diff --git a/lctt2020.md b/lctt2020.md new file mode 100644 index 0000000000..ededeb7081 --- /dev/null +++ b/lctt2020.md @@ -0,0 +1,64 @@ +# Linux 中国旗下贡献者组织 LCTT 七年回顾和展望 + +> 这是一篇 LCTT 七周年的纪念文章,也是 LCTT 承前启后的一个里程碑。 + +### 写在 LCTT 七年之际 + +在 7 年前的今天,我并没有想到,在一个偶然的机会下诞生的 LCTT,它能走过这么长的时间,留下这么多的印痕。是的,一些老朋友或许记得,LCTT 这个 Linux 中国旗下的最主要的开源活动/组成部分,最初只是我发心想完善 man 的中文翻译而产生的副产品。结果,man 中文翻译项目没有做成,而 LCTT 却持续地运营了下来。 + +虽然,这些年 LCTT 屡有改进和完善,但是总体来说还是相对保守。当然,LCTT 这些年已经陆续有 400 多位贡献者实质性的参与了贡献,并在此基础上创建了几个 SIG(特别兴趣小组),如[红帽代码英雄 SIG](https://linux.cn/article-12436-1.html)、漫画 SIG、LFS SIG 等。 + +作为回顾,我来介绍一下 LCTT 这 7 年间在主项目(TranslateProject)上取得的成就: + +- 贡献者: [435 位](https://linux.cn/lctt-list) +- 翻译文章:[5687 篇](https://linux.cn/) +- GitHub 提交:[54629 次](https://github.com/LCTT/TranslateProject) +- GitHub 拉取请求:[19243 次](https://github.com/LCTT/TranslateProject/pulls) + +这是 LCTT 主项目的提交图: + +![](https://postimg.aliavv.com/mbp/uglsc.png) + +这其中,[钻石级的贡献者有 5 名,五星级贡献者有 6 名,13 位 4 星贡献者](https://linux.cn/lctt-list)。那么,请让我来用一段视频展示一下 LCTT 七年来的历程: + +![](https://img.linux.net.cn/static/video/LCTT%207%20Years.mp4) + +当然,整体的贡献水平呈现长尾分布,大部分贡献者浅尝辄止,我想除了贡献者存在着体验的心态之外,也与 LCTT 没有建立起来合适的社区引导和激励机制有关。此外,就开源社区/开源项目而言,我们也存在一些不足,比如,按 GitHub 建议,我们在如下社区建设方面还缺乏: + +- 社区行为准则 +- 贡献指南 +- 议题模板 +- 拉取请求模板 + +因此,在写这篇文章时,我也要宣布一件事,就是我会逐渐淡出 LCTT 的日常管理,改组 LCTT 管理团队,将更多未来的可能交给社区成员来建设,也希望新的社区管理团队可以为 LCTT 创造出一个不同的明天。 + +以下,请我们的 Linux 中国的核心合伙人 Bestony 来介绍一下今后 LCTT 的发展计划。 + +--- + +大家好,我是 Bestony,感谢老王数年来的坚持不懈的投入,正是有老王的坚守,才能有我们如今的成就。在接下来的时间里,我将会帮助老王,更好的运作 LCTT,让老王可以喘口气,也为 LCTT 带来一些新的气象。 + +在过去的七年里,我们 LCTT 做了很多事情,我们翻译了数千篇文章,有数百位技能精湛的贡献者。如今,到了 7 年的这个节点上,我也在思考,我们下一步应该怎么走。 + +其实,在过去的一年里,LCTT 的问题在不断的浮现:选题方向单一、译者进入门槛较高、大家翻译的质量水平参差不齐、校对的人手不足、译稿外发的反馈不足,这些问题都是我们在过去遇见,但一直没有足够的精力和人力来解决的问题。不过,如今我将加入到 LCTT 的管理团队中,配合老王,一起一个个的解决这些过去遇见的问题。 + +![](https://postimg.aliavv.com/mbp/3kfwy.png) + +对于这些问题,有一些我们已经在解决,比如“**选题方向单一**”,在今年的年初,LCTT 与红帽公司(RedHat)[联合建立了 LCRH SIG](https://linux.cn/article-12436-1.html),面向红帽旗下的原创播客《[代码英雄](https://www.redhat.com/en/command-line-heroes) Command Line Heroes》进行定向的翻译,目前,第一季度的翻译成功已经全部在 Linux 中国公众号上发布,而第二、三季度的内容,也正在不断的发布过程中。 + +![](https://postimg.aliavv.com/mbp/71eup.png) + +LCTT - SIG 将是后续的新的发展方向。**我们将会在保留 LCTT 主体的基础上,鼓励各位译者探索更多的兴趣方向,通过建立起不同的 SIG,引入更多的翻译内容,来帮助大家更好的达成自己想要的翻译目标。** 并且,通过 LCTT 的技术和经验,赋能每一位译者,帮助译者更好的学习、了解各种不同领域的知识。 + +而在“**进入门槛较高**”方面,一直以来 Github 的访问慢问题、Git 的概念不熟悉等问题,都是困扰不少新同学的点。而也正是这些点,在不断制约着 LCTT 的发展。在将来,我希望 LCTT 可以打造出自己的翻译工具(也将会为之而奋斗),通过工具辅助的方式,帮助更多人走上翻译的道路,让更多的爱好者们,可以为中文的技术环境贡献一份力。 + +![](https://postimg.aliavv.com/mbp/8183e.png) + +后续,我们将会引入翻译工具、自建关键词表、多轮校对手段等方案,帮助更多的译者完成自己的翻译文章,通过翻译,学到自己想要的知识。 + +当然,问题并不止我点出来的这些,我们能发展到今天,一定有很多做对了的地方,但同样,我们也有做错了的地方。欢迎你随时联系我,讨论你对于 LCTT 下一步的想法,我相信,你的意见能够帮助 LCTT 变得更好。 + +![](https://postimg.aliavv.com/mbp/aq5m9.png) + +最后,**千里之行,始于足下**,刚刚走过 7 年的 LCTT, 希望我们可以在下一个七年,再次相遇。 + diff --git a/published/20190115 Linux Desktop Setup - HookRace Blog.md b/published/20190115 Linux Desktop Setup - HookRace Blog.md new file mode 100644 index 0000000000..4efb833a04 --- /dev/null +++ b/published/20190115 Linux Desktop Setup - HookRace Blog.md @@ -0,0 +1,523 @@ +[#]: collector: (lujun9972) +[#]: translator: (chenmu-kk) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12883-1.html) +[#]: subject: (Linux Desktop Setup · HookRace Blog) +[#]: via: (https://hookrace.net/blog/linux-desktop-setup/) +[#]: author: (Dennis Felsing http://felsin9.de/nnis/) + +十年 Linux 桌面生存指南 +====== + +![](https://img.linux.net.cn/data/attachment/album/202012/03/223817smrej5qwsbqjb3vs.jpg) + +从 2006 年开始转战 Linux 系统后,经过几年的实践,我的软件设置在过去十年内出人意料的固定。再过十年回顾一下,看看发生了什么,也许会非常有趣。在写这篇推文时,我迅速回顾了正在运行的内容: + +![htop overview][2] + +### 动机 + +我的软件介绍排序不分先后: + + * 程序应该运行在本地系统中以便我可以控制它,这其中并不包括云解决方案。 + * 程序应在终端中运行,以便于在任何地方连贯地使用它们,包括性能稍差的电脑或手机。 + * 通过使用终端软件,可以实现自动聚焦键盘。只有在一些有意义的地方,我会更喜欢使用鼠标,因为在打字期间一直伸手去拿鼠标感觉像在浪费时间。有时候过了一个小时我才注意到甚至还没有插鼠标。 + * 最好使用快速高效的软件,我不喜欢听到风扇的声音和感到房间在变热。我还可以继续长久地运行旧硬件,已经使用了 10 年的 Thinkpad x200s 还能很好地支持我所使用的软件。 + * 组合。我不想手动执行每个步骤,而是在需要时自动执行更多操作,这时自然是支持 shell。 + +### 操作系统 + +十二年前移除 Windows 系统后,我在 Linux 系统上经历了一个艰难的开始,当时我手上只有 [Gentoo Linux][3] 系统的安装光盘和一本打印的说明书,要用它们来实现一个可运行的 Linux 系统。虽然花费了几天的时间去编译和修整,但最终还是觉得自己受益颇多。 + +自此我再也没有转回 Windows 系统,但在持续的编译压力导致风扇失灵后,我将我的电脑系统切换到 [Arch Linux][4]。之后我将其他的电脑和私人服务器也切换到了 Arch Linux。作为一个滚动发布发行版,你可以随时升级软件包,但 [Arch Linux News][5] 已经详细报道了其中最主要的漏洞。 + +不过,令人烦恼的是一旦你更新了旧的内核模组,Arch Linux 就会移除旧版的相关信息。我经常注意到一旦我试着插入一个 USB 闪存盘,内核就无法加载相关组件。相反,每次内核升级后都应该进行重启。有一些 [方法][6] 可以解决这个问题,但我还没有实际地使用它们。 + +其他程序也会出现类似的情况,通常 Firefox 、 cron 或者 Samba 在升级后都需要重启,但恼人的是,它们没有警告你存在这种情况。我在工作中使用的 [SUSE][7] 很好地提醒了这种情况。 + +对于 [DDNet][8] 产品服务器,相较于 Arch Linux ,我更倾向于 [Debian][9] 系统,这样在每次升级时出现故障的几率更低。我的防火墙和路由器使用了 [OpenBSD][10] ,它拥有干净系统、文档和强大的 [pf 防火墙][11],而我现在不需要一个单独的路由器。 + +### 窗口管理器 + +从我开始使用 Gentoo 后,我很快注意到 KDE 的编译时间非常长,这让我没办法继续使用它。我四处寻找更简单的解决方案,最初使用了 [Openbox][12] 和 [Fluxbox][13]。某次,为了能更多进行纯键盘操作,我开始尝试转入平铺窗口管理器,并在研究其初始版本的时候学习了 [dwm][14] 和 [awesome][15]。 + +最终,由于 [xmonad][16]的灵活性、可扩展性以及使用纯 [Haskell][17](一种出色的函数编程语言)编写和配置,最终选择了它。一个例子是,我在家中运行一个 40" 4K 的屏幕,但经常会将它分为四个虚拟屏幕,每个虚拟屏幕显示一个工作区,每个工作区自动排列在我的窗口上。当然, xmonad 有一个对应的 [模块][18]。 + +[dzen][19] 和 [conky][20] 对我来说是一个非常简单的状态栏。我的整体 conky 配置看起来是这样的: + +``` +out_to_console yes +update_interval 1 +total_run_times 0 + +TEXT +${downspeed eth0} ${upspeed eth0} | $cpu% ${loadavg 1} ${loadavg 2} ${loadavg 3} $mem/$memmax | ${time %F %T} +``` + +输入命令直接通过管道输入 dzen2: + +``` +conky | dzen2 -fn '-xos4-terminus-medium-r-normal-*-12-*-*-*-*-*-*-*' -bg '#000000' -fg '#ffffff' -p -e '' -x 1000 -w 920 -xs 1 -ta r +``` + +对我而言,一项重要功能是在完成工作后使终端发出蜂鸣声。只需要简单地在 zsh 中的 `PR_TITLEBAR` 变量中添加一个 `\a` 字符就可以做到,只要工作完成就可以发出蜂鸣声。当然,我使用了命令: + +``` +echo "blacklist pcspkr" > /etc/modprobe.d/nobeep.conf +``` + +将 `pcspkr` 内核模块列入黑名单来禁用实际的蜂鸣声。相反 urxvt 的 `URxvt.urgentOnBell: true` 设置会将声音变为尖锐。之后 xmonad 有一个 urgency 钩子来捕捉这类信号,并且我可以使用组合键自动聚焦到当前的发出紧急信号的窗口。在 dzen 中我可以看到一个漂亮且明亮的 `#ff0000` 紧急窗口。 + +在我笔记本上所得到的最终成品是: + +![Laptop screenshot][22] + +我听说前几年 [i3][23] 变得非常流行,但它要求更多的手动窗口对齐而不是自动对齐。 + +我意识到也有像 [tmux][24] 那样的终端多路复用器,但我仍想要一些图形化应用程序,因此最终我没有有效地使用它们。 + +### 终端连续性 + +为了使终端保持活跃状态,我使用了 [dtach][25] ,它只是模拟屏幕分离功能。为了使计算机上的每个终端都可连接和断开,我编写了一个小的封装脚本。 这意味着,即使必须重新启动 X 服务器,我也可以使所有终端都运行良好,包括本地和远程终端。 + +### Shell & 编程 + +对于 shell,我使用 [zsh][28] 而不是 [bash][27],因为它有众多的功能。 + +作为终端模拟,我发现 [urxvt][29] 足够轻巧,支持 Unicode 编码和 256 色,具有出色的性能。另一个重要的功能是可以分别运行 urxvt 客户端和守护进程。因此,即使大量终端也几乎不占用任何内存(回滚缓冲区除外)。 + +对我而言,只有一种字体看起来绝对干净和完美: [Terminus][30]。 由于它是位图字体,因此所有内容都是完美像素,渲染速度极快且 CPU 使用率低。为了能使用 `CTRL-WIN-[1-7]` 在每个终端按需切换字体,我的 `~/.Xdefaults` 包含: + +``` +URxvt.font: -xos4-terminus-medium-r-normal-*-14-*-*-*-*-*-*-* +dzen2.font: -xos4-terminus-medium-r-normal-*-14-*-*-*-*-*-*-* + +URxvt.keysym.C-M-1: command:\033]50;-xos4-terminus-medium-r-normal-*-12-*-*-*-*-*-*-*\007 +URxvt.keysym.C-M-2: command:\033]50;-xos4-terminus-medium-r-normal-*-14-*-*-*-*-*-*-*\007 +URxvt.keysym.C-M-3: command:\033]50;-xos4-terminus-medium-r-normal-*-18-*-*-*-*-*-*-*\007 +URxvt.keysym.C-M-4: command:\033]50;-xos4-terminus-medium-r-normal-*-22-*-*-*-*-*-*-*\007 +URxvt.keysym.C-M-5: command:\033]50;-xos4-terminus-medium-r-normal-*-24-*-*-*-*-*-*-*\007 +URxvt.keysym.C-M-6: command:\033]50;-xos4-terminus-medium-r-normal-*-28-*-*-*-*-*-*-*\007 +URxvt.keysym.C-M-7: command:\033]50;-xos4-terminus-medium-r-normal-*-32-*-*-*-*-*-*-*\007 + +URxvt.keysym.C-M-n: command:\033]10;#ffffff\007\033]11;#000000\007\033]12;#ffffff\007\033]706;#00ffff\007\033]707;#ffff00\007 +URxvt.keysym.C-M-b: command:\033]10;#000000\007\033]11;#ffffff\007\033]12;#000000\007\033]706;#0000ff\007\033]707;#ff0000\007 +``` + +对于编程和书写,我使用 [Vim][31] 语法高亮显示和 [ctags][32] 进行索引,以及一些带有 `grep` 、`sed` 和其他用于搜索和操作的常用终端窗口。这可能不像 IDE 那样舒适,但可以实现更多的自动化。 + +Vim 的一个问题是你已经习惯了它的键映射,因此希望在任何地方都使用它们。 + +在 shell 功能不够强大时,[Python][33] 和 [Nim][34] 作为脚本语言也不错。 + +### 系统监控 + +[htop][35] (查看当前站点的后台运行,是托管服务器的实时视图)非常适合快速了解软件的当前运行状态。 [lm_sensors][36] 可以监控硬件温度、风扇和电压。 [powertop][37] 是一款由 Intel 发布的优秀省电小工具。 [ncdu][38] 可以交互式分析磁盘使用情况。 + +[nmap][39]、 iptraf-ng、 [tcpdump][40] 和 [Wireshark][41] 都是分析网络问题的基本工具。 + +当然还有很多更优秀的工具。 + +### 邮件 & 同步 + +在我的家庭服务器上,我为自己所有的邮箱账号运行了 [fetchmail][42] 守护进程。fetchmail 只是检索收到的邮件并调用 [procmail][43]: + +``` +#!/bin/sh +for i in /home/deen/.fetchmail/*; do + FETCHMAILHOME=$i /usr/bin/fetchmail -m 'procmail -d %T' -d 60 +done +``` + +配置非常简单,然后等待服务器通知我们有新的邮件: + +``` +poll imap.1und1.de protocol imap timeout 120 user "dennis@felsin9.de" password "XXX" folders INBOX keep ssl idle +``` + +我的 `.procmailrc` 配置包含一些备份全部邮件的规则,并将邮件整理在对应的目录下面。例如,基于邮件列表名或者邮件标题: + +``` +MAILDIR=/home/deen/shared/Maildir +LOGFILE=$HOME/.procmaillog +LOGABSTRACT=no +VERBOSE=off +FORMAIL=/usr/bin/formail +NL=" +" + +:0wc +* ! ? test -d /media/mailarchive/`date +%Y` +| mkdir -p /media/mailarchive/`date +%Y` + +# Make backups of all mail received in format YYYY/YYYY-MM +:0c +/media/mailarchive/`date +%Y`/`date +%Y-%m` + +:0 +* ^From: .*(.*@.*.kit.edu|.*@.*.uka.de|.*@.*.uni-karlsruhe.de) +$MAILDIR/.uni/ + +:0 +* ^list-Id:.*lists.kit.edu +$MAILDIR/.uni-ml/ + +[...] +``` + +我使用 [msmtp][44] 来发送邮件,它也很好配置: + +``` +account default +host smtp.1und1.de +tls on +tls_trust_file /etc/ssl/certs/ca-certificates.crt +auth on +from dennis@felsin9.de +user dennis@felsin9.de +password XXX + +[...] +``` + +但是到目前为止,邮件还在服务器上。 我的文档全部存储在一个目录中,我使用 [Unison][45] 在所有计算机之间进行同步。Unison 可以视为双向交互式 [rsync][46],我的邮件是这个文件目录下的一部分,因此它们最终存储在我的电脑上。 + +这也意味着,尽管邮件会立即到达我的邮箱,但我只是按需拿取,而不是邮件一到达时就立即收到通知。 + +从此我使用 [mutt][47] 阅读邮件,使用侧边栏显示我的邮件目录。 `/etc/mailcap` 文件对于显示非纯文本邮件( HTML, Word 或者 PDF)不可或缺: + +``` +text/html;w3m -I %{charset} -T text/html; copiousoutput +application/msword; antiword %s; copiousoutput +application/pdf; pdftotext -layout /dev/stdin -; copiousoutput +``` + +### 新闻 & 通讯 + +[Newsboat][48] 是一个非常棒的终端 RSS/Atom 阅读器。我在一个有约 150 个提要的 `tach` 会话服务器上运行它。也可以在本地选择提要,例如: + +``` +ignore-article "https://forum.ddnet.tw/feed.php" "title =~ \"Map Testing •\" or title =~ \"Old maps •\" or title =~ \"Map Bugs •\" or title =~ \"Archive •\" or title =~ \"Waiting for mapper •\" or title =~ \"Other mods •\" or title =~ \"Fixes •\"" +``` + +我以同样的方式使用 [Irssi][49] 进行 IRC 通讯。 + +### 日历 + +[remind][50] 是一个可以从命令行获取的日历。通过编辑 `rem` 文件可以设置新的提醒: + +``` +# One time events +REM 2019-01-20 +90 Flight to China %b + +# Recurring Holidays +REM 1 May +90 Holiday "Tag der Arbeit" %b +REM [trigger(easterdate(year(today()))-2)] +90 Holiday "Karfreitag" %b + +# Time Change +REM Nov Sunday 1 --7 +90 Time Change (03:00 -> 02:00) %b +REM Apr Sunday 1 --7 +90 Time Change (02:00 -> 03:00) %b + +# Birthdays +FSET birthday(x) "'s " + ord(year(trigdate())-x) + " birthday is %b" +REM 16 Apr +90 MSG Andreas[birthday(1994)] + +# Sun +SET $LatDeg 49 +SET $LatMin 19 +SET $LatSec 49 +SET $LongDeg -8 +SET $LongMin -40 +SET $LongSec -24 + +MSG Sun from [sunrise(trigdate())] to [sunset(trigdate())] +[...] +``` + +遗憾的是,目前 remind 中还没有中国农历的提醒功能,因此中国的节日不易计算。 + +我给提醒设置了两个名字: + +``` +rem -m -b1 -q -g +``` + +按时间顺序查看待办事项清单 + +``` +rem -m -b1 -q -cuc12 -w$(($(tput cols)+1)) | sed -e "s/\f//g" | less +``` + +显示适应终端宽度的日历: + +![remcal][51] + +### 字典 + +[rdictcc][52] 是鲜为人知的字典工具,它可以使用 [dict.cc][53] 很棒的词典并将他们转存在本地数据库中: + +``` +$ rdictcc rasch +====================[ A => B ]==================== +rasch: + - apace + - brisk [speedy] + - cursory + - in a timely manner + - quick + - quickly + - rapid + - rapidly + - sharpish [Br.] [coll.] + - speedily + - speedy + - swift + - swiftly +rasch [gehen]: + - smartly [quickly] +Rasch {n} [Zittergras-Segge]: + - Alpine grass [Carex brizoides] + - quaking grass sedge [Carex brizoides] +Rasch {m} [regional] [Putzrasch]: + - scouring pad +====================[ B => A ]==================== +Rasch model: + - Rasch-Modell {n} +``` + +### 记录和阅读 + +我有一个简单记录任务的备忘录,在 Vim 会话中基本上一直处于打开状态。我也使用备忘录作为工作中“已完成”工作的记录,这样就可以检查自己每天完成了哪些任务。 + +对于写文件、信件和演示文稿,我会使用 [LaTeX][54] 进行高级排版。德式的简单信件可以这样设置,例如: + +``` +\documentclass[paper = a4, fromalign = right]{scrlttr2} +\usepackage{german} +\usepackage{eurosym} +\usepackage[utf8]{inputenc} +\setlength{\parskip}{6pt} +\setlength{\parindent}{0pt} + +\setkomavar{fromname}{Dennis Felsing} +\setkomavar{fromaddress}{Meine Str. 1\\69181 Leimen} +\setkomavar{subject}{Titel} + +\setkomavar*{enclseparator}{Anlagen} + +\makeatletter +\@setplength{refvpos}{89mm} +\makeatother + +\begin{document} +\begin{letter} {Herr Soundso\\Deine Str. 2\\69121 Heidelberg} +\opening{Sehr geehrter Herr Soundso,} + +Sie haben bei mir seit dem Bla Bla Bla. + +Ich fordere Sie hiermit zu Bla Bla Bla auf. + +\closing{Mit freundlichen Grüßen} + +\end{letter} +\end{document} +``` + +在 [我的私人网站][55] 上可以找到更多的示例文档和演示文稿。 + +[Zathura][56] 读取 PDF 文件速度很快,支持 Vim 类控件,还支持两种不同的 PDF 后端: Poppler 和 MuPDF。另一方面,在偶尔遇到 Zathura 无法打开的文件时,[Evince][57] 则显得更全能一些。 + +### 图片编辑 + +简便的选择是,[GIMP][58] 和 [Inkscape][59] 分别用于照片编辑和交互式向量图形。 + +有时 [Imagemagick][60] 已经足够好了,它可以从命令行直接使用,从而自动编辑图片。同样 [Graphviz][61] 和 [TikZ][62] 可以用来绘制曲线图和其他图表。 + +### Web 浏览器 + +对于 Web 浏览器,我一直在使用 [Firefox][63]。相较于 Chrome,它的可扩展性更好,资源使用率更低。 + +不幸的是,在 Firefox 完全改用 Chrome 风格的扩展之后, [Pentadactyl][64] 扩展的开发就停止了,所以我的浏览器中再也没有令人满意的 Vim 类控件了。 + +### 媒体播放器 + +通过设置 `vo=gpu` 以及 `hwdec=vaapi`,具有硬件解码功能的 [mpv][65] 在播放期间 CPU 的占用率保持在 5%。相较于默认的 PulseAudio,mpv 中的 `audio-channels=2` 似乎可以使我的立体扬声器/耳机获得更清晰的降级混频。一个很棒的小功能是用 `Shift-Q` 退出,而不是只用 `Q` 来保存回放位置。当你与母语是其他语言的人一起看视频时,你可以使用 `--secondary-sid=` 同时显示两种字幕,主字幕位于底部,次字幕位于屏幕顶部。 + +我的无线鼠标可以简单地通过一个小的配置文件( `~/.config/mpv/input.conf` )实现远程控制 mpv : + +``` +MOUSE_BTN5 run "mixer" "pcm" "-2" +MOUSE_BTN6 run "mixer" "pcm" "+2" +MOUSE_BTN1 cycle sub-visibility +MOUSE_BTN7 add chapter -1 +MOUSE_BTN8 add chapter 1 +``` + +[youtube-dl][66] 非常适合观看在线托管的视频,使用 `-f bestvideo+bestaudio/best --all-subs --embed-subs` 命令可获得最高质量的视频。 + +作为音乐播放器, [MOC][67] 不再活跃开发,但它仍是一个简易的播放器,可以播放各种可能的格式,包括最不常用的 Chiptune 格式。在 AUR 中有一个 [补丁][68] 增加了 PulseAudio 支持。即使在 CPU 时钟频率降到 800 MHz, MOC 也只使用了单核 CPU 的 1-2% 。 + +![moc][69] + +我的音乐收藏夹保存在我的家庭服务器上,因此我可以从任何地方访问它。它使用 [SSHFS][70] 挂载并自动安装在 `/etc/fstab/` 目录下: + +``` +root@server:/media/media /mnt/media fuse.sshfs noauto,x-systemd.automount,idmap=user,IdentityFile=/root/.ssh/id_rsa,allow_other,reconnect 0 0 +``` + +### 跨平台构建 + +除了 Linux 本身,它对于构建任何主流操作系统的软件包都很优秀! 一开始,我使用 [QEMU][71] 与旧版 Debian、 Windows 以及 Mac OS X VM 一起构建这些平台。 + +现在我在旧版 Debian 发行版上转而使用 chroot (以获得最大的 Linux 兼容性),在 Windows 上使用 [MinGW][72] 进行交叉编译,在 Mac OS X 上则使用 [OSXCross][73]。 + +用于 [构建 DDNet][74] 的脚本以及 [更新库构建的说明][75] 的脚本都基于这个。 + +### 备份 + +通常,我们都会忘记备份。即使这是最后一节,它也不应该成为事后诸葛。 + +十年前我写了 [rrb][76] (反向 rsync 备份)重新封装了 `rsync` ,因此我只需要将备份服务器的 root SSH 权限授予正在备份的计算机。令人惊讶地是,尽管我一直在使用 rrb ,但它在过去十年里没有任何改变。 + +备份文件直接存储在文件系统中。使用硬链接实现增量备份(`--link-dest`)。一个简单的 [配置][77] 定义了备份保存时间,默认为: + +``` +KEEP_RULES=( \ + 7 7 \ # One backup a day for the last 7 days + 31 8 \ # 8 more backups for the last month + 365 11 \ # 11 more backups for the last year +1825 4 \ # 4 more backups for the last 5 years +) +``` + +因为我的一些计算机没有静态 IP / DNS 但仍想使用 rrb 备份,那我会使用反向安全隧道(作为 systemd 服务): + +``` +[Unit] +Description=Reverse SSH Tunnel +After=network.target + +[Service] +ExecStart=/usr/bin/ssh -N -R 27276:localhost:22 -o "ExitOnForwardFailure yes" server +KillMode=process +Restart=always + +[Install] +WantedBy=multi-user.target +``` + +现在,隧道运行备份时,服务器可以通过 `ssh -p 27276 localhost` 命令或者使用 `.ssh/config` 到达服务器端。 + +``` +Host cr-remote + HostName localhost + Port 27276 +``` + +在谈及 SSH 技巧时,有时由于某些中断的路由会很难访问到服务器。在那种情况下你可以借道其他服务器的 SSH 连接,以获得更好的路由。在这种情况下,你可能通过美国连接访问到我的中国服务器,而来自德国的不可靠连接可能需要几个周: + +``` +Host chn.ddnet.tw + ProxyCommand ssh -q usa.ddnet.tw nc -q0 chn.ddnet.tw 22 + Port 22 +``` + +### 结语 + +感谢阅读我工具的收藏。这其中我也许遗漏了许多日常中自然成习惯的步骤。让我们来看看我的软件设置在下一年里能多稳定吧。如果你有任何问题,随时联系我 [dennis@felsin9.de][78] 。 + +在 [Hacker News][79] 下评论吧。 + +-------------------------------------------------------------------------------- + +via: https://hookrace.net/blog/linux-desktop-setup/ + +作者:[Dennis Felsing][a] +选题:[lujun9972][b] +译者:[chenmu-kk](https://github.com/chenmu-kk) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: http://felsin9.de/nnis/ +[b]: https://github.com/lujun9972 +[1]: https://hookrace.net/public/linux-desktop/htop_small.png +[2]: https://hookrace.net/public/linux-desktop/htop.png +[3]: https://gentoo.org/ +[4]: https://www.archlinux.org/ +[5]: https://www.archlinux.org/news/ +[6]: https://www.reddit.com/r/archlinux/comments/4zrsc3/keep_your_system_fully_functional_after_a_kernel/ +[7]: https://www.suse.com/ +[8]: https://ddnet.tw/ +[9]: https://www.debian.org/ +[10]: https://www.openbsd.org/ +[11]: https://www.openbsd.org/faq/pf/ +[12]: http://openbox.org/wiki/Main_Page +[13]: http://fluxbox.org/ +[14]: https://dwm.suckless.org/ +[15]: https://awesomewm.org/ +[16]: https://xmonad.org/ +[17]: https://www.haskell.org/ +[18]: http://hackage.haskell.org/package/xmonad-contrib-0.15/docs/XMonad-Layout-LayoutScreens.html +[19]: http://robm.github.io/dzen/ +[20]: https://github.com/brndnmtthws/conky +[21]: https://hookrace.net/public/linux-desktop/laptop_small.png +[22]: https://hookrace.net/public/linux-desktop/laptop.png +[23]: https://i3wm.org/ +[24]: https://github.com/tmux/tmux/wiki +[25]: http://dtach.sourceforge.net/ +[26]: https://github.com/def-/tach/blob/master/tach +[27]: https://www.gnu.org/software/bash/ +[28]: http://www.zsh.org/ +[29]: http://software.schmorp.de/pkg/rxvt-unicode.html +[30]: http://terminus-font.sourceforge.net/ +[31]: https://www.vim.org/ +[32]: http://ctags.sourceforge.net/ +[33]: https://www.python.org/ +[34]: https://nim-lang.org/ +[35]: https://hisham.hm/htop/ +[36]: http://lm-sensors.org/ +[37]: https://01.org/powertop/ +[38]: https://dev.yorhel.nl/ncdu +[39]: https://nmap.org/ +[40]: https://www.tcpdump.org/ +[41]: https://www.wireshark.org/ +[42]: http://www.fetchmail.info/ +[43]: http://www.procmail.org/ +[44]: https://marlam.de/msmtp/ +[45]: https://www.cis.upenn.edu/~bcpierce/unison/ +[46]: https://rsync.samba.org/ +[47]: http://www.mutt.org/ +[48]: https://newsboat.org/ +[49]: https://irssi.org/ +[50]: https://www.roaringpenguin.com/products/remind +[51]: https://hookrace.net/public/linux-desktop/remcal.png +[52]: https://github.com/tsdh/rdictcc +[53]: https://www.dict.cc/ +[54]: https://www.latex-project.org/ +[55]: http://felsin9.de/nnis/research/ +[56]: https://pwmt.org/projects/zathura/ +[57]: https://wiki.gnome.org/Apps/Evince +[58]: https://www.gimp.org/ +[59]: https://inkscape.org/ +[60]: https://imagemagick.org/Usage/ +[61]: https://www.graphviz.org/ +[62]: https://sourceforge.net/projects/pgf/ +[63]: https://www.mozilla.org/en-US/firefox/new/ +[64]: https://github.com/5digits/dactyl +[65]: https://mpv.io/ +[66]: https://rg3.github.io/youtube-dl/ +[67]: http://moc.daper.net/ +[68]: https://aur.archlinux.org/packages/moc-pulse/ +[69]: https://hookrace.net/public/linux-desktop/moc.png +[70]: https://github.com/libfuse/sshfs +[71]: https://www.qemu.org/ +[72]: http://www.mingw.org/ +[73]: https://github.com/tpoechtrager/osxcross +[74]: https://github.com/ddnet/ddnet-scripts/blob/master/ddnet-release.sh +[75]: https://github.com/ddnet/ddnet-scripts/blob/master/ddnet-lib-update.sh +[76]: https://github.com/def-/rrb/blob/master/rrb +[77]: https://github.com/def-/rrb/blob/master/config.example +[78]: mailto:dennis@felsin9.de +[79]: https://news.ycombinator.com/item?id=18979731 diff --git a/published/20190524 Dual booting Windows and Linux using UEFI.md b/published/20190524 Dual booting Windows and Linux using UEFI.md new file mode 100644 index 0000000000..9c701f6487 --- /dev/null +++ b/published/20190524 Dual booting Windows and Linux using UEFI.md @@ -0,0 +1,103 @@ +[#]: collector: (lujun9972) +[#]: translator: (robsean) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12891-1.html) +[#]: subject: (Dual booting Windows and Linux using UEFI) +[#]: via: (https://opensource.com/article/19/5/dual-booting-windows-linux-uefi) +[#]: author: (Alan Formy-Duval https://opensource.com/users/alanfdoss/users/ckrzen) + +使用 UEFI 双启动 Windows 和 Linux +====== + +> 这是一份在同一台机器上设置 Linux 和 Windows 双重启动的速成解释,使用统一可扩展固件接口(UEFI)。 + +![](https://img.linux.net.cn/data/attachment/album/202012/06/101431eb02wvkk0nzkk5sw.jpg) + +我将强调一些重要点,而不是一步一步地指导你来如何配置你的系统以实现双重启动。作为一个示例,我将提到我在几个月之前新买的笔记本计算机。我先是安装 [Ubuntu Linux][2] 到整个硬盘中,这就摧毁了预装的 [Windows 10][3] 环境。几个月后,我决定安装一个不同的 Linux 发行版 [Fedora Linux][4],也决定在双重启动配置中与它一起再次安装 Windows 10 。我将强调一些极其重要的实际情况。让我们开始吧! + +### 固件 + +双重启动不仅仅是软件问题。或者说它算是软件的问题,因为它需要更改你的固件,以告诉你的机器如何开始启动程序。这里有一些和固件相关的重要事项要铭记于心。 + +#### UEFI vs BIOS + +在尝试安装前,确保你的固件配置是最佳的。现在出售的大多数计算机有一个名为 [统一可扩展固件接口][5]Unified Extensible Firmware Interface (UEFI)的新类型固件,UEFI 差不多取代了另一个名为 [基本输入输出系统][6]Basic Input Output System(BIOS)的固件类型,(包括很多固件供应商在内的很多人)通常称 BIOS 为传统启动模式Legacy Boot。 + +我不需要 BIOS,所以我选择了 UEFI 模式。 + +#### 安全启动 + +另一个重要的设置是安全启动Secure Boot。这个功能将检测启动路径是否被篡改,并阻止未经批准的操作系统的启动。现在,我禁用这个选项来确保我能够安装 Fedora Linux 。依据 Fedora 项目维基“[功能/安全启动][7]”部分的介绍可知:Fedora Linux 在安全启动选项启用的时候也可以工作。这对其它的 Linux 发行版来说可能有所不同 — 我打算今后重新研究这项设置。 + +简而言之,如果你发现在这项设置启用时你不能安装你的 Linux 操作系统,那么禁用安全启动并再次重新尝试安装。 + +### 对启动驱动器进行分区 + +如果你选择双重启动并且两个操作系统都在同一个驱动器上,那么你必须将它分成多个分区。即使你使用两个不同的驱动器进行双重启动,出于各种各样的原因,大多数 Linux 环境也最好分成几个基本的分区。这里有一些选项值得考虑。 + +#### GPT vs MBR + +如果你决定手动分区你的启动驱动器,在动手前,我建议使用[GUID 分区表][8]GUID Partition Table(GPT),而不是使用旧的[主启动记录][9]Master Boot Record(MBR) 。这种更改的原因之一是:MBR 有两个特定的限制,而 GPT 却没有: + + * MBR 可以最多拥有 15 个分区,而 GPT 可以最多拥有 128 个分区。 + * MBR 最多仅支持 2 TB 磁盘,而 GPT 使用 64 位地址,这使得它最多支持 800 万 TB 的磁盘。 + +如果你最近购买过硬盘,那么你可能会知道现代的很多硬盘都超过了 2 TB 的限制。 + +#### EFI 系统分区 + +如果你正在进行一次全新的安装或使用一块新的驱动器,那么这里可能没有可以开始的分区。在这种情况下,操作系统安装程序将先创建一个分区,即[EFI 系统分区][10]EFI System Partition(ESP)。如果你选择使用一个诸如 [gdisk][11] 之类的工具来手动分区你的驱动器,你将需要使用一些参数来创建这个分区。基于现有的 ESP ,我设置它为约 500 MB 的大小,并分配它为 `ef00`( EFI 系统 )分区类型。UEFI 规范要求格式化为 FAT32/msdos ,很可能是因为这种格式被大量的操作系统所支持。 + +![分区][12] + +### 操作系统安装 + +在你完成先前的两个任务后,你就可以安装你的操作系统了。虽然我在这里关注的是 Windows 10 和 Fedora Linux ,当安装其它组合时的过程也是非常相似。 + +#### Windows 10 + +我开始 Windows 10 的安装,并创建了一个 20 GB 的 Windows 分区。因为我先前在我的笔记本计算机上安装了 Linux ,所以驱动器已经有了一个 ESP ,我选择保留它。我删除所有的现有 Linux 和交换分区来开始一次全新安装,然后开始我的 Windows 安装。Windows 安装程序自动创建另一个 16 MB 的小分区,称为 [微软保留分区][13]Microsoft Reserved Partition(MSR)。在这完成后,在 512 GB 启动驱动器上仍然有大约 400 GB 的未分配空间。 + +接下来,我继续完成了 Windows 10 安装过程。随后我重新启动到 Windows 来确保它是工作的,在操作系统第一次启动时,创建我的用户账号,设置 Wi-Fi ,并完成其它必须的任务。 + +#### Fedora Linux + +接下来,我将心思转移到安装 Linux 。我开始了安装过程,当安装进行到磁盘配置的步骤时,我确保不会更改 Windows NTFS 和 MSR 分区。我也不会更改 ESP ,但是我设置它的挂载点为 `/boot/efi`。然后我创建常用的 ext4 格式分区, `/`(根分区)、`/boot` 和 `/home`。我创建的最后一个分区是 Linux 的交换分区(swap)。 + +像安装 Windows 一样,我继续完成了 Linux 安装,随后重新启动。令我高兴的是,在启动时[大一统启动加载程序][14]GRand Unified Boot Loader(GRUB)菜单提供选择 Windows 或 Linux 的选项,这意味着我不需要再做任何额外的配置。我选择 Linux 并完成了诸如创建我的用户账号等常规步骤。 + +### 总结 + +总体而言,这个过程是不难的,在过去的几年里,从 BIOS 过渡到 UEFI 有一些困难需要解决,加上诸如安全启动等功能的引入。我相信我们现在已经克服了这些障碍,可以可靠地设置多重启动系统。 + +我不再怀念 [Linux LOader][15](LILO)! + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/5/dual-booting-windows-linux-uefi + +作者:[Alan Formy-Duval][a] +选题:[lujun9972][b] +译者:[robsean](https://github.com/robsean) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/alanfdoss/users/ckrzen +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/linux_keyboard_desktop.png?itok=I2nGw78_ (Linux keys on the keyboard for a desktop computer) +[2]: https://www.ubuntu.com +[3]: https://www.microsoft.com/en-us/windows +[4]: https://getfedora.org +[5]: https://en.wikipedia.org/wiki/Unified_Extensible_Firmware_Interface +[6]: https://en.wikipedia.org/wiki/BIOS +[7]: https://fedoraproject.org/wiki/Features/SecureBoot +[8]: https://en.wikipedia.org/wiki/GUID_Partition_Table +[9]: https://en.wikipedia.org/wiki/Master_boot_record +[10]: https://en.wikipedia.org/wiki/EFI_system_partition +[11]: https://sourceforge.net/projects/gptfdisk/ +[12]: /sites/default/files/u216961/gdisk_screenshot_s.png +[13]: https://en.wikipedia.org/wiki/Microsoft_Reserved_Partition +[14]: https://en.wikipedia.org/wiki/GNU_GRUB +[15]: https://en.wikipedia.org/wiki/LILO_(boot_loader) diff --git a/published/20191118 Creating a Chat Bot with Recast.AI.md b/published/20191118 Creating a Chat Bot with Recast.AI.md new file mode 100644 index 0000000000..e878ea1bc2 --- /dev/null +++ b/published/20191118 Creating a Chat Bot with Recast.AI.md @@ -0,0 +1,164 @@ +[#]: collector: (lujun9972) +[#]: translator: (alim0x) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12878-1.html) +[#]: subject: (Creating a Chat Bot with Recast.AI) +[#]: via: (https://opensourceforu.com/2019/11/creating-a-chat-bot-with-recast-ai/) +[#]: author: (Athira Lekshmi C.V https://opensourceforu.com/author/athira-lekshmi/) + +用 Recast.AI 创建一个聊天机器人 +====== + +[![][1]][2] + +> 据 Gartner 2018 年 2 月的报告,“到 2020 年,25% 的客户服务和支持业务将在参与渠道中整合虚拟客户助理(VCA)或聊天机器人技术,而 2017 年只有不到 2%。”鉴于此,读者会发现本教程对理解开源的 Recast.AI 机器人创建平台的工作原理很有帮助。 + +聊天机器人,包括基于语音的以及其他技术的,已经实际使用了有一阵子了。从让用户参与谋杀解密游戏,到帮助完成房地产交易和医疗诊断,聊天机器人已经跨越了多个领域。 + +有许多平台可以让用户创建和部署机器人。Recast.AI(在被 SAP 收购之后现在是 SAP Conversational AI)是其中的先行者。 + +酷炫的界面、协作性以及它所提供的分析工具,让它成为流行的选择。 + +正如 Recast 官方网站说的,“它是一个创建、训练、部署和监控智能机器人的终极协作平台。” + +### 创建一个基础的机器人 + +让我们来看看如何在 Recast 创建一个基础的机器人。 + + 1. 在 https://cai.tools.sap 创建一个账户。注册可以使用电子邮箱或者 Github 账户。 + 2. 在你登录之后,你会进入仪表板。点击右上角 “+” 新建机器人图标新建一个机器人。 + 3. 在下一个界面,你会看到一系列可选的预定义技能。暂时选择问候Greetings”(图 1)。这个机器人已经经过训练,能够理解基本的问候。 + ![图 1: 设置机器人属性][3] + 4. 给机器人提供一个名字。目前来说,你可以让机器人讲一些笑话,所以我们将它命名为 Joke Bot,选择英语作为默认语言。 + 5. 因为你不会处理任何敏感信息,所以在数据策略下选择非个人数据。然后选择公共机器人选项并点击创建一个机器人。 + +所以这就是你在 Recast 平台创建的机器人。 + +### 开发一个机器人的五个阶段 + +用 Recast 官方博客的话说,在机器人的生命中有五个阶段。 + + * 训练——教授机器人需要理解的内容 + * 构建——使用机器人构建工具创建你的对话流 + * 编写代码——将机器人连接到外部 API 或数据库 + * 连接——将机器人发布到一个或多个消息平台 + * 监控——训练机器人让它更敏锐,并且了解其使用情况 + +### 通过意图训练机器人 + +你可以在仪表板上看到搜索、分叉或创建一个意图intent的选项。“‘意图’是一系列含义相同但构造不同的表达。‘意图’是你的机器人理解能力的核心。每个‘意图’代表了机器人可以理解的一种想法。”(摘自 Recast.AI 网站) + +![图 2: 机器人面板][4] + +就像先前定的,你需要一个讲笑话的机器人。所以底线是这个机器人可以理解用户在要求它讲笑话,它不应该在用户仅仅说了“Hi”的情况下回复一个笑话——这可不妙。把用户可能说的话进行分组,比如: + +``` +Tell me a joke.(给我讲个笑话。) +Tell me a funny fact.(告诉我一个有趣的事实。) +Can you crack a joke?(你可以讲个笑话吗?) +What’s funny today?(今天有什么有趣的?) +``` +…… + +在继续从头开始创建意图之前,让我们来看看搜索/分叉选项。在搜索框输入 “Joke”(图 3)。系统给出了全球的 Recast 用户创建的公开的意图清单,这就是为什么说 Recast 天然就是协作性质的。所以其实没有必要从头开始创建所有的意图,可以在已经创建的基础上进行构建。这就降低了训练具有常见意图的机器人所需的投入。 + +![图 3: 搜索一个意图][5] + + * 选择列表中的第一个意图并将其分叉到机器人上。 + * 点击分叉Fork按钮。这个意图就添加到了机器人中(图 4)。 + ![图 4: @joke 意图][6] + * 点击意图 @joke,会显示出这个意图中已经存在的表达expression列表(图 5)。 + ![图 5: 预定义表达][7] + * 向其添加更多的表达(图 6)。 + ![图 6: 建议的表达][8] + +添加了一些表达之后,机器人会给出一些建议,像图 7 展示的那样。选择几个将它们添加到意图中。你还可以根据机器人的上下文,标记你自己的自定义实体来检测关键词。 + +![图 7: 建议的表达][9] + +### 技能 + +技能skill是一块有明确目的的对话,机器人可以据此运行并达到目标。它可以像打招呼那么简单,也可以更复杂,比如基于用户提供的信息提供电影建议。 + +技能需要的不能只是一对问答,它需要多次交互。比如考虑一个帮你学习汇率的机器人。它一开始会问原货币,然后是目标货币,最后给出准确回应。结合技能可以创建复杂的对话流。 + +下面是如何给笑话机器人创建技能: + + * 去到 构建(Build) 页。点击 “+” 图标创建技能。 + * 给技能命名 “Joke”(图 8) + ![图 8: 技能面板][10] + * 创建之后,点击这个技能。你会看到四个标签。读我Read me触发器Triggers需求Requirements动作Actions。 + * 切换到需求页面。只有在笑话意图存在的时候,你才应该存储信息。所以,像图 9 那样添加一个需求。 + ![图 9: 添加一个触发器][11] + +由于这个简单的使用范例,你不需要在需求选项卡中考虑任何特定的需求,但可以考虑只有当某些关键字或实体出现时才需要触发响应的情况——在这种情况下你需要需求。 + +需求是某个技能执行动作之前需要检索的意图或实体。需求是对话中机器人可以使用的重要信息。例如用户的姓名或位置。一旦一个需求完成,相关的值就会存储在机器人的内存中,供整个对话使用。 + +现在让我们转到动作页面设置回应response(参见图 10)。 + +![图 10: 添加动作][12] + +点击添加新消息组new message group。然后选择发送消息Send message并添加一条文本消息,在这个例子中可以是任何笑话。当然,你肯定不想让你的机器人每次都说一样的笑话,你可以添加多条消息,每次从中随机选择一条。 + +![图 11: 添加文本消息][13] + +### 频道集成 + +一个成功的机器人还依赖于它的易得性。Recast 有不少的内置消息频道集成,如 Skype for Business、Kik Messenger、Telegram、Line、Facebook Messenger、Slack、Alexa 等等。除此之外,Recast 还提供了 SDK 用于开发自定义的频道。 + +此外,Recast 还提供一个可立即使用的网页聊天(在连接页面中)。你可以自定义颜色主题、标题、机器人头像等。它给你提供了一个可以添加到页面的脚本标签。你的界面现在就可以使用了(图 12)。 + +![图 12: 设置网络聊天][14] + +网页聊天的代码是开源的,开发者可以更方便地定制外观、标准回应类型等等。面板提供了如何将机器人部署到各种频道的逐步过程说明。这个笑话机器人部署在 Telegram 和网页聊天上,就像图 13 展示的那样。 + +![图 13: 网页聊天部署][15] + +![图 14: Telegram 中开发的机器人][16] + +### 还有更多 + +Recast 支持多语言,创建机器人的时候选择一个语言作为基础,但之后你有选项可以添加更多你想要的语言。 + +![图 15: 多语言机器人][17] + +这里的例子是一个简单的静态笑话机器人,实际使用中可能需要更多的和不同系统的交互。Recast 有 Web 钩子功能,用户可以连接到不同的系统来获取回应。同时它还有详细的 API 文档来帮助使用平台的每个独立功能。 + +至于分析,Recast 有一个监控面板,帮助你了解机器人的准确度以及更加深入地训练机器人。 + +-------------------------------------------------------------------------------- + +via: https://opensourceforu.com/2019/11/creating-a-chat-bot-with-recast-ai/ + +作者:[Athira Lekshmi C.V][a] +选题:[lujun9972][b] +译者:[alim0x](https://github.com/alim0x) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensourceforu.com/author/athira-lekshmi/ +[b]: https://github.com/lujun9972 +[1]: https://i0.wp.com/opensourceforu.com/wp-content/uploads/2019/04/Build-ChatBoat.jpg?resize=696%2C442&ssl=1 (Build ChatBoat) +[2]: https://i0.wp.com/opensourceforu.com/wp-content/uploads/2019/04/Build-ChatBoat.jpg?fit=900%2C572&ssl=1 +[3]: https://i1.wp.com/opensourceforu.com/wp-content/uploads/2019/11/Figure-1-Setting-the-bot-properties.jpg +[4]: https://i1.wp.com/opensourceforu.com/wp-content/uploads/2019/11/Figure-2-Setting-the-bot-properties.jpg +[5]: https://i0.wp.com/opensourceforu.com/wp-content/uploads/2019/11/Figure-3-Searching-an-intent.jpg +[6]: https://i0.wp.com/opensourceforu.com/wp-content/uploads/2019/11/Figure-4-@joke-intent.jpg +[7]: https://i0.wp.com/opensourceforu.com/wp-content/uploads/2019/11/Figure-5-Predefined-expressions.jpg +[8]: https://i2.wp.com/opensourceforu.com/wp-content/uploads/2019/11/Figure-6-Suggested-expressions.jpg +[9]: https://i1.wp.com/opensourceforu.com/wp-content/uploads/2019/11/Figure-7-Suggested-expressions.jpg +[10]: https://i0.wp.com/opensourceforu.com/wp-content/uploads/2019/11/Figure-8-Skills-dashboard.jpg +[11]: https://i0.wp.com/opensourceforu.com/wp-content/uploads/2019/11/Figure-9-Adding-a-trigger.jpg +[12]: https://i0.wp.com/opensourceforu.com/wp-content/uploads/2019/11/Figure-10-Adding-actions.jpg +[13]: https://i1.wp.com/opensourceforu.com/wp-content/uploads/2019/11/Figure-11-Adding-text-messages.jpg +[14]: https://i2.wp.com/opensourceforu.com/wp-content/uploads/2019/11/Figure-12-Setting-up-webchat.jpg +[15]: https://i0.wp.com/opensourceforu.com/wp-content/uploads/2019/11/Figure-13-Webchat-deployed.jpg +[16]: https://i2.wp.com/opensourceforu.com/wp-content/uploads/2019/11/Figure-14-Bot-deployed-in-Telegram.jpg +[17]: https://i1.wp.com/opensourceforu.com/wp-content/uploads/2019/11/Figure-15-Multi-language-bot.jpg +[18]: https://secure.gravatar.com/avatar/d24503a2a0bb8bd9eefe502587d67323?s=100&r=g +[19]: https://opensourceforu.com/author/athira-lekshmi/ +[20]: https://opensourceforu.com/wp-content/uploads/2019/11/assoc.png +[21]: https://feedburner.google.com/fb/a/mailverify?uri=LinuxForYou&loc=en_US diff --git a/published/20180503 How the four components of a distributed tracing system work together.md b/published/202002/20180503 How the four components of a distributed tracing system work together.md similarity index 100% rename from published/20180503 How the four components of a distributed tracing system work together.md rename to published/202002/20180503 How the four components of a distributed tracing system work together.md diff --git a/published/20180511 MidnightBSD Could Be Your Gateway to FreeBSD.md b/published/202002/20180511 MidnightBSD Could Be Your Gateway to FreeBSD.md similarity index 100% rename from published/20180511 MidnightBSD Could Be Your Gateway to FreeBSD.md rename to published/202002/20180511 MidnightBSD Could Be Your Gateway to FreeBSD.md diff --git a/published/202002/20190114 Some Advice for How to Make Emacs Tetris Harder.md b/published/202002/20190114 Some Advice for How to Make Emacs Tetris Harder.md new file mode 100644 index 0000000000..7e06e1b241 --- /dev/null +++ b/published/202002/20190114 Some Advice for How to Make Emacs Tetris Harder.md @@ -0,0 +1,150 @@ +[#]: collector: (lujun9972) +[#]: translator: (lujun9972) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11938-1.html) +[#]: subject: (Some Advice for How to Make Emacs Tetris Harder) +[#]: via: (https://nickdrozd.github.io/2019/01/14/tetris.html) +[#]: author: (nickdrozd https://nickdrozd.github.io) + +如何让 Emacs 俄罗斯方块变得更难 +====== + +你知道吗,Emacs 捆绑了一个俄罗斯方块的实现?只需要输入 `M-x tetris` 就行了。 + +![](https://nickdrozd.github.io/assets/2019-01-14-tetris/tetris-normal.png) + +在对文本编辑器的讨论中,Emacs 鼓吹者经常提到这一点。“没错,但是你那个编辑器能运行俄罗斯方块吗?”我很好奇,这会让大家相信 Emacs 更优秀吗?比如,为什么有人会关心他们是否可以在文本编辑器中玩游戏呢?“没错,但是你那台吸尘器能播放 mp3 吗?” + +有人说,俄罗斯方块总是很有趣的。像 Emacs 中的所有东西一样,它的源代码是开放的,易于检查和修改,因此 **我们可以使它变得更加有趣**。所谓更加有趣,我的意思是更难。 + +让游戏变得更难的一个最简单的方法就是“隐藏下一个块预览”。你无法在知道下一个块会填满空间的情况下有意地将 S/Z 块放在一个危险的位置——你必须碰碰运气,希望出现最好的情况。下面是没有预览的情况(如你所见,没有预览,我做出的某些选择带来了“可怕的后果”): + +![](https://nickdrozd.github.io/assets/2019-01-14-tetris/tetris-no-preview.png) + +预览框由一个名为 `tetris-draw-next-shape` [^1] 的函数设置: + +``` +(defun tetris-draw-next-shape () + (dotimes (x 4) + (dotimes (y 4) + (gamegrid-set-cell (+ tetris-next-x x) + (+ tetris-next-y y) + tetris-blank))) + (dotimes (i 4) + (let ((tetris-shape tetris-next-shape) + (tetris-rot 0)) + (gamegrid-set-cell (+ tetris-next-x + (aref (tetris-get-shape-cell i) 0)) + (+ tetris-next-y + (aref (tetris-get-shape-cell i) 1)) + tetris-shape)))) +``` + +首先,我们引入一个标志,决定是否允许显示下一个预览块 [^2]: + +``` +(defvar tetris-preview-next-shape nil + "When non-nil, show the next block the preview box.") +``` + +现在的问题是,我们如何才能让 `tetris-draw-next-shape` 遵从这个标志?最明显的方法是重新定义它: + +``` +(defun tetris-draw-next-shape () + (when tetris-preview-next-shape + ;; existing tetris-draw-next-shape logic + )) +``` + +但这不是理想的解决方案。同一个函数有两个定义,这很容易引起混淆,如果上游版本发生变化,我们必须维护修改后的定义。 + +一个更好的方法是使用 **advice**。Emacs 的 advice 类似于 **Python 装饰器**,但是更加灵活,因为 advice 可以从任何地方添加到函数中。这意味着我们可以修改函数而不影响原始的源文件。 + +有很多不同的方法使用 Emacs advice([查看手册][4]),但是这里我们只使用 `advice-add` 函数和 `:around` 标志。advice 函数将原始函数作为参数,原始函数可能执行也可能不执行。我们这里,我们让原始函数只有在预览标志是非空的情况下才能执行: + +``` +(defun tetris-maybe-draw-next-shape (tetris-draw-next-shape) + (when tetris-preview-next-shape + (funcall tetris-draw-next-shape))) + +(advice-add 'tetris-draw-next-shape :around #'tetris-maybe-draw-next-shape) +``` + +这段代码将修改 `tetris-draw-next-shape` 的行为,而且它可以存储在配置文件中,与实际的俄罗斯方块代码分离。 + +去掉预览框是一个简单的改变。一个更激烈的变化是,**让块随机停止在空中**: + +![](https://nickdrozd.github.io/assets/2019-01-14-tetris/tetris-air.png) + +本图中,红色的 I 和绿色的 T 部分没有掉下来,它们被固定下来了。这会让游戏变得 **极其困难**,但却很容易实现。 + +和前面一样,我们首先定义一个标志: + +``` +(defvar tetris-stop-midair t + "If non-nil, pieces will sometimes stop in the air.") +``` + +目前,**Emacs 俄罗斯方块的工作方式** 类似这样子:活动部件有 x 和 y 坐标。在每个时钟滴答声中,y 坐标递增(块向下移动一行),然后检查是否有与现存的块重叠。如果检测到重叠,则将该块回退(其 y 坐标递减)并设置该活动块到位。为了让一个块在半空中停下来,我们所要做的就是破解检测函数 `tetris-test-shape`。 + +**这个函数内部做什么并不重要** —— 重要的是它是一个返回布尔值的无参数函数。我们需要它在正常情况下返回布尔值 true(否则我们将出现奇怪的重叠情况),但在其他时候也需要它返回 true。我相信有很多方法可以做到这一点,以下是我的方法的: + +``` +(defun tetris-test-shape-random (tetris-test-shape) + (or (and + tetris-stop-midair + ;; Don't stop on the first shape. + (< 1 tetris-n-shapes ) + ;; Stop every INTERVAL pieces. + (let ((interval 7)) + (zerop (mod tetris-n-shapes interval))) + ;; Don't stop too early (it makes the game unplayable). + (let ((upper-limit 8)) + (< upper-limit tetris-pos-y)) + ;; Don't stop at the same place every time. + (zerop (mod (random 7) 10))) + (funcall tetris-test-shape))) + +(advice-add 'tetris-test-shape :around #'tetris-test-shape-random) +``` + +这里的硬编码参数使游戏变得更困难,但仍然可玩。当时我在飞机上喝醉了,所以它们可能需要进一步调整。 + +顺便说一下,根据我的 `tetris-scores` 文件,我的 **最高分** 是: + +``` +01389 Wed Dec 5 15:32:19 2018 +``` + +该文件中列出的分数默认最多为五位数,因此这个分数看起来不是很好。 + +### 给读者的练习 + +1. 使用 advice 修改 Emacs 俄罗斯方块,使得每当方块下移动时就闪烁显示讯息 “OH SHIT”。消息的大小与块堆的高度成比例(当没有块时,消息应该很小的或不存在的,当最高块接近天花板时,消息应该很大)。 +2. 在这里给出的 `tetris-test-shape-random` 版本中,每隔七格就有一个半空中停止。一个玩家有可能能计算出时间间隔,并利用它来获得优势。修改它,使间隔随机在一些合理的范围内(例如,每 5 到 10 格)。 +3. 另一个对使用 Tetris 使用 advise 的场景,你可以试试 [autotetris-mode][1]。 +4. 想出一个有趣的方法来打乱块的旋转机制,然后使用 advice 来实现它。 + +[^1]: Emacs 只有一个巨大的全局命名空间,因此函数和变量名一般以包名做前缀以避免冲突。 +[^2]: 很多人会说你不应该使用已有的命名空间前缀而且应该将自己定义的所有东西都放在一个预留的命名空间中,比如像这样 `my/tetris-preview-next-shape`,然而这样很难看而且没什么意义,因此我不会这么干。 + +-------------------------------------------------------------------------------- + +via: https://nickdrozd.github.io/2019/01/14/tetris.html + +作者:[nickdrozd][a] +选题:[lujun9972][b] +译者:[lujun9972](https://github.com/lujun9972) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://nickdrozd.github.io +[b]: https://github.com/lujun9972 +[1]: https://nullprogram.com/blog/2014/10/19/ +[2]: https://nickdrozd.github.io/2019/01/14/tetris.html#fn.1 +[3]: https://nickdrozd.github.io/2019/01/14/tetris.html#fn.2 +[4]: https://www.gnu.org/software/emacs/manual/html_node/elisp/Advising-Functions.html +[5]: https://nickdrozd.github.io/2019/01/14/tetris.html#fnr.1 +[6]: https://nickdrozd.github.io/2019/01/14/tetris.html#fnr.2 diff --git a/translated/tech/20190116 Zipping files on Linux- the many variations and how to use them.md b/published/202002/20190116 Zipping files on Linux- the many variations and how to use them.md similarity index 93% rename from translated/tech/20190116 Zipping files on Linux- the many variations and how to use them.md rename to published/202002/20190116 Zipping files on Linux- the many variations and how to use them.md index 81731f464c..fbd32f20ca 100644 --- a/translated/tech/20190116 Zipping files on Linux- the many variations and how to use them.md +++ b/published/202002/20190116 Zipping files on Linux- the many variations and how to use them.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (wxy) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11913-1.html) [#]: subject: (Zipping files on Linux: the many variations and how to use them) [#]: via: (https://www.networkworld.com/article/3333640/linux/zipping-files-on-linux-the-many-variations-and-how-to-use-them.html) [#]: author: (Sandra Henry-Stocker https://www.networkworld.com/author/Sandra-Henry_Stocker/) @@ -12,13 +12,13 @@ > 除了压缩和解压缩文件外,你还可以使用 zip 命令执行许多有趣的操作。这是一些其他的 zip 选项以及它们如何提供帮助。 -![](https://images.idgesg.net/images/article/2019/01/zipper-100785364-large.jpg) +![](https://img.linux.net.cn/data/attachment/album/202002/21/120507ox11ak23f9x2hxaq.jpg) 为了节省一些磁盘空间并将文件打包在一起进行归档,我们中的一些人已经在 Unix 和 Linux 系统上压缩文件数十年了。即使这样,并不是所有人都尝试过一些有趣的压缩工具的变体。因此,在本文中,我们将介绍标准的压缩和解压缩以及其他一些有趣的压缩选项。 ### 基本的 zip 命令 -首先,让我们看一下基本的 `zip` 命令。它使用了与 `gzip` 基本上相同的压缩算法,但是有一些重要的区别。一方面,`gzip` 命令仅用于压缩单个文件,而 `zip` 既可以压缩文件,也可以将多个文件结合在一起成为归档文件。另外,`gzip` 命令是“就地”压缩。换句话说,它会留下一个压缩文件,而不是原始文件。 这是工作中的 `gzip` 示例: +首先,让我们看一下基本的 `zip` 命令。它使用了与 `gzip` 基本上相同的压缩算法,但是有一些重要的区别。一方面,`gzip` 命令仅用于压缩单个文件,而 `zip` 既可以压缩文件,也可以将多个文件结合在一起成为归档文件。另外,`gzip` 命令是“就地”压缩。换句话说,它会只留下一个压缩文件,而原始文件则没有了。 这是工作中的 `gzip` 示例: ``` $ gzip onefile @@ -26,7 +26,7 @@ $ ls -l -rw-rw-r-- 1 shs shs 10514 Jan 15 13:13 onefile.gz ``` -而这是 `zip`。请注意,此命令要求为压缩存档提供名称,其中 `gzip`(执行压缩操作后)仅使用原始文件名并添加 `.gz` 扩展名。 +而下面是 `zip`。请注意,此命令要求为压缩存档提供名称,其中 `gzip`(执行压缩操作后)仅使用原始文件名并添加 `.gz` 扩展名。 ``` $ zip twofiles.zip file* @@ -61,7 +61,7 @@ $ zip mybin.zip ~/bin/* ### unzip 命令 -`unzip` 命令将从一个 zip 文件中恢复内容,并且,如你所料,原来的 zip 文件还保留在那里,而类似的`gunzip` 命令将仅保留未压缩的文件。 +`unzip` 命令将从一个 zip 文件中恢复内容,并且,如你所料,原来的 zip 文件还保留在那里,而类似的 `gunzip` 命令将仅保留未压缩的文件。 ``` $ unzip twofiles.zip @@ -272,13 +272,13 @@ $ zipnote twofiles.zip @ (zip file comment below this line) ``` -如果要添加注释,请先将 `zipnote` 命令的输出写入文件: +如果要添加注释,请先将 `zipnote` 命令的输出写入到文件: ``` $ zipnote twofiles.zip > comments ``` -接下来,编辑你刚刚创建的文件,将注释插入到 `(comment above this line)` 行上方。然后使用像这样的`zipnote` 命令添加注释: +接下来,编辑你刚刚创建的文件,将注释插入到 `(comment above this line)` 行上方。然后使用像这样的 `zipnote` 命令添加注释: ``` $ zipnote -w twofiles.zip < comments @@ -286,7 +286,7 @@ $ zipnote -w twofiles.zip < comments ### zipsplit 命令 -当归档文件太大时,可以使用 `zipsplit` 命令将一个 zip 归档文件分解为多个 zip 归档文件,这样你就可以将其中某一个文件放到小型 U 盘中。最简单的方法似乎是为每个部分的压缩文件指定最大大小,此大小必须足够大以容纳最大的包含文件。 +当归档文件太大时,可以使用 `zipsplit` 命令将一个 zip 归档文件分解为多个 zip 归档文件,这样你就可以将其中某一个文件放到小型 U 盘中。最简单的方法似乎是为每个部分的压缩文件指定最大大小,此大小必须足够大以容纳最大的所包含的文件。 ``` $ zipsplit -n 12000 twofiles.zip @@ -312,7 +312,7 @@ via: https://www.networkworld.com/article/3333640/linux/zipping-files-on-linux-t 作者:[Sandra Henry-Stocker][a] 选题:[lujun9972][b] 译者:[wxy](https://github.com/wxy) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 diff --git a/published/202002/20190322 12 open source tools for natural language processing.md b/published/202002/20190322 12 open source tools for natural language processing.md new file mode 100644 index 0000000000..ee4bf2e0ec --- /dev/null +++ b/published/202002/20190322 12 open source tools for natural language processing.md @@ -0,0 +1,113 @@ +[#]: collector: (lujun9972) +[#]: translator: (zhangxiangping) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11927-1.html) +[#]: subject: (12 open source tools for natural language processing) +[#]: via: (https://opensource.com/article/19/3/natural-language-processing-tools) +[#]: author: (Dan Barker https://opensource.com/users/barkerd427) + +12 种自然语言处理的开源工具 +====== + +> 让我们看看可以用在你自己的 NLP 应用中的十几个工具吧。 + +![](https://img.linux.net.cn/data/attachment/album/202002/25/103230j77i7zx8uyymj7y3.jpg) + +在过去的几年里,自然语言处理(NLP)推动了聊天机器人、语音助手、文本预测等这些渗透到我们的日常生活中的语音或文本应用程技术的发展。目前有着各种各样开源的 NLP 工具,所以我决定调查一下当前开源的 NLP 工具来帮助你制定开发下一个基于语音或文本的应用程序的计划。 + +尽管我并不熟悉所有工具,但我将从我所熟悉的编程语言出发来介绍这些工具(对于我不熟悉的语言,我无法找到大量的工具)。也就是说,出于各种原因,我排除了三种我熟悉的语言之外的工具。 + +R 语言可能是没有被包含在内的最重要的语言,因为我发现的大多数库都有一年多没有更新了。这并不一定意味着它们没有得到很好的维护,但我认为它们应该得到更多的更新,以便和同一领域的其他工具竞争。我还选择了最有可能用在生产场景中的语言和工具(而不是在学术界和研究中使用),而我主要是使用 R 作为研究和发现工具。 + +我也惊讶地发现 Scala 的很多库都没有更新了。我上次使用 Scala 已经过去了两年了,当时它非常流行。但是大多数库从那个时候就再没有更新过,或者只有少数一些有更新。 + +最后,我排除了 C++。 这主要是因为我上次使用 C++ 编写程序已经有很多年了,而我所工作的组织还没有将 C++ 用于 NLP 或任何数据科学方面的工作。 + +### Python 工具 + +#### 自然语言工具包(NLTK) + +毋庸置疑,[自然语言工具包(NLTK)][2]是我调研过的所有工具中功能最完善的一个。它几乎实现了自然语言处理中多数功能组件,比如分类、令牌化、词干化、标注、分词和语义推理。每一个都有多种不同的实现方式,所以你可以选择具体的算法和方式。同时,它也支持不同的语言。然而,它以字符串的形式表示所有的数据,对于一些简单的数据结构来说可能很方便,但是如果要使用一些高级的功能来说就可能有点困难。它的使用文档有点复杂,但也有很多其他人编写的使用文档,比如[这本很棒的书][3]。和其他的工具比起来,这个工具库的运行速度有点慢。但总的来说,这个工具包非常不错,可以用于需要具体算法组合的实验、探索和实际应用当中。 + +#### SpaCy + +[SpaCy][4] 可能是 NLTK 的主要竞争者。在大多数情况下都比 NLTK 的速度更快,但是 SpaCy 的每个自然语言处理的功能组件只有一个实现。SpaCy 把所有的东西都表示为一个对象而不是字符串,从而简化了应用构建接口。这也方便它与多种框架和数据科学工具的集成,使得你更容易理解你的文本数据。然而,SpaCy 不像 NLTK 那样支持多种语言。它确实接口简单,具有简化的选项集和完备的文档,以及用于语言处理和分析各种组件的多种神经网络模型。总的来说,对于需要在生产中表现出色且不需要特定算法的新应用程序,这是一个很不错的工具。 + +#### TextBlob + +[TextBlob][5] 是 NLTK 的一个扩展库。你可以通过 TextBlob 用一种更简单的方式来使用 NLTK 的功能,TextBlob 也包括了 Pattern 库中的功能。如果你刚刚开始学习,这将会是一个不错的工具,可以用于对性能要求不太高的生产环境的应用。总体来说,TextBlob 适用于任何场景,但是对小型项目尤佳。 + +#### Textacy + +这个工具是我用过的名字最好听的。先重读“ex”再带出“cy”,多读“[Textacy][6]”几次试试。它不仅仅是名字读起来好,同时它本身也是一个很不错的工具。它使用 SpaCy 作为它自然语言处理核心功能,但它在处理过程的前后做了很多工作。如果你想要使用 SpaCy,那么最好使用 Textacy,从而不用去编写额外的附加代码就可以处理不同种类的数据。 + +#### PyTorch-NLP + +[PyTorch-NLP][7] 才出现短短的一年,但它已经有一个庞大的社区了。它适用于快速原型开发。当出现了最新的研究,或大公司或者研究人员推出了完成新奇的处理任务的其他工具时,比如图像转换,它就会被更新。总体来说,PyTorch 的目标用户是研究人员,但它也能用于原型开发,或使用最先进算法的初始生产载荷中。基于此基础上的创建的库也是值得研究的。 + +### Node.js 工具 + +#### Retext + +[Retext][8] 是 [Unified 集合][9]的一部分。Unified 是一个接口,能够集成不同的工具和插件以便它们能够高效的工作。Retext 是 Unified 工具中使用的三种语法之一,另外的两个分别是用于 Markdown 的 Remark 和用于 HTML 的 Rehype。这是一个非常有趣的想法,我很高兴看到这个社区的发展。Retext 没有涉及很多的底层技术,更多的是使用插件去完成你在 NLP 任务中想要做的事情。拼写检查、字形修复、情绪检测和增强可读性都可以用简单的插件来完成。总体来说,如果你不想了解底层处理技术又想完成你的任务的话,这个工具和社区是一个不错的选择。 + +#### Compromise + +[Compromise][10] 显然不是最复杂的工具,如果你正在找拥有最先进的算法和最完备的系统的话,它可能不适合你。然而,如果你想要一个性能好、功能广泛、还能在客户端运行的工具的话,Compromise 值得一试。总体来说,它的名字(“折中”)是准确的,因为作者更关注更具体功能的小软件包,而在功能性和准确性上有所折中,这些小软件包得益于用户对使用环境的理解。 + +#### Natural + +[Natural][11] 包含了常规自然语言处理库所具有的大多数功能。它主要是处理英文文本,但也包括一些其它语言,它的社区也欢迎支持其它的语言。它能够进行令牌化、词干化、分类、语音处理、词频-逆文档频率计算(TF-IDF)、WordNet、字符相似度计算和一些变换。它和 NLTK 有的一比,因为它想要把所有东西都包含在一个包里头,但它更易于使用,而且不一定专注于研究。总的来说,这是一个非常完整的库,目前仍在活跃开发中,但可能需要对底层实现有更多的了解才能完全发挥效力。 + +#### Nlp.js + +[Nlp.js][12] 建立在其他几个 NLP 库之上,包括 Franc 和 Brain.js。它为许多 NLP 组件提供了一个很好的接口,比如分类、情感分析、词干化、命名实体识别和自然语言生成。它也支持一些其它语言,在你处理英语之外的语言时能提供一些帮助。总之,它是一个不错的通用工具,并且提供了调用其他工具的简化接口。在你需要更强大或更灵活的工具之前,这个工具可能会在你的应用程序中用上很长一段时间。 + +### Java 工具 + +#### OpenNLP + +[OpenNLP][13] 是由 Apache 基金会管理的,所以它可以很方便地集成到其他 Apache 项目中,比如 Apache Flink、Apache NiFi 和 Apache Spark。这是一个通用的 NLP 工具,包含了所有 NLP 组件中的通用功能,可以通过命令行或者以包的形式导入到应用中来使用它。它也支持很多种语言。OpenNLP 是一个很高效的工具,包含了很多特性,如果你用 Java 开发生产环境产品的话,它是个很好的选择。 + +#### Stanford CoreNLP + +[Stanford CoreNLP][14] 是一个工具集,提供了统计 NLP、深度学习 NLP 和基于规则的 NLP 功能。这个工具也有许多其他编程语言的版本,所以可以脱离 Java 来使用。它是由高水平的研究机构创建的一个高效的工具,但在生产环境中可能不是最好的。此工具采用双许可证,具有可以用于商业目的的特定许可证。总之,在研究和实验中它是一个很棒的工具,但在生产系统中可能会带来一些额外的成本。比起 Java 版本来说,读者可能对它的 Python 版本更感兴趣。同样,在 Coursera 上最好的机器学习课程之一是斯坦福教授提供的,[点此][15]访问其他不错的资源。 + +#### CogCompNLP + +[CogCompNLP][16] 由伊利诺斯大学开发的一个工具,它也有一个相似功能的 Python 版本。它可以用于处理文本,包括本地处理和远程处理,能够极大地缓解你本地设备的压力。它提供了很多处理功能,比如令牌化、词性标注、断句、命名实体标注、词型还原、依存分析和语义角色标注。它是一个很好的研究工具,你可以自己探索它的不同功能。我不确定它是否适合生产环境,但如果你使用 Java 的话,它值得一试。 + +* * * + +你最喜欢的开源 NLP 工具和库是什么?请在评论区分享文中没有提到的工具。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/3/natural-language-processing-tools + +作者:[Dan Barker][a] +选题:[lujun9972][b] +译者:[zxp](https://github.com/zhangxiangping) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/barkerd427 +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/talk_chat_communication_team.png?itok=CYfZ_gE7 (Chat bubbles) +[2]: http://www.nltk.org/ +[3]: http://www.nltk.org/book_1ed/ +[4]: https://spacy.io/ +[5]: https://textblob.readthedocs.io/en/dev/ +[6]: https://readthedocs.org/projects/textacy/ +[7]: https://pytorchnlp.readthedocs.io/en/latest/ +[8]: https://www.npmjs.com/package/retext +[9]: https://unified.js.org/ +[10]: https://www.npmjs.com/package/compromise +[11]: https://www.npmjs.com/package/natural +[12]: https://www.npmjs.com/package/node-nlp +[13]: https://opennlp.apache.org/ +[14]: https://stanfordnlp.github.io/CoreNLP/ +[15]: https://opensource.com/article/19/2/learn-data-science-ai +[16]: https://github.com/CogComp/cogcomp-nlp diff --git a/published/202002/20190407 Manage multimedia files with Git.md b/published/202002/20190407 Manage multimedia files with Git.md new file mode 100644 index 0000000000..befd819d4f --- /dev/null +++ b/published/202002/20190407 Manage multimedia files with Git.md @@ -0,0 +1,236 @@ +[#]: collector: (lujun9972) +[#]: translator: (svtter) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11889-1.html) +[#]: subject: (Manage multimedia files with Git) +[#]: via: (https://opensource.com/article/19/4/manage-multimedia-files-git) +[#]: author: (Seth Kenlon https://opensource.com/users/seth) + + +通过 Git 来管理多媒体文件 +====== + +> 在我们有关 Git 鲜为人知的用法系列的最后一篇文章中,了解如何使用 Git 跟踪项目中的大型多媒体文件。 + +![](https://img.linux.net.cn/data/attachment/album/202002/13/235436mhub12qhxzmbw11p.png) + +Git 是专用于源代码版本控制的工具。因此,Git 很少被用于非纯文本的项目以及行业。然而,异步工作流的优点是十分诱人的,尤其是在一些日益增长的行业中,这种类型的行业把重要的计算和重要的艺术创作结合起来,这包括网页设计、视觉效果、视频游戏、出版、货币设计(是的,这是一个真实的行业)、教育……等等。还有许多行业属于这个类型。 + +在这个 Git 系列文章中,我们分享了六种鲜为人知的 Git 使用方法。在最后一篇文章中,我们将介绍将 Git 的优点带到管理多媒体文件的软件。 + +### Git 管理多媒体文件的问题 + +众所周知,Git 用于处理非文本文件不是很好,但是这并不妨碍我们进行尝试。下面是一个使用 Git 来复制照片文件的例子: + +``` +$ du -hs +108K . +$ cp ~/photos/dandelion.tif . +$ git add dandelion.tif +$ git commit -m 'added a photo' +[master (root-commit) fa6caa7] two photos + 1 file changed, 0 insertions(+), 0 deletions(-) + create mode 100644 dandelion.tif +$ du -hs +1.8M . +``` + +目前为止没有什么异常。增加一个 1.8MB 的照片到一个目录下,使得目录变成了 1.8 MB 的大小。所以下一步,我们尝试删除文件。 + +``` +$ git rm dandelion.tif +$ git commit -m 'deleted a photo' +$ du -hs +828K . +``` + +在这里我们可以看到有些问题:删除一个已经被提交的文件,还是会使得存储库的大小扩大到原来的 8 倍(从 108K 到 828K)。我们可以测试多次来得到一个更好的平均值,但是这个简单的演示与我的经验一致。提交非文本文件,在一开始花费空间比较少,但是一个工程活跃地时间越长,人们可能对静态内容修改的会更多,更多的零碎文件会被加和到一起。当一个 Git 存储库变的越来越大,主要的成本往往是速度。拉取和推送的时间,从最初抿一口咖啡的时间到你觉得你可能断网了。 + +静态内容导致 Git 存储库的体积不断扩大的原因是什么呢?那些通过文本的构成的文件,允许 Git 只拉取那些修改的部分。光栅图以及音乐文件对 Git 文件而言与文本不同,你可以查看一下 .png 和 .wav 文件中的二进制数据。所以,Git 只不过是获取了全部的数据,并且创建了一个新的副本,哪怕是一张图仅仅修改了一个像素。 + +### Git-portal + +在实践中,许多多媒体项目不需要或者不想追踪媒体的历史记录。相对于文本或者代码的部分,项目的媒体部分一般有一个不同的生命周期。媒体资源一般按一个方向产生:一张图片从铅笔草稿开始,以数字绘画的形式抵达它的目的地。然后,尽管文本能够回滚到早起的版本,但是艺术制品只会一直向前发展。工程中的媒体很少被绑定到一个特定的版本。例外情况通常是反映数据集的图形,通常是可以用基于文本的格式(如 SVG)完成的表、图形或图表。 + +所以,在许多同时包含文本(无论是叙事散文还是代码)和媒体的工程中,Git 是一个用于文件管理的,可接受的解决方案,只要有一个在版本控制循环之外的游乐场来给艺术家游玩就行。 + +![Graphic showing relationship between art assets and Git][2] + +一个启用这个特性的简单方法是 [Git-portal][3],这是一个通过带有 Git 钩子的 Bash 脚本,它可将静态文件从文件夹中移出 Git 的范围,并通过符号链接来取代它们。Git 提交链接文件(有时候称作别名或快捷方式),这种符号链接文件比较小,所以所有的提交都是文本文件和那些代表媒体文件的链接。因为替身文件是符号链接,所以工程还会像预期的运行,因为本地机器会处理他们,转换成“真实的”副本。当用符号链接替换出文件时,Git-portal 维护了项目的结构,因此,如果你认为 Git-portal 不适合你的项目,或者你需要构建项目的一个没有符号链接的版本(比如用于分发),则可以轻松地逆转该过程。 + +Git-portal 也允许通过 `rsync` 来远程同步静态资源,所以用户可以设置一个远程存储位置,来做为一个中心的授权源。 + +Git-portal 对于多媒体的工程是一个理想的解决方案。类似的多媒体工程包括视频游戏、桌面游戏、需要进行大型 3D 模型渲染和纹理的虚拟现实工程、[带图][4]以及 .odt 输出的书籍、协作型的[博客站点][5]、音乐项目,等等。艺术家在应用程序中以图层(在图形世界中)和曲目(在音乐世界中)的形式执行版本控制并不少见——因此,Git 不会向多媒体项目文件本身添加任何内容。Git 的功能可用于艺术项目的其他部分(例如散文和叙述、项目管理、字幕文件、致谢、营销副本、文档等),而结构化远程备份的功能则由艺术家使用。 + +#### 安装 Git-portal + +Git-portal 的 RPM 安装包位于 ,可用于下载和安装。 + +此外,用户可以从 Git-portal 的 Gitlab 主页手动安装。这仅仅是一个 Bash 脚本以及一些 Git 钩子(也是 Bash 脚本),但是需要一个快速的构建过程来让它知道安装的位置。 + +``` +$ git clone https://gitlab.com/slackermedia/git-portal.git git-portal.clone +$ cd git-portal.clone +$ ./configure +$ make +$ sudo make install +``` + +#### 使用 Git-portal + +Git-portal 与 Git 一起使用。这意味着,如同 Git 的所有大型文件扩展一样,都需要记住一些额外的步骤。但是,你仅仅需要在处理你的媒体资源的时候使用 Git-portal,所以很容易记住,除非你把大文件都当做文本文件来进行处理(对于 Git 用户很少见)。使用 Git-portal 必须做的一个安装步骤是: + +``` +$ mkdir bigproject.git +$ cd !$ +$ git init +$ git-portal init +``` + +Git-portal 的 `init` 函数在 Git 存储库中创建了一个 `_portal` 文件夹并且添加到 `.gitignore` 文件中。 + +在平日里使用 Git-portal 和 Git 协同十分平滑。一个较好的例子是基于 MIDI 的音乐项目:音乐工作站产生的项目文件是基于文本的,但是 MIDI 文件是二进制数据: + +``` +$ ls -1 +_portal +song.1.qtr +song.qtr +song-Track_1-1.mid +song-Track_1-3.mid +song-Track_2-1.mid +$ git add song*qtr +$ git-portal song-Track*mid +$ git add song-Track*mid +``` + +如果你查看一下 `_portal` 文件夹,你会发现那里有最初的 MIDI 文件。这些文件在原本的位置被替换成了指向 `_portal` 的链接文件,使得音乐工作站像预期一样运行。 + +``` +$ ls -lG +[...] _portal/ +[...] song.1.qtr +[...] song.qtr +[...] song-Track_1-1.mid -> _portal/song-Track_1-1.mid* +[...] song-Track_1-3.mid -> _portal/song-Track_1-3.mid* +[...] song-Track_2-1.mid -> _portal/song-Track_2-1.mid* +``` + +与 Git 相同,你也可以添加一个目录下的文件。 + +``` +$ cp -r ~/synth-presets/yoshimi . +$ git-portal add yoshimi +Directories cannot go through the portal. Sending files instead. +$ ls -lG _portal/yoshimi +[...] yoshimi.stat -> ../_portal/yoshimi/yoshimi.stat* +``` + +删除功能也像预期一样工作,但是当从 `_portal` 中删除一些东西时,你应该使用 `git-portal rm` 而不是 `git rm`。使用 Git-portal 可以确保文件从 `_portal` 中删除: + +``` +$ ls +_portal/ song.qtr song-Track_1-3.mid@ yoshimi/ +song.1.qtr song-Track_1-1.mid@ song-Track_2-1.mid@ +$ git-portal rm song-Track_1-3.mid +rm 'song-Track_1-3.mid' +$ ls _portal/ +song-Track_1-1.mid* song-Track_2-1.mid* yoshimi/ +``` + +如果你忘记使用 Git-portal,那么你需要手动删除 `_portal` 下的文件: + +``` +$ git-portal rm song-Track_1-1.mid +rm 'song-Track_1-1.mid' +$ ls _portal/ +song-Track_1-1.mid* song-Track_2-1.mid* yoshimi/ +$ trash _portal/song-Track_1-1.mid +``` + +Git-portal 其它的唯一功能,是列出当前所有的链接并且找到里面可能已经损坏的符号链接。有时这种情况会因为项目文件夹中的文件被移动而发生: + +``` +$ mkdir foo +$ mv yoshimi foo +$ git-portal status +bigproject.git/song-Track_2-1.mid: symbolic link to _portal/song-Track_2-1.mid +bigproject.git/foo/yoshimi/yoshimi.stat: broken symbolic link to ../_portal/yoshimi/yoshimi.stat +``` + +如果你使用 Git-portal 用于私人项目并且维护自己的备份,以上就是技术方面所有你需要知道关于 Git-portal 的事情了。如果你想要添加一个协作者或者你希望 Git-portal 来像 Git 的方式来管理备份,你可以创建一个远程位置。 + +#### 增加 Git-portal 远程位置 + +为 Git-portal 增加一个远程位置是通过 Git 已有的远程功能来实现的。Git-portal 实现了 Git 钩子(隐藏在存储库 `.git` 文件夹中的脚本),来寻找你的远程位置上是否存在以 `_portal` 开头的文件夹。如果它找到一个,它会尝试使用 `rsync` 来与远程位置同步文件。Git-portal 在用户进行 Git 推送以及 Git 合并的时候(或者在进行 Git 拉取的时候,实际上是进行一次获取和自动合并),都会执行此操作。 + +如果你仅克隆了 Git 存储库,那么你可能永远不会自己添加一个远程位置。这是一个标准的 Git 过程: + +``` +$ git remote add origin git@gitdawg.com:seth/bigproject.git +$ git remote -v +origin git@gitdawg.com:seth/bigproject.git (fetch) +origin git@gitdawg.com:seth/bigproject.git (push) +``` + +对你的主要 Git 存储库来说,`origin` 这个名字是一个流行的惯例,将其用于 Git 数据是有意义的。然而,你的 Git-portal 数据是分开存储的,所以你必须创建第二个远程位置来让 Git-portal 了解向哪里推送和从哪里拉取。取决于你的 Git 主机,你可能需要一个单独的服务器,因为空间有限的 Git 主机不太可能接受 GB 级的媒体资产。或者,可能你的服务器仅允许你访问你的 Git 存储库而不允许访问外部的存储文件夹: + +``` +$ git remote add _portal seth@example.com:/home/seth/git/bigproject_portal +$ git remote -v +origin git@gitdawg.com:seth/bigproject.git (fetch) +origin git@gitdawg.com:seth/bigproject.git (push) +_portal seth@example.com:/home/seth/git/bigproject_portal (fetch) +_portal seth@example.com:/home/seth/git/bigproject_portal (push) +``` + +你可能不想为所有用户提供服务器上的个人帐户,也不必这样做。为了提供对托管资源库大文件资产的服务器的访问权限,你可以运行一个 Git 前端,比如 [Gitolite][8] 或者你可以使用 `rrsync` (受限的 rsync)。 + +现在你可以推送你的 Git 数据到你的远程 Git 存储库,并将你的 Git-portal 数据到你的远程的门户: + +``` +$ git push origin HEAD +master destination detected +Syncing _portal content... +sending incremental file list +sent 9,305 bytes received 18 bytes 1,695.09 bytes/sec +total size is 60,358,015 speedup is 6,474.10 +Syncing _portal content to example.com:/home/seth/git/bigproject_portal +``` + +如果你已经安装了 Git-portal,并且配置了 `_portal` 的远程位置,你的 `_portal` 文件夹将会被同步,并且从服务器获取新的内容,以及在每一次推送的时候发送新的内容。尽管你不需要进行 Git 提交或者推送来和服务器同步(用户可以使用直接使用 `rsync`),但是我发现对于艺术性内容的改变,提交是有用的。这将会把艺术家及其数字资产集成到工作流的其余部分中,并提供有关项目进度和速度的有用元数据。 + +### 其他选择 + +如果 Git-portal 对你而言太过简单,还有一些用于 Git 管理大型文件的其他选择。[Git 大文件存储][9](LFS)是一个名为 git-media 的停工项目的分支,这个分支由 GitHub 维护和支持。它需要特殊的命令(例如 `git lfs track` 来保护大型文件不被 Git 追踪)并且需要用户维护一个 `.gitattributes` 文件来更新哪些存储库中的文件被 LFS 追踪。对于大文件而言,它**仅**支持 HTTP 和 HTTPS 远程主机。所以你必须配置 LFS 服务器,才能使得用户可以通过 HTTP 而不是 SSH 或 `rsync` 来进行鉴权。 + +另一个相对 LFS 更灵活的选择是 [git-annex][10]。你可以在我的文章 [管理 Git 中大二进制 blob][11] 中了解更多(忽略其中 git-media 这个已经废弃项目的章节,因为其灵活性没有被它的继任者 Git LFS 延续下来)。Git-annex 是一个灵活且优雅的解决方案。它拥有一个细腻的系统来用于添加、删除、移动存储库中的大型文件。因为它灵活且强大,有很多新的命令和规则需要进行学习,所以建议看一下它的[文档][12]。 + +然而,如果你的需求很简单,你可能更加喜欢整合已有技术来进行简单且明显任务的解决方案,则 Git-portal 可能是对于工作而言比较合适的工具。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/4/manage-multimedia-files-git + +作者:[Seth Kenlon][a] +选题:[lujun9972][b] +译者:[svtter](https://github.com/svtter) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/seth +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/video_editing_folder_music_wave_play.png?itok=-J9rs-My (video editing dashboard) +[2]: https://opensource.com/sites/default/files/uploads/git-velocity.jpg (Graphic showing relationship between art assets and Git) +[3]: http://gitlab.com/slackermedia/git-portal.git +[4]: https://www.apress.com/gp/book/9781484241691 +[5]: http://mixedsignals.ml +[6]: mailto:git@gitdawg.com +[7]: mailto:seth@example.com +[8]: https://opensource.com/article/19/4/file-sharing-git +[9]: https://git-lfs.github.com/ +[10]: https://git-annex.branchable.com/ +[11]: https://opensource.com/life/16/8/how-manage-binary-blobs-git-part-7 +[12]: https://git-annex.branchable.com/walkthrough/ diff --git a/published/202002/20190729 How to structure a multi-file C program- Part 1.md b/published/202002/20190729 How to structure a multi-file C program- Part 1.md new file mode 100644 index 0000000000..196892cb41 --- /dev/null +++ b/published/202002/20190729 How to structure a multi-file C program- Part 1.md @@ -0,0 +1,189 @@ +[#]: collector: (lujun9972) +[#]: translator: (mengxinayan) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11935-1.html) +[#]: subject: (How to structure a multi-file C program: Part 1) +[#]: via: (https://opensource.com/article/19/7/structure-multi-file-c-part-1) +[#]: author: (Erik O'Shaughnessy https://opensource.com/users/jnyjnyhttps://opensource.com/users/jnyjnyhttps://opensource.com/users/jim-salterhttps://opensource.com/users/cldxsolutions) + +如何组织构建多文件 C 语言程序(一) +====== + +> 准备好你喜欢的饮料、编辑器和编译器,放一些音乐,然后开始构建一个由多个文件组成的 C 语言程序。 + +![](https://img.linux.net.cn/data/attachment/album/202002/26/214517o5p7q45l2a8jkx4k.jpg) + +大家常说计算机编程的艺术部分是处理复杂性,部分是命名某些事物。此外,我认为“有时需要添加绘图”是在很大程度上是正确的。 + +在这篇文章里,我会编写一个小型 C 程序,命名一些东西,同时处理一些复杂性。该程序的结构大致基于我在 《[如何写一个好的 C 语言 main 函数][2]》 文中讨论的。但是,这次做一些不同的事。准备好你喜欢的饮料、编辑器和编译器,放一些音乐,让我们一起编写一个有趣的 C 语言程序。 + +### 优秀 Unix 程序哲学 + +首先,你要知道这个 C 程序是一个 [Unix][3] 命令行工具。这意味着它运行在(或者可被移植到)那些提供 Unix C 运行环境的操作系统中。当贝尔实验室发明 Unix 后,它从一开始便充满了[设计哲学][4]。用我自己的话来说就是:程序只做一件事,并做好它,并且对文件进行一些操作。虽然“只做一件事,并做好它”是有意义的,但是“对文件进行一些操作”的部分似乎有点儿不合适。 + +事实证明,Unix 中抽象的 “文件” 非常强大。一个 Unix 文件是以文件结束符(EOF)标志为结尾的字节流。仅此而已。文件中任何其它结构均由应用程序所施加而非操作系统。操作系统提供了系统调用,使得程序能够对文件执行一套标准的操作:打开、读取、写入、寻址和关闭(还有其他,但说起来那就复杂了)。对于文件的标准化访问使得不同的程序共用相同的抽象,而且可以一同工作,即使它们是不同的人用不同语言编写的程序。 + +具有共享的文件接口使得构建*可组合的*的程序成为可能。一个程序的输出可以作为另一个程序的输入。Unix 家族的操作系统默认在执行程序时提供了三个文件:标准输入(`stdin`)、标准输出(`stdout`)和标准错误(`stderr`)。其中两个文件是只写的:`stdout` 和 `stderr`。而 `stdin` 是只读的。当我们在常见的 Shell 比如 Bash 中使用文件重定向时,可以看到其效果。 + +``` +$ ls | grep foo | sed -e 's/bar/baz/g' > ack +``` + +这条指令可以被简要地描述为:`ls` 的结果被写入标准输出,它重定向到 `grep` 的标准输入,`grep` 的标准输出重定向到 `sed` 的标准输入,`sed` 的标准输出重定向到当前目录下文件名为 `ack` 的文件中。 + +我们希望我们的程序在这个灵活又出色的生态系统中运作良好,因此让我们编写一个可以读写文件的程序。 + +### 喵呜喵呜:流编码器/解码器概念 + +当我还是一个露着豁牙的孩子懵懵懂懂地学习计算机科学时,学过很多编码方案。它们中的有些用于压缩文件,有些用于打包文件,另一些毫无用处因此显得十分愚蠢。列举最后这种情况的一个例子:[哞哞编码方案][5]。 + +为了让我们的程序有个用途,我为它更新了一个 [21 世纪][6] 的概念,并且实现了一个名为“喵呜喵呜” 的编码方案的概念(毕竟网上大家都喜欢猫)。这里的基本的思路是获取文件并且使用文本 “meow” 对每个半字节(半个字节)进行编码。小写字母代表 0,大写字母代表 1。因为它会将 4 个比特替换为 32 个比特,因此会扩大文件的大小。没错,这毫无意义。但是想象一下人们看到经过这样编码后的惊讶表情。 + +``` +$ cat /home/your_sibling/.super_secret_journal_of_my_innermost_thoughts +MeOWmeOWmeowMEoW... +``` + +这非常棒。 + +### 最终的实现 + +完整的源代码可以在 [GitHub][7] 上面找到,但是我会写下我在编写程序时的思考。目的是说明如何组织构建多文件 C 语言程序。 + +既然已经确定了要编写一个编码和解码“喵呜喵呜”格式的文件的程序时,我在 Shell 中执行了以下的命令 : + +``` +$ mkdir meowmeow +$ cd meowmeow +$ git init +$ touch Makefile     # 编译程序的方法 +$ touch main.c       # 处理命令行选项 +$ touch main.h       # “全局”常量和定义 +$ touch mmencode.c   # 实现对喵呜喵呜文件的编码 +$ touch mmencode.h   # 描述编码 API +$ touch mmdecode.c   # 实现对喵呜喵呜文件的解码 +$ touch mmdecode.h   # 描述解码 API +$ touch table.h      # 定义编码查找表 +$ touch .gitignore   # 这个文件中的文件名会被 git 忽略 +$ git add . +$ git commit -m "initial commit of empty files" +``` + +简单的说,我创建了一个目录,里面全是空文件,并且提交到 git。 + +即使这些文件中没有内容,你依旧可以从它的文件名推断每个文件的用途。为了避免万一你无法理解,我在每条 `touch` 命令后面进行了简单描述。 + +通常,程序从一个简单 `main.c` 文件开始,只有两三个解决问题的函数。然后程序员轻率地向自己的朋友或者老板展示了该程序,然后为了支持所有新的“功能”和“需求”,文件中的函数数量就迅速爆开了。“程序俱乐部”的第一条规则便是不要谈论“程序俱乐部”,第二条规则是尽量减少单个文件中的函数。 + +老实说,C 编译器并不关心程序中的所有函数是否都在一个文件中。但是我们并不是为计算机或编译器写程序,我们是为其他人(有时也包括我们)去写程序的。我知道这可能有些奇怪,但这就是事实。程序体现了计算机解决问题所采用的一组算法,当问题的参数发生了意料之外的变化时,保证人们可以理解它们是非常重要的。当在人们修改程序时,发现一个文件中有 2049 函数时他们会诅咒你的。 + +因此,优秀的程序员会将函数分隔开,将相似的函数分组到不同的文件中。这里我用了三个文件 `main.c`、`mmencode.c` 和 `mmdecode.c`。对于这样小的程序,也许看起来有些过头了。但是小的程序很难保证一直小下去,因此哥忒拓展做好计划是一个“好主意”。 + +但是那些 `.h` 文件呢?我会在后面解释一般的术语,简单地说,它们被称为头文件,同时它们可以包含 C 语言类型定义和 C 预处理指令。头文件中不应该包含任何函数。你可以认为头文件是提供了应用程序接口(API)的定义的一种 `.c` 文件,可以供其它 `.c` 文件使用。 + +### 但是 Makefile 是什么呢? + +我知道下一个轰动一时的应用都是你们这些好孩子们用 “终极代码粉碎者 3000” 集成开发环境来编写的,而构建项目是用 Ctrl-Meta-Shift-Alt-Super-B 等一系列复杂的按键混搭出来的。但是如今(也就是今天),使用 `Makefile` 文件可以在构建 C 程序时帮助做很多有用的工作。`Makefile` 是一个包含如何处理文件的方式的文本文件,程序员可以使用其自动地从源代码构建二进制程序(以及其它东西!) + +以下面这个小东西为例: + +``` +00 # Makefile +01 TARGET= my_sweet_program +02 $(TARGET): main.c +03    cc -o my_sweet_program main.c +``` + +`#` 符号后面的文本是注释,例如 00 行。 + +01 行是一个变量赋值,将 `TARGET` 变量赋值为字符串 `my_sweet_program`。按照惯例,也是我的习惯,所有 `Makefile` 变量均使用大写字母并用下划线分隔单词。 + +02 行包含该步骤recipe要创建的文件名和其依赖的文件。在本例中,构建目标target是 `my_sweet_program`,其依赖是 `main.c`。 + +最后的 03 行使用了一个制表符号(`tab`)而不是四个空格。这是将要执行创建目标的命令。在本例中,我们使用 C 编译器C compiler前端 `cc` 以编译链接为 `my_sweet_program`。 + +使用 `Makefile` 是非常简单的。 + +``` +$ make +cc -o my_sweet_program main.c +$ ls +Makefile  main.c  my_sweet_program +``` + +构建我们喵呜喵呜编码器/解码器的 [Makefile][8] 比上面的例子要复杂,但其基本结构是相同的。我将在另一篇文章中将其分解为 Barney 风格。 + +### 形式伴随着功能 + +我的想法是程序从一个文件中读取、转换它,并将转换后的结果存储到另一个文件中。以下是我想象使用程序命令行交互时的情况: + +``` +$ meow < clear.txt > clear.meow +$ unmeow < clear.meow > meow.tx +$ diff clear.txt meow.tx +$ +``` + +我们需要编写代码以进行命令行解析和处理输入/输出流。我们需要一个函数对流进行编码并将结果写到另一个流中。最后,我们需要一个函数对流进行解码并将结果写到另一个流中。等一下,我们在讨论如何写一个程序,但是在上面的例子中,我调用了两个指令:`meow` 和 `unmeow`?我知道你可能会认为这会导致越变越复杂。 + +### 次要内容:argv[0] 和 ln 指令 + +回想一下,C 语言 main 函数的结构如下: + +``` +int main(int argc, char *argv[]) +``` + +其中 `argc` 是命令行参数的数量,`argv` 是字符指针(字符串)的列表。`argv[0]` 是包含正在执行的程序的文件路径。在 Unix 系统中许多互补功能的程序(比如:压缩和解压缩)看起来像两个命令,但事实上,它们是在文件系统中拥有两个名称的一个程序。这个技巧是通过使用 `ln` 命令创建文件系统链接来实现两个名称的。 + +在我笔记本电脑中 `/usr/bin` 的一个例子如下: + +``` +$ ls -li /usr/bin/git* +3376 -rwxr-xr-x. 113 root root     1.5M Aug 30  2018 /usr/bin/git +3376 -rwxr-xr-x. 113 root root     1.5M Aug 30  2018 /usr/bin/git-receive-pack +... +``` + +这里 `git` 和 `git-receive-pack` 是同一个文件但是拥有不同的名字。我们说它们是相同的文件因为它们具有相同的 inode 值(第一列)。inode 是 Unix 文件系统的一个特点,对它的介绍超越了本文的内容范畴。 + +优秀或懒惰的程序可以通过 Unix 文件系统的这个特点达到写更少的代码但是交付双倍的程序。首先,我们编写一个基于其 `argv[0]` 的值而作出相应改变的程序,然后我们确保为导致该行为的名称创建链接。 + +在我们的 `Makefile` 中,`unmeow` 链接通过以下的方式来创建: + +``` +# Makefile +... +$(DECODER): $(ENCODER) + $(LN) -f $< $@ + ... +``` + +我倾向于在 `Makefile` 中将所有内容参数化,很少使用 “裸” 字符串。我将所有的定义都放置在 `Makefile` 文件顶部,以便可以简单地找到并改变它们。当你尝试将程序移植到新的平台上时,需要将 `cc` 改变为某个 `cc` 时,这会很方便。 + +除了两个内置变量 `$@` 和 `$<` 之外,该步骤recipe看起来相对简单。第一个便是该步骤的目标的快捷方式,在本例中是 `$(DECODER)`(我能记得这个是因为 `@` 符号看起来像是一个目标)。第二个,`$<` 是规则依赖项,在本例中,它解析为 `$(ENCODER)`。 + +事情肯定会变得复杂,但它还在管理之中。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/7/structure-multi-file-c-part-1 + +作者:[Erik O'Shaughnessy][a] +选题:[lujun9972][b] +译者:[萌新阿岩](https://github.com/mengxinayan) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/jnyjnyhttps://opensource.com/users/jnyjnyhttps://opensource.com/users/jim-salterhttps://opensource.com/users/cldxsolutions +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/programming_keyboard_coding.png?itok=E0Vvam7A (Programming keyboard.) +[2]: https://linux.cn/article-10949-1.html +[3]: https://en.wikipedia.org/wiki/Unix +[4]: http://harmful.cat-v.org/cat-v/ +[5]: http://www.jabberwocky.com/software/moomooencode.html +[6]: https://giphy.com/gifs/nyan-cat-sIIhZliB2McAo +[7]: https://github.com/JnyJny/meowmeow +[8]: https://github.com/JnyJny/meowmeow/blob/master/Makefile diff --git a/published/202002/20191022 How to Go About Linux Boot Time Optimisation.md b/published/202002/20191022 How to Go About Linux Boot Time Optimisation.md new file mode 100644 index 0000000000..b6db365389 --- /dev/null +++ b/published/202002/20191022 How to Go About Linux Boot Time Optimisation.md @@ -0,0 +1,208 @@ +[#]: collector: (lujun9972) +[#]: translator: (robsean) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11881-1.html) +[#]: subject: (How to Go About Linux Boot Time Optimisation) +[#]: via: (https://opensourceforu.com/2019/10/how-to-go-about-linux-boot-time-optimisation/) +[#]: author: (B Thangaraju https://opensourceforu.com/author/b-thangaraju/) + +如何进行 Linux 启动时间优化 +====== + +![][2] + +> 快速启动嵌入式设备或电信设备,对于时间要求紧迫的应用程序是至关重要的,并且在改善用户体验方面也起着非常重要的作用。这个文章给予一些关于如何增强任意设备的启动时间的重要技巧。 + +快速启动或快速重启在各种情况下起着至关重要的作用。为了保持所有服务的高可用性和更好的性能,嵌入式设备的快速启动至关重要。设想有一台运行着没有启用快速启动的 Linux 操作系统的电信设备,所有依赖于这个特殊嵌入式设备的系统、服务和用户可能会受到影响。这些设备维持其服务的高可用性是非常重要的,为此,快速启动和重启起着至关重要的作用。 + +一台电信设备的一次小故障或关机,即使只是几秒钟,都可能会对无数互联网上的用户造成破坏。因此,对于很多对时间要求严格的设备和电信设备来说,在它们的设备中加入快速启动的功能以帮助它们快速恢复工作是非常重要的。让我们从图 1 中理解 Linux 启动过程。 + +![图 1:启动过程][3] + +### 监视工具和启动过程 + +在对机器做出更改之前,用户应注意许多因素。其中包括计算机的当前启动速度,以及占用资源并增加启动时间的服务、进程或应用程序。 + +#### 启动图 + +为监视启动速度和在启动期间启动的各种服务,用户可以使用下面的命令来安装: + +``` +sudo apt-get install pybootchartgui +``` + +你每次启动时,启动图会在日志中保存一个 png 文件,使用户能够查看该 png 文件来理解系统的启动过程和服务。为此,使用下面的命令: + +``` +cd /var/log/bootchart +``` + +用户可能需要一个应用程序来查看 png 文件。Feh 是一个面向控制台用户的 X11 图像查看器。不像大多数其它的图像查看器,它没有一个精致的图形用户界面,但它只用来显示图片。Feh 可以用于查看 png 文件。你可以使用下面的命令来安装它: + +``` +sudo apt-get install feh +``` + +你可以使用 `feh xxxx.png` 来查看 png 文件。 + + +![图 2:启动图][4] + +图 2 显示了一个正在查看的引导图 png 文件。 + +#### systemd-analyze + +但是,对于 Ubuntu 15.10 以后的版本不再需要引导图。为获取关于启动速度的简短信息,使用下面的命令: + +``` +systemd-analyze +``` + +![图 3:systemd-analyze 的输出][5] + +图表 3 显示命令 `systemd-analyze` 的输出。 + +命令 `systemd-analyze blame` 用于根据初始化所用的时间打印所有正在运行的单元的列表。这个信息是非常有用的,可用于优化启动时间。`systemd-analyze blame` 不会显示服务类型为简单(`Type=simple`)的服务,因为 systemd 认为这些服务应是立即启动的;因此,无法测量初始化的延迟。 + +![图 4:systemd-analyze blame 的输出][6] + +图 4 显示 `systemd-analyze blame` 的输出。 + +下面的命令打印时间关键的服务单元的树形链条: + +``` +command systemd-analyze critical-chain +``` + +图 5 显示命令 `systemd-analyze critical-chain` 的输出。 + +![图 5:systemd-analyze critical-chain 的输出][7] + +### 减少启动时间的步骤 + +下面显示的是一些可以减少启动时间的各种步骤。 + +#### BUM(启动管理器) + +BUM 是一个运行级配置编辑器,允许在系统启动或重启时配置初始化服务。它显示了可以在启动时启动的每个服务的列表。用户可以打开和关闭各个服务。BUM 有一个非常清晰的图形用户界面,并且非常容易使用。 + +在 Ubuntu 14.04 中,BUM 可以使用下面的命令安装: + +``` +sudo apt-get install bum +``` + +为在 15.10 以后的版本中安装它,从链接 http://apt.ubuntu.com/p/bum 下载软件包。 + +以基本的服务开始,禁用扫描仪和打印机相关的服务。如果你没有使用蓝牙和其它不想要的设备和服务,你也可以禁用它们中一些。我强烈建议你在禁用相关的服务前学习服务的基础知识,因为这可能会影响计算机或操作系统。图 6 显示 BUM 的图形用户界面。 + +![图 6:BUM][8] + +#### 编辑 rc 文件 + +要编辑 rc 文件,你需要转到 rc 目录。这可以使用下面的命令来做到: + +``` +cd /etc/init.d +``` + +然而,访问 `init.d` 需要 root 用户权限,该目录基本上包含的是开始/停止脚本,这些脚本用于在系统运行时或启动期间控制(开始、停止、重新加载、启动启动)守护进程。 + +在 `init.d` 目录中的 `rc` 文件被称为运行控制run control脚本。在启动期间,`init` 执行 `rc` 脚本并发挥它的作用。为改善启动速度,我们可以更改 `rc` 文件。使用任意的文件编辑器打开 `rc` 文件(当你在 `init.d` 目录中时)。 + +例如,通过输入 `vim rc` ,你可以更改 `CONCURRENCY=none` 为 `CONCURRENCY=shell`。后者允许某些启动脚本同时执行,而不是依序执行。 + +在最新版本的内核中,该值应该被更改为 `CONCURRENCY=makefile`。 + +图 7 和图 8 显示编辑 `rc` 文件前后的启动时间比较。可以注意到启动速度有所提高。在编辑 `rc` 文件前的启动时间是 50.98 秒,然而在对 `rc` 文件进行更改后的启动时间是 23.85 秒。 + +但是,上面提及的更改方法在 Ubuntu 15.10 以后的操作系统上不工作,因为使用最新内核的操作系统使用 systemd 文件,而不再是 `init.d` 文件。 + +![图 7:对 rc 文件进行更改之前的启动速度][9] + +![图 8:对 rc 文件进行更改之后的启动速度][10] + +#### E4rat + +E4rat 代表 e4 减少访问时间reduced access time(仅在 ext4 文件系统的情况下)。它是由 Andreas Rid 和 Gundolf Kiefer 开发的一个项目。E4rat 是一个通过碎片整理来帮助快速启动的应用程序。它还会加速应用程序的启动。E4rat 使用物理文件的重新分配来消除寻道时间和旋转延迟,因而达到较高的磁盘传输速度。 + +E4rat 可以 .deb 软件包形式获得,你可以从它的官方网站 http://e4rat.sourceforge.net/ 下载。 + +Ubuntu 默认安装的 ureadahead 软件包与 e4rat 冲突。因此必须使用下面的命令安装这几个软件包: + +``` +sudo dpkg purge ureadahead ubuntu-minimal +``` + +现在使用下面的命令来安装 e4rat 的依赖关系: + +``` +sudo apt-get install libblkid1 e2fslibs +``` + +打开下载的 .deb 文件,并安装它。现在需要恰当地收集启动数据来使 e4rat 工作。 + +遵循下面所给的步骤来使 e4rat 正确地运行并提高启动速度。 + +* 在启动期间访问 Grub 菜单。这可以在系统启动时通过按住 `shift` 按键来完成。 +* 选择通常用于启动的选项(内核版本),并按 `e`。 +* 查找以 `linux /boot/vmlinuz` 开头的行,并在该行的末尾添加下面的代码(在句子的最后一个字母后按空格键):`init=/sbin/e4rat-collect or try - quiet splash vt.handsoff =7 init=/sbin/e4rat-collect +`。 +* 现在,按 `Ctrl+x` 来继续启动。这可以让 e4rat 在启动后收集数据。在这台机器上工作,并在接下来的两分钟时间内打开并关闭应用程序。 +* 通过转到 e4rat 文件夹,并使用下面的命令来访问日志文件:`cd /var/log/e4rat`。 +* 如果你没有找到任何日志文件,重复上面的过程。一旦日志文件就绪,再次访问 Grub 菜单,并对你的选项按 `e`。 +* 在你之前已经编辑过的同一行的末尾输入 `single`。这可以让你访问命令行。如果出现其它菜单,选择恢复正常启动(Resume normal boot)。如果你不知为何不能进入命令提示符,按 `Ctrl+Alt+F1` 组合键。 +* 在你看到登录提示后,输入你的登录信息。 +* 现在输入下面的命令:`sudo e4rat-realloc /var/lib/e4rat/startup.log`。此过程需要一段时间,具体取决于机器的磁盘速度。 +* 现在使用下面的命令来重启你的机器:`sudo shutdown -r now`。 +* 现在,我们需要配置 Grub 来在每次启动时运行 e4rat。 +* 使用任意的编辑器访问 grub 文件。例如,`gksu gedit /etc/default/grub`。 +* 查找以 `GRUB CMDLINE LINUX DEFAULT=` 开头的一行,并在引号之间和任何选项之前添加下面的行:`init=/sbin/e4rat-preload 18`。 +* 它应该看起来像这样:`GRUB CMDLINE LINUX DEFAULT = init=/sbin/e4rat- preload quiet splash`。 +* 保存并关闭 Grub 菜单,并使用 `sudo update-grub` 更新 Grub 。 +* 重启系统,你将发现启动速度有明显变化。 + +图 9 和图 10 显示在安装 e4rat 前后的启动时间之间的差异。可注意到启动速度的提高。在使用 e4rat 前启动所用时间是 22.32 秒,然而在使用 e4rat 后启动所用时间是 9.065 秒。 + +![图 9:使用 e4rat 之前的启动速度][11] + +![图 10:使用 e4rat 之后的启动速度][12] + +### 一些易做的调整 + +使用很小的调整也可以达到良好的启动速度,下面列出其中两个。 + +#### SSD + +使用固态设备而不是普通的硬盘或者其它的存储设备将肯定会改善启动速度。SSD 也有助于加快文件传输和运行应用程序方面的速度。 + +#### 禁用图形用户界面 + +图形用户界面、桌面图形和窗口动画占用大量的资源。禁用图形用户界面是获得良好的启动速度的另一个好方法。 + +-------------------------------------------------------------------------------- + +via: https://opensourceforu.com/2019/10/how-to-go-about-linux-boot-time-optimisation/ + +作者:[B Thangaraju][a] +选题:[lujun9972][b] +译者:[robsean](https://github.com/robsean) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensourceforu.com/author/b-thangaraju/ +[b]: https://github.com/lujun9972 +[1]: https://i0.wp.com/opensourceforu.com/wp-content/uploads/2019/10/Screenshot-from-2019-10-07-13-16-32.png?&ssl=1 (Screenshot from 2019-10-07 13-16-32) +[2]: https://i0.wp.com/opensourceforu.com/wp-content/uploads/2019/10/Screenshot-from-2019-10-07-13-16-32.png?fit=700%2C499&ssl=1 +[3]: https://i2.wp.com/opensourceforu.com/wp-content/uploads/2019/10/fig-1.png?ssl=1 +[4]: https://i0.wp.com/opensourceforu.com/wp-content/uploads/2019/10/fig-2.png?ssl=1 +[5]: https://i1.wp.com/opensourceforu.com/wp-content/uploads/2019/10/fig-3.png?ssl=1 +[6]: https://i0.wp.com/opensourceforu.com/wp-content/uploads/2019/10/fig-4.png?ssl=1 +[7]: https://i2.wp.com/opensourceforu.com/wp-content/uploads/2019/10/fig-5.png?ssl=1 +[8]: https://i0.wp.com/opensourceforu.com/wp-content/uploads/2019/10/fig-6.png?ssl=1 +[9]: https://i2.wp.com/opensourceforu.com/wp-content/uploads/2019/10/fig-7.png?ssl=1 +[10]: https://i1.wp.com/opensourceforu.com/wp-content/uploads/2019/10/fig-8.png?ssl=1 +[11]: https://i2.wp.com/opensourceforu.com/wp-content/uploads/2019/10/fig-9.png?ssl=1 +[12]: https://i0.wp.com/opensourceforu.com/wp-content/uploads/2019/10/fig-10.png?ssl=1 diff --git a/sources/tech/20191204 --acid -words- Handle Chromium - Firefox sessions with org-mode.md b/published/202002/20191204 --acid -words- Handle Chromium - Firefox sessions with org-mode.md similarity index 54% rename from sources/tech/20191204 --acid -words- Handle Chromium - Firefox sessions with org-mode.md rename to published/202002/20191204 --acid -words- Handle Chromium - Firefox sessions with org-mode.md index 7b71e21ff3..31c93609ab 100644 --- a/sources/tech/20191204 --acid -words- Handle Chromium - Firefox sessions with org-mode.md +++ b/published/202002/20191204 --acid -words- Handle Chromium - Firefox sessions with org-mode.md @@ -1,22 +1,24 @@ [#]: collector: (lujun9972) [#]: translator: (lujun9972) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (#:acid 'words: Handle Chromium & Firefox sessions with org-mode) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11926-1.html) +[#]: subject: (Handle Chromium & Firefox sessions with org-mode) [#]: via: (https://acidwords.com/posts/2019-12-04-handle-chromium-and-firefox-sessions-with-org-mode.html) [#]: author: (Sanel Z https://acidwords.com/) -Handle Chromium & Firefox sessions with org-mode +通过 Org 模式管理 Chromium 和 Firefox 会话 ====== -I was big fan of [Session Manager][1], small addon for Chrome and Chromium that will save all open tabs, assign the name to session and, when is needed, restore it. +![](https://img.linux.net.cn/data/attachment/album/202002/24/113047w8jtoh2o5j085750.jpg) -Very useful, especially if you are like me, switching between multiple "mind sessions" during the day - research, development or maybe news reading. Or simply, you'd like to remember workflow (and tabs) you had few days ago. +我是[会话管理器][1]的铁粉,它是 Chrome 和 Chromium 的小插件,可以保存所有打开的选项卡,为会话命名,并在需要时恢复会话。 -After I decided to ditch all extensions from Chromium except [uBlock Origin][2], it was time to look for alternative. My main goal was it to be browser agnostic and session links had to be stored in text file, so I can enjoy all the goodies of plain text file. What would be better for that than good old [org-mode][3] ;) +它非常有用,特别是如果你像我一样,白天的时候需要在多个“思维活动”之间切换——研究、开发或者阅读新闻。或者你只是单纯地希望记住几天前的工作流(和选项卡)。 -Long time ago I found this trick: [Get the currently open tabs in Google Chrome via the command line][4] and with some elisp sugar and coffee, here is the code: +在我决定放弃 chromium 上除了 [uBlock Origin][2] 之外的所有扩展后,就必须寻找一些替代品了。我的主要目标是使之与浏览器无关,同时会话链接必须保存在文本文件中,这样我就可以享受所有纯文本的好处了。还有什么比 [org 模式][3]更好呢 ;) + +很久以前我就发现了这个小诀窍:[通过命令行获取当前在谷歌 Chrome 中打开的标签][4] 再加上些 elisp 代码: ``` (require 'cl-lib) @@ -57,9 +59,9 @@ Make sure to put cursor on date heading that contains list of urls." (forward-line 1))))) ``` -So, how does it work? +那么,它的工作原理是什么呢? -Evaluate above code, open new org-mode file and call `M-x save-chromium-session`. It will create something like this: +运行上述代码,打开一个新 org 模式文件并调用 `M-x save-chromium-session`。它会创建类似这样的东西: ``` * [2019-12-04 12:14:02] @@ -68,9 +70,9 @@ Evaluate above code, open new org-mode file and call `M-x save-chromium-session` - https://news.ycombinator.com ``` -or whatever urls are running in Chromium instance. To restore it back, put cursor on desired date and run `M-x restore-chromium-session`. All tabs should be back. +也就是任何在 chromium 实例中运行着的 URL。要还原的话,则将光标置于所需日期上然后运行 `M-x restore-chromium-session`。所有标签都应该恢复了。 -Here is how I use it, with randomly generated data for the purpose of this text: +以下是我的使用案例,其中的数据是随机生成的: ``` #+TITLE: Browser sessions @@ -88,27 +90,27 @@ Here is how I use it, with randomly generated data for the purpose of this text: - https://news.ycombinator.com ``` -Note that hack for reading Chromium session isn't perfect: `strings` will read whatever looks like string and url from binary database and sometimes that will yield small artifacts in urls. But, you can easily edit those and keep session file lean and clean. +请注意,用于读取 Chromium 会话的方法并不完美:`strings` 将从二进制数据库中读取任何类似 URL 字符串的内容,有时这将产生不完整的 URL。不过,你可以很方便地地编辑它们,从而保持会话文件简洁。 -To actually open tabs, elisp code will use [browse-url][5] and it can be further customized to run Chromium, Firefox or any other browser with `browse-url-browser-function` variable. Make sure to read documentation for this variable. +为了真正打开标签,elisp 代码中使用到了 [browse-url][5],它可以通过 `browse-url-browser-function` 变量进一步定制成运行 Chromium、Firefox 或任何其他浏览器。请务必阅读该变量的相关文档。 -Don't forget to put session file in git, mercurial or svn and enjoy the fact that you will never loose your session history again :) +别忘了把会话文件放在 git、mercurial 或 svn 中,这样你就再也不会丢失会话历史记录了 :) -### What about Firefox? +### 那么 Firefox 呢? -If you are using Firefox (recent versions) and would like to pull session urls, here is how to do it. +如果你正在使用 Firefox(最近的版本),并且想要获取会话 URL,下面是操作方法。 -First, download and compile [lz4json][6], small tool that will decompress Mozilla lz4json format, where Firefox stores session data. Session data (at the time of writing this post) is stored in `$HOME/.mozilla/firefox//sessionstore-backups/recovery.jsonlz4`. +首先,下载并编译 [lz4json][6],这是一个可以解压缩 Mozilla lz4json 格式的小工具,Firefox 以这种格式来存储会话数据。会话数据(在撰写本文时)存储在 `$HOME/.mozilla/firefox//sessionstore-backup /recovery.jsonlz4` 中。 -If Firefox is not running, `recovery.jsonlz4` will not be present, but use `previous.jsonlz4` instead. +如果 Firefox 没有运行,则没有 `recovery.jsonlz4`,这种情况下用 `previous.jsonlz4` 代替。 -To extract urls, try this in terminal: +要提取网址,尝试在终端运行: ``` $ lz4jsoncat recovery.jsonlz4 | grep -oP '"(http.+?)"' | sed 's/"//g' | sort | uniq ``` -and update `save-chromium-session` with: +然后更新 `save-chromium-session` 为: ``` (defun save-chromium-session () @@ -122,7 +124,7 @@ and update `save-chromium-session` with: ;; rest of the code is unchanged ``` -Updating documentation strings, function name and any further refactoring is left for exercise. +更新本函数的文档字符串、函数名以及进一步的重构都留作练习。 -------------------------------------------------------------------------------- @@ -131,7 +133,7 @@ via: https://acidwords.com/posts/2019-12-04-handle-chromium-and-firefox-sessions 作者:[Sanel Z][a] 选题:[lujun9972][b] 译者:[lujun9972](https://github.com/lujun9972) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 diff --git a/published/20191225 8 Commands to Check Memory Usage on Linux.md b/published/202002/20191225 8 Commands to Check Memory Usage on Linux.md similarity index 100% rename from published/20191225 8 Commands to Check Memory Usage on Linux.md rename to published/202002/20191225 8 Commands to Check Memory Usage on Linux.md diff --git a/published/20191227 Top CI-CD resources to set you up for success.md b/published/202002/20191227 Top CI-CD resources to set you up for success.md similarity index 100% rename from published/20191227 Top CI-CD resources to set you up for success.md rename to published/202002/20191227 Top CI-CD resources to set you up for success.md diff --git a/published/20200102 Data streaming and functional programming in Java.md b/published/202002/20200102 Data streaming and functional programming in Java.md similarity index 100% rename from published/20200102 Data streaming and functional programming in Java.md rename to published/202002/20200102 Data streaming and functional programming in Java.md diff --git a/published/20200103 Add scorekeeping to your Python game.md b/published/202002/20200103 Add scorekeeping to your Python game.md similarity index 100% rename from published/20200103 Add scorekeeping to your Python game.md rename to published/202002/20200103 Add scorekeeping to your Python game.md diff --git a/published/20200109 My favorite Bash hacks.md b/published/202002/20200109 My favorite Bash hacks.md similarity index 100% rename from published/20200109 My favorite Bash hacks.md rename to published/202002/20200109 My favorite Bash hacks.md diff --git a/published/20200109 What-s HTTPS for secure computing.md b/published/202002/20200109 What-s HTTPS for secure computing.md similarity index 100% rename from published/20200109 What-s HTTPS for secure computing.md rename to published/202002/20200109 What-s HTTPS for secure computing.md diff --git a/published/202002/20200112 What I learned going from prison to Python.md b/published/202002/20200112 What I learned going from prison to Python.md new file mode 100644 index 0000000000..283212f4b4 --- /dev/null +++ b/published/202002/20200112 What I learned going from prison to Python.md @@ -0,0 +1,104 @@ +[#]: collector: (lujun9972) +[#]: translator: (heguangzhi) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11893-1.html) +[#]: subject: (What I learned going from prison to Python) +[#]: via: (https://opensource.com/article/20/1/prison-to-python) +[#]: author: (Shadeed "Sha" Wallace-Stepter https://opensource.com/users/shastepter) + +从监狱到 Python +====== + +> 入狱后,开源编程是如何提供机会的。 + +![书架上的编程书籍][1] + +不到一年前,我还在圣昆廷州立监狱服刑,我是无期徒刑。 + +我高三的时候,我抢劫了一个人并向他开了枪。现在,我经过一段时间才意识到并承认自己做错了,这是在经历了陪审团审判并看到我的行为带来的恶果后,我知道需要改变自己,我也确实做到了。尽管我对我的行为表示懊悔,但我毕竟开枪打了一个人,并差点杀了他。做这样的事是有后果的,这是理所当然的。所以在我 18 岁的时候,我被判了终身监禁。 + +监狱是一个非常可怕的地方;我是不推荐你去的。但是我必须去,所以我去了。我不告诉你具体的细节,但你可以放心,这是一个没有太多动机去改变的地方,许多人在这里养成的坏习惯比他们过去在别处养成的更多。 + +我是幸运儿之一。当我在服刑的时候,发生了一些不同寻常的事情。我开始想象自己出狱后的的未来,虽然在这之前,我还是已经在那里度过了我整个成年生活。 + +现在你想想:我是黑人,只受过高中教育。我没有工作经历,如果我离开监狱,在被释放前,我还是一个被定罪的重罪犯。当每个雇主看到我的简历,都不会有“我需要雇用这个人”想法,我认为是正常的。 + +我不知道我的选择是什么,但我已经下定决心了。我需要做些活下去的事情,并且这和我入狱前的生活一点也不像。 + +### Python 之路 + +最终,我被关在了圣昆廷州立监狱,我不知道我为何幸运地被关在那里。圣昆廷提供了几个自助和教育编程项目。这些[改造机会][2]帮助囚犯使他们拥有在获释后避免再次犯罪的技能。 + +作为其中一个编程项目的一部分,2017 年我通过圣昆廷媒体项目认识了[杰西卡·麦凯拉][3]。杰西卡是编程语言 [Python][4] 的爱好者,她开始向我推荐 Python 有多棒,以及它是刚起步的人学习的完美语言。这就是故事变得比小说更精彩的地方。 + +> 感谢 [@northbaypython][5] 让 [@ShaStepter][6] 和我重复 [@pycon][7] 的主题演讲,让他们被录制下来。我很荣幸与大家分享: +> +> 从监狱到 Pythone: https://t.co/rcumoAgZHm +> +> 大规模裁员:如果我们不雇佣被判重罪的人,谁会呢? https://t.co/fENDUFdxfX +> +> [pic.Twitter.com/kpjo8d3ul6][8] +> +> —杰西卡·麦凯拉(@jessicamckellar)[2019 年 11 月 5 日][9] + +杰西卡向我介绍了一些 Python 视频教程,这些教程是她为一家名叫 [O’Reilly Media][10] 的公司做的,课程是在线的,如果我能接触到它们,那该有多好呀。不幸的是,在监狱里上网是不可能的。但是,我遇到了一个叫 Tim O’Reilly 的人,他最近刚来到圣昆廷。在他访问之后,Tim 从他的公司 O’Reilly Media 公司向监狱的编程班捐赠了大量内容。最终,我拿到了一款平板电脑,上面有杰西卡的 Python 教程,并学会了如何使用这些 Python 教程进行编码。 + +真是难以置信。背景和生活与我完全不同的陌生人把这些联系在一起,让我学会了编码。 + +### 对 Python 社区的热爱 + +在这之后,我开始经常和杰西卡见面,她开始告诉我关于开源社区的情况。我了解到,从根本上说,开源社区就是关于伙伴关系和协作的社区。之所以如此有效,是因为没有人被排除在外。 + +对我来说,一个努力寻找自己定位的人,我所看到的是一种非常基本的爱——通过合作和接受的爱,通过接触的爱,通过包容的爱。我渴望成为其中的一部分。所以我继续学习 Python,不幸的是,我无法获得更多的教程,但是我能够从开源社区收集的大量书面知识中获益。我读一切提到 Python 的东西,从平装本到晦涩难懂的杂志文章,我使用平板电脑来解决我读到的 Python 问题。 + +我对 Python 和编程的热情不是我的许多同龄人所共有的。除了监狱编程课上的极少数人之外,我认识的其他人都没有提到过编程;一般囚犯都不知道。我认为这是因为有过监禁经历的人无法接触编程,尤其是如果你是有色人种。 + +### 监狱外的 Python 生活 + +然而,在 2018 年 8 月 17 日,我得到了生命中的惊喜。时任州长的杰里·布朗将我 27 年的刑期减刑,在服刑将近 19 年后,我被释放出狱了。 + +但现实情况是,这也是为什么我认为编程和开源社区如此有价值。我是一名 37 岁的黑人罪犯,没有工作经历,刚刚在监狱服刑 18 年。我有犯罪史,并且现存偏见导致没有多少职业适合我。但是编程是少数例外之一。 + +现在,监禁后重返社会的人们迫切需要包容,但当谈及工作场所的多样性以及对多样性的需求时,你真的听不到这个群体被提及或包容。 + +> 还有什么: +> +> 1、背景调查:询问他们在你的公司是如何使用的。 +> +> 2、初级角色:删除虚假的、不必要的先决条件,这些条件将排除有记录的合格人员。 +> +> 3、积极拓展:与当地再就业项目合作,创建招聘渠道。 +> +> [pic.twitter.com/WnzdEUTuxr][11] +> +> —杰西卡·麦凯拉(@jessicamckellar)[2019 年 5 月 12 日][12] +  + +因此,我想谦卑地挑战开源社区的所有程序员和成员,让他们围绕包容和多样性展开思考。今天,我自豪地站在你们面前,代表一个大多数人都没有想到的群体——以前被监禁的人。但是我们存在,我们渴望证明我们的价值,最重要的是,我们期待被接受。当我们重返社会时,许多挑战等待着我们,我请求你们允许我们有机会展示我们的价值。欢迎我们,接受我们,最重要的是,包容我们。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/1/prison-to-python + +作者:[Shadeed "Sha" Wallace-Stepter][a] +选题:[lujun9972][b] +译者:[heguangzhi](https://github.com/heguangzhi) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/shastepter +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/books_programming_languages.jpg?itok=KJcdnXM2 (Programming books on a shelf) +[2]: https://www.dailycal.org/2019/02/27/san-quentin-rehabilitation-programs-offer-inmates-education-a-voice/ +[3]: https://twitter.com/jessicamckellar?lang=en +[4]: https://www.python.org/ +[5]: https://twitter.com/northbaypython?ref_src=twsrc%5Etfw +[6]: https://twitter.com/ShaStepter?ref_src=twsrc%5Etfw +[7]: https://twitter.com/pycon?ref_src=twsrc%5Etfw +[8]: https://t.co/Kpjo8d3ul6 +[9]: https://twitter.com/jessicamckellar/status/1191601209917837312?ref_src=twsrc%5Etfw +[10]: http://shop.oreilly.com/product/110000448.do +[11]: https://t.co/WnzdEUTuxr +[12]: https://twitter.com/jessicamckellar/status/1127640222504636416?ref_src=twsrc%5Etfw diff --git a/published/202002/20200117 Use this Python script to find bugs in your Overcloud.md b/published/202002/20200117 Use this Python script to find bugs in your Overcloud.md new file mode 100644 index 0000000000..94428426e4 --- /dev/null +++ b/published/202002/20200117 Use this Python script to find bugs in your Overcloud.md @@ -0,0 +1,172 @@ +[#]: collector: (lujun9972) +[#]: translator: (Morisun029) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11886-1.html) +[#]: subject: (Use this Python script to find bugs in your Overcloud) +[#]: via: (https://opensource.com/article/20/1/logtool-root-cause-identification) +[#]: author: (Arkady Shtempler https://opensource.com/users/ashtempl) + +用 Python 脚本发现 OpenStack Overcloud 中的问题 +====== + +> LogTool 是一组 Python 脚本,可帮助你找出 Overcloud 节点中问题的根本原因。 + +![](https://img.linux.net.cn/data/attachment/album/202002/12/211455woy57xx5q19cx175.jpg) + +OpenStack 在其 Overcloud 节点和 Undercloud 主机上存储和管理了一堆日志文件。因此,使用 OSP 日志文件来排查遇到的问题并不是一件容易的事,尤其在你甚至都不知道是什么原因导致问题时。 + +如果你正处于这种情况,那么 [LogTool][2] 可以使你的生活变得更加轻松!它会为你节省本需要人工排查问题所需的时间和精力。LogTool 基于模糊字符串匹配算法,可提供过去发生的所有唯一错误和警告信息。你可以根据日志中的时间戳导出特定时间段(例如 10 分钟前、一个小时前、一天前等)的这些信息。 + +LogTool 是一组 Python 脚本,其主要模块 `PyTool.py` 在 Undercloud 主机上执行。某些操作模式使用直接在 Overcloud 节点上执行的其他脚本,例如从 Overcloud 日志中导出错误和警告信息。 + +LogTool 支持 Python 2 和 Python 3,你可以根据需要更改工作目录:[LogTool_Python2][3] or [LogTool_Python3][4]。 + +### 操作方式 + +#### 1、从 Overcloud 日志中导出错误和警告信息 + +此模式用于从过去发生的 Overcloud 节点中提取 **错误** 和 **警告** 信息。作为用户,系统将提示你提供“开始时间”和“调试级别”,以用于提取错误或警告消息。例如,如果在过去 10 分钟内出了问题,你则可以只提取该时间段内的错误和警告消息。 + +此操作模式将为每个 Overcloud 节点生成一个包含结果文件的目录。结果文件是经过压缩的简单文本文件(`*.gz`),以减少从 Overcloud 节点下载所需的时间。将压缩文件转换为常规文本文件,可以使用 `zcat` 或类似工具。此外,Vi 的某些版本和 Emacs 的任何最新版本均支持读取压缩数据。结果文件分为几部分,并在底部包含目录。 + +LogTool 可以即时检测两种日志文件:标准和非标准。在标准文件中,每条日志行都有一个已知的和已定义的结构:时间戳、调试级别、信息等等。在非标准文件中,日志的结构未知。例如,它可能是第三方的日志。在目录中,你可以找到每个部分的“名称 --> 行号”例如: + + * **原始数据 - 从标准 OSP 日志中提取的错误/警告消息:** 这部分包含所有提取的错误/警告消息,没有任何修改或更改。这些消息是 LogTool 用于模糊匹配分析的原始数据。 + * **统计信息 - 每个标准 OSP 日志的错误/警告信息数量:** 在此部分,你将找到每个标准日志文件的错误和警告数量。这些信息可以帮助你了解用于排查问题根本原因的潜在组件。 + * **统计信息 - 每个标准 OSP 日志文件的唯一消息:** 这部分提供指定时间戳内的唯一的错误和警告消息。有关每个唯一错误或警告的更多详细信息,请在“原始数据”部分中查找相同的消息。 + * **统计信息 - 每个非标准日志文件在任意时间的唯一消息:** 此部分包含非标准日志文件中的唯一消息。遗憾的是,LogTool 无法像标准日志文件那样的处理方式处理这些日志文件。因此,在你提取“特定时间”的日志信息时会被忽略,你会看到过去创建的所有唯一的错误/警告消息。因此,首先,向下滚动到结果文件底部的目录并查看其部分-使用目录中的行索引跳到相关部分,其中第 3、4 和 5 行的信息最重要。 + +#### 2、从 Overcloud 节点下载所有日志 + +所有 Overcloud 节点的日志将被压缩并下载到 Undercloud 主机上的本地目录。 + +#### 3、所有 Overcloud 日志中搜索字符串 + +该模式“grep”(搜索)由用户在所有 Overcloud 日志上提供的字符串。例如,你可能希望查看特定请求的所有日志消息,例如,“Create VM”的失败的请求 ID。 + +#### 4、检查 Overcloud 上当前的 CPU、RAM 和磁盘使用情况 + +该模式显示每个 Overcloud 节点上的当前 CPU、RAM 和磁盘信息。 + +#### 5、执行用户脚本 + +该模式使用户可以在 Overcloud 节点上运行自己的脚本。例如,假设 Overcloud 部署失败,你就需要在每个控制器节点上执行相同的过程来修复该问题。你可以实现“替代方法”脚本,并使用此模式在控制器上运行它。 + +#### 6、仅按给定的时间戳下载相关日志 + +此模式仅下载 Overcloud 上 “给定的时间戳”的“上次修改时间”的日志。例如,如果 10 分钟前出现错误,则与旧日志文件就没有关系,因此无需下载。此外,你不能(或不应)在某些错误报告工具中附加大文件,因此此模式可能有助于编写错误报告。 + +#### 7、从 Undercloud 日志中导出错误和警告信息 + +这与上面的模式 1 相同。 + +#### 8、在 Overcloud 上检查不正常的 docker + +此模式用于在节点上搜索不正常的 Docker。 + +#### 9、下载 OSP 日志并在本地运行 LogTool + +此模式允许你从 Jenkins 或 Log Storage 下载 OSP 日志(例如,`cougar11.scl.lab.tlv.redhat.com`),并在本地分析。 + +#### 10、在 Undercloud 上分析部署日志 + +此模式可以帮助你了解 Overcloud 或 Undercloud 部署过程中出了什么问题。例如,在`overcloud_deploy.sh` 脚本中,使用 `--log` 选项时会生成部署日志;此类日志的问题是“不友好”,你很难理解是什么出了问题,尤其是当详细程度设置为 `vv` 或更高时,使得日志中的数据难以读取。此模式提供有关所有失败任务的详细信息。 + +#### 11、分析 Gerrit(Zuul)失败的日志 + +此模式用于分析 Gerrit(Zuul)日志文件。它会自动从远程 Gerrit 门下载所有文件(HTTP 下载)并在本地进行分析。 + +### 安装 + +GitHub 上有 LogTool,使用以下命令将其克隆到你的 Undercloud 主机: + +``` +git clone https://github.com/zahlabut/LogTool.git +``` + +该工具还使用了一些外部 Python 模块: + +#### Paramiko + +默认情况下,SSH 模块通常会安装在 Undercloud 上。使用以下命令来验证是否已安装: + +``` +ls -a /usr/lib/python2.7/site-packages | grep paramiko +``` + +如果需要安装模块,请在 Undercloud 上执行以下命令: + +``` +sudo easy_install pip +sudo pip install paramiko==2.1.1 +``` + +#### BeautifulSoup + +此 HTML 解析器模块仅在使用 HTTP 下载日志文件的模式下使用。它用于解析 Artifacts HTML 页面以获取其中的所有链接。安装 BeautifulSoup,请输入以下命令: + +``` +pip install beautifulsoup4 +``` + +你还可以通过执行以下命令使用 [requirements.txt][6] 文件安装所有必需的模块: + +``` +pip install -r requirements.txt +``` + +### 配置 + +所有必需的参数都直接在 `PyTool.py` 脚本中设置。默认值为: + +``` +overcloud_logs_dir = '/var/log/containers' +overcloud_ssh_user = 'heat-admin' +overcloud_ssh_key = '/home/stack/.ssh/id_rsa' +undercloud_logs_dir ='/var/log/containers' +source_rc_file_path='/home/stack/' +``` + +### 用法 + +此工具是交互式的,因此要启动它,只需输入: + +``` +cd LogTool +python PyTool.py +``` + +### 排除 LogTool 故障 + + +在运行时会创建两个日志文件:`Error.log` 和 `Runtime.log`。请在你要打开的问题的描述中添加两者的内容。 + +### 局限性 + +LogTool 进行硬编码以处理最大 500 MB 的文件。 + +### LogTool_Python3 脚本 + +在 [github.com/zahlabut/LogTool][2] 获取。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/1/logtool-root-cause-identification + +作者:[Arkady Shtempler][a] +选题:[lujun9972][b] +译者:[Morisun029](https://github.com/译者ID) +校对:[wxy](https://github.com/wxy) + + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/ashtempl +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/search_find_code_python_programming.png?itok=ynSL8XRV (Searching for code) +[2]: https://github.com/zahlabut/LogTool +[3]: https://github.com/zahlabut/LogTool/tree/master/LogTool_Python2 +[4]: https://github.com/zahlabut/LogTool/tree/master/LogTool_Python3 +[5]: https://opensource.com/article/19/2/getting-started-cat-command +[6]: https://github.com/zahlabut/LogTool/blob/master/LogTool_Python3/requirements.txt diff --git a/published/20200118 Keep a journal of your activities with this Python program.md b/published/202002/20200118 Keep a journal of your activities with this Python program.md similarity index 100% rename from published/20200118 Keep a journal of your activities with this Python program.md rename to published/202002/20200118 Keep a journal of your activities with this Python program.md diff --git a/published/20200119 How to Set or Change Timezone in Ubuntu Linux -Beginner-s Tip.md b/published/202002/20200119 How to Set or Change Timezone in Ubuntu Linux -Beginner-s Tip.md similarity index 100% rename from published/20200119 How to Set or Change Timezone in Ubuntu Linux -Beginner-s Tip.md rename to published/202002/20200119 How to Set or Change Timezone in Ubuntu Linux -Beginner-s Tip.md diff --git a/published/20200119 One open source chat tool to rule them all.md b/published/202002/20200119 One open source chat tool to rule them all.md similarity index 100% rename from published/20200119 One open source chat tool to rule them all.md rename to published/202002/20200119 One open source chat tool to rule them all.md diff --git a/published/20200120 Use this Twitter client for Linux to tweet from the terminal.md b/published/202002/20200120 Use this Twitter client for Linux to tweet from the terminal.md similarity index 100% rename from published/20200120 Use this Twitter client for Linux to tweet from the terminal.md rename to published/202002/20200120 Use this Twitter client for Linux to tweet from the terminal.md diff --git a/published/20200121 Read Reddit from the Linux terminal.md b/published/202002/20200121 Read Reddit from the Linux terminal.md similarity index 100% rename from published/20200121 Read Reddit from the Linux terminal.md rename to published/202002/20200121 Read Reddit from the Linux terminal.md diff --git a/published/20200122 Get your RSS feeds and podcasts in one place with this open source tool.md b/published/202002/20200122 Get your RSS feeds and podcasts in one place with this open source tool.md similarity index 100% rename from published/20200122 Get your RSS feeds and podcasts in one place with this open source tool.md rename to published/202002/20200122 Get your RSS feeds and podcasts in one place with this open source tool.md diff --git a/published/202002/20200122 Screenshot your Linux system configuration with Bash tools.md b/published/202002/20200122 Screenshot your Linux system configuration with Bash tools.md new file mode 100644 index 0000000000..e8507162f9 --- /dev/null +++ b/published/202002/20200122 Screenshot your Linux system configuration with Bash tools.md @@ -0,0 +1,107 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11920-1.html) +[#]: subject: (Screenshot your Linux system configuration with Bash tools) +[#]: via: (https://opensource.com/article/20/1/screenfetch-neofetch) +[#]: author: (Don Watkins https://opensource.com/users/don-watkins) + +使用 Bash 工具截屏 Linux 系统配置 +====== + +> 使用 ScreenFetch 和 Neofetch 与其他人轻松分享你的 Linux 环境。 + +![](https://img.linux.net.cn/data/attachment/album/202002/23/124525yiiqs18ll736oro8.jpg) + +你可能有很多原因想要与他人分享你的 Linux 配置。你可能正在寻求帮助来对系统上的问题进行故障排除,或者你对所创建的环境感到非常自豪,因此想向其他开源爱好者展示。 + +你可以在 Bash 提示符下使用 `cat /proc/cpuinfo` 或 `lscpu` 命令获取某些信息。但是,如果你想共享更多详细信息,例如你的操作系统、内核、运行时间、shell 环境,屏幕分辨率等,那么可以选择两个很棒的工具:screenFetch 和 Neofetch。 + +### screenFetch + +[screenFetch][2] 是 Bash 命令行程序,它可以产生非常漂亮的系统配置和运行时间的截图。这是方便的与它人共享系统配置的方法。 + +在许多 Linux 发行版上安装 screenFetch 很简单。 + +在 Fedora 上,输入: + +``` +$ sudo dnf install screenfetch +``` + +在 Ubuntu 上,输入: + +``` +$ sudo apt install screenfetch +``` + +对于其他操作系统,包括 FreeBSD、MacOS 等,请查阅 screenFetch 的 wiki [安装页面][3]。安装 screenFetch 后,它可以生成详细而彩色的截图,如下所示: + +![screenFetch][4] + +ScreenFetch 还提供各种命令行选项来调整你的结果。例如,`screenfetch -v` 返回详细输出,逐行显示每个选项以及上面的显示。 + +`screenfetch -n` 在显示系统信息时消除了操作系统图标。 + +![screenfetch -n option][5] + +其他选项包括 `screenfetch -N`,它去除所有输出的颜色。`screenfetch -t`,它根据终端的大小截断输出。`screenFetch -E`,它可抑制错误输出。 + +请检查手册页来了解其他选项。screenFetch 在 GPLv3 许可证下的开源,你可以在它的 [GitHub 仓库][6]中了解有关该项目的更多信息。 + +### Neofetch + +[Neofetch][7] 是创建系统信息截图的另一个工具。它是用 Bash 3.2 编写的,在 [MIT 许可证][8]下开源。 + +根据项目网站所述,“Neofetch 支持近 150 种不同的操作系统。从 Linux 到 Windows,一直到 Minix、AIX 和 Haiku 等更晦涩的操作系统。” + +![Neofetch][9] + +该项目维护了一个 wiki,其中包含用于各种发行版和操作系统的出色的[安装文档][10]。 + +如果你使用的是 Fedora、RHEL 或 CentOS,那么可以在 Bash 提示符下使用以下命令安装 Neofetch: + +``` +$ sudo dnf install neofetch +``` + +在 Ubuntu 17.10 及更高版本上,你可以使用: + +``` +$ sudo apt install neofetch +``` + +首次运行时,Neofetch 将 `~/.config/neofetch/config.conf` 文件写入主目录(`.config/config.conf`),它让你可以[自定义和控制][11] Neofetch 输出的各个方面。例如,你可以配置 Neofetch 使用图像、ASCII 文件、你选择的壁纸,或者完全不使用。config.conf 文件还让与它人分享配置变得容易。 + +如果 Neofetch 不支持你的操作系统或不提供所需选项,请在项目的 [GitHub 仓库][12]中打开一个问题。 + +### 总结 + +无论为什么要共享系统配置,screenFetch 或 Neofetch 都应该能做到。你是否知道在 Linux 上提供此功能的另一个开源工具?请在评论中分享你的最爱。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/1/screenfetch-neofetch + +作者:[Don Watkins][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/don-watkins +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/metrics_data_dashboard_system_computer_analytics.png?itok=oxAeIEI- (metrics and data shown on a computer screen) +[2]: https://github.com/KittyKatt/screenFetch +[3]: https://github.com/KittyKatt/screenFetch/wiki/Installation +[4]: https://opensource.com/sites/default/files/uploads/screenfetch.png (screenFetch) +[5]: https://opensource.com/sites/default/files/uploads/screenfetch-n.png (screenfetch -n option) +[6]: http://github.com/KittyKatt/screenFetch +[7]: https://github.com/dylanaraps/neofetch +[8]: https://github.com/dylanaraps/neofetch/blob/master/LICENSE.md +[9]: https://opensource.com/sites/default/files/uploads/neofetch.png (Neofetch) +[10]: https://github.com/dylanaraps/neofetch/wiki/Installation +[11]: https://github.com/dylanaraps/neofetch/wiki/Customizing-Info +[12]: https://github.com/dylanaraps/neofetch/issues diff --git a/translated/tech/20200123 How to stop typosquatting attacks.md b/published/202002/20200123 How to stop typosquatting attacks.md similarity index 72% rename from translated/tech/20200123 How to stop typosquatting attacks.md rename to published/202002/20200123 How to stop typosquatting attacks.md index 4f51c8ec3b..728bf29f50 100644 --- a/translated/tech/20200123 How to stop typosquatting attacks.md +++ b/published/202002/20200123 How to stop typosquatting attacks.md @@ -1,20 +1,22 @@ [#]: collector: (lujun9972) [#]: translator: (HankChow) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11899-1.html) [#]: subject: (How to stop typosquatting attacks) [#]: via: (https://opensource.com/article/20/1/stop-typosquatting-attacks) [#]: author: (Sam Bocetta https://opensource.com/users/sambocetta) 如何防范误植攻击 ====== + > 误植Typosquatting是一种引诱用户将敏感数据泄露给不法分子的方式,针对这种攻击方式,我们很有必要了解如何保护我们的组织、我们的开源项目以及我们自己。 + ![Gears above purple clouds][1] -除了常规手段以外,不法分子还会利用社会工程的方式,试图让安全意识较弱的人泄露私人信息或是有价值的证书。很多[网络钓鱼骗局][2]的实质都是攻击者伪装成信誉良好的公司或组织,然后借此大规模分发病毒或恶意软件。 +除了常规手段以外,网络罪犯还会利用社会工程的方式,试图让安全意识较弱的人泄露私人信息或是有价值的证书。很多[网络钓鱼骗局][2]的实质都是攻击者伪装成信誉良好的公司或组织,然后借此大规模传播病毒或恶意软件。 -[误植][3]就是其中一个常用的手法。它是一种社会工程学的攻击方式,通过使用一些合法网站的错误拼写 URL 以引诱用户访问恶意网站,这样的做法既使真正的原网站遭受声誉上的损害,又诱使用户向这些恶意网站提交个人敏感信息。因此,网站的管理人员和用户双方都应该意识到这个问题带来的风险,并采取措施加以保护。 +[误植][3]Typosquatting就是其中一个常用的手法。它是一种社会工程学的攻击方式,通过使用一些合法网站的错误拼写的 URL 以引诱用户访问恶意网站,这样的做法既使真正的原网站遭受声誉上的损害,又诱使用户向这些恶意网站提交个人敏感信息。因此,网站的管理人员和用户双方都应该意识到这个问题带来的风险,并采取措施加以保护。 一些由广大开发者在公共代码库中维护的开源软件通常都被认为具有安全上的优势,但当面临社会工程学攻击或恶意软件植入时,开源软件也需要注意以免受到伤害。 @@ -22,9 +24,9 @@ ### 什么是误植? -误植是一种具体的网络犯罪手段,其背后通常是一个网络钓鱼骗局。不法分子首先会购买注册域名,而他们注册的域名通常是一个常用网站的错误拼写形式,例如在正确拼写的基础上添加一个额外的元音字母,又或者是将字母“i”替换成字母“l”。对于同一个正常域名,不法分子通常会注册数十个拼写错误的变体域名。 +误植是一种非常特殊的网络犯罪形式,其背后通常是一个更大的网络钓鱼骗局。不法分子首先会购买和注册域名,而他们注册的域名通常是一个常用网站的错误拼写形式,例如在正确拼写的基础上添加一个额外的元音字母,又或者是将字母“i”替换成字母“l”。对于同一个正常域名,不法分子通常会注册数十个拼写错误的变体域名。 -用户一旦访问这样的域名,不法分子的目的就已经成功了一半。为此,他们会通过电子邮件的方式,诱导用户访问这样的伪造域名。伪造域名指向的页面中,通常都带有一个简单的登录界面,还会附上被模仿的网站的 logo,尽可能让用户认为自己访问的是正确的网站。 +用户一旦访问这样的域名,不法分子的目的就已经成功了一半。为此,他们会通过电子邮件的方式,诱导用户访问这样的伪造域名。伪造域名指向的页面中,通常都带有一个简单的登录界面,还会附上熟悉的被模仿网站的徽标,尽可能让用户认为自己访问的是真实的网站。 如果用户没有识破这一个骗局,在页面中提交了诸如银行卡号、用户名、密码等敏感信息,这些数据就会被不法分子所完全掌控。进一步来看,如果这个用户在其它网站也使用了相同的用户名和密码,那就有同样受到波及的风险。受害者最终可能会面临身份被盗、信用记录被破坏等危险。 @@ -34,11 +36,11 @@ 在几年之前就发生过[一起案件][4],很多健康保险客户收到了一封指向 we11point.com 的钓鱼电子邮件,其中 URL 里正确的字母“l”被换成了数字“1”,从而导致一批用户成为了这一次攻击的受害者。 -最初,特定国家的顶级域名是不允许随意注册的。但后来国际域名规则中放开这一限制之后,又兴起了一波新的误植攻击。例如最常见的一种手法就是注册一个与 .com 域名类似的 .om 域名,一旦在输入 URL 时不慎遗漏了字母 c 就会给不法分子带来可乘之机。 +最初,与特定国家/地区相关的顶级域名是不允许随意注册的。但后来国际域名规则中放开这一限制之后,又兴起了一波新的误植攻击。例如最常见的一种手法就是注册一个与 .com 域名类似的 .om 域名,一旦在输入 URL 时不慎遗漏了字母 c 就会给不法分子带来可乘之机。 ### 网站如何防范误植攻击 -对于一个公司来说,最好的策略就是永远比误植攻击采取早一手的行动。 +对于一个公司来说,最好的策略就是永远比误植攻击采取早一步的行动。 也就是说,在注册域名的时候,不仅要注册自己商标名称的域名,最好还要同时注册可能由于拼写错误产生的其它域名。当然,没有太大必要把可能导致错误的所有顶级域名都注册掉,但至少要把可能导致错误的一些一级域名抢注下来。 @@ -46,7 +48,7 @@ 你可以使用类似 [DNS Twist][5] 的开源工具来扫描公司正在使用的域名,它可以确定是否有相似的域名已被注册,从而暴露潜在的误植攻击。DNS Twist 可以在 Linux 系统上通过一系列的 shell 命令来运行。 -还有一些网络提供商会将防护误植攻击作为他们网络产品的一部分。这就相当于一层额外的保护,如果用户不慎输入了带有拼写错误的 URL,就会被提示该页面已经被阻止并重定向到正确的域名。 +还有一些网络提供商(ISP)会将防护误植攻击作为他们网络产品的一部分。这就相当于一层额外的保护,如果用户不慎输入了带有拼写错误的 URL,就会被提示该页面已经被阻止并重定向到正确的域名。 如果你是系统管理员,还可以考虑运行一个自建的 [DNS 服务器][6],以便通过黑名单的机制禁止对某些域名的访问。 @@ -58,29 +60,27 @@ 因为开源项目的源代码是公开的,所以其中大部分项目都会进行安全和渗透测试。但错误是不可能完全避免的,如果你参与了开源项目,还是有需要注意的地方。 -当你收到一个不明来源的合并请求Merge Request或补丁时,必须在合并之前仔细检查,尤其是相关代码涉及到网络层面的时候。一定要进行严格的检查和测试,以确保没有恶意代码混入正常的代码当中。 +当你收到一个不明来源的合并请求Merge Request或补丁时,必须在合并之前仔细检查,尤其是相关代码涉及到网络层面的时候。不要屈服于只测试构建的诱惑; 一定要进行严格的检查和测试,以确保没有恶意代码混入正常的代码当中。 同时,还要严格按照正确的方法使用域名,避免不法分子创建仿冒的下载站点并提供带有恶意代码的软件。可以通过如下所示的方法使用数字签名来确保你的软件没有被篡改: - ``` gpg --armor --detach-sig \ -\--output advent-gnome.sig \ -example-0.0.1.tar.xz + --output advent-gnome.sig \ + example-0.0.1.tar.xz ``` 同时给出你提供的文件的校验和: - ``` -`sha256sum example-0.0.1.tar.xz > example-0.0.1.txt` +sha256sum example-0.0.1.tar.xz > example-0.0.1.txt ``` 无论你的用户会不会去用上这些安全措施,你也应该提供这些必要的信息。因为只要有那么一个人留意到签名有异样,就能为你敲响警钟。 ### 总结 -人类犯错在所难免。世界上数百万人输入同一个,总会有人出现拼写的错误。不法分子也正是抓住了这个漏洞才得以实施误植攻击。 +人类犯错在所难免。世界上数百万人输入同一个网址时,总会有人出现拼写的错误。不法分子也正是抓住了这个漏洞才得以实施误植攻击。 用抢注域名的方式去完全根治误植攻击也是不太现实的,我们更应该关注这种攻击的传播方式以减轻它对我们的影响。最好的保护就是和用户之间建立信任,并积极检测误植攻击的潜在风险。作为开源社区,我们更应该团结起来一起应对误植攻击。 @@ -91,7 +91,7 @@ via: https://opensource.com/article/20/1/stop-typosquatting-attacks 作者:[Sam Bocetta][a] 选题:[lujun9972][b] 译者:[HankChow](https://github.com/HankChow) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 diff --git a/published/20200123 Use this open source tool to get your local weather forecast.md b/published/202002/20200123 Use this open source tool to get your local weather forecast.md similarity index 100% rename from published/20200123 Use this open source tool to get your local weather forecast.md rename to published/202002/20200123 Use this open source tool to get your local weather forecast.md diff --git a/translated/tech/20200124 3 handy command-line internet speed tests.md b/published/202002/20200124 3 handy command-line internet speed tests.md similarity index 62% rename from translated/tech/20200124 3 handy command-line internet speed tests.md rename to published/202002/20200124 3 handy command-line internet speed tests.md index 1fbced0ace..58426cffea 100644 --- a/translated/tech/20200124 3 handy command-line internet speed tests.md +++ b/published/202002/20200124 3 handy command-line internet speed tests.md @@ -1,39 +1,38 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11882-1.html) [#]: subject: (3 handy command-line internet speed tests) [#]: via: (https://opensource.com/article/20/1/internet-speed-tests) [#]: author: (Ben Nuttall https://opensource.com/users/bennuttall) -3 个方便的命令行网速度测试工具 +3 个方便的命令行网速测试工具 ====== -用这三个开源工具检查你的互联网和局域网速度。 -![Old train][1] -可以验证网络连接速度让你可以控制计算机。三个可以检查互联网和局域网的开源命令行工具是 Speedtest、Fast 和 iPerf。 +> 用这三个开源工具检查你的互联网和局域网速度。 + +![](https://img.linux.net.cn/data/attachment/album/202002/12/115915kk6hkax1vparkuvk.jpg) + +能够验证网络连接速度使您可以控制计算机。 使您可以在命令行中检查互联网和网络速度的三个开源工具是 Speedtest、Fast 和 iPerf。 ### Speedtest -[Speedtest][2] 是以前的最爱。它用 Python 实现,并打包在 Apt 中,也可用 pip 安装。你可以将它作为命令行工具或 Python 脚本使用。 +[Speedtest][2] 是一个旧宠。它用 Python 实现,并打包在 Apt 中,也可用 `pip` 安装。你可以将它作为命令行工具或在 Python 脚本中使用。 使用以下命令安装: - ``` -`sudo apt install speedtest-cli` +sudo apt install speedtest-cli ``` 或者 - ``` -`sudo pip3 install speedtest-cli` +sudo pip3 install speedtest-cli ``` -然后使用命令 **speedtest** 运行它: - +然后使用命令 `speedtest` 运行它: ``` $ speedtest @@ -48,28 +47,25 @@ Testing upload speed............................................................ Upload: 10.93 Mbit/s ``` -它给你提供了上传和下载的网速。它快速而且脚本化,因此你可以定期运行它,并将输出保存到文件或数据库中,以记录一段时间内的网络速度。 +它给你提供了互联网上传和下载的网速。它快速而且可脚本调用,因此你可以定期运行它,并将输出保存到文件或数据库中,以记录一段时间内的网络速度。 ### Fast -[Fast][3] 是 Netflix 提供的服务。它的网址是 [Fast.com][4],同时它有一个可通过 npm 安装的命令行工具: - +[Fast][3] 是 Netflix 提供的服务。它的网址是 [Fast.com][4],同时它有一个可通过 `npm` 安装的命令行工具: ``` -`npm install --global fast-cli` +npm install --global fast-cli ``` 网站和命令行程序都提供了相同的基本界面:它是一个尽可能简单的速度测试: - ``` $ fast      82 Mbps ↓ ``` -该命令返回你的网络下载速度。要获取上传速度,请使用 **-u** 标志: - +该命令返回你的网络下载速度。要获取上传速度,请使用 `-u` 标志: ``` $ fast -u @@ -79,10 +75,10 @@ $ fast -u ### iPerf -[iPerf][5] 测试的是局域网速度(而不是像前两个工具一样测试互联网速度)的好方法。 Debian、Raspbian 和 Ubuntu 用户可以使用 apt 安装它: +[iPerf][5] 测试的是局域网速度(而不是像前两个工具一样测试互联网速度)的好方法。Debian、Raspbian 和 Ubuntu 用户可以使用 apt 安装它: ``` -`sudo apt install iperf` +sudo apt install iperf ``` 它还可用于 Mac 和 Windows。 @@ -91,34 +87,31 @@ $ fast -u 获取服务端计算机的 IP 地址: - ``` -`ip addr show | grep inet.*brd` +ip addr show | grep inet.*brd ``` -你的本地 IP 地址(假设为 IPv4 本地网络)以 **192.168** 或 **10** 开头。记下 IP 地址,以便可以在另一台计算机(指定为客户端的计算机)上使用它。 - -在服务端启动 **iperf**: +你的本地 IP 地址(假设为 IPv4 本地网络)以 `192.168` 或 `10` 开头。记下 IP 地址,以便可以在另一台计算机(指定为客户端的计算机)上使用它。 +在服务端启动 `iperf`: ``` -`iperf -s` +iperf -s ``` -这会等待来自客户端的传入连接。将另一台计算机作为为客户端并运行此命令,将示例中的 IP 替换为服务端计算机的 IP: - +它会等待来自客户端的传入连接。将另一台计算机作为为客户端并运行此命令,将示例中的 IP 替换为服务端计算机的 IP: ``` -`iperf -c 192.168.1.2` +iperf -c 192.168.1.2 ``` ![iPerf][6] -只需几秒钟即可完成测试,然后返回传输大小和计算出的带宽。我使用家用服务器作为服务端,在 PC 和笔记本电脑上进行了一些测试。我最近在房屋周围安装了 Cat6 以太网,因此我的有线连接速度达到 1Gbps,但 WiFi 连接速度却低得多。 +只需几秒钟即可完成测试,然后返回传输大小和计算出的带宽。我使用家用服务器作为服务端,在 PC 和笔记本电脑上进行了一些测试。我最近在房屋周围安装了六类线以太网,因此我的有线连接速度达到 1Gbps,但 WiFi 连接速度却低得多。 ![iPerf][7] -你可能注意到它记录到 16Gbps。那是我使用服务器进行自我测试,因此它只是在测试写入磁盘的速度。服务器是普通硬盘,它只有 16Gbps,但是我的台式机有 46Gbps,另外我的(新)笔记本超过了 60Gbps,因为它们都有固态硬盘。 +你可能注意到它记录到 16Gbps。那是我使用服务器进行自我测试,因此它只是在测试写入磁盘的速度。该服务器具有仅 16 Gbps 的硬盘驱动器,但是我的台式机有 46Gbps,另外我的(较新的)笔记本超过了 60Gbps,因为它们都有固态硬盘。 ![iPerf][8] @@ -128,9 +121,7 @@ $ fast -u 你还使用其他哪些工具来衡量家庭网络?在评论中分享你的评论。 -* * * - -_本文最初发表在 Ben Nuttall 的 [Tooling blog][9] 上,并获准在此使用。_ +本文最初发表在 Ben Nuttall 的 [Tooling blog][9] 上,并获准在此使用。 -------------------------------------------------------------------------------- @@ -139,7 +130,7 @@ via: https://opensource.com/article/20/1/internet-speed-tests 作者:[Ben Nuttall][a] 选题:[lujun9972][b] 译者:[geekpi](https://github.com/geekpi) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 diff --git a/published/202002/20200124 Run multiple consoles at once with this open source window environment.md b/published/202002/20200124 Run multiple consoles at once with this open source window environment.md new file mode 100644 index 0000000000..33593eb788 --- /dev/null +++ b/published/202002/20200124 Run multiple consoles at once with this open source window environment.md @@ -0,0 +1,111 @@ +[#]: collector: (lujun9972) +[#]: translator: (wxy) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11892-1.html) +[#]: subject: (Run multiple consoles at once with this open source window environment) +[#]: via: (https://opensource.com/article/20/1/multiple-consoles-twin) +[#]: author: (Kevin Sonney https://opensource.com/users/ksonney) + +使用开源窗口环境 twin 一次运行多个控制台 +====== + +> 在我们的 20 个使用开源提升生产力的系列的第十四篇文章中用 twin 模拟了老式的 DESQview 体验。 + +![](https://img.linux.net.cn/data/attachment/album/202002/14/193658tlbyft0lbu44f0s3.jpg) + +去年,我在 19 天里给你介绍了 19 个新(对你而言)的生产力工具。今年,我换了一种方式:使用你在使用或者还没使用的工具,构建一个使你可以在新一年更加高效的环境。 + +### 通过 twin 克服“一个屏幕,一个应用程序”的限制 + +还有人记得 [DESQview][2] 吗?我们在 Windows、Linux 和 MacOS 中理所当然地可以在屏幕上同时运行多个程序,而 DESQview 赋予了 DOS 同样的功能。在我运营拨号 BBS 服务的初期,DESQview 是必需的,它使我能够让 BBS 在后台运行,同时在前台进行其他操作。例如,当有人拨打电话时,我可能正在开发新功能或设置新的外部程序而不会影响他们的体验。后来,在我早期做支持工作的时候,我可以同时运行我的工作电子邮件([MHS 上的 DaVinci 电子邮件][3])、支持单据系统和其他 DOS 程序。这是令人吃惊的! + +![twin][4] + +从那时起,运行多个控制台应用程序的功能已经发展了很多。但是 [tmux][5] 和 [Screen][6] 等应用仍然遵循“一个屏幕,一个应用”的显示方式。好吧,是的,tmux 具有屏幕拆分和窗格,但是不像 DESQview 那样具有将窗口“浮动”在其他窗口上的功能,就我个人而言,我怀念那个功能。 + +让我们来看看 [twin][7](文本模式窗口环境)。我认为,这个相对年轻的项目是 DESQview 的精神继任者。它支持控制台和图形环境,并具有与会话脱离和重新接驳的功能。设置起来并不是那么容易,但是它可以在大多数现代操作系统上运行。 + +Twin 是从源代码安装的(现在是这样)。但是首先,你需要安装所需的开发库。库名称将因操作系统而异。 以下示例显示了在我的 Ubuntu 19.10 系统中的情况。一旦安装了依赖库,请从 Git 中检出 twin 源代码,并运行 `./configure` 和 `make`,它们应自动检测所有内容并构建 twin: + +``` +sudo apt install libx11-dev libxpm-dev libncurses-dev zlib1g-dev libgpm-dev +git clone git@github.com:cosmos72/twin.git +cd twin +./configure +make +sudo make install +``` + +注意:如果要在 MacOS 或 BSD 上进行编译,则需要在运行 `make` 之前在文件 `include/Tw/autoconf.h` 和 `include/twautoconf.h` 中注释掉 `#define socklen_t int`。这个问题应该在 [twin #57][9] 解决了。 + +![twin text mode][10] + +第一次调用 twin 是一个挑战。你需要通过 `--hw` 参数告诉它正在使用哪种显示。例如,要启动文本模式的 twin,请输入 `twin --hw=tty,TERM=linux`。这里指定的 `TERM` 变量替代了你当前 Shell 中终端变量。要启动图形版本,运行 `twin --hw=X@$DISPLAY`。在 Linux 上,twin 一般都“可以正常工作”,而在 MacOS 上,Twin 基本是只能在终端上使用。 + +*真正*的乐趣是可以通过 `twattach` 和 `twdisplay` 命令接驳到正在运行的会话的功能。它们使你可以接驳到其他正在运行的 twin 会话。例如,在 Mac 上,我可以运行以下命令以接驳到演示机器上运行的 twin 会话: + +``` +twdisplay --twin@20days2020.local:0 --hw=tty,TERM=linux +``` + +![remote twin session][11] + +通过多做一些工作,你还可以将其用作登录外壳,以代替控制台上的 [getty][12]。这需要 gdm 鼠标守护程序、twdm 应用程序(包括)和一些额外的配置。在使用 systemd 的系统上,首先安装并启用 gdm(如果尚未安装),然后使用 `systemctl` 为控制台(我使用 tty6)创建一个覆盖。这些命令必须以 root 用户身份运行;在 Ubuntu 上,它们看起来像这样: + +``` +apt install gdm +systemctl enable gdm +systemctl start gdm +systemctl edit getty@tty6 +``` + +`systemctl edit getty@tty6` 命令将打开一个名为 `override.conf` 的空文件。它可以定义 systemd 服务设置以覆盖 tty6 的默认设置。将内容更新为: + +``` +[service] +ExecStart= +ExecStart=-/usr/local/sbin/twdm --hw=tty@/dev/tty6,TERM=linux +StandardInput=tty +StandardOutput=tty +``` + +现在,重新加载 systemd 并重新启动 tty6 以获得 twin 登录提示界面: + +``` +systemctl daemon-reload +systemctl restart getty@tty6 +``` + +![twin][13] + +这将为登录的用户启动一个 twin 会话。我不建议在多用户系统中使用此会话,但是对于个人桌面来说,这是很酷的。并且,通过使用 `twattach` 和 `twdisplay`,你可以从本地 GUI 或远程桌面访问该会话。 + +我认为 twin 真是太酷了。它还有一些细节不够完善,但是基本功能都已经有了,并且有一些非常好的文档。另外,它也使我可以在现代操作系统上稍解对 DESQview 式的体验的渴望。我希望随着时间的推移它会有所改进,希望你和我一样喜欢它。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/1/multiple-consoles-twin + +作者:[Kevin 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://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/browser_web_internet_website.png?itok=g5B_Bw62 (Digital creative of a browser on the internet) +[2]: https://en.wikipedia.org/wiki/DESQview +[3]: https://en.wikipedia.org/wiki/Message_Handling_System +[4]: https://opensource.com/sites/default/files/uploads/productivity_14-1.png (twin) +[5]: https://github.com/tmux/tmux/wiki +[6]: https://www.gnu.org/software/screen/ +[7]: https://github.com/cosmos72/twin +[8]: mailto:git@github.com +[9]: https://github.com/cosmos72/twin/issues/57 +[10]: https://opensource.com/sites/default/files/uploads/productivity_14-2.png (twin text mode) +[11]: https://opensource.com/sites/default/files/uploads/productivity_14-3.png (remote twin session) +[12]: https://en.wikipedia.org/wiki/Getty_(Unix) +[13]: https://opensource.com/sites/default/files/uploads/productivity_14-4.png (twin) diff --git a/published/202002/20200125 Use tmux to create the console of your dreams.md b/published/202002/20200125 Use tmux to create the console of your dreams.md new file mode 100644 index 0000000000..9e1d32dbd3 --- /dev/null +++ b/published/202002/20200125 Use tmux to create the console of your dreams.md @@ -0,0 +1,117 @@ +[#]: collector: (lujun9972) +[#]: translator: (wxy) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11900-1.html) +[#]: subject: (Use tmux to create the console of your dreams) +[#]: via: (https://opensource.com/article/20/1/tmux-console) +[#]: author: (Kevin Sonney https://opensource.com/users/ksonney) + +使用 tmux 创建你的梦想主控台 +====== + +> 使用 tmux 可以做很多事情,尤其是在将 tmuxinator 添加到其中时。在我们的二十篇系列文章的第十五期中查看它们,以在 2020 年实现开源生产力的提高。 + +![](https://img.linux.net.cn/data/attachment/album/202002/16/220832bd4l1ag4tlqxlpr4.jpg) + +去年,我在 19 天里给你介绍了 19 个新(对你而言)的生产力工具。今年,我换了一种方式:使用你在使用或者还没使用的工具,构建一个使你可以在新一年更加高效的环境。 + +### 使用 tmux 和 tmuxinator 全部放到主控台上 + +到目前为止,在本系列文章中,我已经撰写了有关单个应用程序和工具的文章。从今天开始,我将把它们放在一起进行全面设置以简化操作。让我们从命令行开始。为什么使用命令行?简而言之,在命令行上工作可以使我能够从运行 SSH 的任何位置访问许多这些工具和功能。我可以 SSH 进入我的一台个人计算机,并在工作计算机上运行与我的个人计算机上所使用的相同设置。我要使用的主要工具是 [tmux][2]。 + +大多数人都只使用了 tmux 非常基础的功能,比如说在远程服务器上打开 tmux,然后启动进程,也许还会打开第二个会话以查看日志文件或调试信息,然后断开连接并在稍后返回。但是其实你可以使用 tmux 做很多工作。 + +![tmux][3] + +首先,如果你有一个已有的 tmux 配置文件,请对其进行备份。tmux 的配置文件是 `~/.tmux.conf`。将其移动到另一个目录,例如 `~/tmp`。现在,用 Git 克隆 [Oh My Tmux][4] 项目。从该克隆目录中将 `.tmux.conf` 符号链接到你的家目录,并复制该克隆目录中的 `.tmux.conf.local` 文件到家目录中以进行调整: + +``` +cd ~ +mkdir ~/tmp +mv ~/.tmux.conf ~/tmp/ +git clone https://github.com/gpakosz/.tmux.git +ln -s ~/.tmux/.tmux.conf ./ +cp ~/.tmux/.tmux.conf.local ./ +``` + +`.tmux.conf.local` 文件包含了本地设置和覆盖的设置。例如,我稍微更改了默认颜色,然后启用了 [Powerline][5] 分隔线。下面的代码段仅显示了我更改过的内容: + +``` +tmux_conf_theme_24b_colour=true +tmux_conf_theme_focused_pane_bg='default' +tmux_conf_theme_pane_border_style=fat +tmux_conf_theme_left_separator_main='\uE0B0' +tmux_conf_theme_left_separator_sub='\uE0B1' +tmux_conf_theme_right_separator_main='\uE0B2' +tmux_conf_theme_right_separator_sub='\uE0B3' +#tmux_conf_battery_bar_symbol_full='◼' +#tmux_conf_battery_bar_symbol_empty='◻' +tmux_conf_battery_bar_symbol_full='♥' +tmux_conf_battery_bar_symbol_empty='·' +tmux_conf_copy_to_os_clipboard=true +set -g mouse on +``` + +请注意,你不需要安装 Powerline,你只需要支持 Powerline 符号的字体即可。我在与控制台相关的所有内容中几乎都使用 [Hack Nerd Font][6],因为它易于阅读并且具有许多有用的额外符号。你还会注意到,我打开了操作系统剪贴板支持和鼠标支持。 + +现在,当 tmux 启动时,底部的状态栏会以吸引人的颜色提供更多信息。`Ctrl` + `b` 仍然是输入命令的 “引导” 键,但其他一些进行了更改。现在水平拆分(顶部/底部)窗格为 `Ctrl` + `b` + `-`,垂直拆分为 `Ctrl` + `b` + `_`。启用鼠标模式后,你可以单击以在窗格之间切换,并拖动分隔线以调整其大小。打开新窗口仍然是 `Ctrl` + `b` + `n`,你现在可以单击底部栏上的窗口名称在它们之间进行切换。同样,`Ctrl` + `b` + `e` 将打开 `.tmux.conf.local` 文件以进行编辑。退出编辑器时,tmux 将重新加载配置,而不会重新加载其他任何内容。这很有用。 + +到目前为止,我仅对功能和视觉显示进行了一些简单的更改,并增加了鼠标支持。现在,我将它设置为以一种有意义的方式启动我想要的应用程序,而不必每次都重新定位和调整它们的大小。为此,我将使用 [tmuxinator][7]。tmuxinator 是 tmux 的启动器,它允许你指定和管理布局以及使用 YAML 文件自动启动应用程序。要使用它,请启动 tmux 并创建要在其中运行程序的窗格。然后,使用 `Ctrl` + `b` + `n` 打开一个新窗口,并执行 `tmux list-windows`。你将获得有关布局的详细信息。 + +![tmux layout information][8] + +请注意上面代码中的第一行,我在其中设置了四个窗格,每个窗格中都有一个应用程序。保存运行时的输出以供以后使用。现在,运行 `tmuxinator new 20days` 以创建名为 “20days” 的布局。这将显示一个带有默认布局文件的文本编辑器。它包含很多有用的内容,我建议你阅读所有选项。首先输入上方的布局信息以及所需的应用程序: + +``` +# /Users/ksonney/.config/tmuxinator/20days.yml +name: 20days +root: ~/ +windows: + - mail: + layout: d9da,208x60,0,0[208x26,0,0{104x26,0,0,0,103x26,105,0,5},208x33,0,27{104x33,0,27,1,103x33,105,27,4}]] @0 + panes: + - alot + - abook + - ikhal + - todo.sh ls +20days +``` + +注意空格缩进!与 Python 代码一样,空格和缩进关系到文件的解释方式。保存该文件,然后运行 `tmuxinator 20days`。你应该会得到四个窗格,分别是 [alot][9] 邮件程序、[abook][10]、ikhal(交互式 [khal][11] 的快捷方式)以及 [todo.txt][12] 中带有 “+20days” 标签的任何内容。 + +![sample layout launched by tmuxinator][13] + +你还会注意到,底部栏上的窗口标记为 “Mail”。你可以单击该名称(以及其他命名的窗口)以跳到该视图。漂亮吧?我在同一个文件中还设置了名为 “Social” 的第二个窗口,包括 [Tuir][14]、[Newsboat][15]、连接到 [BitlBee][16] 的 IRC 客户端和 [Rainbow Stream][17]。 + +tmux 是我跟踪所有事情的生产力动力之源,有了 tmuxinator,我不必在不断调整大小、放置和启动我的应用程序上费心。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/1/tmux-console + +作者:[Kevin 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://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/coffee_tea_laptop_computer_work_desk.png?itok=D5yMx_Dr (Person drinking a hat drink at the computer) +[2]: https://github.com/tmux/tmux +[3]: https://opensource.com/sites/default/files/uploads/productivity_15-1.png (tumux) +[4]: https://github.com/gpakosz/.tmux +[5]: https://github.com/powerline/powerline +[6]: https://www.nerdfonts.com/ +[7]: https://github.com/tmuxinator/tmuxinator +[8]: https://opensource.com/sites/default/files/uploads/productivity_15-2.png (tmux layout information) +[9]: https://opensource.com/article/20/1/organize-email-notmuch +[10]: https://opensource.com/article/20/1/sync-contacts-locally +[11]: https://opensource.com/article/20/1/open-source-calendar +[12]: https://opensource.com/article/20/1/open-source-to-do-list +[13]: https://opensource.com/sites/default/files/uploads/productivity_15-3.png (sample layout launched by tmuxinator) +[14]: https://opensource.com/article/20/1/open-source-reddit-client +[15]: https://opensource.com/article/20/1/open-source-rss-feed-reader +[16]: https://opensource.com/article/20/1/open-source-chat-tool +[17]: https://opensource.com/article/20/1/tweet-terminal-rainbow-stream diff --git a/published/202002/20200126 Use Vim to send email and check your calendar.md b/published/202002/20200126 Use Vim to send email and check your calendar.md new file mode 100644 index 0000000000..032329e76e --- /dev/null +++ b/published/202002/20200126 Use Vim to send email and check your calendar.md @@ -0,0 +1,113 @@ +[#]: collector: (lujun9972) +[#]: translator: (wxy) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11908-1.html) +[#]: subject: (Use Vim to send email and check your calendar) +[#]: via: (https://opensource.com/article/20/1/vim-email-calendar) +[#]: author: (Kevin Sonney https://opensource.com/users/ksonney) + +使用 Vim 发送邮件和检查日历 +====== + +> 在 2020 年用开源实现更高生产力的二十种方式的第十六篇文章中,直接通过文本编辑器管理你的电子邮件和日历。 + +![](https://img.linux.net.cn/data/attachment/album/202002/19/185842eyz2znxx1yc2ctnc.jpg) + +去年,我在 19 天里给你介绍了 19 个新(对你而言)的生产力工具。今年,我换了一种方式:使用你在使用或者还没使用的工具,构建一个使你可以在新一年更加高效的环境。 + +### 用 Vim 做(几乎)所有事情,第一部分 + +我经常使用两个文本编辑器 —— [Vim][2] 和 [Emacs][3]。为什么两者都用呢?它们有不同的使用场景,在本系列的后续几篇文章中,我将讨论其中的一些用例。 + +![][4] + +好吧,为什么要在 Vim 中执行所有操作?因为如果有一个应用程序是我可以访问的每台计算机上都有的,那就是 Vim。如果你像我一样,可能已经在 Vim 中打发了很多时光。那么,为什么不将其用于**所有事情**呢? + +但是,在此之前,你需要做一些事情。首先是确保你的 Vim 具有 Ruby 支持。你可以使用 `vim --version | grep ruby`。如果结果不是 `+ruby`,则需要解决这个问题。这可能有点麻烦,你应该查看发行版的文档以获取正确的软件包。在 MacOS 上,用的是官方的 MacVim(不是 Brew 发行的),在大多数 Linux 发行版中,用的是 vim-nox 或 vim-gtk,而不是 vim-gtk3。 + +我使用 [Pathogen][5] 自动加载插件和捆绑软件。如果你使用 [Vundle][6] 或其他 Vim 软件包管理器,则需要调整以下命令才能使用它。 + +#### 在 Vim 中管理你的邮件 + +使 Vim 在你的生产力计划中发挥更大作用的一个很好的起点是使用它通过 [Notmuch] [7] 发送和接收电子邮件,和使用 [abook] [8] 访问你的联系人列表。你需要为此安装一些东西。下面的所有示例代码都运行在 Ubuntu 上,因此如果你使用其他发行版,则需要对此进行调整。通过以下步骤进行设置: + +``` +sudo apt install notmuch-vim ruby-mail +curl -o ~/.vim/plugin/abook --create-dirs https://raw.githubusercontent.com/dcbaker/vim-abook/master/plugin/abook.vim +``` + +到目前为止,一切都很顺利。现在启动 Vim 并执行 `:NotMuch`。由于是用较旧版本的邮件库 `notmuch-vim` 编写的,可能会出现一些警告,但总的来说,Vim 现在将成为功能齐全的 Notmuch 邮件客户端。 + +![Reading Mail in Vim][9] + +如果要搜索特定标签,请输入 `\t`,输入标签名称,然后按回车。这将拉出一个带有该标签的所有消息的列表。`\s` 组合键会弹出 `Search:` 提示符,可以对 Notmuch 数据库进行全面搜索。使用箭头键浏览消息列表,按回车键显示所选项目,然后输入 `\q` 退出当前视图。 + +要撰写邮件,请使用 `\c` 按键。你将看到一条空白消息。这是 `abook.vim` 插件发挥作用的位置。按下 `Esc` 并输入 `:AbookQuery `,其中 `` 是你要查找的名称或电子邮件地址的一部分。你将在 abook 数据库中找到与你的搜索匹配的条目列表。通过键入你想要的地址的编号,将其添加到电子邮件的地址行中。完成电子邮件的键入和编辑,按 `Esc` 退出编辑模式,然后输入 `,s` 发送。 + +如果要在 `:NotMuch` 启动时更改默认文件夹视图,则可以将变量 `g:notmuch_folders` 添加到你的 `.vimrc` 文件中: + +``` +let g:notmuch_folders = [ + \ [ 'new', 'tag:inbox and tag:unread' ], + \ [ 'inbox', 'tag:inbox' ], + \ [ 'unread', 'tag:unread' ], + \ [ 'News', 'tag:@sanenews' ], + \ [ 'Later', 'tag:@sanelater' ], + \ [ 'Patreon', 'tag:@patreon' ], + \ [ 'LivestockConservancy', 'tag:livestock-conservancy' ], + \ ] +``` + +Notmuch 插件的文档中涵盖了更多设置,包括设置标签键和使用其它的邮件程序。 + +#### 在 Vim 中查询日历 + +![][10] + +遗憾的是,似乎没有使用 vCalendar 或 iCalendar 格式的 Vim 日历程序。有个 [Calendar.vim][11],做得很好。设置 Vim 通过以下方式访问你的日历: + +``` +cd ~/.vim/bundle +git clone git@github.com:itchyny/calendar.vim.git +``` + +现在,你可以通过输入 `:Calendar` 在 Vim 中查看日历。你可以使用 `<` 和 `>` 键在年、月、周、日和时钟视图之间切换。如果要从一个特定的视图开始,请使用 `-view=` 标志告诉它你希望看到哪个视图。你也可以在任何视图中定位日期。例如,如果我想查看 2020 年 7 月 4 日这一周的情况,请输入 `:Calendar -view week 7 4 2020`。它的帮助信息非常好,可以使用 `?` 键参看。 + +![][13] + +Calendar.vim 还支持 Google Calendar(我需要),但是在 2019 年 12 月,Google 禁用了它的访问权限。作者已在 [GitHub 上的这个提案][14]中发布了一种变通方法。 + +这样你就在 Vim 中有了这些:你的邮件、地址簿和日历。但是这些还没有完成; 下一篇你将在 Vim 上做更多的事情! + +Vim 为作家提供了很多好处,无论他们是否具有技术意识。 + +需要保持时间表正确吗?了解如何使用这些免费的开源软件来做到这一点。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/1/vim-email-calendar + +作者:[Kevin 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://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/calendar.jpg?itok=jEKbhvDT (Calendar close up snapshot) +[2]: https://www.vim.org/ +[3]: https://www.gnu.org/software/emacs/ +[4]: https://opensource.com/sites/default/files/uploads/day16-image1.png +[5]: https://github.com/tpope/vim-pathogen +[6]: https://github.com/VundleVim/Vundle.vim +[7]: https://opensource.com/article/20/1/organize-email-notmuch +[8]: https://opensource.com/article/20/1/sync-contacts-locally +[9]: https://opensource.com/sites/default/files/uploads/productivity_16-2.png (Reading Mail in Vim) +[10]: https://opensource.com/sites/default/files/uploads/day16-image3.png +[11]: https://github.com/itchyny/calendar.vim +[12]: mailto:git@github.com +[13]: https://opensource.com/sites/default/files/uploads/day16-image4.png +[14]: https://github.com/itchyny/calendar.vim/issues/156 diff --git a/published/20200126 What-s your favorite Linux distribution.md b/published/202002/20200126 What-s your favorite Linux distribution.md similarity index 100% rename from published/20200126 What-s your favorite Linux distribution.md rename to published/202002/20200126 What-s your favorite Linux distribution.md diff --git a/translated/tech/20200127 Use Vim to manage your task list and access Reddit and Twitter.md b/published/202002/20200127 Use Vim to manage your task list and access Reddit and Twitter.md similarity index 57% rename from translated/tech/20200127 Use Vim to manage your task list and access Reddit and Twitter.md rename to published/202002/20200127 Use Vim to manage your task list and access Reddit and Twitter.md index 8a50dd6f14..dcf7ef9dd8 100644 --- a/translated/tech/20200127 Use Vim to manage your task list and access Reddit and Twitter.md +++ b/published/202002/20200127 Use Vim to manage your task list and access Reddit and Twitter.md @@ -1,20 +1,22 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11912-1.html) [#]: subject: (Use Vim to manage your task list and access Reddit and Twitter) [#]: via: (https://opensource.com/article/20/1/vim-task-list-reddit-twitter) [#]: author: (Kevin Sonney https://opensource.com/users/ksonney) 使用 Vim 管理任务列表和访问 Reddit 和 Twitter ====== -在我们的 20 个使用开源提升生产力的系列的第十七篇文章中了解在编辑器中处理待办列表以及获取社交信息。 -![Chat via email][1] + +> 在 2020 年用开源实现更高生产力的二十种方式的第十七篇文章中,了解在编辑器中处理待办列表以及获取社交信息。 + +![](https://img.linux.net.cn/data/attachment/album/202002/21/112633yf3mx8qlssltugzm.jpg) 去年,我在 19 天里给你介绍了 19 个新(对你而言)的生产力工具。今年,我换了一种方式:使用你在使用或者还没使用的工具,构建一个使你可以在新一年更加高效的环境。 -### 使用 Vim 执行(几乎)所有操作,第 2 部分 +### 用 Vim 做(几乎)所有事情,第 2 部分 在[昨天的文章][2]中,你开始用 Vim 检查邮件和日历。今天,你可以做的更多。首先,你会在 Vim 编辑器中跟踪任务,然后获取社交信息。 @@ -24,13 +26,12 @@ 使用 Vim 编辑一个文本待办事件是一件自然的事,而 [todo.txt-vim][4] 包使其更加简单。首先安装 todo.txt-vim 包: - ``` -git clone ~/.vim/bundle/todo.txt-vim +git clone https://github.com/freitass/todo.txt-vim ~/.vim/bundle/todo.txt-vim vim ~/path/to/your/todo.txt ``` -todo.txt-vim 自动识别以 todo.txt 和 done.txt 结尾的文件作为 [todo.txt][5] 文件。它添加特定于 todo.txt 格式的键绑定。你可以使用 **\x** 标记“已完成”的内容,使用 **\d** 将其设置为当前日期,然后使用 **\a**、**\b** 和 **\c** 更改优先级。你可以提升(**\k**)或降低(**\j**)优先级,并根据项目(**\s+**)、上下文(**\s@**)或日期(**\sd**)排序(**\s**)。完成后,你可以和平常一样关闭和保存文件。 +todo.txt-vim 自动识别以 `todo.txt` 和 `done.txt` 结尾的文件作为 [todo.txt][5] 文件。它添加特定于 todo.txt 格式的键绑定。你可以使用 `\x` 标记“已完成”的内容,使用 `\d` 将其设置为当前日期,然后使用 `\a`、`\b` 和 `\c` 更改优先级。你可以提升(`\k`)或降低(`\j`)优先级,并根据项目(`\s+`)、上下文(`\s@`)或日期(`\sd`)排序(`\s`)。完成后,你可以和平常一样关闭和保存文件。 todo.txt-vim 包是我几天前写的 [todo.sh 程序][6]的一个很好的补充,使用 [todo edit][7] 加载项,它可以增强的你待办事项列表跟踪。 @@ -40,13 +41,12 @@ todo.txt-vim 包是我几天前写的 [todo.sh 程序][6]的一个很好的补 Vim 还有一个不错的用于 [Reddit][9] 的加载项,叫 [vim-reddit][10]。它不如 [Tuir][11] 好,但是用于快速查看最新的文章,它还是不错的。首先安装捆绑包: - ``` -git clone ~/.vim/bundle/vim-reddit +git clone https://github.com/DougBeney/vim-reddit.git ~/.vim/bundle/vim-reddit vim ``` -现在输入 **:Reddit** 将加载 Reddit 首页。你可以使用 **:Reddit name** 加载特定子板。打开文章列表后,使用箭头键导航或使用鼠标滚动。按 **o** 将在 Vim 中打开文章(除非它多媒体文章,它会打开浏览器),然后按 **c** 打开评论。如果要直接转到页面,请按 **O** 而不是 **o**。只需按 **u** 就能返回。当你 Reddit 看完后,输入 **:bd** 就行。vim-reddit 唯一的缺点是无法登录或发布新文章和评论。话又说回来,有时这是一件好事。 +现在输入 `:Reddit` 将加载 Reddit 首页。你可以使用 `:Reddit name` 加载特定子板。打开文章列表后,使用箭头键导航或使用鼠标滚动。按 `o` 将在 Vim 中打开文章(除非它多媒体文章,它会打开浏览器),然后按 `c` 打开评论。如果要直接转到页面,请按 `O` 而不是 `o`。只需按 `u` 就能返回。当你 Reddit 看完后,输入 `:bd` 就行。vim-reddit 唯一的缺点是无法登录或发布新文章和评论。话又说回来,有时这是一件好事。 #### 使用 twitvim 在 Vim 中发推 @@ -54,17 +54,15 @@ vim 最后,我们有 [twitvim][13],这是一个于阅读和发布 Twitter 的 Vim 软件包。它需要更多设置。首先从 GitHub 安装 twitvim: - ``` -`git clone https://github.com/twitvim/twitvim.git ~/.vim/bundle/twitvim` +git clone https://github.com/twitvim/twitvim.git ~/.vim/bundle/twitvim ``` -现在你需要编辑 **.vimrc** 文件并设置一些选项。它帮助插件知道使用哪些库与 Twitter 交互。运行 **vim --version** 并查看哪些语言的前面有 **+** 就代表你的 Vim 支持它。 +现在你需要编辑 `.vimrc` 文件并设置一些选项。它帮助插件知道使用哪些库与 Twitter 交互。运行 `vim --version` 并查看哪些语言的前面有 `+` 就代表你的 Vim 支持它。 ![Enabled and Disabled things in vim][14] -因为我的是 **+perl -python +python3**,所以我知道我可以启用 Perl 和 Python 3 但不是 Python 2 (python)。 - +因为我的是 `+perl -python +python3`,所以我知道我可以启用 Perl 和 Python 3 但不是 Python 2 (python)。 ``` " TwitVim Settings @@ -73,9 +71,9 @@ let twitvim_enable_perl = 1 let twitvim_enable_python3 = 1 ``` -现在,你可以通过运行 **:SetLoginTwitter** 启动浏览器窗口,它会打开一个浏览器窗口要求你授权 VimTwit 访问你的帐户。在 Vim 中输入提供的 PIN 后就可以了。 +现在,你可以通过运行 `:SetLoginTwitter` 启动浏览器窗口,它会打开一个浏览器窗口要求你授权 VimTwit 访问你的帐户。在 Vim 中输入提供的 PIN 后就可以了。 -Twitvim 的命令不像其他包中一样简单。要加载好友和关注者的时间线,请输入 **:FriendsTwitter**。要列出提及你的和回复,请使用 **:MentionsTwitter**。发布新推文是 **:PosttoTwitter <Your message>**。你可以滚动列表并输入 **\r** 回复特定推文,你可以用 **\d** 直接给某人发消息。 +Twitvim 的命令不像其他包中一样简单。要加载好友和关注者的时间线,请输入 `:FriendsTwitter`。要列出提及你的和回复,请使用 `:MentionsTwitter`。发布新推文是 `:PosttoTwitter `。你可以滚动列表并输入 `\r` 回复特定推文,你可以用 `\d` 直接给某人发消息。 就是这些了。你现在可以在 Vim 中做(几乎)所有事了! @@ -86,14 +84,14 @@ via: https://opensource.com/article/20/1/vim-task-list-reddit-twitter 作者:[Kevin Sonney][a] 选题:[lujun9972][b] 译者:[geekpi](https://github.com/geekpi) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 [a]: https://opensource.com/users/ksonney [b]: https://github.com/lujun9972 [1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/email_chat_communication_message.png?itok=LKjiLnQu (Chat via email) -[2]: https://opensource.com/article/20/1/send-email-and-check-your-calendar-vim +[2]: https://linux.cn/article-11908-1.html [3]: https://opensource.com/sites/default/files/uploads/productivity_17-1.png (to-dos and Twitter with Vim) [4]: https://github.com/freitass/todo.txt-vim [5]: http://todotxt.org diff --git a/published/202002/20200128 Send email and check your calendar with Emacs.md b/published/202002/20200128 Send email and check your calendar with Emacs.md new file mode 100644 index 0000000000..2ffdbd22d7 --- /dev/null +++ b/published/202002/20200128 Send email and check your calendar with Emacs.md @@ -0,0 +1,146 @@ +[#]: collector: (lujun9972) +[#]: translator: (lujun9972) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11932-1.html) +[#]: subject: (Send email and check your calendar with Emacs) +[#]: via: (https://opensource.com/article/20/1/emacs-mail-calendar) +[#]: author: (Kevin Sonney https://opensource.com/users/ksonney) + +使用 Emacs 发送电子邮件和检查日历 +====== + +> 在 2020 年用开源实现更高生产力的二十种方式的第十八篇文章中,使用 Emacs 文本编辑器管理电子邮件和查看日程安排。 + +![](https://img.linux.net.cn/data/attachment/album/202002/26/103647mnee75vxhcc00z06.jpg) + +去年,我给你们带来了 2019 年的 19 天新生产力工具系列。今年,我将采取一种不同的方式:建立一个新的环境,让你使用已用或未用的工具来在新的一年里变得更有效率。 + +### 使用 Emacs 做(几乎)所有的事情,第 1 部分 + +两天前,我曾经说过我经常使用 [Vim][2] 和 [Emacs][3],在本系列的 [16][4] 和 [17][5] 天,我讲解了如何在 Vim 中做几乎所有的事情。现在,Emacs 的时间到了! + +![Emacs 中的邮件和日历][6] + +在深入之前,我需要说明两件事。首先,我这里使用默认的 Emacs 配置,而不是我之前[写过][8]的 [Spacemacs][7]。为什么呢?因为这样一来我使用的就是默认快捷键,从而使你可以参考文档,而不必将“原生的 Emacs” 转换为 Spacemacs。第二,在本系列文章中我没有对 Org 模式进行任何设置。Org 模式本身几乎可以自成一个完整的系列,它非常强大,但是设置可能非常复杂。 + +#### 配置 Emacs + +配置 Emacs 比配置 Vim 稍微复杂一些,但以我之见,从长远来看,这样做是值得的。首先我们创建一个配置文件,并在 Emacs 中打开它: + +``` +mkdir ~/.emacs.d +emacs ~/.emacs.d/init.el +``` + +接下来,向内置的包管理器添加一些额外的包源。在 `init.el` 中添加以下内容: + +``` +(package-initialize) +(add-to-list 'package-archives '("melpa" . "")) +(add-to-list 'package-archives '("org" . "") t) +(add-to-list 'package-archives '("gnu" . "")) +(package-refresh-contents) +``` + +使用 `Ctrl+x Ctrl+s` 保存文件,然后按下 `Ctrl+x Ctrl+c` 退出,再重启 Emacs。Emacs 会在启动时下载所有的插件包列表,之后你就可以使用内置的包管理器安装插件了。输入 `Meta+x` 会弹出命令提示符(大多数键盘上 `Meta` 键就是的 `Alt` 键,而在 MacOS 上则是 `Option`)。在命令提示符下输入 `package-list-packages` 就会显示可以安装的包列表。遍历该列表并使用 `i` 键选择以下包: + +``` +bbdb +bbdb-vcard +calfw +calfw-ical +notmuch +``` + +选好软件包后按 `x` 安装它们。根据你的网络连接情况,这可能需要一段时间。你也许会看到一些编译错误,但是可以忽略它们。安装完成后,使用组合键 `Ctrl+x Ctrl+f` 打开 `~/.emacs.d/init.el`,并在 `(package-refresh-packages)` 之后、 `(custom-set-variables` 之前添加以下行到文件中。 +`(custom-set-variables` 行由 Emacs 内部维护,你永远不应该修改它之后的任何内容。以 `;;` 开头的行则是注释。 + +``` +;; Set up bbdb +(require 'bbdb) +(bbdb-initialize 'message) +(bbdb-insinuate-message) +(add-hook 'message-setup-hook 'bbdb-insinuate-mail) +;; set up calendar +(require 'calfw) +(require 'calfw-ical) +;; Set this to the URL of your calendar. Google users will use +;; the Secret Address in iCalendar Format from the calendar settings +(cfw:open-ical-calendar "") +;; Set up notmuch +(require 'notmuch) +;; set up mail sending using sendmail +(setq send-mail-function (quote sendmail-send-it)) +(setq user-mail-address "[myemail@mydomain.com][9]" +      user-full-name "My Name") +``` + +现在,你已经准备好使用自己的配置启动 Emacs 了!保存 `init.el` 文件(`Ctrl+x Ctrl+s`),退出 Emacs(`Ctrl+x Ctrl+c`),然后重启之。这次重启要多花些时间。 + +#### 使用 Notmuch 在 Emacs 中读写电子邮件 + +一旦你看到了 Emacs 启动屏幕,你就可以使用 [Notmuch][10] 来阅读电子邮件了。键入 `Meta+x notmuch`,你将看到 notmuch 的 Emacs 界面。 + +![使用 notmuch 阅读邮件][11] + +所有加粗的项目都是指向电子邮件视图的链接。你可以通过点击鼠标或者使用 `tab` 键在它们之间跳转并按回车来访问它们。你可以使用搜索栏来搜索 Notmuch 的数据库,语法与 Notmuch 命令行上的[语法][12] 相同。如果你愿意,还可以使用 `[save]` 按钮保存搜索以便未来使用,这些搜索会被添加到屏幕顶部的列表中。如果你进入一个链接就会看到一个相关电子邮件的列表。你可以使用箭头键在列表中导航,并在要读取的消息上按回车。按 `r` 可以回复一条消息,`f` 转发该消息,`q` 退出当前屏幕。 + +你可以通过键入 `Meta+x compose-mail` 来编写新消息。撰写、回复和转发都将打开编写邮件的界面。写完邮件后,按 `Ctrl+c Ctrl+c` 发送。如果你决定不发送它,按 `Ctrl+c Ctrl+k` 关闭消息撰写缓冲区(窗口)。 + +#### 使用 BBDB 在 Emacs 中自动补完电子邮件地址 + +![在消息中使用 BBDB 地址][13] + +那么通讯录怎么办?这就是 [BBDB][14] 发挥作用的地方。但首先我们需要从 [abook][15] 导入所有地址,方法是打开命令行并运行以下导出命令: + +``` +abook --convert --outformat vcard --outfile ~/all-my-addresses.vcf --infile ~/.abook/addresses +``` + +Emacs 启动后,运行 `Meta+x bbdb-vcard-import-file`。它将提示你输入要导入的文件名,即 `~/all-my-address.vcf`。导入完成后,在编写消息时,可以开始输入名称并使用 `Tab` 搜索和自动完成 “to” 字段的内容。BBDB 还会打开一个联系人缓冲区,以便你确保它是正确的。 + +既然在 [vdirsyncer][16] 中已经为每个地址都生成了对应的 .vcf 文件了,为什么我们还要这样做呢?如果你像我一样,有许多地址,一次处理一个地址是很麻烦的。这样做,你就可以把所有的东西都放在 abook 里,做成一个大文件。 + +#### 使用 calfw 在 Emacs 中浏览日历 + +![calfw 日历 ][17] + +最后,你可以使用 Emacs 查看日历。在上面的配置中,你安装了 [calfw][18] 包,并添加了一些行来告诉它在哪里可以找到要加载的日历。Calfw 是 “Emacs 日历框架Calendar Framework for Emacs”的简称,它支持多种日历格式。我使用的是谷歌日历,这也是我放在配置中的链接。日历将在启动时自动加载,你可以通过 `Ctrl+x+b` 命令切换到 cfw-calendar 缓冲区来查看日历。 + +Calfw 提供日、周、双周和月视图。你可以在日历顶部选择视图,并使用箭头键导航日历。不幸的是,calfw 只能查看日历,所以你仍然需要使用 [khal][19] 之类的工具或通过 web 界面来添加、删除和修改事件。 + +这就是 Emacs 中的邮件、日历和邮件地址。明天我会展示更多。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/1/emacs-mail-calendar + +作者:[Kevin Sonney][a] +选题:[lujun9972][b] +译者:[lujun9972](https://github.com/lujun9972) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/ksonney +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/email_paper_envelope_document.png?itok=uPj_kouJ (Document sending) +[2]: https://www.vim.org/ +[3]: https://www.gnu.org/software/emacs/ +[4]: https://linux.cn/article-11908-1.html +[5]: https://linux.cn/article-11912-1.html +[6]: https://opensource.com/sites/default/files/uploads/productivity_18-1.png (Mail and calendar in Emacs) +[7]: https://www.spacemacs.org/ +[8]: https://opensource.com/article/19/12/spacemacs +[9]: mailto:myemail@mydomain.com +[10]: https://notmuchmail.org/ +[11]: https://opensource.com/sites/default/files/uploads/productivity_18-2.png (Reading mail with Notmuch) +[12]: https://linux.cn/article-11807-1.html +[13]: https://opensource.com/sites/default/files/uploads/productivity_18-3.png (Composing a message with BBDB addressing) +[14]: https://www.jwz.org/bbdb/ +[15]: https://linux.cn/article-11834-1.html +[16]: https://linux.cn/article-11812-1.html +[17]: https://opensource.com/sites/default/files/uploads/productivity_18-4.png (calfw calendar) +[18]: https://github.com/kiwanami/emacs-calfw +[19]: https://khal.readthedocs.io/en/v0.9.2/index.html diff --git a/published/20200129 4 cool new projects to try in COPR for January 2020.md b/published/202002/20200129 4 cool new projects to try in COPR for January 2020.md similarity index 100% rename from published/20200129 4 cool new projects to try in COPR for January 2020.md rename to published/202002/20200129 4 cool new projects to try in COPR for January 2020.md diff --git a/translated/tech/20200129 Joplin- The True Open Source Evernote Alternative.md b/published/202002/20200129 Joplin- The True Open Source Evernote Alternative.md similarity index 59% rename from translated/tech/20200129 Joplin- The True Open Source Evernote Alternative.md rename to published/202002/20200129 Joplin- The True Open Source Evernote Alternative.md index a4ce65d52b..106d670f11 100644 --- a/translated/tech/20200129 Joplin- The True Open Source Evernote Alternative.md +++ b/published/202002/20200129 Joplin- The True Open Source Evernote Alternative.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11896-1.html) [#]: subject: (Joplin: The True Open Source Evernote Alternative) [#]: via: (https://itsfoss.com/joplin/) [#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/) @@ -10,53 +10,50 @@ Joplin:真正的 Evernote 开源替代品 ====== -_**简介:Joplin 是一个开源笔记记录和待办应用。你可以将笔记组织到笔记本中并标记它们。Joplin 还提供网络剪贴板来保存来自互联网的文章。**_ - +> Joplin 是一个开源笔记记录和待办应用。你可以将笔记组织到笔记本中并标记它们。Joplin 还提供网络剪贴板来保存来自互联网的文章。 ### Joplin:开源笔记管理器 -![][1] +![][4] -如果你喜欢[Evernote][2],那么你不会不太适应开源软件 [Joplin][3]。 +如果你喜欢 [Evernote][2],那么你不会不太适应这个开源软件 [Joplin][3]。 -Joplin 是一个优秀的开源笔记应用,拥有丰富的功能。你可以记笔记、写待办事项并且通过和 Dropbox 和 NextCloud 等云服务链接来跨设备同步笔记。同步通过端到端加密保护。 +Joplin 是一个优秀的开源笔记应用,拥有丰富的功能。你可以记笔记、记录待办事项并且通过和 Dropbox 和 NextCloud 等云服务链接来跨设备同步笔记。同步过程通过端到端加密保护。 -Joplin 还有一个 Web 剪贴板,能让你将网页另存为笔记。网络剪贴板可用于 Firefox 和 Chrome/Chromium 浏览器。 +Joplin 还有一个 Web 剪贴板,能让你将网页另存为笔记。这个网络剪贴板可用于 Firefox 和 Chrome/Chromium 浏览器。 -Joplin 可以导入 enex 格式的 Evernote 文件, 这让从 Evernote 切换变得容易。 +Joplin 可以导入 enex 格式的 Evernote 文件,这让从 Evernote 切换变得容易。 -因为自己保存数据,你可以用 Joplin 格式或者原始格式导出所有文件。 +因为数据自行保存,所以你可以用 Joplin 格式或者原始格式导出所有文件。 ### Joplin 的功能 -![][4] +![][1] 以下是 Joplin 的所有功能列表: +* 将笔记保存到笔记本和子笔记本中,以便更好地组织 +* 创建待办事项清单 +* 可以标记和搜索笔记 +* 离线优先,因此即使没有互联网连接,所有数据始终在设备上可用 +* Markdown 笔记支持图片、数学符号和复选框 +* 支持附件 +* 可在桌面、移动设备和终端(CLI)使用 +* 可在 Firefox 和 Chrome 使用[网页剪切板][5] +* 端到端加密 +* 保留笔记历史 +* 根据名称、时间等对笔记进行排序 +* 可与 [Nextcloud][7]、Dropbox、WebDAV 和 OneDrive 等各种[云服务][6]同步 +* 从 Evernote 导入文件 +* 导出 JEX 文件(Joplin 导出格式)和原始文件 +* 支持笔记、待办事项、标签和笔记本 +* 任意跳转功能 +* 支持移动设备和桌面应用通知 +* 地理位置支持 +* 支持多种语言 +* 外部编辑器支持:在 Joplin 中一键用你最喜欢的编辑器打开笔记 - * 将笔记保存到笔记本和子笔记本中,以便更好地组织 -  * 创建待办事项清单 -  * 笔记可以被标记和搜索 -  * 离线优先,因此即使没有互联网连接,所有数据始终在设备上可用 -  * Markdown 笔记支持图片、数学符号和复选框 -  * 支持附件 -  * 应用可在桌面、移动设备和终端(CLI)使用 -  * 可在 Firefox 和 Chrome 使用[网页剪切板][5] -  * 端到端加密 -  * 保留笔记历史 -  * 根据名称,时间等对笔记进行排序 -  * 与 [Nextcloud][7]、Dropbox、WebDAV 和 OneDrive 等各种[云服务][6]同步 -  * 从 Evernote 导入文件 -  * 导出 JEX 文件(Joplin 导出格式)和原始文件。 -  * 支持笔记、待办事项、标签和笔记本。 -  * 任意跳转功能。 -  * 支持移动设备和桌面应用通知。 -  * 地理位置支持。 -  * 支持多种语言 -  * 外部编辑器支持–在 Joplin 中一键用你最喜欢的编辑器打开笔记。 - - -### Installing Joplin on Linux and other platforms +### 在 Linux 和其它平台上安装 Joplin ![][10] @@ -64,23 +61,23 @@ Joplin 可以导入 enex 格式的 Evernote 文件, 这让从 Evernote 切换 在 Linux 中,你可以获取 Joplin 的 [AppImage][14] 文件,并作为可执行文件运行。你需要为下载的文件授予执行权限。 -[Download Joplin][15] +- [下载 Joplin][15] ### 体验 Joplin -Joplin 中的笔记使用 markdown,但你不需要了解它。编辑器的顶部面板能让你以图形方式选择项目符号、标题、图像、链接等。 +Joplin 中的笔记使用 Markdown,但你不需要了解它。编辑器的顶部面板能让你以图形方式选择项目符号、标题、图像、链接等。 虽然 Joplin 提供了许多有趣的功能,但你需要自己去尝试。例如,默认情况下未启用 Web 剪切板,我需要发现如何打开它。 -你需要从桌面应用启用剪切板。在顶部菜单中,进入 “Tools->Options”。你可以在此处找到 Web 剪切板选项: +你需要从桌面应用启用剪切板。在顶部菜单中,进入 “Tools->Options”。你可以在此处找到 Web 剪切板选项: ![Enable Web Clipper from the desktop application first][16] -它的 Web 剪切板不如 Evernote 的 Web 剪切板聪明,后者可以以图形方式剪辑网页文章的一部分。但是,它也足够了。 +它的 Web 剪切板不如 Evernote 的 Web 剪切板聪明,后者可以以图形方式剪辑网页文章的一部分。但是,也足够了。 -这是一个在积极开发中的开源软件,我希望它随着时间的推移得到更多的改进。 +这是一个在活跃开发中的开源软件,我希望它随着时间的推移得到更多的改进。 -**总结** +### 总结 如果你正在寻找一个不错的拥有 Web 剪切板的笔记应用,你可以试试 Joplin。如果你喜欢它,并将继续使用,尝试通过捐赠或改进代码和文档来帮助 Joplin 开发。我以 FOSS 的名义[捐赠][17]了 25 欧。 @@ -93,7 +90,7 @@ via: https://itsfoss.com/joplin/ 作者:[Abhishek Prakash][a] 选题:[lujun9972][b] 译者:[geekpi](https://github.com/geekpi) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 diff --git a/published/20200129 Showing memory usage in Linux by process and user.md b/published/202002/20200129 Showing memory usage in Linux by process and user.md similarity index 100% rename from published/20200129 Showing memory usage in Linux by process and user.md rename to published/202002/20200129 Showing memory usage in Linux by process and user.md diff --git a/published/202002/20200130 Meet FuryBSD- A New Desktop BSD Distribution.md b/published/202002/20200130 Meet FuryBSD- A New Desktop BSD Distribution.md new file mode 100644 index 0000000000..611ed7c315 --- /dev/null +++ b/published/202002/20200130 Meet FuryBSD- A New Desktop BSD Distribution.md @@ -0,0 +1,92 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11915-1.html) +[#]: subject: (Meet FuryBSD: A New Desktop BSD Distribution) +[#]: via: (https://itsfoss.com/furybsd/) +[#]: author: (John Paul https://itsfoss.com/author/john/) + +认识 FuryBSD:一个新的桌面 BSD 发行版 +====== + +在过去的几个月中,出现了一些新的桌面 BSD。之前有 [HyperbolaBSD,它之前是 Hyperbola GNU/Linux][1]。[BSD][2] 世界中的另一个新入者是 [FuryBSD][3]。 + +### FuryBSD:一个新的 BSD 发行版 + +![][4] + +从本质上讲,FuryBSD 是一个非常简单的小东西。根据[它的网站][5]:“FuryBSD 一个是基于 FreeBSD 的轻量级桌面发行版。” 它基本上是预配置了桌面环境,并预安装了多个应用的 FreeBSD。目地是快速地在你的计算机上运行基于 FreeBSD 的系统。 + +你可能会认为这听起来很像其他几个已有的 BSD,例如 [NomadBSD][6] 和 [GhostBSD][7]。这些 BSD 与 FuryBSD 之间的主要区别在于 FuryBSD 与现有的 FreeBSD 更加接近。例如,FuryBSD 使用 FreeBSD 安装程序,而其他发行版则用了自己的安装程序和工具。 + +正如[它的网站][8]所说:“尽管 FuryBSD 可能类似于 PC-BSD 和 TrueOS 等图形化 BSD 项目,但 FuryBSD 是由不同的团队创建的,并且采用了不同与 FreeBSD 着重于紧密集成的方法。这样可以降低开销,并保持与上游的兼容性。”开发负责人还告诉我:“FuryBSD 的一个主要重点是使其成为一种小型现场版介质,并带有一些测试硬件驱动程序的辅助工具。” + +当前,你可以进入 [FuryBSD 主页][3]并下载 XFCE 或 KDE 的 LiveCD。GNOME 版本正在开发中。 + +### FuryBSD 的背后是谁 + +FuryBSD 的主要开发者是 [Joe Maloney][9]。Joe 多年来一直是 FreeBSD 的用户。他为 PC-BSD 等其他 BSD 项目做过贡献。他还与 GhostBSD 的创建者 Eric Turgeon 一起重写了 GhostBSD LiveCD。在此过程中,他对 BSD 有了更好的了解,并开始形成自己如何做一个发行版的想法。 + +Joe 与其他参与 BSD 世界多年的开发者一起加入了开发,例如 Jaron Parsons、Josh Smith 和 Damian Szidiropulosz。 + +### FuryBSD 的未来 + +目前,FuryBSD 仅仅是预配置的 FreeBSD。但是,开发者有一份[要改进的清单][5]。包括: + +* 可靠的加载框架、第三方专有图形驱动、无线网络 +* 进一步整理 LiveCD 体验,以使其更加友好 +* 开箱即用的打印支持 +* 包含更多默认应用,以提供完整的桌面体验 +* 集成的 [ZFS][10] 复制工具,用于备份和还原 +* Live 镜像持久化选项 +* 默认自定义 pkg 仓库 +* 用于应用更新的持续集成 +* 桌面 FreeBSD 的质量保证 +* 自定义、色彩方案和主题 +* 目录服务集成 +* 安全加固 + +开发者非常清楚地表明,他们所做的任何更改都需要大量的思考和研究。他们不会改进某个功能,只会在它破坏一些东西时删除或者修改它。 + +![FuryBSD desktop][11] + +### 你可以如何帮助 FuryBSD? + +目前,该项目还很年轻。由于所有项目都需要帮助才能生存,所以我问 Joe 他们正在寻求什么样的帮助。他说:“我们可以帮助[在论坛上回答问题][12]、回答 [GitHub][13] 上的问题,完善文档。”他还说如果人们想增加对其他桌面环境的支持,欢迎发起拉取请求。 + +### 最后的想法 + +尽管我还没有尝试过,但是我对 FuryBSD 感觉不错。听起来项目在掌握中。十多年来,Joe Maloney 一直在思考如何达到最佳的 BSD 桌面体验。与大多数 Linux 发行版基本上都是经过重新设计的 Ubuntu 不同,FuryBSD 背后的开发者知道他们在做什么,并且他们在更看重质量而不是花哨的功能。 + +你对这个在不断增长的桌面 BSD 市场的新入者怎么看?你尝试过 FuryBSD 或者会尝试一下吗?请在下面的评论中告诉我们。 + +如果你觉得这篇文章有趣,请在 Hacker News 或 [Reddit][14] 等社交媒体上分享它。 + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/furybsd/ + +作者:[John Paul][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://itsfoss.com/author/john/ +[b]: https://github.com/lujun9972 +[1]: https://itsfoss.com/hyperbola-linux-bsd/ +[2]: https://itsfoss.com/bsd/ +[3]: https://www.furybsd.org/ +[4]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/01/fury-bsd.jpg?ssl=1 +[5]: https://www.furybsd.org/manifesto/ +[6]: https://itsfoss.com/nomadbsd/ +[7]: https://ghostbsd.org/ +[8]: https://www.furybsd.org/furybsd-video-overview-at-knoxbug/ +[9]: https://github.com/pkgdemon +[10]: https://itsfoss.com/what-is-zfs/ +[11]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/01/FuryBSDS-desktop.jpg?resize=800%2C450&ssl=1 +[12]: https://forums.furybsd.org/ +[13]: https://github.com/furybsd +[14]: https://reddit.com/r/linuxusersgroup diff --git a/published/20200131 Intro to the Linux command line.md b/published/202002/20200131 Intro to the Linux command line.md similarity index 100% rename from published/20200131 Intro to the Linux command line.md rename to published/202002/20200131 Intro to the Linux command line.md diff --git a/published/20200202 4 Key Changes to Look Out for in Linux Kernel 5.6.md b/published/202002/20200202 4 Key Changes to Look Out for in Linux Kernel 5.6.md similarity index 100% rename from published/20200202 4 Key Changes to Look Out for in Linux Kernel 5.6.md rename to published/202002/20200202 4 Key Changes to Look Out for in Linux Kernel 5.6.md diff --git a/published/202002/20200203 Give an old MacBook new life with Linux.md b/published/202002/20200203 Give an old MacBook new life with Linux.md new file mode 100644 index 0000000000..4a2ec03b17 --- /dev/null +++ b/published/202002/20200203 Give an old MacBook new life with Linux.md @@ -0,0 +1,83 @@ +[#]: collector: (lujun9972) +[#]: translator: (qianmingtian) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11902-1.html) +[#]: subject: (Give an old MacBook new life with Linux) +[#]: via: (https://opensource.com/article/20/2/macbook-linux-elementary) +[#]: author: (Don Watkins https://opensource.com/users/don-watkins) + +用 Linux 让旧 MacBook 焕发新生 +====== + +> Elementary OS 的最新版本 Hera 是一个令人印象深刻的平台,它可以让过时的 MacBook 得以重生。 + +![](https://img.linux.net.cn/data/attachment/album/202002/18/113614k2jx6ju7uuu0alhk.png) + +当我安装苹果的 [MacOS Mojave][2] 时,它使我以前可靠的 MacBook Air 慢得像爬一样。我的计算机发售于 2015 年,具有 4 GB 内存、i5 处理器和 Broadcom 4360 无线卡,但是对于我的日常使用来说,Mojava 有点过分了,它不能和 [GnuCash][3] 一起工作,这激起了我重返 Linux 的欲望。我很高兴能重返,但是我深感遗憾的是,我的这台出色的 MacBook 被闲置了。 + +我在 MacBook Air 上尝试了几种 Linux 发行版,但总会有缺陷。有时是无线网卡;还有一次,它缺少对触摸板的支持。看了一些不错的评论后,我决定尝试 [Elementary OS][4] 5.0(Juno)。我用 USB [制作了启动盘][5],并将其插入 MacBook Air 。我来到了一个现场live桌面,并且操作系统识别出了我的 Broadcom 无线芯片组 —— 我认为这可能行得通! + +我喜欢在 Elementary OS 中看到的内容。它的 [Pantheon][6] 桌面真的很棒,并且其外观和使用起来的感觉对 Apple 用户来说很熟悉 —— 它的显示屏底部有一个扩展坞,并带有一些指向常用应用程序的图标。我对我之前期待的预览感到满意,所以我决定安装它,然后我的无线设备消失了。真的很令人失望。我真的很喜欢 Elementary OS ,但是没有无线网络是不行的。 + +时间快进到 2019 年 12 月,当我在 [Linux4Everyone][7] 播客上听到有关 Elementary 最新版本 v.5.1(Hera) 使 MacBook 复活的评论时,我决定用 Hera 再试一次。我下载了 ISO ,创建了可启动驱动器,将其插入电脑,这次操作系统识别了我的无线网卡。我可以在上面工作了。 + +![运行 Hera 的 MacBook Air][8] + +我非常高兴我轻巧又功能强大的 MacBook Air 通过 Linux 焕然一新。我一直在更详细地研究 Elementary OS,我可以告诉你我印象深刻的东西。 + +### Elementary OS 的功能 + +根据 [Elementary 的博客][9],“新设计的登录和锁定屏幕问候语看起来更清晰、效果更好,并且修复了以前问候语中报告的许多问题,包括输入焦点问题,HiDPI 问题和更好的本地化。Hera 的新设计是为了响应来自 Juno 的用户反馈,并启用了一些不错的新功能。” + +“不错的新功能”是在轻描淡写 —— Elementary OS 拥有我见过的最佳设计的 Linux 用户界面之一。默认情况下,系统上的“系统设置”图标位于扩展坞上。更改设置很容易,很快我就按照自己的喜好配置了系统。我需要的文字大小比默认值大,辅助功能是易于使用的,允许我设置大文字和高对比度。我还可以使用较大的图标和其他选项来调整扩展坞。 + +![Elementary OS 的设置界面][10] + +按下 Mac 的 Command 键将弹出一个键盘快捷键列表,这对新用户非常有帮助。 + +![Elementary OS 的键盘快捷键][11] + +Elementary OS 附带的 [Epiphany][12] Web 浏览器,我发现它非常易于使用。它与 Chrome、Chromium 或 Firefox 略有不同,但它已经绰绰有余。 + +对于注重安全的用户(我们应该都是),Elementary OS 的安全和隐私设置提供了多个选项,包括防火墙、历史记录、锁定,临时和垃圾文件的自动删除以及用于位置服务开/关的开关。 + +![Elementary OS 的隐私与安全][13] + +### 有关 Elementray OS 的更多信息 + +Elementary OS 最初于 2011 年发布,其最新版本 Hera 于 2019 年 12 月 3 日发布。 Elementary 的联合创始人兼 CXO 的 [Cassidy James Blaede][14] 是操作系统的 UX 架构师。 Cassidy 喜欢使用开放技术来设计和构建有用、可用和令人愉悦的数字产品。 + +Elementary OS 具有出色的用户[文档][15],其代码(在 GPL 3.0 下许可)可在 [GitHub][16] 上获得。Elementary OS 鼓励参与该项目,因此请务必伸出援手并[加入社区][17]。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/2/macbook-linux-elementary + +作者:[Don Watkins][a] +选题:[lujun9972][b] +译者:[qianmingtian][c] +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/don-watkins +[b]: https://github.com/lujun9972 +[c]: https://github.com/qianmingtian +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/coffee_cafe_brew_laptop_desktop.jpg?itok=G-n1o1-o (Coffee and laptop) +[2]: https://en.wikipedia.org/wiki/MacOS_Mojave +[3]: https://www.gnucash.org/ +[4]: https://elementary.io/ +[5]: https://opensource.com/life/14/10/test-drive-linux-nothing-flash-drive +[6]: https://opensource.com/article/19/12/pantheon-linux-desktop +[7]: https://www.linux4everyone.com/20-macbook-pro-elementary-os +[8]: https://opensource.com/sites/default/files/uploads/macbookair_hera.png (MacBook Air with Hera) +[9]: https://blog.elementary.io/introducing-elementary-os-5-1-hera/ +[10]: https://opensource.com/sites/default/files/uploads/elementaryos_settings.png (Elementary OS's Settings screen) +[11]: https://opensource.com/sites/default/files/uploads/elementaryos_keyboardshortcuts.png (Elementary OS's Keyboard shortcuts) +[12]: https://en.wikipedia.org/wiki/GNOME_Web +[13]: https://opensource.com/sites/default/files/uploads/elementaryos_privacy-security.png (Elementary OS's Privacy and Security screen) +[14]: https://github.com/cassidyjames +[15]: https://elementary.io/docs/learning-the-basics#learning-the-basics +[16]: https://github.com/elementary +[17]: https://elementary.io/get-involved diff --git a/published/202002/20200203 Troubleshoot Kubernetes with the power of tmux and kubectl.md b/published/202002/20200203 Troubleshoot Kubernetes with the power of tmux and kubectl.md new file mode 100644 index 0000000000..8fe0552828 --- /dev/null +++ b/published/202002/20200203 Troubleshoot Kubernetes with the power of tmux and kubectl.md @@ -0,0 +1,158 @@ +[#]: collector: (lujun9972) +[#]: translator: (guevaraya) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11930-1.html) +[#]: subject: (Troubleshoot Kubernetes with the power of tmux and kubectl) +[#]: via: (https://opensource.com/article/20/2/kubernetes-tmux-kubectl) +[#]: author: (Abhishek Tamrakar https://opensource.com/users/tamrakar) + +利用 Tmux 和 kubectl 解决 Kubernetes 故障 +====== + +> 一个使用 tmux 的 kubectl 插件可以使 Kubernetes 疑难问题变得更简单。 + +![](https://img.linux.net.cn/data/attachment/album/202002/25/125435a4v3vpss3s4w3sks.jpg) + +[Kubernetes][2] 是一个活跃的开源容器管理平台,它提供了可扩展性、高可用性、健壮性和富有弹性的应用程序管理。它的众多特性之一是支持通过其主要的二进制客户端 [kubectl][3] 运行定制脚本或可执行程序,kubectl 很强大的,允许用户在 Kubernetes 集群上用它直接做很多事情。 + +### 使用别名进行 Kubernetes 的故障排查 + +使用 Kubernetes 进行容器编排的人都知道由于设计上原因带来了其功能的复杂性。举例说,迫切需要以更快的速度并且几乎不需要手动干预的方式来简化 Kubernetes 中的故障排除(除过特殊情况)。 + +在故障排查功能方面,有很多场景需要考虑。在一种场景下,你知道你需要运行什么,但是这个命令的语法(即使作为一个单独的命令运行)过于复杂,或需要一、两次交互才能起作用。 + +例如,如果你需要经常进入一个系统命名空间中运行的容器,你可能发现自己在重复地键入: + +``` +kubectl --namespace=kube-system exec -i -t +``` + +为了简化故障排查,你可以用这些指令的命令行别名。比如,你可以增加下面命令到你的隐藏配置文件(`.bashrc` 或 `.zshrc`): + +``` +alias ksysex='kubectl --namespace=kube-system exec -i -t' +``` + +这是来自于 [Kubernetes 常见别名][4]存储库的一个例子,它展示了一种简化 `kubectl` 中的功能的方法。像这种场景下的简单情形,使用别名很有用。 + +### 切换到 kubectl 插件 + +更复杂的故障排查场景是需要一个一个的执行很多命令,调查环境,最后得出结论。仅仅用别名方法是不能解决这种情况的;你需要知道你所部署的 Kubernetes 之间逻辑和相关性,你真正需要的是自动化,以在更短的时间内输出你想要的。 + +考虑到你的集群有 10 ~ 20 或 50 ~ 100 个命名空间来提供不同的微服务。一般在进行故障排查时,什么对你有帮助? + +* 你需要能够快速分辨出抛出错误的是哪个 命名空间的哪个 Pod 的东西。 +* 你需要一些可监视一个命名空间的所有 Pod 日志的东西。 +* 你可能也需要监视特定命名空间的出现错误的某个 Pod 的日志。 + +涵盖这些要点的解决方案对于定位生产环境的问题有很大的帮助,以及在开发和测试环节中也很有用。 + +你可以用 [kubectl 插件][5]创建比简单的别名更强大的功能。插件类似于其它用任何语言编写的独立脚本,但被设计为可以扩充 Kubernetes 管理员的主要命令。 + +创建一个插件,你必须用 `kubectl-` 的正确的语法来拷贝这个脚本到 `$PATH` 中的导出目录之一,并需要为其赋予可执行权限(`chmod +x`)。 + +创建插件之后将其移动到路径中,你可以立即运行它。例如,我的路径下有一个 `kubectl-krawl` 和 `kubectl-kmux`: + +``` +$ kubectl plugin list +The following compatible plugins are available: + +/usr/local/bin/kubectl-krawl +/usr/local/bin/kubectl-kmux + +$ kubectl kmux +``` + +现在让我们见识下带有 tmux 的 Kubernetes 的有多强大。 + +### 驾驭强大的 tmux + +[Tmux][6] 是一个非常强大的工具,许多管理员和运维团队都依赖它来解决与易操作性相关的问题:通过将窗口分成多个窗格以便在多台计算机上运行并行的调试来监视日志。它的主要的优点是可在命令行或自动化脚本中使用。 + +我创建[一个 kubectl 插件][7],使用 tmux 使故障排查更加简单。我将通过注释来解析插件背后的逻辑(插件的完整代码留待给你实现): + +``` +# NAMESPACE 是要监控的名字空间 +# POD 是 Pod 名称 +# Containers 是容器名称 + +# 初始化一个计数器 n 以计算循环计数的数量, +# 之后 tmux 使用它来拆分窗格。 +n=0; + +# 在 Pod 和容器列表上开始循环 +while IFS=' ' read -r POD CONTAINERS +do + # tmux 为每个 Pod 创建一个新窗口 + tmux neww $COMMAND -n $POD 2>/dev/null + # 对运行中的 Pod 中 的所有容器启动循环 + for CONTAINER in ${CONTAINERS//,/ } + do + if [ x$POD = x -o x$CONTAINER = x ]; then + # 如果任何值为 null,则退出。 + warn "Looks like there is a problem getting pods data." + break + fi + + # 设置要执行的命令 + COMMAND=”kubectl logs -f $POD -c $CONTAINER -n $NAMESPACE” + # 检查 tmux 会话 + if tmux has-session -t <会话名> 2>/dev/null; + then + <设置会话退出> + else + <创建会话> + fi + # 在当前窗口为每个容器切分窗格 + tmux selectp -t $n \; \ + splitw $COMMAND \; \ + select-layout tiled \; + # 终止容器循环 + done + + # 用 Pod 名称重命名窗口以识别 + tmux renamew $POD 2>/dev/null + + # 增加计数器 + ((n+=1)) + +# 终止 Pod 循环 +done<<(<从 kubernetes 集群获取 Pod 和容器的列表>) + +# 最后选择窗口并附加会话 +tmux selectw -t <会话名>:1 \; \ +attach-session -t <会话名>\; +``` + +运行插件脚本后,将产生类似于下图的输出。每个 Pod 有一个自己的窗口,每个容器(如果有多个)被分割到其窗口中 Pod 窗格中,并在日志到达时输出。Tmux 之美如下可见;通过正确的配置,你甚至会看到哪个窗口正处于激活运行状态(可看到标签是白色的)。 + +![kmux 插件的输出][8] + +### 总结 + +别名是在 Kubernetes 环境下常见的也有用的简易故障排查方法。当环境变得复杂,用高级脚本生成的kubectl 插件是一个更强大的方法。至于用哪个编程语言来编写 kubectl 插件是没有限制。唯一的要求是该名字在路径中是可执行的,并且不能与已知的 kubectl 命令重复。 + +要阅读完整的插件源码,或试试我创建的插件,请查看我的 [kube-plugins-github][7] 存储库。欢迎提交提案和补丁。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/2/kubernetes-tmux-kubectl + +作者:[Abhishek Tamrakar][a] +选题:[lujun9972][b] +译者:[guevaraya](https://github.com/guevaraya) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/tamrakar +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/OSDC_women_computing_4.png?itok=VGZO8CxT (一个坐在笔记本面前的妇女) +[2]: https://opensource.com/resources/what-is-kubernetes +[3]: https://kubernetes.io/docs/reference/kubectl/overview/ +[4]: https://github.com/ahmetb/kubectl-aliases/blob/master/.kubectl_aliases +[5]: https://kubernetes.io/docs/tasks/extend-kubectl/kubectl-plugins/ +[6]: https://opensource.com/article/19/6/tmux-terminal-joy +[7]: https://github.com/abhiTamrakar/kube-plugins +[8]: https://raw.githubusercontent.com/abhiTamrakar/kube-plugins/master/kmux/kmux.png diff --git a/published/20200204 Ubuntu 19.04 Has Reached End of Life- Existing Users Must Upgrade to Ubuntu 19.10.md b/published/202002/20200204 Ubuntu 19.04 Has Reached End of Life- Existing Users Must Upgrade to Ubuntu 19.10.md similarity index 100% rename from published/20200204 Ubuntu 19.04 Has Reached End of Life- Existing Users Must Upgrade to Ubuntu 19.10.md rename to published/202002/20200204 Ubuntu 19.04 Has Reached End of Life- Existing Users Must Upgrade to Ubuntu 19.10.md diff --git a/translated/tech/20200205 Getting started with GnuCash.md b/published/202002/20200205 Getting started with GnuCash.md similarity index 75% rename from translated/tech/20200205 Getting started with GnuCash.md rename to published/202002/20200205 Getting started with GnuCash.md index 69ef66261d..00dc0465c5 100644 --- a/translated/tech/20200205 Getting started with GnuCash.md +++ b/published/202002/20200205 Getting started with GnuCash.md @@ -1,31 +1,31 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11895-1.html) [#]: subject: (Getting started with GnuCash) [#]: via: (https://opensource.com/article/20/2/gnucash) [#]: author: (Don Watkins https://opensource.com/users/don-watkins) 开始使用 GnuCash ====== -使用 GnuCash 管理你的个人或小型企业会计。 -![A dollar sign in a network][1] -在过去的四年里,我一直在用 [GnuCash][2] 来管理我的个人财务,我对此非常满意。这个开源 (GPL v3) 项目自 1998 年首次发布以来一直成长和改进,2019 年 12 月发布的最新版本 3.8 增加了许多改进和 bug 修复。 +> 使用 GnuCash 管理你的个人或小型企业会计。 + +![](https://img.linux.net.cn/data/attachment/album/202002/15/124236wz5e0z5vq7571qby.jpg) + +在过去的四年里,我一直在用 [GnuCash][2] 来管理我的个人财务,我对此非常满意。这个开源(GPL v3)项目自 1998 年首次发布以来一直成长和改进,2019 年 12 月发布的最新版本 3.8 增加了许多改进和 bug 修复。 GnuCash 可在 Windows、MacOS 和 Linux 中使用。它实现了一个复式记账系统,并可以导入各种流行的开放和专有文件格式,包括 QIF、QFX、OFX、CSV 等。这使得从其他财务应用转换(包括 Quicken)而来很容易,它是为取代这些而出现的。 -借助 GnuCash,你可以跟踪个人财务状况以及小型企业会计和开票。它没有一个集成的工资系统。根据文档,你可以在 GnuCash 中跟踪工资支出,但你必须在软件外部计算税金和扣减。 +借助 GnuCash,你可以跟踪个人财务状况以及小型企业会计和开票。它没有集成的工资系统。根据文档,你可以在 GnuCash 中跟踪工资支出,但你必须在该软件外计算税金和扣减。 ### 安装 要在 Linux 上安装 GnuCash: - * 在 Red Hat、CentOS 或 Fedora 中: **$ sudo dnf install gnucash** - * 在 Debian、Ubuntu 或 Pop_OS 中: **$ sudo apt install gnucash** - - + * 在 Red Hat、CentOS 或 Fedora 中: `$ sudo dnf install gnucash` + * 在 Debian、Ubuntu 或 Pop_OS 中: `$ sudo apt install gnucash` 你也可以从 [Flathub][3] 安装它,我在运行 Elementary OS 的笔记本上使用它。(本文中的所有截图都来自此次安装)。 @@ -37,7 +37,7 @@ GnuCash 可在 Windows、MacOS 和 Linux 中使用。它实现了一个复式记 #### 个人账户 -如果你选择第一个选项(正如我所做的那样),GnuCash 会打开一个页面给你向导。它收集初始数据并设置账户首选项,例如账户类型和名称、商业数据(例如,税号)和首选货币。 +如果你选择第一个选项(正如我所做的那样),GnuCash 会打开一个页面帮你起步。它收集初始数据并设置账户首选项,例如账户类型和名称、商业数据(例如,税号)和首选货币。 ![GnuCash new account setup][5] @@ -49,7 +49,7 @@ GnuCash 支持个人银行账户、商业账户、汽车贷款、CD 和货币市 #### 开票 -GnuCash 还支持小型企业功能,包括客户、供应商和开票。要创建发票,请在 **Business ->Invoice** 中输入数据。 +GnuCash 还支持小型企业功能,包括客户、供应商和开票。要创建发票,请在 “Business -> Invoice” 中输入数据。 ![GnuCash create invoice][7] @@ -63,7 +63,7 @@ GnuCash 还支持小型企业功能,包括客户、供应商和开票。要创 ![GnuCash help][9] -项目的网站包含许多有用的信息的链接,例如 GnuCash [功能][10]的概述。GnuCash 还提供了[详细的文档][11],可供下载和离线阅读,它还有一个 [wiki][12],为用户和开发人员提供了有用的信息。 +该项目的网站包含许多有用的信息的链接,例如 GnuCash [功能][10]的概述。GnuCash 还提供了[详细的文档][11],可供下载和离线阅读,它还有一个 [wiki][12],为用户和开发人员提供了有用的信息。 你可以在项目的 [GitHub][13] 仓库中找到其他文件和文档。GnuCash 项目由志愿者驱动。如果你想参与,请查看项目的 wiki 上的 [Getting involved][14] 部分。 @@ -73,8 +73,8 @@ via: https://opensource.com/article/20/2/gnucash 作者:[Don Watkins][a] 选题:[lujun9972][b] -译者:[geekpi]](https://github.com/geekpi) -校对:[校对者ID](https://github.com/校对者ID) +译者:[geekpi](https://github.com/geekpi) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 diff --git a/published/202002/20200206 3 ways to use PostgreSQL commands.md b/published/202002/20200206 3 ways to use PostgreSQL commands.md new file mode 100644 index 0000000000..edb92e9144 --- /dev/null +++ b/published/202002/20200206 3 ways to use PostgreSQL commands.md @@ -0,0 +1,218 @@ +[#]: collector: (lujun9972) +[#]: translator: (Morisun029) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11904-1.html) +[#]: subject: (3 ways to use PostgreSQL commands) +[#]: via: (https://opensource.com/article/20/2/postgresql-commands) +[#]: author: (Greg Pittman https://opensource.com/users/greg-p) + +3 种使用 PostgreSQL 命令的方式 +====== + +> 无论你需要的东西简单(如一个购物清单)亦或复杂(如色卡生成器) ,PostgreSQL 命令都能使它变得容易起来。 + +![](https://img.linux.net.cn/data/attachment/album/202002/18/124003twk7fryz2krw2r39.jpg) + +在 [PostgreSQL 入门][2]一文中, 我解释了如何安装、设置和开始使用这个开源数据库软件。不过,使用 [PostgreSQL][3] 中的命令可以做更多事情。 + +例如,我使用 Postgres 来跟踪我的杂货店购物清单。我的大多数杂货店购物是在家里进行的,而且每周进行一次大批量的采购。我去几个不同的地方购买清单上的东西,因为每家商店都提供特定的选品或质量,亦或更好的价格。最初,我制作了一个 HTML 表单页面来管理我的购物清单,但这样无法保存我的输入内容。因此,在想到要购买的物品时我必须马上列出全部清单,然后到采购时我常常会忘记一些我需要或想要的东西。 + +相反,使用 PostgreSQL,当我想到需要的物品时,我可以随时输入,并在购物前打印出来。你也可以这样做。 + +### 创建一个简单的购物清单 + +首先,输入 `psql` 命令进入数据库,然后用下面的命令创建一个表: + +``` +Create table groc (item varchar(20), comment varchar(10)); +``` + +输入如下命令在清单中加入商品: + +``` +insert into groc values ('milk', 'K'); +insert into groc values ('bananas', 'KW'); +``` + +括号中有两个信息(逗号隔开):前面是你需要买的东西,后面字母代表你要购买的地点以及哪些东西是你每周通常都要买的(`W`)。 + +因为 `psql` 有历史记录,你可以按向上键在括号内编辑信息,而无需输入商品的整行信息。 + +在输入一小部分商品后,输入下面命令来检查前面的输入内容。 + +``` +Select * from groc order by comment; + + item | comment +----------------+--------- + ground coffee | H + butter | K + chips | K + steak | K + milk | K + bananas | KW + raisin bran | KW + raclette | L + goat cheese | L + onion | P + oranges | P + potatoes | P + spinach | PW + broccoli | PW + asparagus | PW + cucumber | PW + sugarsnap peas | PW + salmon | S +(18 rows) +``` + +此命令按 `comment` 列对结果进行排序,以便按购买地点对商品进行分组,从而使你的购物更加方便。 + +使用 `W` 来指明你每周要买的东西,当你要清除表单为下周的列表做准备时,你可以将每周的商品保留在购物清单上。输入: + +``` +delete from groc where comment not like '%W'; +``` + +注意,在 PostgreSQL 中 `%` 表示通配符(而非星号)。所以,要保存输入内容,需要输入: + +``` +delete from groc where item like 'goat%'; +``` + +不能使用 `item = 'goat%'`,这样没用。 + +在购物时,用以下命令输出清单并打印或发送到你的手机: + +``` +\o groclist.txt +select * from groc order by comment; +\o +``` + +最后一个命令 `\o` 后面没有任何内容,将重置输出到命令行。否则,所有的输出会继续输出到你创建的杂货店购物文件 `groclist.txt` 中。 + +### 分析复杂的表 + +这个逐项列表对于数据量小的表来说没有问题,但是对于数据量大的表呢?几年前,我帮 [FreieFarbe.de][4] 的团队从 HLC 调色板中创建一个自由色的色样册。事实上,任何能想象到的打印色都可按色调、亮度、浓度(饱和度)来规定。最终结果是 [HLC Color Atlas][5],下面是我们如何实现的。 + +该团队向我发送了具有颜色规范的文件,因此我可以编写可与 Scribus 配合使用的 Python 脚本,以轻松生成色样册。一个例子像这样开始: + +``` +HLC, C, M, Y, K +H010_L15_C010, 0.5, 49.1, 0.1, 84.5 +H010_L15_C020, 0.0, 79.7, 15.1, 78.9 +H010_L25_C010, 6.1, 38.3, 0.0, 72.5 +H010_L25_C020, 0.0, 61.8, 10.6, 67.9 +H010_L25_C030, 0.0, 79.5, 18.5, 62.7 +H010_L25_C040, 0.4, 94.2, 17.3, 56.5 +H010_L25_C050, 0.0, 100.0, 15.1, 50.6 +H010_L35_C010, 6.1, 32.1, 0.0, 61.8 +H010_L35_C020, 0.0, 51.7, 8.4, 57.5 +H010_L35_C030, 0.0, 68.5, 17.1, 52.5 +H010_L35_C040, 0.0, 81.2, 22.0, 46.2 +H010_L35_C050, 0.0, 91.9, 20.4, 39.3 +H010_L35_C060, 0.1, 100.0, 17.3, 31.5 +H010_L45_C010, 4.3, 27.4, 0.1, 51.3 +``` + +这与原始数据相比,稍有修改,原始数据用制表符分隔。我将其转换成 CSV 格式(用逗号分割值),我更喜欢其与 Python 一起使用(CSV 文也很有用,因为它可轻松导入到电子表格程序中)。 + +在每一行中,第一项是颜色名称,其后是其 C、M、Y 和 K 颜色值。 该文件包含 1,793 种颜色,我想要一种分析信息的方法,以了解这些值的范围。这就是 PostgreSQL 发挥作用的地方。我不想手动输入所有数据 —— 我认为输入过程中我不可能不出错,而且令人头痛。幸运的是,PostgreSQL 为此提供了一个命令。 + +首先用以下命令创建数据库: + +``` +Create table hlc_cmyk (color varchar(40), c decimal, m decimal, y decimal, k decimal); +``` + +然后通过以下命令引入数据: + +``` +\copy hlc_cmyk from '/home/gregp/HLC_Atlas_CMYK_SampleData.csv' with (header, format CSV); +``` + +开头有反斜杠,是因为使用纯 `copy` 命令的权限仅限于 root 用户和 Postgres 的超级用户。在括号中,`header` 表示第一行包含标题,应忽略,`CSV` 表示文件格式为 CSV。请注意,在此方法中,颜色名称不需要用括号括起来。 + +如果操作成功,会看到 `COPY NNNN`,其中 N 表示插入到表中的行数。 + +最后,可以用下列命令查询: + +``` +select * from hlc_cmyk; + + color | c | m | y | k +---------------+-------+-------+-------+------ + H010_L15_C010 | 0.5 | 49.1 | 0.1 | 84.5 + H010_L15_C020 | 0.0 | 79.7 | 15.1 | 78.9 + H010_L25_C010 | 6.1 | 38.3 | 0.0 | 72.5 + H010_L25_C020 | 0.0 | 61.8 | 10.6 | 67.9 + H010_L25_C030 | 0.0 | 79.5 | 18.5 | 62.7 + H010_L25_C040 | 0.4 | 94.2 | 17.3 | 56.5 + H010_L25_C050 | 0.0 | 100.0 | 15.1 | 50.6 + H010_L35_C010 | 6.1 | 32.1 | 0.0 | 61.8 + H010_L35_C020 | 0.0 | 51.7 | 8.4 | 57.5 + H010_L35_C030 | 0.0 | 68.5 | 17.1 | 52.5 +``` + + +所有的 1,793 行数据都是这样的。回想起来,我不能说此查询对于 HLC 和 Scribus 任务是绝对必要的,但是它减轻了我对该项目的一些担忧。 + +为了生成 HLC 色谱,我使用 Scribus 为色板页面中的 13,000 多种颜色自动创建了颜色图表。 + +我可以使用 `copy` 命令输出数据: + +``` +\copy hlc_cmyk to '/home/gregp/hlc_cmyk_backup.csv' with (header, format CSV); +``` + +我还可以使用 `where` 子句根据某些值来限制输出。 + +例如,以下命令将仅发送以 `H10` 开头的色调值。 + +``` +\copy hlc_cmyk to '/home/gregp/hlc_cmyk_backup.csv' with (header, format CSV) where color like 'H10%'; +``` + +### 备份或传输数据库或表 + +我在此要提到的最后一个命令是 `pg_dump`,它用于备份 PostgreSQL 数据库,并在 `psql` 控制台之外运行。 例如: + +``` +pg_dump gregp -t hlc_cmyk > hlc.out +pg_dump gregp > dball.out +``` + +第一行是导出 `hlc_cmyk` 表及其结构。第二行将转储 `gregp` 数据库中的所有表。这对于备份或传输数据库或表非常有用。 + +要将数据库或表传输到另一台电脑(查看 [PostgreSQL 入门][2]那篇文章获取详细信息),首先在要转入的电脑上创建一个数据库,然后执行相反的操作。 + +``` +psql -d gregp -f dball.out +``` + +一步创建所有表并输入数据。 + +### 总结 + +在本文中,我们了解了如何使用 `WHERE` 参数限制操作,以及如何使用 PostgreSQL 通配符 `%`。我们还了解了如何将大批量数据加载到表中,然后将部分或全部表数据输出到文件,甚至是将整个数据库及其所有单个表输出。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/2/postgresql-commands + +作者:[Greg Pittman][a] +选题:[lujun9972][b] +译者:[Morisun029](https://github.com/Morisun029) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/greg-p +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/todo_checklist_team_metrics_report.png?itok=oB5uQbzf (Team checklist and to dos) +[2]: https://linux.cn/article-11593-1.html +[3]: https://www.postgresql.org/ +[4]: http://freiefarbe.de +[5]: https://www.freiefarbe.de/en/thema-farbe/hlc-colour-atlas/ diff --git a/translated/tech/20200207 Best Open Source eCommerce Platforms to Build Online Shopping Websites.md b/published/202002/20200207 Best Open Source eCommerce Platforms to Build Online Shopping Websites.md similarity index 66% rename from translated/tech/20200207 Best Open Source eCommerce Platforms to Build Online Shopping Websites.md rename to published/202002/20200207 Best Open Source eCommerce Platforms to Build Online Shopping Websites.md index 7e57583f95..ae38ffcddd 100644 --- a/translated/tech/20200207 Best Open Source eCommerce Platforms to Build Online Shopping Websites.md +++ b/published/202002/20200207 Best Open Source eCommerce Platforms to Build Online Shopping Websites.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (HankChow) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11884-1.html) [#]: subject: (Best Open Source eCommerce Platforms to Build Online Shopping Websites) [#]: via: (https://itsfoss.com/open-source-ecommerce/) [#]: author: (Ankush Das https://itsfoss.com/author/ankush/) @@ -16,7 +16,7 @@ 这些电商解决方案是专为搭建线上购物站点设计的,因此都集成了库存管理、商品列表、购物车、下单、愿望清单以及支付这些必需的基础功能。 -_但请注意,这篇文章并不会进行深入介绍。因此,我建议最好广泛试用其中的多个产品,以便进一步的了解和比较。_ +但请注意,这篇文章并不会进行深入介绍。因此,我建议最好广泛试用其中的多个产品,以便进一步的了解和比较。 ### 优秀的开源电商解决方案 @@ -24,63 +24,63 @@ _但请注意,这篇文章并不会进行深入介绍。因此,我建议最 开源电商解决方案种类繁多,一些缺乏维护的都会被我们忽略掉,以免搭建出来的站点因维护不及时而受到影响。 -_**另外,以下的列表排名不分先后。**_ +另外,以下的列表排名不分先后。 -#### 1\. nopCommerce +#### 1、nopCommerce ![][3] -nopCommerce 是基于 [ASP.NET Core][4] 的自由开源电商解决方案。如果你要找的是基于 PHP 的解决方案,可以跳过这一节了。 +nopCommerce 是基于 [ASP.NET Core][4] 的自由开源的电商解决方案。如果你要找的是基于 PHP 的解决方案,可以跳过这一节了。 -nopCommerce 的管理面板界面具有简洁易用的特点,如果你还使用过 OpenCart,就可能会感到似曾相识。在默认情况下,它就已经自带了很多基本的功能,同时还为移动端用户提供了响应式的设计。 +nopCommerce 的管理面板界面具有简洁易用的特点,如果你还使用过 OpenCart,就可能会感到似曾相识(我不是在抱怨)。在默认情况下,它就已经自带了很多基本的功能,同时还为移动端用户提供了响应式的设计。 你可以在其[官方商店][5]中获取到一些兼容的界面主题和应用扩展,还可以选择付费的支持服务。 在开始使用前,你可以从 nopCommerce 的[官方网站][6]下载源代码包,然后进行自定义配置和部署;也可以直接下载完整的软件包快速安装到 web 服务器上。详细信息可以查阅 nopCommerce 的 [GitHub 页面][7]或官方网站。 -[nopCommerce][8] +- [nopCommerce][8] -#### 2\. OpenCart +#### 2、OpenCart ![][9] -OpenCart 是一个基于 PHP 的非常流行的电商解决方案, 我个人感觉它还是相当不错的。 +OpenCart 是一个基于 PHP 的非常流行的电商解决方案,就我个人而言,我曾为一个项目用过它,并且体验非常好,如果不是最好的话。 或许你会觉得它维护得不是很频繁,但实际上使用 OpenCart 的开发者并不在少数。你可以获得许多受支持的扩展并将它们的功能加入到 OpenCart 中。 -OpenCart 不一定是适合所有人的电商解决方案,但如果你需要的只是一个基于 PHP 的开源解决方案,OpenCart 是个值得一试的选择,毕竟它可以方便地一键完成安装。想要了解更多,可以查阅 OpenCart 的官方网站或 [GitHub 页面][10]。 +OpenCart 不一定是适合所有人的“现代”电商解决方案,但如果你需要的只是一个基于 PHP 的开源解决方案,OpenCart 是个值得一试的选择。在大多数具有一键式应用程序安装支持的网络托管平台中,应该可以安装 OpenCart。想要了解更多,可以查阅 OpenCart 的官方网站或 [GitHub 页面][10]。 -[OpenCart][11] +- [OpenCart][11] -#### 3\. PrestaShop +#### 3、PrestaShop ![][12] PrestaShop 也是一个可以尝试的开源电商解决方案。 -PrestaShop 则是一个积极维护下的开源解决方案,它的官方商店中也有额外提供主题和扩展。与 OpenCart 不同,PrestaShop 不是一个能够一键安装的应用。但不需要担心,从官方网站下载下来之后,它的部署过程也并不复杂。如果你需要帮助,也可以参考 PrestaShop 的[安装指南][15]。 +PrestaShop 是一个积极维护下的开源解决方案,它的官方商店中也有额外提供主题和扩展。与 OpenCart 不同,在托管服务平台上,你可能找不到一键安装的 PrestaShop。但不需要担心,从官方网站下载下来之后,它的部署过程也并不复杂。如果你需要帮助,也可以参考 PrestaShop 的[安装指南][15]。 PrestaShop 的特点就是配置丰富和易于使用,我发现很多其它用户也在用它,你也不妨试用一下。 你也可以在 PrestaShop 的 [GitHub 页面][16]查阅到更多相关内容。 -[PrestaShop][17] +- [PrestaShop][17] -#### 4\. WooCommerce +#### 4、WooCommerce ![][18] 如果你想用 [WordPress][19] 来搭建电商站点,不妨使用 WooCommerce。 -严格来说,这种方式其实是搭建一个 WordPress 应用,然后把 WooCommerce 作为一个插件或扩展以实现电商站点所需要的功能。很多 web 开发者都知道如何使用 WordPress,因此 WooCommerce 的学习成本不会很高。 +从技术上来说,这种方式其实是搭建一个 WordPress 应用,然后把 WooCommerce 作为一个插件或扩展以实现电商站点所需要的功能。很多 web 开发者都知道如何使用 WordPress,因此 WooCommerce 的学习成本不会很高。 WordPress 作为目前最好的开源站点项目之一,对大部分人来说都不会有太高的门槛。它具有易用、稳定的特点,同时还支持大量的扩展插件。 WooCommerce 的灵活性也是一大亮点,在它的线上商店提供了许多设计和扩展可供选择。你也可以到它的 [GitHub 页面][20]查看相关介绍。 -[WooCommerce][21] +- [WooCommerce][21] -#### 5\. Zen Cart +#### 5、Zen Cart ![][22] @@ -90,9 +90,9 @@ WooCommerce 的灵活性也是一大亮点,在它的线上商店提供了许 你也可以在 [SourceForge][23] 找到 Zen Cart 这个项目。 -[Zen Cart][24] +- [Zen Cart][24] -#### 6\. Magento +#### 6、Magento ![Image Credits: Magestore][25] @@ -104,9 +104,9 @@ Magento 完全是作为电商应用程序而生的,因此你会发现它的很 想要了解更多,可以查看 Magento 的 [GitHub 页面][27]。 -[Magento][28] +- [Magento][28] -#### 7\. Drupal +#### 7、Drupal ![Drupal][29] @@ -116,11 +116,25 @@ Drupal 是一个适用于创建电商站点的开源 CMS 解决方案。 跟 WordPress 类似,Drupal 在服务器上的部署并不复杂,不妨看看它的使用效果。在它的[下载页面][30]可以查看这个项目以及下载最新的版本。 -[Drupal][31] +- [Drupal][31] -总结 +#### 8、Odoo eCommerce -以上是我接触过最好的几个开源电商解决方案了,当然或许还会有很多更好的同类产品。如果你还有其它值得一提的产品,可以在评论区发表。也欢迎在评论区分享你对开源电商解决方案的经验和想法。 +![Odoo Ecommerce Platform][32] + +如果你还不知道,Odoo 提供了一套开源商务应用程序。他们还提供了[开源会计软件][33]和 CRM 解决方案,我们将会在单独的列表中进行介绍。 + +对于电子商务门户,你可以根据需要使用其在线拖放生成器自定义网站。你也可以推广该网站。除了简单的主题安装和自定义选项之外,你还可以利用 HTML/CSS 在一定程度上手动自定义外观。 + +你也可以查看其 [GitHub][34] 页面以进一步了解它。 + +- [Odoo eCommerce][35] + +### 总结 + +我敢肯定还有更多的开源电子商务平台,但是,我现在还没有遇到比我上面列出的更好的东西。 + +如果你还有其它值得一提的产品,可以在评论区发表。也欢迎在评论区分享你对开源电商解决方案的经验和想法。 -------------------------------------------------------------------------------- @@ -129,7 +143,7 @@ via: https://itsfoss.com/open-source-ecommerce/ 作者:[Ankush Das][a] 选题:[lujun9972][b] 译者:[HankChow](https://github.com/HankChow) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 @@ -166,3 +180,7 @@ via: https://itsfoss.com/open-source-ecommerce/ [29]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/01/drupal.png?ssl=1 [30]: https://www.drupal.org/project/drupal [31]: https://www.drupal.org/industries/ecommerce +[32]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/02/odoo-ecommerce-platform.jpg?w=800&ssl=1 +[33]: https://itsfoss.com/open-source-accounting-software/ +[34]: https://github.com/odoo/odoo +[35]: https://www.odoo.com/page/open-source-ecommerce diff --git a/published/202002/20200207 Connect Fedora to your Android phone with GSConnect.md b/published/202002/20200207 Connect Fedora to your Android phone with GSConnect.md new file mode 100644 index 0000000000..80a2884a6f --- /dev/null +++ b/published/202002/20200207 Connect Fedora to your Android phone with GSConnect.md @@ -0,0 +1,112 @@ +[#]: collector: (lujun9972) +[#]: translator: (chai-yuan) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11897-1.html) +[#]: subject: (Connect Fedora to your Android phone with GSConnect) +[#]: via: (https://fedoramagazine.org/connect-fedora-to-your-android-phone-with-gsconnect/) +[#]: author: (Lokesh Krishna https://fedoramagazine.org/author/lowkeyskywalker/) + +使用 GSConnect 将 Android 手机连接到 Fedora 系统 +====== + +![][1] + +苹果和微软公司都不同程度的提供了桌面产品与移动设备集成。Fedora 提供了类似甚至更高集成度的工具——GSConnect。它可以让你将安卓手机和你的 Fedora 桌面配对并使用。请继续阅读,以了解更多关于它的情况以及它是如何工作的信息。 + +### GSConnect 是什么? + +GSConnect 是针对 GNOME 桌面定制的 KDE Connect 程序。KDE Connect 可以使你的设备能够互相通信。但是,在 Fedora 默认的 GNOME 桌面上安装它需要安装大量的 KDE 依赖。 + +GSConnect 是一个 KDE Connect 的完整实现,其以 GNOME shell 的拓展形式出现。安装后,GSConnect 允许你执行以下操作及更多: + +* 在计算机上接收电话通知并回复信息 +* 用手机操纵你的桌面 +* 在不同设备之间分享文件与链接 +* 在计算机上查看手机电量 +* 让手机响铃以便你能找到它 + +### 设置 GSConnect 扩展 + +设置 GSConnect 需要安装两个组件:计算机上的 GSConnect 扩展和 Android 设备上的 KDE Connect 应用。 + +首先,从 GNOME Shell 扩展网站上安装 [GSConnect][2] 扩展。(Fedora Magazine 有一篇关于[如何安装 GNOME Shell 扩展][3]的文章,可以帮助你完成这一步。) + +KDE Connect 应用程序可以在 Google 的 [Play 商店][4]上找到。它也可以在 FOSS Android 应用程序库 [F-Droid][5] 上找到。 + +一旦安装了这两个组件,就可以配对两个设备。安装扩展后它在你的系统菜单中显示为“移动设备Mobile Devices”。单击它会出现一个下拉菜单,你可以从中访问“移动设置Mobile Settings”。 + +![][6] + +你可以在这里用 GSConnect 查看并管理已配对的设备。进入此界面后,需要在 Android 设备上启动应用程序。 + +你可以在任意一台设备上进行配对初始化,在这里我们从 Android 设备连接到计算机。点击应用程序上的“刷新”,只要两个设备都在同一个无线网络环境中,你的 Android 设备便可以搜索到你的计算机。现在可以向桌面发送配对请求,并在桌面上接受配对请求以完成配对。 + +![][7] + +### 使用 GSConnect + +配对后,你将需要在 Android 设备授予权限,才能使用 GSConnect 上提供的许多功能。单击设备列表中的已配对设备,便可以查看所有可用功能,并根据你的偏好和需要启用或禁用它们。 + +![][8] + +请记住,你还需要在这个 Android 应用程序中授予相应的权限才能使用这些功能。启用权限后,你现在可以访问桌面上的移动联系人,获得消息通知并回复消息,甚至同步桌面和 Android 设备的剪贴板。 + +### 将你的浏览器与“文件”应用集成 + +GSConnect 允许你直接从计算机上的文件资源管理器的关联菜单向 Android 设备发送文件。 + +在 Fedora 的默认 GNOME 桌面上,你需要安装 `nautilus-python` 依赖包,以便在关联菜单中显示配对的设备。安装此命令非常简单,只需要在你的首选终端运行以下命令: + +``` +$ sudo dnf install nautilus-python +``` + +完成后,将在“文件Files”应用的关联菜单中显示“发送到移动设备Send to Mobile Device”选项。 + +![][9] + +同样,为你的浏览器安装相应的 WebExtension,无论是 [Firefox][10] 还是 [Chrome][11] 浏览器,都可以将链接发送到你的 Android 设备。你可以选择直接发送链接以在浏览器中直接打开,或将其作为短信息发送。 + +### 运行命令 + +GSConnect 允许你定义命令,然后可以从远程设备在计算机上运行这些命令。这使得你可以远程截屏,或者从你的 Android 设备锁定和解锁你的桌面。 + +![][12] + +要使用此功能,可以使用标准的 shell 命令和 GSConnect 提供的 CLI。该项目的 GitHub 存储库(CLI Scripting)中提供了有关此操作的文档。 + +[KDE UserBase Wiki][13] 有一个命令示例列表。这些例子包括控制桌面的亮度和音量、锁定鼠标和键盘,甚至更改桌面主题。其中一些命令是针对 KDE Plasma 设计的,需要进行修改才能在 GNOME 桌面上运行。 + +### 探索并享受乐趣 + +GSConnect 使我们能够享受到极大的便利和舒适。深入研究首选项,查看你可以做的所有事情,灵活的使用这些命令功能发挥创意,并在下面的评论中自由分享你解锁的新方式。 + +-------------------------------------------------------------------------------- + +via: https://fedoramagazine.org/connect-fedora-to-your-android-phone-with-gsconnect/ + +作者:[Lokesh Krishna][a] +选题:[lujun9972][b] +译者:[chai-yuan](https://github.com/chai-yuan) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://fedoramagazine.org/author/lowkeyskywalker/ +[b]: https://github.com/lujun9972 +[1]: https://fedoramagazine.org/wp-content/uploads/2019/12/gsconnect-816x345.jpg +[2]: https://extensions.gnome.org/extension/1319/gsconnect/ +[3]: https://fedoramagazine.org/install-gnome-shell-extension/ +[4]: https://play.google.com/store/apps/details?id=org.kde.kdeconnect_tp +[5]: https://f-droid.org/en/packages/org.kde.kdeconnect_tp/ +[6]: https://fedoramagazine.org/wp-content/uploads/2020/01/within-the-menu-1024x576.png +[7]: https://fedoramagazine.org/wp-content/uploads/2020/01/pair-request-1024x576.png +[8]: https://fedoramagazine.org/wp-content/uploads/2020/01/permissions-1024x576.png +[9]: https://fedoramagazine.org/wp-content/uploads/2020/01/send-to-mobile-2-1024x576.png +[10]: https://addons.mozilla.org/en-US/firefox/addon/gsconnect/ +[11]: https://chrome.google.com/webstore/detail/gsconnect/jfnifeihccihocjbfcfhicmmgpjicaec +[12]: https://fedoramagazine.org/wp-content/uploads/2020/01/commands-1024x576.png +[13]: https://userbase.kde.org/KDE_Connect/Tutorials/Useful_commands +[14]: https://unsplash.com/@pathum_danthanarayana?utm_source=unsplash&utm_medium=referral&utm_content=creditCopyText +[15]: https://unsplash.com/s/photos/android?utm_source=unsplash&utm_medium=referral&utm_content=creditCopyText diff --git a/published/202002/20200207 Customize your internet with an open source search engine.md b/published/202002/20200207 Customize your internet with an open source search engine.md new file mode 100644 index 0000000000..ed102d2f0e --- /dev/null +++ b/published/202002/20200207 Customize your internet with an open source search engine.md @@ -0,0 +1,118 @@ +[#]: collector: (lujun9972) +[#]: translator: (wxy) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11905-1.html) +[#]: subject: (Customize your internet with an open source search engine) +[#]: via: (https://opensource.com/article/20/2/open-source-search-engine) +[#]: author: (Seth Kenlon https://opensource.com/users/seth) + +用开源搜索引擎定制你的互联网 +====== + +> 上手开源的对等 Web 索引器 YaCy。 + +![](https://img.linux.net.cn/data/attachment/album/202002/19/103541la7erglz7oloa4ye.jpg) + +很久以前,互联网很小,小到几个人就可以索引它们,这些人收集了所有网站的名称和链接,并按主题将它们分别列在页面或印刷书籍中。随着万维网网络的发展,形成了“网站环”形式,具有类似的内容、主题或敏感性的站点捆绑在一起,形成了通往每个成员的循环路径。环中任何站点的访问者都可以单击按钮以转到环中的下一个或上一个站点,以发现与其兴趣相关的新站点。 + +又过了一段时间,互联网似乎变得臃肿不堪了。每个人都在网络上,有很多冗余信息和垃圾邮件,多到让你无法找到任何东西。Yahoo 和 AOL、CompuServe 以及类似的服务各自采用了不同的方法来解决这个问题,但是直到谷歌出现后,现代的搜索模型才得以普及。按谷歌的做法,互联网应该通过搜索引擎进行索引、排序和排名。 + +### 为什么选择开源替代品? + +像谷歌和 DuckDuckGo 这样的搜索引擎显然是卓有成效的。你可能是通过搜索引擎访问的本站。尽管对于因主机没有选择遵循优化搜索引擎的最佳实践从而导致会内容陷入困境这件事仍存在争论,但用于管理丰富的文化、知识和轻率的信息(即互联网)的现代解决方案是冷冰冰的索引。 + +但是也许出于隐私方面的考虑,或者你希望为使互联网更加独立而做出贡献,你或许不愿意使用谷歌或 DuckDuckGo。如果你对此感兴趣,那么可以考虑参加 [YaCy][2],这是一个对等互联网索引器和搜索引擎。 + +### 安装 YaCy + +要安装并尝试 YaCy,请首先确保已安装 Java。如果你使用的是 Linux,则可以按照我的《[如何在 Linux 上安装 Java][3]》中的说明进行操作。如果你使用 Windows 或 MacOS,请从 [AdoptOpenJDK.net][4] 获取安装程序。 + +安装 Java 后,请根据你的平台[下载安装程序][5]。 + +如果你使用的是 Linux,请解压缩 tarball 并将其移至 `/opt` 目录: + +``` +$ sudo tar --extract --file  yacy_*z --directory /opt +``` + +根据下载的安装程序的说明启动 YaCy。 + +在 Linux 上,启动在后台运行的 YaCy: + +``` +$ /opt/startYACY.sh & +``` + +在 Web 浏览器中,导航到 `localhost:8090` 并进行搜索。 + +![YaCy start page][6] + +### 将 YaCy 添加到你的地址栏 + +如果你使用的是 Firefox Web 浏览器,则只需单击几下,即可在 Awesome Bar(Mozilla 给 URL 栏起的名称)中将 YaCy 设置为默认搜索引擎。 + +首先,如果尚未显示,在 Firefox 工具栏中使专用搜索栏显示出来(你不必使搜索栏保持一直可见;只需要激活它足够长的时间即可添加自定义搜索引擎)。Firefox 右上角的“汉堡”菜单中的“自定义”菜单中提供了搜索栏。在 Firefox 工具栏上的搜索栏可见后,导航至 `localhost:8090`,然后单击刚添加的 Firefox 搜索栏中的放大镜图标。单击选项将 YaCy 添加到你的 Firefox 的搜索引擎中。 + +![Adding YaCy to Firefox][7] + +完成此操作后,你可以在 Firefox 首选项中将其标记为默认值,或者仅在 Firefox 搜索栏中执行的搜索中选择性地使用它。如果将其设置为默认搜索引擎,则可能不需要专用搜索栏,因为 Awesome Bar 也使用默认引擎,因此可以将其从工具栏中删除。 + +### 对等搜索引擎如何工作 + +YaCy 是一个开源的分布式搜索引擎。它是用 [Java][8] 编写的,因此可以在任何平台上运行,并且可以执行 Web 爬网、索引和搜索。这是一个对等(P2P)网络,因此每个运行 YaCy 的用户都将努力地不断跟踪互联网的变化情况。当然,没有单个用户能拥有整个互联网的完整索引,因为这将需要一个数据中心来容纳,但是该索引分布在所有 YaCy 用户中且是冗余的。它与 BitTorrent 非常相似(因为它使用分布式哈希表 DHT 来引用索引条目),只不过你所共享的数据是单词和 URL 关联的矩阵。通过混合哈希表返回的结果,没人能说出谁搜索了哪些单词,因此所有搜索在功能上都是匿名的。这是用于无偏见、无广告、未跟踪和匿名搜索的有效系统,你只需要使用它就加入了它。 + +### 搜索引擎和算法 + +索引互联网的行为是指将网页分成单个单词,然后将页面的 URL 与每个单词相关联。在搜索引擎中搜索一个或多个单词将获取与该查询关联的所有 URL。YaCy 客户端在运行时也是如此。 + +客户端要做的另一件事是为你的浏览器提供搜索界面。你可以将 Web 浏览器指向 `localhost:8090` 来搜索 YaCy,而不是在要搜索时导航到谷歌。你甚至可以将其添加到浏览器的搜索栏中(取决于浏览器的可扩展性),因此可以从 URL 栏中进行搜索。 + +### YaCy 的防火墙设置 + +首次开始使用 YaCy 时,它可能运行在“初级”模式下。这意味着你的客户端爬网的站点仅对你可用,因为其他 YaCy 客户端无法访问你的索引条目。要加入对等环境,必须在路由器的防火墙(或者你正在运行的软件防火墙)中打开端口 8090,这称为“高级”模式。 + +如果你使用的是 Linux,则可以在《[使用防火墙让你的 Linux 更加强大][9]》中找到有关计算机防火墙的更多信息。在其他平台上,请参考操作系统的文档。 + +互联网服务提供商(ISP)提供的路由器上几乎总是启用了防火墙,并且有太多种类的防火墙无法准确说明。大多数路由器都提供了在防火墙上“打洞”的选项,因为许多流行的联网游戏都需要双向流量。 + +如果你知道如何登录路由器(通常为 192.168.0.1 或 10.1.0.1,但可能因制造商的设置而异),则登录并查找配置面板来控制“防火墙”或“端口转发”或“应用”。 + +找到路由器防火墙的首选项后,将端口 8090 添加到白名单。例如: + +![Adding YaCy to an ISP router][10] + +如果路由器正在进行端口转发,则必须使用相同的端口将传入的流量转发到计算机的 IP 地址。例如: + +![Adding YaCy to an ISP router][11] + +如果由于某种原因无法调整防火墙设置,那也没事。YaCy 将继续以初级模式运行并作为对等搜索网络的客户端运行。 + +### 你的互联网 + +使用 YaCy 搜索引擎可以做的不仅仅是被动搜索。你可以强制抓取不太显眼的网站,可以请求对网站进行网络抓取,可以选择使用 YaCy 进行本地搜索等等。你可以更好地控制*你的*互联网的所呈现的一切。高级用户越多,索引的网站就越多。索引的网站越多,所有用户的体验就越好。加入吧! + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/2/open-source-search-engine + +作者:[Seth Kenlon][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/seth +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/laptop_screen_desk_work_chat_text.png?itok=UXqIDRDD (Person using a laptop) +[2]: https://yacy.net/ +[3]: https://linux.cn/article-11614-1.html +[4]: https://adoptopenjdk.net/releases.html +[5]: https://yacy.net/download_installation/ +[6]: https://opensource.com/sites/default/files/uploads/yacy-startpage.jpg (YaCy start page) +[7]: https://opensource.com/sites/default/files/uploads/yacy-add-firefox.jpg (Adding YaCy to Firefox) +[8]: https://opensource.com/resources/java +[9]: https://opensource.com/article/19/7/make-linux-stronger-firewalls +[10]: https://opensource.com/sites/default/files/uploads/router-add-app.jpg (Adding YaCy to an ISP router) +[11]: https://opensource.com/sites/default/files/uploads/router-add-app1.jpg (Adding YaCy to an ISP router) diff --git a/published/202002/20200207 NVIDIA-s Cloud Gaming Service GeForce NOW Shamelessly Ignores Linux.md b/published/202002/20200207 NVIDIA-s Cloud Gaming Service GeForce NOW Shamelessly Ignores Linux.md new file mode 100644 index 0000000000..4a6e9f660f --- /dev/null +++ b/published/202002/20200207 NVIDIA-s Cloud Gaming Service GeForce NOW Shamelessly Ignores Linux.md @@ -0,0 +1,82 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11888-1.html) +[#]: subject: (NVIDIA’s Cloud Gaming Service GeForce NOW Shamelessly Ignores Linux) +[#]: via: (https://itsfoss.com/geforce-now-linux/) +[#]: author: (Ankush Das https://itsfoss.com/author/ankush/) + +NVIDIA 的云游戏服务 GeForce NOW 无耻地忽略了Linux +====== + +NVIDIA 的 [GeForce NOW][1] 云游戏服务对于那些可能没有硬件但想使用 GeForce NOW 在最新的最好的游戏上获得尽可能好的游戏体验玩家来说是充满前景的(在线推流游戏,并可以在任何设备上玩)。 + +该服务仅限于一些用户(以等待列表的形式)使用。然而,他们最近宣布 [GeForce NOW 面向所有人开放][2]。但实际上并不是。 + +有趣的是,它**并不是面向全球所有区域**。而且,更糟的是 **GeForce NOW 不支持 Linux**。 + +![][3] + +### GeForce NOW 并不是向“所有人开放” + +制作一个基于订阅的云服务来玩游戏的目的是消除平台依赖性。 + +就像你通常使用浏览器访问网站一样,你应该能够在每个平台上玩游戏。是这个概念吧? + +![][4] + +好吧,这绝对不是火箭科学,但是 NVIDIA 仍然不支持 Linux(和 iOS)? + +### 是因为没有人使用 Linux 吗? + +我非常不同意这一点,即使这是某些不支持 Linux 的原因。如果真是这样,我不会使用 Linux 作为主要桌面操作系统来为 “It’s FOSS” 写文章。 + +不仅如此,如果 Linux 不值一提,你认为为何一个 Twitter 用户会提到缺少 Linux 支持? + +![][5] + +是的,也许用户群不够大,但是在考虑将其作为基于云的服务时,**不支持 Linux** 显得没有意义。 + +从技术上讲,如果 Linux 上没有游戏,那么 **Valve** 就不会在 Linux 上改进 [Steam Play][6] 来帮助更多用户在 Linux 上玩纯 Windows 的游戏。 + +我不想说任何不正确的说法,但台式机 Linux 游戏的发展比以往任何时候都要快(即使统计上要比 Mac 和 Windows 要低)。 + +### 云游戏不应该像这样 + +![][7] + +如上所述,找到使用 Steam Play 的 Linux 玩家不难。只是你会发现 Linux 上游戏玩家的整体“市场份额”低于其他平台。 + +即使这是事实,云游戏也不应该依赖于特定平台。而且,考虑到 GeForce NOW 本质上是一种基于浏览器的可以玩游戏的流媒体服务,所以对于像 NVIDIA 这样的大公司来说,支持 Linux 并不困难。 + +来吧,Nvidia,*你想要我们相信在技术上支持 Linux 有困难?或者,你只是想说不值得支持 Linux 平台?* + +### 结语 + +不管我为 GeForce NOW 服务发布而感到多么兴奋,当看到它根本不支持 Linux,我感到非常失望。 + +如果像 GeForce NOW 这样的云游戏服务在不久的将来开始支持 Linux,**你可能没有理由使用 Windows 了**(*咳嗽*)。 + +你怎么看待这件事?在下面的评论中让我知道你的想法。 + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/geforce-now-linux/ + +作者:[Ankush Das][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://itsfoss.com/author/ankush/ +[b]: https://github.com/lujun9972 +[1]: https://www.nvidia.com/en-us/geforce-now/ +[2]: https://blogs.nvidia.com/blog/2020/02/04/geforce-now-pc-gaming/ +[3]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/02/nvidia-geforce-now-linux.jpg?ssl=1 +[4]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/02/nvidia-geforce-now.png?ssl=1 +[5]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/02/geforce-now-twitter-1.jpg?ssl=1 +[6]: https://itsfoss.com/steam-play/ +[7]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/02/ge-force-now.jpg?ssl=1 diff --git a/published/202002/20200207 What is WireGuard- Why Linux Users Going Crazy Over it.md b/published/202002/20200207 What is WireGuard- Why Linux Users Going Crazy Over it.md new file mode 100644 index 0000000000..56b1584ee1 --- /dev/null +++ b/published/202002/20200207 What is WireGuard- Why Linux Users Going Crazy Over it.md @@ -0,0 +1,98 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11916-1.html) +[#]: subject: (What is WireGuard? Why Linux Users Going Crazy Over it?) +[#]: via: (https://itsfoss.com/wireguard/) +[#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/) + +什么是 WireGuard?为什么 Linux 用户为它疯狂? +====== + +从普通的 Linux 用户到 Linux 创建者 [Linus Torvalds][1],每个人都对 WireGuard 很感兴趣。什么是 WireGuard,它为何如此特别? + +### 什么是 WireGuard? + +![][2] + +[WireGuard][3] 是一个易于配置、快速且安全的开源 [VPN][4],它利用了最新的加密技术。目的是提供一种更快、更简单、更精简的通用 VPN,它可以轻松地在树莓派这类低端设备到高端服务器上部署。 + +[IPsec][5] 和 OpenVPN 等大多数其他解决方案是几十年前开发的。安全研究人员和内核开发人员 Jason Donenfeld 意识到它们速度慢且难以正确配置和管理。 + +这让他创建了一个新的开源 VPN 协议和解决方案,它更加快速、安全、易于部署和管理。 + +WireGuard 最初是为 Linux 开发的,但现在可用于 Windows、macOS、BSD、iOS 和 Android。它仍在活跃开发中。 + +### 为什么 WireGuard 如此受欢迎? + +![][6] + +除了可以跨平台之外,WireGuard 的最大优点之一就是易于部署。配置和部署 WireGuard 就像配置和使用 SSH 一样容易。 + +看看 [WireGuard 设置指南][7]。安装 WireGuard、生成公钥和私钥(像 SSH 一样),设置防火墙规则并启动服务。现在将它和 [OpenVPN 设置指南][8]进行比较——有太多要做的了。 + +WireGuard 的另一个好处是它有一个仅 4000 行代码的精简代码库。将它与 [OpenVPN][9](另一个流行的开源 VPN)的 100,000 行代码相比。显然,调试 WireGuard 更加容易。 + +不要因其简单而小看它。WireGuard 支持所有最新的加密技术,例如 [Noise 协议框架][10]、[Curve25519][11]、[ChaCha20][12]、[Poly1305][13]、[BLAKE2][14]、[SipHash24][15]、[HKDF][16] 和安全受信任结构。 + +由于 WireGuard 运行在[内核空间][17],因此可以高速提供安全的网络。 + +这些是 WireGuard 越来越受欢迎的一些原因。Linux 创造者 Linus Torvalds 非常喜欢 WireGuard,以至于将其合并到 [Linux Kernel 5.6][18] 中: + +> 我能否再次声明对它的爱,并希望它能很快合并?也许代码不是完美的,但我不在乎,与 OpenVPN 和 IPSec 的恐怖相比,这是一件艺术品。 +> +> Linus Torvalds + +### 如果 WireGuard 已经可用,那么将其包含在 Linux 内核中有什么大惊小怪的? + +这可能会让新的 Linux 用户感到困惑。你知道可以在 Linux 上安装和配置 WireGuard VPN 服务器,但同时也会看到 Linux Kernel 5.6 将包含 WireGuard 的消息。让我向您解释。 + +目前,你可以将 WireGuard 作为[内核模块][19]安装在 Linux 中。而诸如 VLC、GIMP 等常规应用安装在 Linux 内核之上(在 [用户空间][20]中),而不是内部。 + +当将 WireGuard 安装为内核模块时,基本上需要你自行修改 Linux 内核并向其添加代码。从 5.6 内核开始,你无需手动添加内核模块。默认情况下它将包含在内核中。 + +在 5.6 内核中包含 WireGuard 很有可能[扩展 WireGuard 的采用,从而改变当前的 VPN 场景][21]。 + +### 总结 + +WireGuard 之所以受欢迎是有充分理由的。诸如 [Mullvad VPN][23] 之类的一些流行的[关注隐私的 VPN][22] 已经在使用 WireGuard,并且在不久的将来,采用率可能还会增长。 + +希望你对 WireGuard 有所了解。与往常一样,欢迎提供反馈。 + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/wireguard/ + +作者:[Abhishek Prakash][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://itsfoss.com/author/abhishek/ +[b]: https://github.com/lujun9972 +[1]: https://itsfoss.com/linus-torvalds-facts/ +[2]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/02/wireguard.png?ssl=1 +[3]: https://www.wireguard.com/ +[4]: https://en.wikipedia.org/wiki/Virtual_private_network +[5]: https://en.wikipedia.org/wiki/IPsec +[6]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/02/wireguard-logo.png?ssl=1 +[7]: https://www.linode.com/docs/networking/vpn/set-up-wireguard-vpn-on-ubuntu/ +[8]: https://www.digitalocean.com/community/tutorials/how-to-set-up-an-openvpn-server-on-ubuntu-16-04 +[9]: https://openvpn.net/ +[10]: https://noiseprotocol.org/ +[11]: https://cr.yp.to/ecdh.html +[12]: https://cr.yp.to/chacha.html +[13]: https://cr.yp.to/mac.html +[14]: https://blake2.net/ +[15]: https://131002.net/siphash/ +[16]: https://eprint.iacr.org/2010/264 +[17]: http://www.linfo.org/kernel_space.html +[18]: https://itsfoss.com/linux-kernel-5-6/ +[19]: https://wiki.archlinux.org/index.php/Kernel_module +[20]: http://www.linfo.org/user_space.html +[21]: https://www.zdnet.com/article/vpns-will-change-forever-with-the-arrival-of-wireguard-into-linux/ +[22]: https://itsfoss.com/best-vpn-linux/ +[23]: https://mullvad.net/en/ diff --git a/published/202002/20200210 Install All Essential Media Codecs in Ubuntu With This Single Command -Beginner-s Tip.md b/published/202002/20200210 Install All Essential Media Codecs in Ubuntu With This Single Command -Beginner-s Tip.md new file mode 100644 index 0000000000..5c6d5e90ea --- /dev/null +++ b/published/202002/20200210 Install All Essential Media Codecs in Ubuntu With This Single Command -Beginner-s Tip.md @@ -0,0 +1,114 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11906-1.html) +[#]: subject: (Install All Essential Media Codecs in Ubuntu With This Single Command [Beginner’s Tip]) +[#]: via: (https://itsfoss.com/install-media-codecs-ubuntu/) +[#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/) + +一条命令在 Ubuntu 中安装所有基本的媒体编解码器 +====== + +如果你刚刚安装了 Ubuntu 或其他 [Ubuntu 特色版本][1] 如 Kubuntu、Lubuntu 等,你会注意到系统无法播放某些音频或视频文件。 + +对于视频文件,你可以[在 Ubuntu 上安装 VLC][2]。[VLC][3] 是 [Linux 上的最佳视频播放器][4]之一,它几乎可以播放任何视频文件格式。但你仍然会遇到无法播放音频和 flash 的麻烦。 + +好消息是 [Ubuntu][5] 提供了一个软件包来安装所有基本的媒体编解码器:ubuntu-restricted-extras。 + +![][6] + +### 什么是 Ubuntu Restricted Extras? + +ubuntu-restricted-extras 是一个包含各种基本软件,如 Flash 插件、[unrar][7]、[gstreamer][8]、mp4、[Ubuntu 中的 Chromium 浏览器][9]的编解码器等的软件包。 + +由于这些软件不是开源软件,并且其中一些涉及软件专利,因此 Ubuntu 默认情况下不会安装它们。你必须使用 multiverse 仓库,它是 Ubuntu 专门为用户提供非开源软件而创建的仓库。 + +请阅读本文以[了解有关各种 Ubuntu 仓库的更多信息][10]。 + +### 如何安装 Ubuntu Restricted Extras? + +令我惊讶的是,我发现软件中心未列出 Ubuntu Restricted Extras。不管怎样,你都可以使用命令行安装该软件包,这非常简单。 + +在菜单中搜索或使用[终端键盘快捷键 Ctrl+Alt+T][11] 打开终端。 + +由于 ubuntu-restrcited-extras 软件包在 multiverse 仓库中,因此你应验证系统上已启用 multiverse 仓库: + +``` +sudo add-apt-repository multiverse +``` + +然后你可以使用以下命令安装: + +``` +sudo apt install ubuntu-restricted-extras +``` + +输入回车后,你会被要求输入密码,**当你输入密码时,屏幕不会有显示**。这是正常的。输入你的密码并回车。 + +它将显示大量要安装的包。按回车确认选择。 + +你会看到 [EULA][12](最终用户许可协议),如下所示: + +![Press Tab key to select OK and press Enter key][13] + +浏览此页面可能会很麻烦,但是请放心。只需按 Tab 键,它将高亮选项。当高亮在正确的选项上,按下回车确认你的选择。 + +![Press Tab key to highlight Yes and press Enter key][14] + +安装完成后,由于新安装的媒体编解码器,你应该可以播放 MP3 和其他媒体格式了。 + +##### 在 Kubuntu、Lubuntu、Xubuntu 上安装受限制的额外软件包 + +请记住,Kubuntu、Lubuntu 和 Xubuntu 都有此软件包,并有各自不同的名称。它们本应使用相同的名字,但不幸的是并不是。 + +在 Kubuntu 上,使用以下命令: + +``` +sudo apt install kubuntu-restricted-extras +``` + +在 Lubuntu 上,使用: + +``` +sudo apt install lubuntu-restricted-extras +``` + +在 Xubuntu 上,你应该使用: + +``` +sudo apt install xubuntu-restricted-extras +``` + +我一直建议将 ubuntu-restricted-extras 作为[安装 Ubuntu 后要做的基本事情][15]之一。只需一个命令即可在 Ubuntu 中安装多个编解码器。 + +希望你喜欢 Ubuntu 初学者系列中这一技巧。以后,我将分享更多此类技巧。 + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/install-media-codecs-ubuntu/ + +作者:[Abhishek Prakash][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://itsfoss.com/author/abhishek/ +[b]: https://github.com/lujun9972 +[1]: https://itsfoss.com/which-ubuntu-install/ +[2]: https://itsfoss.com/install-latest-vlc/ +[3]: https://www.videolan.org/index.html +[4]: https://itsfoss.com/video-players-linux/ +[5]: https://ubuntu.com/ +[6]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/02/Media_Codecs_in_Ubuntu.png?ssl=1 +[7]: https://itsfoss.com/use-rar-ubuntu-linux/ +[8]: https://gstreamer.freedesktop.org/ +[9]: https://itsfoss.com/install-chromium-ubuntu/ +[10]: https://itsfoss.com/ubuntu-repositories/ +[11]: https://itsfoss.com/ubuntu-shortcuts/ +[12]: https://en.wikipedia.org/wiki/End-user_license_agreement +[13]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/02/installing_ubuntu_restricted_extras.jpg?ssl=1 +[14]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/02/installing_ubuntu_restricted_extras_1.jpg?ssl=1 +[15]: https://itsfoss.com/things-to-do-after-installing-ubuntu-18-04/ diff --git a/published/202002/20200210 Playing Music on your Fedora Terminal with MPD and ncmpcpp.md b/published/202002/20200210 Playing Music on your Fedora Terminal with MPD and ncmpcpp.md new file mode 100644 index 0000000000..b78452578b --- /dev/null +++ b/published/202002/20200210 Playing Music on your Fedora Terminal with MPD and ncmpcpp.md @@ -0,0 +1,118 @@ +[#]: collector: (lujun9972) +[#]: translator: (chai-yuan) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11909-1.html) +[#]: subject: (Playing Music on your Fedora Terminal with MPD and ncmpcpp) +[#]: via: (https://fedoramagazine.org/playing-music-on-your-fedora-terminal-with-mpd-and-ncmpcpp/) +[#]: author: (Carmine Zaccagnino https://fedoramagazine.org/author/carzacc/) + +在你的 Fedora 终端上播放音乐 +====== + +![][1] + +MPD(Music Playing Daemon),顾名思义,是一个音乐(Music)播放(Playing)守护进程(Daemon)。它可以播放音乐,并且作为一个守护进程,任何软件都可以与之交互并播放声音,包括一些 CLI 客户端。 + +其中一个被称为 `ncmpcpp`,它是对之前 `ncmpc` 工具的改进。名字的变化与编写它们的语言没有太大关系:都是 C++,而之所以被称为 `ncmpcpp`,因为它是 “NCurses Music Playing Client Plus Plus”。 缘故 + +### 安装 MPD 和 ncmpcpp + +`ncmpmpcc` 的客户端可以从官方 Fedora 库中通过 `dnf` 命令直接安装。 + +``` +$ sudo dnf install ncmpcpp +``` + +另一方面,MPD 必须从 RPMFusion free 库安装,你可以通过运行: + +``` +$ sudo dnf install https://download1.rpmfusion.org/free/fedora/rpmfusion-free-release-$(rpm -E %fedora).noarch.rpm +``` + +然后你可以运行下面的命令安装它: + +``` +$ sudo dnf install mpd +``` + +### 配置并启用 MPD + +设置 MPD 最简单的方法是以普通用户的身份运行它。默认情况是以专用 `mpd` 用户的身份运行它,但这会导致各种权限问题。 + +在运行它之前,我们需要创建一个本地配置文件,允许我们作为普通用户运行。 + +首先在 `~/.config` 里创建一个名叫 `mpd` 的目录: + +``` +$ mkdir ~/.config/mpd +``` + +将配置文件拷贝到此目录下: + +``` +$ cp /etc/mpd.conf ~/.config/mpd +``` + +然后用 `vim`、`nano` 或 `gedit` 之类的软件编辑它: + +``` +$ nano ~/.config/mpd/mpd.conf +``` + +我建议你通读所有内容,检查是否有任何需要做的事情,但对于大多数设置你都可以删除,只需保留以下内容: + +``` +db_file "~/.config/mpd/mpd.db" +log_file "syslog" +``` + +现在你可以运行它了: + +``` +$ mpd +``` + +没有报错,这将在后台启动 MPD 守护进程。 + +### 使用 ncmpcpp + +只需运行: + +``` +$ ncmpcpp +``` + +你将在终端中看到一个由 ncurses 所支持的图形用户界面。 + +按下 `4` 键,然后就可以看到本地的音乐目录,用方向键进行选择并按下回车进行播放。 + +多播放几个歌曲就会创建一个*播放列表*,让你可以使用 `>` 键(不是右箭头, 是右尖括号)移动到下一首,并使用 `<` 返回上一首。`+` 和 `–` 键可以调节音量。`Q` 键可以让你退出 `ncmpcpp` 但不停止播放音乐。你可以按下 `P` 来控制暂停和播放。 + +你可以按下 `1` 键来查看当前播放列表(这是默认的视图)。从这个视图中,你可以按 `i` 查看有关当前歌曲的信息(标签)。按 `6` 可更改当前歌曲的标签。 + +按 `\` 按钮将在视图顶部添加(或删除)信息面板。在左上角,你可以看到如下的内容: + +``` +[------] +``` + +按下 `r`、`z`、`y`、`R`、`x` 将会分别切换到 `repeat`、`random`、`single`、`consume` 和 `crossfade` 等播放模式,并将这个小指示器中的 `–` 字符替换为选定模式。 + +按下 `F1` 键将会显示一些帮助文档,包含一系列的键绑定列表,因此无需在此处列出完整列表。所以继续吧!做一个极客,在你的终端上播放音乐! + +-------------------------------------------------------------------------------- + +via: https://fedoramagazine.org/playing-music-on-your-fedora-terminal-with-mpd-and-ncmpcpp/ + +作者:[Carmine Zaccagnino][a] +选题:[lujun9972][b] +译者:[chai-yuan](https://github.com/chai-yuan) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://fedoramagazine.org/author/carzacc/ +[b]: https://github.com/lujun9972 +[1]: https://fedoramagazine.org/wp-content/uploads/2020/02/play_music_mpd-816x346.png +[2]: https://rpmfusion.org/Configuration diff --git a/published/202002/20200210 Scan Kubernetes for errors with KRAWL.md b/published/202002/20200210 Scan Kubernetes for errors with KRAWL.md new file mode 100644 index 0000000000..22fcd2a098 --- /dev/null +++ b/published/202002/20200210 Scan Kubernetes for errors with KRAWL.md @@ -0,0 +1,220 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11936-1.html) +[#]: subject: (Scan Kubernetes for errors with KRAWL) +[#]: via: (https://opensource.com/article/20/2/kubernetes-scanner) +[#]: author: (Abhishek Tamrakar https://opensource.com/users/tamrakar) + +使用 KRAWL 扫描 Kubernetes 错误 +====== + +> 用 KRAWL 脚本来识别 Kubernetes Pod 和容器中的错误。 + +![Ship captain sailing the Kubernetes seas][1] + +当你使用 Kubernetes 运行容器时,你通常会发现它们堆积在一起。这是设计使然。它是容器的优点之一:每当需要新的容器时,它们启动成本都很低。你可以使用前端工具(如 OpenShift 或 OKD)来管理 Pod 和容器。这些工具使可视化设置变得容易,并且它具有一组丰富的用于快速交互的命令。 + +如果管理容器的平台不符合你的要求,你也可以仅使用 Kubernetes 工具链获取这些信息,但这需要大量命令才能全面了解复杂环境。出于这个原因,我编写了 [KRAWL][2],这是一个简单的脚本,可用于扫描 Kubernetes 集群命名空间下的 Pod 和容器,并在发现任何事件时,显示事件的输出。它也可用作为 Kubernetes 插件使用。这是获取大量有用信息的快速简便方法。 + +### 先决条件 + + * 必须安装 `kubectl`。 + * 集群的 kubeconfig 配置必须在它的默认位置(`$HOME/.kube/config`)或已被导出到环境变量(`KUBECONFIG=/path/to/kubeconfig`)。 + +### 使用 + + +``` +$ ./krawl +``` + +![KRAWL script][3] + +### 脚本 + + +``` +#!/bin/bash +# AUTHOR: Abhishek Tamrakar +# EMAIL: abhishek.tamrakar08@gmail.com +# LICENSE: Copyright (C) 2018 Abhishek Tamrakar +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +## +#define the variables +KUBE_LOC=~/.kube/config +#define variables +KUBECTL=$(which kubectl) +GET=$(which egrep) +AWK=$(which awk) +red=$(tput setaf 1) +normal=$(tput sgr0) +# define functions + +# wrapper for printing info messages +info() +{ + printf '\n\e[34m%s\e[m: %s\n' "INFO" "$@" +} + +# cleanup when all done +cleanup() +{ + rm -f results.csv +} + +# just check if the command we are about to call is available +checkcmd() +{ + #check if command exists + local cmd=$1 + if [ -z "${!cmd}" ] + then + printf '\n\e[31m%s\e[m: %s\n' "ERROR" "check if $1 is installed !!!" + exit 1 + fi +} + +get_namespaces() +{ + #get namespaces + namespaces=( \ + $($KUBECTL get namespaces --ignore-not-found=true | \ + $AWK '/Active/ {print $1}' \ + ORS=" ") \ + ) +#exit if namespaces are not found +if [ ${#namespaces[@]} -eq 0 ] +then + printf '\n\e[31m%s\e[m: %s\n' "ERROR" "No namespaces found!!" + exit 1 +fi +} + +#get events for pods in errored state +get_pod_events() +{ + printf '\n' + if [ ${#ERRORED[@]} -ne 0 ] + then + info "${#ERRORED[@]} errored pods found." + for CULPRIT in ${ERRORED[@]} + do + info "POD: $CULPRIT" + info + $KUBECTL get events \ + --field-selector=involvedObject.name=$CULPRIT \ + -ocustom-columns=LASTSEEN:.lastTimestamp,REASON:.reason,MESSAGE:.message \ + --all-namespaces \ + --ignore-not-found=true + done + else + info "0 pods with errored events found." + fi +} + +#define the logic +get_pod_errors() +{ + printf "%s %s %s\n" "NAMESPACE,POD_NAME,CONTAINER_NAME,ERRORS" > results.csv + printf "%s %s %s\n" "---------,--------,--------------,------" >> results.csv + for NAMESPACE in ${namespaces[@]} + do + while IFS=' ' read -r POD CONTAINERS + do + for CONTAINER in ${CONTAINERS//,/ } + do + COUNT=$($KUBECTL logs --since=1h --tail=20 $POD -c $CONTAINER -n $NAMESPACE 2>/dev/null| \ + $GET -c '^error|Error|ERROR|Warn|WARN') + if [ $COUNT -gt 0 ] + then + STATE=("${STATE[@]}" "$NAMESPACE,$POD,$CONTAINER,$COUNT") + else + #catch pods in errored state + ERRORED=($($KUBECTL get pods -n $NAMESPACE --no-headers=true | \ + awk '!/Running/ {print $1}' ORS=" ") \ + ) + fi + done + done< <($KUBECTL get pods -n $NAMESPACE --ignore-not-found=true -o=custom-columns=NAME:.metadata.name,CONTAINERS:.spec.containers[*].name --no-headers=true) + done + printf "%s\n" ${STATE[@]:-None} >> results.csv + STATE=() +} +#define usage for seprate run +usage() +{ +cat << EOF + + USAGE: "${0##*/} (optional)" + + This program is a free software under the terms of Apache 2.0 License. + COPYRIGHT (C) 2018 Abhishek Tamrakar + +EOF +exit 0 +} + +#check if basic commands are found +trap cleanup EXIT +checkcmd KUBECTL +# +#set the ground +if [ $# -lt 1 ]; then + if [ ! -e ${KUBE_LOC} -a ! -s ${KUBE_LOC} ] + then + info "A readable kube config location is required!!" + usage + fi +elif [ $# -eq 1 ] +then + export KUBECONFIG=$1 +elif [ $# -gt 1 ] +then + usage +fi +#play +get_namespaces +get_pod_errors + +printf '\n%40s\n' 'KRAWL' +printf '%s\n' '---------------------------------------------------------------------------------' +printf '%s\n' ' Krawl is a command line utility to scan pods and prints name of errored pods ' +printf '%s\n\n' ' +and containers within. To use it as kubernetes plugin, please check their page ' +printf '%s\n' '=================================================================================' + +cat results.csv | sed 's/,/,|/g'| column -s ',' -t +get_pod_events +``` + +此文最初发布在 [KRAWL 的 GitHub 仓库][2]下的 README 中,并被或许重用。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/2/kubernetes-scanner + +作者:[Abhishek Tamrakar][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/tamrakar +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/ship_captain_devops_kubernetes_steer.png?itok=LAHfIpek (Ship captain sailing the Kubernetes seas) +[2]: https://github.com/abhiTamrakar/kube-plugins/tree/master/krawl +[3]: https://opensource.com/sites/default/files/uploads/krawl_0.png (KRAWL script) +[4]: mailto:abhishek.tamrakar08@gmail.com diff --git a/published/202002/20200210 Top hacks for the YaCy open source search engine.md b/published/202002/20200210 Top hacks for the YaCy open source search engine.md new file mode 100644 index 0000000000..aaa71c4f0e --- /dev/null +++ b/published/202002/20200210 Top hacks for the YaCy open source search engine.md @@ -0,0 +1,101 @@ +[#]: collector: (lujun9972) +[#]: translator: (HankChow) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11919-1.html) +[#]: subject: (Top hacks for the YaCy open source search engine) +[#]: via: (https://opensource.com/article/20/2/yacy-search-engine-hacks) +[#]: author: (Seth Kenlon https://opensource.com/users/seth) + +使用开源搜索引擎 YaCy 的技巧 +====== + +> 无需适应其他人的眼光,而是使用 YaCY 搜索引擎定义你想要的互联网。 + +![](https://img.linux.net.cn/data/attachment/album/202002/23/115822jqkdyjwzdqwdad0y.jpg) + +在我以前介绍 [YaCy 入门][2]的文章中讲述过 [YaCy][3] 这个对等peer-to-peer式的搜索引擎是如何安装和使用的。YaCy 最令人兴奋的一点就是它事实上是一个本地客户端,全球范围内的每一个 YaCy 用户都是构成整个这个分布式搜索引擎架构的一个节点,这意味着每个用户都可以掌控自己的互联网搜索体验。 + +Google 曾经提供过 google.com/linux 这样的主题简便方式以便快速筛选出和 Linux 相关的搜索内容,这个小功能受到了很多人的青睐,但 Google 最终还是在 2011 年的时候把它[下线][4]了。 + +而 YaCy 则让自定义搜索引擎变得可能。 + +### 自定义 YaCy + +YaCy 安装好之后,只需要访问 `localhost:8090` 就可以使用了。要自定义搜索引擎,只需要点击右上角的“管理Administration”按钮(它可能隐藏在小屏幕的菜单图标中)。 + +你可以在管理面板中配置 YaCy 对系统资源的使用策略,以及如何跟其它的 YaCy 客户端进行交互。 + +![YaCy profile selector][5] + +例如,点击侧栏中的“第一步First steps”按钮可以配置备用端口,以及设置 YaCy 对内存和硬盘的使用量;而“监控Monitoring”面板则可以监控 YaCy 的运行状况。大多数功能都只需要在面板上点击几下就可以完成了,例如以下几个常用的功能。 + +### 内网搜索应用 + +目前市面上也有不少公司推出了[内网搜索应用][6],而 YaCy 可以免费为你提供一个。对于能够通过 HTTP、FTP、Samba 等协议访问的文件,YaCy 都可以进行索引,因此无论是作为私人的文件搜索还是企业内部的本地共享文件搜索,YaCy 都可以实现。它可以让内部网络中的用户使用你个人的 YaCy 实例来查找共享文件,于此同时保持对内部网络以外的用户不可见。 + +### 网络配置 + +YaCy 在默认情况下就支持隐私和隔离。点击“用例与账号Use Case & Account”页面顶部的“网络配置Network Configuration”链接,即可进入网络配置面板设置对等网络。 + +![YaCy network configuration][7] + +### 爬取站点 + +YaCy 的分布式运作方式决定了它对页面的爬取是由用户驱动的。并没有一个大型公司对整个互联网上的所有可访问页面都进行搜索,对于 YaCy 来说也是这样,一个站点只有在被用户指定爬取的前提下,才会被 YaCy 爬取并进入索引。 + +YaCy 客户端提供了两种爬取页面的方式:你可以手动爬取,并让 YaCy 根据建议去爬取。 + +![YaCy advanced crawler][8] + +#### 手动爬取 + +手动爬取是指由用户输入指定的网站 URL 并启动 YaCy 的爬虫任务。只需要点击“高级爬虫Advanced Crawler”并输入计划爬取的若干 URL,然后选择页面底部的“进行远程索引Do Remote indexing”选项,这个选项会让客户端向互联网广播它要索引的 URL,可选地接受这些请求的客户端可以帮助你爬取这些 URL。 + +点击页面底部的“开始新爬虫任务Start New Crawl Job”按钮就可以开始进行爬取了,我就是这样对一些常用和有用站点进行爬取和索引的。 + +爬虫任务启动之后,YaCy 会将这些 URL 对应的页面在本地生成和存储索引。在高级模式下,也就是本地计算机允许 8090 端口流量进出时,全网的 YaCy 用户都可以使用到这一份索引。 + +#### 加入爬虫网络 + +尽管一些非常敬业的 YaCy 高级用户已经强迫症般地在互联网上爬取了很多页面,但对于全网浩如烟海的页面而言也只是沧海一粟。单个用户所拥有的资源远不及很多大公司的网络爬虫,但大量 YaCy 用户如果联合起来成为一个社区,能产生的力量就大得多了。只要开启了 YaCy 的爬虫请求广播功能,就可以让其它客户端参与进来爬取更多页面。 + +只需要在“高级爬虫Advanced Crawler”面板中点击页面顶部的“远程爬取Remote Crawling”,勾选“加载Load”旁边的复选框,就可以让你的客户端接受其它人发来的爬虫任务请求了。 + +![YaCy remote crawling][9] + +### YaCy 监控相关 + +YaCy 除了作为一个非常强大的搜索引擎,还提供了很丰富的主题和用户体验。你可以在“监控Monitor”面板中监控 YaCy 客户端的网络运行状况,甚至还可以了解到有多少人从 YaCy 社区中获取到了自己所需要的东西。 + +![YaCy monitoring screen][10] + +### 搜索引擎发挥了作用 + +你使用 YaCy 的时间越长,就越会思考搜索引擎如何改变自己的视野,因为你对互联网的体验很大一部分来自于你在搜索引擎中一次次简单查询的结果。实际上,当你和不同行业的人交流时,可能会注意到每个人对“互联网”的理解都有所不同。有些人会认为,互联网的搜索引擎中充斥着各种广告和推广,同时也仅仅能从搜索结果中获取到有限的信息。例如,假设有人不断搜索关于关键词 X 的内容,那么大部分商业搜索引擎都会在搜索结果中提高关键词 X 的权重,但与此同时,另一个关键词 Y 的权重则会相对降低,从而让关键词 Y 被淹没在搜索结果当中,即使这样对完成特定任务更好。 + +就像在现实生活中一样,走出虚拟的世界视野会让你看到一个更广阔的世界。尝试使用 YaCy,看看你发现了什么。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/2/yacy-search-engine-hacks + +作者:[Seth Kenlon][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/seth +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/browser_desktop_website_checklist_metrics.png?itok=OKKbl1UR (Browser of things) +[2]: https://linux.cn/article-11905-1.html +[3]: https://yacy.net/ +[4]: https://www.linuxquestions.org/questions/linux-news-59/is-there-no-more-linux-google-884306/ +[5]: https://opensource.com/sites/default/files/uploads/yacy-profiles.jpg (YaCy profile selector) +[6]: https://en.wikipedia.org/wiki/Vivisimo +[7]: https://opensource.com/sites/default/files/uploads/yacy-network-config.jpg (YaCy network configuration) +[8]: https://opensource.com/sites/default/files/uploads/yacy-advanced-crawler.jpg (YaCy advanced crawler) +[9]: https://opensource.com/sites/default/files/uploads/yacy-remote-crawl-accept.jpg (YaCy remote crawling) +[10]: https://opensource.com/sites/default/files/uploads/yacy-monitor.jpg (YaCy monitoring screen) diff --git a/published/202002/20200211 Dino is a Modern Looking Open Source XMPP Client.md b/published/202002/20200211 Dino is a Modern Looking Open Source XMPP Client.md new file mode 100644 index 0000000000..82b969948c --- /dev/null +++ b/published/202002/20200211 Dino is a Modern Looking Open Source XMPP Client.md @@ -0,0 +1,103 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11917-1.html) +[#]: subject: (Dino is a Modern Looking Open Source XMPP Client) +[#]: via: (https://itsfoss.com/dino-xmpp-client/) +[#]: author: (Ankush Das https://itsfoss.com/author/ankush/) + +Dino:一个有着现代外观的开源 XMPP 客户端 +====== + +> Dino 是一个相对较新的开源 XMPP 客户端,它试图提供良好的用户体验,鼓励注重隐私的用户使用 XMPP 发送消息。 + +![](https://img.linux.net.cn/data/attachment/album/202002/22/102844mhzgzb3533xgq6d8.jpg) + +### Dino:一个开源 XMPP 客户端 + +![][1] + +[XMPP][2](可扩展通讯和表示协议eXtensible Messaging Presence Protocol) 是一个去中心化的网络模型,可促进即时消息传递和协作。去中心化意味着没有中央服务器可以访问你的数据。通信直接点对点。 + +我们中的一些人可能会称它为“老派”技术,可能是因为 XMPP 客户端通常用户体验非常糟糕,或者仅仅是因为它需要时间来适应(或设置它)。 + +这时候 [Dino][3] 作为现代 XMPP 客户端出现了,在不损害你的隐私的情况下提供干净清爽的用户体验。 + +### 用户体验 + +![][4] + +Dino 试图改善 XMPP 客户端的用户体验,但值得注意的是,它的外观和感受将在一定程度上取决于你的 Linux 发行版。你的图标主题或 Gnome 主题会让你的个人体验更好或更糟。 + +从技术上讲,它的用户界面非常简单,易于使用。所以,我建议你看下 Ubuntu 中的[最佳图标主题][5]和 [GNOME 主题][6]来调整 Dino 的外观。 + +### Dino 的特性 + +![Dino Screenshot][7] + +你可以将 Dino 用作 Slack、[Signal][8] 或 [Wire][9] 的替代产品,来用于你的业务或个人用途。 + +它提供了消息应用所需的所有基本特性,让我们看下你可以从中得到的: + +* 去中心化通信 +* 如果无法设置自己的服务器,它支持公共 XMPP 的服务器 +* 和其他流行消息应用相似的 UI,因此易于使用 +* 图像和文件共享 +* 支持多个帐户 +* 高级消息搜索 +* 支持 [OpenPGP][10] 和 [OMEMO][11] 加密 +* 轻量级原生桌面应用 + +### 在 Linux 上安装 Dino + +你可能会发现它列在你的软件中心中,也可能未找到。Dino 为基于 Debian(deb)和 Fedora(rpm)的发行版提供了可用的二进制文件。 + +Dino 在 Ubuntu 的 universe 仓库中,你可以使用以下命令安装它: + +``` +sudo apt install dino-im +``` + +类似地,你可以在 [GitHub 分发包页面][12]上找到其他 Linux 发行版的包。 + +如果你想要获取最新的,你可以在 [OpenSUSE 的软件页面][13]找到 Dino 的 **.deb** 和 .**rpm** (每日构建版)安装在 Linux 中。 + +在任何一种情况下,前往它的 [Github 页面][14]或点击下面的链接访问官方网站。 + +- [下载 Dino][3] + +### 总结 + +在我编写这篇文章时快速测试过它,它工作良好,没有出过问题。我将尝试探索更多,并希望能涵盖更多有关 XMPP 的文章来鼓励用户使用 XMPP 的客户端和服务器用于通信。 + +你觉得 Dino 怎么样?你会推荐另一个可能好于 Dino 的开源 XMPP 客户端吗?在下面的评论中让我知道你的想法。 + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/dino-xmpp-client/ + +作者:[Ankush Das][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://itsfoss.com/author/ankush/ +[b]: https://github.com/lujun9972 +[1]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/02/dino-main.png?ssl=1 +[2]: https://xmpp.org/about/ +[3]: https://dino.im/ +[4]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/02/dino-xmpp-client.jpg?ssl=1 +[5]: https://itsfoss.com/best-icon-themes-ubuntu-16-04/ +[6]: https://itsfoss.com/best-gtk-themes/ +[7]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/02/dino-screenshot.png?ssl=1 +[8]: https://itsfoss.com/signal-messaging-app/ +[9]: https://itsfoss.com/wire-messaging-linux/ +[10]: https://www.openpgp.org/ +[11]: https://en.wikipedia.org/wiki/OMEMO +[12]: https://github.com/dino/dino/wiki/Distribution-Packages +[13]: https://software.opensuse.org/download.html?project=network:messaging:xmpp:dino&package=dino +[14]: https://github.com/dino/dino + diff --git a/published/202002/20200212 How to Change the Default Terminal in Ubuntu.md b/published/202002/20200212 How to Change the Default Terminal in Ubuntu.md new file mode 100644 index 0000000000..b90a79887f --- /dev/null +++ b/published/202002/20200212 How to Change the Default Terminal in Ubuntu.md @@ -0,0 +1,84 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11903-1.html) +[#]: subject: (How to Change the Default Terminal in Ubuntu) +[#]: via: (https://itsfoss.com/change-default-terminal-ubuntu/) +[#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/) + +如何在 Ubuntu 中更改默认终端 +====== + +终端Terminal是 Linux 系统的关键部分。它能让你通过 shell 访问 Linux 系统。Linux 上有多个终端应用(技术上称为终端仿真器)。 + +大多数[桌面环境][1]都有自己的终端实现。它们的外观可能有所不同,并且可能有不同的快捷键。例如,[Guake 终端][2]对高级用户非常有用,它提供了一些可能无法在发行版默认终端中使用的功能。 + +你可以在系统上安装其他终端,并将其设为默认,并能通过[快捷键 Ctrl+Alt+T][3] 打开。 + +现在问题来了,如何在 Ubuntu 中更改默认终端。它没有遵循[更改 Ubuntu 中的默认应用][4]的标准方式,要怎么做? + +### 更改 Ubuntu 中的默认终端 + +![][5] + +在基于 Debian 的发行版中,有一个方便的命令行程序,称为 [update-alternatives][6],可用于处理默认应用。 + +你可以使用它来更改默认的命令行文本编辑器、终端等。为此,请运行以下命令: + +``` +sudo update-alternatives --config x-terminal-emulator +``` + +它将显示系统上存在的所有可作为默认值的终端仿真器。当前的默认终端标有星号。 + +``` +abhishek@nuc:~$ sudo update-alternatives --config x-terminal-emulator +There are 2 choices for the alternative x-terminal-emulator (providing /usr/bin/x-terminal-emulator). + + Selection Path Priority Status +------------------------------------------------------------ + 0 /usr/bin/gnome-terminal.wrapper 40 auto mode + 1 /usr/bin/gnome-terminal.wrapper 40 manual mode +* 2 /usr/bin/st 15 manual mode + +Press to keep the current choice[*], or type selection number: +``` + +你要做的就是输入选择编号。对我而言,我想使用 GNOME 终端,而不是来自 [Regolith 桌面][7]的终端。 + +``` +Press to keep the current choice[*], or type selection number: 1 +update-alternatives: using /usr/bin/gnome-terminal.wrapper to provide /usr/bin/x-terminal-emulator (x-terminal-emulator) in manual mode +``` + +> **自动模式 vs 手动模式** +> +> 你可能已经在 `update-alternatives` 命令的输出中注意到了自动模式和手动模式。 +> +> 如果选择自动模式,那么在安装或删除软件包时,系统可能会自动决定默认应用。该决定受优先级数字的影响(如上一节中的命令输出所示)。 +> +> 假设你的系统上安装了 5 个终端仿真器,并删除了默认的仿真器。现在,你的系统将检查哪些仿真器处于自动模式。如果有多个,它将​​选择优先级最高的一个作为默认仿真器。 + +我希望你觉得这个小技巧有用。随时欢迎提出问题和建议。 + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/change-default-terminal-ubuntu/ + +作者:[Abhishek Prakash][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://itsfoss.com/author/abhishek/ +[b]: https://github.com/lujun9972 +[1]: https://itsfoss.com/best-linux-desktop-environments/ +[2]: http://guake-project.org/ +[3]: https://itsfoss.com/ubuntu-shortcuts/ +[4]: https://itsfoss.com/change-default-applications-ubuntu/ +[5]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/02/switch_default_terminal_ubuntu.png?ssl=1 +[6]: https://manpages.ubuntu.com/manpages/trusty/man8/update-alternatives.8.html +[7]: https://itsfoss.com/regolith-linux-desktop/ diff --git a/published/202002/20200212 How to use byobu to multiplex SSH sessions.md b/published/202002/20200212 How to use byobu to multiplex SSH sessions.md new file mode 100644 index 0000000000..061ca4c41a --- /dev/null +++ b/published/202002/20200212 How to use byobu to multiplex SSH sessions.md @@ -0,0 +1,82 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11944-1.html) +[#]: subject: (How to use byobu to multiplex SSH sessions) +[#]: via: (https://opensource.com/article/20/2/byobu-ssh) +[#]: author: (Ben Nuttall https://opensource.com/users/bennuttall) + +如何使用 byobu 复用 SSH 会话 +====== + +> Byobu 能让你在保持会话活跃的情况下维护多个终端窗口,通过 SSH 连接、断开、重连以及共享访问。 + +![Person drinking a hat drink at the computer][1] + +[Byobu][2] 是基于文本的窗口管理器和终端多路复用器。它类似于 [GNU Screen][3],但更现代、更直观。它还适用于大多数 Linux、BSD 和 Mac 发行版。 + +Byobu 能让你在保持会话活跃的情况下维护多个终端窗口、通过 SSH(secure shell)连接、断开、重连,甚至让其他人访问。 + +比如,你 SSH 进入树莓派或服务器,并运行(比如) `sudo apt update && sudo apt upgrade`,然后你在它运行的时候失去了互联网连接,你的命令会丢失无效。然而,如果你首先启动 byobu 会话,那么它会继续运行,在你重连后,你会发现它仍在继续运行。 + +![The byobu logo is a fun play on screens.][4] + +Byobu 名称来自于日语的装饰性多面板屏风,它可作为折叠式隔断,我认为这很合适。 + +要在 Debian/Raspbian/Ubuntu 上安装 byobu: + +``` +sudo apt install byobu +``` + +接着启用它: + +``` +byobu-enable +``` + +现在,请退出 SSH 会话并重新登录,你将会在 byobu 会话中登录。运行类似 `sudo apt update` 命令并关闭窗口(或输入转义序列([Enter + ~ + .][5])并重新登录。你将看到更新命令在你离开后还在运行。 + +有*很多*我不常使用的功能。我通常使用的是: + + * `F2` – 新窗口 + * `F3/F4` – 在窗口间导航 + * `Ctrl`+`F2` – 垂直拆分窗格 + * `Shift`+`F2` – 水平拆分窗格 + * `Shift`+`左箭头/Shift`+`右箭头` – 在拆分窗格间导航 + * `Shift`+`F11` – 放大(或缩小)拆分窗格 + +### 我们如何使用 byobu + +Byobu 对于维护 [piwheels][6](一个用于树莓派的方便的,预编译 Python 包)很好用。我水平拆分了窗格,在上半部分显示了 piwheels 监视器,在下半部分实时显示了 syslog 条目。接着,如果我们想要做其他事情,我们可以切换到另外一个窗口。当我们进行协作分析时,这特别方便,因为当我在 IRC 中聊天时,我可以看到我的同事 Dave 输入了什么(并纠正他的错字)。 + +我在家庭和办公服务器上启用了 byobu,因此,当我登录到任何一台计算机时,一切都与我离开时一样。它正在运行多个作业、在特定目录中保留一个窗口,以另一个用户身份运行进程等。 + +![byobu screenshot][7] + +Byobu 对于在树莓派上进行开发也很方便。你可以在桌面上启动它,运行命令,然后 SSH 进入,并连接到该命令运行所在的会话。请注意,启用 byobu 不会更改终端启动器的功能。只需运行 `byobu` 即可启动它。 + +本文最初发表在 Ben Nuttall 的 [Tooling blog][8] 中,并获许重用。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/2/byobu-ssh + +作者:[Ben Nuttall][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/bennuttall +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/coffee_tea_laptop_computer_work_desk.png?itok=D5yMx_Dr (Person drinking a hat drink at the computer) +[2]: https://byobu.org/ +[3]: http://www.gnu.org/software/screen/ +[4]: https://opensource.com/sites/default/files/uploads/byobu.png (byobu screen) +[5]: https://www.google.com/search?client=ubuntu&channel=fs&q=Enter-tilde-dot&ie=utf-8&oe=utf-8 +[6]: https://opensource.com/article/20/1/piwheels +[7]: https://opensource.com/sites/default/files/uploads/byobu-screenshot.png (byobu screenshot) +[8]: https://tooling.bennuttall.com/byobu/ diff --git a/published/202002/20200212 elementary OS is Building an App Center Where You Can Buy Open Source Apps for Your Linux Distribution.md b/published/202002/20200212 elementary OS is Building an App Center Where You Can Buy Open Source Apps for Your Linux Distribution.md new file mode 100644 index 0000000000..6619254799 --- /dev/null +++ b/published/202002/20200212 elementary OS is Building an App Center Where You Can Buy Open Source Apps for Your Linux Distribution.md @@ -0,0 +1,95 @@ +[#]: collector: (lujun9972) +[#]: translator: (wxy) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11939-1.html) +[#]: subject: (elementary OS is Building an App Center Where You Can Buy Open Source Apps for Your Linux Distribution) +[#]: via: (https://itsfoss.com/appcenter-for-everyone/) +[#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/) + +elementary OS 正在构建一个可以买应用的开源应用商店 +====== + +> elementary OS 正在构建一个应用中心生态系统,你可以在其中购买用于 Linux 发行版的开源应用程序。 + +### 众筹构建一个开源应用中心 + +![][1] + +[elementary OS][2] 最近宣布,它正在[众筹举办一个构建应用中心的活动][3],你可以从这个应用中心购买开源应用程序。应用中心中的应用程序将为 Flatpak 格式。 + +尽管这是 elementary OS 发起的活动,但这个新的应用中心也将适用于其他发行版。 + +该活动旨在资助在美国科罗拉多州丹佛市进行的一项一周个人开发冲刺活动,其中包括来自 elementary OS、[Endless][4]、[Flathub][5] 和 [GNOME][6] 的开发人员。 + +众筹活动已经超过了筹集 1 万美元的目标(LCTT 译注:截止至本译文发布,已近 15000 美金)。但你仍然可以为其提供资金,因为其他资金将用于开发 elementary OS。 + +### 这个应用中心将带来什么功能 + +其重点是提供“安全”应用程序,因此使用 [Flatpak][7] 应用来提供受限的应用程序。在这种格式下,默认情况下将会限制应用程序访问系统或个人文件,并在技术层面上将它们与其他应用程序隔离。 + +仅当你明确表示同意时,应用程序才能访问操作系统和个人文件。 + +除了安全性,[Flatpak][8] 还捆绑了所有依赖项。这样,即使当前 Linux 发行版中不提供这些依赖项,应用程序开发人员也可以利用这种最先进的技术使用它。 + +AppCenter 还具有钱包功能,可以保存你的信用卡详细信息。这样,你无需每次输入卡的详细信息即可快速为应用付费。 + +![][9] + +这个新的开源“应用中心”也将适用于其他 Linux 发行版。 + +### 受到了 elementary OS 自己的“按需付费”应用中心模型成功的启发 + +几年前,elementary OS 推出了自己的应用中心。应用中心的“按需付费”方法很受欢迎。开发人员可以为其开源应用设置最低金额,而用户可以选择支付等于或高于最低金额的金额。 + +![][10] + +这帮助了几位独立开发人员可以对其开源应用程序接受付款。该应用中心现在拥有约 160 个原生应用程序,elementary OS 表示已通过应用中心向开发人员支付了数千美元。 + +受到此应用中心实验在 elementary OS 中的成功的启发,他们现在也希望将此应用中心的方法也引入其他发行版。 + +### 如果应用程序是开源的,你怎么为此付费? + +某些人仍然对 FOSS(自由而开源)的概念感到困惑。在这里,该软件的“源代码”是“开源的”,任何人都可以“自由”进行修改和重新分发。 + +但这并不意味着开源软件必须免费。一些开发者依靠捐赠,而另一些则收取支持费用。 + +获得开源应用程序的报酬可能会鼓励开发人员创建 [Linux 应用程序][11]。 + +### 让我们拭目以待 + +![][12] + +就个人而言,我不是 Flatpak 或 Snap 包格式的忠实拥护者。它们确实有其优点,但是它们花费了相对更多的时间来启动,并且它们的包大小很大。如果安装了多个此类 Snap 或 Flatpak 软件包,磁盘空间就会慢慢耗尽。 + +也需要对这个新的应用程序生态系统中的假冒和欺诈开发者保持警惕。想象一下,如果某些骗子开始创建冷门的开源应用程序的 Flatpak 程序包,并将其放在应用中心上?我希望开发人员采用某种机制来淘汰此类应用程序。 + +我确实希望这个新的应用中心能够复制在 elementary OS 中已经看到的成功。对于桌面 Linux 的开源应用程序,我们绝对需要更好的生态系统。 + +你对此有何看法?这是正确的方法吗?你对改进应用中心有什么建议? + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/appcenter-for-everyone/ + +作者:[Abhishek Prakash][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://itsfoss.com/author/abhishek/ +[b]: https://github.com/lujun9972 +[1]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/02/appcenter.png?ssl=1 +[2]: https://elementary.io/ +[3]: https://www.indiegogo.com/projects/appcenter-for-everyone/ +[4]: https://itsfoss.com/endless-linux-computers/ +[5]: https://flathub.org/ +[6]: https://www.gnome.org/ +[7]: https://flatpak.org/ +[8]: https://itsfoss.com/flatpak-guide/ +[9]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/02/appcenter-wallet.png?ssl=1 +[10]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/02/appcenter-payment.png?ssl=1 +[11]: https://itsfoss.com/essential-linux-applications/ +[12]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/02/open_source_app_center.png?ssl=1 diff --git a/published/202002/20200213 Why developers like to code at night.md b/published/202002/20200213 Why developers like to code at night.md new file mode 100644 index 0000000000..144345c44f --- /dev/null +++ b/published/202002/20200213 Why developers like to code at night.md @@ -0,0 +1,97 @@ +[#]: collector: (lujun9972) +[#]: translator: (Morisun029) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11924-1.html) +[#]: subject: (Why developers like to code at night) +[#]: via: (https://opensource.com/article/20/2/why-developers-code-night) +[#]: author: (Matt Shealy https://opensource.com/users/mshealy) + +程序员为什么喜欢在晚上编码 +====== + +> 对许多开源程序员来说,夜间的工作计划是创造力和生产力来源的关键。 + +![](https://img.linux.net.cn/data/attachment/album/202002/24/104251b2hxch46h45c8zwd.jpg) + +如果你问大多数开发人员更喜欢在什么时候工作,大部人会说他们最高效的时间在晚上。这对于那些在工作之余为开源项目做贡献的人来说更是如此(尽管如此,希望在他们的健康范围内[避免透支][2])。 + +有些人喜欢从晚上开始,一直工作到凌晨,而另一些人则很早就起床(例如,凌晨 4 点),以便在开始日常工作之前完成大部分编程工作。 + +这种工作习惯可能会使许多开发人员看起来像个怪人,不合时宜。但是,为什么有这么多的程序员喜欢在非正常时间工作,原因有很多: + +### 制造者日程 + +根据 [保罗·格雷厄姆][3]Paul Graham 的观点,“生产东西”的人倾向于遵守 制造者日程 —— 他们更愿意以半天或更长时间为单位使用时间。事实上,大多数[开发人员也有相同的偏好][4]。(LCTT 译注:保罗·格雷厄姆有[一篇文章][8]述及制造者日程和管理者日程。) + +一方面,开发人员从事大型抽象系统工作,需要思维空间来处理整个模型。将他们的日程分割成 15 分钟或 30 分钟的时间段来处理电子邮件、会议、电话以及来自同事的打断,工作效果只会适得其反。 + +另一方面,通常不可能以小时为单位进行有效编程。因为这么短的时间几乎不够让你把思绪放在手头的任务上并开始工作。 + +上下文切换也会对编程产生不利影响。在晚上工作,开发人员可以避免尽可能多的干扰。在没有不断的干扰的情况下,他们可以花几个小时专注于手头任务,并尽可能提高工作效率。 + +### 平和安静的环境 + +由于晚上或凌晨不太会有来自各种活动的噪音(例如,办公室闲谈、街道上的交通),这使许多程序员感到放松,促使他们更具创造力和生产力,特别是在处理诸如编码之类的精神刺激任务时。 + +独处与平静,加上他们知道自己将有几个小时不被中断的工作时间,通常会使他们摆脱白天工作计划相关的时间压力,从而产出高质量的工作。 + +更不用说了,当解决了一个棘手的问题后,没有什么比尽情享受自己最喜欢的午夜小吃更美好的事情了! + +### 沟通 + +与在公司内工作的程序员相比,从事开源项目的开发人员可以拥有不同的沟通节奏。大多数开源项目的沟通都是通过邮件或 GitHub 上的评论等渠道异步完成的。很多时候,其他程序员在不同的国家和时区,因此实时交流通常需要开发人员变成一个夜猫子。 + +### 昏昏欲睡的大脑 + +这听起来可能违反直觉,但是随着时间的推移,大脑会变得非常疲倦,因此只能专注于一项任务。晚上工作从根本上消除了多任务处理,而这是保持专注和高效的主要障碍。当大脑处于昏昏欲睡的状态时,你是无法保持专注的! + +此外,许多开发人员在入睡时思考要解决的问题通常会取得重大进展。潜意识开始工作,答案通常在他们半睡半醒的凌晨时分就出现了。 + +这不足为奇,因为[睡眠可增强大脑功能][5],可帮助我们理解新信息并进行更有创造性的思考。当解决方案在凌晨出现时,这些开发人员便会起来开始工作,不错过任何机会。 + +### 灵活和创造性思考 + +许多程序员体会到晚上创造力会提升。前额叶皮层,即大脑中与集中能力有关的部分,在一天结束时会感到疲倦。这似乎为某些人提供了更灵活和更具创造性的思考。 + +匹兹堡大学医学院精神病学助理教授 [Brant Hasler][6] 表示:“由于自上而下的控制和‘认知抑制’的减少,大脑可能会解放出来进行更发散的思考,从而使人们更容易地将不同概念之间的联系建立起来。” 结合轻松环境所带来的积极情绪,开发人员可以更轻松地产生创新想法。 + +此外,在没有干扰的情况下集中精力几个小时,“沉浸在你做的事情中”。这可以帮助你更好地专注于项目并参与其中,而不必担心周围发生的事情。 + +### 明亮的电脑屏幕 + +因为整天看着明亮的屏幕, 许多程序员的睡眠周期被延迟。电脑屏幕发出的蓝光[扰乱我们的昼夜节律][7],延迟了释放诱发睡眠的褪黑激素和提高人的机敏性,并将人体生物钟重置到更晚的时间。从而导致,开发人员往往睡得越来越晚。 + +### 来自过去的影响 + +过去,大多数开发人员是出于必要在晚上工作,因为在白天当公司其他人都在使用服务器时,共享服务器的计算能力支撑不了编程工作,所以开发人员需要等到深夜才能执行白天无法进行的任务,例如测试项目、运行大量的“编码-编译-运行-调试”周期以及部署新代码。现在尽管服务器功能变强大了,大多数可以满足需求,但夜间工作的趋势仍是这种文化的一部分。 + +### 结语 + +尽管开发人员喜欢在晚上工作的原因很多,但请记住,做为夜猫子并不意味着你应该克扣睡眠时间。睡眠不足会导致压力和焦虑,并最终导致倦怠。 + +获得足够质量的睡眠是维持良好身体健康和大脑功能的关键。例如,它可以帮助你整合新信息、巩固记忆、创造性思考、清除身体积聚的毒素、调节食欲并防止过早衰老。 + +无论你是哪种日程,请确保让你的大脑得到充分的休息,这样你就可以在一整天及每天的工作中发挥最大的作用! + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/2/why-developers-code-night + +作者:[Matt Shealy][a] +选题:[lujun9972][b] +译者:[Morisun029](https://github.com/Morisun029) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/mshealy +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/computer_code_programming_laptop.jpg?itok=ormv35tV (Person programming on a laptop on a building) +[2]: https://opensource.com/article/19/11/burnout-open-source-communities +[3]: http://www.paulgraham.com/makersschedule.html +[4]: https://www.chamberofcommerce.com/business-advice/software-development-trends-overtaking-the-market +[5]: https://amerisleep.com/blog/sleep-impacts-brain-health/ +[6]: https://www.vice.com/en_us/article/mb58a8/late-night-creativity-spike +[7]: https://www.sleepfoundation.org/articles/how-blue-light-affects-kids-sleep +[8]: http://www.paulgraham.com/makersschedule.html diff --git a/published/202002/20200214 Digging up IP addresses with the Linux dig command.md b/published/202002/20200214 Digging up IP addresses with the Linux dig command.md new file mode 100644 index 0000000000..01f72b47fd --- /dev/null +++ b/published/202002/20200214 Digging up IP addresses with the Linux dig command.md @@ -0,0 +1,196 @@ +[#]: collector: (lujun9972) +[#]: translator: (HankChow) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11931-1.html) +[#]: subject: (Digging up IP addresses with the Linux dig command) +[#]: via: (https://www.networkworld.com/article/3527430/digging-up-ip-addresses-with-the-dig-command.html) +[#]: author: (Sandra Henry-Stocker https://www.networkworld.com/author/Sandra-Henry_Stocker/) + +使用 dig 命令挖掘域名解析信息 +====== + +> 命令行工具 `dig` 是用于解析域名和故障排查的一个利器。 + +![](https://img.linux.net.cn/data/attachment/album/202002/26/094028jgvzguau1pdgicpz.jpg) + +从主要功能上来说,`dig` 和 `nslookup` 之间差异不大,但 `dig` 更像一个加强版的 `nslookup`,可以查询到一些由域名服务器管理的信息,这在排查某些问题的时候非常有用。总的来说,`dig` 是一个既简单易用又功能强大的命令行工具。(LCTT 译注:`dig` 和 `nslookup` 行为的主要区别来自于 `dig` 使用是是操作系统本身的解析库,而 `nslookup` 使用的是该程序自带的解析库,这有时候会带来一些行为差异。此外,从表现形式上看,`dig` 返回是结果是以 BIND 配置信息的格式返回的,也带有更多的技术细节。) + +`dig` 最基本的功能就是查询域名信息,因此它的名称实际上是“域名信息查询工具Domain Information Groper”的缩写。`dig` 向用户返回的内容可以非常详尽,也可以非常简洁,展现内容的多少完全由用户在查询时使用的选项来决定。 + +### 我只需要查询 IP 地址 + +如果只需要查询某个域名指向的 IP 地址,可以使用 `+short` 选项: + +``` +$ dig facebook.com +short +31.13.66.35 +``` + +在查询的时候发现有的域名会指向多个 IP 地址?这其实是网站提高其可用性的一种措施。 + +``` +$ dig networkworld.com +short +151.101.2.165 +151.101.66.165 +151.101.130.165 +151.101.194.165 +``` + +也正是由于这些网站通过负载均衡实现高可用,在下一次查询的时候,或许会发现这几个 IP 地址的排序有所不同。(LCTT 译注:浏览器等应用默认会使用返回的第一个 IP 地址,因此这样实现了一种简单的负载均衡。) + +``` +$ dig networkworld.com +short +151.101.130.165 +151.101.194.165 +151.101.2.165 +151.101.66.165 +``` + +### 标准返回 + +`dig` 的标准返回内容则包括这个工具本身的一些信息,以及请求域名服务器时返回的响应内容: + +``` +$ dig networkworld.com + +; <<>> DiG 9.11.5-P4-5.1ubuntu2.1-Ubuntu <<>*gt; networkworld.com +;; global options: +cmd +;; Got answer: +;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 39932 +;; flags: qr rd ra; QUERY: 1, ANSWER: 4, AUTHORITY: 0, ADDITIONAL: 1 + +;; OPT PSEUDOSECTION: +; EDNS: version: 0, flags:; udp: 65494 +;; QUESTION SECTION: +;networkworld.com. IN A + +;; ANSWER SECTION: +networkworld.com. 300 IN A 151.101.194.165 +networkworld.com. 300 IN A 151.101.130.165 +networkworld.com. 300 IN A 151.101.66.165 +networkworld.com. 300 IN A 151.101.2.165 + +;; Query time: 108 msec +;; SERVER: 127.0.0.53#53(127.0.0.53) +;; WHEN: Thu Feb 13 13:49:53 EST 2020 +;; MSG SIZE rcvd: 109 +``` + +由于域名服务器有缓存机制,返回的内容可能是之前缓存好的信息。在这种情况下,`dig` 最后显示的查询时间Query time会是 0 毫秒(0 msec): + +``` +;; Query time: 0 msec <== +;; SERVER: 127.0.0.53#53(127.0.0.53) +;; WHEN: Thu Feb 13 15:30:09 EST 2020 +;; MSG SIZE rcvd: 109 +``` + +### 向谁查询? + +在默认情况下,`dig` 会根据 `/etc/resolv.conf` 这个文件的内容决定向哪个域名服务器获取查询结果。你也可以使用 `@` 来指定 `dig` 请求的域名服务器。 + +在下面的例子中,就指定了 `dig` 向 Google 的域名服务器 8.8.8.8 查询域名信息。 + +``` +$ dig @8.8.8.8 networkworld.com + +; <<>> DiG 9.11.5-P4-5.1ubuntu2.1-Ubuntu <<>> @8.8.8.8 networkworld.com +; (1 server found) +;; global options: +cmd +;; Got answer: +;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 21163 +;; flags: qr rd ra; QUERY: 1, ANSWER: 4, AUTHORITY: 0, ADDITIONAL: 1 + +;; OPT PSEUDOSECTION: +; EDNS: version: 0, flags:; udp: 512 +;; QUESTION SECTION: +;networkworld.com. IN A + +;; ANSWER SECTION: +networkworld.com. 299 IN A 151.101.130.165 +networkworld.com. 299 IN A 151.101.66.165 +networkworld.com. 299 IN A 151.101.194.165 +networkworld.com. 299 IN A 151.101.2.165 + +;; Query time: 48 msec +;; SERVER: 8.8.8.8#53(8.8.8.8) +;; WHEN: Thu Feb 13 14:26:14 EST 2020 +;; MSG SIZE rcvd: 109 +``` + +想要知道正在使用的 `dig` 工具的版本,可以使用 `-v` 选项。你会看到类似这样: + +``` +$ dig -v +DiG 9.11.5-P4-5.1ubuntu2.1-Ubuntu +``` + +或者这样的返回信息: + +``` +$ dig -v +DiG 9.11.4-P2-RedHat-9.11.4-22.P2.el8 +``` + +如果你觉得 `dig` 返回的内容过于详细,可以使用 `+noall`(不显示所有内容)和 `+answer`(仅显示域名服务器的响应内容)选项,域名服务器的详细信息就会被忽略,只保留域名解析结果。 + +``` +$ dig networkworld.com +noall +answer + +; <<>> DiG 9.11.5-P4-5.1ubuntu2.1-Ubuntu <<>> networkworld.com +noall +answer +;; global options: +cmd +networkworld.com. 300 IN A 151.101.194.165 +networkworld.com. 300 IN A 151.101.130.165 +networkworld.com. 300 IN A 151.101.66.165 +networkworld.com. 300 IN A 151.101.2.165 +``` + +### 批量查询域名 + +如果你要查询多个域名,可以把这些域名写入到一个文件内(`domains`),然后使用下面的 `dig` 命令遍历整个文件并给出所有查询结果。 + +``` +$ dig +noall +answer -f domains +networkworld.com. 300 IN A 151.101.66.165 +networkworld.com. 300 IN A 151.101.2.165 +networkworld.com. 300 IN A 151.101.130.165 +networkworld.com. 300 IN A 151.101.194.165 +world.std.com. 77972 IN A 192.74.137.5 +uushenandoah.org. 1982 IN A 162.241.24.209 +amazon.com. 18 IN A 176.32.103.205 +amazon.com. 18 IN A 176.32.98.166 +amazon.com. 18 IN A 205.251.242.103 +``` + +你也可以在上面的命令中使用 `+short` 选项,但如果其中有些域名指向多个 IP 地址,就无法看出哪些 IP 地址对应哪个域名了。在这种情况下,更好地做法应该是让 `awk` 对返回内容进行处理,只留下第一列和最后一列: + +``` +$ dig +noall +answer -f domains | awk '{print $1,$NF}' +networkworld.com. 151.101.66.165 +networkworld.com. 151.101.130.165 +networkworld.com. 151.101.194.165 +networkworld.com. 151.101.2.165 +world.std.com. 192.74.137.5 +amazon.com. 176.32.98.166 +amazon.com. 205.251.242.103 +amazon.com. 176.32.103.205 +``` + +-------------------------------------------------------------------------------- + +via: https://www.networkworld.com/article/3527430/digging-up-ip-addresses-with-the-dig-command.html + +作者:[Sandra Henry-Stocker][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.networkworld.com/author/Sandra-Henry_Stocker/ +[b]: https://github.com/lujun9972 +[1]: https://www.networkworld.com/newsletters/signup.html +[2]: https://www.networkworld.com/article/3440100/take-the-intelligent-route-with-consumption-based-storage.html?utm_source=IDG&utm_medium=promotions&utm_campaign=HPE21620&utm_content=sidebar ( Take the Intelligent Route with Consumption-Based Storage) +[3]: https://www.facebook.com/NetworkWorld/ +[4]: https://www.linkedin.com/company/network-world diff --git a/published/202002/20200217 How to get MongoDB Server on Fedora.md b/published/202002/20200217 How to get MongoDB Server on Fedora.md new file mode 100644 index 0000000000..8c5522b477 --- /dev/null +++ b/published/202002/20200217 How to get MongoDB Server on Fedora.md @@ -0,0 +1,115 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11942-1.html) +[#]: subject: (How to get MongoDB Server on Fedora) +[#]: via: (https://fedoramagazine.org/how-to-get-mongodb-server-on-fedora/) +[#]: author: (Honza Horak https://fedoramagazine.org/author/hhorak/) + +如何在 Fedora 上安装 MongoDB 服务器 +====== + +![][1] + +Mongo(来自 “humongous” —— 巨大的)是一个高性能、开源、无模式的、面向文档的数据库,它是最受欢迎的 [NoSQL][2] 数据库之一。它使用 JSON 作为文档格式,并且可以在多个服务器节点之间进行扩展和复制。 + +### 有关许可证更改的故事 + +MongoDB 上游决定更改服务器代码的许可证已经一年多了。先前的许可证是 GNU Affero General Public License v3(AGPLv3)。但是,上游公司写了一个新许可证,旨在使运行 MongoDB 即服务的公司可以回馈社区。新许可证称为 Server Side Public License(SSPLv1),关于这个举措及其解释的更多说明,请参见 [MongoDB SSPL FAQ][3]。 + +Fedora 一直只包含自由软件。当 SSPL 发布后,Fedora [确定][4]它并不是自由软件许可证。许可证更改日期(2018 年 10 月)之前发布的所有 MongoDB 版本都可保留在 Fedora 中,但之后再也不更新的软件包会带来安全问题。因此,从 Fedora 30 开始,Fedora 社区决定完全[移除 MongoDB 服务器][5]。 + +### 开发人员还有哪些选择? + +是的,还有替代方案,例如 PostgreSQL 在最新版本中也支持 JSON,它可以在无法再使用 MongoDB 的情况下使用它。使用 JSONB 类型,索引在 PostgreSQL 中可以很好地工作,其性能可与 MongoDB 媲美,甚至不会受到 ACID 的影响。 + +开发人员可能选择 MongoDB 的技术原因并未随许可证而改变,因此许多人仍想使用它。重要的是要意识到,SSPL 许可证仅更改仅针对 MongoDB 服务器。MongoDB 上游还开发了其他项目,例如 MongoDB 工具、C 和 C++ 客户端库以及用于各种动态语言的连接器,这些项目在客户端使用(通过网络与服务器通信的应用中)。由于这些包的许可证人保持自由(主要是 Apache 许可证),因此它们保留在 Fedora 仓库中,因此用户可以将其用于应用开发。 + +唯一的变化实际是服务器软件包本身,它已从 Fedora 仓库中完全删除。让我们看看 Fedora 用户可以如何获取非自由的包。 + +### 如何从上游安装 MongoDB 服务器 + +当 Fedora 用户想要安装 MongoDB 服务器时,他们需要直接向上游获取 MongoDB。但是,上游不为 Fedora 提供 RPM 包。相反,MongoDB 服务器可以获取源码 tarball,用户需要自己进行编译(这需要一些开发知识),或者 Fedora 用户可以使用一些兼容的包。在兼容的选项中,最好的选择是 RHEL-8 RPM。以下步骤描述了如何安装它们以及如何启动守护进程。 + +#### 1、使用上游 RPM 创建仓库(RHEL-8 构建) + +``` +$ sudo cat > /etc/yum.repos.d/mongodb.repo >>EOF +[mongodb-upstream] +name=MongoDB Upstream Repository +baseurl=https://repo.mongodb.org/yum/redhat/8Server/mongodb-org/4.2/x86_64/ +gpgcheck=1 +enabled=1 +gpgkey=https://www.mongodb.org/static/pgp/server-4.2.asc +EOF +``` + +#### 2、安装元软件包,来拉取服务器和工具包 + +``` +$ sudo dnf install mongodb-org +...... +Installed: + mongodb-org-4.2.3-1.el8.x86_64 mongodb-org-mongos-4.2.3-1.el8.x86_64 + mongodb-org-server-4.2.3-1.el8.x86_64 mongodb-org-shell-4.2.3-1.el8.x86_64 + mongodb-org-tools-4.2.3-1.el8.x86_64 + +Complete! +``` + +#### 3、启动 MongoDB 守护进程 + +``` +$ sudo systemctl status mongod +● mongod.service - MongoDB Database Server + Loaded: loaded (/usr/lib/systemd/system/mongod.service; enabled; vendor preset: disabled) + Active: active (running) since Sat 2020-02-08 12:33:45 EST; 2s ago + Docs: https://docs.mongodb.org/manual + Process: 15768 ExecStartPre=/usr/bin/mkdir -p /var/run/mongodb (code=exited, status=0/SUCCESS) + Process: 15769 ExecStartPre=/usr/bin/chown mongod:mongod /var/run/mongodb (code=exited, status=0/SUCCESS) + Process: 15770 ExecStartPre=/usr/bin/chmod 0755 /var/run/mongodb (code=exited, status=0/SUCCESS) + Process: 15771 ExecStart=/usr/bin/mongod $OPTIONS (code=exited, status=0/SUCCESS) + Main PID: 15773 (mongod) + Memory: 70.4M + CPU: 611ms + CGroup: /system.slice/mongod.service + +``` + +#### 4、通过 mongo shell 连接服务器来验证是否运行 + +``` +$ mongo +MongoDB shell version v4.2.3 +connecting to: mongodb://127.0.0.1:27017/?compressors=disabled&gssapiServiceName=mongodb +Implicit session: session { "id" : UUID("20b6e61f-c7cc-4e9b-a25e-5e306d60482f") } +MongoDB server version: 4.2.3 +Welcome to the MongoDB shell. +For interactive help, type "help". +For more comprehensive documentation, see + http://docs.mongodb.org/ +--- +``` + + +就是这样了。如你所见,RHEL-8 包完美兼容,只要 Fedora 包还与 RHEL-8 兼容,它就应该会一直兼容。请注意,在使用时必须遵守 SSPLv1 许可证。 + +-------------------------------------------------------------------------------- + +via: https://fedoramagazine.org/how-to-get-mongodb-server-on-fedora/ + +作者:[Honza Horak][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://fedoramagazine.org/author/hhorak/ +[b]: https://github.com/lujun9972 +[1]: https://fedoramagazine.org/wp-content/uploads/2020/02/mongodb-816x348.png +[2]: https://en.wikipedia.org/wiki/NoSQL +[3]: https://www.mongodb.com/licensing/server-side-public-license/faq +[4]: https://lists.fedoraproject.org/archives/list/legal@lists.fedoraproject.org/thread/IQIOBOGWJ247JGKX2WD6N27TZNZZNM6C/ +[5]: https://fedoraproject.org/wiki/Changes/MongoDB_Removal diff --git a/published/202002/20200217 How to install Vim plugins.md b/published/202002/20200217 How to install Vim plugins.md new file mode 100644 index 0000000000..f3ce601e53 --- /dev/null +++ b/published/202002/20200217 How to install Vim plugins.md @@ -0,0 +1,166 @@ +[#]: collector: (lujun9972) +[#]: translator: (qianmingtian) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11923-1.html) +[#]: subject: (How to install Vim plugins) +[#]: via: (https://opensource.com/article/20/2/how-install-vim-plugins) +[#]: author: (Seth Kenlon https://opensource.com/users/seth) + +如何安装 Vim 插件 +====== + +> 无论你是手动安装还是通过包管理器安装,插件都可以帮助你在工作流中打造一个完美的 Vim 。 + +![](https://img.linux.net.cn/data/attachment/album/202002/23/215719kwhqzwwj1ezoen6o.jpg) + +虽然 [Vim][2] 是快速且高效的,但在默认情况下,它仅仅只是一个文本编辑器。至少,这就是没有插件的情况 Vim 应当具备的样子,插件构建在 Vim 之上,并添加额外的功能,使 Vim 不仅仅是一个输入文本的窗口。有了合适的插件组合,你可以控制你的生活,形成你自己独特的 Vim 体验。你可以[自定义你的主题][3],你可以添加语法高亮,代码 linting,版本跟踪器等等。 + +### 怎么安装 Vim 插件 + +Vim 可以通过插件进行扩展,但很长一段时间以来,并没有官方的安装方式去安装这些插件。从 Vim 8 开始,有一个关于插件如何安装和加载的结构。你可能会在网上或项目自述文件中遇到旧的说明,但只要你运行 Vim 8 或更高版本,你应该根据 Vim 的[官方插件安装方法][4]安装或使用 Vim 包管理器。你可以使用包管理器,无论你运行的是什么版本(包括比 8.x 更老的版本),这使得安装过程比你自己维护更新更容易。 + +手动和自动安装方法都值得了解,所以请继续阅读以了解这两种方法。 + +### 手动安装插件(Vim 8 及以上版本) + +所谓的 “Vim 包”是一个包含一个或多个插件的目录。默认情况下,你的 Vim 设置包含在 `~/.vim` 中,这是 Vim 在启动时寻找插件的地方。(下面的示例使用了通用名称 `vendor` 来表示插件是从其它地方获得的。) + +当你启动 Vim 时,它首先处理你的 `.vimrc`文件,然后扫描 `~/.vim` 中的所有目录,查找包含在 `pack/*/start` 中的插件。 + +默认情况下,你的 `~/.vim` 目录(如果你有的话)中没有这样的文件结构,所以设置为: + +``` +$ mkdir -p ~/.vim/pack/vendor/start +``` + +现在,你可以将 Vim 插件放在 `~/.vim/pack/vendor/start` 中,它们会在你启动 Vim 时自动加载。 + +例如,尝试安装一下 [NERDTree][5],这是一个基于文本的 Vim 文件管理器。首先,使用 Git 克隆 NERDTree 存储库的快照: + +``` +$ git clone --depth 1 \ +  https://github.com/preservim/nerdtree.git \ +  ~/.vim/pack/vendor/start/nerdtree +``` + +启动 Vim 或者 gvim,然后键入如下命令: + +``` +:NERDTree +``` + +Vim 窗口左侧将打开一个文件树。 + +![NERDTree plugin][6] + +如果你不想让一个插件每次启动 Vim 时都自动加载,你可以在 `~/.vim/pack/vendor` 中创建 `opt` 文件夹: + +``` +$ mkdir ~/.vim/pack/vendor/opt +``` + +任何安装到 `opt` 的插件都可被 Vim 使用,但是只有当你使用 `packadd` 命令将它们添加到一个会话中时,它们才会被加载到内存中。例如,一个虚构的叫 foo 的插件: + +``` +:packadd foo +``` + +Vim 官方建议每个插件项目在 `~/.Vim/pack` 中创建自己的目录。例如,如果你要安装 NERDTree 插件和假想的 foo 插件,你需要创建这样的目录结构: + +``` +$ mkdir -p ~/.vim/pack/NERDTree/start/ +$ git clone --depth 1 \ + https://github.com/preservim/nerdtree.git \ + ~/.vim/pack/NERDTree/start/NERDTree +$ mkdir -p ~/.vim/pack/foo/start/ +$ git clone --depth 1 \ + https://notabug.org/foo/foo.git \ + ~/.vim/pack/foo/start/foo +``` + +这样做是否方便取决于你。 + +### 使用 Vim 包管理器(任何 Vim 版本) + +自从 Vim 8 以后,包管理器变得不那么有用了,但是一些用户仍然喜欢它们,因为它们能够自动更新一些插件。有几个包管理器可供选择,并且它们各不相同,但是 [vim-plug][7] 有一些很棒的特性和最好的文档,这使我们很容易开始并在以后深入研究。 + +#### 使用 vim-plug 安装插件 + +安装 vim-plug,以便它在启动时自动加载: + +``` +$ curl -fLo ~/.vim/autoload/plug.vim --create-dirs \ +  https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim +``` + +创建一个 `~/.vimrc` 文件(如果你还没有这个文件),然后输入以下文本: + +``` +call plug#begin() +Plug 'preservim/NERDTree' +call plug#end() +``` + +每次要安装插件时,都必须在 `plug#begin()` 和 `plug#end()` 之间输入插件的名称和位置(上面以 NERDTree 文件管理器为例)。如果你所需的插件未托管在 GitHub 上,你可以提供完整的 URL,而不仅仅是 GitHub 的用户名和项目 ID。你甚至可以在 `~/.vim` 目录之外“安装”本地插件。 + +最后,启动 Vim 并提示 vim-plug 安装 `~/.vimrc` 中列出的插件: + +``` +:PlugInstall +``` + +等待插件下载。 + +#### 通过 vim-plug 更新插件 + +与手动安装过程相比,编辑 `~/.vimrc` 并使用命令来进行安装可能看起来并没有多省事,但是 vim-plug 的真正优势在更新。更新所有安装的插件,使用这个 Vim 命令: + +``` +:PlugUpdate +``` + +如果你不想更新所有的插件,你可以通过添加插件的名字来更新任何插件: + +``` +:PlugUpdate NERDTree +``` + +#### 恢复插件 + +vim-plug 的另一个优点是它的导出和恢复功能。Vim 用户都知道,正是插件的缘故,通常每个用户使用 Vim 的工作方式都是独一无二的。一旦你安装和配置了正确的插件组合,你最不想要的局面就是再也找不到它们。 + +Vim-plug 有这个命令来生成一个脚本来恢复所有当前的插件: + +``` +:PlugSnapshot ~/vim-plug.list +``` +vim-plug 还有许多其他的功能,所以请参考它的[项目页面][7]以获得完整的文档。 + +### 打造一个完美的 Vim + +当你整天都在做一个项目时,你希望每一个小细节都能为你提供最好的服务。了解 Vim 和它的许多插件,直到你为你所做的事情构建出一个完美的应用程序。 + +有喜欢的 Vim 插件吗?请在评论中告诉我们吧! + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/2/how-install-vim-plugins + +作者:[Seth Kenlon][a] +选题:[lujun9972][b] +译者:[qianmingtian][c] +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/seth +[b]: https://github.com/lujun9972 +[c]: https://github.com/qianmingtian +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/todo_checklist_team_metrics_report.png?itok=oB5uQbzf (Team checklist and to dos) +[2]: https://www.vim.org/ +[3]: https://opensource.com/article/19/12/colors-themes-vim +[4]: https://github.com/vim/vim/blob/03c3bd9fd094c1aede2e8fe3ad8fd25b9f033053/runtime/doc/repeat.txt#L515 +[5]: https://github.com/preservim/nerdtree +[6]: https://opensource.com/sites/default/files/uploads/vim-nerdtree.jpg (NERDTree plugin) +[7]: https://github.com/junegunn/vim-plug diff --git a/published/202002/20200219 Don-t like IDEs- Try grepgitvi.md b/published/202002/20200219 Don-t like IDEs- Try grepgitvi.md new file mode 100644 index 0000000000..7284c57f0f --- /dev/null +++ b/published/202002/20200219 Don-t like IDEs- Try grepgitvi.md @@ -0,0 +1,104 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11934-1.html) +[#]: subject: (Don't like IDEs? Try grepgitvi) +[#]: via: (https://opensource.com/article/20/2/no-ide-script) +[#]: author: (Yedidyah Bar David https://opensource.com/users/didib) + +不喜欢 IDE?试试看 grepgitvi +====== + +> 一个简单又原始的脚本来用 Vim 打开你选择的文件。 + +![](https://img.linux.net.cn/data/attachment/album/202002/26/113942a99a1aujmjpfnfrh.jpg) + +像大多数开发者一样,我整天都在搜索和阅读源码。就我个人而言,我从来没有习惯过集成开发环境 (IDE),多年来,我主要使用 `grep` (找到文件),并复制/粘贴文件名来打开 Vi(m)。 + +最终,我写了这个脚本,并根据需要缓慢地对其进行了完善。 + +它依赖 [Vim][2] 和 [rlwrap][3],并使用 Apache 2.0 许可证开源。要使用该脚本,请[将它放到 PATH 中][4],然后在文本目录下运行: + +``` +grepgitvi +``` + +它将返回搜索结果的编号列表,并提示你输入结果编号并打开 Vim。退出 Vim 后,它将再次显示列表,直到你输入除结果编号以外的任何内容。你也可以使用向上和向下箭头键选择一个文件。(这对我来说)更容易找到我已经看过的结果。 + +与现代 IDE 甚至与 Vim 的更复杂的用法相比,它简单而原始,但它对我有用。 + +### 脚本 + + +``` +#!/bin/bash + +# grepgitvi - grep source files, interactively open vim on results +# Doesn't really have to do much with git, other than ignoring .git +# +# Copyright Yedidyah Bar David 2019 +# +# SPDX-License-Identifier: Apache-2.0 +# +# Requires vim and rlwrap +# +# Usage: grepgitvi +# + +TMPD=$(mktemp -d /tmp/grepgitvi.XXXXXX) +UNCOLORED=${TMPD}/uncolored +COLORED=${TMPD}/colored + +RLHIST=${TMPD}/readline-history + +[ -z "${DIRS}" ] && DIRS=. + +cleanup() { + rm -rf "${TMPD}" +} + +trap cleanup 0 + +find ${DIRS} -iname .git -prune -o \! -iname "*.min.css*" -type f -print0 > ${TMPD}/allfiles + +cat ${TMPD}/allfiles | xargs -0 grep --color=always -n -H "$@" > $COLORED +cat ${TMPD}/allfiles | xargs -0 grep -n -H "$@" > $UNCOLORED + +max=`cat $UNCOLORED | wc -l` +pat="${@: -1}" + +inp='' +while true; do + echo "============================ grep results ===============================" + cat $COLORED | nl + echo "============================ grep results ===============================" + prompt="Enter a number between 1 and $max or anything else to quit: " + inp=$(rlwrap -H $RLHIST bash -c "read -p \"$prompt\" inp; echo \$inp") + if ! echo "$inp" | grep -q '^[0-9][0-9]*$' || [ "$inp" -gt "$max" ]; then + break + fi + + filename=$(cat $UNCOLORED | awk -F: "NR==$inp"' {print $1}') + linenum=$(cat $UNCOLORED | awk -F: "NR==$inp"' {print $2-1}') + vim +:"$linenum" +"norm zz" +/"${pat}" "$filename" +done +``` + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/2/no-ide-script + +作者:[Yedidyah Bar David][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/didib +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/files_documents_paper_folder.png?itok=eIJWac15 (Files in a folder) +[2]: https://www.vim.org/ +[3]: https://linux.die.net/man/1/rlwrap +[4]: https://opensource.com/article/17/6/set-path-linux diff --git a/published/202002/20200219 How Kubernetes Became the Standard for Compute Resources.md b/published/202002/20200219 How Kubernetes Became the Standard for Compute Resources.md new file mode 100644 index 0000000000..3d1a903916 --- /dev/null +++ b/published/202002/20200219 How Kubernetes Became the Standard for Compute Resources.md @@ -0,0 +1,49 @@ +[#]: collector: (lujun9972) +[#]: translator: (heguangzhi) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11940-1.html) +[#]: subject: (How Kubernetes Became the Standard for Compute Resources) +[#]: via: (https://www.linux.com/articles/how-kubernetes-became-the-standard-for-compute-resources/) +[#]: author: (Swapnil Bhartiya https://www.linux.com/author/swapnil/) + +Kubernetes 如何成为计算资源的标准 +====== + +![](https://img.linux.net.cn/data/attachment/album/202002/28/131634mwzyylmv93m4ccws.jpg) + +对于原生云生态系统来说,2019 年是改变游戏规则的一年。有大的[并购][1],如 Red Hat Docker 和 Pivotal,并出现其他的玩家,如 Rancher Labs 和 Mirantis。 + +Rancher Labs (一家为采用容器的团队提供完整软件栈的公司)的联合创始人兼首席执行官盛亮表示:“所有这些整合和并购,都表明这一领域的市场成熟的速度很快。” + +传统上,像 Kubernetes 和 Docker 这样的新兴技术吸引着开发者和像脸书和谷歌这样的超级用户。除了这群人之外则没什么兴趣。然而,这两种技术都在企业层面得到了广泛采用。突然间,出现了一个巨大的市场,有着巨大的机会。几乎每个人都跳了进去。有人带来了创新的解决方案,也有人试图赶上其他人。它很快变得非常拥挤和热闹起来。 + +它也改变了创新的方式。[早期采用者通常是精通技术的公司][2]。现在,几乎每个人都在使用它,即使是在不被认为是 Kubernetes 地盘的地方。它改变了市场动态,像 Rancher Labs 这样的公司见证了独特的用例。 + +盛亮补充道,“我从来没有经历过像 Kubernete 这样快速、动态的市场或技术演变。当我们五年前开始的时候,这是一个非常拥挤的空间。随着时间的推移,我们大多数的友商因为这样或那样的原因消失了。他们要么无法适应变化,要么选择不适应某些变化。” + +在 Kubernetes 的早期,最明显的机会是建立 Kubernetes 发行版本和 Kubernetes 业务。这是新技术。众所周知,它的安装、升级和操作相当的复杂。 + +当谷歌、AWS 和微软进入市场时,一切都变了。当时,一群供应商蜂拥而至,为平台提供解决方案。盛亮表示:“一旦像谷歌这样的云提供商决定将 Kubernetes 作为一项服务,并免费提供亏本出售的商品,以推动基础设施消费;我们就知道,运营和支持 Kubernetes 业务的优势将非常有限了。” + +对谷歌之外的其它玩家来说,并非一切都不好。由于云供应商通过将它作为服务来提供,消除了 Kubernetes 带来的所有复杂性,这意味着更广泛地采用该技术,即使是那些由于运营成本而不愿使用该技术的人也是如此。这意味着 Kubernetes 将变得无处不在,并将成为一个行业标准。 + +“Rancher Labs 是极少数将此视为机遇并比其他公司看得更远的公司之一。我们意识到 Kubernetes 将成为新的计算标准,就像 TCP/IP 成为网络标准一样,”盛亮说。 + +CNCF 在围绕 Kubernetes 构建一个充满活力的生态系统方面发挥着至关重要的作用,创建了一个庞大的社区来构建、培育和商业化原生云开源技术。 + +-------------------------------------------------------------------------------- + +via: https://www.linux.com/articles/how-kubernetes-became-the-standard-for-compute-resources/ + +作者:[Swapnil Bhartiya][a] +选题:[lujun9972][b] +译者:[heguangzhi](https://github.com/heguangzhi) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://www.linux.com/author/swapnil/ +[b]: https://github.com/lujun9972 +[1]: https://www.cloudfoundry.org/blog/2019-is-the-year-of-consolidation-why-ibms-deal-with-red-hat-is-a-harbinger-of-things-to-come/ +[2]: https://www.packet.com/blog/open-source-season-on-the-kubernetes-highway/ diff --git a/published/202002/20200219 How to Install Latest Git Version on Ubuntu.md b/published/202002/20200219 How to Install Latest Git Version on Ubuntu.md new file mode 100644 index 0000000000..c05c0d3c02 --- /dev/null +++ b/published/202002/20200219 How to Install Latest Git Version on Ubuntu.md @@ -0,0 +1,128 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11929-1.html) +[#]: subject: (How to Install Latest Git Version on Ubuntu) +[#]: via: (https://itsfoss.com/install-git-ubuntu/) +[#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/) + +如何在 Ubuntu 上安装最新版本的 Git +====== + +在 Ubuntu 上安装 Git 非常容易。它存在于 [Ubuntu 的主仓库][1]中,你可以像这样[使用 apt 命令][2]安装它: + +``` +sudo apt install git +``` + +很简单?是不是? + +只有一点点小问题(这可能根本不是问题),就是它安装的 [Git][3] 版本。 + +在 LTS 系统上,软件稳定性至关重要,这就是为什么 Ubuntu 18.04 和其他发行版经常提供较旧但稳定的软件版本的原因,它们都经过发行版的良好测试。 + +这就是为什么当你检查 Git 版本时,会看到安装的版本会比 [Git 网站上当前最新 Git 版本][4]旧: + +``` +$ git --version +git version 2.17.1 +``` + +在编写本教程时,网站上提供的版本为 2.25。那么,如何在 Ubuntu 上安装最新的 Git? + +### 在基于 Ubuntu 的 Linux 发行版上安装最新的 Git + +![][5] + +一种方法是[从源代码安装][6]。这种很酷又老派的方法不适合所有人。值得庆幸的是,Ubuntu Git 维护团队提供了 [PPA][7],莫可以使用它轻松地安装最新的稳定 Git 版本。 + +``` +sudo add-apt-repository ppa:git-core/ppa +sudo apt update +sudo apt install git +``` + +即使你以前使用 `apt` 安装了 Git,它也将更新为最新的稳定版本。 + +``` +$ git --version +git version 2.25.0 +``` + +[使用PPA][8] 的好处在于,如果发布了新的 Git 稳定版本,那么就可以通过系统更新获得它。[仅更新 Ubuntu][9] 来获取最新的 Git 稳定版本。 + +### 配置 Git (推荐给开发者) + +如果你出于开发目的安装了 Git,你会很快开始克隆仓库,进行更改并提交更改。 + +如果你尝试提交代码,那么你可能会看到 “Please tell me who you are” 这样的错误: + +``` +$ git commit -m "update readme" + +*** Please tell me who you are. + +Run + + git config --global user.email "you@example.com" + git config --global user.name "Your Name" + +to set your account's default identity. +Omit --global to set the identity only in this repository. + +fatal: unable to auto-detect email address (got 'abhishek@itsfoss.(none)') +``` + +这是因为你还没配置必要的个人信息。 + +正如错误已经暗示的那样,你可以像这样设置全局 Git 配置: + +``` +git config --global user.name "Your Name" +git config --global user.email "you@example.com" +``` + +你可以使用以下命令检查 Git 配置: + +``` +git config --list +``` + +它应该显示如下输出: + +``` +user.email=you@example.com +user.name=Your Name +``` + +配置保存在 `~/.gitconfig` 中。你可以手动修改配置。 + +### 结尾 + +我希望这个小教程可以帮助你在 Ubuntu 上安装 Git。使用 PPA,你可以轻松获得最新的 Git 版本。 + +如果你有任何疑问或建议,请随时在评论部分提问。也欢迎直接写“谢谢” :) + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/install-git-ubuntu/ + +作者:[Abhishek Prakash][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://itsfoss.com/author/abhishek/ +[b]: https://github.com/lujun9972 +[1]: https://itsfoss.com/ubuntu-repositories/ +[2]: https://itsfoss.com/apt-command-guide/ +[3]: https://git-scm.com/ +[4]: https://git-scm.com/downloads +[5]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/02/install_git_ubuntu.png?ssl=1 +[6]: https://itsfoss.com/install-software-from-source-code/ +[7]: https://launchpad.net/~git-core/+archive/ubuntu/ppa +[8]: https://itsfoss.com/ppa-guide/ +[9]: https://itsfoss.com/update-ubuntu/ diff --git a/published/202002/20200220 Using Python and GNU Octave to plot data.md b/published/202002/20200220 Using Python and GNU Octave to plot data.md new file mode 100644 index 0000000000..5f2b7dba66 --- /dev/null +++ b/published/202002/20200220 Using Python and GNU Octave to plot data.md @@ -0,0 +1,483 @@ +[#]: collector: (lujun9972) +[#]: translator: (heguangzhi) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11943-1.html) +[#]: subject: (Using Python and GNU Octave to plot data) +[#]: via: (https://opensource.com/article/20/2/python-gnu-octave-data-science) +[#]: author: (Cristiano L. Fontana https://opensource.com/users/cristianofontana) + +使用 Python 和 GNU Octave 绘制数据 +====== + +> 了解如何使用 Python 和 GNU Octave 完成一项常见的数据科学任务。 + +![](https://img.linux.net.cn/data/attachment/album/202002/29/114750tr7qykssk90yrvyz.jpg) + +数据科学是跨越编程语言的知识领域。有些语言以解决这一领域的问题而闻名,而另一些则鲜为人知。这篇文章将帮助你熟悉用一些流行的语言完成数据科学的工作。 + +### 选择 Python 和 GNU Octave 做数据科学工作 + +我经常尝试学习一种新的编程语言。为什么?这既有对旧方式的厌倦,也有对新方式的好奇。当我开始学习编程时,我唯一知道的语言是 C 语言。那些年的编程生涯既艰难又危险,因为我必须手动分配内存、管理指针、并记得释放内存。 + +后来一个朋友建议我试试 Python,现在我的编程生活变得轻松多了。虽然程序运行变得慢多了,但我不必通过编写分析软件来受苦了。然而,我很快就意识到每种语言都有比其它语言更适合自己的应用场景。后来我学习了一些其它语言,每种语言都给我带来了一些新的启发。发现新的编程风格让我可以将一些解决方案移植到其他语言中,这样一切都变得有趣多了。 + +为了对一种新的编程语言(及其文档)有所了解,我总是从编写一些执行我熟悉的任务的示例程序开始。为此,我将解释如何用 Python 和 GNU Octave 编写一个程序来完成一个你可以归类为数据科学的特殊任务。如果你已经熟悉其中一种语言,从它开始,然后通过其他语言寻找相似之处和不同之处。这篇文章并不是对编程语言的详尽比较,只是一个小小的展示。 + +所有的程序都应该在[命令行][2]上运行,而不是用[图形用户界面][3](GUI)。完整的例子可以在 [polyglot_fit 存储库][4]中找到。 + +### 编程任务 + +你将在本系列中编写的程序: + + * 从 [CSV 文件][5]中读取数据 + * 用直线插入数据(例如 `f(x)=m ⋅ x + q`) + * 将结果生成图像文件 + +这是许多数据科学家遇到的常见情况。示例数据是 [Anscombe 的四重奏][6]的第一组,如下表所示。这是一组人工构建的数据,当用直线拟合时会给出相同的结果,但是它们的曲线非常不同。数据文件是一个文本文件,以制表符作为列分隔符,开头几行作为标题。此任务将仅使用第一组(即前两列)。 + +![](https://img.linux.net.cn/data/attachment/album/202002/29/122805h3yrs1dkrgysssxk.png) + +### Python 方式 + +[Python][7] 是一种通用编程语言,是当今最流行的语言之一(依据 [TIOBE 指数][8]、[RedMonk 编程语言排名][9]、[编程语言流行指数][10]、[GitHub Octoverse 状态][11]和其他来源的调查结果)。它是一种[解释型语言][12];因此,源代码由执行该指令的程序读取和评估。它有一个全面的[标准库][13]并且总体上非常好用(我对这最后一句话没有证据;这只是我的拙见)。 + +#### 安装 + +要使用 Python 开发,你需要解释器和一些库。最低要求是: + +* [NumPy][14] 用于简化数组和矩阵的操作 +* [SciPy][15] 用于数据科学 +* [Matplotlib][16] 用于绘图 + +在 [Fedora][17] 安装它们是很容易的: + +``` +sudo dnf install python3 python3-numpy python3-scipy python3-matplotlib +``` + +#### 代码注释 + +在 Python中,[注释][18]是通过在行首添加一个 `#` 来实现的,该行的其余部分将被解释器丢弃: + +``` +# 这是被解释器忽略的注释。 +``` + +[fitting_python.py][19] 示例使用注释在源代码中插入许可证信息,第一行是[特殊注释][20],它允许该脚本在命令行上执行: + +``` +#!/usr/bin/env python3 +``` + +这一行通知命令行解释器,该脚本需要由程序 `python3` 执行。 + +#### 需要的库 + +在 Python 中,库和模块可以作为一个对象导入(如示例中的第一行),其中包含库的所有函数和成员。可以通过使用 `as` 方式用自定义标签重命名它们: + +``` +import numpy as np +from scipy import stats +import matplotlib.pyplot as plt +``` + +你也可以决定只导入一个子模块(如第二行和第三行)。语法有两个(基本上)等效的方式:`import module.submodule` 和 `from module import submodule`。 + +#### 定义变量 + +Python 的变量是在第一次赋值时被声明的: + +``` +input_file_name = "anscombe.csv" +delimiter = "\t" +skip_header = 3 +column_x = 0 +column_y = 1 +``` + +变量类型由分配给变量的值推断。没有具有常量值的变量,除非它们在模块中声明并且只能被读取。习惯上,不应被修改的变量应该用大写字母命名。 + +#### 打印输出 + +通过命令行运行程序意味着输出只能打印在终端上。Python 有 [print()][21] 函数,默认情况下,该函数打印其参数,并在输出的末尾添加一个换行符: + +``` +print("#### Anscombe's first set with Python ####") +``` + +在 Python 中,可以将 `print()` 函数与[字符串类][23]的[格式化能力][22]相结合。字符串具有`format` 方法,可用于向字符串本身添加一些格式化文本。例如,可以添加格式化的浮点数,例如: + +``` +print("Slope: {:f}".format(slope)) +``` + +#### 读取数据 + +使用 NumPy 和函数 [genfromtxt()][24] 读取 CSV 文件非常容易,该函数生成 [NumPy 数组][25]: + +``` +data = np.genfromtxt(input_file_name, delimiter = delimiter, skip_header = skip_header) +``` + +在 Python 中,一个函数可以有数量可变的参数,你可以通过指定所需的参数来传递一个参数的子集。数组是非常强大的矩阵状对象,可以很容易地分割成更小的数组: + +``` +x = data[:, column_x] +y = data[:, column_y] +``` + +冒号选择整个范围,也可以用来选择子范围。例如,要选择数组的前两行,可以使用: + +``` +first_two_rows = data[0:1, :] +``` + +#### 拟合数据 + +SciPy 提供了方便的数据拟合功能,例如 [linregress()][26] 功能。该函数提供了一些与拟合相关的重要值,如斜率、截距和两个数据集的相关系数: + +``` +slope, intercept, r_value, p_value, std_err = stats.linregress(x, y) + +print("Slope: {:f}".format(slope)) +print("Intercept: {:f}".format(intercept)) +print("Correlation coefficient: {:f}".format(r_value)) +``` + +因为 `linregress()` 提供了几条信息,所以结果可以同时保存到几个变量中。 + +#### 绘图 + +Matplotlib 库仅仅绘制数据点,因此,你应该定义要绘制的点的坐标。已经定义了 `x` 和 `y` 数组,所以你可以直接绘制它们,但是你还需要代表直线的数据点。 + +``` +fit_x = np.linspace(x.min() - 1, x.max() + 1, 100) +``` + +[linspace()][27] 函数可以方便地在两个值之间生成一组等距值。利用强大的 NumPy 数组可以轻松计算纵坐标,该数组可以像普通数值变量一样在公式中使用: + +``` +fit_y = slope * fit_x + intercept +``` + +该公式在数组中逐元素应用;因此,结果在初始数组中具有相同数量的条目。 + +要绘图,首先,定义一个包含所有图形的[图形对象][28]: + +``` +fig_width = 7 #inch +fig_height = fig_width / 16 * 9 #inch +fig_dpi = 100 + +fig = plt.figure(figsize = (fig_width, fig_height), dpi = fig_dpi) +``` + +一个图形可以画几个图;在 Matplotlib 中,这些图被称为[轴][29]。本示例定义一个单轴对象来绘制数据点: + +``` +ax = fig.add_subplot(111) + +ax.plot(fit_x, fit_y, label = "Fit", linestyle = '-') +ax.plot(x, y, label = "Data", marker = '.', linestyle = '') + +ax.legend() +ax.set_xlim(min(x) - 1, max(x) + 1) +ax.set_ylim(min(y) - 1, max(y) + 1) +ax.set_xlabel('x') +ax.set_ylabel('y') +``` + +将该图保存到 [PNG 图形文件][30]中,有: + +``` +fig.savefig('fit_python.png') +``` + +如果要显示(而不是保存)该绘图,请调用: + +``` +plt.show() +``` + +此示例引用了绘图部分中使用的所有对象:它定义了对象 `fig` 和对象 `ax`。这在技术上是不必要的,因为 `plt` 对象可以直接用于绘制数据集。《[Matplotlib 教程][31]》展示了这样一个接口: + +``` +plt.plot(fit_x, fit_y) +``` + +坦率地说,我不喜欢这种方法,因为它隐藏了各种对象之间发生的重要交互。不幸的是,有时[官方的例子][32]有点令人困惑,因为他们倾向于使用不同的方法。在这个简单的例子中,引用图形对象是不必要的,但是在更复杂的例子中(例如在图形用户界面中嵌入图形时),引用图形对象就变得很重要了。 + +#### 结果 + +命令行输入: + +``` +#### Anscombe's first set with Python #### +Slope: 0.500091 +Intercept: 3.000091 +Correlation coefficient: 0.816421 +``` + +这是 Matplotlib 产生的图像: + +![Plot and fit of the dataset obtained with Python][33] + +### GNU Octave 方式 + +[GNU Octave][34] 语言主要用于数值计算。它提供了一个简单的操作向量和矩阵的语法,并且有一些强大的绘图工具。这是一种像 Python 一样的解释语言。由于 Octave 的语法[几乎兼容][35] [MATLAB][36],它经常被描述为一个替代 MATLAB 的免费方案。Octave 没有被列为最流行的编程语言,而 MATLAB 则是,所以 Octave 在某种意义上是相当流行的。MATLAB 早于 NumPy,我觉得它是受到了前者的启发。当你看这个例子时,你会看到相似之处。 + +#### 安装 + +[fitting_octave.m][37] 的例子只需要基本的 Octave 包,在 Fedora 中安装相当简单: + +``` +sudo dnf install octave +``` + +#### 代码注释 + +在 Octave 中,你可以用百分比符号(`%`)为代码添加注释,如果不需要与 MATLAB 兼容,你也可以使用 `#`。使用 `#` 的选项允许你编写像 Python 示例一样的特殊注释行,以便直接在命令行上执行脚本。 + +#### 必要的库 + +本例中使用的所有内容都包含在基本包中,因此你不需要加载任何新的库。如果你需要一个库,[语法][38]是 `pkg load module`。该命令将模块的功能添加到可用功能列表中。在这方面,Python 具有更大的灵活性。 + +#### 定义变量 + +变量的定义与 Python 的语法基本相同: + +``` +input_file_name = "anscombe.csv"; +delimiter = "\t"; +skip_header = 3; +column_x = 1; +column_y = 2; +``` + +请注意,行尾有一个分号;这不是必需的,但是它会抑制该行结果的输出。如果没有分号,解释器将打印表达式的结果: + +``` +octave:1> input_file_name = "anscombe.csv" +input_file_name = anscombe.csv +octave:2> sqrt(2) +ans = 1.4142 +``` + +#### 打印输出结果 + +强大的函数 [printf()][39] 是用来在终端上打印的。与 Python 不同,`printf()` 函数不会自动在打印字符串的末尾添加换行,因此你必须添加它。第一个参数是一个字符串,可以包含要传递给函数的其他参数的格式信息,例如: + +``` +printf("Slope: %f\n", slope); +``` + +在 Python 中,格式是内置在字符串本身中的,但是在 Octave 中,它是特定于 `printf()` 函数。 + +#### 读取数据 + +[dlmread()][40] 函数可以读取类似 CSV 文件的文本内容: + +``` +data = dlmread(input_file_name, delimiter, skip_header, 0); +``` + +结果是一个[矩阵][41]对象,这是 Octave 中的基本数据类型之一。矩阵可以用类似于 Python 的语法进行切片: + +``` +x = data(:, column_x); +y = data(:, column_y); +``` + +根本的区别是索引从 1 开始,而不是从 0 开始。因此,在该示例中,`x` 列是第一列。 + +#### 拟合数据 + +要用直线拟合数据,可以使用 [polyfit()][42] 函数。它用一个多项式拟合输入数据,所以你只需要使用一阶多项式: + +``` +p = polyfit(x, y, 1); + +slope = p(1); +intercept = p(2); +``` + +结果是具有多项式系数的矩阵;因此,它选择前两个索引。要确定相关系数,请使用 [corr()][43] 函数: + +``` +r_value = corr(x, y); +``` + +最后,使用 `printf()` 函数打印结果: + +``` +printf("Slope: %f\n", slope); +printf("Intercept: %f\n", intercept); +printf("Correlation coefficient: %f\n", r_value); +``` + +#### 绘图 + +与 Matplotlib 示例一样,首先需要创建一个表示拟合直线的数据集: + +``` +fit_x = linspace(min(x) - 1, max(x) + 1, 100); +fit_y = slope * fit_x + intercept; +``` + +与 NumPy 的相似性也很明显,因为它使用了 [linspace()][44] 函数,其行为就像 Python 的等效版本一样。 + +同样,与 Matplotlib 一样,首先创建一个[图][45]对象,然后创建一个[轴][46]对象来保存这些图: + +``` +fig_width = 7; %inch +fig_height = fig_width / 16 * 9; %inch +fig_dpi = 100; + +fig = figure("units", "inches", +             "position", [1, 1, fig_width, fig_height]); + +ax = axes("parent", fig); + +set(ax, "fontsize", 14); +set(ax, "linewidth", 2); +``` + +要设置轴对象的属性,请使用 [set()][47] 函数。然而,该接口相当混乱,因为该函数需要一个逗号分隔的属性和值对列表。这些对只是代表属性名的一个字符串和代表该属性值的第二个对象的连续。还有其他设置各种属性的函数: + +``` +xlim(ax, [min(x) - 1, max(x) + 1]); +ylim(ax, [min(y) - 1, max(y) + 1]); +xlabel(ax, 'x'); +ylabel(ax, 'y'); +``` + +绘图是用 [plot()][48] 功能实现的。默认行为是每次调用都会重置坐标轴,因此需要使用函数 [hold()][49]。 + +``` +hold(ax, "on"); + +plot(ax, fit_x, fit_y, +     "marker", "none", +     "linestyle", "-", +     "linewidth", 2); +plot(ax, x, y, +     "marker", ".", +     "markersize", 20, +     "linestyle", "none"); + +hold(ax, "off"); +``` + +此外,还可以在 `plot()` 函数中添加属性和值对。[legend][50] 必须单独创建,标签应手动声明: + +``` +lg = legend(ax, "Fit", "Data"); +set(lg, "location", "northwest"); +``` + +最后,将输出保存到 PNG 图像: + +``` +image_size = sprintf("-S%f,%f", fig_width * fig_dpi, fig_height * fig_dpi); +image_resolution = sprintf("-r%f,%f", fig_dpi); + +print(fig, 'fit_octave.png', +      '-dpng', +      image_size, +      image_resolution); +``` + +令人困惑的是,在这种情况下,选项被作为一个字符串传递,带有属性名和值。因为在 Octave 字符串中没有 Python 的格式化工具,所以必须使用 [sprintf()][51] 函数。它的行为就像 `printf()` 函数,但是它的结果不是打印出来的,而是作为字符串返回的。 + +在这个例子中,就像在 Python 中一样,图形对象很明显被引用以保持它们之间的交互。如果说 Python 在这方面的文档有点混乱,那么 [Octave 的文档][52]就更糟糕了。我发现的大多数例子都不关心引用对象;相反,它们依赖于绘图命令作用于当前活动图形。全局[根图形对象][53]跟踪现有的图形和轴。 + +#### 结果 + +命令行上的结果输出是: + +``` +#### Anscombe's first set with Octave #### +Slope: 0.500091 +Intercept: 3.000091 +Correlation coefficient: 0.816421 +``` + +它显示了用 Octave 生成的结果图像。 + +![Plot and fit of the dataset obtained with Octave][54] + +###接下来 + +Python 和 GNU Octave 都可以绘制出相同的信息,尽管它们的实现方式不同。如果你想探索其他语言来完成类似的任务,我强烈建议你看看 [Rosetta Code][55]。这是一个了不起的资源,可以看到如何用多种语言解决同样的问题。 + +你喜欢用什么语言绘制数据?在评论中分享你的想法。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/2/python-gnu-octave-data-science + +作者:[Cristiano L. Fontana][a] +选题:[lujun9972][b] +译者:[heguangzhi](https://github.com/heguangzhi) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/cristianofontana +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/analytics-graphs-charts.png?itok=sersoqbV (Analytics: Charts and Graphs) +[2]: https://en.wikipedia.org/wiki/Command-line_interface +[3]: https://en.wikipedia.org/wiki/Graphical_user_interface +[4]: https://gitlab.com/cristiano.fontana/polyglot_fit +[5]: https://en.wikipedia.org/wiki/Comma-separated_values +[6]: https://en.wikipedia.org/wiki/Anscombe%27s_quartet +[7]: https://www.python.org/ +[8]: https://www.tiobe.com/tiobe-index/ +[9]: https://redmonk.com/sogrady/2019/07/18/language-rankings-6-19/ +[10]: http://pypl.github.io/PYPL.html +[11]: https://octoverse.github.com/ +[12]: https://en.wikipedia.org/wiki/Interpreted_language +[13]: https://docs.python.org/3/library/ +[14]: https://numpy.org/ +[15]: https://www.scipy.org/ +[16]: https://matplotlib.org/ +[17]: https://getfedora.org/ +[18]: https://en.wikipedia.org/wiki/Comment_(computer_programming) +[19]: https://gitlab.com/cristiano.fontana/polyglot_fit/-/blob/master/fitting_python.py +[20]: https://en.wikipedia.org/wiki/Shebang_(Unix) +[21]: https://docs.python.org/3/library/functions.html#print +[22]: https://docs.python.org/3/library/string.html#string-formatting +[23]: https://docs.python.org/3/library/string.html +[24]: https://docs.scipy.org/doc/numpy/reference/generated/numpy.genfromtxt.html +[25]: https://docs.scipy.org/doc/numpy/reference/generated/numpy.array.html +[26]: https://docs.scipy.org/doc/scipy/reference/generated/scipy.stats.linregress.html +[27]: https://docs.scipy.org/doc/numpy/reference/generated/numpy.linspace.html +[28]: https://matplotlib.org/api/_as_gen/matplotlib.figure.Figure.html#matplotlib.figure.Figure +[29]: https://matplotlib.org/api/axes_api.html#matplotlib.axes.Axes +[30]: https://en.wikipedia.org/wiki/Portable_Network_Graphics +[31]: https://matplotlib.org/tutorials/introductory/pyplot.html#sphx-glr-tutorials-introductory-pyplot-py +[32]: https://matplotlib.org/gallery/index.html +[33]: https://opensource.com/sites/default/files/uploads/fit_python.png (Plot and fit of the dataset obtained with Python) +[34]: https://www.gnu.org/software/octave/ +[35]: https://wiki.octave.org/FAQ#Differences_between_Octave_and_Matlab +[36]: https://en.wikipedia.org/wiki/MATLAB +[37]: https://gitlab.com/cristiano.fontana/polyglot_fit/-/blob/master/fitting_octave.m +[38]: https://octave.org/doc/v5.1.0/Using-Packages.html#Using-Packages +[39]: https://octave.org/doc/v5.1.0/Formatted-Output.html#XREFprintf +[40]: https://octave.org/doc/v5.1.0/Simple-File-I_002fO.html#XREFdlmread +[41]: https://octave.org/doc/v5.1.0/Matrices.html +[42]: https://octave.org/doc/v5.1.0/Polynomial-Interpolation.html +[43]: https://octave.org/doc/v5.1.0/Correlation-and-Regression-Analysis.html#XREFcorr +[44]: https://octave.sourceforge.io/octave/function/linspace.html +[45]: https://octave.org/doc/v5.1.0/Multiple-Plot-Windows.html +[46]: https://octave.org/doc/v5.1.0/Graphics-Objects.html#XREFaxes +[47]: https://octave.org/doc/v5.1.0/Graphics-Objects.html#XREFset +[48]: https://octave.org/doc/v5.1.0/Two_002dDimensional-Plots.html#XREFplot +[49]: https://octave.org/doc/v5.1.0/Manipulation-of-Plot-Windows.html#XREFhold +[50]: https://octave.org/doc/v5.1.0/Plot-Annotations.html#XREFlegend +[51]: https://octave.org/doc/v5.1.0/Formatted-Output.html#XREFsprintf +[52]: https://octave.org/doc/v5.1.0/Two_002dDimensional-Plots.html#Two_002dDimensional-Plots +[53]: https://octave.org/doc/v5.1.0/Graphics-Objects.html#XREFgroot +[54]: https://opensource.com/sites/default/files/uploads/fit_octave.png (Plot and fit of the dataset obtained with Octave) +[55]: http://www.rosettacode.org/ diff --git a/published/202003/20170918 Fun and Games in Emacs.md b/published/202003/20170918 Fun and Games in Emacs.md new file mode 100644 index 0000000000..2602ba804c --- /dev/null +++ b/published/202003/20170918 Fun and Games in Emacs.md @@ -0,0 +1,220 @@ +[#]: collector: (lujun9972) +[#]: translator: (lujun9972) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11949-1.html) +[#]: subject: (Fun and Games in Emacs) +[#]: via: (https://www.masteringemacs.org/article/fun-games-in-emacs) +[#]: author: (Mickey Petersen https://www.masteringemacs.org/about) + +“Emacs 游戏机”完全指南 +====== + +又是周一,你正在为你的老板 Lumbergh (LCTT 译注:《上班一条虫》中的副总裁)努力倒腾那些 [无聊之极的文档][1]。为什么不玩玩 Emacs 中类似 zork 的文字冒险游戏来让你的大脑从单调的工作中解脱出来呢? + +但说真的,Emacs 中既有游戏,也有古怪的玩物。有些你可能有所耳闻。这些玩意唯一的共同点就是,它们大多是很久以前就添加到 Emacs 中的:有些东西真的是相当古怪(如你将在下面看到的),而另一些则显然是由无聊的员工或学生们编写的。它们全有一个共同点,都带着一种奇思妙想和随意性,这在今天的 Emacs 中很少见。Emacs 现在变得十分严肃,在某种程度上,它已经与 20 世纪 80 年代那些游戏被编写出来的时候大不一样。 + +### 汉诺塔 + +[汉诺塔][2] 是一款古老的数学解密游戏,有些人可能对它很熟悉,因为它的递归和迭代解决方案经常被用于计算机科学教学辅助。 + +![Tower of Hanoi Screenshot](https://www.masteringemacs.org/static/uploads/hanoi.png) + +Emacs 中有三个命令可以运行汉诺塔:`M-x hanoi` 默认为 3 个碟子; `M-x hanoi-unix` 和 `M-x hanoi-unix-64` 使用 unix 时间戳的位数(32 位或 64 位)作为默认盘子的个数,并且每秒钟自动移动一次,两者不同之处在于后者假装使用 64 位时钟(因此有 64 个碟子)。 + +Emacs 中汉诺塔的实现可以追溯到 20 世纪 80 年代中期——确实是久得可怕。它有一些自定义选项(`M-x customize-group RET hanoi RET`),如启用彩色碟子等。当你离开汉诺塔缓冲区或输入一个字符,你会收到一个讽刺的告别信息(见上图)。 + +### 5x5 + +![5x5 game grid](https://www.masteringemacs.org/static/uploads/5x5.png) + +5x5 的游戏是一个逻辑解密游戏:你有一个 5x5 的网格,中间的十字被填满;你的目标是通过按正确的顺序切换它们的空满状态来填充所有的单元格,从而获得胜利。这并不像听起来那么容易! + +输入 `M-x 5x5` 就可以开始玩了,使用可选的数字参数可以改变网格的大小。这款游戏的有趣之处在于它能向你建议下一步行动并尝试找到该游戏网格的解法。它用到了 Emacs 自己的一款非常酷的符号 RPN 计算器 `M-x calc`(在《[Emacs 快乐计算][3]》这篇文章中,我使用它来解决了一个简单的问题)。 + +所以我喜欢这个游戏的原因是它提供了一个非常复杂的解题器——真的,你应该通过 `M-x find-library RET 5x5` 来阅读其源代码——这是一个试图通过暴力破解游戏解法的“破解器”。 + +创建一个更大的游戏网格,例如输入 `M-10 M-x 5x5`,然后运行下面某个 `crack` 命令。破解器将尝试通过迭代获得最佳解决方案。它会实时运行该游戏,观看起来非常有趣: + +- `M-x 5x5-crack-mutating-best`: 试图通过变异最佳解决方案来破解 5x5。 +- `M-x 5x5-crack-mutating-current`: 试图通过变异当前解决方案来破解 5x5。 +- `M-x 5x5-crack-random`: 尝试使用随机方案解破解 5x5。 +- `M-x 5x5-crack-xor-mutate`: 尝试通过将当前方案和最佳方案进行异或运算来破解 5x5。 + +### 文本动画 + +你可以通过运行 `M-x animation-birthday-present` 并给出你的名字来显示一个奇特的生日礼物动画。它看起来很酷! + +![xkcd](https://imgs.xkcd.com/comics/real_programmers.png) + +这里用的 `animate` 包也用在了 `M-x butterfly` 命令中,这是一个向上面的 [XKCD][4] 漫画致敬而添加到 Emacs 中的命令。当然,漫画中的 Emacs 命令在技术上是无效的,但它的幽默足以弥补这一点。 + +### 黑箱 + +我将逐字引用这款游戏的目标: + +> 游戏的目标是通过向黑盒子发射光线来找到四个隐藏的球。有四种可能: +> 1) 射线将通过盒子不受干扰; +> 2) 它将击中一个球并被吸收; +> 3) 它将偏转并退出盒子,或 +> 4) 立即偏转,甚至不能进入盒子。 + +所以,这有点像我们小时候玩的[战舰游戏][5],但是……是专为物理专业高学历的人准备的吧? + +这是另一款添加于 20 世纪 80 年代的游戏。我建议你输入 `C-h f blackbox` 来阅读玩法说明(文档巨大)。 + + +### 泡泡 + +![Bubbles game](https://www.masteringemacs.org/static/uploads/bubbles.png) + +`M-x bubble` 游戏相当简单:你必须用尽可能少移动清除尽可能多的“泡泡”。当你移除气泡时,其他气泡会掉落并粘在一起。这是一款有趣的游戏,此外如果你使用 Emacs 的图形用户界面,它还支持图像显示。而且它还支持鼠标。 + +你可以通过调用 `M-x bubbles-set-game-` 来设置难度,其中 `` 可以是这些之一:`easy`、`medium`、`difficult`、`hard` 或 `userdefined`。此外,你可以使用:`M-x custom-group bubbles` 来更改图形、网格大小和颜色。 + +由于它即简单又有趣,这是 Emacs 中我最喜欢的游戏之一。 + +### 幸运饼干 + +我喜欢 `fortune` 命令。每当我启动一个新 shell 时,这些与文学片段、谜语相结合的刻薄、无益、常常带有讽刺意味的“建议”就会点亮我的一天。 + +令人困惑的是,Emacs 中有两个包或多或少地做着类似的事情:`fortune` 和 `cookie`。前者主要用于在电子邮件签名中添加幸运饼干消息,而后者只是一个简单的 fortune 格式阅读器。 + +不管怎样,使用 Emacs 的 `cookie` 包前,你首先需要通过 `customize-option RET cookie RET` 来自定义变量 `cookie-file` 告诉它从哪找到 fortune 文件。 + +如果你的操作系统是 Ubuntu,那么你先安装 `fortune` 软件包,然后就能在 `/usr/share/games/fortune/` 目录中找到这些文件了。 + +之后你就可以调用 `M-x cookie` 随机显示 fortune 内容,或者,如果你想的话,也可以调用 `M-x cookie-apropos` 查找所有匹配的饼干。 + +### 破译器 + +这个包完美地抓住了 Emacs 的功利本质:这个包为你破解简单的替换密码(如“密码谜题”)提供了一个很有用的界面。你知道,二十多年前,有些人确实迫切需要破解很多基本的密码。正是像这个模块这样的小玩意让我非常高兴地用起 Emacs 来:一个只对少数人有用的模块,但是,如果你突然需要它了,那么它就在那里等着你。 + +那么如何使用它呢?让我们假设使用 “rot13” 密码:在 26 个字符的字母表中,将字符旋转 13 个位置。 +通过 `M-x ielm` (Emacs 用于 [运行 Elisp][6] 的 REPL 环境)可以很容易在 Emacs 中进行尝试: + +``` +*** Welcome to IELM *** Type (describe-mode) for help. +ELISP> (rot13 "Hello, World") +"Uryyb, Jbeyq" +ELISP> (rot13 "Uryyb, Jbeyq") +"Hello, World" +ELISP> +``` + +简而言之,你将明文旋转了 13 个位置,就得到了密文。你又旋转了一次 13 个位置,就返回了最初的明文。 这就是这个包可以帮助你解决的问题。 + +那么,decipher 模块又是如何帮助我们的呢?让我们创建一个新的缓冲区 `test-cipher` 并输入你的密文(在我的例子中是 `Uryyb,Jbeyq`)。 + +![cipher](https://www.masteringemacs.org/static/uploads/cipher.png) + +你现在面对的是一个相当复杂的界面。现在把光标放在紫色行的密文的任意字符上,并猜测这个字符可能是什么:Emacs 将根据你的选择更新其他明文的猜测结果,并告诉你目前为止字母表中的字符是如何分配的。 + +你现在可以用下面各种助手命令来关闭选项,以帮助推断密码字符可能对应的明文字符: + +- `D`: 列出示意图(该加密算法中双字符对)及其频率 +- `F`: 表示每个密文字母的频率 +- `N`: 显示字符的邻近信息。我不确定这是干啥的。 +- `M` 和 `R`: 保存和恢复一个检查点,允许你对工作进行分支以探索破解密码的不同方法。 + +总而言之,对于这样一个深奥的任务,这个包是相当令人印象深刻的!如果你经常破解密码,也许这个程序包能帮上忙? + +### 医生 + +![doctor](https://www.masteringemacs.org/static/uploads/doctor.png) + +啊,Emacs 医生。其基于最初的 [ELIZA][7],“医生”试图对你说的话进行心理分析,并试图把问题复述给你。体验几分钟,相当有趣,它也是 Emacs 中最著名的古怪玩意之一。你可以使用 `M-x doctor` 来运行它。 + +### Dunnet + +Emacs 自己特有的类 Zork 文字冒险游戏。输入 `M-x dunnet` 就能玩了。这是一款相当不错的游戏,简单的说,它是另一款非常著名的 Emacs 游戏,很少有人真正玩到通关。 + +如果你发现自己能在无聊的文档工作之间空出时间来,那么这是一个超级棒的游戏,内置“老板屏幕”,因为它是纯文本的。 + +哦,还有,不要想着吃掉那块 CPU 卡 :) + +### 五子棋 + +![gomoku](https://www.masteringemacs.org/static/uploads/gomoku.png) + +另一款写于 20 世纪 80 年代的游戏。你必须将 5 个方块连成一条线,井字棋风格。你可以运行 `M-x gomoku` 来与 Emacs 对抗。游戏还支持鼠标,非常方便。你也可以自定义 `gomoku` 组来调整网格的大小。 + +### 生命游戏 + +[康威的生命游戏][8] 是细胞自动机的一个著名例子。Emacs 版本提供了一些启动模式,你可以(通过 elisp 编程)调整 `life-patterns` 变量来更改这些模式。 + +你可以用 `M-x life` 触发生命游戏。事实上,所有的东西,包括显示代码、注释等等一切,总共不到 300 行,这也让人印象深刻。 + +### 乒乓,贪吃蛇和俄罗斯方块 + +![tetris](https://www.masteringemacs.org/static/uploads/tetris.png) + +这些经典游戏都是使用 Emacs 包 `gamegrid` 实现的,这是一个用于构建网格游戏(如俄罗斯方块和贪吃蛇)的通用框架。gamegrid 包的伟大之处在于它同时兼容图形化和终端 Emacs:如果你在 GUI 中运行 Emacs,你会得到精美的图形;如果你没有,你看到简单的 ASCII 艺术。 + +你可以通过输入 `M-x pong`、`M-x snake`、`M-x tetris` 来运行这些游戏。 + +特别是俄罗斯方块游戏实现的非常到位,会逐渐增加速度并且能够滑块。而且既然你已经有了源代码,你完全可以移除那个讨厌的 Z 形块,没人喜欢它! + +### Solitaire + +![solitaire image](https://www.masteringemacs.org/static/uploads/solitaire.png) + +可惜,这不是纸牌游戏,而是一个基于“钉子”的游戏,你可以选择一块石头(`o`)并“跳过”相邻的石头进入洞中(`.`),并在这个过程中去掉你跳过的石头,最终只能在棋盘上留下一块石头,重复该过程直到棋盘被请空(只保留一个石头)。 + +如果你卡住了,有一个内置的解题器名为 `M-x solitire-solve`。 + +### Zone + +我的另一个最爱。这是一个屏幕保护程序——或者更确切地说,是一系列的屏幕保护程序。 + +输入 `M-x zone`,然后看看屏幕上发生了什么! + +你可以通过运行 `M-x zone-when-idle`(或从 elisp 调用它)来配置屏幕保护程序的空闲时间,时间以秒为单位。你也可以通过 `M-x zone-leave-me-alone` 来关闭它。 + +如果在你的同事看着的时候启动它,你的同事肯定会抓狂的。 + +### 乘法解谜 + +![mpuz](https://www.masteringemacs.org/static/uploads/mpuz.png) + +这是另一个脑筋急转弯的益智游戏。当你运行 `M-x mpuz` 时,将看到一个乘法解谜题,你必须将字母替换为对应的数字,并确保数字相加(相乘?)符合结果。 + +如果遇到难题,可以运行 `M-x mpuz-show-solution` 来解决。 + +### 杂项 + +还有更多好玩的东西,但它们就不如刚才那些那么好玩好用了: + +- 你可以通过 `M-x morse-region` 和 `M-x unmorse-region` 将一个区域翻译成莫尔斯电码。 +- Dissociated Press 是一个非常简单的命令,它将一个类似随机穿行的马尔可夫链生成器应用到缓冲区中的文本中,并以此生成无意义的文本。试一下 `M-x dissociated-press`。 +- `gametree` 软件包是一个通过电子邮件记录和跟踪国际象棋游戏的复杂方法。 +- `M-x spook` 命令插入随机单词(通常是到电子邮件中),目的是混淆/超载 “NSA 拖网渔船” —— 记住,这个模块可以追溯到 20 世纪 80 年代和 90 年代,那时应该有间谍们在监听各种单词。当然,即使是在十年前,这样做也会显得非常偏执和古怪,不过现在看来已经不那么奇怪了…… + +### 总结 + +我喜欢 Emacs 附带的游戏和玩具。它们大多来自于,嗯,我们姑且称之为一个不同的时代:一个允许或甚至鼓励奇思妙想的时代。有些玩意非常经典(如俄罗斯方块和汉诺塔),有些对经典游戏进行了有趣的变种(如黑盒)——但我很高兴这么多年后它们依然存在于 Emacs 中。我想知道时至今日,类似这些的玩意是否还会再纳入 Emacs 的代码库中;嗯,它们很可能不会——它们将被归入包管理仓库中,而在这个干净而无菌的世界中,它们无疑属于包管理仓库。 + +Emacs 要求将对 Emacs 体验不重要的内容转移到包管理仓库 ELPA 中。我的意思是,作为一个开发者,这是有道理的,但是……对于每一个被移出并流放到 ELPA 的包,我们是不是在蚕食 Emacs 的精髓? + +-------------------------------------------------------------------------------- + + +via: https://www.masteringemacs.org/article/fun-games-in-emacs + +作者:[Mickey Petersen][a] +选题:[lujun9972][b] +译者:[lujun9972](https://github.com/lujun9972) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:https://www.masteringemacs.org/about +[b]:https://github.com/lujun9972 +[1]:https://en.wikipedia.org/wiki/Office_Space +[2]:https://en.wikipedia.org/wiki/Tower_of_Hanoi +[3]:https://www.masteringemacs.org/article/fun-emacs-calc +[4]:http://www.xkcd.com +[5]:https://en.wikipedia.org/wiki/Battleship_(game) +[6]:https://www.masteringemacs.org/article/evaluating-elisp-emacs +[7]:https://en.wikipedia.org/wiki/ELIZA +[8]:https://en.wikipedia.org/wiki/Conway's_Game_of_Life diff --git a/published/202003/20180306 Exploring free and open web fonts.md b/published/202003/20180306 Exploring free and open web fonts.md new file mode 100644 index 0000000000..3e688cbd35 --- /dev/null +++ b/published/202003/20180306 Exploring free and open web fonts.md @@ -0,0 +1,71 @@ +探索自由而开放的 Web 字体 +====== + +> 谷歌字体和开放字体库中的免费 Web 字体已经改变了游戏规则,但仅在有限的范围内。 + +![](https://img.linux.net.cn/data/attachment/album/202003/08/174910xoklikblgkkbooib.jpg) + +毫无疑问,近些年来互联网的面貌已经被开源字体所改变。早在 2010 年之前,你在 Web 浏览器上几乎只能看到微软制作的通常“Web 安全”的[核心字体][1]。但这一年(2010)正好是好几轮技术革新开始的见证之年:[Web 开放字体格式][2]Web Open Font Format(WOFF)的引入为通过 HTTP 有效地传输字体文件提供了一个开放的标准,以及像[谷歌字体][3]和[开放字体库][4]Open Font Library这样的 Web 字体服务的推出,使得 Web 内容发布者可以在开源许可证之下免费使用海量的字体库。 + +这些事件对 Web 排版的积极影响再夸大都不过分。但是要将 Web 开放字体的成功与整个开源排版等同起来,并得到结论——挑战已经远离了我们,困难悉数被解决了——却很容易。然而事实并非如此,如果你很关注字体,那么好消息是你有好多机会参与到对这些字体的改进工作当中去。 + +对新手来说,至关重要的是必须要意识到谷歌字体和开放字体库提供了专用的服务(为网页提供字体),而没有为其他使用情况制定字体解决方案。这不是服务方面的缺点,这只是意味着我们必须去开发其它的解决方案。 + +需要解决的问题还非常多。可能最明显的例子就是给 Linux 桌面计算机的其他软件安装字体所遇到的尴尬情况。你可以通过任何一种服务下载任何一种 Web 字体,但是你得到的只是一个最普通的压缩包文件,里面有一些 TTF 或 OTF 二进制文件和一个普通文本文件的许可证。接下来会发生什么完完全全需要你去猜。 + +大部分用户很快学会了“正确”的步骤就是手动地复制这些字体二进制文件到他们硬盘里几个特殊文件夹里的某一个里。但是这样做只能使这个文件对操作系统可见。它并不能为用户体验带来什么提升。再强调一遍,这不是 Web 字体服务的缺陷,相反它佐证了对于关于服务到哪里停止和需要在其他方面做更多工作的观点。 + +在用户视角来说,一个巨大的提升可能就是在“只是下载”这个阶段,操作系统或者桌面环境变得更智能。系统或桌面环境不仅会把字体文件安装到正确的位置上,更重要的是,当用户选择要在一个项目中使用的字体时,它会自己添加用户所需要的重要的元数据。 + +这些附加信息包含的内容与它如何呈现给用户与另一个挑战有关:与其它操作系统相比,在 Linux 环境管理一个字体库显然不那么令人满意。字体管理器总是时不时的出现一下(例如 [GTK+ 字体管理器][5],这是最近的一个例子),但是它们很少变得流行起来。我一直在思考一大堆这些软件让人失望的方面。一个核心的原因是它们把自己局限于只展示内嵌在二进制字体文件内的信息:基本字符集的覆盖、粗细/宽度和斜率的设定,内置的许可证和版权说明等等。 + +但是除了这些内嵌数据中的内容,在选择字体的过程中还涉及很多决策。严肃的字体用户,像信息设计者、杂志文章作者,或者书籍美工设计者,他们的字体选择是根据每一份文件的要求和需求做出的。这当然包含了许可证信息,但它还包含了更多,像关于设计师和厂商的信息、潮流风格的趋势,或者字体在使用中的细节。 + +举个例子,如果你的文档包含了英语和阿拉伯文,你多半想要拉丁文和阿拉伯文的字体由同时熟悉这两种字母系统script的设计师所设计。否则,你将浪费一大堆时间来微调字体大小和行间距来使两种字母系统良好地结合在一起。你可能从经验中学到,某些设计师或字体厂商比其他人更善于多种字母系统设计。或许和你职业相关的是今天的时尚杂志几乎无一例外的采用 “[Didone][6]”风格的字体,“[Didone][6]”是指一种两百多年前最先被 [Firmin Didot][7] 和 [Giambattista Bodoni][8] 设计出来的超高反差的字体风格。这种字体恰好就是现在的潮流。 + +但是像 Didone、Didot 或 Bodoni 这些术语都不可能会出现在二进制文件的内置数据当中,你也不容易判断拉丁文和阿拉伯文是否相得益彰或其它关于字体的历史背景。这些信息有可能出现在补充的材料中,类似某种字形样本或字体文件中,如果这些东西存在的话。 + +字形样本specimen是一份设计好的文档(一般是 PDF),它展示了这种字体的使用情况,而且包括了背景信息。字形样本经常在挑选字体时充当市场营销和外观样例的双重角色。一份精心设计的样本展示了字体在实际应用中的情况和在自动生成的字符表中所不能体现的风格。字形样本文件也有可能包含了一些其他重要信息,比如怎样激活字体的 OpenType 特性、提供的数学表达式或古体字,或者它在支持的多种语言上的风格变化。在字体管理应用程序中向用户提供此类材料,对于帮助用户找到适合其项目需求的字体将大有帮助。 + +当然,如果我们希望一个字体管理软件能够处理文件和样本问题,我们也必须仔细观察一下各种发行版提供的字体包所随附的内容。Linux 的用户刚开始只有自动安装的那几种字体,并且发行版存储库提供的包是大部分用户除了下载通用的压缩包档案之外的唯一字体来源。这些包往往非常的“简陋”。商业字体总的来说都包含了样本、文档,还有其他的支持项目,然而开源字体往往没有这些配套文件。 + +也有一些优秀的开放字体提供了高质量的样本和文档(例如 [SIL Gentium][9] 和 [Bungee][10] 是两种差异明显但是都有效的方案),但是它们几乎不涉足下游的打包工作链。我们显然可以做的更好一些。 + +要在系统的字体交互方面提供更丰富的用户体验上面还存在一些技术问题。一方面,[AppStream][11] 的元数据标准定义了一些字体文件特有的参数,但是到现在为止,这些参数没有包含样本、设计师/厂商和其他相关细节的任何信息。另外一个例子,[SPDX][13](软件包数据交换Software Package Data Exchange)格式也没有包含太多用于分发字体的软件许可证(及许可证变体)。 + +最后,就像任何一个唱片爱好者都会告诉你的,一个不允许你编辑和完善你的 MP3 曲库中的 ID3 信息的音乐播放器很快就会变得令人失望(LCTT 译注:ID3 信息是 MP3 文件头部的元信息,用于存储歌曲信息)。你想要处理标签里的错误、想要添加注释和专辑封面之类的信息,本质上,这就是完善你的音乐库。同样,你可能也想要让你的本地字体库也保持在一个方便使用的状态。 + +但是改动字体文件的内置数据一直有所忌讳,因为字体往往是被内置或附加到其他文件里的。如果你随意改变了字体二进制文件中的字段,然后将其与你的演示文稿一起重新分发,那么下载这些演示文稿的任何人最终都会得到错误的元数据,但这个错误不是他们自己造成的。所以任何一个要改善字体管理体验的人都要想明白如何从策略上解决对内置或外置的字体元数据的重复修改。 + +除了技术角度之外,丰富的字体管理经验也是一项设计挑战。就像我在前面说的一样,有几种开放字体也带了良好的样本和精心编写的文档。但是更多的字体包这两者都没有,还有大量的更老的字体包已经没有人维护了。这很可能意味着大部分开放字体包想要获得样本和证明文件的唯一办法就是让社区去创建它们。 + +也许这是一个很高的要求。但是开源设计社区现在比以往任何时候都要庞大,它是整个自由开源软件运动中的一个高度活跃的组成部分。所以谁知道呢,也许明年这个时候会发现,在 Linux 桌面系统查找、下载和使用字体会变成一种完全不同的体验。 + +在这一连串关于现代 Linux 用户的文字设计上的挑战的思考中包含了打包、文档设计,甚至有可能需要在桌面环境加入不少新的软件部分。此外还有其他一系列的东西也需要考虑。其共通性就是在 Web 字体服务不可及的地方,事情就会变得更加困难。 + +从我的视角来看,最好的消息是现在比起以前有更多的人对这个话题感兴趣。我认为我们要感谢像谷歌字体和开放字体库这样的 Web 字体服务巨头让开放字体得到了更高的关注。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/18/3/webfonts + +作者:[Nathan Willis][a] +译者:[Fisherman110](https://github.com/Fisherman110) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:https://opensource.com/users/n8willis +[1]:https://en.wikipedia.org/wiki/Core_fonts_for_the_Web +[2]:https://en.wikipedia.org/wiki/Web_Open_Font_Format +[3]:https://fonts.google.com/ +[4]:https://fontlibrary.org/ +[5]:https://fontmanager.github.io/ +[6]:https://en.wikipedia.org/wiki/Didone_(typography) +[7]:https://en.wikipedia.org/wiki/Firmin_Didot +[8]:https://en.wikipedia.org/wiki/Giambattista_Bodoni +[9]:https://software.sil.org/gentium/ +[10]:https://djr.com/bungee/ +[11]:https://www.freedesktop.org/wiki/Distributions/AppStream/ +[12]:https://www.freedesktop.org/software/appstream/docs/sect-Metadata-Fonts.html +[13]:https://spdx.org/ diff --git a/published/202003/20180522 Advanced use of the less text file viewer in Linux.md b/published/202003/20180522 Advanced use of the less text file viewer in Linux.md new file mode 100644 index 0000000000..399f0d05b8 --- /dev/null +++ b/published/202003/20180522 Advanced use of the less text file viewer in Linux.md @@ -0,0 +1,109 @@ +你所不知道的用 less 查看文件的高级用法 +====== + +> 使用 less 文件查看器的一些技巧。 + +![](https://img.linux.net.cn/data/attachment/album/202003/16/152826assmtybsohopo4b7.png) + +最近,我正在拜读 Scott Nesbitt 的文章《[在 Linux 命令行中使用 less 来查看文本文件][1]》,并受到了一些启发,所以我想分享一些使用 `less` 命令的技巧。 + +### LESS 环境变量 + +如果你定义了环境变量 `LESS`(例如在 `.bashrc` 中),那么 `less` 会将其视为一个选项列表,就像在命令行中传递给它一样。 + +我这样定义: + +``` +LESS='-C -M -I -j 10 -# 4' +``` + +它的意思是: + +* `-C` – 通过不从底部滚动来加快全屏打印速度。 +* `-M` – 在最后一行(状态行)显示更多信息。你可以使用 `-PM` 来自定义显示的信息,但我通常只用 `-M`。 +* `-I` – 忽略搜索中的大小写。 +* `-j 10` – 在终端的第 10 行而不是第一行显示搜索结果。这样,每次按 `n` 或(`N`) 跳到下一个(或上一个)匹配项时,就会有 10 条上下文。 +* `-# 4` – 当按下向右或向左的箭头时,会向右或向左跳四个字符。默认情况时跳转半个屏幕,我觉得太多了。一般来说,`less` 似乎(至少部分)是按最初开发它时的环境优化的,那时使用慢速调制解调器和低带宽的互联网连接,所以跳过半个屏幕是有意义的。 + +### PAGER 环境变量 + +许多程序使用在 `PAGER` 环境变量中的命令来显示信息。因此,你可以在 `.bashrc` 中设置 `PAGER=less`,然后让程序运行 `less`。查看手册页(`man 7 environ`)中是否有其它此类变量。 + +### -S + +`-S` 告诉 `less` 将长行切断而不是将它们换行。除非我在(或我要)查看文件,否则我很少需要这样做。幸运的是,你可以在 `less` 中输入所有命令行选项,就像它们是键盘命令一样。因此,如果我想在文件已经打开的情况下隔断长行,我可以简单地输入 `-S`。(LCTT 译注:注意大写 `S` ,并按回车) + +这是我经常使用的一个例子: + +``` +su - postgres +export PAGER=less  # 因为我不用在所有的机器上编辑 postgres 的 .bashrc +psql +``` + +有时当我查看一个 `SELECT` 命令的输出非常宽时,我会输入 `-S` 以便将其格式化的漂亮一些。如果当我按下右箭头想查看更多内容时它跳得太远(因为我没有设置 `-#`),则可以输入 `-#8`,那么每次按下右箭头都会向右移动八个字符。 + +有时在多次输入 `-S` 之后,我会退出 psql 并设置环境变量后再次运行它: + +``` +export LESS=-S +``` + +### F + +命令 `F` 可以使 `less` 像 `tail -f` 一样工作,等待更多的数据被添加到文件后再显示它们。与 `tail -f` 相比,它的一个优点是,高亮显示搜索匹配仍然有效。因此,你可以输入 `less /var/log/logfile`,搜索某些内容时,它将高亮显示所有出现的内容(除非你使用了 `-g`),然后按下 `F` 键,当更多数据写入到日志时,`less` 将显示它并高亮新的匹配项。 + +按下 `F` 后,可以按 `Ctrl+C` 来停止其查找新数据(这不会干掉它),这样你可以返回文件查看旧内容,搜索其它内容等,然后再次按 `F` 键来查看更多新数据。 + +### 搜索 + +搜索使用系统的正则表达式库,这通常意味着你可以使用扩展正则表达式。特别是,搜索 `one|two|three` 可以找到并高亮所有的 one、two 或 three。 + +我经常使用的另一种模式是 `.*someting.*`,特别是对于一些很长的日志行(例如,跨越多个终端宽度的行),它会高亮整行。这种模式使查看一行的起始和结束位置变得更加容易。我还会结合其它内容,例如 `.*one thing.*|.*another thing.*`,或者使用 `key: .*|.*marker.*` 来查看 `key` 的内容。例如,一个日志文件中包含一些字典/哈希的转储。它会高亮相关的标记行,这样我就看到上下文了,甚至,如果我知道这个值被引号引起来的话,就可以: + +``` +key: '[^']*'|.*marker.* +``` + +`less` 会保留你的搜索项的历史纪录,并将其保存到磁盘中以备将来调用。当你按下 `/` 或 `?` 时,可以使用向上或向下箭头浏览历史记录(以及进行基本的行编辑)。 + +在撰写本文时,我无意间看了下 `less` 手册页,发现了一个非常有用的功能:使用 `&!pattern` 跳过无关的行。例如,当我在 `/var/log/messages` 中寻找内容时,经常会一个个迭代使用以下命令: + +``` +cat /var/log/messages | egrep -v 'systemd: Started Session' | less +cat /var/log/messages | egrep -v 'systemd: Started Session|systemd: Starting Session' | less +cat /var/log/messages | egrep -v 'systemd: Started Session|systemd: Starting Session|User Slice' | less +cat /var/log/messages | egrep -v 'systemd: Started Session|systemd: Starting Session|User Slice|dbus' | less +cat /var/log/messages | egrep -v 'systemd: Started Session|systemd: Starting Session|User Slice|dbus|PackageKit Daemon' | less +``` + +但是现在我知道如何在 `less` 中做同样的事情。例如,我可以输入 `&!systemd: Started Session`,然后想要隐藏 `systemd: Starting Session`,所以我输入 `&!`,并使用向上箭头从历史记录中获得上一次搜索的结果。然后我接着输入 `|systemd: Starting Session` 并按下回车,继续以相同的方式添加更多条目,直到我过滤掉足够多的条目,看到更有趣的内容。 + +### = + +命令 `=` 显示有关文件和位置的更多信息,甚至比 `-M` 更多。如果文件非常大,计算 `=` 花费的时间太长,可以按下 `Ctrl+C`,它将停止尝试计算。 + +如果你正在查看的内容来自管道而不是文件,则 `=`(和 `-M`)不会显示未知内容,包括文件中的行数和字节数。要查看这些数据,如果你知道管道命令将很快结束,则可以使用 `G` 跳到最后,然后 `less` 将开始显示这些信息。 + +如果按下 `G` 并且写入管道的命令花费的时间比预期的长,你可以按下 `Ctrl+C`,该命令将被终止。即使你没有按 `G`,`Ctrl+C` 键也会杀死它。因此,如果你不想终止命令,请不要意外按下 `Ctrl+C`。出于这个原因,如果命令执行了某些操作(不仅是显示信息),通常更安全的做法是将其输出写入文件并在单独的终端中查看文件,而不是使用管道。 + +### 为什么你需要 less + +`less` 是一个非常强大的程序,与该领域中较新的竞争者(例如 `most` 和 `moar`)不同,你可能会在几乎所有的系统上找到它,就像 `vi` 一样。因此,即使你使用 GUI 查看器或编辑器,花一些时间浏览 `less` 手册页也是值得的,至少可以了解一下它的用处。这样,当你需要做一些已有的功能可能提供的工作时,就会知道如何要搜索手册页或互联网来找到所需的内容。 + +有关更多信息,访问 [less 主页][2]。该网站有一个不错的常见问题解答,其中包含更多提示和技巧。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/18/5/advanced-use-less-text-file-viewer + +作者:[Yedidyah Bar David][a] +选题:[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/) 荣誉推出 + +[a]:https://opensource.com/users/didib +[1]:http://opensource.com/article/18/4/using-less-view-text-files-command-line +[2]:http://www.greenwoodsoftware.com/less/ diff --git a/sources/tech/20180708 Building a Messenger App- Conversations.md b/published/202003/20180708 Building a Messenger App- Conversations.md similarity index 60% rename from sources/tech/20180708 Building a Messenger App- Conversations.md rename to published/202003/20180708 Building a Messenger App- Conversations.md index 1a5c7d251a..722383745d 100644 --- a/sources/tech/20180708 Building a Messenger App- Conversations.md +++ b/published/202003/20180708 Building a Messenger App- Conversations.md @@ -1,41 +1,41 @@ [#]: collector: (lujun9972) [#]: translator: (PsiACE) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12056-1.html) [#]: subject: (Building a Messenger App: Conversations) [#]: via: (https://nicolasparada.netlify.com/posts/go-messenger-conversations/) [#]: author: (Nicolás Parada https://nicolasparada.netlify.com/) -Building a Messenger App: Conversations +构建一个即时消息应用(三):对话 ====== -This post is the 3rd in a series: +![](https://img.linux.net.cn/data/attachment/album/202003/30/193824w7xsj2ixs8frsal8.jpg) - * [Part 1: Schema][1] - * [Part 2: OAuth][2] +本文是该系列的第三篇。 +* [第一篇:模式][1] +* [第二篇:OAuth][2] +在我们的即时消息应用中,消息表现为两个参与者对话的堆叠。如果你想要开始一场对话,就应该向应用提供你想要交谈的用户,而当对话创建后(如果该对话此前并不存在),就可以向该对话发送消息。 -In our messenger app, messages are stacked by conversations between two participants. You start a conversation providing the user you want to chat with, the conversations is created (if not exists already) and you can start sending messages to that conversations. +就前端而言,我们可能想要显示一份近期对话列表。并在此处显示对话的最后一条消息以及另一个参与者的姓名和头像。 -On the front-end we’re interested in showing a list of the lastest conversations. There we’ll show the last message of it and the name and avatar of the other participant. +在这篇帖子中,我们将会编写一些端点endpoint来完成像“创建对话”、“获取对话列表”以及“找到单个对话”这样的任务。 -In this post, we’ll code the endpoints to start a conversation, list the latest and find a single one. +首先,要在主函数 `main()` 中添加下面的路由。 -Inside the `main()` function add this routes. - -``` +```go router.HandleFunc("POST", "/api/conversations", requireJSON(guard(createConversation))) router.HandleFunc("GET", "/api/conversations", guard(getConversations)) router.HandleFunc("GET", "/api/conversations/:conversationID", guard(getConversation)) ``` -These three endpoints require authentication so we use the `guard()` middleware. There is a new middleware that checks for the request content type JSON. +这三个端点都需要进行身份验证,所以我们将会使用 `guard()` 中间件。我们也会构建一个新的中间件,用于检查请求内容是否为 JSON 格式。 -### Require JSON Middleware +### JSON 请求检查中间件 -``` +```go func requireJSON(handler http.HandlerFunc) http.HandlerFunc { return func(w http.ResponseWriter, r *http.Request) { if ct := r.Header.Get("Content-Type"); !strings.HasPrefix(ct, "application/json") { @@ -47,11 +47,11 @@ func requireJSON(handler http.HandlerFunc) http.HandlerFunc { } ``` -If the request isn’t JSON, it responds with a `415 Unsupported Media Type` error. +如果请求request不是 JSON 格式,那么它会返回 `415 Unsupported Media Type`(不支持的媒体类型)错误。 -### Create Conversation +### 创建对话 -``` +```go type Conversation struct { ID string `json:"id"` OtherParticipant *User `json:"otherParticipant"` @@ -60,9 +60,9 @@ type Conversation struct { } ``` -So, a conversation holds a reference to the other participant and the last message. Also has a bool field to tell if it has unread messages. +就像上面的代码那样,对话中保持对另一个参与者和最后一条消息的引用,还有一个 `bool` 类型的字段,用来告知是否有未读消息。 -``` +```go type Message struct { ID string `json:"id"` Content string `json:"content"` @@ -74,11 +74,11 @@ type Message struct { } ``` -Messages are for the next post, but I define the struct now since we are using it. Most of the fields are the same as the database table. We have `Mine` to tell if the message is owned by the current authenticated user and `ReceiverID` will be used to filter messanges once we add realtime capabilities. +我们会在下一篇文章介绍与消息相关的内容,但由于我们这里也需要用到它,所以先定义了 `Message` 结构体。其中大多数字段与数据库表一致。我们需要使用 `Mine` 来断定消息是否属于当前已验证用户所有。一旦加入实时功能,`ReceiverID` 可以帮助我们过滤消息。 -Lets write the HTTP handler then. It’s quite long but don’t be scared. +接下来让我们编写 HTTP 处理程序。尽管它有些长,但也没什么好怕的。 -``` +```go func createConversation(w http.ResponseWriter, r *http.Request) { var input struct { Username string `json:"username"` @@ -170,19 +170,19 @@ func createConversation(w http.ResponseWriter, r *http.Request) { } ``` -For this endpoint you do a POST request to `/api/conversations` with a JSON body containing the username of the user you want to chat with. +在此端点,你会向 `/api/conversations` 发送 POST 请求,请求的 JSON 主体中包含要对话的用户的用户名。 -So first it decodes the request body into an struct with the username. Then it validates that the username is not empty. +因此,首先需要将请求主体解析成包含用户名的结构。然后,校验用户名不能为空。 -``` +```go type Errors struct { Errors map[string]string `json:"errors"` } ``` -This is the `Errors` struct. It’s just a map. If you enter an empty username you get this JSON with a `422 Unprocessable Entity` error. +这是错误消息的结构体 `Errors`,它仅仅是一个映射。如果输入空用户名,你就会得到一段带有 `422 Unprocessable Entity`(无法处理的实体)错误消息的 JSON 。 -``` +```json { "errors": { "username": "Username required" @@ -190,17 +190,17 @@ This is the `Errors` struct. It’s just a map. If you enter an empty username y } ``` -Then, we begin an SQL transaction. We only received an username, but we need the actual user ID. So the first part of the transaction is to query for the id and avatar of that user (the other participant). If the user is not found, we respond with a `404 Not Found` error. Also, if the user happens to be the same as the current authenticated user, we respond with `403 Forbidden`. There should be two different users, not the same. +然后,我们开始执行 SQL 事务。收到的仅仅是用户名,但事实上,我们需要知道实际的用户 ID 。因此,事务的第一项内容是查询另一个参与者的 ID 和头像。如果找不到该用户,我们将会返回 `404 Not Found`(未找到) 错误。另外,如果找到的用户恰好和“当前已验证用户”相同,我们应该返回 `403 Forbidden`(拒绝处理)错误。这是由于对话只应当在两个不同的用户之间发起,而不能是同一个。 -Then, we try to find a conversation those two users have in common. We use `INTERSECT` for that. If there is one, we redirect to that conversation `/api/conversations/{conversationID}` and return there. +然后,我们试图找到这两个用户所共有的对话,所以需要使用 `INTERSECT` 语句。如果存在,只需要通过 `/api/conversations/{conversationID}` 重定向到该对话并将其返回。 -If no common conversation was found, we continue by creating a new one and adding the two participants. Finally, we `COMMIT` the transaction and respond with the newly created conversation. +如果未找到共有的对话,我们需要创建一个新的对话并添加指定的两个参与者。最后,我们 `COMMIT` 该事务并使用新创建的对话进行响应。 -### Get Conversations +### 获取对话列表 -This endpoint `/api/conversations` is to get all the conversations of the current authenticated user. +端点 `/api/conversations` 将获取当前已验证用户的所有对话。 -``` +```go func getConversations(w http.ResponseWriter, r *http.Request) { ctx := r.Context() authUserID := ctx.Value(keyAuthUserID).(string) @@ -267,17 +267,17 @@ func getConversations(w http.ResponseWriter, r *http.Request) { } ``` -This handler just does a query to the database. It queries to the conversations table with some joins… First, to the messages table to get the last message. Then to the participants, but it adds a condition to a participant whose ID is not the one of the current authenticated user; this is the other participant. Then it joins to the users table to get his username and avatar. And finally joins with the participants again but with the contrary condition, so this participant is the current authenticated user. We compare `messages_read_at` with the message `created_at` to know whether the conversation has unread messages. And we use the message `user_id` to check if it’s “mine” or not. +该处理程序仅对数据库进行查询。它通过一些联接来查询对话表……首先,从消息表中获取最后一条消息。然后依据“ID 与当前已验证用户不同”的条件,从参与者表找到对话的另一个参与者。然后联接到用户表以获取该用户的用户名和头像。最后,再次联接参与者表,并以相反的条件从该表中找出参与对话的另一个用户,其实就是当前已验证用户。我们会对比消息中的 `messages_read_at` 和 `created_at` 两个字段,以确定对话中是否存在未读消息。然后,我们通过 `user_id` 字段来判定该消息是否属于“我”(指当前已验证用户)。 -Note that this query assumes that a conversation has just two users. It only works for that scenario. Also, if you want to show a count of the unread messages, this design isn’t good. I think you could add a `unread_messages_count` `INT` field on the `participants` table and increment it each time a new message is created and reset it when the user read them. +注意,此查询过程假定对话中只有两个用户参与,它也仅仅适用于这种情况。另外,该设计也不很适用于需要显示未读消息数量的情况。如果需要显示未读消息的数量,我认为可以在 `participants` 表上添加一个`unread_messages_count` `INT` 字段,并在每次创建新消息的时候递增它,如果用户已读则重置该字段。 -Then it iterates over the rows, scan each one to make an slice of conversations and respond with those at the end. +接下来需要遍历每一条记录,通过扫描每一个存在的对话来建立一个对话切片slice of conversations并在最后进行响应。 -### Get Conversation +### 找到单个对话 -This endpoint `/api/conversations/{conversationID}` respond with a single conversation by its ID. +端点 `/api/conversations/{conversationID}` 会根据 ID 对单个对话进行响应。 -``` +```go func getConversation(w http.ResponseWriter, r *http.Request) { ctx := r.Context() authUserID := ctx.Value(keyAuthUserID).(string) @@ -321,17 +321,17 @@ func getConversation(w http.ResponseWriter, r *http.Request) { } ``` -The query is quite similar. We’re not interested in showing the last message, so we omit those fields, but we need the message to know whether the conversation has unread messages. This time we do a `LEFT JOIN` instead of an `INNER JOIN` because the `last_message_id` is `NULLABLE`; in other case we won’t get any rows. We use an `IFNULL` in the `has_unread_messages` comparison for that reason too. Lastly, we filter by ID. +这里的查询与之前有点类似。尽管我们并不关心最后一条消息的显示问题,并因此忽略了与之相关的一些字段,但是我们需要根据这条消息来判断对话中是否存在未读消息。此时,我们使用 `LEFT JOIN` 来代替 `INNER JOIN`,因为 `last_message_id` 字段是 `NULLABLE`(可以为空)的;而其他情况下,我们无法得到任何记录。基于同样的理由,我们在 `has_unread_messages` 的比较中使用了 `IFNULL` 语句。最后,我们按 ID 进行过滤。 -If the query returns no rows, we respond with a `404 Not Found` error, otherwise `200 OK` with the found conversation. +如果查询没有返回任何记录,我们的响应会返回 `404 Not Found` 错误,否则响应将会返回 `200 OK` 以及找到的对话。 * * * -Yeah, that concludes with the conversation endpoints. +本篇帖子以创建了一些对话端点结束。 -Wait for the next post to create and list messages 👋 +在下一篇帖子中,我们将会看到如何创建并列出消息。 -[Souce Code][3] +- [源代码][3] -------------------------------------------------------------------------------- @@ -340,12 +340,12 @@ via: https://nicolasparada.netlify.com/posts/go-messenger-conversations/ 作者:[Nicolás Parada][a] 选题:[lujun9972][b] 译者:[PsiACE](https://github.com/PsiACE) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 [a]: https://nicolasparada.netlify.com/ [b]: https://github.com/lujun9972 -[1]: https://nicolasparada.netlify.com/posts/go-messenger-schema/ -[2]: https://nicolasparada.netlify.com/posts/go-messenger-oauth/ +[1]: https://linux.cn/article-11396-1.html +[2]: https://linux.cn/article-11510-1.html [3]: https://github.com/nicolasparada/go-messenger-demo diff --git a/sources/tech/20181231 Troubleshooting hardware problems in Linux.md b/published/202003/20181231 Troubleshooting hardware problems in Linux.md similarity index 91% rename from sources/tech/20181231 Troubleshooting hardware problems in Linux.md rename to published/202003/20181231 Troubleshooting hardware problems in Linux.md index eee2160639..34dbed5f44 100644 --- a/sources/tech/20181231 Troubleshooting hardware problems in Linux.md +++ b/published/202003/20181231 Troubleshooting hardware problems in Linux.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (wxy) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11953-1.html) [#]: subject: (Troubleshooting hardware problems in Linux) [#]: via: (https://opensource.com/article/18/12/troubleshooting-hardware-problems-linux) [#]: author: (Daniel Oh https://opensource.com/users/daniel-oh) @@ -12,11 +12,11 @@ Linux 硬件故障排除指南 > 了解是什么原因导致你的 Linux 硬件发生故障,以便你可以将其恢复并快速运行。 -![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/rh_003499_01_other11x_cc.png?itok=I_kCDYj0) +![](https://img.linux.net.cn/data/attachment/album/202003/03/101312zcazy02wl2g8uhy1.jpg) -[Linux 服务器][1]在物理机、虚拟化、私有云、公共云和混合云等许多不同种类的基础设施中运行着关键的业务应用程序。对于 Linux 系统管理员来说,了解如何管理 Linux 硬件基础设施(包括与 [网络][2]、存储、Linux 容器相关的软件定义的功能)和 Linux 服务器上的多种工具非常重要。 +[Linux 服务器][1]在物理机、虚拟化、私有云、公共云和混合云等许多不同种类的基础设施中运行着关键的业务应用程序。对于 Linux 系统管理员来说,了解如何管理 Linux 硬件基础设施(包括与 [网络][2]、存储、Linux 容器相关的软件定义功能)和 Linux 服务器上的多种工具非常重要。 -在 Linux 上进行故障排除和解决与硬件相关的问题可能需要一些时间。即使是经验丰富的系统管理员,有时也会花费数小时来解决神秘的硬件和软件差异。 +在 Linux 上进行排除和解决与硬件相关的问题可能需要一些时间。即使是经验丰富的系统管理员,有时也会花费数小时来解决神秘的硬件和软件差异。 以下提示可以使你更快、更轻松地对 Linux 中的硬件进行故障排除。许多不同的事情都可能导致 Linux 硬件出现问题。在开始诊断它们之前,明智的做法是了解最常见的问题以及最有可能找到问题的地方。 @@ -54,7 +54,7 @@ xvdb    202:16   0  20G  0 disk .... ``` -### 深入到多个日志当中 +### 深入到各个日志当中 使用 `dmesg` 可以找出内核最新消息中的错误和警告。例如,这是 `dmesg | more` 命令的输出: @@ -93,7 +93,7 @@ Dec  1 13:21:33 bastion dnsmasq[30201]: using nameserver 127.0.0.1#53 for domai ### 分析网络功能 -你可能有成千上万的云原生应用程序在一个复杂的网络环境中为业务提供服务。其中可能包括虚拟化、多云和混合云。这意味着,作为故障排除的一部分,你应该分析网络连接是否正常工作。弄清 Linux 服务器中网络功能的有用命令包括:`ip addr`、`traceroute`、`nslookup`、`dig` 和 `ping` 等。例如,这是 `ip addr show` 命令的输出: +你可能有成千上万的云原生应用程序在一个复杂的网络环境中为业务提供服务,其中可能包括虚拟化、多云和混合云。这意味着,作为故障排除的一部分,你应该分析网络连接是否正常工作。弄清 Linux 服务器中网络功能的有用命令包括:`ip addr`、`traceroute`、`nslookup`、`dig` 和 `ping` 等。例如,这是 `ip addr show` 命令的输出: ``` # ip addr show @@ -129,7 +129,7 @@ via: https://opensource.com/article/18/12/troubleshooting-hardware-problems-linu 作者:[Daniel Oh][a] 选题:[lujun9972][b] 译者:[wxy](https://github.com/wxy) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 diff --git a/published/202003/20190113 Editing Subtitles in Linux.md b/published/202003/20190113 Editing Subtitles in Linux.md new file mode 100644 index 0000000000..fe3a66da99 --- /dev/null +++ b/published/202003/20190113 Editing Subtitles in Linux.md @@ -0,0 +1,235 @@ +[#]: collector: (lujun9972) +[#]: translator: (chenmu-kk) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11946-1.html) +[#]: subject: (Editing Subtitles in Linux) +[#]: via: (https://itsfoss.com/editing-subtitles) +[#]: author: (Shirish https://itsfoss.com/author/shirish/) + +如何在 Linux 中编辑字幕 +====== + +我作为一位世界电影和地区电影爱好者已经几十年了。这期间字幕是一个必不可少的工具,它可以使我享受来自不同国家不同语言的优秀电影。 + +如果你喜欢观看带有字幕的电影,你可能会注意到有时字幕并不同步或者说并不正确。 + +你知道你可以自己编写字幕并使得它们更完美吗?让我们向你展示一些 Linux 中的基本字幕编辑吧。 + +![Editing subtitles in Linux][1] + +### 从闭路字幕数据中提取字幕 + +大概在 2012、2013 年我开始了解到有一款叫做 [CCEextractor][2] 的工具。随着时间的推移,它已经成为我必不可少的工具之一,尤其是当我偶然发现一份内含有字幕的媒体文件。 + +CCExtractor 负责解析视频文件以及从闭路字幕closed captions数据中产生独立的字幕文件。 + +CCExtractor 是一个跨平台的、自由开源工具。自它形成的那年起该工具已经成熟了不少而如今已成为 [GSOC][3] 和谷歌编码输入的一部分。 + +简单来说,这个工具基本上是一系列脚本,这些脚本以一种顺序方式一个接着一个地给你提供提取到的字幕。 + +你可以按照[本页][5]的 CCExtractor 安装指南进行操作。 + +若安装后你想从媒体文件中提取字幕,请按以下步骤操作: + +``` +ccextractor +``` + +该命令将会输出以下内容: + +``` +$ ccextractor $something.mkv +CCExtractor 0.87, Carlos Fernandez Sanz, Volker Quetschke. +Teletext portions taken from Petr Kutalek's telxcc +-------------------------------------------------------------------------- +Input: $something.mkv +[Extract: 1] [Stream mode: Autodetect] +[Program : Auto ] [Hauppage mode: No] [Use MythTV code: Auto] +[Timing mode: Auto] [Debug: No] [Buffer input: No] +[Use pic_order_cnt_lsb for H.264: No] [Print CC decoder traces: No] +[Target format: .srt] [Encoding: UTF-8] [Delay: 0] [Trim lines: No] +[Add font color data: Yes] [Add font typesetting: Yes] +[Convert case: No] [Video-edit join: No] +[Extraction start time: not set (from start)] +[Extraction end time: not set (to end)] +[Live stream: No] [Clock frequency: 90000] +[Teletext page: Autodetect] +[Start credits text: None] +[Quantisation-mode: CCExtractor's internal function] +----------------------------------------------------------------- +Opening file: $something.mkv +File seems to be a Matroska/WebM container +Analyzing data in Matroska mode + +Document type: matroska +Timecode scale: 1000000 +Muxing app: libebml v1.3.1 + libmatroska v1.4.2 +Writing app: mkvmerge v8.2.0 ('World of Adventure') 64bit +Title: $something + +Track entry: + Track number: 1 + UID: 1 + Type: video + Codec ID: V_MPEG4/ISO/AVC + Language: mal + Name: $something + +Track entry: + Track number: 2 + UID: 2 + Type: audio + Codec ID: A_MPEG/L3 + Language: mal + Name: $something + +Track entry: + Track number: 3 + UID: somenumber + Type: subtitle + Codec ID: S_TEXT/UTF8 + Name: $something + 99% | 144:34 +100% | 144:34 +Output file: $something_eng.srt +Done, processing time = 6 seconds +Issues? Open a ticket here +https://github.com/CCExtractor/ccextractor/issues +``` +它会大致浏览媒体文件。在这个例子中,它发现该媒体文件是马拉雅拉姆语言(mal)并且格式是 [.mkv][6]。之后它将字幕文件提取出来,命名为源文件名并添加“_eng”后缀。 + +CCExtractor 是一款用来增强字幕功能和字幕编辑的优秀工具,我将在下一部分对它进行介绍。 + +> 趣味阅读:在 [vicaps][7] 有一份有趣的字幕提要,它讲解和分享为何字幕对我们如此重要。对于那些对这类话题感兴趣的人来说,这里面也有许多电影制作的细节。 + +### 用 SubtitleEditor 工具编辑字幕 + +你大概意识到大多数的字幕都是 [.srt 格式][8] 的。这种格式的优点在于你可以将它加载到文本编辑器中并对它进行少量的修改。 + +当进入一个简单的文本编辑器时,一个 srt 文件看起来会是这个样子: + +``` +1 +00:00:00,959 --> 00:00:13,744 +"THE CABINET +OF DR. CALIGARI" + +2 +00:00:40,084 --> 00:01:02,088 +A TALE of the modern re-appearance of an 11th Century Myth +involting the strange and mysterious influence +of a mountebank monk over a somnambulist. +``` + +我分享的节选字幕来自于一部非常老的德国电影《[卡里加里博士的小屋][9]》(1920)。 + +Subtitleeditor 是一款非常棒的字幕编辑软件。字幕编辑器可以用来设置字幕持续时间、与多媒体文件同步的字幕帧率以及字幕间隔时间等等。接下来我将在这分享一些基本的字幕编辑。 + +![][10] + +首先,以安装 ccextractor 工具同样的方式安装 subtitleeditor 工具,使用你自己喜爱的安装方式。在 Debian 中,你可以使用命令: + +``` +sudo apt install subtitleeditor +``` + +当你安装完成后,让我们来看一下在你编辑字幕时一些常见的场景。 + +#### 调整帧率使其媒体文件同步 + +如果你发现字幕与视频不同步,一个原因可能是视频文件的帧率与字幕文件的帧率并不一致。 + +你如何得知这些文件的帧率呢,然后呢?为了获取视频文件的帧率,你可以使用 `mediainfo` 工具。首先你可能需要发行版的包管理器来安装它。 + +使用 `mediainfo` 非常简单: + +``` +$ mediainfo somefile.mkv | grep Frame + Format settings : CABAC / 4 Ref Frames + Format settings, ReFrames : 4 frames + Frame rate mode : Constant + Frame rate : 25.000 FPS + Bits/(Pixel*Frame) : 0.082 + Frame rate : 46.875 FPS (1024 SPF) +``` + +现在你可以看到视频文件的帧率是 25.000 FPS 。我们看到的另一个帧率则是音频文件的帧率。虽然我可以分享为何在视频解码和音频解码等地方会使用特定的 fps,但这将会是一个不同的主题,与它相关的历史信息有很多。 + +下一个问题是解决字幕文件的帧率,这个稍微有点复杂。 + +通常情况下,大多数字幕都是压缩格式的。将.zip 归档文件和字幕文件(以 XXX.srt 结尾)一起解压缩。除此之外,通常还会有一个同名的 .info 文件,该文件可能包含字幕的帧率。 + +如果不是,那么通常最好去某个站点并从具有该帧速率信息的站点下载字幕。对于这个特定的德文文件,我使用 [Opensubtitle.org][11] 来找到它。 + +正如你在链接中所看到的,字幕的帧率是 23.976 FPS 。很明显,它不能与帧率为 25.000 FPS 的视频文件一起很好地播放。 + +在这种情况下,你可以使用字幕编辑工具来改变字幕文件的帧率。 + +按下 `CTRL+A` 选择字幕文件中的全部内容。点击 “Timings -> Change Framerate” ,将 23.976 fps 改为 25.000 fps 或者你想要的其他帧率,保存已更改的文件。 + +![synchronize frame rates of subtitles in Linux][12] + +#### 改变字幕文件的起点 + +有时以上的方法就足够解决问题了,但有时候以上方法并不足够解决问题。 + +在帧率相同时,你可能会发现字幕文件的开头与电影或媒体文件中起点并不相同。 + +在这种情况下,请按以下步骤进行操作: + +按下 `CTRL+A` 键选中字幕文件的全部内容。点击 “Timings -> Select Move Subtitle” 。 + +![Move subtitles using Subtitle Editor on Linux][13] + +设定字幕文件的新起点,保存已更改的文件。 + +![Move subtitles using Subtitle Editor in Linux][14] + +如果你想要时间更精确一点,那么可以使用 [mpv][15] 来查看电影或者媒体文件并点击进度条(可以显示电影或者媒体文件的播放进度),它也会显示微秒。 + +通常我喜欢精准无误的操作,因此我会试着尽可能地仔细调节。相较于人类的反应时间来说,MPV 中的反应时间很精确。如果我想要极其精确的时间,那么我可以使用像 [Audacity][16] 之类的东西,但是那是另一种工具,你可以在上面做更多的事情。那也将会是我未来博客中将要探讨的东西。 + +#### 调整字幕间隔时间 + +有时,两种方法都采用了还不够,甚至你可能需要缩短或增加间隔时间以使其与媒体文件同步。这是较为繁琐的工作之一,因为你必须单独确定每个句子的间隔时间。尤其是在媒体文件中帧率可变的情况下(现已很少见,但你仍然会得到此类文件) + +在这种设想下,你可能因为无法实现自动编辑而不得不手动的修改间隔时间。最好的方式是修改视频文件(会降低视频质量)或者换另一个更高质量的片源,用你喜欢的设置对它进行[转码][17] 。这又是一重大任务,以后我会在我的一些博客文章上阐明。 + +### 总结 + +以上我分享的内容或多或少是对现有字幕文件的改进。如果从头开始,你需要花费大量的时间。我完全没有分享这一点,因为一部电影或一个小时内的任何视频材料都可以轻易地花费 4-6 个小时,甚至更多的时间,这取决于字幕员的技巧、耐心、上下文、行话、口音、是否是以英语为母语的人、翻译等,所有的这些都会对字幕的质量产生影响。 + +我希望自此以后你会觉得这件事很有趣,并将你的字幕处理的更好一点。如果你有其他想要补充的问题,请在下方留言。 + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/editing-subtitles + +作者:[Shirish][a] +选题:[lujun9972][b] +译者:[chenmu-kk](https://github.com/chenmu-kk) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://itsfoss.com/author/shirish/ +[b]: https://github.com/lujun9972 +[1]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/01/editing-subtitles-in-linux.jpeg?resize=800%2C450&ssl=1 +[2]: https://www.ccextractor.org/ +[3]: https://itsfoss.com/best-open-source-internships/ +[4]: https://www.ccextractor.org/public:codein:google_code-in_2018 +[5]: https://github.com/CCExtractor/ccextractor/wiki/Installation +[6]: https://en.wikipedia.org/wiki/Matroska +[7]: https://www.vicaps.com/blog/history-of-silent-movies-and-subtitles/ +[8]: https://en.wikipedia.org/wiki/SubRip#SubRip_text_file_format +[9]: https://www.imdb.com/title/tt0010323/ +[10]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2018/12/subtitleeditor.jpg?ssl=1 +[11]: https://www.opensubtitles.org/en/search/sublanguageid-eng/idmovie-4105 +[12]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/01/subtitleeditor-frame-rate-sync.jpg?resize=800%2C450&ssl=1 +[13]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/01/Move-subtitles-Caligiri.jpg?resize=800%2C450&ssl=1 +[14]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2019/01/move-subtitles.jpg?ssl=1 +[15]: https://itsfoss.com/mpv-video-player/ +[16]: https://www.audacityteam.org/ +[17]: https://en.wikipedia.org/wiki/Transcoding +[18]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/01/editing-subtitles-in-linux.jpeg?fit=800%2C450&ssl=1 diff --git a/published/202003/20190124 ffsend - Easily And Securely Share Files From Linux Command Line Using Firefox Send Client.md b/published/202003/20190124 ffsend - Easily And Securely Share Files From Linux Command Line Using Firefox Send Client.md new file mode 100644 index 0000000000..0663005ce5 --- /dev/null +++ b/published/202003/20190124 ffsend - Easily And Securely Share Files From Linux Command Line Using Firefox Send Client.md @@ -0,0 +1,283 @@ +[#]: collector: "lujun9972" +[#]: translator: "FSSlc" +[#]: reviewer: "wxy" +[#]: publisher: "wxy" +[#]: url: "https://linux.cn/article-12051-1.html" +[#]: subject: "ffsend – Easily And Securely Share Files From Linux Command Line Using Firefox Send Client" +[#]: via: "https://www.2daygeek.com/ffsend-securely-share-files-folders-from-linux-command-line-using-firefox-send-client/" +[#]: author: "Vinoth Kumar https://www.2daygeek.com/author/vinoth/" + +ffsend:在命令行中通过 FireFox Send 分享文件 +====== + +![](https://img.linux.net.cn/data/attachment/album/202003/29/202308w7ormrouomij2dzq.jpg) + +Linux 用户偏爱使用 `scp` 或 `rsync` 来进行文件或目录的复制拷贝。不过在 Linux 上正出现了许多新的可选方式,因为 Linux 是开源的,所以任何人都可以为 Linux 开发一个安全软件。 + +在过去我们已经写了多篇有关安全分享这个话题的文章,它们分别是 [OnionShare][1]、[Magic Wormhole][2]、[Transfer.sh][3] 和 [Dcp – Dat Copy][4]。 + +今天我们甚至还将继续讨论这个话题,我们将介绍名为 `ffsend` 的工具。 + +### ffsend 是什么? + +[ffsend][5] 是 Firefox Send 服务的一个命令行客户端,允许用户通过命令行来传递和接收文件或目录。 + +它允许我们通过一个安全、私密、加密的链接,使用一个简单的命令来轻易安全地分享文件和目录。 + +通过 Firefox 的 Send 服务共享的文件最大大小为 2GB(LCTT 译注:现在官网上写的是最大 1GB,登录后最大 2.5GB)。其他人可以通过这个工具或者网页浏览器来下载这些分享的文件。 + +所有的文件都是在客户端加密的,并且秘钥将不会被共享到远程主机。另外,你还可以为上传的文件额外设置一个密码。 + +上传的文件在下载(默认被下载 1 次,最多可被下载 10 次)后或者 24 小时后,就会自动删除。这将确保你的文件不会一直保留在网络上。 + +该工具当前处于 alpha 阶段,使用时请自担风险。而且,当前只有有限的安装方式可用。 + +### ffsend 的特点: + + * 全功能且使用友好的命令行工具 + * 可以安全地上传和下载文件与目录 + * 总是在客户端加密 + * 可用额外的密码进行保护、密码生成和可配置下载次数限制 + * 内置的文件或目录的打包和解压 + * 可以轻松地管理你的历史分享记录 + * 能够使用你自己的 Send 主机 + * 审查或者删除共享文件 + * 精准的错误报告 + * 低内存消耗,用于加密或上传下载 + * 无需交互,可以集成在脚本中 + +### 如何在 LInux 中安装 ffsend 呢? + +当前除了 Debian 和 Arch Linux 系统,其他发行版还没有相应的安装包(LCTT 译注:这个信息已过时,最新内容请看[这里](https://github.com/timvisee/ffsend#install))。然而,我们可以轻易地根据我们自己的操作系统和架构下载到相应的预编译二进制文件。 + +运行下面的命令来为你的操作系统下载 `ffsend` 最新可用的版本(LCTT 译注:当前最新版本为 v0.2.58): + +``` +$ wget https://github.com/timvisee/ffsend/releases/download/v0.1.2/ffsend-v0.1.2-linux-x64.tar.gz +``` + +然后使用下面的命令来解压 tar 包: + +``` +$ tar -xvf ffsend-v0.1.2-linux-x64.tar.gz +``` + +接着运行下面的命令来查看你的 `PATH` 环境变量: + +``` +$ echo $PATH +/home/daygeek/.cargo/bin:/usr/local/bin:/usr/local/sbin:/usr/bin:/usr/lib/jvm/default/bin:/usr/bin/site_perl:/usr/bin/vendor_perl:/usr/bin/core_perl +``` + +正如我先前告知的那样,下面我们要做的就是将这个可执行文件放置到 `PATH` 环境变量中的某个目录中: + +``` +$ sudo mv ffsend /usr/local/sbin +``` + +直接运行 `ffsend` 可以获取其基本使用信息: + +``` +$ ffsend +ffsend 0.1.2 +Usage: ffsend [FLAGS] ... + +Easily and securely share files from the command line. +A fully featured Firefox Send client. + +Missing subcommand. Here are the most used: + ffsend upload ... + ffsend download ... + +To show all subcommands, features and other help: + ffsend help [SUBCOMMAND] +``` + +对于使用基于 Arch Linux 系统的用户可以简单地借助 [AUR 助手][6]来安装它,因为这个包已经在 AUR 软件仓库中了。 + +``` +$ yay -S ffsend +``` + +对于使用 Debian/Ubuntu 系统的用户,使用 [DPKG 命令][7]来安装 `ffsend`。 + +``` +$ wget https://github.com/timvisee/ffsend/releases/download/v0.1.2/ffsend_0.1.2_amd64.deb +$ sudo dpkg -i ffsend_0.1.2_amd64.deb +``` + +### 如何使用 ffsend + +这并不复杂,我们可以简单地通过下面的语法来发送文件。 + +**语法:** + +``` +$ ffsend upload [/Path/to/the/file/name] +``` + +在下面的例子中,我们将上传一个名为 `passwd-up1.sh` 的文件,一旦你上传了该文件,你将得到一个唯一的 URL。 + +``` +$ ffsend upload passwd-up1.sh --copy +Upload complete +Share link: https://send.firefox.com/download/a4062553f4/#yy2_VyPaUMG5HwXZzYRmpQ +``` + +![][9] + +在任何远端的系统上,只需要使用上面那个唯一的 URL 就可以下载上传的文件了。 + +**语法:** + +``` +$ ffsend download [Generated URL] +``` + +命令的输出如下: + +``` +$ ffsend download https://send.firefox.com/download/a4062553f4/#yy2_VyPaUMG5HwXZzYRmpQ +Download complete +``` + +![][10] + +使用下面的语法来对目录进行上传: + +``` +$ ffsend upload [/Path/to/the/Directory] --copy +``` + +在下面的例子中,我们将上传一个名为 `2g` 的目录: + +``` +$ ffsend upload /home/daygeek/2g --copy +You've selected a directory, only a single file may be uploaded. +Archive the directory into a single file? [Y/n]: y +Archiving... +Upload complete +Share link: https://send.firefox.com/download/90aa5cfe67/#hrwu6oXZRG2DNh8vOc3BGg +``` + +在任意的远端系统中,只需要利用上面生成的唯一 URL 就可以获取到刚才上传的目录了。 + +``` +$ ffsend download https://send.firefox.com/download/90aa5cfe67/#hrwu6oXZRG2DNh8vOc3BGg +You're downloading an archive, extract it into the selected directory? [Y/n]: y +Extracting... +Download complete +``` + +上面已经通过安全、私密和加密过的链接来发送了文件。然而,如果你想在你的掌控范围内再添加额外的安全措施,你可以为文件添加密码。 + +``` +$ ffsend upload file-copy-rsync.sh --copy --password +Password: +Upload complete +Share link: https://send.firefox.com/download/0742d24515/#P7gcNiwZJ87vF8cumU71zA +``` + +当你在远端系统中尝试下载该文件时,它将要求你输入密码: + +``` +$ ffsend download https://send.firefox.com/download/0742d24515/#P7gcNiwZJ87vF8cumU71zA +This file is protected with a password. +Password: +Download complete +``` + +另外,你还可以在上传过程中提供下载次数限制来限制文件被下载的次数。 + +``` +$ ffsend upload file-copy-scp.sh --copy --downloads 10 +Upload complete +Share link: https://send.firefox.com/download/23cb923c4e/#LVg6K0CIb7Y9KfJRNZDQGw +``` + +然后你可以在任意的远程系统中使用上面的唯一 URL 来下载该文件: + +``` +ffsend download https://send.firefox.com/download/23cb923c4e/#LVg6K0CIb7Y9KfJRNZDQGw +Download complete +``` + +假如你想看这个链接的更多细节,你可以使用下面的命令来查看它的信息,它将为你展示文件名称、文件大小、被下载次数以及过期时间。 + +**语法:** + +``` +$ ffsend info [Generated URL] + +$ ffsend info https://send.firefox.com/download/23cb923c4e/#LVg6K0CIb7Y9KfJRNZDQGw +ID: 23cb923c4e +Name: file-copy-scp.sh +Size: 115 B +MIME: application/x-sh +Downloads: 3 of 10 +Expiry: 23h58m (86280s) +``` + +此外,你还可以使用下面的命令来查看你的传输历史: + +``` +$ ffsend history +# LINK EXPIRY +1 https://send.firefox.com/download/23cb923c4e/#LVg6K0CIb7Y9KfJRNZDQGw 23h57m +2 https://send.firefox.com/download/0742d24515/#P7gcNiwZJ87vF8cumU71zA 23h55m +3 https://send.firefox.com/download/90aa5cfe67/#hrwu6oXZRG2DNh8vOc3BGg 23h52m +4 https://send.firefox.com/download/a4062553f4/#yy2_VyPaUMG5HwXZzYRmpQ 23h46m +5 https://send.firefox.com/download/74ff30e43e/#NYfDOUp_Ai-RKg5g0fCZXw 23h44m +6 https://send.firefox.com/download/69afaab1f9/#5z51_94jtxcUCJNNvf6RcA 23h43m +``` + +假如你不想再分享某个链接,你可以使用下面的语法来删除它: + +**语法:** + +``` +$ ffsend delete [Generated URL] + +$ ffsend delete https://send.firefox.com/download/69afaab1f9/#5z51_94jtxcUCJNNvf6RcA +File deleted +``` + +### 如何在浏览器中使用 Send + +另外,你还可以通过使用 firefox 浏览器打开 https://send.firefox.com/ 来完成相应的分享。 + +只需要拖拽该文件就可以上传它: + +![][11] + +一旦该文件被下载,它将展示 100% 的下载状态。 + +![][12] + +想查看其他的可能选项,请浏览它对应的 man 信息或者帮助页。 + +-------------------------------------------------------------------------------- + +via: https://www.2daygeek.com/ffsend-securely-share-files-folders-from-linux-command-line-using-firefox-send-client/ + +作者:[Vinoth Kumar][a] +选题:[lujun9972][b] +译者:[FSSlc](https://github.com/FSSlc) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://www.2daygeek.com/author/vinoth/ +[b]: https://github.com/lujun9972 +[1]: https://linux.cn/article-9177-1.html +[2]: https://www.2daygeek.com/wormhole-securely-share-files-from-linux-command-line/ +[3]: https://www.2daygeek.com/transfer-sh-easy-fast-way-share-files-over-internet-from-command-line/ +[4]: https://linux.cn/article-10516-1.html +[5]: https://github.com/timvisee/ffsend +[6]: https://www.2daygeek.com/category/aur-helper/ +[7]: https://www.2daygeek.com/dpkg-command-to-manage-packages-on-debian-ubuntu-linux-mint-systems/ +[8]: data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7 +[9]: https://www.2daygeek.com/wp-content/uploads/2019/01/ffsend-easily-and-securely-share-files-from-linux-command-line-using-firefox-send-client-1.png +[10]: https://www.2daygeek.com/wp-content/uploads/2019/01/ffsend-easily-and-securely-share-files-from-linux-command-line-using-firefox-send-client-2.png +[11]: https://www.2daygeek.com/wp-content/uploads/2019/01/ffsend-easily-and-securely-share-files-from-linux-command-line-using-firefox-send-client-3.png +[12]: https://www.2daygeek.com/wp-content/uploads/2019/01/ffsend-easily-and-securely-share-files-from-linux-command-line-using-firefox-send-client-4.png diff --git a/published/202003/20190422 9 ways to save the planet.md b/published/202003/20190422 9 ways to save the planet.md new file mode 100644 index 0000000000..28a8cf2c55 --- /dev/null +++ b/published/202003/20190422 9 ways to save the planet.md @@ -0,0 +1,98 @@ +[#]: collector: (lujun9972) +[#]: translator: (MFGJT) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11978-1.html) +[#]: subject: (9 ways to save the planet) +[#]: via: (https://opensource.com/article/19/4/save-planet) +[#]: author: (Jen Wike Huger https://opensource.com/users/jen-wike/users/alanfdoss/users/jmpearce) + +九种用开源拯救地球的方法 +====== + +> 这些主意都用到了有关的开源技巧。 + +![](https://img.linux.net.cn/data/attachment/album/202003/10/004034vbl5qb5lbij66zil.jpg) + +人们可以做些什么来拯救地球?这个问题可能会让人感到压抑,因为有时我们感觉个人可以做的贡献太少了。但是作为地球公民,我们从来不是一个人。所以,我向我们的作家社区征集了一些开源软件或硬件可以帮助改变现状的方法。以下是他们的回复。 + +### 九种利用开源的方法来拯救地球的方式 + +#### 1、在你的终端禁用闪烁的光标 + +这听起来可能有点傻,但是那个无关紧要的闪烁的光标可能导致[每小时两瓦特的额外电力开销][2]。如果要禁用光标闪烁,可以通过更改终端设置:编辑Edit > 偏好设置Preferences > 光标Cursor > 光标闪烁Cursor blinking > 禁用Disabled。 + +*由 Mars Toktonaliev 推荐* + +#### 2、减少有关动物产品和加工食物的消费 + +这样做的一种方法是在你的手机中添加这些开源的 App:Daily Dozen、OpenFoodFacts、OpenVegeMap 和 Food Restrictions。这些 App 可以帮助你准备一份健康的素食饮食计划,为你找到素食主义者和严格素食主义者可以就餐的餐厅,还可以帮助你把你的饮食需求告诉别人,即使他们不和你讲同一种语言。如果想要了解更多有关这些的 App 的信息,你可以阅读《[4 款“吃草”的开源应用][3]》。 + +*由 Joshua Allen Holm 推荐* + +#### 3、让旧电脑重焕新生 + +怎么做?当然是用 Linux。通过给那些自己得不到新电脑的人创造一台新电脑来传递爱心,同时也可以避免让这台电脑进到垃圾填埋场。可以在 [The Asian Penguins][4] 看看我们是怎么做的。 + +*由 Stu Keroff 推荐* + +#### 4、在你不使用设备时关闭它们 + +你可以使用带有主插座和控制插座的“智能插座板”。把你的电脑连接到主插座上,这样的话当你打开电脑时所有你连接到控制插座上的设备如显示器,打印机等也都会打开。一个更简单的、技术含量更低的方法是使用一个带有计时器的插座板。我在家里就是用的这个。你可以用计时器上的开关设定一个定时开关电源的时间表。这样可以在没有人在家时自动关闭网络打印机。或者以我的用了六年的笔记本电脑为例,我通过一个交替使用外接电源(插座打开)和使用电脑电池(插座关闭)的电源计划延长了电脑电池的寿命。 + +*由 Jim Hall 推荐* + +#### 5、减少供暖通风系统(HVAC)的使用 + +在夏天,透过窗户的阳光可以为室内提供很多热量。使用 Home Assistant 可以[基于一天中的时间的][6],甚至是基于太阳高度角[自动调节][5]窗帘和遮阳棚。 + +*由 Michael Hrivnak 推荐* + +#### 6、出门就把恒温器关闭或调低 + +如果你的家用恒温器具有“离开”功能,你很容易忘记在出门时启用它。借助自动化,任何连接到网络的恒温器都可以在你不在家时自动节省能量。[Stataway][7] 就是一个这样项目。它通过调用你的手机的 GPS 坐标来决定是将你的恒温器设置为“在家”还是“离开”。 + +*由 Michael Hrivnak 推荐* + +#### 7、为未来储蓄算力 + +我有一个主意:创建一个可以读取可选的能量阵列(如风能或太阳能)的输出的脚本。这个脚本应该将计算集群中的服务器从睡眠模式更改为激活模式,直到过量的电能(超出可以储存的部分)被用尽。然后在高产能时段使用这些过量的电能来进行需要大量计算的项目,比如渲染。这个过程本质应该是免费的,因为使用的能量无法被储存起来挪作它用。我相信现有的监控、能量管理和服务器阵列工具一定可以实现这个功能。那么剩下的只是一些整合上的问题,就可以让整个系统工作起来。 + +*由 Terry Hancock 推荐* + +#### 8、关掉你的灯 + +根据[人工夜空亮度图集][8]World Atlas of Artificial Night Sky Brightness的说法,光污染影响了全世界超过 80% 的人口。这一结论在 2016 年(遵循 CC-NC 4.0 协议)发表在公开访问的期刊《科学进展Science Advances》上。关闭外部照明是一个可以使野生生物、人类健康受益并让我们享受夜晚的天空的快速途径,而且可以减少能量消耗。访问 [darksky.org][9] 来查看更多减少外部照明影响的方法。 + +*由 Michael Hrivnak 推荐* + +#### 9、减少你的 CPU 数量 + +就我个人而言,我记得我以前有很多在地下室运行的电脑作为我的 IT 游乐场/实验室。我现在对于能源消耗更加注意了,所以确实大大地减少了我的 CPU 数量。我现在更喜欢利用虚拟机、区域和容器等技术。另外,我很高兴有小型电脑和 SoC 电脑这种东西,比如树莓派,因为我可以用一台这样的电脑做很多事情,比如运行一个 DNS 或者 Web 服务器,而无需使整个屋子变热并积累昂贵的电费账单。 + +P.S. 这些电脑都运行于 Linux、FreeBSD,或者 Raspbian 系统! + +*由 Alan Formy-Duvall 推荐* + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/4/save-planet + +作者:[Jen Wike Huger][a] +选题:[lujun9972][b] +译者:[MFGJT](https://github.com/MFGJT) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/jen-wike/users/alanfdoss/users/jmpearce +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/pixelated-world.png?itok=fHjM6m53 +[2]: https://www.redhat.com/archives/fedora-devel-list/2009-January/msg02406.html +[3]: https://linux.cn/article-10926-1.html +[4]: https://opensource.com/article/19/2/asian-penguins-close-digital-divide +[5]: https://www.home-assistant.io/docs/automation/trigger/#sun-trigger +[6]: https://www.home-assistant.io/components/cover/ +[7]: https://github.com/mhrivnak/stataway +[8]: http://advances.sciencemag.org/content/2/6/e1600377 +[9]: http://darksky.org/ diff --git a/published/202003/20190527 How To Enable Or Disable SSH Access For A Particular User Or Group In Linux.md b/published/202003/20190527 How To Enable Or Disable SSH Access For A Particular User Or Group In Linux.md new file mode 100644 index 0000000000..0c0a600eeb --- /dev/null +++ b/published/202003/20190527 How To Enable Or Disable SSH Access For A Particular User Or Group In Linux.md @@ -0,0 +1,288 @@ +[#]: collector: "lujun9972" +[#]: translator: "way-ww" +[#]: reviewer: "wxy" +[#]: publisher: "wxy" +[#]: url: "https://linux.cn/article-12027-1.html" +[#]: subject: "How To Enable Or Disable SSH Access For A Particular User Or Group In Linux?" +[#]: via: "https://www.2daygeek.com/allow-deny-enable-disable-ssh-access-user-group-in-linux/" +[#]: author: "2daygeek http://www.2daygeek.com/author/2daygeek/" + +如何在 Linux 上为特定的用户或用户组启用或禁用 SSH? +====== + +![](https://img.linux.net.cn/data/attachment/album/202003/23/105915r1azn34i82sp48ca.jpg) + +由于你的公司标准规定,你可能只能允许部分人访问 Linux 系统。或者你可能只能够允许几个用户组中的用户访问 Linux 系统。那么如何实现这样的要求呢?最好的方法是什么呢?如何使用一个简单的方法去实现呢? + +是的,我们会有很多种方法去实现它。但是我们应该使用简单轻松的方法。为了简单轻松的完成目的,我们可以通过对 `/etc/ssh/sshd_config` 文件做必要的修改来实现。在这篇文章中我们将会向你展示实现要求的详细步骤。 + +为什么我们要这样做呢?是出于安全的原因。你可以访问[这个链接][1]来获取更多关于 openSSH 的使用方法。 + +### 什么是 SSH ? + +openssh 全称为 OpenBSD Secure Shell。Secure Shell(ssh)是一个自由开源的网络工具,它能让我们在一个不安全的网络中通过使用 Secure Shell(SSH)协议来安全访问远程主机。 + +它采用了客户端-服务器架构(C/S),拥有用户身份认证、加密、在计算机和隧道之间传输文件等功能。 + +我们也可以用 `telnet` 或 `rcp` 等传统工具来完成,但是这些工具都不安全,因为它们在执行任何动作时都会使用明文来传输密码。 + +### 如何在 Linux 中允许用户使用 SSH? + +通过以下内容,我们可以为指定的用户或用户列表启用 `ssh` 访问。如果你想要允许多个用户,那么你可以在添加用户时在同一行中用空格来隔开他们。 + +为了达到目的只需要将下面的值追加到 `/etc/ssh/sshd_config` 文件中去。 在这个例子中, 我们将会允许用户 `user3` 使用 ssh。 + +``` +# echo "AllowUsers user3" >> /etc/ssh/sshd_config +``` + +你可以运行下列命令再次检查是否添加成功。 + +``` +# cat /etc/ssh/sshd_config | grep -i allowusers +AllowUsers user3 +``` + +这样就行了, 现在只需要重启 `ssh` 服务和见证奇迹了。(下面这两条命令效果相同, 请根据你的服务管理方式选择一条执行即可) + +``` +# systemctl restart sshd +或 +# service restart sshd +``` + +接下来很简单,只需打开一个新的终端或者会话尝试用不同的用户身份访问 Linux 系统。是的,这里 `user2` 用户是不被允许使用 SSH 登录的并且会得到如下所示的错误信息。 + +``` +# ssh user2@192.168.1.4 +user2@192.168.1.4's password: +Permission denied, please try again. +``` + +输出: + +``` +Mar 29 02:00:35 CentOS7 sshd[4900]: User user2 from 192.168.1.6 not allowed because not listed in AllowUsers +Mar 29 02:00:35 CentOS7 sshd[4900]: input_userauth_request: invalid user user2 [preauth] +Mar 29 02:00:40 CentOS7 unix_chkpwd[4902]: password check failed for user (user2) +Mar 29 02:00:40 CentOS7 sshd[4900]: pam_unix(sshd:auth): authentication failure; logname= uid=0 euid=0 tty=ssh ruser= rhost=192.168.1.6 user=user2 +Mar 29 02:00:43 CentOS7 sshd[4900]: Failed password for invalid user user2 from 192.168.1.6 port 42568 ssh2 +``` + +与此同时用户 `user3` 被允许登入系统因为他在被允许的用户列表中。 + +``` +# ssh user3@192.168.1.4 +user3@192.168.1.4's password: +[user3@CentOS7 ~]$ +``` + +输出: + +``` +Mar 29 02:01:13 CentOS7 sshd[4939]: Accepted password for user3 from 192.168.1.6 port 42590 ssh2 +Mar 29 02:01:13 CentOS7 sshd[4939]: pam_unix(sshd:session): session opened for user user3 by (uid=0) +``` + +### 如何在 Linux 中阻止用户使用 SSH ? + +通过以下内容,我们可以配置指定的用户或用户列表禁用 `ssh`。如果你想要禁用多个用户,那么你可以在添加用户时在同一行中用空格来隔开他们。 + +为了达到目的只需要将以下值追加到 `/etc/ssh/sshd_config` 文件中去。 在这个例子中, 我们将禁用用户 `user1` 使用 `ssh`。 + +``` +# echo "DenyUsers user1" >> /etc/ssh/sshd_config +``` + +你可以运行下列命令再次检查是否添加成功。 + +``` +# cat /etc/ssh/sshd_config | grep -i denyusers +DenyUsers user1 +``` + +这样就行了, 现在只需要重启 `ssh` 服务和见证奇迹了。 + +``` +# systemctl restart sshd +活 +# service restart sshd +``` + +接下来很简单,只需打开一个新的终端或者会话,尝试使用被禁用的用户身份被访问 Linux 系统。是的,这里 `user1` 用户在禁用名单中。所以,当你尝试登录时,你将会得到如下所示的错误信息。 + +``` +# ssh user1@192.168.1.4 +user1@192.168.1.4's password: +Permission denied, please try again. +``` + +输出: + +``` +Mar 29 01:53:42 CentOS7 sshd[4753]: User user1 from 192.168.1.6 not allowed because listed in DenyUsers +Mar 29 01:53:42 CentOS7 sshd[4753]: input_userauth_request: invalid user user1 [preauth] +Mar 29 01:53:46 CentOS7 unix_chkpwd[4755]: password check failed for user (user1) +Mar 29 01:53:46 CentOS7 sshd[4753]: pam_unix(sshd:auth): authentication failure; logname= uid=0 euid=0 tty=ssh ruser= rhost=192.168.1.6 user=user1 +Mar 29 01:53:48 CentOS7 sshd[4753]: Failed password for invalid user user1 from 192.168.1.6 port 42522 ssh2 +``` + +### 如何在 Linux 中允许用户组使用 SSH? + +通过以下内容,我们可以允许一个指定的组或多个组使用 `ssh`。 + +如果你想要允许多个组使用 `ssh` 那么你在添加用户组时需要在同一行中使用空格来隔开他们。 + +为了达到目的只需将以下值追加到 `/etc/ssh/sshd_config` 文件中去。在这个例子中,我们将允许 `2g-admin` 组使用 ssh。 + +``` +# echo "AllowGroups 2g-admin" >> /etc/ssh/sshd_config +``` + +你可以运行下列命令再次检查是否添加成功。 + +``` +# cat /etc/ssh/sshd_config | grep -i allowgroups +AllowGroups 2g-admin +``` + +运行下列命令查看属于该用户组的用户有哪些。 + +``` +# getent group 2g-admin +2g-admin:x:1005:user1,user2,user3 +``` + +这样就行了, 现在只需要重启 `ssh` 服务和见证奇迹了。 + +``` +# systemctl restart sshd +或 +# service restart sshd +``` + +是的, `user1` 被允许登入系统因为用户 `user1` 属于 `2g-admin` 组。 + +``` +# ssh user1@192.168.1.4 +user1@192.168.1.4's password: +[user1@CentOS7 ~]$ +``` + +输出: + +``` +Mar 29 02:10:21 CentOS7 sshd[5165]: Accepted password for user1 from 192.168.1.6 port 42640 ssh2 +Mar 29 02:10:22 CentOS7 sshd[5165]: pam_unix(sshd:session): session opened for user user1 by (uid=0) +``` + +是的, `user2` 被允许登入系统因为用户 `user2` 同样属于 `2g-admin` 组。 + +``` +# ssh user2@192.168.1.4 +user2@192.168.1.4's password: +[user2@CentOS7 ~]$ +``` + +输出: + +``` +Mar 29 02:10:38 CentOS7 sshd[5225]: Accepted password for user2 from 192.168.1.6 port 42642 ssh2 +Mar 29 02:10:38 CentOS7 sshd[5225]: pam_unix(sshd:session): session opened for user user2 by (uid=0) +``` + +当你尝试使用其他不在被允许的组中的用户去登入系统时, 你将会得到如下所示的错误信息。 + +``` +# ssh ladmin@192.168.1.4 +ladmin@192.168.1.4's password: +Permission denied, please try again. +``` + +输出: + +``` +Mar 29 02:12:36 CentOS7 sshd[5306]: User ladmin from 192.168.1.6 not allowed because none of user's groups are listed in AllowGroups +Mar 29 02:12:36 CentOS7 sshd[5306]: input_userauth_request: invalid user ladmin [preauth] +Mar 29 02:12:56 CentOS7 unix_chkpwd[5310]: password check failed for user (ladmin) +Mar 29 02:12:56 CentOS7 sshd[5306]: pam_unix(sshd:auth): authentication failure; logname= uid=0 euid=0 tty=ssh ruser= rhost=192.168.1.6 user=ladmin +Mar 29 02:12:58 CentOS7 sshd[5306]: Failed password for invalid user ladmin from 192.168.1.6 port 42674 ssh2 +``` + +### 如何在 Linux 中阻止用户组使用 SSH? + +通过以下内容,我们可以禁用指定的组或多个组使用 `ssh`。 + +如果你想要禁用多个用户组使用 `ssh`,那么你需要在添加用户组时在同一行中使用空格来隔开他们。 + +为了达到目的只需要将下面的值追加到 `/etc/ssh/sshd_config` 文件中去。 + +``` +# echo "DenyGroups 2g-admin" >> /etc/ssh/sshd_config +``` + +你可以运行下列命令再次检查是否添加成功。 + +``` +# # cat /etc/ssh/sshd_config | grep -i denygroups +DenyGroups 2g-admin + +# getent group 2g-admin +2g-admin:x:1005:user1,user2,user3 +``` + +这样就行了, 现在只需要重启 `ssh` 服务和见证奇迹了。 + +``` +# systemctl restart sshd +或 +# service restart sshd +``` + +是的 `user1` 不被允许登入系统,因为他是 `2g-admin` 用户组中的一员。他属于被禁用 `ssh` 的组中。 + +``` +# ssh user1@192.168.1.4 +user1@192.168.1.4's password: +Permission denied, please try again. +``` + +输出: + +``` +Mar 29 02:17:32 CentOS7 sshd[5400]: User user1 from 192.168.1.6 not allowed because a group is listed in DenyGroups +Mar 29 02:17:32 CentOS7 sshd[5400]: input_userauth_request: invalid user user1 [preauth] +Mar 29 02:17:38 CentOS7 unix_chkpwd[5402]: password check failed for user (user1) +Mar 29 02:17:38 CentOS7 sshd[5400]: pam_unix(sshd:auth): authentication failure; logname= uid=0 euid=0 tty=ssh ruser= rhost=192.168.1.6 user=user1 +Mar 29 02:17:41 CentOS7 sshd[5400]: Failed password for invalid user user1 from 192.168.1.6 port 42710 ssh2 +``` + +除了 `2g-admin` 用户组之外的用户都可以使用 ssh 登入系统。 例如,`ladmin` 等用户就允许登入系统。 + +``` +# ssh ladmin@192.168.1.4 +ladmin@192.168.1.4's password: +[ladmin@CentOS7 ~]$ +``` + +输出: + +``` +Mar 29 02:19:13 CentOS7 sshd[5432]: Accepted password for ladmin from 192.168.1.6 port 42716 ssh2 +Mar 29 02:19:13 CentOS7 sshd[5432]: pam_unix(sshd:session): session opened for user ladmin by (uid=0) +``` + +-------------------------------------------------------------------------------- + +via: https://www.2daygeek.com/allow-deny-enable-disable-ssh-access-user-group-in-linux/ + +作者:[2daygeek][a] +选题:[lujun9972][b] +译者:[way-ww](https://github.com/way-ww) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: http://www.2daygeek.com/author/2daygeek/ +[b]: https://github.com/lujun9972 +[1]: https://www.2daygeek.com/category/ssh-tutorials/ diff --git a/published/202003/20190731 How to structure a multi-file C program- Part 2.md b/published/202003/20190731 How to structure a multi-file C program- Part 2.md new file mode 100644 index 0000000000..53dc8bb70e --- /dev/null +++ b/published/202003/20190731 How to structure a multi-file C program- Part 2.md @@ -0,0 +1,224 @@ +[#]: collector: (lujun9972) +[#]: translator: (mengxinayan) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12000-1.html) +[#]: subject: (How to structure a multi-file C program: Part 2) +[#]: via: (https://opensource.com/article/19/7/structure-multi-file-c-part-2) +[#]: author: (Erik O'Shaughnessy https://opensource.com/users/jnyjny) + +如何组织构建多文件 C 语言程序(二) +====== + +> 我将在本系列的第二篇中深入研究由多个文件组成的 C 程序的结构。 + +![](https://img.linux.net.cn/data/attachment/album/202003/16/122928i6qheufnh24jq2qf.jpg) + +在[第一篇][2]中,我设计了一个名为[喵呜喵呜][3]的多文件 C 程序,该程序实现了一个玩具[编解码器][4]。我也提到了程序设计中的 Unix 哲学,即在一开始创建多个空文件,并建立一个好的结构。最后,我创建了一个 `Makefile` 文件夹并阐述了它的作用。在本文中将另一个方向展开:现在我将介绍简单但具有指导性的喵呜喵呜编解码器的实现。 + +当读过我的《[如何写一个好的 C 语言 main 函数][5]》后,你会觉得喵呜喵呜编解码器的 `main.c` 文件的结构很熟悉,其主体结构如下: + +``` +/* main.c - 喵呜喵呜流式编解码器 */ + +/* 00 系统包含文件 */ +/* 01 项目包含文件 */ +/* 02 外部声明 */ +/* 03 定义 */ +/* 04 类型定义 */ +/* 05 全局变量声明(不要用)*/ +/* 06 附加的函数原型 */ +    +int main(int argc, char *argv[]) +{ +  /* 07 变量声明 */ +  /* 08 检查 argv[0] 以查看该程序是被如何调用的 */ +  /* 09 处理来自用户的命令行选项 */ +  /* 10 做点有用的事情 */ +} +    +/* 11 其它辅助函数 */ +``` + +### 包含项目头文件 + +位于第二部分中的 `/* 01 项目包含文件 */` 的源代码如下: + + +``` +/* main.c - 喵呜喵呜流式编解码器 */ +... +/* 01 项目包含文件 */ +#include "main.h" +#include "mmecode.h" +#include "mmdecode.h" +``` + +`#include` 是 C 语言的预处理命令,它会将该文件名的文件内容拷贝到当前文件中。如果程序员在头文件名称周围使用双引号(`""`),编译器将会在当前目录寻找该文件。如果文件被尖括号包围(`<>`),编译器将在一组预定义的目录中查找该文件。 + +[main.h][6] 文件中包含了 [main.c][7] 文件中用到的定义和类型定义。我喜欢尽可能多将声明放在头文件里,以便我在我的程序的其他位置使用这些定义。 + +头文件 [mmencode.h][8] 和 [mmdecode.h][9] 几乎相同,因此我以 `mmencode.h` 为例来分析。 + +``` +/* mmencode.h - 喵呜喵呜流编解码器 */ +   +#ifndef _MMENCODE_H +#define _MMENCODE_H + +#include + +int mm_encode(FILE *src, FILE *dst); + +#endif /* _MMENCODE_H */ +``` + +`#ifdef`、`#define`、`#endif` 指令统称为 “防护” 指令。其可以防止 C 编译器在一个文件中多次包含同一文件。如果编译器在一个文件中发现多个定义/原型/声明,它将会产生警告。因此这些防护措施是必要的。 + +在这些防护内部,只有两个东西:`#include` 指令和函数原型声明。我在这里包含了 `stdio.h` 头文件,以便于能在函数原型中使用 `FILE` 定义。函数原型也可以被包含在其他 C 文件中,以便于在文件的命名空间中创建它。你可以将每个文件视为一个独立的命名空间,其中的变量和函数不能被另一个文件中的函数或者变量使用。 + +编写头文件很复杂,并且在大型项目中很难管理它。不要忘记使用防护。 + +### 喵呜喵呜编码的最终实现 + +该程序的功能是按照字节进行 `MeowMeow` 字符串的编解码,事实上这是该项目中最简单的部分。截止目前我所做的工作便是支持允许在适当的位置调用此函数:解析命令行,确定要使用的操作,并打开将要操作的文件。下面的循环是编码的过程: + +``` +/* mmencode.c - 喵呜喵呜流式编解码器 */ +... + while (!feof(src)) { + + if (!fgets(buf, sizeof(buf), src)) + break; + + for(i=0; i> 4; + fputs(tbl[hi], dst); + fputs(tbl[lo], dst); + } + } +``` + +简单的说,当文件中还有数据块时( `feof(3)` ),该循环读取(`feof(3)` )文件中的一个数据块。然后将读入的内容的每个字节分成两个 `hi` 和 `lo` 的半字节nibble。半字节是半个字节,即 4 个位。这里的奥妙之处在于可以用 4 个位来编码 16 个值。我将 `hi` 和 `lo` 用作 16 个字符串查找表 `tbl` 的索引,表中包含了用半字节编码的 `MeowMeow` 字符串。这些字符串使用 `fputs(3)` 函数写入目标 `FILE` 流,然后我们继续处理缓存区的下一个字节。 + +该表使用 [table.h][14] 中的宏定义进行初始化,在没有特殊原因(比如:要展示包含了另一个项目的本地头文件)时,我喜欢使用宏来进行初始化。我将在未来的文章中进一步探讨原因。 + +### 喵呜喵呜解码的实现 + +我承认在开始工作前花了一些时间。解码的循环与编码类似:读取 `MeowMeow` 字符串到缓冲区,将编码从字符串转换为字节 + +``` + /* mmdecode.c - 喵呜喵呜流式编解码器 */ + ... + int mm_decode(FILE *src, FILE *dst) + { +   if (!src || !dst) { +     errno = EINVAL; +     return -1; +   } +   return stupid_decode(src, dst); + } +``` + +这不符合你的期望吗? + +在这里,我通过外部公开的 `mm_decode()` 函数公开了 `stupid_decode()` 函数细节。我上面所说的“外部”是指在这个文件之外。因为 `stupid_decode()` 函数不在该头文件中,因此无法在其他文件中调用它。 + +当我们想发布一个可靠的公共接口时,有时候会这样做,但是我们还没有完全使用函数解决问题。在本例中,我编写了一个 I/O 密集型函数,该函数每次从源中读取 8 个字节,然后解码获得 1 个字节写入目标流中。较好的实现是一次处理多于 8 个字节的缓冲区。更好的实现还可以通过缓冲区输出字节,进而减少目标流中单字节的写入次数。 + +``` +/* mmdecode.c - 喵呜喵呜流式编解码器 */ +... +int stupid_decode(FILE *src, FILE *dst) +{ + char buf[9]; + decoded_byte_t byte; + int i; + + while (!feof(src)) { + if (!fgets(buf, sizeof(buf), src)) + break; + byte.field.f0 = isupper(buf[0]); + byte.field.f1 = isupper(buf[1]); + byte.field.f2 = isupper(buf[2]); + byte.field.f3 = isupper(buf[3]); + byte.field.f4 = isupper(buf[4]); + byte.field.f5 = isupper(buf[5]); + byte.field.f6 = isupper(buf[6]); + byte.field.f7 = isupper(buf[7]); + + fputc(byte.value, dst); + } + return 0; +} +``` + +我并没有使用编码器中使用的位移方法,而是创建了一个名为 `decoded_byte_t` 的自定义数据结构。 + +``` +/* mmdecode.c - 喵呜喵呜流式编解码器 */ +... + +typedef struct { +  unsigned char f7:1; +  unsigned char f6:1; +  unsigned char f5:1; +  unsigned char f4:1; +  unsigned char f3:1; +  unsigned char f2:1; +  unsigned char f1:1; +  unsigned char f0:1; +} fields_t; +   +typedef union { +  fields_t      field; +  unsigned char value; +} decoded_byte_t; +``` + +初次看到代码时可能会感到有点儿复杂,但不要放弃。`decoded_byte_t` 被定义为 `fields_t` 和 `unsigned char` 的 **联合**。可以将联合中的命名成员看作同一内存区域的别名。在这种情况下,`value` 和 `field` 指向相同的 8 位内存区域。将 `field.f0` 设置为 `1` 也将会设置 `value` 中的最低有效位。 + +虽然 `unsigned char` 并不神秘,但是对 `fields_t` 的类型定义(`typedef`)也许看起来有些陌生。现代 C 编译器允许程序员在结构体中指定单个位字段的值。字段所在的类型是一个无符号整数类型,并在成员标识符后紧跟一个冒号和一个整数,该整数指定了位字段的长度。 + +这种数据结构使得按字段名称访问字节中的每个位变得简单,并可以通过联合中的 `value` 字段访问组合后的值。我们依赖编译器生成正确的移位指令来访问字段,这可以在调试时为你节省不少时间。 + +最后,因为 `stupid_decode()` 函数一次仅从源 `FILE` 流中读取 8 个字节,所以它效率并不高。通常我们尝试最小化读写次数,以提高性能和降低调用系统调用的开销。请记住:少量的读取/写入大的块比大量的读取/写入小的块好得多。 + +### 总结 + +用 C 语言编写一个多文件程序需要程序员要比只是是一个 `main.c` 做更多的规划。但是当你添加功能或者重构时,只需要多花费一点儿努力便可以节省大量时间以及避免让你头痛的问题。 + +回顾一下,我更喜欢这样做:多个文件,每个文件仅有简单功能;通过头文件公开那些文件中的小部分功能;把数字常量和字符串常量保存在头文件中;使用 `Makefile` 而不是 Bash 脚本来自动化处理事务;使用 `main()` 函数来处理命令行参数解析并作为程序主要功能的框架。 + +我知道我只是蜻蜓点水般介绍了这个简单的程序,并且我很高兴知道哪些事情对你有所帮助,以及哪些主题需要详细的解释。请在评论中分享你的想法,让我知道。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/7/structure-multi-file-c-part-2 + +作者:[Erik O'Shaughnessy][a] +选题:[lujun9972][b] +译者:[萌新阿岩](https://github.com/mengxinayan) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/jnyjny +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/file_system.jpg?itok=pzCrX1Kc (4 manilla folders, yellow, green, purple, blue) +[2]: https://linux.cn/article-11935-1.html +[3]: https://github.com/jnyjny/MeowMeow.git +[4]: https://en.wikipedia.org/wiki/Codec +[5]: https://linux.cn/article-10949-1.html +[6]: https://github.com/JnyJny/meowmeow/blob/master/main.h +[7]: https://github.com/JnyJny/meowmeow/blob/master/main.c +[8]: https://github.com/JnyJny/meowmeow/blob/master/mmencode.h +[9]: https://github.com/JnyJny/meowmeow/blob/master/mmdecode.h +[10]: http://www.opengroup.org/onlinepubs/009695399/functions/feof.html +[11]: http://www.opengroup.org/onlinepubs/009695399/functions/fgets.html +[12]: http://www.opengroup.org/onlinepubs/009695399/functions/strlen.html +[13]: http://www.opengroup.org/onlinepubs/009695399/functions/fputs.html +[14]: https://github.com/JnyJny/meowmeow/blob/master/table.h +[15]: http://www.opengroup.org/onlinepubs/009695399/functions/isupper.html +[16]: http://www.opengroup.org/onlinepubs/009695399/functions/fputc.html diff --git a/published/202003/20190813 Building a non-breaking breakpoint for Python debugging.md b/published/202003/20190813 Building a non-breaking breakpoint for Python debugging.md new file mode 100644 index 0000000000..0ad21ebeab --- /dev/null +++ b/published/202003/20190813 Building a non-breaking breakpoint for Python debugging.md @@ -0,0 +1,215 @@ +[#]: collector: (lujun9972) +[#]: translator: (caiichenr) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11986-1.html) +[#]: subject: (Building a non-breaking breakpoint for Python debugging) +[#]: via: (https://opensource.com/article/19/8/debug-python) +[#]: author: (Liran Haimovitch https://opensource.com/users/liranhaimovitch) + +在 Python 调试过程中设置不中断的断点 +====== + +> 你对如何让调试器变得更快产生过兴趣吗?本文将分享我们在为 Python 构建调试器时得到的一些经验。 + +![](https://img.linux.net.cn/data/attachment/album/202003/12/104433hq3qx2k81w1wamwm.jpg) + +整段故事讲的是我们在 [Rookout][2] 公司的团队为 Python 调试器开发不中断断点的经历,以及开发过程中得到的经验。我将在本月于旧金山举办的 [PyBay 2019][3] 上介绍有关 Python 调试过程的更多细节,但现在就让我们立刻开始这段故事。 + +### Python 调试器的心脏:sys.set_trace + +在诸多可选的 Python 调试器中,使用最广泛的三个是: + +* pdb,它是 Python 标准库的一部分 +* PyDev,它是内嵌在 Eclipse 和 Pycharm 等 IDE 中的调试器 +* ipdb,它是 IPython 的调试器 + +Python 调试器的选择虽多,但它们几乎都基于同一个函数:`sys.settrace`。 值得一提的是, [sys.settrace][4] 可能也是 Python 标准库中最复杂的函数。 + +![set_trace Python 2 docs page][5] + +简单来讲,`settrace` 的作用是为解释器注册一个跟踪函数,它在下列四种情形发生时被调用: + +* 函数调用 +* 语句执行 +* 函数返回 +* 异常抛出 + +一个简单的跟踪函数看上去大概是这样: + +``` +def simple_tracer(frame, event, arg): +  co = frame.f_code +  func_name = co.co_name +  line_no = frame.f_lineno +  print("{e} {f} {l}".format( +e=event, f=func_name, l=line_no)) +  return simple_tracer +``` + +在分析函数时我们首先关注的是参数和返回值,该跟踪函数的参数分别是: + +* `frame`,当前堆栈帧,它是包含当前函数执行时解释器里完整状态的对象 +* `event`,事件,它是一个值可能为 `call`、`line`、`return` 或 `exception` 的字符串 +* `arg`,参数,它的取值基于 `event` 的类型,是一个可选项 + +该跟踪函数的返回值是它自身,这是由于解释器需要持续跟踪两类跟踪函数: + +* **全局跟踪函数(每线程)**:该跟踪函数由当前线程调用 `sys.settrace` 来设置,并在解释器创建一个新的堆栈帧时被调用(即代码中发生函数调用时)。虽然没有现成的方式来为不同的线程设置跟踪函数,但你可以调用 `threading.settrace` 来为所有新创建的 `threading` 模块线程设置跟踪函数。 +* **局部跟踪函数(每一帧)**:解释器将该跟踪函数的值设置为全局跟踪函数创建帧时的返回值。同样也没有现成的方法能够在帧被创建时自动设置局部跟踪函数。 + +该机制的目的是让调试器对被跟踪的帧有更精确的把握,以减少对性能的影响。 + +### 简单三步构建调试器 (我们最初的设想) + +仅仅依靠上文提到的内容,用自制的跟踪函数来构建一个真正的调试器似乎有些不切实际。幸运的是,Python 的标准调试器 pdb 是基于 Bdb 构建的,后者是 Python 标准库中专门用于构建调试器的基类。 + +基于 Bdb 的简易断点调试器看上去是这样的: + +``` +import bdb +import inspect + +class Debugger(bdb.Bdb): +  def __init__(self): +      Bdb.__init__(self) +      self.breakpoints = dict() +      self.set_trace() + +def set_breakpoint(self, filename, lineno, method): +  self.set_break(filename, lineno) +  try : +      self.breakpoints[(filename, lineno)].add(method) +  except KeyError: +      self.breakpoints[(filename, lineno)] = [method] + +def user_line(self, frame): +  if not self.break_here(frame): +      return + +  # Get filename and lineno from frame +  (filename, lineno, _, _, _) = inspect.getframeinfo(frame) + +  methods = self.breakpoints[(filename, lineno)] +  for method in methods: +      method(frame) +``` + +这个调试器类的全部构成是: + +1. 继承 `Bdb`,定义一个简单的构造函数来初始化基类,并开始跟踪。 +2. 添加 `set_breakpoint` 方法,它使用 `Bdb` 来设置断点,并跟踪这些断点。 +3. 重载 `Bdb` 在当前用户行调用的 `user_line` 方法,该方法一定被一个断点调用,之后获取该断点的源位置,并调用已注册的断点。 + +### 这个简易的 Bdb 调试器效率如何呢? + +Rookout 的目标是在生产级性能的使用场景下提供接近普通调试器的使用体验。那么,让我们来看看先前构建出来的简易调试器表现的如何。 + +为了衡量调试器的整体性能开销,我们使用如下两个简单的函数来进行测试,它们分别在不同的情景下执行了 1600 万次。请注意,在所有情景下断点都不会被执行。 + +``` +def empty_method(): +   pass + +def simple_method(): +   a = 1 +   b = 2 +   c = 3 +   d = 4 +   e = 5 +   f = 6 +   g = 7 +   h = 8 +   i = 9 +   j = 10 +``` + +在使用调试器的情况下需要大量的时间才能完成测试。糟糕的结果指明了,这个简陋 `Bdb` 调试器的性能还远不足以在生产环境中使用。 + +![First Bdb debugger results][6] + +### 对调试器进行优化 + +降低调试器的额外开销主要有三种方法: + +1. **尽可能的限制局部跟踪**:由于每一行代码都可能包含大量事件,局部跟踪比全局跟踪的开销要大得多。 +2. **优化 `call` 事件并尽快将控制权还给解释器**:在 `call` 事件发生时调试器的主要工作是判断是否需要对该事件进行跟踪。 +3. **优化 `line` 事件并尽快将控制权还给解释器**:在 `line` 事件发生时调试器的主要工作是判断我们在此处是否需要设置一个断点。 + +于是我们复刻了 `Bdb` 项目,精简特征、简化代码,针对使用场景进行优化。这些工作虽然得到了一些效果,但仍无法满足我们的需求。因此我们又继续进行了其它的尝试,将代码优化并迁移至 `.pyx` 使用 [Cython][7] 进行编译,可惜结果(如下图所示)依旧不够理想。最终,我们在深入了解 CPython 源码之后意识到,让跟踪过程快到满足生产需求是不可能的。 + +![Second Bdb debugger results][8] + +### 放弃 Bdb 转而尝试字节码操作 + +熬过先前对标准调试方法进行的试验-失败-再试验循环所带来的失望,我们将目光转向另一种选择:字节码操作。 + +Python 解释器的工作主要分为两个阶段: + +1. **将 Python 源码编译成 Python 字节码**:这种(对人类而言)不可读的格式专为执行的效率而优化,它们通常缓存在我们熟知的 `.pyc` 文件当中。 +2. **遍历 解释器循环中的字节码**: 在这一步中解释器会逐条的执行指令。 + +我们选择的模式是:使用**字节码操作**来设置没有全局额外开销的**不中断断点**。这种方式的实现首先需要在内存中的字节码里找到我们感兴趣的部分,然后在该部分的相关机器指令前插入一个函数调用。如此一来,解释器无需任何额外的工作即可实现我们的不中断断点。 + +这种方法并不依靠魔法来实现,让我们简要地举个例子。 + +首先定义一个简单的函数: + +``` +def multiply(a, b): +   result = a * b +   return result +``` + +在 [inspect][9] 模块(其包含了许多实用的单元)的文档里,我们得知可以通过访问 `multiply.func_code.co_code` 来获取函数的字节码: + +``` +'|\x00\x00|\x01\x00\x14}\x02\x00|\x02\x00S' +``` + +使用 Python 标准库中的 [dis][10] 模块可以翻译这些不可读的字符串。调用 `dis.dis(multiply.func_code.co_code)` 之后,我们就可以得到: + +``` +  4          0 LOAD_FAST               0 (a) +             3 LOAD_FAST               1 (b) +             6 BINARY_MULTIPLY     +             7 STORE_FAST              2 (result) + +  5         10 LOAD_FAST               2 (result) +            13 RETURN_VALUE       +``` + +与直截了当的解决方案相比,这种方法让我们更靠近发生在调试器背后的事情。可惜 Python 并没有提供在解释器中修改函数字节码的方法。我们可以对函数对象进行重写,不过那样做的效率满足不了大多数实际的调试场景。最后我们不得不采用一种迂回的方式来使用原生拓展才能完成这一任务。 + +### 总结 + +在构建一个新工具时,总会学到许多事情的工作原理。这种刨根问底的过程能够使你的思路跳出桎梏,从而得到意料之外的解决方案。 + +在 Rookout 团队中构建不中断断点的这段时间里,我学到了许多有关编译器、调试器、服务器框架、并发模型等等领域的知识。如果你希望更深入的了解字节码操作,谷歌的开源项目 [cloud-debug-python][11] 为编辑字节码提供了一些工具。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/8/debug-python + +作者:[Liran Haimovitch][a] +选题:[lujun9972][b] +译者:[caiichenr](https://github.com/caiichenr) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/liranhaimovitch +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/python_jungle_lead.jpeg?itok=pFKKEvT- (Real python in the graphic jungle) +[2]: https://rookout.com/ +[3]: https://pybay.com/ +[4]: https://docs.python.org/3/library/sys.html#sys.settrace +[5]: https://opensource.com/sites/default/files/uploads/python2docs.png (set_trace Python 2 docs page) +[6]: https://opensource.com/sites/default/files/uploads/debuggerresults1.png (First Bdb debugger results) +[7]: https://cython.org/ +[8]: https://opensource.com/sites/default/files/uploads/debuggerresults2.png (Second Bdb debugger results) +[9]: https://docs.python.org/2/library/inspect.html +[10]: https://docs.python.org/2/library/dis.html +[11]: https://github.com/GoogleCloudPlatform/cloud-debug-python +[12]: https://pybay.com/speaker/liran-haimovitch/ +[13]: https://ti.to/sf-python/pybay2019/discount/OpenSource35 diff --git a/published/202003/20190925 Debugging in Emacs- The Grand Unified Debugger.md b/published/202003/20190925 Debugging in Emacs- The Grand Unified Debugger.md new file mode 100644 index 0000000000..ef4b71f194 --- /dev/null +++ b/published/202003/20190925 Debugging in Emacs- The Grand Unified Debugger.md @@ -0,0 +1,104 @@ +[#]: collector: (lujun9972) +[#]: translator: (cycoe) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11994-1.html) +[#]: subject: (Debugging in Emacs: The Grand Unified Debugger) +[#]: via: (https://opensourceforu.com/2019/09/debugging-in-emacs-the-grand-unified-debugger/) +[#]: author: (Vineeth Kartha https://opensourceforu.com/author/vineeth-kartha/) + +Emacs 调试秘籍之 GUD 调试器 +====== + +![][2] + +> 本文简短地对 Emacs 的调试工具 GUD 的特性进行了探索。 + +如果你是一个 C 或 C++ 开发者,你很可能已经使用过 GDB(GNU 调试器),毫无疑问,它是现今最强大、最无可匹敌的调试器之一。它唯一的缺点就是它基于命令行,虽然仍能提供许多强大的功能,但有时也会具有一些局限性。这也就是为什么聪明的人们开始追求整合了编辑器和调试器的图形化 GUI 集成开发环境Integrated Development Environment。仍有些开发者坚信使用鼠标会降低工作效率,在 GUI 上用鼠标点~点~点~是来自恶魔的诱惑。 + +因为 Emacs 是现今最酷的文本编辑器之一,我将为你展示如何在不碰鼠标且不离开 Emacs 的情况下,实现写代码、编译代码、调试代码的过程。 + +GUD(LCTT 译注:全称大统一调试器Grand Unified Debugger,鉴于其缩写形式更为人熟知,以下全文将使用缩写替代此全称)是 Emacs 下的一个模式mode,用于在 Emacs 中运行 GDB。它向 GDB 提供了 Emacs 的所有特性,使用户无需离开编辑器就可以对代码进行调试。 + +### 使用 GUD 的前期准备 + +如果你正在使用一个 Linux 机器,很可能你已经安装了 GDB 和 gcc,接下来就是要确保已经安装了 Emacs。以下的内容我将假设读者熟悉 GDB 并且至少用它做过基本的调试。如果你未曾接触过 GDB,你可以做个快速入门,这些资料在网上随处可得。 + +对于那些 Emacs 新手,我将向你介绍一些基本术语。纵览整篇文章,你将看到诸如 `C-c M-x` 等快捷键。此处 `C` 代表 `Ctrl` 键,`M` 代表 `Alt` 键。`C-c` 代表 `Ctrl` 键和 `c` 键被同时按下。如果你看到 `C-c c`,它代表同时按下 `Ctrl` 键和 `c` 键,释放后紧接着按下 `c` 键。在 Emacs 中,编辑文本的主要区域被称为主缓冲区main buffer,而在 Emacs 窗口下方用于输入命令的区域被称为迷你缓冲区mini buffer。 + +启动 Emacs,并按下 `C-x C-f` 来创建一个新文件。Emacs 将提示你输入一个文件名,此处让我们将文件命名为 `buggyFactorial.cpp`。一旦文件打开,输入如下代码: + +``` +#include +#include + +int factorial(int num) { + int product = 1; + while(num--) { + product *= num; + } + return product; +} +int main() { + int result = factorial(5); + assert(result == 120); +} +``` + +使用 `C-x C-s` 快捷键保存文件。文件保存完毕,是时候进行编译了。按下 `M-x`,在弹出的提示符prompt后输入 `compile` 并点击回车。然后在提示符后,将内容替换为 `g++ -g buggyFactorial.cpp` 并再次点击回车。 + +![图 1: Emacs 迷你缓冲区中编译命令][3] + +这将在 Emacs 中开启另一个缓冲区,显示编译的状态。如果你的代码输入没有错误,你将预期得到如图 2 所示的缓冲区。 + +![图 2: 编译状态][4] + +要想隐藏编译缓冲区,首先确保你的光标在编译缓冲区中(你可以不使用鼠标,而是通过 `C-x o` 快捷键将光标从一个缓冲区移动到另一个),然后按下 `C-x 0`。下一步就是运行代码,并观察是否运行良好。按下 `M-!` 快捷键并在迷你缓冲区的提示符后面输入 `./a.out`。 + +![图 3: 代码在迷你缓冲区中的输出][5] + +你可以看到迷你缓冲区中显示断言失败。很明显代码中有错误,因为 5 的阶乘是 120。那么让我们现在开始调试吧。 + +### 使用 GUD 调式代码 + +现在,我们的代码已经编译完成,是时候看看到底哪里出错了。按下 `M-x` 快捷键并在提示符后输入 `gdb`。在接下来的提示符后,输入 `gdb -i=mi a.out`。如果一切顺利,GDB 会在 Emacs 缓冲区中启动,你会看到如图 4 所示的窗口。 + +![图 4: Emacs 中的 GDB 缓冲区][6] + +在 `gdb` 提示符后,输入 `break main` 来设置断点,并输入 `r` 来运行程序。程序会开始运行并停在 `main()` 函数处。 + +一旦 GDB 到达了 `main` 处设置的断点,就会弹出一个新的缓冲区显示你正在调试的代码。注意左侧的红点,正是你设置断点的位置,同时会有一个小的标志提示你当前代码运行到了哪一行。当前,该标志就在断点处(如图 5)。 + +![图 5: GDB 与代码显示在两个分离的窗口][7] + +为了调试 `factorial` 函数,我们需要单步运行。想要达到此目的,你可以在 GBD 提示符使用 GDB 命令 `step`,或者使用 Emacs 快捷键 `C-c C-s`。还有其它一些快捷键,但我更喜欢 GDB 命令。因此我将在本文的后续部分使用它们。 + +单步运行时让我们注意一下局部变量中的阶乘值。参考图 6 来设置在 Emacs 帧中显示局部变量值。 + +![图 6: 在 Emacs 中使用独立帧显示局部变量][8] + +在 GDB 提示符中进行单步运行并观察局部变量值的变化。在循环的第一次迭代中,我们发现了一个问题。此处乘法的结果应该是 5 而不是 4。 + +本文到这里也差不多结束了,读者可以自行探索发现 GUD 模式这片新大陆。GDB 中的所有命令都可以在 GUD 模式中运行。我将此代码的修复留给读者作为一个练习。看看你在调试的过程中,可以做哪一些定制化,来使你的工作流更加简单和高效。 + +-------------------------------------------------------------------------------- + +via: https://opensourceforu.com/2019/09/debugging-in-emacs-the-grand-unified-debugger/ + +作者:[Vineeth Kartha][a] +选题:[lujun9972][b] +译者:[cycoe](https://github.com/cycoe) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensourceforu.com/author/vineeth-kartha/ +[b]: https://github.com/lujun9972 +[1]: https://i0.wp.com/opensourceforu.com/wp-content/uploads/2019/09/Screenshot-from-2019-09-25-15-39-46.png?ssl=1 +[2]: https://i0.wp.com/opensourceforu.com/wp-content/uploads/2019/09/Screenshot-from-2019-09-25-15-39-46.png?ssl=1 +[3]: https://i1.wp.com/opensourceforu.com/wp-content/uploads/2019/09/Figure_1.png?ssl=1 +[4]: https://i2.wp.com/opensourceforu.com/wp-content/uploads/2019/09/Figure_2.png?ssl=1 +[5]: https://i0.wp.com/opensourceforu.com/wp-content/uploads/2019/09/Figure_3.png?ssl=1 +[6]: https://i0.wp.com/opensourceforu.com/wp-content/uploads/2019/09/Figure_4.png?ssl=1 +[7]: https://i1.wp.com/opensourceforu.com/wp-content/uploads/2019/09/Figure_5.png?ssl=1 +[8]: https://i1.wp.com/opensourceforu.com/wp-content/uploads/2019/09/Figure_6.png?ssl=1 diff --git a/published/202003/20191126 Calculator N- is an open source scientific calculator for your smartphone.md b/published/202003/20191126 Calculator N- is an open source scientific calculator for your smartphone.md new file mode 100644 index 0000000000..3ba3711fe6 --- /dev/null +++ b/published/202003/20191126 Calculator N- is an open source scientific calculator for your smartphone.md @@ -0,0 +1,60 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11981-1.html) +[#]: subject: (Calculator N+ is an open source scientific calculator for your smartphone) +[#]: via: (https://opensource.com/article/19/11/calculator-n-mobile) +[#]: author: (Ricardo Berlasso https://opensource.com/users/rgb-es) + +Calculator N+:一款智能手机上的开源科学计算器 +====== + +> 这个 Android 应用可在掌中计算许多高级数学函数。 + +![](https://img.linux.net.cn/data/attachment/album/202003/10/113543hlb5xu7b5e17ba90.jpg) + +移动电话每天都在变得越来越强大,因此毫不奇怪它们可以击败不太久前的大多数计算机。这也意味着移动手机上的工具每天都在变得越来越强大。 + +之前,我写过一篇 [两款 Linux 桌面端可用的科学计算器][2],我接着将介绍 [Calculator N+][3],这是一款很棒的适用于 Android 设备的计算机代数系统(CAS)应用,采用 GPL v3.0 许可证下。 + +Calculator N+ 被认为是“适用于 Android 的强大计算器”,但这是一个谦虚的说法。它不仅可以以任意精度工作,还可以显示根数和分数等*很多*功能。 + +寻找多项式根?可以。分解因数?可以。导数、积分和极限?可以。数论(模算术、组合学、素因数分解)?可以。 + +你还可以求解方程系统、简化表达式(包括三角函数)、转换单位,只要你想到的,它都能做! + +![Calculator N+ graphical interface][4] + +其结果以 LaTeX 输出。左上方的菜单提供了许多强大的功能,只需触摸一下即可使用。同样在该菜单中,你将找到该应用所有功能的帮助文件。在屏幕的右上角,你可以在精确表示法和十进制表示法之间切换。最后,点击屏幕底部的蓝色栏,即可访问应用中的所有函数库。不过要小心!如果你不是数学家、物理学家或工程师,那么这么长的列表会看上去很吓人。 + +所有这些功能都来自 [Symja 库][5],这是另一个出色的 GPL 3 项目。 + +这两个项目都处于积极开发中,并且每个版本都在不断完善。特别是,Calculator N+ 的 v3.4.6 在用户界面(UI)品质方面取得了重大飞跃。虽然还是存在一些不够好的地方,但是要在智能手机的小巧的用户界面中发挥如此强大的功能是一项艰巨的任务,我认为应用开发人员正在很好地解决其剩余的问题。对他们表示敬意! + +如果你是老师、学生或在理工科领域工作,请试试 Calculator N+。它是免费、无广告、开源的,并可以满足你所有的数学需求。(当然,除了数学考试期间,为防止作弊绝对不允许使用智能手机。) + +可以在 [Google Play 商店][6]找到 Calculator N+,也可以使用 GitHub 页面上的说明[从源代码构建][7]。 + +如果你知道用于科学或工程的其他有用的开源应用,请在评论中告知我们。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/11/calculator-n-mobile + +作者:[Ricardo Berlasso][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/rgb-es +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/calculator_money_currency_financial_tool.jpg?itok=2QMa1y8c (scientific calculator) +[2]: https://linux.cn/article-9643-1.html +[3]: https://github.com/tranleduy2000/ncalc +[4]: https://opensource.com/sites/default/files/uploads/calculatornplus_sqrt-frac.png (Calculator N+ graphical interface) +[5]: https://github.com/axkr/symja_android_library +[6]: https://play.google.com/store/apps/details?id=com.duy.calculator.free +[7]: https://github.com/tranleduy2000/ncalc/blob/master/README.md diff --git a/published/202003/20191223 10 articles to learn Linux your way.md b/published/202003/20191223 10 articles to learn Linux your way.md new file mode 100644 index 0000000000..a38a98dff2 --- /dev/null +++ b/published/202003/20191223 10 articles to learn Linux your way.md @@ -0,0 +1,99 @@ +[#]: collector: "lujun9972" +[#]: translator: "messon007" +[#]: reviewer: "wxy" +[#]: publisher: "wxy" +[#]: url: "https://linux.cn/article-12035-1.html" +[#]: subject: "10 articles to learn Linux your way" +[#]: via: "https://opensource.com/article/19/12/learn-linux" +[#]: author: "Seth Kenlon https://opensource.com/users/seth" + +10 篇关于 Linux 的好文章 +======= + +> 2019 年对于 Linux 来说是个好年份,让我们一起来回顾一下这十篇关于 Linux 的好文章。 + +![](https://img.linux.net.cn/data/attachment/album/202003/25/115447rrjfuufccumf0oz6.jpg) + +2019 年对于 Linux 来说是个好年份,显然这里的 “Linux” 一词有更多含义: 内核? 桌面? 或是生态? 在此次回顾年度 Linux 好文中,我在选择十大好文时有意采取了更开放的视角。下面就是十大好文(无先后次序之分)。 + +### 《Linux 权限入门指南》 + +Bryant Son 的《[Linux 权限入门指南][2]》向新用户介绍了文件权限的概念,通过图形和图表的方式来说明每个要点。通常很难以视觉的方式来解释纯粹基于文本的概念,而本文则对可视方式学习的人非常友好。 Bryant 在讲述时也很专注主题。关于文件权限的任何阐述都可能引出几个相关主题(例如所有权和访问控制列表等),但是本文致力于解释一件事并很好地解释它。 + +### 《为什么我从 Mac 换到了 Linux》 + +Matthew Broberg 在《[为什么我从 Mac 换到了 Linux][3]》中清楚而客观的介绍了他从 MacOS 切换到 Linux 的经历。通常切换平台是很困难的,因此记录决定切换的背后考虑非常重要。我认为 Matt 的文章带有几个目的,但对我来说最重要的两个目的是:通过解答他的问题并提供潜在的解决方案,他请 Linux 社区的人们来支持他;这对于其他正在考虑采用 Linux 的人来说是一个很好的参考。 + +### 《在 Linux 上定位 WiFi 速度慢的问题》 + +《[在 Linux 上定位 WiFi 速度慢的问题][4]》这篇文章中,David Clinton 对每个人都可能遇到的问题进行了分析,并提供了怎么样一步步解决的思路。这是“偶然的 Linux”技巧的一个很好的例子,但它不仅可以帮助经常遇到问题的人,而且可以向非 Linux 用户展示如何在其他平台上进行问题定位。 + +### 《一个非技术人员对 GNOME 项目使用 GitLab 的感受》 + +Molly de Blanc 所写的《[一个非技术人员对 GNOME 项目使用 GitLab 的感受][5]》深层次地揭示了开源界的一个典范(GNOME 桌面)如何使用开源界的另一个典范(Git)进行开发。听到一个开放源代码项目对于任何需要做的事情默认为开放源代码解决方案,这总是让我感到振奋。无论如何,这种情况并不常见,然而对于 GNOME 来说,这是项目本身的重要且受欢迎的部分。 + +### 《详解 Linux 中的虚拟文件系统》 + +Alison Chaiken 在《[详解 Linux 中的虚拟文件系统][6]》中巧妙地解释了对许多用户来说都很难理解的东西。理解文件系统是什么、虚拟文件系统和真实的文件系统是一回事,但从定义上讲,*虚拟的*其实并不是真正的文件系统。Linux 以一种普通用户也能从中受益的方式提供了它们,Alison 的文章以一种易于理解的方式对其进行了阐述。另外,Alison 在文章的后半部分更深入地介绍了如何使用 `bcc` 脚本查看她刚刚讲的虚拟文件系统的相关内容。 + +### 《理解文件路径并学会使用它们》 + +我认为《[理解文件路径并学会使用它们][7]》很重要,因为这是大多数用户(在任何平台上)似乎都没有学过的概念。这是一个奇怪的现象,因为现在比以往任何时候,人们都越来越多地看到*文件路徑*:几乎所有的互联网网址都包含一个文件路径,该路径告诉你你在域中的确切位置。我常常在想为什么计算机教育不是从互联网开始的,互联网是目前最熟悉的应用程序,并且可以说是使用最频繁的超级计算机,完全可以用它来解释我们每天使用的设备。(我想如果这些设备运行 Linux 会有所帮助,但是我们正在努力。) + +### 《Linux 下的进程间通信:共享存储》 + +Marty Kalin 的《[Linux 下的进程间通信:共享存储][8]》从 Linux 的开发者视角解释了 IPC 以及如何在代码中使用它。虽然我只是列入了这篇文章,不过它实际上是一个三篇文章的系列,而它是同类文章中阐述的最好的。很少有文档能够解释 Linux 怎样处理 IPC,更不用说 IPC 是什么,为什么它很重要,或者在编程时该如何使用它。通常这是你在大学读书时关注的话题。现在,你可以在这里阅读所有内容。 + +### 《在 Linux 上用 strace 来理解系统调用》 + +Gaurav Kamathe 的《[在 Linux 上用 strace 来理解系统调用][9]》具有很强的技术性,我希望我所见过的有关 `strace` 的每次会议演讲都是如此。这是对一个复杂但非常有用的命令的清晰演示。令我惊讶的是,我读了本文才发现自己一直使用的命令不是这个命令,而是 `ltrace`(可以用来查看命令调用了哪些函数)。本文包含了丰富的信息,是开发人员和测试人员的快捷参考手册。 + +### 《Linux 桌面发展旅程》 + +Jim Hall 的《[Linux 桌面发展旅程][10]》是对 Linux 桌面历史的一次视觉之旅。从 [TWM][11] 开始,经历了 [FVWM][12]、[GNOME][13]、[KDE][14] 等薪火相传。如果你是 Linux 的新手,那么这将是一个出自那个年代的人的有趣的历史课(有截图可以证明这一点)。如果你已经使用 Linux 多年,那么这肯定会唤醒你的记忆。最后,可以肯定的是:仍然可以找到 20 年前屏幕快照的人都是神一样的数据档案管理员。 + +### 《用 Linux 创建你自己的视频流服务器》 + +Aaron J. Prisk 的 《[用 Linux 创建你自己的视频流服务器][15]》消除了大多数人对我们视为理所当然的服务的误解。由于 YouTube 和 Twitch 之类服务的存在,许多人认为这是向世界广播视频的唯一方式。当然,人们过去常常以为 Windows 和 Mac 是计算机的唯一入口,值得庆幸的是,最终证明这是严重的误解。在本文中,Aaron 建立了一个视频流服务器,甚至还顺便讨论了一下 [OBS][16],以便你可以创建视频。这是一个有趣的周末项目还是新职业的开始?你自己决定。 + +### 《塑造 Linux 历史的 10 个时刻》 + +Alan Formy-Duval 撰写的《[塑造 Linux 历史的 10 个时刻][17]》试图完成一项艰巨的任务,即从 Linux 的历史中选出 10 件有代表性的事情。当然,这是很难的,因为有如此多重要的时刻,所以我想看看 Alan 是如何通过自己的经历来选择它。例如,什么时候开始意识到 Linux 必然可以发展下去?—— 当 Alan 意识到他维护的所有系统都在运行 Linux 时。用这种方式来解释历史是很美的,因为每个人的重要时刻都会有所不同。 关于 Linux 没有权威性列表,关于 Linux 的文章也没有,关于开源也没有。你可以创建你自己的列表,也可以使你自己成为列表的一部分。 + +(LCTT 译注:这里推荐了 11 篇,我数了好几遍,没眼花……) + +### 你想从何学起? + +你还想知道 Linux 的什么内容?请在评论区告诉我们或来文讲述你的 Linux 经验。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/12/learn-linux + +作者:[Seth Kenlon][a] +选题:[lujun9972][b] +译者:[messon007](https://github.com/messon007) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/seth +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/OSDC_Penguin_Image_520x292_12324207_0714_mm_v1a.png?itok=p7cWyQv9 "Penguins gathered together in the Artic" +[2]: https://linux.cn/article-11056-1.html +[3]: https://linux.cn/article-11586-1.html +[4]: http://opensource.com/article/19/4/troubleshooting-wifi-linux +[5]: https://linux.cn/article-11806-1.html +[6]: https://linux.cn/article-10884-1.html +[7]: https://opensource.com/article/19/8/understanding-file-paths-linux +[8]: https://linux.cn/article-10826-1.html +[9]: https://linux.cn/article-11545-1.html +[10]: https://opensource.com/article/19/8/how-linux-desktop-grown +[11]: https://github.com/freedesktop/twm +[12]: http://www.fvwm.org/ +[13]: http://gnome.org +[14]: http://kde.org +[15]: https://opensource.com/article/19/1/basic-live-video-streaming-server +[16]: https://opensource.com/life/15/12/real-time-linux-video-editing-with-obs-studio +[17]: https://opensource.com/article/19/4/top-moments-linux-history +[18]: https://opensource.com/how-submit-article diff --git a/published/202003/20191223 Prioritizing simplicity in your Python code.md b/published/202003/20191223 Prioritizing simplicity in your Python code.md new file mode 100644 index 0000000000..e0760548c7 --- /dev/null +++ b/published/202003/20191223 Prioritizing simplicity in your Python code.md @@ -0,0 +1,63 @@ +[#]: collector: (lujun9972) +[#]: translator: (caiichenr) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11999-1.html) +[#]: subject: (Prioritizing simplicity in your Python code) +[#]: via: (https://opensource.com/article/19/12/zen-python-simplicity-complexity) +[#]: author: (Moshe Zadka https://opensource.com/users/moshez) + +简单是 Python 编程的第一要则 +====== + +> 本文是 Python 之禅特别系列的第二篇,我们将要关注其中第三与第四条原则:简单与复杂。 + +![](https://img.linux.net.cn/data/attachment/album/202003/15/124150t4wf3wwgdrijx6xx.jpg) + +> "Il semble que la perfection soit atteinte non quand il n'y a plus rien à ajouter, mais quand il n'y plus rien à retrancher." +> +> "It seems that perfection is finally attained not when there is no longer anything to add, but when there is no longer anything to take away." +> +> “完美并非无可增,而是不可减。” +> +> —Antoine de Saint-Exupéry, [Terre des Hommes][2], 1939 + +编程时最常有的考量是与复杂性的斗争,只想写出让旁人无从下手的繁杂代码,对每个程序员来讲都算不上难事。倘若未能触及代码的简繁取舍,那么 《[Python 之禅][3]》 就有了一角残缺。 + +### 简单胜过复杂Simple is better than complex + +尚有选择余地时,应该选简单的方案。Python 少有*不可为*之事,这意味着设计出巴洛克风格(LCTT 译注:即夸张和不理性)的程序只为解决浅显的问题不仅有可能,甚至很简单。 + +正因如此,编程时应当谨记,代码的简单性是最易丢失,却最难复得的。 + +这意味着,在可以选用函数来表达时不要去引入额外的类;避免使用强力的第三方库往往有助于你针对迫切的问题场景设计更妥当的简短函数。不过其根本的意图,旨在让你减少对将来的盘算,而去着重解决手头的问题。 + +以简单和优美作为指导原则的代码相比那些想要囊括将来一切变数的,在日后要容易修改得多。 + +### 复杂胜过错综复杂Complex is better than complicated + +把握用词的精确含义对于理解这条令人费解的原则是至关重要的。形容某事复杂complex,是说它由许多部分组成,着重组成成分之多;而形容某事错综复杂complicated,则是指其包含着差异巨大、难以预料的行为,强调的是各组成部分之间的杂乱联系。 + +解决困难问题时,往往没有可行的简单方案。此时,最 Python 化的策略是“自底向上bottom-up”地构建出简单的工具,之后将其组合用以解决该问题。 + +这正是对象组合object composition这类技术的闪耀之处,它避免了错综复杂的继承体系,转而由独立的对象把一些方法调用传递给别的独立对象。这些对象都能独立地测试与部署,最终却可以组成一体。 + +“自底建造” 的另一例即是[单分派泛函数][4]singledispatch的使用,抛弃了错综复杂的对象之后,我们得到是简单、几乎无行为的对象以及独立的行为。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/12/zen-python-simplicity-complexity + +作者:[Moshe Zadka][a] +选题:[lujun9972][b] +译者:[caiichenr](https://github.com/caiichenr) +校对:[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://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/read_book_guide_tutorial_teacher_student_apaper.png?itok=_GOufk6N (Person reading a book and digital copy) +[2]: https://en.wikipedia.org/wiki/Wind,_Sand_and_Stars +[3]: https://www.python.org/dev/peps/pep-0020/ +[4]: https://opensource.com/article/19/5/python-singledispatch diff --git a/published/202003/20191226 10 Linux command tutorials for beginners and experts.md b/published/202003/20191226 10 Linux command tutorials for beginners and experts.md new file mode 100644 index 0000000000..b9d216695c --- /dev/null +++ b/published/202003/20191226 10 Linux command tutorials for beginners and experts.md @@ -0,0 +1,87 @@ +[#]: collector: (lujun9972) +[#]: translator: (wxy) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12011-1.html) +[#]: subject: (10 Linux command tutorials for beginners and experts) +[#]: via: (https://opensource.com/article/19/12/linux-commands) +[#]: author: (Moshe Zadka https://opensource.com/users/moshez) + +10 篇对初学者和专家都有用的 Linux 命令教程 +====== + +> 在这有关 Linux 命令的十大文章中,了解如何使 Linux 发挥所需的作用。 + +![](https://img.linux.net.cn/data/attachment/album/202003/19/095932xc64xw7cwqlolale.jpg) + +**很好地**使用 Linux 意味着了解有哪些命令以及它们可以为你执行的功能。 + +### 《在 Linux 命令行下使用“原力”》 + +原力force有光明的一面和黑暗的一面。正确理解这个对于真正掌握它至关重要。Alan Formy-Duval 在他的文章《[在 Linux 命令行下使用“原力”][2]》中,解释了一些流行的、有时是危险的命令的 `-f` 选项(也称为 `--force`)。 + +### 《Linux useradd 命令介绍》 + +共享帐户是一个坏主意。相反,请使用典型的 `useradd` 命令为不同的人(甚至是不同的角色)分配单独的帐户。作为其经典的 Linux 管理基础系列的一部分,Alan Formy-Duval 提供了《[Linux useradd 命令介绍][3]》,并且像往常一样,他用**朴实明白的语言**对其进行了解释,以便新老管理员都可以理解。 + +### 《用 Linux 命令显示硬件信息》 + +机器**里面**是什么?有时不使用螺丝刀检查硬件很有用。无论是你正在使用的计算机,还是在商店购买前进行测试的计算机、或者是正在尝试维修的计算机,在《[用 Linux 命令显示硬件信息][4]》中,Howard Fosdick 提供了或流行或晦涩难懂的命令,以帮助你深入了解计算机的硬件信息。 + +### 《如何在 Linux 上使用 gocryptfs 加密文件》 + +从社会保险号到个人信件再到亲人,我们的文件中包含了许多私人数据。在《[如何在 Linux 上使用 gocryptfs 加密文件][5]》中,Brian "Bex" Exelbierd 解释了如何保持**隐私*的私密性。此外,他展示了一种加密文件的方式,这种方式对你现有的工作流程几乎没有影响。这不是复杂的 PGP 风格的密钥管理和后台密钥代理的难题,这是快速、无缝和安全的文件加密。 + +### 《如何使用 rsync 的高级用法进行大型备份》 + +在新的一年中,许多人会下定决心要更加努力地进行备份。Alan Formy-Duval 早在几年前就已经做出了解决方案,因为在《[如何使用 rsync 的高级用法进行大型备份][6]》中,他表现出对文件同步命令的极其熟悉。你可能不会马上记住所有语法,但其思路是读取和处理选项、构造备份命令,然后使其自动化。这是使用 `rsync` 的明智方法,也是可靠地执行备份的**唯一**方法。 + +### 《在 Linux 命令行使用 more 查看文本文件》 + +在 Scott Nesbitt 的文章《[在 Linux 命令行使用 more 查看文本文件][7]》中,古老而良好的默认分页器 `more` 引起了人们的关注。许多人安装和使用 `less`,因为它比 `more` 更灵活。但是,随着越来越多的系统在新出现的容器中实现,有时甚至不存在像 `less` 或 `most` 之类的新颖的豪华工具。了解和使用`more` 很简单,这是常见的默认设置,并且是生产系统最后的调试工具。 + +### 《关于 sudo 你可能不知道的》 + +`sudo` 命令因其过失而闻名。人们知道 `sudo` 一词,我们大多数人认为我们知道它的作用。我们的观点是正确的,但是正如 Peter Czanik 在他的文章《[关于 sudo 你可能不知道的][8]》中所揭示的那样,该命令所包含的不仅仅是“西蒙说的Simon says”(LCTT 译注:国外的一个儿童游戏)。就像这个经典的童年游戏一样,`sudo` 命令功能强大,也容易犯愚蠢的错误 —— 有更多的可能产生可怕都后果,而这是你绝不想遇上的事情! + +### 《怎样用 Bash 编程:语法和工具》 + +如果你是 Linux、BSD 或 Mac(以及近来的 Windows)用户,你也许使用过交互式 Bash shell。它是快速的、一次性命令的绝佳 shell,这就是为什么这么多 Linux 用户喜欢将其用作主要用户界面的原因。但是,Bash 不仅仅是个命令提示符。它也是一种编程语言,如果你已经在使用 Bash 命令,那么自动化的道路从未如此简单过。在 David Both 的出色作品《[怎样用 Bash 编程:语法和工具][9]》中对其进行全面了解。 + +### 《精通 Linux 的 ls 命令》 + +`ls` 命令是那些两个字母的命令之一。单字母命令是针对慢速终端的优化,因为慢速终端的输入的每个字母都会导致明显的延迟,而这对于懒惰的打字员来说也是不错的奖励。一如既往地,Seth Kenlon 清晰实用地解释了你可以怎样《[精通 Linux 的 ls 命令][10]》。最重要的是,在“一切都是文件”的系统中,列出文件至关重要。 + +### 《Linux cat 命令入门》 + +`cat` 命令(con*cat*enate 的缩写)看似简单。无论是使用它来快速查看文件的内容还是将内容通过管道传输到另一个命令,你都可能没有充分利用 `cat` 的功能。Alan Formy-Duval 的《[Linux cat 命令入门][11]》提供了一些新思路,可以使你没有打开文件的感觉就可以看到文件内容。另外,了解各种有关 `zcat` 的知识,这样你就可以无需解压缩就可以得到压缩文件的内容!这是一件小而简单的事情,但是**这**是使 Linux 很棒的原因。 + +### 继续旅程 + +不要让这些关于 Linux 命令的 10 篇最佳文章成为你的旅程终点。关于 Linux 及其多才多艺的提示符,还有更多值得去发现,因此,请继续关注以获取更多知识。而且,如果你想让我们介绍一个 Linux 命令,请在评论中告诉我们。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/12/linux-commands + +作者:[Moshe Zadka][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/moshez +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/car-penguin-drive-linux-yellow.png?itok=twWGlYAc (Penguin driving a car with a yellow background) +[2]: https://linux.cn/article-10881-1.html +[3]: https://linux.cn/article-11756-1.html +[4]: https://linux.cn/article-11422-1.html +[5]: https://opensource.com/article/19/8/how-encrypt-files-gocryptfs +[6]: https://linux.cn/article-10865-1.html +[7]: https://linux.cn/article-10531-1.html +[8]: https://linux.cn/article-11595-1.html +[9]: https://linux.cn/article-11552-1.html +[10]: https://linux.cn/article-11159-1.html +[11]: https://opensource.com/article/19/2/getting-started-cat-command +[12]: https://opensource.com/how-submit-article diff --git a/sources/tech/20200113 How to setup a DNS server with bind.md b/published/202003/20200113 How to setup a DNS server with bind.md similarity index 55% rename from sources/tech/20200113 How to setup a DNS server with bind.md rename to published/202003/20200113 How to setup a DNS server with bind.md index 74cc32e747..356ea4bf8c 100644 --- a/sources/tech/20200113 How to setup a DNS server with bind.md +++ b/published/202003/20200113 How to setup a DNS server with bind.md @@ -1,103 +1,103 @@ [#]: collector: (lujun9972) -[#]: translator: (lxbwolf) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: translator: (geekpi) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11997-1.html) [#]: subject: (How to setup a DNS server with bind) [#]: via: (https://fedoramagazine.org/how-to-setup-a-dns-server-with-bind/) [#]: author: (Curt Warfield https://fedoramagazine.org/author/rcurtiswarfield/) -How to setup a DNS server with bind +简明指南:使用 bind 设置 DNS 服务器 ====== ![][1] -The Domain Name System, or DNS, as it’s more commonly known, translates or converts domain names into the IP addresses associated with that domain. DNS is the reason you are able to find your favorite website by name instead of typing an IP address into your browser. This guide shows you how to configure a Master DNS system and one client. +域名系统Domain Name System,我们更通常称为 DNS 的系统,可以将域名翻译或转换为与该域关联的 IP 地址。DNS 是能够让你通过名称找到自己喜欢的网站而不是在浏览器中输入 IP 地址的原因。本指南将向你展示如何配置一个主 DNS 系统以及客户端。 -Here are system details for the example used in this article: +以下是本文示例中使用的系统细节: ``` -dns01.fedora.local (192.168.1.160 ) - Master DNS server -client.fedora.local (192.168.1.136 ) - Client +dns01.fedora.local (192.168.1.160)- 主 DNS 服务器 +client.fedora.local (192.168.1.136)- 客户端 ``` -### DNS server configuration +### DNS 服务器配置 -Install the bind packages using sudo: +使用 `sudo` 安装 bind 包: ``` $ sudo dnf install bind bind-utils -y ``` -The _/etc/named.conf_ configuration file is provided by the _bind_ package to allow you to configure the DNS server. +bind 包提供了 `/etc/named.conf` 配置文件,来供你配置 DNS 服务器。 -Edit the _/etc/named.conf_ file: +编辑 `/etc/named.conf` 文件: ``` sudo vi /etc/named.conf ``` -Look for the following line: +查找以下行: ``` listen-on port 53 { 127.0.0.1; }; ``` -Add the IP address of your Master DNS server as follows: +添加主 DNS 服务器的 IP 地址,如下所示: ``` listen-on port 53 { 127.0.0.1; 192.168.1.160; }; ``` -Look for the next line: +查找以下行: ``` allow-query { localhost; }; ``` -Add your local network range. The example system uses IP addresses in the 192.168.1.X range. This is specified as follows: +添加本地网络范围。该示例系统使用的 IP 地址在 192.168.1.X 的范围内。指定如下: ``` allow-query { localhost; 192.168.1.0/24; }; ``` -Specify a forward and reverse zone. Zone files are simply text files that have the DNS information, such as IP addresses and host-names, on your system. The forward zone file makes it possible for the translation of a host-name to its IP address. The reverse zone file does the opposite. It allows a remote system to translate an IP address to the host name. +指定转发和反向区域。区域文件Zone file就是具有系统上 DNS 信息(例如 IP 地址和主机名)的文本文件。转发区域文件forward zone file使得将主机名转换为 IP 地址成为可能。反向区域文件reverse zone file则相反。它允许远程系统将 IP 地址转换为主机名。 -Look for the following line at the bottom of the /etc/named.conf file: +在 `/etc/named.conf` 文件的底部查找以下行: ``` include "/etc/named.rfc1912.zones"; ``` -Here, you’ll specify the zone file information _**directly above that line**_ as follows: +在此处,你将在**该行的正上方**指定区域文件信息,如下所示: ``` zone "dns01.fedora.local" IN { -type master; -file "forward.fedora.local"; -allow-update { none; }; + type master; + file "forward.fedora.local"; + allow-update { none; }; }; zone "1.168.192.in-addr.arpa" IN { -type master; -file "reverse.fedora.local"; -allow-update { none; }; + type master; + file "reverse.fedora.local"; + allow-update { none; }; }; ``` -The _forward.fedora.local_ and the file _reverse.fedora.local_ are just the names of the zone files you will be creating. They can be called anything you like. +`forward.fedora.local` 和 `reverse.fedora.local` 文件是要创建的区域文件的名称。它们可以是任意名字。 -Save and exit. +保存并退出。 -#### Create the zone files +#### 创建区域文件 -Create the forward and reverse zone files you specified in the /etc/named.conf file: +创建你在 `/etc/named.conf` 文件中指定的转发和反向区域文件: ``` $ sudo vi /var/named/forward.fedora.local ``` -Add the following lines: +添加以下行: ``` $TTL 86400 @@ -114,13 +114,13 @@ dns01 IN A 192.168.1.160 client IN A 192.168.1.136 ``` -Everything in _**bold**_ is specific to your environment. Save the file and exit. Next, edit the _reverse.fedora.local_ file: +所有**粗体**(LCTT 译注:本译文中无法呈现粗体)内容都特定于你的环境。保存文件并退出。接下来,编辑 `reverse.fedora.local` 文件: ``` $ sudo vi /var/named/reverse.fedora.local ``` -Add the following lines: +添加以下行: ``` $TTL 86400 @@ -139,9 +139,9 @@ client IN A 192.168.1.136 136 IN PTR client.fedora.local. ``` -Everything in _**bold**_ is also specific to your environment. Save the file and exit. +所有**粗体**(LCTT 译注:本译文中无法呈现粗体)内容都特定于你的环境。保存文件并退出。 -You’ll also need to configure SELinux and add the correct ownership for the configuration files. +你还需要配置 SELinux 并为配置文件添加正确的所有权。 ``` sudo chgrp named -R /var/named @@ -150,22 +150,22 @@ sudo restorecon -rv /var/named sudo restorecon /etc/named.conf ``` -Configure the firewall: +配置防火墙: ``` sudo firewall-cmd --add-service=dns --perm sudo firewall-cmd --reload ``` -#### Check the configuration for any syntax errors +#### 检查配置是否存在语法错误 ``` sudo named-checkconf /etc/named.conf ``` -Your configuration is valid if no output or errors are returned. +如果没有输出或返回错误,那么你的配置有效。 -Check the forward and reverse zone files. +检查转发和反向区域文件。 ``` $ sudo named-checkzone forward.fedora.local /var/named/forward.fedora.local @@ -173,7 +173,7 @@ $ sudo named-checkzone forward.fedora.local /var/named/forward.fedora.local $ sudo named-checkzone reverse.fedora.local /var/named/reverse.fedora.local ``` -You should see a response of OK: +你应该看到 “OK” 的响应: ``` zone forward.fedora.local/IN: loaded serial 2011071001 @@ -183,50 +183,50 @@ zone reverse.fedora.local/IN: loaded serial 2011071001 OK ``` -#### Enable and start the DNS service +#### 启用并启动 DNS 服务 ``` $ sudo systemctl enable named $ sudo systemctl start named ``` -#### Configuring the resolv.conf file +#### 配置 resolv.conf 文件 -Edit the _/etc/resolv.conf_ file: +编辑 `/etc/resolv.conf` 文件: ``` $ sudo vi /etc/resolv.conf ``` -Look for your current name server line or lines. On the example system, a cable modem/router is serving as the name server and so it currently looks like this: +查找你当前的 `nameserver` 行。在示例系统上,使用调制解调器/路由器充当名称服务器,因此当前看起来像这样: ``` nameserver 192.168.1.1 ``` -This needs to be changed to the IP address of the Master DNS server: +这需要更改为主 DNS 服务器的 IP 地址: ``` nameserver 192.168.1.160 ``` -Save your changes and exit. +保存更改并退出。 -Unfortunately there is one caveat to be aware of. NetworkManager overwrites the _/etc/resolv.conf_ file if the system is rebooted or networking gets restarted. This means you will lose all of the changes that you made. +不幸的是需要注意一点。如果系统重启或网络重启,那么 NetworkManager 会覆盖 `/etc/resolv.conf` 文件。这意味着你将丢失所做的所有更改。 -To prevent this from happening, make _/etc/resolv.conf_ immutable: +为了防止这种情况发生,请将 `/etc/resolv.conf` 设为不可变: ``` $ sudo chattr +i /etc/resolv.conf ``` -If you want to set it back and allow it to be overwritten again: +如果要重新设置,就需要允许其再次被覆盖: ``` $ sudo chattr -i /etc/resolv.conf ``` -#### Testing the DNS server +#### 测试 DNS 服务器 ``` $ dig fedoramagazine.org @@ -266,27 +266,27 @@ $ dig fedoramagazine.org ;; MSG SIZE rcvd: 266 ``` -There are a few things to look at to verify that the DNS server is working correctly. Obviously getting the results back are important, but that by itself doesn’t mean the DNS server is actually doing the work. +需要检查几件事以验证 DNS 服务器是否正常运行。显然,取得结果很重要,但这本身并不意味着 DNS 服务器实际上正常工作。 -The QUERY, ANSWER, and AUTHORITY fields at the top should show non-zero as it in does in our example: +顶部的 `QUERY`、`ANSWER` 和 `AUTHORITY` 字段应显示为非零,如我们的示例所示: ``` ;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 3, ADDITIONAL: 6 ``` -And the SERVER field should have the IP address of your DNS server: +并且 `SERVER` 字段应有你的 DNS 服务器的 IP 地址: ``` ;; SERVER: 192.168.1.160#53(192.168.1.160) ``` -In case this is the first time you’ve run the _dig_ command, notice how it took 830 milliseconds for the query to complete: +如果这是你第一次运行 `dig` 命令,请注意完成查询要花费 830 毫秒的时间: ``` ;; Query time: 830 msec ``` -If you run it again, the query will run much quicker: +如果再次运行它,查询将会更快: ``` $ dig fedoramagazine.org @@ -297,37 +297,37 @@ $ dig fedoramagazine.org ;; SERVER: 192.168.1.160#53(192.168.1.160) ``` -### Client configuration +### 客户端配置 -The client configuration will be a lot simpler. +客户端配置将简单得多。 -Install the bind utilities: +安装 bind 程序: ``` $ sudo dnf install bind-utils -y ``` -Edit the /etc/resolv.conf file and configure the Master DNS as the only name server: +编辑 `/etc/resolv.conf` 文件,并将主 DNS 配置为唯一的名称服务器: ``` $ sudo vi /etc/resolv.conf ``` -This is how it should look: +它看起来像这样: ``` nameserver 192.168.1.160 ``` -Save your changes and exit. Then, make the _/etc/resolv.conf_ file immutable to prevent it from be overwritten and going back to its default settings: +保存更改并退出。然后,使 `/etc/resolv.conf` 文件不可变,防止其被覆盖并变回默认设置: ``` $ sudo chattr +i /etc/resolv.conf ``` -#### Testing the client +#### 测试客户端 -You should get the same results as you did from the DNS server: +你应该获得与 DNS 服务器相同的结果: ``` $ dig fedoramagazine.org @@ -367,9 +367,9 @@ $ dig fedoramagazine.org ;; MSG SIZE rcvd: 266 ``` -Make sure the SERVER output has the IP Address of your DNS server. +确保 `SERVER` 输出的是你 DNS 服务器的 IP 地址。 -Your DNS server is now ready to use and all requests from the client should be going through your DNS server now! +你的 DNS 服务器设置完成了,现在所有来自客户端的请求都会经过你的 DNS 服务器了! -------------------------------------------------------------------------------- @@ -377,8 +377,8 @@ via: https://fedoramagazine.org/how-to-setup-a-dns-server-with-bind/ 作者:[Curt Warfield][a] 选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) +译者:[geekpi](https://github.com/geekpi) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 diff --git a/published/202003/20200121 Syncthing- Open Source P2P File Syncing Tool.md b/published/202003/20200121 Syncthing- Open Source P2P File Syncing Tool.md new file mode 100644 index 0000000000..383fc2f351 --- /dev/null +++ b/published/202003/20200121 Syncthing- Open Source P2P File Syncing Tool.md @@ -0,0 +1,146 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11960-1.html) +[#]: subject: (Syncthing: Open Source P2P File Syncing Tool) +[#]: via: (https://itsfoss.com/syncthing/) +[#]: author: (Ankush Das https://itsfoss.com/author/ankush/) + +Syncthing:开源 P2P 文件同步工具 +====== + +> Syncthing 是一个开源的 P2P 文件同步工具,可用于在多个设备(包括 Android 手机)之间同步文件。 + +![](https://img.linux.net.cn/data/attachment/album/202003/05/094211oy2dosttvoaseovk.jpg) + +通常,我们有 [MEGA][1] 或 Dropbox 之类的云同步解决方案,以便在云上备份我们的文件,同时更易于共享。但是,如果要跨多个设备同步文件而不将其存储在云中怎么办? + +这就是 [Syncthing][2] 派上用场的地方了。 + +### Syncthing:一个跨设备同步文件的开源工具 + +![][3] + +Syncthing 可让你跨多个设备同步文件(包括对 Android 智能手机的支持)。它主要通过 Linux 上的 Web UI 进行工作,但也提供了 GUI(需要单独安装)。 + +然而,Syncthing 完全没有利用云,它是 [P2P][4] 文件同步工具。你的数据不会被发送到中央服务器。而是会在所有设备之间同步。因此,它并不能真正取代 [Linux 上的典型云存储服务][5]。 + +要添加远程设备,你只需要设备 ID(或直接扫描二维码),而无需 IP 地址。 + +如果你想要远程备份文件,那么你可能应该依靠云。 + +![Syncthing GUI][6] + +考虑到所有因素,Syncthing 可以在很多方面派上用场。从技术上讲,你可以安全、私密地在多个系统上访问重要文件,而不必担心有人监视你的数据。 + +例如,你可能不想在云上存储一些敏感文件,因此你可以添加其他受信任的设备来同步并保留这些文件的副本。 + +即使我对它的描述很简单,但它并不像看到的那么简单。如果你感兴趣的话,我建议你阅读[官方 FAQ][7] 来了解它如何工作的。 + +### Syncthing 的特性 + +你可能不希望同步工具中有很多选项。它要可靠地同步文件,应该非常简单。 + +Syncthing 确实非常简单且易于理解。即使这样,如果你想使用它的所有功能,那么也建议你阅读它的[文档][8]。 + +在这里,我将重点介绍 Syncthing 的一些有用特性: + +#### 跨平台支持 + +![Syncthing on Android][9] + +作为开源解决方案,它支持 Windows、Linux 和 macOS。 + +除此之外,它还支持 Android 智能手机。如果你使用的是 iOS 设备,那么你会感到失望。到目前为止,它还没有支持 iOS 的计划。 + +#### 文件版本控制 + +![Syncthing File Versioning][10] + +如果替换或删除了旧文件,那么 Syncthing 会利用各种[文件版本控制方法][11]来存档旧文件。 + +默认情况下,你不会发现它启用。但是,当你创建一个要同步的文件夹时,你将找到将文件版本控制切换为首选方法的选项。 + +#### 易于使用 + +作为 P2P 文件同步工具,它无需高级调整即可使用。 + +但是,它允许你在需要时配置高级设置。 + +#### 安全和隐私 + +即使你不与任何云服务提供商共享数据,仍会有一些连接可能会引起窃听者的注意。因此,Syncthing 使用 TLS 保护通信。 + +此外,它还有可靠的身份验证方法,以确保仅授予只有你允许的设备/连接能够取得同步/读取数据的权限。 + +对于 Android 智能手机,如果你使用 [Orbot 应用][12],你还可以强制将流量通过 Tor。在 Android 中你还有几个不同选择。 + +#### 其他功能 + +![][13] + +当你探索这个工具时,你会注意到可以同步的文件夹数和可同步的设备数没有限制。 + +因此,作为一个有着丰富有用特性的自由开源解决方案,对于在寻找 P2P 同步客户端的 Linux 用户而言是一个令人印象深刻的选择。 + +### 在 Linux 上安装 Syncthing + +你可能无法在官网上找到 .deb 或者 .AppImage 文件。但是,你可在 [Snap 商店][14]中找到 snap 包。如果你好奇,你可以阅读在 Linux 上[使用 snap 应用][15]的文章来开始使用。 + +你可能无法在软件中心找到它(如果你找到了,那它可能不是最新版本)。 + +**注意:**如果你需要一个 GUI 应用而不是浏览器来管理它,它还有一个 [Syncthing-GTK][16]。 + +- [Syncthing][2] + +如果你有基于 Debian 的发行版,你也可以利用终端来安装它,这些说明位于[官方下载页面][17]上。 + +### 我在 Syncthing 方面的体验 + +就个人而言,我把它安装在 Pop!_OS 19.10 上,并在写这篇文章之前用了一会儿。 + +我尝试同步文件夹、删除它们、添加重复文件以查看文件版本控制是否工作,等等。它工作良好。 + +然而,当我尝试同步它到手机(安卓),同步启动有点晚,它不是很快。因此,如果我们可以选择显式强制同步,那会有所帮助。或者,我错过了什么选项吗?如果是的话,请在评论中让我知道。 + +从技术上讲,它使用系统资源来工作,因此,如果你连接了多个设备进行同步,这可能会提高同步速度(上传/下载)。 + +总体而言,它工作良好,但我必须说,你不应该依赖它作为唯一的数据备份方案。 + +### 总结 + +你试过 Syncthing 了吗?如果有的话,你的体验如何?欢迎在下面的评论中分享。 + +此外,如果你知道一些不错的替代品,也请让我知道。 + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/syncthing/ + +作者:[Ankush Das][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://itsfoss.com/author/ankush/ +[b]: https://github.com/lujun9972 +[1]: https://itsfoss.com/install-mega-cloud-storage-linux/ +[2]: https://syncthing.net/ +[3]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/01/syncthing-screenshot.jpg?ssl=1 +[4]: https://en.wikipedia.org/wiki/Peer-to-peer +[5]: https://itsfoss.com/cloud-services-linux/ +[6]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/01/syncthing-gtk.png?ssl=1 +[7]: https://docs.syncthing.net/users/faq.html +[8]: https://docs.syncthing.net/users/index.html +[9]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/01/syncthing-android.jpg?ssl=1 +[10]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/01/syncthing-file-versioning.jpg?ssl=1 +[11]: https://docs.syncthing.net/users/versioning.html +[12]: https://play.google.com/store/apps/details?id=org.torproject.android&hl=en_IN +[13]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/01/syncthing-screenshot1.jpg?ssl=1 +[14]: https://snapcraft.io/syncthing +[15]: https://itsfoss.com/install-snap-linux/ +[16]: https://github.com/syncthing/syncthing-gtk/releases/latest +[17]: https://syncthing.net/downloads/ diff --git a/published/202003/20200123 6 things you should be doing with Emacs.md b/published/202003/20200123 6 things you should be doing with Emacs.md new file mode 100644 index 0000000000..27dfd5bb49 --- /dev/null +++ b/published/202003/20200123 6 things you should be doing with Emacs.md @@ -0,0 +1,142 @@ +[#]: collector: (lujun9972) +[#]: translator: (lujun9972) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12004-1.html) +[#]: subject: (6 things you should be doing with Emacs) +[#]: via: (https://opensource.com/article/20/1/emacs-cheat-sheet) +[#]: author: (Seth Kenlon https://opensource.com/users/seth) + +6 件你应该用 Emacs 做的事 +====== + +> 下面六件事情你可能都没有意识到可以在 Emacs 下完成。此外还有我们的新备忘单,拿去,充分利用 Emacs 的功能吧。 + +![](https://img.linux.net.cn/data/attachment/album/202003/17/133738wjj66p2safcpc50z.jpg) + +想象一下使用 Python 的 IDLE 界面来编辑文本。你可以将文件加载到内存中,编辑它们,并保存更改。但是你执行的每个操作都由 Python 函数定义。例如,调用 `upper()` 来让一个单词全部大写,调用 `open` 打开文件,等等。文本文档中的所有内容都是 Python 对象,可以进行相应的操作。从用户的角度来看,这与其他文本编辑器的体验一致。对于 Python 开发人员来说,这是一个丰富的 Python 环境,只需在配置文件中添加几个自定义函数就可以对其进行更改和开发。 + +这就是 [Emacs][2] 对 1958 年的编程语言 [Lisp][3] 所做的事情。在 Emacs 中,运行应用程序的 Lisp 引擎与输入文本之间无缝结合。对 Emacs 来说,一切都是 Lisp 数据,因此一切都可以通过编程进行分析和操作。 + +这造就了一个强大的用户界面(UI)。但是,如果你是 Emacs 的普通用户,你可能对它的能力知之甚少。下面是你可能没有意识到 Emacs 可以做的六件事。 + +### 使用 Tramp 模式进行云端编辑 + +Emacs 早在网络流行化之前就实现了透明的网络编辑能力了,而且时至今日,它仍然提供了最流畅的远程编辑体验。Emacs 中的 [Tramp 模式][4](以前称为 RPC 模式)代表着 “透明的远程(文件)访问,多协议Transparent Remote (file) Access,Multiple Protocol”,这准确说明了它提供的功能:通过最流行的网络协议轻松访问你希望编辑的远程文件。目前最流行、最安全的能用于远程编辑的协议是 [OpenSSH][5],因此 Tramp 使用它作为默认的协议。 + +在 Emacs 22.1 或更高版本中已经包含了 Tramp,因此要使用 Tramp,只需使用 Tramp 语法打开一个文件。在 Emacs 的 “File” 菜单中,选择 “Open File”。当在 Emacs 窗口底部的小缓冲区中出现提示时,使用以下语法输入文件名: + +``` +/ssh:user@example.com:/path/to/file +``` + +如果需要交互式登录,Tramp 会提示你输入密码。但是,Tramp 直接使用 OpenSSH,所以为了避免交互提示,你可以将主机名、用户名和 SSH 密钥路径添加到你的 `~/.ssh/config` 文件。与 Git 一样,Emacs 首先使用你的 SSH 配置,只有在出现错误时才会停下来询问更多信息。 + +Tramp 非常适合编辑并没有放在你的计算机上的文件,它的用户体验与编辑本地文件没有明显的区别。下次,当你 SSH 到服务器启动 Vim 或 Emacs 会话时,请尝试使用 Tramp。 + +### 日历 + +如果你喜欢文本多过图形界面,那么你一定会很高兴地知道,可以使用 Emacs 以纯文本的方式安排你的日程(或生活),而且你依然可以在移动设备上使用开源的 [Org 模式][6]查看器来获得华丽的通知。 + +这个过程需要一些配置,以创建一个方便的方式来与移动设备同步你的日程(我使用 Git,但你可以调用蓝牙、KDE Connect、Nextcloud,或其他文件同步工具),此外你必须在移动设备上安装一个 Org 模式查看器(如 [Orgzly][7])以及 Git 客户程序。但是,一旦你搭建好了这些基础,该流程就会与你常用的(或正在完善的,如果你是新用户)Emacs 工作流完美地集成在一起。你可以在 Emacs 中方便地查阅日程、更新日程,并专注于任务上。议程上的变化将会反映在移动设备上,因此即使在 Emacs 不可用的时候,你也可以保持井然有序。 + +![][8] + +感兴趣了?阅读我的关于[使用 Org mode 和 Git 进行日程安排][9]的逐步指南。 + +### 访问终端 + +有[许多终端模拟器][10]可用。尽管 Emacs 中的 Elisp 终端仿真器不是最强大的通用仿真器,但是它有两个显著的优点: + +1. **打开在 Emacs 缓冲区之中**:我使用 Emacs 的 Elisp shell,因为它在 Emacs 窗口中打开很方便,我经常全屏运行该窗口。这是一个小而重要的优势,只需要输入 `Ctrl+x+o`(或用 Emacs 符号来表示就是 `C-x o`)就能使用终端了,而且它还有一个特别好的地方在于当运行漫长的作业时能够一瞥它的状态报告。 +2. **在没有系统剪贴板的情况下复制和粘贴特别方便**:无论是因为懒惰不愿将手从键盘移动到鼠标,还是因为在远程控制台运行 Emacs 而无法使用鼠标,在 Emacs 中运行终端有时意味着可以从 Emacs 缓冲区中很快地传输数据到 Bash。 + +要尝试 Emacs 终端,输入 `Alt+x`(用 Emacs 符号表示就是 `M-x`),然后输入 `shell`,然后按回车。 + +### 使用 Racket 模式 + +[Racket][11] 是一种激动人心的新兴 Lisp 方言,拥有动态编程环境、GUI 工具包和充满激情的社区。学习 Racket 的默认编辑器是 DrRacket,它的顶部是定义面板,底部是交互面板。使用该设置,用户可以编写影响 Racket 运行时环境的定义。就像旧的 [Logo Turtle][12] 程序,但是有一个终端而不是仅仅一个海龟。 + +![Racket-mode][13] + +*由 PLT 提供的 LGPL 示例代码* + +基于 Lisp 的 Emacs 为资深 Racket 编程人员提供了一个很好的集成开发环境(IDE)。它尚未附带 [Racket 模式][14],但你可以使用 Emacs 包安装程序安装 Racket 模式和辅助扩展。要安装它,按下 `Alt+X`(用 Emacs 符号表示就是 `M-x`),键入 `package-install`,然后按回车。接着输入要安装的包 `racet-mode`,按回车。 + +使用 `M-x racket-mode` 进入 Racket 模式。如果你是 Racket 新手,而对 Lisp 或 Emacs 比较熟悉,可以从这份优秀的[图解 Racket][15] 入手。 + +## 脚本 + +你可能知道,Bash 脚本在自动化和增强 Linux 或 Unix 体验方面很流行。你可能听说过 Python 在这方面也做得很好。但是你知道 Lisp 脚本可以用同样的方式运行吗?有时人们会对 Lisp 到底有多有用感到困惑,因为许多人是通过 Emacs 来了解 Lisp 的,因此有一种潜在的印象,即在 21 世纪运行 Lisp 的惟一方法是在 Emacs 中运行。幸运的是,事实并非如此,Emacs 是一个很好的 IDE,它支持将 Lisp 脚本作为一般的系统可执行文件来运行。 + +除了 Elisp 之外,还有两种流行的现代 Lisp 可以很容易地用来作为独立脚本运行。 + +1. **Racket**:你可以通过在系统上运行 Racket 来提供运行 Racket 脚本所需的运行时支持,或者你可以使用 `raco exe` 产生一个可执行文件。`raco exe` 命令将代码和运行时支持文件一起打包,以创建可执行文件。然后,`raco distribution` 命令将可执行文件打包成可以在其他机器上工作的发行版。Emacs 有许多 Racket 工具,因此在 Emacs 中创建 Racket 文件既简单又有效。 +2. **GNU Guile**:[GNU Guile][16](GNU 通用智能语言扩展GNU Ubiquitous Intelligent Language for Extensions 的缩写)是 [Scheme][17] 编程语言的一个实现,它可以用于为桌面、互联网、终端等创建应用程序和游戏。Emacs 中的 Scheme 扩展众多,使用任何一个扩展来编写 Scheme 都很容易。例如,这里有一个用 Guile 编写的 “Hello world” 脚本: + +``` +#!/usr/bin/guile -s +!# + +(display "hello world") + (newline) +``` + +用 `guile` 编译并允许它: + +``` +$ guile ./hello.scheme +;;; compiling /home/seth/./hello.scheme +;;; compiled [...]/hello.scheme.go +hello world +$ guile ./hello.scheme +hello world +``` + +### 无需 Emacs 允许 Elisp + +Emacs 可以作为 Elisp 的运行环境,但是你无需按照传统印象中的必须打开 Emacs 来运行 Elisp。`--script` 选项可以让你使用 Emacs 作为引擎来执行 Elisp 脚本,而无需运行 Emacs 图形界面(甚至也无需使用终端)。下面这个例子中,`-Q` 选项让 Emacs 忽略 `.emacs` 文件,从而避免由于执行 Elisp 脚本时产生延迟(若你的脚本依赖于 Emacs 配置中的内容,那么请忽略该选项)。 + +``` +emacs -Q --script ~/path/to/script.el +``` + +### 下载 Emacs 备忘录 + +Emacs 许多重要功能都不是只能通过 Emacs 来实现的;Org 模式是 Emacs 扩展也是一种格式标准,流行的 Lisp 方言大多不依赖于具体的应用,我们甚至可以在没有可见或可交互式 Emacs 实例的情况下编写和运行 Elisp。然后若你对为什么模糊代码和数据之间的界限能够引发创新和效率感到好奇的话,那么 Emacs 是一个很棒的工具。 + +幸运的是,现在是 21 世纪,Emacs 有了带有传统菜单的图形界面以及大量的文档,因此学习曲线不再像以前那样。然而,要最大化 Emacs 对你的好处,你需要学习它的快捷键。由于 Emacs 支持的每个任务都是一个 Elisp 函数,Emacs 中的任何功能都可以对应一个快捷键,因此要描述所有这些快捷键是不可能完成的任务。你只要学习使用频率 10 倍于不常用功能的那些快捷键即可。 + +我们汇聚了最常用的 Emacs 快捷键成为一份 Emacs 备忘录以便你查询。将它挂在屏幕附近或办公室墙上,把它作为鼠标垫也行。让它触手可及经常翻阅一下。每次翻两下可以让你获得十倍的学习效率。而且一旦开始编写自己的函数,你一定不会后悔获取了这个免费的备忘录副本的! + +- [这里下载 Emacs 备忘录(需注册)](https://opensource.com/downloads/emacs-cheat-sheet) + +-------------------------------------------------------------------------------- +via: https://opensource.com/article/20/1/emacs-cheat-sheet + +作者:[Seth Kenlon][a] +选题:[lujun9972][b] +译者:[lujun9972](https://github.com/lujun9972) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/seth +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/browser_blue_text_editor_web.png +[2]: https://www.gnu.org/software/emacs/ +[3]: https://en.wikipedia.org/wiki/Lisp_(programming_language) +[4]: https://www.gnu.org/software/tramp/ +[5]: https://www.openssh.com/ +[6]: https://orgmode.org/ +[7]: https://f-droid.org/en/packages/com.orgzly/ +[8]: https://opensource.com/sites/default/files/uploads/orgzly-agenda.jpg +[9]: https://linux.cn/article-11320-1.html +[10]: https://linux.cn/article-11814-1.html +[11]: http://racket-lang.org/ +[12]: https://en.wikipedia.org/wiki/Logo_(programming_language)#Turtle_and_graphics +[13]: https://opensource.com/sites/default/files/racket-mode.jpg +[14]: https://www.racket-mode.com/ +[15]: https://docs.racket-lang.org/quick/index.html +[16]: https://www.gnu.org/software/guile/ +[17]: https://en.wikipedia.org/wiki/Scheme_(programming_language) diff --git a/sources/tech/20200127 Build your own cloud with Fedora 31 and Nextcloud Server.md b/published/202003/20200127 Build your own cloud with Fedora 31 and Nextcloud Server.md similarity index 61% rename from sources/tech/20200127 Build your own cloud with Fedora 31 and Nextcloud Server.md rename to published/202003/20200127 Build your own cloud with Fedora 31 and Nextcloud Server.md index 69b8ad9e06..295e111690 100644 --- a/sources/tech/20200127 Build your own cloud with Fedora 31 and Nextcloud Server.md +++ b/published/202003/20200127 Build your own cloud with Fedora 31 and Nextcloud Server.md @@ -1,63 +1,63 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: translator: (geekpi) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11964-1.html) [#]: subject: (Build your own cloud with Fedora 31 and Nextcloud Server) [#]: via: (https://fedoramagazine.org/build-your-own-cloud-with-fedora-31-and-nextcloud-server/) [#]: author: (storyteller https://fedoramagazine.org/author/storyteller/) -Build your own cloud with Fedora 31 and Nextcloud Server +使用 Fedora 31 和 Nextcloud 服务器构建自己的云 ====== ![][1] -[Nextcloud][2] is a software suite for storing and syncing your data across multiple devices. You can learn more about Nextcloud Server’s features from [https://github.com/nextcloud/server][3]. +[Nextcloud][2] 是用于跨多个设备存储和同步数据的软件套件。你可以从 [https://github.com/nextcloud/server][3] 了解有关 Nextcloud 服务器的更多特性信息。 -This article demonstrates how to build a personal cloud using Fedora and Nextcloud in a few simple steps. For this tutorial you will need a dedicated computer or a virtual machine running Fedora 31 server edition and an internet connection. +本文通过几个简单的步骤演示了如何使用 Fedora 和 Nextcloud 构建个人云。对于本教程,你将需要一台独立计算机或运行 Fedora 31 服务器版的虚拟机,还需要互联网连接。 -### Step 1: Install the prerequisites +### 步骤 1:预先安装条件 -Before installing and configuring Nextcloud, a few prerequisites must be satisfied. +在安装和配置 Nextcloud 之前,必须满足一些预先条件。 -First, install Apache web server: +首先,安装 Apache Web 服务器: ``` # dnf install httpd ``` -Next, install PHP and some additional modules. Make sure that the PHP version being installed meets [Nextcloud’s requirements][4]: +接下来,安装 PHP 和一些其他模块。确保所安装的 PHP 版本符合 [Nextcloud 的要求][4]: ``` # dnf install php php-gd php-mbstring php-intl php-pecl-apcu php-mysqlnd php-pecl-redis php-opcache php-imagick php-zip php-process ``` -After PHP is installed enable and start the Apache web server: +安装 PHP 后,启用并启动 Apache Web 服务器: ``` # systemctl enable --now httpd ``` -Next, allow _HTTP_ traffic through the firewall: +接下来,允许 HTTP 流量穿过防火墙: ``` # firewall-cmd --permanent --add-service=http # firewall-cmd --reload ``` -Next, install the MariaDB server and client: +接下来,安装 MariaDB 服务器和客户端: ``` # dnf install mariadb mariadb-server ``` -Then enable and start the MariaDB server: +然后启用并启动 MariaDB 服务器 ``` # systemctl enable --now mariadb ``` -Now that MariaDB is running on your server, you can run the _mysql_secure_installation_ command to secure it: +现在,MariaDB 正在运行,你可以运行 `mysql_secure_installation` 命令来保护它: ``` # mysql_secure_installation @@ -128,7 +128,7 @@ MariaDB installation should now be secure. Thanks for using MariaDB! ``` -Next, create a dedicated user and database for your Nextcloud instance: +接下来,为你的 Nextcloud 实例创建独立的用户和数据库: ``` # mysql -p @@ -139,23 +139,23 @@ Next, create a dedicated user and database for your Nextcloud instance: > exit; ``` -### Step 2: Install Nextcloud Server +### 步骤 2:安装 Nextcloud 服务器 -Now that the prerequisites for your Nextcloud installation have been satisfied, download and unzip [the Nextcloud archive][5]: +现在,你已满足 Nextcloud 安装的预先条件,请下载并解压 [Nextcloud 压缩包][5]: ``` # wget https://download.nextcloud.com/server/releases/nextcloud-17.0.2.zip # unzip nextcloud-17.0.2.zip -d /var/www/html/ ``` -Next, create a data folder and grant Apache read and write access to the _nextcloud_ directory tree: +接下来,创建一个数据文件夹,并授予 Apache 对 `nextcloud` 目录树的读写访问权限: ``` # mkdir /var/www/html/nextcloud/data # chown -R apache:apache /var/www/html/nextcloud ``` -SELinux must be configured to work with Nextcloud. The basic commands are those bellow, but a lot more, by features used on nexcloud installation, are posted here: [Nextcloud SELinux configuration][6] +SELinux 必须配置为可与 Nextcloud 一起使用。基本命令如下所示,但在 nexcloud 安装中还有很多其他的命令,发布在这里:[Nextcloud SELinux 配置][6]。 ``` # semanage fcontext -a -t httpd_sys_rw_content_t '/var/www/html/nextcloud/config(/.*)?' @@ -166,34 +166,32 @@ SELinux must be configured to work with Nextcloud. The basic commands are those # restorecon -Rv '/var/www/html/nextcloud/' ``` -### Step 3: Configure N**extclou**d +### 步骤 3:配置 Nextcloud -Nextcloud can be configured using its web interface or from the command line. +可以使用它的 Web 界面或在命令行配置 Nextcloud。 -#### Using the web interface +#### 使用 Web 界面 -From your favorite browser, access __ and fill the fields: +在你喜欢的浏览器中,访问 并输入字段: ![][7] -#### Using the command line +#### 使用命令行 -From the command line, just enter the following, substituting the values you used when you created a dedicated Nextcloud user in MariaDB earlier: +在命令行中,只需输入以下内容,使用你之前在 MariaDB 中创建的独立 Nextcloud 用户替换相应的值: ``` # sudo -u apache php occ maintenance:install --data-dir /var/www/html/nextcloud/data/ --database "mysql" --database-name "nextcloud" --database-user "nc_admin" --database-pass "DB_SeCuRe_PaSsWoRd" --admin-user "admin" --admin-pass "Admin_SeCuRe_PaSsWoRd" ``` -### Final Notes +### 最后几点 - * I used the _http_ protocol, but Nextcloud also works over _https_. I might write a follow-up about securing Nextcloud in a future article. - * I disabled SELinux, but your server will be more secure if you configure it. - * The recommend PHP memory limit for Nextcloud is 512M. To change it, edit the _memory_limit_ variable in the _/etc/php.ini_ configuration file and restart your _httpd_ service. - * By default, the web interface can only be accessed using the __ URL. If you want to allow access using other domain names, [you can do so by editing the _/var/www/html/nextcloud/config/config.php_ file][8]. The * character can be used to bypass the domain name restriction and allow the use of any URL that resolves to one of your server’s IP addresses. +* 我使用的是 http 协议,但是 Nextcloud 也可以在 https 上运行。我可能会在以后的文章中写一篇有关保护 Nextcloud 的文章。 +* 我禁用了 SELinux,但是如果配置它,你的服务器将更加安全。 +* Nextcloud 的建议 PHP 内存限制为 512M。要更改它,请编辑 `/etc/php.ini` 配置文件中的 `memory_limit` 变量,然后重新启动 httpd 服务。 +* 默认情况下,只能使用 URL 访问 Web 界面。如果要允许使用其他域名访问,[你可编辑 /var/www/html/nextcloud/config/config.php 来进行此操作][8]。`*` 字符可用于绕过域名限制,并允许任何解析为服务器 IP 的 URL 访问。 - - -``` + ``` 'trusted_domains' => array ( 0 => 'localhost', @@ -201,16 +199,14 @@ From the command line, just enter the following, substituting the values you use ), ``` -_— Updated on January 28th, 2020 to include SELinux configuration —_ - -------------------------------------------------------------------------------- via: https://fedoramagazine.org/build-your-own-cloud-with-fedora-31-and-nextcloud-server/ 作者:[storyteller][a] 选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) +译者:[geekpi](https://github.com/geekpi) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 diff --git a/published/202003/20200129 Use Emacs to get social and track your todo list.md b/published/202003/20200129 Use Emacs to get social and track your todo list.md new file mode 100644 index 0000000000..0d7bbc42c5 --- /dev/null +++ b/published/202003/20200129 Use Emacs to get social and track your todo list.md @@ -0,0 +1,163 @@ +[#]: collector: (lujun9972) +[#]: translator: (lujun9972) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11956-1.html) +[#]: subject: (Use Emacs to get social and track your todo list) +[#]: via: (https://opensource.com/article/20/1/emacs-social-track-todo-list) +[#]: author: (Kevin Sonney https://opensource.com/users/ksonney) + +使用 Emacs 进行社交并跟踪你的待办事项列表 +====== + +> 在 2020 年用开源实现更高生产力的二十种方式的第十九篇文章中,访问 Twitter、Reddit、 交谈、电子邮件 、RSS 和你的待办事项列表。 + +![](https://img.linux.net.cn/data/attachment/album/202003/04/100911lg2vrv92692b422y.jpg) + +去年,我在 19 天里给你介绍了 19 个新(对你而言)的生产力工具。今年,我换了一种方式:使用你在使用或者还没使用的工具,构建一个使你可以在新一年更加高效的环境。 + +### 使用 Emacs 做(几乎)所有的事情,第 2 部分 + +[昨天][2],我谈到了如何在 Emacs 中读取电子邮件、访问电子邮件地址和显示日历。Emacs 功能繁多,你还可以将它用于 Twitter、交谈、待办事项列表等等! + +![在 Emacs 中处理所有事情][3] + +要完成所有这些,你需要安装一些 Emacs 包。和昨天一样,用 `Meta+x package-manager` 打开 Emacs 包管理器(Meta 键在大多数键盘上是 `Alt`,在 MacOS 上是 `Option`)。然后通过 `i` 选择以下带有的软件包,然后输入 `x` 进行安装: + +``` +nnreddit +todotxt +twittering-mode +``` + +安装之后,按下 `Ctrl+x ctrl+f` 打开 `~/.emacs.d/init.el`,并在 `(custom-set-variables` 行前加上: + +``` +;; Todo.txt +(require 'todotxt) +(setq todotxt-file (expand-file-name "~/.todo/todo.txt")) + +;; Twitter +(require 'twittering-mode) +(setq twittering-use-master-password t) +(setq twittering-icon-mode t) + +;; Python3 for nnreddit +(setq elpy-rpc-python-command "python3") +``` + +按下 `Ctrl+x Ctrl+s` 保存文件,使用 `Ctrl+x Ctrl+c` 退出 Emacs,然后重启 Emacs。 + +#### 使用 twittering-mode 在 Emacs 中发推 + +![Emacs 中的 Twitter][4] + +[Twittering-mode][5] 是 Twitter 最好的 Emacs 接口之一。它几乎支持 Twitter 的所有功能,并且键盘快捷键也易于使用。 + +首先,输入 `Meta+x twit` 来启动 twittering-mode。它会提供一个 URL 并提示你启动浏览器来访问它,你登录该 URL 后就能获得授权令牌。将令牌复制并粘贴到 Emacs 中,你的 Twitter 时间线就会加载了。你可以使用箭头键滚动,使用 `Tab` 从一个项目移动到另一个项目,并按回车访问光标所在的 URL。如果光标在用户名上,按回车将在 web 浏览器中打开时间轴。如果你在一条推文的文本上,按回车将回复该推文。你可以用 `u` 创建一个新的推文,用 `Ctrl+c+Enter` 转发一些内容,然后用 `d` 发送一条即时消息——它打开的对话框中有关于如何发送、取消和缩短 URL 的说明。 + +按 `V` 会打开一个提示让你跳转到其他时间线。输入 `:mentions` 打开你的提及。输入 `:home` 打开你的主时间线,输入用户名将进入该用户的时间线。最后,按 `q` 会退出 twittering-mode 并关闭窗口。 + +twitter-mode 还有更多功能,我鼓励你阅读它 GitHub 页面上的[完整功能列表][6]。 + +#### 在 Emacs 上使用 Todotxt.el 追踪你的待办事项 + +![Emacs 中的 todo.txt][7] + +[Todotxt.el][8] 是一个很棒的 [todo.txt][9] 待办列表管理器接口。它的快捷键几乎无所不包。 + +输入 `Meta+x todotxt` 启动它将加载 `todotxt-file` 变量中指定的 `todo.txt` 文件(本文的第一部分中设置了该文件)。在 `todo.txt` 的缓冲区(窗口),你可以按 `a` 添加新任务并和按 `c` 标记它已被完成。你还可以使用 `r` 设置优先级,并使用 `t` 添加项目和上下文。完成事项后只需要按下 `A` 即可将任务移如 `done.txt`。你可以使用 `/` 过滤列表,也可以使用 `l` 刷新完整列表。同样,你可以按 `q` 退出。 + +#### 在 Emacs 中使用 ERC 进行交谈 + +![使用 ERC 与人交谈 ][10] + +Vim 的缺点之一是很难用它与人交谈。另一方面,Emacs 则将 [ERC][11] 客户端内置到默认发行版中。使用 `Meta+x ERC` 启动 ERC,系统将提示你输入服务器、用户名和密码。你可以使用几天前介绍设置 [BitlBee][12] 时使用的相同信息:服务器为 `localhost`,端口为 `6667`,相同用户名,无需密码。 + +ERC 使用起来与其他 IRC 客户端一样。每个频道单独一个缓冲区(窗口),你可以使用 `Ctrl+x ctrl+b` 进行频道间切换,这也可以在 Emacs 中的其他缓冲区之间进行切换。`/quit` 命令将退出 ERC。 + +#### 使用 Gnus 阅读电子邮件,Reddit 和 RSS + +![Mail,Reddit,and RSS feeds with Gnus][13] + +我相信昨天在我提及在 Emacs 中阅读邮件时,许多 Emacs 的老用户会问,“怎么没有 [Gnus][14] 呢?” + +这个疑问很合理。Gnus 是一个内置在 Emacs 中的邮件和新闻阅读器,尽管它这个邮件阅读器不支持以 [Notmuch][15] 作为搜索引擎。但是,如果你将其配置来阅读 Reddit 和 RSS feed(稍后你将这样做),那么同时使用它来阅读邮件是个聪明的选择。 + +Gnus 是为阅读 Usenet 新闻而创建的,并从此发展而来。因此,它的很多外观和感觉(以及术语)看起来很像 Usenet 的新闻阅读器。 + +Gnus 以 `~/.gnus` 作为自己的配置文件。(该配置也可以包含在 `~/.emacs.d/init.el` 中)。使用 `Ctrl+x Ctrl+f` 打开 `~/.gnus`,并添加以下内容: + + +``` +;; Required packages +(require 'nnir) +(require 'nnrss) + +;; Primary Mailbox +(setq gnus-select-method +      '(nnmaildir "Local" +                  (directory "~/Maildir") +                  (nnir-search-engine notmuch) +      )) +(add-to-list 'gnus-secondary-select-methods +             '(nnreddit "")) +``` + +用 `Ctrl+x Ctrl+s` 保存文件。这分配置告诉 Gnus 从 `~/Maildir` 这个本地邮箱中读取邮件作为主源(参见 `gnus-select-method` 变量),并使用 [nnreddit][16] 插件添加辅源(`gnus-secondary-select-methods` 变量)。你还可以定义多个辅助源,包括 Usenet 新闻(nntp)、IMAP (nnimap)、mbox(nnmbox)和虚拟集合(nnvirtual)。你可以在 [Gnus 手册][17] 中了解更多有关所有选项的信息。 + +保存文件后,使用 `Meta+x Gnus` 启动 Gnus。第一次运行将在 Python 虚拟环境中安装 [Reddit 终端查看器][18],Gnus 通过它获取 Reddit 上的文章。然后它会启动浏览器来登录 Reddit。之后,它会扫描并加载你订阅的 Reddit 群组。你会看到一个有新邮件的邮件夹列表和一个有新内容的看板列表。在任一列表上按回车将加载该组中的消息列表。你可以使用箭头键导航并按回车加载和读取消息。在查看消息列表时,按 `q` 将返回到前一个视图,从主窗口按 `q` 将退出 Gnus。在阅读 Reddit 群组时,`a` 会创建一条新消息;在邮件组中,`m` 创建一个新的电子邮件;并且在任何一个视图中按 `r` 回复邮件。 + +你还可以向 Gnus 接口中添加 RSS 流,并像阅读邮件和新闻组一样阅读它们。要添加 RSS 流,输入 `G+R` 并填写 RSS 流的 URL。会有提示让你输入 RSS 的标题和描述,这些信息可以从流中提取出来并填充进去。现在输入 `g` 来检查新消息(这将检查所有组中的新消息)。阅读 RSS 流 就像阅读 Reddit 群组和邮件一样,它们使用相同的快捷键。 + +Gnus 中有*很多*功能,还有大量的键组合。[Gnus 参考卡][19]为每个视图列出了所有这些键组合(以非常小的字体显示在 5 页纸上)。 + +#### 使用 nyan-mode 查看位置 + +最后,你可能会一些截屏底部注意到 [Nyan cat][20]。这是 [nyan-mode][21],它指示了你在缓冲区中的位置,因此当你接近文档或缓冲区的底部时,它会变长。你可以使用包管理器安装它,并在 `~/.emacs.d/init.el` 中使用以下代码进行设置: + +``` +;; Nyan Cat +(setq nyan-wavy-trail t) +(setq nyan-bar-length 20) +(nyan-mode) +``` + +### Emacs 的基本功能 + +这只是 Emacs 所有功能的皮毛。Emacs *非常*强大,是我用来提高工作效率的必要工具之一,无论我是在追踪待办事项、阅读和回复邮件、编辑文本,还是与朋友和同事交流我都用它。这需要一点时间来适应,但是一旦你习惯了,它就会成为你桌面上最有用的工具之一。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/1/emacs-social-track-todo-list + +作者:[Kevin Sonney][a] +选题:[lujun9972][b] +译者:[lujun9972](https://github.com/lujun9972) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/ksonney +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/talk_chat_team_mobile_desktop.png?itok=d7sRtKfQ (Team communication, chat) +[2]: https://linux.cn/article-11932-1.html +[3]: https://opensource.com/sites/default/files/uploads/productivity_19-1.png (All the things with Emacs) +[4]: https://opensource.com/sites/default/files/uploads/productivity_19-2.png (Twitter in Emacs) +[5]: https://github.com/hayamiz/twittering-mode +[6]: https://github.com/hayamiz/twittering-mode#features +[7]: https://opensource.com/sites/default/files/uploads/productivity_19-3.png (todo.txt in emacs) +[8]: https://github.com/rpdillon/todotxt.el +[9]: http://todotxt.org/ +[10]: https://opensource.com/sites/default/files/uploads/productivity_19-4.png (Chatting with erc) +[11]: https://www.gnu.org/software/emacs/manual/html_mono/erc.html +[12]: https://linux.cn/article-11856-1.html +[13]: https://opensource.com/sites/default/files/uploads/productivity_19-5.png (Mail, Reddit, and RSS feeds with Gnus) +[14]: https://www.gnus.org/ +[15]: https://linux.cn/article-11807-1.html +[16]: https://github.com/dickmao/nnreddit +[17]: https://www.gnus.org/manual/gnus.html +[18]: https://pypi.org/project/rtv/ +[19]: https://www.gnu.org/software/emacs/refcards/pdf/gnus-refcard.pdf +[20]: http://www.nyan.cat/ +[21]: https://github.com/TeMPOraL/nyan-mode diff --git a/published/202003/20200130 4 open source productivity tools on my wishlist.md b/published/202003/20200130 4 open source productivity tools on my wishlist.md new file mode 100644 index 0000000000..533247844b --- /dev/null +++ b/published/202003/20200130 4 open source productivity tools on my wishlist.md @@ -0,0 +1,99 @@ +[#]: collector: (lujun9972) +[#]: translator: (wxy) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11961-1.html) +[#]: subject: (4 open source productivity tools on my wishlist) +[#]: via: (https://opensource.com/article/20/1/open-source-productivity-tools) +[#]: author: (Kevin Sonney https://opensource.com/users/ksonney) + +我的愿望清单上的 4 种开源生产力工具 +====== + +> 在 2020 年用开源实现更高生产力的二十种方式的最后一篇文章中,了解开源世界还需要什么。 + +![](https://img.linux.net.cn/data/attachment/album/202003/05/100642k52u7oydcwnc1c2w.jpg) + +去年,我在 19 天里给你介绍了 19 个新(对你而言)的生产力工具。今年,我换了一种方式:使用你在使用或者还没使用的工具,构建一个使你可以在新一年更加高效的环境。 + +### 然而… + +在搜索生产力应用程序时,我找不到想要的所有应用,而且几乎总是会丢失一些读者与我分享的精彩内容。 因此,当我结束本系列文章时,是时候[再次][2]谈论我在本年度系列文章中未能涵盖的一些主题。 + +![Desktop with Joplin, Emacs, and Firefox][3] + +#### 在 Vim 中聊天 + +我试过了。我真的非常、非常想能够在 Vim 中聊天,但我做不到。我找到的一个软件包 [VimIRC.vim][4] 一直就工作不起来,我试了几天也没用。我探索的另一个选项是 [Irc it][5],这需要我付出更多的[努力去设置][6],超过了我正常可以付出的耐心或时间。我尝试过了,也确实做到了,但对于同处于相同境地的 Vim 用户,对不起,我无法帮到你。 + +#### Org 模式 + +![Org Mode in Emacs][7] + +我喜欢 [Org 模式][8],并且每天都使用它。关于 Org 模式我可以滔滔不绝的说上几天。它提供了基本的[任务跟踪][9];谷歌[日历][10]同步和 [CalFW][11] 集成;富文本文档、网站和演示文稿;链接到任何事物;等等、等等…… + +我希望你会在 2020 年从我这里收到更多有关 Org 模式的信息,因为它真的很酷。 + +#### 图形用户界面程序 + +在 2019 年的生产力系列中,我共享了很多图形用户界面程序,而今年几乎都是命令行应用程序。有一些很棒的图形程序可以帮助解决我今年谈论的一些问题,例如可以使用 Maildir 邮箱的[邮件][12]程序、用于读取本地日历文件的日历程序、[天气][13]应用程序等等。我甚至尝试了几项对我而言新奇的事物,看它们是否适合这个主题。除了 [twin][14] 之外,我没有感觉到有什么图形用户界面程序是新颖的(对我而言)或值得注意的(同样对我而言)是今年要写的。至于…… + +#### 移动应用程序 + +越来越多的人将平板电脑(有时与笔记本电脑结合使用)作为主要设备。我将手机用于大多数社交媒体和即时消息传递,并且经常使用平板电脑(好的,老实说,好几个平板电脑)来阅读或浏览网络。可以肯定的是,并不是没有开源移动应用程序,但是它们与我今年的主题不符。开源和移动应用程序正在发生很多变化,我正在仔细地寻找可以帮助我在手机和平板电脑上提高工作效率的事物。 + +### 该你了 + +非常感谢你阅读今年的系列文章。请你发表评论,告诉我错过的或需要在 2021 年看到的内容。正如我在 [Productivity Alchemy][15] 播客上所说:“哥们,记着:要保持生产力!” + +### 本系列汇总 + +1. [使用 Syncthing 在多个设备间同步文件](https://linux.cn/article-11793-1.html) +2. [使用 Stow 管理多台机器配置](https://linux.cn/article-11796-1.html) +3. [使用 OfflineIMAP 同步邮件](https://linux.cn/article-11804-1.html) +4. [使用 Notmuch 组织你的邮件](https://linux.cn/article-11807-1.html) +5. [使用 khal 和 vdirsyncer 组织和同步你的日历](https://linux.cn/article-11812-1.html) +6. [用于联系人管理的三个开源工具](https://linux.cn/article-11834-1.html) +7. [开始使用开源待办事项清单管理器](https://linux.cn/article-11835-1.html) +8. [使用这个 Python 程序记录你的活动](https://linux.cn/article-11846-1.html) +9. [一个通过 IRC 管理所有聊天的开源聊天工具](https://linux.cn/article-11856-1.html) +10. [使用这个 Twitter 客户端在 Linux 终端中发推特](https://linux.cn/article-11858-1.html) +11. [在 Linux 终端中阅读 Reddit](https://linux.cn/article-11869-1.html) +12. [使用此开源工具在一起收取你的 RSS 订阅源和播客](https://linux.cn/article-11876-1.html) +13. [使用这个开源工具获取本地天气预报](https://linux.cn/article-11879-1.html) +14. [使用此开源窗口环境一次运行多个控制台](https://linux.cn/article-11892-1.html) +15. [使用 tmux 创建你的梦想主控台](https://linux.cn/article-11900-1.html) +16. [使用 Vim 发送邮件和检查日历](https://linux.cn/article-11908-1.html) +17. [使用 Vim 管理任务列表和访问 Reddit 和 Twitter](https://linux.cn/article-11912-1.html) +18. [使用 Emacs 发送电子邮件和检查日历](https://linux.cn/article-11932-1.html) +19. [使用 Emacs 进行社交并跟踪你的待办事项列表](https://linux.cn/article-11956-1.html) +20. [我的愿望清单上的 4 种开源生产力工具](https://linux.cn/article-11961-1.html) + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/1/open-source-productivity-tools + +作者:[Kevin 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://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/world_hands_diversity.png?itok=zm4EDxgE (Two diverse hands holding a globe) +[2]: https://opensource.com/article/19/1/productivity-tool-wish-list +[3]: https://opensource.com/sites/default/files/uploads/productivity_20-1.png (Desktop with Joplin, Emacs, and Firefox) +[4]: https://github.com/vim-scripts/VimIRC.vim +[5]: https://tools.suckless.org/ii/ +[6]: https://www.reddit.com/r/vim/comments/48t7ws/vim_ii_irc_client_xpost_runixporn/d0macnl/ +[7]: https://opensource.com/sites/default/files/uploads/productivity_20-2.png (Org Mode in Emacs) +[8]: https://orgmode.org/ +[9]: https://opensource.com/article/20/1/open-source-to-do-list +[10]: https://opensource.com/article/20/1/open-source-calendar +[11]: https://github.com/kiwanami/emacs-calfw +[12]: https://opensource.com/article/20/1/organize-email-notmuch +[13]: https://opensource.com/article/20/1/open-source-weather-forecast +[14]: https://github.com/cosmos72/twin +[15]: https://productivityalchemy.com diff --git a/published/202003/20200204 DevOps vs Agile- What-s the difference.md b/published/202003/20200204 DevOps vs Agile- What-s the difference.md new file mode 100644 index 0000000000..e221cbc775 --- /dev/null +++ b/published/202003/20200204 DevOps vs Agile- What-s the difference.md @@ -0,0 +1,160 @@ +[#]: collector: "lujun9972" +[#]: translator: "messon007" +[#]: reviewer: "wxy" +[#]: publisher: "wxy" +[#]: url: "https://linux.cn/article-12031-1.html" +[#]: subject: "DevOps vs Agile: What's the difference?" +[#]: via: "https://opensource.com/article/20/2/devops-vs-agile" +[#]: author: "Taz Brown https://opensource.com/users/heronthecli" + +DevOps 和敏捷:究竟有什么区别? +====== + +> 两者之间的区别在于开发完毕之后发生的事情。 + +![](https://img.linux.net.cn/data/attachment/album/202003/23/200609w2rlzrjjhpf2hzsq.jpg) + +早期,软件开发并没有特定的管理流程。随后出现了[瀑布开发流程][2]Waterfall,它提出软件开发活动可以用开发和构建应用所耗费的时间来定义。 + +那时候,由于在开发流程中没有审查环节和权衡考虑,常常需要花费很长的时间来开发、测试和部署软件。交付的软件也是带有缺陷和 Bug 的质量较差的软件,而且交付时间也不满足要求。那时候软件项目管理的重点是长期而拖沓的计划。 + +瀑布流程与[三重约束模型][3]triple constraint model相关,三重约束模型也称为项目管理三角形project management triangle。三角形的每一个边代表项目管理三要素的一个要素: **范围、时间和成本**。正如 [Angelo Baretta 写到][4],三重约束模型“认为成本是时间和范围的函数,这三个约束以一种确定的、可预测的方式相互作用。……如果我们想缩短时间表(时间),就必须增加成本。如果我们想增加范围,就必须增加成本或时间。” + +### 从瀑布流程过渡到敏捷开发 + +瀑布流程来源于生产和工程领域,这些领域适合线性化的流程:正如房屋封顶之前需要先盖好支撑墙。相似地,软件开发问题被认为可以通过提前做好计划来解决。从头到尾,开发流程均由路线图清晰地定义,沿着路线图就可以得到最终交付的产品。 + +最终,瀑布模型被认为对软件开发是不利的而且违反人的直觉,因为通常直到开发流程的最后才能体现出项目的价值,这导致许多项目最终都以失败告终。而且,在项目结束前客户看不到任何可以工作的软件。 + +敏捷Agile采用了一种不同的方法,它抛弃了规划整个项目,承诺估计的时间点,简单的遵循计划。与瀑布流程相反,它假设和拥抱不确定性。它的理念是以响应变化代替讨论过去,它认为变更是客户需求的一部分。 + +### 敏捷价值观 + +敏捷由敏捷宣言Agile Manifesto代言,敏捷宣言定义了 [12 条原则][5](LCTT 译注:此处没有采用本文原本的简略句式,而是摘录了来自敏捷软件开发宣言官方的[中文译本][14]): + +1. 我们最重要的目标,是通过持续不断地及早交付有价值的软件使客户满意。 +2. 欣然面对需求变化,即使在开发后期也一样。 +3. 经常交付可工作的软件,相隔几星期或一两个月,倾向于采取较短的周期。 +4. 业务人员和开发人员必须相互合作,项目中的每一天都不例外。 +5. 激发个体的斗志,以他们为核心搭建项目。提供所需的环境和支援,辅以信任,从而达成目标。 +6. 面对面沟通是传递信息的最佳的也是效率最高的方法。 +7. 可工作的软件是进度的首要度量标准。 +8. 敏捷流程倡导可持续的开发,责任人、开发人员和用户要能够共同维持其步调稳定延续。 +9. 坚持不懈地追求技术卓越和良好设计,敏捷能力由此增强。 +10. 以简洁为本,它是极力减少不必要工作量的艺术。 +11. 最好的架构,需求和设计出自自组织团队 +12. 团队定期地反思如何能提高成效,并依此调整自身的举止表现。 + +敏捷的四个[核心价值观][6]是(LCTT 译注:[此处译文][15]同样来自敏捷软件开发宣言官方): + +* **个体和互动** 高于流程和工具 +* **工作的软件** 高于详尽的文档 +* **客户合作** 高于合同谈判 +* **响应变化** 高于遵循计划 + +这与瀑布流程死板的计划风格相反。在敏捷流程中,客户是开发团队的一员,而不仅仅是在项目开始时参与项目需求的定义,在项目结束时验收最终的产品。客户帮忙团队完成[验收标准][7],并在整个过程中保持投入。另外,敏捷需要整个组织的变化和持续的改进。开发团队和其他团队一起合作,包括项目管理团队和测试团队。做什么和计划什么时候做由指定的角色领导,并由整个团队同意。 + +### 敏捷软件开发 + +敏捷软件开发需要自适应的规划、演进式的开发和交付。许多软件开发方法、框架和实践遵从敏捷的理念,包括: + +* Scrum +* 看板Kanban(可视化工作流) +* 极限编程Xtreme Programming(XP) +* 精益方法Lean +* DevOps +* 特性驱动开发Feature-Driven Development(FDD) +* 测试驱动开发Test-Driven Development(TDD) +* 水晶方法Crystal +* 动态系统开发方法Dynamic Systems Development Method(DSDM) +* 自适应软件开发Adaptive Software Development(ASD) + +所有这些已经被单独用于或一起用于开发和部署软件。最常用的是 [Scrum][8]、看板(或 Scrumban)和 DevOps。 + +[Scrum][9] 是一个框架,采用该框架的团队通常由一个 Scrum 教练、产品经理和开发人员组成,该团队以跨职能、自主的工作方式运作,能够加快软件交付速度从而给客户带来巨大的商业价值。其关注点是[较小增量][10]的快速迭代。 + +[看板][11] 是一个敏捷框架,有时也叫工作流管理系统,它能帮助团队可视化他们的工作从而最大化效率(因而变得敏捷)。看板通常由数字或物理展示板来呈现。团队的工作在展示板上随着进度而移动,例如从未启动到进行中,一直到测试中、已完成。看板使得每个团队成员可以随时查看到所有工作的状态。 + +### DevOps 价值观 + +DevOps 是一种文化,是一种思维状态,是一种软件开发的方式或者基础设施的方式,也是一种构建和部署软件和应用的方式。它假设开发和运维之间没有隔阂,他们一起合作,没有矛盾。 + +DevOps 基于其它两个领域的实践: 精益和敏捷。DevOps 不是一个公司内的岗位或角色;它是一个组织或团队对持续交付、持续部署和持续集成的坚持不懈的追求。[Gene Kim][12](Phoenix 项目和 Unicorn 项目的作者)认为,有三种方式定义 DevOps 的理念: + +* 第一种: 流程原则 +* 第二种: 反馈原则 +* 第三种: 持续学习原则 + +### DevOps 软件开发 + +DevOps 不会凭空产生;它是一种灵活的实践,它的本质是一种关于软件开发和 IT 或基础设施实施的共享文化和思维方式。 + +当你想到自动化、云、微服务时,你会想到 DevOps。在一次[访谈][13]中,《加速构建和扩张高性能技术组织》的作者 Nicol Forsgren、Jez Humble 和 Gene Kim 这样解释到: + +> * 软件交付能力很重要,它极大地影响到组织的成果,例如利润、市场份额、质量、客户满意度以及组织战略目标的达成。 +> * 优秀的团队能达到很高的交付量、稳定性和质量;他们并没有为了获得这些属性而进行取舍。 +> * 你可以通过实施精益、敏捷和 DevOps 中的实践来提升能力。 +> * 实施这些实践和能力也会影响你的组织文化,并且会进一步对你的软件交付能力和组织能力产生有益的提升。 +> * 懂得怎样改进能力需要做很多工作。 + +### DevOps 和敏捷的对比 + +DevOps 和敏捷有相似性,但是它们不完全相同,一些人认为 DevOps 比敏捷更好。为了避免造成混淆,深入地了解它们是很重要的。 + +#### 相似之处 + +* 毫无疑问,两者都是软件开发技术。 +* 敏捷已经存在了 20 多年,DevOps 是最近才出现的。 +* 两者都追求软件的快速开发,它们的理念都基于怎样在不伤害客户或运维利益的情况下快速开发出软件。 + +#### 不同之处 + +* 两者的差异在于软件开发完成后发生的事情。 + * 在 DevOps 和敏捷中,都有软件开发、测试和部署的阶段。然而,敏捷流程在这三个阶段之后会终止。相反,DevOps 包括后续持续的运维。因此,DevOps 会持续的监控软件运行情况和进行持续的开发。 +* 敏捷中,不同的人负责软件的开发、测试和部署。而 DevOps 工程角色负责所有活动,开发即运维,运维即开发。 +* DevOps 更关注于削减成本,而敏捷则是精益和减少浪费的代名词,侧重于像敏捷项目会计和最小可行产品的概念。 +* 敏捷专注于并体现了经验主义(适应、透明和检查),而不是预测性措施。 + +敏捷 | DevOps +--- | --- +从客户得到反馈 | 从自己得到反馈 +较小的发布周期 | 较小的发布周期,立即反馈 +聚焦于速度 | 聚焦于速度和自动化 +对业务不是最好 | 对业务最好 + +### 总结 + +敏捷和 DevOps 是截然不同的,尽管它们的相似之处使人们认为它们是相同的。这对敏捷和 DevOps 都是一种伤害。 + +根据我作为一名敏捷专家的经验,我发现对于组织和团队从高层次上了解敏捷和 DevOps 是什么,以及它们如何帮助团队更高效地工作,更快地交付高质量产品从而提高客户满意度非常有价值。 + +敏捷和 DevOps 绝不是对抗性的(或至少没有这个意图)。在敏捷革命中,它们更像是盟友而不是敌人。敏捷和 DevOps 可以相互协作一致对外,因此可以在相同的场合共存。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/2/devops-vs-agile + +作者:[Taz Brown][a] +选题:[lujun9972][b] +译者:[messon007](https://github.com/messon007) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/heronthecli +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/collab-team-pair-programming-code-keyboard.png?itok=kBeRTFL1 "Pair programming" +[2]: http://www.agilenutshell.com/agile_vs_waterfall +[3]: https://en.wikipedia.org/wiki/Project_management_triangle +[4]: https://www.pmi.org/learning/library/triple-constraint-erroneous-useless-value-8024 +[5]: http://agilemanifesto.org/principles.html +[6]: https://agilemanifesto.org/ +[7]: https://www.productplan.com/glossary/acceptance-criteria/ +[8]: https://opensource.com/article/19/8/scrum-vs-kanban +[9]: https://www.scrum.org/ +[10]: https://www.scrum.org/resources/what-is-an-increment +[11]: https://www.atlassian.com/agile/kanban +[12]: https://itrevolution.com/the-unicorn-project/ +[13]: https://www.infoq.com/articles/book-review-accelerate/ +[14]: http://agilemanifesto.org/iso/zhchs/principles.html +[15]: http://agilemanifesto.org/iso/zhchs/manifesto.html diff --git a/published/202003/20200211 Basic kubectl and Helm commands for beginners.md b/published/202003/20200211 Basic kubectl and Helm commands for beginners.md new file mode 100644 index 0000000000..5cb41e2c38 --- /dev/null +++ b/published/202003/20200211 Basic kubectl and Helm commands for beginners.md @@ -0,0 +1,198 @@ +[#]: collector: (lujun9972) +[#]: translator: (wxy) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12007-1.html) +[#]: subject: (Basic kubectl and Helm commands for beginners) +[#]: via: (https://opensource.com/article/20/2/kubectl-helm-commands) +[#]: author: (Jessica Cherry https://opensource.com/users/jrepka) + +适用于初学者的基本 kubectl 和 Helm 命令 +====== + +> 去杂货店“采购”这些命令,你需要用这些 Kubernetes 工具来入门。 + +![](https://img.linux.net.cn/data/attachment/album/202003/18/113120adp34myy90eb944b.jpg) + +最近,我丈夫告诉我他即将要去参加一个工作面试,面试时他需要在计算机上运行一些基本命令。他对这场面试感到焦虑,但是对于他来说,学习和记住事情的最好方法是将不了解的事物比喻为非常熟悉的事物。因为我们的谈话是在我逛杂货店试图决定当晚要烹饪的食物之后进行的,所以这启发我用一次去杂货店的行程来介绍 `kubectl` 和 `helm` 命令。 + +[Helm][2](“舵轮”)是在 Kubernetes(来自希腊语,意思是“舵手” 或 “领航员”)中管理应用程序的工具。你可以轻松地使用你的应用程序信息来部署“海图chart”,从而可以在你的 Kubernetes 环境中几分钟之内让它们就绪并预配置好。在学习新知识时,查看示例的“海图”以了解其用法总是很有帮助的,因此,如果有时间,请查看这些成型的“[海图][3]”。(LCTT 译注:Kubernetes 生态中大量使用了和航海有关的比喻,因此本文在翻译时也采用了这些比喻) + +[kubectl][4] 是与 Kubernetes 环境交互的命令行界面,允许你配置和管理集群。它需要一些配置才能在环境中工作,因此请仔细阅读其[文档][5]以了解你需要做什么。 + +我会在示例中使用命名空间,你可以在我的文章《[Kubernetes 命名空间入门][6]》中了解它。 + +现在我们已经准备好了,让我们开始 `kubectl`和 `helm` 基本命令的购物之旅! + +### 用 Helm 列出清单 + +你去商店之前要做的第一件事是什么?好吧,如果你做事有条理,会创建一个“清单”。同样,这是我将解释的第一个基本的 Helm 命令。 + +在一个用 Helm 部署的应用程序中,`list` 命令提供有关应用程序当前版本的详细信息。在此示例中,我有一个已部署的应用程序:Jenkins CI/CD 应用程序。运行基本的 `list` 命令总是会显示默认的命名空间。由于我没有在默认的命名空间中部署任何内容,因此不会显示任何内容: + +``` +$helm list +NAME    NAMESPACE    REVISION    UPDATED    STATUS    CHART    APP VERSION +``` + +但是,如果运行带有额外标志的命令,则会显示我的应用程序和信息: + +``` +$helm list --all-namespaces +NAME     NAMESPACE  REVISION  UPDATED                   STATUS      CHART           APP  VERSION +jenkins  jenkins        1         2020-01-18 16:18:07 EST   deployed    jenkins-1.9.4   lts +``` + +最后,我可以指示 `list` 命令只检查我想从中获取信息的命名空间: + +``` +$helm list --namespace jenkins +NAME     NAMESPACE  REVISION  UPDATED                   STATUS    CHART          APP VERSION +jenkins    jenkins      1              2020-01-18 16:18:07 EST  deployed  jenkins-1.9.4  lts     +``` + +现在我有了一个清单,并且知道该清单上有什么,我可以使用 `get` 命令来“获取”我的物品!我会从 Kubernetes 集群开始,看看我能从中获取到什么? + +### 用 Kubectl 获取物品 + +`kubectl get` 命令提供了有关 Kubernetes 中许多事物的信息,包括“吊舱Pod”、节点和命名空间。同样,如果没有指定命名空间标志,就会使用默认的命名空间。首先,我获取集群中的命名空间以查看正在运行的命名空间: + +``` +$kubectl get namespaces +NAME             STATUS   AGE +default          Active   53m +jenkins          Active   44m +kube-node-lease  Active   53m +kube-public      Active   53m +kube-system      Active   53m +``` + +现在我已经知道了在我的环境中运行的有哪些命名空间了,接下来获取节点并查看有多少个节点正在运行: + +``` +$kubectl get nodes +NAME       STATUS   ROLES       AGE   VERSION +minikube   Ready    master  55m   v1.16.2 +``` + +我有一个节点正在运行,这主要是因为我的 Minikube 运行在一台小型服务器上。要得到在我的这一个节点上运行的“吊舱”可以这样: + +``` +$kubectl get pods +No resources found in default namespace. +``` + +啊哦,它是空的。我将通过以下方式获取 Jenkins 命名空间中的内容: + +``` +$kubectl get pods --namespace jenkins +NAME                      READY  STATUS   RESTARTS  AGE +jenkins-7fc688c874-mh7gv  1/1    Running  0         40m +``` + +好消息!这里发现了一个“吊舱”,它还没有重新启动过,已运行了 40 分钟了。好的,如今我知道“吊舱”已经装好,所以我想看看用 Helm 命令可以得到什么。 + +### 用 Helm 获取信息 + +`helm get` 命令稍微复杂一点,因为这个“获取”命令所需要的不仅仅是一个应用程序名称,而且你可以从应用程序中请求多个内容。我会从获取用于制作该应用程序的值开始,然后展示“获取全部”的操作结果的片段,该操作将提供与该应用程序相关的所有数据。 + +``` +$helm get values jenkins -n jenkins +USER-SUPPLIED VALUES: +null +``` + +由于我只安装了最小限度的稳定版,因此配置没有更改。如果我运行“获取全部”命令,我将得到所有的“海图”: + +``` +$helm get all jenkins -n jenkins +``` + +![output from helm get all command][7] + +这会产生大量数据,因此我始终建议保留一份 Helm “海图”的副本,以便你可以查看“海图”中的模板。我还创建自己的值来了解自己所拥有的。 + +现在,我把所有的商品都放在购物车中了,我会检查一下“描述”它们包含什么的标签。这些示例仅与 `kubectl` 命令有关,它们描述了我通过 Helm 部署的内容。 + +### 用 kubectl 查看描述 + +正如我使用“获取”命令(该命令可以描述 Kubernetes 中的几乎所有内容)所做的那样,我将示例限定到命名空间、“吊舱”和节点上。由于我知道它们每一个是什么,因此这很容易。 + +``` +$kubectl describe ns jenkins +Name:           jenkins +Labels:         <none> +Annotations:  <none> +Status:         Active +No resource quota. +No resource limits. +``` + +我可以看到我的命名空间的名称,并且它是活动的,没有资源或限额限制。 + +`describe pods` 命令会产生大量信息,因此我这里提供的是一小段输出。如果你在不使用“吊舱”名称的情况下运行该命令,它将返回名称空间中所有“吊舱”的信息,这可能会很麻烦。因此,请确保在此命令中始终包含“吊舱”名称。例如: + +``` +$kubectl describe pods jenkins-7fc688c874-mh7gv --namespace jenkins +``` + +![output of kubectl-describe-pods][8] + +这会提供容器的状态、管理方式、标签以及“吊舱”中所使用的镜像(还有很多其它信息)。没有在这个简化过的输出中包括的数据有:在 Helm 配置值文件中应用的各种条件下的资源请求和限制、初始化容器和存储卷信息。如果你的应用程序由于资源不足而崩溃,或者是一个需要运行前置脚本进行配置的初始配置容器,或者生成不应该存储于纯文本 YAML 文件中的隐藏密码,则此数据很有用。 + +最后,我将使用 `describe node` 命令,当然,它是用来描述节点的。由于本示例只有一个名为 Minikube 的示例,因此我将使用这个名字。如果你的环境中有多个节点,则必须包含你想查找的的节点名称。 + +与“吊舱”一样,这个节点的命令会产生大量数据,因此我将仅包括输出片段。 + +``` +$kubectl describe node minikube +``` + +![output of kubectl describe node][9] + +注意,`describe node` 是更重要的基本命令之一。如此图所示,该命令返回统计信息,该信息指示节点何时资源用尽,并且该数据非常适合在需要扩展时(如果你的环境中没有自动扩展)向你发出警报。此输出片段中未包含的其它内容包括:对所有资源和限制的请求所占的百分比,以及资源的使用期限和分配(例如,对于我的应用程序而言)。 + +### 买单 + +使用这些命令,我完成了“购物”并得到了我想要的一切。希望这些基本命令也能在你使用 Kubernetes 的日常工作中提供帮助。 + +我鼓励你经常使用命令行并学习“帮助”部分中的速记标志,你可以通过运行以下命令来查看这些标志: + +``` +$helm --help +``` + +或 + +``` +$kubectl -h +``` + +### 花生酱和果冻 + +有些东西像花生酱和果冻一样混在一起。Helm 和 `kubectl` 就有点像那样交错在一起。 + +我经常在自己的环境中使用这些工具。因为它们在很多地方都有很多相似之处,所以在使用其中一个之后,我通常需要跟进另一个。例如,我可以进行 Helm 部署,并使用 `kubectl` 观察它是否失败。一起试试它们,看看它们能为你做什么。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/2/kubectl-helm-commands + +作者:[Jessica Cherry][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/jrepka +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/rh_003784_02_os.comcareers_os_rh2x.png?itok=jbRfXinl (A person working.) +[2]: https://helm.sh/ +[3]: https://github.com/helm/charts/tree/master/stable +[4]: https://kubernetes.io/docs/reference/kubectl/kubectl/ +[5]: https://kubernetes.io/docs/reference/kubectl/overview/ +[6]: https://linux.cn/article-11749-1.html +[7]: https://opensource.com/sites/default/files/uploads/helm-get-all.png (output from helm get all command) +[8]: https://opensource.com/sites/default/files/uploads/kubectl-describe-pods.png (output of kubectl-describe-pods) +[9]: https://opensource.com/sites/default/files/uploads/kubectl-describe-node.png (output of kubectl describe node) diff --git a/published/202003/20200212 Extend the life of your SSD drive with fstrim.md b/published/202003/20200212 Extend the life of your SSD drive with fstrim.md new file mode 100644 index 0000000000..dfb2969cf9 --- /dev/null +++ b/published/202003/20200212 Extend the life of your SSD drive with fstrim.md @@ -0,0 +1,152 @@ +[#]: collector: (lujun9972) +[#]: translator: (wxy) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11959-1.html) +[#]: subject: (Extend the life of your SSD drive with fstrim) +[#]: via: (https://opensource.com/article/20/2/trim-solid-state-storage-linux) +[#]: author: (Alan Formy-Duval https://opensource.com/users/alanfdoss) + +在 Linux 下使用 fstrim 延长 SSD 驱动器的寿命 +====== + +> 这个新的系统服务可以使你的生活更轻松。 + +![](https://img.linux.net.cn/data/attachment/album/202003/04/121625sl380ga10g56d33h.jpg) + +在过去的十年中,固态驱动器(SSD)带来了一种管理存储的新方法。与上一代的转盘产品相比,SSD 具有无声、更冷却的操作和更快的接口规格等优点。当然,新技术带来了新的维护和管理方法。SSD 具有一种称为 TRIM 的功能。从本质上讲,这是一种用于回收设备上未使用的块的方法,该块可能先前已被写入,但不再包含有效数据,因此可以返回到通用存储池以供重用。Opensource.com 的 Don Watkins 首先在其 2017 年的文章《[Linux 固态驱动器:为 SSD 启用 TRIM][2]》中介绍过 TRIM 的内容。 + +如果你一直在 Linux 系统上使用此功能,则你可能熟悉下面描述的两种方法。 + +### 老的方式 + +#### 丢弃选项 + +我最初使用 `mount` 命令的 `discard` 选项启用了此功能。每个文件系统的配置都放在 `/etc/fstab` 文件中。 + +``` +# cat /etc/fstab +UUID=3453g54-6628-2346-8123435f  /home  xfs  defaults,discard   0 0 +``` + +丢弃选项可启用自动的在线 TRIM。由于可能会对性能造成负面影响,最近关于这是否是最佳方法一直存在争议。使用此选项会在每次将新数据写入驱动器时启动 TRIM。这可能会引入其他磁盘活动,从而影响存储性能。 + +#### Cron 作业 + +我从 `fstab` 文件中删除了丢弃选项。然后,我创建了一个 cron 作业来按计划调用该命令。 + +``` +# crontab -l +@midnight /usr/bin/trim +``` + +这是我最近在 Ubuntu Linux 系统上使用的方法,直到我了解到另一种方法。 + +### 一个新的 TRIM 服务 + +我最近发现有一个用于 TRIM 的 systemd 服务。Fedora 在版本 30 中将其[引入][3],尽管默认情况下在版本 30 和 31 中未启用它,但计划在版本 32 中使用它。如果你使用的是 Fedora 工作站 31,并且你想要开始使用此功能,可以非常轻松地启用它。我还将在下面向你展示如何对其进行测试。该服务并非 Fedora 独有的服务。它是否存在及其地位将因发行版而异。 + +#### 测试 + +我喜欢先进行测试,以更好地了解幕后情况。我通过打开终端并发出配置服务调用的命令来执行此操作。 + +``` +/usr/sbin/fstrim --fstab --verbose --quiet +``` + +`fstrim` 的 `-help` 参数将描述这些信息和其他参数。 + +``` +$ sudo /usr/sbin/fstrim --help + +Usage: + fstrim [options] + +Discard unused blocks on a mounted filesystem. + +Options: + -a, --all trim all supported mounted filesystems + -A, --fstab trim all supported mounted filesystems from /etc/fstab + -o, --offset the offset in bytes to start discarding from + -l, --length the number of bytes to discard + -m, --minimum the minimum extent length to discard + -v, --verbose print number of discarded bytes + --quiet suppress error messages + -n, --dry-run does everything, but trim + + -h, --help display this help + -V, --version display version +``` + +因此,现在我可以看到这个 systemd 服务已配置为在我的 `/etc/fstab` 文件中的所有受支持的挂载文件系统上运行该修剪操作(`-fstab`),并打印出所丢弃的字节数(`-verbose`),但是抑制了任何可能会发生的错误消息(`–quiet`)。了解这些选项对测试很有帮助。例如,我可以从最安全的方法开始,即空运行。我还将去掉 `-quiet` 参数,以便确定驱动器设置是否发生任何错误。 + +``` +$ sudo /usr/sbin/fstrim --fstab --verbose --dry-run +``` + +这就会显示 `fstrim` 命令根据在 `/etc/fstab` 文件中找到的文件系统要执行的操作。 + +``` +$ sudo /usr/sbin/fstrim --fstab --verbose +``` + +现在,这会将 TRIM 操作发送到驱动器,并报告每个文件系统中丢弃的字节数。以下是我最近在新的 NVME SSD 上全新安装 Fedora 之后的示例。 + +``` +/home: 291.5 GiB (313011310592 bytes) trimmed on /dev/mapper/wkst-home +/boot/efi: 579.2 MiB (607301632 bytes) trimmed on /dev/nvme0n1p1 +/boot: 787.5 MiB (825778176 bytes) trimmed on /dev/nvme0n1p2 +/: 60.7 GiB (65154805760 bytes) trimmed on /dev/mapper/wkst-root +``` + +#### 启用 + +Fedora Linux 实现了一个计划每周运行它的 systemd 计时器服务。要检查其是否存在及当前状态,请运行 `systemctl status`。 + +``` +$ sudo systemctl status fstrim.timer +``` + +现在,启用该服务。 + +``` +$ sudo systemctl enable fstrim.timer +``` + +#### 验证 + +然后,你可以通过列出所有计时器来验证该计时器是否已启用。 + +``` +$ sudo systemctl list-timers --all +``` + +会显示出下列行,表明 `fstrim.timer` 存在。注意,该计时器实际上激活了 `fstrim.service` 服务。这是实际调用 `fstrim` 的地方。与时间相关的字段显示为 `n/a`,因为该服务已启用且尚未运行。 + +``` +NEXT   LEFT    LAST   PASSED   UNIT           ACTIVATES +n/a    n/a     n/a    n/a      fstrim.timer   fstrim.service +``` + +### 结论 + +该服务似乎是在驱动器上运行 TRIM 的最佳方法。这比必须创建自己的 crontab 条目来调用 `fstrim` 命令要简单得多。不必编辑 `fstab` 文件也更安全。观察固态存储技术的发展很有趣,并且我很高兴看到 Linux 似乎正在朝着标准且安全的方向实现它。 + +在本文中,学习了固态驱动器与传统硬盘驱动器有何不同以及它的含义... + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/2/trim-solid-state-storage-linux + +作者:[Alan Formy-Duval][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/alanfdoss +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/linux_keyboard_desktop.png?itok=I2nGw78_ (Linux keys on the keyboard for a desktop computer) +[2]: https://linux.cn/article-8177-1.html +[3]: https://fedoraproject.org/wiki/Changes/EnableFSTrimTimer (Fedora Project WIKI: Changes/EnableFSTrimTimer) diff --git a/published/202003/20200214 How to set up your own fast, private open source mesh network.md b/published/202003/20200214 How to set up your own fast, private open source mesh network.md new file mode 100644 index 0000000000..dbf4bfc481 --- /dev/null +++ b/published/202003/20200214 How to set up your own fast, private open source mesh network.md @@ -0,0 +1,112 @@ +[#]: collector: (lujun9972) +[#]: translator: (wxy) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11968-1.html) +[#]: subject: (How to set up your own fast, private open source mesh network) +[#]: via: (https://opensource.com/article/20/2/mesh-network-freemesh) +[#]: author: (Spencer Thomason https://opensource.com/users/spencerthomason) + +如何建立自己的快速、私有的开源网状网络(mesh) +====== + +> 只需要不到 10 分钟的安装时间,就可以用 FreeMesh 搭建一个经济实惠、性能卓越、尊重隐私的网格系统。 + +![](https://img.linux.net.cn/data/attachment/album/202003/06/234848jaga52a0wx05w0f0.jpg) + +[FreeMesh][2] 系统有望为大众带来完全开源的网状网络mesh network(LCTT 译注:也称之为“多跳网络”)。我最近有机会对它进行了测试;它安装迅速,性能非常好 —— 特别是相对它的价格而言。 + +### 为什么要网格化和开源? + +使用开源的原因很简单:隐私。有了 FreeMesh,你的数据就是你自己的。它不会跟踪或收集数据。不相信吗?毕竟,你可以轻松检查 —— 它是开源的!而其它大型高科技企业集团提供的一些流行的网状网络解决方案,你是否相信它们会保护你的数据? + +另一个重要因素:更新。FreeMesh 表示,它将致力于定期发布安全性和性能更新。从现在起到 10 年后呢?使用开源解决方案,你可以根据需要自由地更新产品。 + +那么为什么要用网状网络呢?在网状网络中,多个无线路由器一起工作以广播单个超大型的无线网络。网状网络中的每个路由器都可与其他路由器智能地通信,以便为你的数据提供最佳的“路径”。FreeMesh 网站上的以下图片突出显示了使用单个无线路由器和网状网络之间的区别。红色网络表示单个无线路由器,绿色网络是网状网络。 + +![单路由器网络] [3] + +![网状网络] [4] + +### 采购设备 + +要开始使用 FreeMesh,请[订购套件][5]。它提供两种套件:标准套件和 4G LTE。 + +顾名思义,4G LTE 套件支持蜂窝数据连接。此功能在消费级网络领域非常罕见,但对某些人来说非常有用。你可以在提供电源和电池的任何地方建立具有完整的快速故障转移功能的便携式网状网络。 + +FreeMesh 套件带有一个主路由器和两个节点。路由器和节点使用 802.11ac、802.11r 和 802.11s 标准。随附的固件运行定制版本的 [OpenWrt] [6],这是嵌入式设备的 Linux 发行版。 + +FreeMesh 路由器的一些规格非常好: + +* CPU:双核 880MHz MediaTek MT7621AT(双核/四线程!) +* 内存:DDR3 512MB +* 接口:1 个 GbE WAN、4 个 GbE LAN、1 个 USB 2.0 端口、1 个 microSD 卡插槽、1 个 SIM 插槽 +* 天线:2 个 5dBi 2.4GHz、2 个 5dBi 5GHz、2 个 3dBi 3G/4G(内置) +* 4G LTE 调制解调器:LTE 4 类模块,下行 150Mbps/上行 50Mbps + +### 设置 + +设置很容易,FreeMesh 的 [README][7] 提供了简单的说明和图表。首先首先设置主路由器。然后按照以下简单步骤操作: + +1、将第一个节点(蓝色 WAN 端口)连接到主路由器(黄色 LAN 端口)。 + +![FreeMesh 设置步骤 1][8] + +2、等待约 30 至 60 秒。设置完成后,节点的 LED 将会闪烁。 + +![FreeMesh 设置步骤 2][9] + +3、将节点移到另一个位置。 + +仅此而已!节点不需要手动设置。你只需将它们插入主路由器,其余的工作就完成了。你可以以相同的方式添加更多节点;只需重复上述步骤即可。 + +### 功能 + +FreeMesh 是开箱即用的,它由 OpenWRT 和 LuCI 组合而成。它具有你期望路由器提供的所有功能。是否要安装新功能或软件包?SSH 连入并开始魔改! + +![FreeMesh 网络上的实时负载][10] + +![FreeMesh 网络概览][11] + +![OpenWrt 状态报告][12] + +### 性能如何 + +设置完 FreeMesh 系统后,我将节点移动到了房屋周围的各个地方。我使用 [iPerf][13] 测试带宽,它达到了约 150Mbps。WiFi 可能会受到许多环境变量的影响,因此你的结果可能会有所不同。节点与主路由器之间的距离在带宽中也有很大的影响。 + +但是,网状网络的真正优势不是高峰速度,而是整个空间的平均速度要好得多。即使在我家很远的地方,我仍然能够用流媒体播放视频并正常工作。我甚至可以在后院工作。在出门之前,我只是将一个节点重新放在窗口前面而已。 + +### 结论 + +FreeMesh 确实令人信服。它以简单、开源的形式为你提供高性价比和隐私。 + +以我的经验,设置非常容易,而且足够快。覆盖范围非常好,远远超过了任何单路由器环境。你可以随意魔改和定制 FreeMesh 设置,但是我觉得没有必要。它提供了我需要的一切。 + +如果你正在寻找价格可承受、性能良好且尊重隐私的网格系统,且该系统可以在不到 10 分钟的时间内安装完毕,你可以考虑一下 FreeMesh。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/2/mesh-network-freemesh + +作者:[Spencer Thomason][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/spencerthomason +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/bus-networking.png?itok=fHmulI9p (people on top of a connected globe) +[2]: https://freemeshwireless.com/ +[3]: https://opensource.com/sites/default/files/uploads/singlerouternetwork.png (Single-router network) +[4]: https://opensource.com/sites/default/files/uploads/meshnetwork.png (Mesh network) +[5]: https://freemeshwireless.com/#pricing +[6]: https://openwrt.org/ +[7]: https://gitlab.com/slthomason/freemesh/-/blob/master/README.md +[8]: https://opensource.com/sites/default/files/uploads/connecttorouter.png (FreeMesh setup step 1) +[9]: https://opensource.com/sites/default/files/uploads/setupcomplete.png (FreeMesh setup step 2) +[10]: https://opensource.com/sites/default/files/uploads/freemeshrealtimeload.png (Real-time load on FreeMesh network) +[11]: https://opensource.com/sites/default/files/uploads/freemeshwirelessoverview.png (Overview of FreeMesh network) +[12]: https://opensource.com/sites/default/files/uploads/openwrt.png (OpenWrt status report) +[13]: https://opensource.com/article/20/1/internet-speed-tests diff --git a/published/202003/20200214 Linux is our love language.md b/published/202003/20200214 Linux is our love language.md new file mode 100644 index 0000000000..293568e366 --- /dev/null +++ b/published/202003/20200214 Linux is our love language.md @@ -0,0 +1,80 @@ +[#]: collector: (lujun9972) +[#]: translator: (sndnvaps) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12022-1.html) +[#]: subject: (Linux is our love language) +[#]: via: (https://opensource.com/article/20/2/linux-love-language) +[#]: author: (Christopher Cherry https://opensource.com/users/chcherry) + +学习 Linux 是我们的爱情语言 +====== + +> 当一个妻子教丈夫一些新技能的时候,他们都学到了比期待更多的东西。 + +![](https://img.linux.net.cn/data/attachment/album/202003/22/163819clzuy77dc4d7q8zu.jpg) + +2019 年是我们 Cherry 家学习的一年。我是一个喜欢学习新技术的高级软件工程师,并把学到的内容一起教给了我的丈夫 Chris。通过教给他一些我学到的东西,并让他全程经历我的技术演练文章,我帮助 Chris 学习到了新技术,使他能够将自己的职业生涯更深入地转向技术领域。而我学习到了新的方法,使我的演练和培训材料更易于让读者理解。 + +在这篇文章中,我们来讨论一下我们各自和彼此学习到了什么东西,然后探讨这对于我们的未来有何影响。 + +### 向学生的提问 + +**Jess:** Chris,是什么导致你想深入学习我的领域的技能呢? + +**Chris:** 主要目的是为了让我事业更进一步。作为一个网络工程师的经历告诉我,现在的网络专家已经不像以前一样有价值了,我必须掌握更多的知识。由于网络经常被认为是造成这些天程序中断或出错的原因,我想从开发人员的角度了解更多关于编写应用程序的知识,以便于了解它们如何依赖网络资源。 + +**Jess:** 我首先教你什么内容?你从中学到什么? + +**Chris:** 首先是从学习除此安装 Linux 系统开始的,之后又安装了 [Ansible][2]。只要硬件兼容,我用过的每一个 Linux 发行版都很容易安装,但可能会出现个别不兼容的情况。这就意味着我有时候第一手学习到的是如何解决系统安装过程的最初 5 分钟出现的问题了(这个我最喜欢了)。Ansible 给了一个我学习使用软件管理器来安装程序的理由。当程序安装完成后,通过查看 yum 安装的程序,我快速了解了程序管理器是如何处理程序的依赖项的,因此,用 Python 编写的 Ansible 能够在我的系统运行。自此之后,我开始使用 Ansible 来安装各种各样的程序。 + +**Jessica:** 你喜欢我这种教学方式不? + +**Chris:** 我们一开始有过争吵,直到我们弄清楚了我喜欢的学习方式,你也知道了应该怎样为我提供最好的学习方式。在一开始的时候,我很难跟上你讲的内容。例如,当你说“一个码头工人集装箱”的时候,我完全不知道你在讲什么。比较早的时候,我的回答就是“这是一个集装箱”,然而当时这对我来说,完全没有意义。当你对这些内容进行一些更深入的讲解后,才让学习更有趣。 + +**Jess:** 老实说,这对我来说也是一个重要的教训。在你之前,我从来没有教过在这个技术领域知识比我少的人,所以你帮助我认识到我需要解释更多细节。我也得说声谢谢。 + +当你通过这几个学习步骤的时候,你觉得我的这篇测试文章怎样呢? + +**Chris:** 就我个人而言,我认为这很容易,但我错了。在我主要学习的内容中,比如你[介绍的Vagrant][3],它在不同的 Linux 发行版间的变化比我想像的要多。操作系统的变化会影响设置的方式、运行都要求和特定的命令。这看起来比我用的网络设备变化更大。这让我花费更多的精力去查看这些说明是对应我的系统还是其它的系统(有时候很难知道)。在这学习路上,我似乎碰到很多问题。 + +**Jess:** 我每天都会遇到各种各样的问题,所以对我来说日常就是用各种方法解决各种问题。 + +### 向老师的提问 + +**Chris:** Jess,你将来教我的方式会有所改变吗? + +**Jess:** 我想让你像我一样读多一些书。通过翻阅书籍来学习新技术。每天起床后一小时和睡觉前一小时我都会看书,花费一个星期左右我就能看一到两本书。我也会创建为期两周的任务计划来实践我从书本中学习到的技能。这是除了我一天中第一个小时在喝大量咖啡时读到的科技文章之外的。当我考虑到你的职业发展目标的时候,我认为除了我们谈到的优秀博客文章和文章之外,书籍是一个重要的元素。我觉得我的阅读量使我保持进步,如果你也这么做了,你也会很快赶上我的。 + +**Chris:** 那么学生有没有教过老师呢? + +**Jess:** 我在你那里学习到耐心。举个例子,当你完成了安装 Ansible 的时候,我问你下一步要怎样操作的时候。你直接回复我,“不知道”,这不是我想让你学习到的内容。所以我改变了策略,现在在逐步安装任何组件之前,我们将详细讨论你想要实现的目标。当我们在写 Vagrant 文章的时候,我们一起进行相应的演示操作,我以创建它时就牢记目标,因此我们就有一些需要马上实现的目标。 + +这实际上对我在工作中的培训方式产生了巨大的改变。现在我在大家学习的过程中会问更多问题,并更多地进行手把手讲解。我更愿意坐下来仔细检查,确保有人明白我在说什么和我们在做什么。这是我之前从来没有做过的。 + +### 我们一起学到了什么 + +做为一对夫妇,在这一年的技术合作中我们的技术都有所增长。 + +**Chris:** 我对自己学到的东西感到震惊。通过一年课程学习,我认识了新操作系统、如何使用 API、使用 Ansible 部署 Web 应用和使用 Vagrant 启动虚拟机器。我还学习到了文档可以让生活变得更好,所以我也会尝试去写一写。然而,在这个工作领域,操作并不总是被记录在案,所以我学会了准备好处理棘手的问题,并记录如何解决它们。 + +**Jess:** 除了我在教你中学到的知识外,我还专注于学习 Kubernetes 在云环境中的应用知识。这包括部署策略、Kubernetes API 的复杂度、创建我自己的容器,并对环境进行加密处理。我还节省了探索的时间:研究了 serverless 的代码、AI 模型、Python 和以图形方式显示热图。对于我来说,这一年也很充足。 + +我们下一个目标是什么?现在还不知道,但我可以向你保证,我们将会继续进行分享它。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/2/linux-love-language + +作者:[Christopher Cherry][a] +选题:[lujun9972][b] +译者:[sndnvaps](https://github.com/sndnvaps) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/chcherry +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/red-love-heart-alone-stone-path.jpg?itok=O3q1nEVz (红心 "你不是孤单的") +[2]: https://opensource.com/resources/what-ansible +[3]: https://opensource.com/resources/vagrant diff --git a/published/202003/20200214 PHP Development on Fedora with Eclipse.md b/published/202003/20200214 PHP Development on Fedora with Eclipse.md new file mode 100644 index 0000000000..d373722c0e --- /dev/null +++ b/published/202003/20200214 PHP Development on Fedora with Eclipse.md @@ -0,0 +1,89 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11967-1.html) +[#]: subject: (PHP Development on Fedora with Eclipse) +[#]: via: (https://fedoramagazine.org/php-development-on-fedora-with-eclipse/) +[#]: author: (Mehdi Haghgoo https://fedoramagazine.org/author/powergame/) + +使用 Eclipse 在 Fedora 上进行 PHP 开发 +====== + +![][1] + +[Eclipse][2] 是由 Eclipse 基金会开发的功能全面的自由开源 IDE。它诞生于 2001 年。你可以在此 IDE 中编写各种程序,从 C/C++ 和 Java 到 PHP,乃至于 Python、HTML、JavaScript、Kotlin 等等。 + +### 安装 + +该软件可从 Fedora 的官方仓库中获得。要安装它,请用: + +``` +sudo dnf install eclipse +``` + +这将安装基本的 IDE 和 Eclipse 平台,能让你开发 Java 应用。为了将 PHP 开发支持添加到 IDE,请运行以下命令: + +``` +sudo dnf install eclipse-pdt +``` + +这将安装 PHP 开发工具,如 PHP 项目向导、PHP 服务器配置,composer 支持等。 + +### 功能 + +该 IDE 有许多使 PHP 开发更加容易的功能。例如,它有全面的项目向导(你可以在其中为新项目配置许多选项)。它还有如 composer 支持、调试支持、浏览器、终端等内置功能。 + +### 示例项目 + +现在已经安装了 IDE,让我们创建一个简单的 PHP 项目。进入 “File →New → Project”。在出现的对话框中,选择 “PHP project”。输入项目的名称。你可能还需要更改其他一些选项,例如更改项目的默认位置,启用 JavaScript 以及更改 PHP 版本。请看以下截图。 + +![Create A New PHP Project in Eclipse][3] + +你可以单击 “Finish” 按钮创建项目,或按 “Next” 配置其他选项,例如添加包含和构建路径。在大多数情况下,你无需更改这些设置。 + +创建项目后,右键单击项目文件夹,然后选择 “New→PHP File” 将新的 PHP 文件添加到项目。在本教程中,我将其命名为 `index.php`,这是每个 PHP 项目中公认的默认文件。 + +![add a new PHP file][4] + +接着在新文件中添加代码。 + +![Demo PHP code][5] + +在上面的例子中,我在同一页面上使用了 CSS、JavaScript 和 PHP 标记,主要是为了展示 IDE 能够支持所有这些标记。 + +页面完成后,你可以将文件移至 Web 服务器文档根目录或在项目目录中创建一个 PHP 开发服务器来查看输出。 + +借助 Eclipse 中的内置终端,我们可以直接在 IDE 中启动 PHP 开发服务器。只需单击工具栏上的终端图标(![Terminal Icon][6]),然后单击 “OK”。在新终端中,进入项目目录,然后运行以下命令: + +``` +php -S localhost:8080 -t . index.php +``` + +![Terminal output][7] + +现在,打开浏览器并进入 。如果按照说明正确完成了所有操作,并且代码没有错误,那么你将在浏览器中看到 PHP 脚本的输出。 + +![PHP output in Fedora][8] + +-------------------------------------------------------------------------------- + +via: https://fedoramagazine.org/php-development-on-fedora-with-eclipse/ + +作者:[Mehdi Haghgoo][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://fedoramagazine.org/author/powergame/ +[b]: https://github.com/lujun9972 +[1]: https://fedoramagazine.org/wp-content/uploads/2020/02/php-eclipse-816x346.png +[2]: https://projects.eclipse.org/projects/eclipse +[3]: https://fedoramagazine.org/wp-content/uploads/2020/02/Screenshot-from-2020-02-07-01-58-39.png +[4]: https://fedoramagazine.org/wp-content/uploads/2020/02/Screenshot-from-2020-02-07-02-02-05-1024x576.png +[5]: https://fedoramagazine.org/wp-content/uploads/2020/02/code-1024x916.png +[6]: https://fedoramagazine.org/wp-content/uploads/2020/02/Screenshot-from-2020-02-07-03-50-05.png +[7]: https://fedoramagazine.org/wp-content/uploads/2020/02/terminal-1024x239.png +[8]: https://fedoramagazine.org/wp-content/uploads/2020/02/output.png diff --git a/published/202003/20200219 Basic Vim Commands You Need to Know to Work in Vim Editor.md b/published/202003/20200219 Basic Vim Commands You Need to Know to Work in Vim Editor.md new file mode 100644 index 0000000000..2a6b8e91d7 --- /dev/null +++ b/published/202003/20200219 Basic Vim Commands You Need to Know to Work in Vim Editor.md @@ -0,0 +1,137 @@ +[#]: collector: (lujun9972) +[#]: translator: (mengxinayan) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12053-1.html) +[#]: subject: (Basic Vim Commands You Need to Know to Work in Vim Editor) +[#]: via: (https://www.2daygeek.com/basic-vim-commands-cheat-sheet-quick-start-guide/) +[#]: author: (Magesh Maruthamuthu https://www.2daygeek.com/author/magesh/) + +必知必会的 Vim 编辑器基础命令 +====== + +如果你是一名系统管理员或者开发者,当你在终端工作时有时会需要编辑一个文件。在 Linux 系统中有几种文件编辑器,你可以根据需求选择合适的文件编辑器。在这里,我想推荐 Vim 编辑器。 + +### 为什么推荐 Vim 编辑器 + +相对于创建新文件,你更多是修改已经存在的文件。在这种情况下,Vim 快捷键可以有效地满足你的需求。 + +下列文章可以帮助你了解对文件和目录的操作。 + +- [Linux 基础:对文件和目录进行操作的 Linux 和 Unix 命令][1] +- [在 Linux 中查看不同文件格式的 10 种方法][2] + +### 什么是 Vim + +Vim 是被 Linux 管理员和开发者广泛使用的最流行和功能强大的编辑器之一。它可以通过高度的自定义配置来提高文本编辑效率。它是在众多 Unix 默认安装的 Vi 编辑器的升级版。 + +Vim 通常被称为“程序员的编辑器”,但并不限于此,它也可用于编辑任何类型的文件。它具有许多功能,例如:多次撤销、多窗口和缓冲区、语法高亮、命令行编辑、文件名补全、可视选择等等。你可以使用 `:help` 命令来获取在线帮助。 + +### 理解 Vim 的模式 + +Vim 有两种模式,详细介绍如下: + +**命令模式:** 当启动 Vim 编辑器后,默认处在命令模式下。你可以在文件中移动并且修改内容,剪切、复制和粘贴文件的一部分,同时发出命令执行更多操作(按 `ESC` 键进入命令模式) + +**插入模式:** 插入模式用于在给定的文档位置插入文本(按 `i` 键进入插入模式) + +### 我如何知道我正使用哪种 Vim 模式呢? + +如果你正在使用插入模式,你会在编辑器的底部看到 `INSERT`。如果编辑器底部没有显示任何内容,或者在编辑器底部显示了文件名,则处于 “命令模式”。 + +### 命令模式下的光标移动 + +Vim 快捷键允许你使用不同的方式来移动光标: + + * `G` – 跳转到文件最后一行 + * `gg` – 跳转到文件首行 + * `$` – 跳转到行末尾 + * `0`(数字 0) – 跳转到行开头 + * `w` – 跳转到下一个单词的开始(单词的分隔符可以是空格或其他符号) + * `W` – 跳转到下一个单词的开始(单词的分隔符只能是空格) + * `b` – 跳转到下一个单词的末尾(单词的分隔符可以是空格或其他符号) + * `B` – 跳转到下一个单词的末尾(单词的分隔符只能是空格) + + * `PgDn` 键 – 向下移动一页 + * `PgUp` 键 – 向上移动一页 + * `Ctrl+d` – 向下移动半页 + * `Ctrl+u` – 向上移动半页 + +### 插入模式:插入文字 + +下面的 Vim 快捷键允许你根据需要在光标的不同位置插入内容。 + + * `i` – 在光标之前插入 + * `a` – 在光标之后插入 + * `I` – 在光标所在行的开头插入。当光标位于行中间时,这个键很有用 + * `A` – 在光标所在行的末尾插入。 + * `o` – 在光标所在行的下面插入新行 + * `O` – 在光标所在行的上面插入新行 + * `ea` – 在单词的末尾插入 + +### 拷贝、粘贴和删除一行 + + * `yy` – 复制一行 + * `p` / `P` – 将内容粘贴到光标之后 / 之前 + * `dd` – 删除一行 + * `dw` – 删除一个单词 + +### 在 Vim 中搜索和替换匹配的模式 + + * `/模式` – 向后搜索给定的模式 + * `?模式` – 向前搜索给定的模式 + * `n` – 向后重复搜索之前给定的模式 + * `N` – 向前重复搜索之前给定的模式 + * `:%s/旧模式/新模式/g` – 将文件中所有的旧模式替换为新模式 + * `:s/旧模式/新模式/g` – 将当前行中所有的旧模式替换为新模式 + * `:%s/旧模式/新模式/gc` – 逐个询问是否文件中的旧模式替换为新模式 + +### 如何在 Vim 编辑器中跳转到特定行 + +你可以根据需求以两种方式达到该目的,如果你不知道行号,建议采用第一种方法。 + +通过打开文件并运行下面的命令来显示行号 + +``` +:set number +``` + +当你设置好显示行号后,按 `:n` 跳转到相应的行号。例如,如果你想跳转到第 15 行,请输入: + +``` +:15 +``` + +如果你已经知道行号,请使用以下方法在打开文件时直接跳转到相应行。例如,如果在打开文件时直接跳转到 20 行,请输入下面的命令: + +``` +$ vim +20 [文件名] +``` + +### 撤销操作/恢复上一次操作/重复上一次操作 + + * `u` – 撤销更改 + * `Ctrl+r` – 恢复更改 + * `.` – 重复上一条命令 + +### 保存和退出 Vim + + * `:w` – 保存更改但不退出 vim + * `:wq` – 写并退出 + * `:q!` – 强制退出 + +-------------------------------------------------------------------------------- + +via: https://www.2daygeek.com/basic-vim-commands-cheat-sheet-quick-start-guide/ + +作者:[Magesh Maruthamuthu][a] +选题:[lujun9972][b] +译者:[萌新阿岩](https://github.com/mengxinayan) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://www.2daygeek.com/author/magesh/ +[b]: https://github.com/lujun9972 +[1]: https://www.2daygeek.com/linux-basic-commands-file-directory-manipulation/ +[2]: https://www.2daygeek.com/unix-linux-command-to-view-file/ diff --git a/published/202003/20200219 Here Are The Most Beautiful Linux Distributions in 2020.md b/published/202003/20200219 Here Are The Most Beautiful Linux Distributions in 2020.md new file mode 100644 index 0000000000..b4eafe90dd --- /dev/null +++ b/published/202003/20200219 Here Are The Most Beautiful Linux Distributions in 2020.md @@ -0,0 +1,195 @@ +[#]: collector: (lujun9972) +[#]: translator: (robsean) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12046-1.html) +[#]: subject: (Here Are The Most Beautiful Linux Distributions in 2020) +[#]: via: (https://itsfoss.com/beautiful-linux-distributions/) +[#]: author: (Ankush Das https://itsfoss.com/author/ankush/) + +我眼中的 2020 年最漂亮的 Linux 发行版 +====== + +![](https://img.linux.net.cn/data/attachment/album/202003/28/103619o7gog737dg7fi9ii.jpg) + +以我的观点,每个人都该有一个 Linux 发行版,不管他们喜欢的是哪种,或者想用来做什么。 + +要是你刚刚开始使用 Linux,你可以使用这些[最适合于初学者的 Linux 发行版][1];要是你是从 Windows 投奔过来的,你可以使用这些[看起来像 Windows 一样的 Linux 发行版][2];要是你有台旧电脑想让它发挥余热,你可以使用这些[轻量级 Linux 发行版][3]。当然,无论你是在[企业][36]还是 [SOHO][37],Linux 还可以用于[个人工作][38]、[开发][39],以及作为[服务器][40]或[嵌入式系统][41]的操作系统,它可以用于[各种用途][42]。 + +但在这个列表中,我们只关注最漂亮的 Linux 发行版。 + +### 7 款最漂亮的 Linux 发行版 + +![][4] + +等一下!Linux 发行版有漂亮这个分类吗?显然,你可以自己定制任何发行版的外观,并使用[主题][5]和[图标][6]之类的来使其看起来更漂亮。 + +你说得对。但是在这里,我所说的是指不需要用户进行任何调整和自定义工作就看起来很漂亮的发行版。这些发行版提供友好的顺滑、流畅、开箱即用的桌面体验。 + +**注意:** 以下列表排名不分前后,名单纯属个人喜好,请使劲喷你的观点。 + +#### 1、elementary OS + +![][7] + +首先踏上 T 台的 elementary OS 是最漂亮的 Linux 发行版(如果非得说的话,可以是“之一”)。它靠着一种类似 macOS 的外观,而为 Linux 用户提供了出色的体验。如果你已经适应了 macOS,那么你在使用 elementary OS 时就不会有任何不适感。 + +此外,elementary OS 是基于 Ubuntu 的,因此,你可以很容易地找到大量的可以满足你的需要的应用程序。 + +不仅仅是外观和感受,elementary OS 总是努力地引入一些重要的变化。因此,你可以期待用户体验会随着每次更新而获得提升。 + +- [elementary OS][8] + +#### 2、深度 Linux + +![][9] + +深度 Linux(或许现在该叫统信 UOS?)是另外一个漂亮的 Linux 发行版,它起源于 Debian 的稳定版分支。对于某些人来说,其动画效果(外观和感受)可能有点过度了,虽然它看起来很漂亮。 + +它有它自己特色的 Deepin 桌面环境(DDE),蕴藏了多种基本功能,从而提供尽可能好的用户体验。它可能不像其它发行版的用户界面,但你很容易就可以习惯。 + +我个人对深度中的控制中心和特色配色方案印象深刻。你可以自己尝试一下,我觉得值得一试。 + +- [深度][10] + +#### 3、Pop!_OS + +![][11] + +Pop!_OS 在提供了纯净的 [GNOME][12] 体验的同事,也成功地在 Ubuntu 之上打造出了一个出色的用户界面。 + +这正是我的最爱,我使用它作为我的主要桌面系统。Pop!_OS 既不浮华,也没有一些花哨的动画。然而,它通过图标和主题的完美组合做到了最好,同时从技术角度提升了用户体验。 + +我不想发起一场 [Ubuntu 和 Pop!\_OS][13] 之间的争论,但是如果你已经习惯了 Ubuntu,Pop!_OS 可能是一个可能更好的用户体验的绝佳选择。 + +- [Pop!_OS][14] + +#### 4、Manjaro Linux + +![][15] + +Manjaro Linux 是一个基于 [Arch][16] 的 Linux 发行版。虽然[安装 Arch Linux][17] 是一件稍微复杂的工作,而 Manjaro 则提供了一种更舒适、更流畅的 Arch 体验。 + +它提供各种各样的[桌面环境版本][18],在下载时可供选择。不管你选择哪一个,你都仍然有足够的选择权来自定义外观和感觉或布局。 + +对我来说,这样一个开箱即用的、基于 Arch 的发行版看起来棒极了,你值得拥有! + +- [Manjaro Linux][19] + +#### 5、KDE Neon + +![][20] + +[KDE Neon][21] 是为那些想要采用简化的设计方案而仍可以得到丰富体验的用户所准备的。 + +它是一个基于 Ubuntu 的轻量级 Linux 发行版。顾名思义,它采用 KDE Plasma 桌面,看起来精美绝伦。 + +KDE Neon 给予你最新的、最好的 KDE Plasma 桌面及 KDE 应用程序。不像 [Kubuntu][22] 或其它基于 KDE 的发行版,你不需要等待数月来获取新的 [KDE 软件][23]。 + +你可以在 KDE 桌面中获取很多内置的自定义选项,请按你的心意摆弄它! + +- [KDE Neon][24] + +#### 6、Zorin OS + +![][25] + +毫无疑问,Zorin OS 是一款令人印象深刻的 Linux 发行版,它努力提供了良好的用户体验,即便是它的精简版也是如此。 + +你可以尝试完整版或精简版(使用 [Xfce 桌面][26])。这个用户界面是专门为习惯于 Windows 和 macOS 的用户定制的。虽然它是基于 Ubuntu 的,但它仍然提供了出色的用户体验。 + +如果你开始喜欢上了它的用户界面,那你也可以尝试使用 [Zorin Grid][27] 来管理运行在工作区/家庭中的 Zorin OS 计算机。而使用其终极版,你还可以控制桌面布局(如上图所示)。 + +- [video](https://youtu.be/UsUm_ERVLpQ) + +- [Zorin OS][28] + +#### 7、Nitrux OS + +![][29] + +[Nitrux OS][30] 在 Linux 发行版里算是个另类,它某种程度上基于 Ubuntu,但是不完全基于 Ubuntu 。 + +对于那些正在寻找在 Linux 发行版上使用全新方式的独特设计语言的用户来说,它专注于为他们提供一种良好的用户体验。它使用基于 KDE 的 Nomad 桌面。 + +Nitrux 鼓励使用 [AppImage][31] 应用程序。但是在这个基于 Ubuntu 的 Nitrux 中你也可以使用 Arch Linux 的 pacman 软件包管理器。真令人惊叹! + +如果它不是你安装过(或尚未安装过)的完美的操作系统,但它确实看起来很漂亮,并且对大多数基本任务来说已经足够了。你可以阅读我们的 [Nitrux 创始人的采访][32],可以更多地了解它。 + +这是一个稍微过时的 Nitrux 视频,但是它仍然看起来很好: + +- [video](https://youtu.be/8p2BK0AwuV8) + +- [Nitrux OS][33] + +#### 赠品:eXtern OS (处于‘停滞’开发阶段) + +![][34] + +如果你想尝试一个实验性的 Linux 发行版,extern OS 是非常漂亮的。 + +它没有积极维护,因此不应该用于生产系统。但是,它提供独特的用户体验,尽管还不够完美无缺。 + +如果只是想尝试一个好看的 Linux 发行版,你可以试试。 + +- [eXtern OS][35] + +### 总结 + +俗话说,情人眼里出西施。所以这份来自我眼中的最漂亮 Linux 发行版列表。你可以随意提出不同的意见 (当然要礼貌一点),并提出你最喜欢的 Linux 发行版。 + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/beautiful-linux-distributions/ + +作者:[Ankush Das][a] +选题:[lujun9972][b] +译者:[robsean](https://github.com/robsean) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://itsfoss.com/author/ankush/ +[b]: https://github.com/lujun9972 +[1]: https://linux.cn/article-11145-1.html +[2]: https://linux.cn/article-8311-1.html +[3]: https://linux.cn/article-11040-1.html +[4]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/02/beautiful-linux-distros.png?ssl=1 +[5]: https://itsfoss.com/best-gtk-themes/ +[6]: https://itsfoss.com/best-icon-themes-ubuntu-16-04/ +[7]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/01/elementary-os-hera.png?ssl=1 +[8]: https://elementary.io/ +[9]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/02/deepin-screenshot.jpg?ssl=1 +[10]: https://www.deepin.org/en/ +[11]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/02/pop-os-stock.jpg?ssl=1 +[12]: https://www.gnome.org/ +[13]: https://itsfoss.com/pop-os-vs-ubuntu/ +[14]: https://system76.com/pop +[15]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/02/manjaro_kde.jpg?ssl=1 +[16]: https://en.wikipedia.org/wiki/Arch +[17]: https://itsfoss.com/install-arch-linux/ +[18]: https://itsfoss.com/best-linux-desktop-environments/ +[19]: https://manjaro.org/download/ +[20]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/02/kde-neon-screenshot.jpg?ssl=1 +[21]: https://itsfoss.com/kde-neon-unveiled/ +[22]: https://kubuntu.org/ +[23]: https://kde.org/ +[24]: https://neon.kde.org/ +[25]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2019/11/zorin-lite-ultimate-appearance.jpg?ssl=1 +[26]: https://www.xfce.org/ +[27]: https://itsfoss.com/zorin-grid/ +[28]: https://zorinos.com/ +[29]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/02/nitrux-screenshot.jpg?ssl=1 +[30]: https://itsfoss.com/nitrux-linux-overview/ +[31]: https://itsfoss.com/use-appimage-linux/ +[32]: https://itsfoss.com/nitrux-linux/ +[33]: https://nxos.org/ +[34]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/02/extern-os.png?ssl=1 +[35]: https://externos.io/ +[36]: https://linux.cn/article-9553-1.html +[37]: https://linux.cn/article-10490-1.html +[38]: https://linux.cn/article-11028-1.html +[39]: https://linux.cn/article-10534-1.html +[40]: https://linux.cn/article-7813-1.html +[41]: https://linux.cn/article-9324-1.html +[42]: https://linux.cn/article-8628-1.html diff --git a/published/202003/20200219 How to find what you-re looking for on Linux with find.md b/published/202003/20200219 How to find what you-re looking for on Linux with find.md new file mode 100644 index 0000000000..4b2ca325ef --- /dev/null +++ b/published/202003/20200219 How to find what you-re looking for on Linux with find.md @@ -0,0 +1,236 @@ +[#]: collector: (lujun9972) +[#]: translator: (heguangzhi) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11966-1.html) +[#]: subject: (How to find what you’re looking for on Linux with find) +[#]: via: (https://www.networkworld.com/article/3527420/how-to-find-what-you-re-looking-for-on-linux-with-find.html) +[#]: author: (Sandra Henry-Stocker https://www.networkworld.com/author/Sandra-Henry_Stocker/) + +通过 find 命令找到你要找的东西 +====== + +> find 命令有巨多的选项可以帮助你准确定位你在 Linux 系统上需要寻找的文件。这篇文章讨论了一系列非常有用的选项。 + +![](https://img.linux.net.cn/data/attachment/album/202003/06/113842txki5llopb5aagbt.jpg) + +在 Linux 系统上有许多用于查找文件的命令,而你在使用它们时也有巨多的选项可以使用。 + +例如,你不仅可以通过文件的名称来查找文件,还可以通过文件的所有者或者组、它们的创建时间、大小、分配的权限、最后一次访问它们的时间、关联的信息节点,甚至是文件是否属于系统上不再存在的帐户或组等等来查找文件。 + +你还可以指定搜索从哪里开始,搜索应该深入到文件系统的什么位置,以及搜索结果将告诉你它所找到的文件的数量。 + +而所有这些要求都可以通过 `find` 命令来处理。 + +下面提供了根据这些要求查找文件的示例。在某些命令中,错误(例如试图列出你没有读取权限的文件)输出将被发送到 `/dev/null`,以便我们不必查看它。或者,我们可以简单地以 root 身份运行以避免这个问题。 + +请记住,还有更多的其他选项。这篇文章涵盖了很多内容,但并不是 `find` 命令帮助你定位查找文件的所有方式。 + +### 选择起点 + +使用 `find`,你可以选择一个起点或从你所在的位置开始。要选择的搜索的起点,请在单词 `find` 后输入它。例如,`find /usr` 或 `find ./bin` 将在 `/usr` 目录或当前位置下的 `bin` 目录开始搜索,而 `find ~` 将在你的主目录中开始搜索,即使你当前位于当前文件系统中的其他位置。 + +### 选择你要找的 + +最常用的搜索策略之一是按名称搜索文件。这需要使用 `-name` 选项。 + +默认情况下,`find` 会显示找到的文件的完整路径。如果你在命令中添加 `-print`,你会看到同样的结果。如果你想查看与文件相关的详细信息—-例如:文件的长度、权限等,你需要在你的 `find` 命令的末尾添加 `-ls` 参数。 + +``` +$ find ~/bin -name tryme +/home/shs/bin/tryme +$ find ~/bin -name tryme -print +/home/shs/bin/tryme +$ find ~/bin -name tryme -ls + 917528 4 -rwx------ 1 shs shs 139 Apr 8 2019 /home/shs/bin/tryme +``` + +你也可以使用子字符串来查找文件。例如,如果你将上面示例中的 `tryme` 替换为 `try*`,你将会找到所有名称以 `try` 开头的文件。(LCTT 译注:如果要使用通配符 `*` ,请将搜索字符串放到单引号或双引号内,以避免通配符被 shell 所解释) + +按名称查找文件可能是 `find` 命令最典型的用法,不过还有很多其他的方式来查找文件,并且有这样做的需要。下面的部分展示了如何使用其他可用的方式。 + +此外,当按文件大小、组、索引节点等条件来搜索文件时,你需要确认找到的文件与你要查找的文件是否相匹配。使用 `-ls` 选项来显示细节是非常有用。 + +### 通过大小查找文件 + +按大小查找文件需要使用 `-size` 选项并且对相应规范使用一点技巧。例如,如果你指定 `-size 189b`,你将找到 189 个块大小的文件,而不是 189 个字节。(LCTT 译注:如果不跟上单位,默认单位是 `b`。一个块是 512 个字节大小,不足或正好 512 个字节将占据一个块。)对于字节,你需要使用 `--size 189c`(字符)。而且,如果你指定 `--size 200w` ,你将会找到 200 个“word”的文件——以“双字节增量”为单位的字,而不是“我们互相谈论的那些事情”中的单词。你还可以通过以千字节(`k`)、兆字节(`M`)和千兆字节(`G`)为单位提供大小来查找文件。(LCTT 译注:乃至还有 `T`、`P`) + +大多数情况下,Linux 用户会搜索比选定大小要大的文件。例如,要查找大于 1 千兆字节的文件,你可以使用这样的命令,其中 `+1G` 表示“大于 1 千兆字节”: + +``` +$ find -size +1G -ls 2>/dev/null + 787715 1053976 -rw-rw-r-- 1 shs shs 1079263432 Dec 21 2018 ./backup.zip + 801834 1052556 -rw-rw-r-- 1 shs shs 1077809525 Dec 21 2018 ./2019/hold.zip +``` + +### 通过索引节点号查找文件 + +你可以通过用于维护文件元数据(即除文件内容和文件名之外的所有内容)的索引节点来查找文件。 + +``` +$ find -inum 919674 -ls 2>/dev/null + 919674 4 -rw-rw-r-- 1 shs shs 512 Dec 27 15:25 ./bin/my.log +``` + +### 查找具有特定文件所有者或组的文件 + +按所有者或组查找文件也非常简单。这里我们使用 `sudo` 来解决权限问题。 + +``` +$ sudo find /home -user nemo -name "*.png" -ls + 1705219 4 drwxr-xr-x 2 nemo nemo 4096 Jan 28 08:50 /home/nemo/Pictures/me.png +``` + +在下面这个命令中,我们寻找一个被称为 `admins` 的多用户组拥有的文件。 + +``` +# find /tmp -group admins -ls + 262199 4 -rwxr-x--- 1 dory admins 27 Feb 16 18:57 /tmp/testscript +``` + +### 查找没有所有者或组的文件 + +你可以使用如下命令所示的 `-nouser` 选项来查找不属于当前系统上的任何用户的文件。 + +``` +# find /tmp -nouser -ls +262204 4 -rwx------ 1 1016 1016 17 Feb 17 16:42 /tmp/hello +``` + +请注意,该列表显示了旧用户的 UID 和 GID,这清楚地表明该用户未在系统上定义。这种命令将查找帐户已从系统中删除的用户创建在主目录之外的文件,或者在用户帐户被删除后而未被删除的主目录中创建的文件。类似地,`-nogroup` 选项也会找到这样的文件,尤其是当这些用户是相关组的唯一成员时。 + +### 按上次更新时间查找文件 + +在此命令中,我们在特定用户的主目录中查找过去 24 小时内更新过的文件。`sudo` 用于搜索另一个用户的主目录。 + +``` +$ sudo find /home/nemo -mtime -1 +/home/nemo +/home/nemo/snap/cheat +/home/nemo/tryme +``` + +### 按上次更改权限的时间查找文件 + +`-ctime` 选项可以帮助你查找在某个参考时间范围内状态(如权限)发生更改的文件。以下是查找在最后一天内权限发生更改的文件的示例: + +``` +$ find . -ctime -1 -ls + 787987 4 -rwxr-xr-x 1 shs shs 189 Feb 11 07:31 ./tryme +``` + +请记住,显示的日期和时间只反映了对文件内容进行的最后更新。你需要使用像 `stat` 这样的命令来查看与文件相关联的三个状态(文件创建、修改和状态更改)。 + +### 按上次访问的时间查找文件 + +在这个命令中,我们使用 `-atime` 选项查找在过去两天内访问过的本地 pdf 文件。 + +``` +$ find -name "*.pdf" -atime -2 +./Wingding_Invites.pdf +``` + +### 根据文件相对于另一个文件的时间来查找文件 + +你可以使用 `-newer` 选项来查找比其他文件更新的文件。 + +``` +$ find . -newer dig1 -ls + 786434 68 drwxr-xr-x 67 shs shs 69632 Feb 16 19:05 . + 1064442 4 drwxr-xr-x 5 shs shs 4096 Feb 16 11:06 ./snap/cheat + 791846 4 -rw-rw-r-- 1 shs shs 649 Feb 13 14:26 ./dig +``` + +没有相应的 `-older` 选项,但是你可以用 `! -newer` (即更旧)得到类似的结果,它们基本上一样。 + +### 按类型查找文件 + +通过文件类型找到一个文件,你有很多选项——常规文件、目录、块和字符文件等等。以下是文件类型选项列表: + +``` +b 块特殊文件(缓冲的) +c 字符特殊文件(无缓冲的) +d 目录 +p 命名管道(FIFO) +f 常规文件 +l 符号链接 +s 套接字 +``` + +这里有一个寻找符号链接的例子: + +``` +$ find . -type l -ls + 805717 0 lrwxrwxrwx 1 shs shs 11 Apr 10 2019 ./volcano -> volcano.pdf + 918552 0 lrwxrwxrwx 1 shs shs 1 Jun 16 2018 ./letter -> pers/letter2mom +``` + +### 限制查找的深度 + +`-mindepth` 和 `-maxdepth` 选项控制在文件系统中搜索的深度(从当前位置或起始点开始)。 + +``` +$ find -maxdepth 3 -name "*loop" +./bin/save/oldloop +./bin/long-loop +./private/loop +``` + +### 查找空文件 + +在这个命令中,我们寻找空文件,但不进入目录及其子目录。 + +``` +$ find . -maxdepth 2 -empty -type f -ls + 917517 0 -rw-rw-r-- 1 shs shs 0 Sep 23 11:00 ./complaints/newfile + 792050 0 -rw-rw-r-- 1 shs shs 0 Oct 4 19:02 ./junk +``` + +### 按权限查找文件 + +你可以使用 `-perm` 选项查找具有特定权限集的文件。在下面的示例中,我们只查找常规文件(`-type f`),以避免看到符号链接,默认情况下符号链接被赋予了这种权限,即使它们所引用的文件是受限的。 + +``` +$ find -perm 777 -type f -ls +find: ‘./.dbus’: Permission denied + 798748 4 -rwxrwxrwx 1 shs shs 15 Mar 28 2019 ./runme +``` + +### 使用查找来帮助你删除文件 + +如果使用如下命令,你可以使用 `find` 命令定位并删除文件: + +``` +$ find . -name runme -exec rm {} \; +``` + +`{}` 代表根据搜索条件找到的每个文件的名称。 + +一个非常有用的选项是将 `-exec` 替换为 `-ok`。当你这样做时,`find` 会在删除任何文件之前要求确认。 + +``` +$ find . -name runme -ok rm -rf {} \; +< rm ... ./bin/runme > ? +``` + +删除文件并不是 `-ok` 和 `-exec` 能为你做的唯一事情。例如,你可以复制、重命名或移动文件。 + +确实有很多选择可以有效地使用 `find` 命令,毫无疑问还有一些在本文中没有涉及到。我希望你已经找到一些新的,特别有帮助的。 + +-------------------------------------------------------------------------------- + +via: https://www.networkworld.com/article/3527420/how-to-find-what-you-re-looking-for-on-linux-with-find.html + +作者:[Sandra Henry-Stocker][a] +选题:[lujun9972][b] +译者:[heguangzhi](https://github.com/heguangzhi) +校对:[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.networkworld.com/newsletters/signup.html +[2]: https://www.networkworld.com/article/3440100/take-the-intelligent-route-with-consumption-based-storage.html?utm_source=IDG&utm_medium=promotions&utm_campaign=HPE21620&utm_content=sidebar ( Take the Intelligent Route with Consumption-Based Storage) +[3]: https://www.facebook.com/NetworkWorld/ +[4]: https://www.linkedin.com/company/network-world diff --git a/published/202003/20200219 Try this Bash script for-large filesystems.md b/published/202003/20200219 Try this Bash script for-large filesystems.md new file mode 100644 index 0000000000..8ebc16d6d3 --- /dev/null +++ b/published/202003/20200219 Try this Bash script for-large filesystems.md @@ -0,0 +1,330 @@ +[#]: collector: (lujun9972) +[#]: translator: (wxy) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12025-1.html) +[#]: subject: (Try this Bash script for large filesystems) +[#]: via: (https://opensource.com/article/20/2/script-large-files) +[#]: author: (Nick Clifton https://opensource.com/users/nickclifton) + +针对大型文件系统可以试试此 Bash 脚本 +====== + +> 一个可以列出文件、目录、可执行文件和链接的简单脚本。 + +![bash logo on green background][1] + +你是否曾经想列出目录中的所有文件,但仅列出文件,而不列出其它的。仅列出目录呢?如果有这种需求的话,那么下面的脚本可能正是你一直在寻找的,它在 GPLv3 下开源。 + +当然,你可以使用 `find` 命令: + +``` +find . -maxdepth 1 -type f -print +``` + +但这键入起来很麻烦,输出也不友好,并且缺少 `ls` 命令拥有的一些改进。你还可以结合使用 `ls` 和 `grep` 来达到相同的结果: + +``` +ls -F . | grep -v / +``` + +但是,这又有点笨拙。下面这个脚本提供了一种简单的替代方法。 + +### 用法 + +该脚本提供了四个主要功能,具体取决于你调用它的名称:`lsf` 列出文件,`lsd` 列出目录,`lsx` 列出可执行文件以及 `lsl` 列出链接。 + +通过符号链接无需安装该脚本的多个副本。这样可以节省空间并使脚本更新更容易。 + +该脚本通过使用 `find` 命令进行搜索,然后在找到的每个项目上运行 `ls`。这样做的好处是,任何给脚本的参数都将传递给 `ls` 命令。因此,例如,这可以列出所有文件,甚至包括以点开头的文件: + +``` +lsf -a +``` + +要以长格式列出目录,请使用 `lsd` 命令: + +``` +lsd -l +``` + +你可以提供多个参数,以及文件和目录路径。 + +下面提供了当前目录的父目录和 `/usr/bin` 目录中所有文件的长分类列表: + +``` +lsf -F -l .. /usr/bin +``` + +目前该脚本不处理递归,仅列出当前目录中的文件。 + +``` +lsf -R +``` + +该脚本不会深入子目录,这个不足有一天可能会进行修复。 + +### 内部 + +该脚本采用自上而下的方式编写,其初始化功能位于脚本的开头,而工作主体则接近结尾。脚本中只有两个真正重要的功能。函数 `parse_args()` 会仔细分析命令行,将选项与路径名分开,并处理脚本中的 `ls` 命令行选项中的特定选项。 + +`list_things_in_dir()` 函数以目录名作为参数并在其上运行 `find` 命令。找到的每个项目都传递给 `ls` 命令进行显示。 + +### 总结 + +这是一个可以完成简单功能的简单脚本。它节省了时间,并且在使用大型文件系统时可能会非常有用。 + +### 脚本 + +``` +#!/bin/bash + +# Script to list: +# directories (if called "lsd") +# files (if called "lsf") +# links (if called "lsl") +# or executables (if called "lsx") +# but not any other type of filesystem object. +# FIXME: add lsp (list pipes) +# +# Usage: +# [switches valid for ls command] [dirname...] +# +# Works with names that includes spaces and that start with a hyphen. +# +# Created by Nick Clifton. +# Version 1.4 +# Copyright (c) 2006, 2007 Red Hat. +# +# This is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License as published +# by the Free Software Foundation; either version 3, or (at your +# option) any later version. + +# It is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. + +# ToDo: +# Handle recursion, eg: lsl -R +# Handle switches that take arguments, eg --block-size +# Handle --almost-all, --ignore-backups, --format and --ignore + +main () +{ + init + + parse_args ${1+"$@"} + + list_objects + + exit 0 +} + +report () +{ + echo $prog": " ${1+"$@"} +} + +fail () +{ + report " Internal error: " ${1+"$@"} + exit 1 +} + +# Initialise global variables. +init () +{ + # Default to listing things in the current directory. + dirs[0]="."; + + # num_dirs is the number of directories to be listed minus one. + # This is because we are indexing the dirs[] array from zero. + num_dirs=0; + + # Default to ignoring things that start with a period. + no_dots=1 + + # Note - the global variables 'type' and 'opts' are initialised in + # parse_args function. +} + +# Parse our command line +parse_args () +{ + local no_more_args + + no_more_args=0 ; + + prog=`basename $0` ; + + # Decide if we are listing files or directories. + case $prog in + lsf | lsf.sh) + type=f + opts=""; + ;; + lsd | lsd.sh) + type=d + # The -d switch to "ls" is presumed when listing directories. + opts="-d"; + ;; + lsl | lsl.sh) + type=l + # Use -d to prevent the listed links from being followed. + opts="-d"; + ;; + lsx | lsx.sh) + type=f + find_extras="-perm /111" + ;; + *) + fail "Unrecognised program name: '$prog', expected either 'lsd', 'lsf', 'lsl' or 'lsx'" + ;; + esac + + # Locate any additional command line switches for ls and accumulate them. + # Likewise accumulate non-switches to the directories list. + while [ $# -gt 0 ] + do + case "$1" in + # FIXME: Handle switches that take arguments, eg --block-size + # FIXME: Properly handle --almost-all, --ignore-backups, --format + # FIXME: and --ignore + # FIXME: Properly handle --recursive + -a | -A | --all | --almost-all) + no_dots=0; + ;; + --version) + report "version 1.2" + exit 0 + ;; + --help) + case $type in + d) report "a version of 'ls' that lists only directories" ;; + l) report "a version of 'ls' that lists only links" ;; + f) if [ "x$find_extras" = "x" ] ; then + report "a version of 'ls' that lists only files" ; + else + report "a version of 'ls' that lists only executables"; + fi ;; + esac + exit 0 + ;; + --) + # A switch to say that all further items on the command line are + # arguments and not switches. + no_more_args=1 ; + ;; + -*) + if [ "x$no_more_args" = "x1" ] ; + then + dirs[$num_dirs]="$1"; + let "num_dirs++" + else + # Check for a switch that just uses a single dash, not a double + # dash. This could actually be multiple switches combined into + # one word, eg "lsd -alF". In this case, scan for the -a switch. + # XXX: FIXME: The use of =~ requires bash v3.0+. + if [[ "x${1:1:1}" != "x-" && "x$1" =~ "x-.*a.*" ]] ; + then + no_dots=0; + fi + opts="$opts $1"; + fi + ;; + *) + dirs[$num_dirs]="$1"; + let "num_dirs++" + ;; + esac + shift + done + + # Remember that we are counting from zero not one. + if [ $num_dirs -gt 0 ] ; + then + let "num_dirs--" + fi +} + +list_things_in_dir () +{ + local dir + + # Paranoia checks - the user should never encounter these. + if test "x$1" = "x" ; + then + fail "list_things_in_dir called without an argument" + fi + + if test "x$2" != "x" ; + then + fail "list_things_in_dir called with too many arguments" + fi + + # Use quotes when accessing $dir in order to preserve + # any spaces that might be in the directory name. + dir="${dirs[$1]}"; + + # Catch directory names that start with a dash - they + # confuse pushd. + if test "x${dir:0:1}" = "x-" ; + then + dir="./$dir" + fi + + if [ -d "$dir" ] + then + if [ $num_dirs -gt 0 ] + then + echo " $dir:" + fi + + # Use pushd rather passing the directory name to find so that the + # names that find passes on to xargs do not have any paths prepended. + pushd "$dir" > /dev/null + if [ $no_dots -ne 0 ] ; then + find . -maxdepth 1 -type $type $find_extras -not -name ".*" -printf "%f\000" \ + | xargs --null --no-run-if-empty ls $opts -- ; + else + find . -maxdepth 1 -type $type $find_extras -printf "%f\000" \ + | xargs --null --no-run-if-empty ls $opts -- ; + fi + popd > /dev/null + else + report "directory '$dir' could not be found" + fi +} + +list_objects () +{ + local i + + i=0; + while [ $i -le $num_dirs ] + do + list_things_in_dir i + let "i++" + done +} + +# Invoke main +main ${1+"$@"} +``` + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/2/script-large-files + +作者:[Nick Clifton][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/nickclifton +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/bash_command_line.png?itok=k4z94W2U (bash logo on green background) diff --git a/published/202003/20200219 Waterfox- Firefox Fork With Legacy Add-ons Options.md b/published/202003/20200219 Waterfox- Firefox Fork With Legacy Add-ons Options.md new file mode 100644 index 0000000000..959c2b5f9e --- /dev/null +++ b/published/202003/20200219 Waterfox- Firefox Fork With Legacy Add-ons Options.md @@ -0,0 +1,106 @@ +[#]: collector: (lujun9972) +[#]: translator: (wxy) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12033-1.html) +[#]: subject: (Waterfox: Firefox Fork With Legacy Add-ons Options) +[#]: via: (https://itsfoss.com/waterfox-browser/) +[#]: author: (Ankush Das https://itsfoss.com/author/ankush/) + +水狐:一个支持旧版扩展的火狐复刻版 +====== + +> 在本周的开源软件推荐中,我们将介绍一个基于 Firefox 的浏览器,该浏览器支持 Firefox 如今已不再支持的旧版扩展,同时尽可能地提供了快速的用户体验。 + +在 Web 浏览器方面,虽然谷歌浏览器已经占据了最大的市场份额,但 [Mozilla Firefox 仍然是关切隐私的主流 Web 浏览器的一面大旗][1]。 + +Firefox 最近有了很多改进,这些改进的副作用之一是它删除了旧版扩展附件add-on的支持。如果你最喜欢的扩展附件在最近几个月/几年内消失了,那么你可以以 Witerfox 的形式再次拥有它们。 + +> 注意! +> +> 我们注意到,Waterfox 已被 System1 收购。该公司还收购了注重隐私的搜索引擎 Startpage。尽管 System1 声称他们提供注重隐私的产品,因为“这是刚需”,但我们不能对此担保。换句话说,这要取决于你是否信任 System1 和 Waterfox。 + +### Waterfox:一个基于 Firefox 的浏览器 + +![Waterfox Classic][2] + +[Waterfox][3] 是基于 Firefox 构建的一个好用的开源浏览器,它注重隐私并支持旧版扩展。它没有将自己定位为偏执于隐私的浏览器,但确实尊重这个基本的认知。 + +你可以得到两个单独的 Waterfox 浏览器版本。当前版旨在提供现代体验,而经典版则旨在支持 [NPAPI 插件][4] 和 [bootstrap 扩展][5]。 + +![Waterfox Classic][6] + +如果你不需要使用 bootstrap 扩展程序,而是需要 [WebExtensions][7],则应该选择 Waterfox 当前版。 + +而如果你需要设置一个需要大量 NPAPI 插件或 Bootstrap 扩展的浏览器,则 Waterfox 经典版将非常适合你。 + +因此,如果你喜欢 Firefox,但想在同一阵营内尝试一些不同的体验,那么这个 Firefox 替代选择就是为此而生的。 + +### Waterfox 的功能 + +![Waterfox Current][8] + +当然,从技术上讲,你应该能够做 Mozilla Firefox 支持的许多操作。 + +因此,我将在此处的列表中突出显示 Waterfox 的所有重要功能。 + +* 支持 NPAPI 插件 +* 支持 Bootstrap 扩展 +* 分别提供了支持旧版本扩展和现代的 WebExtension 两个版本。 +* 跨平台支持(Windows、Linux 和 macOS) +* 主题定制 +* 支持已经归档的扩展 + +### 在 Ubuntu/Linux 上安装 Waterfox + +与其他流行的浏览器不同,它没有可以安装的软件包。因此,你将必须从其[官方下载页面][9]下载归档包。 + +![][10] + +根据你想要的版本(当前版/经典版),只需下载该文件,它是以 .tar.bz2 为扩展名的文件。 + +下载后,只需解压缩文件即可。 + +接下来,转到解压缩的文件夹并查找 `Waterfox` 文件。你只需双击它即可运行以启动浏览器。 + +如果这不起作用,则可以使用终端并导航到提取的 `Waterfox` 文件夹。到达那里后,你只需使用一个命令即可运行它。看起来如下: + +``` +cd waterfox-classic +./waterfox +``` + +无论是哪种情况,你都可以访问其 [GitHub 页面][11]以了解将其安装在系统上的更多方式。 + +- [下载 Waterfox][3] + +### 总结 + +我在我的 Pop!_OS 19.10 系统中启动了它,在我这里工作的很好。尽管我不准备从 Firefox 切换到 Waterfox,因为我没有使用任何旧版扩展附件。但对于某些用户来说,它可能是一个重要选择。 + +你可以尝试一下,在下面的评论中让我知道你的想法。 + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/waterfox-browser/ + +作者:[Ankush Das][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://itsfoss.com/author/ankush/ +[b]: https://github.com/lujun9972 +[1]: https://itsfoss.com/why-firefox/ +[2]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/02/waterfox-classic.png?fit=800%2C423&ssl=1 +[3]: https://www.waterfox.net/ +[4]: https://en.wikipedia.org/wiki/NPAPI +[5]: https://wiki.mozilla.org/Extension_Manager:Bootstrapped_Extensions +[6]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/02/waterfox-classic-screenshot.jpg?ssl=1 +[7]: https://wiki.mozilla.org/WebExtensions +[8]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/02/waterfox-screenshot.jpg?ssl=1 +[9]: https://www.waterfox.net/download/ +[10]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/02/waterfox-download-page.jpg?ssl=1 +[11]: https://github.com/MrAlex94/Waterfox diff --git a/published/202003/20200220 Tools for SSH key management.md b/published/202003/20200220 Tools for SSH key management.md new file mode 100644 index 0000000000..9331cf701f --- /dev/null +++ b/published/202003/20200220 Tools for SSH key management.md @@ -0,0 +1,104 @@ +[#]: collector: (lujun9972) +[#]: translator: (wxy) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11947-1.html) +[#]: subject: (Tools for SSH key management) +[#]: via: (https://opensource.com/article/20/2/ssh-tools) +[#]: author: (Ben Nuttall https://opensource.com/users/bennuttall) + +SSH 密钥管理工具 +====== + +> 常用开源工具的省时快捷方式。 + +![](https://img.linux.net.cn/data/attachment/album/202003/01/122336zyldgpse6eyrbymt.jpg) + +我经常使用 SSH。我发现自己每天都要登录多个服务器和树莓派(与我位于同一房间,并接入互联网)。我有许多设备需要访问,并且获得访问权限的要求也不同,因此,除了使用各种 `ssh` / `scp` 命令选项之外,我还必须维护一个包含所有连接详细信息的配置文件。 + +随着时间的推移,我发现了一些省时的技巧和工具,你可能也会发现它们有用。 + +### SSH 密钥 + +SSH 密钥是一种在不使用密码的情况下认证 SSH 连接的方法,可以用来加快访问速度或作为一种安全措施(如果你关闭了密码访问权限并确保仅允许授权的密钥)。要创建 SSH 密钥,请运行以下命令: + +``` +$ ssh-keygen +``` + +这将在 `~/.ssh/` 中创建一个密钥对(公钥和私钥)。将私钥(`id_rsa`)保留在 PC 上,切勿共享。你可以与其他人共享公钥(`id_rsa.pub`)或将其放置在其他服务器上。 + +### ssh-copy-id + +如果我在家中或公司工作时使用树莓派,则倾向于将 SSH 设置保留为默认设置,因为我不担心内部信任网络上的安全性,并且通常将 SSH 密钥(公钥)复制到树莓派上,以避免每次都使用密码进行身份验证。为此,我使用 `ssh-copy-id` 命令将其复制到树莓派。这会自动将你的密钥(公钥)添加到树莓派: + +``` +$ ssh-copy-id pi@192.168.1.20 +``` + +在生产服务器上,我倾向于关闭密码身份验证,仅允许授权的 SSH 密钥登录。 + +### ssh-import-id + +另一个类似的工具是 `ssh-import-id`。你可以使用此方法通过从 GitHub 导入密钥来授予你自己(或其他人)对计算机或服务器的访问权限。例如,我已经在我的 GitHub 帐户中注册了各个 SSH 密钥,因此无需密码即可推送到 GitHub。这些公钥是有效的,因此 `ssh-import-id` 可以使用它们在我的任何计算机上授权我: + +``` +$ ssh-import-id gh:bennuttall +``` + +我还可以使用它来授予其他人访问服务器的权限,而无需询问他们的密钥: + +``` +$ ssh-import-id gh:waveform80 +``` + +### storm + +我还使用了名为 Storm 的工具,该工具可帮助你将 SSH 连接添加到 SSH 配置中,因此你不必记住这些连接细节信息。你可以使用 `pip` 安装它: + +``` +$ sudo pip3 install stormssh +``` + +然后,你可以使用以下命令将 SSH 连接信息添加到配置中: + +``` +$ storm add pi3 pi@192.168.1.20 +``` + +然后,你可以只使用 `ssh pi3` 来获得访问权限。类似的还有 `scp file.txt pi3:` 或 `sshfs pi pi3:`。 + +你还可以使用更多的 SSH 选项,例如端口号: + +``` +$ storm add pi3 pi@192.168.1.20:2000 +``` + +你可以参考 Storm 的[文档][2]轻松列出、搜索和编辑已保存的连接。Storm 实际所做的只是管理 SSH 配置文件 `~/.ssh/config` 中的项目。一旦了解了它们是如何存储的,你就可以选择手动编辑它们。配置中的示例连接如下所示: + +``` +Host pi3 +   user pi +   hostname 192.168.1.20 +   port 22 +``` + +### 结论 + +从树莓派到大型的云基础设施,SSH 是系统管理的重要工具。熟悉密钥管理会很方便。你还有其他 SSH 技巧要添加吗?我希望你在评论中分享他们。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/2/ssh-tools + +作者:[Ben Nuttall][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/bennuttall +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/osdc_BUS_Apple_520.png?itok=ZJu-hBV1 (collection of hardware on blue backround) +[2]: https://stormssh.readthedocs.io/en/stable/usage.html diff --git a/published/202003/20200224 Using C and C-- for data science.md b/published/202003/20200224 Using C and C-- for data science.md new file mode 100644 index 0000000000..f1dfdce174 --- /dev/null +++ b/published/202003/20200224 Using C and C-- for data science.md @@ -0,0 +1,514 @@ +[#]: collector: (lujun9972) +[#]: translator: (wxy) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11950-1.html) +[#]: subject: (Using C and C++ for data science) +[#]: via: (https://opensource.com/article/20/2/c-data-science) +[#]: author: (Cristiano L. Fontana https://opensource.com/users/cristianofontana) + +在数据科学中使用 C 和 C++ +====== + +> 让我们使用 C99 和 C++11 完成常见的数据科学任务。 + +![metrics and data shown on a computer screen][1] + +虽然 [Python][2] 和 [R][3] 之类的语言在数据科学中越来越受欢迎,但是 C 和 C++ 对于高效的数据科学来说是一个不错的选择。在本文中,我们将使用 [C99][4] 和 [C++11][5] 编写一个程序,该程序使用 [Anscombe 的四重奏][6]数据集,下面将对其进行解释。 + +我在一篇涉及 [Python 和 GNU Octave][7] 的文章中写了我不断学习编程语言的动机,值得大家回顾。这里所有的程序都需要在[命令行][8]上运行,而不是在[图形用户界面(GUI)][9]上运行。完整的示例可在 [polyglot_fit 存储库][10]中找到。 + +### 编程任务 + +你将在本系列中编写的程序: + +* 从 [CSV 文件][11]中读取数据 +* 用直线插值数据(即 `f(x)=m ⋅ x + q`) +* 将结果绘制到图像文件 + +这是许多数据科学家遇到的普遍情况。示例数据是 [Anscombe 的四重奏][6]的第一组,如下表所示。这是一组人工构建的数据,当拟合直线时可以提供相同的结果,但是它们的曲线非常不同。数据文件是一个文本文件,其中的制表符用作列分隔符,前几行作为标题。该任务将仅使用第一组(即前两列)。 + +![](https://img.linux.net.cn/data/attachment/album/202002/29/122805h3yrs1dkrgysssxk.png) + +### C 语言的方式 + +[C][12] 语言是通用编程语言,是当今使用最广泛的语言之一(依据 [TIOBE 指数][13]、[RedMonk 编程语言排名][14]、[编程语言流行度指数][15]和 [GitHub Octoverse 状态][16] 得来)。这是一种相当古老的语言(大约诞生在 1973 年),并且用它编写了许多成功的程序(例如 Linux 内核和 Git 仅是其中的两个例子)。它也是最接近计算机内部运行机制的语言之一,因为它直接用于操作内存。它是一种[编译语言][17];因此,源代码必须由[编译器][18]转换为[机器代码][19]。它的[标准库][20]很小,功能也不多,因此人们开发了其它库来提供缺少的功能。 + +我最常在[数字运算][21]中使用该语言,主要是因为其性能。我觉得使用起来很繁琐,因为它需要很多[样板代码][22],但是它在各种环境中都得到了很好的支持。C99 标准是最新版本,增加了一些漂亮的功能,并且得到了编译器的良好支持。 + +我将一路介绍 C 和 C++ 编程的必要背景,以便初学者和高级用户都可以继续学习。 + +#### 安装 + +要使用 C99 进行开发,你需要一个编译器。我通常使用 [Clang][23],不过 [GCC][24] 是另一个有效的开源编译器。对于线性拟合,我选择使用 [GNU 科学库][25]。对于绘图,我找不到任何明智的库,因此该程序依赖于外部程序:[Gnuplot][26]。该示例还使用动态数据结构来存储数据,该结构在[伯克利软件分发版(BSD)][27]中定义。 + +在 [Fedora][28] 中安装很容易: + +``` +sudo dnf install clang gnuplot gsl gsl-devel +``` + +#### 代码注释 + +在 C99 中,[注释][29]的格式是在行的开头放置 `//`,行的其它部分将被解释器丢弃。另外,`/*` 和 `*/` 之间的任何内容也将被丢弃。 + +``` +// 这是一个注释,会被解释器忽略 +/* 这也被忽略 */ +``` + +#### 必要的库 + +库由两部分组成: + +* [头文件][30],其中包含函数说明 +* 包含函数定义的源文件 + +头文件包含在源文件中,而库文件的源文件则[链接][31]到可执行文件。因此,此示例所需的头文件是: + +``` +// 输入/输出功能 +#include +// 标准库 +#include +// 字符串操作功能 +#include +// BSD 队列 +#include +// GSL 科学功能 +#include +#include +``` + +#### 主函数 + +在 C 语言中,程序必须位于称为主函数 [main()][32] 的特殊函数内: + +``` +int main(void) { +    ... +} +``` + +这与上一教程中介绍的 Python 不同,后者将运行在源文件中找到的所有代码。 + +#### 定义变量 + +在 C 语言中,变量必须在使用前声明,并且必须与类型关联。每当你要使用变量时,都必须决定要在其中存储哪种数据。你也可以指定是否打算将变量用作常量值,这不是必需的,但是编译器可以从此信息中受益。 以下来自存储库中的 [fitting_C99.c 程序][33]: + +``` +const char *input_file_name = "anscombe.csv"; +const char *delimiter = "\t"; +const unsigned int skip_header = 3; +const unsigned int column_x = 0; +const unsigned int column_y = 1; +const char *output_file_name = "fit_C99.csv"; +const unsigned int N = 100; +``` + +C 语言中的数组不是动态的,从某种意义上说,数组的长度必须事先确定(即,在编译之前): + +``` +int data_array[1024]; +``` + +由于你通常不知道文件中有多少个数据点,因此请使用[单链列表][34]。这是一个动态数据结构,可以无限增长。幸运的是,BSD [提供了链表][35]。这是一个示例定义: + +``` +struct data_point { + double x; + double y; + + SLIST_ENTRY(data_point) entries; +}; + +SLIST_HEAD(data_list, data_point) head = SLIST_HEAD_INITIALIZER(head); +SLIST_INIT(&head); +``` + +该示例定义了一个由结构化值组成的 `data_point` 列表,该结构化值同时包含 `x` 值和 `y` 值。语法相当复杂,但是很直观,详细描述它就会太冗长了。 + +#### 打印输出 + +要在终端上打印,可以使用 [printf()][36] 函数,其功能类似于 Octave 的 `printf()` 函数(在第一篇文章中介绍): + +``` +printf("#### Anscombe's first set with C99 ####\n"); +``` + +`printf()` 函数不会在打印字符串的末尾自动添加换行符,因此你必须添加换行符。第一个参数是一个字符串,可以包含传递给函数的其他参数的格式信息,例如: + +``` +printf("Slope: %f\n", slope); +``` + +#### 读取数据 + +现在来到了困难的部分……有一些用 C 语言解析 CSV 文件的库,但是似乎没有一个库足够稳定或流行到可以放入到 Fedora 软件包存储库中。我没有为本教程添加依赖项,而是决定自己编写此部分。同样,讨论这些细节太啰嗦了,所以我只会解释大致的思路。为了简洁起见,将忽略源代码中的某些行,但是你可以在存储库中找到完整的示例代码。 + +首先,打开输入文件: + +``` +FILE* input_file = fopen(input_file_name, "r"); +``` + +然后逐行读取文件,直到出现错误或文件结束: + +``` +while (!ferror(input_file) && !feof(input_file)) { + size_t buffer_size = 0; + char *buffer = NULL; + + getline(&buffer, &buffer_size, input_file); + + ... +} +``` + +[getline()][39] 函数是 [POSIX.1-2008 标准][40]新增的一个不错的函数。它可以读取文件中的整行,并负责分配必要的内存。然后使用 [strtok()][42] 函数将每一行分成[字元][41]token。遍历字元,选择所需的列: + +``` +char *token = strtok(buffer, delimiter); + +while (token != NULL) +{ + double value; + sscanf(token, "%lf", &value); + + if (column == column_x) { + x = value; + } else if (column == column_y) { + y = value; + } + + column += 1; + token = strtok(NULL, delimiter); +} +``` + +最后,当选择了 `x` 和 `y` 值时,将新数据点插入链表中: + +``` +struct data_point *datum = malloc(sizeof(struct data_point)); +datum->x = x; +datum->y = y; + +SLIST_INSERT_HEAD(&head, datum, entries); +``` + +[malloc()][46] 函数为新数据点动态分配(保留)一些持久性内存。 + +#### 拟合数据 + +GSL 线性拟合函数 [gsl_fit_linear()][47] 期望其输入为简单数组。因此,由于你将不知道要创建的数组的大小,因此必须手动分配它们的内存: + +``` +const size_t entries_number = row - skip_header - 1; + +double *x = malloc(sizeof(double) * entries_number); +double *y = malloc(sizeof(double) * entries_number); +``` + +然后,遍历链表以将相关数据保存到数组: + +``` +SLIST_FOREACH(datum, &head, entries) { + const double current_x = datum->x; + const double current_y = datum->y; + + x[i] = current_x; + y[i] = current_y; + + i += 1; +} +``` + +现在你已经处理完了链表,请清理它。要**总是**释放已手动分配的内存,以防止[内存泄漏][48]。内存泄漏是糟糕的、糟糕的、糟糕的(重要的话说三遍)。每次内存没有释放时,花园侏儒都会找不到自己的头: + +``` +while (!SLIST_EMPTY(&head)) { + struct data_point *datum = SLIST_FIRST(&head); + + SLIST_REMOVE_HEAD(&head, entries); + + free(datum); +} +``` + +终于,终于!你可以拟合你的数据了: + +``` +gsl_fit_linear(x, 1, y, 1, entries_number, + &intercept, &slope, + &cov00, &cov01, &cov11, &chi_squared); +const double r_value = gsl_stats_correlation(x, 1, y, 1, entries_number); + +printf("Slope: %f\n", slope); +printf("Intercept: %f\n", intercept); +printf("Correlation coefficient: %f\n", r_value); +``` + +#### 绘图 + +你必须使用外部程序进行绘图。因此,将拟合数据保存到外部文件: + +``` +const double step_x = ((max_x + 1) - (min_x - 1)) / N; + +for (unsigned int i = 0; i < N; i += 1) { + const double current_x = (min_x - 1) + step_x * i; + const double current_y = intercept + slope * current_x; + + fprintf(output_file, "%f\t%f\n", current_x, current_y); +} +``` + +用于绘制两个文件的 Gnuplot 命令是: + +``` +plot 'fit_C99.csv' using 1:2 with lines title 'Fit', 'anscombe.csv' using 1:2 with points pointtype 7 title 'Data' +``` + +#### 结果 + +在运行程序之前,你必须编译它: + +``` +clang -std=c99 -I/usr/include/ fitting_C99.c -L/usr/lib/ -L/usr/lib64/ -lgsl -lgslcblas -o fitting_C99 +``` + +这个命令告诉编译器使用 C99 标准、读取 `fitting_C99.c` 文件、加载 `gsl` 和 `gslcblas` 库、并将结果保存到 `fitting_C99`。命令行上的结果输出为: + +``` +#### Anscombe's first set with C99 #### +Slope: 0.500091 +Intercept: 3.000091 +Correlation coefficient: 0.816421 +``` + +这是用 Gnuplot 生成的结果图像: + +![Plot and fit of the dataset obtained with C99][52] + +### C++11 方式 + +[C++][53] 语言是一种通用编程语言,也是当今使用的最受欢迎的语言之一。它是作为 [C 的继承人][54]创建的(诞生于 1983 年),重点是[面向对象程序设计(OOP)][55]。C++ 通常被视为 C 的超集,因此 C 程序应该能够使用 C++ 编译器进行编译。这并非完全正确,因为在某些极端情况下它们的行为有所不同。 根据我的经验,C++ 与 C 相比需要更少的样板代码,但是如果要进行面向对象开发,语法会更困难。C++11 标准是最新版本,增加了一些漂亮的功能,并且基本上得到了编译器的支持。 + +由于 C++ 在很大程度上与 C 兼容,因此我将仅强调两者之间的区别。我在本部分中没有涵盖的任何部分,则意味着它与 C 中的相同。 + +#### 安装 + +这个 C++ 示例的依赖项与 C 示例相同。 在 Fedora 上,运行: + +``` +sudo dnf install clang gnuplot gsl gsl-devel +``` + +#### 必要的库 + +库的工作方式与 C 语言相同,但是 `include` 指令略有不同: + +``` +#include +#include +#include +#include +#include +#include +#include + +extern "C" { +#include +#include +} +``` + +由于 GSL 库是用 C 编写的,因此你必须将这个特殊情况告知编译器。 + +#### 定义变量 + +与 C 语言相比,C++ 支持更多的数据类型(类),例如,与其 C 语言版本相比,`string` 类型具有更多的功能。相应地更新变量的定义: + +``` +const std::string input_file_name("anscombe.csv"); +``` + +对于字符串之类的结构化对象,你可以定义变量而无需使用 `=` 符号。 + +#### 打印输出 + +你可以使用 `printf()` 函数,但是 `cout` 对象更惯用。使用运算符 `<<` 来指示要使用 `cout` 打印的字符串(或对象): + +``` +std::cout << "#### Anscombe's first set with C++11 ####" << std::endl; + +... + +std::cout << "Slope: " << slope << std::endl; +std::cout << "Intercept: " << intercept << std::endl; +std::cout << "Correlation coefficient: " << r_value << std::endl; +``` + +#### 读取数据 + +该方案与以前相同。将打开文件并逐行读取文件,但语法不同: + +``` +std::ifstream input_file(input_file_name); + +while (input_file.good()) { + std::string line; + + getline(input_file, line); + + ... +} +``` + +使用与 C99 示例相同的功能提取行字元。代替使用标准的 C 数组,而是使用两个[向量][56]。向量是 [C++ 标准库][57]中对 C 数组的扩展,它允许动态管理内存而无需显式调用 `malloc()`: + +``` +std::vector x; +std::vector y; + +// Adding an element to x and y: +x.emplace_back(value); +y.emplace_back(value); +``` + +#### 拟合数据 + +要在 C++ 中拟合,你不必遍历列表,因为向量可以保证具有连续的内存。你可以将向量缓冲区的指针直接传递给拟合函数: + +``` +gsl_fit_linear(x.data(), 1, y.data(), 1, entries_number, + &intercept, &slope, + &cov00, &cov01, &cov11, &chi_squared); +const double r_value = gsl_stats_correlation(x.data(), 1, y.data(), 1, entries_number); + +std::cout << "Slope: " << slope << std::endl; +std::cout << "Intercept: " << intercept << std::endl; +std::cout << "Correlation coefficient: " << r_value << std::endl; +``` + +#### 绘图 + +使用与以前相同的方法进行绘图。 写入文件: + +``` +const double step_x = ((max_x + 1) - (min_x - 1)) / N; + +for (unsigned int i = 0; i < N; i += 1) { + const double current_x = (min_x - 1) + step_x * i; + const double current_y = intercept + slope * current_x; + + output_file << current_x << "\t" << current_y << std::endl; +} + +output_file.close(); +``` + +然后使用 Gnuplot 进行绘图。 + +#### 结果 + +在运行程序之前,必须使用类似的命令对其进行编译: + +``` +clang++ -std=c++11 -I/usr/include/ fitting_Cpp11.cpp -L/usr/lib/ -L/usr/lib64/ -lgsl -lgslcblas -o fitting_Cpp11 +``` + +命令行上的结果输出为: + +``` +#### Anscombe's first set with C++11 #### +Slope: 0.500091 +Intercept: 3.00009 +Correlation coefficient: 0.816421 +``` + +这就是用 Gnuplot 生成的结果图像: + +![Plot and fit of the dataset obtained with C++11][58] + +### 结论 + +本文提供了用 C99 和 C++11 编写的数据拟合和绘图任务的示例。由于 C++ 在很大程度上与 C 兼容,因此本文利用了它们的相似性来编写了第二个示例。在某些方面,C++ 更易于使用,因为它部分减轻了显式管理内存的负担。但是其语法更加复杂,因为它引入了为 OOP 编写类的可能性。但是,仍然可以用 C 使用 OOP 方法编写软件。由于 OOP 是一种编程风格,因此可以在任何语言中使用。在 C 中有一些很好的 OOP 示例,例如 [GObject][59] 和 [Jansson][60]库。 + +对于数字运算,我更喜欢在 C99 中进行,因为它的语法更简单并且得到了广泛的支持。直到最近,C++11 还没有得到广泛的支持,我倾向于避免使用先前版本中的粗糙不足之处。对于更复杂的软件,C++ 可能是一个不错的选择。 + +你是否也将 C 或 C++ 用于数据科学?在评论中分享你的经验。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/2/c-data-science + +作者:[Cristiano L. Fontana][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/cristianofontana +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/metrics_data_dashboard_system_computer_analytics.png?itok=oxAeIEI- (metrics and data shown on a computer screen) +[2]: https://opensource.com/article/18/9/top-3-python-libraries-data-science +[3]: https://opensource.com/article/19/5/learn-python-r-data-science +[4]: https://en.wikipedia.org/wiki/C99 +[5]: https://en.wikipedia.org/wiki/C%2B%2B11 +[6]: https://en.wikipedia.org/wiki/Anscombe%27s_quartet +[7]: https://linux.cn/article-11943-1.html +[8]: https://en.wikipedia.org/wiki/Command-line_interface +[9]: https://en.wikipedia.org/wiki/Graphical_user_interface +[10]: https://gitlab.com/cristiano.fontana/polyglot_fit +[11]: https://en.wikipedia.org/wiki/Comma-separated_values +[12]: https://en.wikipedia.org/wiki/C_%28programming_language%29 +[13]: https://www.tiobe.com/tiobe-index/ +[14]: https://redmonk.com/sogrady/2019/07/18/language-rankings-6-19/ +[15]: http://pypl.github.io/PYPL.html +[16]: https://octoverse.github.com/ +[17]: https://en.wikipedia.org/wiki/Compiled_language +[18]: https://en.wikipedia.org/wiki/Compiler +[19]: https://en.wikipedia.org/wiki/Machine_code +[20]: https://en.wikipedia.org/wiki/C_standard_library +[21]: https://en.wiktionary.org/wiki/number-crunching +[22]: https://en.wikipedia.org/wiki/Boilerplate_code +[23]: https://clang.llvm.org/ +[24]: https://gcc.gnu.org/ +[25]: https://www.gnu.org/software/gsl/ +[26]: http://www.gnuplot.info/ +[27]: https://en.wikipedia.org/wiki/Berkeley_Software_Distribution +[28]: https://getfedora.org/ +[29]: https://en.wikipedia.org/wiki/Comment_(computer_programming) +[30]: https://en.wikipedia.org/wiki/Include_directive +[31]: https://en.wikipedia.org/wiki/Linker_%28computing%29 +[32]: https://en.wikipedia.org/wiki/Entry_point#C_and_C++ +[33]: https://gitlab.com/cristiano.fontana/polyglot_fit/-/blob/master/fitting_C99.c +[34]: https://en.wikipedia.org/wiki/Linked_list#Singly_linked_list +[35]: http://man7.org/linux/man-pages/man3/queue.3.html +[36]: https://en.wikipedia.org/wiki/Printf_format_string +[37]: http://www.opengroup.org/onlinepubs/009695399/functions/ferror.html +[38]: http://www.opengroup.org/onlinepubs/009695399/functions/feof.html +[39]: http://man7.org/linux/man-pages/man3/getline.3.html +[40]: https://en.wikipedia.org/wiki/POSIX +[41]: https://en.wikipedia.org/wiki/Lexical_analysis#Token +[42]: http://man7.org/linux/man-pages/man3/strtok.3.html +[43]: http://www.opengroup.org/onlinepubs/009695399/functions/strtok.html +[44]: http://www.opengroup.org/onlinepubs/009695399/functions/sscanf.html +[45]: http://www.opengroup.org/onlinepubs/009695399/functions/malloc.html +[46]: http://man7.org/linux/man-pages/man3/malloc.3.html +[47]: https://www.gnu.org/software/gsl/doc/html/lls.html +[48]: https://en.wikipedia.org/wiki/Memory_leak +[49]: http://www.opengroup.org/onlinepubs/009695399/functions/free.html +[50]: http://www.opengroup.org/onlinepubs/009695399/functions/printf.html +[51]: http://www.opengroup.org/onlinepubs/009695399/functions/fprintf.html +[52]: https://opensource.com/sites/default/files/uploads/fit_c99.png (Plot and fit of the dataset obtained with C99) +[53]: https://en.wikipedia.org/wiki/C%2B%2B +[54]: http://www.cplusplus.com/info/history/ +[55]: https://en.wikipedia.org/wiki/Object-oriented_programming +[56]: https://en.wikipedia.org/wiki/Sequence_container_%28C%2B%2B%29#Vector +[57]: https://en.wikipedia.org/wiki/C%2B%2B_Standard_Library +[58]: https://opensource.com/sites/default/files/uploads/fit_cpp11.png (Plot and fit of the dataset obtained with C++11) +[59]: https://en.wikipedia.org/wiki/GObject +[60]: http://www.digip.org/jansson/ diff --git a/published/202003/20200224 What developers need to know about domain-specific languages.md b/published/202003/20200224 What developers need to know about domain-specific languages.md new file mode 100644 index 0000000000..c0e01b7923 --- /dev/null +++ b/published/202003/20200224 What developers need to know about domain-specific languages.md @@ -0,0 +1,130 @@ +[#]: collector: (lujun9972) +[#]: translator: (HankChow) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11957-1.html) +[#]: subject: (What developers need to know about domain-specific languages) +[#]: via: (https://opensource.com/article/20/2/domain-specific-languages) +[#]: author: (Girish Managoli https://opensource.com/users/gammay) + + +开发者需要了解的领域特定语言(DSL) +====== + +> 领域特定语言是在特定领域下用于特定上下文的语言。作为开发者,很有必要了解领域特定语言的含义,以及为什么要使用特定领域语言。 + +![](https://img.linux.net.cn/data/attachment/album/202003/04/112240b0os2988kolritlo.jpg) + +领域特定语言domain-specific language(DSL)是一种旨在特定领域下的上下文的语言。这里的领域是指某种商业上的(例如银行业、保险业等)上下文,也可以指某种应用程序的(例如 Web 应用、数据库等)上下文。与之相比的另一个概念是通用语言general-purpose language(GPL,LCTT 译注:注意不要和 GPL 许可证混淆),通用语言则可以广泛应用于各种商业或应用问题当中。 + +DSL 并不具备很强的普适性,它是仅为某个适用的领域而设计的,但它也足以用于表示这个领域中的问题以及构建对应的解决方案。HTML 是 DSL 的一个典型,它是在 Web 应用上使用的语言,尽管 HTML 无法进行数字运算,但也不影响它在这方面的广泛应用。 + +而 GPL 则没有特定针对的领域,这种语言的设计者不可能知道这种语言会在什么领域被使用,更不清楚用户打算解决的问题是什么,因此 GPL 会被设计成可用于解决任何一种问题、适合任何一种业务、满足任何一种需求。例如 Java 就属于 GPL,它可以在 PC 或移动设备上运行,嵌入到银行、金融、保险、制造业等各种行业的应用中去。 + +### DSL 的类别 + +从使用方式的角度,语言可以划分出以下两类: + +* DSL:使用 DSL 形式编写或表示的语言 +* 宿主语言host language:用于执行或处理 DSL 的语言 + +由不同的语言编写并由另一种宿主语言处理的 DSL 被称为外部external DSL。 + +以下就是可以在宿主语言中处理的 SQL 形式的 DSL: + +``` +SELECT account +FROM accounts +WHERE account = '123' AND branch = 'abc' AND amount >= 1000 +``` + +因此,只要在规定了词汇和语法的情况下,DSL 也可以直接使用英语来编写,并使用诸如 ANTLR 这样的解析器生成器parser generator以另一种宿主语言来处理 DSL: + +``` +if smokes then increase premium by 10% +``` + +如果 DSL 和宿主语言是同一种语言,这种 DSL 称为内部internalDSL,其中 DSL 由以同一种语义的宿主语言编写和处理,因此又称为嵌入式embedded DSL。以下是两个例子: + +* Bash 形式的 DSL 可以由 Bash 解释器执行: + + ``` +if today_is_christmas; then apply_christmas_discount; fi +``` + 同时这也是一段看起来符合英语语法的 Bash。 +* 使用类似 Java 语法编写的 DSL: + + ``` +orderValue = orderValue + .applyFestivalDiscount() + .applyCustomerLoyalityDiscount() + .applyCustomerAgeDiscount(); +``` + 这一段的可读性也相当强。 + +实际上,DSL 和 GPL 之间并没有非常明确的界限。 + +### DSL 家族 + +以下这些语言都可以作为 DSL 使用: + +* Web 应用:HTML +* Shell:用于类 Unix 系统的 sh、Bash、CSH 等;用于 Windows 系统的 MS-DOS、Windows Terminal、PowerShell 等 +* 标记语言:XML +* 建模:UML +* 数据处理:SQL 及其变体 +* 业务规则管理:Drools +* 硬件:Verilog、VHD +* 构建工具:Maven、Gradle +* 数值计算和模拟:MATLAB(商业)、GNU Octave、Scilab +* 解析器和生成器:Lex、YACC、GNU Bison、ANTLR + +### 为什么要使用 DSL? + +DSL 的目的是在某个领域中记录一些需求和行为,在某些方面(例如金融商品交易)中,DSL 的适用场景可能更加狭窄。业务团队和技术团队能通过 DSL 有效地协同工作,因此 DSL 除了在业务用途上有所发挥,还可以让设计人员和开发人员用于设计和开发应用程序。 + +DSL 还可以用于生成一些用于解决特定问题的代码,但生成代码并不是 DSL 的重点并不在此,而是对专业领域知识的结合。当然,代码生成在领域工程中是一个巨大的优势。 + +### DSL 的优点和缺点 + +DSL 的优点是,它对于领域的特征捕捉得非常好,同时它不像 GPL 那样包罗万有,学习和使用起来相对比较简单。因此,它在专业人员之间、专业人员和开发人员之间都提供了一个沟通的桥梁。 + +而 DSL 最显著的缺点就在于它只能用于一个特定的领域和目标。尽管学习起来不算太难,但学习成本仍然存在。如果使用到 DSL 相关的工具,即使对工作效率有所提升,但开发或配置这些工具也会增加一定的工作负担。另外,如果要设计一款 DSL,设计者必须具备专业领域知识和语言开发知识,而同时具备这两种知识的人却少之又少。 + +### DSL 相关软件 + +开源的 DSL 软件包括: + +* Xtext:Xtext 可以与 Eclipse 集成,并支持 DSL 开发。它能够实现代码生成,因此一些开源和商业产品都用它来提供特定的功能。用于农业活动建模分析的多用途农业数据系统Multipurpose Agricultural Data System(MADS)就是基于 Xtext 实现的一个项目,可惜的是这个项目现在已经不太活跃了。 +* JetBrains MPS:JetBrains MPS 是一个可供开发 DSL 的集成开发环境Integrated Development Environment,它将文档在底层存储为一个抽象树结构(Microsoft Word 也使用了这一概念),因此它也自称为一个投影编辑器projectional editor。JetBrains MPS 支持 Java、C、JavaScript 和 XML 的代码生成。 + +### DSL 的最佳实践 + +如果你想使用 DSL,记住以下几点: + +* DSL 不同于 GPL,DSL 只能用于解决特定领域中有限范围内的问题。 +* 不必动辄建立自己的 DSL,可以首先尝试寻找已有的 DSL。例如 [DSLFIN][4] 这个网站就提供了很多金融方面的 DSL。在实在找不到合适的 DSL 的情况下,才需要建立自己的 DSL。 +* DSL 最好像平常的语言一样具有可读性。 +* 尽管代码生成不是一项必需的工作,但它确实会大大提高工作效率。 +* 虽然 DSL 被称为语言,但 DSL 不需要像 GPL 一样可以被执行,可执行性并不是 DSL 需要达到的目的。 +* DSL 可以使用文本编辑器编写,但专门的 DSL 编辑器可以更轻松地完成 DSL 的语法和语义检查。 + +如果你正在使用或将要使用 DSL,欢迎在评论区留言。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/2/domain-specific-languages + +作者:[Girish Managoli][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/gammay +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/programming_language_c.png?itok=mPwqDAD9 (Various programming languages in use) +[2]: https://en.wikipedia.org/wiki/Domain-specific_language +[3]: http://mads.sourceforge.net/ +[4]: http://www.dslfin.org/resources.html diff --git a/published/202003/20200225 3 eBook readers for the Linux desktop.md b/published/202003/20200225 3 eBook readers for the Linux desktop.md new file mode 100644 index 0000000000..07fbb8f09a --- /dev/null +++ b/published/202003/20200225 3 eBook readers for the Linux desktop.md @@ -0,0 +1,113 @@ +[#]: collector: (lujun9972) +[#]: translator: (wenwensnow) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11990-1.html) +[#]: subject: (3 eBook readers for the Linux desktop) +[#]: via: (https://opensource.com/article/20/2/linux-ebook-readers) +[#]: author: (Scott Nesbitt https://opensource.com/users/scottnesbitt) + +可在 Linux 桌面使用的 3 个电子书阅读器应用 +====== + +> 任意一个开源电子书应用都能使你在大屏设备上的阅读体验得到提升。 + +![电脑浏览器阅读书籍界面][1] + +我通常使用手机或 Kobo 阅读器阅读电子书,总是没有在大屏设备上阅读书籍那么爽。很多人经常在自己的笔记本或桌面电脑上阅读电子书,如果你有这种需求(或者你认为以后会遇到这种情况),我想向你介绍三种 Linux 桌面下的电子书阅读器。 + +### Bookworm(书虫) + +[Bookworm][2] 意在成为一个“简洁、专注的电子书阅读器”。事实证明它也确实做到了。Bookworm 内置一系列基础功能,有人抱怨它太过*简单*,缺少*功能性*(虽然这词显然有点指意不明)。Bookworm 起到了应有的作用而没有无关的花哨功能。 + +该应用的界面整洁干净。 + +![Bookworm 电子书应用][3] + +你可通过以下方式查看书籍: + +* 空格键前往下一页 +* 上下方向键按行移动 +* 左右方向键跳转至前后章节 + +你也可以通过添加注释或书签跳转至特定页面。 + +![Bookworm 注释][4] + +Bookworm 没有太多设置选项。你能调整书籍字体大小及间距,开启双页模式或夜间模式。在应用中添加新文件夹后,Bookworm 会自动扫描文件夹中的电子书。 + +![Bookworm 参数设置][5] + +Bookworm 支持常用的电子书格式:EPUB、PDF、MOBI、[FB2][6],你还能用它阅读 [CBR][7] 和 CBZ 格式的数字版漫画。我只在 Bookworm 上测试了前三种格式,PDF 倒是能打开,但加载速度很慢,格式也很难看。 + +### Foliate + +单从功能上来说,[Foliate][8] 确实比 Bookworm 强上一些。Foliate 不仅功能更强,它还有更多设置选项。这个功能多样、简单干净的应用满足了所有要求。 + +![Foliate 电子书应用][9] + +在 Foliate 中可以通过空格、方向键、向上或向下翻页键浏览电子书,这里没什么特别的。 + +你还可以在书籍中添加注释、查找以及翻译字句、查询字词含义。如果你电脑上安装了智能语音应用, Foliate 还能将文本朗读出来。 + +![在 Foliate 中的注释文本][10] + +Foliate 与 Bookworm 相比有更多自定义选项。你能在应用中修改字体类型及大小、行间距、电子书页边距,也可以调高或降低屏幕亮度,从应用内置的四个主题中选择一个等。 + +![Foliate 设置][11] + +你可以在 Foliate 上阅读 EPUB、MOBI、AZW、AZW3 格式的电子书。如果你不了解,我可以提前告诉你,后三种格式是亚马逊 Kindle 阅读器上架的书籍的闭源格式。 + +### Calibre 电子书阅读器 + +这个[电子书阅读器][12]是 [Calibre][13] 电子书管理工具的一个组件,就像它的前代一样,电子书阅读器这部分并不是软件整体最棒的部分。 + +![电子书阅读器应用][14] + +不过别被上面的话吓到,它也的确是个桌面电子书阅读器。 + +在 Calibre 电子书阅读器中,你可以通过方向键、向上/向下翻页键以及空格浏览书籍,还能在在线字典中查找词语含义,添加书签。这一阅读器没有注释功能,但内置的搜索引擎却很好用,你还能将书籍保存为 PDF 格式(虽然我不太明白你为什么要这么做)。 + +不过参数设置这里确是它出彩的地方,它的可选设置比 Bookworm 和 Foliate 加起来都多,从字体到文本布局,页面分割方式你都能改。除此之外,你还能自定义应用按键设置,将你喜欢的词典网站添加进来,方便阅读查找。 + +![电子书参数设置][15] + +Calibre 电子书阅读器一个很有用的功能,就是把自行设置的 CSS 配置文件效果应用到电子书上。赘言一句,CSS 是一种调整网页格式的方法(这类文件就是许多电子书的一个组成部分)。如果你是使用 CSS 的高手,你可以将自己的 CSS 文件复制粘贴到配置窗口的 “User stylesheet” 部分,这就是个性化的究极办法。 + +据开发者描述,这一电子书阅读器“能支持所有主流电子书格式”。如果你想知道具体支持格式是什么,[这是列表链接][16]。我测试了列表中的一小部分格式,没有发现问题。 + +### 留在最后的话 + +不管你只是单纯想找个电子书阅读器,还是有个更多复杂功能的应用,上文提到的三个选择都很不错,而且它们都能提升你在大屏设备上的阅读体验。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/2/linux-ebook-readers + +作者:[Scott Nesbitt][a] +选题:[lujun9972][b] +译者:[wenwensnow](https://github.com/wenwensnow) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/scottnesbitt +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/computer_browser_program_books_read.jpg?itok=iNMWe8Bu (Computer browser with books on the screen) +[2]: https://babluboy.github.io/bookworm/ +[3]: https://opensource.com/sites/default/files/uploads/bookworm-reading.png (Bookworm e-book application) +[4]: https://opensource.com/sites/default/files/uploads/bookworm-annotations.png (Annotations in Bookworm) +[5]: https://opensource.com/sites/default/files/uploads/bookworm-preferences.png (Bookworm preferences) +[6]: https://en.wikipedia.org/wiki/FictionBook +[7]: https://en.wikipedia.org/wiki/Comic_book_archive +[8]: https://johnfactotum.github.io/foliate/ +[9]: https://opensource.com/sites/default/files/uploads/foliate-reading.png (Foliate e-book application) +[10]: https://opensource.com/sites/default/files/uploads/foliate-annotation_0.png +[11]: https://opensource.com/sites/default/files/uploads/foliate-settings.png (Foliate settings) +[12]: https://calibre-ebook.com/about +[13]: https://opensourcemusings.com/managing-your-ebooks-with-calibre +[14]: https://opensource.com/sites/default/files/uploads/e-book_viewer-reading.png (E-book Viewer application) +[15]: https://opensource.com/sites/default/files/uploads/ebook-viewer-preferences.png (E-book Viewer preferences) +[16]: https://manual.calibre-ebook.com/faq.html#what-formats-does-calibre-support-conversion-to-from +[17]: https://opensourcemusings.com/three-ebook-readers-for-the-linux-desktop +[18]: https://creativecommons.org/licenses/by-sa/4.0/ diff --git a/published/202003/20200225 7 tips for writing an effective technical resume.md b/published/202003/20200225 7 tips for writing an effective technical resume.md new file mode 100644 index 0000000000..5748eea651 --- /dev/null +++ b/published/202003/20200225 7 tips for writing an effective technical resume.md @@ -0,0 +1,73 @@ +[#]: collector: (lujun9972) +[#]: translator: (Morisun029) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12020-1.html) +[#]: subject: (7 tips for writing an effective technical resume) +[#]: via: (https://opensource.com/article/20/2/technical-resume-writing) +[#]: author: (Emily Brand https://opensource.com/users/emily-brand) + +撰写有效的技术简历的 7 个技巧 +====== + +> 遵循以下这些要点,把自己最好的一面呈现给潜在雇主。 + +![](https://img.linux.net.cn/data/attachment/album/202003/21/092248u2w2gz2aezre2ba2.jpg) + +如果你是一名软件工程师或技术领域的经理,那么创建或更新简历可能是一项艰巨的任务。要考虑的重点是什么?应该怎么把控格式、内容以及求职目标或摘要?哪些工作经验相关?如何确保自动化招聘工具不会过滤掉你的简历? + +在过去的七年中,作为一名招聘经理,我看到了各种各样的简历;尽管有些令人印象深刻,但还有很多人写的很糟糕。 + +在编写或更新简历时,请遵循以下七个简单原则。 + +### 1、概述 + +简历顶部的简短段落应简洁明了、目的明确,避免过度使用形容词和副词。诸如“令人印象深刻”、“广泛”和“卓越”之类的词,这些词不会增加你的招聘机会;相反,它们看起来和感觉上像是过度使用的填充词。 关于你的求职目标,问自己一个重要的问题:**它是否告诉招聘经理我正在寻找什么样的工作以及如何为他们提供价值?** 如果不是,请加强并简化它以回答该问题,或者将其完全排除在外。 + +### 2、工作经验 + +数字、数字、数字——重要的事情说三遍。用确凿的事实传达观点远比一般的陈述,例如“帮助构建、管理、交付许多对客户利润有贡献的项目”更能对你有帮助。你的表达中应包括统计数据,例如“直接影响了 5 个顶级银行的项目,这些项目将其上市时间缩短了 40%”,你提交了多少行代码或管理了几个团队。数据比修饰语更能有效地展示你的能力和价值。 + +如果你经验不足,没有什么工作经验可展示,那些无关的经验,如暑期兼职工作,就不要写了。相反,将相关经验的细节以及你所学到的知识的详细信息写进简历,这些可以使你成为一个更好的候选人。 + +### 3、搜索术语和行话 + +随着技术在招聘过程中发挥如此巨大的作用,确保简历被标记为正确的职位非常重要,但不要在简历上过分吹嘘自己。如果你提到敏捷技能但不知道看板是什么,请三思。如果你提到自己精通 Java,但是已经有五年都没有使用过 Java 了,请小心。如果存在你熟悉但不一定是当前在用的语言和框架,请创建其他类别或将你的经验分为“精通”和“熟悉”。 + +### 4、教育 + +如果你不是应届大学毕业生,那就没必要再写你的 GPA 或你参加过的俱乐部或兄弟会,除非你计划将它们用作谈话要点以在面试中赢得信任。确保将你发表的或获取过专利的东西包括在内,即使它与该工作无关。如果你没有大学学位,请添加一个证书部分代替教育背景部分。如果你是军人,请包括现役和预备役时间。 + +### 5、资质证书 + +除非你想重新进入之前离开的领域,否则不要写过期的证书,例如,如果你曾经是一名人事经理,而现在正寻求动手编程的工作。如果你拥有与该领域不再相关的认证,就不要写这些认证,因为这些可能会分散招聘者的注意力,使你的简历失去吸引力。利用你的 LinkedIn 个人资料为简历添加更多色彩,因为大多数人在面试之前都会阅读你的简历和 LinkedIn 个人资料。 + +### 6、拼写和语法 + +让其他人帮忙对你的简历校对一下。很多时候,我在简历中看到过拼写错误的单词,或者错误用词,如“他们的”、“他们是”、“那些”。这些可以避免和修复的错误会产生负面影响。理想情况下,你的简历应用主动语态,但是如果这样会使你感到不舒服,那么就用过去时书写 —— 最重要的是要始终保持一致。不正确的拼写和语法会传递你要么不是很在乎所申请的工作,要么没有足够注意细节。 + +### 7、格式 + +确保你的简历是最新的并且富有吸引力,这是留下良好第一印象的简便方法。确保格式一致,例如相同的页边距,相同的间距、大写字母和颜色(将调色板保持在最低限度,不要花花绿绿)是简历写作中最基本的部分,但有必要表明你对工作感到自豪,并重视自己的价值和未来的雇主。在适当的地方使用表格,以视觉吸引人的方式分配信息。如果支持的话,以 .pdf 和 .docx 格式上传简历,然后用 Google Docs 导出为 .odt 格式,这样可以在 LibreOffice 中轻松打开。这里有一个我推荐的简单的 Google 文档[简历模板][2]。 你还可以支付少量费用(不到 10 美元)从一些设计公司购买模板。 + +### 定期更新 + +如果你需要(或希望)申请一份工作,定期更新简历可以最大程度地减少压力,也可以帮助你创建和维护更准确的简历版本。撰写简历时,要有远见,确保至少让另外三个人对你的简历内容、拼写和语法进行检查。即使你是由公司招募或其他人推荐给公司的,面试官也可能只能通过简历来认识你,因此请确保它为你带来良好的第一印象。 + +你还有其他提示要添加吗? + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/2/technical-resume-writing + +作者:[Emily Brand][a] +选题:[lujun9972][b] +译者:[Morisun029](https://github.com/Morisun029) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/emily-brand +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/resume_career_document_general.png?itok=JEaFL2XI (Two hands holding a resume with computer, clock, and desk chair ) +[2]: https://docs.google.com/document/d/1ARVyybC5qQEiCzUOLElwAdPpKOK0Qf88srr682eHdCQ/edit diff --git a/published/202003/20200226 Use logzero for simple logging in Python.md b/published/202003/20200226 Use logzero for simple logging in Python.md new file mode 100644 index 0000000000..e6bcd095c4 --- /dev/null +++ b/published/202003/20200226 Use logzero for simple logging in Python.md @@ -0,0 +1,140 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11970-1.html) +[#]: subject: (Use logzero for simple logging in Python) +[#]: via: (https://opensource.com/article/20/2/logzero-python) +[#]: author: (Ben Nuttall https://opensource.com/users/bennuttall) + +使用 logzero 在 Python 中进行简单日志记录 +====== + +> 快速了解一个方便的日志库,来帮助你掌握这个重要的编程概念。 + +![](https://img.linux.net.cn/data/attachment/album/202003/07/122445v743hy7ajdyrrda1.jpg) + +logzero 库使日志记录就像打印语句一样容易,是简单性的杰出代表。我不确定 logzero 的名称是否要与 pygame-zero、GPIO Zero 和 guizero 这样的 “zero 样板库”契合,但是肯定属于该类别。它是一个 Python 库,可以使日志记录变得简单明了。 + +你可以使用它基本的记录到标准输出的日志记录,就像你可以使用 print 来获得信息和调试一样,学习它的更高级日志记录(例如记录到文件)的学习曲线也很平滑。 + +首先,使用 pip 安装 logzero: + +``` +$ sudo pip3 install logzero +``` + +在 Python 文件中,导入 logger 并尝试以下一个或所有日志实例: + +``` +from logzero import logger + +logger.debug("hello") +logger.info("info") +logger.warning("warning") +logger.error("error") +``` + +输出以易于阅读的方式自动着色: + +![Python, Raspberry Pi: import logger][2] + +因此现在不要再使用 `print` 来了解发生了什么,而应使用有相关日志级别的日志器。 + +### 在 Python 中将日志写入文件 + +如果你阅读至此,并会在你写代码时做一点改变,这对我就足够了。如果你要了解更多,请继续阅读! + +写到标准输出对于测试新程序不错,但是仅当你登录到运行脚本的计算机时才有用。在很多时候,你需要远程执行代码并在事后查看错误。这种情况下,记录到文件很有帮助。让我们尝试一下: + +``` +from logzero import logger, logfile + +logfile('/home/pi/test.log') +``` + +现在,你的日志条目将记录到文件 `test.log` 中。记住确保[脚本有权限][3]写入该文件及其目录结构。 + +你也可以指定更多选项: + +``` +logfile('/home/pi/test.log', maxBytes=1e6, backupCount=3) +``` + +现在,当提供给 `test.log` 文件的数据达到 1MB(10^6 字节)时,它将通过 `test.log.1`、`test.log.2` 等文件轮替写入。这种行为可以避免系统打开和关闭大量 I/O 密集的日志文件,以至于系统无法打开和关闭。更专业一点,你或许还要记录到 `/var/log`。假设你使用的是 Linux,那么创建一个目录并将用户设为所有者,以便可以写入该目录: + +``` +$ sudo mkdir /var/log/test +$ sudo chown pi /var/log/test +``` + +然后在你的 Python 代码中,更改 `logfile` 路径: + +``` +logfile('/var/log/test/test.log', maxBytes=1e6, backupCount=3) +``` + +当要在 `logfile` 中捕获异常时,可以使用 `logging.exception`: + +``` +try: +    c = a / b +except Exception as e: +    logger.exception(e) +``` + +这将输出(在 `b` 为零的情况下): + +``` +[E 190422 23:41:59 test:9] division by zero +     Traceback (most recent call last): +       File "test.py", line 7, in +         c = a / b +     ZeroDivisionError: division by zero +``` + +你会得到日志,还有完整回溯。另外,你可以使用 `logging.error` 并隐藏回溯: + +``` +try: +    c = a / b +except Exception as e: +    logger.error(f"{e.__class__.__name__}: {e}") +``` + +现在,将产生更简洁的结果: + +``` +[E 190423 00:04:16 test:9] ZeroDivisionError: division by zero +``` + +![Logging output][4] + +你可以在 [logzero.readthedocs.io] [5] 中阅读更多选项。 + +### logzero 为教育而生 + +对于新手程序员来说,日志记录可能是一个具有挑战性的概念。大多数框架依赖于流控制和大量变量操作来生成有意义的日志,但是 logzero 不同。由于它的语法类似于 `print` 语句,因此它在教育上很成功,因为它无需解释其他概念。在你的下个项目中试试它。 + + +此文章最初发布在[我的博客][6]上,经许可重新发布。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/2/logzero-python + +作者:[Ben Nuttall][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/bennuttall +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/getting_started_with_python.png?itok=MFEKm3gl (Snake charmer cartoon with a yellow snake and a blue snake) +[2]: https://opensource.com/sites/default/files/uploads/rpi_ben_1.png (Python, Raspberry Pi: import logger) +[3]: https://opensource.com/article/19/6/understanding-linux-permissions +[4]: https://opensource.com/sites/default/files/uploads/rpi_ben_2.png (Logging output) +[5]: https://logzero.readthedocs.io/en/latest/ +[6]: https://tooling.bennuttall.com/logzero/ diff --git a/published/202003/20200228 Converting between uppercase and lowercase on the Linux command line.md b/published/202003/20200228 Converting between uppercase and lowercase on the Linux command line.md new file mode 100644 index 0000000000..a90b4d411c --- /dev/null +++ b/published/202003/20200228 Converting between uppercase and lowercase on the Linux command line.md @@ -0,0 +1,157 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11983-1.html) +[#]: subject: (Converting between uppercase and lowercase on the Linux command line) +[#]: via: (https://www.networkworld.com/article/3529409/converting-between-uppercase-and-lowercase-on-the-linux-command-line.html) +[#]: author: (Sandra Henry-Stocker https://www.networkworld.com/author/Sandra-Henry_Stocker/) + +在 Linux 命令行中转换大小写 +====== + +> 转换文本的大小写可能非常繁琐,尤其是当你要避免无意间的拼写错误时。幸运的是,Linux 提供了一些命令,可以使工作变得非常容易。 + +![](https://img.linux.net.cn/data/attachment/album/202003/11/095821df7u8nlyfyyydqvf.jpg) + +有很多方法可以在 Linux 命令行中将文本从小写更改为大写,反之亦然。实际上,有一组这样的命令可以选择。这篇文章检验了一些最佳的命令来完成这项工作,以及你该如何让它们正常工作。 + +### 使用 tr + +`tr`(translate)命令是在命令行或脚本中最容易使用的命令之一。如果你要确定要一串大写字符串,你只需将它传给 `tr`,如下所示: + +``` +$ echo Hello There | tr [:lower:] [:upper:] +HELLO THERE +``` + +下面是一个在脚本中使用这个命令的例子,当你要确保添加到文件中的所有文本都使用大写形式以保持一致性时(LCTT 译注:这里输入部门名称作为示例): + +``` +#!/bin/bash + +echo -n "Enter department name: " +read dept +echo $dept | tr [:lower:] [:upper:] >> depts +``` + +将顺序切换为 `[:upper:] [:lower:]` 会产生相反的效果,将所有大写的部门名称都转换为小写: + +``` +echo $dept | tr [:upper:] [:lower:] >> depts +``` + +同样,你可以使用 `sed` 命令的 `A-Z` 和 `a-z` 字符串完成相同的操作: + +``` +echo $dept | tr a-z A-Z >> depts +``` + +毫无疑问,反转 `a-z` 和 `A-Z` 字符串的顺序将产生相反的效果,将文本全部变为小写。 + +### 使用 awk + +`awk` 命令可让你使用它的 `toupper` 和 `tolower` 选项执行相同的操作。上例脚本中的命令可以用这种方式代替: + +``` +echo $dept | awk '{print toupper($0)}' >> depts +``` + +相反操作(切换为小写)如下所示: + +``` +echo $dept | awk '{print tolower($0)}' >> depts +``` + +### 使用 sed + +`sed`(stream editor)命令也可用于切换大小写。它与上面显示的两个命令中的第一个具有相同的效果。 + +``` +echo $dept | sed 's/[a-z]/\U&/g' >> depts +``` + +从大写字母切换到小写字母只需将行尾附近的 `U` 替换为 `L`。 + +``` +echo $dept | sed 's/[A-Z]/\L&/g' >> depts +``` + +### 操作文件中的文本 + +`awk` 和 `sed` 都能更改整个文件的文本大小写。因此,你发现你的老板需要所有部门名称的小写么?没问题。只需带上文件名运行以下命令: + +``` +$ awk '{print tolower($0)}' depts +finance +billing +bookkeeping +``` + +如果要覆盖 `depts` 文件,而不仅仅是以小写形式显示,则需要执行以下操作: + +``` +$ awk '{print tolower($0)}' depts > depts- +$ mv depts- depts +``` + +但是,使用 `sed` 进行更改,你可以避免最后一步,因为 `sed` 可以“原地”编辑文件,如下所示,文件完整,但文本全部小写: + +``` +$ sed 's/[A-Z]/\L&/g' depts +``` + +### 仅将首字母转换为大写 + +要仅将字符串中单词的首字母转换为大写,那么可以执行以下操作: + +``` +$ echo design \& engineering| sed -e "s/\b\(.\)/\u\1/g" +Design & Engineering +``` + +该命令将确保首字母大写,但不会更改其余字母。 + +### 确保只有首字母大写 + +当要更改文本以使只有首字母大写时,这更具挑战性。假设你正在处理一个工作人员姓名列表,并且希望以正常的“名 姓”方式对其格式化。 + +#### 使用 sed + +你可以使用更复杂的 `sed` 命令来确保以下结果: + +``` +$ echo design \& ENGINEERING | sed 's/\b\([[:alpha:]]\)\([[:alpha:]]*\)\b/\u\1\L\2/g' +Design & Engineering +``` + +#### 使用 Python + +如果你已安装 Python,你可以运行这样的命令,它还可以设置文本格式,以便每个单词只有首字母大写,并且它可能比上面显示的 `sed` 命令更易于解析: + +``` +$ echo -n "design & engineering" | python3 -c "import sys; print(sys.stdin.read().title())" +Design & Engineering +``` + +有多种方法可以在大小写之间更改文本格式。哪种方法效果最好取决于你要处理的是单个字符串还是整个文件,以及想要的最终结果。 + +-------------------------------------------------------------------------------- + +via: https://www.networkworld.com/article/3529409/converting-between-uppercase-and-lowercase-on-the-linux-command-line.html + +作者:[Sandra Henry-Stocker][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://www.networkworld.com/author/Sandra-Henry_Stocker/ +[b]: https://github.com/lujun9972 +[1]:https://images.idgesg.net/images/article/2019/04/alphabetic_letters_characters_language_by_andybrandon50_cc_by-sa_2-0_1500x1000-100794409-large.jpg +[2]: https://creativecommons.org/licenses/by-sa/2.0/legalcode +[3]: https://www.networkworld.com/newsletters/signup.html +[4]: https://www.networkworld.com/article/3440100/take-the-intelligent-route-with-consumption-based-storage.html?utm_source=IDG&utm_medium=promotions&utm_campaign=HPE21620&utm_content=sidebar ( Take the Intelligent Route with Consumption-Based Storage) +[5]: https://www.facebook.com/NetworkWorld/ +[6]: https://www.linkedin.com/company/network-world diff --git a/published/202003/20200302 How to Add New Brushes in GIMP -Quick Tip.md b/published/202003/20200302 How to Add New Brushes in GIMP -Quick Tip.md new file mode 100644 index 0000000000..4608cec762 --- /dev/null +++ b/published/202003/20200302 How to Add New Brushes in GIMP -Quick Tip.md @@ -0,0 +1,104 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11975-1.html) +[#]: subject: (How to Add New Brushes in GIMP [Quick Tip]) +[#]: via: (https://itsfoss.com/add-brushes-gimp/) +[#]: author: (Community https://itsfoss.com/author/itsfoss/) + +快速技巧:如何在 GIMP 中添加新画笔 +====== + +[GIMP][1] 是最流行的自由开源的图像编辑器,它也许是 Linux 上最好的 [Adobe Photoshop 替代品][2]。 + +当你[在 Ubuntu 或其他任何操作系统上安装了 GIMP 后][3],你会发现已经安装了一些用于基本图像编辑的画笔。如果你需要更具体的画笔,你可以随时在 GIMP 中添加新画笔。 + +怎么样?让我在这个快速教程中向你展示。 + +### 如何在 GIMP 中添加画笔 + +![][4] + +在 GIMP 中安装新画笔需要三个步骤: + +* 获取新画笔 +* 将其放入指定的文件夹中 +* 刷新 GIMP 中的画笔 + +#### 步骤 1:下载新的 GIMP 画笔 + +第一步是获取新的 GIMP 画笔。你从哪里获取?当然是从互联网上。 + +你可以在 Google 或[如 Duck Duck Go 这种隐私搜索引擎][5]来搜索 “GIMP brushes”,并从网站下载一个你喜欢的。 + +GIMP 画笔通常以 .gbr 和 .gih 文件格式提供。.gbr 文件用于常规画笔,而 .gih 用于动画画笔。 + +> 你知道吗? +> +> 从 2.4 版本起,GIMP 使安装和使用 Photoshop 画笔(.abr 文件)非常简单。你只需将 Photoshop 画笔文件放在正确的文件夹中。 +> +> 请记住,最新的 Photoshop 画笔可能无法完美地在 GIMP 中使用。 + +#### 步骤 2:将新画笔复制到它的位置 + +获取画笔文件后,下一步是复制该文件并将其粘贴到 GIMP 配置目录中所在的文件夹。 + +> 在微软 Windows 上,你必须进入类似 `C:\Documents and Settings\myusername.gimp-2.10\brushes` 这样的文件夹。 + +我将展示 Linux 上的详细步骤,因为我们是一个专注于 Linux 的网站。 + +选择画笔文件后,在家目录中按下 `Ctrl+h` [查看 Linux 中的隐藏文件][6]。 + +![Press Ctrl+H to see hidden files in the home directory][7] + +你应该进入 `.config/GIMP/2.10/brushes` 文件夹(如果你使用的是 GIMP 2.10)。如果使用其他版本,那么应在 `.config/GIMP` 下看到相应文件夹。 + +![Adding New Brushes in GIMP][8] + +将画笔文件粘贴到此文件夹中。可选地,你可以通过再次按 `Ctrl+h` 来隐藏隐藏的文件。 + +#### 步骤 3:刷新画笔(避免重启 GIMP) + +GIMP 将在启动时自动加载画笔。如果已在运行,并且不想关闭它,你可以刷新画笔。 + +在 GIMP 的主菜单中找到 “Windows->Dockable Dialogues->Brushes”。 + +![Refresh GIMP Brushes by going go to Windows->Dockable Dialogues-> Brushes][9] + +在右侧栏的 Brushes 对话框中找到“refresh”图标。 + +![Refresh GIMP Brushes][10] + +如果你的画笔没有出现,那么你可以试试重启 GIMP。 + +> 额外的技巧! +> +> 在 [GIMP 中添加新画笔还能让你轻松给图片添加水印][11]。只需将 logo 用作画笔,并点击一下就可添加到图片中。 + +我希望你喜欢这个快速 GIMP 技巧。敬请期待更多。 + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/add-brushes-gimp/ + +作者:[Community][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://itsfoss.com/author/itsfoss/ +[b]: https://github.com/lujun9972 +[1]: https://www.gimp.org/ +[2]: https://itsfoss.com/open-source-photoshop-alternatives/ +[3]: https://itsfoss.com/gimp-2-10-release/ +[4]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/03/Install-New-Brushes-in-GIMP.jpg?ssl=1 +[5]: https://itsfoss.com/privacy-search-engines/ +[6]: https://itsfoss.com/hide-folders-and-show-hidden-files-in-ubuntu-beginner-trick/ +[7]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/03/adding-brushes-GIMP-1.jpg?ssl=1 +[8]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/03/adding-brushes-GIMP.png?ssl=1 +[9]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/03/Refresh-GIMP-Brushes.jpg?ssl=1 +[10]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/03/Refresh-GIMP-Brushes-2.jpg?ssl=1 +[11]: https://itsfoss.com/add-watermark-gimp-linux/ diff --git a/published/202003/20200302 Install GNU Emacs on Windows.md b/published/202003/20200302 Install GNU Emacs on Windows.md new file mode 100644 index 0000000000..7432b0e600 --- /dev/null +++ b/published/202003/20200302 Install GNU Emacs on Windows.md @@ -0,0 +1,99 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11971-1.html) +[#]: subject: (Install GNU Emacs on Windows) +[#]: via: (https://opensource.com/article/20/3/emacs-windows) +[#]: author: (Seth Kenlon https://opensource.com/users/seth) + +如何在 Windows 上安装 GNU Emacs +====== + +> 即使你的操作系统是闭源的,你仍然可以使用这个流行的开源文本编辑器。 + +![](https://img.linux.net.cn/data/attachment/album/202003/08/094942ihwcnsqojnup46wo.jpg) + +GNU Emacs 是一个专为各种程序员设计的流行的文本编辑器。因为它是在 Unix 上开发的,并在 Linux(macOS 中也有)上得到了广泛使用,所以人们有时没有意识到它也可用于微软 Windows 上。你也无需成为有经验的或专职的程序员即可使用 Emacs。只需单击几下就可以下载并安装 Emacs,本文向你展示了如何进行。 + +你可以手动安装 Windows,也可以使用包管理器安装,例如 [Chocolatey][2]。 + +### 7-zip + +如果还没在 Windows 中安装 7-zip,那么就先安装它。[7-zip][3] 是一个开源的归档程序,能够创建和解压 ZIP、7z、TAR、XZ、BZIP2 和 GZIP(以及更多)文件。对于 Windows 用户来说,这是一个宝贵的工具。 + +安装 7-zip 后,在 Windows 资源管理器中浏览文件时,右键单击菜单中就有新的 7-zip 归档选项。 + +### Powershell 和 Chocolatey + +要在 Windows 上使用 Chocolatey 安装 GNU Emacs : + +``` +PS> choco install emacs-full +``` + +安装后,在 Powershell 中启动 Emacs: + +``` +PS> emacs +``` + +![Emacs running on Windows][4] + +### 下载适用于 Windows 的 GNU Emacs + +要在 Windows 上手动安装 GNU Emacs,你必须[下载 Emacs][5]。 + +![GNU Windows downloader][6] + +它会打开连接到离你最近的服务器,并展示所有可用的 Emacs 版本。找到发行版本号最高的目录,然后单击进入。Windows 有许多不同的 Emacs 构建,但是最通用的版本只是被命名为 `emacs-VERSION-ARCHITECTURE.zip`。`VERSION` 取决于你要下载的版本,而 `ARCHITECTURE` 取决于你使用的是 32 位还是 64 位计算机。大多数现代计算机都是 64 位的,但是如果你有疑问,可以下载 32 位版本,它可在两者上运行。 + +如果要下载 64 位计算机的 Emacs v26,你应该点击 `emacs-26.2-x86_64.zip` 的链接。有较小的下载包(例如 “no-deps” 等),但是你必须熟悉如何从源码构建 Emacs,知道它需要哪些库以及你的计算机上已经拥有哪些库。通常,获取较大版本的 Emacs 最容易,因为它包含了在计算机上运行所需的一切。 + +### 解压 Emacs + +接下来,解压下载的 ZIP 文件。要解压缩,请右键单击 Emacs ZIP 文件,然后从 7-zip 子菜单中选择 “Extract to Emacs-VERSION”。这是一个很大的压缩包,因此解压可能需要一段时间,但是完成后,你将拥有一个新目录,其中包含与 Emacs 一起分发的所有文件。例如,在此例中,下载了 `emacs-26.2-x86_64.zip`,因此解压后的目录为 `emacs-26.2-x86_64`。 + +### 启动 Emacs + +在 Emacs 目录中,找到 `bin` 目录。此文件夹存储随 Emacs 一起分发的所有二进制可执行文件(EXE 文件)。双击 `emacs.exe` 文件启动应用。 + +![Emacs running on Windows][7] + +你可以在桌面上创建 `emacs.exe` 的快捷方式,以便于访问。 + +### 学习 Emacs + +Emacs 并不像传闻那样难用。它具有自己的传统和惯例,但是当你其中输入文本时,你可以像在记事本或者网站的文本框中那样使用它。 + +重要的区别是在你*编辑*输入的文本时。 + +但是,学习的唯一方法是开始使用它,因此,使 Emacs 成为完成简单任务的首选文本编辑器。当你通常打开记事本、Word 或 Evernote 或其他工具来做快速笔记或临时记录时,请启动 Emacs。 + +Emacs 以基于终端的应用而闻名,但它显然有 GUI,因此请像使用其他程序一样经常使用它的 GUI。从菜单而不是使用键盘复制、剪切和粘贴(paste)(或用 Emacs 的术语 “yank”),然后从菜单或工具栏打开和保存文件。从头开始,并根据应用本身来学习它,而不是根据你以往对其他编辑器的经验就认为它应该是怎样。 + +- 下载[速查表][8]! + +感谢 Matthias Pfuetzner 和 Stephen Smoogen。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/3/emacs-windows + +作者:[Seth Kenlon][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/seth +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/windows_building_sky_scale.jpg?itok=mH6CAX29 (Tall building with windows) +[2]: https://github.com/chocolatey/choco +[3]: https://www.7-zip.org/ +[4]: https://opensource.com/sites/default/files/uploads/windows-ps-choco-emacs.jpg (Emacs running on Windows) +[5]: https://www.gnu.org/software/emacs/download.html +[6]: https://opensource.com/sites/default/files/uploads/windows-emacs-download.jpg (GNU Windows downloader) +[7]: https://opensource.com/sites/default/files/uploads/windows-emacs.jpg (Emacs running on Windows) +[8]: https://opensource.com/downloads/emacs-cheat-sheet diff --git a/published/202003/20200303 Getting started with the Rust package manager, Cargo.md b/published/202003/20200303 Getting started with the Rust package manager, Cargo.md new file mode 100644 index 0000000000..55f3f7491d --- /dev/null +++ b/published/202003/20200303 Getting started with the Rust package manager, Cargo.md @@ -0,0 +1,561 @@ +[#]: collector: (lujun9972) +[#]: translator: (wxy) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11977-1.html) +[#]: subject: (Getting started with the Rust package manager, Cargo) +[#]: via: (https://opensource.com/article/20/3/rust-cargo) +[#]: author: (Gaurav Kamathe https://opensource.com/users/gkamathe) + +Rust 包管理器 Cargo 入门 +====== + +> 了解 Rust 的软件包管理器和构建工具。 + +![](https://img.linux.net.cn/data/attachment/album/202003/09/104906tdl21k977t8999qt.jpg) + +[Rust][2] 是一种现代编程语言,可提供高性能、可靠性和生产力。几年来,它一直被 StackOverflow 调查评为[最受欢迎的语言][3]。 + +除了是一种出色的编程语言之外,Rust 还具有一个称为 Cargo 的构建系统和软件包管理器。Cargo 处理许多任务,例如构建代码、下载库或依赖项等等。这两者捆绑在一起,因此在安装 Rust 时会得到 Cargo。 + +### 安装 Rust 和 Cargo + +在开始之前,你需要安装 Rust 和 Cargo。Rust 项目提供了一个可下载的脚本来处理安装。要获取该脚本,请打开浏览器以访问 [https://sh.rustup.rs][4] 并保存该文件。阅读该脚本以确保你对它的具体行为有所了解,然后再运行它: + +``` +$ sh ./rustup.rs +``` + +你也可以参考这个[安装 Rust][5] 的网页以获取更多信息。 + +安装 Rust 和 Cargo 之后,你必须获取source `env` 文件中的配置: + +``` +$ source $HOME/.cargo/env +``` + +更好的办法是,将所需目录添加到 `PATH` 环境变量中: + +``` +export PATH=$PATH:~/.cargo/bin +``` + +如果你更喜欢使用软件包管理器(例如 Linux 上的 DNF 或 Apt),请在发行版本的存储库中查找 Rust 和 Cargo 软件包,并进行相应的安装。 例如: + +``` +$ dnf install rust cargo +``` + +安装并设置它们后,请验证你拥有的 Rust 和 Cargo 版本: + +``` +$ rustc --version +rustc 1.41.0 (5e1a79984 2020-01-27) +$ cargo --version +cargo 1.41.0 (626f0f40e 2019-12-03) +``` + +### 手动构建和运行 Rust + +从在屏幕上打印“Hello, world!”的简单程序开始。打开你喜欢的文本编辑器,然后键入以下程序: + +``` +$ cat hello.rs +fn main() { +    println!("Hello, world!"); +} +``` + +以扩展名 `.rs` 保存文件,以将其标识为 Rust 源代码文件。 + +使用 Rust 编译器 `rustc` 编译程序: + +``` +$ rustc hello.rs +``` + +编译后,你将拥有一个与源程序同名的二进制文件: + +``` +$ ls -l +total 2592 +-rwxr-xr-x. 1 user group 2647944 Feb 13 14:14 hello +-rw-r--r--. 1 user group      45 Feb 13 14:14 hello.rs +$ +``` + +执行程序以验证其是否按预期运行: + +``` +$ ./hello +Hello, world! +``` + +这些步骤对于较小的程序或任何你想快速测试的东西就足够了。但是,在进行涉及到多人的大型程序时,Cargo 是前进的最佳之路。 + +### 使用 Cargo 创建新包 + +Cargo 是 Rust 的构建系统和包管理器。它可以帮助开发人员下载和管理依赖项,并帮助创建 Rust 包。在 Rust 社区中,Rust 中的“包”通常被称为“crate”(板条箱),但是在本文中,这两个词是可以互换的。请参阅 Rust 社区提供的 Cargo [FAQ][6] 来区分。 + +如果你需要有关 Cargo 命令行实用程序的任何帮助,请使用 `--help` 或 `-h` 命令行参数: + +``` +$ cargo –help +``` + +要创建一个新的包,请使用关键字 `new`,跟上包名称。在这个例子中,使用 `hello_opensource` 作为新的包名称。运行该命令后,你将看到一条消息,确认 Cargo 已创建具有给定名称的二进制包: + +``` +$ cargo new hello_opensource +     Created binary (application) `hello_opensource` package +``` + +运行 `tree` 命令以查看目录结构,它会报告已创建了一些文件和目录。首先,它创建一个带有包名称的目录,并且在该目录内有一个存放你的源代码文件的 `src` 目录: + +``` +$ tree . +. +└── hello_opensource +    ├── Cargo.toml +    └── src +        └── main.rs + +2 directories, 2 files +``` + +Cargo 不仅可以创建包,它也创建了一个简单的 “Hello, world” 程序。打开 `main.rs` 文件看看: + +``` +$ cat hello_opensource/src/main.rs +fn main() { +    println!("Hello, world!"); +} +``` + +下一个要处理的文件是 `Cargo.toml`,这是你的包的配置文件。它包含有关包的信息,例如其名称、版本、作者信息和 Rust 版本信息。 + +程序通常依赖于外部库或依赖项来运行,这使你可以编写应用程序来执行不知道如何编码或不想花时间编码的任务。你所有的依赖项都将在此文件中列出。此时,你的新程序还没有任何依赖关系。打开 `Cargo.toml` 文件并查看其内容: + +``` +$ cat hello_opensource/Cargo.toml +[package] +name = "hello_opensource" +version = "0.1.0" +authors = ["user "] +edition = "2018" + +# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html + +[dependencies] +``` + +### 使用 Cargo 构建程序 + +到目前为止,一切都很顺利。现在你已经有了一个包,可构建一个二进制文件(也称为可执行文件)。在此之前,进入包目录: + +``` +$ cd hello_opensource/ +``` + +你可以使用 Cargo 的 `build` 命令来构建包。注意消息说它正在“编译”你的程序: + +``` +$ cargo build +   Compiling hello_opensource v0.1.0 (/opensource/hello_opensource) +    Finished dev [unoptimized + debuginfo] target(s) in 0.38s +``` + +运行 `build` 命令后,检查项目目录发生了什么: + +``` +$ tree . +. +├── Cargo.lock +├── Cargo.toml +├── src +│   └── main.rs +└── target +    └── debug +        ├── build +        ├── deps +        │   ├── hello_opensource-147b8a0f466515dd +        │   └── hello_opensource-147b8a0f466515dd.d +        ├── examples +        ├── hello_opensource +        ├── hello_opensource.d +        └── incremental +            └── hello_opensource-3pouh4i8ttpvz +                ├── s-fkmhjmt8tj-x962ep-1hivstog8wvf +                │   ├── 1r37g6m45p8rx66m.o +                │   ├── 2469ykny0eqo592v.o +                │   ├── 2g5i2x8ie8zed30i.o +                │   ├── 2yrvd7azhgjog6zy.o +                │   ├── 3g9rrdr4hyk76jtd.o +                │   ├── dep-graph.bin +                │   ├── query-cache.bin +                │   ├── work-products.bin +                │   └── wqif2s56aj0qtct.o +                └── s-fkmhjmt8tj-x962ep.lock + +9 directories, 17 files +``` + +哇!编译过程产生了许多中间文件。另外,你的二进制文件将以与软件包相同的名称保存在 `./target/debug` 目录中。 + +### 使用 Cargo 运行你的应用程序 + +现在你的二进制文件已经构建好了,使用 Cargo 的 `run` 命令运行它。如预期的那样,它将在屏幕上打印 `Hello, world!`。 + +``` +$ cargo run +    Finished dev [unoptimized + debuginfo] target(s) in 0.01s +     Running `target/debug/hello_opensource` +Hello, world! +``` + +或者,你可以直接运行二进制文件,该文件位于: + +``` +$ ls -l ./target/debug/hello_opensource +-rwxr-xr-x. 2 root root 2655552 Feb 13 14:19 ./target/debug/hello_opensource +``` + +如预期的那样,它产生相同的结果: + +``` +$ ./target/debug/hello_opensource +Hello, world! +``` + +假设你需要重建包,并丢弃早期编译过程创建的所有二进制文件和中间文件。Cargo 提供了一个方便的`clean` 选项来删除所有中间文件,但源代码和其他必需文件除外: + +``` +$ cargo clean +$ tree . +. +├── Cargo.lock +├── Cargo.toml +└── src +    └── main.rs + +1 directory, 3 files +``` + +对程序进行一些更改,然后再次运行以查看其工作方式。例如,下面这个较小的更改将 `Opensource` 添加到 `Hello, world!` 字符串中: + +``` +$ cat src/main.rs +fn main() { +    println!("Hello, Opensource world!"); +} +``` + +现在,构建该程序并再次运行它。这次,你会在屏幕上看到 `Hello, Opensource world!`: + +``` +$ cargo build +   Compiling hello_opensource v0.1.0 (/opensource/hello_opensource) +    Finished dev [unoptimized + debuginfo] target(s) in 0.39s + +$ cargo run +    Finished dev [unoptimized + debuginfo] target(s) in 0.01s +     Running `target/debug/hello_opensource` +Hello, Opensource world! +``` + +### 使用 Cargo 添加依赖项 + +Cargo 允许你添加程序需要运行的依赖项。使用 Cargo 添加依赖项非常容易。每个 Rust 包都包含一个 `Cargo.toml` 文件,其中包含一个依赖关系列表(默认为空)。用你喜欢的文本编辑器打开该文件,找到 `[dependencies]` 部分,然后添加要包含在包中的库。例如,将 `rand` 库添加为依赖项: + +``` +$ cat Cargo.toml +[package] +name = "hello_opensource" +version = "0.1.0" +authors = ["test user "] +edition = "2018" + +# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html + +[dependencies] +rand = "0.3.14" +``` + +试试构建你的包,看看会发生什么。 + +``` +$ cargo build +    Updating crates.io index +   Compiling libc v0.2.66 +   Compiling rand v0.4.6 +   Compiling rand v0.3.23 +   Compiling hello_opensource v0.1.0 (/opensource/hello_opensource) +    Finished dev [unoptimized + debuginfo] target(s) in 4.48s +``` + +现在,Cargo 会联系 [Crates.io][9](这是 Rust 用于存储 crate(或包)的中央仓库),并下载和编译 `rand`。但是,等等 —— `libc` 包是怎么回事?你没有要安装 libc 啊。是的,`rand` 包依赖于 `libc` 包;因此,Cargo 也会下载并编译 `libc`。 + +库的新版本会不断涌现,而 Cargo 提供了一种使用 `update` 命令更新其所有依赖关系的简便方法: + +``` +cargo update +``` + +你还可以选择使用 `-p` 标志跟上包名称来更新特定的库: + +``` +cargo update -p rand +``` + +### 使用单个命令进行编译和运行 + +到目前为止,每当对程序进行更改时,都先使用了 `build` 之后是 `run`。有一个更简单的方法:你可以直接使用 `run` 命令,该命令会在内部进行编译并运行该程序。要查看其工作原理,请首先清理你的软件包目录: + +``` +$ cargo clean +$ tree . +. +├── Cargo.lock +├── Cargo.toml +└── src +    └── main.rs + +1 directory, 3 files +``` + +现在执行 `run`。输出信息表明它已进行编译,然后运行了该程序,这意味着你不需要每次都显式地运行 `build`: + +``` +$ cargo run +   Compiling hello_opensource v0.1.0 (/opensource/hello_opensource) +    Finished dev [unoptimized + debuginfo] target(s) in 0.41s +     Running `target/debug/hello_opensource` +Hello, world! +``` + +### 在开发过程中检查代码 + +在开发程序时,你经常会经历多次迭代。你需要确保你的程序没有编码错误并且可以正常编译。你不需要负担在每次编译时生成二进制文件的开销。Cargo 为你提供了一个 `check` 选项,该选项可以编译代码,但跳过了生成可执行文件的最后一步。首先在包目录中运行 `cargo clean`: + +``` +$ tree . +. +├── Cargo.lock +├── Cargo.toml +└── src +    └── main.rs + +1 directory, 3 files +``` + +现在运行 `check` 命令,查看对目录进行了哪些更改: + +``` +$ cargo check +    Checking hello_opensource v0.1.0 (/opensource/hello_opensource) +    Finished dev [unoptimized + debuginfo] target(s) in 0.18s +``` + +该输出显示,即使在编译过程中创建了中间文件,但没有创建最终的二进制文件或可执行文件。这样可以节省一些时间,如果该包包含了数千行代码,这非常重要: + +``` +$ tree . +. +├── Cargo.lock +├── Cargo.toml +├── src +│   └── main.rs +└── target +    └── debug +        ├── build +        ├── deps +        │   ├── hello_opensource-842d9a06b2b6a19b.d +        │   └── libhello_opensource-842d9a06b2b6a19b.rmeta +        ├── examples +        └── incremental +            └── hello_opensource-1m3f8arxhgo1u +                ├── s-fkmhw18fjk-542o8d-18nukzzq7hpxe +                │   ├── dep-graph.bin +                │   ├── query-cache.bin +                │   └── work-products.bin +                └── s-fkmhw18fjk-542o8d.lock + +9 directories, 9 files +``` + +要查看你是否真的节省了时间,请对 `build` 和 `check` 命令进行计时并进行比较。首先,计时 `build` 命令: + +``` +$ time cargo build +   Compiling hello_opensource v0.1.0 (/opensource/hello_opensource) +    Finished dev [unoptimized + debuginfo] target(s) in 0.40s + +real    0m0.416s +user    0m0.251s +sys     0m0.199s +``` + +在运行 `check` 命令之前清理目录: + +``` +$ cargo clean +``` + +计时 `check` 命令: + +``` +$ time cargo check +    Checking hello_opensource v0.1.0 (/opensource/hello_opensource) +    Finished dev [unoptimized + debuginfo] target(s) in 0.15s + +real    0m0.166s +user    0m0.086s +sys     0m0.081s +``` + +显然,`check` 命令要快得多。 + +### 建立外部 Rust 包 + +到目前为止,你所做的这些都可以应用于你从互联网上获得的任何 Rust crate。你只需要下载或克隆存储库,移至包文件夹,然后运行 `build` 命令,就可以了: + +``` +git clone +cd +cargo build +``` + +### 使用 Cargo 构建优化的 Rust 程序 + +到目前为止,你已经多次运行 `build`,但是你注意到它的输出了吗?不用担心,再次构建它并密切注意: + +``` +$ cargo build +   Compiling hello_opensource v0.1.0 (/opensource/hello_opensource) +    Finished dev [unoptimized + debuginfo] target(s) in 0.36s +``` + +看到了每次编译后的 `[unoptimized + debuginfo]` 文本了吗?这意味着 Cargo 生成的二进制文件包含大量调试信息,并且未针对执行进行优化。开发人员经常经历开发的多次迭代,并且需要此调试信息进行分析。同样,性能并不是开发软件时的近期目标。因此,对于现在而言是没问题的。 + +但是,一旦准备好发布软件,就不再需要这些调试信息。而是需要对其进行优化以获得最佳性能。在开发的最后阶段,可以将 `--release` 标志与 `build` 一起使用。仔细看,编译后,你应该会看到 `[optimized]` 文本: + +``` +$ cargo build --release +   Compiling hello_opensource v0.1.0 (/opensource/hello_opensource) +    Finished release [optimized] target(s) in 0.29s +``` + +如果愿意,你可以通过这种练习来了解运行优化软件与未优化软件时节省的时间。 + +### 使用 Cargo 创建库还是二进制文件 + +任何软件程序都可以粗略地分类为独立二进制文件或库。一个独立二进制文件也许即使是当做外部库使用的,自身也是可以运行的。但是,作为一个库,是可以被另一个独立二进制文件所利用的。到目前为止,你在本教程中构建的所有程序都是独立二进制文件,因为这是 Cargo 的默认设置。 要创建一个**库**,请添加 `--lib` 选项: + +``` +$ cargo new --lib libhello +     Created library `libhello` package +``` + +这次,Cargo 不会创建 `main.rs` 文件,而是创建一个 `lib.rs` 文件。 你的库的代码应该是这样的: + +``` +$ tree . +. +└── libhello +    ├── Cargo.toml +    └── src +        └── lib.rs + +2 directories, 2 files +``` + +Cargo 就是这样的,不要奇怪,它在你的新库文件中添加了一些代码。通过移至包目录并查看文件来查找添加的内容。默认情况下,Cargo 在库文件中放置一个测试函数。 + +### 使用 Cargo 运行测试 + +Rust 为单元测试和集成测试提供了一流的支持,而 Cargo 允许你执行以下任何测试: + +``` +$ cd libhello/ + +$ cat src/lib.rs +#[cfg(test)] +mod tests { +    #[test] +    fn it_works() { +        assert_eq!(2 + 2, 4); +    } +} +``` + +Cargo 有一个方便的 `test` 命令,可以运行代码中存在的任何测试。尝试默认运行 Cargo 在库代码中放入的测试: + +``` +$ cargo test +   Compiling libhello v0.1.0 (/opensource/libhello) +    Finished test [unoptimized + debuginfo] target(s) in 0.55s +     Running target/debug/deps/libhello-d52e35bb47939653 + +running 1 test +test tests::it_works ... ok + +test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out + +   Doc-tests libhello + +running 0 tests + +test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out +``` + +### 深入了解 Cargo 内部 + +你可能有兴趣了解在运行一个 Cargo 命令时它底下发生了什么。毕竟,在许多方面,Cargo 只是个封装器。要了解它在做什么,你可以将 `-v` 选项与任何 Cargo 命令一起使用,以将详细信息输出到屏幕。 + +这是使用 `-v` 选项运行 `build` 和 `clean` 的几个例子。 + +在 `build` 命令中,你可以看到这些给定的命令行选项触发了底层的 `rustc`(Rust 编译器): + +``` +$ cargo build -v +   Compiling hello_opensource v0.1.0 (/opensource/hello_opensource) +     Running `rustc --edition=2018 --crate-name hello_opensource src/main.rs --error-format=json --json=diagnostic-rendered-ansi --crate-type bin --emit=dep-info,link -C debuginfo=2 -C metadata=147b8a0f466515dd -C extra-filename=-147b8a0f466515dd --out-dir /opensource/hello_opensource/target/debug/deps -C incremental=/opensource/hello_opensource/target/debug/incremental -L dependency=/opensource/hello_opensource/target/debug/deps` +    Finished dev [unoptimized + debuginfo] target(s) in 0.36s +``` + +而 `clean` 命令表明它只是删除了包含中间文件和二进制文件的目录: + +``` +$ cargo clean -v +    Removing /opensource/hello_opensource/target +``` + +### 不要让你的技能生锈 + +要扩展你的技能,请尝试使用 Rust 和 Cargo 编写并运行一个稍微复杂的程序。很简单就可以做到:例如,尝试列出当前目录中的所有文件(可以用 9 行代码完成),或者尝试自己回显输入。小型的实践应用程序可帮助你熟悉语法以及编写和测试代码的过程。 + +本文为刚起步的 Rust 程序员提供了大量信息,以使他们可以开始入门 Cargo。但是,当你开始处理更大、更复杂的程序时,你需要对 Cargo 有更深入的了解。当你准备好迎接更多内容时,请下载并阅读 Rust 团队编写的开源的《[Cargo 手册][10]》,看看你可以创造什么! + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/3/rust-cargo + +作者:[Gaurav Kamathe][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/gkamathe +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/bus-containers2.png?itok=idd8duC_ (Shipping containers stacked in a yard) +[2]: https://www.rust-lang.org/ +[3]: https://insights.stackoverflow.com/survey/2019#technology-_-most-loved-dreaded-and-wanted-languages +[4]: https://sh.rustup.rs/ +[5]: https://www.rust-lang.org/tools/install +[6]: https://doc.rust-lang.org/cargo/faq.html +[7]: mailto:user@mail.com +[8]: mailto:test@mail.com +[9]: http://crates.io +[10]: https://doc.rust-lang.org/cargo diff --git a/published/202003/20200303 Session- An Open Source Private Messenger That Doesn-t Need Your Phone Number.md b/published/202003/20200303 Session- An Open Source Private Messenger That Doesn-t Need Your Phone Number.md new file mode 100644 index 0000000000..1d98fdf187 --- /dev/null +++ b/published/202003/20200303 Session- An Open Source Private Messenger That Doesn-t Need Your Phone Number.md @@ -0,0 +1,138 @@ +[#]: collector: (lujun9972) +[#]: translator: (HankChow) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11982-1.html) +[#]: subject: (Session: An Open Source Private Messenger That Doesn’t Need Your Phone Number) +[#]: via: (https://itsfoss.com/session-messenger/) +[#]: author: (Ankush Das https://itsfoss.com/author/ankush/) + +Session:一款不需要电话号码的开源通信应用 +====== + +Signal 作为一款私人通信应用,正在变得愈发流行。而我们下面要介绍开源应用 Session 则是 Signal 的一个复刻fork,它的一大亮点是并不需要提供手机号码即可以开始使用。 + +### Session:一款真正意义上的私人通信应用 + +![][1] + +对于私人通信服务来说,有没有既能保护通信安全性,又尊重用户跨平台隐私的集大成者呢?很多注重个人隐私的用户似乎都在寻找这个问题的答案。 + +最近,我留意到 [Loki 基金会][3]开发的一款叫做 [Session][2] 的开源通信应用。从技术上来说,Session 是另一款[开源、加密的通信应用 Signal][4] 的一个复刻。 + +在本文中,我会讲述我自己使用 Session 的体验,以及 Session 的一些主要功能。 + +Session 在这个领域中算是一款比较新的应用了,因此我还会在文章的最后提到它的一些不足之处。 + +### Session 的一些主要功能 + +接下来我会重点介绍 Session 的主要功能,可以供你参考这款应用是否值得使用。 + +#### Session 的使用过程中不需要提供手机号码 + +![][5] + +在 Signal 或者其它类似的通信应用中,用户都需要提供手机号码才得以成功注册。注重隐私的用户们都认为这样的做法会潜藏着巨大的安全隐患。 + +而使用 Session 则简单得多。在 PC 或手机上安装应用之后,只需要点击“创建账号Create Account”,无须提供手机号码,它就会生成一个类似 05652245af9a8bfee4f5a8138fd5c..... 这样的随机且唯一的 Session ID。 + +此后,把 Session ID 分享给想要添加的联系人就可以了。Session 还支持二维码,其他人可以通过扫描二维码添加你的 Session ID 为好友。 + +#### Session 使用了区块链等加密技术 + +![Session ID][6] + +对[区块链][7]有所了解的用户都很期待区块链能为普罗大众做出什么有实际意义的应用,而 Session 可以算得上其中一个。尽管 Session 的核心是基于区块链的,但普通用户在使用时并不需要真正弄懂区块链。 + +如果你好奇它的工作原理,可以参考这篇[官方的博客文章][8],里面有相关的解释。 + +#### 跨平台支持 + +![][9] + +这样严格保护隐私的应用,是否能在不同平台上使用? + +答案是肯定的。首先,它支持 Linux 和 Android 平台,同时也支持 Windows/Mac/iOS 平台。因此跨平台、跨设备的消息同步是没有问题的。 + +#### 包含基本隐私选项 + +![][10] + +毫无疑问,基本的隐私功能是必须有的,这是作为一个以安全为卖点的应用所必备的体验。 + +最基本的选项包括: + +* **消息有效期**:你可以控制一条消息在接收者阅读前的保留时长 +* **已读回执**:消息发送者可以知晓你已经阅读该消息 + +#### Session 使用去中心化网络保护你的元数据 + +尽管 Session 不使用端对端peer-to-peer技术,但它也不使用中心化的服务器。 + +Session 采用了去中心化的架构实现消息的传输和路由。如果你不熟悉这方面的内容,可以关注 Session 的官方博客,尝试了解[中心化网络和去中心化网络的区别][11],以及它的实际工作原理。 + +同时,这样的网络架构还有助于保护诸如与 IP 地址相关的信息等元数据。 + +#### 其它功能 + +除了专注于隐私之外,Session 也支持群聊、语音消息、发送附件等通信应用的基本功能。 + +### 在 Linux 上安装 Session + +在[官方下载页面][12]中可以下载到对应的 .AppImage 文件。如果你不了解这个文件的使用方法,可以查阅我们的[相关文章][13]。 + +另外,你也可以在它的 [Github 发布页面][14] 获取到对应的 .deb 安装文件。 + +- [下载 Session][12] + +### 我使用 Session 的体验 + +我在各种平台上都试用过 Session,其中在 PC 上我使用了 Pop!\_OS 19.10 的 .AppImage 文件运行这个应用。 + +总的来说,使用的体验很不错,用户界面也没有出现问题。 + +在设置中备份了密码(也称为种子seed)后,可以很方便地恢复账号。 + +![][15] + +当然,我也发现了一些需要改进的地方: + +* 在接受好友请求时会出现延迟 +* 设备间连接的方式不太直观 +* 当你在不同的设备上使用同一个 Session ID 向同一个人回复消息时,对方会收到两个不同的对话 + +### 总结 + +当然,最完美的事物是不存在的。我也会一直使用 Session 并考虑它发展的方向,这是一个注重隐私的用户应该做的事情。 + +欢迎在评论区发表你的看法。 + + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/session-messenger/ + +作者:[Ankush Das][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://itsfoss.com/author/ankush/ +[b]: https://github.com/lujun9972 +[1]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/02/session-app.jpg?ssl=1 +[2]: https://getsession.org/ +[3]: https://loki.foundation/ +[4]: https://linux.cn/article-11764-1.html +[5]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/02/session-create.jpg?ssl=1 +[6]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/03/session-application-id.jpg?ssl=1 +[7]: https://en.wikipedia.org/wiki/Blockchain +[8]: https://getsession.org/how-session-protects-your-anonymity-with-blockchain-and-crypto/ +[9]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/02/session-cross-platform.jpg?ssl=1 +[10]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/02/session-settings.jpg?fit=800%2C512&ssl=1 +[11]: https://getsession.org/centralisation-vs-decentralisation-in-private-messaging/ +[12]: https://getsession.org/download/ +[13]: https://itsfoss.com/use-appimage-linux/ +[14]: https://github.com/loki-project/session-desktop/releases +[15]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/02/session-seed.jpg?ssl=1 diff --git a/published/202003/20200304 Drauger OS Linux Aims to Bring Console Gaming Experience on the Desktop.md b/published/202003/20200304 Drauger OS Linux Aims to Bring Console Gaming Experience on the Desktop.md new file mode 100644 index 0000000000..d574442156 --- /dev/null +++ b/published/202003/20200304 Drauger OS Linux Aims to Bring Console Gaming Experience on the Desktop.md @@ -0,0 +1,131 @@ +[#]: collector: (lujun9972) +[#]: translator: (wxy) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11972-1.html) +[#]: subject: (Drauger OS Linux Aims to Bring Console Gaming Experience on the Desktop) +[#]: via: (https://itsfoss.com/drauger-os/) +[#]: author: (John Paul https://itsfoss.com/author/john/) + +Drauger OS Linux 旨在为台式机带来主机游戏体验 +====== + +多年来(或数十年),人们抱怨不[使用Linux][1] 的原因之一是它缺乏主流游戏。[Linux 上的游戏][2]在最近几年有了显著改进,特别是 [Steam Proton][3] 项目的引入使你可以[在 Linux 上玩很多 Windows 专用的游戏][4]。 + +这也鼓励了一些[以游戏为中心的 Linux发行版][5]。以 [Lakka][6] 为例,你可以[借助 Lakka Linux 将旧计算机变成复古的街机游戏机][7]。 + +另一个以游戏为中心的 Linux 发行版是 [Draguer OS][8],我们今天将对其进行研究。 + +### Drauger OS + +根据[该项目的网站][9],“Drauger OS 是 Linux 桌面游戏操作系统。它旨在为游戏玩家提供一个平台,使他们可以在不牺牲安全性的情况下获得出色的性能。此外,它旨在使任何人都可以轻松玩游戏,无论他们使用键盘和鼠标还是某种控制器。” + +他们强调 Drauger OS 并非供日常使用。因此,大多数其他发行版附带的许多生产力工具都不在 Drauger OS 中。 + +![Drauger OS 7.4.1][10] + +Drauger OS [基于][9] Ubuntu 之上。当前版本(7.4.1 Jiangshi)使用 “[Liquorix][11] 低延迟Linux 内核,这是一种预编译的 ZEN 内核,设计时考虑了延迟和吞吐量之间的平衡”。但是,这将在下一版本中更改。他们只有一个桌面环境可供选择,即一个修改版本的 [Xfce][12]。 + +Drauger OS 开箱即用地安装了多个应用程序和工具,以改善游戏体验。这些包括: + +* [PlayOnLinux][13] +* WINE +* [Lutris][14] +* Steam +* [DXVK][15] + +它还具有一组与游戏无关的有趣工具。[Drauger 安装器][16]是 .deb 安装程序,是 Gdebi 的替代品。[多软件库应用安装器][17](mrai)是“用于基于 Debian 的 Linux 操作系统的类似于 AUR-helper 的脚本”。Mrai 旨在与 apt、snap、flatpaks 配合使用,并且可以从 GitHub 安装应用程序。 + +有趣的是,Drauger OS 的名称是一个错误。开发负责人 [Thomas Castleman][18](即 batcastle)曾打算为其发行版命名为 Draugr,但是却打错了名字。在 Drauger OS 播客的[第 23 集][19]中,Castleman 说会保留这个拼写错误的名称,因为要对其进行更正需要大量工作。根据 [Wikipedia][20] 的描述,Draugr 是“来自北欧神话中的不死生物”。 + +是的,你没看错。Drauger OS 是仅有的几个具有自己的[播客][21]的发行版之一。当被问到这个问题时,Castleman 告诉我:“无论他们的情况如何,我都希望确保我们的社区拥有最大的透明度。”多数情况下,播客是 Drauger OS 博客的音频版本,但有时他们会在没有时间撰写博客文章时使用它来发布公告。 + +### Drauger OS 的未来 + +![Drauger OS][22] + +Druager OS 背后的开发人员正在开发其下一个主要版本:7.5.1。此版本将基于 Ubuntu 19.10。将有三个主要变化。首先,将使用“我们内部构建的内核” [替换][23] Liquorix 内核。该内核将基于 Linux 内核 GitHub 存储库,“因此,它会变得越来越原汁原味”。 + +新版本的第二个主要变化将是为其桌面提供新布局。根据用户的反馈,他们决定将其更改为看起来更类似于 GNOME 的样子。 + +第三,他们放弃了 SystemBack 作为其备份工具和安装程序。相反,他们从头开始编写了新的[安装程序][24]。 + +开发团队也正在研究 Drauger OS 的 [ARM 版本][25]。他们希望在 2022 年的某个时候发布它。 + +### 系统要求 + +Drauger OS [系统要求][25]非常适中。请记住,Drauger OS 仅在 64 位系统上运行。 + +#### 最低系统要求 + +* CPU:双核、1.8GHz、64 位处理器 +* RAM:1 GB +* 储存空间:16 GB +* 图形处理器:集成 +* 屏幕分辨率:60Hz 时为 1024×768 +* 外部端口:1 个用于显示的端口(HDMI/DisplayPort/VGA/DVI),2 个用于安装 USB 驱动器和键盘的 USB 端口(鼠标可选,但建议使用) + +#### 推荐系统要求 + +* CPU:四核、2.2Ghz、64 位处理器 +* RAM:4 GB +* 储存空间:128 GB +* 图形处理器:NVIDIA GTX 1050、AMD RX 460 或同等显卡 +* 屏幕分辨率:60Hz 时为 1080p +* 外部端口:1 个用于显示的端口(HDMI/DisplayPort/VGA/DVI),3 个用于安装 USB 驱动器、键盘和鼠标的 USB 端口,1 个音频输出端口 + +### 如何为Drauger OS提供帮助 + +如果你有兴趣,可以通过多种方法来帮助 Drauger OS。他们一直在寻找[财政支持][26]以保持发展。 + +如果你想贡献代码,他们正在寻找具有 BASH、C++ 和 Python 经验的人员。他们所有的代码都在 [GitHub][27] 上。你也可以在社交媒体上[联系][28]他们。 + +### 结语 + +Drauger OS 只是这类项目之一。我还见过其他[面向游戏的发行版][29],但 Drauger OS 在专注于游戏方面一心一意。由于我更喜欢休闲游戏,因此该发行版对我个人而言并不具有吸引力。但是,我可以看到它如何吸引游戏爱好者使用 Linux。祝他们在以后的发行中好运。 + +你对这个仅限于游戏的发行版有何想法?你最喜欢的 Linux 游戏解决方案是什么?请在下面的评论中告诉我们。 + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/drauger-os/ + +作者:[John Paul][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://itsfoss.com/author/john/ +[b]: https://github.com/lujun9972 +[1]: https://itsfoss.com/why-use-linux/ +[2]: https://linux.cn/article-7316-1.html +[3]: https://linux.cn/article-10054-1.html +[4]: https://itsfoss.com/steam-play/ +[5]: https://itsfoss.com/linux-gaming-distributions/ +[6]: http://www.lakka.tv/ +[7]: https://itsfoss.com/lakka-retrogaming-linux/ +[8]: https://draugeros.org/go/ +[9]: https://www.draugeros.org/go/about/ +[10]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/02/drauger-os-7.4.1.jpg?ssl=1 +[11]: https://liquorix.net/ +[12]: https://www.xfce.org/ +[13]: https://www.playonlinux.com/en/ +[14]: https://lutris.net/ +[15]: https://github.com/doitsujin/dxvk +[16]: https://github.com/drauger-os-development/drauger-installer +[17]: https://github.com/drauger-os-development/mrai +[18]: https://github.com/Batcastle +[19]: https://anchor.fm/drauger-os/episodes/Episode-23-eapu47 +[20]: https://en.wikipedia.org/wiki/Draugr +[21]: https://anchor.fm/drauger-os +[22]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/02/drauger-os-7.5.1.png?ssl=1 +[23]: https://www.draugeros.org/go/2020/01/20/major-changes-in-drauger-os-7-5-1/ +[24]: https://github.com/drauger-os-development/system-installer +[25]: https://www.draugeros.org/go/system-requirements/ +[26]: https://www.draugeros.org/go/contribute/ +[27]: https://github.com/drauger-os-development +[28]: https://www.draugeros.org/go/contact-us/ +[29]: https://itsfoss.com/manjaro-gaming-linux/ +[30]: https://reddit.com/r/linuxusersgroup diff --git a/published/202003/20200305 Install and Use Wireshark on Ubuntu Linux.md b/published/202003/20200305 Install and Use Wireshark on Ubuntu Linux.md new file mode 100644 index 0000000000..ec70ef40a8 --- /dev/null +++ b/published/202003/20200305 Install and Use Wireshark on Ubuntu Linux.md @@ -0,0 +1,216 @@ +[#]: collector: (lujun9972) +[#]: translator: (qianmingtian) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11987-1.html) +[#]: subject: (Install and Use Wireshark on Ubuntu Linux) +[#]: via: (https://itsfoss.com/install-wireshark-ubuntu/) +[#]: author: (Community https://itsfoss.com/author/itsfoss/) + +Ubuntu 上 Wireshark 的安装与使用 +====== + +> 在本教程中,你将学习如何在 Ubuntu 和其它基于 Ubuntu 的发行版上安装最新的 Wireshark。同时你也将学习如何在没有 sudo 的情况下来运行 Wireshark,以及如何设置它来进行数据包嗅探。 + +[Wireshark][1] 是一款自由开源的网络协议分析器,它在全球被广泛使用。 + +通过使用 Wireshark,你可以实时捕获网络的传入和传出数据包,并将其用于网络故障排除、数据包分析、软件和通信协议开发等。 + +它适用于所有主流的桌面操作系统,如 Windows、Linux、macOS、BSD 等。 + +在本教程中,我将指导你在 Ubuntu 和其他基于 Ubuntu 的发行版上安装 Wireshark 。我还将介绍如何设置和配置 Wireshark 来捕获数据包。 + +### 在基于 Ubuntu 的 Linux 发行版上安装 Wireshark + +![][2] + +Wireshark 适用于所有主流 Linux 发行版。你应该查看[官方安装说明][3]。因为在本教程中,我将着重在仅基于 Ubuntu 的发行版上安装最新版本的 Wireshark 。 + +Wireshark 可以在 Ubuntu 的 Universe 存储库中找到。你可以[启用 universe 存储库][4],然后按如下方式安装: + +``` +sudo add-apt-repository universe +sudo apt install wireshark +``` + +这种方法的一个小问题是,你可能并不总是得到最新版本的 Wireshark 。 + +例如,在 Ubuntu 18.04 中,如果你使用 [apt][5] 命令检查 Wireshark 的可用版本,可用版本会显示是 2.6 。 + +``` +abhishek@nuc:~$ apt show wireshark +Package: wireshark +Version: 2.6.10-1~ubuntu18.04.0 +Priority: optional +Section: universe/net +Origin: Ubuntu +Maintainer: Balint Reczey +``` + +然而, [Wireshark 3.2 稳定版][6]已经在几个月前发布了。当然,新版本拥有新的特性。 + +那么在这种情况下,你应该怎么办呢?谢天谢地, Wireshark 开发者提供了一种官方 PPA 方式,你可以使用它在 Ubuntu 和其它基于 Ubuntu 的发行版上安装最新稳定版本的 Wireshark. + +我希望你熟悉 PPA。如果没有,请[阅读我们关于 PPA 的优秀指南,以便完全理解它][7]。 + +打开终端并逐个使用以下命令: + +``` +sudo add-apt-repository ppa:wireshark-dev/stable +sudo apt update +sudo apt install wireshark +``` + +即使安装了旧版本的 Wireshark ,它也将更新为新版本。 + +安装时,系统将询问你是否允许非超级用户捕获数据包。选择“Yes”允许,选择“No”限制非超级用户捕获数据包,最后完成安装。 + +### 不使用 sudo 运行 Wireshark + +如果在上一次安装中选择了“No”,则以 root 用户身份运行以下命令: + +``` +sudo dpkg-reconfigure wireshark-common +``` + +然后按 `tab` 键并使用回车键选择“No”: + +![][8] + +由于你允许非超级用户捕获数据包,因此你必须将该用户添加到 `wireshark` 组。使用 [usermod][9] 命令将自己添加到 `wireshark` 组。 + +``` +sudo usermod -aG wireshark $(whoami) +``` + +最后,[重启你的 Ubuntu 系统][10]对你的系统进行必要的修改。 + +> 冷知识 +> +> Wireshark 于 1998 年首次发布,最初被称为 Ethereal 。2006 年,由于商标问题,开发商不得不将其名称改为 Wireshark 。 + +### 启动 Wireshark + +你可以从应用程序启动器或者命令行启动 Wireshark 应用。 + +如果从命令行启动,只需要在你的控制台中输入 `wireshark`: + +``` +wireshark +``` + +要是从**图形化界面**启动,需要在搜索栏搜索 Wireshark 应用,并按回车键。 + +![][11] + +现在,让我们来玩玩 Wireshark 吧。 + +### 使用 Wireshark 捕获数据包 + +当你启动 Wireshark 的时候,你会看到一个接口列表,你可以使用它来捕获这个接口接收和发送的数据包。 + +你可以使用 Wireshark 监视许多类型的接口,例如,有线、外部设备等。根据你的偏好,你可以从下图中的标记区域选择在欢迎屏幕中显示特定类型的接口。 + +![Select interface][12] + +例如,我只列出了**有线**网络接口。 + +![][13] + +接下来,要开始捕获数据包,你必须选择接口(在我的示例中是 `ens33` ),然后单击“Start capturing packets”图标,如下图所示。 + +![Start capturing packets with Wireshark][14] + +你还可以同时从多个接口捕获数据包。只需按住 `CTRL` 按钮,同时单击要捕获的接口,然后点击“Start capturing packets”图标,如下图所示。 + +![][15] + +接下来,我尝试在终端中使用 `ping google.com` 命令,如你所见,捕获了许多数据包。 + +![Captured packets][16] + +现在你可以选择任何数据包来检查该特定数据包。在点击一个特定的包之后,你可以看到与它相关的 TCP/IP 协议的不同层的信息。 + +![Packet info][17] + +你还可以在底部看到该特定数据包的原始数据,如下图所示。 + +![Check RAW data in the captured packets][18] + +> 这就是为什么端到端加密很重要。 +> +> 假设你正在登录一个不使用 HTTPS 的网站。与你在同一网络上的任何人都可以嗅探数据包,并在原始数据中看到用户名和密码。 +> +> 这就是为什么现在大多数聊天应用程序使用端到端加密,而大多数网站使用 https (而不是 http)。 + +#### 在 Wireshark 中停止数据包捕获 + +你可以点击如图所示的红色图标停止捕获数据包。 + +![Stop packet capture in Wireshark][19] + +#### 将捕获的数据包保存成文件 + +你可以单击下图中标记的图标,将捕获的数据包保存到文件中以备将来使用。 + +![Save captured packets by Wireshark][20] + + +**注意**:输出可以导出为 XML、PostScript、CSV 或纯文本。 + +接下来,选择一个目标文件夹,键入文件名并单击“Save”。 + +然后选择文件并单击“Open”。 + +![][21] + +现在你可以随时打开和分析保存的数据包。要打开文件,请按 `\+o`,或从 Wireshark 转到 “File > Open”。 + +捕获的数据包将从文件中加载。 + +![][22] + +### 结语 + +Wireshark 支持许多不同的通信协议。有许多选项和功能,使你能够以独特的方式捕获和分析网络数据包。你可以从 Wireshark 的[官方文档][23]了解更多关于 Wireshark 的信息。 + +我希望这个教程能帮助你在 Ubuntu 上安装 Wireshark 。请让我知道你的问题和建议。 + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/install-wireshark-ubuntu/ + +作者:[Kushal Rai][a] +选题:[lujun9972][b] +译者:[qianmingtian][c] +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://itsfoss.com/author/itsfoss/ +[b]: https://github.com/lujun9972 +[c]: https://github.com/qianmingtian +[1]: https://www.wireshark.org/ +[2]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/03/wireshark_ubuntu.png?ssl=1 +[3]: https://www.wireshark.org/docs/wsug_html_chunked/ChBuildInstallUnixInstallBins.html +[4]: https://itsfoss.com/ubuntu-repositories/ +[5]: https://itsfoss.com/apt-command-guide/ +[6]: https://www.wireshark.org/news/20191218.html +[7]: https://itsfoss.com/ppa-guide/ +[8]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/03/yes.png?ssl=1 +[9]: https://linuxhandbook.com/usermod-command/ +[10]: https://itsfoss.com/schedule-shutdown-ubuntu/ +[11]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/03/wire.png?ssl=1 +[12]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/03/interfaces.jpg?ssl=1 +[13]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/03/intoption.jpg?ssl=1 +[14]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/03/singleinterface.jpg?ssl=1 +[15]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/03/selint.jpg?ssl=1 +[16]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/03/capture.jpg?ssl=1 +[17]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/03/packetinfo.png?ssl=1 +[18]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/03/raw.png?ssl=1 +[19]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/03/stopcapture.png?ssl=1 +[20]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/03/savepackets.jpg?ssl=1 +[21]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/03/savename.jpg?ssl=1 +[22]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/03/openpacket.png?ssl=1 +[23]: https://www.wireshark.org/docs/https://www.wireshark.org/docs/ +[24]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/03/kushal_rai.jpg?ssl=1 diff --git a/published/202003/20200306 Communicating with other users on the Linux command line.md b/published/202003/20200306 Communicating with other users on the Linux command line.md new file mode 100644 index 0000000000..b5af59b838 --- /dev/null +++ b/published/202003/20200306 Communicating with other users on the Linux command line.md @@ -0,0 +1,143 @@ +[#]: collector: (lujun9972) +[#]: translator: (linusboyle) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12023-1.html) +[#]: subject: (Communicating with other users on the Linux command line) +[#]: via: (https://www.networkworld.com/article/3530343/communicating-with-other-users-on-the-linux-command-line.html) +[#]: author: (Sandra Henry-Stocker https://www.networkworld.com/author/Sandra-Henry_Stocker/) + +使用 Linux 命令行与其他用户进行通信 +====== + +![](https://img.linux.net.cn/data/attachment/album/202003/22/171055z3q772v2zq320zx3.jpg) + +使用 Linux 命令行向其他用户发送消息或许非常容易,这里有一些相关的命令你可以考虑使用。在这篇文章中,我们会考察 4 个这样的命令,看看它们是怎么工作的。 + +### wall + +`wall`(“Write ALL” 的简称)命令允许你向所有系统中已登录的用户发送一条信息。这里我们假设用户都使用命令行在同一台服务器上工作。虽然 `wall` 命令最常被系统管理员用于向用户发布公告和传递信息(比如说,服务器即将因维护而关闭),但它可以被任何用户使用。 + +系统管理员可能会用类似下面的方式发送信息: + +``` +$ wall The system will be going down in 15 minutes to address a serious problem +``` + +而所有登录的用户都将看到类似这样的信息: + +``` +Broadcast message from admin@dragonfly (pts/0) (Thu Mar 5 08:56:42 2020): +The system is going down in 15 minutes to address a serious problem +``` + +如果希望在消息中使用单引号,你可以像这样将信息用双引号括起来: + +``` +$ wall "Don't forget to save your work before logging off" +``` + +最外层的双引号不会出现在发出的消息中,但是如果没有它们,`wall` 会停下并等待输入一个配对的单引号。 + +### mesg + +如果出于某种理由你不想接收来自另一个用户的消息,你可以使用 `mesg` 命令来屏蔽这些消息。这个命令可以接受一个 `n` 作为参数来拒绝某用户的消息,或者接收一个 `y` 作为参数来接收用户发来的消息。 + +``` +$ mesg n doug +$ mesg y doug +``` + +被屏蔽的用户不会被告知这一事实。你也可以像这样使用 `mesg` 来屏蔽或者接收所有消息: + +``` +$ mesg y +$ mesg n +``` + +### write + +另一个在不使用电子邮件的情况下发送文本的命令是 `write`,这个命令可以用来和一个特定的用户通信。 + +``` +$ write nemo +Are you still at your desk? +I need to talk with you right away. +^C +``` + +输入你的信息后用 `ctrl-c` 退出,这样就完成了通信。这个命令允许你发送文本,但并不会建立一个双向的通话。它只是将文本发送过去而已。如果目标用户在多个终端上登录,你可以指定你想将消息发送到哪一个终端,否则系统会选择空闲时间最短的那个终端。 + +``` +$ write nemo#1 +``` + +如果你试图向一个将消息屏蔽了的用户发送信息,你应该会看到这样的输出: + +``` +$ write nemo +write: nemo has messages disabled +``` + +### talk/ytalk + +`talk` 和 `ytalk` 命令让你可以和一个或多个用户进行交互式的聊天。它们会展示一个有上下两个子窗口的界面,每个用户向显示在他们屏幕上方的窗口内输入内容,并在下方的窗口看到回复信息。要回复一个`talk` 请求,接收方可以输入 `talk`,在后面加上请求方的用户名。 + +``` +Message from Talk_Daemon@dragonfly at 10:10 ... +talk: connection requested by dory@127.0.0.1. +talk: respond with: talk dory@127.0.0.1 + +$ talk dory +``` + +如果使用的是 `ytalk`,那么窗口中可以包含多于两个参与者。正如下面的例子所展示的(这是上面 `talk dory` 命令的结果),`talk` 通常指向 `ytalk`。 + +``` +----------------------------= YTalk version 3.3.0 =-------------------------- +Is the report ready? + +-------------------------------= nemo@dragonfly =---------------------------- +Just finished it +``` + +如上所述,在通话的另一侧,`talk`会话界面的窗口是相反的: + +``` +----------------------------= YTalk version 3.3.0 =-------------------------- +Just finished it + +-------------------------------= dory@dragonfly =---------------------------- +Is the report ready? +``` + +同样的,使用 `ctrl-c` 来退出。 + +如果要和非本机的用户通讯,你需要加上 `-h` 选项和目标主机名或IP地址,就像这样: + +``` +$ talk -h 192.168.0.11 nemo +``` + +### 总结 + +Linux 上有若干基本的命令可以用来向其他登录的用户发送消息。如果你需要向所有用户快速发送信息或是需要便捷的电话替代品,又或是希望能简单地开始一个多用户快速通讯会话,这些命令会十分实用。 + +一些命令如 `wall` 允许广播消息但却不是交互式的。另外的一些命令如 `talk` 允许多用户进行长时间通讯,当你只需要非常快速地交换一些信息,它们可以你你避免建立一个电话会议。 + +-------------------------------------------------------------------------------- + +via: https://www.networkworld.com/article/3530343/communicating-with-other-users-on-the-linux-command-line.html + +作者:[Sandra Henry-Stocker][a] +选题:[lujun9972][b] +译者:[linusboyle](https://github.com/linusboyle) +校对:[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.networkworld.com/article/3440100/take-the-intelligent-route-with-consumption-based-storage.html?utm_source=IDG&utm_medium=promotions&utm_campaign=HPE21620&utm_content=sidebar ( Take the Intelligent Route with Consumption-Based Storage) +[2]: https://www.facebook.com/NetworkWorld/ +[3]: https://www.linkedin.com/company/network-world diff --git a/published/202003/20200306 Three Ways to Exclude-Hold-Prevent a Specific Package from an apt Upgrade.md b/published/202003/20200306 Three Ways to Exclude-Hold-Prevent a Specific Package from an apt Upgrade.md new file mode 100644 index 0000000000..f005d928fa --- /dev/null +++ b/published/202003/20200306 Three Ways to Exclude-Hold-Prevent a Specific Package from an apt Upgrade.md @@ -0,0 +1,182 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11992-1.html) +[#]: subject: (Three Ways to Exclude/Hold/Prevent a Specific Package from an apt Upgrade) +[#]: via: (https://www.2daygeek.com/debian-ubuntu-exclude-hold-prevent-packages-from-apt-get-upgrade/) +[#]: author: (Magesh Maruthamuthu https://www.2daygeek.com/author/magesh/) + +从 apt 升级中排除/保留/阻止特定软件包的三种方法 +====== + +![](https://img.linux.net.cn/data/attachment/album/202003/13/103902tfyv8eeuo5jf9ifo.jpg) + +有时,由于某些应用依赖性,你可能会意外更新不想更新的软件包。这在全系统更新或自动包升级时经常会发生。如果发生这种情况,可能会破坏应用的功能。这会造成严重的问题,你需要花费大量时间来解决问题。 + +如何避免这种情况?如何从 `apt-get` 更新中排除软件包? + +> 如果你要[从 Yum Update 中排除特定软件包][1],请参考这篇。 + +是的,可以在 Debian 和 Ubuntu 系统上使用以下三种方法来完成。 + +* [apt-mark 命令][2] +* [dpkg 命令][3] +* aptitude 命令 + +我们将分别详细展示。 + +### 方法 1:如何使用 apt-mark 命令排除 Debian/Ubuntu 系统上的软件包更新 + +`apt-mark` 用于将软件包标记/取消标记为自动安装。 + +`hold` 选项用于将软件包标记为保留,以防止软件包被自动安装、升级或删除。 + +`unhold` 选项用于取消先前面的设置,以允许重复执行所有操作。 + +运行以下命令以使用 `apt-mark` 命令保留指定的软件包。 + +``` +$ sudo apt-mark hold nano +nano set on hold. +``` + +保留软件包后,请运行以下 `apt-mark` 命令查看它们。 + +``` +$ sudo apt-mark showhold +nano +``` + +这表明在执行完整的系统更新时,不会升级 nano 包。 + +``` +$ sudo apt update + +Reading package lists… Done +Building dependency tree +Reading state information… Done +Calculating upgrade… Done +The following packages have been kept back: + nano +0 upgraded, 0 newly installed, 0 to remove and 1 not upgraded. +``` + +运行以下命令,使用 `apt-mark` 命令取消保留 nano 包。 + +``` +$ sudo apt-mark unhold nano +Canceled hold on nano. +``` + +### 方法 2:如何使用 dpkg 命令在 Debian/Ubuntu 系统上排除软件包更新 + +`dpkg` 命令是一个 CLI 工具,用于安装、构建、删除和管理 Debian 软件包。`dpkg` 的主要且更用户友好的前端是 `aptitude`。 + +运行以下命令使用 `dpkg` 命令阻止给定的软件包。 + +语法: + +``` +$ echo "package_name hold" | sudo dpkg --set-selections +``` + +运行以下 `dpkg` 命令以保留 apache2 包。 + +``` +$ echo "apache2 hold" | sudo dpkg --set-selections +``` + +保留软件包后,请运行以下命令查看它们。 + +``` +$ sudo dpkg --get-selections | grep "hold" +apache2 hold +``` + +它会显示在执行完整的系统更新时,不会升级 apache2包。 + +``` +$ sudo apt update + +Reading package lists… Done +Building dependency tree +Reading state information… Done +Calculating upgrade… Done +The following packages have been kept back: + apache2 +0 upgraded, 0 newly installed, 0 to remove and 1 not upgraded. +``` + +运行以下命令,使用 `dpkg` 命令取消对指定软件包的保留。 + +语法: + +``` +$ echo "package_name install" | sudo dpkg --set-selections +``` + +运行以下命令,使用 `dpkg` 命令取消保留 apache2 包。 + +``` +$ echo "apache2 install" | sudo dpkg --set-selections +``` + +### 方法 3:如何使用 aptitude 命令排除 Debian/Ubuntu 系统上的软件包更新 + +`aptitude` 命令是 Debian 及其衍生版本的基于文​​本的软件包管理界面。 + +它允许用户查看软件包列表并执行软件包管理任务,例如安装、升级和删除软件包。它可以从可视界面或命令行执行操作。 + +运行以下命令,使用 `aptitude` 命令保留指定的软件包。 + +``` +$ sudo aptitude hold python3 +``` + +保留某些软件包后,请运行以下命令查看它们。 + +``` +$ sudo dpkg --get-selections | grep "hold" +或者 +$ sudo apt-mark showhold + +python3 +``` + +这表明在执行完整的系统更新时,不会升级 python3 软件包。 + +``` +$ sudo apt update + +Reading package lists… Done +Building dependency tree +Reading state information… Done +Calculating upgrade… Done +The following packages have been kept back: + python3 +0 upgraded, 0 newly installed, 0 to remove and 1 not upgraded. +``` + +使用 `aptitude ` 命令运行以下命令以解除对 python3 软件包的保留。 + +``` +$ sudo aptitude unhold python3 +``` + +-------------------------------------------------------------------------------- + +via: https://www.2daygeek.com/debian-ubuntu-exclude-hold-prevent-packages-from-apt-get-upgrade/ + +作者:[Magesh Maruthamuthu][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://www.2daygeek.com/author/magesh/ +[b]: https://github.com/lujun9972 +[1]: https://www.2daygeek.com/redhat-centos-yum-update-exclude-specific-packages/ +[2]: https://www.2daygeek.com/apt-get-apt-cache-command-examples-manage-packages-debian-ubuntu-systems/ +[3]: https://www.2daygeek.com/dpkg-command-to-manage-packages-on-debian-ubuntu-linux-mint-systems/ diff --git a/published/202003/20200309 6 Raspberry Pi tutorials to try out.md b/published/202003/20200309 6 Raspberry Pi tutorials to try out.md new file mode 100644 index 0000000000..a15b85f450 --- /dev/null +++ b/published/202003/20200309 6 Raspberry Pi tutorials to try out.md @@ -0,0 +1,68 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12005-1.html) +[#]: subject: (6 Raspberry Pi tutorials to try out) +[#]: via: (https://opensource.com/article/20/3/raspberry-pi-tutorials) +[#]: author: (Lauren Pritchett https://opensource.com/users/lauren-pritchett) + +6 个可以尝试的树莓派教程 +====== + +> 这些树莓派项目均旨在简化你的生活并提高生产力。 + +![](https://img.linux.net.cn/data/attachment/album/202003/17/142619e7jbh7dj5448nf1i.jpg) + +没有什么比体验树莓派创作结果更令人兴奋了。经过数小时的编程、测试和徒手构建,你的项目终于开始成形,你不禁大喊 “哇哦!”树莓派可以带给日常生活的可能性让我着迷。无论你是想学习新知识、尝试提高效率还是只是乐在其中,本文总有一个树莓派项目适合你。 + +### 设置 VPN 服务器 + +本[教程][2]教你如何使用树莓派添加一个网络安全层。这个项目不仅有实际好处,而且还能为你带来很多乐趣。额外的安全性使你可以放心地做其它项目,例如下面列出的项目。 + +### 创建一个物体跟踪摄像机 + +树莓派之所以具有吸引力,是因为它提供了较低的入门门槛来学习机器学习等新技术。这份[分步指南][3]提供了详尽的说明,说明了如何构建一个全景摄像头,以便使用 TensorFlow 和树莓派跟踪运动。 + +### 使用照片幻灯片展示你最喜欢的回忆 + +你是否曾经问过自己:“我应该怎么处理这些数码照片?”。如果你像我一样这样想过,那么答案是“是”。在朋友和家人圈子中,我被公认为摄像爱好者。这就是为什么我喜欢这个树莓派项目。在[本教程][4]中,你将学习如何设置照片幻灯片,以便轻松地在家里展示自己喜欢的回忆,而无需打印机! + +### 玩复古电子游戏 + +如果你对复古游戏系统怀有怀旧之情,那么可以尝试[本教程][5]。了解包括树莓派在内的哪些设备可以运行 Amiga 模拟器。完成设置后,你将可在树莓派上玩自己喜欢的 Amiga 游戏。 + +### 为你的娱乐中心搭建时钟 + +在过去的十年中,家庭娱乐中心发生了很大的变化。我的家人完全依靠流媒体服务来观看节目和电影。我之所以爱它是因为我可以通过移动设备或语音助手控制电视。但是,当你不再能一眼看到时钟时,便会失去一定程度的便利!请遵循[这些步骤][6],使用树莓派从头开始搭建自己的时钟显示。 + +### 扩大自制啤酒的生产规模 + +在[本教程][7]中,经验丰富的家庭酿酒师分享了他建立电动啤酒酿造系统的经验。该项目需要在硬件和零件上进行更多的前期投资,但由此产生的效率和一致性让这些值得。为此祝贺! + +如果你是像我这样的树莓派新手,那么我建议你阅读我们这些可下载的树莓派指南。我们的[单页速查表][8]提供了入门指南。有关更多技巧和教程,我们的[综合指南][9]涵盖了一些主题,例如选择树莓派、保持更新、为社区做出贡献等。 + +你会尝试哪个树莓派项目?让我们在评论中知道。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/3/raspberry-pi-tutorials + +作者:[Lauren Pritchett][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/lauren-pritchett +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/raspberrypi_cartoon.png?itok=m3TcBONJ (Cartoon graphic of Raspberry Pi board) +[2]: https://opensource.com/article/19/6/raspberry-pi-vpn-server +[3]: https://opensource.com/article/20/1/object-tracking-camera-raspberry-pi +[4]: https://opensource.com/article/19/2/wifi-picture-frame-raspberry-pi +[5]: https://opensource.com/article/19/3/amiga-raspberry-pi +[6]: https://opensource.com/article/17/7/raspberry-pi-clock +[7]: https://opensource.com/article/17/7/brewing-beer-python-and-raspberry-pi +[8]: https://opensource.com/downloads/getting-started-raspberry-pi-cheat-sheet +[9]: https://opensource.com/downloads/raspberry-pi-guide diff --git a/published/202003/20200310 2020 Will Be a Year of Hindsight for SD-WAN.md b/published/202003/20200310 2020 Will Be a Year of Hindsight for SD-WAN.md new file mode 100644 index 0000000000..6b4c3c1886 --- /dev/null +++ b/published/202003/20200310 2020 Will Be a Year of Hindsight for SD-WAN.md @@ -0,0 +1,61 @@ +[#]: collector: (lujun9972) +[#]: translator: (hkurj) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12034-1.html) +[#]: subject: (2020 Will Be a Year of Hindsight for SD-WAN) +[#]: via: (https://www.networkworld.com/article/3531315/2020-will-be-a-year-of-hindsight-for-sd-wan.html) +[#]: author: (Zeus Kerravala https://www.networkworld.com/author/Zeus-Kerravala/) + +2020 年将是 SD-WAN 的回顾之年 +====== + +![](https://images.idgesg.net/images/article/2020/03/istock-1127447341-100834720-large.jpg) + +对于软件定义的广域网(SD-WAN),“过去看起来困难的选择,知道了这些选择的结果后,现在看起来就很清晰了” 这一说法再合适不过了。总结过去的几年:云计算和数字化转型促使公司重新评估传统的 WAN 技术,该技术不再能够满足其不断增长的业务需求。从那时起,SD-WAN 成为一种有前途的新技术。 + +SD-WAN 旨在解决物理设备的流量管理问题,并支持从云进行基于软件的配置。许多最初的 SD-WAN 部署都因希望取代昂贵的多协议标签交换 (MPLS) 而得到推动。公司希望它可以神奇地解决他们所有的网络问题。但是在实践中,基本的 SD-WAN 解决方案远没有实现这一愿景。 + +快速发展到现在,围绕 SD-WAN 的炒作已经尘埃落定,并且早期的实施工作已经过去。现在是时候回顾一下我们在 2019 年学到的东西以及在 2020 年要改进的地方。所以,让我们开始吧。 + +### 1、这与节省成本无关 + +大多数公司选择 SD-WAN 作为 MPLS 的替代品,因为它可以降低 WAN 成本。但是,[节省的成本][1]会因 SD-WAN 的不同而异,因此不应将其用作部署该技术的主要驱动力。无论公司需要什么,公司都应该专注于提高网络敏捷性,例如实现更快的站点部署和减少配置时间。SD-WAN 的主要驱动力是使网络更高效。如果成功实现那么成本也会随之降低。 + +### 2、WAN 优化是必要的 + +说到效率,[WAN 优化][2]提高了应用程序和数据流量的性能。通过应用协议加速、重复数据消除、压缩和缓存等技术,WAN 优化可以增加带宽、减少延迟并减轻数据包丢失。最初的想法是 SD-WAN 可以完成对 WAN 优化的需求,但是我们现在知道某些应用程序需要更多的性能支持。这些技术相互补充,而不是相互替代。它们应该用来解决不同的问题。 + +### 3、安全性不应该事后考虑 + +SD-WAN 具有许多优点,其中之一就是使用宽带互联网快速发送企业应用程序流量。但是这种方法也带来了安全风险,因为它使用户及其本地网络暴露于不受信任的公共互联网中。从一开始,安全性就应该成为 SD-WAN 实施的一部分,而不是在事后。公司可以通过使用[安全的云托管][3]之类的服务,将安全性放在分支机构附近,从而实现所需的应用程序性能和保护。 + +### 4、可见性对于 SD-WAN 成功至关重要 + +在应用程序和数据流量中具有[可见性][4],这使网络管理不再需要猜测。最好的起点是部署前阶段,在此阶段,公司可以在实施 SD-WAN 之前评估其现有功能以及缺少的功能。可见性以日常监控和警报的形式在部署后继续发挥重要作用。了解网络中正在发生的情况的公司会更好地准备应对性能问题,并可以利用这些知识来避免将来出现问题。 + +### 5、无线广域网尚未准备就绪 + +SD-WAN 可通过包括宽带和 4G/LTE 无线在内的任何传输将用户连接到应用程序。这就是[移动互联][5]越来越多地集成到 SD-WAN 解决方案中的原因。尽管公司渴望将 4G 用作潜在的传输替代方案(尤其是在偏远地区),但由此带来的按使用付费 4G 服务成本却很高。此外,由于延迟和带宽限制,4G 可能会出现问题。最好的方法是等待服务提供商部署具有更好的价格选择的 5G。今年我们将看到 5G 的推出,并更加关注无线 SD-WAN。 + +请务必观看以下 SD-WAN 视频系列:[你应该知道的所有关于 SD-WAN 的知识][6]。 + +-------------------------------------------------------------------------------- + +via: https://www.networkworld.com/article/3531315/2020-will-be-a-year-of-hindsight-for-sd-wan.html + +作者:[Zeus Kerravala][a] +选题:[lujun9972][b] +译者:[hkurj](https://github.com/hkurj) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://www.networkworld.com/author/Zeus-Kerravala/ +[b]: https://github.com/lujun9972 +[1]: https://blog.silver-peak.com/to-maximize-the-value-of-sd-wan-look-past-hardware-savings +[2]: https://blog.silver-peak.com/sd-wan-vs-wan-optimization +[3]: https://blog.silver-peak.com/sd-wans-enable-scalable-local-internet-breakout-but-pose-security-risk +[4]: https://blog.silver-peak.com/know-the-true-business-drivers-for-sd-wan +[5]: https://blog.silver-peak.com/mobility-and-sd-wan-part-1-sd-wan-with-4g-lte-is-a-reality +[6]: https://www.silver-peak.com/everything-you-need-to-know-about-sd-wan diff --git a/published/202003/20200310 Basilisk- A Firefox Fork For The Classic Looks and Classic Extensions.md b/published/202003/20200310 Basilisk- A Firefox Fork For The Classic Looks and Classic Extensions.md new file mode 100644 index 0000000000..b15e81597e --- /dev/null +++ b/published/202003/20200310 Basilisk- A Firefox Fork For The Classic Looks and Classic Extensions.md @@ -0,0 +1,103 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12001-1.html) +[#]: subject: (Basilisk: A Firefox Fork For The Classic Looks and Classic Extensions) +[#]: via: (https://itsfoss.com/basilisk-browser/) +[#]: author: (Ankush Das https://itsfoss.com/author/ankush/) + +Basilisk:一个有着经典的外观和扩展的 Firefox 复刻 +====== + +> Basilisk 是一个 Firefox 复刻,它支持旧版的扩展等更多功能。在这里,我们看一下它的功能并尝试一下。 + +![](https://img.linux.net.cn/data/attachment/album/202003/16/130319lvls6fvsaslzllrv.jpg) + +### Basilisk:基于 XUL 的开源 Web 浏览器 + +尽管最好使用 Linux 上的常规浏览器(如 Firefox 或 Chromium),但了解其他浏览器也没坏处。最近,我偶然发现了一个 Firefox 复刻:[Basilisk][1] 浏览器,它有经典的 Firefox 用户界面以及对旧版扩展的支持(就像 [Waterfox][2] 一样)。 + +![itsfoss.com homepage on Basilisk][3] + +如果你迫切需要使用旧版扩展程序或怀念 Firefox 的经典外观,Basilisk 浏览器可以帮到你。这个浏览器是由 [Pale Moon][4] 浏览器背后的团队维护(这是我接下来要介绍的另一个 Firefox 复刻)。 + +如果你正在寻找开源 [Chrome 替代品][5],那么你可以快速了解一下 Basilisk 提供的功能。 + +**注意:**Basilisk 是开发中软件。即使我在使用时没有遇到重大的可用性问题,但你也不应依赖它作为唯一使用的浏览器。 + +### Basilisk 浏览器的特性 + +![][6] + +Basilisk 开箱即用。但是,在考虑使用之前,可能需要先看一下以下这些特性: + +* 基于 [XUL][7] 的 Web 浏览器 +* 它具有 “Australis” Firefox 界面,这在 v29–v56 的 Firefox 版本中非常流行。 +* 支持 [NPAPI][8] 插件(Flash、Unity、Java 等) +* 支持 XUL/Overlay Mozilla 形式的扩展。 +* 使用 [Goanna][9] 开源浏览器引擎,它是 Mozilla [Gecko][10] 的复刻 +* 不使用 Rust 或 Photon 用户界面 +* 仅支持 64 位系统 + +### 在 Linux 上安装 Basilisk + +你可能没有在软件中心中找到它。因此,你必须前往其官方[下载页面][11]获得 tarball(tar.xz)文件。 + +下载后,只需将其解压缩并进入文件夹。接下来,你将在其中找到一个 `Basilisk` 可执行文件。你只需双击或右键单击并选择 “运行” 即可运行它。 + +你可以查看它的 [GitHub 页面][12]获取更多信息。 + +![][13] + +你也可以按照下面的步骤使用终端进入下载的文件夹,并运行文件: + +``` +cd basilisk-latest.linux64 +cd basilisk +./basilisk +``` + +- [下载 Basilisk][1] + +### 使用 Basilisk 浏览器 + +![][14] + +如果你想要支持旧版扩展,Basilisk 是不错的 Firefox 复刻。它是由 Pale Moon 背后的团队积极开发的,对于希望获得 Mozilla Firefox(在 Quantum 更新之前)经典外观,且不包括现代 Web 支持的用户而言,它可能是一个不错的选择。 + +浏览网页没有任何问题。但是,我注意到 YouTube 将其检测为过时的浏览器,并警告说它将很快停止支持它。 + +**因此,我不确定 Basilisk 是否适合所有现有的 Web 服务 —— 但是,如果你确实需要使用 Firefox 较早版本中的扩展,那这是一个解决方案。** + +### 总结 + +你认为这个 Firefox 复刻值得尝试吗?你喜欢哪个?在下面的评论中分享你的想法。 + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/basilisk-browser/ + +作者:[Ankush Das][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://itsfoss.com/author/ankush/ +[b]: https://github.com/lujun9972 +[1]: https://www.basilisk-browser.org/ +[2]: https://itsfoss.com/waterfox-browser/ +[3]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/03/basilisk-itsfoss.jpg?ssl=1 +[4]: https://www.palemoon.org +[5]: https://itsfoss.com/open-source-browsers-linux/ +[6]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/03/basilisk-options-1.jpg?ssl=1 +[7]: https://developer.mozilla.org/en-US/docs/Archive/Mozilla/XUL +[8]: https://wiki.mozilla.org/NPAPI +[9]: https://en.wikipedia.org/wiki/Goanna_(software) +[10]: https://developer.mozilla.org/en-US/docs/Mozilla/Gecko +[11]: https://www.basilisk-browser.org/download.shtml +[12]: https://github.com/MoonchildProductions/Basilisk +[13]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/03/basilisk-folder-1.jpg?ssl=1 +[14]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/03/basilisk-browser-1.jpg?ssl=1 diff --git a/published/202003/20200310 Containers vs. VMs, Istio in production, and more industry news.md b/published/202003/20200310 Containers vs. VMs, Istio in production, and more industry news.md new file mode 100644 index 0000000000..c897efde43 --- /dev/null +++ b/published/202003/20200310 Containers vs. VMs, Istio in production, and more industry news.md @@ -0,0 +1,85 @@ +[#]: collector: "lujun9972" +[#]: translator: "messon007" +[#]: reviewer: "wxy" +[#]: publisher: "wxy" +[#]: url: "https://linux.cn/article-12015-1.html" +[#]: subject: "Containers vs. VMs, Istio in production, and more industry news" +[#]: via: "https://opensource.com/article/20/3/survey-istio-industry-news" +[#]: author: "Tim Hildred https://opensource.com/users/thildred" + +每周开源点评:容器 vs 虚拟机、生产环境中的 Istio 等 +====== + +> 本文是最近一周开源社区的新闻和行业进展。 + +![Person standing in front of a giant computer screen with numbers, data][1] + +我在一家采用开源软件开发模型的企业软件公司任高级产品营销经理,我的一部分职责是为产品营销人员,经理和其他相关人定期发布有关开源社区,市场和业界发展趋势的更新。以下是该更新中我和他们最喜欢的五篇文章。 + +### 云原生应用采用的技术:容器等 + +- [文章链接][2] + +> * 在生产环境中采用容器的比例从 2018 年的 73% 上升到 2019 年的 84%。其中,运行了至少 250 个容器的比例从 2018 年的 46% 上升到 2019 年的 58%。2017 到 2019 年间, 环境中拥有 50 台以上计算机(物理或虚拟)的受访者人数从 2017 年的 77% 上升到 2019 年的 81%。 +> * 表明: 容器的引入似乎缓解了需要管理的 VM 的快速增长。但是,请警惕要管理的原始机器数量会减少的说法。 +> + +**分析**:从直觉上看,随着容器使用的增长,虚拟机的增长将放缓;有许多容器被部署在虚拟机内部,从而充分利用了两者的优势特性,而且许多应用不会很快被容器化(留意下你所在企业的传统单体式应用)。 + +### 在生产环境中运行Istio的经验 + +- [文章链接][3] + +> 在 HelloFresh,我们将团队分为小队和团伙。每个团伙都有自己的 Kubernetes 命名空间。如上所述,我们先按命名空间启用 sidecar 注入,然后再逐个对应用启用。在将应用添加到 Istio 之前,我们举办了研讨会,以使小队了解其应用发生的变化。由于我们采用“您构建,您维护”的模型,团队可以在故障定位时了解应用的进出流量。不仅如此,它还提升了公司内部的知识量。我们还创建了 Istio 相关的 [OKR][4] ,来跟踪我们的进度并达成我们引入Istio的目的。 + +**分析**:引入或是不引入技术,要由自己决定,同时要自行承担相应的后果。 + +### Aether: 首个开源的边缘云平台 + +- [文章链接][5] + +> ONF 的营销副主席 Sloane 这样解释 Aether: 它将多个正在自己的沙箱中开发和运行的项目聚集到一起,ONF 试图在该框架下将多种边缘服务在一个融合平台上支持起来。ONF 的各个项目将保持独立并可继续单独使用,但是 Aether 试图将多个能力绑定到一起来简化企业的私有边缘云运营。 +> +> 他说:“我们认为我们正在创造一个新的合作空间,工业界和社区可以携手帮助推动通用平台背后的整合和关键工作,然后可以帮助这些边缘云中的通用功能不断发展”。 + +**分析**:当今,使用技术解决的问题过于复杂,无法通过单一技术解决。比技术更重要的是要解决的业务问题需要聚焦于真正增值的部分。将两者结合起来,就是企业之间需要在他们共同的需求上找到合作的方法,并在它们特有的方面进行竞争。除了开源,你找不到比这更好的方法了。 + +### 与云相关职业的女性正在改变现状 + +- [文章链接][6] + +> Yordanova 说:“由于云是一种相对较新的技术,我的[成为一名“科技女性”][7]的经验可能并不典型,因为云行业极为多样化”。“实际上,我的团队中性别比例相当,成员由随着云技术而成长的不同个性、文化和优势的具体人员组成。“ + +**分析**:我想考虑的一件事就是跨越式的演进思路。你可能可以跳过演进过程中的某个步骤或阶段,因为原先导致其存在的条件已不再适用。云技术时代没有形成“谁发明的以及它是为谁而生”的固有说法,所以也许它所承载的某些前代的技术负担更少? + +### StarlingX 如何在中国开源项目的星空中闪耀 + +- [文章链接][8] + +> 我们的团队在中国,因此我们的任务之一是帮助中国的社区开发软件、贡献代码、文档等。大多数 StarlingX 项目会议是在中国的深夜举行,因此华人社区成员的出席和参与颇具挑战。为了克服这些障碍,我们与中国的其他社区成员(例如 99cloud 的朋友)一起采取了一些措施,例如和其他社区成员一起聚会,一起参加动手实践研讨会和中文的特设技术会议,将一些文档翻译成中文,并在微信小组中不断进行互动(就像每个人都可以享受的 24/7 通话服务一样) + +**分析**:随着中国对开源项目的贡献不断增长,这种情况似乎有可能逆转或至少相当。“学习英语”根本不是参与开源项目开发的先决条件。 + +希望你喜欢这个列表,下周再见。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/3/survey-istio-industry-news + +作者:[Tim Hildred][a] +选题:[lujun9972][b] +译者:[messon007](https://github.com/messon007) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/thildred +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/data_metrics_analytics_desktop_laptop.png?itok=9QXd7AUr "Person standing in front of a giant computer screen with numbers, data" +[2]: https://thenewstack.io/cncf-survey-snapshot-tech-adoption-in-the-cloud-native-world/ +[3]: https://engineering.hellofresh.com/everything-we-learned-running-istio-in-production-part-1-51efec69df65 +[4]: https://en.wikipedia.org/wiki/OKR +[5]: https://www.sdxcentral.com/articles/news/onf-projects-coalesce-for-enterprise-edge-cloud/2020/03/ +[6]: https://www.cloudpro.co.uk/leadership/cloud-essentials/8446/how-women-in-cloud-are-challenging-the-narrative +[7]: https://www.itpro.co.uk/business-strategy/33301/diversity-not-a-company-priority-claim-nearly-half-of-women-in-tech +[8]: https://superuser.openstack.org/articles/starlingx-community-interview-how-starlingx-shines-in-the-starry-sky-of-open-source-projects-in-china/ diff --git a/published/202003/20200310 Run Kubernetes on a Raspberry Pi with k3s.md b/published/202003/20200310 Run Kubernetes on a Raspberry Pi with k3s.md new file mode 100644 index 0000000000..79b42ade4d --- /dev/null +++ b/published/202003/20200310 Run Kubernetes on a Raspberry Pi with k3s.md @@ -0,0 +1,187 @@ +[#]: collector: (lujun9972) +[#]: translator: (HankChow) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12049-1.html) +[#]: subject: (Run Kubernetes on a Raspberry Pi with k3s) +[#]: via: (https://opensource.com/article/20/3/kubernetes-raspberry-pi-k3s) +[#]: author: (Lee Carpenter https://opensource.com/users/carpie) + +使用 K3s 在树莓派上运行 Kubernetes 集群 +====== + +> 跟随接下来的介绍,自己搭建一个三节点的 Kubernetes 集群。 + +![](https://img.linux.net.cn/data/attachment/album/202003/29/121559p44e3dfrerf3zver.jpg) + +我对在树莓派上搭建 [Kubernetes][2] 集群已经感兴趣很长时间了,只要照着网上的教程,我可以在由三个树莓派组成的集群中搭建一套 Kubernetes 并正常运行。但在这种情况下,主节点上的内存和 CPU 资源捉襟见肘,执行 Kubernetes 任务的时候往往性能不佳,想要升级 Kubernetes 就更不可能了。 + +这个时候,我非常激动地发现了 [K3s][3] 这个项目。K3s 被誉为在可用于资源受限环境下的轻量级 Kubernetes,它还针对 ARM 处理器做出了优化,这让 Kubernetes 集群可以在树莓派上运行得更好。在下文中,我们将会使用 K3s 来创建一个 Kubernetes 集群。 + +- [video](https://youtu.be/6PqxJhV-t1s) + +### 准备 + +要按照本文介绍的方式创建 Kubernetes 集群,首先需要准备: + +* 至少一个树莓派(包括 SD 卡和电源) +* 网线 +* 将所有树莓派连接到一起的交换机或路由器 + +我们会通过在线安装的方式安装 K3s,因此还需要可以连接到互联网。 + +### 集群概览 + +在这个集群里,我们会使用三个树莓派。其中一个树莓派作为主节点,我们将它命名为 `kmaster`,并为其分配一个静态 IP `192.168.0.50`(注:假设使用的私有网段是 192.168.0.0/24),而另外两个树莓派作为工作节点,分别命名为 `knode1` 和 `knode2`,也分别分配 `192.168.0.51` 和 `192.168.0.52` 两个 IP 地址。 + +当然,如果你实际的网络布局和上面不同,只要将文中所提及到的 IP 替换成你实际可用的 IP 就可以了。 + +为了不需要通过 IP 来引用某一个节点,我们将每个节点的主机名记录到 PC 的 `/etc/hosts` 文件当中: + +``` +echo -e "192.168.0.50\tkmaster" | sudo tee -a /etc/hosts +echo -e "192.168.0.51\tknode1" | sudo tee -a /etc/hosts +echo -e "192.168.0.52\tknode2" | sudo tee -a /etc/hosts +``` + +### 部署主节点 + +我们首先部署主节点。最开始的步骤当然是使用镜像安装最新的 Raspbian,这个步骤可以参考我的[另一篇文章][4],在这里就不展开介绍了。在安装完成之后,启动 SSH 服务,将主机名设置为 `kmaster`,然后分配静态 IP `192.168.0.50`。 + +在主节点上安装 Raspbian 完成后,启动树莓派并通过 `ssh` 连接上去: + +``` +ssh pi@kmaster +``` + +在主节点上执行以下命令安装 K3s: + +``` +curl -sfL https://get.k3s.io | sh - +``` + +等到命令跑完以后,一个单节点集群就已经运行起来了。让我们检查一下,还在这个树莓派上执行: + +``` +sudo kubectl get nodes +``` + +就会看到这样的输出: + +``` +NAME STATUS ROLES AGE VERSION +kmaster Ready master 2m13s v1.14.3-k3s.1 +``` + +### 获取连接令牌join token + +之后我们需要部署工作节点。在工作节点上安装 K3s 的时候,会需要用到连接令牌,它放置在主节点的文件系统上。首先把连接令牌保存出来以便后续使用: + +``` +sudo cat /var/lib/rancher/k3s/server/node-token +``` + +### 部署工作节点 + +通过 SD 卡在每个作为工作节点的树莓派上安装 Raspbian。在这里,我们把其中一个树莓派的主机名设置为 `knode1`,为其分配 IP 地址 `192.168.0.51`,另一个树莓派的主机名设置为 `knode2`,分配 IP 地址 `192.168.0.52`。接下来就可以安装 K3s 了。 + +启动主机名为 `knode1` 的树莓派,通过 `ssh` 连接上去: + +``` +ssh pi@knode1 +``` + +在这个树莓派上,安装 K3s 的过程和之前差不多,但需要另外加上一些参数,表示它是一个工作节点,需要连接到一个已有的集群上: + +``` +curl -sfL http://get.k3s.io | K3S_URL=https://192.168.0.50:6443 \ +K3S_TOKEN=刚才保存下来的连接令牌 sh - +``` + +`K3S_TOKEN` 的值需要替换成刚才保存下来的实际的连接令牌。完成之后,在主机名为 `knode2` 的树莓派上重复这个安装过程。 + +### 通过 PC 访问集群 + +现在如果我们想要查看或者更改集群,都必须 `ssh` 到集群的主节点才能使用 `kubectl`,这是比较麻烦的。因此我们会将 `kubectl` 放到 PC 上使用。首先,在主节点上获取一些必要的配置信息,`ssh` 到 `kmaster` 上执行: + +``` +sudo cat /etc/rancher/k3s/k3s.yaml +``` + +复制上面命令的输出,然后在你的 PC 上创建一个目录用来放置配置文件: + +``` +mkdir ~/.kube +``` + +将复制好的内容写入到 `~/.kube/config` 文件中,然后编辑该文件,将 + +``` +server: https://localhost:6443 +``` + +改为 + +``` +server: https://kmaster:6443 +``` + +出于安全考虑,只对自己保留这个配置文件的读写权限: + +``` +chmod 600 ~/.kube/config +``` + +如果 PC 上还没有安装 `kubectl` 的话,就可以开始安装了。Kubernetes 官方网站上有各种平台安装 `kubectl` 的[方法说明][5],我使用的是 Ubuntu 的衍生版 Linux Mint,所以我的安装方法是这样的: + +``` +sudo apt update && sudo apt install -y apt-transport-https +curl -s https://packages.cloud.google.com/apt/doc/apt-key.gpg | sudo apt-key add - +echo "deb https://apt.kubernetes.io/ kubernetes-xenial main" | sudo tee -a /etc/apt/sources.list.d/kubernetes.list +sudo apt update && sudo apt install kubectl +``` + +上面几个命令的作用是添加了一个包含 Kubernetes 的 Debian 软件库,获取 GPG 密钥以确保安全,然后更新软件包列表并安装 `kubectl`。如果 `kubectl` 有更新,我们将会通过标准软件更新机制standard software update mechanism收到通知。 + +现在在 PC 上就可以查看 Kubernetes 集群了: + +``` +kubectl get nodes +``` + +输出大概会是这样: + +``` +NAME STATUS ROLES AGE VERSION +kmaster Ready master 12m v1.14.3-k3s.1 +knode1 Ready worker 103s v1.14.3-k3s.1 +knode1 Ready worker 103s v1.14.3-k3s.1 +``` + +至此,我们已经搭建了一个三节点的 Kubernetes 集群。 + +### K3s 的彩蛋 + +如果执行 `kubectl get pods --all-namespaces`,就会看到其它服务的一些 Pod,比如 [Traefik][6]。Traefik 在这里起到是反向代理和负载均衡器的作用,它可以让流量从单个入口进入集群后引导到集群中的各个服务。Kubernetes 支持这种机制,但 Kubernetes 本身不提供这个功能,因此 Traefik 是一个不错的选择,K3s 安装后立即可用的优点也得益于此。 + +在后续的文章中,我们会继续探讨 Traefik 在 Kubernetes ingress 中的应用,以及在集群中部署其它组件。敬请关注。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/3/kubernetes-raspberry-pi-k3s + +作者:[Lee Carpenter][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/carpie +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/ship_wheel_gear_devops_kubernetes.png?itok=xm4a74Kv (A ship wheel with someone steering) +[2]: https://opensource.com/resources/what-is-kubernetes +[3]: https://k3s.io/ +[4]: https://carpie.net/articles/headless-pi-with-static-ip-wired-edition +[5]: https://kubernetes.io/docs/tasks/tools/install-kubectl/ +[6]: https://traefik.io/ diff --git a/published/202003/20200311 How to install pip to manage PyPI packages easily.md b/published/202003/20200311 How to install pip to manage PyPI packages easily.md new file mode 100644 index 0000000000..b6453085c1 --- /dev/null +++ b/published/202003/20200311 How to install pip to manage PyPI packages easily.md @@ -0,0 +1,145 @@ +[#]: collector: (lujun9972) +[#]: translator: (HankChow) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11993-1.html) +[#]: subject: (How to install pip to manage PyPI packages easily) +[#]: via: (https://opensource.com/article/20/3/pip-linux-mac-windows) +[#]: author: (Vijay Singh Khatri https://opensource.com/users/vijaytechnicalauthor) + +安装 pip 轻松管理 PyPI 软件包 +====== + +> 在 Linux、Mac 或 Windows 上为旧版 Python 安装 pip。 + +![](https://img.linux.net.cn/data/attachment/album/202003/14/102539wq3a73opalpzoabb.jpg) + +Python 是一种功能强大、流行广泛的编程语言,在常规编程、数据科学等很多方面它都有丰富的软件包可供使用。但这些软件包通常都不会在 Python 安装时自动附带,而是需要由用户自行下载、安装和管理。所有的这些软件包(包括库和框架)都存放在一个名叫 [PyPI][2](也就是 Python 软件包索引 Python Package Index)的中央存储库当中,而 `pip`(也就是首选安装程序Preferred Installer Program)则是管理这个中央存储库的工具。 + +在安装 `pip` 之后,管理 PyPI 的软件包就变得很方便了。大部分的软件包都可以通过在终端或者命令行界面执行 `python -m pip install <软件包名>` 这样的命令来完成安装。 + +较新版本的 Python 3(3.4 或以上)和 Python 2(2.7.9 或以上)都已经预装了 `pip`,旧版本的 Python 没有自带 `pip`,但可以另外安装。 + +在这篇文章中,我将会介绍 `pip` 在 Linux、Mac 和 Windows 系统上的安装过程。想要了解更多详细信息,可以参考 [pip.pypa][3] 的文档。 + +### 首先需要安装 Python + +首先你的系统中需要安装好 Python,否则 `pip` 安装器无法理解任何相关的命令。你可以在命令行界面、Bash 或终端执行 `python` 命令确认系统中是否已经安装 Python,如果系统无法识别 `python` 命令,请先[下载 Python][4] 并安装。安装完成后,你就可以看到一些引导你安装 `pip` 的提示语了。 + +### 在 Linux 上安装 pip + +在不同发行版的 Linux 上,安装 `pip` 的命令也有所不同。 + +在 Fedora、RHEL 或 CentOS 上,执行以下命令安装: + +``` +$ sudo dnf install python3 +``` + +在 Debian 或 Ubuntu 上,使用 `apt` 包管理工具安装: + +``` +$ sudo apt install python3-pip +``` + +其它的发行版可能还会有不同的包管理工具,比如 Arch Linux 使用的是 `pacman`: + +``` +$ sudo pacman -S python-pip +``` + +执行 `pip --version` 命令就可以确认 `pip` 是否已经正确安装。 + +在 Linux 系统上安装 `pip` 就是这样简单,你可以直接跳到“使用 pip”部分继续阅读。 + +### 在 Mac 上安装 pip + +MacOS 已经预装了 Python,但 Python 版本一般是比较旧的。如果你要使用 Python 的话,建议[另外安装 Python 3][6]。 + +在 Mac 上可以使用 [homebrew][7] 安装 Python 3: + +``` +$ brew update && brew upgrade python +``` + +如果你安装的是以上提到的新版本 Python 3,它会自带 `pip` 工具。你可以使用以下命令验证: + +``` +$ python3 -m pip --version +``` + +如果你使用的是 Mac,安装过程也到此结束,可以从“使用 pip”部分继续阅读。 + +### 在 Windows 上安装 pip + +以下 `pip` 安装过程是针对 Windows 8 和 Windows 10 的。下面文章中的截图是 Windows 10 环境下的截图,但对 Windows 8 同样适用。 + +首先确认 [Python 已经安装完成][8]。 + +如果你想在 Windows 系统上像 Linux 一样使用包管理工具,[Chocolatey][9] 是一个不错的选择,它可以让 Python 的调用和更新变得更加方便。Chocolatey 在 PowerShell 中就可以运行,只需要简单的命令,Python 就可以顺利安装。 + +``` +PS> choco install python +``` + +接下来就可以使用 `pip` 安装所需的软件包了。 + +### 使用 pip + +在 Linux、BSD、Windows 和 Mac 上,`pip` 都是以同样的方式使用的。 + +例如安装某个库: + +``` +python3 -m pip install foo --user +``` + +卸载某个已安装的库: + +``` +python3 -m pip uninstall foo +``` + +按照名称查找软件包: + +``` +python3 -m pip search foo +``` + +将 `pip` 更新到一个新版本: + +``` +$ sudo pip install --upgrade pip +``` + +需要注意的是,在 Windows 系统中不需要在前面加上 `sudo` 命令,这是因为 Windows 通过独有的方式管理用户权限,对应的做法是[创建一个执行策略例外][10]。 + +``` +python -m pip install --upgrade pip +``` + +希望本文介绍的的方法能对你有所帮助,欢迎在评论区分享你的经验。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/3/pip-linux-mac-windows + +作者:[Vijay Singh Khatri][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/vijaytechnicalauthor +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/1980s-computer-yearbook.png?itok=eGOYEKK- (Person typing on a 1980's computer) +[2]: https://pypi.org/ +[3]: https://pip.pypa.io/en/stable/installing/ +[4]: https://www.python.org/downloads/ +[5]: tmp.u1JOYd3gs9#usage +[6]: https://opensource.com/article/19/5/python-3-default-mac +[7]: https://brew.sh +[8]: https://opensource.com/article/19/8/how-install-python-windows +[9]: https://opensource.com/article/20/3/chocolatey +[10]: https://opensource.com/article/20/3/chocolatey#admin diff --git a/published/202003/20200312 Amazon Has Launched Its Own Linux Distribution But It-s Not for Everyone.md b/published/202003/20200312 Amazon Has Launched Its Own Linux Distribution But It-s Not for Everyone.md new file mode 100644 index 0000000000..49d54dbc48 --- /dev/null +++ b/published/202003/20200312 Amazon Has Launched Its Own Linux Distribution But It-s Not for Everyone.md @@ -0,0 +1,87 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12018-1.html) +[#]: subject: (Amazon Has Launched Its Own Linux Distribution But It’s Not for Everyone) +[#]: via: (https://itsfoss.com/bottlerocket-linux/) +[#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/) + +Amazon 推出了自己的容器专用 Linux 发行版“瓶装火箭” +====== + +![](https://img.linux.net.cn/data/attachment/album/202003/21/074953h0a55lq72h0qlpzd.jpg) + +Amazon 已经[推出][1]了自己的基于 Linux 的开源操作系统 Bottlerocket(“瓶装火箭”)。但在你兴奋地想要尝试安装和运行它之前,我必须告诉你,它不是常规的如 Ubuntu、Fedora 或 Debian 这样的 Linux 发行版。那它是什么? + +### Bottlerocket:来自 Amazon 的 Linux 发行版,用于运行容器 + +![][2] + +如果你不了解 Linux 容器,建议你阅读 Red Hat 的[这篇文章][3]。 + +自从首次提出云计算一词以来,IT 行业发生了许多变化。得益于 Amazon AWS、Google、Linode、Digital Ocean 等云服务器提供商,部署 Linux 服务器(通常在虚拟机中运行)只需几秒钟。最重要的是,你可以借助 Docker 和 Kubernetes 之类的工具在这些服务器上以容器形式部署应用和服务。 + +问题是,当你唯一目的是在 Linux 系统上运行容器时,并不总是需要完整的 Linux 发行版。这就是为什么容器专用 Linux 仅提供必要软件包的原因。这将大大减少操作系统的大小,从而进一步减少部署时间。 + +[Bottlerocket][5] Linux 由 Amazon Web Services(AWS)专门构建,用于在虚拟机或裸机上运行容器。它支持 docker 镜像和其他遵循 [OCI 镜像][6]格式的镜像。 + +### Bottlerocket Linux 的特性 + +![][7] + +这是来自 Amazon 的新 Linux 发行版提供的特性: + +#### 没有逐包更新 + +传统的 Linux 发行版更新过程由更新单个软件包组成。Bottlerocket 改用基于镜像的更新。 + +由于采用了这种方法,可以避免冲突和破坏,并可以进行快速而完整的回滚(如有必要)。 + +#### 只读文件系统 + +Bottlerocket 还使用了只读主文件系统。在启动时通过 dm-verity 检查其完整性。在其他安全措施上,也不建议使用 SSH 访问,并且只能通过[管理容器][8](附加机制)使用。 + +AWS 已经统治了云世界。 + +#### 自动更新 + +你可以使用 Amazon EKS 之类的编排服务来自动执行 Bottlerocket 更新。 + +Amazon 还声称,与通用 Linux 发行版相比,仅包含运行容器的基本软件可以减少攻击面。 + +### 你怎么看? + +Amazon 并不是第一个创建“容器专用 Linux” 的公司。我认为 CoreOS 是最早的此类发行版之一。[CoreOS 被 Red Hat 收购][9],Red Hat 又被 [IBM 收购][10]。Red Hat 公司最近停用了 CoreOS,并用 [Fedora CoreOS][11] 代替了它。 + +云服务器是一个巨大的行业,它将继续发展壮大。像 Amazon 这样的巨头将竭尽所能与它竞争对手保持一致或领先。我认为,Bottlerocket 是对 IBM Fedora CoreOS(目前)的应答。 + +尽管 [Bottlerocket 仓库可在 GitHub 上找到][12],但我还没发现就绪的镜像(LCTT 译注:源代码已经提供)。在撰写本文时,它仅[可在 AWS 上预览][5]。 + +你对此有何看法?Amazon 会从 Bottlerocket 获得什么?如果你以前使用过 CoreOS 之类的软件,你会切换到 Bottlerocket 么? + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/bottlerocket-linux/ + +作者:[Abhishek Prakash][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://itsfoss.com/author/abhishek/ +[b]: https://github.com/lujun9972 +[1]: https://aws.amazon.com/blogs/aws/bottlerocket-open-source-os-for-container-hosting/ +[2]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/03/botlerocket-logo.png?ssl=1 +[3]: https://www.redhat.com/en/topics/containers/whats-a-linux-container +[4]: https://www.linode.com/ +[5]: https://aws.amazon.com/bottlerocket/ +[6]: https://www.opencontainers.org/ +[7]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/03/BottleRocket.png?ssl=1 +[8]: https://github.com/bottlerocket-os/bottlerocket-admin-container +[9]: https://itsfoss.com/red-hat-acquires-coreos/ +[10]: https://itsfoss.com/ibm-red-hat-acquisition/ +[11]: https://getfedora.org/en/coreos/ +[12]: https://github.com/bottlerocket-os/bottlerocket diff --git a/published/202003/20200312 How to write effective documentation for your open source project.md b/published/202003/20200312 How to write effective documentation for your open source project.md new file mode 100644 index 0000000000..1635591917 --- /dev/null +++ b/published/202003/20200312 How to write effective documentation for your open source project.md @@ -0,0 +1,104 @@ +[#]: collector: (lujun9972) +[#]: translator: (HankChow) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12052-1.html) +[#]: subject: (How to write effective documentation for your open source project) +[#]: via: (https://opensource.com/article/20/3/documentation) +[#]: author: (Kevin Xu https://opensource.com/users/kevin-xu) + +如何为你的开源项目编写实用的文档 +====== + +> 一份优质的文档可以让很多用户对你的项目路人转粉。 + +![](https://img.linux.net.cn/data/attachment/album/202003/29/215343srdknc1o8kplbu8z.jpg) + +好的代码很多时候并不代表一切。或许你能用最精巧的代码解决了世界上最迫切需要解决的问题,但如果你作为一个开源开发者,没能用准确的语言将你的作品公之于世,你的代码也只能成为沧海遗珠。因此,技术写作和文档编写是很重要的技能。 + +一般来说,项目中的文档是最受人关注的部分,很多用户会通过文档来决定自己是否应该对某个项目开始学习或研究。所以,我们不能忽视技术写作和文档编写的工作,尤其要重点关注其中的“入门Getting Started”部分,这会对你项目的发展起到关键性的作用。 + +对于很多人来说,写作是一件令人厌烦甚至恐惧的事情。我们这些工程师出身的人,更多学习的是“写代码”而不是学习“为代码写文档”。不少人会把英语作为自己的第二语言或者第三语言,他们可能会对英语写作感到不自信甚至害怕(我的母语是汉语,英语是作为我的第二语言学习的,所以我也能感受到这种痛苦)。 + +但如果你希望自己的项目能在全球范围内产生一定的影响力,英语就是你必须使用的语言,这是一个无法避免的现实。但不必害怕,我在写这篇文章的时候就考虑到了这些可能带来的挑战,并给出了我的一些建议。 + +### 五条有用的写作建议 + +这五条建议你马上就可以用起来,尽管看起来似乎有些浅显,但在技术写作时却经常被忽视。 + +1. **使用主动语态**:感受一下[主动语态][2]下的“你可以这样更改配置(You can change these configurations by...)”和被动语态下的“配置可以这样更改(These configurations can be changed by…)”有什么不同之处。 +2. **使用简洁明了的句子**:可以借助 [Hemingway App][3] 或者 [Grammarly][4] 这样的工具,尽管它们并不开源。 +3. **保持条理性**:你可以在文档中通过写标题、划重点、引链接等方式,把各类信息划分为不同的部分,避免将所有内容都杂糅在一大段冗长的文字当中。 +4. **提高可读性**:除了单纯的文字之外,运用图表也是从多种角度表达的手段之一。 +5. **注意拼写和语法**:必须记得检查文档中是否有拼写错误或者语法错误。 + +只要在文档的写作和编辑过程中应用到这些技巧,你就能够和读者建立起沟通和信任。 + +* **高效沟通**:对于工程师们来说,阅读长篇大论的冗长文字,还不如去看小说。在阅读技术文档时,他们总是希望能够从中快速准确地获取到有用的信息。因此,技术文档的最佳风格应该是精简而有效的,不过这并不代表文档中不能出现类似幽默、emoji 甚至段子这些东西,这些元素可以当你的文档更有个性、更使人印象深刻。当然,具体的实现方式就因人而异了 +* **建立信任**:你需要取得文档读者们的信任,这在一个项目的前期尤为重要。读者对你的信任除了来源于你代码的质量,还跟你文档编写的质量有关。所以你不仅要打磨代码,还要润色好相关的文档,这也是上面第 5 点建议拼写和语法检查的原因。 + +### 从编写“入门”文档开始 + +现在,最需要花费功夫的应该就是“入门”部分了,这是一篇技术文档最重要的部分,[二八定律][5]在这里得到了充分体现:访问一个项目的大部分流量都会落在项目文档上,而访问项目文档的大部分流量则会落在文档的“入门”部分中。因此,如果文档的“入门”部分写得足够好,项目就会吸引到很多用户,反之,用户会对你的项目敬而远之。 + +那么如何写好“入门”部分呢?我建议按照以下三步走: + +1. **任务化**:入门指南应该以任务为导向。这里的任务指的是对于开发者来说可以完成的离散的小项目,而不应该包含太多涉及到体系结构、核心概念等的抽象信息,因此在“入门”部分只需要提供一个简单明了的概述就可以了。也不要在“入门”部分大谈这个项目如何优秀地解决了问题,这个话题可以放在文档中别的部分进行说明。总而言之,“入门”部分最好是给出一些主要的操作步骤,这样显得开门见山。 +2. **30 分钟内能够完成**:这一点的核心是耗时尽可能短,不宜超过 30 分钟,这个时间上限是考虑到用户可能对你的项目并不了解。这一点很重要,大部分愿意浏览文档的人都是有技术基础的,但对你的项目也仅仅是一知半解。首先让这些读者尝试进行一些相关操作,在收到一定效果后,他们才会愿意花更多时间深入研究整个项目。因此,你可以从耗时这个角度来评估你的文档“入门”部分有没有需要改进之处。 +3. **有意义的任务**:这里“有意义”的含义取决于你的开源项目。最重要的是认真思考并将“入门”部分严格定义为一项任务,然后交给你的读者去完成。这个项目的价值应该在这项有意义的任务中有所体现,不然读者可能会感觉这是一个浪费时间的行为。 + +提示:假如你的项目是一个分布式数据库,那么达到“整个集群在某些节点故障的情况下可以不中断地保持可用”的目标就可以认为是“有意义”的;假如你的项目是一个数据分析工具或者是商业智能工具,“有意义”的目标也可以是“加载数据后能快速生成多种可视化效果的仪表板”。总之,无论你的项目需要达到什么“有意义”的目标,都应该能在笔记本电脑上本地快速实现。 + +[Linkerd 入门][6]就是一个很好的例子。Linkerd 是一个开源的 Kubernetes 服务网格Service Mesh,当时我对 Kubernetes 了解并不多,也不熟悉服务网格。但我在自己的笔记本电脑上很轻松地就完成了其中的任务,同时也加深了对服务网格的理解。 + +上面提到的三步过程是一个很有用的框架,对一篇文档“入门”部分的设计和量化评估很有帮助。今后你如果想将你的[开源项目产品化][7],这个框架还可能对实现价值的时间time-to-value产生影响。 + +### 其它核心部分 + +认真写好“入门”部分之后,你的文档中还需要有这五个部分:架构设计、生产环境使用指导、使用案例、参考资料以及未来展望,这五个部分在一份完整的文档中是必不可少的。 + +* **架构设计**:这一部分需要深入探讨整个项目架构设计的依据,“入门”部分中那些一笔带过的关键细节就应该在这里体现。在产品化过程中,这个部分将会是[产品推广计划][8]的核心,因此通常会包含一些可视化呈现的内容,期望的效果是让更多用户长期参与到项目中来。 +* **生产环境使用指导**:对于同一个项目,在生产环境中部署比在笔记本电脑上部署要复杂得多。因此,指导用户认真使用就尤为重要。同时,有些用户可能对项目很感兴趣,但对生产环境下的使用有所顾虑,而指导和展示的过程则正好能够吸引到这类潜在的用户。 +* **使用案例**:社会认同social proof的力量是有目共睹的,所以很有必要列出正在生产环境使用这个项目的其他用户,并把这些信息摆放在显眼的位置。这个部分的浏览量甚至仅次于“入门”部分。 +* **参考资料**:这个部分是对项目的一些详细说明,让用户得以进行详细的研究以及查阅相关信息。一些开源作者会在这个部分事无巨细地列出项目中的每一个细节和边缘情况edge case,这种做法可以理解,但不推荐在项目初期就在这个部分花费过多的时间。你可以采取更折中的方式,在质量和效率之间取得平衡,例如提供一些相关社区的链接、Stack Overflow 上的标签或单独的 FAQ 页面。 +* **未来展望**:你需要制定一个简略的时间表,规划这个项目的未来发展方向,这会让用户长期保持兴趣。尽管项目在当下可能并不完美,但要让用户知道你仍然有完善这个项目的计划。这个部分也能让整个社区构建一个强大的生态,因此还要向用户提供表达他们对未来展望的看法的交流区。 + +以上这几个部分或许还没有在你的文档中出现,甚至可能会在后期才能出现,尤其是“使用案例”部分。尽管如此,还是应该在文档中逐渐加入这些部分。如果用户对“入门”部分已经感觉良好,那以上这几个部分将会提起用户更大的兴趣。 + +最后,请在“入门”部分、README 文件或其它显眼的位置注明整个项目所使用的许可证。这个细节会让你的项目更容易通过最终用户的审核。 + +### 花 20% 的时间写作 + +一般情况下,我建议把整个项目 10% 到 20% 的时间用在文档写作上。也就是说,如果你是全职进行某一个项目的,文档写作需要在其中占半天到一天。 + +再细致一点,应该将写作纳入到常规的工作流程中,这样它就不再是一件孤立的琐事,而是日常的事务。文档写作应该随着工作进度同步进行,切忌将所有写作任务都堆积起来最后完成,这样才可以帮助你的项目达到最终目标:吸引用户、获得信任。 + +* * * + +*特别鸣谢云原生计算基金会的布道师 [Luc Perkins][9] 给出的宝贵意见。* + +*本文首发于 [COSS Media][10] 并经许可发布。* + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/3/documentation + +作者:[Kevin Xu][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/kevin-xu +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/osdc-docdish-typewriter-pink.png?itok=OXJBtyYf (A pink typewriter) +[2]: https://www.grammar-monster.com/glossary/active_voice.htm +[3]: http://www.hemingwayapp.com/ +[4]: https://www.grammarly.com/ +[5]: https://en.wikipedia.org/wiki/Pareto_principle +[6]: https://linkerd.io/2/getting-started/ +[7]: https://opensource.com/article/19/11/products-open-source-projects +[8]: https://opensource.com/article/20/2/product-marketing-open-source-project +[9]: https://twitter.com/lucperkins +[10]: https://coss.media/open-source-documentation-technical-writing-101/ diff --git a/published/202003/20200313 6 Best AUR (Arch User Repository) Helpers for Arch Linux.md b/published/202003/20200313 6 Best AUR (Arch User Repository) Helpers for Arch Linux.md new file mode 100644 index 0000000000..0a49142c98 --- /dev/null +++ b/published/202003/20200313 6 Best AUR (Arch User Repository) Helpers for Arch Linux.md @@ -0,0 +1,215 @@ +[#]: collector: (lujun9972) +[#]: translator: (hkurj) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12019-1.html) +[#]: subject: (6 Best AUR (Arch User Repository) Helpers for Arch Linux) +[#]: via: (https://www.2daygeek.com/best-aur-arch-user-repository-helpers-arch-linux-manjaro/) +[#]: author: (Magesh Maruthamuthu https://www.2daygeek.com/author/magesh/) + +6 个用于 Arch Linux 的最佳 AUR 助手 +====== + +![](https://img.linux.net.cn/data/attachment/album/202003/21/082920kxdmlwkk7xx7llpw.jpeg) + +Arch Linux 是一款 Linux 发行版,主要由针对 x86-64 微处理器计算机的二进制软件包组成。Arch Linux 使用的是滚动发布模型,这种模式会频繁的给应用程序交付更新。它使用名为 [pacman][1] 的软件包管理器,可以用来安装、删除和更新软件包。 + +由于 Arch Linux 是为有经验的用户构建的,建议新手在使用过其他 Linux 后再来尝试。 + +### 什么是 AUR(Arch 用户软件仓库)? + +[Arch 用户软件仓库][2] 通常称为 AUR,是给 Arch 用户的基于社区的软件存储库。 + +根据软件包在 AUR 社区的流行程度,用户编译的软件包会进入到 Arch 的官方存储库。 + +### 什么是 AUR 助手? + +[AUR 助手][3]是一个包装程序,允许用户从 AUR 存储库安装软件包,而无需手动干预。 + +很多用例实现了自动化,比如包搜索、解决依赖关系、检索和构建 AUR 包、Web 内容检索和 AUR 包提交之类。 + +以下列出了 6 种最佳的 AUR 助手: + +* Yay(Yet another Yogurt) +* Pakku +* Pacaur +* Pikaur +* Trizen +* Aura + +### 1)Yay(Yet another Yogurt) + +[Yay][4] 是 Arch Linux 下基于 CLI 的最佳 AUR 助手,使用 Go 语言编写。Yay 是基于 yaourt、apacman 和 pacaur 设计的。 + +这是最合适推荐给新手的 AUR 助手。类似于 Pacman,其使用方法和 `pacman` 中的命令和选项很相似,可以让用户在搜索过程中找到匹配的软件包提供程序,并进行选择。 + +#### 如何安装 yay + +依次运行以下命令以在 Arch Linux 系统上安装。 + +``` +$ sudo pacman -S git go base-devel +$ git clone https://aur.archlinux.org/yay.git +$ cd yay +$ makepkg -si +``` + +#### 如何使用 yay + +`yay` 语法与 `pacman` 相同,使用以下命令安装软件包。 + +``` +$ yay -s arch-wiki-man +``` + +### 2)Pakku + +[Pakku][5] 可以被视为一个初始阶段的 Pacman。它是一个包装程序,可以让用户从 AUR 中搜索或安装软件包。 + +它在删除依赖项方面做得不错,并且还允许通过克隆 PKGBUILD 来安装软件包。 + +#### 如何安装 Pakku + +要在 Arch Linux 的系统上安装 Pakku,请依次运行以下命令。 + +``` +$ sudo pacman -S git base-devel +$ git clone https://aur.archlinux.org/pakku.git +$ cd pakku +$ makepkg -si +``` + +#### 如何使用 Pakku + +`pakku` 语法与 `pacman` 相同,使用以下命令安装软件包。 + +``` +$ pakku -s dropbox +``` + +### 3)Pacaur + +另一个基于 CLI 的 AUR 助手,可帮助减少用户与提示符的交互。 + +[Pacaur][6] 专为倾向于自动化重复任务的高级用户而设计。用户需要熟悉 `makepkg` 及其配置的 AUR 手动构建过程。 + +#### 如何安装 Pacaur + +要在 Arch Linux 的系统上安装 Pakku,请依次运行以下命令。 + +``` +$ sudo pacman -S git base-devel +$ git clone https://aur.archlinux.org/pacaur.git +$ cd pacaur +$ makepkg -si +``` + +#### 如何使用 Pacaur + +`pacaur` 语法与 `pacman` 相同,使用以下命令安装软件包。 + +``` +$ pacaur -s spotify +``` + +### 4)Pikaur + +[Pikaur][7] 是具有最小依赖性的 AUR 助手,可以一次查看所有 PKGBUILD,无需用户交互即可全部构建。 + +Pikaur 将通过控制 `pacman` 命令来告知 Pacman 要执行的下一个步骤。 + +#### 如何安装 Pikaur + +要在 Arch Linux 的系统上安装 Pakku,请依次运行以下命令。 + +``` +$ sudo pacman -S git base-devel +$ git clone https://aur.archlinux.org/pikaur.git +$ cd pikaur +$ makepkg -fsri +``` + +#### 如何使用 Pikaur + +`pikaur` 语法与 `pacman` 相同,使用以下命令安装软件包。 + +``` +$ pacaur -s spotify +``` + +### 5)Trizen + +[Trizen][8] 是用 Perl 编写的基于命令行的 AUR 轻量级包装器。这个面向速度的 AUR 助手,它允许用户搜索、安装软件包,还允许阅读 AUR 软件包注释。 + +支持编辑文本文件,并且输入/输出使用 UTF-8。内置与 `pacman` 的交互功能。 + +#### 如何安装 Trizen + +要在 Arch Linux 的系统上安装 Trizen,请依次运行以下命令。 + +``` +$ sudo pacman -S git base-devel +$ git clone https://aur.archlinux.org/trizen.git +$ cd trizen +$ makepkg -si +``` + +#### 如何使用 Trizen + +`trizen` 语法与 `pacman` 相同,使用以下命令安装软件包。 + +``` +$ pacaur -s google-chrome +``` + +### 6)Aura + +[Aura][9] 是用 Haskell 编写的,是用于 Arch Linux 和 AUR 的安全的多语言包管理器。它支持许多Pacman 操作和子选项,可轻松进行开发并编写精美的代码。 + +它可以自动从 AUR 安装软件包。使用 Aura 时,用户通常会在系统升级方面遇到一些困难。 + +#### 如何安装 Aura + +要在 Arch Linux 的系统上安装 Pakku,请依次运行以下命令。 + +``` +$ sudo pacman -S git base-devel +$ git clone https://aur.archlinux.org/aura.git +$ cd aura +$ makepkg -si +``` + +#### 如何使用 Aura + +`aura` 语法与 `pacman` 相同,使用以下命令安装软件包。 + +``` +$ pacaur -s android-sdk +``` + +### 结论 + +用户可以凭借这些分析在上述 6 个 AUR 助手中进行选择。 + +-------------------------------------------------------------------------------- + +via: https://www.2daygeek.com/best-aur-arch-user-repository-helpers-arch-linux-manjaro/ + +作者:[Magesh Maruthamuthu][a] +选题:[lujun9972][b] +译者:[hkurj](https://github.com/hkurj) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://www.2daygeek.com/author/magesh/ +[b]: https://github.com/lujun9972 +[1]: https://www.2daygeek.com/pacman-command-examples-manage-packages-arch-linux-system/ +[2]: https://wiki.archlinux.org/index.php/Arch_User_Repository +[3]: https://wiki.archlinux.org/index.php/AUR_helpers +[4]: https://github.com/Jguer/yay +[5]: https://github.com/kitsunyan/pakku +[6]: https://github.com/E5ten/pacaur +[7]: https://github.com/actionless/pikaur +[8]: https://github.com/trizen/trizen +[9]: https://github.com/fosskers/aura diff --git a/published/202003/20200313 GNOME 3.36 Released With Visual - Performance Improvements.md b/published/202003/20200313 GNOME 3.36 Released With Visual - Performance Improvements.md new file mode 100644 index 0000000000..f193b4d245 --- /dev/null +++ b/published/202003/20200313 GNOME 3.36 Released With Visual - Performance Improvements.md @@ -0,0 +1,114 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12030-1.html) +[#]: subject: (GNOME 3.36 Released With Visual & Performance Improvements) +[#]: via: (https://itsfoss.com/gnome-3-36-release/) +[#]: author: (Ankush Das https://itsfoss.com/author/ankush/) + +GNOME 3.36 发布,对视觉和性能进行了改进 +====== + +![](https://img.linux.net.cn/data/attachment/album/202003/23/151837oglshll1b7kjj8jg.jpg) + +在 [GNOME 3.34][1] 发布 6 个月后,最新版本的 GNOME 3.36 代号为 “Gresik” 也最终发布了。不仅是添加了功能,GNOME 3.36 还改进了许多我们需要的功能。 + +在本文中,我将重点介绍 GNOME 新版本的主要更改。 + +### GNOME 3.36 的关键改进 + +如果你想快速了解发生了什么变化,可以看以下官方视频: + +[视频][2] + +现在,让我分别重点介绍最新版本中的更改: + +#### GNOME Shell 扩展应用 + +你可以通过专门的“扩展”程序轻松管理 GNOME Shell 的扩展。 + +![][3] + +因此,你可以使用该程序更新、配置、删除或禁用现有扩展。 + +#### 切换到请勿打扰(DND) + +![][4] + +你可能已经在 Pop!\_OS 或其他 Linux 发行版中注意到了它。 + +但是,GNOME 3.36 现在在通知弹出区域中实现了 DND 切换。除非你将其关闭,否则不会收到任何通知。 + +#### 锁屏改进 + +![][5] + +在新版本中,锁定屏幕在输入凭据之前没有额外的动画。取而代之会在登录屏幕直接打招呼。 + +另外,为了提升一致性,锁屏背景将是墙纸的模糊版本。 + +总的来说,对锁屏的改进旨在使之更易于访问,同时改善其外观/感觉。 + +#### 视觉变化 + +![][6] + +包含了一些明显的新增,这些设计更改改善了 GNOME 3.36 的总体外观。 + +从图标的重新设计到文件夹和系统对话框,进行了许多小的改进以增强 GNOME 3.36 的用户体验。 + +此外,设置应用已进行了调整,通过微小的界面重新设计,使得选项访问更加容易。 + +#### 主要性能改进 + +GNOME 声称,此更新还提升了 GNOME 桌面的性能。 + +当使用装有 GNOME 3.36 的发行版时,你会注意到在性能上有明显的不同。无论是动画、重新设计还是微小的调整,对于 GNOME 3.36 所做的一切都会对用户的性能产生积极影响。 + +#### 其他更改 + +除了上述关键更改之外,还有很多其他改进,例如: + +* 时钟重新设计 +* 用户文档更新 +* GNOME 安装助手改进 + +还有许多其他更改。你可以查看[官方发布说明][7]了解更多信息。 + +### 如何获取 GNOME 3.36? + +即使 GNOME 3.36 已正式发布。Linux 发行版可能需要一段时间才能让你轻松升级 GNOME 体验。 + +[Ubuntu 20.04 LTS][8] 将提供最新版本 GNOME。你可以等待。 + +其他[流行的 Linux 发行版][9],如 Fedora、OpenSuse、Pop!\_OS,应该会很快包含 GNOME 3.36。[Arch Linux][10] 已升级到 GNOME 3.36。 + +我建议你耐心等待,直到获得发行版本的更新。不过,你可以查看[源代码][11]或尝试即将发布的流行发行版的开发版本,这些发行版可能有 GNOME 3.36。 + +你如何看待 GNOME 3.36?在下面的评论中让我知道你的想法。 + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/gnome-3-36-release/ + +作者:[Ankush Das][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://itsfoss.com/author/ankush/ +[b]: https://github.com/lujun9972 +[1]: https://itsfoss.com/gnome-3-34-release/ +[2]: https://img.linux.net.cn/static/video/Introducing%20GNOME%203.36%20-%20%27Gresik%27-ae2D4aWTsXM.mp4 +[3]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/03/extensions-gnome.jpg?ssl=1 +[4]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/03/dnd-gnome.jpg?ssl=1 +[5]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/03/gnome-lockscreen.jpg?ssl=1 +[6]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/03/gnome-settings.jpg?ssl=1 +[7]: https://help.gnome.org/misc/release-notes/3.36/ +[8]: https://itsfoss.com/ubuntu-20-04-release-features/ +[9]: https://itsfoss.com/best-linux-distributions/ +[10]: https://www.archlinux.org/ +[11]: https://gitlab.gnome.org/GNOME diff --git a/published/202003/20200313 How to Change MAC Address in Linux.md b/published/202003/20200313 How to Change MAC Address in Linux.md new file mode 100644 index 0000000000..5e8d12da57 --- /dev/null +++ b/published/202003/20200313 How to Change MAC Address in Linux.md @@ -0,0 +1,173 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12008-1.html) +[#]: subject: (How to Change MAC Address in Linux) +[#]: via: (https://itsfoss.com/change-mac-address-linux/) +[#]: author: (Dimitrios Savvopoulos https://itsfoss.com/author/itsfoss/) + +如何在 Linux 中更改 MAC 地址 +====== + +在向你展示如何在 Linux 中更改 MAC 地址之前,让我们首先讨论为什么要更改它。 + +可能有几个原因。也许你不希望在公共网络上公开你的实际 [MAC 地址][1](也称为物理地址)?还有可能是网络管理员可能已在路由器或防火墙中阻止了特定的 MAC 地址。 + +一个实用的“好处”是某些公共网络(例如机场 WiFi)允许在有限的时间内免费上网。如果你还想继续使用,那么伪造 Mac 地址可能会欺骗网络,让它认为是一台新设备。这也是一个有名的原因。 + +![](https://img.linux.net.cn/data/attachment/album/202003/18/120702qdjyb7hvyj7bsrj7.jpg) + +我将展示更改 MAC 地址(也称为欺骗/伪造 MAC 地址)的步骤。 + +### 在 Linux 中更改 MAC 地址 + +让我们一步步来: + +#### 查找你的 MAC 地址和网络接口 + +让我们找出一些[关于 Linux 中网卡的细节][3]。使用此命令获取网络接口详细信息: + +``` +ip link show +``` + +在输出中,你将看到一些详细信息以及 MAC 地址: + +``` +1: lo: mtu 65536 qdisc noqueue state UNKNOWN mode DEFAULT group default qlen 1000 + link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00 +2: eno1: mtu 1500 qdisc fq_codel state DOWN mode DEFAULT group default qlen 1000 + link/ether 94:c6:f8:a7:d7:30 brd ff:ff:ff:ff:ff:ff +3: enp0s31f6: mtu 1500 qdisc noqueue state UP mode DORMANT group default qlen 1000 + link/ether 38:42:f8:8b:a7:68 brd ff:ff:ff:ff:ff:ff +4: docker0: mtu 1500 qdisc noqueue state DOWN mode DEFAULT group default + link/ether 42:02:07:8f:a7:38 brd ff:ff:ff:ff:ff:ff +``` + +如你所见,在这里,我的网络接口称为 `enp0s31f6`,MAC 地址为 `38:42:f8:8b:a7:68`。 + +你可能需要在安全的地方记录下来,以便稍后还原到该原始 MAC 地址。 + +现在你可以继续更改 MAC 地址。 + +注意! + +如果在当前使用的网络接口上执行此操作,那么可能会中断你的网络连接。因此,请在其他网卡上尝试使用此方法,或者准备重启网络。 + +#### 方法 1:使用 Macchanger 更改 MAC 地址 + +![][4] + +[Macchanger][5] 是查看、修改和操作网卡 MAC 地址的简单程序。它几乎在所有 GNU/Linux 操作系统中都可用,你可以使用发行版的包安装程序进行安装。 + +在 Arch Linux 或 Manjaro 上: + +``` +sudo pacman -S macchanger +``` + +在 Fedora、CentOS 和 RHEL 上: + +``` +sudo dnf install macchanger +``` + +在 Debian、Ubuntu、Linux Mint、Kali Linux 上: + +``` +sudo apt install macchanger +``` + +**重要!**系统会要求你选择是否应将 `macchanger` 设置为在每次启动或关闭网络设备时自动运行。每当你接到网线或重启 WiFi 时,它都会提供一个新的 MAC 地址。 + +![Not a good idea to run it automatically][6] + +我建议不要自动运行它,除非你确实需要每次更改 MAC 地址。因此,选择“No”(按 `Tab` 键),然后按回车键继续。 + +**如何使用 Macchanger 更改 MAC 地址** + +你还记得网络接口名称吗?你在前面的步骤中获得了它。 + +现在,要将随机 MAC 地址分配给该网卡,请使用: + +``` +sudo macchanger -r enp0s31f6 +``` + +更改 MAC 后,使用以下命令进行验证: + +``` +ip addr +``` + +现在你将看到已经伪造 MAC。 + +要将 MAC 地址更改为特定值,请使用以下命令指定自定义 MAC 地址: + +``` +macchanger --mac=XX:XX:XX:XX:XX:XX +``` + +其中 XX:XX:XX:XX:XX:XX 是你要更改的新 MAC。 + +最后,要将 MAC 地址恢复为其原始硬件值,请运行以下命令: + +``` +macchanger -p enp0s31f6 +``` + +但是,你不必如此。重启系统后,更改将自动丢失,并且实际的 MAC 地址将再次恢复。 + +你可以随时查看手册页以获取更多详细信息。 + +#### 方法 2:使用 iproute2 更改 Mac 地址(中级知识) + +我建议你使用 macchanger,但如果你不想使用它,那么可以使用另一种方法在 Linux 中更改 MAC 地址。 + +首先,使用以下命令关闭网卡: + +``` +sudo ip link set dev enp0s31f6 down +``` + +接下来,使用以下命令设置新的 MAC: + +``` +sudo ip link set dev enp0s31f6 address XX:XX:XX:XX:XX:XX +``` + +最后,使用以下命令重新打开网络: + +``` +sudo ip link set dev enp0s31f6 up +``` + +现在,验证新的 MAC 地址: + +``` +ip link show enp0s31f6 +``` + +就是这些了。你已经成功地在 Linux 中修改了 MAC 地址。敬请期待 FOSS 更多有关 Linux 教程和技巧的文章。 + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/change-mac-address-linux/ + +作者:[Dimitrios Savvopoulos][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://itsfoss.com/author/itsfoss/ +[b]: https://github.com/lujun9972 +[1]: https://en.wikipedia.org/wiki/MAC_address +[2]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/03/airport_wifi_meme.jpg?ssl=1 +[3]: https://itsfoss.com/find-network-adapter-ubuntu-linux/ +[4]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/03/Change_MAC_Address_Linux.jpg?ssl=1 +[5]: https://github.com/alobbs/macchanger +[6]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/03/configuring_mcchanger.jpg?ssl=1 +[7]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/03/Dimitrios.jpg?ssl=1 diff --git a/published/202003/20200314 How to Install Netbeans on Ubuntu and Other Linux.md b/published/202003/20200314 How to Install Netbeans on Ubuntu and Other Linux.md new file mode 100644 index 0000000000..95cd74089e --- /dev/null +++ b/published/202003/20200314 How to Install Netbeans on Ubuntu and Other Linux.md @@ -0,0 +1,98 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12017-1.html) +[#]: subject: (How to Install Netbeans on Ubuntu and Other Linux) +[#]: via: (https://itsfoss.com/install-netbeans-ubuntu/) +[#]: author: (Community https://itsfoss.com/author/itsfoss/) + +如何在 Ubuntu 和其他 Linux 上安装 Netbeans +====== + +> 在本教程中,你将学习在 Ubuntu 和其他 Linux 发行版上安装 Netbeans IDE 的各种方法。 + +[NetBeans][1] 是一个开源集成开发环境,具有良好的跨平台支持。此工具已被 Java 和 C/C++ 开发社区广泛认可。 + +开发环境相当灵活。你可以配置它以支持各种开发。实际上,你可以用它来开发 Web、桌面和移动应用,而无需离开此平台。这太神奇了,不是吗?除此之外,用户可以添加许多已知语言,如 [PHP][2]、C、C++、HTML、[Ajax][3]、JavaScript、JSP、Ruby on Rails 等。 + +如果你正在了解如何在 Linux 上安装 Netbeans,那么有几种方法可以做到。我编写本教程主要是为了 Ubuntu,但一些安装方法也适用于其他发行版。 + +* [使用 apt 在 Ubuntu 上安装 Netbeans][4]:适用于 Ubuntu 和基于 Ubuntu 的发行版,但通常**它是旧版的 Netbeans** +* [使用 Snap 在 Ubuntu 上安装 Netbeans][5]:适用于已启用 Snap 包支持的任何 Linux 发行版 +* [使用 Flatpak 安装 Netbeans] [6]:适用于所有支持 Flatpak 包的 Linux 发行版 + +### 使用 Apt 包管理器在 Ubuntu 上安装 Netbeans IDE + +如果在 Ubuntu 软件中心搜索 Netbeans,你将找到两个版本的 Netbeans。Apache Netbeans 是 snap 版本,大小较大,但提供了最新的 Netbeans。 + +只需单击一下即可安装它。无需打开终端。是最简单的方法。 + +![Apache Netbeans in Ubuntu Software Center][7] + +你也可以选择使用 `apt` 命令,但使用 `apt` 时,你无法获得最新的 Netbeans。例如,在编写本教程时,Ubuntu 18.04 中 Apt 提供 Netbeans 10,而 Snap 有最新的 Netbeans 11。 + +如果你是 [apt 或 apt-get][8] 的粉丝,那么可以[启用 universe 仓库][9],并在终端中使用此命令安装 Netbeans: + +``` +sudo apt install netbeans +``` + +### 使用 Snap 在任何 Linux 发行版上安装 Netbeans IDE + +![][10] + +Snap 是一个通用包管理器,如果[发行版上启用了 Snap][11],那么可以使用以下命令安装它: + +``` +sudo snap install netbeans --classic +``` + +此过程可能需要一些时间才能完成,因为总下载大小约为 1 GB。完成后,你将在应用程序启动器中看到它。 + +你不仅可以通过 Snap 获取最新的 Netbeans,已安装的版本将自动更新到较新版本。 + +### 使用 Flatpak 安装 Netbeans + +[Flatpak][12] 是另一个类似 Snap 的包安装器。默认情况下,某些发行版支持 Flatpak,在其他发行版上你可以[启用 Flatpak 支持][13]。 + +发行版支持 Flatpak 后,你可以使用以下命令安装 Netbeans: + +``` +flatpak install flathub org.apache.netbeans +``` + +另外,你可以下载源码并自己编译。 + +- [下载 Netbeans][14] + +希望你使用了上面其中一个方法在你的 Ubuntu 上安装了 Netbeans。但你使用的是哪个方法?有遇到问题么?让我们知道。 + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/install-netbeans-ubuntu/ + +作者:[Srimanta Koley][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://itsfoss.com/author/itsfoss/ +[b]: https://github.com/lujun9972 +[1]: https://netbeans.org/ +[2]: https://www.php.net/ +[3]: https://en.wikipedia.org/wiki/Ajax_(programming) +[4]: tmp.ZNFNEC210y#apt +[5]: tmp.ZNFNEC210y#snap +[6]: tmp.ZNFNEC210y#flatpak +[7]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/03/apache-netbeans-ubuntu-software-center.jpg?ssl=1 +[8]: https://itsfoss.com/apt-vs-apt-get-difference/ +[9]: https://itsfoss.com/ubuntu-repositories/ +[10]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/03/Install_Netbeans_Linux.jpg?ssl=1 +[11]: https://itsfoss.com/install-snap-linux/ +[12]: https://flatpak.org/ +[13]: https://itsfoss.com/flatpak-guide/ +[14]: https://netbeans.apache.org/download/index.html +[15]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/03/srimanta.jpg?ssl=1 diff --git a/published/202003/20200316 Connect your Google Drive to Fedora Workstation.md b/published/202003/20200316 Connect your Google Drive to Fedora Workstation.md new file mode 100644 index 0000000000..134703d0dc --- /dev/null +++ b/published/202003/20200316 Connect your Google Drive to Fedora Workstation.md @@ -0,0 +1,67 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12037-1.html) +[#]: subject: (Connect your Google Drive to Fedora Workstation) +[#]: via: (https://fedoramagazine.org/connect-your-google-drive-to-fedora-workstation/) +[#]: author: (Paul W. Frields https://fedoramagazine.org/author/pfrields/) + +将你的 Google Drive 连接到 Fedora 工作站 +====== + +![][1] + +有大量的云服务可用于存储重要文档。Google Drive 无疑是最受欢迎的之一。它提供了一组相应的应用程序,例如文档,表格和幻灯片来创建内容。但是,你也可以在 Google Drive 中存储任意内容。本文向你展示如何将其连接到 [Fedora 工作站][2]。 + +### 添加帐户 + +Fedora 工作站可在安装后首次启动或者之后的任何时候添加一个帐户。要在首次启动期间添加帐户,请按照提示进行操作。其中包括选择添加一个帐户: + +![][3] + +选择 Google,然后会出现一个登录提示,请使用你的 Google 帐户信息登录。 + +![][4] + +请注意,此信息仅传输给 Google,而不传输给 GNOME 项目。下一个页面要求你授予访问权限,这是必需的,以便系统桌面可以与 Google 进行交互。向下滚动查看访问请求,然后选择“允许”继续。 + +你会在移动设备和 Gmail 中收到有关新设备(系统)访问 Google 帐户的通知。这是正常现象。 + +![][5] + +如果你在初次启动时没有执行此操作,或者需要重新添加帐户,请打开“设置”,然后选择“在线账户”来添加帐户。可以通过顶部栏右侧的下拉菜单(“齿轮”图标)或打开“概览”并输入“settings”来使用它。接着和上面一样。 + +### 在 Google Drive 中使用“文件”应用 + +打开“文件”应用(以前称为 “nautilus”)。“文件”应用可以通过左侧栏访问。在列表中找到你的 Google 帐户。 + +当你选择帐户后,“文件”应用会显示你的 Google Drive 的内容。你可以使用 Fedora 工作站的本地应用打开某些文件,例如声音文件或 [LibreOffice][6] 兼容文件(包括 Microsoft Office 文档)。其他文件(例如 Google 文档、表格和幻灯片等 Google 应用文件)将使用浏览器和相应的应用打开。 + +请记住,如果文件很大,将需要一些时间才能通过网络接收文件,你才可以打开它。 + +你还可以复制粘贴 Google Drive 中的文件到连接到 Fedora 工作站的其他存储,或者反之。你还可以使用内置功能来重命名文件、创建文件夹并组织它们。对于共享和其他高级选项,请和平常一样在浏览器中使用 Google Drive。 + +请注意,“文件”应用程序不会实时刷新内容。如果你从其他连接 Google 的设备(例如手机或平板电脑)添加或删除文件,那么可能需要按 `Ctrl+R` 刷新“文件”应用。 + +-------------------------------------------------------------------------------- + +via: https://fedoramagazine.org/connect-your-google-drive-to-fedora-workstation/ + +作者:[Paul W. Frields][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://fedoramagazine.org/author/pfrields/ +[b]: https://github.com/lujun9972 +[1]: https://fedoramagazine.org/wp-content/uploads/2020/03/gdrive-workstation-816x345.jpg +[2]: https://getfedora.org/workstation +[3]: https://fedoramagazine.org/wp-content/uploads/2020/03/firstboot-choices.jpg +[4]: https://fedoramagazine.org/wp-content/uploads/2020/03/firstboot-signin.jpg +[5]: https://fedoramagazine.org/wp-content/uploads/2020/03/firstboot-grantaccess.jpg +[6]: https://fedoramagazine.org/discover-hidden-gems-libreoffice/ +[7]: https://unsplash.com/@beatriz_perez?utm_source=unsplash&utm_medium=referral&utm_content=creditCopyText +[8]: https://unsplash.com/s/photos/office-files?utm_source=unsplash&utm_medium=referral&utm_content=creditCopyText diff --git a/published/202003/20200317 Coronavirus challenges remote networking.md b/published/202003/20200317 Coronavirus challenges remote networking.md new file mode 100644 index 0000000000..9467133c2d --- /dev/null +++ b/published/202003/20200317 Coronavirus challenges remote networking.md @@ -0,0 +1,116 @@ +[#]: collector: (lujun9972) +[#]: translator: (HankChow) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12039-1.html) +[#]: subject: (Coronavirus challenges remote networking) +[#]: via: (https://www.networkworld.com/article/3532440/coronavirus-challenges-remote-networking.html) +[#]: author: (Michael Cooney https://www.networkworld.com/author/Michael-Cooney/) + +新型冠状病毒对远程网络的影响 +====== + +> 由于 COVID-19 的肆虐,IBM、谷歌、亚马逊、AT&T、思科、苹果等公司都争先恐后地为远程办公提供了技术上的支持,这为远程网络带来了不少的压力。 + +![](https://images.idgesg.net/images/article/2018/02/crisis_survival_strategy_disaster_preparedness_readiness_recovery_continuity_plan_thinkstock_600161484-100749343-large.jpg) + +在新型冠状病毒广泛传播的大环境下,很多公司都要求员工留在家中远程办公,远程网络技术因此承受了更大的压力,一些带宽和安全方面的问题也接踵而至。 + +在过去的几十年当中,由于企业的蓬勃发展,远程办公的人数估计增加了 400 多万。而当前疫情流行的背景下,远程办公的需求激增,有望达到一个新的高峰。 + +一家虚拟私有网络Virtual Private Network(缩写:???)提供商 [Atlas][1] 的一份研究表明,在今年 3 月 9 日到 3 月 15 日之间,美国的虚拟私有网络使用量增加了 53%,并且还会继续提高。而在意大利这个疫情爆发比美国早两周的国家,过去一周内的虚拟私有网络使用量甚至增加了 112%。Atlas 虚拟私有网络的首席执行官 Rachel Welch 在一份声明中称,美国的虚拟私有网络使用量在 3 月底预估会达到 150% 的增幅。 + +部分企业正在尝试通过一日测试one-day test来评估远程办公的可行性。据《[芝加哥论坛报][2]》的报道,摩根大通、晨星以及一家数据分析方面的初创公司 Arity 已经通过让员工在家办公一天来测试整个办公系统的稳定性。 + +在政府方面,[美国国家海洋与大气管理局][3]和 NASA 都已经进行或计划进行网络方面的压力测试,评估是否有足够的网络容量足以让上千名工作人员远程办公,以及远程办公可能造成的影响。而放眼整个美国,供职于美国政府部门的员工数量在 [200 万][4]左右。 + +为了避免蜂窝数据网络发生拥堵,美国[联邦通信委员会][5]已批准 T-mobile 临时访问已分配给其它运营商的 600MHz 频段,T-mobile 表示“将使用这个频段让美国人更方便地享受远程医疗、参与远程工作和学习,同时在保持‘物理距离’的情况下保持联系”。 + +- [video](https://youtu.be/-1-ugVx0hVc) + +但也有一些业内人士指出,在一些对蜂窝网络有较强依赖的的场景下,“最后一英里”的网络访问会变得非常拥堵。 + +网络情报公司 ThousandEyes 的主要产品是局域网和广域网性能分析的软件,该公司的产品经理 Alex Cruz Farmer 表示,网络瓶颈在于一些较为偏远的农村地区,因为那些地区的网络基础设施较为薄弱,主要通过微波或蜂窝网络来访问互联网。最大的挑战在于现有的解决方案所能提供的带宽远远不足。 + +Alex Cruz Farmer 还补充道,尽管持续时间不长,但现在的确已经出现一些由于运营商问题或网络负载增加导致的故障现象。 + +AT&T 表示目前已经留意到蜂窝网络使用量的变化,但网络容量并没有作出提高。 + +[AT&T 在一份声明中称][7],在新冠病毒传播最严重的城市中,由于越来越多的人留在了家中远程办公,减少了通勤和人群聚集,很多特定位置和特定时段的蜂窝网络使用量峰值都明显降低了。他们还使用了一些工具对网络带宽进行了统计和监控,通过这些工具,他们可以更直观地了解网络使用情况的趋势,同时获取网络性能和网络容量方面的报告,进而管理整个通信网络。 + +Verison 表示,自从新型冠状病毒疫情爆发以来,尽管在家办公的用户数量大增,但使用的数据量并没有明显的上升。他们在一份声明中称:“Verison 的网络是为满足未来的需求设计建造的,面对各种需求量的增加或使用方式的改变,我们都有充分的准备。虽然这是一次前所未有的社会事件,整个局面也在不断发生改变,但随着不断了解实际需求的变化情况,我们随时可以对网络资源作出调整”。 + +Verison 一直在关注受影响最严重的地区的网络使用情况,并承诺将会与医院、医护人员、政府机构合作,制定网络资源使用的优先级,以满足他们的需求。Verison 还宣布计划在 2020 年将支出在 170 亿至 180 亿美元的基础上再提高 5 亿美元,以实现“加快 Verison 向 5G 过渡并在困难时期帮助支撑经济”的目标。 + +### 企业虚拟私有网络安全问题 + +对于企业来说,数据中心与远程用户之间的网络和安全问题解决起来绝非易事,尤其是使用虚拟私有网络进行远程访问时,来自用户所在住宅网络的访问几乎无法由企业控制。CIMI 公司总裁 Tom Nolle 认为,IT 部门有必要验证这些连接是否符合企业的标准(关于 Tom Nolle 更多关于在家办公的看法,可以查阅[这里][8])。 + +Tom Nolle 认为像 ISP、DNS 和 Wi-Fi 这些常见的家用网络要素都应该作为适合远程办公网络业务认证的一部分。他发现 Google 的 DNS 服务比 ISP 提供的服务更能承受压力,OpenDNS 也是一个很好的选择,这说明用户可以考虑使用其中一种。 + +Tom Nolle 还说,家庭 Wi-Fi 网络的安全性也是一个问题,IT 部门应该要求远程办公的员工提交 Wi-Fi 配置的屏幕截图,以保证使用了正确的加密方式。之所以有这样的想法,是因为他觉得很多远程办公的员工都会绕过企业预设的一些安全措施。 + +DNS 软件公司 BlueCat 的首席战略官 Andrew Wertkin 表示,对一些刚刚开始在家远程办公的员工来说,适当提供相关指导是很有必要的。大部分员工从来没有尝试过在家远程办公,他们或许并不了解安全的重要性。如果员工访问公司网络的时候使用的是个人设备而不是公司设备,就更有可能出现问题。 + +而使用[虚拟私有网络][9]远程办公的人数激增也会为企业带来成本上的挑战。 + +“虚拟私有网络设备并不便宜,如果考虑到计算资源的成本和每个人的均摊成本,迁移到云上的虚拟环境会带来一笔不小的开支,这还不包括每个虚拟私有网络许可证价格的上升”,Alex Cruz Farmer 坦言。 + +在容量方面,随着远程访问量的增加,用于分配 IP 地址的 DHCP 服务也会承受巨大的压力。Andrew Wertkin 指出,如果进行远程连接的设备无法获取到网络地址,则是否具有足够的虚拟私有网络许可证并不重要。企业内部必须对这些风险进行测试,了解其中存在瓶颈的部分,并制定规避这些风险的策略。 + +按照这个思路,企业甚至需要验证数据中心可以用于公开的 SSL 套接字数量,否则也会面临数量不足的风险。 + +微软 Office 365 产品团队的高级程序经理 Paul Collinge 也表达了类似的担忧。他在一篇关于优化 Office 365 员工远程办公流量的[博客][10]中写道,当大量员工在同时接入企业网络时,会对诸如虚拟私有网络集中器、中央网络出口设备(例如代理、DLP)、中央互联网带宽、回程 MPLS 和 NAT 等网络要素产生巨大的压力。最终导致的结果是低下的性能、低下的生产力,以及员工们低下的使用体验。 + +Alex Cruz Farmer 提出,企业很可能需要增加网络上虚拟私有网络集中器的数量,这样就可以让远程用户分布在多个不同的虚拟私有网络端点上,避免产生拥堵。退而求其次,只能在防火墙上把某些端口放开,允许特定应用程序的公开访问,尽管这样有助于提高工作效率,但却降低了整体的安全性。 + +### 虚拟私有网络隧道分割技术有效吗? + +业内人士对隧道分割tunneling split有不同的看法。 + +BlueCat 的 Andrew Wertkin 认为,虚拟私有网络可以使用隧道分割技术,使得仅有需要访问企业内部网络的流量才通过虚拟私有网络隧道访问,其余流量则直接进入互联网。这意味着会有部分流量不受隧道和企业网络内部的安全控制,用户的计算机会暴露在互联网当中,进而导致企业的数据和网络面临安全风险。 + +尽管如此,微软在上周还是建议 IT 管理员使用隧道分割技术以缓解 Office 365 由于大量远程用户涌入导致的拥堵问题。微软在[建议][10]中提供了相关接入点的 URL 和 IP 地址列表,并引导 IT 人员如何按照这个方式将流量路由到 Office 365。 + +按照 Paul Collinge 的说法,虚拟私有网络客户端需要经过配置,才能将流量路由到已标识的 URL/IP/ 端口上,进而为全球的用户提供高性能的服务。 + +Alex Cruz Farmer 认为,在虚拟私有网络使用率上升之后,企业很有必要对网络安全进行一个全面的审查。对于仍然在使用传统网络安全架构的企业来说,应该开始考虑基于云端的网络安全方案了,这不仅可以提升远程办公的性能,还能减少企业对于广域网的使用量。 + +其它相关情况: + +* [FCC][11] 呼吁,宽带提供商应该适当放宽数据传输的限制,电话运营商应该适当免除用户的长途电话费,远程教育提供商应该合作为社会提供远程学习的机会,网络运营商应该优先考虑医院或医疗机构的网络连接需求。对此,AT&T 已经作出了相关的回应和行动。 +* [美国参议员 Mark R. Warner (D-VA)][12] 和其他 17 名参议员致信了 AT&T、CenturyLink、Charter Communications、Comcast、Cox Communications、Sprint、T-Mobile、Verizon 这八家主要 ISP 的首席执行官,呼吁这些公司应该采取措施应对远程办公、在线教育、远程医疗、远程支持服务等方面需求激增带来的压力。这些参议员在信中呼吁,各公司应该降低可能对远程服务产生影响的限制和费用,同时还应该为受到疫情影响的学生提供免费或收费的宽带服务,否则学生在疫情期间无法接入网络进行在线学习。 +* [思科][13]、微软、[谷歌][14]、[LogMeIn][15]、[Spectrum][16] 等供应商都提供了一些免费工具,帮助用户在疫情爆发期间正常进行安全通信。 + + +-------------------------------------------------------------------------------- + +via: https://www.networkworld.com/article/3532440/coronavirus-challenges-remote-networking.html + +作者:[Michael Cooney][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.networkworld.com/author/Michael-Cooney/ +[b]: https://github.com/lujun9972 +[1]: https://atlasvpn.com/blog/vpn-usage-in-italy-rockets-by-112-and-53-in-the-us-amidst-coronavirus-outbreak/ +[2]: https://www.chicagotribune.com/coronavirus/ct-coronavirus-work-from-home-20200312-bscm4ifjvne7dlugjn34sksrz4-story.html +[3]: https://federalnewsnetwork.com/workforce/2020/03/agencies-ramp-up-coronavirus-preparations-as-noaa-plans-large-scale-telework-test/ +[4]: https://fas.org/sgp/crs/misc/R43590.pdf +[5]: https://www.fcc.gov/coronavirus +[6]: https://www.networkworld.com/blog/itaas-and-the-corporate-storage-technology/?utm_source=IDG&utm_medium=promotions&utm_campaign=HPE22140&utm_content=sidebar (ITAAS and Corporate Storage Strategy) +[7]: https://about.att.com/pages/COVID-19.html +[8]: https://blog.cimicorp.com/?p=4055 +[9]: https://www.networkworld.com/article/3268744/understanding-virtual-private-networks-and-why-vpns-are-important-to-sd-wan.html +[10]: https://techcommunity.microsoft.com/t5/office-365-blog/how-to-quickly-optimize-office-365-traffic-for-remote-staff-amp/ba-p/1214571 +[11]: https://www.fcc.gov/document/commissioner-starks-statement-fccs-response-covid-19 +[12]: https://www.warner.senate.gov/public/_cache/files/2/3/239084db-83bd-4641-bf59-371cb829937a/A99E41ACD1BA92FB37BDE54E14A97BFA.letter-to-isps-on-covid-19-final-v2.-signed.pdf +[13]: https://blogs.cisco.com/collaboration/cisco-announces-work-from-home-webex-contact-center-quick-deployment +[14]: https://cloud.google.com/blog/products/g-suite/helping-businesses-and-schools-stay-connected-in-response-to-coronavirus +[15]: https://www.gotomeeting.com/work-remote?clickid=RFlSQF3DBxyOTSr0MKVSfWfHUknShrScK0%3AhTY0&irgwc=1&cid=g2m_noam_ir_aff_cm_pl_ct +[16]: https://www.multichannel.com/news/charter-opening-wi-fi-hotspots-in-face-of-covid-19 +[17]: https://www.facebook.com/NetworkWorld/ +[18]: https://www.linkedin.com/company/network-world diff --git a/published/202003/20200317 Viewing and configuring password aging on Linux.md b/published/202003/20200317 Viewing and configuring password aging on Linux.md new file mode 100644 index 0000000000..a6699b8878 --- /dev/null +++ b/published/202003/20200317 Viewing and configuring password aging on Linux.md @@ -0,0 +1,142 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12041-1.html) +[#]: subject: (Viewing and configuring password aging on Linux) +[#]: via: (https://www.networkworld.com/article/3532815/viewing-and-configuring-password-aging-on-linux.html) +[#]: author: (Sandra Henry-Stocker https://www.networkworld.com/author/Sandra-Henry_Stocker/) + +在 Linux 上查看和配置密码时效 +====== + +![](https://images.idgesg.net/images/article/2019/09/cso_nw_user_id_password_credentials_authentication_by_bluebay2014_gettyimages-924698706_2400x1600-100811223-large.jpg) + +> 使用正确的设置,可以强制 Linux 用户定期更改密码。以下是查看密码时效以及如何更改其中设置的方法。 + +可以将 Linux 系统上的用户密码配置为永久或设置过期时间,以让人们必须定期重置它们。出于安全原因,通常认为定期更改密码是一种好习惯,但默认并未配置。 + +要查看和修改密码时效,你需要熟悉几个重要的命令:`chage` 命令及其 `-l` 选项,以及 `passwd` 命令及其 `-S` 选项。本文会介绍这些命令,还有其他一些 `chage` 命令选项来配置密码时效。 + +### 查看密码时效设置 + +确定某个特定帐户是否已设置密码时效的方法是使用如下 `chage` 命令。请注意,除了你自己的帐户以外,其他任何帐户都需要 root 权限。请注意下面的密码到期日期。 + +``` +$ sudo chage -l dory +Last password change : Mar 15, 2020 +Password expires : Jun 13, 2020 <== +Password inactive : never +Account expires : never +Minimum number of days between password change : 10 +Maximum number of days between password change : 90 +Number of days of warning before password expires : 14 +``` + +如果未应用密码时效,那么帐户信息将如下所示: + +``` +$ sudo chage -l nemo +Last password change : Jan 14, 2019 +Password expires : never <== +Password inactive : never +Account expires : Mar 26, 2706989 +Minimum number of days between password change : 0 +Maximum number of days between password change : 99999 +Number of days of warning before password expires : 7 +``` + +你也可以使用 `passwd -S` 命令查看某些信息,但是你需要知道输出中的每个字段代表什么: + +``` +dory$ passwd -S +dory P 03/15/2020 10 90 14 -1 +``` + +这里的七个字段代表: + +* 1 – 用户名 +* 2 - 帐户状态(`L` = 锁定,`NP` = 无密码,`P` = 可用密码) +* 3 – 上次密码更改的日期 +* 4 – 可更改最低时效(如果没有这么多天,则不能更改密码) +* 5 – 最长时效(这些天后,密码必须更改) +* 6 – 密码过期前提前警告的天数 +* 7 – 密码过期后锁定之前的天数(设为无效) + +需要注意的一件事是,`chage` 命令不会显示帐户是否被锁定;它仅显示密码时效设置。另一方面,`passwd -S` 命令将告诉你密码被锁定的时间。在此例中,请注意帐户状态为 `L`: + +``` +$ sudo passwd -S dorothy +dorothy L 07/09/2019 0 99999 7 10 +``` + +通过将 `/etc/shadow` 文件中通常包含密码的“哈希”字段变为 `!`,从而达成锁定的效果。 + +``` +$ sudo grep dorothy /etc/shadow +dorothy:!:18086:0:99999:7:10:: <== +``` + +帐户被锁定的事实在 `chage` 输出中并不明显: + +``` +$ sudo chage -l dorothy +Last password change : Jul 09, 2019 +Password expires : never +Password inactive : never +Account expires : never +Minimum number of days between password change : 0 +Maximum number of days between password change : 99999 +Number of days of warning before password expires : 7 +``` + +### 密码时效的一些选项 + +最常用的设置是最短和最长的天数。它们经常结合使用。例如,你可以配置一个密码,使其最长不能使用超过 90 天(最大),然后添加一个有效期为一周或 10 天(最小)的密码。这样可以确保用户不会在需要更改密码后马上改回以前的密码。 + +``` +$ sudo chage -M 90 -m 10 shark +$ sudo chage -l shark +Last password change : Mar 16, 2020 +Password expires : Jun 14, 2020 +Password inactive : never +Account expires : never +Minimum number of days between password change : 10 <== +Maximum number of days between password change : 90 <== +Number of days of warning before password expires : 7 +``` + +你还可以使用 `-E` 选项为帐户设置特定的到期日期。 + +``` +$ sudo chage -E 2020-11-11 tadpole +$ sudo chage -l tadpole +Last password change : Oct 15, 2019 +Password expires : never +Password inactive : never +Account expires : Nov 11, 2020 <== +Minimum number of days between password change : 0 +Maximum number of days between password change : 99999 +Number of days of warning before password expires : 7 +``` + +密码时效可能是一个重要的选择,只要它不鼓励用户使用过于简单的密码或以不安全的方式写下来即可。有关控制密码字符(例如,大小写字母、数字等的组合)的更多信息,请参考这篇关于[密码复杂度][3]的文章。 + +-------------------------------------------------------------------------------- + +via: https://www.networkworld.com/article/3532815/viewing-and-configuring-password-aging-on-linux.html + +作者:[Sandra Henry-Stocker][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://www.networkworld.com/author/Sandra-Henry_Stocker/ +[b]: https://github.com/lujun9972 +[1]: https://www.networkworld.com/newsletters/signup.html +[2]: https://www.networkworld.com/blog/itaas-and-the-corporate-storage-technology/?utm_source=IDG&utm_medium=promotions&utm_campaign=HPE22140&utm_content=sidebar (ITAAS and Corporate Storage Strategy) +[3]: https://www.networkworld.com/article/2726217/how-to-enforce-password-complexity-on-linux.html +[4]: https://www.facebook.com/NetworkWorld/ +[5]: https://www.linkedin.com/company/network-world diff --git a/published/202003/20200318 Top 10 open source tools for working from home.md b/published/202003/20200318 Top 10 open source tools for working from home.md new file mode 100644 index 0000000000..c8357aadc7 --- /dev/null +++ b/published/202003/20200318 Top 10 open source tools for working from home.md @@ -0,0 +1,141 @@ +[#]: collector: (lujun9972) +[#]: translator: (wxy) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12014-1.html) +[#]: subject: (Top 10 open source tools for working from home) +[#]: via: (https://opensource.com/article/20/3/open-source-working-home) +[#]: author: (Seth Kenlon https://opensource.com/users/seth) + +在家工作的十大开源工具 +====== + +> 无论你是在家工作的资深人士还是远程工作的新手,这些工具都可以使交流和协作变得轻而易举。 + +![](https://img.linux.net.cn/data/attachment/album/202003/20/103814bwxxqxkxc9qqxkbb.jpg) + +如果你在家工作work from home(WFH),你就会知道拥有一系列实用的工具是很重要的,这些工具可以让你远离烦恼,专注于重要的事情。在工作期间工作越努力,工作日结束后,你就越容易放松。 + +我已经在家工作多年了,这是我精选的远程工作者必备的最佳开源工具。 + +### 视频会议:Jitsi + +![Jitsi screenshot][2] + +当你不在同事身边时,每周保持连接几次非常重要,甚至只是这样也可以保持人与人之间的联系,否则你就会变得孤独。市场上有很多视频会议系统,但以我的经验,最简单、最好的是开源的 [Jitsi][3]。 + +通过易于记忆的 URL([meet.jit.si][3])和按需会议室,Jitsi 使得召开即席会议非常简单。而且更好的是,无需注册。你只需进入 [meet.jit.si][3],找到一个带有友好的、随机生成的 URL(此处没有字母和数字的随机组合) 的会议室,你就可以立即开始聊天。如果你选择注册,那么还可以与几种日历进行集成。 + +在现实生活中,我参加了许多来自新西兰最偏远地区的会议,而 Jitsi 无疑是我迄今为止拥有的最好的视频聊天体验。不需要浪费一半的会议时间在迷宫般的虚拟会议室中寻找彼此,也不用在尴尬的滞后时间中坐着发呆,更不用努力地为聊天应用程序安装更新。使用开源和符合标准的 webRTC 协议的 Jitsi 可以让你有个愉悦的开会体验。 + +### 白板:Drawpile + +![Drawpile screenshot][4] + +有时,白板非常适合解释事情、跟踪想法或只是散布一下疯狂的想法。白板是办公室会议室的常见物品,但在数字世界中却很难获得。幸运的是,有了 [Drawpile][5],这是一个实时协作的绘图应用程序。你可以在自己的计算机上托管绘图会话并邀请其他用户,也可以在 Drawpile 的服务器上托管会话。 + +它易于使用,足够精简、直观而功能强大,当你的粗略想法开始逐渐成型时,它是使其成为可行的作品的应用程序。 + +### 看板:Taiga + +![Taiga screenshot][6] + +想要保持有序并与你的部门保持同步吗?你应该试试 [Taiga][7],这是一个虚拟的“便利贴”面板,可以帮助团队跟踪各个任务。这种组织和项目计划方法被称为看板kanban,在软件开发中很流行,而它也流行于从假期规划到家庭装修项目的所有计划之中。 + +Taiga 的优点是它是一个在线共享空间。与你进行协作或与之合作的任何人都可以把任务放到面板上,并且随着每个人的进展,他们将任务从左列(起点)移到右边(终点线)。Taiga 具有令人愉悦的图形化和交互性,没有什么比从一列移动到另一列的拖放任务令人感到舒适的了。 + +如果你的团队有 Taiga 无法满足的特定需求,那么你应该看看[我们挑选的最佳开源看板][8]。 + +### 个人笔记本:Joplin + +![Joplin][9] + +我在办公桌旁放着一个纸质笔记本,这样我就可以随时记下思考或想法了。想要捕捉这种简单动作的感受和便利是很棘手的,但 Joplin 却做的很好。 + +你可以在 Joplin 中创建虚拟笔记本,每个笔记本可以有任意数量的条目。这些条目可以是简单的文本,也可以是带有图形、任务列表、超链接等的复杂的动态文档。最重要的是,你可以将 Joplin 与所有的在线存储服务同步,包括开源的 Nextcloud 服务,这样你可以在任何计算机和任何设备上使用笔记本。这是使你的工作日井井有条、专心致志并保持活动顺畅的好方法。 + +如果 Joplin 不太满足你的要求,请查看一些我们最喜欢的[笔记本应用][10]。 + +### 群聊:Riot + +![Riot screenshot][11] + +并非所有内容都需要视频聊天或语音通话,但是有些事情比电子邮件更紧急。这就是团队聊天发挥作用的地方。一个好的群聊应用程序应该具有这些功能:即时消息传递、支持表情符号、支持 GIF 和图像,按需聊天室或“频道”、广泛的兼容性和隐私性。[Matrix][12] 是一个用于实时通信的开放标准和轻量级协议,如果你厌烦于键入大段消息,则可以使用相同的协议快速切换到 VOIP。你将获得世界上最好的群聊体验。 + +Matrix 是一种协议,并且有许多应用程序可以接驳到它(就像使用 Internet 协议一样,Firefox 是使人类可以访问的应用程序)。最受欢迎的客户端之一是 [Riot.im][13]。你可以为你的计算机和手机下载 Riot,并且只是短时间使用的话,可以通过 Web 浏览器连接到 Riot。你的团队总是会近在咫尺,但永远不会近到让你感到不舒服。 + +### 共享文档:Etherpad + +![Etherpad screenshot][14] + +如果你想与他人协作处理文档或与开会,则仅需 Etherpad 就行。Etherpad 是一个实时共享的文字处理器。可以邀请一个或多个人访问文档,并在每个人进行添加和编辑时进行观察。这是一种快速有效的方法,可将想法记入“纸上”并一起迭代修订。 + +有几种使用 Etherpad 的方法。如果你拥有良好的 IT 支持,则可以要求你的 IT 部门为你的组织托管一个 Etherpad 实例。否则,将有来自开源支持者的在线公共实例,例如 [Riseup][15] 和 [Etherpad][16] 本身所提供的。 + +### 共享电子表格:Ethercalc + +![Ethercalc screenshot][17] + +与 Etherpad 相似,在线 [Ethercalc][18] 编辑器允许多个用户同时在同一屏幕上远程地在电子表格上工作。Ethercalc 甚至可以从现有电子表格和定界文本文件中导入数据。你可能会也可能不会丢失大部分格式,具体取决于要导入的内容的复杂性,但是我从来没有弄坏过我的数据,因此导入文件总是一个好的开始。 下次需要复杂公式的帮助时,或者需要在最新预算中输入收据时,或者只是需要某人在格子上的输入时,请将其输入到 Ethercalc。 + +### 共享存储与日历:Nextcloud + +![Nextcloud screenshot][19] + +[Nextcloud][20] 是一个心存远志的应用程序。顾名思义,它是你自己的个人云。它最明显的切入点是在线共享存储,它可以与台式机和移动设备上的文件夹同步。将文件放入文件中,文件会上传到存储空间,然后当一切内容都同步后,它们会出现在所有设备上。为组织中的每个人提供一个帐户,你马上便拥有了共享的存储空间,可以通过单击鼠标单击以共享带有或不带有密码的文件和文件夹。 + +但是,除了充当共享数据的保管箱之外,Nextcloud 还有很多其他功能。由于其插件式结构,你可以将无数的 Web 应用程序安装到 Nextcloud 中,例如聊天客户端、电子邮件客户端、视频聊天等等。并非所有插件都是“官方的”,因此其支持服务各不相同,但是有几个非常好的官方插件。值得注意的是,有一个官方的日历应用程序,你和你的同事可以用它安排会议并跟踪即将发生的重要事件。该日历使用 CalDAV 协议,因此你所做的一切都可以与任何 CalDAV 客户端兼容。 + +### LibreOffice + +![LibreOffice screenshot][21] + +如果你习惯于每天一整天都在办公室里工作,那么你也可能习惯整天在办公套件里工作。包含所有常用功能的面面俱到的应用程序会令人感到某种程度的舒适,而在开源办公世界中的这样的应用程序就是 [LibreOffice][22]。它具有办公套件所应有的一切:文字处理器、电子表格和幻灯片演示。它还具有超出预期的功能,例如基于矢量的绘图应用程序,它还可以编辑 PDF 文件,还有一个带有图形界面构建器的关系型数据库。如果你正在寻找一个好的办公应用程序,那么 LibreOffice 是你应该首先看一看的,因为一旦你使用它,你就再也不用看别的了。 + +### Linux + +![][23] + +如果你不熟悉远程工作,而可能是由于某种原因而正在经历一场重大变革。对于某些人来说,变革的时光是一个极好的动力,它可以一劳永逸地改变一切。如果你是其中的一员,那么可能是时候更改一下整个操作系统了。Windows 和 Mac 可能在过去为你提供了很好的服务,但是如果你希望从非开源软件转向开源软件,为什么不换一下运行所有这些应用程序的平台呢? + +有许多出色的 Linux 发行版可以让你认真地工作、认真地自我管理和认真地进阶。获取一份 Linux 副本,不论是 [Fedora][24]、[Elementary][25] 还是 [Red Hat Enterprise Linux][26] 的长期支持订购,去尝试使用自由的开源操作系统吧。等你熟悉了远程人的生活时,你最终将成为一名 Linux 专家! + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/3/open-source-working-home + +作者:[Seth Kenlon][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/seth +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/oatmeal-and-fedora.jpg?itok=NBFUH9eF (Oatmeal and a laptop.) +[2]: https://opensource.com/sites/default/files/uploads/jitsi_0.jpg (Jitsi screenshot) +[3]: http://meet.jit.si +[4]: https://opensource.com/sites/default/files/uploads/drawpile-whiteboard.jpg (Drawpile screenshot) +[5]: https://drawpile.net/ +[6]: https://opensource.com/sites/default/files/uploads/taiga_kanban_screen_0.jpg (Taiga screenshot) +[7]: http://taiga.io +[8]: https://opensource.com/alternatives/trello +[9]: https://opensource.com/sites/default/files/joplin_0.png (Joplin) +[10]: https://opensource.com/alternatives/evernote +[11]: https://opensource.com/sites/default/files/uploads/riot-matrix.jpg (Riot screenshot) +[12]: http://matrix.org +[13]: http://riot.im +[14]: https://opensource.com/sites/default/files/uploads/etherpad.jpg (Etherpad screenshot) +[15]: https://pad.riseup.net/ +[16]: https://beta.etherpad.org +[17]: https://opensource.com/sites/default/files/uploads/ethercalc.jpg (Ethercalc screenshot) +[18]: https://ethercalc.org +[19]: https://opensource.com/sites/default/files/uploads/nextcloud-calendar.jpg (Nextcloud screenshot) +[20]: http://nextcloud.com +[21]: https://opensource.com/sites/default/files/uploads/libreoffice.png (LibreOffice screenshot) +[22]: http://libreoffice.org +[23]: https://opensource.com/sites/default/files/uploads/advent-pantheon.jpg +[24]: https://getfedora.org/ +[25]: https://elementary.io +[26]: https://www.redhat.com/en/store/red-hat-enterprise-linux-workstation diff --git a/published/202003/20200319 4 Markdown tools for the Linux command line.md b/published/202003/20200319 4 Markdown tools for the Linux command line.md new file mode 100644 index 0000000000..0aa052696b --- /dev/null +++ b/published/202003/20200319 4 Markdown tools for the Linux command line.md @@ -0,0 +1,111 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12048-1.html) +[#]: subject: (4 Markdown tools for the Linux command line) +[#]: via: (https://opensource.com/article/20/3/markdown-apps-linux-command-line) +[#]: author: (Scott Nesbitt https://opensource.com/users/scottnesbitt) + +4 个 Linux 命令行下的 Markdown 工具 +====== + +> 命令行 Markdown 工具快速、强大、灵活。以下是 4 个值得试一下的工具。 + +![](https://img.linux.net.cn/data/attachment/album/202003/29/112110pbd22dku6b2g6ku6.jpg) + +(在 Linux 上)在处理 [Markdown][2] 格式的文件时,命令行工具会占据主导地位。它们轻巧、快速、强大、灵活,它们大多数都遵循 Unix 哲学只做好一件事。 + +看一下这四个程序,它们可以帮助你在命令行中更有效地处理 Markdown 文件。 + +### mdless + +如果你使用过一段时间的 Linux 命令行,那么你可能对名为 [less][3] 的文本查看器很熟悉。当然,你可以使用 `less` 查看 Markdown 文件,但结果有点枯燥。如何在终端中查看 Markdown 文件效果更好一点?来使用 [mdless][4]。 + +![mdless][5] + +你可以使用键盘上的箭头键四处移动,并且 `mdless` 提供了很好的搜索功能。 + +`mdless` 不仅会显示文本,而且还会渲染标题、粗体和斜体等格式。它还可以显示表格并语法高亮代码块。你还可以创建一个或多个主题文件来[定制][6] `mdless` 的外观。 + +### Markdown lint 工具 + +你在快速输入时会犯错误。如果你在使用 Markdown(或其他任何标记语言)时丢失了一些格式,那么在将文件转换为另一种格式时可能会有问题。 + +程序员通常使用名为 linter 的工具来检查语法是否正确。你可以使用 [Markdown lint 工具][7]对 Markdown 执行相同的操作。 + +在你对 Markdown 文件运行该工具时,它会根据[规则集][8]检查格式。这些规则控制着文档的结构,包括标题级别的顺序、不正确的缩进和间距、代码块问题、文件中存在 HTML 等等。 + +![Markdown lint tool][9] + +规则可能有点严格。但是,在将文件转换为其他格式之前对文件运行 Markdown lint 工具可以防止由于格式错误或不一致引起的麻烦。 + +### mdmerge + +合并任何类型的文件可能会很痛苦。例如,我在整理一本电子书。它是一篇文章集,最初发布在我的[每周邮件][10]中。这些文章都放在单独的文件中,作为受虐狂,我以凌乱、手动的方式将它们组合在一起。 + +我希望在开始这个项目之前就知道 [mdmerge][11]。这样我可以节省很多时间和精力。 + +`mdmerge`,你可能已经从名称中猜到了它的作用,它将两个或多个 Markdown 文件合并为一个文件。你无需在命令行中输入文件名。相反,你可以将它们添加到名为 `book.txt` 的文件中,并将其用作 `mdmerge` 的输入文件。 + +这并不是 `mdmerge` 能做的一切。你可以添加对另一个文档的引用(使用 Markdown 格式引用或一段源代码),然后将其放入主文档中。这样一来,你就可以创建针对特定受众定制的[主文档][12]。 + +`mdmerge` 不会是你经常使用的程序。但当你需要时,你会很高兴硬盘上有它。 + +### bashblog + +严格说 [bashblog][13] 并不是 Markdown 工具。它获取 Markdown 文件,并使用它们来构建简单的博客或网站。你可以将 bashblog 视为[静态站点生成器][14],但是它没有很多脆弱的依赖关系。一切几乎都在一个不到 50KB 的 shell 脚本中。 + +要使用 bashblog,只需在计算机上安装 Markdown 处理器即可。在此,你可以编辑 Shell 脚本添加有关博客的信息,例如标题、名字、社交媒体链接等。然后运行该脚本。之后会在默认文本编辑器中新建一篇文章。开始输入。 + +保存文章后,你可以发布它或将其另存为草稿。如果你选择发布文章,那么 bashblog 会将你的博客、文章和所有内容生成为一组 HTML 文件,你可以将它们上传到 Web 服务器。 + +它开箱即用,你的博客或许会平淡无奇,但可以使用。你可以根据自己喜好编辑站点的 CSS 文件来改变外观。 + +![bashblog][15] + +### Pandoc 如何? + +当然,Panddoc 是一个非常强大的工具,可以将 Markdown 文件转换为其他标记语言。但是,在命令行上使用 Markdown 要比 Pandoc 多。 + +如果你需要 Pandoc,请查看我们发布的文章: + +* [在命令行使用 Pandoc 进行文件转换][16] +* [使用 Pandoc 将你的书转换成网页和电子书][17] +* [用 Pandoc 生成一篇调研论文][18] +* [使用 pandoc 将 Markdown 转换为格式化文档][19] + + + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/3/markdown-apps-linux-command-line + +作者:[Scott Nesbitt][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/scottnesbitt +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/rh_003784_02_os.comcareers_os_rh2x.png?itok=jbRfXinl (A person working.) +[2]: https://opensource.com/article/19/9/introduction-markdown +[3]: https://opensource.com/article/18/4/using-less-view-text-files-command-line +[4]: https://github.com/ttscoff/mdless +[5]: https://opensource.com/sites/default/files/uploads/mdless.png (mdless) +[6]: https://github.com/ttscoff/mdless#customization +[7]: https://github.com/markdownlint/markdownlint +[8]: https://github.com/markdownlint/markdownlint/blob/master/docs/RULES.md +[9]: https://opensource.com/sites/default/files/uploads/mdl.png (Markdown lint tool) +[10]: https://buttondown.email/weeklymusings +[11]: https://github.com/JeNeSuisPasDave/MarkdownTools +[12]: https://help.libreoffice.org/6.2/en-US/text/swriter/guide/globaldoc.html +[13]: https://github.com/cfenollosa/bashblog +[14]: https://en.wikipedia.org/wiki/Web_template_system#Static_site_generators +[15]: https://opensource.com/sites/default/files/uploads/bashblog.png (bashblog) +[16]: https://linux.cn/article-10228-1.html +[17]: https://linux.cn/article-10287-1.html +[18]: https://linux.cn/article-10179-1.html +[19]: https://linux.cn/article-11160-1.html diff --git a/published/202003/20200319 7 open hardware projects working to solve COVID-19.md b/published/202003/20200319 7 open hardware projects working to solve COVID-19.md new file mode 100644 index 0000000000..3b3f5cf23e --- /dev/null +++ b/published/202003/20200319 7 open hardware projects working to solve COVID-19.md @@ -0,0 +1,208 @@ +[#]: collector: (lujun9972) +[#]: translator: (wxy) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12047-1.html) +[#]: subject: (7 open hardware projects working to solve COVID-19) +[#]: via: (https://opensource.com/article/20/3/open-hardware-covid19) +[#]: author: (Harris Kenny https://opensource.com/users/harriskenny) + +应对新冠病毒的 7 个开源硬件项目 +====== + +> 开源硬件解决方案可以为抵御新型冠状病毒的传播和痛苦做出贡献。 + +![](https://img.linux.net.cn/data/attachment/album/202003/29/103909f50gm91z22twuv23.jpg) + +开源[硬件][2]运动长期以来一直主张维修权的重要性,完全拥有所购买的技术,并能够像音乐一样重新组合和复制部件。因此,在这个充满挑战的时期内,开源硬件为由冠状病毒大流行引起的一些问题提供了一些答案。 + +### 背景概述 + +首先,全球的硬件开发人员正在努力使用开源解决供应链中的弱点,在过去 30 年中,这种理念推动了新软件技术的大量涌现。过去在硬件运动方面的成功,如 [RepRap Project][3]、[Open Source Ecology][4] 和 [Open Source Beehives][5],证明了这一点是可以做到的。 + +对于使用 3D 打印和其他技术按需生产安全设备和按需制造它的替换零件,创客们的兴趣日益增加。例如,香港理工大学实验室为医院工作人员提供 [3D 打印面罩][6]。意大利初创公司 Isinnova 与米兰 FabLab 合作,为受重灾的意大利北部提供用于呼吸机的 [3D 打印替换阀][7]。公司们还发布了设计以适应我们的物理接触需求,例如 Materialise 的 [3D 打印免提开门器][8]。这些更换零件和解决问题的示例是一个很好的起点,为挽救生命做出了努力。 + +另一种传统的硬件技术正在加速发展:缝纫。法新社报道说,全球急需口罩,来自世界卫生组织的指导也指明了其重要性。随着一次性口罩要优先供给于医护人员,捷克共和国的人们[开始缝制自己的口罩][9]。(重复使用的口罩确实会带来细菌问题。)Facebook 小组“捷克缝制口罩”开始在他们的国家解决这个问题,成千上万的成员开始用起了他们的家用缝纫机。 + +开源硬件设备和机械项目也越来越受欢迎。首先,有一些测试性设备具备高精度且功能强大。其次,在没有其他选择方案的情况下,有一些医疗设备(顶多)可以归类为现场级。这些项目将在下面详细概述。 + +为了解更多信息,我与总部位于芝加哥的 [Tapster Robotics][10] 的创始人兼首席执行官 Jason Huggins 进行了交谈。Tapster Robotics 使用 3D 打印、计算机数控(CNC)加工和 [Arduino][11] 等开源电子产品设计和制造台式机器人。他兼具技术知识和工业能力,具有很高的影响力。他想投入自己公司的资源来帮助这场斗争。 + +“基本上,我们现在正处于第二次世界大战的动员时刻。即使我不是医生,我们仍然应该遵循希波克拉底誓言。无论我做什么,我都不想让问题变得更糟”,Huggins 解释,他认为:“作为对策,世卫组织执行主任 Michael Ryan 博士发表了这样的评论:‘速度胜过完美’。” + +> 哇! +> +> 这个人是疾病传播的全球权威。如果您是领导者(无论以何种身份),请注意。如果不是,也请注意。 +> +> [pic.twitter.com/bFogaekehM][12] +> +> — Jim RichardsSh🎙wgram(@JIMrichards1010)[2020 年 3 月 15 日][13] + +Huggins 在应需提供方面具有丰富的经验。他的努力有助于 [Healthcare.gov][14] 在挑战性的最初启动后得以扩展。他还创建了软件行业标准的测试框架 Selenium 和 Appium。有了这一经验,他的建议非常值得考虑。 + +我还与 [Tyson Law][15] 的西雅图律师 Mark Tyson 进行了交谈,他的合作对象是初创公司和小型企业。他在快速发展的行业中与敏捷公司合作有着直接的经验。在阐述整个问题时,Tyson 说到: + +> 《善良的撒玛利亚人法Good Samaritan law》保护志愿者(即“好撒玛利亚人”)免于因其在紧急情况下提供援助的决定而承担责任。尽管这些法律的具体内容因州而异,但它们具有共同的公共政策依据:即鼓励旁观者帮助遇到紧急情况的其他人。可以想象,除了传统的把车祸的受害者从伤害中拉出来之外,这种理论依据可以证明在不太传统的环境中应用这类法律的合理性。 + +对于这种特定情况,Tyson 指出: + +> “在采取行动之前,创客们明智的做法是与律师沟通一下,以针对特定的州进行风险评估。还应谨慎地要求大型机构(例如医院或保险公司)通过合同接受潜在的责任风险,例如,通过使用赔偿协议,使医院或其保险人同意赔偿创客们的责任。” + +Tyson 明白情况的紧迫性和严重性。使用合同的这种选择并不意味着障碍。相反,这可能是一种帮助其大规模采用的方法,以更快地产生更大的变化。这取决于你或你的机构。 + +综上所述,让我们探索正在使用或正在开发中的项目(可能很快就可以部署)。 + +### 7 个与新冠病毒对抗的开源硬件项目 + +#### Opentrons + +[Opentrons][16] 的开源实验室自动化平台由一套开源硬件、经过验证的实验室器具、消耗品、试剂和工作站组成。Opentrons 表示,其产品可以“在下订单后几天内每天自动进行多达 2400 个测试”的系统,可以极大地帮助提高[新冠病毒测试规模][17]。它计划在 7 月 1 日之前提升到多达 100 万个测试样本。 + +![Opentrons roadmap graphic][18] + +*来自 Opentrons [网站][17],版权所有* + +该公司已经在与联邦和地方政府机构合作,以确定其系统是否可以在[紧急使用授权][19]下用于临床诊断。 Opentrons 在 [Apache 2.0 许可证][20]下共享。我最初是从与该项目有联系的生物学家 Kristin Ellis 那里得知它的。 + +#### Chai 的 Open qPCR + +Chai 的 [Open qPCR][21] 设备使用[聚合酶链反应][22](PCR)快速检测物品表面(例如,门把手和电梯按钮)上的拭子,以查看是否存在新型冠状病毒。这种在 [Apache 2.0 许可证][23]下共享的开源硬件使用 [BeagleBone][24] 低功耗 Linux 计算机。Chai 的 Open qPCR 提供的数据可以使公共卫生、公民和企业领导者做出有关清洁、缓解、关闭设施、接触追踪和测试的更明智的决策。 + +#### OpenPCR + +[OpenPCR][25] 是 Chai Open qPCR 的创建者 Josh Perfetto 和 Jessie Ho 的 PCR 测试设备套件。与他们的前一个项目相比,这更像是一种 DIY 开源设备,但它具有相同的使用场景:使用环境测试来识别野外冠状病毒。正如该项目页面所指出的那样,“能够检测这些病原体的传统实时 PCR 设备通常花费超过 30,000 美元,而且不适合在现场使用。”由于 OpenPCR 是用户构建的工具包,并且在 [GPLv3.0 许可证][26]下共享,因此该设备旨在使分子诊断的访问大众化。 + +![OpenPCR][27] + +*来自 OpenPCR [网站][25],版权所有* + +而且,就像任何优秀的开源项目一样,它也有一个衍生产品!瑞士的 [Gaudi Labs][29] 推出的 [WildOpenPCR][28] 也以 [GPLv3.0 许可证][30]共享。 + +#### PocketPCR + +Gaudi Labs 的 [PocketPCR][31] 热循环仪可通过升高和降低小试管中液体的温度来激活生物反应。它可以通过简单的 USB 电源适配器供电,该适配器可以绑定到设备上,也可以单独使用,不使用计算机或智能手机时可使用预设参数。 + +![PocketPCR][32] + +*来自 PocketPCR [网站][31],版权所有* + +与本文所述的其他 PCR 产品一样,此设备可能有助于对冠状病毒进行环境测试,尽管其项目页面并未明确说明。PocketPCR 在 [GPLv3.0 许可证][33]下共享。 + +#### Open Lung 低资源呼吸机 + +[Open Lung 低资源呼吸机][34]是一种快速部署的呼吸机,它以[气囊阀罩][35](BVM)(也称为 Ambu 气囊)为核心组件。Ambu 气囊已批量生产,经过认证,体积小,机械简单,并且适用于侵入性导管和口罩。 Open Lung 呼吸机使用微电子技术来感测和控制气压和流量,以实现半自主运行。 + +![Open Lung ventilator][36] + +*Open Lung,[GitLab][37]* + +这个早期项目拥有一支由数百名贡献者组成的大型团队,领导者包括:Colin Keogh、David Pollard、Connall Laverty 和 Gui Calavanti。它是以 [GPLv3.0 许可证][38]共享的。 + +#### Pandemic 呼吸机 + +[Pandemic 呼吸机][39]是 DIY 呼吸机的原型。像 RepRap 项目一样,它在设计中使用了常用的硬件组件。该项目已由用户 Panvent 于 10 多年前上传到 Instructables,并且有六个主要的生产步骤。该项目是以 [CC BY-NC-SA 许可证][39]共享的。 + +#### Folding at Home + +[Folding at Home][40] 是一个分布式计算项目,用于模拟蛋白质动力学,包括蛋白质折叠的过程以及与多种疾病有关的蛋白质运动。这是一个面向公民科学家、研究人员和志愿者的行动呼吁,类似于退役的 [SETI@Home 项目][41]使用家中的计算机来运行解码计算。如果你是具备强大计算机硬件功能的技术人员,那么这个项目适合你。 + +![Markov state model][42] + +*Vincent Voelz,CC BY-SA 3.0* + +Folding at Home 项目使用马尔可夫状态模型(如上所示)来建模蛋白质可能采取的形状和折叠途径,以寻找新的治疗机会。你可以在华盛顿大学生物物理学家 Greg Bowman 的帖子《[它是如何运作的以及如何提供帮助][43]》中找到有关该项目的更多信息。 + +该项目涉及来自许多国家和地区(包括香港、克罗地亚、瑞典和美国)的财团的学术实验室、贡献者和公司赞助者。 在 [GitHub][45] 上,[在混合了 GPL 和专有许可证][44]下共享,并且可以在 Windows、macOS 和 GNU/Linux(例如 Debian、Ubuntu、Mint、RHEL、CentOS、Fedora)。 + +### 许多其他有趣的项目 + +这些项目只是在开源硬件领域中解决或治疗新冠病毒活动中的一小部分。在研究本文时,我发现了其他值得探索的项目,例如: + +* Coronavirus Tech Handbook 提供的[开源呼吸机、氧气浓缩器等][46] +* 来自 ProjectOpenAir 的 [有用的工程][47] +* Hackaday 上的[开源呼吸机黑客马拉松][48] +* 约翰·霍普金斯急诊医学住院医师 Julian Botta 的[简单开源机械呼吸机规范][49] +* [与冠状病毒有关的网络钓鱼、恶意软件和随机软件正在增加][50],作者:Shannon Morse +* [将低成本的 CPAP 鼓风机转换为基本呼吸机][51],作者: jcl5m1 +* [A.I.R.E. 论坛上关于开源呼吸器和风扇的讨论][52](西班牙语) +* [关于新冠病毒的开源医疗硬件的特殊问题][53],作者:Elsevier HardwareX + +这些项目遍布全球,而这种全球合作正是我们所需要的,因为病毒无视国界。新冠病毒大流行在不同时期以不同方式影响国家,因此我们需要一种分布式方法。 + +正如我和同事 Steven Abadie 在 [OSHdata 2020 报告][54]中所写的那样,开源硬件运动是全球性运动。参与该认证项目的个人和组织遍布全球 35 个国家地区和每个半球。 + +![Open source hardware map][55] + +*OSHdata,CC BY-SA 4.0 国际版* + +如果你有兴趣加入这场与全球开源硬件开发人员的对话,请加入[开源硬件峰会的 Discord][56] 服务器,并通过专用渠道进行有关新冠病毒的讨论。你在这里可以找到机器人专家、设计师、艺术家、固件和机械工程师、学生、研究人员以及其他共同为这场战争而战的人。希望可以看到你。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/3/open-hardware-covid19 + +作者:[Harris Kenny][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/harriskenny +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/health_heartbeat.png?itok=P-GXea-p (open on blue background with heartbeat symbol) +[2]: https://opensource.com/resources/what-open-hardware +[3]: https://reprap.org/wiki/RepRap +[4]: https://www.opensourceecology.org/ +[5]: https://www.osbeehives.com/ +[6]: https://www.scmp.com/news/hong-kong/health-environment/article/3052135/polytechnic-university-lab-3d-printing-face +[7]: https://www.3dprintingmedia.network/covid-19-3d-printed-valve-for-reanimation-device/ +[8]: https://www.3dprintingmedia.network/materialise-shows-3d-printed-door-opener-for-coronavirus-containment-efforts/ +[9]: https://news.yahoo.com/stitch-time-czechs-sew-combat-virus-mask-shortage-205213804.html +[10]: http://tapster.io/ +[11]: https://opensource.com/life/15/5/arduino-or-raspberry-pi +[12]: https://t.co/bFogaekehM +[13]: https://twitter.com/JIMrichards1010/status/1239140710558969857?ref_src=twsrc%5Etfw +[14]: http://Healthcare.gov +[15]: https://www.marktysonlaw.com/ +[16]: https://opentrons.com/ +[17]: https://blog.opentrons.com/testing-for-covid-19-with-opentrons/ +[18]: https://opensource.com/sites/default/files/uploads/opentrons.png (Opentrons roadmap graphic) +[19]: https://www.fda.gov/regulatory-information/search-fda-guidance-documents/policy-diagnostics-testing-laboratories-certified-perform-high-complexity-testing-under-clia-prior +[20]: https://github.com/Opentrons/opentrons/blob/edge/LICENSE +[21]: https://www.chaibio.com/openqpcr +[22]: https://en.wikipedia.org/wiki/Polymerase_chain_reaction +[23]: https://github.com/chaibio/chaipcr +[24]: https://beagleboard.org/bone +[25]: https://openpcr.org/ +[26]: https://github.com/jperfetto/OpenPCR/blob/master/license.txt +[27]: https://opensource.com/sites/default/files/uploads/openpcr.png (OpenPCR) +[28]: https://github.com/GenericLab/WildOpenPCR +[29]: http://www.gaudi.ch/GaudiLabs/?page_id=328 +[30]: https://github.com/GenericLab/WildOpenPCR/blob/master/license.txt +[31]: http://gaudi.ch/PocketPCR/ +[32]: https://opensource.com/sites/default/files/uploads/pocketpcr.png (PocketPCR) +[33]: https://github.com/GaudiLabs/PocketPCR/blob/master/LICENSE +[34]: https://gitlab.com/TrevorSmale/low-resource-ambu-bag-ventilor +[35]: https://en.wikipedia.org/wiki/Bag_valve_mask +[36]: https://opensource.com/sites/default/files/uploads/open-lung.png (Open Lung ventilator) +[37]: https://gitlab.com/TrevorSmale/low-resource-ambu-bag-ventilor/-/blob/master/images/CONCEPT_1_MECH.png +[38]: https://gitlab.com/TrevorSmale/low-resource-ambu-bag-ventilor/-/blob/master/LICENSE +[39]: https://www.instructables.com/id/The-Pandemic-Ventilator/ +[40]: https://foldingathome.org/ +[41]: https://setiathome.ssl.berkeley.edu/ +[42]: https://opensource.com/sites/default/files/uploads/foldingathome.png (Markov state model) +[43]: https://foldingathome.org/2020/03/15/coronavirus-what-were-doing-and-how-you-can-help-in-simple-terms/ +[44]: https://en.wikipedia.org/wiki/Folding@home +[45]: https://github.com/FoldingAtHome +[46]: https://coronavirustechhandbook.com/hardware +[47]: https://app.jogl.io/project/121#about +[48]: https://hackaday.com/2020/03/12/ultimate-medical-hackathon-how-fast-can-we-design-and-deploy-an-open-source-ventilator/ +[49]: https://docs.google.com/document/d/1FNPwrQjB1qW1330s5-S_-VB0vDHajMWKieJRjINCNeE/edit?fbclid=IwAR3ugu1SGMsacwKi6ycAKJFOMduInSO4WVM8rgmC4CgMJY6cKaGBNR14mpM +[50]: https://www.youtube.com/watch?v=dmQ1twpPpXA +[51]: https://github.com/jcl5m1/ventilator +[52]: https://foro.coronavirusmakers.org/ +[53]: https://www.journals.elsevier.com/hardwarex/call-for-papers/special-issue-on-open-source-covid19-medical-hardware +[54]: https://oshdata.com/2020-report +[55]: https://opensource.com/sites/default/files/uploads/oshdata-country.png (Open source hardware map) +[56]: https://discord.gg/duAtG5h diff --git a/published/202003/20200319 Fedora 32 Release Date, New Features and Everything Else.md b/published/202003/20200319 Fedora 32 Release Date, New Features and Everything Else.md new file mode 100644 index 0000000000..b47291dfe1 --- /dev/null +++ b/published/202003/20200319 Fedora 32 Release Date, New Features and Everything Else.md @@ -0,0 +1,88 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12044-1.html) +[#]: subject: (Fedora 32 Release Date, New Features and Everything Else) +[#]: via: (https://itsfoss.com/fedora-32/) +[#]: author: (Ankush Das https://itsfoss.com/author/ankush/) + +Fedora 32 发布日期、新功能和其它信息 +====== + +Fedora 32 应该和 [Ubuntu 20.04 LTS][1] 一样都在 4 月底发布。 + +由于我们详细介绍了 Ubuntu 20.04,因此我们考虑在这里为 Fedora 粉丝做同样的事情。 + +在本文中,我将重点介绍 Fedora 32 的新功能。随着开发的进行,我将对本文进行更新。 + +### Fedora 32 的新功能 + +![][2] + +#### 启用了 EarlyOOM + +在此版本中,默认启用 [EarlyOOM][3]。提供一下背景知识,EarlyOOM 可以让用户在大量进行[交换][4]时轻松地摆脱内存不足状况恢复其系统。 + +值得注意的是,它适用于 Fedora 32 Beta 工作站版本。 + +#### 添加了 GNOME 3.36 + +新的 Fedora 32 工作站版也包含了新的 [GNOME 3.36][5]。不仅限于 Fedora 32 Beta 工作站版,[Ubuntu 20.04 LTS][1] 的每日构建版中也添加了它。 + +当然,GNOME 3.36 中的改进也进入了 Fedora 的最新版本,总体上提供了更快,更好的体验。因此,你将获得新的锁定屏幕、请勿打扰功能以及 GNOME 3.36 附带的所有其他功能。 + +#### 软件包更新 + +Fedora 32 版本还更新了许多重要的软件包,包括 Ruby、Perl 和 Python。它还有 [GNU 编译器集合(GCC)][6]的最新版本 10。 + +#### 其他更改 + +除了主要亮点之外,还有很多更改、改进或修复。你可以详细查看它的[更新日志][7]来了解有关更多信息。 + +### 下载Fedora 32(开发版) + +Fedora 32 仍在开发中。Beta 版已经发布,你可以在空闲系统或虚拟机上对其进行测试。**我不建议你在最终版本之前在主系统上使用它**。当前版本有一个官方的[已知 bug 列表] [8],你也可以参考。 + +在[官方公告][9]中,他们提到了 **Fedora 32 beta 工作站版**和**服务器版**以及其他流行版本的可用性。 + +要获取工作站和服务器版本,你必须访问 [Fedora 工作站][10]和 [Fedora 服务器][11]的官方下载页面(取决于你的需求)。 + +![Fedora Download Beta][12] + +打开后,你只需查找如上图所示的标记为 “**Beta!**” 的发行版,然后开始下载。对于其他变体版本,请单击下面的链接以转到各自的下载页面: + +* [Fedora 32 Beta Spins][13] +* [Fedora 32 Beta Labs][14] +* [Fedora 32 Beta ARM][15] + +你是否注意到 Fedora 32 中的其他新功能?你想在这里看到哪些功能?请随时在下面发表评论。 + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/fedora-32/ + +作者:[Ankush Das][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://itsfoss.com/author/ankush/ +[b]: https://github.com/lujun9972 +[1]: https://itsfoss.com/ubuntu-20-04-release-features/ +[2]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2019/11/update_fedora.jpg?ssl=1 +[3]: https://fedoraproject.org/wiki/Changes/EnableEarlyoom#Enable_EarlyOOM +[4]: https://itsfoss.com/swap-size/ +[5]: https://itsfoss.com/gnome-3-36-release/ +[6]: https://gcc.gnu.org/ +[7]: https://fedoraproject.org/wiki/Releases/32/ChangeSet +[8]: https://fedoraproject.org/wiki/Common_F32_bugs +[9]: https://fedoramagazine.org/announcing-the-release-of-fedora-32-beta/ +[10]: https://getfedora.org/workstation/download/ +[11]: https://getfedora.org/server/download/ +[12]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/03/fedora-download-beta.jpg?ssl=1 +[13]: https://spins.fedoraproject.org/prerelease +[14]: https://labs.fedoraproject.org/prerelease +[15]: https://arm.fedoraproject.org/prerelease diff --git a/published/202003/20200319 Manually rotating log files on Linux.md b/published/202003/20200319 Manually rotating log files on Linux.md new file mode 100644 index 0000000000..ae5f7294e3 --- /dev/null +++ b/published/202003/20200319 Manually rotating log files on Linux.md @@ -0,0 +1,151 @@ +[#]: collector: (lujun9972) +[#]: translator: (HankChow) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12038-1.html) +[#]: subject: (Manually rotating log files on Linux) +[#]: via: (https://www.networkworld.com/article/3531969/manually-rotating-log-files-on-linux.html) +[#]: author: (Sandra Henry-Stocker https://www.networkworld.com/author/Sandra-Henry_Stocker/) + +在 Linux 系统中手动滚动日志 +====== + +![](https://img.linux.net.cn/data/attachment/album/202003/25/223932xqibwq5fafx5ao3f.jpg) + +日志滚动log rotation在 Linux 系统上是再常见不过的一个功能了,它为系统监控和故障排查保留必要的日志内容,同时又防止过多的日志造成单个日志文件太大。 + +日志滚动的过程是这样的:在一组日志文件之中,编号最大的(最旧的)一个日志文件会被删除,其余的日志文件编号则依次增大并取代较旧的日志文件,而较新的文件则取代它作为当前的日志文件。这一个过程很容易就可以实现自动化,在细节上还能按需作出微调。 + +使用 `logrotate` 命令可以手动执行日志滚动的操作。本文将要介绍的就是手动进行日志滚动的方法,以及预期产生的结果。 + +文中出现的示例适用于 Ubuntu 等 Linux 系统,对于其它类型的系统,日志文件和配置文件可能会有所不同,但日志滚动的过程是大同小异的。 + +### 为什么需要滚动日志 + +一般情况下,无需手动旋转日志文件。Linux 系统会每隔一天(或间隔更长的时间)或根据日志文件的大小自动进行一次日志滚动。如果你需要滚动日志以释放存储空间,又或者将某一部分日志从当前的活动中分割出来,这很容易做到,具体要取决于文件滚动规则。 + +### 一点背景介绍 + +在 Linux 系统安装完成后就已经有很多日志文件被纳入到日志滚动的范围内了。另外,一些应用程序在安装时也会为自己产生的日志文件设置滚动规则。一般来说,日志滚动的配置文件会放置在 `/etc/logrotate.d`。如果你想了解日志滚动的详细实现,可以参考[这篇以前的文章][4]。 + +在日志滚动的过程中,活动日志会以一个新名称命名,例如 `log.1`,之前被命名为 `log.1` 的文件则会被重命名为 `log.2`,依此类推。在这一组文件中,最旧的日志文件(假如名为 `log.7`)会从系统中删除。日志滚动时文件的命名方式、保留日志文件的数量等参数是由 `/etc/logrotate.d` 目录中的配置文件决定的,因此你可能会看到有些日志文件只保留少数几次滚动,而有些日志文件的滚动次数会到 7 次或更多。 + +例如 `syslog` 在经过日志滚动之后可能会如下所示(注意,行尾的注释部分只是说明滚动过程是如何对文件名产生影响的): + +``` +$ ls -l /var/log/syslog* +-rw-r----- 1 syslog adm 128674 Mar 10 08:00 /var/log/syslog <== 新文件 +-rw-r----- 1 syslog adm 2405968 Mar 9 16:09 /var/log/syslog.1 <== 之前的 syslog +-rw-r----- 1 syslog adm 206451 Mar 9 00:00 /var/log/syslog.2.gz <== 之前的 syslog.1 +-rw-r----- 1 syslog adm 216852 Mar 8 00:00 /var/log/syslog.3.gz <== 之前的 syslog.2.gz +-rw-r----- 1 syslog adm 212889 Mar 7 00:00 /var/log/syslog.4.gz <== 之前的 syslog.3.gz +-rw-r----- 1 syslog adm 219106 Mar 6 00:00 /var/log/syslog.5.gz <== 之前的 syslog.4.gz +-rw-r----- 1 syslog adm 218596 Mar 5 00:00 /var/log/syslog.6.gz <== 之前的 syslog.5.gz +-rw-r----- 1 syslog adm 211074 Mar 4 00:00 /var/log/syslog.7.gz <== 之前的 syslog.6.gz +``` + +你可能会发现,除了当前活动的日志和最新一次滚动的日志文件之外,其余的文件都已经被压缩以节省存储空间。这样设计的原因是大部分系统管理员都只需要查阅最新的日志文件,其余的日志文件压缩起来,需要的时候可以解压查阅,这是一个很好的折中方案。 + +### 手动日志滚动 + +你可以这样执行 `logrotate` 命令进行手动日志滚动: + +``` +$ sudo logrotate -f /etc/logrotate.d/rsyslog +``` + +值得一提的是,`logrotate` 命令使用 `/etc/logrotate.d/rsyslog` 这个配置文件,并通过了 `-f` 参数实行“强制滚动”。因此,整个过程将会是: + +- 删除 `syslog.7.gz`, +- 将原来的 `syslog.6.gz` 命名为 `syslog.7.gz`, +- 将原来的 `syslog.5.gz` 命名为 `syslog.6.gz`, +- 将原来的 `syslog.4.gz` 命名为 `syslog.5.gz`, +- 将原来的 `syslog.3.gz` 命名为 `syslog.4.gz`, +- 将原来的 `syslog.2.gz` 命名为 `syslog.3.gz`, +- 将原来的 `syslog.1.gz` 命名为 `syslog.2.gz`, +- 但新的 `syslog` 文件不一定必须创建。 + +你可以按照下面的几条命令执行操作,以确保文件的属主和权限正确: + +``` +$ sudo touch /var/log/syslog +$ sudo chown syslog:adm /var/log/syslog +$ sudo chmod 640 /var/log/syslog +``` + +你也可以把以下这一行内容添加到 `/etc/logrotate.d/rsyslog` 当中,由 `logrotate` 来帮你完成上面三条命令的操作: + +``` +create 0640 syslog adm +``` + +整个配置文件的内容是这样的: + +``` +/var/log/syslog +{ +rotate 7 +daily +missingok +notifempty +create 0640 syslog adm <== +delaycompress +compress +postrotate +/usr/lib/rsyslog/rsyslog-rotate +endscript +} +``` + +下面是手动滚动记录用户登录信息的 `wtmp` 日志的示例。由于 `/etc/logrotate.d/wtmp` 中有 `rotate 2` 的配置,因此系统中只保留了两份 `wtmp` 日志文件。 + +滚动前: + +``` +$ ls -l wtmp* +-rw-r----- 1 root utmp 1152 Mar 12 11:49 wtmp +-rw-r----- 1 root utmp 768 Mar 11 17:04 wtmp.1 +``` + +执行滚动命令: + +``` +$ sudo logrotate -f /etc/logrotate.d/wtmp +``` + +滚动后: + +``` +$ ls -l /var/log/wtmp* +-rw-r----- 1 root utmp 0 Mar 12 11:52 /var/log/wtmp +-rw-r----- 1 root utmp 1152 Mar 12 11:49 /var/log/wtmp.1 +-rw-r----- 1 root adm 99726 Feb 21 07:46 /var/log/wtmp.report +``` + +需要知道的是,无论发生的日志滚动是自动滚动还是手动滚动,最近一次的滚动时间都会记录在 `logrorate` 的状态文件中。 + +``` +$ grep wtmp /var/lib/logrotate/status +"/var/log/wtmp" 2020-3-12-11:52:57 +``` + +-------------------------------------------------------------------------------- + +via: https://www.networkworld.com/article/3531969/manually-rotating-log-files-on-linux.html + +作者:[Sandra Henry-Stocker][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.networkworld.com/author/Sandra-Henry_Stocker/ +[b]: https://github.com/lujun9972 +[1]: https://www.flickr.com/photos/klif/4244284159/in/photolist-7t44P6-oPFpsr-a8c5W-gWNZ6-32EEo4-cjdxqy-diHaq9-8DYZWf-gWNWM-bgLApc-hBt94C-cj71kY-PMESV-dZBcCU-pSqgNM-51eKHq-EecbfS-osGNau-KMUx-nFaWEL-cj71PE-HFVXn-gWNWs-85HueR-8QpDh8-kV1dEc-76qYSV-5YnxuS-gWNXr-dYoQ5w-dzj1j3-3AJyd-mHbaWF-q2fTri-e9bFa6-nJyvfR-4PnMyH-gWNZr-8VUtGS-gWNWZ-ajzUd4-2hAjMk-gWW3g-gWP11-dwYbH5-4XMew-cj71B1-ica9kJ-5RonM6-8z5tGL +[2]: https://creativecommons.org/licenses/by/2.0/legalcode +[3]: https://www.networkworld.com/newsletters/signup.html +[4]: https://www.networkworld.com/article/3218728/how-log-rotation-works-with-logrotate.html +[5]: https://www.networkworld.com/blog/itaas-and-the-corporate-storage-technology/?utm_source=IDG&utm_medium=promotions&utm_campaign=HPE22140&utm_content=sidebar (ITAAS and Corporate Storage Strategy) +[6]: https://www.facebook.com/NetworkWorld/ +[7]: https://www.linkedin.com/company/network-world diff --git a/published/202003/20200322 Linus Torvalds- Advice on Working From Home during Coronavirus Lockdown.md b/published/202003/20200322 Linus Torvalds- Advice on Working From Home during Coronavirus Lockdown.md new file mode 100644 index 0000000000..753398999f --- /dev/null +++ b/published/202003/20200322 Linus Torvalds- Advice on Working From Home during Coronavirus Lockdown.md @@ -0,0 +1,106 @@ +[#]: collector: (lujun9972) +[#]: translator: (wxy) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12029-1.html) +[#]: subject: (Linus Torvalds’ Advice on Working From Home during Coronavirus Lockdown) +[#]: via: (https://itsfoss.com/torvalds-remote-work-advice/) +[#]: author: (Ankush Das https://itsfoss.com/author/ankush/) + +Linus Torvalds 关于在冠状病毒禁足期间在家工作的建议 +====== + +在冠状病毒爆发期间,我们中的许多人都在室内自我隔离。[ZDNet][1] 特此与 Linus Torvalds 进行了专题采访,讨论了他对冠状病毒禁足期间在家工作的看法或想法。 + +如果你还不知道(怎么可能不知道),[Linus Torvalds][2] 是 Linux 的创建者,也是 [Git][3] 的创建者,而所有这一切都是他在家里工作时做的。这是 2016 年的视频,Torvalds 展示了他的家庭办公室: + +- [video](https://img.linux.net.cn/static/video/Linus%20Torvalds%20Guided%20Tour%20of%20His%20Home%20Office-SOXeXauRAm0.mp4) + +因此,在本文中,我将分享我关注的一些主要要点,以及来自 Linus Torvalds 接受 ZDNet [Steven J. Vaughan-Nichols][4] 采访互动时的回应。 + +### 消除对人际交往缺失的恐惧 + +Linus 提到,几年前刚开始在家工作时,他担心过缺少人与人之间的互动,包括去办公室、与人互动或哪怕只是出去吃个午餐。 + +有趣的是,他似乎并没有错过任何东西,他更喜欢在家中没有人际交往的时间。 + +当然,将自己与人际互动隔离开并不是最好的事情 ,但在目前看来,这是一件好事。 + +### 利用在家工作的优势 + +![][5] + +就像我们是完全远程操作一样,你可以做很多事情,而无需实际在办公室。 + +不要忘记,你可以随心所欲地养猫,我有 6 只猫,我知道这很困难(*哈哈*)。 + +而且,正如 Linus 所提到的,远程工作的真正优势在于“灵活性”。你不一定需要朝九晚五甚至更长的时间坐在办公桌前。从技术上讲,你可以在工作中自由休息,并在家中做你想做的任何事情。 + +换句话说,Linus 建议**不要在你的家中重新搞一个办公室**,这比去办公室还差。 + +### 高效沟通是关键 + +![][6] + +虽然你可以在一天之中召开几次会议(视频会议或音频呼叫),但这真的有必要吗? + +对于某些人来说,这可能很重要,但是你应该通过简化和整理内容来尽量减少会议花费的时间。 + +或者,按照 Linus 的建议,最好有个电子邮件列表来记录事情,以确保一切各司其职,这就是 [Linux 内核][7] 的运行方式。 + +James Bottomley 是 [IBM 研究院][8]的杰出工程师,也是资深 Linux 内核开发人员,他也建议你重新阅读你的文字以确保发送的准确信息不会被人不小心跳过。 + +就个人而言,出于同样的原因,我更喜欢文本而不是语音。实际上,它可以节省你的时间。 + +但是,请记住,你需要只以适当的方式传达必要的信息,而不要使通过文本/电子邮件发送的信息过载。 + +### 追踪你的时间 + +灵活性并不一定意味着你可以减少工作量并泡在社交媒体平台上,除非那就是你的工作。 + +因此,你需要确保充分利用自己的时间。为此,你可以使用多种工具来跟踪你的时间用在什么地方,以及在计算机上花费的时间。 + +你甚至可以将其记录在便签上,以确保你可以将时间高效地分配于工作上。你可以选择使用 [RescueTime][9] 或 [ActivityWatch][10] 来跟踪你在计算机或智能手机上花费的时间。 + +### 和猫(宠物)一起玩 + +![][11] + +不歧视其他宠物,但这就是 Linus Torvalds 提到的。 + +正因为你在家中,你在安排工作或尝试有效利用时间时要做的事情有很多。 + +Linus 坚持认为,每当你感到无聊时,可以在必要时出门获取必需品,也可以与猫(或你的其它宠物)一起玩。 + +### 结语 + +虽然 Linus 还提到了当你在家时没人会评判你,但他的建议似乎是正确的,对于那些在家工作的人来说可能很有用。 + +不仅是因为冠状病毒的爆发,而且如果你打算一直在家工作,应该牢记这些。 + +你如何看待 Linus 的看法呢?你同意他的观点吗? + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/torvalds-remote-work-advice/ + +作者:[Ankush Das][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://itsfoss.com/author/ankush/ +[b]: https://github.com/lujun9972 +[1]: https://www.zdnet.com/article/pet-the-cat-own-the-bathrobe-linus-torvalds-on-working-from-home/ +[2]: https://en.wikipedia.org/wiki/Linus_Torvalds +[3]: https://git-scm.com/ +[4]: https://twitter.com/sjvn +[5]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/03/Work-from-Home-torvalds.jpg?ssl=1 +[6]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/03/torvalds-home-office.jpg?ssl=1 +[7]: https://en.wikipedia.org/wiki/Linux_kernel +[8]: https://www.research.ibm.com/ +[9]: https://www.rescuetime.com/ +[10]: https://activitywatch.net/ +[11]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/03/torvalds-penguins.jpeg?ssl=1 diff --git a/published/202003/20200322 Meet DebianDog - Puppy sized Debian Linux.md b/published/202003/20200322 Meet DebianDog - Puppy sized Debian Linux.md new file mode 100644 index 0000000000..c5b50c7670 --- /dev/null +++ b/published/202003/20200322 Meet DebianDog - Puppy sized Debian Linux.md @@ -0,0 +1,120 @@ +[#]: collector: (lujun9972) +[#]: translator: (robsean) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12059-1.html) +[#]: subject: (Meet DebianDog – Puppy sized Debian Linux) +[#]: via: (https://itsfoss.com/debiandog/) +[#]: author: (John Paul https://itsfoss.com/author/john/) + +体验 DebianDog:Puppy 式的 Debian Linux +====== + +不久前,我偶然发现了一个有趣的 Linux 项目。这个项目旨在为 Debian 和基于 Debian 的系统创建一个小型的现场版 CD,类似于 [Puppy Linux 项目][1] 。让我们看看 DebianDog 。 + +### DebianDog 是什么? + +正如字面所述,[DebianDog][2] “是一个被塑造成一个外观和动作都像 Puppy Linux 的小型 Debian 现场版 CD。没有改动 Debian 结构和方式,Debian 的文档对 DebianDog 来说是完全有效的。你可以使用 `apt-get` 或 synaptic 来访问所有的 Debian 存储库。” + +![DebianDog][3] + +对于那些不熟悉 [Puppy Linux][1] 的人来说,该项目是 “多个 Linux 发行版的一个集合,建立在相同的共享准则之上”。这些准则能够实现快速、小型(300 MB 或更少)、易于使用。这里有为支持 Ubuntu, Slackware 和 Raspbian 软件包构建的 Puppy Linux 变种。 + +DebianDog 和 Puppy Linux 之间最大的不同是,Puppy Linux 有其自己的软件包管理器 [Puppy 软件包管理器][4] 。如上所述,DebianDog 使用 Debian 软件包管理器及其软件包。甚至 DebianDog 网站也试图澄清这一点:“它不是 Puppy Linux,并且也与基于 Debian 的 Puppy 无关。” + +### 为什么一些人使用 DebianDog ? + +安装 DebianDog(或其任何衍生产品)的主要原因是让一台较旧电脑重焕新生。在 DebianDog 上的每个版本都有一个 32 位版本。它们还有更轻量级的桌面环境/窗口管理器,例如 [Openbox][5] 或 [Trinity Desktop][6] 环境。它们中大多数也都有一个 systemd 的可替代版本。它们也安装更轻的应用程序,例如 [PCManFM][7] 。 + +### DebianDog 有哪些可用的变体版本? + +尽管 DebianDog 在本系列中是第一个,但是该项目被称为 ‘Dog Linux’ ,提供各种基于Debian 和 Ubuntu的流行发行版的 ‘Dog 变体’。 + +#### DebianDog Jessie + +DebianDog 的第一个(也是最初的)版本是 DebianDog Jessie。它有两个 [32 位版本][8] ,一个使用 [Joe’s Window Manager (JWM)][9] 作为默认桌面环境,另一个使用 XFCE 作为默认桌面环境。systemd 和 sysvinit 都是可用的。它还有一个 [64 位版本][10]。DebianDog Jessie 基于 Debian 8.0(Jessie)。Debian 8.0 的支持将于 2020 年 6 月 30 日结束,因此安装需谨慎。 + +#### StretchDog + +[StretchDog][12] 基于 Debian 9.0(Stretch)。它有 32 位和 64 位两种版本可用。Openbox 是默认的窗口管理器,但是我们可以切换到 JWM 。Debian 9.0 的支持将于 2022 年 6 月 30 日结束。 + +#### BusterDog + +[BusterDog][13] 是很有趣的。它基于 [Debian 10][14](Buster)。它不使用 systemd,反而像 [AntiX][16] 一样使用 [elogind][15] 。Debian 10.0 的支持将于 2024 年 6 月结束。 + +#### MintPup + +[MintPup][17] 基于 [Linux Mint][18] 17.1。现场版 CD 仅有 32 位版本。你也可以使用 “apt-get 或 synaptic 访问 Ubuntu/Mint 的存储库”。考虑到 Mint 17 已经到了生命的尽头,这一版本必须避免使用。 + +#### XenialDog + +XenialDog 有 [32 位][19]和 [64 位][20] 两种变种,基于 Ubuntu 16.04 LTS 。两个变种都使用 Openbox 作为默认版本,JWM 可选。Ubuntu 16.04 LTS 的支持将于 2021 年 4 月结束, 因此安装需谨慎。 + +#### TrinityDog + +[TrintyDog][21] 有两种变体。一个基于 Debian 8 ,另一个基于 Debian 9 。两种变体都有 32 位版本,并且都使用 [Trinity Desktop Environment][6] ,以此得名。 + +![TrinityDog][11] + +#### BionicDog + +你应该能够从名称猜到。[BionicDog][23] 基于 [Ubuntu 18.04 LTS][24]。主要版本有 32 位和 64 位两个版本,Openbox 是默认的窗口管理器。这里也有一个使用 [Cinnamon desktop][25] 的版本,并且只有 64 位版本。 + +![BionicDog][22] + +### 结束语 + +我喜欢任何 [想让较旧电脑系统有用的 Linux 项目][26]。但是,通过 DebianDog 项目提供的大多数操作系统不再受支持,或者接近它们的生命尽头。从长远来看,这就不那么有用了。 + +**我不建议在你的主计算机上使用它。**在现场版 USB 中或一台闲置的系统上尝试它。此外,如果你想使用较新的基础系统,[你可以创建][27]你自己的现场版 CD 。 + +似乎冥冥中自有天意,我总是在探索鲜为人知的 Linux 发行版的路上艰难地前行,像 [FatDog64][28]、[4M Linux][29] 以及 [Vipper Linux][30] 。虽然我不建议使用它们,但是知晓这些项目的存在的意义总是好的。 + +你对 DebianDog 有什么看法?你最最喜欢的 Puppy 式的操作系统是什么?请在下面的评论区中告诉我们。 + +如果你觉得这篇文章很有趣,请花点时间在社交媒体、黑客新闻或 Reddit 上分享。 + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/debiandog/ + +作者:[John Paul][a] +选题:[lujun9972][b] +译者:[robsean](https://github.com/robsean) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://itsfoss.com/author/john/ +[b]: https://github.com/lujun9972 +[1]: http://puppylinux.com/ +[2]: https://debiandog.github.io/doglinux/ +[3]: https://www.linuxinsider.com/article_images/2017/84328_990x556.jpg +[4]: http://wikka.puppylinux.com/PPM?redirect=no +[5]: http://openbox.org/wiki/Main_Page +[6]: https://www.trinitydesktop.org/ +[7]: https://wiki.lxde.org/en/PCManFM +[8]: https://debiandog.github.io/doglinux/zz01debiandogjessie.html +[9]: https://en.wikipedia.org/wiki/JWM +[10]: https://debiandog.github.io/doglinux/zz02debiandog64.html +[11]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/03/TrinityDog.jpg?ssl=1 +[12]: https://debiandog.github.io/doglinux/zz02stretchdog.html +[13]: https://debiandog.github.io/doglinux/zz03busterdog.html +[14]: https://itsfoss.com/debian-10-buster/ +[15]: https://github.com/elogind/elogind +[16]: https://antixlinux.com/ +[17]: https://debiandog.github.io/doglinux/zz04mintpup.html +[18]: https://linuxmint.com/ +[19]: https://debiandog.github.io/doglinux/zz05xenialdog.html +[20]: https://debiandog.github.io/doglinux/zz05zxenialdog.html +[21]: https://debiandog.github.io/doglinux/zz06-trinitydog.html +[22]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/03/BionicDog.jpg?ssl=1 +[23]: https://debiandog.github.io/doglinux/zz06-zbionicdog.html +[24]: https://itsfoss.com/ubuntu-18-04-released/ +[25]: https://en.wikipedia.org/wiki/Cinnamon_(desktop_environment) +[26]: https://itsfoss.com/lightweight-linux-beginners/ +[27]: https://github.com/DebianDog/MakeLive +[28]: https://itsfoss.com/fatdog64-linux-review/ +[29]: https://itsfoss.com/4mlinux-review/ +[30]: https://itsfoss.com/viperr-linux-review/ +[31]: https://reddit.com/r/linuxusersgroup diff --git a/published/202003/20200322 Purism Librem Mini- A Privacy-First Linux-Based Mini PC.md b/published/202003/20200322 Purism Librem Mini- A Privacy-First Linux-Based Mini PC.md new file mode 100644 index 0000000000..3df6585958 --- /dev/null +++ b/published/202003/20200322 Purism Librem Mini- A Privacy-First Linux-Based Mini PC.md @@ -0,0 +1,107 @@ +[#]: collector: "lujun9972" +[#]: translator: "wxy" +[#]: reviewer: "wxy" +[#]: publisher: "wxy" +[#]: url: "https://linux.cn/article-12042-1.html" +[#]: subject: "Purism Librem Mini: A Privacy-First Linux-Based Mini PC" +[#]: via: "https://itsfoss.com/purism-librem-mini/" +[#]: author: "Ankush Das https://itsfoss.com/author/ankush/" + +Purism Librem Mini:隐私为重的基于 Linux 的微型个人电脑 +====== + +> Purism 推出了一款外形小巧的微型个人电脑 “Librem Mini”,旨在提供隐私和安全性。让我们来看看它的细节。 + +[Purism][1] 以专注于增强用户的数字隐私和安全性的服务或产品而闻名。 + +Purism 自诩为“[社会目地公司][2]Social Purpose Company”,旨在为社会造福,并在这方面提供了多种服务和产品。 + +你可能听说过它的 Librem 系列 [Linux 笔记本电脑][3]、[Librem One][4](加密服务)、[PureOS Linux][5] 和 [Librem 5 Linux 智能手机][6]。现在,他们已经针对想要掌控自己的隐私和安全性的用户推出了小尺寸微型个人电脑。 + +### Librem Mini: Purism 的微型个人电脑 + +![Librem Mini PC][7] + +[Purism][1] 的 [Librem Mini][8] 旨在成为小型、轻便且功能强大的微型个人电脑。 + +当然,已经有很多[基于 Linux 的微型个人电脑][9]了,但是 Librem Mini 专门关注于其用户的隐私和安全性。它随附了 [PureOS][5]、[Pureboot][10] 和 [Librem Key][11] 支持。 + +基本配置将以 699 美元的价格提供。这比大多数其他微型个人电脑要贵。但是,与大多数其他产品不同,Librem Mini 并不是又一个 [Intel NUC][12]。 那么,它提供了什么呢? + +### Librem Mini 的规格 + +![][13] + +这是它的规格表: + + * Intel Core i7-8565U(Whiskey Lake),主动(风扇)冷却,4 核 8 线程最高频率 4.6GHz + * Intel UHD Graphics 620 + * RAM: 最多 64 GB DDR4 2400 MHz(2 个 SO-DIMM 插槽) + * 1 SATA III 6GB/s SSD/HDD(7mm) + * 1 M.2 SSD(SATA III/NVMe x4) + * 1 HDMI 2.0 4K @ 60Hz + * 1 DisplayPort 1.2 4K @ 60Hz + * 4 x USB 3.0 + * 2 x USB 2.0 + * 1 x Type-C 3.1 + * 3.5mm 音频插孔(麦克风输入和耳机插孔合一) + * 1 RJ45 Gigabit Ethernet LAN + * WiFi 802.11n(2.4/5.0 GHz),可选 Atheros ATH9k 模块 + * 包括在 WiFi 模块的蓝牙 4.0(可选) + * 重量:1 公斤(2.2 磅) + * 尺寸:12.8 厘米(5.0 英寸) x 12.8 厘米(5.0 英寸) x 3.8 厘米(1.5 英寸) + +我不知道他们为什么决定采用 Intel 的 8 代处理器,而市场上已经出现了 10 代处理器。也许是因为 Whiskey Lake 是第 8 代处理器的最新产品。 + +是的,他们已禁用并中止了 Intel 的管理引擎,所以仍然可以采用这个产品。 + +除此之外,你还应该记住,这款微型个人电脑在提供全盘加密的同时具有检测硬件和软件篡改的功能。 + +而且,当然,用的是 Linux。 + +### 价格和供应 + +![Librem Mini from the back][14] + +具有 8 Gigs RAM 和 256 GB SSD 的基本配置将需要花费 $699。而且,如果你想要最强大的配置,其价格轻松就升高到 $3000。 + +他们的预定销售额目标是 $50,000,并且他们计划在达到预定目标后一个月内开始发货。 + +因此,如果你要是现在[预订][15]的话,不要指望很快就会开始发货。因此,我建议你关注 [Librem Mini 产品页面][8]的预定目标。 + +### 总结 + +如果你正在寻找一台微型个人电脑(不是专门为隐私和安全而设计的),则可以看看我们的[基于 Linux 的最佳微型个人电脑][9]列表,以获取更多建议。 + +对于普通消费者而言,Librem Mini 绝对听起来很昂贵。对于隐私发烧友来说,它仍然是一个不错的选择。 + +你怎么看?让我知道你的想法! + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/purism-librem-mini/ + +作者:[Ankush Das][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://itsfoss.com/author/ankush/ +[b]: https://github.com/lujun9972 +[1]: https://puri.sm/ +[2]: https://puri.sm/about/social-purpose/ +[3]: https://itsfoss.com/get-linux-laptops/ +[4]: https://itsfoss.com/librem-one/ +[5]: https://itsfoss.com/pureos-convergence/ +[6]: https://itsfoss.com/librem-linux-phone/ +[7]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/03/librem-mini-pc.png?ssl=1 +[8]: https://puri.sm/products/librem-mini/ +[9]: https://itsfoss.com/linux-based-mini-pc/ +[10]: https://docs.puri.sm/PureBoot.html +[11]: https://puri.sm/products/librem-key/ +[12]: https://itsfoss.com/intel-nuc-essential-accessories/ +[13]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/03/librem-mini-pc-1.png?ssl=1 +[14]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/03/librem-mini-back.png?ssl=1 +[15]: https://shop.puri.sm/shop/librem-mini/ diff --git a/published/202003/20200327 How open source software is fighting COVID-19.md b/published/202003/20200327 How open source software is fighting COVID-19.md new file mode 100644 index 0000000000..28429de34e --- /dev/null +++ b/published/202003/20200327 How open source software is fighting COVID-19.md @@ -0,0 +1,108 @@ +[#]: collector: (lujun9972) +[#]: translator: (HankChow) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12057-1.html) +[#]: subject: (How open source software is fighting COVID-19) +[#]: via: (https://opensource.com/article/20/3/open-source-software-covid19) +[#]: author: (Jeff Stern https://opensource.com/users/jeffstern) + +开源软件在应对新冠病毒中的贡献 +====== + +> 在新冠疫情爆发之际,涌现了数以千计的开源项目,今天我们来了解其中四个。 + +![](https://img.linux.net.cn/data/attachment/album/202003/30/210613wchojyc5rrwh8y5k.jpg) + +在当前紧张的疫情环境下,保持专注和积极性是一个很大的挑战。而研究开源社区如何应对这一次疫情爆发,对于我来说却成为了一种宣泄。 + +从今年一月底开始,整个开源社区已经贡献了数以千计关于冠状病毒或新冠病毒的[开源软件仓库][2],其中涉及的内容包括但不限于数据集、模型、可视化、Web 应用、移动应用,且大多数都使用了 JavaScript 和 Python 编写。 + +之前我们分享过一些关于[开源硬件创客们在帮助][3]遏制冠状病毒传播方面做的贡献,现在将继续分享四个由开源社区作出的应对冠状病毒和新冠病毒的项目,这体现了开发者们和整个开源社区在当下对整个世界的影响力。 + +### 1. PennSignals:CHIME + +![CHIME by PennSignals][4] + +新冠病毒流行病医院影响模型COVID-19 Hospital Impact Model for Epidemics([CHIME][5])是由宾夕法尼亚大学 Penn Medicine 机构的数据科学家们建立的开源在线应用,它可以让医院更好地了解本次新型冠状病毒对医院需求的影响。 + +医院的管理人员可以通过 CHIME 来大致预测未来几天和几周内将会有多少患者需要住院治疗,并推算 ICU 和呼吸机的需求量。只需要输入当前住院患者数以及一些相关的变量,就可以看到未来几天内需求的变化情况。 + +CHIME 主要使用 Python 开发,并通过 [Pandas][6] 这个开源库实现了大部分的数据转换和数值计算,最终得出相关的估计值。Pandas 的背后有一个强大的团队进行支持,它是在数据分析方面被广泛使用的 Python 库之一。和很多其它的开源项目一样,Pandas 团队的收入大部分来源于[用户的资金支持][7]。 + +### 2. Locale.ai:实时新冠病毒可视化 + +![Locale.ai COVID-19 visualization][8] + +实时显示世界各地病例数量分布的地图可以让我们直观了解新冠病毒的规模和扩散程度。Locale.ai 就开发了这样一个开源、可交互的[新冠病毒已知病例可视化分布图][9],这个图会根据最新的可靠数据实时进行更新。 + +这个项目有趣的地方在于,它的数据是是通过 GitHub 用户 ExpDev07 创建的[开源 API][10] 进行检索的,这个 API 的数据来源是[约翰·霍普金斯大学的开源数据集][11],而约翰·霍普金斯大学这份聚合了多个来源的数据集则是 GitHub 上新冠病毒相关的最受欢迎的项目。这就是开源领域中分支带来的一大好处。 + +Locale.ai 的这个图表通过 [Vue.js][11] 开发。Vue.js 是一个在 Web 应用开发方面非常流行的框架,它是由[尤雨溪][12]创造并维护的。值得一提的是,尤雨溪是少数以全职参与开源项目维护的人之一。 + +### 3. BlankerL:DXY-COVID-19-Crawler + +![BlankerL DXY-COVID-19-Crawler][13] + +[DXY-COVID-19-Crawler][14] 建立于今年 1 月份,是开源社区对新冠病毒最早发起响应的项目之一。当时该病毒主要在中国范围内传播,中国医学界通过[丁香园][15]网站来进行病例的报告和跟踪。为了使这些疫情信息具有更高的可读性和易用性,GitHub 用户 BlankerL 开发了一个爬虫,系统地从丁香园网站获取数据,并通过 API 和数据仓库的方式对外公开。这些数据也被学术研究人员用于研究病毒传播趋势和制作相关的可视化图表。到目前为止,DXY-COVID-19-Crawler 这个项目已经获得了超过 1300 个星标和近 300 次的复刻。 + +BlankerL 使用 Python 和 [Beautiful Soup][16] 库开发了这个爬虫。Beautiful Soup 是 Python 开发者用于从页面 HTML DOM 中提取信息的库,它由 Leonard Richardson 维护,这位作者另外还全职担任软件架构师。 + +### 4. 东京新冠病毒工作组网站 + +![City of Tokyo's COVID-19 Task Force site][17] + +世界各地很多城市都在网络上持续更新当地的新冠病毒信息。东京都政府则为此创建了一个[综合性的网站][18],让东京当地居民、在东京设有办事处的公司以及到东京的游客了解最新情况,并采取相应的预防措施。 + +这个网站的不同之处在于它是由东京都政府[开源][19]的。这个项目受到了来自 180 多名用户的贡献,日本的[长野市、千叶市、福冈市][20]还对这个网站进行了改造。这个项目是城市公共建设更好地服务大众的有力示范。 + +这个开源网站也使用了很多开源技术。通过 [Tidelift][21],我留意到项目中存在了 1365 个依赖项,而这都是由 38 个由开发者明确使用的直接依赖项所依赖的。也就是说,超过一千多个开源项目(包括 [Nuxt.js][22]、[Prettier][23]、[Babel][24]、[Ajv][25] 等等)都为东京向市民共享信息提供了帮助。 + +![Dependencies in Tokyo's COVID-19 Task Force site][26] + +### 其它项目 + +除此以外,还有很多[应对新冠病毒的重要项目][27]正在公开进行当中。在这次研究中,开源社区应对流行病以及利用开源技术开展工作的方式让我深受启发。接下来的一段时间都是应对疫情的关键时期,我们也可以继续在开源社区中寻找到更大的动力。 + +如果你也参与到了新冠病毒相关的开源项目当中,欢迎在评论区分享。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/3/open-source-software-covid19 + +作者:[Jeff Stern][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/jeffstern +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/Medical%20costs.jpg?itok=ke57j6cs (symbols showing healthcare) +[2]: https://github.com/search?q=coronavirus+OR+covid19 +[3]: https://linux.cn/article-12047-1.html +[4]: https://opensource.com/sites/default/files/uploads/chime_pennsignals.png (CHIME by PennSignals) +[5]: http://penn-chime.phl.io/ +[6]: https://tidelift.com/subscription/pkg/pypi-pandas +[7]: https://pandas.pydata.org/about/sponsors.html +[8]: https://opensource.com/sites/default/files/uploads/locale-ai-visualization.png (Locale.ai COVID-19 visualization) +[9]: https://github.com/localeai/covid19-live-visualization +[10]: https://github.com/CSSEGISandData/COVID-19 +[11]: https://tidelift.com/subscription/pkg/npm-vue +[12]: https://blog.tidelift.com/vuejs-evan-you-javascript-framework +[13]: https://opensource.com/sites/default/files/uploads/dxy-covid-19-crawler.png (BlankerL DXY-COVID-19-Crawler) +[14]: https://github.com/BlankerL/DXY-COVID-19-Crawler +[15]: https://dxy.cn +[16]: https://blog.tidelift.com/beautiful-soup-is-now-part-of-the-tidelift-subscription +[17]: https://opensource.com/sites/default/files/uploads/tokyo-covid19-task-force.png (City of Tokyo's COVID-19 Task Force site) +[18]: https://stopcovid19.metro.tokyo.lg.jp/en/ +[19]: https://github.com/tokyo-metropolitan-gov/covid19 +[20]: https://github.com/tokyo-metropolitan-gov/covid19/issues/1802 +[21]: https://tidelift.com/ +[22]: https://tidelift.com/subscription/pkg/npm-nuxt +[23]: https://blog.tidelift.com/prettier-is-now-part-of-the-tidelift-subscriptions +[24]: https://tidelift.com/subscription/pkg/npm-babel +[25]: https://blog.tidelift.com/ajv-is-now-part-of-the-tidelift-subscription +[26]: https://opensource.com/sites/default/files/uploads/tokyo-dependencies.png (Dependencies in Tokyo's COVID-19 Task Force site) +[27]: https://github.com/soroushchehresa/awesome-coronavirus diff --git a/published/202004/20190107 Different Ways To Update Linux Kernel For Ubuntu.md b/published/202004/20190107 Different Ways To Update Linux Kernel For Ubuntu.md new file mode 100644 index 0000000000..50e1bb7e16 --- /dev/null +++ b/published/202004/20190107 Different Ways To Update Linux Kernel For Ubuntu.md @@ -0,0 +1,220 @@ +[#]: collector: "lujun9972" +[#]: translator: "mr-ping" +[#]: reviewer: "wxy" +[#]: publisher: "wxy" +[#]: url: "https://linux.cn/article-12125-1.html" +[#]: subject: "Different Ways To Update Linux Kernel For Ubuntu" +[#]: via: "https://www.ostechnix.com/different-ways-to-update-linux-kernel-for-ubuntu/" +[#]: author: "SK https://www.ostechnix.com/author/sk/" + +升级 Ubuntu Linux 内核的几种不同方法 +====== + +![](https://www.ostechnix.com/wp-content/uploads/2019/01/ubuntu-linux-kernel-720x340.png) + +这个指南里介绍了 7 种为 Ubuntu 升级 Linux 内核的不同方法。这 7 种方法里,有 5 种需要重启系统来使新内核生效,其他两种则不用。升级之前,**强烈建议你将重要数据进行备份!** 这里提到的所有方法只在 Ubuntu 中测试过。我们并不确定这些方法是不是也能适用于其他 Ubuntu 的特色发行版(如: Xubuntu)和衍生发行版(如:Linux Mint)。 + +### 第一部分:需要重启的内核升级 + +以下方法需要你重启系统以便新的内核生效。以下所有方法都建议在个人系统或测试系统中进行。重要的事儿再说一遍,请备份好你 Ubuntu 中的重要数据、配置文件和其他重要的东西。 + +#### 方法 1 - 使用 dpkg 升级 Linux 内核(手动方式) + +这个方法可以帮助你从 [kernel.ubuntu.com][1] 网站手动下载可用的最新 Linux 内核。如果你打算安装最新版(而不是稳定版或者正式发布版),那这种方法对你会很有用。从以上链接下载 Linux 内核版本。编写这个指南的时候,最新的可用版本是 **5.0-rc1**,最新的稳定版是 **v4.20**。 + +![][3] + +点击你所选择的 Linux 内核版本链接,找到你对应的架构(“Build for XXX”)的那部分。然后下载符合以下格式的两个文件(其中 X.Y.Z 是最高版本号): + + 1. linux-image-*X.Y.Z*-generic-*.deb + 2. linux-modules-X.Y.Z*-generic-*.deb + +在终端中改变到文件所在的目录,然后执行此命令手动安装内核: + +``` +$ sudo dpkg --install *.deb +``` + +重启系统,使用新内核: + +``` +$ sudo reboot +``` + +检查是否如你所愿: + +``` +$ uname -r +``` + +对于分步的说明,请查看下列链接中对应的部分。 + ++ [在基于 RPM 和 DEB 的系统中安装 Linux 内核 4.15](https://www.ostechnix.com/install-linux-kernel-4-15-rpm-deb-based-systems/) + +以上的指南是针对的是 4.15 版本,不过安装最新版本的所有的步骤都是一样的。 + +**优势:** 不必联网(你可以从任何系统中下载 Linux 内核来使用) + +**缺点:** 手动更新,需要重启系统。 + +#### 方法 2 - 用 apt-get 来升级 Linux 内核(推荐方法) + +这是在类 Ubuntu 系统中升级 Linux 内核的推荐方法。不同于上一个方法,这种方法会从 Ubuntu 官方仓库下载、安装内核版本,而不是从 **kernel.ubuntu.com**网站。 + +要升级包括内核的整个系统,只需要执行: + +``` +$ sudo apt-get update +$ sudo apt-get upgrade +``` + +如果只希望升级内核,运行: + +``` +$ sudo apt-get upgrade linux-image-generic +``` + +**优势:** 简单。推荐方法。 + +**缺点:** 需要联网,需要重启。 + +从官方库中升级内核是最接近开箱即用的方法,并且不会出什么问题。如果是生产环境的系统,这是最为推荐的升级 Linux 内核的方法。 + +方法 1 和方法 2 都需要用户去介入到升级 Linux 内核的过程中。而下边的方法(3、 4、 5)则几乎是全自动的。 + +#### 方法 3 - 使用 Ukuu 升级 Linux 内核 + +**Ukuu**是一个 Gtk GUI 和命令行工具,它可以从 kernel.ubuntu.com 下载最新的 Linux 主线内核,并自动安装到你的 Ubuntu 桌面版和服务器版中。Ukku 不仅简化了手动下载和安装新内核的过程,同时也会帮助你安全地移除旧的和不再需要的内核。更多细节可以参照以下指南。 + ++ [Ukuu:在 Ubuntu 系统中安装和升级 Linux 内核的简单方法](https://www.ostechnix.com/ukuu-an-easy-way-to-install-and-upgrade-linux-kernel-in-ubuntu-based-systems/) + +**优势:** 易于安装使用。自动安装主线内核。 + +**缺点:** 需要联网,需要重启。 + +#### 方法 4 - 使用 UKTools 升级 Linux 内核 + +跟 Ukuu 差不多,**UKTools** 也会从 kernel.ubuntu.com 网站获取最新的稳定内核并且自动安装到 Ubuntu 以及类似于 Linux Mint 的延伸发行版中。关于UKTools的更多详情,请参见下面的链接。 + ++ [UKTools:升级Ubuntu及其衍生产品中的最新Linux内核](https://www.ostechnix.com/uktools-upgrade-latest-linux-kernel-in-ubuntu-and-derivatives/) + +**优势:** 简单,自动。 + +**缺点:** 需要联网,需要重启。 + +#### 方法 5 - 使用 Linux 内核实用程序更新 Linux 内核 + +**Linux 内核实用程序**是目前另一个用于升级类 Ubuntu 系统 Linux 内核的程序。实质上,它是一个由一系列 Bash 脚本构成的合集,用于编译并且可以选择性地为 Debian(LCTT 译注:Ubuntu 的上游发行版)及其衍生发行版升级内核。它包含三个实用程序,一个用于手动编译、安装来自于 [http://www.kernel.org][4] 网站的源码内核,另一个用于安装来自 网站的预编译的内核,第三个脚本用于移除旧内核。更多细节请浏览以下链接。 + ++ [Linux 内核实用程序:编译和更新最新的 Linux 内核的脚本,适用于 Debian 及其衍生产品](https://www.ostechnix.com/linux-kernel-utilities-scripts-compile-update-latest-linux-kernel-debian-derivatives/) + +**优势:** 简单,自动。 + +**缺点:** 需要联网,需要重启。 + +### 第二部分:无需重启的内核升级 + +我之前说过,上边所有的方法都需要你重启服务器(LCTT 译注:也可以是桌面版)来启用新内核。如果是个人系统或者测试系统,可以这么办。但对于无法停机的生产环境系统该怎么办呢?一点问题没有,这时候实时补丁livepatching就派上用场了。 + +**实时补丁**(或者叫热补丁)允许你在不重启的情况下安装 Linux 更新或补丁,使你的服务器处于最新的安全级别。这对 web 主机、游戏服务器这类需要不间断在线的服务器来说是很有价值的。事实上,任何情况下,服务器都应该保持在不间断运行的状态下。由于 Linux 供应商只会在出于修复安全漏洞的目的下维护补丁,所以如果安全性是你最关注的问题时,这种方式再适合不过了。 + +以下两种方法不需要重启,对于生产环境和执行关键任务的 Ubuntu 服务器的 Linux 内核更新非常有用。 + +#### 方法 6 – 使用 Canonical 实时补丁服务来更新 Linux 内核 + +![][5] + +[Canonical 实时补丁服务][6]可以在不需要重启 Ubuntu 系统的情况下自动应用内核更新、补丁和安全补丁。它可以减少Ubuntu系统的停机时间,并保证系统的安全。Canonical 实时补丁服务可以在安装过程当中或安装之后进行设置。如果你使用的是 Ubuntu 桌面版,软件更新器会自动检查内核补丁的更新,并通知你。在基于控制台的系统中,则需要你定期运行 `apt-get update` 命令来进行升级。由于需要你手动运行 `apt-get upgrade` 命令它才会安装内核的安全补丁,所以算是半自动的。 + +实时补丁对三个及以下系统免费,如果多于三个,你需要升级成名为 **Ubuntu Advantage** 的企业支持方案套件。这个套件包括 **Kernel 实时补丁**及以下服务: + + * 扩展安全维护 – Ubuntu 生命周期后的重要安全更新 + * Landscape – 针对大规模使用 Ubuntu 的系统管理工具 + * 知识库 – 由 Ubuntu 专家撰写的私人文章和教程 + * 电话和网站支持 + +**价格** + +Ubuntu Advantage 包含三种付费计划,即基本计划、标准计划和高级计划。最基础的计划(基本计划)从 **单物理节点 225 美元/年**和**单VPS 75美元/年**开始计价。对于 Ubuntu 服务器版和桌面版看上去没有按月订阅。你可以在[此处][7]浏览所有计划的细节信息。 + +**优势:** 简单。半自动化。无需重启。支持三个免费系统。 + +**缺点:** 4 个以上主机的话非常昂贵。没有补丁回滚。 + +##### 开启 Canonical 实时补丁 + +如果你想在安装后设置实时补丁服务,依照以下方法逐步执行: + +从 [https://auth.livepatch.canonical.com/][8] 获取一个密钥。 + +``` +$ sudo snap install canonical-livepatch +$ sudo canonical-livepatch enable your-key +``` + +#### 方法 7 - 使用 KernelCare 升级 Linux 内核 + +![][9] + +[KernelCare][10] 是最新的实时补丁方案。它是 [CloudLinux][11] 推出的产品。KernelCare 可以运行在 Ubuntu 和其他的 Linux 发行版中。它每四个小时检查一遍补丁的发布,并在无需确认的情况下安装它们。如果更新后存在问题,可以将补丁进行回滚。 + +**价格** + +费用,每台服务器:**4 美元/月**,**45 美元/年**。 + +跟 Ubuntu 实时补丁相比,KernelCare 看起来非常便宜、实惠。好的方面在于**也可以按月订阅**。另一个前者不具备的功能是支持其他 Linux 发行版,如 Red Hat、CentOS、Debian、Oracle Linux、Amazon Linux 以及 OpenVZ、Proxmox 等虚拟化平台。 + +你可以在[此处][12]了解 KernelCare 的所有特性和简介,以及所有的付费计划的细节。 + +**优势:** 简单。全自动化。覆盖范围更广的操作系统。补丁回滚。无需重启。对非营利组织提供免费许可。价格低廉。 + +**缺点:** 不是免费的(除了30天的试用期)。 + +##### 开启 KernelCare 服务 + +在 [https://cloudlinux.com/kernelcare-free-trial5][14] 获取一个 30 天免费试用密钥。 + +执行以下命令开启 KernelCare 并注册秘钥。 + +``` +$ sudo wget -qq -O - https://repo.cloudlinux.com/kernelcare/kernelcare_install.sh | bash +$ sudo /usr/bin/kcarectl --register KEY +``` + +如果你正在寻找一种经济实惠且可靠的商业服务来保持 Linux 服务器上的 Linux 内核更新,那么 KernelCare 是个不错的选择。 + +*由来自 Cloud Linux 的技术撰稿人和内容作者 Paul A. Jacobs 提供。* + +到此,希望这边文章能对你有所帮助。如果你觉得还有其他的工具和方法需要列在这里,可以在留言区给我们留言。我会根据反馈检查和更新这篇指南的。 + +接下来会有更多好东西给大家呈现,敬请期待。 + +Cheers! + +-------------------------------------------------------------------------------- + +via: https://www.ostechnix.com/different-ways-to-update-linux-kernel-for-ubuntu/ + +作者:[SK][a] +选题:[lujun9972][b] +译者:[mr-ping](https://github.com/mr-ping) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://www.ostechnix.com/author/sk/ +[b]: https://github.com/lujun9972 +[1]: http://kernel.ubuntu.com/~kernel-ppa/mainline/ +[2]: data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7 +[3]: http://www.ostechnix.com/wp-content/uploads/2019/01/Ubuntu-mainline-kernel.png +[4]: http://www.kernel.org +[5]: http://www.ostechnix.com/wp-content/uploads/2019/01/Livepatch.png +[6]: https://www.ubuntu.com/livepatch +[7]: https://www.ubuntu.com/support/plans-and-pricing +[8]: https://auth.livepatch.canonical.com/ +[9]: http://www.ostechnix.com/wp-content/uploads/2019/01/KernelCare.png +[10]: https://www.kernelcare.com/ +[11]: https://www.cloudlinux.com/ +[12]: https://www.kernelcare.com/update-kernel-linux/ +[13]: https://www.kernelcare.com/pricing/ +[14]: https://cloudlinux.com/kernelcare-free-trial5 diff --git a/published/202004/20190116 Best Audio Editors For Linux.md b/published/202004/20190116 Best Audio Editors For Linux.md new file mode 100644 index 0000000000..a6977b7d73 --- /dev/null +++ b/published/202004/20190116 Best Audio Editors For Linux.md @@ -0,0 +1,142 @@ +[#]: collector: (lujun9972) +[#]: translator: (MFGJT) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12095-1.html) +[#]: subject: (Best Audio Editors For Linux) +[#]: via: (https://itsfoss.com/best-audio-editors-linux) +[#]: author: (Ankush Das https://itsfoss.com/author/ankush/) + +Linux 上的最佳音频编辑工具推荐 +====== + +在 Linux 上,有很多种音频编辑器可供你选用。不论你是一个专业的音乐制作人,还是只想学学怎么做出超棒的音乐的爱好者,这些强大的音频编辑器都是很有用的工具。 + +对于专业级的使用,我总是建议使用 [DAW][1](数码音频工作站)。但并不是每个人都需要全部的功能,所以你也应该了解一些最简单的音频编辑器。 + +在本文中,我们将讨论几款 DAW 和基础的音频编辑器,而且它们都是在 Linux 和(可能)其它操作系统上可以使用的**自由开源**的解决方案。 + +### Linux 上的最佳音频编辑器 + +![Best audio editors and DAW for Linux][2] + +我们不会关注 DAW 提供的所有功能,而只是关注基本的音频编辑功能。不过,你仍然可以把以下内容看作是 Linux 的最佳 DAW 名单。 + +**安装说明:**你可以在 AppCenter 或软件中心中找到所有提到的音频编辑器或 DAW。如果你在这两个地方没有找到它们,请前往它们的官方网站获取更多信息。 + +#### 1、Audacity + +![Audacity audio editor][3] + +[Audacity](https://www.audacityteam.org/) 是 Linux 中最基本音频编辑器之一,但是它也很强大。它是一个自由开源的跨平台工具。肯定已经有很多人了解这个软件了。 + +现在的它相比它最初流行的时候有了很大的改进。我记得我以前试着通过从音频中去除人声来制作卡拉 OK 伴奏。现在有些时候,你仍然可以这么做。 + +**特性:** + +它还支持包含 VST 效果的插件。当然,你不应该期望它支持 VST 乐器。 + + * 通过麦克风或混音器进行现场录制 + * 支持同时从多种音频格式的多个文件中批量导出/导入内容 + * 支持 LADSPA、LV2、Nyquist、VST 和 Audio Unit 的效果插件 + * 使用简单,带有剪切、粘贴、删除和拷贝的功能 + * 可观测声音频率的频谱模式 + +#### 2、LMMS + +![LMMS audio editor][4] + +[LMMS](https://lmms.io/) 是一个自由开源的(跨平台)数码音频工作站。它包括所有基本的音频编辑功能以及许多高级功能。 + +你可以混音、组合音频,或使用 VST 设备创造音频。LMMS 支持这些功能。此外,它还自带一些样本音频、预设、VST 设备和特效来帮助你起步。此外,你还可以得到一个频谱分析仪,以便进行高级的音频编辑工作。 + +**特性:** + + * 基于 MIDI 的音符回放 + * 支持 VST 设备 + * 原生支持多采样 + * 内置压缩器、限制器、延迟功能、混响功能、失真功能和低音增强器 + +#### 3、Ardour + +![Ardour audio editor][5] + +[Ardour](https://ardour.org/) 是另一个自由开源的数码音频工作站。只要你有音频接口,Ardour 就支持它的使用。当然,你也可以无限地添加多声道音轨。这些多声道音轨也可以被指派到不同的混音带,以方便编辑和录音。 + +你也可以导入一个视频,编辑其中的音频,然后导出新的视频。它提供了许多内置插件,并且支持 VST 插件。 + +**特性:** + + * 非线性编辑 + * 垂直窗口堆叠,便于导航 + * 静默消除功能strip silence推拉修剪功能push-pull trimming,和用以短暂片段或基于基于音符开始的编辑的 Rhythm Ferret。 + +#### 4、Cecilia + +![Cecilia audio editor][6] + +[Cecilia](http://ajaxsoundstudio.com/software/cecilia/) 不是一个普通的音频编辑器。它的使用者一般是音效设计师或者正在努力成为音效设计师的人。 Cecilia 实际上是一个音频信号处理环境。它可以让你的作品余音绕梁。 + +你还可以得到内置的音效与合成模组和插件。Cecilia 为一个明确的目的而生:如果你正在找音效设计工具,这是你的不二之选! + +**特性:** + + * 利用模块来完成更多工作(UltimateGrainer —— 最先进的颗粒化处理工具,RandomAccumulator —— 记录变量速度的累加器,UpDistoRes——通过上采样和谐振低通滤波器创造失真效果的工具) + * 自动保存调制设定 + +#### 5、Mixxx + +![Mixxx audio DJ][7] + +如果你想要在混合和录制一些东西的同时能够有一个虚拟的 DJ 工具,[Mixxx](https://www.mixxx.org/) 将是完美的工具。你可以用到 BPM、音调,并使用主同步功能来匹配歌曲的节奏和节拍。另外,不要忘记它也是一个 Linux 的自由开源的软件。 + +它还支持自定义 DJ 设备。所以,如果你有 DJ 设备或者 MIDI,你可以用这个工具录制你的现场混音。 + +**特性:** + + * 播送和录制你的歌曲的 DJ 混音 + * 可以连接到你的设备并且现场演奏 + * 音调检测和 BPM 检测 + +#### 6、Rosegarden + +![Rosegarden audio editor][9] + +[Rosegarden](https://www.rosegardenmusic.com/) 是另一个令人赞叹的 Linux 的自由开源的音频编辑器。它既不是一个功能齐全的 DAW,也不是一个基本的音频编辑工具。它是两者的混合体,并带有一些缩减的功能。 + +我不会向专业人士推荐这款软件,但如果你经营家庭音乐工作室或只是想体验一下,这将是 Linux 上可以安装的最好的音频编辑器之一。 + +**特性:** + + * 乐谱编辑 + * 录音、混音以及采样 + +### 小结 + +这些是你可以找到的 Linux 上的最棒的一些音频编辑器了。不论你是需要 DAW,一个剪切/粘贴的编辑工具,或者仅仅想要一个拥有基础的混音和录音功能的音频编辑工具,上述软件都能够满足你的需求。 + +如果在这篇文章中我们遗漏了你最喜欢的一些音频工具,可以在原文下方评论中回复告诉我们。 + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/best-audio-editors-linux + +作者:[Ankush Das][a] +选题:[lujun9972][b] +译者:[MFGJT](https://github.com/MFGJT) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://itsfoss.com/author/ankush/ +[b]: https://github.com/lujun9972 +[1]: https://en.wikipedia.org/wiki/Digital_audio_workstation +[2]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/01/linux-audio-editors-800x450.jpeg?resize=800%2C450&ssl=1 +[3]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2019/01/audacity-audio-editor.jpg?fit=800%2C591&ssl=1 +[4]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2019/01/lmms-daw.jpg?fit=800%2C472&ssl=1 +[5]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2019/01/ardour-audio-editor.jpg?fit=800%2C639&ssl=1 +[6]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/01/cecilia.jpg?fit=800%2C510&ssl=1 +[7]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/01/mixxx.jpg?fit=800%2C486&ssl=1 +[8]: https://itsfoss.com/dj-mixxx-2/ +[9]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2019/01/rosegarden.jpg?fit=800%2C391&ssl=1 +[10]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2019/01/linux-audio-editors.jpeg?fit=800%2C450&ssl=1 diff --git a/published/202004/20190205 Installing Kali Linux on VirtualBox- Quickest - Safest Way.md b/published/202004/20190205 Installing Kali Linux on VirtualBox- Quickest - Safest Way.md new file mode 100644 index 0000000000..31ce0c27f0 --- /dev/null +++ b/published/202004/20190205 Installing Kali Linux on VirtualBox- Quickest - Safest Way.md @@ -0,0 +1,156 @@ +[#]: collector: (lujun9972) +[#]: translator: (robsean) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12113-1.html) +[#]: subject: (Installing Kali Linux on VirtualBox: Quickest & Safest Way) +[#]: via: (https://itsfoss.com/install-kali-linux-virtualbox/) +[#]: author: (Ankush Das https://itsfoss.com/author/ankush/) + +在 VirtualBox 上安装 Kali Linux:最快速和最安全的方法 +====== + +> 这篇教程向你展示如何在 Windows 和 Linux 中以最快的方式在 VirtualBox 上安装 Kali Linux。 + +[Kali Linux][1] 是 [最适合脆弱性测试和安全爱好者的 Linux 发行版][2] 之一。 + +因为它涉及一个像黑客之类的敏感话题,就像一把双刃剑。我们过去在详细的 Kali Linux 评论中讨论过,所以我不会再次赘述。 + +虽然你可以通过替换现有的操作系统的形式安装 Kali Linux,但是通过虚拟机来使用它可能会是更好、更安全的选择。 + +使用 VirtualBox,你可以在 Windows/Linux 系统中将 Kail Linux 作为常规应用程序使用。这和在系统中运行 VLC 或游戏几乎是一样的。 + +在虚拟机中使用 Kali Linux 是安全的。不管你在 Kali Linux 做什么都不会影响你的 ‘宿主系统’(即你原来的 Windows 或 Linux 操作系统)。你的实际操作系统将不会受到影响,并且在你的宿主系统中数据也是安全的。 + +![][3] + +### 如何在 VirtualBox 中安装 Kali Linux + +在这里我会使用 [VirtualBox][4]。它是一个非常好的开源虚拟化解决方案,几乎适合于任何人,无论是专业使用或个人使用。它是免费提供的。 + +在这篇文章中,我们将特别讨论 Kali Linux,但你也可以安装几乎任何其他的操作系统,只要有 ISO 文件或预建的虚拟机保存文件就可以安装。 + +**注意:**同样的步骤适用于运行 VirtualBox 的 Windows 或 Linux。 + +如上所述 ,你可以安装 Windows 或 Linux 作为你的宿主系统。但是,在我已安装 Windows 10 的情况下(别仇恨我!),我会尝试着在其上的 VirtualBox 中一步步地安装 Kali Linux 。 + +并且,最棒的是,即使你碰巧使用一个 Linux 发行版作为你的主要操作系统,也将使用同样的步骤! + +想知道如何做?让我们来看看… + +- [video](https://youtu.be/TGOiAsSdADs) + +### 在 VirtualBox 上安装 Kali Linux 的分步指南 + +我们将使用一个专门为 VirtualBox 定制的 Kali Linux 镜像。你也可以下载 Kali Linux 的 ISO 文件,并创建一个新的虚拟机,但是当你有一个简单的选择时,为什么还这样做呢? + +#### 1、下载并安装 VirtualBox + +第一件要做的事是从甲骨文的官方网站下载和安装 VirtualBox。 + +- [下载 VirtualBox][6] + +在你下载了安装器之后,只需要双击它来安装 VirtualBox。在 [Ubuntu][7]/Fedora Linux 安装 VirtualBox 也是一样的方式。 + +#### 2、下载即用型的 Kali Linux 虚拟镜像 + +在安装成功后,前往 [Offensive Security 的下载页面][8] 来下载适用于 VirtualBox 的虚拟机镜像。如果你改变主意使用 [VMware][9],那里也有适用的。 + +![][10] + +如你所见,文件大小大约 3 GB,你应该使用 torrent 方式,或者使用一个[下载管理器][11]来下载它。 + +- [下载 Kali Linux 虚拟镜像][8] + +#### 3、在 Virtual Box 上安装 Kali Linux + +当你安装 VirtualBox 并下载 Kali Linux 镜像后,你只需要将其导入到 VirtualBox 中就可以使其正常工作。 + +这里是如何导入 Kali Linux 的 VirtualBox 镜像: + +##### 步骤 1 + +启动 VirtualBox。你会看到一个导入Import 按钮,点击它。 + +![点击导入按钮][12] + +##### 步骤 2 + +接下来,浏览刚刚下载的文件,选择要导入的文件(如下图所示)。文件名应该以“kali linux”开始,以 .ova 扩展名结束。 + +![导入 Kali Linux 镜像][13] + +选择后,单击下一步Next继续进行。 + +##### 步骤 3 + +现在,你会看到要导入的虚拟机的设置。所以,你可以自定义它们或者不自定义,这是你的选择。采用默认设置也是可以的。 + +你需要选择一个有足够可用存储空间的路径。在 Windows 上,我绝不建议使用 C: 盘。 + +![将硬盘驱动器导入为 VDI][14] + +在这里,“将硬盘驱动器导入为 VDI”指的是通过分配存储器空间集来虚拟挂载硬盘驱动器。 + +在你完成设置后,单击导入Import,等待一段时间。 + +##### 步骤 4 + +你现在将看到它被列在虚拟机列表中。所以,只需点击开始Start来启动它。 + +你可能会在开始时得到一个 USB 2.0 端口控制器的错误,你可以禁用它来解决问题,或者只需按照屏幕上的指示来安装一个附加软件包修复问题。然后就大功告成了! + +![Kali Linux 运行在 VirtualBox 中][15] + +以前 Kali Linux 中的默认用户名是 root,默认密码是 toor。但从 2020 年 1 月起,Kali Linux 就不使用 root 账号了。现在,默认账号和密码都是 kali。 + +你应该可以用它来登录系统了。 + +请注意,在尝试安装一个新的应用程序或尝试破解 WiFi 密码之前,请先[更新 Kali Linux][16] 。 + +我希望这篇指南能帮助您在 VirtualBox 上很容易地安装 Kali Linux。当然,Kali Linux 有很多有用的渗透测试工具 – 祝你好运! + +**提示** : Kali Linux 和 Ubuntu 都是基于 Debian 的,如果你在使用 Kali Linux 时遇到任何问题或错误,你可以按照互联网上的 Ubuntu 和 Debian 的教程解决。 + +### 奖励: 免费的 Kali Linux 指南书 + +如果你刚刚开始使用 Kali Linux, 那么了解如何使用 Kali Linux 就很有必要了。 + +Kali Linux 背后的公司 Offensive Security 制作了一本指南书,讲解了 Linux 的基础知识、Kali Linux 的基础知识、配置和设置,书中还有一些关于渗透测试和安全工具的章节。 + +基本上,它包含你上手 Kali Linux 所需要的一切东西。更重要的是,这本书可以免费下载。 + +- [免费下载《揭秘 Kali Linux》][17] + +如果你在 VirtualBox 上使用 Kali Linux 时遇到问题,请在下面的评论中告诉我们,或者直接分享你的经验。 + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/install-kali-linux-virtualbox/ + +作者:[Ankush Das][a] +选题:[lujun9972][b] +译者:[robsean](https://github.com/robsean) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://itsfoss.com/author/ankush/ +[b]: https://github.com/lujun9972 +[1]: https://www.kali.org/ +[2]: https://itsfoss.com/linux-hacking-penetration-testing/ +[3]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/02/kali-linux-virtual-box.png?resize=800%2C450&ssl=1 +[4]: https://www.virtualbox.org/ +[5]: https://www.youtube.com/c/itsfoss?sub_confirmation=1 +[6]: https://www.virtualbox.org/wiki/Downloads +[7]: https://itsfoss.com/install-virtualbox-ubuntu/ +[8]: https://www.offensive-security.com/kali-linux-vm-vmware-virtualbox-image-download/ +[9]: https://itsfoss.com/install-vmware-player-ubuntu-1310/ +[10]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/02/kali-linux-virtual-box-image.jpg?resize=800%2C347&ssl=1 +[11]: https://itsfoss.com/4-best-download-managers-for-linux/ +[12]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/02/vmbox-import-kali-linux.jpg?ssl=1 +[13]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/02/vmbox-linux-next.jpg?ssl=1 +[14]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/02/vmbox-kali-linux-settings.jpg?ssl=1 +[15]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/02/kali-linux-on-windows-virtualbox.jpg?resize=800%2C429&ssl=1 +[16]: https://linuxhandbook.com/update-kali-linux/ +[17]: https://kali.training/downloads/Kali-Linux-Revealed-1st-edition.pdf diff --git a/published/202004/20190429 10 moments that shaped Linux history.md b/published/202004/20190429 10 moments that shaped Linux history.md new file mode 100644 index 0000000000..8dc04ce5de --- /dev/null +++ b/published/202004/20190429 10 moments that shaped Linux history.md @@ -0,0 +1,91 @@ +[#]: collector: (lujun9972) +[#]: translator: (wxy) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12060-1.html) +[#]: subject: (10 moments that shaped Linux history) +[#]: via: (https://opensource.com/article/19/4/top-moments-linux-history) +[#]: author: (Alan Formy-Duval https://opensource.com/users/alanfdoss) + +塑造 Linux 历史的 10 个时刻 +====== + +> 自 1991 年诞生以来,Linux 已经走了漫长的一段路,而这些事件标志着它的发展。 + +![](https://img.linux.net.cn/data/attachment/album/202004/01/093243wukmsiwdkkwfrg00.jpg) + +在 2018 年 8 月,Opensource.com 发布了一项包含七个选项的民意测验,询问读者:[Linux 历史上最重要的时刻是什么?][2]我觉得我需要扩大这个清单,并提出我认为的 10 个在塑造 Linux 历史上发挥了重要作用的时刻。 + +### 1、Linus 发布 Linux + +Linus Torvalds 最初是在 1991 年将 Linux 当成一个业余爱好发布到世上的。结果这个业余爱好成了他的职业! + +### 2、出现 Linux 发行版 + +1993 年,出现了几个 Linux 发行版,需要特别指出的有 [Debian][3]、[Red Hat][4] 和 [Slackware][5]。这个时刻之所以重要是因为它们证明了 Linux 在市场认可度和开发水平方面的成就,使其能够在 1990 年代动荡的操作系统战争、浏览器战争和协议战争中生存下来。相反,那时许多成熟的、商业的和专有的产品并没有活过千禧年之交! + +### 3、IBM 斥巨资投注 Linux + +2000 年,IBM 宣布将在 Linux 上投资 10 亿美元。Richard Richtmyer 在他的 CNN Money [有关投资的文章][6] 中写道:“这一声明强调了蓝色巨人对 Linux 的承诺,标志着将这个替代操作系统推向主流商业市场的重大进展。” + +### 4、好莱坞接纳 Linux + +在 2002 年,整个好莱坞电影业似乎都采用了 Linux。[迪尼斯][7]、[梦工厂][8] 和 [工业光魔][9] 都在那一年开始用 Linux 制作电影。 + +### 5、Linux 得到政府认可 + +2003 年,美国政府对 Linux 的接受是它的又一个重要时刻。红帽 Linux 被[授予][10]美国防部通用操作环境(COE)认证。这很重要,因为政府(特别是情报和军事机构)对计算机系统有非常严格的要求,以防止攻击和支持国家安全。这为其他机构使用 Linux 打开了大门。在那年晚些时候,[美国国家气象局宣布][11],它将用运行 Linux 的新计算机代替过时的系统。 + +### 6、我管理的系统 + +这个“时刻”确实是我个人经历的集合。随着在 2000 年代我的职业发展,我发现自己管理的几种类型的系统和设备都运行着 Linux。我在 VMware ESX、F5 Big-IP、Check Point UTM Edge、Cisco ASA 和 PIX 这些地方发现了 Linux。这使我意识到 Linux 确实可行并且可以继续存在下去。 + +### 7、Ubuntu + +2004 年,Mark Shuttleworth 创立了 Canonical,该公司基于 Debian 发行版提供了易于使用的 Linux 桌面:[Ubuntu Linux][12]。我认为 Ubuntu Linux 帮助扩展了桌面 Linux 安装基数。从休闲的家庭用户到专业软件开发人员,它使 Linux 出现在更多人面前。 + +### 8、Google 的 Linux + +Google 发行了两种基于 Linux 内核的操作系统:2008 年中期的 Android 移动操作系统和 2011 年在 Chromebook 上运行的 Chrome OS。在那之后,已经售出了数百万部 Android 手机和 Chromebook。 + +### 9、云计算即 Linux + +在过去这十年左右的时间里,云计算已经从互联网计算的宏伟愿景变成了我们如何个人和专业地使用计算机的全新方式。云计算领域中的主要参与者都是构建于 Linux 之上的,包括 [Amazon Web Services(AWS)][13]、[Google Cloud Services(GCS)][14] 和 [Linode][15]。即使在一些我们不能确信的地方(例如 Microsoft Azure),也很好地支持运行 Linux 工作负载。 + +### 10、我的汽车运行着 Linux + +你的也一样!许多汽车制造商几年前开始引入 Linux。这导致了名为 [汽车级 Linux(AGL)][16] 的协作开源项目的形成。丰田和斯巴鲁等主要汽车制造商已经联合开发基于 Linux 的汽车娱乐、导航和引擎管理系统。 + +### 分享你的最爱 + +这是我从贯穿我的职业生涯的 Linux 文章和事件的档案库中提取出来的主观清单,因此可能还有其他更值得注意的时刻。请分享你的评论吧。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/4/top-moments-linux-history + +作者:[Alan Formy-Duval][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/alanfdoss +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/linux_penguin_green.png?itok=ENdVzW22 (Penguin with green background) +[2]: https://opensource.com/article/18/8/linux-history +[3]: https://www.debian.org/doc/manuals/project-history/ch-intro.en.html +[4]: https://brand.redhat.com/foundations/history +[5]: https://opensource.com/article/18/7/stackware-turns-25 +[6]: https://money.cnn.com/2000/12/12/technology/ibm_linux +[7]: https://www.nytimes.com/2002/06/18/business/technology-disney-shifting-to-linux-for-film-animation.html +[8]: https://www.linux.com/news/stallion-and-penguin-dreamworks-uses-linux-create-new-animated-film +[9]: https://www.linuxjournal.com/article/6011 +[10]: https://www.cnet.com/news/government-tips-hat-to-red-hat +[11]: https://www.computerworld.com/article/2574142/national-weather-service-migrates-to-linux-based-ibm-workstations.html +[12]: https://www.ubuntu.com/about +[13]: https://aws.amazon.com/amazon-linux-2 +[14]: https://cloud.google.com +[15]: https://www.linode.com/docs/getting-started +[16]: https://www.automotivelinux.org diff --git a/published/202004/20190523 Run your blog on GitHub Pages with Python.md b/published/202004/20190523 Run your blog on GitHub Pages with Python.md new file mode 100644 index 0000000000..ea62c62a04 --- /dev/null +++ b/published/202004/20190523 Run your blog on GitHub Pages with Python.md @@ -0,0 +1,233 @@ +[#]: collector: (lujun9972) +[#]: translator: (MjSeven) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12064-1.html) +[#]: subject: (Run your blog on GitHub Pages with Python) +[#]: via: (https://opensource.com/article/19/5/run-your-blog-github-pages-python) +[#]: author: (Erik O'Shaughnessy https://opensource.com/users/jnyjny/users/jasperzanjani/users/jasperzanjani/users/jasperzanjani/users/jnyjny/users/jasperzanjani) + +使用 Python 在 GitHub 上运行你的博客 +====== + +> 使用 Pelican 创建博客,这是一个基于 Python 的平台,与 GitHub 配合的不错。 + +![](https://img.linux.net.cn/data/attachment/album/202004/02/101030cy0t0f0e0jvf5e5e.jpg) + +[GitHub][2] 是一个非常流行的用于源代码控制的 Web 服务,它使用 [Git][3] 同步本地文件和 GitHub 服务器上保留的副本,这样你就可以轻松地共享和备份你的工作。 + +除了为代码仓库提供用户界面之外,GitHub 还运允许用户直接从仓库[发布网页][4]。GitHub 推荐的网站生成软件包是 [Jekll][5],是使用 Ruby 编写的。因为我是 [Python][6] 的忠实粉丝,所以我更喜欢 [Pelican][7],这是一个基于 Python 的博客平台,可与 GitHub 很好地协同工作。 + +Pelican 和 Jekll 都可以将 [Markdown][8] 或 [reStructuredText][9] 中编写的内容转换为 HTML 以生成静态网站,并且两个生成器都支持定制的主题。 + +在本文中,我将介绍如何安装 Pelican、设置 GitHub 仓库、运行快速入门帮助、编写一些 Markdown 文件以及发布第一篇博客。我假设你有一个 [GitHub 账户][10],熟悉[基础的 Git 命令][11],并且想使用 Pelican 发布博客。 + +### 安装 Pelican 并创建仓库 + +首先,你必须在本地计算机上安装 Pelican 和 `ghp-import`。使用 Python 软件包安装工具 [pip][12](你有,对吧?),这非常容易: + +``` +$ pip install pelican ghp-import Markdown +``` + +然后,打开浏览器并在 GitHub 上为你新鲜出炉的博客创建一个新仓库,命名如下(在此处以及整个教程中,用 GitHub 用户名替换 `username`): + +``` +https://GitHub.com/username/username.github.io +``` + +让它保持为空,稍后我们用引人注目的博客内容来填充它。 + +使用命令行(确保正确),将这个空 Git 仓库克隆到本地计算机: + +``` +$ git clone blog +$ cd blog +``` + +### 奇怪的把戏... + +在 GitHub 上发布 Web 内容有一个不太引入注意的技巧,对于托管在名为 `username.github.io` 的仓库的用户页面,其内容由 `master` 分支提供服务。 + +我强烈建议所有的 Pelican 配置文件和原始的 Markdown 文件都不要保留在 `master` 中,`master` 中只保留 Web 内容。因此,我将 Pelican 配置和原始内容保留在一个我喜欢称为 `content` 的单独分支中。(你可以随意创建一个分支,但以下内容沿用 `content`。)我喜欢这种结构,因为我可以放弃掉 `master` 中的所有文件,然后用 `content` 分支重新填充它。 + +``` +$ git checkout -b content +Switched to a new branch 'content' +``` + +### 配置 Pelican + +现在该进行内容配置了。Pelican 提供了一个很棒的初始化工具 `pelican-quickstart`,它会询问你有关博客的一系列问题。 + +``` +$ pelican-quickstart +Welcome to pelican-quickstart v3.7.1. + +This script will help you create a new Pelican-based website. + +Please answer the following questions so this script can generate the files +needed by Pelican. + +> Where do you want to create your new web site? [.] +> What will be the title of this web site? Super blog +> Who will be the author of this web site? username +> What will be the default language of this web site? [en] +> Do you want to specify a URL prefix? e.g., http://example.com (Y/n) n +> Do you want to enable article pagination? (Y/n) +> How many articles per page do you want? [10] +> What is your time zone? [Europe/Paris] US/Central +> Do you want to generate a Fabfile/Makefile to automate generation and publishing? (Y/n) y +> Do you want an auto-reload & simpleHTTP script to assist with theme and site development? (Y/n) y +> Do you want to upload your website using FTP? (y/N) n +> Do you want to upload your website using SSH? (y/N) n +> Do you want to upload your website using Dropbox? (y/N) n +> Do you want to upload your website using S3? (y/N) n +> Do you want to upload your website using Rackspace Cloud Files? (y/N) n +> Do you want to upload your website using GitHub Pages? (y/N) y +> Is this your personal page (username.github.io)? (y/N) y +Done. Your new project is available at /Users/username/blog +``` + +你可以对每个问题都采用默认值,但除了以下这些问题: + +* 网站标题,应该唯一且特殊 +* 网站作者,可以是个人用户名或你的全名 +* 时区,可能你不在巴黎 +* 上传到 GitHub 页面,我们选择 `y` + +回答完所有问题后,Pelican 会在当前目录中留下以下内容: + +``` +$ ls +Makefile content/ develop_server.sh* +fabfile.py output/ pelicanconf.py +publishconf.py +``` + +你可以查看 [Pelican 文档][13]来了解如何使用这些文件,但**现在**我们要做的是完成手头的工作。说实话,我也没有阅读文档。 + +### 继续 + +将所有 Pelican 生成的文件添加到本地 Git 仓库的 `content` 分支,提交更改,然后将本地更改推送到 Github 上托管的远程仓库: + +``` +$ git add . +$ git commit -m 'initial pelican commit to content' +$ git push origin content +``` + +这件事情并不是特别令人兴奋,但是如果我们需要撤销这些文件之一的修改时,这将非常方便。 + +### 终于 + +终于,现在你得到一个博客了!你所有的博客文章、照片、图像、PDF 等都将位于 `content` 目录中,它最初是空的。要开始创建第一篇博客和关于页面,输入: + +``` +$ cd content +$ mkdir pages images +$ cp /Users/username/SecretStash/HotPhotoOfMe.jpg images +$ touch first-post.md +$ touch pages/about.md +``` + +接下来,在你喜欢的文本编辑器中打开 `first-post.md`,并添加以下内容: + +``` +title: First Post on My Sweet New Blog +date: +author: Your Name Here + +# I am On My Way To Internet Fame and Fortune! + +This is my first post on my new blog. While not super informative it +should convey my sense of excitement and eagerness to engage with you, +the reader! +``` + +前三行是 Pelican 用于组织内容的元数据。有很多不同的元数据可供你选择。再说一次,文档是你了解更多选项的最佳选择。 + +现在,打开空白文件 `pages/about.md` 并添加以下文本: + +``` +title: About +date: + +![So Schmexy][my_sweet_photo] + +Hi, I am and I wrote this epic collection of Interweb +wisdom. In days of yore, much of this would have been deemed sorcery +and I would probably have been burned at the stake. + +😆 + +[my_sweet_photo]: {static}/images/HotPhotoOfMe.jpg +``` + +现在,`content` 目录中将包含三个新的 Web 内容,在 `content` 分支中还有很多内容。 + +### 发布 + +不要急,马上要见到成果了! + +剩下要做的就是: + +* 运行 Pelican 以在 `output` 中生成静态 HTML 文件: + + ``` +$ pelican content -o output -s publishconf.py +``` +* 使用 `ghp-import` 将 `output` 目录的内容添加到 `master` 分支中: + + ``` +$ ghp-import -m "Generate Pelican site" --no-jekyll -b master output +``` +* 将本地 `master` 分支推送到远程仓库: + + ``` +$ git push origin master +``` +* 提交新内容并将其推送到 `content` 分支 + + ``` +$ git add content +$ git commit -m 'added a first post, a photo and an about page' +$ git push origin content +``` + +### OMG,我成功了 + +现在最激动的时候到了,当你想要看到你发布给大家的博客内容时,打开浏览器输入: + +``` +https://username.github.io +``` + +恭喜你可以在 GitHub 上发布自己的博客了!当你想添加更多页面或文章时,都可以按照上面的步骤来。希望你可以愉快地发布博客。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/5/run-your-blog-github-pages-python + +作者:[Erik O'Shaughnessy][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/jnyjny/users/jasperzanjani/users/jasperzanjani/users/jasperzanjani/users/jnyjny/users/jasperzanjani +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/getting_started_with_python.png?itok=MFEKm3gl (Raspberry Pi and Python) +[2]: https://github.com/ +[3]: https://git-scm.com +[4]: https://help.github.com/en/categories/github-pages-basics +[5]: https://jekyllrb.com +[6]: https://python.org +[7]: https://blog.getpelican.com +[8]: https://guides.github.com/features/mastering-markdown +[9]: http://docutils.sourceforge.net/docs/user/rst/quickref.html +[10]: https://github.com/join?source=header-home +[11]: https://git-scm.com/docs +[12]: https://pip.pypa.io/en/stable/ +[13]: https://docs.getpelican.com diff --git a/published/202004/20190605 What is GraphQL.md b/published/202004/20190605 What is GraphQL.md new file mode 100644 index 0000000000..49d68894b1 --- /dev/null +++ b/published/202004/20190605 What is GraphQL.md @@ -0,0 +1,125 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12070-1.html) +[#]: subject: (What is GraphQL?) +[#]: via: (https://opensource.com/article/19/6/what-is-graphql) +[#]: author: (Zach Lendon https://opensource.com/users/zachlendon) + +什么是 GraphQL? +====== + +> GraphQL 是一种查询语言、一个执行引擎,也是一种规范,它让开发人员重新思考如何构建客户端和 API 应用。 + +![](https://img.linux.net.cn/data/attachment/album/202004/04/112938odz6sbw6hzwsh7f6.jpg) + +GraphQL 是当今软件技术中最大的流行语之一。但它*究竟*是什么?是像 [SQL][2] 一样的查询语言吗?是像 [JVM][3] 这样的执行引擎?还是像 [XML][4] 这样的规范? + +如果你回答上面这些都是,那么你是对的![GraphQL][5] 是一种查询语言的语法、是一种编程语言无关的执行引擎,也是一种不断发展的规范。 + +让我们深入了解一下 GraphQL 如何成为所有这些东西的,并了解一下人们为什么对它感到兴奋。 + +### 查询语言 + +GraphQL 作为查询语言似乎是合理的 —— 毕竟 “QL” 似乎重要到出现在名称中。但是我们查询什么呢?看一个示例查询请求和相应的响应可能会有所帮助。 + +以下的用户查询: + +``` +{ + user(id: 4) { +    name +    email +    phoneNumber +  } +} +``` + +可能会返回下面的 JSON 结果: + +``` +{ +  "user": { +    "name": "Zach Lendon" +    “email”: “zach@hydrate.io” +    “phoneNumber”: “867-5309” +  } +} +``` + +想象一下,客户端应用查询用户详细信息、获取结果,并使用它填充配置屏幕。作为查询语言,GraphQL 的核心优势之一是客户端应用可以*只请求它需要*的数据,并期望以一致的方式返回这些数据。 + +那么 GraphQL 响应返回的*什么*呢?这就是执行引擎发挥的作用,通常是以 GraphQL 服务器的形式出现。 + +### 执行引擎 + +![GraphQL execution engine][7] + +GraphQL 执行引擎负责处理 GraphQL 查询并返回 JSON 响应。所有 GraphQL 服务器由两个核心组件组成,分别定义了执行引擎的结构和行为:模式和解析器。 + +GraphQL 模式是一种自定义类型语言,它公开哪些查询既允许(有效),又由 GraphQL 服务器实现处理。上面用户示例查询的模式可能如下所示: + +``` +type User { + name: String +    email: String +    phoneNumber: String +} + +type Query { +    user: User +} +``` + +此模式定义了一个返回用户的用户查询。客户端可以通过用户查询请求用户上的任何字段,并且 GraphQL 服务器将仅返回请求的字段。通过使用强类型模式,GraphQL 服务器可以根据定义的模式验证传入的查询,以确保是有效的。 + +确定查询有效后,就会由 GraphQL 服务器的解析器处理。解析器函数支持每个 GraphQL 类型的每个字段。我们的这个用户查询的示例解析器可能如下所示: + +``` +Query: { + user(obj, args, context, info) { + return context.db.loadUserById(args.id).then( + userData => new User(userData) + ) + } +} +``` + +虽然上面的例子是用 JavaScript 编写的,但 GraphQL 服务器可以用任意语言编写。这是因为 GraphQL 也是*也是*一种规范! + +### 规范 + +GraphQL 规范定义了 GraphQL 实现必须遵循的功能和特性。作为一个在开放网络基金会的最终规范协议([OWFa 1.0][8])下提供的开放规范,技术社区可以审查 GraphQL 实现必须符合规范的要求,并帮助制定 GraphQL 的未来。 + +虽然该规范对 GraphQL 的语法,什么是有效查询以及模式的工作方式进行了非常具体的说明,但它没有提供有关如何存储数据或 GraphQL 服务器应使用哪种编程语言实现的指导。这在软件领域是非常强大的,也是相对独特的。它允许以各种编程语言创建 GraphQL 服务器,并且由于它们符合规范,因此客户端会确切知道它们的工作方式。GraphQL 服务器已经有多种语言实现,人们不仅可以期望像 JavaScript、Java和 C# 这样的语言,还可以使用 Go、Elixir 和 Haskell 等。服务器实现所使用的语言不会成为采用过程的障碍。它不仅存在多种语言实现,而且它们都是开源的。如果没有你选择的语言的实现,那么可以自己实现。 + +### 总结 + +GraphQL 是开源 API 领域中一个令人兴奋的、相对较新的参与者。它将查询语言、执行引擎与开源规范结合在一起,它定义了 GraphQL 实现的外观和功能。 + +GraphQL 已经开始改变企业对构建客户端和 API 应用的看法。通过将 GraphQL 作为技术栈的一部分,前端开发人员可以自由地查询所需的数据,而后端开发人员可以将客户端应用需求与后端系统架构分离。通常,公司在使用 GraphQL 的过程中,首先会在其现有的后端服务之上构建一个 GraphQL API “层”。这使得客户端应用开始获得他们所追求的性能和运营效率,同时使后端团队有机会确定他们可能需要在 GraphQL 层后面的“幕后”进行哪些更改。通常,这些更改都是为了优化,这些优化有助于确保使用 GraphQL 的应用可以尽可能高效地运行。由于 GraphQL 提供了抽象性,因此系统团队可以进行更改的同时继续在其 GraphQL API 级别上遵守 GraphQL 的“合约”。 + +由于 GraphQL 相对较新,因此开发人员仍在寻找新颖而激动人心的方法来利用它构建更好的软件解决方案。GraphQL 将如何改变你构建应用的方式,它是否对得起众望所归?只有一种方法可以找到答案 —— 用 GraphQL 构建一些东西! + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/6/what-is-graphql + +作者:[Zach Lendon][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/zachlendon +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/analytics-graphs-charts.png?itok=sersoqbV (Analytics: Charts and Graphs) +[2]: https://opensource.com/article/18/2/getting-started-sql +[3]: https://www.cubrid.org/blog/understanding-jvm-internals/ +[4]: https://www.w3.org/TR/xml/ +[5]: http://graphql.org/ +[6]: mailto:zach@hydrate.io +[7]: https://opensource.com/sites/default/files/pictures/graphql-execution-engine.png (GraphQL execution engine) +[8]: http://www.openwebfoundation.org/legal/the-owf-1-0-agreements/owfa-1-0---patent-only diff --git a/published/202004/20190612 How to write a loop in Bash.md b/published/202004/20190612 How to write a loop in Bash.md new file mode 100644 index 0000000000..6649f2b926 --- /dev/null +++ b/published/202004/20190612 How to write a loop in Bash.md @@ -0,0 +1,262 @@ +[#]: collector: "lujun9972" +[#]: translator: "chunibyo-wly" +[#]: reviewer: "wxy" +[#]: publisher: "wxy" +[#]: url: "https://linux.cn/article-12088-1.html" +[#]: subject: "How to write a loop in Bash" +[#]: via: "https://opensource.com/article/19/6/how-write-loop-bash" +[#]: author: "Seth Kenlon https://opensource.com/users/seth" + +如何在 Bash 中使用循环 +====== + +> 使用循环和查找命令批量自动对多个文件进行一系列的操作。 + +![](https://img.linux.net.cn/data/attachment/album/202004/08/225655by8i8k7uyppp18ph.jpg) + +人们希望学习批处理命令的一个普遍原因是要得到批处理强大的功能。如果你希望批量的对文件执行一些指令,构造一个可以重复运行在那些文件上的命令就是一种方法。在编程术语中,这被称作*执行控制*,`for` 循环就是其中最常见的一种。 + +`for` 循环可以详细描述你希望计算机对你指定的每个数据对象(比如说文件)所进行的操作。 + +### 一般的循环 + +使用循环的一个简单例子是对一组文件进行分析。这个循环可能没什么用,但是这是一个安全的证明自己有能力独立处理文件夹里每一个文件的方法。首先,创建一个文件夹然后拷贝一些文件(例如 JPEG、PNG 等类似的文件)至文件夹中生成一个测试环境。你可以通过文件管理器或者终端来完成创建文件夹和拷贝文件的操作: + +```bash +$ mkdir example +$ cp ~/Pictures/vacation/*.{png,jpg} example +``` + +切换到你刚创建的那个新文件夹,然后列出文件并确认这个测试环境是你需要的: + +``` +$ cd example +$ ls -1 +cat.jpg +design_maori.png +otago.jpg +waterfall.png +``` + +在循环中逐一遍历文件的语法是:首先声明一个变量(例如使用 `f` 代表文件),然后定义一个你希望用变量循环的数据集。在这种情况下,使用 `*` 通配符来遍历当前文件夹下的所有文件(通配符 `*` 匹配*所有文件*)。然后使用一个分号(`;`)来结束这个语句。 + +``` +$ for f in * ; +``` + +取决于你个人的喜好,你可以选择在这里按下回车键。在语法完成前,shell 是不会尝试执行这个循环的。 + +接下来,定义你想在每次循环中进行的操作。简单起见,使用 `file` 命令来得到 `f` 变量(使用 `$` 告诉 shell 使用这个变量的值,无论这个变量现在存储着什么)所存储着的文件的各种信息: + +``` +do file $f ; +``` + +使用另一个分号结束这一行,然后关闭这个循环: + +``` +done +``` + +按下回车键启动 shell 对当前文件夹下*所有东西*的遍历。`for` 循环将会一个一个的将文件分配给变量 `f` 并且执行你的命令: + +``` +$ for f in * ; do +> file $f ; +> done +cat.jpg: JPEG image data, EXIF standard 2.2 +design_maori.png: PNG image data, 4608 x 2592, 8-bit/color RGB, non-interlaced +otago.jpg: JPEG image data, EXIF standard 2.2 +waterfall.png: PNG image data, 4608 x 2592, 8-bit/color RGB, non-interlaced +``` + +你也可以用这种形式书写命令: + +``` +$ for f in *; do file $f; done +cat.jpg: JPEG image data, EXIF standard 2.2 +design_maori.png: PNG image data, 4608 x 2592, 8-bit/color RGB, non-interlaced +otago.jpg: JPEG image data, EXIF standard 2.2 +waterfall.png: PNG image data, 4608 x 2592, 8-bit/color RGB, non-interlaced +``` + +对你的 shell 来说,多行和单行的格式没有什么区别,并且会输出完全一样的结果。 + +### 一个实用的例子 + +下面是一个循环在日常使用中的实用案例。假如你拥有一堆假期拍的照片想要发给你的朋友。但你的照片太大了,无法通过电子邮件发送,上传到[图片分享服务][2]也不方便。因此你想为你的照片创建小型的 web 版本,但是你不希望花费太多时间在一个一个的压缩图片体积上。 + +首先,在你的 Linux、BSD 或者 Mac 上使用包管理器安装 ImageMagick 命令。例如,在 Fedora 和 RHEL 上: + +``` +$ sudo dnf install ImageMagick +``` + +在 Ubuntu 和 Debian 上: + +``` +$ sudo apt install ImageMagick +``` + +在 BSD 上,使用 `ports` 或者 [pkgsrc][3] 安装。在 Mac 上,使用 [Homebrew][4] 或者 [MacPorts][5] 安装。 + +在你安装了 ImageMagick 之后,你就拥有一系列可以用来操作图片的新命令了。 + +为你将要创建的文件建立一个目标文件夹: + +``` +$ mkdir tmp +``` + +使用下面的循环可以将每张图片减小至原来大小的 33%。 + +``` +$ for f in * ; do convert $f -scale 33% tmp/$f ; done +``` + +然后就可以在 `tmp` 文件夹中看到已经缩小了的照片了。 + +你可以在循环体中使用任意数量的命令,因此如果你需要对一批文件进行复杂的操作,可以将你的命令放在一个 `for` 循环的 `do` 和 `done` 语句之间。例如,假设你希望将所有处理过的图片拷贝至你的网站所托管的图片文件夹并且在本地系统移除这些文件: + +``` +$ for f in * ; do + convert $f -scale 33% tmp/$f + scp -i seth_web tmp/$f seth@example.com:~/public_html + trash tmp/$f ; +done +``` + +你的计算机会对 `for` 循环中处理的每一个文件自动的执行 3 条命令。这意味着假如你仅仅处理 10 张图片,也会省下输入 30 条指令和更多的时间。 + +### 限制你的循环 + +一个循环常常不需要处理所有文件。在示例文件夹中,你可能需要处理的只是 JPEG 文件: + +``` +$ for f in *.jpg ; do convert $f -scale 33% tmp/$f ; done +$ ls -m tmp +cat.jpg, otago.jpg +``` + +或者,你希望重复特定次数的某个操作而不仅仅只处理文件。`for` 循环的变量的值是被你赋给它的(不管何种类型的)数据所决定的,所以你可以创建一个循环遍历数字而不只是文件: + +``` +$ for n in {0..4}; do echo $n ; done +0 +1 +2 +3 +4 +``` + +### 更多循环 + +现在你了解的知识已经足够用来创建自己的循环体了。直到你对循环非常熟悉之前,尽可能的在需要处理的文件的*副本*上进行操作。使用内置的保护措施可以预防损坏自己的数据和制造不可复现的错误,例如偶然将一个文件夹下的所有文件重命名为同一个名字,就可能会导致他们的相互覆盖。 + +更进一步的 `for` 循环话题,请继续阅读。 + +### 不是所有的 shell 都是 Bash + +关键字 `for` 是内置在 Bash shell 中的。许多类似的 shell 会使用和 Bash 同样的关键字和语法,但是也有某些 shell ,比如 [tcsh][7],使用不同的关键字,例如 `foreach`。 + +tcsh 的语法与 Bash 类似,但是它更为严格。例如在下面的例子中,不要在你的终端的第 2、3 行键入 `foreach?` 。它只是提示你仍处在构建循环的过程中。 + +``` +$ foreach f (*) +foreach? file $f +foreach? end +cat.jpg: JPEG image data, EXIF standard 2.2 +design_maori.png: PNG image data, 4608 x 2592, 8-bit/color RGB, non-interlaced +otago.jpg: JPEG image data, EXIF standard 2.2 +waterfall.png: PNG image data, 4608 x 2592, 8-bit/color RGB, non-interlaced +``` + +在 tcsh 中,`foreach` 和 `end` 都必须单独的在一行中出现。因此你不能像 Bash 或者其他类似的 shell 一样只使用一行命令创建一个 `for` 循环。 + +### for 循环与 find 命令 + +理论上,你可能会用到不支持 `for` 循环的 shell,或者你只是更想使用其他命令的一些特性来完成和循环一样的工作。 + +使用 `find` 命令是另一个实现 `for` 循环功能的途径。这个命令提供了多种方法来定义循环中包含哪些文件的范围以及[并行][8]处理的选项。 + +`find` 命令顾名思义就是帮助你查询存储在硬盘里的文件。它的用法很简单:提供一个你希望它查询的位置的路径,接着 `find` 就会查询这个路径下面的所有文件和文件夹。 + +``` +$ find . +. +./cat.jpg +./design_maori.png +./otago.jpg +./waterfall.png +``` + +你可以通过添加名称的某些部分来过滤搜索结果: + +``` +$ find . -name "*jpg" +./cat.jpg +./otago.jpg +``` + +`find` 命令非常好的地方在于你可以通过 `-exec` 参数标志将它查询到的每一个文件放入循环中。例如,只对存放在你的 `example` 文件夹下的 PNG 图片进行体积压缩操作: + +``` +$ find . -name "*png" -exec convert {} -scale 33% tmp/{} \; +$ ls -m tmp +design_maori.png, waterfall.png +``` + +在 `-exec` 短语中,括号 `{}` 表示的是 `find` 正在处理的条目(换句话说,每一个被找到的以 PNG 结尾的文件)。`-exec` 短语必须使用分号结尾,但是 Bash 中常常也会使用分号。为了解决这个二义性问题,你的 `结束符` 可以使用反斜杠加上一个分号(`\;`),使得 `find` 命令可以知道这个结束符是用来标识自己结束使用的。 + +`find` 命令的操作非常棒,某些情况下它甚至可以表现得更棒。比如说,在一个新的进程中使用同一条命令查找 PNG 文件,你可能就会得到一些错误信息: + +``` +$ find . -name "*png" -exec convert {} -flip -flop tmp/{} \; +convert: unable to open image `tmp/./tmp/design_maori.png': +No such file or directory @ error/blob.c/OpenBlob/2643. +... +``` + +看起来 `find` 不只是定位了当前文件夹(`.`)下的所有 PNG 文件,还包括已经处理并且存储到了 `tmp` 下的文件。在一些情况下,你可能希望 `find` 查询当前文件夹下再加上其子文件夹下的所有文件。`find` 命令是一个功能强大的递归工具,特别体现在处理一些文件结构复杂的情境下(比如用来放置存满了音乐人音乐专辑的文件夹),同时你也可以使用 `-maxdepth` 选项来限制最大的递归深度。 + +只在当前文件夹下查找 PNG 文件(不包括子文件夹): + +``` +$ find . -maxdepth 1 -name "*png" +``` + +上一条命令的最大深度再加 1 就可以查找和处理当前文件夹及下一级子文件夹下面的文件: + +``` +$ find . -maxdepth 2 -name "*png" +``` + +`find` 命令默认是查找每一级文件夹。 + +### 循环的乐趣与收益 + +你使用的循环越多,你就可以越多的省下时间和力气,并且可以应对庞大的任务。虽然你只是一个用户,但是通过使用循环,可以使你的计算机完成困难的任务。 + +你可以并且应该就像使用其他的命令一样使用循环。在你需要重复处理单个或多个文件时,尽可能的使用这个命令。无论如何,这也算是一项需要被严肃对待的编程活动,因此如果你需要在一些文件上完成复杂的任务,你应该多花点时间在规划自己的工作流上面。如果你可以在一份文件上完成你的工作,接下来将操作包装进 `for` 循环里就相对简单了,这里面唯一的“编程”的需要只是理解变量是如何工作的并且进行充分的规划工作将已处理过的文件和未处理过的文件分开。经过一段时间的练习,你就可以从一名 Linux 用户升级成一位知道如何使用循环的 Linux 用户,所以开始让计算机为你工作吧! + +--- + +via: https://opensource.com/article/19/6/how-write-loop-bash + +作者:[Seth Kenlon][a] +选题:[lujun9972][b] +译者:[chunibyo-wly](https://github.com/chunibyo-wly) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux 中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/seth/users/goncasousa/users/howtopamm/users/howtopamm/users/seth/users/wavesailor/users/seth +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/bash_command_line.png?itok=k4z94W2U "bash logo on green background" +[2]: http://nextcloud.com +[3]: http://pkgsrc.org +[4]: http://brew.sh +[5]: https://www.macports.org +[6]: mailto:seth@example.com +[7]: https://en.wikipedia.org/wiki/Tcsh +[8]: https://opensource.com/article/18/5/gnu-parallel diff --git a/published/202004/20190612 Why use GraphQL.md b/published/202004/20190612 Why use GraphQL.md new file mode 100644 index 0000000000..b71cb64206 --- /dev/null +++ b/published/202004/20190612 Why use GraphQL.md @@ -0,0 +1,91 @@ +[#]: collector: (lujun9972) +[#]: translator: (wxy) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12075-1.html) +[#]: subject: (Why use GraphQL?) +[#]: via: (https://opensource.com/article/19/6/why-use-graphql) +[#]: author: (Zach Lendon https://opensource.com/users/zachlendon/users/goncasousa/users/patrickhousley) + +为什么使用 GraphQL? +====== + +> 以下是 GraphQL 在标准 REST API 技术上获得发展的原因。 + +[](https://img.linux.net.cn/data/attachment/album/202004/05/105820rdnjrppprjdjddfd.jpg) + +正如我[以前][3]所写,[GraphQL][2] 是一种下一代 API 技术,它正在改变客户端应用程序与后端系统的通信方式以及后端系统的设计方式。 + +由于一开始就从创建它的组织 Facebook 获得了支持,并得到了其他技术巨头(如 Github、Twitter 和 AirBnB)的支持,因此 GraphQL 作为应用程序系统的关键技术的地位似乎是稳固的 —— 无论现在还是将来。 + +### GraphQL 的崛起 + +移动应用程序性能和组织敏捷性重要性的提高为 GraphQL 登上现代企业体系结构的顶端提供了助推器。 + +鉴于 [REST][4] 是一种非常流行的体系结构风格,早已提供了数据交互机制,与 [REST][4] 相比,GraphQL 这项新技术具有哪些优势呢?GraphQL 中的 “QL” 代表着查询语言,而这是一个很好的起点。 + +借助 GraphQL,组织内的不同客户端应用程序可以轻松地仅查询所需数据,这一点超越了其它 REST 方法,并带来了实际应用程序性能的提高。使用传统的 [REST][4] API 端点,客户端应用程序将详询服务器资源,并接受包含了与请求匹配的所有数据的响应。如果来自 [REST][4] API 端点的成功响应返回 35 个字段,那么客户端应用程序就会收到 35 个字段。 + +### 获取的问题 + +传统上,[REST][4] API 没有为客户端应用程序提供简便的方法来仅检索或只更新它们关心的数据。这通常被描述为“过度获取over-fetching”的问题。随着移动应用程序在人们的日常生活中的普遍使用,过度获取问题会给现实世界带来不良后果。移动应用程序发出的每个请求、每一个字节的接受和发送,对终端用户的性能影响越来越大。数据连接速度较慢的用户尤其会受到不太好的 API 设计方案的影响。使用移动应用程序而性能体验不佳的客户更有可能不购买产品或不使用服务。低效的 API 设计只会浪费企业的钱。 + +并非只有“过度获取”是问题,“欠缺获取”同样也是问题。默认情况下,端点只返回客户端实际需要的部分数据,这需要客户端进行额外的调用以满足其数据需求,这就产生了额外的 HTTP 请求。由于过度和欠缺的获取问题及其对客户端应用程序性能的影响,促进有效获取的 API 技术才有机会在市场上引起轰动 —— GraphQL 大胆地介入并填补了这一空白。 + +### REST 的应对 + +[REST][4] API 设计师不甘心不战而退,他们试图通过以下几种方式来应对移动应用程序性能问题: + +* “包含”和“排除”查询参数,允许客户端应用程序通过可能较长的查询格式来指定所需的字段。 +* “复合”服务,将多个端点组合在一起,以使客户端应用程序在其发出的请求数量和接收到的数据方面更高效。 +   +尽管这些模式是 [REST][4] API 社区为解决移动客户端所面临的挑战而做出的英勇尝试,但它们在以下几个关键方面仍存在不足: + +* 包含和排除查询键/值对很快就会变得混乱,特别是对于需要用嵌套“点表示法”语法(或类似方法)以对目标数据进行包含和排除的深层对象图而言,更是如此。此外,在此模型中调试查询字符串的问题通常需要手动分解 URL。 +* 包含和排除查询的服务器的实现往往是自定义的,因为基于服务器的应用程序没有标准的方式来处理包含和排除查询的使用,就像没有定义包含和排除查询的标准方式一样。 +* 复合服务的兴起形成了更加紧密耦合的后端和前端系统,这就需要加强协调以交付项目,并且将曾经的敏捷项目转回瀑布式开发。这种协调和耦合还有一个痛苦的副作用,那就是减宦了组织的敏捷性。此外,顾名思义,组合服务不是 RESTful。 +   +### GraphQL 的起源 + +对于 Facebook 来说,从其 2011-2012 年基于 HTML5 版本的旗舰移动应用程序中感受到的痛点和体验,才造就了 GraphQL。Facebook 工程师意识到提高性能至关重要,因此意识到他们需要一种新的 API 设计来确保最佳性能。可能考虑到上述 [REST][4] 的局限性,并且需要支持许多 API 客户端的不同需求,因此人们可以理解是什么导致其共同创建者 Lee Byron 和 Dan Schaeffer(那时尚是 Facebook 员工)创建了后来被称之为 GraphQL 的技术的早期种子。 + +通过 GraphQL 查询语言,客户端(通常是单个 GraphQL 端点)应用程序通常可以显著减少所需的网络调用数量,并确保仅检索所需的数据。在许多方面,这可以追溯到早期的 Web 编程模型,在该模型中,客户端应用程序代码会直接查询后端系统 —— 比如说,有些人可能还记得 10 到 15 年前在 JSP 上用 JSTL 编写 SQL 查询的情形吧! + +现在最大的区别是使用 GraphQL,我们有了一个跨多种客户端和服务器语言和库实现的规范。借助 GraphQL 这样一种 API 技术,我们通过引入 GraphQL 应用程序中间层来解耦后端和前端应用程序系统,该层提供了一种机制,以与组织的业务领域相一致的方式来访问组织数据。 + +除了解决软件工程团队遇到的技术挑战之外,GraphQL 还促进了组织敏捷性的提高,特别是在企业中。启用 GraphQL 的组织敏捷性通常归因于以下因素: + + * GraphQL API 设计人员和开发人员无需在客户端需要一个或多个新字段时创建新的端点,而是能够将这些字段包含在现有的图实现中,从而以较少的开发工作量和跨应用程序系统的较少更改的方式展示出新功能。 + * 通过鼓励 API 设计团队将更多的精力放在定义对象图上,而不是在专注于客户端应用程序交付上,前端和后端软件团队为客户交付解决方案的速度日益解耦。 +   +### 采纳之前的注意事项 + +尽管 GraphQL 具有引人注目的优势,但 GraphQL 并非没有实施挑战。一些例子包括: + +* 为 [REST][4] API 建立的缓存机制更加成熟。 +* 使用 [REST][4] 来构建 API 的模式更加完善。 +* 尽管工程师可能更喜欢 GraphQL 等新技术,但与 GraphQL 相比,市场上的人才库更多是从事于构建基于 [REST][4] 的解决方案。 + +### 结论 + +通过同时提高性能和组织敏捷性,GraphQL 在过去几年中被企业采纳的数量激增。但是,与 API 设计的 RESTful 生态系统相比,它确实还需要更成熟一些。 + +GraphQL 的一大优点是,它并不是作为替代 API 解决方案的批发替代品而设计的。相反,GraphQL 可以用来补充或增强现有的 API。因此,鼓励企业探索在 GraphQL 对其最有意义的地方逐步采用 GraphQL —— 在他们发现它对应用程序性能和组织敏捷性具有最大的积极影响的地方。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/6/why-use-graphql + +作者:[Zach Lendon][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/zachlendon/users/goncasousa/users/patrickhousley +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/metrics_graph_stats_blue.png?itok=OKCc_60D +[2]: https://graphql.org/ +[3]: https://linux.cn/article-12070-1.html +[4]: https://en.wikipedia.org/wiki/Representational_state_transfer diff --git a/published/202004/20190712 What is Silverblue.md b/published/202004/20190712 What is Silverblue.md new file mode 100644 index 0000000000..7437135b98 --- /dev/null +++ b/published/202004/20190712 What is Silverblue.md @@ -0,0 +1,98 @@ +[#]: collector: (lujun9972) +[#]: translator: (wxy) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12153-1.html) +[#]: subject: (What is Silverblue?) +[#]: via: (https://fedoramagazine.org/what-is-silverblue/) +[#]: author: (Tomáš Popela https://fedoramagazine.org/author/tpopela/) + +Silverblue 是什么? +====== + +![][1] + +Fedora Silverblue 在 Fedora 世界内外越来越受欢迎。因此,根据社区的反馈,以下是关于这个项目的一些有趣问题的答案。如果你有任何其他与 Silverblue 相关的问题,请在评论区留言,我们会在未来的文章中回答。 + +### Silverblue 是什么? + +Silverblue 是新一代桌面操作系统的代号,之前被称为 Atomic Workstation。该操作系统是通过利用 [rpm-ostree 项目][2]创建的映像来交付的。这种系统的主要优点是速度、安全性、原子更新和不变性。 + +### “Silverblue” 到底是什么意思? + +“Team Silverblue” 或简称 “Silverblue”,没有任何隐藏的含义。该项目以前被称为 Atomic Workstation,大约两个月后更名时选中了这个名字。在这个过程中,审查过 150 多个单词或单词组合。最终选择了 “Silverblue”,因为它有一个可用的域名以及社交网络账号。人们可以把它看成是 Fedora 的蓝色品牌的一个新的品牌形象,可以用在诸如“加油,Silverblue 团队!”或“想加入该团队,改进 Silverblue 吗?”这样的短语中。 + +### 何谓 ostree? + +[OSTree(或 libostree)是一个项目][3],它结合了一个类似 Git 的提交和下载可引导文件系统树的模型,以及用于部署它们和管理引导加载程序配置的层。OSTree 由 rpm-ostree 使用,这是 Silverblue 使用的一个基于包/镜像的混合系统。它原子化地复制了一个基础操作系统,并允许用户在需要时在基础操作系统之上“层叠”传统的 RPM。 + +### 为何使用 Silverblue? + +因为它可以让你专注于你的工作,而不是你正在运行的操作系统。因为系统的更新是原子式的,所以它更稳健。你唯一需要做的事情就是重新启动到新的镜像中。此外,如果当前启动的镜像有什么问题,你可以很容易地重启/回滚到之前可以工作的镜像,如果有的话。如果没有,你可以使用 `ostree` 命令下载并启动过去生成的任何其他镜像。 + +另一个好处是可以在不同的分支(或者用旧的语境说就是不同的 Fedora 风味版本)之间轻松切换。你可以轻松地尝试 [Rawhide][4] 或 [updates-testing][5] 分支,然后返回到包含当前稳定版本的分支。另外,如果你想尝试一些新奇的东西,也可以考虑试试 Silverblue。 + +### 不可变的操作系统有什么好处? + +其中一个主要的好处是安全。基础操作系统是以只读的形式挂载的,因此不能被恶意软件修改。唯一可以改变系统的方法是通过 `rpm-ostree` 实用程序。 + +另一个好处是健壮性。普通用户几乎不可能在不小心或无意中删除了一些系统库后,导致操作系统回到不启动或无法正常工作的状态。试着想想你过去的这些经历,就可以明白 Silverblue 可以如何帮助你。 + +### 如何在 Silverblue 中管理应用程序和包? + +对于图形化用户界面的应用程序,建议使用 [Flatpak][6] —— 如果应用程序是以 Flatpak 的形式提供的话。用户可以选择来自 Fedora 的 Flatpak,和从 Fedora 包及 Fedora 自己的基础架构中构建的 Flatpak,或者是目前有更广泛的交付品的 Flathub。用户可以通过已经支持 Fedora Silverblue 的 GNOME “软件”轻松安装它们。 + +用户首先发现的一件事就是操作系统中没有预装 `dnf`。主要原因是它不能在 Silverblue 上工作 —— 它的部分功能被 `rpm-ostree` 命令所取代。用户可以通过使用 `rpm-ostree install PACKAGE` 来层叠传统的软件包。但只有在没有其他方法的情况下,才应该使用这种方式。这是因为从存储库中提取新的系统镜像时,每次更改系统镜像时都必须重新构建系统镜像,以容纳层叠的包或从基础操作系统中删除及替换为其他版本的包。 + +Fedora Silverblue 自带的默认 GUI 应用程序集是基础操作系统的一部分。团队正在努力将它们移植到 Flatpak 上,这样它们就可以通过这种方式分发。其中一个好处是,基础操作系统将变得更小,更容易维护和测试,用户可以更容易修改他们的默认安装环境。如果你想看一下它是怎么做的,或者有什么帮助,可以看看官方的[文档][7]。 + +### 什么是 Toolbox? + +[Toolbox][8] 是一个让普通用户可以轻松使用容器的项目。它通过使用 podman 的无 root 容器环境来实现。Toolbox 可以让你在常规的 Fedora 环境中轻松、快速地创建一个容器,你可以在这个容器上折腾或开发,而与你的操作系统分离。 + +### Silverblue 有路线图吗? + +形式上没有,因为我们正在关注在测试过程中发现的问题和社区的反馈。我们目前正在使用 Fedora 的 [Taiga][9] 来进行规划。 + +### Silverblue 的发布周期是多少? + +它和普通的 Fedora Workstation 是一样的。每 6 个月发布一次新版本,支持期为 13 个月。团队计划每两周(或更长时间)发布一次更新,而不是像现在这样每天发布一次。这样一来,更新可以在发送给其他用户之前,由 QA 和社区志愿者进行更彻底的测试。 + +### 不可变操作系统的未来前景如何? + +从我们的角度来看,桌面的未来会走向到不可变的操作系统。这对用户来说是最安全的,Android、ChromeOS、ChromeOS、最近的 macOS Catalina 全都在底层采用了这种方式。而对于 Linux 桌面来说,一些第三方软件期望写到操作系统的问题还是存在的。HP 打印机驱动程序就是一个很好的例子。 + +另一个问题是系统中的部分软件如何分发和安装。字体就是一个很好的例子。目前在 Fedora 中,它们是以 RPM 包的形式分发的。如果你想使用它们,你必须层叠它们,然后重新启动到新创建的包含它们的镜像中。 + +### 标准版 Workstation 的前景如何? + +Silverblue 有可能会取代普通的 Workstation 版本。但 Silverblue 要提供与 Workstation 版本相同的功能和用户体验还有很长的路要走。在此期间,这两款桌面产品将同时推出。 + +### Atomic Workstation 或 Fedora CoreOS 与这些有什么关系? + +Atomic Workstation 是在更名为 Fedora Silverblue 之前的项目名称。 + +Fedora CoreOS 是一个不同但相似的项目。它与 Silverblue 共享一些基本技术,如 `rpm-ostree`、`toolbox` 等。尽管如此,CoreOS 是一个更简约、专注于容器、自动更新的操作系统。 + +-------------------------------------------------------------------------------- + +via: https://fedoramagazine.org/what-is-silverblue/ + +作者:[Tomáš Popela][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://fedoramagazine.org/author/tpopela/ +[b]: https://github.com/lujun9972 +[1]: https://fedoramagazine.org/wp-content/uploads/2019/07/what-is-fedora-silverblue-816x345.jpg +[2]: https://rpm-ostree.readthedocs.io/en/latest/ +[3]: https://ostree.readthedocs.io/en/latest/ +[4]: https://fedoraproject.org/wiki/Releases/Rawhide +[5]: https://fedoraproject.org/wiki/QA:Updates_Testing +[6]: https://flatpak.org/ +[7]: https://docs.fedoraproject.org/en-US/flatpak/tutorial/ +[8]: https://github.com/debarshiray/toolbox +[9]: https://teams.fedoraproject.org/project/silverblue/ diff --git a/published/202004/20190814 9 open source cloud native projects to consider.md b/published/202004/20190814 9 open source cloud native projects to consider.md new file mode 100644 index 0000000000..0c2ffabd03 --- /dev/null +++ b/published/202004/20190814 9 open source cloud native projects to consider.md @@ -0,0 +1,251 @@ +[#]: collector: (lujun9972) +[#]: translator: (messon007) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12135-1.html) +[#]: subject: (9 open source cloud native projects to consider) +[#]: via: (https://opensource.com/article/19/8/cloud-native-projects) +[#]: author: (Bryant Son https://opensource.com/users/brsonhttps://opensource.com/users/marcobravo) + +值得关注的 9 个开源云原生项目 +====== + +> 工作中用了容器?熟悉这些出自云原生计算基金会的项目吗? + +![](https://img.linux.net.cn/data/attachment/album/202004/21/222735oa1wib1wgypoiwpp.jpg) + +随着用容器来开发应用的实践变得流行,[云原生应用][2]也在增长。云原生应用的定义为: + +> “云原生技术用于开发使用打包在容器中的服务所构建的应用程序,以微服务的形式部署,并通过敏捷的 DevOps 流程和持续交付工作流在弹性基础设施上进行管理。” + +这个定义提到了构成云原生应用的不可或缺的四个元素: + + 1. 容器 + 2. 微服务 + 3. DevOps + 4. 持续集成和持续交付 (CI/CD) + +尽管这些技术各有各自独特的历史,但它们之间却相辅相成,在短时间内实现了云原生应用和工具的惊人的指数级增长。这个[云原生计算基金会(CNCF)][4]信息图呈现了当今云原生应用生态的规模和广度。 + +![Cloud-Native Computing Foundation applications ecosystem][5] + +*云原生计算基金会项目* + +我想说,瞧着吧!这仅仅是一个开始。正如 NodeJS 的出现引发了无数的 JavaScript 工具的爆炸式增长一样,容器技术的普及也推动了云原生应用的指数增长。 + +好消息是,有几个组织负责监管并将这些技术连接在一起。 其中之一是 [开放容器倡议][6]Open Containers Initiative(OCI),它是一个轻量级的、开放的治理机构(或项目),“它是在 Linux 基金会的支持下形成的,其明确目的是创建开放的行业标准的容器格式和运行时。” 另一个是 CNCF,它是“一个致力于使云原生计算普及和可持续发展的开源软件基金会”。 + +通常除了围绕云原生应用建立社区之外,CNCF 还帮助项目围绕其云原生应用建立结构化管理。CNCF 创建了成熟等级的概念(沙箱级、孵化级或毕业级),分别与下图中的“创新者”、“早期采用者”和“早期大量应用”相对应。 + +![CNCF project maturity levels][7] + +*CNCF 项目成熟等级* + +CNCF 为每个成熟等级制定了详细的[标准][8](为方便读者而列在下面)。获得技术监督委员会(TOC)三分之二的同意才能转为孵化或毕业级。 + +**沙箱级** + +> 要想成为沙箱级,一个项目必须至少有两个 TOC 赞助商。 有关详细过程,请参见《CNCF 沙箱指南 v1.0》。 + +**孵化级** + +> 注:孵化级是我们期望对项目进行全面的尽职调查的起点。 +> +> 要进入孵化级,项目除了满足沙箱级的要求之外还要满足: +> +> * 证明至少有三个独立的最终用户已成功将其用于生产,且 TOC 判断这些最终用户具有足够的质量和范围。 +> * 提交者的数量要合理。提交者定义为具有提交权的人,即可以接受部分或全部项目贡献的人。 +> * 显示出有大量持续提交和合并贡献。 +> * 由于这些指标可能会根据项目的类型、范围和大小而有很大差异,所以 TOC 有权决定是否满足这些标准的活动水平。 + +**毕业级** + +> 要从沙箱或孵化级毕业,或者要使一个新项目作为已毕业项目加入,项目除了必须满足孵化级的标准外还要满足: +> +> * 至少有两个来自组织的提交者。 +> * 已获得并保持了“核心基础设施计划最佳实践徽章”。 +> * 已完成独立的第三方安全审核,并发布了具有与以下示例类似的范围和质量的结果(包括已解决的关键漏洞):,并在毕业之前需要解决所有关键的漏洞。 +> * 采用《CNCF 行为准则》。 +> * 明确规定项目治理和提交流程。最好将其列在 `GOVERNANCE.md` 文件中,并引用显示当前提交者和荣誉提交者的 `OWNERS.md` 文件。 +> * 至少有一个主仓的项目采用者的公开列表(例如,`ADOPTERS.md` 或项目网站上的徽标)。 +> * 获得 TOC 的绝大多数票,进入毕业阶段。如果项目能够表现出足够的成熟度,则可以尝试直接从沙箱级过渡到毕业级。项目可以无限期保持孵化状态,但是通常预计它们会在两年内毕业。 + +### 值得关注的 9 个项目 + +本文不可能涵盖所有的 CNCF 项目,我将介绍最有趣的 9 个毕业和孵化的开源项目。 + +名称|授权类型|简要描述 +---|---|--- +[Kubernetes][9] | Apache 2.0 | 容器编排平台 +[Prometheus][10] | Apache 2.0 | 系统和服务监控工具 +[Envoy][11] | Apache 2.0 | 边缘和服务代理 +[rkt][12] | Apache 2.0 | Pod 原生的容器引擎 +[Jaeger][13] | Apache 2.0 | 分布式跟踪系统 +[Linkerd][14] | Apache 2.0 | 透明服务网格 +[Helm][15] | Apache 2.0 | Kubernetes 包管理器 +[Etcd][16] | Apache 2.0 | 分布式键值存储 +[CRI-O][17] | Apache 2.0 | 专门用于 Kubernetes 的轻量级运行时环境 + +我也创建了视频材料来介绍这些项目。 + +- [video](https://youtu.be/3cDxYO2GK4w) + +### 毕业项目 + +毕业的项目被认为是成熟的,已被许多组织采用的,并且严格遵守了 CNCF 的准则。以下是三个最受欢迎的开源 CNCF 毕业项目。(请注意,其中一些描述来源于项目的网站并被做了改编。) + +#### Kubernetes(希腊语“舵手”) + +Kubernetes! 说起云原生应用,怎么能不提 Kubernetes 呢? Google 发明的 Kubernetes 无疑是最著名的基于容器的应用程序的容器编排平台,而且它还是一个开源工具。 + +什么是容器编排平台?通常,一个容器引擎本身可以管理几个容器。但是,当你谈论数千个容器和数百个服务时,管理这些容器变得非常复杂。这就是容器编排引擎的用武之地。容器编排引擎通过自动化容器的部署、管理、网络和可用性来帮助管理大量的容器。 + +Docker Swarm 和 Mesosphere Marathon 也是容器编排引擎,但是可以肯定地说,Kubernetes 已经赢得了这场比赛(至少现在是这样)。Kubernetes 还催生了像 [OKD][18] 这样的容器即服务(CaaS)平台,它是 Kubernetes 的 Origin 社区发行版,并成了 [Red Hat OpenShift][19] 的一部分。 + +想开始学习,请访问 [Kubernetes GitHub 仓库][9],并从 [Kubernetes 文档][20]页面访问其文档和学习资源。 + +#### Prometheus(普罗米修斯) + +Prometheus 是 2012 年在 SoundCloud 上构建的一个开源的系统监控和告警工具。之后,许多公司和组织都采用了 Prometheus,并且该项目拥有非常活跃的开发者和用户群体。现在,它已经成为一个独立的开源项目,独立于公司之外进行维护。 + +![Prometheus’ architecture][21] + +*Prometheus 的架构* + +理解 Prometheus 的最简单方法是可视化一个生产系统,该系统需要 24(小时)x 365(天)都可以正常运行。没有哪个系统是完美的,也有减少故障的技术(称为容错系统),但是,如果出现问题,最重要的是尽快发现问题。这就是像 Prometheus 这样的监控工具的用武之地。Prometheus 不仅仅是一个容器监控工具,但它在云原生应用公司中最受欢迎。此外,其他开源监视工具,包括 [Grafana][22],都借助了 Prometheus。 + +开始使用 Prometheus 的最佳方法是下载其 [GitHub 仓库][10]。在本地运行 Prometheus 很容易,但是你需要安装一个容器引擎。你可以在 [Prometheus 网站][23]上查看详细的文档。 + +#### Envoy(使者) + +Envoy(或 Envoy 代理)是专为云原生应用设计的开源的边缘代理和服务代理。由 Lyft 创建的 Envoy 是为单一服务和应用而设计的高性能的 C++ 开发的分布式代理,同时也是为由大量微服务组成的服务网格架构而设计的通信总线和通用数据平面。Envoy 建立在 Nginx、HAProxy、硬件负载均衡器和云负载均衡器等解决方案的基础上,Envoy 与每个应用相伴(并行)运行,并通过提供平台无关的方式提供通用特性来抽象网络。 + +当基础设施中的所有服务流量都经过 Envoy 网格时,很容易就可以通过一致的可观测性来可视化问题域,调整整体性能,并在单个位置添加基础功能。基本上,Envoy 代理是一个可帮助组织为生产环境构建容错系统的服务网格工具。 + +服务网格应用有很多替代方案,例如 Uber 的 [Linkerd][24](下面会讨论)和 [Istio][25]。Istio 通过将其部署为 [Sidecar][26] 并利用了 [Mixer][27] 的配置模型,实现了对 Envoy 的扩展。Envoy 的显著特性有: + +* 包括所有的“入场筹码table stakes(LCTT 译注:引申为基础必备特性)”特性(与 Istio 这样的控制平面组合时) +* 带载运行时 99% 数据可达到低延时 +* 可以作为核心的 L3/L4 过滤器,提供了开箱即用的 L7 过滤器 +* 支持 gRPC 和 HTTP/2(上行/下行) +* 由 API 驱动,并支持动态配置和热重载 +* 重点关注指标收集、跟踪和整体可监测性 + +要想了解 Envoy,证实其能力并实现其全部优势,需要丰富的生产级环境运行的经验。你可以在其[详细文档][28]或访问其 [GitHub][11] 仓库了解更多信息。 + +### 孵化项目 + +下面是六个最流行的开源的 CNCF 孵化项目。 + +#### rkt(火箭) + +rkt, 读作“rocket”,是一个 Pod 原生的容器引擎。它有一个命令行接口用来在 Linux 上运行容器。从某种意义上讲,它和其他容器如 [Podman][29]、Docker 和 CRI-O 相似。 + +rkt 最初是由 CoreOS (后来被 Red Hat 收购)开发的,你可以在其网站上找到详细的[文档][30],以及在 [GitHub][12] 上访问其源代码。 + +#### Jaeger(贼鸥) + +Jaeger 是一个开源的端到端的分布式追踪系统,适用于云端应用。在某种程度上,它是像 Prometheus 这样的监控解决方案。但它有所不同,因为其使用场景有所扩展: + +* 分布式事务监控 +* 性能和延时优化 +* 根因分析 +* 服务依赖性分析 +* 分布式上下文传播 + +Jaeger 是一项 Uber 打造的开源技术。你可以在其网站上找到[详细文档][31],以及在 [GitHub][13] 上找到其源码。 + +#### Linkerd + +像创建 Envoy 代理的 Lyft 一样,Uber 开发了 Linkerd 开源解决方案用于生产级的服务维护。在某些方面,Linkerd 就像 Envoy 一样,因为两者都是服务网格工具,旨在提供平台级的可观测性、可靠性和安全性,而无需进行配置或代码更改。 + +但是,两者之间存在一些细微的差异。 尽管 Envoy 和 Linkerd 充当代理并可以通过所连接的服务进行上报,但是 Envoy 并不像 Linkerd 那样被设计为 Kubernetes Ingress 控制器。Linkerd 的显著特点包括: + +* 支持多种平台(Docker、Kubernetes、DC/OS、Amazon ECS 或任何独立的机器) +* 内置服务发现抽象,可以将多个系统联合在一起 +* 支持 gRPC、HTTP/2 和 HTTP/1.x请 求和所有的 TCP 流量 + +你可以在 [Linkerd 网站][32]上阅读有关它的更多信息,并在 [GitHub][14] 上访问其源码。 + +#### Helm(舵轮) + +Helm 基本上就是 Kubernetes 的包管理器。如果你使用过 Apache Maven、Maven Nexus 或类似的服务,你就会理解 Helm 的作用。Helm 可帮助你管理 Kubernetes 应用程序。它使用“Helm Chart”来定义、安装和升级最复杂的 Kubernetes 应用程序。Helm 并不是实现此功能的唯一方法;另一个流行的概念是 [Kubernetes Operators][33],它被 Red Hat OpenShift 4 所使用。 + +你可以按照其文档中的[快速开始指南][34]或 [GitHub 指南][15]来试用 Helm。 + +#### Etcd + +Etcd 是一个分布式的、可靠的键值存储,用于存储分布式系统中最关键的数据。其主要特性有: + +* 定义明确的、面向用户的 API(gRPC) +* 自动 TLS,可选的客户端证书验证 +* 速度(可达每秒 10,000 次写入) +* 可靠性(使用 Raft 实现分布式) + +Etcd 是 Kubernetes 和许多其他技术的默认的内置数据存储方案。也就是说,它很少独立运行或作为单独的服务运行;相反,它以集成到 Kubernetes、OKD/OpenShift 或其他服务中的形式来运作。还有一个 [etcd Operator][35] 可以用来管理其生命周期并解锁其 API 管理功能: + +你可以在 [etcd 文档][36]中了解更多信息,并在 [GitHub][16]上访问其源码。 + +#### CRI-O + +CRI-O 是 Kubernetes 运行时接口的 OCI 兼容实现。CRI-O 用于各种功能,包括: + +* 使用 runc(或遵从 OCI 运行时规范的任何实现)和 OCI 运行时工具运行 +* 使用容器/镜像进行镜像管理 +* 使用容器/存储来存储和管理镜像层 +* 通过容器网络接口(CNI)来提供网络支持 + +CRI-O 提供了大量的[文档][37],包括指南、教程、文章,甚至播客,你还可以访问其 [GitHub 页面][17]。 + +我错过了其他有趣且开源的云原生项目吗?请在评论中提醒我。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/8/cloud-native-projects + +作者:[Bryant Son][a] +选题:[lujun9972][b] +译者:[messon007](https://github.com/messon007) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/brsonhttps://opensource.com/users/marcobravo +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/rh_003601_05_mech_osyearbook2016_cloud_cc.png?itok=XSV7yR9e (clouds in the sky with blue pattern) +[2]: https://opensource.com/article/18/7/what-are-cloud-native-apps +[3]: https://thenewstack.io/10-key-attributes-of-cloud-native-applications/ +[4]: https://www.cncf.io +[5]: https://opensource.com/sites/default/files/uploads/cncf_1.jpg (Cloud-Native Computing Foundation applications ecosystem) +[6]: https://www.opencontainers.org +[7]: https://opensource.com/sites/default/files/uploads/cncf_2.jpg (CNCF project maturity levels) +[8]: https://github.com/cncf/toc/blob/master/process/graduation_criteria.adoc +[9]: https://github.com/kubernetes/kubernetes +[10]: https://github.com/prometheus/prometheus +[11]: https://github.com/envoyproxy/envoy +[12]: https://github.com/rkt/rkt +[13]: https://github.com/jaegertracing/jaeger +[14]: https://github.com/linkerd/linkerd +[15]: https://github.com/helm/helm +[16]: https://github.com/etcd-io/etcd +[17]: https://github.com/cri-o/cri-o +[18]: https://www.okd.io/ +[19]: https://www.openshift.com +[20]: https://kubernetes.io/docs/home +[21]: https://opensource.com/sites/default/files/uploads/cncf_3.jpg (Prometheus’ architecture) +[22]: https://grafana.com +[23]: https://prometheus.io/docs/introduction/overview +[24]: https://linkerd.io/ +[25]: https://istio.io/ +[26]: https://istio.io/docs/reference/config/networking/v1alpha3/sidecar +[27]: https://istio.io/docs/reference/config/policy-and-telemetry +[28]: https://www.envoyproxy.io/docs/envoy/latest +[29]: https://podman.io +[30]: https://coreos.com/rkt/docs/latest +[31]: https://www.jaegertracing.io/docs/1.13 +[32]: https://linkerd.io/2/overview +[33]: https://coreos.com/operators +[34]: https://helm.sh/docs +[35]: https://github.com/coreos/etcd-operator +[36]: https://etcd.io/docs/v3.3.12 +[37]: https://github.com/cri-o/cri-o/blob/master/awesome.md diff --git a/published/202004/20190822 How the Linux desktop has grown.md b/published/202004/20190822 How the Linux desktop has grown.md new file mode 100644 index 0000000000..0bfb102dd6 --- /dev/null +++ b/published/202004/20190822 How the Linux desktop has grown.md @@ -0,0 +1,185 @@ +[#]: collector: (lujun9972) +[#]: translator: (wxy) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12068-1.html) +[#]: subject: (How the Linux desktop has grown) +[#]: via: (https://opensource.com/article/19/8/how-linux-desktop-grown) +[#]: author: (Jim Hall https://opensource.com/users/jim-hall) + +Linux 桌面史话 +====== + +> 自 20 世纪 90 年代初以来,Linux 桌面已从一个简单的窗口管理器发展为一个完整的桌面。让我们一起来回顾一下 Linux 桌面的历史。 + +![](https://img.linux.net.cn/data/attachment/album/202004/03/142430kei55auvvv254aka.jpg) + +我第一次安装 Linux 是在 1993 年。那时,安装这种操作系统没有太多的选择。早期,许多人只是从别人那里复制一个运行中的镜像。然后有人有了一个很好的想法,创建一个 Linux 的“发行版”,让你可以自定义要安装的软件。这就是 Softlanding Linux 系统(SLS),也是我首次接触 Linux。 + +当时我的 386 PC 虽然内存不多,但已经足够了。SLS 1.03 需要 2MB 的内存才能运行,如果要编译程序,则需要 4MB 的内存。如果要运行 X 窗口系统,则需要多达 8MB 的内存!而我的电脑正好有足够的内存来运行 X 窗口系统。 + +因为我是在命令行中成长的,所以图形化的用户界面对我来说并不重要,但它确实很方便,我可以在不同的窗口中运行应用程序,并在任务间轻松切换。 + +从我第一次尝试 Linux 开始,我就迷上了它。从那以后,我一直在台式机上使用 Linux。和许多人一样,我也曾有一段时间以双引导配置运行 Linux,这样我就可以跳回到 MS-DOS 和 Windows 来运行某些程序。直到 1998 年,我终于冒了个险,全面投身于 Linux 之中。 + +在过去的 26 年中,我看着 Linux 桌面逐渐成熟。在这段时间里,我还尝试了各种有趣的桌面环境,下面我来分享一下 Linux 桌面的历史。 + +### X 和窗口管理器 + +Linux 上的第一个“桌面”还不是桌面。相反,它们是运行在 X 窗口系统上的“窗口管理器window manager”(WM)。X 提供了图形用户界面的基本构件,比如在屏幕上创建窗口,并提供键盘和鼠标输入。就其本身而言,X 的用处并不大。为了使 X 图形环境变得有用,你需要一种方法来管理会话中的所有窗口。这就出现了窗口管理器window manager。运行 xterm 或 xclock 之类的 X 程序就会在一个窗口中打开该程序。窗口管理器可以跟踪窗口并进行基本的内部管理,例如让你可以来回移动窗口并将其最小化。其余的事情取决于你自己。你可以通过将程序名列在 `~/.xinitrc` 文件中以在 X 开始时启动这些程序,但是通常,你会从 xterm 中运行新程序。 + +在 1993 年,最常见的窗口管理器是 TWM,它的历史可以追溯到 1988 年。TWM 相当简单,仅仅提供了基本的窗口管理功能。 + +![TWM on SLS 1.05][2] + +*SLS 1.05 上的 TWM,显示了 xterm、xclock 和 Emacs 编辑器* + +另一个早期的窗口管理器是 OpenLook 虚拟窗口管理器(OLVWM)。OpenLook 是 Sun 微系统公司在 20世纪 80 年代开发的图形用户界面,后来被移植到其它 Unix 平台。作为一个*虚拟*窗口管理器,OLVWM 支持多个工作区。 + +![OLVWM on SLS 1.05][3] + +*SLS 1.05 上的 OLVWM,显示了 xterm 和虚拟工作区选择器* + +当 Linux 开始流行起来的时候,没多久就有人创建出性能更流畅、界面更好的新窗口管理器。这些新的窗口管理器中首先出现的是虚拟窗口管理器 FVWM。FVWM 比 TWM 或 OLVWM 更具现代感。但是,我们仍然没有桌面。 + +![FVWM on SLS 1.05][4] + +*SLS 1.05 上的 FVWM,显示了 xterm 和文件管理器* + +以现代的眼光来看,TWM 和 FVWM 可能看起来很朴素。但重要的是要想想当时其它图形环境是什么样子。 Windows 当时的版本看起来也相当简单。Windows 版本 1 到版本 3 使用了一个称为“程序管理器”的普通启动器。 + +![Windows 3.11][5] + +*Windows 3.11,显示程序管理器和记事本编辑器* + +1995 年 8 月,微软发布了 Windows 95,改变了现代 PC 桌面的格局。当然,我当时对此印象很深刻。我曾觉得 Windows 3.x 笨拙而丑陋,但 Windows 95 却流畅而漂亮。更重要的是,我们现在将 Windows 95 视为“**桌面**”。新的“桌面”隐喻是一个巨大的进步。你可以在桌面上放置图标——事实上,Windows 95 提供了两个默认的桌面图标,分别是“我的电脑”(用于打开文件管理器)和“回收站”(用于放置以后要删除的文件)。 + +但是,更重要的是,Windows 95 桌面的意味着*整合*。程序管理器不见了,取而代之的是屏幕底部的任务栏,可让你使用更简单的“开始”菜单启动新程序。任务栏是多功能的,还通过一系列的按钮显示了你正在运行的程序,而托盘显示了时间、扬声器音量和其它简单的控件。你可以在这个新桌面上右键单击任何对象, Windows 95 会为你提供一个上下文相关的菜单,其中又你可以执行的操作。 + +![Windows 95][6] + +*Windows 95,显示了记事本编辑器* + +与以前版本的 Windows 甚至其它 Linux 窗口管理器相比,Windows 95 的界面更加流畅并且易于使用。值得一提的是,Linux 开发人员创建了一个模仿 Windows 95 界面的 FVWM 的新版本。名为 FVWM95 的新窗口管理器仍然不是桌面,但它看起来非常漂亮。新的任务栏让你可以使用“开始”菜单启动新的 X 程序。任务栏还可以使用类似于 Windows 95 的按钮显示了正在运行的程序。 + +![FVWM95 on Red Hat Linux 5.2][7] + +*在 Red Hat Linux 5.2 上的 FVWM95,显示了 xterm 和一个带有 xterm 图标、文件管理器和其他程序的快速访问程序启动器* + +虽然 FVWM95 和其他窗口管理器都在改进,但核心问题仍然存在:Linux 并没有真正的桌面。它具有一堆窗口管理器,仅此而已。使用图形用户界面的 Linux 应用程序(基本上意味着它们是 X 应用程序)看起来形态各异且工作方式也不同。除了 X 窗口系统提供的简单的纯文本复制/粘贴功能外,你不能从一个应用程序复制和粘贴到另一个应用程序里。Linux 真正需要的是在其图形用户界面中进行彻底的重新打造,以创建它的第一个桌面。 + +### Linux 桌面之初啼 + +在 1996 年,Matthias Ettrich 有感于 X 之下 Linux 应用程序体验不一致的困扰。他想使找个更易于使用的图形环境,而且更重要的是,他想让所有东西都“集成”在一起,就像真正的桌面一样。 + +Matthias 开始了K 桌面环境K Desktop Environment(KDE)的工作。那个 K 代表着 “Kool”(LCTT 译注:即 Cool)。但是 KDE 这个名字也意味着可以类似通用桌面环境Common Desktop Environment(CDE)的做法,而 CDE 是“大 Unix”世界的标准。尽管到了 1996 年,CDE 看起来已经有点过时了。CDE 基于 Motif 部件集,这也是 FVWM 所模仿的设计。KDE 1.0 于 1998 年 7 月完成,与 FVWM95 等普通窗口管理器相比,它有了明显改进。 + +![KDE 1.0][8] + +*K 桌面环境(KDE)版本 1.0。图片来源:Paul Brown / KDE* + +KDE 是 Linux 向前迈出的一大步。最终,Linux 有了一个真正的桌面,集成了应用程序和更多现代的桌面图标。KDE 的设计与 Windows 95 并无不同。屏幕底部有一个任务栏,它提供了相当于 Windows 95 的“开始”菜单以及一些应用程序的快捷键。KDE 还支持虚拟桌面,这些桌面被巧妙地标记为 “One”、“ Two”、“Three” 和 “Four”。正在运行的应用程序通过位于屏幕顶部单独的任务栏的按钮表示。 + +但并不是每个人都对 KDE 感到满意。为了将 GUI 从系统中抽象出来,KDE 使用了 Trolltech 的 Qt 工具套件库。不幸的是,Qt 并不是以自由软件的许可证进行分发的。Trolltech 允许 Qt 在自由软件应用程序中免费使用,但在商业或专有应用程序中要收取使用费。而且这种二分法与自由软件不符。这给 Linux 发行版带来了问题:它们应该包括 KDE 吗?还是默认使用 FVWM 这样老式但属于自由软件的图形用户界面? + +面对这种情况,Miguel de Icaza 和 Federico Mena 于 1997 年开始开发新的 Linux 桌面上。这个新项目被称为 GNOME,即GNU 网络对象模型环境GNU Network Object Model Environment的缩写。GNOME 旨在成为一个完全自由的软件,并使用了一个不同的工具套件库 —— 来自 GIMP 图像编辑器的 GTK。GTK 从字面上的意思 GIMP 工具套件GIMP Tool Kit。当 GNOME 1.0 终于在 1999 年发布时,Linux 又多了一个现代化的桌面环境。 + +![GNOME 1.0][9] + +*GNOME 1.0 版。图片来源:GNOME 文档项目* + +有两个 Linux 桌面环境固然很棒,但“KDE 与 GNOME”之争仍持续了一段时间。到了 1999 年,Trolltech 以新的公共许可证 Q 公共许可证Q Public License(QPL)重新发布了 Qt 库。但是,新许可证有其自身的包袱—-QPL 仅适用于 Qt 在开源软件项目中的使用,而不适用于商业项目。因此,自由软件基金会Free Software Foundation(FSF)认为 QPL 与 GNU 通用公共许可证GNU General Public License(GNU GPL)[不兼容][10]。这个许可证问题一直持续到 2000 年 Trolltech 在 GNU GPL v2 下重新发布 Qt 库。 + +### 随着时间的发展 + +Linux 桌面继续走向成熟。KDE 和 GNOME 进行了一场友好的竞争,促使双方都在增加了新的功能,还互相交流了思想和观念。到了 2004 年,GNOME 和 KDE 都取得了长足的进步,但只是给用户界面带来了渐进式的变化。 + +KDE 2 和 3 继续依赖屏幕底部的任务栏概念,但并入了用于运行应用程序的按钮。KDE 最明显的变化之一是添加了 Konqueror 浏览器,该浏览器首次出现在 KDE 2 中。 + +![KDE 2.2.2 \(2001\) showing the Konqueror browser][11] + +*KDE 2.2.2(2001),显示了 Konqueror 浏览器。图片来源:Paul Brown / KDE* + +![KDE 3.2.2][12] + +*Fedora Core 2 上的 KDE 3.2.2(2004),显示了 Konqueror 文件管理器(使用 Fedora Core 2 主题)* + +GNOME 2 也使用了任务栏概念,但将任务栏一分为二:屏幕顶部的任务栏用于启动应用程序并响应桌面提示,屏幕底部的任务栏用于显示正在运行的应用程序。我把这两个任务栏称之为“你可以做的事情”(顶部)和“你正在做的事情”(底部)。除了精简的用户界面外,GNOME 还添加了由 Eazel 开发的更新过的文件管理器,名为 Nautilus。 + +![GNOME 2.6.0][13] + +*Fedora Core 2 上的 GNOME 2.6.0(2004),显示了 Nautilus 文件管理器(使用 Fedora Core 2 主题)* + +随着时间的流逝,KDE 和 GNOME 走了不同的道路。两者都提供了功能丰富、健壮且现代化的桌面环境,但是却具有不同的用户界面目标。2011 年,GNOME 和 KDE 在桌面界面上出现了很大的偏差。KDE 4.6(2011 年 1 月)和 KDE 4.7(2011 年 7 月)提供了更传统的桌面感受,同时继续根植于许多用户熟悉的任务栏概念。当然,KDE 的底层发生很多变化,但是它仍然保留了熟悉的外观。 + +![KDE 4.6][14] + +*KDE 4.6,显示 Gwenview 图像查看器。图片来源:KDE* + +2011 年,GNOME 以一个新的桌面概念彻底改变了走向。GNOME 3 旨在创建一个更简单、更精简的桌面体验,使用户能够专注于自己的工作。任务栏消失了,取而代之的是屏幕顶部的黑色状态栏,其中包括音量和网络控件,显示了时间和电池状态,并允许用户通过重新设计过的菜单启动新程序。 + +菜单的变化最具最戏剧性。单击“活动”菜单或将鼠标移到“活动”的“热角”,所有打开的应用程序会显示为单独的窗口。用户还可以从“概述”中单击“应用程序”选项卡以启动新程序。“概述”还提供了一个内部集成的搜索功能。 + +![GNOME 3.0][15] + +*GNOME 3.0,显示 GNOME 图片应用程序。图片来源:GNOME* + +![GNOME 3.0][16] + +*GNOME 3.0,显示活动概述。图片来源:GNOME* + +### 你的桌面之选 + +拥有两个 Linux 桌面意味着用户有很大的选择余地。有些人喜欢 KDE,而另一些人喜欢 GNOME。没关系,选择最适合你的桌面就行。 + +可以肯定的是,KDE 和 GNOME 都有拥护者和批评者。例如,GNOME 因为放弃任务栏而改成“活动概述”而受到了不少批评。也许最著名的批评者是 Linus Torvalds,他在 2011 年[大声斥责并抛弃了][17]新的 GNOME,将其视为“邪恶的烂摊子”,然后在两年后又[回到了][18] GNOME。 + +其他人也对 GNOME 3 提出了类似的批评,以至于一些开发人员复刻 GNOME 2 的源代码创建了 MATE 桌面。MATE(是MATE 高级传统环境MATE Advanced Traditional Environment的递归缩写)延续了 GNOME 2 的传统任务栏界面。 + +无论如何,毫无疑问当今两个最受欢迎的 Linux 桌面是 KDE 和 GNOME。它们的当前版本非常成熟,功能也很丰富。KDE 5.16(2019)和 GNOME 3.32(2019)都试图简化和精简 Linux 桌面体验,但是方式有所不同。GNOME 3.32 继续致力于极简外观,删除所有分散用户注意力的用户界面元素,以便用户可以专注于其应用程序和工作。KDE 5.16 采用了更为熟悉的任务栏方法,但也增加了其他视觉上的改进和亮点,尤其是改进的小部件处理和图标。 + +![KDE 5.16 Plasma][19] + +*KDE 5.16 Plasma。图片来源:KDE* + +![GNOME 3.32][20] + +*GNOME 3.32。图片来源:GNOME* + +同时,你也不会完全失去它们之间的兼容性。每个主要的 Linux 发行版都提供了兼容性库,因此你可以在运行 GNOME 的同时来运行 KDE 应用程序。当你真正想使用的应用程序是为其他桌面环境编写的,这一点非常有用。你可以在 GNOME 上运行 KDE 应用程序,反之亦然。 + +我认为这种态势不会很快改变,这是一件好事。KDE 和 GNOME 之间的良性竞争使这两个阵营的开发人员可以避免故步自封。无论你使用 KDE 还是 GNOME,你都将拥有一个集成度很高的现代化桌面。而最重要的是,这意味着 Linux 拥有自由软件最好的特点:选择。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/8/how-linux-desktop-grown + +作者:[Jim Hall][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/jim-hallhttps://opensource.com/users/jason-bakerhttps://opensource.com/users/jlacroixhttps://opensource.com/users/doni08521059https://opensource.com/users/etc-eterahttps://opensource.com/users/marcobravohttps://opensource.com/users/alanfdoss +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/1980s-computer-yearbook.png?itok=eGOYEKK- (Person typing on a 1980's computer) +[2]: https://opensource.com/sites/default/files/uploads/twm-sls105.png (TWM on SLS 1.05) +[3]: https://opensource.com/sites/default/files/uploads/olvwm-sls105.png (OLVWM on SLS 1.05) +[4]: https://opensource.com/sites/default/files/uploads/fvwm-sls105.png (FVWM on SLS 1.05) +[5]: https://opensource.com/sites/default/files/uploads/win311.png (Windows 3.11) +[6]: https://opensource.com/sites/default/files/uploads/win95.png (Windows 95) +[7]: https://opensource.com/sites/default/files/uploads/fvwm95-rh52.png (FVWM95 on Red Hat Linux 5.2) +[8]: https://opensource.com/sites/default/files/uploads/kde1.png (KDE 1.0) +[9]: https://opensource.com/sites/default/files/uploads/gnome10.png (GNOME 1.0) +[10]: https://www.linuxtoday.com/developer/2000090500121OPLFKE +[11]: https://opensource.com/sites/default/files/uploads/kde_2.2.2.png (KDE 2.2.2 (2001) showing the Konqueror browser) +[12]: https://opensource.com/sites/default/files/uploads/kde322-fc2.png (KDE 3.2.2) +[13]: https://opensource.com/sites/default/files/uploads/gnome26-fc2.png (GNOME 2.6.0) +[14]: https://opensource.com/sites/default/files/uploads/kde46.png (KDE 4.6) +[15]: https://opensource.com/sites/default/files/uploads/gnome30.png (GNOME 3.0) +[16]: https://opensource.com/sites/default/files/uploads/gnome30-overview.png (GNOME 3.0) +[17]: https://www.theregister.co.uk/2011/08/05/linus_slams_gnome_three/ +[18]: https://www.phoronix.com/scan.php?page=news_item&px=MTMxNjc +[19]: https://opensource.com/sites/default/files/uploads/kde516.png (KDE 5.16 Plasma) +[20]: https://opensource.com/sites/default/files/uploads/gnome332.png (GNOME 3.32) diff --git a/published/202004/20191014 How to make a Halloween lantern with Inkscape.md b/published/202004/20191014 How to make a Halloween lantern with Inkscape.md new file mode 100644 index 0000000000..1cd31042d1 --- /dev/null +++ b/published/202004/20191014 How to make a Halloween lantern with Inkscape.md @@ -0,0 +1,155 @@ +[#]: collector: (lujun9972) +[#]: translator: (robsean) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12152-1.html) +[#]: subject: (How to make a Halloween lantern with Inkscape) +[#]: via: (https://opensource.com/article/19/10/how-make-halloween-lantern-inkscape) +[#]: author: (Jess Weichler https://opensource.com/users/cyanide-cupcake) + +如何使用 Inkscape 制作万圣节灯笼 +====== + +> 使用开源软件为你最喜欢的万圣节鬼屋制作一个有趣和怪异的装饰品。 + +![万圣节 - 背光飞行的蝙蝠][1] + +使用开源软件装饰一个独一无二的万圣节灯笼! + +通常,灯笼的一部分结构体是不透明的,以阻挡内部的光线。灯笼之所以成为灯笼,是因为其去掉了一些东西 :从结构体上切开的窗口,这样光线就可以射出。虽然对于照明来说不实用,但是一个有着怪异形状窗口和隐藏暗色轮廓的灯笼却可以令人兴奋,并创造出很多乐趣。 + +这篇演示如何使用 [Inkscape][2] 创建你自己的灯笼。如果还没有 Inkscape ,在 Linux 上,你可以从软件库中安装它,在 MacOS 和 Windows 上,你可以从[Inkscape 网站][3] 上下载它. + +### 使用材料 + + * 模板([A4][4] 或[信纸][5]大小) + * 卡片纸(黑色是传统色) + * 描图纸(可选) + * 裁纸刀、尺子、切割垫板(可使用工艺切割机/激光切割机代替) + * 工艺胶 + * LED 茶灯"蜡烛" + +安全注意事项:这个项目只使用电池操作的蜡烛。 + +### 理解模板 + +首先,从上面的链接下载你所在区域(A4 或信纸)的合适的模板,然后在 Inkscape 中打开它。 + +![灯笼模板荧光屏][6] + +灰白色的棋盘格背景是透明的(从技术角度来说,它是 alpha 通道。) + +黑色基板构成了灯笼。现在,没有窗口可以让光线穿过;灯笼有一个非镂空的黑色基板。你将在 Inkscape 中使用**并集**和**差集**选项来数字化的设计窗口。 + +蓝色虚线表示折线。橙色实线表示参考线。采光窗口不应该放在橙色盒子的外面。 + +模板的左侧是你可以在你设计中使用的一些预先制作好的对象。 + +### 创建一个窗口或形状 + +1. 创建一个看起来像你想要的窗口样式的对象。可以使用 Inkscape 左侧工具栏中的一些形状工具来创建对象。此外,你可以下载共创或公共领域的剪贴画,并导入 PNG 文件到你的项目中。 +2. 当你对对象的形状满意时,在顶部菜单中选择“路径” -> “对象转化成路径” 将其转换为一个路径(而不是一个形状,Inkscape 视其为两种不同的对象)。 + + ![对象到路径 菜单][7] + +3. 在基板形状的上面放置对象。 +4. 选择对象和黑色基板。通过先单击一个,并按住 `Shift` 按键,再选择另一个来完成。 +5. 从顶部菜单选择“路径” -> “差集” 来从基板的对象中移除形状。这将创建灯笼中的一个窗口。 + + ![路径 > 差集 菜单][8] + +### 添加对象到窗口中 + +在制作了一个窗口后,你可以添加对象到其中来创建一个场景。 + +提示: + +* 所有的对象,包括文本,必须连接到灯笼的基板,否则,在切割后会掉落下来,并留下一片空白。 +* 避免小而复杂的细微之处。即使使用激光切割机或工艺切割机等机器,也很难切割这些细微之处。 + +1. 创建或导入一个对象。 +2. 放置对象到窗口内,以便它至少接触基板的两侧。 +3. 选择对象后,从顶部菜单选择“连接” -> “对象转化成路径”。 + + ![对象到路径 菜单][9] + +4. 选择对象和黑色基板,通过在按住 `Shift` 按键的同时单击每一个来完成。 +5. 选择“路径” -> “并集”来使对象和基板合二为一。 + +### 添加文本 + +文本既可以从基板剪出文字来创建一个窗口(就像我对星星所做的那样),或者也可以添加到一个窗口上(它可以阻挡来自灯笼内部的光线)。如果你要创建一个窗口,只需要执行下面的步骤 1 和步骤 2,然后使用“差集”来从基板移除文本。 + +1. 从左侧边栏中选择文本工具来创建文本。粗体字体效果最好。 + + ![文本工具][10] + +2. 选择你的文本,然后从顶部菜单选择“路径” -> “对象转化成路径”。这将转换文本对象为一个路径。注意,这个步骤意味着你将不能再编辑该文本,所以,*只有当*你确定你拥有想要的单词后,执行这个步骤。 +3. 在你转换文本后,你可以按键盘上的 `F2` 来激活节点编辑器工具,当选择使用这个工具时,可以清楚地显示文本的节点。 + + ![选中的文本使用节点编辑器][11] + +4. 取消文本分组。 +5. 调整每个字母,以便使其与相邻字母或基板稍微重叠。 + + ![重叠文本][12] + +6. 为将所有的字母彼此连接,并连接到基板,重新选择所有文本和基板,然后选择“路径” -> “并集”。 + + ![使用 路径 > 并集 连接字母和基板][13] + +### 准备打印 + +下面是手工切割灯笼的说明。如果使用激光切割机或工艺切割机,遵循硬件所需要的技巧来准备好你的文件。 + +1. 在“图层”面板中,单击“安全”图层旁边的“眼睛”图标来隐藏安全线。如果你看不到图层面板,通过顶部菜单选择“图层” -> “图层”来显示它。 +2. 选择黑色基板。在“填充和笔划”面板中,设置填充为“X”(意味着*不填充*),设置“笔划”为纯黑色(对于喜欢十六进制的粉丝来说是 `#000000ff` )。 + + ![设置填充和笔划][14] + +3. 使用“文件” -> “打印”来打印你的图案。 +4. 使用一把工艺刀和直尺,小心地绕着每一条黑线切割。在蓝色虚线上轻划,然后折叠。 + + ![裁剪灯笼][15] + +5. 要完成窗口的制作,剪切描图纸为每个窗口的大小,然后粘贴它到灯笼的内侧。 + + ![添加描图纸][16] + +6. 在折条处把灯笼的边粘在一起。 +7. 接通电池供电的 LED 蜡烛,并放置它到你灯笼中。 + + ![完成灯笼][17] + +现在你的灯笼已经完成了,准备好点亮你的鬼屋了。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/10/how-make-halloween-lantern-inkscape + +作者:[Jess Weichler][a] +选题:[lujun9972][b] +译者:[robsean](https://github.com/robsean) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/cyanide-cupcake +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/halloween_bag_bat_diy.jpg?itok=24M0lX25 (Halloween - backlit bat flying) +[2]: https://opensource.com/article/18/1/inkscape-absolute-beginners +[3]: http://inkscape.org +[4]: https://www.dropbox.com/s/75qzjilg5ak2oj1/papercraft_lantern_A4_template.svg?dl=0 +[5]: https://www.dropbox.com/s/8fswdge49jwx91n/papercraft_lantern_letter_template%20.svg?dl=0 +[6]: https://opensource.com/sites/default/files/uploads/lanterntemplate_screen.png (Lantern template screen) +[7]: https://opensource.com/sites/default/files/uploads/lantern1.png (Object to path menu) +[8]: https://opensource.com/sites/default/files/uploads/lantern2.png (Object > Difference menu) +[9]: https://opensource.com/sites/default/files/uploads/lantern3.png (Object to path menu) +[10]: https://opensource.com/sites/default/files/uploads/lantern4.png (Text tool) +[11]: https://opensource.com/sites/default/files/uploads/lantern5.png (Text selected with Node editor) +[12]: https://opensource.com/sites/default/files/uploads/lantern6.png (Overlapping the text) +[13]: https://opensource.com/sites/default/files/uploads/lantern7.png (Connecting letters and base with Path > Union) +[14]: https://opensource.com/sites/default/files/uploads/lantern8.png (Setting fill and stroke) +[15]: https://opensource.com/sites/default/files/uploads/lantern9.jpg (Cutting out the lantern) +[16]: https://opensource.com/sites/default/files/uploads/lantern10.jpg (Adding tracing paper) +[17]: https://opensource.com/sites/default/files/uploads/lantern11.jpg (Completed lantern) diff --git a/published/202004/20191209 Use the Fluxbox Linux desktop as your window manager.md b/published/202004/20191209 Use the Fluxbox Linux desktop as your window manager.md new file mode 100644 index 0000000000..d3eb78339e --- /dev/null +++ b/published/202004/20191209 Use the Fluxbox Linux desktop as your window manager.md @@ -0,0 +1,158 @@ +[#]: collector: (lujun9972) +[#]: translator: (robsean) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12082-1.html) +[#]: subject: (Use the Fluxbox Linux desktop as your window manager) +[#]: via: (https://opensource.com/article/19/12/fluxbox-linux-desktop) +[#]: author: (Seth Kenlon https://opensource.com/users/seth) + +使用 Fluxbox 桌面作为你的窗口管理器 +====== + +> 本文是 24 天 Linux 桌面特别系列的一部分。Fluxbox 对系统资源的占用非常轻量,但它拥有重要的 Linux 桌面功能,让你的用户体验轻松、高效、快捷。 + +![](https://img.linux.net.cn/data/attachment/album/202004/07/113105p0ng5skkn5kmvdm0.jpg) + +桌面的概念可谓是仁者见仁智者见智。很多人把桌面看作一个家的基地,或者一个舒适的客厅,甚至是一个字面意义上的桌面,在其中放置着他们经常使用的记事本、最好的笔和铅笔,还有他们最喜欢的咖啡杯。KDE、 GNOME、Pantheon 等等在 Linux 上提供了这种舒适的生活方式。 + +但是对一些用户来说,桌面只是一个空荡荡的显示器空间,这是还没有任何可以自由浮动的应用程序窗口直接投射到他们的视网膜上的副作用。对于这些用户来说,桌面是一个空的空间,他们可以在上面运行应用程序 —— 无论是大型办公软件和图形套件,还是一个简单的终端窗口,或是来管理服务的托盘小程序。这种操作 [POSIX][2] 计算机的模式由来已久,该家族树的一支是 *box 窗口管理器:Blackbox、Fluxbox 和 Openbox。 + +[Fluxbox][3] 是一个 X11 系统的窗口管理器,它基于一个较老的名为 Blackbox 的项目。当我发现 Linux 时,Blackbox 的开发已进入衰退期,因此我就喜欢上了 Fluxbox ,此后我至少在一个以上的常用的系统上使用过它。它是用 C++ 编写的,并在 MIT 开源许可证下授权。 + +### 安装 Fluxbox + +你很可能会在你的 Linux 发行版的软件库中找到 Fluxbox,但是你也可以在 [Fluxbox.org][4] 上找到它。如果你正在运行另外一个桌面,在同一个系统上安装 Fluxbox 是安全的,因为 Fluxbox 不会预设任何配置或附带的应用程序。 + +在安装 Fluxbox 后,注销你当前的桌面会话,以便你可以登录一个新的桌面会话。默认情况下,你的桌面会话管理器 (KDM、GDM、LightDM 或 XDM,取决于你的安装设置) 将继续让登录到之前的桌面,所以你在登录前必需要覆盖上一个桌面。 + +使用 GDM 覆盖一个桌面: + +![在 GDM 中选择你的桌面会话][5] + +或者使用 KDM: + +![使用 KDM 选择你的桌面会话][6] + +### 配置 Fluxbox 桌面 + +当你第一次登录到桌面时,屏幕基本是空的,因为 Fluxbox 提供的所有东西是面板(用于任务栏、系统托盘等等)和用于应用程序窗口的窗口装饰品。 + +![在 CentOS 7 上的默认 Fluxbox 配置][7] + +如果你的发行版提供一个简单的 Fluxbox 桌面,你可以使用 `feh` 命令(你可能需要从你的发行版的软件库中安装它)来为你的桌面设置背景。这个命令有几个用于设置背景的选项,包括使用你选择的墙纸来填充屏幕的 `--bg-fill` 选项,来按比例缩放的 `--bg-scale` 等等选项。 + +``` +$ feh --bg-fill ~/photo/oamaru/leaf-spiral.jpg +``` + +![应用主题的 Fluxbox ][8] + +默认情况下,Fluxbox 自动生成一个菜单,在桌面上任意位置右键单击可用该菜单,这给予你访问应用程序的能力。根据你的发行版的不同,这个菜单可能非常小,也可能列出 `/usr/share/applications` 目录中的所有启动程序。 + +Fluxbox 配置是在文本文件中设置的,这些文本文件包含在 `$HOME/.fluxbox` 目录中。你可以: + +* 在 `keys` 中设置键盘快捷键 +* 在 `startup` 中启动的服务和应用程序 +* 在 `init` 设置桌面首选项(例如工作区数量、面板位置等等) +* 在 `menu` 中设置菜单项 + +该文本配置文件非常易于推断,但是你也可以(并且是应该)阅读 Fluxbox 的[文档][9]。 + +例如,这是我的典型菜单(或者说至少有它的基本结构): + +``` +# 为使用你自己的菜单,复制这些文本到 ~/.fluxbox/menu,然后编辑 +# ~/.fluxbox/init ,并更改 session.menuFile 文件路径到 ~/.fluxbox/menu + +[begin] (fluxkbox) + [submenu] (apps) {} + [submenu] (txt) {} + [exec] (Emacs 23 (text\)) { x-terminal-emulator -T "Emacs (text)" -e /usr/bin/emacs -nw} <> + [exec] (Emacs (X11\)) {/usr/bin/emacs} <> + [exec] (LibreOffice) {/usr/bin/libreoffice} + [end] + [submenu] (code) {} + [exec] (qtCreator) {/usr/bin/qtcreator} + [exec] (eclipse) {/usr/bin/eclipse} + [end] + [submenu] (graphics) {} + [exec] (ksnapshot) {/usr/bin/ksnapshot} + [exec] (gimp) {/usr/bin/gimp} + [exec] (blender) {/usr/bin/blender} + [end] + [submenu] (files) {} + [exec] (dolphin) {/usr/bin/dolphin} + [exec] (konqueror) { /usr/bin/kfmclient openURL $HOME } + [end] + [submenu] (network) {} + [exec] (firefox) {/usr/bin/firefox} + [exec] (konqueror) {/usr/bin/konqueror} + [end] + [end] +## 更改窗口管理器或工作环境 +[submenu] (environments) {} + [restart] (flux) {/usr/bin/startfluxbox} + [restart] (ratpoison) {/usr/bin/ratpoison} + [exec] (openIndiana) {/home/kenlon/qemu/startSolaris.sh} +[end] + +[config] (config) + [submenu] (styles) {} + [stylesdir] (/usr/share/fluxbox/styles) + [stylesdir] (~/.fluxbox/styles) + [end] +[workspaces] (workspaces) +[reconfig] (reconfigure) +[restart] (restart) +[exit] (exeunt) +[end] +``` + +该菜单也提供一些首选项设置,例如,选择一个主题,从 Fluxbox 会话中重启或注销的能力。 + +我使用键盘快捷键来启动大多数的应用程序,这些快捷键写入到 `keys` 配置文件中。这里有一些示例(`Mod4` 按键是 `Super` 键,我使用其来指定全局快捷键): + +``` +# 打开应用程序 +Mod4 t :Exec konsole +Mod4 k :Exec konqueror +Mod4 z :Exec fbrun +Mod4 e :Exec emacs +Mod4 f :Exec firefox +Mod4 x :Exec urxvt +Mod4 d :Exec dolphin +Mod4 q :Exec xscreensaver-command -activate +Mod4 3 :Exec ksnapshot +``` + +在这些快捷方式和一个打开的终端之间,在我工作日的大部分时间内很少使用鼠标,因此从一个控制器切换到另一个控制器不会浪费时间。并且因为 Fluxbox 很好地避开了控制器之间切换的方法,因此在其中操作没有一丝干扰。 + +### 为什么你应该使用 Fluxbox + +Fluxbox 对系统资源的占用非常轻量,但是它拥有重要的功能,可以使你的用户体验轻松、快速、高效。它很容易定制,并且允许你定义你自己的工作流。你不必使用 Fluxbox 的面板,因为还有其它优秀的面板。你甚至可以鼠标中键点击并拖动两个独立的应用程序窗口到彼此之中,以便它们成为一个窗口,每个窗口都有自己的选项卡。 + +可能性是无穷的,所以今天就在你的 Linux 上尝试一下 Fluxbox 的简单稳定吧! + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/12/fluxbox-linux-desktop + +作者:[Seth Kenlon][a] +选题:[lujun9972][b] +译者:[robsean](https://github.com/robsean) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/seth +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/browser_blue_text_editor_web.png?itok=lcf-m6N7 (Text editor on a browser, in blue) +[2]: https://opensource.com/article/19/7/what-posix-richard-stallman-explains +[3]: http://fluxbox.org +[4]: http://fluxbox.org/download/ +[5]: https://opensource.com/sites/default/files/advent-gdm_0.jpg (Select your desktop session in GDM) +[6]: https://opensource.com/sites/default/files/advent-kdm.jpg (Select your desktop session with KDM) +[7]: https://opensource.com/sites/default/files/advent-fluxbox-default.jpg (Default Fluxbox configuration on CentOS 7) +[8]: https://opensource.com/sites/default/files/advent-fluxbox-green.jpg (Fluxbox with a theme applied) +[9]: http://fluxbox.org/features/ diff --git a/published/202004/20191216 Relive Linux history with the ROX desktop.md b/published/202004/20191216 Relive Linux history with the ROX desktop.md new file mode 100644 index 0000000000..72c2993473 --- /dev/null +++ b/published/202004/20191216 Relive Linux history with the ROX desktop.md @@ -0,0 +1,103 @@ +[#]: collector: (lujun9972) +[#]: translator: (wxy) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12123-1.html) +[#]: subject: (Relive Linux history with the ROX desktop) +[#]: via: (https://opensource.com/article/19/12/linux-rox-desktop) +[#]: author: (Seth Kenlon https://opensource.com/users/seth) + +用 ROX 桌面重温 Linux 历史 +====== + +> 这篇文章是 Linux 桌面 24 天特别系列的一部分。如果你想来一次有趣的时光之旅,ROX 桌面非常值得一试。 + +![](https://img.linux.net.cn/data/attachment/album/202004/18/151533n196wag64gwhs0ga.jpg) + +[ROX][2] 桌面已经不再积极开发,而它的遗留问题至今仍然存在,但即使在它活跃开发的时候,它也是一个另类的 Linux 桌面。当其他的桌面感觉与旧式的 Unix 或 Windows 界面大致相似时,ROX 则属于 BeOS、AmigaOS 和 [RISC OS][3] 桌面阵营。 + +它专注于拖放式操作(这使得它的可访问性对某些用户来说并不理想)、点击式操作、弹出式上下文菜单,以及一个独特的应用程序目录系统,无需安装即可运行本地应用程序。 + +### 安装 ROX + +如今,ROX 基本上都被遗弃了,只剩下一点残渣碎片留给用户自己去收集整理。幸运的是,这个难题相对来说比较容易解决,但是当你在发行版的软件仓库中找到 ROX 桌面的碎片时,不要被迷惑了,因为那并不是 ROX 桌面全部的碎片。ROX 常用的部分 —— 文件管理器([ROX-Filer][4])和终端([ROXTerm][5]) —— 似乎在大多数流行的发行版软件仓库中都有存在,你可以将它们作为独立的应用程序安装(并使用)。然而,要运行 ROX 桌面,你必须同时安装 ROX-Session 和它所依赖的库。 + +我在 Slackware 14.2 上安装了 ROX,但它应该可以在任何 Linux 或 BSD 系统上运行。 + +首先,你必须从其版本库中安装 [ROX-lib2][6]。你要安装 ROX-lib2,按照它的理念,只需下载tarball、[解压][7],然后将 `ROX-lib` 目录移动到 `/usr/local/lib` 下就行。 + +接下来,你要安装 [ROX-Session][8]。这可能需要从源码中编译,因为它很可能不在你的软件仓库中。编译过程需要编译工具,这些工具在 Slackware 上是默认提供的,但在其他发行版中往往会被省略,以节省初始下载空间。根据你的发行版不同,你必须安装的包的名称也不同,所以请参考文档来了解具体内容。例如,在 Debian 发行版中,你可以在 [Debian 的 wiki][9] 中了解构建需求,而在 Fedora 发行版中,请参考 [Fedora 的文档][10]。安装了构建工具后,执行自定义的 ROX-Session 构建脚本。 + +``` +$ ./AppRun +``` + +这个脚本会自己管理构建和安装,并提示你需要 root 权限,以在你的登录屏上将其添加为一个选项。 + +如果你还没有从你的软件库中安装 ROX-Filer,请在继续之前安装。 + +这些组件共同组成了一个完整的 ROX 桌面。要登录到新桌面,请从当前桌面会话中注销。默认情况下,你的会话管理器(KDM、GDM、LightDM 或 XDM,视你的设置而定)会继续登录到你之前的桌面,所以在登录前必须覆盖。 + +使用 SDDM: + +![][11] + +使用 GDM: + +![][12] + +### ROX 桌面特性 + +ROX 桌面默认情况下很简单,屏幕底部有一个面板,桌面上有一个通往主目录的快捷方式图标。面板中包含了一些常用位置的快捷方式。这就是 ROX 桌面的全部功能,至少在安装后就是这样。如果你想要时钟、日历或系统托盘,你需要找到提供这些功能的应用程序。 + +![Default ROX desktop][13] + +虽然没有任务栏,但当你将窗口最小化时,它就会成为桌面上的一个临时图标。你可以点击该图标,将其窗口恢复到以前的大小和位置。 + +面板也可以进行一些修改。你可以在其中放置不同的快捷方式,甚至可以创建自己的小程序。 + +它没有应用菜单,也没有上下文菜单中的应用快捷方式。相反,你可以手动导航到 `/usr/share/applications`,或者你可以将你的应用目录或目录添加到 ROX 面板中。 + +![ROX desktop][14] + +ROX 桌面的工作流程集中在鼠标驱动上,让人联想到 Mac OS 7.5 和 8 系统。通过 ROX-filer,你可以管理权限、文件管理、内省introspection、脚本启动、后台设置,以及几乎所有你能想到的东西,只要你有足够的耐心,就可以实现点击式的交互。对于高级用户来说,这似乎很慢,但 ROX 设法让它变得相对无痛,而且非常直观。 + +### 应用程序目录、AppRun 和 AppImage + +ROX 桌面有一个优雅的惯例,按照此惯例,包含一个名为 `AppRun` 的脚本的目录就可以像一个应用程序一样被执行。这意味着,要制作一个 ROX 应用程序,你所要做的就是将代码编译到一个目录中,将一个名为`AppRun` 的脚本放在该目录的根目录下,来执行你所编译的二进制文件,然后将该目录标记为可执行即可。ROX-Filer 会按照你设置的方式来显示一个目录,并以特殊的图标和颜色显示一个目录。当你点击一个应用程序目录,ROX-Filer 会自动运行里面的 `AppRun` 脚本。它的外观和行为就像一个已经安装好的应用程序,但它是在用户的主目录下的本地目录,不需要特殊的权限。 + +这是一个方便的功能,但它是那些你使用时感觉很好的小功能之一,因为它很容易做到。它绝不是必要的,它只是比在本地建立一个应用程序,将目录隐藏在某个不显眼的地方,并建立一个快速的 `.desktop` 文件作为你的启动器,要领先了几步。然而,应用程序目录的概念已经当做灵感被 [AppImage][16] 打包系统所 [借鉴][15]。 + +### 为什么应该试试 ROX 桌面 + +把 ROX 设置好并使用是有些困难的,它似乎真的被抛弃了。然而,它的遗产在今天以多种方式继续存在,它是 Linux 历史上的一段迷人而有趣的历史。它可能不会成为你的主要桌面,但如果你想来一次有趣的回溯之旅,那么 ROX 非常值得一试。探索它、定制它,看看它包含了哪些巧妙的想法。也许还有一些隐藏的宝石可以让开源社区受益。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/12/linux-rox-desktop + +作者:[Seth Kenlon][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/seth +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/1980s-computer-yearbook.png?itok=eGOYEKK- (Person typing on a 1980's computer) +[2]: http://rox.sourceforge.net/desktop/ +[3]: https://www.riscosopen.org/content/ +[4]: http://rox.sourceforge.net/desktop/ROX-Filer +[5]: http://roxterm.sourceforge.net/ +[6]: http://rox.sourceforge.net/desktop/ROX-Lib +[7]: https://opensource.com/article/17/7/how-unzip-targz-file +[8]: http://rox.sourceforge.net/desktop/ROX-Session.html +[9]: https://wiki.debian.org/BuildingTutorial +[10]: https://docs.pagure.org/docs-fedora/installing-software-from-source.html +[11]: https://opensource.com/sites/default/files/advent-kdm_0.jpg +[12]: https://opensource.com/sites/default/files/advent-gdm_1.jpg +[13]: https://opensource.com/sites/default/files/uploads/advent-rox.jpg (Default ROX desktop) +[14]: https://opensource.com/sites/default/files/uploads/advent-rox-custom.jpg (ROX desktop) +[15]: https://github.com/AppImage/AppImageKit/wiki/AppDir +[16]: https://appimage.org/ diff --git a/published/202004/20191220 The Difference Between DNF and YUM, Why is Yum Replaced by DNF.md b/published/202004/20191220 The Difference Between DNF and YUM, Why is Yum Replaced by DNF.md new file mode 100644 index 0000000000..8521ab4291 --- /dev/null +++ b/published/202004/20191220 The Difference Between DNF and YUM, Why is Yum Replaced by DNF.md @@ -0,0 +1,68 @@ +[#]: collector: (lujun9972) +[#]: translator: (wxy) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12161-1.html) +[#]: subject: (The Difference Between DNF and YUM, Why is Yum Replaced by DNF?) +[#]: via: (https://www.2daygeek.com/comparison-difference-between-dnf-vs-yum/) +[#]: author: (Magesh Maruthamuthu https://www.2daygeek.com/author/magesh/) + +DNF 和 Yum 的区别,为什么 Yum 会被 DNF 取代? +====== + +由于 Yum 中许多长期存在的问题仍未得到解决,因此 [Yum 包管理器][1]已被 [DNF 包管理器][2]取代。这些问题包括性能差、内存占用过多、依赖解析速度变慢等。 + +DNF 使用 `libsolv` 进行依赖解析,由 SUSE 开发和维护,旨在提高性能。 + +Yum 主要是用 Python 编写的,它有自己的应对依赖解析的方法。它的 API 没有完整的文档,它的扩展系统只允许 Python 插件。 + +Yum 是 RPM 的前端工具,它管理依赖关系和资源库,然后使用 RPM 来安装、下载和删除包。 + +为什么他们要建立一个新的工具,而不是修复现有的问题呢? + +Ales Kozamblak 解释说,这个修复在技术上是不可行的,而且 Yum 团队还没有准备好立即接受修改。 + +另外,最大的挑战是,Yum 有 56000 行代码,但 DNF 只有 29000 行代码。 + +所以除了分叉,没有办法解决。 + +不过 Yum 的运行情况还算可以。 + + +编号 | DNF(Dandified YUM) | YUM(Yellowdog Updater, Modified) +---|---|--- +1 | DNF 使用 libsolv 来解析依赖关系,由 SUSE 开发和维护 | YUM 使用公开的 API 来解析依赖关系 +2 | API 有完整的文档 | API 没有完整的文档 +3 | 由 C、C++、Python 编写的 | 只用 Python 编写 +4 | DNF 目前在 Fedora、RHEL 8、CentOS 8、OEL 8 和 Mageia 6/7 中使用 | YUM 目前在 RHEL 6/7、CentOS 6/7、OEL 6/7 中使用 +5 | DNF 支持各种扩展 | Yum 只支持基于 Python 的扩展 +6 | API 有良好的文档,因此很容易创建新的功能 | 因为 API 没有正确的文档化,所以创建新功能非常困难 +7 | DNF 在同步存储库的元数据时,使用的内存较少 | 在同步存储库的元数据时,YUM 使用了过多的内存 +8 | DNF 使用满足性算法来解决依赖关系解析(它是用字典的方法来存储和检索包和依赖信息)| 由于使用公开 API 的原因,Yum 依赖性解析变得迟钝 +9 | 从内存使用量和版本库元数据的依赖性解析来看,性能都不错 | 总的来说,在很多因素的影响下,表现不佳 +10 | DNF 更新:在 DNF 更新过程中,如果包中包含不相关的依赖,则不会更新 | YUM 将在没有验证的情况下更新软件包 +11 | 如果启用的存储库没有响应,DNF 将跳过它,并继续使用可用的存储库处理事务 | 如果有存储库不可用,YUM 会立即停止 +12 | `dnf update` 和 `dnf upgrade` 是等价的 | 在 Yum 中则不同 +13 | 安装包的依赖关系不更新 | Yum 为这种行为提供了一个选项 +14 | 清理删除的包:当删除一个包时,DNF 会自动删除任何没有被用户明确安装的依赖包 | Yum 不会这样做 +15 | 存储库缓存更新计划:默认情况下,系统启动后 10 分钟后,DNF 每小时会对配置的存储库检查一次更新。这个动作由系统定时器单元 `dnf-makecache.timer` 控制 | Yum 也会这样做 +16 | 内核包不受 DNF 保护。不像 Yum,你可以删除所有的内核包,包括运行中的内核包 | Yum 不允许你删除运行中的内核 +17 | libsolv:用于解包和读取资源库。hawkey: 为 libsolv 提供简化的 C 和 Python API 库。librepo: 提供 C 和 Python(类似 libcURL)API 的库,用于下载 Linux 存储库元数据和软件包。libcomps: 是 yum.comps 库的替代品。它是用纯 C 语言编写的库,有 Python 2 和 Python 3 的绑定。| Yum 不使用单独的库来执行这些功能 +18 | DNF 包含 29000 行代码 | Yum 包含 56000 行代码 +19 | DNF 由 Ales Kozumplik 开发 | YUM 由 Zdenek Pavlas、Jan Silhan 和团队成员开发 + +-------------------------------------------------------------------------------- + +via: https://www.2daygeek.com/comparison-difference-between-dnf-vs-yum/ + +作者:[Magesh Maruthamuthu][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.2daygeek.com/author/magesh/ +[b]: https://github.com/lujun9972 +[1]: https://www.2daygeek.com/yum-command-examples-manage-packages-rhel-centos-systems/ +[2]: https://www.2daygeek.com/linux-dnf-command-examples-manage-packages-fedora-centos-rhel-systems/ diff --git a/published/202004/20191224 Why your Python code should be flat and sparse.md b/published/202004/20191224 Why your Python code should be flat and sparse.md new file mode 100644 index 0000000000..5f9bf864e6 --- /dev/null +++ b/published/202004/20191224 Why your Python code should be flat and sparse.md @@ -0,0 +1,85 @@ +[#]: collector: (lujun9972) +[#]: translator: (caiichenr) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12087-1.html) +[#]: subject: (Why your Python code should be flat and sparse) +[#]: via: (https://opensource.com/article/19/12/zen-python-flat-sparse) +[#]: author: (Moshe Zadka https://opensource.com/users/moshez) + +为何你的 Python 代码应是扁平与稀疏的 +====== + +> 本文是 Python 之禅特别系列的第三篇,此篇着眼于其中第五与第六条原则:扁平与稀疏。 + +![](https://img.linux.net.cn/data/attachment/album/202004/08/191645uiniiy56keig95gi.jpg) + +[Python 之禅][2] 之所以得名,正是由于它那简明扼要的规则被设计出的意图在于让读者进行深入地思考,而绝不单是为编程提供一份易于遵守的指南。 + +读后不去三思其意,断然难以体会 Python 之禅的妙处。倘若 Python 之禅仅仅罗列出一组清晰的法则,那法则之间的矛盾是一种缺憾,然而作为引导读者沉思最优方案沉思的工具,矛盾却是绝佳的。 + +### 扁平胜过嵌套Flat is better than nested + +迫于对缩进的强硬要求,Python 对“扁平化”的需求显然远超它者。其余编程语言为了缓解对缩进的需求,通常会在嵌套结构里加入一种“作弊”的手段。为了理解这一点,不妨一同来看看 JavaScript。 + +JavaScript 本质上是异步的,这意味着程序员用 JavaScript 写的代码会用到大量的回调函数。 + +``` +a(function(resultsFromA) { +  b(resultsFromA, function(resultsfromB) { +    c(resultsFromC, function(resultsFromC) { +      console.log(resultsFromC) +   } +  } +} +``` + +忽略这段代码的具体内容,只去观察这段代码的形状与缩进带来一个最右边的点的方式。这种独特的“箭头”图形在我们扫看代码时格外扎眼,这种写法也因此被视作不可取,甚至得到了“回调地狱”的绰号。不过,在 JavaScript 中,这种反映嵌套关系的缩进可以通过“作弊”来回避。 + +``` +a(function(resultsFromA) { +b(resultsFromA, +  function(resultsfromB) { +c(resultsFromC, +  function(resultsFromC) { +    console.log(resultsFromC) +}}} +``` + +Python 并没有提供这种作弊手段:每一级嵌套在代码中都如实的对应着一层缩进。因此,Python 深层的嵌套关系在*视觉*上也一定是深层嵌套的。这使得“回调地狱”的问题对于 Python 而言要比在 JavaScript 中严重得多:嵌套的回调函数必定带来缩进,而绝无使用花括号来“作弊”的可能。 + +这项挑战与 Python 之禅的指导原则相结合后,在我参与的库中催生出了一个优雅的解决方案。我们在 [Twisted][3] 框架里提出了 deferred 抽象,日后 JavaScript 中流行的 promise 抽象亦是受其启发而生。正是由于 Python 对整洁代码的坚守,方能推动 Python 开发者去发掘新的、强力的抽象。 + +``` +future_value = future_result() +future_value.addCallback(a) +future_value.addCallback(b) +future_value.addCallback(c) +``` + +(现代 JavaScript 程序员也许会觉得这段代码十分眼熟:promise 着实受到了 Twisted 里 deferred 抽象的深远影响。) + +### 稀疏胜过密集Sparse is better than dense + +最易降低代码密集程度的方法是引入嵌套。这种习惯也正是有关稀疏的原则要随着前一条提出的原因:在竭尽所能地减少嵌套之后,我们往往会遗留下*密集的*代码或数据结构。此处的密集,是指塞进过量信息的小段代码,它们会导致错误发生后的解析变得困难。 + +这种密集性唯有通过创造性的思考方可改善,此外别无捷径。Python 之禅并不为我们提供简单的解决方案,它只会指明改善代码的方向,而非提供“如何”去做的向导。 + +起身走走,泡个热水澡,抑或是闻闻花香。盘坐冥思,直至灵感袭来。当你终于得到启发,便是动身写代码之时。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/12/zen-python-flat-sparse + +作者:[Moshe Zadka][a] +选题:[lujun9972][b] +译者:[caiichenr](https://github.com/caiichenr) +校对:[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://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/browser_web_internet_website.png?itok=g5B_Bw62 (Digital creative of a browser on the internet) +[2]: https://www.python.org/dev/peps/pep-0020/ +[3]: https://twistedmatrix.com/trac/ diff --git a/published/202004/20200211 Navigating man pages in Linux.md b/published/202004/20200211 Navigating man pages in Linux.md new file mode 100644 index 0000000000..98ca0579ed --- /dev/null +++ b/published/202004/20200211 Navigating man pages in Linux.md @@ -0,0 +1,172 @@ +[#]: collector: (lujun9972) +[#]: translator: (wxy) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12127-1.html) +[#]: subject: (Navigating man pages in Linux) +[#]: via: (https://www.networkworld.com/article/3519853/navigating-man-pages-in-linux.html) +[#]: author: (Sandra Henry-Stocker https://www.networkworld.com/author/Sandra-Henry_Stocker/) + +在 Linux 中遨游手册页的海洋 +====== + +> Linux 系统上的手册页可以做的不仅仅是提供特定命令的信息。它们可以帮助你发现你没有意识到的命令。 + +![Hello I'm Nik][1] + +手册页提供了关于 Linux 命令的基本信息,很多用户经常参考它,但手册页的内容比我们很多人意识到的要多得多。 + +你总是可以输入一个像 `man who` 这样的命令,然后得到 `who` 命令的工作原理的漂亮描述,但是探索你可能不知道的命令可能会更有启发。例如,你可以使用 `man` 命令来帮助找到一些处理非常具有挑战性的任务的命令,或者显示一些选项,这些选项可以帮助你以新的更好的方式使用你已经知道的命令。 + +让我们来浏览一些选项,看看最终的结果是什么。 + +### 用 man 去识别命令 + +`man` 命令可以帮助你按主题查找命令。例如,如果你要找一个计算文件中的行数的命令,你可以提供一个关键字。在下面的例子中,我们把关键字 “count” 放在了引号中,并添加了空格,这样我们就不会得到与 “accounts” 或 “accounting” 相关的命令,而是得到那些可以为我们做一些计算的命令。 + +``` +$ man -k ' count ' +anvil (8postfix) - Postfix session count and request rate control +cksum (1) - checksum and count the bytes in a file +sum (1) - checksum and count the blocks in a file +timer_getoverrun (2) - get overrun count for a POSIX per-process timer +``` + +为了显示与新用户账户相关的命令,我们可以尝试使用这样的命令。 + +``` +$ man -k "new user" +newusers (8) - update and create new users in batch +useradd (8) - create a new user or update default new user information +zshroadmap (1) - informal introduction to the zsh manual The Zsh Manual, … +``` + +需要说明的是,上面的第三项只是提到 “new users” 类似的内容,并不是设置、删除或配置用户账号的命令。`man` 命令只是在命令描述中匹配了一些词,作用很像 `apropos` 命令。注意上面列出的每个命令后面的括号中的数字。这些数字与包含这些命令的手册页的分区有关。 + +### 确定手册页的分区 + +`man` 命令的分区将其内容划分为不同的类别。要列出这些类别,请键入 `man man`,并查看类似下面的描述。你的系统中很可能没有第 9 分区的命令。 + +- `1`:可执行程序或 shell 命令 +- `2`:系统调用(内核提供的函数) +- `3`:库调用(程序库内的函数) +- `4`:特殊文件(通常在可以 `/dev` 中找到) +- `5`:文件格式和惯例,例如 `/etc/passwd` +- `6`:游戏 +- `7`:杂项(包括宏包和约定),例如 `man`(7)、`groff`(7) +- `8`:系统管理命令(通常只由 root 用户使用) +- `9`:内核例程(非标准) + +手册页涵盖了比我们通常认为的“命令”更多的内容。从上面的描述中可以看到,它们涵盖了系统调用、库调用、特殊文件等等。 + +下面的列表显示了 Linux 系统中的手册页的实际存储位置。这些目录上的日期会有所不同,因为随着更新,其中一些分区会有新的内容,而另一些则不会。 + +``` +$ ls -ld /usr/share/man/man? +drwxr-xr-x 2 root root 98304 Feb 5 16:27 /usr/share/man/man1 +drwxr-xr-x 2 root root 65536 Oct 23 17:39 /usr/share/man/man2 +drwxr-xr-x 2 root root 270336 Nov 15 06:28 /usr/share/man/man3 +drwxr-xr-x 2 root root 4096 Feb 4 10:16 /usr/share/man/man4 +drwxr-xr-x 2 root root 28672 Feb 5 16:25 /usr/share/man/man5 +drwxr-xr-x 2 root root 4096 Oct 23 17:40 /usr/share/man/man6 +drwxr-xr-x 2 root root 20480 Feb 5 16:25 /usr/share/man/man7 +drwxr-xr-x 2 root root 57344 Feb 5 16:25 /usr/share/man/man8 +``` + +注意,为了节省空间,手册页文件一般都是 gzip 压缩的。每当你使用 `man` 命令时,`man` 命令会根据需要解压。 + +``` +$ ls -l /usr/share/man/man1 | head -10 +total 12632 +lrwxrwxrwx 1 root root 9 Sep 5 06:38 [.1.gz -> test.1.gz +-rw-r--r-- 1 root root 563 Nov 7 05:07 2to3-2.7.1.gz +-rw-r--r-- 1 root root 592 Apr 23 2016 411toppm.1.gz +-rw-r--r-- 1 root root 2866 Aug 14 10:36 a2query.1.gz +-rw-r--r-- 1 root root 2361 Sep 9 15:13 aa-enabled.1.gz +-rw-r--r-- 1 root root 2675 Sep 9 15:13 aa-exec.1.gz +-rw-r--r-- 1 root root 1142 Apr 3 2018 aaflip.1.gz +-rw-r--r-- 1 root root 3847 Aug 14 10:36 ab.1.gz +-rw-r--r-- 1 root root 2378 Aug 23 2018 ac.1.gz +``` + +### 按分区列出的手册页 + +即使只看第 1 分区的前 10 个手册页(如上所示),你也可能会看到一些新的命令 —— 也许是 `a2query` 或 `aaflip`(如上所示)。 + +探索命令的更好策略是按分区列出命令,不查看文件本身,而是使用 `man` 命令向你显示命令并提供每个命令的简要说明。 + +在下面的命令中,`-s 1` 指示 `man` 显示第 1 分区中的命令信息。`-k .` 使该命令对所有命令都有效,而不是指定一个特定的关键字;如果没有这个,`man` 命令就会回过头来问:“你想要什么手册页?”所以,使用关键字来选择一组相关的命令,或者使用点来显示一个分区中的所有命令。 + +``` +$ man -s 1 -k . +2to3-2.7 (1) - Python2 to Python3 converter +411toppm (1) - convert Sony Mavica .411 image to ppm +as (1) - the portable GNU assembler. +baobab (1) - A graphical tool to analyze disk usage +busybox (1) - The Swiss Army Knife of Embedded Linux +cmatrix (1) - simulates the display from "The Matrix" +expect_dislocate (1) - disconnect and reconnect processes +red (1) - line-oriented text editor +enchant (1) - a spellchecker +… +``` + +### 有多少手册页? + +如果你对每个分区中有多少手册页感到好奇,可以使用以下命令按分区对它们进行计数: + +``` +$ for num in {1..8} +> do +> man -s $num -k . | wc -l +> done +2382 +493 +2935 +53 +441 +11 +245 +919 +``` + +确切的数量可能有所不同,但是大多数 Linux 系统的命令数量差不多。如果我们使用命令将这些数字加在一起,我们可以看到运行该命令的系统上有将近 7500 个手册页。有很多命令,系统调用等。 + +``` +$ for num in {1..8} +> do +> num=`man -s $num -k . | wc -l` +> tot=`expr $num + $tot` +> echo $tot +> done +2382 +2875 +5810 +5863 +6304 +6315 +6560 +7479 <=== total +``` + +阅读手册页可以学到很多东西,但是以其他方式浏览手册页可以帮助你了解系统上可能不知道的命令。 + +-------------------------------------------------------------------------------- + +via: https://www.networkworld.com/article/3519853/navigating-man-pages-in-linux.html + +作者:[Sandra Henry-Stocker][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.networkworld.com/author/Sandra-Henry_Stocker/ +[b]: https://github.com/lujun9972 +[1]: https://images.idgesg.net/images/article/2019/10/field-note_play-book_playbook_map_navigation_journey_by-hello-i-m-nik-via-unsplash-100813507-large.jpg +[2]: https://creativecommons.org/publicdomain/zero/1.0/ +[3]: https://www.networkworld.com/slideshow/153439/linux-best-desktop-distros-for-newbies.html#tk.nww-infsb +[4]: https://www.networkworld.com/article/3440100/take-the-intelligent-route-with-consumption-based-storage.html?utm_source=IDG&utm_medium=promotions&utm_campaign=HPE21620&utm_content=sidebar ( Take the Intelligent Route with Consumption-Based Storage) +[5]: https://www.facebook.com/NetworkWorld/ +[6]: https://www.linkedin.com/company/network-world diff --git a/published/202004/20200213 Manage complex Git workspaces with Great Teeming Workspaces.md b/published/202004/20200213 Manage complex Git workspaces with Great Teeming Workspaces.md new file mode 100644 index 0000000000..9ae4ee5618 --- /dev/null +++ b/published/202004/20200213 Manage complex Git workspaces with Great Teeming Workspaces.md @@ -0,0 +1,173 @@ +[#]: collector: (lujun9972) +[#]: translator: (lxbwolf) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12156-1.html) +[#]: subject: (Manage complex Git workspaces with Great Teeming Workspaces) +[#]: via: (https://opensource.com/article/20/2/git-great-teeming-workspaces) +[#]: author: (Daniel Gryniewicz https://opensource.com/users/dang) + +使用 GTWS 管理复杂的 Git 工作空间 +====== + +> GTWS 是一系列脚本,它使我们在开发环境中管理不同的项目和项目的各个版本变得很容易。 + +![](https://img.linux.net.cn/data/attachment/album/202004/27/182149xh9s7kb5bkf5875b.jpg) + +[Great Teeming Workspaces][2](GTWS)是一个 Git 的复杂工作空间管理工具包,它使我们在开发环境中管理不同的项目和项目的各个版本变得很容易。 + +有点像 Python 的 [venv][3],但不是为 Python 语言准备的。GTWS 用来管理多个项目的多个版本的工作空间。你可以很容易地创建、更新、进入和离开工作空间,每个项目或版本的组合(最多)有一个本地的 origin,用来与 upstream 同步 — 其余的所有工作空间都从本地的 origin 更新。 + +### 部署 + +``` +${GTWS_ORIGIN}//[/] +${GTWS_BASE_SRCDIR}////{[,...]} +``` + +源代码目录的每一级(包括全局的家目录)可以包含一个 `.gtwsrc` 文件,这个文件中维护与当前级相关的设置和 bash 代码。每一级的配置会覆盖上一级。 + +### 安装 + +用下面的命令检出 GTWS: + +``` +git clone https://github.com/dang/gtws.git +``` + +配置你的 `${HOME}/.gtwsrc`。它应该包含 `GTWS_ORIGIN`,也可以再包含 `GTWS_SETPROMPT`。 + +把仓库目录加到环境变量中: + +``` +export PATH="${PATH}:/path/to/gtws +``` + +### 配置 + +通过级联 `.gtwsrc` 文件来进行配置。它从根目录向下遍历,会执行在每级目录中找到的 `.gtwsrc` 文件。下级目录的文件会覆盖上一级。 + +在你最上层的文件 `~/.gtws/.gtwsrc` 中进行如下设置: + + * `GTWS_BASE_SRCDIR`:所有项目源文件目录树的基目录。默认为 `$HOME/src`。 + * `GTWS_ORIGIN`: 指定 origin git 目录树的路径。默认为 `$HOME/origin`。 + * `GTWS_SETPROMPT`: 可选配置。如果配置了这个参数,shell 提示符会有工作空间的名字。 + * `GTWS_DEFAULT_PROJECT`: 不指定项目或项目未知时默认的项目名。如果不指定,使用命令行时必须指明项目。 + * `GTWS_DEFAULT_PROJECT_VERSION`: 检出的默认版本。默认为 `master`。 + +在每个项目的根目录进行以下设置: + + * `GTWS_PROJECT`: 项目的名字(和基目录)。 + * `gtws_project_clone`: 这个函数用于克隆一个项目的指定版本。如果未定义,它会假定项目的 origin 对每一个版本都有一个单独的目录,这样会导致克隆一堆 Git 仓库。 + * `gtws_project_setup`: 在克隆完所有的仓库后,可以选择是否调用这个函数,调用后可以对项目进行必要的配置,如在 IDE 中配置工作空间。 + +在项目版本级进行以下设置: + + * `GTWS_PROJECT_VERSION:` 项目的版本。用于正确地从 origin 拉取代码。类似 Git 中的分支名字。 + +下面这些参数可以在目录树的任意地方进行配置,如果能生效,它们可以被重写多次: + + * `GTWS_PATH_EXTRA`: 这些是工作空间中加到路径后的额外的路径元素。 + * `GTWS_FILES_EXTRA`: 这些是不在版本控制内,但应该在工作空间中被检出的额外的文件。这些文件包括 `.git/info/exclude`,每个文件都与仓库的基目录相关联。 + +### origin 目录 + +`GTWS_ORIGIN` (大部分脚本中)指向拉取和推送的原始 Git 检出目录。 + +`${GTWS_ORIGIN}` 部署: + + * `/` + * 这是一个项目的仓库的基目录。 + * 如果指定了 `gtws_project_clone`,你可以配置任意的部署路径。 + * 如果没有指定 `gtws_project_clone`,这个路径下必须有个名为 `git` 的子目录,且 `git` 目录下有一系列用来克隆的裸 Git 仓库。 + +### 工作流示例 + +假设你有一个项目名为 `Foo`,它的 upstream 为 `github.com/foo/foo.git`。这个仓库有个名为 `bar` 的子模块,它的 upstream 是 `github.com/bar/bar.git`。Foo 项目在 master 分支开发,使用稳定版本的分支。 + +为了能在 Foo 中使用 GTWS,你首先要配置目录结构。本例中假设你使用默认的目录结构。 + + * 配置你最上层的 `.gtwsrc`: + * `cp ${GTWS_LOC}/examples/gtwsrc.top ~/.gtwsrc` + * 根据需要修改 `~/.gtwsrc`。 + * 创建顶级目录: + * `mkdir -p ~/origin ~/src` + * 创建并配置项目目录: + * `mkdir -p ~/src/foo` + + `cp ${GTWS_LOC}/examples/gtwsrc.project ~/src/foo/.gtwsrc` + * 根据需要修改 `~/src/foo/.gtwsrc`。 + * 创建并配置 master 版本目录: + * `mkdir -p ~/src/foo/master` + + `cp ${GTWS_LOC}/examples/gtwsrc.version ~/src/foo/master/.gtwsrc` + * 根据需要修改 `~/src/foo/master/.gtwsrc`。 + * 进入版本目录并创建一个临时工作空间来配置镜像: + * `mkdir -p ~/src/foo/master/tmp` + + `cd ~/src/foo/master/tmp` + + `git clone --recurse-submodules git://github.com/foo/foo.git` + + `cd foo` + + `gtws-mirror -o ~/origin -p foo`(译注:这个地方原文有误,不加 `-s` 参数会报错) + * 上面命令会创建 `~/origin/foo/git/foo.git` 和 `~/origin/foo/submodule/bar.git`。 + * 以后的克隆操作会从这些 origin 而不是 upstream 克隆。 + * 现在可以删除工作空间了。 + +到现在为止,Foo 的 master 分支的工作可以结束了。假设你现在想修复一个 bug,名为 `bug1234`。你可以脱离你当前的工作空间为修复这个 bug 单独创建一个工作空间,之后在新创建的工作空间中开发。 + + * 进入版本目录,创建一个新的工作空间: + * `cd ~/src/foo/master` + + `mkws bug1234` + * 上面的命令创建了 `bug1234/`,在这个目录下检出了 Foo(和它的子模块 `bar`),并创建了 `build/foo` 来构建它。 + * 有两种方式进入工作空间: + * `cd ~/src/foo/master/bug1234` + + `startws` + + 或者 + + `cd ~/src/foo/master/` + + `startws bug1234` + * 上面的命令在 `bug1234` 工作空间中开启了一个子 shell。这个 shell 有 GTWS 的环境和你在各级 `.gtwsrc` 文件中设置的环境。它也把你工作空间的基目录加入到了 CD,因此你可以从 base 路径 `cd` 到相关的目录中。 + * 现在你可以修复 `bug1234` 了,构建、测试、提交你的修改。当你可以把代码推送到 upstream 时,执行下面的命令: + + `cd foo` + + `wspush`  + * `wspush` 会把代码推送到与你工作空间相关的分支 — 先推送到本地的 origin,再推送到 upstream。 + * 当 upstream 有修改时,你可以用下面的命令同步到本地: + + `git sync` + * 上面的命令调用了 GTWS 的 `git-sync` 脚本,会从本地 origin 更新代码。使用下面的命令来更新本地的 origin: + + `git sync -o`  + * 上面的命令会更新你本地的 origin 和子模块的镜像,然后用那些命令来更新你的检出仓库的代码。`git-sync` 也有一些其他的很好的工鞥。 + * 当要结束工作空间中的工作时,直接退出 shell: + + `exit` + * 你可以在任何时间重复进入工作空间,也可以在同一时间在相同的工作空间中开多个 shell。 + * 当你不需要某个工作空间时,你可以使用 `rmws` 来删除它,或者直接删除它的目录树。 + * 还有一个脚本 `tmws` 使用 tmux 进入工作空间,能创建一系列的窗口/窗格,这完美契合我的工作流。你可以根据你自己的需求来修改它。 + + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/2/git-great-teeming-workspaces + +作者:[Daniel Gryniewicz][a] +选题:[lujun9972][b] +译者:[lxbwolf](https://github.com/lxbwolf) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/dang +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/code_computer_laptop_hack_work.png?itok=aSpcWkcl (Coding on a computer) +[2]: https://github.com/dang/gtws +[3]: https://docs.python.org/3/library/venv.html diff --git a/published/202004/20200228 Getting started with Linux firewalls.md b/published/202004/20200228 Getting started with Linux firewalls.md new file mode 100644 index 0000000000..a8a9749395 --- /dev/null +++ b/published/202004/20200228 Getting started with Linux firewalls.md @@ -0,0 +1,117 @@ +[#]: collector: (lujun9972) +[#]: translator: (lxbwolf) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12130-1.html) +[#]: subject: (Getting started with Linux firewalls) +[#]: via: (https://opensource.com/article/20/2/firewall-cheat-sheet) +[#]: author: (Seth Kenlon https://opensource.com/users/seth) + +Linux 防火墙入门教程 +====== + +> 防火墙是你的计算机防止网络入侵的第一道屏障。为确保你的安全,请下载我们的备忘单。 + +![](https://img.linux.net.cn/data/attachment/album/202004/20/104205paugcytauqctqw6c.jpg) + +合理的防火墙是你的计算机防止网络入侵的第一道屏障。你在家里上网,通常互联网服务提供会在路由中搭建一层防火墙。当你离开家时,那么你计算机上的那层防火墙就是仅有的一层,所以配置和控制好你 Linux 电脑上的防火墙很重要。如果你维护一台 Linux 服务器,那么知道怎么去管理你的防火墙同样重要,只要掌握了这些知识你才能保护你的服务器免于本地或远程非法流量的入侵。 + +### 安装防火墙 + +很多 Linux 发行版本已经自带了防火墙,通常是 `iptables`。它很强大并可以自定义,但配置起来有点复杂。幸运的是,有开发者写出了一些前端程序来帮助用户控制防火墙,而不需要写冗长的 iptables 规则。 + +在 Fedora、CentOS、Red Hat 和一些类似的发行版本上,默认安装的防火墙软件是 `firewalld`,通过 `firewall-cmd` 命令来配置和控制。在 Debian 和大部分其他发行版上,可以从你的软件仓库安装 firewalld。Ubuntu 自带的是简单防火墙Uncomplicated Firewall(ufw),所以要使用 firewalld,你必须启用 `universe` 软件仓库: + +``` +$ sudo add-apt-repository universe +$ sudo apt install firewalld +``` + +你还需要停用 ufw: + +``` +$ sudo systemctl disable ufw +``` + +没有理由*不用* ufw。它是一个强大的防火墙前端。然而,本文重点讲 firewalld,因为大部分发行版都支持它而且它集成到了 systemd,systemd 是几乎所有发行版都自带的。 + +不管你的发行版是哪个,都要先激活防火墙才能让它生效,而且需要在启动时加载: + +``` +$ sudo systemctl enable --now firewalld +``` + +### 理解防火墙的域 + +Firewalld 旨在让防火墙的配置工作尽可能简单。它通过建立zone来实现这个目标。一个域是一组的合理、通用的规则,这些规则适配大部分用户的日常需求。默认情况下有九个域。 + + * `trusted`:接受所有的连接。这是最不偏执的防火墙设置,只能用在一个完全信任的环境中,如测试实验室或网络中相互都认识的家庭网络中。 + * `home`、`work`、`internal`:在这三个域中,接受大部分进来的连接。它们各自排除了预期不活跃的端口进来的流量。这三个都适合用于家庭环境中,因为在家庭环境中不会出现端口不确定的网络流量,在家庭网络中你一般可以信任其他的用户。 + * `public`:用于公共区域内。这是个偏执的设置,当你不信任网络中的其他计算机时使用。只能接收选定的常见和最安全的进入连接。 + * `dmz`:DMZ 表示隔离区。这个域多用于可公开访问的、位于机构的外部网络、对内网访问受限的计算机。对于个人计算机,它没什么用,但是对某类服务器来说它是个很重要的选项。 + * `external`:用于外部网络,会开启伪装(你的私有网络的地址被映射到一个外网 IP 地址,并隐藏起来)。跟 DMZ 类似,仅接受经过选择的传入连接,包括 SSH。 + * `block`:仅接收在本系统中初始化的网络连接。接收到的任何网络连接都会被 `icmp-host-prohibited` 信息拒绝。这个一个极度偏执的设置,对于某类服务器或处于不信任或不安全的环境中的个人计算机来说很重要。 + * `drop`:接收的所有网络包都被丢弃,没有任何回复。仅能有发送出去的网络连接。比这个设置更极端的办法,唯有关闭 WiFi 和拔掉网线。 + +你可以查看你发行版本的所有域,或通过配置文件 `/usr/lib/firewalld/zones` 来查看管理员设置。举个例子:下面是 Fefora 31 自带的 `FedoraWorkstation` 域: + +``` +$ cat /usr/lib/firewalld/zones/FedoraWorkstation.xml + + + Fedora Workstation + Unsolicited incoming network packets are rejected from port 1 to 1024, except for select network services. Incoming packets that are related to outgoing network connections are accepted. Outgoing network connections are allowed. + + + + + + +``` + +### 获取当前的域 + +任何时候你都可以通过 `--get-active-zones` 选项来查看你处于哪个域: + +``` +$ sudo firewall-cmd --get-active-zones +``` + +输出结果中,会有当前活跃的域的名字和分配给它的网络接口。笔记本电脑上,在默认域中通常意味着你有个 WiFi 卡: + +``` +FedoraWorkstation +  interfaces: wlp61s0 +``` + +### 修改你当前的域 + +要更改你的域,请将网络接口重新分配到不同的域。例如,把例子中的 `wlp61s0` 卡修改为 public 域: + +``` +$ sudo firewall-cmd --change-interface=wlp61s0 --zone=public +``` + +你可以在任何时候、任何理由改变一个接口的活动域 —— 无论你是要去咖啡馆,觉得需要增加笔记本的安全策略,还是要去上班,需要打开一些端口进入内网,或者其他原因。在你凭记忆学会 `firewall-cmd` 命令之前,你只要记住了关键词 `change` 和 `zone`,就可以慢慢掌握,因为按下 `Tab` 时,它的选项会自动补全。 + +### 更多信息 + +你可以用你的防火墙干更多的事,比如自定义已存在的域,设置默认域,等等。你对防火墙越了解,你在网上的活动就越安全,所以我们创建了一个[备忘单][2]便于速查和参考。 + +- 下载你的 [防火墙备忘单][2]。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/2/firewall-cheat-sheet + +作者:[Seth Kenlon][a] +选题:[lujun9972][b] +译者:[lxbwolf](https://github.com/lxbwolf) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/seth +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/coverimage_cheat_sheet.png?itok=lYkNKieP (Cheat Sheet cover image) +[2]: https://opensource.com/downloads/firewall-cmd-cheat-sheet diff --git a/published/202004/20200309 Fish - A Friendly Interactive Shell.md b/published/202004/20200309 Fish - A Friendly Interactive Shell.md new file mode 100644 index 0000000000..cb7b6cb62d --- /dev/null +++ b/published/202004/20200309 Fish - A Friendly Interactive Shell.md @@ -0,0 +1,183 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12069-1.html) +[#]: subject: (Fish – A Friendly Interactive Shell) +[#]: via: (https://fedoramagazine.org/fish-a-friendly-interactive-shell/) +[#]: author: (Michal Konečný https://fedoramagazine.org/author/zlopez/) + +Fish:一个友好的交互式 Shell +====== + +![Fish — A Friendly Interactive Shell][1] + +你是否正在寻找 bash 的替代品?你是否在寻找更人性化的东西?不用再看了,因为你刚发现了 fish! + +Fish(友好的交互式 shell)是一个智能且用户友好的命令行 shell,可在 Linux、MacOS 和其他操作系统上运行。可以将其用于终端的日常工作和脚本编写。用 fish 编写的脚本比相同的 bash 版本具有更少的神秘性。 + +### Fish 的用户友好功能 + +* **建议**:Fish 会提示你之前写过的命令。当经常输入相同命令时,这样可以提高生产率。 +* **健全的脚本能力**:Fish 避免使用那些隐秘字符。这提供了更清晰和更友好的语法。 +* **基于手册页的补全**:Fish 会根据命令的手册页自动补全参数。 +* **语法高亮**:Fish 会高亮显示命令语法以使其在视觉上友好。 + +### 安装 + +#### Fedora 工作站 + +使用 `dnf` 命令安装 fish: + +``` +$ sudo dnf install fish +``` + +安装 `util-linux-user` 包,然后使用适当的参数运行 `chsh`(更改 shell 程序)命令,将 fish 设置为默认 shell 程序: + +``` +$ sudo dnf install util-linux-user +$ chsh -s /usr/bin/fish +``` + +你需要注销然后重新登录,更改才能生效。 + +#### Fedora Silverblue + +由于它不是 GUI 应用,因此你需要使用 `rpm-ostree` 将其加到层内。使用以下命令在 Fedora Silverblue 上安装 fish: + +``` +$ rpm-ostree install fish +``` + +在 Fedora Silverblue 上,你需要重启 PC 才能切换到新的 ostree 镜像。 + +如果你想在 Fedora Silverblue 用 fish 作为主要 shell,最简单的方法是更新 `/etc/passwd` 文件。找到你的用户,并将 `/bin/bash` 更改为 `/usr/bin/fish`。 + +你需要 [root 权限][2]来编辑 `/etc/passwd` 文件。另外,你需要注销并重新登录才能使更改生效。 + +### 配置 + +fish 的用户配置文件在 `~/.config/fish/config.fish`。要更改所有用户的配置,请编辑 `/etc/fish/config.fish`。 + +用户配置文件必须手动创建。安装脚本不会创建 `~/.config/fish/config.fish`。 + +以下是两个个配置示例以及它们的 bash 等效项,以帮助你入门: + +#### 创建别名 + +* `~/.bashrc`:`alias ll='ls -lh'` +* `~/.config/fish/config.fish`: `alias ll='ls -lh'` + +#### 设置环境变量 + + * `~/.bashrc`:`export PATH=$PATH:~/bin` + * `~/.config/fish/config.fish`:`set -gx PATH $PATH ~/bin` + +### 使用 fish 工作 + +将 fish 配置为默认 shell 程序后,命令提示符将类似于下图所示。如果尚未将 fish 配置为默认 shell,只需运行 `fish` 命令以在当前终端会话中启动。 + +![][3] + +在你开始输入命令时,你会注意到语法高亮显示: + +![][4] + +很酷,不是吗?🙂 + +你还将在输入时看到建议的命令。例如,再次开始输入上一个命令: + +![][5] + +注意输入时出现的灰色文本。灰色文本显示建议之前编写的命令。要自动补全,只需按 `CTRL+F`。 + +通过输入连接号(`–`)然后使用 `TAB` 键,它会根据前面命令的手册页获取参数建议: + +![][6] + +如果你按一次 `TAB`,它将显示前几个建议(或所有建议,如果只有少量参数可用)。如果再次按 `TAB`,它将显示所有建议。如果连续三次按 `TAB`,它将切换到交互模式,你可以使用箭头键选择一个参数。 + +除此之外,fish 的工作与大多数其他 shell 相似。其他差异已经写在文档中。因此,找到你可能感兴趣的其他功能应该不难。 + +### 让 fish 变得更强大 + +使用 [powerline][7] 使 fish 变得更强大。Powerline 可以为 fish 的界面添加命令执行时间、彩色化 git 状态、当前 git 分支等。 + +在安装 powerline 之前,你必须先安装 [Oh My Fish][8]。Oh My Fish 扩展了 fish 的核心基础架构,以支持安装其他插件。安装 Oh My Fish 的最简单方法是使用 `curl` 命令: + +``` +> curl -L https://get.oh-my.fish | fish +``` + +如果你不想直接将安装命令管道传给 `fish`,请参见 Oh My Fish 的 [README][9] 的安装部分,以了解其他安装方法。 + +Fish 的 powerline 插件是 [bobthefish][7]。Bobthefish 需要 `powerline-fonts` 包。 + +在 Fedora 工作站上: + +``` +> sudo dnf install powerline-fonts +``` + +在 Fedora Silverblue 上: + +``` +> rpm-ostree install powerline-fonts +``` + +在 Fedora Silverblue 上,你必须重启以完成字体的安装。 + +安装 `powerline-fonts` 之后,安装 `bobthefish`: + +``` +> omf install bobthefish +``` + +现在你可以通过 powerline 体验 fish 的全部奇妙之处: + +![][10] + +### 更多资源 + +查看这些网页,了解更多 fish 内容: + + * [官网][11] + * [文档][12] + * [教程][13] + * [常见问题][14] + * [在线体验][15] + * [邮件列表][16] + * [GitHub][17] + + +-------------------------------------------------------------------------------- + +via: https://fedoramagazine.org/fish-a-friendly-interactive-shell/ + +作者:[Michal Konečný][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://fedoramagazine.org/author/zlopez/ +[b]: https://github.com/lujun9972 +[1]: https://fedoramagazine.org/wp-content/uploads/2020/03/fish-816x345.jpg +[2]: https://fedoramagazine.org/howto-use-sudo/ +[3]: https://fedoramagazine.org/wp-content/uploads/2020/03/Screenshot-from-2020-03-03-14-00-35.png +[4]: https://fedoramagazine.org/wp-content/uploads/2020/03/Screenshot-from-2020-03-03-14-19-24.png +[5]: https://fedoramagazine.org/wp-content/uploads/2020/03/Screenshot-from-2020-03-03-14-25-31.png +[6]: https://fedoramagazine.org/wp-content/uploads/2020/03/Screenshot-from-2020-03-03-14-58-07.png +[7]: https://github.com/oh-my-fish/theme-bobthefish +[8]: https://github.com/oh-my-fish/oh-my-fish +[9]: https://github.com/oh-my-fish/oh-my-fish/blob/master/README.md#installation +[10]: https://fedoramagazine.org/wp-content/uploads/2020/03/Screenshot-from-2020-03-03-15-38-07.png +[11]: https://fishshell.com/ +[12]: https://fishshell.com/docs/current/index.html +[13]: https://fishshell.com/docs/current/tutorial.html +[14]: https://fishshell.com/docs/current/faq.html +[15]: https://rootnroll.com/d/fish-shell/ +[16]: https://sourceforge.net/projects/fish/lists/fish-users +[17]: https://github.com/fish-shell/fish-shell/ diff --git a/published/202004/20200311 Directing Kubernetes traffic with Traefik.md b/published/202004/20200311 Directing Kubernetes traffic with Traefik.md new file mode 100644 index 0000000000..c9cc3c3f8e --- /dev/null +++ b/published/202004/20200311 Directing Kubernetes traffic with Traefik.md @@ -0,0 +1,381 @@ +[#]: collector: (lujun9972) +[#]: translator: (wxy) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12049-1.html) +[#]: subject: (Directing Kubernetes traffic with Traefik) +[#]: via: (https://opensource.com/article/20/3/kubernetes-traefik) +[#]: author: (Lee Carpenter https://opensource.com/users/carpie) + +使用 Traefik 引导 Kubernetes 流量 +====== + +> 将流量引入 Kubernetes 树莓派集群的分步指南。 + +![Digital creative of a browser on the internet][1] + +在本文中,我们将部署几个简单的网站,并学习如何使用 Traefik 将来自外部世界的流量引入到我们的集群中。之后,我们还将学习如何删除 Kubernetes 资源。让我们开始吧! + +- [video](https://img.linux.net.cn/static/video/Ingressing%20with%20k3s-QcC-5fRhsM8.mp4) + +### 准备 + +要继续阅读本文,你只需要我们在上一篇文章中构建的 [k3s 树莓派集群][2]。由于你的集群将从网络上拉取镜像,因此该集群需要能够访问互联网。 + +出于解释目的,本文将显示一些配置文件和示例 HTML 文件。所有示例文件都可以在[此处][3]下载。 + +### 部署一个简单的网站 + +之前,我们使用 `kubectl` 进行了直接部署。但是,这不是典型的部署方法。一般情况都会使用 YAML 配置文件,这也是我们要在本文中使用的配置文件。我们将从顶部开始,并以自顶向下的方式创建该配置文件。 + +### 部署配置 + +首先是部署配置。配置如下所示,并在下面进行说明。我通常以 [Kubernetes 文档][4]中的示例为起点,然后根据需要对其进行修改。例如,下面的配置是复制了[部署文档][5]中的示例后修改的。 + +创建一个文件 `mysite.yaml`,其内容如下: + +``` +apiVersion: apps/v1 +kind: Deployment +metadata: + name: mysite-nginx + labels: + app: mysite-nginx +spec: + replicas: 1 + selector: + matchLabels: + app: mysite-nginx + template: + metadata: + labels: + app: mysite-nginx + spec: + containers: + - name: nginx + image: nginx + ports: + - containerPort: 80 +``` + +其中大部分是样板。重要的部分,我们会将该部署命名为 `mysite-nginx`,并为其加上同名的 `app` 标签。我们指定了一个副本replica,这意味着将只创建一个 Pod。我们还指定了一个容器,我们将其命名为 `nginx`。我们将镜像image指定为 `nginx`。这意味着在部署时,k3s 将从 DockerHub 下载 `nginx` 镜像并从中创建一个 Pod。最后,我们指定了容器端口containerPort为 `80`,这只意味着在容器内部 Pod 会监听 `80` 端口。 + +我在上面强调了“在容器内部”,因为这是一个重要的区别。由于我们是按容器配置的,因此只能在容器内部访问它,并且进一步将其限制为内部网络。这对于允许多个容器在同一容器端口上监听所是必要的。换句话说,通过这种配置,其他一些 Pod 也可以在其容器端口 80 上侦听,并且不会与此容器冲突。为了提供对该 Pod 的正式访问权限,我们需要一个服务service配置。 + +### 服务配置 + +在 Kubernetes 中,服务service是一种抽象。它提供了一种访问 Pod 或 Pod 集合的方法。当连接到服务时,服务会路由到单个 Pod,或者如果定义了多个 Pod 副本,会通过负载均衡路由到多个 Pod。 + +可以在同一配置文件中指定该服务,这就是我们将在此处要做的。用 `---` 分隔配置区域,将以下内容添加到 `mysite.yaml` 中: + +``` +--- +apiVersion: v1 +kind: Service +metadata: + name: mysite-nginx-service +spec: + selector: + app: mysite-nginx + ports: + - protocol: TCP + port: 80 +``` + +在此配置中,我们将服务命名为 `mysite-nginx-service`。我们提供了一个选择器selector:`app: mysite-nginx`。这是服务选择其路由到的应用程序容器的方式。请记住,我们为容器提供了 `app` 标签:`mysite-nginx` 。这就是服务用来查找我们的容器的方式。最后,我们指定服务协议为 `TCP`,在端口 `80` 上监听。 + +### 入口配置 + +入口Ingress配置指定了如何将流量从集群外部传递到集群内部的服务。请记住,k3s 预先配置了 Traefik 作为入口控制器。因此,我们将编写特定于 Traefik 的入口配置。将以下内容添加到 `mysite.yaml` 中(不要忘了用 `---` 分隔): + +``` +--- +apiVersion: networking.k8s.io/v1beta1 +kind: Ingress +metadata: + name: mysite-nginx-ingress + annotations: + kubernetes.io/ingress.class: "traefik" +spec: + rules: + - http: + paths: + - path: / + backend: + serviceName: mysite-nginx-service + servicePort: 80 +``` + +在此配置中,我们将入口记录命名为 `mysite-nginx-ingress`。我们告诉 Kubernetes,我们希望 `traefik` 成为我们的入口控制器,再加上 `kubernetes.io/ingress.class` 的注解。 + +在规则rules部分中,我们基本上是说,当 `http` 流量进入时,并且 `path` 匹配 `/`(或其下的任何内容),将其路由到由 `serviceName mysite-nginx-service` 指定的后端backend服务中,并将其路由到 `servicePort 80`。这会将传入的 HTTP 流量连接到我们之前定义的服务。 + +### 需要部署的东西 + +就配置而言,就是这样了。如果我们现在部署,我们将获得默认的 nginx 页面,但这不是我们想要的。让我们创建一些简单但可自定义的部署方式。创建具有以下内容的文件 `index.html`: + +``` + +K3S! + + + +
Hello from K3S!
+ + +``` + +我们尚未介绍 Kubernetes 中的存储机制,因此在这里我们偷懒一下,仅将该文件存储在 Kubernetes 配置映射中。这不是我们推荐的部署网站的方式,但对于我们的目的来说是可行的。运行以下命令: + +``` +kubectl create configmap mysite-html --from-file index.html +``` + +该命令从本地文件 `index.html` 创建名为 `mysite-html` 的配置映射configmap资源。这实际上是在 Kubernetes 资源中存储一个文件(或一组文件),我们可以在配置中调出该文件。它通常用于存储配置文件(因此而得名),我们在这里稍加滥用。在以后的文章中,我们将讨论 Kubernetes 中适当的存储解决方案。 + +创建配置映射后,让我们将其挂载在我们的 `nginx` 容器中。我们分两个步骤进行。首先,我们需要指定一个volume来调出配置映射。然后我们需要将该卷挂载到 `nginx` 容器中。通过在 `mysite.yaml` 中的 `container` 后面的 `spec` 标签下添加以下内容来完成第一步: + +``` +      volumes: +      - name: html-volume +        configMap: +          name: mysite-html +``` + +这告诉 Kubernetes 我们要定义一个名为 `html-volume` 的卷,并且该卷应包含名为 `html-volume`(我们在上一步中创建的)的配置映射的内容。 + +接下来,在 `nginx` 容器规范中的端口ports下方,添加以下内容: + +``` +        volumeMounts: +        - name: html-volume +          mountPath: /usr/share/nginx/html +``` + +这告诉 Kubernetes,对于 `nginx` 容器,我们想在容器中的 `/usr/share/nginx/html` 路径上挂载名为 `html-volume` 的卷。 为什么要使用 `/usr/share/nginx/html`?那个位置就是 `nginx` 镜像提供 HTML 服务的地方。通过在该路径上挂载卷,我们用该卷内容替换了默认内容。 + +作为参考,配置文件的 `deployment` 部分现在应如下所示: + +``` +apiVersion: apps/v1 +kind: Deployment +metadata: +  name: mysite-nginx +  labels: +    app: mysite-nginx +spec: +  replicas: 1 +  selector: +    matchLabels: +      app: mysite-nginx +  template: +    metadata: +      labels: +        app: mysite-nginx +    spec: +      containers: +      - name: nginx +        image: nginx +        ports: +        - containerPort: 80 +        volumeMounts: +        - name: html-volume +          mountPath: /usr/share/nginx/html +      volumes: +      - name: html-volume +        configMap: +          name: mysite-html +``` + +### 部署它! + +现在我们准备部署! 我们可以这样做: + +``` +kubectl apply -f mysite.yaml +``` + +你应该看到类似于以下内容: + +``` +deployment.apps/mysite-nginx created +service/mysite-nginx-service created +ingress.networking.k8s.io/mysite-nginx-ingress created +``` + +这意味着 Kubernetes 为我们指定的三个配置分别创建了资源。使用以下方法检查 Pod 的状态: + +``` +kubectl get pods +``` + +如果看到状态为 `ContainerCreating`,请给它一些时间并再次运行 `kubectl get pods`。通常,第一次会花一些时间,因为 k3s 必须下载 `nginx` 镜像来创建 Pod。一段时间后,你应该看到 `Running` 的状态。 + +### 尝试一下! + +Pod 运行之后,就该尝试了。打开浏览器,然后在地址栏中输入 `kmaster`。 + +![][6] + +恭喜你!你已经在 k3s 集群上部署了一个网站! + +### 另一个 + +因此,现在我们有了一个运行单个网站的整个 k3s 集群。但是我们可以有更多的网站!如果我们要在同一集群中提供另一个网站怎么办?让我们看看如何做到这一点。 + +同样,我们需要部署一些东西。碰巧我的狗有一条她想让全世界都知道的信息,她想了好久了。因此,我专门为她制作了一些 HTML(可从示例 zip 文件中获得)。同样,我们将使用配置映射的技巧来托管这些 HTML。这次我们将把整个目录(`html` 目录)放到配置映射中,但是调用是相同的。 + +``` +kubectl create configmap mydog-html --from-file html +``` + +现在,我们需要为此站点创建一个配置文件。它几乎与用于 `mysite.yaml` 的完全相同,因此首先将 `mysite.yaml` 复制为 `mydog.yaml`。现在将 `mydog.yaml` 修改为: + +``` +apiVersion: apps/v1 +kind: Deployment +metadata: + name: mydog-nginx + labels: + app: mydog-nginx +spec: + replicas: 1 + selector: + matchLabels: + app: mydog-nginx + template: + metadata: + labels: + app: mydog-nginx + spec: + containers: + - name: nginx + image: nginx + ports: + - containerPort: 80 + volumeMounts: + - name: html-volume + mountPath: /usr/share/nginx/html + volumes: + - name: html-volume + configMap: + name: mydog-html +--- +apiVersion: v1 +kind: Service +metadata: + name: mydog-nginx-service +spec: + selector: + app: mydog-nginx + ports: + - protocol: TCP + port: 80 +--- +apiVersion: networking.k8s.io/v1beta1 +kind: Ingress +metadata: + name: mydog-nginx-ingress + annotations: + kubernetes.io/ingress.class: "traefik" + traefik.frontend.rule.type: PathPrefixStrip +spec: + rules: + - http: + paths: + - path: /mydog + backend: + serviceName: mydog-nginx-service + servicePort: 80 +``` + +我们只需进行搜索并将 `mysite` 替换为 `mydog`即可完成大多数修改。其他两个修改在入口部分中。我们将 `path` 更改为 `/mydog`,并添加了一个注解 `traefik.frontend.rule.type: PathPrefixStrip`。 + +`/mydog` 路径的规范指示 Traefik 将以 `/mydog` 路径开头的所有传入请求路由到 `mydog-nginx-service`。任何其他路径将继续路由到 `mysite-nginx-service`。 + +新的注解 `PathPrefixStrip` 告诉 Traefik 在将请求发送到 `mydog-nginx-service` 之前先去除前缀 `/mydog`。我们这样做是因为 `mydog-nginx` 应用程序不需要前缀。这意味着我们可以简单地通过更改入口记录中的前缀来更改挂载的服务的位置。 + +现在我们可以像以前一样进行部署: + +``` +kubectl apply -f mydog.yaml +``` + +现在,我的狗的消息应该可以在 上找到。 + +![][7] + + +呼!消息发出去了!也许今晚我们都可以睡一觉。 + +因此,现在,我们有了一个 k3s 集群,该集群托管了两个网站,Traefik 根据路径名决定将请求传递给哪个服务!但是,不仅限于基于路径的路由,我们也可以使用基于主机名的路由,我们将在以后的文章中进行探讨。 + +另外,我们刚刚托管的网站是标准的未加密 HTML 网站,而如今的所有内容都使用 SSL/TLS 加密。在我们的下一篇文章中,我们将为 k3s 集群添加支持以托管 SSL/TLS HTTPS 站点! + +### 清理 + +在开始之前,由于本文主要涉及的是示例站点,因此我想向你展示如何删除内容,以防万一你不希望将这些示例丢在集群中。 + +对于大多数配置,只需使用与部署时使用的相同配置文件运行 `delete` 命令即可撤消配置。因此,让我们同时清理 `mysite` 和 `mydog`。 + +``` +kubectl delete -f mysite.yaml +kubectl delete -f mydog.yaml +``` + +由于我们是手动创建配置映射的,因此我们也需要手动删除它们。 + +``` +kubectl delete configmap mysite-html +kubectl delete configmap mydog-html +``` + +现在,如果我们执行 `kubectl get pods`,我们应该看到我们的 nginx Pod 不存在了。 + +``` +$ kubectl get pods +No resources found in default namespace. +``` + +一切都清理了。 + +请在下面的评论中告诉我你对这个项目有什么想法。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/3/kubernetes-traefik + +作者:[Lee Carpenter][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/carpie +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/browser_web_internet_website.png?itok=g5B_Bw62 (Digital creative of a browser on the internet) +[2]: https://linux.cn/article-12049-1.html +[3]: https://gitlab.com/carpie/ingressing_with_k3s/-/archive/master/ingressing_with_k3s-master.zip +[4]: https://kubernetes.io/docs/ +[5]: https://kubernetes.io/docs/concepts/workloads/controllers/deployment/#creating-a-deployment +[6]: https://opensource.com/sites/default/files/uploads/mysite.jpg +[7]: https://opensource.com/sites/default/files/uploads/mydog.jpg diff --git a/published/202004/20200311 What you need to know about variables in Emacs.md b/published/202004/20200311 What you need to know about variables in Emacs.md new file mode 100644 index 0000000000..a53c1200ed --- /dev/null +++ b/published/202004/20200311 What you need to know about variables in Emacs.md @@ -0,0 +1,227 @@ +[#]: collector: (lujun9972) +[#]: translator: (cycoe) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12150-1.html) +[#]: subject: (What you need to know about variables in Emacs) +[#]: via: (https://opensource.com/article/20/3/variables-emacs) +[#]: author: (Clemens Radermacher https://opensource.com/users/clemera) + +关于 Emacs 中的变量你需要知道的事情 +====== + +> 学习 Elisp 是如何处理变量的,以及如何在你的脚本与配置中使用它们。 + +![](https://img.linux.net.cn/data/attachment/album/202004/25/190905pq1qfk1f8f9qs9v8.jpg) + +GNU Emacs 是由 C 和 Emacs Lisp(Elisp,Lisp 编程语言的一种方言)写成,它是一个编辑器的同时,又碰巧是 Elisp 的沙盒。因此,理解 Elisp 中的一些基本编程概念会对你有一些帮助。 + +如果你是 [Emacs][2] 新手,请先阅读 Sacha Chua 的《[给 Emacs 新手的资源][3]》精品帖。本篇文章假定你熟悉常见的 Emacs 术语,并且能够阅读并求值 Elisp 代码的简单片段。最好你也听说过变量作用域的概念,知道它在其它编程语言中的作用。本篇文章中的示例假定你使用的是相对较新的 Emacs 版本([v.25 之后的版本][4])。 + +[Elisp 手册][5] 包含了 Elisp 的方方面面,但它是写给那些有明确查找目标的人们的(它在这方面也做得相当棒)。但是很多人想要能够在更高的层次上解释 Elisp 概念的材料,同时将信息压缩成最精华的部分。本篇文章也正是我回应这种呼声的一次尝试,为读者描绘基础的大体轮廓。使他们能在配置中用上这些技巧,也让他们在手册中查询细节变得更容易。 + +### 全局变量 + +用 `defcustom` 定义的用户设置和用 `defvar` 或 `defconst` 定义的变量是全局的。使用 `defcustom` 或 `defvar` 声明变量的一个非常重要的原因是,当一个变量已经被绑定bind,对它们进行重新求值不会覆盖掉已有的值。举个栗子,如果你在初始化文件中对 `my-var` 进行如下绑定: + +``` +(setq my-var nil) +``` + +对如下表达式求值不会将变量覆盖为 `t`: + +``` +(defvar my-var t) +``` + +注意此处有*一个例外*:如果你用 `C-M-x` 快捷键对上述声明求值,它将调用 `eval-defun` 函数,并将变量覆盖为 `t`。通过此方式,你可以按需将变量强制覆盖。这种行为是刻意而为之的:你可能知道,Emacs 中的许多特性是按需加载的,也可以称为自动加载。如果那些文件中的声明将变量覆盖为它们的默认值,那它也就覆盖了你初始化文件中的设置。 + +### 用户选项 + +用户选项就是使用 `defcustom` 声明的全局变量。与使用 `defvar` 声明的变量不同,这些变量可以用 `M-x customize` 界面来配置。据我所知,大部分人因为觉得它开销较大而不经常使用。一旦你知道如何在你的初始化文件中设置变量,也就没有理由一定要去使用它了。许多用户没有意识到的一个细节是,通过 `customize` 的方式设置用户选项能够执行代码,有的时间可用来运行一些附加的配置说明: + +``` +(defcustom my-option t +  "My user option." +  :set (lambda (sym val) +         (set-default sym val) +         (message "Set %s to %s" sym val))) +``` + +若你对这段代码求值,并键入 `M-x customize-option RET my-option RET` 运行 `customize` 界面,lambda 匿名函数就会被调用,回显区域就会显示出该选项的符号名与值。 + +如果你在初始化文件中使用 `setq` 改变该选项的值,那么匿名函数不会运行。要想在 Elisp 中正确设置一个选项,你需要使用函数 `customize-set-variable`。或者,人们在他们的配置文件中使用了各种版本的 `csetq` 宏来自动处理(如你所愿,你可以通过 GitHub 的代码搜索发现更复杂的变体)。 + +``` +(defmacro csetq (sym val) +  `(funcall (or (get ',sym 'custom-set) 'set-default) ',sym ,val)) +``` + +若你正在使用 [use-package][6] 宏,`:custom` 关键字会替你处理好以上这些。 + +在你将以上代码放入到你的初始化文件中之后,你便可以使用 `csetq` 宏在设置变量的同时运行任何现存的 `setter` 函数。要证明这点,你可以使用此宏来改变上面定义的选项,并观察回显区域的消息输出。 + +``` +(csetq my-option nil) +``` + +### 动态绑定与词法绑定 + +当你在使用其它编程语言时,你可能不会意识到动态绑定与词法绑定的区别。当今的大部分编程语言使用词法绑定,并且在学习变量作用域与变量查找时也没有必要去了解它们之间的区别。 + +如此看来,Emacs Lisp 比较特殊因为动态绑定是默认选项,词法绑定需要显式启用。这里有一些历史遗留原因,但在实际使用中,你应该*时刻*启用词法绑定,因为它更快并且不容易出错。要启用词法绑定,只需将如下的注释行作为你的 Emacs Lisp 文件的第一行: + +``` +;;; -*- lexical-binding: t; -*- +``` + +另一种方式,你可以调用 `add-file-local-variable-prop-line`,在你选择将变量 `lexical-binding` 置为 `t` 后,会自动插入如上的注释行。 + +在加载包含如上特殊格式行的文件时,Emacs 会相应地设置变量,这意味着该缓冲区中的代码加载时启用了词法绑定。若要采用交互式的方式,你可以调用 `M-x eval-buffer` 命令,它会将词法绑定考虑在内。 + +既然你已经知道了如何启用词法绑定,那么了解这些术语的含义就很明智了。对于动态绑定,在程序执行期间建立的最后一个绑定将用于变量查找。你可以通过将以下代码放入空缓冲区并执行 `M-x eval buffer`,以对此进行测试: + +``` +(defun a-exists-only-in-my-body (a) +  (other-function)) + +(defun other-function () +  (message "I see `a', its value is %s" a)) + +(a-exists-only-in-my-body t) +``` + +你可能会很惊讶地发现,在 `other-function` 中查找变量 `a` 竟然成功了。 + +若你在顶部添加了特殊的词法绑定注释后,重新运行前面的示例,这段代码将抛出 `variable is void` 错误,因为 `other-functioin` 无法识别变量 `a`。如果你使用的是其它编程语言,这才是你所期望的行为。 + +启用词法绑定后,作用域会由周围的代码所定义。这并不单单是性能原因,时间也已经表明了词法绑定才是更受喜爱的。 + +### 特殊变量与动态绑定 + +如你所知,`let` 用于临时建立局部绑定: + +``` +(let ((a "I'm a") +      (b "I'm b")) +  (message "Hello, %s. Hello %s" a b)) +``` + +接下来有趣的是——使用 `defcustom`、`defvar` 以及 `defconst` 定义的变量被称为*特殊变量*,不论词法绑定是否启用,它们都将使用动态绑定: + +``` +;;; -*- lexical-binding: t; -*- + +(defun some-other-function () +  (message "I see `c', its value is: %s" c)) + +(defvar c t) + +(let ((a "I'm lexically bound") +      (c "I'm special and therefore dynamically bound")) +  (some-other-function) +  (message "I see `a', its values is: %s" a)) +``` + +通过 `C-h e` 切换至 `Messages` 缓冲区,查看上述示例输出的消息。 + +使用 `let` 或者函数参数绑定的局部变量会遵循由 `lexical-binding` 变量定义的查找规则,但使用 `defvar`、`defconst` 或 `defcustom` 定义的全局变量,能够沿着调用栈在 `let` 表达式中被修改。 + +这种技巧允许方便地进行特殊定制,并且经常在 Emacs 中被使用。这并不奇怪,毕竟 Emacs Lisp 最开始只提供动态绑定作为唯一选择。下面是一个常见的示例,说明如何向只读缓冲区临时写入数据: + +``` +(let ((inhibit-read-only t)) +  (insert ...)) +``` + +这是另一个常见的示例,如何进行大小写敏感的搜索: + +``` +(let ((case-fold-search nil)) +  (some-function-which-uses-search ...)) +``` + +动态绑定允许你采用作者未曾预料的方式对函数进行修改。对于像 Emacs 这样设计使用的程序来说,这是个强大的工具与特性。 + +有一点需要注意:你可能会意外地使用局部变量名,该变量在其他地方被声明为特殊变量。防止这种冲突的一个技巧是避免在局部变量名中使用下划线。在我当前的 Emacs 会话中,以下代码只留下少数潜在冲突的候选: + +``` +(let ((vars ())) + (mapatoms + (lambda (cand) + (when (and (boundp cand) + (not (keywordp cand)) + (special-variable-p cand) + (not (string-match "-" + (symbol-name cand)))) + (push cand vars)))) + vars) ;; => (t obarray noninteractive debugger nil) +``` + +### 缓冲区局部变量 + +每个缓冲区都能够拥有变量的一个局部绑定。这就意味着对于任何变量,都会首先在当前缓冲区中查找缓冲区局部变量取代默认值。局部变量是 Emacs 中一个非常重要的特性,比如它们被主模式用来建立缓冲区范围内的行为与设置。 + +事实上你已经在本文中见过*缓冲区局部变量*——也就是将 `lexical-binding` 在缓冲区范围内设置为 `t` 的特殊注释行。在 Emacs 中,在特殊注释行中定义的缓冲区局部变量也被称为*文件局部变量*。 + +任何的全局变量都可以用缓冲区局部变量来遮掩,比如上面定义的变量 `my-var`,你可用如下方式设置局部变量: + +``` +(setq-local my-var t) +;; or (set (make-local-variable 'my-var) t) +``` + +此时 `my-var` 对于你在对上述代码进行求值时对应的缓冲区来说就是局部变量。若你对它调用 `describe-variable`,文档会同时告诉你局部与全局的值。从编程的角度来讲,你可以分别用 `buffer-local-value` 获取局部值,用 `default-value` 获取全局值。若要移除局部值,你可以调用 `kill-local-variable`。 + +另一个需要注意的重要性质就是,一旦一个变量成为缓冲区局部变量,后续在该缓冲区中使用的 `setq` 都将只能设置局部的值。要想设置默认值,你需要使用 `setq-default`。 + +因为局部变量意味着对缓冲区的定制,它们也就经常被用于模式钩子中。一个典型的例子如下所示: + +``` +(add-hook 'go-mode-hook +          (defun go-setup+ () +            (setq-local compile-command +              (if (string-suffix-p "_test.go" buffer-file-name) +                  "go test -v" +                (format "go run %s" +                        (shell-quote-argument +                         (file-name-nondirectory buffer-file-name))))))) +``` + +这将设置 `go-mode` 缓冲区中 `M-x compile` 使用的编译命令。 + +另一个重要的方面就是一些变量会*自动*成为缓冲区局部变量。这也就意味着当你使用 `setq` 设置这样一个变量时,它会针对当前缓冲区设置局部绑定。这个特性不应该被经常使用,因为这种隐式的行为并不好。不过如果你想的话,你可以使用如下方法创建自动局部变量: + +``` +(defvar-local my-automatical-local-var t) +;; or (make-variable-buffer-local 'my-automatical-local-var) +``` + +变量 `indent-tabs-mode` 就是 Emacs 内建的一个例子。如果你在初始化文件中使用 `setq` 改变变量的值,根本不会影响默认值。只有在你加载初始化文件时正处在当前的缓冲区的局部值会被改变。因此,你需要使用 `setq-default` 来改变 `indent-tabs-mode` 的默认值。 + +### 结语 + +Emacs 是一个强大的编辑器,并且随着你的定制它将变得更加强大。现在,你知道了 Elisp 是如何处理变量的,以及你应如何在你自己的脚本与配置中使用它们。 + +*本篇文章此前采用 CC BY-NC-SA 4.0 许可证发布在 [With-Emacs][7] 上,经过修改(带有合并请求)并在作者允许的情况下重新发布。* + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/3/variables-emacs + +作者:[Clemens Radermacher][a] +选题:[lujun9972][b] +译者:[cycoe](https://github.com/cycoe) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/clemera +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/programming_keyboard_coding.png?itok=E0Vvam7A (Programming keyboard.) +[2]: https://www.gnu.org/software/emacs/ +[3]: http://sachachua.com/blog/p/27144 +[4]: https://www.gnu.org/software/emacs/download.html +[5]: https://www.gnu.org/software/emacs/manual/html_node/elisp/ +[6]: https://github.com/jwiegley/use-package#customizing-variables +[7]: https://with-emacs.com/posts/tutorials/almost-all-you-need-to-know-about-variables/ diff --git a/published/202004/20200312 Make SSL certs easy with k3s.md b/published/202004/20200312 Make SSL certs easy with k3s.md new file mode 100644 index 0000000000..657d88123f --- /dev/null +++ b/published/202004/20200312 Make SSL certs easy with k3s.md @@ -0,0 +1,331 @@ +[#]: collector: (lujun9972) +[#]: translator: (wxy) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12106-1.html) +[#]: subject: (Make SSL certs easy with k3s) +[#]: via: (https://opensource.com/article/20/3/ssl-letsencrypt-k3s) +[#]: author: (Lee Carpenter https://opensource.com/users/carpie) + +用 k3s 轻松管理 SSL 证书 +====== + +> 如何在树莓派上使用 k3s 和 Let's Encrypt 来加密你的网站。 + +![](https://img.linux.net.cn/data/attachment/album/202004/13/153032ncp8q55pjwdj8ppj.jpg) + +在[上一篇文章][2]中,我们在 k3s 集群上部署了几个简单的网站。那些是未加密的网站。不错,它们可以工作,但是未加密的网站有点太过时了!如今,大多数网站都是加密的。在本文中,我们将安装 [cert-manager][3] 并将其用于在集群上以部署采用 TLS 加密的网站。这些网站不仅会被加密,而且还会使用有效的公共证书,这些证书会从 [Let's Encrypt][4] 自动获取和更新!让我们开始吧! + +### 准备 + +要继续阅读本文,你将需要我们在上一篇文章中构建的 [k3s 树莓派集群][5]。另外,你需要拥有一个公用静态 IP 地址,并有一个可以为其创建 DNS 记录的域名。如果你有一个动态 DNS 提供程序为你提供域名,可能也行。但是,在本文中,我们使用静态 IP 和 [CloudFlare][6] 来手动创建 DNS 的 A 记录。 + +我们在本文中创建配置文件时,如果你不想键入它们,则可以在[此处][7]进行下载。 + +### 我们为什么使用 cert-manager? + +Traefik(在 k3s 预先捆绑了)实际上具有内置的 Let's Encrypt 支持,因此你可能想知道为什么我们要安装第三方软件包来做同样的事情。在撰写本文时,Traefik 中的 Let's Encrypt 支持检索证书并将其存储在文件中。而 cert-manager 会检索证书并将其存储在 Kubernetes 的 “机密信息secret” 中。我认为,“机密信息”可以简单地按名称引用,因此更易于使用。这就是我们在本文中使用 cert-manager 的主要原因。 + +### 安装 cert-manager + +通常,我们只是遵循 cert-manager 的[文档][8]在 Kubernetes 上进行安装。但是,由于我们使用的是 ARM 体系结构,因此我们需要进行一些更改,以便我们可以完成这个操作。 + +第一步是创建 cert-manager 命名空间。命名空间有助于将 cert-manager 的 Pod 排除在我们的默认命名空间之外,因此当我们使用自己的 Pod 执行 `kubectl get pods` 之类的操作时,我们不必看到它们。创建名称空间很简单: + +``` +kubectl create namespace cert-manager +``` + +安装说明会让你下载 cert-manager 的 YAML 配置文件并将其一步全部应用到你的集群。我们需要将其分为两个步骤,以便为基于 ARM 的树莓派修改文件。我们将下载文件并一步一步进行转换: + +``` +curl -sL \ +https://github.com/jetstack/cert-manager/releases/download/v0.11.0/cert-manager.yaml |\ +sed -r 's/(image:.*):(v.*)$/\1-arm:\2/g' > cert-manager-arm.yaml +``` + +这会下载配置文件,并将包含的所有 docker 镜像更新为 ARM 版本。来检查一下它做了什么: + +``` +$ grep image: cert-manager-arm.yaml +          image: "quay.io/jetstack/cert-manager-cainjector-arm:v0.11.0" +          image: "quay.io/jetstack/cert-manager-controller-arm:v0.11.0" +          image: "quay.io/jetstack/cert-manager-webhook-arm:v0.11.0" +``` + +如我们所见,三个镜像现在在镜像名称上添加了 `-arm`。现在我们有了正确的文件,我们只需将其应用于集群: + +``` +kubectl apply -f cert-manager-arm.yaml +``` + +这将安装 cert-manager 的全部。我们可以通过 `kubectl --namespace cert-manager get pods` 来检查安装何时完成,直到所有 Pod 都处于 `Running` 状态。 + +这就完成了 cert-manager 的安装! + +### Let's Encrypt 概述 + +Let's Encrypt 的好处是,它免费为我们提供了经过公共验证的 TLS 证书!这意味着我们可以拥有一个完全有效的、可供任何人访问的 TLS 加密网站,这些家庭或业余的爱好活动挣不到钱,也无需自己掏腰包购买 TLS 证书!以及,当通过 cert-manager 使用 Let's Encrypt 的证书时,获得证书的整个过程是自动化的,证书的续订也是自动的! + +但它是如何工作的?下面是该过程的简化说明。我们(或代表我们的 cert-manager)向 Let's Encrypt 发出我们拥有的域名的证书请求。Let's Encrypt 通过使用 ACME DNS 或 HTTP 验证机制来验证我们是否拥有该域。如果验证成功,则 Let's Encrypt 将向我们提供证书,这些证书将由 cert-manager 安装在我们的网站(或其他 TLS 加密的端点)中。在需要重复此过程之前,这些证书可以使用 90 天。但是,cert-manager 会自动为我们更新证书。 + +在本文中,我们将使用 HTTP 验证方法,因为它更易于设置并且适用于大多数情况。以下是幕后发生的基本过程。cert-manager 向 Let's Encrypt 发出证书请求。作为回应,Let's Encrypt 发出所有权验证的质询challenges。这个质询是将一个 HTTP 资源放在请求证书的域名下的一个特定 URL 上。从理论上讲,如果我们可以将该资源放在该 URL 上,并且让 Let's Encrypt 可以远程获取它,那么我们实际上必须是该域的所有者。否则,要么我们无法将资源放置在正确的位置,要么我们无法操纵 DNS 以使 Let's Encrypt 访问它。在这种情况下,cert-manager 会将资源放在正确的位置,并自动创建一个临时的 `Ingress` 记录,以将流量路由到正确的位置。如果 Let's Encrypt 可以读到该质询要求的资源并正确无误,它将把证书发回给 cert-manager。cert-manager 将证书存储为“机密信息”,然后我们的网站(或其他任何网站)将使用这些证书通过 TLS 保护我们的流量。 + +### 为该质询设置网络 + +我假设你要在家庭网络上进行设置,并拥有一个以某种方式连接到更广泛的互联网的路由器/接入点。如果不是这种情况,则可能不需要以下过程。 + +为了使质询过程正常运行,我们需要一个我们要申请证书的域名,以将其路由到端口 80 上的 k3s 集群。为此,我们需要告诉世界上的 DNS 系统它的位置。因此,我们需要将域名映射到我们的公共 IP 地址。如果你不知道你的公共 IP 地址是什么,可以访问 [WhatsMyIP][9] 之类的地方,它会告诉你。接下来,我们需要输入 DNS 的 A 记录,该记录将我们的域名映射到我们的公共 IP 地址。为了使此功能可靠地工作,你需要一个静态的公共 IP 地址,或者你可以使用动态 DNS 提供商。一些动态 DNS 提供商会向你颁发一个域名,你可以按照以下说明使用它。我没有尝试过,所以不能肯定地说它适用于所有提供商。 + +对于本文,我们假设有一个静态公共 IP,并使用 CloudFlare 来设置 DNS 的 A 记录。如果愿意,可以使用自己的 DNS 服务器。重要的是你可以设置 A 记录。 + +在本文的其余部分中,我将使用 [k3s.carpie.net][10] 作为示例域名,因为这是我拥有的域。你显然会用自己拥有的任何域名替换它。 + +为示例起见,假设我们的公共 IP 地址是 198.51.100.42。我们转到我们的 DNS 提供商的 DNS 记录部分,并添加一个名为 [k3s.carpie.net][10] 的类型为 `A` 的记录(CloudFlare 已经假定了域的部分,因此我们只需输入 `k3s`),然后输入 `198.51.100.42` 作为 IPv4 地址。 + +![][11] + +请注意,有时 DNS 更新要传播一段时间。你可能需要几个小时才能解析该名称。在继续之前该名称必须可以解析。否则,我们所有的证书请求都将失败。 + +我们可以使用 `dig` 命令检查名称是否解析: + +``` +$ dig +short k3s.carpie.net +198.51.100.42 +``` + +继续运行以上命令,直到可以返回 IP 才行。关于 CloudFlare 有个小注释:ClouldFlare 提供了通过代理流量来隐藏你的实际 IP 的服务。在这种情况下,我们取回的是 CloudFlare 的 IP,而不是我们的 IP。但对于我们的目的,这应该可以正常工作。 + +网络配置的最后一步是配置路由器,以将端口 80 和 443 上的传入流量路由到我们的 k3s 集群。可悲的是,路由器配置页面的差异很大,因此我无法确切地说明你的外观是什么样子。大多数时候,我们需要的管理页面位于“端口转发”或类似内容下。我甚至看到过它列在“游戏”之下(显然是端口转发主要用于的游戏)!让我们看看我的路由器的配置如何。 + +![][12] + +如果你和我的环境一样,则转到 192.168.0.1 登录到路由器管理应用程序。对于此路由器,它位于 “ NAT/QoS” -> “端口转发”。在这里,我们将端口 80/TCP 协议设置为转发到 192.168.0.50(主节点 `kmaster` 的 IP)的端口 80。我们还设置端口 443 也映射到 `kmaster`。从技术上讲,这对于质询来说并不是必需的,但是在本文的结尾,我们将部署一个启用 TLS 的网站,并且需要映射 443 来进行访问。因此,现在进行映射很方便。我们保存并应用更改,应该一切顺利! + +### 配置 cert-manager 来使用 Let's Encrypt(暂存环境) + +现在,我们需要配置 cert-manager 来通过 Let's Encrypt 颁发证书。Let's Encrypt 为我们提供了一个暂存(例如用于测试)环境,以便审视我们的配置。这样它更能容忍错误和请求的频率。如果我们对生产环境做了错误的操作,我们很快就会发现自己被暂时禁止访问了!因此,我们将使用暂存环境手动测试请求。 + +创建一个文件 `letsencrypt-issuer-staging.yaml`,内容如下: + +``` +apiVersion: cert-manager.io/v1alpha2 +kind: ClusterIssuer +metadata: + name: letsencrypt-staging +spec: + acme: + # The ACME server URL + server: https://acme-staging-v02.api.letsencrypt.org/directory + # Email address used for ACME registration + email: @example.com + # Name of a secret used to store the ACME account private key + privateKeySecretRef: + name: letsencrypt-staging + # Enable the HTTP-01 challenge provider + solvers: + - http01: + ingress: + class: traefik +``` + +请确保将电子邮件地址更新为你的地址。如果出现问题或我们弄坏了一些东西,这就是 Let's Encrypt 与我们联系的方式! + +现在,我们使用以下方法创建发行者issuer: + +``` +kubectl apply -f letsencrypt-issuer-staging.yaml +``` + +我们可以使用以下方法检查发行者是否已成功创建: + +``` +kubectl get clusterissuers +``` + +`clusterissuers` 是由 cert-manager 创建的一种新的 Kubernetes 资源类型。 + +现在让我们手动请求一个测试证书。对于我们的网站,我们不需要这样做;我们只是在测试这个过程,以确保我们的配置正确。 + +创建一个包含以下内容的证书请求文件 `le-test-certificate.yaml`: + +``` +apiVersion: cert-manager.io/v1alpha2 +kind: Certificate +metadata: + name: k3s-carpie-net + namespace: default +spec: + secretName: k3s-carpie-net-tls + issuerRef: + name: letsencrypt-staging + kind: ClusterIssuer + commonName: k3s.carpie.net + dnsNames: + - k3s.carpie.net +``` + +该记录仅表示我们要使用名为 `letsencrypt-staging`(我们在上一步中创建的)的 `ClusterIssuer` 来请求域 [k3s.carpie.net][10] 的证书,并在 Kubernetes 的机密信息中名为 `k3s-carpie-net-tls` 的文件中存储该证书。 + +像平常一样应用它: + +``` +kubectl apply -f le-test-certificate.yaml +``` + +我们可以通过以下方式查看状态: + +``` +kubectl get certificates +``` + +如果我们看到类似以下内容: + +``` +NAME                    READY   SECRET                  AGE +k3s-carpie-net          True    k3s-carpie-net-tls      30s +``` + +我们走在幸福之路!(这里的关键是 `READY` 应该是 `True`)。 + +### 解决证书颁发问题 + +上面是幸福的道路。如果 `READY` 为 `False`,我们可以等等它,然后再次花点时间检查状态。如果它一直是 `False`,那么我们就有需要解决的问题。此时,我们可以遍历 Kubernetes 资源链,直到找到一条告诉我们问题的状态消息。 + +假设我们执行了上面的请求,而 `READY` 为 `False`。我们可以从以下方面开始故障排除: + +``` +kubectl describe certificates k3s-carpie-net +``` + +这将返回很多信息。通常,有用的内容位于 `Events:` 部分,该部分通常位于底部。假设最后一个事件是 `Created new CertificateRequest resource "k3s-carpie-net-1256631848`。然后我们描述describe一下该请求: + +``` +kubectl describe certificaterequest k3s-carpie-net-1256631848 +``` + +现在比如说最后一个事件是 `Waiting on certificate issuance from order default/k3s-carpie-net-1256631848-2342473830`。 + +那么,我们可以描述该顺序: + +``` +kubectl describe orders default/k3s-carpie-net-1256631848-2342473830 +``` + +假设有一个事件,事件为 `Created Challenge resource "k3s-carpie-net-1256631848-2342473830-1892150396" for domain "k3s.carpie.net"`。让我们描述一下该质询: + +``` +kubectl describe challenges k3s-carpie-net-1256631848-2342473830-1892150396 +``` + +从这里返回的最后一个事件是 `Presented challenge using http-01 challenge mechanism`。看起来没问题,因此我们浏览一下描述的输出,并看到一条消息 `Waiting for http-01 challenge propagation: failed to perform self check GET request ... no such host`。终于!我们发现了问题!在这种情况下,`no such host` 意味着 DNS 查找失败,因此我们需要返回并手动检查我们的 DNS 设置,正确解析域的 DNS,并进行所需的任何更改。 + +### 清理我们的测试证书 + +我们实际上想要使用的是域名的真实证书,所以让我们继续清理证书和我们刚刚创建的机密信息: + +``` +kubectl delete certificates k3s-carpie-net +kubectl delete secrets k3s-carpie-net-tls +``` + +### 配置 cert-manager 以使用 Let's Encrypt(生产环境) + +现在我们已经有了测试证书,是时候移动到生产环境了。就像我们在 Let's Encrypt 暂存环境中配置 cert-manager 一样,我们现在也需要对生产环境进行同样的操作。创建一个名为 `letsencrypt-issuer-production.yaml` 的文件(如果需要,可以复制和修改暂存环境的文件),其内容如下: + +``` +apiVersion: cert-manager.io/v1alpha2 +kind: ClusterIssuer +metadata: +name: letsencrypt-prod +spec: +acme: + # The ACME server URL + server: https://acme-v02.api.letsencrypt.org/directory + # Email address used for ACME registration + email: @example.com + # Name of a secret used to store the ACME account private key + privateKeySecretRef: + name: letsencrypt-prod + # Enable the HTTP-01 challenge provider + solvers: + - http01: + ingress: + class: traefik +``` + +(如果要从暂存环境进行复制,则唯一的更改是 `server:` URL。也请不要忘记修改电子邮件!) + +应用它: + +``` +kubectl apply -f letsencrypt-issuer-production.yaml +``` + +### 申请我们网站的证书 + +重要的是需要注意,我们到目前为止完成的所有步骤都只需要进行一次!而对于将来的任何其他申请,我们可以从这个说明开始! + +让我们部署在[上一篇文章][13]中部署的同样站点。(如果仍然可用,则可以修改 YAML 文件。如果没有,则可能需要重新创建并重新部署它)。 + +我们只需要将 `mysite.yaml` 的 `Ingress` 部分修改为: + +``` +--- +apiVersion: networking.k8s.io/v1beta1 +kind: Ingress +metadata: + name: mysite-nginx-ingress + annotations: + kubernetes.io/ingress.class: "traefik" + cert-manager.io/cluster-issuer: letsencrypt-prod +spec: + rules: + - host: k3s.carpie.net + http: + paths: + - path: / + backend: + serviceName: mysite-nginx-service + servicePort: 80 + tls: + - hosts: + - k3s.carpie.net + secretName: k3s-carpie-net-tls +``` + +请注意,上面仅显示了 `mysite.yaml` 的 `Ingress` 部分。所做的更改是添加了注解 `cert-manager.io/cluster-issuer: letsencrypt-prod`。这告诉 traefik 创建证书时使用哪个发行者。 其他唯一增加的是 `tls:` 块。这告诉 traefik 我们希望在主机 [k3s.carpie.net][10] 上具有 TLS 功能,并且我们希望 TLS 证书文件存储在机密信息 `k3s-carpie-net-tls` 中。 + +请记住,我们没有创建这些证书!(好吧,我们创建了名称相似的测试证书,但我们删除了这些证书。)Traefik 将读取这些配置并继续寻找机密信息。当找不到时,它会看到注释说我们想使用 `letsencrypt-prod` 发行者来获取它。由此,它将提出请求并为我们安装证书到机密信息之中! + +大功告成! 让我们尝试一下。 + +它现在具有了加密 TLS 所有优点!恭喜你! + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/3/ssl-letsencrypt-k3s + +作者:[Lee Carpenter][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/carpie +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/files_documents_paper_folder.png?itok=eIJWac15 (Files in a folder) +[2]: https://linux.cn/article-12081-1.html +[3]: https://cert-manager.io/ +[4]: https://letsencrypt.org/ +[5]: https://linux.cn/article-12049-1.html +[6]: https://cloudflare.com/ +[7]: https://gitlab.com/carpie/k3s_using_certmanager/-/archive/master/k3s_using_certmanager-master.zip +[8]: https://cert-manager.io/docs/installation/kubernetes/ +[9]: https://whatsmyip.org/ +[10]: http://k3s.carpie.net +[11]: https://opensource.com/sites/default/files/uploads/ep011_dns_example.png +[12]: https://opensource.com/sites/default/files/uploads/ep011_router.png +[13]:https://linux.cn/article-12081-1.html +[14]: http://cert-manager.io/cluster-issuer diff --git a/published/202004/20200313 What is the internet backbone and how it works.md b/published/202004/20200313 What is the internet backbone and how it works.md new file mode 100644 index 0000000000..5e120b20da --- /dev/null +++ b/published/202004/20200313 What is the internet backbone and how it works.md @@ -0,0 +1,69 @@ +[#]: collector: (lujun9972) +[#]: translator: (messon007) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12141-1.html) +[#]: subject: (What is the internet backbone and how it works) +[#]: via: (https://www.networkworld.com/article/3532318/what-is-the-internet-backbone-and-how-it-works.html) +[#]: author: (Tim Greene https://www.networkworld.com/author/Tim-Greene/) + +什么是互联网骨干网,它是怎样工作的 +====== + +> 一级互联网服务提供商(ISP)将其高速光纤网络连接在一起,形成互联网的骨干网,实现在不同地理区域之间高效地传输流量。 + +![](https://images.idgesg.net/images/article/2018/04/global_network_connections_by_gerd_altmann_cc0_via_pixabay_1200x800-100754306-large.jpg) + +互联网会产生大量的计算机到计算机的流量,要确保所有流量都可以在世界上任何地方之间传输,就需要大量汇聚的高速网络,这些网络统称为互联网骨干网,但是它是如何工作的呢? + +### 互联网的骨干网是什么? + +像任何其他网络一样,互联网由接入链路组成,这些接入链路将流量传输到高带宽路由器,路由器又将流量从源地址通过最佳可用路径传输到目的地址。其核心是由相互连接的、彼此对等的各个高速光纤网络而构成的互联网骨干网。 + +单个独立的核心网络由一级互联网服务提供商(ISP)所拥有。他们的网络连接在一起。这些提供商包括 AT&T、CenturyLink、Cogent Communications,、Deutsche Telekom、Global Telecom and Technology (GTT)、NTT Communications、Sprint、Tata Communications,、Telecom Italia Sparkle、Telia Carrier和 Verizon。 + +通过将这些长途网连接在一起,一级 ISP 们创建了一个他们可以访问整个路由表的单一的全球性网络,因此他们可以通过逐步层次化地增加本地 ISP 网络来有效地将流量传输到其目的地。 + +除了物理连接之外,这些骨干网提供商还通过一致的网络协议 TCP/IP 融合在一起,这实际上是两个协议,传输控制协议transport control protocol互联网协议internet protocol,它们在计算机之间建立连接,以确保连接可靠,并将消息格式化为数据包。 + +### 互联网交接点(IXP)将骨干网连接在一起 + +骨干网 ISP 在中立位置的对等点通过高速交换机和路由器连接其网络。这些通常由第三方(有时是非营利组织)提供,以促进骨干网的统一。 + +参与的一级 ISP 会帮助资助 IXP,但不向其他一级 ISP 收取流量传输费用,这种关系称为无结算对等。这种协议消除了可能导致互联网性能下降的潜在财务纠纷。 + +### 骨干网有多快? + +互联网骨干网由最快的路由器组成,可以提供 100Gbps 的线路速度。这些路由器由包括 Cisco、Extreme、华为、Juniper 和 Nokia 在内的供应商制造,使用边界网关协议(BGP)在彼此之间路由流量。 + +### 流量是如何进入骨干网的 + +在 1 级 ISP 之下是规模较小的 2 级和 3 级 ISP。 + +3 级 ISP 为企业和消费者提供了互联网接入服务。这些提供商自己没有接入互联网骨干网,因此,他们自己无法将其客户连接到数十亿台互联网上的计算机。 + +购买一级 ISP 提供商的接入非常昂贵。通常 3 级 ISP 与拥有自己网络的 2 级(区域)ISP 签订合同,利用 2 级 ISP 的网络将流量传输到有限的地理区域,但不能传输到所有互联网上的设备。 + +为此,2 级 ISP 与 1 级 ISP 签约以访问全球骨干网,并以这种方式使客户可以访问整个互联网。 + +这种方式使得来自世界一侧的计算机的流量能够连接到另一侧的计算机。流量从源计算机流向 3 级 ISP,再路由到 2 级 ISP,再路由到 1 级骨干网提供商,再路由到正确的 2 级 ISP,最后路由到提供该数据的 3 级接入提供商连接的目标计算机。 + +-------------------------------------------------------------------------------- + +via: https://www.networkworld.com/article/3532318/what-is-the-internet-backbone-and-how-it-works.html + +作者:[Tim Greene][a] +选题:[lujun9972][b] +译者:[messon007](https://github.com/messon007) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://www.networkworld.com/author/Tim-Greene/ +[b]: https://github.com/lujun9972 +[1]: https://pixabay.com/en/social-media-digitization-faces-3271592/ +[2]: https://creativecommons.org/publicdomain/zero/1.0/ +[3]: https://www.networkworld.com/newsletters/signup.html +[4]: https://www.networkworld.com/article/3440100/take-the-intelligent-route-with-consumption-based-storage.html?utm_source=IDG&utm_medium=promotions&utm_campaign=HPE21620&utm_content=sidebar ( Take the Intelligent Route with Consumption-Based Storage) +[5]: https://www.facebook.com/NetworkWorld/ +[6]: https://www.linkedin.com/company/network-world diff --git a/published/202004/20200320 Build a private social network with a Raspberry Pi.md b/published/202004/20200320 Build a private social network with a Raspberry Pi.md new file mode 100644 index 0000000000..8e9faaa8cc --- /dev/null +++ b/published/202004/20200320 Build a private social network with a Raspberry Pi.md @@ -0,0 +1,341 @@ +[#]: collector: (lujun9972) +[#]: translator: (lxbwolf) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12120-1.html) +[#]: subject: (Build a private social network with a Raspberry Pi) +[#]: via: (https://opensource.com/article/20/3/raspberry-pi-open-source-social) +[#]: author: (Giuseppe Cassibba https://opensource.com/users/peppe8o) + +用树莓派搭建一个私人社交网络 +====== + +> 手把手教你怎样以低成本的硬件和简易步骤搭建自己的社交网络。 + +![Team of people around the world][1] + +近年来,社交网络已经革新了人们的生活习惯。人们每天都会使用社交频道与朋友和家人联系。但是涉及到隐私和数据安全时,仍有一些共同的问题。尽管社交网络创建了复杂的隐私策略来保护用户的信息,但如果你不想自己的信息被泄露,最好的办法还是把数据保存在自己的服务器上。 + +一个树莓派 — 多才多艺的 Raspbian Lite 版本就可以让你搭建很多有用的家庭服务(参照我的文章[树莓派项目][2])。通过搜索开源软件你就可以实现一些令人痴迷的功能,你也可以用这个神奇的设备来感受那些功能。其中一个有趣的尝试就是在你的树莓派上安装 OSSN。 + +### OSSN 是什么? + +[开源社交网络][3]OpenSource Social Network(OSSN)是用 PHP 写的一个快速开发社交网络软件,让你可以搭建自己的社交网站。OSSN 可以用来搭建不同类型的社交应用,如: + + * 私人内部网 + * 公用/公开网络 + * 社区 + +OSSN 支持的功能: + + * 照片 + * 个人资料 + * 朋友圈 + * 表情 + * 搜索 + * 聊天 + +OSSN 运行在 LAMP 服务器上。硬件需求很简单,却能提供强大的用户界面,也友好支持移动端。 + +### 我们需要准备什么 + +这个项目很简单,而且由于我们只安装远程 Web 服务,因此我们只需要一些便宜的零件就够了。我使用的是树莓派 3B+,但是用树莓派 3A+ 或其他更新的板应该也可以。 + +硬件: + + * 带有电源模块的树莓派 3B+ + * 一张 SD 卡(最好是性能好点的卡,至少 16 GB) + * 一台有 SFTP 软件(如免费的 [Filezilla][4])的桌面 PC,用来把安装包传到你的树莓派上 + +### 操作步骤 + +我们首先搭建一个传统的 LAMP 服务器,然后配置数据库用户和安装 OSSN。 + +#### 1、安装 Raspbian Buster Lite 操作系统 + +你可以直接参照我的文章[在你的树莓派上安装 Raspbian Buster Lite][5]。 + +为了确保你的系统是最新的,ssh 登录到树莓派后在终端输入下面的命令: + +```bash +sudo apt-get update +sudo apt-get upgrade +``` + +#### 2、安装 LAMP 服务 + +LAMP(Linux–Apache–Mysql–Php)服务通常与 MySQL 数据库配合。在我们的项目中,我们选择 MariaDB,因为它更轻量,完美支持树莓派。 + +安装 Apache 服务: + +``` +sudo apt-get install apache2 -y +``` + +你可以通过在浏览器输入 `http://<>` 来检查 Apache 是否安装正确: + +![][6] + +安装 PHP: + +``` +sudo apt-get install php -y +``` + +安装 MariaDB 服务和 PHP connector: + +``` +sudo apt-get install mariadb-server php-mysql -y +``` + +安装 phpMyAdmin: + +在 OSSN 中 phpMyAdmin 不是强制安装的,但我建议你安装,因为它可以简化数据库的管理。 + +``` +sudo apt-get install phpmyadmin +``` + +在 phpMyAdmin 配置界面,执行以下步骤: + + * 按下空格和 “OK” 选择 apache(强制)。 + * 在 dbconfig-common 选择“Yes”,配置 phpMyAdmin 的数据库。 + * 输入想设置的密码,按下 “OK”。 + * 再次输入 phpMyAdmin 密码来确认,按下 “OK”。 + +为 phpMyAdmin 用户添加数据库权限来管理数据库: + +我们用 root 用户连接 MariaDB(默认没有密码)来设置权限。 + +``` +sudo mysql -uroot -p +grant all privileges on *.* to 'phpmyadmin'@'localhost'; +flush privileges; +quit +``` + +最后,重启 Apache 服务: + +``` +sudo systemctl restart apache2.service +``` + +在浏览器输入 `http://<>/phpmyadmin/` 来检查 phpMyAdmin 是否正常: + +![][7] + +默认的 phpMyAdmin 登录凭证: + + * 用户名:`phpmyadmin` + * 密码:在 phpMyAdmin 安装步骤中你设置的密码 + +#### 3、安装 OSSN 所需的其他包和配置 PHP + +在第一次配置 OSSN 前,我们还需要在系统上安装一些所需的包: + + * PHP 版本 5.6、7.0 或 7.1 + * MYSQL 5 及以上 + * APACHE + * MOD_REWRITE + * 需要打开 PHP 扩展 cURL 和 Mcrypt + * PHP GD 扩展 + * PHP ZIP 扩展 + * 打开 PHP 设置 `allow_url_fopen` + * PHP JSON 支持 + * PHP XML 支持 + * PHP OpenSSL + +在终端输入以下命令来安装上述包: + +``` +sudo apt-get install php7.3-curl php7.3-gd php7.3-zip php7.3-json php7.3-xml +``` + +打开 mod_rewrite: + +``` +sudo a2enmod rewrite +``` + +修改默认的 Apache 配置,使用 mod_rewrite: + +``` +sudo nano /etc/apache2/sites-available/000-default.conf +``` + +在 `000-default.conf` 文件中添加下面的内容: + +```ini + + ServerAdmin webmaster@localhost + DocumentRoot /var/www/html + ErrorLog ${APACHE_LOG_DIR}/error.log + CustomLog ${APACHE_LOG_DIR}/access.log combined + # 需要添加的部分开始 -------------------------------- + + Options Indexes FollowSymLinks MultiViews + AllowOverride All + Require all granted + + # 需要添加的部分结束 -------------------------------- + +``` + +安装 Mcrypt: + +```bash +sudo apt install php-dev libmcrypt-dev php-pear +sudo pecl channel-update pecl.php.net +sudo pecl install mcrypt-1.0.2 +``` + +打开 Mcrypt 模块: + +在 `/etc/php/7.3/apache2/php.ini` 文件中 `extension=mcrypt.so`(或取消注释): + +```bash +sudo nano /etc/php/7.3/apache2/php.ini +``` + +`allow_url_fopen` 应该已经在 `/etc/php/7.3/apache2/php.ini` 文件中打开了。OpenSSL 应该在 php7.3 中安装了。 + +我建议的另一个设置是把 PHP 最大上传文件数修改为 16 MB: + +``` +sudo nano /etc/php/7.3/apache2/php.ini +``` + +搜索到 `upload_max_filesize` 所在的行,参照下面的设置: + +``` +upload_max_filesize = 16M +``` + +保存并退出,重启 Apache: + +``` +sudo systemctl restart apache2.service +``` + +#### 4、安装 OSSN + +##### 创建数据库,设置用户 + +回到 phpmyadmin web 页面(浏览器输入 `http://<>/phpmyadmin/`)并登录: + +- 用户名: `phpmyadmin` +- 密码:在 phpMyAdmin 安装步骤中你设置的密码 + +点击数据库标签页: + +![][8] + +创建一个数据库,记下数据库的名字,因为在之后的安装过程中,你要手动输入它。 + +![][9] + +现在为 OSSN 创建一个数据库用户,我使用下面的凭证: + +- 用户名: `ossn_db_user` +- 密码: `ossn_db_password` + +在终端输入下面的命令(如果你没有修改过密码,root 密码应该仍然是空): + +```bash +sudo mysql -uroot -p +CREATE USER 'ossn_db_user'@'localhost' IDENTIFIED BY 'ossn_db_password'; +GRANT ALL PRIVILEGES ON ossn_db.* TO 'ossn_db_user'@'localhost'; +flush privileges; +quit +``` + +##### 安装 OSSN 软件 + +在你 PC 上从 [OSSN 下载页面][10] 下载 OSSN 安装压缩文件,保存为文件 `ossn-v5.2-1577836800.zip`。 + +使用你习惯的 SFTP 软件把整个压缩文件通过 SFTP 传到树莓派的新目录 `/home/pi/download` 下。常用的(默认)SFP 连接参数是: + + * 主机:你树莓派的 IP 地址 + * 用户名:`pi` + * 密码:raspberry(如果没有修改过默认密码) + * 端口: 22 + +在终端输入: + +```bash +cd /home/pi/download/ # 进入上传的 OSSN 安装文件的目录。 +unzip ossn-v5.2-1577836800.zip # 从压缩包中提取所有文件 +cd /var/www/html/ # 进入 Apache Web 目录 +sudo rm index.html # 删除 Apache 默认页面 - 我们将使用 OSSN +sudo cp -R /home/pi/download/ossn-v5.2-1577836800/* ./ #Copy installation files to web directory +sudo chown -R www-data:www-data ./ +``` + +创建数据文件夹:OSSN 需要一个文件夹来存放数据。出于安全目的,OSSN 建议这个文件夹创建在公开文档根目录之外。所以,我们在 `/opt` 下创建。 + +```bash +sudo mkdir /opt/ossn_data +sudo chown -R www-data:www-data /opt/ossn_data/ +``` + +在浏览器输入 `http://<>` 来开始安装向导。 + +![][11] + +所有项都检查完后,点击页面最下面的下一步按钮。 + +![][12] + +阅读证书验证并点击页面最下面的下一步按钮来接受证书。 + +![][13] + +输入数据库用户名,密码和你选择的数据库名字,记得也要输入 OSSN 数据文件夹名称。点击安装。 + +![][14] + +输入你的管理员账号信息,点击创建按钮。 + +![][15] + +现在所有的工作应该都完成了。点击结束,进入管理员首页。 + +![][16] + +你可以通过 URL `http://<>/administrator` 进入管理员控制面板,普通用户可以访问链接是 `http://<>`。 + +![][17] + +本文首发在 [peppe8o.com][18]。已获得转载授权。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/3/raspberry-pi-open-source-social + +作者:[Giuseppe Cassibba][a] +选题:[lujun9972][b] +译者:[lxbwolf](https://github.com/lxbwolf) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/peppe8o +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/team_global_people_gis_location.png?itok=Rl2IKo12 (Team of people around the world) +[2]: https://peppe8o.com/2019/04/best-raspberry-pi-projects-with-open-source-software/ +[3]: https://www.opensource-socialnetwork.org/ +[4]: https://filezilla-project.org/ +[5]: https://peppe8o.com/2019/07/install-raspbian-buster-lite-in-your-raspberry-pi/ +[6]: https://opensource.com/sites/default/files/uploads/ossn_1_0.jpg +[7]: https://opensource.com/sites/default/files/uploads/ossn_2.jpg +[8]: https://opensource.com/sites/default/files/uploads/ossn_3.jpg +[9]: https://opensource.com/sites/default/files/uploads/ossn_4.jpg +[10]: https://www.opensource-socialnetwork.org/download +[11]: https://opensource.com/sites/default/files/uploads/ossn_5.jpg +[12]: https://opensource.com/sites/default/files/uploads/ossn_6.jpg +[13]: https://opensource.com/sites/default/files/uploads/ossn_7.jpg +[14]: https://opensource.com/sites/default/files/uploads/ossn_8.jpg +[15]: https://opensource.com/sites/default/files/uploads/ossn_9.jpg +[16]: https://opensource.com/sites/default/files/uploads/ossn_10.jpg +[17]: https://opensource.com/sites/default/files/uploads/ossn_11.jpg +[18]: https://peppe8o.com/private-social-network-with-raspberry-pi-and-opensource-social-network/ diff --git a/published/202004/20200320 Control the firewall at the command line.md b/published/202004/20200320 Control the firewall at the command line.md new file mode 100644 index 0000000000..4cf7283963 --- /dev/null +++ b/published/202004/20200320 Control the firewall at the command line.md @@ -0,0 +1,134 @@ +[#]: collector: "lujun9972" +[#]: translator: "tinyeyeser" +[#]: reviewer: "wxy" +[#]: publisher: "wxy" +[#]: url: "https://linux.cn/article-12103-1.html" +[#]: subject: "Control the firewall at the command line" +[#]: via: "https://fedoramagazine.org/control-the-firewall-at-the-command-line/" +[#]: author: "Paul W. Frields https://fedoramagazine.org/author/pfrields/" + +在 Fedora 命令行下玩转防火墙 +====== + +![](https://img.linux.net.cn/data/attachment/album/202004/12/123040ghxuicphyhsoppch.jpg) + +网络防火墙,顾名思义:为了阻止不需要的网络连接而设置的防护性屏障。在与外界建立连接或是提供网络服务时常常会用到。例如,在学校或是咖啡厅里使用笔记本电脑时,你一定不想某个陌生人窥探你的电脑。 + +每个 Fedora 系统都内置了一款防火墙。这是 Linux 内核网络功能的一部分。本文介绍如何通过 `firewall-cmd` 命令修改防火墙的配置。 + +### 网络基础 + +本文并不教授计算机网络的[所有知识][2],但还是会简单介绍一些网络基础。 + +网络中的所有计算机都有一个 *IP 地址*,可以把它想象成一个邮箱地址,有了邮箱地址,邮件才知道发往何处。每台计算机还会拥有一组*端口*,端口号范围从 0 到 65535。同样的,你可以把这些端口想象成用来连接邮箱地址的连接点。 + +通常情况下,端口会是一个标准端口号或是根据应用程序的应答要求选定的一个端口范围。例如,一台 Web 服务器通常会保留 80 端口用于 HTTP 通信,443 端口用于 HTTPS。小于 1024 的端口主要用于系统或常见用途,1024-49151 端口是已经注册的,49152 及以上端口多为临时使用(只限短时间使用)。 + +互联网传输中最常见的两个协议,[TCP][4] 和 [UDP][5]。当要传输的数据很重要,不能有丢包时,就使用 TCP 协议,如果数据包没有按顺序到达,还需要重组为正确的顺序。UDP 协议则更多用于对时间敏感的服务,为了保证时效性,有时允许丢失部分数据。 + +系统中运行的应用,例如 Web 服务器,会保留一些端口(例如上文提到的 80 和 443)。在网络传输过程中,主机会为传输的两端建立一个链接,一端是源地址和源端口,另一端是目的地址和目的端口。 + +网络防火墙就是基于地址、端口及其他标准的一组规则集,来对网络数据的传输进行屏蔽或阻断的。通过 `firewall-cmd` 命令,我们就可以查看或修改防火墙的工作配置。 + +### 防火墙域(zone) + +为了验证防火墙是否开启,使用 `firewall-cmd` 命令,输入时要加上 [sudo](https://fedoramagazine.org/howto-use-sudo/)。(通常,在运行了 [PolicyKit](https://en.wikipedia.org/wiki/Polkit) 的环境中,你也可以不加 `sudo`) + +``` +$ sudo firewall-cmd --state +running +``` + +firewalld 服务支持任意数量的域。每个域都可以拥有独立的配置和防护规则。一台 Fedora 工作站的外部接口(例如 WIFI 或有线网卡)其默认域为 `FedoraWorkstation`。 + +要看有哪些域是激活状态,可以使用 `-–get-active-zones` 选项。在本示例中,有两个网卡,有线以太网卡 `wlp2s0` 和虚拟(libvirt)桥接网卡 `virbr0`: + +``` +$ sudo firewall-cmd --get-active-zones +FedoraWorkstation + interfaces: wlp2s0 +libvirt + interfaces: virbr0 +``` + +如果想看看默认域是什么,或是直接查询所有域: + +``` +$ sudo firewall-cmd --get-default-zone +FedoraWorkstation +$ sudo firewall-cmd --get-zones +FedoraServer FedoraWorkstation block dmz drop external home internal libvirt public trusted work +``` + +查询默认域中防火墙放行了哪些系统,使用 `-–list-services` 选项。下例给出了一个定制系统的查询结果,你可以看到与常见的结果有些不同。 + +``` +$ sudo firewall-cmd --list-services +dhcpv6-client mdns samba-client ssh +``` + +该系统对外开启了四个服务。每个服务都对应一个常见端口。例如 `ssh` 服务对应 22 端口。 + +如果要查看当前域中防火墙还开启了哪些端口,可以使用 `--list-ports` 选项。当然,你也可以随时对其他域进行查询: + +``` +$ sudo firewall-cmd --list-ports --zone=FedoraWorkstation +1025-65535/udp 1025-65535/tcp +``` + +结果表明,从 1025 到 65535 端口(包含 UDP 和 TCP)默认都是开启的。 + +### 修改域、端口及服务 + +以上的配置都是预先设计好的防火墙策略。是为了确保新手用户安装的应用都能够正常访问网络。如果你确定自己心里有数,想要一个保护性更强的策略,可以将接口放入 `FedoraServer` 域,明确禁止所有端口的访问。(**警告**:如果你的服务器之前是联网状态,这么做可能会导致连接中断,那你就得到机房里去修改更多的配置项!) + +``` +$ sudo firewall-cmd --change-interface= --zone=FedoraServer +success +``` + +**本文并不讨论如何制定防火墙策略,Fedora 社区里已经有很多讨论了。你大可以按照自身需要来修改配置。** + +如果你想要开放某个服务的常见端口,可以将该服务加入默认域(或使用 `--zone` 指定一个不同的域)。还可以一次性将其加入多个域。下例开放了 HTTP 和 HTTPS 的常见端口 80、443: + +``` +$ sudo firewall-cmd --add-service=http --add-service=https +success +``` + +并非所有的服务都有默认端口,不过大部分都是有的。使用 `-–get-services` 选项可以查看完整列表。 + +如果你想指定某个特定端口号,可以直接用数字和协议进行配置。(多数情况下,`-–add-service` 和 `-–add-port` 这两个选项是合在一起使用的)下例开启的是 UDP 协议的网络启动服务: + +``` +$ sudo firewall-cmd --add-port=67/udp +success +``` + +**重要**:如果想要在系统重启或是 firewalld 服务重启后,配置仍然生效,**必须**在命令中加上 `-–permanent` 选项。本文中的例子只是临时修改了配置,下次遇到系统重启或是 firewalld 服务重启,这些配置就失效了。 + +以上只是 `firewall-cmd` 和 firewalld 服务诸多功能中的一小部分。firewalld 项目的[主页][8]还有更多信息值得你去探索和尝试。 + +-------------------------------------------------------------------------------- + +via: https://fedoramagazine.org/control-the-firewall-at-the-command-line/ + +作者:[Paul W. Frields][a] +选题:[lujun9972][b] +译者:[tinyeyeser](https://github.com/tinyeyeser) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://fedoramagazine.org/author/pfrields/ +[b]: https://github.com/lujun9972 +[1]: https://fedoramagazine.org/wp-content/uploads/2020/03/firewall-cmd-816x345.jpg +[2]: https://en.wikipedia.org/wiki/Portal:Internet +[3]: https://en.wikipedia.org/wiki/List_of_TCP_and_UDP_port_numbers +[4]: https://en.wikipedia.org/wiki/Transmission_Control_Protocol +[5]: https://en.wikipedia.org/wiki/User_Datagram_Protocol +[6]: https://fedoramagazine.org/howto-use-sudo/ +[7]: https://en.wikipedia.org/wiki/Polkit +[8]: https://firewalld.org/ +[9]: https://unsplash.com/@jakobustrop?utm_source=unsplash&utm_medium=referral&utm_content=creditCopyText +[10]: https://unsplash.com/s/photos/brick-wall?utm_source=unsplash&utm_medium=referral&utm_content=creditCopyText diff --git a/published/202004/20200320 How to Check Password Expiration Date for All Users on Linux.md b/published/202004/20200320 How to Check Password Expiration Date for All Users on Linux.md new file mode 100644 index 0000000000..1633f32694 --- /dev/null +++ b/published/202004/20200320 How to Check Password Expiration Date for All Users on Linux.md @@ -0,0 +1,119 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12062-1.html) +[#]: subject: (How to Check Password Expiration Date for All Users on Linux) +[#]: via: (https://www.2daygeek.com/linux-check-user-password-expiration-date/) +[#]: author: (Magesh Maruthamuthu https://www.2daygeek.com/author/magesh/) + +如何在 Linux 上检查所有用户密码到期日期 +====== + +![](https://img.linux.net.cn/data/attachment/album/202004/01/104918dn0n0anhxoia40rc.jpg) + +如果你在 [Linux 上启用了密码策略][1]。密码必须在到期前进行更改,并且登录到系统时会收到通知。 + +如果你很少使用自己的帐户,那么可能由于密码过期而被锁定。在许多情况下,这可能会在[无需密码登录][2]的服务帐户中发生,因为没人会注意到它。 + +这将导致停止服务器上配置的 [cronjob/crontab][3]。 + +如果如此,该如何缓解这种情况。 + +你可以写一个 shell 脚本来获得有关它的通知,我们前一段时间为此写了一篇文章。 + + * [使用 Bash 脚本发送包含几天内到期的用户账号列表的电子邮件][5] + +它将给出天数,但是本文旨在在终端中给你实际日期。 + +这可以使用 `chage` 命令来实现。 + +### 什么是 chage 命令? + +`chage` 代表更改时效change age。它更改用户密码到期信息。 + +`chage` 命令可以修改两次密码更改之间的天数,以及最后一次更改密码的日期。 + +系统使用此信息来确定用户何时应更改密码。 + +它还允许用户执行其他功能,例如设置帐户到期日期、在到期后将密码设置为无效、显示帐户时效信息、设置密码更改之前的最小和最大天数以及设置到期警告天数。 + +### 1)如何在 Linux 上检查特定用户的密码到期日期 + +如果要检查 Linux 上特定用户的密码到期日期,请使用以下命令。 + +``` +# chage -l daygeek + +Last password change : Feb 13, 2020 +Password expires : May 13, 2020 +Password inactive : never +Account expires : never +Minimum number of days between password change : 7 +Maximum number of days between password change : 90 +Number of days of warning before password expires : 7 +``` + +### 2)如何在 Linux 上检查所有用户的密码到期日期 + +你可以直接对单个用户使用 chage 命令,不过可能你对多个用户使用时可能无效。 + +为此,你需要编写一个小的 shell 脚本。下面的 shell 脚本可以列出添加到系统中的所有用户,包括系统用户。 + +``` +# for user in $(cat /etc/passwd |cut -d: -f1); do echo $user; chage -l $user | grep "Password expires"; done | paste -d " " - - | sed 's/Password expires//g' +``` + +你将得到类似以下的输出,但是用户名可能不同。 + +``` +root : never +bin : never +daemon : never +adm : never +lp : never +sync : never +shutdown : never +u1 : Nov 12, 2018 +u2 : Jun 17, 2019 +u3 : Jun 17, 2019 +u4 : Jun 17, 2019 +u5 : Jun 17, 2019 +``` + +### 3)如何检查 Linux 上除系统用户外的所有用户的密码有效期 + +下面的 shell 脚本将显示有到期日期的用户列表。 + +``` +# for user in $(cat /etc/passwd |cut -d: -f1); do echo $user; chage -l $user | grep "Password expires"; done | paste -d " " - - | sed 's/Password expires//g' | grep -v "never" +``` + +你将得到类似以下的输出,但是用户名可能不同。 + +``` +u1 : Nov 12, 2018 +u2 : Jun 17, 2019 +u3 : Jun 17, 2019 +u4 : Jun 17, 2019 +u5 : Jun 17, 2019 +``` + +-------------------------------------------------------------------------------- + +via: https://www.2daygeek.com/linux-check-user-password-expiration-date/ + +作者:[Magesh Maruthamuthu][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://www.2daygeek.com/author/magesh/ +[b]: https://github.com/lujun9972 +[1]: https://linux.cn/article-10698-1.html +[2]: https://www.2daygeek.com/configure-setup-passwordless-ssh-key-based-authentication-linux/ +[3]: https://www.2daygeek.com/linux-crontab-cron-job-to-schedule-jobs-task/ +[4]: https://www.2daygeek.com/category/shell-script/ +[5]: https://linux.cn/article-11781-1.html diff --git a/published/202004/20200323 Don-t love diff- Use Meld instead.md b/published/202004/20200323 Don-t love diff- Use Meld instead.md new file mode 100644 index 0000000000..9fd421118f --- /dev/null +++ b/published/202004/20200323 Don-t love diff- Use Meld instead.md @@ -0,0 +1,126 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12067-1.html) +[#]: subject: (Don't love diff? Use Meld instead) +[#]: via: (https://opensource.com/article/20/3/meld) +[#]: author: (Ben Nuttall https://opensource.com/users/bennuttall) + +不喜欢 diff 么?试试 Meld 吧 +====== + +> Meld 是一个可视化 diff 工具,它可让你轻松比较和合并文件、目录、Git 仓库等的更改。 + +![](https://img.linux.net.cn/data/attachment/album/202004/03/122428dkagz1qtgh9f2g10.jpg) + +Meld 是我处理代码和数据文件的基本工具之一。它是一个图形化的 diff 工具,因此,如果你曾经使用过 `diff` 命令并难以理解输出,那么 [Meld][2] 可以为你提供帮助。 + +这是该项目网站的精彩描述: + +>“Meld 是面向开发人员的可视化 diff 和合并工具。Meld 可以帮助你比较文件、目录和版本控制的项目。它提供文件和目录的双向和三向比较,并支持许多流行的版本控制系统。” +> +>“Meld 可以帮助你检查代码更改并了解补丁。它甚至可以帮助你弄清你一直在避免的合并中发生了什么。” + +你可以使用以下命令在 Debian/Ubuntu 系统(包括 Raspbian)上安装 Meld: + +``` +$ sudo apt install meld +``` + +在 Fedora 或类似产品上: + +``` +$ sudo dnf install meld +``` + +Meld 是跨平台的,它有一个使用 [Chocolately][4] 包管理器的 [Windows 安装包][3]。尽管它在 macOS 上不受官方支持,但有[可用于 Mac 的版本][5],你可以使用 Homebrew 安装: + +``` +$ brew cask install meld +``` + +有关[其他系统][2],请参见 Meld 的主页。 + +### Meld 对比 diff 命令 + +如果你有两个相似的文件(也许一个是另一个的修改版本),并想要查看它们之间的更改,那么可以在终端中运行 `diff` 命令查看它们的区别: + +![diff output][6] + +此例显示了 `conway1.py` 和 `conway2.py` 之间的区别。表明我: + +* 删除了[释伴][7]和第二行 +* 从类声明中删除了 `(object)` +* 为类添加了 docstring +* 在方法中交换了 `alive` 和 `neighbours == 2` 的顺序 + +这是使用 `meld` 命令的相同例子。你可以在命令行中运行以下命令进行相同的比较: + +``` +$ meld conway1.py conway2.py +``` + +![Meld output][8] + +Meld 更清晰! + +你可以轻松查看并单击箭头(左右都行)合并文件之间的更改。你甚至可以实时编辑文件(在输入时,Meld 可以用作具有实时比较功能的简单文本编辑器)—只是要记得在关闭窗口之前保存。 + +你甚至可以比较和编辑三个不同的文件: + +![Comparing three files in Meld][9] + +### Meld 的 Git 感知 + +希望你正在使用 [Git][10] 之类的版本控制系统。如果是这样,那么你的比较就不是在两个不同文件之间进行,而是要查找当前文件与 Git 历史文件之间的差异。Meld 理解这一点,因此,如果你运行 `meld conway.py`(`conway.py` 在 Git 中),它将显示自上次 Git 提交以来所做的更改: + +![Comparing Git files in Meld][11] + +你可以看到当前版本(右侧)和仓库版本(左侧)之间的更改。你可以看到,自上次提交以来,我删除了一个方法,并添加了一个参数和一个循环。 + +如果你运行 `meld .`,你将看到当前目录(如果位于仓库的根目录,就是整个仓库)中的所有更改: + +![Meld . output][12] + +你会看到一个文件被修改了,另一个文件未加入版本控制(这意味着它对 Git 是新的,因此在比较之前,我需要 `git add` 添加该文件),以及许多其他未修改的文件。顶部的图标提供了各种显示选项。 + +你还可以比较两个目录,这有时很方便: + +![Comparing directories in Meld][13] + +### 结论 + +即使是普通用户也会觉得 diff 的比较难以理解。我发现 Meld 提供的可视化在找出文件之间的更改方面有很大的不同。最重要的是,Meld 有一些有用的版本控制认知,可以帮助你在不考虑太多内容的情况下对 Git 提交进行比较。快来试试 Meld,并轻松解决问题。 + +* * * + +*本文最初发表在 Ben Nuttall 的 [Tooling blog][14] 上,并经允许重新使用。* + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/3/meld + +作者:[Ben Nuttall][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/bennuttall +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/coffee_tea_laptop_computer_work_desk.png?itok=D5yMx_Dr (Person drinking a hat drink at the computer) +[2]: https://meldmerge.org/ +[3]: https://chocolatey.org/packages/meld +[4]: https://opensource.com/article/20/3/chocolatey +[5]: https://yousseb.github.io/meld/ +[6]: https://opensource.com/sites/default/files/uploads/diff-output.png (diff output) +[7]: https://en.wikipedia.org/wiki/Shebang_(Unix) +[8]: https://opensource.com/sites/default/files/uploads/meld-output.png (Meld output) +[9]: https://opensource.com/sites/default/files/uploads/meld-3-files.png (Comparing three files in Meld) +[10]: https://opensource.com/resources/what-is-git +[11]: https://opensource.com/sites/default/files/uploads/meld-git.png (Comparing Git files in Meld) +[12]: https://opensource.com/sites/default/files/uploads/meld-directory-changes.png (Meld . output) +[13]: https://opensource.com/sites/default/files/uploads/meld-directory-compare.png (Comparing directories in Meld) +[14]: https://tooling.bennuttall.com/meld/ diff --git a/published/202004/20200325 Linux firewall basics with ufw.md b/published/202004/20200325 Linux firewall basics with ufw.md new file mode 100644 index 0000000000..538d1a928a --- /dev/null +++ b/published/202004/20200325 Linux firewall basics with ufw.md @@ -0,0 +1,213 @@ +[#]: collector: (lujun9972) +[#]: translator: (MjSeven) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12079-1.html) +[#]: subject: (Linux firewall basics with ufw) +[#]: via: (https://www.networkworld.com/article/3533551/linux-firewall-basics-with-ufw.html) +[#]: author: (Sandra Henry-Stocker https://www.networkworld.com/author/Sandra-Henry_Stocker/) + +Linux 防火墙 ufw 简介 +====== + +> 我们来研究下 Linux 上的 ufw(简单防火墙),为你更改防火墙提供一些见解和命令。 + +![][0] + +`ufw`(简单防火墙Uncomplicated FireWall)真正地简化了 [iptables][1],它从出现的这几年,已经成为 Ubuntu 和 Debian 等系统上的默认防火墙。而且 `ufw` 出乎意料的简单,这对新管理员来说是一个福音,否则他们可能需要投入大量时间来学习防火墙管理。 + +`ufw` 也有 GUI 客户端(例如 `gufw`),但是 `ufw` 命令通常在命令行上执行的。本文介绍了一些使用 `ufw` 的命令,并研究了它的工作方式。 + +首先,快速查看 `ufw` 配置的方法是查看其配置文件 —— `/etc/default/ufw`。使用下面的命令可以查看其配置,使用 `grep` 来抑制了空行和注释(以 # 开头的行)的显示。 + +``` +$ grep -v '^#\|^$' /etc/default/ufw +IPV6=yes +DEFAULT_INPUT_POLICY="DROP" +DEFAULT_OUTPUT_POLICY="ACCEPT" +DEFAULT_FORWARD_POLICY="DROP" +DEFAULT_APPLICATION_POLICY="SKIP" +MANAGE_BUILTINS=no +IPT_SYSCTL=/etc/ufw/sysctl.conf +IPT_MODULES="nf_conntrack_ftp nf_nat_ftp nf_conntrack_netbios_ns" +``` + +正如你所看到的,默认策略是丢弃输入但允许输出。允许你接受特定的连接的其它规则是需要单独配置的。 + +`ufw` 命令的基本语法如下所示,但是这个概要并不意味着你只需要输入 `ufw` 就行,而是一个告诉你需要哪些参数的快速提示。 + +``` +ufw [--dry-run] [options] [rule syntax] +``` + +`--dry-run` 选项意味着 `ufw` 不会运行你指定的命令,但会显示给你如果执行后的结果。但是它会显示假如更改后的整个规则集,因此你要做有好多行输出的准备。 + +要检查 `ufw` 的状态,请运行以下命令。注意,即使是这个命令也需要使用 `sudo` 或 root 账户。 + +``` +$ sudo ufw status +Status: active + +To Action From +-- ------ ---- +22 ALLOW 192.168.0.0/24 +9090 ALLOW Anywhere +9090 (v6) ALLOW Anywhere (v6) +``` + +否则,你会看到以下内容: + +``` +$ ufw status +ERROR: You need to be root to run this script +``` + +加上 `verbose` 选项会提供一些其它细节: + +``` +$ sudo ufw status verbose +Status: active +Logging: on (low) +Default: deny (incoming), allow (outgoing), disabled (routed) +New profiles: skip + +To Action From +-- ------ ---- +22 ALLOW IN 192.168.0.0/24 +9090 ALLOW IN Anywhere +9090 (v6) ALLOW IN Anywhere (v6) +``` + +你可以使用以下命令轻松地通过端口号允许和拒绝连接: + +``` +$ sudo ufw allow 80 <== 允许 http 访问 +$ sudo ufw deny 25 <== 拒绝 smtp 访问 +``` + +你可以查看 `/etc/services` 文件来找到端口号和服务名称之间的联系。 + +``` +$ grep 80/ /etc/services +http 80/tcp www # WorldWideWeb HTTP +socks 1080/tcp # socks proxy server +socks 1080/udp +http-alt 8080/tcp webcache # WWW caching service +http-alt 8080/udp +amanda 10080/tcp # amanda backup services +amanda 10080/udp +canna 5680/tcp # cannaserver +``` + +或者,你可以命令中直接使用服务的名称。 + +``` +$ sudo ufw allow http +Rule added +Rule added (v6) +$ sudo ufw allow https +Rule added +Rule added (v6) +``` + +进行更改后,你应该再次检查状态来查看是否生效: + +``` +$ sudo ufw status +Status: active + +To Action From +-- ------ ---- +22 ALLOW 192.168.0.0/24 +9090 ALLOW Anywhere +80/tcp ALLOW Anywhere <== +443/tcp ALLOW Anywhere <== +9090 (v6) ALLOW Anywhere (v6) +80/tcp (v6) ALLOW Anywhere (v6) <== +443/tcp (v6) ALLOW Anywhere (v6) <== +``` + +`ufw` 遵循的规则存储在 `/etc/ufw` 目录中。注意,你需要 root 用户访问权限才能查看这些文件,每个文件都包含大量规则。 + +``` +$ ls -ltr /etc/ufw +total 48 +-rw-r--r-- 1 root root 1391 Aug 15 2017 sysctl.conf +-rw-r----- 1 root root 1004 Aug 17 2017 after.rules +-rw-r----- 1 root root 915 Aug 17 2017 after6.rules +-rw-r----- 1 root root 1130 Jan 5 2018 before.init +-rw-r----- 1 root root 1126 Jan 5 2018 after.init +-rw-r----- 1 root root 2537 Mar 25 2019 before.rules +-rw-r----- 1 root root 6700 Mar 25 2019 before6.rules +drwxr-xr-x 3 root root 4096 Nov 12 08:21 applications.d +-rw-r--r-- 1 root root 313 Mar 18 17:30 ufw.conf +-rw-r----- 1 root root 1711 Mar 19 10:42 user.rules +-rw-r----- 1 root root 1530 Mar 19 10:42 user6.rules +``` + +本文前面所作的更改,为 `http` 访问添加了端口 `80` 和为 `https` 访问添加了端口 `443`,在 `user.rules` 和 `user6.rules` 文件中看起来像这样: + +``` +# grep " 80 " user*.rules +user6.rules:### tuple ### allow tcp 80 ::/0 any ::/0 in +user6.rules:-A ufw6-user-input -p tcp --dport 80 -j ACCEPT +user.rules:### tuple ### allow tcp 80 0.0.0.0/0 any 0.0.0.0/0 in +user.rules:-A ufw-user-input -p tcp --dport 80 -j ACCEPT +You have new mail in /var/mail/root +# grep 443 user*.rules +user6.rules:### tuple ### allow tcp 443 ::/0 any ::/0 in +user6.rules:-A ufw6-user-input -p tcp --dport 443 -j ACCEPT +user.rules:### tuple ### allow tcp 443 0.0.0.0/0 any 0.0.0.0/0 in +user.rules:-A ufw-user-input -p tcp --dport 443 -j ACCEPT +``` + +使用 `ufw`,你还可以使用以下命令轻松地阻止来自一个 IP 地址的连接: + +``` +$ sudo ufw deny from 208.176.0.50 +Rule added +``` + +`status` 命令将显示更改: + +``` +$ sudo ufw status verbose +Status: active +Logging: on (low) +Default: deny (incoming), allow (outgoing), disabled (routed) +New profiles: skip + +To Action From +-- ------ ---- +22 ALLOW IN 192.168.0.0/24 +9090 ALLOW IN Anywhere +80/tcp ALLOW IN Anywhere +443/tcp ALLOW IN Anywhere +Anywhere DENY IN 208.176.0.50 <== new +9090 (v6) ALLOW IN Anywhere (v6) +80/tcp (v6) ALLOW IN Anywhere (v6) +443/tcp (v6) ALLOW IN Anywhere (v6) +``` + +总而言之,`ufw` 不仅容易配置,而且且容易理解。 + +-------------------------------------------------------------------------------- + +via: https://www.networkworld.com/article/3533551/linux-firewall-basics-with-ufw.html + +作者:[Sandra Henry-Stocker][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://www.networkworld.com/author/Sandra-Henry_Stocker/ +[b]: https://github.com/lujun9972 +[0]: https://images.idgesg.net/images/article/2019/06/cso_network_security_encryption_automation_by_vertigo3d_gettyimages-597931354_2400x1600-100798880-large.jpg +[1]: https://www.networkworld.com/article/2716098/working-with-iptables.html +[2]: https://www.networkworld.com/article/3143050/linux/linux-hardening-a-15-step-checklist-for-a-secure-linux-server.html#tk.nww-fsb +[3]: https://www.networkworld.com/blog/itaas-and-the-corporate-storage-technology/?utm_source=IDG&utm_medium=promotions&utm_campaign=HPE22140&utm_content=sidebar (ITAAS and Corporate Storage Strategy) +[4]: https://www.facebook.com/NetworkWorld/ +[5]: https://www.linkedin.com/company/network-world diff --git a/published/202004/20200326 3 open source tools for sticking to a budget.md b/published/202004/20200326 3 open source tools for sticking to a budget.md new file mode 100644 index 0000000000..8504fec779 --- /dev/null +++ b/published/202004/20200326 3 open source tools for sticking to a budget.md @@ -0,0 +1,57 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12072-1.html) +[#]: subject: (3 open source tools for sticking to a budget) +[#]: via: (https://opensource.com/article/20/3/open-source-budget) +[#]: author: (Lauren Pritchett https://opensource.com/users/lauren-pritchett) + +3 个控制预算的开源工具 +====== + +> 在这篇开源预算工具汇总中找到适合你的解决方案。另外学习有关开源的备税务软件。 + +![](https://img.linux.net.cn/data/attachment/album/202004/05/092735ni323vgji9sbigq9.jpg) + +鉴于目前世界上许多国家/地区的经济形势都在变化,你可能会想改造或改善财务状况和你对它的了解。或者,也许你的新年决心之一是开始预算?你并不孤单。 + +坚持该决心的最佳方法是定期跟踪你的支出和收入。问题是,许多流行的个人理财应用都是专有的。你是否正在寻找 Quicken、Mint 或 You Need a Budget 的开源替代方案?无论你是开源软件新手,还是预算新手,这些工具之一都将满足你的需求和舒适度。 + +### LibreOffice Calc + +我向希望做预算的任何开源新手推荐使用 LibreOffice Calc。如果你使用过 Google Sheets 或 Microsoft Excel 等专有电子表格,那么 LibreOffice Calc 模板将非常熟悉。在此[预算教程][2]中,作者 Jess Weichler 已经为你提供了方便、可下载的模板。该模板已经有费用类别,例如水电费、杂货、外出就餐等,但是你可以自由地根据自己的生活方式对其进行自定义。在第二篇文章中,她向你展示了如何[创建自己的模板][3]。 + +### HomeBank + +对于所有的开源用户来说,HomeBank 都是另一个不错的选择。HomeBank 是免费的,但它拥有许多它同类专有软件的分析和交易功能。实际上,你可以将 Quicken 文件导入到 HomeBank 中,这使得转换到它变得轻而易举。最后,你可以使用一种工具来帮助你明智地做出有关资金的决定,而无需花费更多的钱。在 Jessica Cherry 的[教程][4]中学习如何入门。 + +### GnuCash + +就像这里提到的其他预算工具一样,GnuCash 可以在 Windows、macOS 和 Linux 上使用。它提供了大量文档,但 Don Watkins 会在[此教程][5]中指导你在 Linux 上设置 GnuCash。GnuCash 不仅是控制个人财务的绝佳选择,而且还有开发票等功能来帮助你管理小型企业。 + +### 赠品:OpenTaxSolver + +对许多美国人来说,可怕的税收季可能是一个压力很大的时期。许多人购买 TurboTax 或请会计师或税务服务来缴税。与普遍的看法相反,开源的备税务软件是存在的!作者 Jessica Cherry 在[本文][6]中做了研究,并向读者介绍 OpenTaxSolver。要正确使用 OpenTaxSolver,你需要特别注意细节,但是你不必担心进行复杂的数学运算。 + +你会尝试使用哪个开源预算应用?你是否有我在此列表中未提及的最喜欢的工具?请在评论区分享你的观点。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/3/open-source-budget + +作者:[Lauren Pritchett][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/lauren-pritchett +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/osdc_whitehurst_money.png?itok=ls-SOzM0 (A dollar sign in a network) +[2]: https://opensource.com/article/20/3/libreoffice-open-source-budget +[3]: https://opensource.com/article/20/3/libreoffice-templates +[4]: https://opensource.com/article/20/2/open-source-homebank +[5]: https://opensource.com/article/20/2/gnucash +[6]: https://opensource.com/article/20/2/open-source-taxes diff --git a/published/202004/20200327 Build a private chat server with a Raspberry Pi and Rocket.Chat.md b/published/202004/20200327 Build a private chat server with a Raspberry Pi and Rocket.Chat.md new file mode 100644 index 0000000000..25a4581dd7 --- /dev/null +++ b/published/202004/20200327 Build a private chat server with a Raspberry Pi and Rocket.Chat.md @@ -0,0 +1,98 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12116-1.html) +[#]: subject: (Build a private chat server with a Raspberry Pi and Rocket.Chat) +[#]: via: (https://opensource.com/article/20/3/raspberry-pi-rocketchat) +[#]: author: (Giuseppe Cassibba https://opensource.com/users/peppe8o) + +使用树莓派和 Rocket.Chat 构建一个私人聊天服务器 +====== + +> 使用这些简单、经济高效的开源工具构建自己真正的私人聊天和消息解决方案。 + +![](https://img.linux.net.cn/data/attachment/album/202004/16/203055g5r5w7ei8eenw1ex.jpg) + +互联网提供了大量免费的消息服务。像 WhatsApp 和 Viber 这样的应用已经是我们日常生活的一部分,也是我们与亲朋好友沟通的最常见方式。但是,安全意识的提高,让人们对真正的私密聊天解决方案的需求越来越大。此外,消息类应用在我们的设备中占用了大量空间,因此一个备用聊天渠道可能对于我们与朋友分享媒体、信息和联系人很有作用。 + +今天,我们将了解如何使用[树莓派][2]和 Rocket.Chat 安装一个私人聊天和消息服务器。 + +### 什么是 Rocket.Chat? + +[Rocket.Chat][3] 是一个开源解决方案,它提供了一个增强的聊天服务。它包括媒体共享、屏幕共享和视频/音频呼叫支持等协作工具。 + +它可以通过浏览器或从所有主要应用商店(Google Play、App Store 等)下载使用。 + +除了社区版本外,Rocket.Chat 还提供企业版和专业版,包括支持和其他附加功能。 + +### 我们需要什么 + +对于这个项目,我将使用更便宜的树莓派 3A+。树莓派 3B 和 3B+ 以及树莓派 4B 应该也可以用同样的方法。 + +我也建议使用一块高性能 SD 卡,因为 Rocket.Chat 会给树莓派带来很大的负载。如其他文章中所述,高性能 SD 卡可显著提高 Raspbian 操作系统的性能。 + +我们将使用 Raspbian 的精简版本,拥有预配置的 WiFi 访问和 SSH 服务,因此不需要键盘或 HDMI 线缆。 + +### 分步过程 + +从[安装最新版本的 Raspbian Buster Lite][5] 开始。 + +我们将使用 [Snap][6] 简化 Rocket.Chat 安装。通过 SSH 登录并从终端输入: + +``` +sudo apt-get update +sudo apt-get upgrade +``` + +安装 Snap: + +``` +sudo apt-get install snapd +``` + +安装 Snap 后,我们需要重启系统使其正常工作: + +``` +sudo reboot +``` + +再次通过 SSH 登录,并用以下简单的命令安装 Rocket.Chat: + +``` +sudo snap install rocketchat-server +``` + +从终端安装后,请等待一段时间,让 Rocket.Chat 初始化数据库和服务。休息一下,几分钟后,你应该能够在浏览器中访问 `http://<>:3000`,你应该看到以下内容: + +![Rocket Chat setup wizard][7] + +填写所需的表单就可以了。经过四个简单的设置窗口后,你应该会进入 Rocket.Chat 主页: + +![Rocket Chat home page][8] + +享受吧! + +本文最初发表在 [peppe8o.com][9],并获许重新发布。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/3/raspberry-pi-rocketchat + +作者:[Giuseppe Cassibba][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/peppe8o +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/email_chat_communication_message.png?itok=LKjiLnQu (Chat via email) +[2]: https://opensource.com/resources/raspberry-pi +[3]: https://rocket.chat/ +[5]: https://peppe8o.com/2019/07/install-raspbian-buster-lite-in-your-raspberry-pi/ +[6]: https://snapcraft.io/ +[7]: https://opensource.com/sites/default/files/uploads/rocket-chat-setup-wizard.jpg (Rocket Chat setup wizard) +[8]: https://opensource.com/sites/default/files/uploads/rocket-chat-home.jpg (Rocket Chat home page) +[9]: https://peppe8o.com/private-chat-and-messaging-server-with-raspberry-pi-and-rocket-chat/ diff --git a/published/202004/20200329 How to install Microsoft TrueType Fonts on Ubuntu-based Distributions.md b/published/202004/20200329 How to install Microsoft TrueType Fonts on Ubuntu-based Distributions.md new file mode 100644 index 0000000000..2300ffee80 --- /dev/null +++ b/published/202004/20200329 How to install Microsoft TrueType Fonts on Ubuntu-based Distributions.md @@ -0,0 +1,107 @@ +[#]: collector: (lujun9972) +[#]: translator: (robsean) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12074-1.html) +[#]: subject: (How to install Microsoft TrueType Fonts on Ubuntu-based Distributions) +[#]: via: (https://itsfoss.com/install-microsoft-fonts-ubuntu/) +[#]: author: (Dimitrios Savvopoulos https://itsfoss.com/author/itsfoss/) + +如何在基于 Ubuntu 的发行版上安装微软 TrueType 字体 +====== + +如果你在 Linux 上用 LibreOffice 打开一些微软文档,你会发现字体看起来有一点不同。你也将注意到有些常用字体找不到,如 [Times New Roman][1]、Arial 等等。 + +不用担心。我将向你展示如何在 Ubuntu 上和其它基于 Ubuntu 的 Linux 发行版上安装这些字体。但是在此之前,让我告诉你为什么这些字体没有被默认安装。 + +### 为什么微软字体不被默认安装在 Linux 中? + +![][2] + +Times New Roman、Arial 等字体都是微软的,并且这些字体不是开源的。很多 Linux 发行版默认不提供专有软件,以避免授权问题。 + +这就是为什么在默认情况下 Ubuntu 和其它 Linux 发行版使用开源字体 “Liberation” 字体来替代微软字体的原因。[Red Hat][4] 创建 [Liberation 字体][3] 来代替 Arial、Arial Narrow、 Times New Roman 和 Courier New,因为这些字体的宽度一样。当你打开一个使用 Times New Roman 字体书写的文档时,会使用对应的 Liberation 字体来保持文档不被破坏。 + +不过,Liberation 字体与微软的字体并不是完全相同的,在一些情况下,你可能需要使用 Arial 或 Times New Roman。一个非常常见的情况是,在学校、大学和其他公共或私人机构中,微软的字体是唯一的选择。他们要求你使用这些字体之一来提交文档。 + +好在,你可以在 Ubuntu 和其它发行版上很容易地安装微软字体。以这种方式,你将增强 LibreOffice 的兼容性,并可以自由选择开源办公软件。 + +### 在基于 Ubuntu 的 Linux 发行版上安装微软字体 + +你可以自行下载字体,并[在 Ubuntu 中安装新的字体][5]。但是由于微软字体非常受欢迎(并且是免费提供的),所以 Ubuntu 提供了一种简单的方法来安装它们。 + +要知道尽管微软已经免费发布了其核心字体,在其它操作系统中使用该字体依然是受到限制的。在 Ubuntu 中安装微软字体前,你必须阅读并接受 EULA (最终用户许可协议) 。 + +这些字体 [可在 multiverse 存储库中获得,首先要确保启用它][6]: + +``` +sudo add-apt-repository multiverse +``` + +在此之后,你可以更新你的 Ubuntu 存储库缓存,并像这样安装微软字体: + +``` +sudo apt update && sudo apt install ttf-mscorefonts-installer +``` + +当微软的最终用户协议出现时,按 `tab` 键来选择 “OK” ,并按回车键。 + +![按 tab 键来高亮选择][7] + +单击 “Yes” 来接受微软的协议: + +![使用 tab 键来作出选择,并按回车键][8] + +当安装完成后,你应该使用下面的命令来更新字体缓存: + +``` +sudo fc-cache -f -v +``` + +![][9] + +如果你现在打开 LibreOffice ,你将看到微软 [TrueType 字体][10] 。 + +![][11] + +如果意外地拒绝了许可协议,你可以使用这个命令来重新安装安装程序: + +``` +sudo apt install –reinstall ttf-mscorefonts-installer +``` + +微软的 TrueType 字体也可以通过 [Ubuntu Restricted Extras package][12] 获得,其包含用来播放 MP3 等文件的其它专有的多媒体编解码器。 + +> 不要轻视专有字体。 +> +> 你可能认为字体有什么大不了的呢?毕竟,它只是一款字体,而不是软件的一个关键部分,对吧?但是你知道,这些年来 [Netflix 为其使用的专有字体支付了数百万美元][13]吗?最后,他们创建了自己的自定义字体,这为他们节省了一大笔钱。 + +希望这个快速教程有用。更多的生产力教程即将上线,请在下面留下你的评论,了解更多信息请订阅我们的社交媒体! + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/install-microsoft-fonts-ubuntu/ + +作者:[Dimitrios Savvopoulos][a] +选题:[lujun9972][b] +译者:[robsean](https://github.com/robsean) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://itsfoss.com/author/itsfoss/ +[b]: https://github.com/lujun9972 +[1]: https://en.wikipedia.org/wiki/Times_New_Roman +[2]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/03/microsoft-fonts-ubuntu.png?ssl=1 +[3]: https://en.wikipedia.org/wiki/Liberation_fonts +[4]: https://en.wikipedia.org/wiki/Red_Hat +[5]: https://itsfoss.com/install-fonts-ubuntu/ +[6]: https://itsfoss.com/ubuntu-repositories/ +[7]: https://i1.wp.com/i.imgur.com/JoEJp5w.png?ssl=1 +[8]: https://i0.wp.com/i.imgur.com/M8zTc7f.png?ssl=1 +[9]: https://i0.wp.com/i.imgur.com/Cshle6S.png?ssl=1 +[10]: https://en.wikipedia.org/wiki/TrueType +[11]: https://i1.wp.com/i.imgur.com/9oIu3oj.png?ssl=1 +[12]: https://itsfoss.com/install-media-codecs-ubuntu/ +[13]: https://thehustle.co/nextflix-sans-custom-font/ +[14]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/03/Dimitrios.jpg?ssl=1 diff --git a/published/202004/20200329 Oracle Announces Java 14- How to Install it on Ubuntu Linux.md b/published/202004/20200329 Oracle Announces Java 14- How to Install it on Ubuntu Linux.md new file mode 100644 index 0000000000..fc7af79bb5 --- /dev/null +++ b/published/202004/20200329 Oracle Announces Java 14- How to Install it on Ubuntu Linux.md @@ -0,0 +1,80 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12076-1.html) +[#]: subject: (Oracle Announces Java 14! How to Install it on Ubuntu Linux) +[#]: via: (https://itsfoss.com/java-14-ubuntu/) +[#]: author: (Ankush Das https://itsfoss.com/author/ankush/) + +如何在 Ubuntu Linux 上安装 Oracle Java 14 +====== + +![](https://img.linux.net.cn/data/attachment/album/202004/05/205313e188lsbrbgz9932d.jpg) + +最近,Oracle 宣布 Java 14(或 Oracle JDK 14)公开可用。如果你想进行最新的实验或者开发的话,那么你可以试试在 Linux 系统上安装 Java 14。 + +Oracle JDK 14(或简称 Java 14)[发布版][1]包含几个新功能,如果你想预览它们的话。我已添加了链接: + + * [instanceof 的模式匹配][2] + * [Records][3] + * [Text Blocks][4] + +除预览功能外,它还包含一些改进和补充。在新闻中,他们还提到了其他改进: + +> 此外,最新的 Java 版本增加了 Java 语言对 switch 表达式的支持,新增了用于持续监控 JDK Flight Recorder 数据的新 API,将低延迟 zgc 扩展到了 macOS 和 Windows,并添加在 incubator 模块中,独立的 Java 应用打包,以及为了安全、有效地访问 Java 堆外部内存的新的外部内存访问 API。 + +当然,如果你想深入了解细节,那么你应查看[官方公告][1]。 + +在本教程中,我将向你展示在 Ubuntu 系统上安装 Java 14 的简便方法。请继续阅读。 + +**注意:**如果你选择使用 Oracle Java 11 或更高版本,那么应该了解新的 [Oracle 技术网络许可协议][5],以了解它如何影响个人用户、开发人员和商业组织。通常,它们可以免费用于开发和测试,但不能用于生产环境。 + +### 如何在 Ubuntu Linux 上安装 Java 14? + +作为参考,我已成功在默认安装 **OpenJDK 11** 的 **Pop!_OS 19.10** 上成功安装了它。 + +这里,我们将使用 [Linux Uprising][7] 的 Java 14 安装程序(最初基于 WebUpd8 Java 软件包)。 + +只需在终端中输入以下命令即可进行安装: + +``` +sudo add-apt-repository ppa:linuxuprising/java +sudo apt update +sudo apt install oracle-java14-installer +``` + +这应该就完成了,如果你想将它设为默认,那么你可以输入以下命令: + +``` +sudo apt install oracle-java14-set-default +``` + +值得注意的是,这仅适用于基于 Ubuntu 的发行版。如果要在 Debian 和其他 Linux 发行版上安装它,那么也可以按照 [Linux Uprising 中的详细指南][7]安装 Java 14。 + +### 总结 + +当然,这些会带来最新的特性,如果你不想破环原有环境,你或许会希望继续使用 Java 11。如果你想在了解风险的情况下进行试验,请继续尝试! + +欢迎在下面的评论中让我知道你对 Java 14 的想法。 + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/java-14-ubuntu/ + +作者:[Ankush Das][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://itsfoss.com/author/ankush/ +[b]: https://github.com/lujun9972 +[1]: https://www.oracle.com/corporate/pressrelease/oracle-announces-java14-031720.html +[2]: https://openjdk.java.net/jeps/305 +[3]: https://openjdk.java.net/jeps/359 +[4]: https://openjdk.java.net/jeps/368 +[5]: https://www.oracle.com/technetwork/java/javase/overview/oracle-jdk-faqs.html +[6]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/03/install-java-14-ubuntu.png?ssl=1 +[7]: https://www.linuxuprising.com/2020/03/how-to-install-oracle-java-14-jdk14-on.html diff --git a/published/202004/20200329 The Keyring Concept in Ubuntu- What is It and How to Use it.md b/published/202004/20200329 The Keyring Concept in Ubuntu- What is It and How to Use it.md new file mode 100644 index 0000000000..3af840a02c --- /dev/null +++ b/published/202004/20200329 The Keyring Concept in Ubuntu- What is It and How to Use it.md @@ -0,0 +1,182 @@ +[#]: collector: (lujun9972) +[#]: translator: (messon007) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12093-1.html) +[#]: subject: (The Keyring Concept in Ubuntu: What is It and How to Use it?) +[#]: via: (https://itsfoss.com/ubuntu-keyring/) +[#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/) + +解读 Ubuntu 里的密钥环概念 +====== + +![][3] + +如果你用过 Ubuntu 或者其他的 Linux 发行版里的[自动登录功能][1], 你可能遇到过这种弹出消息: + +> 请输入密码以解锁你的登录密钥环 +> +> 登录密钥环在你登录系统时未解锁。 + +![Enter Password To Unlock Your Login Keyring Ubuntu][2] + +如果你一直点击取消,它会不断弹出几次才会消失。你可能想知道,为什么你会一直看到这个密钥环信息呢? + +让我来告诉你吧。它其实不是错误,而是一个安全特性。 + +奇怪吗?下面就让我来解释下 Linux 里的密钥环概念。 + +### Linux 里的密钥环是什么。为什么需要它? + +在现实生活中你为什么要用钥匙环(也叫[钥匙链][4])?你用它把一把或多把钥匙串到一起, 以便于携带和查找。 + +Linux 里也是类似的。密钥环特性使你的系统可以将各种密码放在一起,并将其保存在一个地方。 + +大多数 Linux 桌面环境,如 GNOME、KDE、Xfce 等采用 [GNOME 密钥环][5]来提供这个功能。 + +该密钥环保存了 ssh 密钥、GPG 密钥以及使用此功能的应用程序(例如 Chromium 浏览器)的密钥。默认情况下,**“密钥环”通过主密码来保护**,该密码通常是帐户的登录密码。 + +系统上的每个用户都有自己的密钥环,(通常)密码与用户帐户本身的密码相同。当你使用密码登录系统时,你的密匙环将使用你帐户的密码自动解锁。 + +当你[启用 Ubuntu 中的自动登录功能时][1]时,就有问题了。这意味着你无需输入密码即可登录系统。在这种情况下,你的密钥环不会自动解锁。 + +#### 密钥环是一个安全特性 + +记得我说过密钥环是一个安全特性吗?现在想象一下你在 Linux 电脑上开启了自动登录功能。有权访问你电脑的任何人无需密码就能进入你的系统。但是你可能不会在意,因为你只是用它来访问互联网。 + +但是,如果你在 Ubuntu 中使用 Chromium 或 [Google Chrome][6] 之类的浏览器,并使用它来保存各种网站的登录密码,那么你将遇到麻烦。任何人都可以使用浏览器并利用你在浏览器中保存的密码登录网站。这不很危险吗? + +这就是为什么当你使用 Chrome 时,它将反复地提示你先解锁密钥环。这确保了只有知道密钥环密码(即账户密码)的人才能使用在浏览器中保存的密码来登录它们相关的网站。 + +如果你反复取消解锁密钥环的提示,它最终将消失,并允许你使用浏览器。但是,保存的密码将不会被解锁,你在 Chromium/Chome 浏览器上将会看到“同步暂停”的提示。 + +![Sync paused in Google Chrome][7] + +#### 如果密钥环一直存在,为什么你从来没有见过它呢? + +如果你在你的 Linux 系统上从没见过它的话,这个问题就很有道理。 + +如果你从没有用过自动登录功能(或者修改你的账户密码),你可能都没有意识到这个特性的存在。 + +这是因为当你通过你的密码登录系统时,你的密钥环被你的账户密码自动解锁了。 + +Ubuntu(和其他发行版)在执行普通的管理任务如修改用户、安装新软件等需要输入密码,无论你是否是自动登录的。但是对于日常任务像使用浏览器,它不需要输入密码因为密钥环已经被解锁了。 + +当你切换到自动登录时,你不再需要输入登录密码。这意味着密钥环没有被自动解锁,因此当你使用利用了密钥环特性的浏览器时,它将提示你来解锁密钥环。 + +#### 你可以轻松地管理密钥环和密码 + +这个密钥环放在哪里?它的核心是一个守护任务(一个后台自动运行的程序)。 + +别担心。你不必通过终端来操作守护任务。大多数桌面环境都自带一个可以和这个守护进程进行交互的图形化应用程序。KDE 上有 KDE 钱包,GNOME 和其他桌面上叫做“密码和密钥”(之前叫 [Seahorse][8])。 + +![Password And Keys App in Ubuntu][9] + +你可以用这个 GUI 程序来查看哪些应用程序在用密钥环来管理/保护密码。 + +你可以看到,我的系统有自动创建的登录密钥环。也有一个存储 GPG 和 SSH 密钥的密钥环。那个[证书][10]用来保存证书机构颁发的证书(如 HTTPS 证书)。 + +![Password and Keys application in Ubuntu][11] + +你也可以使用这个应用程序来手动保存网站的密码。例如,我创建了一个新的叫做“Test”的被密码保护的密钥环,并手动存储了一个密码。 + +这比在一个文本文件中保存一批密码要好一些。至少在这种情况下,你的密码只有在你通过密码解锁了密钥环时才允许被看到。 + +![Saving New Password Seahorse][12] + +这里有一个潜在的问题,如果你格式化你的系统,手动保存的密码必然会丢失。通常,你会备份你的个人文件,但并不是所有的用户特定数据,如密钥环文件。 + +有一种办法能解决它。密钥环数据通常保存在 `~/.local/share/keyrings` 目录。在这里你可以看到所有的密钥环,但是你不能直接看到它们的内容。如果你移除密钥环的密码(我会在这篇文章的后面描述操作步骤),你可以像一个普通的文本文件一样读取密钥环的内容。你可以将这个解锁后的密钥环文件完整地复制下来,并在其他的 Linux 机器上运行“密码和密钥”应用程序导入到其中。 + +总结一下目前为止所学的内容: + + * 大多数 Linux 系统缺省已经安装并激活了密钥环特性 + * 系统上的每个用户都拥有他自己的密钥环 + * 密钥环通常是用账户密码锁定的(保护) + * 当你通过密码登录时密钥环会被自动解锁 + * 对于自动登录,密钥环不会自动解锁,因此当你试图使用依赖密钥环的应用程序时会被提示先解锁它 + * 并不是所有的浏览器或应用程序利用了密钥环特性 + * (Linux 上)安装一个 GUI 程序可以和密钥环交互 + * 你可以用密钥环来手动存储加密格式的密码 + * 你可以自己修改密钥环密码 + * 你可以通过导出(需要先解锁密钥环)并导入到其他计算机上的方式来获取手工保存的密码。 + +### 修改密钥环密码 + +假设你修改了你的账户密码。当你登录时,你的系统试图通过新的登录密码来自动解锁密钥环。但是密钥环还在使用老的登录密码。 + +这种情况下,你可以修改密钥环密码为新的登录密码,这样密码环才能在你登录系统时自动解锁。 + +从菜单中打开“密码和密钥”应用程序: + +![Look for Password and Keys app in the menu][9] + +在“Login”密钥环上右击并点击“修改密码”: + +![Change Keyring Password][13] + +#### 如果你不记得老的登录密码怎么办? + +你可能知道在 [Ubuntu 上重置忘记的密码很容易][14]。但是密钥环在这种场景下还是有问题。你修改了账户密码,但是你不记得仍然被密钥环使用的老的账户密码。 + +你不能修改它因为你不知道老的密码。怎么办? + +这种情况下,你将不得不移除整个密钥环。你可以通过“密码和密钥”应用程序来操作: + +![Delete Keyring Ubuntu][15] + +它会提示你进行确认: + +![Delete Keyring][16] + +另外,你也可以手动删除 `~/.local/share/keyrings` 目录下的密钥环文件。 + +老的密钥环文件被移除后,你再打开 Chrome/Chromium 时,它会提示你创建一个新的密钥环。 + +![New Keyring Password][17] + +你可以用新的登录密码,密钥环就会被自动解锁了。 + +### 禁用密钥环密码 + +在你想用自动登录但又不想手动解锁密钥环时,你可以把禁用密钥环密码作为一个规避方法。记住你正在禁用一个安全特性,因此请三思。 + +操作步骤和修改密钥环相似。打开“密码和密钥”应用程序,然后修改密钥环密码。 + +技巧在于当它提示修改密码时,不要输入新密码,而是点击“继续”按钮。这将移除密钥环的密码。 + +![Disable Keyring password by not setting any password at all][18] + +这种方法,密钥环没有密码保护,并将一直处于解锁状态。 + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/ubuntu-keyring/ + +作者:[Abhishek Prakash][a] +选题:[lujun9972][b] +译者:[messon007](https://github.com/messon007) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://itsfoss.com/author/abhishek/ +[b]: https://github.com/lujun9972 +[1]: https://itsfoss.com/ubuntu-automatic-logon/ +[2]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/03/enter-password-to-unlock-your-login-keyring-ubuntu.jpg?ssl=1 +[3]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/03/keyring-concept-ubuntu-1.png?ssl=1 +[4]: https://en.wikipedia.org/wiki/Keychain +[5]: https://wiki.archlinux.org/index.php/GNOME/Keyring +[6]: https://itsfoss.com/install-chrome-ubuntu/ +[7]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/03/sync-paused-keyring-ubuntu.jpg?ssl=1 +[8]: https://wiki.debian.org/Seahorse +[9]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/03/password-and-keys-app-ubuntu.jpg?ssl=1 +[10]: https://help.ubuntu.com/lts/serverguide/certificates-and-security.html +[11]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/03/keyring-pasword-ubuntu.png?ssl=1 +[12]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/03/saving-new-password-seahorse.png?ssl=1 +[13]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/03/change-keyring-password.png?ssl=1 +[14]: https://itsfoss.com/how-to-hack-ubuntu-password/ +[15]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/03/delete-keyring-ubuntu.jpg?ssl=1 +[16]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/03/delete-keyring.jpg?ssl=1 +[17]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/03/new-keyring-password.jpg?ssl=1 +[18]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/03/disable-keyring-password-ubuntu.png?ssl=1 diff --git a/published/202004/20200329 Turn Your Regular TV into a Smart TV With KDE Plasma Bigscreen.md b/published/202004/20200329 Turn Your Regular TV into a Smart TV With KDE Plasma Bigscreen.md new file mode 100644 index 0000000000..fd51a345f3 --- /dev/null +++ b/published/202004/20200329 Turn Your Regular TV into a Smart TV With KDE Plasma Bigscreen.md @@ -0,0 +1,96 @@ +[#]: collector: (lujun9972) +[#]: translator: (wxy) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12063-1.html) +[#]: subject: (Turn Your Regular TV into a Smart TV With KDE Plasma Bigscreen) +[#]: via: (https://itsfoss.com/kde-plasma-bigscreen/) +[#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/) + +用 KDE “等离子大屏幕”把你的普通电视变成智能电视 +====== + +> KDE 即将推出的“等离子大屏幕”项目可让你使用开源技术将普通电视变成智能电视。 + +如今,智能电视已成为新的常态。这些智能电视主要基于 Android,可让你播放 YouTube、Netflix、Spotify 和其他流媒体服务。你甚至可以使用语音命令来控制你的智能电视。 + +这些所谓的“智能电视”的一个主要问题是它们可能正在[监视你][1]。你的数据在你或许知道或许不知道的情况下被收集。 + +这就是 KDE 的“[等离子大屏幕项目][2]”旨在解决的问题。(LCTT 译注: 等离子Plasma恰是 KDE 桌面环境的名称,和大屏幕Bigscreen很搭,因此这个惯常不翻译的名称这里翻译出来。) + +### “等离子大屏幕”:通过开源技术使电视更智能 + +![][3] + +你可能了解 [KDE][4] 项目。它开始是一个 Linux 桌面环境项目,而在发展了 20 多年后,KDE 项目变得越来越大,这就是为什么他们创建了 Plasma 桌面环境的原因,以明确表明 KDE 不再仅仅是“K 桌面环境K Desktop Environment(KDE)”了。 + +Plasma 项目本身具有多种用途,当然,你可以在台式机 Linux 计算机上使用它,而 [Plasma 也具有移动版本][5],你可以在基于 Linux 的智能手机上运行它,例如 [Librem5][6] 和 [PinePhone][7]。 + +“等离子大屏幕Plasma Bigscreen”是 KDE 的一个新项目,旨在提供类似于智能电视所提供的界面和功能。 + +你需要的是一台[树莓派之类的单板计算机][8]和一台带 HDMI 端口的电视,然后在你的树莓派设备上安装“等离子大屏幕”,将其连接到电视就行。 + +### “等离子大屏幕”的功能:不仅仅是媒体服务器 + +![YouTube In Plasma Bigscreen][9] + +乍一看,它看起来很像是一个媒体服务器,但“等离子大屏幕”却和 Kodi 及其它 [Linux 媒体服务器][10] 不同,它不止于此。 + +#### 使用常规遥控器进行控制 + +你不需要新的专用遥控器。多亏了 [CEC][11],你可以使用常规的电视遥控器。 + +#### 带有开源 Mycroft AI 的语音控制 + +“等离子大屏幕”利用了开源 Mycroft AI 项目。借助“等离子大屏幕”内置的 Mycroft AI,你可以使用语音命令播放内容、检查天气并控制智能电视的其他方面。你可以通过教它新技能来进一步训练它。 + +#### 传统的桌面应用程序 + +“等离子大屏幕”不仅提供丰富的媒体应用程序,还提供经过重新设计,适合它的体验的传统桌面应用程序。 + +#### 自由开源软件 + +最重要的是它是一个开源项目,它使用其他开源技术为你提供对数据和智能电视的完全控制。 + +由于它是开源的,我相信一旦发布,就会有一些供应商将其作为即插即用设备提供。 + +### 如何获取“等离子大屏幕”? + +“等离子大屏幕”仍处于测试阶段,没有确定稳定版发布的时间表。 + +但是,测试版已经可以在树莓派 4 等设备上正常运行。下面是一个从事此项目的开发人员的视频。 + +- [video](https://youtu.be/iOxMuexAPaQ) + +如果你有树莓派 4,则可以从其官方下载页面上下载“[等离子大屏幕][13]”的测试版,然后按照[此处][14]的步骤进行安装。 + +就个人而言,我对此感到非常兴奋。我要花一些时间在[树莓派 4][15]上尝试一下。你呢?你认为该项目具有潜力吗?你想试试看吗? + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/kde-plasma-bigscreen/ + +作者:[Abhishek Prakash][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://itsfoss.com/author/abhishek/ +[b]: https://github.com/lujun9972 +[1]: https://www.zdnet.com/article/fbi-warns-about-snoopy-smart-tvs-spying-on-you/ +[2]: https://plasma-bigscreen.org/ +[3]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/03/plasma-bigscreen-menu.jpg?ssl=1 +[4]: https://kde.org/ +[5]: https://itsfoss.com/kde-announces-plasma-mobile/ +[6]: https://itsfoss.com/librem-linux-phone/ +[7]: https://itsfoss.com/pinephone/ +[8]: https://itsfoss.com/raspberry-pi-alternatives/ +[9]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/03/youtube-in-plasma-bigscreen.jpg?ssl=1 +[10]: https://itsfoss.com/best-linux-media-server/ +[11]: http://libcec.pulse-eight.com/ +[12]: https://www.youtube.com/c/itsfoss?sub_confirmation=1 +[13]: https://plasma-bigscreen.org/#download-jumpto +[14]: https://plasma-bigscreen.org/manual/ +[15]: https://itsfoss.com/raspberry-pi-4/ diff --git a/published/202004/20200330 Using data from spreadsheets in Fedora with Python.md b/published/202004/20200330 Using data from spreadsheets in Fedora with Python.md new file mode 100644 index 0000000000..9cff11bd8f --- /dev/null +++ b/published/202004/20200330 Using data from spreadsheets in Fedora with Python.md @@ -0,0 +1,115 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12099-1.html) +[#]: subject: (Using data from spreadsheets in Fedora with Python) +[#]: via: (https://fedoramagazine.org/using-data-from-spreadsheets-in-fedora-with-python/) +[#]: author: (Paul W. Frields https://fedoramagazine.org/author/pfrields/) + +使用 Python 读取电子表格中的数据 +====== + +![][1] + +[Python][2] 是最流行、功能最强大的编程语言之一。由于它是自由开源的,因此每个人都可以使用。大多数 Fedora 系统都已安装了该语言。Python 可用于多种任务,其中包括处理逗号分隔值(CSV)数据。CSV文件一开始往往是以表格或电子表格的形式出现。本文介绍了如何在 Python 3 中处理 CSV 数据。 + +CSV 数据正如其名。CSV 文件按行放置数据,数值之间用逗号分隔。每行由相同的*字段*定义。简短的 CSV 文件通常易于阅读和理解。但是较长的数据文件或具有更多字段的数据文件可能很难用肉眼解析,因此在这种情况下计算机做得更好。 + +这是一个简单的示例,其中的字段是 `Name`、`Email` 和 `Country`。在此例中,CSV 数据将字段定义作为第一行,尽管并非总是如此。 + +``` +Name,Email,Country +John Q. Smith,jqsmith@example.com,USA +Petr Novak,pnovak@example.com,CZ +Bernard Jones,bjones@example.com,UK +``` + +### 从电子表格读取 CSV + +Python 包含了一个 `csv` 模块,它可读取和写入 CSV 数据。大多数电子表格应用,无论是原生(例如 Excel 或 Numbers)还是基于 Web 的(例如 Google Sheet),都可以导出 CSV 数据。实际上,许多其他可发布表格报告的服务也可以导出为 CSV(例如,PayPal)。 + +Python `csv` 模块有一个名为 `DictReader` 的内置读取器方法,它可以将每个数据行作为有序字典 (`OrderedDict`) 处理。它需要一个文件对象访问 CSV 数据。因此,如果上面的文件在当前目录中为 `example.csv`,那么以下代码段是获取此数据的一种方法: + +``` +f = open('example.csv', 'r') +from csv import DictReader +d = DictReader(f) +data = [] +for row in d: + data.append(row) +``` + +现在,内存中的 `data` 对象是 `OrderedDict` 对象的列表: + +``` +[OrderedDict([('Name', 'John Q. Smith'), + ('Email', 'jqsmith@example.com'), + ('Country', 'USA')]), + OrderedDict([('Name', 'Petr Novak'), + ('Email', 'pnovak@example.com'), + ('Country', 'CZ')]), + OrderedDict([('Name', 'Bernard Jones'), + ('Email', 'bjones@example.com'), + ('Country', 'UK')])] +``` + +引用这些对象很容易: + +``` +>>> print(data[0]['Country']) +USA +>>> print(data[2]['Email']) +bjones@example.com +``` + +顺便说一句,如果你需要处理没有字段名标题行的 CSV 文件,那么 `DictReader` 类可以让你定义它们。在上面的示例中,添加 `fieldnames` 参数并传递一系列名称: + +``` +d = DictReader(f, fieldnames=['Name', 'Email', 'Country']) +``` + +### 真实例子 + +我最近想从一长串人员名单中随机选择一个中奖者。我从电子表格中提取的 CSV 数据是一个简单的名字和邮件地址列表。 + +幸运的是,Python 有一个有用的 `random` 模块,可以很好地生成随机值。该模块 `Random` 类中的 `randrange` 函数正是我需要的。你可以给它一个常规的数字范围(例如整数),以及它们之间的步长值。然后,该函数会生成一个随机结果,这意味着我可以在数据的总行数范围内获得一个随机整数(或者说是行号)。 + +这个小程序运行良好: + +``` +from csv import DictReader +from random import Random + +d = DictReader(open('mydata.csv')) +data = [] +for row in d: + data.append(row) + +r = Random() +winner = data[r.randrange(0, len(data), 1)] +print('The winner is:', winner['Name']) +print('Email address:', winner['Email']) +``` + +显然,这个例子非常简单。电子表格本身包含了复杂的分析数据的方法。但是,如果你想在电子表格应用之外做某事,Python 或许是一种技巧! + +题图由 [Isaac Smith][3] 拍摄,发表于 [U​​nsplash][4]。 + +-------------------------------------------------------------------------------- + +via: https://fedoramagazine.org/using-data-from-spreadsheets-in-fedora-with-python/ + +作者:[Paul W. Frields][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://fedoramagazine.org/author/pfrields/ +[b]: https://github.com/lujun9972 +[1]: https://fedoramagazine.org/wp-content/uploads/2020/03/spreadsheets-python-816x345.jpg +[2]: https://python.org +[3]: https://unsplash.com/@isaacmsmith?utm_source=unsplash&utm_medium=referral&utm_content=creditCopyText +[4]: https://unsplash.com/s/photos/spreadsheets?utm_source=unsplash&utm_medium=referral&utm_content=creditCopyText diff --git a/published/202004/20200331 5 ways to level up your Vim skills.md b/published/202004/20200331 5 ways to level up your Vim skills.md new file mode 100644 index 0000000000..487f0247ba --- /dev/null +++ b/published/202004/20200331 5 ways to level up your Vim skills.md @@ -0,0 +1,156 @@ +[#]: collector: (lujun9972) +[#]: translator: (wxy) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12077-1.html) +[#]: subject: (5 ways to level up your Vim skills) +[#]: via: (https://opensource.com/article/20/3/vim-skills) +[#]: author: (Detlef Johnson https://opensource.com/users/deckart) + +提升你的 Vim 技能的 5 个方法 +====== + +> 通过一些有趣的小技巧使你的文本编辑器更上一层楼。 + +![](https://img.linux.net.cn/data/attachment/album/202004/05/232434x1hnzlnhcnm3nrc7.jpg) + +Vim 是最受欢迎的文本编辑器之一,因此绝对值得你花时间去学习如何使用它。就算你只是学习使用这个无处不在的 [Vi(m)][2] 命令行文本编辑器打开文件、输入和编辑一些文本、保存编辑的文件并退出程序,你都会受益匪浅。 + +你会发现,使用 Vim 非常方便的的场景几乎总是涉及到运行远程 Shell 操作的任务。如果你时不时地使用 ssh,比如 + +``` +$ ssh user@hostname.provider.com +``` + +并在虚拟专用服务器(VPS)或本地虚拟化容器中工作,那么就可以从这些强大的 Vim 技能中受益匪浅。 + +### 将 Vim 设置为默认的文本编辑器 + +几乎所有的现代 Linux(或 BSD)发行版中,都可以在终端仿真器的 shell 命令提示符下使用 Vim。一旦在你的用户 shell 程序中将 Vim 定义为默认编辑器后,那么就可以使用熟悉的 Vim 键绑定来在内置的实用程序(例如 `man`)中导航。我将说明如何使用 Bash 和 Z shell(zsh)来实现此目的,zsh 现在是 macOS 用户的默认 shell(自 Catalina 起)。 + +#### 在 Bash 中将 Vim 设置为默认 + +Bash 通过点文件的组合来管理设置。最常见的的做法将你的编辑器添加到主目录中的 `.bashrc` 文件中,但也可以将其添加到 `.bash_profile` 中。(请阅读 [GNU Bash 文档][3]了解两者的不同之处)。 + +通过在 `~/.bashrc` 中添加以下内容,将 Vim 设置为默认编辑器: + +``` +# set default editor to Vim +export EDITOR=vim +``` + +以 `#` 开头的行是可选的注释,这是一个好方法,可以提醒自己该命令的作用。 + +#### 在 zsh 中将 Vim 设置为默认 + +zsh 是一种越来越流行的终端仿真器,尤其是在苹果公司的基于 FreeBSD 的 Darwin 系统最近从 Bash 转向 zsh 以来。 + +zsh 点文件与 Bash 的文件相当,因此你可以在 `~/.zshrc` 或 `~/.zprofile` 之间进行选择。有关何时使用哪一个的详细信息,请参见 [zsh文档][4]。 + +将其设置为默认: + +``` +# set default editor to Vim +export EDITOR=vim +``` + +### 优化 Vim 配置 + +Vim 像是终端仿真器 shell 一样,也使用点文件来设置个人偏好。如果你发现了这种模式,则可能已经猜到它是 `~/.vimrc`。 + +你可能要更改的第一个设置是将对传统的 Vi 兼容模式切换为“关闭”。由于 Vim 是 Vi 的超集,因此 Vi 中的所有功能在 Vim 中都是可用的,并且在 Vim 中得到了很大的改进,你可以获得许多高级功能。最新版本(8.2)允许你在分割的窗口中以子进程 shell 的方式打开一个终端。 + +顺便说一句,明确关闭对传统的 Vi 的兼容性看起来没有什么作用([事实上,可能并没有什么作用][5])。当 Vim 遇到 `.vimrc` 文件时,它会暗暗地自动将兼容模式切换到关闭。但有时将其明确关闭仍然很重要。缩写 `nocp` 是 `nocompatible` 的同义词,作用是一样的。[条条大道通罗马][6],切换首选项有很多方式。 + +在 `.vimrc` 语法中, 以 `"` 开头的行是注释(就像 `.bashrc` 文件中的 `#` 一样),这些注释可以帮助你记住诸如为何选择了一个隐晦的设置名称之类的内容。 + +要关闭 Vi 兼容性,请将以下内容添加到 `~/.vimrc` 文件中: + +``` +" ensure that legacy compatibility mode is off +" documentation: ' +set nocp +``` + +### 理解模式 + +Vim 的 “模式”概念是非常重要的,尤其是“普通模式”和“插入模式”之间的区别。对模式的混淆是大多数新用户的困扰。模式并不是 Vim 所独有的,甚至也不是 Vi 所引入的。命令模式是如此的古老,以至于它比 70 年代发明的[复制和粘贴][7]功能还要早。 + +#### 重要的模式 + +Vim 依赖于不同的模式来定义键盘的敲击行为。需要了解的重要模式有: + +* 普通模式:默认模式,主要用于导航和打开文件。 +* 插入模式(包括替换):这种模式下 Vim 允许将文本输入到打开的文件中。 +* 可视模式:Vim 的行为类似于基于鼠标的输入方式,如复制、编辑、替换等。 +* 命令模式(包括行模式、Ex 命令模式和末行模式):是在 Vim 中做更多事情的强大方法。 + +每种模式都有很多值得探索的地方。使用 [Vimtutor][8](`vimtutor`)可以交互式地学习移动光标、模式和在末行模式下运行 Ex 命令。一些不可缺少的生产力操作符包括: + +操作符 | 说明 +--- | --- +`:E` | 打开资源管理器,用于定位文件和目录。 +`.` | 重复上次的编辑操作。 +`;` | 向前重复上一次的动作或移动 +`,` | 向后重复上一次的动作或移动。 +`/` | 向前搜索文档。 +`?` | 向后搜索文档。 +`*` | 查找光标所在处的单词的下一个出现的地方。 +`#` | 查找光标所在处的单词的上一次出现的地方。 +`~` | 切换大小写。 +`%` | 在 `()`、`[]` 和 `{}` 的开闭符号之间切换;对编码非常有用。 +`z=` | 提出拼写建议。 + +### 像钢琴一样弹奏 Vim + +尽管把 Vim 的操作符“语言”记在记忆中是很重要的,但要想掌握它,难点在于学会像音乐家一样思考,把操作符和动作组合成“和弦”,这样你就可以像弹钢琴一样弹奏 Vim。这就是 Vim 的文本操作能力可以与另一个著名的命令行编辑器 Emacs 相媲美的地方。(虽然其中一个编辑器会让磨损掉你的 `Esc` 键,而另一个编辑器会让你的 `Ctrl` 键磨损掉。) + +在描述键“和弦”时,Vim 中的传统做法是用大写字母 C 后面加上一个连字符(`C-`)来指代 `Ctrl` 键。这并不是通用的,但我将从这里开始遵循这一惯例,并在有可能引起混淆的时候加以说明。 + +如果你在 Vim 中键入长行,你会想把它设置成可以换行。想要根据你的工作方式对 Vim 进行个性化设置,请考虑一下这个设置:默认情况下,你希望 Vim 启动时如何处理文本换行?开还是关?我喜欢将其关闭,并将其留在运行命令文件之外。当我想让文本自动换行时,我只需在命令行模式下用 `:set wrap` 设置即可。 + +让 Vim 设置为默认情况下自动换行并没有错,这只是一个偏好问题 —— 它可能随着时间的推移而改变。同样你也可以控制粘贴、代码语言缩进语法和 `Tab` 键的设置(制表符还是空格?多少个空格?可也在[这里][9]深入研究这些选项)。所有这些默认行为的选项都是完全可配置和可更改的,并且在你使用命令行模式操作时可以实时更改。 + +你会在社区论坛、Vim 维基和文章(比如这篇文章)中找到很多关于设置 Vim 默认设置的建议。你应该很熟悉为你的个人计算环境设置首选项,Vim 也不例外。我强烈建议你从对设置进行很小的更改开始,慢慢地进行其它更改,以便你可以轻松地恢复设置。这样一来,你就可以好多年避免使用插件或完全不用插件。 + +### Vim 8.2 中的分割、标签和终端 + +有两种方法可以将你正在处理的文件分割成不同的视图:它们可以并排显示,也可以使用应用程序标签页在全屏(窗口)中切换。这些对应用程序窗口的更改是从命令模式启动的,这需要使用冒号(`:`)来调起提示符。 + +每个分割的窗口可以容纳一个文件进行编辑,你可以通过标签页在更多的文件之间随意切换。分割的屏幕空间有限,所以当你想分割更多的屏幕时,标签页是很方便的。想要如何设置,纯属个人喜好的问题。要水平分割一个窗口,使用 `:sp`,垂直分割时使用 `:vs`。 + +从 [Vim 8.2][10] 开始,你可以用 `:vert term` 打开一个垂直分割的终端 shell 子进程,以在你的代码旁边的命令行上进行操作。你需要键入 `exit` 来关闭你的终端进程,就像你结束一个 shell 会话一样,但你关闭这个分割的窗口和标签页的方式和关闭任何普通的 Vim 窗口一样,要用 `:q` 来关闭。 + +要初始化一个标签页,请使用一个特殊的编辑命令:`:tabedit`,它会自动切换到新打开的标签页。如果你给该命令一个文件名作为参数,会打开该文件并进行编辑。如果你忽略了给它一个文件名作为参数,可以在命令行模式下的使用编辑命令 `:e filename.txt`,就像在任何一个普通的 Vim 窗口中一样。可以使用下一个(`:tabn`)和上一个(`:tabp`)命令在标签页间导航。 + +要使用分割,你需要知道如何使用组合键 `C-w` 和你想要移动的方向的移动键,例如左(`h`)、下(`j`)、左(`k`)、右(`l`)。如果你想学习更多的组合键,请阅读 Vim 手册中的 `:help split` 和 `:help tabpage`。 + +### 获取帮助 + +虽然可以在 Vimtutor 中打开参考 Vim 手册,但用 `:help` 打开 Vim 帮助,可以让你自己把时间花在编辑器上,不用完全依赖像这样的文章,就能获得更多的成果。经验是掌握 Vim 的关键。经验有助于提高你的整体计算直觉,因为 Vim 中的很多东西都是从 Unix 宇宙中汲取的。 + +祝你在探索 Vim 之美的过程中玩得开心,有什么问题可以在评论中分享。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/3/vim-skills + +作者:[Detlef Johnson][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/deckart +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/keyboaord_enter_writing_documentation.jpg?itok=kKrnXc5h (Computer keyboard typing) +[2]: https://www.vim.org/ +[3]: https://www.gnu.org/software/bash/manual/html_node/Bash-Startup-Files.html +[4]: http://zsh.sourceforge.net/Intro/intro_3.html +[5]: http://vimdoc.sourceforge.net/htmldoc/starting.html#compatible-default +[6]: https://en.wikipedia.org/wiki/There%27s_more_than_one_way_to_do_it +[7]: https://www.npr.org/2020/02/22/808404858/remembering-the-pioneer-behind-your-computers-cut-copy-and-paste-functions +[8]: http://www2.geog.ucl.ac.uk/~plewis/teaching/unix/vimtutor +[9]: https://opensource.com/article/18/9/vi-editor-productivity-powerhouse +[10]: https://www.vim.org/vim-8.2-released.php diff --git a/published/202004/20200401 How to Find Which Graphics Card do You Have in Linux.md b/published/202004/20200401 How to Find Which Graphics Card do You Have in Linux.md new file mode 100644 index 0000000000..6ad35a9367 --- /dev/null +++ b/published/202004/20200401 How to Find Which Graphics Card do You Have in Linux.md @@ -0,0 +1,102 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12086-1.html) +[#]: subject: (How to Find Which Graphics Card do You Have in Linux?) +[#]: via: (https://itsfoss.com/check-graphics-card-linux/) +[#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/) + +如何知道你的 Linux 用的哪种显卡? +====== + +无论是 [Nvidia][1] 还是 [Radeon][2] 或者 Intel,它们的显卡都可能在 Linux 中有问题。当你要对图形问题进行故障排除时,首先要了解系统中装有哪种显卡。 + +Linux 有几个命令可以检查硬件信息。你可以使用它们来检查你有哪些显卡(也称为视频卡)。让我向你展示一些命令来获取 Linux 中的 GPU 信息。 + +### 在 Linux 命令行中检查显卡详细信息 + +![][3] + +#### 使用 lspci 命令查找显卡 + +`lspci` 命令显示通过 [PCI][4](外设组件互连Peripheral Component Interconnect)总线连接的设备的信息。基本上,此命令提供有关系统从键盘和鼠标到声卡、网卡和显卡的所有外设的详细信息。 + +默认情况下,你会有大量的此类外设列表。这就是为什么你需要用 `grep` 命令过滤出显卡的原因: + +``` +lspci | grep VGA +``` + +这应该会显示一行有关你显卡的信息: + +``` +abhishek@itsfoss:~$ lspci | grep VGA +00:02.0 VGA compatible controller: Intel Corporation HD Graphics 620 (rev 02) +``` + +如你所见,我的系统中有 Intel HD 620 显卡。 + +#### 在 Linux 中使用 lshw 命令获取显卡详细信息 + +`lspci` 命令足以查看你的显卡,但是并不能告诉你很多信息。你可以使用 `lshw` 命令获取有关它的更多信息。 + +此命令要求你有 root 用户权限。你需要以这种方式查找视频卡(显卡)信息: + +``` +sudo lshw -C video +``` + +正如你在下面的输出中看到的那样,此命令提供了有关显卡的更多信息,例如时钟频率、位宽、驱动等。 + +``` +abhishek@itsfoss:~$ sudo lshw -C video +[sudo] password for abhishek: + *-display + description: VGA compatible controller + product: HD Graphics 620 + vendor: Intel Corporation + physical id: 2 + bus info: [email protected]:00:02.0 + version: 02 + width: 64 bits + clock: 33MHz + capabilities: pciexpress msi pm vga_controller bus_master cap_list rom + configuration: driver=i915 latency=0 + resources: irq:139 memory:db000000-dbffffff memory:90000000-9fffffff ioport:f000(size=64) memory:c0000-dffff +``` + +#### 附赠技巧:以图形方式检查显卡详细信息 + +并非必须使用命令行在 Linux 中查找显卡详细信息。大多数 Linux 发行版(或者应该说是桌面环境)在设置中提供了必要的详细信息。 + +例如,如果你使用的是 [GNOME 桌面环境][5],那么可以进入“设置”的“关于”部分来检查详细信息。[Ubuntu 20.04][6] 中看上去像这样: + +![Graphics card information check graphically][7] + +我希望这个快速技巧对你有所帮助。你也可以使用相同的命令来[查找网卡][8]和 [Linux 中的 CPU 信息][9]。 + +如果你有任何疑问或建议,请随时发表评论。 + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/check-graphics-card-linux/ + +作者:[Abhishek Prakash][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://itsfoss.com/author/abhishek/ +[b]: https://github.com/lujun9972 +[1]: https://www.nvidia.com/en-us/ +[2]: https://www.amd.com/en/graphics/radeon-rx-graphics +[3]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/03/check-gpu-info-linux.jpg?ssl=1 +[4]: https://en.wikipedia.org/wiki/Conventional_PCI +[5]: https://www.gnome.org/ +[6]: https://itsfoss.com/ubuntu-20-04-release-features/ +[7]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/03/ubuntu-gpu-check.jpg?ssl=1 +[8]: https://itsfoss.com/find-network-adapter-ubuntu-linux/ +[9]: https://linuxhandbook.com/check-cpu-info-linux/ diff --git a/published/202004/20200401 IEEE Standards Association Launches an Open Source Collaboration Platform.md b/published/202004/20200401 IEEE Standards Association Launches an Open Source Collaboration Platform.md new file mode 100644 index 0000000000..891edf7bdb --- /dev/null +++ b/published/202004/20200401 IEEE Standards Association Launches an Open Source Collaboration Platform.md @@ -0,0 +1,93 @@ +[#]: collector: (lujun9972) +[#]: translator: (wxy) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12096-1.html) +[#]: subject: (IEEE Standards Association Launches an Open Source Collaboration Platform) +[#]: via: (https://itsfoss.com/ieee-open-source-collaboration-platform/) +[#]: author: (Ankush Das https://itsfoss.com/author/ankush/) + +IEEE 标准协会推出开源协作平台 +====== + +> IEEE 标准协会宣布了一个基于 GitLab 的开源协作平台。 + +![](https://img.linux.net.cn/data/attachment/album/202004/10/222910vjpiqd6lqqm6riqp.jpg) + +[IEEE][1] 是世界上最大的技术专业组织,致力于推动技术的发展。IEEE 标准协会the IEEE Standards Association(IEEE SA)是 IEEE 内部的一个组织,负责制定全球各行业的标准。 + +IEEE 标准协会(SA)提出了一个开源协作平台,即 [IEEE SA Open][2]。 + +技术上来说,它是一个自托管的 GitLab 实例,结合了 [Mattermost][3](一个 [Slack 的替代品][4])和 [GitLab Pages][5]。[其官方博文][6]对此进一步解释道: + +> 该平台使独立软件开发者、初创企业、业界、学术机构等能够在一个协作、安全、负责任的环境中创建、测试、管理和部署创新项目。 + +### 它有什么不同或有用的地方? + +这个平台最主要的吸引力应该是 IEEE 的会员网络、技术专长和资源。 + +IEEE 主席 [Robert Fish][7],也曾(在接受 Radio Kan 的采访时)简单地提到它有什么不同之处,以及为什么 IEEE 想要使用它。 + +> 如今,世界上大部分的基础设施都是由软件运行的,而这些软件需要符合通信网络、电网、农业等方面的标准。 + +这是有道理的 —— 如果我们想提高标准化技术,这在很大程度上取决于软件。所以,这听起来肯定是要对创新的开源项目进行标准化,让它们也能为潜在的资本机会做好准备。 + +IEEE 还澄清说: + +> 随着软件在当今世界越来越普遍,道德规范、可靠性、透明度和民主治理成为必须具备的条件。IEEE 在赋予开源项目这些属性方面有着得天独厚的优势。 + +虽然听起来很好,但 IEEE 的开源平台究竟能提供什么?让我们一起来看看这个问题。 + +### IEEE SA Open 概览 + +![][8] + +首先,它对所有人开放并且完全免费使用。你只需要创建一个 [IEEE 帐户][9],然后[登录到这个开源平台][10]就可以开始。 + +除了与 IEEE 广泛的会员网络相关的好处之外,你还可以期望其开源社区经理或社区成员提供指导性支持。 + +![Ieee Gitlab][11] + +该平台提供了标准和非标准项目的用例,你可以尝试一下。 + +因为选择将 GitLab 与 Mattermost 和 Pages 结合起来,你可以获得一些有用的功能,它们是: + + * 项目规划和管理功能 + * 源代码管理 + * 测试、代码质量和持续集成功能 + * Docker 容器注册库和 Kubernetes 集成 + * 应用程序的发布和交付功能 + * 集成了 Mattermost 聊天论坛的斜线命令(完全支持 Android 和 iPhone 应用程序) + * 能够弥合标准制定和开源社区之间的差距,以便以更快的速度推进灵活和创造性的技术解决方案 + * 安全的开放空间,并有严格的行为准则。 + +### 小结 + +显然,有更多的平台来潜在地放大开源项目的曝光率是一件好事 —— 因此,IEEE 的举措听起来很有希望。 + +你对此有何看法?让我知道你的想法吧! + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/ieee-open-source-collaboration-platform/ + +作者:[Ankush Das][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://itsfoss.com/author/ankush/ +[b]: https://github.com/lujun9972 +[1]: https://www.ieee.org/about/index.html +[2]: https://standards.ieee.org/content/ieee-standards/en/initiatives/opensource/ +[3]: https://mattermost.com/ +[4]: https://itsfoss.com/open-source-slack-alternative/ +[5]: https://docs.gitlab.com/ee/user/project/pages/ +[6]: https://spectrum.ieee.org/the-institute/ieee-products-services/ieee-standards-association-launches-a-platform-for-open-source-collaboration +[7]: https://www.linkedin.com/in/robertsfish/ +[8]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/03/ieee-opensource.jpg?ssl=1 +[9]: https://www.ieee.org/profile/public/createwebaccount/showRegister.html +[10]: https://opensource.ieee.org/ +[11]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/03/ieee-gitlab.jpg?ssl=1 diff --git a/published/202004/20200402 How to Upgrade to Ubuntu 20.04 Beta from 18.04 - 19.10.md b/published/202004/20200402 How to Upgrade to Ubuntu 20.04 Beta from 18.04 - 19.10.md new file mode 100644 index 0000000000..10db11050c --- /dev/null +++ b/published/202004/20200402 How to Upgrade to Ubuntu 20.04 Beta from 18.04 - 19.10.md @@ -0,0 +1,140 @@ +[#]: collector: (lujun9972) +[#]: translator: (HankChow) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12085-1.html) +[#]: subject: (How to Upgrade to Ubuntu 20.04 Beta from 18.04 & 19.10) +[#]: via: (https://itsfoss.com/upgrade-ubuntu-beta/) +[#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/) + +如何将 Ubuntu 18.04 LTS/19.10 升级到 Ubuntu 20.04 beta +====== + +![](https://img.linux.net.cn/data/attachment/album/202004/08/125043m1qyy7gzvkjazx41.jpg) + +[Ubuntu 20.04 LTS 版本][1]还有不到一个月就发布了,Ubuntu 在这一个版本中对视觉效果作出了大变动,同时在性能方面也有所提高。 + +如果你还在使用 Ubuntu 18.04 LTS 版本,你会发现 Ubuntu 20.04 配合深色 Yaru 主题非常惊艳,看过 [Ubuntu 20.04 的展示视频][2]你就知道了。 + +- [video](https://img.linux.net.cn/static/video/Ubuntu%2020.04%20Desktop%20Tour%20-%20Check%20Out%20New%20Features-9u5B0njRgOw.mp4) + +感觉确实不错。如果你想在 4 月 23 日最终稳定版正式发布前率先使用 Ubuntu 20.04,也可以在官方网站上下载 beta 版本。尽管是测试版本,但它的稳定性并不差,同时你也可以在使用这个版本的过程中帮助 Ubuntu 团队进行测试。 + +你可以下载每日构建daily build版并进行重新安装,如果你正在使用的是 Ubuntu 18.04 或 Ubuntu 19.10,也可以在现有系统的基础上直接升级到 Ubuntu 20.04 beta 版本。 + +从现有系统中升级是很方便的,因为你不会丢失系统设置和其他文件。与重新安装不同的是,你不需要从头开始重新安装所有的软件。当你切换到新版本时,你的主目录、应用程序(大部分)、文件都会保持原样。 + +> 如果你需要确认正在使用的 Ubuntu 版本,可以参考[这篇文章][4]。 + +在本文中,我将会介绍如何升级到 Ubuntu 20.04 beta 版本。 + +### 如何将 Ubuntu 18.04/19.10 升级到 Ubuntu 20.04 beta + +![Upgrade Ubuntu 20 04 Beta][5] + +在你阅读后面的内容之前,我首先说明一些关于升级到 Ubuntu beta 版本的常见问题。 + + * 版本升级的过程并不复杂,但在整个过程中需要有良好的网络连接,以便下载高达好几 GB 的数据。 + * 版本升级的过程中,第三方存储库(比如你自行添加的 [PPA][6])会被禁用,有些 PPA 可能也和新版本不兼容,在版本升级完毕后,你可以手动启用这些 PPA。 + * 强烈建议将重要数据备份到外部的 USB 硬盘上。你只需要将各个目录下的重要文件直接复制到外部 USB 硬盘上保存即可。 + * 升级到新版本之后,就无法再回滚到之前的旧版本了,如果需要旧版本的系统,只能重新安装。 + * 如果你选择升级到 Ubuntu 20.04 beta 版本,那么在 Ubuntu 20.04 最终稳定版发布之后,你也不需要重新安装。只需要保持定期更新 Ubuntu 系统,届时你就可以直接用上最终稳定版了。 + * Ubuntu 16.04/17/18/19.04 都无法直接升级到 Ubuntu 20.04。 + +了解完上面的内容之后,下面开始从 Ubuntu 18.04/19.10 升级到 Ubuntu 20.04。 + +#### 步骤 1:检查设置是否正确 + +进入“软件和升级Software & Updates”应用: + +![Software & Updates application in Ubuntu][7] + +在“升级Updates”选项卡中,设置“有任何新版本 Ubuntu 都提醒我”或“有 LTS 版本 Ubuntu 就提醒我”: + +![Ubuntu Upgrade Version Settings][8] + +设置完成后,系统会刷新软件库缓存。 + +#### 步骤 2:安装系统更新 + +在上面的步骤完成之后,打开终端(在 Ubuntu 中可以使用 `Ctrl+Alt+T` [快捷键][9]),然后使用以下命令[更新 Ubuntu 系统][10]: + +``` +sudo apt update && sudo apt full-upgrade +``` + +`apt full-upgrade` 或 `apt dist-upgrade` 的功能和 `apt upgrade` 大致相同,但对于系统版本的升级,`apt full-upgrade` 会在需要的情况下将当前已安装的软件移除掉。 + +更新安装完成后,系统可能会需要重新启动。在重新启动之后,就可以进入步骤 3 了。 + +#### 步骤 3:使用更新管理器查找开发版本 + +在步骤 2 中已经安装了所有必要的更新,现在通过下面的命令打开更新管理器,其中 `-d` 参数表示需要查找开发版本: + +``` +update-manager -d +``` + +整个过程可能需要好几分钟,随后会提示有新版本的 Ubuntu 可用: + +![Availability of Ubuntu 20.04 in Ubuntu 19.10][11] + +在 Ubuntu 18.04 上的提示是这样的: + +![Availability of Ubuntu 20.04 in Ubuntu 18.04][12] + +然后点击对话框中的“升级upgrade”按钮。 + +#### 步骤 4:开始升级到 Ubuntu 20.04 beta + +接下来只要等待下载更新就可以了,遇到对话框直接点击 “OK” 即可。 + +![][13] + +点击“升级upgrade”按钮,然后按照提示进行操作。 + +![][14] + +在升级过程中,可能会有提示信息告知所有第三方源都已经禁用。有时候还会提示有哪些软件包需要升级或删除,以及是否需要保留一些已经过时了的软件包。一般情况下,我会选择直接删除。 + +整个升级过程通常会需要几个小时,但主要还是取决于实际的网速。升级完成后,系统会提示需要重新启动。 + +![][15] + +下面的视频展示了所有相关步骤。 + +- [video](https://img.linux.net.cn/static/video/How%20to%20Upgrade%20to%20Ubuntu%2020.04%20Beta%20from%2018.04%20&%2019.10%20Right%20Now-RkxxEtaTVkA.mp4) + +由此可见,这个升级流程并不复杂。欢迎体验 Ubuntu 20.04 带来的新特性。 + +如果你有疑问或建议,欢迎在评论区留言。 + + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/upgrade-ubuntu-beta/ + +作者:[Abhishek Prakash][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://itsfoss.com/author/abhishek/ +[b]: https://github.com/lujun9972 +[1]: https://itsfoss.com/ubuntu-20-04-release-features/ +[2]: https://www.youtube.com/watch?v=9u5B0njRgOw +[3]: https://www.youtube.com/c/itsfoss?sub_confirmation=1 +[4]: https://linux.cn/article-9872-1.html +[5]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/03/upgrade-ubuntu-20-04-beta.jpg?ssl=1 +[6]: https://itsfoss.com/ppa-guide/ +[7]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/03/software-updates-app-ubuntu.jpg?ssl=1 +[8]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/03/ubuntu-upgrade-version-settings.jpg?ssl=1 +[9]: https://itsfoss.com/ubuntu-shortcuts/ +[10]: https://itsfoss.com/update-ubuntu/ +[11]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/03/upgrade-ubuntu-20-04.jpg?ssl=1 +[12]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/03/upgrade-ubuntu-20-04-from-18-04.jpg?ssl=1 +[13]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/03/upgrade-ubuntu-20-04-steps-1.jpg?ssl=1 +[14]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/03/upgrade-ubuntu-20-04-steps-2.jpg?ssl=1 +[15]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/03/restart-to-finish-beta-upgarde-ubuntu-20-04.jpg?ssl=1 diff --git a/published/202004/20200403 Scheduling tasks on Linux using the at command.md b/published/202004/20200403 Scheduling tasks on Linux using the at command.md new file mode 100644 index 0000000000..5c692a68ef --- /dev/null +++ b/published/202004/20200403 Scheduling tasks on Linux using the at command.md @@ -0,0 +1,161 @@ +[#]: collector: (lujun9972) +[#]: translator: (MjSeven) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12092-1.html) +[#]: subject: (Scheduling tasks on Linux using the at command) +[#]: via: (https://www.networkworld.com/article/3535808/scheduling-tasks-on-linux-using-the-at-command.html) +[#]: author: (Sandra Henry-Stocker https://www.networkworld.com/author/Sandra-Henry_Stocker/) + +使用 at 命令在 Linux 上安排任务 +====== + +> at 命令可以很容易地安排 Linux 任务在你选择的任何时间或日期运行,让我们来看看它能为你做什么。 + +![][0] + +当你希望命令或脚本在某个特定时间运行时,你不需要将手指放在键盘上盘旋等待按下回车键,或者是在特定时间坐在办公桌前。相反,你可以通过 `at` 命令来设置任务。在本文中,我们将研究如何使用 `at` 来安排任务,如何精确地选择任务希望运行的时间,以及如何使用 `at` 来查看安排运行的任务。 + +### at vs cron + +对于那些使用 cron 在 Linux 系统上安排任务的人来说,`at` 命令类似于 cron,因为你可以在选定的时间调度任务,但是 cron 用于定期运行的作业 —— 甚至是每年仅一次。大多数 cron 作业的频率都设置为每天、每周或每月运行一次,不过你可以控制运行的频率和时间。 + +另一方面,`at` 命令用于仅运行一次的任务。想在午夜重启系统?没问题,只要你有适当的权限,`at` 可以为你完成此操作。如果你希望系统在每个星期六凌晨 2 点重启,那么改用 cron。 + +### 使用 at + +`at` 命令很容易使用,只需记住几件事。一个简单使用 `at` 的例子类似于这样: + +``` +$ at 5:00PM +at> date >> thisfile +at> +``` + +在输入 `at` 和应该运行命令的时间,`at` 会提示你在设定时间会运行该命令(此例中是 `date` 命令)。输入 `^D`(`Ctrl + d`)来完成请求。 + +假设我们在下午 5 点之前设置这个 `at` 命令,那么这个日期和时间将在当天下午 5 点添加到名为 `thisfile` 文件的末尾。否则,该命令将在第二天下午 5 点运行。 + +与 `at` 命令进行交互时,可以输入多个命令。如果你要同时运行多个命令,只需输入多个命令行即可: + +``` +$ at 6:22 +warning: commands will be executed using /bin/sh +at> echo first >> thisfile +at> echo second >> thisfile +at> +``` + +在上面的命令中,我们使用了一个普通的用户账户,将一些简单的文本添加到该用户主目录的文件中。如果在上午 6:22 之后运行这些命令,那么命令会在第二天运行,因为 6:22 表示上午 6:22。如果你想在下午 6:22 运行,使用 `6:22 PM` 或者 `18:22`。`6:22 PM` 这样也是可以工作的。 + +你也可以通过使用 `at` 来安排命令在指定的日期或时间运行,例如 `10:00AM April 15 2021` 或 `noon + 5 days`(从今天起 5 天内的中午运行),以下是一些例子: + +``` +at 6PM tomorrow +at noon April 15 2021 +at noon + 5 days +at 9:15 + 1000 days +``` + +在指定要运行的命令并按下 `^D` 后,你会注意到 `at` 命令为每个请求分配了一个作业编号,这个数字将显示在 `at` 命令的作业队列中。 + +``` +$ at noon + 1000 days +warning: commands will be executed using /bin/sh +at> date >> thisfile +at> +job 36 at Tue Dec 27 12:00:00 2022 <== job # is 36 +``` + +### 检查队列 + +你可以使用 `atq`(at queue)命令来查看 `at` 作业队列: + +``` +$ atq +32 Thu Apr 2 03:06:00 2020 a shs +35 Mon Apr 6 12:00:00 2020 a shs +36 Tue Dec 27 12:00:00 2022 a shs +34 Thu Apr 2 18:00:00 2020 a shs +``` + +如果你需要取消队列中的一个作业,使用 `atrm`(at remove)命令和作业编号: + +``` +$ atrm 32 +$ atq +35 Mon Apr 6 12:00:00 2020 a shs +36 Tue Dec 27 12:00:00 2022 a shs +34 Thu Apr 2 18:00:00 2020 a shs +``` + +你可以使用 `at -c` 命令来查看安排任务的详细信息,其它详细信息(活动的搜索路径等)也可以看到,但是输出的最后一行将显示计划运行的命令。 + +``` +$ at -c 36 | tail -6 +cd /home/shs || { + echo 'Execution directory inaccessible' >&2 + exit 1 +} +date >> thisfile +``` + +注意,该命令显示首先会测试是否可以通过 `cd` 命令进入用户目录。如果不可以,作业将退出并显示错误。如果可以,则运行在 `at` 中指定的命令。它将命令视为 “进入 `/home/shs` 或退出并显示错误”。 + +### 以 root 身份运行作业 + +要以 root 身份运行 `at` 作业,只需将 `sudo` 与你的 `at` 命令一起使用,如下所示: + +``` +$ sudo at 8PM +[sudo] password for shs: +warning: commands will be executed using /bin/sh +at> reboot now +at> +job 37 at Wed Apr 1 16:00:00 2020 +``` + +注意,root 的任务以 `root` 作为执行者显示在队列中。 + +``` +35 Mon Apr 6 12:00:00 2020 a shs +36 Tue Dec 27 12:00:00 2022 a shs +37 Wed Apr 1 20:00:00 2020 a root <== +``` + +### 运行脚本 + +你还可以使用 `at` 命令来运行脚本,这里有一个例子: + +``` +$ at 4:30PM +warning: commands will be executed using /bin/sh +at> bin/tryme +at> +``` + +### 禁止使用 at 命令 + +`/etc/at.deny` 文件提供了一种禁止用户使用 `at` 命令的方法。默认情况下,它可能会包含一个不允许的账户列表,例如 `ftp` 和 `nobody`。可以使用 `/etc/at.allow` 文件执行相反的操作,但是通常只配置 `at.deny` 文件。 + +### 总结 + +当你要安排一项一次性任务时,无论你是希望在今天下午或几年后运行,`at` 命令都是通用且易于使用的。 + +-------------------------------------------------------------------------------- + +via: https://www.networkworld.com/article/3535808/scheduling-tasks-on-linux-using-the-at-command.html + +作者:[Sandra Henry-Stocker][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://www.networkworld.com/author/Sandra-Henry_Stocker/ +[b]: https://github.com/lujun9972 +[0]: https://images.idgesg.net/images/article/2019/08/gettyimages-140389307-100808283-large.jpg +[1]: https://www.networkworld.com/blog/itaas-and-the-corporate-storage-technology/?utm_source=IDG&utm_medium=promotions&utm_campaign=HPE22140&utm_content=sidebar (ITAAS and Corporate Storage Strategy) +[2]: https://www.facebook.com/NetworkWorld/ +[3]: https://www.linkedin.com/company/network-world diff --git a/published/202004/20200403 Take back your dotfiles with Chezmoi.md b/published/202004/20200403 Take back your dotfiles with Chezmoi.md new file mode 100644 index 0000000000..caded6c08c --- /dev/null +++ b/published/202004/20200403 Take back your dotfiles with Chezmoi.md @@ -0,0 +1,308 @@ +[#]: collector: (lujun9972) +[#]: translator: (wxy) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12109-1.html) +[#]: subject: (Take back your dotfiles with Chezmoi) +[#]: via: (https://fedoramagazine.org/take-back-your-dotfiles-with-chezmoi/) +[#]: author: (Ryan Walter https://fedoramagazine.org/author/rwaltr/) + +用 Chezmoi 取回你的点文件 +====== + +![](https://img.linux.net.cn/data/attachment/album/202004/14/183618dwkhe4ehx1kthxvw.jpg) + +在 Linux 中,点文件是隐藏的文本文件,从 Bash、Git 到 i3 或 VSCode 等更复杂的许多应用程序,都用它存储配置设置。 + +这些文件大多数都放在 `~/.config` 目录中或用户主目录中。编辑这些文件使你可以自定义也许没有提供设置菜单的应用程序,并且它们可以跨设备甚至是跨其它 Linux 发行版移植。但是,整个 Linux 发烧友社区的讨论焦点是如何管理这些点文件以及如何共享它们。 + +我们将展示一个名为 [Chezmoi][2] 的工具,该工具与其它工具略有不同。 + +### 点文件管理的历史 + +如果你在 [GitHub 上搜索“dotfiles”][3],那么你将看到有超过 10 万个存储库在解决一个目标:将人们的点文件存储在可共享且可重复的领地中。但是,除了都在使用 Git 之外,它们存储文件的方式各有不同。 + +虽然 Git 解决了代码管理问题,也将其转换为配置文件管理,但它并没有解决如何区分发行版、角色(例如家用计算机与工作计算机)、机密信息管理以及按设备配置的问题。 + +因此,许多用户决定制定自己的解决方案,多年来,社区已经做出了许多成果。本文将简要介绍已有的一些解决方案。 + +#### 在孤立的环境中进行实验 + +你想在封闭的环境中快速尝试以下解决方案吗?运行: + +``` +$ podman run --rm -it fedora +``` + +来创建一个 Fedora 容器尝试应用程序。退出容器时,该容器将自动删除自身。 + +#### 安装问题 + +如果将点文件存储在 Git 存储库中,你肯定希望可以让更改轻松地自动应用到主目录之中,乍一看,最简单的方法是使用符号链接,例如 `ln -s ~/.dotfies/bashrc ~/.bashrc`。这可以使你的更改在更新存储库时立即就绪。 + +符号链接的问题在于管理符号链接可能很麻烦。Stow 和 [RCM][4](在 Fedora 杂志上介绍过)可以帮助你管理这些,但是这些并不是非常舒服的解决方案。下载后,需要对私有文件进行适当的修改和设置访问模式。如果你在一个系统上修改了点文件,然后将存储库下载到另一个系统,则可能会发生冲突并需要进行故障排除。 + +解决此问题的另一种方法是编写自己的安装脚本。这是最灵活的选项,但要权衡花费更多时间来构建自定义解决方案是否值得。 + +#### 机密信息问题 + +Git 旨在跟踪更改。如果你在 Git 存储库中存储密码或 API 密钥之类的机密信息,则会比较麻烦,并且需要重写 Git 历史记录以删除该机密信息。如果你的存储库是公开的,那么如果其他人下载了你的存储库,你的机密信息将不再保密。仅这个问题就会阻止许多人与公共世界共享其点文件。 + +#### 多设备配置问题 + +问题不在于如何将配置拉到多个设备,而是当你有多个需要不同配置的设备的问题。大多数人通过使用不同的文件夹或使用不同的复刻fork来处理此问题。这使得难以在不同设备和角色集之间共享配置。 + +### Chezmoi 是如何干的 + +Chezmoi 是一种考虑了以上问题的用于管理点文件的工具,它不会盲目地从存储库复制或符号链接文件。 Chezmoi 更像是模板引擎,可以根据系统变量、模板、机密信息管理器和 Chezmoi 自己的配置文件来生成你的点文件。 + +#### Chezmoi 入门 + +目前,Chezmoi 并不在 Fedora 的默认软件库中。你可以使用以下命令下载 Chezmoi 的当前版本。 + +``` +$ sudo dnf install https://github.com/twpayne/chezmoi/releases/download/v1.7.17/chezmoi-1.7.17-x86_64.rpm +``` + +这会将预打包的 RPM 安装到你的系统中。 + +让我们继续使用以下方法创建你的存储库: + +``` +$ chezmoi init +``` + +它将在 `~/.local/share/chezmoi/` 中创建你的新存储库。你可以使用以下命令轻松地切换到该目录: + +``` +$ chezmoi cd +``` + +让我们添加第一个文件: + +``` +chezmoi add ~/.bashrc +``` + +这将你的 `.bashrc` 文件添加到 chezmoi 存储库。 + +注意:如果你的 `.bashrc` 文件实际上是一个符号链接,则需要添加 `-f` 标志以跟随它来读取实际文件的内容。 + +现在,你可以使用以下命令编辑该文件: + +``` +$ chezmoi edit ~/.bashrc +``` + +现在让我们添加一个私有文件,这是一个具有 600 或类似权限的文件。我在 `.ssh/config` 中有一个文件,我想通过使用如下命令添加它: + +``` +$ chezmoi add ~/.ssh/config +``` + +Chezmoi 使用特殊的前缀来跟踪隐藏文件和私有文件,以解决 Git 的限制。运行以下命令以查看它: + +``` +$ chezmoi cd +``` + +**请注意,标记为私有的文件实际上并不是私有的,它们仍会以纯文本格式保存在你的 Git 存储库中。稍后会进一步解释。** + +你可以使用以下方法应用任何更改: + +``` +$ chezmoi apply +``` + +并使用如下命令检查有什么不同: + +``` +$ chezmoi diff +``` + +#### 使用变量和模板 + +要导出 Chezmoi 可以收集的所有数据,请运行: + +``` +$ chezmoi data +``` + +其中大多数是有关用户名、架构、主机名、操作系统类型和操作系统名称的信息。但是你也可以添加我们自己的变量。 + +继续,运行: + +``` +$ chezmoi edit-config +``` + +然后输入以下内容: + +``` +[data] + email = "fedorauser@example.com" + name = "Fedora Mcdora" +``` + +保存文件,然后再次运行 `chezmoi data`。你将在底部看到你的电子邮件和姓名已经添加成功。现在,你可以将这些与 Chezmoi 的模板一起使用。运行: + +``` +$ chezmoi add -T --autotemplate ~/.gitconfig +``` + +来将你的 `.gitconfig` 作为模板添加到 Chezmoi 中。如果 Chezmoi 成功地正确推断了模板,你将获得以下信息: + +``` +[user] + email = "{{ .email }}" + name = "{{ .name }}" +``` + +如果没有,则可以将文件更改为这样。 + +使用以下方法检查文件: + +``` +$ chezmoi edit ~/.gitconfig +``` + +然后使用: + +``` +$ chezmoi cat ~/.gitconfig +``` + +来查看 Chezmoi 为此文件生成什么。我生成的示例如下: + +``` +[root@a6e273a8d010 ~]# chezmoi cat ~/.gitconfig +[user] + email = "fedorauser@example.com" + name = "Fedora Mcdora" +[root@a6e273a8d010 ~]# +``` + +它将在我们的 Chezmoi 配置中生成一个充满变量的文件。你也可以使用变量执行简单的逻辑语句。一个例子是: + +``` +{{- if eq .chezmoi.hostname "fsteel" }} +# 如果主机名为 "fsteel" 才包括此部分 +{{- end }} +``` + +请注意,要使其正常工作,该文件必须是模板。你可以通过查看文件是否在 `chezmoi cd` 中的文件名后附加 `.tmpl` 或使用 `-T` 选项读取文件来进行检查。 + +#### 让机密信息保持机密 + +要对设置进行故障排除,请使用以下命令。 + +``` +$ chezmoi doctor +``` + +这里重要的是它还向你显示了[所支持的密码管理器][5]。 + +``` +[root@a6e273a8d010 ~]# chezmoi doctor + warning: version dev + ok: runtime.GOOS linux, runtime.GOARCH amd64 + ok: /root/.local/share/chezmoi (source directory, perm 700) + ok: /root (destination directory, perm 550) + ok: /root/.config/chezmoi/chezmoi.toml (configuration file) + ok: /bin/bash (shell) + ok: /usr/bin/vi (editor) + warning: vimdiff (merge command, not found) + ok: /usr/bin/git (source VCS command, version 2.25.1) + ok: /usr/bin/gpg (GnuPG, version 2.2.18) + warning: op (1Password CLI, not found) + warning: bw (Bitwarden CLI, not found) + warning: gopass (gopass CLI, not found) + warning: keepassxc-cli (KeePassXC CLI, not found) + warning: lpass (LastPass CLI, not found) + warning: pass (pass CLI, not found) + warning: vault (Vault CLI, not found) + [root@a6e273a8d010 ~]# +``` + +你可以使用这些客户端,也可以使用[通用客户端][6],也可以使用系统的[密钥环][7]。 + +对于 GPG,你需要使用以下命令将以下内容添加到配置中: + +``` +$ chezmoi edit-config +``` + +``` +[gpg] + recipient = "开悟 enlightenment
”。 + +然而,当 Enlightenment 18 版本发布以后,这一切都改变了。该版本是如此的糟糕,以至于它并没有集成到 Bodhi 中。Enlightenment 19 发布后修复了一些问题,但仍然存在一些不足。 + +在尝试与 Enlightenment 开发团队合作却毫无进展之后,Bodhi 开发者在 2015 年[复刻][8]了 Enlightenment 17。新的桌面环境被命名为 [Moksha][9],它是基于梵文单词“解脱、解放或释放”。你可以在 [GitHub][10] 上找到它的代码。 + +### 5.1.0 有什么新特性? + +- [Bodhi Linux 5.1 Trailer](https://youtu.be/e8wcRL9F3p8) + +[Bodhi 5.1.0][12] 是这两年内发布的第一个版本,也是基于 Ubuntu 18.04 的第二个版本。除了更新包,它还有新的默认图标和主题。该版本对默认应用程序做了几处更改。预装版 Leafpad 取代了 epad 并且 [GNOME Web][13](也被称为 Epiphany)代替了 [Midori][14]。删除了 eepDater 系统更新器。 + +目前有[四个不同的版本][15]的 Bodhi5.1.0 可以[下载][16]: 标准版Standard硬件支持版Hwe兼容版Legacy软件包版AppPack。 + +* 标准适用于过去十年内电脑配置。它不推送内核更新。 +* 硬件支持版是 Bodhi 家族的新成员,其设计用来包括对更新的硬件的支持,并会接收到内核更新。5.1 版本的使用的是 5.3.0-42 内核。 +* 兼容版是仅有的 32 位版本。它使用“较旧的 4.9.0-6-686 Linux 内核,该内核针对旧的(15 年以上)硬件进行了优化。这个内核也不包括许多老系统不支持的 PAE 扩展。” +* 软件包版是为那些想要一个开箱即用的全载系统的人准备的,并预装了许多应用程序。 + +### Bodhi Linux 的系统要求 + +最低系统要求: + + * 500 MHz 处理器 + * 256 MB 内存 + * 5 GB 的硬盘存储空间 + +推荐系统要求: + + * 1.0 GHz 处理器 + * 512 MB 内存 + * 10 GB 的硬盘存储空间 + +### 体验 Bodhi Linux + +![Old Bodhi Linux][17] + +由于它是基于 Ubuntu 的,所以安装 Bodhi 非常简单。当我登录到 Bodhi 后,新的主题和图标集让我大吃一惊。上次我安装 Bodhi(包括几个月前的 5.0)时,我认为它需要换一个新的外观。之前的主题并没有什么问题,但看起来像是二十一世纪初的东西。新的主题使它看起来更具现代感。 + +![Bodhi Linux 5.1][18] + +我也很高兴看到 Midori 浏览器被 GNOME Web 所取代。我不是 [Midori 浏览器][19]的粉丝。对我来说,它总是显得功能太少了。(不过,随着 [Midori Next][20] 的推出,这种情况可能会改变。)GNOME Web 更像是我需要的网页浏览器。最重要的是它带有 Firefox Sync,这样我就可以同步我所有的书签和密码了。 + +与许多 Linux 发行版不同,Bodhi 并没有一个独立的软件中心。相反,如果你点击 AppCenter 图标,它会打开浏览器,并导航到 Bodhi 网站的软件中心页面 [AppCenter 页面][21]。这里的应用程序是按类别排序的,它们中的大多数是[轻量级应用程序][22]。 + +![Bodhi Linux Appcenter][23] + +如果你点击其中一个页面并点击“安装”,(在你输入密码之后)Bodhi 就会安装它。这是通过一个名为 [apturl][24] 的小程序实现的,它是“是一个非常简单的从网页浏览器安装软件包的方法”。它非常灵巧,我希望更多基于 Ubuntu 的发行版使用它。 + +总的来说,我喜欢 Moksha 桌面。它坚持我们几十年来看到的桌面风格(这是我最喜欢的)。它不会影响你,却很容易改变和定制。我唯一怀念的是,当我按下超级键时,应用程序菜单不打开。但我猜你不可能拥有生活中的一切。 + +### 结语 + +我对最近发布的 Bodhi Linux 感到十分惊喜。过去,我经常折腾它。并且我一直很喜欢它,但最近的这个版本是迄今为止最好的。在某种程度上,他们打破了 Bodhi 只适合老系统的想法,加入了对较新内核的支持。 + +如果你想换换个环境,同时又想在 Ubuntu 的世界里寻找新的风景,那就试试[Bodhi Linux][3]吧。 + +你用过 Bodhi Linux 吗?你最喜欢的基于 Ubuntu 的发行版是什么?请在下面的评论中告诉我们。 + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/bodhi-linux-review/ + +作者:[John Paul][a] +选题:[lujun9972][b] +译者:[qfzy1233](https://github.com/qfzy1233) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://itsfoss.com/author/john/ +[b]: https://github.com/lujun9972 +[1]: https://itsfoss.com/lightweight-linux-beginners/ +[2]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/03/bodhi-start-page.png?resize=800%2C500&ssl=1 +[3]: https://www.bodhilinux.com/ +[4]: https://www.bodhilinux.com/w/wiki/ +[5]: https://www.bodhilinux.com/w/what-is-bodhi-linux/ +[6]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/03/bodhi-desktop.jpg?resize=800%2C500&ssl=1 +[7]: https://www.enlightenment.org/start +[8]: https://www.bodhilinux.com/2015/04/28/introducing-the-moksha-desktop/ +[9]: https://www.bodhilinux.com/moksha-desktop/ +[10]: https://github.com/JeffHoogland/moksha +[11]: https://www.youtube.com/c/itsfoss?sub_confirmation=1 +[12]: https://www.bodhilinux.com/2020/03/25/bodhi-linux-5-1-0-released/ +[13]: https://wiki.gnome.org/Apps/Web/ +[14]: https://en.wikipedia.org/wiki/Midori_(web_browser +[15]: https://www.bodhilinux.com/w/selecting-the-correct-iso-image/ +[16]: https://www.bodhilinux.com/download/ +[17]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/03/bodhi.png?resize=800%2C400&ssl=1 +[18]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/04/bodhi-Linux-5-1-screenshot.jpg?ssl=1 +[19]: https://itsfoss.com/midori-browser/ +[20]: https://www.midori-browser.org/2020/01/15/midori-next-come-on-yarovi-we-can/ +[21]: https://www.bodhilinux.com/a/ +[22]: https://itsfoss.com/lightweight-alternative-applications-ubuntu/ +[23]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/03/Bodhi-Linux-AppCenter.png?resize=800%2C500&ssl=1 +[24]: https://wiki.ubuntu.com/AptUrl +[25]: https://reddit.com/r/linuxusersgroup diff --git a/published/202004/20200404 What is Arch User Repository (AUR)- How to Use AUR on Arch and Manjaro Linux.md b/published/202004/20200404 What is Arch User Repository (AUR)- How to Use AUR on Arch and Manjaro Linux.md new file mode 100644 index 0000000000..df0074259a --- /dev/null +++ b/published/202004/20200404 What is Arch User Repository (AUR)- How to Use AUR on Arch and Manjaro Linux.md @@ -0,0 +1,140 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12107-1.html) +[#]: subject: (What is Arch User Repository (AUR)? How to Use AUR on Arch and Manjaro Linux?) +[#]: via: (https://itsfoss.com/aur-arch-linux/) +[#]: author: (Dimitrios Savvopoulos https://itsfoss.com/author/dimitrios/) + +什么是 Arch 用户仓库(AUR)以及如何使用? +====== + +如果你一直在使用 [Arch Linux][1] 或其他基于 Arch 的发行版,如 Manjaro,那么可能会遇到 AUR。你尝试安装新软件,有人建议从 AUR 中安装它。这让你感到困惑。 + +什么是 AUR?为什么使用它?如何使用 AUR?我将在本文中回答这些问题。 + +### 什么是 AUR? + +![][2] + +AUR 表示Arch 用户仓库Arch User Repository。它是针对基于 Arch 的 Linux 发行版用户的社区驱动的仓库。它包含名为 [PKGBUILD][3] 的包描述,它可让你使用 [makepkg][4] 从源代码编译软件包,然后通过 [pacman][5](Arch Linux 中的软件包管理器)安装。 + +创建 AUR 的目的是组织和共享社区中的新软件包,并帮助加速将流行的软件包纳入[社区仓库][6]。 + +进入官方仓库的大量新软件包都从 AUR 开始。在 AUR 中,用户可以贡献自己的软件包构建(PKGBUILD 和相关文件)。 + +AUR 社区可以对 AUR 中的软件包进行投票。如果一个软件包变得足够流行(假设它具有兼容的许可证和良好的打包技术),那么可以将其加入 `pacman` 直接访问的社区仓库中。 + +> 简而言之,AUR 是开发人员在 Arch 仓库中正式包含新软件之前向 Arch Linux 用户提供新软件的一种方式。 + +### 你应该使用 AUR 吗?有什么风险? + +使用 AUR 就像过马路一样。如果你谨慎操作,应该就没问题。 + +如果你刚接触 Linux,建议你在建立有关 Arch/Manjaro 和 Linux 的基础知识之前不要使用 AUR。 + +的确,任何人都可以将软件包上传到 AUR,但[受信任用户][7](TU)负责监视上传的内容。尽管 TU 对上传的软件包执行质量控制,但不能保证 AUR 中的软件包格式正确或没有恶意。 + +在实践中,AUR 似乎很安全,但理论上讲它可以造成一定程度的损害,但前提是你不小心。从 AUR 构建软件包时,聪明的 Arch 用户**总是**检查 `PKGBUILD` 和 `*.install` 文件。 + +此外,TU(受信任用户)还会删除 AUR 中包含在 core/extra/community 中的软件包,因此它们之间不应存在命名冲突。AUR 通常会包含软件包的开发版本(cvs/svn/git 等),但它们的名称会被修改,例如 foo-git。 + +对于 AUR 软件包,`pacman` 会处理依赖关系并检测文件冲突,因此,除非你默认使用 `–force` 选项,否则你不必担心用另一个包中的文件会覆盖另一个包的文件。如果这么做了,你可能会遇到比文件冲突更严重的问题。 + +### 如何使用 AUR? + +使用 AUR 的最简单方法是通过 AUR 助手。 [AUR 助手][8] 是一个命令行工具(有些还有 GUI),可让你搜索在 AUR 上发布的软件包并安装。 + +#### 在 Arch Linux 上安装 AUR 助手 + +假设你要使用 [Yay AUR 助手][9]。确保在 Linux 上安装了 git。然后克隆仓库,进入目录并构建软件包。 + +依次使用以下命令: + +``` +sudo pacman -S git +sudo git clone https://aur.archlinux.org/yay-git.git +cd yay +makepkg -si +``` + +安装后,你可以使用 `yay` 命令来安装软件包: + +``` +yay -S package_name +``` + +并非必须使用 AUR 助手来从 AUR 安装软件包。从以下文章解如何在没有 AUR 助手的情况下使用 AUR。 + +#### 不使用 AUR 助手安装 AUR 软件包 + +如果你不想使用 AUR 助手,那么也可以自行从 AUR 安装软件包。 + +在 [AUR 页面][10]上找到要安装的软件包后,建议确认“许可证”、“流行程度”、“最新更新”、“依赖项”等,作为额外的质量控制步骤。 + +``` +git clone [package URL] +cd [package name] +makepkg -si +``` + +例如。假设你要安装 [telegram 桌面包][11]: + +``` +git clone https://aur.archlinux.org/telegram-desktop-git.git +cd telegram-desktop-git +makepkg -si +``` + +#### 在 Manjaro Linux 中启用 AUR 支持 + +它默认情况下未启用 AUR,你必须通过 `pamac` 启用它。我的笔记本电脑运行 [Manjaro][12] Cinnamon,但是所有 Manjaro 变种的步骤都相同。 + +打开 Pamac(显示为 “Add/Remove Software”): + +![][13] + +进入 Pamac 后,请进入如下所示的首选项preferences。 + +![][14] + +在首选项对话框中,进入 “AUR” 选项卡,启用 AUR 支持,启用检查更新,并关闭对话框。 + +![][15] + +现在,你可以搜索软件包,并且可以通过软件包描述下的标签来识别属于 AUR 的软件包。 + +![][16] + +希望本文对你有用,并关注社交媒体上即将出现的与 Arch 相关的主题。 + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/aur-arch-linux/ + +作者:[Dimitrios Savvopoulos][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://itsfoss.com/author/dimitrios/ +[b]: https://github.com/lujun9972 +[1]: https://www.archlinux.org/ +[2]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/04/what-is-aur.png?ssl=1 +[3]: https://wiki.archlinux.org/index.php/PKGBUILD +[4]: https://wiki.archlinux.org/index.php/Makepkg +[5]: https://wiki.archlinux.org/index.php/Pacman#Additional_commands +[6]: https://wiki.archlinux.org/index.php/Community_repository +[7]: https://wiki.archlinux.org/index.php/Trusted_Users +[8]: https://itsfoss.com/best-aur-helpers/ +[9]: https://github.com/Jguer/yay +[10]: https://aur.archlinux.org/ +[11]: https://aur.archlinux.org/packages/telegram-desktop-git +[12]: https://manjaro.org/ +[13]: https://i1.wp.com/i.imgur.com/kFF6HtW.png?ssl=1 +[14]: https://i0.wp.com/i.imgur.com/47r963A.png?ssl=1 +[15]: https://i1.wp.com/i.imgur.com/UThiDHO.png?ssl=1 +[16]: https://i2.wp.com/i.imgur.com/RM5BKi2.png?ssl=1 diff --git a/published/202004/20200407 15 years of Git- How to get started or learn something new.md b/published/202004/20200407 15 years of Git- How to get started or learn something new.md new file mode 100644 index 0000000000..d08342b3e7 --- /dev/null +++ b/published/202004/20200407 15 years of Git- How to get started or learn something new.md @@ -0,0 +1,75 @@ +[#]: collector: (lujun9972) +[#]: translator: (wxy) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12104-1.html) +[#]: subject: (15 years of Git: How to get started or learn something new) +[#]: via: (https://opensource.com/article/20/4/get-started-git) +[#]: author: (Seth Kenlon https://opensource.com/users/seth) + +Git 都 15 岁了,如何入门或学习点新东西 +====== + +> 在 Git 15 周年之际,了解为什么 Git 是保持软件行业运行的重要组成部分。 + +![](https://img.linux.net.cn/data/attachment/album/202004/13/091410k80er3mttrznc22e.jpg) + +如果说过去二十年来有什么东西改变了软件,那么 [Git][2] 肯定位列榜首。 + +如果你没有亲自使用过 Git,你可能会认为它只是一种技术时尚,只是因为它是由 [Linux][3] 项目的创始人创建的,所以在开发者中只是一个偶然的宠儿。这或许有一定的道理,但 Git 确实取得了一些其他行业所没有的成就。有了 Git,分布在世界各地的开发者们可以在同一时间对同一段代码进行工作,并记录下每一次修改的历史,然后将所有的工作合并到一起,形成一个成品。由于这件事情非常复杂,所以这个工具本身也会变得很复杂,但归根结底,它是维持软件行业运行的重要组成部分。 + +无论你是否了解 Git,如果你足够深入的研究开源软件,或者进入计算机科学领域,都有可能遇到它。无论你使用 Git 只是为了下载一个安装包,还是每天与它交互来管理代码,了解更多关于它的知识,都会对你有很大的启发和帮助。 + +### Git 术语 + +与任何专业工具一样,Git 中也有很多行话。像“克隆clone”、“合并merge”和“变基rebase”这样的术语,最起码也是神秘的,而更糟的情况下会令人感到排斥。试图理解这些术语的含义可能会让人不知所措,但如果你从 Matthew Broberg 的优秀文章《[Git 术语基础][4]》中得到一点指导,就不会这样了。只需快速阅读一下,你就能真正理解地听懂关于 Git 的对话。 + +### Git 入门 + +如果你需要知道如何使用 Git,那么我自己的[关于使用 Git 的入门文章系列][5]是一个很好的开始。这些文章已经有几年的历史了,但就像许多 Linux 和 UNIX 技术一样,它的界面并没有发生很大的变化,所以这些文章和我写这些文章那时一样,在今天还是很有意义的。这一系列文章向你介绍了 Git 最基本的概念,并带领你完成创建仓库、提交文件、恢复文件、合并分支等过程。 + +### 常见的 Git 服务 + +Git 最常见的用途之一是公共的 Git 托管服务,比如 GitLab 和 GitHub。Kedar Vijay Kulkarni 在他的《[如何在 Git 中克隆、修改、添加和删除文件][6]》一文中,演示了大多数开发者使用 Git 执行的日常任务。这不是非开发者的必读书目,但对于任何想在公共 Git 托管服务上为项目做贡献的人来说,这篇文章是必读的。这篇文章专门针对的是 Github,因为它是当今最常见的平台之一,但其原理也适用于任何 Git 服务的 Web 前端,包括 [GitLab][7]、[Gogs][8] 和 [Gitea][9] 等流行的开源框架。 + +### 试试这个 Git 演练 + +与其漫无目的的探索,你是不是更喜欢在导游的带领下学习?有时候,学习一件事最简单的方法就是模仿别人的准确步骤。你知道最终的结果是肯定成功的,所以你在进行练习的时候会有信心,而你的大脑和手指也会得到重复的好处,从而建立起记忆。如果这是你的学习风格,那就跟着 Alan Formy-Duvall 的《[Git 的实用学习练习][10]》,找出成功的 Git 课程的感觉。 + +### Git 应用程序 + +信不信由你,Git 的界面比你在终端输入的文字更多。显然,在线托管的 Git 有 Web 界面,但是你也可以在计算机上使用 Git 客户端。如果想获得更多的帮助,请阅读 Jesse Duffield 关于 [Lazygit][11] 的文章或 Olaf Anders 关于 [Tig][12] 的文章。要获得完整的图形应用程序体验,请阅读我有关 [Git-cola][13]、[Sparkleshare][14] 以及[其它应用][15]的文章。是的,甚至还有[用于你的移动设备的界面][16]! + +### 了解更多关于 Git 的信息 + +知识就是力量,所以不要让 Git 对你来说像个谜。无论你是直接使用它,还是只知道它的名字,或者你以前从未听说过它,现在都是了解 Git 的好时机。这里有很多资源可以帮助你了解它的工作原理、工作原理以及人们为什么这么喜欢它。潜入其中,按照自己的节奏来学习,并学会爱上 Git 吧! + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/4/get-started-git + +作者:[Seth Kenlon][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/seth +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/document_free_access_cut_security.png?itok=ocvCv8G2 (Scissors cutting open access to files) +[2]: https://en.wikipedia.org/wiki/Git +[3]: https://opensource.com/resources/linux +[4]: https://opensource.com/article/19/2/git-terminology +[5]: https://opensource.com/life/16/7/stumbling-git +[6]: https://opensource.com/article/18/2/how-clone-modify-add-delete-git-files +[7]: https://about.gitlab.com/install/ +[8]: https://gogs.io/ +[9]: https://gitea.io/en-us/ +[10]: https://opensource.com/article/19/5/practical-learning-exercise-git +[11]: https://opensource.com/article/20/3/lazygit +[12]: https://opensource.com/article/19/6/what-tig +[13]: https://opensource.com/article/20/3/git-cola +[14]: https://opensource.com/article/19/4/file-sharing-git +[15]: https://opensource.com/life/16/8/graphical-tools-git +[16]: https://opensource.com/article/19/4/calendar-git#mobile diff --git a/published/202004/20200407 Bitwarden- A Free - Open Source Password Manager.md b/published/202004/20200407 Bitwarden- A Free - Open Source Password Manager.md new file mode 100644 index 0000000000..5341efed3d --- /dev/null +++ b/published/202004/20200407 Bitwarden- A Free - Open Source Password Manager.md @@ -0,0 +1,112 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12111-1.html) +[#]: subject: (Bitwarden: A Free & Open Source Password Manager) +[#]: via: (https://itsfoss.com/bitwarden/) +[#]: author: (Ankush Das https://itsfoss.com/author/ankush/) + +Bitwarden:一个自由开源的密码管理器 +====== + +> Bitwarden 是流行的开源密码管理器。在这里,我们来看看它提供了什么。 + +![][1] + +[Bitwarden][2] 是一个自由开源的密码管理器。你可能还记得,我们之前将它列为 [Linux 中的最佳密码管理器][3]之一。 + +就个人而言,几个月来我一直在多个设备上使用 Bitwarden 作为我的密码管理器。因此,在本文中,我将说明它提供的功能以及我的使用经验。 + +**注意:** 如果你对服务的安全性有疑问,请查看其官方安全性[常见问题页面][4]。 + +### Bitwarden 密码管理器的特性 + +![][5] + +[Bitwarden][2] 是许多其他方便的密码管理器的不错替代品。 + +以下是它的特性: + + * 提供免费和付费选择 + * 适用于团队(企业)和个人 + * 开源 + * 支持自托管 + * 能够作为身份验证器应用(如 Google 身份验证器) + * 跨平台支持(安卓、iOS、Linux、Windows 和 macOS) + * 提供浏览器扩展(Firefox,、Chrome、Opera、Edge、Safari) + * 提供命令行工具 + * 提供网页保管库 + * 能够导入/导出密码 + * [密码生成器][6] + * 自动填充密码 + * 两步身份验证 + +从技术上讲,Bitwarden 使用完全免费。然而,它也提供了一些付费计划(个人付费和商务付费计划)。 + +通过付费计划,你可以与更多用户共享密码、获取 API 访问权限(业务使用)以及更多此类高级功能。 + +以下是定价(在编写本文时): + +![][7] + +对于大多数个人来说,考虑到支持开源项目,10 美元/年的高级个人计划不应成为问题。当然,你也可以选择没有限制地免费使用。 + +### 在 Linux 上安装 Bitwarden + +![][8] + +很容易将 Bitwarden 安装到你的 Linux 系统上,因为它提供了一个 .AppImage 文件。如果你还不知道[如何使用 AppImage][9] 文件,你可以参考我们的指南。 + +如果你不喜欢使用 AppImage,你可以选择 [snap 包][10]或在其[官方下载页面][11]上下载 .deb 或者 .rpm 文件。你还可以查看其 [GitHub 页面][12]了解更多信息。 + +- [下载 Bitwarden][2] + +如果你对使用桌面应用不感兴趣,也可以使用浏览器扩展。 + +### 我使用 Bitwarden 的体验 + +在 Bitwarden 之前,我使用 [LastPass][13] 作为密码管理器。尽管这不是一个糟糕的选择,但它不是开源软件。 + +所以,在我发现 Bitwarden 后就决定使用它。 + +首先,我从 LastPass 导出我的数据,并导入到 Bitwarden 没有遇到困难。在此过程中我没有丢失任何数据。 + +除了桌面应用,我一直在使用 Bitwarden 的火狐插件和 Android 应用。使用六个多月后,我没有遇到任何问题。所以,如果你愿意试试看,我一定会给它好评! + +### 总结 + +我想说,对于那些想要一个可以到处工作,并且跨设备轻松同步的密码管理器的用户而言,Bitwarden 是一个完整的解决方案。 + +你可以免费入门,但如果可以,请购买 **10 美元/年**的高级计划来支持这个开源项目。 + +如果你正在寻找更多选择,你也可以查看我们的 [Linux 中 5 个最佳密码管理器][3]。 + +你试过 Bitwarden 了吗?如果没有,请试试看!此外,你最喜欢的密码管理器是什么?让我在下面的评论中知道! + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/bitwarden/ + +作者:[Ankush Das][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://itsfoss.com/author/ankush/ +[b]: https://github.com/lujun9972 +[1]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/04/bitwarden-screenshot.jpg?ssl=1 +[2]: https://bitwarden.com/ +[3]: https://linux.cn/article-11531-1.html +[4]: https://help.bitwarden.com/security/ +[5]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/04/bitwarden-dark-mode.jpg?ssl=1 +[6]: https://itsfoss.com/password-generators-linux/ +[7]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/04/bitwarden-pricing.jpg?ssl=1 +[8]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/04/bitwarden-settings.png?ssl=1 +[9]: https://itsfoss.com/use-appimage-linux/ +[10]: https://snapcraft.io/bitwarden +[11]: https://bitwarden.com/#download +[12]: https://github.com/bitwarden +[13]: https://www.lastpass.com/ diff --git a/published/202004/20200407 New Linux Distribution UbuntuDDE Brings The Beautiful Deepin Desktop to Ubuntu.md b/published/202004/20200407 New Linux Distribution UbuntuDDE Brings The Beautiful Deepin Desktop to Ubuntu.md new file mode 100644 index 0000000000..87410d1362 --- /dev/null +++ b/published/202004/20200407 New Linux Distribution UbuntuDDE Brings The Beautiful Deepin Desktop to Ubuntu.md @@ -0,0 +1,84 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12114-1.html) +[#]: subject: (New Linux Distribution UbuntuDDE Brings The Beautiful Deepin Desktop to Ubuntu) +[#]: via: (https://itsfoss.com/ubuntudde/) +[#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/) + +新的 Linux 发行版 UbuntuDDE 将漂亮的深度桌面带到 Ubuntu +====== + +深度是一个漂亮桌面环境,拥有直观的 UI。UbuntuDDE 项目结合了 Ubuntu 的强大和深度之美。 + +[深度桌面环境][1](DDE)是由[深度 Linux][2] 的开发人员创建的漂亮桌面环境。最初,深度 Linux 基于 [Ubuntu][3],但后来他们切换到了 [Debian][4]。 + +![Deepin Desktop Environment in Ubuntu][5] + +深度 Linux 的一个主要问题是它的下载服务器速度较慢。常规系统需要花几个小时才能下载,因为他们的所有服务器都在中国,而这些服务器很不幸的是速度极慢。 + +如果你想使用深度桌面,那没有什么可以阻止你将其安装在常规 Ubuntu 系统上。[UbuntuDDE][6] 试图通过在 Ubuntu 之上为你提供开箱即用的深度桌面体验来使其更简单。这样可以节省你在 Ubuntu 上安装和配置深度桌面的时间和精力。 + +![Screenshot of UbuntuDDE][7] + +### Ubuntu DDE:Ubuntu 的强大和深度桌面的漂亮 + +请注意,UbuntuDDE 不是 Ubuntu 的官方变种。UbuntuDDE 的开发人员与 Ubuntu 团队无关。UbuntuDDE 目前一个混合发行版,其目标是在未来的发行版中被接纳为 Ubuntu 的官方变种。 + +UbuntuDDE 开发人员得到了 Ubuntu Snapcraft 团队的 Alan Pope、Ubuntu Budgie 团队和 [Ubuntu Cinnamon][8] 团队,以及其他开发者,如 Hualet Wang 和 Felix Yan 的帮助。 + +在与 FOSS 的对话中,其主要开发人员 Arun 强调说,该项目的重点是定期维护 Ubuntu 的 DDE 软件包,并帮助用户享受 DDE(深度桌面环境)的全部乐趣。 + +![Ubuntu Deepin Edition login screen][9] + +Arun 还提到,这个 Ubuntu 和深度的混合项目首先是维护和打包来自上游(即深度仓库)的最新版本。然后,它最终与 Ubuntu 20.04 focal 结合,生成了一个镜像文件,每个人都可以安装,而不必麻烦地先安装常规的 Ubuntu,然后再安装深度桌面。UbuntuDDE 不仅是 DDE 和 Ubuntu 的组合,而且还是 UbuntuDDE 团队的软件包选择和设计变更的融合。 + +![UbuntuDDE screenshot][10] + +与 Deepin Linux 不同,UbuntuDDE 不使用深度应用商店。它改用 Ubuntu 软件中心。如果你被[这个来自武汉的深度 Linux 的间谍软件谣言][11]吓到了,这应该是一个好消息。 + +### 下载 UbuntuDDE 20.04 Beta + +UbuntuDDE 的目标是与 Ubuntu 20.04 一起发布第一个正式的稳定版本。像[其他 Ubuntu 变种][12]一样,UbuntuDDE 20.04 beta 也可供你下载并尝试。 + +> 警告! +> +> 一句话警告。 UbuntuDDE 是正在开发的新手项目。请不要在你的主用系统上使用它。如果要尝试,请在虚拟机或备用系统中使用它。 + +- [下载 Ubuntu 20.04 DDE Beta][13] + +![Installing UbuntuDDE][14] + +由于本质上是 Ubuntu,因此安装 UbuntuDDE 与安装 Ubuntu 相同。你可以参考这篇教程,其中展示了[如何在 VirtualBox 内安装 Ubuntu][15]。 + +我知道你可能会认为这“不过是另一个 Ubuntu” 或者“只是 Ubuntu 上的深度,任何人都可以做到的”。但是我也知道有一小部分用户喜欢像 UbuntuDDE 这样的项目,这对他们来说使事情变得容易。我的意思是有许多 Ubuntu 变种就是这样出现的。你怎么看? + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/ubuntudde/ + +作者:[Abhishek Prakash][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://itsfoss.com/author/abhishek/ +[b]: https://github.com/lujun9972 +[1]: https://www.deepin.org/en/dde/ +[2]: https://www.deepin.org/en/ +[3]: https://ubuntu.com/ +[4]: https://www.debian.org/ +[5]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/04/ubuntu-deepin-edition-screenshot.jpg?ssl=1 +[6]: https://ubuntudde.com/ +[7]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/04/ubuntu-deepin-edition-screenshot-1.jpg?ssl=1 +[8]: https://itsfoss.com/ubuntu-cinnamon/ +[9]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/04/ubuntu-deepin-edition-screenshot-5.jpg?ssl=1 +[10]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/04/ubuntu-deepin-edition-screenshot-2.jpg?ssl=1 +[11]: https://www.deepin.org/en/2018/04/14/linux-deepin-is-not-spyware/ +[12]: https://itsfoss.com/which-ubuntu-install/ +[13]: https://ubuntudde.com/download/ +[14]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/04/ubuntu-deepin-edition-screenshot-4.jpg?ssl=1 +[15]: https://itsfoss.com/install-linux-in-virtualbox/ diff --git a/published/202004/20200408 Create web tutorials with Reveal.js and Git.md b/published/202004/20200408 Create web tutorials with Reveal.js and Git.md new file mode 100644 index 0000000000..8d549aceaf --- /dev/null +++ b/published/202004/20200408 Create web tutorials with Reveal.js and Git.md @@ -0,0 +1,203 @@ +[#]: collector: (lujun9972) +[#]: translator: (wxy) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12139-1.html) +[#]: subject: (Create web tutorials with Reveal.js and Git) +[#]: via: (https://opensource.com/article/20/4/create-web-tutorial-git) +[#]: author: (Eric D. Schabell https://opensource.com/users/eschabell) + +使用 Reveal.js 和 Git 创建网页教程 +====== + +> 通过这个简单的工作流程创建的研讨会幻灯片,可以在任何浏览器、设备和平台上获得一致的查看效果。 + +![](https://img.linux.net.cn/data/attachment/album/202004/23/094800ohkpbjd3zbj0dj0d.jpg) + +无论你是学习者还是教师,你可能都会认识到采用幻灯片放映来传播知识的在线研讨会workshop的价值。如果你曾经偶然看到过这样一个逐页、逐章设置的井井有条的教程,你可能会想知道创建这样的一个网站有多难。 + +好吧,让我在这里向你展示,使用全自动化的流程来生成这样的教程是多么容易。 + +### 介绍 + +当我开始将学习内容放到网上置时,体验并不是很好。我想要的是一种可重复的、一致的、易于维护的东西,因为我的内容会随着我教学的技术发展而变化。 + +我尝试了许多交付模型,从 [Asciidoctor][2] 这样的低级代码生成器到在单个 PDF 文件中放置教程。全都不能让我满意。当我举办现场的在座研讨会时,我喜欢使用幻灯片放映,因此我想知道我是否可以为我自己的在线的,自定进度的研讨会体验做同样的事情。 + +经过一番挖掘,我为创建无痛的研讨会网站打下了基础。当时我已经在使用一个演示文稿生成框架,这对我来说是很有帮助的,因为这个框架可以产生对网站友好的格式(HTML)。 + +### 设置 + +这里是这个项目所需要的基本组件。 + + * 研讨会的想法(这是你的问题,我帮不了你) + * 用于研讨会幻灯片的 Reveal.js + * GitLab 项目仓库 + * 你常用的 HTML 代码编辑器 + * Web 浏览器 + * 在你的机器上安装好 Git + +如果这个列表看起来令人望而生畏,那么有一个快速入门的方法,不需要把所有的东西一个个都拉到一起。你可以用我的模板项目来给你提供幻灯片和项目设置的入门教程。 + +本文假设你熟悉 Git 和在 Git 平台(如 GitLab)上托管项目。如果你需要指导或教程,请查看我们的[Git 入门系列][3]。 + +首先,将模板项目克隆到本地机器上。 + +``` +$ git clone https://gitlab.com/eschabell/beginners-guide-automated-workshops.git +``` + +为此设置一个新的 GitLab 项目,导入模板项目作为初始导入。 + +研讨会网站有一些重要的文件。在**根目录**下,你会发现一个名为 `.gitlab-ci.yml` 的文件,当你向主分支提交修改时(即将拉取请求合并到 `master` 分支),这个文件会作为触发器。它可以触发将 `slides` 目录的全部内容复制到 GitLab 项目的 `website` 文件夹中。 + +我把它托管在我的 GitLab 账户中,名为 `beginners-guide-automated-workshops`。当它部署完毕后,你可以在浏览器中通过导航到下列地址查看 `slides` 目录的内容: + +``` +https://eschabell.gitlab.io/beginners-guide-automated-workshops +``` + +对于你的用户帐户和项目,URL 如下所示: + +``` +https://[YOUR_USERNAME].gitlab.io/[YOUR_PROJECT_NAME] +``` + +这些是你开始创建网站内容所需要的基本素材。当你推送修改后,它们会自动生成更新过的研讨会网站。请注意,默认模板包含了几个示例幻灯片,这将是你完成对存储库的完整签入后的第一个研讨会网站。 + +研讨会模板生成的结果是一个 [receive.js][4] 幻灯片,可以在任何浏览器中运行,并可以自动调整大小,几乎可以让任何人在任何地方、任何设备上观看。 + +这样创建一个方便、易访问的研讨会怎么样? + +### 它是如何工作的 + +有了这些背景信息,你就可以开始探索研讨会的这些素材,并开始把你的内容放在一起了。你需要的一切都可以在项目的 `slides` 目录中找到;这里是使用 reveal.js 在浏览器中创建研讨会幻灯片的地方。 + +你将用来制作研讨会的文件和目录是: + + * `default.css`文件 + * `images` 目录 + * `index.html`文件 + +在你常用的 HTML/CSS 编辑器中打开每一个文件,然后进行下面描述的修改。你用哪个编辑器并不重要,我更喜欢 [RubyMine IDE][5],因为它能在本地浏览器中提供页面预览。这对我在将内容推送到研讨会网站之前测试内容时很有帮助。 + +#### default.css 文件 + +文件 `css/theme/default.css` 是一个基础文件,你将在这里为你的研讨会幻灯片设置重要的全局设置。其中值得注意的两个主要的项目是所有幻灯片的默认字体和背景图片。 + +在 `default.css` 中,看一下标有 `GLOBAL STYLES` 的部分。当前的默认字体在这一行中列出了。 + +``` +font-family: "Red Hat Display", "Overpass", san-serif; +``` + +如果你使用的是非标准字体类型,则必须在以下行中将其导入(Overpass 字体类型就是这样做的): + +``` +@import url('SOME_URL'); +``` + +`background` 是你创建的每张幻灯片的默认图像。它存储在 `images` 目录下(见下面),并在下面这一行中设置(重点是图像路径)。 + +``` +background: url("…/…/images/backgrounds/basic.png") +``` + +要设置一个默认背景,只需将这一行指向你要使用的图片。 + +#### images 目录 + +顾名思义,`images` 目录是用来存储你想在研讨会幻灯片上使用的图片。例如,我通常会把展示研讨会主题进展的截图放在我的个人幻灯片上。 + +现在,你只需要知道你需要将背景图片存储在一个子目录(`backgrounds`)中,并将你计划在幻灯片中使用的图片存储在 `images` 目录中。 + +#### index.html 文件 + +现在你已经把这两个文件整理好了,剩下的时间你就可以在 HTML 文件中创建幻灯片了,从 `index.html` 开始。为了让你的研讨会网站开始成形,请注意这个文件中的以下三个部分。 + + * `head `部分,在这里你可以设置标题、作者和描述。 + * `body` 部分,你可以在这里找到要设计的单个幻灯片。 + * 你可以在每个 `section` 中定义各个幻灯片的内容。 + +从 `head` 部分开始,因为它在顶部。模板项目有三个占位符行供你更新。 + +``` +INSERT-YOUR-TITLE-HERE + + +``` + +`title` 标签包含文件打开时显示在浏览器选项卡中的文字。请将其改为与你的研讨会的标题相关的内容(或研讨会的某个部分),但记得要简短,因为标签页的标题空间有限。`description` 元标签包含了对你的工作坊的简短描述,而 `author` 元标签是你应该把你的名字(如果你是为别人写的,则是工作坊创建者的名字)。 + +现在继续到 `body` 部分。你会注意到它被分成了许多 `section` 标签。`body` 的开头包含了一个注释,说明你正在为每个标有 `section` 的打开和关闭的标签创建幻灯片。 + +``` + +
+ + +
+``` + +接下来,创建你的各个幻灯片,每张幻灯片都用 `section` 标签封装起来。这个模板包括了一些幻灯片来帮助你开始制作。例如,这里是第一张幻灯片。 + +``` +
+
+

Beginners guide

+

to automated workshops

+
+
+ Brought to you by,
+ YOUR-NAME
+
+ +
+``` + +这张幻灯片有两个区域,用 `div` 标签分隔。用空格隔开了标题和作者。 + +如果你有一定的 HTML 使用知识,可以尝试各种东西来开发你的研讨会。使用浏览器预览结果的时候真的很方便。有些 IDE 提供了本地查看修改,但你也可以打开 `index.html` 文件查看你的修改,然后再推送到资源库中。 + +一旦你对你的研讨会感到满意,推送你的修改,然后等待它们通过持续集成管道。它们将像模板项目一样被托管在 。 + +### 了解更多 + +要了解更多关于这个工作流程可以做什么,请查看下面的示例研讨会和托管了研讨会集合的网站。所有这些都是基于本文中描述的工作流程。 + +研讨会例子: + + * [Red Hat Process Automation Manage workshop][6] + * [JBoss Travel Agency BPM Suite online workshop][7] + +研讨会集合: + + * [Rule the world: Practical decisions & process automation development workshops][8] + * [Application development in the cloud workshop][9] + * [Portfolio architecture: Workshops for creating impactful architectural diagrams][10] + +我希望这本新手指南和模板研讨会项目能让你看到,在开发和维护研讨会网站的过程中,可以轻松、无痛地完成。我也希望这个工作流程能让你的研讨会受众几乎在任何设备上都能完全访问你的内容,这样他们就能从你分享的知识中学习到你的知识。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/4/create-web-tutorial-git + +作者:[Eric D. Schabell][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/eschabell +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/read_book_guide_tutorial_teacher_student_apaper.png?itok=_GOufk6N (Person reading a book and digital copy) +[2]: https://asciidoctor.org/ +[3]: https://opensource.com/resources/what-is-git +[4]: https://revealjs.com/#/ +[5]: https://www.jetbrains.com/ruby/ +[6]: https://gitlab.com/bpmworkshop/rhpam-devops-workshop +[7]: https://gitlab.com/bpmworkshop/presentation-bpmworkshop-travel-agency +[8]: https://bpmworkshop.gitlab.io/ +[9]: https://appdevcloudworkshop.gitlab.io/ +[10]: https://redhatdemocentral.gitlab.io/portfolio-architecture-workshops diff --git a/published/202004/20200408 How to Create Templates in LibreOffice to Save Time and Increase Productivity.md b/published/202004/20200408 How to Create Templates in LibreOffice to Save Time and Increase Productivity.md new file mode 100644 index 0000000000..1377f03523 --- /dev/null +++ b/published/202004/20200408 How to Create Templates in LibreOffice to Save Time and Increase Productivity.md @@ -0,0 +1,84 @@ +[#]: collector: (lujun9972) +[#]: translator: (qfzy1233) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12118-1.html) +[#]: subject: (How to Create Templates in LibreOffice to Save Time and Increase Productivity) +[#]: via: (https://itsfoss.com/create-templates-libreoffice/) +[#]: author: (Dimitrios Savvopoulos https://itsfoss.com/author/dimitrios/) + +如何在 LibreOffice 中创建模板以实现省时高效 +====== + +![](https://img.linux.net.cn/data/attachment/album/202004/16/214314y17oww0ymfylyn1m.jpg) + +在 [LibreOffice][1] 中为你经常使用的文档创建模板可以为你节省一些时间。它可以是信件、财务表格抑或是简报。 + +模板不仅可以为你节省时间,另一方面它可以保证在同一机构内参与统一项目的小组成员文档的一致性。 + +举例而言,如果你是一家需要经常开具工作经验证明的企业,你可以创建一个模板,而不再需要从某个地方复制粘贴已保存的文档。当你需要开具一个新的经验证明时,你可以从模板中创建,稍微编辑一下就可以了。 + +LibreOffice 默认情况下提供了一些模板,但并不仅仅局限于使用这些,你可以根据自己的需求自由定制。 + +我认为模板是每个用户都应该了解的 [LibreOffice 基础技巧之一][2]。下面我将为你演示如何使用。 + +### 如何在 LibreOffice 中创建一个模板 + +首先,创建你希望通过最少的编辑就可以重复使用的文档。它可以是文档、电子表格或演示文稿。我在示例中使用的是 word 文档,但是所有步骤都是相同的。 + +然后转到“文件”选项卡并选择“存储为模板”。你将被提示输入“名称”及选择“类别”,再单击“保存”。 + +![Creating a new template in LibreOffice][3] + +此文件将以 .ots 格式保存在 LibreOffice 的模板文件夹中。你可以在其他安装了 LibreOffice 的系统上使用这些 .ots 文件,并在这些系统上使用相同的模板。 + +### 如何在 LibreOffice 中使用模板 + +要使用模板,请选择 “文件选项卡”,然后选择 “模板”。 + +不要担心! LibreOffice 在打开一个模板时会在不影响原始模板的情况下创建一个副本。你可以随意编辑文档而不必担心模板发生改动。 + +![Using templates][4] + +选择模板后,单击打开。你就可以随意编辑了。 + +### 如何在 LibreOffice 中更改模板 + +我们需求可能会不时变化,所以需要对模板进行相应。 + +编辑一个现有的模板,单击“文件” -> “模板”,然后右键单击所需的模板,然后单击“编辑”。 + +![edit Template][5] + +当你完成对模板的编辑时,单击“保存”以使更改生效。 + +总之,模板不仅可以减少重复任务的工作量,还可以防止用户出错。你可以利用电脑优势来灵活的处理重复性的任务,并以此提高你的效率。 + +> 福利小贴士 + +你可以在 [LibreOffice 网站][7]上找到大量的附加模板。你可以搜索你需要的,下载并使用它们。请注意,这些模板来自第三方和未经验证的用户。所以使用它们的风险需要自己承担。 + +之后我会继续分享更多这样的技巧。同时,你还可以学习一下如何创建模板[在 GNOME 的右键菜单上下文中添加“创建新文档”选项][8]。 + + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/create-templates-libreoffice/ + +作者:[Dimitrios Savvopoulos][a] +选题:[lujun9972][b] +译者:[qfzy1233](https://github.com/qfzy1233) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://itsfoss.com/author/dimitrios/ +[b]: https://github.com/lujun9972 +[1]: https://www.libreoffice.org/ +[2]: https://itsfoss.com/libreoffice-tips/ +[3]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/04/1.Template-save-as.png?resize=800%2C567&ssl=1 +[4]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/04/2.Use-a-template.png?ssl=1 +[5]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/04/3.edit-template.png?ssl=1 +[6]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2017/12/LibreOffice-logo.jpeg?fit=800%2C450&ssl=1 +[7]: https://extensions.libreoffice.org/templates +[8]: https://itsfoss.com/add-new-document-option/ diff --git a/published/202004/20200409 Here-s How to Find Out Which Desktop Environment You are Using.md b/published/202004/20200409 Here-s How to Find Out Which Desktop Environment You are Using.md new file mode 100644 index 0000000000..963a64f356 --- /dev/null +++ b/published/202004/20200409 Here-s How to Find Out Which Desktop Environment You are Using.md @@ -0,0 +1,111 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12124-1.html) +[#]: subject: (Here’s How to Find Out Which Desktop Environment You are Using) +[#]: via: (https://itsfoss.com/find-desktop-environment/) +[#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/) + +如何找出你所使用的桌面环境 +====== + +如果你是 Linux 新用户,并在一个 Linux 论坛中寻求帮助,那么你可能会被问以下问题: + +> “你使用的是哪个桌面环境?” + +你知道什么是桌面环境desktop environment(DE),但你如何知道你使用的是哪一个?我会告诉你如何找到它。我将首先展示命令行方法,因为这适用于[各种 Linux 发行版][1]。我还将展示如何通过图形方式获得。 + +### 检查你使用的是哪个桌面环境 + +![][2] + +你可以[在 Linux 中使用 echo 命令][3]在终端中显示 `XDG_CURRENT_DESKTOP` 变量的值。 + +打开终端并复制粘贴此命令: + +``` +echo $XDG_CURRENT_DESKTOP +``` + +例如,这表明我在 [Ubuntu 20.04][5] 中使用了 [GNOME 桌面][4]: + +``` +[email protected]:~$ echo $XDG_CURRENT_DESKTOP +ubuntu:GNOME +``` + +尽管此命令可以快速告诉你正在使用哪个桌面环境,但它不会提供任何其他信息。 + +在某些情况下,了解桌面环境版本可能很重要。软件的每个新版本都会带来新功能或删除某些功能。[GNOME 3.36][6] 引入了“请勿打扰”选项,以关闭所有桌面通知。 + +假设你了解了这个新的“请勿打扰”功能。你确认自己正在使用 GNOME,但是在 GNOME 桌面上看不到此选项。如果你可以检查系统上已安装的 GNOME 桌面版本,那么这会很清楚。 + +我将先向你展示命令检查桌面环境版本,因为你可以在任何运行桌面环境的 Linux 中使用它。 + +### 如何获取桌面环境版本 + +与获取桌面环境的名称不同。获取其版本号的方法并不直接,因为它没有标准的命令或环境变量可以提供此信息。 + +在 Linux 中获取桌面环境信息的一种方法是使用 [Screenfetch][7] 之类的工具。此[命令行工具以 ascii 格式显示 Linux 发行版的 logo][8] 以及一些基本的系统信息。桌面环境版本就是其中之一。 + +在基于 Ubuntu 的发行版中,你可以通过[启用 Universe 仓库][9]安装 Screenfetch,然后使用以下命令: + +``` +sudo apt install screenfetch +``` + +对于其他 Linux 发行版,请使用系统的软件包管理器来安装此程序。 + +安装后,只需在终端中输入 `screenfetch` 即可,它应该显示桌面环境版本以及其他系统信息。 + +![Check Desktop Environment Version][10] + +如上图所示,我的系统使用 GNOME 3.36.1(基本版本是 GNOME 3.36)。你也可以这样[检查 Linux 内核版本][11]和其他详细信息。 + +请记住,Screenfetch 不一定显示桌面环境版本。我查看了它的源码,它有许多 if-else 代码,可以从各种桌面环境中的许多源和参数获取版本信息。如果找不到任何版本,那么仅显示桌面环境名称。 + +### 使用 GUI 检查桌面环境版本 + +几乎所有桌面环境在其 “Settings”->“About” 部分中都提供了基本的系统详细信息。 + +一个主要问题是,大多数桌面环境看起来都不同,因此我无法展示每个桌面环境的确切步骤。我将展示 GNOME 的,让你在桌面上发现它。 + +在菜单中搜索 “Settings”(按 Windows 键并搜索): + +![Search for Settings application][12] + +在这里,找到底部的 “About” 部分。单击它,你应该就能看到桌面环境及其版本。 + +![Check Desktop Environment in Ubuntu][13] + +如你所见,这表明我的系统正在使用 GNOME 3.36。 + +我希望这个快速入门技巧对你有所帮助。如果你有任何疑问或建议,请在下面发表评论。 + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/find-desktop-environment/ + +作者:[Abhishek Prakash][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://itsfoss.com/author/abhishek/ +[b]: https://github.com/lujun9972 +[1]: https://itsfoss.com/what-is-linux/ +[2]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/04/check-desktop-environment.jpg?ssl=1 +[3]: https://linuxhandbook.com/echo-command/ +[4]: https://www.gnome.org/ +[5]: https://itsfoss.com/ubuntu-20-04-release-features/ +[6]: https://itsfoss.com/gnome-3-36-release/ +[7]: https://github.com/KittyKatt/screenFetch +[8]: https://itsfoss.com/display-linux-logo-in-ascii/ +[9]: https://itsfoss.com/ubuntu-repositories/ +[10]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/04/check-desktop-environment-version.jpg?ssl=1 +[11]: https://itsfoss.com/find-which-kernel-version-is-running-in-ubuntu/ +[12]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/08/applications_menu_settings.jpg?ssl=1 +[13]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/04/check-desktop-environment-ubuntu.jpg?ssl=1 diff --git a/published/202004/20200410 How I-m using AI to translate -wash your hands- in 500 languages.md b/published/202004/20200410 How I-m using AI to translate -wash your hands- in 500 languages.md new file mode 100644 index 0000000000..4117cefacf --- /dev/null +++ b/published/202004/20200410 How I-m using AI to translate -wash your hands- in 500 languages.md @@ -0,0 +1,136 @@ +[#]: collector: (lujun9972) +[#]: translator: (wxy) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12131-1.html) +[#]: subject: (How I'm using AI to translate 'wash your hands' in 500 languages) +[#]: via: (https://opensource.com/article/20/4/ai-translation) +[#]: author: (Daniel Whitenack https://opensource.com/users/datadan) + +我是如何用 AI 把“请洗手”翻译成 500 种语言的? +====== + +> 通过使用人类和机器生成的翻译,可以将关键的健康短语翻译成世界各地的当地语言。 + +![](https://img.linux.net.cn/data/attachment/album/202004/20/184427f1a2t5z61m5xxo1t.jpg) + +你可能不知道,目前世界上有 [7117 种语言][2]在使用,不是方言,而是在用的语言! 然而,世界上许多数字媒体只能使用几十种语言,而像谷歌翻译这样的翻译平台只支持 100 种左右的语言。这样的现实意味着,由于缺乏及时获取信息的机会,全世界有数十亿人被边缘化。当前的冠状病毒(COVID-19)大流行已经让人痛苦地意识到了这一点,凸显了将健康相关的短语(如“请洗手wash your hands”或“保持距离”等)即时、快速翻译成小众语言的必要性。 + +为此,我应用了最先进的 AI 技术,用 544 种语言构建出了与“请洗手”相近的短语并进行了统计(我的 GPU 还在运行)。多语言无监督和受监督嵌入Multilingual Unsupervised and Supervised Embeddings(MUSE)方法被用来训练这 544 种语言和英语之间的跨语言单词嵌入。然后,这些嵌入方法可以从现有文档中提取出与目标短语相似的短语。 + +我与 SIL 国际公司的同事们合作完成了这项工作,他们收集了该短语的更多的人工翻译结果。这些人工翻译结果和我的一些机器翻译结果的组合可以在[这个民族语指南页面][3]上搜索到(机器生成的短语用一个小的机器人图标表示),更多的翻译将在生成/收集到的时候加入。 + +### 利用现有的语料库 + +SIL 国际公司已经完成了 2000 多种语言的语言工作,目前管理着 1600 多个语言项目。因此,当我解决这个特殊的问题时,我知道我们很可能已经多次将“请洗手”和/或类似的短语翻译成了数百种语言,而这一猜测得到了回报。我很快就从我们的档案库中收集到了超过 900 种语言的文档(主要是完成的贝壳书模板、教材和圣经)。这些文档中的每一份都有一个英文的对应版本,其中必然包括“请洗手”和/或类似“请洗脸”这样的短语。此外,这些文档的质量都很高,并与当地语言社区合作进行了翻译和检查。 + +这是相当多语言的数据集。然而,有两个问题需要克服。首先,这个数据包含了大多数语言的数千种样本,这与训练机器翻译模型所使用的数百万个样本形成了鲜明对比。其次,即使文档中包含目标语言中的“请洗手”这个短语,我们也不知道这个短语在周围文本中的确切位置。 + +我们当然可以利用[低资源语言的机器翻译][4]中的一些最新技巧,但是需要花费一些时间来调整自动化方法,以快速适应每种语言对中的翻译模型。此外,我们所针对的许多语言都没有现成的的基线,可以用来比较评估指标(例如 [BLEU 评分][5])。考虑到对冠状病毒大流行的迫切担忧,我们希望比这更快一点(尽管我们计划在将来再来解决这个问题)。 + +我选择通过在现有的文档中寻找短语本身或短语的组件(如“请洗”或“你的手”)来尝试构建“请洗手”这个短语。为了找到这些成分,我使用 Facebook Research 的[多语言无监督和受监督嵌入(MUSE)][6]对每个 {英语、目标语言} 对进行了跨语言cross-lingual嵌入训练。MUSE 以单语言monolingual的单词嵌入作为输入(我使用 [fasttext][7] 来生成这些词),并使用对抗性方法学习了从英语到目标嵌入空间的映射。这个过程的输出是跨语言cross-lingual的单词嵌入。 + +![Using fasttext along with MUSE to perform cross-language embedding][8] + +一旦产生了跨语言嵌入,我们就可以开始在目标语言文档中寻找短语组件。结果发现,整个文档中清楚地使用了“请洗脸”这个短语以及单独的“手”、“请洗”等词。对于每一种语言,我都通过 n-gram 搜索我预期该短语会出现的地方(根据其在英语的对应版本中的用法)。使用跨语言嵌入法对 n-gram 进行了矢量化处理,并使用各种距离指标与英语短语的矢量化版本进行了比较。在嵌入空间中,与英文短语“最接近”的 n-gram 被确定为与目标语言匹配。 + +最后,将与英语对应的成分短语进行组合,生成目标语言中的“请洗手”短语。这种组合方式再次利用了跨语言嵌入,以确保以合适方式组合组件。例如,如果我们在目标语言中匹配“请洗脚”这个短语,就必须将“脚”对应的 n-gram 替换成“手”对应的 n-gram。下面是伯利兹·克里奥尔Belize Kriol英语的一个例子: + +![][9] + +当然,在这个匹配过程中,会做一些假设,这个过程完全有可能不能产生语法上正确的预测。例如,我假设在大多数语言中,“手”的单词和“脚”的单词都是一个字元token长的(字元由空格和标点符号隔开)。当然并非总是如此。这可能会造成类似于“和洗和手你”或类似的瑕疵词条。希望我们可以克服其中的一些局限性,并在未来扩展这个系统,但是,现在,我们选择用图形来强化这个想法。 + +我们将世界卫生组织的洗手说明改编成了一个 PNG 图片模板。然后,我们把我们翻译和生成的短语,用 Bash 和 Go 脚本的组合将其渲染到洗手图像中。这样,在文字和图像中都强调了正确洗手的理念(以防万一我们生成的翻译很尴尬)。 + +![][10] + +### 结果 + +到目前为止,我已经能够训练出 544 种语言的跨语言嵌入。我使用上述讨论过的方法尝试为所有这些语言构建“请洗手”这个短语。因为我没有许多语言对的对齐数据,所以我使用了同样包含“请洗手”成分的单独的保留文档来帮助验证构造短语中的字元。这让我们对公开发布的翻译版本有了一些信心(至少它们包含了表示“洗”和/或“手”的信息)。此外,我还将该方法与谷歌翻译支持的和/或有可用的人工翻译的语言对进行了比较。以下是来自 [Ethnologue][11] 带有语言统计的翻译样本。 + +**语言:意大利语 [Ita]** + +- 地点:意大利 +- 人口: 68,000,000 +- 我们的系统: làvati la mani +- 谷歌翻译: Lavati le mani + +**语言:保加利亚语 [bul]** + +- 地点:保加利亚 +- 人口:8,000,000 +- 我们的系统:умий ръцете +- 谷歌翻译:Измий си ръцете + +**语言: 荷兰语 [nld]** + +- 地点:荷兰 +- 人口:24,000,000,000 +- 我们的系统:wast uw handen +- 谷歌翻译:Was je handen + +**语言: Pijin [pis]** + +- 地点:所罗门群岛 +- 人口: 550,000 +- 我们的系统:wasim han +- 谷歌翻译:不支持 + +**语言:Tikar [tik]** + +- 地点:喀麦隆 +- 人口:110,000 +- 我们的系统:ɓɔsi fyàʼ +- 谷歌翻译:不支持 + +**语言:Waffa [waj]** + +- 地点:巴布亚新几内亚 +- 人口:1,300 +- 我们的系统:yaakuuvaitana nnikiiyauvaa fini +- 谷歌翻译:不支持 + +构造的短语类似于参考翻译,或者似乎是“请洗手”的另一种说法。例如,在保加利亚语中,我预测为“умий ръцете”,而谷歌翻译预测为“Измий си ръцете”。 然而,如果我用谷歌翻译回译我的预测,我还是会得到“请洗手”。有一些不确定的地方,我无法与参考译文(例如,所罗门群岛的 Pijin [pis])或人类注释的跨度进行比较,但我仍然可以验证“洗”(wasim)和“手”(han)分别用在其他必定是谈论洗或手的参考文件中。 大约有 15% 的译文可以用这个方法验证,我希望在收集参考文献字典的过程中能进行更多的验证。 + +请注意,我最多使用了每种语言中大约 7000 个句子来得到上述译文,即使是意大利语这样的高资源语言也是如此。我也不依赖语言对之间的对齐句子。尽管存在这种数据非常稀缺、无监督的情况,但对于两个系统都支持的语言,我仍然能够获得类似于谷歌翻译的短语。这证明了这种“混合”方法(无监督的单词嵌入+基于规则的匹配)在将短语翻译成数据非常少的语言中的潜在用途。 + +注意:我绝对不是说这是解决冠状病毒和其他健康相关的信息传播问题的解决方案。这里仍有很多东西需要探索和正式评估,我们正在为此努力。在很多情况下,这种方法无法帮助构建数百种语言的重要信息资料。但是,我认为,我们所有人都应该尝试着为当前危机的相关问题制定创造性的解决方案。也许这只是一个非常大的拼图中的一块。 + +你可以在[这个民族语言指南][3]上查看经过验证的译文加上人工翻译的完整列表。此外,我们即将以论文的形式对这一系统进行更深入的描述和分析。我们欢迎公众对翻译进行反馈,以帮助系统进行微调,最重要的是,确保将健康信息传递给世界各地的边缘化语言社区。 + +### 制作自己的洗手海报 + +我们已经开源了[用于渲染复合的脚本和生成洗手海报的代码][12]。这种方法应该能够处理几乎所有的语言和脚本。你可以在海报中添加你自己的“请洗手”的翻译,以帮助传播,或者根据自己的本地语境进行翻译。请务必在社交媒体上以 #WashYourHands 为标签分享你生成的海报。 + +### 培养你的 AI 技能 + +有很多令人兴奋的 AI 问题,可以给世界带来巨大的影响。如果你想用人工智能解决像上面提到的问题,或者你认为你的企业可能需要开始利用人工智能来做其他事情(供应链优化、推荐、客户服务自动化等),那么不要错过今年 5 月的[AI 课堂培训活动][13]。*AI 课堂*是一个沉浸式的、为期三天的虚拟培训活动,适合至少有一定编程经验和数学基础知识的人参加。该培训提供了使用 Python 和开源框架(如 TensorFlow 和 PyTorch)进行现实的 AI 开发的实用基础知识。完成课程后,学员将有信心开始开发和部署自己的 AI 解决方案。 + +本文经许可转载自 https://datadan.io/blog/wash-your-hands + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/4/ai-translation + +作者:[Daniel Whitenack][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/datadan +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/world_hands_diversity.png?itok=zm4EDxgE (Two diverse hands holding a globe) +[2]: https://www.ethnologue.com/guides/how-many-languages +[3]: https://www.ethnologue.com/guides/health +[4]: https://datadan.io/blog/resources-for-low-resource-machine-translation +[5]: https://en.wikipedia.org/wiki/BLEU +[6]: https://github.com/facebookresearch/MUSE +[7]: https://fasttext.cc/ +[8]: https://opensource.com/sites/default/files/uploads/ai-language-translation-wash-your-hands-opensourcedotcom.gif (Using fasttext along with MUSE to perform cross-language embedding) +[9]: https://opensource.com/sites/default/files/uploads/ai-language-translation-wash-your-hands-opensourcedotcom2.gif +[10]: https://opensource.com/sites/default/files/uploads/ai-language-translation-wash-your-hands-opensourcedotcom3.gif +[11]: https://www.ethnologue.com/ +[12]: https://github.com/sil-ai/wash-your-hands +[13]: https://datadan.io/ diff --git a/published/202004/20200410 How to Go Full Dark Mode in Ubuntu 20.04.md b/published/202004/20200410 How to Go Full Dark Mode in Ubuntu 20.04.md new file mode 100644 index 0000000000..5ff72f17b5 --- /dev/null +++ b/published/202004/20200410 How to Go Full Dark Mode in Ubuntu 20.04.md @@ -0,0 +1,112 @@ +[#]: collector: (lujun9972) +[#]: translator: (HankChow) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12098-1.html) +[#]: subject: (How to Go Full Dark Mode in Ubuntu 20.04) +[#]: via: (https://itsfoss.com/dark-mode-ubuntu/) +[#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/) + +在 Ubuntu 20.04 中完全进入深色模式 +====== + +> 深色模式是 Ubuntu 20.04 最受瞩目的[新功能][1]之一了。任何版本的 Ubuntu 都可以通过[安装深色主题][2]让用户界面拥有一个深色的外观,但在 Ubuntu 20.04 中,这个过程变得更简单。 + +![](https://img.linux.net.cn/data/attachment/album/202004/11/200841gvvaja25jaz5z7hv.jpg) + +在 Ubuntu 20.04 中,无需额外安装主题,默认主题(称为 Yaru)本身就带有三种模式,其中就包括深色模式。 + +下面我会展示如何将 Ubuntu 系统完全设置为深色模式。 + +### 在 Ubuntu 20.04 打开深色模式 + +- [video](https://player.vimeo.com/video/405726943) + +这个步骤是在 GNOME 桌面上进行的,如果你[使用的是其它桌面][4],你看到的可能会和下面的截图不一样。 + +按下 super 键(或 Windows 键),然后输入 “settings”,就可以找到系统设置。 + +![Search for Settings][5] + +在系统设置中,进入“外观Appearance”部分,就可以看到浅色light标准standard深色dark三个选项。既然要使用深色模式,那自然而然要选择“深色”这个选项了。 + +![Enable Dark Theme in Ubuntu][6] + +完成设置以后,使用了 GTK3 的应用程序都可以跟随深色模式。因此你会看到系统中包括文本编辑器、终端、LibreOffice 等在内的大多数应用程序都已经切换成深色了。但未使用 GTK3 的应用程序可能并没有跟随进入深色模式,下面我会展示如何更完整地进入深色模式。 + +### 继续调整,进入完整深色模式 + +这个时候你会发现,shell 主题、屏幕顶部面板中的消息托盘和系统托盘还仍然保持在原有的模式当中。 + +![No Dark Shell by default in Ubuntu][7] + +现在就需要使用 [GNOME 扩展][8]安装 Yaru 深色 shell 主题了。[在 Ubuntu 中通过 Ctrl+Alt+T 打开终端][9],然后执行以下这个命令安装浏览器扩展: + +``` +sudo apt install chrome-gnome-shell +``` + +进入[扩展页面][10]启用这个扩展: + +![Enable User Themes GNOME Extension][11] + +执行以下命令安装 [GNOME 调整工具][12]: + +``` +sudo apt install gnome-tweaks +``` + +打开 GNOME 调整工具,进入“外观Appearance”部分,就可以看到 shell 主题的选项,现在只需要把它启用就可以了。 + +![Enable Yaru Dark Shell Theme in Ubuntu][13] + +设置完之后再观察一下,桌面通知、消息托盘、系统托盘等等都已经进入深色模式了。 + +![Yaru Dark Shell Theme in Ubuntu][14] + +现在感觉好多了。但你可能还会注意到,在使用浏览器访问网站的时候,很多网站都使用了白色的背景色。如果期望网站方提供深色模式,那是很不现实的,但我们可以自己实现这一件事。 + +你需要用到的东西就是诸如 [Dark Reader][15] 这样的浏览器扩展。《[在 Firefox 中启用深色模式][16]》这篇文章中也有讨论过这个浏览器扩展,它的使用过程并不复杂,如果你使用的浏览器是 Firefox、Chrome 或 [Ubuntu 下的 Chromium][17],就可以直接安装[其官方网站][15]上列出的扩展。 + +Dark Reader 安装完成后,就会以深色模式打开网站了。 + +![It’s FOSS Homepage in Dark Mode with Dark Reader][18] + +当然,有些外部的第三方应用程序可能仍然是浅色状态。如果它们自己附带了深色模式的选项,就需要手动启用它们的深色模式。 + +如今,深色模式在非开发者人群中也越来越流行了。按照以上的步骤,你就可以轻松进入深色模式。 + +请享受深色模式。 + + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/dark-mode-ubuntu/ + +作者:[Abhishek Prakash][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://itsfoss.com/author/abhishek/ +[b]: https://github.com/lujun9972 +[1]: https://itsfoss.com/ubuntu-20-04-release-features/ +[2]: https://itsfoss.com/install-themes-ubuntu/ +[3]: https://www.youtube.com/c/itsfoss?sub_confirmation=1 +[4]: https://itsfoss.com/find-desktop-environment/ +[5]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/04/settings-search-ubuntu-20-04.jpg?ssl=1 +[6]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/04/enable-dark-theme-ubuntu.png?ssl=1 +[7]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/04/no-dark-shell-ubuntu.jpg?ssl=1 +[8]: https://itsfoss.com/gnome-shell-extensions/ +[9]: https://itsfoss.com/ubuntu-shortcuts/ +[10]: https://extensions.gnome.org/extension/19/user-themes/ +[11]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/04/enable-user-themes-gnome.jpg?ssl=1 +[12]: https://itsfoss.com/gnome-tweak-tool/ +[13]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/04/ubuntu-yaru-dark-shell-theme.jpeg?ssl=1 +[14]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/04/yaru-dark-shell-theme-ubuntu.jpg?ssl=1 +[15]: https://darkreader.org/ +[16]: https://itsfoss.com/firefox-dark-mode/ +[17]: https://itsfoss.com/install-chromium-ubuntu/ +[18]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/01/itsfoss_dark_mode.jpg?ssl=1 diff --git a/published/202004/20200413 A handy utility for creating Raspberry Pi SD card images.md b/published/202004/20200413 A handy utility for creating Raspberry Pi SD card images.md new file mode 100644 index 0000000000..9fd472c01d --- /dev/null +++ b/published/202004/20200413 A handy utility for creating Raspberry Pi SD card images.md @@ -0,0 +1,77 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12136-1.html) +[#]: subject: (A handy utility for creating Raspberry Pi SD card images) +[#]: via: (https://opensource.com/article/20/4/raspberry-pi-imager-mac) +[#]: author: (James Farrell https://opensource.com/users/jamesf) + +一个方便的用于创建树莓派 SD 卡镜像的程序 +====== + +> 开始在 Mac 上使用 Raspberry Pi Imager。 + +![Raspberries with pi symbol overlay][1] + +有多种购买树莓派的方法,根据你的购买渠道的不同,可能附带或不附带操作系统。要在树莓派上安装操作系统,只需将操作系统镜像 “闪存” 到 SD 卡即可。为了使之尽可能简单,[树莓派基金会][2]推出一个 Raspberry Pi Imager 实用程序,你可以在所有主流平台上下载它。下面就来简单介绍一下这个有用的新工具。 + +### 安装 Imager + +你通常可以在[树莓派下载][3]页面上找到 Raspberry Pi Imager。它有 Mac、Ubuntu 和 Windows 版本。我将下载并演示 Mac 版本。 + +Mac 的安装包是常规的 DMG 镜像,它会挂载到你的桌面,然后经典的安装界面就会出现: + +![Raspberry Pi Imager installer][4] + +只需将可爱的树莓图标拖到“应用”文件夹,就可以完成。从启动台中调用它,你会看到一系列简单的按钮和菜单供你选择。真的不能比这更简单了: + +![Raspberry Pi Imager home screen][5] + +### 可用的镜像和选项 + +默认选项包含各种树莓派型号的镜像。Raspbian 是首选,它有两个可用的选项,较小的 “Lite” 版本和较大的 “Full” 版本。LibreELEC Kodi 娱乐系统有各种特定于型号的版本。Ubuntu 18 和 19 有适用于不同树莓派型号的 32 位和 64 位版本。有一个 RPi 4 EEPROM 恢复程序,以及使用 FAT32 格式化卡的功能。最后,有一个通用的镜像安装程序选项,稍后我将进行尝试。这个简单而紧凑的程序非常方便。 + +### 安装一些镜像 + +我决定使用 16g 的 micro SD 卡。我选择了默认的 Raspbian 镜像,选择已连接的 USB/SD 设备,然后按下 “WRITE” 按钮。这是一个简短的演示: + +![Raspberry Pi Imager demo][6] + +我没有在此处发布整个操作过程。我认为它是在写入的时候下载了镜像,对于我的无线连接这花费了几分钟。该过程在完成之前要先经过写入,然后经过验证环节。完成后,我弹出设备,并将卡插入到我的树莓派 3 中,然后按照通常的图形 Raspbian 安装向导和桌面环境进行设置。 + +这对我来说还不够。我每天都会下载许多 Linux,今天我还在寻找更多。我回到了[树莓派下载][3]页面,并下载了 RISC OS 镜像。这个过程几乎一样容易。下载 RISCOSPi.5.24.zip 文件,将其解压缩,然后找到 ro524-1875M.img 文件。在 “Operating System” 按钮中,我选择了 “Use Custom” 并选择了所需的镜像文件。这个过程几乎是相同的。唯一真正的不同是我必须在下载目录中搜寻并选择一个镜像。文件写完后,回到树莓派 3,RISC OS 可以使用了。 + +### 对 USB C 的抱怨 + +顺便说一句,如今有多少人对 USB C 带来的不便感到沮丧?我使用的是只有 USB C 口的 MacBook Pro,我需要不断更换适配器才能完成工作。看看这个: + +![USB C adapter][7] + +是的,那是一个 USB C 到 USB A 适配器,然后是一个 USB 到 SD 卡读卡器,以及一个 SD 到 micro SD 适配器。我可能可以在网上找到一些东西来简化此过程,但这些都是我手头有的部件,以支持我家五花八门的 Mac、Windows 和 Linux 主机。说到这里就不多说了,但我希望你能从这些疯狂的东西中得到一个笑点。 + +### 总结 + +新的 Raspberry Pi Imager 是一种简单有效的工具,可以快速烧录树莓派镜像。[BalenaEtcher][8] 是用于对可移动设备进行烧录的类似工具,但是新的 Raspberry Pi Imager 通过省去了获取那些常见镜像的步骤,使普通树莓派系统安装(如 Raspbian)更加容易。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/4/raspberry-pi-imager-mac + +作者:[James Farrell][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/jamesf +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/life-raspberrypi_0.png?itok=Kczz87J2 (Raspberries with pi symbol overlay) +[2]: https://www.raspberrypi.org/ +[3]: https://www.raspberrypi.org/downloads/ +[4]: https://opensource.com/sites/default/files/uploads/install_1.png (Raspberry Pi Imager installer) +[5]: https://opensource.com/sites/default/files/uploads/screen_2_0.png (Raspberry Pi Imager home screen) +[6]: https://opensource.com/sites/default/files/uploads/demo_3.gif (Raspberry Pi Imager demo) +[7]: https://opensource.com/sites/default/files/uploads/adapter_4.png (USB C adapter) +[8]: https://www.balena.io/etcher/ diff --git a/published/202004/20200413 How to Add Multiple Time Zones in Ubuntu.md b/published/202004/20200413 How to Add Multiple Time Zones in Ubuntu.md new file mode 100644 index 0000000000..8cd0619343 --- /dev/null +++ b/published/202004/20200413 How to Add Multiple Time Zones in Ubuntu.md @@ -0,0 +1,94 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12121-1.html) +[#]: subject: (How to Add Multiple Time Zones in Ubuntu) +[#]: via: (https://itsfoss.com/add-multiple-time-zones-ubuntu/) +[#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/) + +如何在 Ubuntu 中添加多个时区 +====== + +> 本快速教程介绍了在 Ubuntu 和其他发行版中使用 GNOME 桌面环境添加多时区时钟的步骤。 + +![](https://img.linux.net.cn/data/attachment/album/202004/18/142021jborblzkglbebrkk.jpg) + +如果你的家人或同事在另一个国家,或者你居住在一个有多个时区的国家,那么了解时差就变得很重要。毕竟,你不想在凌晨 4 点打电话打扰别人。 + +一些 Linux 用户还会记下 [UTC 时间][1],因为大多数服务器都使用 UTC。 + +如果你有多个时钟,那么可以更好地管理此类情况。你可以将一个时钟设置为本地时间,并将其他时钟同步到其他时区。这使得了解不同时间变得更加容易。 + +在本教程中,我将向你展示如何在 Ubuntu 和其他使用 GNOME 桌面环境的 Linux 发行版中添加其他时钟。 + +### 在 Ubuntu(以及其他使用 GNOME 的 Linux)中添加多个时区时钟 + +请[检查你正在使用的桌面环境][2]。本教程仅适用于 GNOME 桌面。 + +要添加其他时钟,可以使用一个叫 [GNOME Clocks][3] 的小程序。 + +GNOME Clocks 是一个简单的应用,它可以显示多个位置的时间和日期。你也可以使用它来设置闹钟或计时器,它还包括秒表功能。 + +GNOME Clocks 存在于 Ubuntu 的 Universe 仓库中。因此,请确保首先[启用 Universe 仓库][4]。 + +你可以在软件中心中搜索 “GNOME Clocks” 并从那里安装它。 + +![Gnome Clocks Ubuntu Software Center][5] + +或者,你可以打开终端并使用以下命令来安装 GNOME Clocks: + +``` +sudo apt install gnome-clocks +``` + +如果你使用的是其他 Linux 发行版,那么请使用发行版的软件中心或软件包管理器来安装此程序。 + +安装后,请按 `Super` 键( `Windows` 键)并搜索 clocks: + +![Gnome Clocks App Search Ubuntu][6] + +启动程序,你应该会看到一个界面,提供一些选项,例如添加世界时钟、设置闹钟、使用秒表和计时器。 + +单击左上角的 “+” 号,它将为你提供搜索地理位置的选项。搜索、选择并添加。 + +![Adding additional clocks][7] + +通过地理位置添加所需的时区后,你可以看到现在在消息托盘中添加了这个新时钟。它还显示了你当地时间与其他时区之间的时差。 + +![Multiple clocks for multiple time zones][8] + +你可以使用 `Super + M` 键快速打开消息托盘。你可以掌握这些[有用的 Ubuntu 快捷方式][9]来节省时间。 + +如果要删除其他时钟,你可以从 GNOME Clocks 应用界面执行以下操作: + +![Remove Additional Clocks][10] + +你无法(在这里)删除当前时区并设置为其他时区。有其他方法[更改 Linux 中的当前时区][11]。 + +我希望你喜欢这个快速技巧。欢迎提出问题和建议。 + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/add-multiple-time-zones-ubuntu/ + +作者:[Abhishek Prakash][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://itsfoss.com/author/abhishek/ +[b]: https://github.com/lujun9972 +[1]: https://en.wikipedia.org/wiki/Coordinated_Universal_Time +[2]: https://itsfoss.com/find-desktop-environment/ +[3]: https://wiki.gnome.org/Apps/Clocks +[4]: https://itsfoss.com/ubuntu-repositories/ +[5]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/04/gnome-clocks-ubuntu-software-center.jpg?ssl=1 +[6]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/04/gnome-clocks-app-search-ubuntu.jpg?ssl=1 +[7]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/04/add-multiple-time-zones-gnome.jpg?ssl=1 +[8]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/04/multiple-clocks-ubuntu.jpg?ssl=1 +[9]: https://itsfoss.com/ubuntu-shortcuts/ +[10]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/04/remove-additional-clocks-ubuntu.jpg?ssl=1 +[11]: https://itsfoss.com/change-timezone-ubuntu/ diff --git a/published/202004/20200413 How to install Python on Linux.md b/published/202004/20200413 How to install Python on Linux.md new file mode 100644 index 0000000000..7a152a5489 --- /dev/null +++ b/published/202004/20200413 How to install Python on Linux.md @@ -0,0 +1,149 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12132-1.html) +[#]: subject: (How to install Python on Linux) +[#]: via: (https://opensource.com/article/20/4/install-python-linux) +[#]: author: (Vijay Singh Khatri https://opensource.com/users/vijaytechnicalauthor) + +如何在 Linux 上安装 Python +====== + +> 在 Linux 上安装最新 Python,替代或与老版本并存的分步说明。 + +![](https://img.linux.net.cn/data/attachment/album/202004/21/094500u63lnlgukgnjb0t0.jpg) + +[Python][2] 现在是[最流行][3]、最常用的编程语言。Python 的简单语法和较低的学习曲线使其成为初学者和专业开发人员的终极选择。Python 还是一种非常通用的编程语言。从 Web 开发到人工智能,它几乎在除了移动开发的所有地方都有使用。 + +如果你使用的是 Python,那么你很有可能是一名开发人员(或想成为一名开发人员),而 Linux 是创建软件的绝佳平台。但是,当你每天使用 Python 时,有时你希望使用最新版本。你可能不想仅仅为了测试最新版本的系统而替换了默认的 Python 安装,因此本文说明了如何在 Linux 上安装最新版本的 Python 3,而不替换发行版提供的版本。 + +使用 `python --version` 终端命令检查是否已安装 Python,如果已安装,那么检查是哪个版本。如果你的 Linux 系统上未安装 Python,或者你想安装更新的版本,请按照以下步骤操作。 + +### 分步安装说明 + +#### 步骤 1:首先,安装构建 Python 所需的开发包 + +在 Debian 上 + +``` +$ sudo apt update +$ sudo apt install build-essential zlib1g-dev \ +libncurses5-dev libgdbm-dev libnss3-dev \ +libssl-dev libreadline-dev libffi-dev curl +``` + +在 Fedora 上: + +``` +$ sudo dnf groupinstall development +``` + +#### 步骤 2:下载最新的稳定版本的 Python 3 + +访问[官方 Python 网站][4]并下载最新版本的 Python 3。下载完成后,你会有一个 `.tar.xz` 归档文件(“tarball”),其中包含 Python 的源代码。 + +#### 步骤 3:解压 tarball + +下载完成后,使用解压程序或 [Linux 的 tar 命令][5]解压压缩包,例如: + +``` +$ tar -xf Python-3.?.?.tar.xz +``` + +#### 步骤 4:配置脚本 + +解压 Python 压缩包后,进入 `configure` 脚本所在目录并在 Linux 终端中使用以下命令执行该脚本: + +``` +$ cd Python-3.* +./configure +``` + +配置可能需要一些时间。等待直到成功完成,然后再继续。 + +#### 步骤 5:开始构建过程 + +如果你的系统上已经安装了某个版本的 Python,并且希望同时安装新版本的 Python,请使用以下命令: + +``` +$ sudo make altinstall +``` + +构建过程可能需要一些时间。 + +如果要使用此版本替换当前版本的 Python,那么应使用包管理器(例如 `apt` 或 `dnf`)卸载当前的 Python 包,然后安装: + +``` +$ sudo make install +``` + +但是,通常最好以软件包的形式(例如 `.deb` 或 `.rpm` 文件)来安装软件,以便系统可以为你跟踪和更新它。因为本文假设尚未打包最新的 Python,所以你可能没有这个选择。在这种情况下,你可以按照建议使用 `altinstall` 来安装 Python,或者使用最新的源代码重构现有的 Python 包。这是一个高级主题,并且特定于你的发行版,因此不在本文讨论范围之内。 + +#### 步骤 6:验证安装 + +如果你没有遇到任何错误,那么现在你的 Linux 系统上已安装了最新的 Python。要进行验证,请在终端中输入以下命令之一: + +``` +python3 --version +``` + +或者 + +``` +python --version +``` + +如果输出显示 `Python 3.x`,那么说明 Python 3 已成功安装。 + +### 创建虚拟环境(可选) + +Python 提供了名为 `venv`(虚拟环境)的软件包,可帮助你将程序目录或软件包与其他目录或软件包隔离。 + +要创建虚拟环境,请在 Python 终端中输入以下内容(在此示例中,假定你安装的 Python 版本为 `3.8` 系列): + +``` +python3.8 -m venv example +``` + +该命令创建一个带有一些子目录的新目录(我将其命名为 `example`)。 + +要激活虚拟环境,请输入: + +``` +$ source example/bin/activate +(example) $ +``` + +请注意,你的终端提示符(`$`)现在以环境名称开头。 + +要停用虚拟环境,请使用 `deactivate` 命令: + +``` +(example) $ deactivate +``` + +### 总结 + +Python 是一种有趣的语言,它的开发和改进非常频繁。一旦了解了如何安装最新版本而又不干扰发行版提供的稳定版本,熟悉新功能将很容易。 + +如果你有任何反馈或问题,请在评论中提出。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/4/install-python-linux + +作者:[Vijay Singh Khatri][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/vijaytechnicalauthor +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/openstack_python_vim_1.jpg?itok=lHQK5zpm (OpenStack source code (Python) in VIM) +[2]: https://www.python.org/ +[3]: http://pypl.github.io/PYPL.html +[4]: http://python.org +[5]: https://opensource.com/article/17/7/how-unzip-targz-file diff --git a/published/202004/20200415 How to Open Files and Folders as Administrator in Nautilus File Manager in Linux.md b/published/202004/20200415 How to Open Files and Folders as Administrator in Nautilus File Manager in Linux.md new file mode 100644 index 0000000000..4b46fad9b3 --- /dev/null +++ b/published/202004/20200415 How to Open Files and Folders as Administrator in Nautilus File Manager in Linux.md @@ -0,0 +1,82 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12128-1.html) +[#]: subject: (How to Open Files and Folders as Administrator in Nautilus File Manager in Linux) +[#]: via: (https://itsfoss.com/open-nautilus-as-administrator/) +[#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/) + +如何在 Linux 的 Nautilus 文件管理器中以管理员身份打开文件和文件夹 +====== + +> 了解如何在 Ubuntu 和其他 Linux 发行版的 Nautilus 文件管理器的右键菜单中添加“以管理员身份打开”选项。 + +![](https://img.linux.net.cn/data/attachment/album/202004/19/211224hurk01u0kuvqnpvn.jpg) + +如果要以根用户身份打开或编辑文件,你总是可以在终端中执行此操作。但我知道有些人对命令行不适应。 + +桌面 Linux 通常为那些害怕终端的人提供方法避免命令行。 + +如果你必须以 root 用户身份访问文件夹或以 root 用户权限编辑文件,那你可以在 [Nautilus 文件管理器][1]中以图形方式进行操作。 + +一个小巧优雅的 Nautilus 技巧能让你以管理员(也就是 root)打开文件和文件夹。让我向你展示如何做。 + +### 在 Nautilus 文件管理器的右键菜单中添加“以管理员身份打开”选项 + +> 警告!请不要以 root 用户身份打开和编辑随机文件,因为这样可能会弄乱文件并导致系统损坏。仅在需要时使用它。 + +我展示的是 Ubuntu 的步骤。你可以根据你的发行版的软件包管理器进行更改。 + +你必须使用终端(即使你不喜欢它)来安装 Nautilus 插件。请[确保已启用 Universe 仓库][4]: + +``` +sudo apt install nautilus-admin +``` + +关闭并再次打开 Nautilus 文件管理器以查看更改生效。 + +![Right clock to see the “Open as Administrator” option][5] + +你也可以用 root 用户身份编辑文件。只需选择文件,右键单击它,然后选择“以管理员身份编辑”选项。 + +![Edit Files As Root Ubuntu][6] + +这两种情况下,系统都会提示你输入帐户密码: + +![You need to enter your password, of course][7] + +差不多了。你可以享受 GUI 的舒适了。 + +如果你不想再以 root 用户身份运行 Nautilus,那么可以删除此插件。删除已安装但不再使用的其他东西总是没错的。 + +在终端中(没错,再一次在终端),使用以下命令删除 Nautilus 插件。 + +``` +sudo apt remove nautilus-admin +``` + +顺便说一句,如果你在使用 [Ubuntu MATE][8],你可以使用 caja-admin 代替 nautilus-admin。其他文件管理器可能会或可能不会提供此类功能。 + +我希望这个快速技巧对你有所帮助。随时欢迎提出问题和建议。 + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/open-nautilus-as-administrator/ + +作者:[Abhishek Prakash][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://itsfoss.com/author/abhishek/ +[b]: https://github.com/lujun9972 +[1]: https://wiki.gnome.org/Apps/Files +[3]: https://itsfoss.com/root-user-ubuntu/ +[4]: https://itsfoss.com/ubuntu-repositories/ +[5]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/04/open-folder-as-administrator-ubuntu.jpg?ssl=1 +[6]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/04/edit-files-as-root-ubuntu.jpg?ssl=1 +[7]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/04/authentication-pop-up-ubuntu.png?ssl=1 +[8]: https://ubuntu-mate.org/ diff --git a/published/202004/20200416 How to package Python applications for Linux.md b/published/202004/20200416 How to package Python applications for Linux.md new file mode 100644 index 0000000000..95b6bba528 --- /dev/null +++ b/published/202004/20200416 How to package Python applications for Linux.md @@ -0,0 +1,169 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12143-1.html) +[#]: subject: (How to package Python applications for Linux) +[#]: via: (https://opensource.com/article/20/4/package-python-applications-linux) +[#]: author: (Moshe Zadka https://opensource.com/users/moshez) + +如何为 Linux 打包 Python 应用 +====== + +> 了解如何使用 dh_virtualenv 来让你的 Python 应用可作为 .deb 包安装。 + +![](https://img.linux.net.cn/data/attachment/album/202004/23/235547iztz5d955t9s9b5t.jpg) + +在基于 Debian 的操作系统(例如 Debian 或 [Elementary OS][2])上安装 Python 应用的一种方法是使用 [dh_virtualenv][3] 工具。它可以构建一个 `.deb` 包,在应用之外封装了一个 Python 虚拟环境,并在安装时进行部署。 + +在本文中,我将以构建一个包含 [HTTPie][4] 工具的包为例来解释如何使用它,以便在无需激活虚拟环境的情况下从命令行测试 HTTP API。 + +### 使用 dh_virtualenv 打包 + +首先,你需要安装 `dh_virtualenv` 所需的工具。`dh_virtualenv` 的[文档][5]提供了所有安装选项。在基于 Debian 的系统上,我输入: + +``` +apt-get install dh-virtualenv devscripts +``` + +尽管不需要 [devscripts][6] 包,但它可以简化后续操作。 + +现在,创建一个目录来保存源码。由于这是一个本地的、非官方的 HTTPie 打包,因此我将其称为 `myhttp`。接下来,让我们在 `myhttp` 内创建一些文件,向 Debian 构建系统提供元数据。 + +首先,创建 `debian/control` 文件: + +``` +Source: myhttp +Section: python +Priority: extra +Maintainer: Jan Doe +Build-Depends: debhelper (>= 9), python3.7, dh-virtualenv (>= 0.8) +Standards-Version: 3.9.5 + +Package: myhttp +Architecture: any +Pre-Depends: dpkg (>= 1.16.1), python3.7, ${misc:Pre-Depends} +Depends: ${misc:Depends} +Description: http client + Useful for doing stuff +``` + +那么这些是什么信息呢?正如 [Debian 文档][8]指出的: + +>“第 1–7 行是源码包的控制信息。第 9–13 行是二进制包的控制信息。” + +以下是我使用的: + +* `Section` 的值对于我们来说大多没有意义,但需要存在。它对给引导式 UI 安装程序提供信息是有意义的,但对于这个包来说,没有意义。 +* `Priority` 对像这样的第三方包的正确值是 `extra`。 +* 强烈建议在 `Maintainer` 字段中填写正确的联系人信息。但不一定非得是你的个人电子邮件,如果包由团队维护,并且你希望将问题发送到团队的邮件别名,例如 `Infrastructure Team `。 +* `Build-Depends` 字段标识你需要 `debhelper`、`python` 和 `dh-virtualenv` 来构建包:包构建过程中将确保这些依赖项在包构建时已安装。 +* `Standards-Version` 字段主要给人看。它表明你遵循的指南。本指南基于 `dh-virtualenv` 的官方文档,它是基于 Debian 的 3.9.5 指南。最好一直将源码包和二进制包命名相同。 +* `Architecture` 字段应为 `Any`,因为除非虚拟环境可能包含一些特定于体系结构的文件。否则,最好选择该字段为 `any`。 +* 保持 `Pre-Depends` 列表不变:它是一种非常严格的依赖关系形式,你很少会需要比这里建议的最小依赖更多的依赖项。依赖项通常由构建系统准确计算,因此没有理由手动指定它们。 +* 如果你的包主要用于内部,那么 `Description` 字段可能只需要最少的信息或者指向公司 wiki 的链接,不然更多的信息会更有用。 + +然后创建 `debian/compat` 文件,它[主要出于历史目的而存在][10]: + +``` +$ echo "9" > debian/compat +``` + +接下来,创建更新日志以告知包用户自上次发布以来发生了什么变化。最简单的方法是使用 `dch --create` 创建模板,然后填写值。 + +填写后,它看起来像: + +``` +myhttp (2.0.0-1) stable; urgency=medium + + * Initial release. + + -- Jan Doe Fri, 27 Mar 2020 01:09:22 +0000 +``` + +现在你需要告诉工具安装 HTTPie,但是哪个版本? + +创建一个宽松版本的 `requirements.in` 文件: + +``` +httpie +``` + +通常,宽松的需求文件将仅包含项目的直接依赖项,并在需要时指定最低版本。不一定总是需要指定最低版本:这些工具通常偏向于将依赖关系转化为“可能的最新版本”。如果你的 Debian 包与一个内部 Python 包相对应,这是内部应用中的一种常见情况,那么宽松的需求文件看起来将很相似:仅包含包名的一行。 + +然后使用 `pip-compile`(可通过安装 PyPI 包 `pip-tools` 获得): + +``` +$ pip-compile requirements.in > requirements.txt +``` + +这会生成一个严格的依赖文件,名为 `requirements.txt`: + +``` +# +# This file is autogenerated by pip-compile +# To update, run: +# +# pip-compile requirements.in +# +certifi==2019.11.28 # via requests +chardet==3.0.4 # via requests +httpie==2.0.0 # via -r requirements.in +idna==2.9 # via requests +pygments==2.6.1 # via httpie +requests==2.23.0 # via httpie +urllib3==1.25.8 # via requests +``` + +最后,写一个 `debian/rules` 文件来创建包。因为 `dh_virtualenv` 会处理所有困难的事,因此规则文件很简单: + +``` +#!/usr/bin/make -f + +%: + dh $@ --with python-virtualenv --python /usr/bin/python3.7 +``` + +确保指定 Python 解释器。默认它会使用 `/usr/bin/python`,这是 Python2,但是你应该使用一个[受支持的 Python 版本][11]。 + +完成了,接下来就是构建包: + +``` +$ debuild -b -us -uc +``` + +这会在父目录生成一个类似 `myhttp_2.0.0-1_amd64.deb` 的文件。该文件可在任何兼容的系统上安装。 + +通常,最好在同一平台上构建用于特定平台(例如 Debian 10.0)的 Debian 包。 + +你可以将此 Debian 包保存在软件仓库中,并使用例如 [Ansible][12] 的工具将其安装在所有相关系统上。 + +### 总结 + +给基于 Debian 的系统的打包应用是一个有着多个步骤的过程。使用 `dh_virtualenv` 将使过程变得简单明了。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/4/package-python-applications-linux + +作者:[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://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/life-python.jpg?itok=F2PYP2wT (Python in a tree) +[2]: https://opensource.com/article/19/12/pantheon-linux-desktop +[3]: https://dh-virtualenv.readthedocs.io/en/latest/ +[4]: https://opensource.com/article/19/8/getting-started-httpie +[5]: https://dh-virtualenv.readthedocs.io/en/1.1/tutorial.html +[6]: http://man.he.net/man1/devscripts +[7]: mailto:jandoe@example.org +[8]: https://www.debian.org/doc/manuals/maint-guide/dreq.en.html#control +[9]: mailto:infra-team-list@company.example.com +[10]: https://www.debian.org/doc/manuals/maint-guide/dother.en.html#compat +[11]: https://opensource.com/article/19/11/end-of-life-python-2 +[12]: https://opensource.com/resources/what-ansible diff --git a/published/202004/20200417 12 Linux Commands to Have Some Fun in the Terminal.md b/published/202004/20200417 12 Linux Commands to Have Some Fun in the Terminal.md new file mode 100644 index 0000000000..d13219c30a --- /dev/null +++ b/published/202004/20200417 12 Linux Commands to Have Some Fun in the Terminal.md @@ -0,0 +1,329 @@ +[#]: collector: (lujun9972) +[#]: translator: (Zioyi) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12149-1.html) +[#]: subject: (12 Linux Commands to Have Some Fun in the Terminal) +[#]: via: (https://itsfoss.com/funny-linux-commands/) +[#]: author: (Community https://itsfoss.com/author/itsfoss/) + +12 个有趣的 Linux 终端命令 +====== + +> 你觉得 Linux 终端里只有无趣的工作吗?那你一定不知道下面这些有趣的 Linux 命令吧。 + +Linux 终端是用来完成复杂的工作的,我们有很多有用的 [linux 命令奇技淫巧][1]来帮助你。 + +但是,你知道你还可以用终端来做很多有趣的事吗?如果你不知道,没关系,大多数 Linux 用户也都只把终端视为一个用来管理系统和开发工作的交互界面。 + +然而,如果你知道这里有些你可以在终端玩的[基于终端的游戏][2]和 [ASCII 码游戏][3],你一定会大吃一惊。 + +在这篇文章中,我将会探索一些有趣的、可笑的、荒谬的命令来让你可以在终端中找点乐子! + +### 用这些命令在 Linux 终端中找点乐子 + +![][4] + +你可能会觉得这些命令荒谬或没用,但是有一些还是可以被好好利用的。 + +我已经放上了 Ubuntu/Debian 的安装指令,如果你使用基于 Ubuntu 的发行版,请确保[启用 universe 仓库][5],因为大多数命令不在主仓库中。 + +如果你使用 Arch、Fedora、SUSE、Solus 或者其他非 Ubuntu 的发行版,请使用你的发行版包管理工具去安装这些有趣的 Linux 命令。 + +#### 1、在终端开一辆火车 + +让我们坐上火车,来一场说走就走的旅行的,没错,就是字面意思! + +`sl` 命令可以让你在终端运行一辆火车。 + +![][6] + +安装方法: + +``` +sudo apt install sl +``` + +完成后,你只要在终端输入下面的命令就可以开始: + +``` +sl +``` + +很精彩,对吧?但等等,我们还没结束!你还可以让你的火车飞起来,只要加上参数 `-F`,波特先生,请飞吧: + +``` +sl -F +``` + +这样会让火车长出翅膀飞出终端窗口! + +#### 2、给你的 Linux 终端加上黑客帝国效果 + +还记得科幻电影[黑客帝国][7]吗?终端里掉落的绿色字符成为了黑客帝国的标志形象。 + +你也可以在你的 Linux 电脑里有这样的黑客帝国数字雨!你只需要安装 `cmatric` 然后在终端输入它就行。 + +![][8] + +在 Debian/Ubuntu Linux 上安装 cmatrix: + +``` +sudo apt install cmatrix +``` + +现在,你要做的就是输入下面的命令,在终端就会有黑客帝国屏幕了: + +``` +cmatrix +``` + +按下 `Ctrl+C` 来停止它,黑客先生。 + +#### 3、燃起来 + +拿好灭火器,因为接下来你要在你的终端里点火了! + +![][11] + +想安装它,你要输入: + +``` +sudo apt install libaa-bin +``` + +完成后,你输入下面的命令,你的终端就会燃起一团火焰: + +``` +aafire +``` + +按下 `Ctrl+C` 来停止它。 + +#### 4、幸运饼干命令 + +想知道你的运气怎样但身边没有幸运饼干? + +别担心,你只需在终端打出 `fortune` 然后按下回车。终端将会随机显示出一个幸运语,就像你从幸运饼干里得到的一样。 + +![][12] + +安装它: + +``` +sudo apt install fortune +``` + +完成后,只要在命令行打出下面的内容,你就会知道你的运气怎样: + +``` +fortune +``` + +这是一个你可以实际使用的命令。你可以用它作为每日消息,这样在多用户环境下,每个用户登录后都会得到一个“幸运饼干”。 + +你也可以把它添加到 `bashrc` 文件,这样当你登进终端你就会看到了。 + +#### 5、宠物爱好者?这是给你准备的 + +`oneko` 是一个有趣的命令,可以把你的光标变成一只老鼠,然后创造一只好奇的猫,一旦你移动光标,就会来追你。这不仅局限于终端。当猫追逐光标时,你可以继续工作。 + +如果你家里有孩子这一定很有趣。 + +![][13] + +用下面的命令安装 `oneko`: + +``` +sudo apt install oneko +``` + +用下面的命令运行它: + +``` +oneko +``` + +如果你不喜欢猫,喜欢狗,输入: + +``` +oneko -dog +``` + +它有很多种小宠物,你可以用 `oneko -help` 获取信息。按下 `Ctrl+C` 终止它。 + +#### 6、有个小兄弟在看着你 + +`xeyes` 是一个很小的 GUI 程序,它可以绘制出一双眼睛一直盯着你!它会不断跟随你的鼠标光标,运行命令自己看看! + +![][14] + +你可以用下面命令安装: + +``` +sudo apt install xeyes +``` + +然后这样用它: + +``` +xeyes +``` + +按下 `Ctrl+C` 终止它。 + +#### 7、让终端帮你讲话 + +打开你的扬声器,你来试试这个命令,[eSpeak][15] 是一个有趣的命令,它可以让你的终端说话。是的,你没听错。 + +先安装这个包: + +``` +sudo apt install espeak +``` + +接下来,你只需要输入在命令行中输入你想听到的话: + +``` +espeak "Type what your computer says" +``` + +无论你在双引号里面填什么,你的电脑都会复述出来!它就像[在 Linux 中的 echo 命令][16],但不是打印出来,而是说出来。 + +#### 8、Toilet(但与洗手间无关) + +这听起来有点奇怪,是的。但是,这只是一个命令,用来将文本转换成大的 ASCII 字符。 + +![][17] + +用这个命令安装 `toilet`: + +``` +sudo apt install toilet +``` + +完成后,你只需输入: + +``` +toilet sample text you want +``` + +我也不知道为啥这个小程序叫 Toilet。 + +#### 9、那个牛说什么? + +`cowsay` 是一个在终端中用 ASCII 字符展示出一头牛的命令。通过这个命令,你可以控制牛说出你想说的话。 + +别纠结声音,它只展示文本(就是你看漫画书一样)。 + +![Cowsay Cowthink][18] + +安装 `cowsay`: + +``` +sudo apt install cowsay +``` + +安装完成后,你只要输入: + +``` +cowsay "your text" +``` + +无论你在双引号里填什么,你的牛都会说!我看到一些系统管理员用它来展示每天的消息。你也可以这样,你甚至可以把它和 `fortune` 命令结合。 + +#### 10、旗帜 + +`banner` 命令与 `toilet` 命令相似,但它限制最多只能打印 10 个字符。 + +![][19] + +你可以这样安装 `banner` 命令: + +``` +sudo apt install sysvbanner +``` + +然后这样运行: + +``` +banner "Welcome" +``` + +替换双引号里的内容,你将会得到你想要的展示内容。 + +#### 11、Yes + +![][20] + +`yes` 命令帮助你在循环中自动响应直到终止命令。这个命令将会一直打印相同的内容。如果你想快速生成大量垃圾文本,那么此命令将像超级按钮一样工作。 + +你也可以使用它为命令提供 `yes` 应答(如果提示应答时)。例如,`apt upgrade` 命令会要求你确认,你可以像这样使用它: + +``` +yes | sudo apt upgrade +``` + +你不需要安装任何包,`yes` 命令已经存在了。 + +想要终止 `yes` 命令循环,只需按下 `CTRL+C`。 + +#### 12、得到一个新的身份 + +要生成一个随机的假身份吗?我推荐你用 `rig` 命令。你在终端运行它,就会生成一个假的身份。 + +![][21] + +用这个命令安装 `rig`: + +``` +sudo apt install rig +``` + +只需像这样输入: + +``` +rig +``` + +它可能被用在脚本或者 web 应用中展示随机信息,但我自己还没做过什么。 + +### 结尾 + +我希望你会喜欢这个有趣的 Linux 命令列表。你最喜欢哪个命令呢?你还知道其他有趣的命令吗?请在评论部分与我们分享。 + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/funny-linux-commands/ + +作者:[Srimanta Koley][a] +选题:[lujun9972][b] +译者:[Zioyi](https://github.com/Zioyi) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://itsfoss.com/author/itsfoss/ +[b]: https://github.com/lujun9972 +[1]: https://itsfoss.com/linux-command-tricks/ +[2]: https://itsfoss.com/best-command-line-games-linux/ +[3]: https://itsfoss.com/best-ascii-games/ +[4]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/04/fun-linux-commands.png?ssl=1 +[5]: https://itsfoss.com/ubuntu-repositories/ +[6]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/04/sl-command.jpg?ssl=1 +[7]: https://en.wikipedia.org/wiki/The_Matrix +[8]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/04/matrix-screen-command.png?ssl=1 +[9]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2015/12/Star-Wars-Linux-Terminal-2.png?fit=732%2C462&ssl=1 +[10]: https://itsfoss.com/star-wars-linux/ +[11]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/04/fire-command.png?ssl=1 +[12]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/04/fortune-command.jpg?ssl=1 +[13]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/04/oneko-command.jpg?ssl=1 +[14]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/04/xeyes-command.jpg?ssl=1 +[15]: https://itsfoss.com/espeak-text-speech-linux/ +[16]: https://linuxhandbook.com/echo-command/ +[17]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/04/toilet-command.jpg?ssl=1 +[18]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/04/cowsay-cowthink.jpg?ssl=1 +[19]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/04/banner-command.jpg?ssl=1 +[20]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/04/yes-yourtext.jpg?ssl=1 +[21]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/04/rig-command.jpg?ssl=1 +[22]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/03/srimanta.jpg?ssl=1 diff --git a/published/202004/20200418 Ethernet consortium announces completion of 800GbE spec.md b/published/202004/20200418 Ethernet consortium announces completion of 800GbE spec.md new file mode 100644 index 0000000000..c909b1fb0e --- /dev/null +++ b/published/202004/20200418 Ethernet consortium announces completion of 800GbE spec.md @@ -0,0 +1,51 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12138-1.html) +[#]: subject: (Ethernet consortium announces completion of 800GbE spec) +[#]: via: (https://www.networkworld.com/article/3538529/ethernet-consortium-announces-completion-of-800gbe-spec.html) +[#]: author: (Andy Patrizio https://www.networkworld.com/author/Andy-Patrizio/) + +以太网技术联盟宣布完成 800Gb 以太网规范 +====== + +> 800Gb 以太网规范使当前以太网标准的最高速度提高了一倍,但同时也对包括延迟在内的其他方面进行了调整。 + +![](https://images.techhive.com/images/article/2017/05/170522-networking-2-100723415-large.jpg) + +由业界支持的以太网技术联盟Ethernet Technology Consortium(ETC)已宣布完成 800Gb 以太网技术规范。 + +新规范基于当前高端 400Gb 以太网协议中使用的许多技术,新规范正式称为 800GBASE-R。设计它的联盟(当时称为 25Gb 以太网联盟)在开发 25、50 和 100Gb 以太网协议方面也发挥了重要作用,其成员包括 博通、思科、谷歌和微软。 + +800Gb 以太网规范增加了新的介质访问控制media access control(MAC)和物理编码子层physical coding sublayer(PCS)方法,新规范对这些功能进行了调整,来使用 8 条 106.25Gbps 的物理通道分发数据。(通道可以是铜双绞线,也可以是光缆,一束光纤或光波。)800GBASE-R 规范建立在两个 400 GbE 2xClause PCS 之上,以创建一个以 800Gbps 的总速率运行的单个 MAC。 + +尽管主要是使用八条 106.25Gb 通道,但这并不是固定的。它可以以一半的速度 (53.125Gbps) 使用 16 条通道。 + +新标准提供了 400G 以太网规范的一半延迟,但是新规范也将运行在 50 Gbps、100 Gbps 和 200 Gbps 的网络上的前向纠错forward error correction(FEC)开销减少了一半,从而减少了网卡上的数据包处理负担。 + +通过降低延迟,这将满足对延迟敏感的应用(例如[高性能计算][2]和人工智能)中对速度的需求,在这些应用中,需要尽可能快地移动大量数据。 + +从 400G 增加到 800G 并不是太大的技术飞跃。它意味着在相同的传输速率下增加更多的通道,再做一些调整。但是,要想突破 Tb 级,Cisco 和其他网络公司已经讨论了十年了,这将需要对技术进行重大修改,而且并非易事。 + +新技术可能也不便宜。800G 可与现有硬件一起使用,而 400Gb 以太网交换机价格不菲,高达六位数。对技术进行重大修改,越过 Tb 障碍,可能会变得更加昂贵。但是对于大客户和高性能计算客户而言,这也是情理之中的事。 + +ETC 并未透露何时会支持 800G 的新硬件,但考虑到它对现有规格的变化不大,它可能会在今年出现,前提是疫情引起的停滞不会影响它。 + +-------------------------------------------------------------------------------- + +via: https://www.networkworld.com/article/3538529/ethernet-consortium-announces-completion-of-800gbe-spec.html + +作者:[Andy Patrizio][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://www.networkworld.com/author/Andy-Patrizio/ +[b]: https://github.com/lujun9972 +[2]: https://www.networkworld.com/article/3444399/high-performance-computing-do-you-need-it.html +[3]: https://www.networkworld.com/blog/itaas-and-the-corporate-storage-technology/?utm_source=IDG&utm_medium=promotions&utm_campaign=HPE22140&utm_content=sidebar (ITAAS and Corporate Storage Strategy) +[4]: https://www.facebook.com/NetworkWorld/ +[5]: https://www.linkedin.com/company/network-world diff --git a/published/202004/20200421 MystiQ- A Free and Open Source Audio-Video Converter.md b/published/202004/20200421 MystiQ- A Free and Open Source Audio-Video Converter.md new file mode 100644 index 0000000000..c4c99dac95 --- /dev/null +++ b/published/202004/20200421 MystiQ- A Free and Open Source Audio-Video Converter.md @@ -0,0 +1,88 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12160-1.html) +[#]: subject: (MystiQ: A Free and Open Source Audio/Video Converter) +[#]: via: (https://itsfoss.com/mystiq/) +[#]: author: (Ankush Das https://itsfoss.com/author/ankush/) + +MystiQ:一个自由开源的音视频转换器 +====== + +![](https://img.linux.net.cn/data/attachment/album/202004/28/223258cr9rxzyrj344kh68.jpg) + +> MystiQ 是一款全新的开源视频转换工具,适用于 Linux 和 Windows。它的底层使用 FFMPEG,并为你提供了一个基于 Qt 的整洁干净的图形界面。 + +### MystiQ,一个基于 QT 的 FFmpeg GUI 前端 + +![][1] + +音频/视频转换工具可为每位跨多个平台的计算机用户提供方便。 + +出于同样的原因,我想着重介绍 [MystiQ][2] 是个好主意,这是一个相对较新的视频/音频转换器工具,适用于 Linux 和 Windows。截至目前,它还不支持 macOS,但可能会在不久的将来支持。 + +MystiQ 是基于 [Qt 5 界面][4]的 [FFmpeg][3] 图形前端。现在,你可以随时[在 Linux 命令行中安装并使用 ffmpeg][5],但这不是很舒服,是吗?这就是为什么 [Handbrake][6] 和 MystiQ 之类的工具可以使我们的生活更方便的原因。 + +由于 MystiQ 基于 FFmpeg,因此你可以将其用于一些基本的视频编辑,例如修剪、旋转等。 + +让我们来看看它的功能。 + +### MystiQ 视频转换器的功能 + +![][7] + +即使 MystiQ 目前还算是一个新事物,但它也包含了一组很好的基本功能。以下它提供的: + + * 视频转换 + * 音频转换(也可从视频中提取音频) + * 支持的格式:MP4、WEBM、MKV、MP3、MOV、OGG、WAV、ASF、FLV、3GP、M4A 等。 + * 跨平台(Windows 和 Linux) + * 适用于 32 位和 64 位系统的安装包 + * 能够调整音频质量(采样率、比特率等)进行转换 + * 基本的视频编辑功能(剪辑视频、插入字幕、旋转视频、缩放视频等) + * 将彩色视频转换为黑白 + * 有几个预设方案,可轻松转换视频以获得最佳质量或获得最佳压缩效果。 + +### 安装 MystiQ + +你可能没有在软件中心中找到它,但将它安装在 Linux 发行版上非常容易。 + +它提供了 .AppImage 文件和 .deb / .rpm 文件(32 位和 64 位软件包)。如果你不清楚如何使用的话,可以阅读[如何使用 AppImage 文件][10]。 + +如果你想帮助他们测试软件进行改进,你还可以找到他们的 [GitHub 页面][11],并查看源码或任何近期的预发布软件包。 + +你可以在其官方网站下载适用于 Linux 和 Windows 的安装程序文件。 + +- [下载 MystiQ][2] + +### 总结 + +在本文中,我使用 [Pop!_OS][12] 20.04 测试了 MytiQ 转换器,并且在转换视频和音频时没遇到任何问题。而且,对于像我这样的普通用户来说,它的转换速度足够快。 + +欢迎尝试一下,让我知道你对它的想法!另外,如果你在 Linux 上一直使用其他工具转换视频和音频,那它是什么? + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/mystiq/ + +作者:[Ankush Das][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://itsfoss.com/author/ankush/ +[b]: https://github.com/lujun9972 +[1]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/04/mystiq-converter-ft.jpg?ssl=1 +[2]: https://mystiqapp.com/ +[3]: https://www.ffmpeg.org/ +[4]: https://www.qt.io/ +[5]: https://itsfoss.com/ffmpeg/ +[6]: https://itsfoss.com/handbrake/ +[7]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/04/mystiq-options.jpg?ssl=1 +[9]: https://itsfoss.com/sound-converter-linux/ +[10]: https://itsfoss.com/use-appimage-linux/ +[11]: https://github.com/swl-x/MystiQ/ +[12]: https://system76.com/pop diff --git a/published/202004/20200422 How to Check the Available Network Interfaces, Associated IP Addresses, MAC Addresses, and Interface Speed on Linux.md b/published/202004/20200422 How to Check the Available Network Interfaces, Associated IP Addresses, MAC Addresses, and Interface Speed on Linux.md new file mode 100644 index 0000000000..8464da643e --- /dev/null +++ b/published/202004/20200422 How to Check the Available Network Interfaces, Associated IP Addresses, MAC Addresses, and Interface Speed on Linux.md @@ -0,0 +1,198 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12165-1.html) +[#]: subject: (How to Check the Available Network Interfaces, Associated IP Addresses, MAC Addresses, and Interface Speed on Linux) +[#]: via: (https://www.2daygeek.com/linux-unix-check-network-interfaces-names-nic-speed-ip-mac-address/) +[#]: author: (Magesh Maruthamuthu https://www.2daygeek.com/author/magesh/) + +如何在 Linux 上检查网卡信息 +====== + +![](https://img.linux.net.cn/data/attachment/album/202004/29/214835m1ms3n00s6qbcycz.jpg) + +默认情况下,在设置服务器时你会配置主网络接口。这是每个人所做的构建工作的一部分。有时出于各种原因,你可能需要配置额外的网络接口。 + +这可以是通过网络绑定bonding/协作teaming来提供高可用性,也可以是用于应用需求或备份的单独接口。 + +为此,你需要知道计算机有多少接口以及它们的速度来配置它们。 + +有许多命令可检查可用的网络接口,但是我们仅使用 `ip` 命令。以后,我们会另外写一篇文章来全部介绍这些工具。 + +在本教程中,我们将向你显示可用网络网卡(NIC)信息,例如接口名称、关联的 IP 地址、MAC 地址和接口速度。 + +### 什么是 ip 命令 + +[ip 命令][1] 类似于 `ifconfig`, 用于分配静态 IP 地址、路由和默认网关等。 + +``` +# ip a + +1: lo: mtu 65536 qdisc noqueue state UNKNOWN + link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00 + inet 127.0.0.1/8 scope host lo + inet6 ::1/128 scope host + valid_lft forever preferred_lft forever +2: eth0: mtu 1500 qdisc pfifo_fast state UP qlen 1000 + link/ether fa:16:3e:a0:7d:5a brd ff:ff:ff:ff:ff:ff + inet 192.168.1.101/24 brd 192.168.1.101 scope global eth0 + inet6 fe80::f816:3eff:fea0:7d5a/64 scope link + valid_lft forever preferred_lft forever +``` + +### 什么是 ethtool 命令 + +`ethtool` 用于查询或控制网络驱动或硬件设置。 + +``` +# ethtool eth0 +``` + +### 1)如何在 Linux 上使用 ip 命令检查可用的网络接口 + +在不带任何参数的情况下运行 `ip` 命令时,它会提供大量信息,但是,如果仅需要可用的网络接口,请使用以下定制的 `ip` 命令。 + +``` +# ip a |awk '/state UP/{print $2}' + +eth0: +eth1: +``` + +### 2)如何在 Linux 上使用 ip 命令检查网络接口的 IP 地址 + +如果只想查看 IP 地址分配给了哪个接口,请使用以下定制的 `ip` 命令。 + +``` +# ip -o a show | cut -d ' ' -f 2,7 +或 +ip a |grep -i inet | awk '{print $7, $2}' + +lo 127.0.0.1/8 +192.168.1.101/24 +192.168.1.102/24 +``` + +### 3)如何在 Linux 上使用 ip 命令检查网卡的 MAC 地址 + +如果只想查看网络接口名称和相应的 MAC 地址,请使用以下格式。 + +检查特定的网络接口的 MAC 地址: + +``` +# ip link show dev eth0 |awk '/link/{print $2}' +00:00:00:55:43:5c +``` + +检查所有网络接口的 MAC 地址,创建该脚本: + +``` +# vi /opt/scripts/mac-addresses.sh + +#!/bin/sh +ip a |awk '/state UP/{print $2}' | sed 's/://' | while read output; +do + echo $output: + ethtool -P $output +done +``` + +运行该脚本获取多个网络接口的 MAC 地址: + +``` +# sh /opt/scripts/mac-addresses.sh + +eth0: +Permanent address: 00:00:00:55:43:5c +eth1: +Permanent address: 00:00:00:55:43:5d +``` + +### 4)如何在 Linux 上使用 ethtool 命令检查网络接口速度 + +如果要在 Linux 上检查网络接口速度,请使用 `ethtool` 命令。 + +检查特定网络接口的速度: + +``` +# ethtool eth0 |grep "Speed:" + +Speed: 10000Mb/s +``` + +检查所有网络接口速度,创建该脚本: + +``` +# vi /opt/scripts/port-speed.sh + +#!/bin/sh +ip a |awk '/state UP/{print $2}' | sed 's/://' | while read output; +do + echo $output: + ethtool $output |grep "Speed:" +done +``` + +运行该脚本获取多个网络接口速度: + +``` +# sh /opt/scripts/port-speed.sh + +eth0: +Speed: 10000Mb/s +eth1: +Speed: 10000Mb/s +``` + +### 5)验证网卡信息的 Shell 脚本 + +通过此 shell 脚本你可以收集上述所有信息,例如网络接口名称、网络接口的 IP 地址,网络接口的 MAC 地址以及网络接口的速度。创建该脚本: + +``` +# vi /opt/scripts/nic-info.sh + +#!/bin/sh +hostname +echo "-------------" +for iname in $(ip a |awk '/state UP/{print $2}') +do + echo "$iname" + ip a | grep -A2 $iname | awk '/inet/{print $2}' + ip a | grep -A2 $iname | awk '/link/{print $2}' + ethtool $iname |grep "Speed:" +done +``` + +运行该脚本检查网卡信息: + +``` +# sh /opt/scripts/nic-info.sh + +vps.2daygeek.com +---------------- +eth0: +192.168.1.101/24 +00:00:00:55:43:5c +Speed: 10000Mb/s +eth1: +192.168.1.102/24 +00:00:00:55:43:5d +Speed: 10000Mb/s +``` + +-------------------------------------------------------------------------------- + +via: https://www.2daygeek.com/linux-unix-check-network-interfaces-names-nic-speed-ip-mac-address/ + +作者:[Magesh Maruthamuthu][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://www.2daygeek.com/author/magesh/ +[b]: https://github.com/lujun9972 +[1]: https://www.2daygeek.com/ip-command-configure-network-interface-usage-linux/ +[2]: https://www.2daygeek.com/category/shell-script/ diff --git a/published/202004/20200422 Things You Should Know About Ubuntu 20.04.md b/published/202004/20200422 Things You Should Know About Ubuntu 20.04.md new file mode 100644 index 0000000000..a6a56b25f2 --- /dev/null +++ b/published/202004/20200422 Things You Should Know About Ubuntu 20.04.md @@ -0,0 +1,129 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12158-1.html) +[#]: subject: (Things You Should Know About Ubuntu 20.04) +[#]: via: (https://itsfoss.com/ubuntu-20-04-faq/) +[#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/) + +关于 Ubuntu 20.04 你应该了解的事情 +====== + +[Ubuntu 20.04][1] 已经发布,你可能对升级、安装等有一些问题和疑问。 + +我在各种社交媒体渠道上主持了一些问答环节,回答像你这样的读者的疑虑。我将列出这些关于 Ubuntu 20.04 的常见问题,并给出答案。我希望它能帮助你消除你的疑虑。如果你仍有问题,请随时在下面的评论栏提问。 + +### Ubuntu 20.04:已回复的问题 + +![][2] + +为了澄清一下,这里的一些答案也许受我个人意见的影响。如果你是一个有经验的 Ubuntu 用户,有些问题听起来可能有点愚蠢,但它对 Ubuntu 新用户不是这样。 + +#### Ubuntu 20.04 何时发布? + +Ubuntu 20.04 LTS 于 2020 年 4 月 23 日发布。所有变种,如 Kubuntu、Lubuntu,、Xubuntu、Budgie、MATE 都将和 20.04 同一天发布。 + +#### Ubuntu 20.04 的系统要求是什么? + +对于默认的 GNOME 版本,应至少具有 4GB 的内存、2GHz 双核处理器和至少 25GB 的磁盘空间。 + +其他 [Ubuntu 变种][3]可能有不同的系统要求。 + +#### 我可以在 32 位系统上使用 Ubuntu 20.04 吗? + +完全不行。你不能在 32 位系统上使用 Ubuntu 20.04。即使你使用的是 32 位 Ubuntu 18.04,也不能升级到 Ubuntu 20.04。32 位的系统 ISO 是以前用的。 + +![Error while upgrading 32-bit Ubuntu 18.04 to Ubuntu 20.04][4] + +#### 我可以在 Ubuntu 20.04 上使用 Wine 吗? + +是的,你仍然可以在 Ubuntu 20.04 上使用 Wine,因为仍然用于 Wine 和 [Steam Play][5] 软件包所需的 32 位库。 + +#### 我需要购买 Ubuntu 20.04 或许可证? + +不,Ubuntu 完全可以免费使用。你不必像在 Windows 中那样购买许可证密钥或激活 Ubuntu。 + +Ubuntu 的下载页会请求你捐赠一些资金,如果你想为开发这个强大的操作系统捐钱,由你自己决定。 + +#### GNOME 版本是什么? + +Ubuntu 20.04 有 GNOME 3.36。 + +#### Ubuntu 20.04 的性能是否优于 Ubuntu 18.04? + +是的,在几个方面。Ubuntu 20.04 系统速度更快,甚至超快。我在下面这个视频的 4:40 处展示了性能对比。 + +- [video](https://img.linux.net.cn/static/video/Top%207%20Best%20Features%20You%27ll%20Love%20in%20Ubuntu%2020.04-lpq8pm_xkSE.mp4) + +在 GNOME 3.36 中,滚动、窗口动画和其他 UI 元素更加流畅,提供了更流畅的体验。 + +#### Ubuntu 20.04 将支持多长时间? + +它是一个长期支持(LTS)版本,与任何 LTS 版本一样,它将在五年内得到支持。这意味着 Ubuntu 20.04 将在 2025 年 4 月之前获得安全和维护更新。 + +#### 升级到 Ubuntu 20.04 时,是否会丢失数据? + +你可以从 Ubuntu 19.10 或 Ubuntu 18.04 升级到 Ubuntu 20.04。你无需创建 live USB 并从中安装。你所需要的是一个良好的互联网连接,来下载约 1.5GB 的数据。 + +从现有系统升级不会破坏你的文件。你应该会留有所有文件,并且大多数现有软件应具有相同的版本或升级后的版本。 + +如果你使用了某些第三方工具或[其他 PPA][6],升级过程将禁用它们。如果 Ubuntu 20.04 可以使用这些其他存储库,那么可以再次启用它们。 + +升级大约需要一个小时,重启后,你将登录到新版本。 + +虽然你的数据不会被触碰,并且不会丢失系统文件和配置,但最好在外部设备备份重要数据。 + +#### 何时可以升级到 Ubuntu 20.04? + +![][7] + +如果你正在使用 Ubuntu 19.10 并有正确的更新设置(如前面部分所述),那么应在发布后的几天内通知你升级到 Ubuntu 20.04。 + +对于 Ubuntu 18.04 用户,可能需要几周时间才能正式通知他们 Ubuntu 20.04 可用。可能,你可能会在第一个点版本 Ubuntu 20.04.1 后获得提示。 + +#### 如果我升级到 Ubuntu 20.04,我可以降级到 19.10 或 18.04 吗? + +不行。虽然升级到新版本很容易,但无法选择降级。如果你想回到 Ubuntu 18.04,你需要重新[安装 Ubuntu 18.04][8]。 + +#### 我使用的是 Ubuntu 18.04 LTS。我应该升级到 Ubuntu 20.04 LTS 吗? + +这取决于你。如果你对 Ubuntu 20.04 中的新功能印象深刻,并希望上手尝试,那么你应该升级。 + +如果你想要一个更稳定的系统,我建议等待第一个点版本 Ubuntu 20.04.1,新版本会有 bug 修复。20.04.1 通常在 Ubuntu 20.04 发布后大约两个月到来。 + +无论是那种情况,我都建议你或早或晚升级到 Ubuntu 20.04。Ubuntu 20.04 具有更新的内核、性能改进,尤其是仓库中有更新版本的软件。 + +在外部磁盘上进行备份,并且有良好的互联网连接,升级不应成为问题。 + +#### 我应该重新安装 Ubuntu 20.04 还是从 18.04/19.10 升级到 Ubuntu? + +如果你可以选择,请备份数据,并重新安装 Ubuntu 20.04。 + +从现有版本升级到 20.04 是一个方便的选择。然而,在我看来,它仍然保留有一些旧版本的痕迹/包。全新安装更加干净。 + +#### 关于 Ubuntu 20.04 的任何其他问题? + +如果你对 Ubuntu 20.04 有任何疑问,请随时在下面发表评论。如果你认为应该将其他信息添加到列表中,请让我知道。 + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/ubuntu-20-04-faq/ + +作者:[Abhishek Prakash][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://itsfoss.com/author/abhishek/ +[b]: https://github.com/lujun9972 +[1]: https://linux.cn/article-12142-1.html +[2]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/04/ubuntu_20_04_faq.jpg?ssl=1 +[3]: https://itsfoss.com/which-ubuntu-install/ +[4]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/04/ubuntu-32-bit.jpg?ssl=1 +[5]: https://itsfoss.com/steam-play/ +[6]: https://itsfoss.com/ppa-guide/ +[7]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/03/upgrade-ubuntu-20-04.jpg?ssl=1 +[8]: https://itsfoss.com/install-ubuntu/ diff --git a/published/202004/20200424 Ubuntu 20.04 LTS Released. Download Now.md b/published/202004/20200424 Ubuntu 20.04 LTS Released. Download Now.md new file mode 100644 index 0000000000..fcd11c0e8d --- /dev/null +++ b/published/202004/20200424 Ubuntu 20.04 LTS Released. Download Now.md @@ -0,0 +1,121 @@ +[#]: collector: (lujun9972) +[#]: translator: (wxy) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12146-1.html) +[#]: subject: (Ubuntu 20.04 LTS Released. Download Now!) +[#]: via: (https://itsfoss.com/download-ubuntu-20-04/) +[#]: author: (Ankush Das https://itsfoss.com/author/ankush/) + +Ubuntu 20.04 LTS 下载及新特性 +====== + +> Ubuntu 20.04 LTS Focal Fossa 终于发布了。以下是 Ubuntu 20.04 的新功能和下载链接,以及Ubuntu 20.04的官方风味版。 + +等待终于结束了。Ubuntu 20.04 LTS 终于来了,可以下载了! + +![][1] + +如果你已经在使用 Ubuntu 19.10,你可能发现没有太多明显的差异 —— 但我所看到的改进清单确实令人印象深刻。 + +如果你想知道有什么新的东西,我将会提到这个版本的几个主要亮点。 + +### Ubuntu 20.04 有什么新特性? + +与之前的 18.04 LTS 版本相比,Ubuntu 20.04 LTS 有很多视觉上的改变,同时也包括了一些底层的改进。 + +当然,随着 [GNOME 3.36][2] 的加入,视觉上的重大升级和性能上的提升是相当明显的。以下是一段视频,重点介绍了 Ubuntu 20.04 中的新功能。 + +- [What's New in Ubuntu 20.04 Take a Look at the Top Features](https://youtu.be/9u5B0njRgOw) + +如果你有兴趣的话,你也可以深入到我们的文章中去看看,重点介绍 [Ubuntu 20.04 的新功能][3]。 + +不管是哪种情况,让我来给你介绍一些亮点。 + + * GNOME 3.36 是默认的桌面系统 + * 性能提高了很多 + * 新的 Yaru 主题很华丽,也有黑暗模式。 + * 你不会再看到亚马逊应用程序,它已经永远消失了! + * 改进的 [ZFS][4] 支持 + * 你可以获得最新的 [Linux 内核 5.4][5](LTS) + * 增加了对 exFAT 的支持 + * 改进硬件和图形支持 + * 更新软件 Python 3.8.2 + * Wireguard 已被移植到 Linux 内核5.4,可以在 Ubuntu 20.04 上使用。 + +如果你想看详细的功能介绍,请观看这段视频,重点介绍 20.04 LTS 的最佳功能。 + +- [Top 7 Best Features You'll Love in Ubuntu 20.04](https://youtu.be/lpq8pm_xkSE) + +如果你是 Ubuntu 的新手,对 Ubuntu 20.04 有疑问,我们也为你提供了一篇快速的 [Ubuntu 20.04 FAQ][7] 文章。 + +### 从 18.04 和 19.10 升级到 Ubuntu 20.04 + +如果你已经在使用 Ubuntu 18.04 或 19.10,你可以从系统中轻松升级到 Ubuntu 20.04。 + +这样一来,当你开始使用新版本的时候,你的文件和大部分的应用程序设置都会保持原样,而无需从 ISO 中重新安装。 + +你可以阅读此详细教程来学习[如何将 Ubuntu 升级到新版本][8]。 + +请注意,如果你使用的是 Lubuntu 18.04,请不要升级到 Lubuntu 20.04。Lubuntu 18.04 使用的是 Lxde 桌面,而后面的版本使用的是 LXQt 桌面。这样升级可能会导致冲突和系统崩溃。 + +### 下载 Ubuntu 20.04 LTS + +你可以抓取 ISO 或 torrent 文件,这取决于你喜欢什么。 + +- [Ubuntu 20.04 LTS (ISO)][9] +- [Ubuntu 20.04 LTS (Torrent)][10] + +请按照本教程学习[如何安装 Ubuntu][11]。 + +### 下载Ubuntu 20.04 LTS官方版下载 + +如果你想在不同的桌面环境下得到 Ubuntu 的官方版本,请按照下面的链接进行操作。 + +- [Ubuntu MATE 20.04 LTS][12] +- [Kubuntu 20.04 LTS][13] +- [Xubuntu 20.04 LTS][14] +- [Ubuntu Budgie 20.04 LTS][15] +- [Ubuntu Studio 20.04 LTS][16] +- [Lubuntu 20.04 LTS][17] + +如果你没有在各自的官方网站上找到最新的 ISO/torrent 文件,只需前往 [cdimages.ubuntu.com][18] 找到所有的版本。 + +接下来,导航到“发行版名称” -> “releases” -> “20.04” -> “release”,然后你应该可以找到列出的 ISO 和 torrent 文件的链接。 + +如果你有问题,请参考这篇文章,它回答了[关于 Ubuntu 20.04 的常见问题][7]。如果你要安装,请查看我们推荐的[安装 Ubuntu 20.04 之后要做的事情][19]。 + +享受 Ubuntu 20.04 LTS Focal Fossa! + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/download-ubuntu-20-04/ + +作者:[Ankush Das][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://itsfoss.com/author/ankush/ +[b]: https://github.com/lujun9972 +[1]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/04/Ubuntu-20.04-LTS-released.png?ssl=1 +[2]: https://itsfoss.com/gnome-3-36-release/ +[3]: https://itsfoss.com/ubuntu-20-04-release-features/ +[4]: https://itsfoss.com/what-is-zfs/ +[5]: https://itsfoss.com/linux-kernel-5-4/ +[6]: https://www.youtube.com/c/itsfoss?sub_confirmation=1 +[7]: https://itsfoss.com/ubuntu-20-04-faq/ +[8]: https://itsfoss.com/upgrade-ubuntu-version/ +[9]: http://releases.ubuntu.com/focal/ubuntu-20.04-desktop-amd64.iso +[10]: http://releases.ubuntu.com/focal/ubuntu-20.04-desktop-amd64.iso.torrent +[11]: https://itsfoss.com/install-ubuntu/ +[12]: https://ubuntu-mate.org/download/amd64/focal/ +[13]: https://kubuntu.org/getkubuntu/ +[14]: https://xubuntu.org/download/ +[15]: https://ubuntubudgie.org/downloads/ +[16]: https://ubuntustudio.org/ +[17]: https://lubuntu.me/downloads/ +[18]: http://cdimages.ubuntu.com/ +[19]: https://itsfoss.com/things-to-do-after-installing-ubuntu-20-04/ diff --git a/published/202004/20200424 What you need to know about open source ad blockers.md b/published/202004/20200424 What you need to know about open source ad blockers.md new file mode 100644 index 0000000000..c28cbc6080 --- /dev/null +++ b/published/202004/20200424 What you need to know about open source ad blockers.md @@ -0,0 +1,56 @@ +[#]: collector: (lujun9972) +[#]: translator: (CrazyShipOne) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12157-1.html) +[#]: subject: (What you need to know about open source ad blockers) +[#]: via: (https://opensource.com/article/20/4/ad-blockers) +[#]: author: (Joshua Pearce https://opensource.com/users/jmpearce) + +开源的广告拦截器不但节能,而且能拯救生命! +====== +> 三个开源广告拦截器与“无广告拦截器”对照组进行了测试。 + +![](https://img.linux.net.cn/data/attachment/album/202004/27/220109b86sidn56sn6inoh.jpg) + +一项旨在调查自由开源的广告拦截器节能的情况的[研究][2],意外地发现了互联网广告正在浪费你大量的时间。 + +更重要的是,研究结果表明了你可以挽救回这些失去的时间。这项研究评估发现,使用 [uBlock Origin][3](一个开源免费的广告拦截器)的情况下平均每个网民一年可以节约超过 100 个小时的时间。uBlock Origin 是测试中最有效的广告拦截器,不过其他的广告拦截器也为网民节省了时间、能源以及金钱。 + +![Ad blocker screen comparison][4] + +在研究结果中,[AdBlock+][5] 减少了 11% 的页面加载时间,[Privacy Badger][6] 减少了 22%,[uBlock Origin][3] 减少了 28%。对于单独一个页面来说这个时间並不算多,但是网民们一半以上的浏览时间都是在网站间快速跳转,通常在一个页面停留少于 15 秒。鉴于这种情况,加载广告的额外时间加起来就很多了。 + +发布于 Technologies 杂志上的《[用开源的广告拦截器节能][7]》一文最初旨在解决日益增长的能源消耗问题。随着全球网民每日上网时间超过 6.5 小时,与互联网相关的用电量正在快速地增加。以美国人为例,自 2000 年他们的上网时间已经增加了一倍,几乎达到每周 24 小时。开源广告拦截器通过消灭上网和观看视频时产生的广告,潜在地减少了时间,从而减少用电。 + +在研究过程中,对三个开源广告拦截器与“无广告拦截器”对照组进行了测试。研究人员记录了浏览全球访问量最大的网站的页面加载时间,其中包括网络搜索(谷歌、雅虎、必应)、信息(Weather.com、维基百科)和新闻网站(CNN、福克斯、纽约时报)。除此之外,研究还分析了观看流行与非流行视频内容时广告所花费的时间。这部分研究由于缺乏 Youtube 上流行和非流行内容观看比例的数据而非常具有挑战性。每个视频浪费在广告观看上的时间可以从 0.06% 到惊人的 21% 不等。而且,这还只是浏览器上记录的加载广告而失去的时间。 + +总的来说,研究结果表明加载广告所浪费的能源并不是是小事。由于运行电脑所使用的大量电力仍然来自于煤炭,而煤炭会造成空气污染和过早死亡,因此该研究分析了广告拦截器拯救美国人生命的潜力。(LCTT 译注:由于这项研究是美国人完成的,所以这里仅提及了美国人,但是同理可推至全球。)结果是令人震惊的:如果美国人都使用开源广告拦截器,每年节约的能源将会拯救超过 36 个美国人的生命。 + +电能即金钱,所以削减广告也可以为消费者节约钱财。在美国,如果所有的网民都在他们的电脑上开启 [Privacy Badger][8],美国人每年可以节约超过 9100 万美元。在全球范围内,调查研究的结果则更令人吃惊。uBlock Origin 每年可以为全球消费者节约 18 亿美元。 + +这项研究始于人们因为新冠肺炎大流行而被迫居家之前,因此所有的数据都可以被认为是保守的估算。整体来说,研究发现了开源广告拦截器是一项潜在的节能技术。 + +虽然自由开源的广告拦截器可以节约能源,对自然环境也有好处,但你可能主要是为了拦截恼人的广告和节省自己的时间而使用它们。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/4/ad-blockers + +作者:[Joshua Pearce][a] +选题:[lujun9972][b] +译者:[CrazyShipOne](https://github.com/CrazyShipOne) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/jmpearce +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/browser_desktop_website_checklist_metrics.png?itok=OKKbl1UR (Browser of things) +[2]: https://www.mdpi.com/2227-7080/8/2/18 +[3]: https://github.com/gorhill/uBlock +[4]: https://opensource.com/sites/default/files/uploads/os_ad_blocker_story_.png (Ad blocker screen comparison) +[5]: https://adblockplus.org/ +[6]: https://privacybadger.org/ +[7]: https://www.academia.edu/42434401/Energy_Conservation_with_Open_Source_Ad_Blockers +[8]: https://privacybadger.org/ diff --git a/published/202004/20200425 What Happened to IPv5- Why there is IPv4, IPv6 but no IPv5.md b/published/202004/20200425 What Happened to IPv5- Why there is IPv4, IPv6 but no IPv5.md new file mode 100644 index 0000000000..3a8ab6b8bd --- /dev/null +++ b/published/202004/20200425 What Happened to IPv5- Why there is IPv4, IPv6 but no IPv5.md @@ -0,0 +1,76 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12168-1.html) +[#]: subject: (What Happened to IPv5? Why there is IPv4, IPv6 but no IPv5?) +[#]: via: (https://itsfoss.com/what-happened-to-ipv5/) +[#]: author: (John Paul https://itsfoss.com/author/john/) + +IPv5 发生了什么?为什么有 IPv4、IPv6 但没有 IPv5? +====== + +如果你花过很多时间在互联网上,那么你应该已经听说过计算机每天使用的 IPv4 和 IPv6 协议。 + +你可能会问的一个问题是:为什么没有 IPv5?为什么 IPv6 在 IPv4 之后而不是 IPv5 之后出现?是否有 IPv5,如果是,那么 IPv5 发生了什么? + +答案是肯定的,曾经有一个 IPv5。让我解释一下这里发生的事。 + +### 互联网的早期历史 + +![ARPA Logical Map in 1977 | Image courtesy: Wikipedia][1] + +在 1960 年代后期,美国国防部的[高级研究计划局][2](DARPA)发起了一个[项目][3]来连接全国的计算机。最初的目标是创建一个由全国 ARPA 资助的所有计算机组成的网络系统。 + +由于这是第一次将如此规模的网络整合在一起,因此他们也在不断发展自己的技术和硬件。他们首先做的工作之一就是开发名为[传输控制协议][4]Transmission Control Protocol(TCP)的互联网协议Internet Protocol(IP)。该协议“可靠、有序,并会对运行于通过 IP 网络传输的主机上的应用的八进制(字节)流通讯进行错误检测”。简单来说,它可以确保数据安全到达。 + +最初,TCP 被设计为[“主机级别的端到端协议以及封装和路由协议”][5]。但是,他们意识到他们需要拆分协议以使其更易于管理。于是决定由 IP 协议处理封装和路由。 + +那时,TCP 已经经历了三个版本,因此新协议被称为 IPv4。 + +### IPv5 的诞生 + +IPv5 开始时有个不同的名字:互联网流协议Internet Stream Protocol(ST)。它是[由 Apple、NeXT 和 Sun Microsystems][6] 为试验流式语音和视频而创建的。 + +该新协议能够“在保持通信的同时,以特定频率传输数据包”。 + +### 那么 IPv5 发生了什么? + +![][7] + +IPv5 从未被接受为正式的互联网协议。这主要是由于 32 位限制。 + +IPV5 使用与 IPv4 相同的寻址系统。每个地址由 0 到 255 之间的四组数字组成。这将可能的地址数量限制为 [43 亿][6]个。 + +在 1970 年代初,这似乎比全世界所需要的还要多。但是,互联网的爆炸性增长证明了这一想法是错误的。2011 年,世界上的IPv4地址正式用完了。 + +在 1990 年代,一个新项目开始致力于研究下一代互联网协议(IPng)。这形成了 128 位的 IPv6。IPv6 地址包含 [“8 组 4 字符的十六进制数字”][6],它可以包含从 0 到 9 的数字和从 A 到 F 的字母。与 IPv4 不同,IPv6 拥有数万亿个可能的地址,因此我们应该能安全一阵子。 + +同时,IPv5 奠定了 VoIP 的基础,而该技术已被我们用于当今世界范围内的通信。**因此,我想在某种程度上,你可以说 IPv5 仍然可以保留到了今天**。 + +希望你喜欢有关互联网历史的轶事。你可以阅读其他[关于 Linux 和技术的琐事文章][8]。 + +如果你觉得这篇文章有趣,请花一点时间在社交媒体、Hacker News 或 [Reddit][9] 上分享它。 + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/what-happened-to-ipv5/ + +作者:[John Paul][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://itsfoss.com/author/john/ +[b]: https://github.com/lujun9972 +[1]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/04/Arpa_internet.png?fit=800%2C573&ssl=1 +[2]: https://en.wikipedia.org/wiki/DARPA +[3]: https://en.wikipedia.org/wiki/ARPANET +[4]: https://en.wikipedia.org/wiki/Transmission_Control_Protocol +[5]: https://fcw.com/articles/2006/07/31/what-ever-happened-to-ipv5.aspx +[6]: https://www.lifewire.com/what-happened-to-ipv5-3971327 +[7]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/04/what-happened-to-ipv5.png?ssl=1 +[8]: https://itsfoss.com/category/story/ +[9]: https://reddit.com/r/linuxusersgroup diff --git a/published/202004/20200428 Fedora 32 is officially here.md b/published/202004/20200428 Fedora 32 is officially here.md new file mode 100644 index 0000000000..acad6862f5 --- /dev/null +++ b/published/202004/20200428 Fedora 32 is officially here.md @@ -0,0 +1,77 @@ +[#]: collector: (lujun9972) +[#]: translator: (wxy) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12164-1.html) +[#]: subject: (Fedora 32 is officially here!) +[#]: via: (https://fedoramagazine.org/announcing-fedora-32/) +[#]: author: (Matthew Miller https://fedoramagazine.org/author/mattdm/) + +Fedora 32 正式发布! +====== + +![][1] + +它来了! 我们很荣幸地宣布 Fedora 32 的发布。感谢成千上万的 Fedora 社区成员和贡献者的辛勤工作,我们又一次准时发布了。 + +如果你只想马上就能拿到它,请马上访问 。更多详情,请继续阅读本文。 + +### Fedora 的全部变种 + +Fedora Editions 是针对特定的“展示”用途输出的。 + +Fedora Workstation 专注于桌面系统。特别是,它面向的是那些希望获得“可以工作的” Linux 操作系统体验的软件开发者。这个版本采用了 [GNOME 3.36][2],一如既往地有很多很棒的改进。我最喜欢的是新的锁屏! + +Fedora Server 以一种易于部署的方式为系统管理员带来了新锐的开源服务器软件。对于边缘计算用例,[Fedora IoT][3] 为 IoT 生态系统提供了坚实的基础。 + +Fedora CoreOS 是一个新兴的 Fedora Edition。它是一个自动更新的、最小化的操作系统,用于安全地大规模运行容器化工作负载。它提供了几个[更新流][4],遵循大约每两周一次的自动更新。目前,next 流是基于 Fedora 32,后续还有 testing 流和 stable 流。你可以从[下载页面][5]中找到关于按 next 流发布的工件的信息,并在 [Fedora CoreOS 文档][6]中找到关于如何使用这些工件的信息。 + +当然,我们制作的不仅仅是 Editions。[Fedora Spins][7] 和[实验室][8]针对的是不同的受众和用例,包括[Fedora 天文学实验室][9],它为业余和专业的天文学家带来了完整的开源工具链,还有像 [KDE Plasma][10] 和 [Xfce][11] 这样的桌面环境。Fedora 32 中新增的 [计算神经科学实验室][12] 是由我们的神经科学特别兴趣小组开发的,它可以实现计算神经科学。 + +还有,别忘了我们的备用架构,[ARM AArch64、Power 和 S390x][13]。特别值得一提的是,我们改进了对 Rockchip 系统级芯片的支持,包括 Rock960、RockPro64 和 Rock64。 + +### 一般性的改进 + +无论你使用 Fedora 的哪个变体,你都能获得最新的开源世界。遵循我们的“[First][14]”理念,我们更新了关键的编程语言和系统库包,包括 GCC 10、Ruby 2.7 和 Python 3.8。当然,随着 Python 2 已经过了报废期,我们已经从 Fedora 中删除了大部分 Python 2 包,但我们为仍然需要它的开发者和用户提供了一个遗留的 python27 包。在 Fedora Workstation 中,我们默认启用了 EarlyOOM 服务,以改善低内存情况下的用户体验。 + +我们非常期待你能尝试一下新版本的使用体验! 现在就去 下载它。或者如果你已经在运行 Fedora 操作系统,请按照简单的[升级说明][15]进行升级。 + +### 万一出现问题…… + +如果你遇到问题,请查看[Fedora 32 常见错误][16]页面,如果有问题,请访问我们的 [Askedora][17] 用户支持平台。 + +### 谢谢大家 + +感谢在这个发布周期中为 Fedora 项目做出贡献的成千上万的人,特别是感谢那些在大流行期间为又一次准时发布而付出额外努力的人。Fedora 是一个社区,很高兴看到我们彼此之间的支持。我邀请大家参加 4 月28-29 日的[红帽峰会虚拟体验][18],了解更多关于 Fedora 和其他社区的信息。 + +-------------------------------------------------------------------------------- + +via: https://fedoramagazine.org/announcing-fedora-32/ + +作者:[Matthew Miller][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://fedoramagazine.org/author/mattdm/ +[b]: https://github.com/lujun9972 +[1]: https://fedoramagazine.org/wp-content/uploads/2020/04/f32-final-816x345.png +[2]: https://www.gnome.org/news/2020/03/gnome-3-36-released/ +[3]: https://iot.fedoraproject.org/ +[4]: https://docs.fedoraproject.org/en-US/fedora-coreos/update-streams/ +[5]: https://getfedora.org/en/coreos/download?stream=next +[6]: https://docs.fedoraproject.org/en-US/fedora-coreos/getting-started/ +[7]: https://spins.fedoraproject.org/ +[8]: https://labs.fedoraproject.org/ +[9]: https://labs.fedoraproject.org/en/astronomy/ +[10]: https://spins.fedoraproject.org/en/kde/ +[11]: https://spins.fedoraproject.org/en/xfce/ +[12]: https://labs.fedoraproject.org/en/comp-neuro +[13]: https://alt.fedoraproject.org/alt/ +[14]: https://docs.fedoraproject.org/en-US/project/#_first +[15]: https://docs.fedoraproject.org/en-US/quick-docs/upgrading/ +[16]: https://fedoraproject.org/wiki/Common_F32_bugs +[17]: http://ask.fedoraproject.org +[18]: https://www.redhat.com/en/summit diff --git a/published/202004/20200429 Manjaro 20 Lysia Arrives with ZFS and Snap Support.md b/published/202004/20200429 Manjaro 20 Lysia Arrives with ZFS and Snap Support.md new file mode 100644 index 0000000000..2ed94dd0a8 --- /dev/null +++ b/published/202004/20200429 Manjaro 20 Lysia Arrives with ZFS and Snap Support.md @@ -0,0 +1,110 @@ +[#]: collector: (lujun9972) +[#]: translator: (wxy) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12166-1.html) +[#]: subject: (Manjaro 20 Lysia Arrives with ZFS and Snap Support) +[#]: via: (https://itsfoss.com/manjaro-20-release/) +[#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/) + +Manjaro 20 Lysia 到来,支持 ZFS 和 Snap +====== + +![](https://img.linux.net.cn/data/attachment/album/202004/29/232925j8paomvp11pfu12v.jpg) + +> Manjaro Linux 刷新了其 Manjaro 20 “Lysia” 的 ISO。现在在 Pamac 中支持了 Snap 和 Flatpak 软件包。在 Manjaro Architect 安装程序中增加了 ZFS 选项,并使用最新的内核 5.6 作为基础。 + +最近新的发行版的发布像下雨一样。在上周发布了 [Ubuntu 20.04 LTS](https://linux.cn/article-12142-1.html) ,紧接着 [Fedora 32](https://linux.cn/article-12164-1.html) 也刚刚发布,而现在 [Manjaro 发布了版本 20][1],代号为 Lysia。 + +### Manjaro 20 Lysia 有什么新东西? + +其实有很多。让我给大家介绍一下 Manjaro 20 中的一些主要新功能。 + +#### 新的抹茶主题 + +Manjaro 20 有一个新的默认主题,名为 Matcha(抹茶)。它让桌面看起来更有质感。 + +![][2] + +#### 对 Snap 和 Flatpak 的支持 + +Snap 和 Flatpak 软件包的支持得到了改进。如果你愿意,你可以在命令行中使用它们。 + +你还可以在 Pamac 图形界面包管理器中启用 Snap 和 Flatpak 支持。 + +![Enable Snap support in Pamac Manjaro][3] + +启用后,你可以在 Pamac 软件管理器中找到并安装 Snap/Flatpak 应用程序。 + +![Snap applications in Pamac][4] + +#### Pamac 提供了基于搜索安装新软件的方式(在 GNOME 中) + +在 GNOME 变种中,如果你搜索某个东西,Pamac 软件管理器会提供安装符合查询的软件。在其他使用 GNOME 桌面的发行版中,GNOME 软件中心也会这样做。 + +#### ZFS 支持登陆了 Manjaro Architect + +现在,你可以在 Manjaro Linux 中轻松地使用 ZFS 作为根文件系统。在 [Manjaro Architect][6] 中提供了对 [ZFS 文件系统][5]的支持。 + +请注意,我说的是 Manjaro Architect,即基于终端的安装程序。它和普通的图形化的 [Calamares 安装程序][7]不一样。 + +![][8] + +#### Linux kernel 5.6 + +最新的稳定版 [Linux 内核 5.6][9] 带来了更多的硬件支持,如 thunderbolt、Nvidia 和 USB4。你也可以使用 [WireGuard VPN][10]。 + +![][11] + +#### 其他杂项变化 + + * 新的桌面环境版本:Xfce 4.14、GNOME 3.36 和 KDE Plasma 5.18。 + * 新的默认 shell 是 zsh。 + * Display-Profiles 允许你存储一个或多个配置文件,用于你的首选显示配置。 + * 改进后的 Gnome-Layout-Switcher。 + * 最新的驱动程序。 + * 改进和完善了 Manjaro 工具。 + +### 如何取得 Manjaro 20 Lysia? + +如果你已经在使用 Manjaro,只需更新你的 Manjaro Linux 系统,你就应该已经在使用 Lysia 了。 + +Manjaro 采用了滚动发布模式,这意味着你不必手动从一个版本升级到另一个版本。只要有新的版本发布,不需要重新安装就可以使用了。 + +既然 Manjaro 是滚动发布的,为什么每隔一段时间就会发布一个新版本呢?这是因为他们要刷新 ISO,这样下载 Manjaro 的新用户就不用再安装过去几年的更新了。这就是为什么 Arch Linux 也会每个月刷新一次 ISO 的原因。 + +Manjaro 的“ISO 刷新”是有代号和版本的,因为它可以帮助开发者清楚地标明每个开发阶段的发展方向。 + +所以,如果你已经在使用它,只需使用 Pamac 或命令行[更新你的 Manjaro Linux 系统][12]即可。 + +如果你想尝试 Manjaro 或者想使用 ZFS,那么你可以通过从它的网站上[下载 ISO][14] 来[安装 Manjaro][13]。 + +愿你喜欢新的 Manjaro Linux 发布。 + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/manjaro-20-release/ + +作者:[Abhishek Prakash][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://itsfoss.com/author/abhishek/ +[b]: https://github.com/lujun9972 +[1]: https://forum.manjaro.org/t/manjaro-20-0-lysia-released/138633 +[2]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/04/manjaro-20-lysia.jpeg?resize=800%2C440&ssl=1 +[3]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/04/enable-snap-in-pamac-manjaro.jpg?resize=800%2C490&ssl=1 +[4]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/04/snap-app-pacman.jpg?resize=800%2C489&ssl=1 +[5]: https://itsfoss.com/what-is-zfs/ +[6]: https://itsfoss.com/manjaro-architect-review/ +[7]: https://calamares.io/ +[8]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/04/pacman-prompts-install-apps.jpg?resize=800%2C331&ssl=1 +[9]: https://itsfoss.com/linux-kernel-5-6/ +[10]: https://itsfoss.com/wireguard/ +[11]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/04/manjaro-20-neofetch-screen.jpg?resize=800%2C495&ssl=1 +[12]: https://itsfoss.com/update-arch-linux/ +[13]: https://itsfoss.com/install-manjaro-linux/ +[14]: https://manjaro.org/download/ diff --git a/published/202005/20180425 An introduction to the GNU Core Utilities - Opensource.com.md b/published/202005/20180425 An introduction to the GNU Core Utilities - Opensource.com.md new file mode 100644 index 0000000000..fe61c265f0 --- /dev/null +++ b/published/202005/20180425 An introduction to the GNU Core Utilities - Opensource.com.md @@ -0,0 +1,127 @@ +GNU 核心实用程序简介 +====== + +> 大多数 Linux 系统管理员需要做的事情都可以在 GNU coreutils 或 util-linux 中找到。 + +![](https://img.linux.net.cn/data/attachment/album/202005/10/172312hofgh88i3g6jajfj.jpg) + +许多 Linux 系统管理员最基本和常用的工具主要包括在两套实用程序中:[GNU 核心实用程序(coreutils)][3]和 util-linux。它们的基本功能允许系统管理员执行许多管理 Linux 系统的任务,包括管理和操作文本文件、目录、数据流、存储介质、进程控制、文件系统等等。 + +这些工具是不可缺少的,因为没有它们,就不可能在 Unix 或 Linux 计算机上完成任何有用的工作。鉴于它们的重要性,让我们来研究一下它们。 + +### GNU coreutils + +要了解 GNU 核心实用程序的起源,我们需要乘坐时光机进行一次短暂的旅行,回到贝尔实验室的 Unix 早期。[编写 Unix][8] 是为了让 Ken Thompson、Dennis Ritchie、Doug McIlroy 和 Joe Ossanna 可以继续他们在大型多任务和多用户计算机项目 [Multics][9] 上的工作:开发一个叫做《太空旅行》游戏的小东西。正如今天一样,推动计算技术发展的似乎总是游戏玩家。这个新的操作系统比 Multics(LCTT 译注:multi- 字头的意思是多数的)的局限性更大,因为一次只能有两个用户登录,所以被称为 Unics(LCTT 译注:uni- 字头的意思是单独的)。后来这个名字被改成了 Unix。 + +随着时间的推移,Unix 取得了如此巨大的成功,开始贝尔实验室基本上是将其赠送给大学,后来送给公司也只是收取介质和运输的费用。在那个年代,系统级的软件是在组织和程序员之间共享的,因为在系统管理这个层面,他们努力实现的是共同的目标。 + +最终,AT&T 公司的[老板们][10]决定,他们应该在 Unix 上赚钱,并开始使用限制更多的、昂贵的许可证。这发生在软件变得更加专有、受限和封闭的时期,从那时起,与其他用户和组织共享软件变得不可能。 + +有些人不喜欢这种情况,于是用自由软件来对抗。Richard M. Stallman(RMS),他带领着一群“反叛者”试图编写一个开放的、自由的可用操作系统,他们称之为 GNU 操作系统。这群人创建了 GNU 实用程序,但并没有产生一个可行的内核。 + +当 Linus Torvalds 开始编写和编译 Linux 内核时,他需要一套非常基本的系统实用程序来开始执行一些稍微有用的工作。内核并不提供命令或任何类型的命令 shell,比如 Bash,它本身是没有任何用处的,因此,Linus 使用了免费提供的 GNU 核心实用程序,并为 Linux 重新编译了它们。这让他拥有了一个完整的、即便是相当基本的操作系统。 + +你可以通过在终端命令行中输入命令 `info coreutils` 来了解 GNU 核心实用程序的全部内容。下面的核心实用程序列表就是这个信息页面的一部分。这些实用程序按功能进行了分组,以方便查找;在终端中,选择你想了解更多信息的组,然后按回车键。 + +``` +* Output of entire files::       cat tac nl od base32 base64 +* Formatting file contents::     fmt pr fold +* Output of parts of files::     head tail split csplit +* Summarizing files::            wc sum cksum b2sum md5sum sha1sum sha2 +* Operating on sorted files::    sort shuf uniq comm ptx tsort +* Operating on fields::          cut paste join +* Operating on characters::      tr expand unexpand +* Directory listing::            ls dir vdir dircolors +* Basic operations::             cp dd install mv rm shred +* Special file types::           mkdir rmdir unlink mkfifo mknod ln link readlink +* Changing file attributes::     chgrp chmod chown touch +* Disk usage::                   df du stat sync truncate +* Printing text::                echo printf yes +* Conditions::                   false true test expr +* Redirection::                  tee +* File name manipulation::       dirname basename pathchk mktemp realpath +* Working context::              pwd stty printenv tty +* User information::             id logname whoami groups users who +* System context::               date arch nproc uname hostname hostid uptime +* SELinux context::              chcon runcon +* Modified command invocation::  chroot env nice nohup stdbuf timeout +* Process control::              kill +* Delaying::                     sleep +* Numeric operations::           factor numfmt seq +``` + +这个列表里有 102 个实用程序。它涵盖了在 Unix 或 Linux 主机上执行基本任务所需的许多功能。但是,很多基本的实用程序都缺失了,例如,`mount` 和 `umount` 命令不在这个列表中。这些命令和其他许多不在 GNU 核心实用程序中的命令可以在 util-linux 中找到。 + +### util-linux + +util-linix 实用程序包中包含了许多系统管理员常用的其它命令。这些实用程序是由 Linux 内核组织发布的,这 107 条命令中几乎每一个都来自原本是三个单独的集合 —— fileutils、shellutils 和 textutils,2003 年它们被[合并成一个包][11]:util-linux。 + +``` +agetty          fsck.minix      mkfs.bfs        setpriv +blkdiscard      fsfreeze        mkfs.cramfs     setsid +blkid           fstab           mkfs.minix      setterm +blockdev        fstrim          mkswap          sfdisk +cal             getopt          more            su +cfdisk          hexdump         mount           sulogin +chcpu           hwclock         mountpoint      swaplabel +chfn            ionice          namei           swapoff +chrt            ipcmk           newgrp          swapon +chsh            ipcrm           nologin         switch_root +colcrt          ipcs            nsenter         tailf +col             isosize         partx           taskset +colrm           kill            pg              tunelp +column          last            pivot_root      ul +ctrlaltdel      ldattach        prlimit         umount +ddpart          line            raw             unshare +delpart         logger          readprofile     utmpdump +dmesg           login           rename          uuidd +eject           look            renice          uuidgen +fallocate       losetup         reset           vipw +fdformat        lsblk           resizepart      wall +fdisk           lscpu           rev             wdctl +findfs          lslocks         RTC Alarm       whereis +findmnt         lslogins        runuser         wipefs +flock           mcookie         script          write +fsck            mesg            scriptreplay    zramctl +fsck.cramfs     mkfs            setarch +``` + +这些实用程序中的一些已经被淘汰了,很可能在未来的某个时候会从集合中被踢出去。你应该看看[维基百科的 util-linux 页面][12]来了解其中许多实用程序的信息,而 man 页面也提供了关于这些命令的详细信息。 + +### 总结 + +这两个 Linux 实用程序的集合,GNU 核心实用程序和 util-linux,共同提供了管理 Linux 系统所需的基本实用程序。在研究这篇文章的过程中,我发现了几个有趣的实用程序,这些实用程序是我从不知道的。这些命令中的很多都是很少需要的,但当你需要的时候,它们是不可缺少的。 + +在这两个集合里,有 200 多个 Linux 实用工具。虽然 Linux 的命令还有很多,但这些都是管理一个典型的 Linux 主机的基本功能所需要的。 + +--- + +via: [https://opensource.com/article/18/4/gnu-core-utilities][17] + +作者: [David Both][18] 选题者: [lujun9972][19] 译者: [wxy][20] 校对: [wxy][21] + +本文由 [LCTT][22] 原创编译,[Linux中国][23] 荣誉推出 + +[1]: https://pixabay.com/en/tiny-people-core-apple-apple-half-700921/ +[2]: https://creativecommons.org/publicdomain/zero/1.0/ +[3]: https://www.gnu.org/software/coreutils/coreutils.html +[4]: https://opensource.com/life/17/10/top-terminal-emulators?intcmp=7016000000127cYAAQ +[5]: https://opensource.com/article/17/2/command-line-tools-data-analysis-linux?intcmp=7016000000127cYAAQ +[6]: https://opensource.com/downloads/advanced-ssh-cheat-sheet?intcmp=7016000000127cYAAQ +[7]: https://developers.redhat.com/cheat-sheet/advanced-linux-commands-cheatsheet?intcmp=7016000000127cYAAQ +[8]: https://en.wikipedia.org/wiki/History_of_Unix +[9]: https://en.wikipedia.org/wiki/Multics +[10]: https://en.wikipedia.org/wiki/Pointy-haired_Boss +[11]: https://en.wikipedia.org/wiki/GNU_Core_Utilities +[12]: https://en.wikipedia.org/wiki/Util-linux +[13]: https://opensource.com/users/dboth +[14]: https://opensource.com/users/dboth +[15]: https://opensource.com/users/dboth +[16]: https://opensource.com/participate +[17]: https://opensource.com/article/18/4/gnu-core-utilities +[18]: https://opensource.com/users/dboth +[19]: https://github.com/lujun9972 +[20]: https://github.com/译者ID +[21]: https://github.com/校对者ID +[22]: https://github.com/LCTT/TranslateProject +[23]: https://linux.cn/ diff --git a/published/202005/20180612 Systemd Services- Reacting to Change.md b/published/202005/20180612 Systemd Services- Reacting to Change.md new file mode 100644 index 0000000000..8a7be7cde2 --- /dev/null +++ b/published/202005/20180612 Systemd Services- Reacting to Change.md @@ -0,0 +1,266 @@ +Systemd 服务:响应变化 +====== + +![](https://img.linux.net.cn/data/attachment/album/202005/12/001037iz91uu9b15dqb9w3.jpg) + +[我有一个这样的电脑棒][1](图1),我把它用作通用服务器。它很小且安静,由于它是基于 x86 架构的,因此我为我的打印机安装驱动没有任何问题,而且这就是它大多数时候干的事:与客厅的共享打印机和扫描仪通信。 + +![ComputeStick][3] + +*一个英特尔电脑棒。欧元硬币大小。* + +大多数时候它都是闲置的,尤其是当我们外出时,因此我认为用它作监视系统是个好主意。该设备没有自带的摄像头,也不需要一直监视。我也不想手动启动图像捕获,因为这样就意味着在出门前必须通过 SSH 登录,并在 shell 中编写命令来启动该进程。 + +因此,我以为应该这么做:拿一个 USB 摄像头,然后只需插入它即可自动启动监视系统。如果这个电脑棒重启后发现连接了摄像头也启动监视系统就更加分了。 + +在先前的文章中,我们看到 systemd 服务既可以[手动启动或停止][5],也可以[在满足某些条件时启动或停止][6]。这些条件不限于操作系统在启动或关机时序中达到某种状态,还可以在你插入新硬件或文件系统发生变化时进行。你可以通过将 Udev 规则与 systemd 服务结合起来实现。 + +### 有 Udev 支持的热插拔 + +Udev 规则位于 `/etc/udev/rules` 目录中,通常是由导致一个动作action条件conditions赋值assignments的单行语句来描述。 + +有点神秘。让我们再解释一次: + +通常,在 Udev 规则中,你会告诉 systemd 当设备连接时需要查看什么信息。例如,你可能想检查刚插入的设备的品牌和型号是否与你让 Udev 等待的设备的品牌和型号相对应。这些就是前面提到的“条件”。 + +然后,你可能想要更改一些内容,以便以后可以方便使用该设备。例如,更改设备的读写权限:如果插入 USB 打印机,你会希望用户能够从打印机读取信息(用户的打印应用程序需要知道其模型、制造商,以及是否准备好接受打印作业)并向其写入内容,即发送要打印的内容。更改设备的读写权限是通过你之前阅读的“赋值” 之一完成的。 + +最后,你可能希望系统在满足上述条件时执行某些动作,例如在插入某个外部硬盘时启动备份程序以复制重要文件。这就是上面提到的“动作”的例子。 + +了解这些之后, 来看看以下几点: + +``` +ACTION=="add", SUBSYSTEM=="video4linux", ATTRS{idVendor}=="03f0", ATTRS{idProduct}=="e207", +SYMLINK+="mywebcam", TAG+="systemd", MODE="0666", ENV{SYSTEMD_WANTS}="webcam.service" +``` + +规则的第一部分, + +``` +ACTION=="add", SUBSYSTEM=="video4linux", ATTRS{idVendor}=="03f0", +ATTRS{idProduct}=="e207" [etc... ] +``` + +表明了执行你想让系统执行的其他动作之前设备必须满足的条件。设备必须被添加到(`ACTION=="add"`)机器上,并且必须添加到 `video4linux` 子系统中。为了确保仅在插入正确的设备时才应用该规则,你必须确保 Udev 正确识别设备的制造商(`ATTRS{idVendor}=="03f0"`)和型号(`ATTRS{idProduct}=="e207"`)。 + +在本例中,我们讨论的是这个设备(图2): + +![webcam][8] + +*这个试验使用的是 HP 的摄像头。* + +注意怎样用 `==` 来表示这是一个逻辑操作。你应该像这样阅读上面的简要规则: + +> 如果添加了一个设备并且该设备由 video4linux 子系统控制,而且该设备的制造商编码是 03f0,型号是 e207,那么... + +但是,你从哪里获取的这些信息?你在哪里找到触发事件的动作、制造商、型号等?你可要使用多个来源。你可以通过将摄像头插入机器并运行 `lsusb` 来获得 `IdVendor` 和 `idProduct` : + +``` +lsusb +Bus 002 Device 002: ID 8087:0024 Intel Corp. Integrated Rate Matching Hub +Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub +Bus 004 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub +Bus 003 Device 003: ID 03f0:e207 Hewlett-Packard +Bus 003 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub +Bus 001 Device 003: ID 04f2:b1bb Chicony Electronics Co., Ltd +Bus 001 Device 002: ID 8087:0024 Intel Corp. Integrated Rate Matching Hub +Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub +``` + +我用的摄像头是 HP 的,你在上面的列表中只能看到一个 HP 设备。`ID` 提供了制造商和型号,它们以冒号(`:`)分隔。如果你有同一制造商的多个设备,不确定哪个是哪个设备,请拔下摄像头,再次运行 `lsusb` , 看看少了什么。 + +或者... + +拔下摄像头,等待几秒钟,运行命令 `udevadmin monitor --environment` ,然后重新插入摄像头。当你使用的是HP摄像头时,你将看到: + +``` +udevadmin monitor --environment +UDEV [35776.495221] add /devices/pci0000:00/0000:00:1c.3/0000:04:00.0 + /usb3/3-1/3-1:1.0/input/input21/event11 (input) +.MM_USBIFNUM=00 +ACTION=add +BACKSPACE=guess +DEVLINKS=/dev/input/by-path/pci-0000:04:00.0-usb-0:1:1.0-event + /dev/input/by-id/usb-Hewlett_Packard_HP_Webcam_HD_2300-event-if00 +DEVNAME=/dev/input/event11 +DEVPATH=/devices/pci0000:00/0000:00:1c.3/0000:04:00.0/ + usb3/3-1/3-1:1.0/input/input21/event11 +ID_BUS=usb +ID_INPUT=1 +ID_INPUT_KEY=1 +ID_MODEL=HP_Webcam_HD_2300 +ID_MODEL_ENC=HPx20Webcamx20HDx202300 +ID_MODEL_ID=e207 +ID_PATH=pci-0000:04:00.0-usb-0:1:1.0 +ID_PATH_TAG=pci-0000_04_00_0-usb-0_1_1_0 +ID_REVISION=1020 +ID_SERIAL=Hewlett_Packard_HP_Webcam_HD_2300 +ID_TYPE=video +ID_USB_DRIVER=uvcvideo +ID_USB_INTERFACES=:0e0100:0e0200:010100:010200:030000: +ID_USB_INTERFACE_NUM=00 +ID_VENDOR=Hewlett_Packard +ID_VENDOR_ENC=Hewlettx20Packard +ID_VENDOR_ID=03f0 +LIBINPUT_DEVICE_GROUP=3/3f0/e207:usb-0000:04:00.0-1/button +MAJOR=13 +MINOR=75 +SEQNUM=3162 +SUBSYSTEM=input +USEC_INITIALIZED=35776495065 +XKBLAYOUT=es +XKBMODEL=pc105 +XKBOPTIONS= +XKBVARIANT= +``` + +可能看起来有很多信息要处理,但是,看一下这个:列表前面的 `ACTION` 字段, 它告诉你刚刚发生了什么事件,即一个设备被添加到系统中。你还可以在其中几行中看到设备名称的拼写,因此可以非常确定它就是你要找的设备。输出里还显示了制造商的ID(`ID_VENDOR_ID = 03f0`)和型号(`ID_VENDOR_ID = 03f0`)。 + +这为你提供了规则条件部分需要的四个值中的三个。你可能也会想到它还给了你第四个,因为还有一行这样写道: + +``` +SUBSYSTEM=input +``` + +小心!尽管 USB 摄像头确实是提供输入的设备(键盘和鼠标也是),但它也属于 usb 子系统和其他几个子系统。这意味着你的摄像头被添加到了多个子系统,并且看起来像多个设备。如果你选择了错误的子系统,那么你的规则可能无法按你期望的那样工作,或者根本无法工作。 + +因此,第三件事就是检查网络摄像头被添加到的所有子系统,并选择正确的那个。为此,请再次拔下摄像头,然后运行: + +``` +ls /dev/video* +``` + +这将向你显示连接到本机的所有视频设备。如果你使用的是笔记本,大多数笔记本都带有内置摄像头,它可能会显示为 `/dev/video0` 。重新插入摄像头,然后再次运行 `ls /dev/video*`。 + +现在,你应该看到多一个视频设备(可能是`/dev/video1`)。 + +现在,你可以通过运行 `udevadm info -a /dev/video1` 找出它所属的所有子系统: + +``` +udevadm info -a /dev/video1 + +Udevadm info starts with the device specified by the devpath and then +walks up the chain of parent devices. It prints for every device +found, all possible attributes in the udev rules key format. +A rule to match, can be composed by the attributes of the device +and the attributes from one single parent device. + + looking at device '/devices/pci0000:00/0000:00:1c.3/0000:04:00.0 +  /usb3/3-1/3-1:1.0/video4linux/video1': + KERNEL=="video1" + SUBSYSTEM=="video4linux" + DRIVER=="" + ATTR{dev_debug}=="0" + ATTR{index}=="0" + ATTR{name}=="HP Webcam HD 2300: HP Webcam HD" + +[etc...] +``` + +输出持续了相当长的时间,但是你感兴趣的只是开头的部分:`SUBSYSTEM =="video4linux"`。你可以将这行文本直接复制粘贴到你的规则中。输出的其余部分(为简洁未显示)为你提供了更多的信息,例如制造商和型号 ID,同样是以你可以复制粘贴到你的规则中的格式。 + +现在,你有了识别设备的方式吗,并明确了什么事件应该触发该动作,该对设备进行修改了。 + +规则的下一部分,`SYMLINK+="mywebcam", TAG+="systemd", MODE="0666"` 告诉 Udev 做三件事:首先,你要创建设备的符号链接(例如 `/dev/video1` 到 `/dev/mywebcam`。这是因为你无法预测系统默认情况下会把那个设备叫什么。当你拥有内置摄像头并热插拔一个新的时,内置摄像头通常为 `/dev/video0`,而外部摄像头通常为 `/dev/video1`。但是,如果你在插入外部 USB 摄像头的情况下重启计算机,则可能会相反,内部摄像头可能会变成 `/dev/video1` ,而外部摄像头会变成 `/dev/video0`。这想告诉你的是,尽管你的图像捕获脚本(稍后将看到)总是需要指向外部摄像头设备,但是你不能依赖它是 `/dev/video0` 或 `/dev/video1`。为了解决这个问题,你告诉 Udev 创建一个符号链接,该链接在设备被添加到 `video4linux` 子系统的那一刻起就不会再变,你将使你的脚本指向该链接。 + +第二件事就是将 `systemd` 添加到与此规则关联的 Udev 标记列表中。这告诉 Udev,该规则触发的动作将由 systemd 管理,即它将是某种 systemd 服务。 + +注意在这个两种情况下是如何使用 `+=` 运算符的。这会将值添加到列表中,这意味着你可以向 `SYMLINK` 和 `TAG` 添加多个值。 + +另一方面,`MODE` 值只能包含一个值(因此,你可以使用简单的 `=` 赋值运算符)。`MODE` 的作用是告诉 Udev 谁可以读或写该设备。如果你熟悉 `chmod`(你读到此文, 应该会熟悉),你就也会熟悉[如何用数字表示权限][9]。这就是它的含义:`0666` 的含义是 “向所有人授予对设备的读写权限”。 + +最后, `ENV{SYSTEMD_WANTS}="webcam.service"` 告诉 Udev 要运行什么 systemd 服务。 + +将此规则保存到 `/etc/udev/rules.d` 目录名为 `90-webcam.rules`(或类似的名称)的文件中,你可以通过重启机器或运行以下命令来加载它: + +``` +sudo udevadm control --reload-rules && udevadm trigger +``` + +### 最后是服务 + +Udev 规则触发的服务非常简单: + +``` +# webcam.service + +[Service] +Type=simple +ExecStart=/home/[user name]/bin/checkimage.sh +``` + +基本上,它只是运行存储在你个人 `bin/` 中的 `checkimage.sh` 脚本并将其放到后台。[这是你在先前的文章中看过的内容][5]。它看起来似乎很小,但那只是因为它是被 Udev 规则调用的,你刚刚创建了一种特殊的 systemd 单元,称为 `device` 单元。 恭喜。 + +至于 `webcam.service` 调用的 `checkimage.sh` 脚本,有几种方法从摄像头抓取图像并将其与前一个图像进行比较以检查变化(这是 `checkimage.sh` 所做的事),但这是我的方法: + +``` +#!/bin/bash +# This is the checkimage.sh script + +mplayer -vo png -frames 1 tv:// -tv driver=v4l2:width=640:height=480:device= + /dev/mywebcam &>/dev/null +mv 00000001.png /home/[user name]/monitor/monitor.png + +while true +do + mplayer -vo png -frames 1 tv:// -tv driver=v4l2:width=640:height=480:device=/dev/mywebcam &>/dev/null + mv 00000001.png /home/[user name]/monitor/temp.png + + imagediff=`compare -metric mae /home/[user name]/monitor/monitor.png /home/[user name] + /monitor/temp.png /home/[user name]/monitor/diff.png 2>&1 > /dev/null | cut -f 1 -d " "` + if [ `echo "$imagediff > 700.0" | bc` -eq 1 ] + then + mv /home/[user name]/monitor/temp.png /home/[user name]/monitor/monitor.png + fi + + sleep 0.5 +done +``` + +首先使用[MPlayer][10]从摄像头抓取一帧(`00000001.png`)。注意,我们怎样将 `mplayer` 指向 Udev 规则中创建的 `mywebcam` 符号链接,而不是指向 `video0` 或 `video1`。然后,将图像传输到主目录中的 `monitor/` 目录。然后执行一个无限循环,一次又一次地执行相同的操作,但还使用了[Image Magick 的 compare 工具][11]来查看最后捕获的图像与 `monitor/` 目录中已有的图像之间是否存在差异。 + +如果图像不同,则表示摄像头的镜框里某些东西动了。该脚本将新图像覆盖原始图像,并继续比较以等待更多变动。 + +### 插线 + +所有东西准备好后,当你插入摄像头后,你的 Udev 规则将被触发并启动 `webcam.service`。 `webcam.service` 将在后台执行 `checkimage.sh` ,而 `checkimage.sh` 将开始每半秒拍一次照。你会感觉到,因为摄像头的 LED 在每次拍照时将开始闪。 + +与往常一样,如果出现问题,请运行: + +``` +systemctl status webcam.service +``` + +检查你的服务和脚本正在做什么。 + +### 接下来 + +你可能想知道:为什么要覆盖原始图像?当然,系统检测到任何动静,你都想知道发生了什么,对吗?你是对的,但是如你在下一部分中将看到的那样,将它们保持原样,并使用另一种类型的 systemd 单元处理图像将更好,更清晰和更简单。 + +请期待下一篇。 + +-------------------------------------------------------------------------------- + +via: https://www.linux.com/blog/intro-to-linux/2018/6/systemd-services-reacting-change + +作者:[Paul Brown][a] +选题:[lujun9972][b] +译者:[messon007](https://github.com/messon007) +校对:[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.intel.com/content/www/us/en/products/boards-kits/compute-stick/stk1a32sc.html +[2]: https://www.linux.com/files/images/fig01png +[3]: https://lcom.static.linuxfound.org/sites/lcom/files/fig01.png +[4]: https://www.linux.com/licenses/category/used-permission +[5]: https://linux.cn/article-9700-1.html +[6]: https://linux.cn/article-9703-1.html +[7]: https://www.linux.com/files/images/fig02png +[8]: https://www.linux.com/sites/lcom/files/styles/floated_images/public/fig02.png?itok=esFv4BdM (webcam) +[9]: https://chmod-calculator.com/ +[10]: https://mplayerhq.hu/design7/news.html +[11]: https://www.imagemagick.org/script/compare.php +[12]: https://training.linuxfoundation.org/linux-courses/system-administration-training/introduction-to-linux diff --git a/published/202005/20190915 How to Configure SFTP Server with Chroot in Debian 10.md b/published/202005/20190915 How to Configure SFTP Server with Chroot in Debian 10.md new file mode 100644 index 0000000000..51a75f3521 --- /dev/null +++ b/published/202005/20190915 How to Configure SFTP Server with Chroot in Debian 10.md @@ -0,0 +1,199 @@ +[#]: collector: (lujun9972) +[#]: translator: (robsean) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12186-1.html) +[#]: subject: (How to Configure SFTP Server with Chroot in Debian 10) +[#]: via: (https://www.linuxtechi.com/configure-sftp-chroot-debian10/) +[#]: author: (Pradeep Kumar https://www.linuxtechi.com/author/pradeep/) + +如何在 Debian 10 中配置 Chroot 环境的 SFTP 服务 +====== + +SFTP 意思是“安全文件传输协议Secure File Transfer Protocol” 或 “SSH 文件传输协议SSH File Transfer Protocol”,它是最常用的用于通过 `ssh` 将文件从本地系统安全地传输到远程服务器的方法,反之亦然。`sftp` 的主要优点是,除 `openssh-server` 之外,我们不需要安装任何额外的软件包,在大多数的 Linux 发行版中,`openssh-server` 软件包是默认安装的一部分。`sftp` 的另外一个好处是,我们可以允许用户使用 `sftp` ,而不允许使用 `ssh` 。 + +![](https://img.linux.net.cn/data/attachment/album/202005/05/223518ip4mbdi4nggbdtgu.jpg) + +当前发布的 Debian 10 代号为 ‘Buster’,在这篇文章中,我们将演示如何在 Debian 10 系统中在 “监狱式的” Chroot 环境中配置 `sftp`。在这里,Chroot 监狱式环境意味着,用户不能超出各自的家目录,或者用户不能从各自的家目录更改目录。下面实验的详细情况: + +* OS = Debian 10 +* IP 地址 = 192.168.56.151 + +让我们跳转到 SFTP 配置步骤, + +### 步骤 1、使用 groupadd 命令给 sftp 创建一个组 + +打开终端,使用下面的 `groupadd` 命令创建一个名为的 `sftp_users` 组: + +``` +root@linuxtechi:~# groupadd sftp_users +``` + +### 步骤 2、添加用户到组 sftp_users 并设置权限 + +假设你想创建新的用户,并且想添加该用户到 `sftp_users` 组中,那么运行下面的命令, + +**语法:** + +``` +# useradd -m -G sftp_users <用户名> +``` + +让我们假设用户名是 `jonathan`: + +``` +root@linuxtechi:~# useradd -m -G sftp_users jonathan +``` + +使用下面的 `chpasswd` 命令设置密码: + +``` +root@linuxtechi:~# echo "jonathan:<输入密码>" | chpasswd +``` + +假设你想添加现有的用户到 `sftp_users` 组中,那么运行下面的 `usermod` 命令,让我们假设已经存在的用户名称是 `chris`: + +``` +root@linuxtechi:~# usermod -G sftp_users chris +``` + +现在设置用户所需的权限: + +``` +root@linuxtechi:~# chown root /home/jonathan /home/chris/ +``` + +在各用户的家目录中都创建一个上传目录,并设置正确地所有权: + +``` +root@linuxtechi:~# mkdir /home/jonathan/upload +root@linuxtechi:~# mkdir /home/chris/upload +root@linuxtechi:~# chown jonathan /home/jonathan/upload +root@linuxtechi:~# chown chris /home/chris/upload +``` + +**注意:** 像 Jonathan 和 Chris 之类的用户可以从他们的本地系统上传文件和目录。 + +### 步骤 3、编辑 sftp 配置文件 /etc/ssh/sshd_config + +正如我们已经陈述的,`sftp` 操作是通过 `ssh` 完成的,所以它的配置文件是 `/etc/ssh/sshd_config`,在做任何更改前,我建议首先备份文件,然后再编辑该文件,接下来添加下面的内容: + +``` +root@linuxtechi:~# cp /etc/ssh/sshd_config /etc/ssh/sshd_config-org +root@linuxtechi:~# vim /etc/ssh/sshd_config +...... +#Subsystem sftp /usr/lib/openssh/sftp-server +Subsystem sftp internal-sftp + +Match Group sftp_users + X11Forwarding no + AllowTcpForwarding no + ChrootDirectory %h + ForceCommand internal-sftp +...... +``` + +保存并退出文件。 + +为使上述更改生效,使用下面的 `systemctl` 命令来重新启动 `ssh` 服务: + +``` +root@linuxtechi:~# systemctl restart sshd +``` + +在上面的 `sshd_config` 文件中,我们已经注释掉了以 `Subsystem` 开头的行,并添加了新的条目 `Subsystem sftp internal-sftp` 和新的行。而 + +`Match Group sftp_users` –> 它意味着如果用户是 `sftp_users` 组中的一员,那么将应用下面提到的规则到这个条目。 + +`ChrootDierctory %h` –> 它意味着用户只能在他们自己各自的家目录中更改目录,而不能超出他们各自的家目录。或者换句话说,我们可以说用户是不允许更改目录的。他们将在他们的目录中获得监狱一样的环境,并且不能访问其他用户的目录和系统的目录。 + +`ForceCommand internal-sftp` –> 它意味着用户仅被限制到只能使用 `sftp` 命令。 + +### 步骤 4、测试和验证 sftp + +登录到你的 `sftp` 服务器的同一个网络上的任何其它的 Linux 系统,然后通过我们放入 `sftp_users` 组中的用户来尝试 ssh 和 sftp 服务。 + +``` +[root@linuxtechi ~]# ssh root@linuxtechi +root@linuxtechi's password: +Write failed: Broken pipe +[root@linuxtechi ~]# ssh root@linuxtechi +root@linuxtechi's password: +Write failed: Broken pipe +[root@linuxtechi ~]# +``` + +以上操作证实用户不允许 `ssh` ,现在使用下面的命令尝试 `sftp`: + +``` +[root@linuxtechi ~]# sftp root@linuxtechi +root@linuxtechi's password: +Connected to 192.168.56.151. +sftp> ls -l +drwxr-xr-x 2 root 1001 4096 Sep 14 07:52 debian10-pkgs +-rw-r--r-- 1 root 1001 155 Sep 14 07:52 devops-actions.txt +drwxr-xr-x 2 1001 1002 4096 Sep 14 08:29 upload +``` + +让我们使用 sftp 的 `get` 命令来尝试下载一个文件: + +``` +sftp> get devops-actions.txt +Fetching /devops-actions.txt to devops-actions.txt +/devops-actions.txt 100% 155 0.2KB/s 00:00 +sftp> +sftp> cd /etc +Couldn't stat remote file: No such file or directory +sftp> cd /root +Couldn't stat remote file: No such file or directory +sftp> +``` + +上面的输出证实我们能从我们的 sftp 服务器下载文件到本地机器,除此之外,我们也必须测试用户不能更改目录。 + +让我们在 `upload` 目录下尝试上传一个文件: + +``` +sftp> cd upload/ +sftp> put metricbeat-7.3.1-amd64.deb +Uploading metricbeat-7.3.1-amd64.deb to /upload/metricbeat-7.3.1-amd64.deb +metricbeat-7.3.1-amd64.deb 100% 38MB 38.4MB/s 00:01 +sftp> ls -l +-rw-r--r-- 1 1001 1002 40275654 Sep 14 09:18 metricbeat-7.3.1-amd64.deb +sftp> +``` + +这证实我们已经成功地从我们的本地系统上传一个文件到 sftp 服务中。 + +现在使用 winscp 工具来测试 sftp 服务,输入 sftp 服务器 IP 地址和用户的凭证: + +![][3] + +在 “Login” 上单击,然后尝试下载和上传文件: + +![][4] + +现在,在 `upload` 文件夹中尝试上传文件: + +![][5] + +上面的窗口证实上传是完好地工作的,这就是这篇文章的全部。如果这些步骤能帮助你在 Debian 10 中使用 chroot 环境配置 SFTP 服务器s,那么请分享你的反馈和评论。 + +-------------------------------------------------------------------------------- + +via: https://www.linuxtechi.com/configure-sftp-chroot-debian10/ + +作者:[Pradeep Kumar][a] +选题:[lujun9972][b] +译者:[robsean](https://github.com/robsean) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://www.linuxtechi.com/author/pradeep/ +[b]: https://github.com/lujun9972 +[1]: data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7 +[2]: https://www.linuxtechi.com/wp-content/uploads/2019/09/Configure-sftp-debian10.jpg +[3]: https://www.linuxtechi.com/wp-content/uploads/2019/09/Winscp-sftp-debian10.jpg +[4]: https://www.linuxtechi.com/wp-content/uploads/2019/09/Download-file-winscp-debian10-sftp.jpg +[5]: https://www.linuxtechi.com/wp-content/uploads/2019/09/Upload-File-using-winscp-Debian10-sftp.jpg diff --git a/published/202005/20200222 How to install TT-RSS on a Raspberry Pi.md b/published/202005/20200222 How to install TT-RSS on a Raspberry Pi.md new file mode 100644 index 0000000000..e3f83399d4 --- /dev/null +++ b/published/202005/20200222 How to install TT-RSS on a Raspberry Pi.md @@ -0,0 +1,227 @@ +[#]: collector: (lujun9972) +[#]: translator: (lxbwolf) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12264-1.html) +[#]: subject: (How to install TT-RSS on a Raspberry Pi) +[#]: via: (https://opensource.com/article/20/2/ttrss-raspberry-pi) +[#]: author: (Patrick H. Mullins https://opensource.com/users/pmullins) + +怎样在树莓派上安装 TT-RSS +====== + +> 使用 Tiny Tiny RSS 来保护你阅读新闻馈送时的隐私。 + +![](https://img.linux.net.cn/data/attachment/album/202005/29/230337vmazkl65hh61l0qq.png) + +[Tiny Tiny RSS][2](TT-RSS)是一个自由开源的基于 Web 的新闻馈送feed(RSS/Atom)阅读器和聚合工具。它非常适合那些注重隐私,并且仍然依赖 RSS 来获取日常新闻的人。TT-RSS 是自行托管的软件,因此你可以 100% 的掌控你的服务器、数据以及你的全部隐私。它还支持大量的插件、扩展和主题。你喜欢黑暗模式的界面?没问题。想基于关键词过滤发来的消息?TT-RSS 也能让你得偿所愿。 + +![Tiny Tiny RSS screenshot][3] + +现在你知道 TT-RSS 是什么了,那么为什么你可能会想用它。我会讲述要把它安装到树莓派或 Debian 10 服务器上你需要了解的所有的东西。 + +### 安装和配置 TT-RSS + +要把 TT-RSS 安装到树莓派上,你还需要安装和配置最新版本的 PHP(本文撰写时 PHP 最新版本是 7.3)、后端数据库 PostgreSQL、Nginx web 服务器、Git,最后才是 TT-RSS。 + +#### 1、安装 PHP 7 + +安装 PHP 7 是整个过程中最复杂的部分。幸运的是,它并不像看起来那样困难。从安装下面的支持包开始: + +``` +$ sudo apt install -y ca-certificates apt-transport-https +``` + +现在,添加存储库 PGP 密钥: + +``` +$ wget -q https://packages.sury.org/php/apt.gpg -O- | sudo apt-key add - +``` + +下一步,把 PHP 库添加到你的 apt 源: + +``` +$ echo "deb https://packages.sury.org/php/ buster main" | sudo tee /etc/apt/sources.list.d/php.list +``` + +然后更新你的存储库索引: + +``` +$ sudo apt update +``` + +最后,安装 PHP 7.3(或最新版本)和一些通用组件: + +``` +$ sudo apt install -y php7.3 php7.3-cli php7.3-fpm php7.3-opcache php7.3-curl php7.3-mbstring php7.3-pgsql php7.3-zip php7.3-xml php7.3-gd php7.3-intl +``` + +上面的命令默认你使用的后端数据库是 PostgreSQL,会安装 `php7.3-pgsql`。如果你想用 MySQL 或 MariaDB,你可以把命令参数改为 `php7.3-mysql`。 + +下一步,确认 PHP 已安装并在你的树莓派上运行着: + +``` +$ php -v +``` + +现在是时候安装和配置 Web 服务器了。 + +#### 2、安装 Nginx + +可以用下面的命令安装 Nginx: + +``` +$ sudo apt install -y nginx +``` + +修改默认的 Nginx 虚拟主机配置,这样 Web 服务器才能识别 PHP 文件以及知道如何处理它们。 + +``` +$ sudo nano /etc/nginx/sites-available/default +``` + +你可以安全地删除原文件中的所有内容,用下面的内容替换: + +``` +server { + listen 80 default_server; + listen [::]:80 default_server; + + root /var/www/html; + index index.html index.htm index.php; + server_name _; + + location / { + try_files $uri $uri/ =404; + } + + location ~ \.php$ { + include snippets/fastcgi-php.conf; + fastcgi_pass unix:/run/php/php7.3-fpm.sock; + } + +} +``` + +按 `Ctrl+O` 保存修改后的配置文件,然后按 `Ctrl+X` 退出 Nano。你可以用下面的命令测试你的新配置文件: + + +``` +$ nginx -t +``` + +如果没有报错,重启 Nginx 服务: + +``` +$ systemctl restart nginx +``` + +#### 3、安装 PostgreSQL + +接下来是安装数据库服务器。在树莓派上安装 PostgreSQL 超级简单: + +``` +$ sudo apt install -y postgresql postgresql-client postgis +``` + +输入下面的命令看一下数据库服务器安装是否成功: + +``` +$ psql --version +``` + +#### 4、创建 Tiny Tiny RSS 数据库 + +在做其他事之前,你需要创建一个数数据库,用来给 TT-RSS 软件保存数据。首先,登录 PostgreSQL 服务器: + +``` +sudo -u postgres psql +``` + +下一步,新建一个用户,设置密码: + +``` +CREATE USER username WITH PASSWORD 'your_password' VALID UNTIL 'infinity'; +``` + +然后创建一个给 TT-RSS 用的数据库: + + +``` +CREATE DATABASE tinyrss; +``` + +最后,给新建的用户赋最高权限: + +``` +GRANT ALL PRIVILEGES ON DATABASE tinyrss to user_name; +``` + +这是安装数据库的步骤。你可以输入 `\q` 来退出 `psql` 程序。 + +#### 5、安装 Git + +安装 TT-RSS 需要用 Git,所以输入下面的命令安装 Git: + +``` +$ sudo apt install git -y +``` + +现在,进入到 Nginx 服务器的根目录: + +``` +$ cd /var/www/html +``` + +下载 TT-RSS 最新源码: + +``` +$ git clone https://git.tt-rss.org/fox/tt-rss.git tt-rss +``` + +注意,这一步会创建一个 `tt-rss` 文件夹。 + +#### 6、安装和配置Tiny Tiny RSS + +现在是安装和配置你的新 TT-RSS 服务器的最后时刻了。首先,确认下你在浏览器中能打开 `http://your.site/tt-rss/install/index.php`。如果浏览器显示 `403 Forbidden`,那么就证明 `/var/www/html` 文件夹的权限没有设置正确。下面的命令通常能解决这个问题: + +``` +$ chmod 755 /var/www/html/ -v +``` + +如果一切正常,你会看到 TT-RSS 安装页面,它会让你输入一些数据的信息。你只需要输入前面你创建的数据库用户名和密码;数据库名;主机名填 `localhost`;端口填 `5432`。 + +点击“Test Configuration”。如果一切正常,你会看到一个标记着“Initialize Database”的红色按钮。点击它来开始安装。结束后,你会看到一个配置文件,你可以把它复制到 TT-RSS 的目录,另存为 `config.php`。 + +安装过程结束后,浏览器输入 `http://yoursite/tt-rss/` 打开 TT-RSS,使用默认的凭证登录(用户名:`admin`,密码:`password`)。登录后系统会提示你修改密码。我强烈建议你尽快修改密码。 + +### 配置 TT-RSS + +如果一切正常,你现在就可以开始使用 TT-RSS 了。建议你新建一个非管理员用户,使用新用户名登录,并开始导入你的馈送、订阅,按照你的意愿来配置它。 + +最后,并且是超级重要的事,不要忘了阅读 TT-RSS 维基上的 [Updating Feeds][4] 部分。它讲述了如何创建一个简单的 systemd 服务来更新馈送。如果你跳过了这一步,你的 RSS 馈送就不会自动更新。 + +### 总结 + +呵!工作量不小,但是你做完了!你现在有自己的 RSS 聚合服务器了。想了解 TT-RSS 更多的知识?我推荐你去看官方的 [FAQ][5]、[支持][6]论坛,和详细的[安装][7]笔记。如果你有任何问题,尽情地在下面评论吧。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/2/ttrss-raspberry-pi + +作者:[Patrick H. Mullins][a] +选题:[lujun9972][b] +译者:[lxbwolf](https://github.com/lxbwolf) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/pmullins +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/life-raspberrypi_0.png?itok=Kczz87J2 (Raspberries with pi symbol overlay) +[2]: https://tt-rss.org/ +[3]: https://opensource.com/sites/default/files/uploads/tt-rss.jpeg (Tiny Tiny RSS screenshot) +[4]: https://tt-rss.org/wiki/UpdatingFeeds +[5]: https://tt-rss.org/wiki/FAQ +[6]: https://community.tt-rss.org/c/tiny-tiny-rss/support +[7]: https://tt-rss.org/wiki/InstallationNotes diff --git a/published/202005/20200317 Create Stunning Pixel Art With Free and Open Source Editor Pixelorama.md b/published/202005/20200317 Create Stunning Pixel Art With Free and Open Source Editor Pixelorama.md new file mode 100644 index 0000000000..7a267a672e --- /dev/null +++ b/published/202005/20200317 Create Stunning Pixel Art With Free and Open Source Editor Pixelorama.md @@ -0,0 +1,105 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12173-1.html) +[#]: subject: (Create Stunning Pixel Art With Free and Open Source Editor Pixelorama) +[#]: via: (https://itsfoss.com/pixelorama/) +[#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/) + +使用 Pixelorama 创建令人惊叹的像素艺术 +====== + +> Pixelorama 是一个跨平台、自由开源的 2D 精灵编辑器。它在一个整洁的用户界面中提供了创建像素艺术所有必要工具。 + +### Pixelorama:开源 Sprite 编辑器 + +[Pixelorama][1] 是 [Orama 互动][2]公司的年轻游戏开发人员创建的一个工具。他们已经开发了一些 2D 游戏,其中一些使用了像素艺术。 + +虽然 Orama 主要从事于游戏开发,但开发人员也创建实用工具,帮助他们(和其他人)创建这些游戏。 + +自由开源的精灵Sprite编辑器 Pixelorama 就是这样一个实用工具。它构建在 [Godot 引擎][3]之上,非常适合创作像素艺术。 + +![Pixelorama screenshot][4] + +你看到上面截图中的像素艺术了吗?它是使用 Pixelorama 创建的。这段视频展示了制作上述图片的时间推移视频。 + +### Pixelorama 的功能 + +以下是 Pixelorama 提供的主要功能: + + * 多种工具,如铅笔、橡皮擦、填充桶、取色器等 + * 多层系统,你可以根据需要添加、删除、上下移动、克隆和合并多个层 + * 支持 Spritesheets + * 导入图像并在 Pixelorama 中编辑它们 + * 带有 [Onion Skinning][5] 的动画时间线 + * 自定义画笔 + * 以 Pixelorama 的自定义文件格式 .pxo 保存并打开你的项目 + * 水平和垂直镜像绘图 + * 用于创建图样的磁贴模式 + * 拆分屏幕模式和迷你画布预览 + * 使用鼠标滚轮缩放 + * 无限次撤消和重做 + * 缩放、裁剪、翻转、旋转、颜色反转和去饱和图像 + * 键盘快捷键 + * 提供多种语言 + * 支持 Linux、Windows 和 macOS + +### 在 Linux 上安装 Pixelorama + +Pixelorama 提供 Snap 应用,如果你使用的是 Ubuntu,那么可以在软件中心找到它。 + +![Pixelorama is available in Ubuntu Software Center][6] + +或者,如果你在 [Linux 发行版上启用了 Snap 支持][7],那么可以使用此命令安装它: + +``` +sudo snap install pixelorama +``` + +如果你不想使用 Snap,不用担心。你可以从[他们的 GitHub 仓库][8]下载最新版本的 Pixelorama,[解压 zip 文件][9],你会看到一个可执行文件。授予此文件执行权限,并双击它运行应用。 + +- [下载 Pixelorama][10] + +### 总结 + +![Pixelorama Welcome Screen][11] + +在 Pixeloaram 的功能中,它说你可以导入图像并对其进行编辑。我想,这只是对某些类型的文件,因为当我尝试导入 PNG 或 JPEG 文件,程序崩溃了。 + +然而,我可以像一个 3 岁的孩子那样随意涂鸦并制作像素艺术。我对艺术不是很感兴趣,但我认为这[对 Linux 上的数字艺术家是个有用的工具][12]。 + +我喜欢这样的想法:尽管是游戏开发人员,但他们创建的工具,可以帮助其他游戏开发人员和艺术家。这就是开源的精神。 + +如果你喜欢这个项目,并且会使用它,请考虑通过捐赠来支持他们。[It’s FOSS 捐赠了][13] 25 美元,以感谢他们的努力。 + +- [向 Pixelorama 捐赠(主要开发者的个人 Paypal 账户)][14] + +你喜欢 Pixelorama 吗?你是否使用其他开源精灵编辑器?请随时在评论栏分享你的观点。 + +-------------------------------------------------------------------------------- +via: https://itsfoss.com/pixelorama/ + +作者:[Abhishek Prakash][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://itsfoss.com/author/abhishek/ +[b]: https://github.com/lujun9972 +[1]: https://www.orama-interactive.com/pixelorama +[2]: https://www.orama-interactive.com/ +[3]: https://godotengine.org/ +[4]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/03/pixelorama-v6.jpg?ssl=1 +[5]: https://en.wikipedia.org/wiki/Onion_skinning +[6]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/03/pixelorama-ubuntu-software-center.jpg?ssl=1 +[7]: https://itsfoss.com/install-snap-linux/ +[8]: https://github.com/Orama-Interactive/Pixelorama +[9]: https://itsfoss.com/unzip-linux/ +[10]: https://github.com/Orama-Interactive/Pixelorama/releases +[11]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/03/pixelorama.jpg?ssl=1 +[12]: https://itsfoss.com/best-linux-graphic-design-software/ +[13]: https://itsfoss.com/donations-foss/ +[14]: https://www.paypal.me/erevos diff --git a/published/202005/20200323 How to create a personal file server with SSH on Linux.md b/published/202005/20200323 How to create a personal file server with SSH on Linux.md new file mode 100644 index 0000000000..14abf4cc64 --- /dev/null +++ b/published/202005/20200323 How to create a personal file server with SSH on Linux.md @@ -0,0 +1,134 @@ +[#]: collector: (lujun9972) +[#]: translator: (lxbwolf) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12255-1.html) +[#]: subject: (How to create a personal file server with SSH on Linux) +[#]: via: (https://opensource.com/article/20/3/personal-file-server-ssh) +[#]: author: (Jim Hall https://opensource.com/users/jim-hall) + +怎样在 Linux 下用 SSH 搭建个人文件服务器 +====== + +> 通过 SSH 连接远程 Linux 系统很简单。下面是教程。 + +![](https://img.linux.net.cn/data/attachment/album/202005/27/120338v62cakrqnccpjckk.jpg) + +树莓派是一个有用且价格低廉的家庭服务器,可用于很多事情。我的树莓派最常用来做[打印服务器][2],可以在我的家庭网络中共享激光打印机,或作为个人文件服务器保存项目副本和其他数据。 + +我的文件服务器有很多用途。假设说我现在有一个项目,比如一本新书,我想把我的工作和所有相关的文件都复制一份快照。这种场景下,我只需要把 `BookProject` 文件夹复制到文件服务器的 `BookBackup` 文件夹。 + +或者我现在正在清理我的本地文件时,发现一些我不需要的文件,但是我不确定是否要删除,我会把它们复制到文件服务器的 `KeepForLater` 文件夹。这是我日常 Linux 系统中清除杂乱的文件,并将不常用的文件卸载到个人文件服务器上的方便方法。 + +用树莓派或其他 Linux 系统搭建个人文件服务器不需要配置 NFS(网络文件系统Network File System>)或 CIFS(通用互联网文件系统Common Internet File System)或改造其他的文件共享系统如 WebDAV。你可以很轻松的使用 SSH 来搭建远程文件服务器。下面是教程。 + +### 在远程服务器上配置 SSHD + +你的 Linux 系统可能已经安装了 SSH 守护进程(`sshd`),甚至它已经默认运行了。如果没有,你可以使用你 Linux 发行版本上的任何控制面板来轻松配置 SSH。我在树莓派上运行了 [Fedora ARM][3],通过 Web 浏览器访问树莓派的 9090 端口,我可以远程访问控制面板。(在我的家庭网络中,树莓派的 IP 地址是 `10.0.0.11`,因此我连接的是 `10.0.0.11:9090`。)如果 SSH 守护进程没有默认运行,你可以在控制面板的“服务”里把它设置为开机启动。 + +![sshd in the list of system services][4] + +你可以在系统服务列表里找到 `sshd`。 + +![slider to activate sshd][5] + +如果 `sshd` 没有开启,点击切换按钮打开它。 + +### 你有账号吗? + +你需要有个远程系统的账号。它可以与你本地系统的账号相同,也可以不同。 + +在流行的 Raspbian 发行版本上,默认的账号名是 `pi`。但是其他的 Linux 发行版本可能需要你在安装系统时就设置一个唯一的新用户。如果你不知道你的用户名,你可以用系统的控制面板创建一个。在我的树莓派上,我创建了一个 `jhall` 账号,与我日常用的 Linux 桌面机器的用户名相同。 + +![Set up a new account on Fedora Server][6] + +如果你用的是 Fedora 服务器,你可以点击“创建新账号”按钮。 + +![Set password or SSH key][7] + +不要忘记设置密码或添加公钥。 + +### 可选:添加公钥 + +如果你把公钥添加到远程 Linux 系统上,你就可以不使用密码登录。这一步是可选的;如果你愿意,你仍可以用密码登录。 + +你可以在下面的文章中学到更多关于 SSH 密钥的信息: + +* [SSH 密钥管理工具][8] +* [用 Seahorse 对 SSH 密钥进行图形化管理][9] +* [如何管理多个 SSH 密钥][10] +* [使用 GPG 密钥作为鉴权依据开启 SSH 访问][11] + +### 创建文件管理器的快捷方式 + +现在你已经在远程系统上启动 SSH 守护进程了,也设置了用户名和密码,最后一步就是在你本地的文件管理器中创建一个快捷方式,地址映射到远程 Linux 系统。我的桌面是 GNOME,但是在其他的 Linux 桌面上的基本操作步骤都是一样的。 + +#### 建立初始连接 + +在 GNOME 的文件管理器中,在左边导航栏找到 “+其它位置” 按钮。点击它会出现一个 “连接到服务器” 提示框。在框中输入远程 Linux 服务器的地址,地址以 SSH 连接协议开头。 + +![Creating a shortcut in GNOME file manager][12] + +GNOME 文件管理器支持多种连接协议。要通过 SSH 进行连接,服务器地址请以 `sftp://` 或 `ssh://` 开头。 + +如果你远程 Linux 系统的用户名与本地的相同,那么你只需要输入服务器的地址和文件夹路径就可以了。比如要连接到我的树莓派的 `/home/jhall` 目录,我输入: + +``` +sftp://10.0.0.11/home/jhall +``` + +![GNOME file manager Connect to Server][13] + +如果你远程 Linux 系统的用户名与本地的不同,你可以在远程系统地址前加 `@` 符号来指定远程系统的用户名。要连接到远程的 Raspbian 系统,你可能要输入: + +``` +sftp://pi@10.0.0.11/home/pi +``` + +![GNOME file manager Connect to Server][14] + +如果你没有把公钥添加到远程服务器,那么你需要输入密码。如果你已经添加,GNOME 文件管理器应该会自动打开远程系统上的文件夹来让你跳转到不同的目录。 + +![GNOME file manager connection][15] + +#### 创建一个快捷方式,之后就可以轻松连接服务器 + +在 GNOME 文件管理器中,这很简单。右击导航栏中远程系统的名字,选择“添加书签”。这一步操作就创建了连接到远程路径的快捷方式。 + +![GNOME file manager - adding bookmark][16] + +如果你想把标签中的快捷方式改成一个更容易记的名字,你可以右击快捷方式选择“重命名”。 + +### 总结 + +通过 SSH 连接到远程 Linux 系统是很简单的事。你可以用相同的方式连接到家庭文件服务器以外的其他系统。我还创建了一个能让我立即访问我的提供商 Web 服务器上的文件的快捷方式,和另一个能迅速打开我的项目服务器的文件夹的快捷方式。SSH 使它成为一个安全的连接;所有的传输都是加密的。当我通过 SSH 打开远程的文件时,我可以像在本地操作一样使用 GNOME 文件管理器轻松打开远程文件。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/3/personal-file-server-ssh + +作者:[Jim Hall][a] +选题:[lujun9972][b] +译者:[lxbwolf](https://github.com/lxbwolf) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/jim-hall +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/yearbook-haff-rx-linux-file-lead_0.png?itok=-i0NNfDC (Hand putting a Linux file folder into a drawer) +[2]: https://opensource.com/article/18/3/print-server-raspberry-pi +[3]: https://arm.fedoraproject.org/ +[4]: https://opensource.com/sites/default/files/uploads/fedora-server-control-panel-sshd.png (sshd in the list of system services) +[5]: https://opensource.com/sites/default/files/uploads/fedora-server-control-panel-sshd-service.png (slider to activate sshd) +[6]: https://opensource.com/sites/default/files/uploads/fedora-server-control-panel-accounts_create-user.png (Set up a new account on Fedora Server) +[7]: https://opensource.com/sites/default/files/uploads/fedora-server-control-panel-accounts.png (Set password or SSH key) +[8]: https://linux.cn/article-11947-1.html +[9]: https://linux.cn/article-9451-1.html +[10]: https://opensource.com/article/19/4/gpg-subkeys-ssh-manage +[11]: https://opensource.com/article/19/4/gpg-subkeys-ssh +[12]: https://opensource.com/sites/default/files/uploads/gnome-file-manager-other-locations.png (Creating a shortcut in GNOME file manager) +[13]: https://opensource.com/sites/default/files/uploads/gnome-file-manager-other-sftp.png (GNOME file manager Connect to Server) +[14]: https://opensource.com/sites/default/files/uploads/gnome-file-manager-other-sftp-username.png (GNOME file manager Connect to Server) +[15]: https://opensource.com/sites/default/files/uploads/gnome-file-manager-remote-jhall.png (GNOME file manager connection) +[16]: https://opensource.com/sites/default/files/uploads/gnome-file-manager-remote-jhall-add-bookmark.png (GNOME file manager - adding bookmark) diff --git a/published/202005/20200324 Audacious 4.0 Released With Qt 5- Here-s How to Install it on Ubuntu.md b/published/202005/20200324 Audacious 4.0 Released With Qt 5- Here-s How to Install it on Ubuntu.md new file mode 100644 index 0000000000..8b46842802 --- /dev/null +++ b/published/202005/20200324 Audacious 4.0 Released With Qt 5- Here-s How to Install it on Ubuntu.md @@ -0,0 +1,104 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12250-1.html) +[#]: subject: (Audacious 4.0 Released With Qt 5: Here’s How to Install it on Ubuntu) +[#]: via: (https://itsfoss.com/audacious-4-release/) +[#]: author: (Ankush Das https://itsfoss.com/author/ankush/) + +如何安装使用 Qt 5 的音频播放器 Audacious 4.0 +====== + +[Audacious][1] 是一个开源音频播放器,可用于包括 Linux 在内的多个平台。继上次发布主版本将近 2 年后,Audacious 4.0 带来了一些重大变化。 + +最新版本的 Audacious 4.0 默认带 [Qt 5][2] 用户界面。你仍然可以和以前一样使用旧的 GTK2 UI,但是,新功能仅会添加到 Qt UI 中。 + +让我们看下发生了什么变化,以及如何在 Linux 系统上安装最新的 Audacious。 + +### Audacious 4.0 关键变化和功能 + +![Audacious 4 Release][3] + +当然,主要的变化是默认使用 Qt 5 UI。除此之外,他们的[官方公告][4]中提到了许多改进和功能补充,它们是: + +* 单击播放列表列头可对播放列表进行排序 +* 拖动播放列表列头会更改列顺序 +* 应用中的音量和时间步长设置 +* 隐藏播放列表标签的新选项 +* 按路径对播放列表排序,现在将文件夹排序在文件后面 +* 实现了额外的 MPRIS 调用,以与 KDE 5.16+ 兼容 +* 新的基于 OpenMPT 的跟踪器模块插件 +* 新的 VU Meter 可视化插件 +* 添加了使用 SOCKS 网络代理的选项 +* 换歌插件现在可在 Windows 上使用 +* 新的“下一张专辑”和“上一张专辑”命令 +* Qt UI 中的标签编辑器现在可以一次编辑多个文件 +* 为 Qt UI 实现均衡器预设窗口 +* 歌词插件获得了在本地保存和加载歌词的能力 +* 模糊范围和频谱分析器可视化已移植到 Qt +* MIDI 插件 “SoundFont 选择”已移植到 Qt +* JACK 输出插件获得了一些新选项 +* 添加了无限循环 PSF 文件的选项 + +如果你以前不了解它,你可以轻松安装它,并使用均衡器和 [LADSP][5] 效果器来调整音乐体验。 + +![Audacious Winamp Classic Interface][6] + +### 如何在 Ubuntu 上安装 Audacious 4.0 + +值得注意的是,[非官方 PPA][7] 是由 [UbuntuHandbook][8] 提供的。你可以按照以下说明在 Ubuntu 16.04、18.04、19.10 和 20.04 上进行安装。 + +1、首先,你必须在终端中输入以下命令将 PPA 添加到系统中: + +``` +sudo add-apt-repository ppa:ubuntuhandbook1/apps +``` + +2、接下来,你需要从仓库中更新(刷新)软件包信息,然后继续安装该应用。方法如下: + +``` +sudo apt update +sudo apt install audacious audacious-plugins +``` + +就是这样。你无需执行其他任何操作。无论什么情况,如果你想[删除 PPA 和软件][9],只需按顺序输入以下命令: + +``` +sudo add-apt-repository --remove ppa:ubuntuhandbook1/apps +sudo apt remove --autoremove audacious audacious-plugins +``` + +你也可以在它的 GitHub 页面上查看有关源码的更多信息,并根据需要在其他 Linux 发行版上进行安装。 + +- [Audacious 源代码][10] + +### 总结 + +新功能和 Qt 5 UI 开关对于改善用户体验和音频播放器的功能应该是一件好事。如果你是经典 Winamp 界面的粉丝,它也可以正常工作。但缺少其公告中提到的一些功能。 + +你可以尝试一下,并在下面的评论中让我知道你的想法! + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/audacious-4-release/ + +作者:[Ankush Das][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://itsfoss.com/author/ankush/ +[b]: https://github.com/lujun9972 +[1]: https://audacious-media-player.org +[2]: https://doc.qt.io/qt-5/qt5-intro.html +[3]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/03/audacious-4-release.jpg?ssl=1 +[4]: https://audacious-media-player.org/news/45-audacious-4-0-released +[5]: https://www.ladspa.org/ +[6]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/03/audacious-winamp.jpg?ssl=1 +[7]: https://itsfoss.com/ppa-guide/ +[8]: http://ubuntuhandbook.org/index.php/2020/03/audacious-4-0-released-qt5-ui/ +[9]: https://itsfoss.com/how-to-remove-or-delete-ppas-quick-tip/ +[10]: https://github.com/audacious-media-player/audacious diff --git a/published/202005/20200326 Tricks for getting around your Linux file system.md b/published/202005/20200326 Tricks for getting around your Linux file system.md new file mode 100644 index 0000000000..d9d6cf1006 --- /dev/null +++ b/published/202005/20200326 Tricks for getting around your Linux file system.md @@ -0,0 +1,142 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12239-1.html) +[#]: subject: (Tricks for getting around your Linux file system) +[#]: via: (https://www.networkworld.com/article/3533421/tricks-for-getting-around-your-linux-file-system.html) +[#]: author: (Sandra Henry-Stocker https://www.networkworld.com/author/Sandra-Henry_Stocker/) + +在 Linux 文件系统中导航的技巧 +====== + +> cd 命令可能是任何 Linux 用户学习的前 10 个命令之一,但这并不是在 Linux 文件系统中导航的唯一方法,这里还有其他一些方法。 + +![](https://img.linux.net.cn/data/attachment/album/202005/22/114058yrzlx94rz9lbx974.jpg) + +无论你是在文件系统中四处查看、寻找文件还是尝试进入重要目录,Linux 都可以提供很多帮助。在本文中,我们将介绍一些技巧,使你可以在文件系统中移动,查找和使用所需的命令也更加轻松。 + +### 添加到 \$PATH + +确保你不必花费大量时间在 Linux 系统上查找命令的最简单、最有用的方法之一就是在 `$PATH` 变量中添加适当的目录。但是,添加到 `$PATH` 变量中的目录顺序非常重要。它们确定系统在目录中查找要运行命令的目录顺序--在找到第一个匹配项时停止。 + +例如,你可能希望将家目录放在第一个,这样,如果你创建的脚本与其他可执行文件有相同的名称,那么只要输入该脚本的名称,它便会运行。 + +要将家目录添加到 `$PATH` 变量中,可以执行以下操作: + +``` +$ export PATH=~:$PATH +``` + +`~` 字符代表家目录。 + +如果将脚本保存在 `bin` 目录中,下面的会有效: + +``` +$ export PATH=~/bin:$PATH +``` + +然后,你可以运行位于家目录中的脚本,如下所示: + +``` +$ myscript +Good morning, you just ran /home/myacct/bin/myscript +``` + +**重要提示:**上面显示的命令会添加到你的搜索路径中,因为 `$PATH`(当前路径)被包含在内。它们不会覆盖它。你的搜索路径应该在你的 `.bashrc` 文件中配置,任何你打算永久化的更改也应该添加到那里。 + +### 使用符号链接 + +符号链接提供了一种简单而明显的方式来记录可能经常需要使用的目录的位置。例如,如果你管理网站的内容,那么可能需要通过创建如下链接来使你的帐户“记住”网页文件的位置: + +``` +ln -s /var/www/html www +``` + +参数的顺序很重要。第一个(`/var/www/html`)是目标,第二个是你创建的链接的名称。如果你当前不在家目录中,那么以下命令将执行相同的操作: + +``` +ln -s /var/www/html ~/www +``` + +设置好之后,你可以使用 `cd www` 进入 `/var/www/html`。 + +### 使用 shopt + +`shopt` 命令还提供了一种让移动到其他目录更加容易的方法。当你使用 `shopt` 的 `autocd` 选项时,只需输入名称即可转到目录。例如: + +``` +$ shopt -s autocd +$ www +cd -- www +/home/myacct/www +$ pwd -P +/var/www/html + +$ ~/bin +cd -- /home/myacct/bin +$ pwd +/home/myacct/bin +``` + +在上面的第一组命令中,启用了 `shopt` 命令的 `autocd` 选项。输入 `www`,就会调用 `cd www` 命令。由于此符号链接是在上面的 `ln` 命令示例之一中创建的,因此将我们移至 `/var/www/html`。 `pwd -P` 命令显示实际位置。 + +在第二组中,键入 `~/bin` 会调用 `cd` 进入在用户家目录的 `bin` 目录。 + +请注意,当你输入的是命令时,`autocd` 行为将*不会*生效,即使它也是目录的名称。 + +`shopt` 是 bash 内置命令,它有很多选项。这只是意味着你不必在要进入每个目录的名称之前输入 `cd`。 + +要查看 `shopt` 的其他选项,只需输入 `shopt`。 + +### 使用 \$CDPATH + +可能进入特定目录的最有用技巧之一,就是将你希望能够轻松进入的路径添加到 `$CDPATH` 中。这将创建一个目录列表,只需输入完整路径名的一部分即可进入。 + +一方面,这可能有点棘手。你的 `$CDPATH` 需要包含要移动到的目录的父目录,而不是目录本身。 + +例如,假设你希望仅通过输入 `cd html` 就可以移至 `/var/www/html` 目录,并仅使用 `cd` 和简单目录名即可移至 `/var/log` 中的子目录。在这种情况下,此 `$CDPATH` 就可以起作用: + +``` +$ CDPATH=.:/var/log:/var/www +``` + +你将看到: + +``` +$ cd journal +/var/log/journal +$ cd html +/var/www/html +``` + +当你输入的不是完整路径时,`$CDPATH` 就会生效。它向下查看其目录列表,以查看指定的目录是否存在于其中一个目录中。找到匹配项后,它将带你到那里。 + +在 `$CDPATH` 开头保持 `.` 意味着你可以进入本地目录,而不必在 `$CDPATH` 中定义它们。 + +``` +$ export CDPATH=".:$CDPATH" +$ Videos +cd -- Videos +/home/myacct/Videos +``` + +在 Linux 文件系统键切换并不难,但是如果你使用一些方便的技巧轻松地到达各个位置,那你可以节省一些大脑细胞。 + + +-------------------------------------------------------------------------------- + +via: https://www.networkworld.com/article/3533421/tricks-for-getting-around-your-linux-file-system.html + +作者:[Sandra Henry-Stocker][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://www.networkworld.com/author/Sandra-Henry_Stocker/ +[b]: https://github.com/lujun9972 +[2]: https://www.networkworld.com/blog/itaas-and-the-corporate-storage-technology/?utm_source=IDG&utm_medium=promotions&utm_campaign=HPE22140&utm_content=sidebar (ITAAS and Corporate Storage Strategy) +[3]: https://www.facebook.com/NetworkWorld/ +[4]: https://www.linkedin.com/company/network-world diff --git a/published/202005/20200331 Rambox is an All-in-one Messenger for Linux.md b/published/202005/20200331 Rambox is an All-in-one Messenger for Linux.md new file mode 100644 index 0000000000..93a73f4a54 --- /dev/null +++ b/published/202005/20200331 Rambox is an All-in-one Messenger for Linux.md @@ -0,0 +1,96 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12171-1.html) +[#]: subject: (Rambox is an All-in-one Messenger for Linux) +[#]: via: (https://itsfoss.com/rambox/) +[#]: author: (Ankush Das https://itsfoss.com/author/ankush/) + +Rambox:Linux 中多合一的消息收发工具 +====== + +> Rambox 是一个多合一消息收发工具,允许你将多种服务(如 Discord、Slack、Facebook Messenger)和数百个此类服务结合在一起。 + +### Rambox:在单个应用中添加多个消息服务 + +![][1] + +Rambox 是通过安装单个应用管理多个通信服务的最佳方式之一。你可以在一个界面使用[多个消息服务][2],如 Facebook Messenger、Gmail chats、AOL、Discord、Google Duo、[Viber][3] 等。 + +这样,你就不需要安装单独的应用或者在浏览器中一直打开着。你可以使用主密码锁定 Rambox 应用。你还可以使用“请勿打扰”功能。 + +Rambox 提供可免费使用的[开源社区版][4]。付费专业版允许你访问 600 多个应用,而社区版则包含 99 多个应用。专业版本具有额外的功能,如主题、休眠、ad-block、拼写检查和高级支持。 + +不用担心。开源社区版本身非常有用,你甚至不需要这些专业功能。 + +### Rambox 的功能 + +![][5] + +虽然你应该在开源版中找到大多数基本功能,但你可能会注意到其中一些功能仅限于专业版。 + +此处,我说下所有的基本功能: + + * 在开源版本中,你有大约 100 个应用/服务可供选择 + * 能够使用单个主密码锁保护应用 + * 能够锁定加载的每个会话 + * 请勿打扰模式 + * 能够跨多个设备同步应用和配置 + * 你可以创建和添加自定义应用 + * 支持键盘快捷键 + * 启用/禁用应用而无需删除它们 + * JS 和 CSS 注入支持,以调整应用的样式 + * Ad-block (**专业版**) + * 休眠支持 (**专业版**) + * 主题支持(**专业版**) + * 移动设备视图 (**专业版**) + * 拼写检查 (**专业版**) + * 工作时间 - 计划传入通知的时间 (**专业版**) + * 支持代理 (**专业版**) + +除了我在这里列出的内容外,你还可以在 Rambox Pro 版本中找到更多功能。要了解有关它的更多信息,你可以参考[正式功能列表][6]。 + +还值得注意的是,你不能超过 3 个活跃并发设备的连接。 + +### 在 Linux 上安装 Rambox + +你可以在[官方下载页][4]获取 .AppImage 文件来运行 Rambox。如果你不清楚,你可以参考我们的指南,了解如何[在 Linux 上使用 AppImage 文件][7]。 + +另外,你也可以从 [Snap 商店][8]获取它。此外,请查看其 [GitHub release][9] 部分的 .deb / .rpm 或其他包。 + +- [下载 Rambox 社区版][4] + +### 总结 + +使用 Rambox 安装大量应用可能会有点让人不知所措。因此,我建议你在添加更多应用并将其用于工作时监视内存使用情况。 + +还有一个类似的应用称为 [Franz][10],它也像 Rambox 部分开源、部分高级版。 + +尽管像 Rambox 或 Franz 这样的解决方案非常有用,但它们并不总是节约资源,特别是如果你同时使用数十个服务。因此,请留意系统资源(如果你注意到对性能的影响)。 + +除此之外,这是一个令人印象深刻的应用。你有试过了么?欢迎随时让我知道你的想法! + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/rambox/ + +作者:[Ankush Das][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://itsfoss.com/author/ankush/ +[b]: https://github.com/lujun9972 +[1]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/03/rambox-ce.jpg?ssl=1 +[2]: https://itsfoss.com/best-messaging-apps-linux/ +[3]: https://itsfoss.com/viber-linux-client-beta-install/ +[4]: https://rambox.pro/#ce +[5]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/03/rambox-preferences.png?ssl=1 +[6]: https://rambox.pro/#features +[7]: https://itsfoss.com/use-appimage-linux/ +[8]: https://snapcraft.io/rambox +[9]: https://github.com/ramboxapp/community-edition/releases +[10]: https://itsfoss.com/franz-messaging-app/ diff --git a/published/202005/20200401 3 Python templating languages you should (probably) never use.md b/published/202005/20200401 3 Python templating languages you should (probably) never use.md new file mode 100644 index 0000000000..a5a7502767 --- /dev/null +++ b/published/202005/20200401 3 Python templating languages you should (probably) never use.md @@ -0,0 +1,177 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12252-1.html) +[#]: subject: (3 Python templating languages you should (probably) never use) +[#]: via: (https://opensource.com/article/20/4/python-templating-languages) +[#]: author: (Moshe Zadka https://opensource.com/users/moshez) + +你应该(或许)没使用过的 3 种 Python 模板语言 +====== + +> 包括这 3 个模板语言在内,Python 积累了许多模板语言。 + +![](https://img.linux.net.cn/data/attachment/album/202005/26/110220lxie9osmd592m5ee.jpg) + +当需要使用模板语言来编写 [Python][2] Web 应用时,有很多健壮的解决方案。 + +有 [Jinja2][3]、[Genshi 和 Mako][4]。甚至还有 [Chameleon][5] 之类的解决方案,虽然有些陈旧,但仍被 [Pyramid][6] 框架推荐。 + +Python 已经存在了很长时间。此时,在系统的深处,它积累了一些几乎被遗忘的模板语言,它们都是值得一试的。 + +这些语言就像桉树上可爱的考拉一样,在自己的生态圈里快乐地生活着,有时也会有危险的工作,这些都是很少有人听说过的模板语言,使用过的应该更少。 + +### 3、string.Template + +你是否曾经想过:“如何获得一种没有任何特性的模板语言,而且同时也不需要 `pip install` 安装任何东西?” Python 标准库已经为你提供了答案。虽然没有循环和条件,但 `string.Template` 类是一种最小的模板语言。 + +使用它很简单。 + +``` +>>> import string +>>> greeting = string.Template("Hello, $name, good $time!") +>>> greeting.substitute(name="OpenSource.com", time="afternoon") +'Hello, OpenSource.com, good afternoon!' +``` + +### 2、twisted.web.template + +你会给一个包罗万象的库送什么礼物? + +当然,不是模板语言,因为它已经有了。twisted.web.template 中嵌套了两种模板语言。一种是基于 XML 的,并有一个[很棒的文档][7]。 + +但是它还有另一种,一种基于使用 Python 作为领域特定语言(DSL)来生成 HTML 文档。 + +它基于两个原语:包含标签对象的 `twisted.web.template.tags` 和渲染它们的 `twisted.web.template.flattenString`。由于它是 Twisted 的一部分,因此它内置支持高效异步渲染。 + +此例将渲染一个小页面: + +``` +async def render(reactor): + my_title = "A Fun page" + things = ["one", "two", "red", "blue"] + template = tags.html( + tags.head( + tags.title(my_title), + ), + tags.body( + tags.h1(my_title), + tags.ul( + [tags.li(thing) for thing in things], + ), + tags.p( + task.deferLater(reactor, 3, lambda: "Hello "), + task.deferLater(reactor, 3, lambda: "world!"), + ) + ) + ) + res = await flattenString(None, template) + res = res.decode('utf-8') + with open("hello.html", 'w') as fpout: + fpout.write(res) +``` + +该模板是使用 `tags.` 来指示层次结构的常规 Python 代码。原生支持渲染字符串,因此任何字符串都正常。 + +要渲染它,你需要做的是添加调用: + +``` +from twisted.internet import task, defer +from twisted.web.template import tags, flattenString + +def main(reactor): +    return defer.ensureDeferred(render(reactor)) +``` + +最后写上: + + +``` +task.react(main) +``` + +只需 3 秒(而不是 6 秒),它将渲染一个不错的 HTML 页面。在实际中,这些 `deferLater` 可以是对 HTTP API 的调用:它们将并行发送和处理,而无需付出任何努力。我建议你阅读关于[更好地使用 Twisted][8]。不过,这已经可以工作了。 + +### 1、Quixote + +你会说:“但是 Python 并不是针对 HTML 领域而优化的领域特定语言。” 如果有一种语言可以[转化][9]到 Python,但是更适合定义模板,而不是像 Python 那样按原样解决呢?如果可以的话,请使用“Python 模板语言”(PTL)。 + +编写自己的语言,有时被说成是一个攻击假想敌人的唐吉坷德项目。当 Quixote(可在 [PyPI][10] 中找到)的创造者决定这样做时,并没有受此影响。 + +以下将渲染与上面 Twisted 相同的模板。*警告:以下不是有效的 Python 代码*: + +``` +import time + +def render [html] (): + my_title = "A Fun page" + things = ["one", "two", "red", "blue"] + "" + my_title + "</head>

" + my_title + "

" + "
    " + for thing in things: + "
  • " + thing + "
  • " + "

    " + time.sleep(3) + (lambda: "Hello ")() + time.sleep(3) + (lambda: "world!")() + "

    " + "" + +def write(): + result = render() + with open("hello.html", 'w') as fpout: + fpout.write(str(result)) +``` + +但是,如果将它放到 `template.ptl` 文件中,那么可以将其导入到 Quixote 中,并写出可以渲染模板的版本: + + +``` +>>> from quixote import enable_ptl +>>> enable_ptl() +>>> import template +>>> template.write() +``` + +Quixote 安装了一个导入钩子,它会将 PTL 文件转换为 Python。请注意,此渲染需要 6 秒,而不是 3 秒。你不再获得自由的异步性。 + +### Python 中的模板太多 + +Python 库的历史悠久且曲折,其中一些库可以或多或少都能达到类似结果(例如,Python [包管理][11])。 + +我希望你喜欢探索这三种*可以*用 Python 创建模板的方式。另外,我建议从[这三个库之一][4]开始了解。 + +你是否有另一种深奥的模板方法?请在下面的评论中分享! + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/4/python-templating-languages + +作者:[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://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/python-programming-code-keyboard.png?itok=fxiSpmnd (Hands on a keyboard with a Python book ) +[2]: https://opensource.com/resources/python +[3]: https://opensource.com/article/20/2/jinja2-cheat-sheet +[4]: https://opensource.com/resources/python/template-libraries +[5]: https://chameleon.readthedocs.io/en/latest/ +[6]: https://opensource.com/article/18/5/pyramid-framework +[7]: https://twistedmatrix.com/documents/13.1.0/web/howto/twisted-templates.html +[8]: https://opensource.com/article/20/3/treq-python +[9]: https://en.wikipedia.org/wiki/Source-to-source_compiler +[10]: https://pypi.org/project/Quixote/ +[11]: https://opensource.com/article/19/4/managing-python-packages diff --git a/published/202005/20200401 The ins and outs of high-performance computing as a service.md b/published/202005/20200401 The ins and outs of high-performance computing as a service.md new file mode 100644 index 0000000000..ef96b09ffe --- /dev/null +++ b/published/202005/20200401 The ins and outs of high-performance computing as a service.md @@ -0,0 +1,96 @@ +[#]: collector: (lujun9972) +[#]: translator: (messon007) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12202-1.html) +[#]: subject: (The ins and outs of high-performance computing as a service) +[#]: via: (https://www.networkworld.com/article/3534725/the-ins-and-outs-of-high-performance-computing-as-a-service.html) +[#]: author: (Josh Fruhlinger https://www.networkworld.com/author/Josh-Fruhlinger/) + +超算即服务:超级计算机如何上云 +====== + +> 高性能计算(HPC)服务可能是一种满足不断增长的超级计算需求的方式,但依赖于使用场景,它们不一定比使用本地超级计算机好。 + +![](https://img.linux.net.cn/data/attachment/album/202005/09/223805mrjfjzecr3hceais.jpg) + +导弹和军用直升机上的电子设备需要工作在极端条件下。美国国防承包商麦考密克·史蒂文森公司McCormick Stevenson Corp.在部署任何物理设备之前都会事先模拟它所能承受的真实条件。模拟依赖于像 Ansys 这样的有限元素分析软件,该软件需要强大的算力。 + +几年前的一天,它出乎意料地超出了计算极限。 + +麦考密克·史蒂文森公司的首席工程师 Mike Krawczyk 说:“我们的一些工作会使办公室的计算机不堪重负。购买机器并安装软件在经济上或计划上都不划算。”相反,他们与 Rescale 签约,该公司销售其超级计算机系统上的处理能力,而这只花费了他们购买新硬件上所需的一小部分。 + +麦考密克·史蒂文森公司已成为被称为超级计算即服务或高性能计算即服务(两个紧密相关的术语)市场的早期采用者之一。根据国家计算科学研究所的定义,HPC 是超级计算机在计算复杂问题上的应用,而超级计算机是处理能力最先进的那些计算机。 + +无论叫它什么,这些服务都在颠覆传统的超级计算市场,并将 HPC 能力带给以前负担不起的客户。但这不是万能的,而且绝对不是即插即用的,至少现在还不是。 + +### HPC 服务实践 + +从最终用户的角度来看,HPC 即服务类似于早期大型机时代的批处理模型。 “我们创建一个 Ansys 批处理文件并将其发送过去,运行它,然后将结果文件取下来,然后导入到本地,” Krawczyk 说。 + +在 HPC 服务背后,云提供商在其自己的数据中心中运行超级计算基础设施,尽管这不一定意味着当你听到“超级计算机”时你就会看到最先进的硬件。正如 IBM OpenPOWER 计算技术副总裁 Dave Turek 解释的那样,HPC 服务的核心是“相互互连的服务器集合。你可以调用该虚拟计算基础设施,它能够在你提出问题时,使得许多不同的服务器并行工作来解决问题。” + +理论听起来很简单。但都柏林城市大学数字商业教授 Theo Lynn 表示,要使其在实践中可行,需要解决一些技术问题。普通计算与 HPC 的区别在于那些互联互通 —— 高速的、低延时的而且昂贵的 —— 因此需要将这些互连引入云基础设施领域。在 HPC 服务可行之前,至少需要将存储性能和数据传输也提升到与本地 HPC 相同的水平。 + +但是 Lynn 说,一些制度创新相比技术更好的帮助了 HPC 服务的起飞。特别是,“我们现在看到越来越多的传统 HPC 应用采用云友好的许可模式 —— 这在过去是阻碍采用的障碍。” + +他说,经济也改变了潜在的客户群。“云服务提供商通过向那些负担不起传统 HPC 所需的投资成本的低端 HPC 买家开放,进一步开放了市场。随着市场的开放,超大规模经济模型变得越来越多,更可行,成本开始下降。” + +### 避免本地资本支出 + +HPC 服务对传统超级计算长期以来一直占据主导地位的私营部门客户具有吸引力。这些客户包括严重依赖复杂数学模型的行业,包括麦考密克·史蒂文森公司等国防承包商,以及石油和天然气公司、金融服务公司和生物技术公司。都柏林城市大学的 Lynn 补充说,松耦合的工作负载是一个特别好的用例,这意味着许多早期采用者将其用于 3D 图像渲染和相关应用。 + +但是,何时考虑 HPC 服务而不是本地 HPC 才有意义?对于德国的模拟烟雾在建筑物中的蔓延和火灾对建筑物结构部件的破坏的 hhpberlin 公司来说,答案是在它超出了其现有资源时。 + +Hpberlin 公司数值模拟的科学负责人 Susanne Kilian 说:“几年来,我们一直在运行自己的小型集群,该集群具有多达 80 个处理器核。……但是,随着应用复杂性的提高,这种架构已经越来越不足以支撑;可用容量并不总是够快速地处理项目。” + +她说:“但是,仅仅花钱买一个新的集群并不是一个理想的解决方案:鉴于我们公司的规模和管理环境,不断地维护这个集群(定期进行软件和硬件升级)是不现实的。另外,需要模拟的项目数量会出现很大的波动,因此集群的利用率并不是真正可预测的。通常,使用率很高的阶段与很少使用或不使用的阶段交替出现。”通过转换为 HPC 服务模式,hhpberlin 释放了过剩的产能,并无需支付升级费用。 + +IBM 的 Turek 解释了不同公司在评估其需求时所经历的计算过程。对于拥有 30 名员工的生物科学初创公司来说,“你需要计算,但你真的不可能让 15% 的员工专门负责计算。这就像你可能也会说你不希望有专职的法律代表,所以你也会把它作为一项服务来做。”不过,对于一家较大的公司而言,最终归结为权衡 HPC 服务的运营费用与购买内部超级计算机或 HPC 集群的费用。 + +到目前为止,这些都是你采用任何云服务时都会遇到的类似的争论。但是,可以 HPC 市场的某些特殊性将使得衡量运营支出(OPEX)与资本支出(CAPEX)时选择前者。超级计算机不是诸如存储或 x86 服务器之类的商用硬件;它们非常昂贵,技术进步很快会使其过时。正如麦考密克·史蒂文森公司的 Krawczyk 所说,“这就像买车:只要车一开走,它就会开始贬值。”对于许多公司,尤其是规模较大,灵活性较差的公司,购买超级计算机的过程可能会陷入无望的泥潭。IBM 的 Turek 说:“你会被规划问题、建筑问题、施工问题、培训问题所困扰,然后必须执行 RFP。你必须得到 CIO 的支持。你必须与内部客户合作以确保服务的连续性。这是一个非常、非常复杂的过程,并没有很多机构有非常出色的执行力。” + +一旦你选择走 HPC 服务的路线,你会发现你会得到你期望从云服务中得到的许多好处,特别是仅在业务需要时才需付费的能力,从而可以带来资源的高效利用。Gartner 高级总监兼分析师 Chirag Dekate 表示,当你对高性能计算有短期需求时,突发性负载是推动选择 HPC 服务的关键用例。 + +他说:“在制造业中,在产品设计阶段前后,HPC 活动往往会达到很高的峰值。但是,一旦产品设计完成,在其余产品开发周期中,HPC 资源的利用率就会降低。” 相比之下,他说:“当你拥有大型的、长期运行的工作时,云计算的经济性才会逐渐减弱。” + +通过巧妙的系统设计,你可以将这些 HPC 服务突发活动与你自己的内部常规计算集成在一起。埃森哲Accenture实验室常务董事 Teresa Tung 举了一个例子:“通过 API 访问 HPC 可以与传统计算无缝融合。在模型构建阶段,传统的 AI 流水线可能会在高端超级计算机上进行训练,但是最终经过反复按预期运行的训练好的模型将部署在云端的其他服务上,甚至部署在边缘设备上。” + +### 它并不适合所有的应用场景 + +HPC 服务适合批处理和松耦合的场景。这与一个常见的 HPC 缺点有关:数据传输问题。高性能计算本身通常涉及庞大的数据集,而将所有这些信息通过互联网发送到云服务提供商并不容易。IBM 的 Turek 说:“我们与生物技术行业的客户交流,他们每月仅在数据费用上就花费 1000 万美元。” + +而钱并不是唯一的潜在问题。构建一个利用数据的工作流程,可能会对你的工作流程提出挑战,让你绕过数据传输所需的漫长时间。hhpberlin 的 Kilian 说:“当我们拥有自己的 HPC 集群时,当然可以随时访问已经产生的仿真结果,从而进行交互式的临时评估。我们目前正努力达到在仿真的任意时刻都可以更高效地、交互地访问和评估云端生成的数据,而无需下载大量的模拟数据。” + +Mike Krawczyk 提到了另一个绊脚石:合规性问题。国防承包商使用的任何服务都需要遵从《国际武器交易条例》(ITAR),麦考密克·史蒂文森公司之所以选择 Rescale,部分原因是因为这是他们发现的唯一符合的供应商。如今,尽管有更多的公司使用云服务,但任何希望使用云服务的公司都应该意识到使用其他人的基础设施时所涉及的法律和数据保护问题,而且许多 HPC 场景的敏感性使得 HPC 即服务的这个问题更加突出。 + +此外,HPC 服务所需的 IT 治理超出了目前的监管范围。例如,你需要跟踪你的软件许可证是否允许云使用­ —— 尤其是专门为本地 HPC 群集上运行而编写的软件包。通常,你需要跟踪 HPC 服务的使用方式,它可能是一个诱人的资源,尤其是当你从员工习惯的内部系统过渡到有可用的空闲的 HPC 能力时。例如,Avanade 全球平台高级主管兼 Azure 平台服务全球负责人 Ron Gilpin 建议,将你使用的处理核心的数量回拨给那些对时间不敏感的任务。他说:“如果一项工作只需要用一小时来完成而不需要在十分钟内就完成,那么它可以使用 165 个处理器而不是 1,000 个,从而节省了数千美元。” + +### 对 HPC 技能的要求很高 + +一直以来,采用 HPC 的最大障碍之一就是其所需的独特的内部技能,而 HPC 服务并不能神奇使这种障碍消失。Gartner 的 Dekate 表示:“许多 CIO 将许多工作负载迁移到了云上,他们看到了成本的节约、敏捷性和效率的提升,因此相信在 HPC 生态中也可以达成类似的效果。一个普遍的误解是,他们可以通过彻底地免去系统管理员,并聘用能解决其 HPC 工作负载的新的云专家,从而以某种方式优化人力成本。”对于 HPC 即服务来说更是如此。 + +“但是 HPC 并不是一个主流的企业环境。” 他说。“你正在处理通过高带宽、低延迟的网络互联的高端计算节点,以及相当复杂的应用和中间件技术栈。许多情况下,甚至连文件系统层也是 HPC 环境所独有的。没有对应的技能可能会破坏稳定性。” + +但是超级计算技能的供给却在减少,Dekate 将其称为劳动力“老龄化”,这是因为这一代开发人员将目光投向了新兴的初创公司,而不是学术界或使用 HPC 的更老套的公司。因此,HPC 服务供应商正在尽其所能地弥补差距。IBM 的 Turek 表示,许多 HPC 老手将总是想运行他们自己精心调整过的代码,并需要专门的调试器和其他工具来帮助他们在云端实现这一目标。但是,即使是 HPC 新手也可以调用供应商构建的代码库,以利用超级计算的并行处理能力。第三方软件提供商出售的交钥匙软件包可以减少 HPC 的许多复杂性。 + +埃森哲的 Tung 表示,该行业需要进一步加大投入才能真正繁荣。她说:“HPCaaS 已经创建了具有重大影响力的新功能,但还需要做的是使它易于被数据科学家、企业架构师或软件开发人员使用。这包括易用的 API、文档和示例代码。它包括解答问题的用户支持。仅仅提供 API 是不够的,API 需要适合特定的用途。对于数据科学家而言,这可能是以 Python 形式提供,并容易更换她已经在使用的框架。价值来自于使这些用户能够通过新的效率和性能最终使他们的工作得到改善,只要他们能够访问新的功能就可以了。” 如果供应商能够做到这一点,那么 HPC 服务才能真正将超级计算带给大众。 + + +-------------------------------------------------------------------------------- + +via: https://www.networkworld.com/article/3534725/the-ins-and-outs-of-high-performance-computing-as-a-service.html + +作者:[Josh Fruhlinger][a] +选题:[lujun9972][b] +译者:[messon007](https://github.com/messon007) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://www.networkworld.com/author/Josh-Fruhlinger/ +[b]: https://github.com/lujun9972 +[1]: https://www.networkworld.com/article/3236875/embargo-10-of-the-worlds-fastest-supercomputers.html +[2]: https://www.networkworld.com/blog/itaas-and-the-corporate-storage-technology/?utm_source=IDG&utm_medium=promotions&utm_campaign=HPE22140&utm_content=sidebar (ITAAS and Corporate Storage Strategy) +[3]: https://www.facebook.com/NetworkWorld/ +[4]: https://www.linkedin.com/company/network-world diff --git a/published/202005/20200404 Best Raspberry Pi Operating Systems for Various Purposes.md b/published/202005/20200404 Best Raspberry Pi Operating Systems for Various Purposes.md new file mode 100644 index 0000000000..25ebd65fcd --- /dev/null +++ b/published/202005/20200404 Best Raspberry Pi Operating Systems for Various Purposes.md @@ -0,0 +1,353 @@ +[#]: collector: (lujun9972) +[#]: translator: (lxbwolf) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12219-1.html) +[#]: subject: (Best Raspberry Pi Operating Systems for Various Purposes) +[#]: via: (https://itsfoss.com/raspberry-pi-os/) +[#]: author: (Ankush Das https://itsfoss.com/author/ankush/) + +用于各种用途的最佳树莓派操作系统 +====== + +![](https://img.linux.net.cn/data/attachment/album/202005/15/105040b17d6v7gdmj63k3k.jpg) + +[树莓派][1] 是一款不可缺少的单板电脑,在很多工作中都能派上用场。不相信?只要[看看这个树莓派项目列表][2],就能了解这个小小的设备能做什么。 + +考虑到树莓派用途这么多,为它选择一个合适的操作系统就极其重要。当然,你可以用 Linux 做很多事,但专门为特定目的配置的操作系统可以为你节省大量的时间和精力。 + +因此,本文中我要介绍一些专门为树莓派量身定制的流行且实用的操作系统。 + +### 由于有树莓派镜像工具,安装任何操作系统到树莓派上都很容易 + +[在 SD 卡上安装树莓派操作系统][3]比以前容易得多。你只需下载[树莓派镜像][4]就可以快速地安装任何树莓派操作系统。请看下面的官方视频,你就知道有多简单。 + +- [HOW TO INSTALL RASPBIAN OS to your Raspberry Pi with ease - Raspberry Pi Imager](https://youtu.be/J024soVgEeM) + +你也可以使用 [NOOBS][5](新开箱即用软件New Out Of the Box Software)在树莓派上轻松安装各种的操作系统。你还可以从他们的 [NOOBS 官方下载页面][5]提到的支持的零售商列表中获得预装 SD 卡。 + +欢迎在他们的[官方文档][6]中了解更多关于安装操作系统的信息。 + +- [下载树莓派操作系统][4] + +现在你知道了怎么安装它(以及从哪儿获取),让我来重点介绍几个有用的树莓派操作系统,希望对你有所帮助。 + +### 适用于树莓派的各种操作系统 + +请注意,我花了一些精力筛选出了那些被积极维护的树莓派操作系统项目。如果某个项目在不久的将来会停止维护,请在评论区告诉我,我会更新本文。 + +另一件事是,我关注到现在最新的版本是树莓派 4,但是下面的列表不应被认为是树莓派 4 的操作系统列表,这些系统应该也能用于树莓派 3、3B+ 和其他变种,但是请参照项目的官方网站了解详细信息。 + +**注意:** 排名不分先后。 + +#### 1、Raspbian OS:官方的树莓派操作系统 + +![][7] + +Raspbian OS 是官方支持的树莓派板卡操作系统。它集成了很多工具,用于教育、编程以及其他广泛的用途。具体来说,它包含了 Python、Scratch、Sonic Pi、Java 和其他一些重要的包。 + +最初,Raspbian OS 是基于 Debian 的,并预装了大量有用的包。因此,当你安装 Raspbian OS 后,你可能就不需要特意安装基本工具了 — 你会发现大部分工具已经提前安装好了。 + +Raspbian OS 是被积极地维护着的,它也是最流行的树莓派操作系统之一。你可以使用 [NOOBS][5] 或参照[官方文档][6]来安装它。 + +- [Raspbian OS][8] + +#### 2、Ubuntu MATE:适合通用计算需求 + +![][9] + +尽管 Raspbian 是官方支持的操作系统,但它的特点不是最新、最大的软件包。因此,如果你想更快的更新,想用最新的包,你可以试试 Ubuntu MATE 的树莓派版本。 + +Ubuntu MATE 的树莓派定制版是值得安装的非常不错的轻量级发行版。它还被广泛用于 [NVIDIA 的 Jetson Nano][10]。换言之,你可以在树莓派的很多场景下使用它。 + +为了更好地帮助你,我们还有一份详细的教程:[怎样在树莓派上安装 Ubuntu MATE][11]。 + +- [Ubuntu MATE for Raspberry Pi][12] + +#### 3、Ubuntu Server:把树莓派作为一台 Linux 服务器来使用 + +![][13] + +如果你计划把你的树莓派当作项目的某个服务器来使用,那么安装 Ubuntu Server 会是一个不错的选择。 + +Ubuntu Server 有 32 位和 64 位的镜像。你可以根据你的板卡类型(是否支持 64 位)来选择对应的操作系统。 + +然而,值得注意的一点是 Ubuntu Server 不是为桌面用户定制的。因此,你需要留意 Ubuntu Server 默认不会安装图形用户界面。 + +- [Ubuntu Server][14] + +#### 4、LibreELEC:适合做媒体服务器 + +![][15] + +我们已经有一个 [Linux 下可用的媒体服务器软件][16],LibreELEC 在列表中。 + +它是一个很棒的轻量级操作系统,让你可以在树莓派上安装 [KODI][17]。你可以尝试使用树莓派镜像工具来安装它。 + +你可以很容易地找到他们的[官方下载页面][18],并找到适合你板卡的安装镜像。 + +- [LibreELEC][19] + +#### 5、OSMC:适合做媒体服务器 + +![][20] + +OSMC 是另一个 Linux 下[流行的媒体服务器软件][16]。如果要把树莓派板作为媒体中心设备,那么 OSMC 是你可以向他人推荐的操作系统之一。 + +类似 LibreELEC,OSMC 也运行 KODI,可以帮助你管理你的媒体文件和欣赏你已有的素材。 + +OSMC 没有正式提及对树莓派 4 的支持。因此,如果你的树莓派是树莓派 3 或更早的版本,那么应该没有问题。 + +- [OSMC][21] + +#### 6、RISC OS:最初的 ARM 操作系统 + +![][22] + +RISC OS 最初是为 ARM 设备打造的,至今已有近 30 年左右的历史。 + +如果你想了解,我们也有篇详细介绍 [RISC OS][23] 的文章。简而言之,RISC OS 也是为诸如树莓派的现代基于 ARM 的单板计算机定制的。它的用户界面很简单,更专注于性能。 + +同样的,这并不是为树莓派 4 量身定做的。因此,如果你的树莓派是 3 或更早的版本,你可以试一下。 + +- [RISC OS][24] + +#### 7、Mozilla WebThings Gateway:适合 IoT 项目 + +![][25] + +作为 Mozilla 的 [IoT 设备的开源实现][26]的一部分,WebThings Gateway 让你可以监控和控制所有连接的 IoT 设备。 + +你可以参考[官方文档][27]来检查所需的环境,遵照指导把安装到树莓派上。它确实是适合 IoT 应用的最有用的树莓派操作系统之一。 + +- [WebThings Gateway][28] + +#### 8、Ubuntu Core:适合 IoT 项目 + +Ubuntu Core 是又一个树莓派操作系统,适用于潜在的 [IoT][29] 应用,或者只是测试一下 Snap。 + +Ubuntu Core 是专门为 IoT 设备或者具体来说是树莓派定制的。我不会刻意宣传它 —— 但是 Ubuntu Core 是一款适合树莓派板卡的安全操作系统。你可以自己尝试一下! + +- [Ubuntu Core][30] + +#### 9、DietPi:轻量级树莓派操作系统 + +![][31] + +DietPi 是一款轻量级的 [Debian][32] 操作系统,它还宣称比 “Raspbian Lite” 操作系统更轻量。 + +虽然它被视作一款轻量级的树莓派操作系统,但它提供了很多功能,可以在多个使用场景中派上用场。从简单的软件安装包到备份解决方案,还有很多功能值得探索。 + +如果你想安装一个低内存占用而性能相对更好的操作系统,你可以尝试一下 DietPi。 + +- [DietPi][33] + +#### 10、Lakka Linux:打造复古的游戏主机 + +![][34] + +想让你的树莓派变成一个复古的游戏主机? + +Lakka Linux 发行版本最初是建立在 RetroArch 模拟器上的。因此,你可以立刻在树莓派上获得所有的复古游戏。 + +如果你想了解,我们也有一篇介绍 [Lakka Linux][35] 的文章。或者直接上手吧! + +- [Lakka][36] + +#### 11、RetroPie:适合复古游戏 + +![][37] + +RetroPie 是另一款可以让树莓派变成复古游戏主机的树莓派操作系统。它提供了几个配置工具,让你可以自定义主题,或者调整模拟器即可拥有最好的复古游戏。 + +值得注意的是它不包含任何有版权的游戏。你可以试一下,看看它是怎么工作的! + +- [RetroPie][38] + +#### 12、Kali Linux:适合低成本渗透 + +![][39] + +想要在你的树莓派上尝试和学习一些道德黑客技巧吗?[Kali Linux][64] 会是最佳选择。是的,Kali Linux 通常在最新的树莓派一发布就会支持它。 + +Kali Linux 不仅适合树莓派,它也支持很多其他设备。尝试一下,玩得愉快! + +- [Kali Linux][40] + +#### 13、OpenMediaVault:适合网络附加存储(NAS) + +![][41] + +如果你想在极简的硬件上搭建 [NAS][42] 解决方案,树莓派可以帮助你。 + +OpenMediaVault 最初是基于 Debian Linux 的,提供了大量功能,如基于 Web 的管理能力、插件支持,等等。它支持大多数树莓派型号,因此你可以尝试下载并安装它! + +- [OpenMediaVault][43] + +#### 14、ROKOS:适合加密挖矿 + +![][44] + +如果你对加密货币和比特币很感兴趣,那么 ROKOS 会吸引你。 + +ROKOS 是基于 Debian 的操作系统,基本上可以让你把你的树莓派变成一个节点,同时预装了相应的驱动程序和软件包。当然,在安装之前你需要了解它是怎么工作的。因此,如果你对此不太了解,我建议你先调研下。 + +- [ROKOS][45] + +#### 15、Alpine Linux:专注于安全的轻量级 Linux + +当今年代,很多用户都在寻找专注于安全和[隐私的发行版本][46]。如果你也是其中一员,你可以试试在树莓派上安装 Alpine Linux。 + +如果你是个树莓派新手,它可能不像你想象的那样对用户友好(或者说对初学者来说容易上手)。但是,如果你想尝试一些不一样的东西,那么你可以试试 Alpine Linux 这个专注于安全的 Linux 发行版本。 + +- [Alpine Linux][47] + +#### 16、Kano OS:适合儿童教育的操作系统 + +![][48] + +如果你在寻找一款能让学习变得有趣还能教育儿童的树莓派操作系统,那么 Kano OS 是个不错的选择。 + +它正在积极维护中,而且 Kano OS 上的桌面集成的用户体验相当简单,玩起来也很有趣,可以让孩子们从中学习。 + +- [Kano OS][49] + +#### 17、KDE Plasma Bigscreen:把普通电视转换为智能电视 + +![][50] + +这是 KDE 一个正在开发中的项目。在树莓派上安装 [KDE “等离子大屏”][51] 后,你可以把普通电视变成智能电视。 + +你不需要特殊的遥控器来控制电视,你可以使用普通的遥控器。 + +“等离子大屏”也集成了 [MyCroft 开源 AI][52] 作为声控。 + +这个项目还在测试阶段,所以如果你想尝试,可能会有一些错误和问题。 + +- [Plasma Bigscreen][53] + +#### 18、Manjaro Linux:为你提供多功能的桌面体验 + +![][54] + +如果你想在树莓派上寻找一个基于 Arch 的 Linux 发行版,那么 Manjaro Linux 应该是一个很好的补充,它可以做很多事情,适合一般的计算任务。 + +Manjaro Linux ARM 版也支持最新的树莓派 4。它为你的树莓派或任何[树莓派替代品][55]提供了 XFCE 和 KDE Plasma 变体。 + +此外,它似乎还提供了树莓派设备上最快/最好的体验之一。如果你还没试过,那就试试吧! + +- [Manjaro ARM][56] + +#### 19、Volumio:作为一个开源音乐播放器使用 + +![][57] + +想做一个廉价的音乐发烧友系统?Volumio 应该可以帮到你。 + +它是一个自由而开源的操作系统([GitHub][58]),还支持集成多个设备的能力。你可以通过一个简单的 Web 控制界面,对所有连接的设备进行管理。除了免费版之外,它还提供了一个高级版,可以让你获得独家功能。 + +它也确实支持最新的树莓派 4。所以,如果你对调整已有的家庭立体声系统有一定的兴趣,想要获得最佳的音质,不妨试试这个。 + +- [Volumio][59] + +#### 20、FreeBSD + +不想使用 Linux 发行版?不用担心,你也可以用 FreeBSD 在树莓派上安装一个类 UNIX 操作系统。 + +如果你不知道的话,我们有一篇关于 [FreeBSD 项目][60]的详细文章。 + +一旦你按照他们的[官方说明][61]安装好之后,你可以利用它来进行任何 DIY 实验,或者只是把它作为一个轻量级的桌面系统来完成特定的任务。 + +- [FreeBSD][62] + +#### 21、NetBSD + +NetBSD 是另一个令人印象深刻的类 UNIX 操作系统,你可以在树莓派上安装。它的目标是成为一个跨多个系统的便携式操作系统。 + +如果你在其他系统中使用过它,你可能已经知道它的好处了。然而,它不仅仅是一个轻量级的便携式操作系统,它的特点是拥有一套有用的功能,可以完成各种任务。 + +- [NetBSD][63] + +### 结语 + +我相信还有很多为树莓派定制的操作系统 — 但是我尽力列出了被积极维护的最流行的或最有用的操作系统。 + +如果你觉得我遗漏了最合适树莓派的操作系统,尽情在下面的评论去告诉我吧! + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/raspberry-pi-os/ + +作者:[Ankush Das][a] +选题:[lujun9972][b] +译者:[lxbwolf](https://github.com/lxbwolf) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://itsfoss.com/author/ankush/ +[b]: https://github.com/lujun9972 +[1]: https://www.raspberrypi.org/ +[2]: https://itsfoss.com/raspberry-pi-projects/ +[3]: https://linux.cn/article-12136-1.html +[4]: https://www.raspberrypi.org/downloads/ +[5]: https://www.raspberrypi.org/downloads/noobs/ +[6]: https://www.raspberrypi.org/documentation/installation/installing-images/README.md +[7]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2019/06/raspbian_home_screen.jpg?resize=800%2C492&ssl=1 +[8]: https://www.raspbian.org/ +[9]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2019/04/Desktop-ubuntu.jpg?resize=800%2C600&ssl=1 +[10]: https://www.nvidia.com/en-us/autonomous-machines/embedded-systems/jetson-nano/ +[11]: https://linux.cn/article-10817-1.html +[12]: https://ubuntu-mate.org/raspberry-pi/ +[13]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/03/ubunt-server.png?ssl=1 +[14]: https://ubuntu.com/download/raspberry-pi +[15]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2019/02/libreelec.jpg?resize=800%2C600&ssl=1 +[16]: https://itsfoss.com/best-linux-media-server/ +[17]: https://kodi.tv/ +[18]: https://libreelec.tv/downloads_new/ +[19]: https://libreelec.tv/ +[20]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/02/osmc-server.jpg?resize=800%2C450&ssl=1 +[21]: https://osmc.tv/ +[22]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2018/10/riscos5.1.jpg?resize=800%2C600&ssl=1 +[23]: https://itsfoss.com/risc-os-is-now-open-source/ +[24]: https://www.riscosopen.org/content/ +[25]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/03/web-things-gateway.png?ssl=1 +[26]: https://iot.mozilla.org/about/ +[27]: https://iot.mozilla.org/docs/gateway-getting-started-guide.html +[28]: https://iot.mozilla.org/gateway/ +[29]: https://en.wikipedia.org/wiki/Internet_of_things +[30]: https://ubuntu.com/download/raspberry-pi-core +[31]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/03/diet-pi.jpg?ssl=1 +[32]: https://www.debian.org/ +[33]: https://dietpi.com/ +[34]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2016/08/lakkaos.jpg?resize=1024%2C640&ssl=1 +[35]: https://linux.cn/article-10158-1.html +[36]: http://www.lakka.tv/ +[37]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/03/retro-pie.png?ssl=1 +[38]: https://retropie.org.uk/ +[39]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/03/kali-linux-pi.png?ssl=1 +[40]: https://www.offensive-security.com/kali-linux-arm-images/ +[41]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/03/openmediavault.jpg?ssl=1 +[42]: https://en.wikipedia.org/wiki/Network-attached_storage +[43]: https://www.openmediavault.org/ +[44]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/03/rocos-bitcoin-pi.jpg?ssl=1 +[45]: https://rokos.space/ +[46]: https://itsfoss.com/privacy-focused-linux-distributions/ +[47]: https://alpinelinux.org/ +[48]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/03/kano-os-pi.jpeg?ssl=1 +[49]: https://kano.me/row/downloadable +[50]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/03/plasma-bigscreen-menu.jpg?ssl=1 +[51]: https://itsfoss.com/kde-plasma-bigscreen/ +[52]: https://itsfoss.com/mycroft-mark-2/ +[53]: https://plasma-bigscreen.org/#download-jumpto +[54]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/04/manjaro-arm.jpg?w=800&ssl=1 +[55]: https://linux.cn/article-10823-1.html +[56]: https://manjaro.org/download/#raspberry-pi-4 +[57]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/04/volumio.jpg?w=800&ssl=1 +[58]: https://github.com/volumio +[59]: https://volumio.org/ +[60]: https://itsfoss.com/freebsd-interview-deb-goodkin/ +[61]: https://www.freebsdfoundation.org/freebsd/how-to-guides/installing-freebsd-for-raspberry-pi/ +[62]: https://www.freebsd.org/ +[63]: https://www.netbsd.org/ +[64]: https://linux.cn/article-10690-1.html diff --git a/published/202005/20200407 How to avoid man-in-the-middle cyber attacks.md b/published/202005/20200407 How to avoid man-in-the-middle cyber attacks.md new file mode 100644 index 0000000000..8ae4bb8a6d --- /dev/null +++ b/published/202005/20200407 How to avoid man-in-the-middle cyber attacks.md @@ -0,0 +1,80 @@ +[#]: collector: "lujun9972" +[#]: translator: "tinyeyeser" +[#]: reviewer: "wxy" +[#]: publisher: "wxy" +[#]: url: "https://linux.cn/article-12191-1.html" +[#]: subject: "How to avoid man-in-the-middle cyber attacks" +[#]: via: "https://opensource.com/article/20/4/mitm-attacks" +[#]: author: "Jackie Lam https://opensource.com/users/beenverified" + +如何避免中间人攻击(MITM) +====== + +> 首先搞明白到底什么是中间人攻击(MITM),才能避免成为此类高科技窃听的受害者。 + +![](https://img.linux.net.cn/data/attachment/album/202005/07/100655i7og1eqsw6o3ww81.jpg) + +当你使用电脑发送数据或与某人在线通话的时候,你一定采取了某种程度的安全隐私手段。 + +但如果有第三方在你不知情的情况下窃听,甚至冒充某个你信任的商业伙伴窃取破坏性的信息呢?你的私人数据就这样被放在了危险分子的手中。 + +这就是臭名昭著的中间人攻击man-in-the-middle(MITM)。 + +### 到底什么是中间人攻击? + +黑客潜入到你与受害者或是某个设备间的通信过程中,窃取敏感信息(多数是身份信息)进而从事各种违法行为的过程,就是一次中间人攻击。Scamicide 公司创始人 Steve J. J. Weisman 介绍说: + +> “中间人攻击也可以发生在受害者与某个合法 app 或网页中间。当受害者以为自己面对的是正常 app 或网页时,其实 Ta 正在与一个仿冒的 app 或网页互动,将自己的敏感信息透露给了不法分子。” + +中间人攻击诞生于 1980 年代,是最古老的网络攻击形式之一。但它却更为常见。Weisman 解释道,发生中间人攻击的场景有很多种: + + * **攻陷一个未有效加密的 WiFi 路由器**:该场景多见于人们使用公共 WiFi 的时候。“虽然家用路由器也很脆弱,但黑客攻击公共 WiFi 网络的情况更为常见。”Weisman 说,“黑客的目标就是从毫无戒心的人们那里窃取在线银行账户这样的敏感信息。” + * **攻陷银行、金融顾问等机构的电子邮件账户**:“一旦黑客攻陷了这些电子邮件系统,他们就会冒充银行或此类公司给受害者发邮件”,Weisman 说,”他们以紧急情况的名义索要个人信息,诸如用户名和密码。受害者很容易被诱骗交出这些信息。” + * **发送钓鱼邮件**:窃贼们还可能冒充成与受害者有合作关系的公司,向其索要个人信息。“在多个案例中,钓鱼邮件会引导受害者访问一个伪造的网页,这个伪造的网页看起来就和受害者常常访问的合法公司网页一模一样。”Weisman 说道。 + * **在合法网页中嵌入恶意代码**:攻击者还会把恶意代码(通常是 JavaScript)嵌入到一个合法的网页中。“当受害者加载这个合法网页时,恶意代码首先按兵不动,直到用户输入账户登录或是信用卡信息时,恶意代码就会复制这些信息并将其发送至攻击者的服务器。”网络安全专家 Nicholas McBride 介绍说。 + +### 有哪些中间人攻击的著名案例? + +联想作为主流的计算机制造厂商,在 2014 到 2015 年售卖的消费级笔记本电脑中预装了一款叫做 VisualDiscovery 的软件,拦截用户的网页浏览行为。当用户的鼠标在某个产品页面经过时,这款软件就会弹出一个来自合作伙伴的类似产品的广告。 + +这起中间人攻击事件的关键在于:VisualDiscovery 拥有访问用户所有私人数据的权限,包括身份证号、金融交易信息、医疗信息、登录名和密码等等。所有这些访问行为都是在用户不知情和未获得授权的情况下进行的。联邦交易委员会(FTC)认定此次事件为欺诈与不公平竞争。2019 年,联想同意为此支付 8300 万美元的集体诉讼罚款。 + +### 我如何才能避免遭受中间人攻击? + + * **避免使用公共 WiFi**:Weisman 建议,从来都不要使用公开的 WiFi 进行金融交易,除非你安装了可靠的 VPN 客户端并连接至可信任的 VPN 服务器。通过 VPN 连接,你的通信是加密的,信息也就不会失窃。 + * **时刻注意:**对要求你更新密码或是提供用户名等私人信息的邮件或文本消息要时刻保持警惕。这些手段很可能被用来窃取你的身份信息。 + + 如果不确定收到的邮件来自于确切哪一方,你可以使用诸如电话反查或是邮件反查等工具。通过电话反查,你可以找出未知发件人的更多身份信息。通过邮件反查,你可以尝试确定谁给你发来了这条消息。 + + 通常来讲,如果发现某些方面确实有问题,你可以听从公司中某个你认识或是信任的人的意见。或者,你也可以去你的银行、学校或其他某个组织,当面寻求他们的帮助。总之,重要的账户信息绝对不要透露给不认识的“技术人员”。 + + * **不要点击邮件中的链接**:如果有人给你发了一封邮件,说你需要登录某个账户,不要点击邮件中的链接。相反,要通过平常习惯的方式自行去访问,并留意是否有告警信息。如果在账户设置中没有看到告警信息,给客服打电话的时候也*不要*联系邮件中留的电话,而是联系站点页面中的联系人信息。 + * **安装可靠的安全软件**:如果你使用的是 Windows 操作系统,安装开源的杀毒软件,如 [ClamAV][2]。如果使用的是其他平台,要保持你的软件安装有最新的安全补丁。 + * **认真对待告警信息**:如果你正在访问的页面以 HTTPS 开头,浏览器可能会出现一则告警信息。例如,站点证书的域名与你尝试访问的站点域名不相匹配。千万不要忽视此类告警信息。听从告警建议,迅速关掉页面。确认域名没有输入错误的情况下,如果情况依旧,要立刻联系站点所有者。 + * **使用广告屏蔽软件**:弹窗广告(也叫广告软件攻击)可被用于窃取个人信息,因此你还可以使用广告屏蔽类软件。对个人用户来说,中间人攻击其实是很难防范的,因为它被设计出来的时候,就是为了让受害者始终蒙在鼓里,意识不到任何异常。有一款不错的开源广告屏蔽软件叫 [uBlock origin][4]。可以同时支持 Firefox 和 Chromium(以及所有基于 Chromium 的浏览器,例如 Chrome、Brave、Vivaldi、Edge 等),甚至还支持 Safari。 + +### 保持警惕 + +要时刻记住,你并不需要立刻就点击某些链接,你也并不需要听从某个陌生人的建议,无论这些信息看起来有多么紧急。互联网始终都在。你大可以先离开电脑,去证实一下这些人的真实身份,看看这些“无比紧急”的页面到底是真是假。 + +尽管任何人都可能遭遇中间人攻击,只要弄明白何为中间人攻击,理解中间人攻击如何发生,并采取有效的防范措施,就可以保护自己避免成为其受害者。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/4/mitm-attacks + +作者:[Jackie Lam][a] +选题:[lujun9972][b] +译者:[tinyeyeser](https://github.com/tinyeyeser) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/beenverified +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/security_password_chaos_engineer_monster.png?itok=J31aRccu "Security monster" +[2]: https://www.clamav.net +[3]: https://opensource.com/article/20/1/stop-typosquatting-attacks +[4]: https://github.com/gorhill/uBlock +[5]: https://www.beenverified.com/crime/what-is-a-man-in-the-middle-attack/ +[6]: https://creativecommons.org/licenses/by-sa/2.0/ diff --git a/published/202005/20200407 How to use pyenv to run multiple versions of Python on a Mac.md b/published/202005/20200407 How to use pyenv to run multiple versions of Python on a Mac.md new file mode 100644 index 0000000000..3bcf991e02 --- /dev/null +++ b/published/202005/20200407 How to use pyenv to run multiple versions of Python on a Mac.md @@ -0,0 +1,172 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12241-1.html) +[#]: subject: (How to use pyenv to run multiple versions of Python on a Mac) +[#]: via: (https://opensource.com/article/20/4/pyenv) +[#]: author: (Matthew Broberg https://opensource.com/users/mbbroberg) + +如何在 Mac 上使用 pyenv 运行多个版本的 Python +====== + +> 如果你在 macOS 上运行的项目需要没有安装的 Python 版本,请试试 pyenv。 + +![](https://img.linux.net.cn/data/attachment/album/202005/23/112041pawp65alw6tmea6l.jpg) + +即使对于有经验的开发人员,管理本地 Python 开发环境仍然是一个挑战。尽管有详细的[软件包管理策略][2],但仍需要采取另外的步骤来确保你在需要时运行所需的 Python 版本。 + +### 为什么 Python 版本重要? + +起初这是一个奇怪的概念,但是编程语言会像其他任何软件一样发生变化。它们有错误、修复和更新,就像你喜欢的 [API][3] 和任何其他软件一样。同样,不同的发行版由称为[语义化版本][4]的三位数标识。 + +> 😭😭😭 [pic.twitter.com/yt1Z2439W8][5] +> +> — Denny Perez (@dennyperez18) [May 28, 2019][6] + +多年来,Python 2 是该语言的常用主要版本。在 2020 年 1 月,Python 2 [到达最后寿命][7],此后,Python 的核心维护者将仅支持 Python 3。Python 3 稳步发展,并定期发布新更新。对我来说定期获取这些更新很重要。 + +最近,我试图在 macOS 上运行一个依赖于 Python 3.5.9 的项目,而我的系统上并没有安装这个版本。我认为 Python 包管理器 `pip` 可以安装它,但事实并非如此: + +``` +$ pip install python3.5.9 +Collecting python3.5.9 +  ERROR: Could not find a version that satisfies the requirement python3.5.9 (from versions: none) +ERROR: No matching distribution found for python3.5.9 +``` + +或者,我也可以从官方 Python 网站下载该版本,但我如何在我的 Mac 上与现有的 Python 版本一起运行?每次运行时指定 Python 解释器版本(例如 python3.7 或 python3.5)似乎很容易出错。一定会有更好的方法。 + +(说明:我知道这对经验丰富的 Python 开发人员没有意义,但对当时的我来说是有意义的。我很乐意谈一谈为什么我仍然认为它应该这样做。) + +### 安装和设置 pyenv + +值得庆幸的是,`pyenv` 可以绕开这一系列复杂的问题。首先,我需要安装 `pyenv`。我可以[从源码][8]克隆并编译它,但是我更喜欢通过 Homebrew 包管理器来管理软件包: + +``` +$ brew install pyenv +``` + +为了通过 `pyenv` 使用 Python 版本,必须了解 shell 的 `PATH` 变量。`PATH` 决定了 shell 通过命令的名称来搜索文件的位置。你必须确保 shell 程序能够找到通过 `pyenv` 运行的 Python 版本,而不是默认安装的版本(通常称为*系统版本*)。如果不更改路径,那么结果如下: + +``` +$ which python +/usr/bin/python +``` + +这是 Python 的系统版本。 + +要正确设置 `pyenv`,可以在 Bash 或 zsh 中运行以下命令: + +``` +$ PATH=$(pyenv root)/shims:$PATH +``` + +现在,如果你检查 Python 的版本,你会看到它是 `pyenv` 管理的版本: + +``` +$ which python +/Users/my_username/.pyenv/shims/python +``` + +该导出语句(`PATH=`)仅会对该 shell 实例进行更改,为了使更改永久生效,你需要将它添加到点文件当中。由于 zsh 是 macOS 的默认 shell,因此我将重点介绍它。将相同的语法添加到 `~/.zshrc` 文件中: + +``` +$ echo 'PATH=$(pyenv root)/shims:$PATH' >> ~/.zshrc +``` + +现在,每次我们在 zsh 中运行命令时,它将使用 `pyenv` 版本的 Python。请注意,我在 `echo` 中使用了单引号,因此它不会评估和扩展命令。 + +`.zshrc` 文件仅管理 zsh 实例,因此请确保检查你的 shell 程序并编辑关联的点文件。如果需要再次检查默认 shell 程序,可以运行 `echo $SHELL`。如果是 zsh,请使用上面的命令。如果你使用 Bash,请将 `~/.zshrc` 更改为 `~/.bashrc`。如果你想了解更多信息,可以在 `pyenv` 的 `README` 中深入研究[路径设置][9]。 + +### 使用 pyenv 管理 Python 版本 + +现在 `pyenv` 已经可用,我们可以看到它只有系统 Python 可用: + +``` +$ pyenv versions +system +``` + +如上所述,你绝对不想使用此版本([阅读更多有关信息][10])。现在 `pyenv` 已正确设置,我希望它能有我经常使用的几个不同版本的 Python。 + +有一种方法可以通过运行 `pyenv install --list` 来查看 pyenv 可以访问的所有仓库中的所有 Python 版本。这是一个很长的列表,将来回顾的时候可能会有所帮助。目前,我决定在 [Python 下载页面][11]找到的每个最新的“点版本”(3.5.x 或 3.6.x,其中 x 是最新的)。因此,我将安装 3.5.9 和 3.8.0: + +``` +$ pyenv install 3.5.9 +$ pyenv install 3.8.0 +``` + +这将需要一段时间,因此休息一会(或阅读上面的链接之一)。有趣的是,输出中显示了该版本的 Python 的下载和构建。例如,输出显示文件直接来自 [Python.org][12]。 + +安装完成后,你可以设置默认值。我喜欢最新的,因此将全局默认 Python 版本设置为最新版本: + +``` +$ pyenv global 3.8.0 +``` + +该版本立即在我的 shell 中设置完成。确认一下: + +``` +$ python -V +Python 3.8.0 +``` + +我要运行的项目仅适于 Python 3.5,因此我将在本地设置该版本并确认: + +``` +$ pyenv local 3.5.9 +$ python -V +Python 3.5.9 +``` + +因为我在 `pyenv` 中使用了 `local` 选项,所以它向当前目录添加了一个文件来跟踪该信息。 + +``` +$ cat .python-version +3.5.9 +``` + +现在,我终于可以为想要的项目设置虚拟环境,并确保运行正确版本的 Python。 + +``` +$ python -m venv venv +$ source ./venv/bin/activate +(venv) $ which python +/Users/mbbroberg/Develop/my_project/venv/bin/python +``` + +要了解更多信息,请查看有关[在 Mac 上管理虚拟环境][13]的教程。 + +### 总结 + +默认情况下,运行多个 Python 版本可能是一个挑战。我发现 `pyenv` 可以确保在我需要时可以有我需要的 Python 版本。 + +你还有其他初学者或中级 Python 问题吗? 请发表评论,我们将在以后的文章中考虑介绍它们。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/4/pyenv + +作者:[Matthew Broberg][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/mbbroberg +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/search_find_code_python_programming.png?itok=ynSL8XRV (Searching for code) +[2]: https://opensource.com/article/19/4/managing-python-packages +[3]: https://opensource.com/article/19/5/api-evolution-right-way +[4]: https://semver.org/ +[5]: https://t.co/yt1Z2439W8 +[6]: https://twitter.com/dennyperez18/status/1133505310516232203?ref_src=twsrc%5Etfw +[7]: https://opensource.com/article/19/11/end-of-life-python-2 +[8]: https://github.com/pyenv/pyenv +[9]: https://github.com/pyenv/pyenv#understanding-path +[10]: https://opensource.com/article/19/5/python-3-default-mac +[11]: https://www.python.org/downloads/ +[12]: http://python.org +[13]: https://linux.cn/article-11086-1.html diff --git a/published/202005/20200408 My Linux Story- From 8-bit enthusiast to Unix sysadmin.md b/published/202005/20200408 My Linux Story- From 8-bit enthusiast to Unix sysadmin.md new file mode 100644 index 0000000000..60ab428ad3 --- /dev/null +++ b/published/202005/20200408 My Linux Story- From 8-bit enthusiast to Unix sysadmin.md @@ -0,0 +1,78 @@ +[#]: collector: (lujun9972) +[#]: translator: (Acceleratorrrr) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12228-1.html) +[#]: subject: (My Linux Story: From 8-bit enthusiast to Unix sysadmin) +[#]: via: (https://opensource.com/article/20/4/linux-story) +[#]: author: (James Farrell https://opensource.com/users/jamesf) + +我的 Linux 故事:从 8 位发烧友到 Unix 系统管理员 +====== + +> 我是如何从一个电脑爱好者成为职业系统管理员和 Linux 粉丝的。 + +![](https://img.linux.net.cn/data/attachment/album/202005/18/132731pnnzy7t5tz7hvc6z.jpg) + +故事得从 1980 年中期我父母给家里购买[苹果 \]\[c][2] 开始。尽管很喜欢打游戏,但我还是很快被实用又好玩的 BASIC 编程迷住了。那个年代的人们还是把电脑当作小一点的打字机对待,所以拥有“高级电脑技能”的人可以轻松使用他们的魔法。 + +以用 BASIC 和点阵打印机自动生成惩罚作业来举个例子。被罚写两百遍道歉时,我问老师我可不可以用打字代替手写。经过同意后,我写了 5 行 BASIC 语句来自动生成作业。另外一个小技巧是用非可视化文本编辑器,比如用 AppleWorks 微调字体、行距和边距,把学期论文“拉长”到要求的篇幅。 + +对电脑的痴迷很快让我得到了带有内存驱动卡和 x86 协处理器的苹果 ][gs。那时候,调制解调器和 BBS 刚开始火起来,有了这样的双处理器系统后,我就可以安装各种琳琅满目的软件。但是由于调制解调器 2400bps 的速度限制,对我每天都要下载几 KB 的有趣东西形成了阻碍。我对苹果痴迷一段时间,不久之后就换了。 + +### 探索 Unix + +我的本科专业是计算机信息系统,研究生专业是计算机科学。本科教育主要使用个人电脑,很少涉及大型分时系统。研究生的时候才开始真正有意思起来,拨号进入带有互联网连接的 Unix 简直打开了新世界的大门。尽管我依然用着我的双处理器 ][gs 来使用调制解调器还有写写论文,不过 Unix 系统真正吸引了我的注意力,因为它可以访问通用的 Telnet 游戏、文件传输协议(FTP)、在线邮箱和进行 C 语言编程。当时 Gopher 非常受欢迎,特别是在我们这群终端用户当中。 + +被分到学院计算机部门是我研究生命运的转折点,这个部门主管学校的计算机服务。学生们可以使用 X Window 终端来登录基于 [Ultrix][3] 的系统。大部分都是灰度的黑白界面,彩色处理在当时非常占用 CPU,也很影响系统性能。也有一些彩色系统还不错,但是这些机器都很慢。 + +我很喜欢那个时候,我有系统管理员权限而且工作是维护系统和网络。我有一些很好的导师,他们对我选择从事系统管理员而不是程序员起了关键作用(尽管我至今仍然热爱编程)。 + +### 从 Unix 到 Linux + +稀缺是创造之母,当需要分享匮乏的学校电脑系统资源的时候,我们学生们变得富有创造力。需要用电脑的学生是 Ultrix 工作站承受量的三到五倍,所以寻找资源往往是个难题(特别是要交付项目的时候)。在不需要图形化显示的时候,我们有一个 56k 的点对点协议的调制解调器池可供远程系统访问接入。但是找到一个有空余资源的机器并共享系统进行源码编译通常会导致进度缓慢。和大部分人一样,我发现晚上工作通常会有所帮助,但我还需要其它一些东西让我的项目迭代快一点。 + +后来学校的一个系统管理员建议我去看一个免费提供的 Unix 系统。那就是 Linux,它被装在 3.5 英寸的软盘里。多亏我们学校超快的 T1 线路,我很容易就搜索到新闻组和其他资源来学习如何下载它。它全是基于 32 位的英特尔 PC 机的,而我并没有这一类的设备。 + +幸运的是,我在学校的工作让我有机会接触到堆积如山的废旧电脑,所以命运的齿轮又开始旋转起来。 + +我找到了足够多的废旧 PC 组装了一个可靠的 80386 PC,带有足够内存(我确定不到 1GB),它有一个能用的显卡、一个细缆(同轴)以太网卡和一个硬盘。我所用的镜像是 Linux 内核 0.98,我不记得它是不是正式发行版的一部分了(可能是 SLS)。我所记得的是,它有一系列的软盘镜像,第一张软盘启动内核和一个最小安装程序,然后格式化硬盘,接着要求插入每个后续的软盘来安装 GNU 核心实用程序。在核心实用程序装好并引导系统之后,你可以下载和安装其他的软件包镜像,比如编译器之类的。 + +这是我学术道路上巨大的福音。在没有运行 X Window 显示服务器的情况下,这台电脑性能比学校的 Ultrix 工作站强很多。学校允许我把这台机器连到校园网络,挂载学校的学生网络文件系统(NFS)共享,并且能直接访问互联网。因为我的研究生课程用 [GCC][5](还有 Perl 4)来完成大部分学生作业,所以我可以在本地进行开发工作。这使得我可以独享关键资源,从而使我能够更快速地迭代我的项目。 + +但是,这个方案不是完美的。硬件有时会有点不稳定(这可能就是它们被丢弃的原因),但我都能搞定。真正让我感受到的是 Linux 和 Ultrix 在操作系统和系统库层面的差异。我开始理解移植软件到其他操作系统的意义,我可以自由地在任何地方开发,但是我必须以 Ultrix 编译的二进制文件交付项目。在一个平台上完美运行的 C 语言代码可能在另一个平台出错。这非常令人沮丧,但是我可能本能的察觉到了早期 Linux 解引用空指针的方法。Linux 倾向于把它作为空操作处理,但是 Ultrix 会立即触发核心转储和段错误 [SIGSEGV][6]。这是我第一次程序移植时的重大发现,正好在要交作业的几天之前。这同时对我研究 C++ 造成了一些麻烦,因为我粗心地同时使用了 `malloc()`/`free()` 和自动[构造函数和析构函数][7]处理,让我的项目到处都是空指针炸弹。 + +研究生课程快结束的时候,我升级到了一台性能野兽工作站:一颗英特尔 486DX2 66MHz 芯片、一块 SCSI 硬盘、一块光驱和一个 1024x768 RGB 显示器,并且还用一个 16550 UART 串口卡完美地匹配了我的新 US Robotics V.Everything 牌调制解调器。它可以双启动 Windows 和 Linux 系统,但更重要的是显卡和 CPU 的速度让我的开发环境幸福感倍增。那台旧的 386 依然在学校服役,不过我我现在大部分繁重的功课和钻研都转移到了家里。 + +和 [Mike Harris][8] 关于 90 年代的 Linux 故事类似,我真的对当时流行的 CD 集合很着迷。我住的附近有家新开的 Micro Center 计算机商店,这个宝库充满了电脑配件、高级专业书籍和你能想到的各种 Linux(以及免费的 Unix)CD。我还记得 [Yggdrasil][9] 和 [Slackware][10] 是我最喜欢的发行版。真正让人难以置信的是 CD 存储空间的巨大容量 —— 650MB!使它成为获得软件的必不可少的载体。是的,你可以用 56k 的速度下载,但是真的很慢。更别提大部分人负担不起存档这么多供以后使用的闲置数据。 + +### 而到了今天 + +就是这些开启了我长达 25 年的系统管理员的职业生涯和开源软件的乐趣。Linux 一直是我事业和个人开发中的重要组成部分。最近我依旧醉心于 Linux(主要是 CentOS、RedHat 和 Ubuntu),但也经常从 [FreeBSD][11] 和其他炫酷开源软件中得到乐趣。 + +Linux 让我来到了 Opensource.com,我希望在这里能回馈社区,为新一代电脑爱好者出一份力。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/4/linux-story + +作者:[James Farrell][a] +选题:[lujun9972][b] +译者:[Accelerator](https://github.com/Acceleratorrrr) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/jamesf +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/1980s-computer-yearbook.png?itok=eGOYEKK- (Person typing on a 1980's computer) +[2]: https://en.wikipedia.org/wiki/Apple_IIc +[3]: https://en.wikipedia.org/wiki/Ultrix +[4]: https://en.wikipedia.org/wiki/Point-to-Point_Protocol +[5]: https://en.wikipedia.org/wiki/GNU_Compiler_Collection +[6]: https://en.wikipedia.org/wiki/Segmentation_fault +[7]: https://www.tutorialspoint.com/cplusplus/cpp_constructor_destructor.htm +[8]: https://linux.cn/article-11831-1.html +[9]: https://en.wikipedia.org/wiki/Yggdrasil_Linux/GNU/X +[10]: http://slackware.com +[11]: https://www.freebsd.org/ diff --git a/published/202005/20200413 9 open source CSS frameworks for frontend web development.md b/published/202005/20200413 9 open source CSS frameworks for frontend web development.md new file mode 100644 index 0000000000..00ab65d520 --- /dev/null +++ b/published/202005/20200413 9 open source CSS frameworks for frontend web development.md @@ -0,0 +1,249 @@ +[#]: collector: (lujun9972) +[#]: translator: (wxy) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12227-1.html) +[#]: subject: (9 open source CSS frameworks for frontend web development) +[#]: via: (https://opensource.com/article/20/4/open-source-css-frameworks) +[#]: author: (Bryant Son https://opensource.com/users/brson) + +9 个用于前端 Web 开发的开源 CSS 框架 +====== + +> 探索开源 CSS 框架,找到适合你的项目的框架。 + +![](https://img.linux.net.cn/data/attachment/album/202005/18/094922of81rqfiei8x78xi.jpg) + +当大多数人想到 Web 开发时,通常会想到 HTML 或 JavaScript。他们通常会忘记对网站的欣赏能力有更大影响的技术:[级联样式表][2]cascading style sheets(简称 CSS)。据维基百科的说法,CSS 既是网页中最重要的部分,也是最常被遗忘的部分,尽管它是万维网的三大基石技术之一。 + +本文将探讨九种流行的、强大的、开源的框架,是这些框架让构建漂亮的网站前端的 CSS 开发变得简单明了。 + +名称 | 介绍| 许可证 +---|---|--- +[Bootstrap][3] | 最流行的 CSS 框架,来自 Twitter | MIT +[PatternFly][4] | 开源框架,来自 Red Hat | MIT +[MDC Web][5] | Material Design 组件开源框架,来自 Google | MIT +[Pure][6] | 开源框架,来自 Yahoo | BSD +[Foundation][7] | 前端框架,来自 Zurb 基金会 | MIT +[Bulma][8] | 现代 CSS 框架,基于 Flexbox | MIT +[Skeleton][9] | 轻量级 CSS 框架 | MIT +[Materialize][10] | 基于 Material Design 的 CSS 框架 | MIT +[Bootflat][11] | 开源 Flat UI 工具,基于 Bootstrap 3.3.0 | MIT + +### Bootstrap + +[Bootstrap][2] 无疑是最流行的 CSS 框架,它是所有前端 Web 设计的开端。Bootstrap 由 Twitter 开发,提供了可用性、功能性和可扩展性。 + +![Bootstrap homepage][13] + +Bootstrap 还提供了大量的[例子][14]来帮助你入门。 + +![Bootstrap examples][15] + +使用 Bootstrap,你可以将不同的组件和布局拼接在一起,创造出有趣的页面设计。它还提供了大量详细的文档。 + +![Bootstrap documentation][16] + +Bootstrap 的 [GitHub][3] 仓库有超过 19000 个提交和 1100 个贡献者。它基于 MIT 许可证,所以(和这个列表中的所有框架一样)你也可以加入并贡献。 + +![Bootstrap GitHub][17] + +### PatternFly + +[PatternFly][18] 是由 Red Hat 开发的一个开源的(MIT 许可证)CSS 框架。PatternFly 采取了与 Bootstrap 不同的方法:Bootstrap 是为任何对创建一个漂亮网站感兴趣的人而设计的,而 PatternFly 主要针对企业级应用开发者,它提供的组件,如条形图、图表和导航,对于创建强大的、指标驱动的仪表盘非常有吸引力。事实上,Red Hat 在其产品(如 OpenShift)的设计中也使用了这个 CSS 框架。 + +![PatternFly homepage][19] + +除了静态 HTML 之外,PatternFly 还支持 ReactJS 框架,ReactJS 是 Facebook 开发的一个流行的 JavaScript 框架。 + +![PatternFly ReactJS support][20] + +PatternFly 有许多高级组件,如条形图、图表、[模态窗口][21]和布局等,适用于企业级应用。 + +![PatternFly chart component][22] + +PatternFly 的 [GitHub][4] 页面列出了超过 1050 个提交和 44 个贡献者。PatternFly 得到了很多人的关注,欢迎大家踊跃贡献。 + +![PatternFly GitHub][23] + +### MDC Web + +凭借其大获成功的安卓平台,谷歌以一个名为 [Material Design][24] 的概念制定了自己的标准设计准则。Material Design 标准旨在体现在所有谷歌的产品中,这些标准也可以面向大众,并且在 MIT 许可证下开源。 + +![Material Design homepage][25] + +Material Design 有许多“用于创建用户界面的交互式构建块”的[组件][26]。这些按钮、卡片、背景等可用于创建网站或移动应用程序的任何类型的用户界面。 + +![Material Components webpage][27] + +维护人员为不同的平台提供了详尽的文档。 + +![Material Design documentation][28] + +还有分步教程,其中包含用于实现不同目标的练习。 + +![Material Design tutorial][29] + +Material 组件的 GitHub 页面承载了面向不同平台的存储库,包括用于网站开发的 [Material Web 组件(MDC Web)][5]。MDC Web 有超过 5700 个提交和 349 个贡献者。 + +![MDC Web GitHub][30] + +### Pure + +Bootstrap、Patternfly 和 MDC Web 都是非常强大的 CSS 框架,但是它们可能相当的笨重和复杂。如果你想要一个轻量级的 CSS 框架,它更接近于自己编写 CSS,但又能帮助你建立一个漂亮的网页,可以试试 [Pure.css][31]。Pure 是一个轻量级的 CSS 框架,它的体积很小。它是由 Yahoo 开发的,在 BSD 许可证下开源。 + +![Pure.css homepage][32] + +尽管体积小,但 Pure 提供了建立一个漂亮网页的很多必要的组件。 + +![Pure.css components][33] + +Pure 的 [GitHub][6] 页面显示它有超过 565 个提交和 59 个贡献者。 + +![Pure.css GitHub][34] + +### Foundation + +[Foundation][35] 号称是世界上最先进的响应式前端框架。它提供了先进的功能和教程,用于构建专业网站。 + +![Foundation homepage][36] + +该框架被许多公司、组织甚至政客[使用][37],并且有大量的文档可用。 + +![Foundation documentation][38] + +Foundation 的 [GitHub][7] 页面显示有近 17000 个提交和 1000 个贡献者。和这个列表中的大多数其他框架一样,它也是在 MIT 许可证下提供的。 + +![Foundation GitHub][39] + +### Bulma + +[Bulma][40] 是一个基于 Flexbox 的开源框架,在 MIT 许可证下提供。Bulma 是一个相当轻量级的框架,因为它只需要一个 CSS 文件。 + +![Bulma homepage][41] + +Bulma 有简洁明快的文档,让你可以很容易地选择你想要探索的主题。它也有很多网页组件,你可以直接拿起来在设计中使用。 + +![Bulma documentation][42] + +Bulma 的 [GitHub][8] 页面列出了 1400 多个提交和 300 多个贡献者。 + +![Bulma GitHub][43] + +### Skeleton + +如果连 Pure 都觉得太重了,那么还有一个叫 [Skeleton][44] 的更轻量级框架。Skeleton 库只有 400 行左右的长度,而且这个框架只提供了开始你的 CSS 框架之旅的基本组件。 + +![Skeleton homepage][45] + +尽管它很简单,但 Skeleton 提供了详细的文档,可以帮助你马上上手。 + +![Skeleton documentation][46] + +Skeleton 的 [GitHub][9] 列出了 167 个提交和 22 个贡献者。然而,它不是很活跃,它的最后一次更新是在 2014 年,所以在使用之前可能需要一些维护。由于它是在 MIT 许可证下发布的,你可以自行维护。 + +![Skeleton GitHub][47] + +### Materialize + +[Materialize][48] 是一个基于 Google 的 Material Design 的响应式前端框架,带有由 Materialize 的贡献者开发的附加主题和组件。 + +![Materialize homepage][49] + +Materialize 的文档页面非常全面,而且相当容易理解。它的组件页面包括按钮、卡片、导航等等。 + +![Materialize documentation][50] + +Materialize 是 MIT 许可证下的开源项目,它的 [GitHub][10] 列出了超过 3800 个提交和 250 个贡献者。 + +![Materialize GitHub][51] + +### Bootflat + +[Bootflat][52] 是由 Twitter 的 Bootstrap 衍生出来的一个开源 CSS 框架。与 Bootstrap 相比, Bootflat 更简单,框架组件更轻量级。 + +![Bootflat homepage][53] + +Bootflat 的[文档][54]几乎像是受到了宜家的启发 —— 它显示的是每个组件的图片,没有太多的文字。 + +![Bootflat docs][55] + +Bootflat 是在 MIT 许可证下提供的,其 [GitHub][11] 页面包括 159 个提交和 8 个贡献者。 + +![Bootflat GitHub][56] + +### 你应该选择哪个 CSS 框架? + +对于开源的 CSS 框架,你有很多选择,这取决于你想要的工具功能有多丰富或简单。就像所有的技术决定一样,没有一个正确的答案,只有在给定的时间和项目中才有正确的选择。 + +尝试一下其中的一些,看看要在下一个项目中使用哪个。另外,我有没有错过任何有趣的开源 CSS 框架?请在下面的评论中分享你的反馈和想法。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/4/open-source-css-frameworks + +作者:[Bryant Son][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/brson +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/browser_web_internet_website.png?itok=g5B_Bw62 (Digital creative of a browser on the internet) +[2]: https://en.wikipedia.org/wiki/Cascading_Style_Sheets +[3]: https://github.com/twbs/bootstrap +[4]: https://github.com/patternfly/patternfly +[5]: https://github.com/material-components/material-components-web +[6]: https://github.com/pure-css/pure +[7]: https://github.com/foundation/foundation-sites +[8]: https://github.com/jgthms/bulma +[9]: https://github.com/dhg/Skeleton +[10]: https://github.com/Dogfalo/materialize +[11]: https://github.com/bootflat/bootflat.github.io +[12]: https://getbootstrap.com +[13]: https://opensource.com/sites/default/files/uploads/2_bootstrapscreenshot.jpg (Bootstrap homepage) +[14]: https://getbootstrap.com/docs/4.4/examples/ +[15]: https://opensource.com/sites/default/files/uploads/3_bootstrapsamples.jpg (Bootstrap examples) +[16]: https://opensource.com/sites/default/files/uploads/4_bootstrapdocs.jpg (Bootstrap documentation) +[17]: https://opensource.com/sites/default/files/uploads/5_bootstrapgithub.jpg (Bootstrap GitHub) +[18]: https://www.patternfly.org +[19]: https://opensource.com/sites/default/files/uploads/6_patternflyhomepage.jpg (PatternFly homepage) +[20]: https://opensource.com/sites/default/files/uploads/7_patternflyreactjs.jpg (PatternFly ReactJS support) +[21]: https://en.wikipedia.org/wiki/Modal_window +[22]: https://opensource.com/sites/default/files/uploads/8_patternflycomponents.jpg (PatternFly chart component) +[23]: https://opensource.com/sites/default/files/uploads/9_patternflygithub.jpg (PatternFly GitHub) +[24]: https://material.io +[25]: https://opensource.com/sites/default/files/uploads/10_materialhome.jpg (Material Design homepage) +[26]: https://material.io/components/ +[27]: https://opensource.com/sites/default/files/uploads/11_materialcomponents.jpg (Material Components webpage) +[28]: https://opensource.com/sites/default/files/uploads/12_materialdocs.jpg (Material Design documentation) +[29]: https://opensource.com/sites/default/files/uploads/13_materialtutorial.jpg (Material Design tutorial) +[30]: https://opensource.com/sites/default/files/uploads/15_materialgithub.jpg (MDC Web GitHub) +[31]: https://purecss.io +[32]: https://opensource.com/sites/default/files/uploads/16_purehome.jpg (Pure.css homepage) +[33]: https://opensource.com/sites/default/files/uploads/17_purecomponents.jpg (Pure.css components) +[34]: https://opensource.com/sites/default/files/uploads/18_puregithub.jpg (Pure.css GitHub) +[35]: https://get.foundation +[36]: https://opensource.com/sites/default/files/uploads/19_foundationhome.jpg (Foundation homepage) +[37]: https://zurb.com/responsive +[38]: https://opensource.com/sites/default/files/uploads/21_foundationdocs.jpg (Foundation documentation) +[39]: https://opensource.com/sites/default/files/uploads/22_foundationgithub.jpg (Foundation GitHub) +[40]: https://bulma.io +[41]: https://opensource.com/sites/default/files/uploads/23_bulmahome.jpg (Bulma homepage) +[42]: https://opensource.com/sites/default/files/uploads/24_bulmadoc.jpg (Bulma documentation) +[43]: https://opensource.com/sites/default/files/uploads/25_bulmagithub.jpg (Bulma GitHub) +[44]: http://getskeleton.com +[45]: https://opensource.com/sites/default/files/uploads/26_skeletonhome.jpg (Skeleton homepage) +[46]: https://opensource.com/sites/default/files/uploads/27_skeletondocs.jpg (Skeleton documentation) +[47]: https://opensource.com/sites/default/files/uploads/28_skeletongithub.jpg (Skeleton GitHub) +[48]: https://materializecss.com +[49]: https://opensource.com/sites/default/files/uploads/29_materializehome.jpg (Materialize homepage) +[50]: https://opensource.com/sites/default/files/uploads/30_materializedocs.jpg (Materialize documentation) +[51]: https://opensource.com/sites/default/files/uploads/31_materializegithub.jpg (Materialize GitHub) +[52]: http://bootflat.github.io +[53]: https://opensource.com/sites/default/files/uploads/32_bootflathome.jpg (Bootflat homepage) +[54]: http://bootflat.github.io/documentation.html +[55]: https://opensource.com/sites/default/files/uploads/33_bootflatdocs.jpg (Bootflat docs) +[56]: https://opensource.com/sites/default/files/uploads/34_bootflatgithub.jpg (Bootflat GitHub) diff --git a/published/202005/20200414 How I containerize a build system.md b/published/202005/20200414 How I containerize a build system.md new file mode 100644 index 0000000000..e268f779ff --- /dev/null +++ b/published/202005/20200414 How I containerize a build system.md @@ -0,0 +1,163 @@ +[#]: collector: (lujun9972) +[#]: translator: (LazyWolfLin) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12232-1.html) +[#]: subject: (How I containerize a build system) +[#]: via: (https://opensource.com/article/20/4/how-containerize-build-system) +[#]: author: (Ravi Chandran https://opensource.com/users/ravichandran) + +对构建系统进行容器化的指南 +====== + +> 搭建一个通过容器分发应用的可复用系统可能很复杂,但这儿有个好方法。 + +![](https://img.linux.net.cn/data/attachment/album/202005/19/085248ausakkjfu05akqr2.jpg) + +一个用于将源代码转换成可运行的应用的构建系统是由工具和流程共同组成。在转换过程中还涉及到代码的受众从软件开发者转变为最终用户,无论最终用户是运维的同事还是部署的同事。 + +在使用容器搭建了一些构建系统后,我觉得有一个不错的可复用的方法值得分享。虽然这些构建系统被用于编译机器学习算法和为嵌入式硬件生成可加载的软件镜像,但这个方法足够抽象,可用于任何基于容器的构建系统。 + +这个方法是以一种易于使用和维护的方式搭建或组织构建系统,但并不涉及处理特定编译器或工具容器化的技巧。它适用于软件开发人员构建软件,并将可维护镜像交给其他技术人员(无论是系统管理员、运维工程师或者其他一些头衔)的常见情况。该构建系统被从终端用户中抽象出来,这样他们就可以专注于软件。 + +### 为什么要容器化构建系统? + +搭建基于容器的可复用构建系统可以为软件团队带来诸多好处: + + * **专注**:我希望专注于应用的开发。当我调用一个工具进行“构建”时,我希望这个工具集能生成一个随时可用的二进制文件。我不想浪费时间在构建系统的查错上。实际上,我宁愿不了解,或者说不关心构建系统。 + * **一致的构建行为**:无论在哪种使用情况下,我都想确保整个团队使用相同版本的工具集并在构建时得到相同的结果。否则,我就得不断地处理“我这咋就是好的”的麻烦。在团队项目中,使用相同版本的工具集并对给定的输入源文件集产生一致的输出是非常重要。 + * **易于部署和升级**:即使向每个人都提供一套详细说明来安装一个项目的工具集,也可能会有人翻车。问题也可能是由于每个人对自己的 Linux 环境的个性化修改导致的。在团队中使用不同的 Linux 发行版(或者其他操作系统),情况可能还会变得更复杂。当需要将工具集升级到下一版本时,问题很快就会变得更糟糕。使用容器和本指南将使得新版本升级非常简单。 + +对我在项目中使用的构建系统进行容器化的这些经验显然很有价值,因为它可以缓解上述问题。我倾向于使用 Docker 作为容器工具,虽然在相对特殊的环境中安装和网络配置仍可能出现问题,尤其是当你在一个使用复杂代理的企业环境中工作时。但至少现在我需要解决的构建系统问题已经很少了。 + +### 漫步容器化的构建系统 + +我创建了一个[教程存储库][2],随后你可以克隆并检查它,或者按照本文内容进行操作。我将逐个介绍存储库中的文件。这个构建系统非常简单(它运行 `gcc`),从而可以让你专注于这个构建系统结构上。 + +### 构建系统需求 + +我认为构建系统中有两个关键点: + + * **标准化构建调用**:我希望能够指定一些形如 `/path/to/workdir` 的工作目录来构建代码。我希望以如下形式调用构建: + + ./build.sh /path/to/workdir + + 为了使得示例的结构足够简单(以便说明),我将假定输出也在 `/path/to/workdir` 路径下的某处生成。(否则,将增加容器中显示的卷的数量,虽然这并不困难,但解释起来比较麻烦。) + * **通过 shell 自定义构建调用**:有时,工具集会以出乎意料的方式被调用。除了标准的工具集调用 `build.sh` 之外,如果需要还可以为 `build.sh` 添加一些选项。但我一直希望能够有一个可以直接调用工具集命令的 shell。在这个简单的示例中,有时我想尝试不同的 `gcc` 优化选项并查看效果。为此,我希望调用: + + ./shell.sh /path/to/workdir + + 这将让我得到一个容器内部的 Bash shell,并且可以调用工具集和访问我的工作目录(`workdir`),从而我可以根据需要尝试使用这个工具集。 + +### 构建系统的架构 + +为了满足上述基本需求,这是我的构架系统架构: + +![Container build system architecture][3] + +在底部的 `workdir` 代表软件开发者用于构建的任意软件源码。通常,这个 `workdir` 是一个源代码的存储库。在构建之前,最终用户可以通过任何方式来操纵这个存储库。例如,如果他们使用 `git` 作为版本控制工具的话,可以使用 `git checkout` 切换到他们正在工作的功能分支上并添加或修改文件。这样可以使得构建系统独立于 `workdir` 之外。 + +顶部的三个模块共同代表了容器化的构建系统。最左边的黄色模块代表最终用户与构建系统交互的脚本(`build.sh` 和 `shell.sh`)。 + +在中间的红色模块是 Dockerfile 和相关的脚本 `build_docker_image.sh`。开发运营者(在这个例子中指我)通常将执行这个脚本并生成容器镜像(事实上我多次执行它直到一切正常为止,但这是另一回事)。然后我将镜像分发给最终用户,例如通过容器信任注册库container trusted registry进行分发。最终用户将需要这个镜像。另外,他们将克隆构建系统的存储库(即一个与[教程存储库][2]等效的存储库)。 + +当最终用户调用 `build.sh` 或者 `shell.sh` 时,容器内将执行右边的 `run_build.sh` 脚本。接下来我将详细解释这些脚本。这里的关键是最终用户不需要为了使用而去了解任何关于红色或者蓝色模块或者容器工作原理的知识。 + +### 构建系统细节 + +把教程存储库的文件结构映射到这个系统结构上。我曾将这个原型结构用于相对复杂构建系统,因此它的简单并不会造成任何限制。下面我列出存储库中相关文件的树结构。文件夹 `dockerize-tutorial` 能用构建系统的其他任何名称代替。在这个文件夹下,我用 `workdir` 的路径作参数调用 `build.sh` 或 `shell.sh`。 + +``` +dockerize-tutorial/ +├── build.sh +├── shell.sh +└── swbuilder +    ├── build_docker_image.sh +    ├── install_swbuilder.dockerfile +    └── scripts +        └── run_build.sh +``` + +请注意,我上面特意没列出 `example_workdir`,但你能在教程存储库中找到它。实际的源码通常存放在单独的存储库中,而不是构建工具库中的一部分;本教程为了不必处理两个存储库,所以我将它包含在这个存储库中。 + +如果你只对概念感兴趣,本教程并非必须的,因为我将解释所有文件。但是如果你继续本教程(并且已经安装 Docker),首先使用以下命令来构建容器镜像 `swbuilder:v1`: + +``` +cd dockerize-tutorial/swbuilder/ +./build_docker_image.sh +docker image ls  # resulting image will be swbuilder:v1 +``` + +然后调用 `build.sh`: + +``` +cd dockerize-tutorial +./build.sh ~/repos/dockerize-tutorial/example_workdir +``` + +下面是 [build.sh][4] 的代码。这个脚本从容器镜像 `swbuilder:v1` 实例化一个容器。而这个容器实例映射了两个卷:一个将文件夹 `example_workdir` 挂载到容器内部路径 `/workdir` 上,第二个则将容器外的文件夹 `dockerize-tutorial/swbuilder/scripts` 挂载到容器内部路径 `/scripts` 上。 + +``` +docker container run                              \ +    --volume $(pwd)/swbuilder/scripts:/scripts    \ +    --volume $1:/workdir                          \ +    --user $(id -u ${USER}):$(id -g ${USER})      \ +    --rm -it --name build_swbuilder swbuilder:v1  \ +    build +``` + +另外,`build.sh` 还会用你的用户名(以及组,本教程假设两者一致)去运行容器,以便在访问构建输出时不出现文件权限问题。 + +请注意,[shell.sh][5] 和 `build.sh` 大体上是一致的,除了两点不同:`build.sh` 会创建一个名为 `build_swbuilder` 的容器,而 `shell.sh` 则会创建一个名为 `shell_swbuilder` 的容器。这样一来,当其中一个脚本运行时另一个脚本被调用也不会产生冲突。 + +两个脚本之间的另一处关键不同则在于最后一个参数:`build.sh` 传入参数 `build` 而 `shell.sh` 则传入 `shell`。如果你看了用于构建容器镜像的 [Dockerfile][6],就会发现最后一行包含了下面的 `ENTRYPOINT` 语句。这意味着上面的 `docker container run` 调用将使用 `build` 或 `shell` 作为唯一的输入参数来执行 `run_build.sh` 脚本。 + +``` +# run bash script and process the input command +ENTRYPOINT [ "/bin/bash", "/scripts/run_build.sh"] +``` + +[run_build.sh][7] 使用这个输入参数来选择启动 Bash shell 还是调用 `gcc` 来构建 `helloworld.c` 项目。一个真正的构建系统通常会使用 Makefile 而非直接运行 `gcc`。 + +``` +cd /workdir + +if [ $1 = "shell" ]; then     +    echo "Starting Bash Shell" +    /bin/bash +elif [ $1 = "build" ]; then +    echo "Performing SW Build" +    gcc helloworld.c -o helloworld -Wall +fi +``` + +在使用时,如果你需要传入多个参数,当然也是可以的。我处理过的构建系统,构建通常是对给定的项目调用 `make`。如果一个构建系统有非常复杂的构建调用,则你可以让 `run_build.sh` 调用 `workdir` 下最终用户编写的特定脚本。 + +### 关于 scripts 文件夹的说明 + +你可能想知道为什么 `scripts` 文件夹位于目录树深处而不是位于存储库的顶层。两种方法都是可行的,但我不想鼓励最终用户到处乱翻并修改里面的脚本。将它放到更深的地方是一个让他们更难乱翻的方法。另外,我也可以添加一个 `.dockerignore` 文件去忽略 `scripts` 文件夹,因为它不是容器必需的部分。但因为它很小,所以我没有这样做。 + +### 简单而灵活 + +尽管这一方法很简单,但我在几个相当不同的构建系统中使用过,发现它相当灵活。相对稳定的部分(例如,一年仅修改数次的给定工具集)被固定在容器镜像内。较为灵活的部分则以脚本的形式放在镜像外。这使我能够通过修改脚本并将更改推送到构建系统存储库中,轻松修改调用工具集的方式。用户所需要做的是将更改拉到本地的构建系统存储库中,这通常是非常快的(与更新 Docker 镜像不同)。这种结构使其能够拥有尽可能多的卷和脚本,同时使最终用户摆脱复杂性。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/4/how-containerize-build-system + +作者:[Ravi Chandran][a] +选题:[lujun9972][b] +译者:[LazyWolfLin](https://github.com/LazyWolfLin) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/ravichandran +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/containers_2015-3-osdc-lead.png?itok=O6aivM_W (Containers on a ship on the ocean) +[2]: https://github.com/ravi-chandran/dockerize-tutorial +[3]: https://opensource.com/sites/default/files/uploads/build_sys_arch.jpg (Container build system architecture) +[4]: https://github.com/ravi-chandran/dockerize-tutorial/blob/master/build.sh +[5]: https://github.com/ravi-chandran/dockerize-tutorial/blob/master/shell.sh +[6]: https://github.com/ravi-chandran/dockerize-tutorial/blob/master/swbuilder/install_swbuilder.dockerfile +[7]: https://github.com/ravi-chandran/dockerize-tutorial/blob/master/swbuilder/scripts/run_build.sh diff --git a/published/202005/20200416 Learning to love systemd.md b/published/202005/20200416 Learning to love systemd.md new file mode 100644 index 0000000000..5cacf21a0c --- /dev/null +++ b/published/202005/20200416 Learning to love systemd.md @@ -0,0 +1,318 @@ +[#]: collector: (lujun9972) +[#]: translator: (messon007) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12214-1.html) +[#]: subject: (Learning to love systemd) +[#]: via: (https://opensource.com/article/20/4/systemd) +[#]: author: (David Both https://opensource.com/users/dboth) + +学会爱上 systemd +====== + +> systemd 是所有进程之母,负责将 Linux 主机启动到可以做生产性任务的状态。 + +![](https://img.linux.net.cn/data/attachment/album/202005/13/085016gy86wj713zh7xq71.jpg) + +systemd(是的,全小写,即使在句子开头也是小写),是初始化程序(`init`)和 SystemV 初始化脚本的现代替代者。此外,它还有更多功能。 + +当我想到 `init` 和 SystemV 初始化时,像大多数系统管理员一样,我想到的是 Linux 的启动和关闭,而不是真正意义上的管理服务,例如在服务启动和运行后对其进行管理。像 `init` 一样,systemd 是所有进程之母,它负责使 Linux 主机启动到可以做生产性任务的状态。systemd 设定的一些功能比老的初始化程序要广泛得多,它要管理正在运行的 Linux 主机的许多方面,包括挂载文件系统、管理硬件、处理定时器以及启动和管理生产性主机所需的系统服务。 + +本系列文章是基于我的三期 Linux 培训课程《[使用和管理 Linux:从零开始进行学习系统管理][2]》部分内容的摘录,探讨了 systemd 在启动和启动完成后的功能。 + +### Linux 引导 + +Linux 主机从关机状态到运行状态的完整启动过程很复杂,但它是开放的并且是可知的。在详细介绍之前,我将简要介绍一下从主机硬件被上电到系统准备好用户登录的过程。大多数时候,“引导过程”被作为一个整体来讨论,但这是不准确的。实际上,完整的引导和启动过程包含三个主要部分: + +* 硬件引导:初始化系统硬件 +* Linux 引导boot:加载 Linux 内核和 systemd +* Linux 启动startup:systemd 为主机的生产性工作做准备 + +Linux 启动阶段始于内核加载了 `init` 或 systemd(取决于具体发行版使用的是旧的方式还是还是新的方式)之后。`init` 和 systemd 程序启动并管理所有其它进程,它们在各自的系统上都被称为“所有进程之母”。 + +将硬件引导与 Linux 引导及 Linux 启动区分开,并明确定义它们之间的分界点是很重要的。理解它们的差异以及它们每一个在使 Linux 系统进入生产状态所起的作用,才能够管理这些进程,并更好地确定大部分人所谓的“启动”问题出在哪里。 + +启动过程按照三步引导流程,使 Linux 计算机进入可进行生产工作的状态。当内核将主机的控制权转移到 systemd 时,启动环节开始。 + +### systemd 之争 + +systemd 引起了系统管理员和其它负责维护 Linux 系统正常运行人员的广泛争议。在许多 Linux 系统中,systemd 接管了大量任务,这在某些开发者和sysadmins群体中引起了反对和不和谐。 + +SystemV 和 systemd 是执行 Linux 启动环节的两种不同的方法。SystemV 启动脚本和 `init` 程序是老的方法,而使用目标target的 systemd 是新方法。尽管大多数现代 Linux 发行版都使用较新的 systemd 进行启动、关机和进程管理,但仍有一些发行版未采用。原因之一是某些发行版维护者和系统管理员喜欢老的 SystemV 方法,而不是新的 systemd。 + +我认为两者都有其优势。 + +#### 为何我更喜欢 SystemV + +我更喜欢 SystemV,因为它更开放。使用 Bash 脚本来完成启动。内核启动 `init` 程序(这是一个编译后的二进制)后,`init` 启动 `rc.sysinit` 脚本,该脚本执行许多系统初始化任务。`rc.sysinit` 执行完后,`init` 启动 `/etc/rc.d/rc` 脚本,该脚本依次启动 `/etc/rc.d/rcX.d` 中由 SystemV 启动脚本定义的各种服务。其中 `X` 是待启动的运行级别号。 + +除了 `init` 程序本身之外,所有这些程序都是开放且易于理解的脚本。可以通读这些脚本并确切了解整个启动过程中发生的事情,但是我不认为有太多系统管理员真正做到这一点。每个启动脚本都被编了号,以便按特定顺序启动预期的服务。服务是串行启动的,一次只能启动一个服务。 + +systemd 是由 Red Hat 的 Lennart Poettering 和 Kay Sievers 开发的,它是一个由大型的、编译的二进制可执行文件构成的复杂系统,不访问其源码就无法理解。它是开源的,因此“访问其源代码”并不难,只是不太方便。systemd 似乎表现出对 Linux 哲学多个原则的重大驳斥。作为二进制文件,systemd 无法被直接打开供系统管理员查看或进行简单更改。systemd 试图做所有事情,例如管理正在运行的服务,同时提供明显比 SystemV 更多的状态信息。它还管理硬件、进程、进程组、文件系统挂载等。systemd 几乎涉足于现代 Linux 主机的每个方面,使它成为系统管理的一站式工具。所有这些都明显违反了“程序应该小,且每个程序都应该只做一件事并做好”的原则。 + +#### 为何我更喜欢 systemd + +我更喜欢用 systemd 作为启动机制,因为它会根据启动阶段并行地启动尽可能多的服务。这样可以加快整个的启动速度,使得主机系统比 SystemV 更快地到达登录屏幕。 + +systemd 几乎可以管理正在运行的 Linux 系统的各个方面。它可以管理正在运行的服务,同时提供比SystemV 多得多的状态信息。它还管理硬件、进程和进程组、文件系统挂载等。systemd 几乎涉足于现代 Linux 操作系统的每方面,使其成为系统管理的一站式工具。(听起来熟悉吧?) + +systemd 工具是编译后的二进制文件,但该工具包是开放的,因为所有配置文件都是 ASCII 文本文件。可以通过各种 GUI 和命令行工具来修改启动配置,也可以添加或修改各种配置文件来满足特定的本地计算环境的需求。 + +#### 真正的问题 + +你认为我不能喜欢两种启动系统吗?我能,我会用它们中的任何一个。 + +我认为,SystemV 和 systemd 之间大多数争议的真正问题和根本原因在于,在系统管理层面[没有选择权][3]。使用 SystemV 还是 systemd 已经由各种发行版的开发人员、维护人员和打包人员选择了(但有充分的理由)。由于 `init` 极端的侵入性,挖出并替换 `init` 系统会带来很多影响,会带来很多在发行版设计过程之外难以解决的后果。 + +尽管该选择实际上是为我而选的,但我的Linux主机能不能开机、能不能工作,这是我平时最关心的。作为最终用户,甚至是系统管理员,我主要关心的是我是否可以完成我的工作,例如写我的书和这篇文章,安装更新以及编写脚本来自动化所有事情。只要我能做我的工作,我就不会真正在意发行版中使用的启动系统。 + +在启动或服务管理出现问题时,我会在意。无论主机上使用哪种启动系统,我都足够了解如何沿着事件顺序来查找故障并进行修复。 + +#### 替换SystemV + +以前曾有过用更现代的东西替代 SystemV 的尝试。大约在两个版本中,Fedora 使用了一个叫作 Upstart 的东西来替换老化的 SystemV,但是它没有取代 `init`,也没有提供我所注意到的任何变化。由于 Upstart 并未对 SystemV 的问题进行任何显著的改变,所以在这个方向上的努力很快就被放弃了,转而使用 systemd。 + +尽管大部分 Linux 开发人员都认可替换旧的 SystemV 启动系统是个好主意,但许多开发人员和系统管理员并不喜欢 systemd。与其重新讨论人们在 systemd 中遇到的或曾经遇到过的所有所谓的问题,不如带你去看两篇好文章,尽管有些陈旧,但它们涵盖了大多数内容。Linux 内核的创建者 Linus Torvalds 对 systemd 似乎不感兴趣。在 2014 年 ZDNet 的一篇文章《[Linus Torvalds 和其他人对 Linux 上的 systemd 的看法][4]》中,Linus 清楚地表达了他的感受。 + +> “实际上我对 systemd 本身没有任何特别强烈的意见。我对一些核心开发人员有一些问题,我认为他们在对待错误和兼容性方面过于轻率,而且我认为某些设计细节是疯狂的(例如,我不喜欢二进制日志),但这只是细节,不是大问题。” + +如果你对 Linus 不太了解的话,我可以告诉你,如果他不喜欢某事,他是非常直言不讳的,很明确,而且相当明确的表示不喜欢。他解决自己对事物不满的方式已经被社会更好地接受了。 + +2013 年,Poettering 写了一篇很长的博客,他在文章驳斥了[关于 systemd 的迷思][5],同时对创建 systemd 的一些原因进行了深入的剖析。这是一分很好的读物,我强烈建议你阅读。 + +### systemd 任务 + +根据编译过程中使用的选项(不在本系列中介绍),systemd 可以有多达 69 个二进制可执行文件执行以下任务,其中包括: + +* `systemd` 程序以 1 号进程(PID 1)运行,并提供使尽可能多服务并行启动的系统启动能力,它额外加快了总体启动时间。它还管理关机顺序。 +* `systemctl` 程序提供了服务管理的用户接口。 +* 支持 SystemV 和 LSB 启动脚本,以便向后兼容。 +* 服务管理和报告提供了比 SystemV 更多的服务状态数据。 +* 提供基本的系统配置工具,例如主机名、日期、语言环境、已登录用户的列表,正在运行的容器和虚拟机、系统帐户、运行时目录及设置,用于简易网络配置、网络时间同步、日志转发和名称解析的守护进程。 +* 提供套接字管理。 +* systemd 定时器提供类似 cron 的高级功能,包括在相对于系统启动、systemd 启动时间、定时器上次启动时间的某个时间点运行脚本。 +* 它提供了一个工具来分析定时器规范中使用的日期和时间。 +* 能感知分层的文件系统挂载和卸载功能可以更安全地级联挂载的文件系统。 +* 允许主动的创建和管理临时文件,包括删除。 +* D-Bus 的接口提供了在插入或移除设备时运行脚本的能力。这允许将所有设备(无论是否可插拔)都被视为即插即用,从而大大简化了设备的处理。 +* 分析启动环节的工具可用于查找耗时最多的服务。 +* 它包括用于存储系统消息的日志以及管理日志的工具。 + +### 架构 + +这些以及更多的任务通过许多守护程序、控制程序和配置文件来支持。图 1 显示了许多属于 systemd 的组件。这是一个简化的图,旨在提供概要描述,因此它并不包括所有独立的程序或文件。它也不提供数据流的视角,数据流是如此复杂,因此在本系列文章的背景下没用。 + +![系统架构][6] + +*图 1:systemd 的架构,作者 Shmuel Csaba Otto Traian (CC BY-SA 3.0)* + +如果要完整地讲解 systemd 就需要一本书。你不需要了解图 1 中的 systemd 组件是如何组合在一起的细节。只需了解支持各种 Linux 服务管理以及日志文件和日志处理的程序和组件就够了。但是很明显, systemd 并不是某些批评者所宣称的那样,它是一个单一的怪物。 + +### 作为 1 号进程的 systemd + +systemd 是 1 号进程(PID 1)。它的一些功能,比老的 SystemV3 `init` 要广泛得多,用于管理正在运行的 Linux 主机的许多方面,包括挂载文件系统以及启动和管理 Linux 生产主机所需的系统服务。与启动环节无关的任何 systemd 任务都不在本文讨论范围之内(但本系列后面的一些文章将探讨其中的一些任务)。 + +首先,systemd 挂载 `/etc/fstab` 所定义的文件系统,包括所有交换文件或分区。此时,它可以访问位于 `/etc` 中的配置文件,包括它自己的配置文件。它使用其配置链接 `/etc/systemd/system/default.target` 来确定将主机引导至哪个状态或目标。`default.target` 文件是指向真实目标文件的符号链接。对于桌面工作站,通常是 `graphical.target`,它相当于 SystemV 中的运行级别 5。对于服务器,默认值更可能是 `multi-user.target`,相当于 SystemV 中的运行级别 3。`emergency.target` 类似于单用户模式。目标target服务service是 systemd 的单元unit。 + +下表(图 2)将 systemd 目标与老的 SystemV 启动运行级别进行了比较。systemd 提供 systemd 目标别名以便向后兼容。目标别名允许脚本(以及许多系统管理员)使用 SystemV 命令(如 `init 3`)更改运行级别。当然,SystemV 命令被转发给 systemd 进行解释和执行。 + +systemd 目标 | SystemV 运行级别 | 目标别名 | 描述 +--- | --- | --- | --- +`default.target` | | | 此目标总是通过符号连接的方式成为 `multi-user.target` 或 `graphical.target` 的别名。systemd 始终使用 `default.target` 来启动系统。`default.target` 绝不应该设为 `halt.target`,`poweroff.target` 或 `reboot.target` 的别名。 +`graphic.target` | 5 | `runlevel5.target` |带有 GUI 的 `multi-user.target`。 + | 4 | `runlevel4.target` |未用。在 SystemV 中运行级别 4 与运行级别 3 相同。可以创建并自定义此目标以启动本地服务,而无需更改默认的 `multi-user.target`。 +`multi-user.target` | 3 | `runlevel3.target` |所有服务在运行,但仅有命令行界面(CLI)。 + | 2 | `runlevel2.target` | 多用户,没有 NFS,其它所有非 GUI 服务在运行。 +`rescue.target` | 1 | `runlevel1.target` | 基本系统,包括挂载文件系统,运行最基本的服务和主控制台的恢复 shell。 +`emergency.target` | S | |单用户模式:没有服务运行;不挂载文件系统。这是最基本的工作级别,只有主控制台上运行的一个紧急 Shell 供用户与系统交互。 +`halt.target` | | | 停止系统而不关闭电源。 +`reboot.target` | 6 | `runlevel6.target` | 重启。 +`poweroff.target` | 0 | `runlevel0.target` | 停止系统并关闭电源。 + +*图 2:SystemV 运行级别与 systemd 目标和一些目标别名的比较* + +每个目标在其配置文件中都描述了一个依赖集。systemd 启动必须的依赖项,这些依赖项是运行 Linux 主机到特定功能级别所需的服务。当目标配置文件中列出的所有依赖项被加载并运行后,系统就在该目标级别运行了。在图 2 中,功能最多的目标位于表的顶部,从顶向下,功能逐步递减。 + +systemd 还会检查老的 SystemV `init` 目录,以确认是否存在任何启动文件。如果有,systemd 会将它们作为配置文件以启动它们描述的服务。网络服务是一个很好的例子,在 Fedora 中它仍然使用 SystemV 启动文件。 + +图 3(如下)是直接从启动手册页复制来的。它显示了 systemd 启动期间一般的事件环节以及确保成功启动的基本顺序要求。 + +``` + cryptsetup-pre.target + | + (various low-level v + API VFS mounts: (various cryptsetup devices...) + mqueue, configfs, | | + debugfs, ...) v | + | cryptsetup.target | + | (various swap | | remote-fs-pre.target + | devices...) | | | | + | | | | | v + | v local-fs-pre.target | | | (network file systems) + | swap.target | | v v | + | | v | remote-cryptsetup.target | + | | (various low-level (various mounts and | | | + | | services: udevd, fsck services...) | | remote-fs.target + | | tmpfiles, random | | | / + | | seed, sysctl, ...) v | | / + | | | local-fs.target | | / + | | | | | | / + \____|______|_______________ ______|___________/ | / + \ / | / + v | / + sysinit.target | / + | | / + ______________________/|\_____________________ | / + / | | | \ | / + | | | | | | / + v v | v | | / + (various (various | (various | |/ + timers...) paths...) | sockets...) | | + | | | | | | + v v | v | | + timers.target paths.target | sockets.target | | + | | | | v | + v \_______ | _____/ rescue.service | + \|/ | | + v v | + basic.target rescue.target | + | | + ________v____________________ | + / | \ | + | | | | + v v v | + display- (various system (various system | + manager.service services services) | + | required for | | + | graphical UIs) v v + | | multi-user.target + emergency.service | | | + | \_____________ | _____________/ + v \|/ + emergency.target v + graphical.target +``` + +*图 3: systemd 启动图* + +`sysinit.target` 和 `basic.target` 目标可以看作启动过程中的检查点。尽管 systemd 的设计目标之一是并行启动系统服务,但是某些服务和功能目标必须先启动,然后才能启动其它服务和目标。直到该检查点所需的所有服务和目标被满足后才能通过这些检查点。 + +当 `sysinit.target` 所依赖的所有单元都完成时,就会到达 `sysinit.target`。所有这些单元,包括挂载文件系统、设置交换文件、启动 Udev、设置随机数生成器种子、启动低层服务以及配置安全服务(如果一个或多个文件系统是加密的)都必须被完成,但在 `sysinit.target` 中,这些任务可以并行执行。 + +`sysinit.target` 启动了系统接近正常运行所需的所有低层服务和单元,它们也是进入 `basic.target` 所需的。 + +在完成 `sysinit.target` 之后,systemd 会启动实现下一个目标所需的所有单元。`basic.target` 通过启动所有下一目标所需的单元来提供一些额外功能。包括设置为各种可执行程序目录的路径、设置通信套接字和计时器之类。 + +最后,用户级目标 `multi-user.target` 或 `graphical.target` 被初始化。要满足 `graphical.target` 的依赖必须先达到 `multi-user.target`。图 3 中带下划线的目标是通常的启动目标。当达到这些目标之一时,启动就完成了。如果 `multi-user.target` 是默认设置,那么你应该在控制台上看到文本模式的登录界面。如果 `graphical.target` 是默认设置,那么你应该看到图形的登录界面。你看到的具体的 GUI 登录界面取决于你的默认显示管理器。 + +引导手册页还描述并提供了引导到初始化 RAM 磁盘和 systemd 关机过程的图。 + +systemd 还提供了一个工具,该工具列出了完整的启动过程或指定单元的依赖项。单元是一个可控的 systemd 资源实体,其范围可以从特定服务(例如 httpd 或 sshd)到计时器、挂载、套接字等。尝试以下命令并滚动查看结果。 + +``` +systemctl list-dependencies graphical.target +``` + +注意,这会完全展开使系统进入 `graphical.target` 运行模式所需的顶层目标单元列表。也可以使用 `--all` 选项来展开所有其它单元。 + +``` +systemctl list-dependencies --all graphical.target +``` + +你可以使用 `less` 命令来搜索诸如 `target`、`slice` 和 `socket` 之类的字符串。 + +现在尝试下面的方法。 + +``` +systemctl list-dependencies multi-user.target +``` + +和 + +``` +systemctl list-dependencies rescue.target +``` + +和 + +``` +systemctl list-dependencies local-fs.target +``` + +和 + +``` +systemctl list-dependencies dbus.service +``` + +这个工具帮助我可视化我正用的主机的启动依赖细节。继续花一些时间探索一个或多个 Linux 主机的启动树。但是要小心,因为 systemctl 手册页包含以下注释: + +> “请注意,此命令仅列出当前被服务管理器加载到内存的单元。尤其是,此命令根本不适合用于获取特定单元的全部反向依赖关系列表,因为它不会列出被单元声明了但是未加载的依赖项。” + +### 结尾语 + +即使在没有深入研究 systemd 之前,很明显能看出它既强大又复杂。显然,systemd 不是单一、庞大、独体且不可知的二进制文件。相反,它是由许多较小的组件和旨在执行特定任务的子命令组成。 + +本系列的下一篇文章将更详细地探讨 systemd 的启动,以及 systemd 的配置文件,更改默认的目标以及如何创建简单服务单元。 + +### 资源 + +互联网上有大量关于 systemd 的信息,但是很多都很简短、晦涩甚至是带有误导。除了本文提到的资源外,以下网页还提供了有关 systemd 启动的更详细和可靠的信息。 + +* Fedora 项目有一个很好的实用的 [systemd 指南][7]。它有你需要知道的通过 systemd 来配置、管理和维护 Fedora 主机所需的几乎所有知识。 +* Fedora 项目还有一个不错的[速记表][8],将老的 SystemV 命令与对比的 systemd 命令相互关联。 +* 有关 systemd 的详细技术信息及创建它的原因,请查看 [Freedesktop.org][9] 对 [systemd 描述][10]。 +* [Linux.com][11] 的“systemd 的更多乐趣”提供了更高级的 systemd [信息和技巧][12]。 + +还有针对 Linux 系统管理员的一系列技术性很强的文章,作者是 systemd 的设计师和主要开发者 Lennart Poettering。这些文章是在 2010 年 4 月至 2011 年 9 月之间撰写的,但它们现在和那时一样有用。关于 systemd 及其生态的其它许多好文都基于这些论文。 + +* [重新思考 1 号进程][13] +* [systemd 系统管理员篇 I][14] +* [systemd 系统管理员篇 II][15] +* [systemd 系统管理员篇 III][16] +* [systemd 系统管理员篇 IV][17] +* [systemd 系统管理员篇 V][18] +* [systemd 系统管理员篇 VI][19] +* [systemd 系统管理员篇 VII][20] +* [systemd 系统管理员篇 VIII][21] +* [systemd 系统管理员篇 IX][22] +* [systemd 系统管理员篇 X][23] +* [systemd 系统管理员篇 XI][24] + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/4/systemd + +作者:[David Both][a] +选题:[lujun9972][b] +译者:[messon007](https://github.com/messon007) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/dboth +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/car-penguin-drive-linux-yellow.png?itok=twWGlYAc (Penguin driving a car with a yellow background) +[2]: http://www.both.org/?page_id=1183 +[3]: http://www.osnews.com/story/28026/Editorial_Thoughts_on_Systemd_and_the_Freedom_to_Choose +[4]: https://www.zdnet.com/article/linus-torvalds-and-others-on-linuxs-systemd/ +[5]: http://0pointer.de/blog/projects/the-biggest-myths.html +[6]: https://opensource.com/sites/default/files/uploads/systemd-architecture.png (systemd architecture) +[7]: https://docs.fedoraproject.org/en-US/quick-docs/understanding-and-administering-systemd/index.html +[8]: https://fedoraproject.org/wiki/SysVinit_to_Systemd_Cheatsheet +[9]: http://Freedesktop.org +[10]: http://www.freedesktop.org/wiki/Software/systemd +[11]: http://Linux.com +[12]: https://www.linux.com/training-tutorials/more-systemd-fun-blame-game-and-stopping-services-prejudice/ +[13]: http://0pointer.de/blog/projects/systemd.html +[14]: http://0pointer.de/blog/projects/systemd-for-admins-1.html +[15]: http://0pointer.de/blog/projects/systemd-for-admins-2.html +[16]: http://0pointer.de/blog/projects/systemd-for-admins-3.html +[17]: http://0pointer.de/blog/projects/systemd-for-admins-4.html +[18]: http://0pointer.de/blog/projects/three-levels-of-off.html +[19]: http://0pointer.de/blog/projects/changing-roots +[20]: http://0pointer.de/blog/projects/blame-game.html +[21]: http://0pointer.de/blog/projects/the-new-configuration-files.html +[22]: http://0pointer.de/blog/projects/on-etc-sysinit.html +[23]: http://0pointer.de/blog/projects/instances.html +[24]: http://0pointer.de/blog/projects/inetd.html diff --git a/published/202005/20200417 Create a SDN on Linux with open source.md b/published/202005/20200417 Create a SDN on Linux with open source.md new file mode 100644 index 0000000000..e05b649ee1 --- /dev/null +++ b/published/202005/20200417 Create a SDN on Linux with open source.md @@ -0,0 +1,185 @@ +[#]: collector: (lujun9972) +[#]: translator: (messon007) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12199-1.html) +[#]: subject: (Create a SDN on Linux with open source) +[#]: via: (https://opensource.com/article/20/4/quagga-linux) +[#]: author: (M Umer https://opensource.com/users/noisybotnet) + +在 Linux 上使用开源软件创建 SDN +====== + +> 使用开源路由协议栈 Quagga,使你的 Linux 系统成为一台路由器。 + +![](https://img.linux.net.cn/data/attachment/album/202005/09/093541rqx3zr5dxn3yvnq6.jpg) + +网络路由协议分为两大类:内部网关协议和外部网关协议。路由器使用内部网关协议在单个自治系统内共享信息。如果你用的是 Linux,则可以通过开源(GPLv2)路由协议栈 [Quagga][2] 使其表现得像一台路由器。 + +### Quagga 是什么? + +Quagga 是一个[路由软件包][3],并且是 [GNU Zebra][4] 的一个分支。它为类 Unix 平台提供了所有主流路由协议的实现,例如开放最短路径优先(OSPF),路由信息协议(RIP),边界网关协议(BGP)和中间系统到中间系统协议(IS-IS)。 + +尽管 Quagga 实现了 IPv4 和 IPv6 的路由协议,但它并不是一个完整的路由器。一个真正的路由器不仅实现了所有路由协议,而且还有转发网络流量的能力。 Quagga 仅仅实现了路由协议栈,而转发网络流量的工作由 Linux 内核处理。 + +### 架构 + +Quagga 通过特定协议的守护程序实现不同的路由协议。守护程序名称与路由协议相同,加了字母“d”作为后缀。Zebra 是核心,也是与协议无关的守护进程,它为内核提供了一个[抽象层][5],并通过 TCP 套接字向 Quagga 客户端提供 Zserv API。每个特定协议的守护程序负责运行相关的协议,并基于交换的信息来建立路由表。 + +![Quagga architecture][6] + +### 环境 + +本教程通过 Quagga 实现的 OSPF 协议来配置动态路由。该环境包括两个名为 Alpha 和 Beta 的 CentOS 7.7 主机。两台主机共享访问 **192.168.122.0/24** 网络。 + +**主机 Alpha:** + +IP:192.168.122.100/24 +网关:192.168.122.1 + +**主机 Beta:** + +IP:192.168.122.50/24 +网关:192.168.122.1 + +### 安装软件包 + +首先,在两台主机上安装 Quagga 软件包。它存在于 CentOS 基础仓库中: + +``` +yum install quagga -y +``` + +### 启用 IP 转发 + +接下来,在两台主机上启用 IP 转发,因为它将由 Linux 内核来执行: + +``` +sysctl -w net.ipv4.ip_forward = 1 +sysctl -p +``` + +### 配置 + +现在,进入 `/etc/quagga` 目录并为你的设置创建配置文件。你需要三个文件: + +* `zebra.conf`:Quagga 守护程序的配置文件,你可以在其中定义接口及其 IP 地址和 IP 转发 +* `ospfd.conf`:协议配置文件,你可以在其中定义将通过 OSPF 协议提供的网络 +* `daemons`:你将在其中指定需要运行的相关的协议守护程序 + +在主机 Alpha 上, + +``` + [root@alpha]# cat /etc/quagga/zebra.conf +interface eth0 + ip address 192.168.122.100/24 + ipv6 nd suppress-ra +interface eth1 + ip address 10.12.13.1/24 + ipv6 nd suppress-ra +interface lo +ip forwarding +line vty + +[root@alpha]# cat /etc/quagga/ospfd.conf +interface eth0 +interface eth1 +interface lo +router ospf + network 192.168.122.0/24 area 0.0.0.0 + network 10.12.13.0/24 area 0.0.0.0 +line vty + +[root@alphaa ~]# cat /etc/quagga/daemons +zebra=yes +ospfd=yes +``` + +在主机 Beta 上, + +``` +[root@beta quagga]# cat zebra.conf +interface eth0 + ip address 192.168.122.50/24 + ipv6 nd suppress-ra +interface eth1 + ip address 10.10.10.1/24 + ipv6 nd suppress-ra +interface lo +ip forwarding +line vty + +[root@beta quagga]# cat ospfd.conf +interface eth0 +interface eth1 +interface lo +router ospf + network 192.168.122.0/24 area 0.0.0.0 + network 10.10.10.0/24 area 0.0.0.0 +line vty + +[root@beta ~]# cat /etc/quagga/daemons +zebra=yes +ospfd=yes +``` + +### 配置防火墙 + +要使用 OSPF 协议,必须允许它通过防火墙: + +``` +firewall-cmd --add-protocol=ospf –permanent + +firewall-cmd –reload +``` + +现在,启动 `zebra` 和 `ospfd` 守护程序。 + +``` +# systemctl start zebra +# systemctl start ospfd +``` + +用下面命令在两个主机上查看路由表: + +``` +[root@alpha ~]# ip route show   +default via 192.168.122.1 dev eth0 proto static metric 100 +10.10.10.0/24 via 192.168.122.50 dev eth0 proto zebra metric 20 +10.12.13.0/24 dev eth1 proto kernel scope link src 10.12.13.1 +192.168.122.0/24 dev eth0 proto kernel scope link src 192.168.122.100 metric 100 +``` + +你可以看到 Alpha 上的路由表包含通过 **192.168.122.50** 到达 **10.10.10.0/24** 的路由项,它是通过协议 zebra 获取的。同样,在主机 Beta 上,该表包含通过 **192.168.122.100** 到达网络 **10.12.13.0/24** 的路由项。 + +``` +[root@beta ~]# ip route show +default via 192.168.122.1 dev eth0 proto static metric 100 +10.10.10.0/24 dev eth1 proto kernel scope link src 10.10.10.1 +10.12.13.0/24 via 192.168.122.100 dev eth0 proto zebra metric 20 +192.168.122.0/24 dev eth0 proto kernel scope link src 192.168.122.50 metric 100 +``` + +### 结论 + +如你所见,环境和配置相对简单。要增加复杂性,你可以向路由器添加更多网络接口,以为更多网络提供路由。你也可以使用相同的方法来实现 BGP 和 RIP 协议。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/4/quagga-linux + +作者:[M Umer][a] +选题:[lujun9972][b] +译者:[messon007](https://github.com/messon007) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/noisybotnet +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/code_computer_laptop_hack_work.png?itok=aSpcWkcl (Coding on a computer) +[2]: https://www.quagga.net/ +[3]: https://en.wikipedia.org/wiki/Quagga_(software) +[4]: https://www.gnu.org/software/zebra/ +[5]: https://en.wikipedia.org/wiki/Abstraction_layer +[6]: https://opensource.com/sites/default/files/uploads/quagga_arch.png (Quagga architecture) diff --git a/published/202005/20200417 How to compress files on Linux 5 ways.md b/published/202005/20200417 How to compress files on Linux 5 ways.md new file mode 100644 index 0000000000..5ba0c7feeb --- /dev/null +++ b/published/202005/20200417 How to compress files on Linux 5 ways.md @@ -0,0 +1,203 @@ +[#]: collector: (lujun9972) +[#]: translator: (robsean) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12190-1.html) +[#]: subject: (How to compress files on Linux 5 ways) +[#]: via: (https://www.networkworld.com/article/3538471/how-to-compress-files-on-linux-5-ways.html) +[#]: author: (Sandra Henry-Stocker https://www.networkworld.com/author/Sandra-Henry_Stocker/) + +在 Linux 上压缩文件的 5 种方法 +====== + +> 在 Linux 系统上有很多可以用于压缩文件的工具,但它们的表现并不都是一样的,也不是所有的压缩效果都是一样的。在这篇文章中,我们比较其中的五个工具。 + +![](https://img.linux.net.cn/data/attachment/album/202005/06/231536tgxma941yb8dgl53.jpg) + +在 Linux 上有不少用于压缩文件的命令。最新最有效的一个方法是 `xz`,但是所有的方法都有节省磁盘空间和维护备份文件供以后使用的优点。在这篇文章中,我们将比较这些压缩命令并指出显著的不同。 + +### tar + +`tar` 命令不是专门的压缩命令。它通常用于将多个文件拉入一个单个的文件中,以便容易地传输到另一个系统,或者将文件作为一个相关的组进行备份。它也提供压缩的功能,这就很有意义了,附加一个 `z` 压缩选项能够实现压缩文件。 + +当使用 `z` 选项为 `tar` 命令附加压缩过程时,`tar` 使用 `gzip` 来进行压缩。 + +就像压缩一组文件一样,你可以使用 `tar` 来压缩单个文件,尽管这种操作与直接使用 `gzip` 相比没有特别的优势。要使用 `tar` 这样做,只需要使用 `tar cfz newtarfile filename` 命令来标识要压缩的文件,就像标识一组文件一样,像这样: + +``` +$ tar cfz bigfile.tgz bigfile + ^ ^ + | | + +- 新的文件 +- 将被压缩的文件 + +$ ls -l bigfile* +-rw-rw-r-- 1 shs shs 103270400 Apr 16 16:09 bigfile +-rw-rw-r-- 1 shs shs 21608325 Apr 16 16:08 bigfile.tgz +``` + +注意,文件的大小显著减少了。 + +如果你愿意,你可以使用 `tar.gz` 扩展名,这可能会使文件的特征更加明显,但是大多数的 Linux 用户将很可能会意识到与 `tgz` 的意思是一样的 – `tar` 和 `gz` 的组合来显示文件是一个压缩的 tar 文件。在压缩完成后,你将同时得到原始文件和压缩文件。 + +要将很多文件收集在一起并在一个命令中压缩出 “tar ball”,使用相同的语法,但要指定要包含的文件为一组,而不是单个文件。这里有一个示例: + +``` +$ tar cfz bin.tgz bin/* + ^ ^ + | +-- 将被包含的文件 + + 新的文件 +``` + +### zip + +`zip` 命令创建一个压缩文件,与此同时保留原始文件的完整性。语法像使用 `tar` 一样简单,只是你必需记住,你的原始文件名称应该是命令行上的最后一个参数。 + +``` +$ zip ./bigfile.zip bigfile +updating: bigfile (deflated 79%) +$ ls -l bigfile bigfile.zip +-rw-rw-r-- 1 shs shs 103270400 Apr 16 11:18 bigfile +-rw-rw-r-- 1 shs shs 21606889 Apr 16 11:19 bigfile.zip +``` + +### gzip + +`gzip` 命令非常容易使用。你只需要键入 `gzip`,紧随其后的是你想要压缩的文件名称。不像上述描述的命令,`gzip` 将“就地”“加密”文件。换句话说,原始文件将被“加密”文件替换。 + +``` +$ gzip bigfile +$ ls -l bigfile* +-rw-rw-r-- 1 shs shs 21606751 Apr 15 17:57 bigfile.gz +``` + +### bzip2 + +像使用 `gzip` 命令一样,`bzip2` 将在你选择的文件“就地”压缩,不留下原始文件。 + +``` +$ bzip bigfile +$ ls -l bigfile* +-rw-rw-r-- 1 shs shs 18115234 Apr 15 17:57 bigfile.bz2 +``` + +### xz + +`xz` 是压缩命令团队中的一个相对较新的成员,在压缩文件的能力方面,它是一个领跑者。像先前的两个命令一样,你只需要将文件名称提供给命令。再强调一次,原始文件被就地压缩。 + +``` +$ xz bigfile +$ ls -l bigfile* +-rw-rw-r-- 1 shs shs 13427236 Apr 15 17:30 bigfile.xz +``` + +对于大文件来说,你可能会注意到 `xz` 将比其它的压缩命令花费更多的运行时间,但是压缩的结果却是非常令人赞叹的。 + +### 对比 + +大多数人都听说过“大小不是一切”。所以,让我们比较一下文件大小以及一些当你计划如何压缩文件时的问题。 + +下面显示的统计数据都与压缩单个文件相关,在上面显示的示例中使用 `bigfile`。这个文件是一个大的且相当随机的文本文件。压缩率在一定程度上取决于文件的内容。 + +#### 大小减缩率 + +当比较时,上面显示的各种压缩命产生下面的结果。百分比表示压缩文件与原始文件的比较效果。 + +``` +-rw-rw-r-- 1 shs shs 103270400 Apr 16 14:01 bigfile +------------------------------------------------------ +-rw-rw-r-- 1 shs shs 18115234 Apr 16 13:59 bigfile.bz2 ~17% +-rw-rw-r-- 1 shs shs 21606751 Apr 16 14:00 bigfile.gz ~21% +-rw-rw-r-- 1 shs shs 21608322 Apr 16 13:59 bigfile.tgz ~21% +-rw-rw-r-- 1 shs shs 13427236 Apr 16 14:00 bigfile.xz ~13% +-rw-rw-r-- 1 shs shs 21606889 Apr 16 13:59 bigfile.zip ~21% +``` + +`xz` 命令获胜,最终只有压缩文件 13% 的大小,但是所有这些压缩命令都相当显著地减少原始文件的大小。 + +#### 是否替换原始文件 + +`bzip2`、`gzip` 和 `xz` 命令都用压缩文件替换原始文件。`tar` 和 `zip` 命令不替换。 + +#### 运行时间 + +`xz` 命令似乎比其它命令需要花费更多的时间来“加密”文件。对于 `bigfile` 来说,大概的时间是: + +``` +命令 运行时间 +tar 4.9 秒 +zip 5.2 秒 +bzip2 22.8 秒 +gzip 4.8 秒 +xz 50.4 秒 +``` + +解压缩文件很可能比压缩时间要短得多。 + +#### 文件权限 + +不管你对压缩文件设置什么权限,压缩文件的权限将基于你的 `umask` 设置,但 `bzip2` 除外,它保留了原始文件的权限。 + +#### 与 Windows 的兼容性 + +`zip` 命令创建的文件可以在 Windows 系统以及 Linux 和其他 Unix 系统上使用(即解压),而无需安装其他工具,无论这些工具可能是可用还是不可用的。 + +### 解压缩文件 + +解压文件的命令与压缩文件的命令类似。在我们运行上述压缩命令后,这些命令用于解压缩 `bigfile`: + + * tar: `tar xf bigfile.tgz` + * zip: `unzip bigfile.zip` + * gzip: `gunzip bigfile.gz` + * bzip2: `bunzip2 bigfile.gz2` + * xz: `xz -d bigfile.xz` 或 `unxz bigfile.xz` + +### 自己运行压缩对比 + +如果你想自己运行一些测试,抓取一个大的且可以替换的文件,并使用上面显示的每个命令来压缩它 —— 最好使用一个新的子目录。你可能需要先安装 `xz`,如果你想在测试中包含它的话。这个脚本可能更容易地进行压缩,但是可能需要花费几分钟完成。 + +``` +#!/bin/bash + +# 询问用户文件名称 +echo -n "filename> " +read filename + +# 你需要这个,因为一些命令将替换原始文件 +cp $filename $filename-2 + +# 先清理(以免先前的结果仍然可用) +rm $filename.* + +tar cvfz ./$filename.tgz $filename > /dev/null +zip $filename.zip $filename > /dev/null +bzip2 $filename +# 恢复原始文件 +cp $filename-2 $filename +gzip $filename +# 恢复原始文件 +cp $filename-2 $filename +xz $filename + +# 显示结果 +ls -l $filename.* + +# 替换原始文件 +mv $filename-2 $filename +``` + +-------------------------------------------------------------------------------- + +via: https://www.networkworld.com/article/3538471/how-to-compress-files-on-linux-5-ways.html + +作者:[Sandra Henry-Stocker][a] +选题:[lujun9972][b] +译者:[robsean](https://github.com/robsean) +校对:[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.networkworld.com/blog/itaas-and-the-corporate-storage-technology/?utm_source=IDG&utm_medium=promotions&utm_campaign=HPE22140&utm_content=sidebar (ITAAS and Corporate Storage Strategy) +[2]: https://www.facebook.com/NetworkWorld/ +[3]: https://www.linkedin.com/company/network-world diff --git a/published/202005/20200420 4 Git scripts I can-t live without.md b/published/202005/20200420 4 Git scripts I can-t live without.md new file mode 100644 index 0000000000..43102c69e6 --- /dev/null +++ b/published/202005/20200420 4 Git scripts I can-t live without.md @@ -0,0 +1,192 @@ +[#]: collector: (lujun9972) +[#]: translator: (wxy) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12180-1.html) +[#]: subject: (4 Git scripts I can't live without) +[#]: via: (https://opensource.com/article/20/4/git-extras) +[#]: author: (Vince Power https://opensource.com/users/vincepower) + +4 个不可或缺的 Git 脚本 +====== + +> Git Extras 版本库包含了 60 多个脚本,它们是 Git 基本功能的补充。以下是如何安装、使用和贡献的方法。 + +![](https://img.linux.net.cn/data/attachment/album/202005/03/211446dshwbzoh235b3gre.jpg) + +2005 年,[Linus Torvalds][2] 创建了 [Git][3],以取代他之前用于维护 Linux 内核的分布式源码控制管理的专有解决方案。从那时起,Git 已经成为开源和云原生开发团队的主流版本控制解决方案。 + +但即使是像 Git 这样功能丰富的应用程序,也没有人们想要或需要的每个功能,所以会有人花大力气去创建这些缺少的功能。就 Git 而言,这个人就是 [TJ Holowaychuk][4]。他的 [Git Extras][5] 项目承载了 60 多个“附加功能”,这些功能扩展了 Git 的基本功能。 + +### 使用 Git 附加功能 + +下面介绍一下如何使用四种最受欢迎的 Git 附加功能。 + +#### git-ignore + +`git ignore` 是一个方便的附加功能,它可以让你手动添加文件类型和注释到 `.git-ignore` 文件中,而不需要打开文本编辑器。它可以操作你的个人用户帐户的全局忽略文件和单独用于你正在工作的版本库中的忽略文件。 + +在不提供参数的情况下执行 `git ignore` 会先列出全局忽略文件,然后是本地的忽略文件。 + +``` +$ git ignore +Global gitignore: /home/alice/.gitignore +# Numerous always-ignore extensions +*.diff +*.err +*.orig +*.rej +*.swo +*.swp +*.vi +*~ +*.sass-cache + +# OS or Editor folders +Thumbs.db +--------------------------------- +Local gitignore: .gitignore +nbproject +``` + +#### git-info + +`git info` 可以检索你所需要的所有信息,以获取你正在使用的版本库的上下文信息。它包括远程 URL、远程分支、本地分支、配置信息和最后一次的提交信息。 + +``` +$ git info + +## Remote URLs: + +origin git@github.com:sampleAuthor/git-extras.git (fetch) +origin git@github.com:sampleAuthor/git-extras.git (push) + +## Remote Branches: + +origin/HEAD -> origin/master +origin/myBranch + +## Local Branches: + +myBranch +* master + +## Most Recent Commit: + +commit e3952df2c172c6f3eb533d8d0b1a6c77250769a7 +Author: Sample Author + +Added git-info command. + +Type ´git log´ for more commits, or ´git show ´ for full commit details. + +## Configuration (.git/config): + +color.diff=auto +color.status=auto +color.branch=auto +user.name=Sample Author +user.email=sampleAuthor@gmail.com +core.repositoryformatversion=0 +core.filemode=true +core.bare=false +core.logallrefupdates=true +core.ignorecase=true +remote.origin.fetch=+refs/heads/*:refs/remotes/origin/* +remote.origin.url=git@github.com:mub/git-extras.git +branch.master.remote=origin +branch.master.merge=refs/heads/master +``` + +#### git-mr 和 git-pr + +这些附加功能的作用类似,工作方式也基本相同。 + +* `git mr` 检出来自 GitLab 的合并请求。 +* `git pr` 检出来自 GitHub 的拉取请求。 + +无论是哪种情况,你只需要合并请求号/拉取请求号或完整的 URL,它就会抓取远程引用,检出分支,并调整配置,这样 Git 就知道要替换哪个分支了。 + +``` +$ git mr 51 +From gitlab.com:owner/repository + * [new ref] refs/merge-requests/51/head -> mr/51 +Switched to branch 'mr/51' +``` + +#### git-release + +通过将 `commit`、`tag` 和 `push` 合并到一个命令中,`git release` 可以节省大量的按键来执行这三个命令,而这三个命令往往是依次运行的。 + +要用特定的 `` 和自定义消息提交: + +``` +$ git release 0.1.0 -m <+ powerful feature added> +``` + +#### 其他附加功能 + +这只是该版本库中 60 多个 Git 附加功能中的四个命令。要访问 Git Extras 中的全部命令,请查看该源代码库中的 [Commands.md][8] 文件,或者在安装 Git Extras 后运行以下命令。 + +``` +$ git extras --help +``` + +### 安装 Git 附加功能 + +使用 Git 附加功能的主要前提是安装了 Git 的命令行版本。如果你打算从源码中构建,还需要有额外的工具(例如:`make`)。 + +如果你使用的是最新版本的 macOS,那么 Git 附加功能的安装最好使用 [Homebrew][9](和大多数开源工具一样)。 + +``` +$ brew install git-extras +``` + +在 Linux 上,每个平台原生的包管理器中都包含有 Git Extras。有时,你需要启用额外的仓库,比如在 CentOS 上的 [EPEL][10],然后运行一条命令。 + +``` +$ sudo yum install git-extras +``` + +其他 Linux 发行版、BSD 和其他平台的完整安装说明可以在该版本库的 [Installation.md][11] 文件中找到。 + +### 贡献 + +你是否认为 Git 中有缺少的功能,并且已经构建了一个脚本来处理它?为什么不把它作为 Git Extras 发布版的一部分,与全世界分享呢? + +要做到这一点,请将该功能贡献到 Git Extras 仓库中。更多具体细节请参见仓库中的 [CONTRIBUTING.md][12] 文件,但基本的操作方法很简单: + +1. 创建一个处理该功能的 Bash 脚本。 +2. 创建一个基本的 man 文件,让大家知道如何使用它。 +3. 更新命令列表和补完脚本,让人们知道这个功能的存在。 +4. 运行完整性检查,确保你没有破坏任何东西。 +5. 为你的功能创建一个拉取请求。 + +向 Git Extras 贡献贡献,会让你的 Git 用户的生活更轻松一些。你可以在项目的 [README][13] 中了解更多。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/4/git-extras + +作者:[Vince Power][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/vincepower +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/laptop_screen_desk_work_chat_text.png?itok=UXqIDRDD (Person using a laptop) +[2]: https://en.wikipedia.org/wiki/Linus_Torvalds +[3]: https://git-scm.com/ +[4]: https://github.com/tj +[5]: https://github.com/tj/git-extras +[6]: mailto:git@github.com +[7]: mailto:sampleAuthor@gmail.com +[8]: https://github.com/tj/git-extras/blob/master/Commands.md +[9]: https://brew.sh/ +[10]: https://fedoraproject.org/wiki/EPEL +[11]: https://github.com/tj/git-extras/blob/master/Installation.md +[12]: https://github.com/tj/git-extras/blob/master/CONTRIBUTING.md +[13]: https://github.com/tj/git-extras/blob/master/Readme.md diff --git a/published/202005/20200421 Using Python to visualize COVID-19 projections.md b/published/202005/20200421 Using Python to visualize COVID-19 projections.md new file mode 100644 index 0000000000..aaf5fc72d0 --- /dev/null +++ b/published/202005/20200421 Using Python to visualize COVID-19 projections.md @@ -0,0 +1,238 @@ +[#]: collector: (lujun9972) +[#]: translator: (wxy) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12172-1.html) +[#]: subject: (Using Python to visualize COVID-19 projections) +[#]: via: (https://opensource.com/article/20/4/python-data-covid-19) +[#]: author: (AnuragGupta https://opensource.com/users/999anuraggupta) + +使用 Python 来可视化 COVID-19 预测 +====== + +> 我将演示如何利用提供的全球病毒传播的开放数据,使用开源库来创建两个可视效果。 + +![](https://img.linux.net.cn/data/attachment/album/202005/01/193624a2p2osojyf0yg4go.jpg) + +使用 [Python][2] 和一些图形库,你可以预测 COVID-19 确诊病例总数,也可以显示一个国家(本文以印度为例)在给定日期的死亡总数。人们有时需要帮助解释和处理数据的意义,所以本文还演示了如何为五个国家创建一个动画横条形图,以显示按日期显示病例的变化。 + +### 印度的确诊病例和死亡人数预测 + +这要分三步来完成。 + +#### 1、下载数据 + +科学数据并不总是开放的,但幸运的是,许多现代科学和医疗机构都乐于相互之间及与公众共享信息。关于 COVID-19 病例的数据可以在网上查到,并且经常更新。 + +要解析这些数据,首先必须先下载。 。 + +直接将数据加载到 Pandas `DataFrame` 中。Pandas 提供了一个函数 `read_csv()`,它可以获取一个 URL 并返回一个 `DataFrame` 对象,如下所示。 + +``` +import pycountry +import plotly.express as px +import pandas as pd +URL_DATASET = r'https://raw.githubusercontent.com/datasets/covid-19/master/data/countries-aggregated.csv' +df1 = pd.read_csv(URL_DATASET) +print(df1.head(3)) # 获取数据帧中的前 3 项 +print(df1.tail(3)) # 获取数据帧中的后 3 项 +``` + +数据集的顶行包含列名。 + +1. `Date` +2. `Country` +3. `Confirmed` +4. `Recovered` +5. `Deaths` + +`head` 查询的输出包括一个唯一的标识符(不作为列列出)和每个列的条目。 + +``` +0 2020-01-22 Afghanistan 0 0 0 +1 2020-01-22 Albania 0 0 0 +1 2020-01-22 Algeria 0 0 0 +``` + +`tail` 查询的输出类似,但包含数据集的尾端。 + +``` +12597 2020-03-31 West Bank and Gaza 119 18 1 +12598 2020-03-31 Zambia 35 0 0 +12599 2020-03-31 Zimbabwe 8 0 1 +``` + +从输出中,可以看到 DataFrame(`df1`)有以下几个列: + +1. 日期 +2. 国家 +3. 确诊 +4. 康复 +5. 死亡 + +此外,你可以看到 `Date` 栏中的条目从 1 月 22 日开始到 3 月 31 日。这个数据库每天都会更新,所以你会有当前的值。 + +#### 2、选择印度的数据 + +在这一步中,我们将只选择 DataFrame 中包含印度的那些行。这在下面的脚本中可以看到。 + +``` +#### ----- Step 2 (Select data for India)---- +df_india = df1[df1['Country'] == 'India'] +print(df_india.head(3)) +``` + +#### 3、数据绘图 + +在这里,我们创建一个条形图。我们将把日期放在 X 轴上,把确诊的病例数和死亡人数放在 Y 轴上。这一部分的脚本有以下几个值得注意的地方。 + + * `plt.rcParams["figure.figsize"]=20,20` 这一行代码只适用于 Jupyter。所以如果你使用其他 IDE,请删除它。 + * 注意这行代码:`ax1 = plt.gca()`。为了确保两个图,即确诊病例和死亡病例的图都被绘制在同一个图上,我们需要给第二个图的 `ax` 对象。所以我们使用 `gca()` 来完成这个任务。(顺便说一下,`gca` 代表 “获取当前坐标轴get current axis”) + +完整的脚本如下所示。 + +``` +# Author:- Anurag Gupta # email:- 999.anuraggupta@gmail.com +%matplotlib inline +import matplotlib.pyplot as plt +import pandas as pd + +#### ----- Step 1 (Download data)---- +URL_DATASET = r'https://raw.githubusercontent.com/datasets/covid-19/master/data/countries-aggregated.csv' +df1 = pd.read_csv(URL_DATASET) +# print(df1.head(3)) # Uncomment to see the dataframe + +#### ----- Step 2 (Select data for India)---- +df_india = df1[df1['Country'] == 'India'] +print(df_india.head(3)) + +#### ----- Step 3 (Plot data)---- +# Increase size of plot +plt.rcParams["figure.figsize"]=20,20 # Remove if not on Jupyter +# Plot column 'Confirmed' +df_india.plot(kind = 'bar', x = 'Date', y = 'Confirmed', color = 'blue') + +ax1 = plt.gca() +df_india.plot(kind = 'bar', x = 'Date', y = 'Deaths', color = 'red', ax = ax1) +plt.show() +``` + +整个脚本[可在 GitHub 上找到][4]。 + +### 为五个国家创建一个动画水平条形图 + +关于 Jupyter 的注意事项:要在 Jupyter 中以动态动画的形式运行,而不是静态 png 的形式,你需要在单元格的开头添加一个神奇的命令,即: `%matplotlib notebook`。这将使图形保持动态,而不是显示为静态的 png 文件,因此也可以显示动画。如果你在其他 IDE 上,请删除这一行。 + +#### 1、下载数据 + +这一步和前面的脚本完全一样,所以不需要重复。 + +#### 2、创建一个所有日期的列表 + +如果你检查你下载的数据,你会发现它有一列 `Date`。现在,这一列对每个国家都有一个日期值。因此,同一个日期会出现多次。我们需要创建一个只具有唯一值的日期列表。这会用在我们条形图的 X 轴上。我们有一行代码,如 `list_dates = df[‘Date’].unique()`。`unique()` 方法将只提取每个日期的唯一值。 + +#### 3、挑选五个国家并创建一个 `ax` 对象。 + +做一个五个国家的名单。(你可以选择你喜欢的国家,也可以增加或减少国家的数量。)我也做了一个五个颜色的列表,每个国家的条形图的颜色对应一种。(如果你喜欢的话,也可以改一下。)这里有一行重要的代码是:`fig, ax = plt.subplots(figsize=(15, 8))`。这是创建一个 `ax` 对象所需要的。 + +#### 4、编写回调函数 + +如果你想在 Matplotlib 中做动画,你需要创建一个名为 `matplotlib.animation.FuncAnimation` 的类的对象。这个类的签名可以在网上查到。这个类的构造函数,除了其他参数外,还需要一个叫 `func` 的参数,你必须给这个参数一个回调函数。所以在这一步中,我们会写个回调函数,这个回调函数会被反复调用,以渲染动画。 + +#### 5、创建 `FuncAnimation` 对象 + +这一步在上一步中已经部分说明了。 + +我们创建这个类的对象的代码是: + +``` +my_anim = animation.FuncAnimation(fig = fig, func = plot_bar, + frames = list_dates, blit = True, + interval=20) +``` + +要给出的三个重要参数是: + +* `fig`,必须给出一个 fig 对象,也就是我们之前创建的 fig 对象。 +* `func`,必须是回调函数。 +* `frames`,必须包含要做动画的变量。在我们这里,它是我们之前创建的日期列表。 + +#### 6、将动画保存为 mp4 文件 + +你可以将创建的动画保存为 mp4 文件。但是,你需要 `ffmpeg`。你可以用 `pip` 下载:`pip install ffmpeg-python`,或者用 conda(在 Jupyter 上):`install -c conda-forge ffmpeg`。 + +最后,你可以使用 `plt.show()` 运行动画。请注意,在许多平台上,`ffmpeg` 可能无法正常工作,可能需要进一步“调整”。 + +``` +%matplotlib notebook +# Author:- Anurag Gupta # email:- 999.anuraggupta@gmail.com +import pandas as pd +import matplotlib.pyplot as plt +import matplotlib.animation as animation +from time import sleep + +#### ---- Step 1:- Download data +URL_DATASET = r'https://raw.githubusercontent.com/datasets/covid-19/master/data/countries-aggregated.csv' +df = pd.read_csv(URL_DATASET, usecols = ['Date', 'Country', 'Confirmed']) +# print(df.head(3)) # uncomment this to see output + +#### ---- Step 2:- Create list of all dates +list_dates = df['Date'].unique() +# print(list_dates) # Uncomment to see the dates + +#### --- Step 3:- Pick 5 countries. Also create ax object +fig, ax = plt.subplots(figsize=(15, 8)) +# We will animate for these 5 countries only +list_countries = ['India', 'China', 'US', 'Italy', 'Spain'] +# colors for the 5 horizontal bars +list_colors = ['black', 'red', 'green', 'blue', 'yellow'] + +### --- Step 4:- Write the call back function +# plot_bar() is the call back function used in FuncAnimation class object +def plot_bar(some_date): + df2 = df[df['Date'].eq(some_date)] + ax.clear() + # Only take Confirmed column in descending order + df3 = df2.sort_values(by = 'Confirmed', ascending = False) + # Select the top 5 Confirmed countries + df4 = df3[df3['Country'].isin(list_countries)] + # print(df4) # Uncomment to see that dat is only for 5 countries + sleep(0.2) # To slow down the animation + # ax.barh() makes a horizontal bar plot. + return ax.barh(df4['Country'], df4['Confirmed'], color= list_colors) + +###----Step 5:- Create FuncAnimation object--------- +my_anim = animation.FuncAnimation(fig = fig, func = plot_bar, + frames= list_dates, blit=True, + interval=20) + +### --- Step 6:- Save the animation to an mp4 +# Place where to save the mp4. Give your file path instead +path_mp4 = r'C:\Python-articles\population_covid2.mp4' +# my_anim.save(path_mp4, fps=30, extra_args=['-vcodec', 'libx264']) +my_anim.save(filename = path_mp4, writer = 'ffmpeg', + fps=30, + extra_args= ['-vcodec', 'libx264', '-pix_fmt', 'yuv420p']) +plt.show() +``` + +完整的脚本[可以在 GitHub 上找到][5]。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/4/python-data-covid-19 + +作者:[AnuragGupta][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/999anuraggupta +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/colorful_sound_wave.png?itok=jlUJG0bM (Colorful sound wave graph) +[2]: https://opensource.com/resources/python +[3]: mailto:999.anuraggupta@gmail.com +[4]: https://raw.githubusercontent.com/ag999git/jupyter_notebooks/master/corona_bar_india +[5]: https://raw.githubusercontent.com/ag999git/jupyter_notebooks/master/corona_bar_animated diff --git a/published/202005/20200423 Difference Between YUM and RPM Package Manager.md b/published/202005/20200423 Difference Between YUM and RPM Package Manager.md new file mode 100644 index 0000000000..bf916108e1 --- /dev/null +++ b/published/202005/20200423 Difference Between YUM and RPM Package Manager.md @@ -0,0 +1,91 @@ +[#]: collector: (lujun9972) +[#]: translator: (wxy) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12170-1.html) +[#]: subject: (Difference Between YUM and RPM Package Manager) +[#]: via: (https://www.2daygeek.com/comparison-difference-between-yum-vs-rpm/) +[#]: author: (Magesh Maruthamuthu https://www.2daygeek.com/author/magesh/) + +YUM 和 RPM 包管理器的不同之处 +====== + +![](https://img.linux.net.cn/data/attachment/album/202004/30/215525o4e88nen85d8dzd7.jpg) + +软件包管理器在 Linux 系统中扮演着重要的角色。它允许你安装、更新、查看、搜索和删除软件包,以满足你的需求。 + +每个发行版都有自己的一套包管理器,依据你的 Linux 发行版来分别使用它们。 + +RPM 是最古老的传统软件包管理器之一,它是为基于 Red Hat 的系统设计的,如 Red Hat Enterprise Linux(RHEL)、CentOS、Fedora 和 openSUSE(它基于 suse Enterprise Linux)等系统。但在依赖解析和包更新(全系统更新/升级)方面,RPM 包管理器有一个突出的限制。 + +> 如果你想知道 [YUM 和 DNF 包管理器的区别][1]请参考该文章。 + +这意味着 `yum` 可以自动下载并安装所有需要的依赖项,但 `rpm` 会告诉你安装一个依赖项列表,然后你必须手动安装。 + +当你想用 [rpm 命令][2] 安装一组包时,这实际上是不可能的,而且很费时间。 + +这时,[YUM 包管理器][3] 就派上了用场,解决了这两个问题。 + +### 什么是 RPM? + +RPM 指的是 RPM Package Manager(原名 Red Hat Package Manager),是一个功能强大的命令行包管理工具,是为 Red Hat 操作系统开发的。 + +它现在被用作许多 Linux 发行版的核心组件,如 Centos、Fedora、Oracle Linux、openSUSE 和 Mageia 等。 + +RPM 软件包管理器允许你在基于 RPM 的 Linux 系统上安装、升级、删除、查询和验证软件包。 + +RPM 文件的扩展名为 `.rpm`。RPM 包由一个存档文件组成,其中包含了一个特定包的库和依赖关系,这些库和依赖关系与系统上安装的其他包不冲突。 + +在 Linux 上有很多前端工具可以用来安装 RPM 包,与 RPM 工具相比,这些工具可以使安装过程更加高效,尤其是在处理依赖关系方面。 + +如果你想了解更多关于 Linux 发行版的前端包管理器的信息,请到下面的链接。 + +* [Linux 命令行包管理器列表][4] + +如果你想了解 Linux 的 GUI 包管理器,请到下面的链接。 + +* [Linux GUI 包管理器列表][5] + +### 什么是 YUM? + +Yum 是一个 Linux 操作系统上的自由开源的命令行包管理程序,它使用 RPM 包管理器。Yum 是一个 RPM 的前端工具,可以自动解决软件包的依赖关系。它可以从发行版官方仓库和其他第三方仓库中安装 RPM 软件包。 + +Yum 允许你在系统中安装、更新、搜索和删除软件包。如果你想让你的系统保持更新,你可以通过 yum-cron 启用自动更新。 + +此外,如果你需要的话,它还允许你在 `yum update` 中排除一个或多个软件包。 + +Yum 是默认安装的,你不需要安装它。 + +编号 | RPM | YUM +--- | --- | --- +1 | 红帽在 1997 年引入了 RPM | Yellowdog UPdater(YUP)开发于 1999-2001 年,YUM 于 2003 年取代了原来的 YUP 工具 +2 | RPM 代表 RPM Package manager(原名 Red Hat package manager) | YUM 代表 Yellowdog Updater Modified +3 | RPM 文件的命名规则如下,`httpd-2.4.6-92.el7.x86_64.rpm`:`httpd` - 实际的包名;`2.4.6` - 包发布版本号;`92` - 包发布子版本号;`el7` - Red Hat 版本;`x86_64` - 硬件架构;`rpm` - 文件扩展名 | 后台使用 rpm 数据库 +4 | 不解析依赖关系,你必须手动安装依赖 | 可以自动解析依赖关系并同时安装它们(任何包都会和它的依赖关系一起安装) +5 | 允许你同时安装多个版本的软件包 | 不允许,并显示该软件包已经安装 +6 | 当使用 RPM 命令安装一个软件包时,你必须提供 `.rpm` 软件包的确切位置 | 你可以安装仓库中的任何软件包,而你只需要知道软件包的名称就可以了 +7 | RPM 不依赖于 YUM | 它是一个前端工具,在后台使用 RPM 包管理器来管理包 +8 | RPM 在安装包的管理方面比较难 | YUM 是最简单的管理 RPM 包的方法 +9 | RPM 不能让你将整个系统升级到最新的版本 | YUM 可以让你将系统升级到最新的版本(例如 7.0 到 7.x 的小版本升级) +10 | RPM 不能让你自动更新/升级安装在系统上的软件包 | YUM 可以让你自动更新/升级系统上的更新 +11 | 不使用在线仓库来执行任何操作 | 完全依赖在线仓库来完成所有的工作 +12 | RPM 是一种包格式,它也是一个底层的包管理器,只做基本的事情 | 这是一个上层的包管理器前端,它可以完成你所需要的一切工作 + +-------------------------------------------------------------------------------- + +via: https://www.2daygeek.com/comparison-difference-between-yum-vs-rpm/ + +作者:[Magesh Maruthamuthu][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.2daygeek.com/author/magesh/ +[b]: https://github.com/lujun9972 +[1]: https://linux.cn/article-12161-1.html +[2]: https://www.2daygeek.com/linux-rpm-command-examples-manage-packages-fedora-centos-rhel-systems/ +[3]: https://www.2daygeek.com/linux-yum-command-examples-manage-packages-rhel-centos-systems/ +[4]: https://www.2daygeek.com/list-of-command-line-package-manager-for-linux/ +[5]: https://www.2daygeek.com/list-of-graphical-frontend-tool-for-linux-package-manager/ diff --git a/published/202005/20200424 16 Things to do After Installing Ubuntu 20.04.md b/published/202005/20200424 16 Things to do After Installing Ubuntu 20.04.md new file mode 100644 index 0000000000..ded221ab6c --- /dev/null +++ b/published/202005/20200424 16 Things to do After Installing Ubuntu 20.04.md @@ -0,0 +1,283 @@ +[#]: collector: (lujun9972) +[#]: translator: (qfzy1233) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12183-1.html) +[#]: subject: (16 Things to do After Installing Ubuntu 20.04) +[#]: via: (https://itsfoss.com/things-to-do-after-installing-ubuntu-20-04/) +[#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/) + +安装完 Ubuntu 20.04 后要做的 16 件事 +====== + +> 以下是安装 Ubuntu 20.04 之后需要做的一些调整和事项,它将使你获得更流畅、更好的桌面 Linux 体验。 + +[Ubuntu 20.04 LTS(长期支持版)带来了许多新的特性][1]和观感上的变化。如果你要安装 Ubuntu 20.04,让我向你展示一些推荐步骤便于你的使用。 + +### 安装完 Ubuntu 20.04 LTS “Focal Fossa” 后要做的 16 件事 + +![][2] + +我在这里提到的步骤仅是我的建议。如果一些定制或调整不适合你的需要和兴趣,你可以忽略它们。 + +同样的,有些步骤看起来很简单,但是对于一个 Ubuntu 新手来说是必要的。 + +这里的一些建议适用于启用 GNOME 作为默认桌面 Ubuntu 20.04,所以请检查 [Ubuntu 版本][3]和[桌面环境][4]。 + +以下列表便是安装了代号为 Focal Fossa 的 Ubuntu 20.04 LTS 之后要做的事。 + +#### 1、通过更新和启用额外的软件仓库来准备你的系统 + +安装 Ubuntu 或任何其他 Linux 发行版之后,你应该做的第一件事就是更新它。Linux 的运作是建立在本地的可用软件包数据库上,而这个缓存需要同步以便你能够安装软件。 + +升级 Ubuntu 非常简单。你可以运行软件更新从菜单(按 `Super` 键并搜索 “software updater”): + +![Ubuntu 20.04 的软件升级器][5] + +你也可以在终端使用以下命令更新你的系统: + +``` +sudo apt update && sudo apt upgrade +``` + +接下来,你应该确保启用了 [universe(宇宙)和 multiverse(多元宇宙)软件仓库][6]。使用这些软件仓库,你可以访问更多的软件。我还推荐阅读关于 [Ubuntu 软件仓库][6]的文章,以了解它背后的基本概念。 + +在菜单中搜索 “Software & Updates”: + +![软件及更新设置项][7] + +请务必选中软件仓库前面的勾选框: + +![启用额外的软件仓库][8] + +#### 2、安装媒体解码器来播放 MP3、MPEG4 和其他格式媒体文件 + +如果你想播放媒体文件,如 MP3、MPEG4、AVI 等,你需要安装媒体解码器。由于各个国家的版权问题, Ubuntu 在默认情况下不会安装它。 + +作为个人,你可以[使用 Ubuntu Restricted Extra 安装包][9]很轻松地安装这些媒体编解码器。这将[在你的 Ubuntu 系统安装][10]媒体编解码器、Adobe Flash 播放器和微软 True Type 字体等。 + +你可以通过[点击这个链接][11]来安装它(它会要求在软件中心打开它),或者使用以下命令: + +``` +sudo apt install ubuntu-restricted-extras +``` + +如果遇到 EULA 或许可证界面,请记住使用 `tab` 键在选项之间进行选择,然后按回车键确认你的选择。 + +![按 tab 键选择 OK 并按回车键][12] + +#### 3、从软件中心或网络上安装软件 + +现在已经设置好了软件仓库并更新了软件包缓存,应该开始安装所需的软件了。 + +在 Ubuntu 中安装应用程序有几种方法,最简单和正式的方法是使用软件中心。 + +![Ubuntu 软件中心][14] + +如果你想要一些关于软件的建议,请参考这个[丰富的各种用途的 Ubuntu 应用程序列表][15]。 + +一些软件供应商提供了 .deb 文件来方便地安装他们的应用程序。你可以从他们的网站获得 .deb 文件。例如,要[在 Ubuntu 上安装谷歌 Chrome][16],你可以从它的网站上获得 .deb 文件,双击它开始安装。 + +#### 4、享受 Steam Proton 和 GameModeEnjoy 上的游戏 + +[在 Linux 上进行游戏][17]已经有了长足的发展。你不再受限于自带的少数游戏。你可以[在 Ubuntu 上安装 Steam][18]并享受许多游戏。 + +[Steam 新的 Proton 项目][19]可以让你在 Linux 上玩许多只适用于 Windows 的游戏。除此之外,Ubuntu 20.04 还默认安装了 [Feral Interactive 的 GameMode][20]。 + +GameMode 会自动调整 Linux 系统的性能,使游戏具有比其他后台进程更高的优先级。 + +这意味着一些支持 GameMode 的游戏(如[古墓丽影·崛起][21])在 Ubuntu 上的性能应该有所提高。 + +#### 5、管理自动更新(适用于进阶用户和专家) + +最近,Ubuntu 已经开始自动下载并安装对你的系统至关重要的安全更新。这是一个安全功能,作为一个普通用户,你应该让它保持默认开启。 + +但是,如果你喜欢自己进行配置更新,而这个自动更新经常导致你[“无法锁定管理目录”错误][22],也许你可以改变自动更新行为。 + +你可以选择“立即显示”,这样一有安全更新就会立即通知你,而不是自动安装。 + +![管理自动更新设置][23] + +#### 6、控制电脑的自动挂起和屏幕锁定 + +如果你在笔记本电脑上使用 Ubuntu 20.04,那么你可能需要注意一些电源和屏幕锁定设置。 + +如果你的笔记本电脑处于电池模式,Ubuntu 会在 20 分钟不活动后休眠系统。这样做是为了节省电池电量。就我个人而言,我不喜欢它,因此我禁用了它。 + +类似地,如果你离开系统几分钟,它会自动锁定屏幕。我也不喜欢这种行为,所以我宁愿禁用它。 + +![Ubuntu 20.04 的电源设置][24] + +#### 7、享受夜间模式 + +[Ubuntu 20.04 中最受关注的特性][25]之一是夜间模式。你可以通过进入设置并在外观部分中选择它来启用夜间模式。 + +![开启夜间主题 Ubuntu][26] + +你可能需要做一些[额外的调整来获得完整的 Ubuntu 20.04 夜间模式][27]。 + +#### 8、控制桌面图标和启动程序 + +如果你想要一个最简的桌面,你可以禁用桌面上的图标。你还可以从左侧禁用启动程序,并在顶部面板中禁用软件状态栏。 + +所有这些都可以通过默认的新 GNOME 扩展来控制,该程序默认情况下已经可用。 + +![禁用 Ubuntu 20 04 的 Dock][28] + +顺便说一下,你也可以通过“设置”->“外观”来将启动栏的位置改变到底部或者右边。 + +#### 9、使用表情符和特殊字符,或从搜索中禁用它 + +Ubuntu 提供了一个使用表情符号的简单方法。在默认情况下,有一个专用的应用程序叫做“字符”。它基本上可以为你提供表情符号的 [Unicode][29]。 + +不仅是表情符号,你还可以使用它来获得法语、德语、俄语和拉丁语字符的 unicode。单击符号你可以复制 unicode,当你粘贴该代码时,你所选择的符号便被插入。 + +![Ubuntu 表情符][30] + +你也能在桌面搜索中找到这些特殊的字符和表情符号。也可以从搜索结果中复制它们。 + +![表情符出现在桌面搜索中][31] + +如果你不想在搜索结果中看到它们,你应该禁用搜索功能对它们的访问。下一节将讨论如何做到这一点。 + +#### 10、掌握桌面搜索 + +GNOME 桌面拥有强大的搜索功能,大多数人使用它来搜索已安装的应用程序,但它不仅限于此。 + +按 `Super` 键并搜索一些东西,它将显示与搜索词匹配的任何应用程序,然后是系统设置和软件中心提供的匹配应用程序。 + +![桌面搜索][32] + +不仅如此,搜索还可以找到文件中的文本。如果你正在使用日历,它也可以找到你的会议和提醒。你甚至可以在搜索中进行快速计算并复制其结果。 + +![Ubuntu搜索的快速计算][33] + +你可以进入“设置”中来控制可以搜索的内容和顺序。 + +![][34] + +#### 11、使用夜灯功能,减少夜间眼睛疲劳 + +如果你在晚上使用电脑或智能手机,你应该使用夜灯功能来减少眼睛疲劳。我觉得这很有帮助。 + +夜灯的特点是在屏幕上增加了一种黄色的色调,比白光少了一些挤压感。 + +你可以在“设置”->“显示”切换到夜灯选项卡来开启夜光功能。你可以根据自己的喜好设置“黄度”。 + +![夜灯功能][35] + +#### 12、使用 2K/4K 显示器?使用分辨率缩放得到更大的图标和字体 + +如果你觉得图标、字体、文件夹在你的高分辨率屏幕上看起来都太小了,你可以利用分辨率缩放。 + +启用分辨率缩放可以让你有更多的选项来从 100% 增加到 200%。你可以选择适合自己喜好的缩放尺寸。 + +![在设置->显示中启用高分缩放][36] + +#### 13、探索 GNOME 扩展功能以扩展 GNOME 桌面可用性 + +GNOME 桌面有称为“扩展”的小插件或附加组件。你应该[学会使用 GNOME 扩展][37]来扩展系统的可用性。 + +如下图所示,天气扩展顶部面板中显示了天气信息。不起眼但十分有用。你也可以在这里查看一些[最佳 GNOME 扩展][38]。不需要全部安装,只使用那些对你有用的。 + +![天气扩展][39] + +#### 14、启用“勿扰”模式,专注于工作 + +如果你想专注于工作,禁用桌面通知会很方便。你可以轻松地启用“勿扰”模式,并静音所有通知。 + +![启用“请勿打扰”清除桌面通知][40] + +这些通知仍然会在消息栏中,以便你以后可以阅读它们,但是它们不会在桌面上弹出。 + +#### 15、清理你的系统 + +这是你安装 Ubuntu 后不需要马上做的事情。但是记住它会对你有帮助。 + +随着时间的推移,你的系统将有大量不再需要的包。你可以用这个命令一次性删除它们: + +``` +sudo apt autoremove +``` + +还有其他[清理 Ubuntu 以释放磁盘空间的方法][41],但这是最简单和最安全的。 + +#### 16、根据你的喜好调整和定制 GNOME 桌面 + +我强烈推荐[安装 GNOME 设置工具][42]。这将让你可以通过额外的设置来进行定制。 + +![Gnome 设置工具][43] + +比如,你可以[以百分比形式显示电池容量][44]、[修正在触摸板右键问题][45]、改变 Shell 主题、改变鼠标指针速度、显示日期和星期数、改变应用程序窗口行为等。 + +定制是没有尽头的,我可能仅使用了它的一小部分功能。这就是为什么我推荐[阅读这些][42]关于[自定义 GNOME 桌面][46]的文章。 + +你也可以[在 Ubuntu 中安装新主题][47],不过就我个人而言,我喜欢这个版本的默认主题。这是我第一次在 Ubuntu 发行版中使用默认的图标和主题。 + +#### 安装 Ubuntu 之后你会做什么? + +如果你是 Ubuntu 的初学者,我建议你[阅读这一系列 Ubuntu 教程][48]开始学习。 + +这就是我的建议。安装 Ubuntu 之后你要做什么?分享你最喜欢的东西,我可能根据你的建议来更新这篇文章。 + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/things-to-do-after-installing-ubuntu-20-04/ + +作者:[Abhishek Prakash][a] +选题:[lujun9972][b] +译者:[qfzy1233](https://github.com/qfzy1233) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://itsfoss.com/author/abhishek/ +[b]: https://github.com/lujun9972 +[1]: https://linux.cn/article-12146-1.html +[2]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/04/things-to-do-after-installing-ubuntu-20-04.jpg?ssl=1 +[3]: https://linux.cn/article-9872-1.html +[4]: https://linux.cn/article-12124-1.html +[5]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/04/software-updater-ubuntu-20-04.jpg?ssl=1 +[6]: https://itsfoss.com/ubuntu-repositories/ +[7]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/04/software-updates-settings-ubuntu-20-04.jpg?ssl=1 +[8]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/04/extra-repositories-ubuntu-20.jpg?ssl=1 +[9]: https://linux.cn/article-11906-1.html +[10]: https://linux.cn/article-12074-1.html +[11]: //ubuntu-restricted-extras/ +[12]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/02/installing_ubuntu_restricted_extras.jpg?ssl=1 +[13]: https://itsfoss.com/remove-install-software-ubuntu/ +[14]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/04/software-center-ubuntu-20.png?resize=800%2C509&ssl=1 +[15]: https://itsfoss.com/best-ubuntu-apps/ +[16]: https://itsfoss.com/install-chrome-ubuntu/ +[17]: https://linux.cn/article-7316-1.html +[18]: https://itsfoss.com/install-steam-ubuntu-linux/ +[19]: https://linux.cn/article-10054-1.html +[20]: https://github.com/FeralInteractive/gamemode +[21]: https://en.wikipedia.org/wiki/Rise_of_the_Tomb_Raider +[22]: https://itsfoss.com/could-not-get-lock-error/ +[23]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/04/auto-updates-ubuntu.png?resize=800%2C361&ssl=1 +[24]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/04/power-settings-ubuntu-20-04.png?fit=800%2C591&ssl=1 +[25]: https://www.youtube.com/watch?v=lpq8pm_xkSE +[26]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/04/enable-dark-theme-ubuntu.png?ssl=1 +[27]: https://linux.cn/article-12098-1.html +[28]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/04/disable-dock-ubuntu-20-04.png?ssl=1 +[29]: https://en.wikipedia.org/wiki/List_of_Unicode_characters +[30]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/04/emoji-ubuntu.jpg?ssl=1 +[31]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/04/emojis-desktop-search-ubuntu.jpg?ssl=1 +[32]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/04/ubuntu-desktop-search-1.jpg?ssl=1 +[33]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/04/quick-calculations-ubuntu-search.jpg?ssl=1 +[34]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/04/search-settings-control-ubuntu.png?resize=800%2C534&ssl=1 +[35]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/04/nightlight-ubuntu-20-04.png?ssl=1 +[36]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/04/fractional-scaling-ubuntu.jpg?ssl=1 +[37]: https://itsfoss.com/gnome-shell-extensions/ +[38]: https://itsfoss.com/best-gnome-extensions/ +[39]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/04/weather-extension-ubuntu.jpg?ssl=1 +[40]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/03/do-not-distrub-option-ubuntu-20-04.png?ssl=1 +[41]: https://itsfoss.com/free-up-space-ubuntu-linux/ +[42]: https://itsfoss.com/gnome-tweak-tool/ +[43]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/04/gnome-tweaks-tool-ubuntu-20-04.png?fit=800%2C551&ssl=1 +[44]: https://itsfoss.com/display-battery-ubuntu/ +[45]: https://itsfoss.com/fix-right-click-touchpad-ubuntu/ +[46]: https://itsfoss.com/gnome-tricks-ubuntu/ +[47]: https://itsfoss.com/install-themes-ubuntu/ +[48]: https://itsfoss.com/getting-started-with-ubuntu/ diff --git a/published/202005/20200425 Inlining optimisations in Go.md b/published/202005/20200425 Inlining optimisations in Go.md new file mode 100644 index 0000000000..12f1cb67b7 --- /dev/null +++ b/published/202005/20200425 Inlining optimisations in Go.md @@ -0,0 +1,213 @@ +[#]: collector: (lujun9972) +[#]: translator: (lxbwolf) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12176-1.html) +[#]: subject: (Inlining optimisations in Go) +[#]: via: (https://dave.cheney.net/2020/04/25/inlining-optimisations-in-go) +[#]: author: (Dave Cheney https://dave.cheney.net/author/davecheney) + +Go 中的内联优化 +====== + +> 本文讨论 Go 编译器是如何实现内联的,以及这种优化方法如何影响你的 Go 代码。 + +![](https://img.linux.net.cn/data/attachment/album/202005/02/222202e3v3pppkhnndpbpn.jpg) + +*请注意:*本文重点讨论 *gc*,这是来自 [golang.org](https://github.com/golang/go) 的事实标准的 Go 编译器。讨论到的概念可以广泛适用于其它 Go 编译器,如 gccgo 和 llgo,但它们在实现方式和功效上可能有所差异。 + +### 内联是什么? + +内联inlining就是把简短的函数在调用它的地方展开。在计算机发展历程的早期,这个优化是由程序员手动实现的。现在,内联已经成为编译过程中自动实现的基本优化过程的其中一步。 + +### 为什么内联很重要? + +有两个原因。第一个是它消除了函数调用本身的开销。第二个是它使得编译器能更高效地执行其他的优化策略。 + +#### 函数调用的开销 + +在任何语言中,调用一个函数 [^1] 都会有消耗。把参数编组进寄存器或放入栈中(取决于 ABI),在返回结果时的逆反过程都会有开销。引入一次函数调用会导致程序计数器从指令流的一点跳到另一点,这可能导致管道滞后。函数内部通常有前置处理preamble,需要为函数执行准备新的栈帧,还有与前置相似的后续处理epilogue,需要在返回给调用方之前释放栈帧空间。 + +在 Go 中函数调用会消耗额外的资源来支持栈的动态增长。在进入函数时,goroutine 可用的栈空间与函数需要的空间大小进行比较。如果可用空间不同,前置处理就会跳到运行时runtime的逻辑中,通过把数据复制到一块新的、更大的空间的来增长栈空间。当这个复制完成后,运行时就会跳回到原来的函数入口,再执行栈空间检查,现在通过了检查,函数调用继续执行。这种方式下,goroutine 开始时可以申请很小的栈空间,在有需要时再申请更大的空间。[^2] + +这个检查消耗很小,只有几个指令,而且由于 goroutine 的栈是成几何级数增长的,因此这个检查很少失败。这样,现代处理器的分支预测单元可以通过假定检查肯定会成功来隐藏栈空间检查的消耗。当处理器预测错了栈空间检查,不得不放弃它在推测性执行所做的操作时,与为了增加 goroutine 的栈空间运行时所需的操作消耗的资源相比,管道滞后的代价更小。 + +虽然现代处理器可以用预测性执行技术优化每次函数调用中的泛型和 Go 特定的元素的开销,但那些开销不能被完全消除,因此在每次函数调用执行必要的工作过程中都会有性能消耗。一次函数调用本身的开销是固定的,与更大的函数相比,调用小函数的代价更大,因为在每次调用过程中它们做的有用的工作更少。 + +因此,消除这些开销的方法必须是要消除函数调用本身,Go 的编译器就是这么做的,在某些条件下通过用函数的内容来替换函数调用来实现。这个过程被称为*内联*,因为它在函数调用处把函数体展开了。 + +#### 改进的优化机会 + +Cliff Click 博士把内联描述为现代编译器做的优化措施,像常量传播(LCTT 译注:此处作者笔误,原文为 constant proportion,修正为 constant propagation)和死代码消除一样,都是编译器的基本优化方法。实际上,内联可以让编译器看得更深,使编译器可以观察调用的特定函数的上下文内容,可以看到能继续简化或彻底消除的逻辑。由于可以递归地执行内联,因此不仅可以在每个独立的函数上下文处进行这种优化决策,也可以在整个函数调用链中进行。 + +### 实践中的内联 + +下面这个例子可以演示内联的影响: + +```go +package main + +import "testing" + +//go:noinline +func max(a, b int) int { + if a > b { + return a + } + return b +} + +var Result int + +func BenchmarkMax(b *testing.B) { + var r int + for i := 0; i < b.N; i++ { + r = max(-1, i) + } + Result = r +} +``` + +运行这个基准,会得到如下结果:[^3] + +```bash +% go test -bench=. +BenchmarkMax-4 530687617 2.24 ns/op +``` + +在我的 2015 MacBook Air 上 `max(-1, i)` 的耗时约为 2.24 纳秒。现在去掉 `//go:noinline` 编译指令,再看下结果: + +```bash +% go test -bench=. +BenchmarkMax-4 1000000000 0.514 ns/op +``` + +从 2.24 纳秒降到了 0.51 纳秒,或者从 `benchstat` 的结果可以看出,有 78% 的提升。 + +```bash +% benchstat {old,new}.txt +name old time/op new time/op delta +Max-4 2.21ns ± 1% 0.49ns ± 6% -77.96% (p=0.000 n=18+19) +``` + +这个提升是从哪儿来的呢? + +首先,移除掉函数调用以及与之关联的前置处理 [^4] 是主要因素。把 `max` 函数的函数体在调用处展开,减少了处理器执行的指令数量并且消除了一些分支。 + +现在由于编译器优化了 `BenchmarkMax`,因此它可以看到 `max` 函数的内容,进而可以做更多的提升。当 `max` 被内联后,`BenchmarkMax` 呈现给编译器的样子,看起来是这样的: + +```go +func BenchmarkMax(b *testing.B) { + var r int + for i := 0; i < b.N; i++ { + if -1 > i { + r = -1 + } else { + r = i + } + } + Result = r +} +``` + +再运行一次基准,我们看一下手动内联的版本和编译器内联的版本的表现: + +```bash +% benchstat {old,new}.txt +name old time/op new time/op delta +Max-4 2.21ns ± 1% 0.48ns ± 3% -78.14% (p=0.000 n=18+18) +``` + +现在编译器能看到在 `BenchmarkMax` 里内联 `max` 的结果,可以执行以前不能执行的优化措施。例如,编译器注意到 `i` 初始值为 `0`,仅做自增操作,因此所有与 `i` 的比较都可以假定 `i` 不是负值。这样条件表达式 `-1 > i` 永远不是 `true`。[^5] + +证明了 `-1 > i` 永远不为 true 后,编译器可以把代码简化为: + +```go +func BenchmarkMax(b *testing.B) { + var r int + for i := 0; i < b.N; i++ { + if false { + r = -1 + } else { + r = i + } + } + Result = r +} +``` + +并且因为分支里是个常量,编译器可以通过下面的方式移除不会走到的分支: + +```go +func BenchmarkMax(b *testing.B) { + var r int + for i := 0; i < b.N; i++ { + r = i + } + Result = r +} +``` + +这样,通过内联和由内联解锁的优化过程,编译器把表达式 `r = max(-1, i))` 简化为 `r = i`。 + +### 内联的限制 + +本文中我论述的内联称作叶子内联leaf inlining:把函数调用栈中最底层的函数在调用它的函数处展开的行为。内联是个递归的过程,当把函数内联到调用它的函数 A 处后,编译器会把内联后的结果代码再内联到 A 的调用方,这样持续内联下去。例如,下面的代码: + +```go +func BenchmarkMaxMaxMax(b *testing.B) { + var r int + for i := 0; i < b.N; i++ { + r = max(max(-1, i), max(0, i)) + } + Result = r +} +``` + +与之前的例子中的代码运行速度一样快,因为编译器可以对上面的代码重复地进行内联,也把代码简化到 `r = i` 表达式。 + +下一篇文章中,我会论述当 Go 编译器想要内联函数调用栈中间的某个函数时选用的另一种内联策略。最后我会论述编译器为了内联代码准备好要达到的极限,这个极限 Go 现在的能力还达不到。 + +[^1]: 在 Go 中,一个方法就是一个有预先定义的形参和接受者的函数。假设这个方法不是通过接口调用的,调用一个无消耗的函数所消耗的代价与引入一个方法是相同的。 +[^2]: 在 Go 1.14 以前,栈检查的前置处理也被垃圾回收器用于 STW,通过把所有活跃的 goroutine 栈空间设为 0,来强制它们切换为下一次函数调用时的运行时状态。这个机制[最近被替换][8]为一种新机制,新机制下运行时可以不用等 goroutine 进行函数调用就可以暂停 goroutine。 +[^3]: 我用 `//go:noinline` 编译指令来阻止编译器内联 `max`。这是因为我想把内联 `max` 的影响与其他影响隔离开,而不是用 `-gcflags='-l -N'` 选项在全局范围内禁止优化。关于 `//go:` 注释在[这篇文章][10]中详细论述。 +[^4]: 你可以自己通过比较 `go test -bench=. -gcflags=-S` 有无 `//go:noinline` 注释时的不同结果来验证一下。 +[^5]: 你可以用 `-gcflags=-d=ssa/prove/debug=on` 选项来自己验证一下。 + +#### 相关文章: + +1. [使 Go 变快的 5 件事](https://dave.cheney.net/2014/06/07/five-things-that-make-go-fast) +2. [为什么 Goroutine 的栈空间会无限增长?](https://dave.cheney.net/2013/06/02/why-is-a-goroutines-stack-infinite) +3. [Go 中怎么写基准测试](https://dave.cheney.net/2013/06/30/how-to-write-benchmarks-in-go) +4. [Go 中隐藏的编译指令](https://dave.cheney.net/2018/01/08/gos-hidden-pragmas) + +-------------------------------------------------------------------------------- + +via: https://dave.cheney.net/2020/04/25/inlining-optimisations-in-go + +作者:[Dave Cheney][a] +选题:[lujun9972][b] +译者:[lxbwolf](https://github.com/lxbwolf) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://dave.cheney.net/author/davecheney +[b]: https://github.com/lujun9972 +[1]: https://github.com/golang/go +[2]: tmp.gBQ2tEtMHc#easy-footnote-bottom-1-4053 (In Go, a method is just a function with a predefined formal parameter, the receiver. The relative costs of calling a free function vs a invoking a method, assuming that method is not called through an interface, are the same.) +[3]: tmp.gBQ2tEtMHc#easy-footnote-bottom-2-4053 (Up until Go 1.14 the stack check preamble was also used by the garbage collector to stop the world by setting all active goroutine’s stacks to zero, forcing them to trap into the runtime the next time they made a function call. This system was recently replaced with a mechanism which allowed the runtime to pause an goroutine without waiting for it to make a function call.) +[4]: tmp.gBQ2tEtMHc#easy-footnote-bottom-3-4053 (I’m using the //go:noinline pragma to prevent the compiler from inlining max. This is because I want to isolate the effects of inlining on max rather than disabling optimisations globally with -gcflags='-l -N'. I go into detail about the //go: comments in this presentation.) +[5]: tmp.gBQ2tEtMHc#easy-footnote-bottom-4-4053 (You can check this for yourself by comparing the output of go test -bench=. -gcflags=-S with and without the //go:noinline annotation.) +[6]: tmp.gBQ2tEtMHc#easy-footnote-bottom-5-4053 (You can check this yourself with the -gcflags=-d=ssa/prove/debug=on flag.) +[7]: tmp.gBQ2tEtMHc#easy-footnote-1-4053 +[8]: https://github.com/golang/proposal/blob/master/design/24543-non-cooperative-preemption.md +[9]: tmp.gBQ2tEtMHc#easy-footnote-2-4053 +[10]: https://dave.cheney.net/2018/01/08/gos-hidden-pragmas +[11]: tmp.gBQ2tEtMHc#easy-footnote-3-4053 +[12]: tmp.gBQ2tEtMHc#easy-footnote-4-4053 +[13]: tmp.gBQ2tEtMHc#easy-footnote-5-4053 +[14]: https://dave.cheney.net/2014/06/07/five-things-that-make-go-fast (Five things that make Go fast) +[15]: https://dave.cheney.net/2013/06/02/why-is-a-goroutines-stack-infinite (Why is a Goroutine’s stack infinite ?) +[16]: https://dave.cheney.net/2013/06/30/how-to-write-benchmarks-in-go (How to write benchmarks in Go) +[17]: https://dave.cheney.net/2018/01/08/gos-hidden-pragmas (Go’s hidden #pragmas) diff --git a/published/202005/20200427 How to secure your Linux email services with SSL-TLS.md b/published/202005/20200427 How to secure your Linux email services with SSL-TLS.md new file mode 100644 index 0000000000..48c2138c7a --- /dev/null +++ b/published/202005/20200427 How to secure your Linux email services with SSL-TLS.md @@ -0,0 +1,196 @@ +[#]: collector: (lujun9972) +[#]: translator: (Acceleratorrrr) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12217-1.html) +[#]: subject: (How to secure your Linux email services with SSL/TLS) +[#]: via: (https://opensource.com/article/20/4/securing-linux-email) +[#]: author: (Marc Skinner https://opensource.com/users/marc-skinner) + +如何利用 SSL/TLS 保护你的 Linux 邮件服务 +====== + +> 通过理解安全证书来保护你的 Linux 邮件服务。 + +![](https://img.linux.net.cn/data/attachment/album/202005/13/215637khaogmririavnrlk.jpg) + +通常,不管你是通过简单邮件传输协议Simple Mail Transport Protocol(SMTP)或者互联网消息访问协议Internet Message Access Protocol(IMAP)或邮局协议Post Office Protocol(POP)发送或者接受邮件,邮件服务默认都是以无保护的明文来传输数据。近来随着数据加密成为越来越多程序的共识,你需要安全套接层Secure Sockets Layer/传输层安全性Transport Layer Security(SSL/TLS)的安全证书来保护你的邮件服务。 + +首先,快速回顾一下邮件服务和协议的基本流程。邮件通过 SMTP 从 TCP 端口 25 发出。这个协议依靠 DNS 邮件交换服务器Mail eXchanger(MX)记录的地址信息来传输邮件。当邮件到达邮件服务器后,可以被以下两种服务中的任意一种检索:使用 TCP 端口 143 的 IMAP,或者使用 TCP 端口 110 的 POP3(邮局协议第 3 版)。然而,以上服务都默认使用明文传输邮件和认证信息。这非常的不安全! + +为了保护电子邮件数据和认证,这些服务都增加了一个安全功能,使它们可以利用 SSL/TLS 证书对数据流和通讯进行加密封装。SSL/TLS 是如何加密数据的细节不在本文讨论范围,有兴趣的话可以阅读 [Bryant Son 关于互联网安全的文章][2]了解更多细节。概括的说,SSL/TLS 加密是一种基于公钥和私钥的算法。 + +通过加入这些安全功能后,这些服务将监听在新的 TCP 端口: + +服务 | 默认 TCP 端口 | SSL/TLS 端口 +---|---|--- +SMTP | 25 | 587 +IMAP | 143 | 993 +POP3 | 110 | 995 + +### 生成 SSL/TLS 证书 + +[OpenSSL][3] 可以生成免费的 SSL/TLS 证书,或者你也可以从公共证书颁发机构Certificate Authoritie(CA)购买。过去,生成自签发证书十分简单而且通用,但是由于安全被日益重视,大部分的邮件客户端是不信任自签发证书的,除非手动设置。 + +如果你只是自己使用或者做做测试,那就使用自签发证书省点钱吧。但是如果很多人或者客户也需要使用的话,那最好还是从受信任的证书颁发机构购买。 + +不管是哪种情况,开始请求新证书的过程是使用 Linux 系统上的 OpenSSL 工具来创建一个证书签发请求Certificate Signing Request完全合规域名Fully Qualified Domain Name(FQDN)、邮件联系信息等等。当你输入完这些信息后,私钥和 CSR 文件就生成完毕了。 + +#### 如果你想生成自签发证书 + +如果你想要生成自签发证书的话,在运行以上 CSR 命令之前,你必须先创建一个[自己的根 CA][4]。你可以通过以下方法创建自己的根 CA。 + +``` +$ openssl genrsa -des3 -out myCA.key 2048 +``` + +命令行会提示你输入一个密码。请输入一个复杂点的密码而且不要弄丢了,因为这将会是根 CA 私钥的密码,正如其名称所示,它是你的证书中所有信任关系的根。 + +接下来,生成根 CA 证书: + +``` +$ openssl req -x509 -new -nodes -key myCA.key -sha256 -days 1825 -out myCA.pem +``` + +在回答完一些问题后,你就拥有一个有效期为 5 年的根 CA 证书了。 + +用之前生成的 CSR 文件,你可以请求生成一个新证书,并由您刚才创建的根 CA 签名。 + +``` +$ openssl x509 -req -in mail.mydomain.csr -CA myCA.pem -CAkey myCA.key -CAcreateserial -out mail.mydomain.pem -days 1825 -sha256 +``` + +输入你的根 CA 私钥的密码来创建和签署证书。 + +现在你有了配置电子邮件服务以增强安全性所需的两个文件:私匙文件 `mail.mydomain.key` 和公开证书文件 `mail.mydomain.pem`。 + +#### 如果你愿意购买证书 + +如果你愿意从机构购买证书,则需要上传 CSR 文件到证书颁发机构的系统中,它将会被用于生成 SSL/TLS 证书。证书可作为文件下载,比如 `mail.mydomain.pem`。很多 SSL 机构也需要你下载一个中间证书。如果是这样的话,你必须把这个两个证书合并成一个,这样电子邮件服务就可以将这两个证书结合起来处理。可以使用以下命令把你的证书和第三方中间证书合并在一起: + +``` +$ cat mail.mydomain.pem gd_bundle-g2-g1.crt > mail.mydomain.pem +``` + +值得一提的是 `.pem` 文件后缀代表隐私增强邮件Privacy-Enhanced Mail。 + +现在你就有全部的设置邮件服务安全所需文件了:私匙文件 `mail.mydomain.key` 和组合的公开证书文件 `mail.mydomain.pem`。 + +### 为你的文件生成一个安全的文件夹 + +不管你是的证书是自签发的或者从机构购买,你都需要生成一个安全的,管理员拥有的文件夹用于保存这两个文件。可以使用以下命令来生成: + +``` +$ mkdir /etc/pki/tls +$ chown root:root /etc/pki/tls +$ chmod 700 /etc/pki/tls +``` + +在复制文件到 `/etc/pki/tls` 后,再次设置这些文件的权限: + +``` +$ chmod 600 /etc/pki/tls/* +``` + +### 配置你的 SMTP 和 IMAP 服务 + +接下来,让 SMTP 和 IMAP 服务使用新的安全证书。我们用 `postfix` 和 `dovecot` 来作为例子。 + +用你顺手的编辑器来编辑 `/etc/postfix/main.cf` 文件。添加以下几行: + +``` +smtpd_use_tls = yes +smtpd_tls_cert_file = /etc/pki/tls/mail.mydomain.pem +smtpd_tls_key_file = /etc/pki/tls/mail.mydomain.key +``` + +### 自定义选项 + +以下选项可以启用或禁用各种加密算法,协议等等: + +``` +smtpd_tls_eecdh_grade = strong +smtpd_tls_protocols= !SSLv2, !SSLv3, !TLSv1, !TLSv1.1 +smtpd_tls_mandatory_protocols= !SSLv2, !SSLv3, !TLSv1, !TLSv1.1 +smtpd_tls_mandatory_ciphers = high +smtpd_tls_security_level=may +smtpd_tls_ciphers = high +tls_preempt_cipherlist = yes +smtpd_tls_mandatory_exclude_ciphers = aNULL, MD5 , DES, ADH, RC4, PSD, SRP, 3DES, eNULL +smtpd_tls_exclude_ciphers = aNULL, MD5 , DES, ADH, RC4, PSD, SRP, 3DES, eNULL +smtp_tls_mandatory_protocols = !SSLv2, !SSLv3, !TLSv1, !TLSv1.1 +smtp_tls_protocols = !SSLv2, !SSLv3, !TLSv1, !TLSv1.1 +``` + +编辑 `/etc/dovecot/dovecot.conf` 文件,添加以下三行: + +``` +ssl = required +ssl_cert = </etc/pki/tls/mail.mydomain.pem +ssl_key = </etc/pki/tls/mail.mydomain.key +``` + +添加下列更多选项来启用或禁用各种加密算法、协议等等(我把这些留给你来理解): + +``` +ssl_cipher_list = EECDH+ECDSA+AESGCM:EECDH+aRSA+AESGCM:EECDH+ECDSA+SHA384:EECDH+ECDSA+SHA256:EECDH+aRSA+SHA384:EECDH+aRSA+SHA256:EECDH+aRSA+RC4:EECDH:EDH+aRSA:ALL:!aNULL:!eNULL:!LOW:!3DES:!MD5:!EXP:!PSK:!SRP:!DSS:!RC4:!SSLv2 +ssl_prefer_server_ciphers = yes +ssl_protocols = !SSLv2 !SSLv3 !TLSv1 !TLSv1.1 +ssl_min_protocol = TLSv1.2 +``` + +### 设置 SELinux 上下文 + +如果你的 Linux 发行版启用了 SELinux,请为你的新证书文件设置正确的 SELinux 上下文。 + +对于 Postfix 设置 SELinux: + +``` +$ chcon -u system_u -t cert_t mail.mydomain.* +``` + +对于 Dovecot 设置 SELinux: + +``` +$ chcon -u system_u -t dovecot_cert_t mail.mydomain.* +``` + +重启这些服务,并与你相应更新过的电子邮件客户端配置连接。有些电子邮件客户端会自动探测到新的端口,有些则需要你手动更新。 + +### 测试配置 + +用 `openssl` 命令行和 `s_client` 插件来简单测试一下: + +``` +$ openssl s_client -connect mail.mydomain.com:993 +$ openssl s_client -starttls imap -connect mail.mydomain.com:143 +$ openssl s_client -starttls smtp -connect mail.mydomain.com:587 +``` + +这些测试命令会打印出很多信息,关于你使用的连接、证书、加密算法、会话和协议。这不仅是一个验证新设置的好方法,也可以确认你使用了适当的证书,以及在 postfix 或 dovecot 配置文件中定义的安全设置正确。 + +保持安全! + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/4/securing-linux-email + +作者:[Marc Skinner][a] +选题:[lujun9972][b] +译者:[Acceleratorrrr](https://github.com/Acceleratorrrr) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/marc-skinner +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/newsletter_email_mail_web_browser.jpg?itok=Lo91H9UH (email or newsletters via inbox and browser) +[2]: https://linux.cn/article-11699-1.html +[3]: https://www.openssl.org/ +[4]: https://en.wikipedia.org/wiki/Root_certificate diff --git a/published/202005/20200428 Lubuntu 20.04 Review- Lightweight, Minimalistic, Polished.md b/published/202005/20200428 Lubuntu 20.04 Review- Lightweight, Minimalistic, Polished.md new file mode 100644 index 0000000000..3b04dc37b8 --- /dev/null +++ b/published/202005/20200428 Lubuntu 20.04 Review- Lightweight, Minimalistic, Polished.md @@ -0,0 +1,150 @@ +[#]: collector: (lujun9972) +[#]: translator: (qfzy1233) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12242-1.html) +[#]: subject: (Lubuntu 20.04 Review: Lightweight, Minimalistic, Polished) +[#]: via: (https://itsfoss.com/lubuntu-20-04-review/) +[#]: author: (Dimitrios Savvopoulos https://itsfoss.com/author/dimitrios/) + +Lubuntu 20.04 点评:轻量、简约、文雅 +====== + +> Lubuntu 20.04 LTS 与之前的 LTS 版本有很大的不同。它旨在给你一个更完善的体验,而不仅仅是关注旧电脑。请阅读更多关于 Lubuntu 20.04 的内容。 + +### Lubuntu 20.04 点评:第一个基于 LXQt 的长期支持版 + +我在 Lubuntu 20.04 发行前几天就已经开始使用它了。我通常使用 Arch 阵营中 Manjaro 和 Cinnamon 桌面,所以使用 Lubuntu 对我来说是一个愉快的改变。 + +以下是我在使用 Lubuntu 20.04.时的一些感受和注记。 + +#### 再见 LXDE,你好 LXQt! + +长期以来,[Lubuntu][1] 都依靠 [LXDE][2] 来提供轻量级的 Linux 体验。但现在,它使用的是 LXQt 桌面环境。 + +[LXDE][3] 是基于 GTK(GNOME 所使用的库),更具体地说是基于 2020 年的 GTK+ 2。由于对 GTK+ 3 不满意,LXDE 开发人员 Hong Jen Yee 决定将整个桌面移植到 Qt(KDE 所使用的库)。LXDE 的 Qt 移植版本和 [Razor-qt][4] 项目合并形成 [LXQt][5]。所以现在,LXDE 和 LXQt 作为单独的项目而共存。 + +既然 LXDE 开发者本身专注于 LXQt,那么 Lubuntu 坚持使用三年多前上一次稳定发布版的桌面环境 LXDE 是没有意义的。 + +因此,Lubuntu 18.04 是使用 [LXDE][3] 的最后一个版本。幸运的是,这是一个长期支持版本。Lubuntu 团队将提供支持直到 2021 年。 + +![][6] + +#### 不仅适于老机器 + +随着在 2020 年“老机器”的定义发生了变化,Lubuntu 18.04 成为了最后一个 32 位版本。现在,即使是一台 10 年前的老机器也至少有 2G 的内存和一个双核 64 位处理器。 + +因此,Lubuntu 团队将不再设置最低的系统需求,也不再主要关注旧硬件。尽管 LXQt 仍然是一个轻量级的、经典而不失精致的、功能丰富的桌面环境。 + +在 Lubuntu 20.04 LTS 发布之前,Lubuntu 的第一个 LXQt 发行版是 18.10,开发人员经历了三个标准发行版来完善 LXQt 桌面,这是一个很好的开发策略。 + +#### 不用常规的 Ubiquity,Lubuntu 20.04 使用的是 Calamares 安装程序 + +![Lubuntu 20.04 Calamares 安装程序][8] + +在新版本中使用了全新的 [Calamares][9] 安装程序,取代了其它 [Ubuntu 官方版本][10]使用的 Ubiquity 安装程序。 + +整个安装过程在大约能在 10 分钟内完成,比之前 Lubuntu 的版本稍微快一些。 + +由于镜像文件附带了预先安装的基本应用程序,所以你可以很快就可以完成系统的完全配置。 + +#### 不要直接从 Lubuntu 18.04 升级到 Lubuntu 20.04 + +通常,你可以[将 Ubuntu 从一个 LTS 版本升级到另一个 LTS 版本][11]。但是 Lubuntu 团队建议不要从 Lubuntu 18.04 升级到 20.04。他们建议重新安装,这才是正确的。 + +Lubuntu 18.04 使用 LXDE 桌面,20.04 使用 LXQt。由于桌面环境的巨大变化,从 18.04 升级到 20.04 将导致系统崩溃。 + +#### 更多的 KDE 和 Qt 应用程序 + +![][12] + +下面是在这个新版本中默认提供的一些应用程序,正如我们所看到的,并非所有应用程序都是轻量级的,而且大多数应用程序都是基于 Qt 的。 + +甚至使用的软件中心也是 KDE 的 Discover,而不是 Ubuntu 的 GNOME 软件中心。 + + * Ark – 归档文件管理器 + * Bluedevil – 蓝牙连接管理 + * Discover 软件中心 – 包管理系统 + * FeatherPad – 文本编辑器 + * FireFox – 浏览器 + * K3b – CD/DVD 刻录器 + * Kcalc – 计算器 + * KDE 分区管理器 – 分区管理工具 + * LibreOffice – 办公套件(Qt 界面版本) + * LXimage-Qt – 图片查看器及截图制作 + * Muon – 包管理器 + * Noblenote – 笔记工具 + * PCManFM-Qt – 文件管理器 + * Qlipper – 剪贴板管理工具 + * qPDFview – PDF 阅读器 + * PulseAudio – 音频控制器 + * Qtransmission – BT 下载工具(Qt 界面版本) + * Quassel – IRC 客户端 + * ScreenGrab – 截屏制作工具 + * Skanlite – 扫描工具 + * 启动盘创建工具 – USB 启动盘制作工具 + * Trojita – 邮件客户端 + * VLC – 媒体播放器 + * [MPV 视频播放器][13] + +#### 测试 Lubuntu 20.04 LTS + +LXQt 版 Lubuntu 的启动时间不到一分钟,虽然是从 SSD 启动的。 + +LXQt 目前需要的内存比基于 Gtk+ 2 的 LXDE 稍微多一点,但是另一种 Gtk+ 3 工具包也需要更多的内存。 + +在重新启动之后,系统以非常低的内存占用情况运行,大约只有 340 MB(按照现代标准),比 LXDE 多 100 MB。 + +![htop 在 Lubuntu 20.04 上运行][14] + +LXQt 不仅适用于硬件较旧的用户,也适用于那些希望在新机器上获得简约经典体验的用户。 + +桌面布局看起来类似于 KDE 的 Plasma 桌面,你觉得呢? + +![Lubuntu 20.04 桌面环境][15] + +在左下角有一个应用程序菜单,一个用于显示固定和活动的应用程序的任务栏,右下角有一个系统托盘。 + +Lubuntu 的 LXQt 版本可以很容易的定制,所有的东西都在菜单的首选项下,大部分的关键项目都在 LXQt “设置”中。 + +值得一提的是,LXQt 在默认情况下使用流行的 [Openbox 窗口管理器][16]。 + +与前三个发行版一样,20.04 LTS 附带了一个默认的黑暗主题 Lubuntu Arc,但是如果不适合你的口味,可以快速更换,也很方便。 + +就日常使用而言,事实证明,Lubuntu 20.04 向我证明,其实每一个 Ubuntu 的分支版本都完全没有问题。 + +#### 结论 + +Lubuntu 团队已经成功地过渡到一个现代的、依然轻量级的、极简的桌面环境。LXDE 看起来被遗弃了,迁移到一个活跃的项目也是一件好事。 + +我希望 Lubuntu 20.04 能够让你和我一样热爱,如果是这样,请在下面的评论中告诉我。请继续关注! + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/lubuntu-20-04-review/ + +作者:[Dimitrios Savvopoulos][a] +选题:[lujun9972][b] +译者:[qfzy1233](https://github.com/qfzy1233) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://itsfoss.com/author/dimitrios/ +[b]: https://github.com/lujun9972 +[1]: https://lubuntu.me/ +[2]: https://github.com/lxde +[3]: https://lxde.org/ +[4]: https://web.archive.org/web/20160220061334/http://razor-qt.org/ +[5]: https://lxqt.org/ +[6]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/04/Lubuntu-20-04-review.jpg?ssl=1 +[7]: https://itsfoss.com/lubuntu-no-more-old-distro/ +[8]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/04/lubuntu-20-04-installer.jpg?ssl=1 +[9]: https://calamares.io/ +[10]: https://itsfoss.com/which-ubuntu-install/ +[11]: https://itsfoss.com/upgrade-ubuntu-version/ +[12]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/04/Lubuntu-20.04.gif?ssl=1 +[13]: https://itsfoss.com/mpv-video-player/ +[14]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/04/htop.jpg?fit=800%2C629&ssl=1 +[15]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/04/Lubuntu-20.04-desktop.jpg?fit=800%2C450&ssl=1 +[16]: https://en.wikipedia.org/wiki/Openbox diff --git a/published/202005/20200428 Upgrading Fedora 31 to Fedora 32.md b/published/202005/20200428 Upgrading Fedora 31 to Fedora 32.md new file mode 100644 index 0000000000..c2c4bc0301 --- /dev/null +++ b/published/202005/20200428 Upgrading Fedora 31 to Fedora 32.md @@ -0,0 +1,99 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12195-1.html) +[#]: subject: (Upgrading Fedora 31 to Fedora 32) +[#]: via: (https://fedoramagazine.org/upgrading-fedora-31-to-fedora-32/) +[#]: author: (Adam Šamalík https://fedoramagazine.org/author/asamalik/) + +将 Fedora 31 升级到 Fedora 32 +====== + +![][1] + +Fedora 32 [已经发布][2]。你可能想升级系统以获得 Fedora 中的最新功能。Fedora Workstation 有图形化的升级方法。另外,Fedora 提供了命令行方法,用于将 Fedora 31 升级到 Fedora 32。 + +升级前,请访问 [Fedora 32 个常见 bug 的维基页面][3],查看是否存在可能影响升级的问题。尽管 Fedora 社区试图确保升级正常进行,但是无法为用户可能使用的每种软硬件组合提供保证。 + +### 将 Fedora 31 Workstation 升级到 Fedora 32 + +在新版本发布不久之后就会出现通知,告诉你有可用的升级。你可以单击该通知启动 “GNOME 软件”。或者,你可以从 GNOME Shell 中选择“软件”。 + +在 “GNOME 软件”中选择更新Updates选项卡,你会看到一个页面通知你 Fedora 32 现在可用。 + +如果你在此页面看不到任何内容,请尝试使用左上方的重新加载按钮。发布后,所有系统可能都需要一段时间才能看到可用的升级。 + +选择下载Download获取升级包。你可以继续做事直到下载完成。然后使用 “GNOME 软件”重启系统并应用升级。升级需要时间,因此你可能需要喝杯咖啡,稍后再回来。 + +### 使用命令行 + +如果你是从 Fedora 的先前版本升级的,那么你可能对 `dnf upgrade` 插件很熟悉。这个方法是推荐和受支持的从 Fedora 31 升级到 Fedora 32 的方法。使用此插件将使你轻松地升级到 Fedora 32。 + +#### 1、更新软件并备份系统 + +在开始升级过程之前,请确保你有 Fedora 31 的最新软件。如果你安装了模块化软件modular software,这尤为重要。`dnf` 和 “GNOME 软件”的最新版本对某些模块化流的升级过程进行了改进。要更新软件,请使用 “GNOME 软件” 或在终端中输入以下命令。 + +``` +sudo dnf upgrade --refresh +``` + +此外,在继续操作之前,请确保备份系统。有关备份的帮助,请参阅 Fedora Magazine 上的[备份系列][4]。 + +#### 2、安装 DNF 插件 + +接下来,打开终端并输入以下命令安装插件: + +``` +sudo dnf install dnf-plugin-system-upgrade +``` + +#### 3、使用 DNF 开始更新 + +现在,你的系统已更新、已备份、并且已安装 DNF 插件,你可以在终端中使用以下命令开始升级: + +``` +sudo dnf system-upgrade download --releasever=32 +``` + +这个命令将开始在本地下载所有的升级包,为升级做准备。如果你在升级的时候因为没有更新的包、依赖关系破损或退役的包而出现问题,请在输入上述命令时添加 `--allowerasing` 标志。这将允许 DNF 移除可能阻碍系统升级的软件包。 + +#### 4、重启并升级 + +当上一个命令完成了所有升级包的下载,你的系统就可以重新启动了。要将系统引导至升级过程,请在终端中输入以下命令: + +``` +sudo dnf system-upgrade reboot +``` + +此后,系统将重启。在许多版本之前,`fedup` 工具会在内核选择/启动页上创建一个新选项。使用 `dnf-plugin-system-upgrade` 包,你的系统会重启进入 Fedora 31 当前安装的内核;这个是正常的。在选择内核之后,你的系统会立即开始升级过程。 + +现在可能是喝杯咖啡休息的好时机!完成后,系统将重启,你将能够登录到新升级的 Fedora 32 系统。 + +![][5] + +### 解决升级问题 + +有时,升级系统时可能会出现意外问题。如果你遇到任何问题,请访问 [DNF 系统升级文档][6],以获取有关故障排除的更多信息。 + +如果升级时遇到问题,并且系统上安装了第三方仓库,那么在升级时可能需要禁用这些仓库。对于 Fedora 不提供的仓库的支持,请联系仓库的提供者。 + +-------------------------------------------------------------------------------- + +via: https://fedoramagazine.org/upgrading-fedora-31-to-fedora-32/ + +作者:[Adam Šamalík][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://fedoramagazine.org/author/asamalik/ +[b]: https://github.com/lujun9972 +[1]: https://fedoramagazine.org/wp-content/uploads/2020/04/31-32-816x345.png +[2]: https://linux.cn/article-12164-1.html +[3]: https://fedoraproject.org/wiki/Common_F32_bugs +[4]: https://fedoramagazine.org/taking-smart-backups-duplicity/ +[5]: https://cdn.fedoramagazine.org/wp-content/uploads/2016/06/Screenshot_f23-ws-upgrade-test_2016-06-10_110906-1024x768.png +[6]: https://docs.fedoraproject.org/en-US/quick-docs/dnf-system-upgrade/#Resolving_post-upgrade_issues diff --git a/published/202005/20200428 Using Files and Folders on Desktop Screen in Ubuntu.md b/published/202005/20200428 Using Files and Folders on Desktop Screen in Ubuntu.md new file mode 100644 index 0000000000..a58f9a7895 --- /dev/null +++ b/published/202005/20200428 Using Files and Folders on Desktop Screen in Ubuntu.md @@ -0,0 +1,102 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12198-1.html) +[#]: subject: (Using Files and Folders on Desktop Screen in Ubuntu) +[#]: via: (https://itsfoss.com/add-files-on-desktop-ubuntu/) +[#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/) + +在 Ubuntu 桌面中使用文件和文件夹 +====== + +![](https://img.linux.net.cn/data/attachment/album/202005/08/224609chff5qn5ccah56af.jpg) + +> 此初学者教程讨论了 在Ubuntu 桌面上添加文件和文件夹时可能遇到的一些困难。 + +我认识一些习惯将所有重要/常用文件放在桌面上以便快速访问的人。 + +![][1] + +我不喜欢杂乱的桌面,但是我可以想象它实际上可能对某些人有所帮助。 + +在过去的几个版本中,很难在 Ubuntu 的默认 GNOME 桌面上添加文件。这并不是 Ubuntu 的错。 + +[GNOME][2] 的开发者认为,桌面上没有图标和文件的存身之地。当你可以在菜单中轻松搜索文件时,无需将文件放在桌面上。这在部分情况下是事实。 + +这就是为什么 [GNOME 的文件管理器 Nautilus][3] 的较新版本不能很好地支持桌面上的图标和文件的原因。 + +也就是说,在桌面上添加文件和文件夹并非没有可能。让我告诉你如何做。 + +### 在 Ubuntu 的桌面上添加文件和文件夹 + +![][4] + +我在本教程中使用的是 Ubuntu 20.04。对于其他 Ubuntu 版本,步骤可能会有所不同。 + +#### 将文件和文件夹添加到“桌面文件夹” + +如果打开文件管理器,你应该在左侧边栏或文件夹列表中看到一个名为“桌面”的条目。此文件夹(以某种方式)代表你的桌面。 + +![Desktop folder can be used to add files to the desktop screen][5] + +你添加到此文件夹的所有内容都会反映在桌面上。 + +![Anything added to the Desktop folder will be reflected on the desktop screen][6] + +如果你从“桌面文件夹”中删除文件,那么文件也会从桌面中删除。 + +#### 将文件拖放到桌面不起作用 + +现在,如果你尝试从文件管理器往桌面上拖放文件,它会不起使用。这不是一个 bug,它是一个使很多人恼火的功能。 + +一种临时方案是打开两个文件管理器。在其中一个打开“桌面”文件夹,然后将文件拖放到该文件夹​​中,它们将被添加到桌面上。 + +我知道这并不理想,但是你没有太多选择。 + +#### 你不能使用 Ctrl+C 和 Ctrl+V 在桌面上复制粘贴,请使用右键单击菜单 + +更恼人的是,你不能使用 `Ctrl+V`(著名的键盘快捷键)将文件粘贴到桌面上。 + +但是,你仍然可以使用右键单击,然后选择“粘贴”,将文件复制到桌面上。你甚至可以通过这种方式创建新文件夹。 + +![Right click menu can be used for copy-pasting files to desktop][7] + +是否有意义?对我来说不是,但这就是 Ubuntu 20.04 的方式。 + +#### 你无法使用 Delete 键删除文件和文件夹,请再次使用右键菜单 + +更糟糕的是,你无法使用 `Delete` 键或 `Shift+Delete` 键从桌面上删除文件。但是你仍然可以右键单击文件或文件夹,然后选择“移至回收站”来删除文件。 + +![Delete files from desktop using right click][8] + +好了,你现在知道至少有一种方法可以在桌面上添加文件,但有一些限制。不幸的是,这还没有结束。 + +你无法在桌面上用名称搜索文件。通常,如果你开始输入 “abc”,那么以 “abc” 开头的文件会高亮显示。但是在这里不行。 + +我不知道为什么在桌面上添加文件受到了如此多的限制。值得庆幸的是,我不会经常使用它,否则我会感到非常沮丧。 + +如果有兴趣,你也可以阅读[在 Ubuntu 桌面上添加应用快捷方式][9]这篇文章。 + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/add-files-on-desktop-ubuntu/ + +作者:[Abhishek Prakash][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://itsfoss.com/author/abhishek/ +[b]: https://github.com/lujun9972 +[1]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/04/files-on-desktop-ubuntu.jpg?ssl=1 +[2]: https://www.gnome.org/ +[3]: https://wiki.gnome.org/Apps/Files +[4]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/04/adding-files-desktop-ubuntu.png?ssl=1 +[5]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/04/desktop-folder-ubuntu.png?ssl=1 +[6]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/04/adding-files-desktop-screen-ubuntu.jpg?ssl=1 +[7]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/04/adding-new-files-ubuntu-desktop.jpg?ssl=1 +[8]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/04/delete-files-from-desktop-ubuntu.jpg?ssl=1 +[9]: https://itsfoss.com/ubuntu-desktop-shortcut/ diff --git a/published/202005/20200428 What-s new in Fedora 32 Workstation.md b/published/202005/20200428 What-s new in Fedora 32 Workstation.md new file mode 100644 index 0000000000..17050794d2 --- /dev/null +++ b/published/202005/20200428 What-s new in Fedora 32 Workstation.md @@ -0,0 +1,87 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12201-1.html) +[#]: subject: (What’s new in Fedora 32 Workstation) +[#]: via: (https://fedoramagazine.org/whats-new-fedora-32-workstation/) +[#]: author: (Ryan Lerch https://fedoramagazine.org/author/ryanlerch/) + +Fedora 32 Workstation 的新功能 +====== + +![][1] + +Fedora 32 Workstation 是我们免费的领先操作系统的[最新版本][2]。你现在可以从[官方网站][3]下载它。Fedora 32 Workstation 中有几个新的且值得注意的变化。请阅读下面的详情。 + +### GNOME 3.36 + +Fedora 32 Workstation 包含了适合所有用户的 GNOME 桌面环境的最新版本。Fedora 32 Workstation 中的 GNOME 3.36 包含了许多更新和改进,包括: + +#### 重新设计的锁屏界面 + +Fedora 32 中的锁屏是一种全新的体验。新设计消除了以前版本中使用的“窗口阴影”,并着重于易用性和速度。 + +![Unlock screen in Fedora 32][4] + +#### 新的扩展程序 + +Fedora 32 有新的“扩展”应用,它可轻松管理你的 GNOME 扩展。过去,扩展是使用“软件”和/或“调整工具”来安装、配置和启用的。 + +![The new Extensions application in Fedora 32][5] + +请注意,默认情况下,Fedora 32 上未安装这个“扩展”应用。需要使用“软件”进行搜索和安装,或在终端中使用以下命令: + +``` +sudo dnf install gnome-extensions-app +``` + +#### 重新组织的设置应用 + +敏锐的 Fedora 用户会注意到“设置”应用已重新组织。设置类别的结构更加扁平,因此可以一次看到更多设置。 + +此外,“关于”中现在有有关系统的更多信息,包括正在运行的窗口系统(例如 Wayland)。 + +![The reorganized settings application in Fedora 32][6] + +#### 重新设计的通知/日历弹出框 + +单击桌面顶部的“日期和时间”可切换“通知/日历”弹出窗口,其中有许多小的样式调整项。此外,弹出窗口现在有“请勿打扰”开关,可快速禁用所有通知。这在希望只显示屏幕而不显示个人通知时很有用。 + +![The new Notification / Calendar popover in Fedora 32 ][7] + +#### 重新设计的时钟应用 + +Fedora 32 完全重新设计了时钟。该设计在较小的窗口中效果更好。 + +![The Clocks application in Fedora 32][8] + +GNOME 3.36 还提供了许多其他功能和增强。有关更多信息,请查看 [GNOME 3.36 的发布说明][9]。 + +### 改进的内存不足处理 + +以前,如果系统内存不足,那么可能会遇到大量使用交换(也称为 [交换抖动][10])–有时会导致 Workstation UI 变慢或在一段时间内无响应。Fedora 32 Workstation 现在默认启用 EarlyOOM。EarlyOOM 可以让用户在低内存的情况下,存在大量使用交换的情况下,更快速地恢复和恢复对系统的控制。 + +-------------------------------------------------------------------------------- + +via: https://fedoramagazine.org/whats-new-fedora-32-workstation/ + +作者:[Ryan Lerch][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://fedoramagazine.org/author/ryanlerch/ +[b]: https://github.com/lujun9972 +[1]: https://fedoramagazine.org/wp-content/uploads/2020/04/fedora32workstation-816x345.jpg +[2]: https://linux.cn/article-12164-1.html +[3]: https://getfedora.org/workstation +[4]: https://fedoramagazine.org/wp-content/uploads/2020/04/unlock.gif +[5]: https://fedoramagazine.org/wp-content/uploads/2020/04/extensions.png +[6]: https://fedoramagazine.org/wp-content/uploads/2020/04/settings.png +[7]: https://fedoramagazine.org/wp-content/uploads/2020/04/donotdisturb.png +[8]: https://fedoramagazine.org/wp-content/uploads/2020/04/clocks.png +[9]: https://help.gnome.org/misc/release-notes/3.36/ +[10]: https://en.wikipedia.org/wiki/Thrashing_(computer_science) diff --git a/published/202005/20200429 Drop PNG and JPG for your online images- Use WebP.md b/published/202005/20200429 Drop PNG and JPG for your online images- Use WebP.md new file mode 100644 index 0000000000..7f581e778f --- /dev/null +++ b/published/202005/20200429 Drop PNG and JPG for your online images- Use WebP.md @@ -0,0 +1,165 @@ +[#]: collector: (lujun9972) +[#]: translator: (lxbwolf) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12193-1.html) +[#]: subject: (Drop PNG and JPG for your online images: Use WebP) +[#]: via: (https://opensource.com/article/20/4/webp-image-compression) +[#]: author: (Jeff Macharyas https://opensource.com/users/jeffmacharyas) + +线上图片请抛弃 PNG 和 JPG:使用 WebP +====== + +> 了解一下这个开源的图片编辑工具来节省时间和空间。 + +![](https://img.linux.net.cn/data/attachment/album/202005/07/143932l22hot7ebhbbqjmm.jpg) + +WebP 是 2010 年 Google 开发的一种图片格式,它为网页上的图片提供了卓越的无损和有损压缩。网站开发者们可以使用 WebP 来创建尺寸更小、细节更丰富的图片,以此来提高网站的速度。更快的加载速度对于网站的用户体验和网站的营销效果是至关重要的。 + +为了在所有设备和用户中达到最佳加载效果,你网站上的图片文件大小不应该超过 500 KB。 + +与 PNG 图片相比,WebP 无损图片通常至少要比 PNG 图片小 25%。在同等的 SSIM(结构相似度structural similarity)质量指标下,WebP 有损图片通常比 JPEG 图片小 25% 到 34%。 + +无损 WebP 也支持透明度。而在可接受有损 RGB 压缩的情况下,有损 WebP 也支持透明度,通常其大小比 PNG 文件小三倍。 + +Google 报告称,把动画 GIF 文件转换为有损 WebP 后文件大小减少了 64%,转换为无损 WebP 后文件大小减少了 19%。 + +WebP 文件格式是一种基于 RIFF(资源互换文件格式resource interchange file format)的文档格式。你可以用 [hexdump][2] 看到文件的签名是 `52 49 46 46`(RIFF): + + +``` +$ hexdump --canonical pixel.webp +00000000  52 49 46 46 26 00 00 00  [...]  |RIFF&...WEBPVP8 | +00000010  1a 00 00 00 30 01 00 9d  [...]  |....0....*......| +00000020  0e 25 a4 00 03 70 00 fe  [...]  |.%...p...`....| +0000002e +``` + +独立的 libwebp 库作为 WebP 技术规范的参考实现,可以从 Google 的 [Git 仓库][3] 或 tar 包中获得。 + +全球在用的 80% 的 web 浏览器兼容 WebP 格式。本文撰写时,Apple 的 Safari 浏览器还不兼容。解决这个问题的方法是将 JPG/PNG 图片与 WebP 图片一起提供,有一些方法和 Wordpress 插件可以做到这一点。 + +### 为什么要这样做? + +我的部分工作是设计和维护我们组织的网站。由于网站是个营销工具,而网站的速度是衡量用户体验的重要指标,我一直致力于提高网站速度,通过把图片转换为 WebP 来减少图片大小是一个很好的解决方案。 + +我使用了 web.dev 来检测其中一个网页,该工具是由 Lighthouse 提供服务的,遵循 Apache 2.0 许可证,可以在 找到。 + +据其官方描述,“LIghthouse 是一个开源的,旨在提升网页质量的自动化工具。你可以在任何公共的或需要鉴权的网页上运行它。它有性能、可用性、渐进式 web 应用、SEO 等方面的审计。你可以在 Chrome 浏览器的开发工具中运行 Lighthouse,也可以通过命令行或作为 Node 模块运行。你输入一个 URL 给 Lighthouse,它会对这个网页进行一系列的审计,然后生成这个网页的审计结果报告。从报告的失败审计条目中可以知道应该怎么优化网页。每条审计都有对应的文档解释为什么该项目是重要的,以及如何修复它。” + +### 创建更小的 WebP 图片 + +我测试的页面返回了三张图片。在它生成的报告中,它提供了推荐和目标。我选择了它报告有 650 KB 的 `app-graphic` 图片。通过把它转换为 WebP 格式,预计可以把图片大小降到 61 KB,节省 589 KB。我在 Photoshop 中把它转换了,用默认的 WebP 设置参数保存它,它的文件大小为 44.9 KB。比预期的还要好!从下面的 Photoshop 截图中可以看出,两张图在视觉质量上完全一样。 + +![WebP vs JPG comparison][4] + +*左图:650 KB(实际大小)。右图: 44.9 KB(转换之后的目标大小)。* + +当然,也可以用开源图片编辑工具 [GIMP][5] 把图片导出为 WebP。它提供了几个质量和压缩的参数: + +![GIMP dialog for exporting webp, as a webp][6] + +另一张图放大后: + +![WebP vs PNG comparison][7] + +PNG(左图)和 WebP(右图),都是从 JPG 转换而来,两图对比可以看出 WebP 不仅在文件大小更小,在视觉质量上也更优秀。 + +### 把图片转换为 WebP + +你也可以用 Linux 的命令行工具把图片从 JPG/PNG 转换为 WebP: + +在命令行使用 `cwebp` 把 PNG 或 JPG 图片文件转换为 WebP 格式。你可以用下面的命令把 PNG 图片文件转换为质量参数为 80 的 WebP 图片。 + +``` +cwebp -q 80 image.png -o image.webp +``` + +你还可以用 [Image Magick][8],这个工具可能在你的发行版本软件仓库中可以找到。转换的子命令是 `convert`,它需要的所有参数就是输入和输出文件: + +``` +convert pixel.png pixel.webp +``` + +### 使用编辑器把图片转换为 WebP + +要在图片编辑器中来把图片转换为 WebP,可以使用 [GIMP][9]。从 2.10 版本开始,它原生地支持 WebP。 + +如果你是 Photoshop 用户,由于 Photoshop 默认不包含 WebP 支持,因此你需要一个转换插件。遵循 Apache License 2.0 许可证发布的 WebPShop 0.2.1 是一个用于打开和保存包括动画图在内的 WebP 图片的 Photoshop 模块,在 可以找到。 + +为了能正常使用它,你需要把它放进 Photoshop 插件目录下的 `bin` 文件夹: + +Windows x64 :`C:\Program Files\Adobe\Adobe Photoshop\Plug-ins\WebPShop.8bi` + +Mac:`Applications/Adobe Photoshop/Plug-ins/WebPShop.plugin` + +### Wordpress 上的 WebP + +很多网站是用 Wordpress 搭建的(我的网站就是)。因此,Wordpress 怎么上传 WebP 图片?本文撰写时,它还不支持。但是,当然已经有插件来满足这种需求,因此你可以在你的网站上同时准备 WebP 和 PNG/JPG 图片(为 Apple 用户)。 + +在 [Marius Hosting][11] 有下面的[说明][10]: + +“直接向 Wordpress 上传 WebP 图片会怎样?这很简单。向你的主题 `functions.php` 文件添加几行内容就可以了。Wordpress 默认不支持展示和上传 WebP 文件,但是我会向你介绍一下怎么通过几个简单的步骤来让它支持。登录进你的 Wordpress 管理员界面,进入‘外观/主题编辑器’找到 `functions.php`。复制下面的代码粘贴到该文件最后并保存: + +``` +//** *Enable upload for webp image files.*/ +function webp_upload_mimes($existing_mimes) { + $existing_mimes['webp'] = 'image/webp'; + return $existing_mimes; +} +add_filter('mime_types', 'webp_upload_mimes'); +``` + +如果你想在‘媒体/媒体库’时看到缩略图预览,那么你需要把下面的代码也添加到 `functions.php` 文件。为了找到 `functions.php` 文件,进入‘外观/主题编辑器’并搜索 `functions.php`,然后复制下面的代码粘贴到文件最后并保存: + +``` +//** * Enable preview / thumbnail for webp image files.*/ +function webp_is_displayable($result, $path) { + if ($result === false) { + $displayable_image_types = array( IMAGETYPE_WEBP ); + $info = @getimagesize( $path ); + + if (empty($info)) { + $result = false; + } elseif (!in_array($info[2], $displayable_image_types)) { + $result = false; + } else { + $result = true; + } + } + + return $result; +} +add_filter('file_is_displayable_image', 'webp_is_displayable', 10, 2); +``` + +” + +### WebP 和未来 + +WebP 是一个健壮而优化的格式。它看起来更好,压缩率更高,并具有其他大部分常见图片格式的所有特性。不必再等了,现在就使用它吧。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/4/webp-image-compression + +作者:[Jeff Macharyas][a] +选题:[lujun9972][b] +译者:[lxbwolf](https://github.com/lxbwolf) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/jeffmacharyas +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/painting_computer_screen_art_design_creative.png?itok=LVAeQx3_ (Painting art on a computer screen) +[2]: https://opensource.com/article/19/8/dig-binary-files-hexdump +[3]: https://storage.googleapis.com/downloads.webmproject.org/releases/webp/index.html +[4]: https://opensource.com/sites/default/files/uploads/webp-vs-jpg-app-graphic.png (WebP vs JPG comparison) +[5]: http://gimp.org +[6]: https://img.linux.net.cn/data/attachment/album/202005/07/143538plu797s4wmhy9b1p.jpg (GIMP dialog for exporting webp, as a webp) +[7]: https://opensource.com/sites/default/files/uploads/xcompare-png-left-webp-right.png (WebP vs PNG comparison) +[8]: https://imagemagick.org +[9]: https://en.wikipedia.org/wiki/GIMP +[10]: https://mariushosting.com/how-to-upload-webp-files-on-wordpress/ +[11]: https://mariushosting.com/ diff --git a/published/202005/20200429 The life-changing magic of git rebase -i.md b/published/202005/20200429 The life-changing magic of git rebase -i.md new file mode 100644 index 0000000000..54665c70fe --- /dev/null +++ b/published/202005/20200429 The life-changing magic of git rebase -i.md @@ -0,0 +1,79 @@ +[#]: collector: (lujun9972) +[#]: translator: (wxy) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12231-1.html) +[#]: subject: (The life-changing magic of git rebase -i) +[#]: via: (https://opensource.com/article/20/4/git-rebase-i) +[#]: author: (Dave Neary https://opensource.com/users/dneary) + +完美生活:git rebase -i +====== + +> 让大家觉得你一次就能写出完美的代码,并让你的补丁更容易审核和合并。 + +![](https://img.linux.net.cn/data/attachment/album/202005/18/185911fvwztwyp4lvbzkw4.jpg) + +软件开发是混乱的。有很多错误的转折、有需要修复的错别字、有需要修正的错误、有需要稍后纠正的临时和粗陋的代码,还有在以后的开发过程中发现一次又一次的问题。有了版本控制,在创建“完美”的最终产品(即准备提交给上游的补丁)的过程中,你会有一个记录着每一个错误转折和修正的原始记录。就像电影中的花絮一样,它们会让人有点尴尬,有时也会让人觉得好笑。 + +如果你使用版本控制来定期保存你的工作线索,然后当你准备提交审核的东西时,又可以隐藏所有这些私人草稿工作,并只提交一份单一的、完美的补丁,那不是很好吗?`git rebase -i`,是重写历史记录的完美方法,可以让大家觉得你一次就写出了完美的代码! + +### git rebase 的作用是什么? + +如果你不熟悉 Git 的复杂性,这里简单介绍一下。在幕后,Git 将项目的不同版本与唯一标识符关联起来,这个标识符由父节点的唯一标识符的哈希以及新版本与其父节点的差异组成。这样就形成了一棵修订树,每个签出项目的人都会得到自己的副本。不同的人可以把项目往不同的方向发展,每个方向都可能从不同的分支点开始。 + +![Master branch vs. private branch][2] + +*左边是 origin 版本库中的主分支,右边是你个人副本中的私有分支。* + +有两种方法可以将你的工作与原始版本库中的主分支整合起来:一种是使用合并:`git merge`,另一种是使用变基:`git rebase`。它们的工作方式非常不同。 + +当你使用 `git merge` 时,会在主分支(`master`)上创建一个新的提交,其中包括所有来自原始位置(`origin`)的修改和所有本地的修改。如果有任何冲突(例如,如果别人修改了你也在修改的文件),则将这些冲突标记出来,并且你有机会在将这个“合并提交”提交到本地版本库之前解决这些冲突。当你将更改推送回父版本库时,所有的本地工作都会以分支的形式出现在 Git 版本库的其他用户面前。 + +但是 `git rebase` 的工作方式不同。它会回滚你的提交,并从主分支(`master`)的顶端再次重放这些提交。这导致了两个主要的变化。首先,由于你的提交现在从一个不同的父节点分支出来,它们的哈希值会被重新计算,并且任何克隆了你的版本库的人都可能得到该版本库的一个残破副本。第二,你没有“合并提交”,所以在将更改重放到主分支上时会识别出任何合并冲突,因此,你需要在进行变基rebase之前先修复它们。现在,当你现在推送你的修改时,你的工作不会出现在分支上,并且看起来像是你是在主分支的最新的提交上写入了所有的修改。 + +![Merge commits preserve history, and rebase rewrites history.][3] + +*合并提交(左)保留了历史,而变基(右)重写历史。* + +然而,这两种方式都有一个缺点:在你准备好分享代码之前,每个人都可以看到你在本地处理问题时的所有涂鸦和编辑。这就是 `git rebase` 的 `--interactive`(或简写 `-i`)标志发挥作用的地方。 + +### git rebase -i 登场 + +`git rebase` 的最大优点是它可以重写历史。但是,为什么仅止于假装你从后面的点分支出来呢?有一种更进一步方法可以重写你是如何准备就绪这些代码的:`git rebase -i`,即交互式的 `git rebase`。 + +这个功能就是 Git 中的 “魔术时光机” 功能。这个标志允许你在做变基时对修订历史记录进行复杂的修改。你可以隐藏你的错误! 将许多小的修改合并到一个崭新的功能补丁中! 重新排列修改历史记录中的显示顺序! + +![output of git rebase -i][4] + +当你运行 `git rebase -i` 时,你会进入一个编辑器会话,其中列出了所有正在被变基的提交,以及可以对其执行的操作的多个选项。默认的选择是选择(`Pick`)。 + +* `Pick`:会在你的历史记录中保留该提交。 +* `Reword`:允许你修改提交信息,可能是修复一个错别字或添加其它注释。 +* `Edit`:允许你在重放分支的过程中对提交进行修改。 +* `Squash`:可以将多个提交合并为一个。 +* 你可以通过在文件中移动来重新排序提交。 + +当你完成后,只需保存最终结果,变基操作就会执行。在你选择修改提交的每个阶段(无论是用 `reword`、`edit`、`squash` 还是发生冲突时),变基都会停止,并允许你在继续提交之前进行适当的修改。 + +上面这个例子的结果是 “One-liner bug fix” 和 “Integate new header everywhere” 被合并到一个提交中,而 “New header for docs website” 和 “D'oh - typo. Fixed” 合并到另一个提交中。就像变魔术一样,其他提交的工作还在你的分支中,但相关的提交已经从你的历史记录中消失了! + +这使得使用 `git send-email` 或者用你新整理好的补丁集在父版本库中创建一个拉取请求,然后来提交一个干净的补丁给上游项目变得很容易。这有很多好处,包括让你的代码更容易审核,更容易接受,也更容易合并。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/4/git-rebase-i + +作者:[Dave Neary][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/dneary +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/programming-code-keyboard-laptop.png?itok=pGfEfu2S (Hands programming) +[2]: https://opensource.com/sites/default/files/uploads/master-private-branches.png (Master branch vs. private branch) +[3]: https://opensource.com/sites/default/files/uploads/merge-commit-vs-rebase.png (Merge commits preserve history, and rebase rewrites history.) +[4]: https://opensource.com/sites/default/files/uploads/git-rebase-i.png (output of git rebase -i) diff --git a/published/202005/20200429 Why strace doesn-t work in Docker.md b/published/202005/20200429 Why strace doesn-t work in Docker.md new file mode 100644 index 0000000000..57e5a5b42e --- /dev/null +++ b/published/202005/20200429 Why strace doesn-t work in Docker.md @@ -0,0 +1,161 @@ +[#]: collector: (lujun9972) +[#]: translator: (wxy) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12251-1.html) +[#]: subject: (Why strace doesn't work in Docker) +[#]: via: (https://jvns.ca/blog/2020/04/29/why-strace-doesnt-work-in-docker/) +[#]: author: (Julia Evans https://jvns.ca/) + +为什么 strace 在 Docker 中不起作用? +====== + +在编辑“容器如何工作”爱好者杂志的能力页面时,我想试着解释一下为什么 `strace` 在 Docker 容器中无法工作。 + +这里的问题是 —— 如果我在笔记本上的 Docker 容器中运行 `strace`,就会出现这种情况: + +``` +$ docker run -it ubuntu:18.04 /bin/bash +$ # ... install strace ... +[email protected]:/# strace ls +strace: ptrace(PTRACE_TRACEME, ...): Operation not permitted +``` + +`strace` 通过 `ptrace` 系统调用起作用,所以如果不允许使用 `ptrace`,它肯定是不能工作的! 这个问题很容易解决 —— 在我的机器上,是这样解决的: + +``` +docker run --cap-add=SYS_PTRACE -it ubuntu:18.04 /bin/bash +``` + +但我对如何修复它不感兴趣,我想知道为什么会出现这种情况。为什么 `strace` 不能工作,为什么`--cap-add=SYS_PTRACE` 可以解决这个问题? + +### 假设 1:容器进程缺少 `CAP_SYS_PTRACE` 能力。 + +我一直以为原因是 Docker 容器进程默认不具备 `CAP_SYS_PTRACE` 能力。这和它可以被 `--cap-add=SYS_PTRACE` 修复是一回事,是吧? + +但这实际上是不合理的,原因有两个。 + +原因 1:在实验中,作为一个普通用户,我可以对我的用户运行的任何进程进行 `strace`。但如果我检查我的当前进程是否有 `CAP_SYS_PTRACE` 能力,则没有: + +``` +$ getpcaps $$ +Capabilities for `11589': = +``` + +原因 2:`capabilities` 的手册页对 `CAP_SYS_PTRACE` 的介绍是: + +``` +CAP_SYS_PTRACE + * Trace arbitrary processes using ptrace(2); +``` + +所以,`CAP_SYS_PTRACE` 的作用是让你像 root 一样,可以对任何用户拥有的**任意**进程进行 `ptrace`。你不需要用它来对一个只是由你的用户拥有的普通进程进行 `ptrace` 。 + +我用第三种方法测试了一下(LCTT 译注:此处可能原文有误) —— 我用 `docker run --cap-add=SYS_PTRACE -it ubuntu:18.04 /bin/bash` 运行了一个 Docker 容器,去掉了 `CAP_SYS_PTRACE` 能力,但我仍然可以跟踪进程,虽然我已经没有这个能力了。什么?为什么?! + +### 假设 2:关于用户命名空间的事情? + +我的下一个(没有那么充分的依据的)假设是“嗯,也许这个过程是在不同的用户命名空间里,而 `strace` 不能工作,因为某种原因而行不通?”这个问题其实并不相关,但这是我观察时想到的。 + +容器进程是否在不同的用户命名空间中?嗯,在容器中: + +``` +root@e27f594da870:/# ls /proc/$$/ns/user -l +... /proc/1/ns/user -> 'user:[4026531837]' +``` + +在宿主机: + +``` +bork@kiwi:~$ ls /proc/$$/ns/user -l +... /proc/12177/ns/user -> 'user:[4026531837]' +``` + +因为用户命名空间 ID(`4026531837`)是相同的,所以容器中的 root 用户和主机上的 root 用户是完全相同的用户。所以,绝对没有理由不能够对它创建的进程进行 `strace`! + +这个假设并没有什么意义,但我(之前)没有意识到 Docker 容器中的 root 用户和主机上的 root 用户同一个,所以我觉得这很有意思。 + +### 假设 3:ptrace 系统的调用被 seccomp-bpf 规则阻止了 + +我也知道 Docker 使用 seccomp-bpf 来阻止容器进程运行许多系统调用。而 `ptrace` 在[被 Docker 默认的 seccomp 配置文件阻止的系统调用列表][2]中!(实际上,允许的系统调用列表是一个白名单,所以只是`ptrace` 不在默认的白名单中。但得出的结果是一样的。) + +这很容易解释为什么 `strace` 在 Docker 容器中不能工作 —— 如果 `ptrace` 系统调用完全被屏蔽了,那么你当然不能调用它,`strace` 就会失败。 + +让我们来验证一下这个假设 —— 如果我们禁用了所有的 seccomp 规则,`strace` 能在 Docker 容器中工作吗? + +``` +$ docker run --security-opt seccomp=unconfined -it ubuntu:18.04 /bin/bash +$ strace ls +execve("/bin/ls", ["ls"], 0x7ffc69a65580 /* 8 vars */) = 0 +... it works fine ... +``` + +是的,很好用!很好。谜底解开了,除了..... + +### 为什么 `--cap-add=SYS_PTRACE` 能解决问题? + +我们还没有解释的是:为什么 `--cap-add=SYS_PTRACE` 可以解决这个问题? + +`docker run` 的手册页是这样解释 `--cap-add` 参数的。 + +``` +--cap-add=[] + Add Linux capabilities +``` + +这跟 seccomp 规则没有任何关系! 怎么回事? + +### 我们来看看 Docker 源码 + +当文档没有帮助的时候,唯一要做的就是去看源码。 + +Go 语言的好处是,因为依赖关系通常是在一个 Go 仓库里,你可以通过 `grep` 来找出做某件事的代码在哪里。所以我克隆了 `github.com/moby/moby`,然后对一些东西进行 `grep`,比如 `rg CAP_SYS_PTRACE`。 + +我认为是这样的。在 `containerd` 的 seccomp 实现中,在 [contrib/seccomp/seccomp/seccomp_default.go][3] 中,有一堆代码来确保如果一个进程有一个能力,那么它也会(通过 seccomp 规则)获得访问权限,以使用与该能力相关的系统调用。 + +``` +case "CAP_SYS_PTRACE": + s.Syscalls = append(s.Syscalls, specs.LinuxSyscall{ + Names: []string{ + "kcmp", + "process_vm_readv", + "process_vm_writev", + "ptrace", + }, + Action: specs.ActAllow, + Args: []specs.LinuxSeccompArg{}, + }) +``` + +在 moby 中的 [profile/seccomp/seccomp.go][4] 和 [默认的 seccomp 配置文件][5]中,也有一些其他的代码似乎做了一些非常类似的事情,所以有可能就是这个代码在做这个事情。 + +所以我想我们有答案了! + +### Docker 中的 `--cap-add` 做的事情比它说的要多 + +结果似乎是,`--cap-add` 并不像手册页里说的那样,它更像是 `--cap-add-and-also-whiteelist-some-extra-system-calls-if-required`。这很有意义! 如果你具有一个像 `--CAP_SYS_PTRACE` 这样的能力,可以让你使用 `process_vm_readv` 系统调用,但是该系统调用被 seccomp 配置文件阻止了,那对你没有什么帮助! + +所以当你给容器 `CAP_SYS_PTRACE` 能力时,允许使用 `process_vm_readv` 和 `ptrace` 系统调用似乎是一个合理的选择。 + +### 就这样! + +这是个有趣的小事情,我认为这是一个很好的例子,说明了容器是由许多移动的部件组成的,它们以不完全显而易见的方式一起工作。 + +-------------------------------------------------------------------------------- + +via: https://jvns.ca/blog/2020/04/29/why-strace-doesnt-work-in-docker/ + +作者:[Julia Evans][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://jvns.ca/ +[b]: https://github.com/lujun9972 +[1]: https://wizardzines.com/zines/containers +[2]: https://docs.docker.com/engine/security/seccomp/ +[3]: https://github.com/containerd/containerd/blob/4be98fa28b62e8a012491d655a4d6818ef87b080/contrib/seccomp/seccomp_default.go#L527-L537 +[4]: https://github.com/moby/moby/blob/cc0dfb6e7b22ad120c60a9ce770ea15415767cf9/profiles/seccomp/seccomp.go#L126-L132 +[5]: https://github.com/moby/moby/blob/master/profiles/seccomp/default.json#L723-L739 diff --git a/published/202005/20200430 10 ways to analyze binary files on Linux.md b/published/202005/20200430 10 ways to analyze binary files on Linux.md new file mode 100644 index 0000000000..35fedf607a --- /dev/null +++ b/published/202005/20200430 10 ways to analyze binary files on Linux.md @@ -0,0 +1,314 @@ +[#]: collector: (lujun9972) +[#]: translator: (wxy) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12187-1.html) +[#]: subject: (10 ways to analyze binary files on Linux) +[#]: via: (https://opensource.com/article/20/4/linux-binary-analysis) +[#]: author: (Gaurav Kamathe https://opensource.com/users/gkamathe) + +在 Linux 上分析二进制文件的 10 种方法 +====== + +> 这些简单的命令和工具可以帮助你轻松完成分析二进制文件的任务。 + +![](https://img.linux.net.cn/data/attachment/album/202005/05/232115nn0oduodo4oztv0a.jpg) + +“这个世界上有 10 种人:懂二进制的人和不懂二进制的人。” + +我们每天都在与二进制文件打交道,但我们对二进制文件却知之甚少。我所说的二进制,是指你每天运行的可执行文件,从命令行工具到成熟的应用程序都是。 + +Linux 提供了一套丰富的工具,让分析二进制文件变得轻而易举。无论你的工作角色是什么,如果你在 Linux 上工作,了解这些工具的基本知识将帮助你更好地理解你的系统。 + +在这篇文章中,我们将介绍其中一些最流行的 Linux 工具和命令,其中大部分都是 Linux 发行版的一部分。如果没有找到,你可以随时使用你的软件包管理器来安装和探索它们。请记住:学习在正确的场合使用正确的工具需要大量的耐心和练习。 + +### file + +它的作用:帮助确定文件类型。 + +这将是你进行二进制分析的起点。我们每天都在与文件打交道,并非所有的文件都是可执行类型,除此之外还有各种各样的文件类型。在你开始之前,你需要了解要分析的文件类型。是二进制文件、库文件、ASCII 文本文件、视频文件、图片文件、PDF、数据文件等文件吗? + +`file` 命令将帮助你确定你所处理的文件类型。 + +``` +$ file /bin/ls +/bin/ls: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.32, BuildID[sha1]=94943a89d17e9d373b2794dcb1f7e38c95b66c86, stripped +$ +$ file /etc/passwd +/etc/passwd: ASCII text +$ +``` + +### ldd + +它的作用:打印共享对象依赖关系。 + +如果你已经在一个可执行的二进制文件上使用了上面的 `file` 命令,你肯定会看到输出中的“动态链接dynamically linked”信息。它是什么意思呢? + +在开发软件的时候,我们尽量不要重造轮子。有一组常见的任务是大多数软件程序需要的,比如打印输出或从标准输入/打开的文件中读取等。所有这些常见的任务都被抽象成一组通用的函数,然后每个人都可以使用,而不是写出自己的变体。这些常用的函数被放在一个叫 `libc` 或 `glibc` 的库中。 + +如何找到可执行程序所依赖的库?这就是 `ldd` 命令的作用了。对动态链接的二进制文件运行该命令会显示出所有依赖库和它们的路径。 + +``` +$ ldd /bin/ls + linux-vdso.so.1 => (0x00007ffef5ba1000) + libselinux.so.1 => /lib64/libselinux.so.1 (0x00007fea9f854000) + libcap.so.2 => /lib64/libcap.so.2 (0x00007fea9f64f000) + libacl.so.1 => /lib64/libacl.so.1 (0x00007fea9f446000) + libc.so.6 => /lib64/libc.so.6 (0x00007fea9f079000) + libpcre.so.1 => /lib64/libpcre.so.1 (0x00007fea9ee17000) + libdl.so.2 => /lib64/libdl.so.2 (0x00007fea9ec13000) + /lib64/ld-linux-x86-64.so.2 (0x00007fea9fa7b000) + libattr.so.1 => /lib64/libattr.so.1 (0x00007fea9ea0e000) + libpthread.so.0 => /lib64/libpthread.so.0 (0x00007fea9e7f2000) +$ +``` + +### ltrace + +它的作用:库调用跟踪器。 + +我们现在知道如何使用 `ldd` 命令找到一个可执行程序所依赖的库。然而,一个库可以包含数百个函数。在这几百个函数中,哪些是我们的二进制程序正在使用的实际函数? + +`ltrace` 命令可以显示运行时从库中调用的所有函数。在下面的例子中,你可以看到被调用的函数名称,以及传递给该函数的参数。你也可以在输出的最右边看到这些函数返回的内容。 + +``` +$ ltrace ls +__libc_start_main(0x4028c0, 1, 0x7ffd94023b88, 0x412950 +strrchr("ls", '/') = nil +setlocale(LC_ALL, "") = "en_US.UTF-8" +bindtextdomain("coreutils", "/usr/share/locale") = "/usr/share/locale" +textdomain("coreutils") = "coreutils" +__cxa_atexit(0x40a930, 0, 0, 0x736c6974756572) = 0 +isatty(1) = 1 +getenv("QUOTING_STYLE") = nil +getenv("COLUMNS") = nil +ioctl(1, 21523, 0x7ffd94023a50) = 0 +<< snip >> +fflush(0x7ff7baae61c0) = 0 +fclose(0x7ff7baae61c0) = 0 ++++ exited (status 0) +++ +$ +``` + +### hexdump + +它的作用:以 ASCII、十进制、十六进制或八进制显示文件内容。 + +通常情况下,当你用一个应用程序打开一个文件,而它不知道如何处理该文件时,就会出现这种情况。尝试用 `vim` 打开一个可执行文件或视频文件,你屏幕上会看到的只是抛出的乱码。 + +在 `hexdump` 中打开未知文件,可以帮助你看到文件的具体内容。你也可以选择使用一些命令行选项来查看用 ASCII 表示的文件数据。这可能会帮助你了解到它是什么类型的文件。 + +``` +$ hexdump -C /bin/ls | head +00000000  7f 45 4c 46 02 01 01 00  00 00 00 00 00 00 00 00  |.ELF............| +00000010  02 00 3e 00 01 00 00 00  d4 42 40 00 00 00 00 00  |..>......B@.....| +00000020  40 00 00 00 00 00 00 00  f0 c3 01 00 00 00 00 00  |@...............| +00000030  00 00 00 00 40 00 38 00  09 00 40 00 1f 00 1e 00  |....@.8...@.....| +00000040  06 00 00 00 05 00 00 00  40 00 00 00 00 00 00 00  |........@.......| +00000050  40 00 40 00 00 00 00 00  40 00 40 00 00 00 00 00  |@.@.....@.@.....| +00000060  f8 01 00 00 00 00 00 00  f8 01 00 00 00 00 00 00  |................| +00000070  08 00 00 00 00 00 00 00  03 00 00 00 04 00 00 00  |................| +00000080  38 02 00 00 00 00 00 00  38 02 40 00 00 00 00 00  |8.......8.@.....| +00000090  38 02 40 00 00 00 00 00  1c 00 00 00 00 00 00 00  |8.@.............| +$ +``` + +### strings + +它的作用:打印文件中的可打印字符的字符串。 + +如果你只是在二进制中寻找可打印的字符,那么 `hexdump` 对于你的使用场景来说似乎有点矫枉过正,你可以使用 `strings` 命令。 + +在开发软件的时候,各种文本/ASCII 信息会被添加到其中,比如打印信息、调试信息、帮助信息、错误等。只要这些信息都存在于二进制文件中,就可以用 `strings` 命令将其转储到屏幕上。 + +``` +$ strings /bin/ls +``` + +### readelf + +它的作用:显示有关 ELF 文件的信息。 + +ELF(可执行和可链接文件格式Executable and Linkable File Format)是可执行文件或二进制文件的主流格式,不仅是 Linux 系统,也是各种 UNIX 系统的主流文件格式。如果你已经使用了像 `file` 命令这样的工具,它告诉你文件是 ELF 格式,那么下一步就是使用 `readelf` 命令和它的各种选项来进一步分析文件。 + +在使用 `readelf` 命令时,有一份实际的 ELF 规范的参考是非常有用的。你可以在[这里][2]找到该规范。  + +``` +$ readelf -h /bin/ls +ELF Header: +  Magic:   7f 45 4c 46 02 01 01 00 00 00 00 00 00 00 00 00 +  Class:                             ELF64 +  Data:                              2's complement, little endian +  Version:                           1 (current) +  OS/ABI:                            UNIX - System V +  ABI Version:                       0 +  Type:                              EXEC (Executable file) +  Machine:                           Advanced Micro Devices X86-64 +  Version:                           0x1 +  Entry point address:               0x4042d4 +  Start of program headers:          64 (bytes into file) +  Start of section headers:          115696 (bytes into file) +  Flags:                             0x0 +  Size of this header:               64 (bytes) +  Size of program headers:           56 (bytes) +  Number of program headers:         9 +  Size of section headers:           64 (bytes) +  Number of section headers:         31 +  Section header string table index: 30 +$ +``` + +### objdump + +它的作用:从对象文件中显示信息。 + +二进制文件是通过你编写的源码创建的,这些源码会通过一个叫做编译器的工具进行编译。这个编译器会生成相对于源代码的机器语言指令,然后由 CPU 执行特定的任务。这些机器语言代码可以通过被称为汇编语言的助记词来解读。汇编语言是一组指令,它可以帮助你理解由程序所进行并最终在 CPU 上执行的操作。 + +`objdump` 实用程序读取二进制或可执行文件,并将汇编语言指令转储到屏幕上。汇编语言知识对于理解 `objdump` 命令的输出至关重要。 + +请记住:汇编语言是特定于体系结构的。 + +``` +$ objdump -d /bin/ls | head + +/bin/ls: file format elf64-x86-64 + +Disassembly of section .init: + +0000000000402150 <_init@@Base>: + 402150: 48 83 ec 08 sub $0x8,%rsp + 402154: 48 8b 05 6d 8e 21 00 mov 0x218e6d(%rip),%rax # 61afc8 <__gmon_start__> + 40215b: 48 85 c0 test %rax,%rax +$ +``` + +### strace + +它的作用:跟踪系统调用和信号。 + +如果你用过前面提到的 `ltrace`,那就把 `strace` 想成是类似的。唯一的区别是,`strace` 工具不是追踪调用的库,而是追踪系统调用。系统调用是你与内核对接来完成工作的。 + +举个例子,如果你想把一些东西打印到屏幕上,你会使用标准库 `libc` 中的 `printf` 或 `puts` 函数;但是,在底层,最终会有一个名为 `write` 的系统调用来实际把东西打印到屏幕上。 + +``` +$ strace -f /bin/ls +execve("/bin/ls", ["/bin/ls"], [/* 17 vars */]) = 0 +brk(NULL) = 0x686000 +mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f967956a000 +access("/etc/ld.so.preload", R_OK) = -1 ENOENT (No such file or directory) +open("/etc/ld.so.cache", O_RDONLY|O_CLOEXEC) = 3 +fstat(3, {st_mode=S_IFREG|0644, st_size=40661, ...}) = 0 +mmap(NULL, 40661, PROT_READ, MAP_PRIVATE, 3, 0) = 0x7f9679560000 +close(3) = 0 +<< snip >> +fstat(1, {st_mode=S_IFCHR|0620, st_rdev=makedev(136, 1), ...}) = 0 +mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f9679569000 +write(1, "R2 RH\n", 7R2 RH +) = 7 +close(1) = 0 +munmap(0x7f9679569000, 4096) = 0 +close(2) = 0 +exit_group(0) = ? ++++ exited with 0 +++ +$ +``` + +### nm + +它的作用:列出对象文件中的符号。 + +如果你所使用的二进制文件没有被剥离,`nm` 命令将为你提供在编译过程中嵌入到二进制文件中的有价值的信息。`nm` 可以帮助你从二进制文件中识别变量和函数。你可以想象一下,如果你无法访问二进制文件的源代码时,这将是多么有用。 + +为了展示 `nm`,我们快速编写了一个小程序,用 `-g` 选项编译,我们会看到这个二进制文件没有被剥离。 + +``` +$ cat hello.c +#include + +int main() { + printf("Hello world!"); + return 0; +} +$ +$ gcc -g hello.c -o hello +$ +$ file hello +hello: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.32, BuildID[sha1]=3de46c8efb98bce4ad525d3328121568ba3d8a5d, not stripped +$ +$ ./hello +Hello world!$ +$ + + +$ nm hello | tail +0000000000600e20 d __JCR_END__ +0000000000600e20 d __JCR_LIST__ +00000000004005b0 T __libc_csu_fini +0000000000400540 T __libc_csu_init + U __libc_start_main@@GLIBC_2.2.5 +000000000040051d T main + U printf@@GLIBC_2.2.5 +0000000000400490 t register_tm_clones +0000000000400430 T _start +0000000000601030 D __TMC_END__ +$ +``` + +### gdb + +它的作用:GNU 调试器。 + +好吧,不是所有的二进制文件中的东西都可以进行静态分析。我们确实执行了一些运行二进制文件(进行分析)的命令,比如 `ltrace` 和 `strace`;然而,软件由各种条件组成,这些条件可能会导致执行不同的替代路径。 + +分析这些路径的唯一方法是在运行时环境,在任何给定的位置停止或暂停程序,并能够分析信息,然后再往下执行。 + +这就是调试器的作用,在 Linux 上,`gdb` 就是调试器的事实标准。它可以帮助你加载程序,在特定的地方设置断点,分析内存和 CPU 的寄存器,以及更多的功能。它是对上面提到的其他工具的补充,可以让你做更多的运行时分析。 + +有一点需要注意的是,一旦你使用 `gdb` 加载一个程序,你会看到它自己的 `(gdb)` 提示符。所有进一步的命令都将在这个 `gdb` 命令提示符中运行,直到你退出。 + +我们将使用我们之前编译的 `hello` 程序,使用 `gdb` 来看看它的工作原理。 + +``` +$ gdb -q ./hello +Reading symbols from /home/flash/hello...done. +(gdb) break main +Breakpoint 1 at 0x400521: file hello.c, line 4. +(gdb) info break +Num Type Disp Enb Address What +1 breakpoint keep y 0x0000000000400521 in main at hello.c:4 +(gdb) run +Starting program: /home/flash/./hello + +Breakpoint 1, main () at hello.c:4 +4 printf("Hello world!"); +Missing separate debuginfos, use: debuginfo-install glibc-2.17-260.el7_6.6.x86_64 +(gdb) bt +#0 main () at hello.c:4 +(gdb) c +Continuing. +Hello world![Inferior 1 (process 29620) exited normally] +(gdb) q +$ +``` + +### 结语 + +一旦你习惯了使用这些原生的 Linux 二进制分析工具,并理解了它们提供的输出,你就可以转向更高级和专业的开源二进制分析工具,比如 [radare2][3]。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/4/linux-binary-analysis + +作者:[Gaurav Kamathe][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/gkamathe +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/tux_linux_penguin_code_binary.jpg?itok=TxGxW0KY (Tux with binary code background) +[2]: http://www.skyfree.org/linux/references/ELF_Format.pdf +[3]: https://github.com/radareorg/radare2 diff --git a/published/202005/20200430 Three Methods Boot CentOS-RHEL 7-8 Systems in Single User Mode.md b/published/202005/20200430 Three Methods Boot CentOS-RHEL 7-8 Systems in Single User Mode.md new file mode 100644 index 0000000000..4b7edb67e9 --- /dev/null +++ b/published/202005/20200430 Three Methods Boot CentOS-RHEL 7-8 Systems in Single User Mode.md @@ -0,0 +1,165 @@ +[#]: collector: (lujun9972) +[#]: translator: (lxbwolf) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12181-1.html) +[#]: subject: (Three Methods Boot CentOS/RHEL 7/8 Systems in Single User Mode) +[#]: via: (https://www.2daygeek.com/boot-centos-7-8-rhel-7-8-single-user-mode/) +[#]: author: (Magesh Maruthamuthu https://www.2daygeek.com/author/magesh/) + +以单用户模式启动 CentOS/RHEL 7/8 的三种方法 +====== + +![](https://img.linux.net.cn/data/attachment/album/202005/03/230109uw1f9zvv9upbhwv8.jpg) + +单用户模式,也被称为维护模式,超级用户可以在此模式下恢复/修复系统问题。 + +通常情况下,这类问题在多用户环境中修复不了。系统可以启动但功能不能正常运行或者你登录不了系统。 + +在基于 [Red Hat][1](RHEL)7/8 的系统中,使用 `runlevel1.target` 或 `rescue.target` 来实现。 + +在此模式下,系统会挂载所有的本地文件系统,但不开启网络接口。 + +系统仅启动特定的几个服务和修复系统必要的尽可能少的功能。 + +当你想运行文件系统一致性检查来修复损坏的文件系统,或忘记 root 密码后重置密码,或要修复系统上的一个挂载点问题时,这个方法会很有用。 + +你可以用下面三种方法以单用户模式启动 [CentOS][2]/[RHEL][3] 7/8 系统。 + + * 方法 1:通过向内核添加 `rd.break` 参数来以单用户模式启动 CentOS/RHEL 7/8 系统 + * 方法 2:通过用 `init=/bin/bash` 或 `init=/bin/sh` 替换内核中的 `rhgb quiet` 语句来以单用户模式启动 CentOS/RHEL 7/8 系统 + * 方法 3:通过用 `rw init=/sysroot/bin/sh` 参数替换内核中的 `ro` 语句以单用户模式启动 CentOS/RHEL 7/8 系统 + +### 方法 1 + +通过向内核添加 `rd.break` 参数来以单用户模式启动 CentOS/RHEL 7/8 系统。 + +重启你的系统,在 GRUB2 启动界面,按下 `e` 键来编辑选中的内核。你需要选中第一行,第一个是最新的内核,然而如果你想用旧的内核启动系统你也可以选择其他的行。 + +![](https://www.2daygeek.com/wp-content/uploads/2018/12/reset-forgotten-root-password-on-rhel-7-centos-7-2.png) + +根据你的 RHEL/CentOS 版本,找到 `linux16` 或 `linux` 语句,按下键盘上的 `End` 键,跳到行末,像下面截图中展示的那样添加关键词 `rd.break`,按下 `Ctrl+x` 或 `F10` 来进入单用户模式。 + +如果你的系统是 RHEL/CentOS 7,你需要找 `linux16`,如果你的系统是 RHEL/CentOS 8,那么你需要找 `linux`。 + +![](https://www.2daygeek.com/wp-content/uploads/2018/12/reset-forgotten-root-password-on-rhel-7-centos-7-3.png) + +这个修改会让你的 root 文件系统以 “只读(`ro`)” 模式挂载。你可以用下面的命令来验证下。下面的输出也明确地告诉你当前是在 “紧急模式Emergency Mode”。 + +``` +# mount | grep root +``` + +![](https://www.2daygeek.com/wp-content/uploads/2018/12/reset-forgotten-root-password-on-rhel-7-centos-7-5.png) + +为了修改 `sysroot` 文件系统,你需要用读写模式(`rw`)重新挂载它。 + +``` +# mount -o remount,rw /sysroot +``` + +运行下面的命令修改环境,这就是大家熟知的 “监禁目录” 或 “chroot 监狱”。 + +``` +# chroot /sysroot +``` + +![](https://www.2daygeek.com/wp-content/uploads/2018/12/reset-forgotten-root-password-on-rhel-7-centos-7-8.png) + +现在,单用户模式已经完全准备好了。当你修复了你的问题要退出单用户模式时,执行下面的步骤。 + +CentOS/RHEL 7/8 默认使用 SELinux,因此创建下面的隐藏文件,这个文件会在下一次启动时重新标记所有文件。 + +``` +# touch /.autorelabel +``` + +最后,用下面的命令重启系统。你也可以输入两次 `exit` 命令来重启你的系统。 + +``` +# reboot -f +``` + +### 方法 2 + +通过用 `init=/bin/bash` 或 `init=/bin/sh` 替换内核中的 `rhgb quiet` 语句来以单用户模式启动 CentOS/RHEL 7/8 系统。 + +重启你的系统,在 GRUB2 启动界面,按下 `e` 键来编辑选中的内核。 + +![](https://www.2daygeek.com/wp-content/uploads/2018/12/reset-forgotten-root-password-on-rhel-7-centos-7-2.png) + +找到语句 `rhgb quiet`,用 `init=/bin/bash` 或 `init=/bin/sh` 替换它,然后按下 `Ctrl+x` 或 `F10` 来进入单用户模式。 + +`init=/bin/bash` 的截图。 + +![](https://www.2daygeek.com/wp-content/uploads/2018/12/method-reset-forgotten-root-password-on-rhel-7-centos-7-1.png) + +`init=/bin/sh` 的截图。 + +![](https://www.2daygeek.com/wp-content/uploads/2018/12/method-reset-forgotten-root-password-on-rhel-7-centos-7-1a.png) + +默认情况下,上面的操作会以只读(`ro`)模式挂载你的 `/` 分区,因此你需要以读写(`rw`)模式重新挂载 `/` 文件系统,这样才能修改它。 + +``` +# mount -o remount,rw / +``` + +![](https://www.2daygeek.com/wp-content/uploads/2018/12/method-reset-forgotten-root-password-on-rhel-7-centos-7-4.png) + +现在你可以执行你的任务了。当结束时,执行下面的命令来开启重启时的 SELinux 重新标记。 + +``` +# touch /.autorelabel +``` + +最后,重启系统。 + +``` +# exec /sbin/init 6 +``` + +### 方法 3 + +通过用 `rw init=/sysroot/bin/sh` 参数替换内核中的 `ro` 单词,以单用户模式启动 CentOS/RHEL 7/8 系统。 + +为了中断自动启动的过程,重启你的系统并在 GRUB2 启动界面按下任意键。 + +现在会展示你系统上所有可用的内核,选择最新的内核,按下 `e` 键来编辑选中的内核参数。 + +找到以 `linux` 或 `linux16` 开头的语句,用 `rw init=/sysroot/bin/sh` 替换 `ro`。替换完后按下 `Ctrl+x` 或 `F10` 来进入单用户模式。 + +运行下面的命令把环境切换为 “chroot 监狱”。 + +``` +# chroot /sysroot +``` + +如果需要,做出必要的修改。修改完后,执行下面的命令来开启重启时的 SELinux 重新标记。 + +``` +# touch /.autorelabel +``` + +最后,重启系统。 + +``` +# reboot -f +``` + +-------------------------------------------------------------------------------- + +via: https://www.2daygeek.com/boot-centos-7-8-rhel-7-8-single-user-mode/ + +作者:[Magesh Maruthamuthu][a] +选题:[lujun9972][b] +译者:[lxbwolf](https://github.com/lxbwolf) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://www.2daygeek.com/author/magesh/ +[b]: https://github.com/lujun9972 +[1]: https://www.2daygeek.com/category/red-hat/ +[2]: https://www.2daygeek.com/category/centos/ +[3]: https://www.2daygeek.com/category/rhel/ +[4]: data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7 diff --git a/published/202005/20200501 How to Handle Automatic Updates in Ubuntu.md b/published/202005/20200501 How to Handle Automatic Updates in Ubuntu.md new file mode 100644 index 0000000000..4339c22494 --- /dev/null +++ b/published/202005/20200501 How to Handle Automatic Updates in Ubuntu.md @@ -0,0 +1,129 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12257-1.html) +[#]: subject: (How to Handle Automatic Updates in Ubuntu) +[#]: via: (https://itsfoss.com/auto-updates-ubuntu/) +[#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/) + +如何在 Ubuntu 中处理自动的无人值守升级 +====== + +> 本教程教你如何处理无人值守的升级,即 Ubuntu Linux 的自动系统更新。 + +![](https://img.linux.net.cn/data/attachment/album/202005/27/234040fxb0nkc53pk0nxvx.jpg) + +有时,当你尝试[关闭 Ubuntu 系统][1]时,可能看到这个阻止你关闭的页面: + +> 关机过程中正在进行无人值守升级,请不要关闭计算机。 + +![Unattended Upgrade In Progress In Ubuntu][2] + +你可能会问这个“无人值守升级”是什么,怎么会在你不知情的情况下运行呢? + +原因是 [Ubuntu][3] 非常重视系统的安全性。默认情况下,它会每天自动检查系统更新,如果发现安全更新,它会下载这些更新并自行安装。对于正常的系统和应用更新,它会通过软件更新程序通知你。 + +由于所有这些都是在后台发生的,所以在你尝试关闭系统或尝试自行安装应用程序之前,你甚至不会意识到这一点。 + +在这些无人值守的升级过程中,尝试安装新软件,会导致著名的[无法获得锁定的错误][4]。 + +![][5] + +如你所见,自动更新带来了一些小麻烦。你可以选择禁用自动更新,但这意味着你必须一直手动检查并[更新你的 Ubuntu 系统][6]。 + +> **你真的需要禁用自动更新吗?** +> +> 请注意,这是一项安全功能。Linux 实际上允许你禁用系统中的所有功能,甚至禁用这些安全功能。 +> +> 但是我认为,作为普通用户,**你不应该禁用自动更新**。毕竟,它可以确保你的系统安全。 +> +> 为了确保系统的安全性,你可以忍受自动更新所带来的小麻烦。 + +现在,你已经收到警告,还是觉得承担手动更新系统的额外任务更好,那么让我们看看如何处理自动更新。 + +与往常一样,有两种方法可以做到:GUI 和命令行。 我将向你展示两种方法。 + +我在这里使用 Ubuntu 20.04,但是这些步骤对 Ubuntu 18.04 和任何其他 Ubuntu 版本均有效。 + +### 方法 1:以图形方式禁用 Ubuntu 中的自动更新 + +进入菜单并查找“软件和更新”工具。 + +![Software & Updates Settings][7] + +在此处,进入“更新”选项卡。查找“自动检查更新”。默认情况下,它设置为“每日”。 + +你可以将其更改为“从不”,你的系统将永远不会检查更新。如果不检查更新,它就不会找到要安装的新的更新。 + +![Disable Auto Updates in Ubuntu Completely][8] + +如果这样做,那么必须不时手动更新系统。但是,这是额外的工作,你可能不会一直记得。 + +#### 在 Ubuntu 中处理自动更新的更好方法 + +就个人而言,我建议让它自己检查更新。如果你不希望它自动安装更新,那么可以更改该行为,以通知有关安全更新的可用性。 + +保持“自动检查更新”为“每日”,然后将“有安全更新时”选项更改为“立即显示”,而不是“自动下载并安装”。 + +![Get notified for security updates instead of automatically installing them][9] + +这样,它会检查是否有更新,而不是在后台自动安装更新,软件更新程序会通知你有可用于系统的更新。而你的系统已经完成正常的系统和软件更新。 + +![Get notified about security updates][10] + +使用此设置,关闭系统时将不会看到“正在进行的无人值守升级”。但是,由于两个不同的进程无法同时使用 apt 包管理器,因此你仍然可能会遇到“无法锁定”错误。 + +我相信这是一个更好的解决方案,你不认为是么? + +如我承诺的同时有 GUI 和命令行方法一样,让我向你展示如何在终端中禁用无人值守的升级。 + +### 如何在 Ubuntu 中使用命令行禁用自动更新 + +你可以在 `/etc/apt/apt.conf.d/20auto-upgrades` 中找到自动升级设置。Ubuntu 终端中的默认文本编辑器是 Nano,因此你可以使用以下命令来编辑此文件: + +``` +sudo nano /etc/apt/apt.conf.d/20auto-upgrades +``` + +现在,如果你不希望系统自动检查更新,那么可以将 `APT::Periodic::Update-Package-Lists` 的值更改为 `"0"`。 + +``` +APT::Periodic::Update-Package-Lists "0"; +APT::Periodic::Unattended-Upgrade "0"; +``` + +如果你希望它检查更新但不自动安装无人值守的升级,那么可以选择将其设置为: + +``` +APT::Periodic::Update-Package-Lists "1"; +APT::Periodic::Unattended-Upgrade "0"; +``` + +### 最后 + +由于某种原因,启用了自动安全更新,建议你保持这种状态。这个小烦恼实际上并不值得冒险损害系统安全性。你怎么看? + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/auto-updates-ubuntu/ + +作者:[Abhishek Prakash][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://itsfoss.com/author/abhishek/ +[b]: https://github.com/lujun9972 +[1]: https://itsfoss.com/schedule-shutdown-ubuntu/ +[2]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/04/unattended-upgrade-in-progress-in-ubuntu.png?ssl=1 +[3]: https://ubuntu.com/ +[4]: https://itsfoss.com/could-not-get-lock-error/ +[5]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/12/Could_not_get_lock.jpg?ssl=1 +[6]: https://itsfoss.com/update-ubuntu/ +[7]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/04/software-updates-settings-ubuntu-20-04.jpg?ssl=1 +[8]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/04/disable-auto-updates-ubuntu.jpg?ssl=1 +[9]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/04/handle-auto-updates-ubuntu.jpg?ssl=1 +[10]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/04/updates-available-ubuntu.png?ssl=1 diff --git a/published/202005/20200501 Using mergerfs to increase your virtual storage.md b/published/202005/20200501 Using mergerfs to increase your virtual storage.md new file mode 100644 index 0000000000..de9b8af2c7 --- /dev/null +++ b/published/202005/20200501 Using mergerfs to increase your virtual storage.md @@ -0,0 +1,143 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12207-1.html) +[#]: subject: (Using mergerfs to increase your virtual storage) +[#]: via: (https://fedoramagazine.org/using-mergerfs-to-increase-your-virtual-storage/) +[#]: author: (Curt Warfield https://fedoramagazine.org/author/rcurtiswarfield/) + +使用 mergefs 增加虚拟存储 +====== + +![][1] + +如果你想在一个媒体项目中用到了多个磁盘或分区,不想丢失任何现有数据,但又想将所有文件都存放在一个驱动器下,该怎么办?这时,mergefs 就能派上用场! + +[mergerfs][2] 是一个联合文件系统,旨在简化存储和管理众多商业存储设备上的文件。 + +你需要从他们的 [GitHub][3] 页面获取最新的 RPM。Fedora 的版本名称中带有 “fc” 和版本号。例如,这是 Fedora 31 的版本: [mergerfs-2.29.0-1.fc31.x86_64.rpm][4]。 + +### 安装和配置 mergefs + +使用 `sudo` 安装已下载的 mergefs 软件包: + +``` +$ sudo dnf install mergerfs-2.29.0-1.fc31.x86_64.rpm +``` + +现在,你可以将多个磁盘挂载为一个驱动器。如果你有一台媒体服务器,并且希望所有媒体文件都显示在一个地方,这将很方便。如果将新文件上传到系统,那么可以将它们复制到 mergefs 目录,mergefs 会自动将它们复制具有足够可用空间的磁盘上。 + +这是使你更容易理解的例子: + +``` +$ df -hT | grep disk +/dev/sdb1 ext4 23M 386K 21M 2% /disk1 +/dev/sdc1 ext4 44M 1.1M 40M 3% /disk2 + +$ ls -l /disk1/Videos/ +total 1 +-rw-r--r--. 1 curt curt 0 Mar 8 17:17 Our Wedding.mkv + +$ ls -l /disk2/Videos/ +total 2 +-rw-r--r--. 1 curt curt 0 Mar 8 17:17 Baby's first Xmas.mkv +-rw-rw-r--. 1 curt curt 0 Mar 8 17:21 Halloween hijinks.mkv +``` + +在此例中挂载了两块磁盘,分别为 `disk1` 和 `disk2`。两个驱动器都有一个包含文件的 `Videos` 目录。 + +现在,我们将使用 mergefs 挂载这些驱动器,使它们看起来像一个更大的驱动器。 + +``` +$ sudo mergerfs -o defaults,allow_other,use_ino,category.create=mfs,moveonenospc=true,minfreespace=1M /disk1:/disk2 /media +``` + +mergefs 手册页非常庞杂,因此我们将说明上面提到的选项。 + + * `defaults`:除非指定,否则将使用默认设置。 + * `allow_other`:允许 `sudo` 或 `root` 以外的用户查看文件系统。 + * `use_ino`:让 mergefs 提供文件/目录 inode 而不是 libfuse。虽然不是默认值,但建议你启用它,以便链接的文件共享相同的 inode 值。 + * `category.create=mfs`:根据可用空间在驱动器间传播文件。 + * `moveonenospc=true`:如果启用,那么如果写入失败,将进行扫描以查找具有最大可用空间的驱动器。 + * `minfreespace=1M`:最小使用空间值。 + * `disk1`:第一块硬盘。 + * `disk2`:第二块硬盘。 + * `/media`:挂载驱动器的目录。 + +看起来是这样的: + +``` +$ df -hT | grep disk +/dev/sdb1 ext4 23M 386K 21M 2% /disk1 +/dev/sdc1 ext4 44M 1.1M 40M 3% /disk2 + +$ df -hT | grep media +1:2 fuse.mergerfs 66M 1.4M 60M 3% /media +``` + +你可以看到现在 mergefs 挂载显示的总容量为 66M,这是两块硬盘的总容量。 + +继续示例: + +有一个叫 `Baby's second Xmas.mkv` 的 30M 视频。让我们将其复制到用 mergerfs 挂载的 `/media` 文件夹中。 + +``` +$ ls -lh "Baby's second Xmas.mkv" +-rw-rw-r--. 1 curt curt 30M Apr 20 08:45 Baby's second Xmas.mkv +$ cp "Baby's second Xmas.mkv" /media/Videos/ +``` + +这是最终结果: + +``` +$ df -hT | grep disk +/dev/sdb1 ext4 23M 386K 21M 2% /disk1 +/dev/sdc1 ext4 44M 31M 9.8M 76% /disk2 + +$ df -hT | grep media +1:2 fuse.mergerfs 66M 31M 30M 51% /media +``` + +从磁盘空间利用率中可以看到,因为 `disk1` 没有足够的可用空间,所以 mergefs 自动将文件复制到 `disk2`。 + +这是所有文件详情: + +``` +$ ls -l /disk1/Videos/ +total 1 +-rw-r--r--. 1 curt curt 0 Mar 8 17:17 Our Wedding.mkv + +$ ls -l /disk2/Videos/ +total 30003 +-rw-r--r--. 1 curt curt 0 Mar 8 17:17 Baby's first Xmas.mkv +-rw-rw-r--. 1 curt curt 30720000 Apr 20 08:47 Baby's second Xmas.mkv +-rw-rw-r--. 1 curt curt 0 Mar 8 17:21 Halloween hijinks.mkv + +$ ls -l /media/Videos/ +total 30004 +-rw-r--r--. 1 curt curt 0 Mar 8 17:17 Baby's first Xmas.mkv +-rw-rw-r--. 1 curt curt 30720000 Apr 20 08:47 Baby's second Xmas.mkv +-rw-rw-r--. 1 curt curt 0 Mar 8 17:21 Halloween hijinks.mkv +-rw-r--r--. 1 curt curt 0 Mar 8 17:17 Our Wedding.mkv +``` + +当你将文件复制到 mergefs 挂载点时,它将始终将文件复制到有足够可用空间的硬盘上。如果池中的所有驱动器都没有足够的可用空间,那么你将无法复制它们。 + +-------------------------------------------------------------------------------- + +via: https://fedoramagazine.org/using-mergerfs-to-increase-your-virtual-storage/ + +作者:[Curt Warfield][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://fedoramagazine.org/author/rcurtiswarfield/ +[b]: https://github.com/lujun9972 +[1]: https://fedoramagazine.org/wp-content/uploads/2020/04/mergerfs-816x346.png +[2]: https://github.com/trapexit/mergerfs +[3]: https://github.com/trapexit/mergerfs/releases +[4]: https://github.com/trapexit/mergerfs/releases/download/2.29.0/mergerfs-2.29.0-1.fc31.x86_64.rpm diff --git a/published/202005/20200502 Mid-stack inlining in Go.md b/published/202005/20200502 Mid-stack inlining in Go.md new file mode 100644 index 0000000000..588286626a --- /dev/null +++ b/published/202005/20200502 Mid-stack inlining in Go.md @@ -0,0 +1,208 @@ +[#]: collector: (lujun9972) +[#]: translator: (lxbwolf) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12184-1.html) +[#]: subject: (Mid-stack inlining in Go) +[#]: via: (https://dave.cheney.net/2020/05/02/mid-stack-inlining-in-go) +[#]: author: (Dave Cheney https://dave.cheney.net/author/davecheney) + +Go 中对栈中函数进行内联 +====== + +![](https://img.linux.net.cn/data/attachment/album/202005/04/230304avxkxlyoozbiw1bn.jpg) + +[上一篇文章][1]中我论述了叶子内联leaf inlining是怎样让 Go 编译器减少函数调用的开销的,以及延伸出了跨函数边界的优化的机会。本文中,我要论述内联的限制以及叶子内联与栈中内联mid-stack inlining的对比。 + +### 内联的限制 + +把函数内联到它的调用处消除了调用的开销,为编译器进行其他的优化提供了更好的机会,那么问题来了,既然内联这么好,内联得越多开销就越少,*为什么不尽可能多地内联呢?* + +内联可能会以增加程序大小换来更快的执行时间。限制内联的最主要原因是,创建许多函数的内联副本会增加编译时间,并导致生成更大的二进制文件的边际效应。即使把内联带来的进一步的优化机会考虑在内,太激进的内联也可能会增加生成的二进制文件的大小和编译时间。 + +内联收益最大的是[小函数][2],相对于调用它们的开销来说,这些函数做很少的工作。随着函数大小的增长,函数内部做的工作与函数调用的开销相比省下的时间越来越少。函数越大通常越复杂,因此优化其内联形式相对于原地优化的好处会减少。 + +### 内联预算 + +在编译过程中,每个函数的内联能力是用*内联预算*计算的 [^1]。开销的计算过程可以巧妙地内化,像一元和二元等简单操作,在抽象语法数Abstract Syntax Tree(AST)中通常是每个节点一个单位,更复杂的操作如 `make` 可能单位更多。考虑下面的例子: + +```go +package main + +func small() string { + s := "hello, " + "world!" + return s +} + +func large() string { + s := "a" + s += "b" + s += "c" + s += "d" + s += "e" + s += "f" + s += "g" + s += "h" + s += "i" + s += "j" + s += "k" + s += "l" + s += "m" + s += "n" + s += "o" + s += "p" + s += "q" + s += "r" + s += "s" + s += "t" + s += "u" + s += "v" + s += "w" + s += "x" + s += "y" + s += "z" + return s +} + +func main() { + small() + large() +} +``` + +使用 `-gcflags=-m=2` 参数编译这个函数能让我们看到编译器分配给每个函数的开销: + +```bash +% go build -gcflags=-m=2 inl.go +# command-line-arguments +./inl.go:3:6: can inline small with cost 7 as: func() string { s := "hello, world!"; return s } +./inl.go:8:6: cannot inline large: function too complex: cost 82 exceeds budget 80 +./inl.go:38:6: can inline main with cost 68 as: func() { small(); large() } +./inl.go:39:7: inlining call to small func() string { s := "hello, world!"; return s } +``` + +编译器根据函数 `func small()` 的开销(7)决定可以对它内联,而 `func large()` 的开销太大,编译器决定不进行内联。`func main()` 被标记为适合内联的,分配了 68 的开销;其中 `small` 占用 7,调用 `small` 函数占用 57,剩余的(4)是它自己的开销。 + +可以用 `-gcflag=-l` 参数控制内联预算的等级。下面是可使用的值: + + * `-gcflags=-l=0` 默认的内联等级。 + * `-gcflags=-l`(或 `-gcflags=-l=1`)取消内联。 + * `-gcflags=-l=2` 和 `-gcflags=-l=3` 现在已经不使用了。和 `-gcflags=-l=0` 相比没有区别。 + * `-gcflags=-l=4` 减少非叶子函数和通过接口调用的函数的开销。[^2] + +#### 不确定语句的优化 + +一些函数虽然内联的开销很小,但由于太复杂它们仍不适合进行内联。这就是函数的不确定性,因为一些操作的语义在内联后很难去推导,如 `recover`、`break`。其他的操作,如 `select` 和 `go` 涉及运行时的协调,因此内联后引入的额外的开销不能抵消内联带来的收益。 + +不确定的语句也包括 `for` 和 `range`,这些语句不一定开销很大,但目前为止还没有对它们进行优化。 + +### 栈中函数优化 + +在过去,Go 编译器只对叶子函数进行内联 —— 只有那些不调用其他函数的函数才有资格。在上一段不确定的语句的探讨内容中,一次函数调用就会让这个函数失去内联的资格。 + +进入栈中进行内联,就像它的名字一样,能内联在函数调用栈中间的函数,不需要先让它下面的所有的函数都被标记为有资格内联的。栈中内联是 David Lazar 在 Go 1.9 中引入的,并在随后的版本中做了改进。[这篇文稿][5]深入探究了保留栈追踪行为和被深度内联后的代码路径里的 `runtime.Callers` 的难点。 + +在前面的例子中我们看到了栈中函数内联。内联后,`func main()` 包含了 `func small()` 的函数体和对 `func large()` 的一次调用,因此它被判定为非叶子函数。在过去,这会阻止它被继续内联,虽然它的联合开销小于内联预算。 + +栈中内联的最主要的应用案例就是减少贯穿函数调用栈的开销。考虑下面的例子: + +```go +package main + +import ( + "fmt" + "strconv" +) + +type Rectangle struct {} + +//go:noinline +func (r *Rectangle) Height() int { + h, _ := strconv.ParseInt("7", 10, 0) + return int(h) +} + +func (r *Rectangle) Width() int { + return 6 +} + +func (r *Rectangle) Area() int { return r.Height() * r.Width() } + +func main() { + var r Rectangle + fmt.Println(r.Area()) +} +``` + +在这个例子中, `r.Area()` 是个简单的函数,调用了两个函数。`r.Width()` 可以被内联,`r.Height()` 这里用 `//go:noinline` 指令标注了,不能被内联。[^3] + +```bash +% go build -gcflags='-m=2' square.go +# command-line-arguments +./square.go:12:6: cannot inline (*Rectangle).Height: marked go:noinline +./square.go:17:6: can inline (*Rectangle).Width with cost 2 as: method(*Rectangle) func() int { return 6 } +./square.go:21:6: can inline (*Rectangle).Area with cost 67 as: method(*Rectangle) func() int { return r.Height() * r.Width() } +./square.go:21:61: inlining call to (*Rectangle).Width method(*Rectangle) func() int { return 6 } +./square.go:23:6: cannot inline main: function too complex: cost 150 exceeds budget 80 +./square.go:25:20: inlining call to (*Rectangle).Area method(*Rectangle) func() int { return r.Height() * r.Width() } +./square.go:25:20: inlining call to (*Rectangle).Width method(*Rectangle) func() int { return 6 } +``` + +由于 `r.Area()` 中的乘法与调用它的开销相比并不大,因此内联它的表达式是纯收益,即使它的调用的下游 `r.Height()` 仍是没有内联资格的。 + +#### 快速路径内联 + +关于栈中内联的效果最令人吃惊的例子是 2019 年 [Carlo Alberto Ferraris][7] 通过允许把 `sync.Mutex.Lock()` 的快速路径(非竞争的情况)内联到它的调用方来[提升它的性能][7]。在这个修改之前,`sync.Mutex.Lock()` 是个很大的函数,包含很多难以理解的条件,使得它没有资格被内联。即使锁可用时,调用者也要付出调用 `sync.Mutex.Lock()` 的代价。 + +Carlo 把 `sync.Mutex.Lock()` 分成了两个函数(他自己称为外联outlining)。外部的 `sync.Mutex.Lock()` 方法现在调用 `sync/atomic.CompareAndSwapInt32()` 且如果 CAS(比较并交换Compare and Swap)成功了之后立即返回给调用者。如果 CAS 失败,函数会走到 `sync.Mutex.lockSlow()` 慢速路径,需要对锁进行注册,暂停 goroutine。[^4] + +```bash +% go build -gcflags='-m=2 -l=0' sync 2>&1 | grep '(*Mutex).Lock' +../go/src/sync/mutex.go:72:6: can inline (*Mutex).Lock with cost 69 as: method(*Mutex) func() { if "sync/atomic".CompareAndSwapInt32(&m.state, 0, mutexLocked) { if race.Enabled { }; return }; m.lockSlow() } +``` + +通过把函数分割成一个简单的不能再被分割的外部函数,和(如果没走到外部函数就走到的)一个处理慢速路径的复杂的内部函数,Carlo 组合了栈中函数内联和[编译器对基础操作的支持][9],减少了非竞争锁 14% 的开销。之后他在 `sync.RWMutex.Unlock()` 重复这个技巧,节省了另外 9% 的开销。 + +[^1]: 不同发布版本中,在考虑该函数是否适合内联时,Go 编译器对同一函数的预算是不同的。 +[^2]: 时刻记着编译器的作者警告过[“更高的内联等级(比 -l 更高)可能导致错误或不被支持”][11]。 Caveat emptor。 +[^3]: 编译器有足够的能力来内联像 `strconv.ParseInt` 的复杂函数。作为一个实验,你可以尝试去掉 `//go:noinline` 注释,使用 `-gcflags=-m=2` 编译后观察。 +[^4]: `race.Enable` 表达式是通过传递给 `go` 工具的 `-race` 参数控制的一个常量。对于普通编译,它的值是 `false`,此时编译器可以完全省略代码路径。 + +### 相关文章: + + 1. [Go 中的内联优化][15] + 2. [goroutine 的栈为什么会无限增长?][16] + 3. [栈追踪和 errors 包][17] + 4. [零值是什么,为什么它很有用?][18] + +-------------------------------------------------------------------------------- + +via: https://dave.cheney.net/2020/05/02/mid-stack-inlining-in-go + +作者:[Dave Cheney][a] +选题:[lujun9972][b] +译者:[lxbwolf](https://github.com/lxbwolf) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://dave.cheney.net/author/davecheney +[b]: https://github.com/lujun9972 +[1]: https://linux.cn/article-12176-1.html +[2]: https://medium.com/@joshsaintjacque/small-functions-considered-awesome-c95b3fd1812f +[3]: tmp.FyRthF1bbF#easy-footnote-bottom-1-4076 (The budget the Go compiler applies to each function when considering if it is eligible for inlining changes release to release.) +[4]: tmp.FyRthF1bbF#easy-footnote-bottom-2-4076 (Keep in mind that the compiler authors warn that “Additional levels of inlining (beyond -l) may be buggy and are not supported”. Caveat emptor.) +[5]: https://docs.google.com/presentation/d/1Wcblp3jpfeKwA0Y4FOmj63PW52M_qmNqlQkNaLj0P5o/edit#slide=id.p +[6]: tmp.FyRthF1bbF#easy-footnote-bottom-3-4076 (The compiler is powerful enough that it can inline complex functions like strconv.ParseInt. As a experiment, try removing the //go:noinline annotation and observe the result with -gcflags=-m=2.) +[7]: https://go-review.googlesource.com/c/go/+/148959 +[8]: tmp.FyRthF1bbF#easy-footnote-bottom-4-4076 (The expression race.Enable is a constant controlled by the -race flag passed to the go tool. It is false for normal builds which allows the compiler to elide those code paths entirely.) +[9]: https://dave.cheney.net/2019/08/20/go-compiler-intrinsics +[10]: tmp.FyRthF1bbF#easy-footnote-1-4076 +[11]: https://github.com/golang/go/blob/be08e10b3bc07f3a4e7b27f44d53d582e15fd6c7/src/cmd/compile/internal/gc/inl.go#L11 +[12]: tmp.FyRthF1bbF#easy-footnote-2-4076 +[13]: tmp.FyRthF1bbF#easy-footnote-3-4076 +[14]: tmp.FyRthF1bbF#easy-footnote-4-4076 +[15]: https://dave.cheney.net/2020/04/25/inlining-optimisations-in-go (Inlining optimisations in Go) +[16]: https://dave.cheney.net/2013/06/02/why-is-a-goroutines-stack-infinite (Why is a Goroutine’s stack infinite ?) +[17]: https://dave.cheney.net/2016/06/12/stack-traces-and-the-errors-package (Stack traces and the errors package) +[18]: https://dave.cheney.net/2013/01/19/what-is-the-zero-value-and-why-is-it-useful (What is the zero value, and why is it useful?) diff --git a/published/202005/20200502 Pop OS 20.04 Review- Best Ubuntu-based Distribution Just Got Better.md b/published/202005/20200502 Pop OS 20.04 Review- Best Ubuntu-based Distribution Just Got Better.md new file mode 100644 index 0000000000..731c14fa0b --- /dev/null +++ b/published/202005/20200502 Pop OS 20.04 Review- Best Ubuntu-based Distribution Just Got Better.md @@ -0,0 +1,228 @@ +[#]: collector: (lujun9972) +[#]: translator: (wxy) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12175-1.html) +[#]: subject: (Pop OS 20.04 Review: Best Ubuntu-based Distribution Just Got Better) +[#]: via: (https://itsfoss.com/pop-os-20-04-review/) +[#]: author: (Ankush Das https://itsfoss.com/author/ankush/) + +Pop!_OS 20.04 点评:最好的基于 Ubuntu 的发行版越来越好了 +====== + +> Pop!_OS 20.04 是一款令人印象深刻的基于 Ubuntu 的 Linux 发行版。我在这篇评论中回顾了其主要的新功能,并分享了我对最新版本的体验。 + +现在,Ubuntu 20.04 LTS 及其官方变体版本已经发布了 - 是时候看看 [System76][1] 的 Pop!_OS 20.04 了,这是基于 Ubuntu 的最好的发行版之一。 + +老实说,Pop!_OS 是我最喜欢的 Linux 发行版,主要用于我做的所有事情。 + +现在,Pop!_OS 20.04 终于来了。是时候来看看它提供了哪些功能,以及你是否应该升级? + +### Pop!_OS 20.04 LTS 中有什么新东西? + +![][2] + +从视觉上看,Pop!\_OS 20.04 LTS 与 Pop!\_OS 19.10 并没有太大的区别。然而,你可以发现几个新功能和改进。 + +但是,如果你之前使用的是 Pop!_OS 18.04 LTS,则可以发现有很多东西可以尝试。 + +随着 [GNOME 3.36][3] 的到来,及其带来的一些新功能,Pop!_OS 20.04 成为了一个令人激动的版本。 + +总的来说,以下是一些主要的亮点。 + + * 自动窗口平铺 + * 新的应用程序切换器和启动器 + * 在 Pop!_Shop 中增加了对 Flatpack 的支持。 + * GNOME 3.36 + * Linux 内核 5.4 + * 改进的混合图形支持 + +虽然听起来很有趣,但我们还是来了解一下详细的变化,以及到目前为止 Pop!_OS 20.04 的体验如何。 + +#### Pop!_OS 20.04 中的用户体验提升 + +毫无疑问,很多 Linux 发行版都提供了开箱即用的用户体验。同样的,[Ubuntu 20.04 LTS 也有一流的改进和功能][4]。 + +而对于 System76 的 Pop!_OS,他们总是试图更进一步。并且,大多数新功能旨在通过提供有用的功能来改善用户体验。 + +在这里,我将介绍一些改进,其中包括 [GNOME 3.36][3] 和 Pop!_OS 特有的一些功能。 + +#### 支持系统托盘图标 + +总算是有了!这可能不是什么大的改变 —— 但 Pop!_OS 以前没有支持系统托盘图标(或小程序图标)。 + +![][5] + +随着 20.04 LTS 的发布,默认情况就有了系统托盘,不需要任何扩展。 + +依靠系统托盘图标的程序可能并不多 —— 但它仍然是重要的东西。 + +就我而言,我以前无法在 Pop!_OS 19.10 上使用 [ActivityWatch][6] —— 但现在可以了。 + +#### 自动窗口平铺 + +![][7] + +自动窗口平铺是我一直想尝试的东西 —— 但从来没花时间使用过 [i3][9] 这样的[平铺窗口管理器][8]来设置它,更别说是 [Regolith 桌面][10]了。 + +在 Pop!_OS 20.04 中,你就不需要这样做了。自动窗口平铺功能已经内置,无需设置。 + +它还提供了“显示活动提示”的选项,也就是说,它将高亮显示活动窗口以避免混淆。而且,你还可以调整窗口之间的间隙。 + +![][11] + +你可以在他们的官方视频中看到它是如何工作的: + +- [System76 Pop!_OS 20.04 - Auto Tiling](https://youtu.be/-fltwBKsMY0) + +而且,我得说,这是 Pop!_OS 20.04 上最大的新增功能之一,有可能帮助你更有效地进行多任务处理。 + +即使每次使用该功能都很方便,但为了最大程度地利用它,最好是使用一个大于 21 英寸的显示屏(至少)! 而且,因为这个原因 —— 我真的很想把我的显示器也升级一下! + +#### 新的扩展应用 + +![][13] + +Pop!_OS 内置了一些独特的 GNOME 扩展。但是,你不需要用 GNOME Tweaks 来管理扩展。 + +新增加的 “Extensions” 应用可以让你在 Pop!_OS 20.04 上配置和管理扩展程序。 + +#### 改进的通知中心 + +![][14] + +在新的 GNOME 3.36 中,通知中心的外观经过了改进。这里,我启用了黑暗模式。 + +#### 新的应用程序切换器 & 启动器 + +![][15] + +你仍然可以用 `ALT+TAB` 或 `Super+TAB` 来浏览正在运行的应用程序。 + +但是,当你有很多事情要做的时候,这很耗时。所以,在 Pop!_OS 20.04上,你可以使用 `Super+ /` 激活应用程序切换器和启动器。 + +一旦你习惯了这个快捷键,它将是非常方便的东西。 + +除此以外,你可能会发现 Pop!_OS 20.04 上的图标/窗口在视觉上有许多其它细微的改进。 + +#### 新的登录界面 + +嗯,这是 GNOME 3.36 带来的一个明显的变化。但是,它看起来确实很不错! + +![][16] + +#### Pop!_Shop 支持 Flatpak + +通常,Pop!_Shop 已经是一个非常有用的东西了,包括它自有的在内,它带有一个巨大的软件仓库。 + +现在,在 Pop!\_OS 20.04 中,你可以用 Pop!_Shop 安装任何可用软件的 Debian 包或 Flatpak(通过 Flathub) —— 当然,前提是某个软件有 Flatpak 软件包。 + +如果你没有使用 Pop!_OS 20.04,你可能要看看[如何在 Linux 上使用 Flatpak][18]。 + +![][19] + +就我个人而言,我并不是 Flatpak 的粉丝,但有些应用如 GIMP 需要你安装 Flatpak 包才能获得最新版本。所以,在 Pop!_Shop 上直接支持了 Flatpak 绝对是一件好事。 + +#### 键盘快捷键更改 + +如果你习惯了 Pop!_OS 19.10 或更早的版本上现有的键盘快捷键,这可能会让你很烦。 + +不管是哪种情况,有几个重要的键盘快捷键变化可能会改善你的体验,如下: + + * 锁定屏幕:`Super + L` 改为 `Super + Escape`。 + * 移动工作区:`Super + 上/下箭头键` 改为 `Super + CTRL + 上/下箭头键`。 + * 关闭窗口:`Super + W` 变更为 `Super + Q`。 + * 切换最大化:`Super +向上箭头` 改为 `Super + M`。 + +#### Linux 内核 5.4 + +与其他大多数最新的 Linux 发行版相似,Pop!_OS 20.04 搭载了 [Linux 内核 5.4][20]。 + +所以,很明显,你可以期望获得对 [exFAT 支持][21]、改进的 AMD 图形兼容性以及它附带所有其他功能。 + +#### 性能提升 + +尽管 Pop!_OS 并不称自己是轻量级的 Linux 发行版,但它仍然是一个资源节约型的发行版。而且,有了 GNOME 3.36 的支持,它的速度应该足够快了。 + +考虑到我已经将 Pop!\_OS 作为主要发行版使用已经一年多了,我从来没有遇到过性能问题。这就是你安装了 Pop!_OS 20.04 之后的资源使用情况(取决于你的系统配置)。 + +![][22] + +给你一个作为参考,我的台式机配置包括 i5-7400 处理器、16GB 内存(2400MHz)、NVIDIA GTX 1050ti 显卡和 SSD。 + +我不是一个系统基准测试的忠实拥护者,因为除非你去尝试,否则它并不能让你知道特定的应用或游戏的性能。 + +你可以试试 [Phoronix 测试套件][23]来分析你的系统表现。但是,Pop!_OS 20.04 LTS 应该是一个很爽快的体验! + +#### 软件包更新 & 其他改进 + +尽管每个基于Ubuntu的发行版都受益于Ubuntu 20.04 LTS的改进,但也有一些 Pop!_OS 特有的错误修复和改进。 + +除此之外,一些主要的应用程序/包(如 Firefox 75.0)也已经更新到了最新版本。 + +到现在为止,应该没有任何严重的错误,至少对我来说没有。 + +你可以在 [GitHub 上查看他们的开发进度][24],以了解他们在测试期间已经修复的问题和发布后即将修复的问题。 + +### 下载 & 支持 Pop!_OS 20.04 + +![][25] + +在这个版本中,System76 终于增加了一个可选的订阅模式来支持 Pop!_OS 的开发。 + +你可以免费下载 Pop!_OS 20.04 —— 但如果你想支持他们,我建议你只需要 \$1/月就可以订阅。 + +- [Pop!_OS 20.04][26] + +### 我对 Pop OS 20.04 的看法 + +我必须提到的是,我正在为最新的 20.04 版本提供全新的墙纸。但是,这没什么大不了的。 + +有了窗口平铺功能、支持 flatpak,以及众多其他改进,到目前为止,我对 Pop!_OS 20.04 的体验是一流的。另外,很高兴看到他们在一些流行软件的开箱即用支持上突出了他们对创意专业人士的关注。 + +![][27] + +Ubuntu 20.04 的所有优点,再加上 System76 的一些额外的加料,让我印象深刻! + +你试过 Pop!_OS 20.04 吗?请在下面的评论中告诉我你的想法。 + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/pop-os-20-04-review/ + +作者:[Ankush Das][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://itsfoss.com/author/ankush/ +[b]: https://github.com/lujun9972 +[1]: https://system76.com +[2]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/05/pop_os_20_04_review.jpg?ssl=1 +[3]: https://itsfoss.com/gnome-3-36-release/ +[4]: https://itsfoss.com/ubuntu-20-04-release-features/ +[5]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/04/system-tray-icons-pop-os.jpg?ssl=1 +[6]: https://activitywatch.net/ +[7]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/04/pop-os-automatic-screen-tiling.png?ssl=1 +[8]: https://en.wikipedia.org/wiki/Tiling_window_manager +[9]: https://i3wm.org/ +[10]: https://itsfoss.com/regolith-linux-desktop/ +[11]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/04/tile-feature-options-popos.jpg?ssl=1 +[12]: https://www.youtube.com/c/itsfoss?sub_confirmation=1 +[13]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/04/pop-os-extensions.jpg?ssl=1 +[14]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/04/notification-center-pop-os.jpg?ssl=1 +[15]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/04/pop-os-application-launcher.jpg?ssl=1 +[16]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/04/pop-os-20-04-lock-screen.jpg?ssl=1 +[17]: https://launchpad.net/~system76/+archive/ubuntu/pop +[18]: https://itsfoss.com/flatpak-guide/ +[19]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/04/pop-os-flatpak-deb.jpg?ssl=1 +[20]: https://itsfoss.com/linux-kernel-5-4/ +[21]: https://itsfoss.com/mount-exfat/ +[22]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/04/pop-os-20-04-performance.jpg?ssl=1 +[23]: https://www.phoronix-test-suite.com/ +[24]: https://github.com/orgs/pop-os/projects/13 +[25]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/05/support-pop-os.jpg?ssl=1 +[26]: https://pop.system76.com/ +[27]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/05/pop-os-stem-focus.jpg?ssl=1 diff --git a/published/202005/20200504 4 cool new projects to try in COPR for May 2020.md b/published/202005/20200504 4 cool new projects to try in COPR for May 2020.md new file mode 100644 index 0000000000..9a63887910 --- /dev/null +++ b/published/202005/20200504 4 cool new projects to try in COPR for May 2020.md @@ -0,0 +1,108 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12230-1.html) +[#]: subject: (4 cool new projects to try in COPR for May 2020) +[#]: via: (https://fedoramagazine.org/4-cool-new-projects-to-try-in-copr-for-april-2020/) +[#]: author: (Dominik Turecek https://fedoramagazine.org/author/dturecek/) + +COPR 仓库中 4 个很酷的新项目(2020.05) +====== + +![][1] + +COPR 是个人软件仓库[集合][2],它不在 Fedora 中。这是因为某些软件不符合轻松打包的标准;或者它可能不符合其他 Fedora 标准,尽管它是自由而开源的。COPR 可以在 Fedora 套件之外提供这些项目。COPR 中的软件不受 Fedora 基础设施的支持,或者是由项目自己背书的。但是,这是一种尝试新的或实验性的软件的一种巧妙的方式。 + +本文介绍了 COPR 中一些有趣的新项目。如果你第一次使用 COPR,请参阅 [COPR 用户文档][3]。 + +### Ytop + +[ytop][4] 是类似于 `htop` 的命令行系统监视器。它们之间的主要区别是,`ytop` 在显示进程及其 CPU 和内存使用率的顶部显示了系统的 CPU、内存和网络使用率随时间变化的图表。此外,`ytop` 还显示磁盘使用情况和计算机温度。最后,`ytop` 支持多种配色方案以及创建新配色的选项。 + +![][5] + +#### 安装说明 + +[该仓库][6]当前为 Fedora 30、31、32 和 Rawhide 以及 EPEL 7 提供了 `ytop`。要安装 `ytop`,请[带上 sudo][7] 使用以下命令: + +``` +sudo dnf copr enable atim/ytop +sudo dnf install ytop +``` + +### Ctop + +[ctop][8] 是另一个命令行系统监视器。但是,与 `htop` 和 `ytop` 不同,`ctop` 专注于显示容器的资源使用情况。`ctop` 同时显示计算机上运行的所有容器的 CPU、内存、网络和磁盘使用情况的概要,以及单个容器的更全面的信息,包括一段时间内资源使用情况的图表。当前,`ctop` 支持 Docker 和 runc 容器。 + +![][9] + +#### 安装说明 + +[该仓库][10]当前为 Fedora 31、32 和 Rawhide 以及 EPEL 7 还有其他发行版提供了安装包。要安装 `ctop`,请使用以下命令: + +``` +sudo dnf copr enable fuhrmann/ctop +sudo dnf install ctop +``` + +### Shortwave + +[shortwave][11] 是用于收听广播电台的程序。`shortwave` 使用广播电台的社区数据库 [www.radio-browser.info][12]。在此数据库中,你可以发现或搜索广播电台,将它们添加到库中,然后收听。此外,`shortwave` 还提供有关当前播放歌曲的信息,并且还可以记录这些歌曲。 + +![][13] + +#### 安装说明 + +[该仓库][14] 当前为 Fedora 31、32 和 Rawhide 提供了 shortwave。要安装 `shortwave`,请使用以下命令: + +``` +sudo dnf copr enable atim/shortwave +sudo dnf install shortwave +``` + +### Setzer + +[setzer][15] 是 LaTeX 编辑器,它可以构建 pdf 文档并查看它们。它提供了各种类型文档(例如文章或幻灯片)的模板。此外,`setzer` 还有许多特殊符号、数学符号和希腊字母的按钮。 + +![][16] + +#### 安装说明 + +[该仓库][17] 当前为 Fedora 30、31、32 和 Rawhide 提供了 `setzer`。要安装 `setzer`,请使用以下命令: + +``` +sudo dnf copr enable lyessaadi/setzer +sudo dnf install setzer +``` + +-------------------------------------------------------------------------------- + +via: https://fedoramagazine.org/4-cool-new-projects-to-try-in-copr-for-april-2020/ + +作者:[Dominik Turecek][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://fedoramagazine.org/author/dturecek/ +[b]: https://github.com/lujun9972 +[1]: https://fedoramagazine.org/wp-content/uploads/2017/08/4-copr-945x400.jpg +[2]: https://copr.fedorainfracloud.org/ +[3]: https://docs.pagure.org/copr.copr/user_documentation.html# +[4]: https://github.com/cjbassi/ytop +[5]: https://fedoramagazine.org/wp-content/uploads/2020/04/ytop.png +[6]: https://copr.fedorainfracloud.org/coprs/atim/ytop/ +[7]: https://fedoramagazine.org/howto-use-sudo/ +[8]: https://github.com/bcicen/ctop +[9]: https://fedoramagazine.org/wp-content/uploads/2020/04/ctop.png +[10]: https://copr.fedorainfracloud.org/coprs/fuhrmann/ctop/ +[11]: https://github.com/ranfdev/shortwave +[12]: http://www.radio-browser.info/gui/#!/ +[13]: https://fedoramagazine.org/wp-content/uploads/2020/04/shortwave.png +[14]: https://copr.fedorainfracloud.org/coprs/atim/shortwave/ +[15]: https://www.cvfosammmm.org/setzer/ +[16]: https://fedoramagazine.org/wp-content/uploads/2020/04/setzer.png +[17]: https://copr.fedorainfracloud.org/coprs/lyessaadi/setzer/ diff --git a/published/202005/20200505 Browse the Peer-to-peer Web With Beaker Browser.md b/published/202005/20200505 Browse the Peer-to-peer Web With Beaker Browser.md new file mode 100644 index 0000000000..701d66156e --- /dev/null +++ b/published/202005/20200505 Browse the Peer-to-peer Web With Beaker Browser.md @@ -0,0 +1,124 @@ +[#]: collector: (lujun9972) +[#]: translator: (lxbwolf) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12203-1.html) +[#]: subject: (Browse the Peer-to-peer Web With Beaker Browser) +[#]: via: (https://itsfoss.com/beaker-browser/) +[#]: author: (John Paul https://itsfoss.com/author/john/) + +使用 Beaker 浏览器浏览对等 Web +====== + +![](https://img.linux.net.cn/data/attachment/album/202005/10/082745ztmi4kqh4iq449ll.jpg) + +在过去 50 年中,我们所了解的互联网没有什么变化,全球的网民使用他们的设备从遍布在世界各地的服务器上检索数据。 + +一群专业的技术专家想改变现状,使互联网变成人们可以连接和直接分享信息的地方,而不是依赖一个中心服务器(去中心化)。 + +我们已经在 It’s FOSS 讨论过很多这样的去中心化的服务。[YouTube 竞品:LBRY][1]、[Twitter 竞品:Mastodon][2] 是其中的两个例子。 + +今天我将要介绍另一个这样的产品,名为 [Beaker 浏览器][3],它的设计目标是浏览对等 Web。 + +![Beaker Browser][4] + +### “对等 Web” 是什么? + +根据 Beaker 浏览器的[开发者之一][5]的描述,“对等 Web 是一项实验性的技术 ……旨在提高我们掌控 Web 的能力。” + +还有,他们说对等 Web 有三个主要原则:任何一点都可以成为服务器;多台计算机可以为同一个网站提供服务;没有后端。 + +从这些原则中你可以看出,对等 Web 的思想与 BitTorrent 很像,文件由多个对端做种,这些对端共同承担带宽负载。这减少了一个用户需要提供给他们的网站的总带宽。 + +![Beaker Browser Settings][6] + +对等 Web 另一个重要的方面是创作者对于他们自己的想法的控制能力。当今年代,平台都是由庞大的组织控制的,往往拿你的数据为他们所用。Beaker 把数据的控制能力返还给了内容创造者。 + +### 使用 Beaker 浏览去中心化的 web + +[Beaker 浏览器][3] 是在 2016 年被创建的。该项目(及其周边技术)由[蓝链实验室][7]的三人团队创建。Beaker 浏览器使用 [Dat 协议][8]在计算机之间共享数据。使用 Dat 协议的网站以 `dat://` 而不是 `http://` 开头。 + +Dat 协议的优势如下: + + * 快速 – 档案能立即从多个源同步。 + * 安全 – 所有的更新都是有签名和经过完整性检查的。 + * 灵活 – 可以在不修改档案 URL 的情况下迁移主机。 + * 版本控制 – 每次修改都被写到只能追加的版本日志中。 + * 去中心化 – 任何设备都可以作为承载档案的主机。 + +![Beaker Browser Seeding][9] + +Beaker 浏览器本质上是阉割版的 Chromium,原生支持 `dat://` 地址,也可以访问普通的 `http://` 站点。 + +每次访问一个 dat 站点,在你请求时该站点的内容才会下载到你的计算机。例如,在一个站点上的 about 页面中有一张 Linux Torvalds 的图片,只有在你浏览到该站点的这个页面时,才会下载这张图片。 + +此外,当你浏览一个 dat 网站时,“[你会短暂性的][10]重新上传或做种你从该网站上下载的所有文件。”你也可以选择为网站(主动)做种来帮助创造者。 + +![Beaker Browser Menu][11] + +由于 Beaker 的志向就是创建一个更开放的网络,因此你可以很容易地查看任何网站的源码。不像在大多数浏览器上你只能看到当前浏览的页面的源码那样,使用 Beaker 你能以类似 GitHub 的视图查看整个站点的结构。你甚至可以复刻这个站点,并托管你自己的版本。 + +除了浏览基于 dat 的网站外,你还可以创建自己的站点。在 Beaker 浏览器的菜单里,有创建新网站或空项目的选项。如果你选择了创建一个新网站,Beaker 会搭建一个小的演示站点,你可以使用浏览器里自带的编辑器来编辑。 + +然而,如果你像我一样更喜欢用 Markdown,你可以选择创建一个空项目。Beaker 会创建一个站点的结构,赋给它一个 `dat://` 地址。你只需要创建一个 `index.md` 文件后就行了。这有个[简短教程][12],你可以看到更多信息。你也可以用创建空项目的方式搭建一个 web 应用。 + +![Beaker Browser Website Template][13] + +由于 Beaker 的角色是个 Web 服务器和站点做种者,当你关闭它或关机后你的站点就不可用了。幸运的是,你不必一直开着你的计算机或浏览器。你也可以使用名为 [Hashbase][14] 的做种服务或者你可以搭建一个 [homebase][15] 做种服务器。 + +虽然 Beaker [适用于][16] Linux、Windows 和 macOS,但是在使用 Beaker 之前,还是要查阅下[各平台的教程][17]。 + +### Beaker 浏览器不是大众可用的,但它有这个意图 + +当第一次接触到时,我对 Beaker 浏览器有极高的热情。(但是)如它现在的名字一样(烧杯),Beaker 浏览器仍是非常实验性的。我尝试浏览过的很多 dat 站点还不可用,因为用户并没有为站点做种。当站点恢复可用时 Beaker 确实可以选择通知你。 + +![Beaker Browser No Peer][18] + +另一个问题是,Beaker 是真正阉割版的 Chromium。它不能安装扩展或主题。你只能使用白色主题和极少的工具集。我不会把 Beaker 浏览器作为常用浏览器,而且能访问 dat 网站并不是把它留在系统上的充分条件。 + +我曾经寻找一个能支持 `dat://` 协议的 Firefox 扩展。我确实找到了这样一款扩展,但它需要安装一系列其他的软件。相比而言,安装 Beaker 比安装那些软件容易点。 + +就如它现在的名字一样,Beaker 不适合我。也许在将来更多的人使用 Beaker 或者其他浏览器支持 dat 协议。那时会很有趣。目前而言,聊胜于无。 + +在使用 Beaker 的时间里,我用内建的工具创建了一个[网站][19]。不要担心,我已经为它做种了。 + +![Beaker Bowser Site Source][20] + +你怎么看 Beaker 浏览器?你怎么看对等 Web?请尽情在下面评论。 + +如果你觉得本文有意思,请花点时间把它分享到社交媒体,Hacker News 或 [Reddit][21]。 + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/beaker-browser/ + +作者:[John Paul][a] +选题:[lujun9972][b] +译者:[lxbwolf](https://github.com/lxbwolf) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://itsfoss.com/author/john/ +[b]: https://github.com/lujun9972 +[1]: https://itsfoss.com/lbry/ +[2]: https://itsfoss.com/mastodon-open-source-alternative-twitter/ +[3]: https://beakerbrowser.com/ +[4]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/04/beaker-browser.jpg?resize=800%2C426&ssl=1 +[5]: https://pfrazee.hashbase.io/blog/what-is-the-p2p-web +[6]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/04/beaker-bowser-setting.jpg?resize=800%2C573&ssl=1 +[7]: https://bluelinklabs.com/ +[8]: https://www.datprotocol.com/ +[9]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/04/beaker-bowser-seedding.jpg?resize=800%2C466&ssl=1 +[10]: https://beakerbrowser.com/docs/faq/ +[11]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/04/beaker-browser-menu.jpg?ssl=1 +[12]: https://beakerbrowser.com/docs/guides/create-a-markdown-site +[13]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/04/beaker-browser-website-template.jpg?resize=800%2C459&ssl=1 +[14]: https://hashbase.io/ +[15]: https://github.com/beakerbrowser/homebase +[16]: https://beakerbrowser.com/install/ +[17]: https://beakerbrowser.com/docs/guides/ +[18]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/04/beaker-browser-no-peer.jpg?resize=800%2C424&ssl=1 +[19]: https://41bfbd06731e8d9c5d5676e8145069c69b254e7a3b710ddda4f6e9804529690c/ +[20]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/04/beaker-bowser-source.jpg?resize=800%2C544&ssl=1 +[21]: https://reddit.com/r/linuxusersgroup diff --git a/published/202005/20200506 After More Than 3 Years, Inkscape 1.0 is Finally Here With Tons of Feature Improvements.md b/published/202005/20200506 After More Than 3 Years, Inkscape 1.0 is Finally Here With Tons of Feature Improvements.md new file mode 100644 index 0000000000..fcf6c3b3ca --- /dev/null +++ b/published/202005/20200506 After More Than 3 Years, Inkscape 1.0 is Finally Here With Tons of Feature Improvements.md @@ -0,0 +1,115 @@ +[#]: collector: (lujun9972) +[#]: translator: (wxy) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12188-1.html) +[#]: subject: (After More Than 3 Years, Inkscape 1.0 is Finally Here With Tons of Feature Improvements) +[#]: via: (https://itsfoss.com/inkscape-1-release/) +[#]: author: (Ankush Das https://itsfoss.com/author/ankush/) + +经过了 3 年,Inkscape 1.0 终于发布了 +====== + +![](https://img.linux.net.cn/data/attachment/album/202005/06/094055fvnh9nnnbybwl4jn.jpg) + +虽然我不是这方面的专业人员,但可以肯定地说,Inkscape 是[最好的矢量图形编辑器][1]之一。 + +不仅仅因为它是自由开源软件,而且对于数字艺术家来说,它是一个非常有用的应用程序。 + +上一次发布(0.92 版本)是在 3 年前。现在,终于,[Inkscape 宣布了它的 1.0 版本][2] —— 增加了很多新的功能和改进。 + +### Inkscape 1.0 里的新东西 + +![Inkscape 1.0][3] + +在这里,让我重点介绍一下 Inkscape 1.0 版本中重要关键变化。 + +#### 首个原生 macOS 应用 + +对于像 Inkscape 这样的神奇工具来说,适当的跨平台支持总是好的。在这个最新的版本中,它推出了原生的 macOS 应用。 + +请注意,这个 macOS 应用仍然是一个**预览版**,还有很多改进的空间。不过,在无需 [XQuartz][4] 的情况下就做到了更好的系统集成,对于 macOS 用户来说,应该是一个值得期许的进步。 + +#### 性能提升 + +不管是什么应用程序/工具,都会从显著的性能提升中受益,而 Inkscape 也是如此。 + +随着其 1.0 版本的发布,他们提到,当你使用 Inkscape 进行各种创意工作时,你会发现性能更加流畅。 + +除了在 macOS 上(仍为“预览版”),Inkscape 在 Linux 和 Windows 上的运行都是很好的。 + +#### 改进的 UI 和 HiDPI 支持 + +![][5] + +他们在发布说明中提到: + +> ……达成了一个重要的里程碑,使 Inkscape 能够使用最新的软件(即 GTK+3)来构建编辑器的用户界面。拥有 HiDPI(高分辨率)屏幕的用户要感谢 2018 年波士顿黑客节期间的团队合作,让更新后的 GTK 轮子开始运转起来。 + +从 GTK+3 的用户界面到高分辨率屏幕的 HiDPI 支持,这都是一次精彩的升级。 + +更不要忘了,你还可以获得更多的自定义选项来调整外观和感受。 + +#### 新增功能 + +![][6] + +即便是从纸面上看,这些列出新功能都看起来不错。根据你的专业知识和你的喜好,这些新增功能应该会派上用场。 + +以下是新功能的概述: + + * 新改进过的实时路径效果(LPE)功能。 + * 新的可搜索的 LPE 选择对话框。 + * 自由式绘图用户现在可以对画布进行镜像和旋转。 + * 铅笔工具的新的 PowerPencil 模式提供了压感的宽度,并且终于可以创建封闭路径了。 + * 包括偏移、PowerClip 和 PowerMask LPE 在内的新路径效果会吸引艺术类用户。 + * 能够创建复制引导、将网格对齐到页面上、测量工具的路径长度指示器和反向 Y 轴。 + * 能够导出带有可点击链接和元数据的 PDF 文件。 + * 新的调色板和网状渐变,可在网页浏览器中使用。 + +虽然我已经尝试着整理了这个版本中添加的关键功能列表,但你可以在他们的[发布说明][7]中获得全部细节。 + +#### 其他重要变化 + +作为重大变化之一,Inkscape 1.0 现在支持 Python 3。而且,随着这一变化,你可能会注意到一些扩展程序无法在最新版本中工作。 + +所以,如果你的工作依赖于某个扩展程序的工作流程,我建议你仔细看看他们的[发布说明][7],了解所有的技术细节。 + +### 在 Linux 上下载和安装 Inkscape 1.0 + +Inkscape 1.0 有用于 Linux 的 AppImage 和 Snap 软件包,你可以从 Inkscape 的网站上下载。 + +- [下载 Inkscape 1.0 for Linux][8] + +如果你还不知道,可以查看[如何在 Linux 上使用 AppImage 文件][9]来入门。你也可以参考[这个 Snap 指南][10]。 + +Ubuntu 用户可以在 Ubuntu 软件中心找到 Inskcape 1.0 的 Snap 版本。 + +我在 [Pop!_OS 20.04][11] 上使用了 AppImage 文件,工作的很好。你可以详细体验所有的功能,看看它的效果如何。 + +你试过了吗?请在下面的评论中告诉我你的想法。 + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/inkscape-1-release/ + +作者:[Ankush Das][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://itsfoss.com/author/ankush/ +[b]: https://github.com/lujun9972 +[1]: https://itsfoss.com/vector-graphics-editors-linux/ +[2]: https://inkscape.org/news/2020/05/04/introducing-inkscape-10/ +[3]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/05/inkscape-1-0.jpg?ssl=1 +[4]: https://en.wikipedia.org/wiki/XQuartz +[5]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/05/inkscape-ui-customization.jpg?ssl=1 +[6]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/05/inkscape-live-path-effects.jpg?ssl=1 +[7]: https://wiki.inkscape.org/wiki/index.php/Release_notes/1.0 +[8]: https://inkscape.org/release/1.0/gnulinux/ +[9]: https://itsfoss.com/use-appimage-linux/ +[10]: https://itsfoss.com/install-snap-linux/ +[11]: https://itsfoss.com/pop-os-20-04-review/ diff --git a/published/202005/20200506 Customizing my open source PHP framework for web development.md b/published/202005/20200506 Customizing my open source PHP framework for web development.md new file mode 100644 index 0000000000..de6b46f8b7 --- /dev/null +++ b/published/202005/20200506 Customizing my open source PHP framework for web development.md @@ -0,0 +1,82 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12235-1.html) +[#]: subject: (Customizing my open source PHP framework for web development) +[#]: via: (https://opensource.com/article/20/5/codeigniter) +[#]: author: (Wee Ben Sen https://opensource.com/users/bswee14) + +自定义用于 Web 开发的开源 PHP 框架 Codeigniter +====== + +> Codeigniter 是一个 PHP 框架,可以使公司进行开发具有灵活性和便捷性的高性能网站。 + +![](https://img.linux.net.cn/data/attachment/album/202005/21/102637vslj5zqk52x98a52.jpg) + +PHP Codeigniter 是一个开源框架,为商业应用提供易于使用的 PHP 编程语言和强大的编码工具。它还提供商务智能、服务器监视、开发和应用集成功能。这是一个相对冷清的项目,你很少听到它,但它功能强大,许多刚接触的开发人员都对此感到惊讶和耳目一新。 + +我在新加坡的一家在线学习服务提供商处使用 [Codeigniter][2]。我们提供的服务并不算常见,没有可以作为模板的默认功能集或现有后台管理系统,所以我需要一个能提供良好的、可靠的、可以建立在此基础上的原始材料。最初,我考虑用其他平台(如 Wordpress)用于我们的网站。但是,我决定使用 Codeigniter,因为它的灵活性,以及集成了在我们的补课匹配过程中需要的功能。 + +以下是打动我使用 Codeigniter 的原因: + +* 与 MySQL 数据库的集成 —— 主要功能是允许客户端浏览导师的数据库并添加导师,例如类似于电子商务平台的“购物车”。 +* 客户端界面系统 —— 用户可以登录来管理偏好并编辑详细信息,修改所教的科目、旅游的地区、手机号码、地址等。 +* 定制的管理员面板 —— 管理员可以使用定制的管理面板访问客户提交的资料,它与客户服务功能集成在一起,因此管理员可以单独跟进。 +* 付款系统 —— 管理面板带有与 Paypal 集成的发票和付款网关。 +* CMS 编辑器界面 —— 管理员能够编辑博客和文章中的文本和图像,以及添加新页面。 + +该项目花费了大约六个月的时间来完成,另外花了两个月的调试时间。如果我需要从头开始构建所有,或者尝试重新设计现有的框架以满足我们的需求,那将花费更长的时间,而且可能最终无法满足客户需求。 + +### 功能和优点 + +PHP Codeigniter还有很多吸引开发者的功能,包括错误处理和代码格式化,这些功能在各种编码情景下都非常有用。它支持模板,可用于向现有网站添加功能或生成新网站。有许多基于 web 系统商业需要的功能,包括使用自定义标签。即使没有编程经验的普通开发人员也可以使用大多数工具。 + +Codeigniter 的主要功能是: + +* XML 核心服务, +* HTTP/FTP 核心服务 +* AppData 和 PHP 沙箱功能 +* XSLT 和 HTML 模板 +* 加密的信息传输 +* PCM Codeigniter 服务器监控 +* 应用集成 +* 文件传输协议(FTP) +* 服务台支持 +* Apache POI(用于托管网站的内容管理基础架构) + +#### 兼容性 + +Codeigniter 与许多领先的软件程序兼容,例如 PHP、MySQL、[MariaDB][3]、[phpMyAdmin][4]、[Apache][5]、OpenBSD、XSLT、[SQLite][6] 等。许多公司更喜欢使用 Codeigniter 产品来满足网站要求,因为它们易于使用和集成。如果你不想创建自己的网站,你可以找到许多提供自定义 Web 开发服务的开发人员和设计机构。 + +#### 安全 + +Codeigniter 还通过 SSL 加密提供数据安全性。加密可以保护数据免受入侵者和防火墙外部威胁的侵害。数据存储功能还允许对公司网站进行安全审核。 + +#### 其它功能 + +一家优秀的 PHP Web 开发公司会使用几种高级技术和第三方技术,例如 XML 和 PHP。它为企业提供了一个完整的平台,可以开发出具有看起来专业的、好用的商业网站。Codeigniter 使得第三方技术的使用变得容易,并可以与常见的 Web 开发软件一起使用。这使得 Web 公司可以轻松地使用所选模块创建网站。大多数 PHP 开发者也为个人提供支持和培训服务。 + +### 使用 PHP 框架 Codeigniter + +Codeigniter 给企业提供了完整的 PHP 开发包,它将提供强大的功能、灵活性和性能完美结合在一起。到目前为止,我很满意我们的网站,并不断地升级和添加新的功能。并不断升级和增加新的功能。我期待着发现我们的网站还能用 Codeigniter 做些什么。你也是这样么? + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/5/codeigniter + +作者:[Wee Ben Sen][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/bswee14 +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/lenovo-thinkpad-laptop-concentration-focus-windows-office.png?itok=-8E2ihcF (Woman using laptop concentrating) +[2]: https://codeigniter.com/ +[3]: http://mariadb.org/ +[4]: https://www.phpmyadmin.net/ +[5]: http://apache.org/ +[6]: http://sqlite.org/ diff --git a/published/202005/20200506 Managing Git projects with submodules and subtrees.md b/published/202005/20200506 Managing Git projects with submodules and subtrees.md new file mode 100644 index 0000000000..d52aef42a6 --- /dev/null +++ b/published/202005/20200506 Managing Git projects with submodules and subtrees.md @@ -0,0 +1,196 @@ +[#]: collector: (lujun9972) +[#]: translator: (lxbwolf) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12244-1.html) +[#]: subject: (Managing Git projects with submodules and subtrees) +[#]: via: (https://opensource.com/article/20/5/git-submodules-subtrees) +[#]: author: (Manaswini Das https://opensource.com/users/manaswinidas) + +使用子模块和子树来管理 Git 项目 +====== + +> 使用子模块和子树来帮助你管理多个存储库中共有的子项目。 + +![](https://img.linux.net.cn/data/attachment/album/202005/23/201323myyhob22eg2y2jqt.jpg) + +如果你参与了开源项目的开发,那么你很可能已经用了 Git 来管理你的源码。你可能遇到过有很多依赖和/或子项目的项目。你是如何管理它们的? + +对于一个开源组织,要实现社区**和**产品的单一来源文档和依赖管理比较棘手。文档和项目往往会碎片化和变得冗余,这致使它们很难维护。 + +### 必要性 + +假设你想把单个项目作为一个存储库内的子项目,传统的方法是把该项目复制到父存储库中,但是,如果你想要在多个父项目中使用同一个子项目呢?如果把子项目复制到所有父项目中,当有更新时,你都要在每个父项目中做修改,这是不太可行的。这会导致父项目中的冗余和数据不一致,使更新和维护子项目变得很困难。 + +### Git 子模块和子树 + +如果你可以用一条命令把一个项目放进另一个项目中,会怎样呢?如果你随时可以把一个项目作为子项目添加到任意数目的项目中,并可以同步更新修改呢?Git 提供了这类问题的解决方案:Git 子模块submodule和 Git 子树subtree。创建这些工具的目的是以更加模块化的水平来支持共用代码的开发工作流,旨在 Git 存储库源码管理source-code management(SCM)与它下面的子树之间架起一座桥梁。 + +![Cherry tree growing on a mulberry tree][2] + +*生长在桑树上的樱桃树* + +下面是本文要详细介绍的概念的一个真实应用场景。如果你已经很熟悉树形结构,这个模型看起来是下面这样: + +![Tree with subtrees][3] + +### Git 子模块是什么? + +Git 在它默认的包中提供了子模块,子模块可以把 Git 存储库嵌入到其他存储库中。确切地说,Git 子模块指向子树中的某次提交。下面是我 [Docs-test][4] GitHub 存储库中的 Git 子模块的样子: + +![Git submodules screenshot][5] + +[文件夹@提交 Id][6] 格式表明这个存储库是一个子模块,你可以直接点击文件夹进入该子树。名为 `.gitmodules` 的配置文件包含所有子模块存储库的详细信息。我的存储库的 `.gitmodules` 文件如下: + +![Screenshot of .gitmodules file][7] + +你可以用下面的命令在你的存储库中使用 Git 子模块: + +#### 克隆一个存储库并加载子模块 + +克隆一个含有子模块的存储库: + +``` +$ git clone --recursive +``` + +如果你之前已经克隆了存储库,现在想加载它的子模块: + +``` +$ git submodule update --init +``` + +如果有嵌套的子模块: + +``` +$ git submodule update --init --recursive +``` + +#### 下载子模块 + +串行地连续下载多个子模块是很枯燥的工作,所以 `clone` 和 `submodule update` 会支持 `--jobs` (或 `-j`)参数: + +例如,想一次下载 8 个子模块,使用: + +``` +$ git submodule update --init --recursive -j 8 +$ git clone --recursive --jobs 8 +``` + +#### 拉取子模块 + +在运行或构建父项目之前,你需要确保依赖的子项目都是最新的。 + +拉取子模块的所有修改: + +``` +$ git submodule update --remote +``` + +#### 使用子模块创建存储库: + +向一个父存储库添加子树: + +``` +$ git submodule add +``` + +初始化一个已存在的 Git 子模块: + +``` +$ git submodule init +``` + +你也可以通过为 `submodule update` 命令添加 `--update` 参数在子模块中创建分支和追踪提交: + +``` +$ git submodule update --remote +``` + +#### 更新子模块的提交 + +上面提到过,一个子模块就是一个指向子树中某次提交的链接。如果你想更新子模块的提交,不要担心。你不需要显式地指定最新的提交。你只需要使用通用的 `submodule update` 命令: + +``` +$ git submodule update +``` + +就像你平时创建父存储库和把父存储库推送到 GitHub 那样添加和提交就可以了。 + +#### 从一个父存储库中删除一个子模块 + +仅仅手动删除一个子项目文件夹不会从父项目中移除这个子项目。想要删除名为 `childmodule` 的子模块,使用: + +``` +$ git rm -f childmodule +``` + +虽然 Git 子模块看起来很容易上手,但是对于初学者来说,有一定的使用门槛。 + +### Git 子树是什么? + +Git 子树 subtree,是在 Git 1.7.11 引入的,让你可以把任何存储库的副本作为子目录嵌入另一个存储库中。它是 Git 项目可以注入和管理项目依赖的几种方法之一。它在常规的提交中保存了外部依赖信息。Git 子树提供了整洁的集成点,因此很容易复原它们。 + +如果你参考 [GitHub 提供的子树教程][8]来使用子树,那么无论你什么时候添加子树,在本地都不会看到 `.gittrees` 配置文件。这让我们很难分辨哪个是子树,因为它们看起来很像普通的文件夹,但是它们却是子树的副本。默认的 Git 包中不提供带 `.gittrees` 配置文件的 Git 子树版本,因此如果你想要带 `.gittrees` 配置文件的 git-subtree 命令,必须从 Git 源码存储库的 [/contrib/subtree 文件夹][9] 下载 git-subtree。 + +你可以像克隆其他常规的存储库那样克隆任何含有子树的存储库,但由于在父存储库中有整个子树的副本,因此克隆过程可能会持续很长时间。 + +你可以用下面的命令在你的存储库中使用 Git 子树。 + +#### 向父存储库中添加一个子树 + +想要向父存储库中添加一个子树,首先你需要执行 `remote add`,之后执行 `subtree add` 命令: + +``` +$ git remote add remote-name +$ git subtree add --prefix=folder/ remote-name subtree-branchname +``` + +上面的命令会把整个子项目的提交历史合并到父存储库。 + +#### 向子树推送修改以及从子树拉取修改 + +``` +$ git subtree push-all +``` + +或者 + +``` +$ git subtree pull-all +``` + +### 你应该使用哪个? + +任何工具都有优缺点。下面是一些可能会帮助你决定哪种最适合你的特性: + + * Git 子模块的存储库占用空间更小,因为它们只是指向子项目的某次提交的链接,而 Git 子树保存了整个子项目及其提交历史。 + * Git 子模块需要在服务器中可访问,但子树是去中心化的。 + * Git 子模块大量用于基于组件的开发,而 Git 子树多用于基于系统的开发。 + +Git 子树并不是 Git 子模块的直接可替代项。有明确的说明来指导我们该使用哪种。如果有一个归属于你的外部存储库,使用场景是向它回推代码,那么就使用 Git 子模块,因为推送代码更容易。如果你有第三方代码,且不会向它推送代码,那么使用 Git 子树,因为拉取代码更容易。 + +自己尝试使用 Git 子树和子模块,然后在评论中留下你的使用感想。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/5/git-submodules-subtrees + +作者:[Manaswini Das][a] +选题:[lujun9972][b] +译者:[lxbwolf](https://github.com/lxbwolf) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/manaswinidas +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/browser_web_internet_website.png?itok=g5B_Bw62 (Digital creative of a browser on the internet) +[2]: https://opensource.com/sites/default/files/uploads/640px-bialbero_di_casorzo.jpg (Cherry tree growing on a mulberry tree) +[3]: https://opensource.com/sites/default/files/subtree_0.png (Tree with subtrees) +[4]: https://github.com/manaswinidas/Docs-test/ +[5]: https://opensource.com/sites/default/files/uploads/git-submodules_github.png (Git submodules screenshot) +[6]: mailto:folder@commitId +[7]: https://opensource.com/sites/default/files/uploads/gitmodules.png (Screenshot of .gitmodules file) +[8]: https://help.github.com/en/github/using-git/about-git-subtree-merges +[9]: https://github.com/git/git/tree/master/contrib/subtree diff --git a/published/202005/20200506 Speed up administration of Kubernetes clusters with k9s.md b/published/202005/20200506 Speed up administration of Kubernetes clusters with k9s.md new file mode 100644 index 0000000000..2d3665fc79 --- /dev/null +++ b/published/202005/20200506 Speed up administration of Kubernetes clusters with k9s.md @@ -0,0 +1,232 @@ +[#]: collector: (lujun9972) +[#]: translator: (wxy) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12247-1.html) +[#]: subject: (Speed up administration of Kubernetes clusters with k9s) +[#]: via: (https://opensource.com/article/20/5/kubernetes-administration) +[#]: author: (Jessica Cherry https://opensource.com/users/cherrybomb) + +k9s:你没看错,这是一个加速 k8s 集群管理的工具 +====== + +> 看看这个很酷的 Kubernetes 管理的终端 UI。 + +![](https://img.linux.net.cn/data/attachment/album/202005/25/104742pqjmiroc44honcs5.jpg) + +通常情况下,我写的关于 Kubernetes 管理的文章中用的都是做集群管理的 `kubectl` 命令。然而最近,有人给我介绍了 [k9s][2] 项目,可以让我快速查看并解决 Kubernetes 中的日常问题。这极大地改善了我的工作流程,我会在这篇教程中告诉你如何上手它。  + +它可以安装在 Mac、Windows 和 Linux 中,每种操作系统的说明可以在[这里][2]找到。请先完成安装,以便能够跟上本教程。 + +我会使用 Linux 和 Minikube,这是一种在个人电脑上运行 Kubernetes 的轻量级方式。按照[此教程][3]或使用[该文档][4]来安装它。 + +### 设置 k9s 配置文件 + +安装好 `k9s` 应用后,从帮助命令开始总是很好的起点。 + +``` +$ k9s help +``` + +正如你在帮助信息所看到的,我们可以用 `k9s` 来配置很多功能。我们唯一需要进行的步骤就是编写配置文件。而 `info` 命令会告诉我们该应用程序要在哪里找它的配置文件。 + +``` +$ k9s info + ____ __.________ +| |/ _/ __ \______ +| < \____ / ___/ +| | \ / /\___ \ +|____|__ \ /____//____ > + \/ \/ + +Configuration: /Users/jess/.k9s/config.yml +Logs: /var/folders/5l/c1y1gcw97szdywgf9rk1100m0000gn/T/k9s-jess.log +Screen Dumps: /var/folders/5l/c1y1gcw97szdywgf9rk1100m0000gn/T/k9s-screens-jess +``` + +如果要添加配置文件,该配置目录不存在的话就创建它,然后添加一个配置文件。 + +``` +$ mkdir -p ~/.k9s/ +$ touch ~/.k9s/config.yml +``` + +在这篇介绍中,我们将使用 `k9s` 版本库中推荐的默认 `config.yml`。维护者请注意,这种格式可能会有变化,可以[在这里查看][5]最新版本。 + +``` +k9s: +  refreshRate: 2 +  headless: false +  readOnly: false +  noIcons: false +  logger: +    tail: 200 +    buffer: 500 +    sinceSeconds: 300 +    fullScreenLogs: false +    textWrap: false +    showTime: false +  currentContext: minikube +  currentCluster: minikube +  clusters: +    minikube: +      namespace: +        active: "" +        favorites: +        - all +        - kube-system +        - default +      view: +        active: dp +  thresholds: +    cpu: +      critical: 90 +      warn: 70 +    memory: +      critical: 90 +      warn: 70 +``` + +我们设置了 `k9s` 寻找本地的 minikube 配置,所以我要确认 minikube 已经上线可以使用了。 + +``` +$ minikube status +host: Running +kubelet: Running +apiserver: Running +kubeconfig: Configured +``` + +### 运行 k9s 来探索一个 Kubernetes 集群 + +有了配置文件,并指向我们的本地集群,我们现在可以运行 `k9s` 命令了。 + +``` +$ k9s +``` + +启动后,会弹出 `k9s` 的基于文本的用户界面。在没有指定命名空间标志的情况下,它会向你显示默认命名空间中的 Pod。 + +![K9s screenshot][6] + +如果你运行在一个有很多 Pod 的环境中,默认视图可能会让人不知所措。或者,我们可以将注意力集中在给定的命名空间上。退出该应用程序,运行 `k9s -n `,其中 `` 是已存在的命名空间。在下图中,我运行了 `k9s -n minecraft`,它显示了我损坏的 Pod: + +![K9s screenshot][7] + +所以,一旦你有了 `k9s` 后,有很多事情你可以更快地完成。  + +通过快捷键来导航 `k9s`,我们可以随时使用方向键和回车键来选择列出的项目。还有不少其他的通用快捷键可以导航到不同的视图。 + +* `0`:显示在所有命名空间中的所有 Pod + ![K9s screenshot][8] +* `d`:描述所选的 Pod + ![K9s screenshot][9] +* `l`:显示所选的 Pod 的日志 + ![Using k9s to show Kubernetes pod logs][10] + +你可能会注意到 `k9s` 设置为使用 [Vim 命令键][11],包括使用 `J` 和 `K` 键上下移动等。Emacs 用户们,败退吧 :) + +### 快速查看不同的 Kubernetes 资源 + +需要去找一个不在 Pod 里的东西吗?是的,我也需要。当我们输入冒号(`:`)键时,可以使用很多快捷方式。从那里,你可以使用下面的命令来导航。 + +* `:svc`:跳转到服务视图 + ![K9s screenshot][12] +* `:deploy`:跳转到部署视图 + ![K9s screenshot][13] +* `:rb`:跳转到角色绑定视图,用于 [基于角色的访问控制(RBAC)][14]管理 + ![K9s screenshot][15] +* `:namespace`:跳转到命名空间视图 + ![K9s screenshot][16] +* `:cj`:跳转到 cronjob 视图,查看集群中计划了哪些作业。 + ![K9s screenshot][17] + +这个应用最常用的工具是键盘;要在任何页面往上或下翻页,请使用方向键。如果你需要退出,记得使用 Vim 绑定键,键入 `:q`,然后按回车键离开。 + +### 用 k9s 排除 Kubernetes 的故障示例 + +当出现故障的时候,`k9s` 怎么帮忙?举个例子,我让几个 Pod 由于配置错误而死亡。下面你可以看到我那个可怜的 “hello” 部署死了。当我们将其高亮显示出来,可以按 `d` 运行 `describe` 命令,看看是什么原因导致了故障。 + +![K9s screenshot][18] + +![K9s screenshot][19] + +草草掠过那些事件并不能告诉我们故障原因。接下来,我按了 `esc` 键,然后通过高亮显示 Pod 并输入`shift-l` 来检查日志。 + +![K9s screenshot][20] + +不幸的是,日志也没有提供任何有用的信息(可能是因为部署从未正确配置过),而且 Pod 也没有出现。 + +然后我使用 `esc` 退了出来,我看看删除 Pod 是否能解决这个问题。要做到这一点,我高亮显示该 Pod,然后使用 `ctrl-d`。幸好 `k9s` 在删除前会提示用户。  + +![K9s screenshot][21] + +虽然我确实删除了这个 Pod,但部署资源仍然存在,所以新的 Pod 会重新出现。无论什么原因(我们还不知道),它还会继续重启并死掉。 + +在这里,我会重复查看日志,描述资源,甚至使用 `e` 快捷方式来编辑运行中的 Pod 以排除故障行为。在这个特殊情况下,失败的 Pod 是因为没有配置在这个环境下运行。因此,让我们删除部署来停止崩溃接着重启的循环。 + +我们可以通过键入 `:deploy` 并点击回车进入部署。从那里我们高亮显示并按 `ctrl-d` 来删除。 + +![K9s screenshot][22] + +![K9s screenshot][23] + +这个有问题的部署被干掉了! 只用了几个按键就把这个失败的部署给清理掉了。 + +### k9s 是极其可定制的 + +这个应用有很多自定义选项、乃至于 UI 的配色方案。这里有几个可编辑的选项,你可能会感兴趣。 + +* 调整你放置 `config.yml` 文件的位置(这样你就可以把它存储在[版本控制][24]中)。 +* 在 `alias.yml` 文件中添加[自定义别名][25]。 +* 在 `hotkey.yml` 文件中创建[自定义热键][26]。 +* 探索现有的[插件][27]或编写自己的插件。 + +整个应用是在 YAML 文件中配置的,所以定制化对于任何 Kubernetes 管理员来说都会觉得很熟悉。 + +### 用 k9s 简化你的生活 + +我倾向于以一种非常手动的方式来管理我团队的系统,更多的是为了锻炼脑力,而不是别的。当我第一次听说 `k9s` 的时候,我想,“这只是懒惰的 Kubernetes 而已。”于是我否定了它,然后回到了到处进行人工干预的状态。实际上,当我在处理积压工作时就开始每天使用它,而让我震惊的是它比单独使用 `kubectl` 快得多。现在,我已经皈依了。  + +了解你的工具并掌握做事情的“硬道理”很重要。还有一点很重要的是要记住,就管理而言,重要的是要更聪明地工作,而不是更努力。使用 `k9s`,就是我践行这个目标的方法。我想,我们可以把它叫做懒惰的 Kubernetes 管理,也没关系。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/5/kubernetes-administration + +作者:[Jessica Cherry][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/cherrybomb +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/game-dogs-chess-play-lead.png?itok=NAuhav4Z (Dogs playing chess) +[2]: https://github.com/derailed/k9s +[3]: https://opensource.com/article/18/10/getting-started-minikube +[4]: https://kubernetes.io/docs/tasks/tools/install-minikube/ +[5]: https://github.com/derailed/k9s#k9s-configuration +[6]: https://opensource.com/sites/default/files/uploads/k9s_1.png (K9s screenshot) +[7]: https://opensource.com/sites/default/files/uploads/k9s_2.png (K9s screenshot) +[8]: https://opensource.com/sites/default/files/uploads/k9s_3.png (K9s screenshot) +[9]: https://opensource.com/sites/default/files/uploads/k9s_5_0.png (K9s screenshot) +[10]: https://opensource.com/sites/default/files/uploads/k9s-show-logs-opensourcedotcom.png (Using k9s to show Kubernetes pod logs) +[11]: https://opensource.com/article/19/3/getting-started-vim +[12]: https://opensource.com/sites/default/files/uploads/k9s_5.png (K9s screenshot) +[13]: https://opensource.com/sites/default/files/uploads/k9s_6.png (K9s screenshot) +[14]: https://kubernetes.io/docs/reference/access-authn-authz/rbac/ +[15]: https://opensource.com/sites/default/files/uploads/k9s_7.png (K9s screenshot) +[16]: https://opensource.com/sites/default/files/uploads/k9s_8.png (K9s screenshot) +[17]: https://opensource.com/sites/default/files/uploads/k9s_9.png (K9s screenshot) +[18]: https://opensource.com/sites/default/files/uploads/k9s_10.png (K9s screenshot) +[19]: https://opensource.com/sites/default/files/uploads/k9s_11.png (K9s screenshot) +[20]: https://opensource.com/sites/default/files/uploads/k9s_12.png (K9s screenshot) +[21]: https://opensource.com/sites/default/files/uploads/k9s_13.png (K9s screenshot) +[22]: https://opensource.com/sites/default/files/uploads/k9s_14.png (K9s screenshot) +[23]: https://opensource.com/sites/default/files/uploads/k9s_15.png (K9s screenshot) +[24]: https://opensource.com/article/19/3/move-your-dotfiles-version-control +[25]: https://k9scli.io/topics/aliases/ +[26]: https://k9scli.io/topics/hotkeys/ +[27]: https://github.com/derailed/k9s/tree/master/plugins diff --git a/published/202005/20200506 Three Methods to Check Uptime of MySQL-MariaDB Database Server on Linux.md b/published/202005/20200506 Three Methods to Check Uptime of MySQL-MariaDB Database Server on Linux.md new file mode 100644 index 0000000000..a319cb3be6 --- /dev/null +++ b/published/202005/20200506 Three Methods to Check Uptime of MySQL-MariaDB Database Server on Linux.md @@ -0,0 +1,139 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12263-1.html) +[#]: subject: (Three Methods to Check Uptime of MySQL/MariaDB Database Server on Linux) +[#]: via: (https://www.2daygeek.com/check-mysql-mariadb-database-server-uptime-linux/) +[#]: author: (Magesh Maruthamuthu https://www.2daygeek.com/author/magesh/) + +在 Linux 上检查 MySQL/MariaDB 数据库正常运行时间的三种方法 +====== + +![](https://img.linux.net.cn/data/attachment/album/202005/29/211031hqb8qlyddtlrt2fl.jpg) + +我们都知道在 Linux 中使用 `uptime` 命令的目的。它用于检查 [Linux 系统的正常运行时间][1]以及系统上次启动以来运行的时间。 + +而 Linux 管理员的工作是保持系统正常运行。 + +如果要检查 Linux 上的其他服务(例如 [Apache][2]、MySQL、MariaDB、sftp 等)运行了多长时间,该怎么做? + +每个服务都有自己的命令来检查服务的正常运行时间。但是你也可以为此使用其他命令。 + +### 方法 1:如何使用 ps 命令在 Linux 上检查 MySQL/MariaDB 数据库的正常运行时间 + +[ps 命令][3]的意思是进程状态process status。这是最基本的命令之一,它显示了系统正在运行的进程的详细信息。 + +为此,你首先需要使用 [pidof 命令][5]查找 [MySQL][4]/[MariaDB][6] 的 PID。 + +``` +# pidof mysqld | cut -d" " -f1 + +2412 +``` + +获取 MySQL/MariaDB 的 PID 后,请在 `ps` 命令中使用 `--etime` 选项获得正常运行时间。 + +* `--etime`:自进程启动以来经过的时间,形式为 `[[DD-]hh:]mm:ss`。 + +``` +# ps -p 2412 -o etime + + ELAPSED +2-08:49:30 +``` + +或者,在 `ps` 命令中使用 `--lstart` 选项来获取指定 PID 的正常运行时间。 + +``` +# ps -p 2412 -o lstart + + STARTED +Sat May 2 03:02:15 2020 +``` + +MySQL/MariaDB 进程已经运行了 2 天 03 小时 02 分 15 秒。 + +### 方法 2:如何使用 systemctl 命令在 Linux 上检查 MySQL/MariaDB 数据库的正常运行时间 + +[systemctl 命令][7]用于控制 systemd 系统和服务管理器。 + +systemd 是新的初始化系统和系统管理器,现在大多数 Linux 发行版都淘汰了传统的 SysVinit 管理器而采用了 systemd。 + +``` +# systemctl status mariadb +或者 +# systemctl status mysql + +● mariadb.service - MariaDB 10.1.44 database server + Loaded: loaded (/usr/lib/systemd/system/mariadb.service; enabled; vendor preset: disabled) + Drop-In: /etc/systemd/system/mariadb.service.d + └─migrated-from-my.cnf-settings.conf + Active: active (running) since Sat 2020-05-02 03:02:18 UTC; 2 days ago + Docs: man:mysqld(8) + https://mariadb.com/kb/en/library/systemd/ + Process: 2448 ExecStartPost=/bin/sh -c systemctl unset-environment _WSREP_START_POSITION (code=exited, status=0/SUCCESS) + Process: 2388 ExecStartPre=/bin/sh -c [ ! -e /usr/bin/galera_recovery ] && VAR= || VAR=/usr/bin/galera_recovery; [ $? -eq 0 ] && systemctl set-environment _WSREP_START_POSITION=$VAR || exit 1 (code=exited, status=0/SUCCESS) + Process: 2386 ExecStartPre=/bin/sh -c systemctl unset-environment _WSREP_START_POSITION (code=exited, status=0/SUCCESS) + Main PID: 2412 (mysqld) + Status: "Taking your SQL requests now…" + CGroup: /system.slice/mariadb.service + └─2412 /usr/sbin/mysqld + +May 03 21:41:26 ns2.2daygeek.com mysqld[2412]: 2020-05-03 21:41:26 140328136861440 [Warning] Host name '1.1.1.1' could not be resolved: … not known +May 04 02:00:46 ns2.2daygeek.com mysqld[2412]: 2020-05-04 2:00:46 140328436418304 [Warning] IP address '1.1.1.1' has been resolved to the host name '2…ss itself. +May 04 03:01:31 ns2.2daygeek.com mysqld[2412]: 2020-05-04 3:01:31 140328436111104 [Warning] IP address '1.1.1.1' could not be resolved: Temporary fai…resolution +May 04 04:03:06 ns2.2daygeek.com mysqld[2412]: 2020-05-04 4:03:06 140328136861440 [Warning] IP address '1.1.1.1' could not be resolved: Name or ser… not known +May 04 07:23:54 ns2.2daygeek.com mysqld[2412]: 2020-05-04 7:23:54 140328435189504 [Warning] IP address '1.1.1.1' could not be resolved: Name or service not known +May 04 08:03:31 ns2.2daygeek.com mysqld[2412]: 2020-05-04 8:03:31 140328436418304 [Warning] IP address '1.1.1.1' could not be resolved: Name or service not known +May 04 08:25:56 ns2.2daygeek.com mysqld[2412]: 2020-05-04 8:25:56 140328135325440 [Warning] IP address '1.1.1.1' could not be resolved: Name or service not known +Warning: Journal has been rotated since unit was started. Log output is incomplete or unavailable. +Hint: Some lines were ellipsized, use -l to show in full. +``` + +### 方法 3:如何使用 MySQLAdmin 命令在 Linux 上检查 MySQL/MariaDB 数据库的正常运行时间 + +[MySQLAdmin][8] 是安装 MySQL 软件包时安装的 MySQL 服务器命令行程序。 + +MySQLAdmin 客户端允许你在 MySQL 服务器上执行一些基本的管理功能。 + +它用于创建数据库、删除数据库、设置 root 密码、更改 root 密码、检查 MySQL 状态、验证 MySQL 功能、监视 mysql 进程以及验证服务器的配置。 + +``` +# mysqladmin -u root -pPassword version + +mysqladmin Ver 8.42 Distrib 5.7.27, for Linux on x86_64 +Copyright (c) 2000, 2019, Oracle and/or its affiliates. All rights reserved. + +Oracle is a registered trademark of Oracle Corporation and/or its +affiliates. Other names may be trademarks of their respective +owners. + +Server version 5.7.27 +Protocol version 10 +Connection Localhost via UNIX socket +UNIX socket /var/lib/mysql/mysql.sock +Uptime: 1 day 10 hours 44 min 13 sec +``` + +-------------------------------------------------------------------------------- + +via: https://www.2daygeek.com/check-mysql-mariadb-database-server-uptime-linux/ + +作者:[Magesh Maruthamuthu][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://www.2daygeek.com/author/magesh/ +[b]: https://github.com/lujun9972 +[1]: https://www.2daygeek.com/linux-system-server-uptime-check/ +[2]: https://www.2daygeek.com/check-find-apache-httpd-web-server-uptime-linux/ +[3]: https://www.2daygeek.com/linux-ps-command-find-running-process-monitoring/ +[4]: https://www.2daygeek.com/category/mysql/ +[5]: https://www.2daygeek.com/check-find-parent-process-id-pid-ppid-linux/ +[6]: https://www.2daygeek.com/category/mariadb/ +[7]: https://www.2daygeek.com/sysvinit-vs-systemd-cheatsheet-systemctl-command-usage/ +[8]: https://www.2daygeek.com/linux-mysqladmin-command-administrate-mysql-mariadb-server/ diff --git a/published/202005/20200507 Ubuntu Studio To Replace Xfce With KDE Plasma Desktop Environment.md b/published/202005/20200507 Ubuntu Studio To Replace Xfce With KDE Plasma Desktop Environment.md new file mode 100644 index 0000000000..d349c73567 --- /dev/null +++ b/published/202005/20200507 Ubuntu Studio To Replace Xfce With KDE Plasma Desktop Environment.md @@ -0,0 +1,71 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12223-1.html) +[#]: subject: (Ubuntu Studio To Replace Xfce With KDE Plasma Desktop Environment) +[#]: via: (https://itsfoss.com/ubuntu-studio-opts-for-kde/) +[#]: author: (Ankush Das https://itsfoss.com/author/ankush/) + +Ubuntu Studio 将用 KDE Plasma 桌面环境替换 Xfce +====== + +[Ubuntu Studio][1] 是一个流行的 [Ubuntu 官方变种][2],它是为从事音频制作、视频、图形、摄影和书籍出版的创意内容创建者量身定制的。它提供了许多多媒体内容创建应用,开箱即用,体验极佳。 + +在最近的 20.04 LTS 版本发布之后,Ubuntu Studio 团队在其[官方公告][3]中强调了一些非常重要的内容。而且,也许不是每个人都注意到关键信息,即 Ubuntu Studio 的未来。 + +Ubuntu Studio 20.04 将是带有 [Xfce 桌面环境][4]的最后一个版本。将来的所有发行版都将改用 [KDE Plasma][5]。 + +### 为什么 Ubuntu Studio 放弃 XFCE? + +![][6] + +据他们的澄清,Ubuntu Studio 并不专注于任何特定的外观/感受,而是旨在提供最佳的用户体验。同时,KDE 被证明是一个更好的选择。 + +> 事实证明,Plasma 为图形艺术家和摄影师提供了更好的工具,例如在 Gwenview、Krita 甚至文件管理器 Dolphin 中都可以看出。此外,它对 Wacom 平板的支持比其他任何桌面环境都更好。 + +> 它已经变得如此之好,以至于现在大部分 Ubuntu Studio 团队成员都在使用通过 Ubuntu Studio 安装程序添加了 Ubuntu Studio 的 Kubuntu 作为日常工作使用。既然我们中的这么多人都在使用 Plasma,因此在我们的下一个版本中过渡到 Plasma 似乎是个好时机。 + +当然,每一个桌面环境都是针对不同的用户量身定制的。在此,他们认为 KDE Plasma 是最适合取代 XFCE 的桌面环境,可以为所有用户提供更好的用户体验。 + +尽管我不确定用户对此会有何反应,因为每个用户都有不同的偏好。如果现有用户对 KDE 没有问题,那就没什么大问题。 + +值得注意的是,Ubuntu Studio 还提到了为什么 KDE 可能是它们的更好选择: + +> 在没有 Akonadi 的情况下,Plasma 桌面环境的资源使用与 Xfce 一样轻量级,甚至更轻。Fedora Jam 和 KXStudio 等其他以音频为重点的 Linux 发行版在历史上一直使用 KDE Plasma 桌面环境,并且在音频方面做得很好。 + +此外,他们还强调了 [Jason Evangelho 在福布斯杂志上的一篇文章][7],其中一些基准测试表明 KDE 几乎与 Xfce 一样轻量级。尽管这是一个好的迹象,我们仍然需要等待用户试驾 KDE 驱动的 Ubuntu Studio。只有这样,我们才能观察到 Ubuntu Studio 放弃 XFCE 桌面环境的决定是否正确。 + +### 更改后,Ubuntu Studio 用户将发生什么变化? + +在带有 KDE 的 Ubuntu Studio 20.10 及更高版本上的整体工作流程可能会受到影响(或改善)。 + +但是,升级过程(从 20.04 到 20.10)会导致系统损坏。因此,全新安装 Ubuntu Studio 20.10 或更高版本将是唯一的方法。 + +他们还提到,他们还会不断评估与预安装的应用是否存在重复。所以,相信在未来的日子里,更多的细节也会随之而来。 + +Ubuntu Studio 是最近一段时间内第二个改变了主桌面环境的发行版。先前,[Lubuntu][8] 从 LXDE 切换到 LXQt。 + +你如何看待这种变化?欢迎在下面的评论中分享你的想法。 + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/ubuntu-studio-opts-for-kde/ + +作者:[Ankush Das][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://itsfoss.com/author/ankush/ +[b]: https://github.com/lujun9972 +[1]: https://ubuntustudio.org/ +[2]: https://itsfoss.com/which-ubuntu-install/ +[3]: https://ubuntustudio.org/2020/04/ubuntu-studio-20-04-lts-released/ +[4]: https://xfce.org +[5]: https://kde.org/plasma-desktop +[6]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/05/ubuntu-studio-kde-xfce.jpg?ssl=1 +[7]: https://www.forbes.com/sites/jasonevangelho/2019/10/23/bold-prediction-kde-will-steal-the-lightweight-linux-desktop-crown-in-2020 +[8]: https://itsfoss.com/lubuntu-20-04-review/ diff --git a/published/202005/20200508 5 ways to split your Linux terminal.md b/published/202005/20200508 5 ways to split your Linux terminal.md new file mode 100644 index 0000000000..3bc58045fa --- /dev/null +++ b/published/202005/20200508 5 ways to split your Linux terminal.md @@ -0,0 +1,158 @@ +[#]: collector: (lujun9972) +[#]: translator: (HankChow) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12236-1.html) +[#]: subject: (5 ways to split your Linux terminal) +[#]: via: (https://opensource.com/article/20/5/split-terminal) +[#]: author: (Seth Kenlon https://opensource.com/users/seth) + +5 种拆分 Linux 终端的方法 +====== + +> 本文介绍了 Linux 提供的拆分终端的方法,它能够帮助你完成多任务工作。那么,你最喜欢哪一款终端复用工具呢? + +![](https://img.linux.net.cn/data/attachment/album/202005/21/132437ypzpqqppqh1qfznh.jpg) + +没有什么问题是不能用一个 Linux 终端解决的,如果不行,那就用两个。 + +很早以前,[终端其实是一个物理设备][2],而现在的终端实际上是在计算机上被模拟出来的一个应用程序。当你使用终端和计算机进行交互的时候,就会发现,只打开一个终端是不够用的。在进行编译、数据处理等长时间任务的时候,你不得不打开一个新终端或新选项卡tab来同时进行其它工作。 + +如果你是系统管理员,你就需要更多的终端窗口,以便连接到多个不同的主机上并行工作了。 + +在 Linux 系统中,终端应用程序在很久之前就已经开始带有选项卡功能了。而现在的终端应用程序里,选项卡已经是标配功能了,这是非常流行的趋势。尽管如此,工作的时候在多个选项卡之间来回切换,或多或少也会分散我们的注意力,甚至带来不便。 + +而最好的解决方案就是将整个屏幕划分为多个部分,这样多个终端就可以在同一个终端应用程序窗口中同时存在。Linux 发行版中也有很多相关的工具可以实现这一功能。 + +### Shell、终端和控制台 + +在此之前,我们首先要明确 Shell、终端terminal控制台console这三个概念。想要详细了解的话,请参阅 [Enable Sysadmin][2] 博客上的相关文章。 + +简而言之: + +* **Shell** 是带有命令提示符prompt的用于输入、输出的界面。准确地说,[POSIX][3] 桌面底层也运行着一个 Shell,即使这个 Shell 对用户不可见,因为用户会话就是由这个 Shell 启动的。 +* **终端**是在图形界面服务器(例如 X11 或 Wayland)中运行的应用程序,其中加载了一个 Shell。只有在终端窗口启动之后,才算是运行了一个终端。终端可以认为是操作 Shell 的一个入口。 +* **控制台**(或称“虚拟控制台”)通常表示在桌面环境以外使用的 Shell,你可以通过 `Alt+Ctrl+F2` 进入控制台,通常情况下从 `F3` 到 `F7` 都是不同的控制台,其中桌面环境有可能是 `F1` 或者 `F7`,这在不同的发行版中可能会有所不同。 + +因此,有些应用程序提供的功能是拆分 Shell 或者控制台,有些应用程序的功能则是拆分终端。 + +### tmux + +![tmux terminal][4] + +[tmux][5] 可以说是最灵活、最强大的屏幕拆分工具了,它通过键盘控制对多个终端的复用,因此你可以将一个控制台叠放在另一个控制台上面,并在两个控制台之间切换。你还可以将整个屏幕等分为多个控制台,以便同时观察不同控制台上的状况。 + +`tmux` 的所有操作都是通过键盘完成的,这就意味着你的手不需要离开键盘去寻找鼠标。为此,你需要记住一些按键组合。 + +如果你只用 `tmux` 来做屏幕拆分,那你只需要记住一下这些命令: + + * `Ctrl-B %` 竖直拆分屏幕(两个 Shell 分别位于左右) + * `Ctrl-B "` 水平拆分屏幕(两个 Shell 分别位于上下) + * `Ctrl-B O` 切换到另一个 Shell + * `Ctrl-B ?` 查看帮助 + * `Ctrl-B d` 断开 `tmux` 并让其在后台运行(可以使用 `tmux attach` 重新进入) + +`tmux` 的一大好处是,在一台计算机上启动 `tmux` 会话之后,也可以从另一台计算机上进入到这个会话,由此可以看出,`tmux` 对 Shell 进行了守护进程化daemonize。 + +例如,当我在树莓派上运行 `tmux`,我就可以从计算机上连接到树莓派并登录 IRC,当我断开连接时,树莓派上的 `tmux` 会继续运行,并等待我的下一次连接,在此期间 IRC 是处于持续登录状态的。 + +### GNU Screen + +![GNU Screen terminal][6] + +[GNU Screen][7] 也是一个 Shell 复用工具,类似于 `tmux`,你可以在断开一个活动会话后重连到其中,它也支持竖直或水平拆分屏幕。 + +`screen` 的灵活性比 `tmux` 要弱一些。它默认的绑定按键组合是 `Ctrl-A`,和 Bash 中光标移动到行首的快捷键是一样的。因此,当你正在运行 `screen` 的时候,如果想要将光标移动到行首,就需要多按一次 `Ctrl-A`。而我自己的做法是,在 `$HOME/.screenrc` 文件中将绑定按键组合重新设置为 `Ctrl-J`。 + +``` +escape ^jJ +``` + +尽管 `screen` 在屏幕拆分功能上做得很好,但 `tmux` 上的一些缺点在 Screen 上也同样存在。例如在拆分 Shell 时,在一个新的面板中不会启动新的 Shell ,而是需要使用 `Ctrl-A Tab` 导航到另一个面板(如果你按照我的方式重新设置了按键组合,需要对应地把 `Ctrl-A` 改为 `Ctrl-J`),然后通过 `Ctrl-A C` 手动创建一个新的 Shell。 + +和 `tmux` 不同的是,`screen` 在退出一个 Shell 的时候,屏幕拆分状态不会改变,这样的设计在某些情况下是比较适合的,但麻烦之处在于需要手动管理屏幕拆分状态。 + +尽管如此,`screen` 还是一个相当可靠灵活的应用程序,在无法使用 `tmux` 的时候,你可以选择 `screen` 作为备选方案。 + +在默认按键方案下,`screen` 常用的基本命令包括: + + * `Ctrl-A |` 竖直拆分屏幕(两个 Shell 分别位于左右) + * `Ctrl-A S` 水平拆分屏幕(两个 Shell 分别位于上下) + * `Ctrl-A Tab` 切换到另一个 Shell + * `Ctrl-A ?` 查看帮助 + * `Ctrl-A d` 断开 `screen` 并让其在后台运行(可以使用 `screen -r` 重新进入) + +### Konsole + +![Konsole screen][8] + +[Konsole][9] 是 KDE Plasma 桌面使用的终端应用程序。和 KDE 一样,Konsole 也以高度可定制、功能强大的特点而著称。 + +和 `tmux`、GNU Screen 类似,Konsole 也具有拆分屏幕的功能。由于 Konsole 是图形界面的终端,因此还可以用鼠标来控制它的屏幕拆分。 + +Konsole 的屏幕拆分功能在“查看View”菜单中。它也支持竖直和水平方向的拆分,只要点击鼠标就可以切换到另一个面板上。每个面板都是一个独立的终端,因此都可以拥有独立的主题和标签页。 + +Konsole 和 `tmux`、GNU Screen 最大的不同之处在于不能断开和重新连接 Konsole。除非使用远程桌面软件,否则只能在打开 Konsole 时使用,这一点和大多数图形界面应用程序是一样的。 + +### Emacs + +![Emacs rpg][10] + +严格来说,Emacs 并不算是一个终端复用工具,但它的使用界面支持拆分和调整大小,同时还带有一个内建的终端。 + +如果 Emacs 是你日常使用的文本编辑器,你就可以在不关闭编辑器的情况下,在不同的应用程序之间轻松互相切换。由于 Emacs eshell 模块是通过 eLISP 实现的,因此你可以在 Emacs 中使用相同的命令进行交互,让一些繁琐的操作变得更为简单。 + +如果你是在图形界面中使用 Emacs,还可以使用鼠标进行操作。例如通过点击切换面板、用鼠标调整拆分屏幕的的大小等等。尽管如此,键盘的操作速度还是更快,因此记住一些键盘快捷键还是很有必要的。 + +Emacs 的一些重要快捷键包括: + + * `Ctrl-X 3` 竖直拆分屏幕(两个 Shell 分别位于左右) + * `Ctrl-X 2` 水平拆分屏幕(两个 Shell 分别位于上下) + * `Ctrl-X O` (大写字母 `O`)切换到另一个 Shell(你也可以使用鼠标操作) + * `Ctrl-X 0` (数字 `0`)关闭当前面板 + +如果你运行了 emacs-client 的话,就可以像 tmux 和 GNU Screen 一样断开和重新连接到 Emacs 了。 + +### 窗口管理器 + +![Ratpoison split screen][11] + +除了文本编辑器之外,一些 Linux 桌面也同样具有拆分屏幕、加载终端这样的功能。例如 [Ratpoison][12]、[Herbsluftwm][13]、i3、Awesome,甚至是启用了特定设置的 KDE Plasma 桌面,都可以将多个应用程序在桌面上分块显示。 + +这些桌面可以让各个应用程序占据屏幕的固定位置,而不是浮在你的桌面“之上”,因此你可以在多个应用程序窗口之间轻松切换。你还可以打开多个终端,排布成网格,就像终端复用工具一样。更进一步,你还可以在你的桌面复用工具中加载一个终端复用工具。 + +而且,没有什么可以阻止你在里面载入 Emacs 并分割缓冲区。没有人知道,如果你把它更进一步,会发生什么,大多数 Linux 用户不会外传这种秘密。 + +和 `tmux`、GNU Screen 不同,你在断开与桌面的连接后无法重新连接到同一个桌面会话,除非你使用了远程桌面软件进行连接。 + +### 更多选择 + +除了上面介绍到的工具以外,还有诸如 [Tilix][14]、Terminator 这样的终端模拟器,它们同样可以实现屏幕拆分、嵌入终端组件等功能。欢迎在评论区分享你喜欢的终端拆分工具。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/5/split-terminal + +作者:[Seth Kenlon][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/seth +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/freedos.png?itok=aOBLy7Ky (4 different color terminal windows with code) +[2]: https://www.redhat.com/sysadmin/terminals-shells-consoles +[3]: https://opensource.com/article/19/7/what-posix-richard-stallman-explains +[4]: https://opensource.com/sites/default/files/uploads/terminal-split-tmux2.png (tmux terminal) +[5]: https://github.com/tmux/tmux +[6]: https://opensource.com/sites/default/files/uploads/terminal-split-screen.png (GNU Screen terminal) +[7]: https://www.gnu.org/software/screen/ +[8]: https://opensource.com/sites/default/files/uploads/konsole.jpg (Konsole screen) +[9]: https://konsole.kde.org +[10]: https://opensource.com/sites/default/files/uploads/emacs-rpg_0.jpg (Emacs rpg) +[11]: https://opensource.com/sites/default/files/uploads/advent-ratpoison-split_0.jpg (Ratpoison split screen) +[12]: https://opensource.com/article/19/12/ratpoison-linux-desktop +[13]: https://opensource.com/article/19/12/herbstluftwm-linux-desktop +[14]: https://gnunn1.github.io/tilix-web/ diff --git a/published/202005/20200508 Fixing -Unable to parse package file -var-lib-apt-lists- Error in Ubuntu and Other Linux Distributions.md b/published/202005/20200508 Fixing -Unable to parse package file -var-lib-apt-lists- Error in Ubuntu and Other Linux Distributions.md new file mode 100644 index 0000000000..41c25c7d8d --- /dev/null +++ b/published/202005/20200508 Fixing -Unable to parse package file -var-lib-apt-lists- Error in Ubuntu and Other Linux Distributions.md @@ -0,0 +1,118 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12216-1.html) +[#]: subject: (Fixing “Unable to parse package file /var/lib/apt/lists” Error in Ubuntu and Other Linux Distributions) +[#]: via: (https://itsfoss.com/unable-to-parse-package-file/) +[#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/) + +修复 Ubuntu 中的 “Unable to parse package file” 错误 +====== + +过去,我已经讨论了许多 [Ubuntu 更新错误][1]。如果你[使用命令行更新 Ubuntu][2],那可能会遇到一些“错误”。 + +其中一些“错误”基本上是内置功能,可防止对系统进行不必要的更改。在本教程中,我不会涉及那些细节。 + +在本文中,我将向你展示如何解决在更新系统或安装新软件时可能遇到的以下错误: + +``` +Reading package lists… Error! +E: Unable to parse package file /var/lib/apt/lists/archive.ubuntu.com_ubuntu_dists_bionic_InRelease +E: The package lists or status file could not be parsed or opened. +``` + +在 Debian 中可能会遇到类似的错误: + +``` +E: Unable to parse package file /var/lib/apt/extended_states (1) +``` + +即使遇到 `The package cache file is corrupted` 也完全不必惊慌。这真的很容易“修复”。 + +### 在基于 Ubuntu 和 Debian 的 Linux 发行版中处理 “Unable to parse package file” 错误 + +![][3] + +以下是你需要做的。仔细查看 [Ubuntu][4] 报错文件的名称和路径。 + +``` +Reading package lists… Error! +E: Unable to parse package file /var/lib/apt/lists/archive.ubuntu.com_ubuntu_dists_bionic_InRelease +E: The package lists or status file could not be parsed or opened. +``` + +例如,上面的错误是在报 `/var/lib/apt/lists/archive.ubuntu.com_ubuntu_dists_bionic_InRelease` 文件错误。 + +这让你想到这个文件不正确。现在,你需要做的就是删除该文件并重新生成缓存。 + +``` +sudo rm +``` + +因此,这里我可以使用以下命令:`sudo rm /var/lib/apt/lists/archive.ubuntu.com_ubuntu_dists_bionic_InRelease`,然后使用 `sudo apt update` 命令重建缓存。 + +#### 给初学者的分步指导 + +如果你熟悉 Linux 命令,那么可能知道如何使用绝对路径删除文件。对于新手用户,让我指导你安全删除文件。 + +首先,你应该进入文件目录: + +``` +cd /var/lib/apt/lists/ +``` + +现在删除无法解析的文件: + +``` +sudo rm archive.ubuntu.com_ubuntu_dists_bionic_InRelease +``` + +现在,如果你再次运行更新,将重新生成 apt 缓存。 + +``` +sudo apt update +``` + +#### 有很多文件无法解析? + +如果你在更新系统时有一个或两个文件无法解析,那么问题不大。但是,如果系统报错有十个或二十个此类文件,那么一一删除它们就太累了。 + +在这种情况下,你可以执行以下操作来删除整个缓存,然后再次生成它: + +``` +sudo rm -r /var/lib/apt/lists/* +sudo apt update +``` + +#### 解释这为何能解决问题 + +`/var/lib/apt` 是与 apt 软件包管理器相关的文件和数据的存储目录。`/var/lib/apt/lists` 是用于保存系统 `source.list` 中指定的每个软件包资源信息的目录。 + +简单点来说,`/var/lib/apt/lists` 保存软件包信息缓存。当你要安装或更新程序时,系统会在此目录中检查该软件包中的信息。如果找到了该包的详细信息,那么它将进入远程仓库并实际下载程序或其更新。 + +当你运行 `sudo apt update` 时,它将构建缓存。这就是为什么即使删除 `/var/lib/apt/lists` 目录中的所有内容,运行更新也会建立新的缓存的原因。 + +这就是处理文件无法解析问题的方式。你的系统报某个软件包或仓库信息以某种方式损坏(下载失败或手动更改 `sources.list`)。删除该文件(或所有文件)并重建缓存即可解决此问题。 + +#### 仍然有错误? + +这应该能解决你的问题。但是,如果问题仍然存在,或者你还有其他相关问题,请在评论栏告诉我,我将尽力帮助你。 + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/unable-to-parse-package-file/ + +作者:[Abhishek Prakash][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://itsfoss.com/author/abhishek/ +[b]: https://github.com/lujun9972 +[1]: https://itsfoss.com/ubuntu-update-error/ +[2]: https://itsfoss.com/update-ubuntu/ +[3]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/05/Unable-to-parse-package-file.png?ssl=1 +[4]: https://ubuntu.com/ diff --git a/published/202005/20200508 Getting started with FreeBSD as a desktop operating system.md b/published/202005/20200508 Getting started with FreeBSD as a desktop operating system.md new file mode 100644 index 0000000000..ef63e7b696 --- /dev/null +++ b/published/202005/20200508 Getting started with FreeBSD as a desktop operating system.md @@ -0,0 +1,69 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12225-1.html) +[#]: subject: (Getting started with FreeBSD as a desktop operating system) +[#]: via: (https://opensource.com/article/20/5/furybsd-linux) +[#]: author: (Joshua Allen Holm https://opensource.com/users/holmja) + +使用 FreeBSD 作为桌面操作系统 +====== + +> FuryBSD 的实时桌面环境能让你在实际使用之前先尝试。 + +![FuryBSD Post-Install XFCE Desktop][10] + +[FreeBSD][2] 是一个很棒的操作系统,但是从设计上讲,它并没有自带桌面环境。如果不从 FreeBSD 的 [ports 和软件包集][3]安装其他软件,那么 FreeBSD 仅能体验命令行。下面的截图显示了在安装过程中选择了每个“可选系统组件”后,登录 FreeBSD 12.1 的样子。 + +![FreeBSD][4] + +FreeBSD 可以用各种桌面环境中的任何一种来变成桌面操作系统,但是这需要时间、精力和[遵循大量书面说明][5]。使用使用 desktop-installer 包(为用户提供基于文本的菜单并帮助自动执行大部分过程)仍然非常耗时。这两种方法的最大问题是,用户可能在花了很多时间进行设置之后,可能会发现他们的硬件系统与 FreeBSD 不完全兼容。 + +[FuryBSD][6] 通过提供实时桌面镜像来解决此问题,用户可以在安装之前对其进行评估。目前,FuryBSD 提供 Xfce 镜像和 KDE 镜像。每个镜像都提供了一个已预安装桌面环境的 FreeBSD。如果用户试用该镜像并发现其硬件工作正常,那么他们可以安装 FuryBSD,并拥有一个由 FreeBSD 驱动的即用桌面操作系统。在本文中,我会使用 Xfce 镜像,但 KDE 镜像的工作原理完全一样。 + +对于安装过 Linux 发行版、BSD 或任何其他类 Unix 的开源操作系统的人,FuryBSD 的上手过程应该很熟悉。从 FuryBSD 网站下载 ISO,将它复制到闪存盘,然后从闪存盘启动计算机。如果从闪存盘引导失败,请确保“安全引导”已禁用。 + +![FuryBSD Live XFCE Desktop][7] + +从闪存盘启动后,桌面环境将自动加载。除了“家”、“文件系统”和“回收站”图标外,实时桌面还有用于配置 Xorg 的工具、入门指南、FuryBSD 安装程序和系统信息程序的图标。除了这些额外功能以及一些自定义的 Xfce 设置和壁纸外,桌面环境除了基本的 Xfce 应用和 Firefox 之外并没有其他功能。 + +![FuryBSD Xorg Tool][8] + +此时仅加载基本的图形驱动,但足以检查 FuryBSD 是否支持系统的有线和无线网络接口。如果网络接口没有一个能自动工作,那么 `Getting Started.txt` 文件包含有关尝试配置网络接口和其他配置任务的说明。如果至少有一个网络接口有效,那么可以使用 Configure Xorg 应用安装 Intel、NVidia 或 VirtualBox 图形驱动。它将下载并安装驱动,并且需要重新启动 Xorg。如果系统未自动重新登录到实时镜像用户,那么密码为 `furybsd`(你可以使用它来登录)。配置后,图形驱动将转移到已安装的系统中。 + +![FuryBSD Installer - ZFS Configuration][9] + +如果一切都可以在实时环境中正常运行,那么 FuryBSD 安装程序可以将 FuryBSD 配置并安装到计算机上。该安装程序在终端中运行,但提供与大多数其他 BSD 和 Linux 安装程序相同的选项。系统将要求用户设置系统的主机名、配置 ZFS 存储、设置 root 密码,添加至少一个非 root 用户以及配置时间和日期。完成后,系统可以引导到预装有 Xfce (或 KDE)的 FreeBSD 中。FuryBSD 完成了所有困难的工作,甚至还花了很多精力使桌面看起来更漂亮。 + + + +如上所述,桌面环境没有大量预装软件,因此几乎肯定要安装额外的软件包。最快的方法是在终端中使用 `pkg` 命令。该命令的行为很像 `dnf` 和 `apt`,因此使用过其中之一的来自 Linux 发行版的用户在查找和安装软件包时应该感到很熟悉。FreeBSD 的软件包集合非常多,因此大多数知名的开源软件包都可用。 + +如果用户在没有太多 FreeBSD 经验的情况下尝试 FuryBSD,应查阅 [FreeBSD 手册][11],以了解有关如何以 FreeBSD 的方式操作。有任何 Linux 发行版或其他 BSD 使用经验的用户应该能弄清很多事情,但是手册可以帮助你弄清一些差异。进一步了解 FreeBSD 的一个很好的资源是 Michael W. Lucas 的 《[Absolute FreeBSD,第三版][12]》。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/5/furybsd-linux + +作者:[Joshua Allen Holm][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/holmja +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/web_browser_desktop_devlopment_design_system_computer.jpg?itok=pfqRrJgh (web development and design, desktop and browser) +[2]: https://www.freebsd.org +[3]: https://www.freebsd.org/ports/ +[4]: https://opensource.com/sites/default/files/uploads/freebsd.png (FreeBSD) +[5]: https://www.freebsdfoundation.org/freebsd/how-to-guides/installing-a-desktop-environment-on-freebsd/ +[6]: https://www.furybsd.org +[7]: https://opensource.com/sites/default/files/uploads/furybsd_live_xfce_desktop.png (FuryBSD Live XFCE Desktop) +[8]: https://opensource.com/sites/default/files/uploads/furybsd_xorg_tool.png (FuryBSD Xorg Tool) +[9]: https://opensource.com/sites/default/files/uploads/furybsd_installer_-_zfs_configuration.png (FuryBSD Installer - ZFS Configuration) +[10]: https://opensource.com/sites/default/files/uploads/furybsd_post-install_xfce_desktop.png (FuryBSD Post-Install XFCE Desktop) +[11]: https://www.freebsd.org/doc/en_US.ISO8859-1/books/handbook/ +[12]: https://nostarch.com/absfreebsd3 diff --git a/published/202005/20200509 Ensmallening Go binaries by prohibiting comparisons.md b/published/202005/20200509 Ensmallening Go binaries by prohibiting comparisons.md new file mode 100644 index 0000000000..1d1a6b1590 --- /dev/null +++ b/published/202005/20200509 Ensmallening Go binaries by prohibiting comparisons.md @@ -0,0 +1,162 @@ +[#]: collector: (lujun9972) +[#]: translator: (lxbwolf) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12238-1.html) +[#]: subject: (Ensmallening Go binaries by prohibiting comparisons) +[#]: via: (https://dave.cheney.net/2020/05/09/ensmallening-go-binaries-by-prohibiting-comparisons) +[#]: author: (Dave Cheney https://dave.cheney.net/author/davecheney) + +通过禁止比较让 Go 二进制文件变小 +====== + +![](https://img.linux.net.cn/data/attachment/album/202005/22/101617lcha7vvqzhh7d565.jpg) + +大家常规的认知是,Go 程序中声明的类型越多,生成的二进制文件就越大。这个符合直觉,毕竟如果你写的代码不去操作定义的类型,那么定义一堆类型就没有意义了。然而,链接器的部分工作就是检测没有被程序引用的函数(比如说它们是一个库的一部分,其中只有一个子集的功能被使用),然后把它们从最后的编译产出中删除。常言道,“类型越多,二进制文件越大”,对于多数 Go 程序还是正确的。 + +本文中我会深入讲解在 Go 程序的上下文中“相等”的意义,以及为什么[像这样][1]的修改会对 Go 程序的大小有重大的影响。 + +### 定义两个值相等 + +Go 的语法定义了“赋值”和“相等”的概念。赋值是把一个值赋给一个标识符的行为。并不是所有声明的标识符都可以被赋值,如常量和函数就不可以。相等是通过检查标识符的内容是否相等来比较两个标识符的行为。 + +作为强类型语言,“相同”的概念从根源上被植入标识符的类型中。两个标识符只有是相同类型的前提下,才有可能相同。除此之外,值的类型定义了如何比较该类型的两个值。 + +例如,整型是用算数方法进行比较的。对于指针类型,是否相等是指它们指向的地址是否相同。映射和通道等引用类型,跟指针类似,如果它们指向相同的地址,那么就认为它们是相同的。 + +上面都是按位比较相等的例子,即值占用的内存的位模式是相同的,那么这些值就相等。这就是所谓的 memcmp,即内存比较,相等是通过比较两个内存区域的内容来定义的。 + +记住这个思路,我过会儿再来谈。 + +### 结构体相等 + +除了整型、浮点型和指针等标量类型,还有复合类型:结构体。所有的结构体以程序中的顺序被排列在内存中。因此下面这个声明: + +``` +type S struct { + a, b, c, d int64 +} +``` + +会占用 32 字节的内存空间;`a` 占用 8 个字节,`b` 占用 8 个字节,以此类推。Go 的规则说如果结构体所有的字段都是可以比较的,那么结构体的值就是可以比较的。因此如果两个结构体所有的字段都相等,那么它们就相等。 + +``` +a := S{1, 2, 3, 4} +b := S{1, 2, 3, 4} +fmt.Println(a == b) // 输出 true +``` + +编译器在底层使用 memcmp 来比较 `a` 的 32 个字节和 `b` 的 32 个字节。 + +### 填充和对齐 + +然而,在下面的场景下过分简单化的按位比较的策略会返回错误的结果: + +``` +type S struct { + a byte + b uint64 + c int16 + d uint32 +} + +func main() + a := S{1, 2, 3, 4} + b := S{1, 2, 3, 4} + fmt.Println(a == b) // 输出 true +} +``` + +编译代码后,这个比较表达式的结果还是 `true`,但是编译器在底层并不能仅依赖比较 `a` 和 `b` 的位模式,因为结构体有*填充*。 + +Go 要求结构体的所有字段都对齐。2 字节的值必须从偶数地址开始,4 字节的值必须从 4 的倍数地址开始,以此类推 [^1]。编译器根据字段的类型和底层平台加入了填充来确保字段都*对齐*。在填充之后,编译器实际上看到的是 [^2]: + +``` +type S struct { + a byte + _ [7]byte // 填充 + b uint64 + c int16 + _ [2]int16 // 填充 + d uint32 +} +``` + +填充的存在保证了字段正确对齐,而填充确实占用了内存空间,但是填充字节的内容是未知的。你可能会认为在 Go 中 填充字节都是 0,但实际上并不是 — 填充字节的内容是未定义的。由于它们并不是被定义为某个确定的值,因此按位比较会因为分布在 `s` 的 24 字节中的 9 个填充字节不一样而返回错误结果。 + +Go 通过生成所谓的相等函数来解决这个问题。在这个例子中,`s` 的相等函数只比较函数中的字段略过填充部分,这样就能正确比较类型 `s` 的两个值。 + +### 类型算法 + +呵,这是个很大的设置,说明了为什么,对于 Go 程序中定义的每种类型,编译器都会生成几个支持函数,编译器内部把它们称作类型的算法。如果类型是一个映射的键,那么除相等函数外,编译器还会生成一个哈希函数。为了维持稳定,哈希函数在计算结果时也会像相等函数一样考虑诸如填充等因素。 + +凭直觉判断编译器什么时候生成这些函数实际上很难,有时并不明显,(因为)这超出了你的预期,而且链接器也很难消除没有被使用的函数,因为反射往往导致链接器在裁剪类型时变得更保守。 + +### 通过禁止比较来减小二进制文件的大小 + +现在,我们来解释一下 Brad 的修改。向类型添加一个不可比较的字段 [^3],结构体也随之变成不可比较的,从而强制编译器不再生成相等函数和哈希函数,规避了链接器对那些类型的消除,在实际应用中减小了生成的二进制文件的大小。作为这项技术的一个例子,下面的程序: + +``` +package main + +import "fmt" + +func main() { + type t struct { + // _ [0][]byte // 取消注释以阻止比较 + a byte + b uint16 + c int32 + d uint64 + } + var a t + fmt.Println(a) +} +``` + +用 Go 1.14.2(darwin/amd64)编译,大小从 2174088 降到了 2174056,节省了 32 字节。单独看节省的这 32 字节似乎微不足道,但是考虑到你的程序中每个类型及其传递闭包都会生成相等和哈希函数,还有它们的依赖,这些函数的大小随类型大小和复杂度的不同而不同,禁止它们会大大减小最终的二进制文件的大小,效果比之前使用 `-ldflags="-s -w"` 还要好。 + +最后总结一下,如果你不想把类型定义为可比较的,可以在源码层级强制实现像这样的奇技淫巧,会使生成的二进制文件变小。 + +* * * + +附录:在 Brad 的推动下,[Cherry Zhang][5] 和 [Keith Randall][6] 已经在 Go 1.15 做了大量的改进,修复了最严重的故障,消除了无用的相等和哈希函数(虽然我猜想这也是为了避免这类 CL 的扩散)。 + +[^1]: 在 32 位平台上 `int64` 和 `unit64` 的值可能不是按 8 字节对齐的,因为平台原生的是以 4 字节对齐的。查看 [议题 599][7] 了解内部详细信息。 +[^2]: 32 位平台会在 `a` 和 `b` 的声明中填充 `_ [3]byte`。参见前一条。 +[^3]: Brad 使用的是`[0]func()`,但是所有能限制和禁止比较的类型都可以。添加了一个有 0 个元素的数组的声明后,结构体的大小和对齐不会受影响。 + +#### 相关文章: + + 1. [Go 运行时如何高效地实现映射(不使用泛型)][11] + 2. [空结构体][12] + 3. [填充很难][13] + 4. [Go 中有类型的 nil(2)][14] + +-------------------------------------------------------------------------------- + +via: https://dave.cheney.net/2020/05/09/ensmallening-go-binaries-by-prohibiting-comparisons + +作者:[Dave Cheney][a] +选题:[lujun9972][b] +译者:[lxbwolf](https://github.com/lxbwolf) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://dave.cheney.net/author/davecheney +[b]: https://github.com/lujun9972 +[1]: https://github.com/golang/net/commit/e0ff5e5a1de5b859e2d48a2830d7933b3ab5b75f +[2]: tmp.uBLyaVR1Hm#easy-footnote-bottom-1-4116 (On 32bit platforms int64 and uint64 values may not be 8 byte aligned as the natural alignment of the platform is 4 bytes. See issue 599 for the gory details.) +[3]: tmp.uBLyaVR1Hm#easy-footnote-bottom-2-4116 (32 bit platforms would see _ [3]byte padding between the declaration of a and b. See previous.) +[4]: tmp.uBLyaVR1Hm#easy-footnote-bottom-3-4116 (Brad used [0]func(), but any type that the spec limits or prohibits comparisons on will do. By declaring the array has zero elements the type has no impact on the size or alignment of the struct.) +[5]: https://go-review.googlesource.com/c/go/+/231397 +[6]: https://go-review.googlesource.com/c/go/+/191198 +[7]: https://github.com/golang/go/issues/599 +[8]: tmp.uBLyaVR1Hm#easy-footnote-1-4116 +[9]: tmp.uBLyaVR1Hm#easy-footnote-2-4116 +[10]: tmp.uBLyaVR1Hm#easy-footnote-3-4116 +[11]: https://dave.cheney.net/2018/05/29/how-the-go-runtime-implements-maps-efficiently-without-generics (How the Go runtime implements maps efficiently (without generics)) +[12]: https://dave.cheney.net/2014/03/25/the-empty-struct (The empty struct) +[13]: https://dave.cheney.net/2015/10/09/padding-is-hard (Padding is hard) +[14]: https://dave.cheney.net/2017/08/09/typed-nils-in-go-2 (Typed nils in Go 2) diff --git a/published/202005/20200511 Can-t Install Deb File on Ubuntu 20.04- Here-s What You Need to do.md b/published/202005/20200511 Can-t Install Deb File on Ubuntu 20.04- Here-s What You Need to do.md new file mode 100644 index 0000000000..bc6bc1aec8 --- /dev/null +++ b/published/202005/20200511 Can-t Install Deb File on Ubuntu 20.04- Here-s What You Need to do.md @@ -0,0 +1,79 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12220-1.html) +[#]: subject: (Can’t Install Deb File on Ubuntu 20.04? Here’s What You Need to do!) +[#]: via: (https://itsfoss.com/cant-install-deb-file-ubuntu/) +[#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/) + +无法在 Ubuntu 20.04 上安装 Deb 文件?这是你需要做的! +====== + +> 双击 deb 文件后无法通过 Ubuntu 20.04 的软件中心安装?你不是唯一遇到此问题的人。本教程展示了解决方法。 + +![](https://img.linux.net.cn/data/attachment/album/202005/15/112149cfdyg556upv6vd66.jpg) + +在“[安装 Ubuntu 20.04 之后要做的事][1]”一文中,一些读者提到他们[用 Deb 文件安装软件][2]遇到了麻烦。 + +我发现这很奇怪,因为使用 deb 文件安装程序是最简单的方法之一。你要做的就是双击下载的文件,它会在软件中心中打开(默认情况下)。单击安装,它要求你输入密码,并在几秒钟/分钟内安装了该软件。 + +我[从 19.10 升级到 Ubuntu 20.04][3]直到今天都没有遇到这个问题。 + +我下载了 .deb 文件来安装 [Rocket Chat Messenger][4],然后双击该文件安装时,文件用存档管理器打开。这不是我所期望的。 + +![DEB files opened with Archive Manager instead of Software Center][5] + +“修复”很简单,我将在本教程中向你展示。 + +### 在 Ubuntu 20.04 中安装 deb 文件 + +由于某些原因,在 Ubuntu 20.04 中 deb 文件的默认打开程序被设置为存档管理器。存档管理器是用于[解压 zip][6] 和其他压缩文件。 + +解决此问题的方法非常简单。[在 Ubuntu 中更改默认应用][7],将打开 DEB 文件从“存档管理器”改到“软件安装”。让我告诉你步骤。 + +**步骤 1:**右键单击下载的 .deb 文件,然后选择**属性**: + +![][8] + +**步骤 2:**进入“**打开方式**”标签,选择“**软件安装**”,然后点击“**设置为默认**”。 + +![][9] + +这样,以后所有的 .deb 文件都将通过“软件安装”即软件中心打开。 + +双击 .deb 文件确认,看看是否在软件中心中打开。 + +### 忽视的 bug 还是愚蠢的功能? + +为什么会用存档管理器打开 deb 文件让人无法理解。我确实希望这是一个 bug,而不是像[在 Ubuntu 20.04 中不允许在桌面上拖放文件][10]这样的怪异功能。 + +既然我们在讨论 deb 文件的安装,就让我告诉你一个不错的工具 [gdebi][11]。它是一个轻量级应用,其唯一目的是安装 DEB 文件。有时它也可以处理依赖关系。 + +你可以了解更多有关[使用 gdebi 并默认设为安装 deb 文件的工具][12]。 + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/cant-install-deb-file-ubuntu/ + +作者:[Abhishek Prakash][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://itsfoss.com/author/abhishek/ +[b]: https://github.com/lujun9972 +[1]: https://linux.cn/article-12183-1.html +[2]: https://itsfoss.com/install-deb-files-ubuntu/ +[3]: https://itsfoss.com/upgrade-ubuntu-version/ +[4]: https://rocket.chat/ +[5]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/05/error-opening-deb-file.png?ssl=1 +[6]: https://itsfoss.com/unzip-linux/ +[7]: https://itsfoss.com/change-default-applications-ubuntu/ +[8]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/05/open-deb-files.png?ssl=1 +[9]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/05/deb-file-install-fix-ubuntu.png?fit=800%2C454&ssl=1 +[10]: https://itsfoss.com/add-files-on-desktop-ubuntu/ +[11]: https://launchpad.net/gdebi +[12]: https://itsfoss.com/gdebi-default-ubuntu-software-center/ diff --git a/published/202005/20200520 How to configure your router using VTY shell.md b/published/202005/20200520 How to configure your router using VTY shell.md new file mode 100644 index 0000000000..5b2874fa82 --- /dev/null +++ b/published/202005/20200520 How to configure your router using VTY shell.md @@ -0,0 +1,188 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12268-1.html) +[#]: subject: (How to configure your router using VTY shell) +[#]: via: (https://opensource.com/article/20/5/vty-shell) +[#]: author: (M Umer https://opensource.com/users/noisybotnet) + +如何使用 VTY Shell 配置路由器 +====== + +> FRR(free range routing)给了你实现多种协议的选择。本指南将帮助你入门。 + +![](https://img.linux.net.cn/data/attachment/album/202005/31/122310xi9aag5iqihqgcxl.jpg) + +最近,我写了一篇文章,解释了如何使用 [Quagga][2] 路由套件实现开放式最短路径优先Open Shortest Path First(OSPF)。可以使用多个软件套件代替 Quagga 来实现不同的路由协议。其中一种是 FRR(free range routing)。 + +### FRR + +[FRR][3] 是一个路由软件套件,它衍生自 Quagga,并在 GNU GPL2 许可下分发。与 Quagga 一样,它为类 Unix 平台提供了所有主要路由协议的实现,例如 OSPF、路由信息协议Routing Information Protocol(RIP)、边界网关协议Border Gateway Protocol(BGP) 和中间系统到中间系统Intermediate system-to-intermediate system (IS-IS)。 + +开发了 Quagga 的一些公司,例如 Big Switch Networks、Cumulus、Open Source Routing 和 6wind,创建了 FRR 以在 Quagga 的良好基础上进行改善。 + +#### 体系结构 + +FRR 是一组守护进程,它们可以共同构建路由表。每个主协议都在其自己的守护进程中实现,并且这些守护进程与独立于协议的核心守护进程 Zebra 通信,后者提供内核路由表更新、接口查找以及不同路由协议之间路由的重新分配。每个特定协议的守护进程负责运行相关协议并根据交换的信息构建路由表。 + +![FRR architecture][4] + +### VTY shell + +[VTYSH][5] 是 FRR 路由引擎的集成 shell。它将每个守护进程中定义的所有 CLI 命令合并,并在单个 shell 中将它们呈现给用户。它提供了类似于 Cisco 的命令行模式,并且许多命令与 Cisco IOS 命令相似。CLI 有不同的模式,某些命令仅在特定模式下可用。 + +### 设置 + +在本教程中,我们将使用 FRR 配置动态路由来实现路由信息协议(RIP)。我们可以通过两种方式来做到这一点:在编辑器中编辑协议守护进程配置文件或使用 VTY Shell。在此例中,我们将使用 VTY shell。我们的设置包括两个名为 Alpha 和 Beta 的 CentOS 7.7 主机。这两台主机都有两个网络接口,并共享对 192.168.122.0/24 网络的访问。我们将广播 10.12.11.0/24 和 10.10.10.0/24 网络的路由。 + +对于主机 Alpha: + +* eth0 IP:192.168.122.100/24 +* 网关:192.168.122.1 +* eth1 IP:10.10.10.12/24 + +对于主机 Beta: + +* eth0 IP:192.168.122.50/24 +* 网关:192.168.122.1 +* eth1 IP:10.12.11.12/24 + +#### 安装软件包 + +首先,我们需要在两台主机上都安装 FRR 软件包。可以按照[官方 FRR 文档][6]中的说明进行操作。 + +#### 启用 IP 转发 + +对于路由,我们需要在两台主机上都启用 IP 转发,因为这将由 Linux 内核执行: + +``` +sysctl -w net.ipv4.conf.all.forwarding = 1 +sysctl -w net.ipv6.conf.all.forwarding = 1 +sysctl -p +``` + +#### 启用 RIPD 守护进程 + +安装后,所有配置文件将保存在 `/etc/frr` 目录中。 必须通过编辑 `/etc/frr/daemons` 文件显式启用守护进程。该文件确定启动 FRR 服务时激活哪些守护进程。要启用特定的守护进程,只需将相应的 `no` 改为 `yes`。之后的服务重启将启动守护进程。 + +![FRR daemon restart][7] + +#### 防火墙配置 + +由于 RIP 协议使用 UDP 作为传输协议,并被分配了 520 端口,因此我们需要在 `firewalld` 配置中允许该端口。 + +``` +firewall-cmd --add-port=520/udp –permanent +firewalld-cmd -reload +``` + +现在,我们可以使用以下命令启动 FRR 服务: + +``` +systemctl start frr +``` + +#### 使用 VTY 进行配置 + +现在,我们需要使用 VTY Shell 配置 RIP。 + +在主机 Alpha 上: + +``` +[root@alpha ~]# vtysh + +Hello, this is FRRouting (version 7.2RPKI). +Copyright 1996-2005 Kunihiro Ishiguro, et al. + +alpha# configure terminal +alpha(config)# router rip +alpha(config-router)# network 192.168.122.0/24 +alpha(config-router)# network 10.10.10.0/24 +alpha(config-router)# route 10.10.10.5/24 +alpha(config-router)# do write +Note: this version of vtysh never writes vtysh.conf +Building Configuration... +Configuration saved to /etc/frr/ripd.conf +Configuration saved to /etc/frr/staticd.conf +alpha(config-router)# do write memory +Note: this version of vtysh never writes vtysh.conf +Building Configuration... +Configuration saved to /etc/frr/ripd.conf +Configuration saved to /etc/frr/staticd.conf +alpha(config-router)# exit +``` + +类似地,在主机 Beta 上: + +``` +[root@beta ~]# vtysh + +Hello, this is FRRouting (version 7.2RPKI). +Copyright 1996-2005 Kunihiro Ishiguro, et al. + +beta# configure terminal +beta(config)# router rip +beta(config-router)# network 192.168.122.0/24 +beta(config-router)# network 10.12.11.0/24 +beta(config-router)# do write +Note: this version of vtysh never writes vtysh.conf +Building Configuration... +Configuration saved to /etc/frr/zebra.conf +Configuration saved to /etc/frr/ripd.conf +Configuration saved to /etc/frr/staticd.conf +beta(config-router)# do write memory +Note: this version of vtysh never writes vtysh.conf +Building Configuration... +Configuration saved to /etc/frr/zebra.conf +Configuration saved to /etc/frr/ripd.conf +Configuration saved to /etc/frr/staticd.conf +beta(config-router)# exit +``` + +完成后,像下面这样检查两台主机路由: + +``` +[root@alpha ~]# ip route show +default via 192.168.122.1 dev eth0 proto static metric 100 +10.10.10.0/24 dev eth1 proto kernel scope link src 10.10.10.12 metric 101 +10.12.11.0/24 via 192.168.122.50 dev eth0 proto 189 metric 20 +192.168.122.0/24 dev eth0 proto kernel scope link src 192.168.122.100 metric 100 +``` + +我们可以看到 Alpha 上的路由表通过 `192.168.122.50` 包含了 `10.12.11.0/24` 的条目,它是通过 RIP 提供的。 + +类似地,在 Beta 上,该表通过 `192.168.122.100` 包含了 `10.10.10.0/24` 的条目。 + +``` +[root@beta ~]# ip route show +default via 192.168.122.1 dev eth0 proto static metric 100 +10.10.10.0/24 via 192.168.122.100 dev eth0 proto 189 metric 20 +10.12.11.0/24 dev eth1 proto kernel scope link src 10.12.11.12 metric 101 +192.168.122.0/24 dev eth0 proto kernel scope link src 192.168.122.50 metric 100 +``` + +### 总结 + +如你所见,设置和配置相对简单。要增加复杂性,我们可以向路由器添加更多的网络接口,以为更多的网络提供路由。可以在编辑器中编辑配置文件来进行配置,但是使用 VTY Shell 在单个组合会话中为我们提供了所有 FRR 守护进程的前端。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/5/vty-shell + +作者:[M Umer][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/noisybotnet +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/connections_wires_sysadmin_cable.png?itok=d5WqHmnJ (Multi-colored and directional network computer cables) +[2]: https://linux.cn/article-12199-1.html +[3]: https://en.wikipedia.org/wiki/FRRouting +[4]: https://opensource.com/sites/default/files/uploads/frr_architecture.png (FRR architecture) +[5]: http://docs.frrouting.org/projects/dev-guide/en/latest/vtysh.html +[6]: http://docs.frrouting.org/projects/dev-guide/en/latest/building-frr-for-centos7.html +[7]: https://opensource.com/sites/default/files/uploads/frr_daemon_restart.png (FRR daemon restart) diff --git a/published/202005/20200525 How to Properly Install and Setup KDE Plasma on Arch Linux.md b/published/202005/20200525 How to Properly Install and Setup KDE Plasma on Arch Linux.md new file mode 100644 index 0000000000..93defdb7c9 --- /dev/null +++ b/published/202005/20200525 How to Properly Install and Setup KDE Plasma on Arch Linux.md @@ -0,0 +1,137 @@ +[#]: collector: (lujun9972) +[#]: translator: (wxy) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12258-1.html) +[#]: subject: (How to Properly Install and Setup KDE Plasma on Arch Linux) +[#]: via: (https://itsfoss.com/install-kde-arch-linux/) +[#]: author: (Dimitrios Savvopoulos https://itsfoss.com/author/dimitrios/) + +如何在 Arch Linux 上正确安装和设置 KDE Plasma? +====== + +我相信你是按照[这份很棒的指南安装来 Arch Linux][1] 的,这篇指南最后提到了 [GNOME 桌面][2]的安装步骤。 + +但现在,不是每个人都是 GNOME 的粉丝,有几个读者要求我们向他们展示如何在 [Arch Linux][4] 上配置 [KDE 桌面][3]。 + +因此,我创建了这个指南来演示如何在 Arch Linux 上正确安装和配置 KDE 桌面(也被称为 KDE Plasma桌面)的步骤。 + +### 如何在 Arch Linux 上安装和设置 KDE 桌面环境? + +![][5] + +请记住,KDE 不允许直接以 root 身份登录。如果你已经安装了 Arch Linux 并以 root 身份使用,你应该创建一个新的用户,并给它以 root 身份运行命令的 sudo 权限。 + +如果你只是最小化安装了 Arch Linux,那么你可能是以 TTY 终端方式登录的。如果你使用的是其他桌面环境,步骤也是一样的。 + +让我们开始吧! + +#### 步骤 1:创建一个 sudo 用户(如果你只有 root 用户) + +你可以使用 [useradd 命令][6]来创建一个新用户。我创建的用户名为 `dimitrios`(这是我的名字)。你可以使用与你的名字匹配的东西。 + +选项 `-m` 为新创建的用户创建一个主目录。 + +``` +useradd -m dimitrios +``` + +你还应该为这个用户设置一个密码。使用此命令: + +``` +passwd dimitrios +``` + +现在你已经创建了用户,给它 sudo 权限。首先,安装 sudo 和一个像 [nano][8] 这样的[命令行文本编辑器][7]。 + +``` +pacman -S sudo nano +``` + +sudo 的配置文件是 `/etc/sudoers`。该文件应该使用 `visudo` 来编辑,它会锁定 `sudoers` 文件,将编辑的内容保存到一个临时文件中,并在复制到 `/etc/sudoers` 之前检查该文件的语法。 + +要使用 `nano` 作为 `visudo` 编辑器,请这样设置: + +``` +EDITOR=nano visudo +``` + +像我的示例那样添加下面这一行,然后保存并退出。 + +``` +dimitrios ALL=(ALL) ALL +``` + +![Adding Sudoer in Arch Linux][9] + +保存你的更改,然后退出编辑器。你现在在 Arch Linux 上有了一个 sudo 用户。 + +#### 步骤 2 :安装 KDE Plasma 桌面 + +要运行 KDE 桌面,你需要以下软件包。 + + * [Xorg][10] 组 + * [KDE Plasma][3] 桌面环境 + * [Wayland][11] KDE Plasma 的会话 + * [KDE 应用程序][12]组(包括 KDE 特有的应用程序:Dolphin 管理器和其他有用的应用程序)。 + +你可以用下面的命令安装上述部分。 + +``` +pacman -S xorg plasma plasma-wayland-session kde-applications +``` + +安装后,启用显示管理器和网络管理器服务。 + +``` +systemctl enable sddm.service +systemctl enable NetworkManager.service +``` + +快完成了。关闭你的系统。 + +``` +shutdown now +``` + +重新打开系统电源,你应该会看到 KDE 的登录界面。你还记得为你的 sudo 用户设置的密码吗?用它来登录。 + +![Arch KDE Plasma Desktop][13] + +#### 接下来? + +你可能会想探索一下[基本的 pacman 命令][14],了解一下 [Arch 用户资源库][15],了解一下 [AUR 助手][16]。 + +希望这篇教程对你在 Arch Linux 上安装 KDE 桌面有所帮助。如果你在安装过程中遇到任何障碍或困难,请在下面的评论中告诉我们。 + +你最喜欢的桌面环境或窗口管理器是什么?请告诉我们,别忘了在我们的社交媒体上订阅。 + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/install-kde-arch-linux/ + +作者:[Dimitrios Savvopoulos][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://itsfoss.com/author/dimitrios/ +[b]: https://github.com/lujun9972 +[1]: https://linux.cn/article-9170-1.html +[2]: https://www.gnome.org/ +[3]: https://kde.org/plasma-desktop +[4]: https://www.archlinux.org/ +[5]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/05/install-kde-arch-linux.png?ssl=1 +[6]: https://linuxhandbook.com/useradd-command/ +[7]: https://itsfoss.com/command-line-text-editors-linux/ +[8]: https://www.nano-editor.org/ +[9]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/05/adding-sudoer-arch-linux.png?ssl=1 +[10]: https://wiki.archlinux.org/index.php/Xorg +[11]: https://wiki.archlinux.org/index.php/Wayland +[12]: https://www.archlinux.org/groups/x86_64/kde-applications/ +[13]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/05/Arch-Plasma-desktop.jpg?fit=800%2C450&ssl=1 +[14]: https://itsfoss.com/pacman-command/ +[15]: https://linux.cn/article-12107-1.html +[16]: https://linux.cn/article-12019-1.html diff --git a/published/202005/20200525 Now You Can Run Linux Apps in Windows (Thanks to WSL).md b/published/202005/20200525 Now You Can Run Linux Apps in Windows (Thanks to WSL).md new file mode 100644 index 0000000000..21173f87f8 --- /dev/null +++ b/published/202005/20200525 Now You Can Run Linux Apps in Windows (Thanks to WSL).md @@ -0,0 +1,105 @@ +[#]: collector: (lujun9972) +[#]: translator: (lnrCoder) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12254-1.html) +[#]: subject: (Now You Can Run Linux Apps in Windows (Thanks to WSL)) +[#]: via: (https://itsfoss.com/run-linux-apps-windows-wsl/) +[#]: author: (Ankush Das https://itsfoss.com/author/ankush/) + +现在你可以在 Windows 中运行 Linux 应用了 +====== + +![](https://img.linux.net.cn/data/attachment/album/202005/27/111439z64u19z6ct6r46kb.jpg) + +微软最近的 “[Build 2020][1]” 开发者大会公布了一些有趣的公告。我不确定这该令人兴奋还是该令人怀疑 —— 但是微软,你现在比以往任何时候都受到我们的关注。 + +同时,在所有的这些公告中,能够在 WSL(Windows Subsystem for Linux)上运行 GUI 应用程序的功能备受关注。 + +更不要忘了 [Xamrin.Forms 更名为 MAUI 的尴尬结局][2],它与 [Nitrux Linux][4] 的 Uri Herrera 的现有开源项目([Maui Project][3])名字冲突。 + +以防你不清楚,WSL 是一种环境,可让你在 Windows 10 中获得 Linux 控制台的体验。它也是在 [Windows 中运行 Linux 命令的最佳方法][5]之一。 + +正如 [Liam Dawe][7] 认为的那样,通过博客文章([DirectX ❤ Linux][6])发布的公告可能是只是个公关诱饵。但是,仍然值得一提。 + +### WSL 上对 Linux GUI 应用程序的支持 + +![][8] + +最近,Microsoft 在在线开发者大会上宣布了 WSL(即 WSL 2)的一系列新功能。 + +[Windows 包管理器][9]、[Windows 终端 1.0][10],以及其他一些功能的引入是其亮点。 + +但是, WSL 2 对 GPU 硬件加速的支持非常重要。 + +那么,是否意味着你可以使用 WSL 在 Windows 上运行 Linux 应用程序呢?看起来像是。 + +微软计划通过使用全新的 Linux 内核驱动程序 `dxgkrnl` 来实现它。为了给你一个技术性的简报, 我在这里引用他们的公告中的描述: + +![Linux Kernel Driver Wsl][11] + +> dxgkrnl 是一个全新的 Linux 内核驱动程序,它将 `/dev/dxg` 设备提供给用户模式的 Linux。 `/dev/dxg` 提供了一组 IOCTL,它们与 Winodws 上的原生 WDDM D3DKMT 内核服务层非常相似。Linux 内核中的 dxgkrnl 通过 VM 总线连接到 Windows 主机上,并使用此 VM 总线连接与物理 GPU 进行通讯。 + +我不是这方面的专家,但这意味着 WSL 上的 Linux 应用程序将与原生的 Windows 应用程序一样可以访问 GPU。 + +针对 GUI 应用程序的支持将在今年秋季的晚些时候提供(而不是 2020 年 5 月的更新) —— 所以我们要看看什么时候提供。 + +微软专门针对的是那些希望在 Windows 上轻松使用 Linux IDE 的开发人员。谷歌也在瞄准同样的用户群,[将 GUI Linux 应用程序引入到 Chromebook][12]。 + +那么,对于那些坚持使用 Windows 的用户来说,这是个好消息。但是,这是真的吗? + +### 微软爱上了 Linux —— 真的吗? + +![Microsoft Loves Linux][13] + +他们在 Windows 上整合 Linux 环境来拥抱 Linux 及其优势的努力,绝对是一件好事。 + +但是,它真的能给**桌面 Linux 用户**带来什么好处呢?到目前为止,我还没有看到任何实际的好处。 + +在这里,你可以有不同的看法。但是,我认为 WSL 的开发对于 Linux 桌面用户来说没有真正的价值。至少,到目前为止没有。 + +有趣的是,[Linux Unplugged podcast][14] 上有人强调了微软的举动,认为这与他们的 EEE(拥抱、延伸和扑灭Embrace, extend, and extinguish)的思路是一致的。 + +可能吧,谁知道呢?当然,他们为实现这一目标而付出的努力值得赞赏 —— 同时又令人感到兴奋和神秘。 + +### 这是否以为着 Windows 用户将不必再转到 Linux? + +微软之所以在其平台上集成 Linux,是因为他们知道 Liunx 的能力,也知道开发人员(或用户)喜欢使用它的原因。 + +但是,随着 WSL 2 的更新,如果这种情况持续下去,我倾向于同意 Abhishek 的看法: + +> 最终,桌面 Linux 将被限制在 Windows 下,成为桌面应用程序…… + +好吧,当然,原生的体验暂时还是比较好的。而且,很难看到现有的 Linux 桌面用户会使用 Windows 来将其替代。但是,这仍然值得担心。 + +你如何看待这一切?我不认为 WSL 对于被迫使用 Windows 的用户有什么好处 —— 但是,从长远来看,你认为微软在 WSL 方面的进展本质上是敌意还是对 Linux 有帮助? + +在评论中让我知道你的想法! + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/run-linux-apps-windows-wsl/ + +作者:[Ankush Das][a] +选题:[lujun9972][b] +译者:[lnrCoder](https://github.com/lnrCoder) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://itsfoss.com/author/ankush/ +[b]: https://github.com/lujun9972 +[1]: https://news.microsoft.com/build2020/ +[2]: https://itsfoss.com/microsoft-maui-kde-row/ +[3]: https://mauikit.org/ +[4]: https://itsfoss.com/nitrux-linux/ +[5]: https://itsfoss.com/run-linux-commands-in-windows/ +[6]: https://devblogs.microsoft.com/directx/directx-heart-linux/ +[7]: https://www.gamingonlinux.com/2020/05/microsoft-build-directx-and-linux-plus-more +[8]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/05/Linux-GUI-app-Windows-WSL.png?ssl=1 +[9]: https://devblogs.microsoft.com/commandline/windows-package-manager-preview/ +[10]: https://devblogs.microsoft.com/commandline/windows-terminal-1-0/ +[11]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/05/linux-kernel-driver-wsl.png?ssl=1 +[12]: https://itsfoss.com/linux-apps-chromebook/ +[13]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/05/microsoft-loves-linux.jpg?ssl=1 +[14]: https://linuxunplugged.com/354 diff --git a/published/202005/20200526 How to write about open source software.md b/published/202005/20200526 How to write about open source software.md new file mode 100644 index 0000000000..fb883d8e59 --- /dev/null +++ b/published/202005/20200526 How to write about open source software.md @@ -0,0 +1,175 @@ +[#]: collector: (lujun9972) +[#]: translator: (wxy) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12267-1.html) +[#]: subject: (How to write about open source software) +[#]: via: (https://opensource.com/article/20/5/write-about-open-source-software) +[#]: author: (Dawn Parzych https://opensource.com/users/dawnparzych) + +如何为开源软件写作文章 +====== + +> 通过以下提示,成为一个更好的作者。 + +![](https://img.linux.net.cn/data/attachment/album/202005/31/115044ecfpxc2q9z0ca8wq.jpg) + +开始接触开源社区的一个方法就是写关于它的文章。你可以贡献技术文档,分享你如何使用软件,或者为我们社区写一篇文章。但是开始写作说起来容易做起来难。我听到的最常见的两个不写文章的借口是:“我没有什么新东西可写”和“我不是一个好的作者”。我在这里是为了打破这两个误区。 + +### 你应该写什么? + +> “寻找那些经常被遗漏的故事。” +> 埃里克·拉尔森 + +对于某些人来说,写作的最大障碍是找到要写的想法或话题。很容易就落入了这样的思维陷阱:“这个话题已经写过了,何必再麻烦。” + +我不是第一个写文章的人,也不会是最后一个。我带来的是我独特的视角和这些年来所学到的东西。曾经有人向我请教过一些关于写作入门的建议,或者是如何让自己的写作更上一层楼。我决定把这些建议变成一篇文章。 + +文如其人,没有人会以你的方式来述事,你的经验和观点可能正是别人所需要的。 + +这里有一些提示,可以帮助你想出一个主题: + +* 你最近学到了什么东西?写出你是如何学习的,你学到了什么,或使你感到惊讶的事情。 +* 你经常被问到的问题是什么?把答案写出来。 +* 你最近是否在搜索一篇怎么做的文章,但在搜索结果中,你对排名靠前的文章不满意?请写出你要找的文章。 +* 你是否参加过会议或研讨会?写一篇会后总结来说明你所学到的东西。 +* 你开始使用新工具了吗?写一份操作指南或入门指南。 + +### 你写的是什么类型的文章? + +有不同类型的文章,包括: + +* 技术文档 +* 操作指南 +* 博客 +* 白皮书或电子书 +* 回顾性的文章 + +内容的类型会影响你的写作风格和语气。博客更加非正式和是对话式的。而技术文档更正式,更具有指导性。 + +### 你是为谁而写的? + +每一篇文章都应该有一个单一的受众。受众是指你为之写作的对象是什么类型的人。在你开始写作之前,写下你的读者的一些特征是有助于写作的。重要的是要考虑到你要为谁写,以及你**不是为**谁写的 —— 确定你的目标受众将决定要包括哪些内容和不包括哪些内容。 + +例如,我在写这篇文章的时候,我设想的目标受众是这样的: + +* 有基本的写作和语法知识 +* 有兴趣提高写作能力 +* 在技术领域担任开发人员、销售工程师、客户经理或类似职位的工作 +* 不是经验丰富或资深的作者,可能在个人或工作博客上发表过几篇文章,想写更多的文章。 +* 非虚构写作 + +如果你有针对多个受众的内容,可以考虑针对不同的受众将其分解成不同的内容。对你的受众要考虑的一些方面: + +* 专业水平:新手、中级、高级 +* 作用:管理人员、个人贡献者 +* 目标:他们为什么要阅读这些? + +### 言语很重要 + +你选择的言语会对读者产生影响。晦涩难懂的词汇会使文章更难理解,不常见的词汇会让读者觉得自己很笨,某些词汇可能会不小心冒犯读者。作为一个作者,你的目标是避免所有这些。下面是怎么做的: + +#### 使用日常用语 + +不要把写作作为炫耀你的词汇量或你从“每日一字”台历上学到的单词的方式。写作是为了让读者能够理解。每一篇文章都有相关的阅读水平。如果你写的是技术文档,那么你的目标大约是初中的阅读水平。这并不意味着你的受众只有初中的教育水平。它意味着你的写作会更容易被人理解。你想让人们对这些言语过目不忘,还是想让他们觉得自己学到了什么?虽然你可以使用长而复杂的词汇,但并不意味着你应该这样做。使用简单的语言不一定意味着你的文章会很无聊。 + +使用 [Hemingway 应用][2]等工具来检查你的作品的可读性(它不是开源的,但很优秀)。比如说,在初稿之后,这篇文章被评定为五年级的阅读水平。Hemingway 还提供了如何改进写作的建议 —— 找出难以理解的句子或需要改变选词的地方。 + +如果你想要找出替代的词汇,可以查看 [Plain English Campaign][3] 的建议或 [Power Thesaurus][4] 的众包建议。 + +#### 知道应该规避哪些词 + +> “每次你想写‘非常’的时候,就用‘该死的’代替;你的编辑会把它删掉,而作品就会如它应有的那样。” +> 马克·吐温 + +在写教程或指南的时候,这里有一些要避免的词,包括“简单simple”、“容易easy”和“就这样just”。你是你所写的主题的专家,经过多年的实践,可能会觉得事情很简单。而初学者可能会觉得事情不“简单”,也不“容易”。你的读者可能会感到沮丧,因为他们觉得过程或解释并不简单。 + +你是否曾经因为无法理解作者的意思而不得不反复重读一个句子或段落?你有没有因为一篇文章对你来说没有意义而放弃过?我有过。 + +作为一个作者,你希望你的读者感到困惑或不理解吗?我希望不会。 + +在你的写作中要避免的其它词语: + +* 这件事That +* 真的Really +* 非常Very +* 所以So +* 为了In order to + +一般来说,这些词可以在不改变句子意思的情况下删除。 + +在我写完之后,我会在文档中搜索这些词。当我在这篇文章中搜索时,我发现了以下这句话: + +> “这并不意味着你的受众只有初中的教育水平*这件事*,而意味着你的写作会更容易被理解*这件事*。” + +这句话中出现了两个“这件事That”的例子。它们并没有给句子增加价值。它们可以被删除而不改变其含义。删除这些词汇可以缩短句子,并且更短的句子更容易理解。而说到短句,我还把它改写成了两句话。 + +> “这并不意味着你的受众只有初中的教育水平。它意味着你的写作会更容易被人理解。” + +#### 使用包容性语言 + +词语和短语的历史背景可能会导致人们感到被排斥或冒犯。在写作时,你要让读者感到被包容。当你使用包容性的语言时,会让读者感到被理解、被尊重,感觉被包容。我参考了 Buffer 中的这篇[关于使用包容性语言的指南][5]。 + +### 修订和编辑 + +> “几乎所有好的写作都是从糟糕的第一次努力开始的。你需要从某个地方开始。” +> 安妮·拉莫特 + +写作是一个迭代的过程。如果你认为作者们坐在办公桌前,在一个小时内就能完成一篇文章准备发表,那么请你再想一想。有些文章需要我花几个星期的时间来完成。以下是我的标准流程: + +* 写一个粗略的初稿。我说的粗略,我的意思是*粗陋*。写的时候不用担心语法问题。目的是让文字从我的脑海中浮现出来,写在纸上。这一步可能需要一个小时到几周的时间。 +* 将草稿放一段时间。这可能需要几个小时到几天的时间,这取决于出版时间线。 +* 审阅草稿。进行调整和编辑。 +* 征求反馈意见,可以是同事或朋友的反馈意见。在这个阶段的反馈中,我的重点是明确性。是否有意义?是否有什么令人困惑的地方?有什么缺失的部分? +* 纳入反馈意见。无论你的写作经验有多丰富,让其他作者审阅你的作品,都会让你的作品变得更好。 + +在这个阶段,我有了一个相当扎实的草稿。现在到了我最不喜欢的写作部分 —— 编辑。我之前提到的 Hemingway 应用不仅能告诉你阅读水平,还能提供改进写作的建议。我还使用 Grammarly 来帮助编辑语法。关于 Grammarly 的开源替代工具,请查看[语言工具网站][6]或这篇文章中的[开源写作工具][7]。 + +我的写作挑战之一就是适当地使用逗号。Grammarly 可以帮助我找出我缺失或滥用逗号的地方。Grammarly 发现了 43 个这篇文章的最终草稿的正确性问题。其中大部分是逗号错误。 + +![Errors identified by Grammarly][8] + +除了语法错误之外,该应用程序还提供了一些建议,以帮助提高清晰度、参与度和表达能力(其中一些功能可能在免费版中没有)。这包括单词选择和使用主动语气与被动语气等。有些建议我接受,有些则拒绝。在审查了所有的警报和建议后,Grammarly 会在各个方面进行反馈。 + +![Grammarly results][10] + +不要害怕寻求写作上的帮助。每一个好的作者背后都有一个好的编辑或好的编辑应用。 + +### 文体指南 + +文体指南为改善书面交流提供了标准。它们包括标点符号、语法和用词等方面。如果是为你的公司撰写文档,请检查一下公司是否有文体指南。如果没有文体指南,或者你是为自己写的,下面是一些常用的文体指南: + +* [芝加哥文体手册][11] +* [谷歌开发者文档指南][12] +* [微软写作文体指南][13] +* [美联社文体手册][14] + +写作是一种与社区分享自己的思想和知识的方式。开始写作的唯一方法就是开始打字。用这些建议来微调你的写作。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/5/write-about-open-source-software + +作者:[Dawn Parzych][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/dawnparzych +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/doc-dish-lead.png?itok=h3fCkVmU (Typewriter in the grass) +[2]: http://www.hemingwayapp.com/ +[3]: http://www.plainenglish.co.uk/the-a-z-of-alternative-words.html +[4]: https://www.powerthesaurus.org/ +[5]: https://open.buffer.com/inclusive-language-tech/ +[6]: https://languagetool.org/ +[7]: https://opensource.com/article/20/3/open-source-writing-tools +[8]: https://opensource.com/sites/default/files/uploads/grammarlyerrors.png (Errors identified by Grammarly) +[9]: https://creativecommons.org/licenses/by-sa/4.0/ +[10]: https://opensource.com/sites/default/files/uploads/grammarlyresults.png (Grammarly results) +[11]: https://www.chicagomanualofstyle.org/home.html +[12]: https://developers.google.com/style +[13]: https://docs.microsoft.com/en-us/style-guide/welcome/ +[14]: https://www.apstylebook.com/ diff --git a/published/202006/20190218 Talk, then code.md b/published/202006/20190218 Talk, then code.md new file mode 100644 index 0000000000..5e4c56af1d --- /dev/null +++ b/published/202006/20190218 Talk, then code.md @@ -0,0 +1,55 @@ +[#]: collector: (lujun9972) +[#]: translator: (wxy) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12319-1.html) +[#]: subject: (Talk, then code) +[#]: via: (https://dave.cheney.net/2019/02/18/talk-then-code) +[#]: author: (Dave Cheney https://dave.cheney.net/author/davecheney) + +给开源项目贡献代码时:先讨论,再编码 +====== + +我所参与的开源项目遵循的是一种这样的理念,我把它描述为 “先讨论,再编码”。我认为一般来说这是开发软件的好方法,我想花一点时间来谈谈这种方法的好处。 + +### 避免伤害感情 + +先讨论你想做的改变最重要的原因是避免伤害感情。我经常看到一个贡献者闭门造车地提交了一个 PR,却发现他的努力工作被拒绝了。这可能有一堆原因:PR 太大了,PR 没有遵循本地风格,PR 修复了一个对项目不重要的问题或者最近间接修复了的问题,等等。 + +这些问题的根本原因都是缺乏沟通。“先讨论,再编码” 理念的目标不是阻碍你或给你带来挫折,而是确保一个功能第一次就能正确落地,而不至于产生大量的维护债务。无论是改动的作者,还是审查者,当一个改动突然出现时,并暗示说 “好吧,我已经做完了,你要做的就是合并它,对吧?”,先讨论可以让他们不必背负伤害感情的情绪负担。 + +### 讨论应该如何进行? + +每一个新功能或错误修复都应该在工作开始前与项目的维护者讨论。私下试验是可以的,但不要在没有讨论之前就发送修改。 + +对于简单的改动,“讨论” 的定义可以只是 GitHub 议题中的一个设计草图。如果你的 PR 修复了一个 bug,你应该链接到它修复的 bug。如果没有,你应该先提出一个 bug,等待维护者确认后再发送 PR。这可能看起来有点落后 —— 谁不希望一个 bug 被修复呢 —— 但考虑到这个 bug 可能是对软件工作方式的误解,也可能是一个更大问题的症状,这需要进一步调查。 + +对于比较复杂的改动,尤其是功能请求,我建议在发送代码之前,先分发一份设计文档并达成一致。这不一定是一个完整的文档,发一个议题,带个草图可能就足够了,但关键是在用代码搞定之前,先用文字达成一致。 + +在任何情况下,你都不应该继续发送你的代码,直到维护者同意你的方法是他们所满意的。拉取请求是日常生活,而不仅仅是为了赶着过节。 + +### 代码审查,而不是由委员会设计 + +代码审查不是争论设计的地方。这有两个原因。首先,大多数代码审查工具都不适合长长的评论会话,GitHub 的 PR 界面在这方面非常糟糕,Gerrit 比较好,但很少有管理员团队会维护 Gerrit 实例。更重要的是,在代码审查阶段就出现了分歧,说明大家对如何实现这个变化并没有达成一致。 + +* * * + +讨论你想写的代码,然后再写你所讨论的代码。请不要反其道而行之。 + +-------------------------------------------------------------------------------- + +via: https://dave.cheney.net/2019/02/18/talk-then-code + +作者:[Dave Cheney][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://dave.cheney.net/author/davecheney +[b]: https://github.com/lujun9972 +[1]: https://dave.cheney.net/2013/09/07/how-to-include-c-code-in-your-go-package (How to include C code in your Go package) +[2]: https://dave.cheney.net/2015/11/05/lets-talk-about-logging (Let’s talk about logging) +[3]: https://dave.cheney.net/2016/04/11/the-value-of-tdd (The value of TDD) +[4]: https://dave.cheney.net/2016/03/12/suggestions-for-contributing-to-an-open-source-project (Suggestions for contributing to an Open Source project) diff --git a/published/202006/20190510 Learn to change history with git rebase.md b/published/202006/20190510 Learn to change history with git rebase.md new file mode 100644 index 0000000000..339e4ef696 --- /dev/null +++ b/published/202006/20190510 Learn to change history with git rebase.md @@ -0,0 +1,605 @@ +[#]: collector: (lujun9972) +[#]: translator: (wxy) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12271-1.html) +[#]: subject: (Learn to change history with git rebase!) +[#]: via: (https://git-rebase.io/) +[#]: author: (git-rebase https://git-rebase.io/) + +学习用 Git 变基来改变历史! +====== + +[Git][1] 核心的附加价值之一就是编辑历史记录的能力。与将历史记录视为神圣的记录的版本控制系统不同,在 Git 中,我们可以修改历史记录以适应我们的需要。这为我们提供了很多强大的工具,让我们可以像使用重构来维护良好的软件设计实践一样,编织良好的提交历史。这些工具对于新手甚至是有经验的 Git 用户来说可能会有些令人生畏,但本指南将帮助我们揭开强大的 git-rebase 的神秘面纱。 + +> 值得注意的是:一般建议不要修改公共分支、共享分支或稳定分支的历史记录。编辑特性分支和个人分支的历史记录是可以的,编辑还没有推送的提交也是可以的。在编辑完提交后,可以使用 `git push -f` 来强制推送你的修改到个人分支或特性分支。 + +尽管有这么可怕的警告,但值得一提的是,本指南中提到的一切都是非破坏性操作。实际上,在 Git 中永久丢失数据是相当困难的。本指南结尾介绍了在犯错误时进行纠正的方法。 + +### 设置沙盒 + +我们不想破坏你的任何实际的版本库,所以在整个指南中,我们将使用一个沙盒版本库。运行这些命令来开始工作。[^1] + +``` +git init /tmp/rebase-sandbox +cd /tmp/rebase-sandbox +git commit --allow-empty -m"Initial commit" +``` + +如果你遇到麻烦,只需运行 `rm -rf /tmp/rebase-sandbox`,并重新运行这些步骤即可重新开始。本指南的每一步都可以在新的沙箱上运行,所以没有必要重做每个任务。 + +### 修正最近的提交 + +让我们从简单的事情开始:修复你最近的提交。让我们向沙盒中添加一个文件,并犯个错误。 + +``` +echo "Hello wrold!" >greeting.txt +git add greeting.txt +git commit -m"Add greeting.txt" +``` + +修复这个错误是非常容易的。我们只需要编辑文件,然后用 `--amend` 提交就可以了,就像这样: + +``` +echo "Hello world!" >greeting.txt +git commit -a --amend +``` + +指定 `-a` 会自动将所有 Git 已经知道的文件进行暂存(例如 Git 添加的),而 `--amend` 会将更改的内容压扁到最近的提交中。保存并退出你的编辑器(如果需要,你现在可以修改提交信息)。你可以通过运行 `git show` 看到修复的提交。 + +``` +commit f5f19fbf6d35b2db37dcac3a55289ff9602e4d00 (HEAD -> master) +Author: Drew DeVault +Date: Sun Apr 28 11:09:47 2019 -0400 + + Add greeting.txt + +diff --git a/greeting.txt b/greeting.txt +new file mode 100644 +index 0000000..cd08755 +--- /dev/null ++++ b/greeting.txt +@@ -0,0 +1 @@ ++Hello world! +``` + +### 修复较旧的提交 + +`--amend` 仅适用于最近的提交。如果你需要修正一个较旧的提交会怎么样?让我们从相应地设置沙盒开始: + +``` +echo "Hello!" >greeting.txt +git add greeting.txt +git commit -m"Add greeting.txt" + +echo "Goodbye world!" >farewell.txt +git add farewell.txt +git commit -m"Add farewell.txt" +``` + +看起来 `greeting.txt ` 像是丢失了 `"world"`。让我们正常地写个提交来解决这个问题: + +``` +echo "Hello world!" >greeting.txt +git commit -a -m"fixup greeting.txt" +``` + +现在文件看起来正确,但是我们的历史记录可以更好一点 —— 让我们使用新的提交来“修复”(`fixup`)最后一个提交。为此,我们需要引入一个新工具:交互式变基。我们将以这种方式编辑最后三个提交,因此我们将运行 `git rebase -i HEAD~3`(`-i` 代表交互式)。这样会打开文本编辑器,如下所示: + +``` +pick 8d3fc77 Add greeting.txt +pick 2a73a77 Add farewell.txt +pick 0b9d0bb fixup greeting.txt + +# Rebase f5f19fb..0b9d0bb onto f5f19fb (3 commands) +# +# Commands: +# p, pick = use commit +# f, fixup = like "squash", but discard this commit's log message +``` + +这是变基计划,通过编辑此文件,你可以指导 Git 如何编辑历史记录。我已经将该摘要削减为仅与变基计划这一部分相关的细节,但是你可以在文本编辑器中浏览完整的摘要。 + +当我们保存并关闭编辑器时,Git 将从其历史记录中删除所有这些提交,然后一次执行一行。默认情况下,它将选取(`pick`)每个提交,将其从堆中召唤出来并添加到分支中。如果我们对此文件根本没有做任何编辑,则将直接回到起点,按原样选取每个提交。现在,我们将使用我最喜欢的功能之一:修复(`fixup`)。编辑第三行,将操作从 `pick` 更改为 `fixup`,并将其立即移至我们要“修复”的提交之后: + +``` +pick 8d3fc77 Add greeting.txt +fixup 0b9d0bb fixup greeting.txt +pick 2a73a77 Add farewell.txt +``` + +> **技巧**:我们也可以只用 `f` 来缩写它,以加快下次的速度。 + +保存并退出编辑器,Git 将运行这些命令。我们可以检查日志以验证结果: + +``` +$ git log -2 --oneline +fcff6ae (HEAD -> master) Add farewell.txt +a479e94 Add greeting.txt +``` + +### 将多个提交压扁为一个 + +在工作时,当你达到较小的里程碑或修复以前的提交中的错误时,你可能会发现写很多提交很有用。但是,在将你的工作合并到 `master` 分支之前,将这些提交“压扁”(`squash`)到一起以使历史记录更清晰可能很有用。为此,我们将使用“压扁”(`squash `)操作。让我们从编写一堆提交开始,如果要加快速度,只需复制并粘贴这些: + +``` +git checkout -b squash +for c in H e l l o , ' ' w o r l d; do + echo "$c" >>squash.txt + git add squash.txt + git commit -m"Add '$c' to squash.txt" +done +``` + +要制作出一个写着 “Hello,world” 的文件,要做很多事情!让我们开始另一个交互式变基,将它们压扁在一起。请注意,我们首先签出了一个分支来进行尝试。因此,因为我们使用 `git rebase -i master` 进行的分支,我们可以快速变基所有提交。结果: + +``` +pick 1e85199 Add 'H' to squash.txt +pick fff6631 Add 'e' to squash.txt +pick b354c74 Add 'l' to squash.txt +pick 04aaf74 Add 'l' to squash.txt +pick 9b0f720 Add 'o' to squash.txt +pick 66b114d Add ',' to squash.txt +pick dc158cd Add ' ' to squash.txt +pick dfcf9d6 Add 'w' to squash.txt +pick 7a85f34 Add 'o' to squash.txt +pick c275c27 Add 'r' to squash.txt +pick a513fd1 Add 'l' to squash.txt +pick 6b608ae Add 'd' to squash.txt + +# Rebase 1af1b46..6b608ae onto 1af1b46 (12 commands) +# +# Commands: +# p, pick = use commit +# s, squash = use commit, but meld into previous commit +``` + +> **技巧**:你的本地 `master` 分支独立于远程 `master` 分支而发展,并且 Git 将远程分支存储为 `origin/master`。结合这种技巧,`git rebase -i origin/master` 通常是一种非常方便的方法,可以变基所有尚未合并到上游的提交! + +我们将把所有这些更改压扁到第一个提交中。为此,将第一行除外的每个“选取”(`pick`)操作都更改为“压扁”(`squash`),如下所示: + +``` +pick 1e85199 Add 'H' to squash.txt +squash fff6631 Add 'e' to squash.txt +squash b354c74 Add 'l' to squash.txt +squash 04aaf74 Add 'l' to squash.txt +squash 9b0f720 Add 'o' to squash.txt +squash 66b114d Add ',' to squash.txt +squash dc158cd Add ' ' to squash.txt +squash dfcf9d6 Add 'w' to squash.txt +squash 7a85f34 Add 'o' to squash.txt +squash c275c27 Add 'r' to squash.txt +squash a513fd1 Add 'l' to squash.txt +squash 6b608ae Add 'd' to squash.txt +``` + +保存并关闭编辑器时,Git 会考虑片刻,然后再次打开编辑器以修改最终的提交消息。你会看到以下内容: + +``` +# This is a combination of 12 commits. +# This is the 1st commit message: + +Add 'H' to squash.txt + +# This is the commit message #2: + +Add 'e' to squash.txt + +# This is the commit message #3: + +Add 'l' to squash.txt + +# This is the commit message #4: + +Add 'l' to squash.txt + +# This is the commit message #5: + +Add 'o' to squash.txt + +# This is the commit message #6: + +Add ',' to squash.txt + +# This is the commit message #7: + +Add ' ' to squash.txt + +# This is the commit message #8: + +Add 'w' to squash.txt + +# This is the commit message #9: + +Add 'o' to squash.txt + +# This is the commit message #10: + +Add 'r' to squash.txt + +# This is the commit message #11: + +Add 'l' to squash.txt + +# This is the commit message #12: + +Add 'd' to squash.txt + +# Please enter the commit message for your changes. Lines starting +# with '#' will be ignored, and an empty message aborts the commit. +# +# Date: Sun Apr 28 14:21:56 2019 -0400 +# +# interactive rebase in progress; onto 1af1b46 +# Last commands done (12 commands done): +# squash a513fd1 Add 'l' to squash.txt +# squash 6b608ae Add 'd' to squash.txt +# No commands remaining. +# You are currently rebasing branch 'squash' on '1af1b46'. +# +# Changes to be committed: +# new file: squash.txt +# +``` + +默认情况下,这是所有要压扁的提交的消息的组合,但是像这样将其保留肯定不是你想要的。不过,旧的提交消息在编写新的提交消息时可能很有用,所以放在这里以供参考。 + +> **提示**:你在上一节中了解的“修复”(`fixup`)命令也可以用于此目的,但它会丢弃压扁的提交的消息。 + +让我们删除所有内容,并用更好的提交消息替换它,如下所示: + +``` +Add squash.txt with contents "Hello, world" + +# Please enter the commit message for your changes. Lines starting +# with '#' will be ignored, and an empty message aborts the commit. +# +# Date: Sun Apr 28 14:21:56 2019 -0400 +# +# interactive rebase in progress; onto 1af1b46 +# Last commands done (12 commands done): +# squash a513fd1 Add 'l' to squash.txt +# squash 6b608ae Add 'd' to squash.txt +# No commands remaining. +# You are currently rebasing branch 'squash' on '1af1b46'. +# +# Changes to be committed: +# new file: squash.txt +# +``` + +保存并退出编辑器,然后检查你的 Git 日志,成功! + +``` +commit c785f476c7dff76f21ce2cad7c51cf2af00a44b6 (HEAD -> squash) +Author: Drew DeVault +Date: Sun Apr 28 14:21:56 2019 -0400 + + Add squash.txt with contents "Hello, world" +``` + +在继续之前,让我们将所做的更改拉入 `master` 分支中,并摆脱掉这一草稿。我们可以像使用 `git merge` 一样使用 `git rebase`,但是它避免了创建合并提交: + +``` +git checkout master +git rebase squash +git branch -D squash +``` + +除非我们实际上正在合并无关的历史记录,否则我们通常希望避免使用 `git merge`。如果你有两个不同的分支,则 `git merge` 对于记录它们合并的时间非常有用。在正常工作过程中,变基通常更为合适。 + +### 将一个提交拆分为多个 + +有时会发生相反的问题:一个提交太大了。让我们来看一看拆分它们。这次,让我们写一些实际的代码。从一个简单的 C 程序 [^2] 开始(你仍然可以将此代码段复制并粘贴到你的 shell 中以快速执行此操作): + +``` +cat <main.c +int main(int argc, char *argv[]) { + return 0; +} +EOF +``` + +首先提交它: + +``` +git add main.c +git commit -m"Add C program skeleton" +``` + +然后把这个程序扩展一些: + +``` +cat <main.c +#include <stdio.h> + +const char *get_name() { + static char buf[128]; + scanf("%s", buf); + return buf; +} + +int main(int argc, char *argv[]) { + printf("What's your name? "); + const char *name = get_name(); + printf("Hello, %s!\n", name); + return 0; +} +EOF +``` + +提交之后,我们就可以准备学习如何将其拆分: + +``` +git commit -a -m"Flesh out C program" +``` + +第一步是启动交互式变基。让我们用 `git rebase -i HEAD~2` 来变基这两个提交,给出的变基计划如下: + +``` +pick 237b246 Add C program skeleton +pick b3f188b Flesh out C program + +# Rebase c785f47..b3f188b onto c785f47 (2 commands) +# +# Commands: +# p, pick = use commit +# e, edit = use commit, but stop for amending +``` + +将第二个提交的命令从 `pick` 更改为 `edit`,然后保存并关闭编辑器。Git 会考虑一秒钟,然后向你建议: + +``` +Stopped at b3f188b... Flesh out C program +You can amend the commit now, with + + git commit --amend + +Once you are satisfied with your changes, run + + git rebase --continue +``` + +我们可以按照以下说明为提交*添加*新的更改,但我们可以通过运行 `git reset HEAD^` 来进行“软重置” [^3]。如果在此之后运行 `git status`,你将看到它取消了提交最新的提交,并将其更改添加到工作树中: + +``` +Last commands done (2 commands done): + pick 237b246 Add C program skeleton + edit b3f188b Flesh out C program +No commands remaining. +You are currently splitting a commit while rebasing branch 'master' on 'c785f47'. + (Once your working directory is clean, run "git rebase --continue") + +Changes not staged for commit: + (use "git add ..." to update what will be committed) + (use "git checkout -- ..." to discard changes in working directory) + + modified: main.c + +no changes added to commit (use "git add" and/or "git commit -a") +``` + +为了对此进行拆分,我们将进行*交互式提交*。这使我们能够选择性地仅提交工作树中的特定更改。运行 `git commit -p` 开始此过程,你将看到以下提示: + +``` +diff --git a/main.c b/main.c +index b1d9c2c..3463610 100644 +--- a/main.c ++++ b/main.c +@@ -1,3 +1,14 @@ ++#include <stdio.h> ++ ++const char *get_name() { ++ static char buf[128]; ++ scanf("%s", buf); ++ return buf; ++} ++ + int main(int argc, char *argv[]) { ++ printf("What's your name? "); ++ const char *name = get_name(); ++ printf("Hello, %s!\n", name); + return 0; + } +Stage this hunk [y,n,q,a,d,s,e,?]? +``` + +Git 仅向你提供了一个“大块”(即单个更改)以进行提交。不过,这太大了,让我们使用 `s` 命令将这个“大块”拆分成较小的部分。 + +``` +Split into 2 hunks. +@@ -1 +1,9 @@ ++#include ++ ++const char *get_name() { ++ static char buf[128]; ++ scanf("%s", buf); ++ return buf; ++} ++ + int main(int argc, char *argv[]) { +Stage this hunk [y,n,q,a,d,j,J,g,/,e,?]? +``` + +> **提示**:如果你对其他选项感到好奇,请按 `?` 汇总显示。 + +这个大块看起来更好:单一、独立的更改。让我们按 `y` 来回答问题(并暂存那个“大块”),然后按 `q` 以“退出”交互式会话并继续进行提交。会弹出编辑器,要求输入合适的提交消息。 + +``` +Add get_name function to C program + +# Please enter the commit message for your changes. Lines starting +# with '#' will be ignored, and an empty message aborts the commit. +# +# interactive rebase in progress; onto c785f47 +# Last commands done (2 commands done): +# pick 237b246 Add C program skeleton +# edit b3f188b Flesh out C program +# No commands remaining. +# You are currently splitting a commit while rebasing branch 'master' on 'c785f47'. +# +# Changes to be committed: +# modified: main.c +# +# Changes not staged for commit: +# modified: main.c +# +``` + +保存并关闭编辑器,然后我们进行第二次提交。我们可以执行另一次交互式提交,但是由于我们只想在此提交中包括其余更改,因此我们将执行以下操作: + +``` +git commit -a -m"Prompt user for their name" +git rebase --continue +``` + +最后一条命令告诉 Git 我们已经完成了此提交的编辑,并继续执行下一个变基命令。这样就行了!运行 `git log` 来查看你的劳动成果: + +``` +$ git log -3 --oneline +fe19cc3 (HEAD -> master) Prompt user for their name +659a489 Add get_name function to C program +237b246 Add C program skeleton +``` + +### 重新排序提交 + +这很简单。让我们从设置沙箱开始: + +``` +echo "Goodbye now!" >farewell.txt +git add farewell.txt +git commit -m"Add farewell.txt" + +echo "Hello there!" >greeting.txt +git add greeting.txt +git commit -m"Add greeting.txt" + +echo "How're you doing?" >inquiry.txt +git add inquiry.txt +git commit -m"Add inquiry.txt" +``` + +现在 `git log` 看起来应如下所示: + +``` +f03baa5 (HEAD -> master) Add inquiry.txt +a4cebf7 Add greeting.txt +90bb015 Add farewell.txt +``` + +显然,这都是乱序。让我们对过去的 3 个提交进行交互式变基来解决此问题。运行 `git rebase -i HEAD~3`,这个变基规划将出现: + +``` +pick 90bb015 Add farewell.txt +pick a4cebf7 Add greeting.txt +pick f03baa5 Add inquiry.txt + +# Rebase fe19cc3..f03baa5 onto fe19cc3 (3 commands) +# +# Commands: +# p, pick = use commit +# +# These lines can be re-ordered; they are executed from top to bottom. +``` + +现在,解决方法很简单:只需按照你希望提交出现的顺序重新排列这些行。应该看起来像这样: + +``` +pick a4cebf7 Add greeting.txt +pick f03baa5 Add inquiry.txt +pick 90bb015 Add farewell.txt +``` + +保存并关闭你的编辑器,而 Git 将为你完成其余工作。请注意,在实践中这样做可能会导致冲突,参看下面章节以获取解决冲突的帮助。 + +### git pull --rebase + +如果你一直在由上游更新的分支 ``(比如说原始远程)上做一些提交,通常 `git pull` 会创建一个合并提交。在这方面,`git pull` 的默认行为等同于: + +``` +git fetch origin +git merge origin/ +``` + +假设本地分支 `` 配置为从原始远程跟踪 `` 分支,即: + +``` +$ git config branch..remote +origin +$ git config branch..merge +refs/heads/ +``` +还有另一种选择,它通常更有用,并且会让历史记录更清晰:`git pull --rebase`。与合并方式不同,这基本上 [^4] 等效于以下内容: + +``` +git fetch origin +git rebase origin/ +``` + +合并方式更简单易懂,但是如果你了解如何使用 `git rebase`,那么变基方式几乎可以做到你想要做的任何事情。如果愿意,可以将其设置为默认行为,如下所示: + +``` +git config --global pull.rebase true +``` + +当你执行此操作时,从技术上讲,你在应用我们在下一节中讨论的过程……因此,让我们也解释一下故意执行此操作的含义。 + +### 使用 git rebase 来变基 + +具有讽刺意味的是,我最少使用的 Git 变基功能是它以之命名的功能:变基分支。假设你有以下分支: + +``` +A--B--C--D--> master + \--E--F--> feature-1 + \--G--> feature-2 +``` + +事实证明,`feature-2` 不依赖于 `feature-1` 的任何更改,它依赖于提交 E,因此你可以将其作为基础脱离 `master`。因此,解决方法是: + +``` +git rebase --onto master feature-1 feature-2 +``` + +非交互式变基对所有牵连的提交都执行默认操作(`pick`)[^5] ,它只是简单地将不在 `feature-1` 中的 `feature-2` 中提交重放到 `master` 上。你的历史记录现在看起来像这样: + +``` +A--B--C--D--> master + | \--G--> feature-2 + \--E--F--> feature-1 +``` + +### 解决冲突 + +解决合并冲突的详细信息不在本指南的范围内,将来请你注意另一篇指南。假设你熟悉通常的解决冲突的方法,那么这里是专门适用于变基的部分。 + +有时,在进行变基时会遇到合并冲突,你可以像处理其他任何合并冲突一样处理该冲突。Git 将在受影响的文件中设置冲突标记,`git status` 将显示你需要解决的问题,并且你可以使用 `git add` 或 `git rm` 将文件标记为已解决。但是,在 `git rebase` 的上下文中,你应该注意两个选项。 + +首先是如何完成冲突解决。解决由于 `git merge` 引起的冲突时,与其使用 `git commit` 那样的命令,更适当的变基命令是 `git rebase --continue`。但是,还有一个可用的选项:`git rebase --skip`。 这将跳过你正在处理的提交,它不会包含在变基中。这在执行非交互性变基时最常见,这时 Git 不会意识到它从“其他”分支中提取的提交是与“我们”分支上冲突的提交的更新版本。 + +### 帮帮我! 我把它弄坏了! + +毫无疑问,变基有时会很难。如果你犯了一个错误,并因此而丢失了所需的提交,那么可以使用 `git reflog` 来节省下一天的时间。运行此命令将向你显示更改一个引用(即分支和标记)的每个操作。每行显示你的旧引用所指向的内容,你可对你认为丢失的 Git 提交执行 `git cherry-pick`、`git checkout`、`git show` 或任何其他操作。 + +[^1]: 我们添加了一个空的初始提交以简化本教程的其余部分,因为要对版本库的初始提交进行变基需要特殊的命令(即` git rebase --root`)。 +[^2]: 如果要编译此程序,请运行 `cc -o main main.c`,然后运行 `./main` 查看结果。 +[^3]: 实际上,这是“混合重置”。“软重置”(使用 `git reset --soft` 完成)将暂存更改,因此你无需再次 `git add` 添加它们,并且可以一次性提交所有更改。这不是我们想要的。我们希望选择性地暂存部分更改,以拆分提交。 +[^4]: 实际上,这取决于上游分支本身是否已变基或删除/压扁了某些提交。`git pull --rebase` 尝试通过在 `git rebase` 和 `git merge-base` 中使用 “复刻点fork-point” 机制来从这种情况中恢复,以避免变基非本地提交。 +[^5]: 实际上,这取决于 Git 的版本。直到 2.26.0 版,默认的非交互行为以前与交互行为稍有不同,这种方式通常并不重要。 + +-------------------------------------------------------------------------------- + +via: https://git-rebase.io/ + +作者:[git-rebase][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://git-rebase.io/ +[b]: https://github.com/lujun9972 +[1]: https://git-scm.com/ +[2]: https://git-scm.com/docs/git-rebase + diff --git a/published/202006/20190814 How to install Python on Windows.md b/published/202006/20190814 How to install Python on Windows.md new file mode 100644 index 0000000000..b49ab0d1de --- /dev/null +++ b/published/202006/20190814 How to install Python on Windows.md @@ -0,0 +1,195 @@ +[#]: collector: (lujun9972) +[#]: translator: (011011100010110101101111) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12335-1.html) +[#]: subject: (How to install Python on Windows) +[#]: via: (https://opensource.com/article/19/8/how-install-python-windows) +[#]: author: (Seth Kenlon https://opensource.com/users/sethhttps://opensource.com/users/greg-p) + +如何在 Windows 上安装 Python +====== + +> 安装 Python,启动 IDE,然后你就可以在 Windows 系统下进行编程了。 + +![](https://img.linux.net.cn/data/attachment/album/202006/20/232632iggga8agp5gablg5.jpg) + +你是否想学习编程呢?可以从 [Python][2] 开始,它因为简洁的语法和面向对象的特性而非常受欢迎,是最常见的编程语言之一。而且 Python 是一门解释型语言,这意味着你无需知道如何把 Python 代码编译为机器语言 —— Python 会帮你做到这一点,从而使你能够在编写代码的同时立即进行测试。 + +但是你也不能仅仅因为 Python 学习起来简单而低估了它强大的潜能,无论是在[电影][4][工作室][5]、视频游戏工作室,还是在金融机构、IT 机构、制造业,都有 Python 的身影,甚至很多业余爱好者、[艺术家][6]、教师和许多其他人都使用 Python。 + +另一方面,Python 也是一门严肃的编程语言,学习它需要付出和实践。还有,你什么都不需要马上做,就几乎可以在任何计算机平台上安装并尝试使用 Python ,因此,如果你使用的是 Windows 操作系统,那本文正适合你。 + +如果你使用的是开源的 Linux 操作系统,那你可以 [在 Linux 上安装][7] 并 [尝试使用 Python][8]。 + +### 如何获取 Python + +你可以从 [Python 官方网站][9] 上去下载 Python。在 Python 官方网站下载页,可以将鼠标悬停在 “Downloads” 按钮上,待菜单展开后,再将鼠标悬停在 “Windows” 选项,最后点击按钮就可以下载最新版的 Python 了。 + +![Downloading Python on Windows][10] + +或者你也可以直接点击 “Downloads” 按钮,然后在下载页中选择特定的版本去下载。 + +### 安装 Python + +下载好安装包后,直接打开就可以启动安装程序了。 + +安装时,选择默认的安装路径比较好,最重要的是要将 Python 添加到搜索路径中,否则 Python 应用程序不知道它该从哪里找到 Python 必须的运行时环境;默认认安装时并没有选中这一项,需要手动勾选安装窗口的 “Add Python 3.7 to Path” ,然后点击继续。 + +![Select "Add Python 3 to PATH"][11] + +由于 Windows 需要经过你的批准才会允许安装非微软官方发行的应用程序,因此你必须要在弹出 “User Account Control”(UAC) 系统提示窗口的时候 点击 “Yes” 来继续完成安装。 + +![Windows UAC][12] + +这时候你就需要耐心等待,系统会自动将 Python 软件包分发到合适的位置,等待过后,也就意味着你已经成功的安装了 Python ,你就可以愉快的与 Python 玩耍了! + +### 安装一个 IDE + +虽然说你仅需要一个文本编辑器,就可以开始编写 Python 代码了,但是我依然建议你使用 IDE(集成开发环境)来进行开发,这样开发起来就会变得方便很多。IDE 会将文本编辑器和一些好用的 Python 功能集成到一起,使用起来非常友好。你可以考虑选择 IDLE 3 或者 NINJA-IDE 来作为你的 IDE。 + +#### IDLE 3 + +Python 自带一款 IDE,名字叫 IDLE。虽然你可以使用任何文本编辑器编写 Python 代码,但 IDE 通常会提供 [Notepad++][13] 之类的纯文本编辑器所没有的代码高亮、语法检测等功能,甚至在 IDE 里可以直接通过鼠标点击 “Run” 按钮就能快速运行 Python 代码。 + +想要启动 IDLE ,可以点击 Windows 的 “开始” (或者 “Windows”)按钮,然后输入 `python` 来进行搜索。这时候可能会搜索到多个选项,选择 IDLE 启动就好了。 + +![IDLE 3 IDE][14] + +如果在 “开始” 菜单中没有搜到,你也可以在 “开始” 菜单输入 `cmd` (或同时按下键盘 `win + R` 键) 来启动 Windows 命令提示符,然后输入下面命令来启动 IDLE : + +``` +C:\Windows\py.exe +``` + +如果还是无法启动的话,可是试着重新安装 Python ,安装时记得务必要在安装向导中选中 “Add Python to PATH”。详细说明,可以参考 [Python 官方文档][15] 。 + +#### Ninja-IDE + +如果你已经有一些编程经验,而且你觉得 IDLE 对你来说有些简陋的话,你也可以试试 [Ninja-IDE][16]。 Ninja-IDE 是一款非常出色的 Python IDE,它具有代码高亮功能,并且它会自动帮你检测诸如拼写错误、引号或括号缺失以及其他语法错误。而且它还可以显示行号(调试的时候会非常有用)、缩进标记甚至可以直接通过点击 “Run” 按钮来运行你的代码。 + +![Ninja-IDE][17] + +如果要安装 Ninja-IDE ,你可以访问 Ninja-IDE 的官网 [下载 Windows 安装程序][18] 。步骤跟安装 Python 大同小异:下载安装包、允许 Windows 安装非微软官方的应用程序,然后等待完成安装即可。 + +Ninja-IDE 安装完成后,双击 Windows 桌面或开始菜单下的 Ninja-IDE 就可以启动了。 + +### 告诉 Python 怎么做 + +关键字能让 Python 知道你想要做什么。在 IDLE 或者 Ninja-IDE ,打开 “文件” 菜单,创建一个新文件。 + +在 Ninja-IDE 中,不要创建一个新项目,而是单独创建一个新文件就可以了。 + +在你用 IDLE 或者 Ninja-IDE 新建的文件中,输入以下代码: + +``` +print("Hello world.") +``` + +* 如果你使用的是 IDLE ,请点击 “运行” 菜单,选择 “运行模块” 选项来运行你的程序。 +* 如果你使用的是 Ninja ,请单击左侧按钮栏中的 “运行文件” 按钮。 + +![Running code in Ninja-IDE][19] + +任何时间当你想要执行代码,IDE 都会提示你先保存当前正在处理的文件,然后再继续。 + +`print` 关键字会告诉 Python 打印出你在括号和引号中输入的所有文本。 + +但是别高兴地太早,Python 的核心库也就只能访问 `print` 和 `help` 之类的基本关键字、函数等。 + +如果想要使用更多的关键字和函数,你就需要使用 `import` 关键字去加载它们。好了,先在你的 IDLE 或者 Ninja 中新建一个文件,命名为 `pen.py` 。 + +**警告**:不要把你新建的文件命名为 `turtle.py` ,因为 `turtle.py` 是包含了你要控制的 turtle 程序的文件名称,使用 `turtle.py` 作为文件名会让 Python 感到困惑,因为它以为你想要引入你自己的文件。 + +在你新建的文件中输入一下代码,并运行: + +``` +import turtle +``` + +[Turtle][20] 是一个用起来非常有意思的模块. 把这段代码添加到你的文件内: + +``` +turtle.begin_fill() +turtle.forward(100) +turtle.left(90) +turtle.forward(100) +turtle.left(90) +turtle.forward(100) +turtle.left(90) +turtle.forward(100) +turtle.end_fill() +``` + +来看看你可以使用 turtle 模块来绘制出哪些图案。 + +想要清空 turtle 绘制的区域的话,你可以使用 `turtle.clear()` 函数。那你知道 `turtle.color("blue")` 是用来做什么的吗? + +我们来试一下更复杂点的程序: + +``` +import turtle as t +import time + +t.color("blue") +t.begin_fill() + +counter = 0 + +while counter < 4: +    t.forward(100) +    t.left(90) +    counter = counter+1 + +t.end_fill() +time.sleep(2) +``` + +给你个挑战,试试修改代码,让它得到下图所示的结果: + +![Example Python turtle output][21] + +当你完成这段代码后,你就可以继续学习更多有意思的模块了。这个 [入门级骰子游戏][22] 就是个不错的开始。 + +### 保持 Pythonic + +Python 是一门非常有趣的语言,它的模块几乎能实现所有你想要实现的功能。正如你所看到的,Python 入门很容易,只要你对自己有耐心,很快就会发现自己在理解和编写 Python 时能像写汉字一样流畅。你可以多阅读关于 [Python 的文章][23],试着自己编写一些小片段,然后看看 Python 会执行出什么结果。如果想要把 Python 真正融合到你实际工作中,你可以试试 Linux ,Linux 具有在本地可编写脚本的功能,而其他系统却没有。 + +祝你好运,记得保持 Pythonic。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/8/how-install-python-windows + +作者:[Seth Kenlon][a] +选题:[lujun9972][b] +译者:[LiuWenlong](https://github.com/011011100010110101101111) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/sethhttps://opensource.com/users/greg-p +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/programming-code-keyboard-laptop.png?itok=pGfEfu2S (Hands programming) +[2]: https://www.python.org/ +[3]: https://opensource.com/article/19/7/get-modular-python-classes +[4]: https://github.com/edniemeyer/weta_python_db +[5]: https://www.python.org/about/success/ilm/ +[6]: https://opensource.com/article/19/7/rgb-cube-python-scribus +[7]: https://opensource.com/article/19/7/ways-get-started-linux +[8]: https://opensource.com/article/17/10/python-101 +[9]: https://www.python.org/downloads/ +[10]: https://opensource.com/sites/default/files/uploads/win-python-install.jpg (Downloading Python on Windows) +[11]: https://opensource.com/sites/default/files/uploads/win-python-path.jpg (Select "Add Python 3 to PATH") +[12]: https://opensource.com/sites/default/files/uploads/win-python-publisher.jpg (Windows UAC) +[13]: https://notepad-plus-plus.org/ +[14]: https://opensource.com/sites/default/files/uploads/idle3.png (IDLE 3 IDE) +[15]: http://docs.python.org/3/using/windows.html +[16]: http://ninja-ide.org/ +[17]: https://opensource.com/sites/default/files/uploads/win-python-ninja.jpg (Ninja-IDE) +[18]: http://ninja-ide.org/downloads/ +[19]: https://opensource.com/sites/default/files/uploads/ninja_run.png (Running code in Ninja-IDE) +[20]: https://opensource.com/life/15/8/python-turtle-graphics +[21]: https://opensource.com/sites/default/files/uploads/win-python-idle-turtle.jpg (Example Python turtle output) +[22]: https://opensource.com/article/17/10/python-101#python-101-dice-game +[23]: https://opensource.com/sitewide-search?search_api_views_fulltext=Python diff --git a/published/202006/20190816 Cockpit and the evolution of the Web User Interface.md b/published/202006/20190816 Cockpit and the evolution of the Web User Interface.md new file mode 100644 index 0000000000..779df7312d --- /dev/null +++ b/published/202006/20190816 Cockpit and the evolution of the Web User Interface.md @@ -0,0 +1,169 @@ +[#]: collector: (lujun9972) +[#]: translator: (wxy) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12324-1.html) +[#]: subject: (Cockpit and the evolution of the Web User Interface) +[#]: via: (https://fedoramagazine.org/cockpit-and-the-evolution-of-the-web-user-interface/) +[#]: author: (Shaun Assam https://fedoramagazine.org/author/sassam/) + +Cockpit 及其网页用户界面的演变 +====== + +![][1] + +3 年多以前,Fedora 杂志发表了一篇题为《[Cockpit 概览][2]》的文章。从那时起,Cockit 的界面有了一些引人注目的变化。今天的 Cockpit 更加简洁,更大的字体更好地利用了屏幕的空间。 + +本文将介绍它的用户界面的一些变化。还将探讨一些在网页界面中可用的通用工具,以简化那些单调的系统管理员任务。 + +### Cockpit 驾驶舱安装 + +Cockpit 可以使用 `dnf install cockpit` 命令安装。这提供了一个最小的设置,提供了使用该界面所需的基本工具。 + +另一个选择是安装 “Headless Management” 组,这将安装用于扩展 Cockpit 功能的附加包。它包括用于 NetworkManager、软件包、磁盘和 SELinux 管理的扩展。 + +运行以下命令,在启动时启用 Web 服务并打开防火墙端口: + +``` +$ sudo systemctl enable --now cockpit.socket +Created symlink /etc/systemd/system/sockets.target.wants/cockpit.socket -> /usr/lib/systemd/system/cockpit.socket + +$ sudo firewall-cmd --permanent --add-service cockpit +success +$ sudo firewall-cmd --reload +success +``` + +### 登录网页界面 + +要访问网页界面,打开你最喜欢的浏览器,在地址栏中输入该服务器的域名或 IP,然后输入服务端口(9090)。由于 Cockpit 使用 HTTPS,安装过程中会创建一个自签证书来加密密码和其他敏感数据。你可以安全地接受这个证书,或者向你的系统管理员或受信任的来源请求 CA 证书。 + +一旦证书被接受,就会出现新改进的登录屏幕。长期使用的用户会注意到用户名和密码字段已被移到顶部。此外,凭证字段后面的白色背景会立即吸引用户的注意力。 + +![][3] + +自上一篇文章后,登录界面增加了一个功能,就是用 `sudo` 权限登录 —— 如果你的账号是 `wheel` 组的成员。勾选 “对于特权任务,重用我的密码” 旁边的方框,就可以提升你的权限。 + +登录界面的另一个版本是连接到同样运行 Cockpit Web 服务的远程服务器的选项。点击 “其他选项” 并输入远程机器的主机名或 IP 地址,从本地浏览器管理它。 + +### 主屏幕视图 + +一开始,我们就会看到基本概述,带有常见的系统信息,这包括机器的品牌和型号、操作系统、系统是否是最新的,等等。 + +![][4] + +点击系统的品牌/型号会显示硬件信息,如 BIOS/固件。它还包括与 `lspci` 中可以看到的组件的详情。 + +![][5] + +点击任何一个选项,右边都会显示该设备的详细信息。例如,“CPU 核心百分比” 选项显示了用户和内核使用了多少 CPU 核心的详细信息。此外,“内存和交换” 图表显示了系统内存的使用量、缓存量和交换分区的活动量。“磁盘 I/O” 和 “网络流量” 图表连到了 Cockpit 的 “存储和网络” 部分。这些内容将在接下来详细探讨系统工具的一篇文章中重新探讨。 + +#### SSH 密钥和认证 + +由于安全是系统管理员的关键因素,Cockpit 现在有了查看机器 MD5 和 SHA256 密钥指纹的选项。点击 “显示指纹” 选项可以显示服务器的 ECDSA、ED25519 和 RSA 指纹密钥。 + +![][6] + +你也可以通过点击右上角的用户名,选择“验证”,添加自己的密钥。点击 “添加密钥”,可以在其他系统上验证该机器。你也可以通过点击右侧的 “X” 按钮,撤销你在 Cockpit Web 服务中的权限。 + +![][7] + +#### 更改主机名和加入域 + +更改主机名可以在主页上一键解决。单击当前显示的主机名,并在“更改主机名”框中输入新名称。最新的功能之一是提供了一个 “简称” 的选项。 + +Cockpit 增加的另一个功能是可以连接到目录服务器。点击 “加入域”,会出现一个弹窗,要求提供域地址或名称、组织单位(可选)和域管理员的凭证。“Domain Membership” 组提供了加入 LDAP 服务器所需的所有包,包括 FreeIPA,以及流行的 Active Directory。 + +要退出域,请点击域名,然后点击 “离开域”。将会出现一个警告,解释一旦系统不再在域上将会发生的变化。要确认,点击红色的 “离开域” 按钮。 + +![][8] + +#### 配置 NTP 和系统日期和时间 + +使用命令行和编辑配置文件绝对可以完成最大限度的调整。然而,有些时候,一些更直接的方法就足够了。通过 Cockpit,你可以选择手动设置或使用 NTP 自动设置系统的日期和时间。一旦同步,右边的信息图标就会由红色变成蓝色。如果你手动设置日期和时间,该图标将消失。 + +要更改时区,请输入洲,下面会弹出城市列表。 + +![][9] + +#### 关机和重启 + +你可以在 Cockpit 的主屏幕上轻松关闭和重启服务器。你也可以延迟关机/重启,并发送消息警告用户。 + +![][10] + +#### 设置性能配置文件 + +如果安装了 `tuned` 和 `tuned-utils` 包,可以在主屏幕上更改性能配置文件。默认情况下,它被设置为推荐的配置文件。然而,如果服务器的用途需要更多的性能,我们可以在 Cockpit 中更改配置文件以满足这些需求。 + +![][11] + +### 网页版终端控制台 + +一个 Linux 系统管理员的工具箱如果不能访问终端,将毫无用处。终端使得管理员可以对服务器进行微调,而不仅仅是 Cockpit 中的内容。随着主题功能的加入,管理员可以根据自己的喜好快速调整文字和背景颜色。 + +另外,如果你错输入了 `exit` 命令,点击右上角的 “重置” 按钮,会提供一个闪烁着光标的新屏幕。 + +![][12] + +### 添加远程服务器和仪表板布局 + +“Headless Management” 组包括了仪表盘模块(`cockpit-dashboard`)。它以实时图表的形式提供了 CPU、内存、网络和磁盘性能的概览。远程服务器也可以通过同一界面进行添加和管理。 + +例如,要在仪表盘中添加远程计算机,请单击 “+” 按钮。输入服务器的名称或 IP 地址,并选择你要的颜色。这有助于你在图中区分服务器的统计数据。要在服务器之间进行切换,请点击主机名称(如下面的屏幕动画所示)。要从列表中删除一个服务器,点击勾选标记图标,然后点击红色垃圾桶图标。下面的例子演示了 Cockpit 如何管理一台名为 `server02.local.lan` 的远程机器。 + +![][13] + +### 文档和寻找帮助 + +一如既往,手册页是查找文档的好地方。在命令行结果中进行简单搜索即可找到与使用和配置该 Web 服务的不同方面有关的页面。 + +``` +$ man -k cockpit +cockpit (1) - Cockpit +cockpit-bridge (1) - Cockpit Host Bridge +cockpit-desktop (1) - Cockpit Desktop integration +cockpit-ws (8) - Cockpit web service +cockpit.conf (5) - Cockpit configuration file +``` + +Fedora 仓库中也有一个名为 `cockpit-doc` 的软件包。这个软件包的描述是最好的解释。 + +> 《Cockpit 部署和开发者指南》向系统管理员展示了如何在他们的机器上部署 Cockpit,并帮助开发者嵌入或扩展 Cockpit。 + +更多文档请访问 。 + +### 结论 + +本文只涉及 Cockpit 中的一些主要功能。管理存储设备、网络、用户账户和软件控制将在下一篇文章中介绍。此外,可选的扩展,如 389 目录服务,以及用于处理 Fedora Silverblue 中的软件包的`cockpit-ostree` 模块。 + +随着越来越多的用户采用 Cockpit,可选的功能会继续增加。这个界面对于想要一个轻量级界面来控制服务器的管理员来说是非常理想的。 + +你对 Cockpit 有什么看法?在下面的评论中分享你的经验和想法。 + +-------------------------------------------------------------------------------- + +via: https://fedoramagazine.org/cockpit-and-the-evolution-of-the-web-user-interface/ + +作者:[Shaun Assam][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://fedoramagazine.org/author/sassam/ +[b]: https://github.com/lujun9972 +[1]: https://fedoramagazine.org/wp-content/uploads/2019/08/cockpit-816x345.jpg +[2]: https://fedoramagazine.org/cockpit-overview/ +[3]: https://fedoramagazine.org/wp-content/uploads/2019/08/cockpit-login-screen.png +[4]: https://fedoramagazine.org/wp-content/uploads/2019/08/cockpit-home-screen.png +[5]: https://fedoramagazine.org/wp-content/uploads/2019/08/cockpit-system-info.gif +[6]: https://fedoramagazine.org/wp-content/uploads/2019/08/cockpit-ssh-key-fingerprints.png +[7]: https://fedoramagazine.org/wp-content/uploads/2019/08/cockpit-authentication.png +[8]: https://fedoramagazine.org/wp-content/uploads/2019/08/cockpit-hostname-domain.gif +[9]: https://fedoramagazine.org/wp-content/uploads/2019/08/cockpit-date-time.png +[10]: https://fedoramagazine.org/wp-content/uploads/2019/08/cockpit-power-options.gif +[11]: https://fedoramagazine.org/wp-content/uploads/2019/08/cockpit-tuned.gif +[12]: https://fedoramagazine.org/wp-content/uploads/2019/08/cockpit-terminal.gif +[13]: https://fedoramagazine.org/wp-content/uploads/2019/08/cockpit-add-remote-servers.gif diff --git a/published/202006/20191125 My top 5 Ansible modules.md b/published/202006/20191125 My top 5 Ansible modules.md new file mode 100644 index 0000000000..f114d6ca59 --- /dev/null +++ b/published/202006/20191125 My top 5 Ansible modules.md @@ -0,0 +1,76 @@ +[#]: collector: (lujun9972) +[#]: translator: (wxy) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12304-1.html) +[#]: subject: (My top 5 Ansible modules) +[#]: via: (https://opensource.com/article/19/11/ansible-modules) +[#]: author: (Mark Phillips https://opensource.com/users/markp) + +我最喜欢用的 5 个 Ansible 模块 +====== + +> 了解如何通过这些 Ansible 模块实现几乎任何事情。 + +![](https://img.linux.net.cn/data/attachment/album/202006/10/214614z2jv4zvet5kw322o.jpg) + +在我成长的时候,我爷爷在他的花园里有一个棚子。他经常会花几个小时在那里制作和修复东西。这是在我们有互联网之前的事情,所以我花了很多时间看他在那个棚子里创造东西。虽然棚子里有很多工具,从钻头到车床到电器配件,还有很多东西我至今都无法辨认,但他使用的只是他手头的一小部分。然而,他能做到的事情似乎永远没有极限。 + +我之所以告诉你这个故事,是因为我觉得我的职业生涯是在一个隐喻的棚子里度过的。计算机也是如此多的工具,都在一个狭小(虚拟?)的空间里。而工具棚中又有工具棚 —— 我最喜欢的是 Ansible。最近的 2.9 版本有 3,681 个模块! **3,681 个啊!**当我在 2013 年夏天第一次开始使用 Ansible 时,1.2.1 版本只有 113 个模块,然而,正如[我当时写的][2],我仍然可以实现任何我想象到的东西。 + +模块是 Ansible 的支柱,是让重任轻装上阵的齿轮。它们被设计为做好一项工作,从而实现了 [Unix 哲学][3]。我们就是这样来把这么多的模块捆绑在一起,作为乐团的指挥,Ansible 现在有很多乐器可以听从它的指挥。 + +回顾一下我多年来的 Ansible 剧本和角色的 Git 仓库,我发现我只用了 35 个模块。这个小的子集被用来构建大型基础设施。不过,我想知道如果用一个更小的子集可以实现什么?当我回顾这 35 个模块时,我在思考,我能否只用 5 个模块就能达到同样的效果。因此,以下是我最喜欢的五个模块,顺序无关。 + +### 5. authorized_key + +SSH 是 Ansible 的核心,至少对于除了 Windows 以外的几乎所有其他功能都是如此。在 Ansible 中高效使用 SSH 的关键(没有双关语)是……[密钥][5]!顺便提一下,你可以用 SSH 密钥为安全性做很多非常酷的事情。值得仔细阅读 [sshd 手册页][6]中的 “authorized_keys” 部分。如果你需要精细的用户访问控制,管理 SSH 密钥可能会变得很费力,尽管我可以用接下来的两个我最爱的模块中的任何一个,但我更喜欢使用 [authorized_key][4] 这个模块,因为它[可以通过变量轻松管理][7]。 + +### 4. file + +除了显而易见的将文件放置在某个地方的功能外,[file][8] 模块还可以设置所有权和权限。我想说的是,这样一个模块就能带来很多的好处。很大一部分安全问题也与设置权限有关,所以 [file][8] 模块和 [authorized_key][4] 可以很好地配合在一起使用。 + +### 3. template + +操作文件内容的方法太多了,我看到很多人都在使用 [lineinfile][10]。我自己也用它做过小任务。但是,[template][9] 模块就清晰多了,因为你维护了整个文件的上下文。我更喜欢以任何人都可以*轻松*理解的方式编写 Ansible 的内容 —— 对我而言,这意味着容易理解正在发生的事情。[template][9] 的使用意味着能够看到你正在放置内容的整个文件、全部你正在改变的变量。 + +### 2. uri + +当前发布版中的许多模块利用 Ansible 作为编排工具。它们与另一个服务对话,而不是做一些具体的事情,比如把一个文件放到一个地方。通常,这种对话也是通过 HTTP 进行的。在许多这样的模块出现之前,你*可以*直接使用 [uri][11] 模块对 API 进行编程。它是一个强大的访问工具,可以使你能够做很多事情。在我的 Ansible 虚拟棚子里,我不会少了它。 + +### 1. shell + +这是我们工具包里的王牌、瑞士军刀。如果你为如何控制其他东西而非常苦恼,别说,说就是 [shell][12]。有人会说,我们这样说是让 Ansible 成为了 Bash 脚本 —— 但是,我想说的是,这还是有点好处的,因为可以在你的剧本和角色中使用 `name` 参数记录下每一步。对我来说,这就像一个很大的奖励一样。早在我还在做咨询的时候,我曾经帮助一个数据库管理员(DBA)迁移到 Ansible。这位 DBA 并不喜欢改变,对改变工作方法也是推三阻四。于是,为了简化迁移到 Ansible 方式,我们在 Ansible 中使用 [shell][12] 模块调用了一些现有的数据库管理脚本。并在任务中附带了翔实的 `name` 声明。 + +通过这五个模块,你可以实现很多事情。是的,为完成特定任务而设计的模块会让你的生活更加轻松。但是,借助简单的工程设计,你几乎可以事半功倍。Ansible 开发者 Brian Coca 是这方面的大师,[他的技巧和窍门讲座][13]总是值得一看。 + +* * * + +你觉得我喜欢的五大模块怎么样?如果你也必须限制在这么多模块,你会选择哪五个,为什么?在下面的评论中告诉我吧! + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/11/ansible-modules + +作者:[Mark Phillips][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/markp +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/mandelbrot_set.png?itok=bmPc0np5 +[2]: http://probably.co.uk/post/puppet-vs-chef-vs-ansible/ +[3]: https://en.wikipedia.org/wiki/Unix_philosophy#Do_One_Thing_and_Do_It_Well +[4]: https://docs.ansible.com/ansible/latest/modules/authorized_key_module.html +[5]: https://linux.die.net/man/1/ssh-keygen +[6]: https://linux.die.net/man/8/sshd +[7]: https://github.com/phips/ansible-demos/blob/3bf59df1eb2390b31b5c42333197e2fbb7fec93f/roles/ansible-users/tasks/main.yml#L35 +[8]: https://docs.ansible.com/ansible/latest/modules/file_module.html +[9]: https://docs.ansible.com/ansible/latest/modules/template_module.html +[10]: https://docs.ansible.com/ansible/latest/modules/lineinfile_module.html +[11]: https://docs.ansible.com/ansible/latest/modules/uri_module.html +[12]: https://docs.ansible.com/ansible/latest/modules/shell_module.html +[13]: https://www.ansible.com/ansible-tips-and-tricks diff --git a/published/202006/20200304 Getting started with the Gutenberg editor in Drupal.md b/published/202006/20200304 Getting started with the Gutenberg editor in Drupal.md new file mode 100644 index 0000000000..55ad82e25a --- /dev/null +++ b/published/202006/20200304 Getting started with the Gutenberg editor in Drupal.md @@ -0,0 +1,121 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12273-1.html) +[#]: subject: (Getting started with the Gutenberg editor in Drupal) +[#]: via: (https://opensource.com/article/20/3/gutenberg-editor-drupal) +[#]: author: (MaciejLukianski https://opensource.com/users/maciejlukianski) + +Drupal 中的 Gutenberg 编辑器入门 +====== + +> 了解如何在 Drupal 中集成使用 WordPress 中流行的所见即所得编辑器。 + +![Text editor on a browser, in blue][1] + +自 2017 年以来,WordPress 的 [Gutenberg][2] 插件中的所见即所得编辑器就真的很不错。但是,Drupal 社区尚未就内容管理系统(CMS)编辑体验的最佳方法达成共识。但在社区的大量努力下,出现了一个强有力的新选择,将 [Gutenberg 与 Drupal 集成在一起][3]。 + +以前,Drupal 8 中有两种主要的内容创建方法: + +* 在[基于段落的方法][4]中,内容是由称为段落的实体组合而成。目前,大约有 100,000 个网站使用“段落”(Paragraphs)模块(根据 Drupal 说法)。 +* [Layout-Builder 方法][5]使用 Drupal 8.5 附带的编辑工具。它仍然在改进,但是它是下一个强有力的竞争者,因为它确实与 Drupal 内核很好地集成在一起。由于 Layout-Builder 是 Drupal 的一部分,因此无法获得使用情况的统计信息。 + +在 2018 年底,由 Fronkom(一家专注于开源解决方案的挪威数字机构)领导的 Drupal 社区将 WordPress Gutenberg 项目作为贡献模块移植到了 Drupal 中。让我们看一下 Gutenberg 在 Drupal 中的工作方式(包括一些很酷的 Drupal 特有的集成)。 + +### 安装 + +安装 [Gutenberg 模块][6]与安装任何 Drupal 模块一样简单,并且有良好的[安装文档][7]。 + +### 配置 + +Gutenberg 已集成到 Drupal 的默认内容实体创建工作流中。你可以将其用于你选择的任何内容类型,前提是内容类型至少有一个文本区域字段,它是 Gutenberg 编辑器输出的位置。 + +要在 Drupal 中的内容类型启用 Gutenberg 项目,你必须进入设置:“结构 -> 内容类型”,并且,从要你想使用 Gutenberg 的内容类型旁边的下拉框中单击“编辑”。 + +![Drupal settings][8] + +在出现的窗口中,向下滚动并选择左侧的“Gutenberg 体验”选项卡,你可以在其中找到下面描述的设置。选择“启用 Gutenberg 体验”。 + +![Drupal Gutenberg settings][9] + +#### 模板 + +这是 WordPress 开箱即用的很酷的功能之一。它能让你用 JSON 结构定义新页面模板。它将使用虚拟占位符内容预填充所有新创建的文章,这将有助于编辑者正确地构造内容。在上面的截图中,我添加了一个标题和一个段落。请注意,必须转义任何双引号。 + +#### 模板锁 + +此设置允许你定义是否允许用户删除占位符内容,添加新块或仅编辑现有的预填充内容。 + +#### 允许的 Gutenberg 和 Drupal 块 + +这是 Gutenberg Drupal 侧的另一个超酷功能。Drupal 允许用户创建各种类型的块来设计页面。例如,你可以创建一个块,其中包含五个最新博客的列表、最新评论或用于收集用户电子邮件的表单。 + +Gutenberg 与 Drupal 的深度集成允许用户在编辑时选择哪些 Drupal 块可供用户使用(例如,限制嵌入 YouTube),并将块用作内联内容。这是一个非常方便的功能,允许对用户体验进行精细控制。 + +在全新安装的 Drupal 中,没有太多的选择,但站点通常有许多提供各种功能的块。在下面的截图中,选择了“搜索表单”的 Drupal 块。 + +![Drupal Gutenberg blocks][10] + +完成配置后,点击“保存内容类型”。 + +### 使用 Drupal Gutenberg 发布内容 + +启用 Gutenberg 内容类型后,它将接管大部分编辑体验。 + +![Drupal Gutenberg content screen][11] + +在主窗口中,你可以看到我在上面的模板配置中添加的虚拟占位符内容。 + +#### 特定于 Drupal 的选项 + +在右侧,Drupal 提供了一些字段和设置。例如,“标题” 字段是 Drupal 中所需的单独字段,因此它不在主页面上。 + +在“标题”下面,根据在 Drupal 中安装的模块和设置的选项,其他设置可能有所不同。你可以看到“修订日志消息”、“菜单设置”、“评论设置”以及添加“URL 别名”。 + +通常,Drupal 内容类型由多个文本字段组成,如标记、类别、复选框、图像字段等。当你启用 Gutenberg 内容类型时,这些附加字段可在“更多设置”选项卡中提供。 + +你现在可以添加内容 —— 它的工作方式与 WordPress Gutenberg 中的相同,并有额外的添加 Drupal 块的选项。 + +在下面的截图中,你可以看到当我添加一些文本替换占位符文本、来自 Drupal 的搜索块、标题、标记和自定义 URL 别名后发生的情况。 + +![Drupal Gutenberg entering text][12] + +点击“保存”后,你的内容将发布。 + +![Drupal Gutenberg output][13] + +就是这样,它工作良好。 + +### 共同工作以获得更好的软件体验 + +Drupal 中的 Gutenberg 工作良好。这是一个可供选择的方式,允许编辑者控制网站的外观,直至最细微的细节。它的采用率正在增长,截至本文撰写时,已有 1,000 多个安装,每月有 50 个新安装。Drupal 集成添加了其他很酷的功能,如细粒度权限、占位符内容,以及内联包含 Drupal 块的功能,这些功能在 WordPress 插件中没有。 + +很高兴看到两个独立项目的社区共同努力实现为人们提供更好的软件的共同目标。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/3/gutenberg-editor-drupal + +作者:[MaciejLukianski][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/maciejlukianski +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/browser_blue_text_editor_web.png?itok=lcf-m6N7 (Text editor on a browser, in blue) +[2]: https://wordpress.org/plugins/gutenberg/ +[3]: https://drupalgutenberg.org/ +[4]: https://www.droptica.com/blog/flexible-and-easy-content-creation-drupal-paragraphs-module/ +[5]: https://www.droptica.com/blog/layout-builder-building-drupal-8-layouts/ +[6]: https://www.drupal.org/project/gutenberg +[7]: https://www.drupal.org/docs/8/extending-drupal-8/installing-drupal-8-modules +[8]: https://opensource.com/sites/default/files/uploads/gutenberg_edit.png (Drupal settings) +[9]: https://opensource.com/sites/default/files/uploads/gutenberg_settings.png (Drupal Gutenberg settings) +[10]: https://opensource.com/sites/default/files/uploads/gutenberg_blocks.png (Drupal Gutenberg blocks) +[11]: https://opensource.com/sites/default/files/uploads/gutenberg_contentwindow.png (Drupal Gutenberg content screen) +[12]: https://opensource.com/sites/default/files/uploads/gutenberg_entry.png (Drupal Gutenberg entering text) +[13]: https://opensource.com/sites/default/files/uploads/gutenberg-demo.png (Drupal Gutenberg output) diff --git a/published/202006/20200506 6 open source alternatives to Wunderlist.md b/published/202006/20200506 6 open source alternatives to Wunderlist.md new file mode 100644 index 0000000000..e79d80ac5d --- /dev/null +++ b/published/202006/20200506 6 open source alternatives to Wunderlist.md @@ -0,0 +1,123 @@ +[#]: collector: (lujun9972) +[#]: translator: (wxy) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12314-1.html) +[#]: subject: (6 open source alternatives to Wunderlist) +[#]: via: (https://opensource.com/article/20/5/alternatives-list) +[#]: author: (Jen Wike Huger https://opensource.com/users/jen-wike) + +6 个开源的奇妙清单(Wunderlist)替代品 +====== + +> 喜欢列表?看看这个便捷的开源应用程序列表,以管理你所有的列表! + +![](https://img.linux.net.cn/data/attachment/album/202006/14/142722a639gqqrgg7x6hb5.jpg) + +奇妙清单(Wunderlist)是一款清单应用,受到很多人的喜爱,但从 2020 年 5 月 6 日起,它就永远停止了。它的网站鼓励现有用户下载并使用“微软待办”来代替它。这很诱人,因为它可以轻松导入你多年来制作的所有这些列表。不过话又说回来,也许这是个机会,可以“近藤麻理惠”一下这些列表,并削减一些事务。(你真的需要 30 个列表吗?很显然,我觉得我需要,所以我不做评判。) + +我有各种各样的清单,从“2020 年花园的植物”到“给丈夫的礼物”。有些是清单,有些是待办事项清单,有些是为了清单而清单。 + +对我和我丈夫来说,最有用的清单是我们共享的杂货清单。我们都有手机上的应用程序,我们都把东西添加到列表中,但在他去购物之前,我们分别在手机上审查它(是的,你没看错),他把东西放进购物车时,他就会勾掉它。这让整个过程变得出奇的高效,我想我们节省了一些钱,因为我们喜欢坚持按清单购物。 + +虽然奇妙清单的用户很喜欢它,但它并不是完全独一无二的。还有无数的列表应用。对于奇妙清单,我特别喜欢它将简洁性和设计感结合在一起,而且它成功实现了一些有用的功能,比如与他人分享和协作,列表的动态复选框,以及在移动和网页界面上的良好用户体验。我也很喜欢用它来做一个不“活跃”文档的列表:一个我不会每周都回顾或定期进展的列表,就像我用来进行头脑风暴的许多列表一样(包括我一直想写的小说...)。 + +从这些年来我们发表的许多精彩文章中,我整理了一系列奇妙清单的开源替代方案,从简单的任务管理和待办事项清单到复杂的笔记记录和流程管理,这些列表工具可能会满足你的需求。或者,如果你是那个在丢得到处都是的纸条和便签上书写任务和备注的人,这可能是尝试这些数字工具之一的好时机。 + +### Tasks:可与 OwnCloud 配合 + +Tasks 是一款自由开源的应用,你可以从 [F-droid][2] 安装。Tasks 是一款只适用于手机的应用,但它可以同步到各种地方,非常灵活。你可以将你的列表保存到 NextCloud 或 OwnCloud、Google Tasks、Apple Reminders 以及几乎所有你有账户的 CalDAV 服务器上。 + +Tasks 的默认视图是每日视图,所以你输入的任何任务都被假定为从今天开始的任务。如果你像我一样,想维护几个不同的列表,你可以用标签来实现。当你创建一个标签时,你就为任务创建了一个类别。你可以为它指定一种颜色和一个图标,这样每个任务列表都是独一无二的。 + +这需要一点时间来适应,但标签有很多优点。因为所有的任务都是有标签的,你可以通过点击你想过滤的标签来查看任务组,但你也可以按天甚至按地点过滤。这意味着,当你去采购杂货时,你的杂货列表会成为活跃的默认列表,而当你回到家时,你的日常生活列表又会成为活跃的列表。 + +通过将你的数据同步到你的一个在线账户,你可以与亲人、合作者和同事分享列表。 + +另一个伟大的功能是,如果你每天早上上班时都有相同的任务,或者每周杂货清单中有 20 个相同的项目,你可以创建定期重复的任务。 + +评测者:Seth Kenlon + +![Screenshot of Tasks interface][3] + +### OpenTasks:适于长列表 + +[OpenTasks][4] 是一款优秀的任务管理工具,可以创建带有各种设置的个人任务。它在创建任务时支持多种字段,从基本的东西,如名称和描述,到更复杂的项目,如选择任务是私人、公共还是机密。OpenTasks 与其他替代品最大的不同之处在于它在应用的主屏幕上使用了选项卡。这些选项卡可以让你快速看到到期的任务、即将开始的任务、按优先级排序的任务,以及按当前完成进度排序的任务。许多其他应用程序支持做这样的事情,但 OpenTasks 很快就能轻松访问这些列表。 + +[阅读完整的 OpenTasks 评测][5],作者:Joshua Allen Holm。 + +![OpenTasks in Google Play store][6] + +### Mirakel:嵌套列表的绝佳之选 + +[Mirakel][7] 是一款任务管理应用,它拥有现代化的用户界面,并支持你在这样一款程序中可能想要的几乎所有格式。Mirakel 在基础层面上支持多个被称为“元列表”的列表。创建一个单独的任务有大量的选项,有截止日期、提醒、进度跟踪、标签、备注、子任务和文件附件,所有这些都构成了任务条目的一部分。 + +[阅读完整的 Mirakel 评测][5],作者:Joshua Allen Holm。 + +![Screenshot from website of Mirakel app][8] + +### Todo:简单有效,随处可用 + +[Todo.txt][9] 是我不断反复推荐的两个待办事项和任务管理应用之一(另一个是 Org 模式)。而让我不断推荐的原因是,它简单、便携、易懂,而且有很多很棒的附加组件,即使一台机器有这个程序而其他机器上没有,也不会破坏它。而且由于它是一个 Bash shell 脚本,我从来没有发现不支持它的系统。阅读更多关于[如何安装和使用 Todo.txt][10]。 + +[阅读完整的 todo.txt 评测][10],作者:Kevin Sonney。 + +![Drop-down menu for Todo.txt][11] + +### Joplin:最佳私人列表 + +[Joplin][12] 是一个 NodeJS 应用程序,它可以在本地运行和存储信息,允许你加密任务,并支持多种同步方法。Joplin 可以作为控制台或图形应用程序在 Windows、Mac 和 Linux 上运行。Joplin 还拥有 Android 和 iOS 的移动应用,这意味着你的笔记随处可用,而不需要大费周章。Joplin 甚至允许你用 Markdown、HTML 或纯文本来格式化你的笔记。 + +[阅读完整的 Joplin 评测][13],作者:Kevin Sonney。 + +![Joplin graphical version ][14] + +### CherryTree:最好的 Evernote / OneNote / Keep 替代品 + +[CherryTree][15] 是一个 GPLv3 许可的应用程序,它以节点的形式组织信息。每个节点都可以有子节点,让你轻松组织你的列表和思想。而且,子节点可以有自己的子节点,具有独立的属性。 + +[阅读完整的 CherryTree 评测][16],作者:Ben Cotton。 + +![CherryTree's hierarchical note layout][17] + +### 附赠:Wekan,给看板粉丝 + +看板kanban是当今敏捷流程的主流。我们中的许多人(包括我自己)不仅用它们来组织我们的工作,还用它们来组织我们的个人生活。我认识一些艺术家,他们使用 Trello 这样的应用程序来跟踪他们的委托清单,以及正在进行和已经完成的工作。但这些应用往往与工作账户或商业服务挂钩。让我们看看 [Wekan][18],这是一个开源的看板,你可以在本地或你选择的服务上运行。Wekan 提供了与其他看板应用相同的功能,比如创建面板、列表、泳道和卡片,在列表之间拖放,分配给用户,给卡片贴标签,以及做几乎所有你在现代看板中期待的事情。 + +[阅读完整的 Wekan 评测][19],作者:Kevin Sonney。 + +![Wekan kanban board][20] + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/5/alternatives-list + +作者:[Jen Wike Huger][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/jen-wike +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/checklist_hands_team_collaboration.png?itok=u82QepPk (a checklist for a team) +[2]: https://f-droid.org/en/packages/org.tasks/ +[3]: https://opensource.com/sites/default/files/uploads/screenshot_tasks_resized.jpg (Screenshot of Tasks interface) +[4]: https://play.google.com/store/apps/details?id=org.dmfs.tasks +[5]: https://opensource.com/article/17/1/task-management-time-tracking-android +[6]: https://opensource.com/sites/default/files/uploads/opentasks_rezied.jpg (OpenTasks in Google Play store) +[7]: https://mirakel.azapps.de/ +[8]: https://opensource.com/sites/default/files/uploads/mirakel_web_resized.jpg (Screenshot from website of Mirakel app) +[9]: http://todotxt.org/ +[10]: https://linux.cn/article-11835-1.html +[11]: https://opensource.com/sites/default/files/uploads/todo.txtmenu_3.png (Drop-down menu for Todo.txt) +[12]: https://joplin.cozic.net/ +[13]: https://linux.cn/article-10476-1.html +[14]: https://opensource.com/sites/default/files/uploads/joplin-1.png (Joplin graphical version ) +[15]: https://www.giuspen.com/cherrytree/ +[16]: https://opensource.com/article/19/5/cherrytree-notetaking +[17]: https://opensource.com/sites/default/files/uploads/cherrytree.png (CherryTree's hierarchical note layout) +[18]: https://wekan.github.io/ +[19]: https://linux.cn/article-10454-1.html +[20]: https://opensource.com/sites/default/files/uploads/wekan-board.png (Wekan kanban board) diff --git a/published/202006/20200507 Ubuntu Cinnamon Remix 20.04 Review- The Perfect Blend of Ubuntu With Cinnamon.md b/published/202006/20200507 Ubuntu Cinnamon Remix 20.04 Review- The Perfect Blend of Ubuntu With Cinnamon.md new file mode 100644 index 0000000000..322e26fa60 --- /dev/null +++ b/published/202006/20200507 Ubuntu Cinnamon Remix 20.04 Review- The Perfect Blend of Ubuntu With Cinnamon.md @@ -0,0 +1,157 @@ +[#]: collector: (lujun9972) +[#]: translator: (wxy) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12316-1.html) +[#]: subject: (Ubuntu Cinnamon Remix 20.04 Review: The Perfect Blend of Ubuntu With Cinnamon) +[#]: via: (https://itsfoss.com/ubuntu-cinnamon-remix-review/) +[#]: author: (Dimitrios Savvopoulos https://itsfoss.com/author/dimitrios/) + +Ubuntu Remix Cinnamon 20.04 评测:Ubuntu 与 Cinnamon 的完美融合 +====== + +![](https://img.linux.net.cn/data/attachment/album/202006/15/113226uq8ohzycrrc52q52.jpeg) + +推出于 2011 年的 GNOME 3,其 GNOME Shell 迎来了社区的赞扬的同时,也招致了一些人的反对。很多用户和开发者都很喜欢原来的 GNOME 界面,以至于有几个小组复刻了它,其中的一个小组 —— Linux Mint 团队创建了 [Cinnamon 桌面环境][1]。 + +Cinnamon 桌面成为了 Linux Mint 的标志型产品。多年来,Cinnamon 一直是 [Linux Mint][2] 的代名词。在过去的几年里,随着 Cinnamon 的普及,这种情况略有改变。现在其他发行版也开始提供 Cinnamon 桌面环境,[Manjaro][3] 就是这样一个例子。 + +几个月前,我们向大家介绍了一个[新 Ubuntu 变体][4],它提供了开箱即用的 Cinnamon 桌面体验,今天就让我们来深入了解一下 [Ubuntu Cinnamon Remix][5]。 + +### 为什么是 Ubuntu Cinnamon Remix 而不是 Linux Mint? + +的确,Linux Mint 是基于 Ubuntu 的,很多 Linux Mint 的用户都会有这样的疑问:既然 Linux Mint 已经如此成熟,而且用户体验也大致相同,那么换成 Ubuntu 有什么意义吗? + +Ubuntu Cinnamon Remix 与 Linux Mint 有很多小的区别,但有一个关键的区别是 Linux 爱好者不能忽视的。 + +Linux Mint 是基于 “LTS”(长期支持)版本的 Ubuntu,这意味着它一直落后于 Canonical 的 6 个月的更新节奏。Ubuntu Cinnamon Remix 则可以得益于较新的内核以及其他 6 个月周期内的功能升级和较新的软件。 + +另一个关键的区别是,Ubuntu Cinnamon Remix 将 “继承” [Snap 支持][6],而 Linux Mint 则拥抱 [FlatPak][7]。Ubuntu Cinnamon Remix 使用 Ubuntu 软件中心而不是 Mint 软件管理器。 + +我是 Cinnamon 的忠实粉丝,所以我选择了评测这款 Ubuntu 和 Cinnamon 的混合版,在这里我分享一下我的体验。 + +### 体验 Ubuntu Cinnamon Remix + +只要有机会,我总会提到 [Calamares 安装程序][8]有多快,感谢 Ubuntu Cinnamon Remix 团队如此选择。 + +![Calamares Installer][9] + +新安装的 Ubuntu Cinnamon Remix 会消耗大约 750 MB 的内存。这与 Linux Mint Cinnamon 非常相似。 + +![An idle Cinnamon takes 750 MB of RAM][10] + +美丽的 [Kimmo 主题][11]和橙色调的 Ubuntu 壁纸也给我留下了深刻的印象,看来这是一个非常细致的努力的结果。 + +![Ubuntu Cinammon Remix 20.04 Desktop][12] + +#### 足够让你开始的工具 + +和其他 Ubuntu 发行版一样,Ubuntu Cinnamon Remix 也包含了一些重要的生产力工具,下面是其中一些: + +* 火狐浏览器 +* Thunderbird - 电子邮件客户端 +* LibreOffice套件 +* Celluloid - 多媒体播放器 +* [GIMP][13] - 图像处理软件 +* Synaptic 软件包管理器 +* Gnome 软件中心 +* [Gparted][14] - 分区管理器 + +使用 Ubuntu Cinnamon Remix 作为我的主要平台已经有几天了,它满足了我的高期望。Ubuntu 稳定如磐石,速度非常快,在日常工作中我没有遇到任何问题。 + +#### 给 Linux Mint 爱好者的 Ubuntu + +你是否热衷于 Ubuntu Cinnamon,却习惯了 Linux Mint 主题?点击下面的内容,看看如何获得一个完整的 Linux Mint 主题包,以及如何配置它来保持 Ubuntu 的传统。 + +给 Ubuntu Cinnamon Remix 以真正的 Mint 感受: + +首先你必须下载并解压以下内容,通过终端很容易完成。 + +获取 Linux Mint-X 图标包: + +``` +wget http://packages.linuxmint.com/pool/main/m/mint-x-icons/mint-x-icons_1.5.5_all.deb +``` + +获取 Linux Mint-Y 图标包: + +``` +wget http://packages.linuxmint.com/pool/main/m/mint-y-icons/mint-y-icons_1.3.9_all.deb +``` + +获取 Linux Mint 主题: + +``` +wget http://packages.linuxmint.com/pool/main/m/mint-themes/mint-themes_1.8.4_all.deb +``` + +安装下载的软件包: + +``` +sudo dpkg -i ./mint-x-icons_1.5.5_all.deb ./mint-y-icons_1.3.9_all.deb ./mint-themes_1.8.4_all.deb +``` + +完成后,点击左下角的菜单按钮,输入 “themes”。你也可以在系统设置中找到“主题”功能。 + +![Accessing Themes][15] + +打开后更换 kimmo 图标和主题,如下图所示。Linux Mint 默认的“绿色”是普通的 Mint-Y,而橙色是 Ubuntu 的最佳选择。 + +![Linux Mint Theme Settings][16] + +#### 为 Cinnamon 迷们准备的美食 + +让我们承认吧,审美很重要。Cinnamon 拥有简洁优雅的外观、易于阅读的字体和漂亮的色彩对比主题。Cinnamon 提供了一个整洁的桌面,只需进入系统设置下的桌面菜单,即可轻松配置桌面图标。你也可以选择桌面图标只显示在主显示器上、只显示在副显示器上,或者同时显示在两个显示器上。这也适用于超过两台显示器的设置。 + +![Ubuntu Cinnamon Remix Desklets][17] + +桌面组件和小程序是一种小型的、单一用途的应用程序,可以分别添加到你的桌面或面板上。在众多的应用程序中,最常用的是 CPU 或资源监控器、天气小程序、便签和日历。 + +Cinnamon 控制中心集中提供许多桌面配置选项。通过访问 “主题” 部分,你可以选择桌面基本方案和图标、窗口边框、鼠标指针和控件外观。字体对桌面的整体外观有很大的影响,而 Cinnamon 让改变字体比以往任何时候都要容易。 + +Cinnamon 控制中心配置对新用户来说也足够简单,相比之下,KDE Plasma 会因为大量的配置选项而导致新用户感到困惑。 + +![][18] + +Cinnamon 面板包含用于启动程序的菜单、基本的系统托盘和应用程序选择器。面板的配置很简单,添加新的程序启动器只需在主菜单中找到你要添加的程序,右击图标,选择 “添加到面板” 即可。你也可以将启动程序图标添加到桌面,以及 Cinnamon 的 “收藏夹” 启动栏中。如果你不喜欢面板上图标的顺序,只需在面板栏上点击右键,进入面板的 “编辑” 模式,重新排列图标即可。 + +### 结论 + +无论你是决定给你的桌面 “加点料”,还是考虑从 [Windows 迁移到 Linux][19],Cinnamon 社区都为你制作了大量的香料。 + +传统而又优雅,可定制而又简单,Ubuntu Cinnamon Remix 是一个有趣的项目,前途无量,对于喜欢 Ubuntu 的 Cinnamon 桌面爱好者来说,这可能是一个不二之选。 + +你觉得 Ubuntu Cinnamon Remix 怎么样?你已经使用过它了吗? + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/ubuntu-cinnamon-remix-review/ + +作者:[Dimitrios Savvopoulos][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://itsfoss.com/author/dimitrios/ +[b]: https://github.com/lujun9972 +[1]: https://en.wikipedia.org/wiki/Cinnamon_(desktop_environment) +[2]: https://www.linuxmint.com/ +[3]: https://manjaro.org/ +[4]: https://itsfoss.com/ubuntudde/ +[5]: https://ubuntucinnamon.org/ +[6]: https://snapcraft.io/ +[7]: https://flatpak.org/ +[8]: https://calamares.io/ +[9]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/04/Calamares-Installer.png?resize=800%2C426&ssl=1 +[10]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/04/htop-running-on-Ubuntu-Cinnamon-Remix-20.04.png?ssl=1 +[11]: https://github.com/Ubuntu-Cinnamon-Remix/kimmo-gtk-theme +[12]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/04/Ubuntu-Cinammon-Remix-20.04-desktop.png?resize=800%2C450&ssl=1 +[13]: https://itsfoss.com/gimp-2-10-release/ +[14]: https://itsfoss.com/gparted/ +[15]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/04/accessing-themes.png?ssl=1 +[16]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/04/Linux-Mint-theme-settings.png?ssl=1 +[17]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/05/ubuntu-cinnamon-remix-desklets.jpg?fit=800%2C450&ssl=1 +[18]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/05/ubuntu-cinnamon-control.jpg?fit=800%2C450&ssl=1 +[19]: https://itsfoss.com/windows-like-linux-distributions/ diff --git a/published/202006/20200511 How to manage network services with firewall-cmd.md b/published/202006/20200511 How to manage network services with firewall-cmd.md new file mode 100644 index 0000000000..6fcbfc11b9 --- /dev/null +++ b/published/202006/20200511 How to manage network services with firewall-cmd.md @@ -0,0 +1,130 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12276-1.html) +[#]: subject: (How to manage network services with firewall-cmd) +[#]: via: (https://fedoramagazine.org/how-to-manage-network-services-with-firewall-cmd/) +[#]: author: (dan01 https://fedoramagazine.org/author/dan01/) + +如何使用 firewall-cmd 管理网络服务 +====== + +![](https://img.linux.net.cn/data/attachment/album/202006/03/090806hcmc9cxcbbcuccbe.jpg) + +在上一篇文章中,我们探讨了如何在 Fedora 中[用命令行控制防火墙][2]。 + +现在你将看到如何“添加”、“删除”和“列出”服务、协议和端口,以便“阻止”或“允许”它们。 + +### 简短回顾 + +首先,最好检查一下防火墙的*状态*,看它是否正在运行。如我们先前所学,你可以使用状态选项(`firewall-cmd ‐‐state`)来得到。 + +下一步是获取网络接口适用的zone。例如,我使用的桌面有两个网络接口:一个*物理*接口(`enp0s3`),代表我实际的*网卡*,和*虚拟*接口(`virbr0`),它由 KVM 等虚拟化软件使用。要查看哪些域处于活动状态,请运行 `firewall-cmd ‐‐get-active-zones`。 + +现在,你知道了你感兴趣的域,可以使用 `firewall-cmd ‐‐info-zone=FedoraWorkstation` 这样的命令列出该域的规则。 + +### 读取区域信息 + +要显示*特定域*的信息,请运行 `firewall-cmd ‐‐zone=ZoneName ‐‐list-all`,或使用以下命令显示默认域的信息: + +``` +[dan@localhost ~]$ firewall-cmd --list-all +FedoraWorkstation (active) +target: default +icmp-block-inversion: no +interfaces: enp0s3 +sources: +services: dhcpv6-client mdns samba-client ssh +ports: 1025-65535/udp 1025-65535/tcp +protocols: +masquerade: no +forward-ports: +source-ports: +icmp-blocks: +rich rules: +``` + +现在,让我们查看输出。第一行表明以下信息关联的域以及该域当前是否在使用中。 + +`target: default`:告诉我们这是默认域。可以通过 `‐‐set-default-zone=ZoneName` 和 `‐‐get-default-zone` 设置或获取。 + +`icmp-block-inversion` 表明是否阻止 [ICMP][3] 请求。例如,如果机器响应来自网络上其他机器的 ping 请求。 + +`interfaces` 字段显示接受此域的所有接口。 + +### 处理服务、端口和协议 + +现在,重点关注 `services`、`ports` 和 `protocols` 所在行。默认情况下,防火墙将阻止所有端口、服务和协议,而只允许列出的。 + +在这里,你可以看到允许的服务是非常基本的客户端服务。例如,访问网络上的共享文件夹(`samba-client`)、与 DNS 服务器通信或通过 SSH(`ssh` 服务)连接到计算机。你可以将 `service` 视为与端口组合的协议,例如 `ssh` 服务使用 SSH 协议,并且按照惯例使用 22 端口。通过允许 `ssh` 服务,你实际上所做的就是允许传入的连接在默认 22 端口上使用 SSH 协议。 + +请注意,根据经验,名称中带有 `client` 字样的服务是指传出连接,也就是你使用你的 IP 作为源对外部的*连接*,与之相反的是 `ssh` 服务,比如,它将接受传入连接(监听来自外部的连接)。 + +你可以在文件 `/etc/services` 中查找服务。例如,如果你想知道这些服务使用什么端口和协议: + +``` +[dan@localhost ~]$ cat /etc/services | grep ssh +ssh 22/tcp # The Secure Shell (SSH) Protocol +ssh 22/udp # The Secure Shell (SSH) Protocol +``` + +你可以看到 SSH 同时使用 TCP 和 UDP 的 22 端口。此外,如果你希望查看所有可用的服务,只需使用 `firewall-cmd --get-services`。 + +#### 打开端口 + +如果要阻止端口、服务或协议,请确保在此处未列出它们。展开来说,如果要允许服务,那么需要将它添加到列表中。 + +假设你要打开 `5000` 端口用于 TCP 连接。为此,请运行: + +``` +sudo firewall-cmd --zone=FedorwaWorkstation --permanent --add-port=5000/tcp +``` + +请注意,你需要指定规则适用的域。添加规则时,还需要如上指定它是 `tcp` 还是 `udp` 端口。`--permanent` 参数将规则设置为即使系统重启后也可以保留。 + +再次查看你所在区域的信息: + +``` +[dan@localhost ~]$ firewall-cmd --list-all +FedoraWorkstation (active) +target: default +icmp-block-inversion: no +interfaces: enp0s3 +sources: +services: dhcpv6-client mdns samba-client ssh +ports: 1025-65535/udp 1025-65535/tcp 5000/tcp +protocols: +masquerade: no +forward-ports: +source-ports: +icmp-blocks: +rich rules: +``` + +类似地,如果你想从列表删除该端口,请运行: + +``` +sudo firewall-cmd --zone=FedorwaWorkstation --permanent --remove-port=5000/tcp +``` + +相同的 `remove` (`‐‐remove-protocol`、`‐‐remove-service`) 和 `add`(`‐‐add-protocol`、`‐‐add-service`)选项同样适用于*服务*和*协议*。 + +-------------------------------------------------------------------------------- + +via: https://fedoramagazine.org/how-to-manage-network-services-with-firewall-cmd/ + +作者:[dan01][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://fedoramagazine.org/author/dan01/ +[b]: https://github.com/lujun9972 +[1]: https://fedoramagazine.org/wp-content/uploads/2020/05/services-firewall-cmd-816x345.jpg +[2]: https://linux.cn/article-12103-1.html +[3]: https://en.wikipedia.org/wiki/Internet_Control_Message_Protocol +[4]: https://unsplash.com/@tkaiser?utm_source=unsplash&utm_medium=referral&utm_content=creditCopyText +[5]: https://unsplash.com/s/photos/poke-hole?utm_source=unsplash&utm_medium=referral&utm_content=creditCopyText diff --git a/published/202006/20200511 Modify a disk image to create a Raspberry Pi-based homelab.md b/published/202006/20200511 Modify a disk image to create a Raspberry Pi-based homelab.md new file mode 100644 index 0000000000..256945adc4 --- /dev/null +++ b/published/202006/20200511 Modify a disk image to create a Raspberry Pi-based homelab.md @@ -0,0 +1,227 @@ +[#]: collector: (lujun9972) +[#]: translator: (robsean) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12277-1.html) +[#]: subject: (Modify a disk image to create a Raspberry Pi-based homelab) +[#]: via: (https://opensource.com/article/20/5/disk-image-raspberry-pi) +[#]: author: (Chris Collins https://opensource.com/users/clcollins) + +修改磁盘镜像来创建基于树莓派的家庭实验室 +====== + +> 使用树莓派或其它单板机创建一个“家庭私有云”。 + +![](https://img.linux.net.cn/data/attachment/album/202006/03/123435csm7ys7mkbw7ggjy.jpg) + +构建一个[家庭实验室][2]可以是一个有趣的方式,可以让你学习的新概念和实验新技术时还能自娱自乐。得益于以 [树莓派][3] 为首的单板计算机(SBC)的流行,在舒适的家里就可以轻松构建一个多计算机实验室。比起试图在主流的云服务商建立的相同配置,创建一个“家庭私有云”以花更少的钱来体验到云原生技术,也是一个极好的方法。 + +这篇文章阐述如何修改树莓派或其它的单板机的磁盘镜像,预配置主机的 SSH,并禁用首次启动时强制竞选交互配置的服务。这是一个让你的设备“即启动,即运行”的极好方法,类似于云端实例。之后,你可以使用自动化的流程通过 SSH 连接来进行更专业和更深入的配置。 + +此外, 当向你的实验室添加更多的树莓派时,修改磁盘镜像可以来让你只需要将该镜像写到一个 SD 卡、放入树莓派中就可以了! + +![Multiple Raspberry Pi computers, a switch, and a power bank][4] + +### 解压缩和挂载镜像 + +对于这个项目,你需要修改一个服务器磁盘镜像。在测试期间,我使用 [Fedora Server 31 ARM][5]。在你下载该磁盘镜像并[验证其校验和][6]之后,你需要将其解压缩并挂载其到宿主机的文件系统的某个位置上,以便你可以根据需要修改它。 + +你可以使用 [xz][7] 命令通过 `--decompress` 参数来解压缩 Fedora 服务器镜像: + + +``` +xz --decompress Fedora-Server-armhfp-X-y.z-sda.raw.xz +``` + +这会留下一个解压缩后的原始磁盘镜像(它会自动地替换 `.xz` 压缩文件)。这个原始磁盘镜像就像它听起来的那样:一个包含格式化后安装好的磁盘上的所有数据的文件。这包含分区信息、启动分区、root 分区以及其它分区。你需要挂载你打算在其中进行修改的分区,但是要做到这一点,你需要知道磁盘镜像中的分区起始位置和扇区大小,这样你才可以挂载该文件正确的扇区。 + +幸运的是,你可以在一个磁盘镜像上使用 [fdisk][8] 命令,就像在实际磁盘上使用一样容易。使用 `--list` 或 `-l` 参数来查看分区的列表和其信息: + +``` +# 使用 fdisk 来列出原始镜像文件的分区: +$ fdisk -l Fedora-Server-armhfp-31-1.9-sda.raw +Disk Fedora-Server-armhfp-X-y.z-sda.raw: 3.2 GiB, 3242196992 bytes, 6332416 sectors +Units: sectors of 1 * 512 = 512 bytes +Sector size (logical/physical): 512 bytes / 512 bytes +I/O size (minimum/optimal): 512 bytes / 512 bytes +Disklabel type: dos +Disk identifier: 0xdaad9f57 + +Device                               Boot   Start     End Sectors  Size Id Type +Fedora-Server-armhfp-X-y.z-sda.raw1         8192  163839  155648   76M  c W95 F +Fedora-Server-armhfp-X-y.z-sda.raw2 *     163840 1163263  999424  488M 83 Linux +Fedora-Server-armhfp-X-y.z-sda.raw3      1163264 6047743 4884480  2.3G 83 Linux +``` + +你需要的所有信息都可在上面的输出中获得。第 3 行表示扇区大小(包括逻辑和物理的):512 字节 / 512 字节。 + +设备列表显示的是原始磁盘镜像中的分区。第一个,`Fedora-Server-armhfp-X-y.z-sda.raw1` 毫无疑问是引导程序分区,因为它是第一个,很小(仅仅 76MB),而且类型被标识为 `c`,即 W95 FAT32(LBA),这是一个从 SD 卡启动的 FAT32 分区。 + +第二个分区也不是非常大,只有 488MB。这个分区是一个 Linux 原生类型分区(Id 83),它可能是包含内核和 [initramfs][9] 的 Linux 启动分区。 + +第三个分区可能是你需要的东西:它有 2.3GB 大小,所以在它其中应该有发行版的主要部分,并且它是一个 Linux 原生分区类型,这也是在预料之中的。这个分区应该包含了你需要修改的分区和数据。 + +第三个分区从扇区 1163264 开始(在 `fdisk` 的输出中被显示为 `Start` 列),所以你的挂载偏移量是 `595591168`,计算方法是将扇区大小(512)乘以起始扇区(1163264)(即 `512 * 1163264`)。这意味着你需要以偏移量 `595591168` 挂载该文件,才能挂载到正确位置。 + +装备了这些信息,现在你可以将第三个分区挂载到你的家目录中了: + +``` +$ mkdir ~/mnt +$ sudo mount -o loop,offset=595591168 Fedora-Server-armhfp-X-y.z-sda.raw ~/mnt +$ ls ~/mnt +``` + +### 直接在磁盘镜像中作业 + +在磁盘镜像被解压缩和被挂载到宿主机上的一个位置后,就可以修改镜像以符合你的需求。在我看来,对镜像进行更改的最简单的方法是使用 `chroot` 来将你会话的工作根目录更改为挂载镜像的工作根目录。不过,有点棘手。 + +在你改变了根目录后,你的会话将使用新的根目录下的二进制文件。除非你是在一个 ARM 系统做这些所有的操作,否则解压缩后的磁盘镜像的架构将与你正在使用的宿主机系统不同。即使在 chroot 环境中,宿主机系统也无法使用一个不同架构的二进制文件。至少,不能在本机使用。 + +幸运的是,这里有一个解决方案:qemu-user-static。来自 [Debian Wiki][10] 的说明: + +> “[qemu-user-static] 提供了用户模式的仿真二进制文件,是静态构建的。在这个模式中,QEMU 可以在一个 CPU 上启动为另一个 CPU 编译的 Linux 进程 …… 如果安装了 binfmt-support 软件包,qemu-user-static 软件包会注册提供的仿真器可以处理的二进制文件格式,以便其能够直接运行其他架构的二进制文件。” + +这正是你需要在 chroot 环境中非本地架构中工作所需的。如果宿主机系统是 Fedora,使用 DNF 来安装 `qemu-user-static` 软件包,并重新启动 `systemd-binfmt.service`: + +``` +# 使用 DNF 启用非本地的 arch chroot 环境,添加新的二进制文件格式信息 +# 输出镜像了精简 +$ dnf install qemu-user-static +$ systemctl restart systemd-binfmt.service +``` + +使用这种方法,你一个能够更改根目录到挂载的磁盘镜像,运行 `uname` 命令来验证一切都在正常: + +``` +sudo chroot ~/mnt/ /usr/bin/uname -a -r +Linux marvin 5.5.16-200.fc31.x86_64 #1 SMP Wed Apr 8 16:43:33 UTC 2020 armv7l armv7l armv7l GNU/Linux +``` + +在 chroot 环境中运行 `uname` 将在输出中显示 `armv7l`,这个原始磁盘镜像的架构, 而不是宿主机的架构。一切如预期,可以继续修改镜像了。 + +### 修改磁盘镜像 + +现在你可以直接切换到这个基于 ARM 的磁盘镜像中,并在该环境中工作了,你可以对镜像自身镜像修改了。你需要设置该镜像,以便它能够启动并可立即访问,而不需要在树莓派上做任何额外的设置。为此,你需要安装并启用 sshd(OpenSSH 守护进程),并为 SSH 访问添加授权密码。 + +为了使其表现得更像一个云环境,实现在家里建立私有云的梦想,添加一个本地用户,给予该用户 `sudo` 权限,并(为了像云端的重度用户一样)允许该用户无需密码就可以使用 `sudo`。 + +所以,你将做的事情是: + + * 安装并启用 SSHD(SSHD 已经在 Fedora ARM 镜像中安装并启用,但是你可能需要为你发行版手动执行这些工作) + * 设置一个本地用户 + * 允许本地用户来使用 `sudo`(无需密码,可选) + * 添加授权密钥 + * 允许 root 使用授权密码镜像 SSH(可选) + +我使用 GitHub 功能,它允许你上传你的 SSH 公钥,并在 [https://github.com/.keys][11] 处可访问。我发现这是一种很方便的分发公钥的方法,不过我生性多疑,我总是检查下载的密钥是否与我预期的匹配。如果你不想使用这种方法,你可以从你宿主机中复制你公钥到 chroot 环境中,或者你可以将公钥托管在你控制的 Web 服务器上以便使用相同的工作流。 + +要开始修改磁盘镜像,再次切换根目录到挂载的磁盘镜像中,这次启动一个 shell,以便可以运行多个命令: + +``` +# 为了简洁起见,省略了这些命令的输出(如果有的话) +$ sudo chroot ~/mnt /bin/bash + +# 安装 openssh-server ,并启用它 (在 Fedora 上已经完成) +$ dnf install -y openssh-server +$ systemctl enable sshd.service + +# 允许 root 使用授权密码访问 SSH +$ mkdir /root/.ssh + +# 下载或者另外添加授权密码文件,你的公共密码 +# 将 URL 替换为你自己公共密码的路径 +$ curl -o /root/.ssh/authorized_keys +$ chmod 700 /root/.ssh +$ chmod 600 /root/.ssh/authorized_keys + +# 添加一个本地用户,并放置他们到 wheel 组中 +# 将组和用户更改为您想要的一切 +useradd -g chris -G wheel -m -u 1000 chris + +# 下载并添加你的授权密码 +# 像你上面所做的那样更改 home 目录和URL +mkdir /home/chris/.ssh +curl -o /home/chris/.ssh/authorized_keys +chmod 700 /home/chris/.ssh +chmod 600 /home/chris/.ssh/authorized_keys +chown -R chris.chris /home/chris/.ssh/ + +# 允许 wheel 组( 使用你的本地用户) 不需要使用密码来使用 suso +echo "%wheel ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers.d/91-wheel-nopasswd +``` + +这就是树莓派或其它单板机在首次启动时需要完成设置 SSH 的全部工作。不过,每个发行版都有自己的特点。例如,Raspbian 已经包含一个本地用户:`pi`,并且不使用 `wheel` 组。因此对于 Raspbian 来说,最好使用现有用户,或者删除 `pi` 用户,并使用另一个用户来替换它。 + +在 Fedora ARM 的情况下,镜像会在首次引导启动时提示你完成设置。这会破坏你在上面所做的修改的目的,尤其是在设置完成之前,它会完全阻止启动。你的目标是使树莓派的功能类似于私有云的基础设施的一部分一样运行,而这个工作流程包括在主机启动时通过 SSH 远程设置主机。 禁用初始化设置,它由 `initial-setup.service` 控制: + +``` +# 对多用户和图形目标禁用 initial-setup.service +unlink /etc/systemd/system/multi-user.target.wants/initial-setup.service +unlink /etc/systemd/system/graphical.target.wants/initial-setup.service +``` + +当你在 chroot 环境时,你可以对你系统做任何你想做的其它更改,或者就放在那里,在第一次启动后,按照云原生的工作流通过 SSH 进行配置。 + +### 重新压缩并安装修改后的镜像 + +完成了这些更改后,剩下的就是重新压缩磁盘镜像,并将其安装其到你的树莓派的 SD 卡上。 + +确保退出 chroot 环境,然后卸载磁盘镜像: + +``` +$ sudo umount ~/mnt/ +``` + +就像最初解压缩镜像一样,你可以再次使用 `xz` 命令来压缩镜像。通过使用 `--keep` 参数,`xz` 将保留原始的镜像,而不是清理掉它。虽然这会占用更多的磁盘空间,但保留下来的未压缩镜像将允许你对正在处理的镜像进行增量更改,而不需要每次都对其进行解压缩。这对于在测试和调整镜像时节省时间是非常好的。 + +``` +# 压缩压缩磁盘镜像为一个 .xz 文件,但保留原始磁盘镜像 +xz --compress Fedora-Server-armhfp-31-1.9-sda.raw --keep +``` + +压缩过程将花费一些时间,所以趁着这个时间站起来,舒展身体,让你的血液再次流动。 + +在压缩完成后,可以将新的、已修改过的磁盘镜像复制到 SD 卡上,以便与树莓派一起使用。标准的 `dd` 方法将镜像放置到 SD 卡上也很好用,但是我喜欢使用 Fedora 的 `arm-image-installer`,因为它因为它在处理未经编辑的镜像时提供了一些选项。它对编辑过的镜像也很好用,并且比 `dd` 命令更友好一些。 + +确保检查 SD 卡在哪个磁盘驱动器上,并用 `--media` 参数使用它: + +``` +# 使用 arm-image-installer 来复制已修改的磁盘镜像到 SD 卡上 +arm-image-installer --image=Fedora-Server-armhfp-X-y.z-sda.raw.xz --target=rpi3 --media=/dev/sdc --norootpass --resizefs -y +``` + +现在,你已经为树莓派或其它单板机准备好了一个新的、已修改的 Fedora Server ARM 镜像,准备好启动并立即 SSH 到你的修改镜像中。这种方法也可以用来做其它的修改,并且你也可以使用其它发行版的原始磁盘镜像,如果你更喜欢它们,而不是 Fedora 的话。这是一个开始构建家庭实验室私有云的良好基础。在以后的文章中,我将指导你使用云技术和自动化建立一个家庭实验室。 + +### 延伸阅读 + +为了学习如何做这篇文章中的事情,我做了很多研究。以下是我找到的两个对学习如何定制磁盘映像和使用非原生架构最有帮助的资料。它们对我从“不知道自己在做什么”到“我能够完成它!”非常有帮助。 + + * [如何修改你的自定义 Linux 发行版的原始磁盘镜像][12] + * [使用 DNF 维基][13] + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/5/disk-image-raspberry-pi + +作者:[Chris Collins][a] +选题:[lujun9972][b] +译者:[robsean](https://github.com/robsean) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/clcollins +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/science_experiment_beaker_lab.png?itok=plKWRhlU (Science lab with beakers) +[2]: https://opensource.com/article/19/3/home-lab +[3]: https://opensource.com/resources/raspberry-pi +[4]: https://opensource.com/sites/default/files/uploads/raspberrypi_homelab.jpg (Multiple Raspberry Pi computers, a switch, and a power bank) +[5]: https://arm.fedoraproject.org/ +[6]: https://arm.fedoraproject.org/verify.html +[7]: https://tukaani.org/xz/ +[8]: https://en.wikipedia.org/wiki/Fdisk +[9]: https://wiki.debian.org/initramfs +[10]: https://wiki.debian.org/RaspberryPi/qemu-user-static +[11]: https://github.com/%3Cyour_github_username%3E.keys +[12]: https://www.linux.com/news/how-modify-raw-disk-image-your-custom-linux-distro/ +[13]: https://wiki.mageia.org/en/Using_DNF#Setting_up_a_container_for_a_non-native_architectur diff --git a/published/202006/20200514 How IoT will rescue aviation.md b/published/202006/20200514 How IoT will rescue aviation.md new file mode 100644 index 0000000000..c6cd6c0ee8 --- /dev/null +++ b/published/202006/20200514 How IoT will rescue aviation.md @@ -0,0 +1,61 @@ +[#]: collector: (lujun9972) +[#]: translator: (Yufei-Yan) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12367-1.html) +[#]: subject: (How IoT will rescue aviation) +[#]: via: (https://www.networkworld.com/article/3543318/how-iot-will-rescue-aviation.html) +[#]: author: (Patrick Nelson https://www.networkworld.com/author/Patrick-Nelson/) + +物联网将如何拯救航空业 +====== + +> 为防止感染新冠病毒的乘客登机,欧洲飞机制造商,空中客车公司正在研究能够识别病毒的物联网传感器。 + +![Stéphan Valentin][1] + +一家开发传感器来探测飞机上和机场中的爆炸物和其他化学物品的生物技术公司正在和空中客车合作,一同开发一种可以检测已经感染新冠病毒乘客的传感器。 + +Koniku 的创始人兼首席执行管 Osh Agabi 在[一篇博文][3]中说,总部位于加州的 Konibu 公司和空中客车(Airbus)公司从 2017 年就开始合作共同开发能够探测出不同化学物质的非接触式设备。 + +他们希望通过识别从呼吸或者汗液中的气味来判断是否感染新冠病毒,因为这些气味可能是新冠病毒中化学物质的标记。“大多数感染和疾病都会或多或少的改变我们呼吸和汗液里的化学成分,也就会产生不同的气味,” Agabi 写道。“如果我们检测到这些气味,我们就可以检测是否存在感染。” + +这两家公司希望能够识别这种新冠病毒的特异性标记,并且能找到一种可以检测这些标记的物联网(IoT)传感器,这些传感器配备有通过基因工程改造过的受体,从而对病毒进行探测。“那些受体会过滤空气中的分子,并且当它们接触到已经提前被编程检测的存在威胁或危险的分子化合物的时候,就会产生一个信号,”他写道。 + +他说,乘客将通过走过一个装有传感器的封闭通道来进行筛选。“通过对构成这些受体细胞中的 DNA 进行编程,使其对出现在感染者呼吸或者汗液中的化合物作出反应,我们相信,我们将能够迅速且可靠地筛查新冠病毒,并且确定一个人是否已经被感染,”他写道。 + +其他类型的非接触检测器已经在使用中了,包括皮肤温度升高elevated-skin-temperature(EST)摄像头。 + +意大利的最主要的机场 Leonardo da Vinci 购置了三个热成像头盔来发现发烧的人。机场已经配备了固定的热感应扫描仪,并且订购了更多的这种设备。[根据当地媒体 Fiumicino Online 的报道][5],被发现潜在发烧的乘客被会要求做进一步的医学检查。 + +位于中国深圳制造这种头盔的 KC Wearable 公司表示,这种头盔可以由员工佩戴,并且可以与乘客保持一定的距离。 + +制造热感应摄像头的 FLIR Systems 公司在其本月的[财报][6]中表示,对 EST 系统的需求正在持续增加。 + +“尽管这些热感应摄像头不能检测或者诊断任何医疗状况,但这些摄像头可以作为识别皮肤温度升高的有效工具。”报告说。 + +FLIR 公司 CEO Jim Cannon 在本月的收入电话会议上表示,“许多公司都在寻求在他们的设施中安装这种技术,以便解除就地避难shelter-in-place法令”。[根据路透社报道][8],通用汽车就是其中之一。 + +-------------------------------------------------------------------------------- + +via: https://www.networkworld.com/article/3543318/how-iot-will-rescue-aviation.html + +作者:[Patrick Nelson][a] +选题:[lujun9972][b] +译者:[Yufei-Yan](https://github.com/Yufei-Yan) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://www.networkworld.com/author/Patrick-Nelson/ +[b]: https://github.com/lujun9972 +[1]: https://images.idgesg.net/images/article/2018/08/passenger-view_of_airplane_wing_above_clouds_travel_journey_transportation_by_stephan_valentin_cc0_via_unsplash_1200x800-100766542-large.jpg +[2]: https://creativecommons.org/publicdomain/zero/1.0/ +[3]: https://www.linkedin.com/pulse/what-happens-when-airports-open-back-up-osh-agabi/?src=aff-lilpar&veh=aff_src.aff-lilpar_c.partners_pkw.10078_plc.Skimbit%20Ltd._pcrid.449670_learning&trk=aff_src.aff-lilpar_c.partners_pkw.10078_plc.Skimbit%20Ltd._pcrid.449670_learning&clickid=WNmzMlyalxyOUI7wUx0Mo34HUkiwwpy%3APQ3X1Y0&irgwc=1 +[4]: https://www.networkworld.com/newsletters/signup.html +[5]: https://www.fiumicino-online.it/articoli/cronaca-2/fase-2-all-aeroporto-di-fiumicino-lo-smart-helmet-per-controllare-la-febbre-a-distanza +[6]: https://flir.gcs-web.com/news-releases/news-release-details/flir-systems-announces-first-quarter-2020-financial-results +[7]: https://www.fool.com/earnings/call-transcripts/2020/05/06/flir-systems-inc-flir-q1-2020-earnings-call-transc.aspx +[8]: https://uk.reuters.com/article/us-flir-systems-gm/general-motors-taps-flir-systems-for-fever-check-cameras-at-factories-idUKKBN22J02B +[9]: https://www.facebook.com/NetworkWorld/ +[10]: https://www.linkedin.com/company/network-world diff --git a/published/202006/20200525 How to Execute a Command or Script at Reboot or Startup.md b/published/202006/20200525 How to Execute a Command or Script at Reboot or Startup.md new file mode 100644 index 0000000000..f3e2a0e45d --- /dev/null +++ b/published/202006/20200525 How to Execute a Command or Script at Reboot or Startup.md @@ -0,0 +1,151 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12279-1.html) +[#]: subject: (How to Execute a Command or Script at Reboot or Startup) +[#]: via: (https://www.2daygeek.com/execute-run-linux-scripts-command-at-reboot-startup/) +[#]: author: (Magesh Maruthamuthu https://www.2daygeek.com/author/magesh/) + +如何在重启或启动时执行命令或脚本 +====== + +![](https://img.linux.net.cn/data/attachment/album/202006/04/091837g664qu0y206aqoo9.jpg) + +众总所周知 Linux 可以在启动时添加服务。例如,如果要在[启动时添加][1] Apache Httpd 服务,你可以在 `chkconfig` 和 `systemctl` 命令的帮助下完成此操作。 + +有时你需要在启动时添加自定义脚本、命令或服务,该怎么做?你可以使用以下三种方法来做到。 + +在本文中,我们将通过示例向你展示如何使用这些方法。 + +### 方法 1:如何使用 /etc/rc.d/rc.local 文件在重启或启动时运行脚本或命令 + +传统上,`/etc/rc.local` 文件是在切换到多用户运行级别的过程结束时,在所有正常的计算机服务启动之后执行的。 + +此方法也适用于 systemd 系统。 + +你需要将你的脚本位置添加到 `/etc/rc.d/rc.local` 文件中以在启动时运行。 + +确保该文件有运行权限: + +``` +# chmod +x /etc/rc.d/rc.local +``` + +作为演示,我们将创建一个简单的示例脚本。你可以根据需要创建任何脚本。 + +``` +# vi /opt/scripts/run-script-on-boot.sh + +#!/bin/bash +date > /root/on-boot-output.txt +hostname > /root/on-boot-output.txt +``` + +脚本完成后,设置可执行权限: + +``` +# chmod +x /opt/scripts/run-script-on-boot.sh +``` + +最后,将该脚本添加到文件底部: + +``` +# vi /etc/rc.d/rc.local + +/opt/scripts/run-script-on-boot.sh +``` + +[重启系统][2]进行检查: + +``` +# reboot +``` + +### 方法 2:如何使用 crontab 在重启或启动时执行命令或脚本 + +cron 在特定时间在后台自动执行计划的作业。可以在 [cron 任务][3]中使用特殊的字符串 `@reboot` 来完成。`@reboot` 是一个特殊的字符串,它允许用户在启动时运行任何命令或脚本。 + +此示例在系统重启时运行 `/opt/scripts/run-script-on-boot.sh` 文件。我们将使用与上面相同的脚本。 + +为此,只需在 crontab 文件中添加以下条目: + +``` +# crontab -e + +@reboot /opt/scripts/run-script-on-boot.sh +``` + +重启系统进行检查: + +``` +# reboot +``` + +### 方法 3:如何使用 systemd 服务单元在重启或启动时运行命令或脚本 + +此方法仅适用于 systemd 系统。该方法非常简单。 + +我们将使用上面相同的脚本进行演示。 + +为此,你需要创建一个 systemd 启动脚本并将其放在 `/etc/systemd/system/` 目录中。 + +这是我们的示例 systemd 启动单元脚本: + +``` +# vi sample-on-boot-script.service + +[Unit] +Description=Run a Custom Script at Startup +After=default.target + +[Service] +ExecStart=/opt/scripts/run-script-on-boot.sh + +[Install] +WantedBy=default.target +``` + +将单元脚本放置在 systemd 所在位置后,运行以下命令更新 systemd 配置文件并启用服务: + +``` +# systemctl daemon-reload +# systemctl enable sample-on-boot-script.service +``` + +重启系统进行检查: + +``` +# reboot +``` + +### 额外提示 + +如果你想在后台运行脚本,你需要在最后加上 `&` 符号 + +``` +/Path/To/My_Script & +``` + +如果你想以不同用户运行命令,使用以下格式: + +``` +su - $USER -c /Path/To/My_Script +``` + +-------------------------------------------------------------------------------- + +via: https://www.2daygeek.com/execute-run-linux-scripts-command-at-reboot-startup/ + +作者:[Magesh Maruthamuthu][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://www.2daygeek.com/author/magesh/ +[b]: https://github.com/lujun9972 +[1]: https://www.2daygeek.com/enable-disable-services-on-boot-linux-chkconfig-systemctl-command/ +[2]: https://www.2daygeek.com/6-commands-to-shutdown-halt-poweroff-reboot-the-linux-system/ +[3]: https://www.2daygeek.com/linux-crontab-cron-job-to-schedule-jobs-task/ diff --git a/published/202006/20200525 How to Make a GIF in GIMP -Simple Tutorial.md b/published/202006/20200525 How to Make a GIF in GIMP -Simple Tutorial.md new file mode 100644 index 0000000000..5d9f949b7f --- /dev/null +++ b/published/202006/20200525 How to Make a GIF in GIMP -Simple Tutorial.md @@ -0,0 +1,95 @@ +[#]: collector: (lujun9972) +[#]: translator: (robsean) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12289-1.html) +[#]: subject: (How to Make a GIF in GIMP [Simple Tutorial]) +[#]: via: (https://itsfoss.com/make-gif-in-gimp/) +[#]: author: (Dimitrios Savvopoulos https://itsfoss.com/author/dimitrios/) + +初级:如何在 GIMP 中制作 GIF +====== + +制作一个 GIF 可能是一件很有趣的事,很多用户可能都想如何制作一个 GIF。你可以使用功能强大的开源图像编辑软件 [GIMP][1] 创建一个非常简单的 GIF。 + +在这篇 GIMP 教程中,我将向你展示如何在 GIMP 中创建一个简单的 GIF。 + +### 在 GIMP 中制作一个 GIF + +![][2] + +使用 GIMP 作为一个动画制作工具需要你把每个图层都看作动画的一帧。在这篇教程中,我将创建一个简单的基于我们的徽标的网页横幅。我将使用 2 个图像作为我的图层,但当你制作自己的 GIF 时,你可以随意添加更多的图像。 + +我在这里使用的方法叫做“组合法”,在这个方法中,新的帧被添加到先前的帧中。我的想法是制作一个“频闪”的网页横幅,来在对一些重要的事情引起注意。 + +我假设你已经 [在 Ubuntu 或其它使用的操作系统中安装了 GIMP][3]。让我们开始制作 GIF 吧。 + +#### 步骤 1 + +从“文件”菜单中,单击“作为图层打开”,并选择你想包含在 GIF 中的所有图像。然后单击“打开”。 + +![][4] + +你可以排序图层标签页中的图像。GIF 的帧序列将从最下面的图层开始,从下到上运行每一层图层。 + +![][5] + +从主菜单中选择“滤镜”,接着选择“动画”,最后单击“优化(用于 GIF)”。 + +![][6] + +> “优化”做了什么? +> +> 优化会检查每一个图层,如果来自前一帧的信息在下一帧中没有改变,则重复使用这些信息。它只存储新更改的像素值,并清除任何重复的部分。 +> +> 如果一帧与前一帧完全相同,那么它将完全删除这一幅帧,并且前一帧将恰当地在屏幕上停留更长时间。 + +要查看该 GIF,从主菜单中单击“滤镜”,接着单击“动画”和“回放”。 + +![][7] + +按下“回放”按钮来启动 GIF。要保存该 GIF,在文件菜单上选择“文件”,单击“导出为”。 + +![][8] + +命名你的 GIF,并选择你想将其保存到的文件夹。在“选择文件类型”时,选择 “GIF 图像”。 + +![][9] + +当提示时,选择“作为动画”、“反复循环”,设置期望的延迟值,并单击“上面输入的延迟用于所有帧”来生效。 + +最重要的选项是设置帧处理动作为“累积各图层(组合)”,以便为我们的横幅获取“频闪”效果。单击“导出”作为最后一个步骤。 + +![][10] + +你的 GIF 已经准备好了! + +![][11] + +这是一个浅显易懂的示例,不过 GIMP 在动画创作方面有很多能力,需要大量的学习和实践才能掌握它。 + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/make-gif-in-gimp/ + +作者:[Dimitrios Savvopoulos][a] +选题:[lujun9972][b] +译者:[robsean](https://github.com/robsean) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://itsfoss.com/author/dimitrios/ +[b]: https://github.com/lujun9972 +[1]: https://www.gimp.org/ +[2]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/05/create-gif-in-gimp.jpg?ssl=1 +[3]: https://itsfoss.com/gimp-2-10-release/ +[4]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/05/1.-open-as-layers.jpeg?ssl=1 +[5]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/05/layers-order.jpg?ssl=1 +[6]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/05/2.-optimize-for-gif-1.png?fit=800%2C647&ssl=1 +[7]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/05/3.-playback.png?fit=800%2C692&ssl=1 +[8]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/05/4.-export-as.png?ssl=1 +[9]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/05/5.-save-as-gif.png?fit=800%2C677&ssl=1 +[10]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/05/6.-export-options-1.png?ssl=1 +[11]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/05/its-foss-logo.gif?fit=800%2C417&ssl=1 +[12]: https://itsfoss.com/subscribe-to-newsletter/ diff --git a/published/202006/20200525 How to Manipulate an Ethernet Card Using the ethtool Command.md b/published/202006/20200525 How to Manipulate an Ethernet Card Using the ethtool Command.md new file mode 100644 index 0000000000..faf7eb196d --- /dev/null +++ b/published/202006/20200525 How to Manipulate an Ethernet Card Using the ethtool Command.md @@ -0,0 +1,304 @@ +[#]: collector: (lujun9972) +[#]: translator: (wxy) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12290-1.html) +[#]: subject: (How to Manipulate an Ethernet Card Using the ethtool Command) +[#]: via: (https://www.2daygeek.com/linux-ethtool-command-view-change-ethernet-adapter-settings-nic-card/) +[#]: author: (Magesh Maruthamuthu https://www.2daygeek.com/author/magesh/) + +如何使用 ethtool 命令管理以太网卡 +====== + +![](https://img.linux.net.cn/data/attachment/album/202006/06/223359syh8n37luz8hhllh.jpg) + +`ethtool` 用于查看和修改网络设备(尤其是有线以太网设备)的驱动参数和硬件设置。你可以根据需要更改以太网卡的参数,包括自动协商、速度、双工和局域网唤醒等参数。通过对以太网卡的配置,你的计算机可以通过网络有效地进行通信。该工具提供了许多关于接驳到你的 Linux 系统的以太网设备的信息。 + +在这篇文章中,我们将告诉你如何更改以下的参数以及如何查看这些参数。这篇文章将帮助你在 Linux 系统中排除与以太网卡相关的问题。 + +下面的信息将帮助你了解以太网卡的工作原理。 + +* **半双工**:半双工模式允许设备一次只能发送或接收数据包。 +* **全双工**:全双工模式允许设备可以同时发送和接收数据包。 +* **自动协商**:自动协商是一种机制,允许设备自动选择最佳网速和工作模式(全双工或半双工模式)。 +* **速度**:默认情况下,它会使用最大速度,你可以根据自己的需要改变它。 +* **链接检测**:链接检测可以显示网卡的状态。如果显示为 `no`,请尝试重启网卡。如果链路检测仍显示 `no`,则检查交换机与系统之间连接的线缆是否有问题。 + +### 如何在 Linux 上安装 ethtool + +默认情况下,大多数系统上应该已经安装了 `ethtool`。如果没有,你可以从发行版的官方版本库中安装。 + +对于 RHEL/CentOS 6/7 系统,请使用 [yum 命令][1] 安装 `ethtool`: + +``` +$ sudo yum install -y ethtool +``` + +对于 RHEL/CentOS 8 和 Fedora 系统,请使用 [dnf 命令][2] 安装 `ethtool`: + +``` +$ sudo yum install -y ethtool +``` + +对于基于 Debian 的系统,请使用 [apt 命令][3] 或 [apt-get 命令][4] 安装 `ethtool`: + +``` +$ sudo apt-get install ethtool +``` + +对于 openSUSE 系统,使用 [zypper 命令][5] 安装 `ethtool`: + +``` +$ sudo zypper install -y ethtool +``` + +对于 Arch Linux 系统,使用 [pacman 命令][6] 安装 `ethtool`: + +``` +$ sudo pacman -S ethtool +``` + +### 如何检查 Linux 上的可用网络接口 + +你可以使用 [ip 命令][7]或 `ifconfig` 命令(在现代发行版中已被淘汰)来验证可用的、活动的网卡的名称和其他细节: + +``` +# ip a +或 +# ifconfig + +1: lo: mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000 + link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00 + inet 127.0.0.1/8 scope host lo + valid_lft forever preferred_lft forever +2: eth0: mtu 1500 qdisc mq state UP group default qlen 1000 + link/ether 00:10:22:35:23:sf brd ff:ff:ff:ff:ff:ff + inet 192.164.23.100/24 brd 192.164.23.255 scope global eth0 + valid_lft forever preferred_lft forever +``` + +### 如何检查 Linux 上的网卡(NIC)信息 + +掌握了以太网卡名称后,就可以使用 `ethtool` 命令轻松查看其详细信息,如下所示。 + +在 Linux 系统中,每个网卡(NIC)都被分配了唯一的名称,如 ethX、enpXXX 等。 + +* 旧的 Linux 发行版使用的是 `eth[X]` 格式。例如,RHEL 6 和它们的旧版本。 +* 现代的 Linux 发行版使用 `enp[XXX]` 或 `ens[XXX]` 格式。例如,大多数现代 Linux 发行版都使用这种格式,包括 RHEL 7、Debian 10、Ubuntu 16.04 LTS。 + +``` +# ethtool eth0 + +Settings for eth0: + Supported ports: [ TP ] + Supported link modes: 1000baseT/Full + 10000baseT/Full + Supported pause frame use: No + Supports auto-negotiation: No + Supported FEC modes: Not reported + Advertised link modes: Not reported + Advertised pause frame use: No + Advertised auto-negotiation: No + Advertised FEC modes: Not reported + Speed: 10000Mb/s + Duplex: Full + Port: Twisted Pair + PHYAD: 0 + Transceiver: internal + Auto-negotiation: off + MDI-X: Unknown + Supports Wake-on: uag + Wake-on: d + Link detected: yes +``` + +### 如何检查以太网卡的驱动程序和固件版本 + +你可以使用 `ethtool` 命令的 `-i` 选项检查驱动程序版本、固件版本和总线的详细信息,如下所示: + +``` +# ethtool -i eth0 + +driver: vmxnet3 +version: 1.4.16.0-k-NAPI +firmware-version: +expansion-rom-version: +bus-info: 0000:0b:00.0 +supports-statistics: yes +supports-test: no +supports-eeprom-access: no +supports-register-dump: yes +supports-priv-flags: no +``` + +### 如何检查网络使用情况统计 + +你可以使用 `ethtool` 命令中的 `-S` 选项来查看网络使用情况统计。它可以显示传输的字节数、接收的字节数、错误数等。 + +``` +# ethtool -S eth0 + +NIC statistics: + Tx Queue#: 0 + TSO pkts tx: 2053 + TSO bytes tx: 7167572 + ucast pkts tx: 4028081 + ucast bytes tx: 399093197 + mcast pkts tx: 0 + mcast bytes tx: 0 + bcast pkts tx: 0 + bcast bytes tx: 0 + pkts tx err: 0 + pkts tx discard: 0 + drv dropped tx total: 0 + too many frags: 0 + giant hdr: 0 + hdr err: 0 + tso: 0 + ring full: 0 + pkts linearized: 0 + hdr cloned: 0 + giant hdr: 0 + Tx Queue#: 1 + TSO pkts tx: 1955 + TSO bytes tx: 6536945 + ucast pkts tx: 3711838 + ucast bytes tx: 346309662 + mcast pkts tx: 0 + mcast bytes tx: 0 + bcast pkts tx: 1186 + bcast bytes tx: 49812 + pkts tx err: 0 + pkts tx discard: 0 + drv dropped tx total: 0 + too many frags: 0 + giant hdr: 0 + hdr err: 0 + tso: 0 + ring full: 0 + pkts linearized: 0 + hdr cloned: 0 + giant hdr: 0 + Rx Queue#: 0 + LRO pkts rx: 0 + LRO byte rx: 0 + ucast pkts rx: 5084776 + ucast bytes rx: 4673133395 + mcast pkts rx: 0 + mcast bytes rx: 0 + bcast pkts rx: 154143 + bcast bytes rx: 45415676 + pkts rx OOB: 0 + pkts rx err: 0 + drv dropped rx total: 0 + err: 0 + fcs: 0 + rx buf alloc fail: 0 + Rx Queue#: 1 + LRO pkts rx: 0 + LRO byte rx: 0 + ucast pkts rx: 6346769 + ucast bytes rx: 4835534292 + mcast pkts rx: 0 + mcast bytes rx: 0 + bcast pkts rx: 3464 + bcast bytes rx: 714646 + pkts rx OOB: 0 + pkts rx err: 0 + drv dropped rx total: 0 + err: 0 + fcs: 0 + rx buf alloc fail: 0 + tx timeout count: 0 +``` + +### 如何改变以太网设备的速度 + +你可以根据需要改变以太网的速度。当你进行此更改时,网卡将自动掉线,你需要使用 [ifup 命令][8] 或 `ip` 命令或 `nmcli` 命令将其重新上。 + +``` +# ethtool -s eth0 speed 100 +# ip link set eth0 up +``` + +### 如何在 Linux 上启用/禁用以太网卡的自动协商? + +你可以使用 `ethtool` 命令中的 `autoneg` 选项启用或禁用自动协商,如下图所示: + +``` +# ethtool -s eth0 autoneg off +# ethtool -s eth0 autoneg on +``` + +### 如何同时更改多个参数 + +如果你想使用 `ethtool` 命令同时更改以太网卡的多个参数,请使用下面的格式: + +``` +Syntax: +ethtool –s [device_name] speed [10/100/1000] duplex [half/full] autoneg [on/off] +``` + +``` +# ethtool –s eth0 speed 1000 duplex full autoneg off +``` + +### 如何检查特定网卡的自动协商、RX 和 TX + +要查看关于特定以太网设备的自动协商等详细信息,请使用以下格式: + +``` +# ethtool -a eth0 +``` + +### 如何从多个设备中识别出特定的网卡(闪烁网卡上的 LED) + +如果你想识别一个特定的物理接口,这个选项非常有用。下面的 `ethtool` 命令会使 `eth0` 端口的 LED 灯闪烁: + +``` +# ethtool -p eth0 +``` + +### 如何在 Linux 中永久设置这些参数 + +在系统重启后,你使用 `ethtool` 所做的更改将被默认恢复。 + +要使自定义设置永久化,你需要更新网络配置文件中的值。根据你的 Linux 发行版,你可能需要将此值更新到正确的文件中。 + +对于基于 RHEL 的系统。你必须使用 `ETHTOOL_OPTS` 变量: + +``` +# vi /etc/sysconfig/network-scripts/ifcfg-eth0 + +ETHTOOL_OPTS="speed 1000 duplex full autoneg off" +``` + +对于基于 Debian 的系统: + +``` +# vi /etc/network/interfaces + +post-up ethtool -s eth0 speed 1000 duplex full autoneg off +``` + +-------------------------------------------------------------------------------- + +via: https://www.2daygeek.com/linux-ethtool-command-view-change-ethernet-adapter-settings-nic-card/ + +作者:[Magesh Maruthamuthu][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.2daygeek.com/author/magesh/ +[b]: https://github.com/lujun9972 +[1]: https://www.2daygeek.com/linux-yum-command-examples-manage-packages-rhel-centos-systems/ +[2]: https://www.2daygeek.com/linux-dnf-command-examples-manage-packages-fedora-centos-rhel-systems/ +[3]: https://www.2daygeek.com/apt-command-examples-manage-packages-debian-ubuntu-systems/ +[4]: https://www.2daygeek.com/apt-get-apt-cache-command-examples-manage-packages-debian-ubuntu-systems/ +[5]: https://www.2daygeek.com/zypper-command-examples-manage-packages-opensuse-system/ +[6]: https://www.2daygeek.com/pacman-command-examples-manage-packages-arch-linux-system/ +[7]: https://www.2daygeek.com/ip-command-configure-network-interface-usage-linux/ +[8]: https://www.2daygeek.com/enable-disable-up-down-nic-network-interface-port-linux-using-ifconfig-ifdown-ifup-ip-nmcli-nmtui/ diff --git a/published/202006/20200525 How to Remove Files Older than N Days Using Tmpwatch-Tmpreaper on Linux.md b/published/202006/20200525 How to Remove Files Older than N Days Using Tmpwatch-Tmpreaper on Linux.md new file mode 100644 index 0000000000..5f0859154c --- /dev/null +++ b/published/202006/20200525 How to Remove Files Older than N Days Using Tmpwatch-Tmpreaper on Linux.md @@ -0,0 +1,182 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12284-1.html) +[#]: subject: (How to Remove Files Older than N Days Using Tmpwatch/Tmpreaper on Linux) +[#]: via: (https://www.2daygeek.com/how-to-remove-files-older-than-n-days-using-tmpwatch-tmpreaper-on-linux/) +[#]: author: (Magesh Maruthamuthu https://www.2daygeek.com/author/magesh/) + +如何使用 Tmpwatch/Tmpreaper 删除旧文件 +====== + +![](https://img.linux.net.cn/data/attachment/album/202006/05/091806zrnwahdl9fdyznrw.jpg) + +你可能忘记了删除计算机上某个目录中不再需要的文件的操作。这可能是“下载”或任何其他目录。它可能已经增长了一段时间。 + +即便有足够的存储空间,你也应该删除它们,因为这会在列出文件时降低系统速度。同样,当一个目录中有成千上万个文件时,它可能很会很臃肿。 + +当你不知道要检查的文件名时,很难在特定目录中找到文件。 + +我们可以通过结合使用 `find` 命令和一些组合来做到这一点,我们过去已经写过一篇文章。 + +* [使用 Bash 脚本在 Linux 中删除早于 “X” 天的文件/文件夹][1] + +今天,我们将向你展示如何在 Linux 上使用 Tmpwatch 程序来实现这一目标。 + +### 什么是 tmpwatch + +`tmpwatch` 会在指定目录中递归删除指定时间段内未被访问的文件。通常,它用于自动清除临时文件系统目录,例如 `/tmp` 和 `/var/tmp`。 + +它只会删除空目录、常规文件和符号链接。它不会切换到其他文件系统,并避开了属于根用户的 `lost+found` 目录。 + +默认情况下,`tmpwatch` 会根据文件的 atime(访问时间)而不是 mtime(修改时间)删除文件。 + +你可以在 `tmpwatch` 命令中添加其他参数来更改这些行为。 + +**警告:** 请不要在 `/` 中运行 `tmpwatch` 或 `tmpreaper`,因为该程序中没有防止这种情况的机制。 + +### 如何在 Linux 上安装 tmpwatch + +可以在官方仓库中按以下方式安装 `tmpwatch`。 + +对于 RHEL/CentOS 6 系统,请使用 [yum 命令][2]安装 `tmpwatch`。 + +``` +$ sudo yum install -y tmpwatch +``` + +对于 Debian 和 Ubuntu 系统,请使用 [apt 命令][3] 或 [apt-get 命令][4] 安装 `tmpreaper`。 + +``` +$ sudo apt-get install tmpreaper +``` + +对于 openSUSE 系统,请使用 [zypper 命令][5] 安装 `tmpwatch`。 + +``` +$ sudo zypper install -y tmpwatch +``` + +对于 Fedora 系统,请使用 [dnf 命令][6] 安装 `tmpwatch`。 + +``` +$ sudo dnf install -y tmpwatch +``` + +**请注意:** 如果你使用的是基于 Debian 的系统,请使用 `tmpreaper` 而不是 `tmpwatch`。所有示例都可以如预期工作。 + +### 了解关键选项和参数 + +* `atime`(文件上次访问时间):显示命令或脚本等任意进程最后一次访问文件中数据的时间。 +* `mtime`(文件上次修改时间):显示修改文件内容或保存文件的时间。除非是更改文件属性,否则大多数情况下 `ctime` 和 `mtime` 会相同。 +* `ctime`(文件上次更改时间):显示文件元数据更改时间。这意味着更改文件属性的时间(如所有权或组等)。 +* `dirmtime`(目录的上次修改时间):显示目录的上一次修改时间。 + +时间参数定义删除文件的阈值。 + +* `d` – 天 +* `h` – 小时 +* `m` – 分钟 +* `s` – 秒 + +### 如何使用 tmpwatch 命令删除一段时间未访问的文件 + +正如我在本文开头所说,`tmpwatch` 默认根据文件访问时间(`atime`)来删除文件。另外,由于小时是默认参数,因此如果使用小时单位,那么无需在时间上添加后缀。 + +例如,运行以下命令以递归方式删除过去 5 个小时未访问的文件。 + +``` +# tmpwatch 5 /tmp +``` + +运行以下命令删除最近 10 个小时未修改的文件。如果要使用修改时间(`mtime`)来删除文件,那么需要在 `tmpwatch` 命令中添加 `-m` 选项。 + +``` +# tmpwatch -m 10 /home/daygeek/Downloads +``` + +### 如何使用 tmpwatch 命令删除超过 “X” 天未访问的文件 + +如果要使用天数删除文件,那么需要添加后缀 `d`。以下示例删除了 30 天以上的文件。 + +``` +# tmpwatch 30d /home/daygeek/Downloads +``` + +### 如何使用 tmpwatch 命令删除一段时间内未访问的所有文件 + +以下命令将基于修改时间(`mtime`)删除所有类型的文件,而不仅仅是常规文件、符号链接和目录。 + +``` +# tmpwatch -am 12 /tmp +``` + +### 如何在 tmpwatch 中排除目录 + +以下命令将删除过去 10 个小时未修改的所有文件,并排除目录。 + +``` +# tmpwatch -am 10 --nodirs /home/daygeek/Downloads +``` + +### 如何在 tmpwatch 中排除特定路径 + +以下命令将删除过去 10 个小时未被修改的所有文件,除了下面排除的文件夹。 + +``` +# tmpwatch -am 10 --exclude=/home/daygeek/Downloads/Movies /home/daygeek/Downloads +``` + +### 如何在 tmpwatch 中排除特定模式 + +以下命令将删除过去 10 小时未被修改的所有文件,除了满足下面列出的模式的文件。 + +``` +# tmpwatch -am 10 --exclude-pattern='*.pdf' /home/daygeek/Downloads +``` + +### 如何让 tmpwatch 命令空运行 + +如果要空运行,请运行以下命令。 + +``` +# tmpwatch -t 5h /home/daygeek/Downloads +``` + +### 如何设置 cronjob 来使用 tmpwatch 定期删除文件 + +默认情况下,它在 `/etc/cron.daily/tmpreaper` 目录下有一个 [cronjob][7] 文件。该 cronjob 根据位于 `/etc/timereaper.conf` 中的配置文件工作。你可以根据需要自定义文件。 + +它每天运行一次,并删除 7 天之前的文件。 + +另外,如果你希望常规执行某项操作,那么可以根据需要手动添加一个 cronjob。 + +``` +# crontab -e + +0 10 * * * /usr/sbin/tmpwatch 15d /home/daygeek/Downloads +``` + +上面的 cronjob 将在每天上午 10 点删除早于 15 天的文件。 + +-------------------------------------------------------------------------------- + +via: https://www.2daygeek.com/how-to-remove-files-older-than-n-days-using-tmpwatch-tmpreaper-on-linux/ + +作者:[Magesh Maruthamuthu][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://www.2daygeek.com/author/magesh/ +[b]: https://github.com/lujun9972 +[1]: https://linux.cn/article-11490-1.html +[2]: https://www.2daygeek.com/linux-yum-command-examples-manage-packages-rhel-centos-systems/ +[3]: https://www.2daygeek.com/apt-command-examples-manage-packages-debian-ubuntu-systems/ +[4]: https://www.2daygeek.com/apt-get-apt-cache-command-examples-manage-packages-debian-ubuntu-systems/ +[5]: https://www.2daygeek.com/zypper-command-examples-manage-packages-opensuse-system/ +[6]: https://www.2daygeek.com/linux-dnf-command-examples-manage-packages-fedora-centos-rhel-systems/ +[7]: https://www.2daygeek.com/linux-crontab-cron-job-to-schedule-jobs-task/ diff --git a/published/202006/20200525 Linux Mint 20- Release Date, Features and Everything Important Associated With it.md b/published/202006/20200525 Linux Mint 20- Release Date, Features and Everything Important Associated With it.md new file mode 100644 index 0000000000..77ec2ec8d7 --- /dev/null +++ b/published/202006/20200525 Linux Mint 20- Release Date, Features and Everything Important Associated With it.md @@ -0,0 +1,120 @@ +[#]: collector: (lujun9972) +[#]: translator: (wxy) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12297-1.html) +[#]: subject: (Linux Mint 20: Release Date, Features and Everything Important Associated With it) +[#]: via: (https://itsfoss.com/linux-mint-20/) +[#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/) + +Linux Mint 20 发布前一窥 +====== + +[Ubuntu 20.04 LTS 版本发布了][1]。这对 Linux Mint 用户来说也是一个好消息。一个新的 Ubuntu LTS 版本意味着新的 Linux Mint 主要版本也将很快随之出现。 + +为什么这么说呢?因为 Linux Mint 是基于 Ubuntu 的长期支持(LTS)版本的。Mint 18 系列是基于 Ubuntu 16.04 LTS,Mint 19 是基于 Ubuntu 18.04 LTS 等等。 + +与 Ubuntu 不同,Linux Mint 没有固定的发布时间表。根据以往的趋势,我可以做出一个明智的猜测,[Linux Mint][2] 20 应该会在今年 6 月发布。 + +### Linux Mint 20 “Ulyana” 即将推出的新功能 + +![][3] + +让我们来看看代号为 Ulyana 的 Linux Mint 20 中提出的一些主要新功能和变化。 + +#### 1. 提高 Nemo 文件管理器的性能 + +Nemo 文件管理器计划中的性能改进之一是它处理缩略图的方式。你可能还没有意识到,但缩略图的生成需要相当多的系统资源(以及磁盘空间)。试着打开一个有几千张图片的文件夹,你会发现 CPU 的消耗会上升。 + +在 Linux Mint 20 中,其目标是优先考虑内容和导航,并尽可能地延迟缩略图的渲染。这意味着在缩略图渲染之前,文件夹的内容会以通用图标显示出来。这不会让人觉得赏心悦目,但你会注意到性能的改善。 + +#### 2. 两种焕然一新的颜色变体 + +默认情况下,Linux Mint 是绿色/薄荷色的风格。还有一些其它的颜色点缀。Linux Mint 20 新添加了两种可爱的的粉红色和青蓝色。 + +以及新的青蓝色风格: + +![Linux Mint Aqua][4] + +这里是新的粉红色风格: + +![Linux Mint Pink][5] + +#### 3. 没有过度偏重于 Snap 包 + +Ubuntu 20.04 将 snap 包的优先级放在了通常的 apt 包之前。事实上,如果你在 Ubuntu 20.04 中使用 `apt` 命令安装 Chromium 浏览器时,它会自动安装 snap 版本。 + +Linux Mint 团队显然对此不满意,他们确认 Mint 20 将不会安装 snaps 或 snapd。它还将禁止 `apt` 使用 snapd。 + +你仍然可以自己手动安装 snap 包。只是不会由 `apt` 来安装它们。 + +#### 4. 有了这个新工具,跨网络共享文件变得很简单。 + +Linux Mint 20 将提供一个[新的 GUI 工具][6],可以轻松地在本地网络上共享文件,而无需任何额外的配置。 + +![New tool for sharing files across the network][7] + +#### 5. 更好地整合了 Electron 应用程序的桌面 + +[Electron][8] 是一个开源框架,它允许使用 Web 技术构建跨平台的桌面应用程序。有些人称它为懒惰的方法,因为应用程序运行在 Chromium 浏览器之上。然而,这可以让开发人员轻松地将他们的应用程序提供给 Linux(和 macOS)。[Linux 上的 Slack][9] 就是众多这样的例子之一。 + +Linux Mint 20 将对 Electron 应用提供更好的支持,并改进系统托盘和桌面通知的集成。 + +#### 6. 改进的支持多显示器的比例缩放功能 + +![improved multi-monitor support][10] + +一个提议的改变是在 Linux Mint 20 中加入支持多显示器的比例缩放功能。如果你有一个 HiDPI 和非 HiDPI 显示器的组合,你可以为它们每一个选择不同的分辨率、刷新率和不同的分数缩放。 + +在 Mint 20 的登录屏幕,可以让你跨多个显示器拉伸显示背景。 + +#### 7. 改进对 Nvidia Optimus 的支持 + +在 Mint 20 中,Nvidia prime 小程序会显示 GPU 渲染器。你也可以直接从系统托盘中的菜单中选择切换到哪块卡。 + +![Switch between GPUs][12] + +你也可以使用 Nvidia “On-Demand” 模式。在这种模式下,将使用英特尔卡来渲染会话。而如视频播放器或视频编辑器这样的兼容应用程序可以在应用程序菜单中打开时使用 Nvidia GPU。 + +![Run an application with NVIDIA GPU][13] + +#### 8. 不再支持 32 位 + +虽然 Ubuntu 18.04 在两年前就放弃了 32 位 ISO,但 Linux Mint 19 系列一直提供 32 位 ISO 的下载和安装。 + +这种情况在 Linux Mint 20 中有所改变。Linux Mint 20 已经没有 32 位版本了。这是因为 32 位支持从 Ubuntu 20.04 中完全消失了。 + +#### 还有什么? + +Cinnamon 4.6 桌面版的发布带来了很多视觉上的变化。 + +在 Ubuntu 20.04 中,应该会有一些“引擎盖下”的变化,比如 Linux Kernel 5.4,取消了 Python 2 的支持,加入 [Wireguard VPN][11] 等。 + +随着开发的进展,我会在本文中更新更多的功能。敬请期待。 + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/linux-mint-20/ + +作者:[Abhishek Prakash][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://itsfoss.com/author/abhishek/ +[b]: https://github.com/lujun9972 +[1]: https://itsfoss.com/ubuntu-20-04-release-features/ +[2]: https://www.linuxmint.com/ +[3]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/04/Linux-Mint-20.png?ssl=1 +[4]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/04/mint-20-aqua.jpg?ssl=1 +[5]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/04/mint-20-pink-1.jpg?ssl=1 +[6]: https://blog.linuxmint.com/?p=3863 +[7]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/04/mint-20-warpinator-1.png?ssl=1 +[8]: https://www.electronjs.org/ +[9]: https://itsfoss.com/slack-use-linux/ +[10]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/04/monitor_display_Linux_mint_20.png?ssl=1 +[11]: https://itsfoss.com/wireguard/ +[12]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/06/nvidia-prime-applet-linux-mint-20.png?w=386&ssl=1 +[13]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/06/nvidia-on-deman-feature-linux-mint-20.png?w=526&ssl=1 diff --git a/published/202006/20200525 Track Your Screen Time in Linux with ActivityWatch.md b/published/202006/20200525 Track Your Screen Time in Linux with ActivityWatch.md new file mode 100644 index 0000000000..e1b6cd5fa1 --- /dev/null +++ b/published/202006/20200525 Track Your Screen Time in Linux with ActivityWatch.md @@ -0,0 +1,129 @@ +[#]: collector: (lujun9972) +[#]: translator: (wxy) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12302-1.html) +[#]: subject: (Track Your Screen Time in Linux with ActivityWatch) +[#]: via: (https://itsfoss.com/activitywatch/) +[#]: author: (Ankush Das https://itsfoss.com/author/ankush/) + +使用 ActivityWatch 跟踪你在 Linux 中的屏幕使用时间 +====== + +![](https://img.linux.net.cn/data/attachment/album/202006/10/104854yumcnhp8smmjxcht.jpg) + +> ActivityWatch 是一款开源的隐私友好型应用程序,可追踪你在台式电脑或移动设备上的使用时间。 + +### ActivityWatch: 一个追踪你在哪个应用程序上花了多少时间的开源应用程序 + +![ActivityWatch lets you check the time spent on various applications][1] + +[ActivityWatch][2] 是一款跨平台的开源应用,可以帮助你追踪使用时间,衡量你的工作效率。它可以追踪你花在应用程序、浏览器上的时间,以及你是否 AFK(远离键盘)或系统处于休眠状态。 + +不只是追踪时间,它还提供了一堆有用的功能,通过可视化的方式帮助你轻松分析你是如何花费时间的,从而有可能提高你的生产力。 + +![][3] + +它是 [RescueTime][4] 和 [ManicTime][5] 等专有产品的绝佳替代品。 + +ActivityWatch 可用于 Linux、Windows、macOS 和 [Android][6]。它还提供了 Chrome 和 Firefox 的浏览器扩展。截至目前,App Store 上还没有它的 iOS 版应用。 + +![][7] + +它刚刚进入该领域,正在积极开发,以解决任何现有的问题并引入新的功能,如在多个设备上同步你的活动数据的能力。 + +**对于注重隐私的用户来说,我应该提到,收集的数据被存储在你本地的设备上。这是一件好事,因为你可以跟踪你的花费时间,而不会被别人跟踪。** + +### ActivityWatch 的功能 + +![][8] + +基本上,ActivityWatch 可以让你监控你的活动,以分析不良的屏幕使用时间,或改善你在设备上工作的时间管理。 + +具体来说,它提供了几个有用的功能,主要有: + +* 摘要你的日常活动及按使用时间排序的应用和程序列表。 +* 追踪你的浏览器活动的时间,使用浏览器扩展来获得每个活动标签所花费时间的确切数据。 +* 追踪 AFK 和非 AFK 时间。(AFK - “Away From Keyboard” 的缩写,即不在电脑前) +* 提供不同的可视化时间线,以监测你的活动。 +* 能够使用 [watchers][9] 跟踪你在编辑器上写代码的时间。 +* 记录你的活动,以分析你的生产力。 +* 将花费的时间进行分类,可以帮助你详细分析。 +* 可以添加更多的类别和调整时间轴的持续时长。 +* 能够将数据导出/导入为 [JSON][10] 文件。 +* 实验性的秒表功能。 +* 本地存储数据,以尊重用户隐私。 + +### 在 Linux 上安装 ActivityWatch + +> 注:如果你的 Linux 发行版不支持系统托盘图标,你需要遵循这个[文档][11]来解决这个问题。 + +不幸的是,你找不到 AppImage、Flatpak 或 Snap 软件包。然而,对于 Manjaro 或 Arch Linux 有可以安装的 [AUR][12] 包。 + +对于所有其它的 Linux 发行版,你会得到一个 ZIP 文件,其中包括一个要运行的 `aw-qt` 应用程序。 + +要运行它,你需要[解压 zip 归档文件][13],然后通过双击 `aw-qt` 应用程序运行二进制文件来安装它。 + +![Aw Qt][14] + +你也可以使用终端: + +``` +cd activitywatch-v0.9.2-linux-x86_64 +sudo ./aw-qt +``` + +解压文件夹的位置和文件名可能会有所不同 —— 所以请确保你导航到正确的目录,然后使用上面的命令。完成后,你可以从系统托盘图标访问 ActivityWatch,或者直接前往 [localhost:5600][15] 访问它。 + +你也可以查看他们的 [GitHub 页面][16]或[官方网站][2]来探索更多关于它的信息。 + +- [下载 ActivityWatch][2] + +顺便提一句,如果你计划经常使用 ActivityWatch,你应该将下载的文件移动到 `/opt` 目录下,并在 `/usr/share/bin` 目录下创建一个链接到 `aw-qt` 可执行文件符号链接。这样一来,该应用程序可以作为一个常规命令供系统上的所有用户使用。类似的方法在 [PopcornTime 安装教程][17]中也有演示。 + +### 我对 ActivityWatch 的看法 + +![][18] + +在 [Pop!_OS 20.04][19] 上,时间跟踪功能可以完全正常地工作,也支持系统托盘图标。你可能会遇到一个错误,不能让你从系统托盘图标访问 ActivityWatch(这也是一个 [GitHub 上的已知问题][20])。在这种情况下,你需要通过 [localhost:5600][15] 来访问它。 + +就个人而言,考虑到我在桌面上使用它,并且没有计划在智能手机上使用它,我对提供的功能相当满意。 + +我必须得向你推荐尝试这个不错的开源项目,并一路支持他们。如果你喜欢这个项目,请随时通过添加星标或赞助[他们的 GitHub 仓库][21]来表示你的赞赏。 + +欢迎在下面的评论中告诉我你的想法。 + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/activitywatch/ + +作者:[Ankush Das][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://itsfoss.com/author/ankush/ +[b]: https://github.com/lujun9972 +[1]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/05/activitywatch.png?fit=800%2C607&ssl=1 +[2]: https://activitywatch.net/ +[3]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/05/activitywatch-afk.jpg?ssl=1 +[4]: https://itsfoss.com/recommends/rescuetime/ +[5]: https://www.manictime.com/ +[6]: https://play.google.com/store/apps/details?id=net.activitywatch.android +[7]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/05/activitywatch-timeline.jpg?ssl=1 +[8]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/05/activitywatch-settings.jpg?ssl=1 +[9]: https://docs.activitywatch.net/en/latest/watchers.html +[10]: https://en.wikipedia.org/wiki/JSON +[11]: https://docs.activitywatch.net/en/latest/getting-started.html +[12]: https://aur.archlinux.org/packages/activitywatch-bin/ +[13]: https://itsfoss.com/unzip-linux/ +[14]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/05/aw-qt.jpg?ssl=1 +[15]: https://itsfoss.com/activitywatch/5600 +[16]: https://github.com/ActivityWatch +[17]: https://itsfoss.com/popcorn-time-ubuntu-linux/ +[18]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/05/activitywatch-screenshot.jpg?ssl=1 +[19]: https://itsfoss.com/pop-os-20-04-review/ +[20]: https://github.com/ActivityWatch/activitywatch/issues/208 +[21]: https://github.com/ActivityWatch/activitywatch diff --git a/published/202006/20200525 Ubuntu Budgie 20.04 Review- Smooth, Polished - Plenty of Changes.md b/published/202006/20200525 Ubuntu Budgie 20.04 Review- Smooth, Polished - Plenty of Changes.md new file mode 100644 index 0000000000..26bcd153cd --- /dev/null +++ b/published/202006/20200525 Ubuntu Budgie 20.04 Review- Smooth, Polished - Plenty of Changes.md @@ -0,0 +1,165 @@ +[#]: collector: (lujun9972) +[#]: translator: (wxy) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12354-1.html) +[#]: subject: (Ubuntu Budgie 20.04 Review: Smooth, Polished & Plenty of Changes) +[#]: via: (https://itsfoss.com/ubuntu-budgie-20-04-review/) +[#]: author: (John Paul https://itsfoss.com/author/john/) + +Ubuntu Budgie 20.04 LTS:平滑、精致和丰富的变化 +====== + +正如我们向读者承诺的那样,我们将对 [Ubuntu 20.04 LTS 版本][1]的所有主要特色版进行评测。在这个续篇中,我们将对 Ubuntu Budgie 进行评测。 + +![Ubuntu Budgie Desktop][2] + +顾名思义,[Ubuntu Budgie][3] 是使用 [Budgie 桌面环境][5]的 [Ubuntu 官方特色版][4]。这个版本是 Ubuntu 家族中较新的一位成员。Ubuntu Budgie 的第一个版本是 16.04,它在 17.04 版本时被接受为官方特色版。 + +他们的[目标][6]是“结合 Budgie 界面的简洁和优雅,以生产具有现代范式的面向桌面的传统发行版。” + +### Ubuntu Budgie 20.04 评测:哪些改变了,哪些没有! + +[自 18.04 LTS 发布以来,Ubuntu Budgie][7] 有了令人惊讶的更新和改进: + + * 苹果风格的新菜单 + * 默认采用基于 Budgie 的网络管理小程序 + * 新的 Window Shuffler 允许你通过快捷键平铺应用程序 + * 快速切换桌面布局的新工具 + * 支持 4k 分辨率 + * 新的默认应用程序:GNOME Firmware 和 Drawing + * 现在已经为 20.04 重构了向后移植包 + * 默认浏览器是火狐 + * 默认使用 Catfish 搜索文件和文本 + * 在 Budgie 中集成了 Nemo 文件管理器 + * 由于错误,系统托盘小程序被移除了 + * 默认情况下,事件警报声被禁用 + * 修复了键盘快捷键神秘失踪的问题 + * 更好的锁屏样式 + * 由于社区的需求,文件应用 Nautilus 已被 Nemo 取代 + * Plank 坞站现在已经切换到屏幕底部,是透明的,并且默认有弹跳动画 + * 快速笔记和热角小程序已从 Python 移植到 Vala,以提高速度 + * Celluloid 取代了 MPV + * 更新了 GNOME 的依赖性 + +![][8] + +Ubuntu Budgie 现在随附了 Budgie 桌面环境的最新版本(10.5.1)。改进包括: + + * 在 Budgie 桌面设置中新增 Raven 部分 + * Raven 通知可以分组,通知可以关闭 + * 重新打造了图标任务列表 + * 能够设置虚拟桌面的数量 + +Ubuntu Budgie 自带了大量的 Budgie 小程序applet微应用min-app。它们可以通过 Ubuntu Budgie “欢迎”应用来安装。 + +![Ubuntu Budgie Welcome][9] + + * WeatherShow:显示未来五天的天气预报,每 3 小时更新一次 + * Wallstreet:一个可以循环展示你的图像文件夹中的壁纸工具 + * Visual-space:一个紧凑的工作区切换器 + * Dropby:这个小程序可让你在面板上快速管理 U 盘 + * Kangaroo:从面板上快速浏览文件夹 + * 垃圾桶小程序:管理你的垃圾桶 + * Fuzzyclock:以模糊的方式显示时间 + * 工作区秒表:允许你跟踪在每个工作区花费的时间 + +完整的变更和更新列表,请访问[变更日志][10]。 + +#### 系统要求 + +Ubuntu Budgie 20.04 更新了[系统要求][11]: + + * 4GB 或以上的内存 + * 64 位的 Intel 和 AMD 处理器 + * 在 CSM 模式下启动的 UEFI 电脑 + * 基于英特尔的现代苹果电脑 + +如你所见,Budgie 并不是一个真正的轻量级选择。 + +#### 安装的应用 + +![][12] + +Ubuntu Budgie 中默认包含了以下有用的应用程序: + + * AisleRiot Solitaire + * Geary + * Catfish 搜索工具 + * Cheese 网络摄像头工具 + * GNOME Drawing + * GNOME 2048 + * GNOME Mahjongg + * GNOME Mines + * GNOME Sudoku + * Gthumb + * LibreOffice + * Maps + * Rhythmbox + * Tilix + * Ubuntu Budgie 欢迎应用 + * Evince 文档查看器 + * Plank + * Celluloid + +![Ubuntu Budgie Ram Usage][13] + +### 安装 + +起初,我无法让 Ubuntu Budgie 进入即用live环境来安装它。结果发现 Ubuntu Budgie 试图通过 EFI 来启动,我从 [Ubuntu Budgie 论坛][14]得到了解决方案。 + +当出现紫色的闪屏时,我必须按下 `ESC` 键并选择 `legacy`。之后,它就如常启动了,安装也没有问题了。我只在 Ubuntu Budgie 上遇到过这个问题。我下载并尝试了 Ubuntu MATE 20.04 ISO,但没有遇到类似的问题。 + +### Ubuntu Budgie 20.04 的体验 + +![][15] + +除了这个安装上的小问题,我使用 Ubuntu Budgie 的体验非常愉快。自 [Ikey][16] 第一次创建 Budgie 桌面以来,Budgie 桌面已经进步了很多,并且已经成为一个非常成熟的选择。Ubuntu Budgie 的目标是“生产一个面向桌面的传统发行版”。它确实做到了极致。他们所做的所有改变都在不断地为他们的产品增添更多的光彩。 + +总的来说,Ubuntu Budgie 是一个非常漂亮的发行版。从默认的主题到壁纸选择,你可以看出他们付出了很多努力,视觉体验非常吸引人。 + +需要注意的是,Ubuntu Budgie 并不适合低配置的系统。我在戴尔 Latitude D630 上运行它。在没有打开任何应用程序的情况下,它使用了大约 700MB 的内存。 + +在 Ubuntu Budgie 中,让我喜欢的部分超乎我的预期,其中一个部分是 [Tilix 终端模拟器][17]。Tilix 允许你在右侧或下方添加终端窗口。它有很多很多功能,我简直爱死了它,我打算在我的其他 Linux 系统上也安装它。 + +### 关于 Ubuntu Budgie 20.04 的最后感想 + +Ubuntu Budgie 是众多官方版本中一个很受欢迎的新版本。Budgie 给人的感觉非常流畅和精致。它不会让你觉得碍手碍脚,而是帮你完成工作。 + +如果你厌倦了当前的桌面环境,想体验一下新的东西,不妨来看看。如果你对当前的环境感到满意,那么就试试 Ubuntu Budgie 的即用 DVD。你可能会喜欢上它。 + +![关于 Ubuntu Budgie][18] + +你是否已经尝试过 Ubuntu 20.04 Budgie?你对它的使用体验如何?如果没有用过,你现在使用的是哪个版本的 Ubuntu 20.04? + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/ubuntu-budgie-20-04-review/ + +作者:[John Paul][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://itsfoss.com/author/john/ +[b]: https://github.com/lujun9972 +[1]: https://itsfoss.com/download-ubuntu-20-04/ +[2]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/05/ubuntu-busgie-desktop.png?resize=800%2C500&ssl=1 +[3]: https://ubuntubudgie.org/ +[4]: https://itsfoss.com/which-ubuntu-install/ +[5]: https://en.wikipedia.org/wiki/Budgie_ +[6]: https://ubuntubudgie.org/about-us/ +[7]: https://itsfoss.com/ubuntu-budgie-18-review/ +[8]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/05/ubuntu-budgie-desktop-settings.jpeg?ssl=1 +[9]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/05/ubuntu-budgie-welcome.png?resize=800%2C472&ssl=1 +[10]: https://ubuntubudgie.org/2020/04/21/ubuntu-budgie-20-04lts-release-notes-for-18-04-upgraders/ +[11]: https://ubuntubudgie.org/downloads/ +[12]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/05/ubuntu-budgie-applications.jpeg?ssl=1 +[13]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/05/ubuntu-budgie-ram-usage.png?resize=800%2C600&ssl=1 +[14]: https://discourse.ubuntubudgie.org/t/cant-get-ub-to-boot/3397 +[15]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/05/ubuntu-budgie-20-04.jpg?ssl=1 +[16]: https://itsfoss.com/ikey-doherty-serpent-interview/ +[17]: https://gnunn1.github.io/tilix-web/ +[18]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/05/ubuntu-budgie-about.png?resize=800%2C648&ssl=1 diff --git a/published/202006/20200525 Ubuntu MATE 20.04 LTS Review- Better Than Ever.md b/published/202006/20200525 Ubuntu MATE 20.04 LTS Review- Better Than Ever.md new file mode 100644 index 0000000000..86e6a6c6d2 --- /dev/null +++ b/published/202006/20200525 Ubuntu MATE 20.04 LTS Review- Better Than Ever.md @@ -0,0 +1,171 @@ +[#]: collector: (lujun9972) +[#]: translator: (robsean) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12341-1.html) +[#]: subject: (Ubuntu MATE 20.04 LTS Review: Better Than Ever) +[#]: via: (https://itsfoss.com/ubuntu-mate-20-04-review/) +[#]: author: (Ankush Das https://itsfoss.com/author/ankush/) + +Ubuntu MATE 20.04 LTS:士别三日,当刮目相待 +====== + +Ubuntu MATE 20.04 LTS 无疑是最流行的 [Ubuntu 官方特色版本][1]之一。 + +不仅仅是我,这份[Ubuntu 20.04 调查报告][2]也持同样观点。不过不管流行与否,它都是一个令人印象深刻的 Linux 发行版,尤其是用在较旧的硬件上时。事实上,它也是可用的[最轻量的 Linux 发行版][3]之一。 + +所以,我想在一个虚拟机中尝试一下,为你提供一个概览,这样你可以了解其中有何值得期盼的变化,以及是否值得尝试。 + +### 在 Ubuntu MATE 20.04 LTS 中有什么新功能? + +- [video](https://www.youtube.com/embed/WBZyXDHw4HA) + +Ubuntu MATE 20.04 LTS 的主要亮点应该是增加了 MATE Desktop 1.24。 + +你可以期待 MATE Desktop 1.24 中的所有新特色都被打包到 Ubuntu MATE 20.04 中。除此之外,还有很多重要的变化、改进和增补。 + +这是 Ubuntu MATE 20.04 中变化的概述: + + * 新增 MATE Desktop 1.24 + * 大量视觉改进 + * 数十处错误修复 + * 基于 [Linux 内核 5.4][5] 系列 + * 添加了实验性的 [ZFS][6] 支持 + * 添加了来自 [Feral Interactive][7] 的 GameMode + * 一些软件包更新 + +现在,为了更好地了解 Ubuntu MATE 20.04,我将给你提供更多的细节。 + +### 用户体验改善 + +![][8] + +考虑到越来越多的用户倾向于在桌面上使用 Linux,而用户体验在桌面中起着至关重要的作用。 + +如果有一些易于使用和令人愉悦的东西,那么第一印象就会有很大不同。 + +对于 Ubuntu MATE 20.04 LTS,我没有感到失望。就我个人而言,我是最新的 [GNOME 3.36][9] 的粉丝。我喜欢在我 [Pop!_OS 20.04][10] 上使用它,但是随着 [MATE 1.24][11] 的出现,使得 Ubuntu MATE 也同样具有很好的体验。 + +你会看到窗口管理器有一些重大更改,包括:增加了用于重新调整大小的隐形边框,HiDPI 图标渲染,重新设计了 `ALT+TAB` 工作区切换器的弹出窗口和一些其它的更改,这些是最新的 MATE 1.24 桌面环境的一部分。 + +![][12] + +此外, MATE Tweak 也得到了一些贴心的改进,即使你更改桌面的布局,也可以保留用户偏好。新的 MATE 欢迎屏幕也会告知用户更改桌面布局的能力,因此,用户无需不断摸索就能知道这个变化。 + +此外,我最喜欢的新增功能之一是可以预览最小化的应用程序。 + +例如,你已经最小化了一个应用程序,但是你想在拉起它之前看到它的预览 —— 现在你只需将鼠标悬停在任务栏上就可以做到这一点,如下图所示: + +![][13] + +不过,我必须指出,并不是每个应用程序都可以如预期般的工作。因此,这个功能是有缺陷的,还需要改进。 + +### 应用程序新增或升级 + +![][14] + +在 MATE 20.04 中,你会注意到有一个新的固件更新器,它是 [fwupd][15] 的 GTK 前端。你可以使用这个更新器来轻松地管理你的固件驱动。 + +这个版本也使用 Evolution 替换了 Thunderbird 电子邮件客户端。尽管 [Thunderbird][16] 是一个非常流行的电子邮件客户端,但是 [Evolution][17] 与 MATE 桌面集成得更好,并且证明它更有用。 + +![][18] + +考虑到我们已经搭载了 MATE 1.24,你也将发现一个新的时间和日期管理应用程序。不仅如此,如果你需要一个放大镜,Ubuntu MATE 20.04 还内置了 [Magnus][19]。 + +![][20] + +Ubuntu MATE 20.04 也包括了众多预安装的软件包/应用程序的升级包。 + +![][21] + +尽管这些是小的增补,但却能在很大程度上帮助发行版变得更有用。 + +### Linux Kernel 5.4 + +Ubuntu MATE 20.04 带有 2019 年最后一个主要的稳定版内核,即 [Linux 内核 5.4][5]。 + +使用该内核,你可以获得原生的 [exFAT 支持][22]、改进的硬件支持。更不用说,拥有 [WireGuard][23] VPN 的支持也是一件极好的事。 + +所以,你会注意到 Linux Kernel 5.4 的众多好处,包括内核锁定功能。如果你好奇,你可以阅读我们关于 [Linux Kernel 5.4][5] 的新闻报道来了解更多的细节。 + +### 增加了 Feral Interactive 的 GameMode + +以将游戏带到 Linux 平台而闻名的 Feral Interactive 带来了一款实用的命令行工具,即 [GameMode][7]。 + +它没有提供图形界面,但是在启动一个游戏前,你可以使用命令行请求临时性的系统优化。 + +虽然这可能不会给每个系统都带来很大的不同,而是给玩游戏提供了更多的资源,并且 GameMode 可以确保你获得必要的优化。 + +### 实验性的 ZFS 安装选项 + +你可以使用 ZFS 作为根文件系统了。值得注意的是,它是一个实验性的功能,如果你不确定自己在做什么,那么就不应该使用它。 + +要更好地了解 ZFS,我建议你阅读我们的一篇文章,[John Paul][24] 所写的《[ZFS 是什么][6]》的文章。 + +### 性能和其它的改进 + +Ubuntu MATE 是一款完美的轻量级发行版,同时也是一款适合现代台式机的发行版。 + +![][25] + +在这个评测中,我没有运行任何特殊的基准测试工具,以一个普通用户来说,我在虚拟机设置中没有发现任何性能问题。我在一台使用了一颗 i5-7400 处理器、配备 GTX 1050 显卡和 16 GB 内存的主机系统上进行了测试。并且,我将 7 GB 的内存 + 768 MB 的显存 + 2 个处理器核心分配给了虚拟机。 + +![][26] + +如果你要自己测试它,请随时告诉我你对它的感觉如何。 + +总的来说,除了所有主要的改进之外,还有一些细微的改变/修复/改进,使得 Ubuntu MATE 20.04 LTS 成为了一个很好的升级版本。 + +### 我应该升级吗? + +如果你正在运行 Ubuntu MATE 19.10,你应该立即升级它,因为它的支持将在 2020 年 6 月结束。 + +对于 Ubuntu MATE 18.04 用户(支持到 2021 年 4 月)来说,这取决于你的需求。如果你需要最新发布版本的功能,你应该选择立即升级它。 + +但是,如果你不一定需要新的功能,你可以查看[现存的错误列表][27] 并加入 [Ubuntu MATE 社区][28] 来了解更多最新发布版本的问题。 + +在你做完必要的研究后,你可以继续升级你的系统到 Ubuntu MATE 20.04 LTS,它将支持到 2023 年 4 月。 + +你试过最新的 Ubuntu MATE 20.04 吗?你认为它怎么样?在评论中让我知道。 + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/ubuntu-mate-20-04-review/ + +作者:[Ankush Das][a] +选题:[lujun9972][b] +译者:[robsean](https://github.com/robsean) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://itsfoss.com/author/ankush/ +[b]: https://github.com/lujun9972 +[1]: https://itsfoss.com/which-ubuntu-install/ +[2]: https://ubuntu.com/blog/ubuntu-20-04-survey-results +[3]: https://itsfoss.com/lightweight-linux-beginners/ +[4]: https://www.youtube.com/c/itsfoss?sub_confirmation=1 +[5]: https://itsfoss.com/linux-kernel-5-4/ +[6]: https://itsfoss.com/what-is-zfs/ +[7]: https://github.com/FeralInteractive/gamemode +[8]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/04/ubuntu-mate-20-04.jpg?ssl=1 +[9]: https://itsfoss.com/gnome-3-36-release/ +[10]: https://linux.cn/article-12175-1.html +[11]: https://mate-desktop.org/blog/2020-02-10-mate-1-24-released/ +[12]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/04/ubuntu-mate-desktop-layout.png?ssl=1 +[13]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/04/ubuntu-mate-minimized-app.png?ssl=1 +[14]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/04/ubuntu-mate-20-04-firmware.png?ssl=1 +[15]: https://fwupd.org +[16]: https://www.thunderbird.net/en-US/ +[17]: https://wiki.gnome.org/Apps/Evolution +[18]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/04/ubuntu-mate-evolution.png?ssl=1 +[19]: https://kryogenix.org/code/magnus/ +[20]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/04/ubuntu-mate-magnus.jpg?ssl=1 +[21]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/04/ubuntu-mate-apps.png?ssl=1 +[22]: https://cloudblogs.microsoft.com/opensource/2019/08/28/exfat-linux-kernel/ +[23]: https://wiki.ubuntu.com/WireGuard +[24]: https://itsfoss.com/author/john/ +[25]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/04/ubuntu-mate-system-reosource.jpg?ssl=1 +[26]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/04/ubuntu-mate-focal-neofetch.png?ssl=1 +[27]: https://bugs.launchpad.net/ubuntu-mate +[28]: https://ubuntu-mate.community/ diff --git a/published/202006/20200527 How to Format a USB Disk as exFAT on Linux -Graphically and Command Line.md b/published/202006/20200527 How to Format a USB Disk as exFAT on Linux -Graphically and Command Line.md new file mode 100644 index 0000000000..9252d16b1c --- /dev/null +++ b/published/202006/20200527 How to Format a USB Disk as exFAT on Linux -Graphically and Command Line.md @@ -0,0 +1,121 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12294-1.html) +[#]: subject: (How to Format a USB Disk as exFAT on Linux [Graphically and Command Line]) +[#]: via: (https://itsfoss.com/format-exfat-linux/) +[#]: author: (Dimitrios Savvopoulos https://itsfoss.com/author/dimitrios/) + +如何在 Linux 上将 USB 盘格式化为 exFAT +====== + +> 本教程教你如何在 Linux 系统上以 exFAT 格式格式化 USB 盘。同时包括 GUI 和命令行两种方法。 + +长期以来,[FAT][1] 是用于格式化磁盘文件系统的默认选择。它与几乎所有主要操作系统兼容。 + +FAT 文件系统的一个主要问题是你不能传输大于 4GB 的文件。这意味着即使你的 USB 盘有 32GB 的可用空间,如果你尝试传输 ISO 镜像或其他大于 4GB 的文件,传输也会失败。 + +这会[在 Linux 中创建 Windows 的可启动 USB 盘][2]的情况下造成问题。你不能使用 [NTFS][3],并且 FAT 文件系统有 4GB 的大小限制。 + +为了克服 FAT 文件系统的限制,微软推出了 [exFAT 文件系统][4]。在本教程中,我将向你展示如何使用 exFAT 文件系统中格式化 USB 盘。 + +### 先决条件 + +从 [Linux kernel 5.4][7] 开始,Linux 内核本身中启用了 exFAT 文件系统支持。[检查正在运行的 Linux 内核版本][8]。如果是内核 5.4 或更高版本,那么应该没问题。 + +不然,你必须[启用 exFAT 支持][9]。在基于 Ubuntu 的发行版中,你可以安装以下软件包: + +``` +sudo apt install exfat-fuse exfat-utils +``` + +### 方法 1:使用 GNOME 磁盘工具将磁盘格式化为 exFAT + +![][10] + +使用 “[GNOME 磁盘][11]” 格式化驱动器是一项简单的工作。它预装在许多 Linux 发行版中。 + +插入外部 USB 盘。在菜单中查找 “Disk”,然后打开 “GNOME 磁盘” 应用。第一步,选择要格式化的驱动器,然后按照我的步骤操作。 + +**警告:请注意你要选择格式化的磁盘。请勿意外格式化主磁盘。** + +![][12] + +诸如 Ext4、NTFS、FAT 之类的常用文件系统将首先出现。要使用 exFAT,请选择 “其它”,然后单击 “下一步”。 + +![][13] + +最后一步:在此页面上选择 exFAT 文件系统,然后单击 “创建”。完成了! + +![][14] + +看到在 Linux 中以图形方式创建 exFAT 磁盘有多么容易了吧?现在,让我向你展示终端方法。 + +### 方法 2:在 Linux 命令行中将磁盘格式化为 exFAT(适用于高级用户) + +[fdisk][15] 是一个交互式命令行程序,它可在硬盘上创建和操作分区表和分区。实际上,它被认为是 [Linux 最佳分区工具][16]之一。 + +插入外部硬盘,然后在终端中输入以下命令: + +``` +sudo fdisk -l +``` + +![][17] + +这将列出计算机中的所有硬盘和分区。识别出要在外部硬盘上格式化的分区。应该会提示磁盘大小。对我而言,USB 盘被标记为 `/dev/sdb1`。 + +识别出 USB 盘后,请使用以下命令将它格式化为 exfat。将 `/dev/sdXn` 替换为你的磁盘 ID。`LABEL` 是你要为磁盘命名的名称,例如 `Data`、`MyUSB` 等。 + +``` +sudo mkfs.exfat -n LABEL /dev/sdXn +``` + +![][18] + +可选地,运行 `fsck` 检查,以确保格式化正确。 + +``` +sudo fsck.exfat /dev/sdXn +``` + +就是这样。享受 exFAT 盘吧。 + +### 你是否成功创建了exFAT 盘? + +我希望你觉得本教程足够简单,并建立坚实的分区知识基础的第一步。 + +从长远来看,有时简单易用的技巧将让你拥有一个更好的 Linux。 + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/format-exfat-linux/ + +作者:[Dimitrios Savvopoulos][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://itsfoss.com/author/dimitrios/ +[b]: https://github.com/lujun9972 +[1]: https://en.wikipedia.org/wiki/File_Allocation_Table +[2]: https://itsfoss.com/bootable-windows-usb-linux/ +[3]: https://en.wikipedia.org/wiki/NTFS +[4]: https://en.wikipedia.org/wiki/ExFAT +[5]: tmp.YPwoWNgq9W#graphical-method +[6]: tmp.YPwoWNgq9W#command-line +[7]: https://itsfoss.com/linux-kernel-5-4/ +[8]: https://itsfoss.com/find-which-kernel-version-is-running-in-ubuntu/ +[9]: https://itsfoss.com/mount-exfat/ +[10]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/05/format-exfat-linux.jpg?ssl=1 +[11]: https://wiki.gnome.org/Apps/Disks +[12]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/05/1.-gnome-disks-2.png?ssl=1 +[13]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/05/2.-gnome-disks.jpg?ssl=1 +[14]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/05/3.-gnome-disks.jpg?ssl=1 +[15]: https://www.tldp.org/HOWTO/Partition/fdisk_partitioning.html +[16]: https://itsfoss.com/partition-managers-linux/ +[17]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/05/sudo-fdisk-l-1.jpg?ssl=1 +[18]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/05/sdXn.jpg?ssl=1 diff --git a/published/202006/20200528 Simplify data visualization in Python with Plotly.md b/published/202006/20200528 Simplify data visualization in Python with Plotly.md new file mode 100644 index 0000000000..870947b3e2 --- /dev/null +++ b/published/202006/20200528 Simplify data visualization in Python with Plotly.md @@ -0,0 +1,353 @@ +[#]: collector: (lujun9972) +[#]: translator: (MjSeven) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12356-1.html) +[#]: subject: (Simplify data visualization in Python with Plotly) +[#]: via: (https://opensource.com/article/20/5/plotly-python) +[#]: author: (Shaun Taylor-Morgan https://opensource.com/users/shaun-taylor-morgan) + +使用 Plotly 来简化 Python 中的数据可视化 +====== + +> Plotly 是一个数据绘图库,具有整洁的接口,它旨在允许你构建自己的 API。 + +![](https://img.linux.net.cn/data/attachment/album/202006/27/215314y0rkrz0e9zw7wd2o.jpg) + +Plotly 是一个绘图生态系统,可以让你在 [Python][2] 以及 JavaScript 和 R 中进行绘图。在本文中,我将重点介绍[使用 Python 库进行绘图][3]。 + +Plotly 有三种不同的 Python API,你可以选择不同的方法来使用它: + + * 类似于 Matplotlib 的面向对象的 API + * 数据驱动的 API,通过构造类似 JSON 的数据结构来定义绘图 + * 类似于 Seaborn 的高级绘图接口,称为 “Plotly Express” API + +我将通过使用每个 API 来绘制相同的图来探索它们:英国大选结果的分组柱状图。 + +在我们进一步探讨之前,请注意,你可能需要调整你的 Python 环境来让这段代码运行,包括以下内容: + +- 运行最新版本的Python([Linux][4]、[Mac][5] 和 [Windows][6] 的说明) +- 确认你运行的 Python 版本能与这些库一起工作 + +数据可在线获得,可以用 Pandas 导入。 + +``` +import pandas as pd +df = pd.read_csv('https://anvil.works/blog/img/plotting-in-python/uk-election-results.csv') +``` + +现在我们可以继续进行了。 + +### 使用图对象来绘制图 + +Plotly 面向对象的 API 被称为 `graph_objects`,它有点类似于 [Matplotlib 的面向对象 API][7]。 + +要创建一个柱状图,你可以构造一个包含四个柱状图的对象: + +``` +# 导入 Plotly 和数据 +import plotly.graph_objects as go +from votes import wide as df + +# 得到 x 列表 +years = df['year'] +x = list(range(len(years))) + +# 定义绘图 +bar_plots = [ +  go.Bar(x=x, y=df['conservative'], name='Conservative', marker=go.bar.Marker(color='#0343df')), +  go.Bar(x=x, y=df['labour'], name='Labour', marker=go.bar.Marker(color='#e50000')), +  go.Bar(x=x, y=df['liberal'], name='Liberal', marker=go.bar.Marker(color='#ffff14')), +  go.Bar(x=x, y=df['others'], name='Others', marker=go.bar.Marker(color='#929591')), +] + +# 指定样式 +layout = go.Layout( +  title=go.layout.Title(text="Election results", x=0.5), +  yaxis_title="Seats", +  xaxis_tickmode="array", +  xaxis_tickvals=list(range(27)), +  xaxis_ticktext=tuple(df['year'].values), +) +    +# 绘制柱状图 +fig = go.Figure(data=bar_plots, layout=layout) + +# 告诉 Plotly 去渲染 +fig.show() +``` + +与 Matplotlib 不同的是,你无需手动计算柱状图的 `x` 轴位置,Plotly 会帮你适配。 + +最终结果图: + +![A multi-bar plot made using Graph Objects][8] + +*A multi-bar plot made using Graph Objects (© 2019 [Anvil][9])* + +### 使用 Python 数据结构来绘图 + +你还可以使用 Python 基本数据结构来定义绘图,它与面对对象 API 具有相同的结构。这直接对应于 Plotly 的 JavaScript 实现的 JSON API。 + +``` +# 定义绘图数据 +fig = { +    'data': [ +        {'type': 'bar', 'x': x, 'y': df['conservative'], 'name': 'Conservative', 'marker': {'color': '#0343df'}}, +        {'type': 'bar', 'x': x, 'y': df['labour'], 'name': 'Labour', 'marker': {'color': '#e50000'}}, +        {'type': 'bar', 'x': x, 'y': df['liberal'], 'name': 'Liberal', 'marker': {'color': '#ffff14'}}, +        {'type': 'bar', 'x': x, 'y': df['others'], 'name': 'Others', 'marker': {'color': '#929591'}}, +    ], +    'layout': { +        'title': {'text': 'Election results', 'x': 0.5}, +        'yaxis': {'title': 'Seats'}, +        'xaxis': { +            'tickmode': 'array', +            'tickvals': list(range(27)), +            'ticktext': tuple(df['year'].values), +        } +    } +} + +# 告诉 Plotly 去渲染它 +pio.show(fig) +``` + +最终结果与上次完全相同: + +![A multi-bar plot made using JSON-like data structures][10] + +*A multi-bar plot made using JSON-like data structures (© 2019 [Anvil][9])* + +#### 使用 Plotly Express 进行绘图 + +[Plotly Express][11] 是对图对象进行封装的高级 API。 + +你可以使用一行代码来绘制柱状图: + +``` +# 导入 Plotly 和数据 +import plotly.express as px +from votes import long as df + +# 定义颜色字典获得自定义栏颜色 +cmap = { +    'Conservative': '#0343df', +    'Labour': '#e50000', +    'Liberal': '#ffff14', +    'Others': '#929591', +} + +# 生成图 +fig = px.bar(df, x="year", y="seats", color="party", barmode="group", color_discrete_map=cmap) +``` + +这里使用了[长表][12]Long Form 数据,也称为“整洁数据”。这些列代表年份、政党和席位,而不是按政党划分。这与在 [Seaborn][13] 中制作柱状图非常相似。 + +``` +>> print(long) +     year         party  seats +0    1922  Conservative    344 +1    1923  Conservative    258 +2    1924  Conservative    412 +3    1929  Conservative    260 +4    1931  Conservative    470 +..    ...           ...    ... +103  2005        Others     30 +104  2010        Others     29 +105  2015        Others     80 +106  2017        Others     59 +107  2019        Others     72 + +[108 rows x 3 columns] +``` + +你可以访问底层的图对象 API 进行详细调整。如添加标题和 `y` 轴标签: + +``` +# 使用图对象 API 来调整绘图 +import plotly.graph_objects as go +fig.layout = go.Layout( +    title=go.layout.Title(text="Election results", x=0.5), +    yaxis_title="Seats", +) +``` + +最后,让 Plotly 渲染: + +``` +fig.show() +``` + +这将在未使用的端口上运行一个临时 Web 服务器,并打开默认的 Web 浏览器来查看图像(Web 服务器将会马上被关闭)。 + +不幸的是,结果并不完美。`x` 轴被视为整数,因此两组之间的距离很远且很小,这使得我们很难看到趋势。 + +![使用 Plotly Express 制作的柱状图][14] + +*A multi-bar plot made using Plotly Express (© 2019 [Anvil][9])* + +你可能会尝试通过将 `x` 值转换为字符串来使 Plotly Express 将其视为字符串,这样它就会以均匀的间隔和词法顺序来绘制。不幸的是,它们的间隔还是很大,像在 `graph_objects`中那样设置 `xaxis_tickvals` 也不行。 + +与 [Seaborn][13] 中的类似示例不同,在这种情况下,抽象似乎没有提供足够的[应急方案][15]来提供你想要的东西,但是也许你可以编写*自己*的 API? + +### 构建自己的 Plotly API + +对 Plotly 的操作方式不满意?那就构建自己的 Plotly API! + +Plotly 的核心是一个 JavaScript 库,它使用 [D3][16] 和 [stack.gl][17] 进行绘图。JavaScript 库的接口使用指定的 JSON 结构来绘图。因此,你只需要输出 JavaScript 库喜欢使用的 JSON 结构就好了。 + +Anvil 这样做是为了创建一个完全在浏览器中工作的 Python Plotly API。 + +![Ployly 使用 JavaScript 库创建图形,由其它语言库通过 JSON 使用][18] + +*Plotly uses a JavaScript library to create plots, driven by libraries in other languages via JSON (© 2019 [Anvil][9])* + +在 Anvil 版本中,你可以同时使用图对象 API 和上面介绍的 Python 数据结构方法。运行完全相同的命令,将数据和布局分配给 Anvil 应用程序中的 [Plot 组件][19]。 + +这是用 Anvil 的客户端 Python API 绘制的多列柱状图: + +``` +# 导入 Anvil 库 +from ._anvil_designer import EntrypointTemplate +from anvil import * +import anvil.server + +# 导入客户端 Plotly +import plotly.graph_objs as go + +# 这是一个 Anvil 表单 +class Entrypoint(EntrypointTemplate): +  def __init__(self, **properties): +    # Set Form properties and Data Bindings. +    self.init_components(**properties) + +    # 从服务器获取数据 +    data = anvil.server.call('get_election_data') +    +    # 获取一个方便的 x 值列表 +    years = data['year'] +    x = list(range(len(years))) + +    # 定义绘图 +    bar_plots = [ +      go.Bar(x=x, y=data['conservative'], name='Conservative', marker=go.Marker(color='#0343df')), +      go.Bar(x=x, y=data['labour'], name='Labour', marker=go.Marker(color='#e50000')), +      go.Bar(x=x, y=data['liberal'], name='Liberal', marker=go.Marker(color='#ffff14')), +      go.Bar(x=x, y=data['others'], name='Others', marker=go.Marker(color='#929591')), +    ] +    # 规定布局 +    layout = { +      'title': 'Election results', +      'yaxis': {'title': 'Seats'}, +      'xaxis': { +        'tickmode': 'array', +        'tickvals': list(range(27)), +        'ticktext': data['year'], +      }, +    } + +    # 生成多列柱状图 +    self.plot_1.data = bar_plots +    self.plot_1.layout = layout +``` + +绘图逻辑与上面相同,但是它完全在 Web 浏览器中运行,绘图是由用户计算机上的 Plotly JavaScript 库完成的!与本系列的所有其它 [Python 绘图库][3]相比,这是一个很大的优势。因为其它 Python 库都需要在服务器上运行。 + +这是在 Anvil 应用中运行的交互式 Plotly 图: + +![The election plot on the web using Anvil's client-side-Python Plotly library][20] + +*The election plot on the web using Anvil's [client-side-Python][21] Plotly library (© 2019 [Anvil][9])* + +你可以[复制此示例][22]作为一个 Anvil 应用程序(注意:Anvil 需要注册才能使用)。 + +在前端运行 Plotly 还有另一个优势:它为自定义交互行为提供了更多选项。 + +### 在 Plotly 中自定义交互 + +Plotly 绘图不仅是动态的,你可以自定义它们的互动行为。例如,你可以在每个柱状图中使用 `hovertemplate` 自定义工具提示的格式: + +``` + go.Bar( + x=x, + y=df['others'], + name='others', + marker=go.bar.Marker(color='#929591'), + hovertemplate='Seats: %{y}', + ), +``` + +当你把这个应用到每个柱状图时,你会看到以下结果: + +![A multi-bar plot with custom tool-tips][23] + +*A multi-bar plot with custom tool-tips (© 2019 [Anvil][9])* + +这很有用,当你想要在某些事件发生时执行任何你想要的代码就更好了(例如,当用户将鼠标悬停在栏上,你想要显示一个相关选举的信息框)。在 Anvil 的 Plotly 库中,你可以将事件处理程序绑定到诸如悬停之类的事件,这使得复杂的交互成为可能。 + +![A multi-bar plot with a hover event handler][24] + +*A multi-bar plot with a hover event handler (© 2019 [Anvil][9])* + +你可以通过将方法绑定到绘图的悬停事件来实现: + +``` + def plot_1_hover(self, points, **event_args): + """This method is called when a data point is hovered.""" + i = points[0]['point_number'] + self.label_year.text = self.data['year'][i] + self.label_con.text = self.data['conservative'][i] + self.label_lab.text = self.data['labour'][i] + self.label_lib.text = self.data['liberal'][i] + self.label_oth.text = self.data['others'][i] + url = f"https://en.wikipedia.org/wiki/{self.data['year'][i]}_United_Kingdom_general_election" + self.link_more_info.text = url + self.link_more_info.url = url +``` + +这是一种相当极端的交互性,从开发人员的角度来看,也是一种极端的可定制性。这都要归功于 Plotly 的架构 —— 它有一个简洁的接口,明确的设计是为了让你建立自己的API。如果到处都能看到这种伟大的设计,那将会很有帮助! + +### 使用 Bokeh 进行自定义交互 + +现在你已经了解了 Plotly 如何使用 JavaScript 来创建动态图,并且可以使用 Anvil 的客户端编写 Python 代码在浏览器中实时编辑它们。 + +Bokeh 是另一个 Python 绘图库,它可以输出可嵌入 Web 应用程序的 HTML 文档,并获得与 Plotly 提供的功能类似的动态功能(如果你想知道如何发音,那就是 “BOE-kay”)。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/5/plotly-python + +作者:[Shaun Taylor-Morgan][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/shaun-taylor-morgan +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/colorful_sound_wave.png?itok=jlUJG0bM (Colorful sound wave graph) +[2]: https://opensource.com/resources/python +[3]: https://linux.cn/article-12327-1.html +[4]: https://opensource.com/article/20/4/install-python-linux +[5]: thttps://opensource.com/article/19/5/python-3-default-mac +[6]: https://opensource.com/article/19/8/how-install-python-windows +[7]: https://opensource.com/article/20/5/matplotlib-python +[8]: https://opensource.com/sites/default/files/uploads/plotly.png (A multi-bar plot made using Graph Objects) +[9]: https://anvil.works/blog/plotting-in-plotly +[10]: https://opensource.com/sites/default/files/uploads/plotly-pio.png (A multi-bar plot made using JSON-like data structures) +[11]: https://plot.ly/python/plotly-express/ +[12]: https://anvil.works/blog/tidy-data +[13]: https://opensource.com/article/20/5/seaborn-visualization-python +[14]: https://opensource.com/sites/default/files/uploads/plotly-express.png (A multi-bar plot made using Plotly Express) +[15]: https://anvil.works/blog/escape-hatches-and-ejector-seats +[16]: https://d3js.org/ +[17]: http://stack.gl/ +[18]: https://opensource.com/sites/default/files/uploads/plotly-arch.png (Plotly uses a JavaScript library to create plots, driven by libraries in other languages via JSON) +[19]: https://anvil.works/docs/client/components/plots +[20]: https://opensource.com/sites/default/files/uploads/plotting-in-anvil.gif (The election plot on the web using Anvil's client-side-Python Plotly library) +[21]: https://anvil.works/docs/client/python +[22]: https://anvil.works/login?app-name=Plotting%20in%20Plotly&app-author=shaun%40anvil.works +[23]: https://opensource.com/sites/default/files/uploads/plotly-tooltips.png (A multi-bar plot with custom tool-tips) +[24]: https://opensource.com/sites/default/files/uploads/plotly-event-handling.gif (A multi-bar plot with a hover event handler) diff --git a/published/202006/20200529 20 productivity tools for the Linux terminal.md b/published/202006/20200529 20 productivity tools for the Linux terminal.md new file mode 100644 index 0000000000..a373c3bb21 --- /dev/null +++ b/published/202006/20200529 20 productivity tools for the Linux terminal.md @@ -0,0 +1,137 @@ +[#]: collector: (lujun9972) +[#]: translator: (lxbwolf) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12274-1.html) +[#]: subject: (20 productivity tools for the Linux terminal) +[#]: via: (https://opensource.com/article/20/6/productivity-tools-linux-terminal) +[#]: author: (Alan Smithee https://opensource.com/users/alansmithee) + +20 个 Linux 终端下的生产力工具 +====== + +> 来试下这些开源工具。你的效率一定会提升。 + +![Computer screen with files or windows open][1] + +诚然,很多人使用计算机来娱乐。但是一些人会用来工作,他们的理论是计算机应当能帮我们更快、更好、更有条理地做事。实际应用中,如果没有根据每个人的工作风格来做一些小小的手动配置,计算机也不会提升我们的效率。 + +[Kevin Sonney][2] 喜欢设计系统,今年他在一个 20 篇文章的系列中介绍了 18 种不同的生产力工具,不仅涵盖了网络方面,也涉及了一些能提升他的工作效率的工具。Kevin 最喜欢的所有的工具都收集到了本文,下面概括介绍每种工具的用途。 + +### 文件同步 + +![][3] + +重要的文件应谨慎管理。 + + * [Syncthing][4] 能使不同设备上的文件彼此同步。*设备*可以是 Linux、Windows 或 Mac,也可以是服务器、Android 平板或手机,等等。文件可以是你期望在多台机器间同步的任意文件。Syncthing 是轻量级的点对点工具,因此你不需要支付服务费,你不需要第三方的服务器,而且它很快。 + * 同步是一件事,但有时你还需要帮忙处理你拥有的文件。假设你想要一个应用程序在作为一个图形化应用和作为控制台应用时表现不同行为,你可以通过修改符号链接指向的不同的配置文件来达成,如 `.foo-gui` 和 `.foo-term`。这完全可以手动修改,但也可以用脚本处理,或者你可以试试 [GNU Stow][5]。 + +### 邮件管理 + +![][6] + +我们都依赖于邮件和收件箱,但似乎很少有人对自己管理邮件的方式满意。如果你喜欢用终端工作,为什么不在终端里管理邮件呢?在终端里收发邮件是一件事,但是要能在终端里组织你的邮件就更棒了。如果你的职业是打字员或是天生写脚本的人,试试这类工具吧。 + + * 我每天用 [OfflineIMAP][7] 把工作邮件同步到笔记本,以便用 Mutt 看邮件。它是很特别的工具,只做一件事:保证本地的邮件副本与远程的收件箱完全同步。配置和用 [cron][8] 调度它都相当简单,然后你就可以忘了它的存在。它相当简单,你与 IMAP 打交道的每一刻时间都应该用它。 + * [Notmuch][9] 能为邮件消息建立索引、加标签以及搜索邮件。如果你的收件箱出了问题,它可以让你*不需要*花费很大精力去补救。 + * [Vim][10] 可以收发邮件和管理你的日历。 + * 当然,[Emacs][11] 可以收发邮件和管理你的日历。 + +### 日历和联系人 + +![][12] + +我用过的所有的 Linux 系统都预装了 `cal` 命令。这是一个在终端下用的便捷小日历,它也是个很好的速查工具。然而,它几乎不能被称为一个日历应用程序。[iCalendar][13] 规范(与 Apple 的旧桌面日历无关)中提供了丰富的共享日历功能,虽然 `.ics` 的约会和事件是纯文本的,但没有在终端中管理它们的工作流。至少,在 khal 和 vdirsyncer 出现之前不存在。 + + * [Khal][14] 是基于控制台的读写 `.ics` 文件的日历工具。 + * [Vdirsyncer][14] 是一个能把线上日历(和联系人)同步到本地的终端命令。Khal 在本地运行,vdirsyncer 在远程运行,这样远程的日历能与你管理的本地日历保持同步。 + * 管理联系人可能会很难,但是如果你用了 [Khard][15] 这个可以读写 vCard 格式文件的终端命令,就会变得简单。反过来,这些文件可以使用 vdirsyncer(你可能已经在使用 khal 日历)同步到远程服务器上。这使得日历和联系人管理变得简单,而且[搭建个人信息管理(PIM)服务器][16]也比以前容易得多。 + +### 待办清单 + +![][17] + + * 组织你每天的行程有很多种方式,但是最简单的一种是用 [todo.txt][18],一个简单、便携、易于理解的系统,即使设备上没有安装 todo.txt 也不会出现问题。todo.txt 能正常运行的原因是,它就是一个 Bash 脚本,能在几乎所有你能找到的的设备上运行。操作过程很简单:下载脚本,安装到家目录,用一个简单的命令开始调度任务。如果你的计算机上没有安装 `todo.sh` 命令,那么你的待办清单仍然可以作为纯文本文件来使用,你可以在需要时手动更新它。 + * [Jrnl][19] 是一个能追踪的你的日常议程和活动的数字笔记本。如果你要摘抄桌面上的报纸的片段或者把随意的想法写下来,那么这就是你要找的程序。 + +### 保持联络 + +![][20] + +沟通是关键,然而现在似乎比以往更多的是聊天平台的问题。这不仅仅是几个客户端,而是几个独立的网络。你怎么管理它们?这里有两个方案。 + + * 如果你有很多的联系人分布在太多的聊天网络中,那么你应该试试 [BitlBee][21],使用这个单一的聊天客户端就可以关联其他所有的聊天网络。 + * [Rainbow Stream][22] 是个推特客户端,能让你不被开放的网页浏览器分心,而又能紧跟时事。 + +### 消息通知 + +![][23] + +网页浏览器很好,但有时过犹不及。你希望能及时收到消息,但是你又不想全身心地陷入到互联网中。因为互联网是建立在开放的规范和大量的开源技术的基础上的,你不必在一个界面中做所有的事。对于不同的任务有不同的*客户端*,它们可以让你用自己喜欢的界面来获取你需要的信息。 + + * [Tuir][24] 是一个 Reddit 终端客户端。 + * [Newsboat][25] 是一个 RSS 阅读器。 + * [Wego][26] 是天气预报工具。 + * [Vim][27] 可以帮助你登录 Reddit 和 Twitter。 + * [Emacs][28] 能让你保持与 Reddit、Twitter 和聊天客户端的联系。 + +### 保持终端一直开启 + +![][29] + +如果你正在用终端工作,那么关闭它的意义是什么呢?摆脱 `exit` 和 `Ctrl+D` 的诱惑,让你的控制台一直开启着。 + + * [Tmux][30] 能分割你的终端,让一个终端窗口“分层"到另一个窗口之上,甚至从一台计算机离开到另一台计算机后,能保持相同的终端会话。 + * [DESQview][31] 是另一种方式:它本质上是一个终端窗口管理器。 + +### 未完待续 + +本文列出的工具只是 Linux 终端的神奇生产力工具中的一小部分。这个清单会结束,但你自己的清单可以继续。找到你喜欢的工具,学习它们,并将其发挥出最大的优势。当然,一个好的工具不一定要提高你的生产力:有时你最喜欢的命令也可以是能让你最快乐的命令。你的工作是找到自己喜欢的命令,用它们来改变世界。 + +玩得愉快! + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/6/productivity-tools-linux-terminal + +作者:[Alan Smithee][a] +选题:[lujun9972][b] +译者:[lxbwolf](https://github.com/lxbwolf) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/alansmithee +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/browser_screen_windows_files.png?itok=kLTeQUbY (Computer screen with files or windows open) +[2]: https://opensource.com/users/ksonney +[3]: https://opensource.com/sites/default/files/uploads/productivity_2-1.png +[4]: https://linux.cn/article-11793-1.html +[5]: https://linux.cn/article-11796-1.html +[6]: https://opensource.com/sites/default/files/uploads/productivity_3-1.png +[7]: https://linux.cn/article-11804-1.html +[8]: https://opensource.com/article/17/11/how-use-cron-linux +[9]: https://linux.cn/article-11807-1.html +[10]: https://linux.cn/article-11908-1.html +[11]: https://linux.cn/article-11932-1.html +[12]: https://opensource.com/sites/default/files/uploads/productivity_5-1.png +[13]: https://tools.ietf.org/html/rfc5545 +[14]: https://linux.cn/article-11812-1.html +[15]: https://linux.cn/article-11834-1.html +[16]: https://opensource.com/alternatives/google-calendar +[17]: https://opensource.com/sites/default/files/uploads/productivity_7-1.png +[18]: https://linux.cn/article-11835-1.html +[19]: https://linux.cn/article-11846-1.html +[20]: https://opensource.com/sites/default/files/uploads/productivity_9-1.png +[21]: https://linux.cn/article-11856-1.html +[22]: https://linux.cn/article-11858-1.html +[23]: https://opensource.com/sites/default/files/uploads/productivity_13-1.png +[24]: https://linux.cn/article-11869-1.html +[25]: https://linux.cn/article-11876-1.html +[26]: https://linux.cn/article-11879-1.html +[27]: https://linux.cn/article-11912-1.html +[28]: https://linux.cn/article-11956-1.html +[29]: https://opensource.com/sites/default/files/uploads/productivity_14-1.png +[30]: https://linux.cn/article-11900-1.html +[31]: https://linux.cn/article-11892-1.html diff --git a/published/202006/20200529 Add interactivity to your Python plots with Bokeh.md b/published/202006/20200529 Add interactivity to your Python plots with Bokeh.md new file mode 100644 index 0000000000..87a6640ddd --- /dev/null +++ b/published/202006/20200529 Add interactivity to your Python plots with Bokeh.md @@ -0,0 +1,221 @@ +[#]: collector: (lujun9972) +[#]: translator: (wxy) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12329-1.html) +[#]: subject: (Add interactivity to your Python plots with Bokeh) +[#]: via: (https://opensource.com/article/20/5/bokeh-python) +[#]: author: (Shaun Taylor-Morgan https://opensource.com/users/shaun-taylor-morgan) + +使用 Bokeh 为你的 Python 绘图添加交互性 +====== + +> 在 Bokeh 中绘图比其他一些绘图库要复杂一些,但付出额外的努力是有回报的。 + +![](https://img.linux.net.cn/data/attachment/album/202006/18/164708zz7tjxz7m7ax5lt3.jpg) + +在这一系列文章中,我通过在每个 Python 绘图库中制作相同的多条形绘图,来研究不同 Python 绘图库的特性。这次我重点介绍的是 [Bokeh][2](读作 “BOE-kay”)。 + +Bokeh 中的绘图比[其它一些绘图库][3]要复杂一些,但付出的额外努力是有回报的。Bokeh 的设计既允许你在 Web 上创建自己的交互式绘图,又能让你详细控制交互性如何工作。我将通过给我在这个系列中一直使用的多条形图添加工具提示来展示这一点。它绘制了 1966 年到 2020 年之间英国选举结果的数据。 + +![][4] + +*绘图的放大视图(©2019 年 [Anvil][5])* + +### 制作多条形图 + +在我们继续之前,请注意你可能需要调整你的 Python 环境来让这段代码运行,包括以下: + +- 运行最新版本的 Python (在 [Linux][11]、[Mac][12] 和 [Windows][13] 上的说明) +- 确认你运行的 Python 版本能与这些库一起工作。 + +数据可在线获得,可以用 Pandas 导入。 + +``` +import pandas as pd +df = pd.read_csv('https://anvil.works/blog/img/plotting-in-python/uk-election-results.csv') +``` + +现在我们可以继续进行了。 + +为了做出多条形图,你需要对你的数据进行一下调整。 + +原始数据是这样的: + +``` +>> print(long) + year party seats +0 1966 Conservative 253 +1 1970 Conservative 330 +2 Feb 1974 Conservative 297 +3 Oct 1974 Conservative 277 +4 1979 Conservative 339 +.. ... ... ... +103 2005 Others 30 +104 2010 Others 29 +105 2015 Others 80 +106 2017 Others 59 +107 2019 Others 72 + +[60 rows x 3 columns] +``` + +你可以把数据看成是每一个可能的 `(year, party)` 组合的一系列 `seats` 值。这正是 Bokeh 处理的方式。你需要做一个 `(year, party)` 元组的列表: + +``` +# 得到每种可能的 (year, party) 组合的元组 +x = [(str(r[1]['year']), r[1]['party']) for r in df.iterrows()] + +# This comes out as [('1922', 'Conservative'), ('1923', 'Conservative'), ... ('2019', 'Others')] +``` + +这些将是 `x` 值。`y` 值就是席位(`seats`)。 + +``` +y = df['seats'] +``` + +现在你的数据看起来应该像这样: + +``` +x                               y +('1966', 'Conservative')        253 +('1970', 'Conservative')        330 +('Feb 1974', 'Conservative')    297 +('Oct 1974', 'Conservative')    277 +('1979', 'Conservative')        339 + ...      ...                   ... +('2005', 'Others')              30 +('2010', 'Others')              29 +('2015', 'Others')              80 +('2017', 'Others')              59 +('2019', 'Others')              72 +``` + +Bokeh 需要你将数据封装在它提供的一些对象中,这样它就能给你提供交互功能。将你的 `x` 和 `y` 数据结构封装在一个 `ColumnDataSource` 对象中。 + +``` + from bokeh.models import ColumnDataSource + + source = ColumnDataSource(data={'x': x, 'y': y}) +``` + +然后构造一个 `Figure` 对象,并传入你用 `FactorRange` 对象封装的 `x` 数据。 + +``` +    from bokeh.plotting import figure +    from bokeh.models import FactorRange +    +    p = figure(x_range=FactorRange(*x), width=2000, title="Election results") +``` + +你需要让 Bokeh 创建一个颜色表,这是一个特殊的 `DataSpec` 字典,它根据你给它的颜色映射生成。在这种情况下,颜色表是一个简单的党派名称和一个十六进制值之间的映射。 + +``` +    from bokeh.transform import factor_cmap + +    cmap = { +        'Conservative': '#0343df', +        'Labour': '#e50000', +        'Liberal': '#ffff14', +        'Others': '#929591', +    } +    fill_color = factor_cmap('x', palette=list(cmap.values()), factors=list(cmap.keys()), start=1, end=2) +``` + +现在你可以创建条形图了: + +``` +    p.vbar(x='x', top='y', width=0.9, source=source, fill_color=fill_color, line_color=fill_color) +``` + +Bokeh 图表上数据的可视化形式被称为“字形glyphs”,因此你已经创建了一组条形字形。 + +调整图表的细节,让它看起来像你想要的样子。 + +``` +    p.y_range.start = 0 +    p.x_range.range_padding = 0.1 +    p.yaxis.axis_label = 'Seats' +    p.xaxis.major_label_orientation = 1 +    p.xgrid.grid_line_color = None +``` + +最后,告诉 Bokeh 你现在想看你的绘图: + +``` +   from bokeh.io import show + +   show(p) +``` + +这将绘图写入一个 HTML 文件,并在默认的 Web 浏览器中打开它。如下结果: + +![][6] + +*Bokeh 中的多条形绘图(©2019年[Anvil][5])* + +它已经有了一些互动功能,比如盒子缩放。 + +![][7] 。 + +*Bokeh 内置的盒子缩放(©2019[Anvil][5])* + +但 Bokeh 的厉害之处在于你可以添加自己的交互性。在下一节中,我们通过在条形图中添加工具提示来探索这个问题。 + +### 给条形图添加工具提示 + +要在条形图上添加工具提示,你只需要创建一个 `HoverTool` 对象并将其添加到你的绘图中。 + +``` +    h = HoverTool(tooltips=[ +        ('Seats', '@y'), +        ('(Year, Party)', '(@x)') +    ]) +    p.add_tools(h) +``` + +参数定义了哪些数据会显示在工具提示上。变量 `@y` 和 `@x` 是指你传入 `ColumnDataSource` 的变量。你还可以使用一些其他的值。例如,光标在图上的位置由 `$x` 和 `$y` 给出(与 `@x` 和 `@y` 没有关系)。 + +下面是结果: + +![][8] + +*选举图,现在带有工具提示(© 2019 [Anvil][5])* + +借助 Bokeh 的 HTML 输出,将绘图嵌入到 Web 应用中时,你可以获得完整的交互体验。你可以在[这里][9]把这个例子复制为 Anvil 应用(注:Anvil 需要注册才能使用)。 + +现在,你可以看到付出额外努力在 Bokeh 中将所有数据封装在 `ColumnDataSource` 等对象的原因了。作为回报,你可以相对轻松地添加交互性。 + +### 回归简单:Altair + +Bokeh 是四大最流行的绘图库之一,本系列将研究[它们各自的特别之处][3]。 + +我也在研究几个因其有趣的方法而脱颖而出的库。接下来,我将看看 [Altair][10],它的声明式 API 意味着它可以做出非常复杂的绘图,而不会让你头疼。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/5/bokeh-python + +作者:[Shaun Taylor-Morgan][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/shaun-taylor-morgan +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/python-programming-code-keyboard.png?itok=fxiSpmnd (Hands on a keyboard with a Python book ) +[2]: https://bokeh.org/ +[3]: https://linux.cn/article-12327-1.html +[4]: https://opensource.com/sites/default/files/uploads/bokeh-closeup.png (A zoomed-in view on the plot) +[5]: https://anvil.works/blog/plotting-in-bokeh +[6]: https://opensource.com/sites/default/files/uploads/bokeh_0.png (A multi-bar plot in Bokeh) +[7]: https://opensource.com/sites/default/files/uploads/bokeh-box-zoom.gif (Bokeh's built-in box zoom) +[8]: https://opensource.com/sites/default/files/uploads/bokeh-tooltips.gif (The election graph, now with tooltips) +[9]: https://anvil.works/build#clone:CFRUWSM6PQ6JUUXH%3dSX4SACDSXBB4UOIVEVPWXH55%7cMYTOLCU2HM5WKJYM%3d6VJKGRSF74TCCVDG5CTVDOCS +[10]: https://altair-viz.github.io/ +[11]: https://opensource.com/article/20/4/install-python-linux +[12]: https://opensource.com/article/19/5/python-3-default-mac +[13]: https://opensource.com/article/19/8/how-install-python-windows \ No newline at end of file diff --git a/published/202006/20200529 How to find and remove broken symlinks on Linux.md b/published/202006/20200529 How to find and remove broken symlinks on Linux.md new file mode 100644 index 0000000000..0c67037b00 --- /dev/null +++ b/published/202006/20200529 How to find and remove broken symlinks on Linux.md @@ -0,0 +1,112 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12298-1.html) +[#]: subject: (How to find and remove broken symlinks on Linux) +[#]: via: (https://www.networkworld.com/article/3546252/how-to-find-and-remove-broken-symlinks-on-linux.html) +[#]: author: (Sandra Henry-Stocker https://www.networkworld.com/author/Sandra-Henry_Stocker/) + +如何在 Linux 上查找和删除损坏的符号链接 +====== + +![](https://img.linux.net.cn/data/attachment/album/202006/09/095016y7ranx1tssxdsttd.jpg) + +> 符号链接是指向另一个文件的 Linux 文件。如果删除了被引用的文件,符号链接会保留,但不会显示有问题,除非你尝试使用它。以下是查找和删除指向文件已被删除的符号链接的简单方法。 + +符号链接symbolic link在 Linux 系统上扮演了非常有用的角色。它们可以帮助你记住重要文件在系统上的位置,使你更容易访问这些文件,并让你不必为了更方便访问大文件而复制它们,从而节省了大量的空间。 + +### 什么是符号链接? + +通常称它们为“符号链接”或“软链接”,符号链接是非常小的文件。实际上,符号链接真正包含的是它指向的文件的名称,通常包含路径(相对于当前位置或绝对路径)。如果有个名为 `ref1` 的文件指向名为 `/apps/refs/ref-2020` 的文件,那么 `ref1` 的长度将为 19 个字符,即使 `ref-202` 文件有 2TB。如果指向 `./ref-2020`,那么长度仅为 10 个字符。如果指向 `ref-2020`,那么只有 8 个字节。 + +如果你执行 `vi ref1` 之类的命令(其中 `ref1` 是符号链接的名称),你将编辑 `ref1` 指向的文件,而不是符号链接本身的内容。Linux 系统知道如何使用符号链接,并且可以做正确的事。同样,如果你使用诸如 `cat`、`more`、`head` 或 `tail` 之类的命令,那么将查看引用文件的内容。 + +另一方面,如果删除符号链接,你将删除该链接,而不是引用的文件。再说一次,Linux 知道怎么做。符号链接使得使用和共享文件更加容易,仅此而已。 + +#### 符号链接损坏时 + +当一个符号链接所指向的文件从系统中删除或重新命名时,符号链接将不再起作用。符号链接只不过是存储在某个特定目录中的引用而已,它不会随着指向它的文件发生变化而更新或删除。它一直指向被引用的文件,即使这个文件早已消失。 + +如果你尝试使用指向一个不存在的文件的符号链接,那么将出现如下错误: + +``` +$ tail whassup +tail: cannot open 'whassup' for reading: No such file or directory +``` + +如果你尝试访问指向自身的符号链接(是的,奇怪的事情发生了),你将看到类似以下的内容: + +``` +$ cat loopy +cat: loopy: Too many levels of symbolic links +$ ls -l loopy +lrwxrwxrwx 1 shs shs 5 May 28 18:07 loopy -> loopy +``` + +而且,如果(上面的)长列表的第一个字母没有引起你的注意,这表示该文件是符号链接。`rwxrwxrwx` 权限是标准权限,并不反映符号链接指向的文件的权限。 + +### 查找损坏的符号链接 + +`find` 命令有一个选项,能让你找到指向不再存在的文件的符号链接。此命令列出当前目录中的符号链接: + +``` +$ find . -type l +``` + +`l` (小写字母 `L`)告诉 `find` 命令查找符号链接。 + +另一方面,下面的命令在当前目录中查找指向*不存在*的文件的符号链接: + +``` +$ find . -xtype l +``` + +为了避免在该命令尝试查找你无权检查的文件或目录时发生错误,你可以将所有错误输出到 `/dev/null`,如下所示: + +``` +$ find . -xtype l 2>/dev/null +``` + +你也可以使用此命令找到损坏的符号链接。它比前面的更长,但做的是同样的事情: + +``` +$ find . -type l ! -exec test -e {} \; -print 2>/dev/null +``` + +### 如何处理损坏的符号链接 + +除非你知道符号链接引用的文件会被替换,否则最好的方法是直接删除损坏的链接。实际上,如果需要,你可以使用一条命令查找并删除损坏的符号链接,如: + +``` +$ find . -xtype l 2>/dev/null -exec rm {} \; +``` + +该命令的 `rm {}` 部分会变成“删除文件”的命令 + +如果你想将符号链接与不同的文件相关联,你必须先删除该符号链接,然后重新创建它,使其指向新文件。这是一个例子: + +``` +$ rm ref1 +$ ln -s /apps/data/newfile ref1 +``` + +### 总结 + +符号链接使引用的文件更易于查找和使用,但有时它会比那些宣传去年已经关闭的餐馆的路标还过分。`find` 命令可以帮助你摆脱损坏的符号链接,或者提醒你没有你可能仍然需要的文件。 + +-------------------------------------------------------------------------------- + +via: https://www.networkworld.com/article/3546252/how-to-find-and-remove-broken-symlinks-on-linux.html + +作者:[Sandra Henry-Stocker][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://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 diff --git a/published/202006/20200529 What is the Difference Between Soft link vs Hard link in Linux.md b/published/202006/20200529 What is the Difference Between Soft link vs Hard link in Linux.md new file mode 100644 index 0000000000..da090386ec --- /dev/null +++ b/published/202006/20200529 What is the Difference Between Soft link vs Hard link in Linux.md @@ -0,0 +1,72 @@ +[#]: collector: (lujun9972) +[#]: translator: (HankChow) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12270-1.html) +[#]: subject: (What is the Difference Between Soft link vs Hard link in Linux?) +[#]: via: (https://www.2daygeek.com/difference-between-soft-link-vs-hard-link-linux/) +[#]: author: (Magesh Maruthamuthu https://www.2daygeek.com/author/magesh/) + + +Linux 中软链接和硬链接的区别 +====== + +![](https://img.linux.net.cn/data/attachment/album/202006/01/082717bilg8nmx808oxzgn.jpg) + +链接Link是一种快捷访问机制,它通过一个文件指向原始文件或目录的方式实现快捷访问,同时还记录了原始文件或目录的一些信息。 + +链接允许多个不同文件对同一个文件进行引用。 + +### 什么是软链接 + +符号链接Symbolic Link(symlink),又称软链接Soft Link,是一种特殊的文件,它指向 Linux 系统上的另一个文件或目录。 + +这和 Windows 系统中的快捷方式有点类似,链接文件中记录的只是原始文件的路径,并不记录原始文件的内容。 + +符号链接通常用于对库文件进行链接,也常用于链接日志文件和网络文件系统Network File System(NFS)上共享的目录。 + +### 什么是硬链接 + +硬链接是原始文件的一个镜像副本。创建硬链接后,如果把原始文件删除,链接文件也不会受到影响,因为此时原始文件和链接文件互为镜像副本。 + +为什么要创建链接文件而不直接复制文件呢? + +当你需要将同一个文件保存在多个不同位置,而且还要保持持续更新的时候,硬链接的重要性就体现出来了。 + +如果你只是单纯把文件复制到另一个位置,那么另一个位置的文件只会保存着复制那一刻的文件内容,后续也不会跟随着原始文件持续更新。 + +而使用硬链接时,各个镜像副本的文件内容都会同时更新。 + +### 软链接和硬链接的区别 + +下表列出了软链接和硬链接之间的区别。 + +\# | 软链接 | 硬链接 +---|---|--- +1 | 软链接类似于 Windows 系统中的快捷方式 | 硬链接是原始文件的一个镜像副本 +2 | 软链接又称符号链接 | 硬链接没有别名 +3 | 链接中任何一个文件发生改变,都会同步到连接中的其它文件 | 和软链接一样 +4 | 软链接可以跨文件系统进行创建 | 硬链接不可以跨文件系统进行创建 +5 | 软链接可以指向文件或目录 | 硬链接只能指向文件 +6 | 链接文件和原始文件之间的 inode 和文件权限不完全一致 | 链接文件和原始文件的 inode 和文件权限完全一致 +7 | 链接文件只记录原始文件的路径,不记录原始文件的内容 | 链接文件记录了原始文件的内容 +8 | 如果原始文件被移除,软链接就会因为指向不存在的文件而失效。这被称为“挂起链接hanging link” | 即使原始文件被移除,链接文件也不受影响。 +9 | 通过 `ln -s <原始文件> <链接文件>` 命令创建软链接 | 通过 `ln <原始文件> <链接文件>` 命令创建硬链接 +10 | 软链接文件的文件权限中有一个特殊标记 `l` | 硬链接文件没有特殊标记 +11 | 通过 `find / -type l` 命令可以查找软链接文件 | 通过 `find / -samefile <原始文件>` 命令可以查找硬链接文件 +12 | 通过 `symlinks <目录>` 命令可以查找失效的软链接 | 硬链接不存在失效链接 + + +-------------------------------------------------------------------------------- + +via: https://www.2daygeek.com/difference-between-soft-link-vs-hard-link-linux/ + +作者:[Magesh Maruthamuthu][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.2daygeek.com/author/magesh/ +[b]: https://github.com/lujun9972 diff --git a/published/202006/20200531 Looking for Some Good Note Taking Apps on Linux- Here are the Best Notes Apps we Found for You.md b/published/202006/20200531 Looking for Some Good Note Taking Apps on Linux- Here are the Best Notes Apps we Found for You.md new file mode 100644 index 0000000000..f2fafaa32c --- /dev/null +++ b/published/202006/20200531 Looking for Some Good Note Taking Apps on Linux- Here are the Best Notes Apps we Found for You.md @@ -0,0 +1,290 @@ +[#]: collector: (lujun9972) +[#]: translator: (wxy) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12307-1.html) +[#]: subject: (Looking for Some Good Note Taking Apps on Linux? Here are the Best Notes Apps we Found for You) +[#]: via: (https://itsfoss.com/note-taking-apps-linux/) +[#]: author: (Ankush Das https://itsfoss.com/author/ankush/) + +9 款 Linux 上的最佳笔记应用 +====== + +无论你做什么,做笔记总是一个好习惯。是的,有很多笔记应用可以帮助你实现这个目标。但是,Linux 上的开源笔记应用怎么样呢? + +别担心,你不需要无休止地在互联网上搜索,就能找到 Linux 下最好的笔记应用。在这里,我挑选了一些最令人印象深刻的开源笔记应用。 + +![][1] + +请注意,此列表没有特定的排名顺序。 + +### 1、Joplin + +![][2] + +主要功能: + +* 支持 Markdown +* 支持附件 +* 支持加密 +* 跨平台,包括 Android 应用 + +[Joplin][9] 是一款令人印象深刻的自由开源笔记应用,支持加密。凭借其提供的出色的功能,它也是目前[最好的 Evernote 替代品][3]之一。事实上,我就是因为它提供的功能才从 Evernote 转移到 Joplin。 + +你可以选择添加待办事项列表、普通笔记,或者把它作为一个 Markdown 编辑器来写东西。它适用于 Linux、Windows、macOS、Android 和 iOS。你还可以选择使用 [Dropbox][4]、OneDrive、[NextCloud][5] 或 WebDAV 来同步你的笔记。 + +如果你好奇,可以阅读我们关于 [Joplin][6] 的详细文章来了解更多。 + +#### 如何安装? + +你可以用一个 AppImage 文件来安装 Joplin。我已经在 Ubuntu 20.04 LTS 上试过了,和预期的一样没有问题。要找到该文件,你可以前往其官方网站或探索他们的 [GitHub 页面][7]。 + +如果你不知道如何安装它,请按照我们的[使用 AppImage 文件][8]指南来开始。 + +另外,如果你想使用终端,你可以键入下面的命令,通过脚本来安装它(在这个过程中还会添加一个桌面图标)。 + +``` +wget -O - https://raw.githubusercontent.com/laurent22/joplin/master/Joplin_install_and_update.sh | bash +``` + +### 2、Simplenote + +![][10] + +主要功能: + +* 支持 Markdown +* 简约的用户界面 +* 通过你的 Simplenote 帐户轻松地进行同步 +* 有 32 位软件包 +* 跨平台,包括移动应用程序 + +顾名思义,它是一款简约的自由开源笔记应用。 + +由 [Automattic][11](WordPress 背后的公司)开发,[Simplenote][13] 可以让你在多个设备上无缝同步你的笔记。它支持 Android、iOS、Windows、Linux,以及 macOS。 + +与其它一些笔记应用不同的是,你会注意到它的界面非常简单,可能不会提供很多功能。但是,你可以为你的笔记添加标签。 + +#### 如何安装? + +它提供了 .deb / .rpm 软件包以及一个 AppImage 文件。你可以在它的 [GitHub 发布部分][12]中找到这些文件。 + +### 3、Laverna + +**注:** 它已经不再积极开发了,但它仍然可以正常工作。 + +![][14] + +主要功能: + +* 支持 Markdown +* 支持加密 +* 支持同步 + +[Laverna][15] 是一个有趣的开源笔记应用程序,还提供加密(这是可选的)。 + +你可以把它作为一个基于 Web 的笔记应用,也可以作为电脑上的应用使用。它适用于 Linux、Mac 和 Windows。 + +虽然它除了支持加密外,还具有记事本应用的所有基本功能,但并没有一个可以使用的移动应用。所以,这是一个只有当你是一个桌面用户,并且在 Web 浏览器上完成大部分事情时才能使用的东西。 + +#### 如何安装? + +它提供了一个压缩文件,可在其[官方网站][15]上获得。下载之后,你需要解压并启动可执行文件来开始。 + +### 4、Standard Notes + +![][16] + +主要功能: + +* 支持 Markdown +* 支持加密 +* 支持同步 +* 笔记的版本历史(付费计划) +* 跨平台,包括移动应用程序 +* 提供了 32 位包。 +* 提供付费选择 + +又一款开源笔记应用,为你的笔记和附件提供加密。 + +与 Laverna 不同,[Standard Notes][18] 正在积极开发中。虽然它提供了大量的功能,但其中一些功能以“扩展功能”或扩展插件仅提供给付费用户,这是偏昂贵的(每月订阅)。你也可以参考我们另外一篇关于 [Standard Notes][17] 的文章来了解更多信息。 + +总的来说,你会得到 Markdown 支持、加密附件和笔记的能力、版本历史、备份支持(OneDrive、Google Drive 等)以及更多这样有用的功能。 + +#### 如何安装? + +它提供了一个 AppImage 文件,可以在你的 Linux 发行版上安装它。你只需要前往它的[官方网站][18]下载即可。如果你不知道如何使用这个文件,可以参考我们的 [AppImage 指南][8]。 + +对于其他可用的软件包或源代码,你可以参考他们的 [GitHub 页面][19]。 + +### 5、Boost Note + +![][20] + +主要功能: + +* 支持 Markdown +* 适用于开发者 +* 跨平台 + +[Boost Note][21] 是一款对使用 Linux 的程序员有用的笔记应用。你可以用它写你的代码,也可以用来写笔记、文档等等。 + +它提供了一个简洁直观的用户界面,并提供了 Linux 上笔记应用的所有基本功能。 + +#### 如何安装? + +你可以选择其[官网][22]上为 Ubuntu 提供的 .deb 文件。如果你想在其他 Linux 发行版上尝试,你还可以找到一个 AppImage 文件来开始使用。 + +如果你好奇,也可以查看他们的 [GitHub 页面][23]来探索更多关于它的内容或复刻它。 + +### 6、Tomboy Notes(新一代) + +![][24] + +主要功能: + +* 轻量级笔记应用 +* 支持同步 +* 跨平台 + +一款轻量级且极其简单的记事应用怎么样? + +好吧,你可能知道旧版的 [Tomboy Notes][25] 已经不再开发了。幸运的是,有一个新一代的 [Tomboy Notes NG][27] 版本。你可以配置存储笔记的路径,并快速开始记笔记。 + +这款应用仅仅只有约 2MB 的下载量。所以,如果你正在寻找一个轻量级的解决方案 —— 那就是它。它可能无法用于智能手机,但你肯定可以在 Windows、Linux 和 MacOS 上使用它。 + +#### 如何安装? + +你可以在他们的 [GitHub 发布部分][26]中找到 .deb / .rpm 和其他包。对于其他的 Linux 发行版,你可以关注他们 GitHub 页面的文档来了解更多。 + +### 7、RedNoteBook + +![][28] + +主要功能 + +* 传统的日记式记事应用 +* 有模板 +* 离线使用 + +对于想要在 Linux 上使用离线笔记应用的用户来说,[RedNotebook][30] 应该是一个不错的选择。 + +是的,它不支持同步,如果你是一个不想要同步功能的人,RedNoteBook 应该是一款传统风格的记事应用,侧边栏为日历。 + +它主要是为喜欢离线日记的用户量身定做的。它还为你提供了几个模板,方便你创建某些笔记。 + +#### 如何安装? + +如果你使用的是 Ubuntu(或者其他基于 Ubuntu 的发行版),你可以通过 PPA 来安装它。下面是你在终端中输入的安装方法: + +``` +sudo add-apt-repository ppa:rednotebook/stable +sudo apt-get update +sudo apt-get install rednotebook +``` + +对于其他的 Linux 发行版,你可以得到 [Flatpak 软件包][29]。 + +### 8、TagSpaces + +![][31] + +主要特点: + +* 丰富的用户界面 +* 支持管理文件 +* 支持同步 +* 提供付费选择 + +[TagSpaces][34] 是一款适用于 Linux 的精美笔记应用。不仅仅局限于创建笔记,你还可以管理照片和其他文档。 + +与其他一些可用的笔记应用不同,它不提供加密功能。所以,你可以尝试像 [Syncthing][32] 这样支持 Dropbox 和 Nextcloud 的工具来安全地同步你的数据。 + +如果你想要特定的功能和支持,你也可以选择它的付费计划。 + +#### 如何安装? + +你可以在他们的 [GitHub 发布区][33]中找到 .deb 文件和一个 AppImage 文件来安装。无论哪种情况,你都可以把它也构建起来。 + +### 9、Trilium Notes + +![][35] + +主要功能: + +* 分层记事应用 +* 支持加密 +* 支持同步 + +[Trilium Notes][39] 并不只是又一款笔记应用,它是一款专注于建立个人知识库的分层笔记应用。 + +是的,你也可以将它用于普通用途 —— 但它是为特定用户量身定制的,他们希望能够以分层方式管理笔记。 + +我个人还没有使用过 —— 除了测试。欢迎试用,多多探讨。 + +#### 如何安装? + +只需前往其 [GitHub 发布区][36],并抓取 [.deb 文件在 Ubuntu 上安装][37]。如果你正在寻找其他 Linux 发行版上可用的软件包,你也可以从源代码构建它,或者下载并[解压缩文件][38]。 + +### 总结 + +我对 Linux 上的笔记应用的推荐到此结束。我已经用过很多个,目前决定用 Simplenote 来做快速笔记,用 Joplin 来收集章节中的笔记。 + +你是否知道一些应该包括在这个列表中的其它 Linux 笔记应用程序?为什么不在评论区告诉我们呢? + +你更喜欢哪个笔记应用程序?我很想知道你通常在 Linux 上寻找的最好的笔记应用程序是什么。 + +欢迎在下面的评论部分分享你的想法。 + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/note-taking-apps-linux/ + +作者:[Ankush Das][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://itsfoss.com/author/ankush/ +[b]: https://github.com/lujun9972 +[1]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/05/Note-Taking-Apps-linux.jpg?ssl=1 +[2]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/01/joplin_ubuntu.jpg?ssl=1 +[3]: https://itsfoss.com/5-evernote-alternatives-linux/ +[4]: https://www.dropbox.com/ +[5]: https://nextcloud.com/ +[6]: https://linux.cn/article-11896-1.html +[7]: https://github.com/laurent22/joplin +[8]: https://itsfoss.com/use-appimage-linux/ +[9]: https://joplinapp.org/ +[10]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/05/simplenote-new.jpg?ssl=1 +[11]: https://automattic.com/ +[12]: https://github.com/Automattic/simplenote-electron/releases/tag/v1.16.0 +[13]: https://simplenote.com +[14]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2019/10/laverna.png?resize=800%2C623&ssl=1 +[15]: https://laverna.cc +[16]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2019/11/standard-notes-shot.jpg?resize=800%2C578&ssl=1 +[17]: https://itsfoss.com/standard-notes/ +[18]: https://standardnotes.org +[19]: https://github.com/standardnotes +[20]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2019/10/boostnote.png?resize=800%2C579&ssl=1 +[21]: https://itsfoss.com/boostnote-linux-review/ +[22]: https://boostnote.io/ +[23]: https://github.com/BoostIO/Boostnote +[24]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/05/tomboy-notes-ng.jpg?ssl=1 +[25]: https://github.com/tomboy-notes/tomboy +[26]: https://github.com/tomboy-notes/tomboy-ng/releases +[27]: https://github.com/tomboy-notes/tomboy-ng +[28]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/05/rednotebook.png?ssl=1 +[29]: https://flathub.org/apps/details/app.rednotebook.RedNotebook +[30]: https://rednotebook.sourceforge.io +[31]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/10/tagspaces.png?resize=800%2C523&ssl=1 +[32]: https://itsfoss.com/syncthing/ +[33]: https://github.com/tagspaces/tagspaces/releases/ +[34]: https://www.tagspaces.org/ +[35]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/05/trilium-notes.png?ssl=1 +[36]: https://github.com/zadam/trilium/releases +[37]: https://itsfoss.com/install-deb-files-ubuntu/ +[38]: https://itsfoss.com/unzip-linux/ +[39]: https://github.com/zadam/trilium/ diff --git a/published/202006/20200601 How to write a VS Code extension.md b/published/202006/20200601 How to write a VS Code extension.md new file mode 100644 index 0000000000..366052a86a --- /dev/null +++ b/published/202006/20200601 How to write a VS Code extension.md @@ -0,0 +1,298 @@ +[#]: collector: (lujun9972) +[#]: translator: (wxy) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12310-1.html) +[#]: subject: (How to write a VS Code extension) +[#]: via: (https://opensource.com/article/20/6/vs-code-extension) +[#]: author: (Ashique Hussain Ansari https://opensource.com/users/uidoyen) + +如何编写 VS Code 扩展 +====== + +> 通过为流行的代码编辑器编写自己的扩展来添加缺失的功能。 + +![](https://img.linux.net.cn/data/attachment/album/202006/13/105415w5u1d0z5bdoneb82.jpg) + +Visual Studio Code(VS Code)是微软为 Linux、Windows 和 macOS 创建的跨平台代码编辑器。遗憾的是,微软版本的 [VS Code][2] 是在 [Microsoft Software License][3] 下发布的,这不是一个开源的许可证。然而,它的源代码是开源的,在 MIT 许可证下由 [VSCodium][4] 项目发布。 + +VSCodium 和 VS Code一样,支持扩展、内嵌式 Git 控制、GitHub 集成、语法高亮、调试、智能代码补完、代码片段等。换句话说,对于大多数用户来说,使用 VS Code 和 VSCodium 没有什么区别,而且后者是完全开源的! + +### 什么是 VS Code 扩展? + +扩展extension可以让你为 VS Code 或 VSCodium 添加功能。你可以在 GUI 中或从终端安装扩展。 + +你也可以构建自己的扩展。有几个你可能想学习如何构建扩展的原因: + +1. **想要添加一些功能:** 如果缺失你想要的功能,你可以创建一个扩展来添加它。 +2. **为了乐趣和学习:** 扩展 API 允许你探索 VSCodium 是如何工作的,这是一件有趣的事情。 +3. **为了提高您的技能:** 创建扩展可以提高你的编程技能。 +4. **为了成名:** 创建一个对他人有用的扩展可以提高你的公众形象。 + +### 安装工具 + +在你开始之前,你必须已经安装了 [Node.js][5]、[npm][6] 和 VS Code 或 [VSCodium][4]。 + +要生成一个扩展,你还需要以下工具:[Yeoman][7],是一个开源的客户端脚手架工具,可以帮助你搭建新项目;以及 [vscode-generator-code][8],是 VS Code 团队创建的 Yeoman 生成器。 + +### 构建一个扩展 + +在本教程中,你将构建一个扩展,它可以为应用程序初始化一个 Docker 镜像。 + +#### 生成一个扩展骨架 + +要在全局范围内安装并运行 Yeoman 生成器,请在命令提示符或终端中输入以下内容: + +``` +npm install -g yo generator-code +``` + +导航到要生成扩展的文件夹,键入以下命令,然后按回车: + +``` +yo code +``` + +根据提示,你必须回答一些关于你的扩展的问题: + +* **你想创建什么类型的扩展?** 使用上下箭头选择其中一个选项。在本文中,我将只介绍第一个选项,`New Extension (TypeScript)`。 +* **你的扩展名称是什么?** 输入你的扩展名称。我的叫 `initdockerapp`。(我相信你会有一个更好的名字。) +* **你的扩展的标识符是什么?** 请保持原样。 +* **你的扩展的描述是什么?** 写一些关于你的扩展的内容(你可以现在填写或稍后编辑它)。 +* **初始化 Git 仓库?** 这将初始化一个 Git 仓库,你可以稍后添加 `set-remote`。 +* **使用哪个包管理器?** 你可以选择 `yarn` 或 `npm`;我使用 `npm`。 + +按回车键后,就会开始安装所需的依赖项。最后显示: + +> "Your extension **initdockerapp** has been created!" + +干的漂亮! + +### 检查项目的结构 + +检查你生成的东西和项目结构。导航到新的文件夹,并在终端中键入 `cd initdockerapp`。 + +一旦你进入该目录,键入 `.code`。它将在你的编辑器中打开,看起来像这样。 + +![Project file structure in VSCodium][9] + +(Hussain Ansari, [CC BY-SA 4.0][10]) + +最需要注意的两个文件是 `src` 文件夹内的 `package.json` 和 `extension.ts`。 + +#### package.json + +首先来看看 `package.json`,它应该是这样的。 + +``` +{ + "name": "initdockerapp", + "displayName": "initdockerapp", + "description": "", + "version": "0.0.1", + "engines": { + "vscode": "^1.44.0" + }, + "categories": [ + "Other" + ], + "activationEvents": [ + "onCommand:initdockerapp.initialize" + ], + "main": "./out/extension.js", + "contributes": { + "commands": [ + { + "command": "initdockerapp.initialize", + "title": "Initialize A Docker Application" + } + ] + }, + "scripts": { + "vscode:prepublish": "npm run compile", + "compile": "tsc -p ./", + "lint": "eslint src --ext ts", + "watch": "tsc -watch -p ./", + "pretest": "npm run compile && npm run lint", + "test": "node ./out/test/runTest.js" + }, + "devDependencies": { + "@types/vscode": "^1.44.0", + "@types/glob": "^7.1.1", + "@types/mocha": "^7.0.2", + "@types/node": "^13.11.0", + "eslint": "^6.8.0", + "@typescript-eslint/parser": "^2.26.0", + "@typescript-eslint/eslint-plugin": "^2.26.0", + "glob": "^7.1.6", + "mocha": "^7.1.1", + "typescript": "^3.8.3", + "vscode-test": "^1.3.0" + } +} +{ + "name": "initdockerapp", + "displayName": "initdockerapp", + "description": "", + "version": "0.0.1", + "engines": { + "vscode": "^1.44.0" + }, + "categories": [ + "Other" + ], + "activationEvents": [ + "onCommand:initdockerapp.initialize" + ], + "main": "./out/extension.js", + "contributes": { + "commands": [ + { + "command": "initdockerapp.initialize", + "title": "Initialize A Docker Application" + } + ] + }, + "scripts": { + "vscode:prepublish": "npm run compile", + "compile": "tsc -p ./", + "lint": "eslint src --ext ts", + "watch": "tsc -watch -p ./", + "pretest": "npm run compile && npm run lint", + "test": "node ./out/test/runTest.js" + }, + "devDependencies": { + "@types/vscode": "^1.44.0", + "@types/glob": "^7.1.1", + "@types/mocha": "^7.0.2", + "@types/node": "^13.11.0", + "eslint": "^6.8.0", + "@typescript-eslint/parser": "^2.26.0", + "@typescript-eslint/eslint-plugin": "^2.26.0", + "glob": "^7.1.6", + "mocha": "^7.1.1", + "typescript": "^3.8.3", + "vscode-test": "^1.3.0" + } +} +``` + +如果你是 Node.js 开发者,其中一些可能看起来很熟悉,因为 `name`、`description`、`version` 和 `scripts` 是 Node.js 项目的常见部分。 + +有几个部分是非常重要的: + +* `engines`:说明该扩展将支持哪个版本的 VS Code / VSCodium。 +* `categories`:设置扩展类型;你可以从 `Languages`、`Snippets`、`Linters`、`Themes`、`Debuggers`、`Formatters`、`Keymaps` 和 `Other` 中选择。 +* `contributes`:可用于与你的扩展一起运行的命令清单。 +* `main`:扩展的入口点。 +* `activationEvents`:指定激活事件发生的时间。具体来说,这决定了扩展何时会被加载到你的编辑器中。扩展是懒加载的,所以在激活事件触发之前,它们不会被激活。 + +#### src/extension.ts + +接下来看看 `src/extension.ts`,它应该是这样的: + +``` +// The module 'vscode' contains the VSCodium extensibility API +// Import the module and reference it with the alias vscode in your code below +import * as vscode from "vscode"; +const fs = require("fs"); +const path = require("path"); + +// this method is called when your extension is activated +// your extension is activated the very first time the command is executed +export function activate(context: vscode.ExtensionContext) { + + // Use the console to output diagnostic information (console.log) and errors (console.error) + // This line of code will only be executed once when your extension is activated + console.log('Congratulations, your extension "initdockerapp" is now active!'); + + // The command has been defined in the package.json file + // Now provide the implementation of the command with registerCommand + // The commandId parameter must match the command field in package.json + let disposable = vscode.commands.registerCommand('initdockerapp.initialize', () => { + // The code you place here will be executed every time your command is executed + + let fileContent =` + FROM node:alpine + WORKDIR /usr/src/app + + COPY package.json . + RUN npm install + + COPY . . + + EXPOSE 3000 + CMD ["npm", "start"] + `; + + fs.writeFile(path.join(vscode.workspace.rootPath, "Dockerfile"), fileContent, (err:any) => { + if (err) { + return vscode.window.showErrorMessage("Failed to initialize docker file!"); + } + vscode.window.showInformationMessage("Dockerfile has been created!"); + }); + }); + + context.subscriptions.push(disposable); +} + +// this method is called when your extension is deactivated +export function deactivate() {} +``` + +这是为你的扩展写代码的地方。已经有一些自动生成的代码了,我再来分析一下。 + +注意,`vscode.command.registerCommand` 里面的 `initdockerapp.initialize` 和 `package.json` 里面的命令是一样的。它需要两个参数。 + +1. 要注册的命令名称 +2. 执行命令的功能 + +另一个需要注意的函数是 `fs.writeFile`,这是你写在 `vscode.command.registerCommand` 函数里面的。这将在你的项目根目录下创建一个 Dockerfile,并在其中附加代码来创建一个 Docker 镜像。 + +### 调试扩展 + +现在你已经写好了扩展,是时候调试它了。点击“Run”菜单,选择“Start Debugging”(或者直接按 `F5`)打开调试窗口。 + +在调试窗口里面点击“Add Folder”或“Clone Repository”按钮,打开该项目。 + +接下来,用 `Ctrl+Shift+P`(在 macOS 上,用 `Command` 键代替 `Ctrl`)打开命令面板,运行 `Initialize A Docker Application`。 + +* 第一次运行此命令时,自 VSCodium 启动后,激活函数尚未执行。因此,调用激活函数,并由激活 函数注册该命令。 +* 如果命令已注册,那么它将被执行。 + +你会看到右下角有一条信息,上面写着:`Dockerfile has been created!`。这就创建了一个 Dockerfile,里面有一些预定义的代码,看起来是这样的: + +![Running the new extension command][11] + +(Hussain Ansari, [CC BY-SA 4.0][10]) + +### 总结 + +有许多有用的 API 可以帮助你创建你想要构建的扩展。VS Code 扩展 API 还有许多其他强大的方法可以使用。 + +你可以在 VS Code 扩展 API 文档中了解更多关于 VS Code API 的信息。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/6/vs-code-extension + +作者:[Ashique Hussain Ansari][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/uidoyen +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/lenovo-thinkpad-laptop-window-focus.png?itok=g0xPm2kD (young woman working on a laptop) +[2]: https://code.visualstudio.com/ +[3]: https://code.visualstudio.com/license +[4]: https://vscodium.com/ +[5]: https://nodejs.org/en/ +[6]: https://www.npmjs.com/ +[7]: https://yeoman.io/ +[8]: https://github.com/Microsoft/vscode-generator-code +[9]: https://opensource.com/sites/default/files/uploads/vscode-tree.png (Project file structure in VSCodium) +[10]: https://creativecommons.org/licenses/by-sa/4.0/ +[11]: https://opensource.com/sites/default/files/uploads/vscode-run-command.png (Running the new extension command) diff --git a/published/202006/20200601 Use FastAPI to build web services in Python.md b/published/202006/20200601 Use FastAPI to build web services in Python.md new file mode 100644 index 0000000000..00dcf9cd0d --- /dev/null +++ b/published/202006/20200601 Use FastAPI to build web services in Python.md @@ -0,0 +1,188 @@ +[#]: collector: (lujun9972) +[#]: translator: (HankChow) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12280-1.html) +[#]: subject: (Use FastAPI to build web services in Python) +[#]: via: (https://fedoramagazine.org/use-fastapi-to-build-web-services-in-python/) +[#]: author: (Clément Verna https://fedoramagazine.org/author/cverna/) + +使用 Python FastAPI 构建 Web 服务 +====== + +![](https://img.linux.net.cn/data/attachment/album/202006/04/105930wr333sx3erz3k2ur.jpg) + +[FastAPI][2] 是一个使用 Python 编写的 Web 框架,还应用了 Python asyncio 库中最新的优化。本文将会介绍如何搭建基于容器的开发环境,还会展示如何使用 FastAPI 实现一个小型 Web 服务。 + +### 起步 + +我们将使用 Fedora 作为基础镜像来搭建开发环境,并使用 Dockerfile 为镜像注入 FastAPI、[Uvicorn][3] 和 [aiofiles][4] 这几个包。 + +``` +FROM fedora:32 +RUN dnf install -y python-pip \ + && dnf clean all \ + && pip install fastapi uvicorn aiofiles +WORKDIR /srv +CMD ["uvicorn", "main:app", "--reload"] +``` + +在工作目录下保存 `Dockerfile` 之后,执行 `podman` 命令构建容器镜像。 + +``` +$ podman build -t fastapi . +$ podman images +REPOSITORY TAG IMAGE ID CREATED SIZE +localhost/fastapi latest 01e974cabe8b 18 seconds ago 326 MB +``` + +下面我们可以开始创建一个简单的 FastAPI 应用程序,并通过容器镜像运行。 + +``` +from fastapi import FastAPI + +app = FastAPI() + +@app.get("/") +async def root(): + return {"message": "Hello Fedora Magazine!"} +``` + +将上面的代码保存到 `main.py` 文件中,然后执行以下命令开始运行: + +``` +$ podman run --rm -v $PWD:/srv:z -p 8000:8000 --name fastapi -d fastapi +$ curl http://127.0.0.1:8000 +{"message":"Hello Fedora Magazine!" +``` + +这样,一个基于 FastAPI 的 Web 服务就跑起来了。由于指定了 `--reload` 参数,一旦 `main.py` 文件发生了改变,整个应用都会自动重新加载。你可以尝试将返回信息 `"Hello Fedora Magazine!"` 修改为其它内容,然后观察效果。 + +可以使用以下命令停止应用程序: + +``` +$ podman stop fastapi +``` + +### 构建一个小型 Web 服务 + +接下来我们会构建一个需要 I/O 操作的应用程序,通过这个应用程序,我们可以看到 FastAPI 自身的特点,以及它在性能上有什么优势(可以在[这里][5]参考 FastAPI 和其它 Python Web 框架的对比)。为简单起见,我们直接使用 `dnf history` 命令的输出来作为这个应用程序使用的数据。 + +首先将 `dnf history` 命令的输出保存到文件。 + +``` +$ dnf history | tail --lines=+3 > history.txt +``` + +在上面的命令中,我们使用 `tail` 去除了 `dnf history` 输出内容中无用的表头信息。剩余的每一条 `dnf` 事务都包括了以下信息: + + * `id`:事务编号(每次运行一条新事务时该编号都会递增) + * `command`:事务中运行的 `dnf` 命令 + * `date`:执行事务的日期和时间 + +然后修改 `main.py` 文件将相关的数据结构添加进去。 + +``` +from fastapi import FastAPI +from pydantic import BaseModel + +app = FastAPI() + +class DnfTransaction(BaseModel): + id: int + command: str + date: str +``` + +FastAPI 自带的 [pydantic][6] 库让你可以轻松定义一个数据类,其中的类型注释对数据的验证也提供了方便。 + +再增加一个函数,用于从 `history.txt` 文件中读取数据。 + +``` +import aiofiles + +from fastapi import FastAPI +from pydantic import BaseModel + +app = FastAPI() + +class DnfTransaction(BaseModel): + id: int + command: str + date: str + + +async def read_history(): + transactions = [] + async with aiofiles.open("history.txt") as f: + async for line in f: + transactions.append(DnfTransaction( + id=line.split("|")[0].strip(" "), + command=line.split("|")[1].strip(" "), + date=line.split("|")[2].strip(" "))) + return transactions +``` + +这个函数中使用了 `aiofiles` 库,这个库提供了一个异步 API 来处理 Python 中的文件,因此打开文件或读取文件的时候不会阻塞其它对服务器的请求。 + +最后,修改 `root` 函数,让它返回事务列表中的数据。 + +``` +@app.get("/") +async def read_root(): + return await read_history() +``` + +执行以下命令就可以看到应用程序的输出内容了。 + +``` +$ curl http://127.0.0.1:8000 | python -m json.tool +[ +{ +"id": 103, +"command": "update", +"date": "2020-05-25 08:35" +}, +{ +"id": 102, +"command": "update", +"date": "2020-05-23 15:46" +}, +{ +"id": 101, +"command": "update", +"date": "2020-05-22 11:32" +}, +.... +] +``` + +### 总结 + +FastAPI 提供了一种使用 asyncio 构建 Web 服务的简单方法,因此它在 Python Web 框架的生态中日趋流行。要了解 FastAPI 的更多信息,欢迎查阅 [FastAPI 文档][2]。 + +本文中的代码可以在 [GitHub][7] 上找到。 + + +-------------------------------------------------------------------------------- + +via: https://fedoramagazine.org/use-fastapi-to-build-web-services-in-python/ + +作者:[Clément Verna][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://fedoramagazine.org/author/cverna/ +[b]: https://github.com/lujun9972 +[1]: https://fedoramagazine.org/wp-content/uploads/2020/05/fastapi-python-816x345.jpg +[2]: https://fastapi.tiangolo.com/ +[3]: https://www.uvicorn.org/ +[4]: https://github.com/Tinche/aiofiles +[5]: https://www.techempower.com/benchmarks/#section=test&runid=7464e520-0dc2-473d-bd34-dbdfd7e85911&hw=ph&test=composite&l=z8kflr-v&a=2&f=jz8cg-0-3s-0-3k-6bo-0-0-18y74-8s5c-0 +[6]: https://pydantic-docs.helpmanual.io/ +[7]: https://github.com/cverna/fastapi_app +[8]: https://unsplash.com/@jankubita?utm_source=unsplash&utm_medium=referral&utm_content=creditCopyText +[9]: https://unsplash.com/s/photos/fast-snake?utm_source=unsplash&utm_medium=referral&utm_content=creditCopyText diff --git a/published/202006/20200601 When to choose C or Python for a command-line interface.md b/published/202006/20200601 When to choose C or Python for a command-line interface.md new file mode 100644 index 0000000000..868894f61f --- /dev/null +++ b/published/202006/20200601 When to choose C or Python for a command-line interface.md @@ -0,0 +1,247 @@ +[#]: collector: (lujun9972) +[#]: translator: (wxy) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12286-1.html) +[#]: subject: (When to choose C or Python for a command-line interface) +[#]: via: (https://opensource.com/article/20/6/c-python-cli) +[#]: author: (Erik O'Shaughnessy https://opensource.com/users/jnyjny) + +用 Python 解析命令行参数 +====== + +> 借鉴 C 语言的历史,学习如何用 Python 编写有用的 CLI 程序。 + +![](https://img.linux.net.cn/data/attachment/album/202006/05/231539dyinqzceci4ci8vv.jpg) + +本文的目标很简单:帮助新的 Python 开发者了解一些关于[命令行接口][2](CLI)的历史和术语,并探讨如何在 Python 中编写这些有用的程序。 + +### 最初…… + +首先,从 [Unix][3] 的角度谈谈命令行界面设计。 + +Unix 是一种计算机操作系统,也是 Linux 和 macOS(以及许多其他操作系统)的祖先。在图形用户界面之前,用户通过命令行提示符与计算机进行交互(想想如今的 [Bash][4] 环境)。在 Unix 下开发这些程序的主要语言是 [C][5],它的[功能][6]非常强大。 + +因此,我们至少应该了解 [C 程序][7]的基础知识。 + +假设你没有读过上面那个链接的内容,C 程序的基本架构是一个叫做 `main` 的函数,它的签名是这样的。 + +``` +   int main(int argc, char **argv) +   { +   ... +   } +``` + +对于 Python 程序员来说,这应该不会显得太奇怪。C 函数首先有一个返回类型、一个函数名,然后是括号内的类型化参数。最后,函数的主体位于大括号之间。函数名 `main` 是[运行时链接器][8](构造和运行程序的程序)如何决定从哪里开始执行你的程序。如果你写了一个 C 程序,而它没有包含一个名为 `main` 的函数,它将什么也做不了。伤心。 + +函数参数变量 `argc` 和 `argv` 共同描述了程序被调用时用户在命令行输入的字符串列表。在典型的 Unix 命名传统中,`argc` 的意思是“参数计数argument count”,`argv` 的意思是“参数向量argument vector”。向量听起来比列表更酷,而 `argl` 听起来就像一个要勒死的求救声。我们是 Unix 系统的程序员,我们不求救。我们让*其他人*哭着求救。 + +#### 再进一步 + +``` +$ ./myprog foo bar -x baz +``` + +如果 `myprog` 是用 C 语言实现的,则 `argc` 的值是 5,而 `argv` 是一个有五个条目的字符指针数组。(不要担心,如果这听起来过于技术,那换句话说,这是一个由五个字符串组成的列表。)向量中的第一个条目 `argv[0]` 是程序的名称。`argv` 的其余部分包含参数。 + +``` +   argv[0] == "./myprog" +   argv[1] == "foo" +   argv[2] == "bar" +   argv[3] == "-x" +   argv[4] == "baz" +    +   /* 注:不是有效的 C 代码 */ +``` + +在 C 语言中,你有很多方法来处理 `argv` 中的字符串。你可以手动地循环处理数组 `argv`,并根据程序的需要解释每个字符串。这相对来说比较简单,但会导致程序的接口大相径庭,因为不同的程序员对什么是“好”有不同的想法。 + +``` +include + +/* 一个打印 argv 内容的简单 C 程序。 */ + +int main(int argc, char **argv) { + int i; + + for(i=0; i +#include + +#define OPTSTR "b:f:" + +extern char *optarg; + +int main(int argc, char **argv) { + int opt; + char *bar = NULL; + char *foo = NULL; + + while((opt=getopt(argc, argv, OPTSTR)) != EOF) + switch(opt) { + case 'b': + bar = optarg; + break; + case 'f': + foo = optarg; + break; + case 'h': + default': + fprintf(stderr, "Huh? try again."); + exit(-1); + /* NOTREACHED */ + } + printf("%s\n", foo ? foo : "Empty foo"); + printf("%s\n", bar ? bar : "Empty bar"); +} +``` + +就个人而言,我*希望* Python 有*开关*,但这[永远][12]、永远不会[发生][13]。 + +#### GNU 时代 + +[GNU][14] 项目出现了,并为他们实现的传统 Unix 命令行工具引入了更长的格式参数,比如`--file-format foo`。当然,我们这些 Unix 程序员很讨厌这样,因为打字太麻烦了,但是就像我们这些旧时代的恐龙一样,我们输了,因为用户*喜欢*更长的选项。我从来没有写过任何使用 GNU 风格选项解析的代码,所以这里没有代码示例。 + +GNU 风格的参数也接受像 `-f foo` 这样的短名,也必须支持。所有这些选择都给程序员带来了更多的工作量,因为他们只想知道用户要求的是什么,然后继续进行下去。但用户得到了更一致的用户体验:长格式选项、短格式选项和自动生成的帮助,使用户不必再试图阅读臭名昭著的难以解析的[手册][15]页面(参见 [ps][16] 这个特别糟糕的例子)。 + +### 但我们正在讨论 Python? + +你现在已经接触了足够多(太多?)的命令行的历史,对如何用我们最喜欢的语言来编写 CLI 有了一些背景知识。Python 在命令行解析方面给出了类似的几个选择:自己解析,自给自足batteries-included的方式,以及大量的第三方方式。你选择哪一种取决于你的特定情况和需求。 + +#### 首先,自己解析 + +你可以从 [sys][17] 模块中获取程序的参数。 + +``` +import sys + +if __name__ == '__main__': +   for value in sys.argv: +       print(value) +``` + +#### 自给自足 + +在 Python 标准库中已经有几个参数解析模块的实现:[getopt][18]、[optparse][19],以及最近的 [argparse][20]。`argparse` 允许程序员为用户提供一致的、有帮助的用户体验,但就像它的 GNU 前辈一样,它需要程序员做大量的工作和“[模板代码][21]”才能使它“奏效”。 + +``` +from argparse import ArgumentParser + +if __name__ == "__main__": + +   argparser = ArgumentParser(description='My Cool Program') +   argparser.add_argument("--foo", "-f", help="A user supplied foo") +   argparser.add_argument("--bar", "-b", help="A user supplied bar") +    +   results = argparser.parse_args() +   print(results.foo, results.bar) +``` + +好处是当用户调用 `--help` 时,有自动生成的帮助。但是[自给自足][22]batteries included的优势呢?有时,你的项目情况决定了你对第三方库的访问是有限的,或者说是没有,你不得不用 Python 标准库来“凑合”。 + +#### CLI 的现代方法 + +然后是 [Click][23]。`Click` 框架使用[装饰器][24]的方式来构建命令行解析。突然间,写一个丰富的命令行界面变得有趣而简单。在装饰器的酷炫和未来感的使用下,很多复杂的东西都消失了,用户惊叹于自动支持关键字补完以及上下文帮助。所有这些都比以前的解决方案写的代码更少。任何时候,只要你能写更少的代码,还能把事情做好,就是一种胜利。而我们都想要胜利。 + +``` +import click + +@click.command() +@click.option("-f", "--foo", default="foo", help="User supplied foo.") +@click.option("-b", "--bar", default="bar", help="User supplied bar.") +def echo(foo, bar): +    """My Cool Program +    +    It does stuff. Here is the documentation for it. +    """ +    print(foo, bar) +    +if __name__ == "__main__": +    echo() +``` + +你可以在 `@click.option` 装饰器中看到一些与 `argparse` 相同的模板代码。但是创建和管理参数分析器的“工作”已经被抽象化了。现在,命令行参数被解析,而值被赋给函数参数,从而函数 `echo` 被*魔法般地*调用。 + +在 `Click` 接口中添加参数就像在堆栈中添加另一个装饰符并将新的参数添加到函数定义中一样简单。 + +### 但是,等等,还有更多! + +[Typer][25] 建立在 `Click` 之上,是一个更新的 CLI 框架,它结合了 `Click` 的功能和现代 Python [类型提示][26]。使用 `Click` 的缺点之一是必须在函数中添加一堆装饰符。CLI 参数必须在两个地方指定:装饰符和函数参数列表。`Typer` [免去你造轮子][27] 去写 CLI 规范,让代码更容易阅读和维护。 + +``` +import typer + +cli = typer.Typer() + +@cli.command() +def echo(foo: str = "foo", bar: str = "bar"): +    """My Cool Program +    +    It does stuff. Here is the documentation for it. +    """ +    print(foo, bar) +    +if __name__ == "__main__": +    cli() +``` + +### 是时候开始写一些代码了 + +哪种方法是正确的?这取决于你的用例。你是在写一个只有你才会使用的快速而粗略的脚本吗?直接使用 `sys.argv` 然后继续编码。你需要更强大的命令行解析吗?也许 `argparse` 就够了。你是否有很多子命令和复杂的选项,你的团队是否会每天使用它?现在你一定要考虑一下 `Click` 或 `Typer`。作为一个程序员的乐趣之一就是魔改出替代实现,看看哪一个最适合你。 + +最后,在 Python 中有很多用于解析命令行参数的第三方软件包。我只介绍了我喜欢或使用过的那些。你喜欢和/或使用不同的包是完全可以的,也是我们所期望的。我的建议是先从这些包开始,然后看看你最终的结果。 + +去写一些很酷的东西吧。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/6/c-python-cli + +作者:[Erik O'Shaughnessy][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/jnyjny +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/search_find_code_python_programming.png?itok=ynSL8XRV (Searching for code) +[2]: https://en.wikipedia.org/wiki/Command-line_interface +[3]: https://en.wikipedia.org/wiki/Unix +[4]: https://www.gnu.org/software/bash/ +[5]: https://en.wikipedia.org/wiki/C_(programming_language) +[6]: https://www.toptal.com/c/after-all-these-years-the-world-is-still-powered-by-c-programming +[7]: https://opensource.com/article/19/5/how-write-good-c-main-function +[8]: https://en.wikipedia.org/wiki/Dynamic_linker +[9]: http://www.opengroup.org/onlinepubs/009695399/functions/printf.html +[10]: https://en.wikipedia.org/wiki/C_standard_library +[11]: http://man7.org/linux/man-pages/man3/getopt.3.html +[12]: https://www.python.org/dev/peps/pep-0275/ +[13]: https://www.python.org/dev/peps/pep-3103/ +[14]: https://www.gnu.org +[15]: https://en.wikipedia.org/wiki/Man_page +[16]: http://man7.org/linux/man-pages/man1/ps.1.html +[17]: https://docs.python.org/3/library/sys.html +[18]: https://docs.python.org/2/library/getopt.html +[19]: https://docs.python.org/2/library/optparse.html +[20]: https://docs.python.org/3/library/argparse.html +[21]: https://en.wikipedia.org/wiki/Boilerplate_code +[22]: https://www.python.org/dev/peps/pep-0206/ +[23]: https://click.palletsprojects.com/en/7.x/ +[24]: https://wiki.python.org/moin/PythonDecorators +[25]: https://typer.tiangolo.com +[26]: https://docs.python.org/3/library/typing.html +[27]: https://en.wikipedia.org/wiki/Don%27t_repeat_yourself +[28]: https://pybit.es/guest-exploring-python-clis.html diff --git a/published/202006/20200602 Linux Lite 5.0 Released With UEFI Support - Other Major Improvements.md b/published/202006/20200602 Linux Lite 5.0 Released With UEFI Support - Other Major Improvements.md new file mode 100644 index 0000000000..f17baf1796 --- /dev/null +++ b/published/202006/20200602 Linux Lite 5.0 Released With UEFI Support - Other Major Improvements.md @@ -0,0 +1,128 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12287-1.html) +[#]: subject: (Linux Lite 5.0 Released With UEFI Support & Other Major Improvements) +[#]: via: (https://itsfoss.com/linux-lite-5-release/) +[#]: author: (Ankush Das https://itsfoss.com/author/ankush/) + +Linux Lite 5.0 发布,带有 UEFI 支持和其他重大改进 +====== + +Linux Lite 是[适合 Windows 用户的最佳 Linux 发行版][1]之一。 不仅限于此,它还是最受欢迎的[轻量级 Linux 发行版][2]之一。 + +基于 Ubuntu 18.04 的 Linux Lite 4.x 系列虽然不错,但没有 [UEFI 支持][3]。 但是现在基于 [Ubuntu 20.04][4] 的 Linux Lite 5.0 终于来了,我很高兴看到这些变化! + +在本文中,我们将介绍 Linux Lite 5.0 的新增功能。 + +### Linux Lite 5.0:关键变更 + +![][5] + +即使 Linux Lite 从 2.x 就开始支持 UEFI,但他们总是默认发布非 UEFI 的。 + +但是,在 Linux Lite 5.0 中,他们终于增加了开箱即用的 [UEFI][3] 默认支持以及许多重大改进。让我们看看发生了什么变化: + +#### UEFI 支持 + +Linux Lite 5.0 支持开箱即用的 UEFI。但是,他们建议禁用[安全启动][6],即使该功能可以工作。 + +![][7] + +你可以看看他们的[论坛文章][8],以了解更多信息。此外,你还可以在新的内置**帮助手册**中找到有关此的更多信息。 + +#### 基于 Ubuntu 的发行版,没有隐藏的遥测 + +如果你正在寻找基于 Ubuntu 的 Linux 发行版,且没有任何隐藏的遥测功能,那么 Linux Lite 5.0 似乎是理想的选择。 + +在[发布公告][9]中,他们在变更日志中提到了它,并提供了截图: + +![][10] + +#### GUFW 防火墙替换为 firewalld + +你可能已经读过[在 Linux 上使用 GUFW 设置防火墙][11],但从 Linux Lite 5.0 开始,它已由 [firewalld][12] 取代。 + +![][13] + +似乎 [GUFW][14] 不能像 firewalld 那样配置。因此,他们决定替换它。 + +默认情况下,它是禁用的。但是,你可以按照**帮助手册**中的教程选择启用它。 + +#### 新的 Whisker 菜单 + +![][15] + +[Whisker 菜单][16]已更新至最新可用的软件包(v2.4.4)。 除了更新之外,你还可以注意到**安装更新**现在被固定在收藏夹。 + +#### HiDPI 设置 + +![][17] + +如果需要,你会发现从**设置菜单**中设置 HiDPI 非常容易。 + +#### 已添加 XFCE 屏幕保护程序 + +在 Linux Lite 5.0 中,你还将注意到添加了 [XFCE 屏幕保护程序][18],默认情况下它处于禁用状态。 + +![][19] + +这是一个简单的补充,对于一直想要屏幕保护程序并能够对其进行调整的用户而言,这将很有用。 + +### 其他重要改进 + +除了上面提到的关键要点外,还有其他一些改进对于 Linux Lite 5.0 用户而言应该是很方便的。我在这里列出其中一些: + + * [Mousepad][20] 替换 [Leafpad][21] + * 新的更新通知 + * 在即时启动时进行完整性检查 + * 对**帮助手册**的重大改进 + * Lite 软件中用 Chrome 取代了 Chromium + * 新的布局选项 + * Lite 欢迎页面和 Lite 用户管理器现在更新到 GTK3 和 Python3。 + * 欢迎页面添加了新的选择:**选择深色或浅色主题、UEFI 和安全启动、反馈** + * 改进的 Lite 小部件 + +如果你想进一步了解更改,可以在其[官方公告][9]中找到详细的更改列表。 + +### 总结 + +我认为 Linux Lite 5.0 比以往任何时候要好,并且随着最近新增的功能,对于许多新 Linux 用户来说,它也是一个绝佳的选择。 + +你如何看待 Linux Lite 5.0?在下面的评论中让我知道你的想法。 + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/linux-lite-5-release/ + +作者:[Ankush Das][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://itsfoss.com/author/ankush/ +[b]: https://github.com/lujun9972 +[1]: https://itsfoss.com/windows-like-linux-distributions/ +[2]: https://itsfoss.com/lightweight-linux-beginners/ +[3]: https://help.ubuntu.com/community/UEFI +[4]: https://itsfoss.com/ubuntu-20-04-release-features/ +[5]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/06/linux-lite-5.jpg?ssl=1 +[6]: https://en.wikipedia.org/wiki/Hardware_restriction#Secure_boot +[7]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/06/linux-lite-uefi.png?ssl=1 +[8]: https://www.linuxliteos.com/forums/uefi-secure-boot/ +[9]: https://www.linuxliteos.com/forums/release-announcements/linux-lite-5-0-final-released/ +[10]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/06/linux-lite-5-telemetry.png?ssl=1 +[11]: https://itsfoss.com/set-up-firewall-gufw/ +[12]: https://firewalld.org/ +[13]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/06/linux-lite-5-firewall.jpg?ssl=1 +[14]: http://gufw.org/ +[15]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/06/whisker-menu-linux-lite.jpg?ssl=1 +[16]: https://gottcode.org/xfce4-whiskermenu-plugin/ +[17]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/06/linux-lite-5-hidpi.png?ssl=1 +[18]: https://docs.xfce.org/apps/screensaver/start +[19]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/06/linux-lite-5-screensaver.jpg?ssl=1 +[20]: https://salsa.debian.org/xfce-team/apps/mousepad +[21]: https://tarot.freeshell.org/leafpad/ diff --git a/published/202006/20200602 Using pandas to plot data in Python.md b/published/202006/20200602 Using pandas to plot data in Python.md new file mode 100644 index 0000000000..f51dd2f1e1 --- /dev/null +++ b/published/202006/20200602 Using pandas to plot data in Python.md @@ -0,0 +1,133 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12333-1.html) +[#]: subject: (Using pandas to plot data in Python) +[#]: via: (https://opensource.com/article/20/6/pandas-python) +[#]: author: (Shaun Taylor-Morgan https://opensource.com/users/shaun-taylor-morgan) + +使用 Pandas 在 Python 中绘制数据 +====== + +> Pandas 是一个非常流行的 Python 数据操作库。学习怎样使用它的 API 绘制数据。 + +![](https://img.linux.net.cn/data/attachment/album/202006/19/231720ed0jd9s99h9cute7.jpg) + +在有关基于 Python 的绘图库的系列文章中,我们将对使用 Pandas 这个非常流行的 Python 数据操作库进行绘图进行概念性的研究。Pandas 是 Python 中的标准工具,用于对进行数据可扩展的转换,它也已成为[从 CSV 和 Excel 格式导入和导出数据][2]的流行方法。 + +除此之外,它还包含一个非常好的绘图 API。这非常方便,你已将数据存储在 Pandas DataFrame 中,那么为什么不使用相同的库进行绘制呢? + +在本系列中,我们将在每个库中制作相同的多条形柱状图,以便我们可以比较它们的工作方式。我们使用的数据是 1966 年至 2020 年的英国大选结果: + +![Matplotlib UK election results][3] + +### 自行绘制的数据 + +在继续之前,请注意你可能需要调整 Python 环境来运行此代码,包括: + +* 运行最新版本的 Python(用于 [Linux][4]、[Mac][5] 和 [Windows][6] 的说明) +* 确认你运行的是与这些库兼容的 Python 版本 + +数据可在线获得,并可使用 Pandas 导入: + +``` +import pandas as pd +df = pd.read_csv('https://anvil.works/blog/img/plotting-in-python/uk-election-results.csv') +``` + +现在我们已经准备好了。在本系列文章中,我们已经看到了一些令人印象深刻的简单 API,但是 Pandas 一定能夺冠。 + +要在 x 轴上绘制按年份和每个党派分组的柱状图,我只需要这样做: + +``` +import matplotlib.pyplot as plt +ax = df.plot.bar(x='year') +plt.show() +``` + +只有四行,这绝对是我们在本系列中创建的最棒的多条形柱状图。 + +我以[宽格式][7]使用数据,这意味着每个党派都有一列: + +``` + year conservative labour liberal others +0 1966 253 364 12 1 +1 1970 330 287 6 7 +2 Feb 1974 297 301 14 18 +.. ... ... ... ... ... +12 2015 330 232 8 80 +13 2017 317 262 12 59 +14 2019 365 202 11 72 +``` + +这意味着 Pandas 会自动知道我希望如何分组,如果我希望进行不同的分组,Pandas 可以很容易地[重组 DataFrame][8]。 + +与 [Seaborn][9] 一样,Pandas 的绘图功能是 Matplotlib 之上的抽象,这就是为什么要调用 Matplotlib 的 `plt.show()` 函数来实际生成绘图的原因。 + +看起来是这样的: + +![pandas unstyled data plot][10] + +看起来很棒,特别是它又这么简单!让我们对它进行样式设置,使其看起来像 [Matplotlib][11] 的例子。 + +#### 调整样式 + +我们可以通过访问底层的 Matplotlib 方法轻松地调整样式。 + +首先,我们可以通过将 Matplotlib 颜色表传递到绘图函数来为柱状图着色: + +``` +from matplotlib.colors import ListedColormap +cmap = ListedColormap(['#0343df', '#e50000', '#ffff14', '#929591']) +ax = df.plot.bar(x='year', colormap=cmap) +``` + +我们可以使用绘图函数的返回值设置坐标轴标签和标题,它只是一个 [Matplotlib 的 Axis 对象][12]。 + +``` +ax.set_xlabel(None) +ax.set_ylabel('Seats') +ax.set_title('UK election results') +``` + +这是现在的样子: + +![pandas styled plot][13] + +这与上面的 Matplotlib 版本几乎相同,但是只用了 8 行代码而不是 16 行!我内心的[代码高手][14]非常高兴。 + +### 抽象必须是可转义的 + +与 Seaborn 一样,向下访问 Matplotlib API 进行细节调整的能力确实很有帮助。这是给出抽象[紧急出口][15]使其既强大又简单的一个很好的例子。 + + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/6/pandas-python + +作者:[Shaun Taylor-Morgan][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/shaun-taylor-morgan +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/panda.png?itok=0lJlct7O (Two pandas sitting in bamboo) +[2]: https://anvil.works/docs/data-tables/csv-and-excel +[3]: https://opensource.com/sites/default/files/uploads/matplotlib_2.png (Matplotlib UK election results) +[4]: https://opensource.com/article/20/4/install-python-linux +[5]: https://opensource.com/article/19/5/python-3-default-mac +[6]: https://opensource.com/article/19/8/how-install-python-windows +[7]: https://anvil.works/blog/tidy-data +[8]: https://anvil.works/blog/tidy-data#converting-between-long-and-wide-data-in-pandas +[9]: https://anvil.works/blog/plotting-in-seaborn +[10]: https://opensource.com/sites/default/files/uploads/pandas-unstyled.png (pandas unstyled data plot) +[11]: https://opensource.com/article/20/5/matplotlib-python +[12]: https://matplotlib.org/api/axis_api.html#axis-objects +[13]: https://opensource.com/sites/default/files/uploads/pandas_3.png (pandas styled plot) +[14]: https://en.wikipedia.org/wiki/Code_golf +[15]: https://anvil.works/blog/escape-hatches-and-ejector-seats +[16]: https://anvil.works/blog/plotting-in-pandas \ No newline at end of file diff --git a/published/202006/20200602 Using the Lightweight Apt Package Manager Synaptic in Ubuntu and Other Debian-based Linux Distributions.md b/published/202006/20200602 Using the Lightweight Apt Package Manager Synaptic in Ubuntu and Other Debian-based Linux Distributions.md new file mode 100644 index 0000000000..3a33690599 --- /dev/null +++ b/published/202006/20200602 Using the Lightweight Apt Package Manager Synaptic in Ubuntu and Other Debian-based Linux Distributions.md @@ -0,0 +1,174 @@ +[#]: collector: (lujun9972) +[#]: translator: (robsean) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12353-1.html) +[#]: subject: (Using the Lightweight Apt Package Manager Synaptic in Ubuntu and Other Debian-based Linux Distributions) +[#]: via: (https://itsfoss.com/synaptic-package-manager/) +[#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/) + +在 Ubuntu 中使用轻量的 Apt 软件包管理器 Synaptic +====== + +![](https://img.linux.net.cn/data/attachment/album/202006/26/220622uh75qnmmzgh58lpv.jpg) + +这周推荐的开源软件是 Synaptic。学习这个经过时光积淀的软件包管理器能做哪些现代软件管理器做不到的事情。 + +### Synaptic 软件包管理器是什么? + +[Synaptic][1] 是一个轻量级的 [apt 软件包管理器系统][2]的 GUI 前端,使用在 Debian、Ubuntu、Linux Mint 以及其它很多基于 Debian/Ubuntu 发行版中。 + +总的来说,所有你可以 [在终端中使用 apt-get 命令][3] 来做的事,都可以通过 Synaptic 来实现。 + +![][4] + +曾几何时,Synaptic 几乎是所有基于 Debian Linux 发行版的默认图形化软件包管理器。它被认为是一种用户友好的、易于使用的管理应用程序的方法。 + +随着像 [GNOME “软件”][5] 和 [KDE “发现”][6] 等现代软件包管理器工具带来更现代和直观的图形用户界面,事情发生了变化。这些软件包管理器有更好的界面,以一种更友好的方式显示软件包信息,带有缩略图、评分和评论。 + +最后,Synaptic [的使用被局限于在大多数的轻量级 Linux 发行版][7] 中。 + +#### 为什么你要使用像 Synaptic 软件包管理器这样的 “古老的” 软件? + +当然,在多大数的情况下,你没有必要这样做。 + +但是,Synaptic 仍然比 GNOME “软件” 的功能要很多。记住,它基本上是 `apt` 的 GUI 前端,这意味着它(几乎)可以做任何你能够 [在终端中使用 apt 命令][8] 所做的事。 + +例如,如果你想 [在 Ubuntu 中阻止特定的软件包更新][9],你可以在 Synaptic 中做到这一点,但是你却不能 GNOME/Ubuntu 的软件中心中实现。 + +![][10] + +另外,我注意到 Ubuntu 20.04 的软件中心存在一些问题。它加载速度缓慢,它搜索软件包时缓慢,并且它充满了 snap 应用程序(不是每个人都喜欢)。 + +Synaptic 也是 [Ubuntu 中一个轻量级应用程序][7],使用可以可以让你感觉你的系统快一点。 + +#### Synaptic 软件包管理器的功能 + +下面是对 Synaptic 的概况: + + * 更新软件包缓存 + * 升级整个系统 + * 管理软件包包存储库 + * 通过名称、描述、维护者、版本、依赖项等搜索软件包 + * 通过组、状态(安装与否)、源或更多信息列出软件包 + * 通过名称、状态、大小或版本排序软件包 + * 获取与软件包相关的信息 + * 锁定软件包版本 + * 安装指定版本的软件包 + +还有很多功能,大家可以自己去探索。 + +### 如何在 Ubuntu 上安装 Synaptic 软件包管理器 + +Synaptic 软件包管理器可在 Ubuntu 的 Universe 存储库中获得。如果 Universe 存储库未启用,你可以在软件中心中找到Synaptic: + +![Synaptic 在 Ubuntu 软件中心][11] + +你也可以通过命令行来安装 Synaptic 。先确保启用 universe 存储库: + +``` +sudo add-apt-repository univers +``` + +然后更新缓存(在 Ubuntu 18.04 及更高版本中不需要): + +``` +sudo apt update +``` + +现在,使用下面的命令来安装 synaptic 软件包管理器: + +``` +sudo apt install synaptic +``` + +这就是所有的安装过程。 + +### 如何使用 Synaptic 软件包管理器 + +在安装后,你可以在菜单中开始搜索 Synaptic 并启动它: + +![][12] + +可以看到,这个界面不是最好看的界面之一。注意复选框的颜色。白色意味着软件包未安装,绿色意味软件包已安装。 + +![][4] + +你可以搜索一个应用程序并单击复选框将标记其为安装。它也将(以绿色的形式)高亮将被作为依赖关系项目的软件包。单击应用来安装选择的软件包: + +![][13] + +你可以使用 Synaptic [查看在 Ubuntu 中安装的所有软件包][14] 。你也可以从这个视图中选择移除软件包。 + +![][15] + +你可以根据源显示各个存储库中可用的软件包。这是查看 [哪个 PPA 提供什么软件包][16]的好方法。你可以通过如上所述的方法来安装或移除软件包。 + +![][17] + +通常,当你更新 Ubuntu 时,所有的软件包都会同时更新。使用 Synaptic,你可以轻松地选择你需要更新/升级到较新版本的软件包。 + +![][18] + +你也可以锁定软件包的版本,以便它们就不会随着系统更新而被更新。 + +![][10] + +你也可以使用 Synaptic 搜索软件包。这类似于 [使用 apt-cache search 命令搜索软件包][19]。 + +![][20] + +如果你认为你做了错误的选择,你可以从“编辑”菜单中单击撤销。 + +你可以使用 Synaptic 做很多事,我无法涵盖所有可能的用法。我在这里已经涵盖了最常见的一些方法,如果你将要去使用 Synaptic 的话,我留给你去探索。 + +### Synaptic 并不适合所有的人 + +如果你不喜欢 Synaptic,你可以在软件中心中移除它,或在终端中使用这个命令: + +``` +sudo apt remove synaptic +``` + +Ubuntu 还有另一个被称为 [AppGrid][21] 的轻量级软件包管理器。据我所知,它已经有一段时间没有更新了。 + +Synaptic 当然并不适合所有的人。它列出了你在常规软件中心中看不到的库和包。如果你移除了一个你不知道的库,那么它可能会引起问题。 + +我认为 Synaptic 更适合于中高级用户,他们既想更好地控制软件包管理器又不想使用命令行方法。 + +你有什么要说的吗?你使用过 Synaptic 软件包管理器吗?你是使用软件中心还是你只在终端中探索?请在评论区中分享你的喜好。 + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/synaptic-package-manager/ + +作者:[Abhishek Prakash][a] +选题:[lujun9972][b] +译者:[robsean](https://github.comrobsean) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://itsfoss.com/author/abhishek/ +[b]: https://github.com/lujun9972 +[1]: https://www.nongnu.org/synaptic/ +[2]: https://en.wikipedia.org/wiki/APT_(software) +[3]: https://itsfoss.com/apt-get-linux-guide/ +[4]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/06/synaptic-interface.png?ssl=1 +[5]: https://wiki.gnome.org/Apps/Software +[6]: https://userbase.kde.org/Discover +[7]: https://itsfoss.com/lightweight-alternative-applications-ubuntu/ +[8]: https://itsfoss.com/apt-command-guide/ +[9]: https://itsfoss.com/prevent-package-update-ubuntu/ +[10]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/06/lock-version-synaptic.png?ssl=1 +[11]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/06/synaptic-ubuntu-software-center.png?ssl=1 +[12]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/06/synaptic-package-manager-ubuntu.jpg?ssl=1 +[13]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/06/install-packages-in-synaptic.png?ssl=1 +[14]: https://itsfoss.com/list-installed-packages-ubuntu/ +[15]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/06/remove-packages-using-synaptic.png?ssl=1 +[16]: https://itsfoss.com/ppa-guide/ +[17]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/06/see-packages-by-repositories-synaptic.png?ssl=1 +[18]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/06/upgrade-packages-synaptic.png?ssl=1 +[19]: https://itsfoss.com/apt-search-command/ +[20]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/06/search-results-synaptic.png?ssl=1 +[21]: https://itsfoss.com/app-grid-lighter-alternative-ubuntu-software-center/ diff --git a/published/202006/20200604 Devuan Beowulf 3.0 is the Latest Stable Release Based on Debian 10.4 Buster (and Free From systemd).md b/published/202006/20200604 Devuan Beowulf 3.0 is the Latest Stable Release Based on Debian 10.4 Buster (and Free From systemd).md new file mode 100644 index 0000000000..14d4670ffe --- /dev/null +++ b/published/202006/20200604 Devuan Beowulf 3.0 is the Latest Stable Release Based on Debian 10.4 Buster (and Free From systemd).md @@ -0,0 +1,97 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12308-1.html) +[#]: subject: (Devuan Beowulf 3.0 is the Latest Stable Release Based on Debian 10.4 Buster) +[#]: via: (https://itsfoss.com/devuan-3-release/) +[#]: author: (Ankush Das https://itsfoss.com/author/ankush/) + +没有 systemd 的 Devuan Beowulf 3.0 发布 +====== + +[Devuan GNU+Linux][1] 是 [Debian][2] 的分支,它不含有 [systemd][3]。如果你想知道 systemd 有什么问题,我们可以改天再讨论这个话题。 + +不过,如果你想要一个没有 systemd 的 Linux 发行版,那么 Devuan Beowulf 3.0 的发布对你来说应该是个好消息。 + +### Devuan Beowulf 3.0 有什么新增功能? + +![](https://img.linux.net.cn/data/attachment/album/202006/12/112455y003411l1k8yykp0.jpg) + +Devuan 通常因其提供了替代性的[初始化][5]系统(如 [SysV][6])而受到喜爱。 + +在本文中,我们将介绍 Devuan Beowulf 3.0 中的主要亮点。 + +#### 基于 Debian 10.4 Buster + +[Debian 10 Buster][7] 无疑是一款令人印象深刻的发行版系列,它的最新版本是 Debian 10.4。 + +而 Devuan Beowulf 3.0,是基于最新的 Debian 10.4 Buster 更新版本的。如果你不了解,可以查看 [Debian 10.4 Buster 的官方公告][8],以了解更多信息。 + +#### Linux Kernel 4.19 + +在它的最新版本中装有 [Linux Kernel 4.19 LTS][9] 也是一个很好的加分项。 + +当然,这不是最新的内核,因为我们身处 “Debian 领域”,这里的事物并非总是最新的,但更加稳定。这个新内核应该可以解决以前版本中可能遇到的几个问题。 + +#### 支持 ppc64el 架构 + +对 [ppc64el][10] 的支持在大多数时候都不是大事,但支持 PowerPC 和 Power ISA 处理器是一个优势。 + +顺便提一句,Devuan GNU+Linux 已经支持 i386、amd64、armel、armhf 和 arm64 架构。 + +#### 添加 runit 和 OpenRC 作为可选项 + +想要更多替代的的初始化系统吗?现在最新版本中可选 [runit][11] 和 [openrc][12]。 + +#### 其他变化 + +除了上面的这样亮点外,你还可以发现它添加了独立守护进程 [eudev][13] 和 [elogind][14]。 + +启动页面、显示管理器和桌面主题也有了细微的变化。例如,启动菜单显示的是 “Debian” 而不是 “Devuan”。 + +如果你想了解有关 Devuan Beowulf 3.0.0 变更的更多技术详细信息,那么可以查看[官方发行说明][15]。 + +> 花絮 +> +> Devuan 的发布版本以小行星命名。Beowulf 是一个[编号为 38086 的小行星][16]。 + +### 总结 + +最新稳定版本的 Devuan Beowulf 3.0 是提供无 systemd 的发行版的很好的进展。 + +如果你想支持 Devuan 项目,请[在财务上为他们的项目捐款][17]或[通过其他方式][18]。 + +你觉得这个版本怎么样?请在下面评论让我知道你的想法! + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/devuan-3-release/ + +作者:[Ankush Das][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://itsfoss.com/author/ankush/ +[b]: https://github.com/lujun9972 +[1]: https://devuan.org +[2]: https://www.debian.org +[3]: https://en.wikipedia.org/wiki/Systemd +[4]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/06/devuan-beowulf.jpg?ssl=1 +[5]: https://en.wikipedia.org/wiki/Init +[6]: https://wiki.archlinux.org/index.php/SysVinit +[7]: https://itsfoss.com/debian-10-buster/ +[8]: https://www.debian.org/News/2020/20200509 +[9]: https://itsfoss.com/linux-kernel-4-19-lts-release/ +[10]: https://en.wikipedia.org/wiki/Ppc64 +[11]: https://en.wikipedia.org/wiki/Runit +[12]: https://en.wikipedia.org/wiki/OpenRC +[13]: https://wiki.gentoo.org/wiki/Eudev +[14]: https://wiki.gentoo.org/wiki/Elogind +[15]: https://files.devuan.org/devuan_beowulf/Release_notes.txt +[16]: https://en.wikipedia.org/wiki/Meanings_of_minor_planet_names:_38001%E2%80%9339000#086 +[17]: https://devuan.org/os/donate +[18]: https://dev1galaxy.org/viewtopic.php?pid=1380#p1380 diff --git a/published/202006/20200604 How to Install Nvidia Drivers on Fedora Linux.md b/published/202006/20200604 How to Install Nvidia Drivers on Fedora Linux.md new file mode 100644 index 0000000000..724a854583 --- /dev/null +++ b/published/202006/20200604 How to Install Nvidia Drivers on Fedora Linux.md @@ -0,0 +1,131 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12301-1.html) +[#]: subject: (How to Install Nvidia Drivers on Fedora Linux) +[#]: via: (https://itsfoss.com/install-nvidia-drivers-fedora/) +[#]: author: (John Paul https://itsfoss.com/author/john/) + +如何在 Fedora Linux 中安装 Nvidia 驱动 +====== + +![](https://img.linux.net.cn/data/attachment/album/202006/10/094702c7of7scjyucmc5f1.jpg) + +与大多数 Linux 发行版一样,[Fedora][1] 并未默认安装专有的 [Nvidia][2] 驱动。 + +默认的开源 [Nouveau 驱动][3]在大多数情况下都可以使用,但是你可能会遇到屏幕撕裂等问题。 + +![Display issue in Fedora with Nouveau graphics driver][4] + +如果遇到此类图形/视频问题,那么可能需要在 Fedora 中安装官方专有的 Nvidia 驱动。让我告诉你如何安装。 + +### 在 Fedora 中安装 Nvidia 驱动 + +我在本教程中使用 [Fedora 32][5],但它应适用于其他 Fedora 版本。 + +#### 步骤 1 + +在做其他任何操作之前,请先确保你的系统是最新的。你可以使用软件中心,也可以在终端中使用以下命令: + +``` +sudo dnf update +``` + +#### 步骤 2 + +由于 Fedora 没有提供 Nvidia 驱动,因此你需要在系统中添加 [RPMFusion 仓库][6]。你可以在终端中使用以下命令: + +``` +sudo dnf install https://download1.rpmfusion.org/free/fedora/rpmfusion-free-release-$(rpm -E %fedora).noarch.rpm https://download1.rpmfusion.org/nonfree/fedora/rpmfusion-nonfree-release-$(rpm -E %fedora).noarch.rpm +``` + +> 不喜欢终端么?那使用 GUI 的方法添加 RPMFusion 仓库。 +> +> 如果你使用 Firefox,那么还可以从浏览器添加 RPMFusion 仓库。进入这个[配置页面][7],然后向下滚动到 “Graphical Setup via Firefox web browser”。单击自由和非自由仓库的链接。这将下载 .rpm 文件,并安装仓库。 +> +> ![RPMFusion Browser Installation][8] +> +> 你可以双击下载的 RPM 文件进行安装。 +> +> ![RPMFusion in the Software Center][9] + +#### 步骤 3 + +现在,你需要确定 [Linux 系统中有哪些显卡(或芯片)][10]。打开终端并输入以下命令: + +``` +lspci -vnn | grep VGA +``` + +![Video Card Lookup in Fedora][11] + +接下来,你需要查找与该芯片对应的驱动。你可以在[此处][12]找到 Nvidia 芯片的列表。你也可以使用[此工具][13]搜索设备。 + +**注意**:请记住,即使 Nvidia 列表显示了更多驱动,但也只有三个驱动可以安装。Nvidia 驱动支持最新的显卡。nvidia-390 和 nvidia-340 驱动支持旧设备。 + +#### 步骤 4 + +要安装所需的驱动,请在终端中输入以下一个命令。下面的命令是用于我的显卡的命令。根据你的系统相应调整。 + +``` +sudo dnf install akmod-nvidia sudo dnf install xorg-x11-drv-nvidia-390xx akmod-nvidia-390xx sudo dnf install xorg-x11-drv-nvidia-340xx akmod-nvidia-340xx +``` + +![Nvidia terminal installation][14] + +#### 步骤 5 + +要使更改生效,请重启系统。你的系统重启可能需要比较长的时间,因为它将 Nvidia 驱动注入到 Linux 内核中。 + +重启并登录系统后,你会看到更好的视觉效果,并且不会出现屏幕撕裂的情况。 + +![Fedora with Nvidia drivers][15] + +### 额外的提示 + +这是可选步骤,但建议这样做。添加 RPMFusion 仓库时,你可以访问常规仓库中不可用的多媒体包。 + +此命令将为使用 [gstreamer][16] 的应用安装软件包: + +``` +sudo dnf groupupdate multimedia --setop="install_weak_deps=False" --exclude=PackageKit-gstreamer-plugin +``` + +此命令将安装声音和视频软件包所需的包: + +``` +sudo dnf groupupdate sound-and-video +``` + +希望本教程对在 Fedora 上安装 Nvidia 驱动很有用。 + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/install-nvidia-drivers-fedora/ + +作者:[John Paul][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://itsfoss.com/author/john/ +[b]: https://github.com/lujun9972 +[1]: https://getfedora.org/ +[2]: https://www.nvidia.com/en-us/ +[3]: https://en.wikipedia.org/wiki/Nouveau_(software) +[4]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/05/fedora-nouveau.jpg?resize=800%2C500&ssl=1 +[5]: https://itsfoss.com/fedora-32/ +[6]: https://rpmfusion.org/RPM%20Fusion +[7]: https://rpmfusion.org/Configuration +[8]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/05/rpmfusion-gui-install.png?resize=800%2C500&ssl=1 +[9]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/05/rpmfusion-gui-install2.png?resize=800%2C500&ssl=1 +[10]: https://itsfoss.com/check-graphics-card-linux/ +[11]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/06/video-card-lookup-fedora.png?ssl=1 +[12]: https://us.download.nvidia.com/XFree86/Linux-x86/367.57/README/supportedchips.html +[13]: https://www.nvidia.com/Download/index.aspx?lang=en-us +[14]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/05/nvidia-cli-install.png?resize=800%2C500&ssl=1 +[15]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/05/fedora-nvidia.jpg?resize=800%2C500&ssl=1 +[16]: https://en.wikipedia.org/wiki/GStreamer diff --git a/published/202006/20200604 How to generate an EPUB file on Fedora.md b/published/202006/20200604 How to generate an EPUB file on Fedora.md new file mode 100644 index 0000000000..021271376f --- /dev/null +++ b/published/202006/20200604 How to generate an EPUB file on Fedora.md @@ -0,0 +1,112 @@ +[#]: collector: (lujun9972) +[#]: translator: (robsean) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12313-1.html) +[#]: subject: (How to generate an EPUB file on Fedora) +[#]: via: (https://fedoramagazine.org/how-to-generate-an-epub-file-on-fedora/) +[#]: author: (John Paul Wohlscheid https://fedoramagazine.org/author/johnblood/) + +如何在 Fedora 上生成 EPUB 电子书 +====== + +![][1] + +在智能手机上阅读内容正在变得越来越流行。每一部手机都有它自己的电子书阅读器。可能你不知道,在 Fedora 创建你自己的电子书文件是非常容易的。 + +这篇文章展示了使用两种不同的方法来创建一个 [EPUB][2] 文件。EPUB 格式是最流行的格式之一,并且被很多开源软件所支持。 + +绝大数的人们将会询问 “在很容易创建 PDF 文件的情况下,为什么要花费时间和精力来创建 EPUB 文件?” 答案是: “你曾经尝试看过每次只能看到一张纸的一小部分的吗?”为阅读一个 PDF 文件,你不得不经常缩放和移动文档,或者将其缩放到一个小尺寸来适合屏幕大小。在另一方面,EPUB 文件则被设计成可以适合很多不同的屏幕类型。 + +### 方法 1: ghostwriter 和 pandoc + +第一种方法创建一个速成版的电子书文件。它使用一个名为 [ghostwriter][3] 的 Markdown 编辑器,和一个名为 [pandoc][4] 的命令行文档转换工具。 + +你可以从软件中心搜查和安装它们,也可以从终端中安装它们。如果你使用终端来安装它们,运行这个命令: + +``` +sudo dnf install pandoc ghostwriter +``` + +对于那些不知道 [Markdown][5] 是什么的人们来说,在这里有一个简要的解释:它是一个大约在 15 年前创建的简单的标记语言。它使用简单的语法来格式化纯文本。Markdown 文件可以随后转换成很多其它文档格式的文件。 + +![ghostwriter][6] + +对于工具,ghostwriter 是一个跨平台的易于使用的 Markdown 编辑器。pandoc 是一个非常易于使用的文档转换工具,可以处理数百种不同的格式。 + +要创建你的电子书,打开 ghostwriter,开始编写你的文档。如果你以前使用过 Markdown,你可能习惯于在文档的“标题 1”的前面放置一个 `#` 符号来作为标题。像这样: `# My Man Jeeves`。然而,pandoc 将不会识别其为标题,并将在你的电子书的顶部放置一个一个大的 “UNTITLED” 。相反地在你的标题前放置一个 `%` 来作为标题。例如,`% My Man Jeeves` 。章节应该被格式为“标题 2”,例如,`## Leave It to Jeeves`。如果你有子章节,使用“标题 3”(`###`)。 + +![][7] + +在你的文档完成后,单击“文件 -> 导出”(或按 `Ctrl+E` 键)。在对话框中,在几个 Markdown 转换器中进行选择。如果这是你第一次使用 ghostwriter ,默认选择的是 Sundown 转换器。从对话框中,选择 pandoc 。接下来单击“导出”。现在你的 EPUB 文件已经创建好了。 + +![ghostwriter 导出对话框][8] + +注意: 如果你得到一个与 pandoc 有关的错误,关闭“智能排版”,并再试一次。 + +### 方法 2: calibre + +如果你想要一个更完美的电子书,那这就是你正在寻找的方法。它需要更多的步骤,但是是值得的。 + +![][9] + +首先,安装一个名为 [calibre][10] 的应用程序。calibre 不仅仅是一个电子书阅读器,它也是一个电子书管理器系统。你可以从软件中心安装它,也可以从终端安装它: + +``` +sudo dnf install calibre +``` + +在这个方法中,你可以在 LibreOffice、ghostwriter,或者其它你选择的编辑器中编写你的文档。确保书籍的标题被格式为“标题 1”,章节被格式为“标题 2”,子章节被格式为“标题 3”。 + +接下来,导出你的文档为一个 HTML 文件。 + +现在添加该文件到 calibre 。打开 calibre ,并单击 “添加书籍”。calibre 会用几秒钟来添加文件。 + +![][11] + +在文件导入后,通过单击 “编辑元数据” 按钮来编辑文件的元数据。在这里你可以填写书的标题和作者的姓名。你也可以上传一个封面图片(如果你有的话),或者 calibre 将为你生成一个封面。 + +![][12] + +接下来,单击 “转换书籍” 按钮。在新的对话框中,选择 “界面与外观” 部分的 “布局” 标签页。勾选 “删除段间空行” 选项。这将更加严格地缩进每一段的内容。 + +![][13] + +现在,设置目录。选择 “内容目录” 部分。这里有三个需要注意的选项: “一级目录”、“二级目录” 和 “三级目录”。对于每一个选项点击其末尾处的魔法棒按钮。在新的对话框中,选择应用于目录表项的 HTML 标记。例如,为“一级目录”选择 “h1”。 + +![][14] + +接下来,告诉 calibre 包含内容目录。选择 “输出 EPUB” 部分并勾选 “插入内联目录”。单击“确定“ 创建 epub 文件。 + +![][15] + +现在,你有了一个看起来很专业的电子书文件。 + +-------------------------------------------------------------------------------- + +via: https://fedoramagazine.org/how-to-generate-an-epub-file-on-fedora/ + +作者:[John Paul Wohlscheid][a] +选题:[lujun9972][b] +译者:[robsean](https://github.com/robsean) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://fedoramagazine.org/author/johnblood/ +[b]: https://github.com/lujun9972 +[1]: https://fedoramagazine.org/wp-content/uploads/2020/05/epub-how_to-816x345.png +[2]: https://en.wikipedia.org/wiki/EPUB +[3]: https://github.com/wereturtle/ghostwriter +[4]: https://pandoc.org/ +[5]: https://fedoramagazine.org/applications-for-writing-markdown/ +[6]: https://fedoramagazine.org/wp-content/uploads/2020/05/ghostwriter-1024x640.jpg +[7]: https://fedoramagazine.org/wp-content/uploads/2020/05/ghostwriter-menu-1024x640.jpg +[8]: https://fedoramagazine.org/wp-content/uploads/2020/05/ghostwriter-export-1024x640.jpg +[9]: https://fedoramagazine.org/wp-content/uploads/2020/05/calibre-pre-1024x640.jpg +[10]: https://calibre-ebook.com/ +[11]: https://fedoramagazine.org/wp-content/uploads/2020/05/calibre-metadata-1024x640.jpg +[12]: https://fedoramagazine.org/wp-content/uploads/2020/05/calibre-lookandfeel-1024x640.jpg +[13]: https://fedoramagazine.org/wp-content/uploads/2020/05/calibre-toc2-1024x640.jpg +[14]: https://fedoramagazine.org/wp-content/uploads/2020/05/calibre-epub-output-1024x640.jpg +[15]: https://fedoramagazine.org/wp-content/uploads/2020/05/calibre-post-1024x640.jpg diff --git a/published/202006/20200604 Now You Can Buy Linux Certified Lenovo ThinkPad and ThinkStation (for the Best Possible Out of The Box Linux Experience).md b/published/202006/20200604 Now You Can Buy Linux Certified Lenovo ThinkPad and ThinkStation (for the Best Possible Out of The Box Linux Experience).md new file mode 100644 index 0000000000..7fed915dff --- /dev/null +++ b/published/202006/20200604 Now You Can Buy Linux Certified Lenovo ThinkPad and ThinkStation (for the Best Possible Out of The Box Linux Experience).md @@ -0,0 +1,89 @@ +[#]: collector: (lujun9972) +[#]: translator: (wxy) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12283-1.html) +[#]: subject: (Now You Can Buy Linux Certified Lenovo ThinkPad and ThinkStation (for the Best Possible Out of The Box Linux Experience)) +[#]: via: (https://itsfoss.com/lenovo-linux-certified/) +[#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/) + +现在你可以购买通过 Linux 认证的联想 ThinkPad 和 ThinkStation +====== + +曾经有一段时间,[ThinkPad][1] 是 Linux 用户的首选系统。但那是在 ThinkPad 还是 [IBM][2] 的产品的时候。当[联想在 2005 年收购了 IBM 的个人电脑业务][3]之后,(我觉得)事情开始发生了变化。 + +ThinkPad 曾经是一个令人惊叹的系列笔记本电脑,稳定可靠、值得信赖、坚如磐石,你只要问问 2010 年代以前用过它的人就知道了。 + +但在 2010 年前后,联想 ThinkPad 开始失去了它的魅力。它充满了一个又一个的问题,消费者们抱怨性能不佳。 + +而对于 Linux 用户来说,情况就更糟糕了。它的安全启动与 UEFI [给 Linux 用户带来了问题][4]。[与 Linux 的争论][5]就这样没完没了。 + +我为什么要回忆起这些?因为联想似乎正在努力提高 Linux 的兼容性。对于 Linux 爱好者来说,联想的最新公告是一个极好的消息。 + +### 联想 ThinkPad 和 ThinkStation 全系产品将通过 Linux 认证 + +![][6] + +联想[宣布][7],将对**全部工作站产品进行 Ubuntu 和红帽等顶级 Linux 发行版的认证**,这包括所有机型和配置。 + +作为 Linux 用户,这对你来说意味着什么?它意味着,如果你购买了联想电脑,你将获得**最好的开箱即用的 Linux 体验**。 + +等一下?不是可以随便在任何电脑上安装 Linux 吗,不管是联想还是幻想?当然,你可以。但是,当你把现有的(Windows)操作系统清除掉,自己安装 Linux 时,你可能会遇到硬件兼容性的问题,如没有声音、Wi-Fi 无法工作等。 + +开箱即用的体验很重要,因为并不是每个人都愿意花时间去修复声音、显卡、Wi-Fi 和蓝牙等问题,而不是专注于自己的实际工作,因为他们买电脑的目的就是为了这个。 + +来自 [Ubuntu][8] 和 Red Hat 的开发人员会对联想系统的每一个硬件组件进行测试和验证,以确保联想系统的每一个硬件组件都能正常工作。 + +### Ubuntu、Red Hat 以及更多 + +![][9] + +为此,联想选择了两款顶级 Linux 发行版。Red Hat 是企业级 Linux 桌面和服务器的热门选择。而 Ubuntu 当然是普遍流行的。 + +这意味着,联想的计算机在使用 Ubuntu LTS 版本和 Red Hat Linux 时,会以最佳状态工作。联想甚至会在其中预装 Ubuntu 和 Red Hat 两种版本的系统。 + +但是,这还没有结束。Fedora 是 Red Hat 的一个社区项目,联想也会在 ThinkPad P53 和 P1 Gen 2 系统上预装 Fedora。 + +有很多基于 Ubuntu LTS 版本的 Linux 发行版。大多数情况下,这些发行版在外观、应用和其他图形化的东西上都不一样,但它们使用的是与 Ubuntu 相同的基础。 + +这应该意味着,基于 Ubuntu 的发行版,如 Linux Mint、Elementary OS 等也会与联想的设备有更好的硬件兼容性。 + +联想还将这些设备驱动直接发送给上游的 Linux 内核中,帮助它们的系统在整个生命周期内都保持稳定性和兼容性。这一点是非常棒的。 + +### 它能帮助增加 Linux 用户群吗? + +开箱即用的体验很重要。它可以让你专注于系统上应该做的重要任务,而不是故障排除。 + +我有一台[预装了 Ubuntu 的戴尔 XPS 笔记本][10]。这是唯一一台几乎不需要从我这一端进行硬件故障排除的设备,即使我手动安装了其它基于 Ubuntu 的发行版,也不需要进行硬件故障排除。 + +我很高兴看到联想为提高 Linux 的兼容性做出了更多努力。现在在[预装 Linux 的电脑列表][11]中有了更多的选择。 + +我不知道联想在其计算机产品中提供 Linux 是否有助于增加 Linux 用户群。大多数时候人们都会要 Windows,Linux 不会成为首要关注点。 + +但联想在设备上让自己的计算机产品更多的使用 Linux,这一点还是值得称赞的。我希望其他厂商也能这样做。希望没有什么坏处:) + + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/lenovo-linux-certified/ + +作者:[Abhishek Prakash][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://itsfoss.com/author/abhishek/ +[b]: https://github.com/lujun9972 +[1]: https://en.wikipedia.org/wiki/ThinkPad +[2]: https://www.ibm.com/ +[3]: https://in.pcmag.com/laptops/38093/10-years-later-looking-back-at-the-ibm-lenovo-pc-deal +[4]: https://www.phoronix.com/scan.php?page=news_item&px=mtiyotg +[5]: https://www.engadget.com/2016-09-21-lenovo-pc-linux-trouble.html +[6]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/06/lenevo-linux-certified-systems.jpg?ssl=1 +[7]: https://news.lenovo.com/pressroom/press-releases/lenovo-brings-linux-certification-to-thinkpad-and-thinkstation-workstation-portfolio-easing-deployment-for-developers-data-scientists/ +[8]: https://ubuntu.com/ +[9]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/06/thinkpad-ubuntu.jpg?resize=800%2C582&ssl=1 +[10]: https://itsfoss.com/dell-xps-13-ubuntu-review/ +[11]: https://itsfoss.com/get-linux-laptops/ diff --git a/published/202006/20200604 Using AppImage for Linux package management.md b/published/202006/20200604 Using AppImage for Linux package management.md new file mode 100644 index 0000000000..ea7908af31 --- /dev/null +++ b/published/202006/20200604 Using AppImage for Linux package management.md @@ -0,0 +1,100 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12317-1.html) +[#]: subject: (Using AppImage for Linux package management) +[#]: via: (https://opensource.com/article/20/6/appimages) +[#]: author: (David Clinton https://opensource.com/users/dbclinton) + +使用 AppImage 进行 Linux 软件包管理 +====== + +> AppImage 在自足的环境中分发应用, 它适用于任何 Linux 发行版。 + +![](https://img.linux.net.cn/data/attachment/album/202006/15/140050aazux37axew7e0xk.jpg) + +管理 Linux 机器(尤其是远程机器)的一个重要分就是管理和安装软件。当本地应用程序出现问题时,或者文件系统上的某些文件损坏需要修复时,你通常会希望推送更新,而不必走很多路坐在物理屏幕前。正如我在 Pluralsight 课程《[Linux 系统维护和故障排除][2]》中所解释的那样,许多问题当然可以通过 Bash 脚本解决,但是仍有很多情况下,除了老式的二进制文件外,没有其他选择。 + +想象一下,你的某些远程系统需要安装新的应用程序,这样使用这些计算机的团队成员就能够执行某些业务。能够利用 Debian 或 RPM 之类的主要 Linux 仓库系统的集成和自动化,可以使你的管理任务变得更加容易。 + +正如 Linus Torvalds 永不厌倦地提醒我们的那样,太多的 Linux 软件管理系统的问题是 [Linux 软件管理系统太多了][3]。多年来,应用开发甚至是 Linux 的采用都变得愈加复杂起来,因为你为了提供你的软件(比如,放到 Debian 仓库)而投入的所有时间和工作,对于你想让它们进入 RPM 系统并没有什么帮助,对于 SUSE 的 Zypper 管理器也一样,没有什么帮助。 + +解决软件孤岛问题的一种有前途的方案是分发具有自足环境的应用,它们可以在任何 Linux 发行版上运行。在这个年轻且不断发展的领域中,选择之一是 [AppImage][4]。 + +### 使用 AppImage + +我全面投入到了 AppImage。就像我提到的其他软件包管理系统一样,如果你需要的话,有很多复杂的功能可以使用。但是,从本质上讲,AppImage 非常简单。AppImage 不像大多数其他包管理器一样通过仓库工作,它使用单个、独立的文件,可以直接发送或通过网站共享。 + +下面是个展示它的美妙之处的例子。当我在用 AppImage 时,我在一个技术论坛上看到了一个很老的讨论,它让我找到了一个同样久远且废弃的 GitHub 项目以及相关的 YAML 和配方文件。它们旨在自动构建准备生成 AppImage 包所需的相当复杂的基础架构。尽管该基础架构全部是在 5 年前的 Ubuntu 版本上构建的,但是当我将它们放在一起并运行 `appimagetool` 命令时,它创建了一个 AppImage 文件,它可在我当前的桌面上无缝运行。我不认为有很多有五年历史的 GitHub 复杂项目可以使用其他技术运行,而无需认真重做。 + +但是这里我我不会介绍这个案例。相反,我将用一个简单的 Hello World 程序向你展示它是如何工作的。首先,请确保本地已安装 AppStream 包。 + +对于基于 Debian 的系统,运行: + +``` +$ sudo apt install appstream +``` + +对于 RPM 系统,请使用: + +``` +$ sudo dnf install appstream +``` + +克隆[这篇文章][5]中提及的 Git 仓库,我会基于它示例: + +``` +$ git clone +$ cd appimage-resources +$ ls hello-world-appimage +``` + +接下来,使用 `cd` 进入 Git 新创建的目录。这里有两个目录。请使用 `hello-world-appimage`。另一个是更复杂的项目,你也应该考虑尝试一下。 + +Linux GUI 系统会读取 `helloworld.desktop` 文件来知道如何呈现桌面图标。事实证明,当前的这个文件会在以后给你带来点麻烦,因此请进行一些小修改:添加 `Categories=` 这行并为其赋予值 `GNOME`。不要忘记最后的分号: + + +``` +$ nano hello-world-appimage/helloworld.desktop +        add Categories=GNOME; +``` + +从 [AppImage GitHub 项目][6]下载 `appimagetool` 预编译的二进制文件。访问 GitHub 的原因之一:那里有很多出色的文档和资源。下载二进制文件后,使文件可执行,并将 `hello-world-appimage` 目录传给它。但是首先,你需要告诉它你想要的架构。由于某些原因,一个名字以 x86\_64 结尾的工具都不能自行确定是否该使用 x86\_64 来构建应用程序(我不知道这是怎么回事)。 + +``` +$ wget +$ chmod +x appimagetool-x86_64.AppImage +$ ARCH=x86_64 ./appimagetool-x86_64.AppImage hello-world-appimage +``` + +如果你没有看到任何错误消息,那么表示完成了,请运行: + +``` +$ ls +$ ./hello-world-appimage-x86_64.AppImage +``` + +### 总结 + +AppImage 是软件包管理的非常有效的选择。当你探索它时,我想你会发现它是 Linux 发行版默认软件包系统的很好的替代品。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/6/appimages + +作者:[David Clinton][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/dbclinton +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/OSDC_gift_giveaway_box_520x292.png?itok=w1YQhNH1 (Gift box opens with colors coming out) +[2]: https://pluralsight.pxf.io/VMKQj +[3]: https://itsfoss.com/desktop-linux-torvalds/ +[4]: https://appimage.org/ +[5]: https://www.booleanworld.com/creating-linux-apps-run-anywhere-appimage/ +[6]: https://github.com/AppImage/AppImageKit/releases diff --git a/published/202006/20200607 5 ways to boost your Kubernetes knowledge.md b/published/202006/20200607 5 ways to boost your Kubernetes knowledge.md new file mode 100644 index 0000000000..8912c4aa92 --- /dev/null +++ b/published/202006/20200607 5 ways to boost your Kubernetes knowledge.md @@ -0,0 +1,89 @@ +[#]: collector: "lujun9972" +[#]: translator: "lxbwolf" +[#]: reviewer: "wxy" +[#]: publisher: "wxy" +[#]: url: "https://linux.cn/article-12320-1.html" +[#]: subject: "5 ways to boost your Kubernetes knowledge" +[#]: via: "https://opensource.com/article/20/6/kubernetes-anniversary" +[#]: author: "Seth Kenlon https://opensource.com/users/seth" + +提升你 Kubernetes 技能的 5 种方式 +====== + +> 值此周年纪念之际,来通过这些深度文章和实践项目了解下 Kubernetes。 + +![](https://img.linux.net.cn/data/attachment/album/202006/16/191023lqq0d5zv5vggr2vg.png) + +在云原生的成长期,开发者们发现在一个小型的、原子化的、精简的 Linux 镜像里编写应用程序很方便,这些镜像与它们所运行的服务器共享资源。从技术上讲,这些基于内核命名空间的小环境定义被称为[容器][2]。随着容器的激增,系统管理员们很快意识到,开发一个不仅能帮助他们管理容器,还能帮助他们管理下面的虚拟化基础设施的工具变得至关重要。于是,[Kubernetes][3] 应运而生。 + +Kubernetes 是一个可扩展开源平台,用于管理容器。它可以帮助管理员和开发者们围绕容器管理工作负载、服务和进程。它促进了声明式配置,更容易实现自动化。在它相对较短的生命周期中,它已经催生了一个迅速成长的生态系统,其中包括来自大量公司和项目的服务、支持和工具。 + +如果你想对这项重要的云技术有更多的了解,这里有一些能帮忙你更深入学习的文章。还有 5 个项目可以帮你把学到的东西付诸实践。 + +### 遏制容器乱象 + +2016 年,我们发布了《[使用 Kubernetes 遏制容器乱象][4]》,这是一篇由 Terry Ryan 写的关于 Kubernetes 的介绍性文章,讲述了 Kubernetes 如何帮助管理员和架构师们努力应对容器。如果你想找一篇从底层介绍容器是做什么的以及 Kubernetes 是如何实现容器管理的,那么你应该先读下本文。本文适合零基础的读者,解释了所有重要的概念,因此你能迅速了解相关技术。 + +如果想进阶了解内核层面发生的一些神奇的事情,请阅读 Jessica Cherry 对 [Kubernetes 命名空间][5]的解释。 + +延伸阅读: + +- [一文了解 Kubernetes 是什么?](https://linux.cn/article-8800-1.html) +- [Kubernetes 是什么?](https://linux.cn/article-8858-1.html) + +### Kubernetes:为什么它很重要? + +Kubernetes 提供了基础设施即服务Infrastructure-as-a-Service(IaaS)解决方案(类似 OpenStack)的便利和一个完整的平台即服务Platform as a Service(PaaS)。它为你提供了管理基础设施的抽象能力,以及在裸金属基础层面进行故障排除所需的工具。如果你执着于使用单一的裸金属服务器,你可能需要阅读下 Tim Potter 写的《[你为什么需要 Kubernetes][6]》。他的文章对比了 IaaS 和 PaaS,解释了为什么 Kubernetes 如此广泛地被使用。你可能并不是一定需要 Kubernetes 或容器,但是重要的是知道什么情况下需要。 + +延伸阅读: + +- [使用 Kubernetes 的 5 个理由](https://linux.cn/article-10973-1.html) +- [你(多半)不需要 Kubernetes](https://linux.cn/article-10469-1.html) + +### 在树莓派上运行 Kubernetes + +熟悉 Kubernetes 的最好方法莫过于自己运行它。不幸的是,不是每个人都有一个云服务基层设施(或者有足够的钱来租用一个)可供其支配。而幸运的是,Chris Collins 提供了《[在树莓派上运行 Kubernetes][7]》的教程。结合他的另外几篇关于《[Cloud-init][8]》和《[Cloud-init 服务][9]》的教程(也是在树莓派上运行),你可以搭建任何你想要的家庭实验室,这样你就可以学习如何管理属于自己的开放混合云。 + +### Kubernetes 命令 + +一旦你运行起 Kubernetes 后,可以看看 Jessica Cherry 的文章和附带的备忘清单,这个清单列出了所有的[基本的 Kubernetes 命令][10]。在她的文章中,她解释了 `kubectl` 命令的语法,简单讲述了每个命令和子命令是用来做什么的。 + +### 有趣的 Kubernetes 项目 + +没有什么比拥有技术却不知道该怎么用它更令人沮丧的了。例如,在你的办公桌上有一个树莓派是一回事,但是决定它的 CPU 应该用来做什么工作却完全是另一回事。我们发布了很多教程,来指导你完成你的 Kubernetes 之路的探索: + + * [Helm][11] 是一个 Kubernetes 的包管理器。你可以在它的帮助下,很快熟悉 Kubernetes 环境。 + * 学习下 [Operator SDK][12] 的所有内容,来熟悉 Kubernetes 的对象和操作器。 + * [在 Kubernetes 之上搭建网络文件系统(NFS)][13] + * 学习如何使用 [Skipper][14] 或 [Traefik][15] 进行流量调度。 + +最重要的,花点时间来熟悉容器和 Kubernetes。不论你先把容器化的应用放到服务器、云上还是桌面,它们都是能帮助你理解的重要的范例,因为它们是一个强大的构造,可以让 Linux 的应用变得更好、更健壮、鲁棒性更好、更简单。一定要投入精力去学习它们,你不会后悔的。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/6/kubernetes-anniversary + +作者:[Seth Kenlon][a] +选题:[lujun9972][b] +译者:[lxbwolf](https://github.com/lxbwolf) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/seth +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/ship_captain_devops_kubernetes_steer.png?itok=LAHfIpek "Ship captain sailing the Kubernetes seas" +[2]: https://opensource.com/article/18/11/behind-scenes-linux-containers +[3]: https://opensource.com/resources/what-is-kubernetes +[4]: https://opensource.com/life/16/9/containing-container-chaos-kubernetes +[5]: https://linux.cn/article-11749-1.html +[6]: https://linux.cn/article-8902-1.html +[7]: https://linux.cn/article-8499-1.html +[8]: https://opensource.com/article/20/5/cloud-init-raspberry-pi-homelab +[9]: https://opensource.com/article/20/5/create-simple-cloud-init-service-your-homelab +[10]: https://opensource.com/article/20/5/kubectl-cheat-sheet +[11]: https://linux.cn/article-12007-1.html +[12]: https://opensource.com/article/20/3/kubernetes-operator-sdk +[13]: https://opensource.com/article/20/6/kubernetes-nfs-client-provisioning +[14]: https://opensource.com/article/20/4/http-kubernetes-skipper +[15]: https://opensource.com/article/20/3/kubernetes-traefik diff --git a/published/202006/20200609 Style your data plots in Python with Pygal.md b/published/202006/20200609 Style your data plots in Python with Pygal.md new file mode 100644 index 0000000000..89fc30a3a1 --- /dev/null +++ b/published/202006/20200609 Style your data plots in Python with Pygal.md @@ -0,0 +1,119 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12364-1.html) +[#]: subject: (Style your data plots in Python with Pygal) +[#]: via: (https://opensource.com/article/20/6/pygal-python) +[#]: author: (Shaun Taylor-Morgan https://opensource.com/users/shaun-taylor-morgan) + +使用 Pygal 在 Python 中设置数据图的样式 +====== + +> 介绍一种更时尚的 Python 绘图库。 + +![](https://img.linux.net.cn/data/attachment/album/202006/30/120650hlf8lm0em3l1m8zd.jpg) + +[Python][2] 有很多可以将数据可视化的库。其中一个互动性较强的库是 Pygal,我认为这个库适合喜欢漂亮事物的人。它可以生成用户可以与之交互的漂亮的 SVG(可缩放矢量图形)文件。SVG 是交互式图形的标准格式,仅使用几行 Python 就可以带来丰富的用户体验。 + +### 使用 Pygal 进行时尚的 Python 绘图 + +在本文中,我们要重新创建多柱状图,用来表示 1966 年至 2020 年英国大选的结果: + +![Pygal plot][3] + +在继续之前,请注意你可能需要调整 Python 环境以使此代码运行,包括: + + * 运行最新版本的 Python([Linux][4]、[Mac][5] 和 [Windows][6] 的说明) + * 确认你运行的是与这些库兼容的 Python 版本 + +数据可在线获得,并可使用 pandas 导入: + +``` +import pandas as pd +df = pd.read_csv('https://anvil.works/blog/img/plotting-in-python/uk-election-results.csv') +``` + +现在我们可以继续进行了。。数据如下所示: + +``` +        year  conservative  labour  liberal  others +0       1966           253     364       12       1 +1       1970           330     287        6       7 +2   Feb 1974           297     301       14      18 +..       ...           ...     ...      ...     ... +12      2015           330     232        8      80 +13      2017           317     262       12      59 +14      2019           365     202       11      72 +``` + +在 Pygal 中进行绘制会以一种易于阅读的方式显示。首先,我们以一种简化柱状图定义的方式定义样式对象。然后我们将自定义样式以及其他元数据传递给 `Bar` 对象: + +``` +import pygal +from pygal.style import Style + +custom_style = Style( + colors=('#0343df', '#e50000', '#ffff14', '#929591'), + font_family='Roboto,Helvetica,Arial,sans-serif', + background='transparent', + label_font_size=14, +) + +c = pygal.Bar( + title="UK Election Results", + style=custom_style, + y_title='Seats', + width=1200, + x_label_rotation=270, +) +``` + +然后,我们将数据添加到 `Bar` 对象中: + +``` +c.add('Conservative', df['conservative']) +c.add('Labour', df['labour']) +c.add('Liberal', df['liberal']) +c.add('Others', df['others']) + +c.x_labels = df['year'] +``` + +最后,我们将图另存为 SVG 文件: + +``` +c.render_to_file('pygal.svg') +``` + +结果是一个交互式 SVG 图,你可以在此 gif 中看到: + +![The Python pygal library can generate rich SVG files as seen here][7] + +精美简单,并且效果漂亮。 + +### 总结 + +Python 中的某些绘图工具需要非常详细地构建每个对象,而 Pygal 从一开始就为你提供这些。如果你手边有数据并且想做一个干净、漂亮、简单的交互式图表,请尝试一下 Pygal。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/6/pygal-python + +作者:[Shaun Taylor-Morgan][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/shaun-taylor-morgan +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/coffee_python.jpg?itok=G04cSvp_ (Python in a coffee cup.) +[2]: https://opensource.com/article/20/4/plot-data-python +[3]: https://opensource.com/sites/default/files/uploads/pygal_1.png (Pygal plot) +[4]: https://opensource.com/article/20/4/install-python-linux +[5]: https://opensource.com/article/19/5/python-3-default-mac +[6]: https://opensource.com/article/19/8/how-install-python-windows +[7]: https://opensource.com/sites/default/files/uploads/pygal-interactive_3.gif (The Python pygal library can generate rich SVG files as seen here) +[8]: https://anvil.works/blog/plotting-in-pygal diff --git a/published/202006/20200610 5 ways to examine the content of files on Linux.md b/published/202006/20200610 5 ways to examine the content of files on Linux.md new file mode 100644 index 0000000000..90f1db340d --- /dev/null +++ b/published/202006/20200610 5 ways to examine the content of files on Linux.md @@ -0,0 +1,241 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12340-1.html) +[#]: subject: (5 ways to examine the content of files on Linux) +[#]: via: (https://www.networkworld.com/article/3561490/5-ways-to-examine-the-content-of-files-on-linux.html) +[#]: author: (Sandra Henry-Stocker https://www.networkworld.com/author/Sandra-Henry_Stocker/) + +在 Linux 上查看文件内容的 5 种方法 +====== + +> 如何使用 cat、more、head 和 tail 命令查看 Linux 文件的内容,而不仅仅是文本文件。 + +![](https://img.linux.net.cn/data/attachment/album/202006/23/121047zz9gwx9dwz155m2w.jpg) + +Linux 提供了许多命令来查看文件的内容,包 括 `cat`、`more`、`head` 和 `tail`,但这只是一个开始。 + +一方面,即使是最显而易见的命令也有很多许多用户不会去使用的选项。还有一些普普通通的命令提供了一些独特的功能。在本文中,我们将介绍查看文件内容的命令,以及如何定制这些视图以更好地满足你的需求的选项。 + +### cat + +`cat` 命令将文本文件的全部内容发送到终端窗口以供查看。实际上,如果你输入 `cat`,然后输入包含数千行内容的文件名,那么这些行将以极快的速度在你的窗口中滚动,你将无法看到除了最后一屏外的其他文本。对于 Linux 用户来说 `cat` 命令很熟悉,但即使是这个基本命令也提供了许多有用的选项,例如对输出中的行进行编号,这是我们许多人可能从未使用过的。更进一步,你不仅可以对行进行编号,还可以选择如何编号。 + +对每行进行编号就像这样: + +``` +$ cat -n msg + 1 Hello -- + 2 + 3 I hope you are having a wonderful day! + 4 + 5 + 6 That's it for ... now + 7 + 8 bye! + 9 + 10 s. +``` + +你也可以只对有内容的行编号。请注意,对于此命令,仅包含空格的行不被视为“空”,而是会被编号。 + +``` +$ cat -b msg + 1 Hello -- + + 2 I hope you are having a wonderful day! + + + 3 That's it for ... now + + 4 bye! + + 5 s. +``` + +`cat` 命令允许你使用 `-s` 选项忽略重复的空白行,但是要完全忽略空白行你必须添加另一个命令。 + +``` +$ cat -s msg +Hello -- + +I hope you are having a wonderful day! + +That's it for ... now + +bye! + +s. +``` + +要忽略所有空白行,只需如下将 `cat` 的输出通过管道传递给 `grep` 命令。 点(`.`)匹配包含任意字符的文本,因此它将显示任意非空的行,用于结束一行的回车换行做匹配(LCTT 译注:此处原文有误,径改)。 + +``` +$ cat msg | grep . +Hello -- +I hope you are having a wonderful day! +That's it for ... now +bye! +s. +``` + +`-E` 选项通过在每行末尾加 `$` 符提供视觉提示,来显示行尾是否还有多余的空格。 + +``` +$ cat -E msg +Hello --$ +$ +I hope you are having a wonderful day! $ +$ +$ +That's it for ... now$ +$ +bye!$ +$ +s.$ +``` + +使用 `-A` 时,既可以在每行的末尾显示 `$` 字符,并且制表符会显示为 `^I` 而不是空白。 + +``` +$ cat -A msg +Hello --$ +$ +I hope you are having a wonderful day!$ +$ +$ +That’s it for ...^Inow$ +$ +bye!$ +$ +s.$ +``` + +### 使用 head 和 tail 显示文件部分内容 + +`head` 和 `tail` 显示文件的头部或尾部,默认为十行。 你可以使用 `-3`(显示 3 行)或 `-11`(显示 11 行)之类的字符串来指定要查看的其它行数。`tail` 命令与 `head` 的工作方式相同,但是显示文件的尾部而不是头部。 + +``` +$ head -3 msg +Hello -- +I hope you are having a wonderful day! +$ tail -3 msg +bye! + +s. +``` + +你还可以结合使用 `head` 和 `tail` 命令来查看文件中间的文本。你只需要选择起点和想要查看行数即可。在此例中,命令将在文件中显示第二个一百行,并在 `cat` 的帮助下为这些行编号。 + +``` +$ cat -b mybigfile | head -200 | tail -100 + 101 Invoice #2020-06-07a sent to vendor + ... +``` + +### 使用 more 或者 less 浏览一屏文本 + +`more` 命令是一次浏览一屏内容的自然之选,而 `less` 通过使用上下键盘箭头增加了在文件中上下移动的能力,这样你就可以遍历内容,然后在文件中回退。 + +### 使用 od 查看文本的两种方法 + +`od`(八进制转储)命令能够以常规文本和一系列 ASCII 值(即该文本在文件中的实际编码方式)的形式查看文件。在下面的例子中可以看到,带编号的行显示了 ASCII 数字值,而其他行则显示了文本和不可打印的字符。 + +``` +$ od -bc msg +0000000 110 145 154 154 157 040 055 055 012 012 111 040 150 157 160 145 + H e l l o - - \n \n I h o p e +0000020 040 171 157 165 040 141 162 145 040 150 141 166 151 156 147 040 + y o u a r e h a v i n g +0000040 141 040 167 157 156 144 145 162 146 165 154 040 144 141 171 041 + a w o n d e r f u l d a y ! +0000060 012 012 012 124 150 141 164 047 163 040 151 164 040 146 157 162 + \n \n \n T h a t ' s i t f o r +0000100 040 056 056 056 011 156 157 167 012 012 142 171 145 041 012 012 + . . . \t n o w \n \n b y e ! \n \n +0000120 163 056 012 + s . \n +``` + +请注意,换行符显示为 `\n`(八进制 `012`),而制表符显示为 `\t`(八进制 `011`)。 + +`od` 命令特别有用的用途之一是查看非文本文件以获取可以标识文件类型的信息。在这里,我们看到 `JFIF`(JPEG 文件交换格式)标签,该标签让 `file` 之类报告文件类型的命令将它标示为 jpg 文件。这里还有很多其他有用的信息,特别是如果你对这些文件的格式感到好奇的话。 + +在接下来的命令中,我们查看 jpg 文件的开始部分。 + +``` +$ od -bc arrow.jpg | head -12 +0000000 377 330 377 340 000 020 112 106 111 106 000 001 001 000 000 001 + 377 330 377 340 \0 020 J F I F \0 001 001 \0 \0 001 +0000020 000 001 000 000 377 333 000 103 000 003 002 002 002 002 002 003 + \0 001 \0 \0 377 333 \0 C \0 003 002 002 002 002 002 003 +0000040 002 002 002 003 003 003 003 004 006 004 004 004 004 004 010 006 + 002 002 002 003 003 003 003 004 006 004 004 004 004 004 \b 006 +0000060 006 005 006 011 010 012 012 011 010 011 011 012 014 017 014 012 + 006 005 006 \t \b \n \n \t \b \t \t \n \f 017 \f \n +0000100 013 016 013 011 011 015 021 015 016 017 020 020 021 020 012 014 + \v 016 \v \t \t \r 021 \r 016 017 020 020 021 020 \n \f +0000120 022 023 022 020 023 017 020 020 020 377 333 000 103 001 003 003 + 022 023 022 020 023 017 020 020 020 377 333 \0 C 001 003 003 +``` + +如果我们要 `file` 命令提供有关此图像的信息,我们可能会看到类似下面这样的信息。`file` 命令从文件开头的数据中提取了所有这些描述性信息: + +``` +$ file arrow.jpg +arrow.png: JPEG image data, JFIF standard 1.01, aspect ratio, density 1x1, segment length 16, baseline, precision 8, 500x375, components 3 +``` + +### 使用 jp2a 将文件视为基于文本的图像 + +如果你只能在命令行工作,并且想了解特定图像包含的内容,那么可以使用 `jp2a`(jpeg to ascii)之类的工具提供字符渲染。图像在这种格式下的识别程度取决于文件。不要有太多期待,因为你将看到的图像版本是“低分辨率”下的测试!这是一只分辨率很低的帝王企鹅。(请离远点看) + +``` +$ jp2a Emperor_Penguin.jpg +MMMMMMMMWOdkNMMMMMMMMMMMMMMMMMMM +MMMXK0kc.... ,OKMMMMMMMMMMMMMMMM +MMNK0Ol... :Xx'dNMMMMMMMMMMMMM +MMMMMMMd;lx00Oo. ..xMMMMMMMMMMMM +MMMMMMK.OXMMMMMN,...lMMMMMMMMMMM +MMMMMMx'KXNNMMMMK....0MMMMMMMMMM +MMMMMMx:kkKNWWMMMl.. 'NMMMMMMMMM +MMMMMMddx0NNNWMMMK'...;NMMMMMMMM +MMMMMMck0NNWWWWWMMd ..lMMMMMMMM +MMMMMM.d0KXNWWWWMMo ...WMMMMMMM +MMMMMM.xOXNNWNMMMW. ....KMMMMMMM +MMMMMM'kKNKWXWMMMK ..'.0MMMMMMM +MMMMMMxckXNNNNMMMX .:..XMMMMMMM +MMMMMMW;xKNWWWMMMM. .;. NMMMMMMM +MMMMMMMok0NNWNWMMMx .l..MMMMMMMM +MMMMMMMkxOKXWXNMMMMl.:'dMMMMMMMM +MMMMMMM0dKOdKXXNMMMMNx,WMMMMMMMM +MMMMMMMWoKxldXKNNMMMMM;MMMMMMMMM +MMMMMMMMxxxxdNWNXNMMMM;MMMMMMMMM +MMMMMMMMxOcoo0XOOOOWMW,kMMMMMMMM +MMMMMMM0xK;.cO0dNX:0XXd;NMMMMMMM +MMMNkdd:,'ldXXO0xl;x0kx:;lKMMMMM +MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM +``` + +### 总结 + +Linux 上有很多命令可以通过各种方式查看文件的内容。其中一些选项在你需要处理文件内容时可能会非常有用。其它的只是……有趣。 + +-------------------------------------------------------------------------------- + +via: https://www.networkworld.com/article/3561490/5-ways-to-examine-the-content-of-files-on-linux.html + +作者:[Sandra Henry-Stocker][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://www.networkworld.com/author/Sandra-Henry_Stocker/ +[b]: https://github.com/lujun9972 +[1]: https://unsplash.com/photos/q65bNe9fW-w +[2]: https://creativecommons.org/publicdomain/zero/1.0/ +[3]: https://www.facebook.com/NetworkWorld/ +[4]: https://www.linkedin.com/company/network-world diff --git a/published/202006/20200610 How to Change Folder Color in Ubuntu 20.04.md b/published/202006/20200610 How to Change Folder Color in Ubuntu 20.04.md new file mode 100644 index 0000000000..42f0043ab2 --- /dev/null +++ b/published/202006/20200610 How to Change Folder Color in Ubuntu 20.04.md @@ -0,0 +1,126 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12311-1.html) +[#]: subject: (How to Change Folder Color in Ubuntu 20.04) +[#]: via: (https://itsfoss.com/folder-color-ubuntu/) +[#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/) + +如何在 Ubuntu 20.04 中更改文件夹颜色 +====== + +![](https://img.linux.net.cn/data/attachment/album/202006/13/133146y1bjzb73jj141143.jpg) + +[Ubuntu 20.04][1] 中默认的 Yaru 主题赋予它优美、现代的外观。默认 Yaru 主题中的文件夹是紫色的外观,以与 Ubuntu 的品牌保持一致。 + +如果你不喜欢紫色,可以在 Ubuntu 中自由更改颜色主题。你可以更改 Ubuntu 的主题以使其有不同的颜色,但这将意味着放弃 Yaru 主题。 + +如果你只想在 Ubuntu 20.04 中更改文件夹的颜色,可以有两种方法: + +* 为选定的文件夹赋予不同的颜色和标志(以便更好地组织文件和文件夹) +* 通过更改 Yaru 颜色主题来更改所有文件夹的颜色 + +让我向你展示两种方法。 + +### 更改所选文件和文件夹的颜色和标志 + +![][2] + +我知道有些人将他们的文件夹使用不同的颜色或放在不同的位置,来表示工作正在进行中还是待处理或已完成。 + +如果你也是这样的,那么可以使用 [Folder Color 工具][3]更改文件夹的颜色。你还可以在文件夹中添加标志(绿色的勾号表示完成,加号表示新的,感叹号表示重要等)。你可以在上一张图片中看到一些例子。 + +你还可以在文件上使用 “Folder Color” 工具。你不能更改文件图标的颜色,但可以添加标志。 + +如果你在 Ubuntu 20.04 中[使用 Yaru 主题][4],你可以使用[官方 PPA][5]: + +``` +sudo add-apt-repository ppa:costales/yaru-colors-folder-color +``` + +现在,使用 Yaru 兼容包安装 Folder Color。 + +``` +sudo apt install folder-color yaru-colors-folder-color +``` + +安装后,你必须使用 `nautilus -q` 命令重启 Nautilus 文件管理器。之后,你可以进入文件管理器,右键单击文件夹或文件。你会在上下文菜单中看到 Folder Color 的选项。你将在此处看到颜色和标志选项。 + +![][6] + +你还可以通过在菜单**通过选择“默认”恢复原始文件夹颜色**。 + +对于 Ubuntu 18.04 或更早版本,可以从软件中心安装 Folder Color。它还可用于 Linux Mint/Cinnamon 桌面的 Nemo 文件管理器和 MATE 桌面的 [Caja 文件管理器][7]。 + +#### 如何删除 Folder Color? + +如果你不想使用 Folder Color,你可以删除应用并删除 PPA。首先删除该应用: + +``` +sudo apt remove folder-color yaru-colors-folder-color +``` + +现在[删除 PPA][8]: + +``` +sudo add-apt-repository -r ppa:costales/yaru-colors-folder-color +``` + +### Yaru Colors 主题包更改 Yaru 主题颜色 + +![Yaru Colors Blue Theme Variant][9] + +如果你想继续使用 Yaru 主题但使用不同的颜色,那么需要[Yaru Colors 主题包][10]。 + +Yaru Colors 由 12 种 Yaru 颜色变体组成。它们浅绿色、蓝色、棕色、深蓝色、绿色、灰色、MATE 绿、橙色、粉红色、紫色、红色和黄色。 + +主题包括 GTK 主题、图标、光标和 GNOME Shell 主题。 + + * 图标:更改文件夹的强调色 + * GTK 主题:更改应用窗口的强调色 + * 光标主题:向光标添加几乎可以忽略的色彩轮廓 + * GNOME Shell 主题:更改消息托盘和系统托盘中的强调色 + +你可以从它的 GitHub 仓库下载 Yaru Colors 主题包: + +#### 下载 Yaru Colors 主题包 + +在提取内容时,你会发现图标、主题文件夹,这两个文件夹都包含上述十二种颜色。你可以分别在 `~/.local/share/.icons` 和 `~/.local/share/themes` 文件夹中复制图标和主题文件夹。 + +如果你不想亲自复制,那么你可以在解压文件夹中找到 `install.sh` 脚本。你可以运行它来通过交互式终端会话安装全部或选定的几个主题。 + +![][11] + +要更改 GNOME Shell 主题,你必须[使用 GNOME Tweak 工具][12]。你也可以使用 GNOME Tweak 将图标和主题更改回默认。 + +![][13] + +享受为你的 Ubuntu 生活增色 :) + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/folder-color-ubuntu/ + +作者:[Abhishek Prakash][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://itsfoss.com/author/abhishek/ +[b]: https://github.com/lujun9972 +[1]: https://itsfoss.com/download-ubuntu-20-04/ +[2]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/06/folder-colors-yaru-ubuntu.png?ssl=1 +[3]: https://foldercolor.tuxfamily.org/ +[4]: https://itsfoss.com/ubuntu-community-theme/ +[5]: https://launchpad.net/folder-color +[6]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/06/change-folder-color-ubuntu.png?ssl=1 +[7]: https://github.com/mate-desktop/caja +[8]: https://itsfoss.com/how-to-remove-or-delete-ppas-quick-tip/ +[9]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/06/yaru-colors-blue-theme-variant.jpg?ssl=1 +[10]: https://github.com/Jannomag/Yaru-Colors +[11]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/06/yaru-colors-theme-install.png?resize=800%2C513&ssl=1 +[12]: https://itsfoss.com/gnome-tweak-tool/ +[13]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/06/restore-yaru-gnome-tweak.png?resize=800%2C557&ssl=1 diff --git a/published/202006/20200610 How to write functions in Bash.md b/published/202006/20200610 How to write functions in Bash.md new file mode 100644 index 0000000000..1df7f0efc2 --- /dev/null +++ b/published/202006/20200610 How to write functions in Bash.md @@ -0,0 +1,103 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12323-1.html) +[#]: subject: (How to write functions in Bash) +[#]: via: (https://opensource.com/article/20/6/bash-functions) +[#]: author: (Seth Kenlon https://opensource.com/users/seth) + +如何在 Bash 中编写函数 +====== + +> 通过编写函数来减少代码的冗余和维护。 + +![](https://img.linux.net.cn/data/attachment/album/202006/17/125913hf1efce5c48cebrc.jpg) + +在编程时,实际上是在定义要由计算机执行的过程procedure例程routine。一个简单的类比是将计算机编程与烤面包进行比较:你一次列出了要组建工作环境的配料,然后列出了烤面包所必须采取的步骤。在编程和烘烤中,必须以不同的间隔重复执行某些步骤。例如,在烤面包中,这可能是酵母培养的过程: + +``` +STIR=100 +SNOOZE=86400 + +function feed_culture { +  remove_from(pantry) +  add(flour, water) +  stir($STIR) +  sleep($SNOOZE) +} +``` + +然后,揉面和醒发面团: + +``` +KNEAD=600 +SNOOZE=7200 + +function process_dough { +  remove_from(proofing_drawer) +  knead($KNEAD) +  return_to_drawer($SNOOZE) +} +``` + +在编程中,这些子例程subroutines可以表示为函数function。函数对程序员很重要,因为它们有助于减少代码中的冗余,从而减少了所需的维护量。例如,在以编程方式烤制面包的假想场景中,如果你需要更改面团醒发的用时,只要你之前使用函数,那么你只需更改一次用时,或使用变量(在示例代码中为 `SNOOZE`)或直接在处理面团的子程序中更改用时。这样可以节省你很多时间,因为你不必通过你的代码库遍历每个可能正在醒发的面团,更不用说担心错过一个。许多 bug 是由未更改的缺失的值或执行不正确的 `sed` 命令引起的,它们希望捕获所有可能而不必手动寻找。 + +在 [Bash][2] 中,无论是在编写的脚本或在独立的文件中,定义函数和使用它们一样简单。如果将函数保存到独立的文件中。那么可以将它 `source` 到脚本中,就像 `include` C 语言或 C++ 中的库或将模块 `import` 到 Python 中一样。要创建一个 Bash 函数,请使用关键字 `function`: + +``` +function foo { +# code here +} +``` + +这是一个如何在函数中使用参数的例子(有些人为设计,因此可能会更简单): + +``` +#!/usr/bin/env bash +ARG=$1 + +function mimic { +  if [[ -z $ARG ]]; then +    ARG='world' +  fi +  echo "hello $ARG" +} + +mimic $ARG +``` + +结果如下: + +``` +$ ./mimic +hello world +$ ./mimic everybody +hello everybody +``` + +请注意脚本的最后一行,它会执行该函数。对于编写脚本的新手来说,这是一个普遍的困惑点:函数不会自动执行。它们作为*潜在的*例程存在,直到被调用。 + +如果没有调用该函数,那么函数只是被定义,并且永远不会运行。 + +如果你刚接触 Bash,请尝试在包含最后一行的情况下执行示例脚本一次,然后在注释掉最后一行的情况下再次执行示例脚本。 + +### 使用函数 + +即使对于简单的脚本,函数也是很重要的编程概念。你越适应函数,在面对一个不仅需要声明性的命令行,还需要更多动态的复杂问题时,你就会越容易。将通用函数保存在单独的文件中还可以节省一些工作,因为它将帮助你建立常用的程序,以便你可以在项目间重用它们。看看你的脚本习惯,看是否适合使用函数。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/6/bash-functions + +作者:[Seth Kenlon][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/seth +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/lenovo-thinkpad-laptop-window-focus.png?itok=g0xPm2kD (young woman working on a laptop) +[2]: https://opensource.com/resources/what-bash diff --git a/published/202006/20200611 How I stream video with OBS and WebSockets.md b/published/202006/20200611 How I stream video with OBS and WebSockets.md new file mode 100644 index 0000000000..56e391979e --- /dev/null +++ b/published/202006/20200611 How I stream video with OBS and WebSockets.md @@ -0,0 +1,137 @@ +[#]: collector: (lujun9972) +[#]: translator: (wxy) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12347-1.html) +[#]: subject: (How I stream video with OBS and WebSockets) +[#]: via: (https://opensource.com/article/20/6/obs-websockets-streaming) +[#]: author: (Kevin Sonney https://opensource.com/users/ksonney) + +如何用 OBS 和 WebSockets 播放视频流 +====== + +> 用这些简化了 WebSockets 的开源支持工具来控制你的流媒体。 + +![](https://img.linux.net.cn/data/attachment/album/202006/25/105128sdod30qqu4z5oooo.jpg) + +[OBS][2] 是现在视频直播的主流之一。它是直播流媒体到 Twitch 的首选软件,Twitch 是近来最受欢迎的视频直播网站之一。有一些非常好的附加组件,可以让流媒体人从他们的手机或另一个屏幕上进行控制,而不影响正在运行的视频。事实证明,使用 [Node-RED][3] 和 [obs-websockets][4] 插件来构建自己的控制面板真的很容易。 + +![My OBS Control Dashboard][5] + +*我的 OBS 控制仪表盘* + +我知道你们很多人在想什么 —— “他在同一句话中提到了 WebSockets 和简单?”很多人在设置和使用 WebSockets 时遇到了困难,WebSockets 允许通过 Web 服务器的单一连接进行双向通信。Node-RED 内置了对 WebSockets 的支持,是让这一切变得简单的原因之一,至少与编写自己的客户端/服务器相比是如此。 + +在开始之前,请确保你已经安装和配置了 OBS。首先下载并安装[最新稳定版的 obs-websockets][6]插件。对于本文来说,默认的设置就可以了,但我强烈建议你之后按照说明来保护 obs-websockets 的安全。 + +接下来,[下载并安装 Node-RED][7],可以在同一个系统上,也可以在不同的系统上(比如树莓派)。同样,默认的安装对我们这篇文章来说是够了,但最好按照他们网站上的指示进行安全安装。 + +现在是有趣的部分。启动 Node-RED,打开网页界面(默认在 ),你有了一个空白的画布。打开右边的“汉堡”菜单,选择“管理口味Manage Palate”。然后点击“安装”标签,搜索 `node-red-contrib-dashboard` 和 `node-red-contrib-rbe` 模块。 + +安装好这些模块后,点击右侧列表,将以下模块拖拽到画布上。 + + * 1 Websocket Out + * 1 Websocket In + * 1 Debug + * 1 Inject + * 1 Switch + * 1 Change + * 2 JSON + * 1 Catch + +以下列顺序连接它们: + +``` +Inject->Button->Change->JSON->Websocket Out + +Websocket In->JSON->Switch->RBE->Debug + +Catch->Debug +``` + +![The basic flows][8] + +*基本流程* + +当 “Button” 被按下时(或 “Inject” 节点发送一个时间戳),有效载荷通过 “change” 节点发送,从 JSON 对象转换为字符串,然后发送到 “WebSocket Out” 节点。当 “WebSocket In” 节点收到消息后,会将其转换为 JSON 对象,如果不是重复的,则发送到 “Debug” 节点进行输出。而 “Catch” 节点会捕捉到任何错误,并将其放入 “Debug” 面板中。 + +那有效载荷里有什么呢?让我们设置好一切,一探究竟。 + +首先,双击 “Button” 打开设置对话框。先使用下拉菜单将有效载荷改为 “JSON”。在该字段中,添加以下内容: + +``` +{"request-type":"GetVersion"} +``` + +启用 “If msg arrives on input, emulate a button click” 复选框,然后点击 “Done” 关闭 “Button” 配置。当消息从 “Inject” 节点传来时,或者 UI 中的 “Button” 被按下,它将把 JSON 有效载荷发送到下一个节点。 + +![Setting up the button][9] + +*设置 “Button”* + +现在打开 “Change” 节点。我们要将 `msg.payload.message-id` 设置为 `msg._msgid`,方法是将第一个字段从 `payload` 改为 `payload.message-id`,然后使用第二个字段的下拉菜单将类型从 `String` 改为 `msg.`,然后我们将 `_msgid` 放入该字段。这样就会把唯一的消息 ID 复制到 JSON 对象的有效载荷中,这样每个请求就有一个唯一的 ID 进行跟踪。 + +然后将其发送到 “JSON” 节点,以便将 JSON 对象转换为字符串,然后传递给 “Websocket Out” 节点。打开 “Websocket Out” 节点,配置到 OBS 的连接。首先,将 `Type` 更改为 `Connect to`,然后单击铅笔图标以创建新的连接 URL。将其设置为 `ws://OBSMachine:4444/`,然后关闭对话框进行保存。`OBSMachine` 是 OBS 和 obs-websocket 运行的机器名称。例如,如果 Node-RED 运行在同一台机器上,则为 `ws://localhost:4444`,如果是在名为 `luxuria.local` 的机器上,则为 `ws://luxuria.local:4444`。关闭并更新 “Websocket Out” 节点。这将向 OBS 中的 WebSocket 发送有效载荷文本字符串。 + +![Websocket Out Node configuration][10] + +*“Websocket Out” 节点配置* + +进入 “WebSocket In” 流程!打开 “WebSocket In” 节点,并对其设置 `Type` 为 `Connect to` 和我们之前定义的连接的 URL(应自动填充)。接下来是第二个 “JSON” 节点,我们可以不用管它。它接受 OBS 的输出,并将其转换为有效载荷对象。 + +接下来,我们将从中过滤出常规的心跳和状态更新。打开 “Switch”,将 `Property` 值设置为 `payload["update-type"]`。现在从它下面的下拉菜单中选择 `Is Not Null`。点击 `+` 添加第二个选项,并从下拉菜单中选择 `otherwise`。 + +![Switch Node configuration][11] + +*“Switch” 节点配置* + +将 “Switch” 上的新输出直接连接到 “Debug” 节点的输入。 + +RBE 节点将过滤掉重复的内容,需要告诉它要观察什么字段。由于它应该连接到 “Switch” 的输出,而它只发送状态更新,所以这一点很重要,因为 obs-websocket 每隔几秒钟就会发送更新。默认情况下,RBE 会比较整个有效载荷对象,它将不断变化。打开 RBE 节点,将 `Property` 从 `payload` 改为 `payload.streaming`。如果 `payload` 的 `streaming` 值发生了变化,那么就把消息传递过去,否则就丢弃。 + +最后一步是将 “Debug” 节点的输出从 `msg.payload` 改为完整的 `msg` 对象。这使我们能够看到整个对象,有时在 `payload` 之外还有有用的信息。 + +现在,单击 “Deploy” 以激活更改。希望 WebSocket 节点下面会有绿色的 `Connected` 消息。如果它们是红色或黄色的,则连接 URL 可能不正确,需要更新,或者连接被阻止。请确保远程机器上的 4444 端口是开放的、可用的,并且 OBS 正在运行! + +如果没有 RBE 节点对 `streaming` 值的过滤,调试面板(点击画布右侧的“虫子”图标)大约现在就会被心跳消息填满。点击 “Inject” 节点左边的按钮,发送一个模拟按钮点击的信号。如果一切顺利,你应该会看到一个对象到达,它有一个 `obs-websocket` 可以做的所有事情的列表。 + +![The response to "GetVersion"][12] + +*对 “GetVersion” 的回应* + +现在在另一个标签或窗口中打开 `http://localhost:1880/ui`。它应该显示一个单一的按钮。按下它! 调试面板应该会显示和之前一样的信息。 + +恭喜你!你已经发送了你的第一个(希望不是最后一个)WebSocket 消息! + +这只是使用 obs-websockets 和 Node-RED 可以做的事情的起步。支持的完整文档记录在 obs-websockets 的 GitHub 仓库的 `protocol.md` 文件中。通过一点点的实验,你可以创建一个功能齐全的控制面板来启动和停止流媒体、改变场景,以及更多。如果你和我一样,在意识到之前,你就可以设置好各种控件了。 + +![OBS Websocket][13] + +*如此多的能力让我有点疯* + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/6/obs-websockets-streaming + +作者:[Kevin 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://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/LIFE_film.png?itok=aElrLLrw (An old-fashioned video camera) +[2]: https://obsproject.com/ +[3]: https://nodered.org/ +[4]: https://github.com/Palakis/obs-websocket +[5]: https://opensource.com/sites/default/files/uploads/obscontrol-img1.png.jpg (My OBS Control Dashboard) +[6]: https://github.com/palakis/obs-websocket/releases +[7]: https://nodered.org/docs/getting-started/ +[8]: https://opensource.com/sites/default/files/uploads/obscontrol-img2.png.jpg (The basic flows) +[9]: https://opensource.com/sites/default/files/uploads/obscontrol-img3.png.jpg (Setting up the button) +[10]: https://opensource.com/sites/default/files/uploads/obscontrol-img4.png.jpg (Websocket Out Node configuration) +[11]: https://opensource.com/sites/default/files/uploads/obscontrol-img5.png.jpg (Switch Node configuration) +[12]: https://opensource.com/sites/default/files/uploads/obscontrol-img6.png.jpg (The response to "GetVersion") +[13]: https://opensource.com/sites/default/files/uploads/obscontrol-img7.png.jpg (OBS Websocket) diff --git a/published/202006/20200612 Import functions and variables into Bash with the source command.md b/published/202006/20200612 Import functions and variables into Bash with the source command.md new file mode 100644 index 0000000000..f8dc02f78e --- /dev/null +++ b/published/202006/20200612 Import functions and variables into Bash with the source command.md @@ -0,0 +1,126 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12346-1.html) +[#]: subject: (Import functions and variables into Bash with the source command) +[#]: via: (https://opensource.com/article/20/6/bash-source-command) +[#]: author: (Seth Kenlon https://opensource.com/users/seth) + +使用 source 命令将函数和变量导入 Bash +====== + +> source 就像 Python 的 import 或者 Java 的 include。学习它来扩展你的 Bash 能力。 + +![](https://img.linux.net.cn/data/attachment/album/202006/24/235417tbzjpdbpbzkbjeul.jpg) + +登录 Linux shell 时,你将继承特定的工作环境。对于 shell 而言,“环境environment”意味着已经为你设置了某些变量,以确保你的命令可以按预期工作。例如,[PATH][2] 环境变量定义 shell 从哪里查找命令。没有它,几乎在 Bash 中尝试执行的所有操作都会因“命令未发现” 错误而失败。在执行日常任务时,环境对你几乎是不可见的,但它很重要。 + +有多种方法可以影响你的 shell 环境。你可以在配置文件中进行修改,例如 `~/.bashrc` 和 `~/.profile`,你可以在启动时运行服务,还可以创建自己的自定义命令或编写自己的 [Bash 函数][3] 。 + +### 通过 source 添加到你的环境 + +Bash(以及其他一些 shell)有一个称为 `source` 的内置命令。这就是令人困惑的地方:`source` 执行与命令 `.` 相同的功能(是的,那只是一个点),而与 `Tcl` 命令的 `source` 不是同一个(如果你输入 `man source`,也许在屏幕上显示的是它)。实际上,内置的 `source` 命令根本不在你的 `PATH` 中。这是 Bash 附带的命令,要获取有关它的更多信息,可以输入 `help source`。 + +`.` 命令兼容 [POSIX][4]。 但 `source` 命令不是 POSIX 定义的,但可以与 `.` 命令互换使用。 + +根据 Bash `help`,`source` 命令在你当前的 shell 中执行一个文件。 “在你当前的 shell 中” 这句很重要,因为它表示它不会启动子 shell。因此,用 `source` 执行的任何操作都发生在内部并影响*当前*环境。 + +在探讨 `source` 对环境的影响之前,请用 `source` 命令导入一个测试文件,以确保其按预期执行代码。首先,创建一个简单的 Bash 脚本并将其保存为 `hello.sh`: + +``` +#!/usr/bin/env bash +echo "hello world" +``` + +使用 `source`,即使该脚本不设置可执行也可以运行: + +``` +$ source hello.sh +hello world +``` + +你也可以使用内置的 `.` 命令获得相同的结果: + +``` +$ . hello.sh +hello world +``` + +`source` 和 `.` 命令成功地执行了测试文件的内容。 + +### 设置变量和导入函数 + + 你可以使用 `source` 将文件 “导入” 到 shell 环境中,就像你可以在 C 或 C++ 中使用 `include` 关键字引用一个库,或者在 Python 中使用 `import` 关键字引入一个模块一样。这是 `source` 的最常见用法之一,它也是 `.bashrc` 中的一个默认包含方式,通过 `source` 导入 `.bash_aliases`,以便将任何你自定义的别名在登录时导入到你的环境。 + +这是导入 Bash 函数的示例。首先,在名为 `myfunctions` 的文件中创建一个函数。它将打印你的公共 IP 地址和本地 IP 地址: + +``` +function myip() { +        curl       + +        ip addr | grep inet$IP | \ +        cut -d"/" -f 1 | \ +        grep -v 127\\.0 | \ +        grep -v \:\:1 | \ +        awk '{$1=$1};1' +} +``` + +将该函数导入你的 shell: + +``` +$ source myfunctions +``` + +测试新函数: + +``` +$ myip +93.184.216.34 +inet 192.168.0.23 +inet6 fbd4:e85f:49c:2121:ce12:ef79:0e77:59d1 +inet 10.8.42.38 +``` + +### source 的搜索 + +当你在 Bash 中使用 `source` 时,它将在当前目录中搜索你引用的文件。但并非所有 shell 都这样,因此,如果你不使用 Bash,请查看文档。 + +如果 Bash 找不到要执行的文件,它将搜索你的 `PATH`。同样,这并不是所有 shell 的默认设置,因此,如果你不使用 Bash,请查看文档。 + +这些都是 Bash 中不错的便利功能。这种出奇地强大,因为它允许你将常用函数保存在磁盘上的一个集中的位置,然后将你的环境视为集成开发环境 (IDE)。你不必担心函数的存储位置,因为你知道它们在你的本地位置等同于在 `/usr/include` 下,因此无论你在哪,当你导入它们时,Bash 都可以找到它们。 + +例如,你可以创建一个名为 `~/.local/include` 的目录作为常见函数存储区,然后将此代码块放入 `.bashrc` 文件中: + +``` +for i in $HOME/.local/include/*; +  do source $i +done +``` + +这会将 `~/.local/include` 中所有包含自定义函数的文件“导入”到 shell 环境中。 + +当你使用 `source` 或 `.` 命令时,Bash 是唯一搜索当前目录和 `PATH` 的 shell。 + +### 将 source 用于开源 + +使用 `source` 或 `.` 来执行文件是影响环境同时保持变更模块化的一种便捷方法。在下次考虑将大量代码复制并粘贴到 `.bashrc` 文件中时,请考虑将相关函数或别名组放入专用文件中,然后使用 `source` 导入它们。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/6/bash-source-command + +作者:[Seth Kenlon][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/seth +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/bash_command_line.png?itok=k4z94W2U (bash logo on green background) +[2]: https://opensource.com/article/17/6/set-path-linux +[3]: https://opensource.com/article/20/6/how-write-functions-bash +[4]: https://opensource.com/article/19/7/what-posix-richard-stallman-explains diff --git a/published/202006/20200615 How to use Bash history commands.md b/published/202006/20200615 How to use Bash history commands.md new file mode 100644 index 0000000000..f410a9ff13 --- /dev/null +++ b/published/202006/20200615 How to use Bash history commands.md @@ -0,0 +1,154 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12344-1.html) +[#]: subject: (How to use Bash history commands) +[#]: via: (https://opensource.com/article/20/6/bash-history-commands) +[#]: author: (Seth Kenlon https://opensource.com/users/seth) + +如何使用 Bash history 命令 +====== + +> Bash 的 history 命令在它提供的功能数量上超过了所有其他 Linux Shell 历史接口。 + +![](https://img.linux.net.cn/data/attachment/album/202006/24/101620c0uj0dgg0buo9nib.jpg) + +Bash 有丰富的历史。也就是说,它是一个古老的的 shell,还有一个更古老的 Shell (Bourne shell)的前辈,但是它还有一个很棒的 `history` 命令,它提供的功能数量超过了所有其他 shell 的历史接口。 [Bash][2] 版本的 `history` 可进行反向搜索、快速调用、重写历史记录等。 + +`history` 命令与许多其他命令不同。你可能习惯于将命令作为可执行文件放在常见的系统级位置,例如 `/usr/bin`、`/usr/local/bin` 或者 `~/bin`。 内置的 `history` 命令不在你的 `PATH` 中并且没有物理位置: + + +``` +$ which history + +which: no history in [PATH] +``` + +相反,`history` 是 shell 本身的内置函数: + +``` +$ type history +history is a shell builtin +$ help history +history: history [-c] [-d offset] [n] or +history -anrw [filename] or +history -ps arg [arg...] + +Display or manipulate the history list. +[...] +``` + +出于这个原因,每个 shell 中的历史功能都是独特的,因此你在 Bash 中使用的功能可能无法在 Tcsh 或 Fish 或 Dash 中使用,而在这些 shell 中使用的功能可能也无法在 Bash 中使用。在某些情况下,了解 Bash 可以做什么可能会激发其他 shell 的用户创建有趣的改造来复制 Bash 行为,并且可能会解锁你从未知道的 Bash 功能。 + +### 查看你的 Bash 历史 + +`history` 命令最基本、最频繁的用法是查看 shell 会话的历史记录: + + +``` +$ echo "hello" +hello +$ echo "world" +world +$ history +  1  echo "hello" +  2  echo "world" +  3  history +``` + +### 事件指示器 + +事件指示器Event designator按事件搜索你的历史记录。在这里,“事件”是指记录在历史中的命令,以换行符划定。换句话说,一行一个事件,以索引号来标记。 + +事件指示器大多以感叹号开头,有时也称为 “bang”(`!`)。 + +要从你的历史记录中重新运行命令,请使用感叹号,之后紧跟(之间没有空格)所需命令的索引号。例如,假设第 1 行包含命令 `echo "hello"`,你想要想再次运行它: + + +``` +$ !1 +echo "hello" +hello +``` + +你可以使用相对定位,提供基于你历史中当前位置向后的负数行号。例如,返回到历史中倒数第三个条目: + +``` +$ echo "foo" +foo +$ echo "bar" +bar +$ echo "baz" +baz +$ !-3 +echo "foo" +foo +``` + +如果只想回去一行,那么可以使用速记 `!!` 代替 `!-1`。这节省了按键时间! + +``` +$ echo "foo" +$ !! +echo "foo" +foo +``` + +### 字符串搜索 + +你也可以对条目搜索特定的字符串,反过来搜索要运行命令。要搜索以指定字符串*开始*的命令,请使用感叹号,之后紧跟(没有空格)要搜索的字符串: + +``` +$ echo "foo" +$ true +$ false +$ !echo +echo "foo" +foo +``` + +你还可以在任意位置(不仅是开头)搜索包含该字符串的命令。为此,请像之前一样使用 `!` 加上要搜索的字符串,但在字符串的两端都用问号(`?`)围绕起来。如果你知道该字符串后紧跟一个换行符,那么可以省略最后的问号(就是在按*回车*之前输入的最后字符): + +``` +$ echo "foo" +$ true +$ false +$ !?foo? +echo "foo" +foo +``` + +### 字符串替换 + +类似于在行首搜索字符串,你可以搜索字符串并用新字符串替换它,以更改命令: + +``` +$ echo "hello" +hello +$ echo "world" +world +$ ^hello^foo +echo "foo" +foo +``` + +### 让 history 有用 + +在 Bash 中,`history` 命令的功能远远超过此处介绍的内容,但这是一个很好的开始, 可以让你习惯使用你的历史记录, 而不是仅仅把它当作一个参考。经常使用 `history` 命令,并试试无需输入命令即可执行的操作。你可能会感到惊讶! + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/6/bash-history-commands + +作者:[Seth Kenlon][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/seth +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/1980s-computer-yearbook.png?itok=eGOYEKK- (Person typing on a 1980's computer) +[2]: https://opensource.com/resources/what-bash diff --git a/published/202006/20200615 Introduction to Homebrew- the painless way to install anything on a Mac.md b/published/202006/20200615 Introduction to Homebrew- the painless way to install anything on a Mac.md new file mode 100644 index 0000000000..7253cba52c --- /dev/null +++ b/published/202006/20200615 Introduction to Homebrew- the painless way to install anything on a Mac.md @@ -0,0 +1,221 @@ +[#]: collector: (lujun9972) +[#]: translator: (wxy) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12338-1.html) +[#]: subject: (Introduction to Homebrew: the painless way to install anything on a Mac) +[#]: via: (https://opensource.com/article/20/6/homebrew-mac) +[#]: author: (Matthew Broberg https://opensource.com/users/mbbroberg) + + +Homebrew :在 Mac 上无痛安装软件 +====== + +> Homebrew 软件包管理器可以让你轻松地在 Mac 上安装和更新应用程序和实用程序。 + +![](https://img.linux.net.cn/data/attachment/album/202006/22/102739xum6zqmoh6sso0n6.jpg) + +在我追求“万物自动化”的过程中,我一直坚持走在用代码来管理我的 Mac 笔记本电脑的路上。与其用鼠标或触控板手动管理我的应用程序和实用程序,我更喜欢使用软件包管理软件来安装、更新和删除不需要的软件。 + +这对 Mac 用户来说是个挑战。Mac 的操作系统 macOS 始终落后于 Linux 的一个地方就是在包管理方面。Mac 用户没有默认的软件包管理器,而 Linux 用户则有很多选择 —— 从熟悉的 `yum` 和 `apt` 到现代的 [Flatpak][2]。但 Mac 呢? + +这就是 [Homebrew][3] 的作用。Homebrew(自酿)填补了 MacOS 事实上的软件包管理器的空白(它也是 Linux 上的又一个可选的包管理器)。它为任何熟悉命令行的人提供了令人难以置信的流畅而直接的体验,如果你是新手,它是学习命令行的好方法。 + +(LCTT 译注:Homebrew 系统中采用了大量针对自酿啤酒相关的比喻,大家在使用过程中会发现这些有趣的形容。) + +如果你在 Mac 上还没有 Homebrew,你可以这样来安装: + +``` +$ /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)" +``` + +该命令将执行 Homebrew 团队提供的安装程序脚本。如果你喜欢谨慎一点,可以 `curl` 下来这个文件,审核后再手动运行。 + +``` +$ curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh --output homebrew_installer.sh +$ more homebrew_installer.sh # 审核该脚本,直到你觉得没问题了 +$ bash homebrew_installer.sh +``` + +### 使用“酿造”来管理你的命令行实用程序 + +Homebrew 号称它“可以安装苹果(或你的 Linux 系统)默认没有安装的必需之物”。安装是通过 `brew`(酿造)命令进行的,它使我们能够访问成千上万的命令行实用程序,但不是更复杂的应用程序。 + +对于我们这些搞技术的人来说,符合“必需之物”类别的实用工具包括显示目录结构的方便的 `tree` 命令和我用来 [管理多个 Python 版本][4] 的 `pyenv`。 + +你可以用 `search` 子命令看到 Homebrew 中所有的“秘方formula”,我用 `wc` 命令显示有多少个“秘方”。 + +``` +# -l 统计行数 +$ brew search | wc -l +    5013 +``` + +有 5000 多个“秘方”,这是一个不可思议的软件数量。所以,在搜索那个庞大的清单之前,最好先对自己想要的东西有个概念。值得庆幸的是,浏览起来很方便。“秘方”被编入并集中存储到核心库中,核心库按操作系统划分(Mac 在 [Homebrew Core][5],Linux 在 [Linux Core][6])。它们也可以通过 Homebrew API 和[网站][7]列出。 + +口碑是另一个寻找实用工具的好方法。考虑到这一点,如果你正在寻找灵感,这里有一些我的最爱: + +* `pyenv`、`rbenv` 和 `nodenv` 分别用于管理 Python、Ruby 和 Node.js 的版本 +* `imagemagick` 用于可脚本化的图像编辑 +* `pandoc` 用于可脚本化的文件转换(我经常从 .docx 切换到 .md 或 .html) +* `hub` 为 GitHub 用户提供了[更好的 Git 体验][8]。 +* `tldr` 提供了解如何使用命令行工具的例子 + +举个例子,看看 [tldr 页面][9],这是一个用户友好的替代方式,可以滚动浏览应用程序的手册页。你可以通过再次运行 `search` 来确认它是否可用: + +``` +$ brew search tldr +==> Formulae +tldr ✔ +``` + +成功了!这个对勾让你知道它是可用的。现在你可以安装它了: + +``` +$ brew install tldr +==> Downloading https://homebrew.bintray.com/bottles/tldr-1.3.0_2.catalina.bottle.tar.gz +Already downloaded: /Users/mbbroberg/Library/Caches/Homebrew/downloads/901bc14594a9283e9ab20aec942dc5a9a2befb7e96e1b0fcccb4e3257918813c--tldr-1.3.0_2.catalina.bottle.tar.gz +==> Installing tldr +==> Pouring tldr-1.3.0_2.catalina.bottle.tar.gz +🍺 /usr/local/Cellar/tldr/1.3.0_2: 6 files, 35.5KB +``` + +值得庆幸的是,Homebrew 预先构建了二进制文件,所以你不必在本地机器上从源代码构建。这样就节省了很多时间,并免除了 CPU 风扇的噪音。我对 Homebrew 赞赏的另一件事是,你可以在不完全了解其含义的情况下欣赏此功能。 + +但如果你喜欢,看看复杂的东西也是很有趣的。对 `tldr` 运行 `info` 子命令,你可以看到所有的依赖管理、源代码,甚至公共分析。 + +``` +$ brew info tldr +tldr: stable 1.3.0 (bottled), HEAD +Simplified and community-driven man pages +https://tldr.sh/ +Conflicts with: + tealdeer (because both install `tldr` binaries) +/usr/local/Cellar/tldr/1.3.0_2 (6 files, 35.5KB) * + Poured from bottle on 2020-05-20 at 15:12:12 +From: https://github.com/Homebrew/homebrew-core/blob/master/Formula/tldr.rb +==> Dependencies +Build: pkg-config ✔ +Required: libzip ✔ +==> Options +--HEAD + Install HEAD version +==> Analytics +install: 2,811 (30 days), 7,875 (90 days), 27,105 (365 days) +install-on-request: 2,806 (30 days), 7,860 (90 days), 27,080 (365 days) +build-error: 0 (30 days) +``` + +最后,和其他优秀的软件包管理器一样,Homebrew 的 `brew uninstall` 子命令可用于快速清理和删除未使用的实用程序。 + +### 用“酒桶”管理你的应用程序 + +命令行实用程序是一匹孤狼,但完整的应用程序呢?Homebrew 保持了其标准命令的简单性,只通过其默认的 `brew` 命令行界面安装单文件应用。而应用程序不符合这种结构。它们的目录层次比较复杂,比单一的二进制要复杂得多。 + +幸运的是,Mac 上的 Homebrew 包含了一个名为 `cask`(酒桶)的子命令,用于处理更复杂的多目录结构。特别好的是,`cask` 使用了与标准 `brew` 命令类似的命令结构,所以你可以使用类似的 `search`、`install` 和 `info` 子命令: + +``` +brew search --cask | wc -l +    4772 +``` + +哇,有近 5000 个应用程序,在 [Homebrew 的网站][10]上浏览更方便。 + +我将用我新喜欢的一款应用来引导你完成 `cask`。[Meld][11](我[在 Opensource.com 上读到的][12])。这是一个功能丰富的编辑器,可以帮助管理合并冲突。在它的网站上有下载的链接,我可以运行安装程序,并将其拖放到我的应用程序文件夹中。但我不想再这样做了,我用的是 Homebrew。 + +首先,我可以通过稍微不同的语法确认它可以使用: + +``` +$ brew search --casks meld +==> Casks +meld +``` + +然后我使用 `cask` 子命令来安装它: + +``` +$ brew cask install meld +==> Downloading https://github.com/yousseb/meld/releases/download/osx-19/meldmerge.dmg +==> Downloading from https://github-production-release-asset-2e65be.s3.amazonaws.com/28624006/66cb25 +######################################################################## 100.0% +==> Verifying SHA-256 checksum for Cask 'meld'. +==> Installing Cask meld +==> Moving App 'Meld.app' to '/Applications/Meld.app'. +==> Linking Binary 'meld.wrapper.sh' to '/usr/local/bin/meld'. +🍺 meld was successfully installed! +``` + +Homebrew 不仅安装了应用程序,而且还在我当前的路径 `/usr/local/bin/` 下提供了它。现在,我可以从命令行运行 `meld` 或从应用程序文件夹中启动应用程序。 + +### 更新一切的“酿造升级” + +我一直使用软件包管理器的主要原因是,我可以不断升级我的软件,以避免已知的安全漏洞,并确保我总是有最新的功能。如果我手工安装所有的东西,我必须关注每一个工具和应用程序,以了解它是否有自动更新程序,如果没有,就得自己拉回最新的版本。 + +升级功能是优秀的软件包管理的闪光点。由于我没有什么特殊的版本要求,所以我只需要运行一个命令就可以顺利更新一切: + +``` +$ brew upgrade +==> Upgrading 6 outdated packages: +helm 3.2.1 -> 3.2.2 +python@3.8 3.8.2_4 -> 3.8.3 +ipython 7.14.0 -> 7.15.0 +go 1.14.2_1 -> 1.14.3 +libzip 1.6.1 -> 1.6.1_1 +sqlite 3.31.1 -> 3.32.1 +``` + +如果你有更复杂的需求,或者想在安装升级前关注一下升级情况,有很多功能标志可供选择。例如,`-n` 提供了一个 “模拟运行”,列出了可用的升级,而不会进行安装。你也可以 “[钉][13]” 住应用程序版本来防止它升级。 + +### 备份你的安装 + +当该工具允许你像其它[点文件的版本控制方案][14]一样备份你的安装环境时,命令行实用程序和应用程序的管理就跳到了一个全新的水平。Homebrew 就有这样的功能,可以在 `dump` 子命令下使用。它会生成一个 `Brewfile`,这是一个可重复使用的当前所有安装的工具的列表。要从你的安装的环境中生成一个,进入你的合适的文件夹并运行: + +``` +$ cd ~/Development/dotfiles # 这是我的点文件的文件夹 +$ brew bundle dump +``` + +当我换了机器,想用 Homebrew 安装相同的应用程序时,我就会进入装有 `Brewfile` 的文件夹并运行。 + +``` +$ brew bundle +``` + +它将在我的新机器上安装所有列出的“秘方”和“酒桶”。 + +### 用 Homebrew 进行软件包管理 + +Homebrew 是我常用的命令行工具和应用程序的管理器。它可以让我保持有条理和及时更新,它的设计在易用性和功能深度之间取得了美丽的平衡。Homebrew 将软件包管理的细节最小化到只需要你知道的程度,大多数用户都会从中受益。 + +如果你对 Linux 软件包管理器已经驾轻就熟,你可能会认为 Homebrew 太简单了,但不要误以为 Homebrew 的易用性是功能的缺乏。稍微深入一点看,就会发现很多高级选项,远远超出了我在这里向你展示的范围。将 `-h` 添加到任何 `brew` 子命令中,会显示可用来升级、删除、故障排除,甚至使用模板贡献新 “秘方” 的丰富功能。 + +总的来说,Homebrew 可以让一个重度命令行的 Mac 用户变得很开心。此外,它是开源的,所以如果你愿意,你可以[贡献代码][15]。尝试一下它,让我知道你的想法,在下面留下评论。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/6/homebrew-mac + +作者:[Matthew Broberg][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/mbbroberg +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/OSDC_gift_giveaway_box_520x292.png?itok=w1YQhNH1 (Gift box opens with colors coming out) +[2]: https://opensource.com/article/19/10/how-build-flatpak-packaging +[3]: https://brew.sh +[4]: https://opensource.com/article/20/4/pyenv +[5]: https://github.com/Homebrew/homebrew-core +[6]: https://github.com/Homebrew/linuxbrew-core +[7]: https://formulae.brew.sh/formula/ +[8]: https://opensource.com/article/20/3/github-hub +[9]: https://github.com/tldr-pages/tldr +[10]: https://formulae.brew.sh/cask/ +[11]: https://meldmerge.org/ +[12]: https://opensource.com/article/20/3/meld +[13]: https://docs.brew.sh/FAQ#how-do-i-stop-certain-formulae-from-being-updated +[14]: https://opensource.com/article/19/3/move-your-dotfiles-version-control +[15]: https://github.com/Homebrew/brew diff --git a/published/202006/20200619 How to dump the GOSSAFUNC graph for a method.md b/published/202006/20200619 How to dump the GOSSAFUNC graph for a method.md new file mode 100644 index 0000000000..36c75fc7af --- /dev/null +++ b/published/202006/20200619 How to dump the GOSSAFUNC graph for a method.md @@ -0,0 +1,99 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12350-1.html) +[#]: subject: (How to dump the GOSSAFUNC graph for a method) +[#]: via: (https://dave.cheney.net/2020/06/19/how-to-dump-the-gossafunc-graph-for-a-method) +[#]: author: (Dave Cheney https://dave.cheney.net/author/davecheney) + +在 Go 中如何转储一个方法的 GOSSAFUNC 图 +====== + +![](https://img.linux.net.cn/data/attachment/album/202006/26/083943vymvmc67p7s3oman.jpg) + +Go 编译器的 SSA 后端包含一种工具,可以生成编译阶段的 HTML 调试输出。这篇文章介绍了如何为函数*和*方法打印 SSA 输出。 + +让我们从一个包含函数、值方法和指针方法的示例程序开始: + +``` +package main + +import ( + "fmt" +) + +type Numbers struct { + vals []int +} + +func (n *Numbers) Add(v int) { + n.vals = append(n.vals, v) +} + +func (n Numbers) Average() float64 { + sum := 0.0 + for _, num := range n.vals { + sum += float64(num) + } + return sum / float64(len(n.vals)) +} + + +func main() { + var numbers Numbers + numbers.Add(200) + numbers.Add(43) + numbers.Add(-6) + fmt.Println(numbers.Average()) +} +``` + +通过 `GOSSAFUNC` 环境变量控制 SSA 调试输出。此变量含有要转储的函数的名称。这*不是*函数的完全限定名。对于上面的 `func main`,函数名称为 `main` *而不是* `main.main`。 + +``` +% env GOSSAFUNC=main go build +runtime +dumped SSA to ../../go/src/runtime/ssa.html +t +dumped SSA to ./ssa.html +``` + +在这个例子中,`GOSSAFUNC=main` 同时匹配了 `main.main` 和一个名为 `runtime.main` 的函数。[^1]这有点不走运,但是实际上可能没什么大不了的,因为如果你要对代码进行性能调整,它就不会出现在 `func main` 中的巨大的意大利面块中。 + +你的代码更有可能在*方法*中,你可能已经看到这篇文章,并寻找能够转储方法的 SSA 输出。 + +要为指针方法 `func (n *Numbers) Add` 打印 SSA 调试,等效函数名为 `(*Numbers).Add`:[^2] + +``` +% env "GOSSAFUNC=(*Numbers).Add" go build +t +dumped SSA to ./ssa.html +``` + +要为值方法 `func (n Numbers) Average` 打印 SSA 调试,等效函数名为 `(*Numbers).Average`,*即使这是一个值方法*: + +``` +% env "GOSSAFUNC=(*Numbers).Average" go build +t +dumped SSA to ./ssa.html +``` + +[^1]: 如果你没有从源码构建 Go,那么 `runtime` 软件包的路径可能是只读的,并且可能会收到错误消息。请不要使用 `sudo` 来解决此问题。 +[^2]: 请注意 shell 引用 + + +-------------------------------------------------------------------------------- + +via: https://dave.cheney.net/2020/06/19/how-to-dump-the-gossafunc-graph-for-a-method + +作者:[Dave Cheney][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://dave.cheney.net/author/davecheney +[b]: https://github.com/lujun9972 + diff --git a/published/202006/20200621 How to Make Ubuntu Look Like macOS in 5 Easy Steps.md b/published/202006/20200621 How to Make Ubuntu Look Like macOS in 5 Easy Steps.md new file mode 100644 index 0000000000..9d5d5f7cf6 --- /dev/null +++ b/published/202006/20200621 How to Make Ubuntu Look Like macOS in 5 Easy Steps.md @@ -0,0 +1,240 @@ +[#]: collector: (lujun9972) +[#]: translator: (robsean) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12361-1.html) +[#]: subject: (How to Make Ubuntu Look Like macOS in 5 Easy Steps) +[#]: via: (https://itsfoss.com/make-ubuntu-look-like-macos/) +[#]: author: (Community https://itsfoss.com/author/itsfoss/) + +5 个简单步骤使你的 Ubuntu 看起来像 macOS +====== + +定制是 [我为什么使用 Linux][1] 的一个主要原因。定制桌面 Linux 的道路是永无止境的。你可以更改图标、主题、字体、终端、添加屏幕小工具、[指示器小程序][2]、扩展等诸如此类的东西。 + +我们已经介绍了很多桌面环境定制的建议和技巧。在这篇文章中,我将向你展示如何使 Ubuntu 看起来像 macOS。 + +很多人使用 macOS,是因为它的简单和优雅的外观。你可能不同意这一点,但这仍然是一个流行的观点。甚至有的 Linux 发行版也有类似 macOS 外观和感觉。 + +一位读者要求我们展示如何使 Ubuntu 看起来像 macOS,因此我们写了这篇教程。事实上,这是一个用来展示桌面 Linux 定制能力的很好的示例。 + +不过,你没有必要为定制外观而安装一个新的发行版。你可以在你自己的系统上做一些调整来给予你一个类似 macOS 的外观。 + +### 如何给你的 Ubuntu Linux 进行 macOS 改造 + +![][3] + +尽管这篇文章是对 Ubuntu 的建议,但是你也可以在其它使用 GNOME 桌面环境的发行版中使用这些建议,几乎可以不做任何改动。请确保[检查一下你的桌面环境][4]。 + +说实话,即使你使用的是其它的桌面环境,你仍然可以得到一些关于要做哪些更改的提示。但是你必须确保使用你的桌面环境的工具按照步骤进行。 + +#### 必要条件: GNOME Tweaks 和 GNOME 扩展 + +请确保 [安装 GNOME Tweaks 工具][5]。你需要它来更改主题和图标。 + +你也需要 [启用 GNOME 扩展][6] 来更改 GNOME Shell 和添加重要的要点。 + +在你启用 GNOME 扩展后,你需要从 [GNOME 扩展][7] 网站安装“用户主题” 扩展,或者只需要转到 [这个超链接][8] ,并单击开关来将其打开。 + +我也希望你对 [在 Ubuntu 上安装主题][9] 有一定的了解。不过,我还是简单的谈了一下这个主题。 + +让我们依次看看每个步骤。 + +#### 步骤 1: 安装一个 macOS 风格的 GTK 主题 + +因为重点是使 GNOME 看起来像 macOS,所以你应该选择一个像 macOS 一样的主题。有很多主题都是像 macOS 一样的。 + +##### 下载一个你选择的主题 + +你可以转到 [Gnome-look][10] 站点,并搜索关于 GTK3 的主题。如果你在 Gnome-look 网站上看到 “Pling” 字样,不用担心,它们都是来自同一个供应商。 + +你可以选择任何你想要的主题。下面是一些我认为你应该看看的macOS主题: + +- [mcOS 11][11] +- [McHigh Sierra][12] +- [Catalina][13] +- [McMojave][14] + +在这篇文章中,我将使用 “[McMojave][14]”。你可以选择任何你想要的主题。你将在网站的右侧找到下拉式的下载按钮,单击它。 + +![McMojave 暗黑主题][15] + +在这里你可以找到各种 “.tar.xz” 文件。这些不同的文件包含了相同的主题,但有一些小的差异。像在 “McMojave” 中,我们有像暗黑主题和明亮主题的变体。你可以尝试所有的主题,或者从之间随意选择一个你喜欢的。 + +##### 设置下载的主题 + +提取下载的主题,并复制这些提取的主题文件夹到 `.local/share/themes` 文件夹下。 + +打开 GNOME Tweak 工具,并更改应用程序和 Shell 的主题。在你更改主题的同时,你可以看到黄色、绿色和红色三个按钮,以及左上角的苹果标志。你也可以看到在面板项上的一些更改。 + +![McMojave GTK 和 Shell 主题][16] + +#### 步骤 2: 安装像 macOS 一样的图标 + +macOS 外观改造的下一步骤是使用像 macOS 一样的图标。 + +##### 下载图标集合 + +这里有一些我建议使用的图标集合,你可以从 Gnome-look 网站下载: + +- [McMojave-circle][17] +- [Mojave CT-icons][18] +- [Cupertino icons][19] + +在这篇文章中,我将使用 “[McMojave-circle][17]” ,你可以随意使用任何你喜欢的图标。 + +就像主题一样,你可以从右侧的下拉式的 “下载” 按钮下载图标集合。在这里你也可以找到同一种图标的不同版本。 + +![Mcmojave Circle][20] + +##### 设置图标 + +现在设置下载的图标。为此,提取下载文件中的文件夹并复制它到你的家目录下的 `.icons` 文件夹。 查看这篇关于 [在 Ubuntu 中安装图标主题][9] 的文章。 + +这是这种图标看起来的样子: + +![McMojave Circle 图标外观][21] + +#### 步骤 3: 添加类似 macOS 样子的坞站 + +没有类似 macOS 样子的坞站dock,你的 Ubuntu 就看起来不像 macOS。在 Linux 上有很多可用的坞站。我喜欢 “[Dash to Dock][22]”,我会在这里使用它。 + +“Dash to Dock” 是一个 GNOME 扩展。到现在为止,你已经熟悉 GNOME 扩展。只需要转到 [这个超链接][23] ,并单击切换按钮来安装它。你的原本的坞站将自动被 “Dash to Dock” 所替换。 + +你可以通过右键单击 “show applications” 按钮(最右边的菜单按钮)并选择 “Dash to dock settings” 来更改设置。 + +![Dash To Dock][24] + +#### 步骤 4: 使用 macOS 壁纸 + +大多数复杂的东西已经完成。现在是时候设置 macOS 壁纸了。你可以从下面的超链接下载 macOS 默认壁纸: + +- [下载 macOS 壁纸][25] + +##### 更改桌面背景 + +我将使用 “Mojave Day” 壁纸。右键单击已下载的的图像,并选择 “设置为壁纸” 选项来更改壁纸。 + +在设置这个壁纸后,这是我系统外观的样子: + +![][26] + +##### 更改锁屏壁纸 + +锁屏壁纸选项已经从 [Ubuntu 20.04][27] 的设置中移除。现在它使用一个模糊的桌面壁纸作为锁屏壁纸。 + +要设置一个自定义锁屏壁纸,你可以使用 “[Lock screen background][28]” 扩展。 + +打开 “Lock screen background” 扩展设置,并设置锁屏壁纸。 + +![锁屏背景设置][29] + +这是锁屏现在的样子。如果你感到好奇话,这里是 [如何在 Ubuntu 中截图锁屏][30]。 + +![锁屏][31] + +![登录屏幕][32] + +#### 步骤 5: 更改系统字体 + +这几年,macOS 的主要系统字体是 “San Francisco” 。但是,这个字体并不是公共领域的,而是像苹果生态系统中的许多其他东西一样,是专有字体。基于这个原因,你不能使用这种字体。 + +你能做的就是使用一种看起来像 San Francisc 字体一样的开源字体。我建议使用 Google 的 [Roboto][33] 字体,或 Adobe 的 [Source Sans Pro][34] 。 + +[在 Ubuntu 中安装字体是很简单的][35] 。下载 字体的 zip 文件,只需要在提取出来的文件夹中双击 ttf 文件。它会给你一个选项来逐一安装字体。 + +如果你想节省时间并一次安装所有的字体,提取其中所有的字体到你的家目录(`~/.fonts`)下的 `.fonts` 目录中。 + +![安装字体][36] + +在你安装字体后,你可以使用 GNOME Tweaks 工具来更改系统字体。 + +![设置字体][37] + +#### 额外提示:Spotlight 式的应用程序启动器(如果你像更进一步的话) + +如果你是 macOS Spotlight 启动器的粉丝,那么你在 Linux 上也能找到类似的东西。我最喜欢的这类启动器的软件包是 “[Albert][38]”。 + +你可以 [在 Albert 网站上找到它的安装说明][39] 。 + +安装完成后,打开 Albert 并设置快捷键(你想打开该启动器的组合键)就可以了。我想,在 macOS 中 `Command + Space` 键是来启动 Spotlight;在 Ubuntu 中,你可以设置 `Super+Space` [快捷键][40]。 + +你会会得到很多内置的主题,在下面的图片中,我使用 “Spotlight dark” 主题。 + +Albert 不能直接启动应用程序,你必须授予它在哪里可以进行搜索的权限。 + +![Albert 设置][41] + +在设置后,这是它看起来的样子: + +![Albert 暗黑主题][42] + +这是我的 Ubuntu 20.04 在完成所有定制后的样子。它看起来像 macOS 吗? 仁者见仁,智者见智。 + +![macOS 主题][43] + +![Ubuntu 使用 macOS 外观改造][44] + +如此,这就是你如何使你的 GNOME 桌面看起来像 macOS 一样的步骤。正如我在开始时所说的,这是一个很好的 Linux 桌面定制功能的示例。 + +如果你有新的注意或有任何疑问;评论区全是你的地盘。 + +本文由 Sumeet 编写,并由 Abhishek Prakash 提供补充输入信息。 + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/make-ubuntu-look-like-macos/ + +作者:[Sumeet][a] +选题:[lujun9972][b] +译者:[robsean](https://github.com/robsean) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://itsfoss.com/author/itsfoss/ +[b]: https://github.com/lujun9972 +[1]: https://itsfoss.com/why-use-linux/ +[2]: https://itsfoss.com/best-indicator-applets-ubuntu/ +[3]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/06/Make-Ubuntu-Look-like-MacOS.png?ssl=1 +[4]: https://linux.cn/article-12124-1.html +[5]: https://itsfoss.com/gnome-tweak-tool/ +[6]: https://linux.cn/article-9447-1.html +[7]: https://extensions.gnome.org/ +[8]: https://extensions.gnome.org/extension/19/user-themes/ +[9]: https://itsfoss.com/install-themes-ubuntu/ +[10]: https://www.gnome-look.org/ +[11]: https://www.pling.com/p/1220826 +[12]: https://www.pling.com/p/1013714 +[13]: https://www.pling.com/p/1226871 +[14]: https://www.pling.com/p/1275087 +[15]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/06/McMojave-dark-theme.png?ssl=1 +[16]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/06/McMojave-Desktop.png?ssl=1 +[17]: https://www.gnome-look.org/p/1305429/ +[18]: https://www.gnome-look.org/p/1210856/ +[19]: https://www.gnome-look.org/p/1102582/ +[20]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/06/McMojave-circle-.png?ssl=1 +[21]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/06/McMojave-circle-icons-look.png?fit=800%2C494&ssl=1 +[22]: https://github.com/micheleg/dash-to-dock +[23]: https://extensions.gnome.org/extension/307/dash-to-dock/ +[24]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/06/Dash-to-dock-1.png?ssl=1 +[25]: https://oswallpapers.com/category/mac-os/ +[26]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/06/Wallpaper.png?fit=800%2C450&ssl=1 +[27]: https://itsfoss.com/ubuntu-20-04-release-features/ +[28]: https://extensions.gnome.org/extension/1476/unlock-dialog-background/ +[29]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/06/Lock-screen-background-setting.png?ssl=1 +[30]: https://itsfoss.com/screenshot-login-screen-ubuntu-linux/ +[31]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/06/Lock-screen-1.png?ssl=1 +[32]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/06/Login-screen-1.png?ssl=1 +[33]: https://fonts.google.com/specimen/Roboto?query=robot +[34]: https://adobe-fonts.github.io/source-sans-pro/ +[35]: https://itsfoss.com/install-fonts-ubuntu/ +[36]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/06/Fonts.png?ssl=1 +[37]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/06/Set-fonts.png?ssl=1 +[38]: https://albertlauncher.github.io/ +[39]: https://albertlauncher.github.io/docs/installing/ +[40]: https://itsfoss.com/ubuntu-shortcuts/ +[41]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/06/Albert-settings.png?ssl=1 +[42]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/06/Albert-look.png?ssl=1 +[43]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/06/macOS-theme.png?fit=800%2C450&ssl=1 +[44]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/06/macOS-theme-2.png?fit=800%2C450&ssl=1 diff --git a/published/202006/20200623 Make the switch from Mac to Linux easier with Homebrew.md b/published/202006/20200623 Make the switch from Mac to Linux easier with Homebrew.md new file mode 100644 index 0000000000..f28c5fbf98 --- /dev/null +++ b/published/202006/20200623 Make the switch from Mac to Linux easier with Homebrew.md @@ -0,0 +1,263 @@ +[#]: collector: (lujun9972) +[#]: translator: (nophDog) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12358-1.html) +[#]: subject: (Make the switch from Mac to Linux easier with Homebrew) +[#]: via: (https://opensource.com/article/20/6/homebrew-linux) +[#]: author: (Matthew Broberg https://opensource.com/users/mbbroberg) + +Homebrew 让你从 Mac 切换到 Linux 更轻松 +====== + +> 不管你是想要更舒服地从 Mac 搬到 Linux,还是不满意常规的 Linux 包管理器,都可以试试 Homebrew。 + +![](https://img.linux.net.cn/data/attachment/album/202006/28/091127an02f8oae0pln3as.jpg) + +[Homebrew][2] 项目最初是为了给 Mac 用户提供一个非官方的 Linux 式的包管理器。用户很快就爱上了它友好的界面以及帮助性的提示,而且,它已经被移植到 Linux 系统 —— 这看起来像是一个奇怪的命运转折。 + +一开始,有两个分开的项目分别针对 macOS 和 Linux (Homebrew 与 Linuxbrew),但是现在是由 Homebrew 核心管理着这两个操作系统。由于我正 [从 Mac 切换到 Linux][3],所以一直在研究我在 macOS 最常用的开源软件在 Linux 表现如何,最终,我很高兴地发现 Homebrew 对 Linux 的支持太赞了! + +### 为什么要在 Linux 使用 Homebrew 呢? + +长期使用 Linux 的用户对 Homebrew 的第一反应是:“为什么不直接使用……呢”,省略号代表他们喜欢的某个 Linux 包管理器。基于 Debian 的系统早就有了 `apt`,基于 Fedora 的系统则有 `dnf` 和 `yum`,并且像 Flatpak 跟 AppImage 这样的项目,在两种系统上都能流畅运行。我花了不少时间尝试这些技术,不得不说,它们都有其强大之处。 + +那我为什么还要 [坚持使用 Homebrew][4] 呢?首先,我对它非常熟悉。在为我过去使用的专有软件寻找开源替代品的过程中,我已经学会了许多使用方法,而保持一些熟悉的东西,比如 Homebrew,可以让我专注于一次学习一件事情,而不是被不同系统间的差异搞垮。 + +此外,我没有看到哪一个包管理器像 Homebrew 一样,对用户如此友好。正如默认的帮助命令一样,命令井然有序: + +``` +$ brew -h +Example usage: +  brew search [TEXT|/REGEX/] +  brew info [FORMULA...] +  brew install FORMULA... +  brew update +  brew upgrade [FORMULA...] +  brew uninstall FORMULA... +  brew list [FORMULA...] + +Troubleshooting: +  brew config +  brew doctor +  brew install --verbose --debug FORMULA + +Contributing: +  brew create [URL [--no-fetch]] +  brew edit [FORMULA...] + +Further help: +  brew commands +  brew help [COMMAND] +  man brew +  +``` + +过于简短的输出可能会被误解为它功能局限,但是你简单看看每一个子命令,都有很丰富的功能。虽然上面的列表只有短短 23 行,但对高级用户来说,光是子命令 `install` 就包含整整 79 行的帮助信息: + +``` +$ brew --help | wc -l +23 +$ brew install --help | wc -l +79 +``` + +它可以选择忽略或者安装依赖关系,也可以选择用源代码编译以及用什么编译器来编译某个确切的上游 Git 提交,或者选择应用的官方 “灌装” 版。总而言之,Homebrew 即适合新手,也同样能满足老鸟。 + +### 开始在 Linux 使用 Homebrew + +如果你想要试着使用 Homebrew,可以用这个单行脚本在 Mac 或者 Linux 上进行安装: + +``` +$ /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)" +``` + +这条命令会立即开始安装 Homebrew。如果你比较谨慎,可以使用 `curl` 将该文件下载到本地,检查完毕之后再运行。 + +``` +$ curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh --output homebrew_installer.sh +$ more homebrew_installer.sh # 审核该脚本,直到你觉得没问题了 +$ bash homebrew_installer.sh +``` + +对 Linux 的安装步骤还包括如何配置点文件,对于 Debian 系统来说是 `~/.profile`,对于 Fedora 系统是 `~/.bash_profile`。 + +``` +$ test -d /home/linuxbrew/.linuxbrew && eval $(/home/linuxbrew/.linuxbrew/bin/brew shellenv) +$ test -r ~/.bash_profile && echo "eval \$($(brew --prefix)/bin/brew shellenv)" >>~/.bash_profile +$ echo "eval \$($(brew --prefix)/bin/brew shellenv)" >>~/.profile +``` + +为了确认已经安装好,Homebrew 团队提供一个空的 `hello` “秘方” 供测试: + +``` +$ brew install hello +==> Downloading https://linuxbrew.bintray.com/bottles/hello-2.10.x86_64_linux.bottle.tar.gz +######################################################################## 100.0% +==> Pouring hello-2.10.x86_64_linux.bottle.tar.gz +🍺 /home/linuxbrew/.linuxbrew/Cellar/hello/2.10: 52 files, 595.6KB +``` + +看起来安装毫无问题,让我来试试更多操作。 + +### 命令行工具 Brew + +Homebrew 宣称自己是一款默认只 “安装你需要而 [Linux] 没有的东西”的应用程序。 + +你可以用 `brew` 命令安装任何打包在 Homebrew 中的命令行软件。这些包的定义文件叫做 “秘方formula”,而且它们通过“瓶子bottle”来编译并分享。在 Homebrew 的世界里,还有许多 “啤酒方面” 的术语,但这个包管理器主要目的是让软件便于使用。 + +都有些什么样的软件呢?对我这样的技术玩家(既然你已经在读这篇文章,估计你也是)来说最方便的东西。例如,便利的 `tree` 命令,可以展示目录结构,或者 `pyenv`,我用它来 [在 Mac 管理不同版本 Python][5]。 + +你可以用 `search` 命令查看所有可以安装的“秘方”,在后面加上 `wc` 命令看看一共有多少: + +``` +# -l 选项统计行数 +$ brew search | wc -l +    5087 +``` + +迄今为止,一共有 5000 多个 “秘方”,这囊括了很多软件。需要注意的是:并非所有 “秘方” 都能在 Linux 运行。在 `brew search --help` 输出中有一节提到可以按软件运行的操作系统来筛选软件。它会在浏览器打开用于每个操作系统的软件仓库。我运行的是 Fedora,所以我会用它来试一试: + +``` +$ brew search --fedora tree +``` + +浏览器打开了网址 `https://apps.fedoraproject.org/packages/s/tree`,向我展示了所有 Fedora 的可用选项。你也可以通过其它方法进行浏览。“秘方” 被集中整理到由操作系统划分的核心仓库当中(Mac 在 [Homebrew Core][6],Linux 在 [Linux Core][7])。同样也可以通过 Homebrew API [在网页显示][8]。 + +即使有这些选择,我还是通过其它用户的推荐找到很多新工具。我列出一些我最喜欢的工具,你可以在里面找点灵感: + + * `pyenv`、`rbenv` 和 `nodenv` 用来管理(相应的) Python、Ruby 和 Node.js 版本 + * `imagemagick` 用于脚本化编辑图片 + * `pandoc` 用于脚本化转换文档格式(我通常将 .docx 文件转成 .md 或者 .html) + * `hub` 为 GitHub 用户提供 [更好的 Git 体验][9] + * `tldr` 展示了命令工具的使用范例 + +想要深入了解 Homebrew,可以去 [trldr 页面][10] 看看,比起应用的 man 页面,它要友好得多。使用 `search` 命令确认你可以安装: + +``` +$ brew search tldr +==> Formulae +tldr ✔ +``` + +太好了!对勾说明你可以安装。那么继续吧: + +``` +$ brew install tldr +==> Downloading https://linuxbrew.bintray.com/bottles/tldr-1.3.0_2.x86_64_linux.bottle.1.tar.gz +######################################################################## 100.0% +==> Pouring tldr-1.3.0_2.x86_64_linux.bottle.1.tar.gz +🍺 /home/linuxbrew/.linuxbrew/Cellar/tldr/1.3.0_2: 6 files, 63.2KB +``` + +Homebrew 提供了编译好的二进制文件,所以你不必在本地机器上从源码编译。这能节省很多时间,也不用听 CPU 风扇的噪声。我很欣赏 Homebrew 的另外一点是,你不完全理解每一个选项的含义也不会影响正常使用。若你想自己编译,可以在 `brew install` 命令后面加上 `-s` 或者 `--build-from-source` 标识,这样就能从源码编译 “秘方”(即便已经有一个 “瓶子” 存在)。 + +同样,软件底层的复杂性也很有意思。使用 `info` 可以查看 `tldr` 软件的依赖管理,“秘方” 的源代码存放在磁盘上的何处,甚至还能查看公开分析。 + +``` +$ brew info tldr +tldr: stable 1.3.0 (bottled), HEAD +Simplified and community-driven man pages +https://tldr.sh/ +Conflicts with: + tealdeer (because both install `tldr` binaries) +/home/linuxbrew/.linuxbrew/Cellar/tldr/1.3.0_2 (6 files, 63.2KB) * + Poured from bottle on 2020-06-08 at 15:56:15 +From: https://github.com/Homebrew/linuxbrew-core/blob/master/Formula/tldr.rb +==> Dependencies +Build: pkg-config ✔ +Required: libzip ✔, curl ✔ +==> Options +--HEAD + Install HEAD version +==> Analytics +install: 197 (30 days), 647 (90 days), 1,546 (365 days) +install-on-request: 197 (30 days), 646 (90 days), 1,546 (365 days) +build-error: 0 (30 days) +``` + +### 从 Mac 到 Linux 的一点不足 + +在 macOS,Homebrew 的 `cask`(“酒桶”)子命令可以让用户使用命令行安装、管理整个应用软件。不幸的是,`cask` 还不能在任何 Linux 发行版上使用。我在安装一个开源工具时发现了这点: + +``` +$ brew cask install tusk +Error: Installing casks is supported only on macOS +``` + +我在 [论坛上][11] 问了一下,很快得到其他用户的反馈。总结一下,方案如下: + +* 复刻 Homebrew 项目,构建这个特性,然后像别人展示其价值 +* 给该软件写一个 “秘方”,然后从源代码编译 +* 为该软件创建一个第三方仓库 + +最后一个是我最感兴趣的。Homebrew 通过 [创建并维护 “水龙头tap”][12] (另一个受啤酒影响的术语)管理第三方仓库。随着你对系统越来越熟悉,并想加入生态系统, “水龙头” 是值得研究的。 + +### 备份 Homebrew 的安装记录 + +我最中意的 Homebrew 特性之一就是你可以像其它任何 [用版本控制工具来备份点文件][13] 一样备份你的安装记录。为了实现这个目的,Homebrew 提供 `bundle`(“捆扎”)子命令,它可以控制一个叫 `dump`(“倾倒”)的子命令生成一个 `Brewfile`。这个文件包含你目前所有安装的工具列表,可以重复使用。进入你想使用的目录然后运行命令,它会根据你所安装的软件生成 `Brewfile`: + +``` +$ cd ~/Development/dotfiles # This is my dotfile folder +$ brew bundle dump +$ ls Brewfile +Brewfile +``` + +当我换了一台机器,想要安装一样的软件时,进入含有 `Brewfile` 的文件夹,然后重新安装: + +``` +$ ls Brewfile +Brewfile +$ brew bundle +``` + +它会在我的新机器上安装所有列出的 “秘方”。 + +#### 在 Mac 和 Linux 同时管理 Brewfile + +`Brewfile` 非常适合备份你目前的安装记录,但是如果某些在 Mac 上运行的软件无法运行在 Linux 呢?或者刚好相反?我发现不管是 Mac 还是 Linux,如果软件无法在当前操作系统运行,Homebrew 会优雅地忽略那一行。如果它遇到不兼容的请求(比如使用 `brew` 在 Linux 安装 “酒桶cask” 时),它会选择跳过,继续安装过程: + +``` +$ brew bundle --file=Brewfile.example + +Skipping cask licecap (on Linux) +Skipping cask macdown (on Linux) +Installing fish +Homebrew Bundle complete! 1 Brewfile dependency now installed. +``` + +为了保持配置文件的简洁,我在两个操作系统上使用同一份 `Brewfile`,因为它只安装与操作系统相关的版本,所以我一直没有遇到任何问题。 + +### 使用 Homebrew 管理软件包 + +Homebrew 已经成了我必备的命令行工具,由于我很熟悉它,所以在 Linux 上的体验也充满乐趣。Homebrew 让我的工具井然有序,并且时刻保持更新,我愈发欣赏它在实用性与功能上找到的平衡点。我更喜欢将软件包管理的细节保持在用户需要了解的最小程度,大多数人都会从中受益。如果你已经很熟悉 Linux 包管理器了,Homebrew 可能会让你觉得很基础,但稍微深入一点看,就会发现它的高级选项远远超过本文的内容。 + +对 Linux 用户来说,他们有很多包管理器可以选择。如果你来自 MacOS,Homebrew 会让你宾至如归。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/6/homebrew-linux + +作者:[Matthew Broberg][a] +选题:[lujun9972][b] +译者:[nophDog](https://github.com/nophDog) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/mbbroberg +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/computer_desk_home_laptop_browser.png?itok=Y3UVpY0l (Digital images of a computer desktop) +[2]: https://brew.sh/ +[3]: https://opensource.com/article/19/10/why-switch-mac-linux +[4]: https://opensource.com/article/20/6/homebrew-mac +[5]: https://opensource.com/article/20/4/pyenv +[6]: https://github.com/Homebrew/homebrew-core +[7]: https://github.com/Homebrew/linuxbrew-core +[8]: https://formulae.brew.sh/formula/ +[9]: https://opensource.com/article/20/3/github-hub +[10]: https://github.com/tldr-pages/tldr +[11]: https://discourse.brew.sh/t/add-linux-support-to-existing-cask/5766 +[12]: https://docs.brew.sh/How-to-Create-and-Maintain-a-Tap +[13]: https://opensource.com/article/19/3/move-your-dotfiles-version-control diff --git a/published/202006/20200624 Customize your Raspberry Pi operating system for everyday use.md b/published/202006/20200624 Customize your Raspberry Pi operating system for everyday use.md new file mode 100644 index 0000000000..52fc766db8 --- /dev/null +++ b/published/202006/20200624 Customize your Raspberry Pi operating system for everyday use.md @@ -0,0 +1,107 @@ +[#]: collector: (lujun9972) +[#]: translator: (Yufei-Yan) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12365-1.html) +[#]: subject: (Customize your Raspberry Pi operating system for everyday use) +[#]: via: (https://opensource.com/article/20/6/custom-raspberry-pi) +[#]: author: (Patrick H. Mullins https://opensource.com/users/pmullins) + +定制用于日常使用的树莓派系统 +====== + +> 安装精简版树莓派系统,让你的树莓派更加轻盈。 + +![](https://img.linux.net.cn/data/attachment/album/202006/30/133836pfm4u3sq073ffmbf.jpg) + +你有一个运行[树莓派系统][2]Raspberry Pi OS(以前称为 Raspbian)操作系统的树莓派Raspberry Pi,你肯定知道,它是一个非常棒的小型电脑,有一个很好的操作系统,对于初学者来说,它包括了你可能想要的一切。然而,一旦你熟悉了它,并且想用它干一些别的事情的时候,你可能不想要那个默认囊括了一切组件的操作系统。 + +在这种情况下,你两个选择:要么你可以绞尽脑汁地把所有你不需要的东西都删干净,要么你还可以用精简版树莓派系统Raspberry Pi OS Lite来构建专门为你的需求而定制的轻量级操作系统。我的建议是,用第二种方法,既简便又节省时间。 + +### Raspberry Pi OS Lite + +“精简版Lite”的树莓派系统Raspberry Pi OS其实没什么特别的,就是一个基于最新版本的 [Debian][3] 的最小化镜像。这个镜像仅包含了操作系统核心和启动到命令行的部分,而不会进入图形桌面。可以将这个作为你的定制树莓派系统的基础。这之后的所有东西都是建立在这个核心之上的。 + +前往树莓派基金会的网站上[下载][2]这个轻量级镜像。下载完成后,查看详细的[安装指南][4],这里面介绍了在 Linux、Windows 或者 macOS 下如何烧制树莓派操作系统的 SD 卡。 + +如果你计划用树莓派作为一个极简系统来运行一些脚本和服务的话,差不多这么多就够了。如果你还想干更多事,那继续往下读。 + +### X Window + +首先,如果偶尔需要通过图形用户界面(GUI)连接到你的树莓派,安装一个窗口系统还是不错的。 + +[X Window 系统][5],有时候称为 X11,是 Unix 操作系统上一个常见的基本窗口系统。X11 提供了一套 GUI 桌面环境的基本框架。它可以让你通过窗口、鼠标和键盘与计算机交互。 + +#### 安装 X Window + +下面这一行安装了能让 X11 运行的最少的包。 + +``` +sudo apt install -y --no-install-recommends xserver-xorg-core xserver-xorg xfonts-base xinit +``` + +如果使用 `--no-install-recommends`,则只安装了主要的一些依赖(`Depends` 字段中的包)。这样可以节省很多空间,因为没有安装那些建议却不一定需要的包。 + +### 进阶:使用 Xfce 桌面环境 + +如果你愿意,可以就此停下了,然后开始使用 X Window 作为你的桌面。不过,我并不建议这么做。X Window 自带的这种最小化的窗口管理工具走的是极简主义风格,某种程度上让人感觉过时了。相反,我建议安装现代化的桌面环境,比如说像 Xfce、GNOME 或者 KDE。当用在微型计算机上时,我更倾向于 [Xfce][6] 而不是其他的,因为它就是为资源有限的系统设计的,而且你可以通过主题、图标或者其他东西对它进行定制。 + +#### 安装 Xfce + +安装 Xfce 桌面环境相当简单。只需要: + +``` +sudo apt install -y --no-install-recommends xfce4 desktop-base lightdm +``` + +这就够了。你现在安装了 X Window(X11)和 Xfce 了。现在是时候来定制一下环境并且安装一些核心应用了。 + +### 核心应用 + +目前为止,你已经安装了 X Window(X11)、Xfce 桌面环境和 LightDM(一个 Xfce 自带的显示管理器)。现在,你已经有了一个可以启动并且正常使用的轻量级的完整系统。不过,在彻底完成之前,我还是喜欢装一些核心应用。 + +下面这条命令安装了一个终端程序、[Audacious][7] 音频播放器、[Ristretto][8] 图像浏览器、[Mousepad][9] 文本编辑器、[File Roller][10] 存档管理器和 [Thunar][11] 容量管理器。 + +``` +sudo apt install -y --no-install-recommends xfce4-terminal audacious ristretto +sudo apt install -y --no-install-recommends mousepad file-roller thunar-volman +``` + +#### 其他可选项 + +其他一些你可能想安装的东西,包括一个好的网络管理器、任务管理器、PDF 阅读器和通知工具,以及桌面背景管理器、截图工具、一些新的图标和光标主题。简单来说,如果树莓派是你的首选系统,这些都算是日常工作的一些补充。 + +``` +sudo apt install -y --no-install-recommends network-manager xfce4-taskmanager xfce4-notifyd +sudo apt install -y --no-install-recommends  xpdf gnome-icon-theme dmz-cursor-theme +``` + +### 下一步该做什么? + +如果一切都正常工作的话,你现在就有一个基于 Xfce 和 Debian Lite 超轻量级操作系统的树莓派了。我建议现在你去 Xfce 网站上查看其它很酷的好东西,这些你都可以安装并使用。下一步做什么完全由你决定! + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/6/custom-raspberry-pi + +作者:[Patrick H. Mullins][a] +选题:[lujun9972][b] +译者:[Yufei-Yan](https://github.com/Yufei-Yan) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/pmullins +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/raspberrypi_cartoon.png?itok=m3TcBONJ (Cartoon graphic of Raspberry Pi board) +[2]: https://www.raspberrypi.org/downloads/raspberry-pi-os/ +[3]: https://www.debian.org/ +[4]: https://www.raspberrypi.org/documentation/installation/installing-images/README.md +[5]: https://en.wikipedia.org/wiki/X_Window_System +[6]: http://xfce.org +[7]: https://audacious-media-player.org/ +[8]: https://docs.xfce.org/apps/ristretto/start +[9]: https://github.com/codebrainz/mousepad +[10]: https://gitlab.gnome.org/GNOME/file-roller +[11]: https://docs.xfce.org/xfce/thunar/thunar-volman +[12]: https://goodies.xfce.org/ diff --git a/published/202007/20180730 50 Best Ubuntu Apps You Should Be Using Right Now.md b/published/202007/20180730 50 Best Ubuntu Apps You Should Be Using Right Now.md new file mode 100644 index 0000000000..3c9039e20f --- /dev/null +++ b/published/202007/20180730 50 Best Ubuntu Apps You Should Be Using Right Now.md @@ -0,0 +1,501 @@ +50 个绝佳的必备 Ubuntu 应用 +====== + +> 摘要:这是一份详尽清单,给所有用户的优秀的 Ubuntu 应用。这些应用将帮助你获得更好的 Linux 桌面使用体验。 + +过去,我已经多次写过关于 [安装 Ubuntu 之后该做什么][1]。每次我都建议在 Ubuntu 上安装某些关键的应用程序。 + +那么问题来了,什么是关键的 Ubuntu 应用程序?没有绝对的答案。这取决于你的需要和你在 Ubuntu 上要做的工作。 + +然而还是有很多读者请我推荐一些优秀的 Ubuntu 应用。这就是为什么我创建了这个全面的Ubuntu应用程序列表,你可以经常使用。 + +为了方便阅读和理解,清单划分为不同应用种类。 + +### 提供更好使用体验的优秀 Ubuntu 应用 + +![优秀 Ubuntu 应用][2] + +当然,你不必使用以下全部应用。只须浏览这份 Ubuntu 关键应用清单,阅读描述并安装你需要或想要的应用。将这篇文章保存在你的浏览器收藏夹以备将来参考或者通过搜索引擎搜索即可。 + +这份 Ubuntu 优秀应用清单是准备给普通 Ubuntu 用户的,因此这些应用不全是开源的。我也标记了某些可能不适合新手的稍微复杂的应用。清单适用于 Ubuntu 16.04、18.04 和其他版本。 + +除非特别声明,所有列出的软件都可以在 Ubuntu 软件中心获得。 + +如果你没有在软件中心找到应用或者缺失安装说明,请告知我,我会补充安装步骤。 + +话不多说!让我们看看有哪些优秀 Ubuntu 应用。 + +#### 浏览器 + +Ubuntu 以 Firefox 为默认浏览器。自从 Quantum 版本发布以来,Firefox 已有显著提升。就个人而言,我经常使用多个浏览器来应对不同的工作。 + +##### Google Chrome + +![Google Chrome Logo][3] + +由于某种原因,Google Chrome 是最为广泛使用的浏览器。使用 Google 账号,你可以在不同设备无缝同步。大量拓展和应用进一步增强 Chrome 的能力。你可以 [点击此处在 Ubuntu 上安装 Chrome][4]。 + +##### Brave + +![brave browser][5] + +Google Chrome 可能是最广泛使用的浏览器,但也是隐私窥探者。一个 [替代浏览器][6] 是 [Brave][7],它可以默认拦截广告和追踪脚本。它为你提供了更快、更安全的浏览体验。 + +#### 音乐应用 + +![Ubuntu 优秀音乐应用][8] + +Ubuntu 将 Rhythmbox 作为默认音乐播放器,这是个相当不坏的选择。不过,你当然可以安装更好的音乐播放器。 + +##### Sayonara + +[Sayonara][9] 是一个小型、轻量并具备漂亮的深色用户界面的音乐播放器。它拥有所有你期望的标准音乐播放器应有的关键功能。它与 Ubuntu 桌面环境整合良好并且不会大量消耗你的内存。 + +##### Audacity + +[Audacity][10] 与其说是音频播放器,不如说是音频编辑器。你可以使用这款自由且开源的工具录制和编辑音频。它支持 Linux、Windows 和 macOS。你可以从软件中心安装它。 + +##### MusicBrainz Picard + +[Picard][11] 不是一个音乐播放器,而是个音乐标签软件。如果你有大量本地音乐文件,Picard 可以帮助你自动更新音乐文件的正确的曲目、专辑、艺人资料和专辑封面。 + +#### 流媒体音乐应用 + +![Streaming Music app Ubuntu][12] + +在这个时代的互联网,听音乐的方式显然发生了改变。现在的人更依赖于流媒体音乐播放器而不是收藏上百首本地音乐文件。让我们看看你可以用于收听流媒体音乐的一些应用吧。 + +##### Spotify + +[Spotify][13] 是流媒体音乐之王。好消息是它具有官方 Linux 版本。[Ubuntu 上的 Spotify 应用][14] 与媒体键和声音菜单以及桌面通知中心整合良好。请注意,Spotify 服务可能在你的国家有,也可能没有。 + +##### Nuvola 音乐播放器 + +[Nuvola][15] 不是像 Spotify 那样的流媒体音乐服务。它是一款在单一应用内支持多个流媒体音乐服务的桌面音乐播放器。你可以使用 Spotify、Deezer、Google Play Music、Amazon Cloud Player 和更多类似服务。 + +#### 视频播放器 + +![Linux 视频播放器][16] + +Ubuntu 有默认的 GNOME 视频播放器(从前名为 Totem),表现尚可,但不支持多种视频编码。当然有很多播放器比 GNOME 视频播放器更优秀。 + +##### VLC + +自由开源的 [VLC][17] 摘得视频播放器桂冠。它几乎支持全部的视频编码。它还允许你将音量增至最高的 200%。它也支持从最后一个已知位置继续播放。有很多 [VLC 使用技巧][18] 供你参考以尽兴使用。 + +##### MPV + +[MPV][19] 是款值得更多关注的视频播放器。别致轻量的界面和丰富的功能,MPV 拥有你对一个好的视频播放器的一切期望。你甚至可以在命令行使用它。如果你对 VLC 不够满意,你完全可以尝试 MPV。 + +#### 云端存储服务 + +本地备份很好,但云端存储给你更多维度的自由。使用云存储,你再也不必总是随身携带 U 盘或担心硬盘故障。 + +##### Dropbox + +![Dropbox logo][20] + +[Dropbox][21] 是最流行的云存储提供商之一。你会获得 2GB 免费存储空间,并通过推介给他人得到更多存储空间。Dropbox 提供了一个原生的 Linux 客户端,你可以从官网下载获得。它会在你的系统创建一个本地文件夹,以和云端服务器同步。 + +##### pCloud + +![pCloud icon][22] + +[pCloud][23] 是另一个优秀的 Linux 云存储提供商。它也拥有原生的 Linux 客户端,你可以从官网下载。你可以获得高达 20GB 的免费存储空间,如果你需要更多,价格也比 Dropbox 实惠。pCloud 总部位于瑞士,这个国家以严格的数据隐私法而闻名。 + +#### 图片编辑器 + +我相信你一定会在某个时间点上需要一个照片编辑器。这里有些优秀的 Ubuntu 图片编辑应用。 + +##### GIMP + +![gimp icon][24] + +[GIMP][25] 是一个自由开源的图片编辑器,它支持 Linux、Windows 和 macOS。它是 Adobe Photoshop 在 Linux 上最优秀的替代软件。你可以使用它执行任何图片编辑。网上有许多资源帮助你使用 GIMP。 + +##### Inkscape + +![inkscape icon][26] + +[Inkscape][27] 也是一个自由开源的图片编辑器,专用于矢量图形编辑。你可以在 Inkscape 上设计矢量图形和徽标。你可以把它比做 Adobe Illustrator。与 GIMP 一样,网上也有诸多 Inkscape 教程。 + +#### 绘图应用 + +![Painting apps for Ubuntu Linux][28] + +绘图应用和图片编辑器不完全等同,尽管它们有时功能重叠。以下是你能在 Ubuntu 使用的一些绘图应用。 + +##### Krita + +[Krita][29] 是一款自由开源的数字绘图应用。你可以用它创建数字绘画、漫画和动画。这是款专业软件,甚至被美术学校作为主要软件使用。 + +##### Pinta + +[Pinta][30] 虽然不像 Krita 功能强大,但也可圈可点。你可以把它视为 Linux 端的微软画图软件。你可以绘制、画图、添加文字和执行绘图应用可行的其他诸如此类的小任务。 + +#### 摄影应用 + +摄影爱好者还是专家?你将随手获得大量 [摄影工具][31],以下是一些推荐应用。 + +##### digiKam + +![digikam][32] + +使用开源软件 [digKam][33],你可以专业地处理你的高品质摄影作品。digKam 提供用于查看、管理、编辑、增强、组织、标记和分享照片所需的所有工具。 + +##### Darktable + +![Darktable icon][34] + +[darktable][35] 是一款开源的摄影工作流应用程序,特别是专注于 raw 图像的开发。这会是你取代 Adobe Lightroom 的最佳替代品。它同样支持 Windows 和 macOS。 + +#### 视频编辑器 + +![Video editors Ubuntu][36] + +[Linux 上的视频编辑器][37] 并不匮乏,毋庸赘述。看看 Ubuntu 中一些功能丰富但相对简单的视频编辑器。 + +##### Kdenlive + +[Kdenlive][38] 是 Linux 端最好的全能型视频编辑器。它与 iMovie 或 Movie Maker 相比功能毫不逊色。 + +##### Shotcut + +[Shotcut][39] 是视频编辑的另一个好选择。它是一款开源软件,拥有标准视频编辑器的所有功能。 + +#### 图片和视频格式转换器 + +如果你需要为你的图片和视频 [转换文件格式][40],这些是我的推荐。 + +##### Xnconvert + +![xnconvert logo][41] + +[Xnconvert][42] 是一款优秀的批量图像转换工具。你可以批量调整图片尺寸、转换文件类型并重命名。 + +##### Handbrake + +![Handbrake Logo][43] + +[HandBrake][44] 是一款易用的开源工具,用于将多种格式的视频转换为一些现代流行的格式。 + +#### 截图和录屏工具 + +![Screenshot and recorders Ubuntu][45] + +以下是截图和录屏的优秀 Ubuntu 应用。 + +##### Shutter + +[Shutter][46] 是我截图的常用工具。你也可以对这些截图进行一些快速编辑,比如添加箭头、文字或调整图片尺寸。你在我们网站看到的截图都是用 Shutter 编辑的。绝对是 Ubuntu 上最好的应用程序之一。 + +##### Kazam + +[Kazam][47] 是我最喜欢的 [Linux 上的录屏工具][48]。这个是小巧的工具,可以让你录制全屏、某个应用程序窗口或选定区域。你也可以使用快捷键暂停或恢复录屏。[我们的 YouTube 频道][49] 上的教程都是用 Kazam 录制的。 + +#### 办公套件 + +我无法想象你在使用计算机时没有文档编辑器。又何必把自己局限在一个文档编辑器上呢?去寻找一个完整的办公套件吧。 + +##### LibreOffice + +![LibreOffice logo][50] + +Ubuntu 预装了 [LibreOffice][51],它无疑是 [最佳的开源办公软件][52]。它是个组件完整的办公软件,包括文档编辑器、电子表格工具、演示软件、数学工具和作图工具。你甚至可以用它编辑部分 PDF 文件。 + +##### WPS Office + +![WPS Office logo][53] + +[WPS Office][54] 因酷似微软 Office 而广受欢迎。它的界面与微软 Office 几乎一样并且号称与微软 Office 更加兼容。如果你正在寻找类似微软 Office 的办公软件,WPS Office 是个好选择。 + +#### 下载工具 + +![Downloading software Ubuntu][55] + +如果你经常从网上下载视频或其他大型文件,这些工具会帮助你。 + +##### youtube-dl + +这是本清单少有的基于命令行的 Ubuntu 应用之一。如果你想从 YouTube、DailyMotion 或其他视频网站下载视频,youtube-dl 是个绝好的选择。它提供了大量 [视频下载高级选项][56]。 + +##### uGet + +[uGet][57] 是一款功能丰富的 [Linux 下载管理器][58]。它允许你暂停和恢复下载、定时下载、监控剪贴板上的可下载内容。如果你的网络速度很慢、不稳定,或者每天的流量有限,这是一个完美的应对工具。 + +#### 代码编辑器 + +![Coding apps for Ubuntu][59] + +如果你喜欢编程,默认的 Gedit 文本编辑器可能无法满足你的编程需求。下面就为你介绍一些比较好用的代码编辑器。 + +##### Atom + +[Atom][60] 是一款由 GitHub 推出的 [自由开源的代码编辑器][61]。早在它推出第一个稳定版之前,它就因其用户界面、功能和海量插件而成为程序员的至宠。 + +##### Visual Studio Code + +[VS Code][62] 是一款微软出品的开源代码编辑器。别忌惮微软之名,VS Code 是款很棒的 Web 开发编辑器,它还支持许多其他编程语言。 + +#### PDF 和电子书相关应用 + +![eBook Management tools in Ubuntu][63] + +在这个数字时代,你不能只依靠真正的纸质书籍,特别是当有大量的免费电子书唾手可得。这里有一些 Ubuntu 应用以供管理 PDF 和电子书。 + +##### Calibre + +如果你是个书虫,并收集电子书,你应该使用 [Calibre][64]。它是一个电子书管理器,拥有 [创建电子书][65]、转换电子书格式和管理电子书库的所有必要组件。 + +##### Okular + +Okular 主要是一个 PDF 查看器,有编辑 PDF 文件的选项。你可以用 Okular 在 Linux 上做一些基本的 [PDF 编辑][66],如添加弹出式备注、内联式备注、手绘、荧光笔、印章等。 + +#### 通讯应用 + +![Messaging apps for Ubuntu][67] + +我相信你在 Linux 上使用至少一款 [通讯应用][68]。以下是我的推荐。 + +##### Skype + +[Skype][69] 是最流行的视频通讯应用。它也被许多公司和企业用于面试和会议。这使得 Skype 成为 Ubuntu 必备的应用程序之一。 + +##### Rambox + +[Rambox][70] 本身不是一个通讯应用,但它允许你从单一窗口中使用 Skype、Viber、Facebook Messanger、WhatsApp、Slack 和其他一些通讯应用。 + +#### 笔记和待办事项应用 + +需要一个待办事项应用或简单的应用来做笔记吗?看看这些吧。 + +##### Simplenote + +![Simplenote logo][71] + +[Simplenote][72] 是 WordPress 创建者 [Automattic][73] 推出的一款自由开源的笔记应用。它适用于 Windows、Linux、macOS、iOS 和 Android。你的笔记会同步到云服务器上,你可以在任何设备上访问它们。你可以从官网下载 DEB 文件。 + +##### Remember The Milk + +![Remember The Milk logo][74] + +[Remember The Milk][75] 是一款流行的待办事项应用。它适用于 Windows、Linux、macOS、iOS 和 Android。你可以在拥有的所有设备上访问你的待办事项。你也可以从浏览器访问它。它还有一个官方的 Linux 原生版本,你可以从官网下载。 + +#### 密码保护和加密 + +![Encryption software Ubuntu][76] + +如果有其他人经常使用你的电脑,也许你会考虑通过密码保护文件和文件夹来增加额外的安全。 + +##### EncryptPad + +[EncryptPad][77] 是一个开源文本编辑器,它允许你用密码锁定你的文件。你可以选择加密的类型。这个工具也有一个命令行版本。 + +##### Gnome Encfs Manager + +Gnome Encfs Manager 允许你 [在 Linux 中用密码锁定文件夹][78]。你可以将任何你想要的文件保存在一个加密文件夹中,然后用密码锁定它。 + +#### 游戏 + +![Gaming on Ubuntu][79] + +[Linux 上的游戏][80] 体验比几年前改进很多。你可以在 Linux 上畅玩大量游戏,而不用回到 Windows 了。 + +##### Steam + +[Steam][81] 是一个数字发行平台,允许你购买游戏(如果需要的话)。Steam 拥有超过 1500 款 [Linux 游戏][82]。你可以从软件中心下载 Steam 客户端。 + +##### PlayOnLinux + +[PlayOnLinux][83] 允许你在 Linux 上通过 WINE 兼容层运行 Windows 游戏。不要对它抱有太高的期望,因为并不是每个游戏都能在 PlayOnLinux 下完美运行。 + +#### 软件包管理工具 [中高级用户] + +![Package Management tools Ubuntu][84] + +Ubuntu 软件中心满足普通 Ubuntu 用户的软件需求,但你可以使用以下应用程序对其进行更多的深入操作。 + +##### Gdebi + +Gedbi 是一款小巧的软件包管理器,你可以用它来安装 DEB 文件。它比软件中心更快,而且还能处理依赖问题。 + +##### Synaptic + +十年前,Synaptic 是大多数 Linux 发行版的默认 GUI 软件包管理器。在一些 Linux 发行版中,它仍然是默认的软件包管理器。这个强大的软件包管理器在 [查找已安装的应用程序并删除它们][85] 方面特别有用。 + +#### 备份和恢复工具 + +![Backup and data recovery tools for Ubuntu][86] + +任何操作系统都应该有备份和恢复工具。让我们来看看 Ubuntu 上有哪些软件是你必须拥有的。 + +##### Timeshift + +Timeshift 是一个帮助你 [对系统进行快照][87] 的工具。这可以让你在系统配置混乱的情况下,在发生不幸的事时将系统恢复到以前的状态。不过要注意的是,它并不是你个人数据备份的最佳工具。对此,你可以使用U buntu 默认的 Deja Dup(也叫做“备份”)。 + +##### TestDisk [中级用户] + +这是本清单里另一个命令行工具。[TestDisk][88] 可以让你 [恢复 Linux 上的数据][89]。如果你不小心删除了文件,使用 TestDisk 还有机会找回来。 + +#### 系统调整和管理工具 + +![System Maintenance apps Ubuntu][90] + +##### GNOME/Unity Tweak Tool + +这些调整工具是每个 Ubuntu 用户必备的。它们允许你访问一些高级系统设置。最重要的是,你可以使用这些调整工具 [改变 Ubuntu 的主题][91]。 + +##### UFW Firewall + +[UFW][92] 意指“不复杂的防火墙”,这一点是贴切的。UFW 为家庭、工作和公共网络预先定义了防火墙设置。 + +##### Stacer + +如果你想释放 Ubuntu 的存储空间,可以试试 Stacer。这个图形化工具可以让你通过删除不必要的文件和完全卸载软件来 [优化你的 Ubuntu 系统][93]。可以从 [官网][94] 下载 Stacer。 + +#### 其他工具 + +![Utilities Ubuntu][95] + +最后,我会列一些其他我很喜欢但无法归类的 Ubuntu 应用。 + +##### Neofetch + +又多了一个命令行工具!Neofetch 可以显示你的系统信息,如 [Ubuntu 版本][96]、桌面环境、主题、图标、内存和其他信息,并附有 [发行版的 ASCII 徽标][97]。使用以下命令安装 Neofetch。 + +``` +sudo apt install neofetch +``` + +##### Etcher + +Ubuntu 已经带有一个即用 USB 创建工具,但 Etcher 能更好地完成这项任务。它同样支持 Windows 和 macOS。你可以 [点击这里][98] 下载 Etcher。 + +##### gscan2pdf + +我使用这个小工具的唯一目的是 [将图片转换为 PDF][99]。你也可以用它将多张图片合并成一个 PDF 文件。 + +##### 音频记录器 + +另一个小巧而又必不可少的 Ubuntu 应用,用于 [在 Ubuntu 上录制音频][100]。你可以用它来录制来自系统麦克风、音乐播放器或任何其他来源的声音。 + +### 你对 Ubuntu 关键应用的建议? + +我想在这里结束我的优秀 Ubuntu 应用清单。我知道你可能不需要或使用所有的应用,但我确信你会喜欢这里列出的大部分应用。 + +你是否找到几款以前从未知道的应用呢?如果要你推荐最爱的 Ubuntu 应用,你会选择哪个呢? + +最后,如果你觉得这篇文章有用,请把它分享到社交媒体或其他你常访问的社区或论坛。这样,你也帮助了我们的成长 :) + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/best-ubuntu-apps/ + +作者:[Abhishek Prakash][a] +选题:[lujun9972](https://github.com/lujun9972) +译者:[LikChung](https://github.com/LikChung) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:https://itsfoss.com/author/abhishek/ +[1]:https://linux.cn/article-12183-1.html +[2]:https://i1.wp.com/itsfoss.com/wp-content/uploads/2018/07/best-ubuntu-apps-featured.jpeg +[3]:https://i1.wp.com/itsfoss.com/wp-content/uploads/2018/07/google-chrome.jpeg +[4]:https://www.google.com/chrome/ +[5]:https://i1.wp.com/itsfoss.com/wp-content/uploads/2018/07/brave-browser-icon.jpeg +[6]:https://itsfoss.com/open-source-browsers-linux/ +[7]:https://brave.com/ +[8]:https://i1.wp.com/itsfoss.com/wp-content/uploads/2018/07/music-apps-ubuntu.jpeg +[9]:https://itsfoss.com/sayonara-music-player/ +[10]:https://www.audacityteam.org/ +[11]:https://itsfoss.com/musicbrainz-picard/ +[12]:https://i1.wp.com/itsfoss.com/wp-content/uploads/2018/07/streaming-music-apps-ubuntu.jpeg +[13]:https://www.spotify.com// +[14]:https://linux.cn/article-9415-1.html +[15]:https://tiliado.eu/nuvolaplayer/ +[16]:https://i1.wp.com/itsfoss.com/wp-content/uploads/2018/07/Video-Players-linux.jpg +[17]:https://www.videolan.org/index.html +[18]:https://linux.cn/article-11776-1.html +[19]:https://mpv.io/ +[20]:https://i1.wp.com/itsfoss.com/wp-content/uploads/2018/07/dropbox-icon.jpeg +[21]:https://www.dropbox.com/ +[22]:https://i1.wp.com/itsfoss.com/wp-content/uploads/2018/07/pcloud-icon.jpeg +[23]:https://itsfoss.com/recommends/pcloud/ +[24]:https://i1.wp.com/itsfoss.com/wp-content/uploads/2018/07/gimp-icon.jpeg +[25]:https://www.gimp.org/ +[26]:https://i1.wp.com/itsfoss.com/wp-content/uploads/2018/07/inkscape-icon.jpeg +[27]:https://inkscape.org/en/ +[28]:https://i1.wp.com/itsfoss.com/wp-content/uploads/2018/07/paint-apps-ubuntu.jpeg +[29]:https://krita.org/en/ +[30]:https://pinta-project.com/pintaproject/pinta/ +[31]:https://itsfoss.com/image-applications-ubuntu-linux/ +[32]:https://i1.wp.com/itsfoss.com/wp-content/uploads/2018/07/digikam-icon.jpeg +[33]:https://www.digikam.org/ +[34]:https://i1.wp.com/itsfoss.com/wp-content/uploads/2018/07/darktable-icon.jpeg +[35]:https://www.darktable.org/ +[36]:https://i1.wp.com/itsfoss.com/wp-content/uploads/2018/07/video-editing-apps-ubuntu.jpeg +[37]:https://linux.cn/article-10185-1.html +[38]:https://kdenlive.org/en/ +[39]:https://shotcut.org/ +[40]:https://itsfoss.com/format-factory-alternative-linux/ +[41]:https://i1.wp.com/itsfoss.com/wp-content/uploads/2018/07/xnconvert-logo.jpeg +[42]:https://www.xnview.com/en/xnconvert/ +[43]:https://i1.wp.com/itsfoss.com/wp-content/uploads/2018/07/handbrake-logo.jpeg +[44]:https://handbrake.fr/ +[45]:https://i1.wp.com/itsfoss.com/wp-content/uploads/2018/07/screen-recording-ubuntu-apps.jpeg +[46]:http://shutter-project.org/ +[47]:https://launchpad.net/kazam +[48]:https://itsfoss.com/best-linux-screen-recorders/ +[49]:https://www.youtube.com/c/itsfoss?sub_confirmation=1 +[50]:https://i1.wp.com/itsfoss.com/wp-content/uploads/2018/07/libre-office-logo.jpeg +[51]:https://www.libreoffice.org/download/download/ +[52]:https://linux.cn/article-9379-1.html +[53]:https://i1.wp.com/itsfoss.com/wp-content/uploads/2018/07/wps-office-logo.jpeg +[54]:http://wps-community.org/ +[55]:https://i1.wp.com/itsfoss.com/wp-content/uploads/2018/07/download-apps-ubuntu.jpeg +[56]:https://linux.cn/article-9244-1.html +[57]:http://ugetdm.com/ +[58]:https://itsfoss.com/4-best-download-managers-for-linux/ +[59]:https://i1.wp.com/itsfoss.com/wp-content/uploads/2018/07/coding-apps-ubuntu.jpeg +[60]:https://atom.io/ +[61]:https://linux.cn/article-7468-1.html +[62]:https://itsfoss.com/install-visual-studio-code-ubuntu/ +[63]:https://i1.wp.com/itsfoss.com/wp-content/uploads/2018/07/pdf-management-apps-ubuntu.jpeg +[64]:https://calibre-ebook.com/ +[65]:https://linux.cn/article-7977-1.html +[66]:https://itsfoss.com/pdf-editors-linux/ +[67]:https://i1.wp.com/itsfoss.com/wp-content/uploads/2018/07/messaging-apps-ubuntu.jpeg +[68]:https://itsfoss.com/best-messaging-apps-linux/ +[69]:https://www.skype.com/en/ +[70]:https://rambox.pro/ +[71]:https://i1.wp.com/itsfoss.com/wp-content/uploads/2018/07/simplenote-logo.jpeg +[72]:http://simplenote.com/ +[73]:https://automattic.com/ +[74]:https://i1.wp.com/itsfoss.com/wp-content/uploads/2018/07/remember-the-milk-logo.jpeg +[75]:https://itsfoss.com/remember-the-milk-linux/ +[76]:https://i1.wp.com/itsfoss.com/wp-content/uploads/2018/07/encryption-apps-ubuntu.jpeg +[77]:https://linux.cn/article-9377-1.html +[78]:https://itsfoss.com/password-protect-folder-linux/ +[79]:https://i1.wp.com/itsfoss.com/wp-content/uploads/2018/07/gaming-ubuntu.jpeg +[80]:https://linux.cn/article-7316-1.html +[81]:https://store.steampowered.com/ +[82]:https://itsfoss.com/free-linux-games/ +[83]:https://www.playonlinux.com/en/ +[84]:https://i1.wp.com/itsfoss.com/wp-content/uploads/2018/07/package-management-apps-ubuntu.jpeg +[85]:https://itsfoss.com/how-to-add-remove-programs-in-ubuntu/ +[86]:https://i1.wp.com/itsfoss.com/wp-content/uploads/2018/07/backup-recovery-tools-ubuntu.jpeg +[87]:https://linux.cn/article-11619-1.html +[88]:https://www.cgsecurity.org/wiki/TestDisk +[89]:https://linux.cn/article-7974-1.html +[90]:https://i1.wp.com/itsfoss.com/wp-content/uploads/2018/07/system-maintenance-apps-ubuntu.jpeg +[91]:https://itsfoss.com/install-themes-ubuntu/ +[92]:https://wiki.ubuntu.com/UncomplicatedFirewall +[93]:https://itsfoss.com/optimize-ubuntu-stacer/ +[94]:https://github.com/oguzhaninan/Stacer +[95]:https://i1.wp.com/itsfoss.com/wp-content/uploads/2018/07/utilities-apps-ubuntu.jpeg +[96]:https://itsfoss.com/how-to-know-ubuntu-unity-version/ +[97]:https://itsfoss.com/display-linux-logo-in-ascii/ +[98]:https://etcher.io/ +[99]:https://itsfoss.com/convert-multiple-images-pdf-ubuntu-1304/ +[100]:https://itsfoss.com/record-streaming-audio/ diff --git a/published/202007/20190213 How to build a WiFi picture frame with a Raspberry Pi.md b/published/202007/20190213 How to build a WiFi picture frame with a Raspberry Pi.md new file mode 100644 index 0000000000..6e66448709 --- /dev/null +++ b/published/202007/20190213 How to build a WiFi picture frame with a Raspberry Pi.md @@ -0,0 +1,131 @@ +[#]: collector: (lujun9972) +[#]: translator: (this-is-name-right) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12448-1.html) +[#]: subject: (How to build a WiFi picture frame with a Raspberry Pi) +[#]: via: (https://opensource.com/article/19/2/wifi-picture-frame-raspberry-pi) +[#]: author: (Manuel Dewald https://opensource.com/users/ntlx) + +如何用树莓派制作 WiFi 相框 +====== + +> DIY一个数码相框,图片流来自云端。 + +![](https://img.linux.net.cn/data/attachment/album/202007/24/212836agkae2776gude1cb.jpg) + +数码相框真的很好,因为它可以让你查看你自己的相片而不必打印出来。更棒的是,当你想要展示一张新的相片的时候,增加和删除数字图片要比打开传统的相框然后替换里面的相框更简单。不过,这还是需要一点手动的操作,比如从数字相框取出 SD 卡、U 盘或者其他的存储介质,然后把存储介质接入电脑,接着再复制图片进入存储介质。 + +一个更简单的选项是数字相框通过 WiFi 获得图片,例如从云端服务器获得。下面就是如何制作这样的一个数字相框。 + +### 需要使用的材料 + + * 老式 [TFT][1] 的 LCD 显示屏 + * HDMI 到 DVI 的转接线(因为 TFT 屏幕支持 DVI) + * 树莓派 3 + * Micro SD 卡 + * 树莓派的电源 + * 键盘 + * 鼠标(可选) + +使用线缆连接树莓派到显示器,并连接电源。 + +### 安装 Raspbian + +按照以下[指示][2]下载并将 Raspbian 烧录到 Micro SD 卡中。将 Micro SD 卡插入树莓派,启动它,并配置你的 WiFi。在安装完 Raspbian 后,我的第一个操作通常是运行 `sudo raspi-config`。在那里,我在网络选项中更改主机名(例如,改为 `picframe`),并在接口选项中启用 SSH 以远程连接到树莓派。使用(例如)`ssh pi@picframe` 连接到树莓派。 + +### 建立并安装云客户端 + +我使用 [Nextcloud][3] 来同步我的图片,但是你可以使用 NFS、[Dropbox][4],或者其他的适合你的需求的方式上传图片到相框。 + +如果你使用 Nextcloud,请按照[以下说明][5]在 Raspbian 上安装客户端。这可以很方便的放图片到你的相框,并且你可能很熟悉安装在台式机的这个客户端应用。当连接客户端到 Nextcloud 服务器上的时候,请确保只选择存储你要在相框上显示的图片的文件夹。 + +### 设置幻灯片放映 + +我发现设置幻灯片放映最简单的方式是使用一个专门为这个目的建立的[轻量级的幻灯片项目][6]。还有一些备用方案,像是配置屏保,这个应用似乎是最最简单设置幻灯片放映的方式了。 + +在你的树莓派上下载最新的二进制程序,解包并移动到一个可执行的文件夹里: + +``` +wget https://github.com/NautiluX/slide/releases/download/v0.9.0/slide_pi_stretch_0.9.0.tar.gz +tar xf slide_pi_stretch_0.9.0.tar.gz +mv slide_0.9.0/slide /usr/local/bin/ +``` + +安装依赖关系: + +``` +sudo apt install libexif12 qt5-default +``` + +通过执行下面的命令播放幻灯片(不要忘记修改图片的路径)。如果你通过 SSH 访问你树莓派,设置 `DISPLAY` 变量来在连接到树莓派显示屏上开始播放幻灯片。 + +``` +DISPLAY=:0.0 slide -p /home/pi/nextcloud/picframe +``` + +### 自动播放幻灯片 + +为了在 Raspbian Stretch 上自动播放幻灯片,建立如下的文件夹并且添加一个 `autostart` 文件到里面: + +``` +mkdir -p /home/pi/.config/lxsession/LXDE/ +vi /home/pi/.config/lxsession/LXDE/autostart +``` + +在文件中输入如下的命令来自动开启幻灯片。`slide` 命令可以调整到你需要的地方: + +``` +@xset s noblank +@xset s off +@xset -dpms +@slide -p -t 60 -o 200 -p /home/pi/nextcloud/picframe +``` + +禁止屏幕空白,树莓派通常会在 10 分钟后这样做,通过编辑下面的文件修改: + +``` +vi /etc/lightdm/lightdm.conf +``` + +添加这两行到文件末尾: + +``` +[SeatDefaults] +xserver-command=X -s 0 -dpms +``` + +### 配置上电时间 + +你可以安排你的相框什么时候打开和关闭通过使用两个简单的定时任务。例如,你想在上午 7 点自动打开,在晚上 11 点自动关闭。运行 `crontab -e` 并且输入下面的两行: + +``` +0 23 * * * /opt/vc/bin/tvservice -o +0 7 * * * /opt/vc/bin/tvservice -p && sudo systemctl restart display-manager +``` + +注意这不会打开或关闭树莓派的电源;这只会关闭 HDMI,它会关闭屏幕。第一行命令将在晚上 11 点关闭 HDMI。第二行将在早上 7 点打开显示屏并重启显示器管理器。 + +### 附言 + +通过这些简单的步骤,你创建了你自己 WiFi 相框。如果你想要让它更好看,为显示屏做一个木质相框吧。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/2/wifi-picture-frame-raspberry-pi + +作者:[Manuel Dewald][a] +选题:[lujun9972][b] +译者:[this-is-name-right](https://github.com/this-is-name-right) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/ntlx +[b]: https://github.com/lujun9972 +[1]: https://en.wikipedia.org/wiki/Thin-film-transistor_liquid-crystal_display +[2]: https://www.raspberrypi.org/documentation/installation/installing-images/README.md +[3]: https://nextcloud.com/ +[4]: http://dropbox.com/ +[5]: https://github.com/nextcloud/client_theming#building-on-debian +[6]: https://github.com/NautiluX/slide/releases/tag/v0.9.0 diff --git a/published/202007/20190624 Book Review- A Byte of Vim.md b/published/202007/20190624 Book Review- A Byte of Vim.md new file mode 100644 index 0000000000..d0cbb158b6 --- /dev/null +++ b/published/202007/20190624 Book Review- A Byte of Vim.md @@ -0,0 +1,86 @@ +[#]: collector: (lujun9972) +[#]: translator: (JonnieWayy) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12441-1.html) +[#]: subject: (Book Review: A Byte of Vim) +[#]: via: (https://itsfoss.com/book-review-a-byte-of-vim/) +[#]: author: (John Paul https://itsfoss.com/author/john/) + +《A Byte of Vim》书评 +====== + +[Vim][1] 是一个简单而又强大的文本编辑工具。大多数新用户都会被它吓倒,因为它不像常规的图形化文本编辑器那样“工作”。Vim “不寻常”的键盘快捷键让人不知道[如何保存并退出 Vim][2]。但一旦你掌握了 Vim,就没有什么能比得上它了。 + +网上有大量的 [Vim 资源][3]。我们也在介绍了一些 Vim 技巧。除了线上资源,也有很多书致力于介绍这个编辑器。今天,我们要介绍的是一本旨在使大多数用户轻松理解 Vim 的书。我们将讨论的书是 [Swaroop C H][5] 撰写的《[A Byte of Vim][4]》。 + +本书作者 [Swaroop C H][5] 已经在计算机领域工作了十余年,他曾在 Yahoo 和 Adobe 工作过。大学毕业后,他卖过 Linux CD,也曾多次创业,也是一个创建了一个名为 ion 的 iPod 充电器的团队的联合创始人。他目前是 [Helpshift][7] AI 团队的工程经理。 + +### 《A Byte of Vim》 + +![][8] + +像所有好书一样,《A Byte of Vim》一开始就谈到了什么是 Vim:“一个用于写各类文本的计算机程序。”他接着说:“Vim 之所以与众不同,是因为它是为数不多的既简单又强大的软件之一。” + +在深入讲解如何使用 Vim 之前,Swaroop 先告诉读者如何在 Windows、Mac、Linux 和 BSD 上安装 Vim。安装完成后,他进而指导读者完成如何启动 Vim,以及如何创建第一个文件。 + +接着,Swaroop 讨论了 Vim 的不同模式,以及如何通过 Vim 的键盘快捷键来浏览文档。接着是使用 Vim 编辑文档的基础知识,包括如何在 Vim 中剪切/复制/粘帖以及撤销/重做。 + +在介绍了编辑基础知识后,Swaroop 介绍了如何使用 Vim 来编辑单个文档的多个部分。你也可以使用多个标签和窗口来同时编辑多个文档。 + +本书还涵盖了通过编写脚本和安装插件来扩展 Vim 的功能。在 Vim 中使用脚本有两种方法,一种是使用 Vim 的内置脚本语言,另一种是使用 Python 或 Perl 等编程语言来访问 Vim 的内核。可以编写或下载五种类型的 Vim 插件:vimrc、全局插件、文件类型插件、语法高亮插件和编译器插件。 + +在一个单独的章节中,Swaroop C H 介绍了使 Vim 更适合编程的特点。这些功能包括语法高亮、智能缩进、对 Shell 命令的支持、全局补全以及可用作 IDE 使用的功能。 + +#### 获取《A Byte of Vim》一书并为之贡献 + +《A Byte of Vim》按照 [共创协议 4.0][10]授权。读者可以在[作者的主页][4]上免费阅读其在线版本。你也可以免费下载其 [PDF][11]、[Epub][12] 或者 [Mobi][13] 版本。 + +- [免费获取《A Byte of Vim》][4] + +如果你更喜欢阅读[纸质版本][14],你也可以选择该方式。 + +请注意,**《A Byte of Vim》的初始版本写于 2008**,并转换为 PDf。不幸的是,Swaroop CH丢失了原始源文件。他正在努力将该书转换为 [Markdown][15]。如果你想提供帮助,请访问[该书的 GitHub 页面][16]。 + +#### 结语 + +当我初次对着 Vim 生气时,我不知道该怎么办。我希望那时候我就知道《A Byte of Vim》这本书。对于任何学习 Linux 的人来说,这本书都是不错的资源,特别是当你开始学习命令行的时候。 + +你读过 Swaroop C H 的《[A Byte of Vim][4]》吗?如果读过,你是如何找到它的?如果不是,那么你最喜欢关于开源主题的是哪本书?请在下方评论区告诉我们。 + + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/book-review-a-byte-of-vim/ + +作者:[John Paul][a] +选题:[lujun9972][b] +译者:[JonnieWayy](https://github.com/JonnieWayy) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://itsfoss.com/author/john/ +[b]: https://github.com/lujun9972 +[1]: https://www.vim.org/ +[2]: https://itsfoss.com/how-to-exit-vim/ +[3]: https://linuxhandbook.com/basic-vim-commands/ +[4]: https://vim.swaroopch.com/ +[5]: https://swaroopch.com/ +[6]: https://swaroopch.com/about/ +[7]: https://www.helpshift.com/ +[8]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2019/06/Byte-of-vim-book.png?resize=800%2C450&ssl=1 +[9]: https://itsfoss.com/4mlinux-review/ +[10]: https://creativecommons.org/licenses/by/4.0/ +[11]: https://www.gitbook.com/download/pdf/book/swaroopch/byte-of-vim +[12]: https://www.gitbook.com/download/epub/book/swaroopch/byte-of-vim +[13]: https://www.gitbook.com/download/mobi/book/swaroopch/byte-of-vim +[14]: https://swaroopch.com/buybook/ +[15]: https://itsfoss.com/best-markdown-editors-linux/ +[16]: https://github.com/swaroopch/byte-of-vim#status-incomplete +[17]: https://i2.wp.com/images-na.ssl-images-amazon.com/images/I/41itW8furUL._SL160_.jpg?ssl=1 +[18]: https://www.amazon.com/Mastering-Vim-Quickly-WTF-time/dp/1983325740?SubscriptionId=AKIAJ3N3QBK3ZHDGU54Q&tag=chmod7mediate-20&linkCode=xm2&camp=2025&creative=165953&creativeASIN=1983325740 (Mastering Vim Quickly: From WTF to OMG in no time) +[19]: https://www.amazon.com/gp/prime/?tag=chmod7mediate-20 (Amazon Prime) +[20]: https://www.amazon.com/Mastering-Vim-Quickly-WTF-time/dp/1983325740?SubscriptionId=AKIAJ3N3QBK3ZHDGU54Q&tag=chmod7mediate-20&linkCode=xm2&camp=2025&creative=165953&creativeASIN=1983325740 (Buy on Amazon) +[21]: https://itsfoss.com/iridium-browser-review/ +[22]: http://reddit.com/r/linuxusersgroup diff --git a/published/202007/20190702 One CI-CD pipeline per product to rule them all.md b/published/202007/20190702 One CI-CD pipeline per product to rule them all.md new file mode 100644 index 0000000000..b093c265ef --- /dev/null +++ b/published/202007/20190702 One CI-CD pipeline per product to rule them all.md @@ -0,0 +1,133 @@ +[#]: collector: (lujun9972) +[#]: translator: (chunibyo-wly) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12392-1.html) +[#]: subject: (One CI/CD pipeline per product to rule them all) +[#]: via: (https://opensource.com/article/19/7/cicd-pipeline-rule-them-all) +[#]: author: (Willy-Peter Schaub https://opensource.com/users/wpschaub/users/bclaster/users/matt-micene/users/barkerd427) + +使用一条 CI/CD 流水线管理所有的产品 +====== + +> 统一的持续集成与持续交付的流水线的构想是一种梦想吗? + +![](https://img.linux.net.cn/data/attachment/album/202007/07/224752iib7xgh7icr8478f.jpg) + +当我加入 WorkSafeBC 负责云端运维和工程流程优化的云端运维团队时,我和大家分享了我的梦想,那就是一个工具化的流水线,每一个产品都可以持续集成和持续交付。 + +根据 Lukas Klose 的说法,[流程][2]flow(在软件工程的语境内)是“软件系统以稳定和可预测的速度创造价值的状态”。我认为这是最大的挑战和机遇之一,特别是在复杂的新兴解决方案领域。我力求通过一种持续、高效和优质的解决方案,提供一种持续交付模式,并且能够构建正确的事物让我们的用户感到满意。想办法把我们的系统分解成更小的碎片,这些碎片本身是有价值的,使团队能够渐进式地交付价值。这需要业务和工程部门改变思维方式。 + +### 持续集成和持续交付的(CI/CD)流水线 + +CI/CD 流水线是一种 DevOps 实践,用于更频繁、一致、可靠的地交付代码变更。它可以帮助敏捷开发团队提高**部署频率**,减少**变更准备时间**、**变更失败率**和关键绩效指标(KPI)的**平均恢复时间**,从而提高质量并且实现更快的交付。唯一的先决条件就是坚实的开发流程、对质量的心态和对需求从构想到废弃的责任心,以及一个全面的流水线(如下图所示)。 + +![Prerequisites for a solid development process][3] + +它简化了工程流程和产品,以稳定基础架构环境;优化工作流程;并创建一致的、可重复的、自动化的任务。正如 Dave Snowden 的 [Cynefin Sensemaking][4] 模型所说的那样,这样就允许我们将复杂不可解决的任务变成了复杂可解决的任务,降低了维护成本,提高了质量和可靠性。 + +精简流程的一部分是将 [浪费实践类型][5]wasteful practice types Muri(过载)、Mura(变异)和 Muda(浪费)的浪费降低最低。 + + * **Muri(过载)**:避免过度工程化,避免与商业价值不相关的功能以及过多的文档。 + * **Mura(变异)**:改善审批和验证流程(比如,安全签批);推动 [左移提前][6]shift-left 策略以推行单元测试、安全漏洞扫描与代码质量检查;并改进风险评定。 + * **Muda(浪费)**:避免技术债、错误或前期的详细文档等浪费。 + +看起来 80% 的重点都集中在提供一种可以集成和协作的工程产品上,这些系统可以采用一个创意和计划、开发、测试和监控你的解决方案。然而,一个成功的转型和工程系统是由 5% 的产品、15% 的过程和 80% 的开发人员组成的。 + +我们可以使用的产品有很多。比如,Azure DevOps 为持续集成(CI)、持续交付(CD)和可扩展性提供了丰富支持,并与 Stryker、SonarQube、WhiteSource、Jenkins 和 Octopus 等开源集成和商用成品(COTS)软件即服务(SaaS)进行集成。对于工程师来说,关注产品总是一种诱惑,但请记住,它们只是我们旅程的 5%。 + +![5% about products, 15% about process, 80% about people][7] + +最大的挑战是打破数十年的规则、规定和已经步入舒适区的流程:“*我们一直都是这样做的;为什么需要改变呢?*” + +开发和运维人员之间的摩擦导致了各种支离破碎的、重复的、不间断的集成和交付流水线。开发人员希望能访问所有东西,以便持续迭代,让用户使用起来和持续地快速发布。运维人员希望将所有东西锁起来,保护业务、用户和品质。这些矛盾在不经意间导致了很难做到一种自动化的流程,进而导致发布周期晚于预期。 + +让我们使用最近的一次白板讨论中的片段来探索流水线。 + +想要支持流水线的变化是一项困难并且花费巨大的工作;版本和可追溯性的不一致使得这个问题变得更加复杂,因此不断精简开发流程和流水线是一项挑战。 + +![Improving quality and visibility of pipelines][8] + +我主张一些原则使得每个产品都能使用通用流水线: + + * 使一切可自动化的东西都自动化 + * 一次构建 + * 保持持续集成和持续交付 + * 保持持续精简和改进 + * 保持一个构建的定义 + * 保持一个发布流水线的定义 + * 尽早、频繁地扫描漏洞,并且*尽快失败* + * 尽早、频繁地进行测试,并且*尽快失败* + * 保持已发布版本的可追踪和监控 + +但是,如果我要打破这些,最重要的原则就是*保持简单*。如果你不能说明流水线化的原因(是什么、为什么)和过程(如何),你或许是不了解自己的软件过程的。我们大多数人想要的不是最好的、超现代的和具有革命意义的流水线 —— 我们仅仅是需要一个功能强大的、有价值的和能促进工程的流水线。首先需要解决的是那 80% —— 文化、人员和他们的心态。请你的 CI/CD 骑士们穿上闪亮的盔甲,在他们的盾牌上贴上 TLA(两个/三个字母的缩写two/three-lettered acronym)符号,加入到实践和经验工程的力量中来。 + +### 统一流水线 + +让我们逐步完成我们的白板会议实践。 + +![CI build/CD release pipeline][9] + +每个应用使用一套构建定义来定义一个 CI/CD 流水线,用来触发*拉取请求的预合并验证*与*持续集成*的构建。生成一个带有调试信息的*发布*的构建,并且将其上传到 [符号服务器][10]。这使开发人员可以在本地和远程生产环境进行调试,而在不用考虑需要加载哪个构建和符号,符号服务器为我们施展了这样的魔法。 + +![Breaking down the CI build pipeline][11] + +在构建过程中进行尽可能多的验证(*左移提前*),这允许开发新特性的团队可以尽快失败,不断的提高整体的产品质量,并在拉取请求中为代码审核人员提供宝贵证据。你喜欢有大量提交的拉取请求吗?还是一个带有少数提交和提供了漏洞检查、测试覆盖率、代码质量检查和 [Stryker][12] 突变残余等支持的拉取请求?就我个人而言,我投后者的票。 + +![Breaking down the CD release pipeline][13] + +不要使用构建转换来生成多个特定环境的构建。通过一个构建实现*发布时转换*、*标记化*和 XML/JSON 的*值替换*。换句话说,*右移滞后*具体环境的配置。 + +![Shift-right the environment-specific configuration][14] + +安全存储发布配置数据,并且根据数据的*信任度*和*敏感度*,让开发和运维都能使用。使用开源的密钥管理工具、Azure 密钥保险库、AWS 密钥管理服务或者其他产品,记住你的工具箱中有很多方便的工具。 + +![Dev-QA-production pipeline][15] + +使用*用户组*而不是*用户*,将审批人管理从跨多个流水线的多个阶段移动到简单的组成员。 + +![Move approver management to simple group membership][16] + +创建一条流水线并且对赋予特定的交付阶段的权限,而不是重复流水线让团队进入他们感兴趣的地方。 + +![Pipeline with access to specific delivery stages][17] + +最后,但并非最不重要的是,拥抱拉取请求,以帮助提高对代码仓库的洞察力和透明度,增进整体质量、协作,并将预验证构建发布到选定的环境,比如,开发环境。 + +这是整个白板更正式的视图。 + +![The full pipeline][18] + +所以,你对 CI/CD 流水线有什么想法和经验?我的通过*一条流水线来管理它们*的这个梦想是空想吗? + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/7/cicd-pipeline-rule-them-all + +作者:[Willy-Peter Schaub][a] +选题:[lujun9972][b] +译者:[chunibyo-wly](https://github.com/chunibyo-wly) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/wpschaub/users/bclaster/users/matt-micene/users/barkerd427 +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/LAW-Internet_construction_9401467_520x292_0512_dc.png?itok=RPkPPtDe (An intersection of pipes.) +[2]: https://continuingstudies.sauder.ubc.ca/courses/agile-delivery-methods/ii861 +[3]: https://opensource.com/sites/default/files/uploads/devops_pipeline_pipe-2.png (Prerequisites for a solid development process) +[4]: https://en.wikipedia.org/wiki/Cynefin_framework +[5]: https://www.lean.org/lexicon/muda-mura-muri +[6]: https://en.wikipedia.org/wiki/Shift_left_testing +[7]: https://opensource.com/sites/default/files/uploads/devops_pipeline_pipe-3.png (5% about products, 15% about process, 80% about people) +[8]: https://opensource.com/sites/default/files/uploads/devops_pipeline_pipe-4_0.png (Improving quality and visibility of pipelines) +[9]: https://opensource.com/sites/default/files/uploads/devops_pipeline_pipe-5_0.png (CI build/CD release pipeline) +[10]: https://en.wikipedia.org/wiki/Microsoft_Symbol_Server +[11]: https://opensource.com/sites/default/files/uploads/devops_pipeline_pipe-6.png (Breaking down the CI build pipeline) +[12]: https://stryker-mutator.io/ +[13]: https://opensource.com/sites/default/files/uploads/devops_pipeline_pipe-7.png (Breaking down the CD release pipeline) +[14]: https://opensource.com/sites/default/files/uploads/devops_pipeline_pipe-8.png (Shift-right the environment-specific configuration) +[15]: https://opensource.com/sites/default/files/uploads/devops_pipeline_pipe-9.png (Dev-QA-production pipeline) +[16]: https://opensource.com/sites/default/files/uploads/devops_pipeline_pipe-10.png (Move approver management to simple group membership) +[17]: https://opensource.com/sites/default/files/uploads/devops_pipeline_pipe-11.png (Pipeline with access to specific delivery stages) +[18]: https://opensource.com/sites/default/files/uploads/devops_pipeline_pipe-12.png (The full pipeline) diff --git a/published/202007/20190808 Sending custom emails with Python.md b/published/202007/20190808 Sending custom emails with Python.md new file mode 100644 index 0000000000..d27fc38226 --- /dev/null +++ b/published/202007/20190808 Sending custom emails with Python.md @@ -0,0 +1,268 @@ +[#]: collector: (lujun9972) +[#]: translator: (silentdawn-zz) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12452-1.html) +[#]: subject: (Sending custom emails with Python) +[#]: via: (https://opensource.com/article/19/8/sending-custom-emails-python) +[#]: author: (Brian "bex" Exelbierd https://opensource.com/users/bexelbie) + +使用 Mailmerge 发送定制邮件 +====== + +> Mailmerge 是一个可以定制群发邮件的命令行程序,它可以处理简单和复杂的邮件。 + +![](https://img.linux.net.cn/data/attachment/album/202007/25/233710lqkvko0jdbh1jzul.jpg) + +电子邮件还是生活的一部分,尽管有种种不足,它仍然是大多数人发送信息的最佳方式,尤其是在按队列将邮件发送给收件人的自动化方式中。 + +作为 [Fedora 社区行动和影响协调员][2],我的工作之一就是给人们发送资助旅行相关的好消息,我经常通过电子邮件做这些事。这里,我将给你展示如何使用 [Mailmerge][3] 向一群人发送定制邮件的,Mailmerge 是一个可以处理简单和复杂的邮件的命令行程序。 + +### 安装 Mailmerge + +在 Fedora 中,Mailmerge 已经打包可用,你可以通过在命令行中运行 `sudo dnf install python3-mailmerge` 来安装它。你还可以使用 `pip` 命令从 PyPi 中安装,具体可以参阅该项目的 [README][4]。 + +### 配置 Mailmerge + +三个配置文件控制着 Mailmerge 的工作模式。运行 `mailmerge --sample`,将生成配置文件模板。这些文件包括: + + * `mailmerge_server.conf:` 这里保存着 SMTP 服务端邮件发送相关详细配置,但你的密码 *不* 在这里保存。 + * `mailmerge_database.csv:` 这里保存每封邮件的定制数据,包括收件人的电子邮件地址。 + * `mailmerge_template.txt:` 这里保存电子邮件的文本,文本中包含占位符,这些占位符会使用 `mailmerge_database.csv` 中的数据替换。 + +#### Server.conf + +配置模板文件 `mailmerge_server.conf` 包含几个大家应该很熟悉的例子。如果你曾经往手机上添加过电子邮件或者设置过桌面电子邮件客户端,那你就应该看到过这些数据。需要提醒的是要记得把你的用户名更新到这个文件中,尤其是在你使用模板所提供的配置时。 + +#### Database.csv + +`mailmerge_database.csv` 这个配置文件稍微有点复杂。最起码要将邮件接收者的电子邮件地址保存在这里,其它在电子邮件中任何需要替换的定制信息也要保存在这里。推荐在创建本文件的占位符列表时,同步编辑 `mailmerge_template.txt` 文件。我发现一个有效的做法是,使用电子表格软件录入这些数据,完成后导出为 CSV 文件。使用下面的示例文件: + +``` +email,name,number +myself@mydomain.com,"Myself",17 +bob@bobdomain.com,"Bob",42 +``` + +可以你向这两个人发送电子邮件,使用他们的名字并告诉他们一个数字。这个示例文件虽然不是特别有趣,但应用了一个重要的原则,那就是:始终让自己处于邮件接收列表的首位。这样你可以在向列表全员发送邮件之前,先给自己发送一个测试邮件,以验证邮件的效果是否如你预期。 + +任何包含半角逗号的值,都 **必须** 以半角双引号(`"`)封闭。如果恰好在半角双引号封闭的区域需要有一个半角双引号,那就在同一行中连续使用两个半角双引号。引号的规则比较有趣,去 [Python 3 中关于 CSV 的内容中][7] 一探究竟吧。 + +#### Template.txt + +我的工作之一,就是为我们 Fedora 贡献者会议 [Flock][8] 发送与旅行基金有关的信息。通过简单的邮件告诉有关的人,他被选中为旅行基金支持的幸运者,以及相应基金支持的详细信息。与接收者相关的具体信息之一就是我们可以为他的旅行提供多少资助。下面是一份我的节略后的模板文件(为了简洁,已经移除大量的文本): + +``` +$ cat mailmerge_template.txt +TO: {{Email}} +SUBJECT: Flock 2019 Funding Offer +FROM: Brian Exelbierd + + +Hi {{Name}}, + + +I am writing you on behalf of the Flock funding committee. You requested funding for your attendance at Flock. After careful consideration we are able to offer you the following funding: + + +Travel Budget: {{Travel_Budget}} + + +<> +``` + +模板的起头定义了邮件的接收者、发送者和主题。在空行之后,是邮件的内容。该邮件需要从 `database.csv` 文件中获取接收者的 `Email` 、`Name` 和 `Travel_Budget` 。注意,上述这些占位符是由双大括弧( `{{`、`}}` )封闭的。相应的 `mailmerge_database.csv` 如下: + +``` +$ cat mailmerge_database.csv +Name,Email,Travel_Budget +Brian,bexelbie@redhat.com,1000 +PersonA,persona@fedoraproject.org,1500 +PèrsonB,personb@fedoraproject.org,500 +``` + +注意,我把自己的信息放在了首条,这是为了测试方便。除了我,还有另外两个人的信息在文档中。列表中的第二个人 PèrsonB,他的名字中有一个包含变音符号的字母,Mailmerge 会对这类字母自动编码。 + +以上包含了模板的全部知识点:写上你自己的电子邮件信息,并编写好以双大括弧封闭的占位符。接下来创建用来提供前述占位符具体值的数据文件。现在测试一下电子邮件的效果。 + +### 测试并发送简单邮件 + +#### 试运行 + +测试从邮件的试运行开始,试运行就是讲邮件内容显示出来,所有的占位符都会被具体值取代。默认情况下,如果你运行不带参数的命令 `mailmerge`,它将对收件列表中的第一个人进行试运行: + +``` +$ mailmerge +>>> encoding ascii +>>> message 0 +TO: bexelbie@redhat.com +SUBJECT: Flock 2019 Funding Offer +FROM: Brian Exelbierd +MIME-Version: 1.0 +Content-Type: text/plain; charset="us-ascii" +Content-Transfer-Encoding: 7bit +Date: Sat, 20 Jul 2019 18:17:15 -0000 + + +Hi Brian, + + +I am writing you on behalf of the Flock funding committee. You requested funding for your attendance at Flock. After careful consideration we are able to offer you the following funding: + + +Travel Budget: 1000 + + +<> + + +>>> sent message 0 DRY RUN +>>> No attachments were sent with the emails. +>>> Limit was 1 messages. To remove the limit, use the --no-limit option. +>>> This was a dry run. To send messages, use the --no-dry-run option. +``` + +从试运行生成的邮件中(列表中的 `message 0` ,和计算机中很多计数场景一样,计数从 0 开始),可以看到我的名字及旅行预算是正确的。如果你想检视所有的邮件,运行 `mailmerge --no-limit`,告诉 Mailmerge 不要仅仅处理第一个收件人的信息。下面是第三个收件人邮件的试运行结果,用来测试特殊字符的编码: + +``` +>>> message 2 +TO: personb@fedoraproject.org +SUBJECT: Flock 2019 Funding Offer +FROM: Brian Exelbierd +MIME-Version: 1.0 +Content-Type: text/plain; charset="iso-8859-1" +Content-Transfer-Encoding: quoted-printable +Date: Sat, 20 Jul 2019 18:22:48 -0000 + + +Hi P=E8rsonB, +``` + +没有问题,`P=E8rsonB` 是 `PèrsonB` 的编码形式。 + +#### 发送测试信息 + +现在,运行 `mailmerge --no-dry-run`,Mailmerge 将向收件人列表中的第一个人发送电子邮件: + +``` +$ mailmerge --no-dry-run +>>> encoding ascii +>>> message 0 +TO: bexelbie@redhat.com +SUBJECT: Flock 2019 Funding Offer +FROM: Brian Exelbierd +MIME-Version: 1.0 +Content-Type: text/plain; charset="us-ascii" +Content-Transfer-Encoding: 7bit +Date: Sat, 20 Jul 2019 18:25:45 -0000 + + +Hi Brian, + + +I am writing you on behalf of the Flock funding committee. You requested funding for your attendance at Flock. After careful consideration we are able to offer you the following funding: + + +Travel Budget: 1000 + + +<> + + +>>> Read SMTP server configuration from mailmerge_server.conf +>>> host = smtp.gmail.com +>>> port = 587 +>>> username = bexelbie@redhat.com +>>> security = STARTTLS +>>> password for bexelbie@redhat.com on smtp.gmail.com: +>>> sent message 0 +>>> No attachments were sent with the emails. +>>> Limit was 1 messages. To remove the limit, use the --no-limit option. +``` + +在倒数第 4 行,它将要求你输入你的密码。如果你使用的是双因素认证或者域控制登录,那就需要创建应用密码来绕过这些控制。如果你使用的是 Gmail 或者类似的系统,可以直接在界面上完成密码验证。如果不行的话,联系你的邮件系统管理员。上述这些操作不会影响邮件系统的安全性,但是仍然有必要采用复杂的安全性好的密码。 + +我在我的邮件收件箱中,看到了这封格式美观的测试邮件。如果测试邮件看起来没有问题,那就可以运行 `mailmerge --no-dry-run --no-limit` 发送所有的邮件了。 + +### 发送复杂邮件 + +只有充分了解了 [Jinja2 模板][12] ,你才可能充分领略 Mailmerge 真正的威力。在邮件模板中使用条件语句及附带附件,是很有用的。下面就是一个复杂邮件的模板及对应的数据文件: + +``` +$ cat mailmerge_template.txt +TO: {{Email}} +SUBJECT: Flock 2019 Funding Offer +FROM: Brian Exelbierd +ATTACHMENT: attachments/{{File}} + + +Hi {{Name}}, + + +I am writing you on behalf of the Flock funding committee. You requested funding for your attendance at Flock. After careful consideration we are able to offer you the following funding: + + +Travel Budget: {{Travel_Budget}} +{% if Hotel == "Yes" -%} +Lodging: Lodging in the hotel Wednesday-Sunday (4 nights) +{%- endif %} + + +<> + + +$ cat mailmerge_database.csv +Name,Email,Travel_Budget,Hotel,File +Brian,bexelbie@redhat.com,1000,Yes,visa_bex.pdf +PersonA,persona@fedoraproject.org,1500,No,visa_person_a.pdf +PèrsonB,personb@fedoraproject.org,500,Yes,visa_person_b.pdf +``` + +在这个邮件中有两项新内容。首先是附件,我需要向参加国际旅行的人发送签证邀请信,帮助他们来 Flock,文件头的 `ATTACHMENT` 部分说明了要包含什么文件;为了保持我的文档目录清晰,我将所有需要作为附件的文档保存于附件子目录下。其次是包含了关于宾馆的条件信息,因为有些人的旅行资金包含了住宿费用,我需要对涉及住宿的人员诉及相关信息,而这是通过 `if` 判断实现的: + +``` +{% if Hotel == "Yes" -%} +Lodging: Lodging in the hotel Wednesday-Sunday (4 nights) +{%- endif %} +``` + +这和大多数编程语言中的 `if` 判断是一样的。Jinja2 实力非凡,可以实现多级判断。通过包含数据元素控制邮件内容,能大大简化相关的日常工作。空格的正确使用对邮件的易读性很重要。`if` 和 `endif` 语句中的短线( `-` )是 Jinja2 控制 [空白字符][13] 的一部分。这里面选项很多,所以还是要通过试验找到最适合自己的方式。 + +在上面的例子中,我在数据文件扩充了 `Hotel` 和 `File` 两个字段,这些字段的值控制着宾馆信息和附件文件名。另外,在上例中,我和 PèrsonB 有住宿资助,但 PersonA 没有。 + +对于简单邮件和复杂邮件而言,试运行及正式发送邮件的操作都是相同的。快去试试吧! + +你还可以尝试在邮件头中使用条件判断( `if` … `endif` ),比如你可以使发送给在数据库中的某人的邮件包含附件,或者改变对部分人改变发送人的信息。 + +### Mailmerge 的优点 + +Mailmerge 是用来批量发送定制邮件的简洁而高效的工具。每个人只接受到他需要的信息,其它额外的操作和细节都是透明的。 + +我还发现,即使是在发送简单的集团邮件时,相对于使用 CC 或者 BCC 向一组受众发送一封邮件,采用 Mailmerge 也是非常高效的。很多人使用了邮件过滤,那些不是直接发给他们的邮件,他们一律不会立刻处理。使用 Mailmerge 保证了每名接收者收到的就是自己的邮件。所有的信息会对接收者进行正确过滤,再也不会有人无意间回复到整个邮件组。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/8/sending-custom-emails-python + +作者:[Brian "bex" Exelbierd][a] +选题:[lujun9972][b] +译者:[silentdawn-zz](https://github.com/silentdawn-zz) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/bexelbie +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/email_chat_communication_message.png?itok=LKjiLnQu (Chat via email) +[2]: https://docs.fedoraproject.org/en-US/council/fcaic/ +[3]: https://github.com/awdeorio/mailmerge +[4]: https://github.com/awdeorio/mailmerge#install +[5]: mailto:myself@mydomain.com +[6]: mailto:bob@bobdomain.com +[7]: https://docs.python.org/3/library/csv.html +[8]: https://flocktofedora.org/ +[9]: mailto:bexelbie@redhat.com +[10]: mailto:persona@fedoraproject.org +[11]: mailto:personb@fedoraproject.org +[12]: http://jinja.pocoo.org/docs/latest/templates/ +[13]: http://jinja.pocoo.org/docs/2.10/templates/#whitespace-control diff --git a/published/202007/20191031 4 Python tools for getting started with astronomy.md b/published/202007/20191031 4 Python tools for getting started with astronomy.md new file mode 100644 index 0000000000..e197bd3721 --- /dev/null +++ b/published/202007/20191031 4 Python tools for getting started with astronomy.md @@ -0,0 +1,70 @@ +[#]: collector: (lujun9972) +[#]: translator: (silentdawn-zz) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12459-1.html) +[#]: subject: (4 Python tools for getting started with astronomy) +[#]: via: (https://opensource.com/article/19/10/python-astronomy-open-data) +[#]: author: (Gina Helfrich, Ph.D. https://opensource.com/users/ginahelfrich) + +开启天文之路的 4 个 Python 工具 +====== + +> 使用 NumPy、SciPy、Scikit-Image 和 Astropy 探索宇宙 + +![](https://img.linux.net.cn/data/attachment/album/202007/27/223146sjfgbj9jfu9m1z2c.jpg) + +### 天文学与 Python + +对科学界而言,尤其是对天文学界来说,Python 是一种伟大的语言工具。各种软件包,如 [NumPy][5]、[SciPy][6]、[Scikit-Image][7] 和 [Astropy][8],(仅举几例) ,都充分证明了 Python 对天文学的适用性,而且有很多用例。(NumPy、Astropy 和 SciPy 是 NumFOCUS 提供资金支持的项目;Scikit-Image 是个隶属项目)。我在十几年前脱离天文研究领域,成为了软件开发者之后,对这些工具包的演进一直很感兴趣。我的很多前天文界同事在他们的研究中,使用着前面提到的大部分甚至是全部工具包。以我为例,我也曾为位于智利的超大口径望远镜(VLT)上的仪器编写过专业天文软件工具包。 + +最近令我吃惊的是,Python 工具包竟然演进到如此好用,任何人都可以轻松编写 [数据还原][9]data reduction 脚本,产生出高质量的数据产品。天文数据易于获取,而且大部分是可以公开使用的,你要做的只是去寻找相关数据。 + +比如,负责 VLT 运行的 ESO,直接在他们的网站上提供数据下载服务,只要访问 [www.eso.org/UserPortal][10] 并在首页创建用户就可以享有数据下载服务。如果你需要 SPHERE 数据,可以下载附近任何一个包含系外行星exoplanet或者原恒星盘proto-stellar discs的恒星的全部数据集。对任何 Python 高手而言,通过还原数据发现深藏于噪声中的行星或者原恒星盘,实在是件令人兴奋的事。 + +我鼓励你下载 ESO 或其它天文影像数据,开启你的探索历程。这里提供几条建议: + +1. 首先要有一个高质量的数据集。看一些有关包含系外行星或者原恒星盘的较近恒星的论文,然后在 之类的网站检索数据。需要注意的是,前述网站上的数据有的标注为红色,有的标注为绿色,标注为红色的数据是尚未公开的,在相应的“发布日期”处会注明数据将来公开的时间。 +2. 了解一些用于获取你所用数据的仪器的信息。尽量对数据的获取有一个基本的理解,对标准的数据还原之后应该是什么样子做到心中有数。所有的望远镜和仪器都有这方面的文档供公开获取。 +3. 必须考虑天文数据的标准问题,并予以校正: + + 1. 数据以 FITS 格式文件保存。需要使用 `pyfits` 或者 `astropy` (包含 `pyfits` )将其读入到 `NumPy` 数组。有些情况下,数据是三维的,需要沿 z 轴使用 `numpy.median` 将数据转换为二维数组。有些 SPHERE 数据在同一幅影像中包含了同一片天空的两份拷贝(各自使用了不同的滤波器),这时候需要使用 **索引** 和 **切片** 将它们分离出来。 + 2. 全黑图master dark坏点图bad pixel map。所有仪器都有快门全关(完全无光)状态拍摄的特殊图片,使用 **NumPy 掩膜数组** 从中分离出坏点图。坏点图非常重要,你在合成最终的清晰图像过程中,需要持续跟踪坏点。有些情况下,这还有助于你从原始科学数据中扣除暗背景的操作。 + 3. 一般情况下,天文仪器还要拍标准响应图master flat frame。这是对均匀的单色标准光源拍摄的一张或者一组图片。你需要将所有的原始数据除以标准响应之后再做后续处理(同样,使用 Numpy 掩膜数组实现的话,这仅仅是一个简单的除法运算)。 + 4. 对行星影像,为了使行星在明亮恒星背景下变得可见,需要仰仗日冕仪coronagraph角差分成像angular differential imaging技术。这一步需要识别影像的光学中心,这是比较棘手的环节之一,过程中要使用 `skimage.feature.blob_dog` 从原始影像中寻找一些人工辅助影像作为帮助。 +4. 要有耐心。理解数据格式并弄清如何操作需要一些时间,绘出像素数据曲线图或者统计图有助于你的理解。贵在坚持,必有收获!你会从中学到很多关于图像数据及其处理的知识。 + +综合应用 NumPy、SciPy、Astropy、scikit-image 及其它工具,结合耐心和恒心,通过分析大量可用的天文数据分析实现重大的发现是非常有可能的。说不定,你会成为某个之前被忽略的系外行星的第一发现者呢。祝你好运! + +--- + +NumFOCUS 是个非盈利组织,维护着一套科学计算与数据科学方面的杰出开源工具集。如果想了解我们的任务及代码,可以访问 [numfocus.org][3]。如果你有兴趣以个人身份加入 NumFOCUS 社区,可以关注你所在地区的 [PyData 活动][4]。 + +本文基于 Pivigo CTO [Ole Moeller-Nilsson][12] 的一次 [谈话][11],最初发布于 NumFOCUS 的博客,蒙允再次发布。如果你有意支持 NumFOCUS,可以 [捐赠][13],也可以参与遍布全球的 [PyData 活动][4] 中你身边的那些。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/10/python-astronomy-open-data + +作者:[Gina Helfrich, Ph.D.][a] +选题:[lujun9972][b] +译者:[silentdawn-zz](https://github.com/silentdawn-zz) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/ginahelfrich +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/space_stars_cosmos_person.jpg?itok=XUtz_LyY (Person looking up at the stars) +[2]: https://numfocus.org/blog +[3]: https://numfocus.org +[4]: https://pydata.org/ +[5]: http://numpy.scipy.org/ +[6]: http://www.scipy.org/ +[7]: http://scikit-image.org/ +[8]: http://www.astropy.org/ +[9]: https://en.wikipedia.org/wiki/Data_reduction +[10]: http://www.eso.org/UserPortal +[11]: https://www.slideshare.net/OleMoellerNilsson/pydata-lonon-finding-planets-with-python +[12]: https://twitter.com/olly_mn +[13]: https://numfocus.org/donate diff --git a/published/202007/20200103 What you need to know about Rust in 2020.md b/published/202007/20200103 What you need to know about Rust in 2020.md new file mode 100644 index 0000000000..50a2b02f43 --- /dev/null +++ b/published/202007/20200103 What you need to know about Rust in 2020.md @@ -0,0 +1,73 @@ +[#]: collector: (lujun9972) +[#]: translator: (JonnieWayy) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12469-1.html) +[#]: subject: (What you need to know about Rust in 2020) +[#]: via: (https://opensource.com/article/20/1/rust-resources) +[#]: author: (Ryan Levick https://opensource.com/users/ryanlevick) + +2020 年关于 Rust 你所需要知道的 +====== + +> 尽管许多程序员长期以来一直将 Rust 用于业余爱好项目,但正如许多有关 Rust 的热门文章所解释的那样,该语言在 2019 年吸引了主要技术公司的支持。 + +![](https://img.linux.net.cn/data/attachment/album/202007/31/001101fkh88966ktvvee99.jpg) + +一段时间以来, [Rust][2] 在诸如 Hacker News 之类的网站上引起了程序员大量的关注。尽管许多人一直喜欢在业余爱好项目中[使用该语言][3],但直到 2019 年它才开始在业界流行,直到那会儿情况才真正开始有所转变。 + +在过去的一年中,包括[微软][4]、 [Facebook][5] 和 [Intel][6] 在内的许多大公司都出来支持 Rust,许多[较小的公司][7]也注意到了这一点。2016 年,作为欧洲最大的 Rust 大会 [RustFest][8] 的第一任主持人,除了 Mozilla,我没见到任何一个人在工作中使用 Rust。三年后,似乎我在 RustFest 2019 所交流的每个人都在不同的公司的日常工作中使用 Rust,无论是作为游戏开发人员、银行的后端工程师、开发者工具的创造者或是其他的一些岗位。 + +在 2019 年, Opensource.com 也通过报道 Rust 日益增长的受欢迎程度而发挥了作用。万一你错过了它们,这里是过去一年里 Opensource.com 上关于 Rust 的热门文章。 + +### 《使用 rust-vmm 构建未来的虚拟化堆栈》 + +Amazon 的 [Firecracker][9] 是支持 AWS Lambda 和 Fargate 的虚拟化技术,它是完全使用 Rust 编写的。这项技术的作者之一 Andreea Florescu 在 《[使用 rust-vmm 构建未来的虚拟化堆栈][10]》中对 Firecracker 及其相关技术进行了深入探讨。 + +Firecracker 最初是 Google [CrosVM][11] 的一个分支,但是很快由于两个项目的不同需求而分化。尽管如此,在这个项目与其他用 Rust 所编写的虚拟机管理器(VMM)之间仍有许多得到了很好共享的通用片段。考虑到这一点,[rust-vmm][12] 项目起初是以一种让 Amazon 和 Google、Intel 和 Red Hat 以及其余开源社区去相互共享通用 Rust “crates” (即程序包)的方式开始的。其中包括 KVM 接口(Linux 虚拟化 API)、Virtio 设备支持以及内核加载程序。 + +看到软件行业的一些巨头围绕用 Rust 编写的通用技术栈协同工作,实在是很神奇。鉴于这种和其他[使用 Rust 编写的技术堆栈][13]之间的伙伴关系,到了 2020 年,看到更多这样的情况我不会感到惊讶。 + +### 《为何选择 Rust 作为你的下一门编程语言》 + +采用一门新语言,尤其是在有着建立已久技术栈的大公司,并非易事。我很高兴写了《[为何选择 Rust 作为你的下一门编程语言][14]》,书中讲述了微软是如何在许多其他有趣的编程语言没有被考虑的情况下考虑采用 Rust 的。 + +选择编程语言涉及许多不同的标准——从技术上到组织上,甚至是情感上。其中一些标准比其他的更容易衡量。比方说,了解技术变更的成本(例如适应构建系统和构建新工具链)要比理解组织或情感问题(例如高效或快乐的开发人员将如何使用这种新语言)容易得多。此外,易于衡量的标准通常与成本相关,而难以衡量的标准通常以收益为导向。这通常会导致成本在决策过程中变得越来越重要,即使这不一定就是说成本要比收益更重要——只是成本更容易衡量。这使得公司不太可能采用新的语言。 + +然而,Rust 最大的好处之一是很容易衡量其编写安全且高性能系统软件的能力。鉴于微软 70% 的安全漏洞是由于内存安全问题导致的,而 Rust 正是旨在防止这些问题的,而且这些问题每年都使公司付出了几十亿美元的代价,所以很容易衡量并理解采用这门语言的好处。 + +是否会在微软全面采用 Rust 尚待观察,但是仅凭着相对于现有技术具有明显且可衡量的好处这一事实,Rust 的未来一片光明。 + +### 2020 年的 Rust + +尽管要达到 C++ 等语言的流行度还有很长的路要走。Rust 实际上已经开始在业界引起关注。我希望更多公司在 2020 年开始采用 Rust。Rust 社区现在必须着眼于欢迎开发人员和公司加入社区,同时确保将推动该语言发展到现在的一切都保留下来。 + +Rust 不仅仅是一个编译器和一组库,而是一群想要使系统编程变得容易、安全而且有趣的人。即将到来的这一年,对于 Rust 从业余爱好语言到软件行业所使用的主要语言之一的转型至关重要。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/1/rust-resources + +作者:[Ryan Levick][a] +选题:[lujun9972][b] +译者:[JonnieWayy](https://github.com/JonnieWayy) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/ryanlevick +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/laptop_screen_desk_work_chat_text.png?itok=UXqIDRDD (Person using a laptop) +[2]: http://rust-lang.org/ +[3]: https://insights.stackoverflow.com/survey/2019#technology-_-most-loved-dreaded-and-wanted-languages +[4]: https://youtu.be/o01QmYVluSw +[5]: https://youtu.be/kylqq8pEgRs +[6]: https://youtu.be/l9hM0h6IQDo +[7]: https://oxide.computer/blog/introducing-the-oxide-computer-company/ +[8]: https://rustfest.eu +[9]: https://firecracker-microvm.github.io/ +[10]: https://opensource.com/article/19/3/rust-virtual-machine +[11]: https://chromium.googlesource.com/chromiumos/platform/crosvm/ +[12]: https://github.com/rust-vmm +[13]: https://bytecodealliance.org/ +[14]: https://opensource.com/article/19/10/choose-rust-programming-language diff --git a/published/202007/20200428 Open source has room for everyone.md b/published/202007/20200428 Open source has room for everyone.md new file mode 100644 index 0000000000..38fe8f56fd --- /dev/null +++ b/published/202007/20200428 Open source has room for everyone.md @@ -0,0 +1,73 @@ +[#]: collector: (lujun9972) +[#]: translator: (guevaraya) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12399-1.html) +[#]: subject: (Open source has room for everyone) +[#]: via: (https://opensource.com/article/20/4/interview-Megan-Byrd-Sanicki) +[#]: author: (Jay Barber https://opensource.com/users/jaybarber) + +开源代码广阔天地造福人类 +====== + +> 了解 2020 年开源社区女性奖获得者 Megan Byrd-Sanicki 如何将人们聚集在一起。 + +![蒲公英般浮于水面][1] + +“在成长的过程中,我曾经有点像陆军元帅,” 2020 年[开源社区女性奖获得者][2] Megan Byrd-Sanicki 笑着说。“我总是那个把同学们拉到一起的人。‘大家来吧,我们告诉你们规则。’我也会注意旁听,尝试找出没有被接纳进来的人,并把他们拉进圈子。” + +![Megan Sanicki 的照片, 已经许可使用][3] + +这种将人们聚集在一起,并为他们建立一个组织,让他们表现出色的动力贯穿了她的大部分职业生涯和社区工作。“我回想起二年级体育课上的我,不得不承认,今天的我依然是这样的人。” + +作为第一任 [Drupal 协会][4]执行主任,Megan 十年来活跃于开源社区,现在是谷歌开源项目办公室的研发和运营主管。“我很幸运能担任这个职位,因为它可以让我看到谷歌 2000 多个不同目标、不同治理结构、不同策略的开源项目。这个也是难得的学习机会。” Megan 最近被推选为 [开源代码促进会][5]的董事会成员,她努力加强该组织为全球项目和企业提供的开源领导力。 + +### 从地下室台阶上学到的知识 + +Megan 原以为她会从商,远离循规的技术。坐在地下室台阶上,耳濡目染父亲的销售电话,到 16 岁时候就知道父亲的所有产品系列,也熟悉了其他知识。 + +“我从父亲学到了做生意就是解决问题和帮助别人” Megan 说。“在我的职业生涯这个信念我始终放在第一位。在某些角度看选择这条路我并不觉得奇怪;这是我个人选择的自然延伸,但它也把我带到了我从未梦想过的地方。” + +开源事业对 Megan 不仅仅是一个职业;她在她的社区活动中也使用同样的理念。“现在,我正在与 [Covid Act Now][6] 的一大群优秀的工程师、数据科学家以及流行病科学家合作。团队成员是义务提供他们的专业知识,公开合作,为政府公共人员提供数据建模,以便他们快速的做出有效的决策。” + +她也活跃于 [FOSS Responders][7],这是一个为受 COVID-19 事件影响的开源项目和社区成员点亮温暖的组织。“在疫情期间,项目很难得到他们需要的帮助。我们可以帮忙需要帮忙的组织和个人扩散他们的请求。”这个组织的一个重要的事务是管理 [FOSS Responders 基金][7],这是一个寻求开源项目基金的融资需求的机制,避免社区衰亡。 + +### 在这不断变化的世界中一群可爱的人 + +影响 Megan 参与到社区的两个宗旨分别是对开源的明确承诺和把大家团结在一起的动力。“人们有梦想的时候,他们就积极的去实现它,这就造就了共同的信念和强烈的 ‘为什么’。人们很容易围绕着‘为什么’参与其中。我知道我是这样做的。” Megan 在被问到她这么努力时说到。 + +“不管是帮助 Drupal 基金会筹集资金的任务还是赋能开源项目可持续发展,都会对人类产生真正的影响。帮助人们达到他们的目标,实现他们的梦想和愿景,而我也实实在在感受到收获这种蝴蝶效应般的热情。” + +开源技术在技术领域占的比重越来越大,Megan 对未来抱有很大希望。“令人兴奋的是故事还没有结束。作为一个社区,我们还在摸索,”她说:“关于开源,我们需要学习的东西太多了,我们的外部环境不断发生变化,它可以以多种方式发展,同时我们周围的环境也在变化。我们需要正确的对话,并找出如何共同发展的方法。确保每个人都有一席之地。” + +用她的话说,这些都是经常从她的父亲生意电话里听到的感悟,做生意就是解决问题并帮助别人。“帮助更多的人学习如何使用和贡献开源来解决问题,的确是一件有益的事情。不管是推动创新,提升效率,还是实现业务目标,有很多方法可以从开源中获得价值。” + +### 属于你的荣耀 + +当被问到对其他想参与到开源社区的女性有哪些建议时,Megan 兴奋的说:“请记住,在开源社区,所有人都有一席之地。这可能会让人望而生畏,但是从我的经验来看,人们都想帮忙。当你需要帮助的时候,就寻求帮助,但也要清楚你能在哪里做出贡献,如何做出贡献,以及你的需求是什么。” + +她也认识到,在开源领域的所有声音中,有时会感觉到缺乏集中的领导力,但她提醒不要把它看成是一种只留给少数人的特权角色。“做你期望的领导者。当社区领导角色空缺时,每个个体可以自己填补空缺。每一个开源的贡献者都是领导者,不管是领导他人,领导社区,甚至领导自己。不要等待被动赋予属于你的权力和精彩。” + +对 Megan 来说,开源之旅就如:一个前途不明朗的心路之旅。尽管如此,对风险和未来的不确定性她从不逃避。“我把生命看作一张你正在编织的美丽挂毯,日复一日,你仅仅看到后面的线头。如果你可以看到全貌,你将意识到,你只要每天尽自己最大的努力,就会以无数的方式为这个美好的作品做出贡献。” + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/4/interview-Megan-Byrd-Sanicki + +作者:[Jay Barber][a] +选题:[lujun9972][b] +译者:[guevaraya](https://github.com/guevaraya) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/jaybarber +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/dandelion_blue_water_hand.jpg?itok=QggW8Wnw (Dandelion held out over water) +[2]: https://www.redhat.com/en/about/women-in-open-source +[3]: https://opensource.com/sites/default/files/uploads/megan_sanicki_headshot_small_0.png (Photo by Megan Sanicki, Used with permission) +[4]: https://www.drupal.org/association +[5]: https://opensource.org/ +[6]: https://www.covidactnow.org/ +[7]: https://fossresponders.com/ +[8]: https://opensource.com/article/20/4/interview-Netha-Hussain diff --git a/published/202007/20200514 What is IoT- The internet of things explained.md b/published/202007/20200514 What is IoT- The internet of things explained.md new file mode 100644 index 0000000000..00ed2a05ef --- /dev/null +++ b/published/202007/20200514 What is IoT- The internet of things explained.md @@ -0,0 +1,155 @@ +[#]: collector: (lujun9972) +[#]: translator: (Yufei-Yan) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12411-1.html) +[#]: subject: (What is IoT? The internet of things explained) +[#]: via: (https://www.networkworld.com/article/3207535/what-is-iot-the-internet-of-things-explained.html) +[#]: author: (Josh Fruhlinger https://www.networkworld.com/author/Josh-Fruhlinger/) + +物联网(IoT)简介 +====== + +> 物联网(IoT)是一个由智能设备连接起来的网络,并提供了丰富的数据,但是它也有可能是一场安全领域的噩梦。 + +![](https://img.linux.net.cn/data/attachment/album/202007/13/144427tnrjnnh686n5kgtn.jpg) + +物联网Internet of Things(IoT)是一个统称,指的是越来越多不属于传统计算设备,但却连接到互联网接收或发送数据,或既接收也发送的电子设备组成的网络。 + +现在有数不胜数的东西可以归为这一类:可以联网的“智能”版传统设备,比如说电冰箱和灯泡;那些只能运行于有互联网环境的小设备,比如像 Alexa 之类的电子助手;与互联网连接的传感器,它们正在改变着工厂、医疗、运输、物流中心和农场。 + +### 什么是物联网? + +物联网将互联网、数据处理和分析的能力带给了现实的实物世界。对于消费者来说,这就意味着不需要键盘和显示器这些东西,就能和这个全球信息网络进行互动;他们的日常用品当中,很多都可以通过该网络接受操作指令,而只需很少的人工干预。 + +互联网长期以来为知识工作提供了便利,在企业环境当中,物联网也能为制造和分销带来同样的效率。全球数以百万计甚至数十亿计的嵌入式具有互联网功能的传感器正在提供令人难以置信丰富的数据集,企业可以利用这些数据来保证他们运营的安全、跟踪资产和减少人工流程。研究人员也可以使用物联网来获取人们的喜好和行为数据,尽管这些行为可能会严重影响隐私和安全。 + +### 它有多大? + +一句话:非常庞大。[Priceonomics 对此进行了分析][2]:在 2020 年的时候,有超过 50 亿的物联网设备,这些设备可以生成 4.4 泽字节zettabyte(LCTT 译注:1 zettabyte = 109 terabyte = 1012 gigabyte)的数据。相比较,物联网设备在 2013 年仅仅产生了 1000 亿千兆字节gigabyte的数据。在物联网市场上可能挣到的钱也同样让人瞠目;到 2025 年,这块市场的价值可以达到 1.6 万亿美元到 14.4 万亿美元不等。 + +### 物联网的历史 + +一个联网设备和传感器无处不在的世界,是科幻小说中最经典的景象之一。物联网传说中将 1970 年 [卡耐基•梅隆大学的一台连接到 APRANET 的自动贩卖机][3] 称之为世界上第一个物联网设备,而且许多技术都被吹捧为可以实现 “智能” 的物联网式特征,使其颇具有未来主义的光彩。但是“物联网”这个词是由英国的技术专家 [Kevin Ashton][4] 于 1999 年提出来的。 + +一开始,技术是滞后于当时对未来的憧憬的。每个与互联网相连的设备都需要一个处理器和一种能和其他东西通信的方式,无线的最好,这些因素都增加了物联网大规模实际应用的成本和性能要求,这种情况至少一直持续到 21 世纪头十年中期,直到摩尔定律赶上来。 + +一个重要的里程碑是 [RFID 标签的大规模使用][5],这种价格低廉的极简转发器可以被贴在任何物品上,然后这些物品就可以连接到更大的互联网上了。对于设计者来说,无处不在的 Wi-Fi 和 4G 让任何地方的无线连接都变得非常简单。而且,IPv6 的出现再也不用让人们担心把数十亿小设备连接到互联网上会将 IP 地址耗尽。(相关报道:[物联网网络可以促进 IPv6 的使用吗?][6]) + +### 物联网是如何工作的? + +物联网的基本元素是收集数据的设备。广义地说,它们是和互联网相连的设备,所以每一个设备都有 IP 地址。它们的复杂程度不一,这些设备涵盖了从工厂运输货物的自动驾驶车辆到监控建筑温度的简单传感器。这其中也包括每天统计步数的个人手环。为了让这些数据变得有意义,就需要对其收集、处理、过滤和分析,每一种数据都可以通过多种方式进行处理。 + +采集数据的方式是将数据从设备上传输到采集点。可以通过各种无线或者有线网络进行数据的转移。数据可以通过互联网发送到具有存储空间或者计算能力的数据中心或者云端,或者这些数据也可以分段进行传输,由中间设备汇总数据后再沿路径发送。 + +处理数据可以在数据中心或者云端进行,但是有时候这不太可行。对于一些非常重要的设备,比如说工业领域的关停设备,从设备上将数据发送到远程数据中心的延迟太大了。发送、处理、分析数据和返回指令(在管道爆炸之前关闭阀门)这些操作,来回一趟的时间可能要花费非常多的时间。在这种情况下,边缘计算edge-computing就可以大显身手了,智能边缘设备可以汇总数据、分析数据,在需要的时候进行回应,所有这些都在相对较近的物理距离内进行,从而减少延迟。边缘设备可以有上游连接,这样数据就可以进一步被处理和储存。 + +![][7] + +*物联网是如何工作的。* + +### 物联网设备的一些例子 + +本质上,任何可以搜集来自于真实世界数据,并且可以发送回去的设备都可以参与到物联网生态系统中。典型的例子包括智能家居设备、射频识别标签(RFID)和工业传感器。这些传感器可以监控一系列的因素,包括工业系统中的温度和压力、机器中关键设备的状态、患者身上与生命体征相关的信号、水电的使用情况,以及其它许许多多可能的东西。 + +整个工厂的机器人可以被认为是物联网设备,在工业环境和仓库中移动产品的自主车辆也是如此。 + +其他的例子包括可穿戴设备和家庭安防系统。还有一些其它更基础的设备,比如说[树莓派][8]和[Arduino][9],这些设备可以让你构建你自己的物联网终端节点。尽管你可能会认为你的智能手机是一台袖珍电脑,但它很可能也会以非常类似物联网的方式将你的位置和行为数据传送到后端服务。 + +#### 设备管理 + +为了能让这些设备一起工作,所有这些设备都需要进行验证、分配、配置和监控,并且在必要时进行修复和更新。很多时候,这些操作都会在一个单一的设备供应商的专有系统中进行;要么就完全不会进行这些操作,而这样也是最有风险的。但是整个业界正在向[标准化的设备管理模式][10]过渡,这使得物联网设备之间可以相互操作,并保证设备不会被孤立。 + +#### 物联网通信标准和协议 + +当物联网上的小设备和其他设备通信的时候,它们可以使用各种通信标准和协议,这其中许多都是为这些处理能力有限和电源功率不大的设备专门定制的。你一定听说过其中的一些,尽管有一些设备使用的是 Wi-Fi 或者蓝牙,但是更多的设备是使用了专门为物联网世界定制的标准。比如,ZigBee 就是一个低功耗、远距离传输的无线通信协议,而 MQTT(消息队列遥测传输Message Queuing Telemetry Transport)是为连接在不可靠或者易发生延迟的网络上的设备定制的一个发布/订阅信息协议。(参考 Network World 的词汇表:[物联网标准和协议](11)。) + +物联网也会受益于 5G 为蜂窝网络带来的高速度和高带宽,尽管这种使用场景会[滞后于普通的手机][12]。 + +### 物联网、边缘计算和云 + +![][13] + +*边缘计算如何使物联网成为可能。* + +对于许多物联网系统来说,大量的数据会以极快的速度涌来,这种情况催生了一个新的科技领域,[边缘计算][14]edge computing,它由放置在物联网设备附近的设备组成,处理来自那些设备的数据。这些机器对这些数据进行处理,只将相关的素材数据发送到一个更集中的系统系统进行分析。比如,想象一个由几十个物联网安防摄像头组成的网络,边缘计算会直接分析传入的视频,而且只有当其中一个摄像头检测到有物体移动的时候才向安全操作中心(SoC)发出警报,而不会是一下子将所有的在线数据流全部发送到建筑物的 SoC。 + +一旦这些数据已经被处理过了,它们又去哪里了呢?好吧,它也许会被送到你的数据中心,但是更多情况下,它最终会进入云。 + +对于物联网这种间歇或者不同步的数据来往场景来说,具有弹性的云计算是再适合不过的了。许多云计算巨头,包括[谷歌][15]、[微软][16]和[亚马逊][17],都有物联网产品。 + +### 物联网平台 + +云计算巨头们正在尝试出售的,不仅仅是存放传感器搜集的数据的地方。他们正在提供一个可以协调物联网系统中各种元素的完整平台,平台会将很多功能捆绑在一起。本质上,物联网平台作为中间件,将物联网设备和边缘网关与你用来处理物联网数据的应用程序连接起来。也就是说,每一个平台的厂商看上去都会对物联网平台应该是什么这个问题有一些稍微不同的解释,以更好地[与其他竞争者拉开差距][18]。 + +### 物联网和数据 + +正如前面所提到的,所有这些物联网设备收集了 ZB 级的数据,这些数据通过边缘网关被发送到平台上进行处理。在很多情况下,这些数据就是要部署物联网的首要原因。通过从现实世界中的传感器搜集来的数据,企业就可以实时的作出灵活的决定。 + +例如,Oracle 公司[假想了一个这样的场景][19],当人们在主题公园的时候,会被鼓励下载一个可以提供公园信息的应用。同时,这个程序会将 GPS 信号发回到公园的管理部门来帮助他们预测排队时间。有了这些信息,公园就可以在短期内(比如通过增加员工数量来提升景点的一些容量)和长期内(通过了解哪些设施最受欢迎,那些最不受欢迎)采取行动。 + +这些决定可以在没有人工干预的情况作出。比如,从化工厂管道中的压力传感器收集的数据可以通过边缘设备的软件进行分析,从而发现管道破裂的威胁,这样的信息可以触发关闭阀门的信号,从而避免泄漏。 + +### 物联网和大数据分析 + +主题公园的例子可以让你很容易理解,但是和许多现实世界中物联网收集数据的操作相比,就显得小菜一碟了。许多大数据业务都会使用到来自物联网设备收集的信息,然后与其他数据关联,这样就可以分析预测到人类的行为。Software Advice 给出了[一些例子][20],其中包括由 Birst 提供的一项服务,该服务将从联网的咖啡机中收集的咖啡冲泡的信息与社交媒体上发布的帖子进行匹配,看看顾客是否在网上谈论咖啡品牌。 + +另一个最近才发生的戏剧性的例子,X-Mode 发布了一张基于位置追踪数据的地图,地图上显示了在 2020 年 3 月春假的时候,正当新冠病毒在美国加速传播的时候,人们在劳德代尔堡Ft. Lauderdale聚会完[最终都去了哪里][21]。这张地图令人震撼,不仅仅是因为它显示出病毒可能的扩散方向,更是因为它说明了物联网设备是可以多么密切地追踪我们。(更多关于物联网和分析的信息,请点击[此处][22]。) + +### 物联网数据和 AI + +物联网设备能够收集的数据量远远大于任何人类能够以有效的方式处理的数据量,而且这肯定也不是能实时处理的。我们已经看到,仅仅为了理解从物联网终端传来的原始数据,就需要边缘计算设备。此外,还需要检测和处理可能就是[完全错误的数据][23]。 + +许多物联网供应商也同时提供机器学习和人工智能的功能,可以用来理解收集来的数据。比如,IBM 的 Jeopardy!-winning Watson 平台就可以在[物联网数据集上进行训练][24],这样就可以在预测性维护领域产生有用的结果 —— 比如说,分析来自无人机的数据,可以区分桥梁上轻微的损坏和需要重视的裂缝。同时,ARM 也在研发[低功耗芯片][25],它可以在物联网终端上提供 AI 的能力。 + +### 物联网和商业 + +物联网的商业用途包括跟踪客户、库存和重要部件的状态。[IoT for All][26] 列举了四个已经被物联网改变的行业: + +* **石油和天然气**:与人工干预相比,物联网传感器可以更好的检测孤立的钻井现场。 +* **农业**:通过物联网传感器获得的田间作物的数据,可以用来提高产量。 +* **采暖通风**:制造商可以监控全国各地的气候控制系统。 +* **实体零售**:当顾客在商店的某些地方停留的时候,可以通过手机进行微目标定位,提供优惠信息。 + +更普遍的情况是,企业正在寻找能够在[四个领域][27]上获得帮助的物联网解决方案:能源使用、资产跟踪、安全领域和客户体验。 + +-------------------------------------------------------------------------------- + +via: https://www.networkworld.com/article/3207535/what-is-iot-the-internet-of-things-explained.html + +作者:[Josh Fruhlinger][a] +选题:[lujun9972][b] +译者:[Yufei-Yan](https://github.com/Yufei-Yan) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://www.networkworld.com/author/Josh-Fruhlinger/ +[b]: https://github.com/lujun9972 +[1]: https://www.networkworld.com/category/internet-of-things/ +[2]: https://priceonomics.com/the-iot-data-explosion-how-big-is-the-iot-data/ +[3]: https://www.machinedesign.com/automation-iiot/article/21836968/iot-started-with-a-vending-machine +[4]: https://www.visioncritical.com/blog/kevin-ashton-internet-of-things +[5]: https://www.networkworld.com/article/2319384/rfid-readers-route-tag-traffic.html +[6]: https://www.networkworld.com/article/3338106/can-iot-networking-drive-adoption-of-ipv6.html +[7]: https://images.idgesg.net/images/article/2020/05/nw_how_iot_works_diagram-100840757-orig.jpg +[8]: https://www.networkworld.com/article/3176091/10-killer-raspberry-pi-projects-collection-1.html +[9]: https://www.networkworld.com/article/3075360/arduino-targets-the-internet-of-things-with-primo-board.html +[10]: https://www.networkworld.com/article/3258812/the-future-of-iot-device-management.html +[11]: https://www.networkworld.com/article/3235124/internet-of-things-definitions-a-handy-guide-to-essential-iot-terms.html +[12]: https://www.networkworld.com/article/3291778/what-s-so-special-about-5g-and-iot.html +[13]: https://images.idgesg.net/images/article/2017/09/nw_how_edge_computing_works_diagram_1400x1717-100736111-orig.jpg +[14]: https://www.networkworld.com/article/3224893/what-is-edge-computing-and-how-it-s-changing-the-network.html +[15]: https://cloud.google.com/solutions/iot +[16]: https://azure.microsoft.com/en-us/overview/iot/ +[17]: https://aws.amazon.com/iot/ +[18]: https://www.networkworld.com/article/3336166/why-are-iot-platforms-so-darn-confusing.html +[19]: https://blogs.oracle.com/bigdata/how-big-data-powers-the-internet-of-things +[20]: https://www.softwareadvice.com/resources/iot-data-analytics-use-cases/ +[21]: https://www.cnn.com/2020/04/04/tech/location-tracking-florida-coronavirus/index.html +[22]: https://www.networkworld.com/article/3311919/iot-analytics-guide-what-to-expect-from-internet-of-things-data.html +[23]: https://www.networkworld.com/article/3396230/when-iot-systems-fail-the-risk-of-having-bad-iot-data.html +[24]: https://www.networkworld.com/article/3449243/watson-iot-chief-ai-can-broaden-iot-services.html +[25]: https://www.networkworld.com/article/3532094/ai-everywhere-iot-chips-coming-from-arm.html +[26]: https://www.iotforall.com/4-unlikely-industries-iot-changing/ +[27]: https://www.networkworld.com/article/3396128/the-state-of-enterprise-iot-companies-want-solutions-for-these-4-areas.html diff --git a/published/202007/20200522 Turn your Raspberry Pi homelab into a network filesystem.md b/published/202007/20200522 Turn your Raspberry Pi homelab into a network filesystem.md new file mode 100644 index 0000000000..cff0ca4ee7 --- /dev/null +++ b/published/202007/20200522 Turn your Raspberry Pi homelab into a network filesystem.md @@ -0,0 +1,286 @@ +[#]: collector: (lujun9972) +[#]: translator: (wxy) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12413-1.html) +[#]: subject: (Turn your Raspberry Pi homelab into a network filesystem) +[#]: via: (https://opensource.com/article/20/5/nfs-raspberry-pi) +[#]: author: (Chris Collins https://opensource.com/users/clcollins) + +把你的树莓派家庭实验室变成一个网络文件系统 +====== + +> 使用 NFS 服务器将共享文件系统添加到你的家庭实验室。 + +![](https://img.linux.net.cn/data/attachment/album/202007/14/154349bgrgrwzexluuvzev.jpg) + +共享文件系统是为家庭实验室增加通用性和功能性的好方法。在实验室中为客户端共享一个集中的文件系统,使得组织数据、进行备份和共享数据变得相当容易。这对于在多个服务器上进行负载均衡的 Web 应用和 [Kubernetes][2] 使用的持久化卷来说,尤其有用,因为它允许在任何数量的节点上用持久化数据来轮转 Pod。 + +无论你的家庭实验室是由普通计算机、多余的企业服务器,还是树莓派或其他单板计算机(SBC)组成,共享文件系统都是一种有用的资产,而网络文件系统(NFS)服务器是创建共享文件系统的好方法。 + +我之前写过关于[建立“家庭私有云”][3]的文章,这是一个由树莓派或其他 SBC 组成的家庭实验室,也许还有其他一些消费类硬件或台式 PC。NFS 服务器是这些组件之间共享数据的理想方式。由于大多数 SBC 的操作系统是通过 SD 卡运行的,所以存在一些挑战。尤其是在用作计算机的操作系统磁盘时,SD 卡的故障率会增加,它们并不是用来不断地读写的。你实际需要的是一个真正的硬盘:它们通常比 SD 卡的每 GB 价格便宜,特别是对于较大的磁盘,而且它们不太可能持续发生故障。树莓派 4 现在带有 USB 3.0 接口,而 USB 3.0 硬盘无处不在,价格也很实惠。这是一个完美的搭配。在这个项目中,我将使用一个 2TB 的 USB 3.0 外置硬盘插入到运行 NFS 服务器的树莓派 4 中。 + +![Raspberry Pi with a USB hard disk][4] + +### 安装 NFS 服务器软件 + +我在树莓派上运行 Fedora 服务器,但这个项目也可以在其他发行版上运行。要在 Fedora 上运行 NFS 服务器,你需要 `nfs-utils` 包,幸运的是它已经安装好了(至少在 Fedora 31 中是这样)。如果你打算运行 NFSv3 服务,你还需要 `rpcbind` 包,但它不是 NFSv4 的严格要求。 + +如果你的系统中还没有这些软件包,请使用 `dnf` 命令安装它们。 + +``` +# 安装 nfs-utils 和 rpcbind +$ sudo dnf install nfs-utils rpcbind +``` + +Raspbian 是另一个与树莓派一起使用的流行操作系统,设置几乎完全相同。软件包名称不同而已,但这是唯一的主要区别。要在运行 Raspbian 的系统上安装 NFS 服务器,你需要以下软件包。 + + * `nfs-common`:这些文件是 NFS 服务器和客户端的通用文件。 + * `nfs-kernel-server`:主要的 NFS 服务器软件包。 + +Raspbian 使用 `apt-get` 来管理软件包(而不是像 Fedora 那样使用 `dnf`),所以用它来安装软件包。 + +``` +# 对于 Raspbian 系统,使用 apt-get 来安装 NFS 软件包 +$ sudo apt-get install nfs-common nfs-kernel-server +``` + +### 准备一个 USB 硬盘作为存储设备 + +正如我上面提到的,USB 硬盘是为树莓派或其他 SBC 提供存储的好选择,尤其是用于操作系统磁盘镜像的 SD 卡并不适合这个用途。对于家庭私有云,你可以使用廉价的 USB 3.0 硬盘进行大规模存储。插入磁盘,使用 `fdisk` 找出分配给它的设备 ID,就可以使用它工作了。 + +``` +# 使用 fdisk 找到你的硬盘 +# 无关的硬盘信息已经省略 +$ sudo fdisk -l + +Disk /dev/sda: 1.84 TiB, 2000398933504 bytes, 3907029167 sectors +Disk model: BUP Slim BK +Units: sectors of 1 * 512 = 512 bytes +Sector size (logical/physical): 512 bytes / 512 bytes +I/O size (minimum/optimal): 512 bytes / 512 bytes +Disklabel type: dos +Disk identifier: 0xe3345ae9 + +Device     Boot Start        End    Sectors  Size Id Type +/dev/sda1        2048 3907028991 3907026944  1.8T 83 Linux +``` + +为了清楚起见,在上面的例子输出中,除了我感兴趣的那个磁盘,我省略了所有其它磁盘的信息。你可以看到我想使用的 USB 磁盘被分配了设备 `/dev/sda`,你可以看到一些关于型号的信息(`Disk model: BUP Slim BK`),这有助于我识别正确的磁盘。该磁盘已经有了一个分区,它的大小也证实了它就是我要找的磁盘。 + +注意:请确保正确识别你的设备的磁盘和分区。它可能与上面的例子不同。 + +在驱动器上创建的每个分区都有一个特殊的通用唯一标识符(UUID)。计算机使用 UUID 来确保它使用 `/etc/fstab` 配置文件将正确的分区挂载到正确的位置。你可以使用 `blkid` 命令检索分区的 UUID。 + +``` +# 获取该分区的块设备属性 +# 确保你使用了合适的分区,它应该有所不同。 +$ sudo blkid /dev/sda1 + +/dev/sda1: LABEL="backup" UUID="bd44867c-447c-4f85-8dbf-dc6b9bc65c91" TYPE="xfs" PARTUUID="e3345ae9-01" +``` + +在这里,`/dev/sda1` 的 UUID 是 `bd44867c-447c-4f85-8dbf-dc6b9bc65c91`。你的 UUID 会有所不同,所以要记下来。 + +### 配置树莓派在启动时挂载这个磁盘,然后挂载它 + +现在你已经确定了要使用的磁盘和分区,你需要告诉计算机如何挂载它,每次启动时都要这样做。现在就去挂载它。因为这是一个 USB 磁盘,可能会被拔掉,所以你还要配置树莓派在启动时如果磁盘没有插入或有其它不可用情况时不要等待。 + +在 Linux 中,通过将分区添加到 `/etc/fstab` 配置文件中,包括你希望它被挂载的位置和一些参数来告诉计算机如何处理它。这个例子将把分区挂载到 `/srv/nfs`,所以先创建这个路径: + +``` +# 创建该磁盘分区的挂载点 +$ sudo mkdir -p /srv/nfs +``` + +接下来,使用以下语法格式修改 `/etc/fstab` 文件: + +``` +                   +``` + +使用你之前确定的 UUID 作为磁盘 ID。正如我在上一步提到的,挂载点是 `/srv/nfs`。对于文件系统类型,通常最好选择其实际的文件系统,但是因为这是一个 USB 磁盘,所以使用 `auto`。 + +对于选项值,使用 `nosuid,nodev,nofail`。 + +#### 关于手册页的一个旁白 + +其实,有*很多*可能的选项,手册页(`man`)是查看它们的最好方法。查看 `fstab` 的手册页是一个很好的开始。 + +``` +# 打开 fstab 的手册页 +$ man fstab +``` + +这将打开与 `fstab` 命令相关的手册/文档。在手册页中,每个选项都被分解成了不同的内容,以显示它的作用和常用的选择。例如,“第四个字段(fs_mntopts)”给出了该字段中可用选项的一些基本信息,并引导你到 `man 8 mount` 中获取 `mount` 选项更深入的描述。这是有道理的,因为 `/etc/fstab` 文件,本质上是告诉计算机如何自动挂载磁盘,就像你手动使用 `mount` 命令一样。 + +你可以从 `mount` 的手册页中获得更多关于你将使用的选项的信息。数字 8 表示手册页的章节。在这里,第 8 章节是*系统管理工具和守护进程*。 + +你可以从 `man` 的手册页中得到标准章节的列表。 + +回到挂载磁盘,让我们看看 `man 8 mount`。 + +``` +# 打开第 8 章节的 mount 手册页 +$ man 8 mount +``` + +在这个手册页中,你可以查看上面列出的选项的作用。 + + * `nosuid`:不理会 suid/guid 位。不允许放在 U 盘上的任何文件以 root 身份执行。这是一个良好的安全实践。 + * `nodev`:不识别文件系统中的字符或块特殊设备,即不理会在 U 盘上的任何设备节点。另一个良好的安全实践。 + * `nofail`:如果设备不存在,不要记录任何错误。这是一个 U 盘,可能没有插入,所以在这种情况下,它将被忽略。 + +回到你正在添加到 `/etc/fstab` 文件的那一行,最后还有两个选项:`fs_freq` 和 `fs_passno`。它们的值与一些过时的选项有关,*大多数*现代系统对这两个选项都只用 `0`,特别是对 USB 磁盘上的文件系统而言。`fs_freq` 的值与 `dump` 命令和文件系统的转储有关。`fs_passno` 的值定义了启动时要 `fsck` 的文件系统及其顺序,如果设置了这个值,通常根分区是 `1`,其他文件系统是 `2`,将该值设置为 `0` 以跳过在该分区上使用 `fsck`。 + +在你喜欢的编辑器中,打开 `/etc/fstab` 文件,添加 U 盘上分区的条目,将这里的值替换成前面步骤中得到的值。 + +``` +# With sudo, or as root, add the partition info to the /etc/fstab file +UUID="bd44867c-447c-4f85-8dbf-dc6b9bc65c91"    /srv/nfs    auto    nosuid,nodev,nofail,noatime 0 0 +``` + +### 启用并启动 NFS 服务器 + +安装好软件包,并将分区添加到你的 `/etc/fstab` 文件中,现在你可以开始启动 NFS 服务器了。在 Fedora 系统中,你需要启用和启动两个服务:`rpcbind` 和 `nfs-server`。使用 `systemctl` 命令来完成这项工作。 + +``` +# 启动 NFS 服务器和 rpcbind +$ sudo systemctl enable rpcbind.service +$ sudo systemctl enable nfs-server.service +$ sudo systemctl start rpcbind.service +$ sudo systemctl start nfs-server.service +``` + +在 Raspbian 或其他基于 Debian 的发行版上,你只需要使用 `systemctl` 命令启用并启动 `nfs-kernel-server` 服务即可,方法同上。 + +#### RPCBind + +rpcbind 工具用于将远程过程调用(RPC)服务映射到其监听的端口。根据 rpcbind 手册页: + +> “当一个 RPC 服务启动时,它会告诉 rpcbind 它正在监听的地址,以及它准备服务的 RPC 程序号。当客户机想对给定的程序号进行 RPC 调用时,它首先与服务器机器上的 rpcbind 联系,以确定 RPC 请求应该发送到哪里的地址。” + +在 NFS 服务器这个案例中,rpcbind 会将 NFS 的协议号映射到 NFS 服务器监听的端口上。但是,NFSv4 不需要使用 rpcbind。如果你*只*使用 NFSv4 (通过从配置中删除版本 2 和版本 3),则不需要使用 rpcbind。我把它放在这里是为了向后兼容 NFSv3。 + +### 导出挂载的文件系统 + +NFS 服务器根据另一个配置文件 `/etc/exports` 来决定与哪些远程客户端共享(导出)哪些文件系统。这个文件只是一个 IP(或子网)与要共享的文件系统的映射,以及一些选项(只读或读写、root 去除等)。该文件的格式是: + +``` +<目录>     <主机>(选项) +``` + +在这个例子中,你将导出挂载到 `/srv/nfs` 的分区。这是“目录”部分。 + +第二部分,主机,包括你要导出这个分区的主机。这些主机可以是单个主机:使用具有完全限定域名(FQDN)或主机名、主机的 IP 地址来指定;也可以是一组主机:使用通配符字符来匹配域(如 *.example.org)、IP 网络(如无类域间路由 CIDR 标识)或网组表示。 + +第三部分包括应用于该导出的选项。 + + * `ro/rw`:将文件系统导出为只读或读写。 + * `wdelay`:如果即将进行另一次写入,则推迟对磁盘的写入,以提高性能(如果你使用的是固态 USB 磁盘,这*可能*没有那么有用) + * `root_squash`:防止客户机上的任何 root 用户在主机上有 root 权限,并将 root UID 设置为 `nfsnobody` 作为安全防范措施。 + +测试导出你挂载在 `/srv/nfs` 处的分区到一个客户端 —— 例如,一台笔记本电脑。确定你的客户机的 IP 地址(我的笔记本是 `192.168.2.64`,但你的可能会不同)。你可以把它共享到一个大的子网,但为了测试,请限制在单个 IP 地址上。这个 IP 的 CIDR 标识是 `192.168.2.64/32`,`/32` 子网代表一个 IP。 + +使用你喜欢的编辑器编辑 `/etc/exports` 文件,写上你的目录、主机 CIDR 以及 `rw` 和 `root_squash` 选项。 + +``` +# 像这样编辑你的 /etc/exports 文件,替换为你的系统上的信息 +/srv/nfs    192.168.2.64/32(rw,root_squash) +``` + +注:如果你从另一个地方复制了 `/etc/exports` 文件,或者用副本覆盖了原文件,你可能需要恢复该文件的 SELinux 上下文。你可以使用 `restorecon` 命令来恢复。 + +``` +# 恢复 /etc/exports 文件的 SELinux 上下文 +$ sudo restorecon /etc/exports +``` + +完成后,重新启动 NFS 服务器,以接收对 `/etc/exports` 文件的更改。 + +``` +# 重新启动 NFS 服务器 +$ sudo systemctl restart nfs-server.service +``` + +### 给 NFS 服务打开防火墙 + +有些系统,默认不运行[防火墙服务][6]。比如 Raspbian,默认是开放 iptables 规则,不同服务打开的端口在机器外部立即就可以使用。相比之下,Fedora 服务器默认运行的是 firewalld 服务,所以你必须为 NFS 服务器(以及 rpcbind,如果你将使用 NFSv3)打开端口。你可以通过 `firewall-cmd` 命令来实现。 + +检查 firewalld 使用的区域并获取默认区域。对于 Fedora 服务器,这是 `FedoraServer` 区域。 + +``` +# 列出区域 +# 出于简洁省略了部分输出 +$ sudo firewall-cmd --list-all-zones + +# R获取默认区域信息 +# 记下默认区域 +$ sudo firewall-cmd --get-default-zone + +# 永久加入 nfs 服务到允许端口列表 +$ sudo firewall-cmd --add-service=nfs --permanent + +# 对于 NFSv3,我们需要再加一些端口: nfsv3、 rpc-mountd、 rpc-bind +$ sudo firewall-cmd --add-service=(nfs3,mountd,rpc-bind) + +# 查看默认区域的服务,以你的系统中使用的默认区域相应替换 +$ sudo firewall-cmd --list-services --zone=FedoraServer + +# 如果一切正常,重载 firewalld +$ sudo firewall-cmd --reload +``` + +就这样,你已经成功地将 NFS 服务器与你挂载的 U 盘分区配置在一起,并将其导出到你的测试系统中进行共享。现在你可以在你添加到导出列表的系统上测试挂载它。 + +### 测试 NFS 导出 + +首先,从 NFS 服务器上,在 `/srv/nfs` 目录下创建一个文件来读取。 + +``` +# 创建一个测试文件以共享 +echo "Can you see this?" >> /srv/nfs/nfs_test +``` + +现在,在你添加到导出列表中的客户端系统上,首先确保 NFS 客户端包已经安装好。在 Fedora 系统上,它是 `nfs-utils` 包,可以用 `dnf` 安装。Raspbian 系统有 `libnfs-utils` 包,可以用 `apt-get` 安装。 + +安装 NFS 客户端包: + +``` +# 用 dnf 安装 nfs-utils 软件包 +$ sudo dnf install nfs-utils +``` + +一旦安装了客户端包,你就可以测试 NFS 的导出了。同样在客户端,使用带有 NFS 服务器 IP 和导出路径的 `mount` 命令,并将其挂载到客户端的一个位置,在这个测试中是 `/mnt` 目录。在这个例子中,我的 NFS 服务器的 IP 是 `192.168.2.109`,但你的可能会有所不同。 + +``` +# 挂载 NFS 服务器的输出到客户端主机 +# 确保替换为你的主机的相应信息 +$ sudo mount 192.168.2.109:/srv/nfs /mnt + +# 查看 nfs_test 文件是不是可见 +$ cat /mnt/nfs_test +Can you see this? +``` + +成功了!你现在已经有了一个可以工作的 NFS 服务器,可以与多个主机共享文件,允许多个读/写访问,并为你的数据提供集中存储和备份。家庭实验室的共享存储有很多选择,但 NFS 是一种古老的、高效的、可以添加到你的“家庭私有云”家庭实验室中的好选择。本系列未来的文章将扩展如何在客户端上自动挂载 NFS 共享,以及如何将 NFS 作为 Kubernetes 持久卷的存储类。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/5/nfs-raspberry-pi + +作者:[Chris Collins][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/clcollins +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/rh_003499_01_cloud21x_cc.png?itok=5UwC92dO (Blue folders flying in the clouds above a city skyline) +[2]: https://opensource.com/resources/what-is-kubernetes +[3]: https://linux.cn/article-12277-1.html +[4]: https://opensource.com/sites/default/files/uploads/raspberrypi_with_hard-disk.jpg (Raspberry Pi with a USB hard disk) +[5]: https://creativecommons.org/licenses/by-sa/4.0/ +[6]: https://opensource.com/article/18/9/linux-iptables-firewalld diff --git a/published/202007/20200525 Foliate- A Modern eBook Reader App for Linux.md b/published/202007/20200525 Foliate- A Modern eBook Reader App for Linux.md new file mode 100644 index 0000000000..39fc680f6e --- /dev/null +++ b/published/202007/20200525 Foliate- A Modern eBook Reader App for Linux.md @@ -0,0 +1,103 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12462-1.html) +[#]: subject: (Foliate: A Modern eBook Reader App for Linux) +[#]: via: (https://itsfoss.com/foliate-ebook-viewer/) +[#]: author: (Ankush Das https://itsfoss.com/author/ankush/) + +Foliate:适用于 Linux 的现代电子书阅读器应用 +====== + +> Foliate 是一款简洁、优雅的开源电子书阅读器,可在 Linux 桌面上提供类似 Kindle 的阅读体验。 + +![](https://img.linux.net.cn/data/attachment/album/202007/28/230931vpsyu25yua8855u3.jpg) + +虽然我们已经有了一个 [Linux 最佳电子书阅读器][2]的列表,但最近我遇到了另一个 Linux 电子书阅读器。它叫 [Foliate][3]。 + +![][1] + +Foliate 是一个现代的 GTK 电子书查看器,它有许多基本功能。如果你拥有亚马逊 Kindle 或其他电子书阅读器,那么你可能会想念那种在桌面上阅读的体验。 + +![](https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/07/foliate-library-view.jpg?w=800&ssl=1) + +Foliate 解决了那些抱怨。Foliate 会显示书的估计剩余阅读时间和页数。你可以添加书签、高亮文本和添加注释。你可以导出数据,也可以轻松同步它们。 + +![Foliate Ebook Viewer Features][4] + +你也可以使用维基词典和维基百科查询单词。你可以在页面视图和滚动视图之间切换。它还有几个主题,以满足你的阅读偏好。 + +![][5] + +最棒的是,它正在积极维护和开发。 + +### Foliate 的功能 + +![][6] + +让我们来看看 Foliate 提供的所有功能: + + * 支持 .epub、.mobi、.azw、未打包的 EPUB 文件、文本文件、漫画存档(cbr、.cbz、.cbt、.cb7),小说书(.fb2、.fb2.zip)和 .azw3 文件。它不支持 PDF 文件。 + * 它让你可以在双页浏览模式下阅读电子书,并提供滚动查看模式。 + * 能够自定义字体、行距、边距和亮度。 + * 图书馆视图,显示最近的书籍和阅读进度。 + * 默认主题包括浅色、棕褐色、深色、Solarized 深色/浅色、Gruvbox 浅色/深色、灰色、Nord 和反转模式。 + * 你还可以添加自定义主题调整电子书浏览器的外观。 + * 带有章节标记的阅读进度滑块。 + * 书签和注释支持。 + * 能够在书中查找文本。 + * 能够放大和缩小。 + * 启用/禁用侧边栏进行导航。 + * 使用 [维基词典][7] 和 [维基百科][8] 快速查找字典 + * 使用谷歌翻译翻译文字 + * 触摸板手势,使用两指滑动即可翻页 + * 使用 [eSpeak NG][9] 和 [Festival][10] 支持文字转语音 + +### 在 Linux 上安装 Foliate + +对于基于 Ubuntu 和 Debian 的 Linux 发行版,你可以从它的 [GitHub 发布页面][13]获取 .deb 文件。只需双击即可[从 deb 文件安装应用][14]。 + +对于 Fedora、Arch、SUSE 等其他 Linux 发行版。Foliate 可提供 [Flatpak][15] 和 [Snap][16] 包。如果你不知道如何使用它们,那么你可以按照我们[使用 flatpak][17] 和[使用 snap 包][18]指南来开始使用。 + +如果需要,你可以浏览它的 [GitHub 页面][19]以从源代码开始构建。 + +- [下载 Foliate 应用][20] + +### 总结 + +我使用 GitHub 上提供的最新 .deb 文件在 Pop!_OS 19.10 上进行了尝试,并且效果很好。我不喜欢在桌面上阅读很久,但我喜欢它的功能。 + +你是否尝试过 Foliate?请随时分享你的经验。 + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/foliate-ebook-viewer/ + +作者:[Ankush Das][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://itsfoss.com/author/ankush/ +[b]: https://github.com/lujun9972 +[1]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/04/foliate-app.jpg?ssl=1 +[2]: https://linux.cn/article-10383-1.html +[3]: https://johnfactotum.github.io/foliate/ +[4]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/04/foliate-ebook-viewer-features.jpg?ssl=1 +[5]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/04/foliate-screenshot.jpg?ssl=1 +[6]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/04/foliate-options.jpg?ssl=1 +[7]: https://en.wiktionary.org/wiki/Wiktionary:Main_Page +[8]: https://en.wikipedia.org/wiki/Main_Page +[9]: https://github.com/espeak-ng/espeak-ng +[10]: http://www.cstr.ed.ac.uk/projects/festival/ +[13]: https://github.com/johnfactotum/foliate/releases +[14]: https://itsfoss.com/install-deb-files-ubuntu/ +[15]: https://flathub.org/apps/details/com.github.johnfactotum.Foliate +[16]: https://snapcraft.io/foliate +[17]: https://itsfoss.com/flatpak-guide/ +[18]: https://itsfoss.com/use-snap-packages-ubuntu-16-04/ +[19]: https://github.com/johnfactotum/foliate +[20]: tmp.6FO70BtAuy \ No newline at end of file diff --git a/published/202007/20200525 How Cloud-init can be used for your Raspberry Pi homelab.md b/published/202007/20200525 How Cloud-init can be used for your Raspberry Pi homelab.md new file mode 100644 index 0000000000..e297ca2521 --- /dev/null +++ b/published/202007/20200525 How Cloud-init can be used for your Raspberry Pi homelab.md @@ -0,0 +1,83 @@ +[#]: collector: (lujun9972) +[#]: translator: (wxy) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12371-1.html) +[#]: subject: (How Cloud-init can be used for your Raspberry Pi homelab) +[#]: via: (https://opensource.com/article/20/5/cloud-init-raspberry-pi-homelab) +[#]: author: (Chris Collins https://opensource.com/users/clcollins) + +在你的树莓派家庭实验室中使用 Cloud-init +====== + +> 了解了云行业的标准,该向你的家庭实验室自动添加新设备和用户了。 + +![](https://img.linux.net.cn/data/attachment/album/202007/01/203559wt8tnnnxnc6jcnn8.jpg) + +[Cloud-init][2](可以说)是一个标准,云提供商用它来为云实例提供初始化和配置数据。它最常用于新实例的首次启动,以自动完成网络设置、账户创建和 SSH 密钥安装等使新系统上线所需的任何事情,以便用户可以访问它。 + +在之前的一篇文章《[修改磁盘镜像来创建基于树莓派的家庭实验室][3]》中,我展示了如何为像树莓派这样的单板计算机定制操作系统镜像以实现类似的目标。有了 Cloud-init,就不需要向镜像中添加自定义数据。一旦在镜像中启用了它,你的虚拟机、物理服务器,甚至是小小的树莓派都可以表现得像你自己的 “家庭私有云” 中的云计算实例。新机器只需插入、打开,就可以自动成为你的[家庭实验室][4]的一部分。 + +说实话,Cloud-init 的设计并没有考虑到家庭实验室。正如我所提到的,你可以很容易地修改给定的一套系统磁盘镜像,以启用 SSH 访问并在第一次启动后对它们进行配置。Cloud-init 是为大规模的云提供商设计的,这些提供商需要容纳许多客户,维护一组小的镜像,并为这些客户提供访问实例的机制,而无需为每个客户定制一个镜像。拥有单个管理员的家庭实验室则不会面临同样的挑战。 + +不过,Cloud-init 在家庭实验室中也不是没有可取之处。教育是我的家庭私有云项目的目标之一,而为你的家庭实验室设置 Cloud-init 是一个很好的方式,可以获得大大小小的云提供商大量使用的技术的经验。Cloud-init 也是其他初始配置选项的替代方案之一。与其为家庭实验室中的每台设备定制每个镜像、ISO 等,并在你要进行更改时面临繁琐的更新,不如直接启用 Cloud-init。这减少了技术债务 —— 还有什么比*个人*技术债务更糟糕的吗?最后,在你的家庭实验室中使用 Cloud-init 可以让你的私有云实例与你拥有的或将来可能拥有的任何公有云实例表现相同 —— 这是真正的[混合云][5]。 + +### 关于 Cloud-init + +当为 Cloud-init 配置的实例启动并且服务开始运行时(实际上是 systemd 中的四个服务,以处理启动过程中的依赖关系),它会检查其配置中的[数据源][6],以确定其运行在什么类型的云中。每个主要的云提供商都有一个数据源配置,告诉实例在哪里以及如何检索配置信息。然后,实例使用数据源信息检索云提供商提供的配置信息(如网络信息和实例识别信息)和客户提供的配置数据(如要复制的授权密钥、要创建的用户账户以及许多其他可能的任务)。 + +检索数据后,Cloud-init 再对实例进行配置:设置网络、复制授权密钥等,最后完成启动过程。然后,远程用户就可以访问它,准备好使用 [Ansible][7] 或 [Puppet][8] 等工具进行进一步的配置,或者准备好接收工作负载并开始分配任务。 + +### 配置数据 + +如上所述,Cloud-init 使用的配置数据来自两个潜在来源:云提供商和实例用户。在家庭实验室中,你扮演着这两种角色:作为云提供商提供网络和实例信息,作为用户提供配置信息。 + +#### 云提供商元数据文件 + +在你的云提供商角色中,你的家庭实验室数据源将为你的私有云实例提供一个元数据文件。这个[元数据][9]文件包含实例 ID、云类型、Python 版本(Cloud-init 用 Python 编写并使用 Python)或要分配给主机的 SSH 公钥等信息。如果你不使用 DHCP(或 Cloud-init 支持的其他机制,如镜像中的配置文件或内核参数),元数据文件还可能包含网络信息。 + +#### 用户提供的用户数据文件 + +Cloud-init 的真正价值在于用户数据文件。[用户数据][10]文件由用户提供给云提供商,并包含在数据源中,它将实例从一台普通的机器变成了用户舰队的一员。用户数据文件可以以可执行脚本的形式出现,与正常情况下脚本的工作方式相同;也可以以云服务配置 YAML 文件的形式出现,利用 [Cloud-init 的模块][11] 来执行配置任务。 + +### 数据源 + +数据源是由云提供商提供的服务,它为实例提供了元数据和用户数据文件。实例镜像或 ISO 被配置为告知实例正在使用什么数据源。 + +例如,亚马逊 AWS 提供了一个 [link-local][12] 文件,它将用实例的自定义数据来响应实例的 HTTP 请求。其他云提供商也有自己的机制。幸运的是,对于家庭私有云项目来说,也有 NoCloud 数据源。 + +[NoCloud][13] 数据源允许通过内核命令以键值对的形式提供配置信息,或通过挂载的 ISO 文件系统以用户数据和元数据文件的形式提供。这些对于虚拟机来说很有用,尤其是与自动化搭配来创建虚拟机。 + +还有一个 NoCloudNet 数据源,它的行为类似于 AWS EC2 数据源,提供一个 IP 地址或 DNS 名称,通过 HTTP 从这里检索用户数据和元数据。这对于你的家庭实验室中的物理机器来说是最有帮助的,比如树莓派、[NUC][14] 或多余的服务器设备。虽然 NoCloud 可以工作,但它需要更多的人工关注 —— 这是云实例的反模式。 + +### 家庭实验室的 Cloud-init + +我希望这能让你了解到 Cloud-init 是什么,以及它对你的家庭实验室有何帮助。它是一个令人难以置信的工具,被主要的云提供商所接受,在家里使用它可以是为了教育和乐趣,并帮助你自动向实验室添加新的物理或虚拟服务器。之后的文章将详细介绍如何创建简单的静态和更复杂的动态 Cloud-init 服务,并指导你将它们纳入你的家庭私有云。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/5/cloud-init-raspberry-pi-homelab + +作者:[Chris Collins][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/clcollins +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/innovation_lightbulb_gears_devops_ansible.png?itok=TSbmp3_M (gears and lightbulb to represent innovation) +[2]: https://cloudinit.readthedocs.io/ +[3]: https://linux.cn/article-12277-1.html +[4]: https://opensource.com/article/19/3/home-lab +[5]: https://www.redhat.com/en/topics/cloud-computing/what-is-hybrid-cloud +[6]: https://cloudinit.readthedocs.io/en/latest/topics/datasources.html +[7]: https://www.ansible.com/ +[8]: https://puppet.com/ +[9]: https://cloudinit.readthedocs.io/en/latest/topics/instancedata.html# +[10]: https://cloudinit.readthedocs.io/en/latest/topics/format.html +[11]: https://cloudinit.readthedocs.io/en/latest/topics/modules.html +[12]: https://en.wikipedia.org/wiki/Link-local_address +[13]: https://cloudinit.readthedocs.io/en/latest/topics/datasources/nocloud.html +[14]: https://en.wikipedia.org/wiki/Next_Unit_of_Computing diff --git a/published/202007/20200527 Add nodes to your private cloud using Cloud-init.md b/published/202007/20200527 Add nodes to your private cloud using Cloud-init.md new file mode 100644 index 0000000000..1f0939e103 --- /dev/null +++ b/published/202007/20200527 Add nodes to your private cloud using Cloud-init.md @@ -0,0 +1,315 @@ +[#]: collector: (lujun9972) +[#]: translator: (wxy) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12407-1.html) +[#]: subject: (Add nodes to your private cloud using Cloud-init) +[#]: via: (https://opensource.com/article/20/5/create-simple-cloud-init-service-your-homelab) +[#]: author: (Chris Collins https://opensource.com/users/clcollins) + +使用 Cloud-init 将节点添加到你的私有云中 +====== + +> 像主流云提供商的处理方式一样,在家中添加机器到你的私有云。 + +![](https://img.linux.net.cn/data/attachment/album/202007/12/100823rj096h3ax4hhehey.jpg) + +[Cloud-init][2] 是一种广泛使用的行业标准方法,用于初始化云实例。云提供商使用 Cloud-init 来定制实例的网络配置、实例信息,甚至用户提供的配置指令。它也是一个可以在你的“家庭私有云”中使用的很好的工具,可以为你的家庭实验室的虚拟机和物理机的初始设置和配置添加一点自动化 —— 并了解更多关于大型云提供商是如何工作的信息。关于更多的细节和背景,请看我之前的文章《[在你的树莓派家庭实验室中使用 Cloud-init][3]》。 + +![A screen showing the boot process for a Linux server running Cloud-init ][4] + +*运行 Cloud-init 的 Linux 服务器的启动过程(Chris Collins,[CC BY-SA 4.0][5])* + +诚然,Cloud-init 对于为许多不同客户配置机器的云提供商来说,比对于由单个系统管理员运行的家庭实验室更有用,而且 Cloud-init 解决的许多问题对于家庭实验室来说可能有点多余。然而,设置它并了解它的工作原理是了解更多关于这种云技术的好方法,更不用说它是首次启动时配置设备的好方法。 + +本教程使用 Cloud-init 的 NoCloud 数据源,它允许 Cloud-init 在传统的云提供商环境之外使用。本文将向你展示如何在客户端设备上安装 Cloud-init,并设置一个运行 Web 服务的容器来响应客户端的请求。你还将学习如何审查客户端从 Web 服务中请求的内容,并修改 Web 服务的容器,以提供基本的、静态的 Cloud-init 服务。 + +### 在现有系统上设置 Cloud-init + +Cloud-init 可能在新系统首次启动时最有用,它可以查询配置数据,并根据指令对系统进行定制。它可以[包含在树莓派和单板计算机的磁盘镜像中][6],也可以添加到用于配给provision虚拟机的镜像中。对于测试用途来说,无论是在现有系统上安装并运行 Cloud-init,还是安装一个新系统,然后设置 Cloud-init,都是很容易的。 + +作为大多数云提供商使用的主要服务,大多数 Linux 发行版都支持 Cloud-init。在这个例子中,我将使用 Fedora 31 Server 来安装树莓派,但在 Raspbian、Ubuntu、CentOS 和大多数其他发行版上也可以用同样的方式来完成。 + +#### 安装并启用云计算初始服务 + +在你想作为 Cloud-init 客户端的系统上,安装 Cloud-init 包。如果你使用的是 Fedora: + +``` +# Install the cloud-init package +dnf install -y cloud-init +``` + +Cloud-init 实际上是四个不同的服务(至少在 systemd 下是这样),这些服务负责检索配置数据,并在启动过程的不同阶段进行配置更改,这使得可以做的事情更加灵活。虽然你不太可能直接与这些服务进行太多交互,但在你需要排除一些故障时,知道它们是什么还是很有用的。它们是: + + * cloud-init-local.service + * cloud-init.service + * cloud-config.service + * cloud-final.service + +启用所有四个服务: + +``` +# Enable the four cloud-init services +systemctl enable cloud-init-local.service +systemctl enable cloud-init.service +systemctl enable cloud-config.service +systemctl enable cloud-final.service +``` + +#### 配置数据源以查询 + +启用服务后,请配置数据源,客户端将从该数据源查询配置数据。有[许多数据源类型][7],而且大多数都是为特定的云提供商配置的。对于你的家庭实验室,请使用 NoCloud 数据源,(如上所述)它是为在没有云提供商的情况下使用 Cloud-init 而设计的。 + +NoCloud 允许以多种方式包含配置信息:以内核参数中的键/值对,用于在启动时挂载的 CD(或虚拟机中的虚拟 CD);包含在文件系统中的文件中;或者像本例中一样,通过 HTTP 从指定的 URL(“NoCloud Net” 选项)获取配置信息。 + +数据源配置可以通过内核参数提供,也可以在 Cloud-init 配置文件 `/etc/cloud/cloud.cfg` 中进行设置。该配置文件对于使用自定义磁盘镜像设置 Cloud-init 或在现有主机上进行测试非常方便。 + +Cloud-init 还会合并在 `/etc/cloud/cloud.cfg.d/` 中找到的任何 `*.cfg` 文件中的配置数据,因此为了保持整洁,请在 `/etc/cloud/cloud.cfg.d/10_datasource.cfg` 中配置数据源。Cloud-init 可以通过使用以下语法从 `seedfrom` 键指向的 HTTP 数据源中读取数据。 + +``` +seedfrom: http://ip_address:port/ +``` + +IP 地址和端口是你将在本文后面创建的 Web 服务。我使用了我的笔记本电脑的 IP 和 8080 端口。这也可以是 DNS 名称。 + +创建 `/etc/cloud/cloud.cfg.d/10_datasource.cfg` 文件: + +``` +# Add the datasource: +# /etc/cloud/cloud.cfg.d/10_datasource.cfg + +# NOTE THE TRAILING SLASH HERE! +datasource: +  NoCloud: +    seedfrom: http://ip_address:port/ +``` + +客户端设置就是这样。现在,重新启动客户端后,它将尝试从你在 `seedfrom` 键中输入的 URL 检索配置数据,并进行必要的任何配置更改。 + +下一步是设置一个 Web 服务器来侦听客户端请求,以便你确定需要提供的服务。 + +### 设置网络服务器以审查客户请求 + +你可以使用 [Podman][8] 或其他容器编排工具(如 Docker 或 Kubernetes)快速创建和运行 Web 服务器。这个例子使用的是 Podman,但同样的命令也适用于 Docker。 + +要开始,请使用 `fedora:31` 容器镜像并创建一个容器文件(对于 Docker 来说,这会是一个 Dockerfile)来安装和配置 Nginx。从该容器文件中,你可以构建一个自定义镜像,并在你希望提供 Cloud-init 服务的主机上运行它。 + +创建一个包含以下内容的容器文件: + +``` +FROM fedora:31 + +ENV NGINX_CONF_DIR "/etc/nginx/default.d" +ENV NGINX_LOG_DIR "/var/log/nginx" +ENV NGINX_CONF "/etc/nginx/nginx.conf" +ENV WWW_DIR "/usr/share/nginx/html" + +# Install Nginx and clear the yum cache +RUN dnf install -y nginx \ + && dnf clean all \ + && rm -rf /var/cache/yum + +# forward request and error logs to docker log collector +RUN ln -sf /dev/stdout ${NGINX_LOG_DIR}/access.log \ + && ln -sf /dev/stderr ${NGINX_LOG_DIR}/error.log + +# Listen on port 8080, so root privileges are not required for podman +RUN sed -i -E 's/(listen)([[:space:]]*)(\[\:\:\]\:)?80;$/\1\2\38080 default_server;/' $NGINX_CONF +EXPOSE 8080 + +# Allow Nginx PID to be managed by non-root user +RUN sed -i '/user nginx;/d' $NGINX_CONF +RUN sed -i 's/pid \/run\/nginx.pid;/pid \/tmp\/nginx.pid;/' $NGINX_CONF + +# Run as an unprivileged user +USER 1001 + +CMD ["nginx", "-g", "daemon off;"] +``` + +注:本例中使用的容器文件和其他文件可以在本项目的 [GitHub 仓库][9]中找到。 + +上面容器文件中最重要的部分是改变日志存储方式的部分(写到 STDOUT 而不是文件),这样你就可以在容器日志中看到进入该服务器的请求。其他的一些改变使你可以在没有 root 权限的情况下使用 Podman 运行容器,也可以在没有 root 权限的情况下运行容器中的进程。 + +在 Web 服务器上的第一个测试并不提供任何 Cloud-init 数据;只是用它来查看 Cloud-init 客户端的请求。 + +创建容器文件后,使用 Podman 构建并运行 Web 服务器镜像: + +``` +# Build the container image +$ podman build -f Containerfile -t cloud-init:01 . + +# Create a container from the new image, and run it +# It will listen on port 8080 +$ podman run --rm -p 8080:8080 -it cloud-init:01 +``` + +这会运行一个容器,让你的终端连接到一个伪 TTY。一开始看起来什么都没有发生,但是对主机 8080 端口的请求会被路由到容器内的 Nginx 服务器,并且在终端窗口中会出现一条日志信息。这一点可以用主机上的 `curl` 命令进行测试。 + +``` +# Use curl to send an HTTP request to the Nginx container +$ curl http://localhost:8080 +``` + +运行该 `curl` 命令后,你应该会在终端窗口中看到类似这样的日志信息: + +``` +127.0.0.1 - - [09/May/2020:19:25:10 +0000] "GET / HTTP/1.1" 200 5564 "-" "curl/7.66.0" "-" +``` + +现在,有趣的部分来了:重启 Cloud-init 客户端,并观察 Nginx 日志,看看当客户端启动时, Cloud-init 向 Web 服务器发出了什么请求。 + +当客户端完成其启动过程时,你应该会看到类似的日志消息。 + +``` +2020/05/09 22:44:28 [error] 2#0: *4 open() "/usr/share/nginx/html/meta-data" failed (2: No such file or directory), client: 127.0.0.1, server: _, request: "GET /meta-data HTTP/1.1", host: "instance-data:8080" +127.0.0.1 - - [09/May/2020:22:44:28 +0000] "GET /meta-data HTTP/1.1" 404 3650 "-" "Cloud-Init/17.1" "-" +``` + +注:使用 `Ctrl+C` 停止正在运行的容器。 + +你可以看到请求是针对 `/meta-data` 路径的,即 `http://ip_address_of_the_webserver:8080/meta-data`。这只是一个 GET 请求 —— Cloud-init 并没有向 Web 服务器发送任何数据。它只是盲目地从数据源 URL 中请求文件,所以要由数据源来识别主机的要求。这个简单的例子只是向任何客户端发送通用数据,但一个更大的家庭实验室应该需要更复杂的服务。 + +在这里,Cloud-init 请求的是[实例元数据][10]信息。这个文件可以包含很多关于实例本身的信息,例如实例 ID、分配实例的主机名、云 ID,甚至网络信息。 + +创建一个包含实例 ID 和主机名的基本元数据文件,并尝试将其提供给 Cloud-init 客户端。 + +首先,创建一个可复制到容器镜像中的 `meta-data` 文件。 + +``` +instance-id: iid-local01 +local-hostname: raspberry +hostname: raspberry +``` + +实例 ID(`instance-id`)可以是任何东西。但是,如果你在 Cloud-init 运行后更改实例 ID,并且文件被送达客户端,就会触发 Cloud-init 再次运行。你可以使用这种机制来更新实例配置,但你应该意识到它是这种工作方式。 + +`local-hostname` 和 `hostname` 键正如其名,它们会在 Cloud-init 运行时为客户端设置主机名信息。 + +在容器文件中添加以下行以将 `meta-data` 文件复制到新镜像中。 + +``` +# Copy the meta-data file into the image for Nginx to serve it +COPY meta-data ${WWW_DIR}/meta-data +``` + +现在,用元数据文件重建镜像(使用一个新的标签以方便故障排除),并用 Podman 创建并运行一个新的容器。 + +``` +# Build a new image named cloud-init:02 +podman build -f Containerfile -t cloud-init:02 . + +# Run a new container with this new meta-data file +podman run --rm -p 8080:8080 -it cloud-init:02 +``` + +新容器运行后,重启 Cloud-init 客户端,再次观察 Nginx 日志。 + +``` +127.0.0.1 - - [09/May/2020:22:54:32 +0000] "GET /meta-data HTTP/1.1" 200 63 "-" "Cloud-Init/17.1" "-" +2020/05/09 22:54:32 [error] 2#0: *2 open() "/usr/share/nginx/html/user-data" failed (2: No such file or directory), client: 127.0.0.1, server: _, request: "GET /user-data HTTP/1.1", host: "instance-data:8080" +127.0.0.1 - - [09/May/2020:22:54:32 +0000] "GET /user-data HTTP/1.1" 404 3650 "-" "Cloud-Init/17.1" "-" +``` + +你看,这次 `/meta-data` 路径被提供给了客户端。成功了! + +然而,客户端接着在 `/user-data` 路径上寻找第二个文件。该文件包含实例所有者提供的配置数据,而不是来自云提供商的数据。对于一个家庭实验室来说,这两个都是你自己提供的。 + +你可以使用[许多 user-data 模块][11]来配置你的实例。对于这个例子,只需使用 `write_files` 模块在客户端创建一些测试文件,并验证 Cloud-init 是否工作。 + +创建一个包含以下内容的用户数据文件: + +``` +#cloud-config + +# Create two files with example content using the write_files module +write_files: + - content: | +    "Does cloud-init work?" +   owner: root:root +   permissions: '0644' +   path: /srv/foo + - content: | +   "IT SURE DOES!" +   owner: root:root +   permissions: '0644' +   path: /srv/bar +``` + +除了使用 Cloud-init 提供的 `user-data` 模块制作 YAML 文件外,你还可以将其制作成一个可执行脚本供 Cloud-init 运行。 + +创建 `user-data` 文件后,在容器文件中添加以下行,以便在重建映像时将其复制到镜像中: + +``` +# Copy the user-data file into the container image +COPY user-data ${WWW_DIR}/user-data +``` + +重建镜像,并创建和运行一个新的容器,这次使用用户数据信息: + +``` +# Build a new image named cloud-init:03 +podman build -f Containerfile -t cloud-init:03 . + +# Run a new container with this new user-data file +podman run --rm -p 8080:8080 -it cloud-init:03 +``` + +现在,重启 Cloud-init 客户端,观察 Web 服务器上的 Nginx 日志: + +``` +127.0.0.1 - - [09/May/2020:23:01:51 +0000] "GET /meta-data HTTP/1.1" 200 63 "-" "Cloud-Init/17.1" "-" +127.0.0.1 - - [09/May/2020:23:01:51 +0000] "GET /user-data HTTP/1.1" 200 298 "-" "Cloud-Init/17.1" "- +``` + +成功了!这一次,元数据和用户数据文件都被送到了 Cloud-init 客户端。 + +### 验证 Cloud-init 已运行 + +从上面的日志中,你知道 Cloud-init 在客户端主机上运行并请求元数据和用户数据文件,但它用它们做了什么?你可以在 `write_files` 部分验证 Cloud-init 是否写入了你在用户数据文件中添加的文件。 + +在 Cloud-init 客户端上,检查 `/srv/foo` 和 `/srv/bar` 文件的内容: + +``` +# cd /srv/ && ls +bar foo +# cat foo +"Does cloud-init work?" +# cat bar +"IT SURE DOES!" +``` + +成功了!文件已经写好了,并且有你期望的内容。 + +如上所述,还有很多其他模块可以用来配置主机。例如,用户数据文件可以配置成用 `apt` 添加包、复制 SSH 的 `authorized_keys`、创建用户和组、配置和运行配置管理工具等等。我在家里的私有云中使用它来复制我的 `authorized_keys`、创建一个本地用户和组,并设置 sudo 权限。 + +### 你接下来可以做什么 + +Cloud-init 在家庭实验室中很有用,尤其是专注于云技术的实验室。本文所演示的简单服务对于家庭实验室来说可能并不是超级有用,但现在你已经知道 Cloud-init 是如何工作的了,你可以继续创建一个动态服务,可以用自定义数据配置每台主机,让家里的私有云更类似于主流云提供商提供的服务。 + +在数据源稍显复杂的情况下,将新的物理(或虚拟)机器添加到家中的私有云中,可以像插入它们并打开它们一样简单。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/5/create-simple-cloud-init-service-your-homelab + +作者:[Chris Collins][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/clcollins +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/computer_desk_home_laptop_browser.png?itok=Y3UVpY0l (Digital images of a computer desktop) +[2]: https://cloudinit.readthedocs.io/ +[3]: https://linux.cn/article-12371-1.html +[4]: https://opensource.com/sites/default/files/uploads/cloud-init.jpg (A screen showing the boot process for a Linux server running Cloud-init ) +[5]: https://creativecommons.org/licenses/by-sa/4.0/ +[6]: https://linux.cn/article-12277-1.html +[7]: https://cloudinit.readthedocs.io/en/latest/topics/datasources.html +[8]: https://podman.io/ +[9]: https://github.com/clcollins/homelabCloudInit/tree/master/simpleCloudInitService/data +[10]: https://cloudinit.readthedocs.io/en/latest/topics/instancedata.html#what-is-instance-data +[11]: https://cloudinit.readthedocs.io/en/latest/topics/modules.html diff --git a/published/202007/20200605 Build a Kubernetes cluster with the Raspberry Pi.md b/published/202007/20200605 Build a Kubernetes cluster with the Raspberry Pi.md new file mode 100644 index 0000000000..3055c80de0 --- /dev/null +++ b/published/202007/20200605 Build a Kubernetes cluster with the Raspberry Pi.md @@ -0,0 +1,424 @@ +[#]: collector: (lujun9972) +[#]: translator: (wxy) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12421-1.html) +[#]: subject: (Build a Kubernetes cluster with the Raspberry Pi) +[#]: via: (https://opensource.com/article/20/6/kubernetes-raspberry-pi) +[#]: author: (Chris Collins https://opensource.com/users/clcollins) + +用树莓派构建 Kubernetes 集群 +====== + +> 将 Kubernetes 安装在多个树莓派上,实现自己的“家庭私有云”容器服务。 + +![](https://img.linux.net.cn/data/attachment/album/202007/15/234152ivw1y2wwhmhmpuvo.jpg) + +[Kubernetes][2] 从一开始就被设计为云原生的企业级容器编排系统。它已经成长为事实上的云容器平台,并由于接受了容器原生虚拟化和无服务器计算等新技术而继续发展。 + +从微型的边缘计算到大规模的容器环境,无论是公有云还是私有云环境,Kubernetes 都可以管理其中的容器。它是“家庭私有云”项目的理想选择,既提供了强大的容器编排,又让你有机会了解一项这样的技术 —— 它的需求如此之大,与云计算结合得如此彻底,以至于它的名字几乎就是“云计算”的代名词。 + +没有什么比 Kubernetes 更懂“云”,也没有什么能比树莓派更合适“集群起来”!在廉价的树莓派硬件上运行本地的 Kubernetes 集群是获得在真正的云技术巨头上进行管理和开发的经验的好方法。 + +### 在树莓派上安装 Kubernetes 集群 + +本练习将在三个或更多运行 Ubuntu 20.04 的树莓派 4 上安装 Kubernetes 1.18.2 集群。Ubuntu 20.04(Focal Fossa)提供了针对 64 位 ARM(ARM64)的树莓派镜像(64 位内核和用户空间)。由于目标是使用这些树莓派来运行 Kubernetes 集群,因此运行 AArch64 容器镜像的能力非常重要:很难找到 32 位的通用软件镜像乃至于标准基础镜像。借助 Ubuntu 20.04 的 ARM64 镜像,可以让你在 Kubernetes 上使用 64 位容器镜像。 + +#### AArch64 vs. ARM64;32 位 vs. 64 位;ARM vs. x86 + +请注意,AArch64 和 ARM64 实际上是同一种东西。不同的名称源于它们在不同社区中的使用。许多容器镜像都标为 AArch64,并能在标为 ARM64 的系统上正常运行。采用 AArch64/ARM64 架构的系统也能够运行 32 位的 ARM 镜像,但反之则不然:32 位的 ARM 系统无法运行 64 位的容器镜像。这就是 Ubuntu 20.04 ARM64 镜像如此有用的原因。 + +这里不会太深入地解释不同的架构类型,值得注意的是,ARM64/AArch64 和 x86\_64 架构是不同的,运行在 64 位 ARM 架构上的 Kubernetes 节点无法运行为 x86\_64 构建的容器镜像。在实践中,你会发现有些镜像没有为两种架构构建,这些镜像可能无法在你的集群中使用。你还需要在基于 Arch64 的系统上构建自己的镜像,或者跳过一些限制以让你的常规的 x86\_64 系统构建 Arch64 镜像。在“家庭私有云”项目的后续文章中,我将介绍如何在常规系统上构建 AArch64 镜像。 + +为了达到两全其美的效果,在本教程中设置好 Kubernetes 集群后,你可以在以后向其中添加 x86\_64 节点。你可以通过使用 [Kubernetes 的污点taint容忍toleration][3] 能力,由 Kubernetes 的调度器将给定架构的镜像调度到相应的节点上运行。 + +关于架构和镜像的内容就不多说了。是时候安装 Kubernetes 了,开始吧! + +#### 前置需求 + +这个练习的要求很低。你将需要: + +* 三台(或更多)树莓派 4(最好是 4GB 内存的型号)。 +* 在全部树莓派上安装 Ubuntu 20.04 ARM64。 + +为了简化初始设置,请阅读《[修改磁盘镜像来创建基于树莓派的家庭实验室][4]》,在将 Ubuntu 镜像写入 SD 卡并安装在树莓派上之前,添加一个用户和 SSH 授权密钥(`authorized_keys`)。 + +### 配置主机 + +在 Ubuntu 被安装在树莓派上,并且可以通过 SSH 访问后,你需要在安装 Kubernetes 之前做一些修改。 + +#### 安装和配置 Docker + +截至目前,Ubuntu 20.04 在 base 软件库中提供了最新版本的 Docker,即 v19.03,可以直接使用 `apt` 命令安装它。请注意,包名是 `docker.io`。请在所有的树莓派上安装 Docker: + +``` +# 安装 docker.io 软件包 +$ sudo apt install -y docker.io +``` + +安装好软件包后,你需要做一些修改来启用 [cgroup][5](控制组)。cgroup 允许 Linux 内核限制和隔离资源。实际上,这可以让 Kubernetes 更好地管理其运行的容器所使用的资源,并通过让容器彼此隔离来增加安全性。 + +在对所有树莓派进行以下修改之前,请检查 `docker info` 的输出: + +``` +# 检查 `docker info` +# 省略了某些输出 +$ sudo docker info +(...) + Cgroup Driver: cgroups +(...) +WARNING: No memory limit support +WARNING: No swap limit support +WARNING: No kernel memory limit support +WARNING: No kernel memory TCP limit support +WARNING: No oom kill disable support +``` + +上面的输出突出显示了需要修改的部分:cgroup 驱动和限制支持。 + +首先,将 Docker 使用的默认 cgroup 驱动从 `cgroups` 改为 `systemd`,让 systemd 充当 cgroup 管理器,确保只有一个 cgroup 管理器在使用。这有助于系统的稳定性,这也是 Kubernetes 所推荐的。要做到这一点,请创建 `/etc/docker/daemon.json` 文件或将内容替换为: + +``` +# 创建或替换 /etc/docker/daemon.json 以启用 cgroup 的 systemd 驱动 + +$ sudo cat > /etc/docker/daemon.json <容器网络接口Container Network Interface(CNI)加载项使用。本练习使用的是 [Flannel][7] CNI。你选择的 CIDR 不应该与你的家庭网络中当前使用的任何 CIDR 重叠,也不应该与你的路由器或 DHCP 服务器管理的 CIDR 重叠。确保使用一个比你预期需要的更大的子网:**总是**有比你最初计划的更多的 Pod!在这个例子中,我将使用 CIDR 地址 `10.244.0.0/16`,但你可以选择一个适合你的。 + +有了这些决定,你就可以初始化控制平面节点了。用 SSH 或其他方式登录到你为控制平面指定的节点。 + +#### 初始化控制平面 + +Kubernetes 使用一个引导令牌来验证被加入集群的节点。当初始化控制平面节点时,需要将此令牌传递给 `kubeadm init` 命令。用 `kubeadm token generate` 命令生成一个令牌: + +``` +# 生成一个引导令牌来验证加入集群的节点 +$ TOKEN=$(sudo kubeadm token generate) +$ echo $TOKEN +d584xg.xupvwv7wllcpmwjy +``` + +现在你可以使用 `kubeadm init` 命令来初始化控制平面了: + +``` +# 初始化控制平面 +#(输出略) +$ sudo kubeadm init --token=${TOKEN} --kubernetes-version=v1.18.2 --pod-network-cidr=10.244.0.0/16 +``` + +如果一切顺利,你应该在输出的最后看到类似这样的东西: + +``` +Your Kubernetes control-plane has initialized successfully! + +To start using your cluster, you need to run the following as a regular user: + + mkdir -p $HOME/.kube + sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config + sudo chown $(id -u):$(id -g) $HOME/.kube/config + +You should now deploy a pod network to the cluster. +Run "kubectl apply -f [podnetwork].yaml" with one of the options listed at: + https://kubernetes.io/docs/concepts/cluster-administration/addons/ + +Then you can join any number of worker nodes by running the following on each as root: + +kubeadm join 192.168.2.114:6443 --token zqqoy7.9oi8dpkfmqkop2p5 \ + --discovery-token-ca-cert-hash sha256:71270ea137214422221319c1bdb9ba6d4b76abfa2506753703ed654a90c4982b +``` + +注意两点:第一,Kubernetes 的 `kubectl` 连接信息已经写入到 `/etc/kubernetes/admin.conf`。这个 kubeconfig 文件可以复制到用户的 `~/.kube/config` 中,可以是主节点上的 root 用户或普通用户,也可以是远程机器。这样你就可以用 `kubectl` 命令来控制你的集群。 + +其次,输出中以 `kubernetes join` 开头的最后一行是你可以运行的命令,你可以运行这些命令加入更多的节点到集群中。 + +将新的 kubeconfig 复制到你的用户可以使用的地方后,你可以用 `kubectl get nodes` 命令来验证控制平面是否已经安装: + +``` +# 显示 Kubernetes 集群中的节点 +# 你的节点名称会有所不同 +$ kubectl get nodes +NAME         STATUS   ROLES    AGE     VERSION +elderberry   Ready    master   7m32s   v1.18.2 +``` + +#### 安装 CNI 加载项 + +CNI 加载项负责 Pod 网络的配置和清理。如前所述,这个练习使用的是 Flannel CNI 加载项,在已经设置好 `podCIDR` 值的情况下,你只需下载 Flannel YAML 并使用 `kubectl apply` 将其安装到集群中。这可以用 `kubectl apply -f -` 从标准输入中获取数据,用一行命令完成。这将创建管理 Pod 网络所需的 ClusterRoles、ServiceAccounts 和 DaemonSets 等。 + +下载并应用 Flannel YAML 数据到集群中: + +``` +# 下载 Flannel YAML 数据并应用它 +# (输出略) +$ curl -sSL https://raw.githubusercontent.com/coreos/flannel/v0.12.0/Documentation/kube-flannel.yml | kubectl apply -f - +``` + +#### 将计算节点加入到集群中 + +有了 CNI 加载项,现在是时候将计算节点添加到集群中了。加入计算节点只需运行 `kube init` 命令末尾提供的 `kubeadm join` 命令来初始化控制平面节点。对于你想加入集群的其他树莓派,登录主机,运行命令即可: + +``` +# 加入节点到集群,你的令牌和 ca-cert-hash 应各有不同 +$ sudo kubeadm join 192.168.2.114:6443 --token zqqoy7.9oi8dpkfmqkop2p5 \ +    --discovery-token-ca-cert-hash sha256:71270ea137214422221319c1bdb9ba6d4b76abfa2506753703ed654a90c4982b +``` + +一旦你完成了每个节点的加入,你应该能够在 `kubectl get nodes` 的输出中看到新节点: + +``` +# 显示 Kubernetes 集群中的节点 +# 你的节点名称会有所不同 +$ kubectl get nodes +NAME         STATUS   ROLES    AGE     VERSION +elderberry   Ready    master   7m32s   v1.18.2 +gooseberry    Ready    <none>   2m39s   v1.18.2 +huckleberry   Ready    <none>   17s     v1.18.2 +``` + +#### 验证集群 + +此时,你已经拥有了一个完全正常工作的 Kubernetes 集群。你可以运行 Pod、创建部署和作业等。你可以使用[服务][8]从集群中的任何一个节点访问集群中运行的应用程序。你可以通过 NodePort 服务或入口控制器实现外部访问。 + +要验证集群正在运行,请创建一个新的命名空间、部署和服务,并检查在部署中运行的 Pod 是否按预期响应。此部署使用 `quay.io/clcollins/kube-verify:01` 镜像,这是一个监听请求的 Nginx 容器(实际上,与文章《[使用 Cloud-init 将节点添加到你的私有云][9]》中使用的镜像相同)。你可以在[这里][10]查看镜像的容器文件。 + +为部署创建一个名为 `kube-verify` 的命名空间: + +``` +# 创建一个新的命名空间 +$ kubectl create namespace kube-verify +# 列出命名空间 +$ kubectl get namespaces +NAME              STATUS   AGE +default           Active   63m +kube-node-lease   Active   63m +kube-public       Active   63m +kube-system       Active   63m +kube-verify       Active   19s +``` + +现在,在新的命名空间创建一个部署: + +``` +# 创建一个新的部署 +$ cat < + + + +``` + +成功了!你的服务正在运行,容器内的 Nginx 正在响应你的请求。你的服务正在运行,容器内的 Nginx 正在响应你的请求。 + +此时,你的树莓派上有一个正在运行的 Kubernetes 集群,安装了一个 CNI 加载项(Flannel),并有一个运行 Nginx Web 服务器的测试部署和服务。在大型公有云中,Kubernetes 有不同的入口控制器来与不同的解决方案交互,比如最近报道的 [Skipper][12] 项目。同样,私有云也有与硬件负载均衡器设备(如 F5 Networks 的负载均衡器)交互的入口控制器,或用于处理进入节点的流量的 Nginx 和 HAProxy 控制器。 + +在以后的文章中,我将通过安装自己的入口控制器来解决将集群中的服务暴露给外界的问题。我还将研究动态存储供应器和 StorageClasses,以便为应用程序分配持久性存储,包括利用你在上一篇文章《[将树莓派家庭实验室变成网络文件系统][13]》中设置的 NFS 服务器来为你的 Pod 创建按需存储。 + +### 去吧,Kubernetes + +“Kubernetes”(κυβερνήτης)在希腊语中是飞行员的意思 —— 但这是否意味着驾驶船只以及引导船只的人?诶,不是。“Kubernan”(κυβερνάω)是希腊语“驾驶”或“引导”的意思,因此,去吧,Kubernan,如果你在会议上或其它什么活动上看到我,请试着给我一个动词或名词的通行证,以另一种语言 —— 我不会说的语言。 + +免责声明:如前所述,我不会读也不会讲希腊语,尤其是古希腊语,所以我选择相信我在网上读到的东西。你知道那是怎么一回事。我对此有所保留,放过我吧,因为我没有开“对我来说都是希腊语”这种玩笑。然而,只是提一下,虽然我可以开玩笑,但是实际上没有,所以我要么偷偷摸摸,要么聪明,要么两者兼而有之。或者,两者都不是。我并没有说这是个好笑话。 + +所以,去吧,像专业人员一样在你的家庭私有云中用自己的 Kubernetes 容器服务来试运行你的容器吧!当你越来越得心应手时,你可以修改你的 Kubernetes 集群,尝试不同的选项,比如前面提到的入口控制器和用于持久卷的动态 StorageClasses。 + +这种持续学习是 [DevOps][14] 的核心,持续集成和新服务交付反映了敏捷方法论,当我们学会了处理云实现的大规模扩容,并发现我们的传统做法无法跟上步伐时,我们就接受了这两种方法论。 + +你看,技术、策略、哲学、一小段希腊语和一个可怕的原始笑话,都汇聚在一篇文章当中。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/6/kubernetes-raspberry-pi + +作者:[Chris Collins][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/clcollins +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/raspberrypi_cartoon.png?itok=m3TcBONJ (Cartoon graphic of Raspberry Pi board) +[2]: https://opensource.com/resources/what-is-kubernetes +[3]: https://kubernetes.io/docs/concepts/scheduling-eviction/taint-and-toleration/ +[4]: https://linux.cn/article-12277-1.html +[5]: https://en.wikipedia.org/wiki/Cgroups +[6]: https://en.wikipedia.org/wiki/Classless_Inter-Domain_Routing +[7]: https://github.com/coreos/flannel +[8]: https://kubernetes.io/docs/concepts/services-networking/service/ +[9]: https://linux.cn/article-12407-1.html +[10]: https://github.com/clcollins/homelabCloudInit/blob/master/simpleCloudInitService/data/Containerfile +[11]: http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd" +[12]: https://opensource.com/article/20/4/http-kubernetes-skipper +[13]: https://linux.cn/article-12413-1.html +[14]: https://opensource.com/tags/devops diff --git a/published/202007/20200608 How to Create Curve Text in GIMP in 5 Simple Steps -GIMP Beginner-s Tutorial.md b/published/202007/20200608 How to Create Curve Text in GIMP in 5 Simple Steps -GIMP Beginner-s Tutorial.md new file mode 100644 index 0000000000..3a6c0a44d4 --- /dev/null +++ b/published/202007/20200608 How to Create Curve Text in GIMP in 5 Simple Steps -GIMP Beginner-s Tutorial.md @@ -0,0 +1,114 @@ +[#]: collector: (lujun9972) +[#]: translator: (robsean) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12396-1.html) +[#]: subject: (How to Create Curve Text in GIMP in 5 Simple Steps [GIMP Beginner’s Tutorial]) +[#]: via: (https://itsfoss.com/curve-text-gimp/) +[#]: author: (Dimitrios Savvopoulos https://itsfoss.com/author/dimitrios/) + +GIMP 教程:如何在 GIMP 中创建曲线文本 +====== + +当你在 GIMP 中制作一个徽章、海报或其它任何作品时,你需要扭曲或弯曲一些文本。多功能的 [GIMP][1] 工具提供了一些创建弯曲文本的方法。取决于你将如何使用它和你想给予文本的弧度,有一些适合不同情况的方法。 + +在本篇教程中,我将向你展示我最喜欢的创建曲线文本的方法。 + +### 如何在 GIMP 中创建曲线文本 + +![][2] + +请确保你已经在你的系统上安装了 GIMP。 + +#### 步骤 1: 创建一个你想要的匹配曲线的路径 + +创建一个新的图像或打开一个现有的图像。选择 “工具 -> 路径”,然后大致考虑曲线文本的位置,通过分别单击路径点的开始点和结束点来创建路径。 + +![创建一个路径][3] + +**然后给你的路径一个曲率。**首先向上或向下拖动中间的直线,然后通过移动调整点进行微调。这将给予它一个拱形结构。 + +![弯曲路径][4] + +#### 步骤 2: 创建你想弯曲的文本 + +当你对自己的曲线路径满意时,你可以移动到接下来的步骤,并 **创建你的文本**。 + +你可能想更改字体及其大小。我的选择只是为了演示用途。 + +![创建一个文本][5] + +#### 步骤 3: 创建一个新的图层 + +我强烈建议分割 GIMP 图像中的每个不同的元素到不同的图层中,以便很容易地控制它们,像移动,打开/关闭一个元素等等。 + +遵循这一规则,我们要弯曲的文本将被放置到一个新的图层中。建议使用像 “Curved Text” 一样的名字来命名你的新的图层,或者一些类似的东西来很容易地识别它。 + +![为弯曲的文本创建一个新的图层][6] + +#### 步骤 4: 弯曲文本 + +现在你需要在你的文本图层上单击,接下来在其上右击,并单击“文字对齐路径”来折弯你的文本。弯曲的文本将被放置到新创建的图层。 + +![文字对齐路径][7] + +你把文本弯曲了!让我们使用颜色填充文本来使其更令人满意。 + +### 步骤 5: 最后的修饰和导出 + +单击弯曲的文本图层,然后转到路径选项卡来选择文本边界。 + +![路径选择][8] + +最后,选择油漆桶工具,选择一种颜色,并如下应用你的选择区。 + +![][9] + +随着最后一步的到来,打开不需要的层的可见性,只保留曲线文本。接下来,需要导出你的文件为你喜欢的图像格式。 + +![][10] + +#### 额外提示:创建阴影效果 + +我还有一个作为一次挑战的额外的步骤,如果你想更进一步的话。让我们在 [GIMP 中勾勒文本][11]以创建一个弯曲文本的阴影效果。 + +我将给予你一些提示: + + * 重新启用所有图层 + * 单击弯曲文本图层,并使用移动工具来到处移动文本 + * 创建另一个图层,并使用黑色来重复油漆桶填充程序 + * 以一种模拟一种阴影位置的方式覆盖图层(你可能需要更改图层顺序) + * 关闭辅助图层 + +最终结果: + +![][12] + +让我在评论区知道你们对这篇 GIMP 教程的想法,以及有多少人尝试了这一额外的步骤。 + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/curve-text-gimp/ + +作者:[Dimitrios Savvopoulos][a] +选题:[lujun9972][b] +译者:[robsean](https://github.com/robsean) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://itsfoss.com/author/dimitrios/ +[b]: https://github.com/lujun9972 +[1]: https://www.gimp.org/ +[2]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/05/Curve-text-in-GIMP.jpg?ssl=1 +[3]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/05/1image-1.png?fit=800%2C508&ssl=1 +[4]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/05/2.png?fit=800%2C500&ssl=1 +[5]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/05/3.png?fit=800%2C503&ssl=1 +[6]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/05/new-layer.png?fit=800%2C637&ssl=1 +[7]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/05/text-along-path.png?fit=800%2C625&ssl=1 +[8]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/05/path-to-selection.png?ssl=1 +[9]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/05/6.png?fit=800%2C539&ssl=1 +[10]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/05/4.png-copy.png?ssl=1 +[11]: https://itsfoss.com/gimp-text-outline/ +[12]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/05/its-foss-curved.jpg?fit=800%2C409&ssl=1 +[13]: https://itsfoss.com/subscribe-to-newsletter/ diff --git a/published/202007/20200611 Stop debugging Go with Println and use Delve instead.md b/published/202007/20200611 Stop debugging Go with Println and use Delve instead.md new file mode 100644 index 0000000000..ed93db45b4 --- /dev/null +++ b/published/202007/20200611 Stop debugging Go with Println and use Delve instead.md @@ -0,0 +1,552 @@ +[#]: collector: (lujun9972) +[#]: translator: (lxbwolf) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12400-1.html) +[#]: subject: (Stop debugging Go with Println and use Delve instead) +[#]: via: (https://opensource.com/article/20/6/debug-go-delve) +[#]: author: (Gaurav Kamathe https://opensource.com/users/gkamathe) + +使用 Delve 代替 Println 来调试 Go 程序 +====== + +> Delve 是能让调试变成轻而易举的事的万能工具包。 + +![](https://img.linux.net.cn/data/attachment/album/202007/09/234357pavw88sbxab0makj.jpg) + +你上次尝试去学习一种新的编程语言时什么时候?你有没有持之以恒,你是那些在新事物发布的第一时间就勇敢地去尝试的一员吗?不管怎样,学习一种新的语言也许非常有用,也会有很多乐趣。 + +你尝试着写简单的 “Hello, world!”,然后写一些示例代码并执行,继续做一些小的修改,之后继续前进。我敢保证我们都有过这个经历,不论我们使用哪种技术。假如你尝试用一段时间一种语言,并且你希望能够精通它,那么有一些事物能在你的进取之路上帮助你。 + +其中之一就是调试器。有些人喜欢在代码中用简单的 “print” 语句进行调试,这种方式很适合代码量少的简单程序;然而,如果你处理的是有多个开发者和几千行代码的大型项目,你应该使用调试器。 + +最近我开始学习 Go 编程语言了,在本文中,我们将探讨一种名为 Delve 的调试器。Delve 是专门用来调试 Go 程序的工具,我们会借助一些 Go 示例代码来了解下它的一些功能。不要担心这里展示的 Go 示例代码;即使你之前没有写过 Go 代码也能看懂。Go 的目标之一是简单,因此代码是始终如一的,理解和解释起来都很容易。 + +### Delve 介绍 + +Delve 是托管在 [GitHub][2] 上的一个开源项目。 + +它自己的文档中写道: + +> Delve 是 Go 编程语言的调试器。该项目的目标是为 Go 提供一个简单、全功能的调试工具。Delve 应该是易于调用和易于使用的。当你使用调试器时,事情可能不会按你的思路运行。如果你这样想,那么你不适合用 Delve。 + +让我们来近距离看一下。 + +我的测试系统是运行着 Fedora Linux 的笔记本电脑,Go 编译器版本如下: + +``` +$ cat /etc/fedora-release +Fedora release 30 (Thirty) +$ +$ go version +go version go1.12.17 linux/amd64 +$ +``` + +### Golang 安装 + +如果你没有安装 Go,你可以运行下面的命令,很轻松地就可以从配置的仓库中获取。 + +``` +$ dnf install golang.x86_64 +``` + +或者,你可以在[安装页面][3]找到适合你的操作系统的其他安装版本。 + +在开始之前,请先确认已经设置好了 Go 工具依赖的下列各个路径。如果这些路径没有设置,有些示例可能不能正常运行。你可以在 SHELL 的 RC 文件中轻松设置这些环境变量,我的机器上是在 `$HOME/bashrc` 文件中设置的。 + +``` +$ go env | grep GOPATH +GOPATH="/home/user/go" +$ +$ go env | grep GOBIN +GOBIN="/home/user/go/gobin" +$ +``` + +### Delve 安装 + +你可以像下面那样,通过运行一个简单的 `go get` 命令来安装 Delve。`go get` 是 Golang 从外部源下载和安装需要的包的方式。如果你安装过程中遇到了问题,可以查看 [Delve 安装教程][4]。 + +``` +$ go get -u github.com/go-delve/delve/cmd/dlv +$ +``` + +运行上面的命令,就会把 Delve 下载到你的 `$GOPATH` 的位置,如果你没有把 `$GOPATH` 设置成其他值,那么默认情况下 `$GOPATH` 和 `$HOME/go` 是同一个路径。 + +你可以进入 `go/` 目录,你可以在 `bin/` 目录下看到 `dlv`。 + +``` +$ ls -l $HOME/go +total 8 +drwxrwxr-x. 2 user user 4096 May 25 19:11 bin +drwxrwxr-x. 4 user user 4096 May 25 19:21 src +$ +$ ls -l ~/go/bin/ +total 19596 +-rwxrwxr-x. 1 user user 20062654 May 25 19:17 dlv +$ +``` + +因为你把 Delve 安装到了 `$GOPATH`,所以你可以像运行普通的 shell 命令一样运行它,即每次运行时你不必先进入它所在的目录。你可以通过 `version` 选项来验证 `dlv` 是否正确安装。示例中安装的版本是 1.4.1。 + +``` +$ which dlv +~/go/bin/dlv +$ +$ dlv version +Delve Debugger +Version: 1.4.1 +Build: $Id: bda606147ff48b58bde39e20b9e11378eaa4db46 $ +$ +``` + +现在,我们一起在 Go 程序中使用 Delve 来理解下它的功能以及如何使用它们。我们先来写一个 `hello.go`,简单地打印一条 `Hello, world!` 信息。 + +记着,我把这些示例程序放到了 `$GOBIN` 目录下。 + +``` +$ pwd +/home/user/go/gobin +$ +$ cat hello.go +package main + +import "fmt" + +func main() { +        fmt.Println("Hello, world!") +} +$ +``` + +运行 `build` 命令来编译一个 Go 程序,它的输入是 `.go` 后缀的文件。如果程序没有语法错误,Go 编译器把它编译成一个二进制可执行文件。这个文件可以被直接运行,运行后我们会在屏幕上看到 `Hello, world!` 信息。 + +``` +$ go build hello.go +$ +$ ls -l hello +-rwxrwxr-x. 1 user user 1997284 May 26 12:13 hello +$ +$ ./hello +Hello, world! +$ +``` + +### 在 Delve 中加载程序 + +把一个程序加载进 Delve 调试器有两种方式。 + +#### 在源码编译成二进制文件之前使用 debug 参数 + +第一种方式是在需要时对源码使用 `debug` 命令。Delve 会为你编译出一个名为 `__debug_bin` 的二进制文件,并把它加载进调试器。 + +在这个例子中,你可以进入 `hello.go` 所在的目录,然后运行 `dlv debug` 命令。如果目录中有多个源文件且每个文件都有自己的主函数,Delve 则可能抛出错误,它期望的是单个程序或从单个项目构建成单个二进制文件。如果出现了这种错误,那么你就应该用下面展示的第二种方式。 + +``` +$ ls -l +total 4 +-rw-rw-r--. 1 user user 74 Jun  4 11:48 hello.go +$ +$ dlv debug +Type 'help' for list of commands. +(dlv) +``` + +现在打开另一个终端,列出目录下的文件。你可以看到一个多出来的 `__debug_bin` 二进制文件,这个文件是由源码编译生成的,并会加载进调试器。你现在可以回到 `dlv` 提示框继续使用 Delve。 + +``` +$ ls -l +total 2036 +-rwxrwxr-x. 1 user user 2077085 Jun  4 11:48 __debug_bin +-rw-rw-r--. 1 user user      74 Jun  4 11:48 hello.go +$ +``` + +#### 使用 exec 参数 + +如果你已经有提前编译好的 Go 程序或者已经用 `go build` 命令编译完成了,不想再用 Delve 编译出 `__debug_bin` 二进制文件,那么第二种把程序加载进 Delve 的方法在这些情况下会很有用。在上述情况下,你可以使用 `exec` 命令来把整个目录加载进 Delve 调试器。 + +``` +$ ls -l +total 4 +-rw-rw-r--. 1 user user 74 Jun  4 11:48 hello.go +$ +$ go build hello.go +$ +$ ls -l +total 1956 +-rwxrwxr-x. 1 user user 1997284 Jun  4 11:54 hello +-rw-rw-r--. 1 user user      74 Jun  4 11:48 hello.go +$ +$ dlv exec ./hello +Type 'help' for list of commands. +(dlv) +``` + +### 查看 delve 帮助信息 + +在 `dlv` 提示符中,你可以运行 `help` 来查看 Delve 提供的多种帮助选项。命令列表相当长,这里我们只列举一些重要的功能。下面是 Delve 的功能概览。 + +``` +(dlv) help +The following commands are available: + +Running the program: + +Manipulating breakpoints: + +Viewing program variables and memory: + +Listing and switching between threads and goroutines: + +Viewing the call stack and selecting frames: + +Other commands: + +Type help followed by a command for full documentation. +(dlv) +``` + +#### 设置断点 + +现在我们已经把 hello.go 程序加载进了 Delve 调试器,我们在主函数处设置断点,稍后来确认它。在 Go 中,主程序从 `main.main` 处开始执行,因此你需要给这个名字提供个 `break` 命令。之后,我们可以用 `breakpoints` 命令来检查断点是否正确设置了。 + +不要忘了你还可以用命令简写,因此你可以用 `b main.main` 来代替 `break main.main`,两者效果相同,`bp` 和 `breakpoints` 同理。你可以通过运行 `help` 命令查看帮助信息来找到你想要的命令简写。 + +``` +(dlv) break main.main +Breakpoint 1 set at 0x4a228f for main.main() ./hello.go:5 +(dlv) breakpoints +Breakpoint runtime-fatal-throw at 0x42c410 for runtime.fatalthrow() /usr/lib/golang/src/runtime/panic.go:663 (0) +Breakpoint unrecovered-panic at 0x42c480 for runtime.fatalpanic() /usr/lib/golang/src/runtime/panic.go:690 (0) +        print runtime.curg._panic.arg +Breakpoint 1 at 0x4a228f for main.main() ./hello.go:5 (0) +(dlv) +``` + +#### 程序继续执行 + +现在,我们用 `continue` 来继续运行程序。它会运行到断点处中止,在我们的例子中,会运行到主函数的 `main.main` 处中止。从这里开始,我们可以用 `next` 命令来逐行执行程序。请注意,当我们运行到 `fmt.Println("Hello, world!")` 处时,即使我们还在调试器里,我们也能看到打印到屏幕的 `Hello, world!`。 + +``` +(dlv) continue +> main.main() ./hello.go:5 (hits goroutine(1):1 total:1) (PC: 0x4a228f) +     1: package main +     2: +     3: import "fmt" +     4: +=>   5:      func main() { +     6:         fmt.Println("Hello, world!") +     7: } +(dlv) next +> main.main() ./hello.go:6 (PC: 0x4a229d) +     1: package main +     2: +     3: import "fmt" +     4: +     5: func main() { +=>   6:              fmt.Println("Hello, world!") +     7: } +(dlv) next +Hello, world! +> main.main() ./hello.go:7 (PC: 0x4a22ff) +     2: +     3: import "fmt" +     4: +     5: func main() { +     6:         fmt.Println("Hello, world!") +=>   7:      } +(dlv) +``` + +#### 退出 Delve + +你随时可以运行 `quit` 命令来退出调试器,退出之后你会回到 shell 提示符。相当简单,对吗? + +``` +(dlv) quit +$ +``` + +### Delve 的其他功能 + +我们用其他的 Go 程序来探索下 Delve 的其他功能。这次,我们从 [golang 教程][5] 中找了一个程序。如果你要学习 Go 语言,那么 Golang 教程应该是你的第一站。 + +下面的程序,`functions.go` 中简单展示了 Go 程序中是怎样定义和调用函数的。这里,我们有一个简单的把两数相加并返回和值的 `add()` 函数。你可以像下面那样构建程序并运行它。 + +``` +$ cat functions.go +package main + +import "fmt" + +func add(x int, y int) int { +        return x + y +} + +func main() { +        fmt.Println(add(42, 13)) +} +$ +``` + +你可以像下面那样构建和运行程序。 + +``` +$ go build functions.go  && ./functions +55 +$ +``` + +#### 进入函数 + +跟前面展示的一样,我们用前面提到的一个选项来把二进制文件加载进 Delve 调试器,再一次在 `main.main` 处设置断点,继续运行程序直到断点处。然后执行 `next` 直到 `fmt.Println(add(42, 13))` 处;这里我们调用了 `add()` 函数。我们可以像下面展示的那样,用 Delve 的 `step` 命令从 `main` 函数进入 `add()` 函数。 + +``` +$ dlv debug +Type 'help' for list of commands. +(dlv) break main.main +Breakpoint 1 set at 0x4a22b3 for main.main() ./functions.go:9 +(dlv) c +> main.main() ./functions.go:9 (hits goroutine(1):1 total:1) (PC: 0x4a22b3) +     4: +     5: func add(x int, y int) int { +     6:         return x + y +     7: } +     8: +=>   9:      func main() { +    10:         fmt.Println(add(42, 13)) +    11: } +(dlv) next +> main.main() ./functions.go:10 (PC: 0x4a22c1) +     5: func add(x int, y int) int { +     6:         return x + y +     7: } +     8: +     9: func main() { +=>  10:              fmt.Println(add(42, 13)) +    11: } +(dlv) step +> main.add() ./functions.go:5 (PC: 0x4a2280) +     1: package main +     2: +     3: import "fmt" +     4: +=>   5:      func add(x int, y int) int { +     6:         return x + y +     7: } +     8: +     9: func main() { +    10:         fmt.Println(add(42, 13)) +(dlv) +``` + +#### 使用`文件名:行号`来设置断点 + +上面的例子中,我们经过 `main` 函数进入了 `add()` 函数,但是你也可以在你想加断点的地方直接使用“文件名:行号”的组合。下面是在 `add()` 函数开始处加断点的另一种方式。 + +``` +(dlv) break functions.go:5 +Breakpoint 1 set at 0x4a2280 for main.add() ./functions.go:5 +(dlv) continue +> main.add() ./functions.go:5 (hits goroutine(1):1 total:1) (PC: 0x4a2280) +     1: package main +     2: +     3: import "fmt" +     4: +=>   5:      func add(x int, y int) int { +     6:         return x + y +     7: } +     8: +     9: func main() { +    10:         fmt.Println(add(42, 13)) +(dlv) +``` + +#### 查看当前的栈信息 + +现在我们运行到了 `add()` 函数,我们可以在 Delve 中用 `stack` 命令查看当前栈的内容。这里在 `0` 位置展示了栈顶的函数 `add()` ,紧接着在 `1` 位置展示了调用 `add()` 函数的 `main.main`。在 `main.main` 下面的函数属于 Go 运行时,是用来处理加载和执行该程序的。 + +``` +(dlv) stack +0  0x00000000004a2280 in main.add +   at ./functions.go:5 +1  0x00000000004a22d7 in main.main +   at ./functions.go:10 +2  0x000000000042dd1f in runtime.main +   at /usr/lib/golang/src/runtime/proc.go:200 +3  0x0000000000458171 in runtime.goexit +   at /usr/lib/golang/src/runtime/asm_amd64.s:1337 +(dlv) +``` + +#### 在帧之间跳转 + +在 Delve 中我们可以用 `frame` 命令实现帧之间的跳转。在下面的例子中,我们用 `frame` 实现了从 `add()` 帧跳到 `main.main` 帧,以此类推。 + +``` +(dlv) frame 0 +> main.add() ./functions.go:5 (hits goroutine(1):1 total:1) (PC: 0x4a2280) +Frame 0: ./functions.go:5 (PC: 4a2280) +     1: package main +     2: +     3: import "fmt" +     4: +=>   5:      func add(x int, y int) int { +     6:         return x + y +     7: } +     8: +     9: func main() { +    10:         fmt.Println(add(42, 13)) +(dlv) frame 1 +> main.add() ./functions.go:5 (hits goroutine(1):1 total:1) (PC: 0x4a2280) +Frame 1: ./functions.go:10 (PC: 4a22d7) +     5: func add(x int, y int) int { +     6:         return x + y +     7: } +     8: +     9: func main() { +=>  10:              fmt.Println(add(42, 13)) +    11: } +(dlv) +``` + +#### 打印函数参数 + +一个函数通常会接收多个参数。在 `add()` 函数中,它的入参是两个整型。Delve 有个便捷的 `args` 命令,它能打印出命令行传给函数的参数。 + +``` +(dlv) args +x = 42 +y = 13 +~r2 = 824633786832 +(dlv) +``` + +#### 查看反汇编码 + +由于我们是调试编译出的二进制文件,因此如果我们能查看编译器生成的汇编语言指令将会非常有用。Delve 提供了一个 `disassemble` 命令来查看这些指令。在下面的例子中,我们用它来查看 `add()` 函数的汇编指令。 + +``` +(dlv) step +> main.add() ./functions.go:5 (PC: 0x4a2280) +     1: package main +     2: +     3: import "fmt" +     4: +=>   5:      func add(x int, y int) int { +     6:         return x + y +     7: } +     8: +     9: func main() { +    10:         fmt.Println(add(42, 13)) +(dlv) disassemble +TEXT main.add(SB) /home/user/go/gobin/functions.go +=>   functions.go:5  0x4a2280   48c744241800000000   mov qword ptr [rsp+0x18], 0x0 +        functions.go:6  0x4a2289   488b442408           mov rax, qword ptr [rsp+0x8] +        functions.go:6  0x4a228e   4803442410           add rax, qword ptr [rsp+0x10] +        functions.go:6  0x4a2293   4889442418           mov qword ptr [rsp+0x18], rax +        functions.go:6  0x4a2298   c3                   ret +(dlv) +``` + +#### 单步退出函数 + +另一个功能是 `stepout`,这个功能可以让我们跳回到函数被调用的地方。在我们的例子中,如果我们想回到 `main.main` 函数,我们只需要简单地运行 `stepout` 命令,它就会把我们带回去。在我们调试大型代码库时,这个功能会是一个非常便捷的工具。 + +``` +(dlv) stepout +> main.main() ./functions.go:10 (PC: 0x4a22d7) +Values returned: +        ~r2: 55 + +     5: func add(x int, y int) int { +     6:         return x + y +     7: } +     8: +     9: func main() { +=>  10:              fmt.Println(add(42, 13)) +    11: } +(dlv) +``` + +#### 打印变量信息 + +我们一起通过 [Go 教程][6] 的另一个示例程序来看下 Delve 是怎么处理 Go 中的变量的。下面的示例程序定义和初始化了一些不同类型的变量。你可以构建和运行程序。 + +``` +$ cat variables.go +package main + +import "fmt" + +var i, j int = 1, 2 + +func main() { +        var c, python, java = true, false, "no!" +        fmt.Println(i, j, c, python, java) +} +$ + +$ go build variables.go &&; ./variables +1 2 true false no! +$ +``` + +像前面说过的那样,用 `delve debug` 在调试器中加载程序。你可以在 Delve 中用 `print` 命令通过变量名来展示他们当前的值。 + +``` +(dlv) print c +true +(dlv) print java +"no!" +(dlv) +``` + +或者,你还可以用 `locals` 命令来打印函数内所有的局部变量。 + +``` +(dlv) locals +python = false +c = true +java = "no!" +(dlv) +``` + +如果你不知道变量的类型,你可以用 `whatis` 命令来通过变量名来打印它的类型。 + +``` +(dlv) whatis python +bool +(dlv) whatis c +bool +(dlv) whatis java +string +(dlv) +``` + +### 总结 + +现在我们只是了解了 Delve 所有功能的皮毛。你可以自己去查看帮助内容,尝试下其它的命令。你还可以把 Delve 绑定到运行中的 Go 程序上(守护进程!),如果你安装了 Go 源码库,你甚至可以用 Delve 导出 Golang 库内部的信息。勇敢去探索吧! + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/6/debug-go-delve + +作者:[Gaurav Kamathe][a] +选题:[lujun9972][b] +译者:[lxbwolf](https://github.com/lxbwolf) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/gkamathe +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/bug_software_issue_tracking_computer_screen.jpg?itok=6qfIHR5y (Bug tracking magnifying glass on computer screen) +[2]: https://github.com/go-delve/delve +[3]: https://golang.org/doc/install +[4]: https://github.com/go-delve/delve/blob/master/Documentation/installation/linux/install.md +[5]: https://tour.golang.org/basics/4 +[6]: https://tour.golang.org/basics/9 diff --git a/published/202007/20200616 How to know if you-re ready to switch from Mac to Linux.md b/published/202007/20200616 How to know if you-re ready to switch from Mac to Linux.md new file mode 100644 index 0000000000..271caf1707 --- /dev/null +++ b/published/202007/20200616 How to know if you-re ready to switch from Mac to Linux.md @@ -0,0 +1,141 @@ +[#]: collector: (lujun9972) +[#]: translator: (nophDog) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12375-1.html) +[#]: subject: (How to know if you're ready to switch from Mac to Linux) +[#]: via: (https://opensource.com/article/20/6/mac-to-linux) +[#]: author: (Marko Saric https://opensource.com/users/markosaric) + +你是否已经准备好从 Mac 切换到 Linux 了? +====== + +> 你几乎可以在 Linux 上做任何你在 Mac 上可以做的事情 —— 这是你拥有一个开源操作系统的自由。 + +![](https://img.linux.net.cn/data/attachment/album/202007/02/222534g8bdabsllplnzl6c.jpg) + +我[从 Mac 转到 Linux][2] 已经两年了。在使用 Linux 之前,我用的 Apple 的系统用了 15 年,而当我在 2018 年安装第一个 Linux 发行版时,还只是一个纯粹的新手。 + +这些日子以来,我只用 Linux,我可以用它完成任何任务。浏览网页、观看 Netflix 影片、写作以及编辑我的 Wordpress [博客][3],甚至还在上面跑我的[开源网页分析项目][4]。 + +我甚至还不是一个开发者!Linux 被认为不适合日常使用,对非技术人员也不够友好的日子已经一去不返了。 + +最近有很多关于 Mac 的讨论,越来越多的人已经在考虑转到 Linux。我打算分享我的切换过程中的一些经验,帮助其它新手也能从容转移。 + +### 你该不该换? + +在换系统之前,最好想清楚,因为有时候 Linux 可能跟你预期不一样。如果你仍希望跟 Apple Watch 无缝配对、可以用 FaceTime 给朋友打电话、或者你想打开 iMovie 看视频,那最好还是不要换了。这些都是 Apple 的专有产品,你只能在 Apple 的“围墙花园”里面使用。如果离不开 Apple 的生态系统,那么 Linux 可能不太适合你。 + +我对 Apple 生态没有太多挂念,我不用 iPhone,所以跟手机的协作没那么必要。我也不用 iCloud、FaceTime,当然也包括 Siri。我早就对开源充满兴趣,只是一直没有行动。 + +### 检查你的必备软件清单 + +我还在使用 Mac 的时候,就已经开始探索开源软件,我发现大部分在 Mac 上使用的软件,在 Linux 也可以运行。 + +很熟悉用火狐浏览网页吗?在 Linux 上它也可以运行。想用 VLC 看视频?它也有 Linux 版本。喜欢用 Audacity 录制、编辑音频?它正在 Linux 上等着你呢。你用 OBS Studio 直播?在 Linux 直接下载安装吧。一直用 Telegram 跟朋友和家人保持联系吗?Linux 上当然少不了它。 + +此外,Linux 不仅仅意味着开源软件。你最喜欢的大部分(也可能是所有)非 Apple 专有软件,都能在 Linux 见到它们的身影。Spotify、Slack、Zoom、Stream、Discord、Skype、Chrome 以及很多闭源软件,都可以使用。而且,在你 Mac 浏览器里面运行的任何东西,同样能够运行在 Linux 浏览器。 + +你能在 Linux 找到你的必备软件,或者更好的替代品吗?请再三确认,做到有备无患。用你最常用的搜索引擎,在网上检索一下。搜索“软件名 + Linux” 或者“软件名 + Linux 替代品”,然后再去 [Flathub][5] 网站查看你能在 Linux 用 Flatpak 安装的专有软件有哪些。 + +### 请牢记:Linux 不等于 Mac + +如果你希望能够从 Mac 轻松转移到 Linux,我相信有一点很重要,你需要保持包容的思想以及愿意学习新操作系统的心态。Linux 并不等于 Mac,所以你需要给自己一些时间去接触并了解它。 + +如果你想让 Linux 用起来、看起来跟你习惯的 macOS 一模一样,那么 Linux 可能也不适合你。尽管你可以通过各种方法[把 Linux 桌面环境打造得跟 macOS 相似][14],但我觉得要想成功转移到 Linux,最好的办法是从拥抱 Linux 开始。 + +试试新的工作流,该怎么用就怎么用。不要总想着把 Linux 变成其它东西。你会跟我一样,像享受 Mac 一样享受 Linux,甚至能有更好的体验感。 + +还记得你第一次使用 Mac 吧:你肯定花了不少时间去习惯它的用法。那么请给 Linux 同样多的时间和关怀。 + +### 选择一个 Linux 发行版 + +有别于 Windows 和 macOS,Linux 不止一个单一的操作系统。不同的 Linux 操作系统被称作发行版,开始使用 Linux 之后,我尝试过好几个不同的发行版。我也用过不同的桌面环境,或者图形界面。在美观度、易用性、工作流以及集成软件上,它们有很大差异。 + +尽管作为 Mac 的替代品,被提及最多的是 [ElementaryOS][6] 和 [Pop!_OS][7],但我仍建议从 [Fedora 工作站][8] 开始,理由如下: + +- 使用 [Fedora 介质写入器][9],容易安装 +- 几乎可以支持你所有的硬件,开箱即用 +- 支持最新的 Linux 软件 +- 运行原生无改动的 GNOME 桌面环境 +- 有一个大型开发团队以及一个庞大的社区在背后支持 + +在我看来,对从 macOS 过来的新手来说,[GNOME][10] 是易用性、一致性、流畅性和用户体验最好的桌面环境。它拥有 Linux 世界中最多的开发资源和用户基数,所以你的使用体验会很好。 + +Fedora 可以为你打开一扇 Linux 的大门,当你适应之后,就可以开始进一步探索各个发行版、桌面环境,甚至窗口管理器之类的玩意了。 + +### 熟悉 GNOME + +GNOME 是 Fedora 和许多其它 Linux 发行版的默认窗口管理器。它最近 [升级到 GNOME 3.36][11],带来了 Mac 用户会喜欢的现代设计。 + +一定要做好心理准备,Linux、Fedora 工作站和 GNOME 并不是 Apple 和 macOS。GNOME 非常干净、简约、现代、独创。它不会分散你的注意力,没有桌面图标,没有可见的坞站,窗口上甚至没有最小化和最大化按钮。但是不要慌张,如果你去尝试,它会证明这是你用过最好、最有生产力的操作系统。 + +GNOME 不会给你带来困扰。启动之后,你唯一能看到的东西只有顶栏和背景图片。顶栏由这几样东西组成,“活动”在左边,时间和日期在中间(这也是你的通知中心),右边是网络、蓝牙、VPN、声音、亮度、电池等托盘图标之类的东西。 + +#### 为什么 GNOME 像 Mac + +你会注意到一些跟 macOS 的相似之处,例如窗口吸附、空格预览(用起来跟 “Quick Look” 一模一样)。 + +如果你把鼠标光标移动到左上角,点击顶栏的“活动”,或者按下键盘上超级键(`Super` 键,也就是 Mac 上的 `ஐ` 键),你会看到“活动概览”。它有点像 macOS 系统上“调度中心”和“聚焦搜索”的结合体。它会在屏幕中间展示已打开软件和窗口的概览。在左手边,你可以看到坞站,上面有你打开的软件和常用软件。所有打开的软件下面会有一个指示标志,在右手边,你可以看到不同的工作区。 + +在顶栏中间,有一个搜索框。只要你开始输入,焦点就会转移到搜索框。它能搜索你已经安装的软件和文件内容,可以在软件中心搜索指定的软件、进行计算、向你展示时间或者天气,当然它能做的还有很多。它就像“聚焦”一样。只需开始输入你要搜索的内容,按下回车就可以打开软件或者文件。 + +你也能看到一列安装好的软件(更像 Mac 上的“启动台”),点击坞站中的“显示应用”图标,或者按 `Super + A` 就行。 + +总体来说,Linux 是一个轻量级的系统,即使在很老的硬件上也能跑得很顺畅,跟 macOS 比起来仅仅占用很少的磁盘空间。并且不像 macOS,你可以删除任何你不想要或不需要的预装软件。 + +#### 自定义你的 GNOME 设置 + +浏览一下 GNOME 设置,熟悉它的选项,做一些更改,让它用起来更舒服。下面是一些我装好 GNOME 必做的事情。 + +- 在“鼠标和触摸板”中,我禁用“自然滚动”、启用“轻触点击”。 +- 在“显示”中,我打开“夜光”功能,在晚上,屏幕会让颜色变暖,减少眼睛疲劳。 +- 我也安装了 [GNOME 优化][12],因为它可以更改额外的设置选项。 +- 在“GNOME 优化”中,我启用了 “Over-Amplification” 设置,这样就能获得更高的音量。 +- 在“GNOME 优化”中,相比默认的亮色主题,我更喜欢 “Adwaita Dark” 主题。 + +#### 习惯使用键盘操作 + +GNOME 是以一个极度以键盘为中心的操作系统,所以尽量多使用键盘。在 GNOME 设置中的“键盘快捷键”部分,你可以找到各个快捷键。 + +你也可以根据自己的理想工作流程来设置键盘快捷键。我将我最常用的应用程序设置为使用超级键打开。比如说,`Super + B` 打开我的浏览器,`Super + F` 打开“文件”,`Super + T` 打开终端。我还把 `Ctrl + Q` 设置成关闭窗口。 + +我使用 `Super + Tab` 在打开的应用程序之间切换,`Super + H` 隐藏一个窗口,`F11` 全屏打开软件,`Super + Left` 把窗口吸附到屏幕左边,`Super + Right` 把窗口吸附到屏幕左边,等等。 + +### 在 Mac 上尝试 Linux 之后再做决定 + +在完全安装 Linux 之前,在你的 Mac 上先尝试 Fedora。从 [Fefora 官网][9]下载 ISO 镜像。使用 [Etcher][13] 将 ISO 镜像写入 USB 驱动器,然后在启动时点击 `Option` 键,这样你就可以在即用模式下尝试了。 + +现在您无需在 Mac 上安装任何东西就可以探索 Fedora 工作站了。试试各种东西,能否正常工作:能不能连接 WiFi?触控板是否正常?有没有声音?等等。 + +也记得花时间来尝试 GNOME。测试我上面提到的不同功能。打开一些安装好的软件。如果一切看起来都还不错,如果你喜欢这样的 Fedora 工作站和 GNOME,并且很肯定这就是你想要的,那么把它安装到你的 Mac 吧。 + +尽情探索 Linux 世界吧! + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/6/mac-to-linux + +作者:[Marko Saric][a] +选题:[lujun9972][b] +译者:[nophDog](https://github.com/nophDog) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/markosaric +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/computer_browser_web_desktop.png?itok=Bw8ykZMA (Digital images of a computer desktop) +[2]: https://markosaric.com/linux/ +[3]: https://markosaric.com/how-start-blog/ +[4]: https://plausible.io/open-source-website-analytics +[5]: https://flathub.org/apps +[6]: https://opensource.com/article/20/2/macbook-linux-elementary +[7]: https://support.system76.com/articles/pop-basics/ +[8]: https://getfedora.org/ +[9]: https://getfedora.org/en/workstation/download/ +[10]: https://www.gnome.org/ +[11]: https://www.gnome.org/news/2020/03/gnome-3-36-released/ +[12]: https://wiki.gnome.org/Apps/Tweaks +[13]: https://www.balena.io/etcher/ +[14]: https://linux.cn/article-12361-1.html \ No newline at end of file diff --git a/published/202007/20200616 How to loop forever in bash on Linux.md b/published/202007/20200616 How to loop forever in bash on Linux.md new file mode 100644 index 0000000000..756836f72f --- /dev/null +++ b/published/202007/20200616 How to loop forever in bash on Linux.md @@ -0,0 +1,143 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12368-1.html) +[#]: subject: (How to loop forever in bash on Linux) +[#]: via: (https://www.networkworld.com/article/3562576/how-to-loop-forever-in-bash-on-linux.html) +[#]: author: (Sandra Henry-Stocker https://www.networkworld.com/author/Sandra-Henry_Stocker/) + +如何在 Linux 的 bash 中永远循环 +====== + +![tine ivanic][1] + +在 Linux 中有很多永远循环(或直到你决定停止)的方法,你可以在命令行或脚本中执行此操作。 + +`for` 和 `while` 命令使这件事非常容易。关于相应的语法和策略,只有几件事要牢记。 + +### 使用 while + +最简单的永远循环之一是使用 `while` 命令,后面跟上条件 `true`。 你不必使用诸如 `while [ 1 -eq 1 ]` 之类的逻辑或类似的测试。 `while true` 测试表示循环将一直运行,直到你使用 `CTRL-C` 停止循环、关闭终端窗口或注销为止。这是一个例子: + +``` +$ while true +> do +> echo Keep running +> sleep 3 +> done +Keep running +Keep running +Keep running +^C +``` + +你也可以使用 `while :` 做同样的事情。这里的关键是 `:` 总是返回成功,因此就像 `while true` 一样,此测试永远不会失败,并且循环会继续运行: + +``` +$ while : +> do +> echo Keep running +> sleep 3 +> done +Keep running +Keep running +^C +``` + +如果你在脚本中插入了无限循环,并想提醒使用它的人如何退出脚本,那么可以使用 `echo` 命令添加提示: + +``` +while : +do + echo Keep running + echo "Press CTRL+C to exit" + sleep 1 +done +``` + +### 使用 for + +`for` 命令还提供了一种永远循环的简便方法。虽然不如 `while true` 明显,但语法相当简单。你只需要在有界循环中替换参数即可,它通常类似于 “c 从等于 1 开始递增,直到 5”: + +``` +$ for (( c=1; c<=5; c++ )) +``` + +不指定任何参数的情况下: + +``` +$ for (( ; ; )) +``` + +没有起始值、增量或退出测试,此循环将永远运行或被强制停止: + +``` +$ for (( ; ; )) +> do +> echo Keep running +> echo “Press CTRL+C to exit” +> sleep 2 +> done +Keep your spirits up +Keep your spirits up +Keep your spirits up +``` + +### 为什么要永远循环? + +在现实中,你不会想永远循环下去,但一直运行直到想要回家、工作完成或者遇到问题才退出并不罕见。任何构造为无限循环的循环都可以设置为根据各种情况退出。 + +该脚本将一直处理数据直到下午 5 点,或者说检查发现第一次超过 5 点的时间: + +``` +#!/bin/bash + +while true +do + if [ `date +%H` -ge 17 ]; then + exit # exit script + fi + echo keep running + ~/bin/process_data # do some work +done +``` + +如果要退出循环而不是退出脚本,请使用 `break` 命令而不是 `exit`。 + +``` +#!/bin/bash + +while true +do + if [ `date +%H` -ge 17 ]; then + break # exit loop + fi + echo keep running + ~/bin/process_data +done +… run other commands here … +``` + +### 总结 + +永远循环很容易。指定要停止循环的条件却需要花费一些额外的精力。 + +-------------------------------------------------------------------------------- + +via: https://www.networkworld.com/article/3562576/how-to-loop-forever-in-bash-on-linux.html + +作者:[Sandra Henry-Stocker][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://www.networkworld.com/author/Sandra-Henry_Stocker/ +[b]: https://github.com/lujun9972 +[1]: https://images.idgesg.net/images/article/2020/06/nw_circular-staircase_loop_infinity_nautilus_by-tine-ivanic-via-unsplash-100848725-large.jpg +[2]: https://creativecommons.org/publicdomain/zero/1.0/ +[3]: https://www.networkworld.com/article/3242170/linux/invaluable-tips-and-tricks-for-troubleshooting-linux.html +[4]: https://www.facebook.com/NetworkWorld/ +[5]: https://www.linkedin.com/company/network-world diff --git a/published/202007/20200617 4 essential tools to set up your Python environment for success.md b/published/202007/20200617 4 essential tools to set up your Python environment for success.md new file mode 100644 index 0000000000..26309e20ba --- /dev/null +++ b/published/202007/20200617 4 essential tools to set up your Python environment for success.md @@ -0,0 +1,104 @@ +[#]: collector: (lujun9972) +[#]: translator: (wxy) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12369-1.html) +[#]: subject: (4 essential tools to set up your Python environment for success) +[#]: via: (https://opensource.com/article/20/6/python-tools) +[#]: author: (Moshe Zadka https://opensource.com/users/moshez) + +建立成功的 Python 环境的 4 个基本工具 +====== + +> 选择的这些工具将简化你的 Python 环境,以实现顺畅和一致的开发实践。 + +![](https://img.linux.net.cn/data/attachment/album/202007/01/123009yolmlzp1yu1y88ew.jpg) + +Python 是一门出色的通用编程语言,经常作为第一门编程语言来教授。二十年来,我为它撰写了很多本书,而它仍然是[我的首选语言][2]。虽然通常来说这门语言是简洁明了的,但是(正如 [xkcd][3] 讽刺的),从来没有人说过配置 Python 环境也是一样的简单。 + +![xkcd python illustration][4] + +*一个复杂的Python环境。 [xkcd][3]* + +在日常生活中有很多使用 Python 的方法。我将解释我是如何使用这些 Python 生态系统工具的。但坦诚的说,我仍在寻找更好的替代品。 + +### 使用 pyenv 来管理 Python 版本 + +我发现在机器上运行一个特定版本的 Python 的最好方法是使用 `pyenv`。这个软件可以在 Linux、Mac OS X 和 WSL2 上工作:这是我通常关心的三个 “类 UNIX” 环境。 + +安装 `pyenv` 本身有时会有点棘手。一种方法是使用专用的 [pyenv 安装程序][5],它使用 `curl | bash` 方法来进行(详见其说明)。 + +如果你是在 Mac 上(或者你运行 Homebrew 的其他系统),你可以按照[这里][6]的说明来安装和使用 `pyenv`。 + +按照说明安装和设置了 `pyenv` 之后,你可以使用 `pyenv global` 来设置一个 “默认的” Python 版本。一般来说,你会选择你的 “首选” 版本。这通常是最新的稳定版本,但如果有其他考虑因素也可能做出不同的选择。 + +### 使用 virtualenvwrapper 让虚拟环境更简单 + +使用 `pyenv` 安装 Python 的一个好处是,你所有后继安装的 Python 解释器环境都是你自己的,而不是操作系统层面的。 + +虽然在 Python 本身内部安装东西通常不是最好的选择,但有一个例外:在上面选择的 “首选” Python 中,安装并配置 `virtualenvwrapper`。这样你就可以瞬间创建和切换到虚拟环境。 + +我在[这篇文章中][7]具体介绍了如何安装和使用 `virtualenvwrapper`。 + +这里我推荐一个独特的工作流程:你可以制作一个可以大量重复运行的虚拟环境,用来做运行器runner。在这个环境中,可以安装你最喜欢的运行器 —— 也就是你会经常用来运行其他软件的软件。就目前而言,我的首选是 `tox`。 + +### 使用 tox 作为 Python 运行器 + +[tox][8] 是一个很好的工具,可以让你的 Python 测试自动化。在每个 Python 环境中,我都会创建一个 `tox.ini` 文件。无论我使用什么系统做持续集成,都可以运行它,我可以用上面文章中描述的 `virtualenvwrapper` 的 `workon` 语法在本地运行同样的东西: + +``` +$ workon runner +$ tox +``` + +这个工作流程之所以重要,是因为我要在多个版本的 Python 和多个版本的依赖库中测试我的代码。这意味着在 `tox` 运行器中会有多个环境。一些会尝试在最新的依赖关系中运行,一些会尝试在冻结的依赖关系中运行(接下来会有更多的介绍),我也可能会用 `pip-compile` 在本地生成这些环境。 + +附注:我目前正在[研究使用 nox][9] 作为 `tox` 的替代品。原因超出了本文的范畴,但值得一试。 + +### 使用 pip-compile 进行 Python 依赖性管理 + +Python 是一种动态编程语言,这意味着它在每次执行代码时都会加载其依赖关系。能否确切了解每个依赖项的具体运行版本可能意味着是平稳运行代码还是意外崩溃。这意味着我们必须考虑依赖管理工具。 + +对于每个新项目,我都会包含一个 `requirements.in` 文件,(通常)只有以下内容: + +``` +. +``` + +是的,没错。只有一个点的单行。我在 `setup.py` 文件中记录了 “宽松” 的依赖关系,比如 `Twisted>=17.5`。这与 `Twisted==18.1` 这样的确切依赖关系形成了鲜明对比,后者在需要一个特性或错误修复时,难以升级到新版本的库。 + +`.` 的意思是 “当前目录”,它使用当前目录下的 `setup.py` 作为依赖关系的来源。 + +这意味着使用 `pip-compile requirements.in > requirements.txt` 会创建一个冻结的依赖文件。你可以在 `virtualenvwrapper` 创建的虚拟环境中或者 `tox.ini` 中使用这个依赖文件。 + +有时,也可以从 `requirements-dev.in`(内容:`.[dev]`)生成 `requirements-dev.txt`,或从 `requirements-test.in`(内容:`.[test]`)生成 `requirements-test.txt`。 + +我正在研究在这个流程中是否应该用 [dephell][10] 代替 `pip-compile`。`dephell` 工具有许多有趣的功能,比如使用异步 HTTP 请求来下载依赖项。 + +### 结论 + +Python 的功能既强大又赏心悦目。为了编写这些代码,我依靠了一个对我来说很有效的特定工具链。工具 `pyenv`、`virtualenvwrapper`、`tox` 和 `pip-compile` 都是独立的。但是,它们各有各的作用,没有重叠,它们一起打造了一个强大的 Python 工作流。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/6/python-tools + +作者:[Moshe Zadka][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/moshez +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/python_programming_question.png?itok=cOeJW-8r (Python programming language logo with question marks) +[2]: https://opensource.com/article/19/10/why-love-python +[3]: https://xkcd.com/1987/ +[4]: https://opensource.com/sites/default/files/uploads/python_environment_xkcd_1.png (xkcd python illustration) +[5]: https://github.com/pyenv/pyenv-installer +[6]: https://linux.cn/article-12241-1.html +[7]: https://linux.cn/article-11086-1.html +[8]: https://opensource.com/article/19/5/python-tox +[9]: https://nox.thea.codes/en/stable/ +[10]: https://github.com/dephell/dephell diff --git a/published/202007/20200622 7 open source alternatives to VS Code.md b/published/202007/20200622 7 open source alternatives to VS Code.md new file mode 100644 index 0000000000..6526252de9 --- /dev/null +++ b/published/202007/20200622 7 open source alternatives to VS Code.md @@ -0,0 +1,128 @@ +[#]: collector: (lujun9972) +[#]: translator: (nophDog) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12382-1.html) +[#]: subject: (7 open source alternatives to VS Code) +[#]: via: (https://opensource.com/article/20/6/open-source-alternatives-vs-code) +[#]: author: (Seth Kenlon https://opensource.com/users/seth) + +VS Code 的 7 个开源替代品 +====== + +> 为了避免使用微软版本的 VS Code,我们需要另行选择一个开源的代码编辑器。 + +![](https://img.linux.net.cn/data/attachment/album/202007/05/112348n834svpa48v08vsa.png) + +Visual Studio Code,也叫 VS Code,是一个跨平台代码编辑器,通用于 Linux、Windows 以及 macOS。它既能编辑简单文本,也能像集成开发环境(IDE)一样管理整个代码库。它可以通过插件进行扩展,并且已经被证明是一个可靠的文本编辑器,很轻松地就击败了非开源的强大竞品编辑器。 + +微软以开源的方式发布了 VS Code,但是你从微软下载的版本其实并不是开源的。然而,你仍有办法以开源的方式使用 VS Code,或者直接选择其它的开源替代品。 + +### 以开源的方式构建 VS Code + +你可以在 [GitHub][2] 获得 VS Code 的源代码。然而当你 [从微软][3] 下载 VS Code 时,你会发现它是基于 [微软软件许可证][4] 授权的。这并不是一个开源许可证。其区别在于构建过程。 + +Chris Dias 是微软 VS Code 项目开发者之一,他对 VS Code [作了一个对比][5],就像 Chrome 浏览器和其开源的“上游”项目 [Chromium][6] 一样。VS Code 确实是基于开源代码库构建的。微软官方发布的版本带有一些与微软相关的功能,包括一项商标、一个插件库、一个 C# 调试器以及遥测。但如果你克隆仓库然后自行编译,这些东西都不会被加入,所以你会得到一个名为 Code - OSS 的“干净”版本(OSS 代表开源软件)。 + +实际上,VS Code 与 Code - OSS 之间的差异很小。最值得注意的是,VS Code 包含遥测功能,它会记录使用数据。微软不可能监控你的一举一动,而且目前越来越多软件都在收集使用数据。是否在乎 VS Code 的遥测功能,完全取决于你自己。如果你不希望它追踪你的使用情况,这里有一些很棒的 VS Code(开源)替代品。 + +### VSCodium + +![Code OSS screenshot][7] + +最简单的替代方案就是构建不带微软附属功能的 VS Code 版本。[VSCodium][9] 项目提供了可下载的 Code-OSS 可执行文件,它基于 VS Code 代码库编译,没有配置微软的 `product.json` 中的改变。VSCodium 的开发者还竭尽全力禁用了所有难以寻找的遥测选项,除非你自行编译,否则这已经是你能找到的最干净的 VS Code 版本了。 + +VSCodium 提醒说,VS Code 悄悄地包含了一些专有工具,这些工具无法与开源版本一起提供。这包括一个 C# 调试器和部分插件。如果你需要它们,可以在 [文档中] 找到解决办法。假如你依赖 VS Code 中某些特定的功能,你应该验证它在 VSCodium 中是否可以发挥功用。 + +此外,你还应该验证是否已禁用所有的遥测功能。 + +### Code - OSS + +如果不想用 VSCodium 的版本,你可以自己 [从头编译 VS Code][12],得到一样的版本。可执行文件叫做 `Code - OSS`,而不是 `VSCode`,适用于 VSCodium 的许可证限制也适用于你的构建,而工作方式也是一样。 + +如果通过编译源码构建应用,首次启动时你要确保 [所有遥测都已经被禁用]。 + +### Atom + +![Atom screenshot][13] + +[Atom][14] 是一个类似于 IDE 的文本编辑器,当微软收购 Github 的同时也收购了它。和 VS Code 一样,你可以使用插件,扩展 Atom 编辑器,此外,你还能通过自己的工具和主题实现定制。它开源且与 Github 集成。简而言之,只要你能找到你想用的插件,或者你愿意自己动手写,那么 Atom 几乎可以满足你的一切需求。 + +跟 VS Code 一样,Atom 也 [默认包含遥测][15]。你可以禁用这个功能,而且跟 VS Code 不同的是,使用插件不受任何限制,所以不必再因为隐私改变你的工作流。对写代码的人来说,毫无疑问 Atom 是很有用的工具,而对于 [使用电脑的任何人][16],它同样会是一个很赞的编辑器。如果你需要一个顺手的通用文本编辑器,请试试 Atom。 + +### GNOME Builder + +![GNOME Builder screenshot][17] + +为 GNOME 桌面而开发的 IDE,[GNOME Builder][18] 是一个 Linux 平台的代码编辑器,专门用于构建 GNOME 应用。如果你为 Linux 构建应用程序,希望轻松解决兼容性问题,那么 Builder 就是最简单的选择。从 [Flathub.org][19] 安装 Builder;当你开启一个新项目,如果没有安装 GNOME SDK,它会提醒你。这意味着当维护你的应用时,你不必刻意关注 GNOME 的状态,因为 Builder 在替你做这件事。 + +然而,Builder 不仅能构建 GNOME 程序。它还支持各种各样的编程语言,包括 Python、Rust、C/C++、Java、Go、JavaScript、TypeScript、VB.NET、Markdown 和几种标记语言等等。它对部分语言有全面的支持,包括自动补全以及弹出式函数定义,但是其它语言仅仅含有一些比较方便的功能,例如语法高亮跟自动匹配括号。不管你是不是一个专门的程序员,或者你只想要一个给力的 HTML 和 CSS 编辑器,这个 IDE 都能让你舒心使用。 + +### Geany + +![Geany screenshot][20] + +[Geany][21] 是一个强大、稳定而轻量级的编辑器,它有很多有用的特性,能帮你写 Bash、Python、Lua、XML、HTML、LaTex,当然远不止这些。对 50 种各种编程及脚本语言、标记语言和各种文件类型(比如 .diff 和 .po),Geany 都有很好的支持。退一万步讲,Geany 还有括号匹配和语法高亮 —— 通常来说,它包含更多功能。 + +Geany 是一个小型编辑器,但是通过插件,你可以为它添加特性,例如项目视图面板、文件系统树、调试、终端等,直到它看起来像一个 IDE。当然,萝卜白菜各有所爱,你也可以尽量使它保持简洁易用。如果因为电脑 CPU 或者内存的限制而无法使用 VS Code,那么很明显 Geany 可以作为你的选择。它只占用少量内存,而且启动迅速。即便跟运行在终端里的 Vim 相比,Geany 稍显笨重,但就算在树莓派,它也能做到快速、灵活。 + +### Brackets + +![Brackets screenshot][22] + +[Brackets][23] 是一款面向网页开发者的文本编辑器和 IDE。对于 HTML、CSS、JavaScript、PHP 甚至 Python,它都有很强大的支持。而且跟 VS Code 一样,它也有一个很丰富的插件生态,所以你可以最大限度地扩展它,以适应你所有编程语言的工作。 + +有的插件用于辅助解析语言、运行脚本,甚至编译执行代码。Brackets 有一个传统的界面,不管你是否熟悉 IDE 或者像记事本一样简单的文本编辑器,都能驾轻就熟。如果稍微花点时间,添加几个相关插件,然后熟悉它们,你会发现 Brackets 真的是一个很精妙、很有用的编辑器,不管你输入什么,它都能通过自动补全、提示帮你避免低级错误。假如你是程序员,它能帮你加快测验和调试周期。 + +### Che + +![Che screenshot][24] + +如果你喜欢新技术,那你应当尝试 [Che][25] 编辑器。这是一个基于云的 IDE,所以它默认以软件即服务(SaaS)的形式运行,但它是完全开源的,如果你有 Kubernetes 实例,那就可以运行为*你自己的* SaaS。 + +Che 不仅是一个在线 IDE,而且是一个为云开发而构建的 IDE。在 Che 的概念里,用户无需查看本地文件系统。由于它在云端工作,所以你也可以这么做。事实上,如果你有一台 Git 服务器,那就可以直接把它当作你的文件系统,在它的仓库中完成你的项目。当然,你也可以下载所有文件做本地备份。 + +但 Che 的主要特点,也是云开发者最为兴奋的一点,它是一个功能全面、带有 Kubernetes 感知功能的开源 IDE。如果你正在为云构建应用、网站或容器(或三者的组合),那么 Che 是一个你需要尝试的编辑器。 + +### 那么你的选择是? + +你有没有在使用这些 VS Code 替代品中的某一个呢?想不想挑一个试试呢?欢迎在评论中分享你的见解。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/6/open-source-alternatives-vs-code + +作者:[Seth Kenlon][a] +选题:[lujun9972][b] +译者:[nophDog](https://github.com/nophDog) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/seth +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/laptop_screen_desk_work_chat_text.png?itok=UXqIDRDD (Person using a laptop) +[2]: https://github.com/microsoft/vscode +[3]: https://code.visualstudio.com/ +[4]: https://code.visualstudio.com/license +[5]: https://github.com/Microsoft/vscode/issues/60#issuecomment-161792005 +[6]: https://www.chromium.org/ +[7]: https://opensource.com/sites/default/files/uploads/code-oss.png (Code OSS screenshot) +[8]: https://creativecommons.org/licenses/by-sa/4.0/ +[9]: https://vscodium.com/ +[10]: https://github.com/VSCodium/vscodium/blob/master/DOCS.md +[11]: https://code.visualstudio.com/docs/supporting/faq#_how-to-disable-telemetry-reporting +[12]: https://github.com/Microsoft/vscode/wiki/How-to-Contribute#build-and-run +[13]: https://opensource.com/sites/default/files/uploads/atom.jpg (Atom screenshot) +[14]: http://atom.io +[15]: https://discuss.atom.io/t/how-do-i-disable-the-metrics-or-tracking/24520 +[16]: https://opensource.com/article/19/4/write-git +[17]: https://opensource.com/sites/default/files/uploads/builder.png (GNOME Builder screenshot) +[18]: https://wiki.gnome.org/Apps/Builder +[19]: https://flathub.org/apps/details/org.gnome.Builder +[20]: https://opensource.com/sites/default/files/uploads/geany.png (Geany screenshot) +[21]: https://www.geany.org/ +[22]: https://opensource.com/sites/default/files/uploads/brackets.jpg (Brackets screenshot) +[23]: http://brackets.io/ +[24]: https://opensource.com/sites/default/files/uploads/che-cpp.jpg (Che screenshot) +[25]: https://www.eclipse.org/che/extend/ diff --git a/published/202007/20200622 Linux tools for improving your time management.md b/published/202007/20200622 Linux tools for improving your time management.md new file mode 100644 index 0000000000..af35552fa3 --- /dev/null +++ b/published/202007/20200622 Linux tools for improving your time management.md @@ -0,0 +1,119 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12388-1.html) +[#]: subject: (Linux tools for improving your time management) +[#]: via: (https://opensource.com/article/20/6/linux-time-management) +[#]: author: (Sudeshna Sur https://opensource.com/users/sudeshna-sur) + +时间管理专家的 Linux 工具 +====== + +> 无论你是需要帮助来保持专注、保持及时性,还是为了找到避免重复的捷径,这些 Linux 工具能够帮助你。 + +![](https://img.linux.net.cn/data/attachment/album/202007/07/084943stbchr65ke6r1cqh.jpg) + +生产力是一个主观术语,但从本质上讲,它是衡量特定任务完成效率的标准。每个人都有不同的方式来提高他们的生产力:有些人需要帮助专注于任务里、有些人需要特殊的工作环境、有些人需要警报和提醒以避免错过截止日期,还有些人需要协助处理重复的手工活。幸运的是,有多种工具和技术可为你提供所需的特定支持。特别地,如果你是 Linux 用户,有一些调整可以帮助你提高生产力。这是我经常使用的两个。 + +### 剪贴板指示器 + +你是否在日常使用中,在多个文档之间的大量使用复制和粘贴?如果是这样,那么 [剪贴板指示器][2] 应该成为你的首选方案之一。将剪贴板指示器作为 GNOME 扩展安装到 Linux 发行版中。以我的经验,它对 GNOME Shell 的性能影响很小,至少比我尝试过的其他方案要小。 + +该工具添加了一个指示器菜单到顶部面板,并缓存剪贴板历史。你可以设置历史记录大小、要预览的字符数量。它可以在复制时显示通知,并充当保存任意复制内容的临时空间。 + +![Clipboard indicator menu on GNOME desktop][3] + +安装扩展程序和连接器的最简单方法是使用发行版的包管理器。 + +对于 Fedora、CentOS 或 RHEL,请使用: + +``` +$ sudo dnf install chrome-gnome-shell +``` + +在 Ubuntu 或 Debian 上,请改用 `apt install`。 + +安装完成后,进入 并查看已安装的扩展。 + +如果你使用的是 Firefox,请使用 Firefox 浏览器附加组件并安装 “GNOME Shell integration”。你将在 Firefox 工具栏中看到一个很小的脚印图标,它将带你进入“扩展”页面。在该页面上,搜索 “Clipboard Indicator” 扩展并启用它。 + +现在,按照提示下载 GNOME 扩展并激活它。你可以查看 `~/.local/share/gnome-shell/extensions` 来浏览你的扩展。 + +好了!你将在 GNOME 桌面的右上角看到一个新图标。复制任意内容并尝试其设置。 + +也可以使用以下命令通过 Git 进行快速安装:将仓库克隆到本地的 gnome-shell 扩展目录中: + +``` +$ git clone https://github.com/Tudmotu/gnome-shell-extension-clipboard-indicator.git ~/.local/share/gnome-shell/extensions/clipboard-indicator@tudmotu.com +``` + +进入 GNOME Tweaks 工具,然后从“扩展”页面激活它。 + +### 番茄计时器(Pomodoro) + +![Using the pomodoro timer on GNOME][4] + +Pomodoro 技术是一种时间管理理念,旨在为用户提供最大注意力。每个 25 分钟的工作时间称为“pomodoro”(意大利语的“番茄”);每个番茄之后,你需要休息五分钟。每四个番茄时间,即每 100 分钟,你就要休息 15 至 20 分钟。如果你有大量的待办事项,那么使用 Pomodoro 技术可以通过强迫你遵守严格的时间安排来帮助你更快地完成项目。 + +可以通过 GNOME Tweaks 网页 (extensions.gnome.org)或通过命令行来管理安装过程。对于后者,请根据你的 Linux 发行版和版本,并使用以下命令进行安装: + +``` +$ sudo dnf install gnome-shell-extension-pomodoro +``` + +或者,如果你希望从源代码构建: + +``` +$ git clone -b gnome-3.34 https://github.com/codito/gnome-pomodoro.git +$ cd gnome-pomodoro +``` + +源码有许多依赖关系,其中许多可能已经安装。为了确保这点,请安装以下内容。 + +``` +$ sudo dnf install autoconf-archive gettext vala vala-tools pkg-config desktop-file-utils glib2-devel gtk3-devel libappstream-glib-devel libappindicator-gtk3-devel libcanberra-devel libpeas-devel sqlite-devel gom-devel gobject-introspection-devel gsettings-desktop-schemas-devel gstreamer1-devel +``` + +在源代码的解压目录中,完成构建。 + +``` +$ ./autogen.sh --prefix=/usr --datadir=/usr/share  +$ make  +$ sudo make install  +``` + +不管是怎么安装的,请进入 GNOME Tweaks 并打开番茄计时器。如果你还没有 GNOME Tweaks,请通过包管理器或所选的软件安装程序进行安装。例如,在 Fedora 上: + +``` +$ sudo dnf install gnome-tweaks +``` + +在 Ubuntu 或 Debian上,请改用 `apt install`。 + +Pomodoro 桌面集成当前可在 GNOME Shell 中使用,并且它们计划在将来支持更多桌面。 查看 获取有关该项目的最新信息。同时,对于 KDE 用户,还有一个名为 [Fokus][5] 的替代品。 + +### Linux 上的生产力 + +生产力是个人的,但这是我们所有人都在以某种方式追求的东西。这些工具中的每一个要么节省了我的时间,要么使我的工作效率提高了,它们可以与 Linux 快速集成。 + +你是否有喜欢的生产力工具?请在评论中分享! + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/6/linux-time-management + +作者:[Sudeshna Sur][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/sudeshna-sur +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/lenovo-thinkpad-laptop-concentration-focus-windows-office.png?itok=-8E2ihcF (Woman using laptop concentrating) +[2]: https://extensions.gnome.org/extension/779/clipboard-indicator/ +[3]: https://opensource.com/sites/default/files/uploads/gnome-tweaks-productivity_0.png (Clipboard indicator menu on GNOME desktop) +[4]: https://opensource.com/sites/default/files/uploads/pomodoro-timer-fedora-opensourcecom.png (Using the pomodoro timer on GNOME) +[5]: https://store.kde.org/p/1308861/ diff --git a/published/202007/20200622 Missing Photoshop on Linux- Use PhotoGIMP and Convert GIMP into Photoshop.md b/published/202007/20200622 Missing Photoshop on Linux- Use PhotoGIMP and Convert GIMP into Photoshop.md new file mode 100644 index 0000000000..0b75d249c9 --- /dev/null +++ b/published/202007/20200622 Missing Photoshop on Linux- Use PhotoGIMP and Convert GIMP into Photoshop.md @@ -0,0 +1,103 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12373-1.html) +[#]: subject: (Missing Photoshop on Linux? Use PhotoGIMP and Convert GIMP into Photoshop) +[#]: via: (https://itsfoss.com/photogimp/) +[#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/) + +在 Linux 上缺少 Photoshop?使用 PhotoGIMP 将 GIMP 变为 Photoshop +====== + +[Adobe Photoshop][1] 不适用于桌面 Linux。GIMP 是 [Linux 上 Adobe Photoshop 的最佳替代品][2]。 + +如果你使用过 Photoshop,那么你会注意到 [GIMP][3] 和 Photoshop 相比有不同的设置、键盘快捷键和布局。 + +这没有错。毕竟,它们都是两种不同的软件,而且它们不必看起来相同。 + +但是,习惯了 Photoshop 的人们发现在切换到 GIMP 的时很难忘记他们反复学习的肌肉记忆。这可能会使某些人感到沮丧,因为使用新的界面意味着要学习大量的键盘快捷键,并花时间在查找工具位于何处。 + +为了帮助从 Photoshop 切换到 GIMP 的人,[Diolinux][4] 推出了一个在 GIMP 中模仿 Adobe Photoshop 的工具。 + +### PhotoGIMP:在 Linux 中为 GIMP 提供 Adobe Photoshop 的外观 + +![][5] + +[PhotoGIMP][6] 不是独立的图形软件。它是 GIMP 2.10 的补丁。你需要在系统上安装 GIMP 才能使用 PhotoGIMP。 + +当你应用 PhotoGIMP 补丁时,它将更改 GIMP 布局以模仿 Adobe Photoshop。 + + * 默认安装数百种新字体 + * 安装新的 Python 过滤器,例如 “heal selection” + * 添加新的启动画面 + * 添加新的默认设置以最大化画布空间 + * 添加类似于 Adobe Photoshop 的键盘快捷键 + +PhotoGIMP 还在自定义 `.desktop` 文件中添加新的图标和名称。让我们看看如何使用它。 + +### 在 Linux 上安装 PhotoGIMP (适合中级到专业用户) + +PhotoGIMP 本质是一个补丁。在 Linux 中下载并[解压 zip 文件][7]。你将在解压的文件夹中找到以下隐藏的文件夹: + + * `.icons`:其中包含新的 PhotoGIMP 图标 + * `.local`:包含个性化的 `.desktop` 文件,以便你在系统菜单中看到的是 PhotoGIMP 而不是 GIMP + * `.var`:包含 GIMP 补丁的主文件夹 + +你应该[使用 Ctrl+H 快捷键在 Ubuntu 中显示隐藏文件][8]。 + +警告:建议你备份 GIMP 配置文件,以便在不喜欢 PhotoGIMP 时可以还原。只需将 GIMP 配置文件复制到其他位置即可备份。 + +目前,PhotoGIMP 主要与通过 [Flatpak][9] 安装的 GIMP 兼容。如果你使用 Flatpak 安装了 GIMP,那么只需将这些隐藏的文件夹复制粘贴到家目录中,它将 GIMP 转换为 Adobe Photoshop 类似的设置。 + +但是,如果你通过 apt、snap 或发行版的包管理器安装了 GIMP,那么必须找到 GIMP 的配置文件夹,然后粘贴 PhotoGIMP 的 `.var` 目录的内容。当出现询问时,请选择合并选项并替换同名的现有文件。 + +我[使用 apt 在 Ubuntu 20.04 中安装了 GIMP][10]。对我来说,GIMP 配置文件在 `~/.config/GIMP/2.10`。我复制了 `.var/app/org.gimp.GIMP/config/GIMP/2.10` 目录,并启动 GIMP 查看 PhotoGIMP 的启动页。 + +这是打了 PhotoGIMP 补丁后的 GIMP 界面: + +![][11] + +我尝试了几个 Photoshop 快捷键来检查它所做的更改,一切似乎可以正常工作。 + +- [下载 PhotoGIMP][12] + +我还找到了 [Snap 包形式的 PhotoGIMP][13],但它是 2019 年的,我不确定它是否可以在所有地方使用,或者仅适用于 snap 安装。 + +### 总结 + +这不是类似的第一个项目。几年前,我们有一个类似的项目叫 Gimpshop。Gimpshop 项目在过去的几年中没有任何进展,可以肯定地认为该项目已经死亡。有一个名为 Gimpshop 的网站,但该网站来自冒名者试图以 Gimpshop 的名义获利。 + +我不是 Adobe Photoshop 用户。我甚至不是 GIMP 专家,这就是为什么我们的 [GIMP 教程][14] 用 Dimitrios 的原因。 + +因此,我无法评论 PhotoGIMP 项目的实用性。如果你熟悉这两种软件,那么应该能够比我更好地进行判断。 + +如果你尝试使用 PhotoGIMP,请与他人分享你的经验,并告诉我们是否值得安装。 + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/photogimp/ + +作者:[Abhishek Prakash][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://itsfoss.com/author/abhishek/ +[b]: https://github.com/lujun9972 +[1]: https://www.adobe.com/in/products/photoshop.html +[2]: https://itsfoss.com/open-source-photoshop-alternatives/ +[3]: https://www.gimp.org/ +[4]: https://diolinux.com.br/ +[5]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/06/photogimp-feature.jpg?ssl=1 +[6]: https://github.com/Diolinux/PhotoGIMP +[7]: https://itsfoss.com/unzip-linux/ +[8]: https://itsfoss.com/hide-folders-and-show-hidden-files-in-ubuntu-beginner-trick/ +[9]: https://flatpak.org/ +[10]: https://itsfoss.com/gimp-2-10-release/ +[11]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/06/photogimp-editor-interface.jpg?resize=800%2C538&ssl=1 +[12]: https://github.com/Diolinux/PhotoGIMP/releases +[13]: https://snapcraft.io/photogimp +[14]: https://itsfoss.com/tag/gimp-tips/ diff --git a/published/202007/20200622 Protect your system with fail2ban and firewalld blacklists.md b/published/202007/20200622 Protect your system with fail2ban and firewalld blacklists.md new file mode 100644 index 0000000000..4cd9c9c586 --- /dev/null +++ b/published/202007/20200622 Protect your system with fail2ban and firewalld blacklists.md @@ -0,0 +1,339 @@ +[#]: collector: (lujun9972) +[#]: translator: (wxy) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12417-1.html) +[#]: subject: (Protect your system with fail2ban and firewalld blacklists) +[#]: via: (https://fedoramagazine.org/protect-your-system-with-fail2ban-and-firewalld-blacklists/) +[#]: author: (hobbes1069 https://fedoramagazine.org/author/hobbes1069/) + +使用 fail2ban 和 FirewallD 黑名单保护你的系统 +====== + +![][1] + +如果你运行的服务器有面向公众的 SSH 访问,你可能遇到过恶意登录尝试。本文介绍了如何使用两个实用程序来防止入侵者进入我们的系统。 + +为了防止反复的 ssh 登录尝试,我们来看看 fail2ban。而且,如果你不经常旅行,基本上停留在一两个国家,你可以将 FirewallD 配置为只允许[从你选择的国家访问][2]。 + +首先,让我们为不熟悉这些应用程序的人员介绍一些术语,以完成这项工作: + +**fail2ban**:一个守护进程,用于禁止发生多次认证错误的主机。fail2ban 将监控 SystemD 日志,以查找对任何已启用的“监狱jail”的失败的验证尝试。在达到指定失败次数后,它将添加一个防火墙规则,在配置的时间内阻止该特定 IP 地址。 + +**FirewallD**:一个带有 D-Bus 接口的防火墙守护进程,提供动态防火墙。除非你另行决定使用传统的 iptables,否则你已经在所有支持的 Fedora 和 CentOS 上安装了 FirewallD。 + +### 假定前提 + +* 主机系统有一个互联网连接,并且要么是直接暴露在互联网上,要么是通过 DMZ(这两个都是非常糟糕的想法,除非你知道你在做什么),要么是有一个端口从路由器转发过来。 +* 虽然大部分的内容可能适用于其他系统,但本文假设当前系统是 Fedora(31 及以上)或 RHEL/CentOS 8 版本。在 CentOS 上,你必须用 `sudo dnf install epel-release` 启用 Fedora EPEL 仓库。 + +### 安装与配置 + +#### Fail2Ban + +很有可能已经有某个 Firewalld 区已经允许 SSH 访问,但 sshd 服务本身默认没有启用。要手动启动它,并且不在启动时永久启用它: + +``` +$ sudo systemctl start sshd +``` + +或者在系统启动时启用,并同时启动它: + +``` +$ sudo systemctl enable --now sshd +``` + +下一步就是安装、配置、启用 fail2ban。和往常一样,安装可以通过命令行完成: + +``` +$ sudo dnf install fail2ban +``` + +安装完毕后,下一步就是配置“监狱”(你要以设置的任何阈值监视并禁止的服务)。默认情况下,IP 会被禁止 1 小时(这其实不够长)。最好的做法是使用 `*.local` 文件覆盖系统默认值,而不是直接修改 `*.config` 文件。如果我们查看我的 `jail.local`,我们可以看到: + +``` +# cat /etc/fail2ban/jail.local +[DEFAULT] + +# "bantime" is the number of seconds that a host is banned. +bantime = 1d + +# A host is banned if it has generated "maxretry" during the last "findtime" +findtime = 1h + +# "maxretry" is the number of failures before a host get banned. +maxretry = 5 +``` + +换成通俗的语言讲,就是在过去一小时内尝试 5 次后,该 IP 将被封禁 1 天。对于多次被封的 IP,也可以选择增加封禁时间,但这是另一篇文章的主题。 + +下一步是配置“监狱”。在本教程中显示的是 `sshd`,但其他服务的步骤大致相同。在 `/etc/fail2ban/jail.d` 中创建一个配置文件。这是我的文件: + +``` +# cat /etc/fail2ban/jail.d/sshd.local +[sshd] +enabled = true +``` + +就这么简单! 很多配置已经在为 Fedora 构建的软件包中处理了(提示:我是当前的维护者)。接下来启用并启动 fail2ban 服务: + +``` +$ sudo systemctl enable --now fail2ban +``` + +希望没有立即出错,如果没有,请使用下面的命令检查 fail2ban 的状态: + +``` +$ sudo systemctl status fail2ban +``` + +如果它没有错误地启动,应该是这样的: + +``` +$ systemctl status fail2ban +● fail2ban.service - Fail2Ban Service +Loaded: loaded (/usr/lib/systemd/system/fail2ban.service; disabled; vendor preset: disabled) +Active: active (running) since Tue 2020-06-16 07:57:40 CDT; 5s ago +Docs: man:fail2ban(1) +Process: 11230 ExecStartPre=/bin/mkdir -p /run/fail2ban (code=exited, status=0/SUCCESS) +Main PID: 11235 (f2b/server) +Tasks: 5 (limit: 4630) +Memory: 12.7M +CPU: 109ms +CGroup: /system.slice/fail2ban.service +└─11235 /usr/bin/python3 -s /usr/bin/fail2ban-server -xf start +Jun 16 07:57:40 localhost.localdomain systemd[1]: Starting Fail2Ban Service… +Jun 16 07:57:40 localhost.localdomain systemd[1]: Started Fail2Ban Service. +Jun 16 07:57:41 localhost.localdomain fail2ban-server[11235]: Server ready +``` + +如果是刚刚启动的,fail2ban 不太可能显示任何有意思的信息,但要检查 fail2ban 的状态,并确保“监狱”被启用,请输入: + +``` +$ sudo fail2ban-client status +Status +|- Number of jail: 1 +`- Jail list: sshd +``` + +sshd “监狱”的上级状态也会显示出来。如果启用了多个“监狱”,它们会在这里显示出来。 + +要查看一个“监狱”的详细状态,只需在前面的命令中添加“监狱”名称。下面是我的系统的输出,它已经运行了一段时间。我已经从输出中删除了被禁止的 IP: + +``` +$ sudo fail2ban-client status sshd +Status for the jail: sshd +|- Filter +| |- Currently failed: 8 +| |- Total failed: 4399 +| `- Journal matches: _SYSTEMD_UNIT=sshd.service + _COMM=sshd +`- Actions + |- Currently banned: 101 + |- Total banned: 684 + `- Banned IP list: ... +``` + +监控 fail2ban 日志文件是否有入侵尝试,可以通过“尾随”日志来实现: + +``` +$ sudo tail -f /var/log/fail2ban.log +``` + +`tail` 是一个很好的命令行工具,默认情况下,它可以显示一个文件的最后 10 行。添加 `-f` 告诉它尾随文件,这是个观察一个仍在被写入的文件的很好方式。 + +由于输出的内容中有真实的 IP,所以这里不会提供样本,但它的可读性很高。`INFO` 行通常是登录的尝试。如果从一个特定的 IP 地址进行了足够多的尝试,你会看到一个 `NOTICE` 行显示一个 IP 地址被禁止。在达到禁止时间后,你会看到一个 `NOTICE` 解禁行。 + +注意几个警告行。最常见的情况是,当添加了一个禁止后,fail2ban 发现该 IP 地址已经在其禁止数据库中,这意味着禁止可能无法正常工作。如果是最近安装的 fail2ban 包,它应该被设置为 FirewallD 的富规则。这个包在 fail2ban-0.11.1-6 版本时从 ipset 方式切换到了富规则方式,所以如果你的 fail2ban 安装时间较早,它可能还在尝试使用 ipset 方式,这种方式使用的是传统的 iptables,不是很可靠。 + +#### FirewallD 配置 + +##### 被动还是主动? + +有两种策略可以分开或一起使用:**被动**地将单个 IP 地址或**主动**地根据来源国将子网永久列入黑名单。 + +对于被动方式,一旦 fail2ban 运行了一段时间,最好再运行 `sudo fail2ban-client status sshd` 来看看有哪些坏蛋。很可能会有很多被禁止的 IP 地址。选择一个,然后试着对它运行 `whois`。在输出结果中可能会有很多有趣的信息,但是对于这个方法来说,只有来源国是重要的。为了保持简单,让我们过滤掉除了国家以外的所有信息。 + +在这个例子中,我们将使用一些著名的域名: + +``` +$ whois google.com | grep -i country +Registrant Country: US +Admin Country: US +Tech Country: US +``` + +``` +$ whois rpmfusion.org | grep -i country +Registrant Country: FR +``` + +``` +$ whois aliexpress.com | grep -i country +Registrant Country: CN +``` + +使用 `grep -i` 的原因是为了使 `grep` 不区分大小写,而大多数条目都使用的是 “Country”,而有些条目则是全小写的 “country”,所以这种方法无论如何都能匹配。 + +现在知道了尝试入侵的来源国,问题是,“是否有来自这个国家的人有合法的理由连接到这台计算机?”如果答案是否定的,那么封锁整个国家应该是可以接受的。 + +从功能上看,主动式方法它与被动式方法没有太大区别,然而,来自有些国家的入侵企图是非常普遍的。如果你的系统既不放在这些国家里,也没有任何源自这些国家的客户,那么为什么不现在就把它们加入黑名单而是等待呢?(LCTT 译注:我的经验是,动辄以国家的范畴而列入黑名单有些过于武断。建议可以将该 IP 所属的 WHOIS 网段放入到黑名单,因为这些网段往往具有相同的使用性质,如都用于用户接入或 IDC 托管,其安全状况也大致相同,因此,如果有来自该网段的某个 IP 的恶意尝试,可以预期该网段内的其它 IP 也可能被利用来做这样的尝试。) + +##### 黑名单脚本和配置 + +那么如何做到这一点呢?用 FirewallD ipset。我开发了下面的脚本来尽可能地自动化这个过程: + +``` +#!/bin/bash +# Based on the below article +# https://www.linode.com/community/questions/11143/top-tip-firewalld-and-ipset-country-blacklist + +# Source the blacklisted countries from the configuration file +. /etc/blacklist-by-country + +# Create a temporary working directory +ipdeny_tmp_dir=$(mktemp -d -t blacklist-XXXXXXXXXX) +pushd $ipdeny_tmp_dir + +# Download the latest network addresses by country file +curl -LO http://www.ipdeny.com/ipblocks/data/countries/all-zones.tar.gz +tar xf all-zones.tar.gz + +# For updates, remove the ipset blacklist and recreate +if firewall-cmd -q --zone=drop --query-source=ipset:blacklist; then + firewall-cmd -q --permanent --delete-ipset=blacklist +fi + +# Create the ipset blacklist which accepts both IP addresses and networks +firewall-cmd -q --permanent --new-ipset=blacklist --type=hash:net \ + --option=family=inet --option=hashsize=4096 --option=maxelem=200000 \ + --set-description="An ipset list of networks or ips to be dropped." + +# Add the address ranges by country per ipdeny.com to the blacklist +for country in $countries; do + firewall-cmd -q --permanent --ipset=blacklist \ + --add-entries-from-file=./$country.zone && \ + echo "Added $country to blacklist ipset." +done + +# Block individual IPs if the configuration file exists and is not empty +if [ -s "/etc/blacklist-by-ip" ]; then + echo "Adding IPs blacklists." + firewall-cmd -q --permanent --ipset=blacklist \ + --add-entries-from-file=/etc/blacklist-by-ip && \ + echo "Added IPs to blacklist ipset." +fi + +# Add the blacklist ipset to the drop zone if not already setup +if firewall-cmd -q --zone=drop --query-source=ipset:blacklist; then + echo "Blacklist already in firewalld drop zone." +else + echo "Adding ipset blacklist to firewalld drop zone." + firewall-cmd --permanent --zone=drop --add-source=ipset:blacklist +fi + +firewall-cmd -q --reload + +popd +rm -rf $ipdeny_tmp_dir +``` + +这个应该安装到 `/usr/local/sbin`,不要忘了让它可执行! + +``` +$ sudo chmod +x /usr/local/sbin/firewalld-blacklist +``` + +然后创建一个配置文件 `/etc/blacklist-by-country`: + +``` +# Which countries should be blocked? +# Use the two letter designation separated by a space. +countries="" +``` + +而另一个配置文件 `/etc/blacklist-by-ip`,每行只有一个 IP,没有任何额外的格式化。 + +在这个例子中,从 ipdeny 的区文件中随机选择了 10 个国家: + +``` +# ls | shuf -n 10 | sed "s/\.zone//g" | tr '\n' ' ' +nl ee ie pk is sv na om gp bn +``` + +现在只要在配置文件中加入至少一个国家,就可以运行了! + +``` +$ sudo firewalld-blacklist + % Total % Received % Xferd Average Speed Time Time Time Current + Dload Upload Total Spent Left Speed +100 142 100 142 0 0 1014 0 --:--:-- --:--:-- --:--:-- 1014 +100 662k 100 662k 0 0 989k 0 --:--:-- --:--:-- --:--:-- 989k +Added nl to blacklist ipset. +Added ee to blacklist ipset. +Added ie to blacklist ipset. +Added pk to blacklist ipset. +Added is to blacklist ipset. +Added sv to blacklist ipset. +Added na to blacklist ipset. +Added om to blacklist ipset. +Added gp to blacklist ipset. +Added bn to blacklist ipset. +Adding ipset blacklist to firewalld drop zone. +success +``` + +要验证 FirewallD 黑名单是否成功,请检查 `drop` 区和 `blacklist` ipset。 + +``` +$ sudo firewall-cmd --info-zone=drop +drop (active) + target: DROP + icmp-block-inversion: no + interfaces: + sources: ipset:blacklist + services: + ports: + protocols: + masquerade: no + forward-ports: + source-ports: + icmp-blocks: + rich rules: + +$ sudo firewall-cmd --info-ipset=blacklist | less +blacklist + type: hash:net + options: family=inet hashsize=4096 maxelem=200000 + entries: +``` + +第二条命令将输出所有的子网,这些子网是基于被封杀的国家而添加的,可能会相当长。 + +### 那么现在我该怎么做? + +虽然在开始的时候,监控的频率会比较高,但随着时间的推移,入侵尝试的次数应该会随着黑名单的增加而减少。那么目标应该是维护而不是主动监控。 + +为此,我创建了一个 SystemD 服务文件和定时器,这样每月都会刷新由 ipdeny 维护的每个国家的子网。事实上,这里讨论的所有内容都可以从我的 [pagure.io](https://pagure.io/firewalld-blacklist) 项目中下载。 + +是不是很高兴你看完了整篇文章?现在只要把服务文件和定时器下载到 `/etc/systemd/system/`,并启用定时器就行了: + +``` +$ sudo systemctl daemon-reload +$ sudo systemctl enable --now firewalld-blacklist.timer +``` + +-------------------------------------------------------------------------------- + +via: https://fedoramagazine.org/protect-your-system-with-fail2ban-and-firewalld-blacklists/ + +作者:[hobbes1069][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://fedoramagazine.org/author/hobbes1069/ +[b]: https://github.com/lujun9972 +[1]: https://fedoramagazine.org/wp-content/uploads/2020/06/fail2ban-and-firewalld-816x345.png +[2]: https://www.linode.com/community/questions/11143/top-tip-firewalld-and-ipset-country-blacklist diff --git a/published/202007/20200624 How to Disable Dock on Ubuntu 20.04 and Gain More Screen Space.md b/published/202007/20200624 How to Disable Dock on Ubuntu 20.04 and Gain More Screen Space.md new file mode 100644 index 0000000000..3ca4e2946f --- /dev/null +++ b/published/202007/20200624 How to Disable Dock on Ubuntu 20.04 and Gain More Screen Space.md @@ -0,0 +1,113 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12414-1.html) +[#]: subject: (How to Disable Dock on Ubuntu 20.04 and Gain More Screen Space) +[#]: via: (https://itsfoss.com/disable-ubuntu-dock/) +[#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/) + +如何在 Ubuntu 20.04 上禁用坞站(dock) +====== + +左侧的启动器已成为 [Ubuntu][1] 桌面的标识。它是在 [Unity 桌面][2]中引入的,甚至在 [Ubuntu 切换到 GNOME][3]时就有了,它复刻了 “Dash to Panel”,以在 [GNOME][4] 上创建一个类似的坞站dock。 + +就个人而言,我发现它对于快速访问常用应用非常方便,但并非所有人都希望它额外占用屏幕上的一些空间。 + +从 [Ubuntu 20.04][5] 开始,你可以轻松禁用坞站。在本教程中,让我向你展示如何以图形和命令的方式执行此操作。 + +![][6] + +### 通过扩展应用禁用 Ubuntu Dock + +[Ubuntu 20.04 的主要功能][7]之一是引入“扩展Extension”应用来管理系统上的 GNOME 扩展。只需在 GNOME 菜单中查找它(按下 Windows 键并输入): + +![Look for Extensions app in the menu][8] + +> 没有找到扩展应用? +> +> 如果尚未安装,你应该启用 GNOME Shell 扩展,“扩展” GUI 是此软件包的一部分。 +> +> ``` +> sudo apt install gnome-shell-extensions +> ``` +> +> 这仅对 [GNOME 3.36][9] 或 Ubuntu 20.04(或更高版本) 中的更高版本有效。 + +启动“扩展”应用,你应该在“内置”扩展下看到 Ubuntu Dock。你只需要关闭即可禁用坞站。 + +![Disable Ubuntu Dock][10] + +更改是即时的,你会看到坞站立即消失。 + +你可以用相同的方式恢复。只需打开它,它就会立即显示。 + +在 Ubuntu 20.04 中非常容易隐藏坞站,不是吗? + +### 替代方法:通过命令行禁用 Ubuntu 坞站 + +如果你是终端爱好者,并且喜欢在终端中做事,那么我有一个对你而言的好消息。你可以从命令行禁用 Ubuntu 坞站。 + +使用 `Ctrl+Alt+T` 打开终端。你可能已经知道 [Ubuntu 中的键盘快捷键][11]。 + +在终端中,使用以下命令列出所有可用的 GNOME 扩展: + +``` +gnome-extensions list +``` + +这将显示类似于以下的输出: + +![List GNOME Extensions][12] + +默认的 Ubuntu 坞站扩展是 `ubuntu-dock@ubuntu.com`。你可以使用以下命令将其禁用: + +``` +gnome-extensions disable ubuntu-dock@ubuntu.com +``` + +屏幕上不会显示任何输出,但是你会注意到启动器(坞站)从左侧消失了。 + +如果需要,你可以使用与上面相同的命令再次启用它,但使用启用选项: + +``` +gnome-extensions enable ubuntu-dock@ubuntu.com +``` + +### 总结 + +在 Ubuntu 18.04 中也有禁用坞站的方法。但是,如果你尝试在 18.04 中删除它,这可能会导致不想要的结果。删除此软件包也会删除 ubuntu-desktop 包,最终可能会导致系统崩溃,例如没有应用菜单。 + +这就是为什么我不建议在 Ubuntu 18.04 上删除它的原因。 + +好消息是 Ubuntu 20.04 提供了一种隐藏任务栏的方法。用户拥有更大的自由度和更多的屏幕空间。说到更多的屏幕空间,你是否知道可以[从 Firefox 移除顶部标题栏并获得更多的屏幕空间][14]? + +我想知道你喜欢怎样的 Ubuntu 桌面?要坞站,不要坞站,还是不要 GNOME? + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/disable-ubuntu-dock/ + +作者:[Abhishek Prakash][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://itsfoss.com/author/abhishek/ +[b]: https://github.com/lujun9972 +[1]: https://ubuntu.com/ +[2]: https://itsfoss.com/keeping-ubuntu-unity-alive/ +[3]: https://itsfoss.com/ubuntu-unity-shutdown/ +[4]: https://www.gnome.org/ +[5]: https://itsfoss.com/download-ubuntu-20-04/ +[6]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/06/disable-dock-in-ubuntu.png?ssl=1 +[7]: https://itsfoss.com/ubuntu-20-04-release-features/ +[8]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/06/GNOME-extensions-app-ubuntu.jpg?ssl=1 +[9]: https://itsfoss.com/gnome-3-36-release/ +[10]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/06/disable-ubuntu-dock.png?ssl=1 +[11]: https://itsfoss.com/ubuntu-shortcuts/ +[12]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/06/list-gnome-extensions.png?ssl=1 +[13]: https://itsfoss.com/cdn-cgi/l/email-protection +[14]: https://itsfoss.com/remove-title-bar-firefox/ diff --git a/published/202007/20200625 How to stress test your Linux system.md b/published/202007/20200625 How to stress test your Linux system.md new file mode 100644 index 0000000000..a9cc40f818 --- /dev/null +++ b/published/202007/20200625 How to stress test your Linux system.md @@ -0,0 +1,208 @@ +[#]: collector: (lujun9972) +[#]: translator: (wxy) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12389-1.html) +[#]: subject: (How to stress test your Linux system) +[#]: via: (https://www.networkworld.com/article/3563334/how-to-stress-test-your-linux-system.html) +[#]: author: (Sandra Henry-Stocker https://www.networkworld.com/author/Sandra-Henry_Stocker/) + +如何对你的 Linux 系统进行压力测试 +====== + +> 如果你想了解 Linux 服务器在重压之下的运行情况,那么给 Linux 服务器施加压力是个不错的主意。在这篇文章中,我们将看一些工具,可以帮助你增加服务器压力并衡量结果。 + +![](https://images.idgesg.net/images/article/2020/06/stress-test2_linux-penguin-stress-ball_hand-squeezing_by-digitalsoul-getty-images_1136841639-100850120-large.jpg) + +为什么你会想给你的 Linux 系统施加压力呢?因为有时你可能想知道当一个系统由于大量运行的进程、繁重的网络流量、过多的内存使用等原因而承受很大的压力时,它的表现如何。这种压力测试可以帮助确保系统已经做好了 “上市” 的准备。 + +如果你需要预测应用程序可能需要多长时间才能做出反应,以及哪些(如果有的话)进程可能会在重负载下失败或运行缓慢,那么在前期进行压力测试是一个非常好的主意。 + +幸运的是,对于那些需要能够预测 Linux 系统在压力下的反应的人来说,你可以采用一些有用的技术和工具来使这个过程更容易。在这篇文章中,我们将研究其中的一些。 + +### 自己动手做个循环 + +第一种技术是在命令行上运行一些循环,观察它们对系统的影响。这种方式可以大大增加 CPU 的负荷。使用 `uptime` 或类似的命令可以很容易地看到结果。 + +在下面的命令中,我们启动了四个无尽循环。你可以通过添加数字或使用 bash 表达式,如 `{1...6}` 来代替 `1 2 3 4` 以增加循环次数: + +``` +for i in 1 2 3 4; do while : ; do : ; done & done +``` + +在命令行上输入后,将在后台启动四个无尽循环: + +``` +$ for i in 1 2 3 4; do while : ; do : ; done & done +[1] 205012 +[2] 205013 +[3] 205014 +[4] 205015 +``` + +在这种情况下,发起了作业 1-4,作业号和进程号会相应显示出来。 + +要观察对平均负载的影响,请使用如下所示的命令。在本例中,`uptime` 命令每 30 秒运行一次: + +``` +$ while true; do uptime; sleep 30; done +``` + +如果你打算定期运行这样的测试,你可以将循环命令放入脚本 `watch-it` 中。 + +``` +#!/bin/bash + +while true +do + uptime + sleep 30 +done +``` + +在输出中,你可以看到平均负载是如何增加的,然后在循环结束后又开始下降。 + +``` + 11:25:34 up 5 days, 17:27, 2 users, load average: 0.15, 0.14, 0.08 + 11:26:04 up 5 days, 17:27, 2 users, load average: 0.09, 0.12, 0.08 + 11:26:34 up 5 days, 17:28, 2 users, load average: 1.42, 0.43, 0.18 + 11:27:04 up 5 days, 17:28, 2 users, load average: 2.50, 0.79, 0.31 + 11:27:34 up 5 days, 17:29, 2 users, load average: 3.09, 1.10, 0.43 + 11:28:04 up 5 days, 17:29, 2 users, load average: 3.45, 1.38, 0.54 + 11:28:34 up 5 days, 17:30, 2 users, load average: 3.67, 1.63, 0.66 + 11:29:04 up 5 days, 17:30, 2 users, load average: 3.80, 1.86, 0.76 + 11:29:34 up 5 days, 17:31, 2 users, load average: 3.88, 2.06, 0.87 + 11:30:04 up 5 days, 17:31, 2 users, load average: 3.93, 2.25, 0.97 + 11:30:34 up 5 days, 17:32, 2 users, load average: 3.64, 2.35, 1.04 <== 循环停止 + 11:31:04 up 5 days, 17:32, 2 users, load average: 2.20, 2.13, 1.01 11:31:34 up 5 days, 17:33, 2 users, load average: 1.40, 1.94, 0.98 +``` + +因为所显示的负载分别代表了 1、5 和 15 分钟的平均值,所以这些值需要一段时间才能恢复到系统接近正常的状态。 + +要停止循环,请发出像下面这样的 `kill` 命令 —— 假设作业号是 1-4,就像本篇文章前面显示的那样。如果你不确定,可以使用 `jobs` 命令来确认作业号。 + +``` +$ kill %1 %2 %3 %4 +``` + +### 增加压力的专用工具 + +另一种方法是使用专门为你制造系统压力的工具。其中一种叫做 `stress`(压力),可以以多种方式对系统进行压力测试。`stress` 工具是一个工作负载生成器,提供 CPU、内存和磁盘 I/O 压力测试。 + +在使用 `--cpu` 选项时,`stress` 命令使用平方根函数强制 CPU 努力工作。指定的 CPU 数量越多,负载上升的速度就越快。 + +下面第二个脚本(`watch-it-2`)可以用来衡量对系统内存使用的影响。请注意,它使用 `free` 命令来查看加压的效果。 + +``` +$ cat watch-it-2 +#!/bin/bash + +while true +do + free + sleep 30 +done +``` + +发起任务并观察压力: + +``` +$ stress --cpu 2 + +$ ./watch-it + 13:09:14 up 5 days, 19:10, 2 users, load average: 0.00, 0.00, 0.00 + 13:09:44 up 5 days, 19:11, 2 users, load average: 0.68, 0.16, 0.05 + 13:10:14 up 5 days, 19:11, 2 users, load average: 1.20, 0.34, 0.12 + 13:10:44 up 5 days, 19:12, 2 users, load average: 1.52, 0.50, 0.18 + 13:11:14 up 5 days, 19:12, 2 users, load average: 1.71, 0.64, 0.24 + 13:11:44 up 5 days, 19:13, 2 users, load average: 1.83, 0.77, 0.30 +``` + +在命令行中指定的 CPU 越多,负载就增加的越快。 + +``` +$ stress --cpu 4 +$ ./watch-it + 13:47:49 up 5 days, 19:49, 2 users, load average: 0.00, 0.00, 0.00 + 13:48:19 up 5 days, 19:49, 2 users, load average: 1.58, 0.38, 0.13 + 13:48:49 up 5 days, 19:50, 2 users, load average: 2.61, 0.75, 0.26 + 13:49:19 up 5 days, 19:50, 2 users, load average: 3.16, 1.06, 0.38 + 13:49:49 up 5 days, 19:51, 2 users, load average: 3.49, 1.34, 0.50 + 13:50:19 up 5 days, 19:51, 2 users, load average: 3.69, 1.60, 0.61 +``` + +`stress` 命令也可以通过 `--io`(输入/输出)和 `--vm`(内存)选项增加 I/O 和内存的负载来给系统施加压力。 + +在接下来的这个例子中,运行这个增加内存压力的命令,然后启动 `watch-it-2` 脚本。 + +``` +$ stress --vm 2 + +$ watch-it-2 + total used free shared buff/cache available +Mem: 6087064 662160 2519164 8868 2905740 5117548 +Swap: 2097148 0 2097148 + total used free shared buff/cache available +Mem: 6087064 803464 2377832 8864 2905768 4976248 +Swap: 2097148 0 2097148 + total used free shared buff/cache available +Mem: 6087064 968512 2212772 8864 2905780 4811200 +Swap: 2097148 0 2097148 +``` + +`stress` 的另一个选项是使用 `--io` 选项为系统添加输入/输出活动。在这种情况下,你可以使用这样的命令: + +``` +$ stress --io 4 +``` + +然后你可以使用 `iotop` 观察受压的 I/O。注意,运行 `iotop` 需要 root 权限。 + +之前: + +``` +$ sudo iotop -o +Total DISK READ: 0.00 B/s | Total DISK WRITE: 19.36 K/s +Current DISK READ: 0.00 B/s | Current DISK WRITE: 27.10 K/s + TID PRIO USER DISK READ DISK WRITE SWAPIN IO> COMMAND + 269308 be/4 root 0.00 B/s 0.00 B/s 0.00 % 1.24 % [kworker~fficient] + 283 be/3 root 0.00 B/s 19.36 K/s 0.00 % 0.26 % [jbd2/sda1-8] +``` + +之后: + +``` +Total DISK READ: 0.00 B/s | Total DISK WRITE: 0.00 B/s +Current DISK READ: 0.00 B/s | Current DISK WRITE: 0.00 B/s + TID PRIO USER DISK READ DISK WRITE SWAPIN IO> COMMAND + 270983 be/4 shs 0.00 B/s 0.00 B/s 0.00 % 51.45 % stress --io 4 + 270984 be/4 shs 0.00 B/s 0.00 B/s 0.00 % 51.36 % stress --io 4 + 270985 be/4 shs 0.00 B/s 0.00 B/s 0.00 % 50.95 % stress --io 4 + 270982 be/4 shs 0.00 B/s 0.00 B/s 0.00 % 50.80 % stress --io 4 + 269308 be/4 root 0.00 B/s 0.00 B/s 0.00 % 0.09 % [kworker~fficient] +``` + +`stress` 只是给系统增加压力的若干工具之一。另一个较新的工具,`stress-ng`,将在以后的文章中介绍。 + +### 总结 + +用于系统压力测试的各种工具可以帮助你预测系统在真实世界的情况下如何响应,在这些情况下,它们受到增加的流量和计算需求。 + +虽然我们在文章中展示的是创建和测量各种类型的压力的方法,但最终的好处是压力如何帮助确定你的系统或应用程序对它的反应。 + +-------------------------------------------------------------------------------- + +via: https://www.networkworld.com/article/3563334/how-to-stress-test-your-linux-system.html + +作者:[Sandra Henry-Stocker][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.networkworld.com/author/Sandra-Henry_Stocker/ +[b]: https://github.com/lujun9972 +[1]: https://www.networkworld.com/newsletters/signup.html +[2]: https://www.facebook.com/NetworkWorld/ +[3]: https://www.linkedin.com/company/network-world diff --git a/published/202007/20200625 Make Bash history more useful with these tips.md b/published/202007/20200625 Make Bash history more useful with these tips.md new file mode 100644 index 0000000000..1757367d61 --- /dev/null +++ b/published/202007/20200625 Make Bash history more useful with these tips.md @@ -0,0 +1,146 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12381-1.html) +[#]: subject: (Make Bash history more useful with these tips) +[#]: via: (https://opensource.com/article/20/6/bash-history-control) +[#]: author: (Seth Kenlon https://opensource.com/users/seth) + +这些技巧让 Bash 命令历史更加有用 +====== + +> 告诉 Bash 你想要它记住什么,甚至删除不需要的记录重写历史。 + +![](https://img.linux.net.cn/data/attachment/album/202007/05/091205hkg0egl2gge2gx9z.jpg) + +运行 [Bash][2] 的 Linux 终端有内置的历史记录,你可以用来跟踪最近的操作。要查看你的 Bash 会话的历史记录,请使用内置命令 `history`: + +``` +$ echo "foo" +foo +$ echo "bar" +bar +$ history +  1  echo "foo" +  2  echo "bar" +  3  history +``` + +与大多数命令不一样,`history` 命令不是文件系统上的可执行文件,而是 Bash 的功能。你可以使用 `type` 命令来验证: + +``` +$ type history +history is a shell builtin +``` + +### 历史控制 + +shell 历史记录的行数上限由 `HISTSIZE` 变量定义。你可以在 `.bashrc` 文件中设置此变量。以下将你的历史记录设置为 3,000 行,之后将最早的行删除以为最新命令腾出空间,该命令位于列表的底部: + +``` +export HISTSIZE=3000 +``` + +还有其他与历史相关的变量。 `HISTCONTROL` 变量控制哪些历史被记录。你可以在 `.bashrc` 中写入下面的行来强制 Bash 排除以空格开头的命令: + +``` +export HISTCONTROL=$HISTCONTROL:ignorespace +``` + +现在,如果你输入以空格开头的命令,那么它将不会记录在历史记录中: + +``` +$ echo "hello" +$     mysql -u bogus -h badpassword123 mydatabase +$ echo "world" +$ history +  1  echo "hello" +  2  echo "world" +  3  history +``` + +你也可以避免重复的条目: + +``` +export HISTCONTROL=$HISTCONTROL:ignoredups +``` + +现在,如果你一个接着一个输入两个命令,历史记录中只会显示一个: + +``` +$ ls +$ ls +$ ls +$ history +  1  ls +  2  history +``` + +如果你喜欢这两个忽略功能,那么可以使用 `ignoreboth`: + +``` +export HISTCONTROL=$HISTCONTROL:ignoreboth +``` + +### 从历史记录中删除命令 + +有时你会犯一个错误,在 shell 中输入了一些敏感内容,或者你​​只是想清理历史记录,以便它更准确地表示让某件事正常工作所采取的步骤。如果要从 Bash 的历史记录中删除命令,请在要删除的项目的行号上使用 `-d` 选项: + +``` +$ echo "foo" +foo +$ echo "bar" +bar +$ history | tail +  535  echo "foo" +  536  echo "bar" +  537  history | tail +$ history -d 536 +$ history | tail +  535  echo "foo" +  536  history | tail +  537  history -d 536 +  538  history | tail +``` + +要停止添加 `history` 条目,只要在 `HISTCONTROL` 环境变量中有 `ignorespace`,就可以在命令前添加空格: + +``` +$  history | tail +  535  echo "foo" +  536  echo "bar" +$  history -d 536 +$  history | tail +  535  echo "foo" +``` + +你可以使用 `-c` 选项清除所有会话历史记录: + +``` +$ history -c +$  history +$ +``` + +### history 命令的经验 + +操纵历史通常没有听起来那么危险,尤其是当你有目标地管理它时。例如,如果你要记录一个复杂的问题,通常最好使用会话历史来记录命令,因为通过将命令插入历史记录,你能运行它们并从而测试过程。很多时候,不执行历史命令会导致忽略小的步骤或写错小细节。 + +按需使用历史会话,并明智地控制历史记录。享受历史修改吧! + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/6/bash-history-control + +作者:[Seth Kenlon][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/seth +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/computer_keyboard_laptop_development_code_woman.png?itok=vbYz6jjb (A person programming) +[2]: https://opensource.com/resources/what-bash diff --git a/published/202007/20200626 Docker and Fedora 32.md b/published/202007/20200626 Docker and Fedora 32.md new file mode 100644 index 0000000000..51d9073614 --- /dev/null +++ b/published/202007/20200626 Docker and Fedora 32.md @@ -0,0 +1,120 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12433-1.html) +[#]: subject: (Docker and Fedora 32) +[#]: via: (https://fedoramagazine.org/docker-and-fedora-32/) +[#]: author: (Kevin "Eonfge" Degeling https://fedoramagazine.org/author/eonfge/) + +在 Fedora 32 上运行 Docker +====== + +![][1] + +随着 Fedora 32 的发布,[Docker][2] 的普通用户面临着一个小挑战。在编写本文时,Fedora 32 不支持 Docker。虽然还有其他选择,例如 [Podman][3] 和 [Buildah][4],但是对于许多现有用户而言,现在切换可能不是最佳时机。因此,本文可以帮助你在 Fedora 32 上设置 Docker 环境。 + +### 步骤 0:消除冲突 + +此步骤适用于从 Fedora 30 或 31 升级的任何用户。如果全新安装的 Fedora 32,那么可以跳到步骤 1。 + +删除 docker 及其所有相关组件: + +``` +sudo dnf remove docker-* +sudo dnf config-manager --disable docker-* +``` + +### 步骤 1:系统准备 + +在 Fedora 的最后两个版本中,操作系统已迁移到两项新技术: CGroups 和用于防火墙的 NFTables。尽管这些新技术的详细信息不在本教程的讨论范围之内,但是令人遗憾的是,Docker 还不支持这些新技术。因此,你必须进行一些更改才能在 Fedora 上使用 Docker。 + +#### 启用旧的 CGroups + +Fedora 仍然支持 CGroups 的先前实现,可以使用以下命令启用它: + +``` +sudo grubby --update-kernel=ALL --args="systemd.unified_cgroup_hierarchy=0" +``` + +#### 在防火墙中将 Docker 列入白名单 + +为了让 Docker 具有网络访问权限,需要两个命令: + +``` +sudo firewall-cmd --permanent --zone=trusted --add-interface=docker0 +sudo firewall-cmd --permanent --zone=FedoraWorkstation --add-masquerade +``` + +第一个命令将 Docker 接口添加到受信任的环境,它允许 Docker 建立远程连接。第二个命令将允许 Docker 建立本地连接。当有多个 Docker 容器作为开发环境时,这特别有用。 + +### 步骤 2:安装 Moby + +[Moby][5] 是 Docker 的开源白牌版本。它基于相同的代码,但不带商标。它包含在 Fedora 的主仓库中,因此很容易安装: + +``` +sudo dnf install moby-engine docker-compose +``` + +这将安装 `moby-engine`、`docker-compose`、`containerd` 和其他一些相关的库。安装完成后,你必须启用系统级守护程序才能运行 Docker: + +``` +sudo systemctl enable docker +``` + +### 步骤 3:重新启动并测试 + +为了确保正确处理所有系统和设置,你现在必须重启计算机: + +``` +sudo systemctl reboot +``` + +之后,你可以使用 Docker hello-world 包来验证安装: + +``` +sudo docker run hello-world +``` + +除非遇到问题,不然你就会看到来自 Docker 的问候! + +#### 以管理员身份运行 + +可选地,你现在还可以将用户添加到 Docker 的组帐户中,以便无需输入 `sudo` 即可启动 Docker 镜像: + +``` +sudo groupadd docker +sudo usermod -aG docker $USER +``` + +注销并登录以使更改生效。如果以管理员权限运行容器的想法让你有所顾虑,那么你应该研究 Podman。 + +### 总结 + +从现在起,Docker 将按照你的习惯工作,包括 `docker-compose` 和所有与 `docker` 相关的工具。不要忘记查看官方文档,这在很多情况下可以为你提供帮助。 + +Fedora 32 上 Docker 的当前状态并不理想。缺少官方软件包可能会困扰一些人,有一个[上游问题][6]对此进行了讨论。对 [CGroups][7] 和 [NFTables][8] 缺少支持更多是技术问题,但是你可以查看它们在其公共问题上的进展。 + +这些指导应可以让你就像什么都没有发生一样继续工作。如果这不能满足你的需求,请不要忘记到 Moby 或 Docker Github 页面去寻求解决你的技术问题,或者看看 Podman,长期来看,它可能会更加强大。 + +-------------------------------------------------------------------------------- + +via: https://fedoramagazine.org/docker-and-fedora-32/ + +作者:[Kevin "Eonfge" Degeling][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://fedoramagazine.org/author/eonfge/ +[b]: https://github.com/lujun9972 +[1]: https://fedoramagazine.org/wp-content/uploads/2020/06/f32-04-twilight-816x459.png +[2]: https://docs.docker.com/ +[3]: https://podman.io/getting-started/ +[4]: https://buildah.io/ +[5]: https://mobyproject.org/ +[6]: https://github.com/docker/for-linux/issues/955 +[7]: https://github.com/moby/moby/issues/40360 +[8]: https://github.com/moby/moby/issues/26824 diff --git a/published/202007/20200626 Open source tools for translating British to American English.md b/published/202007/20200626 Open source tools for translating British to American English.md new file mode 100644 index 0000000000..a2f1f35abb --- /dev/null +++ b/published/202007/20200626 Open source tools for translating British to American English.md @@ -0,0 +1,77 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12430-1.html) +[#]: subject: (Open source tools for translating British to American English) +[#]: via: (https://opensource.com/article/20/6/british-american-cli-translator) +[#]: author: (Jeff Macharyas https://opensource.com/users/jeffmacharyas) + +将英式英语翻译成美式英语的开源工具 +====== + +> 使用这些命令行翻译器将英式英语转换为美式英语(或反之)。 + +![Red telephone booth on a street in England][1] + +去年圣诞节,我和我的妻子去了家乡佛罗里达的皮尔斯堡,并且经常光顾海滩上的一家当地人场所。在那儿,我们遇到了一对来自英国中部地区的夫妇。音乐很响,喝酒也很闹,所以很难听清楚。另外,即使他们“似乎”在说英语,但有时理解他们在说什么仍然是一个挑战。我以为我在澳大利亚的时光会给我足够的语言能力,但是,可惜,很多东西都超出了我的想象。不止是一般的 “soccer 是 football” 或 “trunk是 boot” 之类的困惑。 + +幸运的是,有开源方案可以将“英式”翻译成“美式”。我们可能使用相同的语言,但是我们共同的言语却比多塞特郡沙夫茨伯里的之字形山要曲折得多! + +如果你碰巧在酒吧有 Linux 笔记本,那么你可以使用方便的开源命令行程序,它就叫 [美英英语翻译器][2](MIT 许可证)。 + +我在我的改造运行 Linux 的 MacBook 上安装这个翻译器: + +``` +$ npm install -g american-british-english-translator +``` + +这需要我首先[安装 Node.js][3]。 + +### 声明! + +除了翻译单词和短语,美英英语翻译器还能分析(嗯,剖析)文档。我用一个叫《独立宣言》的流行文件试了一下。它分析并返回了许多结果。其中一个比较有趣的是: + +``` +fall: +issue: Different meanings(意思不同) +details: +American English: autumn(秋天) +British English: +""" +to become pregnant. (Either as in 'I fell pregnant' or as in 'She fell for a baby.');(怀孕 —— 无论是“我怀孕了”还是“她怀孕了”) +``` + +并非如《宣言》作者所指控的“在公海俘虏”(taken captive on the high seas): + +> ”他在公海上俘虏我们的同胞,强迫他们拿起武器来反对自己的国家,成为残杀自己亲人和朋友的刽子手,或是死于自己的亲人和朋友的手下。“(He has constrained our fellow Citizens taken Captive on the high Seas to bear Arms against their Country, to become the executioners of their friends and Brethren, or to fall themselves by their Hands.) + +### 还有一个 + +对于简单的单词替换,你可以尝试 [Common_Language][4],这是一个开源(MIT 许可)Python 脚本。 + +当然,要与同伴一起喝几杯,你也许需要实际交流,并能理解他们。这就是需要用到 MARY 了。 + +[MaryTTS][5] 是一个使用 Java(GNU 许可)编写的开源多语言文本到语音合成平台。方便的[基于浏览器的界面][6]使你可以轻松地将美国酒吧谈话内容转换为男声或女声的正确英语(或其他语言)。 + +现在我可以和我的英国朋友们见面了(可以安全地再来一次),喝几杯!像当地人一样讲英语!大家干杯! + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/6/british-american-cli-translator + +作者:[Jeff Macharyas][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/jeffmacharyas +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/england-telephone-booth-street.jpg?itok=JQsc_piX (Red telephone booth on a street in England) +[2]: https://github.com/hyperreality/American-British-English-Translator +[3]: https://nodejs.org/en/download/ +[4]: https://github.com/willettk/common_language +[5]: https://github.com/marytts/marytts +[6]: http://mary.dfki.de:59125/ diff --git a/published/202007/20200627 An open source browser extension to zoom in on images.md b/published/202007/20200627 An open source browser extension to zoom in on images.md new file mode 100644 index 0000000000..bc056c0938 --- /dev/null +++ b/published/202007/20200627 An open source browser extension to zoom in on images.md @@ -0,0 +1,51 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12384-1.html) +[#]: subject: (An open source browser extension to zoom in on images) +[#]: via: (https://opensource.com/article/20/6/hoverzoom) +[#]: author: (Jeff Macharyas https://opensource.com/users/jeffmacharyas) + +一个可放大图像的开源的浏览器扩展 +====== + +> 想细看网络图像并不总是那么简单,但是 Hover Zoom+ 让它像鼠标滑动一样容易。 + +![Digital images of a computer desktop][1] + +你是否曾经在访问网站时希望查看更大的图像?我经常遇到这种情况,而要做到这点并不总是那么容易。 + +有时,我在源码中筛选,使用 `Ctrl + F` 搜索图像,复制图像源地址并将其粘贴到新窗口中,以便以全尺寸查看图像。或者,另一个选择是右键单击,复制图像地址,然后粘贴到新选项卡中。 + +![Example image source code ][2] + +Hover Zoom+ 让这个过程更加简单。Hover Zoom+ 是一个简单 Chrome 扩展程序,在 MIT 许可证下发布,可在 Chrome 商店中找到,它的源码可在 [GitHub][3] 上获得。它也适用于 Firefox。 + +这个应用使得该过程更加容易。只需将鼠标悬停在图像上,你将看到一个弹出窗口来显示该图像的全部内容,它会匹配你的浏览器窗口,无论图像是否被裁剪(或者图像尺寸适当,它看上去会是一样的)。这可能很有趣,因为有时可能会裁剪原始图像,以适应空间或聚焦于图像的特定部分。但是,你无法右键单击并直接从弹出窗口中保存图像。 + +根据加州圣何塞的开发人员 Oleg Anashkin 的说法,“这是原始 HoverZoom 扩展的开源版本,现已被恶意软件所占领,并被从商店中删除。在此版本中,所有间谍软件均已删除,许多 bug 已被修复,并添加了新功能。它默认不会收集任何统计信息。” + +我在 Windows 10 笔记本上的 Chrome 中安装了此扩展,然后试用了一下。安装扩展后,我将鼠标悬停在图像上,它在弹出窗口中显示了比实际更大的图像。 + +但是,Hover Zoom+ 不适用于所有网站或所有图像。它适用于 Facebook 和 Twitter,但不适用于这些网站上的赞助内容。用户可以轻松切换该应用以针对特定站点启用或禁用它。使用 Hover Zoom+ 可以很容易地看到 Instagram 上的这只可爱小猫而无需实际阅读帖子(方便!): + +![Zoomed-in image of a kitten from Facebook][4] + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/6/hoverzoom + +作者:[Jeff Macharyas][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/jeffmacharyas +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/computer_browser_web_desktop.png?itok=Bw8ykZMA (Digital images of a computer desktop) +[2]: https://opensource.com/sites/default/files/uploads/source.jpg (Example image source code) +[3]: https://github.com/extesy/hoverzoom/ +[4]: https://opensource.com/sites/default/files/uploads/fb-cat.jpg (HoverZoom+ enlarged image) diff --git a/published/202007/20200627 Learn Shell Scripting for Free With These Resources -PDF, Video Courses and Interactive Websites.md b/published/202007/20200627 Learn Shell Scripting for Free With These Resources -PDF, Video Courses and Interactive Websites.md new file mode 100644 index 0000000000..a4bcd85506 --- /dev/null +++ b/published/202007/20200627 Learn Shell Scripting for Free With These Resources -PDF, Video Courses and Interactive Websites.md @@ -0,0 +1,178 @@ +[#]: collector: (lujun9972) +[#]: translator: (Yufei-Yan) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12379-1.html) +[#]: subject: (Learn Shell Scripting for Free With These Resources [PDF, Video Courses and Interactive Websites]) +[#]: via: (https://itsfoss.com/shell-scripting-resources/) +[#]: author: (Ankush Das https://itsfoss.com/author/ankush/) + +学习 Shell 脚本编程的免费资源 +====== + +> 你想学习 shell 脚本编程吗?或者你想提升现有的 bash 知识?我收集了以下免费的资源来帮助你学习 shell 脚本编程。 + +(LCTT 译注:毫无疑问,这些都是英文的) + +shell 是一个命令行解释器,它允许你输入命令并获得输出。当你在使用终端的时候,你就已经在看 shell 了。 + +是的,shell 是一个你可以和它进行交互的命令行界面,你可以通过它给操作系统某种指令。虽然有不同类型的 shell,但是 [bash][1](GNU Bourne-Again Shell)是在各 Linux 发行版中最流行的。 + +当谈到 shell 脚本编程的时候,也就意味着 —— 用户希望使用脚本来执行多条命令来获得一个输出。 + +也许你需要学习 shell 脚本编程作为你的课程或者工作的一部分。了解 shell 脚本编程也可以帮助你在 Linux 中自动化某些重复的任务。 + +不管出于什么原因学习 shell 脚本编程,都可以看看这些我给你展示的资源。 + +### 最好的免费学习 shell 脚本编程的资源 + +![][2] + +还没在你的系统上安装 Linux?不用担心。有很多种方法[在 Windows 上使用 Linux 终端][3]。你也可以在某些情况下[使用在线 Linux 终端][4]来练习 shell 脚本编程。 + +#### 1、学习 Shell —— 互动网站 + +![][5] + +如果你正在找一个互动网站来学习 shell 脚本编程,并且还可以在线试试,“[学习 Shell][6]” 是一个不错的起点。 + +它涵盖了基础知识,并且也提供了一些高级的练习。通常,内容还是简明扼要的 —— 因此,我建议你看看这个网站。 + +#### 2、Shell 脚本编程教程 —— 门户网站 + +![][7] + +“[Shell 脚本编程教程][8]” 是一个完全专注于 shell 脚本编程的网站。你可以选择免费阅读其中的资源,也可以购买 PDF、实体书籍和电子书来支持他们。 + +当然,花钱买纸质的版本或者电子书不是强制的。但是,这些免费资源查看起来还是很方便的。 + +#### 3、Udemy:Shell 脚本 —— 免费视频课程 + +![][9] + +毫无疑问,[Udemy][10] 是最受欢迎的在线课程平台之一。而且,除了付费认证课程之外,它还提供了不包含证书的免费内容。 + +“[Shell 脚本][11]” 是 Udemy 上推荐度最高的免费课程之一。你不需要花费任何费用就可以注册这门课。 + +#### 4、Udemy:Bash Shell 脚本编程 —— 免费视频课程 + +![][12] + +Udemy 上另一个专注于 [bash shell 脚本编程][29]的有趣且免费的课程。与前面提到的课程相比,这个资源似乎更受欢迎。所以,你可以注册这门课,看看它都教些什么。 + +别忘了 Udemy 的免费课程不能提供证书。但是,它确实是一个让人印象深刻的免费 shell 脚本编程学习资源。 + +#### 5、Bash 研究院 —— 互动游戏在线门户 + +![][13] + +顾名思义,“[Bash 研究院][15]” 专注于向用户提供 bash shell 的教学。 + +尽管它没有很多的内容,它还是非常适合初学者和有一定经验的用户。不仅仅局限于指导 —— 它也可以提供交互式的游戏来练习,不过目前已经不能用了。 + +因此,如果这个足够有趣,你可以去看看这个 [Github 页面][14],并且如果你愿意的话,还可以复刻它并对现有资源进行改进。 + +#### 6、LinkedIn:学习 Bash 脚本编程 —— 免费视频课程 + +![][16] + +LinkedIn 提供了大量免费课程来帮助你提成技能,并且为更多工作做好准备。你还可以找到一些专注于 shell 脚本编程的课程,这些课程有助于重温基本技能或者这个过程中获得一些高级技能。 + +在这里,我提供一个 [学习 Bash 脚本编程][17] 的课程链接,你还可以发现其他类似的免费课程。 + +#### 7、高级 Bash 脚本编程指南 —— 免费 PDF 书籍 + +![][18] + +这是一个令人印象深刻的《[高级 Bash 脚本编程指南][19]》,并且可以免费获得到它的 PDF 版本。这个 PDF 资源没有版权限制,在公开领域是完全免费的。 + +尽管这个资源主要是提供高级的知识,通过参考这个 PDF 并且开始学习 shell 脚本编程,它还是很适合初学者的。 + +#### 8、专业 Bash 笔记 —— 免费 PDF 书籍 + +![][20] + +如果你已经对 Bash Shell 脚本编程比较熟悉或者只是想快速总结一下,那这是一个很好的参考。 + +这个《[专业 Bash 笔记][21]》可以免费下载的书有 100 多页,通过简单的描述和例子,这本书涵盖了各种各样的主题。 + +#### 9、Tutorialspoint —— 门户网站 + +![][22] + +“[Tutorialspoint][24]” 是一个非常流行的学习各种编程语言的门户网站。我想说这对于初学者学习基础知识非常好。 + +也许这不太适合作为一个详细的资源——但是它应该是不错的免费资源。 + +#### 10、旧金山城市学院:在线笔记 —— 门户网站 + +![][25] + +也许这不是最好的免费资源 —— 但是如果你已经为学习 shell 脚本编程做好了探索每种资源的准备,为什么不看看旧金山城市学院的 “[在线笔记][26]” 呢? + +当我在网上随便搜索关于 shell 脚本编程的资源的时候,我偶然遇到到了这个资源。 + +同样需要注意的是,这个在线笔记可能会有点过时。但是,这应该还是一个值得探索的有趣资源。 + +#### 荣誉奖: Linux 手册 + +![][27] + +不要忘记,bash 手册也应该是一个相当不错的免费资源,可以用它来查看命令和使用方法。 + +尽管它不是专门为你掌握 shell 脚本编程而量身打造的,它依然是一个你可以免费使用的重要网络资源。你可以选择访问在线手册,或者直接打开终端然后输入以下命令: + +``` +man bash +``` + +### 总结 + +有很多很受欢迎的付费资源,比如这些[最好的 Linux 书籍][28]。从网络上的一些免费资源开始学习 shell 脚本编程还是很方便的。 + +除了我提到的这些,我敢肯定网上还有不计其数的资源可以帮助你学习 shell 脚本编程。 + +你喜欢换上面提到的资源吗?如果你知道我可能错过的非常棒的免费资源,记得在下面评论区告诉我。 + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/shell-scripting-resources/ + +作者:[Ankush Das][a] +选题:[lujun9972][b] +译者:[Yufei-Yan](https://github.com/Yufei-Yan) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://itsfoss.com/author/ankush/ +[b]: https://github.com/lujun9972 +[1]: https://en.wikipedia.org/wiki/Bash_(Unix_shell) +[2]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/06/Learn-Shell-Scripting.png?ssl=1 +[3]: https://itsfoss.com/run-linux-commands-in-windows/ +[4]: https://itsfoss.com/online-linux-terminals/ +[5]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/06/learnshell.png?ssl=1 +[6]: https://www.learnshell.org/ +[7]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/06/shell-scripting-tutorial.png?ssl=1 +[8]: https://www.shellscript.sh/ +[9]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/06/shell-scripting-udemy.png?ssl=1 +[10]: https://www.udemy.com +[11]: https://www.udemy.com/course/shell-scripting-i/ +[12]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/06/bash-shell-scripting.png?ssl=1 +[13]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/06/the-bash-academy.png?ssl=1 +[14]: https://github.com/lhunath/guide.bash.academy +[15]: https://guide.bash.academy/ +[16]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/06/learn-bash-scripting-linkedin.png?ssl=1 +[17]: https://www.linkedin.com/learning/learning-bash-scripting +[18]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/06/advanced-bash-scripting-pdf.png?ssl=1 +[19]: http://tldp.org/LDP/abs/abs-guide.pdf +[20]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/06/Bash-Notes-for-Professional.jpg?ssl=1 +[21]: https://goalkicker.com/BashBook/ +[22]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/06/tutorialspoint-shell.png?ssl=1 +[23]: https://en.wikipedia.org/wiki/Programming_language +[24]: https://www.tutorialspoint.com/unix/shell_scripting.htm +[25]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/06/scripting-notes-ccsf.png?ssl=1 +[26]: https://fog.ccsf.edu/~gboyd/cs160b/online/index.html +[27]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/06/bash-linux-man-page.png?ssl=1 +[28]: https://itsfoss.com/best-linux-books/ +[29]: https://www.udemy.com/course/complete-bash-shell-scripting/ \ No newline at end of file diff --git a/published/202007/20200628 How to crop images in GIMP -Quick Tip.md b/published/202007/20200628 How to crop images in GIMP -Quick Tip.md new file mode 100644 index 0000000000..df99b3db25 --- /dev/null +++ b/published/202007/20200628 How to crop images in GIMP -Quick Tip.md @@ -0,0 +1,78 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12427-1.html) +[#]: subject: (How to crop images in GIMP [Quick Tip]) +[#]: via: (https://itsfoss.com/crop-images-gimp/) +[#]: author: (Dimitrios Savvopoulos https://itsfoss.com/author/dimitrios/) + +GIMP 教程:如何使用 GIMP 裁剪图像 +====== + +你可能想在 [GIMP][1] 中裁剪图像的原因有很多。例如,你可能希望删除无用的边框或信息来改善图像,或者你可能希望最终图像的焦点是在一个特定细节上。 + +在本教程中,我将演示如何在 GIMP 中快速裁剪图像而又不影响精度。让我们一起来看看吧。 + +### 如何在 GIMP 中裁剪图像 + +![][2] + +#### 方法 1 + +裁剪只是一种将图像修整成比原始图像更小区域的操作。裁剪图像的过程很简单。 + +你可以通过“工具”面板访问“裁剪工具”,如下所示: + +![Use Crop Tool for cropping images in GIMP][3] + +你还可以通过菜单访问裁剪工具:“工具 → 变形工具 → 裁剪Tools → Transform Tools → Crop”。 + +激活该工具后,你会注意到画布上的鼠标光标会发生变化,以表示正在使用“裁剪工具”。 + +现在,你可以在图像画布上的任意位置单击鼠标左键,并将鼠标拖到某个位置以创建裁剪边界。此时你不必担心精度,因为你可以在实际裁剪之前修改最终选区。 + +![Crop Selection][4] + +此时,将鼠标光标悬停在所选内容的四个角上会更改鼠标光标并高亮显示该区域。现在,你可以微调裁剪的选区。你可以单击并拖动任何边或角来移动部分选区。 + +选定完区域后,你只需按键盘上的回车键即可进行裁剪。 + +如果你想重新开始或者不裁剪,你可以按键盘上的 `Esc` 键。 + +#### 方法 2 + +裁剪图像的另一种方法是使用“矩形选择工具”进行选择:“工具 → 选择工具 → 选择矩形Tools → Selection Tools → Rectangle Select”。 + +![][5] + +然后,你可以使用与“裁剪工具”相同的方式高亮选区,并调整选区。选择好后,可以通过以下方式裁剪图像来适应选区:“图像 → 裁剪为选区Image → Crop to Selection”。 + +![][6] + +### 总结 + +对于 GIMP 用户而言,精确裁剪图像可以视为一项基本功能。你可以选择哪种方法更适合你的需求并探索其潜力。 + +如果你对过程有任何疑问,请在下面的评论中告诉我。如果你“渴望”更多 [GIMP 教程][7],请确保在你喜欢的社交媒体平台上订阅! + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/crop-images-gimp/ + +作者:[Dimitrios Savvopoulos][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://itsfoss.com/author/dimitrios/ +[b]: https://github.com/lujun9972 +[1]: https://www.gimp.org/ +[2]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/06/Crop-images-in-GIMP.png?ssl=1 +[3]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/06/Crop-tool.png?ssl=1 +[4]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/06/Crop-selection.jpg?ssl=1 +[5]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/06/select-1.gif?ssl=1 +[6]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/06/crop.gif?ssl=1 +[7]: https://itsfoss.com/tag/gimp-tips/ diff --git a/published/202007/20200628 Linux Mint 20 is Officially Available Now- The Performance and Visual Improvements Make it an Exciting New Release.md b/published/202007/20200628 Linux Mint 20 is Officially Available Now- The Performance and Visual Improvements Make it an Exciting New Release.md new file mode 100644 index 0000000000..2ad86e500c --- /dev/null +++ b/published/202007/20200628 Linux Mint 20 is Officially Available Now- The Performance and Visual Improvements Make it an Exciting New Release.md @@ -0,0 +1,110 @@ +[#]: collector: (lujun9972) +[#]: translator: (wxy) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12376-1.html) +[#]: subject: (Linux Mint 20 is Officially Available Now! The Performance and Visual Improvements Make it an Exciting New Release) +[#]: via: (https://itsfoss.com/linux-mint-20-download/) +[#]: author: (Ankush Das https://itsfoss.com/author/ankush/) + +Linux Mint 20 正式发布了!你该升级吗? +====== + +![](https://img.linux.net.cn/data/attachment/album/202007/03/083110avnb4rwi0rwzh56r.jpg) + +Linux Mint 20 “Ulyana” 终于发布了,可以下载了。 + +Linux Mint 19 基于 Ubuntu 18.04 LTS,而 [Mint 20][1] 则基于 [Ubuntu 20.04 LTS][2] —— 所以你会发现很多不同的地方、改进的地方,可能更棒了。 + +既然它来了,让我们来看看它的新功能,在哪里下载它,以及如何升级你的系统。 + +### Linux Mint 20:有什么新东西? + +我们制作了一段关于 Linux Mint 20 的初步视觉印象的视频,让大家更好地了解。 + +- [video](https://youtu.be/7knHfN-NUZk) + +说到 Linux Mint 20 的发布,有很多事情要谈。虽然我们已经介绍了 Linux Mint 20 的新的关键[功能][1],但我还是在这里提几点,让大家一目了然。 + + * Nemo 文件管理器在生成缩略图方面的性能提升 + * 一些重新设计的颜色主题 + * Linux Mint 20 将禁止 APT 使用 Snapd + * 一个新的图形用户界面工具,用于通过本地网络共享文件 + * 改进对多显示器的支持 + * 改进对笔记本电脑的混合图形支持 + * 不再有 32 位版本 + +除了这些变化之外,你还会注意到 Cinnamon 4.6 桌面更新后的一些视觉变化。 + +以下是 Linux Mint 20 Cinnamon 版的一些截图。 + +![Mint 20 Welcome Screen][4] + +![Mint 20 Color Themes][5] + +![Mint 20 Nemo File Manager][6] + +![Mint 20 Nemo File Manager Blue Color Theme][7] + +![Mint 20 Wallpapers][8] + +![Mint 20 Redesigned Gdebi Installer][9] + +![Mint 20 Warpinator Tool for Sharing Files on Local Network][10] + +![Mint 20 Terminal][11] + +### 升级到 Linux Mint 20:你需要知道什么? + +如果你已经在使用 Linux Mint,你可以选择升级到 Linux Mint 20。 + + * 如果你使用的是 Linux Mint 20 测试版,你可以升级到 Mint 20 稳定版。 + * 如果你正在使用 Linux Mint 19.3(这是 Mint 19 的最新迭代),你可以将系统升级到 Linux Mint 20,而不需要进行重新安装 + * Linux Mint 20 没有 32 位版本。如果你**使用 32 位的 Mint 19 系列,你将无法升级到 Mint 20** + * 如果你使用的是 Linux Mint 18 系列,你必须先通过 Mint 19 系列升级。在我看来,重新安装 Mint 20 会比较省时省事 + * 如果你使用的是 Linux Mint 17、16、15 或更低版本,你一定不要再使用它们了。这些版本已经不支持了 + +我们有一个详细的指南,展示了从 18.3 到 19 [升级 Linux Mint 版本][12]的步骤。我猜测 Mint 20 的步骤应该也是一样的。我们的团队会对 Mint 19.3 到 Mint 20 的升级做一些测试,并在适用的情况下更新这个指南。 + +在你继续升级之前,请确保备份你的数据和[使用 Timeshift 创建系统快照][13]。 + +### 下载Linux Mint 20 + +你可以简单地前往其官方下载页面,为自己抓取最新的稳定 ISO。你会发现官方支持的桌面环境的 ISO,即 Cinnamon、MATE 和 Xfce。 + +此外,还为那些网络连接缓慢或不稳定的用户提供了 Torrent链接。 + +- [下载 Linux Mint 20][14] + +如果你只是想在不更换主系统的情况下试一试,我建议先[在 VirtualBox 中安装 Linux Mint 20][15],看看这是不是你喜欢的东西。 + +你试过 Linux Mint 20 了吗?你对这个版本有什么看法?请在下面的评论区告诉我你的想法。 + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/linux-mint-20-download/ + +作者:[Ankush Das][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://itsfoss.com/author/ankush/ +[b]: https://github.com/lujun9972 +[1]: https://linux.cn/article-12297-1.html +[2]: https://itsfoss.com/download-ubuntu-20-04/ +[3]: https://www.youtube.com/c/itsfoss?sub_confirmation=1 +[4]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/06/mint-20-welcome-screen.png?fit=800%2C397&ssl=1 +[5]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/06/mint-20-color-themes.png?fit=800%2C396&ssl=1 +[6]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/06/mint-20-nemo-file-manager.png?fit=800%2C397&ssl=1 +[7]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/06/mint-20-nemo-file-manager-blue-color-theme.png?fit=800%2C450&ssl=1 +[8]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/06/mint-20-wallpapers.png?fit=800%2C450&ssl=1 +[9]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/06/mint-20-redesigned-gdebi-installer.png?fit=800%2C582&ssl=1 +[10]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/06/mint-20-warpinator.png?fit=800%2C397&ssl=1 +[11]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/06/mint-20-terminal.png?fit=800%2C540&ssl=1 +[12]: https://itsfoss.com/upgrade-linux-mint-version/ +[13]: https://itsfoss.com/backup-restore-linux-timeshift/ +[14]: https://linuxmint.com/download.php +[15]: https://itsfoss.com/install-linux-mint-in-virtualbox/ diff --git a/published/202007/20200628 entr- rerun your build when files change.md b/published/202007/20200628 entr- rerun your build when files change.md new file mode 100644 index 0000000000..6fd30b30d8 --- /dev/null +++ b/published/202007/20200628 entr- rerun your build when files change.md @@ -0,0 +1,109 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12403-1.html) +[#]: subject: (entr: rerun your build when files change) +[#]: via: (https://jvns.ca/blog/2020/06/28/entr/) +[#]: author: (Julia Evans https://jvns.ca/) + +entr:文件更改时重新运行构建 +====== + +![](https://img.linux.net.cn/data/attachment/album/202007/11/094223uct6386d9iwctmbh.jpg) + +这是一篇简短的文章。我是最近才发现 [entr][1] 的,我很惊奇从来没有人告诉过我?!因此,如果你和我一样,那么我告诉你它是什么。 + +[entr 的网站][1]上对它已经有很好的解释,也有很多示例。 + +总结在其头部:`entr` 是一个命令行工具,当每次更改一组指定文件中的任何一个时,都能运行一个任意命令。你在标准输入给它传递要监控的文件列表,如下所示: + +``` +git ls-files | entr bash my-build-script.sh +``` + +或者 + +``` +find . -name *.rs | entr cargo test +``` + +或者任何你希望的。 + +### 快速反馈很棒 + +就像世界上的每个程序员一样,我发现每次更改代码时都必须手动重新运行构建/测试非常烦人。 + +许多工具(例如 hugo 和 flask)都有一个内置的系统,可以在更改文件时自动重建,这很棒! + +但是通常我会自己编写一些自定义的构建过程(例如 `bash build.sh`),而 `entr` 让我有了一种神奇的构建经验,我只用一行 bash 就能得到即时反馈,知道我的改变是否修复了那个奇怪的 bug。万岁! + +### 重启服务器(entr -r) + +但是如果你正在运行服务器,并且每次都需要重新启动服务器怎么办?如果你传递 `-r`,那么 `entr` 会帮你的 + +``` +git ls-files | entr -r python my-server.py +``` + +### 清除屏幕(entr -c) + +另一个简洁的标志是 `-c`,它让你可以在重新运行命令之前清除屏幕,以免被前面构建的输出分散注意力。 + +### 与 git ls-files 一起使用 + +通常,我要跟踪的文件集和我在 git 中的文件列表大致相同,因此将 `git ls-files` 传递给 `entr` 是很自然的事情。 + +我现在有一个项目,有时候我刚创建的文件还没有在 git 里。那么如果你想包含未被跟踪的文件怎么办呢?这些 `git` 命令行参数就可以做到(我是从一个读者的邮件中得到的,谢谢你!): + +``` +git ls-files -cdmo --exclude-standard | entr your-build-script +``` + +有人给我发了邮件,说他们做了一个 `git-entr` 命令,可以执行: + +``` +git ls-files -cdmo --exclude-standard | entr -d "$@" +``` + +我觉得这真是一个很棒的主意。 + +### 每次添加新文件时重启:entr -d + +`git ls-files` 的另一个问题是有时候我添加一个新文件,当然它还没有在 git 中。`entr` 为此提供了一个很好的功能。如果你传递 `-d`,那么如果你在 `entr` 跟踪的任何目录中添加新文件,它就会退出。 + +我将它与一个 `while` 循环配合使用,它将重启 `entr` 来包括新文件,如下所示: + +``` +while true +do +{ git ls-files; git ls-files . --exclude-standard --others; } | entr -d your-build-scriot +done +``` + +### entr 在 Linux 上的工作方式:inotify + +在 Linux 中,`entr` 使用 `inotify`(用于跟踪文件更改这样的文件系统事件的系统)工作。如果用 `strace` 跟踪它,那么你会看到每个监控文件的 `inotify_add_watch` 系统调用,如下所示: + +``` +inotify_add_watch(3, "static/stylesheets/screen.css", IN_ATTRIB|IN_CLOSE_WRITE|IN_CREATE|IN_DELETE_SELF|IN_MOVE_SELF) = 1152 +``` + +### 就这样了 + +我希望这可以帮助一些人了解 `entr`! + +-------------------------------------------------------------------------------- + +via: https://jvns.ca/blog/2020/06/28/entr/ + +作者:[Julia Evans][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://jvns.ca/ +[b]: https://github.com/lujun9972 +[1]: http://eradman.com/entrproject/ diff --git a/published/202007/20200630 Painless file extraction on Linux.md b/published/202007/20200630 Painless file extraction on Linux.md new file mode 100644 index 0000000000..4cd4d39c8c --- /dev/null +++ b/published/202007/20200630 Painless file extraction on Linux.md @@ -0,0 +1,141 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12410-1.html) +[#]: subject: (Painless file extraction on Linux) +[#]: via: (https://www.networkworld.com/article/3564265/painless-file-extraction-on-linux.html) +[#]: author: (Sandra Henry-Stocker https://www.networkworld.com/author/Sandra-Henry_Stocker/) + +Linux 上无痛文件提取 +====== + +![](https://img.linux.net.cn/data/attachment/album/202007/12/233401zickd110d2dl6u6f.jpg) + +从 Linux 系统的存档中提取文件没有拔牙那么痛苦,但有时看起来更复杂。在这篇文章中,我们将看看如何轻松地从 Linux 系统中可能遇到的几乎所有类型的存档中提取文件。 + +它们有很多格式,从 .gz 到 .tbz2,这些文件的命名方式都各有一些不同。当然,你可以记住所有从存档中提取文件的各种命令以及它们的选项,但是你也可以将所有经验保存到脚本中,而不再担心细节。 + +在本文中,我们将一系列提取命令组合成一个脚本,它会调用适当的命令根据文档名提取文件的内容。该脚本首先以一些命令来验证是否已经提供了一个文件名作为参数,或要求运行脚本的人提供文件名。 + +``` +#!/bin/bash + +if [ $# -eq 0 ]; then + echo -n "filename> " + read filename +else + filename=$1 +fi + +if [ ! -f "$filename" ]; then + echo "No such file: $filename" + exit $? +fi +``` + +了解了么?如果未提供任何参数,脚本将提示输入文件名,如果存在则使用它。然后,它验证文件是否实际存在。如果不是,那么脚本退出。 + +下一步是使用 bash 的 `case` 语句根据存档文件的名称调用适当的提取命令。对于其中某些文件类型(例如 .bz2),也可以使用除 `tar` 之外的其它命令,但是对于每种文件命名约定,我们仅包含一个提取命令。因此,这是带有各种存档文件名的 `case` 语句: + +``` + case $filename in + *.tar) tar xf $filename;; + *.tar.bz2) tar xjf $filename;; + *.tbz) tar xjf $filename;; + *.tbz2) tar xjf $filename;; + *.tgz) tar xzf $filename;; + *.tar.gz) tar xzf $filename;; + *.gz) gunzip $filename;; + *.bz2) bunzip2 $filename;; + *.zip) unzip $filename;; + *.Z) uncompress $filename;; + *) echo "No extract option for $filename" +esac +``` + +如果提供给脚本的文件扩展名与脚本已知的扩展名都不匹配,那么会发出 “No extract option for $filename” 的消息。如果缺少你使用的任何存档类型,只需将它们与所需的提取命令一起添加即可。 + +将 bash 头添加到脚本顶部,使其可执行,然后就可以开始了。 + +``` +#!/bin/bash + +if [ $# -eq 0 ]; then + echo -n "filename> " + read filename +else + filename=$1 +fi + +if [ ! -f "$filename" ]; then + echo "No such file: $filename" + exit $? +fi + +case $filename in + *.tar) tar xf $filename;; + *.tar.bz2) tar xjf $filename;; + *.tbz) tar xjf $filename;; + *.tbz2) tar xjf $filename;; + *.tgz) tar xzf $filename;; + *.tar.gz) tar xzf $filename;; + *.gz) gunzip $filename;; + *.bz2) bunzip2 $filename;; + *.zip) unzip $filename;; + *.Z) uncompress $filename;; + *.rar) rar x $filename ;; + *) +``` + +如果你希望脚本在提取文件时显示内容,请将详细选项(`-v`)添加到每个命令参数字符串中: + +``` +#!/bin/bash + +if [ $# -eq 0 ]; then + echo -n "filename> " + read filename +else + filename=$1 +fi + +if [ ! -f "$filename" ]; then + echo "No such file: $filename" + exit $? +fi + +case $filename in + *.tar) tar xvf $filename;; + *.tar.bz2) tar xvjf $filename;; + *.tbz) tar xvjf $filename;; + *.tbz2) tar xvjf $filename;; + *.tgz) tar xvzf $filename;; + *.tar.gz) tar xvzf $filename;; + *.gz) gunzip -v $filename;; + *.bz2) bunzip2 -v $filename;; + *.zip) unzip -v $filename;; + *.Z) uncompress -v $filename;; + *) echo "No extract option for $filename" +esac +``` + +### 总结 + +虽然可以为每个可能用到的提取命令创建别名,但是让脚本为遇到的每种文件类型提供命令要比自己停下来编写每个命令和选项容易。 + +-------------------------------------------------------------------------------- + +via: https://www.networkworld.com/article/3564265/painless-file-extraction-on-linux.html + +作者:[Sandra Henry-Stocker][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://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 diff --git a/published/202007/20200630 Read and write data from anywhere with redirection in the Linux terminal.md b/published/202007/20200630 Read and write data from anywhere with redirection in the Linux terminal.md new file mode 100644 index 0000000000..b55f7d8875 --- /dev/null +++ b/published/202007/20200630 Read and write data from anywhere with redirection in the Linux terminal.md @@ -0,0 +1,134 @@ +[#]: collector: (lujun9972) +[#]: translator: (nophDog) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12385-1.html) +[#]: subject: (Read and write data from anywhere with redirection in the Linux terminal) +[#]: via: (https://opensource.com/article/20/6/redirection-bash) +[#]: author: (Seth Kenlon https://opensource.com/users/seth) + +通过重定向在 Linux 终端任意读写数据 +====== + +> 重定向是一种十分高效的数据流动方式,它能帮你减少很多鼠标和键盘上的操作。 + +![](https://img.linux.net.cn/data/attachment/album/202007/06/005419nh6mzxkmmmbsslbb.jpg) + +对于任何编程或脚本语言,输入与输出重定向都是很自然的功能。严格来说,当你使用电脑时,数据自然而然地在发生着重定向。从 `stdin`(标准输入,通常是你的键盘或者鼠标)读取输入,输入则发往 `stdout`(标准输出,一段文本或者数据流),最后错误信息送至 `stderr`。如果你使用 [Bash][2] 或 [Zsh][3] 之类的 shell,那么理解这些数据流能够让你更好地控制信息流向。 + +标准输入、标准输出以及标准错误输出都存在于 Linux 文件系统中。你可以在 `/dev` 查看: + +``` +$ ls /dev/std* +/dev/stderr@  /dev/stdin@  /dev/stdout@ +``` + +你可能没法直接使用它们,但将它们想象成你能传递数据的元位置,会很有帮助。 + +重定向的基础很简单:用一些 `>` 符号重定向输出,然后用另外一些 `<` 符号重定向输入。 + +### 重定向输出 + +将 [ls][4] 命令的输出写入一个文件: + +``` +$ ls > list.txt +``` + +你没法像平常那样看到 `ls` 的输出,因为它们并没有被发送到屏幕,而是被写入 `list.txt` 文件了,这个功能用处太多了,事实上,你甚至可以用它来将文件内容拷贝到另一个文件。不一定是文本文件,你也可以用将重定向用于二进制数据: + +``` +$ cat image.png > picture.png +``` + +(你可能会好奇为什么要这样做,有时候对于 [文件权限信息][5] 而间接有用。) + +### 重定向输入 + +你也能将输入重定向“到”一个命令。可以说,它没有重定向输出那么有用,因为许多命令已经被硬编码,只从你的参数中接收输入。但是,如果某个命令需要一系列参数,而且你把这些参数写在文件里,想要快速“复制粘贴”到终端的时候(除非你并不想复制粘贴),它就帮得上忙了。 + +``` +$ sudo dnf install $(嵌入文档here-document(简写成 here-doc)和嵌入字符串here-string 技巧。这种输入方法将一整块文本重定向至标准输入流,直到碰见一个特殊的文件结束标记(许多人习惯用 `EOF`,实际上你可以使用任何字符串,只要它是唯一的)。试着把这些(在第二个 `EOF` 标记之前)敲进你的终端: + +``` +$ echo << EOF +> foo +> bar +> baz +> EOF +``` + +输出结果: + +``` +foo +bar +baz +``` + +使用 [Bash][2] 编写脚本的人常常用这个技巧,将数行文本一次性写入文件或者打印到屏幕上。只要你别忘了末尾的文件结束标记,这会是一个帮你避免大量繁琐 `echo` 或 `printf` 语句的好办法。 + +嵌入字符串类似于嵌入文档,但是它只含有一个字符串(或者用引号包裹的几个字符串,同样会被当成一个字符串) + +``` +$ cat <<< "foo bar baz" +foo bar baz +``` + +### 重定向错误信息 + +错误信息流叫做 `stderr`,通过 `2>` 实现这个目的。下面这个命令把错误信息定向到 `output.log` 文件: + +``` +$ ls /nope 2> output.log +``` + +### 将数据送往 /dev/null + +既然标准输入、标准输出和错误输出都有自己的位置,那么“空空如也”也应该在 Linux 文件系统占有一席之地。没错,它叫做 `null`,位于 `/dev`,频繁使用的人懒得说 “slash dev slash null”,于是索性叫它 “devnull”。 + +通过重定向,你可以把数据发送到 `/dev/null`。比如,`find` 命令常常会输出很多具体信息,而且在搜索文件遇到权限冲突时,会事无巨细地报告: + +``` +$ find ~ -type f +/home/seth/actual.file +find: `/home/seth/foggy': Permission denied +find: `/home/seth/groggy': Permission denied +find: `/home/seth/soggy': Permission denied +/home/seth/zzz.file +``` + +`find` 命令把那些当作错误,所以你可以只把错误信息重定向至 `/dev/null`: + + +``` +$ find ~ -type f 2>; /dev/null +/home/seth/actual.file +/home/seth/zzz.file +``` + +### 使用重定向 + +在 Bash 中,重定向是转移数据的有效方法。你可能不会频繁使用重定向,但是学会如何使用它,能帮你在打开文件、复制粘贴数据这类需要移动鼠标、大量按键操作上,节省很多不必要的时间。不要做如此浪费时间的事情。使用重定向,好好享受生活。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/6/redirection-bash + +作者:[Seth Kenlon][a] +选题:[lujun9972][b] +译者:[nophDog](https://github.com/nophDog) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/seth +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/programming-code-keyboard-laptop.png?itok=pGfEfu2S (Hands programming) +[2]: https://opensource.com/resources/what-bash +[3]: https://opensource.com/article/19/9/getting-started-zsh +[4]: https://opensource.com/article/19/7/master-ls-command +[5]: https://opensource.com/article/19/8/linux-permissions-101 diff --git a/published/202007/20200701 13 Things To Do After Installing Linux Mint 20.md b/published/202007/20200701 13 Things To Do After Installing Linux Mint 20.md new file mode 100644 index 0000000000..eda69868ad --- /dev/null +++ b/published/202007/20200701 13 Things To Do After Installing Linux Mint 20.md @@ -0,0 +1,215 @@ +[#]: collector: (lujun9972) +[#]: translator: (robsean) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12404-1.html) +[#]: subject: (13 Things To Do After Installing Linux Mint 20) +[#]: via: (https://itsfoss.com/things-to-do-after-installing-linux-mint-20/) +[#]: author: (Ankush Das https://itsfoss.com/author/ankush/) + +安装 Linux Mint 20 后需要做的 13 件事 +====== + +![](https://img.linux.net.cn/data/attachment/album/202007/11/113643ich99s7y7kw7ckw9.jpg) + +Linux Mint 毫无疑问是 [最佳 Linux 发行版][1] 之一,特别是考虑到 [Linux Mint 20][2] 的功能,我确信你也会同意这一说法。 + +假设你错过了我们的新闻报道,[Linux Mint 20 终于可以下载了][3]。 + +当然,如果你使用 Linux Mint 有一段时间了,你可能知道最好做一些什么。但是,对于新用户来说,在安装 Linux Mint 20 后,你需要做一些事,让你的体验更比以往任何时候都好。 + +### 在安装 Linux Mint 20 后建议做的事 + +在这篇文章中,我将列出其中一些要做的事来帮助你改善 Linux Mint 20 的用户体验。 + +#### 1、执行一次系统更新 + +![][4] + +安装后首先应该马上检查的是 —— 使用更新管理器进行系统更新,如上图所示。 + +为什么?因为你需要构建可用软件的本地缓存。更新所有软件包的更新也是一个好主意。 + +如果你喜欢使用终端,只需输入下面的命令来执行系统更新: + +``` +sudo apt update && sudo apt upgrade -y +``` + +#### 2、使用 Timeshift 来创建系统快照 + +![][5] + +如果你想在意外更改或错误更新后快速地恢复系统状态,有一个系统快照总是很有用的。 + +因此,如果你希望能够随时备份你的系统状态,那么使用 Timeshift 配置和创建系统快照是超级重要的。 + +如果你还不知道如何使用它的话,你可以遵循我们 [使用 Timeshift][6] 的详细指南。 + +#### 3、安装有用的软件 + +尽管在 Linux Mint 20 中已经安装有一些有用的预安装应用程序,你可能需要安装一些没有随之一起出炉的必不可少的应用程序。 + +你可以简单地使用软件包管理器或 synaptic 软件包管理器来查找和安装所需要的软件。 + +对于初学者来说,如果你想探索各种各样的工具,那么你可以遵循我们的 [必不可少的 Linux 应用程序][7] 的列表。 + +也参见: + +- [75 个最常用的 Linux 应用程序(2018 年)](https://linux.cn/article-10099-1.html) +- 100 个最佳 Ubuntu 应用([上](https://linux.cn/article-11044-1.html)、[中](https://linux.cn/article-11048-1.html)、[下](https://linux.cn/article-11057-1.html)) + +这里是一个我最喜欢的软件包列表,我希望你也来尝试一下: + + * [VLC 多媒体播放器][8] 用于视频播放 + * [FreeFileSync][9] 用来同步文件 + * [Flameshot][10] 用于截图 + * [Stacer][11] 用来优化和监控系统 + * [ActivityWatch][12] 用来跟踪你的屏幕时间并保持高效唤醒 + +#### 4、自定义主题和图标 + +![][13] + +当然,这在技术上不是必不可少的事,除非你想更改 Linux Mint 20 的外观和感觉。 + +但是,[在 Linux Mint 中更改主题和图标是非常容易的][14] ,而不需要安装任何额外的东西。 + +你会在欢迎屏幕中获得优化外观的选项。或者,你只需要进入 “主题”,并开始自定义主题。 + +![][15] + +为此,你可以搜索它或在系统设置中如上图所示找到它。 + +根据你正在使用的桌面环境,你也可以看看可用的 [最佳图标主题][16]。 + +#### 5、启用 Redshift 来保护你的眼睛 + +![][17] + +你可以在 Linux Mint 上搜索 “[Redshift][18]”,并启用它以在晚上保护你的眼睛。如你在上面的截图所见,它将根据时间自动地调整屏幕的色温。 + +你可能想启用自动启动选项,以便它在你重新启动计算机时自动启动。它可能与 [Ubuntu 20.04 LTS][19] 的夜光功能不太一样,但是如果你不需要自定义时间表或微调色温的能力,那么它就足够好了。 + +#### 6、启用 snap(如果需要的话) + +尽管 Ubuntu 比前所未有的更倾向于推崇使用 Snap,但是 Linux Mint 团队却反对使用它。因此,它禁止 APT 使用 snapd。 + +因此,你将无法获得 snap 开箱即用的支持。然而,你迟早会意识到一些软件包只以 Snap 的格式打包。在这种情况下,你将不得不在 Mint 上启用对 snap 的支持。 + +``` +sudo apt install snapd +``` + +在你完成后,你可以遵循我们的指南来了解更多关于 [在 Linux 上安装和使用 snap][20] 的信息。 + +#### 7、学习使用 Flatpak + +默认情况下,Linux Mint 带有对 Flatpak 的支持。所以,不管你是讨厌使用 snap 或只是更喜欢使用 Flatpak,在系统中保留它是个好主意。 + +现在,你只需要遵循我们关于 [在 Linux 上使用 Flatpak][21] 的指南来开始吧! + +#### 8、清理或优化你的系统 + +优化或清理系统总是好的,以避免不必要的垃圾文件占用存储空间。 + +你可以通过在终端机上输入以下内容,快速删除系统中不需要的软件包: + +``` +sudo apt autoremove +``` + +除此之外,你也可以遵循我们 [在 Linux Mint 上释放空间的一些建议][22] 。 + +#### 9、使用 Warpinator 通过网络发送/接收文件 + +Warpinator 是 Linux Mint 20 的一个新功能,可以让你在连接到网络的多台电脑上共享文件。这里是它看起来的样子: + +![][23] + +你只需要在菜单中搜索它就可以开始了! + +#### 10、使用驱动程序管理器 + +![驱动器管理器][24] + +如果你正在使用需要驱动程序的 Wi-Fi 设备、NVIDIA 显卡或 AMD 显卡,以及其它设备(如果适用的话)时,驱动程序管理器是一个重要的部分。 + +你只需要找到驱动程序管理器并启用它。它应该可以检测到正在使用的任何专有驱动程序,或者你也可以使用驱动程序管理器来利用 DVD 来安装驱动程序。 + +#### 11、设置防火墙 + +![][25] + +在大多数情况下,你可能已经保护了你的家庭网络。但是,如果你想在 Linux Mint 上有一些特殊的防火墙设置,你可以通过在菜单中搜索 “Firewall” 来实现。 + +正如你在上述截图中所看到的,你可以为家庭、企业和公共设置不同的配置文件。你只需要添加规则,并定义什么是允许访问互联网的,什么是不允许的。 + +你可以阅读我们关于 [使用 UFW 配置防火墙][26] 的详细指南。 + +#### 12、学习管理启动应用程序 + +如果你是一个有经验的用户,你可能已经知道这一点了。但是,新用户经常忘记管理他们的启动应用程序,最终影响了系统启动时间。 + +你只需要从菜单中搜索 “Startup Applications” ,你可以启动它来查找像这样的东西: + +![][27] + +你可以简单地切换你想要禁用的那些启动应用程序,添加一个延迟计时器,或从启动应用程序的列表中完全地移除它。 + +#### 13、安装必不可少的游戏应用程序 + +当然,如果你对游戏感兴趣,你可能想去阅读我们关于 [在 Linux 上的游戏][28] 的文章来探索所有的选择。 + +但是,对于初学者来说,你可以尝试安装 [GameHub][29]、[Steam][30] 和 [Lutris][31] 来玩一些游戏。 + +### 总结 + +就是这样,各位!在大多数情况下,如果你在安装 Linux Mint 20 后按照上面的要点进行操作,使其发挥出最好的效果,应该就可以了。 + +我确信你还能够做更多的事。我想知道你喜欢在安装 Linux Mint 20 后马上做了什么。在下面的评论中告诉我你的想法吧! + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/things-to-do-after-installing-linux-mint-20/ + +作者:[Ankush Das][a] +选题:[lujun9972][b] +译者:[robsean](https://github.com/robsean) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://itsfoss.com/author/ankush/ +[b]: https://github.com/lujun9972 +[1]: https://itsfoss.com/best-linux-distributions/ +[2]: https://linux.cn/article-12297-1.html +[3]: https://linux.cn/article-12376-1.html +[4]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/06/linux-mint-20-system-update.png?ssl=1 +[5]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2018/07/snapshot-linux-mint-timeshift.jpeg?ssl=1 +[6]: https://linux.cn/article-11619-1.html +[7]: https://linux.cn/article-10165-1.html +[8]: https://www.videolan.org/vlc/ +[9]: https://itsfoss.com/freefilesync/ +[10]: https://itsfoss.com/flameshot/ +[11]: https://itsfoss.com/optimize-ubuntu-stacer/ +[12]: https://itsfoss.com/activitywatch/ +[13]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/06/linux-mint-20-theme.png?ssl=1 +[14]: https://itsfoss.com/install-icon-linux-mint/ +[15]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/06/linux-mint-20-system-settings.png?ssl=1 +[16]: https://itsfoss.com/best-icon-themes-ubuntu-16-04/ +[17]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/06/linux-mint-20-redshift-1.png?ssl=1 +[18]: https://itsfoss.com/install-redshift-linux-mint/ +[19]: https://itsfoss.com/ubuntu-20-04-release-features/ +[20]: https://itsfoss.com/install-snap-linux/ +[21]: https://itsfoss.com/flatpak-guide/ +[22]: https://itsfoss.com/free-up-space-ubuntu-linux/ +[23]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/04/mint-20-warpinator-1.png?ssl=1 +[24]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2013/12/Additional-Driver-Linux-Mint-16.png?ssl=1 +[25]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/06/linux-mint-20-firewall.png?ssl=1 +[26]: https://itsfoss.com/set-up-firewall-gufw/ +[27]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/06/linux-mint-20-startup-applications.png?ssl=1 +[28]: https://itsfoss.com/linux-gaming-guide/ +[29]: https://itsfoss.com/gamehub/ +[30]: https://store.steampowered.com +[31]: https://lutris.net diff --git a/published/202007/20200701 Back up your phone-s storage with this Linux utility.md b/published/202007/20200701 Back up your phone-s storage with this Linux utility.md new file mode 100644 index 0000000000..c7c9c67789 --- /dev/null +++ b/published/202007/20200701 Back up your phone-s storage with this Linux utility.md @@ -0,0 +1,214 @@ +[#]: collector: (lujun9972) +[#]: translator: (summer2233) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12415-1.html) +[#]: subject: (Back up your phone's storage with this Linux utility) +[#]: via: (https://opensource.com/article/20/7/gphoto2-linux) +[#]: author: (Seth Kenlon https://opensource.com/users/seth) + +使用 Linux 实用程序 gPhoto2 备份手机存储 +====== + +> 尽情地拍照吧,gphoto2 能够方便、快速地将照片从你的设备传输到 Linux 计算机上。 + +![](https://img.linux.net.cn/data/attachment/album/202007/14/170729pzljppapojy44ro4.jpg) + +移动设备的最大缺点之一就是其将数据从设备传输到计算机很困难。移动设备在这一缺点上有着悠久的历史。早期的移动设备,如 Pilot 和掌上电脑 PDA 设备,需要使用特殊的同步软件来传输数据(你必须小心翼翼地做这件事,因为你的设备可能会因为电池耗尽而导致数据永久丢失);旧版 iPod 只提供特定平台的界面。现代移动设备默认将你的数据发送到在线帐户,以便你可以在计算机上再次下载。 + +好消息——如果你正在运行 Linux,你可以使用 `gphoto2` 命令与移动设备进行连接。`gphoto2` 最初是作为一种与数码相机通信的方式而开发的,那时的数码相机只有传统的相机功能,现在的 `gphoto2` 可以和许多不同种类的移动设备通讯。别让这个名字骗了你,它可以处理所有类型的文件,而不仅仅是照片。更棒的是,它可以编写脚本、很灵活、并且比大多数 GUI 界面功能强大得多。 + +如果你曾经为在计算机和移动设备之间同步数据而苦恼,请了解一下 `gphoto2`。 + +### 安装 gPhoto2 + +很可能你的 Linux 系统已经安装了 libgphoto2,因为它是与移动设备连接的一个关键库,但你可能还需要安装命令 `gphoto2`,该命令可能在你的存储库中。 + +在 Fedora 或 RHEL 上: + +``` +$ sudo dnf install gphoto2 +``` + +在 Debian 或 Ubuntu 上: + +``` +$ sudo apt install gphoto2 +``` + +### 验证兼容性 + +若要确认你的移动设备是否受支持,请使用 `--list-cameras`,通过管道传输到 `less`: + +``` +$ gPhoto2 --list-cameras | less +``` + +或者你可以通过管道把它传送到 `grep` 来搜索一个词。例如,如果你有三星 Galaxy,则使用 `grep`,并通过选项 `-i` 关闭区分大小写: + +``` +$ gphoto2 --list-cameras | grep -i galaxy +  "Samsung Galaxy models (MTP)" +  "Samsung Galaxy models (MTP+ADB)" +  "Samsung Galaxy models Kies mode" +``` + +这证实了三星 Galaxy 设备支持通过 MTP 连接和通过 ADB 连接 MTP。 + +如果你没有在列表中找到自己的移动设备,你仍然可以尝试使用 `gphoto2`,可能你的设备在列表中使用了不同的称呼。 + +### 查找移动设备 + +要使用 gPhoto2,首先必须将移动设备插入计算机,设置为 MTP 模式,并且授予计算机与它交互的权限。这通常需要在你的移动设备上操作,往往是在屏幕上按下一个按钮,以允许其文件系统被刚刚连接的计算机访问。 + +![Screenshot of allow access message][2] + +如果你不授权电脑访问移动设备,那么 gPhoto2 可以检测到你的移动设备,但它不能与之交互。 + +要确保计算机检测到你连接的移动设备,请使用 `--auto-detect` 选项: + +``` +$ gphoto2 --auto-detect +Model                       Port +--------------------------------------- +Samsung Galaxy models (MTP) usb:002,010 +``` + +如果你的移动设备没有被检测到,请先检查数据线,然后检查你的设备是否配置为通过 MTP、ADB 或其它 gPhoto2 支持的协议连接,如 `--list-cameras` 所示。 + +### 查询你的设备支持的特性 + +对于现代设备,通常有过多的潜在功能,但并非所有移动设备都支持这些功能。你可以用 `--abilities` 选项来确定自己的移动设备支持哪些功能。我觉得结果看起来直观。 + +``` +$ gphoto2 --abilities +Abilities for camera            : Samsung Galaxy models (MTP) +Serial port support             : no +USB support                     : yes +Capture choices                 : Capture not supported by driver +Configuration support           : no +Delete selected files on camera : yes +Delete all files on camera      : no +File preview (thumbnail) support: no +File upload support             : yes +``` + +如果只连接一个设备,那么不需要指定查询的设备。但是,如果连接了多个 gPhoto2 可以与之交互的设备,则可以通过端口、相机型号或 usbid 指定设备。 + +### 与你的移动设备交互 + +如果你的设备支持拍摄功能,则可以从计算机调用你的摄像头来获取媒体。例如,要拍摄照片: + +``` +$ gphoto2 --capture-image +``` + +要拍摄照片并立即将其传输到连接的计算机: + +``` +$ gphoto2 --capture-image-and-download +``` + +你也可以录制视频和声音。如果连接了多个拍摄设备,可以按端口、相机型号或 usbid 指定要使用的设备: + +``` +$ gphoto2 --camera "Samsung Galaxy models (MTP)" \ +--capture-image-and-download +``` + +### 文件和文件夹 + +要想更加智能地管理移动设备上的文件,你需要了解 gPhoto2 连接的文件系统的结构。 + +你可以使用 `--get-folders` 选项查看可用文件夹: + +``` +$ gphoto2 --list-folders +There are 2 folders in folder '/'.                                             + - store_00010001 + - store_00020002 +There are 0 folders in folder '/store_00010001'. +There are 0 folders in folder '/store_00020002'. +``` + +每个文件夹代表设备上的一个存储单元。在本例中,`store_00010001` 是内部存储器,`store_00020002` 是 SD 卡,这可能与你的设备的结构不同。 + +### 获取文件 + +现在你知道了设备的文件夹布局,就可以从设备获取照片了。你可以使用许多不同的选项,具体取决于你想从设备中获取什么。 + +如果你知道绝对路径,则可以获取指定的文件: + +``` +$ gphoto2 --get-file IMG_0001.jpg --folder /store_00010001/myphotos +``` + +你可以同时获得所有的文件: + +``` +$ gphoto2 --get-all-files --folder /store_00010001/myfiles +``` + +你可以只获取音频文件: + +``` +gphoto2 --get-all-audio-data --folder /store_00010001/mysounds +``` + +gPhoto2 还有其他的选择,其中大多数取决于你连接的设备和使用协议是否支持。 + +### 上传文件 + +现在你知道了潜在的目标文件夹,就可以将文件从计算机上传到你的设备。例如,假设有一个名为 `example.epub` 的文件在当前目录中,你可以使用 `--upload-file` 选项和 `--folder` 选项将文件发送到设备并指定要上传到的目录: + +``` +$ gphoto2 --upload file example.epub \ +--folder store_00010001 +``` + +如果你希望将多个文件上传到同一个位置,你可以在设备上创建一个目录: + + +``` +$ gphoto2 --mkdir books \ +--folder store_00010001 +$ gphoto2 --upload-file *.epub \ +--folder store_00010001/books +``` + +### 列出文件 + +若要查看设备上的文件,请使用 `--list-files` 选项: + +``` +$ gphoto2 --list-files --folder /store_00010001 +There is 1 file in folder '/store_00010001' +#1     example.epub 17713 KB application/x-unknown +$ gphoto2 --list-files --folder /store_00010001/books +There is 1 file in folder '/store_00010001' +#1    example0.epub 17713 KB application/x-unknown +#2    example1.epub 12264 KB application/x-unknown +[...] +``` + +### 探索你的使用方式 + +gPhoto2 的大部分功能取决于你的设备,因此不同用户的体验可能不尽相同。在 `gphoto2 --help` 中列出了许多操作供你探索。使用gPhoto2,再也不用费劲把文件从你的设备传输到电脑上了! + +这些开源图片库能够帮助你组织文件,并让的图片看起来很棒。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/7/gphoto2-linux + +作者:[Seth Kenlon][a] +选题:[lujun9972][b] +译者:[summer2233](https://github.com/summer2233) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/seth +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/idea_innovation_mobile_phone.png?itok=RqVtvxkd (A person looking at a phone) +[2]: https://opensource.com/sites/default/files/uploads/gphoto2-mtp-allow.jpg (Screenshot of allow access message) diff --git a/published/202007/20200701 Customizing Bash.md b/published/202007/20200701 Customizing Bash.md new file mode 100755 index 0000000000..547ae50180 --- /dev/null +++ b/published/202007/20200701 Customizing Bash.md @@ -0,0 +1,277 @@ +[#]: collector: (lujun9972) +[#]: translator: (nophDog) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12429-1.html) +[#]: subject: (Customizing Bash) +[#]: via: (https://fedoramagazine.org/customizing-bash/) +[#]: author: (Stephen Snow https://fedoramagazine.org/author/jakfrost/) + +深入了解定制 Bash +====== + +![](https://img.linux.net.cn/data/attachment/album/202007/19/110018bl392bj3g3g41a23.jpg) + +操作系统的最外层 —— 也就是跟你直接打交道的 —— 叫做 [shell][2](“外壳”)。Fedora 预装了好几种不同的 shell。shell 可以是图形界面,或者字符界面。在文档中,你常常能见到两个母缩写词 GUI (图形用户界面Graphical User Interface)跟 CLI(命令行界面Command-Line Interface),它们用来区分图形和基于字符的 shell/界面。[GNOME][5] 和 [Bash][6] 分别是 Fedora 默认的图形和命令行界面,不过你也可以使用其它 [GUI][3] 或者 [CLI][4] shell。 + +接下来在这篇文章中,我们会讨论一些比较推荐的 Bash 字符界面的点文件配置。 + +### Bash 概览 + +Bash 参考手册中写道: + +> 根本上来说,shell 只是一个能执行命令的宏处理器。宏处理器这个词意味着通过扩展文本跟符号,从而构成更复杂的表达式。 +> +> **Bash 参考手册** +> **第五版,Bash 5.0** +> **2019 年 5 月** + +除了能使用其它程序之外,Bash shell 还含有一些内置命令和关键字。Bash 内置功能很强大,甚至能够作为一门 [高级语言][7] 独当一面。Bash 的几个关键字和操作符类似于 [C 语言][8]。 + +Bash 能够以交互式或非交互式模式启动。Bash 的交互模式是一个很多人都熟悉的典型的终端/命令行界面。[GNOME 终端][9] 默认以交互模式打开 Bash。Bash 在非交互模式下运行的例子是,当命令和数据从文件或 shell 脚本通过 [管道][10] 传送到 Bash 时。其它 Bash 可以运行的模式包括:登录login非登录non-login远程remote、POSIX、Unix sh、受限restricted,以及使用与用户不同的 UID/GID 模式。各种模式是可以相互组合的。比如,交互式 + 受限 + POSIX 或者非交互式 + 非登录 + 远程。不同的启动模式,决定着 Bash 所读取的启动文件。理解这些操作模式,有助于帮助我们修改启动文件。 + +根据 Bash 参考手册,它会: + +> 1. 从文件中...、从作为 `-c` 调用选项传入参数的字符...,或者从用户的终端中读取输入。 +> 2. 将输入分解成单词和操作符,遵循 [它的] 引用规则。...这些标记使用元字符隔开。这一步执行别名展开。 +> 3. 将标记解析成简单与复合命令。 +> 4. 执行各种 shell 展开...,将展开之后的标记分解成文件名...以及命令和参数的列表。 +> 5. 执行必要的重定向...并从参数列表中去除重定向操作符及其操作数。 +> 6. 执行命令。 +> 7. 必要时等待命令完成,并收集退出状态。 +> +> **Bash 参考文档** +> **第五版,Bash 版本 5.0** +> **2019 年 5 月** + +当用户开启终端模拟器进入命令行环境时,便启动了一次交互式 shell 会话。GNOME 终端默认以非登录模式为用户打开 Shell。你可以在 “编辑 → 首选项 → 配置文件 → 命令Edit → Preferences → Profilles → Command” 中配置 GNOME 终端以何种模式(登录与非登录式)启动。也可以在 Bash 启动时通过向其传递 `-login` 标志来要求进入登录模式。要注意一点,Bash 的登录模式与非交互模式并不互斥。可以让 Bash 同时以登录模式和非交互模式运行。 + +### 启动 Bash + +除非传入 `-noprofile` 选项,否则登录模式的 Bash shell 会默认读取并执行某些初始化文件中命令。如果 `/etc/profile` 存在,它会是第一个被执行的文件,紧接着是按 `~/.bash_profile`、`~/.bash_login` 或 `~/.profile` 顺序找到的第一个文件。当用户退出登录模式的 shell 时,或者有脚本在非交互式登录模式的 shell 中调用了内置 `exit` 命令,Bash 会读取并执行 `~/.bash_logout` 中的命令,如果 `/etc/bash_logout` 存在的话,会紧接着执行它。通常来说,`/etc/profile` 会援引source `/etc/bashrc` 文件,读取并执行其中的命令,然后查找并读取执行 `/etc/profile.d` 目录中以 `.sh` 结尾的文件。同样的,`~/.bash_profile` 通常也会援引source `~/.bashrc` 文件。`/etc/bashrc` 和 `~/.bashrc` 都会进行检查,避免重复援引source。 + +(LCTT 译注:在 Bash 中,脚本会通过 `source` 或 `.` 命令来将另外一个脚本引入其中,这个行为称之为 “source”、“sourcing”,但是该行为一直没有公认且常用的翻译方法。经过多番斟酌,我认为可以译做“援引”,理由如下:1、“援引”具有“引用、引入”的意思,符合该行为;2、“援”这个词的发音和“source” 常见的汉语意思“源”同音,便于记忆。以上是我们的愚见,供大家参考讨论。—— 老王,2020/7/19) + +一个交互式的 shell,如果不是登录 shell,那么当它第一次被调用的时候,会执行 `~/.bashrc` 文件。这是用户在 Fedora 上打开终端时通常会进入的 shell 类型。当 Bash 以非交互模式启动 —— 就像运行脚本时那样 —— 它会寻找 `BASH_ENV` 环境变量。如果找到了,就会展开它的值作为文件名,接着读取并执行该文件。效果跟执行以下命令相同: + +``` +if [ -n "$BASH_ENV" ]; then . "$BASH_ENV"; fi +``` + +值得注意的是,不会使用 `PATH` 环境变量的值来搜索该文件名(LCTT 译注:意即不会检索搜索路径)。 + +### 重要的用户点文件 + +Bash 最广为人知的用户点文件是 `~/.bashrc`。通过编辑该文件,可以设置大多数个性化选项。由于我们常常需要设置一些选项,会改动上面提及甚至没有提及的文件,所以大部分自定义选项会成为一个麻烦事。Bash 环境具有很高的可定制性,正是为了适应不同用户的不同需求。 + +![][11] + +当登录 shell 正常退出时,如果 `~/.bash_logout` 和 `/etc/bash_logout` 存在,它们会被调用。下一幅图展示了 Bash 作为交互式 shell 启动时的过程。例如,当用户从桌面环境打开终端模拟器时,会按照以下顺序进行。 + +![][12] + +我们已经知道,在不同的启动模式下,Bash 会执行不同的命令,所以很明显,只有几种最需要关注的典型启动模式。分别是非交互、交互式登录 shell,和非交互式、交互式非登录 shell。如果想定义某些全局环境,那么需要将一个具有唯一名称、以 `.sh` 为后缀的文件(例如 `custom.sh`)放置在 `/etc/profile.d` 目录。 + +对于非交互式非登录启动方式,需要特别注意。在这种模式下,Bash 会检查 `BASH_ENV` 变量。如果定义了该变量,Bash 会援引它所指向的文件。另外,处理 `BASH_ENV` 时并不会使用 `PATH` 变量所存储的值(LCTT 译注:意即不会检索搜索路径),所以它必须包含执行文件的绝对路径。比如说,如果有人希望非交互式执行脚本时,shell 能读取 `~/.bashrc` 文件中的设置,那么他可以把类似下面这样的内容放在一个名为 `/etc/profile.d/custom.sh` 的文件中... + +``` +# custom.sh +. +. +. +# 如果使用 Fedora Workstation +BASH_ENV="/home/username/.bashrc" +. +. +. +# 如果使用 Fedora Silverblue Workstation +BASH_ENV="/var/home/username/.bashrc" + +export BASH_ENV +``` + +上面这份脚本会让每个 shell 脚本在运行之前先执行该用户的 `~/.bashrc`。 + +用户一般都会自定义他们的系统环境,以便契合他们自己的工作习惯与偏好。举例来说,用户可以通过别名来实现这种程度的自定义。拥有相同起始参数、需要频繁使用的命令是制作别名的最佳选择。以下展示了一些来自 `~/.bashrc` 文件中定义的别名。 + +``` +# .bashrc +# 执行全局文件 +if [ -f /etc/bashrc ]; + then . /etc/bashrc +fi +. +. +. +# 用户别名和函数 +alias ls='ls -hF --color=auto' +alias la='ls -ahF --color=auto' + +# 让 dir 命令用起来像在 Windows 那样 +alias dir='ls --color=auto --format=long' + +# 用颜色高亮 grep 结果 +alias grep='grep --color=auto' +``` + +在系统中,别名是一种自定义各种命令的方法。它能减少击键次数,而且让命令用起来更方便。针对用户级别的别名通常存放在该用户的 `~/.bashrc` 文件中。 + +如果你发现自己经常要去历史中查找曾经执行过的某条命令,那可能需要改改历史设置了。你依然可以在 `~/.bashrc` 文件中设置针对用户级别的历史选项。比如说,如习惯同时使用多个终端,那你可能要启用 `histappend` 选项。某些 Bash 相关的 shell 选项本质上是布尔值(接收 `on` 或 `off`),通常可以用内置命令 `shopt` 启用或禁用。接收更复杂的值的 Bash 选项(如 `HISTTIMEFORMAT`),常常通过赋值给环境变量来达到配置目的。以下演示如何以 shell 选项和环境变量定制 Bash。 + +``` +# 配置 Bash 历史 + +# 用制表符扩展目录环境变量,并设置 histappend +shopt -s direxpand histappend + +# ignoreboth 等同于 ignorespace 和 ignoredup +HISTCONTROL='ignoreboth' + +# 控制 `history` 输出中的时间格式 +HISTTIMEFORMAT="[%F %T] " + +# 无限历史记录 +# NB:在新版 Bash 中,任何 < 0 的写法都有效,但是在 CentOS/RHEL 中,只有这样才行得通 +HISTSIZE= +HISTFILESIZE= + +# 或者对于使用新版 Bash 的人 +HISTSIZE=-1 +HISTFILESIZE=-1 +``` + +上面例子中的 `direxpand` 选项,可以让 Bash 在文件名补全时,用单词展开结果替换目录名。它会改变 readline 编辑缓冲区的内容,所以你所输入的东西已经被补全得到的结果替换了。 + +`HISTCONTROL` 变量用于启用或禁用命令历史的某些过滤选项。重复行、以空白打头的行,都能通过该选项将它们从命令历史中过滤掉。引用自 Dusty Mabe,这是我从他那儿得到的技巧: + +> `ignoredup` 可以让历史不记录重复条目(如果你反复执行同一条命令)。`ignorespace` 会忽略前面有空白的条目,当你在设置一个包含敏感信息的环境变量或者执行一条不想被记录进磁盘的命令时,这就很有用。`ignoreboth` 相当于这两条选项的结合体。 +> +> **Dusty Mabe – Redhat 首席软件工程师,2020.6.19** + +对于命令行重度用户,Bash 有一个 `CDPATH` 环境变量。如果 `CDPATH` 包含一系列供 `cd` 命令搜索的目录,且提供一个相对路径作为第一个参数,那么它会按顺序检查所有列出的目录,寻找匹配的子目录并切换到第一个匹配结果目录。 + +``` +# .bash_profile + +# 设置 CDPATH +CDPATH="/var/home/username/favdir1:/var/home/username/favdir2:/var/home/username/favdir3" + +# 也可以写成这样 +CDPATH="/:~:/var:~/favdir1:~/favdir2:~/favdir3" + +export CDPATH +``` + +`CDPATH` 通常像 `PATH` 一样的方式进行更新 —— 通过在赋值右侧引用自身来保留原来的值。 + +``` +# .bash_profile + +# 设置 CDPATH +CDPATH="/var/home/username/favdir1:/var/home/username/favdir2:/var/home/username/favdir3" + +# 或者写成这样 +CDPATH="/:~:/var:~/favdir1:~/favdir2:~/favdir3" + +CDPATH="$CDPATH:~/favdir4:~/favdir5" + +export CDPATH +``` + +`PATH` 是另一个极其重要的变量。它是系统上的命令的搜索路径。注意,有些应用要求将它们自己的目录加入 `PATH` 变量,这样才能正常使用。跟 `CDPATH` 一样,通过在赋值右侧引用原值来追加新值到 `PATH` 变量。如果你希望将新值前置,只需要把原来的值(`$PATH`)放到列表末尾即可。还有注意的是在 Fedora,这一列值通过冒号分隔(`:`)。 + +``` +# .bash_profile + +# 添加 PATH 值到 PAHT 环境变量 +PATH="$PATH:~/bin:~:/usr/bin:/bin:~/jdk-13.0.2:~/apache-maven-3.6.3" + +export PATH +``` + +命令提示符是另一个流行的自定义选项。它有七个可定制的参数: + +> - `PROMPT_COMMAND`:如果设置了,会在每一个主提示符(`$PS1`)出现之前执行该值。 +> - `PROMPT_DIRTRIM`:如果设置成大于零的数,则该值用作展开 `\w` 和 `\W` 提示符字符串转义符时保留的尾随目录组件数量。删除的字符将替换为省略号。 +> - `PS0`:这个参数的值像 `PS1` 一样展开,在交互式 shell 读取命令之后、执行命令之前展示。 +> - `PS1`:主提示符字符串。默认值是 `\s-\v\$ `。 +> - `PS2`:次提示符字符串。默认是 `> `。在显示之前,`PS2` 像 `PS1` 那样展开。 +> - `PS3`:这个参数的值用作 `select` 命令的提示符。如果这个变量没有设置,`select` 命令会用 `#? ` 作为提示符。 +> - `PS4`:这个参数的值像 `PS1` 那样展开,如果设置了 `-x` 选项,这个展开值会在命令行被回显之前作为提示符显示。展开后的值的第一个字符在必要时会复制数次,指示间接层数。默认值是 `+ `。 +> +> **Bash 参考文档** +> **第五版,Bash 版本 5.0** +> **2019 年 5 月** + + Bash 的这一个方面就可以用整篇文章来讨论。你可以找到许许多多信息和例子。在本文末尾链接的存储库中提供了一些点文件范例,包括提示符重新配置。你可以随意使用该存储库中的例子进行学习和体验。 + +### 总结 + +既然你已经掌握了一些 Bash 的工作原理,那就可以轻松修改你的 Bash 点文件,满足你自己的需求和习惯。美化你的提示符,制作一些别名,这样你的电脑才真的属于你。查看 `/etc/profile`、`/etc/bashrc` 和 `/etc/profile.d/` 这些文件的内容,获得一些启发。 + +你也可以在这里写一些关于终端模拟器的评论。有很多办法可以将你最喜欢的终端,完全配置成你想要的样子。你或许早就想到了,但是通常可以通过……嗯……用户家目录的点文件实现这个目的。终端模拟器也可以作为登录会话启动,有些人总喜欢用登录环境。你使用终端和电脑的姿势,取决于你如何修改(或不修改)你的点文件。 + +如果你很好奇自己的命令行处于什么会话状态,使用下面这个脚本来判断一下。 + +``` +#!/bin/bash + +case "$-" in + (*i*) echo This shell is interactive ;; + (*) echo This shell is not interactive ;; +esac +``` + +把这几行放到一个文件里,加上可执行权限,然后运行,就能看到你当前处于何种类型的 shell。`$-` 在 Bash 中是一个变量,如果是交互式 shell,它会包含字母 `i`。此外,你可以直接输出 `$-` 变量然后检查它的输出中是否含有 `i` 标记。 + +``` +$ echo $- +``` + +### 参考信息 + +可以参考以下资料以获取更多信息和示例。Bash 手册也是一个很好的信息来源。请注意,确保你的本地手册页记录了你当前运行的 Bash 版本的特性,因为在网上找到的信息有时可能太老(过时了)或太新(你的系统还没有安装)。 + +- +- (在该网站中,你必须要输入一个有效的电子邮箱地址,或者注册,才能下载。) +- + +对本文有各种形式(点文件示例、提示,以及脚本文件)贡献的社区成员: + + * Micah Abbott – 首席质量工程师 + * John Lebon – 首席软件工程师 + * Dusty Mabe – 首席软件工程师 + * Colin Walters – 高级首席软件工程师 + +示例点文件和脚本可以在这个存储库中找到: + +- + +请仔细检查上面所提供的存储库中的信息。有些可能已经过时了。里面还包含很多开发中的自定义脚本和宠物容器pet container配置例子,那些不是点文件。我推荐从 John Lebon 的点文件开始学习,从头到尾都含有完善的解说,它们是我见过的最详细的,并且包含了非常好的描述。祝你学得开心! + +-------------------------------------------------------------------------------- + +via: https://fedoramagazine.org/customizing-bash/ + +作者:[Stephen Snow][a] +选题:[lujun9972][b] +译者:[nophDog](https://github.com/nophDog) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://fedoramagazine.org/author/jakfrost/ +[b]: https://github.com/lujun9972 +[1]: https://fedoramagazine.org/wp-content/uploads/2020/05/bashenvironment-816x346.png +[2]: https://en.wikipedia.org/wiki/Shell_(computing) +[3]: https://fedoramagazine.org/fedoras-gaggle-of-desktops/ +[4]: https://en.wikipedia.org/wiki/Comparison_of_command_shells +[5]: https://en.wikipedia.org/wiki/GNOME +[6]: https://en.wikipedia.org/wiki/Bash_(Unix_shell) +[7]: https://en.wikipedia.org/wiki/High-level_programming_language +[8]: https://en.wikipedia.org/wiki/C_(programming_language) +[9]: https://en.wikipedia.org/wiki/GNOME_Terminal +[10]: https://en.wikipedia.org/wiki/Pipeline_(Unix) +[11]: https://fedoramagazine.org/wp-content/uploads/2020/06/bash-initialization-1-1024x711.png +[12]: https://fedoramagazine.org/wp-content/uploads/2020/06/bash-initialization-2-1024x544.png +[13]: https://en.wikipedia.org/wiki/Boolean_data_type diff --git a/published/202007/20200701 How to install Java on a Mac.md b/published/202007/20200701 How to install Java on a Mac.md new file mode 100644 index 0000000000..0e59880994 --- /dev/null +++ b/published/202007/20200701 How to install Java on a Mac.md @@ -0,0 +1,193 @@ +[#]: collector: (lujun9972) +[#]: translator: (Yufei-Yan) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12393-1.html) +[#]: subject: (How to install Java on a Mac) +[#]: via: (https://opensource.com/article/20/7/install-java-mac) +[#]: author: (Daniel Oh https://opensource.com/users/daniel-oh) + +如何在 Mac 上安装 Java +====== + +> macOS 用户可以运行 Java 的开源版本,以及用于云原生cloud native开发的新框架。 + +![](https://img.linux.net.cn/data/attachment/album/202007/08/123211djuaz9io7l9dlpd7.jpg) + +五月底,Java 庆祝了它的 25 周年纪念日,为了纪念这一时刻,世界各地的开发人员使用 [#MovedByJava][3] 这一标签分享他们使用这一编程语言的成就、记忆以及愿景。 + +> 我的时间线: +> +> * 1999 开始学习 Java +> * 2007 创建 [@grailsframework][4] +> * 2008 共同创建 G20ne +> * 2009 被 SpringSource 收购 +> * 2015 加入 [@ObjectComputing][5] +> * 2018 创建 [@micronautfw][6] / 获得 [@groundbreakers][7] 奖 +> * 2019 成为 [@Java_Champions][8] +> +> 感谢你 [@java][9]![#MovedByJava][10] +> +> — Graeme Rocher (@graemerocher) [2020年5月21日][11] + +多年来,许多技术和趋势都促进了 Java 堆栈的开发、部署和在标准应用程序服务器上运行多个应用的能力。为 [Kubernetes][12] 构建容器镜像使得 Java 开发者可以在多个云环境中打包和部署[微服务][13]microservices,而不是在虚拟机上运行几个应用程序服务器。 + +![Timeline of technology contributions to Java][14] + +有了这些技术,Java 应用程序栈被优化为运行更大的堆和可以在运行时做出决策的高动态框架。然而不幸的是,这些努力还不足以使 Java 成为开发人员为无服务器serverless和事件驱动平台开发云原生cloud native Java 应用程序的首选编程语言。其他语言填补了这部分空缺,特别是 JavaScript、Python 和 Go,而 Rust 和 WebAssembly 也成了新的选择。 + +尽管存在这种竞争,[云原生 Java][16]cloud native Java 正在对以云为中心的软件开发产生影响。好在,新的 Java 框架(比如,[Quarkus][17]、[Micronaut][18] 和 [Helidon][19])最近已经战胜了这些挑战,它们提供了编译速度更快而且更小的应用,同时它们在设计之初就将分布式系统考虑了进去。 + +### 如何在 macOS 上安装 Java + +Java 开发的未来将从更多人安装和使用 Java 开始。因此,我将介绍如何在 macOS 上安装并开始使用 Java 开发环境。(如果你运行的是 Linux,请查看 Seth Kenlon 的文章《[如何在 Linux 上安装 Java][20]》) + +#### 通过 Brew 仓库安装 OpenJDK + +Homebrew 是 macOS 事实上的标准软件包管理器。如果你还没有安装的话,Matthew Broberg 的文章《[Homebrew 简介][21]》将带你完成这些步骤。 + +当你在 Mac 上安装好 Homebrew 后,使用 `brew` 命令安装 [OpenJDK][22],这是编写 Java 应用程序的开源方式: + +``` +$ brew cask install java +``` + +不到一分钟就能看到: + +``` +🍺 java was successfully installed! +``` + +通过 `java -version` 命令确认 OpenJDK 已经正确安装: + +``` +$ java -version +openjdk version "14.0.1" 2020-04-14 +OpenJDK Runtime Environment (build 14.0.1+7) +OpenJDK 64-Bit Server VM (build 14.0.1+7, mixed mode, sharing +``` + +从输出中可以确认 OpenJDK 14 (本文撰写时的最新版本)已经安装。 + +#### 从二进制文件安装 OpenJDK + +如果你并不热衷于包管理器,并且更愿意自己来管理 Java 的话,那么你总是可以选择下载并且手动安装。 + +我在 OpenJDK 主页上找到了最新版本的下载链接。下载 OpenJDK 14 的二进制文件: + +``` +$ wget https://download.java.net/java/GA/jdk14.0.1/664493ef4a6946b186ff29eb326336a2/7/GPL/openjdk-14.0.1_osx-x64_bin.tar.gz +``` + +移动到你保存二进制文件的目录,然后解压: + +``` +$ tar -xf openjdk-14.0.1_osx-x64_bin.tar.gz +``` + +接下来,将 Java 加入到你的 PATH: + +``` +$ export PATH=$PWD/jdk-14.0.1.jdk/Contents/Home/bin:$PATH +``` + +同时,将这条命令加到你的点文件中,`.bash_profile` 还是 `.zshrc` 取决于你运行的 shell。你可以在《[如何在 Linux 中设置你的 $PATH 变量][23]》一文中了解更多关于配置 `$PATH` 变量的内容。 + +最后,验证你安装的 OpenJDK 14: + +``` +$ java -version +openjdk version "14.0.1" 2020-04-14 +OpenJDK Runtime Environment (build 14.0.1+7) +OpenJDK 64-Bit Server VM (build 14.0.1+7, mixed mode, sharing) +``` + +### 在 Mac 上编写你的第一个[微服务][13]microservices + +现在,你已经准备好在 maxOS 上使用 OpenJDK 堆栈开发云原生cloud native Java 应用程序了。在本教程中,你将在 [Quarkus][17] 上创建一个新的 Java 项目,这个项目使用依赖注入dependency injection来公布 REST API。 + +你需要 [Maven][24] 启动,它是一个非常流行的 Java 依赖管理器。从 Maven 的网站[安装][25]它,或者通过 Homebrew 使用 `brew install maven` 命令。 + +执行以下 Maven 命令来配置 Quarkus 项目,并且创建一个简单的 web 应用: + +``` +$ mvn io.quarkus:quarkus-maven-plugin:1.5.1.Final:create \ +    -DprojectGroupId=com.example \ +    -DprojectArtifactId=getting-started \ +    -DclassName="com.example.GreetingResource" \ +    -Dpath="/hello" +cd getting-started +``` + +运行这个应用: + +``` +$ ./mvnw quarkus:dev +``` + +当应用程序运行的时候,你可以看到这个输出: + +``` +__  ____  __  _____   ___  __ ____  ______ + --/ __ \/ / / / _ | / _ \/ //_/ / / / __/ + -/ /_/ / /_/ / __ |/ , _/ ,< / /_/ /\ \   +\--\\___\\_\\____/_/ |_/_/|_/_/|_|\\____/___/   +2020-06-13 00:03:06,413 INFO  [io.quarkus] (Quarkus Main Thread) getting-started 1.0-SNAPSHOT on JVM (powered by Quarkus 1.5.1.Final) started in 1.125s. Listening on: +2020-06-13 00:03:06,416 INFO  [io.quarkus] (Quarkus Main Thread) Profile dev activated. Live Coding activated. +2020-06-13 00:03:06,416 INFO  [io.quarkus] (Quarkus Main Thread) Installed features: [cdi, resteasy] +``` + +使用 `curl` 命令访问 REST 端点: + +``` +$ curl -w "\n" http://localhost:8080/hello +hello +``` + +恭喜!通过使用 Mavan 和 Quarkus,你很快从没有安装 Java 的环境里创建了第一个 web 应用。 + +### 接下来用 Java 做什么 + +Java 是一个成熟的编程语言,通过专门为云原生cloud native应用程序开发设计的新框架,Java 的热度会一直持续下去。 + +如果你正走在这样构建未来应用的路上,你可能会对更多实用的 Quarkus 开发课程或其他现代化框架感兴趣。无论你在构建什么,下一步是配置你的文本编辑器。阅读我关于《[在 VS Code 用 Quarkus 编写 Java][26]》的教程,然后再看看你能做什么。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/7/install-java-mac + +作者:[Daniel Oh][a] +选题:[lujun9972][b] +译者:[Yufei-Yan](https://github.com/Yufei-Yan) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/daniel-oh +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/coffee_cafe_brew_laptop_desktop.jpg?itok=G-n1o1-o (Coffee and laptop) +[2]: https://opensource.com/resources/java +[3]: https://twitter.com/search?q=%23MovedByJava&src=typed_query +[4]: https://twitter.com/grailsframework?ref_src=twsrc%5Etfw +[5]: https://twitter.com/ObjectComputing?ref_src=twsrc%5Etfw +[6]: https://twitter.com/micronautfw?ref_src=twsrc%5Etfw +[7]: https://twitter.com/groundbreakers?ref_src=twsrc%5Etfw +[8]: https://twitter.com/Java_Champions?ref_src=twsrc%5Etfw +[9]: https://twitter.com/java?ref_src=twsrc%5Etfw +[10]: https://twitter.com/hashtag/MovedByJava?src=hash&ref_src=twsrc%5Etfw +[11]: https://twitter.com/graemerocher/status/1263484918157410304?ref_src=twsrc%5Etfw +[12]: https://opensource.com/resources/what-is-kubernetes +[13]: https://opensource.com/resources/what-are-microservices +[14]: https://opensource.com/sites/default/files/uploads/javatimeline.png (Timeline of technology contributions to Java) +[15]: https://creativecommons.org/licenses/by-sa/4.0/ +[16]: https://opensource.com/article/20/1/cloud-native-java +[17]: https://quarkus.io/ +[18]: https://micronaut.io/ +[19]: https://helidon.io/#/ +[20]: https://linux.cn/article-11614-1.html +[21]: https://linux.cn/article-12338-1.html +[22]: https://openjdk.java.net/ +[23]: https://opensource.com/article/17/6/set-path-linux +[24]: https://maven.apache.org/index.html +[25]: https://maven.apache.org/install.html +[26]: https://opensource.com/article/20/4/java-quarkus-vs-code diff --git a/published/202007/20200702 Customizing my Linux terminal with tmux and Git.md b/published/202007/20200702 Customizing my Linux terminal with tmux and Git.md new file mode 100644 index 0000000000..127da8332b --- /dev/null +++ b/published/202007/20200702 Customizing my Linux terminal with tmux and Git.md @@ -0,0 +1,67 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12450-1.html) +[#]: subject: (Customizing my Linux terminal with tmux and Git) +[#]: via: (https://opensource.com/article/20/7/tmux-git) +[#]: author: (Moshe Zadka https://opensource.com/users/moshez) + +使用 tmux 和 Git 自定义我的 Linux 终端 +====== + +> 设置你的控制台,以便你能知道身处哪个目录和该做什么 + +![](https://img.linux.net.cn/data/attachment/album/202007/25/102841u8u6ns4tp9z8bnha.jpg) + +我使用 GNOME 终端,主要是因为它是我的发行版的默认设置。但是我终端内远非“默认值”。在我开始解释如何自定义它之前,它现在是这个样子: + +![Moshe Zadka's terminal][2] + +### 从底部开始 + +我使用终端多路复用技术 [tmux][4] 管理我的终端体验。 + +在上图的底部,你可以看到我的绿色 tmux 栏。底部的 `[3]` 表示它是第三个终端:每个终端都运行自己的 tmux 会话。(我创建了一个新会话来放大字体,这样可在截图中更容易看到;这是它与其他终端之间的唯一区别。) + +提示符看起来也很有趣,对吧?在提示符中塞入了太多信息后,我喜欢插上一个换行符,这样一来,如果我想即兴进行 shell 编程或编写一个传递了五次的管道,也不会超出屏幕界限。这样做的代价是简单的命令序列(新建、复制、移动)会更快地滚动出我的屏幕。 + +行末是 [阿列夫零][5]Aleph null 字符,它是最小的[无穷基数][6]。我希望内容行的结束很明显,并且当我意识到“阿列夫”和下标 0 都是 Unicode 字符时,我无法抗拒使用“阿列夫零”作为提示符的一部分的诱惑。(数学极客们,团结起来!) + +在此之前是我的用户名。由于我在不同用户名的多台计算机上使用相同的[点文件][7](保存在 Git 中),因此这个还算有用。 + +在我的用户名之前,是我所在目录的最后一部分。完整路径通常太长且无用,而当前目录对于像我这样的经常忘记在做什么人来说是很有用的。在此之前是机器的名称。我所有的机器都以我喜欢的电视节目命名。我的旧笔记本是 `mcgyver`。 + +提示符中的第一位是我最喜欢的:一个让我知道目录的 Git 状态的字母。如果目录为“不在 Git 中”,那么是 `G`。如果目录为“没有问题”(OK),且无需任何操作,那么是 `K`。如果有 Git 未知的文件需要添加或忽略,那么是 `!`。如果需要提交,那么是 `C`。如果没有上游,那么是 `U`。如果存在上游,但我没有推送,那么是 `P`。该方案不是基于当前状态,而是描述了我要做的*下一个动作*。(要回顾 Git 术语,请阅读[本文][8]。) + +终端功能是通过一个有趣的 Python 程序完成的。它运行 `python -m howsit`(在我把 [howsit][9] 安装在虚拟环境中之后)。 + +你可以在上图中看到渲染效果,但是为了完整起见,这是我的 `PS1`: + +``` +[$(~/.virtualenvs/howsit/bin/python -m howsit)]\h:\W \u ℵ₀   +$ +``` + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/7/tmux-git + +作者:[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://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/lenovo-thinkpad-laptop-window-focus.png?itok=g0xPm2kD (young woman working on a laptop) +[2]: https://opensource.com/sites/default/files/uploads/terminal-tmux-moshezadka.png (Moshe Zadka's terminal) +[3]: https://creativecommons.org/licenses/by-sa/4.0/ +[4]: https://opensource.com/article/20/1/tmux-console +[5]: https://simple.wikipedia.org/wiki/Aleph_null +[6]: https://gizmodo.com/a-brief-introduction-to-infinity-5809689 +[7]: https://opensource.com/article/19/3/move-your-dotfiles-version-control +[8]: https://opensource.com/article/19/2/git-terminology +[9]: https://pypi.org/project/howsit/ diff --git a/published/202007/20200702 Ex-Solus Dev is Now Creating a Truly Modern Linux Distribution Called Serpent Linux.md b/published/202007/20200702 Ex-Solus Dev is Now Creating a Truly Modern Linux Distribution Called Serpent Linux.md new file mode 100644 index 0000000000..a8c6507f06 --- /dev/null +++ b/published/202007/20200702 Ex-Solus Dev is Now Creating a Truly Modern Linux Distribution Called Serpent Linux.md @@ -0,0 +1,83 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12401-1.html) +[#]: subject: (Ex-Solus Dev is Now Creating a Truly Modern Linux Distribution Called Serpent Linux) +[#]: via: (https://itsfoss.com/serpent-os-announcement/) +[#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/) + +Solus Linux 创始人正在开发一个没有 GNU 的“真正现代”的 Linux 发行版 +====== + +曾经创建独立 Linux 发行版 Solus 的开发人员 [Ikey Doherty][1] 宣布了他的新项目:Serpent OS。 + +[Serpent OS][2] 是一个**不想**被归类为“轻量级、用户友好、注重隐私的 Linux 桌面发行版”。 + +相反,Serpent OS 具有“与主流产品不同的目标”。具体怎么样?请继续阅读。 + +### Serpent OS:制作“真正现代”的 Linux 发行版 + +![][3] + +Serpent 采用发行版优先,兼容靠后的方法。这使他们可以做出一些非常大胆的决定。 + +Ikey 表示,这个项目不会对阻碍 Linux 的负面角色容忍。例如,不会容忍 NVIDIA 在其 GPU 上缺乏对 Wayland 加速的支持,并将 NVIDIA 专有驱动加入发行版黑名单。 + +这是 Serpent Linux 项目的拟议计划(摘自[其网站][4]): + + * 不再分割 usrbin + * 100% clang 构建(包括内核) + * musl 作为 libc,依靠编译器优化而不是内联 asm + * 使用 libc++ 而不是 libstdc++ + * LLVM 的 binutils 变体(lld、as 等) + * 混合源代码/二进制分发 + * 从 x86\_64 通用基线转移到更新的 CPU,包括针对 Intel 和 AMD 的优化 + * 包管理器中基于功能的订阅(硬件/用户选择等) + * 只支持 UEFI。不支持老式启动方式 + * 完全开源,包括引导程序/重建脚本 + * 针对高工作负载进行了认真的优化 + * 第三方应用仅依赖于容器。没有兼容性修改 + * 仅支持 Wayland。将调查通过容器的 X11 兼容性 + * 完全无状态的管理工具和上游补丁 + +Ikey 大胆地宣称 Serpent Linux 不是 Serpent GNU/Linux,因为它不再依赖于 GNU 工具链或运行时。 + +Serpent OS 项目的开发将于 7 月底开始。没有确定最终稳定版本的时间表。 + +### 要求过高?但是 Ikey 过去做到了 + +你可能会怀疑 Serpent OS 是否会出现,是否能够兑现其所作的所有承诺。 + +但是 Ikey Doherty 过去已经做到了。如果我没记错的话,他首先基于 Debian 创建了 SolusOS。他于 2013 年停止了基于 [Debian 的 SolusOS][5] 的开发,甚至它还没有进入 Beta 阶段。 + +然后,他从头开始创建 [evolve OS][6],而不是使用其他发行版作为基础。由于某些命名版权问题,项目名称已更改为 Solus(是的,相同的旧名称)。[Ikey 在 2018 年退出了 Solus 项目][7],其他开发人员现在负责该项目。 + +Solus 是一个独立的 Linux 发行版,它为我们提供了漂亮的 Budgie 桌面环境。 + +Ikey 过去做到了(当然,在其他开发人员的帮助下)。他现在也应该能够做到。 + +### 看好还是不看好? + +你如何看待这个 Serpent Linux?你是否认为是时候让开发人员采取大胆的立场,并着眼于未来开发操作系统,而不是坚持过去?请分享你的观点。 + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/serpent-os-announcement/ + +作者:[Abhishek Prakash][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://itsfoss.com/author/abhishek/ +[b]: https://github.com/lujun9972 +[1]: https://itsfoss.com/ikey-doherty-serpent-interview/ +[2]: https://www.serpentos.com/ +[3]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/07/serpent-linux.png?ssl=1 +[4]: https://www.serpentos.com/about/ +[5]: https://distrowatch.com/table.php?distribution=solusos +[6]: https://itsfoss.com/beta-evolve-os-released/ +[7]: https://itsfoss.com/ikey-leaves-solus/ diff --git a/published/202007/20200703 openSUSE Leap 15.2 Released With Focus on Containers, AI and Encryption.md b/published/202007/20200703 openSUSE Leap 15.2 Released With Focus on Containers, AI and Encryption.md new file mode 100644 index 0000000000..522ce76e8c --- /dev/null +++ b/published/202007/20200703 openSUSE Leap 15.2 Released With Focus on Containers, AI and Encryption.md @@ -0,0 +1,130 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12425-1.html) +[#]: subject: (openSUSE Leap 15.2 Released With Focus on Containers, AI and Encryption) +[#]: via: (https://itsfoss.com/opensuse-leap-15-2-release/) +[#]: author: (Ankush Das https://itsfoss.com/author/ankush/) + +openSUSE Leap 15.2 发布:重点关注容器、AI 和加密 +====== + +![](https://img.linux.net.cn/data/attachment/album/202007/16/230428vklhwrzllll2eu82.jpg) + +[openSUSE][1] Leap 15.2 最终带来了一些有用的变化和改进。 + +同时,我想到 SUSE 这篇让人激动的公告《[消除 Leap 差异][2]》,openSUSE Leap 15.2 的发布使我们下一步将 SLE([SUSE Linux Enterprise][3])二进制文件集成到 openSUSE Leap 15.3 更加近了一步。 + +让我们看一下 openSUSE Leap 15.2 中发生了哪些变化和改进。 + +### openSUSE Leap 15.2:关键变化 + +![][4] + +总体而言,openSUSE Leap 15.2 发行版涉及安全更新、新的主要软件包、bug 修复以及其他改进。 + +该项目的开发人员 Marco Varlese 在新闻稿中提到: + +>“ Leap 15.2 代表了人工智能领域的巨大进步,我很高兴 openSUSE 用户现在终于可以通过我们的仓库使用机器学习/深度学习框架和应用,以享受稳定和最新的生态系统。” + +尽管这暗示了可能涉及的一些变化,以下是 openSUSE Leap 15.2 中的新功能: + +#### 添加人工智能(AI)和机器学习包 + +毫无疑问,人工智能(AI)和机器学习是最具颠覆性的技术。 + +为了向用户提供便利,openSUSE Leap 15.2 为新的开源技术添加了许多重要的软件包: + + * [Tensorflow][5] + * [PyTorch][6] + * [ONNX][7] + * [Grafana][8] + * [Prometheus][9] + +#### 引入实时内核 + +![][10] + +在 openSUSE Leap 15.2 中,将引入实时内核来管理[微处理器][11]的时序,以有效处理时间关键的事件。 + +实时内核的添加对于现实意义重大。项目委员会主席 Gerald Pfeifer 的讲话如下: + +>“将实时内核添加到 openSUSE Leap 开启了新的可能性。想想边缘计算、嵌入式设备、数据抓取,所有这些都在飞速发展。从历史上看,其中很多都是专有领域。现在,openSUSE 为有兴趣测试实时功能的开发者、研究人员和公司甚至贡献者将打开了通道。这是另一个开源帮助开放的领域!” + +#### 纳入容器技术 + +在最新版本中,你会注意到 [Kubernetes][12] 作为官方包而纳入其中。这让用户可以轻松地自动化部署、扩展和管理容器化的应用。 + +[Helm][13](Kubernetes 的包管理器)也是内置的。不仅于此,你还可以在此找到其他一些附加功能,从而可以更轻松地保护和部署容器化应用。 + +#### 更新的 openSUSE 安装程序 + +![][14] + +openSUSE 的安装程序已经非常不错。但是,在最新的 Leap 15.2 版本中,它们添加了更多信息,兼容从右至左语言(如阿拉伯语)以及一些小的更改,从而在安装时更容易选择。 + +#### YaST 改进 + +尽管 [YaST][15] 已经是一个非常强大的安装和配置工具,但是此发行版增加了创建和管理 Btrfs 文件系统以及实施高级加密技术的能力。 + +当然,你肯定知道 [openSUSE 在 WSL][16] 的可用性。因此,根据 Leap 15.2 的发行说明,YaST 与 WSL 的兼容性得到了改善。 + +#### 桌面环境改进 + +![][17] + +可用的桌面环境已更新为最新版本,包括 [KDE Plasma 5.18 LTS][18] 和 [GNOME 3.34][19]。 + +你还能发现更新的 [XFCE 4.14][20] 桌面在 openSUSE Leap 15.2 上也是可用的。 + +如果你想知道最新版本的所有详细信息,可以参考[官方发布公告][21]。 + +### 下载和可用性 + +目前,你可以找到 Leap 15.2 的 Linode 云镜像。另外,你会注意到其他云托管服务(如 AWS、Azure 和其他服务)也提供了它。 + +你还可以从官方网站获取 DVD ISO 或网络镜像文件。 + +要升级你当前的安装,我建议按照[官方说明][22]操作。 + +- [openSUSE Leap 15.2][23] + +你尝试过 openSUSE Leap 15.2 了么?请随时让我知道你的想法! + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/opensuse-leap-15-2-release/ + +作者:[Ankush Das][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://itsfoss.com/author/ankush/ +[b]: https://github.com/lujun9972 +[1]: https://www.opensuse.org/ +[2]: https://www.suse.com/c/sle-15-sp2-schedule-and-closing-the-opensuse-leap-gap/ +[3]: https://www.suse.com/ +[4]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/07/opensuse-leap-15-2-gnome.png?ssl=1 +[5]: https://www.tensorflow.org +[6]: https://pytorch.org +[7]: https://onnx.ai +[8]: https://grafana.com +[9]: https://prometheus.io/docs/introduction/overview/ +[10]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/07/opensuse-leap-15-2-terminal.png?ssl=1 +[11]: https://en.wikipedia.org/wiki/Microprocessor +[12]: https://kubernetes.io +[13]: https://helm.sh +[14]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/07/opensuse-leap-15-2.png?ssl=1 +[15]: https://yast.opensuse.org/ +[16]: https://itsfoss.com/opensuse-bash-on-windows/ +[17]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/07/opensue-leap-15-2-kde.png?ssl=1 +[18]: https://itsfoss.com/kde-plasma-5-18-release/ +[19]: https://itsfoss.com/gnome-3-34-release/ +[20]: https://www.xfce.org/about/news/?post=1565568000 +[21]: https://en.opensuse.org/Release_announcement_15.2 +[22]: https://en.opensuse.org/SDB:System_upgrade +[23]: https://software.opensuse.org/distributions/leap diff --git a/published/202007/20200706 Project OWL- IoT trying to hold connectivity together in disasters.md b/published/202007/20200706 Project OWL- IoT trying to hold connectivity together in disasters.md new file mode 100644 index 0000000000..bd52eec6e3 --- /dev/null +++ b/published/202007/20200706 Project OWL- IoT trying to hold connectivity together in disasters.md @@ -0,0 +1,57 @@ +[#]: collector: (lujun9972) +[#]: translator: (Yufei-Yan) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12435-1.html) +[#]: subject: (Project OWL: IoT trying to hold connectivity together in disasters) +[#]: via: (https://www.networkworld.com/article/3564980/project-owl-iot-trying-to-hold-connectivity-together-in-disasters.html) +[#]: author: (Jon Gold https://www.networkworld.com/author/Jon-Gold/) + +OWL 项目:物联网正尝试在灾难中让一切保持联络 +====== + +> 当自然灾害破坏了传统的通信连接时,配置在多跳网络mesh network的物联网设备可以迅速部署以提供基本的连接。 + +![](https://img.linux.net.cn/data/attachment/album/202007/21/135614mwr8rxr6lw5xefjs.jpg) + +OWL 项目负责人在最近的开源峰会上说,一个以多跳网络、物联网和 LoRa 连接为中心的开源项目可以帮助急救和受灾人员在自然灾害之后保持联系。 + +OWL 项目的应用场景是当在自然灾害之后频繁发生的通信中断时。无论是蜂窝网络还是有线网络,大范围的中断会频繁阻碍急救服务、供应和在暴风雨或其他重大灾难后必须解决关键问题的信息流。 + +该项目通过一大群“鸭子duck”(便宜、易于部署且不需要现有基础设施支持的小型无线模块)实现这个目的。一些“鸭子”是太阳能的,其它一些则用的是耐用电池。每只“鸭子”配备一个 LoRa 无线电,用于在网络上和其它“鸭子”进行通信,同时还配备有 Wi-Fi,而且可能配备蓝牙和 GPS 来实现其他功能。 + +这个想法是这样的,当网络瘫痪时,用户可以使用他们的智能手机或者笔记本电脑与“鸭子”建立一个 Wi-Fi 连接,这个“鸭子”可以将小块的信息传递到网络的其他部分。信息向网络后端传递,直到到达“鸭子爸爸papaduck”,“鸭子爸爸”装备了可以与云上的 OWL 数据管理系统连接的卫星系统(OWL 代表 ”组织organization位置whereabouts物流logistics”)。信息可以通过云在智能手机或者网页上进行可视化,甚至可以通过 API 插入到现有的系统中。 + +秘密在于“鸭群ClusterDuck” 协议,这是一个开源固件,即使在一些模块不能正常工作的网络中,它仍然能保持信息流通。它就是设计用来工作在大量便宜且容易获取的计算硬件上,类似树莓派的硬件,这样可以更容易且更快捷的建立一个“鸭群”网络。 + +创始人 Bryan Knouse 表示,这个项目的创建,是因为在 2017 年和 2018 年的毁灭性飓风中,要与受影响社区进行有效的通信而采取救援措施,面临着巨大的困难。 + +“我们的一些创始成员经历了这些灾难,然后我们会问‘我们该做些什么?’”,他说道。 + +在马亚圭斯,该项目有一批来自波多黎各大学的学生和教授,大多数的系统测试都在那里进行。Knouse 说,校园中目前有 17 个太阳能“鸭子”,分布在屋顶和树上,并且计划增加数量。 + +他说,“这种关系实际上创建了一个开源社区,这些学生和教授正在帮助我们开发这个项目。” + +-------------------------------------------------------------------------------- + +via: https://www.networkworld.com/article/3564980/project-owl-iot-trying-to-hold-connectivity-together-in-disasters.html + +作者:[Jon Gold][a] +选题:[lujun9972][b] +译者:[Yufei-Yan](https://github.com/Yufei-Yan) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://www.networkworld.com/author/Jon-Gold/ +[b]: https://github.com/lujun9972 +[1]: https://images.idgesg.net/images/article/2019/01/owl-face-100785829-large.jpg +[2]: https://creativecommons.org/licenses/by/2.0/legalcode +[3]: https://www.networkworld.com/article/3207535/what-is-iot-the-internet-of-things-explained.html +[4]: https://www.networkworld.com/article/3356838/how-to-determine-if-wi-fi-6-is-right-for-you.html +[5]: https://www.networkworld.com/article/3250268/what-is-mu-mimo-and-why-you-need-it-in-your-wireless-routers.html +[6]: https://www.networkworld.com/article/3402316/when-to-use-5g-when-to-use-wi-fi-6.html +[7]: https://www.networkworld.com/article/3306720/mobile-wireless/how-enterprises-can-prep-for-5g.html +[8]: https://www.networkworld.com/article/3560993/what-is-wi-fi-and-why-is-it-so-important.html +[9]: https://www.facebook.com/NetworkWorld/ +[10]: https://www.linkedin.com/company/network-world diff --git a/published/202007/20200707 What you need to know about hash functions.md b/published/202007/20200707 What you need to know about hash functions.md new file mode 100644 index 0000000000..062179dd21 --- /dev/null +++ b/published/202007/20200707 What you need to know about hash functions.md @@ -0,0 +1,84 @@ +[#]: collector: (lujun9972) +[#]: translator: (Yufei-Yan) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12408-1.html) +[#]: subject: (What you need to know about hash functions) +[#]: via: (https://opensource.com/article/20/7/hash-functions) +[#]: author: (Mike Bursell https://opensource.com/users/mikecamel) + +关于哈希(散列)函数你应该知道的东西 +====== + +> 从输出的哈希值反推回输入,这从计算的角度是不可行的。 + +![](https://img.linux.net.cn/data/attachment/album/202007/12/145709d3ne3vee330oh3lv.jpg) + +无论安全从业人员用计算机做什么,有一种工具对他们每个人都很有用:加密哈希(散列)hash函数。这听起来很神秘、很专业,甚至可能有点乏味,但是, 在这里,关于什么是哈希函数以及它们为什么对你很重要,我会作出一个简洁的解释。 + +加密哈希函数,比如 SHA-256 或者 MD5,接受一组二进制数据(通常是字节)作为输入,并且对每个可能的输入集给出一个希望唯一hopefully unique的输出。对于任意模式的输入,给定的哈希函数的输出(“哈希值”)的长度都是一样的(对于 SHA-256,是 32 字节或者 256 比特,这从名字中就能看出来)。最重要的是:从输出的哈希值反推回输入,这从计算的角度是不可行的implausible(密码学家讨厌 “不可能impossible” 这个词)。这就是为什么它们有时候被称作单向哈希函数one-way hash function。 + +但是哈希函数是用来做什么的呢?为什么“唯一”的属性如此重要? + +### 唯一的输出 + +在描述哈希函数的输出时,“希望唯一hopefully unique”这个短语是至关重要的,因为哈希函数就是用来呈现完全唯一的输出。比如,哈希函数可以用于验证 *你* 下载的文件副本的每一个字节是否和 *我* 下载的文件一样。你下载一个 Linux 的 ISO 文件或者从 Linux 的仓库中下载软件时,你会看到使用这个验证过程。没有了唯一性,这个技术就没用了,至少就通常的目的而言是这样的。 + +如果两个不同的输入产生了相同的输出,那么这样的哈希过程就称作“碰撞collision”。事实上,MD5 算法已经被弃用,因为虽然可能性微乎其微,但它现在可以用市面上的硬件和软件系统找到碰撞。 + +另外一个重要的特性是,消息中的一个微小变化,甚至只是改变一个比特位,都可能会在输出中产生一个明显的变化(这就是“雪崩效应avalanche effect”)。 + +### 验证二进制数据 + +哈希函数的典型用途是当有人给你一段二进制数据,确保这些数据是你所期望的。无论是文本、可执行文件、视频、图像或者一个完整的数据库数据,在计算世界中,所有的数据都可以用二进制的形式进行描述,所以至少可以这么说,哈希是广泛适用的。直接比较二进制数据是非常缓慢的且计算量巨大,但是哈希函数在设计上非常快。给定两个大小为几 M 或者几 G 的文件,你可以事先生成它们的哈希值,然后在需要的时候再进行比较。 + +通常,对哈希值进行签名比对大型数据集本身进行签名更容易。这个特性太重要了,以至于密码学中对哈希值最常见的应用就是生成“数字”签名。 + +由于生成数据的哈希值很容易,所以通常不需要有两套数据。假设你想在你的电脑上运行一个可执行文件。但是在你运行之前,你需要检查这个文件就是你要的文件,没有被黑客篡改。你可以方便快捷的对文件生成哈希值,只要你有一个这个哈希值的副本,你就可以相当肯定这就是你想要的文件。 + +下面是一个简单的例子: + +``` +$ shasum -a256 ~/bin/fop +87227baf4e1e78f6499e4905e8640c1f36720ae5f2bd167de325fd0d4ebc791c  /home/bob/bin/fop +``` + +如果我知道 `fop` 这个可执行文件的 SHA-256 校验和,这是由供应商(这个例子中是 Apache 基金会)提供的: + +``` +87227baf4e1e78f6499e4905e8640c1f36720ae5f2bd167de325fd0d4ebc791c +``` + +然后我就可以确信,我驱动器上的这个可执行文件和 Apache 基金会网站上发布的文件是一模一样的。这就是哈希函数难以发生碰撞(或者至少是 *很难通过计算得到碰撞*)这个性质的重要之处。如果黑客能将真实文件用哈希值相同的文件轻易的进行替换,那么这个验证过程就毫无用处。 + +事实上,这些性质还有更技术性的名称,我上面所描述的将三个重要的属性混在了一起。更准确地说,这些技术名称是: + +1. 抗原像性pre-image resistance:给定一个哈希值,即使知道用了什么哈希函数,也很难得到用于创建它的消息。 +2. 抗次原像性second pre-image resistance:给定一个消息,很难找到另一个消息,使得这个消息可以产生相同的哈希值。 +3. 抗碰撞性collision resistance:很难得到任意两个可以产生相同哈希值的消息。 + +*抗碰撞性* 和 *抗次原像性* 也许听上去是同样的性质,但它们具有细微而显著的不同。*抗次原像性* 说的是如果 *已经* 有了一个消息,你也很难得到另一个与之哈希值相匹配的消息。*抗碰撞性* 使你很难找到两个可以生成相同哈希值的消息,并且要在哈希函数中实现这一性质则更加困难。 + +让我回到黑客试图替换文件(可以通过哈希值进行校验)的场景。现在,要在“外面”使用加密哈希算法(除了使用那些在现实世界中由独角兽公司开发的完全无 Bug 且安全的实现之外),还有一些重要且困难的附加条件需要满足。认真的读者可能已经想到了其中一些,特别需要指出的是: + +1. 你必须确保自己所拥有的哈希值副本也没有被篡改。 +2. 你必须确保执行哈希算法的实体能够正确执行并报告了结果。 +3. 你必须确保对比两个哈希值的实体确实报告了这个对比的正确结果。 + +确保你能满足这些条件绝对不是一件容易的事。这就是可信平台模块Trusted Platform Modules(TPM)成为许多计算系统一部分的原因之一。它们扮演着信任的硬件基础,可以为验证重要二进制数据真实性的加密工具提供保证。TPM 对于现实中的系统来说是有用且重要的工具,我也打算将来写一篇关于 TPM 的文章。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/7/hash-functions + +作者:[Mike Bursell][a] +选题:[lujun9972][b] +译者:[Yufei-Yan](https://github.com/Yufei-Yan) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/mikecamel +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/osdc_OpenData_CityNumbers.png?itok=lC03ce76 +[2]: https://aliceevebob.com/2020/06/16/whats-a-hash-function/ diff --git a/published/202007/20200708 How to decipher Linux release info.md b/published/202007/20200708 How to decipher Linux release info.md new file mode 100644 index 0000000000..55a2d68d8c --- /dev/null +++ b/published/202007/20200708 How to decipher Linux release info.md @@ -0,0 +1,138 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12418-1.html) +[#]: subject: (How to decipher Linux release info) +[#]: via: (https://www.networkworld.com/article/3565432/how-to-decipher-linux-release-info.html) +[#]: author: (Sandra Henry-Stocker https://www.networkworld.com/author/Sandra-Henry_Stocker/) + +如何解密 Linux 版本信息 +====== + +> 显示和解释有关 Linux 版本的信息比看起来要复杂一些。 + +![christin hume / Linux / Modified by IDG Comm.][1] + +与引用一个简单的版本号不同,识别 Linux 版本有很多种方法。即使只是快速查看一下 `uname` 命令的输出,也可以告诉你一些信息。这些信息是什么,它告诉你什么? + +在本文中,我们将认真研究 `uname` 命令的输出以及其他一些命令和文件提供的版本说明。 + +### 使用 uname + +每当在 Linux 系统终端窗口中执行命令 `uname -a` 时,都会显示很多信息。那是因为这个小小的 `a` 告诉 `uname` 命令你想查看该命令能提供的*全部*输出。结果显示的内容将告诉你许多有关该系统的各种信息。实际上,显示的每一块信息都会告诉你一些关于系统的不同信息。 + +例如,`uname -a` 输出看起来像这样: + +``` +$ uname -a +Linux dragonfly 5.4.0-37-generic #41-Ubuntu SMP Wed Jun 3 18:57:02 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux +``` + +尽管这可能不太重要,但你可以使用一个按适当的顺序包含 `uname` 所有选项来显示相同的信息: + +``` +$ uname -snmrvpio +Linux dragonfly 5.4.0-37-generic #41-Ubuntu SMP Wed Jun 3 18:57:02 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux +``` + +要将这一长串信息分解为单独的块,可以使用类似这样的 `for` 循环来遍历每个选项: + +``` +$ for option in s n m r v p i o; do echo -n "$option: "; uname -$option; done +s: Linux +n: dragonfly +m: x86_64 +r: 5.4.0-37-generic +v: #41-Ubuntu SMP Wed Jun 3 18:57:02 UTC 2020 +p: x86_64 +i: x86_64 +o: GNU/Linux +``` + +该循环显示了该选项提供了哪些信息。`uname` 手册页提供了每个选项的描述。以下是清单: + +- Linux –- 内核名称(选项 `s`) +- dragonfly –- 节点名(选项 `n`) +- x86_64 –- 机器硬件名(选项 `m`) +- 5.4.0-37-generic –- 内核发布版本(选项 `r`) +- #41-Ubuntu SMP Wed Jun 3 18:57:02 UTC 2020 -- 内核版本(选项 `v`) +- x86_64 –- 处理器(选项 `p`) +- x86_64 –- 硬件平台(选项 `i`) +- GNU/Linux –- 操作系统(选项 `o`) + +要更深入地研究显示的信息,请认真查看显示的内核发行数据。第四行中的 `5.4.0-37` 不仅仅是一串任意数字。每个数字都很重要。 + + * `5` 表示内核版本 + * `4` 表示主要版本 + * `0` 表示次要版本 + * `37` 表示最新补丁 + +此外,在上面的循环中输出的第 5 行(内核版本)中的 `#41` 表示此发布版本已编译 41 次。 + +如果你只想显示所有信息中的一项,那么单个选项可能很有用。例如,命令 `uname -n` 可以仅告诉你系统名称,而 `uname -r` 仅可以告诉你内核发布版本。在盘点服务器或构建脚本时,这些和其他选项可能很有用。 + +在 Red Hat 系统时,`uname -a` 命令将提供相同种类的信息。这是一个例子: + +``` +$ uname -a +Linux fruitfly 4.18.0-107.el8.x86_64 #1 SMP Fri Jun 14 13:46:34 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux +``` + +### 发行版信息 + +如果你需要了解运行的发行版是什么,那么 `uname` 的输出不会对你有太大帮助。毕竟,内核版本与发行版不同。关于这个信息,你可以在 Ubuntu 和其他基于 Debian 的系统上使用 `lsb_release -r` 命令,而在 Red Hat 上可以显示 `/etc/redhat-release` 文件的内容。 + +对于 Debian 系统: + +``` +$ lsb_release -r +Release: 20.04 +``` + +对于 Red Hat 及相关系统: + +``` +$ cat /etc/redhat-release +Red Hat Enterprise Linux release 8.1 Beta (Ootpa) +``` + +### 使用 /proc/version + +`/proc/version` 文件还可以提供有关 Linux 版本的信息。该文件中提供的信息与 `uname -a` 输出有很多共同点。以下是例子。 + +在 Ubuntu 上: + +``` +$ cat /proc/version +Linux version 5.4.0-37-generic (buildd@lcy01-amd64-001) (gcc version 9.3.0 (Ubuntu 9.3.0-10ubuntu2)) #41-Ubuntu SMP Wed Jun 3 18:57:02 UTC 2020 +``` + +在 RedHat 上: + +``` +$ cat /proc/version +Linux version 4.18.0-107.el8.x86_64 (mockbuild@x86-vm-09.build.eng.bos.redhat.com) (gcc version 8.3.1 20190507 (Red Hat 8.3.1-4) (GCC)) #1 SMP Fri Jun 14 13:46:34 UTC 2019 +``` + +### 总结 + +Linux 系统提供了很多关于内核和发行版安装的信息。你只需要知道在哪里或如何寻找并理解它的含义。 + +-------------------------------------------------------------------------------- + +via: https://www.networkworld.com/article/3565432/how-to-decipher-linux-release-info.html + +作者:[Sandra Henry-Stocker][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://www.networkworld.com/author/Sandra-Henry_Stocker/ +[b]: https://github.com/lujun9972 +[1]: https://images.idgesg.net/images/article/2020/07/linux_woman-with-laptop_keyboard_code_programmer_devops_by-christin-hume-via-unsplash_linux_-100850842-large.jpg +[2]: https://creativecommons.org/publicdomain/zero/1.0/ +[3]: https://www.facebook.com/NetworkWorld/ +[4]: https://www.linkedin.com/company/network-world diff --git a/published/202007/20200708 Program IoT systems using Python with this VSCode plugin for RTOS.md b/published/202007/20200708 Program IoT systems using Python with this VSCode plugin for RTOS.md new file mode 100644 index 0000000000..a59350cf87 --- /dev/null +++ b/published/202007/20200708 Program IoT systems using Python with this VSCode plugin for RTOS.md @@ -0,0 +1,153 @@ +[#]: collector: (lujun9972) +[#]: translator: (silentdawn-zz) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12463-1.html) +[#]: subject: (Program IoT systems using Python with this VSCode plugin for RTOS) +[#]: via: (https://opensource.com/article/20/7/python-rt-thread) +[#]: author: (Seth Kenlon https://opensource.com/users/seth) + +通过 VSCode RTOS 插件使用 Python 为物联网系统编写程序 +====== + +> RTOS 之类的实时嵌入式操作系统使嵌入式系统的编程更简单 + +![](https://img.linux.net.cn/data/attachment/album/202007/29/001132c37u7u5qp284wef2.jpg) + +物联网(IoT)无处不在,它意味着几乎所有的产品,从冰箱到口袋手表,都可以连网。为了实现这个目标,每个产品都需要拥有一个嵌入式计算机来运行网络栈,有些产品几乎是小的不可思议。这就是嵌入式软件出现的场景:现代科技打造的非常小的计算机,硬编码到硬件芯片,不需要任何板外处理器、内存或者存储盘。 + +就传统视角而言,这种场景意味着没有操作系统可用,但是因为种种 [原因][2],开发者发现,类似于 RTOS 之类的实时嵌入式操作系统能让嵌入式系统的编程变得非常简单。 + +虽然 RT-Thread 嵌入式操作系统致力于鼓励程序员新手进入物联网领域,但并非所有的人都具备使用 C 语言硬编码微芯片的能力。幸运的是,MicroPython 通过让开发者创建运行于嵌入式系统的 Python 代码的方式,逐渐填补了这个鸿沟。为了让整个过程更简单,RT-Thread 有一个可以用于 VSCode 和 [VSCodium][4] 的插件,为开发者提供了物联网方面的开发环境。其部分特性包括: + + * 方便的连接方式,可以很容易的通过串口、网络或者 USB 连接到开发板(如果你使用过 Arduino,肯定会很熟悉这个流程)。 + * 支持上传文件或目录到开发板。 + * 支持基于 MicroPython 的代码,而且具有智能的代码补完、语法检查功能。 + * 支持 MicroPython REPL 交互式环境。 + * 丰富的示例代码和演示程序。 + * 完整的工程同步功能。 + * 快速运行内存中的程序代码。 + * 运行函数的代码片段。 + * 支持主流的 MicroPython 开发板。 + * 支持 Linux 和 Windows 操作系统,并经过充分测试。 + +### 准备 + +在开始之前,如果你使用的是 Windows 操作系统,那么必须保证 VSCode 的默认终端是 [PowerShell][5]。运行 VSCodium,从 “Terminal” 菜单项启动一个终端. 在显示在 VSCodium 窗口底部的终端界面,从下拉菜单顶端选择 “PowerShell”。 +不论你是在 [Windows][6] 还是 Linux 系统下工作,必须保证安装了 Python 3(在 Linux 上,它可能已经安装了,否则可以通过软件库安装它)。 + +还要安装的是微软提供的通用 VSCode Python 插件。安装方法是点击 “File” 菜单,找到 “Preferences” 子菜单,从中打开 “Extensions” 面板。在扩展中,搜索 “Python”,找到来自微软的 Python 插件。 + +![VSCodium Python plugin][7] + +当然,在上述操作之前,你要先正确安装 [VSCodium][9] 或 [VSCode][10]。 + +### 安装插件 + +安装 MicroPython 开发插件的方法与安装 Python 插件一样,点击 “File” 菜单,找到 “Preferences” 子菜单,选择 “Extensions”。 + +在扩展中,搜索 “MicroPython”,安装 RT-Thread 插件。 + +![MicroPython plugin for RT-Thread][11] + +### 使用插件 + +你的开发板必须能访问串口,这需要组策略的允许。你可能需要将自己的账户加入该组,通常在默认情况下你的账户可能并不在该组。首先,确认你的账户不在 “dialout” 组: + +``` +$ groups +tux users +``` + +本例中,用户“tux”只是“tux”组和“users”组的成员,所以需要将用户“tux”添加到“dialout”组: + + +``` +$ sudo usermod --append --groups dialout tux +``` + +退出登录或重启以载入你新的组权限。 + +### 创建 MicroPython 工程 + +MicroPython 开发的第一步是创建 MicroPython 工程用来编写和运行代码。使用 MicroPython 插件创建工程的方法是,点击左下方的 “Create MicroPython project” 按钮。 + +![Create MicroPython project][12] + +之后会有一些提示,让你选择创建空白工程还是包含例程的工程。 + +### 连接到开发板 + +点击 VSCodium 左下方的 “Connection” 按钮,进行 VSCodium 与开发板的连接,在弹出的列表中,选择要连接的物理设备。 + +### 查看例程 + +MicroPython 插件提供了许多例程和例库,供学习和调用。获取例程的过程是,激活 MicroPython 之后,VSCodium 左侧按钮条会出现“新建”快捷图标,点击该图标就可以了。点击“文档”快捷图标,会显示例程文件列表;点击“文件夹”快捷图标,会显示例库列表。 + +![MicroPython examples][13] + +### 直接在开发板上运行 MicroPython 文件 + +在 VSCodium 中可以通过在开发板上运行单个程序文件,很方便快捷的进行程序调试。快捷键 `Alt+Q` 会触发一个特定的插件,该插件会将当前的 Python 文件上传到开发板内存中。你还可以在当前 Python 文档界面点击右键,然后选择 “Run the MicroPython file directly on the device” 实现同样的功能。 + +![Running code on your device][14] + +如果你需要以不上传代码的方式检查一组代码,可以使用“代码片段”功能。要运行 MicroPython REPL 环境中的代码片段,在编辑器中选中要运行的片段,右键菜单中点击 “Execute the selected MicroPython code on the device” (也可以使用 `Alt+Q` 快捷键)。 + +### 加载文件和目录到开发板 + +如果需要加载文件或目录到开发板,有现成的方法可用:选中工程中要加载到开发板的文件或目录,在选中的对象上右键,点击右键菜单中的 “Download the file/folder to the device”。 + +注意,如果开发板中已有与要加载的文件或目录同名者,加载操作将导致开发板原有的内容被覆盖。 + +在 REPL 环境中运行 `os.listdir()` 命令,可以检查文件和目录是否成功加载。当然,也可以通过相应的命令删除 REPL 中的文件或目录。 + +删除文件的命令如下: + +``` +os.remove('file_to_delete') +``` + +删除目录的命令如下: + +``` +os.rmdir('folder_to_delete') +``` + +### 工程的同步 + +点击左下角“同步”按钮可以启动工程同步,该操作将把本地工程中所有的文件和目录同步到开发板的文件系统。建议在完成程序调试之后进行该操作,调试过程中不需要频繁进行同步操作。 + +工程的同步操作完成后,开发板上的文件列表可以在 “Device Files List” 列看到。 + +### 放手尝试 + +RT-Thread 以开源的方式发布 MicroPython 插件,意在为新老开发者提供帮助,它的很多特性,如代码自动补全等,与开源插件之间互有影响和促进。你如果想为嵌入式系统或物联网系统编写软件,这就是最简单的方式,没有之一。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/7/python-rt-thread + +作者:[Seth Kenlon][a] +选题:[lujun9972][b] +译者:[silentdawn-zz](https://github.com/silentdawn-zz) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/seth +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/containers_modules_networking_hardware_parts.png?itok=rPpVj92- (Parts, modules, containers for software) +[2]: https://opensource.com/article/20/6/open-source-rtos +[3]: https://www.rt-thread.io/ +[4]: https://opensource.com/article/20/6/open-source-alternatives-vs-code +[5]: https://opensource.com/article/18/2/powershell-people +[6]: https://opensource.com/article/19/8/how-install-python-windows +[7]: https://opensource.com/sites/default/files/uploads/vscodium-python-plugin.jpg (VSCodium Python plugin) +[8]: https://creativecommons.org/licenses/by-sa/4.0/ +[9]: http://vscodium.com +[10]: https://github.com/microsoft/vscode +[11]: https://opensource.com/sites/default/files/uploads/vscodium-micropython.jpg (MicroPython plugin for RT-Thread) +[12]: https://opensource.com/sites/default/files/uploads/vscodium-micropython-create.jpg (Create MicroPython project) +[13]: https://opensource.com/sites/default/files/uploads/vscodium-micropython-examples.jpg (MicroPython examples) +[14]: https://opensource.com/sites/default/files/uploads/vscodium-micropython-run.jpg (Running code on your device) diff --git a/published/202007/20200709 Btrfs to be the Default Filesystem on Fedora- Fedora 33 Starts Testing Btrfs Switch.md b/published/202007/20200709 Btrfs to be the Default Filesystem on Fedora- Fedora 33 Starts Testing Btrfs Switch.md new file mode 100644 index 0000000000..e360444220 --- /dev/null +++ b/published/202007/20200709 Btrfs to be the Default Filesystem on Fedora- Fedora 33 Starts Testing Btrfs Switch.md @@ -0,0 +1,95 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12455-1.html) +[#]: subject: (Btrfs to be the Default Filesystem on Fedora? Fedora 33 Starts Testing Btrfs Switch) +[#]: via: (https://itsfoss.com/btrfs-default-fedora/) +[#]: author: (Ankush Das https://itsfoss.com/author/ankush/) + +Fedora 33 开始测试切换到 Btrfs +====== + +尽管距离 Fedora 的下一个稳定版本([Fedora 33][1])还有几个月的距离,但仍有一些值得关注的变化。 + +在所有其他 [Fedora 33 接受的系统范围的更改][1]中,最有趣的提议是将 Btrfs 作为桌面的默认文件系统,这个提议现在已经被批准了。 + +这是 Fedora 对该提案的评价: + +> 对于安装 Fedora 的笔记本电脑和工作站,我们希望以透明的方式向用户提供文件系统功能。我们希望添加新功能,同时减少处理磁盘空间不足之类的情况所需的专业知识。Btrfs 它的设计理念非常适合这个角色,让我们将其设为默认设置。 + +值得注意的是,在测试的最终投票结果出来之前,这不是系统范围内的更改。 + +但是,现在测试已经成功完成,投票结果也是赞成的 —— Fedora 33 版本已经接受了这个改动。 + +那么,为什么 Fedora 提出这一更改?这会有什么用么?这是糟糕的举动吗?对 Fedora 的发行有何影响?让我们在这里谈论下。 + +![][3] + +### 它会影响哪些 Fedora 版本? + +根据提议,如果测试成功,那么 Fedora 33 的所有桌面版本、spins 和 labs 都受此影响。 + +因此,你可以期望[工作站版本][4]将 Btrfs 作为 Fedora 33 上的默认文件系统。 + +### 实施此更改的潜在好处 + +为了改进 Fedora 在笔记本和工作站的使用,Btrfs 文件系统提供了一些好处。 + +现在 Fedora 33 将成为默认文件系统 —— 让我来指出使用 Btrfs 作为默认文件系统的好处: + + * 延长存储硬件的使用寿命 + * 提供一个简单的方案来解决用户耗尽根目录或主目录上的可用空间的情况 + * 不易造成数据损坏,易于恢复 + * 提供更好的调整文件系统大小的功能 + * 通过强制 I/O 限制来确保桌面在高内存压力下的响应能力 + * 使复杂的存储设置易于管理 + +如果你感到好奇,你可能想更深入地了解 [Btrfs][5] 及其总体优点。 + +不要忘记,Btrfs 已经是受支持的选项,它只是不是默认的文件系统而已。 + +但是,总的来说,感觉在Fedora 33上引入Btrfs作为默认文件系统是一个有用的变化。 + +### Red Hat Enterprise Linux 会不会实现它? + +很明显,Fedora 被认为是 [Red Hat Enterprise Linux][6] 的前沿版本。 + +因此,如果 Fedora 拒绝更改,那么 Red Hat 将不会实施。另一方面,如果你希望 RHEL 使用 Btrfs,那么 Fedora 应该首先同意更改。 + +为了让你更加清楚,Fedora 对其进行了详细介绍: + +> Red Hat 在许多方面都很好地支持 Fedora。但是 Fedora 已经与上游紧密合作,并依赖上游。这将是其中之一。这是该提案的重要考虑因素。社区有责任确保它得到支持。如果 Fedora 拒绝,那么 Red Hat 将永远不会支持 Btrfs。Fedora 必然需要成为第一个,并提出令人信服的理由,说明它比替代方案能解决更多的问题。它的负责人相信它确实如此,毫无疑问。 + +另外,值得注意的是,如果你不想在 Fedora 中使用 btrfs,你应该看看 [OpenSUSE][7] 和 [SUSE Linux Enterprise][8]。 + +### 总结 + +即使这个更改看起来不会影响任何升级或兼容性,你也可以在 [Fedora 项目的 Wiki 页面][9]中找到有关 Btrfs 的更改的更多信息。 + +你对针对 Fedora 33 发行版的这一更改有何看法?你是否要将 btrfs 文件系统作为默认文件系统? + +请在下面的评论中让我知道你的想法! + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/btrfs-default-fedora/ + +作者:[Ankush Das][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://itsfoss.com/author/ankush/ +[b]: https://github.com/lujun9972 +[1]: https://fedoraproject.org/wiki/Releases/33/ChangeSet +[2]: https://fedoraproject.org/wiki/Test_Day:2020-07-08_Btrfs_default?rd=Test_Day:F33_btrfs_by_default_2020-07-08 +[3]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/07/btrfs-default-fedora.png?ssl=1 +[4]: https://getfedora.org/en/workstation/ +[5]: https://en.wikipedia.org/wiki/Btrfs +[6]: https://www.redhat.com/en/technologies/linux-platforms/enterprise-linux +[7]: https://www.opensuse.org +[8]: https://www.suse.com +[9]: https://fedoraproject.org/wiki/Changes/BtrfsByDefault diff --git a/published/202007/20200709 What you need to know about automation testing in CI-CD.md b/published/202007/20200709 What you need to know about automation testing in CI-CD.md new file mode 100644 index 0000000000..d5b7f7dd3a --- /dev/null +++ b/published/202007/20200709 What you need to know about automation testing in CI-CD.md @@ -0,0 +1,84 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12458-1.html) +[#]: subject: (What you need to know about automation testing in CI/CD) +[#]: via: (https://opensource.com/article/20/7/automation-testing-cicd) +[#]: author: (Taz Brown https://opensource.com/users/heronthecli) + +CI/CD 中的自动化测试的概要知识 +====== + +> 持续集成和持续交付是由测试驱动的。以下是如何做到的。 + +![](https://img.linux.net.cn/data/attachment/album/202007/27/210026blobu65f77accbob.jpg) + +> “如果一切似乎都在控制之中,那只是你走的不够快而已。” —Mario Andretti + +测试自动化是指在软件开发过程中尽可能早、尽可能快地持续关注检测缺陷、错误和 bug。这是通过使用那些追求质量为最高价值的工具完成的,它们旨在*确保*质量,而不仅仅是追求质量。 + +持续集成/持续交付(CI/CD)解决方案(也称为 DevOps 管道)最引人注目的功能之一是可以更频繁地进行测试,而又不会给开发人员或操作人员增加更多的手动工作。让我们谈谈为什么这很重要。 + +### 为什么要在 CI/CD 中实现自动化测试? + +敏捷团队要更快的迭代,以更高的速度交付软件和客户满意度,而这些压力可能会危及质量。全球竞争制造了对缺陷的*低容忍度*,同时也增加了敏捷团队的压力,要求软件交付的*迭代更快*。减轻这种压力的行业解决方案是什么?是 [DevOps][2]。 + +DevOps 是一个大概念,有很多定义,但是对 DevOps 成功至关重要的一项技术是 CI/CD。通过软件开发流程设计一个连续的改进循环,可以为测试带来新的机会。 + +### 这对测试人员意味着什么? + +对于测试人员,这通常意味着他们必须: + + * 更早且更频繁地进行测试(使用自动化) + * 持续测试“真实世界”的工作流(自动和手动) + +更具体地说,任何形式的测试,无论是由编写代码的开发人员运行还是由质量保证工程师团队设计,其作用都是利用 CI/CD 基础架构在快速推进的同时提高质量。 + +### 测试人员还需要做什么? + +具体点说,测试人员负责: + + * 测试新的和现有的软件应用 + * 根据系统要求评估软件来验证和确认功能 + * 利用自动化测试工具来开发和维护可重复使用的自动化测试 + * 与 scrum 团队的所有成员合作,了解正在开发的功能以及实施的技术设计,以设计和开发准确、高质量的自动化测试 + * 分析记录在案的用户需求,并针对中等到高度复杂的软件或 IT 系统制定或协助设计测试计划 + * 开发自动化测试,并与功能团队一起审查和评估测试方案 + * 与技术团队合作,确定在开发环境中自动化测试的正确方法 + * 与团队合作,通过自动化测试来了解和解决软件问题,并回应有关修改或增强的建议 + * 参与需求梳理、估算和其他敏捷 scrum 仪式 + * 协助制定标准和流程,以支持测试活动和材料(例如脚本、配置、程序、工具、计划和结果) + +测试是一项艰巨的工作,但这是有效构建软件的重要组成部分。 + +### 哪些持续测试很重要? + +你可以使用多种测试。不同的类型并不是学科之间的牢固界限。相反,它们是表示如何测试的不同方式。比较测试类型不太重要,更重要的是对每一种测试类型都要有覆盖率。 + + * **功能测试:** 确保软件具有其要求的功能 + * **单元测试:** 独立测试软件的较小单元/组件以检查其功能 + * **负载测试:** 测试软件在重负载或使用期间的性能 + * **压力测试:** 确定软件承受压力(最大负载)时的断点 + * **集成测试:** 测试组合或集成的一组组件的输出 + * **回归测试:** 当修改任意组件(无论多么小),测试整个应用的功能 + +### 总结 + +任何包含持续测试的软件开发过程都将朝着建立关键反馈环路的方向发展,以实现快速和构建有效的软件。最重要的是,该实践将质量内置到 CI/CD 管道中,并意味着了解在软件开发生命周期中提高速度同时减少风险和浪费之间的联系。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/7/automation-testing-cicd + +作者:[Taz Brown][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/heronthecli +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/data_analytics_cloud.png?itok=eE4uIoaB (Net catching 1s and 0s or data in the clouds) +[2]: https://opensource.com/resources/devops diff --git a/published/202007/20200713 My Linux story- From Linux user to contributor.md b/published/202007/20200713 My Linux story- From Linux user to contributor.md new file mode 100644 index 0000000000..0d8c6d5d62 --- /dev/null +++ b/published/202007/20200713 My Linux story- From Linux user to contributor.md @@ -0,0 +1,86 @@ +[#]: collector: (lujun9972) +[#]: translator: (Yufei-Yan) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12438-1.html) +[#]: subject: (My Linux story: From Linux user to contributor) +[#]: via: (https://opensource.com/article/20/7/linux-user-contributor) +[#]: author: (Taz Brown https://opensource.com/users/heronthecli) + +我的 Linux 故事:从用户到贡献者 +====== + +> 开源社区欢迎来自不同背景和技能的贡献者。 + +![](https://img.linux.net.cn/data/attachment/album/202007/22/114140tfuubuvcfgujrcab.jpg) + +我是一名 IT 专业人士,拥有超过 15 年经验,担任过不同职位 —— 包括系统管理员、高级 Linux 管理员、DevOps 工程师、自动化顾问和高级敏捷专家scrum master。我开始是在 Ubuntu 上学习 Linux,但是后来作为系统管理员转到 CentOS,然后我又转到 Fedora 作为个人使用。但是我对技术的喜爱要远比我使用第一个 Linux 发行版要早的多,而且是来自于一部电影。 + +我最喜欢的电影是《黑客Hackers》。最精彩的一幕发生在电影的开头。电影一开始,一群特工冲进一所房子抓捕臭名昭著的黑客 Zero Cool。我们马上发现 Zero Cool 其实是 11 岁的 Dade Murphy,他在一天之内成功瘫痪了 1507 台计算机系统。他被指控犯罪,他的家人被处以重罚。而且,在他 18 岁之前,他都被禁止使用电脑或按键式电话。 + +劳伦斯·梅森Laurence Mason扮演的 Paul Cook,又名 Nikon 勋爵,是我最喜欢角色。其中一个主要原因是,我从没有看过一个黑客电影里面的人物长的像我,所以我被他的形象深深吸引了。他很神秘。这让我耳目一新,并且感到自豪,我对 IT 充满了热情,我也是一个和他很像的极客。 + +![Taz with astronaut][2] + +### 成为一个 Linux 贡献者 + +15 年前,我开始使用 Linux。当我成为一个 Linux 管理员的时候,Linux 就成了我的激情所在。我一直尝试找到某种方式能够为开源作出贡献,当时我还不知道该从哪开始。因为这个社区实在是太大了,我不知道自己能否真正成为一个有影响力的人,但当我发现一些人认可我的兴趣,还对我进行指导,我开始彻底打开心扉,问各种问题,并且从社区中学习。自从那以后,Fedora 社区一直是我做贡献的最主要社区。 + +我现在对于向开源做贡献还是有点稚嫩。当我意识到我可以用代码以外的方式来贡献时,我对开源的想法发生了改变。我更喜欢通过文档做一些贡献,因为我本质上不是一个软件开发人员,而且社区里面最迫切的需求正是文档。请记住:用户的技能和开发人员的技能同样重要。 + +### 我的硬件是什么? + +硬件也很重要,而且现在几乎所有东西都可以运行 Linux。现在,我家里的配置包括: + + * 联想 Thinksever TS140,64 GB 内存,4 x 1 TB SSD 和一个存储数据的 1 TB 机械硬盘 + * 使用 RAID 5 配置的 164 TB Synology NAS + * 输入输出使用罗技 MX Master 和 MX Master 2S + * 一个定制的并且符合人体工学的 Kinesis Advantage 2 键盘 + * 两个 38 寸 LG 超宽曲面显示器和一个 34 寸 LG 超宽显示器 + * 一台配备 i7 六核十二线程 CPU 和 16.1 英寸 IPS 显示器的 System76 笔记本 + +我很喜欢 Fedora 处理外置设备的方式,比如说我的鼠标和键盘。一切都完美融合。即插即用工作正常,性能从来不受影响。 + +![Fedora double monitor setup][4] + +### 软件是什么? + +使用开源软件对我的工作非常重要。我依赖于: + + * Fedora 30 作为我日常使用的 Linux 发行版 + * Wekan 作为我的项目的开源看板kanban + * [Atom][5] 作为我的文本编辑器 + * Terminator 作为我日常使用的终端,因为它的网格布局以及丰富的键盘快捷键 + * Neofetch 用来显示每次登录到终端时的系统信息 + +最后同样重要的是,我把 Powerline、Powerlevel9k 和 Vim-Powerline 搞到我的终端上来跟别人装酷。 + +![Multiple fedora screens][7] + +### Linux 让我们走到一起 + +美国是个大熔炉,我也是这么看待 Linux 和像 Fedora 项目这样的特定社区的。在每个 Linux 社区中,对于不同的贡献都有很大的空间。也有很多方式可以参与进来,而且对于新的想法,也总是有发挥的空间。通过分享我过去 15 年在开源方面的经验,我希望帮助更多在科技领域的少数族裔体会到来自开源社区对多样性和包容性的认同感。 + +*编者注:这篇文章改编自[“Taz Brown:你怎么搞 Fedora?”][8],并得到许可重新发布* + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/7/linux-user-contributor + +作者:[Taz Brown][a] +选题:[lujun9972][b] +译者:[Yufei-Yan](https://github.com/Yufei-Yan) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/heronthecli +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/contributor_spotlight_penguin.jpg?itok=azJA5Cj8 (Penguin, stylized, contributor spotlight) +[2]: https://opensource.com/sites/default/files/uploads/taz_with_astronaut_0.png (Taz with astronaut) +[3]: https://getfedora.org/ +[4]: https://opensource.com/sites/default/files/uploads/fedora_double_monitor_setup.jpg (Fedora double monitor setup) +[5]: https://fedoramagazine.org/install-atom-fedora/ +[6]: https://fedoramagazine.org/add-power-terminal-powerline/ +[7]: https://opensource.com/sites/default/files/uploads/fedora_screens.jpg (Multiple fedora screens) +[8]: https://fedoramagazine.org/taz-brown-how-do-you-fedora/ diff --git a/published/202007/20200713 My feature-rich and minimal Linux terminal.md b/published/202007/20200713 My feature-rich and minimal Linux terminal.md new file mode 100644 index 0000000000..301fb64e95 --- /dev/null +++ b/published/202007/20200713 My feature-rich and minimal Linux terminal.md @@ -0,0 +1,83 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12439-1.html) +[#]: subject: (My feature-rich and minimal Linux terminal) +[#]: via: (https://opensource.com/article/20/7/minimal-linux-terminal) +[#]: author: (Sumantro Mukherjee https://opensource.com/users/sumantro) + +我的功能丰富却又保持简约的 Linux 终端 +====== + +> 这些应用和主题可以你真正拥有你的终端。 + +![](https://img.linux.net.cn/data/attachment/album/202007/22/123206g5t5mmz5ozdt5f5m.jpg) + +每个人都喜欢以特定的方式设置他们的工作区:它可以帮助你提高效率,并使生活更容易以一种感觉有机的方式组织事物,并拥有一个对你来说感觉良好的环境。这也绝对适用于终端。这可能就是为什么有这么多可用终端的原因。 + +在使用新的计算机时,我做的第一件事就是设置我的终端,让它成为我自己的终端。 + +我最喜欢的终端应用是 [Terminator][2],因为它的设计简约,并且内置了窗口选项。但从这里开始变得更加复杂。我将自己喜欢的终端风格描述为“功能丰富却又保持简约”。这种平衡是我经常在微调的。 + +我使用 zsh 作为默认 shell,并使用 Ohmyzsh 来提供额外的功能。可以下载它的安装脚本来安装 Ohmyzsh: + +``` +$ curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh --output install-zsh.sh +``` + +查看一遍脚本了解它做什么,并确保你有信心在计算机上运行该脚本。完成后,运行脚本: + +``` +$ sh ./install-zsh.sh +``` + +我最喜欢的主题/提示符是 [Powerlevel 10k][3],它是一个非常详细的环境视图。它包含了从命令的颜色高亮到运行时间的时间戳等所有内容。所有细节都集成到一个优雅的、具有上下文感知的提示符中。 + +要安装 Powerlevel10k,请先在 `.oh-my-zsh/` 自定义主题目录中下载源码。 + +``` +git clone --depth=1 https://github.com/romkatv/powerlevel10k.git +${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/themes/powerlevel10k +``` + +但是,为了让 Powerlevel10k 看起来如其存储库中所示,我们需要添加一些默认不包括的字体。它们是: + + * [MesloLGS NF Regular.ttf][4] + * [MesloLGS NF Bold.ttf][5] + * [MesloLGS NF Italic.ttf][6] + * [MesloLGS NF Bold Italic.ttf][7] + +这将产生一个美观且具有上下文感知的终端(如 [screenfetch][8] 所示): + +![terminator terminal shot via screenFetch][9] + +我已经习惯了这个特殊的设置,但是,把工作环境变成自己的环境固然重要,但这也并不是一个固执地尝试新事物的理由。新终端的出现,是为了满足新一代用户的需求和要求。这意味着,即使一开始不熟悉,但最近开发的一种终端可能比你的老旧备用机更适合当今的环境和职责。 + +我最近一直在考虑其他选择。我开始关注 [Starship][10] 的开发情况,它将自己描述为简约的、快速的、可无限定制的提示符,适用于任何 shell。它仍然有很多在视觉上可以身临其境的细节,而不会像 Powerlevel10k 那样使人分心。 + +你最喜欢的终端是什么?为什么?请在评论栏分享! + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/7/minimal-linux-terminal + +作者:[Sumantro Mukherjee][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/sumantro +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/computer_desk_home_laptop_browser.png?itok=Y3UVpY0l (Digital images of a computer desktop) +[2]: https://terminator-gtk3.readthedocs.io/en/latest/ +[3]: https://github.com/romkatv/powerlevel10k +[4]: https://github.com/romkatv/powerlevel10k-media/raw/master/MesloLGS%20NF%20Regular.ttf +[5]: https://github.com/romkatv/powerlevel10k-media/raw/master/MesloLGS%20NF%20Bold.ttf +[6]: https://github.com/romkatv/powerlevel10k-media/raw/master/MesloLGS%20NF%20Italic.ttf +[7]: https://github.com/romkatv/powerlevel10k-media/raw/master/MesloLGS%20NF%20Bold%20Italic.ttf +[8]: https://github.com/KittyKatt/screenFetch +[9]: https://opensource.com/sites/default/files/uploads/osdc00_edit.png (terminator terminal shot via screenFetch ) +[10]: https://starship.rs/ diff --git a/published/202007/20200713 Top 5 Open Source Video Conferencing Tools for Remote Working and Online Meetings.md b/published/202007/20200713 Top 5 Open Source Video Conferencing Tools for Remote Working and Online Meetings.md new file mode 100644 index 0000000000..3c7727f220 --- /dev/null +++ b/published/202007/20200713 Top 5 Open Source Video Conferencing Tools for Remote Working and Online Meetings.md @@ -0,0 +1,145 @@ +[#]: collector: (lujun9972) +[#]: translator: (this-is-name-right) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12453-1.html) +[#]: subject: (Top 5 Open Source Video Conferencing Tools for Remote Working and Online Meetings) +[#]: via: (https://itsfoss.com/open-source-video-conferencing-tools/) +[#]: author: (Ankush Das https://itsfoss.com/author/ankush/) + +5 个流行的用于远程工作和在线会议的开源视频会议工具 +====== + +你会发现网上有一些视频会议工具。一些是为专业用户量身定制的,另一些是为了日常闲聊的。 + +然而面对着成百上千的选择,当选择视频会议应用或服务时,安全和隐私是往往是一个重要的点。在众多选择中,哪些是最好最安全的? + +所有这些(或大多数)都宣称要提供最好的安全和隐私。但是,你要知道这可不能只看表面。 + +幸运的是在这里,我们专注于开源和隐私友好的解决方案,所以,让我们看看你可以使用的开源视频会议工具列表。 + +### 顶级开源视频会议解决方案 + +![](https://img.linux.net.cn/data/attachment/album/202007/26/104947gyzs2eb5ybeneg5y.jpg) + +如果你是商企用户,大多数视频会议解决方案可以被安装在你自己的服务器上。 + +对于不是系统管理员的普通人来说,其中一些解决方案还提供了现成的、免费的、基于 Web 的视频会议服务。我将在列表中每个项目的描述中提及此信息。 + +**备注:** 列表中的排名不分先后。 + +#### 1、Jitsi Meet + +![][2] + +Jitsi Meet 是一个令人印象深刻的开源视频会议服务。你可以在我们关于 [Jitsi Meet][3] 的单独报道中轻松找到更多信息。 + +为了给你一个好的开始,Jitsi Meet 提供免费[官方公共实例][4]来测试它,只要你需要,就可以免费使用它。 + +如果你需要将其托管在你的服务器上,同时根据你的需求定制一些选项,你可以从它的[官网][5]下载到你的服务器。 + +尽管他们在 Linux 上提供了一个基于 Electron 的应用,其实你不必下载一个应用到你的桌面上来设置它。你只需要一个浏览器就足够了。在移动端,安卓和 iOS 都有应用。 + +- [Jitsi Meet][5] + +#### 2、Jami + +![][6] + +Jami 是一个基于点对点的开源视频会议解决方案。很高兴看到分布式的服务,这意味着不依靠服务器,而只是点对点的连接。 + +当然了,分布式的服务有优点也有缺点。但是它是自由而开源的,那才是最重要的。 + +Jami 之前被称为 Ring messenger,但它改了名字,现在是一个 GNU 项目。 + +Jami 有 Linux、Windows、macOS、Android 和 iOS 的版本,所以它是一个完全跨平台的安全传送信息和视频会议的解决方案。你可以看看他们的 [GitLab 页面][7]浏览更多信息。 + +- [Jami][8] + +#### 3、Nextcloud Talk + +![][9] + +[Nextcloud][10] 毫无疑问是开源远程办公工具的瑞士军刀。我们就在使用 Nextcloud。所以如果你已经配置了服务器,[Nextcloud Talk][11] 显然是一个优秀的视频会议和聊天工具。 + +当然了,如果你还没有自己的 Nextcloud 服务器,你需要一些技术知识来进行设置它,然后才能开始使用 Nextcloud Talk。 + +- [Nextcloud Talk][11] + +#### 4、Riot.im + +![][12] + +Riot.im(不久会更名)已经是 Slack [最好的开源替代品][13]之一。 + +它能让你可以创建社区、发送信息,并在一个小组/社区中开始视频会议。你可以通过任何可用的公共 [Matrix 服务器][14]来免费使用它。 + +如果你想要自己专用的去中心化的 Matrix 网络,你也可以在 [Modular.im][15] 上选择付费托管计划。 + +- [Riot.im][16] + +#### 5、BigBlueButton + +![][17] + +BigBlueButton 是一个有趣的开源视频会议方案,专门为线上学习打造。 + +如果你是老师或者经营着一个学校,你也许会想试试。虽然你可以免费试用,但免费演示使用会有一定的限制。所以,最好将其托管到自己的服务器上,并且,如果你有其他的产品/服务的话,你也可以把它整合进其中。 + +它提供了一套很好的功能,能让你很轻松的教学生。你可以浏览它的 [GitHub 页面][18]以了解更多信息。 + +- [BigBlueButton][19] + +#### 补充:Wire + +![][20] + +Wire 是一个十分流行的开源的安全消息平台,为商企用户量身打造。它也提供视频电话或者网络会议选项。 + +如果你想要一个为你的企业或团队提供的商业开源方案,你可以试试 Wire,并在试用 30 天后决定是否升级它。 + +就个人而言,我喜欢它的用户体验,但它是要付费的。所以我建议你决定之前,先试试看并浏览它的 [GitHub 页面][21]。 + +- [Wire][22] + +### 总结 + +现在你知道一些流行开源网络视频会议方案了,你更喜欢使用哪一个? + +我是否错过了任何你的最爱?请在下面的评论中告诉我你的想法! + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/open-source-video-conferencing-tools/ + +作者:[Ankush Das][a] +选题:[lujun9972][b] +译者:[this-is-name-right](https://github.com/this-is-name-right) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://itsfoss.com/author/ankush/ +[b]: https://github.com/lujun9972 +[1]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/07/open-source-video-conferencing-tools.jpg?ssl=1 +[2]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/06/jitsi-meet-browser-screenshot.png?ssl=1 +[3]: https://itsfoss.com/jitsi-meet/ +[4]: https://meet.jit.si/ +[5]: https://jitsi.org/jitsi-meet/ +[6]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/07/jami-screenshot.png?ssl=1 +[7]: https://git.jami.net/savoirfairelinux/ring-project +[8]: https://jami.net/ +[9]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/07/nextcloud-talk.png?ssl=1 +[10]: https://itsfoss.com/nextcloud/ +[11]: https://nextcloud.com/talk/ +[12]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/07/riot-communication-video.png?ssl=1 +[13]: https://itsfoss.com/open-source-slack-alternative/ +[14]: https://matrix.org/ +[15]: https://modular.im/ +[16]: https://about.riot.im/ +[17]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/07/big-blue-button.png?ssl=1 +[18]: https://github.com/bigbluebutton/bigbluebutton +[19]: https://itsfoss.com/open-source-video-conferencing-tools/bigbluebutton.org/ +[20]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/07/wire-video-conferencing.png?ssl=1 +[21]: https://github.com/wireapp +[22]: https://wire.com/en/ diff --git a/published/202007/20200714 My Linux story- breaking language barriers with open source.md b/published/202007/20200714 My Linux story- breaking language barriers with open source.md new file mode 100644 index 0000000000..53f2611c0a --- /dev/null +++ b/published/202007/20200714 My Linux story- breaking language barriers with open source.md @@ -0,0 +1,57 @@ +[#]: collector: (lujun9972) +[#]: translator: (JonnieWayy) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12466-1.html) +[#]: subject: (My Linux story: breaking language barriers with open source) +[#]: via: (https://opensource.com/article/20/7/linux-bengali) +[#]: author: (Dr Anirban Mitra https://opensource.com/users/mitradranirban) + +我的 Linux 故事:用开源打破语言壁垒 +====== + +> 开源项目可以通过消除语言和其他障碍来帮着改变世界。 + +![](https://img.linux.net.cn/data/attachment/album/202007/29/230730e4mb18km1nwn4ibm.jpg) + +相较于我的许多同行和同事,我的开源之旅开始得着实很晚。 + +2000 年,我实现了我从高中开始的梦想 —— 买一台属于我自己的个人计算机,当时我正在攻读医学研究生学位。在那之前,我对计算机的唯一接触是偶尔在图书馆或网吧上网,当时这些地方电脑使用的收费都相当高昂。所以我省下了一部分研究生津贴,设法买了一台 Pentium III 550 Mhz、128MB 内存的电脑,并且像当时大多数印度电脑的标准配置一样,装着盗版的 Windows 98 系统。 + +我的宿舍房间上不了网。我不得不去附近的网吧,在那里下载软件,然后随身带着几十张软盘。 + +当我终于拥有了自己的计算机,我非常高兴,但有一点也让我感到困扰,那就是我无法用我的母语孟加拉语写东西。我碰到了 CDAC 提供的资源,CDAC 是一个政府机构,它提供的印度语言工具是基于 ISCII 的,ISCII 是一个较早的国家标准,而印度语的 Unicode 标准就是基于这个标准。很难学习它的键盘布局。 + +### 我的第一次贡献 + +不久后,我遇到了一款名叫 [Yudit][2] 的软件,它使用标准的 QWERTY 键盘布局来提供印地语的拼音输入。正是在通过 Yudit,我第一次遇到了诸如开源和自由软件、GNU 和 Linux 之类的术语。Yudit 也允许我把 UI 组件翻译成孟加拉语,当我将翻译提交给开发人员时,他很高兴地将它们合并到了下一个版本中,并在软件的 README 文件中称赞了我的功劳。 + +第一次看到一款应用程序的用户元素以我的母语呈现,我感到十分兴奋。此外,尽管对写代码的知识几乎为零,我依然能够为软件开发做出贡献。我继续为 Yudit 创建了一个从 ISCII 到 Unicode 的转换器,这个转换器还可以用于各种印度语言之间的直译。我还买了本 Linux 杂志,随刊附赠了一张 Knoppix 的免费 live CD,正是通过它我体验到了 Linux 桌面。 + +我面临的另一个问题是缺乏与 Unicode 兼容的 OpenType Bangla 字体。我使用的字体是共享软件,我需要为它支付许可费用。我在想,“为什么不尝试亲自开发呢?”在此过程中,我通过 bengalinux.org(后来更名为 Ankur 小组)接触到了分散在世界各地的孟加拉语使用者,他们正试图在 Linux 操作系统中使用孟加拉语。 + +我加入了他们的邮件列表,我们在内部与当局之间讨论了孟加拉语的 Unicode 和 OpenType 规范中的各种缺陷,然后在适当的时候进行了纠正。我的贡献是将传统的孟加拉字体转换为兼容 Unicode 的 OpenType 字体,翻译 UI 等。这个小组还发行了世界上第一张带有孟加拉语 UI 的 Live Linux CD。 + +2003 年,我搬家到了一个无法访问互联网的地方。我只有在周日去加尔各答时才能联系到小组。当时,Linux 的孟加拉语本地化已经成为了主流。我们的一些志愿者加入了 Red Hat 从事翻译和字体开发工作。我也忙于我的医疗工作,几乎没时间去进行开源开发。 + +如今,我觉得使用 Linux 做日常工作比其他任何操作系统都要舒服。我也为能与一个能让人们用自己的语言交流的项目联系在一起而感到自豪。它也为长期以来由于不会说英语而被认为处于“数字鸿沟digital divide”另一端的人们带来了计算能力。孟加拉语实际上是世界上使用最广泛的语言之一,这个项目消除了全球人口中很大一部分人接触数字科技的主要语言壁垒。 + +### 加入开源 + +加入到开源运动中来很容易。主动做一些对自己有用的事情,然后思索一下所做的事情如何能对他人也有帮助。关键在于使它免费可用,它可以给世界带来难以估量的价值。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/7/linux-bengali + +作者:[Dr Anirban Mitra][a] +选题:[lujun9972][b] +译者:[JonnieWayy](https://github.com/JonnieWayy) +校对:[wxy](https://github.com/wxy ) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/mitradranirban +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/india-globe-map.jpg?itok=6sSEL5iO (India on the globe) +[2]: http://www.yudit.org/ diff --git a/published/202007/20200715 What-s the difference between DevSecOps and agile software development.md b/published/202007/20200715 What-s the difference between DevSecOps and agile software development.md new file mode 100644 index 0000000000..38b9f14c28 --- /dev/null +++ b/published/202007/20200715 What-s the difference between DevSecOps and agile software development.md @@ -0,0 +1,96 @@ +[#]: collector: (lujun9972) +[#]: translator: (windgeek) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12449-1.html) +[#]: subject: (What's the difference between DevSecOps and agile software development) +[#]: via: (https://opensource.com/article/20/7/devsecops-vs-agile) +[#]: author: (Sam Bocetta https://opensource.com/users/sambocetta) + +DevSecOps 和敏捷软件开发有什么不同? +====== + +> 你更专注于安全性还是软件交付,还是可以两者兼得? + +![](https://img.linux.net.cn/data/attachment/album/202007/24/225337mb44xoe2byvz4x4o.jpg) + +技术社区中存在一种趋势,经常互换地使用 DevSecOps 和敏捷软件开发这两个术语。尽管它们有一些相似性,例如都旨在更早地检测风险,但在改变团队的[工作方式层面有很大不同][2]。 + +DevSecOps 建立在敏捷开发建立的一些原则上。但是,DevSecOps 特别专注于[集成安全功能][3],而敏捷开发则专注于交付软件。 + +知道如何保护你们的网站或应用程序免受勒索程序和其他威胁的侵害,实际上取决于你使用的软件和系统开发。这可能会影响你选择使用 DevSecOps、敏捷软件开发还是两者兼而有之。 + +### DevSecOps 和敏捷软件开发的不同之处 + +两者的主要区别可以归结为一个简单的概念:安全性。这取决于你的软件开发实践,你们公司的安全措施 —— 以及何时、何地以及由谁实施,都可能会有很大不同。 + +每个企业都[需要 IT 安全][4]来保护其重要数据。如果企业真正重视 IT 安全,一般都会采取虚拟专用网(VPN)、数字证书、防火墙保护、多因子身份验证、安全的云存储,包括向员工介绍基本的网络安全措施。 + +当你信任 DevSecOps 时,你就会把公司的安全问题,本质上使其等同于持续集成和交付。 DevSecOps 方法论在开发之初就强调安全性,并使其成为整体软件质量不可或缺的组成部分。 + +基于 DevSecOps 安全性的三大原则: + + * 平衡用户访问难易程度及数据安全性 + * 使用 VPN 和 SSL [加密数据][5]可防止数据在传输过程中受到入侵者的攻击 + * 使用可以扫描新代码的安全漏洞并能通知开发人员该漏洞的工具来预测防范未来的风险 + +尽管 DevOps 一直打算包含安全性,但并非每个实践 DevOps 的组织都牢记这一点。DevSecOps 在 DevOps 的演进形式中,可以提供更加清晰的信息。尽管它们的名称相似,但这两个[不应混淆] [6]。在 DevSecOps 模型中,安全性是团队的主要驱动力。 + +同时,敏捷开发更专注于迭代开发周期,这意味着反馈意见会不断融入到持续的软件开发中。[敏捷的关键原则][7]是拥抱不断变化的环境,为客户和使用者提供竞争优势,让开发人员和利益相关者紧密合作,并在整个过程中始终保持关注技术卓越,以提升效率。换句话说,除非敏捷团队在其定义中包括安全性,否则安全性在敏捷软件开发中算是事后思考。 + +### 国防机构面临的挑战 + +如果要说专门致力于最大程度地提高安全性的组织,美国国防部(DoD)就是其中之一。在 2018 年,美国国防部发布了针对软件开发中的“假敏捷”或“以敏捷为名”的[指南][8]。该指南旨在警告美国国防部高管注意不良编程的问题,并说明如何发现它以避免风险。 + +使用这些方法不仅可以使美国国防部受益。医疗保健和金融部门也[保存着][9]必须保证安全的大量敏感数据。 + +美国国防部通过其现代化战略(包括采用 DevSecOps)来改变防范形式至关重要。尤其在这个连美国国防部容易受到黑客攻击和数据泄露的时代,这一点在 2020 年 2 月的[大规模数据泄露][10]中已经得到了证明。 + +将网络安全最佳实践转化为现实生活中的开发仍然还存在固有的风险。事情不可能 100% 完美地进行。最好的状况是稍微有点不舒服,最坏的情况下,它们可能会带来全新的风险。 + +开发人员,尤其是那些为军用软件编写代码的开发人员,可能对[所有应该采用 DevSecOps 的情境][11]没有透彻的了解。学习曲线会很陡峭,但是为了获得更大的安全性,必须承受这些必不可少的痛苦。 + +### 自动化时代的新模式 + +为了解决对先前安全措施日益增长的担忧,美国国防部承包商已开始评估 DevSecOps 模型。关键是将该方法论部署到持续的服务交付环境中。 + +应对这个问题,出现了三个方向。第一种涉及到自动化,自动化已在大多数隐私和安全工具中[广泛使用][12],包括 VPN 和增强隐私的移动操作系统。大型云基础架构中的自动化无需依赖于人为的检查和平衡,可以自动处理持续的维护和进行安全评估。 + +第二种专注于对于过渡到 DevSecOps 很重要的安全检查点。而传统上,系统设计初期对于数据在各个组件之间移动时依旧可以访问是不做期望的。 + +第三种也是最后一种涉及将企业方式用于军用软件开发。国防部的许多承包商和雇员来自商业领域,而不是军事领域。他们的背景为他们提供了为大型企业[提供网络安全][13]的知识和经验,他们可以将其带入政府部门职位中。 + +### 值得克服的挑战 + +转向基于 DevSecOps 的方法论也提出了一些挑战。在过去的十年中,许多组织已经完全重新设计了其开发生命周期,以适应敏捷开发实践,在不久之后进行再次转换看起来令人生畏。 + +企业应该安下心来,因为即使美国国防部也遇到了这种过渡带来的麻烦,他们在应对推出新流程使得商业技术和工具广泛可用的挑战上并不孤独。 + +展望一下未来,其实切换到 DevSecOps 不会比切换到敏捷软件开发更痛苦。而且通过将[创建安全性的价值][4]添加到开发工作流程中,以及利用现有敏捷开发的优势,企业可以获得很多收益。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/7/devsecops-vs-agile + +作者:[Sam Bocetta][a] +选题:[lujun9972][b] +译者:[windgeek](https://github.com/windgeek) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/sambocetta +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/devops_confusion_wall_questions.png?itok=zLS7K2JG (Brick wall between two people, a developer and an operations manager) +[2]: https://tech.gsa.gov/guides/understanding_differences_agile_devsecops/ +[3]: https://www.redhat.com/en/topics/devops/what-is-devsecops +[4]: https://www.redhat.com/en/topics/security +[5]: https://surfshark.com/blog/does-vpn-protect-you-from-hackers +[6]: https://www.infoq.com/articles/evolve-devops-devsecops/ +[7]: https://enterprisersproject.com/article/2019/9/agile-project-management-explained +[8]: https://www.governmentciomedia.com/defense-innovation-board-issues-guide-detecting-agile-bs +[9]: https://www.redhat.com/en/solutions/financial-services +[10]: https://www.military.com/daily-news/2020/02/25/dod-agency-suffers-data-breach-potentially-compromising-ssns.html +[11]: https://fcw.com/articles/2020/01/23/dod-devsecops-guidance-williams.aspx +[12]: https://privacyaustralia.net/privacy-tools/ +[13]: https://www.securitymagazine.com/articles/88301-cybersecurity-is-standard-business-practice-for-large-companies diff --git a/published/202007/20200718 Ubuntu 19.10 Reaches End of Life. Upgrade to Ubuntu 20.04 As Soon As Possible.md b/published/202007/20200718 Ubuntu 19.10 Reaches End of Life. Upgrade to Ubuntu 20.04 As Soon As Possible.md new file mode 100644 index 0000000000..a3e48b4bb3 --- /dev/null +++ b/published/202007/20200718 Ubuntu 19.10 Reaches End of Life. Upgrade to Ubuntu 20.04 As Soon As Possible.md @@ -0,0 +1,106 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12446-1.html) +[#]: subject: (Ubuntu 19.10 Reaches End of Life. Upgrade to Ubuntu 20.04 As Soon As Possible!) +[#]: via: (https://itsfoss.com/ubuntu-19-10-end-of-life/) +[#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/) + +Ubuntu 19.10 产品寿命结束,尽快升级到 Ubuntu 20.04! +====== + +> Ubuntu 19.10 Eoan Ermine 产品寿命结束。这意味着它不会获得任何安全或维护更新。继续使用 Ubuntu 19.10 将很危险,因为你的系统将来可能会因为缺少安全更新而变得脆弱。你应该升级到 Ubuntu 20.04。 + +[2019 年 10 月发布的 Ubuntu 19.10][1] 带来了一些为 [Ubuntu 20.04][2] 做准备的新功能。 + +作为非 LTS 版本,它有 9 个月的寿命。截至 2020 年 7 月 17 日,它的生命周期结束,并不会再收到任何更新。 + +### Ubuntu 19.10 生命周期结束 + +![][3] + +我之前已经[详细解释了 Ubuntu 的发布周期和产品寿命结束][4]。如果此后继续使用 Ubuntu 19.10,我会重申这对你和你的系统意味着什么。 + +[软件通常有预定义的生命周期][5],一旦软件版本到达生命周期结束,它将停止获取更新和支持。生命周期结束后,Ubuntu 19.10 不再会从 Ubuntu 获得系统更新、安全更新或应用更新。 + +如果你继续使用它,你的系统可能会成为潜在的网络攻击的受害者,因为黑客往往会利用脆弱的系统。 + +之后,你可能无法使用 `apt` 命令安装新软件,因为 Ubuntu 将归档 19.10 的仓库。 + +### 如果你使用的是 Ubuntu 19.10,该怎么办? + +首先,[检查你使用的 Ubuntu 版本][6]。这可以在终端中输入此命令完成: + +``` +lsb_release -a +``` + +``` +No LSB modules are available. +Distributor ID: Ubuntu +Description: Ubuntu 19.10 +Release: 19.10 +Codename: Eoan +``` + +如果你看到 Ubuntu 19.10,你应该做以下两项工作之一: + +* 如果你有良好、稳定的互联网连接,从 Ubuntu 19.10 升级到 20.04。你的个人文件和大多数软件保持不变。 +* 如果你有着缓慢或不稳定的互联网连接,你应该[全新安装的 Ubuntu 20.04][7]。你的文件和磁盘上的所有内容将被擦除,因此你应该在外部磁盘上备份重要数据。 + +#### 如何从 19.10 升级到 20.04 (如果你有良好的互联网连接) + +我之前已经详细讨论了 Ubuntu 版本升级。我会在这里快速说下步骤。 + +首先,请确保在“软件和更新”中已设置接收新版本通知。 + +进入“软件和更新”: + +![][8] + +进入“更新”选项卡,将“通知我新的 Ubuntu 版本”设置为“对于任何新版本”: + +![][9] + +现在,安装所有挂起的更新。 + +现在,再次运行更新管理器工具。你应该可以选择升级到 Ubuntu 20.04。点击升级按钮并按照说明操作。 + +它会安装大约 1.2GB 的软件包。这就是为什么你需要一个良好和稳定的互联网连接。 + +![][10] + +这样的升级会保持你的家目录。不过,仍建议在外部磁盘进行备份。 + +### 你仍在使用 Ubuntu 19.10 吗? + +如果你仍在使用 Ubuntu 19.10,那么必须为升级或全新安装做好准备。你不能忽视它。 + +如果你不喜欢这样的频繁版本升级,你应该使用支持五年的 LTS 版本。当前的 LTS 版本是 Ubuntu 20.04,你无论如何都应该升级到它。 + +你是否正在使用 Ubuntu 19.10?你是否已升级到 Ubuntu 20.04?如果你面临任何问题,或者如果你有任何问题,请让我知道。 + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/ubuntu-19-10-end-of-life/ + +作者:[Abhishek Prakash][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://itsfoss.com/author/abhishek/ +[b]: https://github.com/lujun9972 +[1]: https://itsfoss.com/ubuntu-19-10-released/ +[2]: https://itsfoss.com/download-ubuntu-20-04/ +[3]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/07/ubuntu-19-10-end-of-life.jpg?ssl=1 +[4]: https://itsfoss.com/end-of-life-ubuntu/ +[5]: https://en.wikipedia.org/wiki/Systems_development_life_cycle +[6]: https://itsfoss.com/how-to-know-ubuntu-unity-version/ +[7]: https://itsfoss.com/install-ubuntu/ +[8]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2018/03/upgrade-ubuntu-1.jpeg?ssl=1 +[9]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2017/11/software-update-any-new-version.jpeg?resize=800%2C378&ssl=1 +[10]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/04/software-updater-focal.jpg?ssl=1 diff --git a/published/202007/20200720 Why People Are Crazy About Arch Linux- What-s so Special About it.md b/published/202007/20200720 Why People Are Crazy About Arch Linux- What-s so Special About it.md new file mode 100644 index 0000000000..5f4ad27495 --- /dev/null +++ b/published/202007/20200720 Why People Are Crazy About Arch Linux- What-s so Special About it.md @@ -0,0 +1,132 @@ +[#]: collector: (lujun9972) +[#]: translator: (Mikedkmilk) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12445-1.html) +[#]: subject: (Why People Are Crazy About Arch Linux? What’s so Special About it?) +[#]: via: (https://itsfoss.com/why-arch-linux/) +[#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/) + +为什么人们对 Arch Linux 如此着迷?它有什么特别之处? +====== + +顺便说一句(利益相关),我用 Arch! + +你或许已经在 Linux 论坛、朋友相互讨论或表情包里看到过这个术语。 + +你可能想知道为什么 Arch Linux 如此受欢迎,为什么人们这么喜欢它?因为有更容易使用,甚至更好的[基于 Arch 的发行版][1]。 + +在本文中,我将列出 Linux 用户喜欢使用 [Arch Linux][2] 的一些原因。 + +### 人们喜欢使用 Arch Linux 的六个原因 + +![][3] + +这些只是我的看法,当然,为什么你应该使用 Arch Linux 并没有固定的原因。这是我在十多年里与 Linux 用户和社区打交道的经验中观察到的。 + +让我们一起看看为什么 Arch Linux 如此受欢迎。 + +#### 1、DIY 的方式可以让你掌控操作系统的各个方面 + +我一直认为 Arch Linux 是一个可以让你自己动手打造的操作系统。从安装到管理,Arch Linux 放手让你处理一切。 + +你可以自己决定使用哪种桌面环境、安装哪些组件和服务。这种精细化的控制能够赋予你一个精简的操作系统,可以让你自由选择所需的组件来构建属于你自己的系统。 + +如果你是一个 DIY 爱好者,你会喜欢 Arch Linux 的。 + +#### 2、通过 Arch Linux,可以更好地理解 Linux 的工作原理 + +![Installing Arch Linux by creating partition and making filesystem via command line][4] + +如果你曾经尝试过安装 Arch Linux,你就会知道它的复杂性。 + +但这种复杂性同时也意味着你将被迫学习一些在其他发行版中可能永远不会费心学习的东西。 + +比如说在安装 Arch Linux 过程中配置网络本身就是一个很好的学习课程。 + +如果开始你有感到有困惑不懂的时候,Arch Linux 的[维基][5]可以帮助你。它是互联网上最广泛和最棒的由社区管理的文档。仅仅只是浏览 Arch Linux 的维基,就可以学到很多东西。 + +#### 3、滚动发行模式可以为你提供最新的内核和软件 + +![System update in Arch Linux][6] + +Arch Linux 是一个滚动发行版,这意味着新的内核和应用程序版本一经发布,就会立即向你推送。 + +当大多数其他 [Linux 发行版还在提供旧的 Linux 内核版本][7]时,Arch 会迅速向你提供最新的内核。 + +而软件也是如此。如果 Arch 资源库中的软件发布了新版本,Arch 用户通常会比其他用户先获得新版本。 + +在滚动发行模式下,一切都是新鲜和前沿的。你不必把操作系统从一个版本升级到另一个版本,只要使用 [pacman 命令][8],你会始终保持最新的版本。 + +#### 4、Arch 用户资源库,即 AUR + +![][9] + +Arch Linux 的资源库中有大量的软件。AUR 扩展了 Arch Linux 的软件产品。在 Arch Linux 中,你可以通过 [AUR][10] 得到相当多的软件。 + +AUR 是采用社区驱动的方式来提供更新的应用程序。你可以在 [AUR 辅助工具][11]的帮助下搜索和安装应用程序。 + +#### 5、成就感 + +![][12] + +正如 James Clear 在他的书《原子习惯Atomic Habits》中提到的那样,**人类的大脑喜欢挑战,但前提是在一个最理想的困难区域**。 + +还记得你第一次安装成功 Linux 时的感觉吗?即便你安装的是 Linux Mint。这给了你一种成就感:你成功安装了 Linux! + +如果你已经使用 Ubuntu、Fedora 或其他发行版一段时间了,现在开始感到舒适(或厌倦),你可以尝试安装一下 Arch Linux。 + +对于一个有一定经验的 Linux 用户来说,[成功安装 Arch Linux][13]本身就会给你一种成就感。 + +这是一个挑战,但却是可以实现的。如果你建议一个新的 Linux 用户尝试 Arch Linux 或者更复杂的 Linux 发行版比如 [Linux From Scratch(LFS)][14],这个挑战就太难实现了。 + +这种成功完成挑战的感觉也是人们使用 Arch Linux 的原因之一。 + +#### 6、没有企业的参与!Arch 是由社区创建、支持和拥有的 + +Ubuntu 由 Canonical 支持,Fedora 来自 Red Hat(现在是 IBM 的一部分),openSUSE 来自 SUSE。所有这些主流发行版都是企业支持的。 + +这本身并不是坏事或过错,但是有一些人不喜欢企业参与开源项目。 + +正如 Debian 一样,Arch Linux 是为数不多的仅由社区参与的 Linux 发行项目之一。 + +你可能会指出,许多其他发行版如 Linux Mint 等不是由企业赞助的。好吧,这可能是真的,但 Linux Mint 本身就是基于 Ubuntu 的,并且使用 Ubuntu 的资源库。而 Arch Linux 不是另一个发行版的衍生物。 + +从这个意义上说,[Debian][15] 和 Arch Linux 是更纯粹的社区驱动项目。这对很多人来说可能无关紧要,但确实有一些人在意这些事情。 + +#### 对你来说,为什么 Arch Linux 如此受欢迎? + +现在你可能不同意我提出的所有观点,那没关系。我想知道你是怎么看待 Arch Linux 在 Linux 用户中如此受欢迎,并具有崇拜的地位的? + +当你写评论时,让我分享一下“我用 Arch”的表情包 :) + +![](https://scontent-fml2-1.xx.fbcdn.net/v/t1.0-0/p526x296/109618601_1759578370849589_736435313539592753_o.jpg?_nc_cat=100&_nc_sid=8024bb&_nc_ohc=MYp_pidAMBMAX8z24Mc&_nc_ht=scontent-fml2-1.xx&_nc_tp=6&oh=9c2bf18b620cf90edb2dd32625b03b41&oe=5F3E8F39) + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/why-arch-linux/ + +作者:[Abhishek Prakash][a] +选题:[lujun9972][b] +译者:[Mikedkmilk](https://github.com/Mikedkmilk) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://itsfoss.com/author/abhishek/ +[b]: https://github.com/lujun9972 +[1]: https://itsfoss.com/arch-based-linux-distros/ +[2]: https://www.archlinux.org/ +[3]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/07/why-arch-linux.jpg?ssl=1 +[4]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/01/efi_system_partition-1.png?ssl=1 +[5]: https://wiki.archlinux.org/ +[6]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/04/sudo-pacman-Syu.png?ssl=1 +[7]: https://itsfoss.com/why-distros-use-old-kernel/ +[8]: https://itsfoss.com/pacman-command/ +[9]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2018/01/AUR.png?resize=800%2C451&ssl=1 +[10]: https://itsfoss.com/aur-arch-linux/ +[11]: https://itsfoss.com/best-aur-helpers/ +[12]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/07/installed-arch-linux.png?ssl=1 +[13]: https://itsfoss.com/install-arch-linux/ +[14]: http://www.linuxfromscratch.org/ +[15]: https://www.debian.org/ diff --git a/published/202007/20200727 Getting started as an open source builder and more industry trends.md b/published/202007/20200727 Getting started as an open source builder and more industry trends.md new file mode 100644 index 0000000000..769f5a9af1 --- /dev/null +++ b/published/202007/20200727 Getting started as an open source builder and more industry trends.md @@ -0,0 +1,56 @@ +[#]: collector: (lujun9972) +[#]: translator: (wxy) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12461-1.html) +[#]: subject: (Getting started as an open source builder and more industry trends) +[#]: via: (https://opensource.com/article/20/7/open-source-industry-trends) +[#]: author: (Tim Hildred https://opensource.com/users/thildred) + +每周开源点评:开源建设者入门,以及更多的行业趋势 +====== + +> 每周关注开源社区和行业趋势。 + +![](https://img.linux.net.cn/data/attachment/album/202007/28/175317mgsvgtvstvcggsch.jpg) + +我在一家采用开源软件开发模型的企业软件公司任高级产品营销经理,我的一部分职责是为产品营销人员、经理和其他相关人定期发布有关开源社区、市场和业界发展趋势的更新。以下是该更新中我和他们最喜欢的五篇文章。 + +### 《[开放源码建设者:入门][2]》 + +> "最后,我发现自己想要自己修改代码,"Liz 说。她的第一个贡献是为 Django 框架做了一个授权扩展。她补充说:"我记得当时我很担心维护者可能不希望一个完全陌生的人做的改动,所以当它被接受时,我感到很兴奋,也很欣慰……得到认可,甚至感谢你的贡献,这种感觉总是很好。" + +**分析:** 这一系列对开源维护者的采访(引自 [Liz Rice][3])交汇了跳入开源领域的动机和经验。这也是对天才独狼开发者神话的一个点赞,你可以自己走很远的路,但如果你知道如何与其他人很好地合作,你会走得更远,建立更好的东西。如果你知道如何说服和激励他们,你会走得更远。 + +### 《[Fluent Bit v1.5:轻量级和高性能日志处理器][4]》 + +> 本次主要版本的最大亮点之一是不同公司与 Fluent Bit 核心维护者的联合工作,为 Google、Amazon、LogDNA、New Relic 和 Sumo Logic 等公司内部提供的可观察性云服务带来了改进和新的连接器。 + +**分析:** “从不同来源收集数据/日志,统一并将其发送到多个目的地”是一项繁琐的任务,但这是超大规模企业及其客户共同的任务。证据 A:一个开源工作完全如其预期的典型例子。祝贺 Fluent Bit 团队的这次发布! + +### 《[Kubernetes 如何让 Nubank 工程师每周部署 700 次][5]》 + +> 因此,生产环境的部署时间从 90 分钟变成了 15 分钟。而 Nobre 说,这是“最主要的好处,因为它有助于开发人员的体验”。如今,Nubank 的工程师每周部署 700 次。“对于一家银行来说,你会说这太疯狂了,”Capaverde 笑着说。“但这并不疯狂,因为有了 Kubernetes 和金丝雀部署,回滚变化更容易,因为部署速度也更快。人们的出货频率更高,更有信心。” + +**分析:** 我觉得这是个赢家,也是个输家。当然,他们降低了做出改变的成本,以一种让人们更有信心去尝试的方式。但他们的开发人员不能再在等待部署完成的同时跑 10 公里,现在只能在一次 TED 演讲中凑合。 + +希望你喜欢这个列表,下周再见。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/7/open-source-industry-trends + +作者:[Tim Hildred][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/thildred +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/data_metrics_analytics_desktop_laptop.png?itok=9QXd7AUr (Person standing in front of a giant computer screen with numbers, data) +[2]: https://idk.dev/open-source-builders-getting-started/ +[3]: https://twitter.com/lizrice +[4]: https://www.cncf.io/blog/2020/07/14/fluent-bit-v1-5-lightweight-and-high-performance-log-processor/ +[5]: https://www.cncf.io/blog/2020/07/10/how-kubernetes-empowered-nubank-engineers-to-deploy-200-times-a-week/ diff --git a/published/202007/20200730 Defining cloud native, expanding the ecosystem, and more industry trends.md b/published/202007/20200730 Defining cloud native, expanding the ecosystem, and more industry trends.md new file mode 100644 index 0000000000..d5a52e2a1b --- /dev/null +++ b/published/202007/20200730 Defining cloud native, expanding the ecosystem, and more industry trends.md @@ -0,0 +1,72 @@ +[#]: collector: (lujun9972) +[#]: translator: (wxy) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12473-1.html) +[#]: subject: (Defining cloud native, expanding the ecosystem, and more industry trends) +[#]: via: (https://opensource.com/article/20/7/cloud-native-expanding-and-more-industry-trends) +[#]: author: (Tim Hildred https://opensource.com/users/thildred) + +每周开源点评:定义云原生、拓展生态系统,以及更多的行业趋势 +====== + +> 每周关注开源社区和行业趋势。 + +![](https://img.linux.net.cn/data/attachment/album/202007/31/235751f5zd9l3rejd2tjss.jpg) + +我在一家采用开源软件开发模型的企业软件公司任高级产品营销经理,我的一部分职责是为产品营销人员、经理和其他相关人定期发布有关开源社区、市场和业界发展趋势的更新。以下是该更新中我和他们最喜欢的几篇文章。 + +### 《随着云原生计算的兴起,它和代码一样在改变文化》 + +- [文章链接][2] + +> 现在是围绕一套云原生计算的共同原则进行行业整合的时候了,因为许多企业已经意识到,他们最初进入云计算的回报有限。国际数据公司去年的一项调查发现,[80% 的受访者曾将工作负载从公有云环境遣返到企业内部][3],平均而言,他们预计在未来两年内将一半的公有云应用转移到私有场所。 + +**分析**:在云端的第一次运行主要是大量的“提升和转移”尝试,以提取工作负载并将其投放到云端。第二次运行将涉及更多的工作,以确定转移什么以及如何转移,但随着开发人员对理所当然的事情越来越满意,最终应该会带来更多价值。 + +### 《为什么云原生基础设施的自动化是所有参与者的胜利》 + +- [文章链接][4] + +> 开发的圣杯是创建和维护安全的应用程序,产生强大的投资回报率和满意的客户。但如果这种开发不是高效、高速和可扩展的,那么这个圣杯很快就会变得遥不可及。如果你发现自己对当前的基础设施有更高的期望,那么可能是时候考虑云原生了。它不仅可以检查所有这些机器,而且为云原生基础设施进行自动化可以提高效率和结果。 + +**分析**:我还要补充一点,如果没有大量的自动化,真正采用云原生方法是不可能的;涉及的移动部件数量太多,不可能用人的头脑来处理。 + +### 《Linkerd 案例研究:满足安全要求、减少延迟和从 Istio 迁移》 + +- [文章链接][5] + +> 最后,Subspace 分享了其使用 Linkerd 提供“光速”多人游戏的经验。虽然在超低延迟环境中使用服务网状物起初似乎有悖常理,但 Subspace 发现 Linkerd 的战略使用实际上降低了总延迟 —— 服务网状物是如此轻巧,以至于它增加的最小延迟被它通过可观察性降低的延迟所掩盖。简而言之,Linkerd 的这一独特用例使 Subspace 在运营结果上获得了巨大的净收益。[阅读完整的用户故事][6]。 + +**分析**:我听说过这样一个观点:你并不能真正降低一个系统的复杂性,你只是把它抽象化,改变它的接触对象。似乎对延迟也有类似的观察:如果你仔细选择你接受延迟的地方,你可以因此减少系统中其他地方的延迟。 + +### 一位高层管理人员解释了 IBM 的“重要支点”,以赢得开发者、初创企业和合作伙伴的青睐,这是其从微软等竞争对手手中赢得混合云市场计划的一部分 + +- [文章链接][7] + +> 蓝色巨人正在转向一个新的战略,专注于建立一个由开发者、合作伙伴和初创公司组成的生态系统。“我们的服务组织无法接触到所有客户。获取这些客户的唯一方法是激活一个生态系统。” + +**分析**:越来越多的公司开始接受这样的理念:有些客户的问题,他们没有帮助就无法解决。也许这可以减少从每个单独客户身上赚到的钱,因为它扩大了更广泛地参与更多问题空间的机会。 + +希望你喜欢这个列表,下周再见。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/7/cloud-native-expanding-and-more-industry-trends + +作者:[Tim Hildred][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/thildred +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/data_metrics_analytics_desktop_laptop.png?itok=9QXd7AUr (Person standing in front of a giant computer screen with numbers, data) +[2]: https://siliconangle.com/2020/07/18/cloud-native-computing-rises-transforming-culture-much-code/ +[3]: https://www.networkworld.com/article/3400872/uptick-in-cloud-repatriation-fuels-rise-of-hybrid-cloud.html +[4]: https://thenewstack.io/why-automating-for-cloud-native-infrastructures-is-a-win-for-all-involved/ +[5]: https://www.cncf.io/blog/2020/07/21/linkerd-case-studies-meeting-security-requirements-reducing-latency-and-migrating-from-istio/ +[6]: https://buoyant.io/case-studies/subspace/ +[7]: https://www.businessinsider.com/ibm-developers-tech-ecosystem-red-hat-hybrid-cloud-bob-lord-2020-7?r=AU&IR=T diff --git a/published/202007/20200731 Beginner-friendly Terminal-based Text Editor GNU Nano Version 5.0 Released.md b/published/202007/20200731 Beginner-friendly Terminal-based Text Editor GNU Nano Version 5.0 Released.md new file mode 100644 index 0000000000..c5b64697b1 --- /dev/null +++ b/published/202007/20200731 Beginner-friendly Terminal-based Text Editor GNU Nano Version 5.0 Released.md @@ -0,0 +1,66 @@ +[#]: collector: (lujun9972) +[#]: translator: (wxy) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12471-1.html) +[#]: subject: (Beginner-friendly Terminal-based Text Editor GNU Nano Version 5.0 Released) +[#]: via: (https://itsfoss.com/nano-5-release/) +[#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/) + +适于初学者的基于终端的文本编辑器 GNU Nano 5.0 版发布 +====== + +> 开源文本编辑器 GNU nano 已经达到了 5.0 版本的里程碑。看看这个新版本带来了哪些功能。 + +Linux 上有很多[基于终端的文本编辑器][1]。像 Emacs 和 Vim 这样的编辑器需要经历陡峭的学习曲线和掌握一堆不寻常的键盘快捷键,但公认 GNU nano 更容易使用。 + +也许这就是为什么 Nano 是 Ubuntu 和许多其他发行版中默认的基于终端的文本编辑器的原因,而即将发布的 [Fedora 33 版本][2]也将把 Nano 设置为终端的默认文本编辑器。 + +### GNU nano 5.0 的新功能 + +![][3] + +在 GNU nano 5.0 的[变更日志][4]中提到的一些主要亮点是: + +* `-indicator` 选项将在屏幕右侧显示一种滚动条,以指示视口在缓冲区中的位置和覆盖范围。 +* 可以用 `Alt+Insert` 键标记行,你可以用 `Alt+Page` 和 `Alt+PageDown` 键跳转到这些标记的行。 +* 执行命令提示符现在可以直接从主菜单中访问。 +* 在支持至少 256 种颜色的终端上,有新的颜色可用。 +* 新的 `-bookstyle` 模式,任何以空格开头的行都会被认为是一个段落的开始。 +* 用 `^L` 刷新屏幕现在在每个菜单中都可以使用。它还会将行与光标居中。 +* 可绑定函数 `curpos` 已经改名为 `location`,长选项 `-tempfile` 已经改名为 `-saveonexit`,短选项 `-S` 现在是 `-softwrap` 的同义词。 +* 备份文件将保留其组的所有权(如果可能的话)。 +* 数据会在显示 “……行写入” 之前同步到磁盘。 +* 增加了 Markdown、Haskell 和 Ada 语法的支持。 + +### 获取 GNU nano 5.0 + +目前 Ubuntu 20.04 中的 nano 版本是 4.8,而在这个 LTS 版本中,你不太可能在短时间内获得新版本。如果 Ubuntu 有新版本的话,你应该会通过系统更新得到它。 + +Arch 用户应该会比其他人更早得到它,就像往常一样。其他发行版也应该迟早会提供新版本。 + +如果你是少数喜欢[从源代码安装软件][5]的人,你可以从它的[下载页面][6]中获得。 + +如果你是新手,我强烈推荐这篇 [Nano 编辑器初学者指南][1]。 + +你喜欢这个新版本吗?你期待使用 Nano 5 吗? + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/nano-5-release/ + +作者:[Abhishek Prakash][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://itsfoss.com/author/abhishek/ +[b]: https://github.com/lujun9972 +[1]: https://itsfoss.com/nano-editor-guide/ +[2]: https://itsfoss.com/fedora-33/ +[3]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2018/09/Nano.png?ssl=1 +[4]: https://www.nano-editor.org/news.php +[5]: https://itsfoss.com/install-software-from-source-code/ +[6]: https://www.nano-editor.org/download.php diff --git a/published/20200711 scanimage- scan from the command line.md b/published/20200711 scanimage- scan from the command line.md new file mode 100644 index 0000000000..75aac2dae6 --- /dev/null +++ b/published/20200711 scanimage- scan from the command line.md @@ -0,0 +1,78 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12886-1.html) +[#]: subject: (scanimage: scan from the command line!) +[#]: via: (https://jvns.ca/blog/2020/07/11/scanimage--scan-from-the-command-line/) +[#]: author: (Julia Evans https://jvns.ca/) + +scanimage:从命令行扫描! +====== + +![](https://img.linux.net.cn/data/attachment/album/202012/05/105822m30t6x66hz3hx6x3.jpg) + +这又是一篇关于我很喜欢的一个命令行工具的文章。 + +昨晚,出于官僚原因,我需要扫描一些文档。我以前从来没有在 Linux 上使用过扫描仪,我担心会花上好几个小时才弄明白。我从使用 `gscan2pdf` 开始,但在用户界面上遇到了麻烦。我想同时扫描两面(我知道我们的扫描仪支持),但无法使它工作。 + +### 遇到 scanimage! + +`scanimage` 是一个命令行工具,在 `sane-utils` Debian 软件包中。我想所有的 Linux 扫描工具都使用 `sane` (“scanner access now easy”) 库,所以我猜测它和其他扫描软件有类似的能力。在这里,我不需要 OCR,所以我不打算谈论 OCR。 + +### 用 scanimage -L 得到你的扫描仪的名字 + +`scanimage -L` 列出了你所有的扫描设备。 + +一开始我不能让它工作,我有点沮丧,但事实证明,我把扫描仪连接到了我的电脑上,但没有插上电源。 + +插上后,它马上就能工作了。显然我们的扫描仪叫 `fujitsu:ScanSnap S1500:2314`。万岁! + +### 用 --help 列出你的扫描仪选项 + +显然每个扫描仪有不同的选项(有道理!),所以我运行这个命令来获取我的扫描仪的选项: + +``` +scanimage --help -d 'fujitsu:ScanSnap S1500:2314' +``` + +我发现我的扫描仪支持 `--source` 选项(我可以用它来启用双面扫描)和 `--resolution` 选项(我把它改为 150,以减少文件大小,使扫描更快)。 + +### scanimage 不支持输出 PDF 文件(但你可以写一个小脚本) + +唯一的缺点是:我想要一个 PDF 格式的扫描文件,而 scanimage 似乎不支持 PDF 输出。 + +所以我写了这个 5 行的 shell 脚本在一个临时文件夹中扫描一堆 PNG 文件,并将结果保存到 PDF 中。 + +``` +#!/bin/bash +set -e + +DIR=`mktemp -d` +CUR=$PWD +cd $DIR +scanimage -b --format png -d 'fujitsu:ScanSnap S1500:2314' --source 'ADF Front' --resolution 150 +convert *.png $CUR/$1 +``` + +我像这样运行脚本:`scan-single-sided output-file-to-save.pdf` + +你可能需要为你的扫描仪设置不同的 `-d` 和 `-source`。 + +### 这真是太简单了! + +我一直以为在 Linux 上使用打印机/扫描仪是一个噩梦,我真的很惊讶 `scanimage` 可以工作。我可以直接运行我的脚本 `scan-single-sided receipts.pdf`,它将扫描文档并将其保存到 `receipts.pdf`! + +-------------------------------------------------------------------------------- + +via: https://jvns.ca/blog/2020/07/11/scanimage--scan-from-the-command-line/ + +作者:[Julia Evans][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://jvns.ca/ +[b]: https://github.com/lujun9972 diff --git a/published/202008/20190222 Developer happiness- What you need to know.md b/published/202008/20190222 Developer happiness- What you need to know.md new file mode 100644 index 0000000000..706599ea05 --- /dev/null +++ b/published/202008/20190222 Developer happiness- What you need to know.md @@ -0,0 +1,79 @@ +[#]: collector: (lujun9972) +[#]: translator: (chenmu-kk) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12497-1.html) +[#]: subject: (Developer happiness: What you need to know) +[#]: via: (https://opensource.com/article/19/2/developer-happiness) +[#]: author: (Bart Copeland https://opensource.com/users/bartcopeland) + +开发者的福音:你需要知道的事 +====== + +> 开发者需要快速编程的工具和自由,而不会因为合规性和安全性所困扰。 + +![](https://img.linux.net.cn/data/attachment/album/202008/07/214051ki2zitovo8zzynco.jpg) + +一个人需要合适的工具来完成工作。比如说没有比修车修到一半,却发现你没有完成工作的专业工具更沮丧的事情了。同样的道理也适用在开发者身上:你需要工具来发挥你的才能,而不会因为合规性和安全性的需求打断你的工作流程,这样你才可以更快速地编码。 + +根据 ActiveState 的研究《[2018 年开发者调查:开源运行时的痛苦][1]》显示,超过一半的开发人员(具体为 51%),每天只需要花费 1-4 小时的时间进行编程。换句话说,大多数开发人员花费不到一半的时间编程。根据调查,一半的开发人员认为安全是他们最大的担忧之一,但是由于公司政策方面的原因,67% 的开发人员选择在编程时不添加新的语言。 + +结果是开发人员不得不投入更多的精力在非编码的活动上,例如在构建软件和语言之后检查软件的安全性和合规性标准。而且由于公司政策的原因,他们无法选择适合的开发工具或语言。他们的满意度会下降,同时风险提高。 + +因此,开发人员无法将时间投入在高价值的工作上。这会带来额外的商业风险,因为他们的软件上市时间变慢了,并且公司因为没有授权开发人员在不受公司政策影响的前提下决定“最佳的”技术的能力,从而增加了技术债务。 + +### 纳入安全性和合规性的工作流程 + +我们如何解决这个问题呢?一种方式是通过四个简单的步骤将安全性和合规性的工作流程集成到软件开发中: + +#### 1、集中你的力量 + +获得所有相关人员的支持,这是一个经常被遗忘但却至关重要的第一步。确保考虑到了广泛的利益相关者,包括: + + * 开发运维(DevOps) + * 开发人员 + * 信息安全 + * 合法/合规 + * IT 安全 + +利益相关者想要了解相关的商业利益,因此要为消除软件构建后的安全和合规性检查点提供坚实的理由。你可以在构建你的商业案例中考虑以下任何一个(或者全部)因素:节省时间、机会成本和开发人员生产力。在开发流程中,你也可以通过集成安全性和合规性来避免语言的改造。 + +#### 2、寻找可信赖的资源 + +接下来,选择可使用的可信资源,以及他们的许可证和安全要求。考虑到如下相关信息: + + * 基于环境或应用程序类型的使用限制以及每种语言的版本控制 + * 允许哪些开源组件,例如,特定的程序包 + * 哪种环境类型可以使用哪种许可证(例如,研究与生产) + * 安全级别的定义、可接受的脆弱性风险等级、什么样的风险级别会触发一个措施,这个措施是什么并且谁来负责它的执行 + +#### 3、从一开始就纳入安全性和合规性 + +纳入安全性和合规性的工作流程的结果是,它最终将安全性和合规性融入到代码的第一行。它消除了公司政策的拖累,因为你是按照规范进行编码,而不是必须事后解决问题。但要做到这一点,请考虑在构建代码时采用自动扫描代码的机制,以及使用无代理监控你的运行时代码。你可以节省时间,还可以通过编程实施策略来确保整个组织的合规性。 + +#### 4、监控、报告和更新 + +出现新的漏洞,新的补丁和版本也会出现。所以,将代码部署到生产中以及运行代码时,需要考虑安全性和合规性。你需要知道哪些(如果有的话)代码存在风险以及该代码在何处运行。所以,部署和运行代码的过程应该包括监视、报告和更新生产中的代码。 + +通过一开始就在你的软件开发过程中集成安全性和合规性,你还可以在部署后跟踪代码的运行位置,并在新的威胁出现时获得警报。你也能追踪当你的应用程序何时受到攻击,并通过自动执行软件策略做出响应。 + +如果你的软件开发过程中已经引入了安全性和合规性的工作流程,你将会提高你的生产率。你将能够通过增加编码时间、提高安全性和稳定性、以及在维护和发现安全性和合规性的威胁方面节省的成本和时间来衡量价值。 + +### 集成所带来的幸福 + +如果你不开发和更新软件,你的组织将无法前进。开发人员是公司成功的关键,这意味着他们需要快速编写代码的工具和自由。尽管合规性和安全性至关重要,但你不能让这个需求阻碍你的发展。开发人员显然很担心安全性,因此最好的办法就是“左移”,从一开始就集成安全性和合规性的工作流程。你将可以做更多的事情,在第一次就可以完成,而花费更少的时间进行代码更新。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/2/developer-happiness + +作者:[Bart Copeland][a] +选题:[lujun9972][b] +译者:[chenmu-kk](https://github.com/chenmu-kk) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/bartcopeland +[b]: https://github.com/lujun9972 +[1]: https://www.activestate.com/company/press/press-releases/activestate-developer-survey-examines-open-source-challenges/ diff --git a/published/202008/20190329 9 open source tools for building a fault-tolerant system.md b/published/202008/20190329 9 open source tools for building a fault-tolerant system.md new file mode 100644 index 0000000000..6c541e30f7 --- /dev/null +++ b/published/202008/20190329 9 open source tools for building a fault-tolerant system.md @@ -0,0 +1,137 @@ +[#]: collector: (lujun9972) +[#]: translator: (chenmu-kk) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12566-1.html) +[#]: subject: (9 open source tools for building a fault-tolerant system) +[#]: via: (https://opensource.com/article/19/3/tools-fault-tolerant-system) +[#]: author: (Bryant Son https://opensource.com/users/brson) + +九个用来构建容错系统的开源工具 +====== + +> 这些开源工具可以最大化延长运行时间并且在最大程度上减少问题。 + +![](https://img.linux.net.cn/data/attachment/album/202008/30/205036eqh1j8hhss9skf57.jpg) + +我一直对 Web 开发和软件体系结构很感兴趣,因为我喜欢看到一个工作系统的宏观视图。无论是构建一个移动应用程序还是一个 Web 应用程序,都必须连接到互联网,在不同的模块中交换数据,这意味着你需要 Web 服务。 + +如果选择云系统作为应用程序的后端,则可以利用更强大的计算能力,因为后端服务将会在水平和垂直方向上进行扩展并编排不同的服务。但无论你是否使用云后端,建造一个灵活、稳定、快速又安全的容错系统是必不可少的。 + +要了解容错系统,让我们以脸书、亚马逊、谷歌和奈飞为例。数以亿计的用户会同时接入这些平台并通过对等网络和用户-服务器网络传输大量数据,你可以肯定这其中还存在许多的带有不法目的的恶意用户,例如黑客攻击和拒绝服务(DoS)攻击。即使如此,这些平台无需停机也可以全年无休地运转。 + +虽然机器学习和智能算法是这些系统的基础,但它们实现持续的服务而不停机一分钟的事实值得称赞。它们昂贵的硬件设备和巨大的数据中心当然十分重要,但是支持服务的精密软件设计也同样重要。而且容错系统是一个构建如此精密系统的法则之一。 + +### 生产过程中导致错误的两种行为 + +这是考虑容错系统的另一种方法。当你在本地运行应用程序服务时,每件事似乎都很完美。棒极了!但当你提升服务到生产环境时,一切都会变得一团糟。在这种情况下,容错系统通过解决两个问题来提供帮助:故障停止行为和拜占庭行为。 + +#### 故障停止行为 + +故障停止行为是运行中系统突然停止运行或者系统中的某些部分发生了故障。服务器停机时间和数据库不可访问都属于此种类型。举个例子,在下图中,由于服务 2 无法访问,因此服务 1 无法与服务 2 进行通信。 + +![服务 2 停机导致的故障停止行为][2] + +但是,如果服务之间存在网络问题,也会出现此问题,如下图所示: + +![网络故障导致的故障停止行为][3] + +#### 拜占庭行为 + +拜占庭行为是指系统在持续运行,但并没有产生预期行为(例如:错误的数据或者无效的数据)。 + +如果服务 2 的数据(值)已损坏则可能会发生拜占庭故障,即使服务看起来运行得很好,比如下面的例子: + +![因服务损坏而导致的拜占庭故障][4] + +或者,可能存在恶意的中间人在服务之间进行拦截,并注入了不需要的数据: + +![恶意中间人导致的拜占庭故障][5] + +无论是故障停止和拜占庭行为,都不是理想的情况,因此我们需要一些预防或修复它们的手段。这里容错系统就起作用了。以下是可以帮助你解决这些问题的 8 个开源工具。 + +### 构建容错系统的工具 + +尽管构建一个真正实用的容错系统涉及到深入的“分布式计算理论”和复杂的计算机科学原理,但有许多的软件工具(其中许多是开源软件)通过构建容错系统来减轻不良后果的影响。 + +#### 断路模式:Hystrix 和 Resilience4j + +[断路模式][6]是一种技术,它有助于在服务失败时返回准备好的虚拟回应或者简单回应。 + +![断路模式][7] + +奈飞开源的 [Hystrix][8] 是断路模式中最流行的应用。 + +我之前工作过的很多家公司都在用这款出色的工具。令人意外的是,奈飞宣布将不再更新 Hystrix(是的,我知道了)。相反,奈飞建议使用另一种支持 Java 8 和函数式编程的 [Resilence4j][9] 之类的替代解决方案,或者类似于 [Adaptive Concurrency Limit][10] 的替代解决方案。 + +#### 负载均衡:Nginx 和 HaProxy + +负载均衡是分布式系统中最基本的概念之一,要想拥有一个生产质量的环境,必须有负载均衡的存在。要理解负载均衡器,首先我们需要明白冗余的概念。每个生产级的 Web 服务都有多个服务器在某个服务器宕机时提供冗余来接管和维持服务。 + +![负载均衡][11] + +想想现代飞机:它们的双引擎提供冗余,使它们即使在一个引擎着火的情况下也能安全的着陆。(这也有助于大多数商用飞机拥有最先进的自动化系统)。但是,拥有多引擎(或者多服务器)也意味着必须存在一些调度机制在故障发生时有效地对系统进行路由。 + +负载均衡器是一种通过平衡多个服务节点来优化大流量事务的设备或者软件。举个例子,当数以千计的请求涌入时,负载均衡器可以作为中间层在不同的服务器间进行路由和平均分配流量。如果一台服务器宕机,负载均衡器会将请求转发给其它运行良好的服务器。 + +有许多可用的负载均衡器,但其中最出名的两个就是 Nginx 和 HaProxy。 + +[Nginx][12] 不仅仅是一个负载均衡器,它还是 HTTP 和反向代理服务器、邮件代理服务器和通用 TCP/UDP 代理服务器。Groupon、Capital One、Adobe 和 NASA 等公司都在使用它。 + +[HaProxy][13] 也很受欢迎,因为它是一个免费的、非常快且可靠的解决方案,它为基于 TCP 和 HTTP 的应用程序提供高可用性、负载平衡和代理。许多大型网络公司,包括 Github、Reddit、Twitter 和 Stack Overflow 都使用 HaProxy。是的,Red Hat Enterprise Linux 同样支持 HaProxy 设置。 + +#### 参与者模型:Akka + +[参与者模型][14]是一种并发设计模式,当作为基本计算单位的“参与者”接收到消息时,它会分派责任。一个参与者可以创建更多的参与者,并将消息委派给他们。 + +[Akka][15] 是最著名的参与者模型实现之一。该框架同时支持基于 JVM 的 Java 和 Scala。 + +#### 使用消息队列的异步、非阻塞 I/O:Kafka 和 RabbitMQ + +多线程开发在过去很流行,但是现在已经不鼓励这种做法了,取而代之的是异步的、非阻塞的 I/O 模式。对于 Java,这一点在 [EnterpriseJavaBean(EJB)规范][16]中得到了明确的规定: + +> “企业 bean 一定不能使用线程同步原语来同步多个实例的执行。” +> +> “企业 bean 不得试图去管理线程。企业 bean 不得试图启动、停止、挂起或恢复线程,或者去更改线程的优先级或者名称。企业 bean 不得试图管理线程组。” + +如今,虽然还有其他做法,如流 API 和参与者模型,但像 [Kafka][17] 和[RabbitMQ][18] 之类的消息队列为异步和非阻塞 I/O 功能提供了开箱即用的支持,同时它们也是功能强大的开源工具,通过处理并发进程可以替代线程。 + +#### 其他的选择:Eureka 和 Chaos Monkey + +用于容错系统其它有用的工具包括奈飞的 [Eureka][19] 之类的监控工具,以及像 [Chaos Monkey][20] 这样的压力测试工具。它们旨在通过在较低环境中的测试,如集成(INT)、质量保障(QA)和用户接受测试(UAT)来早早发现潜在问题以防止在转移到生产环境之前出现潜在问题。 + +你在使用什么开源工具来构建一个容错系统呢?请在评论中分享你的最爱。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/3/tools-fault-tolerant-system + +作者:[Bryant Son][a] +选题:[lujun9972][b] +译者:[chenmu-kk](https://github.com/chenmu-kk) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/brson +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/mistake_bug_fix_find_error.png?itok=PZaz3dga (magnifying glass on computer screen, finding a bug in the code) +[2]: https://opensource.com/sites/default/files/uploads/1_errordowntimeservice.jpg (Fail-stop behavior due to Service 2 downtime) +[3]: https://opensource.com/sites/default/files/uploads/2_errordowntimenetwork.jpg (Fail-stop behavior due to network failure) +[4]: https://opensource.com/sites/default/files/uploads/3_byzantinefailuremalicious.jpg (Byzantine failure due to corrupted service) +[5]: https://opensource.com/sites/default/files/uploads/4_byzantinefailuremiddleman.jpg (Byzantine failure due to malicious middleman) +[6]: https://martinfowler.com/bliki/CircuitBreaker.html +[7]: https://opensource.com/sites/default/files/uploads/5_circuitbreakerpattern.jpg (Circuit breaker pattern) +[8]: https://github.com/Netflix/Hystrix/wiki +[9]: https://github.com/resilience4j/resilience4j +[10]: https://medium.com/@NetflixTechBlog/performance-under-load-3e6fa9a60581 +[11]: https://opensource.com/sites/default/files/uploads/7_loadbalancer.jpg (Load balancer) +[12]: https://www.nginx.com +[13]: https://www.haproxy.org +[14]: https://en.wikipedia.org/wiki/Actor_model +[15]: https://akka.io +[16]: https://jcp.org/aboutJava/communityprocess/final/jsr220/index.html +[17]: https://kafka.apache.org +[18]: https://www.rabbitmq.com +[19]: https://github.com/Netflix/eureka +[20]: https://github.com/Netflix/chaosmonkey diff --git a/published/202008/20190620 How to use OpenSSL- Hashes, digital signatures, and more.md b/published/202008/20190620 How to use OpenSSL- Hashes, digital signatures, and more.md new file mode 100644 index 0000000000..ccca0f17d9 --- /dev/null +++ b/published/202008/20190620 How to use OpenSSL- Hashes, digital signatures, and more.md @@ -0,0 +1,341 @@ +[#]: collector: (lujun9972) +[#]: translator: (wxy) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12511-1.html) +[#]: subject: (How to use OpenSSL: Hashes, digital signatures, and more) +[#]: via: (https://opensource.com/article/19/6/cryptography-basics-openssl-part-2) +[#]: author: (Marty Kalin https://opensource.com/users/mkalindepauledu) + +如何使用 OpenSSL:哈希值、数字签名等 +====== + +> 通过 OpenSSL 深入了解密码学的细节:哈希值、数字签名、数字证书等。 + +![](https://img.linux.net.cn/data/attachment/album/202008/13/150012t7zwwk6x7wr69wih.jpg) + +[本系列的第一篇文章][2]通过 OpenSSL 库和命令行实用程序介绍了哈希、加密/解密、数字签名和数字证书。这第二篇文章将对细节进行深入探讨。让我们从计算中无处不在的哈希开始,并考虑是什么使哈希函数*具备密码学意义*。 + +### 密码学哈希 + +OpenSSL 源代码的[下载页面](https://www.openssl.org/source/)包含了一个带有最新版本的表格。每个版本都有两个哈希值hash:160 位 SHA1 和 256 位 SHA256。这些值可以用来验证下载的文件是否与存储库中的原始文件相匹配:下载者在本地重新计算下载文件的哈希值,然后将结果与原始文件进行比较。现代系统有计算这种哈希值的实用程序。例如,Linux 有 `md5sum` 和 `sha256sum`。OpenSSL 本身也提供了类似的命令行实用程序。 + +哈希值被用于计算的许多领域。例如,比特币区块链使用 SHA256 哈希值作为区块标识符。挖比特币就是生成一个低于指定阈值的 SHA256 哈希值,也就是至少有 N 个前导零的哈希值。(N 的值可以上升或下降,这取决于特定时间的挖矿生产力)。作为一个兴趣点,如今的矿机是为并行生成 SHA256 哈希值而设计的硬件集群。在 2018 年的一个高峰期,全球的比特币矿工每秒产生约 7500 万个太哈希值terahash —— 这真是一个不可思议的数字。 + +网络协议也使用哈希值(在这里通常叫做“校验和checksum”)来支持消息的完整性;也就是说,保证收到的消息与发送的消息是一样的。消息发送者计算消息的校验和,并将结果与消息一起发送。当消息到达时,接收方重新计算校验和。如果发送的校验和与重新计算的校验和不一致,那么消息在传输过程中可能出现了一些问题,或者发送的校验和出现了问题,或者两者都出现了问题。在这种情况下,应该重新发送消息和它的校验和,或者至少应该触发一个错误情况。(如 UDP 这样的低级网络协议不会理会校验和。) + +哈希的其他例子大家都很熟悉。比如一个网站,要求用户用密码进行验证,用户在浏览器中输入密码,然后,他们通过 HTTPS 连接到服务器,密码从浏览器加密发送到服务器。一旦密码到达服务器,就会被解密,然后进行数据库表的查询。 + +在这个查询表中应该存储什么?存储密码本身是有风险的。风险要小得多的方式是存储一个由密码生成的哈希值,也许在计算哈希值之前“加一些salt(额外的位)改善口味”。你的密码可能会被发送到 Web 服务器上,但网站可以向你保证,密码不会存储在那里。 + +哈希值还出现在安全的各个领域。例如,基于哈希值的消息认证码hash-based message authentication code([HMAC][3])使用一个哈希值和一个秘密的加密密钥cryptographic key来认证通过网络发送的消息。HMAC 码轻量级且易于在程序中使用,在 Web 服务中很受欢迎。一个 X509 数字证书包括一个称为指纹fingerprint的哈希值,它可以方便证书验证。一个存放于内存中的可信存储truststore可以实现为一个以这种指纹为键的查找表 —— 作为一个支持恒定查找时间的哈希映射hash map。来自传入的证书的指纹可以与可信存储中的密钥进行比较,以确定是否匹配。 + +密码学哈希函数cryptographic hash function应该具有什么特殊属性?它应该是单向one-way的,这意味着很难被逆转。一个加密哈希函数应该是比较容易计算的,但是计算它的反函数(将哈希值映射回输入位串的函数)在计算上应该是困难的。下面是一个描述,用 `chf` 作为加密哈希函数,我的密码 `foobar` 作为样本输入。 + +``` + +---+ +foobar—>|chf|—>hash value ## 简单直接 + +--–+ +``` + +相比之下,逆向操作是不可行的: + +``` + +-----------+ +hash value—>|chf inverse|—>foobar ## 棘手困难 + +-----------+ +``` + +例如,回忆一下 SHA256 哈希函数。对于一个任意长度为 N > 0 的输入位串,这个函数会生成一个 256 位的固定长度的哈希值;因此,这个哈希值甚至不会反映出输入位串的长度 N,更不用说字符串中每个位的值了。顺便说一下,SHA256 不容易受到[长度扩展攻击][4]length extension attack。唯一有效的逆向工程方法是通过蛮力搜索将计算出的 SHA256 哈希值逆向返回到输入位串,这意味着需要尝试所有可能的输入位串,直到找到与目标哈希值匹配的位串。这样的搜索在 SHA256 这样一个完善的加密哈希函数上是不可行的。 + +现在,最后一个回顾的知识点是有序in order。加密哈希值是统计学上的唯一,而不是无条件的唯一,这意味着两个不同的输入位串产生相同的哈希值是不太可能的,但也不是不可能的 —— 这称之为碰撞collision。[生日问题][5]提供了一个很好的反直觉的碰撞例子。对各种哈希算法的抗碰撞性collision resistance有着广泛的研究。例如,MD5(128 位哈希值)在大约 2^21 次哈希之后,抗碰撞能力就会崩溃。对于 SHA1(160 位哈希值),大约在 2^61 次哈希后开始崩溃。 + +对于 SHA256 的抗碰撞能力的剖析,目前还没有一个很好的估计。这个事实并不奇怪。SHA256 有 2^256 个不同的哈希值范围,这个数字的十进制表示法有 78 位之多! 那么,SHA256 哈希会不会发生碰撞呢?当然可能,但可能性极小。 + +在下面的命令行示例中,有两个输入文件被用作位串源:`hashIn1.txt` 和 `hashIn2.txt`。第一个文件包含 `abc`,第二个文件包含 `1a2b3c`。 + +为了便于阅读,这些文件包含的是文本,但也可以使用二进制文件代替。 + +在命令行(百分号 `%` 是提示符)使用 Linux `sha256sum` 实用程序对这两个文件进行处理产生以下哈希值(十六进制): + +``` +% sha256sum hashIn1.txt +9e83e05bbf9b5db17ac0deec3b7ce6cba983f6dc50531c7a919f28d5fb3696c3 hashIn1.txt + +% sha256sum hashIn2.txt +3eaac518777682bf4e8840dd012c0b104c2e16009083877675f00e995906ed13 hashIn2.txt +``` + +OpenSSL 哈希对应的结果与预期相同: + +``` +% openssl dgst -sha256 hashIn1.txt +SHA256(hashIn1.txt)= 9e83e05bbf9b5db17ac0deec3b7ce6cba983f6dc50531c7a919f28d5fb3696c3 + +% openssl dgst -sha256 hashIn2.txt +SHA256(hashIn2.txt)= 3eaac518777682bf4e8840dd012c0b104c2e16009083877675f00e995906ed13 +``` + +这种对密码学哈希函数的研究,为我们仔细研究数字签名及其与密钥对的关系奠定了基础。 + +### 数字签名 + +顾名思义,数字签字digital signature可以附在文件或其他一些电子工件artifact(如程序)上,以证明其真实性。因此,这种签名类似于纸质文件上的手写签名。验证数字签名就是要确认两件事:第一,被担保的工件在签名被附上后没有改变,因为它部分是基于文件的加密学哈希值。第二,签名属于一个人(例如 Alice),只有她才能获得一对密钥中的私钥。顺便说一下,对代码(源码或编译后的代码)进行数字签名已经成为程序员的普遍做法。 + +让我们来了解一下数字签名是如何创建的。如前所述,没有公钥和私钥对就没有数字签名。当使用 OpenSSL 创建这些密钥时,有两个独立的命令:一个是创建私钥,另一个是从私钥中提取匹配的公钥。这些密钥对用 base64 编码,在这个过程中可以指定它们的大小。 + +私钥private key由数值组成,其中两个数值(一个模数modulus和一个指数exponent)组成了公钥。虽然私钥文件包含了公钥public key,但提取出来的公钥并**不会**透露相应私钥的值。 + +因此,生成的带有私钥的文件包含了完整的密钥对。将公钥提取到自己的文件中是很实用的,因为这两把钥匙有不同的用途,而这种提取方式也将私钥可能被意外公开的危险降到最低。 + +接下来,这对密钥的私钥被用来生成目标工件(如电子邮件)的哈希值,从而创建签名。在另一端,接收者的系统使用这对密钥的公钥来验证附在工件上的签名。 + +现在举个例子。首先,用 OpenSSL 生成一个 2048 位的 RSA 密钥对: + +``` +openssl genpkey -out privkey.pem -algorithm rsa 2048 +``` + +在这个例子中,我们可以舍去 `-algorithm rsa` 标志,因为 `genpkey` 默认为 RSA 类型。文件的名称(`privkey.pem`)是任意的,但是隐私增强邮件Privacy Enhanced Mail(PEM)扩展名 `.pem` 是默认 PEM 格式的惯用扩展名。(如果需要的话,OpenSSL 有命令可以在各种格式之间进行转换。)如果需要更大的密钥大小(例如 4096),那么最后一个参数 `2048` 可以改成 `4096`。这些大小总是二的幂。 + +下面是产生的 `privkey.pem` 文件的一个片断,它是 base64 编码的: + +``` +-----BEGIN PRIVATE KEY----- +MIICdgIBADANBgkqhkiG9w0BAQEFAASCAmAwggJcAgEAAoGBANnlAh4jSKgcNj/Z +JF4J4WdhkljP2R+TXVGuKVRtPkGAiLWE4BDbgsyKVLfs2EdjKL1U+/qtfhYsqhkK +... +-----END PRIVATE KEY----- +``` + +接下来的命令就会从私钥中提取出这对密钥的公钥: + +``` +openssl rsa -in privkey.pem -outform PEM -pubout -out pubkey.pem +``` + +由此产生的 `pubkey.pem` 文件很小,可以在这里完整地显示出来: + +``` +-----BEGIN PUBLIC KEY----- +MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDZ5QIeI0ioHDY/2SReCeFnYZJY +z9kfk11RrilUbT5BgIi1hOAQ24LMilS37NhHYyi9VPv6rX4WLKoZCmkeYaWk/TR5 +4nbH1E/AkniwRoXpeh5VncwWMuMsL5qPWGY8fuuTE27GhwqBiKQGBOmU+MYlZonO +O0xnAKpAvysMy7G7qQIDAQAB +-----END PUBLIC KEY----- +``` + +现在,有了密钥对,数字签名就很容易了 —— 在本例中,源文件 `client.c` 是要签名的工件: + +``` +openssl dgst -sha256 -sign privkey.pem -out sign.sha256 client.c +``` + +`client.c` 源文件的摘要是 SHA256,私钥在前面创建的 `privkey.pem` 文件中。由此产生的二进制签名文件是 `sign.sha256`,这是一个任意的名字。要得到这个文件的可读版本(比如 base64),后续命令是: + +``` +openssl enc -base64 -in sign.sha256 -out sign.sha256.base64 +``` + +文件 `sign.sha256.base64` 现在包含如下内容: + +``` +h+e+3UPx++KKSlWKIk34fQ1g91XKHOGFRmjc0ZHPEyyjP6/lJ05SfjpAJxAPm075 +VNfFwysvqRGmL0jkp/TTdwnDTwt756Ej4X3OwAVeYM7i5DCcjVsQf5+h7JycHKlM +o/Jd3kUIWUkZ8+Lk0ZwzNzhKJu6LM5KWtL+MhJ2DpVc= +``` + +或者,可执行文件 `client` 也可以被签名,由此产生的 base64 编码签名将如预期的不同: + +``` +VMVImPgVLKHxVBapJ8DgLNJUKb98GbXgehRPD8o0ImADhLqlEKVy0HKRm/51m9IX +xRAN7DoL4Q3uuVmWWi749Vampong/uT5qjgVNTnRt9jON112fzchgEoMb8CHNsCT +XIMdyaPtnJZdLALw6rwMM55MoLamSc6M/MV1OrJnk/g= +``` + +这一过程的最后一步是用公钥验证数字签名。作为验证的一个重要步骤,应重新计算用于签署工件(在本例中,是可执行的 `client` 程序)的哈希值,因为验证过程应表明工件在签署后是否发生了变化。 + +有两个 OpenSSL 命令用于这个目的。第一条命令是对 base64 签名进行解码。 + +``` +openssl enc -base64 -d -in sign.sha256.base64 -out sign.sha256 +``` + +第二条是核实签名: + +``` +openssl dgst -sha256 -verify pubkey.pem -signature sign.sha256 client +``` + +第二条命令的输出,应该是这样的: + +``` +Verified OK +``` + +为了了解验证失败时的情况,一个简短但有用的练习是将最后一个 OpenSSL 命令中的可执行的 `client` 文件替换为源文件 `client.c`,然后尝试验证。另一个练习是改变 `client` 程序,无论多么轻微,然后再试一次。 + +### 数字证书 + +数字证书digital certificate汇集了到目前为止所分析的各个部分:哈希值、密钥对、数字签名和加密/解密。生产级证书的第一步是创建一个证书签名请求certificate signing request(CSR),然后将其发送给证书颁发机构certificate authority(CA)。在 OpenSSL 的例子中,要做到这一点,请运行: + +``` +openssl req -out myserver.csr -new -newkey rsa:4096 -nodes -keyout myserverkey.pem +``` + +这个例子生成了一个 CSR 文档,并将该文档存储在文件 `myserver.csr`(base64 文本)中。这里的目的是:CSR 文档要求 CA 保证与指定域名相关联的身份,域名也就是 CA 所说的通用名common name(CN)。 + +尽管可以使用现有的密钥对,但这个命令也会生成一个新的密钥对。请注意,在诸如 `myserver.csr` 和 `myserverkey.pem` 等名称中使用 `server` 暗示了数字证书的典型用途:作为与 www.google.com 等域名相关的 Web 服务器的身份担保。 + +然而,无论数字证书如何使用,同样使用这个命令都会创建一个 CSR。它还会启动一个问题/回答的交互式会话,提示有关域名的相关信息,以便与请求者的数字证书相连接。这个交互式会话可以通过在命令中提供基本的信息,用反斜杠来续行一步完成。`-subj` 标志提供了所需的信息。 + +``` +% openssl req -new \ +-newkey rsa:2048 -nodes -keyout privkeyDC.pem \ +-out myserver.csr \ +-subj "/C=US/ST=Illinois/L=Chicago/O=Faulty Consulting/OU=IT/CN=myserver.com" +``` + +产生的 CSR 文件在发送给 CA 之前可以进行检查和验证。这个过程可以创建具有所需格式(如 X509)、签名、有效期等的数字证书。 + +``` +openssl req -text -in myserver.csr -noout -verify +``` + +这是输出的一个片断: + +``` +verify OK +Certificate Request: +Data: +Version: 0 (0x0) +Subject: C=US, ST=Illinois, L=Chicago, O=Faulty Consulting, OU=IT, CN=myserver.com +Subject Public Key Info: +Public Key Algorithm: rsaEncryption +Public-Key: (2048 bit) +Modulus: +00:ba:36:fb:57:17:65:bc:40:30:96:1b:6e:de:73: +… +Exponent: 65537 (0x10001) +Attributes: +a0:00 +Signature Algorithm: sha256WithRSAEncryption +… +``` + +### 自签证书 + +在开发 HTTPS 网站的过程中,手头有一个不用经过 CA 流程的数字证书是很方便的。在 HTTPS 握手的认证阶段,自签证书self-signed certificate就能满足要求,尽管任何现代浏览器都会警告说这样的证书毫无价值。继续这个例子,自签证书的 OpenSSL 命令(有效期为一年,使用 RSA 公钥)如下: + +``` +openssl req -x509 -sha256 -nodes -days 365 -newkey rsa:4096 -keyout myserver.pem -out myserver.crt +``` + +下面的 OpenSSL 命令呈现了生成的证书的可读版本: + +``` +openssl x509 -in myserver.crt -text -noout +``` + +这是自签证书的部分输出: + +``` +Certificate: +Data: +Version: 3 (0x2) +Serial Number: 13951598013130016090 (0xc19e087965a9055a) +Signature Algorithm: sha256WithRSAEncryption +Issuer: C=US, ST=Illinois, L=Chicago, O=Faulty Consulting, OU=IT, CN=myserver.com +Validity +Not Before: Apr 11 17:22:18 2019 GMT +Not After : Apr 10 17:22:18 2020 GMT +Subject: C=US, ST=Illinois, L=Chicago, O=Faulty Consulting, OU=IT, CN=myserver.com +Subject Public Key Info: +Public Key Algorithm: rsaEncryption +Public-Key: (4096 bit) +Modulus: +00:ba:36:fb:57:17:65:bc:40:30:96:1b:6e:de:73: +... +Exponent: 65537 (0x10001) +X509v3 extensions: +X509v3 Subject Key Identifier: +3A:32:EF:3D:EB:DF:65:E5:A8:96:D7:D7:16:2C:1B:29:AF:46:C4:91 +X509v3 Authority Key Identifier: +keyid:3A:32:EF:3D:EB:DF:65:E5:A8:96:D7:D7:16:2C:1B:29:AF:46:C4:91 + + X509v3 Basic Constraints: + CA:TRUE +Signature Algorithm: sha256WithRSAEncryption + 3a:eb:8d:09:53:3b:5c:2e:48:ed:14:ce:f9:20:01:4e:90:c9: + ... +``` + +如前所述,RSA 私钥包含的值是用来生成公钥的。但是,给定的公钥**不会**泄露匹配的私钥。关于底层数学理论的介绍,见 。 + +数字证书与用于生成该证书的密钥对之间存在着重要的对应关系,即使证书只是自签的: + +* 数字证书包含构成公钥的指数和模数值。这些值是最初生成的 PEM 文件中密钥对的一部分,在本例中,是文件 `myserver.pem`。 +* 指数exponent几乎总是 65,537(如本例中),所以可以忽略。 +* 密钥对的模数modulus应该与数字证书的模数相匹配。 + +模数是一个很大的值,为了便于阅读,可以进行哈希处理。下面是两个 OpenSSL 命令,它们检查相同的模数,从而确认数字证书是基于 PEM 文件中的密钥对。 + +``` +% openssl x509 -noout -modulus -in myserver.crt | openssl sha1 ## 证书中的模数 +(stdin)= 364d21d5e53a59d482395b1885aa2c3a5d2e3769 + +% openssl rsa -noout -modulus -in myserver.pem | openssl sha1 ## 密钥中的模数 +(stdin)= 364d21d5e53a59d482395b1885aa2c3a5d2e3769 +``` + +所产生的哈希值匹配,从而确认数字证书是基于指定的密钥对。 + +### 回到密钥分发问题上 + +让我们回到第一部分末尾提出的一个问题:`client` 程序和 Google Web 服务器之间的 TLS 握手。握手协议有很多种,即使是用在 `client` 例子中的 Diffie-Hellman 版本也有不同的方式。尽管如此,`client` 例子遵循了一个共同的模式。 + +首先,在 TLS 握手过程中,`client` 程序和 Web 服务器就加密套件cipher suite达成一致,其中包括要使用的算法。在本例中,该套件是 `ECDHE-RSA-AES128-GCM-SHA256`。 + +现在值得关注的两个要素是 RSA 密钥对算法和 AES128 块密码,用于在握手成功的情况下对消息进行加密和解密。关于加密/解密,这个过程有两种流派:对称symmetric非对称asymmetric。在对称流派中,加密和解密使用的是*相同的*密钥,这首先就引出了密钥分发问题key distribution problem。如何将密钥安全地分发给双方?在非对称流派中,一个密钥用于加密(在这种情况下,是 RSA 公钥),但另一个密钥用于解密(在这种情况下,是来自同一对密钥的 RSA 私钥)。 + +`client` 程序拥有来认证证书的 Google Web 服务器的公钥,而 Web 服务器拥有来自同一对密钥的私钥。因此,`client` 程序可以向 Web 服务器发送加密信息,而 Web 服务器可以单独对该通信进行解密。 + +在 TLS 的情况下,对称方式有两个显著的优势: + +* 在 `client` 程序与 Google Web 服务器之间的互动中,认证是单向的。Google Web 服务器向 `client` 程序发送三张证书,但 `client` 程序并没有向 Web 服务器发送证书,因此,Web 服务器没有来自客户端的公钥,无法加密发给客户端的消息。 +* 使用 AES128 的对称加密/解密比使用 RSA 密钥的非对称加密/解密快了**近千倍**。 + +TLS 握手将两种加密/解密方式巧妙地结合在一起。在握手过程中,`client` 程序会生成随机位,即所谓的预主密pre-master secret(PMS)。然后,`client` 程序用服务器的公钥对 PMS 进行加密,并将加密后的 PMS 发送给服务器,服务器再用 RSA 密钥对的私钥对 PMS 信息进行解密: + +``` + +-------------------+ encrypted PMS +--------------------+ +client PMS--->|server’s public key|--------------->|server’s private key|--->server PMS + +-------------------+ +--------------------+ +``` + +在这个过程结束时,`client` 程序和 Google Web 服务器现在拥有相同的 PMS 位。每一方都使用这些位生成一个主密码master secret,并立即生成一个称为会话密钥session key的对称加密/解密密钥。现在有两个不同但等价的会话密钥,连接的每一方都有一个。在 `client` 的例子中,会话密钥是 AES128 类的。一旦在 `client` 程序和 Google Web 服务器两边生成了会话密钥,每一边的会话密钥就会对双方的对话进行保密。如果任何一方(例如,`client` 程序)或另一方(在这种情况下,Google Web 服务器)要求重新开始握手,握手协议(如 Diffie-Hellman)允许整个 PMS 过程重复进行。 + +### 总结 + +在命令行上说明的 OpenSSL 操作也可以通过底层库的 API 完成。这两篇文章重点使用了这个实用程序,以保持例子的简短,并专注于加密主题。如果你对安全问题感兴趣,OpenSSL 是一个很好的开始地方,并值得深入研究。 + + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/6/cryptography-basics-openssl-part-2 + +作者:[Marty Kalin][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/mkalindepauledu +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/rh_003784_02_os.comcareers_os_rh2x.png?itok=jbRfXinl (A person working.) +[2]: https://linux.cn/article-11810-1.html +[3]: https://en.wikipedia.org/wiki/HMAC +[4]: https://en.wikipedia.org/wiki/Length_extension_attack +[5]: https://en.wikipedia.org/wiki/Birthday_problem +[6]: http://www.google.com diff --git a/sources/tech/20200107 Bash Script to Check How Long the High CPU-Memory Consumption Processes Runs on Linux.md b/published/202008/20200107 Bash Script to Check How Long the High CPU-Memory Consumption Processes Runs on Linux.md similarity index 60% rename from sources/tech/20200107 Bash Script to Check How Long the High CPU-Memory Consumption Processes Runs on Linux.md rename to published/202008/20200107 Bash Script to Check How Long the High CPU-Memory Consumption Processes Runs on Linux.md index fc3818c344..59ebd1255b 100644 --- a/sources/tech/20200107 Bash Script to Check How Long the High CPU-Memory Consumption Processes Runs on Linux.md +++ b/published/202008/20200107 Bash Script to Check How Long the High CPU-Memory Consumption Processes Runs on Linux.md @@ -1,42 +1,38 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: translator: (geekpi) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12477-1.html) [#]: subject: (Bash Script to Check How Long the High CPU/Memory Consumption Processes Runs on Linux) [#]: via: (https://www.2daygeek.com/bash-script-to-check-how-long-the-high-cpu-memory-consumption-processes-runs-on-linux/) [#]: author: (Magesh Maruthamuthu https://www.2daygeek.com/author/magesh/) -Bash Script to Check How Long the High CPU/Memory Consumption Processes Runs on Linux +实用脚本:检查高 CPU / 内存消耗进程 ====== -In the past, we have written three different articles to identify this using Linux commands. +![](https://img.linux.net.cn/data/attachment/album/202008/01/205420jllu1nsngu9qszu5.jpg) -You can access them immediately by going to the relevant URLs below. +过去,我们写了三篇不同的文章来使用 Linux 命令来识别这些进程。 - * **[How to Find High CPU Consumption Processes in Linux][1]** - * **[How to Find Out Top Memory Consuming Processes in Linux][2]** - * **[Five Ways to Check How Long a Process Has Been Running in Linux][3]** +你可以通过下面相关的 URL 立即访问: + * [如何在 Linux 中找出 CPU 占用高的进程][1] + * [如何在 Linux 中找出内存消耗最大的进程][2] + * [在 Linux 中如何查找一个命令或进程的执行时间][3] +本教程中包含两个脚本,它们可以帮助你确定 Linux 上高 CPU/内存消耗进程的运行时间。 -Two scripts are included in this tutorial, which helps you to identify how long the high CPU/memory consumption processes are running on Linux. +该脚本将显示进程 ID、进程的所有者、进程的名称以及进程的运行时间。这将帮助你确定哪些(必须事先完成)作业正在超时运行。这可以使用 `ps` 命令来实现。 -The script will show you the process ID, the owner of the process, the name of the process and how long the processes are running. +### 什么是 ps 命令 -This will help you identify which jobs are running overtime (which must be completed beforehand). +`ps` 是进程状态processes status,它显示有关系统上活动/正在运行的进程的信息。 -This can be achieved using the ps command. +它提供了当前进程的快照以及详细信息,例如用户名、用户 ID、CPU 使用率、内存使用率、进程开始日期和时间等。 -### What’s ps Command +#### 1)检查高 CPU 消耗进程在 Linux 上运行了多长时间的 Bash 脚本 -ps stands for processes status, it display the information about the active/running processes on the system. - -It provides a snapshot of the current processes along with detailed information like username, user id, cpu usage, memory usage, process start date and time command name etc. - -### 1) Bash Script to Check How Long the High CPU Consumption Processes Runs on Linux - -This script will help you to identify how long the high CPU consumption processes has been running on Linux. +该脚本将帮助你确定高 CPU 消耗进程在 Linux 上运行了多长时间。 ``` # vi /opt/scripts/long-running-cpu-proc.sh @@ -56,13 +52,13 @@ done | column -t echo "--------------------------------------------------" ``` -Set an executable **[Linux file permission][4]** to **“long-running-cpu-proc.sh”** file. +给 `long-running-cpu-proc.sh` 设置可执行的 [Linux 文件权限][4]。 ``` # chmod +x /opt/scripts/long-running-cpu-proc.sh ``` -When you run this script, you will get an output like the one below. +运行此脚本时,你将获得类似以下的输出: ``` # sh /opt/scripts/long-running-cpu-proc.sh @@ -82,9 +78,9 @@ daygeek 6301 Web 57:40 ---------------------------------------------------- ``` -### 2) Bash Script to Check How Long the High Memory Consumption Processes Runs on Linux +#### 2)检查高内存消耗进程在 Linux 上运行了多长时间的 Bash 脚本 -This script will help you to identify how long the top memory consumption processes has been running on Linux. +该脚本将帮助你确定最大的内存消耗进程在 Linux 上运行了多长时间。 ``` # sh /opt/scripts/long-running-memory-proc.sh @@ -104,13 +100,13 @@ done | column -t echo "--------------------------------------------------" ``` -Set an executable Linux file permission to **“long-running-memory-proc.sh”** file. +给 `long-running-memory-proc.sh` 设置可执行的 Linux 文件权限。 ``` # chmod +x /opt/scripts/long-running-memory-proc.sh ``` -When you run this script, you will get an output like the one below. +运行此脚本时,你将获得类似以下的输出: ``` # sh /opt/scripts/long-running-memory-proc.sh @@ -136,14 +132,14 @@ via: https://www.2daygeek.com/bash-script-to-check-how-long-the-high-cpu-memory- 作者:[Magesh Maruthamuthu][a] 选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) +译者:[geekpi](https://github.com/geekpi) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 [a]: https://www.2daygeek.com/author/magesh/ [b]: https://github.com/lujun9972 -[1]: https://www.2daygeek.com/how-to-find-high-cpu-consumption-processes-in-linux/ -[2]: https://www.2daygeek.com/linux-find-top-memory-consuming-processes/ -[3]: https://www.2daygeek.com/how-to-check-how-long-a-process-has-been-running-in-linux/ +[1]: https://linux.cn/article-11678-1.html +[2]: https://linux.cn/article-11542-1.html +[3]: https://linux.cn/article-10261-1.html [4]: https://www.2daygeek.com/understanding-linux-file-permissions/ diff --git a/published/202008/20200318 Share data between C and Python with this messaging library.md b/published/202008/20200318 Share data between C and Python with this messaging library.md new file mode 100644 index 0000000000..83c68e0bdb --- /dev/null +++ b/published/202008/20200318 Share data between C and Python with this messaging library.md @@ -0,0 +1,627 @@ +[#]: collector: (lujun9972) +[#]: translator: (silentdawn-zz) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12499-1.html) +[#]: subject: (Share data between C and Python with this messaging library) +[#]: via: (https://opensource.com/article/20/3/zeromq-c-python) +[#]: author: (Cristiano L. Fontana https://opensource.com/users/cristianofontana) + +使用 ZeroMQ 消息库在 C 和 Python 间共享数据 +====== + +> ZeroMQ 是一个快速灵活的消息库,用于数据收集和不同编程语言间的数据共享。 + +![](https://img.linux.net.cn/data/attachment/album/202008/08/202106uale11l1qf11slzw.jpg) + +作为软件工程师,我有多次在要求完成指定任务时感到浑身一冷的经历。其中有一次,我必须在一些新的硬件基础设施和云基础设施之间写一个接口,这些硬件需要 C 语言,而云基础设施主要是用 Python。 + +实现的方式之一是 [用 C 写扩展模块][2],Python 支持 C 扩展的调用。快速浏览文档后发现,这需要编写大量的 C 代码。这样做的话,在有些情况下效果还不错,但不是我喜欢的方式。另一种方式就是将两个任务放在不同的进程中,并使用 [ZeroMQ 消息库][3] 在两者之间交换消息。 + +在发现 ZeroMQ 之前,遇到这种类型的情况时,我选择了编写扩展的方式。这种方式不算太差,但非常费时费力。如今,为了避免那些问题,我将一个系统细分为独立的进程,通过 [通信套接字][4] 发送消息来交换信息。这样,不同的编程语言可以共存,每个进程也变简单了,同时也容易调试。 + +ZeroMQ 提供了一个更简单的过程: + +1. 编写一小段 C 代码,从硬件读取数据,然后把发现的东西作为消息发送出去。 +2. 使用 Python 编写接口,实现新旧基础设施之间的对接。 + +[Pieter Hintjens][5] 是 ZeroMQ 项目发起者之一,他是个拥有 [有趣视角和作品][6] 的非凡人物。 + +### 准备 + +本教程中,需要: + +* 一个 C 编译器(例如 [GCC][7] 或 [Clang][8]) +* [libzmq 库][9] +* [Python 3][10] +* [ZeroMQ 的 Python 封装][11] + +Fedora 系统上的安装方法: + +``` +$ dnf install clang zeromq zeromq-devel python3 python3-zmq +``` + +Debian 和 Ubuntu 系统上的安装方法: + +``` +$ apt-get install clang libzmq5 libzmq3-dev python3 python3-zmq +``` + +如果有问题,参考对应项目的安装指南(上面附有链接)。 + +### 编写硬件接口库 + +因为这里针对的是个设想的场景,本教程虚构了包含两个函数的操作库: + +* `fancyhw_init()` 用来初始化(设想的)硬件 +* `fancyhw_read_val()` 用于返回从硬件读取的数据 + +将库的完整代码保存到文件 `libfancyhw.h` 中: + +``` +#ifndef LIBFANCYHW_H +#define LIBFANCYHW_H + +#include +#include + +// This is the fictitious hardware interfacing library + +void fancyhw_init(unsigned int init_param) +{ + srand(init_param); +} + +int16_t fancyhw_read_val(void) +{ + return (int16_t)rand(); +} + +#endif +``` + +这个库可以模拟你要在不同语言实现的组件间交换的数据,中间有个随机数发生器。 + +### 设计 C 接口 + +下面从包含管理数据传输的库开始,逐步实现 C 接口。 + +#### 需要的库 + +开始先加载必要的库(每个库的作用见代码注释): + +``` +// For printf() +#include +// For EXIT_* +#include +// For memcpy() +#include +// For sleep() +#include + +#include + +#include "libfancyhw.h" +``` + +#### 必要的参数 + +定义 `main` 函数和后续过程中必要的参数: + +``` +int main(void) +{ +    const unsigned int INIT_PARAM = 12345; +    const unsigned int REPETITIONS = 10; +    const unsigned int PACKET_SIZE = 16; +    const char *TOPIC = "fancyhw_data"; + +    ... +``` + +#### 初始化 + +所有的库都需要初始化。虚构的那个只需要一个参数: + +``` +fancyhw_init(INIT_PARAM); +``` + +ZeroMQ 库需要实打实的初始化。首先,定义对象 `context`,它是用来管理全部的套接字的: + +``` +void *context = zmq_ctx_new(); + +if (!context) +{ + printf("ERROR: ZeroMQ error occurred during zmq_ctx_new(): %s\n", zmq_strerror(errno)); + + return EXIT_FAILURE; +} +``` + +之后定义用来发送数据的套接字。ZeroMQ 支持若干种套接字,各有其用。使用 `publish` 套接字(也叫 `PUB` 套接字),可以复制消息并分发到多个接收端。这使得你可以让多个接收端接收同一个消息。没有接收者的消息将被丢弃(即不会入消息队列)。用法如下: + +``` +void *data_socket = zmq_socket(context, ZMQ_PUB); +``` + +套接字需要绑定到一个具体的地址,这样客户端就知道要连接哪里了。本例中,使用了 [TCP 传输层][15](当然也有 [其它选项][16],但 TCP 是不错的默认选择): + +``` +const int rb = zmq_bind(data_socket, "tcp://*:5555"); + +if (rb != 0) +{ + printf("ERROR: ZeroMQ error occurred during zmq_ctx_new(): %s\n", zmq_strerror(errno)); + + return EXIT_FAILURE; +} +``` + +下一步, 计算一些后续要用到的值。 注意下面代码中的 `TOPIC`,因为 `PUB` 套接字发送的消息需要绑定一个主题。主题用于供接收者过滤消息: + +``` +const size_t topic_size = strlen(TOPIC); +const size_t envelope_size = topic_size + 1 + PACKET_SIZE * sizeof(int16_t); + +printf("Topic: %s; topic size: %zu; Envelope size: %zu\n", TOPIC, topic_size, envelope_size); +``` + +#### 发送消息 + +启动一个发送消息的循环,循环 `REPETITIONS` 次: + +``` +for (unsigned int i = 0; i < REPETITIONS; i++) +{ + ... +``` + +发送消息前,先填充一个长度为 `PACKET_SIZE` 的缓冲区。本库提供的是 16 个位的有符号整数。因为 C 语言中 `int` 类型占用空间大小与平台相关,不是确定的值,所以要使用指定宽度的 `int` 变量: + +``` +int16_t buffer[PACKET_SIZE]; + +for (unsigned int j = 0; j < PACKET_SIZE; j++) +{ + buffer[j] = fancyhw_read_val(); +} + +printf("Read %u data values\n", PACKET_SIZE); +``` + +消息的准备和发送的第一步是创建 ZeroMQ 消息,为消息分配必要的内存空间。空白的消息是用于封装要发送的数据的: + +``` +zmq_msg_t envelope; + +const int rmi = zmq_msg_init_size(&envelope, envelope_size); +if (rmi != 0) +{ + printf("ERROR: ZeroMQ error occurred during zmq_msg_init_size(): %s\n", zmq_strerror(errno)); + + zmq_msg_close(&envelope); + + break; +} +``` + +现在内存空间已分配,数据保存在 ZeroMQ 消息 “信封”中。函数 `zmq_msg_data()` 返回一个指向封装数据缓存区顶端的指针。第一部分是主题,之后是一个空格,最后是二进制数。主题和二进制数据之间的分隔符采用空格字符。需要遍历缓存区的话,使用类型转换和 [指针算法][18]。(感谢 C 语言,让事情变得直截了当。)做法如下: + +``` +memcpy(zmq_msg_data(&envelope), TOPIC, topic_size); +memcpy((void*)((char*)zmq_msg_data(&envelope) + topic_size), " ", 1); +memcpy((void*)((char*)zmq_msg_data(&envelope) + 1 + topic_size), buffer, PACKET_SIZE * sizeof(int16_t)) +``` + +通过 `data_socket` 发送消息: + +``` +const size_t rs = zmq_msg_send(&envelope, data_socket, 0); +if (rs != envelope_size) +{ + printf("ERROR: ZeroMQ error occurred during zmq_msg_send(): %s\n", zmq_strerror(errno)); + + zmq_msg_close(&envelope); + + break; +} +``` + +使用数据之前要先解除封装: + +``` +zmq_msg_close(&envelope); + +printf("Message sent; i: %u, topic: %s\n", i, TOPIC); +``` + +#### 清理 + +C 语言不提供 [垃圾收集][20] 功能,用完之后记得要自己扫尾。发送消息之后结束程序之前,需要运行扫尾代码,释放分配的内存: + +``` +const int rc = zmq_close(data_socket); + +if (rc != 0) +{ + printf("ERROR: ZeroMQ error occurred during zmq_close(): %s\n", zmq_strerror(errno)); + + return EXIT_FAILURE; +} + +const int rd = zmq_ctx_destroy(context); + +if (rd != 0) +{ + printf("Error occurred during zmq_ctx_destroy(): %s\n", zmq_strerror(errno)); + + return EXIT_FAILURE; +} + +return EXIT_SUCCESS; +``` + +#### 完整 C 代码 + +保存下面完整的接口代码到本地名为 `hw_interface.c` 的文件: + +``` +// For printf() +#include +// For EXIT_* +#include +// For memcpy() +#include +// For sleep() +#include + +#include + +#include "libfancyhw.h" + +int main(void) +{ + const unsigned int INIT_PARAM = 12345; + const unsigned int REPETITIONS = 10; + const unsigned int PACKET_SIZE = 16; + const char *TOPIC = "fancyhw_data"; + + fancyhw_init(INIT_PARAM); + + void *context = zmq_ctx_new(); + + if (!context) + { + printf("ERROR: ZeroMQ error occurred during zmq_ctx_new(): %s\n", zmq_strerror(errno)); + + return EXIT_FAILURE; + } + + void *data_socket = zmq_socket(context, ZMQ_PUB); + + const int rb = zmq_bind(data_socket, "tcp://*:5555"); + + if (rb != 0) + { + printf("ERROR: ZeroMQ error occurred during zmq_ctx_new(): %s\n", zmq_strerror(errno)); + + return EXIT_FAILURE; + } + + const size_t topic_size = strlen(TOPIC); + const size_t envelope_size = topic_size + 1 + PACKET_SIZE * sizeof(int16_t); + + printf("Topic: %s; topic size: %zu; Envelope size: %zu\n", TOPIC, topic_size, envelope_size); + + for (unsigned int i = 0; i < REPETITIONS; i++) + { + int16_t buffer[PACKET_SIZE]; + + for (unsigned int j = 0; j < PACKET_SIZE; j++) + { + buffer[j] = fancyhw_read_val(); + } + + printf("Read %u data values\n", PACKET_SIZE); + + zmq_msg_t envelope; + + const int rmi = zmq_msg_init_size(&envelope, envelope_size); + if (rmi != 0) + { + printf("ERROR: ZeroMQ error occurred during zmq_msg_init_size(): %s\n", zmq_strerror(errno)); + + zmq_msg_close(&envelope); + + break; + } + + memcpy(zmq_msg_data(&envelope), TOPIC, topic_size); + + memcpy((void*)((char*)zmq_msg_data(&envelope) + topic_size), " ", 1); + + memcpy((void*)((char*)zmq_msg_data(&envelope) + 1 + topic_size), buffer, PACKET_SIZE * sizeof(int16_t)); + + const size_t rs = zmq_msg_send(&envelope, data_socket, 0); + if (rs != envelope_size) + { + printf("ERROR: ZeroMQ error occurred during zmq_msg_send(): %s\n", zmq_strerror(errno)); + + zmq_msg_close(&envelope); + + break; + } + + zmq_msg_close(&envelope); + + printf("Message sent; i: %u, topic: %s\n", i, TOPIC); + + sleep(1); + } + + const int rc = zmq_close(data_socket); + + if (rc != 0) + { + printf("ERROR: ZeroMQ error occurred during zmq_close(): %s\n", zmq_strerror(errno)); + + return EXIT_FAILURE; + } + + const int rd = zmq_ctx_destroy(context); + + if (rd != 0) + { + printf("Error occurred during zmq_ctx_destroy(): %s\n", zmq_strerror(errno)); + + return EXIT_FAILURE; + } + + return EXIT_SUCCESS; +} +``` + +用如下命令编译: + +``` +$ clang -std=c99 -I. hw_interface.c -lzmq -o hw_interface +``` + +如果没有编译错误,你就可以运行这个接口了。贴心的是,ZeroMQ `PUB` 套接字可以在没有任何应用发送或接受数据的状态下运行,这简化了使用复杂度,因为这样不限制进程启动的次序。 + +运行该接口: + +``` +$ ./hw_interface +Topic: fancyhw_data; topic size: 12; Envelope size: 45 +Read 16 data values +Message sent; i: 0, topic: fancyhw_data +Read 16 data values +Message sent; i: 1, topic: fancyhw_data +Read 16 data values +... +... +``` + +输出显示数据已经通过 ZeroMQ 完成发送,现在要做的是让一个程序去读数据。 + +### 编写 Python 数据处理器 + +现在已经准备好从 C 程序向 Python 应用传送数据了。 + +#### 库 + +需要两个库帮助实现数据传输。首先是 ZeroMQ 的 Python 封装: + +``` +$ python3 -m pip install zmq +``` + +另一个就是 [struct 库][21],用于解码二进制数据。这个库是 Python 标准库的一部分,所以不需要使用 `pip` 命令安装。 + +Python 程序的第一部分是导入这些库: + +``` +import zmq +import struct +``` + +#### 重要参数 + +使用 ZeroMQ 时,只能向常量 `TOPIC` 定义相同的接收端发送消息: + +``` +topic = "fancyhw_data".encode('ascii') + +print("Reading messages with topic: {}".format(topic)) +``` + +#### 初始化 + +下一步,初始化上下文和套接字。使用 `subscribe` 套接字(也称为 `SUB` 套接字),它是 `PUB` 套接字的天生伴侣。这个套接字发送时也需要匹配主题。 + +``` +with zmq.Context() as context: +    socket = context.socket(zmq.SUB) + +    socket.connect("tcp://127.0.0.1:5555") +    socket.setsockopt(zmq.SUBSCRIBE, topic) + +    i = 0 + +    ... +``` + +#### 接收消息 + +启动一个无限循环,等待接收发送到 `SUB` 套接字的新消息。这个循环会在你按下 `Ctrl+C` 组合键或者内部发生错误时终止: + +``` +    try: +        while True: + +            ... # we will fill this in next + +    except KeyboardInterrupt: +        socket.close() +    except Exception as error: +        print("ERROR: {}".format(error)) +        socket.close() +``` + +这个循环等待 `recv()` 方法获取的新消息,然后将接收到的内容从第一个空格字符处分割开,从而得到主题: + + +``` +binary_topic, data_buffer = socket.recv().split(b' ', 1) +``` + +#### 解码消息 + +Python 此时尚不知道主题是个字符串,使用标准 ASCII 编解码器进行解码: + +``` +topic = binary_topic.decode(encoding = 'ascii') + +print("Message {:d}:".format(i)) +print("\ttopic: '{}'".format(topic)) +``` + +下一步就是使用 `struct` 库读取二进制数据,它可以将二进制数据段转换为明确的数值。首先,计算数据包中数值的组数。本例中使用的 16 个位的有符号整数对应的是 `struct` [格式字符][22] 中的 `h`: + +``` +packet_size = len(data_buffer) // struct.calcsize("h") + +print("\tpacket size: {:d}".format(packet_size)) +``` + +知道数据包中有多少组数据后,就可以通过构建一个包含数据组数和数据类型的字符串,来定义格式了(比如“`16h`”): + +``` +struct_format = "{:d}h".format(packet_size) +``` + +将二进制数据串转换为可直接打印的一系列数字: + +``` +data = struct.unpack(struct_format, data_buffer) + +print("\tdata: {}".format(data)) +``` + +#### 完整 Python 代码 + +下面是 Python 实现的完整的接收端: + +``` +#! /usr/bin/env python3 + +import zmq +import struct + +topic = "fancyhw_data".encode('ascii') + +print("Reading messages with topic: {}".format(topic)) + +with zmq.Context() as context: + socket = context.socket(zmq.SUB) + + socket.connect("tcp://127.0.0.1:5555") + socket.setsockopt(zmq.SUBSCRIBE, topic) + + i = 0 + + try: + while True: + binary_topic, data_buffer = socket.recv().split(b' ', 1) + + topic = binary_topic.decode(encoding = 'ascii') + + print("Message {:d}:".format(i)) + print("\ttopic: '{}'".format(topic)) + + packet_size = len(data_buffer) // struct.calcsize("h") + + print("\tpacket size: {:d}".format(packet_size)) + + struct_format = "{:d}h".format(packet_size) + + data = struct.unpack(struct_format, data_buffer) + + print("\tdata: {}".format(data)) + + i += 1 + + except KeyboardInterrupt: + socket.close() + except Exception as error: + print("ERROR: {}".format(error)) + socket.close() +``` + +将上面的内容保存到名为 `online_analysis.py` 的文件。Python 代码不需要编译,你可以直接运行它。 + +运行输出如下: + +``` +$ ./online_analysis.py +Reading messages with topic: b'fancyhw_data' +Message 0: +        topic: 'fancyhw_data' +        packet size: 16 +        data: (20946, -23616, 9865, 31416, -15911, -10845, -5332, 25662, 10955, -32501, -18717, -24490, -16511, -28861, 24205, 26568) +Message 1: +        topic: 'fancyhw_data' +        packet size: 16 +        data: (12505, 31355, 14083, -19654, -9141, 14532, -25591, 31203, 10428, -25564, -732, -7979, 9529, -27982, 29610, 30475) +... +... +``` + +### 小结 + +本教程介绍了一种新方式,实现从基于 C 的硬件接口收集数据,并分发到基于 Python 的基础设施的功能。借此可以获取数据供后续分析,或者转送到任意数量的接收端去。它采用了一个消息库实现数据在发送者和处理者之间的传送,来取代同样功能规模庞大的软件。 + +本教程还引出了我称之为“软件粒度”的概念,换言之,就是将软件细分为更小的部分。这种做法的优点之一就是,使得同时采用不同的编程语言实现最简接口作为不同部分之间沟通的组件成为可能。 + +实践中,这种设计使得软件工程师能以更独立、合作更高效的方式做事。不同的团队可以专注于数据分析的不同方面,可以选择自己中意的实现工具。这种做法的另一个优点是实现了零代价的并行,因为所有的进程都可以并行运行。[ZeroMQ 消息库][3] 是个令人赞叹的软件,使用它可以让工作大大简化。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/3/zeromq-c-python + +作者:[Cristiano L. Fontana][a] +选题:[lujun9972][b] +译者:[silentdawn-zz](https://github.com/译者ID) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/cristianofontana +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/email_chat_communication_message.png?itok=LKjiLnQu (Chat via email) +[2]: https://docs.python.org/3/extending/extending.html +[3]: https://zeromq.org/ +[4]: https://en.wikipedia.org/wiki/Network_socket +[5]: https://en.wikipedia.org/wiki/Pieter_Hintjens +[6]: http://hintjens.com/ +[7]: https://gcc.gnu.org/ +[8]: https://clang.llvm.org/ +[9]: https://github.com/zeromq/libzmq#installation-of-binary-packages- +[10]: https://www.python.org/downloads/ +[11]: https://zeromq.org/languages/python/ +[12]: http://www.opengroup.org/onlinepubs/009695399/functions/srand.html +[13]: http://www.opengroup.org/onlinepubs/009695399/functions/rand.html +[14]: http://www.opengroup.org/onlinepubs/009695399/functions/printf.html +[15]: https://en.wikipedia.org/wiki/Transmission_Control_Protocol +[16]: http://zguide.zeromq.org/page:all#Plugging-Sockets-into-the-Topology +[17]: http://www.opengroup.org/onlinepubs/009695399/functions/strlen.html +[18]: https://en.wikipedia.org/wiki/Pointer_%28computer_programming%29%23C_and_C++ +[19]: http://www.opengroup.org/onlinepubs/009695399/functions/memcpy.html +[20]: https://en.wikipedia.org/wiki/Garbage_collection_(computer_science) +[21]: https://docs.python.org/3/library/struct.html +[22]: https://docs.python.org/3/library/struct.html#format-characters diff --git a/published/202008/20200331 How failure-driven development makes you successful.md b/published/202008/20200331 How failure-driven development makes you successful.md new file mode 100644 index 0000000000..6b6bc55b96 --- /dev/null +++ b/published/202008/20200331 How failure-driven development makes you successful.md @@ -0,0 +1,62 @@ +[#]: collector: (lujun9972) +[#]: translator: (JonnieWayy) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12479-1.html) +[#]: subject: (How failure-driven development makes you successful) +[#]: via: (https://opensource.com/article/20/3/failure-driven-development) +[#]: author: (Jessica Cherry https://opensource.com/users/jrepka) + +屡屡失败犯错的我为什么没有被开除 +====== + +> 我是词典里 “失败” 一词旁边的插图,这就是为什么我擅长我的工作的原因。 + +![](https://img.linux.net.cn/data/attachment/album/202008/02/212013q5jjc78ihwd72cij.jpg) + +我的职称是高级软件工程师,但我最亲近的同事并不这么称呼我。由于我摧毁一切,他们管我叫“樱桃炸弹”(正巧我姓“樱桃”)。我定期会遇到的失败已经可以影响到我们的季度性收益和停机时间。简单的来说,我就是你所听说过的生产灾难:“别动,啥都别做,无论何时何地。” + +我的职业生涯始于支持服务台,在那里我写了一些循环,破坏了高端客户的服务器。我曾在没有警告的情况下将生产应用程序关闭了长达八个小时,并且在试图使得情况好转的过程中摧毁了无数个集群,有几次只是因为我打错了字。 + +我是我们在 [Kubernetes][2] 中设有灾难恢复(DR)集群的原因。我是个混乱的工程师,我们有一个应用程序,它的故障恢复计划还从未测试过,而我在没有警告的情况下,就教人们如何快速行动和排除故障。我作为可能失败的最好例子而存在,这实际上是有史以来最酷的事情。 + +### 我和消失的 K8s 集群 + +我的正式职责之一涉及到我们的应用架构。对于任何形式的架构改动,我都要进行代码的编写与测试,看看有什么可能性。近来,据说这成了我老板史诗级的痛苦,这只是轻描淡写。 + +我们在 Kubernetes 上运行我们的大多数基础架构,Kubernetes 以其弹性著称。尽管有这样的声誉,我还是使得两个集群,好吧,消失了。你可能会好奇我是怎么做到的,很容易,`terraform destroy`。我们通过 [Terraform][3] 以代码的方式管理我们的基础架构,并且不需要任何软件知识就知道 `destroy` 可做坏事。在你惊慌失措之前,好吧,是开发集群,所以我还活着。 + +鉴于此,你们肯定会问我为什么还没丢掉饭碗,以及为什么我要写下这些事情。这很好回答:我仍然有工作,是因为我更新的基础架构代码比起起初的代码工作得更好更快了。我写下这些是因为每个人都会经常性地遭遇失败,这是非常非常正常的。如果你没有时不时遭遇失败,我认为你并没有足够努力地学习。 + +### 破坏东西并培训人们 + +你可能还会认为永远不会有人让我去培训任何人。那是最糟糕的主意,因为(就像我的团队开玩笑说的)你永远都不应该做我所做的事情。但是我的老板却让我定期去训练新人。我甚至为整个团队提供使用我们的基础设施或代码的培训,教人们如何建立自己的基础设施。 + +原因是这样的:失败是你迈向成功的第一步。失败的教训绝不只是“备份是个绝佳的主意”。不,从失败中,你学会了更快地恢复、更快地排除故障并且在你工作中取得惊人的进步。当你在工作中变得惊人的时候,你就可以培训其他人,教给他们什么事情不要做,并且帮助他们去理解一切是如何工作的。由于你的经验,他们会比你开始时更进一步 —— 而且他们也很可能以新的、惊人的、史诗般的方式失败,每个人都可以从中学到东西。 + +### 你的成功取决于你的失败 + +没有人生来就具有软件工程和云基础架构方面的天赋,就像没有人天生就会走路。我们都是从滚动和翻爬开始的。从那时起,我们学会爬行,然后能够站立一会儿。当我们开始走路后,我们会跌倒并且擦伤膝盖,撞到手肘,还有,比如像我哥哥,走着走着撞上桌子的尖角,然后在眉毛中间缝了针。 + +凡事都需要时间去学习。一路上阅读手边能获得的一切来帮助你,但这永远只是个开始。完美是无法实现的幻想,你必须通过失败来取得成功。 + +每走一步,我的失败都教会我如何把事情做得更好。 + +最终,你的成功和你累积的失败一样多,这标志着你成功的程度。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/3/failure-driven-development + +作者:[Jessica Cherry][a] +选题:[lujun9972][b] +译者:[JonnieWayy](https://github.com/JonnieWayy) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/jrepka +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/fail_failure_celebrate.png?itok=LbvDAEZF (failure sign at a party, celebrating failure) +[2]: https://www.redhat.com/en/topics/containers/what-is-kubernetes +[3]: https://github.com/hashicorp/terraform diff --git a/published/202008/20200519 24 Linux desktops you need to try.md b/published/202008/20200519 24 Linux desktops you need to try.md new file mode 100644 index 0000000000..f96ba38567 --- /dev/null +++ b/published/202008/20200519 24 Linux desktops you need to try.md @@ -0,0 +1,123 @@ +[#]: collector: (lujun9972) +[#]: translator: (robsean) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12487-1.html) +[#]: subject: (24 Linux desktops you need to try) +[#]: via: (https://opensource.com/article/20/5/linux-desktops) +[#]: author: (Seth Kenlon https://opensource.com/users/seth) + +24 个值得尝试的 Linux 桌面环境 +====== + +> 我全要! + +![](https://img.linux.net.cn/data/attachment/album/202008/04/222604tj9mpc66zyzxppbx.jpg) + +Linux 桌面的最大优点之一是它提供给用户选择的权利。如果你不喜欢你屏幕左下角的应用程序菜单,你可以移除它。如果你不喜欢你的文件管理器组织文件的方式,你可以使用另外一个文件管理器。不过,不可否认的是,这对那些不习惯自己选择如何使用计算机的用户来说可能会感到困惑。如果你正在考虑安装 Linux,你要做的选择之一就是你想使用哪一个桌面,最好的方法就是尝试几个不同的桌面,直到你找到感觉适合你的桌面。 + +### 默认桌面 + +![][2] + +作为在 Fedora、Ubuntu、Debian 和一些其它操作系统上的默认桌面,GNOME 桌面可能是最流行的 Linux 桌面。它有一个易于使用和现代化的界面,并带有为手机环境设计的小点缀,因此即使在触摸屏上也感觉很自然。 + +不过,一些 Linux 发行版选择了不同的桌面环境,如 KDE Plasma、Pantheon、Cinnamon 和 Mate。 + + * [GNOME][3]: 现代化和易于使用,默认桌面 + * [Mate][4]: 传统的 GNOME + * [KDE][5]: 功能强大、可配置的 Plasma 桌面 + * [Cinnamon][6]: 经典的 GNOME + * [Pantheon][7]: [ElementaryOS][8] 的默认桌面 + * [Budgie][9]: 一个柔和的桌面 + * [Trinity][10]: 传统的 KDE + +### 传统的 Unix + +![运行在 Fedora 上的 Window Maker][11] + +Unix 是现代操作系统的鼻祖,也是 Linux 的直接灵感来源,拥有令人吃惊的丰富的桌面历史。大多数人都不熟悉 Unix 桌面设计,因为 Unix 计算机被认为是学术界、科学界和电影界常见的专业机器,而不是家用计算机。如果你是一名 Unix、IRIX 或 NeXT 的用户,那么你可能会对类似于 [CDE][12] 或 NeXTStep 的桌面有着美好的回忆。你很幸运,因为这一传统延续至今: + + * [Windowmaker][13]: NeXT 界面的复兴 + * [Enlightenment][14]: 一个现代化的改进型 Windowmaker 风格的桌面 + * [Fluxbox][15]: 跳出 Blackbox 思维定式 + * [Openbox][16]: 改善 Blackbox 的可用性 + * [TWM][17]: 与 X11 绑定至死的示例桌面 + * [Fvwm][18]: 改进的 TWM + +### 轻量级桌面 + +![XFCE in 2019 年 在 Mageia Linux 上的][19] + +你可能想知道为什么 Linux 有那么多的桌面可供选择。你可以把它归结为个人喜好和对效率低下的低容忍度,但优化用户界面也有技术上的好处。例如,老电脑难以跟上用户界面的更新,可以使用轻量级桌面[赋予它新的生命]() 。另外,你可能只是想把 CPU 处理能力分配到除桌面以外的其它东西上,所以保持你的主用户界面极简是有意义的。不管你的动机是什么,这里有一些你可以尝试的桌面: + + * [XFCE][20]: 熟悉的桌面,极少的性能损失 + * [LXQT 和 LXDE][21]: 熟悉的桌面,较少的性能损失 + * [PekWM][22]: 一个 Blackbox 式的窗口管理器 + * [Joe's Window Manager][23]: 另一个 Blackbox 式的窗口管理器 + * [Ratpoison][24]: 不使用鼠标 + * [Herbstluftwm][25]: 针对 [Vim 用户][26] 的Ratpoison + * [Lumina][27]: 一个为 PC-BSD 开发的桌面 + +### 实验性桌面 + +![Unix 桌面环境][28] + +当创建一个桌面并将其集成到一个系统中相对容易的时候,会发生的事情之一就是你会得到一些有趣的概念验证项目和试验性项目。有一些会比其它的更精致,有一些则不是很容易安装。这些很可能注定不会成为你的永久桌面,但是它们可以是很有趣的体验: + + * [Unix Desktop Environment][29]: 该桌面的重塑版 + * [Rox][30]: 在它那个时代是先进和现代的桌面 + * [MLVWM][31]: 要是 Apple IIe 运行 Unix 怎么样? + * [Equinox][32]: 只是个最基础的东西 + +### 选择你的桌面 + +如果太多的选择让你不知所措,那么记住:桌面意味着 *可选*。你没有义务来尝试发行版附带的多个桌面。 + +许多 Linux 的高级用户都会满足于他们的发行版所提供的某个桌面。最重要的是得到一个可以与你的计算机一起工作的 Linux 系统系统,并花费时间来学习它是如何工作的。归根结底,所有的桌面都只是为了做同一件事:帮助你组织和管理你的重要数据。让你了解你的桌面是如何工作的,这才是最重要的。但是如果你已经了解了你的默认桌面的各个方面,那你现在有了可以在周末尝试的大量选择。祝你玩得开心! + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/5/linux-desktops + +作者:[Seth Kenlon][a] +选题:[lujun9972][b] +译者:[robsean](https://github.com/robsean) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/seth +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/linux-penguins.png?itok=yKOpaJM_ (Penguins) +[2]: https://opensource.com/sites/default/files/advent-gnome.jpg +[3]: https://linux.cn/article-11675-1.html +[4]: https://linux.cn/article-11703-1.html +[5]: https://linux.cn/article-11728-1.html +[6]: https://linux.cn/article-8606-1.html +[7]: https://linux.cn/article-11660-1.html +[8]: https://elementary.io/ +[9]: https://linux.cn/article-10547-1.html +[10]: https://opensource.com/article/19/12/linux-trinity-desktop-environment-tde +[11]: https://opensource.com/sites/default/files/uploads/advent-windowmaker.jpg (Window Maker running on Fedora) +[12]: https://sourceforge.net/projects/cdesktopenv/ +[13]: https://linux.cn/article-11650-1.html +[14]: https://opensource.com/article/19/12/linux-enlightenment-desktop +[15]: https://linux.cn/article-12082-1.html +[16]: https://linux.cn/article-11698-1.html +[17]: https://linux.cn/article-11734-1.html +[18]: https://linux.cn/article-11712-1.html +[19]: https://opensource.com/sites/default/files/advent-xfce.jpg (XFCE on Mageia Linux in 2019) +[20]: https://linux.cn/article-10413-1.html +[21]: https://opensource.com/article/19/12/lxqt-lxde-linux-desktop +[22]: https://linux.cn/article-11670-1.html +[23]: https://opensource.com/article/19/12/joes-window-manager-linux-desktop +[24]: https://opensource.com/article/19/12/ratpoison-linux-desktop +[25]: https://linux.cn/article-11734-1.html +[26]: https://opensource.com/resources/what-vim +[27]: https://linux.cn/article-11706-1.html +[28]: https://opensource.com/sites/default/files/uploads/advent-ude.jpg (Unix Desktop Environment) +[29]: https://opensource.com/article/19/12/linux-unix-desktop-environment-ude +[30]: https://linux.cn/article-12123-1.html +[31]: https://linux.cn/article-11720-1.html +[32]: https://opensource.com/article/19/12/ede-linux-desktop diff --git a/published/202008/20200521 Easy DNS configuration with PowerDNS for nameservers.md b/published/202008/20200521 Easy DNS configuration with PowerDNS for nameservers.md new file mode 100644 index 0000000000..0a0f7aa7ae --- /dev/null +++ b/published/202008/20200521 Easy DNS configuration with PowerDNS for nameservers.md @@ -0,0 +1,88 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12496-1.html) +[#]: subject: (Easy DNS configuration with PowerDNS for nameservers) +[#]: via: (https://opensource.com/article/20/5/powerdns) +[#]: author: (Jonathan Garrido https://opensource.com/users/jgarrido) + +使用 PowerDNS 轻松配置 DNS 名称服务器 +====== + +> 使用 PDNS 为你的项目提供稳定可靠的域名系统(DNS)服务器。 + +![](https://img.linux.net.cn/data/attachment/album/202008/07/202953copoqjmkefkdf3j4.jpg) + +几个月前,我们接到了一个要求,为一个新项目提供一个稳定可靠的域名系统([DNS][2])服务器。该项目使用容器进行自动部署,每个新环境都会生成唯一的随机 URL。在对可能的方案进行了大量研究之后,我们决定尝试一下 [PowerDNS][3](PDNS)。 + +一开始,我们发现 PowerDNS 在所有主流 Linux 发行版中都得到了支持,它采用 GPL 许可,且仓库保持更新。我们还在官方网站上发现了整洁、组织良好的[文档][4],以及大量来自真正喜欢和使用该产品的人在网络上的使用方法。看了一些并学习了一些基本命令之后,安装了 PDNS,启动并运行,我们的旅程开始了。 + +### 数据库驱动 + +PowerDNS 将记录保存在 SQL 数据库中。这对我们来说是新变化,不必使用文本文件来保存记录是一个不错的更改。我们选择 MariaDB 作为首选的强大工具,由于有大量的正确地设置来安装名称服务器的信息,我们可以完美地设置和加固我们的数据库。 + +### 简单配置 + +其次使我们感兴趣的是 PDNS 的所有功能都在配置文件中。`pdns.conf` 有许多选项,你可以通过添加或删除 `#` 号来启用或禁用这些选项。这真是太神奇了,因为它使我们有机会将这项新的服务集成到我们现有的基础架构中,并且只有我们想要的功能,不多也不少。一个简单的例子: + +谁可以访问你的网络服务器? + +``` +webserver-allow-from=172.10.0.1,172.10.1.2 +``` + +我可以转发基于域的请求吗?当然! + +``` +forward-zones=mylocal.io=127.0.0.1:5300 +forward-zones+=example.com=172.10.0.5:53 +forward-zones+=lucky.tech=172.10.1.5:53 +``` + +### 包含 API + +我们可以使用配置文件进行激活 API 服务,解决了我们开发团队的第一个需求,让我们见识到了 PDNS 的强大。这个功能让我们通过发送请求,简单、干净地创建、修改或删除 DNS 服务器中的记录。 + +这个 API 有一些基本的安全性参数,因此,只需几步,你就可以基于 IP 地址和预共享密钥验证的组合来控制谁有权与名称服务器进行交互。这是配置文件的样子: + +``` +api=yes +api-key=lkjdsfpoiernf +webserver-allow-from=172.10.7.13,172.10.7.5 +``` + +### 日志 + +在日志方面,PDNS 做得非常出色。你可以使用日志文件和一个简单的内置 Web 服务器来监控服务器并查看计算机的运行状况。你可以使用浏览器查看服务器不同类型的统计信息,例如 CPU 使用率和收到的 DNS 查询。这非常有价值。例如,我们能够检测到一些“不太健康”的 PC,它们正在向我们的服务器发送与恶意流量相关的站点的 DNS 请求。深入查看日志后,我们可以看到流量来自何处,并对这些 PC 进行清理操作。 + +### 其他功能 + +这只是你使用 PowerDNS 可以做的所有事情的一点点。它还有更多的功能。它是一个拥有很多功能和特性的完整名称服务器,因此值得一试。 + +目前,我们尚未部署 [DNSSEC][5],但似乎只需点击一下即可将其快速投入生产环境。另外,在将递归服务与名称服务器分离时,PowerDNS 有个不错的方法。我了解到它还支持 [DNS RPZ][6](响应策略区域),并且还提供了非常不错且设计良好的前端,可让你使用 Web 浏览器来管理服务器,如下图。 + +![PowerDNS frontend][7] + +信不信由你,你只需花费几个小时了解 PDNS,就可以大大提高你对 DNS 和 IT 操作的了解。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/5/powerdns + +作者:[Jonathan Garrido][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/jgarrido +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/computer_space_graphic_cosmic.png?itok=wu493YbB (Computer laptop in space) +[2]: https://en.wikipedia.org/wiki/Domain_Name_System +[3]: https://www.powerdns.com/opensource.html +[4]: https://doc.powerdns.com/ +[5]: https://en.wikipedia.org/wiki/Domain_Name_System_Security_Extensions +[6]: https://dnsrpz.info/ +[7]: https://opensource.com/sites/default/files/uploads/pdns.jpg (PowerDNS frontend) diff --git a/published/202008/20200526 FreeFileSync- Open Source File Synchronization Tool.md b/published/202008/20200526 FreeFileSync- Open Source File Synchronization Tool.md new file mode 100644 index 0000000000..6c35a380e3 --- /dev/null +++ b/published/202008/20200526 FreeFileSync- Open Source File Synchronization Tool.md @@ -0,0 +1,138 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12543-1.html) +[#]: subject: (FreeFileSync: Open Source File Synchronization Tool) +[#]: via: (https://itsfoss.com/freefilesync/) +[#]: author: (Ankush Das https://itsfoss.com/author/ankush/) + +FreeFileSync:开源的文件同步工具 +====== + +> FreeFileSync 是一个开源的文件夹比较和同步工具,你可以使用它将数据备份到外部磁盘、云服务(如 Google Drive)或任何其他存储路径。 + +### FreeFileSync:一个免费且开源的同步工具 + +![](https://img.linux.net.cn/data/attachment/album/202008/23/060523ubx28vyi8qf8sv9d.jpg) + +[FreeFileSync][2] 是一个令人印象深刻的开源工具,可以帮助你将数据备份到其他位置。 + +它们可以是外部 USB 磁盘、Google Drive 或使用 **SFTP 或 FTP** 连接到任何云存储。 + +你可能之前读过我们的[如何在 Linux 上使用 Google Drive][3] 的教程。不幸的是,没有合适的在 Linux 上原生使用 Google Drive 的 FOSS 方案。有个 [Insync][4],但它是收费软件而非开源软件。 + +FreeFileSync 可使用 Google Drive 帐户同步文件。事实上,我用它把我的文件同步到 Google Drive 和一个单独的硬盘上。 + +### FreeFileSync 的功能 + +![][1] + +尽管 FreeFileSync 的 UI 看起来可能很老,但它为普通用户和高级用户提供了许多有用的功能。 + +我将在此处把所有能重点介绍的功能都介绍出来: + + * 跨平台支持(Windows、macOS 和 Linux) + * 同步前比较文件夹 + * 支持 Google Drive、[SFTP][6] 和 FTP 连接 + * 提供在不同的存储路径(或外部存储设备)上同步文件的能力 + * 多个可用的同步选项(从源更新文件到目标或镜像目标和源之间的文件) + * 支持双向同步(如果目标文件夹或源文件夹有任何修改,将同步更改) + * 适用于高级用户的版本控制 + * 可进行实时同步 + * 能安排批处理作业 + * 同步完成时通过电子邮件收到通知(付费) + * 便携式版(付费) + * 并行文件复制(付费) + +如果你看一下它提供的功能,它不仅是普通的同步工具,而且还免费提供了更多功能。 + +此外,为了让你了解,你还可以在同步文件之前先比较它们。例如,你可以比较文件内容/文件时间,或者简单地比较源文件夹和目标文件夹的文件大小。 + +![][7] + +你还有许多同步选项来镜像或更新数据。如下所示: + +![][8] + +但是,它也为你提供了捐赠密钥的可选选项,它可解锁一些特殊功能,如在同步完成时通过电子邮件通知你等。 + +以下是免费版本和付费版本的不同: + +![][9] + +因此,大多数基本功能是免费的。高级功能主要是针对高级用户,当然,如果你想支持他们也可以。(如果你觉得它有用,请这么做)。 + +此外,请注意,捐赠版单用户最多可在 3 台设备上使用。所以,这绝对不差! + +### 在 Linux 上安装 FreeFileSync + +你可以前往它的[官方下载页面][10],并下载 Linux 的 tar.gz 文件。如果你喜欢,你还可以下载源码。 + +![][11] + +接下来,你只需解压并运行可执行文件就可以了(如上图所示) + +- [下载 FreeFileSync][2] + +### 如何开始使用 FreeFileSync? + +虽然我还没有成功地尝试过创建自动同步作业,但它很容易使用。 + +[官方文档][12]应该足以让你获得想要的。 + +但是,为了让你初步了解,这里有一些事情,你应该记住。 + +![][13] + +如上面的截图所示,你只需选择源文件夹和要同步的目标文件夹。你可以选择本地文件夹或云存储位置。 + +完成后,你需要选择在同步中文件夹比较的类型(通常是文件时间和大小),在右侧,你可以调整要执行的同步类型。 + +#### FreeFileSync 的同步类型 + +当你选择 “更新” 的方式进行同步时,它只需将新数据从源文件夹复制到目标文件夹。因此,即使你从源文件夹中删除了某些东西,它也不会在目标文件夹中被删除。 + +如果你希望目标文件夹有相同的文件副本,可以选择 “镜像”同步方式。这样,如果你从源文件夹中删除内容,它就会从目标文件夹中删除。 + +还有一个 “双向” 同步方式,它检测源文件夹和目标文件夹的更改(而不是只监视源文件夹)。因此,如果对源/目标文件夹进行了任何更改,都将同步修改。 + +有关更高级的用法,我建议你参考[文档][12]。 + +### 总结 + +还有一个[开源文件同步工具是 Syncthing][14],你可能想要看看。 + +FreeFileSync 是一个相当被低估的文件夹比较和同步工具,适用于使用 Google Drive、SFTP 或 FTP 连接以及单独的存储位置进行备份的 Linux 用户。 + +而且,所有这些功能都免费提供对 Windows、macOS 和 Linux 的跨平台支持。 + +这难道不令人兴奋吗?请在下面的评论,让我知道你对 Freefilesync 的看法。 + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/freefilesync/ + +作者:[Ankush Das][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://itsfoss.com/author/ankush/ +[b]: https://github.com/lujun9972 +[1]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/05/free-file-sync.jpg?ssl=1 +[2]: https://freefilesync.org/ +[3]: https://itsfoss.com/use-google-drive-linux/ +[4]: https://itsfoss.com/recommends/insync/ +[5]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/05/FreeFileSync.jpg?ssl=1 +[6]: https://en.wikipedia.org/wiki/SSH_File_Transfer_Protocol +[7]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/05/freefilesync-comparison.png?ssl=1 +[8]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/05/freefilesync-synchronization.png?ssl=1 +[9]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/05/free-file-sync-donation-edition.jpg?ssl=1 +[10]: https://freefilesync.org/download.php +[11]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/05/freefilesync-run.jpg?ssl=1 +[12]: https://freefilesync.org/manual.php +[13]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/05/freefilesync-tips.jpg?ssl=1 +[14]: https://itsfoss.com/syncthing/ diff --git a/published/202008/20200603 Code your hardware using this open source RTOS.md b/published/202008/20200603 Code your hardware using this open source RTOS.md new file mode 100644 index 0000000000..067f5d0213 --- /dev/null +++ b/published/202008/20200603 Code your hardware using this open source RTOS.md @@ -0,0 +1,117 @@ +[#]: collector: (lujun9972) +[#]: translator: (silentdawn-zz) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12518-1.html) +[#]: subject: (Code your hardware using this open source RTOS) +[#]: via: (https://opensource.com/article/20/6/open-source-rtos) +[#]: author: (Zhu Tianlong https://opensource.com/users/zhu-tianlong) + +使用 RT-Thread 实时操作系统驱动你的硬件 +====== + +> 编程驱动一个微处理器芯片是相当有难度的,但在嵌入式系统开发上,实时操作系统可以为你解决很多此类的困难。 + +![](https://img.linux.net.cn/data/attachment/album/202008/15/065451hu3784opp7p74qtp.jpg) + +从通用计算的角度,操作系统是提供计算机基本功能的一组软件。操作系统保证了计算机硬件可以探测并响应外围器件(如键盘、屏幕、移动设备、打印机等),并管理内存空间和外部存储空间。 + +虽然一个 CPU 核心同一时间只能运行单个线程,但现代操作系统可以使多个程序表现的像是在同时运行。每一个任务执行的如此之短,一系列任务切换的如此之快,以至于看起来多个任务像是在并行进行。这一切都是由一个叫做 *调度器* 的子进程来控制的。 + +操作系统通常是为计算机准备的,安装在硬盘上,管理计算机所要执行的任务。 + +### 为什么实时操作系统对嵌入式系统而言不可或缺 + +我曾经在 2008 年接触过嵌入式软件,那时候我还是一名学生,正在学习 [MCS-51][2] 微处理器编程。因为我的主修专业是计算机科学,我在其它课程中的所有程序都是在 PC 上执行的。为微处理器芯片编程是完全不同的体验。人生中第一次,我看到我的程序在裸板上运行,即使到现在我仍然记得,在我看到自己人生中第一个走马灯程序成功运行时的那种兴奋和激动。 + +但那种兴奋转瞬即逝。随着为裸板写出越来越多的程序,我遇到了越来越多的问题。这种沮丧并不是我独有的。直接为芯片写程序很困难,这也是 PC 要运行操作系统的很重要的原因。不幸的是,微处理器芯片(或嵌入式系统)通常是没有操作系统的,它们只能采用“硬编码”的方式编程,没有操作系统帮助你管理代码的运行。 + +在以“硬编码”的方式为处理芯片编写代码的时候,可能会遇到下列问题: + +#### 并发 + +在裸板上是没有管理程序运行的现成守护进程的。嵌入式系统软件中,无可避免的要把所有的逻辑功能放在一个巨大的 `while (1)` 循环中。每个功能可能包含一个或多个延时函数。CPU 在运行延时函数的时候是顺序执行的,没有任何办法跨越一个不必要的延时。正因如此,运行事务的复位操作只能是等待。最终结果就是很多的 CPU 处理时间浪费在空循环上,这对任务的并发非常不利。 + +#### 模块化 + +从软件工程的角度,高內聚低耦合原则在软件开发过程中被不厌其烦的频频强调,但是嵌入式软件的不同模块之间常常是重度耦合的,很多功能都集中在一个巨大的 `while (1)` 循环中,很难切分为模块。设计低耦合软件在编程上只是繁琐一些,但在嵌入式系统上,要低耦合就难以编写比较大型的软件。 + +与此同时,如果使用了看门狗定时器,程序员还得在调用延时函数时倍加小心。如果延时时间太长,主程序没有得到及时“喂狗”的时机,那么看门狗将在程序运行过程中被触发。嵌入式系统软件开发过程中,需要考虑的东西太多了,即便是个简单的延时函数,都不能掉以轻心。软件越复杂,就越需要细心。想象一下,试图将这一系列具有精细时间关系的交互功能拆分为模块会怎么样。 + +#### 软件生态 + +很多高级的软件组件依赖于其所基于的底层操作系统的实现。举个自身的例子,我曾开发过一个基于 [FreeModbus][3] 的开源项目,原计划将它移植到多种平台上,包括裸板。但与适应不同操作系统的便利性相比,有些功能过于复杂,无法在所有裸机板上实现。更糟糕的是,很多硬件平台因为缺乏一致性,只能各自从头做起。 + +直至现在,我的 Modbus 栈仍然不支持在裸板上运行。 + +很多像 Realtek、TI 和 MediaTek 的大厂,所提供的 WiFi 软件开发工具只能在操作系统上运行,且他们不公开固件源码,所以在裸板上根本没法使用这些工具。 + +#### 实时性 + +有些应用领域对实时性有要求,比如有些场景中,必须在特定的时间触发特定的软件操作。在工业控制场景,机器实体控制过程中,机械部件必须以确定的时间和确定的顺序执行动作。如果不能保证控制系统的实时性,整个机器可能出现功能异常,甚至危及工人生命。在裸板平台,所有的功能都塞在一个巨大的 `while (1)` 循环中,实时性无从保证。 + +#### 重用性 + +重用性依赖于模块化。没谁愿意翻来覆去做一成不变的事,对程序员而言更是如此。这不单单是浪费时间,更要命的是这使得代码的维护异常复杂。尤其是,因为功能的实现依赖于底层的硬件,使用了不同芯片的不同硬件平台上,同样的功能必须适配不同的硬件平台。这种情况下,重新发明轮子是无法避免的。 + +### 实时操作系统的优势 + +幸运的是,现在有针对各种微处理器芯片的操作系统,它们被称为实时操作系统(RTOS),和大多数操作系统一样,它们拥有调度器,保证代码以可预见的顺序运行。 + +我是在 2010 年初次在裸板上使用实时操作系统。那时候,[STM32][4] 系列微处理器(MCU)开始流行,因为这种微处理器性能强大、功能丰富,很多人在上面跑操作系统。我使用的是 [RT-Thread][5] 操作系统,有很多基于它的现成组件可用。它使用的是 Apache 2.0 许可,和其它操作系统相比,我觉得这个很舒心。我已经基于它作为平台从事开发工作 10 年了。 + +使用实时操作系统为裸板编程,操作系统为我们解决了需要处理的大部分问题。 + +#### 模块化 + +在操作系统支持下,整个软件可以分割为多个任务(即线程)。每个线程拥有自己独立的运行空间。线程之间互相独立,这促进了软件的模块化。 + +#### 并发 + +如果一个线程有延时函数,它将自动让出 CPU 资源给需要 CPU 的线程,这提高了 CPU 的整体利用率,也提升了系统的并发性能。 + +#### 实时性 + +实时操作系统从设计上就具备实时性。每个线程都被指定了特定的优先级,比较重要的线程设置为更高的优先级,不重要的线程优先级也低。正是以这种方式,软件整体的实时性得到了保证。 + +#### 开发效率 + +操作系统提供了统一的抽象接口,这使得可重用组件得以不断积累,同时提升了开发效率。 + +操作系统是软件极客集体智慧的结晶。很多通用的软件功能,如信号量、事件提醒、邮箱、环形缓冲、单向链表、双向链表等,被抽象出来并实现了封装,可随时调用。 + +Linux、RT-Thread 等操作系统为五花八门的硬件实现了一致的硬件接口,也就是常说的设备驱动框架。正因如此,软件工程师可以专注于软件开发,而不用关心底层的硬件,也不用重复造轮子。 + +#### 软件生态 + +RT-Thread 丰富的软件生态为大量的从业者带来了巨大的改变。操作系统带来的模块化和重用性,使得程序员可以基于 RT-Thread 封装出方便嵌入式系统开发使用的可重用组件。这些组件可以在其它项目中重用,也可以分享给其他的嵌入式应用开发者,以最大化软件的价值。 + +比如,LkdGui 是个开源的单色显示图形库,你可能在工业控制面板上简单而美观的设置界面上见过它。LkdGui 提供了像描点、画线、绘矩形及显示文本、按钮组件、进度条等绘图功能。 + +![LkdGui][6] + +使用像 LkdGui 这样兼具扩展性和健壮性的功能库,程序员们可以在同行已有工作成果的基础上充分施展自己的才能。而这一切,没有实时操作系统这样一个统一的基础,是根本不可能的。 + +### 试用 RT-Thread + +作为开源极客,我已经在 GitHub 上开源了一些嵌入式软件。在发布开源软件之前,我很少对他人谈及自己曾经的项目,因为不同的人在使用各种不同的微处理器芯片和硬件平台,我的代码极可能无法在他人的板子上运行。类似于 RT-Thread 这样的实时操作系统极大的提升了软件的可重用性,所以全世界的不同领域的专家得以就同一个项目展开探讨。这鼓励着越来越多的人分享和交流各自的项目。如果你在做裸板的软件开发,下次可以试试 TR-Thread。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/6/open-source-rtos + +作者:[Zhu Tianlong][a] +选题:[lujun9972][b] +译者:[silentdawn-zz](https://github.com/silentdawn-zz) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/zhu-tianlong +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/puzzle_computer_solve_fix_tool.png?itok=U0pH1uwj (Puzzle pieces coming together to form a computer screen) +[2]: https://en.wikipedia.org/wiki/Intel_MCS-51 +[3]: https://www.embedded-solutions.at/files/freemodbus-v1.6-apidoc/ +[4]: https://en.wikipedia.org/wiki/STM32 +[5]: https://github.com/RT-Thread/rt-thread +[6]: https://opensource.com/sites/default/files/uploads/lkdgui.jpg (LkdGui) diff --git a/published/202008/20200610 Concise data plotting in Python with Altair.md b/published/202008/20200610 Concise data plotting in Python with Altair.md new file mode 100644 index 0000000000..9f68890aa5 --- /dev/null +++ b/published/202008/20200610 Concise data plotting in Python with Altair.md @@ -0,0 +1,185 @@ +[#]: collector: (lujun9972) +[#]: translator: (silentdawn-zz) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12493-1.html) +[#]: subject: (Concise data plotting in Python with Altair) +[#]: via: (https://opensource.com/article/20/6/altair-python) +[#]: author: (Shaun Taylor-Morgan https://opensource.com/users/shaun-taylor-morgan) + +Python 下使用 Altair 数据制图 +====== + +> Altair 作为一个 Python 数据制图库,提供了优雅的接口及自有的绘图语言。 + +![](https://img.linux.net.cn/data/attachment/album/202008/06/110441imrz9ajtpshtfq1i.jpg) + +Python 中的 [绘图库][2] 提供了呈现数据的多种方式,可以满足你不同的偏好,如灵活性、布局、易用性,或者特殊的风格。 + +和其它方式相比,我发现,Altair 提供的是一种不同的解决方案,且总体而言使用起来更为简单。得益于声明式的绘图语言 [Vega][3],Altair 拥有一套优雅的接口,可以直接定义要绘的图应该是什么样子,而不是通过写一大堆循环和条件判断去一步步构建。 + +### 绘图流程 + +我通过绘制同一个多柱状图比较了多个 Python 绘图库的差异。正式开始之前,你需要将你的 Python 环境调整到能运行下面代码的状态。具体就是: + +* 安装最新版的 Python( [Linux][4]、[Mac][5] 和 [Windows][6] 系统下的安装方法) +* 确认该版本 Python 可以运行本教程所使用的库 + +演示用数据可从网络下载,并且可以用 pandas 直接导入: + +``` +import pandas as pd +df = pd.read_csv('https://anvil.works/blog/img/plotting-in-python/uk-election-results.csv') +``` + +准备开始吧。为了做个比较,先看下面这个用 [Matplotlib][7] 做的图: + +![Matplotlib UK election results][8] + +使用 Matplotlib 需要 16 行代码,图柱的位置需要自己计算。 + +使用 Altair 绘制相似的图,代码如下: + +``` +    import altair as alt + +    chart = alt.Chart(df).mark_bar().encode( +        x='party', +        y='seats', +        column='year', +        color='party', +    ) + +    chart.save('altair-elections.html') +``` + +真是简洁多了!与 [Seaborn][9] 类似,Altair 所用数据的组织形式是每个变量一列(即 [数据列][10] )。这种方式下可以将每个变量映射到图的一个属性上 —— Altair 称之为“通道”。在上例中,我们期望每个 “党派” 在 `x` 轴上显示为一组图柱, 其 “席位” 显示在 `y` 轴,且将图柱按照 “年份” 分开为 “列”。我们还想根据 “党派” 给图柱使用不同的 “颜色”。用语言表述需求的话就是上面这个样子,而这也正是代码所要表述的! + +现在把图画出来: + +![Altair plot with default styling][11] + +### 调整样式 + +这和我们期待的效果有点接近了。与 Matplotlib 方案相比,主要区别在于 Altair 方案中,每个 `year` 组显示的时候,内部之间都有个小空白 —— 这不是问题,这只是 Altair 多柱状图显示的一个特性。 + +所以说呢,还需要对显示样式再做一些改进。 + +#### 非整形数据 + +两个不是整数的年份名称(`Feb 1974` 和 `Oct 1974`)显示为 `NaN` 了。这可以通过将年份数值 `year` 转换为字符串来解决: + + +``` +    df['year'] = df['year'].astype(str) +``` + +#### 指定数据排序方法 + +还需要让 Altair 知道如何对数据进行排序。Altair 允许通过传给它一个 `Column` 对象,来设定 `Column` 通道的更多细节。现在让 Altair 按照数据在数据集中出现的顺序排列: + +``` +    chart = alt.Chart(df).mark_bar().encode( +        # ... +        column=alt.Column('year', sort=list(df['year']), title=None), +        # ... +    ) +``` + +#### 移除坐标轴标签 + +我们通过设置 `title=None` 移除了图顶的 "year" 标签。下面再一处每列数据的 "party" 标签: + + +``` +    chart = alt.Chart(df).mark_bar().encode( +        x=alt.X('party', title=None), +        # ... +    ) +``` + +#### 指定颜色图 + +最后,我们还想自己指定图柱的颜色。Altair 允许建立 `domain` 中数值与 `range` 中颜色的映射来实现所需功能,太贴心了: + +``` +    cmap = { +        'Conservative': '#0343df', +        'Labour': '#e50000', +        'Liberal': '#ffff14', +        'Others': '#929591', +    } + +    chart = alt.Chart(df).mark_bar().encode( +        # ... +        color=alt.Color('party', scale=alt.Scale(domain=list(cmap.keys()), range=list(cmap.values()))) +    ) +``` + +#### 样式调整后的最终代码 + +应用上述样式调整之后,代码看起来不那么悦目了,但我们仍然是用声明的方式实现的,这正是 Altair 如此有弹性的原因所在。实现过程中,仍然是使用的异于显示数据的独立变量来分离图中不同属性的,而不是像在 Matplotlib 中那样直接对显示数据做复杂的操作。唯一的不同是,我们的变量名字封装在类似 `alt.X()` 的对象中,从而实现对显示效果的控制: + +``` +    import altair as alt +    from votes import long as df + +    cmap = { +        'Conservative': '#0343df', +        'Labour': '#e50000', +        'Liberal': '#ffff14', +        'Others': '#929591', +    } + +    df['year'] = df['year'].astype(str) + +    # We're still assigning, e.g. 'party' to x, but now we've wrapped it +    # in alt.X in order to specify its styling +    chart = alt.Chart(df).mark_bar().encode( +        x=alt.X('party', title=None), +        y='seats', +        column=alt.Column('year', sort=list(df['year']), title=None), +        color=alt.Color('party', scale=alt.Scale(domain=list(cmap.keys()), range=list(cmap.values()))) +    ) + +    chart.save('altair-elections.html') +``` + +现在与 Matplotlib 方案扯平了,代码数量达到了 16 行! + +下图是使用我们的样式调整方案之后的 Altair 效果图: + +![The Altair plot with our custom styling][12] + +### 结论 + +尽管在代码数量上,使用 Altair 绘图没有表现出优势,但它的声明式绘图语言使得对图层的操控更为精密,这是我比较欣赏的。Altair 还提供了清晰而独立的方式来调校显示样式,这使得 相关代码与绘图的代码块分离开来。Altair 确实是使用 Python 绘图时又一个很棒的工具库。 + +本文首次发布于 [这里][13],蒙允编辑后再次发布。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/6/altair-python + +作者:[Shaun Taylor-Morgan][a] +选题:[lujun9972][b] +译者:[silentdawn-zz](https://github.com/silentdawn-zz) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/shaun-taylor-morgan +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/metrics_data_dashboard_system_computer_analytics.png?itok=oxAeIEI- (metrics and data shown on a computer screen) +[2]: https://linux.cn/article-12327-1.html +[3]: https://vega.github.io/vega/ +[4]: https://opensource.com/article/20/4/install-python-linux +[5]: https://opensource.com/article/19/5/python-3-default-mac +[6]: https://opensource.com/article/19/8/how-install-python-windows +[7]: https://opensource.com/article/20/5/matplotlib-python +[8]: https://opensource.com/sites/default/files/uploads/matplotlib_1_1.png (Matplotlib UK election results) +[9]: https://anvil.works/blog/plotting-in-seaborn +[10]: https://anvil.works/blog/tidy-data +[11]: https://opensource.com/sites/default/files/uploads/altair-first-try.png (Altair plot with default styling) +[12]: https://opensource.com/sites/default/files/uploads/altair_3.png (The Altair plot with our custom styling.) +[13]: https://anvil.works/blog/plotting-in-altair diff --git a/published/202008/20200611 Never forget your password with this Python encryption algorithm.md b/published/202008/20200611 Never forget your password with this Python encryption algorithm.md new file mode 100644 index 0000000000..5d236b50d9 --- /dev/null +++ b/published/202008/20200611 Never forget your password with this Python encryption algorithm.md @@ -0,0 +1,254 @@ +[#]: collector: (lujun9972) +[#]: translator: (silentdawn-zz) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12474-1.html) +[#]: subject: (Never forget your password with this Python encryption algorithm) +[#]: via: (https://opensource.com/article/20/6/python-passwords) +[#]: author: (Moshe Zadka https://opensource.com/users/moshez) + +国王的秘密:如何保护你的主密码 +====== + +> 这种使用 Python 和 Shamir 秘密共享的独特算法可以保护你的主密码,可以有效避免黑客窃取和自己不经意忘记引发的风险和不便。 + +![](https://img.linux.net.cn/data/attachment/album/202008/01/105831kzxididbld8kdhdb.jpg) + +很多人使用密码管理器来保密存储自己在用的各种密码。密码管理器的关键环节之一是主密码,主密码保护着所有其它密码。这种情况下,主密码本身就是风险所在。任何知道你的主密码的人,都可以视你的密码保护若无物,畅行无阻。自然而然,为了保证主密码的安全性,你会选用很难想到的密码,把它牢记在脑子里,并做[所有其他][2]你应该做的事情。 + +但是万一主密码泄露了或者忘记了,后果是什么?也许你去了个心仪的岛上旅行上个把月,没有现代技术覆盖,在开心戏水之后享用美味菠萝的时刻,突然记不清自己的密码是什么了。是“山巅一寺一壶酒”?还是“一去二三里,烟村四五家”?反正当时选密码的时候感觉浑身都是机灵,现在则后悔当初何必作茧自缚。 + +![XKCD comic on password strength][3] + +*([XKCD][4], [CC BY-NC 2.5][5])* + +当然,你不会把自己的主密码告诉其它任何人,因为这是密码管理的首要原则。有没有其它变通的办法,免除这种难以承受的密码之重? + +试试 [Shamir 秘密共享算法][6]Shamir's Secret Sharing,这是一种可以将保密内容进行分块保存,且只能将片段拼合才能恢复保密内容的算法。 + +先分别通过一个古代的和一个现代的故事,看看 Shamir 秘密共享算法究竟是怎么回事吧。 + +这些故事的隐含前提是你对密码学有起码的了解,必要的话,你可以先温习一下 [密码学与公钥基础设施引论][7]. + +### 一个古代关于加解密的故事 + +古代某国,国王有个大秘密,很大很大的秘密: + +``` +def int_from_bytes(s): +    acc = 0 +    for b in s: +        acc = acc * 256 +        acc += b +    return acc + +secret = int_from_bytes("terrible secret".encode("utf-8")) +``` + +大到连他自己的孩子都不能轻易信任。他有五个子女,但他知道前路危机重重。他的孩子需要在他百年之后用这个秘密来保卫国家,而国王又不能忍受自己的孩子在他们还记得自己的时候就知道这些秘密,尤其是这种状态可能要持续几十年。 + +所以,国王动用大力魔术,将这个秘密分为了五个部分。他知道,可能有一两个孩子不会遵从他的遗嘱,但绝对不会同时有三个或三个以上会这样: + +``` +from mod import Mod +from os import urandom +``` + +国王精通 [有限域][8] 和 *随机* 魔法,当然,对他来说,使用巨蟒分割这个秘密也是小菜一碟。 + +第一步是选择一个大质数——第 13 个 [梅森质数][9](`2**521 - 1`),他让人把这个数铸造在巨鼎上,摆放在大殿上: + +``` +P = 2**521 - 1 +``` + +但这不是要保密的秘密:这只是 *公开数据*。 + +国王知道,如果 `P` 是一个质数,用 `P` 对数字取模,就形成了一个数学 [场][10]:在场中可以自由进行加、减、乘、除运算。当然,做除法运算时,除数不能为 0。 + +国王日理万机,方便起见,他在做模运算时使用了 PyPI 中的 [mod][11] 模块,这个模块实现了各种模数运算算法。 + +他确认过,自己的秘密比 `P` 要短: + +``` +secret < P +``` +``` +TRUE +``` + +将秘密转换为 `P` 的模,`mod P`: + +``` +secret = mod.Mod(secret, P) +``` + +为了使任意三个孩子掌握的片段就可以重建这个秘密,他还得生成另外两个部分,并混杂到一起: + +``` +polynomial = [secret] +for i in range(2): + polynomial.append(Mod(int_from_bytes(urandom(16)), P)) +len(polynomial) +``` +``` +3 +``` + +下一步就是在随机选择的点上计算某 [多项式][12] 的值,即计算 `polynomial[0] + polynomial[1]*x + polynomial[2]*x**2 ...`。 + +虽然有第三方模块可以计算多项式的值,但那并不是针对有限域内的运算的,所以,国王还得亲自操刀,写出计算多项式的代码: + +``` +def evaluate(coefficients, x): +    acc = 0 +    power = 1 +    for c in coefficients: +        acc += c * power +        power *= x +    return acc +``` + +再下一步,国王选择五个不同的点,计算多项式的值,并分别交给五个孩子,让他们各自保存一份: + +``` +shards = {} +for i in range(5): +    x = Mod(int_from_bytes(urandom(16)), P) +    y = evaluate(polynomial, x) +    shards[i] = (x, y) +``` + +正如国王所虑,不是每个孩子都正直守信。其中有两个孩子,在他尸骨未寒的时候,就想从自己掌握的秘密片段中窥出些什么,但穷极所能,终无所获。另外三个孩子听说了这个事,合力将这两人永远驱逐: + +``` +del shards[2] +del shards[3] +``` + +二十年弹指一挥间,奉先王遗命,三个孩子将合力恢复出先王的大秘密。他们将各自的秘密片段拼合在一起: + +``` +retrieved = list(shards.values()) +``` + +然后是 40 天没日没夜的苦干。这是个大工程,他们虽然都懂些 Python,但都不如前国王精通。 + +最终,揭示秘密的时刻到了。 + +用于反算秘密的代码基于 [拉格朗日差值][13],它利用多项式在 `n` 个非 0 位置的值,来计算其在 `0` 处的值。前面的 `n` 指的是多项式的阶数。这个过程的原理是,可以为一个多项式找到一个显示方程,使其满足:其在 `t[0]` 处的值是 `1`,在 `i` 不为 `0` 的时候,其在 `t[i]` 处的值是 `0`。因多项式值的计算属于线性运算,需要计算 *这些* 多项式各自的值,并使用多项式的值进行插值: + +``` +from functools import reduce +from operator import mul + +def retrieve_original(secrets): +    x_s = [s[0] for s in secrets] +    acc = Mod(0, P) +    for i in range(len(secrets)): +        others = list(x_s) +        cur = others.pop(i) +        factor = Mod(1, P) +        for el in others: +            factor *= el * (el - cur).inverse() +        acc += factor * secrets[i][1] +    return acc +``` + +这代码是在太复杂了,40 天能算出结果已经够快了。雪上加霜的是,他们只能利用五个秘密片段中的三个来完成这个运算,这让他们万分紧张: + +``` +retrieved_secret = retrieve_original(retrieved) +``` + +后事如何? + +``` +retrieved_secret == secret +``` +``` +TRUE +``` + +数学这个魔术的优美之处就在于它每一次都是那么靠谱,无一例外。国王的孩子们,曾经的孩童,而今已是壮年,足以理解先王的初衷,并以先王的锦囊妙计保卫了国家,并继之以繁荣昌盛! + +### 关于 Shamir 秘密共享算法的现代故事 + +现代,很多人都对类似的大秘密苦不堪言:密码管理器的主密码!几乎没有谁能有足够信任的人去完全托付自己最深的秘密,好消息是,找到至少有三个不会串通起来搞鬼的五人组不是个太困难的事。 + +同样是在现代,比较幸运的是,我们不必再像国王那样自己动手分割要守护的秘密。拜现代 *开源* 技术所赐,这都可以使用现成的软件完成。 + +假设你有五个不敢完全信任,但还可以有点信任的人:张三、李四、王五、赵六和钱大麻子。 + +安装并运行 `ssss` 分割密钥: + +``` +$ echo 'long legs travel fast' | ssss-split -t 3 -n 5 +Generating shares using a (3,5) scheme with dynamic security level. +Enter the secret, at most 128 ASCII characters: Using a 168 bit security level. +1-797842b76d80771f04972feb31c66f3927e7183609 +2-947925f2fbc23dc9bca950ef613da7a4e42dc1c296 +3-14647bdfc4e6596e0dbb0aa6ab839b195c9d15906d +4-97c77a805cd3d3a30bff7841f3158ea841cd41a611 +5-17da24ad63f7b704baed220839abb215f97d95f4f8 +``` + +这确实是个非常牛的主密码:`long legs travel fast`,绝不能把它完整的托付给任何人!那就把五个片段分别交给还比较可靠的伙伴,张三、李四、王五、赵六和钱大麻子。 + + * 把 `1` 给张三。 + * 把 `2` 给李四。 + * 把 `3` 给王五。 + * 把 `4` 给赵六。 + * 把 `5` 给钱大麻子。 + +然后,你开启你的惬意之旅,整整一个月,流连于海边温暖的沙滩,整整一个月,没碰过任何电子设备。没用多久,把自己的主密码忘到了九霄云外。 + +李四和王五也在和你一起旅行,你托付给他们保管的密钥片段保存的好好的,在他们各自的密码管理器中,但不幸的是,他们和你一样,也忘了自己的 *主密码*。 + +没关系。 + +联系张三,他保管的密钥片段是 `1-797842b76d80771f04972feb31c66f3927e7183609`;赵六,一直替你的班,很高兴你能尽快重返岗位,把自己掌握的片段给了你,`4-97c77a805cd3d3a30bff7841f3158ea841cd41a611`;钱大麻子,收到你给的跑腿费才将自己保管的片段翻出来发给你,`5-17da24ad63f7b704baed220839abb215f97d95f4f8`。 + +有了这三个密钥片段,运行: + +``` +$ ssss-combine -t 3 +Enter 3 shares separated by newlines: +Share [1/3]: 1-797842b76d80771f04972feb31c66f3927e7183609 +Share [2/3]: 4-97c77a805cd3d3a30bff7841f3158ea841cd41a611 +Share [3/3]: 5-17da24ad63f7b704baed220839abb215f97d95f4f8 +Resulting secret: long legs travel fast +``` + +就这么简单,有了 *开源* 技术加持,你也可以活的像国王一样滋润! + +### 自己的安全不是自己一个人的事 + +密码管理是当今网络生活必备技能,当然要选择复杂的密码,来保证安全性,但这不是全部。来用 Shamir 秘密共享算法,和他人共同安全的存储你的密码吧。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/6/python-passwords + +作者:[Moshe Zadka][a] +选题:[lujun9972][b] +译者:[silentdawn-zz](https://github.com/silentdawn-zz) +校对:[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://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/search_find_code_python_programming.png?itok=ynSL8XRV (Searching for code) +[2]: https://monitor.firefox.com/security-tips +[3]: https://opensource.com/sites/default/files/uploads/password_strength-xkcd.png (XKCD comic on password strength) +[4]: https://imgs.xkcd.com/comics/password_strength.png +[5]: https://creativecommons.org/licenses/by-nc/2.5/ +[6]: https://en.wikipedia.org/wiki/Secret_sharing#Shamir's_scheme +[7]: https://opensource.com/article/18/5/cryptography-pki +[8]: https://en.wikipedia.org/wiki/Finite_field +[9]: https://en.wikipedia.org/wiki/Mersenne_prime +[10]: https://en.wikipedia.org/wiki/Field_(mathematics) +[11]: https://pypi.org/project/mod/ +[12]: https://en.wikipedia.org/wiki/Polynomial +[13]: https://www.math.usm.edu/lambers/mat772/fall10/lecture5.pdf diff --git a/published/202008/20200612 3 reasons to contribute to open source now.md b/published/202008/20200612 3 reasons to contribute to open source now.md new file mode 100644 index 0000000000..02ec8fa726 --- /dev/null +++ b/published/202008/20200612 3 reasons to contribute to open source now.md @@ -0,0 +1,76 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12505-1.html) +[#]: subject: (3 reasons to contribute to open source now) +[#]: via: (https://opensource.com/article/20/6/why-contribute-open-source) +[#]: author: (Jason Blais https://opensource.com/users/jasonblais) + +现在贡献开源的 3 个理由 +====== + +> 现在比以往任何时候都更是为开源做出贡献的理想时机。下面是为什么。 + +![](https://img.linux.net.cn/data/attachment/album/202008/11/101413or3y9jsjsu0999s4.jpg) + +开源软件已经[遍及世界][2]。从 Linux 和 MySQL 的早期开始,开源就以前所未有的方式推动创新,仅 GitHub 上就有 [180,000 个公共仓库][3]。 + +对于尚未进入开源世界的那些人,下面是如今天开始的三个原因。 + +### 建立你作为开发人员的信心 + +如果你还很年轻,在职业生涯初期,甚至只是在学习一种新的编程语言,那么开源是入门的最佳方法。 + +通过参与一个开源项目,你会立即收到有关你的开发和编程技能的反馈。你可能会获得有关如何选择函数名称、条件逻辑的使用方式或如何使用不了解的 goroutine 来加快程序执行速度的建议。这是你在学习新东西时获得的宝贵反馈。 + +此外,随着你创建更多的拉取请求并应用从先前提交的内容中学到的知识,你将开始学习如何编写良好的代码并[提交优秀的拉取请求进行代码审查][4]。最后,许多开源项目提供指导计划,以帮助指导你完成前几个贡献。这是一个非常友好、安全的环境,可树立你作为开发人员的信心。 + +有关例子故事,请阅读 [Allan Guwatudde 作为一名自学开发者在开源方面的经验][5]这篇文章。 + +### 丰富你的简历 + +即使你是一位经验丰富的开发人员,你也可能希望丰富自己的简历,以帮助职业发展和未来的寻找工作。也许你有兴趣探索新的前沿框架或新的编程模块,而你却没有机会在工作中用到。 + +你可以通过报名一个课程或在日常工作中找到一个方式引入这些概念来获得经验。但是,当这些选项不可用(或不希望使用)时,开源将提供绝佳的机会!除了建立技能和提高信心之外,所有开源贡献都是公开的,它们可以证明你已掌握的技能和已完成的项目。实际上,你的开源方面的个人资料本身可以为你提供强大的作品集,从而使你与其他应聘者脱颖而出。 + +此外,许多开源项目,例如 [Mattermost][6],允许你在 LinkedIn 上添加自己为贡献者,以直接提升自己的专业形象。 + +[阅读 Siyuan Liu 的旅程][7]这篇文章,了解如何从第一次开源贡献到两次成为 Mattermost 项目 MVP。 + +### 建立你的专业网络 + +建立强大的专业网络可以帮助你实现职业目标,了解有关你自己或相邻领域的更多信息,并有助于寻找工作。为开源做贡献是建立该网络的绝佳方法。你加入了一个由成百上千的贡献者组成的温馨社区,在开源空间中与志趣相投的开发人员进行互动,并一路建立联系。你甚至可能会被介绍给行业中的关键人物,例如知名的开源工具的维护者。这样的关系可以变成改变职业生涯的关系。 + +最后,为开源项目做贡献甚至可以让你找到工作!例如,[Mattermost][8] 已经从它的开源社区聘请了一些贡献者,全职在工程团队中工作。 + +### 从今天开始为开源做贡献 + +开源让你能够树立开发者的信心,建立简历和建立专业网络。而且,无论你的贡献大小,它都会对开源项目的未来产生直接影响。因此,许多项目都会向贡献者发放礼物以表示感谢(例如,[为所有首次贡献者送上一个定制的杯子][9])。 + +准备开始进入开源了吗?查看[这些开源项目][10]来进行首次开源贡献,或了解[如何为 Mattermost 做贡献][11]。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/6/why-contribute-open-source + +作者:[Jason Blais][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/jasonblais +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/lenovo-thinkpad-laptop-concentration-focus-windows-office.png?itok=-8E2ihcF (Woman using laptop concentrating) +[2]: https://techcrunch.com/2019/01/12/how-open-source-software-took-over-the-world/ +[3]: https://github.com/search?q=stars%3A%3E100&s=stars&type=Repositories +[4]: https://mattermost.com/blog/submitting-great-prs/ +[5]: https://mattermost.com/blog/building-confidence-and-gaining-experience-with-good-open-source-projects/ +[6]: https://docs.mattermost.com/overview/faq.html#can-contributors-add-themselves-to-the-mattermost-company-page-on-linkedin +[7]: https://mattermost.com/blog/open-source-contributor-journey-with-mattermost/ +[8]: https://mattermost.com/careers/ +[9]: https://forum.mattermost.org/t/limited-edition-mattermost-mugs/143 +[10]: https://firstcontributions.github.io/ +[11]: http://mattermost.com/contribute diff --git a/published/202008/20200616 Perform Common PDF Editing Tasks Like Merge, Split, Rotate With Free and Open Source PDF Mix Tool.md b/published/202008/20200616 Perform Common PDF Editing Tasks Like Merge, Split, Rotate With Free and Open Source PDF Mix Tool.md new file mode 100644 index 0000000000..1da4367b17 --- /dev/null +++ b/published/202008/20200616 Perform Common PDF Editing Tasks Like Merge, Split, Rotate With Free and Open Source PDF Mix Tool.md @@ -0,0 +1,142 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12523-1.html) +[#]: subject: (Perform Common PDF Editing Tasks Like Merge, Split, Rotate With Free and Open Source PDF Mix Tool) +[#]: via: (https://itsfoss.com/pdf-mix-tool/) +[#]: author: (Ankush Das https://itsfoss.com/author/ankush/) + +使用 PDF Mix Tool 执行常见的 PDF 编辑任务 +====== + +> PDF Mix Tool 是一个简单、轻巧的开源 PDF 编辑应用,可让你从 PDF 中提取页面、合并两个 PDF、从 PDF 中删除页面等。 + +![](https://img.linux.net.cn/data/attachment/album/202008/16/203411puozfr91f1pmzg9z.jpg) + +### PDF Mix Tool:一个简单的开源 PDF 编辑工具 + +![][1] + +有[几个可以在 Linux 中使用的 PDF 编辑器][2],我通常将它们分为两类: + + * 可让你编辑内容(注释、高亮、更改文本、添加/删除图像等)的 PDF 编辑器, + * 可让你通过合并、分割、提取页面等来修改文件的 PDF 编辑器。 + +[PDF Mix Tool][3] 属于第二类。它是用 C++ 和 Qt5 编写的开源软件。它可让你合并两个或更多 PDF 文件,并为每个文件指定页面,还有旋转页面、添加空白页、删除页面以及从 PDF 文件提取页面。 + +在本周的开源软件亮点中,让我们看一下使用 PDF Mix Tool。 + +### 使用 PDF Mix Tool 在 Linux 中编辑 PDF + +![][4] + +PDF Mix Tool 并没有很多功能,但是有一些非常重要的功能。 + +#### 合并 PDF 文件 + +![][5] + +你可以轻松合并多个 PDF 文件,同时指定确切的页面。它让你能够调整页面数、旋转,还能使用 “交替混合Alternate mix” 反转页面顺序合并。 + +![][6] + +你只需要单击 “添加 PDF 文件Add PDF File” 添加文件,然后使用可用的选项对其进行编辑(如上图所示),最后生成编辑的 PDF。 + +#### 旋转页面 + +你可以在合并多个文件或仅对单个 PDF 文件进行操作时旋转 PDF 文件的页面。 + +对于合并文件,你可以参考上面的截图。但是当你选择一个文件时,它看上去像这样: + +![][7] + +你有多种选择,但是要旋转页面,需要选择 “编辑页面布局Edit page layout” 选项,如上截图所示。 + +#### 添加或删除页面 + +要从其他 PDF 文件添加新页面,最好利用此选项。 + +但是,如果要添加空白页,你可以选择一个文件进行添加。不只是添加空白页面,还可以删除特定页面。下面的截图圈出了高亮选项: + +![][8] + +#### 从 PDF 文件提取页面 + +![][9] + +除了所有其他选项之外,你还可以从给定的 PDF 文件中提取特定页面(或全部)。你还可以为所有提取的页面生成一个新的 PDF 文件,或者为提取的每个页面制作单独的 PDF 文件。在许多场景中,它应该派上用场。 + +#### 其他功能 + +利用上面所有功能,你可以生成自己选择的全新 PDF,颠倒顺序、提取页面、制作单独的 PDF 文件等等。 + +它不会减小 PDF 文件的大小。你必须使用其他工具[在 Linux 中压缩 PDF 文件][10]。 + +因此,当你组合使用可用选项时,它是功能丰富的工具。 + +### 在 Linux 上安装 PDF Mix Tool + +![PDF Mix Tool in Ubuntu Software Center][11] + +PDF Mix Tool 存在于 Snap 和 [Flatpak 软件包][12]中。这意味着如果发行版支持这任意一种,你都可以在软件管理器中找到它。 + +或者,如果你[启用了 Snap 软件包支持][13],那么可以使用以下命令进行安装: + +``` +sudo snap install pdfmixtool +``` + +如果你想[使用 Flatpak][14],那么使用: + +``` +flatpak install flathub eu.scarpetta.PDFMixTool +``` + +如果你使用的是 Arch Linux,那么可以从[社区仓库][15]中获取。 + +``` +sudo pacman -S pdfmixtool +``` + +你也可以选择查看它的 [GitLab 页面][16]获取源码。 + +- [下载 PDF Mix Tool 源码][17] + +### 总结 + +它可能不是功能最丰富的 PDF 编辑工具,但考虑到它是轻量级的开源工具,因此它是已安装的应用中非常有用的。过去我们也介绍过类似的工具 [PDF Arranger][18]。你可能会想了解一下。 + +你如何看待它?你有尝试过么?在下面的评论中让我知道你的想法。 + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/pdf-mix-tool/ + +作者:[Ankush Das][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://itsfoss.com/author/ankush/ +[b]: https://github.com/lujun9972 +[1]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/06/pdf-mix-tool.png?ssl=1 +[2]: https://itsfoss.com/pdf-editors-linux/ +[3]: https://scarpetta.eu/pdfmixtool/ +[4]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/06/pdf-mix-tool-merge.png?ssl=1 +[5]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/06/pdf-mix-tool-edit.png?ssl=1 +[6]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/06/pdf-mix-tool-merge-edit.png?ssl=1 +[7]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/06/pdf-mix-tool-layout.png?ssl=1 +[8]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/06/pdf-mix-tool-add-delete.png?ssl=1 +[9]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/06/pdf-mix-tool-extract.png?ssl=1 +[10]: https://itsfoss.com/compress-pdf-linux/ +[11]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/06/pdf-mix-tool-ubuntu.png?ssl=1 +[12]: https://flathub.org/apps/details/eu.scarpetta.PDFMixTool +[13]: https://itsfoss.com/install-snap-linux/ +[14]: https://itsfoss.com/flatpak-guide/ +[15]: https://www.archlinux.org/packages/community/x86_64/pdfmixtool/ +[16]: https://gitlab.com/scarpetta/pdfmixtool +[17]: https://www.scarpetta.eu/pdfmixtool/ +[18]: https://itsfoss.com/pdfarranger-app/ diff --git a/published/202008/20200623 Jitsi Meet- A Free - Open Source Video Conferencing Solution That is Also Free to Use Without Any Set Up.md b/published/202008/20200623 Jitsi Meet- A Free - Open Source Video Conferencing Solution That is Also Free to Use Without Any Set Up.md new file mode 100644 index 0000000000..48a344eca5 --- /dev/null +++ b/published/202008/20200623 Jitsi Meet- A Free - Open Source Video Conferencing Solution That is Also Free to Use Without Any Set Up.md @@ -0,0 +1,131 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12484-1.html) +[#]: subject: (Jitsi Meet: A Free & Open Source Video Conferencing Solution That is Also Free to Use Without Any Set Up) +[#]: via: (https://itsfoss.com/jitsi-meet/) +[#]: author: (Ankush Das https://itsfoss.com/author/ankush/) + +Jitsi Meet:自由开源的视频会议解决方案,无需设置即可免费使用 +====== + +> Jitsi Meet 是一个开源视频会议服务,你可以免费使用它来组织在线课程、会议和聚会。你也可以在自己的服务器上托管 Jitsi。 + +在 COVID-19 大流行期间,远程工作趋势显著增长。无论你是否喜欢,视频会议对于个人和企业都是一个很好的解决方案。 + +在过去的几个月中,非常流行的视频会议服务之一就是 Zoom。但是,[关于 Zoom 视频通话][1]存在很多安全和隐私问题。 + +因此,选择一个安全且易于使用的视频会议应用来完成工作是很重要的。我敢肯定有很多选择,但是在这里,让我们看一下开源选项 [Jitsi Meet][2]。 + +### Jitsi Meet:免费使用的开源视频会议服务 + +![][3] + +Jitsi Meet 是开源语音、视频会议和即时消息服务 [Jitsi][4] 集合的一部分。 + +通过 Jitsi Meet,你可以即刻主持群组视频通话(即视频会议),你甚至都不需要建立帐户。 + +对于桌面端,它是基于浏览器的,但它以 AppImage 的形式为 Linux 提供了一个基于 Electron 的桌面应用。它也可以用在 Windows 和 macOS 上。 + +对于智能手机,它提供了 iOS 和 Android 应用,你可以分别从 App Store 和 Play Store 进行安装。除了这些,你还可以在开源 Android 应用商店 [F-Droid][5] 中找到它。 + +如果你想更进一步,你可以在你的服务器上部署 Jitsi Meet。对于那些不想使用第三方服务器的企业来说,这是理想的选择,即使该服务器来自软件开发商。 + +### Jitsi Meet 的功能 + +![][6] + +Jitsi Meet 简单但功能丰富。这是你将获得的功能: + + * 不需要用户注册 + * 使用 Etherpad 共同编辑文档 + * 能够自己部署 + * 支持集成 Slack 和 Rocket.chat + * 如果需要,提供密码保护 + * 端到端加密(beta 版) + * 背景模糊(beta 版) + * 录音选项 + * 直播流支持 + * YouTube 视频分享 + * 查看用户的网络状态 + * 集成 Google 和 Microsoft 日历 + * 聊天功能 + * 屏幕共享 + * 支持国际连接拨入 + * 你可以稍后继续视频通话,而无需会议代码 + * 低带宽模式选项 + * Jitsi 可选的桌面版本 + +![][7] + +出于显而易见的原因,你在移动应用上只能找到较少的功能。 + +请注意,[端到端加密仍处于 beta 阶段][8]。但是,即使没有它,Jitsi Meet 也应该是一个隐私友好且安全的视频会议解决方案。 + +在移动设备上,我只希望它有屏幕共享功能。除此之外,其他所有功能都很好。 + +### 如何使用 Jitsi Meet? + +![][9] + +要使它在 Linux 上运行,你不需要做任何其他事情。你只需要前往它的[官方 Jitsi Meet 实例][2],然后输入会议名称即可创建或加入。 + +如果您使用的是基于 Electron的应用程序,则完全一样。 使用桌面应用程序时的外观如下: + +![](https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/06/jitsi-meet-electron.png?w=800&ssl=1) + +如你在上面的截图中所见,你还可以找到你最近使用的会议室的列表,这样就不必再次输入或创建会议室。 + +![][10] + +如果你要创建它,那么最好使用唯一的名称,并且如果你不需要其他任何人意外加入,那么还应为其添加密码保护。 + +![][11] + +如果你要参加其他人的会议,只需询问会议名称或会议链接即可使用台式机或智能手机轻松加入。 + +除了少一些功能,它与桌面端的工作方式相同。我已经使用了一段时间,并且还鼓励和培训了我父亲的单位(我们的附近学校)使用 Jitsi Meet 主持在线课程。 + +即使有最多 75 名参与者的限制,它的表现也很好,而且工作良好。 + +[Jitsi Meet][12] + +### 总结 + +如果你希望托管自己的 Jitsi 实例,建议你遵循它的[官方自托管指南][13]来启动并运行它。你还可以在[它的 GitHub 页面中找到实例列表][14]。 + +Jitsi Meet 是个了不起的开源视频会议应用。它是 Zoom 和其他此类视频通话服务的一种隐私保护替代方案。 + +我还建议查看 [NextCloud,它是 MS Office 365 的开源替代方案][15]。 + +你如何看待 Jitsi Meet?你尝试过了吗?你最喜欢的视频会议工具是什么? + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/jitsi-meet/ + +作者:[Ankush Das][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://itsfoss.com/author/ankush/ +[b]: https://github.com/lujun9972 +[1]: https://www.tomsguide.com/news/zoom-security-privacy-woes +[2]: https://meet.jit.si/ +[3]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/06/jitsi-meet-screenshot.png?ssl=1 +[4]: https://jitsi.org/ +[5]: https://f-droid.org/en/packages/org.jitsi.meet/ +[6]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/06/jitsi-meet-smartphones.jpg?ssl=1 +[7]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/06/jitsi-options-desktop.png?ssl=1 +[8]: https://jitsi.org/blog/e2ee/ +[9]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/06/jitsi-meet-use.resized.png?ssl=1 +[10]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/06/jitsi-meet-browser-screenshot.png?ssl=1 +[11]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/06/jitsi-meet-password.png?ssl=1 +[12]: https://meet.jit.si +[13]: https://jitsi.github.io/handbook/docs/devops-guide/devops-guide-quickstart +[14]: https://github.com/jitsi/jitsi-meet/wiki/Jitsi-Meet-Instances +[15]: https://itsfoss.com/nextcloud/ diff --git a/published/202008/20200706 Set up Vim as your Rust IDE.md b/published/202008/20200706 Set up Vim as your Rust IDE.md new file mode 100644 index 0000000000..24d86798e8 --- /dev/null +++ b/published/202008/20200706 Set up Vim as your Rust IDE.md @@ -0,0 +1,200 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12530-1.html) +[#]: subject: (Set up Vim as your Rust IDE) +[#]: via: (https://opensource.com/article/20/7/vim-rust-ide) +[#]: author: (Daniel Oh https://opensource.com/users/daniel-oh) + +将 Vim 设置为 Rust IDE +====== + +> Vim 编辑器是很好的 Rust 应用开发环境。 + +![Ferris the crab under the sea, unofficial logo for Rust programming language][1] + +[Rust][2] 语言旨在以 C++ 开发人员熟悉的方式实现具有安全并发性和高内存性能的系统编程。它也是 [Stack Overflow 的 2019 年开发人员调查][3]中最受欢迎的编程语言之一。 + +文本编辑器和[集成开发环境(IDE)工具][4]使编写 Rust 代码更加轻松快捷。有很多编辑器可供选择,但是我相信 [Vim 编辑器][5]非常适合作为 Rust IDE。在本文中,我将说明如何为 Rust 应用开发设置 Vim。 + +### 安装 Vim + +Vim 是 Linux 和 Unix 中最常用的命令行文本编辑器之一。最新版本(在编写本文时)是 [8.2][6],它在使用方式上提供了前所未有的灵活性。 + +[Vim 的下载页面][7]提供了多种二进制或软件包形式安装。例如,如果使用 macOS,那么可以安装 [MacVim][8] 项目,然后通过[安装 Vim 插件][9] 扩展 Vim 的功能。 + +要设置 Rust 进行开发,请下载 [Rustup][10],这是一个方便的 Rust 安装器工具,并在你的终端上运行以下命令(如果你使用 macOS、Linux 或任何其他类 Unix 系统): + +``` +$ curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh +``` + +在提示中选择安装选项。然后,你将看到如下输出: + +``` +stable installed - rustc 1.43.1 (8d69840ab 2020-05-04) + +Rust is installed now. Great! + +To get started you need Cargo's bin directory ($HOME/.cargo/bin) in your PATH +environment variable. Next time you log in this will be done +automatically. + +To configure your current shell run source $HOME/.cargo/env +``` + +### 语法高亮 + +Vim 能让你通过 `.vimrc` 文件配置你的运行时环境。要启用语法高亮,请打开 `.vimrc` 文件(如果不存在就创建一个): + +``` +$ vim ~/.vimrc +``` + +在 `.vimrc` 中添加以下内容并保存: + +``` +filetype plugin indent on +syntax on +``` + +第一行同时打开检测、插件和缩进配置。第二行启用语法高亮。这些功能将帮助你在 Rust 中管理开发流程。在 Vim 的[帮助文件][11]中了解更多信息。 + +### 在 Vim 中创建一个 Rust 应用 + +要使用 Vim 创建一个新的 Rust HelloWorld 应用(`hello.rs`),请输入: + +``` +$ vim hello.rs +``` + +输入以下 Rust 代码在控制台中打印 `Hello World!`: + +``` +fn main() { +   println!("Hello World"); +} +``` + +它看起来应该像这样: + +![Rust code with syntax highlighting][12] + +没有语法高亮的样子如下: + +![Rust code without syntax highlighting][14] + +你是否注意到 Vim 自动缩进和组织代码?那是因为你在 `.vimrc` 文件中输入了第一行。 + +很好!接下来,你将使用 Rust 的包管理器 [Cargo][15] 构建此应用。 + +### Cargo 集成 + +Cargo 使创建应用更加容易。要查看操作方法,请创建一个基于 Cargo 的 HelloWorld 应用。如果你尚未在 Linux 或 macOS 系统上安装 Cargo,请输入: + +``` +$ curl https://sh.rustup.rs -sSf | sh +``` + +然后使用 Cargo 创建包: + +``` +$ cargo new my_hello_world +``` + +如果查看目录结构,你会看到 Cargo 自动生成一些源码和目录。如果你安装了 `tree`,请运行它查看目录结构: + +``` +$ tree my_hello_world +my_hello_world +├── Cargo.toml +└── src +    └── main.rs + +1 directory, 2 files +``` + +在 Vim 中打开 `main.rs` 源码文件: + +``` +$ vim my_hello_world/src/main.rs +``` + +它与你在上面手动创建的 HelloWorld 示例中的代码相同。用 `Rust with Vim` 代替 `World`: + +``` + fn main() { +      println!("Hello, Rust with Vim"); + } +``` + +使用 `:wq` 保存更改并退出 Vim。 + +### 编译你的应用 + +现在你可以使用 `cargo build` 编译你的第一个 Rust 应用: + + +``` +$ cd my_hello_world +$ cargo build +``` + +你的终端输出将类似于以下内容: + +``` +   Compiling my_hello_world v0.1.0 (/Users/danieloh/cloud-native-app-dev/rust/my_hello_world) + +    Finished dev [unoptimized + debuginfo] target(s) in 0.60s +``` + +你可能会看到一条警告消息,因为你重用了示例包名 `my_hello_world`,但现在可以忽略它。 + +运行应用: + +``` +$ target/debug/my_hello_world +Hello, Rust with Vim! +``` + +你也可以使用 `cargo run` 一次构建和运行应用: + +``` +$ cargo run +  +    Finished dev [unoptimized + debuginfo] target(s) in 0.00s +     Running `target/debug/my_hello_world` +Hello, Rust with Vim!! +``` + +恭喜!你在本地的 Vim 编辑器中设置了 Rust IDE,开发了第一个 Rust 应用,并使用 Cargo 包管理器工具构建、测试和运行了它。如果你想学习其他 Cargo 命令,请运行 `cargo help`。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/7/vim-rust-ide + +作者:[Daniel Oh][a] +选题:[lujun9972][b] +译者:[geekpi](https://github.com/geekpi) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/daniel-oh +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/rust_programming_crab_sea.png?itok=2eWLz8A5 (Ferris the crab under the sea, unofficial logo for Rust programming language) +[2]: https://www.rust-lang.org/ +[3]: https://insights.stackoverflow.com/survey/2019#technology-_-most-loved-dreaded-and-wanted-languages +[4]: https://en.wikipedia.org/wiki/Integrated_development_environment +[5]: https://opensource.com/resources/what-vim +[6]: https://github.com/vim/vim +[7]: https://www.vim.org/download.php +[8]: https://github.com/macvim-dev/macvim +[9]: https://opensource.com/article/20/2/how-install-vim-plugins +[10]: https://rustup.rs/ +[11]: http://vimdoc.sourceforge.net/htmldoc/filetype.html#:filetype-overview +[12]: https://opensource.com/sites/default/files/uploads/rust_helloworld.png (Rust code with syntax highlighting) +[13]: https://creativecommons.org/licenses/by-sa/4.0/ +[14]: https://opensource.com/sites/default/files/uploads/rust_helloworld_no-syntax.png (Rust code without syntax highlighting) +[15]: https://opensource.com/article/20/3/rust-cargo diff --git a/published/202008/20200710 Use DNS over TLS.md b/published/202008/20200710 Use DNS over TLS.md new file mode 100644 index 0000000000..9b55039cf6 --- /dev/null +++ b/published/202008/20200710 Use DNS over TLS.md @@ -0,0 +1,171 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12483-1.html) +[#]: subject: (Use DNS over TLS) +[#]: via: (https://fedoramagazine.org/use-dns-over-tls/) +[#]: author: (Thomas Bianchi https://fedoramagazine.org/author/thobianchi/) + +使用 DNS over TLS +====== + +![][1] + +现代计算机用来在互联网种查找资源的[域名系统(DNS)][2] 是在 [35 年前][3]设计的,没有考虑用户隐私。它会面临安全风险和攻击,例如 [DNS 劫持][4]。它还能让 [ISP][5] 拦截查询。 + +幸运的是,现在有 [DNS over TLS][6] 和 [DNSSEC][7] 两种技术。DNS over TLS 和 DNSSEC 允许创建从计算机到它配置的 DNS 服务器之间的安全且加密的端到端隧道。在 Fedora 上,部署这些技术的步骤很容易,并且所有必要的工具也很容易获得。 + +本指南将演示如何使用 `systemd-resolved` 在 Fedora 上配置 DNS over TLS。有关 `systemd-resolved` 服务的更多信息,请参见[文档][8]。 + +### 步骤 1:设置 systemd-resolved + +类似于下面所示修改 `/etc/systemd/resolved.conf`。确保启用 DNS over TLS 并配置要使用的 DNS 服务器的 IP 地址。 + +``` +$ cat /etc/systemd/resolved.conf +[Resolve] +DNS=1.1.1.1 9.9.9.9 +DNSOverTLS=yes +DNSSEC=yes +FallbackDNS=8.8.8.8 1.0.0.1 8.8.4.4 +#Domains=~. +#LLMNR=yes +#MulticastDNS=yes +#Cache=yes +#DNSStubListener=yes +#ReadEtcHosts=yes +``` + +关于选项的简要说明: + + * `DNS`:以空格分隔的 IPv4 和 IPv6 地址列表,用作系统 DNS 服务器。 + * `FallbackDNS`:以空格分隔的 IPv4 和 IPv6 地址列表,用作后备 DNS 服务器。 + * `Domains`:在解析单标签主机名时,这些域名用于搜索后缀。 `~.` 代表对于所有域名,优先使用 `DNS=` 定义的系统 DNS 服务器。 + * `DNSOverTLS`:如果启用,那么将加密与服务器的所有连接。请注意,此模式要求 DNS 服务器支持 DNS-over-TLS,并具有其 IP 的有效证书。 + +> 注意:上面示例中列出的 DNS 服务器是我个人的选择。你要确定要使用的 DNS 服务器。要注意你要向谁请求 IP。 + +### 步骤 2:告诉 NetworkManager 将信息推给 systemd-resolved + +在 `/etc/NetworkManager/conf.d` 中创建一个名为 `10-dns-systemd-resolved.conf` 的文件。 + +``` +$ cat /etc/NetworkManager/conf.d/10-dns-systemd-resolved.conf +[main] +dns=systemd-resolved +``` + +上面的设置(`dns=systemd-resolved`)让 `NetworkManager` 将从 DHCP 获得的 DNS 信息推送到 `systemd-resolved` 服务。这将覆盖*步骤 1* 中配置的 DNS 设置。这在受信任的网络中没问题,但是也可以设置为 `dns=none` 从而使用 `/etc/systemd/resolved.conf` 中配置的 DNS 服务器。 + +### 步骤 3: 启动和重启服务 + +若要使上述步骤中的配置生效,请启动并启用 `systemd-resolved` 服务。然后重启 `NetworkManager` 服务。 + +注意:在 `NetworkManager` 重启时,连接会中断几秒钟。 + +``` +$ sudo systemctl start systemd-resolved +$ sudo systemctl enable systemd-resolved +$ sudo systemctl restart NetworkManager +``` + +> 注意:目前,systemd-resolved 服务默认处于禁用状态,是可选使用的。[有计划][33]在 Fedora 33 中默认启用systemd-resolved。 + +### 步骤 4:检查是否一切正常 + +现在,你应该在使用 DNS over TLS。检查 DNS 解析状态来确认这一点: + +``` +$ resolvectl status +MulticastDNS setting: yes + DNSOverTLS setting: yes + DNSSEC setting: yes + DNSSEC supported: yes + Current DNS Server: 1.1.1.1 + DNS Servers: 1.1.1.1 + 9.9.9.9 +Fallback DNS Servers: 8.8.8.8 + 1.0.0.1 + 8.8.4.4 +``` + +`/etc/resolv.conf` 应该指向 `127.0.0.53`。 + +``` +$ cat /etc/resolv.conf +# Generated by NetworkManager +search lan +nameserver 127.0.0.53 +``` + +若要查看 `systemd-resolved` 发送和接收安全查询的地址和端口,请运行: + +``` +$ sudo ss -lntp | grep '\(State\|:53 \)' +State Recv-Q Send-Q Local Address:Port Peer Address:Port Process +LISTEN 0 4096 127.0.0.53%lo:53 0.0.0.0:* users:(("systemd-resolve",pid=10410,fd=18)) +``` + +若要进行安全查询,请运行: + +``` +$ resolvectl query fedoraproject.org +fedoraproject.org: 8.43.85.67 -- link: wlp58s0 + 8.43.85.73 -- link: wlp58s0 + +[..] + +-- Information acquired via protocol DNS in 36.3ms. +-- Data is authenticated: yes +``` + +### 额外步骤 5:使用 Wireshark 验证配置 + +首先,安装并运行 [Wireshark][10]: + +``` +$ sudo dnf install wireshark +$ sudo wireshark +``` + +它会询问你在哪个设备上捕获数据包。在我这里,因为我使用无线接口,我用的是 `wlp58s0`。在 Wireshark 中设置筛选器,`tcp.port == 853`(853 是 DNS over TLS 协议端口)。在捕获 DNS 查询之前,你需要刷新本地 DNS 缓存: + +``` +$ sudo resolvectl flush-caches +``` + +现在运行: + +``` +$ nslookup fedoramagazine.org +``` + +你应该会看到你的计算机和配置的 DNS 服务器之间的 TLS 加密交换: + +![][11] + +-------------------------------------------------------------------------------- + +via: https://fedoramagazine.org/use-dns-over-tls/ + +作者:[Thomas Bianchi][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://fedoramagazine.org/author/thobianchi/ +[b]: https://github.com/lujun9972 +[1]: https://fedoramagazine.org/wp-content/uploads/2020/06/use-dns-over-tls-816x345.jpg +[2]: https://en.wikipedia.org/wiki/Domain_Name_System +[3]: https://tools.ietf.org/html/rfc1035 +[4]: https://en.wikipedia.org/wiki/DNS_hijacking +[5]: https://en.wikipedia.org/wiki/Internet_service_provider +[6]: https://en.wikipedia.org/wiki/DNS_over_TLS +[7]: https://en.wikipedia.org/wiki/Domain_Name_System_Security_Extensions +[8]: https://www.freedesktop.org/wiki/Software/systemd/resolved/ +[9]: https://fedoraproject.org/wiki/Changes/systemd-resolved +[10]: https://www.wireshark.org/ +[11]: https://fedoramagazine.org/wp-content/uploads/2020/06/1-1024x651.png diff --git a/published/202008/20200713 4 Mac terminal customizations even a curmudgeon can love.md b/published/202008/20200713 4 Mac terminal customizations even a curmudgeon can love.md new file mode 100644 index 0000000000..3ea183bba5 --- /dev/null +++ b/published/202008/20200713 4 Mac terminal customizations even a curmudgeon can love.md @@ -0,0 +1,114 @@ +[#]: collector: (lujun9972) +[#]: translator: (wxy) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12536-1.html) +[#]: subject: (4 Mac terminal customizations even a curmudgeon can love) +[#]: via: (https://opensource.com/article/20/7/mac-terminal) +[#]: author: (Katie McLaughlin https://opensource.com/users/glasnt) + +凯蒂阿姨的自定义 Mac 终端 +====== + +> 开源意味着我可以在任何终端上找到熟悉的 Linux。 + +![](https://img.linux.net.cn/data/attachment/album/202008/21/002323xqslvqnnmdz487dq.jpg) + +十年前,我开始了我的第一份工作,它要求我使用 Linux 作为我的笔记本电脑的操作系统。如果我愿意的话,我可以使用各种 Linux 发行版,包括 Gentoo,但由于我过去曾短暂地使用过Ubuntu,所以我选择了 Ubuntu Lucid Lynx 10.04。 + +我的 [Konsole][2] 终端使用的是 [Zenburn][3] 主题,有一个类似于这样的 Bash 提示符: + +``` +machinename ~/path/to/folder $ +``` + +现在,我使用 Mac,具体来说是 macOS Catalina,我使用 [iTerm2][4] 与 [Zenburn 主题][5],zsh 提示符是这样的: + +``` +machinename ~/path/to/folder +$ +``` + +我想,十年来几乎相同的提示符,我已经赢得了*老古板*的称号,不过这只是标志着,我的喜好和习惯与现在耍酷的孩子们不一样而已。 + +仿佛是为了证明我的古板观点,我想改变我的终端和我的旧终端一样。在 Mac 上获得一个看起来和感觉像 Lucid Lynx 的设置并不简单,而且我很花了一些时间。 + +我最近最大的改变是从 Bash 转移到 zsh,并迁移了我的 [Bash 魔改][6]。但这只是其中一个重大的转变。我学到了许多新式的经验,现在我把这些经验赠送给你,亲爱的读者。 + +### Coreutils 对选项的顺序更宽容 + +从 Ubuntu 转移到 macOS 并没有太大的转变,直到我开始觉得我失去了 Unix 范。我试着运行一些基本的操作,比如删除文件夹,但却被告知我错误地调用了 `rm`。 + +事实证明,GNU 风格的实用程序可能看起来 BSD 风格的差不多,但最大的可用性差异之一是*参数顺序*。未命名参数的排列顺序并不一致。例如:`rm`。 + +下面是我们熟悉的 GNU 风格的删除目录的命令: + +``` +$ rm path/to/folder -rf +``` + +这与同一命令的 BSD 风格版本形成鲜明对比: + +``` +$ rm path/to/folder -rf +rm: path/to/folder: is a directory +rm: -rf: No such file or directory +``` + +我通过 [Homebrew][8] 安装 [Coreutils][7] 解决了这个问题。这将 GNU 实用程序引入到了 macOS,并使我不必为那些已经深深扎根于我的肌肉记忆中的命令记住选项顺序,从而对选项顺序更加宽容。 + +### 强大的 iTerm2 + +我不知道有哪个操作系统的资深用户会对默认终端满意。在 macOS 这块土地上,我选择了 [iTerm2][4],它允许我比基本的操作系统终端应用更灵活。我最喜欢的 iTerm 强大功能之一是能够使用 `Command+D` 和 `Command+Shift+D` 来垂直和水平分割窗格。还有很多技巧需要学习,但仅是简单的分割窗格就值得用 iTerm2 换掉默认终端。 + +### 上下文感知的插件 + +即使是一个古板的用户也会自定义终端提示,其中一个原因是为了获得一些情境感知。我喜欢终端给我提供上下文,并回答所有想到的问题。不仅仅是我在哪个文件夹里,而是:我在什么机器上?这是个 Git 仓库吗?如果是,我在哪个分支?我是在 Python 虚拟环境中吗? + +这些问题的答案最终都归结为一类称之为“上下文感知插件”的终端扩展。 + +对于当前的 Git 分支,我使用了这个 [parse_git_branch()][9] 方法(如果你使用的是 [Oh My Zsh][10],也有类似的插件)。对于 Python 来说,virtualenv 会自动给提示符加前缀。Oh My Zsh 有如此多的[插件][11],你一定能找到改善你生活的东西。 + +至于我的本地机?我就直接用 `PS1` 格式,因为我喜欢这样的基本信息,而且 macOS 并没有*真正*让你给机器起个名字。 + +### 多行提示符也不错 + +观察力强的读者可能会注意到,十年来我的提示符有一个变化,就是现在它是两行。这是最近的一个变化,我慢慢学会了喜欢,因为我前面提到的所有这些插件都让我的提示符变得很长很长。你在文件系统中导航不能太深,要不你试图做任何基本的事情都会输入换行。随之而来的是偶尔的重绘问题和可读性问题。 + +我收到的关于解决这个问题的建议大多围绕着“哦,你在用 zsh?用 [Powerlevel10k][12] 吧!”这对于像我这样不固步自封的人来说是不错的,但我能够从这些主题中学习到一些,并从中获取一点技巧。 + +我所做的是在我的提示符中的最后一个 `$` 前加一个 `$'\n'`,这样我的上下文信息 —— 当前机器、当前文件夹、当前 GitHub 分支、当前 virtualenv 等等 —— 都可以在一行中出现,然后我的命令就可以顺利输入了。 + +我发现唯一的问题是学会在哪里*看*。我习惯于让我的眼睛从行的中心开始,因为以前我的提示符就是从那里开始的。我正在慢慢学会向左看提示符,但这是一个缓慢的过程。我有十几年的眼睛习惯要撤销。 + +### 使用适合你的方法 + +如果你喜欢某种风格或工具,那么你的这种偏好是绝对有效的。你可以尝试其他的东西,但千万不要认为你必须使用最新和最伟大的,只是为了像很酷的孩子一样。你的风格和喜好可以随着时间的推移而改变,但千万不要被迫做出对你来说不舒服的改变。 + +*等下一次,凯蒂阿姨再给你吐槽一下 IDE。* + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/7/mac-terminal + +作者:[Katie McLaughlin][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/glasnt +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/coffee_cafe_brew_laptop_desktop.jpg?itok=G-n1o1-o (Coffee and laptop) +[2]: https://konsole.kde.org/ +[3]: https://github.com/brson/zenburn-konsole +[4]: https://www.iterm2.com/ +[5]: https://gist.github.com/fooforge/3373215 +[6]: https://opensource.com/article/20/1/bash-scripts-aliases +[7]: https://formulae.brew.sh/formula/coreutils +[8]: https://opensource.com/article/20/6/homebrew-mac +[9]: https://gist.github.com/kevinchappell/09ca3805a9531b818579 +[10]: https://github.com/ohmyzsh/ohmyzsh/tree/master/plugins/git +[11]: https://github.com/ohmyzsh/ohmyzsh/wiki/Plugins +[12]: https://github.com/romkatv/powerlevel10k diff --git a/published/202008/20200715 An example of very lightweight RESTful web services in Java.md b/published/202008/20200715 An example of very lightweight RESTful web services in Java.md new file mode 100644 index 0000000000..4c8d4f9857 --- /dev/null +++ b/published/202008/20200715 An example of very lightweight RESTful web services in Java.md @@ -0,0 +1,682 @@ +[#]: collector: (lujun9972) +[#]: translator: (Yufei-Yan) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12555-1.html) +[#]: subject: (An example of very lightweight RESTful web services in Java) +[#]: via: (https://opensource.com/article/20/7/restful-services-java) +[#]: author: (Marty Kalin https://opensource.com/users/mkalindepauledu) + +一个用 Java 实现的超轻量级 RESTful Web 服务示例 +====== + +> 通过管理一套图书的完整代码示例,来探索轻量级的 RESTful 服务。 + +![](https://img.linux.net.cn/data/attachment/album/202008/27/071808tt9zlno3b6lmbgl8.jpg) + +Web 服务,以这样或那样的形式,已经存在了近二十年。比如,[XML-RPC 服务][2]出现在 90 年代后期,紧接着是用 SOAP 分支编写的服务。在 XML-RPC 和 SOAP 这两个开拓者之后出现后不久,REST 架构风格的服务在大约 20 年前也出现了。[REST][4] 风格(以下简称 Restful)服务现在主导了流行的网站,比如 eBay、Facebook 和 Twitter。尽管分布式计算的 Web 服务有很多替代品(如 Web 套接字、微服务和远程过程调用的新框架),但基于 Restful 的 Web 服务依然具有吸引力,原因如下: + + * Restful 服务建立在现有的基础设施和协议上,特别是 Web 服务器和 HTTP/HTTPS 协议。一个拥有基于 HTML 的网站的组织可以很容易地为客户添加 Web 服务,这些客户对数据和底层功能更感兴趣,而不是对 HTML 的表现形式感兴趣。比如,亚马逊就率先通过网站和 Web 服务(基于 SOAP 或 Restful)提供相同的信息和功能。 + * Restful 服务将 HTTP 当作 API,因此避免了复杂的软件分层,这种分层是基于 SOAP 的 Web 服务的明显特征。比如,Restful API 支持通过 HTTP 命令(POST-GET-PUT-DELETE)进行标准的 CRUD(增加-读取-更新-删除)操作;通过 HTTP 状态码可以知道请求是否成功或者为什么失败。 + * Restful Web 服务可以根据需要变得简单或复杂。Restful 是一种风格,实际上是一种非常灵活的风格,而不是一套关于如何设计和构造服务的规定。(伴随而来的缺点是,可能很难确定哪些服务不能算作 Restful 服务。) + * 作为使用者或者客户端,Restful Web 服务与语言和平台无关。客户端发送 HTTP(S) 请求,并以适合现代数据交换的格式(如 JSON)接收文本响应。 + * 几乎每一种通用编程语言都至少对 HTTP/HTTPS 有足够的(通常是强大的)支持,这意味着 Web 服务的客户端可以用这些语言来编写。 + +这篇文章将通过一段完整的 Java 代码示例来探讨轻量级的 Restful 服务。 + +### 基于 Restful 的“小说” Web 服务 + +基于 Restful 的“小说” web 服务包含三个程序员定义的类: + + * `Novel` 类代表一个小说,只有三个属性:机器生成的 ID、作者和标题。属性可以根据实际情况进行扩展,但我还是想让这个例子看上去更简单一些。 + * `Novels` 类包含了用于各种任务的工具类:将一个 `Novel` 或者它们的列表的纯文本编码转换成 XML 或者 JSON;支持在小说集合上进行 CRUD 操作;以及从存储在文件中的数据初始化集合。`Novels` 类在 `Novel` 实例和 servlet 之间起中介作用。 + * `NovelsServlet` 类是从 `HttpServlet` 中继承的,`HttpServlet` 是一段健壮且灵活的代码,自 90 年代末的早期企业级 Java 就已经存在了。对于客户端的 CRUD 请求,servlet 可以当作 HTTP 的端点。 servlet 代码主要用于处理客户端的请求和生成相应的响应,而将复杂的细节留给 `Novels` 类中的工具类进行处理。 + +一些 Java 框架,比如 Jersey(JAX-RS)和 Restlet,就是为 Restful 服务设计的。尽管如此,`HttpServlet` 本身为完成这些服务提供了轻量、灵活、强大且充分测试过的 API。我会通过下面的“小说”例子来说明。 + +### 部署“小说” Web 服务 + +当然,部署“小说” Web 服务需要一个 Web 服务器。我的选择是 [Tomcat][5],但是如果该服务托管在 Jetty 或者甚至是 Java 应用服务器上,那么这个服务应该至少可以工作(著名的最后一句话!)。[在我的网站上][6]有总结了如何安装 Tomcat 的 README 文件和代码。还有一个附带文档的 Apache Ant 脚本,可以用来构建“小说”服务(或者任何其他服务或网站),并且将它部署在 Tomcat 或相同的服务。 + +Tomcat 可以从它的[官网][7]上下载。当你在本地安装后,将 `TOMCAT_HOME` 设置为安装目录。有两个子目录值得关注: + + * `TOMCAT_HOME/bin` 目录包含了类 Unix 系统(`startup.sh` 和 `shutdown.sh`)和 Windows(`startup.bat` 和 `shutdown.bat`) 的启动和停止脚本。Tomcat 作为 Java 应用程序运行。Web 服务器的 servlet 容器叫做 Catalina。(在 Jetty 中,Web 服务器和容器的名字一样。)当 Tomcat 启动后,在浏览器中输入 `http://localhost:8080/` 可以查看详细文档,包括示例。 + * `TOMCAT_HOME/webapps` 目录是已部署的 Web 网站和服务的默认目录。部署网站或 Web 服务的直接方法是复制以 `.war` 结尾的 JAR 文件(也就是 WAR 文件)到 `TOMCAT_HOME/webapps` 或它的子目录下。然后 Tomcat 会将 WAR 文件解压到它自己的目录下。比如,Tomcat 会将 `novels.war` 文件解压到一个叫做 `novels` 的子目录下,并且保留 `novels.war` 文件。一个网站或 Web 服务可以通过删除 WAR 文件进行移除,也可以用一个新版 WAR 文件来覆盖已有文件进行更新。顺便说一下,调试网站或服务的第一步就是检查 Tomcat 已经正确解压 WAR 文件;如果没有的话,网站或服务就无法发布,因为代码或配置中有致命错误。 + * 因为 Tomcat 默认会监听 8080 端口上的 HTTP 请求,所以本机上的 URL 请求以 `http://localhost:8080/` 开始。 + +通过添加不带 `.war` 后缀的 WAR 文件名来访问由程序员部署的 WAR 文件: + +``` +http://locahost:8080/novels/ +``` + +如果服务部署在 `TOMCAT_HOME` 下的一个子目录中(比如,`myapps`),这会在 URL 中反映出来: + +``` +http://locahost:8080/myapps/novels/ +``` + +我会在靠近文章结尾处的测试部分提供这部分的更多细节。 + +如前所述,我的主页上有一个包含 Ant 脚本的 ZIP 文件,这个文件可以编译并且部署网站或者服务。(这个 ZIP 文件中也包含一个 `novels.war` 的副本。)对于“小说”这个例子,命令的示例(`%` 是命令行提示符)如下: + +``` +% ant -Dwar.name=novels deploy +``` + +这个命令首先会编译 Java 源代码,并且创建一个可部署的 `novels.war` 文件,然后将这个文件保存在当前目录中,再复制到 `TOMCAT_HOME/webapps` 目录中。如果一切顺利,`GET` 请求(使用浏览器或者命令行工具,比如 `curl`)可以用来做一个测试: + +``` +% curl http://localhost:8080/novels/ +``` + +默认情况下,Tomcat 设置为 热部署hot deploys:Web 服务器不需要关闭就可以进行部署、更新或者移除一个 web 应用。 + +### “小说”服务的代码 + +让我们回到“小说”这个例子,不过是在代码层面。考虑下面的 `Novel` 类: + +#### 例 1:Novel 类 + +```java +package novels; + +import java.io.Serializable; + +public class Novel implements Serializable, Comparable { +    static final long serialVersionUID = 1L; +    private String author; +    private String title; +    private int id; + +    public Novel() { } + +    public void setAuthor(final String author) { this.author = author; } +    public String getAuthor() { return this.author; } +    public void setTitle(final String title) { this.title = title; } +    public String getTitle() { return this.title; } +    public void setId(final int id) { this.id = id; } +    public int getId() { return this.id; } + +    public int compareTo(final Novel other) { return this.id - other.id; } +} +``` + +这个类实现了 `Comparable` 接口中的 `compareTo` 方法,因为 `Novel` 实例是存储在一个线程安全的无序 `ConcurrentHashMap` 中。在响应查看集合的请求时,“小说”服务会对从映射中提取的集合(一个 `ArrayList`)进行排序;`compareTo` 的实现通过 `Novel` 的 ID 将它按升序排序。 + +`Novels` 类中包含多个实用工具函数: + +#### 例 2:Novels 实用工具类 + +```java +package novels; + +import java.io.IOException; +import java.io.File; +import java.io.ByteArrayOutputStream; +import java.io.InputStream; +import java.io.InputStreamReader; +import java.io.BufferedReader; +import java.nio.file.Files; +import java.util.stream.Stream; +import java.util.concurrent.ConcurrentMap; +import java.util.concurrent.ConcurrentHashMap; +import java.util.concurrent.atomic.AtomicInteger; +import java.util.Collections; +import java.beans.XMLEncoder; +import javax.servlet.ServletContext; // not in JavaSE +import org.json.JSONObject; +import org.json.XML; + +public class Novels { +    private final String fileName = "/WEB-INF/data/novels.db"; +    private ConcurrentMap novels; +    private ServletContext sctx; +    private AtomicInteger mapKey; + +    public Novels() { +        novels = new ConcurrentHashMap(); +        mapKey = new AtomicInteger(); +    } + +    public void setServletContext(ServletContext sctx) { this.sctx = sctx; } +    public ServletContext getServletContext() { return this.sctx; } + +    public ConcurrentMap getConcurrentMap() { +        if (getServletContext() == null) return null; // not initialized +        if (novels.size() < 1) populate(); +        return this.novels; +    } + +    public String toXml(Object obj) { // default encoding +        String xml = null; +        try { +            ByteArrayOutputStream out = new ByteArrayOutputStream(); +            XMLEncoder encoder = new XMLEncoder(out); +            encoder.writeObject(obj); +            encoder.close(); +            xml = out.toString(); +        } +        catch(Exception e) { } +        return xml; +    } + +    public String toJson(String xml) { // option for requester +        try { +            JSONObject jobt = XML.toJSONObject(xml); +            return jobt.toString(3); // 3 is indentation level +        } +        catch(Exception e) { } +        return null; +    } + +    public int addNovel(Novel novel) { +        int id = mapKey.incrementAndGet(); +        novel.setId(id); +        novels.put(id, novel); +        return id; +    } + +    private void populate() { +        InputStream in = sctx.getResourceAsStream(this.fileName); +        // Convert novel.db string data into novels. +        if (in != null) { +            try { +                InputStreamReader isr = new InputStreamReader(in); +                BufferedReader reader = new BufferedReader(isr); + +                String record = null; +                while ((record = reader.readLine()) != null) { +                    String[] parts = record.split("!"); +                    if (parts.length == 2) { +                        Novel novel = new Novel(); +                        novel.setAuthor(parts[0]); +                        novel.setTitle(parts[1]); +                        addNovel(novel); // sets the Id, adds to map +                    } +                } +                in.close(); +            } +            catch (IOException e) { } +        } +    } +} +``` + +最复杂的方法是 `populate`,这个方法从一个包含在 WAR 文件中的文本文件读取。这个文本文件包括了“小说”的初始集合。要打开此文件,`populate` 方法需要 `ServletContext`,这是一个 Java 映射类型,包含了关于嵌入在 servlet 容器中的 servlet 的所有关键信息。这个文本文件有包含了像下面这样的记录: + +``` +Jane Austen!Persuasion +``` + +这一行被解析为两部分(作者和标题),由感叹号(`!`)分隔。然后这个方法创建一个 `Novel` 实例,设置作者和标题属性,并且将“小说”加到容器中,保存在内存中。 + +`Novels` 类也有一些实用工具函数,可以将“小说”容器编码为 XML 或 JSON,取决于发出请求的人所要求的格式。默认是 XML 格式,但是也可以请求 JSON 格式。一个轻量级的 XML 转 JSON 包提供了 JSON。下面是关于编码的更多细节。 + +#### 例 3:NovelsServlet 类 + +```java +package novels; + +import java.util.concurrent.ConcurrentMap; +import javax.servlet.ServletException; +import javax.servlet.http.HttpServlet; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import java.util.Arrays; +import java.io.ByteArrayInputStream; +import java.io.ByteArrayOutputStream; +import java.io.OutputStream; +import java.io.BufferedReader; +import java.io.InputStreamReader; +import java.beans.XMLEncoder; +import org.json.JSONObject; +import org.json.XML; + +public class NovelsServlet extends HttpServlet { +    static final long serialVersionUID = 1L; +    private Novels novels; // back-end bean + +    // Executed when servlet is first loaded into container. +    @Override +    public void init() { +        this.novels = new Novels(); +        novels.setServletContext(this.getServletContext()); +    } + +    // GET /novels +    // GET /novels?id=1 +    @Override +    public void doGet(HttpServletRequest request, HttpServletResponse response) { +        String param = request.getParameter("id"); +        Integer key = (param == null) ? null : Integer.valueOf((param.trim())); + +        // Check user preference for XML or JSON by inspecting +        // the HTTP headers for the Accept key. +        boolean json = false; +        String accept = request.getHeader("accept"); +        if (accept != null && accept.contains("json")) json = true; + +        // If no query string, assume client wants the full list. +        if (key == null) { +            ConcurrentMap map = novels.getConcurrentMap(); +            Object list = map.values().toArray(); +            Arrays.sort(list); + +            String payload = novels.toXml(list);        // defaults to Xml +            if (json) payload = novels.toJson(payload); // Json preferred? +            sendResponse(response, payload); +        } +        // Otherwise, return the specified Novel. +        else { +            Novel novel = novels.getConcurrentMap().get(key); +            if (novel == null) { // no such Novel +                String msg = key + " does not map to a novel.\n"; +                sendResponse(response, novels.toXml(msg)); +            } +            else { // requested Novel found +                if (json) sendResponse(response, novels.toJson(novels.toXml(novel))); +                else sendResponse(response, novels.toXml(novel)); +            } +        } +    } + +    // POST /novels +    @Override +    public void doPost(HttpServletRequest request, HttpServletResponse response) { +        String author = request.getParameter("author"); +        String title = request.getParameter("title"); + +        // Are the data to create a new novel present? +        if (author == null || title == null) +            throw new RuntimeException(Integer.toString(HttpServletResponse.SC_BAD_REQUEST)); + +        // Create a novel. +        Novel n = new Novel(); +        n.setAuthor(author); +        n.setTitle(title); + +        // Save the ID of the newly created Novel. +        int id = novels.addNovel(n); + +        // Generate the confirmation message. +        String msg = "Novel " + id + " created.\n"; +        sendResponse(response, novels.toXml(msg)); +    } + +    // PUT /novels +    @Override +    public void doPut(HttpServletRequest request, HttpServletResponse response) { +        /* A workaround is necessary for a PUT request because Tomcat does not +           generate a workable parameter map for the PUT verb. */ +        String key = null; +        String rest = null; +        boolean author = false; + +        /* Let the hack begin. */ +        try { +            BufferedReader br = +                new BufferedReader(new InputStreamReader(request.getInputStream())); +            String data = br.readLine(); +            /* To simplify the hack, assume that the PUT request has exactly +               two parameters: the id and either author or title. Assume, further, +               that the id comes first. From the client side, a hash character +               # separates the id and the author/title, e.g., + +                  id=33#title=War and Peace +            */ +            String[] args = data.split("#");      // id in args[0], rest in args[1] +            String[] parts1 = args[0].split("="); // id = parts1[1] +            key = parts1[1]; + +            String[] parts2 = args[1].split("="); // parts2[0] is key +            if (parts2[0].contains("author")) author = true; +            rest = parts2[1]; +        } +        catch(Exception e) { +            throw new RuntimeException(Integer.toString(HttpServletResponse.SC_INTERNAL_SERVER_ERROR)); +        } + +        // If no key, then the request is ill formed. +        if (key == null) +            throw new RuntimeException(Integer.toString(HttpServletResponse.SC_BAD_REQUEST)); + +        // Look up the specified novel. +        Novel p = novels.getConcurrentMap().get(Integer.valueOf((key.trim()))); +        if (p == null) { // not found +            String msg = key + " does not map to a novel.\n"; +            sendResponse(response, novels.toXml(msg)); +        } +        else { // found +            if (rest == null) { +                throw new RuntimeException(Integer.toString(HttpServletResponse.SC_BAD_REQUEST)); +            } +            // Do the editing. +            else { +                if (author) p.setAuthor(rest); +                else p.setTitle(rest); + +                String msg = "Novel " + key + " has been edited.\n"; +                sendResponse(response, novels.toXml(msg)); +            } +        } +    } + +    // DELETE /novels?id=1 +    @Override +    public void doDelete(HttpServletRequest request, HttpServletResponse response) { +        String param = request.getParameter("id"); +        Integer key = (param == null) ? null : Integer.valueOf((param.trim())); +        // Only one Novel can be deleted at a time. +        if (key == null) +            throw new RuntimeException(Integer.toString(HttpServletResponse.SC_BAD_REQUEST)); +        try { +            novels.getConcurrentMap().remove(key); +            String msg = "Novel " + key + " removed.\n"; +            sendResponse(response, novels.toXml(msg)); +        } +        catch(Exception e) { +            throw new RuntimeException(Integer.toString(HttpServletResponse.SC_INTERNAL_SERVER_ERROR)); +        } +    } + +    // Methods Not Allowed +    @Override +    public void doTrace(HttpServletRequest request, HttpServletResponse response) { +        throw new RuntimeException(Integer.toString(HttpServletResponse.SC_METHOD_NOT_ALLOWED)); +    } + +    @Override +    public void doHead(HttpServletRequest request, HttpServletResponse response) { +        throw new RuntimeException(Integer.toString(HttpServletResponse.SC_METHOD_NOT_ALLOWED)); +    } + +    @Override +    public void doOptions(HttpServletRequest request, HttpServletResponse response) { +        throw new RuntimeException(Integer.toString(HttpServletResponse.SC_METHOD_NOT_ALLOWED)); +    } + +    // Send the response payload (Xml or Json) to the client. +    private void sendResponse(HttpServletResponse response, String payload) { +        try { +            OutputStream out = response.getOutputStream(); +            out.write(payload.getBytes()); +            out.flush(); +        } +        catch(Exception e) { +            throw new RuntimeException(Integer.toString(HttpServletResponse.SC_INTERNAL_SERVER_ERROR)); +        } +    } +} +``` + +上面的 `NovelsServlet` 类继承了 `HttpServlet` 类,`HttpServlet` 类继承了 `GenericServlet` 类,后者实现了 `Servlet` 接口: + +```java +NovelsServlet extends HttpServlet extends GenericServlet implements Servlet +``` + +从名字可以很清楚的看出来,`HttpServlet` 是为实现 HTTP(S) 上的 servlet 设计的。这个类提供了以标准 HTTP 请求动词(官方说法,方法methods)命名的空方法: + + * `doPost` (Post = 创建) + * `doGet` (Get = 读取) + * `doPut` (Put = 更新) + * `doDelete` (Delete = 删除) + +其他一些 HTTP 动词也会涉及到。`HttpServlet` 的子类,比如 `NovelsServlet`,会重载相关的 `do` 方法,并且保留其他方法为no-ops。`NovelsServlet` 重载了七个 `do` 方法。 + +每个 `HttpServlet` 的 CRUD 方法都有两个相同的参数。下面以 `doPost` 为例: + +```java +public void doPost(HttpServletRequest request, HttpServletResponse response) { +``` + +`request` 参数是一个 HTTP 请求信息的映射,而 `response` 提供了一个返回给请求者的输出流。像 `doPost` 的方法,结构如下: + + * 读取 `request` 信息,采取任何适当的措施生成一个响应。如果该信息丢失或者损坏了,就会生成一个错误。 + * 使用提取的请求信息来执行适当的 CRUD 操作(在本例中,创建一个 `Novel`),然后使用 `response` 输出流为请求者编码一个适当的响应。在 `doPost` 例子中,响应就是已经成功生成一个新“小说”并且添加到容器中的一个确认。当响应被发送后,输出流就关闭了,同时也将连接关闭了。 + +### 关于方法重载的更多内容 + +HTTP 请求的格式相对比较简单。下面是一个非常熟悉的 HTTP 1.1 的格式,注释由双井号分隔: + +``` +GET /novels              ## start line +Host: localhost:8080     ## header element +Accept-type: text/plain  ## ditto +... +[body]                   ## POST and PUT only +``` + +第一行由 HTTP 动词(在本例中是 `GET`)和以名词(在本例中是 `novels`)命名目标资源的 URI 开始。报头中包含键-值对,用冒号分隔左面的键和右面的值。报头中的键 `Host`(大小写敏感)是必须的;主机名 `localhost` 是当前机器上的本地符号地址,`8080` 端口是 Tomcat web 服务器上等待 HTTP 请求的默认端口。(默认情况下,Tomcat 在 8443 端口上监听 HTTP 请求。)报头元素可以以任意顺序出现。在这个例子中,`Accept-type` 报头的值是 MIME 类型 `text/plain`。 + +一些请求(特别是 `POST` 和 `PUT`)会有报文,而其他请求(特别是 `GET` 和 `DELETE`)没有。如果有报文(可能为空),以两个换行符将报头和报文分隔开;HTTP 报文包含一系列键-值对。对于无报文的请求,比如说查询字符串,报头元素就可以用来发送信息。下面是一个用 ID 2 对 `/novels` 资源的 `GET` 请求: + +``` +GET /novels?id=2 +``` + +通常来说,查询字符串以问号开始,并且包含一个键-值对,尽管这个键-值可能值为空。 + +带有 `getParameter` 和 `getParameterMap` 等方法的 `HttpServlet` 很好地回避了有报文和没有报文的 HTTP 请求之前的差异。在“小说”例子中,`getParameter` 方法用来从 `GET`、`POST` 和 `DELETE` 方法中提取所需的信息。(处理 `PUT` 请求需要更底层的代码,因为 Tomcat 没有提供可以解析 `PUT` 请求的参数映射。)下面展示了一段在 `NovelsServlet` 中被重载的 `doPost` 方法: + +```java +@Override +public void doPost(HttpServletRequest request, HttpServletResponse response) { +   String author = request.getParameter("author"); +   String title = request.getParameter("title"); +   ... +``` + +对于没有报文的 `DELETE` 请求,过程基本是一样的: + +```java +@Override +public void doDelete(HttpServletRequest request, HttpServletResponse response) { +   String param = request.getParameter("id"); // id of novel to be removed +   ... +``` + +`doGet` 方法需要区分 `GET` 请求的两种方式:一种是“获得所有”,而另一种是“获得某一个”。如果 `GET` 请求 URL 中包含一个键是一个 ID 的查询字符串,那么这个请求就被解析为“获得某一个”: + +``` +http://localhost:8080/novels?id=2  ## GET specified +``` + +如果没有查询字符串,`GET` 请求就会被解析为“获得所有”: + +``` +http://localhost:8080/novels       ## GET all +``` + +### 一些值得注意的细节 + +“小说”服务的设计反映了像 Tomcat 这样基于 Java 的 web 服务器是如何工作的。在启动时,Tomcat 构建一个线程池,从中提取请求处理程序,这种方法称为 “每个请求一个线程one thread per request” 模型。现在版本的 Tomcat 使用非阻塞 I/O 来提高个性能。 + +“小说”服务是作为 `NovelsServlet` 类的单个实例来执行的,该实例也就维护了一个“小说”集合。相应的,也就会出现竞态条件,比如出现两个请求同时被处理: + + * 一个请求向集合中添加一个新“小说”。 + * 另一个请求获得集合中的所有“小说”。 + +这样的结果是不确定的,取决与 _读_ 和 _写_ 的操作是以怎样的顺序进行操作的。为了避免这个问题,“小说”服务使用了线程安全的 `ConcurrentMap`。这个映射的关键是生成了一个线程安全的 `AtomicInteger`。下面是相关的代码片段: + +```java +public class Novels { +    private ConcurrentMap novels; +    private AtomicInteger mapKey; +    ... +``` + +默认情况下,对客户端请求的响应被编码为 XML。为了简单,“小说”程序使用了以前的 `XMLEncoder` 类;另一个包含更丰富功能的方式是使用 JAX-B 库。代码很简单: + +```java +public String toXml(Object obj) { // default encoding +   String xml = null; +   try { +      ByteArrayOutputStream out = new ByteArrayOutputStream(); +      XMLEncoder encoder = new XMLEncoder(out); +      encoder.writeObject(obj); +      encoder.close(); +      xml = out.toString(); +   } +   catch(Exception e) { } +   return xml; +} +``` + +`Object` 参数要么是一个有序的“小说” `ArraList`(用以响应“获得所有get all”请求),要么是一个 `Novel` 实例(用以响应“获得一个get one”请求),又或者是一个 `String`(确认消息)。 + +如果 HTTP 请求报头指定 JSON 作为所需要的类型,那么 XML 就被转化成 JSON。下面是 `NovelsServlet` 中的 `doGet` 方法中的检查: + +```java +String accept = request.getHeader("accept"); // "accept" is case insensitive +if (accept != null && accept.contains("json")) json = true; +``` + +`Novels`类中包含了 `toJson` 方法,可以将 XML 转换成 JSON: + +```java +public String toJson(String xml) { // option for requester +   try { +      JSONObject jobt = XML.toJSONObject(xml); +      return jobt.toString(3); // 3 is indentation level +   } +   catch(Exception e) { } +   return null; +} +``` + +`NovelsServlet`会对各种类型进行错误检查。比如,`POST` 请求应该包含新“小说”的作者和标题。如果有一个丢了,`doPost` 方法会抛出一个异常: + +```java +if (author == null || title == null) +   throw new RuntimeException(Integer.toString(HttpServletResponse.SC_BAD_REQUEST)); +``` + +`SC_BAD_REQUEST` 中的 `SC` 代表的是 状态码status code,`BAD_REQUEST` 的标准 HTTP 数值是 400。如果请求中的 HTTP 动词是 `TRACE`,会返回一个不同的状态码: + +```java +public void doTrace(HttpServletRequest request, HttpServletResponse response) { +   throw new RuntimeException(Integer.toString(HttpServletResponse.SC_METHOD_NOT_ALLOWED)); +} +``` + +### 测试“小说”服务 + +用浏览器测试 web 服务会很不顺手。在 CRUD 动词中,现代浏览器只能生成 `POST`(创建)和 `GET`(读取)请求。甚至从浏览器发送一个 `POST` 请求都有点不好办,因为报文需要包含键-值对;这样的测试通常通过 HTML 表单完成。命令行工具,比如说 [curl][21],是一个更好的选择,这个部分展示的一些 `curl` 命令,已经包含在我网站的 ZIP 文件中了。 + +下面是一些测试样例,没有展示相应的输出结果: + +``` +% curl localhost:8080/novels/ +% curl localhost:8080/novels?id=1 +% curl --header "Accept: application/json" localhost:8080/novels/ +``` + +第一条命令请求所有“小说”,默认是 XML 编码。第二条命令请求 ID 为 1 的“小说”,XML 编码。最后一条命令通过 `application/json` 添加了 `Accept` 报头元素,作为所需要的 MIME 类型。“获得一个get one”命令也可以用这个报头。这些请求用了 JSON 而不是 XML 编码作为响应。 + +下面两条命令在集合中创建了一个新“小说”,并且确认添加了进去: + +``` +% curl --request POST --data "author=Tolstoy&title=War and Peace" localhost:8080/novels/ +% curl localhost:8080/novels?id=4 +``` + +`curl` 中的 `PUT` 命令与 `POST` 命令相似,不同的地方是 `PUT` 的报文没有使用标准的语法。在 `NovelsServlet` 中关于 `doPut` 方法的文档中有详细的介绍,但是简单来说,Tomcat 不会对 `PUT` 请求生成合适的映射。下面是一个 `PUT` 命令和确认命令的的例子: + +``` +% curl --request PUT --data "id=3#title=This is an UPDATE" localhost:8080/novels/ +% curl localhost:8080/novels?id=3 +``` + +第二个命令确认了集合已经更新。 + +最后,`DELETE` 命令会正常运行: + +``` +% curl --request DELETE localhost:8080/novels?id=2 +% curl localhost:8080/novels/ +``` + +这个请求是删除 ID 为 2 的“小说”。第二个命令会显示剩余的“小说”。 + +### web.xml 配置文件 + +尽管官方规定它是可选的,`web.xml` 配置文件是一个生产级别网站或服务的重要组成部分。这个配置文件可以配置独立于代码的路由、安全性,或者网站或服务的其他功能。“小说”服务的配置通过为该服务的请求分配一个 URL 模式来配置路由: + +```xml + + +    novels +    novels.NovelsServlet +    novels +    /* + +``` + +`servlet-name` 元素为 servlet 全名(`novels.NovelsServlet`)提供了一个缩写(`novels`),然后这个名字在下面的 `servlet-mapping` 元素中使用。 + +回想一下,一个已部署服务的 URL 会在端口号后面有 WAR 文件的文件名: + +``` +http://localhost:8080/novels/ +``` + +端口号后斜杠后的 URI,是所请求资源的“路径”,在这个例子中,就是“小说”服务。因此,`novels` 出现在了第一个单斜杠后。 + +在 `web.xml` 文件中,`url-patter` 被指定为 `/*`,代表 “以 `/novels` 为起始的任意路径”。假设 Tomcat 遇到了一个不存在的 URL,像这样: + +``` +http://localhost:8080/novels/foobar/ +``` + +`web.xml` 配置也会指定这个请求被分配到“小说” servlet 中,因为 `/*` 模式也包含 `/foobar`。因此,这个不存在的 URL 也会得到像上面合法路径的相同结果。 + +生产级别的配置文件可能会包含安全相关的信息,包括连接级别wire-level用户角色users-roles。即使在这种情况下,配置文件的大小也只会是这个例子中的两到三倍大。 + +### 总结 + +`HttpServlet` 是 Java web 技术的核心。像“小说”这样的网站或 web 服务继承了这个类,并且根据需求重载了相应的 `do` 动词方法。像 Jersay(JAX-RS)或 Restlet 这样的 Restful 框架通过提供定制的 servlet 完成了基本相同的功能,针对框架中的 web 应用程序的请求,这个 servlet 扮演着 HTTP(S) 终端endpoint的角色。 + +当然,基于 servlet 的应用程序可以访问 web 应用程序中所需要的任何 Java 库。如果应用程序遵循关注点分离separation-of-concerns原则,那么 servlet 代码仍然相当简单:代码会检查请求,如果存在缺陷,就会发出适当的错误;否则,代码会调用所需要的功能(比如,查询数据库,以特定格式为响应编码),然后向请求这发送响应。`HttpServletRequest` 和 `HttpServletReponse` 类型使得读取请求和编写响应变得简单。 + +Java 的 API 可以从非常简单变得相当复杂。如果你需要用 Java 交付一些 Restful 服务的话,我的建议是在做其他事情之前先尝试一下简单的 `HttpServlet`。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/7/restful-services-java + +作者:[Marty Kalin][a] +选题:[lujun9972][b] +译者:[Yufei-Yan](https://github.com/Yufei-Yan) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/mkalindepauledu +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/code_computer_laptop_hack_work.png?itok=aSpcWkcl (Coding on a computer) +[2]: http://xmlrpc.com/ +[3]: https://en.wikipedia.org/wiki/Representational_state_transfer +[4]: https://www.redhat.com/en/topics/integration/whats-the-difference-between-soap-rest +[5]: http://tomcat.apache.org/ +[6]: https://condor.depaul.edu/mkalin +[7]: https://tomcat.apache.org/download-90.cgi +[8]: http://www.google.com/search?hl=en&q=allinurl%3Adocs.oracle.com+javase+docs+api+serializable +[9]: http://www.google.com/search?hl=en&q=allinurl%3Adocs.oracle.com+javase+docs+api+string +[10]: http://www.google.com/search?hl=en&q=allinurl%3Adocs.oracle.com+javase+docs+api+integer +[11]: http://www.google.com/search?hl=en&q=allinurl%3Adocs.oracle.com+javase+docs+api+object +[12]: http://www.google.com/search?hl=en&q=allinurl%3Adocs.oracle.com+javase+docs+api+bytearrayoutputstream +[13]: http://www.google.com/search?hl=en&q=allinurl%3Adocs.oracle.com+javase+docs+api+exception +[14]: http://www.google.com/search?hl=en&q=allinurl%3Adocs.oracle.com+javase+docs+api+inputstream +[15]: http://www.google.com/search?hl=en&q=allinurl%3Adocs.oracle.com+javase+docs+api+inputstreamreader +[16]: http://www.google.com/search?hl=en&q=allinurl%3Adocs.oracle.com+javase+docs+api+bufferedreader +[17]: http://www.google.com/search?hl=en&q=allinurl%3Adocs.oracle.com+javase+docs+api+ioexception +[18]: http://www.google.com/search?hl=en&q=allinurl%3Adocs.oracle.com+javase+docs+api+arrays +[19]: http://www.google.com/search?hl=en&q=allinurl%3Adocs.oracle.com+javase+docs+api+runtimeexception +[20]: http://www.google.com/search?hl=en&q=allinurl%3Adocs.oracle.com+javase+docs+api+outputstream +[21]: https://curl.haxx.se/ diff --git a/published/202008/20200716 Summarizing your command usage on Linux.md b/published/202008/20200716 Summarizing your command usage on Linux.md new file mode 100644 index 0000000000..ef0b331fb1 --- /dev/null +++ b/published/202008/20200716 Summarizing your command usage on Linux.md @@ -0,0 +1,181 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12517-1.html) +[#]: subject: (Summarizing your command usage on Linux) +[#]: via: (https://www.networkworld.com/article/3567050/summarizing-your-command-usage-on-linux.html) +[#]: author: (Sandra Henry-Stocker https://www.networkworld.com/author/Sandra-Henry_Stocker/) + +汇总你在 Linux 上的命令使用情况 +====== + +> 使用合适的命令,你可以快速了解 Linux 系统上使用的命令以及执行的频率。 + +![](https://img.linux.net.cn/data/attachment/album/202008/14/221303ln67fl62nsfb7nys.jpg) + +汇总 Linux 系统上使用的命令只需一串相对简单的命令以及几条管道将它们绑定在一起。当你的历史记录缓冲区保留了最近的 1,000 或 2,000 条命令时,总结你的命令活动可能会变得很乏味。这篇文章提供了一种方便的方法来汇总命令的使用情况,并高亮显示最常用的命令。 + +首先,请记住,典型的命令历史记录可能看起来像这样。请注意,命令是显示在命令序列号之后,并紧跟其参数。 + +``` +91 sudo apt-get install ccrypt + ^ + +-- command +``` + +请注意,`history` 命令遵循 `HISTSIZE` 的设置,这会决定保留多少条命令。可能是 500、1,000 或更多。如果你不喜欢它的设置,那么可以在 `.bashrc` 或其他启动文件中添加或更改 `HISTSIZE` 设置。 + +``` +$ echo $HISTSIZE +1000 +$ history | wc -l +1000 +$ grep HISTSIZE ~/.bashrc +# for setting history length see HISTSIZE and HISTFILESIZE in bash(1) +HISTSIZE=1000 +``` + +记下大量命令的主要好处之一是,它可以让你轻松地重新运行过去使用的命令,而不必重新输入或记住它们。它还能让你轻松地查看你在一个任务中已经做了多少工作。单独使用 `history` 命令时,你会看到类似下面这样,最早的在最前面: + +``` +$ history + 7 vi tasks + 8 alias + 9 echo $HISTTIMEFORMAT + 10 history + 11 date + … +``` + +查看最新使用命令需要查看记录的命令的尾部: + +``` +$ history | tail -4 + 1007 echo $HISTSIZE + 1008 history | wc -l + 1009 history + 1010 history | tail -4 +``` + +另外,你可以使用 `tail` 命令查看 `.bash_history` 文件的尾部,但是 `history` 命令显示的数字可以让你输入如 `!1010` 这样的数字重新运行命令,这点通常更有用。 + +要提供已使用命令的汇总(例如 `vi` 和 `echo`),你可以首先使用 `awk` 将命令与 `history` 中保存的其他信息分隔开来: + +``` +$ history | awk '{print $2}' +vi +alias +echo +history +date +… +``` + +如果你将历史记录中的命令列表传递给 `sort` 命令以按字母顺序对命令进行分组,那么会得到以下内容: + +``` +$ history | awk '{print $2}' | sort +7z +7z +alias +apropos +cd +cd +… +``` + +接下来,将 `sort` 命令的输出传递给 `uniq -c` ,这将计算每个命令使用了多少次: + +``` +$ history | awk '{print $2}' | sort | uniq -c + 2 7z + 1 alias + 2 apropos + 38 cd + 21 chmod +… +``` + +最后,添加第二个 `sort` 命令按倒序对命令组计数进行排序,这将先列出最常用的命令: + +``` +$ history | awk '{print $2}' | sort | uniq -c | sort -nr + 178 ls + 95 vi + 63 cd + 53 sudo + 41 more +… +``` + +这样可以让你了解使用最多的命令,但不会包括任何你可能故意从历史记录文件中删除的命令,例如: + +``` +HISTIGNORE="pwd:clear:man:history" +``` + +### 当修改了历史记录格式时 + +对于默认的历史记录格式,`history` 命令输出中的第一个字段将是每个命令的序号,第二个字段是使用的命令。因此,上面所有 `awk` 命令都设置成显示 `$2`。 + +``` +$ alias cmds='history | awk '\''{print $2}'\'' | sort | uniq -c | sort -nr' +``` + +如果你像下面那样将日期和时间添加了到 `history` 命令中,那么你还必须修改所设置的别名: + +``` +$ echo $HISTTIMEFORMAT +%d/%m/%y %T +``` + +这个日期/时间信息有时会很有帮助,但是这意味着你必须在选择 `history` 命令的第 4 个字段而不是第 2 个字段来汇总命令,因为你的历史记录条目将如下所示: + +``` +91 05/07/20 16:37:39 sudo apt-get install ccrypt + ^ + +-- command +``` + +因此,在将 `$2` 变为 `$4` 之后,用于检查 `history` 命令的别名将改为这样: + +``` +$ alias cmds='history | awk '\''{print $4}'\'' | sort | uniq -c | sort -nr' +``` + +可将别名保存在 `.bashrc` 或其他启动文件中,请确保在 `$` 符号前面插入反斜杠,以便 bash 不会尝试解释 `$4`。 + +``` +alias cmds='history | awk '\''{print \$2}'\'' | uniq -c | sort -nr' +alias cmds='history | awk '\''{print \$4}'\'' | uniq -c | sort -nr' +``` + +请注意,日期和时间信息与命令本身保存在历史记录文件的不同行中。因此,添加此信息后,bash 历史记录文件的行数将增加一倍,尽管在 `history` 命令输出时不会: + +``` +$ wc -l .bash_history +2000 .bash_history +$ history | wc -l +1000 +``` + +### 总结 + +你可以随时决定要保留多少命令历史记录,哪些命令不值得记录,以使你的命令摘要最有用。 + +-------------------------------------------------------------------------------- + +via: https://www.networkworld.com/article/3567050/summarizing-your-command-usage-on-linux.html + +作者:[Sandra Henry-Stocker][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://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 diff --git a/published/202008/20200717 Debug Linux using ProcDump.md b/published/202008/20200717 Debug Linux using ProcDump.md new file mode 100644 index 0000000000..237932ece5 --- /dev/null +++ b/published/202008/20200717 Debug Linux using ProcDump.md @@ -0,0 +1,406 @@ +[#]: collector: (lujun9972) +[#]: translator: (wxy) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12533-1.html) +[#]: subject: (Debug Linux using ProcDump) +[#]: via: (https://opensource.com/article/20/7/procdump-linux) +[#]: author: (Gaurav Kamathe https://opensource.com/users/gkamathe) + +使用微软的 ProcDump 调试 Linux 进程 +====== + +> 用这个微软的开源工具,获取进程信息。 + +![](https://img.linux.net.cn/data/attachment/album/202008/20/095646k5wz7cd11vyc7lhr.jpg) + +微软越来越心仪 Linux 和开源,这并不是什么秘密。在过去几年中,该公司稳步地增加了对开源的贡献,包括将其部分软件和工具移植到 Linux。2018 年底,微软[宣布][2]将其 [Sysinternals][3] 的部分工具以开源的方式移植到 Linux,[Linux 版的 ProcDump][4]是其中的第一个。 + +如果你在 Windows 上从事过调试或故障排除工作,你可能听说过 Sysinternals,它是一个“瑞士军刀”工具集,可以帮助系统管理员、开发人员和 IT 安全专家监控和排除 Windows 环境的故障。 + +Sysinternals 最受欢迎的工具之一是 [ProcDump][5]。顾名思义,它用于将正在运行的进程的内存转储到磁盘上的一个核心文件中。然后可以用调试器对这个核心文件进行分析,了解转储时进程的状态。因为之前用过 Sysinternals,所以我很想试试 ProcDump 的 Linux 移植版。 + +### 开始使用 Linux 上的 ProcDump + +要试用 Linux 上的 ProcDump,你需要下载该工具并编译它。(我使用的是 Red Hat Enterprise Linux,尽管这些步骤在其他 Linux 发行版上应该是一样的): + +``` +$ cat /etc/redhat-release +Red Hat Enterprise Linux release 8.2 (Ootpa) +$ +$ uname -r +4.18.0-193.el8.x86_64 +$ +``` + +首先,克隆 Linux 版 ProcDump 的版本库。 + +``` +$ git clone https://github.com/microsoft/ProcDump-for-Linux.git +Cloning into 'ProcDump-for-Linux'... +remote: Enumerating objects: 40, done. +remote: Counting objects: 100% (40/40), done. +remote: Compressing objects: 100% (33/33), done. +remote: Total 414 (delta 14), reused 14 (delta 6), pack-reused 374 +Receiving objects: 100% (414/414), 335.28 KiB | 265.00 KiB/s, done. +Resolving deltas: 100% (232/232), done. +$ +$ cd ProcDump-for-Linux/ +$ +$ ls +azure-pipelines.yml  CONTRIBUTING.md  docs     INSTALL.md  Makefile    procdump.gif  src +CODE_OF_CONDUCT.md   dist             include  LICENSE     procdump.1  README.md     tests +$ +``` + +接下来,使用 `make` 构建程序。它能准确地输出编译源文件所需的 [GCC][6] 命令行参数。 + +``` +$ make +rm -rf obj +rm -rf bin +rm -rf /root/ProcDump-for-Linux/pkgbuild +gcc -c -g -o obj/Logging.o src/Logging.c -Wall -I ./include -pthread -std=gnu99 +gcc -c -g -o obj/Events.o src/Events.c -Wall -I ./include -pthread -std=gnu99 +gcc -c -g -o obj/ProcDumpConfiguration.o src/ProcDumpConfiguration.c -Wall -I ./include -pthread -std=gnu99 +gcc -c -g -o obj/Handle.o src/Handle.c -Wall -I ./include -pthread -std=gnu99 +gcc -c -g -o obj/Process.o src/Process.c -Wall -I ./include -pthread -std=gnu99 +gcc -c -g -o obj/Procdump.o src/Procdump.c -Wall -I ./include -pthread -std=gnu99 +gcc -c -g -o obj/TriggerThreadProcs.o src/TriggerThreadProcs.c -Wall -I ./include -pthread -std=gnu99 +gcc -c -g -o obj/CoreDumpWriter.o src/CoreDumpWriter.c -Wall -I ./include -pthread -std=gnu99 +gcc -o bin/procdump obj/Logging.o obj/Events.o obj/ProcDumpConfiguration.o obj/Handle.o obj/Process.o obj/Procdump.o obj/TriggerThreadProcs.o obj/CoreDumpWriter.o -Wall -I ./include -pthread -std=gnu99 +gcc -c -g -o obj/ProcDumpTestApplication.o tests/integration/ProcDumpTestApplication.c -Wall -I ./include -pthread -std=gnu99 +gcc -o bin/ProcDumpTestApplication obj/ProcDumpTestApplication.o -Wall -I ./include -pthread -std=gnu99 +$ +``` + +编译过程中会创建两个新的目录。第一个是 `obj/` 目录,存放编译期间创建的对象文件。第二个(也是更重要的)目录是 `bin/`,它是存储编译出的 `procdump` 程序的地方。它还会编译另一个名为 `ProcDumpTestApplication` 的测试二进制文件: + +``` +$ ls obj/ +CoreDumpWriter.o  Handle.o   ProcDumpConfiguration.o  ProcDumpTestApplication.o  TriggerThreadProcs.o +Events.o          Logging.o  Procdump.o               Process.o +$ +$ +$ ls bin/ +procdump  ProcDumpTestApplication +$ +$ file bin/procdump +bin/procdump: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, for GNU/Linux 3.2.0, BuildID[sha1]=6e8827db64835ea0d1f0941ac3ecff9ee8c06e6b, with debug_info, not stripped +$ +$ file bin/ProcDumpTestApplication +bin/ProcDumpTestApplication: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, for GNU/Linux 3.2.0, BuildID[sha1]=c8fd86f53c07df142e52518815b2573d1c690e4e, with debug_info, not stripped +$ +``` + +在此情况下,每次运行 `procdump` 实用程序时,你都必须移动到 `bin/` 文件夹中。要使它在系统中的任何地方都可以使用,运行 `make install`。这将这个二进制文件复制到通常的 `bin/` 目录中,它是你的 shell `$PATH` 的一部分: + +``` +$ which procdump +/usr/bin/which: no procdump in (/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin) +$ +$ make install +mkdir -p //usr/bin +cp bin/procdump //usr/bin +mkdir -p //usr/share/man/man1 +cp procdump.1 //usr/share/man/man1 +$ +$ which procdump +/usr/bin/procdump +$ +``` + +安装时,ProcDump 提供了一个手册页,你可以用 `man procdump` 访问: + +``` +$ man procdump +$ +``` + +### 运行 ProcDump + +要转储一个进程的内存,你需要向 ProcDump 提供它的进程 ID(PID)。你可以使用机器上任何正在运行的程序或守护进程。在这个例子中,我将使用一个永远循环的小 C 程序。编译程序并运行它(要退出程序,按 `Ctrl+C`,如果程序在后台运行,则使用 `kill` 命令并输入 PID): + +``` +$ cat progxyz.c +#include + +int main() { +        for (;;) +        { +                printf("."); +                sleep(1); +        } +        return 0; +} +$ +$ gcc progxyz.c -o progxyz +$ +$ ./progxyz & +[1] 350498 +$ +``` + +运行该程序,你可以使用 `pgrep` 或 `ps` 找到它的 PID。记下 PID: + +``` +$ pgrep progxyz +350498 +$ +$ ps -ef | grep progxyz +root      350498  345445  0 03:29 pts/1    00:00:00 ./progxyz +root      350508  347350  0 03:29 pts/0    00:00:00 grep --color=auto progxyz +$ +``` + +当测试进程正在运行时,调用 `procdump` 并提供 PID。下面的输出表明了该进程的名称和 PID,并报告它生成了一个核心转储文件,并显示其文件名: + +``` +$ procdump -p 350498 + +ProcDump v1.1.1 - Sysinternals process dump utility +Copyright (C) 2020 Microsoft Corporation. All rights reserved. Licensed under the MIT license. +Mark Russinovich, Mario Hewardt, John Salem, Javid Habibi +Monitors a process and writes a dump file when the process exceeds the +specified criteria. + +Process:                progxyz (350498) +CPU Threshold:          n/a +Commit Threshold:       n/a +Polling interval (ms):  1000 +Threshold (s):  10 +Number of Dumps:        1 + +Press Ctrl-C to end monitoring without terminating the process. + +[03:30:00 - INFO]: Timed: +[03:30:01 - INFO]: Core dump 0 generated: progxyz_time_2020-06-24_03:30:00.350498 +$ +``` + +列出当前目录的内容,你应该可以看到新的核心文件。文件名与 `procdump` 命令显示的文件名一致,日期、时间、PID 都会附加在文件名上: + +``` +$ ls -l progxyz_time_2020-06-24_03\:30\:00.350498 +-rw-r--r--. 1 root root 356848 Jun 24 03:30 progxyz_time_2020-06-24_03:30:00.350498 +$ +$ file progxyz_time_2020-06-24_03\:30\:00.350498 +progxyz_time_2020-06-24_03:30:00.350498: ELF 64-bit LSB core file, x86-64, version 1 (SYSV), SVR4-style, from './progxyz', real uid: 0, effective uid: 0, real gid: 0, effective gid: 0, execfn: './progxyz', platform: 'x86_64' +$ +``` + +### 用 GNU 项目调试器分析核心文件。 + +要查看是否可以读取该转储文件,调用 [GNU 项目调试器][7](`gdb`)。记得提供测试二进制文件的路径,这样你就可以看到堆栈上所有的函数名。在这里,`bt`(回溯)表明,当转储被采集时,`sleep()` 函数正在执行: + +``` +$ gdb -q ./progxyz ./progxyz_time_2020-06-24_03\:30\:00.350498 +Reading symbols from ./progxyz...(no debugging symbols found)...done. +[New LWP 350498] +Core was generated by `./progxyz'. +#0  0x00007fb6947e9208 in nanosleep () from /lib64/libc.so.6 +Missing separate debuginfos, use: yum debuginfo-install glibc-2.28-101.el8.x86_64 +(gdb) bt +#0  0x00007fb6947e9208 in nanosleep () from /lib64/libc.so.6 +#1  0x00007fb6947e913e in sleep () from /lib64/libc.so.6 +#2  0x00000000004005f3 in main () +(gdb) +``` + +### gcore 怎么样? + +Linux 用户会很快指出,Linux 已经有一个叫 `gcore` 的命令,大多数 Linux 发行版都有这个命令,它的作用和 ProcDump 完全一样。你说的对。如果你从来没有使用过它,可以尝试用 `gcore` 来转储一个进程的核心。再次运行测试程序,然后运行 `gcore`,并提供 PID 作为参数: + +``` +$ ./progxyz & +[1] 350664 +$ +$ +$ pgrep progxyz +350664 +$ +$ +$ gcore 350664 +0x00007fefd3be2208 in nanosleep () from /lib64/libc.so.6 +Saved corefile core.350664 +[Inferior 1 (process 350664) detached] +$ +``` + +`gcore` 打印一条消息,说它已将核心文件保存到一个特定的文件中。检查当前目录,找到这个核心文件,然后再次使用 `gdb` 加载它: + +``` +$ +$ ls -l  core.350664 +-rw-r--r--. 1 root root 356848 Jun 24 03:34 core.350664 +$ +$ +$ file core.350664 +core.350664: ELF 64-bit LSB core file, x86-64, version 1 (SYSV), SVR4-style, from './progxyz', real uid: 0, effective uid: 0, real gid: 0, effective gid: 0, execfn: './progxyz', platform: 'x86_64' +$ +$ gdb -q ./progxyz ./core.350664 +Reading symbols from ./progxyz...(no debugging symbols found)...done. +[New LWP 350664] +Core was generated by `./progxyz'. +#0  0x00007fefd3be2208 in nanosleep () from /lib64/libc.so.6 +Missing separate debuginfos, use: yum debuginfo-install glibc-2.28-101.el8.x86_64 +(gdb) bt +#0  0x00007fefd3be2208 in nanosleep () from /lib64/libc.so.6 +#1  0x00007fefd3be213e in sleep () from /lib64/libc.so.6 +#2  0x00000000004005f3 in main () +(gdb) q +$ +``` + +为了使 `gcore` 可以工作,你需要确保以下设置到位。首先,确保为核心文件设置了 `ulimit`,如果设置为 `0`,核心文件将不会被生成。第二,确保 `/proc/sys/kernel/core_pattern` 有正确的设置来指定核心模式: + +``` +$ ulimit -c +unlimited +$ +``` + +### 你应该使用 ProcDump 还是 gcore? + +有几种情况下,你可能更喜欢使用 ProcDump 而不是 gcore,ProcDump 有一些内置的功能,在一些情况下可能很有用。 + +#### 等待测试二进制文件的执行 + +无论是使用 ProcDump 还是 gcore,测试进程必须被执行并处于运行状态,这样才能提供一个 PID 来生成核心文件。但 ProcDump 有一个功能,就是等待特定的二进制文件运行,一旦发现运行的测试二进制文件与给定的名称相匹配,它就会为该测试二进制文件生成一个核心文件。它可以使用 `-w` 参数和程序名称而不是 PID 来启用。这个功能在测试程序快速退出的情况下很有用。 + +下面是它的工作原理。在这个例子中,没有名为 `progxyz` 的进程在运行: + +``` +$ pgrep progxyz +$ +``` + +用 `-w` 参数调用 `procdump`,让它保持等待。在另一个终端,调用测试二进制 `progxyz`: + +``` +$ procdump -w progxyz + +ProcDump v1.1.1 - Sysinternals process dump utility +Copyright (C) 2020 Microsoft Corporation. All rights reserved. Licensed under the MIT license. +Mark Russinovich, Mario Hewardt, John Salem, Javid Habibi +Monitors a process and writes a dump file when the process exceeds the +specified criteria. + +Process:                progxyz (pending) +CPU Threshold:          n/a +Commit Threshold:       n/a +Polling interval (ms):  1000 +Threshold (s):  10 +Number of Dumps:        1 + +Press Ctrl-C to end monitoring without terminating the process. + +[03:39:23 - INFO]: Waiting for process 'progxyz' to launch... +``` + +然后,从另一个终端调用测试二进制 `progxyz`: + +``` +$ ./progxyz & +[1] 350951 +$ +``` + +ProcDump 立即检测到该二进制正在运行,并转储这个二进制的核心文件: + +``` +[03:39:23 - INFO]: Waiting for process 'progxyz' to launch... +[03:43:22 - INFO]: Found process with PID 350951 +[03:43:22 - INFO]: Timed: +[03:43:23 - INFO]: Core dump 0 generated: progxyz_time_2020-06-24_03:43:22.350951 +$ + +$ ls -l progxyz_time_2020-06-24_03\:43\:22.350951 +-rw-r--r--. 1 root root 356848 Jun 24 03:43 progxyz_time_2020-06-24_03:43:22.350951 +$ +$ file progxyz_time_2020-06-24_03\:43\:22.350951 +progxyz_time_2020-06-24_03:43:22.350951: ELF 64-bit LSB core file, x86-64, version 1 (SYSV), SVR4-style, from './progxyz', real uid: 0, effective uid: 0, real gid: 0, effective gid: 0, execfn: './progxyz', platform: 'x86_64' +$ +``` + +#### 多个核心转储 + +另一个重要的 ProcDump 功能是,你可以通过使用命令行参数 `-n ` 指定要生成多少个核心文件。核心转储之间的默认时间间隔是 `10` 秒,但你可以使用 `-s ` 参数修改。这个例子使用 ProcDump 对测试二进制文件进行了三次核心转储: + +``` +$ ./progxyz & +[1] 351014 +$ +$ procdump -n 3 -p 351014 + +ProcDump v1.1.1 - Sysinternals process dump utility +Copyright (C) 2020 Microsoft Corporation. All rights reserved. Licensed under the MIT license. +Mark Russinovich, Mario Hewardt, John Salem, Javid Habibi +Monitors a process and writes a dump file when the process exceeds the +specified criteria. + +Process:                progxyz (351014) +CPU Threshold:          n/a +Commit Threshold:       n/a +Polling interval (ms):  1000 +Threshold (s):  10 +Number of Dumps:        3 + +Press Ctrl-C to end monitoring without terminating the process. + +[03:45:20 - INFO]: Timed: +[03:45:21 - INFO]: Core dump 0 generated: progxyz_time_2020-06-24_03:45:20.351014 +[03:45:31 - INFO]: Timed: +[03:45:32 - INFO]: Core dump 1 generated: progxyz_time_2020-06-24_03:45:31.351014 +[03:45:42 - INFO]: Timed: +[03:45:44 - INFO]: Core dump 2 generated: progxyz_time_2020-06-24_03:45:42.351014 +$ +$ ls -l progxyz_time_2020-06-24_03\:45\:* +-rw-r--r--. 1 root root 356848 Jun 24 03:45 progxyz_time_2020-06-24_03:45:20.351014 +-rw-r--r--. 1 root root 356848 Jun 24 03:45 progxyz_time_2020-06-24_03:45:31.351014 +-rw-r--r--. 1 root root 356848 Jun 24 03:45 progxyz_time_2020-06-24_03:45:42.351014 +$ +``` + +#### 基于 CPU 和内存使用情况的核心转储 + +ProcDump 还可以让你在测试二进制或进程达到一定的 CPU 或内存阈值时触发核心转储。ProcDump 的手册页显示了调用 ProcDump 时使用的命令行参数: + +- `-C`:当 CPU 超过或等于指定值时,触发核心转储生成(0 到 100 * nCPU)。 +- `-c`:当 CPU 小于指定值时,触发核心转储生成(0 到 100 * nCPU)。  +- `-M`:当内存提交超过或等于指定值(MB)时,触发核心转储生成。 +- `-m`:当内存提交小于指定值(MB)时,触发核心转储生成。 +- `-T`:当线程数超过或等于指定值时触发。 +- `-F`:当文件描述符数量超过或等于指定值时触发。 +- `-I`:轮询频率,单位为毫秒(默认为 1000)。 + +例如,当给定 PID 的 CPU 使用率超过 70% 时,可以要求 ProcDump 转储核心: + +``` +procdump -C 70 -n 3 -p 351014 +``` + +### 结论 + +ProcDump 是一长串被移植到 Linux 的 Windows 程序中的一个有趣的补充。它不仅为 Linux 用户提供了额外的工具选择,而且可以让 Windows 用户在 Linux 上工作时更有熟悉的感觉。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/7/procdump-linux + +作者:[Gaurav Kamathe][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/gkamathe +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/dumptruck_car_vehicle_storage_container_road.jpg?itok=TWK0CbX_ (Dump truck rounding a turn in the road) +[2]: https://www.zdnet.com/article/microsoft-working-on-porting-sysinternals-to-linux/ +[3]: https://docs.microsoft.com/en-us/sysinternals/ +[4]: https://github.com/Microsoft/ProcDump-for-Linux +[5]: https://docs.microsoft.com/en-us/sysinternals/downloads/procdump +[6]: https://gcc.gnu.org/ +[7]: https://www.gnu.org/software/gdb/ diff --git a/published/202008/20200717 Decentralized Messaging App Riot Rebrands to Element.md b/published/202008/20200717 Decentralized Messaging App Riot Rebrands to Element.md new file mode 100644 index 0000000000..ffa0796b6d --- /dev/null +++ b/published/202008/20200717 Decentralized Messaging App Riot Rebrands to Element.md @@ -0,0 +1,74 @@ +[#]: collector: (lujun9972) +[#]: translator: (wxy) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12563-1.html) +[#]: subject: (Decentralized Messaging App Riot Rebrands to Element) +[#]: via: (https://itsfoss.com/riot-to-element/) +[#]: author: (John Paul https://itsfoss.com/author/john/) + +去中心化的消息应用 Riot 改名为 Element +====== + +Riot 曾经是,现在也是一款基于开源 Matrix 协议的去中心化即时通讯应用。 + +6 月底,Riot 即时通讯客户端宣布将改名。他们透露,他们的新名字是 [Element][1]。让我们来看看 Riot 为什么要改名,还有哪些要改。 + +### 为什么从 Riot 改名为 Element? + +![][2] + +在说到最新的公告之前,我们先来看看他们当初为什么要改名。 + +根据 6 月 23 日的一篇[博客文章][3],该组织改名有三个原因。 + +首先,他们表示“某大型游戏公司”曾多次阻止他们注册 Riot 和 Riot.im 产品名称的商标。如果要我猜的话,他们可能指的就是这家[“游戏公司”][4])。 + +其次,他们选择 Riot 这个名字的初衷是为了“唤起一些破坏性和活力的东西”。他们担心人们反而认为这个应用是“专注于暴力”。我想,当前的情形下,这个名字并不算好。 + +第三,他们希望澄清 Riot 涉及的众多品牌名称所造成的混乱。例如,Riot 是由一家名为 New Vector 的公司创建的,而 Riot 是托管在 Modular 上,Modular 也是 New Vector 的产品。他们希望简化他们的命名系统,以避免混淆潜在客户。当人们寻找消息解决方案时,他们希望他们只需要寻找一个名字:Element。 + +### 元素即一切 + +![][5] + +从 7 月 15 日开始,该应用的名称和公司的名称已经改为 Element(元素)。他们的 Matrix 托管服务现在将被称为 Element Matrix Services。他们的公告很好地总结了这一点。 + +> “对于那些第一次发现我们的人来说,Element 是 Matrix 通信网络中的旗舰级安全协作应用。Element 让你拥有自己的端到端加密聊天服务器,同时还能与更广泛的 Matrix 网络中的其他人连接。” + +他们之所以选择 Element 这个名字,是因为它“反映了我们在设计 RiotX 时对简单和清晰的强调;这个名字突出了我们一心一意将 Element 打造成可以想象的最优雅和最实用的主流通讯应用的使命”。他们还说,他们想要一个“能唤起数据所有权和自我主权的概念”的名字。他们还认为这是一个很酷的名字。 + +### 除了改个名之外 + +![][6] + +最近的公告也表明,此举不仅仅是简单的改名。Element 还发布了“新一代安卓版 Matrix 客户端”。该客户端的前身是 RiotX,现在改名为 Element。(还有呢?)它对以前的客户端进行了彻底的重写,现在支持 VoIP 通话和小部件。Element 还将在 iOS 上推出,支持 iOS 13,并提供“全新的推送通知支持”。 + +Element Web 客户端也得到了一些关爱,更新了 UI 和新的更容易阅读的字体。他们还“重写了房间列表控件 —— 增加了房间预览(!!)、按字母顺序排列、可调整列表大小、改进的通知用户界面等”。他们还开始努力改进端到端加密。 + +### 最后思考 + +Element 公司的人迈出了一大步,做出了这样的重大改名。他们可能会在短期内失去一些客户。(这可能主要是由于出于某种原因没有意识到名称的改变,或者不喜欢改变)。然而从长远来看,品牌简化将帮助他们脱颖而出。 + +我唯一要提到的负面说明是,这是他们在该应用历史上的第三次改名。在 2016 年发布时,它最初被命名为 Vector。当年晚些时候改名为 Riot。希望 Element 能一直用下去。 + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/riot-to-element/ + +作者:[John Paul][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://itsfoss.com/author/john/ +[b]: https://github.com/lujun9972 +[1]: https://element.io/ +[2]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/07/riot-to-element.png?ssl=1 +[3]: https://element.io/blog/the-world-is-changing/ +[4]: https://en.wikipedia.org/wiki/Riot_Games +[5]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/07/element-desktop.jpg?ssl=1 +[6]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/07/element-apps.jpg?ssl=1 +[7]: http://reddit.com/r/linuxusersgroup diff --git a/published/202008/20200717 How to configure an SSH proxy server with Squid.md b/published/202008/20200717 How to configure an SSH proxy server with Squid.md new file mode 100644 index 0000000000..5062eb7245 --- /dev/null +++ b/published/202008/20200717 How to configure an SSH proxy server with Squid.md @@ -0,0 +1,107 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12476-1.html) +[#]: subject: (How to configure an SSH proxy server with Squid) +[#]: via: (https://fedoramagazine.org/configure-ssh-proxy-server/) +[#]: author: (Curt Warfield https://fedoramagazine.org/author/rcurtiswarfield/) + +如何使用 Squid 配置 SSH 代理服务器 +====== + +![](https://img.linux.net.cn/data/attachment/album/202008/01/162730tx0czx60xs6wz00c.jpg) + +有时你无法从本地连接到 SSH 服务器。还有时,你可能想为 SSH 连接添加额外的安全层。在这些情况下,通过代理服务器连接到 SSH 服务器是一种解决方式。 + +[Squid][2] 是提供缓存和代理服务的全功能代理服务器应用。它通常用于在浏览过程中重用和缓存以前请求的网页来帮助缩短响应时间并减少网络带宽。 + +但是在本篇中,你将配置 Squid 作为 SSH 代理服务器,因为它是强大的受信任代理服务器,易于配置。 + +### 安装和配置 + +使用 [sudo][3] 安装 squid 软件包: + +``` +$ sudo dnf install squid -y +``` + +squid 配置文件非常庞大,但是我们只需要配置其中一些。Squid 使用访问控制列表来管理连接。 + +编辑 `/etc/squid/squid.conf` 文件,确保你有下面解释的两行。 + +首先,指定你的本地 IP 网络。默认配置文件已经列出了最常用的,但是如果没有,你需要添加你的配置。例如,如果你的本地 IP 网络范围是 192.168.1.X,那么这行会是这样: + +``` +acl localnet src 192.168.1.0/24 +``` + +接下来,添加以下行,将 SSH 端口添加为安全端口: + +``` +acl Safe_ports port 22 +``` + +保存该文件。现在启用并重启 squid 代理服务: + +``` +$ sudo systemctl enable squid +$ sudo systemctl restart squid +``` + +squid 代理默认监听 3128 端口。配置 firewalld 允许此服务: + +``` +$ sudo firewall-cmd --add-service=squid --perm +$ sudo firewall-cmd --reload +``` + +### 测试 ssh 代理连接 + +要通过 ssh 代理服务器连接到服务器,我们将使用 `netcat`。 + +如果尚未安装 `nmap-ncat`,请安装它: + +``` +$ sudo dnf install nmap-ncat -y +``` + +这是标准 ssh 连接示例: + +``` +$ ssh user@example.com +``` + +这是使用 squid 代理服务器作为网关连接到该服务器的方式。 + +此示例假定 squid 代理服务器的 IP 地址为 192.168.1.63。你还可以使用 squid 代理服务器的主机名或 FQDN: + +``` +$ ssh user@example.com -o "ProxyCommand nc --proxy 192.168.1.63:3128 %h %p" +``` + +以下是这些选项的含义: + + * `ProxyCommand` – 告诉 ssh 使用代理命令。 + * `nc` – 用于建立与代理服务器连接的命令。这是 netcat 命令。 + * `%h` – 代理服务器的主机名或 IP 地址的占位符。 + * `%p` – 代理服务器端口号的占位符。 + +有很多方法可以配置 SSH 代理服务器,但这是入门​​的简单方法。 + +-------------------------------------------------------------------------------- + +via: https://fedoramagazine.org/configure-ssh-proxy-server/ + +作者:[Curt Warfield][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://fedoramagazine.org/author/rcurtiswarfield/ +[b]: https://github.com/lujun9972 +[1]: https://fedoramagazine.org/wp-content/uploads/2020/07/squid_ssh_proxy-816x345.png +[2]: http://www.squid-cache.org/ +[3]: https://fedoramagazine.org/howto-use-sudo/ diff --git a/published/202008/20200720 Balloon-powered internet service goes live in Kenya.md b/published/202008/20200720 Balloon-powered internet service goes live in Kenya.md new file mode 100644 index 0000000000..782f7bae60 --- /dev/null +++ b/published/202008/20200720 Balloon-powered internet service goes live in Kenya.md @@ -0,0 +1,65 @@ +[#]: collector: (lujun9972) +[#]: translator: (JonnieWayy) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12485-1.html) +[#]: subject: (Balloon-powered internet service goes live in Kenya) +[#]: via: (https://www.networkworld.com/article/3566295/balloon-powered-internet-service-goes-live-in-kenya.html) +[#]: author: (Patrick Nelson https://www.networkworld.com/author/Patrick-Nelson/) + +气球驱动的互联网服务在肯尼亚上线 +====== + +> Alphabet 的衍生产品 [Loon][1] 使用气球创建了一个由蜂窝塔构成的漂浮网络。 + +![](https://images.idgesg.net/images/article/2020/07/loon-aerial-100852193-large.jpg) + +ISP [Telkom Kenya][2] 正在启动第一个使用气球的商业化 4G LTE 服务,气球的作用是在漂浮在平流层中作为蜂窝塔网络。 + +据 Alphabet 的衍生产品及底层技术提供商 [Loon][1] 的首席执行官 Alastair Westgarth 所说,这项服务起初将会覆盖肯尼亚接近 19000 平方英里的范围。 Westgarth 在 [Medium][3] 上的一篇文章中说,将会有大约 35 个或更多的气球组成编队,它们持续不断地移动,漂浮在地表上方大约 12 英里的平流层中。“我们将 Loon 称为漂浮的蜂窝塔网络。” Westgarth 说道。 + +Telkom Kenya 的首席执行官 Mugo Kibati 在一篇[新闻稿][4]中提到,传统互联网对肯尼亚的服务不足,这是采用这种输送装置的原因。“…… 具有互联网功能的气球能够为生活在偏远地区的许多肯尼亚人提供联系,这些地区服务不足或是完全没有服务,仍然处于不利地位。” Kibati 说道。远程医疗和在线教育是两个预期的用例。 + +在测试中, Loon 实现了 19 毫秒延迟的 18.9 Mbps 下行速度,以及 4.74 Mbps 的上行速度。 Westgarth 说,该服务能够用于“语音通话、视频通话、 YouTube、 WhatsApp、电子邮件、发短信、网页浏览”和其他应用程序。 + +从更大的角度看,从平流层提供互联网服务对于[物联网(IoT )][5]来说是一个诱人的主张。在高空,网络覆盖范围可能会更广泛,并且覆盖范围可以随着需求的变化而变化(例如,采矿区的移动)。此外,要建立或处理的地面基础设施更少。 比方说,开发人员可以避免铺设电缆所需的私有地产的纠纷。 + +可以想象,服务中断也更加可控。提供商可以发射另一台设备,而不必通过复杂的远程地面基础设施来跟踪故障。备用气球可随时备用。 + +### 基于无人机的互联网交付 + +另一家正在探索大气层互联网的组织是软银,它称其 260 英尺宽的 HAWK30 无人机是“平流层中的漂浮基站”。(参见相关故事:[软银计划到 2023 年实现无人机交付的物联网和互联网][6]) + +日本大型电信公司对平流层传输的互联网感兴趣的原因之一是,该群岛易于发生自然灾害,例如地震。与传统的基站相比,地球上空的浮动基站更容易移动,从而可以更快、更灵活地应对自然灾害。 + +实际上,Loon 的气球已经成功地用于在灾难后提供互联网服务:例如,在 2017 年波多黎各的飓风 Maria 之后,Loon 提供了连接。 + +Westgarth 说,自最初开发以来,Loon 的气球已经取得了长足的发展。现如今,发射是通过自动设备执行的,该设备可以每半小时一次将与地面站点相连的气球推到 60000 英尺高空,而不像以前那样人工进行。 + +机器学习算法会处理导航,以尝试向用户提供持续的服务。但是,这并非总是可能的,因为风(尽管在地面上没有那么大)和受限的空域都会影响覆盖范围,尽管 Westgarth 称之为“精心编排组织的气球舞蹈”。 + +此外,这些设备是太阳能供电的,这意味着它们只能够在白天工作并提供互联网(或重新定位自身,或向其他气球传输互联网)。出于上述原因和其他的一些原因, Westgarth 和 Kibati 指出,气球必须扩大现有的基础设施和计划,但这并不是一个完整的解决方案。 + +Westgarth 说:“为了连接现在和将来需要它的所有人员和事物,我们需要开阔我们的思维;我们需要在连通性生态系统中增加新的一层。” + +-------------------------------------------------------------------------------- + +via: https://www.networkworld.com/article/3566295/balloon-powered-internet-service-goes-live-in-kenya.html + +作者:[Patrick Nelson][a] +选题:[lujun9972][b] +译者:[JonnieWayy](https://github.com/JonnieWayy) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://www.networkworld.com/author/Patrick-Nelson/ +[b]: https://github.com/lujun9972 +[1]: https://loon.com/ +[2]: https://www.telkom.co.ke/ +[3]: https://medium.com/loon-for-all/loon-is-live-in-kenya-259d81c75a7a +[4]: https://telkom.co.ke/telkom-and-loon-announce-progressive-deployment-loon-technology-customers-july +[5]: https://www.networkworld.com/article/3207535/what-is-iot-the-internet-of-things-explained.html +[6]: https://www.networkworld.com/article/3405170/softbank-plans-drone-delivered-iot-and-internet-by-2023.html +[7]: https://www.facebook.com/NetworkWorld/ +[8]: https://www.linkedin.com/company/network-world diff --git a/published/202008/20200721 Video Trimmer- A No-nonsense, Simple Video Trimming Application for Linux Desktop.md b/published/202008/20200721 Video Trimmer- A No-nonsense, Simple Video Trimming Application for Linux Desktop.md new file mode 100644 index 0000000000..1be71f5264 --- /dev/null +++ b/published/202008/20200721 Video Trimmer- A No-nonsense, Simple Video Trimming Application for Linux Desktop.md @@ -0,0 +1,76 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12480-1.html) +[#]: subject: (Video Trimmer: A No-nonsense, Simple Video Trimming Application for Linux Desktop) +[#]: via: (https://itsfoss.com/video-trimmer/) +[#]: author: (Ankush Das https://itsfoss.com/author/ankush/) + +Video Trimmer:Linux 桌面中的傻瓜级的视频修剪应用 +====== + +> 一个非常简单的工具,无需重新编码即可快速修剪视频。我们来看看它提供了什么。 + +你可能已经知道 Linux 的一些[最佳免费视频编辑器][1],但并不是每个人都需要它们提供的所有功能。 + +有时,你只想快速执行一项操作,例如修剪视频。你是选择探索功能完善的视频编辑器但只是执行简单的修剪操作,还是希望使用便捷工具来修剪视频? + +当然,这取决于你的个人喜好以及处理视频的方式。但是,对于大多数用户而言,首选是使用非常容易使用的修剪工具。 + +因此,我想重点介绍一个傻瓜级的开源工具,即 “[Video Trimmer][2]”,它可以快速修剪视频。 + +![][3] + +### Video Trimmer:一个用于快速修剪视频的傻瓜应用 + +Video Trimmer 是一个开源应用,它可帮助你修剪视频片段而无需重新编码。因此,基本上,你可以能够修剪视频而不会失去原始质量。 + +你要做的就是使用 Video Trimmer 打开视频文件,然后使用鼠标选择要修剪的时间区域。 + +你可以手动设置要修剪的时间范围,也可以仅使用鼠标拖动区域进行修剪。当然,如果视频文件很长,而且你不知道从哪里看,手动设置时间戳可能需要一段时间。 + +为了让你有个印象,请看下面的截图,看看在使用 Video Trimmer 时可用的选项: + +![][4] + +### 在 Linux 上安装 Video Trimmer + +Video Trimmer 仅作为 [Flathub][5] 上的 Flatpak 软件包提供。因此,你应该能够在 Flatpak 支持的任何 Linux 发行版上安装它,而不会出现任何问题。 + +以防你不了解 Flatpak,你可能想要参考我们的[使用和安装 Flatpak][6] 指南。 + +- [下载 Video Trimmer(Flathub)][5] + +### 总结 + +Video Trimmer 底层使用 [ffmpeg][7]。它所做的可以在终端中轻松[使用 ffmpeg 命令][8]完成。但是,并非所有人都希望使用终端来剪辑视频的一部分。Video Trimmer 之类的工具可以帮助像我这样的人。 + +由于某些原因,如果你想寻找一种替代方法,也可以尝试使用 [VidCutter][9]。当然,你始终可以依靠 [Linux 中的顶级视频编辑器][10](例如 [OpenShot][11]) 来修剪视频以及执行一些高级操作的能力。 + +你认为在 Linux 中使用 Video Trimmer 如何?你是否有其他喜欢的视频修剪工具?在下面的评论中让我知道你的想法! + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/video-trimmer/ + +作者:[Ankush Das][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://itsfoss.com/author/ankush/ +[b]: https://github.com/lujun9972 +[1]: https://itsfoss.com/open-source-video-editors/ +[2]: https://gitlab.gnome.org/YaLTeR/video-trimmer +[3]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/07/video-trimmer.jpg?ssl=1 +[4]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/07/video-trimmer-screenshot.jpg?ssl=1 +[5]: https://flathub.org/apps/details/org.gnome.gitlab.YaLTeR.VideoTrimmer +[6]: https://itsfoss.com/flatpak-guide/ +[7]: https://ffmpeg.org/ +[8]: https://itsfoss.com/ffmpeg/ +[9]: https://itsfoss.com/vidcutter-video-editor-linux/ +[10]: https://linux.cn/article-10185-1.html +[11]: https://itsfoss.com/openshot-video-editor-release/ diff --git a/published/202008/20200722 The feature that makes D my favorite programming language.md b/published/202008/20200722 The feature that makes D my favorite programming language.md new file mode 100644 index 0000000000..74ecc7473c --- /dev/null +++ b/published/202008/20200722 The feature that makes D my favorite programming language.md @@ -0,0 +1,150 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12489-1.html) +[#]: subject: (The feature that makes D my favorite programming language) +[#]: via: (https://opensource.com/article/20/7/d-programming) +[#]: author: (Lawrence Aberba https://opensource.com/users/aberba) + +我最喜欢的 D 语言功能 +====== + +> UFCS 能让你能够编写自然的可重用代码而不会牺牲便利性。 + +![](https://img.linux.net.cn/data/attachment/album/202008/05/215524d9j62oui7mgm7ms9.jpg) + +早在 2017 年,我就写过为什么 [D 语言是开发的绝佳选择][2]的文章。但是 D 语言中有一个出色的功能我没有充分的展开介绍:[通用函数调用语法][3]Universal Function Call Syntax(UFCS)。UFCS 是 D 语言中的一种[语法糖][4],它可以在类型(字符串、数字、布尔值等)上链接任何常规函数,就像该类型的成员函数一样。 + +如果你尚未安装 D 语言,请[安装 D 语言编译器][5],以便你可以自己[运行 D 代码][6]。 + +看一下以下示例代码: + +``` +// file: ufcs_demo.d + +module ufcs_demo; + +import std.stdio : writeln; + +int[] evenNumbers(int[] numbers) +{ + import std.array : array; + import std.algorithm : filter; + + return numbers.filter!(n => n % 2 == 0).array; +} + +void main() +{ + writeln(evenNumbers([1, 2, 3, 4])); +} +``` + +使用你喜欢的 D 语言编译器进行编译,查看这个简单示例应用做了什么: + +``` +$ dmd ufcs_demo.d +$ ./ufcs_demo +[2, 4] +``` + +但是,使用作为 D 语言的内置功能的 UFCS ,你还可以自然方式编写代码: + +``` +... +writeln([1, 2, 3, 4].evenNumbers()); +... +``` + +或完全删除现在多余的括号,使 `evenNumbers` 看起来像是一个属性: + +``` +... +writeln([1, 2, 3, 4].evenNumbers); // prints 2, 4 +... +``` + +因此,完整的代码现在变为: + +``` +// file: ufcs_demo.d + +module ufcs_demo; + +import std.stdio : writeln; + +int[] evenNumbers(int[] numbers) +{ + import std.array : array; + import std.algorithm : filter; + + return numbers.filter!(n => n % 2 == 0).array; +} + +void main() +{ + writeln([1, 2, 3, 4].evenNumbers); +} +``` + +使用你最喜欢的 D 语言编译器进行编译,然后尝试一下。 如预期的那样,它产生相同的输出: + +``` +$ dmd ufcs_demo.d +$ ./ufcs_demo +[2, 4] +``` + +在编译过程中,编译器*自动地*将数组作为函数的第一个参数。这是一个常规模式,使得使用 D 语言成为一种乐趣,因此,它与你自然而然考虑代码的感觉非常相似。结果就是函数式编程。 + +你可能会猜出这打印的是什么: + +``` +//file: cool.d +import std.stdio : writeln; +import std.uni : asLowerCase, asCapitalized; + +void main() +{ +    string mySentence = "D IS COOL"; +    writeln(mySentence.asLowerCase.asCapitalized); +} +``` + +确认一下: + + +``` +$ dmd cool.d +$ ./cool +D is cool +``` + +结合[其他 D 语言的功能][7],UFCS 使你能够编写可重用的代码,并在不牺牲便利性的情况下自然地进行编写。 + +### 是时候尝试 D 语言了 + +就像我之前写的那样,D 语言是一种很棒的开发语言。从 [D 语言的下载页面][8]可以很容易地进行安装,因此请下载编译器,查看示例,并亲自体验 D 语言。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/7/d-programming + +作者:[Lawrence Aberba][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/aberba +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/code_computer_laptop_hack_work.png?itok=aSpcWkcl (Coding on a computer) +[2]: https://opensource.com/article/17/5/d-open-source-software-development +[3]: http://ddili.org/ders/d.en/ufcs.html +[4]: https://en.wikipedia.org/wiki/Syntactic_sugar +[5]: https://tour.dlang.org/tour/en/welcome/install-d-locally +[6]: https://tour.dlang.org/tour/en/welcome/run-d-program-locally +[7]: https://dlang.org/comparison.html +[8]: https://dlang.org/download.html diff --git a/published/202008/20200722 Tiny Yet Useful- 13 Raspberry Pi Zero Alternatives That Cost Less Than -20.md b/published/202008/20200722 Tiny Yet Useful- 13 Raspberry Pi Zero Alternatives That Cost Less Than -20.md new file mode 100644 index 0000000000..ee522608b8 --- /dev/null +++ b/published/202008/20200722 Tiny Yet Useful- 13 Raspberry Pi Zero Alternatives That Cost Less Than -20.md @@ -0,0 +1,355 @@ +[#]: collector: (lujun9972) +[#]: translator: (silentdawn-zz) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12502-1.html) +[#]: subject: (Tiny Yet Useful: 13 Raspberry Pi Zero Alternatives That Cost Less Than $20) +[#]: via: (https://itsfoss.com/raspberry-pi-zero-alternatives/) +[#]: author: (Chinmay https://itsfoss.com/author/chinmay/) + +个头小本事大:13 种 20 美元以下的树莓派 Zero 替代品 +====== + +最近两年,[树莓派 Zero][1] 和 [树莓派 Zero W][2] 作为新成员出现在树莓派产品线中。这些超小型的单板计算机大受欢迎,而且会在相当长的一段时间内成为创客和 DIY 社区的 [树莓派项目][3] 的一部分。 + +为了实现更小尺寸和有效地控制价位,它们不得不在许多特性上做出让步,如放弃专用网口、采用更慢的处理器等(与其它们同族的全功能版相比)。 + +早先的一篇文章中,我们罗列了 [树莓派的最佳替代品][4]。这里,我将给出树莓派 Zero 和树莓派 Zero W 的一些替代品。 + +### 树莓派 Zero 替代品:应用于物联网和嵌入式项目的超小单板计算机 + +![][9] + +受益于开源设计和开源软件栈,我们有为不同项目提供的具有各种功能集的优秀替代品。所有这些板子运行的都是嵌入式 Linux 的各种变体。 + +尽管树莓派 Zero 和树莓派 Zero W 的发布价格分别是 5 美元和 10 美元,但即使是在美国境内,也很难按这个价格买到。在美国之外,更是要花 12 和 20 美元才有可能买到。 + +知道了这些,让我们看看一些 20 美元以下的树莓派 Zero 替代品。 + +#### 1、香蕉派 BPI M2 Zero + +![][10] + +香蕉派 M2 Zero 售价 **18 美元**,与树莓派 Zero W 拥有相同的布局。它看起来像是树莓派 Zero W 的复制品,但也仅仅是外形像而已。它使用的是更快的全志 H2+ SOC 芯片,而且可以外接网络模块。它还可以运行多种基于 Linux 的操作系统。 + +**主要参数** + + * 全志 H2+ 四核 Cortex-A7 处理器,Mali400MP2 GPU,H265/HEVC 1080P + * 512M DDR3 内存(与 GPU 共享) + * 40 针接口,与树莓派 3 兼容 + * 板载 WiFi(AP6212)、蓝牙,外部天线连接口 + * CSI 摄像头输入接口 + * 电源及复位按钮 + * Mini HDMI 视频输出 + +详情可参阅 [Banana Pi Wiki][11]。 + +#### 2、香蕉派 BPI-M2 Magic(BPi-M2M) + +![][13] + +这个型号有 2 个变体,无板载 eMMC 闪存的标价 **20 美元**。这是相对其尺寸而言拥有更大处理能力的小型单板计算机。我觉得毫无疑问它很适合作为物联网和自动家居中的触控面板和显示面板。其板载电源管理系统也很有吸引力。 + +**主要参数** + + * 全志 A33/R16 四核 ARM Cortex-A7 处理器,MALI 400 MP2 GPU + * 板载 802.11 b/g/n 2.4GHz WiFi(AP6212),蓝牙 4.0,支持 BLE + * 512MB DDR3(与 GPU 共享) + * MIPI 串行显示接口(DSI),4 数据通道 + * CSI 摄像头输入接口,最大分辨率 1080p 时可达 30 帧/秒 + * 板载话筒和电池管理 + * 无 HDMI 输出 + +详情可参阅 [Banana Pi Wiki][14]。 + +#### 3、香蕉派 BPI-P2 Maker + +![][16] + +它是带有板载网络模块及支持网口供电(POE)的最小的单板计算机之一,此板售价 **13 美元**(带有 POE 模块的版本售价 **19 美元**)。和香蕉派 M2 Zero 一样,使用的是全志 H2+ SOC 芯片,是块非常有趣的板子。它具有板载 8 GB eMMC 存储空间及摄像头接口,同时具有 POE 功能,可用于 DIY 监控摄像,也可以作为基本的机器学习处理器使用。 + +**主要参数** + + * 处理器:全志 H2+,四核,Cortex-A7 架构 + * 512MB DDR 3 同步动态随机存取内存 + * 板载 WiFi(AP6212)和蓝牙 + * 板载 8G eMMC 闪存 + * 100M 网络 + * Mini HDMI + * CSI 摄像头接口 + * 具有 POE 模块,支持 IEEE 802.3af PoE 标准 + +详情可参阅 [Banana Pi Wiki][17]。 + +#### 4、桔子派 Zero LTS + +![][19] + +当前支持板载网络及 POE 的最小且最便宜的单板计算机,售价仅为 **11.49 美元**(256 MB 内存版本售价 **9.49 美元**)。其采用非常常见的全志 H2+ 处理器,并通过 GPIO 和 13 针功能头提供可靠的扩展方式。 + +**主要参数** + + * 全志 H2+ 四核 Cortex-A7 架构处理器,视频支持 H.265/HEVC 1080P + * Mali400MP2 GPU @600MHz + * 256MB/512MB DDR3 SDRAM(与 GPU 共用)(256 MB 版为标准版) + * 10/100M 自适应网络,RJ45 网口,POE 功能默认关闭 + * WiFi 使用 XR819 方案,支持 IEEE 802.11 b/g/n + * 26 针 GPIO 连接头 + * 13 针连接头,包含 2 路 USB、红外线接口和声音端口(MIC、AV) + +详情可参阅 [官方网站][20]。 + +#### 5、桔子派 i96 + +![][24] + +尺寸仅有 6×3 平方厘米,个头最小的型号之一,售价 **8.8 美元**。该板使用 [RDA8810PL 处理器][25],可作为相当先进的功能手机,(据厂商称)适合摄像应用,最高可以 30 帧/秒的速率采集 1080p 分辨率的图像。在同等价位产品中,输入输出功能出色。 + +**主要参数** + + * RDA8810PL ARM Cortex-A5 32 位单核处理器 + * Vivante 出品 GC860 GPU + * 集成 256MB LPDDR2 SDRAM + * RDA5991 方案的 WiFi 和蓝牙 + * CSI 摄像头输入接口 + * 40 针 GPIO 头 + +详情可参阅 [官方网站][26]。 + +#### 6、桔子派 PC + +![][28] + +该板售价 **15 美元**,包含了很多功能。是在同等价位板子中少有的集成了 1 GB 内存的型号之一。采用全志 H3 SoC 芯片,可解码 4K HEVC/H.265 视频。具有 HDMI 输出口并支持 HDCP 和 CEC。该单板计算机可以通过安装软件成为一个很好用的媒体盒子。它竟然还配备了板载红外接收器和话筒。 + +**主要参数** + + * 全志 H3 四核 Cortex-A7 架构处理器,主频 1.6 GHz + * 1GB DDR3 内存(与 GPU 共享) + * 支持 4K 输出的 HDMI + * CSI 摄像头接口,板载话筒 + * SD 卡槽 + * IR 接收器 + * 3.5mm 音频接口 + * 网络接口 + * 板上无 WiFi 和蓝牙 + +桔子派 PC 还有一种减配版,使用的是同样的处理器,只是内存容量要小。 + +详情可参阅 [官方网站][29]。 + +#### 7、桔子派 One 和桔子派 Lite + +这两种板子与桔子派 PC 一样,使用的是全志 H3 处理器,但配备的是 512MB 内存。 + +**主要参数** + + * 全志 H3 四核处理器 + * HDMI 输出,支持 4K 高清 + * SD 卡槽 + * 512 MB DDR3 内存 + * CSI 摄像头接口 + +![Orange Pi Lite][31] + +![Orange Pi One][32] + +桔子派 Lite 售价 **12 美元**,不支持板载有线网络,但提供了 WiFi 联网功能。其具有板载话筒和红外接收器。详情可参阅 [官方网站][33]。 + +桔子派 One 售价 **11 美元**,具有板载有线网络,但不支持 WiFi。详情可参阅 [官方网站][35]。 + +在桔子派相关内容的最后,我想简单提一下他们提供的几种适合自定义应用的板子。 + + * 桔子派 R1 – 具有双有线网口的小板子,可用于构建网络设备。 + * Orange Pi 2G IOT 和 Orange Pi 3G IOT - 这些板子分别提供了 2G 和 3G 蜂窝网络连接能力,适合作为物联网设备。 + +这些板子都不超过 **20 美元**,详情可参阅 [官方网站][37]。 + +#### 8、NanoPi Neo LTS + +![][38] + +起步价 **9.99 美元**,该板非常袖珍(4x4 平方厘米),与桔子派 Zero 规格相似。不同的是,它使用的是更为强悍的全志 H3 SoC 芯片和高达 512MB 的内存。虽然无任何板载 WiFi 和蓝牙芯片,但可以通过 USB 接口外接相关器件获得相应功能。该板非常适合作为无显示器的 Linux 服务器、DNS 过滤器(如 Pi-Hole),同时也很适合作为物联网应用的边缘设备使用。通过 GPIO 可以扩展出你需要的很多功能。 + +**主要参数** + + * 全志 H3 四核处理器,Cortex A7 内核,主频 1.2 GHz + * 512 MB 内存 + * Micro SD 卡槽(最高支持 128 GB) + * 10/100 Mbps 网口 + * 冗余 GPIO 针可实现其它所需功能 + +可从 [官方网站][39] 了解详情及购买。 + +![][40] + +NanoPi NEO 的极简版称为 NanoPi NEO Core LTS,该极简版为满足工业应用需求增加了 eMMC 存储,且通过扩展 GPIO 提供了板载 USB 接口和板载网络接口。详情参阅 [这里][41]。 + +![][42] + +Nano NEO Air 的 WiFi/蓝牙版称为 NanoPi NEO Air,提供了 eMMC 存储和摄像头输入接口,提供了板载 USB 接口和板载网络接口。详情参阅 [这里][43]. + +#### 9、Zero Pi + +![][44] + +这是所有这里提到的板子中,我最感兴趣的板子之一,售价 **9.99 美元**,具有板载千兆网口,使用全志 H3 处理器,小而强悍,适合应用于网络相关场景。它可以运行 OpenWRT,和其配备的千兆网络相得益彰。在作为 DNS 服务器运行的同时,还可以运行 Pi-Hole 的多个实例。 + +**主要参数** + + * 全志 H3 四核处理器,Cortex A7 架构,主频最高 1.2GHz + * 512MB 内存 + * USB 2.0 接口 + * 可运行 OpenWRT + +可从 [官方网站][45] 了解详情及下单购买。 + +#### 10、NanoPi NEO 2 + +![][46] + +NanoPi NEO 2 售价 **19.99 美元**,是 NanoPi NEO 的 2 倍。其外形尺寸与 NanoPi Neo 相同,但使用的是全志 H5 处理器,并配备了千兆网功能。这使得该板子个头小而性能强。 + +**主要参数** + + * 全志 H5 处理器,四核 64 位,高性能 Cortex A53 架构 + * Hexacore Mali450 GPU + * 512MB 内存 + * 1Gbps 板载网络 + * 24 针 GPIO + * 包含音频及红外之类功能的外接口 + +可从 [官方网站][47] 了解详情及下单购买。 + +上面的链接是关于 NanoPi 系列板子的。除此之外,还有一些其它有趣的板子,如配备双千兆网口的,以及针对摄像头应用的。 + +#### 11、La Frite + +![][48] + +出品商是 [Le Potato][49],售价 **20 美元**,主要面向媒体消费及流媒体。它通过 HDMI 2.0 接口以 HDR 方式实现 1080p 视频播放,支持最新的安卓 9 /电视、上游的 Linux、u-boot、Kodi 等。 + +**主要参数** + + * Amlogic S805X 处理器,四核,Cortex-A53 架构,主频 1.2GHz + * 最大 1GB DDR4 SDRAM + * Amlogic 视频引擎 10,支持 H.264、H.265 和 VP9 解码,最高能以 60 帧/秒的速率实现 1080p 高清 + * 百兆网 + * 红外接器 + * 40 针 GPIO + +详情可参阅 [官方网站][50]。 + +#### 12、Onion Omega2+ + +![][51] + +如果你需要的是应用于物联网场景的单板计算机,那么 [Onion Omega][52] 2+ 是替代树莓派 Zero 的很好选择。它是针对物联网的开发平台,运行的是基于 [OpenWRT][53] 的嵌入式 Linux 开发环境。 + +**主要参数** + + * MT7688 SoC 芯片 + * 2.4 GHz WiFi,支持 IEEE 802.11 b/g/n + * 128 MB DDR2 内存 + * 32 MB 板载闪存 + * MicroSD 卡槽 + * USB 2.0 + * 12 个 GPIO 引针 + +你可以 **13 美元** 的单价从 [官方网站][54] 购买其极简版,并可以选配各种附件。 + +#### 13、VoCore2 + +![][55] + +VoCore2 肯定是类似产品中最小的一款,极简版尺寸只有 1 英寸见方,售价 **17.99 美元**。小巧的尺寸使得其能方便的嵌入到不同的应用场合,而且允许根据需要扩充不同的特性。该板使用过的是联发科针对中低端路由器的处理器 MT7628 处理器。生产商声明将持续供应至 2025 年,这是个不错的消息。 + +**主要参数** + + * 联发科 MT7628 处理器,主频 580 MHz,MIPS 24K + * 128MB DDR2 内存, 内存刷新率 166 MHz + * 1 或 5 网口,100 Mbps 网络 + * 无线网,支持 802.11n,双收双发,网速最高 300Mbps + * 板载 16M NOR 存储器,支持最大 2TB SDXC 卡 + * 一个板载 U.FL 槽(天线接口) + +你可以从 [此处][56] 了解更多细节。 + +### 结束语 + +无可否认,不同规格和特性的各种单板计算机可以满足千变万化的使用需求。另外,绝大部分此类产品都基于开源设计,运行着开源软件。这绝对是硬核玩家不可多得的乐园。 + +由于新冠病毒的肆虐,要上手这些板子可能要稍费周折,期待情况能尽快好转! + +如果各位知道树莓派 Zero 和树莓派 Zero W 的其它有趣的替代型号,请留言。我们根据情况检查充实。 + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/raspberry-pi-zero-alternatives/ + +作者:[Chinmay][a] +选题:[lujun9972][b] +译者:[silentdawn-zz](https://github.com/silentdawn-zz) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://itsfoss.com/author/chinmay/ +[b]: https://github.com/lujun9972 +[1]: https://www.raspberrypi.org/products/raspberry-pi-zero/ +[2]: https://itsfoss.com/raspberry-pi-zero-w/ +[3]: https://itsfoss.com/raspberry-pi-projects/ +[4]: https://linux.cn/article-10823-1.html +[5]: https://i1.wp.com/m.media-amazon.com/images/I/517BwcAPmTL._SL160_.jpg?ssl=1 +[6]: https://www.amazon.com/dp/B072N3X39J?tag=chmod7mediate-20&linkCode=ogi&th=1&psc=1 +[7]: https://www.amazon.com/gp/prime/?tag=chmod7mediate-20 (Amazon Prime) +[8]: https://www.amazon.com/dp/B072N3X39J?tag=chmod7mediate-20&linkCode=ogi&th=1&psc=1 (Buy on Amazon) +[9]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/07/raspberry-pi-zero-alterantives.png?ssl=1 +[10]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/07/banana-pi-zero-1.png?ssl=1 +[11]: http://wiki.banana-pi.org/Banana_Pi_BPI-M2_ZERO#Hardware_interfaces +[12]: https://www.aliexpress.com/item/32839074880.html?spm=2114.12010612.8148356.2.258c72dbKctWv3 +[13]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/07/Banana-Pi-M2M-2-1.jpg?ssl=1 +[14]: http://wiki.banana-pi.org/Banana_Pi_BPI-M2M +[15]: https://www.aliexpress.com/item/32836172813.html?spm=2114.12010612.8148356.2.25ac76c2BKPl43 +[16]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/07/Banana-Pi-P2-Zero-1.png?ssl=1 +[17]: http://wiki.banana-pi.org/Banana_Pi_BPI-P2_Zero +[18]: https://www.aliexpress.com/item/32953609399.html?spm=2114.12010612.8148356.6.6d4070a9ktu2qs +[19]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/07/Orange-Pi-Zero-LTS.png?ssl=1 +[20]: http://www.orangepi.org/orangepizerolts/ +[21]: https://i0.wp.com/m.media-amazon.com/images/I/51wOvNrzHkL._SL160_.jpg?ssl=1 +[22]: https://www.amazon.com/dp/B07ZYJGPF8?tag=chmod7mediate-20&linkCode=ogi&th=1&psc=1 (Orange Pi Zero Single Board Computer Quad Core Open-Source Development Board 512MB with WiFi Antenna) +[23]: https://www.amazon.com/dp/B07ZYJGPF8?tag=chmod7mediate-20&linkCode=ogi&th=1&psc=1 (Buy on Amazon) +[24]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/07/Orange-Pi-i96.png?ssl=1 +[25]: https://www.openhacks.com/uploadsproductos/2016030304473558.pdf +[26]: http://www.orangepi.org/OrangePii96/ +[27]: https://www.aliexpress.com/item/32819068354.html?spm=2114.12010612.8148356.2.7cb16aa1JdhlzK +[28]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/07/opipc.png?ssl=1 +[29]: http://www.orangepi.org/orangepipc/ +[30]: https://www.aliexpress.com/item/32448079125.html +[31]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/07/Orange-Pi-Lite.png?ssl=1 +[32]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/07/Orange-Pi-One.png?ssl=1 +[33]: http://www.orangepi.org/orangepilite/ +[34]: https://www.aliexpress.com/item/32662738571.html?spm=2114.12010612.8148356.16.222f4f44KYIA5v +[35]: http://www.orangepi.org/orangepione/ +[36]: https://www.aliexpress.com/item/32603308880.html?spm=a2g0o.detail.1000060.1.4fb86a5eWkGEex&gps-id=pcDetailBottomMoreThisSeller&scm=1007.13339.146401.0&scm_id=1007.13339.146401.0&scm-url=1007.13339.146401.0&pvid=9042001e-bc4a-471b-a3a0-9f0d276d0c3f&_t=gps-id:pcDetailBottomMoreThisSeller,scm-url:1007.13339.146401.0,pvid:9042001e-bc4a-471b-a3a0-9f0d276d0c3f,tpp_buckets:668%230%23131923%2358_668%23808%237756%23236_668%23888%233325%232_668%232846%238111%23464_668%232717%237564%23664_ +[37]: http://www.orangepi.org +[38]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/07/NanoPi-NEO_04-900x630-1.jpg?ssl=1 +[39]: https://www.friendlyarm.com/index.php?route=product/product&path=69&product_id=132&sort=p.price&order=ASC +[40]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/07/Core_04-900x630-1.jpg?ssl=1 +[41]: https://www.friendlyarm.com/index.php?route=product/product&path=69&product_id=212&sort=p.price&order=ASC +[42]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/07/air_03-900x630-1.jpg?ssl=1 +[43]: https://www.friendlyarm.com/index.php?route=product/product&path=69&product_id=151&sort=p.price&order=ASC +[44]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/07/ZeroPi_03-900x630-1.jpg?ssl=1 +[45]: https://www.friendlyarm.com/index.php?route=product/product&path=69&product_id=266&sort=p.price&order=ASC +[46]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/07/NEO2_04-900x630-1.jpg?ssl=1 +[47]: https://www.friendlyarm.com/index.php?route=product/product&product_id=180 +[48]: https://i0.wp.com/cdn.shopify.com/s/files/1/1098/4826/products/84988b14aa58054c0a4cbf8c03466fa9_original_1024x1024.jpg?resize=544%2C306&ssl=1 +[49]: https://libre.computer/products/boards/aml-s905x-cc/ +[50]: https://libre.computer/products/boards/aml-s805x-ac/ +[51]: https://i0.wp.com/onion.io/wp-content/uploads/2019/08/OM-O2P.jpg?resize=424%2C424&ssl=1 +[52]: https://itsfoss.com/onion-omega-2/ +[53]: https://openwrt.org/ +[54]: https://onion.io/ +[55]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/07/VoCore2.png?resize=719%2C319&ssl=1 +[56]: https://vocore.io/v2.html +[57]: https://vocore.io/ diff --git a/published/202008/20200727 5 open source IDE tools for Java.md b/published/202008/20200727 5 open source IDE tools for Java.md new file mode 100644 index 0000000000..39a7e37d65 --- /dev/null +++ b/published/202008/20200727 5 open source IDE tools for Java.md @@ -0,0 +1,106 @@ +[#]: collector: (lujun9972) +[#]: translator: (wxy) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12542-1.html) +[#]: subject: (5 open source IDE tools for Java) +[#]: via: (https://opensource.com/article/20/7/ide-java) +[#]: author: (Daniel Oh https://opensource.com/users/daniel-oh) + +5 个开源的 Java IDE 工具 +====== + +> Java IDE 工具提供了大量的方法来根据你的独特需求和偏好创建一个编程环境。 + +![](https://img.linux.net.cn/data/attachment/album/202008/22/235441wnnorcvo4olasv8o.jpg) + +通过简化程序员的工作,[Java][2] 框架可以使他们的生活更加轻松。这些框架是为了在各种服务器环境上运行各种应用程序而设计开发的;这包括解析注解、扫描描述符、加载配置以及在 Java 虚拟机(JVM)上启动实际的服务等方面的动态行为。控制这么多的任务需要更多的代码,这就很难降低内存占用、加快新应用的启动时间。无论如何,据 [TIOBE 指数][3],在当今使用的编程语言中 Java 一直排名前三,拥有着 700 万到 1000 万开发者的社区。 + +有这么多用 Java 编写的代码,这意味着有一些很好的集成开发环境(IDE)可供选择,可以为开发人员提供有效地编写、整理、测试和运行 Java 应用程序所需的所有工具。 + +下面,我将按字母顺序介绍五个我最喜欢的用于编写 Java 的开源 IDE 工具,以及如何配置它们的基本功能。 + +### BlueJ + +[BlueJ][4] 为 Java 初学者提供了一个集成的教育性 Java 开发环境。它也可以使用 Java 开发工具包(JDK)开发小型软件。各种版本和操作系统的安装方式都可以在[这里][5]找到。 + +在笔记本电脑上安装 BlueJ IDE 后,启动一个新项目,点击项目Project菜单中的新项目New Project,然后从创建一个新类New Class开始编写 Java 代码。生成的示例方法和骨架代码如下所示: + +![BlueJ IDE screenshot][6] + +BlueJ 不仅为学校的 Java 编程课的教学提供了一个交互式的图形用户界面(GUI),而且可以让开发人员在不编译源代码的情况下调用函数(即对象、方法、参数)。 + +### Eclipse + +[Eclipse][7] 是桌面计算机上最著名的 Java IDE 之一,它支持 C/C++、JavaScript 和 PHP 等多种编程语言。它还允许开发者从 Eclipse 市场中的添加无穷无尽的扩展,以获得更多的开发便利。[Eclipse 基金会][8]提供了一个名为 [Eclipse Che][9] 的 Web IDE,供 DevOps 团队在多个云平台上用托管的工作空间创建出一个敏捷软件开发环境。 + +[可以在这里下载][10];然后你可以创建一个新的项目或从本地目录导入一个现有的项目。在[本文][11]中找到更多 Java 开发技巧。 + +![Eclipse IDE screenshot][12] + +### IntelliJ IDEA + +[IntelliJ IDEA CE(社区版)][13]是 IntelliJ IDEA 的开源版本,为 Java、Groovy、Kotlin、Rust、Scala 等多种编程语言提供了 IDE。IntelliJ IDEA CE 在有经验的开发人员中也非常受欢迎,可以用它来对现有源码进行重构、代码检查、使用 JUnit 或 TestNG 构建测试用例,以及使用 Maven 或 Ant 构建代码。可在[这里][14]下载它。 + +IntelliJ IDEA CE 带有一些独特的功能;我特别喜欢它的 API 测试器。例如,如果你用 Java 框架实现了一个 REST API,IntelliJ IDEA CE 允许你通过 Swing GUI 设计器来测试 API 的功能。 + +![IntelliJ IDEA screenshot][15] + +IntelliJ IDEA CE 是开源的,但其背后的公司也提供了一个商业的终极版。可以在[这里][16]找到社区版和终极版之间的更多差异。 + +### Netbeans IDE + +[NetBeans IDE][17] 是一个 Java 的集成开发环境,它允许开发人员利用 HTML5、JavaScript 和 CSS 等支持的 Web 技术为独立、移动和网络架构制作模块化应用程序。NetBeans IDE 允许开发人员就如何高效管理项目、工具和数据设置多个视图,并帮助他们在新开发人员加入项目时使用 Git 集成进行软件协作开发。 + +[这里][18]下载的二进制文件支持 Windows、macOS、Linux 等多个平台。在本地环境中安装了 IDE 工具后,新建项目向导可以帮助你创建一个新项目。例如,向导会生成骨架代码(有部分需要填写,如 `// TODO 代码应用逻辑在此`),然后你可以添加自己的应用代码。 + +### VSCodium + +[VSCodium][19] 是一个轻量级、自由的源代码编辑器,允许开发者在 Windows、macOS、Linux 等各种操作系统平台上安装,是基于 [Visual Studio Code][20] 的开源替代品。其也是为支持包括 Java、C++、C#、PHP、Go、Python、.NET 在内的多种编程语言的丰富生态系统而设计开发的。Visual Studio Code 默认提供了调试、智能代码完成、语法高亮和代码重构功能,以提高开发的代码质量。 + +在其[资源库][21]中有很多下载项。当你运行 Visual Studio Code 时,你可以通过点击左侧活动栏中的“扩展”图标或按下 `Ctrl+Shift+X` 键来添加新的功能和主题。例如,当你在搜索框中输入 “quarkus” 时,就会出现 Visual Studio Code 的 Quarkus 工具,该扩展允许你[在 VS Code 中使用 Quarkus 编写 Java][22]: + +![VSCodium IDE screenshot][23] + +### 总结 + +Java 作为最广泛使用的编程语言和环境之一,这五种只是 Java 开发者可以使用的各种开源 IDE 工具的一小部分。可能很难知道哪一个是正确的选择。和以往一样,这取决于你的具体需求和目标 —— 你想实现什么样的工作负载(Web、移动应用、消息传递、数据交易),以及你将使用 IDE 扩展功能部署什么样的运行时(本地、云、Kubernetes、无服务器)。虽然丰富的选择可能会让人不知所措,但这也意味着你可能可以找到一个适合你的特殊情况和偏好的选择。 + +你有喜欢的开源 Java IDE 吗?请在评论中分享吧。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/7/ide-java + +作者:[Daniel Oh][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/daniel-oh +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/lenovo-thinkpad-laptop-window-focus.png?itok=g0xPm2kD (young woman working on a laptop) +[2]: https://opensource.com/resources/java +[3]: https://www.tiobe.com/tiobe-index/ +[4]: https://www.bluej.org/about.html +[5]: https://www.bluej.org/versions.html +[6]: https://opensource.com/sites/default/files/uploads/5_open_source_ide_tools_to_write_java_and_how_you_begin_it.png (BlueJ IDE screenshot) +[7]: https://www.eclipse.org/ide/ +[8]: https://www.eclipse.org/ +[9]: https://opensource.com/article/19/10/cloud-ide-che +[10]: https://www.eclipse.org/downloads/ +[11]: https://opensource.com/article/19/10/java-basics +[12]: https://opensource.com/sites/default/files/uploads/os_ide_2.png (Eclipse IDE screenshot) +[13]: https://www.jetbrains.com/idea/ +[14]: https://www.jetbrains.org/display/IJOS/Download +[15]: https://opensource.com/sites/default/files/uploads/os_ide_3.png (IntelliJ IDEA screenshot) +[16]: https://www.jetbrains.com/idea/features/editions_comparison_matrix.html +[17]: https://netbeans.org/ +[18]: https://netbeans.org/downloads/8.2/rc/ +[19]: https://vscodium.com/ +[20]: https://opensource.com/article/20/6/open-source-alternatives-vs-code +[21]: https://github.com/VSCodium/vscodium#downloadinstall +[22]: https://opensource.com/article/20/4/java-quarkus-vs-code +[23]: https://opensource.com/sites/default/files/uploads/os_ide_5.png (VSCodium IDE screenshot) diff --git a/published/202008/20200727 Analyze your web server log files with this Python tool.md b/published/202008/20200727 Analyze your web server log files with this Python tool.md new file mode 100644 index 0000000000..8143e4acb1 --- /dev/null +++ b/published/202008/20200727 Analyze your web server log files with this Python tool.md @@ -0,0 +1,114 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12512-1.html) +[#]: subject: (Analyze your web server log files with this Python tool) +[#]: via: (https://opensource.com/article/20/7/python-lars) +[#]: author: (Ben Nuttall https://opensource.com/users/bennuttall) + +使用这个 Python 工具分析你的 Web 服务器日志文件 +====== + +> 这个 Python 模块可以以多种格式收集网站使用日志并输出良好结构化数据以进行分析。 + +![](https://img.linux.net.cn/data/attachment/album/202008/13/155936kpaay0ypkmyk9qd0.jpg) + +是否想知道有多少访问者访问过你的网站?或哪个页面、文章或下载最受欢迎?如果你是自托管的博客或网站,那么无论你使用的是 Apache、Nginx 还是 Microsoft IIS(是的,没错),[lars][2]都可以为你提供帮助。 + +Lars 是 [Python][3] 写的 Web 服务器日志工具包。这意味着你可以使用 Python 通过简单的代码来回溯(或实时)解析日志,并对数据做任何你想做的事:将它存储在数据库中、另存为 CSV 文件,或者立即使用 Python 进行更多分析。 + +Lars 是 [Dave Jones][4] 写的另一个隐藏的宝石。我最初是在本地 Python 用户组中看到 Dave 演示 lars。几年后,我们开始在 [piwheels][5] 项目中使用它来读取 Apache 日志并将行插入到我们的 Postgres 数据库中。当树莓派用户从 [piwheels.org][6] 下载 Python 包时,我们会记录文件名、时间戳、系统架构(Arm 版本)、发行版名称/版本,Python 版本等。由于它是一个关系数据库,因此我们可以将这些结果加入其他表中以获得有关文件的更多上下文信息。 + +你可以使用以下方法安装lars: + +``` +$ pip install lars +``` + +在某些系统上,正确的方式是 `sudo` `pip3 install lars`。 + +首先,找到一个 Web 访问日志并制作一个副本。你需要将日志文件下载到计算机上进行操作。我在示例中使用的是 Apache 日志,但是经过一些小(且直观)的更改,你可以使用 Nginx 或 IIS。在典型的 Web 服务器上,你会在 `/var/log/apache2/` 中找到 Apache 日志,通常是 `access.log`、`ssl_access.log`(对于 HTTPS)或 gzip 压缩后的轮转日志文件,如 `access-20200101.gz` 或者 `ssl_access-20200101.gz` 。 + +首先,日志是什么样的? + +``` +81.174.152.222 - - [30/Jun/2020:23:38:03 +0000] "GET / HTTP/1.1" 200 6763 "-" "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:77.0) Gecko/20100101 Firefox/77.0" +``` + +这是一个显示了请求源 IP 地址、时间戳、请求文件路径(在本例中是主页 `/`)、HTTP 状态代码,用户代理(Ubuntu 上的 Firefox)等的请求。 + +你的日志文件将充满这样的条目,不仅是每个打开的页面,还包括返回的每个文件和资源:每个 CSS 样式表、JavaScript 文件和图像,每个 404 请求、每个重定向、每个爬虫。要从日志中获取有意义的数据,你需要对条目进行解析、过滤和排序。这就是 Lars 的用处。本示例将打开一个日志文件并打印每一行的内容: + +``` +with open('ssl_access.log') as f: +    with ApacheSource(f) as source: +        for row in source: +            print(row) +``` + +它会为每条日志显示如下结果: + +``` +Row(remote_host=IPv4Address('81.174.152.222'), ident=None, remote_user=None, time=DateTime(2020, 6, 30, 23, 38, 3), request=Request(method='GET', url=Url(scheme='', netloc='', path_str='/', params='', query_str='', fragment=''), protocol='HTTP/1.1'), status=200, size=6763) +``` + +它解析了日志条目,并将数据放入结构化格式中。该条目已成为具有与条目数据相关属性的[命名元组][7]namedtuple,因此,例如,你可以使用 `row.status` 访问状态代码,并使用 `row.request.url.path_str` 访问路径: + +``` +with open('ssl_access.log') as f: +    with ApacheSource(f) as source: +        for row in source: +            print(f'hit {row.request.url.path_str} with status code {row.status}') +``` + + +如果你只想显示 404 请求,可以执行以下操作: + +``` +with open('ssl_access.log') as f: +    with ApacheSource(f) as source: +        for row in source: +            if row.status == 404: +                print(row.request.url.path_str) + +``` + +你可能要对这些数据去重,并打印独立的 404 页面数量: + +``` +s = set() +with open('ssl_access.log') as f: +    with ApacheSource(f) as source: +        for row in source: +            if row.status == 404: +                s.add(row.request.url.path_str) +print(len(s)) +``` + +我和 Dave 一直在努力扩展 piwheel 的日志记录器,使其包含网页点击量、软件包搜索等内容,归功于 lars,这些并不难。它不会告诉我们有关用户的任何答案。我们仍然需要进行数据分析,但它去掉了复杂不便的文件格式,并以我们可以利用的方式将它放入我们的数据库。 + +查阅 lars 的文档,以了解如何读取 Apache、Nginx 和 IIS 日志,并了解你还可以使用它做什么。再次感谢 Dave 提供的出色工具! + +最初发布在 Ben Nuttall 的 Tooling Blog 中,并获许重新发布。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/7/python-lars + +作者:[Ben Nuttall][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/bennuttall +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/data_metrics_analytics_desktop_laptop.png?itok=9QXd7AUr (Person standing in front of a giant computer screen with numbers, data) +[2]: https://lars.readthedocs.io/en/latest/ +[3]: https://opensource.com/resources/python +[4]: https://twitter.com/waveform80/ +[5]: https://opensource.com/article/18/10/piwheels-python-raspberrypi +[6]: http://piwheels.org +[7]: https://docs.python.org/3/library/collections.html#collections.namedtuple \ No newline at end of file diff --git a/published/202008/20200728 BigBlueButton- Open Source Software for Online Teaching.md b/published/202008/20200728 BigBlueButton- Open Source Software for Online Teaching.md new file mode 100644 index 0000000000..846d64ff0a --- /dev/null +++ b/published/202008/20200728 BigBlueButton- Open Source Software for Online Teaching.md @@ -0,0 +1,92 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12492-1.html) +[#]: subject: (BigBlueButton: Open Source Software for Online Teaching) +[#]: via: (https://itsfoss.com/bigbluebutton/) +[#]: author: (Ankush Das https://itsfoss.com/author/ankush/) + +BigBlueButton:开源在线教学软件 +====== + +> BigBlueButton 是一个为在线教学量身定制的开源视频会议工具。让我们来看看它提供了什么。 + +在 2020 年,在家远程工作是一种新常态。当然,你不可能远程完成所有事情,但是在线教学是可以的。 + +尽管许多老师和学校组织不熟悉那些所有的出色工具,但某些[最好的开源视频会议工具][1]在一定程度上满足了要求。 + +在我提到的视频通话软件中,[BigBlueButton][2] 引起了我的注意。在这里,我将为你简单介绍。 + +### BigBlueButton:用于在线教学的开源 Web 会议系统 + +![][3] + +BigBlueButton 是一个开源的网络会议方案,它旨在简化在线学习。 + +它是完全免费的,但是需要你在自己的服务器上安装才能将其用作成熟的在线学习解决方案。 + +BigBlueButton 提供了非常好的一组功能。你可以轻松地尝试[演示实例][4],并在学校的服务器上进行安装。 + +开始之前,请先了解以下功能: + +### BigBlueButton 的功能 + +BigBlueButton 为教师和学校的量身定制了一系列在线课堂的有用功能,你可以获得: + + * 现场白板 + * 给公共和私人发消息 + * 支持网络摄像头 + * 支持会话记录 + * 支持表情符号 + * 能够将用户分组以进行团队协作 + * 支持投票 + * 屏幕共享 + * 支持多用户白板 + * 能够自行托管 + * 提供用于轻松集成到 Web 应用中的 API + +除了提供的功能外,你还能看到易于使用的 UI,即 [Greenlight][5] (BigBlueButton 的前端界面),当你在服务器上配置时可以安装它。 + +你可以尝试演示实例来临时免费地教你的学生。但是,考虑到使用[演示实例][4]来尝试 BigBlueButton 的局限性(限制为 60 分钟),建议你将它托管在服务器上,以探索其提供的所有功能。 + +为了更清楚地了解这些功能是如何工作的,你可能需要看下它的[官方教程](https://www.youtube.com/embed/Q2tG2SS4gXA)。 + +### 在你的服务器上安装 BigBlueButton + +他们提供了[详细文档][6],它对每个开发人员都会有用。安装它最简单、最快捷的方法是使用 [bbb-install 脚本][7],但是如果不成功,你也可以探索其他选项。 + +对于刚接触的人,你需要一台至少运行 Ubuntu 16.04 LTS 的服务器。在为 BigBlueButton 部署服务器之前,你应该查看[最低要求][8]。 + +你可以在它的 [GitHub 页面][9]中进一步了解该项目。 + +- [试用 BigBlueButton][2] + +如果你正在为在线教学寻求解决方案,那么 BigBlueButton 是一个不错的选择。 + +它可能不提供原生的智能手机应用,但你肯定可以用手机上的网络浏览器来访问它。当然,最好找一台笔记本电脑/计算机来访问在线教学平台,但它也可以在移动设备上使用。 + +你认为 BigBlueButton 的在线教学如何?有没有更好的开源项目可以替代?在下面的评论中让我知道! + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/bigbluebutton/ + +作者:[Ankush Das][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://itsfoss.com/author/ankush/ +[b]: https://github.com/lujun9972 +[1]: https://linux.cn/article-12453-1.html +[2]: https://bigbluebutton.org/ +[3]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/07/big-blue-button.png?ssl=1 +[4]: http://demo.bigbluebutton.org/ +[5]: https://bigbluebutton.org/2018/07/09/greenlight-2-0/ +[6]: https://docs.bigbluebutton.org/ +[7]: https://github.com/bigbluebutton/bbb-install +[8]: https://docs.bigbluebutton.org/2.2/install.html#minimum-server-requirements +[9]: https://github.com/bigbluebutton diff --git a/published/202008/20200728 Digging for DNS answers on Linux.md b/published/202008/20200728 Digging for DNS answers on Linux.md new file mode 100644 index 0000000000..c958e7dfb4 --- /dev/null +++ b/published/202008/20200728 Digging for DNS answers on Linux.md @@ -0,0 +1,229 @@ +[#]: collector: (lujun9972) +[#]: translator: (wxy) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12509-1.html) +[#]: subject: (Digging for DNS answers on Linux) +[#]: via: (https://www.networkworld.com/article/3568488/digging-for-dns-answers-on-linux.html) +[#]: author: (Sandra Henry-Stocker https://www.networkworld.com/author/Sandra-Henry_Stocker/) + +在 Linux 上挖掘 DNS 应答中的秘密 +====== + +> dig 是一个强大而灵活的工具,用于查询域名系统(DNS)服务器。在这篇文章中,我们将深入了解它的工作原理以及它能告诉你什么。 + +![](https://img.linux.net.cn/data/attachment/album/202008/11/235200wlyytlaymlylfdff.jpg) + +`dig` 是一款强大而灵活的查询 DNS 名称服务器的工具。它执行 DNS 查询,并显示参与该过程的名称服务器返回的应答以及与搜索相关的细节。系统管理员和 [DNS][3] 管理员经常使用 `dig` 来帮助排除 DNS 问题。在这篇文章中,我们将深入了解它的工作原理,看看它能告诉我们什么。 + +开始之前,对 DNS(域名系统)的工作方式有一个基本的印象是很有帮助的。它是全球互联网的关键部分,因为它提供了一种查找世界各地的服务器的方式,从而可以与之连接。你可以把它看作是互联网的地址簿,任何正确连接到互联网的系统,都应该能够使用它来查询任何正确注册的服务器的 IP 地址。 + +### dig 入门 + +Linux 系统上一般都默认安装了 `dig` 工具。下面是一个带有一点注释的 `dig` 命令的例子: + +``` +$ dig www.networkworld.com + +; <<>> DiG 9.16.1-Ubuntu <<>> www.networkworld.com <== 你使用的 dig 版本 +;; global options: +cmd +;; Got answer: +;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 6034 +;; flags: qr rd ra; QUERY: 1, ANSWER: 2, AUTHORITY: 0, ADDITIONAL: 1 + +;; OPT PSEUDOSECTION: +; EDNS: version: 0, flags:; udp: 65494 +;; QUESTION SECTION: <== 你的查询细节 +;www.networkworld.com. IN A + +;; ANSWER SECTION: <== 结果 + +www.networkworld.com. 3568 IN CNAME idg.map.fastly.net. +idg.map.fastly.net. 30 IN A 151.101.250.165 + +;; Query time: 36 msec <== 查询用时 +;; SERVER: 127.0.0.53#53(127.0.0.53) <== 本地缓存解析器 +;; WHEN: Fri Jul 24 19:11:42 EDT 2020 <== 查询的时间 +;; MSG SIZE rcvd: 97 <== 返回的字节数 +``` + +如果你得到了一个这样的应答,是好消息吗?简短的回答是“是”。你得到了及时的回复。状态字段(`status: NOERROR`)显示没有问题。你正在连接到一个能够提供所要求的信息的名称服务器,并得到一个回复,告诉你一些关于你所查询的系统的重要细节。简而言之,你已经验证了你的系统和域名系统相处得很好。 + +其他可能的状态指标包括: + +- `SERVFAIL`:被查询的名称存在,但没有数据或现有数据无效。 +- `NXDOMAIN`:所查询的名称不存在。 +- `REFUSED`:该区域的数据不存在于所请求的权威服务器中,并且在这种情况下,基础设施没有设置为提供响应服务。 + +下面是一个例子,如果你要查找一个不存在的域名,你会看到什么? + +``` +$ dig cannotbe.org + +; <<>> DiG 9.16.1-Ubuntu <<>> cannotbe.org +;; global options: +cmd +;; Got answer: +;; ->>HEADER<<- opcode: QUERY, status: NXDOMAIN, id: 35348 +;; flags: qr rd ra; QUERY: 1, ANSWER: 0, AUTHORITY: 0, ADDITIONAL: 1 +``` + +一般来说,`dig` 比 `ping` 会提供更多的细节,如果域名不存在,`ping` 会回复 “名称或服务未知”。当你查询一个合法的系统时,你可以看到域名系统对该系统知道些什么,这些记录是如何配置的,以及检索这些数据需要多长时间。 + +(LCTT 译注:`dig` 也比 `nslookup` 提供的数据更多。此外,`dig` 采用的是操作系统的解析库,而 `nslookup` 采用的是自己提供的解析库,这有时候会带来不同的行为。最后,有趣的一点是,`dig` 的返回的格式是符合 BIND 区域文件格式的。) + +事实上,有时 `dig` 可以在 `ping` 完全不能响应的时候进行响应,当你试图确定一个连接问题时,这种信息是非常有用的。 + +### DNS 记录类型和标志 + +在上面的第一个查询中,我们可以看到一个问题,那就是同时存在 `CNAME` 和 `A` 记录。`CNAME`(规范名称canonical name)就像一个别名,把一个域名指向另一个域名。你查询的大多数系统不会有 `CNAME` 记录,而只有 `A` 记录。如果你运行 `dig localhost` 命令,你会看到一个 `A` 记录,它就指向 `127.0.0.1` —— 这是每个系统都使用的“回环”地址。`A` 记录用于将一个名字映射到一个 IP 地址。 + +DNS 记录类型包括: + +* `A` 或 `AAAA`:IPv4 或 IPv6 地址 +* `CNAME`:别名 +* `MX`:邮件交换器 +* `NS`:名称服务器 +* `PTR`:一个反向条目,让你根据 IP 地址找到系统名称 +* `SOA`:表示授权记录开始 +* `TXT` 一些相关文本 + +我们还可以在上述输出的第五行看到一系列的“标志”。这些定义在 [RFC 1035][4] 中 —— 它定义了 DNS 报文头中包含的标志,甚至显示了报文头的格式。 + +``` + 1 1 1 1 1 1 + 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 ++--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ +| ID | ++--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ +|QR| Opcode |AA|TC|RD|RA| Z | RCODE | ++--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ +| QDCOUNT | ++--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ +| ANCOUNT | ++--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ +| NSCOUNT | ++--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ +| ARCOUNT | ++--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+ +``` + +在上面的初始查询中,第五行显示的标志是: + +* `qr` = 查询 +* `rd` = 进行递归查询 +* `ra` = 递归数据可用 + +RFC 中描述的其他标志包括: + +* `aa` = 权威答复 +* `cd` = 检查是否禁用 +* `ad` = 真实数据 +* `opcode` = 一个 4 位字段 +* `tc` = 截断 +* `z`(未使用) + +### 添加 +trace 选项 + +如果你添加 `+trace` 选项,你将从 `dig` 得到更多的输出。它会添加更多信息,显示你的 DNS 查询如何通过名称服务器的层次结构找到你要找的答案。 + +下面显示的所有 `NS` 记录都反映了名称服务器 —— 这只是你将看到的数据的第一部分,因为查询通过名称服务器的层次结构来追踪你要找的东西: + +``` +$ dig +trace networkworld.com + +; <<>> DiG 9.16.1-Ubuntu <<>> +trace networkworld.com +;; global options: +cmd +. 84895 IN NS k.root-servers.net. +. 84895 IN NS e.root-servers.net. +. 84895 IN NS m.root-servers.net. +. 84895 IN NS h.root-servers.net. +. 84895 IN NS c.root-servers.net. +. 84895 IN NS f.root-servers.net. +. 84895 IN NS a.root-servers.net. +. 84895 IN NS g.root-servers.net. +. 84895 IN NS l.root-servers.net. +. 84895 IN NS d.root-servers.net. +. 84895 IN NS b.root-servers.net. +. 84895 IN NS i.root-servers.net. +. 84895 IN NS j.root-servers.net. +;; Received 262 bytes from 127.0.0.53#53(127.0.0.53) in 28 ms +... +``` + +最终,你会得到与你的要求直接挂钩的信息: + +``` +networkworld.com. 300 IN A 151.101.2.165 +networkworld.com. 300 IN A 151.101.66.165 +networkworld.com. 300 IN A 151.101.130.165 +networkworld.com. 300 IN A 151.101.194.165 +networkworld.com. 14400 IN NS ns-d.pnap.net. +networkworld.com. 14400 IN NS ns-a.pnap.net. +networkworld.com. 14400 IN NS ns0.pcworld.com. +networkworld.com. 14400 IN NS ns1.pcworld.com. +networkworld.com. 14400 IN NS ns-b.pnap.net. +networkworld.com. 14400 IN NS ns-c.pnap.net. +;; Received 269 bytes from 70.42.185.30#53(ns0.pcworld.com) in 116 ms +``` + +### 挑选响应者 + +你可以使用 `@` 符号来指定一个特定的名称服务器来处理你的查询。在这里,我们要求 Google 的主名称服务器响应我们的查询: + +``` +$ dig @8.8.8.8 networkworld.com + +; <<>> DiG 9.16.1-Ubuntu <<>> @8.8.8.8 networkworld.com +; (1 server found) +;; global options: +cmd +;; Got answer: +;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 43640 +;; flags: qr rd ra; QUERY: 1, ANSWER: 4, AUTHORITY: 0, ADDITIONAL: 1 + +;; OPT PSEUDOSECTION: +; EDNS: version: 0, flags:; udp: 512 +;; QUESTION SECTION: +;networkworld.com. IN A + +;; ANSWER SECTION: +networkworld.com. 299 IN A 151.101.66.165 +networkworld.com. 299 IN A 151.101.194.165 +networkworld.com. 299 IN A 151.101.130.165 +networkworld.com. 299 IN A 151.101.2.165 + +;; Query time: 48 msec +;; SERVER: 8.8.8.8#53(8.8.8.8) +;; WHEN: Sat Jul 25 11:21:19 EDT 2020 +;; MSG SIZE rcvd: 109 +``` + +下面所示的命令对 `8.8.8.8` IP 地址进行反向查找,以显示它属于 Google 的 DNS 服务器。 + +``` +$ nslookup 8.8.8.8 +8.8.8.8.in-addr.arpa name = dns.google. +``` + +### 总结 + +`dig` 命令是掌握 DNS 工作原理和在出现连接问题时排除故障的重要工具。 + +-------------------------------------------------------------------------------- + +via: https://www.networkworld.com/article/3568488/digging-for-dns-answers-on-linux.html + +作者:[Sandra Henry-Stocker][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.networkworld.com/author/Sandra-Henry_Stocker/ +[b]: https://github.com/lujun9972 +[1]: https://images.techhive.com/images/article/2017/01/05_tools-100704412-large.jpg +[2]: https://creativecommons.org/licenses/by/2.0/legalcode +[3]: https://www.networkworld.com/article/3268449/what-is-dns-and-how-does-it-work.html +[4]: https://tools.ietf.org/html/rfc1035 +[5]: https://www.facebook.com/NetworkWorld/ +[6]: https://www.linkedin.com/company/network-world diff --git a/published/202008/20200729 Bypass your Linux firewall with SSH over HTTP.md b/published/202008/20200729 Bypass your Linux firewall with SSH over HTTP.md new file mode 100644 index 0000000000..5f66d24517 --- /dev/null +++ b/published/202008/20200729 Bypass your Linux firewall with SSH over HTTP.md @@ -0,0 +1,94 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12504-1.html) +[#]: subject: (Bypass your Linux firewall with SSH over HTTP) +[#]: via: (https://opensource.com/article/20/7/linux-shellhub) +[#]: author: (Domarys https://opensource.com/users/domarys) + +借助 HTTP 通过 SSH 绕过 Linux 防火墙 +====== + +> 需要远程工作的看一下。使用这个有用的开源解决方案,从任何地方快速地连接和访问你的所有设备。 + +![](https://img.linux.net.cn/data/attachment/album/202008/10/231746xs4363yc03cptzbc.jpg) + +随着对连接和远程工作的需求的增长,访问远程计算资源变得越来越重要。但是,提供对设备和硬件的外部访问的要求使此任务变得复杂而有风险。旨在减少此类麻烦的 [ShellHub][2] 是一个云服务器,允许从任何外部网络常规访问这些设备。 + +ShellHub 是一个 Apache 2.0 许可的开源解决方案,它可满足所有这些需求,并允许用户通过一个帐户连接和管理多个设备。它的开发是为了方便开发者和程序员的工作,使得任何硬件架构的 Linux 设备的远程访问成为可能。 + +仔细观察,ShellHub 方案使用 HTTP 传输层来封装 SSH 协议。这种传输层的选择可以在大多数网络上无缝使用,因为大多数公司的防火墙规则和策略通常都可以使用并接受它。 + +下面这些示例使用 2020 年 6 月 10 日发布的 ShellHub 版本 0.3.2。 + +### 使用 ShellHub + +要访问该平台,只需进入 [shellhub.io][3] 并注册一个自己的帐户。你的注册数据将帮助开发团队了解用户资料并提供有关如何改进平台的更多信息。 + +![ShellHub registration form][4] + +*图 1:[shellhub.io][5] 中的注册表格* + +ShellHub 有直观、简洁的界面,这让所有的信息和功能都能以最快的方式呈现。注册后,你会看到一块仪表板,这时可以注册你的第一台设备。 + +### 添加设备 + +要启用通过 ShellHub 连接设备,你需要生成一个标识符,它用于在设备连接到服务器时对你的设备进行身份验证。 + +此标识必须配置在代理(ShellHub 客户端)内部,该代理必须与镜像一起保存在设备中,或者必须添加为 Docker 容器。 + +ShellHub 默认使用 Docker 运行代理,这非常方便,因为它在现有系统上提供了一种无痛的添加方式,支持 Docker 是唯一的要求。要添加设备,你需要粘贴命令行,它显示在 ShellHub Cloud 的对话框中(请参见图 2)。 + +![Figure 2: Adding a device to the ShellHub Cloud][6] + +*图 2:将设备添加到 ShellHub Cloud* + +设备默认使用它的 MAC 地址作为其主机名。在内部,该设备由其密钥标识,这是在设备注册期间生成的,用于与服务器进行身份验证。 + +### 访问设备 + +要访问你的设备,只需进入仪表板中的“查看所有设备”,或单击左侧菜单上的“设备”。这将列出你所有已注册的设备。 + +设备状态可在页面上轻松看到。在线设备旁边会显示一个绿色图标,可以单击终端图标进行连接。你接着输入密码,最后单击”连接“按钮,请参见(图 3)。 + +![Figure 3: Accessing a device using the terminal on the web][7] + +*图 3:使用网络上的终端访问设备* + +另一种访问设备的方法是从类似 [PuTTY][8]、[Termius][9] 之类的 SSH 客户端,甚至 Linux 终端访问。我们可以使用称为 SSHID 的 ShellHub 标识作为连接的目的地址(例如 `ssh username@SSHID`)。图 4 说明了如何使用在终端中使用 Linux SSH 客户端连接到我们的计算机。 + +![Figure 4: Connecting to a device using the Linux terminal][11] + +*图 4:使用 Linux 终端连接到设备* + +无论你何时登录 ShellHub Cloud 平台,你都可以访问仪表板上的所有已注册设备,这样你可以随时随地访问它们。ShellHub 通过一个开源平台,以透明的方式为您与远程机器保持通信安全的过程增加了简单性。 + +在 [GitHub][2] 上加入 ShellHub 社区,或随时通过 [Gitter][12] 或通过电子邮件 [contato@ossystems.com.br][13] 向开发团队发送你的建议或反馈。我们很乐意收到社区成员的贡献! + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/7/linux-shellhub + +作者:[Domarys][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/domarys +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/terminal_command_linux_desktop_code.jpg?itok=p5sQ6ODE (Terminal command prompt on orange background) +[2]: https://github.com/shellhub-io/shellhub +[3]: https://www.shellhub.io/ +[4]: https://opensource.com/sites/default/files/uploads/shellhub_registration_form_0.png (ShellHub registration form) +[5]: https://opensource.com/article/20/7/www.shellhub.io +[6]: https://opensource.com/sites/default/files/figure2.gif +[7]: https://opensource.com/sites/default/files/figure3.gif +[8]: https://www.putty.org/ +[9]: https://termius.com/ +[10]: mailto:username@SSHID +[11]: https://opensource.com/sites/default/files/figure4.gif +[12]: https://gitter.im/shellhub-io/community?at=5e39ad8b3aca1e4c5f633e8f +[13]: mailto:contato@ossystems.com.br diff --git a/published/202008/20200730 10 cheat sheets for Linux sysadmins.md b/published/202008/20200730 10 cheat sheets for Linux sysadmins.md new file mode 100644 index 0000000000..53e7766a2d --- /dev/null +++ b/published/202008/20200730 10 cheat sheets for Linux sysadmins.md @@ -0,0 +1,128 @@ +[#]: collector: (lujun9972) +[#]: translator: (wxy) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12490-1.html) +[#]: subject: (10 cheat sheets for Linux sysadmins) +[#]: via: (https://opensource.com/article/20/7/sysadmin-cheat-sheets) +[#]: author: (Seth Kenlon https://opensource.com/users/seth) + +Linux 系统管理员的 10 份速查表 +====== + +> 这些快速参考指南让系统管理员的生活和日常工作变得更轻松,而且它们都是免费提供的。 + +![](https://img.linux.net.cn/data/attachment/album/202008/05/222202qildlyr1lnqwq0o4.jpg) + +作为一名系统管理员,你做所的不是一件工作,而是**全部**工作,而且往往每一件工作都是随时随地出现,毫无预兆。除非你每天都只做一项任务,否则当需要的时候,你可能并不总是都能将所有的命令和选项都记在脑海里。这就是为什么我喜欢速查表的原因。 + +速查表可以帮助你避免愚蠢的错误,它们可以让你不必翻阅数页的文档,并让你高效地完成任务。我为每位系统管理员挑选了我最喜欢的 10 个速查表,无论他的经验水平如何。 + +### 网络 + +我们的《[Linux 网络][2]》速查表是速查表界的的瑞士军刀,它包含了最常见的网络命令的简单提醒,包括 `nslookup`、`tcpdump`、`nmcli`、`netstat`、`traceroute` 等。最重要的是,它用了 `ip` 命令,所以你终于可以不用再默认使用 `ifconfig` 命令了! + +### 防火墙 + +系统管理员有两种:了解 `iptables` 的和使用前一类人编写的 `iptables` 配置文件的。如果你是第一类人,你可以继续使用你的 `iptables` 配置,有没有 [firewalld][3] 都无所谓。 + +如果你是第二类人,你终于可以放下你的 iptables 焦虑,拥抱 firewalld 的轻松。阅读《[用 firewall-cmd 保护你的 Linux 网络][4]》,然后下载我们的《[firewalld 速查表][5]》来记住你所学到的东西,保护你的网络端口从未如此简单。 + +### SSH + +许多系统管理员都用的是 [POSIX][6] shell,所以可以在别人的计算机上运行的远程 shell 是 Linux 上最重要的工具之一也就不足为奇了。任何学习服务器管理的人通常很早就学会了使用 SSH,但我们中的许多人只学习了基础知识。 + +当然,SSH 可以在远程机器上打开一个交互式的 shell,但它的功能远不止这些。比如说,你需要在远程机器上进行图形化登录。远程主机的用户要么不在键盘旁边,要么无法理解你启用 VNC 的指令。只要你有 SSH 权限,就可以为他们打开端口。 + +``` +$ ssh -L 5901:localhost:5901 +``` + +通过我们的《[SSH 速查表][7]》了解更多。 + +### Linux 用户和权限 + +传统的大型机和 UNIX 超级计算机风格的用户账户现在基本上已经被 Samba、LDAP 和 OpenShift等系统所取代。然而,这并没有改变对管理员和服务账户仔细管理的需求。为此,你仍然需要熟悉`useradd`、`usermod`、`chown`、`chmod`、`passwd`、`gpasswd`、`umask` 等命令。 + +把我的《[用户和权限速查表][8]》放在手边,你就可以随时对与用户管理有关的任务进行合理的概览,并有实例命令演示你需要做的任何事情的正确语法。 + +### 基本的 Linux 命令 + +并不是所有的系统管理员都会把所有的时间花在终端上。无论你是否喜欢在桌面上工作,还是刚开始使用 Linux,有时为常用的终端命令提供一个任务导向的参考是很好的。 + +对于一个为灵活性和即兴性而设计的界面来说,找到所有你可能需要的东西是很困难的,但我的《[常用命令速查表][9]》是相当全面的。这张速查表以任何技术型桌面用户的典型生活为蓝本,涵盖了用命令在计算机内导航、寻找文件的绝对路径、复制和重命名文件、建立目录、启动系统服务等内容。 + +### Git + +在计算机的历史上,版本控制曾经是只有开发者才需要的东西。但那是过去,而 Git 是现在。对于任何希望跟踪从 Bash 脚本到配置文件、文档和代码的变化的人来说,版本控制是一个重要的工具。Git 适用于每个人,包括程序员、网站可靠性工程师(SRE),甚至系统管理员。 + +获取我们的《[Git 速查表][10]》来学习要领、基本工作流程和最重要的 Git 标志。 + +### Curl + +Curl 不一定是系统管理员专用的工具,从技术上讲,它“只是”一个用于终端的非交互式 Web 浏览器。你可能几天都不用它一次。然而,你很有可能会发现 Curl 对你每天要做的事情很有用,不管是快速参考网站上的一些信息,还是排除网络主机的故障,或者是验证你运行或依赖的一个重要 API。 + +Curl 是一个向服务器传输数据的命令,它支持的协议包括 HTTP、FTP、IMAP、LDAP、POP3、SCP、SFTP、SMB、SMTP 等。它是一个重要的网络工具,所以下载我们的《[Curl 速查表][11]》,开始探索 Curl 吧。 + +### SELinux + +Linux 的安全策略在默认情况下是很好的,root 权限和用户权限之间有很强的分离,但 SELinux 使用标签系统对其进行了改进。在配置了 SELinux 的主机上,每个进程和每个文件对象(或目录、网络端口、设备等)都有一个标签。SELinux 提供了一套规则来控制进程标签对对象(如文件)标签的访问。 + +有时候你需要调整 SELinux 策略,或者调试一些安装时没有正确设置的东西,或者深入了解当前的策略。我们的《[SELinux 速查表][12]》可以提供帮助。 + +### Kubectl + +无论你是已经迁移到了开放的混合云、封闭的私有云,还是你还在研究这样的迁移需要准备什么,你都需要了解 Kubernetes。虽然云确实还需要人去摆弄物理服务器,但作为一个系统管理员,你的未来肯定会涉及到容器,而没有什么比 Kubernetes 更能做到这一点。 + +虽然 [OpenShift][13] 为 Kubernetes 提供了流畅的“仪表盘”体验,但有时需要一种直接的方法,这正是 `kubectl` 提供的。下一次当你不得不到处推送容器时,请确保你手头有我们的《[kubectl 速查表][14]》。 + +### awk + +近几年来,Linux 经历了很多创新,有虚拟机、容器、新的安全模型、新的初始化系统、云等等。然而有些东西似乎永远不会改变。尤其是,系统管理员需要从日志文件和其它无尽的数据流中解析和隔离信息。仍然没有比 Aho、Weinberger 和 Kernighan 的经典 `awk` 命令更适合这项工作的工具。 + +当然,自从 1977 年它被编写出来后,`awk` 已经走过了很长的路,新的选项和功能使它更容易使用。但如果你不是每天都在使用 `awk`,那么多的选项和语法可能会让你有点不知所措。下载我们的《[awk 速查表][15]》,了解 GNU awk 的工作原理。 + +### 赠品:Bash 脚本编程 + +速查表是有用的,但如果你想找更全面的东西,你可以下载我们的《[Bash 脚本编程手册][16]》。这本指南教你如何将你从速查表中了解到的所有命令和经验结合到脚本中,帮助你建立一个随时能用的自动化解决方案库来解决你的日常问题。本书内容丰富,详细讲解了 Bash 的工作原理、脚本与交互式命令的区别、如何捕捉错误等。 + +### 赋能系统管理员 + +你是一名系统管理员吗? + +你正在成为一名系统管理员的路上吗? + +你是否对系统管理员一天都在做什么感到好奇? + +如果是的话,请查看《[赋能系统管理员][17]》,这里有来自业界最勤奋的系统管理员的新文章,讲述他们的工作,以及 Linux 和开源如何让这一切成为可能。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/7/sysadmin-cheat-sheets + +作者:[Seth Kenlon][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/seth +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/rh_003499_01_linux11x_cc.png?itok=XMDOouJR (People work on a computer server with devices) +[2]: https://opensource.com/downloads/cheat-sheet-networking +[3]: https://firewalld.org/ +[4]: https://www.redhat.com/sysadmin/secure-linux-network-firewall-cmd +[5]: https://opensource.com/downloads/firewall-cheat-sheet +[6]: https://opensource.com/article/19/7/what-posix-richard-stallman-explains +[7]: https://opensource.com/downloads/advanced-ssh-cheat-sheet +[8]: https://opensource.com/downloads/linux-permissions-cheat-sheet +[9]: https://opensource.com/downloads/linux-common-commands-cheat-sheet +[10]: https://opensource.com/downloads/cheat-sheet-git +[11]: https://opensource.com/downloads/curl-command-cheat-sheet +[12]: https://opensource.com/downloads/cheat-sheet-selinux +[13]: https://opensource.com/tags/openshift +[14]: https://opensource.com/downloads/kubectl-cheat-sheet +[15]: https://opensource.com/downloads/cheat-sheet-awk-features +[16]: https://opensource.com/downloads/bash-scripting-ebook +[17]: http://redhat.com/sysadmin diff --git a/published/202008/20200801 How to Install the Latest Version of Handbrake on Ubuntu-based Linux Distributions -Quick Tip.md b/published/202008/20200801 How to Install the Latest Version of Handbrake on Ubuntu-based Linux Distributions -Quick Tip.md new file mode 100644 index 0000000000..f29ae37c39 --- /dev/null +++ b/published/202008/20200801 How to Install the Latest Version of Handbrake on Ubuntu-based Linux Distributions -Quick Tip.md @@ -0,0 +1,92 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12515-1.html) +[#]: subject: (How to Install the Latest Version of Handbrake on Ubuntu-based Linux Distributions [Quick Tip]) +[#]: via: (https://itsfoss.com/install-handbrake-ubuntu/) +[#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/) + +如何在 Ubuntu 上安装最新版本的 Handbrake +====== + +> 此快速教程介绍了如何使用在基于 Ubuntu 的发行版上使用官方 PPA 安装最新版本的 HandBrake。 + +![](https://img.linux.net.cn/data/attachment/album/202008/13/223818yghmgmagqggm2pa0.jpg) + +[HandBrake][1] 是可用于 Linux、Windows 和 macOS 的最受欢迎的开源视频转换器之一。 + +此 GUI 应用让你只需单击几下即可将视频从一种格式转换为另一种格式。你还可以根据需要自定义输出视频。 + +[HandBrake][2] 存在于 [Ubuntu 的通用存储库][3]中,但它可能并不总是最新版本。让我向你展示如何在 Ubuntu 和其他基于 Ubuntu 的发行版(如 Linux Mint、Linux Lite、elementray OS 等)上获得最新的 HandBrake。 + +### 在基于 Ubuntu 的 Linux 发行版上安装最新的 HandBrake + +HandBrake 的开发人员维护着一个[官方的 PPA][4]。[使用此 PPA][5],你可以轻松地在基于 Ubuntu 的发行版中安装最新版本的 HandBrake。 + +打开终端,然后使用以下命令添加 PPA 仓库。需要时按下回车键: + +``` +sudo add-apt-repository ppa:stebbins/handbrake-releases +``` + +你可能需要更新本地软件包缓存(在 Ubuntu 18.04 和更高版本中不是必需的): + +``` +sudo apt update +``` + +现在,使用以下命令安装最新版本的 HandBrake: + +``` +sudo apt-get install handbrake-gtk +``` + +这个方法最好的地方是会删除旧的 handbrake 软件包,从而避免安装两个不同版本的 handbrake。 + +![][6] + +在你的 Linux 系统上享受最新最好的 HandBrake 并转换视频。 + +### 从系统中卸载 HandBrake + +由于某些原因,如果你不喜欢 HandBrake 并希望将它删除,那么需要执行以下操作。 + +打开终端并使用以下命令卸载 HandBrake: + +``` +sudo apt remove handbrake-gtk +``` + +现在,你已经删除了该应用,如果你不再需要它,那么[删除它的 PPA][7] 是一个好主意。 + +``` +sudo add-apt-repository -r ppa:stebbins/handbrake-releases +``` + +在询问时确认。 + +在这篇快速 Ubuntu 教程中,你学习了使用 PPA 安装最新的 HandBrake 的步骤。你还了解了正确删除它的步骤。 + +我希望你觉得这篇快速教程有用。如果你有任何问题或建议,请在下面发表评论。 + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/install-handbrake-ubuntu/ + +作者:[Abhishek Prakash][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://itsfoss.com/author/abhishek/ +[b]: https://github.com/lujun9972 +[1]: https://handbrake.fr/ +[2]: https://itsfoss.com/handbrake/ +[3]: https://itsfoss.com/ubuntu-repositories/ +[4]: https://launchpad.net/~stebbins/+archive/ubuntu/handbrake-releases +[5]: https://itsfoss.com/ppa-guide/ +[6]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/07/install-handbrake-ubuntu.png?resize=800%2C498&ssl=1 +[7]: https://itsfoss.com/how-to-remove-or-delete-ppas-quick-tip/ diff --git a/published/202008/20200802 Manjaro vs Arch Linux- What-s the Difference- Which one is Better.md b/published/202008/20200802 Manjaro vs Arch Linux- What-s the Difference- Which one is Better.md new file mode 100644 index 0000000000..a16f98b07a --- /dev/null +++ b/published/202008/20200802 Manjaro vs Arch Linux- What-s the Difference- Which one is Better.md @@ -0,0 +1,154 @@ +[#]: collector: (lujun9972) +[#]: translator: (wxy) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12527-1.html) +[#]: subject: (Manjaro vs Arch Linux: What’s the Difference? Which one is Better?) +[#]: via: (https://itsfoss.com/manjaro-vs-arch-linux/) +[#]: author: (Dimitrios Savvopoulos https://itsfoss.com/author/dimitrios/) + +Manjaro 和 Arch Linux 有何不同,哪个更好? +====== + +> Manjaro 还是 Arch Linux?如果说 Manjaro 是基于 Arch 的,那么它和 Arch 又有什么不同呢?请在这篇比较文章中阅读 Arch 和 Manjaro 的不同之处吧。 + +大多数[适合初学者的 Linux 发行版][1]都是基于 Ubuntu 的。随着 Linux 用户经验的增加,一些人开始尝试使用更高级的发行版,主要是在“Arch 领域”。 + +这个所谓的 “Arch 领域”以两个发行版为主。[Arch Linux][2] 本身和 [Manjaro][3]。还有其他[基于 Arch 的 Linux 发行版][4],但都没有这两个发行版受欢迎。 + +如果你在 Arch 和 Manjaro 之间感到困惑,那么这个比较应该能帮助你。 + +### Manjaro 和 Arch Linux:它们有什么不同或相似之处? + +![][5] + +我试图在各个方面比较这两种发行版。请记住,我并没有只关注差异,我还指出了它们的相似之处。 + +#### 两者都是滚动发布的版本,但不是同一种类型 + +在 Arch 和 Manjaro 中,没有像 Ubuntu 或 Fedora 那样每隔几个月或几年就会有一次“发布”。只要[保持你的 Arch 或 Manjaro 系统的更新][6],你将永远拥有最新版本的操作系统和软件包。你不需要像以往一样担心升级你的安装版本。 + +如果你打算在某个时候进行全新安装,请记住,Manjaro 和 Arch 都会定期更新它的安装 ISO。这被称为 ISO 刷新,它确保新安装的系统不必安装过去几个月中所有可用的新系统更新。 + +但 Arch 和 Manjaro 的滚动发布模式是有区别的。 + +除了社区维护的 Arch 用户软件库Arch User Repository(AUR)之外,Manjaro 也维护着自己的独立软件库,这些软件库也包含了非 Arch 提供的软件包。那些原本由 Arch 官方软件库提供的流行软件包将首先进行彻底的测试(必要时打上补丁),然后 Manjaro 再次发布,这通常比 Arch 晚两周左右,发布到 Manjaro 自己的稳定软件库供公众使用。 + +![][7] + +适应这个测试过程的一个后果是,Manjaro 永远不会像 Arch 一样那么激进尝鲜。但这样一来,就使得 Manjaro 比 Arch 稍微稳定一些,也不容易破坏你的系统。 + +#### 包管理 - Pacman 和 Pamac + +Arch 和 Manjaro 都提供了基于命令行的软件包管理工具 Pacman,它是用 C 语言编写的,使用 `tar` 来打包应用程序。换句话说,你可以[使用相同的 pacman 命令][8]来管理两个发行版的软件包。 + +除了 Pacman,Manjaro 还开发了一个名为 Pamac 的 GUI 应用程序,用于在 Manjaro 上轻松安装软件。这使得使用 Manjaro 比使用 Arch 更容易。 + +![Manjaro 的 Pamac GUI 包管理器][9] + +请注意,你也可以在 Arch Linux 中从 AUR 安装 Pamac,但该工具是 Manjaro 的组成部分。 + +#### Manjaro 硬件检测工具(MHWD) + +Pamac 并不是 Manjaro 团队开发的唯一帮助用户的 GUI 工具。Manjaro 还有一个专门的工具,用于检测硬件并为其推荐驱动程序。 + +![Manjaro 硬件配置 GUI 工具][10] + +这个硬件检测工具非常有用,可以说是 [Manjaro 受到社区喜爱的主要原因][11]之一。它使得检测、安装、使用或从一个驱动切换到另一个驱动都非常简单,让硬件兼容性成为了过去。 + +#### 驱动程序支持 + +Manjaro 为 GPU 驱动提供了极大的支持。我们都知道多年来 Linux 在安装驱动程序(特别是 Nvidia)方面存在问题。 + +当[安装 Manjaro][12] 时,它给出了从开源(自由)或非开源(非自由)图形驱动安装开始的选项。当你选择“非自由”时,它会自动检测你的显卡,并为其安装最合适的驱动程序,因此 GPU 可以开箱即用。 + +由于有了上一节中看到的硬件检测工具,甚至在安装 Manjaro 时,安装显卡驱动会更加容易。 + +如果你有一个带有 Nvidia Optimus 卡(混合 GPU)的系统,它与 Manjaro 配合良好。你会有很多方式来让它工作。 + +在 Arch Linux 中,你必须为你的机器安装(如果你能找到)合适的驱动程序。 + +#### 访问 Arch 用户软件库(AUR) + +[Arch 用户软件库][13](AUR)是一个面向基于 Arch 的 Linux 发行版用户的社区驱动的软件库。AUR 的创建是为了组织和分享来自社区的新软件包,并帮助加快流行软件包被纳入[社区软件库][14]。 + +大量进入官方软件库的新软件包都是从 AUR 开始的。在 AUR 中,用户能够贡献自己的软件包构建(`PKGBUILD` 和相关文件)。 + +你可以在 Arch 和 Manjaro 中使用 AUR。 + +#### 桌面环境 + +好吧!你可以在任何 Linux 发行版上使用几乎所有的桌面环境。Arch 和 Manjaro 也不例外。 + +然而,一个专门的桌面风格或版本可以让用户更容易地在桌面环境里获得顺畅的体验。 + +默认的 Arch ISO 并不包含任何桌面环境。例如,你想[在 Arch Linux 上安装 KDE][15],你必须在[安装 Arch Linux][16] 时或在之后下载安装它。 + +而 Manjaro 则为 Xfce、KDE 和 GNOME 等桌面环境提供了不同的 ISO。Manjaro 社区还维护着 MATE、Cinnamon、LXDE、LXQt、OpenBox 等桌面环境的 ISO。 + +#### 安装程序 + +![Arch 即用启动][17] + +Manjaro 是基于 Arch Linux 的,它是兼容 Arch 的,但**它不是 Arch**。它甚至不是只有一个图形安装程序的预配置版本的 Arch。Arch 并不具备通常的舒适的开箱即用,这也是为什么大多数人喜欢更简单的东西。Manjaro 为你提供了简单的入口,但支持你成为经验丰富的用户或资深用户。 + +#### 文档和支持 + +Arch 和 Manjaro 都有自己的维基页面和支持论坛来帮助各自的用户。 + +虽然 Manjaro 有一个不错的[维基][18]文档,但 [Arch 维基][19]则不可同日而语。你可以在 Arch 维基中找到关于 Arch Linux 各方面的详细信息。 + +#### 目标受众 + +关键的区别在于 [Arch 针对的是抱着自己动手的态度的用户][20],他们愿意阅读文档,自己解决问题。 + +而 Manjaro 则是针对那些没有那么多经验或者不想花时间组装操作系统的 Linux 用户。 + +### 结论 + +有些人经常说 Manjaro 是给那些不会安装 Arch 的人用的。但我认为这是不对的。不是每个人都想从头配置 Arch,或者没有太多时间。 + +Manjaro 绝对是一只野兽,但与 Arch 截然不同。**快速、强大,并总是保持更新**,Manjaro 提供了 Arch 操作系统的所有优点,但特别强调**稳定性、用户友好性和可访问性**,既适合新手,也适合有经验的用户。 + +Manjaro 并不像 Arch Linux 那样极简主义。在 Arch 中,你从一个空白的画布开始,手动调整每个设置。当默认的 Arch 安装完成后,你在命令行就有了一个正在运行的 Linux 实例。想要一个[图形化桌面环境][21]?那就自己来吧 —— 有很多选择。选择一个,安装,然后配置它。你可以从中学到很多东西,特别是如果你是 Linux 新手的话。你会对系统是如何组合在一起的,以及为什么要以这样的方式安装东西有很好的理解。 + +我希望你现在对 Arch 和 Manjaro 有了更好的理解。现在,你明白了它们是相似而不同的了吧。 + +我已经发表了我的看法。不要犹豫,请在评论区分享你的观点。在 Arch 和 Manjaro 之间,你更喜欢哪一个,为什么。 + +Abhishek Prakash 也此文补充了内容。 + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/manjaro-vs-arch-linux/ + +作者:[Dimitrios Savvopoulos][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://itsfoss.com/author/dimitrios/ +[b]: https://github.com/lujun9972 +[1]: https://itsfoss.com/best-linux-beginners/ +[2]: https://www.archlinux.org/ +[3]: https://manjaro.org/ +[4]: https://itsfoss.com/arch-based-linux-distros/ +[5]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/08/arch-vs-manjaro.png?ssl=1 +[6]: https://itsfoss.com/update-arch-linux/ +[7]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/06/repositories.png?ssl=1 +[8]: https://itsfoss.com/pacman-command/ +[9]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/05/Pamac.png?resize=800%2C534&ssl=1 +[10]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/04/hardware-detection.png?ssl=1 +[11]: https://itsfoss.com/why-use-manjaro-linux/ +[12]: https://itsfoss.com/install-manjaro-linux/ +[13]: https://linux.cn/article-12107-1.html +[14]: https://wiki.archlinux.org/index.php/Community_repository +[15]: https://linux.cn/article-12258-1.html +[16]: https://itsfoss.com/install-arch-linux/ +[17]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/05/Arch-live-boot.jpg?ssl=1 +[18]: https://wiki.manjaro.org/index.php?title=Main_Page +[19]: https://wiki.archlinux.org/ +[20]: https://linux.cn/article-12445-1.html +[21]: https://itsfoss.com/best-linux-desktop-environments/ diff --git a/published/202008/20200802 Why making mistakes makes me a better sysadmin.md b/published/202008/20200802 Why making mistakes makes me a better sysadmin.md new file mode 100644 index 0000000000..af4d719498 --- /dev/null +++ b/published/202008/20200802 Why making mistakes makes me a better sysadmin.md @@ -0,0 +1,59 @@ +[#]: collector: (lujun9972) +[#]: translator: (Starryi) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12521-1.html) +[#]: subject: (Why making mistakes makes me a better sysadmin) +[#]: via: (https://opensource.com/article/20/8/sysadmin-mistakes) +[#]: author: (Ben Cotton https://opensource.com/users/bcotton) + +为什么犯错让我成为一个更好的系统管理员 +====== + +> 诀窍就是同一个错误不要犯两次。 + +![](https://img.linux.net.cn/data/attachment/album/202008/16/001203jeyztczb8t6q8egc.jpg) + +到目前为止,我已做了十多年 [Fedora][2] 贡献者。 Fedora 有一个由开发者和用户组成的大型社区,其中每一个人,不管是极富洞察力的用户还是出色的程序员,都有一些独有的技能。我喜欢这样的社区,因为它能激励我培养自己的新技能。 + +对我来说,培养技能最好的方法就是犯错,比如把事情搞得一团糟。犯什么样的错误不重要,因为相比错误本身,我在脱离困境的过程里学习到了什么更重要。 + +### 为什么犯错误是好事 + +我依然记得我犯的第一个计算机错误。我家的第一台电脑是我叔叔升职后送个我们的爱普生笔记本电脑,它有一个特别快的 10 MHz 处理器,因为太重了,所以还有一个手提把手。我很喜欢它。 + +它运行 DOS,但有一个基于文本的菜单应用,所以对新手用户比较友好。硬盘菜单有十个“页面”,每个“页面”可以配置十个命令。我们有一个游戏页面,还有一个页面放些“无聊的东西”,比如文字处理程序和电子表格等等。 + +硬盘菜单还有一些其他功能,当我玩腻了游戏,就会去探索它们。有一天,我决定使用菜单的账户功能。账户不会改变出现的应用程序,但在某种程度上,可以防止对应用程序未经授权的访问。你可以直接跳到 DOS 中取代它,但使用账户仍然是一个不错的尝试。 + +我为自己、父母和妹妹创建了账户。虽然我父母有点不开心,但他们最终迁就了我。万事顺遂了一段时间后,妹妹忘记了她的账户密码。于是,我父母让我删掉她的密码,但是没有妹妹的密码去登录账户,我就无法删除她的密码(那是在 90 年代初,一个比现在简单得多的时代)。要怎么办?要怎么办? + +那以后一段时间,我们一直试着猜测密码,直到有一天,我决定尝试做一些我还没有做过的事情。当我第一次创建帐户时,我设置了一个主密码。如果我输入主密码来代替我妹妹的密码,会发生什么呢? + +如果你在想,“这当然不会有用的”,那么显然你不熟悉 90 年代安全策略的天真幼稚。有了主密码(顺便说一下,主密码是 “worf” ,指的是企业号星舰的克林贡人安全主管,如果你不是《星际迷航:下一代》粉丝的话),我可以删除所有密码。于是,家里的每个人又都可以毫无障碍地使用电脑了。 + +### 试运行的重要性 + +在那之后,我又犯了更大更有益的错误。比如,在我第一次做系统管理员时,当时我正整理一些数据以重新配置存储阵列。有一次,我意外地颠倒了源路径和目标路径,而且那是一个带有 `——delete` 标志的 `rsync` 命令。真的是太糟糕了! + +幸运的是,我自己的账户也崩溃了,这让我的道歉更容易被其他受影响的用户接受。对我们所有人来说更幸运的是,我们有备份。所以那天结束的时候,每个人的文件都找回来了,我还学到了一个宝贵的教训,那就是在进行破坏性同步之前,先使用 `--dry-run` 标志试运行。 + +### 以正确的方式处理错误 + +我不介意犯错误。这些年来,我积累了很多实践经验,学到的诀窍就是不要犯同样的错误。从错误中学习能让我在技能和事业上取得进步,并发现新的会犯的错误。作为 Linux 系统管理员,我总是试图在一个安全的环境(测试平台就很好)中犯错误,确保我可以从错误中恢复(备份真的非常非常重要!),并给以后的我留个笔记,这样他就不会重复犯错(文档是你的朋友)。当然,还要勇于承认自己的错误,并在出现问题时清楚地与用户沟通。如果我一直这样做,也许有一天我就会觉得我很清楚我在做什么! + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/8/sysadmin-mistakes + +作者:[Ben Cotton][a] +选题:[lujun9972][b] +译者:[Starryi](https://github.com/Starryi) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/bcotton +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/fail_failure_celebrate.png?itok=LbvDAEZF (failure sign at a party, celebrating failure) +[2]: http://getfedora.org diff --git a/published/202008/20200803 Do math in the Linux shell with GNU bc.md b/published/202008/20200803 Do math in the Linux shell with GNU bc.md new file mode 100644 index 0000000000..c0b41ddb60 --- /dev/null +++ b/published/202008/20200803 Do math in the Linux shell with GNU bc.md @@ -0,0 +1,164 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12506-1.html) +[#]: subject: (Do math in the Linux shell with GNU bc) +[#]: via: (https://opensource.com/article/20/7/bc-math) +[#]: author: (Seth Kenlon https://opensource.com/users/seth) + +使用 GNU bc 在 Linux Shell 中进行数学运算 +====== + +> 在 shell 中使用 bc 更好地做算数,它是一种用于高级计算的数学语言。 + +![](https://img.linux.net.cn/data/attachment/album/202008/11/105133c86k08rf028jjd6a.jpg) + +大多数 [POSIX][2] 系统带有 [GNU bc][3],这是一种任意精度的数字处理语言。它的语法类似于 C,但是它也支持交互式执行语句和处理来自标准输入(`stdin`)的数据。因此,它通常是以下问题的答案:“我如何在 Linux shell 中进行数学运算?”这种回应方式在网上很常见: + +``` +$ echo "1+1" | bc +2 +``` + +尽管这是完全正确的,但很少有用户认为,与更直观的方式相比,它很优雅,例如: + +``` +$ 1+1  # 这不能工作 +2 +``` + +交互模式要容易一些: + +``` +$ bc +1+1 +2 +quit +$ +``` + +但是交互模式并不总是适合简单计算想要的直观工作流,比如直接输入你想要的计算。因此我推荐 Bluebat 的[纯 Bash 计算器][4]。 + +`bc` 实际上提供了一种用于高级计算的数学语言。 + +### 含高级函数的 mathlib + +`bc` 本身提供了基本的数学函数。你可以在交互式模式下测试它们: + +``` +$ bc +3^2 +9 +(3^2)*(9)/3 +27 +``` + +使用 `--mathlib` 选项获取高级函数,包括正弦、余弦、正切等。在交互式模式下,你可以测试其中一些。下面是 90 度的余弦: + +``` +c(90) +-.44807361612917015236 +``` + +9 的正弦: + +``` +s(9) +.41211848524175656975 +``` + +### 创建你自己的 bc 函数 + +你还可以在 `bc` 中创建自己的函数。函数定义以 `define` 关键字开始,并用大括号括起来。下面是一个输入到交互式会话中的简单函数,它返回给它的任意数字: + +``` +$ bc +define echo(n) { +  return (n); +} +``` + +在同一个交互式会话中,测试一下: + +``` +echo(2) +2 +echo(-2) +-2 +``` + +### bc 中的 if 语句 + +`bc` 语言还有各种控制语句,其中最简单的是 `if`/`else`。语法乍一看可能很熟悉,但在如何处理大括号方面有些不同。请注意,`if` 语句的 `else` 子句包含在大括号中,而 `then` 子句不是,但两者都用分号终止。下面是一个返回数字 `n` 的绝对值的函数: + +``` +define abso(n) { +  if ( n > 0 ) return (n); +  { return (-n); } +} +``` + +在同一个交互式会话中,测试一下: + +``` +abso(-5) +5 +abso(5) +5 +``` + +### 将数据导入 bc + +使用交互式会话对于快速计算和实验是可以容忍的,但在退出时会丢失数据,并且在出错时很难编辑。幸运的是,`bc` 可以从外部文件加载变量和函数。 + +下面是一个包含两个变量(`sol` 和 `foo`)的文件,以及一个用于查找绝对值的自定义 `abso` 函数: + +``` +sol=299792458 + +foo=42 + +define abso(n) { +  if ( n > 0 ) return (n); +  { return (-n); } +} +``` + +将它保存到名为 `bcvars.bc` 的文件中,以便导入 `bc` 交互式会话: + +``` +$ bc bcvars.bc +foo +42 +sol +299792458 +abso(-23) +23 +``` + +### 使用 bc 助力你的数学 + +`bc` 语言相对简单,前提是你知道足够的数学知识来构造任何你想完成的方程。虽然 `bc` 默认提供了有用的基本函数,并允许你创建自己的函数,但你可以通过站在巨人的肩膀上来减少工作量。加载了用于数学基础知识和特定任务(例如,计算复利)的新函数的文件可从 [GNU bc 页][5]获得,同时也可获得 `bc` [完整文档][6]。 + +如果你有兴趣在 shell 里更好地处理数学,试试 `bc` 。它不会使你成为数学天才,但它可能会让过程更简单。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/7/bc-math + +作者:[Seth Kenlon][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/seth +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/math_money_financial_calculator_colors.jpg?itok=_yEVTST1 (old school calculator) +[2]: https://opensource.com/article/19/7/what-posix-richard-stallman-explains +[3]: https://www.gnu.org/software/bc/ +[4]: https://raw.githubusercontent.com/bluebat/.bash/master/bashbc.sh +[5]: http://phodd.net/gnu-bc/ +[6]: https://www.gnu.org/software/bc/manual/html_mono/bc.html diff --git a/published/202008/20200804 Creating and debugging Linux dump files.md b/published/202008/20200804 Creating and debugging Linux dump files.md new file mode 100644 index 0000000000..7bed062411 --- /dev/null +++ b/published/202008/20200804 Creating and debugging Linux dump files.md @@ -0,0 +1,244 @@ +[#]: collector: (lujun9972) +[#]: translator: (wxy) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12554-1.html) +[#]: subject: (Creating and debugging Linux dump files) +[#]: via: (https://opensource.com/article/20/8/linux-dump) +[#]: author: (Stephan Avenwedde https://opensource.com/users/hansic99) + +在 Linux 上创建并调试转储文件 +====== + +> 了解如何处理转储文件将帮你找到应用中难以重现的 bug。 + +![](https://img.linux.net.cn/data/attachment/album/202008/26/234535rhnwdc783swgsbqw.jpg) + +崩溃转储、内存转储、核心转储、系统转储……这些全都会产生同样的产物:一个包含了当应用崩溃时,在那个特定时刻应用的内存状态的文件。 + +这是一篇指导文章,你可以通过克隆示例的应用仓库来跟随学习: + +``` +git clone https://github.com/hANSIc99/core_dump_example.git +``` + +### 信号如何关联到转储 + +信号是操作系统和用户应用之间的进程间通讯。Linux 使用 [POSIX 标准][2]中定义的信号。在你的系统上,你可以在 `/usr/include/bits/signum-generic.h` 找到标准信号的定义。如果你想知道更多关于在你的应用程序中使用信号的信息,这有一个信息丰富的 [signal 手册页][3]。简单地说,Linux 基于预期的或意外的信号来触发进一步的活动。 + +当你退出一个正在运行的应用程序时,应用程序通常会收到 `SIGTERM` 信号。因为这种类型的退出信号是预期的,所以这个操作不会创建一个内存转储。 + +以下信号将导致创建一个转储文件(来源:[GNU C库][4]): + + * `SIGFPE`:错误的算术操作 + * `SIGILL`:非法指令 + * `SIGSEGV`:对存储的无效访问 + * `SIGBUS`:总线错误 + * `SIGABRT`:程序检测到的错误,并通过调用 `abort()` 来报告 + * `SIGIOT`:这个信号在 Fedora 上已经过时,过去在 [PDP-11][5] 上用 `abort()` 时触发,现在映射到 SIGABRT + +### 创建转储文件 + +导航到 `core_dump_example` 目录,运行 `make`,并使用 `-c1` 开关执行该示例二进制: + +``` +./coredump -c1 +``` + +该应用将以状态 4 退出,带有如下错误: + +![Dump written][6] + +“Abgebrochen (Speicherabzug geschrieben) ”(LCTT 译注:这是德语,应该是因为本文作者系统是德语环境)大致翻译为“分段故障(核心转储)”。 + +是否创建核心转储是由运行该进程的用户的资源限制决定的。你可以用 `ulimit` 命令修改资源限制。 + +检查当前创建核心转储的设置: + +``` +ulimit -c +``` + +如果它输出 `unlimited`,那么它使用的是(建议的)默认值。否则,用以下方法纠正限制: + +``` +ulimit -c unlimited +``` + +要禁用创建核心转储,可以设置其大小为 0: + +``` +ulimit -c 0 +``` + +这个数字指定了核心转储文件的大小,单位是块。 + +### 什么是核心转储? + +内核处理核心转储的方式定义在: + +``` +/proc/sys/kernel/core_pattern +``` + +我运行的是 Fedora 31,在我的系统上,该文件包含的内容是: + +``` +/usr/lib/systemd/systemd-coredump %P %u %g %s %t %c %h +``` + +这表明核心转储被转发到 `systemd-coredump` 工具。在不同的 Linux 发行版中,`core_pattern` 的内容会有很大的不同。当使用 `systemd-coredump` 时,转储文件被压缩保存在 `/var/lib/systemd/coredump` 下。你不需要直接接触这些文件,你可以使用 `coredumpctl`。比如说: + +``` +coredumpctl list +``` + +会显示系统中保存的所有可用的转储文件。 + +使用 `coredumpctl dump`,你可以从最后保存的转储文件中检索信息: + +``` +[stephan@localhost core_dump_example]$ ./coredump  +Application started… + +(…….) + +Message: Process 4598 (coredump) of user 1000 dumped core. + +Stack trace of thread 4598: +#0 0x00007f4bbaf22625 __GI_raise (libc.so.6) +#1 0x00007f4bbaf0b8d9 __GI_abort (libc.so.6) +#2 0x00007f4bbaf664af __libc_message (libc.so.6) +#3 0x00007f4bbaf6da9c malloc_printerr (libc.so.6) +#4 0x00007f4bbaf6f49c _int_free (libc.so.6) +#5 0x000000000040120e n/a (/home/stephan/Dokumente/core_dump_example/coredump) +#6 0x00000000004013b1 n/a (/home/stephan/Dokumente/core_dump_example/coredump) +#7 0x00007f4bbaf0d1a3 __libc_start_main (libc.so.6) +#8 0x000000000040113e n/a (/home/stephan/Dokumente/core_dump_example/coredump) +Refusing to dump core to tty (use shell redirection or specify — output). +``` + +这表明该进程被 `SIGABRT` 停止。这个视图中的堆栈跟踪不是很详细,因为它不包括函数名。然而,使用 `coredumpctl debug`,你可以简单地用调试器(默认为 [GDB][8])打开转储文件。输入 `bt`(回溯backtrace的缩写)可以得到更详细的视图: + +``` +Core was generated by `./coredump -c1'. +Program terminated with signal SIGABRT, Aborted. +#0  __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:50 +50  return ret; +(gdb) bt +#0  __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:50 +#1  0x00007fc37a9aa8d9 in __GI_abort () at abort.c:79 +#2  0x00007fc37aa054af in __libc_message (action=action@entry=do_abort, fmt=fmt@entry=0x7fc37ab14f4b "%s\n") at ../sysdeps/posix/libc_fatal.c:181 +#3  0x00007fc37aa0ca9c in malloc_printerr (str=str@entry=0x7fc37ab130e0 "free(): invalid pointer") at malloc.c:5339 +#4  0x00007fc37aa0e49c in _int_free (av=<optimized out>, p=<optimized out>, have_lock=0) at malloc.c:4173 +#5  0x000000000040120e in freeSomething(void*) () +#6  0x0000000000401401 in main () +``` + +与后续帧相比,`main()` 和 `freeSomething()` 的内存地址相当低。由于共享对象被映射到虚拟地址空间末尾的区域,可以认为 `SIGABRT` 是由共享库中的调用引起的。共享对象的内存地址在多次调用之间并不是恒定不变的,所以当你看到多次调用之间的地址不同时,完全可以认为是共享对象。 + +堆栈跟踪显示,后续的调用源于 `malloc.c`,这说明内存的(取消)分配可能出了问题。 + +在源代码中,(即使没有任何 C++ 知识)你也可以看到,它试图释放一个指针,而这个指针并没有被内存管理函数返回。这导致了未定义的行为,并导致了 `SIGABRT`。 + +``` +void freeSomething(void *ptr){ + free(ptr); +} +int nTmp = 5; +int *ptrNull = &nTmp; +freeSomething(ptrNull); +``` + +systemd 的这个 `coredump` 工具可以在 `/etc/systemd/coredump.conf` 中配置。可以在 `/etc/systemd/systemd-tmpfiles-clean.timer` 中配置轮换清理转储文件。 + +你可以在其[手册页][10]中找到更多关于 `coredumpctl` 的信息。 + +### 用调试符号编译 + +打开 `Makefile` 并注释掉第 9 行的最后一部分。现在应该是这样的: + +``` +CFLAGS =-Wall -Werror -std=c++11 -g +``` + +`-g` 开关使编译器能够创建调试信息。启动应用程序,这次使用 `-c2` 开关。 + +``` +./coredump -c2 +``` + +你会得到一个浮点异常。在 GDB 中打开该转储文件: + +``` +coredumpctl debug +``` + +这一次,你会直接被指向源代码中导致错误的那一行: + +``` +Reading symbols from /home/stephan/Dokumente/core_dump_example/coredump… +[New LWP 6218] +Core was generated by `./coredump -c2'. +Program terminated with signal SIGFPE, Arithmetic exception. +#0 0x0000000000401233 in zeroDivide () at main.cpp:29 +29 nRes = 5 / nDivider; +(gdb) +``` + +键入 `list` 以获得更好的源代码概览: + +``` +(gdb) list +24      int zeroDivide(){ +25          int nDivider = 5; +26          int nRes = 0; +27          while(nDivider > 0){ +28              nDivider--; +29              nRes = 5 / nDivider; +30          } +31          return nRes; +32      } +``` + +使用命令 `info locals` 从应用程序失败的时间点检索局部变量的值: + +``` +(gdb) info locals +nDivider = 0 +nRes = 5 +``` + +结合源码,可以看出,你遇到的是零除错误: + +``` +nRes = 5 / 0 +``` + +### 结论 + +了解如何处理转储文件将帮助你找到并修复应用程序中难以重现的随机错误。而如果不是你的应用程序,将核心转储转发给开发人员将帮助她或他找到并修复问题。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/8/linux-dump + +作者:[Stephan Avenwedde][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/hansic99 +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/find-file-linux-code_magnifying_glass_zero.png?itok=E2HoPDg0 (Magnifying glass on code) +[2]: https://en.wikipedia.org/wiki/POSIX +[3]: https://man7.org/linux/man-pages/man7/signal.7.html +[4]: https://www.gnu.org/software/libc/manual/html_node/Program-Error-Signals.html#Program-Error-Signals +[5]: https://en.wikipedia.org/wiki/PDP-11 +[6]: https://opensource.com/sites/default/files/uploads/dump_written.png (Dump written) +[7]: https://creativecommons.org/licenses/by-sa/4.0/ +[8]: https://www.gnu.org/software/gdb/ +[9]: http://www.opengroup.org/onlinepubs/009695399/functions/free.html +[10]: https://man7.org/linux/man-pages/man1/coredumpctl.1.html diff --git a/published/202008/20200805 How to Install Itch on Ubuntu and Other Linux Distributions.md b/published/202008/20200805 How to Install Itch on Ubuntu and Other Linux Distributions.md new file mode 100644 index 0000000000..73289b3d7d --- /dev/null +++ b/published/202008/20200805 How to Install Itch on Ubuntu and Other Linux Distributions.md @@ -0,0 +1,103 @@ +[#]: collector: (lujun9972) +[#]: translator: (robsean) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12526-1.html) +[#]: subject: (How to Install Itch on Ubuntu and Other Linux Distributions) +[#]: via: (https://itsfoss.com/install-itch-linux/) +[#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/) + +如何在 Ubuntu 和其它的 Linux 发行版上安装 Itch +====== + +![][7] + +[Itch][1] 是独立数字创造者的平台,主要专注于独立游戏。它最初是一个托管、销售和下载独立视频游戏的网站。但是现在,Itch 也提供书籍、漫画、工具、棋类游戏、原声带等来自独立创造者的数字内容。 + +作为一名用户,你或者能够免费下载这些数字内容,或者按照创造者设定的价格下载。你所有下载和购买的东西都同步到你的账户,以便你可以在任何你想的时间内下载它们。 + +它有点像 Steam,但是更专注于独立开发者和创作者。 + +你可以从它的网站浏览 Itch ,但是 Itch 也提供了一个 [开源的桌面客户端][2],有一些额外的优势。使用桌面客户端: + + * 你可以浏览游戏和其它的内容,并下载它们到你的系统上。 + * 桌面客户端会自动更新所有新功能。 + * 你下载的游戏也自动更新。 + * 如果你在 Itch 玩基于浏览器的游戏, 那么你可以使用 Itch 桌面客户端离线玩。 + +在这篇教程中,我将向你展示在 Ubuntu 或其它任何 Linux 发行版上安装 Itch 的步骤。 + +### 在 Linux 桌面上安装 Itch + +Itch 提供一个名称为 itch-setup 的安装器。你可以从它的下载网页下载这个文件。 + +- [下载 Linux 版 Itch][3] + +这个 itch-setup 文件可以工作在任何的 Linux 发行版上,只要它已经安装有 GTK 3 (libgtk-3-0)。大多数当前的 Linux 发行版应该已经有它了。 + +在你下载安装文件后,在其上面右击并给予它可执行权限。 + +![右击并给予文件可执行权限][4] + +现在在这个安装文件上通过双击来运行。它将下载 Itch 的最新版本。 + +![][5] + +实际花费的时间取决于你的网速。几分钟后,你应该会看到这个屏幕,要求你登录你的 Itch 账号。 + +![][6] + +在你登录后,你可以浏览游戏和其它的内容,并下载/购买它们。 + +整个安装过程类似于 [在 Ubuntu 上安装 Steam][8]。 + +你可以在 `~/.itch` 文件夹中找到 Itch 的文件。你从 Itch 下载的内容通常位于 `~/.config/itch` 。补充一句,`~` 意味着你的家目录。 + +### 从你的系统中移除 Itch 桌面应用程序 + +出于某些原因,如果你不想再使用 Itch ,你可以从你的系统中移除它。为此,麻烦的是,你需要使用终端。 + +打开一个终端,并使用下面的命令: + +``` +~/.itch/itch-setup --uninstall +``` + +它不会移除你的内容库。如果你想移除下载的游戏和材料,你可以手动删除 `~/.config/itch` 文件夹。 + +``` +rm -r ~/.config/itch +``` + +### 你用 Itch 吗? + +Itch 是一个独立创作者的道德平台,也是这种模式的支持者。Itch 使用 “你想付多少钱就付多少钱”,买家可以支付大于或相等内容创作者设置的任何金额。 + +Itch 也有开放收益分享模式。创作者可以与 Itch 分享部分他们产生的收入,也可以不分享。 + +就我个人而言,我更喜欢像 Itch 和 Humble Bundle 这些有道德的商店。像 Humble Bundle 一样,Itch 也时不时地进行销售和捆绑销售。这有助于你节省资金,并支持独立开发者和创作者。 + +你使用 Itch ,还是 Humble Bundle ?你还使用哪种类似的平台? + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/install-itch-linux/ + +作者:[Abhishek Prakash][a] +选题:[lujun9972][b] +译者:[robsean](https://github.com/robsean) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://itsfoss.com/author/abhishek/ +[b]: https://github.com/lujun9972 +[1]: https://itch.io/?ac=ywUpyBMGXvG +[2]: https://github.com/itchio/itch +[3]: https://itch.io/app +[4]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/08/itch-installer-linux.png?ssl=1 +[5]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/08/installing-itch-linux.jpg?ssl=1 +[6]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/08/itch-running-linux.jpg?ssl=1 +[7]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/08/itch-game-page.png?resize=800%2C441&ssl=1 +[8]: https://itsfoss.com/install-steam-ubuntu-linux/ +[9]: https://itsfoss.com/affiliate-policy/ diff --git a/published/202008/20200807 Microsoft uses AI to boost its reuse, recycling of server parts.md b/published/202008/20200807 Microsoft uses AI to boost its reuse, recycling of server parts.md new file mode 100644 index 0000000000..47a50cb5a0 --- /dev/null +++ b/published/202008/20200807 Microsoft uses AI to boost its reuse, recycling of server parts.md @@ -0,0 +1,56 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12552-1.html) +[#]: subject: (Microsoft uses AI to boost its reuse, recycling of server parts) +[#]: via: (https://www.networkworld.com/article/3570451/microsoft-uses-ai-to-boost-its-reuse-recycling-of-server-parts.html) +[#]: author: (Andy Patrizio https://www.networkworld.com/author/Andy-Patrizio/) + +微软利用 AI 提升服务器部件的重复使用和回收率 +====== + +> 准备好在提到数据中心设备时,听到更多的“循环”一词。 + +![](https://img.linux.net.cn/data/attachment/album/202008/25/234108f8yz3c3la8xw18mn.jpg) + +微软正在将人工智能引入到对数百万台服务器进行分类的任务中,以确定哪些部件可以回收,在哪里回收。 + +新计划要求在微软全球各地的数据中心建立所谓的“循环中心Circular Center”,在那里,人工智能算法将用于从退役的服务器或其他硬件中分拣零件,并找出哪些零件可以在园区内重新使用。 + +微软表示,它的数据中心有超过 300 万台服务器和相关硬件,一台服务器的平均寿命约为 5 年。另外,微软正在全球范围内扩张,所以其服务器数量应该会增加。 + +循环中心就是要快速整理库存,而不是让过度劳累的员工疲于奔命。微软计划到 2025 年将服务器部件的重复使用率提高 90%。微软总裁 Brad Smith 在宣布这一举措的一篇[博客][2]中写道:“利用机器学习,我们将对退役的服务器和硬件进行现场处理。我们会将那些可以被我们以及客户重复使用和再利用的部件进行分类,或者出售。” + +Smith 指出,如今,关于废物的数量、质量和类型,以及废物的产生地和去向,都没有一致的数据。例如,关于建造和拆除废物的数据并不一致,我们要一个标准化的方法,有更好的透明度和更高的质量。 + +他写道:“如果没有更准确的数据,几乎不可能了解运营决策的影响,设定什么目标,如何评估进展,以及废物去向方法的行业标准。” + +根据微软的说法,阿姆斯特丹数据中心的一个循环中心试点减少了停机时间,并增加了服务器和网络部件的可用性,供其自身再利用和供应商回购。它还降低了将服务器和硬件运输到处理设施的成本,从而降低了碳排放。 + +“循环经济circular economy”一词正在科技界流行。它是基于服务器硬件的循环利用,将那些已经使用了几年但仍可用的设备重新投入到其他地方服务。ITRenew 是[我在几个月前介绍过][3]的一家二手超大规模服务器的转售商,它对这个词很感兴趣。 + +该公司表示,首批微软循环中心将建在新的主要数据中心园区或地区。它计划最终将这些中心添加到已经存在的园区中。 + +微软曾明确表示要在 2030 年之前实现“碳负排放”,而这只是其中几个项目之一。近日,微软宣布在其位于盐湖城的系统开发者实验室进行了一项测试,用一套 250kW 的氢燃料电池系统为一排服务器机架连续供电 48 小时,微软表示这是以前从未做过的事情。 + +微软首席基础设施工程师 Mark Monroe 在一篇[博客][4]中写道:“这是我们所知道的最大的以氢气运行的计算机备用电源系统,而且它的连续测试时间最长。”他说,近年来氢燃料电池的价格大幅下降,现在已经成为柴油发电机的可行替代品,但燃烧更清洁。 + +-------------------------------------------------------------------------------- + +via: https://www.networkworld.com/article/3570451/microsoft-uses-ai-to-boost-its-reuse-recycling-of-server-parts.html + +作者:[Andy Patrizio][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://www.networkworld.com/author/Andy-Patrizio/ +[b]: https://github.com/lujun9972 +[2]: https://blogs.microsoft.com/blog/2020/08/04/microsoft-direct-operations-products-and-packaging-to-be-zero-waste-by-2030/ +[3]: https://www.networkworld.com/article/3543810/for-sale-used-low-mileage-hyperscaler-servers.html +[4]: https://news.microsoft.com/innovation-stories/hydrogen-datacenters/ +[5]: https://www.facebook.com/NetworkWorld/ +[6]: https://www.linkedin.com/company/network-world diff --git a/published/202008/20200807 install Fedora on a Raspberry Pi 3.md b/published/202008/20200807 install Fedora on a Raspberry Pi 3.md new file mode 100644 index 0000000000..a6d54a8de3 --- /dev/null +++ b/published/202008/20200807 install Fedora on a Raspberry Pi 3.md @@ -0,0 +1,109 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12520-1.html) +[#]: subject: (install Fedora on a Raspberry Pi 3) +[#]: via: (https://fedoramagazine.org/install-fedora-on-a-raspberry-pi/) +[#]: author: (Nick Hardiman https://fedoramagazine.org/author/nickhardiman/) + +在树莓派 3 上安装 Fedora +====== + +![][1] + +> 在树莓派上运行 Fedora。 + +[树莓派基金会][2]这几年来生产了很多型号。本文的安装过程已经在第三代树莓派上进行了测试:[3B v1.2][3] 和 [B+][4](较旧的 [树莓派 2][5] 和新的 [树莓派 4][6] 都还没有测试)。这些是已经发布了几年的信用卡大小的树莓派。 + +### 获取硬件 + +你需要一些硬件组件,包括树莓派。你不需要任何 [HaT(安装在顶部的硬件)][7] 板或 USB 天线。如果你使用过树莓派,那么可能会有这些。 + + * **当前网络**。也许是你的家庭实验室。 + * **网线**。连接当前网络到树莓派 + * **树莓派 3**,型号 B 或 B+。 + * **电源**。 + * **8 GB 或更大容量的 micro-SD 卡**。 + * **键盘**和**显示器**。 + +键盘和显示器共同组成本地控制台。即使没有控制台,也能进行操作(尽管很复杂),例如设置自动安装然后通过网络连接。在 Fedora 首次启动时,本地控制台可轻松回应配置问题。同样,在 AP 配置期间出错可能会破坏网络配置,从而阻止远程用户连入。 + +### 下载 Fedora Minimal + + * 查找 Fedora 的[其他可选架构镜像][8]。 + * 下载 [ARM® aarch64 架构镜像][9]。 + +Fedora Minimal 镜像是 [Fedora 的其他可选下载之一][10],它有所有必需的核心软件包和网络软件包(嗯,是几乎,注意下面的 dnsmasq)。该镜像包含一个现成的文件系统,它已经安装了 400 多个软件包。此最小镜像不包括流行的软件包,像开发环境、互联网服务或桌面。这些类型的软件不是这里所必需的,如果安装它们,可能会占用过多的内存。 + +Fedora Minimal 原始镜像可安装在小型 SD 卡上,并在少于 1GB 的内存中运行(这些旧的树莓派有 1GB 的内存)。 + +下载文件的名称类似于 `Fedora-Minimal-32-1.6.aarch64.raw.xz`。该文件已压缩,大小约为 700MB。文件解压缩后为 5GB。这是一个 ext4 文件系统,它大部分是空的:已使用约 1GB,空余 4GB。这些空的空间是压缩文件比未压缩的原始文件小得多的原因。 + +### 复制到 micro-SD 卡 + + * 将镜像复制到 micro-SD 卡。 + +这可能比听起来更复杂,而且会带来痛苦的体验。找到一个[良好的 micro-SD 卡][11]需要花费精力。然后是将卡插到计算机的挑战。也许你的笔记本电脑有全尺寸的 SD 卡插槽,你还需要卡适配器,或者你需要一个 USB 适配器。然后,在进行复制时,操作系统可能会帮助你,也可能会妨碍你。你可能很幸运有 [Fedora Media Writer][12],或使用这些 Linux 命令: + +``` +unxz ./Fedora-Minimal-32-1.6.aarch64.raw.xz +dd if=./Fedora-Minimal-32-1.6.aarch64.raw of=/dev/mmcblk0 bs=8M status=progress oflag=direct +``` + +### 安装 Fedora + + * 连接树莓派、电源线、网线和 micro-SD 卡。 + * 打开电源。 + * 当图形芯片通电时,看见彩色框。 + * 等待 [anaconda 安装程序][13]启动。 + * 回答 anaconda 的设置问题。 + +操作系统的初始配置需要几分钟的时间。等待启动需要花费几分钟,还需要花费一些时间填写 anaconda 的文本安装程序的问题。在下面的例子中,用户名为 `nick`,并且还是管理员(`wheel` 组的成员)。 + +恭喜你!你的树莓派已启动并可运行。 + +### 更新软件 + + * 用 `dnf update` 更新软件包。 + * 通过 `systemctl reboot` 重启。 + +多年来,很多人为使树莓派正常工作付出了很多工作。使用最新的软件,以确保你从他们的辛勤工作中受益。如果你跳过此步骤,你可能会发现有些东西无法正常工作。 + +此次更新下载并安装了约一百个软件包。由于存储设备是 micro-SD 卡,因此写入新软件的过程很慢。这就是 90 年代使用存储器的感觉。 + +### 可以摆弄的东西 + +如果你想摆弄的话,此时可以设置其他一些内容。这都是可选的。试试这些。 + + * `sudo hostnamectl set-hostname raspi` 替换 `localhost` 主机名。 + * 用 `ip addr` 查找 IP 地址。 + * 尝试 SSH 登录,甚至使用 `ssh-copy-id` 设置基于密钥的登录。 + * 使用 `systemctl poweroff` 关机。 + +-------------------------------------------------------------------------------- + +via: https://fedoramagazine.org/install-fedora-on-a-raspberry-pi/ + +作者:[Nick Hardiman][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://fedoramagazine.org/author/nickhardiman/ +[b]: https://github.com/lujun9972 +[1]: https://fedoramagazine.org/wp-content/uploads/2020/07/fedora-on-rpi-816x346.png +[2]: https://www.raspberrypi.org/about/ +[3]: https://www.raspberrypi.org/products/raspberry-pi-3-model-b/ +[4]: https://www.raspberrypi.org/products/raspberry-pi-3-model-b-plus/ +[5]: https://www.raspberrypi.org/products/raspberry-pi-2-model-b/ +[6]: https://www.raspberrypi.org/products/raspberry-pi-4-model-b/ +[7]: https://www.raspberrypi.org/blog/introducing-raspberry-pi-hats/ +[8]: https://alt.fedoraproject.org/alt/ +[9]: https://download.fedoraproject.org/pub/fedora-secondary/releases/32/Spins/aarch64/images/Fedora-Minimal-32-1.6.aarch64.raw.xz +[10]: https://alt.fedoraproject.org/ +[11]: https://www.jeffgeerling.com/blog/2019/raspberry-pi-microsd-card-performance-comparison-2019 +[12]: https://fedoramagazine.org/make-fedora-usb-stick/ +[13]: https://fedoraproject.org/wiki/Anaconda diff --git a/published/202008/20200808 An attempt to make a font look more handwritten.md b/published/202008/20200808 An attempt to make a font look more handwritten.md new file mode 100644 index 0000000000..806f9caf59 --- /dev/null +++ b/published/202008/20200808 An attempt to make a font look more handwritten.md @@ -0,0 +1,121 @@ +[#]: collector: (lujun9972) +[#]: translator: (wxy) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12545-1.html) +[#]: subject: (An attempt to make a font look more handwritten) +[#]: via: (https://jvns.ca/blog/2020/08/08/handwritten-font/) +[#]: author: (Julia Evans https://jvns.ca/) + +一次让字体看起来更像手写体的尝试 +====== + +![](https://img.linux.net.cn/data/attachment/album/202008/24/111019lzpc280kkvlfpv1p.jpg) + +其实我对这个实验的结果并不是特别满意,但我还是想分享一下,因为摆弄字体是件非常简单和有趣的事情。而且有人问我怎么做,我告诉她我会写一篇博文来介绍一下 :) + +### 背景:原本的手写体 + +先交代一些背景信息:我有一个我自己的手写字体,我已经在我的电子杂志中使用了好几年了。我用一个叫 [iFontMaker][1] 的令人愉快的应用程序制作了它。他们在网站上自诩为“你可以在 5 分钟内只用手指就能制作出你的手工字体”。根据我的经验,“5 分钟”的部分比较准确 —— 我可能花了更多的时间,比如 15 分钟。我对“只用手指”的说法持怀疑态度 —— 我用的是 Apple Pencil,它的精确度要好得多。但是,使用该应用程序制作你的笔迹的 TTF 字体是非常容易的,如果你碰巧已经有了 Apple Pencil 和 iPad,我认为这是一个有趣的方式,我只花了 7.99 美元。 + +下面是我的字体的样子。左边的“CONNECT”文字是我的实际笔迹,右边的段落是字体。其实有 2 种字体 —— 有一种是普通字体,一种是手写的“等宽”字体。(其实实际并不是等宽,我还没有想好如何在 iFontMaker 中制作一个实际的等宽字体) + +![][2] + +### 目标:在字体上做更多的字符变化 + +在上面的截图中,很明显可以看出这是一种字体,而不是实际的笔迹。当你有两个相同的字母相邻时,就最容易看出来,比如“HTTP”。 + +所以我想,使用一些 OpenType 的功能,以某种方式为这个字体引入更多的变化,比如也许两个 “T” 可以是不同的。不过我不知道该怎么做! + +### 来自 Tristan Hume 的主意:使用 OpenType! + +然后我在 5 月份的 !!Con 2020 上(所有的[演讲录音都在这里!][3])看到了 Tristan Hume 的这个演讲:关于使用 OpenType 通过特殊的字体将逗号插入到大的数字中。他的演讲和博文都很棒,所以这里有一堆链接 —— 下面现场演示也许是最快看到他的成果的方式。 + + * 一个现场演示: [Numderline 测试][4] + * 博客文章:[将逗号插入到大的数字的各个位置:OpenType 冒险][5] + * 谈话:[!!Con 2020 - 使用字体塑型,把逗号插入到大的数字的各个位置!][6] + * GitHub 存储库: https://github.com/trishume/numderline/blob/master/patcher.py + +### 基本思路:OpenType 允许你根据上下文替换字符 + +我一开始对 OpenType 到底是什么非常困惑。目前我仍然不甚了然,但我知道到你可以编写极其简单的 OpenType 规则来改变字体的外观,而且你甚至不需要真正了解字体。 + +下面是一个规则示例: + +``` +sub a' b by other_a; +``` + +这里 `sub a' b by other_a;` 的意思是:如果一个 `a` 字形是在一个 `b` 之前,那么替换 `a` 为字形 `other_a`。 + +所以这意味着我可以让 `ab` 和 `ac` 在字体中出现不同的字形。这并不像手写体那样随机,但它确实引入了一点变化。 + +### OpenType 参考文档:真棒 + +我找到的最好的 OpenType 文档是这个 [OpenType™ 特性文件规范][7] 资料。里面有很多你可以做的很酷的事情的例子,比如用一个连字替换 “ffi”。 + +### 如何应用这些规则:fonttools + +为字体添加新的 OpenType 规则是超容易的。有一个 Python 库叫 `fonttools`,这 5 行代码会把放在 `rules.fea` 中的 OpenType 规则列表应用到字体文件 `input.ttf` 中。 + +``` +from fontTools.ttLib import TTFont +from fontTools.feaLib.builder import addOpenTypeFeatures + +ft_font = TTFont('input.ttf') +addOpenTypeFeatures(ft_font, 'rules.fea', tables=['GSUB']) +ft_font.save('output.ttf') +``` + +`fontTools` 还提供了几个名为 `ttx` 和 `fonttools` 的命令行工具。`ttx` 可以将 TTF 字体转换为 XML 文件,这对我很有用,因为我想重新命名我的字体中的一些字形,但我对字体一无所知。所以我只是将我的字体转换为 XML 文件,使用 `sed` 重命名字形,然后再次使用 `ttx` 将 XML 文件转换回 `ttf`。 + +`fonttools merge` 可以让我把我的 3 个手写字体合并成 1 个,这样我就在 1 个文件中得到了我需要的所有字形。 + +### 代码 + +我把我的极潦草的代码放在一个叫 [font-mixer][8] 的存储库里。它大概有 33 行代码,我认为它不言自明。(都在 `run.sh` 和 `combine.py` 中) + +### 结果 + +下面是旧字体和新字体的小样。我不认为新字体的“感觉”更像手写体 —— 有更多的变化,但还是比不上实际的手写体文字(在下面)。 + +我觉得稍微有点不可思议,它明明还是一种字体,但它却要假装成不是字体: + +![][9] + +而这是实际手写的同样的文字的样本: + +![][10] + +如果我在制作另外 2 种手写字体的时候,把原来的字体混合在一起,再仔细一点,可能效果会更好。 + +### 添加 OpenType 规则这么容易,真酷! + +这里最让我欣喜的是,添加 OpenType 规则来改变字体的工作方式是如此的容易,比如你可以很容易地做出一个“the”单词总是被“teh”代替的字体(让错别字一直留着!)。 + +不过我还是不知道如何做出更逼真的手写字体:)。我现在还在用旧的那个字体(没有额外的变化),我对它很满意。 + +-------------------------------------------------------------------------------- + +via: https://jvns.ca/blog/2020/08/08/handwritten-font/ + +作者:[Julia Evans][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://jvns.ca/ +[b]: https://github.com/lujun9972 +[1]: https://2ttf.com/ +[2]: https://jvns.ca/images/font-sample-connect.png +[3]: http://bangbangcon.com/recordings.html +[4]: https://thume.ca/numderline/ +[5]: https://blog.janestreet.com/commas-in-big-numbers-everywhere/ +[6]: https://www.youtube.com/watch?v=Biqm9ndNyC8 +[7]: https://adobe-type-tools.github.io/afdko/OpenTypeFeatureFileSpecification.html +[8]: https://github.com/jvns/font-mixer/ +[9]: https://jvns.ca/images/font-mixer-comparison.png +[10]: https://jvns.ca/images/handwriting-sample.jpeg diff --git a/published/202008/20200809 Open Source Drawing App Pinta Sees New Release After 5 Years. Here-s How to Get it.md b/published/202008/20200809 Open Source Drawing App Pinta Sees New Release After 5 Years. Here-s How to Get it.md new file mode 100644 index 0000000000..f9c356010c --- /dev/null +++ b/published/202008/20200809 Open Source Drawing App Pinta Sees New Release After 5 Years. Here-s How to Get it.md @@ -0,0 +1,108 @@ +[#]: collector: (lujun9972) +[#]: translator: (wxy) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12501-1.html) +[#]: subject: (Open Source Drawing App Pinta Sees New Release After 5 Years. Here’s How to Get it!) +[#]: via: (https://itsfoss.com/pinta-new-release/) +[#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/) + +开源绘画应用 Pinta 在 5 年后迎来新版本 +====== + +> 开源绘画应用 Pinta 时隔 5 年多迎来新版本。新版本修复了众多 BUG,并增加了新功能。 + +[Pinta][1] 是一款[开源绘画应用,适用于 Linux][2]、Windows 和 macOS。你可以用它来进行自由手绘/素描。你也可以用它在现有的图片上添加箭头、方框、文字等。 + +![][3] + +日前,Pinta 1.7 版本在时隔近 5 年后发布。让我们来看看新版本中都有哪些功能。 + +### Pinta 1.7 的新功能 + +以下是最新版本的 Pinta 带来的新功能: + + * 可以在图片之间切换的标签视图 + * 增加了一个平滑擦除工具 + * 拖放 URL 以在 Pinta 中下载并打开图像进行编辑 + * 铅笔工具可以在不同的混合模式之间切换 + * 按住 Ctrl 键可以缩放“选定移动”工具 + * 矩形选择工具现在在选区的每个角落显示不同的箭头光标 + * 提高了与选区互动时的性能,特别是对大图像而言 + +还有许多 bug 修复,这应该会改善整个 Pinta 的体验。你可以在[官方发布说明][4]中了解更多变化。 + +### 在 Ubuntu 和其他 Linux 发行版上安装 Pinta 1.7 + +对于 Ubuntu 和基于 Ubuntu 的 Linux 发行版,有一个[官方 PPA 可用][5]。如果你使用的是 Ubuntu 18.04 或 20.04,可以使用这个 PPA。 + +打开一个终端,使用下面的命令来添加新的仓库。你会被要求输入你的密码。你可能已经知道,当你在终端中输入密码时,不会有任何显示。只要输入密码,然后按回车键就可以了。 + +``` +sudo add-apt-repository ppa:pinta-maintainers/pinta-stable +``` + +在 Ubuntu 18.04 和更高版本上已不再需要,但其他一些发行版可能需要更新缓存: + +``` +sudo apt update +``` + +现在用这个命令安装最新版本的 Pinta: + +``` +sudo apt install pinta +``` + +好的是,如果你之前安装了 Pinta 1.6,它就会更新到新版本。 + +#### 移除 Pinta + +要删除通过 PPA 安装的 Pinta,请使用此命令: + +``` +sudo apt remove pinta +``` + +你还应该[删除此 PPA][6]: + +``` +sudo add-apt-repository -r ppa:pinta-maintainers/pinta-stable +``` + +#### 在其他发行版上安装 Pinta + +在我上次检查时,Pinta 1.7 还没有在 Fedora 或 AUR 上出现。你可以等待一段时间,或者下载源码自己试试。 + +- [下载 Pinta 1.7][7] + +Pinta 团队也更新了用户指南,提供了详细的文档。如果你是新手或者想深入使用 Pinta,可以参考[本用户指南][8]进行参考。 + +### 结束语 + +我很高兴能看到 Pinta 的新版本。它是我编辑图像的常用工具,可以为教程添加箭头、方框和文字。最近我使用 [Shutter][9] 来达到这个目的,但有了这个新版本,我也许会再次改用 Pinta。 + +你呢?你使用 Pinta 吗,或者你过去用过它吗?你期待使用新版本吗? + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/pinta-new-release/ + +作者:[Abhishek Prakash][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://itsfoss.com/author/abhishek/ +[b]: https://github.com/lujun9972 +[1]: https://www.pinta-project.com/ +[2]: https://itsfoss.com/open-source-paint-apps/ +[3]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/08/pinta-1-7.png?resize=800%2C517&ssl=1 +[4]: https://www.pinta-project.com/releases/1-7 +[5]: https://launchpad.net/~pinta-maintainers/+archive/ubuntu/pinta-stable +[6]: https://itsfoss.com/how-to-remove-or-delete-ppas-quick-tip/ +[7]: https://www.pinta-project.com/releases/ +[8]: https://www.pinta-project.com/user-guide/ +[9]: https://itsfoss.com/install-shutter-ubuntu/ diff --git a/published/202008/20200810 Merging and sorting files on Linux.md b/published/202008/20200810 Merging and sorting files on Linux.md new file mode 100644 index 0000000000..4bee2f31c7 --- /dev/null +++ b/published/202008/20200810 Merging and sorting files on Linux.md @@ -0,0 +1,155 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12539-1.html) +[#]: subject: (Merging and sorting files on Linux) +[#]: via: (https://www.networkworld.com/article/3570508/merging-and-sorting-files-on-linux.html) +[#]: author: (Sandra Henry-Stocker https://www.networkworld.com/author/Sandra-Henry_Stocker/) + +合并和排序 Linux 上的文件 +====== + +![](https://img.linux.net.cn/data/attachment/album/202008/22/102250i3943is48r34w4nz.jpg) + +在 Linux 上合并和排序文本的方法有很多种,但如何去处理它取决于你试图做什么:你是只想将多个文件的内容放入一个文件中,还是以某种方式组织它,让它更易于使用。在本文中,我们将查看一些用于排序和合并文件内容的命令,并重点介绍结果有何不同。 + +### 使用 cat + +如果你只想将一组文件放到单个文件中,那么 `cat` 命令是一个容易的选择。你所要做的就是输入 `cat`,然后按你希望它们在合并文件中的顺序在命令行中列出这些文件。将命令的输出重定向到要创建的文件。如果指定名称的文件已经存在,那么文件将被覆盖。例如: + +``` +$ cat firstfile secondfile thirdfile > newfile +``` + +如果要将一系列文件的内容添加到现有文件中,而不是覆盖它,只需将 `>` 变成 `>>`。 + +``` +$ cat firstfile secondfile thirdfile >> updated_file +``` + +如果你要合并的文件遵循一些方便的命名约定,那么任务可能更简单。如果可以使用正则表达式指定所有文件名,那就不必列出所有文件。例如,如果文件全部以 `file` 结束,如上所示,你可以进行如下操作: + +``` +$ cat *file > allfiles +``` + +请注意,上面的命令将按字母数字顺序添加文件内容。在 Linux 上,一个名为 `filea` 的文件将排在名为 `fileA` 的文件的前面,但会在 `file7` 的后面。毕竟,当我们处理字母数字序列时,我们不仅需要考虑 `ABCDE`,还需要考虑 `0123456789aAbBcCdDeE`。你可以使用 `ls *file` 这样的命令来查看合并文件之前文件的顺序。 + +注意:首先确保你的命令包含合并文件中所需的所有文件,而不是其他文件,尤其是你使用 `*` 等通配符时。不要忘记,用于合并的文件仍将单独存在,在确认合并后,你可能想要删除这些文件。 + +### 按时间期限合并文件 + +如果要基于每个文件的时间期限而不是文件名来合并文件,请使用以下命令: + +``` +$ for file in `ls -tr myfile.*`; do cat $file >> BigFile.$$; done +``` + +使用 `-tr` 选项(`t` = 时间,`r` = 反向)将产生按照最早的在最前排列的文件列表。例如,如果你要保留某些活动的日志,并且希望按活动执行的顺序添加内容,则这非常有用。 + +上面命令中的 `$$` 表示运行命令时的进程 ID。不是很必要使用此功能,但它几乎不可能会无意添加到现有的文件,而不是创建新文件。如果使用 `$$`,那么生成的文件可能如下所示: + +``` +$ ls -l BigFile.* +-rw-rw-r-- 1 justme justme 931725 Aug 6 12:36 BigFile.582914 +``` + +### 合并和排序文件 + +Linux 提供了一些有趣的方式来对合并之前或之后的文件内容进行排序。 + +#### 按字母对内容进行排序 + +如果要对合并的文件内容进行排序,那么可以使用以下命令对整体内容进行排序: + +``` +$ cat myfile.1 myfile.2 myfile.3 | sort > newfile +``` + +如果要按文件对内容进行分组,请使用以下命令对每个文件进行排序,然后再将它添加到新文件中: + +``` +$ for file in `ls myfile.?`; do sort $file >> newfile; done +``` + +#### 对文件进行数字排序 + +要对文件内容进行数字排序,请在 `sort` 中使用 `-n` 选项。仅当文件中的行以数字开头时,此选项才有用。请记住,按照默认顺序,`02` 将小于 `1`。当你要确保行以数字排序时,请使用 `-n` 选项。 + +``` +$ cat myfile.1 myfile.2 myfile.3 | sort -n > xyz +``` + +如果文件中的行以 `2020-11-03` 或 `2020/11/03`(年月日格式)这样的日期格式开头,`-n` 选项还能让你按日期对内容进行排序。其他格式的日期排序将非常棘手,并且将需要更复杂的命令。 + +### 使用 paste + +`paste` 命令允许你逐行连接文件内容。使用此命令时,合并文件的第一行将包含要合并的每个文件的第一行。以下是示例,其中我使用了大写字母以便于查看行的来源: + +``` +$ cat file.a +A one +A two +A three + +$ paste file.a file.b file.c +A one B one C one +A two B two C two +A three B three C thee + B four C four + C five +``` + +将输出重定向到另一个文件来保存它: + +``` +$ paste file.a file.b file.c > merged_content +``` + +或者,你可以将每个文件的内容在同一行中合并,然后将文件粘贴在一起。这需要使用 `-s`(序列)选项。注意这次的输出如何显示每个文件的内容: + +``` +$ paste -s file.a file.b file.c +A one A two A three +B one B two B three B four +C one C two C thee C four C five +``` + +### 使用 join + +合并文件的另一个命令是 `join`。`join` 命令让你能基于一个共同字段合并多个文件的内容。例如,你可能有一个包含一组同事的电话的文件,其中,而另一个包含了同事的电子邮件地址,并且两者均按个人姓名列出。你可以使用 `join` 创建一个包含电话和电子邮件地址的文件。 + +一个重要的限制是文件的行必须是相同的顺序,并在每个文件中包括用于连接的字段。 + +这是一个示例命令: + +``` +$ join phone_numbers email_addresses +Sandra 555-456-1234 bugfarm@gmail.com +Pedro 555-540-5405 +John 555-333-1234 john_doe@gmail.com +Nemo 555-123-4567 cutie@fish.com +``` + +在本例中,即使缺少附加信息,第一个字段(名字)也必须存在于每个文件中,否则命令会因错误而失败。对内容进行排序有帮助,而且可能更容易管理,但只要顺序一致,就不需要这么做。 + +### 总结 + +在 Linux 上,你有很多可以合并和排序存储在单独文件中的数据的方式。这些方法可以使原本繁琐的任务变得异常简单。 + +-------------------------------------------------------------------------------- + +via: https://www.networkworld.com/article/3570508/merging-and-sorting-files-on-linux.html + +作者:[Sandra Henry-Stocker][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://www.networkworld.com/author/Sandra-Henry_Stocker/ +[b]: https://github.com/lujun9972 +[2]: https://www.facebook.com/NetworkWorld/ +[3]: https://www.linkedin.com/company/network-world diff --git a/published/202008/20200811 Don-t ignore .gitignore.md b/published/202008/20200811 Don-t ignore .gitignore.md new file mode 100644 index 0000000000..7e1b1bc47a --- /dev/null +++ b/published/202008/20200811 Don-t ignore .gitignore.md @@ -0,0 +1,94 @@ +[#]: collector: (lujun9972) +[#]: translator: (wxy) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12524-1.html) +[#]: subject: (Don't ignore .gitignore) +[#]: via: (https://opensource.com/article/20/8/dont-ignore-gitignore) +[#]: author: (Rajeev Bera https://opensource.com/users/acompiler) + +不要忽视 .gitignore +====== + +> 使用 .gitignore 文件是提高代码和 Git 仓库质量的最佳实践之一。 + +![](https://img.linux.net.cn/data/attachment/album/202008/16/211643mahzp0zthbh0z55w.jpg) + +我注意到很多开发者没有使用 `.gitignore` 文件,尽管使用 `.gitignore` 文件来指定你不希望 Git 在版本控制中跟踪的文件是[最佳实践][2]之一。`.gitignore` 可以提高代码质量,所以你不应该忽略版本库中的 [.gitignore][3]。 + +### 什么是 .gitignore? + +Git 仓库中的文件可以是: + + 1. **未跟踪的**:未被暂存或提交的变更。 + 2. **跟踪的**:已暂存或提交的变更。 + 3. **忽略的**:你让 Git 忽略的文件。 + +有些文件你希望 Git 忽略,不要在你的版本库中跟踪它,这些文件包括许多自动生成的或特定于平台的文件,以及其他本地配置文件,如: + + 1. 含有敏感信息的文件 + 2. 编译出的代码,如 `.dll` 或 `.class`。 + 3. 系统文件,如 `.DS_Store` 或 `Thumbs.db`。 + 4. 含有临时信息的文件,如日志、缓存等。 + 5. 生成的文件,如 `dist` 文件夹。 + +如果你不想让 Git 跟踪版本库中的某些文件,不过这不能通过 [Git 命令][4]做到。(虽然你可以用 `git rm` 命令停止跟踪一个文件,比如 `git rm --cached`。)相反,你需要使用 `.gitignore` 文件,这是一个告诉 Git 不要跟踪哪些文件的文本文件。 + +创建 `.gitignore` 文件很简单,只需创建一个文本文件并命名为 `.gitignore`。记得在文件名的开头有一个点(`.`)。就这样就完成了。 + +### 编写 .gitignore 文件的规则 + +根据[文档][3],“`.gitignore` 文件中的每一行都指定了一个模式。” + +在此上下文中,“模式”可以指一个特定的文件名,或者指文件名的某些部分结合上通配符。换句话说,`example.txt` 是匹配名为 `example.txt` 的文件的有效模式,而 `ex*txt` 是匹配名为 `example.txt` 以及 `export.txt` 的文件的有效模式。 + +以下是一些帮助你正确设置 `.gitignore` 文件的基本规则: + + 1. 任何以哈希(`#`)开头的行都是注释。 + 2. `\` 字符可以转义特殊字符。 + 3. `/` 字符表示该规则只适用于位于同一文件夹中的文件和文件夹。 + 4. 星号(`*`)表示任意数量的字符(零个或更多)。 + 5. 两个星号(`**`)表示任意数量的子目录。 + 6. 一个问号(`?`)代替零个或一个字符。 + 7. 一个感叹号(`!`)会反转特定的规则(即包括了任何被前一个模式排除的文件)。 + 8. 空行会被忽略,所以你可以用它们来增加空间,使你的文件更容易阅读。 + 9. 在末尾添加 `/` 会忽略整个目录路径。 + +### 本地与全局 .gitignore 文件的比较 + +有两种类型的 `.gitignore` 文件: + + * **本地**:放在 Git 仓库的根目录下,只在该仓库中工作,并且必须提交到该仓库中。 + * **全局**:放在你的主目录根目录下,影响你在你的机器上使用的每个仓库,不需要提交。 + +很多开发者在项目仓库中使用本地的 `.gitignore` 文件,但很少有人使用全局的 `.gitignore` 文件。使用全局文件最显著的优势是,你不需要提交就可以使用它,而且做一个改动会影响你所有的版本库。 + +### Git 忽略的优势 + +除了确保特定的文件不被 Git 追踪之外,使用 `.gitignore` 文件还有其他好处。 + + 1. 通过忽略不需要的文件,它可以帮助你保持代码库的干净。 + 2. 它可以控制代码库的大小,这在你正在做一个大项目的时候特别有用。 + 3. 你的每一次提交、推送和拉取请求都将是干净的。 + +### 结束语 + +Git 很强大,但归根结底,它只是一个计算机程序而已。使用最佳实践并保持你的代码仓库稳定是一个团队的努力,其中要做到一件事就是使用 `.gitignore` 文件。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/8/dont-ignore-gitignore + +作者:[Rajeev Bera][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/acompiler +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/lenovo-thinkpad-laptop-concentration-focus-windows-office.png?itok=-8E2ihcF (Woman using laptop concentrating) +[2]: https://opensource.com/article/20/7/git-repos-best-practices +[3]: https://git-scm.com/docs/gitignore +[4]: https://acompiler.com/git-commands/ diff --git a/published/202008/20200811 Photoflare- An Open Source Image Editor for Simple Editing Needs.md b/published/202008/20200811 Photoflare- An Open Source Image Editor for Simple Editing Needs.md new file mode 100644 index 0000000000..8d1712c3ce --- /dev/null +++ b/published/202008/20200811 Photoflare- An Open Source Image Editor for Simple Editing Needs.md @@ -0,0 +1,118 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12538-1.html) +[#]: subject: (Photoflare: An Open Source Image Editor for Simple Editing Needs) +[#]: via: (https://itsfoss.com/photoflare/) +[#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/) + +Photoflare:满足简单编辑需求的开源图像编辑器 +====== + +> Photoflare 是一款可用于 Linux 和 Windows 上的图像编辑器。它有一个免费而开源的社区版本。 + +在 Linux 上编辑图像时,GIMP 显然是首选。但是,如果你不需要高级编辑功能,GIMP 可能会让人不知所措。这是像 Photoflare 这样的应用立足的地方。 + +### PhotoFlare:一个简单的图像编辑器 + +![][1] + +Photoflare 是一个在简单易用的界面里提供了基本的图像编辑功能的编辑器。 + +它受流行的 Windows 应用 [PhotoFiltre][2] 的启发。这个程序不是一个克隆品,它是用 C++ 从头开始编写的,并使用 Qt 框架作为界面。 + +它的功能包括裁剪、翻转/旋转、调整图像大小。你还可以使用诸如油漆刷、油漆桶、喷雾罐、模糊工具和橡皮擦之类的工具。魔术棒工具可让你选择图像的特定区域。 + +你还可以在图像上添加线条和文本。你还可以更改图像的色调。 + +你也可以像其他[画图应用][3]一样从头开始创建图像。 + +批处理编辑选项可让你同时为多张图片调整大小、转换文件格式和添加滤镜。 + +![Batch Editing Feature in Photoflare | Photo Credit: Photoflare website][4] + +### Photoflare 的功能 + +为了方便参考,我将列出 Photoflare 的主要功能: + +* 创建/绘制图像 +* 裁剪图像 +* 旋转图像 +* 调整图像大小 +* 使用画笔、油漆桶、喷涂、模糊工具和图像等工具编辑图像 +* 在图像上添加线条和文字 +* 更改图像的色调 +* 添加老照片滤镜 +* 批量调整大小、滤镜等 + +### 在 Linux 上安装 Photflare + +![][5] + +在 Photoflare 的网站上,你可以找到定价以及每月订阅的选项。但是,该应用是开源的,它的[源码可在 GitHub 上找到][6]。 + +应用也是“免费”使用的。[定价/订购部分][7]用于该项目的财务支持。你可以免费下载它,如果你喜欢该应用并且会继续使用,请考虑给它捐赠。 + +Photoflare 有[官方 PPA][8],适用于 Ubuntu 和基于 Ubuntu 的发行版。此 PPA 可用于 Ubuntu 18.04 和 20.04 版本。 + +打开终端,逐一输入下面的命令安装 Photoflare: + +``` +sudo add-apt-repository ppa:photoflare/photoflare-stable +sudo apt update +sudo apt install photoflare +``` + +要从基于 Ubuntu 的发行版中删除 Photoflare,请使用以下命令: + +``` +sudo apt remove photoflare +``` + +最好也删除 PPA: + +``` +sudo add-apt-repository -r ppa:photoflare/photoflare-stable +``` + +Arch Linux 和 Manjaro 用户可以[从 AUR 获取][9]。 + +Fedora 没有现成的软件包,因此你需要获取源码: + +- [Photoflare 源代码][6] + +### Photoflare 的经验 + +我发现它与 [Pinta][10] 有点相似,但功能更多。它是用于基本图像编辑的简单工具。批处理功能是加分项。 + +我注意到图像在打开编辑时看起来不够清晰。我打开一张截图进行编辑,字体看起来很模糊。但是,保存图像并在[图像查看器][11]中打开后,没有显示此问题。 + +总之,如果你不需要专业级的图像编辑,它是一个不错的工具。 + +如果你曾经使用过或会去尝试它,请分享你的 Photoflare 使用经验。 + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/photoflare/ + +作者:[Abhishek Prakash][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://itsfoss.com/author/abhishek/ +[b]: https://github.com/lujun9972 +[1]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/08/Photoflare.jpg?ssl=1 +[2]: http://photofiltre.free.fr/frames_en.htm +[3]: https://itsfoss.com/open-source-paint-apps/ +[4]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/08/batch_editing_photoflare.png?ssl=1 +[5]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/08/photoflare-editor-linux.png?resize=800%2C580&ssl=1 +[6]: https://github.com/PhotoFlare/photoflare +[7]: https://photoflare.io/pricing/ +[8]: https://launchpad.net/~photoflare/+archive/ubuntu/photoflare-stable +[9]: https://aur.archlinux.org/packages/photoflare-git/ +[10]: https://itsfoss.com/pinta-new-release/ +[11]: https://itsfoss.com/image-viewers-linux/ \ No newline at end of file diff --git a/published/202008/20200813 AI system analyzes code similarities, makes progress toward automated coding.md b/published/202008/20200813 AI system analyzes code similarities, makes progress toward automated coding.md new file mode 100644 index 0000000000..ddfb8102e8 --- /dev/null +++ b/published/202008/20200813 AI system analyzes code similarities, makes progress toward automated coding.md @@ -0,0 +1,56 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12569-1.html) +[#]: subject: (AI system analyzes code similarities, makes progress toward automated coding) +[#]: via: (https://www.networkworld.com/article/3570389/ai-system-analyzes-code-similarities-makes-progress-toward-automated-coding.html) +[#]: author: (Patrick Nelson https://www.networkworld.com/author/Patrick-Nelson/) + +AI 系统向自动化编码迈进 +====== + +> 来自 Intel、MIT 和佐治亚理工学院的研究人员正在研究一个 AI 引擎,它可以分析代码的相似性,以确定代码的实际作用,为自动化软件编写奠定了基础。 + +![](https://img.linux.net.cn/data/attachment/album/202008/31/231333fklk447gw4w4b4vk.jpg) + +随着人工智能(AI)的快速发展,我们是否会进入计算机智能到足以编写自己的代码并和人类一起完成工作?新的研究表明,我们可能正在接近这个里程碑。 + +来自 MIT 和佐治亚理工学院的研究人员与 Intel 合作开发了一个人工智能引擎,被称为机器推断代码相似性(MISIM),它旨在分析软件代码并确定它与其他代码的相似性。最有趣的是,该系统有学习代码的潜力,然后利用这种智能来改变软件的编写方式。最终,人们可以解释希望程序做什么,然后机器编程(MP)系统可以拿出一个已经编写完的应用。 + +Intel 首席科学家兼机器编程研究总监/创始人 Justin Gottschlich 在该公司的[新闻稿][2]中说:“当完全实现时,MP 能让每个人都能以任何最适合自己的方式 —— 无论是代码、自然语言还是其他东西 —— 来表达自己的意图以创建软件。这是一个大胆的目标,虽然还有很多工作要做,但 MISIM 是朝着这个目标迈出的坚实一步。” + +### 它是如何工作的 + +Intel 解释说,神经网络“根据它们被设计执行的作业”给代码片段打出相似度分数。例如,两个代码样本可能看起来完全不同,但由于它们执行相同的功能,因此被评为相同。然后,该算法可以确定哪个代码片段更有效率。 + +例如,代码相似性系统的原始版本被用于抄袭检测。然而,有了 MISIM,该算法会查看代码块,并试图根据上下文确定这些代码段是否具有相似的特征,或者是否有相似的目标。然后,它可以提供性能方面的改进,例如说,总体效率的改进。 + +MISIM 的关键是创造者的意图,它标志着向基于意图的编程的进步,它可以使软件的设计基于非程序员创造者想要实现的目标。通过基于意图的编程,算法会借助于一个开源代码池,而不是依靠传统的、手工的方法,编译一系列类似于步骤的编程指令,逐行告诉计算机如何做某件事。 + +Intel 解释说:“MISIM 与现有代码相似性系统的核心区别在于其新颖的上下文感知语义结构 (CASS),其目的是将代码的实际作用提炼出来。与其他现有的方法不同,CASS 可以根据特定的上下文进行配置,使其能够捕捉到更高层次的代码描述信息。CASS 可以更具体地洞察代码的作用,而不是它是如何做的。” + +这是在没有编译器(编程中的一个阶段,将人类可读代码转换为计算机程序)的情况下完成的。方便的是,可以执行部分片段,只是为了看看那段代码中会发生什么。另外,该系统摆脱了软件开发中一些比较繁琐的部分,比如逐行查找错误。更多细节可以在该小组的论文([PDF][3])中找到。 + +Intel 表示,该团队的 MISIM 系统比之前的代码相似性系统识别相似代码的准确率高 40 倍。 + +一个 Redditor,Heres_your_sign [对 MISIM 报道][4]的评论中有趣地指出,幸好计算机不写需求。这位 Redditor 认为,那是自找麻烦。 + +-------------------------------------------------------------------------------- + +via: https://www.networkworld.com/article/3570389/ai-system-analyzes-code-similarities-makes-progress-toward-automated-coding.html + +作者:[Patrick Nelson][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://www.networkworld.com/author/Patrick-Nelson/ +[b]: https://github.com/lujun9972 +[2]: https://newsroom.intel.com/news/intel-mit-georgia-tech-machine-programming-code-similarity-system/#gs.d8qd40 +[3]: https://arxiv.org/pdf/2006.05265.pdf +[4]: https://www.reddit.com/r/technology/comments/i2dxed/this_ai_could_bring_us_computers_that_can_write/ +[5]: https://www.facebook.com/NetworkWorld/ +[6]: https://www.linkedin.com/company/network-world diff --git a/published/202008/20200814 Come test a new release of pipenv, the Python development tool.md b/published/202008/20200814 Come test a new release of pipenv, the Python development tool.md new file mode 100644 index 0000000000..f6f5410c59 --- /dev/null +++ b/published/202008/20200814 Come test a new release of pipenv, the Python development tool.md @@ -0,0 +1,109 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12540-1.html) +[#]: subject: (Come test a new release of pipenv, the Python development tool) +[#]: via: (https://fedoramagazine.org/come-test-a-new-release-of-pipenv-the-python-development-tool/) +[#]: author: (torsava https://fedoramagazine.org/author/torsava/) + +快来测试 Python 开发工具 pipenv 的新版本 +====== + +![][1] + +[pipenv][2] 是一个可帮助 Python 开发人员维护具有特定一组依赖关系的隔离虚拟环境,以实现可重新复制的开发和部署环境的工具。它类似于其他编程语言中的工具如 bundler、composer、npm、cargo、yarn 等。 + +最近发布了新版本的 pipenv 2020.6.2。现在可以在 Fedora 33 和 Rawhide 中使用它。对于较旧的 Fedora,维护人员决定打包到 [COPR][3] 中来先进行测试。所以在他们把它推送到稳定的Fedora版本之前,来试试吧。新版本没有带来任何新颖的功能,但是经过两年的开发,它解决了许多问题,并且在底层做了很多不同的事情。之前可以正常工作的应该可以继续工作,但是可能会略有不同。 + +### 如何获取 + +如果你已经在运行 Fedora 33 或 Rawhide,请运行 `$ sudo dnf upgrade pipenv` 或者 `$ sudo dnf install pipenv`,你将获得新版本。 + +在 Fedora 31 或 Fedora 32 上,你需要使用 [copr 仓库][3],直到经过测试的包出现在官方仓库中为止。要启用仓库,请运行: + +``` +$ sudo dnf copr enable @python/pipenv +``` + +然后将 `pipenv` 升级到新版本,运行: + +``` +$ sudo dnf upgrade pipenv +``` + +或者,如果尚未安装,请通过以下方式安装: + +``` +$ sudo dnf install pipenv +``` + +如果你需要回滚到官方维护的版本,可以运行: + +``` +$ sudo dnf copr disable @python/pipenv +$ sudo dnf distro-sync pipenv +``` + +*COPR 不受 Fedora 基础架构的官方支持。使用软件包需要你自担风险。* + +### 如何使用 + +如果你有用旧版本 `pipenv` 管理的项目,你应该可以毫无问题地使用新版本。如果有问题请让我们知道。 + +如果你还不熟悉 `pipenv` 或想开始一个新项目,请参考以下快速指南: + +创建一个工作目录: + +``` +$ mkdir new-project && cd new-project +``` + +使用 Python 3 初始化 `pipenv`: + +``` +$ pipenv --three +``` + +安装所需的软件包,例如: + +``` +$ pipenv install six +``` + +生成 `Pipfile.lock` 文件: + +``` +$ pipenv lock +``` + +现在,你可以将创建的 `Pipfile` 和 `Pipfile.lock` 文件提交到版本控制系统(例如 git)中,其他人可以在克隆的仓库中使用此命令来获得相同的环境: + +``` +$ pipenv install +``` + +有关更多示例,请参见 [pipenv 的文档][4]。 + +### 如何报告问题 + +如果你使用新版本的 `pipenv` 遇到任何问题,请[在 Fedora 的 Bugzilla中 报告问题][5]。Fedora 官方仓库和 copr 仓库中 `pipenv` 软件包的维护者是相同的人。请在报告中指出是新版本。 + +-------------------------------------------------------------------------------- + +via: https://fedoramagazine.org/come-test-a-new-release-of-pipenv-the-python-development-tool/ + +作者:[torsava][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://fedoramagazine.org/author/torsava/ +[b]: https://github.com/lujun9972 +[1]: https://fedoramagazine.org/wp-content/uploads/2018/06/pipenv-install-816x345.jpg +[2]: https://github.com/pypa/pipenv +[3]: https://copr.fedorainfracloud.org/coprs/g/python/pipenv/ +[4]: https://pipenv.pypa.io/en/latest/install/ +[5]: https://bugzilla.redhat.com/enter_bug.cgi?product=Fedora&component=pipenv diff --git a/published/202008/20200817 Use GNU on Windows with MinGW.md b/published/202008/20200817 Use GNU on Windows with MinGW.md new file mode 100644 index 0000000000..153eedab60 --- /dev/null +++ b/published/202008/20200817 Use GNU on Windows with MinGW.md @@ -0,0 +1,141 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12549-1.html) +[#]: subject: (Use GNU on Windows with MinGW) +[#]: via: (https://opensource.com/article/20/8/gnu-windows-mingw) +[#]: author: (Seth Kenlon https://opensource.com/users/seth) + +使用 Mingw 在 Windows 上使用 GNU +====== + +> 在 Windows 上安装 GNU 编译器集合(gcc)和其他 GNU 组件来启用 GNU Autotools。 + +![](https://img.linux.net.cn/data/attachment/album/202008/25/085619rr331p13shpt6htp.jpg) + +如果你是一名使用 Windows 的黑客,你不需要专有应用来编译代码。借助 [Minimalist GNU for Windows][2](MinGW)项目,你可以下载并安装 [GNU 编译器集合(GCC)][3]以及其它几个基本的 GNU 组件,以在 Windows 计算机上启用 [GNU Autotools][4]。 + +### 安装 MinGW + +安装 MinGW 的最简单方法是通过 mingw-get,它是一个图形用户界面 (GUI) 应用,可帮助你选择要安装哪些组件,并让它们保持最新。要运行它,请从项目主页[下载 mingw-get-setup.exe][5]。像你安装其他 EXE 一样,在向导中单击完成安装。 + +![Installing mingw-get][6] + +### 在 Windows 上安装 GCC + +目前为止,你只安装了一个程序,或者更准确地说,一个称为 mingw-get 的专用的*包管理器*。启动 mingw-get 选择要在计算机上安装的 MinGW 项目应用。 + +首先,从应用菜单中选择 mingw-get 启动它。 + +![Installing GCC with MinGW][8] + +要安装 GCC,请单击 GCC 和 G++ 包来标记要安装 GNU C、C++ 编译器。要完成此过程,请从 mingw-get 窗口左上角的**安装**菜单中选择**应用更改**。 + +安装 GCC 后,你可以使用完整路径在 [PowerShell][9] 中运行它: + +``` +PS> C:\MinGW\bin\gcc.exe --version +gcc.exe (MinGW.org GCC Build-x) x.y.z +Copyright (C) 2019 Free Software Foundation, Inc. +``` + +### 在 Windows 上运行 Bash + +虽然它自称 “minimalist”(最小化),但 MinGW 还提供一个可选的 [Bourne shell][10] 命令行解释器,称为 MSYS(它代表最小系统Minimal System)。它是微软的 `cmd.exe` 和 PowerShell 的替代方案,它默认是 Bash。除了是(自然而然的)最流行的 shell 之一外,Bash 在将开源应用移植到 Windows 平台时很有用,因为许多开源项目都假定了 [POSIX][11] 环境。 + +你可以在 mingw-get GUI 或 PowerShell 内安装 MSYS: + +``` +PS> mingw-get install msys +``` + +要尝试 Bash,请使用完整路径启动它: + +``` +PS> C:\MinGW\msys/1.0/bin/bash.exe +bash.exe-$ echo $0 +"C:\MinGW\msys/1.0/bin/bash.exe" +``` + +### 在 Windows 上设置路径 + +你可能不希望为要使用的每个命令输入完整路径。将包含新 GNU 可执行文件的目录添加到 Windows 中的路径中。需要添加两个可执行文件的根目录:一个用于 MinGW(包括 GCC 及其相关工具链),另一个用于 MSYS(包括 Bash、GNU 和 [BSD][12] 项目中的许多常用工具)。 + +若要在 Windows 中修改环境,请单击应用菜单并输入 `env`。 + +![Edit your env][13] + +这将打开“首选项”窗口。点击窗口底部附近的“环境变量”按钮。 + +在“环境变量”窗口中,双击底部面板中的“路径”选区。 + +在“编辑环境变量”窗口中,单击右侧的“新增”按钮。创建一个新条目 `C:\MinCW\msys\1.0\bin`,然后单击 “确定”。以相同的方式创建第二条 `C:\MinGW\bin`,然后单击 “确定”。 + +![Set your env][14] + +在每个首选项窗口中接受这些更改。你可以重启计算机以确保所有应用都检测到新变量,或者只需重启 PowerShell 窗口。 + +从现在开始,你可以调用任何 MinGW 命令而不指定完整路径,因为完整路径位于 PowerShell 继承的 Windows 系统的 `%PATH%` 环境变量中。 + +### Hello world + +你已经完成设置,因此可以对新的 MinGW 系统进行小测试。如果你是 [Vim][15] 用户,请启动它,然后输入下面的 “hello world” 代码: + +``` +#include +#include + +using namespace std; + +int main() { + cout << "Hello open source." << endl; + return 0; +} +``` + +将文件保存为 `hello.cpp`,然后使用 GCC 的 C++ 组件编译文件: + +``` +PS> gcc hello.cpp --output hello +``` + +最后,运行它: + +``` +PS> .\a.exe +Hello open source. +PS> +``` + +MinGW 的内容远不止我在这里所能介绍的。毕竟,MinGW 打开了一个完整的开源世界和定制代码的潜力,因此请充分利用它。对于更广阔的开源世界,你还可以[试试 Linux][16]。当所有的限制都被消除后,你会惊讶于可能的事情。但与此同时,请试试 MinGW,并享受 GNU 的自由。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/8/gnu-windows-mingw + +作者:[Seth Kenlon][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/seth +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/more_windows.jpg?itok=hKk64RcZ (Windows) +[2]: http://mingw.org +[3]: https://gcc.gnu.org/ +[4]: https://opensource.com/article/19/7/introduction-gnu-autotools +[5]: https://osdn.net/projects/mingw/releases/ +[6]: https://opensource.com/sites/default/files/uploads/mingw-install.jpg (Installing mingw-get) +[7]: https://creativecommons.org/licenses/by-sa/4.0/ +[8]: https://opensource.com/sites/default/files/uploads/mingw-packages.jpg (Installing GCC with MinGW) +[9]: https://opensource.com/article/19/8/variables-powershell +[10]: https://en.wikipedia.org/wiki/Bourne_shell +[11]: https://opensource.com/article/19/7/what-posix-richard-stallman-explains +[12]: https://opensource.com/article/19/3/netbsd-raspberry-pi +[13]: https://opensource.com/sites/default/files/uploads/mingw-env.jpg (Edit your env) +[14]: https://opensource.com/sites/default/files/uploads/mingw-env-set.jpg (Set your env) +[15]: https://opensource.com/resources/what-vim +[16]: https://opensource.com/article/19/7/ways-get-started-linux diff --git a/published/202008/20200818 IBM details next-gen POWER10 processor.md b/published/202008/20200818 IBM details next-gen POWER10 processor.md new file mode 100644 index 0000000000..182beb3ff8 --- /dev/null +++ b/published/202008/20200818 IBM details next-gen POWER10 processor.md @@ -0,0 +1,53 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12546-1.html) +[#]: subject: (IBM details next-gen POWER10 processor) +[#]: via: (https://www.networkworld.com/article/3571415/ibm-details-next-gen-power10-processor.html) +[#]: author: (Andy Patrizio https://www.networkworld.com/author/Andy-Patrizio/) + +IBM 披露了下一代 POWER10 处理器细节 +====== + +![](https://images.idgesg.net/images/article/2020/08/power-10_06-100854570-large.jpg) + +> 新的 CPU 针对企业混合云和 AI 推断进行了优化,它采用了为 PB 级内存集群开发的新技术。 + +IBM 上周一公布了最新的 POWER RISC CPU 系列,该系列针对企业混合云计算和人工智能 (AI)推理进行了优化,同时还进行了其他一些改进。 + +Power 是上世纪 90 年代最后一款 Unix 处理器,当时 Sun Microsystems、HP、SGI 和 IBM 都有竞争性的 Unix 系统,以及与之配合的 RISC 处理器。后来,Unix 让位给了 Linux,RISC 让位给了 x86,但 IBM 坚持了下来。 + +这是 IBM 的第一款 7 纳米处理器,IBM 宣称它将在与前代 POWER9 相同的功率范围内,将容量和处理器能效提升多达三倍。该处理器采用 15 核设计(实际上是 16 核,但其中一个没有使用),并允许采用单芯片或双芯片型号,因此 IBM 可以在同一外形尺寸中放入两个处理器。每个核心最多可以有 8 个线程,每块 CPU 最多支持 4TB 的内存。 + +更有趣的是一种名为 Memory Inception 的新内存集群技术。这种形式的集群允许系统将另一台物理服务器中的内存当作自己的内存来看待。因此,服务器不需要在每个机箱中放很多内存,而是可以在内存需求激增的时候,从邻居那里借到内存。或者,管理员可以在集群的中间设置一台拥有大量内存的服务器,并在其周围设置一些低内存服务器,这些服务器可以根据需要从大内存服务器上借用内存。 + +所有这些都是在 50 到 100 纳秒的延迟下完成的。IBM 的杰出工程师 William Starke 在宣布前的视频会议上说:“这已经成为行业的圣杯了。与其在每个机器里放很多内存,不如当我们对内存的需求激增时,我可以向邻居借。” + +POWER10 使用的是一种叫做开放内存接口(OMI)的东西,因此服务器现在可以使用 DDR4,上市后可以升级到 DDR5,它还可以使用 GPU 中使用的 GDDR6 内存。理论上,POWER10 将具备 1TB/秒的内存带宽和 1TB/秒的 SMP 带宽。 + +与 POWER9 相比,POWER10 处理器每个核心的 AES 加密引擎数量增加了四倍。这实现了多项安全增强功能。首先,这意味着在不降低性能的情况下进行全内存加密,因此入侵者无法扫描内存内容。 + +其次,它可以为容器提供隔离的硬件和软件安全。这是为了解决更高密度的容器相关的行安全考虑。如果一个容器被入侵,POWER10 处理器的设计能够防止同一虚拟机中的其他容器受到同样的入侵影响。 + +最后,POWER10 提供了核心内的 AI 业务推断。它通过片上支持用于训练的 bfloat16 以及 AI 推断中常用的 INT8 和 INT4 实现。这将允许事务性负载在应用中添加 AI 推断。IBM 表示,POWER10 中的 AI 推断是 POWER9 的 20 倍。 + +公告中没有提到的是对操作系统的支持。POWER 运行 IBM 的 Unix 分支 AIX,以及 Linux。这并不太令人惊讶,因为这个消息是在 Hot Chips 上发布的,Hot Chips 是每年在斯坦福大学举行的年度半导体会议。Hot Chips 关注的是最新的芯片进展,所以软件通常被排除在外。 + +IBM 一般会在发布前一年左右公布新的 POWER 处理器,所以有足够的时间进行 AIX 的更新。 + +-------------------------------------------------------------------------------- + +via: https://www.networkworld.com/article/3571415/ibm-details-next-gen-power10-processor.html + +作者:[Andy Patrizio][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://www.networkworld.com/author/Andy-Patrizio/ +[b]: https://github.com/lujun9972 +[1]: https://www.facebook.com/NetworkWorld/ +[2]: https://www.linkedin.com/company/network-world diff --git a/published/202008/20200819 How to Convert Text Files between Unix and DOS (Windows) Formats.md b/published/202008/20200819 How to Convert Text Files between Unix and DOS (Windows) Formats.md new file mode 100644 index 0000000000..a7cfa20b4e --- /dev/null +++ b/published/202008/20200819 How to Convert Text Files between Unix and DOS (Windows) Formats.md @@ -0,0 +1,222 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12558-1.html) +[#]: subject: (How to Convert Text Files between Unix and DOS Windows Formats) +[#]: via: (https://www.2daygeek.com/how-to-convert-text-files-between-unix-and-dos-windows-formats/) +[#]: author: (Magesh Maruthamuthu https://www.2daygeek.com/author/magesh/) + +如何将文本文件在 Unix 和 DOS(Windows)格式之间转换 +====== + +![](https://img.linux.net.cn/data/attachment/album/202008/27/235550klfnz34lzpnchf7g.jpg) + +作为一名 Linux 管理员,你可能已经注意到了一些开发者请求将文件从 DOS 格式转换为 Unix 格式,反之亦然。 + +这是因为这些文件是在 Windows 系统上创建的,并由于某种原因被复制到 Linux 系统上。 + +这本身没什么问题,但 Linux 系统上的一些应用可能不能理解这些新的换行符,所以在使用之前,你需要转换它们。 + +DOS 文本文件带有回车(`CR` 或 `\r`)和换行(`LF` 或 `\n`)一对字符作为它们的换行符,而 Unix 文本只有换行(`LF`)符。 + +有很多方法可以将 DOS 文本文件转换为 Unix 格式。 + +但我推荐使用一个名为 `dos2unix` / `unix2dos` 的特殊工具将文本在 DOS 和 Unix 格式之间转换。 + + * `dos2unix`:将文本文件从 DOS 格式转换为 Unix 格式。 + * `unix2dos`:将文本文件从 Unix 格式转换为 DOS 格式。 + * `tr`、`awk` 和 [sed 命令][1]:这些可以用于相同的目的。 + +使用 `od`(八进制转储octal dump)命令可以很容易地识别文件是 DOS 格式还是 Unix 格式,如下图所示: + +``` +# od -bc windows.txt +0000000 125 156 151 170 040 151 163 040 141 040 146 162 145 145 040 157 +U n i x i s a f r e e o +0000020 160 145 156 163 157 165 162 143 145 040 157 160 145 162 141 164 +p e n s o u r c e o p e r a t +0000040 151 156 147 040 163 171 163 164 145 155 015 012 123 165 160 145 +i n g s y s t e m \r \n S u p e +0000060 162 040 143 157 155 160 165 164 145 162 163 040 141 162 145 040 +r c o m p u t e r s a r e +0000100 162 165 156 156 151 156 147 040 157 156 040 125 116 111 130 015 +r u n n i n g o n U N I X \r +0000120 012 071 065 045 040 157 146 040 167 145 142 163 151 164 145 163 +\n 9 5 % o f w e b s i t e s +0000140 040 141 162 145 040 162 165 156 156 151 156 147 040 157 156 040 +a r e r u n n i n g o n +0000160 114 151 156 165 170 040 117 123 015 012 101 156 171 164 150 151 +L i n u x O S \r \n A n y t h i +0000200 156 147 040 143 141 156 040 142 145 040 144 157 156 145 040 157 +n g c a n b e d o n e o +0000220 156 040 114 151 156 165 170 015 012 +n L i n u x \r \n +0000231 +``` + +上面的输出清楚地表明这是一个 DOS 格式的文件,因为它包含了转义序列 `\r\n`。 + +同时,当你在终端上打印文件输出时,你会得到下面的输出: + +``` +# cat windows.txt +Unix is a free opensource operating system +Super computers are running on UNIX +95% of websites are running on Linux OS +Anything can be done on Linux +``` + +### 如何在 Linux 上安装 dos2unix? + +`dos2unix` 可以很容易地从发行版的官方仓库中安装。 + +对于 RHEL/CentOS 6/7 系统,使用 [yum 命令][2] 安装 `dos2unix`。 + +``` +$ sudo yum install -y dos2unix +``` + +对于 RHEL/CentOS 8 和 Fedora 系统,使用 [dnf 命令][3] 安装 `dos2unix`。 + +``` +$ sudo yum install -y dos2unix +``` + +对于基于 Debian 的系统,使用 [apt 命令][4] 或 [apt-get 命令][5] 来安装 `dos2unix`。 + +``` +$ sudo apt-get update +$ sudo apt-get install dos2unix +``` + +对于 openSUSE 系统,使用 [zypper命令][6] 安装 `dos2unix`。 + +``` +$ sudo zypper install -y dos2unix +``` + +### 1)如何将 DOS 文件转换为 UNIX 格式? + +以下命令将 `windows.txt` 文件从 DOS 转换为 Unix 格式。 + +对该文件的修改是删除文件每行的 `\r`。 + +``` +# dos2unix windows.txt +dos2unix: converting file windows.txt to Unix format … +``` + +``` +# cat windows.txt +0000000 125 156 151 170 040 151 163 040 141 040 146 162 145 145 040 157 +U n i x i s a f r e e o +0000020 160 145 156 163 157 165 162 143 145 040 157 160 145 162 141 164 +p e n s o u r c e o p e r a t +0000040 151 156 147 040 163 171 163 164 145 155 012 123 165 160 145 162 +i n g s y s t e m \n S u p e r +0000060 040 143 157 155 160 165 164 145 162 163 040 141 162 145 040 162 +c o m p u t e r s a r e r +0000100 165 156 156 151 156 147 040 157 156 040 125 116 111 130 012 071 +u n n i n g o n U N I X \n 9 +0000120 065 045 040 157 146 040 167 145 142 163 151 164 145 163 040 141 +5 % o f w e b s i t e s a +0000140 162 145 040 162 165 156 156 151 156 147 040 157 156 040 114 151 +r e r u n n i n g o n L i +0000160 156 165 170 040 117 123 012 101 156 171 164 150 151 156 147 040 +n u x O S \n A n y t h i n g +0000200 143 141 156 040 142 145 040 144 157 156 145 040 157 156 040 114 +c a n b e d o n e o n L +0000220 151 156 165 170 012 +i n u x \n +0000225 +``` + +上面的命令将覆盖原始文件。 + +如果你想保留原始文件,请使用以下命令。这将把转换后的输出保存为一个新文件。 + +``` +# dos2unix -n windows.txt unix.txt +dos2unix: converting file windows.txt to file unix.txt in Unix format … +``` + +#### 1a)如何使用 tr 命令将 DOS 文件转换为 UNIX 格式。 + +正如文章开头所讨论的,你可以如下所示使用 `tr` 命令将 DOS 文件转换为 Unix 格式。 + +``` +Syntax: tr -d '\r' < source_file > output_file +``` + +下面的 `tr` 命令将 DOS 格式的文件 `windows.txt` 转换为 Unix 格式文件 `unix.txt`。 + +``` +# tr -d '\r' < windows.txt >unix.txt +``` + +注意:不能使用 `tr` 命令将文件从 Unix 格式转换为 Windows(DOS)。 + +#### 1b)如何使用 awk 命令将 DOS 文件转换为 UNIX 格式。 + +使用以下 `awk` 命令格式将 DOS 文件转换为 Unix 格式。 + +``` +Syntax: awk '{ sub("\r$", ""); print }' source_file.txt > output_file.txt +``` + +以下 `awk` 命令将 DOS 文件 `windows.txt` 转换为 Unix 格式文件 `unix.txt`。 + +``` +# awk '{ sub("\r$", ""); print }' windows.txt > unix.txt +``` + +### 2)如何将 UNIX 文件转换为 DOS 格式? + +当你把一个文件从 UNIX 转换为 DOS 格式时,它会在每一行中添加一个回车(`CR` 或 `\r`)。 + +``` +# unix2dos unix.txt +unix2dos: converting file unix.txt to DOS format … +``` + +该命令将保留原始文件。 + +``` +# unix2dos -n unix.txt windows.txt +unix2dos: converting file unix.txt to file windows.txt in DOS format … +``` + +#### 2a)如何使用 awk 命令将 UNIX 文件转换为 DOS 格式? + +使用以下 `awk` 命令格式将 UNIX 文件转换为 DOS 格式。 + +``` +Syntax: awk 'sub("$", "\r")' source_file.txt > output_file.txt +``` + +下面的 `awk` 命令将 `unix.txt` 文件转换为 DOS 格式文件 `windows.txt`。 + +``` +# awk 'sub("$", "\r")' unix.txt > windows.txt +``` + +-------------------------------------------------------------------------------- + +via: https://www.2daygeek.com/how-to-convert-text-files-between-unix-and-dos-windows-formats/ + +作者:[Magesh Maruthamuthu][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://www.2daygeek.com/author/magesh/ +[b]: https://github.com/lujun9972 +[1]: https://www.2daygeek.com/linux-sed-to-find-and-replace-string-in-files/ +[2]: https://www.2daygeek.com/linux-yum-command-examples-manage-packages-rhel-centos-systems/ +[3]: https://www.2daygeek.com/linux-dnf-command-examples-manage-packages-fedora-centos-rhel-systems/ +[4]: https://www.2daygeek.com/apt-command-examples-manage-packages-debian-ubuntu-systems/ +[5]: https://www.2daygeek.com/apt-get-apt-cache-command-examples-manage-packages-debian-ubuntu-systems/ +[6]: https://www.2daygeek.com/zypper-command-examples-manage-packages-opensuse-system/ diff --git a/published/202008/20200821 Being open to open values.md b/published/202008/20200821 Being open to open values.md new file mode 100644 index 0000000000..9de553292a --- /dev/null +++ b/published/202008/20200821 Being open to open values.md @@ -0,0 +1,58 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12561-1.html) +[#]: subject: (Being open to open values) +[#]: via: (https://opensource.com/open-organization/20/8/being-open-to-open-values) +[#]: author: (Heidi Hess von Ludewig https://opensource.com/users/heidi-hess-von-ludewig) + +对开放的价值观持开放态度 +====== + +> 开放管理可能会让人感到恐惧。一位经理人解释了为什么值得冒这个风险。 + +![Open Lego CAD][1] + +在本期的“[用开放的价值观管理][2]”系列中,我和美国一家全国性保险公司的定价总监、人事经理 Braxton 聊了聊。 + +2018 年 6 月,Braxton 联系到了开放组织社区的红帽人员。他想了解更多关于他*和*他的团队如何使用开放的价值观,以不同的方式工作。我们很乐意提供帮助。于是我帮助 Braxton 和他的团队组织了一个关于[开放组织原则][3]的研讨会,并在之后还保持着联系,这样我就可以了解他在变得更加开放的过程中的风险。 + +最近我们采访了 Braxton,并和他一起坐下来听了事情的进展。[产业/组织心理学家和员工参与度专家][4] Tracy Guiliani 和 [Bryan Behrenshausen][5] 一起加入了采访。我们的谈话范围很广,探讨了了解开源价值观后的感受,如何利用它们来改变组织,以及它们如何帮助 Braxton 和他的团队更好地工作和提高参与度。 + +与 Braxton 合作是一次异常有意义的经历。它让我们直接见证了一个人如何将开放组织社区驱动的研讨会材料融入动态变化,并使他、他的团队和他的组织受益。开放组织大使*一直*在寻求帮助人们获得关于开放价值的见解和知识,使他们能够理解文化变革和[自己组织内的转型][6]。 + +他和他的团队正在以对他们有效的方式执行他们独特的开放价值观,并且让团队实现的利益超过了提议变革在时间和精力上的投入。 + +Braxton 对开放组织原则的*解释*和使组织更加开放的策略,让我们深受启发。 + +Braxton 承认,他的更开放的目标并不包括“制造另一个红帽”。相反,他和他的团队是在以对他们有效的方式,以及让团队实现的利益超过提议的变革所带来的时间和精力投入,来执行他们独特的开放价值观。 + +在我们采访的第一部分,你还会听到 Braxton 描述: + + 1. 在了解了透明性、协作性、适应性、社区性和包容性这五种开放式组织价值观之后,“开放式管理”对他意味着什么? + 2. 他的一些开放式管理做法。 + 3. 他如何在他的团队中倡导开放文化,如何在后来者中鼓励开源价值观,以及他所体验到的好处。 + 4. 当人们试图改造自己的组织时,对开源价值观最大的误解是什么? + +- [收听对 Braxton 的采访](https://opensource.com/sites/default/files/images/open-org/braxton_1.ogg) + +-------------------------------------------------------------------------------- + +via: https://opensource.com/open-organization/20/8/being-open-to-open-values + +作者:[Heidi Hess von Ludewig][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/heidi-hess-von-ludewig +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/open-lego.tiff_.png?itok=mQglOhW_ (Open Lego CAD) +[2]: https://opensource.com/open-organization/managing-with-open-values +[3]: https://github.com/open-organization/open-org-definition +[4]: https://opensource.com/open-organization/20/5/commitment-engagement-org-psychology +[5]: https://opensource.com/users/bbehrens +[6]: https://opensource.com/open-organization/18/4/rethinking-ownership-across-organization diff --git a/published/202008/20200825 11 ways to list and sort files on Linux.md b/published/202008/20200825 11 ways to list and sort files on Linux.md new file mode 100644 index 0000000000..135df819e9 --- /dev/null +++ b/published/202008/20200825 11 ways to list and sort files on Linux.md @@ -0,0 +1,212 @@ +[#]: collector: (lujun9972) +[#]: translator: (wxy) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12560-1.html) +[#]: subject: (11 ways to list and sort files on Linux) +[#]: via: (https://www.networkworld.com/article/3572590/11-ways-to-list-and-sort-files-on-linux.html) +[#]: author: (Sandra Henry-Stocker https://www.networkworld.com/author/Sandra-Henry_Stocker/) + +把 Linux 上的文件列表和排序玩出花来 +====== + +![](https://img.linux.net.cn/data/attachment/album/202008/28/213742y8cxnbnjpopzd5j0.jpg) + +> Linux 命令可以提供文件的详细信息,也可以自定义显示的文件列表,甚至可以深入到文件系统的目录中,只要你愿意看。 + +在 Linux 系统上,有许多方法可以列出文件并显示它们的信息。这篇文章回顾了一些提供文件细节的命令,并提供了自定义文件列表的选项,以满足你的需求。 + +大多数命令都会列出单个目录中的文件,而其他命令则可以深入到文件系统的目录中,只要你愿意看。 + +当然,最主要的文件列表命令是 `ls`。然而,这个命令有大量的选项,可以只查找和列出你想看的文件。另外,还有 `find` 可以帮助你进行非常具体的文件搜索。 + +### 按名称列出文件 + +最简单的方法是使用 `ls` 命令按名称列出文件。毕竟,按名称(字母数字顺序)列出文件是默认的。你可以选择 `ls`(无细节)或 `ls -l`(大量细节)来决定你看到什么。 + +``` +$ ls | head -6 +8pgs.pdf +Aesthetics_Thank_You.pdf +alien.pdf +Annual_Meeting_Agenda-20190602.pdf +bigfile.bz2 +bin +$ ls -l | head -6 +-rw-rw-r-- 1 shs shs 10886 Mar 22 2019 8pgs.pdf +-rw-rw-r-- 1 shs shs 284003 May 11 2019 Aesthetics_Thank_You.pdf +-rw-rw-r-- 1 shs shs 38282 Jan 24 2019 alien.pdf +-rw-rw-r-- 1 shs shs 97358 May 19 2019 Annual_Meeting_20190602.pdf +-rw-rw-r-- 1 shs shs 18115234 Apr 16 17:36 bigfile.bz2 +drwxrwxr-x 4 shs shs 8052736 Jul 10 13:17 bin +``` + +如果你想一次查看一屏的列表,可以将 `ls` 的输出用管道送到 `more` 命令中。 + +### 按相反的名字顺序排列文件 + +要按名称反转文件列表,请添加 `-r`(反转Reverse)选项。这就像把正常的列表倒过来一样。 + +``` +$ ls -r +$ ls -lr +``` + +### 按文件扩展名列出文件 + +`ls` 命令不会按内容分析文件类型,它只会处理文件名。不过,有一个命令选项可以按扩展名列出文件。如果你添加了 `-X` (扩展名eXtension)选项,`ls` 将在每个扩展名类别中按名称对文件进行排序。例如,它将首先列出没有扩展名的文件(按字母数字顺序),然后是扩展名为 `.1`、`.bz2`、`.c` 等的文件。 + +### 只列出目录 + +默认情况下,`ls` 命令将同时显示文件和目录。如果你想只列出目录,你可以使用 `-d`(目录Directory)选项。你会得到一个像这样的列表: + +``` +$ ls -d */ +1/ backups/ modules/ projects/ templates/ +2/ html/ patches/ public/ videos/ +bin/ new/ private/ save/ +``` + +### 按大小排列文件 + +如果你想按大小顺序列出文件,请添加 `-S`(大小Size)选项。但请注意,这实际上不会显示文件的大小(以及其他文件的细节),除非你还添加 `-l`(长列表Long listing)选项。当按大小列出文件时,一般来说,看到命令在按你的要求做事情是很有帮助的。注意,默认情况下是先显示最大的文件。添加 `-r` 选项可以反过来(即 `ls -lSr`)。 + +``` +$ ls -lS +total 959492 +-rw-rw-r-- 1 shs shs 357679381 Sep 19 2019 sav-linux-free-9.tgz +-rw-rw-r-- 1 shs shs 103270400 Apr 16 17:38 bigfile +-rw-rw-r-- 1 shs shs 79117862 Oct 5 2019 Nessus-8.7.1-ubuntu1110_amd64.deb +``` + +### 按属主列出文件 + +如果你想按属主列出文件(例如,在一个共享目录中),你可以把 `ls` 命令的输出传给 `sort`,并通过添加 `-k3` 来按第三个字段排序,从而挑出属主一栏。 + +``` +$ ls -l | sort -k3 | more +total 56 +-rw-rw-r-- 1 dory shs 0 Aug 23 12:27 tasklist +drwx------ 2 gdm gdm 4096 Aug 21 17:12 tracker-extract-files.121 +srwxr-xr-x 1 root root 0 Aug 21 17:12 ntf_listenerc0c6b8b4567 +drwxr-xr-x 2 root root 4096 Aug 21 17:12 hsperfdata_root + ^ + | +``` + +事实上,你可以用这种方式对任何字段进行排序(例如,年份)。只是要注意,如果你要对一个数字字段进行排序,则要加上一个 `n`,如 `-k5n`,否则你将按字母数字顺序进行排序。这种排序技术对于文件内容的排序也很有用,而不仅仅是用于列出文件。 + +### 按年份排列文件 + +使用 `-t`(修改时间Time modified)选项按年份顺序列出文件 —— 它们的新旧程度。添加 `-r` 选项,让最近更新的文件在列表中最后显示。我使用这个别名来显示我最近更新的文件列表。 + +``` +$ alias recent='ls -ltr | tail -8' +``` + +请注意,文件的更改时间和修改时间是不同的。`-c`(更改时间time Changed)和 `-t`(修改时间)选项的结果并不总是相同。如果你改变了一个文件的权限,而没有改变其他内容,`-c` 会把这个文件放在 `ls` 输出的顶部,而 `-t` 则不会。如果你想知道其中的区别,可以看看 `stat` 命令的输出。 + +``` +$ stat ckacct + File: ckacct + Size: 200 Blocks: 8 IO Block: 4096 regular file +Device: 801h/2049d Inode: 829041 Links: 1 +Access: (0750/-rwxr-x---) Uid: ( 1000/ shs) Gid: ( 1000/ shs) +Access: 2020-08-20 16:10:11.063015008 -0400 +Modify: 2020-08-17 07:26:34.579922297 -0400 <== content changes +Change: 2020-08-24 09:36:51.699775940 -0400 <== content or permissions changes + Birth: - +``` + +### 按组别列出文件 + +要按关联的组别对文件进行排序,你可以将一个长列表的输出传给 `sort` 命令,并告诉它在第 4 列进行排序。 + +``` +$ ls -l | sort -k4 +``` + +### 按访问日期列出文件 + +要按访问日期(最近访问的日期在前)列出文件,使用 `-ltu` 选项。`u` 强制“按访问日期”排列顺序。 + +``` +$ ls -ltu +total 959500 +-rwxr-x--- 1 shs shs 200 Aug 24 09:42 ckacct <== most recently used +-rw-rw-r-- 1 shs shs 1335 Aug 23 17:45 lte +``` + +### 单行列出多个文件 + +有时,精简的文件列表更适合手头的任务。`ls` 命令甚至有这方面的选项。为了在尽可能少的行上列出文件,你可以使用 `--format=comma` 来用逗号分隔文件名,就像这个命令一样: + +``` +$ ls --format=comma +1, 10, 11, 12, 124, 13, 14, 15, 16pgs-landscape.pdf, 16pgs.pdf, 17, 18, 19, +192.168.0.4, 2, 20, 2018-12-23_OoS_2.pdf, 2018-12-23_OoS.pdf, 20190512_OoS.pdf, +'2019_HOHO_application working.pdf' … +``` + +喜欢用空格?使用 `--format=across` 代替。 + +``` +$ ls --format=across z* +z zip zipfiles zipfiles1.bat zipfiles2.bat +zipfiles3.bat zipfiles4.bat zipfiles.bat zoom_amd64.deb zoomap.pdf +zoom-mtg +``` + +### 增加搜索的深度 + +虽然 `ls` 一般只列出单个目录中的文件,但你可以选择使用 `-R` 选项(递归Recursively)地列出文件,深入到整个目录的深处。 + +``` +$ ls -R zzzzz | grep -v "^$" +zzzzz: +zzzz +zzzzz/zzzz: +zzz +zzzzz/zzzz/zzz: +zz +zzzzz/zzzz/zzz/zz: +z +zzzzz/zzzz/zzz/zz/z: +sleeping +``` + +另外,你也可以使用 `find` 命令,对深度进行限制或不限制。在这个命令中,我们指示 `find` 命令只在三个层次的目录中查找: + +``` +$ find zzzzz -maxdepth 3 +zzzzz +zzzzz/zzzz +zzzzz/zzzz/zzz +zzzzz/zzzz/zzz/zz +``` + +### 选择 ls 还是 find + +当你需要列出符合具体要求的文件时,`find` 命令可能是比 `ls` 更好的工具。 + +与 `ls` 不同的是,`find` 命令会尽可能地深入查找,除非你限制它。它还有许多其他选项和一个 `-exec` 子命令,允许在找到你要找的文件后采取一些特定的行动。 + +### 总结 + +`ls` 命令有很多用于列出文件的选项。了解一下它们。你可能会发现一些你会喜欢的选项。 + +-------------------------------------------------------------------------------- + +via: https://www.networkworld.com/article/3572590/11-ways-to-list-and-sort-files-on-linux.html + +作者:[Sandra Henry-Stocker][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.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 diff --git a/published/202008/20200825 OnionShare- An Open-Source Tool to Share Files Securely Over Tor Network.md b/published/202008/20200825 OnionShare- An Open-Source Tool to Share Files Securely Over Tor Network.md new file mode 100644 index 0000000000..523072c7ee --- /dev/null +++ b/published/202008/20200825 OnionShare- An Open-Source Tool to Share Files Securely Over Tor Network.md @@ -0,0 +1,161 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12564-1.html) +[#]: subject: (OnionShare: An Open-Source Tool to Share Files Securely Over Tor Network) +[#]: via: (https://itsfoss.com/onionshare/) +[#]: author: (Ankush Das https://itsfoss.com/author/ankush/) + +OnionShare:一个安全共享文件的开源工具 +====== + +> OnionShare 是一个自由开源工具,它利用 Tor 网络安全和匿名地共享文件。 + +![](https://img.linux.net.cn/data/attachment/album/202008/30/103623ty2r6sz03y32o99o.jpg) + +已经有很多在线服务可以安全地共享文件,但它可能不是完全匿名的。 + +此外,你必须依靠一个集中式服务来共享文件,如果服务决定像 [Firefox Send][1] 那样关闭,那你不能真正依靠它来一直安全地共享文件。 + +考虑到这些,OnionShare 是一个让人惊叹的开源工具,它让你使用 [Tor Onion 服务][2]来共享文件。它应该是所有云端文件共享服务的一个很好的替代品。 + +让我们来看看它提供了什么以及它是如何工作的。 + +![][3] + +### OnionShare: 通过 Tor 匿名分享文件 + +[OnionShare][4] 是一款有趣的开源工具,可用于 Linux、Windows 和 macOS。 + +它可以让你安全地将文件直接从你的电脑分享给接收者,而不会在这个过程中暴露你的身份。你不必注册任何帐户,它也不依赖于任何集中式存储服务。 + +它基本上是在 Tor 网络上的点对点服务。接收者只需要有一个 [Tor 浏览器][5]就可以下载/上传文件到你的电脑上。如果你好奇的话,我也建议你去看看我们的 [Tor 指南][6]来探索更多关于它的内容。 + +让我们来看看它的功能。 + +### OnionShare 的功能 + +对于一个只想要安全和匿名的普通用户来说,它不需要调整。不过,如果你有需要,它也有一些高级选项。 + +* 跨平台支持(Windows、macOS和 Linux)。 +* 发送文件 +* 接收文件 +* 命令行选项 +* 发布洋葱站点 +* 能够使用桥接(如果你的 Tor 连接不起作用) +* 能够使用持久 URL 进行共享(高级用户)。 +* 隐身模式(更安全) + +你可以通过 GitHub 上的[官方用户指南][7]来了解更多关于它们的信息。 + +### 在 Linux 上安装 OnionShare + +你应该可以在你的软件中心找到 OnionShare 并安装它。如果没有,你可以在 Ubuntu 发行版上使用下面的命令添加 PPA: + +``` +sudo add-apt-repository ppa:micahflee/ppa +sudo apt update +sudo apt install -y onionshare +``` + +如果你想把它安装在其他 Linux 发行版上,你可以访问[官方网站][4]获取 Fedora 上的安装说明以及构建说明。 + +- [下载 OnionShare][4] + +### OnionShare 如何工作? + +当你安装好后,一切都很明了且易于使用。但是,如果你想开始,让我告诉你它是如何工作的。 + +完成后,它加载并连接到 Tor 网络。 + +#### 共享文件 + +![][8] + +你只需要在电脑上添加你要分享的文件,然后点击 “**Start sharing**”。 + +完成后,右下角的状态应该是 “**Sharing**”,然后会生成一个 **OnionShare 地址**(自动复制到剪贴板),如下图所示。 + +![][9] + +现在接收方需要的是 OnionShare 的地址,它看上去是这样的。 + +``` +http://onionshare:xyz@jumbo2127k6nekzqpff2p2zcxcsrygbnxbitsgnjcfa6v47wvyd.onion +``` + +接着 Tor 浏览器开始下载文件。 + +值得注意的是,下载完成后(文件传输完成),文件共享就会停止。到时候也会通知你。 + +所以,如果你要再次分享或与他人分享,你必须重新分享,并将新的 OnionShare 地址发送给接收者。 + +#### 允许接收文件 + +如果你想生成一个 URL,让别人直接上传文件到你的电脑上(要注意你与谁分享),你可以在启动 OnionShare 后点击 **Receive Files** 标签即可。 + +![][10] + +你只需要点击 “**Start Receive Mode**” 按钮就可以开始了。接下来,你会得到一个 OnionShare 地址(就像共享文件时一样)。 + +接收者必须使用 Tor 浏览器访问它并开始上传文件。它应该像下面这样: + +![][11] + +虽然当有人上传文件到你的电脑上时,你会收到文件传输的通知,但完成后,你需要手动停止接收模式。 + +#### 下载/上传文件 + +考虑到你已经安装了 Tor 浏览器,你只需要在 URL 地址中输入 OnionShare 的地址,确认登录(按 OK 键),它看上去像这样。 + +![][12] + +同样,当你得到一个上传文件的地址时,它看上去是这样的。 + +![][13] + +#### 发布洋葱站点 + +如果你想的话,你可以直接添加文件来托管一个静态的洋葱网站。当然,正因为是点对点的连接,所以在它从你的电脑上传输每个文件时,加载速度会非常慢。 + +![][14] + +我试着用[免费模板][15]测试了一下,效果很好(但很慢)。所以,这可能取决于你的网络连接。 + +### 总结 + +除了上面提到的功能,如果需要的话,你还可以使用命令行进行一些高级的调整。 + +OnionShare 的确是一款令人印象深刻的开源工具,它可以让你轻松地匿名分享文件,而不需要任何特殊的调整。 + +你尝试过 OnionShare 吗?你知道有类似的软件么?请在下面的评论中告诉我! + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/onionshare/ + +作者:[Ankush Das][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://itsfoss.com/author/ankush/ +[b]: https://github.com/lujun9972 +[1]: https://itsfoss.com/firefox-send/ +[2]: https://community.torproject.org/onion-services/ +[3]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/08/onionshare-screenshot.jpg?resize=800%2C629&ssl=1 +[4]: https://onionshare.org/ +[5]: https://itsfoss.com/install-tar-browser-linux/ +[6]: https://itsfoss.com/tor-guide/ +[7]: https://github.com/micahflee/onionshare/wiki +[8]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/08/onionshare-share.png?resize=800%2C604&ssl=1 +[9]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/08/onionshare-file-shared.jpg?resize=800%2C532&ssl=1 +[10]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/08/onionshare-receive-files.jpg?resize=800%2C655&ssl=1 +[11]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/08/onionshare-receive-mode.jpg?resize=800%2C529&ssl=1 +[12]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/08/onionshare-download.jpg?resize=800%2C499&ssl=1 +[13]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/08/onionshare-upload.jpg?resize=800%2C542&ssl=1 +[14]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/08/onionshare-onion-site.jpg?resize=800%2C366&ssl=1 +[15]: https://www.styleshout.com/free-templates/kards/ diff --git a/published/202008/20200826 Glances - A Versatile System Monitoring Tool for Linux Systems.md b/published/202008/20200826 Glances - A Versatile System Monitoring Tool for Linux Systems.md new file mode 100644 index 0000000000..e223385591 --- /dev/null +++ b/published/202008/20200826 Glances - A Versatile System Monitoring Tool for Linux Systems.md @@ -0,0 +1,228 @@ +[#]: collector: (lujun9972) +[#]: translator: (wxy) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12567-1.html) +[#]: subject: (Glances – A Versatile System Monitoring Tool for Linux Systems) +[#]: via: (https://itsfoss.com/glances/) +[#]: author: (Chinmay https://itsfoss.com/author/chinmay/) + +Glances:多功能 Linux 系统监控工具 +====== + +![](https://img.linux.net.cn/data/attachment/album/202008/30/212820tgdi7iou6dg6qqq2.jpg) + +Linux 上最常用的[命令行进程监控工具][1]是 `top` 和它那色彩斑斓、功能丰富的表弟 [htop][2]。 + +要[监控 Linux 上的温度][3],可以使用 [lm-sensors][4]。同样,还有很多实用工具可以监控其他实时指标,如磁盘 I/O、网络统计等。 + +[Glances][5] 是一个系统监控工具,它把这些都联系在一起,并提供了更多的功能。我最喜欢的是,你可以在远程 Linux 服务器上运行 Glances 来监控本地系统的系统资源,也可以通过 Web 浏览器监控。 + +下面是它的外观。下面截图中的终端已经[用 Pywal 工具美化过,可以根据壁纸自动改变颜色][6]。 + +![][7] + +你也可以将它集成到像 [Grafana][8] 这样的工具中,在一个直观的仪表盘中监控统计数据。 + +它是用 Python 编写的,这意味着它的绝大多数功能都可以在大多数平台上使用。 + +### Glances 的功能 + +![Glances Data In Grafana Dashboard][9] + +让我们快速浏览一下 Glances 提供的主要功能: + + * 可以监控系统上的 15 个之多的指标(包括 Docker 容器)。 + * 灵活的使用模式:单机模式、客户端-服务器模式、通过 SSH 和 Web 模式。 + * 可用于集成的各种 REST API 和 XML-RPC API。 + * 支持将数据轻松导出到不同的服务和数据库。 + * 高度的可配置性和适应不同的需求。 + * 非常全面的文档。 + +### 在 Ubuntu 和其他 Linux 发行版上安装 Glances + +Glances 在许多 Linux 发行版的官方软件库中都有。这意味着你可以使用你的发行版的软件包管理器来轻松安装它。 + +在基于 Debian/Ubuntu 的发行版上,你可以使用以下命令: + +``` +sudo apt install glances +``` + +你也可以使用 snap 包安装最新的 Glances: + +``` +sudo snap install glances +``` + +由于 Glances 是基于 Python 的,你也可以使用 PIP 在大多数 Linux 发行版上安装它。先[安装 PIP][10],然后用它来安装 Glances: + +``` +sudo pip3 install glances +``` + +如果没有别的办法,你还可以使用 Glances 开发者提供的自动安装脚本。虽然我们不建议直接在你的系统上随便运行脚本,但这完全取决于你自己: + +``` +curl -L https://bit.ly/glances | /bin/bash +``` + +你可以从他们的[文档][11]中查看其他安装 Glances 的方法,甚至你还可以把它作为一个 Docker 容器来安装。 + +### 使用 Glances 监控本地系统上的 Linux 系统资源(独立模式) + +你可以通过在终端上运行这个命令,轻松启动 Glances 来监控你的本地机器: + +``` +glances +``` + +你可以立即观察到,它将很多不同的信息整合在一个屏幕上。我喜欢它在顶部显示电脑的公共和私人 IP: + +![][12] + +Glances 也是交互式的,这意味着你可以在它运行时使用命令与它互动。你可以按 `s` 将传感器显示在屏幕上;按 `k` 将 TCP 连接列表显示在屏幕上;按 `1` 将 CPU 统计扩展到显示单个线程。 + +你也可以使用方向键在进程列表中移动,并按不同的指标对表格进行排序。 + +你可以通过各种命令行选项来启动 Glances。此外,它还有很多交互式命令。你可以在他们的[丰富的文档][13]中找到完整的列表。 + +按 `Ctrl+C` 键退出 Glances。 + +### 使用 Glances 监控远程 Linux 系统(客户端-服务器模式) + +要监控远程计算机,你可以在客户端-服务器模式下使用 Glances。你需要在两个系统上都安装 Glances。 + +在远程 Linux 系统上,使用 `-s` 选项在服务器模式下启动 Glances: + +``` +glances -s +``` + +在客户端系统中,使用下面的命令在客户端模式下启动 Glances 并连接到服务器: + +``` +glances -c server_ip_address +``` + +你也可以通过 SSH 进入任何一台电脑,然后启动 Glances,它可以完美地工作。更多关于客户端-服务器模式的信息请看[这里][14]。 + +### 使用 Glances 在 Web 浏览器中监控 Linux 系统资源(Web 模式) + +Glances 也可以在 Web 模式下运行。这意味着你可以使用 Web 浏览器来访问 Glances。与之前的客户端-服务器模式不同,你不需要在客户端系统上安装 Glances。 + +要在 Web 模式下启动 Glances,请使用 `-w` 选项: + +``` +glances -w +``` + +请注意,即使在 Linux 服务器上,它也可能显示 “Glances Web User Interface started on http://0.0.0.0:61208”,而实际上它使用的是服务器的 IP 地址。 + +最主要的是它使用的是 61208 端口号,你可以用它来通过网络浏览器访问 Glances。只要在服务器的 IP 地址后面输入端口号,比如 。 + +你也可以在本地系统中使用 访问。 + +![][15] + +Web 模式也模仿终端的样子。网页版是根据响应式设计原则打造的,即使在手机上也很好看。 + +你可能想用密码来保护 Web 模式,这样只有授权的人才能使用它。默认的用户名是 `glances`。 + +``` +root@localhost:~# glances -w --password +Define the Glances webserver password (glances username): +Password (confirm): +Do you want to save the password? [Yes/No]: n +Glances Web User Interface started on http://0.0.0.0:61208/ +``` + +你可以在[快速入门指南][16]中找到关于配置密码的更多信息。 + +### 导出 Glances 数据到不同的服务 + +使用 Glances 最大的优势之一就是开箱即用,它支持将数据导出到各种数据库、服务,并无缝集成到各种数据管道中。 + +你可以在监控的同时用这个命令导出到 CSV: + +``` +glances --export csv --export-csv-file /tmp/glances.csv +``` + +`/tmp/glances.csv` 是文件的位置。数据以时间序列的形式整齐地填入。 + +![][17] + +你也可以导出到其它大型应用程序,如 [Prometheus][18],以启用条件触发器和通知。 + +它可以直接插入到消息服务(如 RabbitMQ、MQTT)、流媒体平台(如 Kafka),并将时间序列数据导出到数据库(如 InfluxDB),并使用 Grafana 进行可视化。 + +你可以在[这里][19]查看服务和导出选项的整个列表。 + +### 使用 REST API 将 Glances 与其他服务进行整合 + +这是整个栈中我最喜欢的功能。Glances 不仅可以将各种指标汇集在一起,还可以通过 API 将它们暴露出来。 + +这个简单而强大的功能使得为任何特定的用例构建自定义应用程序、服务和中间件应用程序变得非常容易。 + +当你在 Web 模式下启动 Glances 时,REST API 服务器会自动启动。要在 API 服务器模式下启动它,你可以使用以下命令: + +``` +glances -w --disable-webui +``` + +[REST API][20] 的文档很全面,其响应也很容易与 Web 应用集成。这使得使用类似 [Node-RED][21] 这样的工具可以很容易地构建一个统一的仪表盘来监控多个服务器。 + +![][22] + +Glances 也提供了一个 XML-RPC 服务器,你可以在[这里][23]查看文档。 + +### 关于 Glances 的结束语 + +Glances 使用 [psutil][24] Python 库来访问不同的系统统计数据。早在 2017 年,我就曾使用相同的库构建了一个简单的 API 服务器来检索 CPU 的使用情况。我能够使用 Node-RED 构建的仪表盘监控一个集群中的所有树莓派。 + +Glances 可以为我节省一些时间,同时提供更多的功能,可惜我当时并不知道它。 + +在写这篇文章的时候,我确实尝试着在我的树莓派上安装 Glances,可惜所有的安装方法都出现了一些错误,失败了。当我成功后,我会更新文章,或者可能再写一篇文章,介绍在树莓派上安装的步骤。 + +我希望 Glances 能提供一种顶替 `top` 或 `htop` 等的方法。让我们希望在即将到来的版本中得到它。 + +我希望这能给你提供大量关于 Glances 的信息。你们使用什么系统监控工具呢,请在评论中告诉我。 + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/glances/ + +作者:[Chinmay][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://itsfoss.com/author/chinmay/ +[b]: https://github.com/lujun9972 +[1]: https://itsfoss.com/linux-system-monitoring-tools/ +[2]: https://hisham.hm/htop/ +[3]: https://itsfoss.com/monitor-cpu-gpu-temp-linux/ +[4]: https://github.com/lm-sensors/lm-sensors +[5]: https://nicolargo.github.io/glances/ +[6]: https://itsfoss.com/pywal/ +[7]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/08/glances-linux.png?resize=800%2C510&ssl=1 +[8]: https://grafana.com/ +[9]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/08/glances-data-in-grafana-dashboard.jpg?resize=800%2C472&ssl=1 +[10]: https://itsfoss.com/install-pip-ubuntu/ +[11]: https://github.com/nicolargo/glances/blob/master/README.rst#installation +[12]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/08/Screenshot-from-2020-08-13-11-54-18.png?resize=800%2C503&ssl=1 +[13]: https://glances.readthedocs.io/en/latest/cmds.html +[14]: https://glances.readthedocs.io/en/latest/quickstart.html#central-client +[15]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/08/Screenshot-from-2020-08-13-16-49-11.png?resize=800%2C471&ssl=1 +[16]: https://glances.readthedocs.io/en/stable/quickstart.html +[17]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/08/Screenshot-from-2020-08-13-12-25-40.png?resize=800%2C448&ssl=1 +[18]: https://prometheus.io/ +[19]: https://glances.readthedocs.io/en/latest/gw/index.html +[20]: https://github.com/nicolargo/glances/wiki/The-Glances-RESTFULL-JSON-API +[21]: https://nodered.org/ +[22]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/08/Screenshot-from-2020-08-13-17-49-41.png?resize=800%2C468&ssl=1 +[23]: https://github.com/nicolargo/glances/wiki +[24]: https://pypi.org/project/psutil/ diff --git a/published/202009/20190105 Why Sorting is O(N log N).md b/published/202009/20190105 Why Sorting is O(N log N).md new file mode 100644 index 0000000000..36aadec5bb --- /dev/null +++ b/published/202009/20190105 Why Sorting is O(N log N).md @@ -0,0 +1,115 @@ +[#]: collector: (lujun9972) +[#]: translator: (silentdawn-zz) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12594-1.html) +[#]: subject: (Why Sorting is O\(N log N\)) +[#]: via: (https://theartofmachinery.com/2019/01/05/sorting_is_nlogn.html) +[#]: author: (Simon Arneaud https://theartofmachinery.com) + +为什么排序的复杂度为 O(N log N) +====== + +基本上所有正而八经的算法教材都会解释像快速排序quicksort堆排序heapsort这样的排序算法有多快,但并不需要复杂的数学就能证明你可以逐渐趋近的速度有多快。 + +> 关于标记的一个严肃说明: +> +> 大多数计算机专业的科学家使用大写字母 O 标记来指代“趋近,直到到达一个常数比例因子”,这与数学专业所指代的意义是有所区别的。这里我使用的大 O 标记的含义与计算机教材所指相同,但至少不会和其他数学符号混用。 + +### 基于比较的排序 + +先来看个特例,即每次比较两个值大小的算法(快速排序、堆排序,及其它通用排序算法)。这种思想后续可以扩展至所有排序算法。 + +#### 一个简单的最差情况下的计数角度 + +假设有 4 个互不相等的数,且顺序随机,那么,可以通过只比较一对数字完成排序吗?显然不能,证明如下:根据定义,要对该数组排序,需要按照某种顺序重新排列数字。换句话说,你需要知道用哪种排列方式?有多少种可能的排列?第一个数字可以放在四个位置中的任意一个,第二个数字可以放在剩下三个位置中的任意一个,第三个数字可以放在剩下两个位置中的任意一个,最后一个数字只有剩下的一个位置可选。这样,共有 $4×3×2×1 = 4! = 24$ 种排列可供选择。通过一次比较大小,只能产生两种可能的结果。如果列出所有的排列,那么“从小到大”排序对应的可能是第 8 种排列,按“从大到小”排序对应的可能是第 24 种排列,但无法知道什么时候需要的是其它 22 种排列。 + +通过 2 次比较,可以得到 2×2=4 种可能的结果,这仍然不够。只要比较的次数少于 5(对应 $2^{5} = 32$ 种输出),就无法完成 4 个随机次序的数字的排序。如果 $W(N)$ 是最差情况下对 $N$ 个不同元素进行排序所需要的比较次数,那么, + +$$ +2^{W(N)} \geq N! +$$ + +两边取以 2 为底的对数,得: + +$$ +W(N) \geq \log_{2}{N!} +$$ + +$N!$ 的增长近似于 $N^{N}$ (参阅 [Stirling 公式][1]),那么, + +$$ +W(N) \succeq \log N^{N} = N\log N +$$ + +这就是最差情况下从输出计数的角度得出的 $O(N\log N)$ 上限。 + +#### 从信息论角度的平均状态的例子 + +使用一些信息论知识,就可以从上面的讨论中得到一个更有力的结论。下面,使用排序算法作为信息传输的编码器: + + 1. 任取一个数,比如 15 + 2. 从 4 个数字的排列列表中查找第 15 种排列 + 3. 对这种排列运行排序算法,记录所有的“大”、“小”比较结果 + 4. 用二进制编码发送比较结果 + 5. 接收端重新逐步执行发送端的排序算法,需要的话可以引用发送端的比较结果 + 6. 现在接收端就可以知道发送端如何重新排列数字以按照需要排序,接收端可以对排列进行逆算,得到 4 个数字的初始顺序 + 7. 接收端在排列表中检索发送端的原始排列,指出发送端发送的是 15 + +确实,这有点奇怪,但确实可以。这意味着排序算法遵循着与编码方案相同的定律,包括理论所证明的不存在通用的数据压缩算法。算法中每次比较发送 1 比特的比较结果编码数据,根据信息论,比较的次数至少是能表示所有数据的二进制位数。更技术语言点,[平均所需的最小比较次数是输入数据的香农熵,以比特为单位][2]。熵是衡量信息等不可预测量的数学度量。 + +包含 $N$ 个元素的数组,元素次序随机且无偏时的熵最大,其值为 $\log_{2}{N!}$ 个比特。这证明 $O(N\log N)$ 是一个基于比较的对任意输入排序的最优平均值。 + +以上都是理论说法,那么实际的排序算法如何做比较的呢?下面是一个数组排序所需比较次数均值的图。我比较的是理论值与快速排序及 [Ford-Johnson 合并插入排序][3] 的表现。后者设计目的就是最小化比较次数(整体上没比快速排序快多少,因为生活中相对于最大限度减少比较次数,还有更重要的事情)。又因为合并插入排序merge-insertion sort是在 1959 年提出的,它一直在调整,以减少了一些比较次数,但图示说明,它基本上达到了最优状态。 + +![随机排列 100 个元素所需的平均排序次数图。最下面的线是理论值,约 1% 处的是合并插入算法,原始 quicksort 大约在 25% 处。][4] + +一点点理论导出这么实用的结论,这感觉真棒! + +#### 小结 + +证明了: + + 1. 如果数组可以是任意顺序,在最坏情况下至少需要 $O(N\log N)$ 次比较。 + 2. 数组的平均比较次数最少是数组的熵,对随机输入而言,其值是 $O(N\log N)$ 。 + +注意,第 2 个结论允许基于比较的算法优于 $O(N\log N)$,前提是输入是低熵的(换言之,是部分可预测的)。如果输入包含很多有序的子序列,那么合并排序的性能接近 $O(N)$。如果在确定一个位之前,其输入是有序的,插入排序性能接近 $O(N)$。在最差情况下,以上算法的性能表现都不超出 $O(N\log N)$。 + +### 一般排序算法 + +基于比较的排序在实践中是个有趣的特例,但从理论上讲,计算机的 [CMP][5] 指令与其它指令相比,并没有什么特别之处。在下面两条的基础上,前面两种情形都可以扩展至任意排序算法: + + 1. 大多数计算机指令有多于两个的输出,但输出的数量仍然是有限的。 + 2. 一条指令有限的输出意味着一条指令只能处理有限的熵。 + +这给出了 $O(N\log N)$ 对应的指令下限。任何物理上可实现的计算机都只能在给定时间内执行有限数量的指令,所以算法的执行时间也有对应 $O(N\log N)$ 的下限。 + +#### 什么是更快的算法? + +一般意义上的 $O(N\log N)$ 下限,放在实践中来看,如果听人说到任何更快的算法,你要知道,它肯定以某种方式“作弊”了,其中肯定有圈套,即它不是一个可以处理任意大数组的通用排序算法。可能它是一个有用的算法,但最好看明白它字里行间隐含的东西。 + +一个广为人知的例子是基数排序radix sort算法,它经常被称为 $O(N)$ 排序算法,但它只能处理所有数字都能放入 $k$ 比特的情况,所以实际上它的性能是 $O({kN})$。 + +什么意思呢?假如你用的 8 位计算机,那么 8 个二进制位可以表示 $2^{8} = 256$ 个不同的数字,如果数组有上千个数字,那么其中必有重复。对有些应用而言这是可以的,但对有些应用就必须用 16 个二进制位来表示,16 个二进制位可以表示 $2^{16} = 65,536$ 个不同的数字。32 个二进制位可以表示 $2^{32} = 4,294,967,296$ 不同的数字。随着数组长度的增长,所需要的二进制位数也在增长。要表示 $N$ 个不同的数字,需要 $k \geq \log_{2}N$ 个二进制位。所以,只有允许数组中存在重复的数字时,$O({kN})$ 才优于 $O(N\log N)$。 + +一般意义上输入数据的 $O(N\log N)$ 的性能已经说明了全部问题。这个讨论不那么有趣因为很少需要在 32 位计算机上对几十亿整数进行排序,[如果有谁的需求超出了 64 位计算机的极限,他一定没有告诉别人][6]。 + +-------------------------------------------------------------------------------- + +via: https://theartofmachinery.com/2019/01/05/sorting_is_nlogn.html + +作者:[Simon Arneaud][a] +选题:[lujun9972][b] +译者:[silentdawn-zz](https://github.com/silentdawn-zz) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://theartofmachinery.com +[b]: https://github.com/lujun9972 +[1]: http://hyperphysics.phy-astr.gsu.edu/hbase/Math/stirling.html +[2]: https://en.wikipedia.org/wiki/Shannon%27s_source_coding_theorem +[3]: https://en.wikipedia.org/wiki/Merge-insertion_sort +[4]: https://theartofmachinery.com/images/sorting_is_nlogn/sorting_algorithms_num_comparisons.svg +[5]: https://c9x.me/x86/html/file_module_x86_id_35.html +[6]: https://sortbenchmark.org/ diff --git a/published/202009/20190226 Reducing security risks with centralized logging.md b/published/202009/20190226 Reducing security risks with centralized logging.md new file mode 100644 index 0000000000..030f7450ed --- /dev/null +++ b/published/202009/20190226 Reducing security risks with centralized logging.md @@ -0,0 +1,81 @@ +[#]: collector: (lujun9972) +[#]: translator: (leommxj) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12591-1.html) +[#]: subject: (Reducing security risks with centralized logging) +[#]: via: (https://opensource.com/article/19/2/reducing-security-risks-centralized-logging) +[#]: author: (Hannah Suarez https://opensource.com/users/hcs) + +通过集中日志记录来减少安全风险 +====== + +> 集中日志并结构化待处理的日志数据可缓解与缺少日志相关的风险 + +![](https://img.linux.net.cn/data/attachment/album/202009/07/231016a8v8gva9gmc5hgv9.jpg) + +日志记录和日志分析对于保护基础设施安全来说至关重要,尤其是当我们考虑到通用漏洞的时候。这篇文章基于我在 FOSDEM'19 上的闪电秀《[Let's use centralized log collection to make incident response teams happy][1]》,目的是提高大家对日志匮乏这种安全问题的重视,提供一种避免风险的方法,并且倡议更多的安全实践(利益声明: 我为 NXLog 工作)。 + +### 为什么要收集日志?为什么要集中日志记录? + +确切的说,日志是写入磁盘的仅追加的记录序列。在实际生活中,日志可以在你尝试寻找异常的根源时帮助你调查基础设施的问题。当你有多个使用自己的标准与格式的日志的异构系统,并且想用一种可靠的方法来接收和处理它们的时候,挑战就来临了。这通常以元数据为代价的。集中日志记录解决方案需要共性,这种共性常常会去除许多开源日志记录工具所提供的丰富的元数据。 + +### 日志记录与监控匮乏的安全风险 + +开源 Web 应用程序安全项目Open Web Application Security Project([OWASP][2])是一个为业界贡献了许多杰出项目(包括许多专注于软件安全的[工具][3])的非营利组织。OWASP 定期为应用开发人员和维护者报告最危险的安全挑战。在最新一版《[10 项最严重的 Web 应用程序安全风险][4]》中,OWASP 将日志记录和监控匮乏加入了列表中。OWASP 警告下列情况会导致日志记录、检测、监控和主动响应的匮乏: + + * 未记录重要的可审计性事件,如:登录、登录失败和高额交易。 + * 告警和错误事件未能产生、产生不足或不清晰的日志信息。 + * 日志信息仅在本地存储。 + * 对于实时或准实时的主动攻击,应用程序无法检测、处理和告警。 + +可以通过集中日志记录(例如,不仅将日志本地存储)和结构化日志数据以进一步分析来缓解上述情形(例如,在告警仪表盘和安全套件中)。 + +举例来说, 假设一个 DNS 查询会导向名为 hacked.badsite.net 的恶意网站。通过 DNS 监控,管理员监控并且主动的分析 DNS 请求与响应。DNS 监控的效果依赖于充足的日志记录与收集来发现潜在问题,同样也依赖于结构化 DNS 日志的结果来进一步分析。 + +``` +2019-01-29 +Time (GMT)      Source                  Destination             Protocol-Info +12:42:42.112898 SOURCE_IP               xxx.xx.xx.x             DNS     Standard query 0x1de7  A hacked.badsite.net +``` + +你可以在 [NXLog 社区版][5] 中自己尝试一下这个例子,也可以尝试其他例子和代码片段。 (再次声明:我为 NXLog 工作) + +### 重要的一点:非结构化数据与结构化数据 + +花费一点时间来考虑下日志数据格式是很重要的。例如,让我们来考虑以下日志消息: + +``` +debug1: Failed password for invalid user amy from SOURCE_IP port SOURCE_PORT ssh2 +``` + +这段日志包含了一个预定义的结构,例如冒号前面的元数据关键词(`debug1`)然而,余下的日志字段是一个未结构化的字符串(`Failed password for invalid user amy from SOURCE_IP port SOURCE_PORT ssh2`)。因此,即便这个消息是人类可轻松阅读的格式,但它不是一个计算机容易解析的格式。 + +非结构化的事件数据存在局限性,包括难以解析、搜索和分析日志。重要的元数据通常以一种自由字符串的形式作为非结构化数据字段,就像上面的例子一样。日志管理员会在他们尝试标准化/归一化日志数据与集中日志源的过程中遇到这个问题。 + +### 接下来怎么做 + +除了集中和结构化日志之外,确保你收集了正确的日志数据——Sysmon、PowerShell、Windows 事件日志、DNS 调试日志、ETW、内核监控、文件完整性监控、数据库日志、外部云日志等等。同样也要选用适当的工具和流程来来收集、汇总和帮助理解数据。 + +希望这对你从不同日志源中集中日志收集提供了一个起点:将日志发送到仪表盘、监控软件、分析软件以及像安全性资讯与事件管理(SIEM)套件等外部源。 + +你的集中日志策略会是怎么样?请在评论中分享你的想法。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/2/reducing-security-risks-centralized-logging + +作者:[Hannah Suarez][a] +选题:[lujun9972][b] +译者:[leommxj](https://github.com/leommxj) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/hcs +[b]: https://github.com/lujun9972 +[1]: https://fosdem.org/2019/schedule/event/lets_use_centralized_log_collection_to_make_incident_response_teams_happy/ +[2]: https://www.owasp.org/index.php/Main_Page +[3]: https://github.com/OWASP +[4]: https://www.owasp.org/index.php/Top_10-2017_Top_10 +[5]: https://nxlog.co/products/nxlog-community-edition/download diff --git a/published/202009/20190501 Monitor and Manage Docker Containers with Portainer.io (GUI tool) - Part-1.md b/published/202009/20190501 Monitor and Manage Docker Containers with Portainer.io (GUI tool) - Part-1.md new file mode 100644 index 0000000000..94bf12cab7 --- /dev/null +++ b/published/202009/20190501 Monitor and Manage Docker Containers with Portainer.io (GUI tool) - Part-1.md @@ -0,0 +1,239 @@ +[#]: collector: "lujun9972" +[#]: translator: "jlztan" +[#]: reviewer: "wxy" +[#]: publisher: "wxy" +[#]: url: "https://linux.cn/article-12634-1.html" +[#]: subject: "Monitor and Manage Docker Containers with Portainer.io (GUI tool) – Part-1" +[#]: via: "https://www.linuxtechi.com/monitor-manage-docker-containers-portainer-part1/" +[#]: author: "Shashidhar Soppin https://www.linuxtechi.com/author/shashidhar/" + +用 Portainer.io 来监控和管理 Docker 容器(1) +====== + +![](https://img.linux.net.cn/data/attachment/album/202009/20/225425zaepvexqvg7nndqv.jpg) + +随着 Docker 的使用量越来越大,监控 Docker 容器正在变得更有挑战性。每天都有大量的 Docker 容器被创建,因此如何监控它们就变得非常重要。目前已经有一些内置的工具和技术,不过对它们进行配置有一些复杂。随着基于微服务的架构正在变成接下来事实上的标准,学会这种技术将为你的知识库再添一项新技能。 + +基于上述场景,对一种轻量、健壮的镜像管理工具的需求日益增加。Portainer.io 解决了这个问题。 Portainer.io(最新版本是 1.20.2)非常轻量,只需 2-3 个命令就可以配置好,已经在 Docker 用户中流行起来。 + +比起其他工具,这个工具有很多优势,其中一些如下所示: + + * 轻量(安装此工具仅需 2 到 3 个命令,与此同时安装镜像的大小在 26 M 到 30 M 之间) + * 健壮且易用 + * 可用于 Docker 监控和构建 + * 提供对 Docker 环境的详细概况 + * 可以管理容器、镜像、网络和卷 + * Portainer 部署方便,仅需一个 Docker 命令(可以在任意地方运行) + * 可以对完整的 Docker 容器环境进行监控 + +Portainer 同时具有以下服务: + +- 社区支持 +- 企业支持 +- 与合作伙伴 OEM 服务一起的专业服务 + +Portainer 的功能和特性如下: + + 1. 配备了漂亮的仪表盘,易于使用和监控 + 2. 自带大量内置模板,便于操作和创建 + 3. 服务支持(仅 OEM 和企业用户) + 4. 对容器、镜像、网络、卷以及配置进行几乎实时的监控 + 5. 包含 Docker 集群监控功能 + 6. 功能多样的用户管理 + +另请阅读:[如何在 Ubuntu 16.04 / 18.04 LTS 版本中安装 Docker CE][1] + +### 如何在 Ubuntu Linux / RHEL / CentOS 系统上安装和配置 Portainer.io + +注意:下面的安装过程是在 Ubuntu 18.04 上完成的,但是对 RHEL 和 CentOS 同样适用,同时假设你已经在系统上安装了 Docker CE。 + +``` +root@linuxtechi:~$ lsb_release -a +No LSB modules are available. +Distributor ID: Ubuntu +Description: Ubuntu 18.04 LTS +Release: 18.04 +Codename: bionic +root@linuxtechi:~$ +``` + +为 Portainer 创建卷: + +``` +root@linuxtechi:~$ sudo docker volume create portainer_data +portainer_data +root@linuxtechi:~$ +``` + +使用下面的 Docker 命令来运行 Portainer 容器: + +``` +root@linuxtechi:~$ sudo docker run -d -p 9000:9000 -v /var/run/docker.sock:/var/run/docker.sock -v portainer_data:/data portainer/portainer +Unable to find image 'portainer/portainer:latest' locally +latest: Pulling from portainer/portainer +d1e017099d17: Pull complete +0b1e707a06d2: Pull complete +Digest: sha256:d6cc2c20c0af38d8d557ab994c419c799a10fe825e4aa57fea2e2e507a13747d +Status: Downloaded newer image for portainer/portainer:latest +35286de9f2e21d197309575bb52b5599fec24d4f373cc27210d98abc60244107 +root@linuxtechi:~$ +``` + +安装完成之后,通过主机或 Docker 的 IP 加上 Docker 引擎使用的 9000 端口在浏览器中打开 Portainer。 + +注意:如果 Docker 所在主机的系统防火墙开启,需要确保 9000 端口被放行,否则浏览器页面将无法打开。 + +在我这边,我的 Docker 主机/引擎的 IP 是 `192.168.1.16`,所以 URL 就是 `http://192.168.1.16:9000` + +![Portainer-Login-User-Name-Password][2] + +在创建管理员用户时,请确保密码是 8 个字符,同时用户名为 `admin`,然后点击 “Create User”。 + +接下来进入如下所示的页面,选中 “Local” 矩形框。 + +![Connect-Portainer-Local-Docker][4] + +点击 “Connect”, + +可以看到 admin 用户的漂亮首页如下所示, + +![Portainer-io-Docker-Monitor-Dashboard][6] + +现在 Portainer 已经准备好运行和管理你的 Docker 容器了,同时也可用于容器监控。 + +### 在 Portainer 中管理容器镜像 + +![Portainer-Endpoints][8] + +检查当前的状态,可以看到有两个容器已经在运行了,如果你创建另一个也会立即显示出来。 + +像下面这样,在命令行中启动一个或两个容器, + +``` +root@linuxtechi:~$ sudo docker run --name test -it debian +Unable to find image 'debian:latest' locally +latest: Pulling from library/debian +e79bb959ec00: Pull complete +Digest: sha256:724b0fbbda7fda6372ffed586670573c59e07a48c86d606bab05db118abe0ef5 +Status: Downloaded newer image for debian:latest +root@linuxtechi:/# +``` + +然后在 Portainer 页面中点击刷新按钮(会出现一条让你确认的消息,点击上面的 “Continue”),就可以像下面高亮显示的一样看到 3 个容器了。 + +![Portainer-io-new-container-image][10] + +点击上图中红圈圈出来的 “containers”,下一个页面会显示 “Dashboard Endpoint summary”。 + +![Portainer-io-Docker-Container-Dash][12] + +在这个页面中,点击上图高亮和红圈圈出来的 “Containers”,就可以对容器进行监控了。 + +### 以简单的方式对容器进行监控 + +继续上面的步骤,就会出现一个如下所示精致、漂亮的 “Container list” 页面。 + +![Portainer-Container-List][14] + +所有的容器都可以在这里进行控制(停止、启动等等)。 + +1、在这个页面上,停止我们之前启动的 “test” 容器(这是一个我们早先启动的 debian 容器)。 + +选中此容器前面的复选框,然后点击上面的“Stop”按钮来停止。 + +![Stop-Container-Portainer-io-dashboard][16] + +在命令行中,你也会看到这个容器现在已经停止或退出了: + +``` +root@linuxtechi:~$ sudo docker container ls -a +CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES +d45902e717c0 debian "bash" 21 minutes ago Exited (0) 49 seconds ago test +08b96eddbae9 centos:7 "/bin/bash" About an hour ago Exited (137) 9 minutes ago mycontainer2 +35286de9f2e2 portainer/portainer "/portainer" 2 hours ago Up About an hour 0.0.0.0:9000->9000/tcp compassionate_benz +root@linuxtechi:~$ +``` + +2、现在,在 Portainer 页面中启动已经停止的两个容器(test 和 mycontainer2) + +选中已停止的这两个容器前面的复选框,然后点击 “Start”。 + +![Start-Containers-Portainer-GUI][18] + +你会立即看到两条窗口提醒,内容是“容器成功启动”,并且两个容器的状态变为正在运行。 + +![Conatiner-Started-successfully-Portainer-GUI][20] + +### 一步步探索其他多种选项和特性 + +1、点击高亮的“Images”,你会看到如下页面: + +![Docker-Container-Images-Portainer-GUI][22] + +这是可用的容器列表,其中一些可能没在运行。这些容器可以被导入、导出或者上传到不同的位置,截图如下所示。 + +![Upload-Docker-Container-Image-Portainer-GUI][24] + +2、点击高亮的“Volumes”,显示如下页面: + +![Volume-list-Portainer-io-gui][26] + +3、通过下面的操作,可以很容易的添加卷。点击添加卷按钮,出现如下页面,在名称输入框中输入卷名称,例如 “myvol”,然后点击 “Create the volume” 按钮: + +![Volume-Creation-Portainer-io-gui][28] + +新创建的卷如下所示(状态为未使用): + +![Volume-unused-Portainer-io-gui][30] + +### 结论 + +通过上面的安装步骤,你可以到配置和使用 Portainer.io 的多种选项是多么简单和精美,它提供了用于构建和监控 Docker 容器的多种功能和选项。如前所述,这个一个非常轻量的工具,因此不会给主机系统增加任何负担。下一组选项将在本系列的第 2 部分中进行探讨。 + +另请阅读: [用 Portainer.io 来监控和管理 Docker 容器(2)][32] + +-------------------------------------------------------------------------------- + +via: https://www.linuxtechi.com/monitor-manage-docker-containers-portainer-part1/ + +作者:[Shashidhar Soppin][a] +选题:[lujun9972][b] +译者:[jlztan](https://github.com/jlztan) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://www.linuxtechi.com/author/shashidhar/ +[b]: https://github.com/lujun9972 +[1]: https://www.linuxtechi.com/how-to-setup-docker-on-ubuntu-server-16-04/ +[2]: https://www.linuxtechi.com/wp-content/uploads/2019/05/Portainer-Login-User-Name-Password-1024x681.jpg +[3]: https://www.linuxtechi.com/wp-content/uploads/2019/05/Portainer-Login-User-Name-Password.jpg +[4]: https://www.linuxtechi.com/wp-content/uploads/2019/05/Connect-Portainer-Local-Docker-1024x538.jpg +[5]: https://www.linuxtechi.com/wp-content/uploads/2019/05/Connect-Portainer-Local-Docker.jpg +[6]: https://www.linuxtechi.com/wp-content/uploads/2019/05/Portainer-io-Docker-Monitor-Dashboard-1024x544.jpg +[7]: https://www.linuxtechi.com/wp-content/uploads/2019/05/Portainer-io-Docker-Monitor-Dashboard.jpg +[8]: https://www.linuxtechi.com/wp-content/uploads/2019/05/Portainer-Endpoints-1024x252.jpg +[9]: https://www.linuxtechi.com/wp-content/uploads/2019/05/Portainer-Endpoints.jpg +[10]: https://www.linuxtechi.com/wp-content/uploads/2019/05/Portainer-io-new-container-image-1024x544.jpg +[11]: https://www.linuxtechi.com/wp-content/uploads/2019/05/Portainer-io-new-container-image.jpg +[12]: https://www.linuxtechi.com/wp-content/uploads/2019/05/Portainer-io-Docker-Container-Dash-1024x544.jpg +[13]: https://www.linuxtechi.com/wp-content/uploads/2019/05/Portainer-io-Docker-Container-Dash.jpg +[14]: https://www.linuxtechi.com/wp-content/uploads/2019/05/Portainer-Container-List-1024x538.jpg +[15]: https://www.linuxtechi.com/wp-content/uploads/2019/05/Portainer-Container-List.jpg +[16]: https://www.linuxtechi.com/wp-content/uploads/2019/05/Stop-Container-Portainer-io-dashboard-1024x447.jpg +[17]: https://www.linuxtechi.com/wp-content/uploads/2019/05/Stop-Container-Portainer-io-dashboard.jpg +[18]: https://www.linuxtechi.com/wp-content/uploads/2019/05/Start-Containers-Portainer-GUI-1024x449.jpg +[19]: https://www.linuxtechi.com/wp-content/uploads/2019/05/Start-Containers-Portainer-GUI.jpg +[20]: https://www.linuxtechi.com/wp-content/uploads/2019/05/Conatiner-Started-successfully-Portainer-GUI-1024x538.jpg +[21]: https://www.linuxtechi.com/wp-content/uploads/2019/05/Conatiner-Started-successfully-Portainer-GUI.jpg +[22]: https://www.linuxtechi.com/wp-content/uploads/2019/05/Docker-Container-Images-Portainer-GUI-1024x544.jpg +[23]: https://www.linuxtechi.com/wp-content/uploads/2019/05/Docker-Container-Images-Portainer-GUI.jpg +[24]: https://www.linuxtechi.com/wp-content/uploads/2019/05/Upload-Docker-Container-Image-Portainer-GUI-1024x544.jpg +[25]: https://www.linuxtechi.com/wp-content/uploads/2019/05/Upload-Docker-Container-Image-Portainer-GUI.jpg +[26]: https://www.linuxtechi.com/wp-content/uploads/2019/05/Volume-list-Portainer-io-gui-1024x544.jpg +[27]: https://www.linuxtechi.com/wp-content/uploads/2019/05/Volume-list-Portainer-io-gui.jpg +[28]: https://www.linuxtechi.com/wp-content/uploads/2019/05/Volume-Creation-Portainer-io-gui-1024x544.jpg +[29]: https://www.linuxtechi.com/wp-content/uploads/2019/05/Volume-Creation-Portainer-io-gui.jpg +[30]: https://www.linuxtechi.com/wp-content/uploads/2019/05/Volume-unused-Portainer-io-gui-1024x544.jpg +[31]: https://www.linuxtechi.com/wp-content/uploads/2019/05/Volume-unused-Portainer-io-gui.jpg +[32]: https://www.linuxtechi.com/monitor-manage-docker-containers-portainer-io-part-2/ diff --git a/published/202009/20191031 Advance your awk skills with two easy tutorials.md b/published/202009/20191031 Advance your awk skills with two easy tutorials.md new file mode 100644 index 0000000000..4fa911cfd9 --- /dev/null +++ b/published/202009/20191031 Advance your awk skills with two easy tutorials.md @@ -0,0 +1,271 @@ +[#]: collector: (lujun9972) +[#]: translator: (wxy) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12658-1.html) +[#]: subject: (Advance your awk skills with two easy tutorials) +[#]: via: (https://opensource.com/article/19/10/advanced-awk) +[#]: author: (Dave Neary https://opensource.com/users/dneary) + +通过两个简单的教程来提高你的 awk 技能 +====== + +> 超越单行的 awk 脚本,学习如何做邮件合并和字数统计。 + +![](https://img.linux.net.cn/data/attachment/album/202009/28/154624jk8w4ez6oujbur8j.jpg) + +`awk` 是 Unix 和 Linux 用户工具箱中最古老的工具之一。`awk` 由 Alfred Aho、Peter Weinberger 和 Brian Kernighan(即工具名称中的 A、W 和 K)在 20 世纪 70 年代创建,用于复杂的文本流处理。它是流编辑器 `sed` 的配套工具,后者是为逐行处理文本文件而设计的。`awk` 支持更复杂的结构化程序,是一门完整的编程语言。 + +本文将介绍如何使用 `awk` 完成更多结构化的复杂任务,包括一个简单的邮件合并程序。 + +### awk 的程序结构 + +`awk` 脚本是由 `{}`(大括号)包围的功能块组成,其中有两个特殊的功能块,`BEGIN` 和 `END`,它们在处理第一行输入流之前和最后一行处理之后执行。在这两者之间,块的格式为: + +``` +模式 { 动作语句 } +``` + +当输入缓冲区中的行与模式匹配时,每个块都会执行。如果没有包含模式,则函数块在输入流的每一行都会执行。 + +另外,以下语法可以用于在 `awk` 中定义可以从任何块中调用的函数。 + +``` +function 函数名(参数列表) { 语句 } +``` + +这种模式匹配块和函数的组合允许开发者结构化的 `awk` 程序,以便重用和提高可读性。 + +### awk 如何处理文本流 + +`awk` 每次从输入文件或流中一行一行地读取文本,并使用字段分隔符将其解析成若干字段。在 `awk` 的术语中,当前的缓冲区是一个*记录*。有一些特殊的变量会影响 `awk` 读取和处理文件的方式: + + * `FS`(字段分隔符field separator)。默认情况下,这是任何空格字符(空格或制表符)。 + * `RS`(记录分隔符record separator)。默认情况下是一个新行(`n`)。 + * `NF`(字段数number of fields)。当 `awk` 解析一行时,这个变量被设置为被解析出字段数。 + * `$0:` 当前记录。 + * `$1`、`$2`、`$3` 等:当前记录的第一、第二、第三等字段。 + * `NR`(记录数number of records)。迄今已被 `awk` 脚本解析的记录数。 + +影响 `awk` 行为的变量还有很多,但知道这些已经足够开始了。 + +### 单行 awk 脚本 + +对于一个如此强大的工具来说,有趣的是,`awk` 的大部分用法都是基本的单行脚本。也许最常见的 `awk` 程序是打印 CSV 文件、日志文件等输入行中的选定字段。例如,下面的单行脚本从 `/etc/passwd` 中打印出一个用户名列表: + +``` +awk -F":" '{print $1 }' /etc/passwd +``` + +如上所述,`$1` 是当前记录中的第一个字段。`-F` 选项将 `FS` 变量设置为字符 `:`。 + +字段分隔符也可以在 `BEGIN` 函数块中设置: + +``` +awk 'BEGIN { FS=":" } {print $1 }' /etc/passwd +``` + +在下面的例子中,每一个 shell 不是 `/sbin/nologin` 的用户都可以通过在该块前面加上匹配模式来打印出来: + +``` +awk 'BEGIN { FS=":" } ! /\/sbin\/nologin/ {print $1 }' /etc/passwd +``` + +### awk 进阶:邮件合并 + +现在你已经掌握了一些基础知识,尝试用一个更具有结构化的例子来深入了解 `awk`:创建邮件合并。 + +邮件合并使用两个文件,其中一个文件(在本例中称为 `email_template.txt`)包含了你要发送的电子邮件的模板: + +``` +From: Program committee +To: {firstname} {lastname} <{email}> +Subject: Your presentation proposal + +Dear {firstname}, + +Thank you for your presentation proposal: + {title} + +We are pleased to inform you that your proposal has been successful! We +will contact you shortly with further information about the event +schedule. + +Thank you, +The Program Committee +``` + +而另一个则是一个 CSV 文件(名为 `proposals.csv`),里面有你要发送邮件的人: + +``` +firstname,lastname,email,title +Harry,Potter,hpotter@hogwarts.edu,"Defeating your nemesis in 3 easy steps" +Jack,Reacher,reacher@covert.mil,"Hand-to-hand combat for beginners" +Mickey,Mouse,mmouse@disney.com,"Surviving public speaking with a squeaky voice" +Santa,Claus,sclaus@northpole.org,"Efficient list-making" +``` + +你要读取 CSV 文件,替换第一个文件中的相关字段(跳过第一行),然后把结果写到一个叫 `acceptanceN.txt` 的文件中,每解析一行就递增文件名中的 `N`。 + +把 `awk` 程序写在一个叫 `mail_merge.awk` 的文件中。在 `awk` 脚本中的语句用 `;` 分隔。第一个任务是设置字段分隔符变量和其他几个脚本需要的变量。你还需要读取并丢弃 CSV 中的第一行,否则会创建一个以 `Dear firstname` 开头的文件。要做到这一点,请使用特殊函数 `getline`,并在读取后将记录计数器重置为 0。 + +``` +BEGIN { +  FS=","; +  template="email_template.txt"; +  output="acceptance"; +  getline; +  NR=0; +} +``` + +主要功能非常简单:每处理一行,就为各种字段设置一个变量 —— `firstname`、`lastname`、`email` 和 `title`。模板文件被逐行读取,并使用函数 `sub` 将任何出现的特殊字符序列替换为相关变量的值。然后将该行以及所做的任何替换输出到输出文件中。 + +由于每行都要处理模板文件和不同的输出文件,所以在处理下一条记录之前,需要清理和关闭这些文件的文件句柄。 + +``` +{ +        # 从输入文件中读取关联字段 +        firstname=$1; +        lastname=$2; +        email=$3; +        title=$4; + +        # 设置输出文件名 +        outfile=(output NR ".txt"); + +        # 从模板中读取一行,替换特定字段, +        # 并打印结果到输出文件。 +        while ( (getline ln < template) > 0 ) +        { +                sub(/{firstname}/,firstname,ln); +                sub(/{lastname}/,lastname,ln); +                sub(/{email}/,email,ln); +                sub(/{title}/,title,ln); +                print(ln) > outfile; +        } + +        # 关闭模板和输出文件,继续下一条记录 +        close(outfile); +        close(template); +} +``` + +你已经完成了! 在命令行上运行该脚本: + +``` +awk -f mail_merge.awk proposals.csv +``` + +或 + +``` +awk -f mail_merge.awk < proposals.csv +``` + +你会在当前目录下发现生成的文本文件。 + +### awk 进阶:字频计数 + +`awk` 中最强大的功能之一是关联数组,在大多数编程语言中,数组条目通常由数字索引,但在 `awk` 中,数组由一个键字符串进行引用。你可以从上一节的文件 `proposals.txt` 中存储一个条目。例如,在一个单一的关联数组中,像这样: + +``` +        proposer["firstname"]=$1; +        proposer["lastname"]=$2; +        proposer["email"]=$3; +        proposer["title"]=$4; +``` + +这使得文本处理变得非常容易。一个使用了这个概念的简单的程序就是词频计数器。你可以解析一个文件,在每一行中分解出单词(忽略标点符号),对行中的每个单词进行递增计数器,然后输出文本中出现的前 20 个单词。 + +首先,在一个名为 `wordcount.awk` 的文件中,将字段分隔符设置为包含空格和标点符号的正则表达式: + +``` +BEGIN { + # ignore 1 or more consecutive occurrences of the characters + # in the character group below + FS="[ .,:;()<>{}@!\"'\t]+"; +} +``` + +接下来,主循环函数将遍历每个字段,忽略任何空字段(如果行末有标点符号,则会出现这种情况),并递增行中单词数: + +``` +{ +        for (i = 1; i <= NF; i++) { +                if ($i != "") { +                        words[$i]++; +                } +        } +} +``` + +最后,处理完文本后,使用 `END` 函数打印数组的内容,然后利用 `awk` 的能力,将输出的内容用管道输入 shell 命令,进行数字排序,并打印出 20 个最常出现的单词。 + +``` +END { +        sort_head = "sort -k2 -nr | head -n 20"; +        for (word in words) { +                printf "%s\t%d\n", word, words[word] | sort_head; +        } +        close (sort_head); +} +``` + +在这篇文章的早期草稿上运行这个脚本,会产生这样的输出: + +``` +[dneary@dhcp-49-32.bos.redhat.com]$ awk -f wordcount.awk < awk_article.txt +the 79 +awk 41 +a 39 +and 33 +of 32 +in 27 +to 26 +is 25 +line 23 +for 23 +will 22 +file 21 +we 16 +We 15 +with 12 +which 12 +by 12 +this 11 +output 11 +function 11 +``` + +### 下一步是什么? + +如果你想了解更多关于 `awk` 编程的知识,我强烈推荐 Dale Dougherty 和 Arnold Robbins 所著的《[Sed 和 awk][8]》这本书。 + +`awk` 编程进阶的关键之一是掌握“扩展正则表达式”。`awk` 为你可能已经熟悉的 sed [正则表达式][9]语法提供了几个强大的补充。 + +另一个学习 `awk` 的好资源是 [GNU awk 用户指南][10]。它有一个完整的 `awk` 内置函数库的参考资料,以及很多简单和复杂的 `awk` 脚本的例子。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/10/advanced-awk + +作者:[Dave Neary][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/dneary +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/checklist_hands_team_collaboration.png?itok=u82QepPk (a checklist for a team) +[2]: mailto:pc@event.org +[3]: mailto:hpotter@hogwarts.edu +[4]: mailto:reacher@covert.mil +[5]: mailto:mmouse@disney.com +[6]: mailto:sclaus@northpole.org +[7]: mailto:dneary@dhcp-49-32.bos.redhat.com +[8]: https://www.amazon.com/sed-awk-Dale-Dougherty/dp/1565922255/book +[9]: https://en.wikibooks.org/wiki/Regular_Expressions/POSIX-Extended_Regular_Expressions +[10]: https://www.gnu.org/software/gawk/manual/gawk.html diff --git a/sources/tech/20200118 3 Methods to Install the Latest PHP 7 Package on CentOS-RHEL 7 and CentOS-RHEL 6.md b/published/202009/20200118 3 Methods to Install the Latest PHP 7 Package on CentOS-RHEL 7 and CentOS-RHEL 6.md similarity index 53% rename from sources/tech/20200118 3 Methods to Install the Latest PHP 7 Package on CentOS-RHEL 7 and CentOS-RHEL 6.md rename to published/202009/20200118 3 Methods to Install the Latest PHP 7 Package on CentOS-RHEL 7 and CentOS-RHEL 6.md index 09b2f4ca73..c1525f1969 100644 --- a/sources/tech/20200118 3 Methods to Install the Latest PHP 7 Package on CentOS-RHEL 7 and CentOS-RHEL 6.md +++ b/published/202009/20200118 3 Methods to Install the Latest PHP 7 Package on CentOS-RHEL 7 and CentOS-RHEL 6.md @@ -1,44 +1,38 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: translator: (gxlct008) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12615-1.html) [#]: subject: (3 Methods to Install the Latest PHP 7 Package on CentOS/RHEL 7 and CentOS/RHEL 6) [#]: via: (https://www.2daygeek.com/install-php-7-on-centos-6-centos-7-rhel-7-redhat-7/) [#]: author: (Magesh Maruthamuthu https://www.2daygeek.com/author/magesh/) -3 Methods to Install the Latest PHP 7 Package on CentOS/RHEL 7 and CentOS/RHEL 6 +在 CentOS/RHEL 7/6 上安装最新 PHP 7 软件包的 3 种方法 ====== -PHP is the most popular open-source general-purpose scripting language and is widely used for web development. +![](https://img.linux.net.cn/data/attachment/album/202009/14/235431i92iqjj2we0vegyj.jpg) -It’s part of the LAMP stack application suite and is used to create dynamic websites. +PHP 是最流行的开源通用脚本语言,被广泛用于 Web 开发。它是 LAMP 栈应用程序套件的一部分,用于创建动态网站。流行的 CMS 应用程序 WordPress,Joomla 和 Drupal 都是用 PHP 语言开发的。这些应用程序的安装和配置都需要 PHP 7。PHP 7 可以更快地加载你的 Web 应用程序,并消耗更少的服务器资源。 -Popular CMS applications WordPress, Joomla and Drupal are developed in PHP language. +在默认情况下,CentOS/RHEL 6 操作系统在其官方存储库中提供 PHP 5.3,而 CentOS/RHEL 7 则提供 PHP 5.4。 -These applications require PHP 7 for their installation and configuration. +在本文中,我们将向你展示如何在 CentOS/RHEL 7 和 CentOS/RHEL 6 系统上安装最新版本的 PHP。 -PHP 7 loads your web application faster and consumes less server resources. +这可以通过在系统中添加必要的 [附加第三方 RPM 存储库][1] 来完成。 -By default the CentOS/RHEL 6 operating system provides PHP 5.3 in their official repository and CentOS/RHEL 7 provides PHP 5.4. +### 方法-1:如何使用软件集合存储库(SCL)在 CentOS 6/7 上安装 PHP 7 -In this article we will show you how to install the latest version of PHP on CentOS/RHEL 7 and CentOS/RHEL 6 systems. +现在,SCL 存储库由 CentOS SIG 维护,该组织不仅重新构建了 Red Hat Software Collections,还提供了自己的一些其他软件包。 -This can be done by adding the necessary **[additional third-party RPM repository][1]** to the system. +它包含各种程序的较新版本,这些程序可以与现有的旧软件包一起安装,并可以使用 `scl` 命令调用。 -### Method-1 : How to Install PHP 7 on CentOS 6/7 Using the Software Collections Repository (SCL) - -The SCL repository is now maintained by a CentOS SIG, which rebuilds the Red Hat Software Collections and also provides some additional packages of their own. - -It contains newer versions of various programs that can be installed alongside existing older packages and invoked by using the scl command. - -Run the following **[yum command][2]** to install Software Collections Repository (SCL) on CentOS +要想在 CentOS 上安装软件集合存储库(SCL),请运行以下 [yum 命令][2]: ``` # yum install centos-release-scl ``` -Run the following command to verify the PHP 7 version available in the scl repository. +运行以下命令可以验证 SCL 存储库中可用的 PHP 7 版本: ``` # yum --disablerepo="*" --enablerepo="centos-sclo-rh" list *php @@ -54,21 +48,21 @@ rh-php71-php.x86_64 7.1.30-2.el7 centos-sclo-rh rh-php72-php.x86_64 7.2.24-1.el7 centos-sclo-rh ``` -Run the command below to install the PHP 7.2 on your system from scl. +运行以下命令可以从 SCL 中安装 PHP 7.2 到你的系统中: ``` # yum --disablerepo="*" --enablerepo="centos-sclo-rh" install rh-php72-php ``` -If you need to install additional modules for PHP 7.2, you can install them by running the command format below. For instance, you can install the **“gd”** and **“pdo”** packages by executing the command below. +如果需要为 PHP 7.2 安装其他模块,则可以通过运行以下命令格式来安装它们。 例如,你可以通过执行以下命令来安装 `gd` 和 `pdo` 软件包: ``` # yum --disablerepo="*" --enablerepo="centos-sclo-rh" install rh-php72-php-gd rh-php72-php-pdo ``` -### Method-1a : How to Install PHP 7 on RHEL 7 Using the Software Collections Repository (SCL) +### 方法-1a:如何使用软件集合存储库(SCL)在 RHEL 7 上安装 PHP 7 -For Red Hat 7, enable the following repositories to install the latest PHP 7 package. +对于 Red Hat 7,启用以下存储库以安装最新的 PHP 7 软件包: ``` # sudo subscription-manager repos --enable rhel-7-server-extras-rpms @@ -76,27 +70,27 @@ For Red Hat 7, enable the following repositories to install the latest PHP 7 pac # sudo subscription-manager repos --enable rhel-server-rhscl-7-rpms ``` -Run the command below to search the available PHP 7 version from the RHSCL repository. +运行以下命令从 RHSCL 库中搜索可用的 PHP 7 版本: ``` # yum search rh-php* ``` -You can easily install PHP 7.3 on the RHEL 7 machine by running the command below from the RHSCL repository. +运行以下命令,你可以轻松地从 RHSCL 存储库中把 PHP7.3 安装到你的 RHEL 7 计算机上: ``` # yum install rh-php73 ``` -### Method-2 : How to Install PHP 7 on CentOS 6/7 Using the Remi Repository +### 方法-2:如何使用 Remi 存储库在 CentOS 6/7 上安装 PHP 7 -The **[Remi repository][3]** stores and maintains the latest version of PHP packages with a large collection of libraries, extensions and tools. Some of them are back-ported from Fedora and EPEL. +[Remi 存储库][3] 存储和维护着最新版本的 PHP 软件包,其中包含大量的库,扩展和工具。 有一些是从 Fedora 和 EPEL 反向移植的。 -This is a CentOS community-recognized repository and doesn’t modify or affect any underlying packages. +这是 CentOS 社区认可的存储库,它不会修改或影响任何基础软件包。 -As a prerequisite, this installs the **[EPEL repository][4]** if it is not already installed on your system. +作为前提条件,如果你的系统上尚未安装 [EPEL 存储库][4],该操作会首先安装它。 -You can easily find the available version of the PHP 7 package from the Remy repository because it adds a separate repo to each version. You can view them using the **[ls command][5]**. +你可以轻松地从 Remi 存储库中找到可用的 PHP 7 软件包版本,因为它会为每个版本添加一个单独的存储库。 你可以使用 [ls 命令][5] 查看它们: ``` # ls -lh /etc/yum.repos.d/remi-php* @@ -109,41 +103,41 @@ You can easily find the available version of the PHP 7 package from the Remy rep -rw-r--r--. 1 root root 1.3K Sep 6 01:31 /etc/yum.repos.d/remi-php74.repo ``` -You can easily install PHP 7.4 on the CentOS 6/7 systems by running the command below from the remi repository. +运行以下命令,你可以轻松地从 Remi 存储库中把 PHP7.4 安装到你的 CentOS 6/7 计算机上: ``` # yum --disablerepo="*" --enablerepo="remi-php74" install php php-mcrypt php-cli php-gd php-curl php-mysql php-ldap php-zip php-fileinfo ``` -### Method-2a : How to Install PHP 7 on RHEL 7 Using the Remi Reposiotry +### 方法-2a:如何使用 Remi 存储库在 RHEL 7 上安装 PHP 7 -For Red Hat 7, install the following repositories to install the latest PHP 7 package. +对于 Red Hat 7,请安装以下存储库以安装最新的 PHP 7 软件包。 -To install EPEL Repository on RHEL 7 +在 RHEL 7 上安装 EPEL 存储库: ``` # yum install https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm ``` -To install Remi Repository on RHEL 7 +在 RHEL 7 上安装 Remi 存储库: ``` # yum install http://rpms.remirepo.net/enterprise/remi-release-7.rpm ``` -To enable the optional RPMS repository. +启用可选的 RPMS 存储库: ``` # subscription-manager repos --enable=rhel-7-server-optional-rpms ``` -You can easily install PHP 7.4 on the RHEL 7 systems by running the below command from the remi repository. +运行以下命令,可以轻松地从 remi 存储库中,把 PHP 7.4 安装在 RHEL 7 系统上: ``` # yum --disablerepo="*" --enablerepo="remi-php74" install php php-mcrypt php-cli php-gd php-curl php-mysql php-ldap php-zip php-fileinfo ``` -To verify the PHP 7 installation, run the following command +要验证 PHP 7 的安装版本,请运行以下命令: ``` # php -v @@ -153,19 +147,19 @@ Copyright (c) The PHP Group Zend Engine v3.4.0, Copyright (c) Zend Technologies ``` -### Method-3 : How to Install PHP 7 on CentOS 6/7 Using the IUS Community Repository +### 方法-3:如何使用 IUS 社区存储库在 CentOS 6/7 上安装 PHP 7 -IUS Community is a CentOS Community Approved third-party RPM repository which contains latest upstream versions of PHP, Python, MySQL, etc.., packages for Enterprise Linux (RHEL & CentOS) 5, 6 & 7. +IUS 社区存储库是 CentOS 社区批准的第三方 RPM 存储库,其中包含 PHP、Python、MySQL 等软件的最新上游版本,以及用于 Enterprise Linux(RHEL 和 CentOS)5、6 和 7 的软件包。 -**[IUS Community Repository][6]** have dependency with EPEL Repository so we have to install EPEL repository prior to IUS repository installation. Follow the below steps to install & enable EPEL & IUS Community Repository to RPM systems and install the packages. +[IUS 社区存储库][6] 与 EPEL 存储库具有依赖性,因此我们必须在安装 IUS 存储库之前先安装 EPEL 存储库。 请按照以下步骤将 EPEL 和 IUS 社区存储库安装并启用到 RPM 系统,然后再安装软件包。 -EPEL package is included in the CentOS Extras repository and enabled by default so, we can install this by running below command. +EPEL软件包包含在 CentOS Extras 存储库中,并默认启用,因此,我们可以通过运行以下命令来安装它: ``` # yum install epel-release ``` -Download IUS Community Repository Shell script +下载 IUS 社区存储库的 Shell 脚本如下: ``` # curl 'https://setup.ius.io/' -o setup-ius.sh @@ -174,13 +168,13 @@ Download IUS Community Repository Shell script 100 1914 100 1914 0 0 6563 0 --:--:-- --:--:-- --:--:-- 133k ``` -Install/Enable IUS Community Repository. +安装/启用 IUS 社区存储库: ``` # sh setup-ius.sh ``` -Run the following command to check available PHP 7 version in the IUS repository. +运行如下命来检查 IUS 存储库中可用的 PHP 7 版本: ``` # yum --disablerepo="*" --enablerepo="ius" list *php7* @@ -200,7 +194,7 @@ php71u-devel.x86_64 7.1.33-1.el7.ius php71u-embedded.x86_64 7.1.33-1.el7.ius ius ``` -You can easily install PHP 7.3 on the CentOS 6/7 systems by running the command below from the IUS Community repository. +运行以下命令你可以轻松地从 IUS 存储库中安装 PHP 7.3 到你 CentOS 6/7 系统上: ``` # yum --disablerepo="*" --enablerepo="ius" install php73-common php73-cli php73-gd php73-gd php73-mysqlnd php73-ldap php73-soap php73-mbstring @@ -212,8 +206,8 @@ via: https://www.2daygeek.com/install-php-7-on-centos-6-centos-7-rhel-7-redhat-7 作者:[Magesh Maruthamuthu][a] 选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) +译者:[gxlct008](https://github.com/gxlct008) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 diff --git a/published/202009/20200415 Tweaking history on Linux.md b/published/202009/20200415 Tweaking history on Linux.md new file mode 100644 index 0000000000..0bd28438f6 --- /dev/null +++ b/published/202009/20200415 Tweaking history on Linux.md @@ -0,0 +1,189 @@ +[#]: collector: (lujun9972) +[#]: translator: (wxy) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12596-1.html) +[#]: subject: (Tweaking history on Linux) +[#]: via: (https://www.networkworld.com/article/3537214/tweaking-history-on-linux.html) +[#]: author: (Sandra Henry-Stocker https://www.networkworld.com/author/Sandra-Henry_Stocker/) + +在 Linux 上调整命令历史 +====== + +> 在 Linux 系统上,bash shell 的 history 命令可以方便地回顾和重用命令,但是你要控制它记住多少,忘记多少,有很多事情要做。 + +![](https://img.linux.net.cn/data/attachment/album/202009/08/232418c2121m2euw3aaw58.jpg) + +Linux 系统中的 bash `history` 命令有助于记住你以前运行过的命令,并重复这些命令,而不必重新输入。 + +如果可以的话,你肯定会很高兴不用翻阅十几页的手册,每过一会再次列出你的文件,而是通过输入 `history` 查看以前运行的命令。在这篇文章中,我们将探讨如何让 `history` 命令记住你希望它记住的内容,并忘记那些可能没有什么“历史价值”的命令。 + +### 查看你的命令历史 + +要查看以前运行过的命令,你只需输入 `history`。你可能会看到一长串命令。记忆的命令数量取决于在 `~/.bashrc` 文件中设置的名为 `$HISTSIZE` 的环境变量,但是如果你想保存更多或更少的命令,你可以根据你的需要改变这个设置。 + +要查看历史记录,请使用 `history` 命令: + +``` +$ history +209 uname -v +210 date +211 man chage +... +``` + +要查看将显示的最大命令数量: + +``` +$ echo $HISTSIZE +500 +``` + +你可以通过运行这样的命令来改变 `$HISTSIZE` 并使之永久化: + +``` +$ export HISTSIZE=1000 +$ echo "HISTSIZE=1000" >> ~/.bashrc +``` + +在为你保留多少历史记录和当你输入 `history` 时显示多少历史记录之间也有区别。`$HISTSIZE` 变量控制显示多少历史记录,而 `$HISTFILESIZE` 变量控制在你的 `.bash_history` 文件中保留多少命令。 + +``` +$ echo $HISTSIZE +1000 +$ echo $HISTFILESIZE +2000 +``` + +你可以通过计算历史文件中的行数来验证第二个变量: + +``` +$ wc -l .bash_history +2000 .bash_history +``` + +需要注意的是,在登录会话中输入的命令在注销前不会被添加到你的 `.bash_history` 文件中,尽管它们会立即显示在 `history` 命令输出中。 + +### 使用历史 + +有三种方法可以重发你在 `history` 中发现的命令。最简单的方法,特别是当你想重用的命令是最近运行的时候,通常是输入一个 `!` 后面跟上命令中足够多的首字母来唯一地识别它。 + +``` +$ !u +uname -v +#37-Ubuntu SMP Thu Mar 26 20:41:27 UTC 2020 +``` + +另一种简单的重复命令的方法是,只需按上箭头键,直到显示了该命令,然后按回车键。 + +另外,如果你运行 `history` 命令,并看到你想重新运行的命令被列出,你可以输入一个 `!` 后面跟着命令左边显示的序号。 + +``` +$ !209 +uname -v +#37-Ubuntu SMP Thu Mar 26 20:41:27 UTC 2020 +``` + +### 隐藏历史 + +如果你想在一段时间内停止记录命令,你可以使用这个命令: + +``` +$ set +o history +``` + +当你输入 `history` 时,你输入的命令不会显示出来,当你退出会话或退出终端时,它们也不会被添加到你的 `.bash_history` 文件中。 + +要取消这个设置,使用 `set -o history`。 + +要使它永久化,你可以把它添加到你的 `.bashrc` 文件中,尽管不使用命令历史记录通常不是一个好主意。 + +``` +$ echo 'set +o history' >> ~/.bashrc +``` + +要暂时清除历史记录,这样在输入 `history` 时只显示之后输入的命令,可以使用 `history -c`(清除)命令: + +``` +$ history | tail -3 +209 uname -v +210 date +211 man chage +$ history -c +$ history +1 history +``` + +注意:在输入 `history -c` 后输入的命令不会被添加到 `.bash_history` 文件中。 + +### 控制历史 + +许多系统上的 `history` 命令的设置会默认包括一个名为 `$HISTCONTROL` 的变量,以确保即使你连续运行同一命令七次,也只会被记住一次。它还可以确保你在首先输入一个或多个空格后跟着的命令将从你的命令历史记录中忽略。 + +``` +$ grep HISTCONTROL .bashrc +HISTCONTROL=ignoreboth +``` + +`ignoreboth` 的意思是“忽略重复的命令和以空格开头的命令”。例如,如果你输入这些命令: + +``` +$ echo try this +$ date +$ date +$ date +$ pwd +$ history +``` + +你的 `history` 命令应该像这样报告: + +``` +$ history +$ echo try this +$ date +$ history +``` + +请注意,连续的 `date` 命令被缩减为一条,以空格缩进的命令被省略。 + +### 忽略历史 + +要忽略某些命令,使它们在你输入 `history` 时不会出现,也不会被添加到你的 `.bash_history` 文件中,可以使用 `$HISTIGNORE` 设置。例如: + +``` +$ export HISTIGNORE=”history:cd:exit:ls:pwd:man” +``` + +这个设置将导致所有的 `history`、`cd`、`exit`、`ls`、`pwd` 和 `man` 命令从你的 `history` 命令的输出和 `.bash_history` 文件中被忽略。 + +如果你想把这个设置变成永久性的,你必须把它添加到你的 `.bashrc` 文件中。 + +``` +$ echo 'HISTIGNORE="history:cd:exit:ls:pwd:man"' >> .bashrc +``` + +这个设置只是意味着当你回看以前运行的命令时,列表不会被你在查看命令历史记录时不想看到的命令所干扰。 + +### 记住、忽略和忘记过去的命令 + +命令历史记录很有用,因为它可以帮助你记住最近使用过的命令,并提醒你最近所做的更改。它还可以让你更容易地重新运行命令,特别是那些有一串参数但你不一定想重新创建的命令。定制你的历史设置可以让你对命令历史的使用变得更容易,更有效率。 + +-------------------------------------------------------------------------------- + +via: https://www.networkworld.com/article/3537214/tweaking-history-on-linux.html + +作者:[Sandra Henry-Stocker][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.networkworld.com/author/Sandra-Henry_Stocker/ +[b]: https://github.com/lujun9972 +[1]: https://unsplash.com/photos/iqeG5xA96M4 +[2]: https://creativecommons.org/publicdomain/zero/1.0/ +[3]: https://www.networkworld.com/blog/itaas-and-the-corporate-storage-technology/?utm_source=IDG&utm_medium=promotions&utm_campaign=HPE22140&utm_content=sidebar (ITAAS and Corporate Storage Strategy) +[4]: https://www.facebook.com/NetworkWorld/ +[5]: https://www.linkedin.com/company/network-world diff --git a/published/202009/20200625 Wi-Fi 6E- When it-s coming and what it-s good for.md b/published/202009/20200625 Wi-Fi 6E- When it-s coming and what it-s good for.md new file mode 100644 index 0000000000..7fb3d60133 --- /dev/null +++ b/published/202009/20200625 Wi-Fi 6E- When it-s coming and what it-s good for.md @@ -0,0 +1,77 @@ +[#]: collector: (lujun9972) +[#]: translator: (chenmu-kk) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12650-1.html) +[#]: subject: (Wi-Fi 6E: When it’s coming and what it’s good for) +[#]: via: (https://www.networkworld.com/article/3563832/wi-fi-6e-when-its-coming-and-what-its-good-for.html) +[#]: author: (Zeus Kerravala https://www.networkworld.com/author/Zeus-Kerravala/) + +Wi-Fi 6E:它何时到来,又有何作用? +====== + +> Extreme Networks 的一位高管表示,近来专用于 Wi-Fi 的新无线频谱可以提供更多的信道和更高的密度部署,但是要支持它的设备要到 2020 年才能得到广泛部署。 + +![](https://images.idgesg.net/images/article/2019/09/cso_wireless_network_management_security_alert_iot_internet_of_things_thinkstock_685417850_1200x800-100810374-large.jpg) + +今年开春 [FCC 在 6GHz 频段内开辟了一系列新的未授权的无线频谱][1],该频谱旨在用于 Wi-Fi,以提供更低的延迟和更快的数据速率。新频谱的范围更短,与已经专用于 Wi-Fi 的频段相比支持的信道也更多,因此适合在体育场馆等高密度区域部署。 + +为了进一步了解什么是 Wi-Fi 6E 以及它与 Wi-Fi 6 有何不同,我最近与网络解决方案提供商 Extreme Networks 的产品管理总监 Perry Correll 进行了交谈。 + +**了解更多关于 5G 和 WiFi 6 的信息** + + * [什么是 5G?相较于 4G 它更好吗?][2] + * [如何确定 WiFi 6 是否适合你?][3] + * [什么是 MU-MIMO?为什么它在你的无线路由器中不可或缺?][4] + * [何时使用 5G?何时使用 WiFi 6?][5] + * [企业如何为5G网络做准备呢?][6] + +**Kerravala: Wi-Fi 6 似乎得到了许多热捧,而 Wi-Fi 6E 却没有。为什么?** + +**Correll:** 所有这些带 666 的数字会混乱得会吓死你。我们已经有了 Wi-Fi 6、Wi-Fi 6E,之后,Wi-Fi 6 还有其它的增强功能,比如多用户多入多出(多用户 MIMO)功能。还有就是 6GHz 频谱,但这并不是 Wi-Fi 6 的名称的由来:它是第六代 Wi-Fi。最重要的是,我们刚刚掌握了 5G,并且已经在谈论 6G —— 认真的讲,这更容易搞混了。 + +**Kerravala: 为什么我们需要 Wi-Fi 6E 和普通的 Wi-Fi 6?** + +**Correll:** 上一次我们在 UNII-2 和 UNII-2 扩展中得到提升是在 15 年前,而在当时智能手机甚至还没有兴起。现在能够获得 1.2GHz 的频谱已经非常大了。使用 Wi-Fi 6E,我们不是将 Wi-Fi 空间增加一倍,事实上,我们将可用空间增加了三倍。根据你所处的地点,频谱的数量要多三倍、四倍或五倍。此外,你不必担心 DFS(动态频率选择dynamic frequency selection),尤其是在室内。 + +Wi-Fi 6E 不会比 Wi-Fi 6 更快,也不会添加增强的技术功能。最妙的是运行 6GHz 需要 Wi-Fi 6 或以上的客户端。所以,我们不会有任何缓慢的客户端,也不会有很多噪声。我们将在更干净的环境中使用更快的设备来得到高性能。 + +**Kerravala: 也能用更宽的信道吗** + +**Correll:** 没错,那是一件很酷的事情。如果你处于一个典型的企业环境中,20 和 40MHz 基本上就是你需要的。在体育馆这种高密度环境中,想要使用 80 或 160MHz 的带宽就会变得很困难了。更宽的信道将会真正有助于像虚拟现实这类应用,它可以利用这些信道占用频谱中剩余的部分。这可能是最大的用例了。 + +在未来的三四年里,如果你想在体育场做数字标识牌或者边缘屏幕处理,则可以使用 160MHz 的 80% 带宽,而不会受到其他任何影响。已经有传言说 Wi-Fi 7 将会有 320MHz 宽的频道。 + +**Kerravala: 这将主要是对大多数 Wi-Fi 策略的增强吗?** + +**Correll:** 短期内肯定会处于先锐领域。首批产品大概会在今年底发布,它们将是消费类产品。对于企业来说,支持 6GHz 的产品将会在明年亮相。在 2022 年之前,你不会真正看到它密集出现——所以,短期内不会。对于智能手机公司来说,Wi-Fi 并不是什么大事,他们更愿意关注其他功能。 + +但它仍是一个巨大的机会。6GHz 与 CBRS(公民宽带无线电服务)或 5G 相比,最棒的一点是(许多人)宁愿坚持使用 Wi-Fi,也不愿迁移到不同的架构。这些用户将推动驱动部件制造商转向物联网设备或机器人或任何需要 6GHz 的设备。这是一个干净的频谱,可能比普通的 Wi-Fi 6 还要便宜也更节能。 + +**Kerravala: 有人说 5G 会替代 Wi-Fi 6。但这有什么实际意义呢?** + +**Correll:** 现实中,你不可能在每个设备中插入 SIM 卡。但是其中一个大问题是数据所有权,因为运营商将拥有你的数据,而不是你。如果你想使用你的数据进行任何类型的业务分析,运营商是否会以一定价格将数据返还给你?这是一个可怕的想法。 + +Wi-Fi 不会消失有太多的理由。当具备 Wi-Fi 6 和 5G 功能的设备问世时,其他只有 Wi-Fi 功能的笔记本电脑、平板电脑和物联网设备将会发生什么呢?要么是只支持 Wi-Fi 的设备,要么是支持 Wi-Fi 和 5G 的设备,但 5G 不会完全取代 Wi-Fi。如果你看看 5G 无线网络的骨干网,Wi-Fi 就是其中的一个组成部分。这是一个幸福的大家庭。这些技术是为了共存而设计的。 + +-------------------------------------------------------------------------------- + +via: https://www.networkworld.com/article/3563832/wi-fi-6e-when-its-coming-and-what-its-good-for.html + +作者:[Zeus Kerravala][a] +选题:[lujun9972][b] +译者:[chenmu-kk](https://github.com/chenmu-kk) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://www.networkworld.com/author/Zeus-Kerravala/ +[b]: https://github.com/lujun9972 +[1]: https://www.networkworld.com/article/3540288/how-wi-fi-6e-boosts-wireless-spectrum-five-fold.html +[2]: https://www.networkworld.com/article/3203489/what-is-5g-how-is-it-better-than-4g.html +[3]: https://www.networkworld.com/article/3356838/how-to-determine-if-wi-fi-6-is-right-for-you.html +[4]: https://www.networkworld.com/article/3250268/what-is-mu-mimo-and-why-you-need-it-in-your-wireless-routers.html +[5]: https://www.networkworld.com/article/3402316/when-to-use-5g-when-to-use-wi-fi-6.html +[6]: https://www.networkworld.com/article/3306720/mobile-wireless/how-enterprises-can-prep-for-5g.html +[7]: https://www.facebook.com/NetworkWorld/ +[8]: https://www.linkedin.com/company/network-world diff --git a/published/202009/20200708 6 best practices for teams using Git.md b/published/202009/20200708 6 best practices for teams using Git.md new file mode 100644 index 0000000000..22db8f87b8 --- /dev/null +++ b/published/202009/20200708 6 best practices for teams using Git.md @@ -0,0 +1,125 @@ +[#]: collector: (lujun9972) +[#]: translator: (LazyWolfLin) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12621-1.html) +[#]: subject: (6 best practices for teams using Git) +[#]: via: (https://opensource.com/article/20/7/git-best-practices) +[#]: author: (Ravi Chandran https://opensource.com/users/ravichandran) + + 6 个在团队中使用 Git 的最佳实践 +====== + +> 采用这些 Git 协作策略,让团队工作更高效。 + +![](https://img.linux.net.cn/data/attachment/album/202009/16/234908ge77j9j799i4eaj7.jpg) + +Git 非常有助于小团队管理他们的软件开发进度,但有些方法能让你变得更高效。我发现了许多有助于我的团队的最佳实践,尤其是当不同 Git 水平的新人加入时。 + +### 在你的团队中正式确立 Git 约定 + +每个人都应当遵循对于分支命名、标记和编码的规范。每个组织都有自己的规范或者最佳实践,并且很多建议都可以从网上免费获取,而重要的是尽早选择合适的规范并在团队中遵循。 + +同时,不同的团队成员的 Git 水平参差不齐。你需要创建并维护一组符合团队规范的基础指令,用于执行通用的 Git 操作。 + +### 正确地合并变更 + +每个团队成员都需要在一个单独的功能分支上开发。但即使是使用了单独的分支,每个人也会修改一些共同的文件。当把更改合并回 `master` 分支时,合并通常无法自动进行。可能需要手动解决不同的人对同一文件不同变更的冲突。这就是你必须学会如何处理 Git 合并的原因。 + +现代编辑器具有协助解决 [Git 合并冲突][2]的功能。它们对同一文件的每个部分提供了合并的各种选择,例如,是否保留你的更改,或者是保留另一分支的更改,亦或者是全部保留。如果你的编辑器不支持这些功能,那么可能是时候换一个代码编辑器了。 + +### 经常变基你的功能分支 + +当你持续地开发你的功能分支时,请经常对它做变基rebase:`rebase master`。这意味着要经常执行以下步骤: + +``` +git checkout master +git pull +git checkout feature-xyz  # 假设的功能分支名称 +git rebase master  # 可能需要解决 feature-xyz 上的合并冲突 +``` + +这些步骤会在你的功能分支上[重写历史][3](这并不是件坏事)。首先,它会使你的功能分支获得 `master` 分支上当前的所有更新。其次,你在功能分支上的所有提交都会在该分支历史的顶部重写,因此它们会顺序地出现在日志中。你可能需要一路解决遇到的合并冲突,这也许是个挑战。但是,这是解决冲突最好的时机,因为它只影响你的功能分支。 + +在解决完所有冲突并进行回归测试后,如果你准备好将功能分支合并回 `master`,那么就可以在再次执行上述的变基步骤几次后进行合并: + +``` +git checkout master +git pull +git merge feature-xyz +``` + +在此期间,如果其他人也将和你有冲突的更改推送到 `master`,那么 Git 合并将再次发生冲突。你需要解决它们并重新进行回归测试。 + +还有一些其他的合并哲学(例如,只使用合并而不使用变基以防止重写历史),其中一些甚至可能更简单易用。但是,我发现上述方法是一个干净可靠的策略。提交历史日志将以有意义的功能序列进行排列。 + +如果使用“纯合并”策略(上面所说的,不进行定期的变基),那么 `master` 分支的历史将穿插着所有同时开发的功能的提交。这样混乱的历史很难回顾。确切的提交时间通常并不是那么重要。最好是有一个易于查看的历史日志。 + +### 在合并前压扁提交 + +当你在功能分支上开发时,即使再小的修改也可以作为一个提交。但是,如果每个功能分支都要产生五十个提交,那么随着不断地增添新功能,`master` 分支的提交数终将无谓地膨胀。通常来说,每个功能分支只应该往 `master` 中增加一个或几个提交。为此,你需要将多个提交压扁Squash成一个或者几个带有更详细信息的提交中。通常使用以下命令来完成: + +``` +git rebase -i HEAD~20  # 查看可进行压扁的二十个提交 +``` + +当这条命令执行后,将弹出一个提交列表的编辑器,你可以通过包括遴选pick压扁squash在内的数种方式编辑它。“遴选”一个提交即保留这个提交。“压扁”一个提交则是将这个提交合并到前一个之中。使用这些方法,你就可以将多个提交合并到一个提交之中,对其进行编辑和清理。这也是一个清理不重要的提交信息的机会(例如,带错字的提交)。 + +总之,保留所有与提交相关的操作,但在合并到 `master` 分支前,合并并编辑相关信息以明确意图。注意,不要在变基的过程中不小心删掉提交。 + +在执行完诸如变基之类的操作后,我会再次看看 `git log` 并做最终的修改: + +``` +git commit --amend +``` + +最后,由于重写了分支的 Git 提交历史,必须强制更新远程分支: + +``` +git push -f +``` + +### 使用标签 + +当你完成测试并准备从 `master` 分支部署软件到线上时,又或者当你出于某种原因想要保留当前状态作为一个里程碑时,那么可以创建一个 Git 标签。对于一个积累了一些变更和相应提交的分支而言,标签就是该分支在那一时刻的快照。一个标签可以看作是没有历史记录的分支,也可以看作是直接指向标签创建前那个提交的命名指针。 + +所谓的“配置控制”就是在不同的里程碑上保存代码的状态。大多数项目都有一个需求,能够重现任一里程碑上的软件源码,以便在需要时重新构建。Git 标签为每个代码的里程碑提供了一个唯一标识。打标签非常简单: + +``` +git tag milestone-id -m "short message saying what this milestone is about" +git push --tags   # 不要忘记将标签显式推送到远程 +``` + +考虑这样一种情况:Git 标签对应的软件版本已经分发给客户,而客户报告了一个问题。尽管代码库中的代码可能已经在继续开发,但通常情况下为了准确地重现客户问题以便做出修复,必须回退到 Git 标签对应的代码状态。有时候新代码可能已经修复了那个问题,但并非一直如此。通常你需要切换到特定的标签并从那个标签创建一个分支: + +``` +git checkout milestone-id        # 切换到分发给客户的标签 +git checkout -b new-branch-name  # 创建新的分支用于重现 bug +``` + +此外,如果带附注的标记和带签名的标记有助于你的项目,可以考虑使用它们。 + +### 让软件运行时打印标签 + +在大多数嵌入式项目中,从代码版本构建出的二进制文件有固定的名称,这样无法从它的名称推断出对应的 Git 标签。在构建时“嵌入标签”有助于将未来发现的问题精准地关联到特定的构建版本。在构建过程中可以自动地嵌入标签。通常,`git describe` 生成的标签字符串会在代码编译前插入到代码中,以便生成的可执行文件能够在启时时输出标签字符串。当客户报告问题时,可以指导他们给你发送启动时输出的内容。 + +### 总结 + +Git 是一个需要花时间去掌握的复杂工具。使用这些实践可以帮助团队成功地使用 Git 协作,无论他们的知识水平。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/7/git-best-practices + +作者:[Ravi Chandran][a] +选题:[lujun9972][b] +译者:[LazyWolfLin](https://github.com/LazyWolfLin) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/ravichandran +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/christina-wocintechchat-com-rg1y72ekw6o-unsplash_1.jpg?itok=MoIv8HlK (Women in tech boardroom) +[2]: https://opensource.com/article/20/4/git-merge-conflict +[3]: https://opensource.com/article/20/4/git-rebase-i diff --git a/published/202009/20200721 Manage network connections from the Linux command line with nmcli.md b/published/202009/20200721 Manage network connections from the Linux command line with nmcli.md new file mode 100644 index 0000000000..8b9b2f8d36 --- /dev/null +++ b/published/202009/20200721 Manage network connections from the Linux command line with nmcli.md @@ -0,0 +1,305 @@ +[#]: collector: "lujun9972" +[#]: translator: "FSSlc" +[#]: reviewer: "wxy" +[#]: publisher: "wxy" +[#]: url: "https://linux.cn/article-12599-1.html" +[#]: subject: "Manage network connections from the Linux command line with nmcli" +[#]: via: "https://opensource.com/article/20/7/nmcli" +[#]: author: "Dave McKay https://opensource.com/users/davemckay" + +在命令行中使用 nmcli 来管理网络连接 +====== + +> nmcli 命令赋予你直接在 Linux 命令行操作 NetworkManager 工具的能力。 + +![](https://img.linux.net.cn/data/attachment/album/202009/10/100302z2xq9cieqyekxbdc.jpg) + +[nmcli][2] 命令赋予你直接在 Linux 命令行操作 NetworkManager 工具的能力。它是 NetworkManager 软件包集成的一部分,通过使用一些 [应用程序接口][3](API)来获取 NetworkManager 的功能。 + +`nmcli` 发布于 2010 年,用以替代其他配置网络接口和连接的方法,例如 [ifconfig][4]。因为它是一个 [命令行界面][5](CLI)工具,被设计用在终端窗口和脚本中,所以对于那些工作在没有 [图形用户界面][6](GUI)的系统的管理员来说,它是一个非常理想的工具。 + +### ncmli 的语法 + +`nmcli` 命令可以使用*选项*来更改它的行为,使用*子命令*来告诉 `nmcli` 想使用它的那部分功能,使用*操作*来告诉 `nmcli` 你想执行什么操作。 + +``` +$ nmcli <选项> <子命令> <操作> +``` + +`nmcli` 一共有 8 个子命令,每个子命令有一些相关的网络操作: + + * `help` 提供有关 `nmcli` 命令和使用方法的帮助信息 + * `general` 返回 NetworkManager 的状态和总体配置信息 + * `networking` 提供命令来查询某个网络连接的状态和启动、禁用连接的功能 + * `radio` 提供命令来查询某个 WiFi 网络连接的状态和启动、禁用连接的功能 + * `monitor` 提供命令来监控 NetworkManager 的活动并观察网络连接的状态改变 + * `connection` 提供命令来启用或禁用网络接口、添加新的连接、删除已有连接等功能 + * `device` 主要被用于更改与某个设备(例如接口名称)相关联的连接参数或者使用一个已有的连接来连接设备 + * `secret` 注册 `nmcli` 来作为一个 NetworkManager 的秘密代理,用以监听秘密信息。这个子命令很少会被用到,因为当连接到网络时,`nmcli` 会自动做这些事 + +### 简单的示例 + +首先,我们验证一下 NetworkManager 正在运行并且 `nmcli` 可以与之通信: + +``` +$ nmcli general +STATE      CONNECTIVITY  WIFI-HW  WIFI     WWAN-HW  WWAN     +connected  full          enabled  enabled  enabled  enabled +``` + +探测总是管理一个系统的首要部分。为了列出内存或磁盘上的网络连接配置,可以使用下面的命令: + +``` +$ nmcli connection show +NAME                UUID                                  TYPE      DEVICE +Wired connection 1  ac3241e4-b424-35d6-aaa7-07498561688d  ethernet  enp0s3 +Wired connection 2  2279d917-fa02-390c-8603-3083ec5a1d3e  ethernet  enp0s8 +Wired connection 3  52d89737-de92-35ec-b082-8cf2e5ac36e6  ethernet  enp0s9 +``` + +上面的命令使用了 `connection` 子命令中的 `show` 操作。 + +用来运行上面这个例子的测试机器上运行着 Ubuntu 20.04,它安装了 3 个网络适配器:`enp0s3`、`enp0s8`和 `enp0s9`。 + +### 连接管理 + +理解 `nmcli` 的术语是非常重要的。一个网络连接connection包含了一个连接的所有信息。你可以将它看作一个网络配置configuration。“连接”包含了与其相关的所有信息,包括 [数据链路层][7] 和 [IP 地址信息][8] 。它们是 [OSI 网络模型][9] 中的第 2 和第 3 层。 + +当你在 Linux 上配置网络时,通常来说你是在为某个网络设备(它们是安装在一个电脑中的网络接口)配置连接。当一个连接被某个设备所使用,那么就可以说这个连接被激活active或者上线up了,反之是停用inactive下线down。 + +#### 添加网络连接 + +`nmcli` 允许你快速地创建网络连接并同时为该连接指定参数。为了通过使用“有线连接 2” `enp0s8` 来创建一个新的连接,你可以利用 `sudo` 来运行下面的命令: + +``` +$ sudo nmcli connection add type ethernet ifname enp0s8 +Connection 'ethernet-enp0s8' (09d26960-25a0-440f-8b20-c684d7adc2f5) successfully added. +``` + +其中 `type` 选项指定需要一个 [Ethernet][10] 类型的连接,而 `ifname`(接口名)选项指定你想要为这个连接使用的网络接口设备。 + +让我们看看发生了什么变化: + +``` +$ nmcli connection show +NAME                UUID                                  TYPE      DEVICE +Wired connection 1  ac3241e4-b424-35d6-aaa7-07498561688d  ethernet  enp0s3 +Wired connection 2  2279d917-fa02-390c-8603-3083ec5a1d3e  ethernet  enp0s8 +Wired connection 3  52d89737-de92-35ec-b082-8cf2e5ac36e6  ethernet  enp0s9 +ethernet-enp0s8     09d26960-25a0-440f-8b20-c684d7adc2f5  ethernet  --   +``` + +通过上图可以看到新的连接 `ethernet-enp0s8` 已经创建好了。它的 [通用唯一标识符][11]Universally Unique IDentifier(UUID)也一同被赋予,并且其连接类型为 “Ethernet”。我们可以使用 `up` 子命令再加上连接名称(或 UUID)来使得这个连接被激活: + +``` +$ nmcli connection up ethernet-enp0s8 +Connection successfully activated (D-Bus active path: /org/freedesktop/NetworkManager/ActiveConnection/4) +``` + +再次查看激活的连接: + +``` +$ nmcli connection show --active +NAME                UUID                                  TYPE      DEVICE +Wired connection 1  ac3241e4-b424-35d6-aaa7-07498561688d  ethernet  enp0s3 +ethernet-enp0s8     09d26960-25a0-440f-8b20-c684d7adc2f5  ethernet  enp0s8 +Wired connection 3  52d89737-de92-35ec-b082-8cf2e5ac36e6  ethernet  enp0s9 +``` + +可以看到新的连接 `ethernet-enp0s8` 现在已经被激活了,并且与 `enp0s8` 网络接口设备绑定。 + +#### 调整连接 + +`nmcli` 命令使得调整现有连接的参数变得更加容易。也许你想将某个网络接口从 [动态主机配置协议][12]Dynamic Host Configuration Protocol(DHCP)改为静态 IP 地址。 + +假设你需要为你的新连接分配一个固定的 IP 地址 `192.168.4.26`,那么你需要使用两个命令,一个用于设定 IP 地址,另一个用来将获取 IP 地址的方法改为 `manual`(手动): + +``` +$ nmcli connection modify ethernet-enp0s8 ipv4.address 192.168.4.26/24 +$ nmcli connection modify ethernet-enp0s8 ipv4.method manual +``` + +记得指定 [子网掩码][13],在我们这个测试的连接中,它是 [无类域间路由][14] Classless Inter-Domain Routing(CIDR)中的 `255.255.255.0` 或 `/24` + +为了使得你的更改生效,你需要通过停止再重新启用该连接。下面的第一个命令是停用该连接,第二个命令则是启用它: + +``` +$ nmcli connection down ethernet-enp0s8 +Connection 'ethernet-enp0s8' successfully deactivated (D-Bus active path: /org/freedesktop/NetworkManager/ActiveConnection/4) +$ nmcli connection up ethernet-enp0s8 +Connection successfully activated (D-Bus active path: /org/freedesktop/NetworkManager/ActiveConnection/6) +``` + +假如你想将连接设置为使用 DHCP,则需要将上面的 `manual` 改为 `auto`(自动): + +``` +$ nmcli connection modify ethernet-enp0s8 ipv4.method auto +``` + +### 设备管理 + +`nmcli` 命令中的 `device` 子命令允许你管理安装在你电脑中的网络接口。 + +#### 检查设备状态 + +可以使用下面的命令来快速检查所有网络接口的状态: + +``` +$ nmcli device status +DEVICE  TYPE      STATE      CONNECTION         +enp0s3  ethernet  connected  Wired connection 1 +enp0s8  ethernet  connected  ethernet-enp0s8     +enp0s9  ethernet  connected  Wired connection 3 +lo      loopback  unmanaged  --   +``` + +#### 显示设备详情 + +为了检查某个网络接口的详情,可以使用 `device` 子命令中的 `show` 操作。假如你不提供某个设备的名称,那么会获取并展示所有设备的详情。你可以上下翻动来查看这些信息。 + +要查看你最近添加的连接所对应的设备 `enp0s8`,你可以使用下面的命令,请注意验证它使用的 IP 地址是否为先前你要求设置的那个: + +``` +$ nmcli device show enp0s8 +GENERAL.DEVICE:                         enp0s8 +GENERAL.TYPE:                           ethernet +GENERAL.HWADDR:                         08:00:27:81:16:20 +GENERAL.MTU:                            1500 +GENERAL.STATE:                          100 (connected) +GENERAL.CONNECTION:                     ethernet-enp0s8 +GENERAL.CON-PATH:                       /org/freedesktop/NetworkManager/ActiveConnection/6 +WIRED-PROPERTIES.CARRIER:               on +IP4.ADDRESS[1]:                         192.168.4.26/24 +IP4.GATEWAY:                            -- +IP4.ROUTE[1]:                           dst = 192.168.4.0/24, nh = 0.0.0.0, mt = 103 +IP6.ADDRESS[1]:                         fe80::6d70:90de:cb83:4491/64 +IP6.GATEWAY:                            -- +IP6.ROUTE[1]:                           dst = fe80::/64, nh = ::, mt = 103 +IP6.ROUTE[2]:                           dst = ff00::/8, nh = ::, mt = 256, table=255 +``` + +上面的输出非常细致,它主要显示了下面这些内容: + + * **网络接口名称**,在这个示例中是 `enp0s8`,它是 [udev][15] 分配的 + * **网络连接类型**,在这个示例中是物理的 Ethernet 连接 + * 设备的媒介访问控制media access control(MAC)地址,它被用来在网络中识别该设备 + * [最大传输单元][17],在单个传输中最大协议数据单位的大小,任何大于这个大小的数据将被分为多个包来进行传输 + * 该设备**当前已经处于连接状态** + * 这个设备使用的连接名称是 `ethernet-enp0s8` + * 这个设备使用的 IP 地址如上面所要求的那样,被设置为 `192.168.4.26/24` + +其他的信息则是与这个设备连接的网络相关的默认路由和网关设置信息。 + +#### nmcli 的交互式编辑器 + +尽管 `nmcli` 是一个命令行工具,但它还包含一个基本的交互式编辑器,`edit` 子命令将为你指定的连接打开一个交互式编辑器,例如: + +``` +$ nmcli connection edit ethernet-enp0s8 +``` + +它将显示少量的帮助文字,接着是 `nmcli` 的命令提示符: + +``` +===| nmcli interactive connection editor |=== + +Editing existing '802-3-ethernet' connection: 'ethernet-enp0s8' + +Type 'help' or '?' for available commands. +Type 'print' to show all the connection properties. +Type 'describe [.]' for detailed property description. + +You may edit the following settings: connection, 802-3-ethernet (ethernet), 802-1x, dcb, sriov, ethtool, match, ipv4, ipv6, tc, proxy +nmcli> +``` + +假如你输入 `print` 然后敲击 `Enter` 键, `nmcli` 将列举出与这个接口相关的所有属性。这些属性有很多,你可以上下翻动来查看这个列表: + +``` +=============================================================================== +                 Connection profile details (ethernet-enp0s8) +=============================================================================== +connection.id:                          ethernet-enp0s8 +connection.uuid:                        09d26960-25a0-440f-8b20-c684d7adc2f5 +connection.stable-id:                   -- +connection.type:                        802-3-ethernet +connection.interface-name:              enp0s8 +connection.autoconnect:                 yes +connection.autoconnect-priority:        0 +connection.autoconnect-retries:         -1 (default) +connection.multi-connect:               0 (default) +connection.auth-retries:                -1 +connection.timestamp:                   1593967212 +connection.read-only:                   no +connection.permissions:                 -- +connection.zone:                        -- +connection.master:                      -- +connection.slave-type:                  -- +connection.autoconnect-slaves:          -1 (default) +connection.secondaries:                 -- +``` + +如果你想将你的连接改为 DHCP,则请输入 `goto ipv4` 然后敲 `Enter` 键: + +``` +nmcli> goto ipv4 +You may edit the following properties: method, dns, dns-search, dns-options, dns-priority, addresses, gateway, routes, route-metric, route-table, routing-rules, ignore-auto-routes, ignore-auto-dns, dhcp-client-id, dhcp-iaid, dhcp-timeout, dhcp-send-hostname, dhcp-hostname, dhcp-fqdn, dhcp-hostname-flags, never-default, may-fail, dad-timeout +nmcli ipv4> +``` + +你想改变的属性是 `method`,再继续敲 `set method auto` 然后敲 `Enter` 键: + +``` +nmcli ipv4> set method auto +Do you also want to clear 'ipv4.addresses'? [yes]: +``` + +假如你想让这个连接清除掉这个静态 IP 地址,则请敲 `Enter` 键,如果要保留,则输入 `no` 然后敲 `Enter` 键。假如你想在将来再次使用它,你可以保留这个 IP 地址。即便存储了一个静态的 IP 地址,如果 `method` 被设置为 `auto` ,它仍然会使用 DHCP。 + +最后输入 `save` 来保存你的更改: + +``` +nmcli ipv4> save +Connection 'ethernet-enp0s8' (09d26960-25a0-440f-8b20-c684d7adc2f5) successfully updated. +nmcli ipv4> +``` + +输入 `quit` 来离开 `nmcli` 的交互式编辑器窗口。假如你不想离开,可以输入 `back` 来回到最开始的命令行提示符界面,然后继续使用这个编辑器。 + +### nmcli 的更多内容 + +浏览交互式编辑器,你就可以看到 `nmcli` 有多少设定和每个设定有多少属性。交互式编辑器是一个简洁的工具,但如果需要在命令行或者在脚本中使用 `nmcli`,你还是需要使用常规的命令行版本。 + +现在你有了这些基础知识,你还可以查看 `nmcli` 的 [man 页面][2] 来查看它还可以提供什么更多功能。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/7/nmcli + +作者:[Dave McKay][a] +选题:[lujun9972][b] +译者:[FSSLC](https://github.com/FSSlc) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/davemckay +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/lenovo-thinkpad-laptop-concentration-focus-windows-office.png?itok=-8E2ihcF "Woman using laptop concentrating" +[2]: https://developer.gnome.org/NetworkManager/stable/nmcli.html +[3]: https://en.wikipedia.org/wiki/Application_programming_interface +[4]: https://man7.org/linux/man-pages/man8/ifconfig.8.html +[5]: https://en.wikipedia.org/wiki/Command-line_interface +[6]: https://en.wikipedia.org/wiki/Graphical_user_interface +[7]: https://en.wikipedia.org/wiki/Data_link_layer +[8]: https://en.wikipedia.org/wiki/IP_address +[9]: https://en.wikipedia.org/wiki/OSI_model +[10]: https://en.wikipedia.org/wiki/Ethernet +[11]: https://en.wikipedia.org/wiki/Universally_unique_identifier +[12]: https://en.wikipedia.org/wiki/Dynamic_Host_Configuration_Protocol +[13]: https://en.wikipedia.org/wiki/Subnetwork +[14]: https://en.wikipedia.org/wiki/Classless_Inter-Domain_Routing +[15]: https://en.wikipedia.org/wiki/Udev +[16]: https://en.wikipedia.org/wiki/MAC_address +[17]: https://en.wikipedia.org/wiki/Maximum_transmission_unit + diff --git a/published/202009/20200722 SCP user-s migration guide to rsync.md b/published/202009/20200722 SCP user-s migration guide to rsync.md new file mode 100644 index 0000000000..1a4120215e --- /dev/null +++ b/published/202009/20200722 SCP user-s migration guide to rsync.md @@ -0,0 +1,182 @@ +[#]: collector: (lujun9972) +[#]: translator: (wxy) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12575-1.html) +[#]: subject: (SCP user’s migration guide to rsync) +[#]: via: (https://fedoramagazine.org/scp-users-migration-guide-to-rsync/) +[#]: author: (chasinglogic https://fedoramagazine.org/author/chasinglogic/) + +scp 用户的 rsync 迁移指南 +====== + +![](https://img.linux.net.cn/data/attachment/album/202009/03/102942u7rxf79a7rsr9txz.jpg) + +在 [SSH 8.0 预发布公告][2]中,OpenSSH 项目表示,他们认为 scp 协议已经过时,不灵活,而且不容易修复,然后他们继而推荐使用 `sftp` 或 `rsync` 来进行文件传输。 + +然而,很多用户都是从小用着 `scp` 命令长大的,所以对 `rsync` 并不熟悉。此外,`rsync` 可以做的事情也远不止复制文件,这可能会给菜鸟们留下复杂和难以掌握的印象。尤其是,`scp` 命令的标志大体上可以直接对应到 `cp` 命令的标志,而 `rsync` 命令的标志却和它大相径庭。 + +本文将为熟悉 `scp` 的人提供一个介绍和过渡的指南。让我们跳进最常见的场景:复制文件和复制目录。 + +### 复制文件 + +对于复制单个文件而言,`scp` 和 `rsync` 命令实际上是等价的。比方说,你需要把 `foo.txt` 传到你在名为 `server` 的服务器上的主目录下: + +``` +$ scp foo.txt me@server:/home/me/ +``` + +相应的 `rsync` 命令只需要输入 `rsync` 取代 `scp`: + +``` +$ rsync foo.txt me@server:/home/me/ +``` + +### 复制目录 + +对于复制目录,就有了很大的分歧,这也解释了为什么 `rsync` 会被认为比 `scp` 更复杂。如果你想把 `bar` 目录复制到 `server` 服务器上,除了指定 `ssh` 信息外,相应的 `scp` 命令和 `cp` 命令一模一样。 + +``` +$ scp -r bar/ me@server:/home/me/ +``` + +对于 `rsync`,考虑的因素比较多,因为它是一个比较强大的工具。首先,我们来看一下最简单的形式: + +``` +$ rsync -r bar/ me@server:/home/me/ +``` + +看起来很简单吧?对于只包含目录和普通文件的简单情况,这就可以了。然而,`rsync` 更在意发送与主机系统中一模一样的文件。让我们来创建一个稍微复杂一些,但并不罕见的例子: + +``` +# 创建多级目录结构 +$ mkdir -p bar/baz +# 在其根目录下创建文件 +$ touch bar/foo.txt +# 现在创建一个符号链接指回到该文件 +$ cd bar/baz +$ ln -s ../foo.txt link.txt +# 返回原位置 +$ cd - +``` + +现在我们有了一个如下的目录树: + +``` +bar +├── baz +│ └── link.txt -> ../foo.txt +└── foo.txt + +1 directory, 2 files +``` + +如果我们尝试上面的命令来复制 `bar`,我们会注意到非常不同的(并令人惊讶的)结果。首先,我们来试试 `scp`: + +``` +$ scp -r bar/ me@server:/home/me/ +``` + +如果你 `ssh` 进入你的服务器,看看 `bar` 的目录树,你会发现它和你的主机系统有一个重要而微妙的区别: + +``` +bar +├── baz +│ └── link.txt +└── foo.txt + +1 directory, 2 files +``` + +请注意,`link.txt` 不再是一个符号链接,它现在是一个 `foo.txt` 的完整副本。如果你习惯于使用 `cp`,这可能会是令人惊讶的行为。如果你尝试使用 `cp -r` 复制 `bar` 目录,你会得到一个新的目录,里面的符号链接和 `bar` 的一样。现在如果我们尝试使用之前的 `rsync` 命令,我们会得到一个警告: + +``` +$ rsync -r bar/ me@server:/home/me/ +skipping non-regular file "bar/baz/link.txt" +``` + +`rsync` 警告我们它发现了一个非常规文件,并正在跳过它。因为你没有告诉它可以复制符号链接,所以它忽略了它们。`rsync` 在手册中有一节“符号链接”,解释了所有可能的行为选项。在我们的例子中,我们需要添加 `-links` 标志: + +``` +$ rsync -r --links bar/ me@server:/home/me/ +``` + +在远程服务器上,我们看到这个符号链接是作为一个符号链接复制过来的。请注意,这与 `scp` 复制符号链接的方式不同。 + +``` +bar/ +├── baz +│ └── link.txt -> ../foo.txt +└── foo.txt + +1 directory, 2 files +``` + +为了省去一些打字工作,并利用更多的文件保护选项,在复制目录时可以使用归档标志 `-archive`(简称 `-a`)。该归档标志将做大多数人所期望的事情,因为它可以实现递归复制、符号链接复制和许多其他选项。 + +``` +$ rsync -a bar/ me@server:/home/me/ +``` + +如果你感兴趣的话,`rsync` 手册页有关于存档标志的深入解释。 + +### 注意事项 + +不过,使用 `rsync` 有一个注意事项。使用 `scp` 比使用 `rsync` 更容易指定一个非标准的 ssh 端口。例如,如果 `server` 使用 8022 端口的 SSH 连接,那么这些命令就会像这样: + +``` +$ scp -P 8022 foo.txt me@server:/home/me/ +``` + +而在使用 `rsync` 时,你必须指定要使用的“远程 shell”命令,默认是 `ssh`。你可以使用 `-e` 标志来指定。 + +``` +$ rsync -e 'ssh -p 8022' foo.txt me@server:/home/me/ +``` + +`rsync` 会使用你的 `ssh` 配置;但是,如果你经常连接到这个服务器,你可以在你的 `~/.ssh/config` 文件中添加以下代码。这样你就不需要再为 `rsync` 或 `ssh` 命令指定端口了! + +``` +Host server + Port 8022 +``` + +另外,如果你连接的每一台服务器都在同一个非标准端口上运行,你还可以配置 `RSYNC_RSH` 环境变量。 + +### 为什么你还是应该切换到 rsync? + +现在我们已经介绍了从 `scp` 切换到 `rsync` 的日常使用案例和注意事项,让我们花一些时间来探讨一下为什么你可能想要使用 `rsync` 的优点。很多人在很久以前就已经开始使用 `rsync` 了,就是因为这些优点。 + +#### 即时压缩 + +如果你和服务器之间的网络连接速度较慢或有限,`rsync` 可以花费更多的 CPU 处理能力来节省网络带宽。它通过在发送数据之前对数据进行即时压缩来实现。压缩可以用 `-z` 标志来启用。 + +#### 差量传输 + +`rsync` 也只在目标文件与源文件不同的情况下复制文件。这可以在目录中递归地工作。例如,如果你拿我们上面的最后一个 `bar` 的例子,并多次重新运行那个 `rsync` 命令,那么在最初的传输之后就不会有任何传输。如果你知道你会重复使用这些命令,例如备份到 U 盘,那么使用 `rsync` 即使是进行本地复制也是值得的,因为这个功能可以节省处理大型数据集的大量的时间。 + +#### 同步 + +顾名思义,`rsync` 可以做的不仅仅是复制数据。到目前为止,我们只演示了如何使用 `rsync` 复制文件。如果你想让 `rsync` 把目标目录变成源目录的样子,你可以在 `rsync` 中添加删除标志 `-delete`。这个删除标志使得 `rsync` 将从源目录中复制不存在于目标目录中的文件,然后它将删除目标目录中不存在于源目录中的文件。结果就是目标目录和源目录完全一样。相比之下,`scp` 只会在目标目录下添加文件。 + +### 结论 + +对于简单的使用情况,`rsync` 并不比老牌的 `scp` 工具复杂多少。唯一显著的区别是在递归复制目录时使用 `-a` 而不是 `-r`。然而,正如我们看到的,`rsync` 的 `-a` 标志比 `scp` 的 `-r` 标志更像 `cp` 的 `-r` 标志。 + +希望通过这些新命令,你可以加快你的文件传输工作流程。 + +-------------------------------------------------------------------------------- + +via: https://fedoramagazine.org/scp-users-migration-guide-to-rsync/ + +作者:[chasinglogic][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://fedoramagazine.org/author/chasinglogic/ +[b]: https://github.com/lujun9972 +[1]: https://fedoramagazine.org/wp-content/uploads/2020/07/scp-rsync-816x345.png +[2]: https://lists.mindrot.org/pipermail/openssh-unix-dev/2019-March/037672.html diff --git a/published/202009/20200728 How to create a documentation site with Docsify and GitHub Pages.md b/published/202009/20200728 How to create a documentation site with Docsify and GitHub Pages.md new file mode 100644 index 0000000000..5c67a47e64 --- /dev/null +++ b/published/202009/20200728 How to create a documentation site with Docsify and GitHub Pages.md @@ -0,0 +1,259 @@ +[#]: collector: (lujun9972) +[#]: translator: (wxy) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12572-1.html) +[#]: subject: (How to create a documentation site with Docsify and GitHub Pages) +[#]: via: (https://opensource.com/article/20/7/docsify-github-pages) +[#]: author: (Bryant Son https://opensource.com/users/brson) + +如何使用 Docsify 和 GitHub Pages 创建一个文档网站 +====== + +> 使用 Docsify 创建文档网页并发布到 GitHub Pages 上。 + +![](https://img.linux.net.cn/data/attachment/album/202009/01/211718hws6rvvziks2zrkc.jpg) + +文档是帮助用户使用开源项目一个重要部分,但它并不总是开发人员的首要任务,因为他们可能更关注的是使他们的应用程序更好,而不是帮助人们使用它。对开发者来说,这就是为什么让发布文档变得更容易是如此有价值的原因。在本教程中,我将向你展示一个这样做的方式:将 [Docsify][2] 文档生成器与 [GitHub Pages][3] 结合起来。  + +如果你喜欢通过视频学习,可以访问 YouTube 版本的教程: + +- [video](https://youtu.be/ccA2ecqKyHo) + +默认情况下,GitHub Pages 会提示用户使用 [Jekyll][4],这是一个支持 HTML、CSS 和其它网页技术的静态网站生成器。Jekyll 可以从以 Markdown 格式编码的文档文件中生成一个静态网站,GitHub 会自动识别它们的 `.md` 或 `.markdown` 扩展名。虽然这种设置很好,但我想尝试一下其他的东西。 + +幸运的是,GitHub Pages 支持 HTML 文件,这意味着你可以使用其他网站生成工具(比如 Docsify)在这个平台上创建一个网站。Docsify 是一个采用 MIT 许可证的开源项目,其具有可以让你在 GitHub Pages 上轻松创建一个有吸引力的、先进的文档网站的[功能][5]。 + +![Docsify][6] + +### 开始使用 Docsify + +安装 Docsify 有两种方法: + + 1. 通过 NPM 安装 Docsify 的命令行界面(CLI)。 + 2. 手动编写自己的 `index.html`。 + +Docsify 推荐使用 NPM 方式,但我将使用第二种方案。如果你想使用 NPM,请按照[快速入门指南][8]中的说明进行操作。 + +### 从 GitHub 下载示例内容 + +我已经在[该项目的 GitHub 页面][9]上发布了这个例子的源代码。你可以单独下载这些文件,也可以通过以下方式[克隆这个存储库][10]。 + +``` +git clone https://github.com/bryantson/OpensourceDotComDemos +``` + +然后 `cd` 进入 `DocsifyDemo` 目录。 + +我将在下面为你介绍这些代码,它们克隆自我的示例存储库中,这样你就可以理解如何修改 Docsify。如果你愿意,你也可以从头开始创建一个新的 `index.html` 文件,就像 Docsify 文档中的的[示例][11]一样: + +``` + + + + + + + + + + + +
    + + + + +``` + +### 探索 Docsify 如何工作 + +如果你克隆了我的 [GitHub 存储库][10],并切换到 `DocsifyDemo` 目录下,你应该看到这样的文件结构: + +![File contents in the cloned GitHub][19] + +文件/文件夹名称 | 内容 +---|--- +`index.html` | 主要的 Docsify 初始化文件,也是最重要的文件 +`_sidebar.md` | 生成导航 +`README.md` | 你的文档根目录下的默认 Markdown 文件 +`images` | 包含了 `README.md` 中的示例 .jpg 图片 +其它目录和文件 | 包含可导航的 Markdown 文件 + +`index.html` 是 Docsify 可以工作的唯一要求。打开该文件,你可以查看其内容: + +``` + + + + + + + + + + Docsify Demo + + +
    + + + + +``` + +这本质上只是一个普通的 HTML 文件,但看看这两行: + +``` + +... 一些其它内容 ... + +``` + +这些行使用内容交付网络(CDN)的 URL 来提供 CSS 和 JavaScript 脚本,以将网站转化为 Docsify 网站。只要你包含这些行,你就可以把你的普通 GitHub 页面变成 Docsify 页面。 + +`` 标签后的第一行指定了要渲染的内容: + +``` +
    +``` + +Docsify 使用[单页应用][21](SPA)的方式来渲染请求的页面,而不是刷新一个全新的页面。 + +最后,看看 ` +``` + +在这个块中: + + * `el` 属性基本上是说:“嘿,这就是我要找的 `id`,所以找到它并在那里呈现。” + * 改变 `repo` 值,以确定当用户点击右上角的 GitHub 图标时,会被重定向到哪个页面。 + ![GitHub icon][22] + * 将 `loadSideBar` 设置为 `true` 将使 Docsify 查找包含导航链接的 `_sidebar.md` 文件。 + +你可以在 Docsify 文档的[配置][23]部分找到所有选项。 + +接下来,看看 `_sidebar.md` 文件。因为你在 `index.html` 中设置了 `loadSidebar` 属性值为 `true`,所以 Docsify 会查找 `_sidebar.md` 文件,并根据其内容生成导航文件。示例存储库中的 `_sidebar.md` 内容是: + +``` + + + +* [HOME](./) + +* [Tutorials](./tutorials/index) + * [Tomcat](./tutorials/tomcat/index) + * [Cloud](./tutorials/cloud/index) + * [Java](./tutorials/java/index) + +* [About](./about/index) + +* [Contact](./contact/index) +``` + +这会使用 Markdown 的链接格式来创建导航。请注意 “Tomcat”、“Cloud” 和 “Java” 等链接是缩进的;这意味着它们被渲染为父链接下的子链接。 + +像 `README.md` 和 `images` 这样的文件与存储库的结构有关,但所有其它 Markdown 文件都与你的 Docsify 网页有关。 + +根据你的需求,随意修改你下载的文件。下一步,你将把这些文件添加到你的 GitHub 存储库中,启用 GitHub Pages,并完成项目。 + +### 启用 GitHub 页面 + +创建一个示例的 GitHub 存储库,然后使用以下 GitHub 命令检出、提交和推送你的代码: + +``` +$ git clone 你的 GitHub 存储库位置 +$ cd 你的 GitHub 存储库位置 +$ git add . +$ git commit -m "My first Docsify!" +$ git push +``` + +设置你的 GitHub Pages 页面。在你的新 GitHub 存储库中,点击 “Settings”: + +![Settings link in GitHub][24] + +向下滚动直到看到 “GitHub Pages”: + +![GitHub Pages settings][25] + +查找 “Source” 部分: + +![GitHub Pages settings][26] + +点击 “Source” 下的下拉菜单。通常,你会将其设置为 “master branch”,但如果你愿意,也可以使用其他分支: + +![Setting Source to master branch][27] + +就是这样!你现在应该有一个链接到你的 GitHub Pages 的页面了。点击该链接将带你到那里,然后用 Docsify 渲染: + +![Link to GitHub Pages docs site][28] + +它应该像这样: + +![Example Docsify site on GitHub Pages][29] + +### 结论 + +通过编辑一个 HTML 文件和一些 Markdown 文本,你可以用 Docsify 创建一个外观精美的文档网站。你觉得怎么样?请留言,也可以分享其他可以和 GitHub Pages 一起使用的开源工具。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/7/docsify-github-pages + +作者:[Bryant Son][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/brson +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/browser_web_internet_website.png?itok=g5B_Bw62 (Digital creative of a browser on the internet) +[2]: https://docsify.js.org +[3]: https://pages.github.com/ +[4]: https://docs.github.com/en/github/working-with-github-pages/about-github-pages-and-jekyll +[5]: https://docsify.js.org/#/?id=features +[6]: https://opensource.com/sites/default/files/uploads/docsify1_ui.jpg (Docsify) +[7]: https://creativecommons.org/licenses/by-sa/4.0/ +[8]: https://docsify.js.org/#/quickstart?id=quick-start +[9]: https://github.com/bryantson/OpensourceDotComDemos/tree/master/DocsifyDemo +[10]: https://github.com/bryantson/OpensourceDotComDemos +[11]: https://docsify.js.org/#/quickstart?id=manual-initialization +[12]: http://december.com/html/4/element/html.html +[13]: http://december.com/html/4/element/head.html +[14]: http://december.com/html/4/element/meta.html +[15]: http://december.com/html/4/element/link.html +[16]: http://december.com/html/4/element/body.html +[17]: http://december.com/html/4/element/div.html +[18]: http://december.com/html/4/element/script.html +[19]: https://opensource.com/sites/default/files/uploads/docsify3_files.jpg (File contents in the cloned GitHub) +[20]: http://december.com/html/4/element/title.html +[21]: https://en.wikipedia.org/wiki/Single-page_application +[22]: https://opensource.com/sites/default/files/uploads/docsify4_github-icon_rev_0.jpg (GitHub icon) +[23]: https://docsify.js.org/#/configuration?id=configuration +[24]: https://opensource.com/sites/default/files/uploads/docsify5_githubsettings_0.jpg (Settings link in GitHub) +[25]: https://opensource.com/sites/default/files/uploads/docsify6_githubpageconfig_rev.jpg (GitHub Pages settings) +[26]: https://opensource.com/sites/default/files/uploads/docsify6_githubpageconfig_rev2.jpg (GitHub Pages settings) +[27]: https://opensource.com/sites/default/files/uploads/docsify8_setsource_rev.jpg (Setting Source to master branch) +[28]: https://opensource.com/sites/default/files/uploads/docsify9_link_rev.jpg (Link to GitHub Pages docs site) +[29]: https://opensource.com/sites/default/files/uploads/docsify2_examplesite.jpg (Example Docsify site on GitHub Pages) diff --git a/published/202009/20200804 Leaving Google- Five Years On.md b/published/202009/20200804 Leaving Google- Five Years On.md new file mode 100644 index 0000000000..796b5b0c01 --- /dev/null +++ b/published/202009/20200804 Leaving Google- Five Years On.md @@ -0,0 +1,141 @@ +[#]: collector: (lujun9972) +[#]: translator: (JonnieWayy) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12614-1.html) +[#]: subject: (Leaving Google: Five Years On) +[#]: via: (https://theartofmachinery.com/2020/08/04/leaving_google.html) +[#]: author: (Simon Arneaud https://theartofmachinery.com) + +离开 Google:五年以来 +====== + +![](https://img.linux.net.cn/data/attachment/album/202009/14/231115kqsf6q25s25ms66m.jpg) + +大约五年前的今天,我上交了 Google 员工证,然后走出了悉尼 Google 办公室,开启了一段自谋职业的崭新生活。我认为我应该详述一下这个故事,因为我通过阅读 [Michael Lynch][1] 的作品而收获颇丰。正如你所看到的,我仍然花费了几年时间才开始考虑写这篇文章,但是最终我告诉自己,倘若我不在五周年纪念日写它,我就永远也不会写了。 + +这篇文章有点儿长,但是我希望它对那些对于在大型技术公司工作感兴趣的新开发人员或是想要离职的大型企业雇员能够有所帮助。我将谈谈我进入 Google,在 Google 工作和辞职的故事,以及之后我做了什么。如果你想了解更多的细节,可以随时询问,不过我已经有很多博文要写,所以不能保证有什么深入的内容。 + +同样地,冒着显而易见的劳工风险:我已经有 5 年不在 Google 工作了,所以请不要以这个故事来作为当今 Google 或是 Google 雇员经历全貌的字面描述。但是,我认为其中的许多内容仍然与一般性的技术职业有关。 + +### 通往 Google 的艰辛道路 + +2005 年,我获得了第一份带薪的编程工作,是在当地的电力公司工作,把一些旧的 Pascal 代码用不同的编译器在不同的操作系统上运行。这基本上只是我为了挣外快而做的暑期工,同年我还刚刚开始攻读我数学和物理的学位。他们很高兴有一个本科生能够胜任这份工作。我被这些大人吓了一跳,因为他们不仅只是对我的编程爱好感兴趣,而且真的还会为此给我钱。 + +直到 2007 年毕业以前,我一直在做类似的工作。我喜欢编程工作,而 Google 是一家从事着很酷的编程工作的很酷的公司,因此我申请了实习。 Google 的面试过程以困难而著称,所以我花了好几个星期时间练习了所有我在网上能够找到的 Google 面试题。我认为 13 年里面试流程并没有发生太大的变化 —— 我提交了简历,受邀参加了几轮电话面试,这些面试问的几乎都是算法问题(我记得有一个动态规划问题和一个分治几何问题)。我通过了最初的几轮面试,然后受邀前往悉尼接受了由 Google 的工程师们进行的为期一天的现场面试。我回到家里,等待 Google HR 的电话,这个过程漫长得像是有一辈子。我被拒绝了。 + +对于我们收到的拒绝和失败感到难过很自然,因此我们并不会经常谈及它们。但是出于同样的原因,其他人也不会去谈论他们自己的失败,这只会使得情况变得更加糟糕。当我后来真的进入 Google 时,我觉得作为一个此前被拒绝过的人,我一定有哪里做得不对,但是有一天我和一群同事坐在一张桌子旁,开始交谈。那时候我才发现,实际上我身边的很多人都至少被拒绝过一次。我甚至都不是“最差的”。有个家伙开玩笑说,他肯定是因为 Google HR 厌倦了拒绝他才得以进来的。我说的也是一些相当厉害的工程师 —— 有些人负责着我一直在用的代码,而我打赌你也在用。 + +进行面试的公司通常会为每个名额面试两名或更多的候选人。这意味着比起录用,会有更多的拒绝,所以一般面试参与者被拒绝的可能性要大于被录用。然而我们一直忘记了这一点。四个开发人员参加面试,一个被录用了,其他三个在社交媒体上抱怨这场面试是如何的漏洞百出,因为他们个人被拒绝了。当然,面试远非完美,但是我们需要停止如此个人化地谈论它。 + +只要你能够找到问题所在并知道如何去改进自己,拒绝和失败就没有那么糟糕。Google 的面试主要针对算法,我在其中磕磕拌拌地摸索,但绝对没有能够脱颖而出。 + +在被 Google 拒绝以后,我得到了两样东西,并进行了为期一年的休假。第一件东西是澳大利亚商务编号(ABN),我用它来提供数学与科学补习课程,以及技术工作合同。我获得的另一样东西是一张大学科技图书馆的借书证。我当时并不打算再次去参加 Google 的面试,但是那次的面试经历告诉我还有很多东西是我所不知道的。我就在图书馆开设课程给大家做辅导,并在期间阅读书籍。顺便说一句,有些人认为我为我的补习业务所做的所有这些财务工作和其他东西很奇怪,而大多数补习老师都只收现金。但是我学到了许多对我日后生活很有帮助的东西,所以我一点儿都不后悔。 + +2009 年,我根据一个叫 Persi Diaconis 的魔术师转行为数学家的作品,进行了一个数学荣誉课程(也就是学士学位四年级)。计算机科学系让我选修他们的一个算法单元作为其中的一部分。 + +就像我所说的那样,我本来并没有打算再去 Google 面试,但是让我快速地讲讲这是怎么发生的。我从高中就开始学习日语,因此在 2012 年,我决定尝试在东京生活。这基本上行得通,除了我犯了一个相当大的错误 —— 我没有任何日语方面的纸质资质证明,因此很难获得工作面试。最终,我的一个已经被 Google 录用的朋友建议我再试一次。与 Google 所有的办事处一样, Google 东京的官方商务语言是英语,因此他们不要求我具有日语资质证明。 + +### Google 面试,再一次 + +我的朋友向 Google HR 推荐了我。这绝对有帮助,但是如果你自己得到了被推荐的机会,也不要太过于兴奋。它所能够确保的是你的简历会被注意到(不是小事)并且免去一次电话面试,但你仍然得通过剩下的电话面试和现场面试。 + +这一次我用来自 [Project Euler][2] 和 [Google CodeJam][3] 的题进行练习。电话面试过程中,我不得不在 Google Doc 上进行一些在线编程,这有点儿尴尬,但是除此以外电话面试一切顺利。然后我受邀前往六本木的 Mori Tower 办公室进行了为期一天的现场面试。 + +![Mori Tower in Tokyo, where I interviewed for Google. It's the sixth tallest building in the city, which means it's huge. \(Photo from here.\)][4] + +我的首个面试非常糟糕。我的脑子僵住了。我知道我能够解出那些题目,但是直到面试官走出房间我才想出答案。我立刻就感到很放松,并且意识到这是一个三元搜索问题。这是在是很令人沮丧,但是我觉得继续前进,看看剩下的面试进展如何。 + +其中的两道面试题很糟糕。其中之一直至今日仍然是我遇到过的最糟糕的面试问题。面试官说:“你用同一输入运行一个程序两次,得到了两个不同的结果。告诉我这是为什么。”我回答道:“当这种情况在现代计算机上发生而且并不在我的预期之中时,通常是竞态条件。”他只说:“不,这不是竞态条件。”然后看着我等着我的下一个回答。如果他有兴趣讨论一下的话,这个问题本该是一个很棒的问题,但是很显然他实际上只想玩“猜猜神秘数”。对于我所说的几乎全部内容,他只是回答:“不。”显然,该程序完全是确定性的,不存储任何状态,并且不依赖于环境(例如磁盘或是实时时钟),但却在每次执行时都给出不同的结果。我怀疑我们对于“被存储的状态”或是“环境”的含义还是某些东西有着不同的理解,但是我无法区分。有一次(变得绝望了)我试着问电子元件的温度变化是否会有影响,而他说:“不,那会是一个竞态条件,我已经告诉过你这不是竞态条件了。”最终,面试结束了,而我仍然不知道那个秘密数字是什么。 + +我讲这个故事的原因是,我听说过许多更为平淡的恐怖故事,用以证明面试官是憎恶面试者的坏人。然而,与流行的刻板印象所相反的是,当天的大多数面试基本上都还可以,面试官也很友好并且很尊重人。面试也着实很困难,因此最好减少面试官的工作量。希望那个“猜数字”面试官从 Google HR 那里得到的反馈是,他的问题对于作出聘用决定没什么帮助。 + +这次,面试带来了一份要约,但是有一个小问题:这份工作在悉尼,担任站点可靠性工程师(SRE)。我以前从未听说过 SRE,但是我和一位悉尼的资深 SRE 通了电话,他解释说他注意到了我在天然气行业从事嵌入式工程的经历,并且认为 SRE 会和适合我,因为同样强调可靠性与拟合紧密约束。 + +在东京花了大约一年时间来建立起自己的生活,我不想抛弃一切然后搬到悉尼,但是我绝不可能会拒绝一份来自 Google 的要约。与招聘人员交谈时,我确实犯了一个非常愚蠢的错误:我被问到当时能赚多少钱,然后我就脱口而出。[别这么做][5]。这意味着不管在面试中发生了什么事情,或是你上一份工作中被底薪了多少,或者其它什么。你可能会被拒绝,或者会在原来的薪水基础上得到一些象征性的提升,并且如果你试图进一步协商,会被认为疯狂而又不合理。就我而言,我的收入甚至远远低于 Google 的入门级职位。我无法肯定地说全是这样,但是在 2013 年我搬到了悉尼,在 Google Maps 成为了一名新毕业生级别的 SRE。 + +### 悉尼的 Google Maps SRE + +像 Maps 这样的产品实际上是若干个软件项目,每个都有自己的开发人员团队。甚至诸如路线查找之类的功能实际上也是多个软件项目 —— 从交通时刻表数据收集,到线路计算,再到结果渲染,等等等等。 SRE 的工作包含两个方面:一方面是为各个项目提供待命,实时响应任何生产事故;另一方面(在无需救火时)则是将生产事故中所积攒的经验应用到其他项目中去,并且发现其中可能出错的方式,或是发现使其性能更好的机会。Google 的 SRE 还需要像开发人员的内部咨询小组一样,对部署实践、自动化、监控或是类似的问题提供咨询。 + +这项工作相当紧张。作为一个团队,我们每周至少需要处理一次生产事故,否则就要为更多的服务提供支持。每个礼拜,悉尼的所有 SRE 都会聚在一起,交流发生过的故障事件或是有关如何使事情更好地运转的新技巧。学习曲线的感觉就像是再次成为了一名本科生。 + +我有时会感到震惊,听说我选择离开 Google 的人会问:“但是你不会想念那些福利吗?!”物质上的福利(例如伙食等等)绝对很棒,但是它们是你可以买到的东西,因此,不,它们不是我所想念的东西。如果你问我所想念的是什么,我会说是在那里工作的人们。与你可能听说过的不同,傲慢的人不喜欢在 Google 之类的地方工作。有一个臭名昭著的故事,一个自恋的人在 Google 找了份工作,并假装自己是各方面的顶级专家,让自己尴尬不已。他待了不到半年就离开了。总的来说,与我工作过的其他地方相比,这里的文化在傲慢、指责以及政治方面很少。另一方面,Google 并没有垄断好同事。 + +不过,有一种公司政治是个大问题。晋升需要“展示影响”,而众所周知的是,要做到这一点最简单的方法是发布一些新事物(不是惟一的方法,但是最简单)。结果是 Googler 们比起改进现有的解决方案,对于推广他们自己内测品质的原型方案更感兴趣。在 SRE 之间,我们经常开玩笑说, Google 内部有两种软件:一种是老的东西,工作得很好,但已经废弃了,甚至连考虑使用都是不够谷歌化的;另一种是热门的新东西,尽管它们还不能用,但却是今天 100% 可以使用的官方工具。作为 SRE,我们经常亲眼看到新的热点事物出了什么问题(有时甚至在没出 alpha 之前它就已经成了过时的旧东西)。([我此前已经对这类事物进行了更为深入的讨论。][6]) + +这不是我们这些愤世疾俗的 SRE 所想象的东西;这在公司中被公认为是一个问题,而我记得有人向我保证,晋升委员会已经开始通过维护工作等方式寻找关于其影响的证据。 + +### 晋升申请 + +2015 年,在 Google 工作了两年之后,我的经理告诉我,现在是时候申请一个高于我新毕业生水准的晋升了。晋升过程是每年两次由晋升委员会进行集中管理的。你可以先提出申请,然后加上一份对你所从事过的项目的简短描述,再加上同事的推荐信。委员会将会进行审查,然后给你赞成或反对的意见。仅仅有你经理的推荐是不够的,因为你的经理有想让你获得晋升的动机。手下有高级别的员工有助于你自己的职业发展。 + +长话短说,我提交了我的申请,而委员会说不。事实上,这是个相当糟糕的拒绝。我不记得详细的答复了,但感觉就像是委员会在我的申请中寻找可以不屑一顾的东西。例如,我从事过的一个项目是一个内部工具,它出现了功能需求的积压。我查看了这个项目,发现根本问题在于它已经超出了构建它的键值存储,需要一个合适的数据库。我主张切换到关系数据库,并实现了它:模式、数据迁移、查询、实时站点迁移等等。新查询的速度要快得多,而且(更重要的是)可以有效地支持新功能。在进行迁移之前,我必须要解决的一个问题是大部分代码没有被测试所覆盖,而这是由于大部分的代码都不可测试。我使用依赖注入以及[我此前讨论过的其他技巧][7]重构了代码,而这使我能够构建一组回归测试套件。我记得这个项目被驳回主要是被评价为测试单元的编写是“新毕业生水平的工作”。 + +我的经理真的很支持我,并且写了上诉。他没有给我看,但是我认为这是可以被缩减成 “WTF” 的若干页(更雄辩而详尽地论述)。以下是一些我也认为这一回复有点 “WTF” 的原因: + +Google SRE 有一种“关键人物”的概念。一个项目的关键人物有两个角色:一个是比起其他 SRE 对于软件项目有着更为深入的了解,以便你能够回答他们可能会提出的问题;另一个角色是作为项目本身的开发人员的第一联络人,以便他们的所有 SRE 问题都能得到回答。 Google 的职业阶梯指南说,关键人物不应该处于“新毕业生水准”,而应该晋升。正如我在申请中所写的,我是三个项目的关键人物。 + +我的关键人物经历使得想要找到同意支持我的晋升申请的资深开发人员很容易。当他们发现我是新毕业生级别时都十分震惊。他们都同意支持我的申请,认可我已经处在了一个更高的级别。 + +在我的申请之中,我提到曾担任过一组新毕业实习生的导师。当我提出申请时,他们之中的许多人都已经被聘用为了正式雇员。我足够资深,可以去担任他们的导师,但是还绝不足以晋升到比他们更高的级别。 + +给我经理上诉的回复与最初的审查截然不同。这次,我“大大超出了对于我‘新毕业生’级别工作的期望”,但是问题在于他们需要稍多一些时间来确保我能够晋升到新毕业生加一的级别。我被告知在接下来的 6 个月时间里,倘若我能够继续超出预期,直到下一个晋升周期,也许那时我就会得到晋升。上诉结束了;这就是最终结果。 + +我写了一封电子邮件,表示我要采取另一种选择。就像许多科技公司一样, Google 也有员工持股计划。在开始工作时,你会得到一笔象征性的补助金,而在各个“投资”里程碑时刻,你会收到真正的股份。我的下一次股票授予是在几个月之后。从那以后,我将不再为 Google 工作。 + +### 我离开的原因 + +任何辞职的决定并不容易,而某天你或许会面临同样的抉择。以下是一些有助于我作出决定的因素。([我在以前的一篇贴子里对一些这类想法进行了更深入的解释。][8]) + +如果你思考一下,考虑到我并不是字面意义上真正的应届毕业生, Google 的评价应该是这样的:“你正在做一些非常错误的事情。在 X、 Y 还有 Z 方面有所改进之前,你根本不会得到晋升。”被告知“你远远超出了预期,但是我们还需要 6 个月左右的时间”,这是毫无道理的。没有人关注我是否有能力做好我的工作。我得到了许多借口,但是没有能够帮助我提高的任何有用反馈。(注意:有时候你必须要明确地要求反馈。经理们可能会陷入捍卫自己所给出的绩效评级的陷阱,而不会去考虑报告是否需要反馈。) + +我也不确定晋升委员会会在 6 个月里看到什么他们在已经过去的 2 年时间里都没有看到的问题。他们难保不会再要求 6 个月时间?如果我需要花上多年时间来证明自己以获得新毕业生加一的级别晋升,那么我升到新毕业生加二的时候得有多老呢? + +刚加入 Google 时,我的工作级别无关紧要,因为我当时学到了那么多东西,并且能在我的简历里写入一家著名的公司。两年过后,等式变得不同了。 Google 所提供给我的未来所具有的价值正在下降,而 Google 之外机会的价值却正在上升。 Google 的职位实际上在 Google 之外几乎毫无意义。在过去的 5 年间,许多人都问过我在 Google 做过什么,但是没有一个人问我在 Google 是什么职位,也没人称我为“新毕业生”。尽管我在短期内受到了财务方面的打击,但实际上在我上交员工证的那天我就已经得到了晋升。 + +值得称赞的是,Google 没有做过任何类似于以下的事情,但是在其他公司中却很常见:试图让员工对于要求加薪感到内疚。在几年前我工作过的地方,一些工程师在一次成功发布会后,在许多紧要关头要求加薪。管理层扮演起了受害者的角色,并且指责工程师们是在“强迫他们”。(大约 6 个月时间后,他们失去了自己大部分的工程团队。)如果你真的愿意就辞职时间进行配合(例如,在发布日期之后,而不是前一周),并且愿意记录下你的知识并做了整理等等,那么你仅仅是由于雇主支付给你的工资不足而“强迫他们”。 + +名义上,我在 Google 留下了大量未授予的股票。但是知道你拥有股票时,股票才属于你。我只是得到了未来会有分红的承诺,而我可以将其除以所需的时间来将其转换为同等的工资率。为这项投资工作 2 个月是值得的,为了剩余的投资工作数年是不值得的。不要被授予股票的偏见所迷惑。 + +什么时候不应该辞职呢?嗯,与在其他地方相比,你能得到的很多吗?公司的职业发展道路不是天上掉下来的,他们是一系列的业务报价,代表着你将为什么样的公司评估而工作。如果你认为自己能得到很多(考虑到所有的薪酬和像是工作环境之类的无形资产),很好!否则,是时候认真考虑一下下一步该做什么了。 + +### 离开 Google 之后 + +我应当警告你的是,我采取了高增长的战略,但是牺牲了短期稳定性。如果对你而言稳定性更为重要,你应该做出不一样的选择。我的 A 计划、 B 计划、 C 计划都失败了,我最终花费了几个月时间苦苦找寻出路。最后,我在一家小型网店得到了一份合同,为 [Safety Town][9] 工作,一家政府建立的面向孩子们的道路安全网站。那里的薪水较之于 Google 是一个巨大的缩减,尤其是考虑到这是我几个月以来的第一份工作。但是,你知道,我真的很享受这个项目。当然了,它不像 Google 那么“酷”,而且可能一些学校里的孩子也不觉得它酷。另一方面,在 Google,我只是机器中的一个螺丝钉。 Safety Town 有一个小团队,每个人都扮演着至关重要的角色。在 Safety Town 项目中,我是后端工程师, Safety Town 当时是我唯一需要费心的事情。而且可能一些孩子已经在这个网站上学到了一两件有关道路安全的事情。从那以后,我做了很多项目,大多数都更大,但是我仍然会向人们展示 Safety Town。 + +![Screenshot of Safety Town home page, owned by Australian NSW government.][10] + +我记得 Google 悉尼办事处的一张海报,上面写着:“飞向月球吧!即使你错过了,你也会降落在群星之中!”人们很容易忘记,即使你不是在为知名公司或初创公司做“登月计划”,你也可以拥有高质量的生活。 + +这儿有一个帮助我获得合同的窍门。我会去参加悉尼的科技活动,站在能看到求职公告板的范围之中,等着看见有人在上面写东西。假设他们正在为一个保险公司项目写 CSS 开发方面的信息。即使我对 CSS 或保险不是特别感兴趣,我也会晃悠过去说:“嗨,这是个什么类型的保险项目?”这是最容易的开启谈话的方式,因为在他们努力往求职公告板上的狭小缝隙中写字的时候,满脑子都是这个项目。通常情况下,这样的谈话仍然不会为我带来一份工作,但是偶尔也会发现一些我能够帮上忙的东西。有些活动没有求职公告板,但是组织者们往往很乐意把麦克风递给别人几分钟。这为他们的活动增添了社区参与度。 + +我在做了一个政府采购的网站后,我取得了重大的突破,因为我学会了不至于对政府采购一窍不通。很难确切说出这些知识的价值,但是不到一年过后,我就签署了一份政府合同,比我此前所期望的要多了 40%。(不过,我如今没有做那么多的政府和大型企业的工作了。) + +大约一年半过后,我有了自己的一人公司。随着我声誉的建立,我逐渐获得了更多类似于 SRE 的工作。基本上,从事开发工作是我的“工作”,然后几个月后就有一个需要 SRE/DevOps 帮助的人联系了我。我事实上既喜欢 SRE,也喜欢纯开发工作,但是供求关系意味着 SRE 工作是个好工作。我仍然可以在空余时间编程。 + +说起这个,工作与生活的平衡是我在新生活中最喜欢的事情。没有人在两份合同之间给我酬劳,但是我可以通过在业余项目中学习新东西来充分利用这一间隙。在一个漫长而又紧张的合同之后,我休息了一下,[进行了为期一个月的背包徒步旅行,探索了日本乡村][11]。这是我期待了很长时间的一次旅行,但是在入职 Google 之前我需要更多的钱,而在 Google 供职期间我又需要更多的时间。自营职业远非没有压力,也不是适合每一个人的,但是有的压力会让你感到死气沉沉,有的压力则会让你越发充满活力。于我而言,自主营生是第二种,我想说,和在 Google 时相比,过去的 5 年间我的压力总体上有所减轻。对于我来说,至少我能够诚实地说我不后悔当初加入 Google,也不后悔当初离开 Google。 + +-------------------------------------------------------------------------------- + +via: https://theartofmachinery.com/2020/08/04/leaving_google.html + +作者:[Simon Arneaud][a] +选题:[lujun9972][b] +译者:[JonnieWayy](https://github.com/JonnieWayy) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://theartofmachinery.com +[b]: https://github.com/lujun9972 +[1]: https://mtlynch.io/why-i-quit-google/ +[2]: https://projecteuler.net +[3]: https://codingcompetitions.withgoogle.com/codejam +[4]: https://theartofmachinery.com/images/leaving_google/mori-tower.jpg +[5]: https://www.kalzumeus.com/2012/01/23/salary-negotiation/ +[6]: https://theartofmachinery.com/2019/03/19/hello_world_marketing.html +[7]: https://theartofmachinery.com/2016/03/28/dirtying_pure_functions_can_be_useful.html +[8]: https://theartofmachinery.com/2018/10/07/payrise_by_switching_jobs.html +[9]: https://www.safetytown.com.au/ +[10]: https://theartofmachinery.com/images/leaving_google/safetytown.png diff --git a/published/202009/20200813 How to use printf to format output.md b/published/202009/20200813 How to use printf to format output.md new file mode 100644 index 0000000000..1afc039622 --- /dev/null +++ b/published/202009/20200813 How to use printf to format output.md @@ -0,0 +1,207 @@ +[#]: collector: (lujun9972) +[#]: translator: (robsean) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12573-1.html) +[#]: subject: (How to use printf to format output) +[#]: via: (https://opensource.com/article/20/8/printf) +[#]: author: (Seth Kenlon https://opensource.com/users/seth) + +如何使用 printf 来格式化输出 +====== + +> 来了解一下 printf ,一个神秘的、灵活的和功能丰富的函数,可以替换 echo、print 和 cout。 + +![](https://img.linux.net.cn/data/attachment/album/202009/02/001109wp3xdtr27xop25e7.jpg) + +当我开始学习 Unix 时,我很早就接触到了 `echo` 命令。同样,我最初的 [Python][2] 课程也涉及到了 `print` 函数。再想起学习 C++ 和 [Java][2] 时学到 `cout` 和 `systemout`。似乎每种语言都骄傲地宣称拥有一种方便的单行输出方法,并生怕这种方式要过时一样宣传它。 + +但是当我翻开中级教程的第一页后,我遇到了 `printf`,一个晦涩难懂的、神秘莫测的,又出奇灵活的函数。本文一反向初学者隐藏 `printf` 这个令人费解的传统,旨在介绍这个不起眼的 `printf` 函数,并解释如何在几乎所有语言中使用它。 + +### printf 简史 + +术语 `printf` 代表“格式化打印print formatted”,它可能最早出现 [Algol 68][3] 编程语言中。自从它被纳入到 C 语言后,`printf` 已经在 C++、Java、Bash、PHP 中一次次重新实现,并且很可能在你最喜欢的 “后 C” 语言中再次出现。 + +显然,它很受欢迎,但很多人认为它的语法很复杂,尤其是与 `echo` 或 `print` 或 `cout` 等替代的函数相比尤为明显。例如,这是在 Bash 中的一个简单的 `echo` 语句: + +``` +$ echo hello +hello +$ +``` + +这是在 Bash 中使用 `printf` 得到同样结果: + +``` +$ printf "%s\n" hello +hello +$ +``` + +但是所增加的复杂性反而让你拥有很多功能,这是为什么 `printf` 值得学习的确切原因。 + +### printf 输出 + +在 `printf` 背后的基本思想是:它能够基于与内容*分离的*样式信息来格式化输出。例如,这里是 `printf` 认可的视作特殊字符的特定序列集合。你喜欢的语言可能会有或多或少的序列,但是通常包含: + + * `\n`: 新行 + * `\r`: 回车换行 + * `\t`: 水平制表符 + * `\NNN`: 一个包含一个到三个数字,使用八进制值表示的特殊字节 + +例如: + +``` +$ printf "\t\123\105\124\110\n" +     SETH +$ +``` + +在这个 Bash 示例中, `printf` 渲染一个制表符后,然后是分配给四个八进制值字符串的 ASCII 字符,并以一个生成一个新行(`\n`)的控制序列结束。 + +如果同样使用 `echo` 来输出会产生更多的字符: + +``` +$ printf "\t\123\105\124\110\n" +\t\123\105\124\110\n +$ +``` + +使用 Python 的 `print` 函数来完成同样的任务,你会发现 Python 的 `print` 命令比你想象的要强大: + +``` +>>> print("\t\123\n") +        S + +>>> +``` + +显然,Python 的 `print` 包含传统的 `printf` 特性以及简单的 `echo` 或 `cout` 的特性。 + +不过,这些示例包括的只是文字字符,尽管在某些情况下它们也很有用,但它们可能是 `printf` 最不重要的部分。`printf` 的真正的威力在于格式化说明。 + +### 使用 printf 格式化输出 + +格式化说明符是以一个百分号(`%`)开头的字符。 + +常见的格式化说明符包括: + + * `%s`: 字符串 + * `%d`: 数字 + * `%f`: 浮点数字 + * `%o`: 一个八进制的数字 + +这些格式化说明符是 `printf` 语句的占位符,你可以使用一个在其它地方提供的值来替换你的 `printf` 语句中的占位符。这些值在哪里提供取决于你使用的语言和它的语法,这里有一个简单的 Java 例子: + +``` +string var="hello\n"; +system.out.printf("%s", var); +``` + +把这个代码包裹在适当的样板文件中,在执行后,将呈现: + +``` +$ ./example +hello +$ +``` + +但是,当一个变量的内容更改时,有意思的地方就来了。假设你想基于不断增加的数字来更新输出: + +``` +#include + +int main() { +  int var=0; +  while ( var < 100) { +    var++; +  printf("Processing is %d% finished.\n", var); +  } +  return 0; +} +``` + +编译并运行: + +``` +Processing is 1% finished. +[...] +Processing is 100% finished. +``` + +注意,在代码中的两个 `%` 将被解析为一个打印出来的 `%` 符号。 + +### 使用 printf 限制小数位数 + +数字也可以是很复杂,`printf` 提供很多格式化选项。你可以对浮点数使用 `%f` 限制打印出多少个小数位。通过把一个点(`.`)和一个限制的数放置在百分符号和 `f` 之间, 你可以告诉 `printf` 打印多少位小数。这是一个简单的用 Bash 写的简练示例: + +``` +$ printf "%.2f\n" 3.141519 +3.14 +$ +``` + +类似的语法也适用于其它的语言。这里是一个 C 语言的示例: + +``` +#include +#include + +int main() { +  fprintf(stdout, "%.2f\n", 4 * atan(1.0)); +  return 0; +} +``` + +对于三位小数,使用 `.3f` ,依次类推。 + +### 使用 printf 来在数字上添加逗号 + +因为位数大的数字很难解读,所以通常使用一个逗号来断开大的数字。你可以在百分号和 `d` 之间放置一个撇号(`'`),让 `printf` 根据需要添加逗号: + +``` +$ printf "%'d\n" 1024 +1,024 +$ printf "%'d\n" 1024601 +1,024,601 +$ +``` + +### 使用 printf 来添加前缀零 + +`printf` 的另一个常用的用法是对文件名称中的数字强制实行一种特定的格式。例如,如果你在一台计算机上有 10 个按顺序排列的文件,计算机可能会把 `10.jpg` 排在 `1.jpg` 之前,这可能不是你的本意。当你以编程的方式写一个到文件时,你可以使用 `printf` 来用前缀为 0 的字符形成文件名称。这是一个简单的用 Bash 写的简练示例: + +``` +$ printf "%03d.jpg\n" {1..10} +001.jpg +002.jpg +[...] +010.jpg +``` + +注意:每个数字最多使用 3 位数字。 + +### 使用 printf + +正如这些 `printf` 示例所显示,包括控制字符,尤其是 `\n` ,可能会冗长,并且语法相对复杂。这就是为什么开发像 `echo` 和 `cout` 之类的快捷方式的原因。不过,如果你时不时地使用 `printf` ,你就会习惯于这种语法,并且它也会变成你的习惯。我不认为 `printf` 有任何理由成为你在日常活动中打印时的*首选*,但是它是一个很好的工具,当你需要它时,它不会拖累你。 + +花一些时间学习你所选择语言中的 `printf`,并且当你需要时就使用它。它是一个强有力的工具,你不会后悔随时可用的工具。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/8/printf + +作者:[Seth Kenlon][a] +选题:[lujun9972][b] +译者:[robsean](https://github.com/robsean) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/seth +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/coffee_tea_laptop_computer_work_desk.png?itok=D5yMx_Dr (Person drinking a hot drink at the computer) +[2]: https://opensource.com/resources/python +[3]: https://opensource.com/article/20/6/algol68 +[4]: http://www.opengroup.org/onlinepubs/009695399/functions/fprintf.html +[5]: http://www.opengroup.org/onlinepubs/009695399/functions/atan.html diff --git a/published/202009/20200823 Linux Jargon Buster- What is Desktop Environment in Linux.md b/published/202009/20200823 Linux Jargon Buster- What is Desktop Environment in Linux.md new file mode 100644 index 0000000000..63d9286ccb --- /dev/null +++ b/published/202009/20200823 Linux Jargon Buster- What is Desktop Environment in Linux.md @@ -0,0 +1,87 @@ +[#]: collector: (lujun9972) +[#]: translator: (wxy) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12579-1.html) +[#]: subject: (Linux Jargon Buster: What is Desktop Environment in Linux?) +[#]: via: (https://itsfoss.com/what-is-desktop-environment/) +[#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/) + +Linux 黑话解释:什么是桌面环境? +====== + +![][6] + +在桌面 Linux 世界中,最常用的术语之一就是桌面环境Desktop Environment(DE)。如果你是 Linux 的新手,你应该了解一下这个经常使用的术语。 + +### 什么是 Linux 中的桌面环境? + +桌面环境是一个组件的组合体,为你提供常见的图形用户界面graphical user interface(GUI)元素组件,如图标、工具栏、壁纸和桌面小部件。借助桌面环境,你可以像在 Windows 中一样使用鼠标和键盘使用 Linux。 + +有几种不同的桌面环境,这些桌面环境决定了你的 Linux 系统的样子以及你与它的交互方式。 + +大多数桌面环境都有自己的一套集成的应用程序和实用程序,这样用户在使用操作系统时就能得到统一的感受。所以,你会得到一个文件资源管理器、桌面搜索、应用程序菜单、壁纸和屏保实用程序、文本编辑器等。 + +如果没有桌面环境,你的 Linux 系统就只有一个类似于终端的实用程序,你只能用命令与之交互。 + +![Screenshot of GNOME Desktop Environment][1] + +### Linux 中各种桌面环境 + +桌面环境有时也被简称为 DE。 + +如前所述,Linux 有[各种桌面环境可供选择][2]。为什么这么说呢? + +可以把桌面环境看成是衣服。衣服决定了你的样子。如果你穿紧身牛仔裤和平底鞋,你会很好看,但穿着这些衣服跑步或登山就不舒服了。 + +[GNOME][3] 这样桌面环境注重现代的外观和用户体验,而像 [Xfce][4] 这样的桌面环境更注重使用更少的计算资源,而不是花哨的图形。 + +![Screenshot of Xfce Desktop Environment][5] + +你的衣服取决于你的需要,决定了你的外观,桌面环境也是如此。你必须决定你是想要一些好看的东西,还是让你的系统运行得更快。 + +一些[流行的桌面环境][2]有: + + * GNOME - 使用大量的系统资源,但给你一个现代的、精致的系统 + * Xfce - 外观复古但占用资源很少 + * KDE - 可高度定制的桌面,适度占用系统资源 + * LXDE - 唯一的重点是尽可能少地使用资源 + * Budgie - 现代的外观和适度占用系统资源 + +### Linux 发行版及其桌面环境变体 + +同样的桌面环境可以在多个 Linux 发行版上使用,一个 Linux 发行版也可能提供多个桌面环境。 + +例如,Fedora 和 Ubuntu 都默认使用 GNOME 桌面,但 Fedora 和 Ubuntu 都提供了其他桌面环境。 + +Linux 的优点和灵活性在于,你可以自己在任何 Linux 发行版上安装桌面环境。但大多数 Linux 发行版都为你省去了这个麻烦,并为不同的桌面环境提供了随时安装的 ISO 镜像。 + +例如 [Manjaro Linux][7] 默认使用 Xfce,但如果你喜欢在 Manjaro 上使用 GNOME,也可以下载 GNOME 版本的 ISO。 + +### 最后... + +桌面环境是 Linux 桌面计算机的重要组成部分,而 Linux 服务器通常依靠命令行界面。并不是说不能在 Linux 服务器上安装桌面环境,但这是画蛇添足,浪费了重要的系统资源,而这些资源可以被服务器上运行的应用程序所利用。 + +我希望你现在对 Linux 中的桌面环境有了一些了解。我强烈推荐你阅读我的[关于什么是 Linux 以及为什么有这么多 Linux 发行版][8]的解释文章。我很有预感,你会喜欢我用它做的比喻。 + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/what-is-desktop-environment/ + +作者:[Abhishek Prakash][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://itsfoss.com/author/abhishek/ +[b]: https://github.com/lujun9972 +[1]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/06/gnome-3-36-screenshot.jpg?resize=800%2C450&ssl=1 +[2]: https://itsfoss.com/best-linux-desktop-environments/ +[3]: https://www.gnome.org/ +[4]: https://www.xfce.org/ +[5]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2015/12/Ubuntu-XFCE-Chromebook-e1451426418482-1.jpg?resize=701%2C394&ssl=1 +[6]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/08/what-is-desktop-environment-linux.png?resize=800%2C450&ssl=1 +[7]: https://manjaro.org/ +[8]: https://itsfoss.com/what-is-linux/ diff --git a/published/202009/20200824 Recognize more devices on Linux with this USB ID Repository.md b/published/202009/20200824 Recognize more devices on Linux with this USB ID Repository.md new file mode 100644 index 0000000000..ecd9d71005 --- /dev/null +++ b/published/202009/20200824 Recognize more devices on Linux with this USB ID Repository.md @@ -0,0 +1,170 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12612-1.html) +[#]: subject: (Recognize more devices on Linux with this USB ID Repository) +[#]: via: (https://opensource.com/article/20/8/usb-id-repository) +[#]: author: (Alan Formy-Duval https://opensource.com/users/alanfdoss) + +利用这个 USB ID 仓库识别更多 Linux 上的设备 +====== + +> 这是一个包含了所有已知 USB 设备 ID 的开源项目。 + +![](https://img.linux.net.cn/data/attachment/album/202009/13/225426zpfbfopxhjxomuxf.jpg) + +市场上有成千上万的 USB 设备:键盘、扫描仪、打印机、鼠标和其他无数的设备,都能在 Linux 上工作。它们的供应商详情都存储在 USB ID 仓库中。 + +### lsusb + +Linux `lsusb` 命令列出了连接到系统的 USB 设备的信息,但有时信息不完整。例如,我最近注意到我的一个 USB 设备的品牌没有被识别。设备是可以使用的,但是在列出我所连接的 USB 设备的详情中没有提供任何识别信息。以下是我的 `lsusb` 命令的输出: + +``` +$ lsusb +Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub +Bus 001 Device 004: ID 046d:082c Logitech, Inc. +Bus 001 Device 003: ID 0951:16d2 Kingston Technology +Bus 001 Device 002: ID 18f8:1486   +Bus 001 Device 005: ID 051d:0002 American Power Conversion Uninterruptible Power Supply +Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub +``` + +正如你在最后一栏中看到的,有一个设备没有制造商描述。要确定这个设备是什么,我必须对我的 USB 设备树进行更深入的检查。幸运的是,`lsusb` 命令有更多的选项。其中一个选项是 `-D device`,来获取每个设备的详细信息,正如手册页面所解释的那样: + +> “不会扫描 `/dev/bus/usb` 目录,而只显示给定设备文件所属设备的信息。设备文件应该是类似 `/dev/bus/usb/001/001` 这样的文件。这个选项会像 `v` 选项一样显示详细信息,但你必须是 root 用户才行。" + +我认为如何将设备路径传递给 `lsusb` 命令并不容易,但在仔细阅读手册页和初始输出后,我能够确定如何构造它。USB 设备驻留在 UDEV 文件系统中。它们的设备路径始于 USB 设备目录 `/dev/bus/usb/`。路径的其余部分由设备的总线 ID 和设备 ID 组成。我的无描述设备是 `Bus 001 Device 002`,被翻译成了 `001/002`,完成的路径为 `/dev/bus/usb/001/002`。现在我可以把这个路径传给 `lsusb`。我还会用管道传给 `more`,因为这里往往有很多信息: + +``` +$ lsusb -D /dev/bus/usb/001/002 |more +Device: ID 18f8:1486   +Device Descriptor: +  bLength                18 +  bDescriptorType         1 +  bcdUSB               1.10 +  bDeviceClass            0 (Defined at Interface level) +  bDeviceSubClass         0 +  bDeviceProtocol         0 +  bMaxPacketSize0         8 +  idVendor           0x18f8 +  idProduct          0x1486 +  bcdDevice            1.00 +  iManufacturer           0 +  iProduct                1 +  iSerial                 0 +  bNumConfigurations      1 +  Configuration Descriptor: +    bLength                 9 +    bDescriptorType         2 +    wTotalLength           59 +    bNumInterfaces          2 +    bConfigurationValue     1 +    iConfiguration          0 +    bmAttributes         0xa0 +      (Bus Powered) +      Remote Wakeup +    MaxPower              100mA +    Interface Descriptor: +      bLength                 9 +      bDescriptorType         4 +      bInterfaceNumber        0 +      bAlternateSetting       0 +      bNumEndpoints           1 +      bInterfaceClass         3 Human Interface Device +      bInterfaceSubClass      1 Boot Interface Subclass +      bInterfaceProtocol      2 Mouse +      iInterface              0 +        HID Device Descriptor: +``` + +不幸的是,这里并没有提供我希望找到的细节。初始输出中出现的两个字段 `idVendor` 和 `idProduct` 都是空的。这有些帮助,因为往下看一下,就会发现 `Mouse` 这个词。所以,这个设备就是我的鼠标。 + +### USB ID 仓库 + +这让我不禁想知道如何才能填充这些字段,不仅是为了自己,也是为了其他 Linux 用户。原来已经有了一个开源项目:[USB ID 仓库][2]。它是一个公共仓库,它包含了 USB 设备中使用的所有已知 ID。它也被用于各种程序中,包括 [USB Utilities][3],用于显示人类可读的设备名称。 + +![The USB ID Repository Site][4] + +你可以从网站上或通过下载数据库来浏览特定设备的仓库。也欢迎用户提交新的数据。我要为我的鼠标提交数据,因为它没有在里面。 + +### 更新你的 USB ID + +USB ID 数据库存储在一个名为 `usb.ids` 的文件中。这个文件的位置可能会因 Linux 发行版的不同而不同。 + +在 Ubuntu 18.04 中,这个文件位于 `/var/lib/usbutils`。要更新数据库,使用命令 `update-usbids`,你需要用 root 权限或 `sudo` 来运行。 + +``` +$ sudo update-usbids +``` + +如果有新文件,它就会被下载。当前的文件将被备份,并被替换为新文件: + +``` +$ ls -la +total 1148 +drwxr-xr-x  2 root root   4096 Jan 15 00:34 . +drwxr-xr-x 85 root root   4096 Nov  7 08:05 .. +-rw-r--r--  1 root root 614379 Jan  9 15:34 usb.ids +-rw-r--r--  1 root root 551472 Jan 15 00:34 usb.ids.old +``` + +最新版本的 Fedora Linux 将数据库文件保存在 `/usr/share/hwdata` 中。而且,没有更新脚本。而是,数据库由一个名为 `hwdata` 的软件包维护。 + +``` +# dnf info hwdata + +Installed Packages +Name         : hwdata +Version      : 0.332 +Release      : 1.fc31 +Architecture : noarch +Size         : 7.5 M +Source       : hwdata-0.332-1.fc31.src.rpm +Repository   : @System +From repo    : updates +Summary      : Hardware identification and configuration data +URL          : https://github.com/vcrhonek/hwdata +License      : GPLv2+ +Description  : hwdata contains various hardware identification and configuration data, +             : such as the pci.ids and usb.ids databases. +``` + +现在我的 USB 设备列表在这个之前未命名的设备旁边显示了一个名字。比较一下上面的输出: + +``` +$ lsusb +Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub +Bus 001 Device 004: ID 046d:082c Logitech, Inc. HD Webcam C615 +Bus 001 Device 003: ID 0951:16d2 Kingston Technology +Bus 001 Device 014: ID 18f8:1486 [Maxxter] +Bus 001 Device 005: ID 051d:0002 American Power Conversion Uninterruptible Power Supply +Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub +``` + +你可能会注意到,随着仓库定期更新新设备和现有设备的详细信息,其他设备的描述也会发生变化。 + +### 提交新数据 + +提交新数据有两种方式:使用网站或通过电子邮件发送特殊格式的补丁文件。在开始之前,我阅读了提交指南。首先,我必须注册一个账户,然后我需要使用项目的提交系统提供我鼠标的 ID 和名称。添加任何 USB 设备的过程都是一样的。 + +你使用过 USB ID 仓库么?如果有,请在评论中分享你的反馈。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/8/usb-id-repository + +作者:[Alan Formy-Duval][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/alanfdoss +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/usb-hardware.png?itok=ROPtNZ5V (Multiple USB plugs in different colors) +[2]: http://www.linux-usb.org/usb-ids.html +[3]: https://sourceforge.net/projects/linux-usb/files/ +[4]: https://opensource.com/sites/default/files/uploads/theusbidrepositorysite.png (The USB ID Repository Site) +[5]: https://creativecommons.org/licenses/by-sa/4.0/ diff --git a/published/202009/20200826 Create and run Python apps on your Android phone.md b/published/202009/20200826 Create and run Python apps on your Android phone.md new file mode 100644 index 0000000000..09d8138226 --- /dev/null +++ b/published/202009/20200826 Create and run Python apps on your Android phone.md @@ -0,0 +1,169 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12582-1.html) +[#]: subject: (Create and run Python apps on your Android phone) +[#]: via: (https://opensource.com/article/20/8/python-android-mobile) +[#]: author: (Phani Adabala https://opensource.com/users/adabala) + +在你的 Android 手机上创建和运行 Python 应用 +====== + +> 使用 Termux 和 Flask 在你的移动设备上创建、开发和运行一个网页应用。 + +![](https://img.linux.net.cn/data/attachment/album/202009/04/214901zsohgryndzrcs6zz.jpg) + +学习和使用 Python 是很有趣的。由于它越来越受欢迎,有越来越多的方式可以让计算世界比现在更好。 + +想象一下,只需一个 Android 移动设备和开源工具,就可以构建和运行一个 Python 应用,无论是开发一个命令行工具从互联网上获取你最喜欢的文章,还是启动一个直接在掌上设备运行的网页服务器,所有这些都可以实现。这将完全改变你对移动设备的看法,将它从一个仅仅让你消费内容的设备变成一个帮助你发挥创造力的设备。 + +在本文中,我将演示运行和测试一个简单的 Python 应用所需的所有的工具、软件包、步骤和各种零零散散的东西。我使用 [Flask 框架][2]来创建一个简单的 “Hello, World!” 应用,并在一个简单而强大的网页服务器上运行。最棒的是,这一切都发生在手机上。不需要笔记本或台式机。 + +### 在 Android 上安装 Termux + +首先,[安装 Termux 应用程序][3]。Termux 是一个强大的终端仿真器,它提供了所有最流行的 Linux 命令,加上数百个额外的包,以便于安装。它不需要任何特殊的权限,你可以使用默认的 [Google Play][4] 商店或开源应用仓库 [F-Droid][5] 来安装。 + +![Welcome to Termux][6] + +安装 Termux 后,启动它并使用 Termux 的 `pkg` 命令执行一些必要的软件安装。 + +订阅附加仓库 `root-repo`: + +``` +$ pkg install root-repo +``` + +执行更新,使所有安装的软件达到最新状态。 + +``` +$ pkg update +``` + +最后,安装 Python: + +``` +$ pkg install python +``` + +![Install Python][7] + +安装和自动配置完成后,就可以构建你的应用了。 + +### 在 Android 上构建一个 Android 应用 + +现在你已经安装了一个终端,你可以在很大程度上像使用另一台 Linux 电脑一样使用你的 Android 手机。这很好地展示了终端到底有多强大。 + +首先创建一个项目目录: + +``` +$ mkdir Source +$ cd Source +``` + +接下来,创建一个 Python 虚拟环境。这是 Python 开发者的常见做法,它有助于让你的 Python 项目独立于你的开发系统(在本例中是你的手机)。在你的虚拟环境中,你将能够安装特定于你应用的 Python 模块。 + +``` +$ python -m venv venv +``` + +激活你的新虚拟环境(注意,开头的两个点用空格隔开) + +``` +$ . ./venv/bin/activate +(env)$ +``` + +请注意你的 shell 提示符现在以 `(env)` 开头,表示你在虚拟环境中。 + +现在使用 `pip` 安装 Flask Python 模块。 + +``` +(env) $ pip install flask +``` + +### 在 Android 上写 Python 代码 + +你已经准备好了。现在你需要为你的应用编写代码。 + +要做到这一点,你需要有经典文本编辑器的经验。我使用的是 `vi`。如果你不熟悉 `vi`,请安装并试用 `vimtutor`,它(如其名称所暗示的)可以教你如何使用这个编辑器。如果你有其他你喜欢的编辑器,如 `jove`、`jed`、`joe` 或 `emacs`,你可以安装并使用其中一个。 + +现在,由于这个演示程序非常简单,你也可以直接使用 shell 的 heredoc 功能,它允许你直接在提示符中输入文本。 + +``` +(env)$ cat << EOF >> hello_world.py +> from flask import Flask +> app = Flask(__name__) +> +> @app.route('/') +> def hello_world(): +> return 'Hello, World!' +> EOF +(env)$ +``` + +这只有六行代码,但有了它,你可以导入 Flask,创建一个应用,并将传入流量路由到名为 `hello_world` 的函数。 + +![Vim on Android][8] + +现在你已经准备好了网页服务器的代码。现在是时候设置一些[环境变量][9],并在你的手机上启动一个网页服务器了。 + +``` +(env) $ export FLASK_APP=hello_world.py +(env) $ export FLASK_ENV=development +(evn) $ python hello_world.py +``` + +![Running a Flask app on your phone][10] + +启动应用后,你会看到这条消息: + +``` +serving Flask app… running on http://127.0.0.1:5000/ +``` + +这表明你现在在 localhost(也就是你的设备)上运行着一个微型网页服务器。该服务器正在监听来自 5000 端口的请求。 + +打开你的手机浏览器并进入到 `http://localhost:5000`,查看你的网页应用。 + +![Your web app][11] + +你并没有损害手机的安全性。你只运行了一个本地服务器,这意味着你的手机不接受来自外部世界的请求。只有你可以访问你的 Flask 服务器。 + +为了让别人看到你的服务器,你可以在 `run` 命令中加入 `--host=0.0.0.0` 来禁用 Flask 的调试模式。这会打开你的手机上的端口,所以要谨慎使用。 + +``` +(env) $ export FLASK_ENV=”” +(env) $ flask run –host=0.0.0.0 +``` + +按 `Ctrl+C` 停止服务器(使用特殊的 `Termux` 键来作为 `Ctrl` 键)。 + +### 决定下一步怎么做 + +你的手机可能不是一个严肃的网页应用的理想服务器平台,但这个例子证明了可能性是无限的。你可能会在 Android 手机上编程,只是因为这是一种方便的实践方式,或者因为你有一个令人兴奋的本地化网页应用的新想法,或者你只是碰巧使用 Flask 应用来完成自己的日常任务。正如爱因斯坦曾经说过的“想象力比知识更重要”,对于任何一个新手编码者,或者一个经验丰富的 Linux 或 Android 爱好者来说,这是一个有趣的小项目。它可以扩展到无穷的层次,所以让你的好奇心接手,并做出一些令人兴奋的东西! + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/8/python-android-mobile + +作者:[Phani Adabala][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/adabala +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/tux_penguin_linux_android.jpg?itok=ctgANLI7 (Tux and Android stuffed animals on shelf) +[2]: https://opensource.com/article/18/4/flask +[3]: https://opensource.com/article/20/8/termux +[4]: https://play.google.com/store/apps/details?id=com.termux +[5]: https://f-droid.org/repository/browse/?fdid=com.termux +[6]: https://opensource.com/sites/default/files/termux-flask-1_0.webp (Welcome to Termux) +[7]: https://opensource.com/sites/default/files/termux-install-python.webp (Install Python) +[8]: https://opensource.com/sites/default/files/termux-python-vim.webp (Vim on Android) +[9]: https://opensource.com/article/19/8/what-are-environment-variables +[10]: https://opensource.com/sites/default/files/termux-flask-run.webp (Running a Flask app on your phone) +[11]: https://opensource.com/sites/default/files/flask-app-android.webp (Your web app) diff --git a/published/202009/20200826 Customize your GNOME desktop theme.md b/published/202009/20200826 Customize your GNOME desktop theme.md new file mode 100644 index 0000000000..096944a7a7 --- /dev/null +++ b/published/202009/20200826 Customize your GNOME desktop theme.md @@ -0,0 +1,97 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12586-1.html) +[#]: subject: (Customize your GNOME desktop theme) +[#]: via: (https://opensource.com/article/20/8/gnome-themes) +[#]: author: (Alan Formy-Duval https://opensource.com/users/alanfdoss) + +自定义你的 GNOME 桌面主题 +====== + +> 使用“优化”和它的用户主题扩展来改变你的 Linux UI。 + +![](https://img.linux.net.cn/data/attachment/album/202009/06/110116kmufkkc31akwfp1w.jpg) + +GNOME 是一个相当简单和精简的 Linux 图形用户界面(GUI),很多用户喜欢它的简约外观。虽然它基本上是开箱即用的,但你可以根据自己的喜好来定制 [GNOME][2] 。有了 GNOME “优化” 和用户主题扩展,你可以改变顶部栏、窗口标题栏、图标、光标和许多其他 UI 选项的外观。 + +### 开始使用 + +在你改变你的 GNOME 主题之前,你必须安装 “[优化][3]Tweaks” 并启用用户主题扩展。 + +#### 安装 GNOME “优化” + +你可以在 GNOME “软件”中找到“优化”,只需点击一个按钮就可以快速安装。 + +![Install Tweaks in Software Center][4] + +如果你喜欢命令行,请使用你的软件包管理器。例如,在 Fedora 或 CentOS 上: + +``` +$ sudo dnf install gnome-tweaks +``` + +在 Debian 或类似的发行版: + +``` +$ sudo apt install gnome-tweaks +``` + +#### 启用用户主题 + +要启用用户主题扩展,启动“优化”并选择“扩展Extensions”。找到 “用户主题User themes
    ”,点击滑块启用。 + +![Enable User Themes Extension][6] + +### 获取主题 + +现在你已经完成了这些预先条件,你已经准备好寻找和下载一些主题了。一个寻找新主题的好网站是 [GNOME-Look.org][7]。 + +在页面的左侧有一个主题类别的列表。当你找到一个你想要的主题,你需要下载它。我直接把 `.tar` 文件下载到我的家目录下的 `.themes` 目录(你可能需要先创建这个目录)。 + +``` +$ mkdir ~/.themes +``` + +如果你想让所有用户都能使用这个主题,请把它放在 `/usr/share/themes` 中。 + +``` +$ tar xvf theme_archive.tar.xz +``` + +下载后,解压压缩包。你可以删除 `.tar.xz` 文件以节省一些磁盘空间。 + +### 应用主题 + +要应用你的新主题,在“优化”中进入“外观Appearance”。在这里,你可以为你的桌面的每个方面选择不同的选项。 + +![Apply a theme][8] + +### 多样性是生活的调剂品 + +自从第一个图形界面面市以来,能够用不同的墙纸、颜色、字体等个性化电脑桌面一直是一个受欢迎的功能。GNOME “优化”和用户主题扩展可以在所有 GNU/Linux 操作系统上的 GNOME 桌面环境中实现这种自定义。而且开源社区还在持续提供广泛的主题、图标、字体和壁纸,任何人都可以下载、尝试和定制。 + +你最喜欢的 GNOME 主题是什么,你为什么喜欢它们?请在评论中分享。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/8/gnome-themes + +作者:[Alan Formy-Duval][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/alanfdoss +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/custom_gnomes.png?itok=iG98iL8d (Gnomes in a window.) +[2]: https://www.gnome.org/ +[3]: https://wiki.gnome.org/Apps/Tweaks +[4]: https://opensource.com/sites/default/files/uploads/gnome-install_tweaks_gui.png (Install Tweaks in Software Center) +[5]: https://creativecommons.org/licenses/by-sa/4.0/ +[6]: https://opensource.com/sites/default/files/uploads/gnome-enable_user_theme_extension.png (Enable User Themes Extension) +[7]: https://www.gnome-look.org +[8]: https://opensource.com/sites/default/files/uploads/gnome-apply_theme.png (Apply a theme) diff --git a/published/202009/20200826 Manage your software repositories with this open source tool.md b/published/202009/20200826 Manage your software repositories with this open source tool.md new file mode 100644 index 0000000000..47eee04059 --- /dev/null +++ b/published/202009/20200826 Manage your software repositories with this open source tool.md @@ -0,0 +1,85 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12617-1.html) +[#]: subject: (Manage your software repositories with this open source tool) +[#]: via: (https://opensource.com/article/20/8/manage-repositories-pulp) +[#]: author: (Melanie Corr https://opensource.com/users/melanie-corr) + +用这个开源工具管理你的软件仓库 +====== + +> 这篇文章介绍 Pulp,一个开源仓库管理解决方案,它的使用范围和功能在不断增长。 + +![](https://img.linux.net.cn/data/attachment/album/202009/15/205353hlidoullmmj44vzq.jpg) + +[Foreman][2] 是一个强大的管理和自动化产品,它为 Linux 环境的管理员提供了企业级的解决方案,它适用于四个关键场景:供应管理、配置管理、补丁管理和内容管理。Foreman 中内容管理功能的一个主要组成部分是由 Pulp 项目提供的。虽然 Pulp 是这个产品的一个组成部分,但它也是一个独立的、自由开源的项目,自身也在取得巨大的进步。 + +让我们来看看 Pulp 项目,特别是最新版本 Pulp 3 的功能。 + +### 什么是 Pulp? + +Pulp 是一个管理软件包仓库,并将其提供给大量的消费者的平台。你可以使用 Pulp 在不同环境中镜像、同步、上传和推广各种内容,如 RPM、Python 包、Ansible 集合、容器镜像等。如果你有几十个、几百个甚至上千个软件包,并需要更好的方式来管理它们,Pulp 可以帮助你。 + +最新的主要版本是 [Pulp 3][3],它于 2019 年 12 月发布。Pulp 3 是多年来收集用户需求的结晶,并对现有的 Pulp 架构进行了全面的技术改造,以提高可靠性和灵活性。另外,它还包含了大量的新功能。 + +### 谁在使用 Pulp? + +大多数情况下,在 Pulp 用户管理的企业软件环境中,内容的稳定性和可靠性是最重要的。Pulp 用户希望有一个平台来开发内容,而不用担心仓库可能会消失。他们希望以安全的方式在其生命周期环境的不同阶段推广内容,优化磁盘空间并扩展环境以满足新的需求。他们还需要灵活处理各种内容类型。Pulp 3 提供了这些以及更多功能。 + +### 在一处管理各类内容 + +安装 Pulp 后,你可以为你计划管理的内容类型添加[内容插件][4],将内容镜像到本地,添加私人托管的内容,并根据你的需求混合内容。例如,如果你是 Ansible 用户,而你又不想在 Ansible Galaxy 上托管你的私有内容,你可以添加 Pulp Ansible 插件,镜像你所需要的公共 Ansible 内容,并将 Pulp 作为一个内部平台,在你的组织中管理和分发可扩展的公共和私有 Ansible 角色和集合的混合。你可以用任何内容类型执行此操作。有各种各样的内容插件可供选择,包括 RPM、Debian、Python、容器和 Ansible 等等。还有一个文件插件,你可以用它来管理 ISO 镜像等文件。 + +如果你没有找到你所需的内容类型插件,Pulp 3 引入了新的插件 API 和插件模板,你可以轻松创建一个属于自己的 Pulp 插件。你可以根据[插件编写指南][5]自动生成一个最小可用的插件,然后从那里开始构建。 + +### 高可用性 + +在 Pulp 3 中,从 MongoDB 到 PostgreSQL 的转变促进了性能和数据完整性的重大改进。Pulp 用户现在有了一个完全开源的技术栈,它可以提供高可用性(HA)和更好的扩展性。 + +### 仓库版本管理 + +使用 Pulp 3,你可以毫无风险地进行试验。每次你添加或删除内容时,Pulp 都会创建一个不可变的仓库版本,这样你就可以回滚到早期的版本,从而保证操作的安全性和稳定性。通过使用发布和分发,你可以公开一个仓库的多个版本,你可以将其作为回滚到早期版本的另一种方法。如要回滚,你可以简单地将你的分发指向一个旧的发布。 + +### 磁盘优化 + +任何软件开发环境的主要挑战之一是磁盘优化。如果你不断地下载包,例如,你今天需要但明天不再需要的仓库每日构建,那么磁盘空间将很快成为一个问题。Pulp 3 的设计已经考虑到了磁盘优化。当默认下载并保存所有的软件包,你也可以启用“按需”或“流式”选项。“按需”选项只下载和保存客户要求的内容,从而节省了磁盘空间。使用“流式”选项,它也会根据客户的要求进行下载,但它不会将内容保存在 Pulp 中。这对于同步内容是非常理想的,例如,从一个每日仓库同步,并让你在后期免于执行磁盘清理。 + +### 多种存储选项 + +即使进行了最好的磁盘优化,随着项目的发展,你可能需要一种方法来扩展你的部署以满足需求。除了本地文件存储,Pulp 还支持一系列的云存储选项,如 Amazon S3 和 Azure,以确保你可以扩展满足你的部署需求。 + +### 保护你的内容 + +Pulp 3 可以选择添加 [Certguard][6] 插件,该插件提供了一个支持 X.509 的 ContentGuard,它要求客户在收到 Pulp 的内容之前提交证明其对内容的权利的证书。 + +只要客户端的证书没有过期,且由证书颁发机构签署,并在创建时存储在 Certguard 上,任何客户端在请求时提供基于 X.509 或基于 Red Hat 订阅管理证书都将获得授权。客户端使用安全传输层(TLS)提供证书,这证明客户端不仅有证书,还有它的密钥。你可以放心地开发,知道你的内容正在受到保护。 + +Pulp 团队也在积极为整个 Pulp 部署一个基于角色的访问控制系统,这样管理员就可以确保正确的用户可以访问正确的环境。 + +### 在容器中试用 Pulp + +如果你有兴趣亲自评估 Pulp 3,你可以使用 Docker 或 Podman 轻松[在容器中安装 Pulp 3][7]。Pulp 团队一直在努力简化安装过程。你也可以使用 [Ansible 剧本][8] 来自动完成 Pulp 3 的全部安装和配置。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/8/manage-repositories-pulp + +作者:[Melanie Corr][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/melanie-corr +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/fruit-orange-pomegranate-pulp-unsplash.jpg?itok=4cvODZDJ (Oranges and pomegranates) +[2]: https://opensource.com/article/17/8/system-management-foreman +[3]: https://pulpproject.org/about-pulp-3/ +[4]: https://pulpproject.org/content-plugins/ +[5]: https://docs.pulpproject.org/plugins/plugin-writer/index.html +[6]: https://pulp-certguard.readthedocs.io/en/latest/ +[7]: https://pulpproject.org/pulp-in-one-container/ +[8]: https://pulp-installer.readthedocs.io/en/latest/ diff --git a/published/202009/20200826 What is DNS and how does it work.md b/published/202009/20200826 What is DNS and how does it work.md new file mode 100644 index 0000000000..344cd3d372 --- /dev/null +++ b/published/202009/20200826 What is DNS and how does it work.md @@ -0,0 +1,135 @@ +[#]: collector: (lujun9972) +[#]: translator: (wxy) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12602-1.html) +[#]: subject: (What is DNS and how does it work?) +[#]: via: (https://www.networkworld.com/article/3268449/what-is-dns-and-how-does-it-work.html) +[#]: author: (Keith Shaw, Josh Fruhlinger ) + +什么是 DNS,它是如何工作的? +====== + +> 域名系统解析互联网网站的名称及其底层 IP 地址,并在此过程中增加了效率和安全性。 + +![](https://images.techhive.com/images/article/2017/04/domain-name-systems-dns-100719737-large.jpg) + +域名系统Domain Name System(DNS)是互联网的基础之一,然而大多数不懂网络的人可能并不知道他们每天都在使用它来工作、查看电子邮件或在智能手机上浪费时间。 + +就其本质而言,DNS 是一个与数字匹配的名称目录。这些数字,在这里指的是 IP 地址,计算机用 IP 地址来相互通信。大多数对 DNS 的描述都是用电话簿来比喻,这对于 30 岁以上的人来说是没有问题的,因为他们知道电话簿是什么。 + +如果你还不到 30 岁,可以把 DNS 想象成你的智能手机的联系人名单,它将人们的名字与他们的电话号码及电子邮件地址进行匹配,然后这个联系人名单的就像地球上的人一样多。 + +### DNS 简史 + +当互联网还非常、非常小的时候,人们很容易将特定的 IP 地址与特定的计算机对应起来,但随着越来越多的设备和人加入到不断发展的网络中,这种简单的情况就没法持续多久了。现在仍然可以在浏览器中输入一个特定的 IP 地址来到达一个网站,但当时和现在一样,人们希望得到一个由容易记忆的单词组成的地址,也就是我们今天所认识的那种域名(比如 linux.cn)。在 20 世纪 70 年代和 80 年代早期,这些名称和地址是由一个人指定的,她是[斯坦福大学的 Elizabeth Feinler][2],她在一个名为 [HOSTS.TXT][3] 的文本文件中维护着一个主列表,记录了每一台连接互联网的计算机。 + +随着互联网的发展,这种局面显然无法维持下去,尤其是因为 Feinler 只处理加州时间下午 6 点之前的请求,而且圣诞节也要请假。1983 年,南加州大学的研究人员 Paul Mockapetris 受命在处理这个问题的多种建议中提出一个折中方案。但他基本上无视了所有提出的建议,而是开发了自己的系统,他将其称为 DNS。虽然从那时起,现今的它显然发生了很大的变化,但在基本层面上,它的工作方式仍然与将近 40 年前相同。 + +### DNS 服务器是如何工作的 + +将名字与数字相匹配的 DNS 目录并不是整个藏在互联网的某个黑暗角落。截至 2017 年底,[它记录了超过 3.32 亿个域名][4],如果作为一个目录确实会非常庞大。就像互联网本身一样,该目录分布在世界各地,存储在域名服务器(一般简称为 DNS 服务器)上,这些服务器都会非常有规律地相互沟通,以提供更新和冗余。 + +### 权威 DNS 服务器与递归 DNS 服务器的比较 + +当你的计算机想要找到与域名相关联的 IP 地址时,它首先会向递归recursive DNS 服务器(也称为递归解析器)提出请求。递归解析器是一个通常由 ISP 或其他第三方提供商运营的服务器,它知道需要向其他哪些 DNS 服务器请求解析一个网站的名称与其 IP 地址。实际拥有所需信息的服务器称为权威authoritative DNS 服务器。 + +### DNS 服务器和 IP 地址 + +每个域名可以对应一个以上的 IP 地址。事实上,有些网站有数百个甚至更多的 IP 地址与一个域名相对应。例如,你的计算机访问 [www.google.com][5] 所到达的服务器,很可能与其他国家的人在浏览器中输入相同的网站名称所到达的服务器完全不同。 + +该目录的分布式性质的另一个原因是,如果这个目录只在一个位置,在数百万,可能是数十亿在同一时间寻找信息的人中共享,那么当你在寻找一个网站时,你需要花费多少时间才能得到响应 —— 这就像是排着长队使用电话簿一样。 + +### 什么是 DNS 缓存? + +为了解决这个问题,DNS 信息在许多服务器之间共享。但最近访问过的网站的信息也会在客户端计算机本地缓存。你有可能每天使用 google.com 好几次。你的计算机不是每次都向 DNS 名称服务器查询 google.com 的 IP 地址,而是将这些信息保存在你的计算机上,这样它就不必访问 DNS 服务器来解析这个名称的 IP 地址。额外的缓存也可能出现在用于将客户端连接到互联网的路由器上,以及用户的互联网服务提供商(ISP)的服务器上。有了这么多的缓存,实际上对 DNS 名称服务器的查询数量比看起来要少很多。 + +### 如何找到我的 DNS 服务器? + +一般来说,当你连接到互联网时,你使用的 DNS 服务器将由你的网络提供商自动建立。如果你想看看哪些服务器是你的主要名称服务器(一般是递归解析器,如上所述),有一些网络实用程序可以提供关于你当前网络连接的信息。[Browserleaks.com][6] 是一个很好的工具,它提供了很多信息,包括你当前的 DNS 服务器。 + +### 我可以使用 8.8.8.8 的 DNS 吗? + +但要记住,虽然你的 ISP 会设置一个默认的 DNS 服务器,但你没有义务使用它。有些用户可能有理由避开他们 ISP 的 DNS —— 例如,有些 ISP 使用他们的 DNS 服务器将不存在的地址的请求重定向到[带有广告的网页][7]。 + +如果你想要一个替代方案,你可以将你的计算机指向一个公共 DNS 服务器,以它作为一个递归解析器。最著名的公共 DNS 服务器之一是谷歌的,它的 IP 地址是 8.8.8.8 和 8.8.4.4。Google 的 DNS 服务往往是[快速的][8],虽然对 [Google 提供免费服务的别有用心的动机][9]有一定的质疑,但他们无法真正从你那里获得比他们从 Chrome 浏览器中获得的更多信息。Google 有一个页面,详细说明了如何[配置你的电脑或路由器][10]连接到 Google 的 DNS。 + +### DNS 如何提高效率 + +DNS 的组织结构有助于保持事情的快速和顺利运行。为了说明这一点,让我们假设你想访问 linux.cn。 + +如上所述,对 IP 地址的初始请求是向递归解析器提出的。递归解析器知道它需要请求哪些其他 DNS 服务器来解析一个网站(linux.cn)的名称与其 IP 地址。这种搜索会传递至根服务器,它知道所有顶级域名的信息,如 .com、.net、.org 以及所有国家域名,如 .cn(中国)和 .uk(英国)。根服务器位于世界各地,所以系统通常会将你引导到地理上最近的一个服务器。 + +一旦请求到达正确的根服务器,它就会进入一个顶级域名(TLD)名称服务器,该服务器存储二级域名的信息,即在你写在 .com、.org、.net 之前的单词(例如,linux.cn 的信息是 “linux”)。然后,请求进入域名服务器,域名服务器掌握着网站的信息和 IP 地址。一旦 IP 地址被找到,它就会被发回给客户端,客户端现在可以用它来访问网站。所有这一切都只需要几毫秒的时间。 + +因为 DNS 在过去的 30 多年里一直在工作,所以大多数人都认为它是理所当然的。在构建系统的时候也没有考虑到安全问题,所以[黑客们充分利用了这一点][11],制造了各种各样的攻击。 + +### DNS 反射攻击 + +DNS 反射攻击可以用 DNS 解析器服务器的大量信息淹没受害者。攻击者使用伪装成受害者的 IP 地址来向他们能找到的所有开放的 DNS 解析器请求大量的 DNS 数据。当解析器响应时,受害者会收到大量未请求的 DNS 数据,使其不堪重负。 + +### DNS 缓存投毒 + +[DNS 缓存投毒][12]可将用户转移到恶意网站。攻击者设法在 DNS 中插入虚假的地址记录,这样,当潜在的受害者请求解析其中一个中毒网站的地址时,DNS 就会以另一个由攻击者控制的网站的 IP 地址作出回应。一旦访问了这些假网站,受害者可能会被欺骗,泄露密码或下载了恶意软件。 + +### DNS 资源耗尽 + +[DNS 资源耗尽][13]攻击可以堵塞 ISP 的 DNS 基础设施,阻止 ISP 的客户访问互联网上的网站。攻击者注册一个域名,并通过将受害者的名称服务器作为域名的权威服务器来实现这种攻击。因此,如果递归解析器不能提供与网站名称相关的 IP 地址,就会询问受害者的名称服务器。攻击者会对自己注册的域名产生大量的请求,并查询不存在的子域名,这就会导致大量的解析请求发送到受害者的名称服务器,使其不堪重负。 + +### 什么是 DNSSec? + +DNS 安全扩展是为了使参与 DNS 查询的各级服务器之间的通信更加安全。它是由负责 DNS 系统的互联网名称与数字地址分配机构Internet Corporation for Assigned Names and Numbers(ICANN)设计的。 + +ICANN 意识到 DNS 顶级、二级和三级目录服务器之间的通信存在弱点,可能会让攻击者劫持查询。这将允许攻击者用恶意网站的 IP 地址来响应合法网站的查询请求。这些网站可能会向用户上传恶意软件,或者进行网络钓鱼和网络欺骗攻击。 + +DNSSec 将通过让每一级 DNS 服务器对其请求进行数字签名来解决这个问题,这就保证了终端用户发送进来的请求不会被攻击者利用。这就建立了一个信任链,这样在查询的每一步,请求的完整性都会得到验证。 + +此外,DNSSec 可以确定域名是否存在,如果不存在,它就不会让该欺诈性域名交付给寻求域名解析的无辜请求者。 + +随着越来越多的域名被创建,越来越多的设备继续通过物联网设备和其他“智能”系统加入网络,随着[更多的网站迁移到 IPv6][14],将需要维持一个健康的 DNS 生态系统。大数据和分析的增长也[带来了对 DNS 管理的更大需求][15]。 + +### SIGRed: 蠕虫病毒 DNS 漏洞再次出现 + +最近,随着 Windows DNS 服务器缺陷的发现,全世界都看到了 DNS 中的弱点可能造成的混乱。这个潜在的安全漏洞被称为 SIGRed,[它需要一个复杂的攻击链][16],但利用未打补丁的 Windows DNS 服务器,有可能在客户端安装和执行任意恶意代码。而且该漏洞是“可蠕虫传播”的,这意味着它可以在没有人为干预的情况下从计算机传播到计算机。该漏洞被认为足够令人震惊,以至于美国联邦机构[被要求他们在几天时间内安装补丁][17]。 + +### DNS over HTTPS:新的隐私格局 + +截至本报告撰写之时,DNS 正处于其历史上最大的一次转变的边缘。谷歌和 Mozilla 共同控制着浏览器市场的大部分份额,他们正在鼓励向 [DNS over HTTPS][18](DoH)的方向发展,在这种情况下,DNS 请求将被已经保护了大多数 Web 流量的 HTTPS 协议加密。在 Chrome 的实现中,浏览器会检查 DNS 服务器是否支持 DoH,如果不支持,则会将 DNS 请求重新路由到谷歌的 8.8.8.8。 + +这是一个并非没有争议的举动。早在上世纪 80 年代就在 DNS 协议上做了大量早期工作的 Paul Vixie 称此举对安全来说是“[灾难][19]”:例如,企业 IT 部门将更难监控或引导穿越其网络的 DoH 流量。不过,Chrome 浏览器是无所不在的,DoH 不久就会被默认打开,所以让我们拭目以待。 + +-------------------------------------------------------------------------------- + +via: https://www.networkworld.com/article/3268449/what-is-dns-and-how-does-it-work.html + +作者:[Keith Shaw][a], [Josh Fruhlinger][c] +选题:[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.networkworld.com/author/Keith-Shaw/ +[c]: https://www.networkworld.com/author/Josh-Fruhlinger/ +[b]: https://github.com/lujun9972 +[1]: https://www.networkworld.com/newsletters/signup.html +[2]: https://www.internethalloffame.org/blog/2012/07/23/why-does-net-still-work-christmas-paul-mockapetris +[3]: https://tools.ietf.org/html/rfc608 +[4]: http://www.verisign.com/en_US/domain-names/dnib/index.xhtml?section=cc-tlds +[5]: http://www.google.com +[6]: https://browserleaks.com/ip +[7]: https://www.networkworld.com/article/2246426/comcast-redirects-bad-urls-to-pages-with-advertising.html +[8]: https://www.networkworld.com/article/3194890/comparing-the-performance-of-popular-public-dns-providers.html +[9]: https://blog.dnsimple.com/2015/03/why-and-how-to-use-googles-public-dns/ +[10]: https://developers.google.com/speed/public-dns/docs/using +[11]: https://www.networkworld.com/article/2838356/network-security/dns-is-ubiquitous-and-its-easily-abused-to-halt-service-or-steal-data.html +[12]: https://www.networkworld.com/article/2277316/tech-primers/tech-primers-how-dns-cache-poisoning-works.html +[13]: https://www.cloudmark.com/releases/docs/whitepapers/dns-resource-exhaustion-v01.pdf +[14]: https://www.networkworld.com/article/3254575/lan-wan/what-is-ipv6-and-why-aren-t-we-there-yet.html +[15]: http://social.dnsmadeeasy.com/blog/opinion/future-big-data-dns-analytics/ +[16]: https://www.csoonline.com/article/3567188/wormable-dns-flaw-endangers-all-windows-servers.html +[17]: https://federalnewsnetwork.com/cybersecurity/2020/07/cisa-gives-agencies-a-day-to-remedy-windows-dns-server-vulnerability/ +[18]: https://www.networkworld.com/article/3322023/dns-over-https-seeks-to-make-internet-use-more-private.html +[19]: https://www.theregister.com/2018/10/23/paul_vixie_slaps_doh_as_dns_privacy_feature_becomes_a_standard/ +[20]: https://www.facebook.com/NetworkWorld/ +[21]: https://www.linkedin.com/company/network-world diff --git a/published/202009/20200827 Information could be half the world-s mass by 2245, says researcher.md b/published/202009/20200827 Information could be half the world-s mass by 2245, says researcher.md new file mode 100644 index 0000000000..4cd711cf56 --- /dev/null +++ b/published/202009/20200827 Information could be half the world-s mass by 2245, says researcher.md @@ -0,0 +1,60 @@ +[#]: collector: (lujun9972) +[#]: translator: (wxy) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12592-1.html) +[#]: subject: (Information could be half the world's mass by 2245, says researcher) +[#]: via: (https://www.networkworld.com/article/3570438/information-could-be-half-the-worlds-mass-by-2245-says-researcher.html) +[#]: author: (Patrick Nelson https://www.networkworld.com/author/Patrick-Nelson/) + +研究人员表示,到 2245 年信息量可能占世界质量的一半 +====== + +> 根据一位理论物理学家的说法,由于创建和存储数字信息所使用的能源和资源数量,数据应该被视为物理的,而不仅仅是看不见的一和零。 + +![](https://images.idgesg.net/images/article/2019/07/global_connections_digital_world_map_planet_earth_particles_light_by_luza_studios_gettyimages-1022793086_2400x1600-100806717-large.jpg) + +一位大学学者建议,数字内容应该与气体、液体、等离子体和固体一样,被视为第五种物质状态。 + +英国朴茨茅斯大学高级讲师、发表在《AIP Advances》杂志上的《[信息灾难][1]》一文的作者 Melvin Vopson 称,由于以物理和数字方式创建、存储和分发数据所使用的能量和资源,数据已经发生了演变,现在应该被视为质量。 + +Vopson 还声称,数字比特正在走向压倒地球的道路,最终将超过原子的数量。 + +给数字信息分配质量的想法建立在一些现有数据点的基础之上。Vopson 引用了 IBM 的一项估计,发现数据每天以 2.5 万亿字节的速度产生。他还将每英寸超过 1 太比特terabit的数据存储密度考虑在内,将比特的大小与原子的大小进行比较。 + +假设数据生成量每年增长 50%,根据宣布 Vopson 研究的[媒体发布][2],“比特的数量将在大约 150 年内等于地球上的原子数量。” + +新闻稿中写道:“大约 130 年后,维持数字信息创造所需的动力将等于地球上目前产生的所有动力,到 2245 年,地球上一半的质量将转化为数字信息质量。” + +Vopson 补充说,COVID-19 大流行正在提高数字数据创造的速度,并加速这一进程。 + +他警告说,一个饱和点即将到来:“即使假设未来的技术进步将比特大小降低到接近原子本身的大小,这个数字信息量所占的比重将超过地球的大小,从而导致我们所定义的‘信息灾难’。”Vopson 在[论文][3]中写道。 + +“我们正在一点一点地改变这个星球,这是一场看不见的危机,”Vopson 说,他是希捷科技公司的前研发科学家。 + +Vopson 并不是一个人在探索,信息并不是简单的不可察觉的 1 和 0。根据发布的消息,Vopson 借鉴了爱因斯坦广义相对论中的质能对比;将热力学定律应用于信息的 Rolf Landauer 的工作;以及数字比特的发明者 Claude Shannon 的工作。 + +“当一个人将信息内容带入现有的物理理论中时,这几乎就像物理学中的一切都多了一个维度,”Vopson 说。 + +他的论文总结道,随着增长速度似乎不可阻挡,数字信息生产“将消耗地球上大部分的电力能源,从而导致道德和环境问题。”他的论文总结道。 + +有趣的是,除此以外,Vopson 还提出,如果像他所预测的那样,未来地球的质量主要由信息位组成,并且有足够的动力创造出来(不确定),那么“可以设想未来的世界主要由计算机模拟,并由数字比特和计算机代码主导,”他写道。 + +-------------------------------------------------------------------------------- + +via: https://www.networkworld.com/article/3570438/information-could-be-half-the-worlds-mass-by-2245-says-researcher.html + +作者:[Patrick Nelson][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.networkworld.com/author/Patrick-Nelson/ +[b]: https://github.com/lujun9972 +[1]: https://aip.scitation.org/doi/10.1063/5.0019941 +[2]: https://publishing.aip.org/publications/latest-content/digital-content-on-track-to-equal-half-earths-mass-by-2245/ +[3]: https://aip.scitation.org/doi/full/10.1063/5.0019941 +[4]: https://www.facebook.com/NetworkWorld/ +[5]: https://www.linkedin.com/company/network-world diff --git a/published/202009/20200827 Use this command-line tool to find security flaws in your code.md b/published/202009/20200827 Use this command-line tool to find security flaws in your code.md new file mode 100644 index 0000000000..3edc6fcfaa --- /dev/null +++ b/published/202009/20200827 Use this command-line tool to find security flaws in your code.md @@ -0,0 +1,129 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12576-1.html) +[#]: subject: (Use this command-line tool to find security flaws in your code) +[#]: via: (https://opensource.com/article/20/8/static-code-security-analysis) +[#]: author: (Ari Noman https://opensource.com/users/arinoman) + +使用命令行工具 Graudit 来查找你代码中的安全漏洞 +====== + +> 凭借广泛的语言支持,Graudit 可以让你在开发过程中的审计你的代码安全。 + +![](https://img.linux.net.cn/data/attachment/album/202009/03/114037qhi2h282wghbp74n.jpg) + +测试是软件开发生命周期(SDLC)的重要组成部分,它有几个阶段。今天,我想谈谈如何在代码中发现安全问题。 + +在开发软件的时候,你不能忽视安全问题。这就是为什么有一个术语叫 DevSecOps,它的基本职责是识别和解决应用中的安全漏洞。有一些用于检查 [OWASP 漏洞][2]的开源解决方案,它将通过创建源代码的威胁模型来得出结果。 + +处理安全问题有不同的方法,如静态应用安全测试(SAST)、动态应用安全测试(DAST)、交互式应用安全测试(IAST)、软件组成分析等。 + +静态应用安全测试在代码层面运行,通过发现编写好的代码中的错误来分析应用。这种方法不需要运行代码,所以叫静态分析。 + +我将重点介绍静态代码分析,并使用一个开源工具进行实际体验。 + +### 为什么要使用开源工具检查代码安全? + +选择开源软件、工具和项目作为开发的一部分有很多理由。它不会花费任何金钱,因为你使用的是一个由志趣相投的开发者社区开发的工具,而他们希望帮助其他开发者。如果你有一个小团队或一个初创公司,找到开源软件来检查你的代码安全是很好的。这样可以让你不必单独雇佣一个 DevSecOps 团队,让你的成本降低。 + +好的开源工具总是考虑到灵活性,它们应该能够在任何环境中使用,覆盖尽可能多的情况。这让开发人员更容易将该软件与他们现有的系统连接起来。 + +但是有的时候,你可能需要一个功能,而这个功能在你选择的工具中是不可用的。那么你就可以选择复刻其代码,在其上开发自己的功能,并在你的系统中使用。 + +因为,大多数时候,开源软件是由社区驱动的,开发的速度往往是该工具的用户的加分项,因为他们会根据用户的反馈、问题或 bug 报告来迭代项目。 + +### 使用 Graudit 来确保你的代码安全 + +有各种开源的静态代码分析工具可供选择,但正如你所知道的,工具分析的是代码本身,这就是为什么没有通用的工具适用于所有的编程语言。但其中一些遵循 OWASP 指南,尽量覆盖更多的语言。 + +在这里,我们将使用 [Graudit][3],它是一个简单的命令行工具,可以让我们找到代码库中的安全缺陷。它支持不同的语言,但有一个固定的签名集。 + +Graudit 使用的 `grep` 是 GNU 许可证下的工具,类似的静态代码分析工具还有 Rough Auditing Tool for Security(RATS)、Securitycompass Web Application Analysis Tool(SWAAT)、flawfinder 等。但 Graudit 的技术要求是最低的,并且非常灵活。不过,你可能还是有 Graudit 无法满足的要求。如果是这样,你可以看看这个[列表][4]的其他的选择。 + +我们可以将这个工具安装在特定的项目下,或者全局命名空间中,或者在特定的用户下,或者任何我们喜欢地方,它很灵活。我们先来克隆一下仓库。 + +``` +$ git clone https://github.com/wireghoul/graudit +``` + +现在,我们需要创建一个 Graudit 的符号链接,以便我们可以将其作为一个命令使用。 + +``` +$ cd ~/bin && mkdir graudit +$ ln --symbolic ~/graudit/graudit ~/bin/graudit +``` + +在 `.bashrc` (或者你使用的任何 shell 的配置文件)中添加一个别名。 + +``` +#------ .bashrc ------ + +alias graudit="~/bin/graudit" +``` + +重新加载 shell: + +``` +$ source ~/.bashrc # 或 +$ exex $SHELL +``` + +让我们通过运行这个来检查是否成功安装了这个工具。 + +``` +$ graudit -h +``` + +如果你得到类似于这样的结果,那么就可以了。 + +![Graudit terminal screen showing help page][5] + +*图 1 Graudit 帮助页面* + +我正在使用我现有的一个项目来测试这个工具。要运行该工具,我们需要传递相应语言的数据库。你会在 signatures 文件夹下找到这些数据库。 + +``` +$ graudit -d ~/gradit/signatures/js.db +``` + +我在现有项目中的两个 JavaScript 文件上运行了它,你可以看到它在控制台中抛出了易受攻击的代码。 + +![JavaScript file showing Graudit display of vulnerable code][6] + +![JavaScript file showing Graudit display of vulnerable code][7] + +你可以尝试在你的一个项目上运行这个,项目本身有一个长长的[数据库][8]列表,用于支持不同的语言。 + +### Graudit 的优点和缺点 + +Graudit 支持很多语言,这使其成为许多不同系统上的用户的理想选择。由于它的使用简单和语言支持广泛,它可以与其他免费或付费工具相媲美。最重要的是,它们正在开发中,社区也支持其他用户。 + +虽然这是一个方便的工具,但你可能会发现很难将某个特定的代码识别为“易受攻击”。也许开发者会在未来版本的工具中加入这个功能。但是,通过使用这样的工具来关注代码中的安全问题总是好的。 + +### 总结 + +在本文中,我只介绍了众多安全测试类型中的一种:静态应用安全测试。从静态代码分析开始很容易,但这只是一个开始。你可以在你的应用开发流水线中添加其他类型的应用安全测试,以丰富你的整体安全意识。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/8/static-code-security-analysis + +作者:[Ari Noman][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/arinoman +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/programming_code_screen_display.jpg?itok=2HMTzqz0 (Code on a screen) +[2]: https://owasp.org/www-community/vulnerabilities/ +[3]: https://github.com/wireghoul/graudit +[4]: https://project-awesome.org/mre/awesome-static-analysis +[5]: https://opensource.com/sites/default/files/uploads/graudit_1.png (Graudit terminal screen showing help page) +[6]: https://opensource.com/sites/default/files/uploads/graudit_2.png (JavaScript file showing Graudit display of vulnerable code) +[7]: https://opensource.com/sites/default/files/uploads/graudit_3.png (JavaScript file showing Graudit display of vulnerable code) +[8]: https://github.com/wireghoul/graudit#databases diff --git a/published/202009/20200828 Use GraphQL as an API gateway to monitor microservices.md b/published/202009/20200828 Use GraphQL as an API gateway to monitor microservices.md new file mode 100644 index 0000000000..a9daa6a877 --- /dev/null +++ b/published/202009/20200828 Use GraphQL as an API gateway to monitor microservices.md @@ -0,0 +1,110 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12588-1.html) +[#]: subject: (Use GraphQL as an API gateway to monitor microservices) +[#]: via: (https://opensource.com/article/20/8/microservices-graphql) +[#]: author: (Rigin Oommen https://opensource.com/users/riginoommen) + +使用 GraphQL 作为 API 网关来监控微服务 +====== + +> 在问题导致关键的微服务瘫痪之前,使用 GraphQL 的监控功能帮助你及早发现问题。 + +![](https://img.linux.net.cn/data/attachment/album/202009/06/205052ve8eebyamcace4v8.jpg) + +[微服务][2]和 [GraphQL][3] 就像面包和黄油一样,是一个很好的组合。它们本身都很棒,结合起来就更棒了。了解你的微服务的健康状况是很重要的,因为它们运行着重要的服务。如果等到某个关键的服务崩溃了才诊断问题,那是很愚蠢的。让 GraphQL 帮助你及早发现问题并不需要花费太多精力。 + +![GraphQL in Microservices][4] + +常规的健康检查可以让你观察和测试你的服务,在问题影响到你的业务、客户或项目之前,尽早得到通知。说起来很简单,但健康检查到底要做什么呢? + +以下是我在设计服务检查时考虑的因素: + +服务器健康检查的要求: + + 1. 我需要了解我的微服务的可用性状态。 + 2. 我希望能够管理服务器的负载。 + 3. 我希望对我的微服务进行端到端(e2e)测试。 + 4. 我应该能够预测中断。 + +![Service health in microservices][5] + +### 做服务器健康检查的方法 + +进行健康检查可能比较棘手,因为理论上,你可以检查的东西几乎是无穷无尽的。我喜欢从小处着手,运行最基本的测试:ping 测试。这只是测试运行应用的服务器是否可用。然后,我加强测试以评估特定问题,思考服务器中最重要的元素。我想到那些如果突然消失的话将是灾难性的事情。 + + 1. **Ping 检查:**Ping 是最简单的监控类型。它只是检查你的应用是否在线。 + 2. **脚本化浏览器:**脚本化浏览器比较高级。像 [Selenium][6] 这样的浏览器自动化工具可以让你实现自定义的监控规则集。 + 3. **API 测试:**API 测试用于监控 API 端点。这是 ping 检查模型的高级版本,你可以根据 API 响应来定义监控计划。 + +### 使用 GraphQL 进行健康检查 + +在一个典型的基于 REST 的微服务中,你需要从头开始构建健康检查功能。这是一个时间密集型的过程,但使用 GraphQL 就不用担心了。 + +根据它的[网站][7]称: + +> “GraphQL 是一种用于 API 的查询语言,也是一种用现有数据完成这些查询的运行时环境。GraphQL 为你的 API 中的数据提供了一个完整的、可理解的描述,让客户有能力精确地仅查询他们所需要的东西,让 API 更容易随着时间的推移而进化,并实现强大的开发者工具。” + +当你启动一个 GraphQL 微服务时,你还可以获得监控微服务的运行状况的供给。这是一个隐藏的宝贝。 + +正如我上面提到的,你可以用 GraphQL 端点执行 API 测试以及 ping 检查。 + +Apollo GraphQL 服务器提供了一个默认的端点,它可以返回有关你的微服务和服务器健康的信息。它不是很复杂:如果服务器正在运行,它就会返回状态码 200。 + +默认端点是 `/.well-known/apollo/server-health`。 + +![Health Check with GraphQL][8] + +### 高级健康检查 + +在某些情况下,基本的健康检查可能不足以确保系统的完整性。例如,紧密耦合的系统需要更多的业务逻辑来确保系统的健康。 + +Apollo GraphQL 在定义服务器的同时,通过声明一个 `onHealthCheck` 函数来有效地管理这种情况。 + +``` +* Defining the Apollo Server */ +const apollo = new ApolloServer({ + playground: process.env.NODE_ENV !== 'production', + typeDefs: gqlSchema, + resolvers: resolver, + onHealthCheck: () => { + return new Promise((resolve, reject) => { + // Replace the `true` in this conditional with more specific checks! + if (true) { + resolve(); + } else { + reject(); + } + }); + } +}); +``` + +当你定义一个 `onHealthCheck` 方法时,它返回一个 promise,如果服务器准备好了,它就会返回 `resolve`,如果有错误,它就会返回 `reject`。 + +GraphQL 让监控 API 变得更容易。此外,在你的服务器基础架构中使用它可以使代码变得可扩展。如果你想尝试采用 GraphQL 作为你的新基础设施定义,请参见我的 GitHub 仓库中的[示例代码和配置][9]。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/8/microservices-graphql + +作者:[Rigin Oommen][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/riginoommen +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/data_analytics_cloud.png?itok=eE4uIoaB (Net catching 1s and 0s or data in the clouds) +[2]: https://opensource.com/resources/what-are-microservices +[3]: https://opensource.com/article/19/6/what-is-graphql +[4]: https://opensource.com/sites/default/files/uploads/graphql-microservices.png (GraphQL in Microservices) +[5]: https://opensource.com/sites/default/files/uploads/servicehealth.png (Service health in microservices) +[6]: https://www.selenium.dev/ +[7]: https://graphql.org/ +[8]: https://opensource.com/sites/default/files/uploads/healthcheck.png (Health Check with GraphQL) +[9]: https://github.com/riginoommen/example-graphql diff --git a/published/202009/20200829 Best Free Online Markdown Editors That Are Also Open Source.md b/published/202009/20200829 Best Free Online Markdown Editors That Are Also Open Source.md new file mode 100644 index 0000000000..d15d98c8ff --- /dev/null +++ b/published/202009/20200829 Best Free Online Markdown Editors That Are Also Open Source.md @@ -0,0 +1,188 @@ +[#]: collector: (lujun9972) +[#]: translator: (wxy) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12624-1.html) +[#]: subject: (Best Free Online Markdown Editors That Are Also Open Source) +[#]: via: (https://itsfoss.com/online-markdown-editors/) +[#]: author: (Ankush Das https://itsfoss.com/author/ankush/) + +免费开源的在线 Markdown 编辑器 +====== + +[Markdown][1] 是一种有用的轻量级[标记语言][2],很多人喜欢用它来编写文档或做网页发布。很多人都使用 Markdown 来写文章。 + +有[几个适用于 Linux 的 Markdown 编辑器][3],你可以安装并使用。 + +但是,如果你不想在你的系统上安装另一个程序怎么办?也许你暂时使用的系统无法安装一个应用程序?也许你只是想要一个能让你实时协作的 Markdown 编辑器? + +无论你的需求是什么,在线 Markdown 编辑器通过提供协作功能、发布集成、笔记同步和一些在线功能,让很多事情变得简单。 + +因此,我整理了一份在线 Markdown 编辑器列表。 + +### 免费的在线 Markdown 编辑器 + +我尽量把重点放在代码开源的在线 Markdown 编辑器上。你可以使用它们的官方网站或将其部署到你的服务器上。 + +注:本列表没有特定排名顺序。 + +#### 1、StackEdit + +![][4] + +[StackEdit][5] 是目前最流行的开源在线 Markdown 编辑器之一。 + +它提供了一个很好的用户界面,并有一堆有用的功能。协作能力、同步能力,以及能够将你的文件发布/保存到 Blogger、WordPress、GitHub 和其他一些服务是 StackEdit 的一些关键功能。 + +不要忘了,你还可以使用一些 Markdown 扩展来支持 LaTeX 数学表达式、UML 图等。它的界面是一个所见即所得的编辑器,可以让你轻松使用 Markdown。它还可以离线工作,如果你需要的话,它还提供了一个 chrome 应用程序和扩展。 + +在 StackEdit 上导入/导出文件也很容易。如果你需要在你的服务器上托管它,你可以看看它在 [GitHub][6] 上的源代码,了解更多细节。 + +- [StackEdit][7] + +#### 2、Dillinger + +![][8] + +Dillinger 也是一个有趣的开源在线 Markdown 编辑器。与 StackEdit 类似,你也可以与 Dropbox、GitHub、Medium、Google Drive、Bitbucket 和 OneDrive 链接并保存文件。 + +你也可以选择在需要时简单地导入/导出文件。Dillinger 的用户界面比你在 StackEdit 上看到的更简单,但它也可以工作。与 StackEdit 不同的是,你没有 LaTeX 表达式或图表的 Markdown 扩展支持,如果你只是需要一个简单的在线 Markdown 编辑器,这是一个不错的选择。 + +如果你需要,你可以选择将它部署在服务器上的 Docker 容器中。关于它的更多技术细节,你不妨看看它的 [GitHub 页面][9]。 + +- [Dillinger][10] + +#### 3、Write.as + +![][11] + +Write.as 基于该团队开发的自由开源软件 [WriteFreely][12],所以如果你愿意的话,你可以简单地把它托管在自己的服务器上免费使用它。 + +你也可以使用 Write.as 服务作为一个具有基本功能的免费在线 Markdown 编辑器。为了使它发挥最大的作用,你可能想选购一份付费订阅。付费的功能包括自定义主题、新闻通讯、照片托管和多个博客等等。 + +它支持 Markdown,可以让 [Mastodon][13]、[ActivityPub][14] 和 [Pleroma][15] 上的任何人轻松关注和分享你的博客文章。 + +你可以在它的 [GitHub 页面][16]上探索更多关于 WriteFreely 的信息,或者使用 Write.as 开始。 + +- [Write.as][17] + +#### 4、Editor.md + +![][18] + +这是一个有趣的开源 Markdown 编辑器,还可以嵌入到自己的网页上。 + +它支持实时预览、GitHub 风格的 Markdown,它有一个所见即所得的编辑器以及一堆有用的功能。除了基本的 Markdown 支持外,它还支持表情符、LaTeX 表达式、流程图等。 + +你也可以选择自己托管,更多信息请看它的 [GitHub 页面][19]。 + +- [Editor.md][20] + +#### 5、CodiMD + +![][21] + +CodiMD 从一开始就不是一个成熟的在线服务。但是,它是一个开源项目,通过托管在服务器上,你可以实时协作文档或笔记。 + +它基于 [HackMD][22] 的源代码,并提供了一个[演示实例][23]来提供测试。我个人很喜欢它还提供了一个黑暗模式,而且很容易使用。 + +对于它未来的发布版本(在写这篇文章的时候),它将改名为 “HedgeDoc”。 + +你可以在它的 [GitHub 页面][24]上找到所有关于通过 Docker/Kubernetes 在服务器上部署它的相关信息以及其他手动配置选项。 + +- [CodiMD][25] + +#### 6、Wri.pe + +![][26] + +Wri.pe 是一款简单的开源在线 Markdown 编辑器,虽然已经不再维护,但它仍然活着而且可用。 + +它的特点是实时预览和可以导出或保存你的笔记到 Dropbox/Evernote。考虑到它没有积极维护,你可能不会依赖它,但当我测试它时,它和预期一样可以工作。 + +你可以看看它的 [GitHub 页面][27]或官方网站来了解更多关于它的信息。 + +- [Wri.pe][28] + +### 附带提名 + +下面是一些提供 Markdown 访问的工具。 + +#### Markdown Web Dingus + +![][29] + +这是由 Markdown 语言的创造者提供的一个简单而免费的在线 Markdown 编辑器。它并不是一个成熟的在线编辑器,也不支持导入/导出, + +但是,如果你只是想要一个在线编辑器来预览你的 Markdown 代码,这可能是一个不错的选择。不仅仅局限于编辑器,你还可以在网站的侧边栏得到一个语法速查表。所以,你也可以在这里尝试和学习。 + +- [Markdown Web Dingus][30] + +#### Markdown Journal + +![][31] + +[Markdown Journal][32] 是 [GitHub][33] 上的一个有趣的开源项目,但已经停止开发了。你可以通过它的在线编辑器使用 Markdown 语言创建日记,并直接保存在你的 Dropbox 账户上。当我试图创建日志时,我注意到发生了内部服务器错误,但你可以了解一下它。 + +#### Etherpad + +![][34] + +[Etherpad][35] 是另一个令人印象深刻的开源在线编辑器,但它并没有开箱即用的 Markdown 支持。你可能会注意到通过一些插件可以在你的服务器上启用 Markdown 编辑,但还不够完美。所以,你可能要注意一点。它有一个[公共实例][36]的列表,也可以尝试一下。 + +### 总结 + +考虑到很多在线编辑器、CMS 和记事本服务都支持 Markdown,如果你想把它发布到网站上,像 [WordPress][37] 这样的服务/应用也是一个不错的选择。 + +你更喜欢用哪个 Markdown 编辑器?我是否错过了你最喜欢的东西?请在下面的评论中告诉我。 + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/online-markdown-editors/ + +作者:[Ankush Das][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://itsfoss.com/author/ankush/ +[b]: https://github.com/lujun9972 +[1]: https://en.wikipedia.org/wiki/Markdown +[2]: https://en.wikipedia.org/wiki/Markup_language +[3]: https://itsfoss.com/best-markdown-editors-linux/ +[4]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/08/stackedit-screenshot.png?resize=800%2C396&ssl=1 +[5]: https://itsfoss.com/stackedit-markdown-editor/ +[6]: https://github.com/benweet/stackedit +[7]: https://stackedit.io/ +[8]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/08/dillinger-screenshot.jpg?resize=800%2C390&ssl=1 +[9]: https://github.com/joemccann/dillinger +[10]: https://dillinger.io/ +[11]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/08/write-as-screenshot.jpg?resize=800%2C505&ssl=1 +[12]: https://writefreely.org/ +[13]: https://itsfoss.com/mastodon-open-source-alternative-twitter/ +[14]: https://en.wikipedia.org/wiki/ActivityPub +[15]: https://pleroma.social/ +[16]: https://github.com/writeas/writefreely +[17]: https://write.as/ +[18]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/08/editor-md-screenshot.jpg?resize=800%2C436&ssl=1 +[19]: https://github.com/pandao/editor.md +[20]: http://editor.md.ipandao.com/en.html +[21]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/08/codiMD.png?resize=800%2C525&ssl=1 +[22]: https://hackmd.io/ +[23]: https://demo.codimd.org/ +[24]: https://github.com/codimd/server +[25]: https://demo.codimd.org +[26]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/08/wri-pe-screenshot.jpg?resize=800%2C558&ssl=1 +[27]: https://github.com/masuidrive/open-wripe +[28]: https://wri.pe/ +[29]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/08/markdown-web-dingus.jpg?resize=800%2C616&ssl=1 +[30]: https://daringfireball.net/projects/markdown/dingus +[31]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/08/markdown-journal.jpg?resize=800%2C656&ssl=1 +[32]: https://markdownjournal.com/ +[33]: https://github.com/maciakl/MarkdownJournal +[34]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/08/etherpad-public-instance.png?resize=800%2C556&ssl=1 +[35]: https://etherpad.org/ +[36]: https://github.com/ether/etherpad-lite/wiki/Sites-that-run-Etherpad-Lite +[37]: https://wordpress.com/ diff --git a/published/202009/20200830 Linux Jargon Buster- What is a Display Server in Linux- What is it Used for.md b/published/202009/20200830 Linux Jargon Buster- What is a Display Server in Linux- What is it Used for.md new file mode 100644 index 0000000000..f5a7bbcdb3 --- /dev/null +++ b/published/202009/20200830 Linux Jargon Buster- What is a Display Server in Linux- What is it Used for.md @@ -0,0 +1,119 @@ +[#]: collector: (lujun9972) +[#]: translator: (wxy) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12589-1.html) +[#]: subject: (Linux Jargon Buster: What is a Display Server in Linux? What is it Used for?) +[#]: via: (https://itsfoss.com/display-server/) +[#]: author: (Dimitrios Savvopoulos https://itsfoss.com/author/dimitrios/) + +Linux 黑话解释:什么是显示服务器,用来做什么? +====== + +![][3] + +在 Linux 相关的文章、新闻和讨论中,你会经常遇到显示服务器display server、Xorg、Wayland 等名词。 + +在这篇解释文章中,我将讨论 Linux 中的显示服务器。 + +### 什么是显示服务器? + +显示服务器是一个程序,它负责协调其客户端与操作系统的其他部分之间,以及硬件和操作系统之间的输入和输出。基本上,多亏了显示服务器,你才能以图形化的方式使用你的计算机(GUI)。如果没有显示服务器,你只能局限于命令行界面(TTY)。 + +显示服务器提供了一个图形环境的框架,使你可以使用鼠标和键盘与应用程序进行交互。 + +显示服务器通过[显示服务器协议][1](如 X11)与客户端进行通信。显示服务器是图形用户界面 —— 特别是窗口系统 —— 中的一个关键组件。 + +不要把显示服务器和[桌面环境][2]混淆。桌面环境的下层使用的是显示服务器。 + +听起来很熟悉,但又不完全清楚?让我来解释一下。 + +### Linux 上的显示服务器协议 + +Linux 中有三种显示服务器协议,分别是 X11、Wayland 和 Mir。下面我就给大家简单介绍一下这些显示服务器。 + +#### X11 + +X11(也称 X)是已经存在多年的传统显示服务器。它是 Linux 发行版中最常用的显示服务器。 + +![X 架构][4] + +X11 通信协议,使用显示服务器 [X.org 服务器][5]。它接收来自[设备驱动程序][6]的输入事件,并将它们提供给它的一个客户端。 + +显示服务器也从客户端接收数据,它处理数据并进行合成,在 Linux 上,它将数据传递给三个内核组件之一:[DRM][7]、[gem][8] 或 [KMS 驱动][9]。 + +X.Org 服务器是一个显示服务器,它依靠第二个程序:[合成窗口管理器][10],来进行合成。例如 [Mutter][11] 或 [KWin][12]。GNOME 使用的是 Mutter。 + +#### Wayland + +按照其网站的说法,Wayland “旨在作为 X 的更简单的替代品,更容易开发和维护”。 + +而事实上 [Wayland][13] 就是现代的显示服务器,它应该取代传统的 X 显示服务器。 + +对它的采用还在普及中。Ubuntu 曾试图在 17.10 版本中改用 Wayland 作为默认的显示服务器,但这个尝试遭到了负面反馈。 + +很多 GUI 应用程序及其框架都依赖于 X 服务器。这些应用程序在 Wayland 上无法正常工作。 + +这迫使 Ubuntu 继续使用 X 作为默认显示服务器。它仍然提供了使用 Wayland 的选项,但不再是默认的了。 + +即使在今天,绝大多数的发行版都默认使用 X 显示服务器。 + +![Wayland 架构][14] + +实施 Wayland 显示服务器协议的显示服务器,被称为 [Wayland 合成器][15]。和 X11 上的一样,Wayland 合成器负责处理其客户端的输入和输出,但同时也进行[合成][16],这与 X11 相反。 + +几个 Wayland 合成器是 [Weston][17]、[Mutter][18]、[KWin][12] 或 [Enlightenment][19]。 + +#### Mir + +[Mir 显示服务器][20]自带的 Mir 显示服务器协议,与 X11 和 Wayland 使用的协议不同。它是由 [Canonical][21] 开发的,作为 Unity 开发的一部分,打算成为 [Ubuntu][22] 的首选显示服务器。 + +但在 2017 年,它已经被 [Ubuntu] 桌面版的 Wayland 显示服务器所取代,不过 Mir 的开发还在继续,用于物联网(IoT)应用。 + +#### 为什么我们还在使用 Xorg? + +Wayland 作为比较新的产品,相比 Xorg 来说,还不是很稳定。作为客户端的程序,必须知道如何与显示服务器进行通信。 + +因此,很多程序在使用 Wayland 时可能无法运行。Ubuntu 默认切换到 Wayland 的实验证实了这一点。 + +### 结束语 + +我希望你对 Linux 中的显示服务器概念有了更好的理解。我已经尽量不谈太多的技术细节,但我无法完全避免。 + +欢迎你的反馈和建议。 + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/display-server/ + +作者:[Dimitrios Savvopoulos][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://itsfoss.com/author/dimitrios/ +[b]: https://github.com/lujun9972 +[1]: https://en.wikipedia.org/wiki/X_Window_System_core_protocol +[2]: https://linux.cn/article-12579-1.html +[3]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/08/display-server-linux.png?resize=800%2C450&ssl=1 +[4]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/08/x-architecture-1.png?resize=800%2C507&ssl=1 +[5]: https://en.wikipedia.org/wiki/X.Org_Server +[6]: https://en.wikipedia.org/wiki/Device_driver +[7]: https://en.wikipedia.org/wiki/Direct_Rendering_Manager +[8]: https://en.wikipedia.org/wiki/Graphics_Execution_Manager +[9]: https://en.wikipedia.org/wiki/KMS_driver +[10]: https://en.wikipedia.org/wiki/Compositing_window_manager +[11]: https://en.wikipedia.org/wiki/Mutter_(window_manager) +[12]: https://en.wikipedia.org/wiki/KWin +[13]: https://wayland.freedesktop.org/ +[14]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/08/wayland-architecture-1.png?resize=800%2C500&ssl=1 +[15]: https://en.wikipedia.org/wiki/Wayland_compositor +[16]: https://en.wikipedia.org/wiki/Compositing +[17]: https://en.wikipedia.org/wiki/Weston_(software) +[18]: https://en.wikipedia.org/wiki/Mutter_(software) +[19]: https://en.wikipedia.org/wiki/Enlightenment_(software) +[20]: https://mir-server.io/ +[21]: https://canonical.com/ +[22]: https://itsfoss.com/install-ubuntu/ diff --git a/published/202009/20200831 Military looks to ultraviolet networks for secure battlefield communication.md b/published/202009/20200831 Military looks to ultraviolet networks for secure battlefield communication.md new file mode 100644 index 0000000000..4e4c176e60 --- /dev/null +++ b/published/202009/20200831 Military looks to ultraviolet networks for secure battlefield communication.md @@ -0,0 +1,59 @@ +[#]: collector: (lujun9972) +[#]: translator: (silentdawn-zz) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12611-1.html) +[#]: subject: (Military looks to ultraviolet networks for secure battlefield communication) +[#]: via: (https://www.networkworld.com/article/3572372/military-looks-to-ultraviolet-networks-for-secure-battlefield-communication.html) +[#]: author: (Patrick Nelson https://www.networkworld.com/author/Patrick-Nelson/) + +美国军方正探索战场保密通信用紫外网络 +====== + +> 美国军方想以开放空间传输的紫外线为载体,为士兵开发新的更安全的通讯网络。 + +![](https://images.idgesg.net/images/article/2018/02/security_safety_guarding_mobile_laptop_endpoint_protection_thinkstock_906578404-100750806-large.jpg) + +美国军方研究者之所以探索战场环境下的紫外光通信的应用,是因为这种技术可能实现敌对方无法侦测的通信。 + +研究者关注的一个方面是衰减效应,即信号强度随传播距离的增加而减弱的自然现象。他们想知道是否存在一个合适的距离范围,在该范围内,信号强度足够弱,以至于敌对方几乎无法侦测,但又足够强,使得友方可以侦测并建立通信。他们说他们观察到了这种情况,但关于他们相关工作的 [研究论文][1] 并没有讲这个距离范围究竟是多少。 + +一份军方出版物提到,“紫外通信具有独特的传输特性,不但可以实现非视距连接,而且让敌对方难以侦测。” + +这个研究由美军作战能力发展司令部 [军队研究实验室][2] 主导,其重点是开发一个基础架构,为未来研究提供可量化环境,在该环境下,己方既可以使用紫外通信,也能够避免敌对方的侦测。研究过程中他们还有另外两个发现: + + * 最差情况,即敌对方探测器与己方发射器在视线范围内,但友方接收器不在视线范围内,问题不像想象中严重。 + * 转换紫外线发射器的发射方向不是降低敌对方探测到通信信号可能性的有效方式。 + +研究者计划分析下面四种场景,场景中涵盖了己方紫外发射器、友方接收器、敌对方探测器相对位置关系: + + * 友方接收器、敌对方探测器都在发射器的视线范围内。 + * 友方接收器在发射器视线范围内,但敌对方探测器不在视线范围内(最佳条件)。 + * 敌对方探测器在发射器的视线范围内,但友方接收器不在视线范围内(最差条件)。 + * 友方接收器、敌对方探测器均不在视线范围内。 + +假定敌对方试图通过时域上的光子计数来发现相干通信信号,进而判定正在进行通信。 + +科学家们承认这么一个事实,即越靠近发射器,信号越容易被侦测。所以紫外通信中发射器的有效使用依赖于对敌对方探测器位置的准确感知。 + +“我们提供了一个基础框架,使得对紫外通信系统实际可探测性与期望性能间差距的根本限制因素的研究得以进行。” 研究者之一,Robert Drost 博士如是说。 + +“我们的研究确保了团队对紫外波段用于通信的潜力及有限性有了根本上的理解。我坚信这种理解将影响到未来军队网络通信能力的发展。” + +-------------------------------------------------------------------------------- + +via: https://www.networkworld.com/article/3572372/military-looks-to-ultraviolet-networks-for-secure-battlefield-communication.html + +作者:[Patrick Nelson][a] +选题:[lujun9972][b] +译者:[silentdawn-zz](https://github.com/silentdawn-zz) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://www.networkworld.com/author/Patrick-Nelson/ +[b]: https://github.com/lujun9972 +[1]: https://www.osapublishing.org/DirectPDFAccess/4516B0FD-2152-4663-9A9899BF00560B7C_433781/oe-28-16-23640.pdf?da=1&id=433781&seq=0&mobile=no +[2]: https://www.arl.army.mil +[3]: https://www.facebook.com/NetworkWorld/ +[4]: https://www.linkedin.com/company/network-world diff --git a/published/202009/20200902 Design a book cover with an open source alternative to InDesign.md b/published/202009/20200902 Design a book cover with an open source alternative to InDesign.md new file mode 100644 index 0000000000..390747395c --- /dev/null +++ b/published/202009/20200902 Design a book cover with an open source alternative to InDesign.md @@ -0,0 +1,110 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12620-1.html) +[#]: subject: (Design a book cover with an open source alternative to InDesign) +[#]: via: (https://opensource.com/article/20/9/open-source-publishing-scribus) +[#]: author: (Jim Hall https://opensource.com/users/jim-hall) + +用 InDesign 的开源替代方案 Scribus 设计书籍封面 +====== + +> 使用开源的出版软件 Scribus 来制作你的下一本自出版书籍的封面。 + +![](https://img.linux.net.cn/data/attachment/album/202009/16/213714ppvfzm6idv9nnynp.jpg) + +我最近写完了一本关于 [C 语言编程][2]的书,我通过 [Lulu.com][3] 自行出版。我已经用 Lulu 做了好几个图书项目,它是一个很棒的平台。今年早些时候,Lulu 做了一些改变,让作者在创作图书封面时有了更大的控制权。以前,你只需上传一对大尺寸图片作为书的封面和封底。现在,Lulu 允许作者上传完全按照你的书的尺寸定制的 PDF。 + +你可以使用 [Scribus][4] 这个开源页面布局程序来创建封面。下面是我的做法。 + +### 下载一个模板 + +当你在 Lulu 上输入图书的信息时,最终会进入设计Design栏。在该页面的设计封面Design Your Cover部分,你会发现一个方便的下载模板Download Template按钮,它为你的图书封面提供了一个 PDF 模板。 + +![Lulu Design your Cover page][5] + +下载此模板,它为你提供了在 Scribus 中创建自己的书籍封面所需的信息。 + +![Lulu's cover template][7] + +最重要的细节是: + + * 文件总尺寸(含出血)Total Document Size (with bleed) + * 出血区(从裁切边缘)Bleed area (from trim edge) + * 书脊区Spine area + +出血Bleed是一个印刷术语,在准备“印刷就绪”文件时,这个术语很重要。它与普通文件中的页边距不同。打印文件时,你会为顶部、底部和侧面设置一个页边距。在大多数文档中,页边距通常为一英寸左右。 + +但在印刷就绪的文件中,文档的尺寸需要比成品书大一些,因为书籍的封面通常包括颜色或图片,一直到封面的边缘。为了创建这种设计,你要使颜色或图片超出你的边距,印刷厂就会把多余的部分裁切掉,使封面缩小到准确的尺寸。因此,“裁切”就是印刷厂将封面精确地裁剪成相应尺寸。而“出血区”就是印刷厂裁掉的多余部分。 + +如果你没有出血区,印刷厂就很难完全按照尺寸印刷封面。如果打印机只偏离了一点点,你的封面最终会在边缘留下一个微小的、白色的、没有印刷的边缘。使用出血和修剪意味着你的封面每次都能看起来正确。 + +### 在 Scribus 中设置书籍的封面文档 + +要在 Scribus 中创建新文档,请从定义文档尺寸的新文档New Document对话框开始。单击出血Bleeds选项卡,并输入 PDF 模板所说的出血尺寸。Lulu 图书通常在所有边缘使用 0.125 英寸的出血量。 + +对于 Scribus 中的文档总尺寸,你不能只使用 PDF 模板上的文档总尺寸。如果这样做,你的 Scribus 文档的尺寸会出现错误。相反,你需要做一些数学计算来获取正确的尺寸。 + +看下 PDF 模板中的文件总尺寸(含出血)Total Document Size (with bleed)。这是将要发送给打印机的 PDF 的总尺寸,它包括封底、书脊和封面(包含出血)。要在 Scribus 中输入正确的尺寸,你必须从所有边缘中减去出血。例如,我最新的书的尺寸是四开本Crown Quarto,装订后尺寸为 7.44" x 9.68",书脊宽度为 0.411"。加上 0.125" 的出血量,文件总尺寸(含出血)是 15.541" × 9.93"。因此,我在 Scribus 中的文档尺寸是: + + * 宽:15.541-(2 x 0.125)=15.291" + * 高:9.93-(2 x 0.125)=9.68" + +![Scribus document setup][8] + +这将设置一个新的适合我的书的封面尺寸的 Scribus 文档。新的 Scribus 文档尺寸应与 PDF 模板上列出的“文件总尺寸(含出血)”完全匹配。 + +### 从书脊开始 + +在 Scribus 中创建新的书籍封面时,我喜欢从书脊区域开始。这可以帮助我验证我是否在 Scribus 中正确定义了文档。 + +使用矩形Rectangle工具在文档上绘制一个彩色方框,书脊需要出现在那里。你不必完全按照正确的尺寸和位置来绘制,只要大小差不多并使用属性Properties来设置正确的值即可。在形状的属性中,选择左上角基点,然后输入书脊需要放在的 x、y 位置和尺寸。同样,你需要做一些数学计算,并使用 PDF 模板上的尺寸作为参考。 + +![Empty Scribus document][9] + +例如,我的书的修边尺寸是 7.44"×9.68",这是印刷厂修边后的封面和封底的尺寸。我的书的书脊大小是 0.411",出血量是 0.125"。也就是说,书脊的左上角 X、Y 的正确位置是: + + * X 位置(出血量+裁剪宽度):0.411+7.44=7.8510" + * Y 位置(减去出血量):-0.125" + +矩形的尺寸是我的书封面的全高(包括出血)和 PDF 模板中标明的书脊宽度。 + + * 宽度:0.411" + * 高度:9.93" + +将矩形的填充Fill设置为你喜欢的颜色,将笔触Stroke设置为None以隐藏边界。如果你正确地定义了 Scribus 文档,你应该最终得到一个矩形,它可以延伸到位于文档中心的图书封面的顶部和底部边缘。 + +![Book spine in Scribus][10] + +如果矩形与文档不完全匹配,可能是你在创建 Scribus 文档时设置了错误的尺寸。由于你还没有在书的封面上花太多精力,所以可能最容易的做法是重新开始,而不是尝试修复你的错误。 + +### 剩下的就看你自己了 + +接下来,你可以创建你的书的封面的其余部分。始终使用 PDF 模板作为指导。封底在左边,封面在右边 + +我可以做一个简单的书籍封面,但我缺乏艺术能力,无法创造出真正醒目的设计。在自己设计了几个书的封面后,我对那些能设计出好封面的人产生了敬意。但如果你只是需要制作一个简单的封面,你可以通过开源软件自己动手。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/9/open-source-publishing-scribus + +作者:[Jim Hall][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/jim-hall +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/books_read_list_stack_study.png?itok=GZxb9OAv (Stack of books for reading) +[2]: https://opensource.com/article/20/8/c-programming-cheat-sheet +[3]: https://www.lulu.com/ +[4]: https://www.scribus.net/ +[5]: https://opensource.com/sites/default/files/uploads/lulu-download-template.jpg (Lulu Design your Cover page) +[6]: https://creativecommons.org/licenses/by-sa/4.0/ +[7]: https://opensource.com/sites/default/files/uploads/lulu-pdf-template.jpg (Lulu's cover template) +[8]: https://opensource.com/sites/default/files/uploads/scribus-new-document.jpg (Scribus document setup) +[9]: https://opensource.com/sites/default/files/uploads/scribus-empty-document.jpg (Empty Scribus document) +[10]: https://opensource.com/sites/default/files/uploads/scribus-spine-rectangle.jpg (Book spine in Scribus) diff --git a/published/202009/20200903 Rclone Browser Enables You to Sync Data With Cloud Services in Linux Graphically.md b/published/202009/20200903 Rclone Browser Enables You to Sync Data With Cloud Services in Linux Graphically.md new file mode 100644 index 0000000000..df58ec759d --- /dev/null +++ b/published/202009/20200903 Rclone Browser Enables You to Sync Data With Cloud Services in Linux Graphically.md @@ -0,0 +1,134 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12605-1.html) +[#]: subject: (Rclone Browser Enables You to Sync Data With Cloud Services in Linux Graphically) +[#]: via: (https://itsfoss.com/rclone-browser/) +[#]: author: (Ankush Das https://itsfoss.com/author/ankush/) + +Rclone Browser 让你在 Linux 中以图形化的方式与云服务同步数据 +====== + +> Rclone Browser 是一款高效的 GUI 程序,它可以让你轻松地使用 Rclone 管理和同步云存储上的数据。在这里,我们来看看它提供的功能和工作方式。 + +如果你想原生地在 Linux 上毫不费力地使用 One Drive 或 [Google Drive][1],你可以选择像 [Insync][2] 这样的高级 GUI 工具。 + +如果你能在终端上下功夫,你可以使用 [rclone][4] 与许多 [Linux 上的云存储服务][5]进行同步。我们有一份详细的[在 Linux 中使用 Rclone 与 OneDrive 同步的指南][6]。 + +[rclone][4] 是一个相当流行且有用的命令行工具。rclone 提供的功能是很多有经验的用户需要的。 + +然而,即使它足够有用,也不是每个人都能从终端使用它。 + +因此,在本文中,我将介绍一个令人印象深刻的 GUI “Rclone Browser”,它可以让你轻松地使用 Rclone 管理和同步云存储上的数据。 + +值得注意的是,rclone 确实提供了一个实验性的基于 Web 的 GUI。但我们将在这里专注于 [Rclone Browser][7]。 + +![][8] + +### Rclone Browser:Rclone 的开源 GUI + +Rclone Browser 是一款可以让你浏览、修改、上传/下载、列出文件,并在想充分利用远程存储位置的情况下,做更多你想做的事情的 GUI。 + +它提供了一个简单的用户界面,并且工作良好(根据我的快速测试)。让我们详细看看它提供的功能以及如何开始使用它。 + +### Rclone Browser 的功能 + +![][9] + +它提供了很多选项和控制来管理远程存储位置。根据你的使用情况,你可能会发现它的功能丰富或不知所措。以下是它的功能: + + * 浏览和修改 rclone 远程存储位置 + * 支持加密云存储 + * 支持自定义位置和配置加密 + * 不需要额外的配置。它将使用相同的 rclone 配置文件(如果你有的话) + * 在不同的标签页中同时导航多个位置 + * 按层次列出文件(按文件名、大小和修改日期) + * rclone 命令的执行是异步的,不会使 GUI 冻结 + * 你可以上传、下载、创建新文件夹、重命名、删除文件和文件夹 + * 上传文件时支持拖放 + * 在 VLC 等播放器中播放流媒体文件 + * 挂载和卸载文件夹/云端驱动器 + * 能够计算文件夹的大小、导出文件列表,并将 rclone 命令复制到剪贴板 + * 支持便携模式 + * 支持共享驱动器(如果你使用 Google Drive)。 + * 针对支持共享链接的远程存储服务,支持获取共享链接 + * 能够创建任务,你可以很容易地保存,以便以后再次运行或编辑。 + * 黑暗模式 + * 跨平台支持(Windows、macOS 和 Linux)。 + +### 在 Linux 上安装 Rclone Browser + +在使用 Rclone Browser 之前,你需要在你的 Linux 发行版上安装 rclone。请按照[官方安装说明][10]来安装。 + +你可以在 [GitHub 页面][7]的[发布页][11]找到 Rclone Browser 的 AppImage 文件。所以,你在任何 Linux 发行版上运行它都不会有问题。 + +如果你不知道 AppImage,我会推荐你阅读我们的[在 Linux 上使用 AppImage][12] 指南。 + +你也可以选择构建它。操作说明在 GitHub 页面上。 + +- [下载 Rclone Browser][7] + +### 开始使用 Rclone Browser + +在这里,我只分享一下使用 Rclone Browser 应该知道的几件事。 + +![][13] + +如果你在终端中使用 rclone 时有任何现有的远程位置,它将自动显示在 GUI 中。你也可以点击 “Refresh” 按钮来获取最新的新增内容。 + +如上图所示,当你点击 “Config” 按钮时,它会启动终端,让你轻松地添加一个新的远程或按你的要求配置它。当终端弹出的时候不用担心,Rclone browser 会执行命令来完成所有必要的任务,你只需要在需要的时候设置或编辑一些东西。你不需要执行任何 rclone 命令。 + +如果你有一些现有的远程位置,你可以使用 “Open” 按钮打开它们,并在不同的标签页中访问云存储,如下所示。 + +![][14] + +你可以轻松地挂载云驱动器,上传/下载文件,获取详细信息,共享文件夹的公共链接(如果支持),以及直接播放流媒体文件。 + +如果你想复制、移动或与远程存储位置同步数据,你可以简单地创建一个任务来完成。只需确保设置正确,你可以模拟执行或者直接运行任务。 + +你可以在 “Jobs” 页面找到所有正在运行的任务,如果需要,你可以取消/停止它们。 + +![][15] + +除了上面提到的所有基本功能外,你可以前往 “File->Preferences” 更改 rclone 位置、挂载选项、下载文件夹、带宽设置以及代理。 + +![][16] + +要了解更多关于它的用法和功能,你可能需要前往 [GitHub 页面][7]了解所有的技术信息。 + +### 总结 + +Rclone Browser 对于每一位想要使用 rclone 强大功能的 Linux 用户来说,绝对是得心应手。 + +你是否已经尝试过了呢?你更喜欢通过 GUI 还是终端来使用 rclone?请在下面的评论中告诉我你的想法! + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/rclone-browser/ + +作者:[Ankush Das][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://itsfoss.com/author/ankush/ +[b]: https://github.com/lujun9972 +[1]: https://itsfoss.com/use-google-drive-linux/ +[2]: https://itsfoss.com/recommends/insync/ +[3]: https://itsfoss.com/affiliate-policy/ +[4]: https://rclone.org/ +[5]: https://itsfoss.com/cloud-services-linux/ +[6]: https://itsfoss.com/use-onedrive-linux-rclone/ +[7]: https://github.com/kapitainsky/RcloneBrowser +[8]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/09/Cloud-sync.gif?resize=800%2C450&ssl=1 +[9]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/08/rclone-browser-screenshot.jpg?resize=800%2C618&ssl=1 +[10]: https://rclone.org/install/ +[11]: https://github.com/kapitainsky/RcloneBrowser/releases/tag/1.8.0 +[12]: https://itsfoss.com/use-appimage-linux/ +[13]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/09/rclone-browser-howto.png?resize=800%2C412&ssl=1 +[14]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/09/rclone-browser-drive.png?resize=800%2C505&ssl=1 +[15]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/09/rclone-browser-task.jpg?resize=800%2C493&ssl=1 +[16]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/09/rclone-browser-preferences.jpg?resize=800%2C590&ssl=1 diff --git a/published/202009/20200903 Soon You-ll be Able to Convert Any Website into Desktop Application in Linux Mint.md b/published/202009/20200903 Soon You-ll be Able to Convert Any Website into Desktop Application in Linux Mint.md new file mode 100644 index 0000000000..3582dedd8e --- /dev/null +++ b/published/202009/20200903 Soon You-ll be Able to Convert Any Website into Desktop Application in Linux Mint.md @@ -0,0 +1,97 @@ +[#]: collector: (lujun9972) +[#]: translator: (koolape) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12581-1.html) +[#]: subject: (Soon You’ll be Able to Convert Any Website into Desktop Application in Linux Mint) +[#]: via: (https://itsfoss.com/web-app-manager-linux-mint/) +[#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/) + +很快你就能在 Linux Mint 上将任何网站转化为桌面应用程序了 +====== + +设想一下,你正忙于一项任务且需要在浏览器中打开超过 20 个页面,大多数页面都和工作有关。 + +还有一些是 YouTube 或其他音乐流媒体网站。 + +完成任务后需要关闭浏览器,但这会将包括工作相关和听音乐的网页等所有网页一起关掉。 + +然后你需要再次打开这些网页并登录账号以回到原来的进度。 + +这看起来令人沮丧,对吧?Linux Mint 理解你的烦恼,因此有了下面这个新项目帮助你应对这些问题。 + +![][1] + +在[最近的一篇文章][2]中,Linux Mint 团队披露了正在开发一个名叫“网页应用管理器Web App Manager”的新工具。 + +该工具让你能够像使用桌面程序那样以独立窗口运行你最喜爱的网页。 + +在将网页添加为网页应用程序的时候,你可以给这个程序取名字并添加图标。也可以将它添加到不同的分类,以便在菜单中搜索这个应用。还可以指定用什么浏览器打开应用。启用/禁用导航栏的选项也有。 + +![在 Linux Mint 中添加网页应用程序][3] + +例如,将 YouTube 添加为网页应用程序: + +![Linux Mint 中的网页应用程序][4] + +运行 YouTube 程序将通过你所使用的浏览器打开一个独立的页面。 + +![YouTube 网页应用程序][5] + +网页应用程序拥有常规桌面应用程序有的大多数功能特点,如使用 `Alt+Tab` 切换。 + +![使用 Alt+Tab 切换网页应用][6] + +甚至还能将应用固定到面板/任务栏方便打开。 + +![添加到面板的 YouTube 网页应用][7] + +该管理器目前处于 beta 开发阶段,但已经使用起来已经相对比较稳定了。不过目前还没有面向大众发放,因为翻译工作还未完成。 + +如果你在使用 Linux Mint 并想尝试这个工具,可在下方下载 beta 版本的 deb 文件: + +- [下载 beta 版][8] + +### 网页应用的好处 + +有读者问到这个网页应用管理器与 Chrome 和其他一些网页浏览器中已有的其他类似功能相比的好处。让我来展开一下这个话题。 + +- 你可以使用 URL 的特定部分(example.com/tool 而不是 example.com)作为应用程序。 +- 添加自定义图标的可能性对于没有清晰的 favicon 的网站来说非常方便。 +- 你可以使用一个没有任何扩展的轻量级浏览器来打开网页应用,而不是像 Chrome/Chromium 这样的常规网页浏览器。它的速度应该更快。 +- 你的网页应用可以被整合到应用菜单中。你可以像其他应用程序一样搜索它。 + +### 网页应用程序在桌面环境的 Linux 中不是什么新事物 + +网页应用程序不是由 Linux Mint 独创的,而是早在大约 10 年前就有了。 + +你可能还记得 Ubuntu 在 2013-2014 年向 Unity 桌面中加入了网页应用程序这项特性。 + +轻量级 Linux 发行版 PeppermintOS 自 2010 年起就将 ICE(网页应用程序工具)列为其主要特色之一。实际上,Linux Mint 的网页应用程序管理器也是基于 [ICE][9] 的。 + +我个人喜欢网页应用程序,因为有用。 + +你怎么看 Linux Mint 中的网页应用程序呢,这是你期待使用的吗?欢迎在下方评论。 + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/web-app-manager-linux-mint/ + +作者:[Abhishek Prakash][a] +选题:[lujun9972][b] +译者:[koolape](https://github.com/koolape) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://itsfoss.com/author/abhishek/ +[b]: https://github.com/lujun9972 +[1]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/09/Web-App-Manager-linux-mint.jpg?resize=800%2C450&ssl=1 +[2]: https://blog.linuxmint.com/?p=3960 +[3]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/09/Add-web-app-in-Linux-Mint.png?resize=600%2C489&ssl=1 +[4]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/09/Web-Apps-in-Linux-Mint.png?resize=600%2C489&ssl=1 +[5]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/09/youtube-web-app-linux-mint.jpg?resize=800%2C611&ssl=1 +[6]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/09/web-app-alt-tab-switcher.jpg?resize=721%2C576&ssl=1 +[7]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/09/panel.jpg?resize=470%2C246&ssl=1 +[8]: http://www.linuxmint.com/tmp/blog/3960/webapp-manager_1.0.3_all.deb +[9]: https://github.com/peppermintos/ice diff --git a/published/202009/20200904 Build a remote management console using Python and Jupyter Notebooks.md b/published/202009/20200904 Build a remote management console using Python and Jupyter Notebooks.md new file mode 100644 index 0000000000..8134eb911a --- /dev/null +++ b/published/202009/20200904 Build a remote management console using Python and Jupyter Notebooks.md @@ -0,0 +1,102 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12606-1.html) +[#]: subject: (Build a remote management console using Python and Jupyter Notebooks) +[#]: via: (https://opensource.com/article/20/9/remote-management-jupyter) +[#]: author: (Moshe Zadka https://opensource.com/users/moshez) + +使用 Jupyter Notebooks 构建一个远程管理控制台 +====== + +> 把 Jupyter 变成一个远程管理控制台。 + +![](https://img.linux.net.cn/data/attachment/album/202009/12/115114jct1g15e9ucsr6ua.jpg) + +SSH 是一个强大的远程管理工具,但有些细节还不够好。编写一个成熟的远程管理控制台听起来好像是一件很费劲的事情。当然,开源社区中肯定有人已经写了一些东西吧? + +是的,他们已经写出来了,它的名字是 [Jupyter][2]。你可能会认为 Jupyter 是那些数据科学家用来分析一周内的广告点击趋势之类的工具。这并没有错,它确实是的,而且它是一个很好的工具。但这仅仅刻画是它的表面。 + +### 关于 SSH 端口转发 + +有时,你可以通过 22 端口进入一台服务器。一般你也连接不到其他端口。也许你是通过另一个有更多访问权限的“堡垒机”,或者限制主机或端口的网络防火墙访问 SSH。当然,限制访问的 IP 范围是有充分理由的。SSH 是远程管理的安全协议,但允许任何人连接到任何端口是相当不必要的。 + +这里有一个替代方案:运行一个简单的 SSH 端口转发命令,将本地端口转发到一个“远程”本地连接上。当你运行像 `-L 8111:127.0.0.1:8888` 这样的 SSH 端口转发命令时,你是在告诉 SSH 将你的*本地*端口 `8111` 转发到它认为的“远程”主机 `127.0.0.1:8888`。远程主机认为 `127.0.0.1` 就是它本身。 + +就像在《芝麻街》节目一样,“这里”是一个微妙的词。 + +地址 `127.0.0.1` 就是你告诉网络的“这里”。 + +### 实际动手学习 + +这可能听起来很混乱,但运行比解释它更简单。 + +``` +$ ssh -L 8111:127.0.0.1:8888 moshez@172.17.0.3 +Linux 6ad096502e48 5.4.0-40-generic #44-Ubuntu SMP Tue Jun 23 00:01:04 UTC 2020 x86_64 + +The programs included with the Debian GNU/Linux system are free software; +the exact distribution terms for each program are described in the +individual files in /usr/share/doc/*/copyright. + +Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent +permitted by applicable law. +Last login: Wed Aug 5 22:03:25 2020 from 172.17.0.1 +$ jupyter/bin/jupyter lab --ip=127.0.0.1 +[I 22:04:29.771 LabApp] JupyterLab application directory is /home/moshez/jupyter/share/jupyter/lab +[I 22:04:29.773 LabApp] Serving notebooks from local directory: /home/moshez +[I 22:04:29.773 LabApp] Jupyter Notebook 6.1.1 is running at: +[I 22:04:29.773 LabApp] http://127.0.0.1:8888/?token=df91012a36dd26a10b4724d618b2e78cb99013b36bb6a0d1 +<删节> +``` + +端口转发 `8111` 到 `127.0.0.1`,并在远程主机上启动 Jupyter,它在 `127.0.0.1:8888` 上监听。 + +现在你要明白,Jupyter 在撒谎。它认为你需要连接到 `8888` 端口,但你把它转发到 `8111` 端口。所以,当你把 URL 复制到浏览器后,但在点击回车之前,把端口从 `8888` 修改为 `8111`。 + +![Jupyter remote management console][3] + +这就是你的远程管理控制台。如你所见,底部有一个“终端”图标。点击它可以启动一个终端。 + +![Terminal in Jupyter remote console][5] + +你可以运行一条命令。创建一个文件会在旁边的文件浏览器中显示出来。你可以点击该文件,在本地的编辑器中打开它。 + +![Opening a file][6] + +你还可以下载、重命名或删除文件: + +![File options in Jupyter remote console][7] + +点击**上箭头**就可以上传文件了。那就上传上面的截图吧。 + +![Uploading a screenshot][8] + +最后说个小功能,Jupyter 可以让你直接通过双击远程图像查看。 + +哦,对了,如果你想用 Python 做系统自动化,还可以用 Jupyter 打开笔记本。 + +所以,下次你需要远程管理防火墙环境的时候,为什么不使用 Jupyter 呢? + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/9/remote-management-jupyter + +作者:[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://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/computer_space_graphic_cosmic.png?itok=wu493YbB (Computer laptop in space) +[2]: https://jupyter.org/ +[3]: https://opensource.com/sites/default/files/uploads/output_1_0.png (Jupyter remote management console) +[4]: https://creativecommons.org/licenses/by-sa/4.0/ +[5]: https://opensource.com/sites/default/files/uploads/output_3_0.png (Terminal in Jupyter remote console) +[6]: https://opensource.com/sites/default/files/uploads/output_5_0.png (Opening a file) +[7]: https://opensource.com/sites/default/files/uploads/output_7_0.png (File options in Jupyter remote console) +[8]: https://opensource.com/sites/default/files/uploads/output_9_0.png (Uploading a screenshot) diff --git a/published/202009/20200907 Linux Jargon Buster- What is a Linux Distribution- Why is it Called a ‘Distribution.md b/published/202009/20200907 Linux Jargon Buster- What is a Linux Distribution- Why is it Called a ‘Distribution.md new file mode 100644 index 0000000000..88dcc5cdeb --- /dev/null +++ b/published/202009/20200907 Linux Jargon Buster- What is a Linux Distribution- Why is it Called a ‘Distribution.md @@ -0,0 +1,90 @@ +[#]: collector: (lujun9972) +[#]: translator: (wxy) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12609-1.html) +[#]: subject: (Linux Jargon Buster: What is a Linux Distribution? Why is it Called a ‘Distribution’?) +[#]: via: (https://itsfoss.com/what-is-linux-distribution/) +[#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/) + +Linux 黑话解释:什么是 Linux 发行版?为什么它被称为“发行版”? +====== + +> 在这一章的 Linux 黑话解释中,我们来讨论一些基本的东西。 + +![][8] + +让我们来讨论一下什么是 Linux 发行版,为什么它被称为发行版distribution(或简称 distro),以及,它与 Linux 内核有什么不同。你还会了解到为什么有些人坚称 Linux 为 GNU/Linux。 + +### 什么是 Linux 发行版? + +Linux 发行版是一个由 Linux 内核、[GNU 工具][1]、附加软件和软件包管理器组成的操作系统,它也可能包括[显示服务器][9]和[桌面环境][2],以用作常规的桌面操作系统。 + +这个术语之所以是 “Linux 发行版”,是因为像 Debian、Ubuntu 这样的机构“发行”了 Linux 内核以及所有必要的软件及实用程序(如网络管理器、软件包管理器、桌面环境等),使其可以作为一个操作系统使用。 + +你的发行版还负责提供更新来维护其内核和其他实用程序。 + +所以,“Linux” 是内核,而 “Linux 发行版”是操作系统。这就是为什么它们有时也被称为基于 Linux 的操作系统的原因。 + +如果不是很理解以上所有的内容,不要担心。下面我将详细解释一下。 + +### “Linux 只是一个内核,不是一个操作系统。”这是什么意思? + +你可能看到到过这句话,这说的没错。内核是一个操作系统的核心,它接近于具体硬件。你使用应用程序和 shell 与它交互。 + +![Linux 内核结构][3] + +为了理解这一点,我就用我在《[什么是 Linux 的详细指南][4]》中曾用过的那个比喻。把操作系统看成车辆,把内核看成引擎。你不能直接驱动引擎。同样,你也不能直接使用内核。 + +![操作系统类比][5] + +一个 Linux 发行版可以看作是一个汽车制造商(比如丰田或福特)为你提供的现成的汽车,就像 Ubuntu 或 Fedora 发行版的发行商为你提供的一个基于 Linux 的现成操作系统一样。 + +### 什么是 GNU/Linux? + +让我们再来看看这张图片。1991 年的时候,[Linus Torvalds][6] 创造的只是其中的最内圈,即 Linux 内核。 + +![Linux 内核结构][3] + +要使用 Linux,即使是以最原始的形式,甚至没有 GUI,你也需要一个 shell。最常见的是 Bash shell。 + +然后,你需要在 shell 中运行一些命令来完成一些工作。你能记起一些基本的 Linux 命令吗?比如 `cat`、`cp`、`mv`、`grep`、`find`、`diff`、`gzip` 等等。 + +严格来说,这些所谓的“Linux 命令”并不是只属于 Linux。它们中的很多都来源于 UNIX 操作系统。 + +在 Linux 诞生之前,Richard Stallman 就已经在 1983 年创建了自由软件项目free software project中的第一个项目:GNU(GNU 是“GNU is Not Unix” 的递归缩写)。[GNU 项目][7]实现了许多流行的 Unix 实用程序,如 `cat`、`grep`、`awk`、shell(`bash`),同时还开发了自己的编译器(GCC)和编辑器(Emacs)。 + +在 80 年代,UNIX 是专有软件,而且超级昂贵。这就是为什么 Linus Torvalds 开发了一个类似 UNIX 的新内核的原因。为了与 Linux 内核进行交互,Linus Torvalds 使用了 GNU 工具,这些工具在其 GPL 开源许可证下是免费的。 + +有了这些 GNU 工具,它的行为也像 UNIX 一样。这就是为什么 Linux 也被称为类 UNIX 操作系统的原因。 + +你无法想象没有 shell 和所有这些命令的 Linux。由于 Linux 与 GNU 工具集成得很深,几乎是完全依赖于 GNU 工具,所以纯粹主义者要求 GNU 应该得到应有的认可,这就是为什么他们坚称它为 GNU Linux(写成 GNU/Linux)。 + +### 总结 + +那么,该用哪个术语?Linux、GNU/Linux、Linux 发行版,基于 Linux 的操作系统还是类 UNIX 操作系统?这取决于你的上下文。我已经为你提供了足够的细节,让你对这些相关的术语有更好的理解。 + +我希望你喜欢这个 Linux 黑话解释系列,并能学习到新的东西。欢迎你的反馈和建议。 + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/what-is-linux-distribution/ + +作者:[Abhishek Prakash][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://itsfoss.com/author/abhishek/ +[b]: https://github.com/lujun9972 +[1]: https://www.gnu.org/manual/blurbs.html +[2]: https://itsfoss.com/what-is-desktop-environment/ +[3]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/03/Linux_Kernel_structure.png?resize=800%2C350&ssl=1 +[4]: https://itsfoss.com/what-is-linux/ +[5]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/03/operating_system_analogy.png?resize=800%2C350&ssl=1 +[6]: https://itsfoss.com/linus-torvalds-facts/ +[7]: https://www.gnu.org/gnu/thegnuproject.en.html +[8]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/09/what-is-linux-distribution.png?resize=800%2C450&ssl=1 +[9]: https://linux.cn/article-12589-1.html \ No newline at end of file diff --git a/published/202009/20200907 Program hardware from the Linux command line.md b/published/202009/20200907 Program hardware from the Linux command line.md new file mode 100644 index 0000000000..7ecd05315d --- /dev/null +++ b/published/202009/20200907 Program hardware from the Linux command line.md @@ -0,0 +1,217 @@ +[#]: collector: (lujun9972) +[#]: translator: (wxy) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12667-1.html) +[#]: subject: (Program hardware from the Linux command line) +[#]: via: (https://opensource.com/article/20/9/hardware-command-line) +[#]: author: (Alan Smithee https://opensource.com/users/alansmithee) + +使用 RT-Thread 的 FinSH 对硬件进行编程 +====== + +> 由于物联网(IoT)的兴起,对硬件进行编程变得越来越普遍。RT-Thread 可以让你可以用 FinSH 从 Linux 命令行与设备进行沟通、 + +![](https://img.linux.net.cn/data/attachment/album/202009/29/233059w523g55qzvo53h6i.jpg) + +RT-Thread 是一个开源的[实时操作系统][2],用于对物联网(IoT)设备进行编程。FinSH 是 [RT-Thread][3] 的命令行组件,它提供了一套操作界面,使用户可以从命令行与设备进行沟通。它主要用于调试或查看系统信息。 + +通常情况下,开发调试使用硬件调试器和 `printf` 日志来显示。但在某些情况下,这两种方法并不是很有用,因为它是从运行的内容中抽象出来的,而且它们可能很难解析。不过 RT-Thread 是一个多线程系统,当你想知道一个正在运行的线程的状态,或者手动控制系统的当前状态时,这很有帮助。因为它是多线程的,所以你能够拥有一个交互式的 shell,你可以直接在设备上输入命令、调用函数来获取你需要的信息,或者控制程序的行为。如果你只习惯于 Linux 或 BSD 等现代操作系统,这在你看来可能很普通,但对于硬件黑客来说,这是极其奢侈的,远超将串行电缆直接连线到电路板上以获取一丝错误的做法。 + +FinSH 有两种模式。 + + * C 语言解释器模式,称为 c-style。 + * 传统的命令行模式,称为 msh(模块 shell)。 + +在 C 语言解释器模式下,FinSH 可以解析执行大部分 C 语言的表达式,并使用函数调用访问系统上的函数和全局变量。它还可以从命令行创建变量。 + +在 msh 模式下,FinSH 的操作与 Bash 等传统 shell 类似。 + +### GNU 命令标准 + +当我们在开发 FinSH 时,我们了解到,在编写命令行应用程序之前,你需要熟悉 GNU 命令行标准。这个标准实践的框架有助于给界面带入熟悉感,这有助于开发人员在使用时感到舒适和高效。 + +一个完整的 GNU 命令主要由四个部分组成。 + + 1. 命令名(可执行文件):命令行程序的名称; + 2. 子命令:命令程序的子函数名称。 + 3. 选项:子命令函数的配置选项。 + 4. 参数:子命令函数配置选项的相应参数。 + +你可以在任何命令中看到这一点。以 Git 为例: + +``` +git reset --hard HEAD~1 +``` + +这一点可以分解为: + +![GNU command line standards][4] + +可执行的命令是 `git`,子命令是 `reset`,使用的选项是 `--head`,参数是 `HEAD~1`。 + +再举个例子: + +``` +systemctl enable --now firewalld +``` + +可执行的命令是 `systemctl`,子命令是 `enable`,选项是 `--now`,参数是 `firewalld`。 + +想象一下,你想用 RT-Thread 编写一个符合 GNU 标准的命令行程序。FinSH 拥有你所需要的一切,并且会按照预期运行你的代码。更棒的是,你可以依靠这种合规性,让你可以自信地移植你最喜欢的 Linux 程序。 + +### 编写一个优雅的命令行程序 + +下面是一个 RT-Thread 运行命令的例子,RT-Thread 开发人员每天都在使用这个命令: + +``` +usage: env.py package [-h] [--force-update] [--update] [--list] [--wizard] +                      [--upgrade] [--printenv] + +optional arguments: +  -h, --help      show this help message and exit +  --force-update  force update and clean packages, install or remove the +                  packages by your settings in menuconfig +  --update        update packages, install or remove the packages by your +                  settings in menuconfig +  --list          list target packages +  --wizard        create a new package with wizard +  --upgrade       upgrade local packages list and ENV scripts from git repo +  --printenv      print environmental variables to check +``` + +正如你所看到的那样,它看起来很熟悉,行为就像你可能已经在 Linux 或 BSD 上运行的大多数 POSIX 应用程序一样。当使用不正确或不充分的语法时,它会提供帮助,它支持长选项和短选项。这种通用的用户界面对于任何使用过 Unix 终端的人来说都是熟悉的。 + +### 选项种类 + +选项的种类很多,按长短可分为两大类。 + + 1. 短选项:由一个连字符加一个字母组成,如 `pkgs -h` 中的 `-h` 选项。 + 2. 长选项:由两个连字符加上单词或字母组成,例如,`scons- --target-mdk5` 中的 `--target` 选项。 + +你可以把这些选项分为三类,由它们是否有参数来决定。 + + 1. 没有参数:该选项后面不能有参数。 + 2. 参数必选:选项后面必须有参数。 + 3. 参数可选:选项后可以有参数,但不是必需的。 + +正如你对大多数 Linux 命令的期望,FinSH 的选项解析非常灵活。它可以根据空格或等号作为定界符来区分一个选项和一个参数,或者仅仅通过提取选项本身并假设后面的内容是参数(换句话说,完全没有定界符)。 + + * `wavplay -v 50` + * `wavplay -v50` + * `wavplay --vol=50` + +### 使用 optparse + +如果你曾经写过命令行程序,你可能会知道,一般来说,你所选择的语言有一个叫做 optparse 的库或模块。它是提供给程序员的,所以作为命令的一部分输入的选项(比如 `-v` 或 `--verbose`)可以与命令的其他部分进行*解析*。这可以帮助你的代码从一个子命令或参数中获取一个选项。 + +当为 FinSH 编写一个命令时,`optparse` 包希望使用这种格式: + +``` +MSH_CMD_EXPORT_ALIAS(pkgs, pkgs, this is test cmd.); +``` + +你可以使用长形式或短形式,或者同时使用两种形式来实现选项。例如: + +``` +static struct optparse_long long_opts[] = +{ +    {"help"        , 'h', OPTPARSE_NONE}, // Long command: help, corresponding to short command h, without arguments. +    {"force-update",  0 , OPTPARSE_NONE}, // Long comman: force-update, without arguments +    {"update"      ,  0 , OPTPARSE_NONE}, +    {"list"        ,  0 , OPTPARSE_NONE}, +    {"wizard"      ,  0 , OPTPARSE_NONE}, +    {"upgrade"     ,  0 , OPTPARSE_NONE}, +    {"printenv"    ,  0 , OPTPARSE_NONE}, +    { NULL         ,  0 , OPTPARSE_NONE} +}; +``` + +创建完选项后,写出每个选项及其参数的命令和说明: + +``` +static void usage(void) +{ +    rt_kprintf("usage: env.py package [-h] [--force-update] [--update] [--list] [--wizard]\n"); +    rt_kprintf("                      [--upgrade] [--printenv]\n\n"); +    rt_kprintf("optional arguments:\n"); +    rt_kprintf("  -h, --help      show this help message and exit\n"); +    rt_kprintf("  --force-update  force update and clean packages, install or remove the\n"); +    rt_kprintf("                  packages by your settings in menuconfig\n"); +    rt_kprintf("  --update        update packages, install or remove the packages by your\n"); +    rt_kprintf("                  settings in menuconfig\n"); +    rt_kprintf("  --list          list target packages\n"); +    rt_kprintf("  --wizard        create a new package with wizard\n"); +    rt_kprintf("  --upgrade       upgrade local packages list and ENV scripts from git repo\n"); +    rt_kprintf("  --printenv      print environmental variables to check\n"); +} +``` + +下一步是解析。虽然你还没有实现它的功能,但解析后的代码框架是一样的: + +``` +int pkgs(int argc, char **argv) +{ + int ch; + int option_index; + struct optparse options; + + if(argc == 1) + { + usage(); + return RT_EOK; + } + + optparse_init(&options, argv); + while((ch = optparse_long(&options, long_opts, &option_index)) != -1) + { + ch = ch; + + rt_kprintf("\n"); + rt_kprintf("optopt = %c\n", options.optopt); + rt_kprintf("optarg = %s\n", options.optarg); + rt_kprintf("optind = %d\n", options.optind); + rt_kprintf("option_index = %d\n", option_index); + } + rt_kprintf("\n"); + + return RT_EOK; +} +``` + +这里是函数头文件: + +``` +#include "optparse.h" +#include "finsh.h" +``` + +然后,编译并下载到设备上。 + +![Output][6] + +### 硬件黑客 + +对硬件进行编程似乎很吓人,但随着物联网的发展,它变得越来越普遍。并不是所有的东西都可以或者应该在树莓派上运行,但在 RT-Thread,FinSH 可以让你保持熟悉的 Linux 感觉。 + +如果你对在裸机上编码感到好奇,不妨试试 RT-Thread。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/9/hardware-command-line + +作者:[Alan Smithee][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/alansmithee +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/command_line_prompt.png?itok=wbGiJ_yg (Command line prompt) +[2]: https://opensource.com/article/20/6/open-source-rtos +[3]: https://github.com/RT-Thread/rt-thread +[4]: https://opensource.com/sites/default/files/uploads/command-line-apps_2.png (GNU command line standards) +[5]: https://creativecommons.org/licenses/by-sa/4.0/ +[6]: https://opensource.com/sites/default/files/uploads/command-line-apps_3.png (Output) diff --git a/published/202009/20200909 How to Connect to WiFi from the Terminal in Ubuntu Linux.md b/published/202009/20200909 How to Connect to WiFi from the Terminal in Ubuntu Linux.md new file mode 100644 index 0000000000..0d5ba1fe40 --- /dev/null +++ b/published/202009/20200909 How to Connect to WiFi from the Terminal in Ubuntu Linux.md @@ -0,0 +1,199 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12629-1.html) +[#]: subject: (How to Connect to WiFi from the Terminal in Ubuntu Linux) +[#]: via: (https://itsfoss.com/connect-wifi-terminal-ubuntu/) +[#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/) + +如何在 Linux 终端中连接 WiFi? +====== + +> 在本教程中,你将学习如何在 Ubuntu 中从终端连接到无线网络。如果你在使用 Ubuntu 服务器时,无法访问常规的[桌面环境][1],这将对你非常有帮助。 + +我的家用电脑主要使用桌面 Linux。我也有多台 Linux 服务器用于托管网站以及开源软件,如 [Nextcloud][2]、[Discourse][3]、Ghost、Rocket Chat 等。 + +我可以使用 [Linode][4] 在云端几分钟内快速部署 Linux 服务器。但最近,我在我的树莓派上安装了 [Ubuntu 服务器][5]。这是我第一次在物理设备上安装服务器,我不得不做一些额外的事情来通过命令行将 Ubuntu 服务器连接到 WiFi。 + +在本教程中,我将展示在 Ubuntu Linux 中使用终端连接到 WiFi 的步骤。你应该: + + * 不要害怕使用终端编辑文件。 + * 知道 wifi 接入点名称 (SSID) 和密码。 + +### 在 Ubuntu 中从终端连接到 WiFi + +![][6] + +当你使用 Ubuntu 桌面时,连接到 WiFi 是很容易的,因为你有图形用户界面,可以很容易地做到这一点。但当你使用 Ubuntu 服务器时就不一样了,因为你只能使用命令行。 + +Ubuntu 使用 [Netplan][7] 工具来轻松配置网络。在 Netplan 中,你可以创建一个包含网络接口描述的 YAML 文件,然后在 `netplan` 命令行工具的帮助下,生成所有需要的配置。 + +让我们看看如何使用 Netplan 从终端连接到无线网络。 + +#### 步骤 1:确定你的无线网络接口名称 + +有几种方法可以识别你的网络接口名称。你可以使用 `ip` 命令、过时的 `ipconfig` 命令或查看这个文件: + +``` +ls /sys/class/net +``` + +这应该会展示所有可用的网络接口(以太网、WiFi 和环回)。无线网络接口名称以 `w` 开头,通常命名类似 `wlanX`、`wlpxyz`。 + +``` +[email protected]:~$ ls /sys/class/net +eth0 lo wlan0 +``` + +记下这个接口名。你将在下一步使用它。 + +#### 步骤 2:编辑 Netplan 配置文件中的 wifi 接口详细信息 + +Netplan 配置文件在 `/etc/netplan` 目录下。如果你查看这个目录的内容,你应该看到类似 `01-network-manager-all.yml` 或 `50-cloud-init.yaml` 等文件。 + +如果是 Ubuntu 服务器,你应该有 `50-cloud-init.yaml` 文件。如果是桌面计算机,应该是 `01-network-manager-all.yml` 文件。 + +Linux 桌面计算机的 Network Manager 允许你选择一个无线网络。你可以在它的配置中硬编码写入 WiFi 接入点。这可以在自动掉线的情况下(比如挂起)时帮助到你。 + +不管是哪个文件,都可以打开编辑。我希望你对 Nano 编辑器有一点[熟悉][8],因为 Ubuntu 预装了它。 + +``` +sudo nano /etc/netplan/50-cloud-init.yaml +``` + +YAML 文件对空格、缩进和对齐方式非常敏感。不要使用制表符,在看到缩进的地方使用 4 个空格(或 2 个,以 YAML 文件中已经使用的为准)代替。 + +基本上,你需要添加以下几行,引号中是接入点名称(SSID) 和密码(通常): + +``` +wifis: + wlan0: + dhcp4: true + optional: true + access-points: + "SSID_name": + password: "WiFi_password" +``` + +再说一次,保持我所展示的对齐方式,否则 YAML 文件不能被解析,它会抛出一个错误。 + +你的完整配置文件可能是这样的: + +``` +# This file is generated from information provided by the datasource. Changes +# to it will not persist across an instance reboot. To disable cloud-init's +# network configuration capabilities, write a file +# /etc/cloud/cloud.cfg.d/99-disable-network-config.cfg with the following: +# network: {config: disabled} +network: + ethernets: + eth0: + dhcp4: true + optional: true + version: 2 + wifis: + wlan0: + dhcp4: true + optional: true + access-points: + "SSID_name": + password: "WiFi_password" +``` + +我觉得很奇怪,尽管有消息说更改不会在实例重启后保留,但它仍然可以工作。 + +不管怎样,用这个命令生成配置: + +``` +sudo netplan generate +``` + +现在应用它: + +``` +sudo netplan apply +``` + +如果你幸运的话,你应该连上网络。尝试 `ping` 一个网站或运行 `apt` 更新命令。 + +然而,事情可能不会那么顺利,你可能会看到一些错误。如果是这种情况,请尝试一些额外的步骤。 + +#### 可能的故障排除 + +当你使用 `netplan apply` 命令时,你有可能在输出中看到类似这样的错误。 + +``` +Failed to start netplan-wpa-wlan0.service: Unit netplan-wpa-wlan0.service not found. +Traceback (most recent call last): + File "/usr/sbin/netplan", line 23, in + netplan.main() + File "/usr/share/netplan/netplan/cli/core.py", line 50, in main + self.run_command() + File "/usr/share/netplan/netplan/cli/utils.py", line 179, in run_command + self.func() + File "/usr/share/netplan/netplan/cli/commands/apply.py", line 46, in run + self.run_command() + File "/usr/share/netplan/netplan/cli/utils.py", line 179, in run_command + self.func() + File "/usr/share/netplan/netplan/cli/commands/apply.py", line 173, in command_apply + utils.systemctl_networkd('start', sync=sync, extra_services=netplan_wpa) + File "/usr/share/netplan/netplan/cli/utils.py", line 86, in systemctl_networkd + subprocess.check_call(command) + File "/usr/lib/python3.8/subprocess.py", line 364, in check_call + raise CalledProcessError(retcode, cmd) +subprocess.CalledProcessError: Command '['systemctl', 'start', '--no-block', 'systemd-networkd.service', 'netplan-wpa-wlan0.service']' returned non-zero exit status 5. +``` + +可能是 `wpa_supplicant` 服务没有运行。运行这个命令: + +``` +sudo systemctl start wpa_supplicant +``` + +再次运行 `netplan apply`。如果它能解决这个问题,那就太好了。否则,使用下面的命令[关闭 Ubuntu 系统][9]: + +``` +shutdown now +``` + +重新启动 Ubuntu 系统,登录并再次生成和运行 `netplan apply`: + +``` +sudo netplan generate +sudo netplan apply +``` + +现在可能会显示警告(而不是错误)。这是警告而不是错误。我检查了[正在运行的 systemd 服务][10],发现 `netplan-wpa-wlan0.service` 已经在运行了。可能是因为它已经在运行了,而且 `netplan apply` 更新了配置文件(即使没有任何改变),所以显示了警告。 + +``` +Warning: The unit file, source configuration file or drop-ins of netplan-wpa-wlan0.service changed on disk. Run 'systemctl daemon-reload' to reload units. +``` + +这并不重要,你可以通过运行 `apt update` 来检查网络是否已经正常工作。 + +我希望你能够在本教程的帮助下,在 Ubuntu 中使用命令行连接到 WiFi。如果你仍然遇到困难,请在评论区告诉我。 + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/connect-wifi-terminal-ubuntu/ + +作者:[Abhishek Prakash][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://itsfoss.com/author/abhishek/ +[b]: https://github.com/lujun9972 +[1]: https://itsfoss.com/what-is-desktop-environment/ +[2]: https://itsfoss.com/nextcloud/ +[3]: https://www.discourse.org/ +[4]: https://itsfoss.com/recommends/linode/ +[5]: https://itsfoss.com/install-ubuntu-server-raspberry-pi/ +[6]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/09/connect-to-wifi-from-terminal-ubuntu.png?resize=800%2C450&ssl=1 +[7]: https://netplan.io/ +[8]: https://itsfoss.com/nano-editor-guide/ +[9]: https://itsfoss.com/schedule-shutdown-ubuntu/ +[10]: https://linuxhandbook.com/systemd-list-services/ diff --git a/published/202009/20200909 Manage your SSH connections with this open source tool.md b/published/202009/20200909 Manage your SSH connections with this open source tool.md new file mode 100644 index 0000000000..10e4bd0f0c --- /dev/null +++ b/published/202009/20200909 Manage your SSH connections with this open source tool.md @@ -0,0 +1,122 @@ +[#]: collector: "lujun9972" +[#]: translator: "hom" +[#]: reviewer: "wxy" +[#]: publisher: "wxy" +[#]: url: "https://linux.cn/article-12632-1.html" +[#]: subject: "Manage your SSH connections with this open source tool" +[#]: via: "https://opensource.com/article/20/9/ssh-connection-manager" +[#]: author: "Kenneth Aaron https://opensource.com/users/flyingrhino" + +使用开源工具 nccm 管理 SSH 连接 +====== + +> 使用 nccm 让你的终端连接 SSH 会话更快、更稳、更轻松。 + +![](https://img.linux.net.cn/data/attachment/album/202009/19/233942j6ne6wllnlbnjd36.jpg) + +OpenSSH 很常用,但没有一个知名的连接管理器,因此我开发了 ncurses SSH 连接管理器(`nccm`)来填补这个重要的空白。 `nccm` 是一个简单的 SSH 连接管理器,具有非常便于移植的终端界面(就如项目名称所示,使用 ncurses 编写)。最重要的是,它使用起来非常简单。有了 `nccm`,你可以花费最少的精力和最少的按键连接到你选择的 SSH 会话。 + +### 安装 nccm + +最快的方式是从它的 [Git 仓库][2]克隆该项目: + +``` +$ git clone https://github.com/flyingrhinonz/nccm nccm.git +``` + +在 `nccm.git/nccm` 的文件夹中有两个文件:`nccm` 自身和 `nccm.yml` 配置文件。 + +首先将 `nccm` 脚本复制到系统目录 `/usr/local/bin/` 中并添加执行权限,也可以通过使用`install` 命令来完成操作: + +``` +$ sudo install -m755 nccm –target-directory /usr/local/bin +``` + +文件 `nccm.yml` 可以拷贝到以下任意一个位置,默认从找到的第一个位置获取配置: + + * `~/.config/nccm/nccm.yml` + * `~/.nccm.yml` + * `~/nccm.yml` + * `/etc/nccm.yml` + +`nccm` 需要在 Python 3 的环境中运行,这在大部分的 Linux 环境是没问题的。大多数 Python 库的依赖包已经作为 Python 3 的一部分存在,但是,有一些 YAML 的依赖包和实用程序是你必须安装的。 + +如果你没有安装 `pip`,你可以使用包管理器来安装它。在安装的同时,也请安装 `yamllint` 应用程序来帮助你验证 `nccm.yml` 文件。 + +在 Debian 或类似系统使用 `apt` 命令: + +``` +$ sudo apt install python3-pip yamllint +``` + +在 Fedora 或者类似系统使用 `dnf` 命令: + +``` +$ sudo dnf install python3-pip yamllint +``` + +`PyYAML` 也是必须安装的,可以通过使用 `pip` 来安装: + +``` +$ pip3 install --user PyYAML +``` + +### 使用 nccm + +开始之前,需要修改 `nccm.yml` 文件来添加 SSH 连接配置,可以参照示例文件格式化 YAML 文件。仿照示例文件在开头添加连接名称,配置项使用两个空格缩进。不要忘了冒号(`:`),这是 YAML 的语言的格式。 + +不要担心你的 SSH 会话信息以何顺序排列,因为 `nccm` 在程序内提供了排序的方式。 + +如果修改完成,可以使用 `yamllint` 来校验配置: + +``` +$ yamllint ~/.config/nccm/nccm.yml +``` + +如果没有错误信息返回,说明文件的内容格式是正确的,可以进行下面的步骤。 + +如果 `nccm` 可以[从你的路径][3]中找到并且可以执行,那么输入 `nccm` 就可以启动 TUI(文本用户界面)了。如果你看到 Python 3 抛出的异常,请检查依赖包是否正确安装,任何异常都应该提到缺少的依赖包。 + +只要你没有在 YAML 配置文件中更改 `ncm_config_control` 模式,那么你可以使用以下的键盘按键来控制: + + * `Up`/`Down` 方向键 - 移动光标 + * `Home`/`End` - 跳转到文件开始和结尾 + * `PgUp`/`PgDn` - 以页为单位查看 + * `Left`/`Right` 方向键 - 水平滚动 + * `TAB` - 在文本框之间移动 + * 回车 - 连接选中的 SSH 会话 + * `Ctrl-h` - 显示帮助菜单 + * `Ctrl-q`/`Ctrl-c` - 退出 + * `F1`-`F5` 或 `!` `@` `#` `$` `%` - 按 1-5 列排序 + +使用 `F1` 到 `F5` 来按 1-5 列排序,如果你的设备占用了这些 `F1` - `F5` 键,你可以使用`!` `@` `#` `$` `%` 来替代。默认界面显示 4 列内容,但我们将用户名和服务器地址作为单独的列来排序,这样我们就有了 5 个排序方式。你也可以通过再次按下排序的按键来逆转排序。在选中的行上按回车可以建立会话。 + +![nccm screenshot terminal view][4] + +在 `Filter` 文本框中输入过滤内容,会用输入的内容以“与”的关系来过滤输出内容。这是不区分大小写的,而条目间用空白分隔。在 `Conn` 部分也是如此,但在这里按回车键可以连接到那个特定的条目编号。 + +这个工具还有许多功能需要你去发掘,比如专注模式,这些部分留下等待你去探索,也可以查看项目主页或者内置的帮助文档查看更多细节内容。 + +项目的 YAML 配置文件的文档是完善的,所以你可以查阅修改使 `nccm` 使用起来更加顺手。`nccm` 项目是非常希望得到你的反馈的,所以你可以复刻该项目然后添加更多新功能,欢迎大家提出拉取请求。 + +### 使用 nccm 来放松连接 SSH 的压力 + +像我一样,我希望这个工具可以对你有用,感谢能够为开源工作增加自己的贡献,请接受 `nccm` 作为我对开源项目自由、高效工作所做的贡献。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/9/ssh-connection-manager + +作者:[Kenneth Aaron][a] +选题:[lujun9972][b] +译者:[hom](https://github.com/hom) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/flyingrhino +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/linux-penguins.png?itok=yKOpaJM_ "Penguins" +[2]: https://github.com/flyingrhinonz/nccm +[3]: https://opensource.com/article/17/6/set-path-linux +[4]: https://opensource.com/sites/default/files/uploads/nccm_screenshot.png "nccm screenshot terminal view" diff --git a/published/202009/20200909 Using the Linux stat command to create flexible file listings.md b/published/202009/20200909 Using the Linux stat command to create flexible file listings.md new file mode 100644 index 0000000000..866f29bba6 --- /dev/null +++ b/published/202009/20200909 Using the Linux stat command to create flexible file listings.md @@ -0,0 +1,131 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12637-1.html) +[#]: subject: (Using the Linux stat command to create flexible file listings) +[#]: via: (https://www.networkworld.com/article/3573802/using-the-linux-stat-command-to-create-flexible-file-listings.html) +[#]: author: (Sandra Henry-Stocker https://www.networkworld.com/author/Sandra-Henry_Stocker/) + +使用 Linux stat 命令创建灵活的文件列表 +====== + +![](https://img.linux.net.cn/data/attachment/album/202009/21/223030wi3xfx2eprij13z2.jpg) + +`stat` 命令提供了很多关于文件的详细信息。 + +它不仅提供了文件最近变化的日期/时间,还显示了最近访问文件的时间和权限变化。它可以同时告诉你文件的字节大小和块的数量。它可以显示文件使用的 inode 以及文件类型。它包括了文件所有者和相关用户组的名称和 UID/GID。它以 “rwx”(被称为 “人类可读” 格式)和数字方式显示文件权限。在某些系统中,它甚至可能包括文件创建的日期和时间(称为“出生”)。 + +除了提供所有这些信息外,`stat` 命令还可以用来创建文件列表。这些列表非常灵活,你可以选择包含上述任何或全部信息。 + +要生成一个自定义列表,你只需要使用 `stat` 命令的 `-c`(或 `--format`)选项,并指定你想要包含的字段。例如,要创建一个以两种格式显示文件权限的列表,使用这个命令: + +``` +$ stat -c '%n %a %A' my* +my.banner 664 -rw-rw-r-- +mydir 775 drwxrwxr-x +myfile 664 -rw-rw-r-- +myjunk 777 lrwxrwxrwx +mykey 664 -rw-rw-r-- +mylog 664 -rw-rw-r-- +myscript 755 -rwxr-xr-x +mytext 664 -rw-rw-r-- +mytext.bak 664 -rw-rw-r-- +mytwin 50 -rw-r----- +mywords 664 -rw-rw-r-- +``` + +如上例所示,`%n` 代表文件名,`%a` 代表八进制的权限,`%A` 代表 `rwx` 形式的权限。完整的列表如后面所示。 + +要为这个命令创建一个别名,输入这个命令,或在 `.bashrc` 文件中添加这个定义。 + +``` +$ alias ls_perms="stat -c '%n %a %A'" +``` + +要创建一个非常接近 `ls -l` 提供的长列表,可以这样做: + +``` +$ stat -c '%A %h %U %G %s %y %n' my* +-rw-rw-r-- 1 shs shs 255 2020-04-01 16:20:00.899374215 -0400 my.banner +drwxrwxr-x 2 shs shs 4096 2020-09-07 12:50:20.224470760 -0400 mydir +-rw-rw-r-- 1 shs shs 6 2020-05-16 11:12:00.460355387 -0400 myfile +lrwxrwxrwx 1 shs shs 11 2020-05-28 18:49:21.666792608 -0400 myjunk +-rw-rw-r-- 1 shs shs 655 2020-01-14 15:56:08.540540488 -0500 mykey +-rw-rw-r-- 1 shs shs 8 2020-03-04 17:13:21.406874246 -0500 mylog +-rwxr-xr-x 1 shs shs 201 2020-09-07 12:50:41.316745867 -0400 myscript +-rw-rw-r-- 1 shs shs 40 2019-06-06 08:54:09.538663323 -0400 mytext +-rw-rw-r-- 1 shs shs 24 2019-06-06 08:48:59.652712578 -0400 mytext.bak +-rw-r----- 2 shs shs 228 2019-04-12 19:37:12.790284604 -0400 mytwin +-rw-rw-r-- 1 shs shs 1983 2020-08-10 14:39:57.164842370 -0400 mywords +``` + +不同之处包括: 1、不试图将字段排成可辨认的一列,2、日期是 `yy-mm-dd` 格式,3、时间字段更精确,4、增加了时区(-0400 是 EDT)。 + +如果你想根据最后一次访问的日期来列出文件(例如,用 `cat` 命令来显示),使用这样的命令: + +``` +$ stat -c '%n %x' my* | sort -k2 +mytwin 2019-04-22 11:25:20.656828964 -0400 +mykey 2020-08-20 16:10:34.479324431 -0400 +mylog 2020-08-20 16:10:34.527325066 -0400 +myfile 2020-08-20 16:10:57.815632794 -0400 +mytext.bak 2020-08-20 16:10:57.935634379 -0400 +mytext 2020-08-20 16:15:42.323391985 -0400 +mywords 2020-08-20 16:15:43.479407259 -0400 +myjunk 2020-09-07 10:04:26.543980300 -0400 +myscript 2020-09-07 12:50:41.312745815 -0400 +my.banner 2020-09-07 13:22:38.105826116 -0400 +mydir 2020-09-07 14:53:10.171867194 -0400 +``` + +用 `stat` 列出文件细节时,可用的选项包括: + + * `%a` - 八进制的访问权限(注意 `#` 和 `0` 的 printf 标志) + * `%A` – 人类可读的访问权限 + * `%b` – 分配的块数(见 `%B`) + * `%B` – `%b` 报告的每个块的字节数 + * `%C` – SELinux 安全上下文字符串 + * `%d` – 十进制的设备编号 + * `%D` – 十六进制的设备编号 + * `%f` – 十六进制的原始模式 + * `%F` – 文件类型 + * `%g` – 所有者的组 ID + * `%G` – 所有者的组名 + * `%h` – 硬链接的数量 + * `%i` – inode 编号 + * `%m` – 挂载点 + * `%n` – 文件名 + * `%N` – 如果是符号链接,会解引用为指向的文件名 + * `%o` – 最佳 I/O 传输大小提示 + * `%s` – 以字节为单位的总大小 + * `%t` – 十六进制的主要设备类型,用于字符/块设备特殊文件 + * `%T` – 十六进制的次要设备类型,用于字符/块设备特殊文件 + * `%u` – 所有者的用户 ID + * `%U` – 所有者的用户名 + * `%w` – 文件创建时间,以人类可读形式; 如果未知,则为 `-`。 + * `%W` – 文件创建时间,以 UNIX 纪元以来的秒数形式;如果未知,则为 `0`。 + * `%x` – 上次访问时间,以人类可读形式 + * `%X` – 上次访问时间,以 UNIX 纪元以来的秒数形式 + * `%y` – 上次数据修改时间,以人类可读形式 + * `%Y` – 上次数据修改时间,以 UNIX 纪元以来的秒数形式 + * `%z` – 上次状态改变的时间,以人类可读形式 + * `%Z` – 上次状态改变的时间,以 UNIX 纪元以来的秒数形式 + +这些字段的选择都列在手册页中,你可以选择任何一个,不过用你喜欢的选项创建一些别名应该可以省去很多麻烦。有些选项,如 SELinux 安全上下文字符串,除非在系统中有使用,它将不可用。文件创建时间只有在你的系统保留该信息的情况下才可用。 + +-------------------------------------------------------------------------------- + +via: https://www.networkworld.com/article/3573802/using-the-linux-stat-command-to-create-flexible-file-listings.html + +作者:[Sandra Henry-Stocker][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://www.networkworld.com/author/Sandra-Henry_Stocker/ +[b]: https://github.com/lujun9972 +[2]: https://www.facebook.com/NetworkWorld/ +[3]: https://www.linkedin.com/company/network-world diff --git a/published/202009/20200911 The New YubiKey 5C NFC Security Key Lets You Use NFC to Easily Authenticate Your Secure Devices.md b/published/202009/20200911 The New YubiKey 5C NFC Security Key Lets You Use NFC to Easily Authenticate Your Secure Devices.md new file mode 100644 index 0000000000..aa56effebd --- /dev/null +++ b/published/202009/20200911 The New YubiKey 5C NFC Security Key Lets You Use NFC to Easily Authenticate Your Secure Devices.md @@ -0,0 +1,79 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12630-1.html) +[#]: subject: (The New YubiKey 5C NFC Security Key Lets You Use NFC to Easily Authenticate Your Secure Devices) +[#]: via: (https://itsfoss.com/yubikey-5c-nfc/) +[#]: author: (Ankush Das https://itsfoss.com/author/ankush/) + +全新的 YubiKey 5C NFC 安全密钥让你可以使用 NFC 轻松认证你的安全设备 +====== + +如果你格外谨慎,会使用最好的认证方法来保护你的在线帐户的安全,你可能知道 [Yubico][1]。他们制作的硬件认证安全密钥可以取代[双因素认证][2],并摆脱在线账户的密码认证系统。 + +基本上,你只需将安全密钥插在电脑上,或者使用智能手机上的 NFC 来解锁访问账户。这样一来,你的认证方式就会完全保持离线状态。 + +![](https://img.linux.net.cn/data/attachment/album/202009/18/174323ior6v6xp1y1or1ov.jpg) + +当然,你可以随时使用 [Linux 中好用的密码管理器][4]。但如果你拥有一家公司,或为公司工作,或者只是对自己的隐私和安全格外谨慎,想增加一层额外的安全保护,这些硬件安全密钥可能值得一试。这些设备最近得到的进一步普及。 + +Yubico 的最新产品 [YubiKey 5C NFC][5] 可能令人印象深刻,因为它既可以作为 Type-C 的 USB 密钥使用,也可以作为 NFC 使用(只要用密钥碰触你的设备)。 + +下面,让我们来看看这款安全密钥的概况。 + +(LCTT 译注:请注意本文中的购买连接是原文作者的受益链接,如果你对此担心,请阅读其[受益政策][6]。) + +### Yubico 5C NFC:概述 + +![][7] + +YubiKey 5C NFC 是最新的产品,它同时使用 USB-C 和 NFC。因此,你可以轻松地将它插入 Windows、macOS 和 Linux 电脑。除了电脑,你还可以将其与 Android 或 iOS 智能手机或平板电脑配合使用。 + +不仅仅局限于 USB-C 和 NFC 的支持(这是件好事),它也恰好是世界上第一个支持智能卡的多协议安全密钥。 + +对于普通消费者来说,硬件安全密钥并不那么常见,因为它的成本很高。但在疫情流行的过程中,随着远程办公的兴起,一个更安全的认证系统肯定会派上用场。 + +以下是 Yubico 在其新闻稿中提到的内容: + +> Yubico 首席产品官 Guido Appenzeller 表示:“如今人们工作和上网的方式与几年前大不相同,尤其是在过去几个月内。用户不再仅仅被一种设备或服务所束缚,也不再希望受限于此。这就是为什么 YubiKey 5C NFC 是我们最受欢迎的安全密钥之一。它与大多数现代电脑和手机兼容,并可以在一系列传统和现代应用中良好运行。归根结底,我们的客户渴望的是无论如何都能“正常工作”的安全性。” + +YubiKey 5C NFC 支持的协议有 FIDO2、WebAuthn、FIDO U2F、PIV(智能卡)、OATH-HOTP 和 OATH-TOTP (基于哈希和时间的一次性密码)、[OpenPGP][8]、YubiOTP 和挑战应答认证。 + +考虑到所有这些协议,你可以轻松地保护任何支持硬件认证的在线帐户,同时还可以访问身份访问管理 (IAM) 解决方案。因此,这对个人用户和企业来说都是一个很好的选择。 + +### 定价和渠道 + +YubiKey 5C NFC 的价格为 55 美元。你可以直接从他们的[在线商店][5]订购,或者从你所在国家的任何授权经销商处购买。花费可能也会根据运输费用的不同而有所不同,但对于那些想要为他们的在线账户提供最佳安全级别的用户而言,55 美元似乎是个不错的价格。 + +值得注意的是,如果你订购两个以上的 YubiKeys,你可以获得批量折扣。 + +- [订购 YubiKey 5C NFC][5] + +### 总结 + +无论你是想保护你的云存储帐户还是其他在线帐户的安全,如果你不介意花点钱来保护你的数据安全,Yubico 的最新产品是值得一试的。 + +你是否使用过 YubiKey 或其他安全密钥,如 LibremKey 等?你对它的体验如何?你认为这些设备值得花钱吗? + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/yubikey-5c-nfc/ + +作者:[Ankush Das][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://itsfoss.com/author/ankush/ +[b]: https://github.com/lujun9972 +[1]: https://itsfoss.com/recommends/yubikey/ +[2]: https://ssd.eff.org/en/glossary/two-factor-authentication +[3]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/09/yubikey-5c-nfc-desktop.jpg?resize=800%2C671&ssl=1 +[4]: https://itsfoss.com/password-managers-linux/ +[5]: https://itsfoss.com/recommends/yubico-5c-nfc/ +[6]: https://itsfoss.com/affiliate-policy/ +[7]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/09/yubico-5c-nfc.jpg?resize=800%2C671&ssl=1 +[8]: https://www.openpgp.org/ diff --git a/published/202009/20200912 Shutdown Taking Too Long- Here-s How to Investigate and Fix Long Shutdown Time in Linux.md b/published/202009/20200912 Shutdown Taking Too Long- Here-s How to Investigate and Fix Long Shutdown Time in Linux.md new file mode 100644 index 0000000000..250d06cd7f --- /dev/null +++ b/published/202009/20200912 Shutdown Taking Too Long- Here-s How to Investigate and Fix Long Shutdown Time in Linux.md @@ -0,0 +1,135 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12635-1.html) +[#]: subject: (Shutdown Taking Too Long? Here’s How to Investigate and Fix Long Shutdown Time in Linux) +[#]: via: (https://itsfoss.com/long-shutdown-linux/) +[#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/) + +关机时间太长的调查和解决的方法 +====== + +![](https://img.linux.net.cn/data/attachment/album/202009/20/233812o1kd114jzq11lq1l.jpg) + +> 你的 Linux 系统关机时间太长么?以下是你可以采取的步骤,来找出导致延迟关机的原因并解决这个问题。 + +我希望你对 [sigterm 和 sigkill][1] 的概念有一点熟悉。 + +当你[关闭 Linux 系统][2]时,它会发送终止信号(sigterm),并礼貌地要求正在运行的进程停止。有些进程不符合该行为,它们会忽略终止信号并继续运行。 + +这可能会导致关机过程的延迟,因为你的系统会在一个预定义的时间段内等待运行的进程停止。在这个时间段之后,它会发送 `kill` 信号来强制停止所有剩余的运行进程并关闭系统。 + +事实上,在某些情况下,你会在黑屏上看到一个类似 “a stop job is running” 的信息。 + +如果你的系统关闭时间太长,你可以做以下工作: + + * 检查哪个进程/服务耗时过长,以及你是否能删除或重新配置它,使其正常运行。 + * 更改系统强制停止运行进程前的默认等待时间。(快速而不优雅的方式) + +我的操作系统是使用 systemd 的 Ubuntu。这里的命令和步骤适用于任何使用 systemd 的 Linux 发行版(大多数发行版都是这样)。 + +![][3] + +### 检查哪些进程会导致 Linux 的长时间关机 + +如果你想找出问题所在,你应该检查上次关机时发生了什么。使用这个命令来获得“我知道你上个会话做了什么”(I Know What You Did Last Summer 的双关语)的力量。 + +``` +journalctl -rb -1 +``` + +[journalctl 命令][4]能让你读取系统日志。使用选项 `-b -1` 可以过滤最后一次启动会话的日志。使用选项 `-r` 时,日志将按时间倒序显示。 + +换句话说,`journalctl -rb -1` 命令将显示最后一次关闭 Linux 系统之前的系统日志。这里就是你需要分析 Linux 系统长时间关机问题的地方。 + +#### 没有 journal 日志?下面是你应该做的。 + +如果没有 journal 日志,请确认你的发行版是否使用 systemd。 + +即使在一些使用 systemd 的 Linux 发行版上,journal 日志也没有被默认激活。 + +请确认 `/var/log/journal` 是否存在。如果不存在,请创建它: + +``` +sudo mkdir /var/log/journal +``` + +你还应该检查 `/etc/systemd/journald.conf` 文件的内容,并确保 `Storage` 的值被设置为自动(`auto`)或持久(`persistent`)。 + +你是否在日志中发现可疑的东西?是否有一个进程/服务拒绝停止?如果是,调查一下是否可以在没有副作用的情况下删除它,或者是否可以重新配置它。请不要在这里盲目地去删除东西。你应该对这个进程有所了解。 + +### 通过减少默认停止超时来加快 Linux 中的关机速度(快速修复) + +关机的默认等待时间通常设置为 90 秒。在这个时间之后,你的系统会尝试强制停止服务。 + +如果你想让你的 Linux 系统快速关闭,你可以改变这个等待时间。 + +你可以在位于 `/etc/systemd/system.conf` 的配置文件中找到所有的 systemd 设置。这个文件中应该有很多以 `#` 开头的行。它们代表了文件中各条目的默认值。 + +在开始之前,最好先复制一份原始文件。 + +``` +sudo cp /etc/systemd/system.conf /etc/systemd/system.conf.orig +``` + +在这里寻找 `DefaultTimeoutStopSec`。它可能被设置为 90 秒。 + +``` +#DefaultTimeoutStopSec=90s +``` + +你得把这个值改成更方便的,比如 5 秒或 10 秒。 + +``` +DefaultTimeoutStopSec=5s +``` + +如果你不知道如何在终端中编辑配置文件,可以使用这个命令在系统默认的文本编辑器(如 Gedit)中打开文件进行编辑: + +``` +sudo xdg-open /etc/systemd/system.conf +``` + +![Change Shutdown Time Settings Ubuntu][5] + +不要忘记**删除 DefaultTimeoutStopSec 前的 `#` 号**。保存文件并重启系统。 + +这将帮助你减少 Linux 系统的关机延迟。 + +#### 看门狗问题! + +Linux 有一个名为看门狗的模块,用于监控某些服务是否在运行。它可以被配置为在系统因软件错误而挂起时自动重启系统。 + +在桌面系统上使用看门狗是不常见的,因为你可以手动关闭或重启系统。它经常被用于远程服务器上。 + +首先检查看门狗是否在运行: + +``` +ps -af | grep watch* +``` + +如果你的系统正在运行看门狗,你可以在 systemd 配置文件 `/etc/systemd/system.conf` 中将 `ShutdownWatchdogSec` 的值从 10 分钟改为更低的值。 + +### 你能解决关机时间过长的问题吗? + +希望本教程能帮助你解决系统长时间关机的问题。如果你成功解决了这个问题,请在评论中告诉我。 + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/long-shutdown-linux/ + +作者:[Abhishek Prakash][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://itsfoss.com/author/abhishek/ +[b]: https://github.com/lujun9972 +[1]: https://linuxhandbook.com/sigterm-vs-sigkill/ +[2]: https://itsfoss.com/schedule-shutdown-ubuntu/ +[3]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/09/troubleshoot-long-shutdown-linux.gif?resize=800%2C450&ssl=1 +[4]: https://linuxhandbook.com/journalctl-command/ +[5]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/09/change-shutdown-time-settings-ubuntu.png?resize=797%2C322&ssl=1 diff --git a/published/202009/20200914 How Nextcloud simplified the signup process for decentralization.md b/published/202009/20200914 How Nextcloud simplified the signup process for decentralization.md new file mode 100644 index 0000000000..f3475a562f --- /dev/null +++ b/published/202009/20200914 How Nextcloud simplified the signup process for decentralization.md @@ -0,0 +1,120 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12656-1.html) +[#]: subject: (How Nextcloud simplified the signup process for decentralization) +[#]: via: (https://opensource.com/article/20/9/decentralization-signup) +[#]: author: (Jan C. Borchardt https://opensource.com/users/jancborchardt) + +Nextcloud 如何简化去中心化的注册流程? +====== + +> Nextcloud 是开源软件,我们不提供托管服务,但我们却能从根本上简化注册体验。 + +![](https://img.linux.net.cn/data/attachment/album/202009/27/100351eqd88qub0b3ww0tu.jpg) + +我们一直有个列表,上面有几十个 Nextcloud 提供商,然而我听到的最常见的问题,即使是我的技术方面的朋友,也是: + +> ”嗨,Jan,你推荐哪个 Nextcloud 提供商?” + +当然,这也是可以理解的。如果你有一长串的供应商,你怎么选择?托管商在附近?名字可爱?标志最大? + +每一个使用服务器的去中心化开源解决方案都在努力解决这些: + + * Mastodon 有 [joinmastodon.org][2] 来选择社区,但很明显主实例是 mastodon.social。 + * Diaspora 有[joindiaspora.com][3],它也是主实例。 + * Matrix 有 [matrix.to][4],还有一个在 [Element.io][5] 的应用(多平台)。 + * WordPress 有 [wordpress.com][6]。我不确定是否有提供商能接近它的知名度。 + * PeerTube 有一堆实例,都有不同的技术细节。 + * Pixelfed 在[beta.joinpixelfed.org][7] 有一个早期版本的实例选择器,以及在 [pixelfed.social][8] 有一个大型实例。 + * 还有更多的去中心化开源应用的例子,这里列出了如何通过终端访问它、设置 Rust 实现、或使其在网络打印机上运行。 + +这就导致了一些问题: + + * 🔮 人们不知道该选哪个,有错失恐惧症Fear Of Missing Out(FOMO),然后根本不选。这就是选择的悖论! + * 🕸 网络并不是真正的去中心化,因为大多数人都在少数服务器上,或者主要是只有一台服务器。 + +Nextcloud 不存在这些问题。 + +### 我们的解决方案:简单注册 + +这是它是如何工作的: + +当你下载我们的手机或桌面应用时,你首先看到的是“登录”或“使用供应商注册”的选择。这是任何专有应用都会做的事情: + +![Android client][9] + +选择“注册”可打开应用中的[简易注册页面][10]。 + +![Web client][11] + +你输入你的电子邮件地址,然后点击“注册”。 + +输入密码,就可以了! 🎉 + +> ”等一下,这怎么这么简单?“ + +我知道,对吧?✨ + +事实上,它甚至比很多集中式的应用更简单,在那里你需要输入你的全名和电话号码,然后点击谷歌的验证码。 + +这基本上可以归结为: + +### 我们为你选择 + +而不是面对一个无法判断什么适合你供应商的名单,我们只向你展示一个选择。就好像我是你的朋友一样,我回答了那个关于我推荐哪家供应商的问题。 + +很好!😊 + +澄清一下:你可以修改供应商,但默认的应该很适合你。目前,它只是地理位置上离你最近的提供商。 + +除此之外,我们对通过简单注册列出的提供商有一些要求,以确保无论你选择哪一个提供商都能获得良好的用户体验: + + * 🎁 2 GB 的免费存储空间,而且不仅仅是试用期。 + * 🍱 一套核心应用。文件、日历、联系人、邮件、通话、任务、笔记。有些供应商甚至提供更多。 + * 🛡 最新版本,让你始终保持最新的功能、修复和安全更新。 + +除此之外,我们还提出了一个尊重隐私的流程。当你点击“注册”时,你的邮件不会发送给我们,而是直接发送给你选择的供应商,这将无缝过渡到他们的设置步骤,在那里你选择一个密码。这意味着在 Nextcloud 不会有任何数据泄露给我们,我们甚至不知道你选择的是哪家提供商! + +因此,虽然我们提供这项服务,而且它超级容易使用,但我们只做绝对最低限度的数据处理,以连接你与你的理想供应商。 + +### 去中心化项目需要简单的注册方式 + +很多开源软件项目可以从简单注册这样的体验中受益。我们[在最初发布的时候写过有关它的文章][12],我们希望这篇文章能澄清使它成功的设计决策,以便它能被更多项目采用。 + +去中心化是赋能,但只有当人们即使不知道服务器是什么也能简单注册时,才是真正的革命。 + +当然,现在也还不完美。比如,如果你已经在 Nextcloud 实例上有了账户,任何一个应用的登录过程都会要求你输入一个服务器地址,而很多人根本不知道那是什么。比如在很多邮件应用中,在这一步会有一个最受欢迎的供应商列表,底部有一个“自定义服务器”的条目。这也可能是一种可能性,但同样带来了系统过于集中的风险,或者让人们对选择什么感到困惑。 + +所以,我们不断尝试为所有 Nextcloud 桌面和移动应用改进这一点,比如 Nextcloud Talk 或者所有优秀的社区开发的应用。在 Android 上,我们与 DAVx5(Android 上的日历和联系人同步)紧密集成,而且,对于其他 Android 应用,还有一个[单点登录库][13]。不幸的是,在 iOS 上,就没有那么容易了,因为应用必须来自同一个开发者才能共享凭证。 + +如果你想合作解决类似这些有趣的挑战,[来加入我们的 Nextcloud 设计团队吧][14]! + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/9/decentralization-signup + +作者:[Jan C. Borchardt][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/jancborchardt +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/rh_003601_05_mech_osyearbook2016_cloud_cc.png?itok=XSV7yR9e (clouds in the sky with blue pattern) +[2]: https://joinmastodon.org/ +[3]: https://joindiaspora.com +[4]: https://matrix.to +[5]: http://Element.io +[6]: https://wordpress.com +[7]: http://beta.joinpixelfed.org +[8]: http://pixelfed.social +[9]: https://opensource.com/sites/default/files/nextcloud-android-small.png (Android client) +[10]: https://nextcloud.com/signup +[11]: https://opensource.com/sites/default/files/nextcloud-web-small.png (Web client) +[12]: https://nextcloud.com/blog/introducing-simple-signup-you-can-now-get-started-with-nextcloud-in-2-steps/ +[13]: https://github.com/nextcloud/Android-SingleSignOn +[14]: https://nextcloud.com/design diff --git a/published/202009/20200914 Incremental backups with Btrfs snapshots.md b/published/202009/20200914 Incremental backups with Btrfs snapshots.md new file mode 100644 index 0000000000..2feb57cf58 --- /dev/null +++ b/published/202009/20200914 Incremental backups with Btrfs snapshots.md @@ -0,0 +1,102 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12653-1.html) +[#]: subject: (Incremental backups with Btrfs snapshots) +[#]: via: (https://fedoramagazine.org/btrfs-snapshots-backup-incremental/) +[#]: author: (Alessio https://fedoramagazine.org/author/alciregi/) + +使用 Btrfs 快照进行增量备份 +====== + +![](https://img.linux.net.cn/data/attachment/album/202009/26/112524cppfppjpvplyjzyx.jpg) + +快照snapshot是 Btrfs 的一个有趣的功能。快照是一个子卷的副本。生成快照是立即的。然而,生成快照与执行 `rsync` 或 `cp` 不同,快照并不是一创建就会占用空间。 + +> 编者注:来自 [BTRFS Wiki][2]:快照简单的来说就是一个子卷,它使用 Btrfs 的 COW 功能与其他子卷共享其数据(和元数据)。 + +占用的空间将随着原始子卷或快照本身(如果它是可写的)的数据变化而增加。子卷中已添加/修改的文件和已删除的文件仍然存在于快照中。这是一种方便的备份方式。 + +### 使用快照进行备份 + +快照驻留在子卷所在的同一磁盘上。你可以像浏览普通目录一样浏览它,并按照生成快照时的状态恢复文件的副本。顺便说一下,在快照子卷的同一磁盘上生成快照并不是一个理想的备份策略:如果硬盘坏了,快照也会丢失。快照的一个有趣的功能是可以将快照发送到另一个位置。快照可以被发送到外部硬盘或通过 SSH 发送到远程系统(目标文件系统也需要格式化为 Btrfs)。要实现这个,需要使用命令 `btrfs send` 和 `btrfs receive`。 + +### 生成快照 + +要使用 `btrfs send` 和 `btrfs receive` 命令,重要的是要将快照创建为只读,而快照默认是可写的。 + +下面的命令将对 `/home` 子卷进行快照。请注意 `-r` 标志代表只读。 + +``` +sudo btrfs subvolume snapshot -r /home /.snapshots/home-day1 +``` + +快照的名称可以是当前日期,而不是 `day1`,比如 `home-$(date +%Y%m%d)`。快照看起来像普通的子目录。你可以把它们放在任何你喜欢的地方。目录 `/.snapshots` 可能是一个不错的选择,以保持它们的整洁和避免混淆。 + +> 编者注:快照不会对自己进行递归快照。如果你创建了一个子卷的快照,子卷所包含的每一个子卷或快照都会被映射到快照里面的一个同名的空目录。 + +### 使用 btrfs send 进行备份 + +在本例中,U 盘中的目标 Btrfs 卷被挂载为 `/run/media/user/mydisk/bk`。发送快照到目标卷的命令是: + +``` +sudo btrfs send /.snapshots/home-day1 | sudo btrfs receive /run/media/user/mydisk/bk +``` + +这被称为初始启动,它相当于一个完整的备份。这个任务需要一些时间,取决于 `/home` 目录的大小。显然,后续的增量发送只需要更短的时间。 + +### 增量备份 + +快照的另一个有用的功能是能够以增量的方式执行发送任务。让我们再来生成一个快照。 + +``` +sudo btrfs subvolume snapshot -r /home /.snapshots/home-day2 +``` + +为了执行增量发送任务,需要指定上一个快照作为基础,并且这个快照必须存在于源文件和目标文件中。请注意 `-p` 选项。 + +``` +sudo btrfs send -p /.snapshot/home-day1 /.snapshot/home-day2 | sudo btrfs receive /run/media/user/mydisk/bk +``` + +再来一次(一天之后): + +``` +sudo btrfs subvolume snapshot -r /home /.snapshots/home-day3 + +sudo btrfs send -p /.snapshot/home-day2 /.snapshot/home-day3 | sudo btrfs receive /run/media/user/mydisk/bk +``` + +### 清理 + +操作完成后,你可以保留快照。但如果你每天都执行这些操作,你可能最终会有很多快照。这可能会导致混乱,并可能会在你的磁盘上使用大量的空间。因此,如果你认为你不再需要一些快照,删除它们是一个很好的建议。 + +请记住,为了执行增量发送,你至少需要最后一个快照。这个快照必须存在于源文件和目标文件中。 + +``` +sudo btrfs subvolume delete /.snapshot/home-day1 +sudo btrfs subvolume delete /.snapshot/home-day2 +sudo btrfs subvolume delete /run/media/user/mydisk/bk/home-day1 +sudo btrfs subvolume delete /run/media/user/mydisk/bk/home-day2 +``` + +注意:第 3 天的快照被保存在源文件和目标文件中。这样,明天(第 4 天),你就可以执行新的增量 `btrfs send`。 + +最后的建议是,如果 U 盘的空间很大,可以考虑在目标盘中保留多个快照,而在源盘中只保留最后一个快照。 + +-------------------------------------------------------------------------------- + +via: https://fedoramagazine.org/btrfs-snapshots-backup-incremental/ + +作者:[Alessio][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://fedoramagazine.org/author/alciregi/ +[b]: https://github.com/lujun9972 +[1]: https://fedoramagazine.org/wp-content/uploads/2020/08/butterfs-816x346.png +[2]: https://btrfs.wiki.kernel.org/index.php/SysadminGuide#Snapshots diff --git a/published/202009/20200914 Linux Jargon Buster- What is a Long Term Support (LTS) Release- What is Ubuntu LTS.md b/published/202009/20200914 Linux Jargon Buster- What is a Long Term Support (LTS) Release- What is Ubuntu LTS.md new file mode 100644 index 0000000000..12a89fe142 --- /dev/null +++ b/published/202009/20200914 Linux Jargon Buster- What is a Long Term Support (LTS) Release- What is Ubuntu LTS.md @@ -0,0 +1,100 @@ +[#]: collector: (lujun9972) +[#]: translator: (wxy) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12618-1.html) +[#]: subject: (Linux Jargon Buster: What is a Long Term Support \(LTS\) Release? What is Ubuntu LTS?) +[#]: via: (https://itsfoss.com/long-term-support-lts/) +[#]: author: (Ankush Das https://itsfoss.com/author/ankush/) + +Linux 黑话解释:什么是长期支持(LTS)版本?什么是 Ubuntu LTS? +====== + +在 Linux 的世界里,特别是谈到 [Ubuntu][1] 的时候,你会遇到 LTS(长期支持Long Term Support)这个词。 + +如果你是一个经验丰富的 Linux 用户,你可能知道 Linux 发行版的各个方面,比如 LTS 版本。但是,新用户或不太懂技术的用户可能不知道。 + +在这一章 Linux 黑话解释中,你将了解什么是 Linux 发行版的 LTS 版本。 + +### 什么是长期支持(LTS)版本? + +长期支持(LTS)版本通常与应用程序或操作系统有关,你会在较长的时间内获得安全、维护和(有时有)功能的更新。 + +LTS 版本被认为是最稳定的版本,它经历了广泛的测试,并且大多包含了多年积累的改进。 + +需要注意的是,LTS 版本的软件不一定涉及功能更新,除非有一个更新的 LTS 版本。但是,你会在 LTS 版本的更新中得到必要的错误修复和安全修复。 + +LTS 版本被推荐给生产级的消费者、企业和商家,因为你可以获得多年的软件支持,而且软件更新不会破坏系统。 + +如果你注意到任何软件的非 LTS 版本,它通常是具有新功能和较短支持时间跨度(例如 6-9 个月)的前沿版本,而 LTS 版本的支持时间为 3-5 年。 + +![][2] + +为了让大家更清楚的了解 LTS 和非 LTS 版本的区别,我们来看看选择 LTS 版本的一些优缺点。 + +#### LTS 版本的优点 + + * 软件更新与安全和维护修复的时间很长(Ubuntu 有 5 年支持) + * 广泛的测试 + * 软件更新不会带来破坏系统的变化 + * 你有足够的时间为下一个 LTS 版本准备系统 + +#### LTS 版本的缺点 + + * 不提供最新和最强的功能 + * 你可能会错过最新的硬件支持 + * 你也可能会错过最新的应用程序升级 + +现在,你知道了什么是 LTS 版本及其优缺点,是时候了解一下 Ubuntu 的 LTS 版本了。Ubuntu 是最流行的 Linux 发行版之一,也是少数同时拥有 LTS 和非 LTS 版本的发行版之一。 + +这就是为什么我决定用一整个章节来介绍它。 + +### 什么是 Ubuntu LTS? + +自 2006 年以来,Ubuntu 每六个月发布一个非 LTS 版本,每两年发布一个 LTS 版本,这一点一直如此。 + +最新的 LTS 版本是 [Ubuntu 20.04][3],它将被支持到 2025 年 4 月。换句话说,Ubuntu 20.04 在那之前都会收到软件更新。非 LTS 版本只支持九个月。 + +你会发现 Ubuntu LTS 版本总是被标为 “LTS”。至少,在 [Ubuntu 官方网站][4]上浏览最新的 Ubuntu 版本时是这样的。 + +为了让你更清楚,如果你见过 Ubuntu 16.04 LTS,那就意味着:**它早在 2016 年 4 月就已经发布,并且支持到 2021 年**(想想**5 年的软件更新**)。 + +同样,你也可以通过计算每个 Ubuntu LTS 版本发布日期接下来的**5 年**软件支持期来估计其更新支持情况。 + +### Ubuntu LTS 软件更新包括什么? + +![][5] + +Ubuntu LTS 版本在其发布的生命周期内都会收到安全和维护更新。除非该版本达到[生命末期(EOL)][6],否则你将获得所有必要的安全和错误修复。 + +在 LTS 版本中你不会注意到任何功能升级。所以,如果你想尝试最新的实验性技术,你可能需要将你的 Ubuntu 版本升级到一个非 LTS 版本。 + +我建议你参考我们最新的 [Ubuntu 升级指南][7]来了解更多关于升级 Ubuntu 的信息。 + +我也建议你阅读我们的文章[安装哪个 Ubuntu 版本][8],以消除你对不同 Ubuntu 版本的困惑,比如 [Xubuntu][9] 或 [Kubuntu][10],它们有什么不同。 + +我希望你现在对 LTS 这个术语有了更好的理解,尤其是在 Ubuntu LTS 方面。敬请关注未来更多的 Linux 黑话解释。 + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/long-term-support-lts/ + +作者:[Ankush Das][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://itsfoss.com/author/ankush/ +[b]: https://github.com/lujun9972 +[1]: https://ubuntu.com/ +[2]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/09/display-server-linux.png?resize=800%2C450&ssl=1 +[3]: https://itsfoss.com/download-ubuntu-20-04/ +[4]: https://ubuntu.com +[5]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/09/ubuntu-lts-release.png?resize=800%2C397&ssl=1 +[6]: https://itsfoss.com/end-of-life-ubuntu/ +[7]: https://itsfoss.com/upgrade-ubuntu-version/ +[8]: https://itsfoss.com/which-ubuntu-install/ +[9]: https://xubuntu.org/ +[10]: https://kubuntu.org/ diff --git a/published/202009/20200915 KeePassXC is An Amazing Community Driven Open Source Password Manager -Not Cloud Based.md b/published/202009/20200915 KeePassXC is An Amazing Community Driven Open Source Password Manager -Not Cloud Based.md new file mode 100644 index 0000000000..94d5aa5334 --- /dev/null +++ b/published/202009/20200915 KeePassXC is An Amazing Community Driven Open Source Password Manager -Not Cloud Based.md @@ -0,0 +1,107 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12642-1.html) +[#]: subject: (KeePassXC is An Amazing Community Driven Open Source Password Manager [Not Cloud Based]) +[#]: via: (https://itsfoss.com/keepassxc/) +[#]: author: (Ankush Das https://itsfoss.com/author/ankush/) + +KeePassXC:社区驱动的开源密码管理器(不基于云服务) +====== + +![](https://img.linux.net.cn/data/attachment/album/202009/23/054245jxx9pyzk8p3kbxhw.jpg) + +> KeePassXC 是一款有用的开源跨平台密码管理器,即使它不是云端工具,在功能上也毫不逊色。下面,我们就来快速了解一下它。 + +### KeePassXC:一个跨平台的开源密码管理器 + +![][1] + +KeePassXC 是 [KeePassX][2] 的社区复刻版本,旨在成为 [KeePass Password Safe][3](适用于 Windows)的跨平台移植。它是完全免费使用和跨平台的(Windows、Linux 和 macOS)。 + +事实上,它是目前 [Linux 最佳密码管理器][4]之一。它的功能选项既适合新手,也适合那些想要进一步控制以保护系统上的密码数据库的高级用户。 + +是的,与我[最喜欢的 Bitwarden 密码管理器][5]不同,KeePassXC 不是基于云端的,密码永远不会离开系统。有些用户确实喜欢不把密码和秘密保存在云服务器中。 + +当你开始使用密码管理器时,你应该能在它上找到你所需要的所有基本功能。但是,在这里,为了让你初步了解,我会强调提到一些它提供的功能。 + +### KeePassXC 的功能 + +![][6] + +值得注意的是,对于一个新手来说,这些功能可能会让人有点不知所措。但是,考虑到你想充分使用它,我想你应该真正了解它所提供的功能: + +* 密码生成器 +* 能够从 1Password、KeePass 1 和任何 CSV 文件导入密码。 +* 通过导出和同步 SSL 证书支持,轻松共享数据库。 +* 支持数据库加密 (256 位 AES) +* 浏览器集成(可选) +* 能够搜索你的凭证 +* 在应用中自动输入密码 +* 数据库报告,以检查密码的健康状况和其他统计数字 +* 支持导出为 CSV 和 HTML +* 支持双因素认证令牌 +* 支持将文件附加到密码中 +* 支持 YubiKey +* 支持命令行 +* 支持集成 SSH 代理 +* 必要时改变加密算法 +* 能够使用 DuckDuckGO 下载网站图标 +* 数据库超时自动锁定 +* 清除剪贴板和搜索查询的能力 +* 自动保存文件 +* 支持文件夹/嵌套文件夹 +* 设置密码的有效期 +* 提供黑暗主题 +* 跨平台支持 + +正如你所看到的,它的确是一款功能丰富的密码管理器。所以,我建议你如果想使用提供的每一个功能,就好好探索它。 + +![][7] + +### 在 Linux 上安装 KeePassXC + +你应该能在你安装的发行版的软件中心找到它。 + +你也可以从官方网站上获得 AppImage 文件。如果你还不知道的话,我建议你去看看我们的[在 Linux 中使用 AppImage 文件][8]的指南。 + +另外,你还会发现有一个 snap 包可以用。除此之外,你还可以得到 Ubuntu PPA、Debian 包、Fedora 包和 Arch 包。 + +如果你好奇,你可以直接探索[官方下载页面][9]的可用包,并查看他们的 [GitHub 页面][10]的源代码。 + +- [下载 KeePassXC][11] + +### 总结 + +如果你不是 [Bitwarden][5] 等云端开源密码管理器的粉丝,KeePassXC 应该是你的绝佳选择。 + +在这里你得到的功能数量可以让你可以在多个平台上保证密码的安全和易于维护。即使没有开发团队的“官方”移动应用,你也可以尝试他们的一些[推荐应用][12],它们与其数据库兼容,并提供相同的功能。 + +你尝试过 KeePassXC 吗?你更喜欢使用什么作为你的密码管理器?请在下面的评论中告诉我你的想法。 + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/keepassxc/ + +作者:[Ankush Das][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://itsfoss.com/author/ankush/ +[b]: https://github.com/lujun9972 +[1]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/09/keepassxc-screenshot.jpg?resize=800%2C580&ssl=1 +[2]: https://www.keepassx.org/ +[3]: https://keepass.info +[4]: https://itsfoss.com/password-managers-linux/ +[5]: https://itsfoss.com/bitwarden/ +[6]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/09/keepassxc-screenshot-1.jpg?resize=800%2C579&ssl=1 +[7]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/09/keepassxc-settings.png?resize=800%2C587&ssl=1 +[8]: https://itsfoss.com/use-appimage-linux/ +[9]: https://keepassxc.org/download/ +[10]: https://github.com/keepassxreboot/keepassxc +[11]: https://keepassxc.org +[12]: https://keepassxc.org/docs/#faq-platform-mobile \ No newline at end of file diff --git a/published/202009/20200916 Huawei ban could complicate 5G deployment.md b/published/202009/20200916 Huawei ban could complicate 5G deployment.md new file mode 100644 index 0000000000..64da10ca4b --- /dev/null +++ b/published/202009/20200916 Huawei ban could complicate 5G deployment.md @@ -0,0 +1,69 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12659-1.html) +[#]: subject: (Huawei ban could complicate 5G deployment) +[#]: via: (https://www.networkworld.com/article/3575408/huawei-ban-could-complicate-5g-deployment.html) +[#]: author: (Jon Gold https://www.networkworld.com/author/Jon-Gold/) + +对华为的禁令可能使 5G 部署复杂化 +====== + +> 对华为、中兴的禁令意味着无线运营商建设 5G 服务的选择减少了。 + +![](https://images.idgesg.net/images/article/2019/02/5g_wireless_technology_network_connections_by_credit-vertigo3d_gettyimages-1043302218_3x2-100787550-large.jpg) + +随着运营商竞相建设他们的 5G 网络,由于美国联邦政府的压力,在美国购买所需设备的选择比其他国家少,这可能会减缓部署。 + +在 2018 年的《国防授权法案》中,总部位于中国的华为和中兴通讯都被禁止向美国政府提供设备,此后不久又全面禁止进口。这极大地改变了竞争格局,并引发了美国 5G 的形态可能因此而改变的问题。 + +Gartner 的分析师 Michael Porowski 表示,虽然还不完全清楚,但运营商可以在哪里购买 5G 设备的限制有可能会减缓部署速度。 + +他说:”供应商数量仍然很多:爱立信、诺基亚、三星。中兴和华为都是更经济的选择。如果它们可用,你可能会看到更快的采用速度。” + +451 Research 的研究总监 Christian Renaud 表示,业界普遍认为,华为设备既成熟又价格低廉,而在没有华为的情况下,运营商也没有明确的替代方案。 + +他说:“目前,会有采用诺基亚或爱立信标准的运营商。(而且)现在判断谁最成熟还为时过早,因为部署是如此有限。” + +这种争论在运营商本身的覆盖地图上可以得到证实。虽然他们很快就大肆宣传 5G 服务在美国的许多市场上已经有了,但实际的地理覆盖范围大多局限于大城市核心区的公共场所。简而言之,大部分地区的 5G 部署还没有到来。 + +部署缓慢是有充分理由的。5G 接入点的部署密度要远高于上一代的无线技术,这使得该过程更加复杂且耗时。还有一个问题是,目前可用的 5G 用户设备数量还很少。 + +Renaud 说:“这就好比说,在有人发明汽车之前,说‘我已经有了这条八车道的高速公路’。” + +设备供应商目前的部分目标是通过私有部署来展示 5G 的潜力,这些部署将该技术用做信号隧道backhaul,用于支持[物联网][8]和其他针对单个企业的链接场景。 + +Renaud 说:“(设备供应商)都在大力推动私有部署这一块,然后他们可以利用这一点说:你看,我可以用在布鲁克林造船厂或某个私有部署的 5G 网络中,所以,如果可以的话……,它可以用于支持人们观看 YouTube。” + +对中国的禁令的一个不幸结果可能是供应商为满足 5G 要求而遵循的规范的分裂。Renaud 称,如果非中国供应商必须为允许华为和中兴的市场制作一个版本,而为不允许华为和中兴的地方制作不同的版本,这可能会给他们带来新的麻烦。 + +他说:“这将把成本负担转移到设备制造商身上,来试图支持不同的运营商实施。我们会造成非技术性的壁垒。”而这些,反过来又会导致客户体验受到影响。 + +但是,5G 已经通过[开放无线接入网技术][9]拥抱了更高的互操作性的趋势,它将 5G 栈各层之间的软件接口标准化。运营商和设备商都接受了这一推动,使得互操作性更有可能,这可能会在未来吸引更多的参与者。 + +当然,即便是普遍的互操作性,设备制造商仍然会试图建立客户依赖性。他说“在试图锁定客户的供应商和试图保持供应商中立的客户之间,总是会有一场拉锯战。这不会有很大的改变。(但是)我们显然已经看到了试图更加开放的动向。” + +-------------------------------------------------------------------------------- + +via: https://www.networkworld.com/article/3575408/huawei-ban-could-complicate-5g-deployment.html + +作者:[Jon Gold][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://www.networkworld.com/author/Jon-Gold/ +[b]: https://github.com/lujun9972 +[1]: https://www.networkworld.com/article/3203489/what-is-5g-fast-wireless-technology-for-enterprises-and-phones.html +[2]: https://www.networkworld.com/article/3568253/how-5g-frequency-affects-range-and-speed.html +[3]: https://www.networkworld.com/article/3568614/private-5g-can-solve-some-enterprise-problems-that-wi-fi-can-t.html +[4]: https://www.networkworld.com/article/3488799/private-5g-keeps-whirlpool-driverless-vehicles-rolling.html +[5]: https://www.networkworld.com/article/3570724/5g-can-make-for-cost-effective-private-backhaul.html +[6]: https://www.networkworld.com/article/3529291/cbrs-wireless-can-bring-private-5g-to-enterprises.html +[8]: https://www.networkworld.com/article/3207535/what-is-iot-the-internet-of-things-explained.html +[9]: https://www.networkworld.com/article/3574977/carriers-vendors-work-to-promote-5g-network-flexibility-with-open-standards.html +[10]: https://www.facebook.com/NetworkWorld/ +[11]: https://www.linkedin.com/company/network-world diff --git a/published/202009/20200916 Teach Python with Jupyter Notebooks.md b/published/202009/20200916 Teach Python with Jupyter Notebooks.md new file mode 100644 index 0000000000..423ef5b0a1 --- /dev/null +++ b/published/202009/20200916 Teach Python with Jupyter Notebooks.md @@ -0,0 +1,322 @@ +[#]: collector: (lujun9972) +[#]: translator: (wxy) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12646-1.html) +[#]: subject: (Teach Python with Jupyter Notebooks) +[#]: via: (https://opensource.com/article/20/9/teach-python-jupyter) +[#]: author: (Moshe Zadka https://opensource.com/users/moshez) + +用 Jupyter Notebook 教 Python +====== + +> 有了 Jupyter、PyHamcrest,用一点测试的代码把它们连在一起,你就可以教任何适用于单元测试的 Python 内容。 + +![](https://img.linux.net.cn/data/attachment/album/202009/24/045721mubdfdx1tb11fibi.jpg) + +关于 Ruby 社区的一些事情一直让我印象深刻,其中两个例子是对测试的承诺和对易于上手的强调。这两方面最好的例子是 [Ruby Koans][2],在这里你可以通过修复测试来学习 Ruby。 + +要是我们能把这些神奇的工具也用于 Python,我们应该可以做得更好。是的,使用 [Jupyter Notebook][3]、[PyHamcrest][4],再加上一点类似于胶带的粘合代码,我们可以做出一个包括教学、可工作的代码和需要修复的代码的教程。 + +首先,需要一些“胶布”。通常,你会使用一些漂亮的命令行测试器来做测试,比如 [pytest][5] 或 [virtue][6]。通常,你甚至不会直接运行它。你使用像 [tox][7] 或 [nox][8] 这样的工具来运行它。然而,对于 Jupyter 来说,你需要写一小段粘合代码,可以直接在其中运行测试。 + +幸运的是,这个代码又短又简单: + +``` +import unittest + +def run_test(klass): +    suite = unittest.TestLoader().loadTestsFromTestCase(klass) +    unittest.TextTestRunner(verbosity=2).run(suite) +    return klass +``` + +现在,装备已经就绪,可以进行第一次练习了。 + +在教学中,从一个简单的练习开始,建立信心总是一个好主意。 + +那么,让我们来修复一个非常简单的测试: + +``` +@run_test +class TestNumbers(unittest.TestCase): + + def test_equality(self): + expected_value = 3 # 只改这一行 + self.assertEqual(1+1, expected_value) +``` + +``` + test_equality (__main__.TestNumbers) ... FAIL + + ====================================================================== + FAIL: test_equality (__main__.TestNumbers) + ---------------------------------------------------------------------- + Traceback (most recent call last): + File "", line 6, in test_equality + self.assertEqual(1+1, expected_value) + AssertionError: 2 != 3 + + ---------------------------------------------------------------------- + Ran 1 test in 0.002s + + FAILED (failures=1) +``` + +“只改这一行” 对学生来说是一个有用的标记。它准确地表明了需要修改的内容。否则,学生可以通过将第一行改为 `return` 来修复测试。 + +在这种情况下,修复很容易: + +``` +@run_test +class TestNumbers(unittest.TestCase): + + def test_equality(self): + expected_value = 2 # 修复后的代码行 + self.assertEqual(1+1, expected_value) +``` + +``` + test_equality (__main__.TestNumbers) ... ok + + ---------------------------------------------------------------------- + Ran 1 test in 0.002s + + OK +``` + +然而,很快,`unittest` 库的原生断言将被证明是不够的。在 `pytest` 中,通过重写 `assert` 中的字节码来解决这个问题,使其具有神奇的属性和各种启发式方法。但这在 Jupyter notebook 中就不容易实现了。是时候挖出一个好的断言库了:PyHamcrest。 + +``` +from hamcrest import * +@run_test +class TestList(unittest.TestCase): + + def test_equality(self): + things = [1, + 5, # 只改这一行 + 3] + assert_that(things, has_items(1, 2, 3)) +``` + +``` + test_equality (__main__.TestList) ... FAIL + + ====================================================================== + FAIL: test_equality (__main__.TestList) + ---------------------------------------------------------------------- + Traceback (most recent call last): + File "", line 8, in test_equality + assert_that(things, has_items(1, 2, 3)) + AssertionError: + Expected: (a sequence containing <1> and a sequence containing <2> and a sequence containing <3>) + but: a sequence containing <2> was <[1, 5, 3]> + + + ---------------------------------------------------------------------- + Ran 1 test in 0.004s + + FAILED (failures=1) +``` + +PyHamcrest 不仅擅长灵活的断言,它还擅长清晰的错误信息。正因为如此,问题就显而易见了。`[1, 5, 3]` 不包含 `2`,而且看起来很丑: + +``` +@run_test +class TestList(unittest.TestCase): + + def test_equality(self): + things = [1, + 2, # 改完的行 + 3] + assert_that(things, has_items(1, 2, 3)) +``` + +``` + test_equality (__main__.TestList) ... ok + + ---------------------------------------------------------------------- + Ran 1 test in 0.001s + + OK +``` + +使用 Jupyter、PyHamcrest 和一点测试的粘合代码,你可以教授任何适用于单元测试的 Python 主题。 + +例如,下面可以帮助展示 Python 从字符串中去掉空白的不同方法之间的差异。 + +``` +source_string = " hello world " + +@run_test +class TestList(unittest.TestCase): + + # 这是个赠品:它可以工作! + def test_complete_strip(self): + result = source_string.strip() + assert_that(result, + all_of(starts_with("hello"), ends_with("world"))) + + def test_start_strip(self): + result = source_string # 只改这一行 + assert_that(result, + all_of(starts_with("hello"), ends_with("world "))) + + def test_end_strip(self): + result = source_string # 只改这一行 + assert_that(result, + all_of(starts_with(" hello"), ends_with("world"))) +``` + +``` + test_complete_strip (__main__.TestList) ... ok + test_end_strip (__main__.TestList) ... FAIL + test_start_strip (__main__.TestList) ... FAIL + + ====================================================================== + FAIL: test_end_strip (__main__.TestList) + ---------------------------------------------------------------------- + Traceback (most recent call last): + File "", line 19, in test_end_strip + assert_that(result, + AssertionError: + Expected: (a string starting with ' hello' and a string ending with 'world') + but: a string ending with 'world' was ' hello world ' + + + ====================================================================== + FAIL: test_start_strip (__main__.TestList) + ---------------------------------------------------------------------- + Traceback (most recent call last): + File "", line 14, in test_start_strip + assert_that(result, + AssertionError: + Expected: (a string starting with 'hello' and a string ending with 'world ') + but: a string starting with 'hello' was ' hello world ' + + + ---------------------------------------------------------------------- + Ran 3 tests in 0.006s + + FAILED (failures=2) +``` + +理想情况下,学生们会意识到 `.lstrip()` 和 `.rstrip()` 这两个方法可以满足他们的需要。但如果他们不这样做,而是试图到处使用 `.strip()` 的话: + +``` +source_string = " hello world " + +@run_test +class TestList(unittest.TestCase): + + # 这是个赠品:它可以工作! + def test_complete_strip(self): + result = source_string.strip() + assert_that(result, + all_of(starts_with("hello"), ends_with("world"))) + + def test_start_strip(self): + result = source_string.strip() # 改完的行 + assert_that(result, + all_of(starts_with("hello"), ends_with("world "))) + + def test_end_strip(self): + result = source_string.strip() # 改完的行 + assert_that(result, + all_of(starts_with(" hello"), ends_with("world"))) +``` + +``` + test_complete_strip (__main__.TestList) ... ok + test_end_strip (__main__.TestList) ... FAIL + test_start_strip (__main__.TestList) ... FAIL + + ====================================================================== + FAIL: test_end_strip (__main__.TestList) + ---------------------------------------------------------------------- + Traceback (most recent call last): + File "", line 19, in test_end_strip + assert_that(result, + AssertionError: + Expected: (a string starting with ' hello' and a string ending with 'world') + but: a string starting with ' hello' was 'hello world' + + + ====================================================================== + FAIL: test_start_strip (__main__.TestList) + ---------------------------------------------------------------------- + Traceback (most recent call last): + File "", line 14, in test_start_strip + assert_that(result, + AssertionError: + Expected: (a string starting with 'hello' and a string ending with 'world ') + but: a string ending with 'world ' was 'hello world' + + + ---------------------------------------------------------------------- + Ran 3 tests in 0.007s + + FAILED (failures=2) +``` + +他们会得到一个不同的错误信息,显示去除了过多的空白: + +``` +source_string = " hello world " + +@run_test +class TestList(unittest.TestCase): + + # 这是个赠品:它可以工作! + def test_complete_strip(self): + result = source_string.strip() + assert_that(result, + all_of(starts_with("hello"), ends_with("world"))) + + def test_start_strip(self): + result = source_string.lstrip() # Fixed this line + assert_that(result, + all_of(starts_with("hello"), ends_with("world "))) + + def test_end_strip(self): + result = source_string.rstrip() # Fixed this line + assert_that(result, + all_of(starts_with(" hello"), ends_with("world"))) +``` + +``` + test_complete_strip (__main__.TestList) ... ok + test_end_strip (__main__.TestList) ... ok + test_start_strip (__main__.TestList) ... ok + + ---------------------------------------------------------------------- + Ran 3 tests in 0.005s + + OK +``` + +在一个比较真实的教程中,会有更多的例子和更多的解释。这种使用 Jupyter Notebook 的技巧,有的例子可以用,有的例子需要修正,可以用于实时教学,可以用于视频课,甚至,可以用更多的其它零散用途,让学生自己完成一个教程。 + +现在就去分享你的知识吧! + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/9/teach-python-jupyter + +作者:[Moshe Zadka][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/moshez +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/read_book_guide_tutorial_teacher_student_apaper.png?itok=_GOufk6N (Person reading a book and digital copy) +[2]: https://github.com/edgecase/ruby_koans +[3]: https://jupyter.org/ +[4]: https://github.com/hamcrest/PyHamcrest +[5]: https://docs.pytest.org/en/stable/ +[6]: https://github.com/Julian/Virtue +[7]: https://tox.readthedocs.io/en/latest/ +[8]: https://nox.thea.codes/en/stable/ diff --git a/published/202009/20200917 What-s new with rdiff-backup.md b/published/202009/20200917 What-s new with rdiff-backup.md new file mode 100644 index 0000000000..81cdddede3 --- /dev/null +++ b/published/202009/20200917 What-s new with rdiff-backup.md @@ -0,0 +1,120 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12663-1.html) +[#]: subject: (What's new with rdiff-backup?) +[#]: via: (https://opensource.com/article/20/9/rdiff-backup-linux) +[#]: author: (Patrik Dufresne https://opensource.com/users/patrik-dufresne) + +11 年后重新打造的 rdiff-backup 2.0 有什么新功能? +====== + +> 这个老牌 Linux 备份方案迁移到了 Python 3 提供了添加许多新功能的机会。 + +![](https://img.linux.net.cn/data/attachment/album/202009/29/094858pb9pa3sppsq9x5z1.jpg) + +2020 年 3 月,[rdiff-backup][2] 升级到了 2.0 版,这距离上一个主要版本已经过去了 11 年。2020 年初 Python 2 的废弃是这次更新的动力,但它为开发团队提供了整合其他功能和优势的机会。 + +大约二十年来,`rdiff-backup` 帮助 Linux 用户在本地或远程维护他们的数据的完整备份,而无需无谓地消耗资源。这是因为这个开源解决方案可以进行反向增量备份,只备份从上一次备份中改变的文件。 + +这次改版(或者说,重生)得益于一个新的、自组织的开发团队(由来自 [IKUS Software][3] 的 Eric Zolf 和 Patrik Dufresne,以及来自 [Seravo][4] 的 Otto Kekäläinen 共同领导)的努力,为了所有 `rdiff-backup` 用户的利益,他们齐心协力。 + +### rdiff-backup 的新功能 + +在 Eric 的带领下,随着向 Python 3 的迁移,项目被迁移到了一个新的、不受企业限制的[仓库][5],以欢迎贡献。团队还整合了多年来提交的所有补丁,包括对稀疏文件的支持和对硬链接的修复。 + +#### 用 Travis CI 实现自动化 + +另一个巨大的改进是增加了一个使用开源 [Travis CI][6] 的持续集成/持续交付(CI/CD)管道。这允许在各种环境下测试 `rdiff-backup`,从而确保变化不会影响方案的稳定性。CI/CD 管道包括集成所有主要平台的构建和二进制发布。 + +#### 使用 yum 和 apt 轻松安装 + +新的 `rdiff-backup` 解决方案可以运行在所有主流的 Linux 发行版上,包括 Fedora、Red Hat、Elementary、Debian 等。Frank 和 Otto 付出了艰辛的努力,提供了开放的仓库以方便访问和安装。你可以使用你的软件包管理器安装 `rdiff-backup`,或者按照 GitHub 项目页面上的[分步说明][7]进行安装。 + +#### 新的主页 + +团队将网站从 Savannah 迁移到了 GitHub Pages,并对 [rdiff-backup.net][2] 官网进行了改版,加入了新的内容,让外观和感觉更加到位。 + +### 如何使用 rdiff-backup + +如果你是 `rdiff-backup` 的新手,你可能会对它的易用性感到惊讶。备份方案应该让你对备份和恢复过程感到舒适,而不是吓人。 + +#### 开始备份 + +要开始备份到本地驱动器,例如通过 USB 连接的驱动器,输入 `rdiff-backup` 命令,然后输入要备份的驱动器和要存储文件的目标目录。 + +例如,要备份到名为 `my_backup_drive` 的本地驱动器,请输入: + +``` +$ rdiff-backup /home/tux/ /run/media/tux/my_backup_drive/ +``` + +要将数据备份到异地存储,请使用远程服务器的位置,并在 `::` 后面指向备份驱动器的挂载点: + +``` +$ rdiff-backup /home/tux/ tux@example.com::/my_backup_drive/ +``` + +你可能需要[设置 SSH 密钥][8]来使这个过程更轻松。 + +#### 还原文件 + +做备份的原因是有时文件会丢失。为了使恢复尽可能简单,你甚至不需要 `rdiff-backup` 来恢复文件(虽然使用 `rdiff-backup` 命令提供了一些方便)。 + +如果你需要从备份驱动器中获取一个文件,你可以使用 `cp` 将其从备份驱动器复制到本地系统,或者对于远程驱动器使用 `scp` 命令。 + +对于本地驱动器,使用: + +``` +$ cp _run_media/tux/my_backup_drive/Documents/example.txt ~/Documents +``` + +或者用于远程驱动器: + +``` +$ scp tux@example.com::/my_backup_drive/Documents/example.txt ~/Documents +``` + +然而,使用 `rdiff-backup` 命令提供了其他选项,包括 `--restore-as-of`。这允许你指定你要恢复的文件的哪个版本。 + +例如,假设你想恢复一个文件在四天前的版本: + +``` +$ rdiff-backup --restore-as-of 4D /run/media/tux/foo.txt ~/foo_4D.txt +``` + +你也可以用 `rdiff-backup` 来获取最新版本: + +``` +$ rdiff-backup --restore-as-of now /run/media/tux/foo.txt ~/foo_4D.txt` +``` + +就是这么简单。另外,`rdiff-backup` 还有很多其他选项,例如,你可以从列表中排除文件,从一个远程备份到另一个远程等等,这些你可以在[文档][9]中了解。 + +### 总结 + +我们的开发团队希望用户能够喜欢这个改版后的开源 `rdiff-backup` 方案,这是我们不断努力的结晶。我们也感谢我们的贡献者,他们真正展示了开源的力量。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/9/rdiff-backup-linux + +作者:[Patrik Dufresne][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/patrik-dufresne +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/yearbook-haff-rx-linux-file-lead_0.png?itok=-i0NNfDC (Hand putting a Linux file folder into a drawer) +[2]: https://rdiff-backup.net/ +[3]: https://www.ikus-soft.com/en/ +[4]: https://seravo.fi/english +[5]: https://github.com/rdiff-backup/rdiff-backup +[6]: https://en.wikipedia.org/wiki/Travis_CI +[7]: https://github.com/rdiff-backup/rdiff-backup#installation +[8]: https://opensource.com/article/20/8/how-ssh +[9]: https://rdiff-backup.net/docs/examples.html diff --git a/published/202009/20200918 How to Fix -Repository is not valid yet- Error in Ubuntu Linux.md b/published/202009/20200918 How to Fix -Repository is not valid yet- Error in Ubuntu Linux.md new file mode 100644 index 0000000000..096e922410 --- /dev/null +++ b/published/202009/20200918 How to Fix -Repository is not valid yet- Error in Ubuntu Linux.md @@ -0,0 +1,99 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12666-1.html) +[#]: subject: (How to Fix “Repository is not valid yet” Error in Ubuntu Linux) +[#]: via: (https://itsfoss.com/fix-repository-not-valid-yet-error-ubuntu/) +[#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/) + +如何修复 Ubuntu Linux 中的 “Release file is not valid yet” 错误 +====== + +我最近[在我的树莓派上安装了 Ubuntu 服务器][1]。我[在 Ubuntu 终端连接上了 Wi-Fi][2],然后做了我在安装任何 Linux 系统后都会做的事情,那就是更新系统。 + +当我使用 `sudo apt update` 命令时,它给了一个对我而言特别的错误。它报出仓库的发布文件在某个时间段内无效。 + +> E: Release file for is not valid yet (invalid for another 159d 15h 20min 52s). Updates for this repository will not be applied.** + +下面是完整输出: + +``` +ubuntu@ubuntu:~$ sudo apt update +Hit:1 http://ports.ubuntu.com/ubuntu-ports focal InRelease +Get:2 http://ports.ubuntu.com/ubuntu-ports focal-updates InRelease [111 kB] +Get:3 http://ports.ubuntu.com/ubuntu-ports focal-backports InRelease [98.3 kB] +Get:4 http://ports.ubuntu.com/ubuntu-ports focal-security InRelease [107 kB] +Reading package lists... Done +E: Release file for http://ports.ubuntu.com/ubuntu-ports/dists/focal/InRelease is not valid yet (invalid for another 21d 23h 17min 25s). Updates for this repository will not be applied. +E: Release file for http://ports.ubuntu.com/ubuntu-ports/dists/focal-updates/InRelease is not valid yet (invalid for another 159d 15h 21min 2s). Updates for this repository will not be applied. +E: Release file for http://ports.ubuntu.com/ubuntu-ports/dists/focal-backports/InRelease is not valid yet (invalid for another 159d 15h 21min 32s). Updates for this repository will not be applied. +E: Release file for http://ports.ubuntu.com/ubuntu-ports/dists/focal-security/InRelease is not valid yet (invalid for another 159d 15h 20min 52s). Updates for this repository will not be applied. + +``` + +### 修复 Ubuntu 和其他 Linux 发行版中 “Release file is not valid yet” 的错误。 + +![][3] + +错误的原因是系统上的时间和现实世界的时间不同。 + +你看,每个仓库文件都是在某个日期签名的,你可以通过查看发布文件信息了解: + +``` +sudo head /var/lib/apt/lists/ports.ubuntu.com_ubuntu_dists_focal_InRelease +-----BEGIN PGP SIGNED MESSAGE----- +Hash: SHA512 + +Origin: Ubuntu +Label: Ubuntu +Suite: focal +Version: 20.04 +Codename: focal +Date: Thu, 23 Apr 2020 17:33:17 UTC +Architectures: amd64 arm64 armhf i386 ppc64el riscv64 s390x +``` + +现在,由于某些原因,我的 Ubuntu 服务器上的时间是过去时间,这也是为什么 Ubuntu 报出发布文件已经无效 X 天的原因。 + +如果你连接到了互联网,你可以**等待几分钟让系统同步时间**。 + +如果不行,你可以强制系统使用本地时间作为实时时钟(硬件时钟): + +``` +sudo timedatectl set-local-rtc 1 +``` + +`timedatectl` 命令可以让你在 Linux 上配置时间、日期和[更改时区][4]。 + +你应该不需要重新启动。它可以立即工作,你可以通过[更新你的 Ubuntu 系统][5]再次验证它。 + +如果问题解决了,你可以将[实时时钟][6]设置为使用 UTC(Ubuntu 推荐的)。 + +``` +sudo timedatectl set-local-rtc 0 +``` + +**是否为你解决了这个问题?** + +我希望这个提示能帮助你解决这个错误。如果你仍然遇到这个问题,请在评论栏告诉我,我会尽力帮助你。 + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/fix-repository-not-valid-yet-error-ubuntu/ + +作者:[Abhishek Prakash][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://itsfoss.com/author/abhishek/ +[b]: https://github.com/lujun9972 +[1]: https://itsfoss.com/install-ubuntu-server-raspberry-pi/ +[2]: https://itsfoss.com/connect-wifi-terminal-ubuntu/ +[3]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/09/Repository-not-valid-yet-error-ubuntu.png?resize=800%2C450&ssl=1 +[4]: https://itsfoss.com/change-timezone-ubuntu/ +[5]: https://itsfoss.com/update-ubuntu/ +[6]: https://www.computerhope.com/jargon/r/rtc.htm diff --git a/published/202009/20200921 Linux Jargon Buster- What is a Rolling Release Distribution.md b/published/202009/20200921 Linux Jargon Buster- What is a Rolling Release Distribution.md new file mode 100644 index 0000000000..572d1011fc --- /dev/null +++ b/published/202009/20200921 Linux Jargon Buster- What is a Rolling Release Distribution.md @@ -0,0 +1,108 @@ +[#]: collector: (lujun9972) +[#]: translator: (wxy) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12639-1.html) +[#]: subject: (Linux Jargon Buster: What is a Rolling Release Distribution?) +[#]: via: (https://itsfoss.com/rolling-release/) +[#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/) + +Linux 黑话解释:什么是滚动发行版? +====== + +在了解了[什么是 Linux][1]、[什么是 Linux 发行版][2]之后,当你开始使用 Linux 时,你可能会在 Linux 论坛的讨论中遇到“滚动发布rolling release”这个名词。 + +在这篇 Linux 黑话解释文章中,你将了解到 Linux 发行版的滚动发布模式。 + +### 什么是滚动发布? + +在软件开发中,滚动发布是一种模式,在这种模式下,软件的更新是连续推出的,而不是分批的版本。这样软件就能始终保持更新。滚动发行版rolling release distribution遵循同样的模式,它提供最新的 Linux 内核和软件版本,在它们一发布就提供。 + +[Arch Linux][3] 是滚动发行版中最流行的例子,然而 [Gentoo][4] 是最古老的滚动发行版,目前仍在开发中。 + +当你使用一个滚动发行版时,你会得到小而频繁的更新。这里没有像 Ubuntu 那样的重大 XYZ 版本发布。你会定期[更新 Arch][5]或其他滚动发行版,你将永远拥有最新版本的发行版。 + +滚动发布也是以测试为代价的。当最新的更新开始给你的系统带来问题时,你也许会受到“惊吓”。 + +### 对比滚动式发布与点版本式发布的发行版 + +![][6] + +许多 Linux 发行版,如 Debian、Ubuntu、Linux Mint、Fedora 等都遵循点版本point release模式。他们每隔几个月/年就会发布一个主要的 XYZ 版本。 + +点版本由 Linux 内核、桌面环境和其他软件的新版本组成。 + +当一个新的点版本发行版的主要版本发布时,你必须[专门来升级你的系统][7]。 + +相反,在滚动发行版中,当它从开发者那里发布时,你会不断地获得新的功能更新。这样,你不需要在几个月或几年后进行版本升级。你总是拥有最新的东西。 + +**哦,但我的 Ubuntu 也会定期更新,几乎每周一次。这是否意味着 Ubuntu 也在滚动发布?** + +![][8] + +不,Ubuntu 不是滚动发布。你看,你通常从 Ubuntu 得到的更新是安全和维护更新(除了一些软件,比如 Mozilla Firefox),而不是新功能的发布。 + +例如,GNOME 3.38 已经发布了,但 Ubuntu LTS 20.04 版不会给你 GNOME 3.38。它将坚持使用 3.36 版本。如果 GNOME 3.36 有安全或维护更新,你会在 Ubuntu 的更新中得到它。 + +LibreOffice 版本也是如此。Ubuntu 20.04 LTS 坚持使用 LibreOffice 6.x 系列,而 LibreOffice 7 已经发布了。请记住,我说的是官方软件库中的软件版本。你可以自由地从他们的官方网站上下载一个更新版本的 LibreOffice,或者使用 PPA。但你不会从 Ubuntu 的软件库中得到它。 + +当 Ubuntu 发布下一个版本 Ubuntu 20.10 时,你会得到 LibreOffice 7 和 GNOME 3.38。 + +**为什么一些滚动发行版有“版本号”和发行版名称?** + +![][9] + +这是一个合理的问题。Arch Linux 是滚动发布的,它总是让你的系统保持更新,然而你会看到像 Arch Linux 2020.9.01 这样的版本号。 + +现在想象一下,你在 2018 年安装了 Arch Linux。你定期更新你的 Arch Linux 系统,所以你在 2020 年 9 月拥有所有最新的内核和软件。 + +但是,如果你决定在 2020 年 9 月在一个新系统上安装 Arch Linux 会发生什么?如果你使用 2018 年使用的相同的安装介质,你将不得不安装过去两年或更长时间内发布的所有系统更新。这很不方便,不是吗? + +这就是为什么 Arch Linux(和其他滚动发行版)每个月或每隔几个月都会提供一个新的 ISO(操作系统安装程序镜像文件),其中包含所有最新的软件。**这就是所谓的 ISO 刷新**。这样一来,新用户就会得到一个更新的 Linux 发行版。 + +如果你已经在使用滚动发行版,你就不用担心新的 ISO 刷新了。你的系统已经和它对等了。ISO 刷新对那些要在新系统上安装它的人是有帮助的。 + +### 滚动式发布的利与弊 + +滚动发布模式的好处是,你可以得到小而频繁的更新。你总是可以从你的发行版的仓库中获得最新的内核和最新的软件版本。 + +然而,这也可能带来新软件不可预见的问题。点版本发行版通常会对系统中集成的基本组件进行测试,以避免带来令人不便的错误。而在滚动发行版中,情况就不一样了,在滚动发行版中,软件一经开发者发布就会被推出。 + +### 你应该使用滚动发行版还是点版本发行版? + +![][10] + +这取决于你。如果你是一个新的 Linux 用户,或者如果你不习惯于排除你的 Linux 系统的故障,请坚持使用你选择的点版本发行版。这也建议用于你的生产和关键任务的机器,在这里你会想要一个稳定的系统。 + +如果你想要最新的和最棒的 Linux 内核和软件,并且你不害怕花费一些时间在故障排除上(时常发生),你可以选择滚动发行版。 + +在这一点上,我还想提到 Manjaro Linux 的混合滚动发布模式。Manjaro 确实遵循滚动发布模式,你不必将系统升级到较新的版本。不过,Manjaro 也会对基本的软件组件进行测试,而不是盲目的向用户推出。这也是[为什么这么多人使用 Manjrao Linux][11] 的原因之一。 + +### 我讲清楚了吗? + +希望你现在对“滚动发行版”这个词有了稍微的了解。如果你对它仍有一些疑问,请留言,我会尽力回答。我可能会更新文章以涵盖你的问题。祝你愉快 :) + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/rolling-release/ + +作者:[Abhishek Prakash][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://itsfoss.com/author/abhishek/ +[b]: https://github.com/lujun9972 +[1]: https://itsfoss.com/what-is-linux/ +[2]: https://linux.cn/article-12609-1.html +[3]: https://www.archlinux.org/ +[4]: https://www.gentoo.org/ +[5]: https://itsfoss.com/update-arch-linux/ +[6]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/09/what-is-rolling-release-distribution.png?resize=800%2C450&ssl=1 +[7]: https://itsfoss.com/upgrade-ubuntu-version/ +[8]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/04/updates-available-ubuntu.png?resize=800%2C433&ssl=1 +[9]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/09/arch-linux-iso-refresh.png?resize=799%2C388&ssl=1 +[10]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/09/rolling-vs-point-release-distribution.png?resize=800%2C350&ssl=1 +[11]: https://itsfoss.com/why-use-manjaro-linux/ diff --git a/published/202009/20200921 Teach Python with the Mu editor.md b/published/202009/20200921 Teach Python with the Mu editor.md new file mode 100644 index 0000000000..ba38d69784 --- /dev/null +++ b/published/202009/20200921 Teach Python with the Mu editor.md @@ -0,0 +1,138 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12654-1.html) +[#]: subject: (Teach Python with the Mu editor) +[#]: via: (https://opensource.com/article/20/9/teach-python-mu) +[#]: author: (Don Watkins https://opensource.com/users/don-watkins) + +使用 Mu 编辑器教授 Python +====== + +> Mu 让你轻松学会如何编写 Python 代码。 + +![](https://img.linux.net.cn/data/attachment/album/202009/26/115018dkf3lvfyekifliec.jpg) + +在学校里,教孩子们编程是非常流行的。很多年前,在 Apple II 和 [Logo][2] 编程的年代,我学会了创建乌龟turtle绘图。我很喜欢学习如何对虚拟乌龟进行编程,后来也帮助学生进行编程。 + +大约五年前,我了解了 [Python 的 turtle 模块][3],这是我 Python 之旅的转折点。很快,我开始使用 `turtle` 模块来教学生 Python 编程基础,包括使用它来创建有趣的图形。 + +### 开始使用 Python 的 turtle 模块 + +在 Linux 或 macOS 电脑上,你只需打开一个终端,输入 `python`,你就会看到 Python shell。 + +如果你使用的是 Windows 电脑,则需要先安装 Python,到 Python 网站上[下载][4]最新的稳定版。 + +接下来,用 `import turtle ` 或 `import turtle as t` 将 `turtle` 模块导入 Python 中。然后你就可以开始享受创建乌龟绘图的乐趣了。 + +### 认识一下 Mu + +在我的 Python 冒险的早期,我使用了 [IDLE][5],它是 Python 的集成开发环境。它比在 Python shell 中输入命令要容易得多,而且我可以编写和保存程序供以后使用。我参加了一些在线课程,阅读了许多关于 Python 编程的优秀书籍。我教老师和学生如何使用 IDLE 创建乌龟绘图。 + +IDLE 是一个很大的改进,但在克利夫兰的 PyConUS 2019 上,我看到了 [Nicholas Tollervey][6]的演讲,这改变了我学习和教授 Python 的方式。Nick 是一位教育家,他创建了 [Mu][7],一个专门为年轻程序员(甚至像我这样的老程序员)设计的 Python 编辑器。Mu 可以安装在 Linux、macOS 和 Windows 上。它很容易使用,并且附带了优秀的[文档][8]和[教程][9]。 + +在 Linux 上,你可以通过命令行安装 Mu。 + +在 Ubuntu 或 Debian 上: + +``` +$ sudo apt install mu-editor +``` + +在 Fedora 或类似的地方: + +``` +$ sudo dnf install mu +``` + +或者,你可以使用 Python 来进行安装。首先,确保你已经安装了 Python 3: + +``` +$ python --version +``` + +如果失败了,就试试: + +``` +$ python3 --version +``` + +假设你有 Python 3 或更高版本,使用 Python 包管理器 `pip` 安装 Mu。 + +``` +$ python -m pip install mu-editor --user +``` + +然后你可以从命令行运行 Mu,或者创建一个快捷方式: + +``` +$ python -m pip install shortcut mu-editor --user +``` + +[树莓派][10]上默认安装了 Mu,这是一个很大的优点。在过去的几年里,我已经向学生介绍了使用树莓派和 Mu 编辑器的 Python 编程。 + +### 如何用 Mu 教授 Python + +Mu 是向学生展示 Python 入门的好方法。下面是我如何教学生开始使用它。 + +1. 打开 Mu 编辑器。 + + ![Mu editor][11] +2. 输入 `import turtle` 导入 `turtle` 模块,就可以让乌龟动起来了。我的第一课是用 Python 代码画一个简单的正方形。 + + ![Mu editor][13] +3. 保存这个程序,确保文件名以 .py 结尾。 + + ![Saving program in Mu][14] +4. 运行程序。哪怕是运行这样一个简单的程序都会让人兴奋,看到你写的程序的图形输出是很有趣的。 + + ![Running Python program in Mu][15] + +### 超越基础知识 + +在上完这节简单的课后,我讲解了有一些方法可以简化和扩展学生所学的基础知识。一是创建一个更简单的 `turtle` 对象,`import turtle as t`。然后我介绍了一个 `for` 循环,用另外一种 `turtle` 方法画一个正方形。 + +![for loops in Python with Mu][16] + +接下来,我将展示如何创建一个 `my_square` 函数,作为另一种绘制正方形的方法。 + +![my_square function][17] + +后来,我通过介绍其他 `turtle` 模块方法,包括 `penup`、`pendown` 和 `pencolor` 来扩展这个概念。很快,我的学生们就开始开发更复杂的程序,并对其进行迭代。 + +![Mu editor][18] + +我一直渴望学习,我很想知道你在学校或家里是如何教授 Python 的。请在评论中分享你的经验。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/9/teach-python-mu + +作者:[Don Watkins][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/don-watkins +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/python-programming-code-keyboard.png?itok=fxiSpmnd (Hands on a keyboard with a Python book ) +[2]: https://en.wikipedia.org/wiki/Logo_(programming_language) +[3]: https://docs.python.org/3/library/turtle.html +[4]: https://www.python.org/downloads/windows/ +[5]: https://docs.python.org/3/library/idle.html +[6]: https://ntoll.org/ +[7]: https://codewith.mu/en/download +[8]: https://codewith.mu/en/howto/ +[9]: https://codewith.mu/en/tutorials/ +[10]: https://www.raspberrypi.org/blog/mu-python-ide/ +[11]: https://opensource.com/sites/default/files/uploads/mu-1_open.png (Mu editor) +[12]: https://creativecommons.org/licenses/by-sa/4.0/ +[13]: https://opensource.com/sites/default/files/uploads/mu-2_square.png (Mu editor) +[14]: https://opensource.com/sites/default/files/uploads/mu-3_save.png (Saving program in Mu) +[15]: https://opensource.com/sites/default/files/uploads/mu-4_run.png (Running Python program in Mu) +[16]: https://opensource.com/sites/default/files/uploads/mu-5_for-loop.png (for loops in Python with Mu) +[17]: https://opensource.com/sites/default/files/uploads/mu-6_my_square.png (my_square function) +[18]: https://opensource.com/sites/default/files/uploads/mu-7_beyond-basics.png (Mu editor) diff --git a/published/202009/20200923 Meet eDEX-UI, A Sci-Fi Inspired Linux Terminal Emulator With Some Cool Features.md b/published/202009/20200923 Meet eDEX-UI, A Sci-Fi Inspired Linux Terminal Emulator With Some Cool Features.md new file mode 100644 index 0000000000..0e0aabb207 --- /dev/null +++ b/published/202009/20200923 Meet eDEX-UI, A Sci-Fi Inspired Linux Terminal Emulator With Some Cool Features.md @@ -0,0 +1,105 @@ +[#]: collector: (lujun9972) +[#]: translator: (wxy) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12655-1.html) +[#]: subject: (Meet eDEX-UI, A Sci-Fi Inspired Linux Terminal Emulator With Some Cool Features) +[#]: via: (https://itsfoss.com/edex-ui-sci-fi-terminal/) +[#]: author: (Ankush Das https://itsfoss.com/author/ankush/) + +eDEX-UI:一款科幻风格的酷炫 Linux 终端仿真器 +====== + +> eDEX-UI 是一个很酷的科幻电影式的终端仿真器,看起来很酷,有大量包括系统监控在内的选项。让我们来快速看看它提供了什么。 + +你可能已经知道了[大量有趣的 Linux 命令][1]。但你知道当谈到 Linux 命令行时,还有什么有趣的东西吗?那就是终端本身。 + +是的,终端仿真器(俗称终端)也可以很有趣。还记得 80 年代和 90 年代初的[酷炫复古的终端,给你一个复古的终端][2]吗? + +那一款深受 《[创:战纪][3]TRON Legacy》 电影特效启发的养眼终端感觉怎么样? + +在本文中,让我们来看看一款神奇的跨平台终端模拟器,注意口水! + +### eDEX-UI: 一个很酷的终端仿真器 + +[eDEX-UI][5] 是一款开源的跨平台终端仿真器,它为你呈现了一个科幻风格的外观和一些有用的功能。 + +它最初的灵感来自于 [DEX UI][6] 项目,但该项目已经不再维护。 + +尽管 eDEX-UI 的重点是外观和未来主义主题的终端,但它也可以作为一个 [Linux 系统监控工具][7]。怎么说呢?因为当你在终端中工作时,它可以在侧边栏中显示系统的统计信息。事实上,其开发者提到,他的目标是将其改进为一个可用的系统管理工具。 + +让我们来看看它还提供了什么,以及如何让它安装到你的电脑上。 + +### eDEX-UI 的特点 + +![][8] + +eDEX-UI 本质上是一个终端仿真器。你可以像普通终端一样使用它来运行命令和其他任何你可以在终端中做的事情。 + +它以全屏方式运行,侧边栏和底部面板可以监控系统和网络的统计信息。此外,还有一个用于触摸设备的虚拟键盘。 + +我做了一个简短的视频,我建议你观看这个视频,看看这个很酷的终端模拟器运行起来是什么样子。**播放视频时要打开声音**(相信我)。 + +- [视频](https://player.vimeo.com/video/460435965) + +eDEX-UI 的特点: + + * 多标签 + * 对 curses 的支持 + * 目录查看器,显示当前工作目录的内容 + * 显示系统信息,包括主板信息、网络状态、IP、网络带宽使用情况、CPU 使用情况、CPU 温度、RAM 使用情况等 + * 自定义选项,以改变主题、键盘布局、CSS 注入 + * 可选的声音效果,让你有一种黑客的感觉 + * 跨平台支持(Windows、macOS 和 Linux) + +### 在 Linux 上安装 eDEX + +![eDEX-UI with Matrix theme][10] + +如前所述,它支持所有主要平台,包括 Windows、macOS,当然还有 Linux。 + +要在 Linux 发行版上安装它,你可以从它的 [GitHub 发布部分][11]中抓取 AppImage 文件,或者在包括 [AUR][13] 在内的[可用资源库][12]中找到它。如果你不知道,我建议你去看一下我们关于[在 Linux 中使用 AppImage][14] 的指南。 + +你可以访问它的 GitHub 页面,如果你喜欢它,可以随时星标他们的仓库。 + +- [eDEX-UI][5] + +### 我对 eDEX-UI 的体验 + +因为它的科幻风格的外观,我喜欢这个终端仿真器。但是,我发现它对系统资源的消耗相当大。我没有[检查我的 Linux 系统的 CPU 温度][15],但 CPU 消耗肯定很高。 + +所以,如果你需要它运行在后台或单独的工作空间中(像我这样),你可能要注意这一点。除此以外,它是一个令人印象深刻的工具,拥有目录查看器和系统资源监控等有用的选项。 + +顺便说一句,如果你想模拟黑客来娱乐一下客人和孩子们,[那么可以试试好莱坞工具][16]。 + +你觉得 eDEX-UI 怎么样?你是想试一试,还是觉得太幼稚/过于复杂? + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/edex-ui-sci-fi-terminal/ + +作者:[Ankush Das][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://itsfoss.com/author/ankush/ +[b]: https://github.com/lujun9972 +[1]: https://itsfoss.com/funny-linux-commands/ +[2]: https://itsfoss.com/cool-retro-term/ +[3]: https://www.imdb.com/title/tt1104001/ +[4]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/09/edex-ui-hacking-terminal.jpg?resize=800%2C450&ssl=1 +[5]: https://github.com/GitSquared/edex-ui +[6]: https://github.com/seenaburns/dex-ui +[7]: https://itsfoss.com/linux-system-monitoring-tools/ +[8]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/09/edex-ui-screenshot-1.png?resize=800%2C450&ssl=1 +[9]: https://www.youtube.com/c/itsfoss?sub_confirmation=1 +[10]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/09/edex-ui-screenshot.png?resize=800%2C450&ssl=1 +[11]: https://github.com/GitSquared/edex-ui/releases +[12]: https://repology.org/project/edex-ui/versions +[13]: https://itsfoss.com/aur-arch-linux/ +[14]: https://itsfoss.com/use-appimage-linux/ +[15]: https://itsfoss.com/check-laptop-cpu-temperature-ubuntu/ +[16]: https://itsfoss.com/hollywood-hacker-screen/ diff --git a/published/20200928 Add sound to your Python game.md b/published/20200928 Add sound to your Python game.md new file mode 100644 index 0000000000..5d898e07cb --- /dev/null +++ b/published/20200928 Add sound to your Python game.md @@ -0,0 +1,156 @@ +[#]: collector: (lujun9972) +[#]: translator: (robsean) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12877-1.html) +[#]: subject: (Add sound to your Python game) +[#]: via: (https://opensource.com/article/20/9/add-sound-python-game) +[#]: author: (Seth Kenlon https://opensource.com/users/seth) + +添加声音到你的 Python 游戏 +====== + +> 通过添加声音到你的游戏中,听听当你的英雄战斗、跳跃、收集战利品时会发生什么。学习如何在这个 Pygame 系列的第十三篇文章中,创建一个声音平台类精灵。 + +![](https://img.linux.net.cn/data/attachment/album/202012/02/092244du74f14837zmo7fz.jpg) + +在 [Python 3][2] 中使用 [Pygame][3] 模块来创建电脑游戏的系列文章仍在进行中,这是第十三部分。先前的文章是: + + 1. [通过构建一个简单的掷骰子游戏去学习怎么用 Python 编程][4] + 2. [使用 Python 和 Pygame 模块构建一个游戏框架][5] + 3. [如何在你的 Python 游戏中添加一个玩家][6] + 4. [用 Pygame 使你的游戏角色移动起来][7] + 5. [如何向你的 Python 游戏中添加一个敌人][8] + 6. [在 Pygame 游戏中放置平台][9] + 7. [在你的 Python 游戏中模拟引力][10] + 8. [为你的 Python 平台类游戏添加跳跃功能][11] + 9. [使你的 Python 游戏玩家能够向前和向后跑][12] + 10. [在你的 Python 平台类游戏中放一些奖励][13] + 11. [添加计分到你的 Python 游戏][14] + 12. [在你的 Python 游戏中加入投掷机制][15] + +Pygame 提供了一种简单的方法来集成声音到你的 Python 电脑游戏中。Pygame 的 [mixer 模块][16] 可以依据命令播放一个或多个声音,并且你也可以将这些声音混合在一起,例如,你能够在听到你的英雄收集奖励或跳过敌人声音的同时播放背景音乐。 + +集成 `mixer` 模块到一个已存在的游戏中是很容易的,因此,与其给你代码示例来向你展示放置它们的位置,不如在这篇文章解释在你的应用程序中获得声音所需的四个步骤。 + +### 启动 mixer + +首先,在你代码的设置部分,启动 `mixer` 进程。你的代码已经启动 Pygame 和 Pygame 字体,因此将它们归类到一起是一个很好的主意: + +``` +pygame.init() +pygame.font.init() +pygame.mixer.init() # add this line +``` + +### 定义声音 + +接下来,你必需定义你想要使用的声音。这样就要求你的计算机上有声音文件,就像使用字体就要求你有字体文件,使用图像就要求你有图像文件一样。 + +你还必需把这些声音与你的游戏捆绑在一起,以便任何玩你游戏的人都有这些声音文件。 + +为将一个声音与你的游戏捆绑在一起,首先在你的游戏目录中创建一个新的目录,就像你为你图像和字体创建的目录一样。称它为 `sound`: + +``` +s = 'sound' +``` + +尽管在互联网上有很多声音文件,下载这些声音文件并将其与你的游戏一起分发并不一定是合法的。这看起来是很奇怪的,因为这么多来自著名电脑游戏的声音是流行文化的一部分,但法律就是这样运作的。如果你想与你的游戏一起分发一个声音文件,你必需找到一个开源或[共创许可][17]的声音文件,它们准许与游戏一起提供声音。 + +这里有一些专门提供自由和合法的声音文件的网站,包括: + + * [Freesound][18] 托管存储所有种类的音效。 + * [Incompetech][19] 托管存储背景音乐。 + * [Open Game Art][20] 托管存储一些音效和音乐。 + +一些声音文件只要你给予作曲家或声音设计师一个致谢就可以自由使用。在与你的游戏捆绑前,仔细阅读使用条件!音乐家和声音设计师在声音上的工作就像你在代码上的工作一样努力,因此即使他们不要求,给予他们致谢也是极好的。 + +给予你的声音源文件一些致谢,在一个名为 `CREDIT` 的文本文件中列出你使用的声音,并在你的游戏文件夹中放置该文本文件。 + +你也可以尝试制作你自己的音乐。优秀的 [LMMS][21] 音频工作站易于使用,并带有很多有趣的声音。它在所有主要的平台上都可以使用,也可以导出为 [Ogg Vorbis][22](OGG)音频格式。 + +### 添加声音到 Pygame + +当你找到你喜欢的一个声音文件时,下载它。如果它是一个 ZIP 或 TAR 文件,提取它并将其移动到你游戏目录中的 `sound` 文件夹中。 + +如果声音文件的名字带有空格或特殊字符,重新命名它。文件名称是完全随意的,它的名称越简单,你就越容易输入到你的代码中。 + +大多数的电脑游戏使用 OGG 格式声音文件,因为这种格式可以占有较小空间而提供高质量的声音。当你下载一个声音文件时,它可能是一个 MP3、WAVE、FLAC 或者其它的音频格式。为保持你的文件的较高兼容性和降低下载文件大小,使用一个像 [fre:ac][23] 或 [Miro][24] 这样的工具来转换这些的文件格式为 Ogg 格式。 + +例如,假设你已经下载一个称为 `ouch.ogg` 的声音文件。 + +在你代码的设置部分中,创建一个变量,代表你想使用的声音文件: + +``` +ouch = pygame.mixer.Sound(os.path.join(s, 'ouch.ogg')) +``` + +### 触发一个声音 + +为使用一个声音,你所要做的就是在你想触发它的时候调用这个变量。例如,当你的玩家击中一名敌人时,触发 `OUCH` 声音效果: + +``` +for enemy in enemy_hit_list: + pygame.mixer.Sound.play(ouch) + score -= 1 +``` + +你可以为各种动作创建声音,例如,跳跃、收集奖励、投掷、碰撞,以及其他任何你能想象到的动作。 + +### 添加背景音乐 + +如果你有想在你的游戏的背景中播放的音乐或令人激动的音效,你可以使用 Pygame 中的 `mixer` 模块中的 `music` 函数。在你的设置部分中,加载音乐文件: + +``` +music = pygame.mixer.music.load(os.path.join(s, 'music.ogg')) +``` + +然后,开始音乐: + +``` +pygame.mixer.music.play(-1) +``` + +`-1` 值告诉 Pygame 无限循环音乐文件。你可以将其设置为从 0 到更高的值之间的任意数值,以定义音乐在停止前循环多少次。 + +### 享受音效 + +音乐和声音可以为你的游戏添加很多韵味。尝试添加一些声音到你的 Pygame 工程! + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/9/add-sound-python-game + +作者:[Seth Kenlon][a] +选题:[lujun9972][b] +译者:[robsean](https://github.com/robsean) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/seth +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/colorful_sound_wave.png?itok=jlUJG0bM (Colorful sound wave graph) +[2]: https://www.python.org/ +[3]: https://www.pygame.org/news +[4]: https://linux.cn/article-9071-1.html +[5]: https://linux.cn/article-10850-1.html +[6]: https://linux.cn/article-10858-1.html +[7]: https://linux.cn/article-10874-1.html +[8]: https://linux.cn/article-10883-1.html +[9]: https://linux.cn/article-10902-1.html +[10]: https://linux.cn/article-11780-1.html +[11]: https://linux.cn/article-11790-1.html +[12]: https://linux.cn/article-11819-1.html +[13]: https://linux.cn/article-11828-1.html +[14]: https://linux.cn/article-11839-1.html +[15]: https://linux.cn/article-12872-1.html +[16]: https://www.pygame.org/docs/ref/mixer.html +[17]: https://opensource.com/article/20/1/what-creative-commons +[18]: https://freesound.org +[19]: https://incompetech.filmmusic.io +[20]: https://opengameart.org +[21]: https://opensource.com/life/16/2/linux-multimedia-studio +[22]: https://en.wikipedia.org/wiki/Vorbis +[23]: https://www.freac.org/index.php/en/downloads-mainmenu-330 +[24]: http://getmiro.com diff --git a/published/202010/20180414 Go on very small hardware Part 2.md b/published/202010/20180414 Go on very small hardware Part 2.md new file mode 100644 index 0000000000..fdce9ab34c --- /dev/null +++ b/published/202010/20180414 Go on very small hardware Part 2.md @@ -0,0 +1,935 @@ +[#]: collector: (oska874) +[#]: translator: (gxlct008) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12747-1.html) +[#]: subject: (Go on very small hardware Part 2) +[#]: via: (https://ziutek.github.io/2018/04/14/go_on_very_small_hardware2.html) +[#]: author: (Michał Derkacz https://ziutek.github.io/) + +Go 语言在极小硬件上的运用(二) +============================================================ + +![](https://img.linux.net.cn/data/attachment/album/201909/24/210256yihkuy8kcigugr2h.png) + +在本文的 [第一部分][2] 的结尾,我承诺要写关于接口的内容。我不想在这里写有关接口或完整或简短的讲义。相反,我将展示一个简单的示例,来说明如何定义和使用接口,以及如何利用无处不在的 `io.Writer` 接口。还有一些关于反射reflection半主机semihosting的内容。 + +![STM32F030F4P6](https://ziutek.github.io/images/mcu/f030-demo-board/board.jpg) + +接口是 Go 语言的重要组成部分。如果你想了解更多有关它们的信息,我建议你阅读《[高效的 Go 编程][3]》 和 [Russ Cox 的文章][4]。 + +### 并发 Blinky – 回顾 + +当你阅读前面示例的代码时,你可能会注意到一中打开或关闭 LED 的反直觉方式。 `Set` 方法用于关闭 LED,`Clear` 方法用于打开 LED。这是由于在 漏极开路配置open-drain configuration 下驱动了 LED。我们可以做些什么来减少代码的混乱?让我们用 `On` 和 `Off` 方法来定义 `LED` 类型: + +``` +type LED struct { + pin gpio.Pin +} + +func (led LED) On() { + led.pin.Clear() +} + +func (led LED) Off() { + led.pin.Set() +} +``` + +现在我们可以简单地调用 `led.On()` 和 `led.Off()`,这不会再引起任何疑惑了。 + +在前面的所有示例中,我都尝试使用相同的 漏极开路配置open-drain configuration来避免代码复杂化。但是在最后一个示例中,对于我来说,将第三个 LED 连接到 GND 和 PA3 引脚之间并将 PA3 配置为推挽模式push-pull mode会更容易。下一个示例将使用以此方式连接的 LED。 + +但是我们的新 `LED` 类型不支持推挽配置,实际上,我们应该将其称为 `OpenDrainLED`,并定义另一个类型 `PushPullLED`: + +``` +type PushPullLED struct { + pin gpio.Pin +} + +func (led PushPullLED) On() { + led.pin.Set() +} + +func (led PushPullLED) Off() { + led.pin.Clear() +} +``` + +请注意,这两种类型都具有相同的方法,它们的工作方式也相同。如果在 LED 上运行的代码可以同时使用这两种类型,而不必注意当前使用的是哪种类型,那就太好了。 接口类型可以提供帮助: + +``` +package main + +import ( + "delay" + + "stm32/hal/gpio" + "stm32/hal/system" + "stm32/hal/system/timer/systick" +) + +type LED interface { + On() + Off() +} + +type PushPullLED struct{ pin gpio.Pin } + +func (led PushPullLED) On() { + led.pin.Set() +} + +func (led PushPullLED) Off() { + led.pin.Clear() +} + +func MakePushPullLED(pin gpio.Pin) PushPullLED { + pin.Setup(&gpio.Config{Mode: gpio.Out, Driver: gpio.PushPull}) + return PushPullLED{pin} +} + +type OpenDrainLED struct{ pin gpio.Pin } + +func (led OpenDrainLED) On() { + led.pin.Clear() +} + +func (led OpenDrainLED) Off() { + led.pin.Set() +} + +func MakeOpenDrainLED(pin gpio.Pin) OpenDrainLED { + pin.Setup(&gpio.Config{Mode: gpio.Out, Driver: gpio.OpenDrain}) + return OpenDrainLED{pin} +} + +var led1, led2 LED + +func init() { + system.SetupPLL(8, 1, 48/8) + systick.Setup(2e6) + + gpio.A.EnableClock(false) + led1 = MakeOpenDrainLED(gpio.A.Pin(4)) + led2 = MakePushPullLED(gpio.A.Pin(3)) +} + +func blinky(led LED, period int) { + for { + led.On() + delay.Millisec(100) + led.Off() + delay.Millisec(period - 100) + } +} + +func main() { + go blinky(led1, 500) + blinky(led2, 1000) +} + +``` + +我们定义了 `LED` 接口,它有两个方法: `On` 和 `Off`。 `PushPullLED` 和 `OpenDrainLED` 类型代表两种驱动 LED 的方式。我们还定义了两个用作构造函数的 `Make*LED` 函数。这两种类型都实现了 `LED` 接口,因此可以将这些类型的值赋给 `LED` 类型的变量: + +``` +led1 = MakeOpenDrainLED(gpio.A.Pin(4)) +led2 = MakePushPullLED(gpio.A.Pin(3)) +``` + +在这种情况下,可赋值性assignability在编译时检查。赋值后,`led1` 变量包含一个 `OpenDrainLED{gpio.A.Pin(4)}`,以及一个指向 `OpenDrainLED` 类型的方法集的指针。 `led1.On()` 调用大致对应于以下 C 代码: + +``` +led1.methods->On(led1.value) +``` + +如你所见,如果仅考虑函数调用的开销,这是相当廉价的抽象。 + +但是,对接口的任何赋值都会导致包含有关已赋值类型的大量信息。对于由许多其他类型组成的复杂类型,可能会有很多信息: + +``` +$ egc +$ arm-none-eabi-size cortexm0.elf + text data bss dec hex filename + 10356 196 212 10764 2a0c cortexm0.elf +``` + +如果我们不使用 [反射][5],可以通过避免包含类型和结构字段的名称来节省一些字节: + +``` +$ egc -nf -nt +$ arm-none-eabi-size cortexm0.elf + text data bss dec hex filename + 10312 196 212 10720 29e0 cortexm0.elf +``` + +生成的二进制文件仍然包含一些有关类型的必要信息和关于所有导出方法(带有名称)的完整信息。在运行时,主要是当你将存储在接口变量中的一个值赋值给任何其他变量时,需要此信息来检查可赋值性。 + +我们还可以通过重新编译所导入的包来删除它们的类型和字段名称: + +``` +$ cd $HOME/emgo +$ ./clean.sh +$ cd $HOME/firstemgo +$ egc -nf -nt +$ arm-none-eabi-size cortexm0.elf + text data bss dec hex filename + 10272 196 212 10680 29b8 cortexm0.elf +``` + +让我们加载这个程序,看看它是否按预期工作。这一次我们将使用 [st-flash][6] 命令: + +``` +$ arm-none-eabi-objcopy -O binary cortexm0.elf cortexm0.bin +$ st-flash write cortexm0.bin 0x8000000 +st-flash 1.4.0-33-gd76e3c7 +2018-04-10T22:04:34 INFO usb.c: -- exit_dfu_mode +2018-04-10T22:04:34 INFO common.c: Loading device parameters.... +2018-04-10T22:04:34 INFO common.c: Device connected is: F0 small device, id 0x10006444 +2018-04-10T22:04:34 INFO common.c: SRAM size: 0x1000 bytes (4 KiB), Flash: 0x4000 bytes (16 KiB) in pages of 1024 bytes +2018-04-10T22:04:34 INFO common.c: Attempting to write 10468 (0x28e4) bytes to stm32 address: 134217728 (0x8000000) +Flash page at addr: 0x08002800 erased +2018-04-10T22:04:34 INFO common.c: Finished erasing 11 pages of 1024 (0x400) bytes +2018-04-10T22:04:34 INFO common.c: Starting Flash write for VL/F0/F3/F1_XL core id +2018-04-10T22:04:34 INFO flash_loader.c: Successfully loaded flash loader in sram + 11/11 pages written +2018-04-10T22:04:35 INFO common.c: Starting verification of write complete +2018-04-10T22:04:35 INFO common.c: Flash written and verified! jolly good! + +``` + +我没有将 NRST 信号连接到编程器,因此无法使用 `-reset` 选项,必须按下复位按钮才能运行程序。 + +![Interfaces](https://ziutek.github.io/images/mcu/f030-demo-board/interfaces.png) + +看来,`st-flash` 与此板配合使用有点不可靠(通常需要复位 ST-LINK 加密狗)。此外,当前版本不会通过 SWD 发出复位命令(仅使用 NRST 信号)。软件复位是不现实的,但是它通常是有效的,缺少它会将会带来不便。对于板卡程序员board-programmer 来说 OpenOCD 工作得更好。 + +### UART + +UART(通用异步收发传输器Universal Aynchronous Receiver-Transmitter)仍然是当今微控制器最重要的外设之一。它的优点是以下属性的独特组合: + +* 相对较高的速度, +* 仅两条信号线(在 半双工half-duplex 通信的情况下甚至一条), +* 角色对称, +* 关于新数据的 同步带内信令synchronous in-band signaling(起始位), +* 在传输 words 内的精确计时。 + +这使得最初用于传输由 7-9 位的字组成的异步消息的 UART,也被用于有效地实现各种其他物理协议,例如被 [WS28xx LEDs][7] 或 [1-wire][8] 设备使用的协议。 + +但是,我们将以其通常的角色使用 UART:从程序中打印文本消息。 + +``` +package main + +import ( + "io" + "rtos" + + "stm32/hal/dma" + "stm32/hal/gpio" + "stm32/hal/irq" + "stm32/hal/system" + "stm32/hal/system/timer/systick" + "stm32/hal/usart" +) + +var tts *usart.Driver + +func init() { + system.SetupPLL(8, 1, 48/8) + systick.Setup(2e6) + + gpio.A.EnableClock(true) + tx := gpio.A.Pin(9) + + tx.Setup(&gpio.Config{Mode: gpio.Alt}) + tx.SetAltFunc(gpio.USART1_AF1) + d := dma.DMA1 + d.EnableClock(true) + tts = usart.NewDriver(usart.USART1, d.Channel(2, 0), nil, nil) + tts.Periph().EnableClock(true) + tts.Periph().SetBaudRate(115200) + tts.Periph().Enable() + tts.EnableTx() + + rtos.IRQ(irq.USART1).Enable() + rtos.IRQ(irq.DMA1_Channel2_3).Enable() +} + +func main() { + io.WriteString(tts, "Hello, World!\r\n") +} + +func ttsISR() { + tts.ISR() +} + +func ttsDMAISR() { + tts.TxDMAISR() +} + +//c:__attribute__((section(".ISRs"))) +var ISRs = [...]func(){ + irq.USART1: ttsISR, + irq.DMA1_Channel2_3: ttsDMAISR, +} + +``` + +你会发现此代码可能有些复杂,但目前 STM32 HAL 中没有更简单的 UART 驱动程序(在某些情况下,简单的轮询驱动程序可能会很有用)。 `usart.Driver` 是使用 DMA 和中断来减轻 CPU 负担的高效驱动程序。 + +STM32 USART 外设提供传统的 UART 及其同步版本。要将其用作输出,我们必须将其 Tx 信号连接到正确的 GPIO 引脚: + +``` +tx.Setup(&gpio.Config{Mode: gpio.Alt}) +tx.SetAltFunc(gpio.USART1_AF1) +``` + +在 Tx-only 模式下配置 `usart.Driver` (rxdma 和 rxbuf 设置为 nil): + +``` +tts = usart.NewDriver(usart.USART1, d.Channel(2, 0), nil, nil) +``` + +我们使用它的 `WriteString` 方法来打印这句名言。让我们清理所有内容并编译该程序: + +``` +$ cd $HOME/emgo +$ ./clean.sh +$ cd $HOME/firstemgo +$ egc +$ arm-none-eabi-size cortexm0.elf + text data bss dec hex filename + 12728 236 176 13140 3354 cortexm0.elf +``` + +要查看某些内容,你需要在 PC 中使用 UART 外设。 + +**请勿使用 RS232 端口或 USB 转 RS232 转换器!** + +STM32 系列使用 3.3V 逻辑,但是 RS232 可以产生 -15 V ~ +15 V 的电压,这可能会损坏你的 MCU。你需要使用 3.3V 逻辑的 USB 转 UART 转换器。流行的转换器基于 FT232 或 CP2102 芯片。 + +![UART](https://ziutek.github.io/images/mcu/f030-demo-board/uart.jpg) + +你还需要一些终端仿真程序(我更喜欢 [picocom][9])。刷新新图像,运行终端仿真器,然后按几次复位按钮: + +``` +$ openocd -d0 -f interface/stlink.cfg -f target/stm32f0x.cfg -c 'init; program cortexm0.elf; reset run; exit' +Open On-Chip Debugger 0.10.0+dev-00319-g8f1f912a (2018-03-07-19:20) +Licensed under GNU GPL v2 +For bug reports, read + http://openocd.org/doc/doxygen/bugs.html +debug_level: 0 +adapter speed: 1000 kHz +adapter_nsrst_delay: 100 +none separate +adapter speed: 950 kHz +target halted due to debug-request, current mode: Thread +xPSR: 0xc1000000 pc: 0x080016f4 msp: 0x20000a20 +adapter speed: 4000 kHz +** Programming Started ** +auto erase enabled +target halted due to breakpoint, current mode: Thread +xPSR: 0x61000000 pc: 0x2000003a msp: 0x20000a20 +wrote 13312 bytes from file cortexm0.elf in 1.020185s (12.743 KiB/s) +** Programming Finished ** +adapter speed: 950 kHz +$ +$ picocom -b 115200 /dev/ttyUSB0 +picocom v3.1 + +port is : /dev/ttyUSB0 +flowcontrol : none +baudrate is : 115200 +parity is : none +databits are : 8 +stopbits are : 1 +escape is : C-a +local echo is : no +noinit is : no +noreset is : no +hangup is : no +nolock is : no +send_cmd is : sz -vv +receive_cmd is : rz -vv -E +imap is : +omap is : +emap is : crcrlf,delbs, +logfile is : none +initstring : none +exit_after is : not set +exit is : no + +Type [C-a] [C-h] to see available commands +Terminal ready +Hello, World! +Hello, World! +Hello, World! +``` + +每次按下复位按钮都会产生新的 “Hello,World!”行。一切都在按预期进行。 + +要查看此 MCU 的 双向bi-directional UART 代码,请查看 [此示例][10]。 + +### io.Writer 接口 + +`io.Writer` 接口可能是 Go 中第二种最常用的接口类型,仅次于 `error` 接口。其定义如下所示: + +``` +type Writer interface { + Write(p []byte) (n int, err error) +} +``` + +`usart.Driver` 实现了 `io.Writer`,因此我们可以替换: + +``` +tts.WriteString("Hello, World!\r\n") +``` + +为 + +``` +io.WriteString(tts, "Hello, World!\r\n") +``` + +此外,你需要将 `io` 包添加到 `import` 部分。 + +`io.WriteString` 函数的声明如下所示: + +``` +func WriteString(w Writer, s string) (n int, err error) +``` + +如你所见,`io.WriteString` 允许使用实现了 `io.Writer` 接口的任何类型来编写字符串。在内部,它检查基础类型是否具有 `WriteString` 方法,并使用该方法代替 `Write`(如果可用)。 + +让我们编译修改后的程序: + +``` +$ egc +$ arm-none-eabi-size cortexm0.elf + text data bss dec hex filename + 15456 320 248 16024 3e98 cortexm0.elf +``` + +如你所见,`io.WriteString` 导致二进制文件的大小显着增加:15776-12964 = 2812 字节。 Flash 上没有太多空间了。是什么引起了这么大规模的增长? + +使用这个命令: + +``` +arm-none-eabi-nm --print-size --size-sort --radix=d cortexm0.elf +``` + +我们可以打印两种情况下按其大小排序的所有符号。通过过滤和分析获得的数据(`awk`,`diff`),我们可以找到大约 80 个新符号。最大的十个如下所示: + +``` +> 00000062 T stm32$hal$usart$Driver$DisableRx +> 00000072 T stm32$hal$usart$Driver$RxDMAISR +> 00000076 T internal$Type$Implements +> 00000080 T stm32$hal$usart$Driver$EnableRx +> 00000084 t errors$New +> 00000096 R $8$stm32$hal$usart$Driver$$ +> 00000100 T stm32$hal$usart$Error$Error +> 00000360 T io$WriteString +> 00000660 T stm32$hal$usart$Driver$Read +``` + +因此,即使我们不使用 `usart.Driver.Read` 方法,但它被编译进来了,与 `DisableRx`、`RxDMAISR`、`EnableRx` 以及上面未提及的其他方法一样。不幸的是,如果你为接口赋值了一些内容,就需要它的完整方法集(包含所有依赖项)。对于使用大多数方法的大型程序来说,这不是问题。但是对于我们这种极简的情况而言,这是一个巨大的负担。 + +我们已经接近 MCU 的极限,但让我们尝试打印一些数字(你需要在 `import` 部分中用 `strconv` 替换 `io` 包): + +``` +func main() { + a := 12 + b := -123 + + tts.WriteString("a = ") + strconv.WriteInt(tts, a, 10, 0, 0) + tts.WriteString("\r\n") + tts.WriteString("b = ") + strconv.WriteInt(tts, b, 10, 0, 0) + tts.WriteString("\r\n") + + tts.WriteString("hex(a) = ") + strconv.WriteInt(tts, a, 16, 0, 0) + tts.WriteString("\r\n") + tts.WriteString("hex(b) = ") + strconv.WriteInt(tts, b, 16, 0, 0) + tts.WriteString("\r\n") +} +``` + +与使用 `io.WriteString` 函数的情况一样,`strconv.WriteInt` 的第一个参数的类型为 `io.Writer`。 + +``` +$ egc +/usr/local/arm/bin/arm-none-eabi-ld: /home/michal/firstemgo/cortexm0.elf section `.rodata' will not fit in region `Flash' +/usr/local/arm/bin/arm-none-eabi-ld: region `Flash' overflowed by 692 bytes +exit status 1 +``` + +这一次我们的空间超出的不多。让我们试着精简一下有关类型的信息: + +``` +$ cd $HOME/emgo +$ ./clean.sh +$ cd $HOME/firstemgo +$ egc -nf -nt +$ arm-none-eabi-size cortexm0.elf + text data bss dec hex filename + 15876 316 320 16512 4080 cortexm0.elf +``` + +很接近,但很合适。让我们加载并运行此代码: + +``` +a = 12 +b = -123 +hex(a) = c +hex(b) = -7b +``` + +Emgo 中的 `strconv` 包与 Go 中的原型有很大的不同。它旨在直接用于写入格式化的数字,并且在许多情况下可以替换沉重的 `fmt` 包。 这就是为什么函数名称以 `Write` 而不是 `Format` 开头,并具有额外的两个参数的原因。 以下是其用法示例: + +``` +func main() { + b := -123 + strconv.WriteInt(tts, b, 10, 0, 0) + tts.WriteString("\r\n") + strconv.WriteInt(tts, b, 10, 6, ' ') + tts.WriteString("\r\n") + strconv.WriteInt(tts, b, 10, 6, '0') + tts.WriteString("\r\n") + strconv.WriteInt(tts, b, 10, 6, '.') + tts.WriteString("\r\n") + strconv.WriteInt(tts, b, 10, -6, ' ') + tts.WriteString("\r\n") + strconv.WriteInt(tts, b, 10, -6, '0') + tts.WriteString("\r\n") + strconv.WriteInt(tts, b, 10, -6, '.') + tts.WriteString("\r\n") +} +``` + +下面是它的输出: + +``` +-123 + -123 +-00123 +..-123 +-123 +-123 +-123.. +``` + +### Unix 流 和 莫尔斯电码Morse code + +由于大多数写入的函数都使用 `io.Writer` 而不是具体类型(例如 C 中的 `FILE` ),因此我们获得了类似于 Unix stream 的功能。在 Unix 中,我们可以轻松地组合简单的命令来执行更大的任务。例如,我们可以通过以下方式将文本写入文件: + +``` +echo "Hello, World!" > file.txt +``` + +`>` 操作符将前面命令的输出流写入文件。还有 `|` 操作符,用于连接相邻命令的输出流和输入流。 + +多亏了流,我们可以轻松地转换/过滤任何命令的输出。例如,要将所有字母转换为大写,我们可以通过 `tr` 命令过滤 `echo` 的输出: + +``` +echo "Hello, World!" | tr a-z A-Z > file.txt +``` + +为了显示 `io.Writer` 和 Unix 流之间的类比,让我们编写以下代码: + +``` +io.WriteString(tts, "Hello, World!\r\n") +``` + +采用以下伪 unix 形式: + +``` +io.WriteString "Hello, World!" | usart.Driver usart.USART1 +``` + +下一个示例将显示如何执行此操作: + +``` +io.WriteString "Hello, World!" | MorseWriter | usart.Driver usart.USART1 +``` + +让我们来创建一个简单的编码器,它使用莫尔斯电码对写入的文本进行编码: + +``` +type MorseWriter struct { + W io.Writer +} + +func (w *MorseWriter) Write(s []byte) (int, error) { + var buf [8]byte + for n, c := range s { + switch { + case c == '\n': + c = ' ' // Replace new lines with spaces. + case 'a' <= c && c <= 'z': + c -= 'a' - 'A' // Convert to upper case. + } + if c < ' ' || 'Z' < c { + continue // c is outside ASCII [' ', 'Z'] + } + var symbol morseSymbol + if c == ' ' { + symbol.length = 1 + buf[0] = ' ' + } else { + symbol = morseSymbols[c-'!'] + for i := uint(0); i < uint(symbol.length); i++ { + if (symbol.code>>i)&1 != 0 { + buf[i] = '-' + } else { + buf[i] = '.' + } + } + } + buf[symbol.length] = ' ' + if _, err := w.W.Write(buf[:symbol.length+1]); err != nil { + return n, err + } + } + return len(s), nil +} + +type morseSymbol struct { + code, length byte +} + +//emgo:const +var morseSymbols = [...]morseSymbol{ + {1<<0 | 1<<1 | 1<<2, 4}, // ! ---. + {1<<1 | 1<<4, 6}, // " .-..-. + {}, // # + {1<<3 | 1<<6, 7}, // $ ...-..- + + // Some code omitted... + + {1<<0 | 1<<3, 4}, // X -..- + {1<<0 | 1<<2 | 1<<3, 4}, // Y -.-- + {1<<0 | 1<<1, 4}, // Z --.. +} +``` + +你可以在 [这里][11] 找到完整的 `morseSymbols` 数组。 `//emgo:const` 指令确保 `morseSymbols` 数组不会被复制到 RAM 中。 + +现在我们可以通过两种方式打印句子: + +``` +func main() { + s := "Hello, World!\r\n" + mw := &MorseWriter{tts} + + io.WriteString(tts, s) + io.WriteString(mw, s) +} +``` + +我们使用指向 `MorseWriter` `&MorseWriter{tts}` 的指针而不是简单的 `MorseWriter{tts}` 值,因为 `MorseWriter` 太大,不适合接口变量。 + +与 Go 不同,Emgo 不会为存储在接口变量中的值动态分配内存。接口类型的大小受限制,相当于三个指针(适合 `slice` )或两个 `float64`(适合 `complex128`)的大小,以较大者为准。它可以直接存储所有基本类型和小型 “结构体/数组” 的值,但是对于较大的值,你必须使用指针。 + +让我们编译此代码并查看其输出: + +``` +$ egc +$ arm-none-eabi-size cortexm0.elf + text data bss dec hex filename + 15152 324 248 15724 3d6c cortexm0.elf +``` + +``` +Hello, World! +.... . .-.. .-.. --- --..-- .-- --- .-. .-.. -.. ---. +``` + +### 终极闪烁 + +Blinky 是等效于 “Hello,World!” 程序的硬件。一旦有了摩尔斯编码器,我们就可以轻松地将两者结合起来以获得终极闪烁程序: + +``` +package main + +import ( + "delay" + "io" + + "stm32/hal/gpio" + "stm32/hal/system" + "stm32/hal/system/timer/systick" +) + +var led gpio.Pin + +func init() { + system.SetupPLL(8, 1, 48/8) + systick.Setup(2e6) + + gpio.A.EnableClock(false) + led = gpio.A.Pin(4) + + cfg := gpio.Config{Mode: gpio.Out, Driver: gpio.OpenDrain, Speed: gpio.Low} + led.Setup(&cfg) +} + +type Telegraph struct { + Pin gpio.Pin + Dotms int // Dot length [ms] +} + +func (t Telegraph) Write(s []byte) (int, error) { + for _, c := range s { + switch c { + case '.': + t.Pin.Clear() + delay.Millisec(t.Dotms) + t.Pin.Set() + delay.Millisec(t.Dotms) + case '-': + t.Pin.Clear() + delay.Millisec(3 * t.Dotms) + t.Pin.Set() + delay.Millisec(t.Dotms) + case ' ': + delay.Millisec(3 * t.Dotms) + } + } + return len(s), nil +} + +func main() { + telegraph := &MorseWriter{Telegraph{led, 100}} + for { + io.WriteString(telegraph, "Hello, World! ") + } +} + +// Some code omitted... + +``` + +在上面的示例中,我省略了 `MorseWriter` 类型的定义,因为它已在前面展示过。完整版可通过 [这里][12] 获取。让我们编译它并运行: + +``` +$ egc +$ arm-none-eabi-size cortexm0.elf + text data bss dec hex filename + 11772 244 244 12260 2fe4 cortexm0.elf +``` + +![Ultimate Blinky](https://ziutek.github.io/images/mcu/f030-demo-board/morse.png) + +### 反射 + +是的,Emgo 支持 [反射][13]。`reflect` 包尚未完成,但是已完成的部分足以实现 `fmt.Print` 函数族了。来看看我们可以在小型 MCU 上做什么。 + +为了减少内存使用,我们将使用 [半主机][14]semihosting 作为标准输出。为了方便起见,我们还编写了简单的 `println` 函数,它在某种程度上类似于 `fmt.Println`。 + +``` +package main + +import ( + "debug/semihosting" + "reflect" + "strconv" + + "stm32/hal/system" + "stm32/hal/system/timer/systick" +) + +var stdout semihosting.File + +func init() { + system.SetupPLL(8, 1, 48/8) + systick.Setup(2e6) + + var err error + stdout, err = semihosting.OpenFile(":tt", semihosting.W) + for err != nil { + } +} + +type stringer interface { + String() string +} + +func println(args ...interface{}) { + for i, a := range args { + if i > 0 { + stdout.WriteString(" ") + } + switch v := a.(type) { + case string: + stdout.WriteString(v) + case int: + strconv.WriteInt(stdout, v, 10, 0, 0) + case bool: + strconv.WriteBool(stdout, v, 't', 0, 0) + case stringer: + stdout.WriteString(v.String()) + default: + stdout.WriteString("%unknown") + } + } + stdout.WriteString("\r\n") +} + +type S struct { + A int + B bool +} + +func main() { + p := &S{-123, true} + + v := reflect.ValueOf(p) + + println("kind(p) =", v.Kind()) + println("kind(*p) =", v.Elem().Kind()) + println("type(*p) =", v.Elem().Type()) + + v = v.Elem() + + println("*p = {") + for i := 0; i < v.NumField(); i++ { + ft := v.Type().Field(i) + fv := v.Field(i) + println(" ", ft.Name(), ":", fv.Interface()) + } + println("}") +} + +``` + +`semihosting.OpenFile` 函数允许在主机端打开/创建文件。特殊路径 `:tt` 对应于主机的标准输出。 + +`println` 函数接受任意数量的参数,每个参数的类型都是任意的: + +``` +func println(args ...interface{}) +``` + +可能是因为任何类型都实现了空接口 `interface{}`。 `println` 使用 [类型开关][15] 打印字符串,整数和布尔值: + +``` +switch v := a.(type) { +case string: + stdout.WriteString(v) +case int: + strconv.WriteInt(stdout, v, 10, 0, 0) +case bool: + strconv.WriteBool(stdout, v, 't', 0, 0) +case stringer: + stdout.WriteString(v.String()) +default: + stdout.WriteString("%unknown") +} +``` + +此外,它还支持任何实现了 `stringer` 接口的类型,即任何具有 `String()` 方法的类型。在任何 `case` 子句中,`v` 变量具有正确的类型,与 `case` 关键字后列出的类型相同。 + +`reflect.ValueOf(p)` 函数通过允许以编程的方式分析其类型和内容的形式返回 `p`。如你所见,我们甚至可以使用 `v.Elem()` 取消引用指针,并打印所有结构体及其名称。 + +让我们尝试编译这段代码。现在让我们看看如果编译时没有类型和字段名,会有什么结果: + +``` +$ egc -nt -nf +$ arm-none-eabi-size cortexm0.elf + text data bss dec hex filename + 16028 216 312 16556 40ac cortexm0.elf +``` + +闪存上只剩下 140 个可用字节。让我们使用启用了半主机的 OpenOCD 加载它: + +``` +$ openocd -d0 -f interface/stlink.cfg -f target/stm32f0x.cfg -c 'init; program cortexm0.elf; arm semihosting enable; reset run' +Open On-Chip Debugger 0.10.0+dev-00319-g8f1f912a (2018-03-07-19:20) +Licensed under GNU GPL v2 +For bug reports, read + http://openocd.org/doc/doxygen/bugs.html +debug_level: 0 +adapter speed: 1000 kHz +adapter_nsrst_delay: 100 +none separate +adapter speed: 950 kHz +target halted due to debug-request, current mode: Thread +xPSR: 0xc1000000 pc: 0x08002338 msp: 0x20000a20 +adapter speed: 4000 kHz +** Programming Started ** +auto erase enabled +target halted due to breakpoint, current mode: Thread +xPSR: 0x61000000 pc: 0x2000003a msp: 0x20000a20 +wrote 16384 bytes from file cortexm0.elf in 0.700133s (22.853 KiB/s) +** Programming Finished ** +semihosting is enabled +adapter speed: 950 kHz +kind(p) = ptr +kind(*p) = struct +type(*p) = +*p = { + X. : -123 + X. : true +} +``` + +如果你实际运行此代码,则会注意到半主机运行缓慢,尤其是在逐字节写入时(缓冲很有用)。 + +如你所见,`*p` 没有类型名称,并且所有结构字段都具有相同的 `X.` 名称。让我们再次编译该程序,这次不带 `-nt -nf` 选项: + +``` +$ egc +$ arm-none-eabi-size cortexm0.elf + text data bss dec hex filename + 16052 216 312 16580 40c4 cortexm0.elf +``` + +现在已经包括了类型和字段名称,但仅在 ~~_main.go_ 文件中~~ `main` 包中定义了它们。该程序的输出如下所示: + +``` +kind(p) = ptr +kind(*p) = struct +type(*p) = S +*p = { + A : -123 + B : true +} +``` + +反射是任何易于使用的序列化库的关键部分,而像 [JSON][16] 这样的序列化 ~~算法~~ 在物联网IoT时代也越来越重要。 + +这些就是我完成的本文的第二部分。我认为有机会进行第三部分,更具娱乐性的部分,在那里我们将各种有趣的设备连接到这块板上。如果这块板装不下,我们就换一块大一点的。 + +-------------------------------------------------------------------------------- + +via: https://ziutek.github.io/2018/04/14/go_on_very_small_hardware2.html + +作者:[Michał Derkacz][a] +译者:[gxlct008](https://github.com/gxlct008) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:https://ziutek.github.io/ +[1]:https://ziutek.github.io/2018/04/14/go_on_very_small_hardware2.html +[2]:https://linux.cn/article-11383-1.html +[3]:https://golang.org/doc/effective_go.html#interfaces +[4]:https://research.swtch.com/interfaces +[5]:https://blog.golang.org/laws-of-reflection +[6]:https://github.com/texane/stlink +[7]:http://www.world-semi.com/solution/list-4-1.html +[8]:https://en.wikipedia.org/wiki/1-Wire +[9]:https://github.com/npat-efault/picocom +[10]:https://github.com/ziutek/emgo/blob/master/egpath/src/stm32/examples/f030-demo-board/usart/main.go +[11]:https://github.com/ziutek/emgo/blob/master/egpath/src/stm32/examples/f030-demo-board/morseuart/main.go +[12]:https://github.com/ziutek/emgo/blob/master/egpath/src/stm32/examples/f030-demo-board/morseled/main.go +[13]:https://blog.golang.org/laws-of-reflection +[14]:http://infocenter.arm.com/help/topic/com.arm.doc.dui0471g/Bgbjjgij.html +[15]:https://golang.org/doc/effective_go.html#type_switch +[16]:https://en.wikipedia.org/wiki/JSON diff --git a/published/202010/20180710 Building a Messenger App- Messages.md b/published/202010/20180710 Building a Messenger App- Messages.md new file mode 100644 index 0000000000..2bd517bca5 --- /dev/null +++ b/published/202010/20180710 Building a Messenger App- Messages.md @@ -0,0 +1,315 @@ +[#]: collector: (lujun9972) +[#]: translator: (gxlct008) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12680-1.html) +[#]: subject: (Building a Messenger App: Messages) +[#]: via: (https://nicolasparada.netlify.com/posts/go-messenger-messages/) +[#]: author: (Nicolás Parada https://nicolasparada.netlify.com/) + +构建一个即时消息应用(四):消息 +====== + +![](https://img.linux.net.cn/data/attachment/album/202010/04/114458z1p1188epequ686p.jpg) + +本文是该系列的第四篇。 + + * [第一篇: 模式][1] + * [第二篇: OAuth][2] + * [第三篇: 对话][3] + +在这篇文章中,我们将对端点进行编码,以创建一条消息并列出它们,同时还将编写一个端点以更新参与者上次阅读消息的时间。 首先在 `main()` 函数中添加这些路由。 + +``` +router.HandleFunc("POST", "/api/conversations/:conversationID/messages", requireJSON(guard(createMessage))) +router.HandleFunc("GET", "/api/conversations/:conversationID/messages", guard(getMessages)) +router.HandleFunc("POST", "/api/conversations/:conversationID/read_messages", guard(readMessages)) +``` + +消息会进入对话,因此端点包含对话 ID。 + +### 创建消息 + +该端点处理对 `/api/conversations/{conversationID}/messages` 的 POST 请求,其 JSON 主体仅包含消息内容,并返回新创建的消息。它有两个副作用:更新对话 `last_message_id` 以及更新参与者 `messages_read_at`。 + +``` +func createMessage(w http.ResponseWriter, r *http.Request) { + var input struct { + Content string `json:"content"` + } + defer r.Body.Close() + if err := json.NewDecoder(r.Body).Decode(&input); err != nil { + http.Error(w, err.Error(), http.StatusBadRequest) + return + } + + errs := make(map[string]string) + input.Content = removeSpaces(input.Content) + if input.Content == "" { + errs["content"] = "Message content required" + } else if len([]rune(input.Content)) > 480 { + errs["content"] = "Message too long. 480 max" + } + if len(errs) != 0 { + respond(w, Errors{errs}, http.StatusUnprocessableEntity) + return + } + + ctx := r.Context() + authUserID := ctx.Value(keyAuthUserID).(string) + conversationID := way.Param(ctx, "conversationID") + + tx, err := db.BeginTx(ctx, nil) + if err != nil { + respondError(w, fmt.Errorf("could not begin tx: %v", err)) + return + } + defer tx.Rollback() + + isParticipant, err := queryParticipantExistance(ctx, tx, authUserID, conversationID) + if err != nil { + respondError(w, fmt.Errorf("could not query participant existance: %v", err)) + return + } + + if !isParticipant { + http.Error(w, "Conversation not found", http.StatusNotFound) + return + } + + var message Message + if err := tx.QueryRowContext(ctx, ` + INSERT INTO messages (content, user_id, conversation_id) VALUES + ($1, $2, $3) + RETURNING id, created_at + `, input.Content, authUserID, conversationID).Scan( + &message.ID, + &message.CreatedAt, + ); err != nil { + respondError(w, fmt.Errorf("could not insert message: %v", err)) + return + } + + if _, err := tx.ExecContext(ctx, ` + UPDATE conversations SET last_message_id = $1 + WHERE id = $2 + `, message.ID, conversationID); err != nil { + respondError(w, fmt.Errorf("could not update conversation last message ID: %v", err)) + return + } + + if err = tx.Commit(); err != nil { + respondError(w, fmt.Errorf("could not commit tx to create a message: %v", err)) + return + } + + go func() { + if err = updateMessagesReadAt(nil, authUserID, conversationID); err != nil { + log.Printf("could not update messages read at: %v\n", err) + } + }() + + message.Content = input.Content + message.UserID = authUserID + message.ConversationID = conversationID + // TODO: notify about new message. + message.Mine = true + + respond(w, message, http.StatusCreated) +} +``` + +首先,它将请求正文解码为包含消息内容的结构。然后,它验证内容不为空并且少于 480 个字符。 + +``` +var rxSpaces = regexp.MustCompile("\\s+") + +func removeSpaces(s string) string { + if s == "" { + return s + } + + lines := make([]string, 0) + for _, line := range strings.Split(s, "\n") { + line = rxSpaces.ReplaceAllLiteralString(line, " ") + line = strings.TrimSpace(line) + if line != "" { + lines = append(lines, line) + } + } + return strings.Join(lines, "\n") +} +``` + +这是删除空格的函数。它遍历每一行,删除两个以上的连续空格,然后回非空行。 + +验证之后,它将启动一个 SQL 事务。首先,它查询对话中的参与者是否存在。 + +``` +func queryParticipantExistance(ctx context.Context, tx *sql.Tx, userID, conversationID string) (bool, error) { + if ctx == nil { + ctx = context.Background() + } + var exists bool + if err := tx.QueryRowContext(ctx, `SELECT EXISTS ( + SELECT 1 FROM participants + WHERE user_id = $1 AND conversation_id = $2 + )`, userID, conversationID).Scan(&exists); err != nil { + return false, err + } + return exists, nil +} +``` + +我将其提取到一个函数中,因为稍后可以重用。 + +如果用户不是对话参与者,我们将返回一个 `404 NOT Found` 错误。 + +然后,它插入消息并更新对话 `last_message_id`。从这时起,由于我们不允许删除消息,因此 `last_message_id` 不能为 `NULL`。 + +接下来提交事务,并在 goroutine 中更新参与者 `messages_read_at`。 + +``` +func updateMessagesReadAt(ctx context.Context, userID, conversationID string) error { + if ctx == nil { + ctx = context.Background() + } + + if _, err := db.ExecContext(ctx, ` + UPDATE participants SET messages_read_at = now() + WHERE user_id = $1 AND conversation_id = $2 + `, userID, conversationID); err != nil { + return err + } + return nil +} +``` + +在回复这条新消息之前,我们必须通知一下。这是我们将要在下一篇文章中编写的实时部分,因此我在那里留一了个注释。 + +### 获取消息 + +这个端点处理对 `/api/conversations/{conversationID}/messages` 的 GET 请求。 它用一个包含会话中所有消息的 JSON 数组进行响应。它还具有更新参与者 `messages_read_at` 的副作用。 + +``` +func getMessages(w http.ResponseWriter, r *http.Request) { + ctx := r.Context() + authUserID := ctx.Value(keyAuthUserID).(string) + conversationID := way.Param(ctx, "conversationID") + + tx, err := db.BeginTx(ctx, &sql.TxOptions{ReadOnly: true}) + if err != nil { + respondError(w, fmt.Errorf("could not begin tx: %v", err)) + return + } + defer tx.Rollback() + + isParticipant, err := queryParticipantExistance(ctx, tx, authUserID, conversationID) + if err != nil { + respondError(w, fmt.Errorf("could not query participant existance: %v", err)) + return + } + + if !isParticipant { + http.Error(w, "Conversation not found", http.StatusNotFound) + return + } + + rows, err := tx.QueryContext(ctx, ` + SELECT + id, + content, + created_at, + user_id = $1 AS mine + FROM messages + WHERE messages.conversation_id = $2 + ORDER BY messages.created_at DESC + `, authUserID, conversationID) + if err != nil { + respondError(w, fmt.Errorf("could not query messages: %v", err)) + return + } + defer rows.Close() + + messages := make([]Message, 0) + for rows.Next() { + var message Message + if err = rows.Scan( + &message.ID, + &message.Content, + &message.CreatedAt, + &message.Mine, + ); err != nil { + respondError(w, fmt.Errorf("could not scan message: %v", err)) + return + } + + messages = append(messages, message) + } + + if err = rows.Err(); err != nil { + respondError(w, fmt.Errorf("could not iterate over messages: %v", err)) + return + } + + if err = tx.Commit(); err != nil { + respondError(w, fmt.Errorf("could not commit tx to get messages: %v", err)) + return + } + + go func() { + if err = updateMessagesReadAt(nil, authUserID, conversationID); err != nil { + log.Printf("could not update messages read at: %v\n", err) + } + }() + + respond(w, messages, http.StatusOK) +} +``` + +首先,它以只读模式开始一个 SQL 事务。检查参与者是否存在,并查询所有消息。在每条消息中,我们使用当前经过身份验证的用户 ID 来了解用户是否拥有该消息(`mine`)。 然后,它提交事务,在 goroutine 中更新参与者 `messages_read_at` 并以消息响应。 + +### 读取消息 + +该端点处理对 `/api/conversations/{conversationID}/read_messages` 的 POST 请求。 没有任何请求或响应主体。 在前端,每次有新消息到达实时流时,我们都会发出此请求。 + +``` +func readMessages(w http.ResponseWriter, r *http.Request) { + ctx := r.Context() + authUserID := ctx.Value(keyAuthUserID).(string) + conversationID := way.Param(ctx, "conversationID") + + if err := updateMessagesReadAt(ctx, authUserID, conversationID); err != nil { + respondError(w, fmt.Errorf("could not update messages read at: %v", err)) + return + } + + w.WriteHeader(http.StatusNoContent) +} +``` + +它使用了与更新参与者 `messages_read_at` 相同的函数。 + +* * * + +到此为止。实时消息是后台仅剩的部分了。请等待下一篇文章。 + +- [源代码][4] + +-------------------------------------------------------------------------------- + +via: https://nicolasparada.netlify.com/posts/go-messenger-messages/ + +作者:[Nicolás Parada][a] +选题:[lujun9972][b] +译者:[gxlct008](https://github.com/gxlct008) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://nicolasparada.netlify.com/ +[b]: https://github.com/lujun9972 +[1]: https://linux.cn/article-11396-1.html +[2]: https://linux.cn/article-11510-1.html +[3]: https://linux.cn/article-12056-1.html +[4]: https://github.com/nicolasparada/go-messenger-demo diff --git a/published/202010/20180710 Building a Messenger App- Realtime Messages.md b/published/202010/20180710 Building a Messenger App- Realtime Messages.md new file mode 100644 index 0000000000..3d70445693 --- /dev/null +++ b/published/202010/20180710 Building a Messenger App- Realtime Messages.md @@ -0,0 +1,175 @@ +[#]: collector: (lujun9972) +[#]: translator: (gxlct008) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12685-1.html) +[#]: subject: (Building a Messenger App: Realtime Messages) +[#]: via: (https://nicolasparada.netlify.com/posts/go-messenger-realtime-messages/) +[#]: author: (Nicolás Parada https://nicolasparada.netlify.com/) + +构建一个即时消息应用(五):实时消息 +====== + +![](https://img.linux.net.cn/data/attachment/album/202010/05/091113edbuavorm89looja.jpg) + +本文是该系列的第五篇。 + + * [第一篇: 模式][1] + * [第二篇: OAuth][2] + * [第三篇: 对话][3] + * [第四篇: 消息][4] + +对于实时消息,我们将使用 [服务器发送事件][5]Server-Sent Events。这是一个打开的连接,我们可以在其中传输数据流。我们会有个端点,用户会在其中订阅发送给他的所有消息。 + +### 消息户端 + +在 HTTP 部分之前,让我们先编写一个映射map ,让所有客户端都监听消息。 像这样全局初始化: + +```go +type MessageClient struct { + Messages chan Message + UserID string +} + +var messageClients sync.Map +``` + +### 已创建的新消息 + +还记得在 [上一篇文章][4] 中,当我们创建这条消息时,我们留下了一个 “TODO” 注释。在那里,我们将使用这个函数来调度一个 goroutine。 + +```go +go messageCreated(message) +``` + +把这行代码插入到我们留注释的位置。 + +```go +func messageCreated(message Message) error { + if err := db.QueryRow(` + SELECT user_id FROM participants + WHERE user_id != $1 and conversation_id = $2 + `, message.UserID, message.ConversationID). + Scan(&message.ReceiverID); err != nil { + return err + } + + go broadcastMessage(message) + + return nil +} + +func broadcastMessage(message Message) { + messageClients.Range(func(key, _ interface{}) bool { + client := key.(*MessageClient) + if client.UserID == message.ReceiverID { + client.Messages <- message + } + return true + }) +} +``` + +该函数查询接收者 ID(其他参与者 ID),并将消息发送给所有客户端。 + +### 订阅消息 + +让我们转到 `main()` 函数并添加以下路由: + +```go +router.HandleFunc("GET", "/api/messages", guard(subscribeToMessages)) +``` + +此端点处理 `/api/messages` 上的 GET 请求。请求应该是一个 [EventSource][6] 连接。它用一个事件流响应,其中的数据是 JSON 格式的。 + +```go +func subscribeToMessages(w http.ResponseWriter, r *http.Request) { + if a := r.Header.Get("Accept"); !strings.Contains(a, "text/event-stream") { + http.Error(w, "This endpoint requires an EventSource connection", http.StatusNotAcceptable) + return + } + + f, ok := w.(http.Flusher) + if !ok { + respondError(w, errors.New("streaming unsupported")) + return + } + + ctx := r.Context() + authUserID := ctx.Value(keyAuthUserID).(string) + + h := w.Header() + h.Set("Cache-Control", "no-cache") + h.Set("Connection", "keep-alive") + h.Set("Content-Type", "text/event-stream") + + messages := make(chan Message) + defer close(messages) + + client := &MessageClient{Messages: messages, UserID: authUserID} + messageClients.Store(client, nil) + defer messageClients.Delete(client) + + for { + select { + case <-ctx.Done(): + return + case message := <-messages: + if b, err := json.Marshal(message); err != nil { + log.Printf("could not marshall message: %v\n", err) + fmt.Fprintf(w, "event: error\ndata: %v\n\n", err) + } else { + fmt.Fprintf(w, "data: %s\n\n", b) + } + f.Flush() + } + } +} +``` + +首先,它检查请求头是否正确,并检查服务器是否支持流式传输。我们创建一个消息通道,用它来构建一个客户端,并将其存储在客户端映射中。每当创建新消息时,它都会进入这个通道,因此我们可以通过 `for-select` 循环从中读取。 + +服务器发送事件Server-Sent Events使用以下格式发送数据: + +```go +data: some data here\n\n +``` + +我们以 JSON 格式发送: + +```json +data: {"foo":"bar"}\n\n +``` + +我们使用 `fmt.Fprintf()` 以这种格式写入响应写入器writter,并在循环的每次迭代中刷新数据。 + +这个循环会一直运行,直到使用请求上下文关闭连接为止。我们延迟了通道的关闭和客户端的删除,因此,当循环结束时,通道将被关闭,客户端不会收到更多的消息。 + +注意,服务器发送事件Server-Sent Events(EventSource)的 JavaScript API 不支持设置自定义请求头😒,所以我们不能设置 `Authorization: Bearer `。这就是为什么 `guard()` 中间件也会从 URL 查询字符串中读取令牌的原因。 + +* * * + +实时消息部分到此结束。我想说的是,这就是后端的全部内容。但是为了编写前端代码,我将再增加一个登录端点:一个仅用于开发的登录。 + +- [源代码][7] + +-------------------------------------------------------------------------------- + +via: https://nicolasparada.netlify.com/posts/go-messenger-realtime-messages/ + +作者:[Nicolás Parada][a] +选题:[lujun9972][b] +译者:[gxlct008](https://github.com/gxlct008) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://nicolasparada.netlify.com/ +[b]: https://github.com/lujun9972 +[1]: https://linux.cn/article-11396-1.html +[2]: https://linux.cn/article-11510-1.html +[3]: https://linux.cn/article-12056-1.html +[4]: https://linux.cn/article-12680-1.html +[5]: https://developer.mozilla.org/en-US/docs/Web/API/Server-sent_events +[6]: https://developer.mozilla.org/en-US/docs/Web/API/EventSource +[7]: https://github.com/nicolasparada/go-messenger-demo diff --git a/sources/tech/20180712 Building a Messenger App- Development Login.md b/published/202010/20180712 Building a Messenger App- Development Login.md similarity index 53% rename from sources/tech/20180712 Building a Messenger App- Development Login.md rename to published/202010/20180712 Building a Messenger App- Development Login.md index e12fb3c56a..9a4654f57d 100644 --- a/sources/tech/20180712 Building a Messenger App- Development Login.md +++ b/published/202010/20180712 Building a Messenger App- Development Login.md @@ -1,38 +1,38 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: translator: (gxlct008) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12692-1.html) [#]: subject: (Building a Messenger App: Development Login) [#]: via: (https://nicolasparada.netlify.com/posts/go-messenger-dev-login/) [#]: author: (Nicolás Parada https://nicolasparada.netlify.com/) -Building a Messenger App: Development Login +构建一个即时消息应用(六):仅用于开发的登录 ====== -This post is the 6th on a series: +![](https://img.linux.net.cn/data/attachment/album/202010/07/101437garmhgi9aza9f9fz.jpg) - * [Part 1: Schema][1] - * [Part 2: OAuth][2] - * [Part 3: Conversations][3] - * [Part 4: Messages][4] - * [Part 5: Realtime Messages][5] +本文是该系列的第六篇。 + * [第一篇: 模式][1] + * [第二篇: OAuth][2] + * [第三篇: 对话][3] + * [第四篇: 消息][4] + * [第五篇: 实时消息][5] +我们已经实现了通过 GitHub 登录,但是如果想把玩一下这个 app,我们需要几个用户来测试它。在这篇文章中,我们将添加一个为任何用户提供登录的端点,只需提供用户名即可。该端点仅用于开发。 -We already implemented login through GitHub, but if we want to play around with the app, we need a couple of users to test it. In this post we’ll add an endpoint to login as any user just giving an username. This endpoint will be just for development. +首先在 `main()` 函数中添加此路由。 -Start by adding this route in the `main()` function. - -``` +```go router.HandleFunc("POST", "/api/login", requireJSON(login)) ``` -### Login +### 登录 -This function handles POST requests to `/api/login` with a JSON body with just an username and returns the authenticated user, a token and expiration date of it in JSON format. +此函数处理对 `/api/login` 的 POST 请求,其中 JSON body 只包含用户名,并以 JSON 格式返回通过认证的用户、令牌和过期日期。 -``` +```go func login(w http.ResponseWriter, r *http.Request) { if origin.Hostname() != "localhost" { http.NotFound(w, r) @@ -81,9 +81,9 @@ func login(w http.ResponseWriter, r *http.Request) { } ``` -First it checks we are on localhost or it responds with `404 Not Found`. It decodes the body skipping validation since this is just for development. Then it queries to the database for a user with the given username, if none is found, it returns with `404 Not Found`. Then it issues a new JSON web token using the user ID as Subject. +首先,它检查我们是否在本地主机上,或者响应为 `404 Not Found`。它解码主体跳过验证,因为这只是为了开发。然后在数据库中查询给定用户名的用户,如果没有,则返回 `404 NOT Found`。然后,它使用用户 ID 作为主题发布一个新的 JSON Web 令牌。 -``` +```go func issueToken(subject string, exp time.Time) (string, error) { token, err := jwtSigner.Encode(jwt.Claims{ Subject: subject, @@ -96,33 +96,33 @@ func issueToken(subject string, exp time.Time) (string, error) { } ``` -The function does the same we did [previously][2]. I just moved it to reuse code. +该函数执行的操作与 [前文][2] 相同。我只是将其移过来以重用代码。 -After creating the token, it responds with the user, token and expiration date. +创建令牌后,它将使用用户、令牌和到期日期进行响应。 -### Seed Users +### 种子用户 -Now you can add users to play with to the database. +现在,你可以将要操作的用户添加到数据库中。 -``` +```sql INSERT INTO users (id, username) VALUES (1, 'john'), (2, 'jane'); ``` -You can save it to a file and pipe it to the Cockroach CLI. +你可以将其保存到文件中,并通过管道将其传送到 Cockroach CLI。 -``` +```bash cat seed_users.sql | cockroach sql --insecure -d messenger ``` * * * -That’s it. Once you deploy the code to production and use your own domain this login function won’t be available. +就是这样。一旦将代码部署到生产环境并使用自己的域后,该登录功能将不可用。 -This post concludes the backend. +本文也结束了所有的后端开发部分。 -[Souce Code][6] +- [源代码][6] -------------------------------------------------------------------------------- @@ -130,16 +130,16 @@ via: https://nicolasparada.netlify.com/posts/go-messenger-dev-login/ 作者:[Nicolás Parada][a] 选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) +译者:[gxlct008](https://github.com/gxlct008) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 [a]: https://nicolasparada.netlify.com/ [b]: https://github.com/lujun9972 -[1]: https://nicolasparada.netlify.com/posts/go-messenger-schema/ -[2]: https://nicolasparada.netlify.com/posts/go-messenger-oauth/ -[3]: https://nicolasparada.netlify.com/posts/go-messenger-conversations/ -[4]: https://nicolasparada.netlify.com/posts/go-messenger-messages/ -[5]: https://nicolasparada.netlify.com/posts/go-messenger-realtime-messages/ +[1]: https://linux.cn/article-11396-1.html +[2]: https://linux.cn/article-11510-1.html +[3]: https://linux.cn/article-12056-1.html +[4]: https://linux.cn/article-12680-1.html +[5]: https://linux.cn/article-12685-1.html [6]: https://github.com/nicolasparada/go-messenger-demo diff --git a/sources/tech/20180716 Building a Messenger App- Access Page.md b/published/202010/20180716 Building a Messenger App- Access Page.md similarity index 63% rename from sources/tech/20180716 Building a Messenger App- Access Page.md rename to published/202010/20180716 Building a Messenger App- Access Page.md index 21671b92f6..b35c83efdc 100644 --- a/sources/tech/20180716 Building a Messenger App- Access Page.md +++ b/published/202010/20180716 Building a Messenger App- Access Page.md @@ -1,31 +1,31 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: translator: (gxlct008) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12704-1.html) [#]: subject: (Building a Messenger App: Access Page) [#]: via: (https://nicolasparada.netlify.com/posts/go-messenger-access-page/) [#]: author: (Nicolás Parada https://nicolasparada.netlify.com/) -Building a Messenger App: Access Page +构建一个即时消息应用(七):Access 页面 ====== -This post is the 7th on a series: +![](https://img.linux.net.cn/data/attachment/album/202010/10/101345zj7gfybyee2g9x9e.jpg) - * [Part 1: Schema][1] - * [Part 2: OAuth][2] - * [Part 3: Conversations][3] - * [Part 4: Messages][4] - * [Part 5: Realtime Messages][5] - * [Part 6: Development Login][6] +本文是该系列的第七篇。 + * [第一篇: 模式][1] + * [第二篇: OAuth][2] + * [第三篇: 对话][3] + * [第四篇: 消息][4] + * [第五篇: 实时消息][5] + * [第六篇: 仅用于开发的登录][6] +现在我们已经完成了后端,让我们转到前端。 我将采用单页应用程序方案。 -Now that we’re done with the backend, lets move to the frontend. I will go with a single-page application. +首先,我们创建一个 `static/index.html` 文件,内容如下。 -Lets start by creating a file `static/index.html` with the following content. - -``` +```html @@ -40,11 +40,11 @@ Lets start by creating a file `static/index.html` with the following content. ``` -This HTML file must be server for every URL and JavaScript will take care of rendering the correct page. +这个 HTML 文件必须为每个 URL 提供服务,并且使用 JavaScript 负责呈现正确的页面。 -So lets go the the `main.go` for a moment and in the `main()` function add the following route: +因此,让我们将注意力转到 `main.go` 片刻,然后在 `main()` 函数中添加以下路由: -``` +```go router.Handle("GET", "/...", http.FileServer(SPAFileSystem{http.Dir("static")})) type SPAFileSystem struct { @@ -60,15 +60,15 @@ func (spa SPAFileSystem) Open(name string) (http.File, error) { } ``` -We use a custom file system so instead of returning `404 Not Found` for unknown URLs, it serves the `index.html`. +我们使用一个自定义的文件系统,因此它不是为未知的 URL 返回 `404 Not Found`,而是转到 `index.html`。 -### Router +### 路由器 -In the `index.html` we loaded two files: `styles.css` and `main.js`. I leave styling to your taste. +在 `index.html` 中我们加载了两个文件:`styles.css` 和 `main.js`。我把样式留给你自由发挥。 -Lets move to `main.js`. Create a `static/main.js` file with the following content: +让我们移动到 `main.js`。 创建一个包含以下内容的 `static/main.js` 文件: -``` +```javascript import { guard } from './auth.js' import Router from './router.js' @@ -98,19 +98,19 @@ function view(pageName) { } ``` -If you are follower of this blog, you already know how this works. That router is the one showed [here][7]. Just download it from [@nicolasparada/router][8] and save it to `static/router.js`. +如果你是这个博客的关注者,你已经知道它是如何工作的了。 该路由器就是在 [这里][7] 显示的那个。 只需从 [@nicolasparada/router][8] 下载并保存到 `static/router.js` 即可。 -We registered four routes. At the root `/` we show the home or access page whether the user is authenticated. At `/callback` we show the callback page. On `/conversations/{conversationID}` we show the conversation or access page whether the user is authenticated and for every other URL, we show a not found page. +我们注册了四条路由。 在根路由 `/` 处,我们展示 `home` 或 `access` 页面,无论用户是否通过身份验证。 在 `/callback` 中,我们展示 `callback` 页面。 在 `/conversations/{conversationID}` 上,我们展示对话或 `access` 页面,无论用户是否通过验证,对于其他 URL,我们展示一个 `not-found` 页面。 -We tell the router to render the result to the document body and dispatch a `disconnect` event to each page before leaving. +我们告诉路由器将结果渲染为文档主体,并在离开之前向每个页面调度一个 `disconnect` 事件。 -We have each page in a different file and we import them with the new dynamic `import()`. +我们将每个页面放在不同的文件中,并使用新的动态 `import()` 函数导入它们。 -### Auth +### 身份验证 -`guard()` is a function that given two functions, executes the first one if the user is authenticated, or the sencond one if not. It comes from `auth.js` so lets create a `static/auth.js` file with the following content: +`guard()` 是一个函数,给它两个函数作为参数,如果用户通过了身份验证,则执行第一个函数,否则执行第二个。它来自 `auth.js`,所以我们创建一个包含以下内容的 `static/auth.js` 文件: -``` +```javascript export function isAuthenticated() { const token = localStorage.getItem('token') const expiresAtItem = localStorage.getItem('expires_at') @@ -150,17 +150,17 @@ export function getAuthUser() { } ``` -`isAuthenticated()` checks for `token` and `expires_at` from localStorage to tell if the user is authenticated. `getAuthUser()` gets the authenticated user from localStorage. +`isAuthenticated()` 检查 `localStorage` 中的 `token` 和 `expires_at`,以判断用户是否已通过身份验证。`getAuthUser()` 从 `localStorage` 中获取经过身份验证的用户。 -When we login, we’ll save all the data to localStorage so it will make sense. +当我们登录时,我们会将所有的数据保存到 `localStorage`,这样才有意义。 -### Access Page +### Access 页面 ![access page screenshot][9] -Lets start with the access page. Create a file `static/pages/access-page.js` with the following content: +让我们从 `access` 页面开始。 创建一个包含以下内容的文件 `static/pages/access-page.js`: -``` +```javascript const template = document.createElement('template') template.innerHTML = `

    Messenger

    @@ -172,15 +172,15 @@ export default function accessPage() { } ``` -Because the router intercepts all the link clicks to do its navigation, we must prevent the event propagation for this link in particular. +因为路由器会拦截所有链接点击来进行导航,所以我们必须特别阻止此链接的事件传播。 -Clicking on that link will redirect us to the backend, then to GitHub, then to the backend and then to the frontend again; to the callback page. +单击该链接会将我们重定向到后端,然后重定向到 GitHub,再重定向到后端,然后再次重定向到前端; 到 `callback` 页面。 -### Callback Page +### Callback 页面 -Create the file `static/pages/callback-page.js` with the following content: +创建包括以下内容的 `static/pages/callback-page.js` 文件: -``` +```javascript import http from '../http.js' import { navigate } from '../router.js' @@ -211,13 +211,13 @@ function getAuthUser(token) { } ``` -The callback page doesn’t render anything. It’s an async function that does a GET request to `/api/auth_user` using the token from the URL query string and saves all the data to localStorage. Then it redirects to `/`. +`callback` 页面不呈现任何内容。这是一个异步函数,它使用 URL 查询字符串中的 token 向 `/api/auth_user` 发出 GET 请求,并将所有数据保存到 `localStorage`。 然后重定向到 `/`。 ### HTTP -There is an HTTP module. Create a `static/http.js` file with the following content: +这里是一个 HTTP 模块。 创建一个包含以下内容的 `static/http.js` 文件: -``` +```javascript import { isAuthenticated } from './auth.js' async function handleResponse(res) { @@ -297,15 +297,15 @@ export default { } ``` -This module is a wrapper around the [fetch][10] and [EventSource][11] APIs. The most important part is that it adds the JSON web token to the requests. +这个模块是 [fetch][10] 和 [EventSource][11] API 的包装器。最重要的部分是它将 JSON web 令牌添加到请求中。 -### Home Page +### Home 页面 ![home page screenshot][12] -So, when the user login, the home page will be shown. Create a `static/pages/home-page.js` file with the following content: +因此,当用户登录时,将显示 `home` 页。 创建一个具有以下内容的 `static/pages/home-page.js` 文件: -``` +```javascript import { getAuthUser } from '../auth.js' import { avatar } from '../shared.js' @@ -334,15 +334,15 @@ function onLogoutClick() { } ``` -For this post, this is the only content we render on the home page. We show the current authenticated user and a logout button. +对于这篇文章,这是我们在 `home` 页上呈现的唯一内容。我们显示当前经过身份验证的用户和注销按钮。 -When the user clicks to logout, we clear all inside localStorage and do a reload of the page. +当用户单击注销时,我们清除 `localStorage` 中的所有内容并重新加载页面。 ### Avatar -That `avatar()` function is to show the user’s avatar. Because it’s used in more than one place, I moved it to a `shared.js` file. Create the file `static/shared.js` with the following content: +那个 `avatar()` 函数用于显示用户的头像。 由于已在多个地方使用,因此我将它移到 `shared.js` 文件中。 创建具有以下内容的文件 `static/shared.js`: -``` +```javascript export function avatar(user) { return user.avatarUrl === null ? `
    ` @@ -350,23 +350,23 @@ export function avatar(user) { } ``` -We use a small figure with the user’s initial in case the avatar URL is null. +如果头像网址为 `null`,我们将使用用户的姓名首字母作为初始头像。 -You can show the initial with a little of CSS using the `attr()` function. +你可以使用 `attr()` 函数显示带有少量 CSS 样式的首字母。 -``` +```css .avatar[data-initial]::after { content: attr(data-initial); } ``` -### Development Login +### 仅开发使用的登录 ![access page with login form screenshot][13] -In the previous post we coded a login for development. Lets add a form for that in the access page. Go to `static/pages/access-page.js` and modify it a little. +在上一篇文章中,我们为编写了一个登录代码。让我们在 `access` 页面中为此添加一个表单。 进入 `static/ages/access-page.js`,稍微修改一下。 -``` +```javascript import http from '../http.js' const template = document.createElement('template') @@ -420,15 +420,15 @@ function login(username) { } ``` -I added a login form. When the user submits the form. It does a POST requets to `/api/login` with the username. Saves all the data to localStorage and reloads the page. +我添加了一个登录表单。当用户提交表单时。它使用用户名对 `/api/login` 进行 POST 请求。将所有数据保存到 `localStorage` 并重新加载页面。 -Remember to remove this form once you are done with the frontend. +记住在前端完成后删除此表单。 * * * -That’s all for this post. In the next one, we’ll continue with the home page to add a form to start conversations and display a list with the latest ones. +这就是这篇文章的全部内容。在下一篇文章中,我们将继续使用主页添加一个表单来开始对话,并显示包含最新对话的列表。 -[Souce Code][14] +- [源代码][14] -------------------------------------------------------------------------------- @@ -436,19 +436,19 @@ via: https://nicolasparada.netlify.com/posts/go-messenger-access-page/ 作者:[Nicolás Parada][a] 选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) +译者:[gxlct008](https://github.com/gxlct008) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 [a]: https://nicolasparada.netlify.com/ [b]: https://github.com/lujun9972 -[1]: https://nicolasparada.netlify.com/posts/go-messenger-schema/ -[2]: https://nicolasparada.netlify.com/posts/go-messenger-oauth/ -[3]: https://nicolasparada.netlify.com/posts/go-messenger-conversations/ -[4]: https://nicolasparada.netlify.com/posts/go-messenger-messages/ -[5]: https://nicolasparada.netlify.com/posts/go-messenger-realtime-messages/ -[6]: https://nicolasparada.netlify.com/posts/go-messenger-dev-login/ +[1]: https://linux.cn/article-11396-1.html +[2]: https://linux.cn/article-11510-1.html +[3]: https://linux.cn/article-12056-1.html +[4]: https://linux.cn/article-12680-1.html +[5]: https://linux.cn/article-12685-1.html +[6]: https://linux.cn/article-12692-1.html [7]: https://nicolasparada.netlify.com/posts/js-router/ [8]: https://unpkg.com/@nicolasparada/router [9]: https://nicolasparada.netlify.com/img/go-messenger-access-page/access-page.png diff --git a/sources/tech/20180719 Building a Messenger App- Home Page.md b/published/202010/20180719 Building a Messenger App- Home Page.md similarity index 58% rename from sources/tech/20180719 Building a Messenger App- Home Page.md rename to published/202010/20180719 Building a Messenger App- Home Page.md index ddec2c180f..741206a4a7 100644 --- a/sources/tech/20180719 Building a Messenger App- Home Page.md +++ b/published/202010/20180719 Building a Messenger App- Home Page.md @@ -1,50 +1,50 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: translator: (gxlct008) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12722-1.html) [#]: subject: (Building a Messenger App: Home Page) [#]: via: (https://nicolasparada.netlify.com/posts/go-messenger-home-page/) [#]: author: (Nicolás Parada https://nicolasparada.netlify.com/) -Building a Messenger App: Home Page +构建一个即时消息应用(八):Home 页面 ====== -This post is the 8th on a series: +![](https://img.linux.net.cn/data/attachment/album/202010/15/213116evlwzdwwv66kmldj.jpg) - * [Part 1: Schema][1] - * [Part 2: OAuth][2] - * [Part 3: Conversations][3] - * [Part 4: Messages][4] - * [Part 5: Realtime Messages][5] - * [Part 6: Development Login][6] - * [Part 7: Access Page][7] +本文是该系列的第八篇。 + * [第一篇: 模式][1] + * [第二篇: OAuth][2] + * [第三篇: 对话][3] + * [第四篇: 消息][4] + * [第五篇: 实时消息][5] + * [第六篇: 仅用于开发的登录][6] + * [第七篇: Access 页面][7] +继续前端部分,让我们在本文中完成 `home` 页面的开发。 我们将添加一个开始对话的表单和一个包含最新对话的列表。 -Continuing the frontend, let’s finish the home page in this post. We’ll add a form to start conversations and a list with the latest ones. - -### Conversation Form +### 对话表单 ![conversation form screenshot][8] -In the `static/pages/home-page.js` file add some markup in the HTML view. +转到 `static/ages/home-page.js` 文件,在 HTML 视图中添加一些标记。 -``` +```html
    ``` -Add that form just below the section in which we displayed the auth user and logout button. +将该表单添加到我们显示 “auth user” 和 “logout” 按钮部分的下方。 -``` +```js page.getElementById('conversation-form').onsubmit = onConversationSubmit ``` -Now we can listen to the “submit” event to create the conversation. +现在我们可以监听 “submit” 事件来创建对话了。 -``` +```js import http from '../http.js' import { navigate } from '../router.js' @@ -79,15 +79,15 @@ function createConversation(username) { } ``` -On submit we do a POST request to `/api/conversations` with the username and redirect to the conversation page (for the next post). +在提交时,我们使用用户名对 `/api/conversations` 进行 POST 请求,并重定向到 `conversation` 页面(用于下一篇文章)。 -### Conversation List +### 对话列表 ![conversation list screenshot][9] -In the same file, we are going to make the `homePage()` function async to load the conversations first. +还是在这个文件中,我们将创建 `homePage()` 函数用来先异步加载对话。 -``` +```js export default async function homePage() { const conversations = await getConversations().catch(err => { console.error(err) @@ -101,24 +101,24 @@ function getConversations() { } ``` -Then, add a list in the markup to render conversations there. +然后,在标记中添加一个列表来渲染对话。 -``` +```html
      ``` -Add it just below the current markup. +将其添加到当前标记的正下方。 -``` +```js const conversationsOList = page.getElementById('conversations') for (const conversation of conversations) { conversationsOList.appendChild(renderConversation(conversation)) } ``` -So we can append each conversation to the list. +因此,我们可以将每个对话添加到这个列表中。 -``` +```js import { avatar, escapeHTML } from '../shared.js' function renderConversation(conversation) { @@ -146,11 +146,11 @@ function renderConversation(conversation) { } ``` -Each conversation item contains a link to the conversation page and displays the other participant info and a preview of the last message. Also, you can use `.hasUnreadMessages` to add a class to the item and do some styling with CSS. Maybe a bolder font or accent the color. +每个对话条目都包含一个指向对话页面的链接,并显示其他参与者信息和最后一条消息的预览。另外,您可以使用 `.hasUnreadMessages` 向该条目添加一个类,并使用 CSS 进行一些样式设置。也许是粗体字体或强调颜色。 -Note that we’re escaping the message content. That function comes from `static/shared.js`: +请注意,我们需要转义信息的内容。该函数来自于 `static/shared.js` 文件: -``` +```js export function escapeHTML(str) { return str .replace(/&/g, '&') @@ -161,35 +161,34 @@ export function escapeHTML(str) { } ``` -That prevents displaying as HTML the message the user wrote. If the user happens to write something like: +这会阻止将用户编写的消息显示为 HTML。如果用户碰巧编写了类似以下内容的代码: -``` +```js ``` -It would be very annoying because that script will be executed 😅 -So yeah, always remember to escape content from untrusted sources. +这将非常烦人,因为该脚本将被执行😅。所以,永远记住要转义来自不可信来源的内容。 -### Messages Subscription +### 消息订阅 -Last but not least, I want to subscribe to the message stream here. +最后但并非最不重要的一点,我想在这里订阅消息流。 -``` +```js const unsubscribe = subscribeToMessages(onMessageArrive) page.addEventListener('disconnect', unsubscribe) ``` -Add that line in the `homePage()` function. +在 `homePage()` 函数中添加这一行。 -``` +```js function subscribeToMessages(cb) { return http.subscribe('/api/messages', cb) } ``` -The `subscribe()` function returns a function that once called it closes the underlying connection. That’s why I passed it to the “disconnect” event; so when the user leaves the page, the event stream will be closed. +函数 `subscribe()` 返回一个函数,该函数一旦调用就会关闭底层连接。这就是为什么我把它传递给 “断开连接”disconnect事件的原因;因此,当用户离开页面时,事件流将被关闭。 -``` +```js async function onMessageArrive(message) { const conversationLI = document.querySelector(`li[data-id="${message.conversationID}"]`) if (conversationLI !== null) { @@ -221,14 +220,14 @@ function getConversation(id) { } ``` -Every time a new message arrives, we go and query for the conversation item in the DOM. If found, we add the `has-unread-messages` class to the item, and update the view. If not found, it means the message is from a new conversation created just now. We go and do a GET request to `/api/conversations/{conversationID}` to get the conversation in which the message was created and prepend it to the conversation list. +每次有新消息到达时,我们都会在 DOM 中查询会话条目。如果找到,我们会将 `has-unread-messages` 类添加到该条目中,并更新视图。如果未找到,则表示该消息来自刚刚创建的新对话。我们去做一个对 `/api/conversations/{conversationID}` 的 GET 请求,以获取在其中创建消息的对话,并将其放在对话列表的前面。 * * * -That covers the home page 😊 -On the next post we’ll code the conversation page. +以上这些涵盖了主页的所有内容 😊。 +在下一篇文章中,我们将对 conversation 页面进行编码。 -[Souce Code][10] +- [源代码][10] -------------------------------------------------------------------------------- @@ -236,20 +235,20 @@ via: https://nicolasparada.netlify.com/posts/go-messenger-home-page/ 作者:[Nicolás Parada][a] 选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) +译者:[gxlct008](https://github.com/gxlct008) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 [a]: https://nicolasparada.netlify.com/ [b]: https://github.com/lujun9972 -[1]: https://nicolasparada.netlify.com/posts/go-messenger-schema/ -[2]: https://nicolasparada.netlify.com/posts/go-messenger-oauth/ -[3]: https://nicolasparada.netlify.com/posts/go-messenger-conversations/ -[4]: https://nicolasparada.netlify.com/posts/go-messenger-messages/ -[5]: https://nicolasparada.netlify.com/posts/go-messenger-realtime-messages/ -[6]: https://nicolasparada.netlify.com/posts/go-messenger-dev-login/ -[7]: https://nicolasparada.netlify.com/posts/go-messenger-access-page/ +[1]: https://linux.cn/article-11396-1.html +[2]: https://linux.cn/article-11510-1.html +[3]: https://linux.cn/article-12056-1.html +[4]: https://linux.cn/article-12680-1.html +[5]: https://linux.cn/article-12685-1.html +[6]: https://linux.cn/article-12692-1.html +[7]: https://linux.cn/article-12704-1.html [8]: https://nicolasparada.netlify.com/img/go-messenger-home-page/conversation-form.png [9]: https://nicolasparada.netlify.com/img/go-messenger-home-page/conversation-list.png [10]: https://github.com/nicolasparada/go-messenger-demo diff --git a/sources/tech/20180720 Building a Messenger App- Conversation Page.md b/published/202010/20180720 Building a Messenger App- Conversation Page.md similarity index 59% rename from sources/tech/20180720 Building a Messenger App- Conversation Page.md rename to published/202010/20180720 Building a Messenger App- Conversation Page.md index c721b48161..95f91cabfa 100644 --- a/sources/tech/20180720 Building a Messenger App- Conversation Page.md +++ b/published/202010/20180720 Building a Messenger App- Conversation Page.md @@ -1,37 +1,37 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: translator: (gxlct008) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12723-1.html) [#]: subject: (Building a Messenger App: Conversation Page) [#]: via: (https://nicolasparada.netlify.com/posts/go-messenger-conversation-page/) [#]: author: (Nicolás Parada https://nicolasparada.netlify.com/) -Building a Messenger App: Conversation Page +构建一个即时消息应用(九):Conversation 页面 ====== -This post is the 9th and last in a series: +![](https://img.linux.net.cn/data/attachment/album/202010/15/220239arr978u7t7oulv73.jpg) - * [Part 1: Schema][1] - * [Part 2: OAuth][2] - * [Part 3: Conversations][3] - * [Part 4: Messages][4] - * [Part 5: Realtime Messages][5] - * [Part 6: Development Login][6] - * [Part 7: Access Page][7] - * [Part 8: Home Page][8] +本文是该系列的第九篇,也是最后一篇。 + * [第一篇: 模式][1] + * [第二篇: OAuth][2] + * [第三篇: 对话][3] + * [第四篇: 消息][4] + * [第五篇: 实时消息][5] + * [第六篇: 仅用于开发的登录][6] + * [第七篇: Access 页面][7] + * [第八篇: Home 页面][8] +在这篇文章中,我们将对对话conversation页面进行编码。此页面是两个用户之间的聊天室。在顶部我们将显示其他参与者的信息,下面接着的是最新消息列表,以及底部的消息表单。 -In this post we’ll code the conversation page. This page is the chat between the two users. At the top we’ll show info about the other participant, below, a list of the latest messages and a message form at the bottom. - -### Chat heading +### 聊天标题 ![chat heading screenshot][9] -Let’s start by creating the file `static/pages/conversation-page.js` with the following content: +让我们从创建 `static/pages/conversation-page.js` 文件开始,它包含以下内容: -``` +```js import http from '../http.js' import { navigate } from '../router.js' import { avatar, escapeHTML } from '../shared.js' @@ -65,17 +65,17 @@ function getConversation(id) { } ``` -This page receives the conversation ID the router extracted from the URL. +此页面接收路由从 URL 中提取的会话 ID。 -First it does a GET request to `/api/conversations/{conversationID}` to get info about the conversation. In case of error, we show it and redirect back to `/`. Then we render info about the other participant. +首先,它向 `/api/ conversations/{conversationID}` 发起一个 GET 请求,以获取有关对话的信息。 如果出现错误,我们会将其显示,并重定向回 `/`。然后我们呈现有关其他参与者的信息。 -### Conversation List +### 对话列表 ![chat heading screenshot][10] -We’ll fetch the latest messages too to display them. +我们也会获取最新的消息并显示它们。 -``` +```js let conversation, messages try { [conversation, messages] = await Promise.all([ @@ -85,32 +85,32 @@ try { } ``` -Update the `conversationPage()` function to fetch the messages too. We use `Promise.all()` to do both request at the same time. +更新 `conversationPage()` 函数以获取消息。我们使用 `Promise.all()` 同时执行这两个请求。 -``` +```js function getMessages(conversationID) { return http.get(`/api/conversations/${conversationID}/messages`) } ``` -A GET request to `/api/conversations/{conversationID}/messages` gets the latest messages of the conversation. +发起对 `/api/conversations/{conversationID}/messages` 的 GET 请求可以获取对话中的最新消息。 -``` +```html
        ``` -Now, add that list to the markup. +现在,将该列表添加到标记中。 -``` +```js const messagesOList = page.getElementById('messages') for (const message of messages.reverse()) { messagesOList.appendChild(renderMessage(message)) } ``` -So we can append messages to the list. We show them in reverse order. +这样我们就可以将消息附加到列表中了。我们以时间倒序来显示它们。 -``` +```js function renderMessage(message) { const messageContent = escapeHTML(message.content) const messageDate = new Date(message.createdAt).toLocaleString() @@ -127,28 +127,28 @@ function renderMessage(message) { } ``` -Each message item displays the message content itself with its timestamp. Using `.mine` we can append a different class to the item so maybe you can show the message to the right. +每个消息条目显示消息内容本身及其时间戳。使用 `.mine`,我们可以将不同的 css 类附加到条目,这样您就可以将消息显示在右侧。 -### Message Form +### 消息表单 ![chat heading screenshot][11] -``` +```html
        ``` -Add that form to the current markup. +将该表单添加到当前标记中。 -``` +```js page.getElementById('message-form').onsubmit = messageSubmitter(conversationID) ``` -Attach an event listener to the “submit” event. +将事件监听器附加到 “submit” 事件。 -``` +```js function messageSubmitter(conversationID) { return async ev => { ev.preventDefault() @@ -191,19 +191,20 @@ function createMessage(content, conversationID) { } ``` -We make use of [partial application][12] to have the conversation ID in the “submit” event handler. It takes the message content from the input and does a POST request to `/api/conversations/{conversationID}/messages` with it. Then prepends the newly created message to the list. -### Messages Subscription +我们利用 [partial application][12] 在 “submit” 事件处理程序中获取对话 ID。它 从输入中获取消息内容,并用它对 `/api/conversations/{conversationID}/messages` 发出 POST 请求。 然后将新创建的消息添加到列表中。 -To make it realtime we’ll subscribe to the message stream in this page also. +### 消息订阅 -``` +为了实现实时,我们还将订阅此页面中的消息流。 + +```js page.addEventListener('disconnect', subscribeToMessages(messageArriver(conversationID))) ``` -Add that line in the `conversationPage()` function. +将该行添加到 `conversationPage()` 函数中。 -``` +```js function subscribeToMessages(cb) { return http.subscribe('/api/messages', cb) } @@ -229,16 +230,15 @@ function readMessages(conversationID) { } ``` -We also make use of partial application to have the conversation ID here. -When a new message arrives, first we check if it’s from this conversation. If it is, we go a prepend a message item to the list and do a POST request to `/api/conversations/{conversationID}/read_messages` to updated the last time the participant read messages. +在这里我们仍然使用这个应用的部分来获取会话 ID。 +当新消息到达时,我们首先检查它是否来自此对话。如果是,我们会将消息条目预先添加到列表中,并向 `/api/conversations/{conversationID}/read_messages` 发起 POST 一个请求,以更新参与者上次阅读消息的时间。 * * * -That concludes this series. The messenger app is now functional. +本系列到此结束。 消息应用现在可以运行了。 -~~I’ll add pagination on the conversation and message list, also user searching before sharing the source code. I’ll updated once it’s ready along with a hosted demo 👨‍💻~~ - -[Souce Code][13] • [Demo][14] +- [源代码][13] +- [演示][14] -------------------------------------------------------------------------------- @@ -246,21 +246,21 @@ via: https://nicolasparada.netlify.com/posts/go-messenger-conversation-page/ 作者:[Nicolás Parada][a] 选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) +译者:[gxlct008](https://github.com/gxlct008) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 [a]: https://nicolasparada.netlify.com/ [b]: https://github.com/lujun9972 -[1]: https://nicolasparada.netlify.com/posts/go-messenger-schema/ -[2]: https://nicolasparada.netlify.com/posts/go-messenger-oauth/ -[3]: https://nicolasparada.netlify.com/posts/go-messenger-conversations/ -[4]: https://nicolasparada.netlify.com/posts/go-messenger-messages/ -[5]: https://nicolasparada.netlify.com/posts/go-messenger-realtime-messages/ -[6]: https://nicolasparada.netlify.com/posts/go-messenger-dev-login/ -[7]: https://nicolasparada.netlify.com/posts/go-messenger-access-page/ -[8]: https://nicolasparada.netlify.com/posts/go-messenger-home-page/ +[1]: https://linux.cn/article-11396-1.html +[2]: https://linux.cn/article-11510-1.html +[3]: https://linux.cn/article-12056-1.html +[4]: https://linux.cn/article-12680-1.html +[5]: https://linux.cn/article-12685-1.html +[6]: https://linux.cn/article-12692-1.html +[7]: https://linux.cn/article-12704-1.html +[8]: https://linux.cn/article-12722-1.html [9]: https://nicolasparada.netlify.com/img/go-messenger-conversation-page/heading.png [10]: https://nicolasparada.netlify.com/img/go-messenger-conversation-page/list.png [11]: https://nicolasparada.netlify.com/img/go-messenger-conversation-page/form.png diff --git a/published/202010/20190102 Using Yarn on Ubuntu and Other Linux Distributions.md b/published/202010/20190102 Using Yarn on Ubuntu and Other Linux Distributions.md new file mode 100644 index 0000000000..0222a78d37 --- /dev/null +++ b/published/202010/20190102 Using Yarn on Ubuntu and Other Linux Distributions.md @@ -0,0 +1,273 @@ +[#]: collector: (lujun9972) +[#]: translator: (gxlct008) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12737-1.html) +[#]: subject: (Using Yarn on Ubuntu and Other Linux Distributions) +[#]: via: (https://itsfoss.com/install-yarn-ubuntu) +[#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/) + +在 Ubuntu 和其他 Linux 发行版上使用 Yarn +====== + +> 本速成教程向你展示了在 Ubuntu 和 Debian Linux 上安装 Yarn 包管理器的官方方法。你还将学习到一些基本的 Yarn 命令以及彻底删除 Yarn 的步骤。 + +[Yarn][1] 是 Facebook 开发的开源 JavaScript 包管理器。它是流行的 npm 包管理器的一个替代品,或者应该说是改进。 [Facebook 开发团队][2] 创建 Yarn 是为了克服 [npm][3] 的缺点。 Facebook 声称 Yarn 比 npm 更快、更可靠、更安全。 + +与 npm 一样,Yarn 为你提供一种自动安装、更新、配置和删除从全局注册库中检索到的程序包的方法。 + +Yarn 的优点是它更快,因为它可以缓存已下载的每个包,所以无需再次下载。它还将操作并行化,以最大化资源利用率。在执行每个已安装的包代码之前,Yarn 还使用 [校验和来验证完整性][4]。 Yarn 还保证可以在一个系统上运行的安装,在任何其他系统上都会以完全相同地方式工作。 + +如果你正 [在 Ubuntu 上使用 node.js][5],那么你的系统上可能已经安装了 npm。在这种情况下,你可以使用 npm 通过以下方式全局安装 Yarn: + +``` +sudo npm install yarn -g +``` + +不过,我推荐使用官方方式在 Ubuntu/Debian 上安装 Yarn。 + +### 在 Ubuntu 和 Debian 上安装 Yarn [官方方式] + +![Yarn JS][6] + +这里提到的说明应该适用于所有版本的 Ubuntu,例如 Ubuntu 18.04、16.04 等。同样的一组说明也适用于 Debian 和其他基于 Debian 的发行版。 + +由于本教程使用 `curl` 来添加 Yarn 项目的 GPG 密钥,所以最好验证一下你是否已经安装了 `curl`。 + +``` +sudo apt install curl +``` + +如果 `curl` 尚未安装,则上面的命令将安装它。既然有了 `curl`,你就可以使用它以如下方式添加 Yarn 项目的 GPG 密钥: + +``` +curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add - +``` + +在此之后,将存储库添加到源列表中,以便将来可以轻松地升级 Yarn 包,并进行其余系统更新: + +``` +sudo sh -c 'echo "deb https://dl.yarnpkg.com/debian/ stable main" >> /etc/apt/sources.list.d/yarn.list' +``` + +你现在可以继续了。[更新 Ubuntu][7] 或 Debian 系统,以刷新可用软件包列表,然后安装 Yarn: + +``` +sudo apt update +sudo apt install yarn +``` + +这将一起安装 Yarn 和 node.js。该过程完成后,请验证是否已成功安装 Yarn。 你可以通过检查 Yarn 版本来做到这一点。 + +``` +yarn --version +``` + +对我来说,它显示了这样的输出: + +``` +yarn --version +1.12.3 +``` + +这意味着我的系统上安装了 Yarn 版本 1.12.3。 + +### 使用 Yarn + +我假设你对 JavaScript 编程以及依赖项的工作原理有一些基本的了解。我在这里不做详细介绍。我将向你展示一些基本的 Yarn 命令,这些命令将帮助你入门。 + +#### 使用 Yarn 创建一个新项目 + +与 `npm` 一样,Yarn 也可以使用 `package.json` 文件。在这里添加依赖项。所有依赖包都缓存在项目根目录下的 `node_modules` 目录中。 + +在项目的根目录中,运行以下命令以生成新的 `package.json` 文件: + +它会问你一些问题。你可以按回车键跳过或使用默认值。 + +``` +yarn init +yarn init v1.12.3 +question name (test_yarn): test_yarn_proect +question version (1.0.0): 0.1 +question description: Test Yarn +question entry point (index.js): +question repository url: +question author: abhishek +question license (MIT): +question private: +success Saved package.json +Done in 82.42s. +``` + +这样,你就得到了一个如下的 `package.json` 文件: + +``` +{ + "name": "test_yarn_proect", + "version": "0.1", + "description": "Test Yarn", + "main": "index.js", + "author": "abhishek", + "license": "MIT" +} +``` + +现在你有了 `package.json`,你可以手动编辑它以添加或删除包依赖项,也可以使用 Yarn 命令(首选)。 + +#### 使用 Yarn 添加依赖项 + +你可以通过以下方式添加对特定包的依赖关系: + +``` +yarn add <包名> +``` + +例如,如果你想在项目中使用 [Lodash][8],则可以使用 Yarn 添加它,如下所示: + +``` +yarn add lodash +yarn add v1.12.3 +info No lockfile found. +[1/4] Resolving packages… +[2/4] Fetching packages… +[3/4] Linking dependencies… +[4/4] Building fresh packages… +success Saved lockfile. +success Saved 1 new dependency. +info Direct dependencies +└─ [email protected] +info All dependencies +└─ [email protected] +Done in 2.67s. +``` + +你可以看到,此依赖项已自动添加到 `package.json` 文件中: + +``` +{ + "name": "test_yarn_proect", + "version": "0.1", + "description": "Test Yarn", + "main": "index.js", + "author": "abhishek", + "license": "MIT", + "dependencies": { + "lodash": "^4.17.11" + } +} +``` + +默认情况下,Yarn 将在依赖项中添加最新版本的包。如果要使用特定版本,可以在添加时指定。 + +``` +yarn add package@version-or-tag +``` + +像往常一样,你也可以手动更新 `package.json` 文件。 + +#### 使用 Yarn 升级依赖项 + +你可以使用以下命令将特定依赖项升级到其最新版本: + +``` +yarn upgrade <包名> +``` + +它将查看所​​涉及的包是否具有较新的版本,并且会相应地对其进行更新。 + +你还可以通过以下方式更改已添加的依赖项的版本: + +``` +yarn upgrade package_name@version_or_tag +``` + +你还可以使用一个命令将项目的所有依赖项升级到它们的最新版本: + +``` +yarn upgrade +``` + +它将检查所有依赖项的版本,如果有任何较新的版本,则会更新它们。 + +#### 使用 Yarn 删除依赖项 + +你可以通过以下方式从项目的依赖项中删除包: + +``` +yarn remove <包名> +``` + +#### 安装所有项目依赖项 + +如果对你 `project.json` 文件进行了任何更改,则应该运行: + +``` +yarn +``` + +或者, + +``` +yarn install +``` + +一次安装所有依赖项。 + +### 如何从 Ubuntu 或 Debian 中删除 Yarn + +我将通过介绍从系统中删除 Yarn 的步骤来完成本教程,如果你使用上述步骤安装 Yarn 的话。如果你意识到不再需要 Yarn 了,则可以将它删除。 + +使用以下命令删除 Yarn 及其依赖项。 + +``` +sudo apt purge yarn +``` + +你也应该从源列表中把存储库信息一并删除掉: + +``` +sudo rm /etc/apt/sources.list.d/yarn.list +``` + +下一步删除已添加到受信任密钥的 GPG 密钥是可选的。但要做到这一点,你需要知道密钥。你可以使用 `apt-key` 命令获得它: + +``` +Warning: apt-key output should not be parsed (stdout is not a terminal) pub rsa4096 2016-10-05 [SC] 72EC F46A 56B4 AD39 C907 BBB7 1646 B01B 86E5 0310 uid [ unknown] Yarn Packaging yarn@dan.cx sub rsa4096 2016-10-05 [E] sub rsa4096 2019-01-02 [S] [expires: 2020-02-02] +``` + +这里的密钥是以 `pub` 开始的行中 GPG 密钥指纹的最后 8 个字符。 + +因此,对于我来说,密钥是 `86E50310`,我将使用以下命令将其删除: + +``` +sudo apt-key del 86E50310 +``` + +你会在输出中看到 `OK`,并且 Yarn 包的 GPG 密钥将从系统信任的 GPG 密钥列表中删除。 + +我希望本教程可以帮助你在 Ubuntu、Debian、Linux Mint、 elementary OS 等操作系统上安装 Yarn。 我提供了一些基本的 Yarn 命令,以帮助你入门,并完成了从系统中删除 Yarn 的完整步骤。 + +希望你喜欢本教程,如果有任何疑问或建议,请随时在下面留言。 + + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/install-yarn-ubuntu + +作者:[Abhishek Prakash][a] +选题:[lujun9972][b] +译者:[gxlct008](https://github.com/gxlct008) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://itsfoss.com/author/abhishek/ +[b]: https://github.com/lujun9972 +[1]: https://yarnpkg.com/lang/en/ +[2]: https://code.fb.com/ +[3]: https://www.npmjs.com/ +[4]: https://itsfoss.com/checksum-tools-guide-linux/ +[5]: https://itsfoss.com/install-nodejs-ubuntu/ +[6]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2019/01/yarn-js-ubuntu-debian.jpeg?resize=800%2C450&ssl=1 +[7]: https://itsfoss.com/update-ubuntu/ +[8]: https://lodash.com/ diff --git a/published/202010/20190521 How to Disable IPv6 on Ubuntu Linux.md b/published/202010/20190521 How to Disable IPv6 on Ubuntu Linux.md new file mode 100644 index 0000000000..a187054afd --- /dev/null +++ b/published/202010/20190521 How to Disable IPv6 on Ubuntu Linux.md @@ -0,0 +1,221 @@ +[#]: collector: (lujun9972) +[#]: translator: (rakino) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12689-1.html) +[#]: subject: (How to Disable IPv6 on Ubuntu Linux) +[#]: via: (https://itsfoss.com/disable-ipv6-ubuntu-linux/) +[#]: author: (Sergiu https://itsfoss.com/author/sergiu/) + +如何在 Ubuntu Linux 上禁用 IPv6 +====== + +想知道怎样在 Ubuntu 上**禁用 IPv6** 吗?我会在这篇文章中介绍一些方法,以及为什么你应该考虑这一选择;以防改变主意,我也会提到如何**启用,或者说重新启用 IPv6**。 + +### 什么是 IPv6?为什么会想要禁用它? + +[互联网协议第 6 版][1]Internet Protocol version 6(IPv6)是互联网协议(IP)的最新版本。互联网协议是一种通信协议,它为网络上的计算机提供识别和定位系统,并在互联网上进行通信路由。IPv6 于 1998 年设计,以取代 IPv4 协议。 + +**IPv6** 意在提高安全性与性能的同时保证地址不被用尽;它可以在全球范围内为每台设备分配唯一的以 **128 位比特**存储的地址,而 IPv4 只使用了 32 位比特。 + +![Disable IPv6 Ubuntu][2] + +尽管 IPv6 的目标是取代 IPv4,但目前还有很长的路要走;互联网上只有不到 **30%** 的网站支持 IPv6([这里][3] 是谷歌的统计),IPv6 有时也给 [一些应用带来问题][4]。 + +由于 IPv6 使用全球(唯一分配的)路由地址,以及(仍然)有互联网服务供应商Internet Service Provider(ISP)不提供 IPv6 支持的事实,IPv6 这一功能在提供全球服务的**虚拟私人网络**Virtual Private Network(VPN)供应商的优先级列表中处于较低的位置,这样一来,他们就可以专注于对 VPN 用户最重要的事情:安全。 + +不想让自己暴露在各种威胁之下可能是另一个让你想在系统上禁用 IPv6 的原因。虽然 IPv6 本身比 IPv4 更安全,但我所指的风险是另一种性质上的。如果你不实际使用 IPv6 及其功能,那么[启用 IPv6 后,你会很容易受到各种攻击][5],因而为黑客提供另一种可能的利用工具。 + +同样,只配置基本的网络规则是不够的;你必须像对 IPv4 一样,对调整 IPv6 的配置给予同样的关注,这可能会是一件相当麻烦的事情(维护也是)。并且随着 IPv6 而来的将会是一套不同于 IPv4 的问题(鉴于这个协议的年龄,许多问题已经可以在网上找到了),这又会使你的系统多了一层复杂性。 + +据观察,在某些情况下,禁用 IPv6 有助于提高 Ubuntu 的 WiFi 速度。 + +### 在 Ubuntu 上禁用 IPv6 [高级用户] + +在本节中,我会详述如何在 Ubuntu 上禁用 IPv6 协议,请打开终端(默认快捷键:`CTRL+ALT+T`),让我们开始吧! + +**注意:** 接下来大部分输入终端的命令都需要 root 权限(`sudo`)。 + +> 警告! +> +> 如果你是一个普通 Linux 桌面用户,并且偏好稳定的工作系统,请避开本教程,接下来的部分是为那些知道自己在做什么以及为什么要这么做的用户准备的。 + +#### 1、使用 sysctl 禁用 IPv6 + +首先,可以执行以下命令来**检查** IPv6 是否已经启用: + +``` +ip a +``` + +如果启用了,你应该会看到一个 IPv6 地址(网卡的名字可能会与图中有所不同) + +![IPv6 Address Ubuntu][7] + +在教程《[在 Ubuntu 中重启网络][8]》(LCTT 译注:其实这篇文章并没有提到使用 sysctl 的方法……)中,你已经见过 `sysctl` 命令了,在这里我们也同样会用到它。要**禁用 IPv6**,只需要输入三条命令: + +``` +sudo sysctl -w net.ipv6.conf.all.disable_ipv6=1 +sudo sysctl -w net.ipv6.conf.default.disable_ipv6=1 +sudo sysctl -w net.ipv6.conf.lo.disable_ipv6=1 +``` + +检查命令是否生效: + +``` +ip a +``` + +如果命令生效,你应该会发现 IPv6 的条目消失了: + +![IPv6 Disabled Ubuntu][9] + +然而这种方法只能**临时禁用 IPv6**,因此在下次系统启动的时候,IPv6 仍然会被启用。 + +(LCTT 译注:这里的临时禁用是指这次所做的改变直到此次关机之前都有效,因为相关的参数是存储在内存中的,可以改变值,但是在内存断电后就会丢失;这种意义上来讲,下文所述的两种方法都是临时的,只不过改变参数值的时机是在系统启动的早期,并且每次系统启动时都有应用而已。那么如何完成这种意义上的永久改变?答案是在编译内核的时候禁用相关功能,然后要后悔就只能重新编译内核了(悲)。) + +一种让选项持续生效的方式是修改文件 `/etc/sysctl.conf`,在这里我用 `vim` 来编辑文件,不过你可以使用任何你想使用的编辑器,以及请确保你拥有**管理员权限**(用 `sudo`): + +![Sysctl Configuration][10] + +将下面这几行(和之前使用的参数相同)加入到文件中: + +``` +net.ipv6.conf.all.disable_ipv6=1 +net.ipv6.conf.default.disable_ipv6=1 +net.ipv6.conf.lo.disable_ipv6=1 +``` + +执行以下命令应用设置: + +``` +sudo sysctl -p +``` + +如果在重启之后 IPv6 仍然被启用了,而你还想继续这种方法的话,那么你必须(使用 root 权限)创建文件 `/etc/rc.local` 并加入以下内容: + +``` +#!/bin/bash +# /etc/rc.local + +/etc/sysctl.d +/etc/init.d/procps restart + +exit 0 +``` + +接着使用 [chmod 命令][11] 来更改文件权限,使其可执行: + +``` +sudo chmod 755 /etc/rc.local +``` + +这会让系统(在启动的时候)从之前编辑过的 sysctl 配置文件中读取内核参数。 + +#### 2、使用 GRUB 禁用 IPv6 + +另外一种方法是配置 **GRUB**,它会在系统启动时向内核传递参数。这样做需要编辑文件 `/etc/default/grub`(请确保拥有管理员权限)。 + +![GRUB Configuration][13] + +现在需要修改文件中分别以 `GRUB_CMDLINE_LINUX_DEFAULT` 和 `GRUB_CMDLINE_LINUX` 开头的两行来在启动时禁用 IPv6: + +``` +GRUB_CMDLINE_LINUX_DEFAULT="quiet splash ipv6.disable=1" +GRUB_CMDLINE_LINUX="ipv6.disable=1" +``` + +(LCTT 译注:这里是指在上述两行内增加参数 `ipv6.disable=1`,不同的系统中这两行的默认值可能有所不同。) + +保存文件,然后执行命令: + +``` +sudo update-grub +``` + +(LCTT 译注:该命令用以更新 GRUB 的配置文件,在没有 `update-grub` 命令的系统中需要使用 `sudo grub-mkconfig -o /boot/grub/grub.cfg` ) + +设置会在重启后生效。 + +### 在 Ubuntu 上重新启用 IPv6 + +要想重新启用 IPv6,你需要撤销之前的所有修改。不过只是想临时启用 IPv6 的话,可以执行以下命令: + +``` +sudo sysctl -w net.ipv6.conf.all.disable_ipv6=0 +sudo sysctl -w net.ipv6.conf.default.disable_ipv6=0 +sudo sysctl -w net.ipv6.conf.lo.disable_ipv6=0 +``` + +否则想要持续启用的话,看看是否修改过 `/etc/sysctl.conf`,可以删除掉之前增加的部分,也可以将它们改为以下值(两种方法等效): + +``` +net.ipv6.conf.all.disable_ipv6=0 +net.ipv6.conf.default.disable_ipv6=0 +net.ipv6.conf.lo.disable_ipv6=0 +``` + +然后应用设置(可选): + +``` +sudo sysctl -p +``` + +(LCTT 译注:这里可选的意思可能是如果之前临时启用了 IPv6 就没必要再重新加载配置文件了) + +这样应该可以再次看到 IPv6 地址了: + +![IPv6 Reenabled in Ubuntu][14] + +另外,你也可以删除之前创建的文件 `/etc/rc.local`(可选): + +``` +sudo rm /etc/rc.local +``` + +如果修改了文件 `/etc/default/grub`,回去删掉你所增加的参数: + +``` +GRUB_CMDLINE_LINUX_DEFAULT="quiet splash" +GRUB_CMDLINE_LINUX="" +``` + +然后更新 GRUB 配置文件: + +``` +sudo update-grub +``` + +### 尾声 + +在这篇文章中,我介绍了在 Linux 上**禁用 IPv6** 的方法,并简述了什么是 IPv6 以及可能想要禁用掉它的原因。 + +那么,这篇文章对你有用吗?你有禁用掉 IPv6 连接吗?让我们评论区见吧~ + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/disable-ipv6-ubuntu-linux/ + +作者:[Sergiu][a] +选题:[lujun9972][b] +译者:[rakino](https://github.com/rakino) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://itsfoss.com/author/sergiu/ +[b]: https://github.com/lujun9972 +[1]: https://en.wikipedia.org/wiki/IPv6 +[2]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/05/disable_ipv6_ubuntu.png?fit=800%2C450&ssl=1 +[3]: https://www.google.com/intl/en/ipv6/statistics.html +[4]: https://whatismyipaddress.com/ipv6-issues +[5]: https://www.internetsociety.org/blog/2015/01/ipv6-security-myth-1-im-not-running-ipv6-so-i-dont-have-to-worry/ +[6]: https://itsfoss.com/remove-drive-icons-from-unity-launcher-in-ubuntu/ +[7]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2019/05/ipv6_address_ubuntu.png?fit=800%2C517&ssl=1 +[8]: https://linux.cn/article-10804-1.html +[9]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/05/ipv6_disabled_ubuntu.png?fit=800%2C442&ssl=1 +[10]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/05/sysctl_configuration.jpg?fit=800%2C554&ssl=1 +[11]: https://linuxhandbook.com/chmod-command/ +[12]: https://itsfoss.com/find-which-kernel-version-is-running-in-ubuntu/ +[13]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/05/grub_configuration-1.jpg?fit=800%2C565&ssl=1 +[14]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2019/05/ipv6_address_ubuntu-1.png?fit=800%2C517&ssl=1 diff --git a/published/202010/20190822 Things You Didn-t Know About GNU Readline.md b/published/202010/20190822 Things You Didn-t Know About GNU Readline.md new file mode 100644 index 0000000000..12dc0a568d --- /dev/null +++ b/published/202010/20190822 Things You Didn-t Know About GNU Readline.md @@ -0,0 +1,132 @@ +[#]: collector: (lujun9972) +[#]: translator: (rakino) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12706-1.html) +[#]: subject: (Things You Didn't Know About GNU Readline) +[#]: via: (https://twobithistory.org/2019/08/22/readline.html) +[#]: author: (Two-Bit History https://twobithistory.org) + +你所不知的 GNU Readline +====== + +![](https://img.linux.net.cn/data/attachment/album/202010/10/222755etdndudtu97wddz7.jpg) + +有时我会觉得自己的计算机是一栋非常大的房子,我每天都会访问这栋房子,也对一楼的大部分房间都了如指掌,但仍然还是有我没有去过的卧室,有我没有打开过的衣柜,有我没有探索过的犄角旮旯。我感到有必要更多地了解我的计算机了,就像任何人都会觉得有必要看看自己家里从未去过的房间一样。 + +GNU Readline 是个不起眼的小软件库,我依赖了它多年却没有意识到它的存在,也许有成千上万的人每天都在不经意间使用它。如果你用 Bash shell 的话,每当你自动补全一个文件名,或者在输入的一行文本中移动光标,以及搜索之前命令的历史记录时,你都在使用 GNU Readline;当你在 Postgres(`psql`)或是 Ruby REPL(`irb`)的命令行界面中进行同样的操作时,你依然在使用 GNU Readline。很多软件都依赖 GNU Readline 库来实现用户所期望的功能,不过这些功能是如此的辅助与不显眼,以至于在我看来很少有人会停下来去想它是从哪里来的。 + +GNU Readline 最初是自由软件基金会在 20 世纪 80 年代创建的,如今作为每个人的基础计算设施的重要的、甚至看不见的组成部分的它,由一位志愿者维护。 + +### 充满特色 + +GNU Readline 库的存在,主要是为了增强各种命令行界面,它提供了一组通用的按键,使你可以在一个单行输入中移动和编辑。例如,在 Bash 提示符中按下 `Ctrl-A`,你的光标会跳到行首,而按下 `Ctrl-E` 则会跳到行末;另一个有用的命令是 `Ctrl-U`,它会删除该行中光标之前的所有内容。 + +有很长一段时间,我通过反复敲击方向键来在命令行上移动,如今看来这十分尴尬,也不知道为什么,当时的我从来没有想过可以有一种更快的方法。当然了,没有哪一个熟悉 Vim 或 Emacs 这种文本编辑器的程序员愿意长时间地击打方向键,所以像 Readline 这样的东西必然会被创造出来。在 Readline 上可以做的绝非仅仅跳来跳去,你可以像使用文本编辑器那样编辑单行文本——这里有删除单词、单词换位、大写单词、复制和粘贴字符等命令。Readline 的大部分按键/快捷键都是基于 Emacs 的,它基本上就是一个单行文本版的 Emacs 了,甚至还有录制和重放宏的功能。 + +我从来没有用过 Emacs,所以很难记住所有不同的 Readline 命令。不过 Readline 有着很巧妙的一点,那就是能够切换到基于 Vim 的模式,在 Bash 中可以使用内置的 `set` 命令来这样做。下面会让 Readline 在当前的 shell 中使用 Vim 风格的命令: + +``` +$ set -o vi +``` + +该选项启用后,就可以使用 `dw` 等命令来删除单词了,此时相当于 Emacs 模式下的 `Ctrl-U` 的命令是 `d0`。 + +我第一次知道有这个功能的时候很兴奋地想尝试一下,但它对我来说并不是那么好用。我很高兴知道有这种对 Vim 用户的让步,在使用这个功能上你可能会比我更幸运,尤其是你还没有使用 Readline 的默认按键的话;我的问题在于,我听说有基于 Vim 的界面时已经学会了几种默认按键,因此即使启用了 Vim 的选项,也一直在错误地用着默认的按键;另外因为没有某种指示器,所以 Vim 的模态设计在这里会很尴尬——你很容易就忘记了自己处于哪个模式,就因为这样,我卡在了一种虽然使用 Vim 作为文本编辑器,但却在 Readline 上用着 Emacs 风格的命令的情况里,我猜其他很多人也是这样的。 + +如果你觉得 Vim 和 Emacs 的键盘命令系统诡异而神秘(这并不是没有道理的),你可以按照喜欢的方式自定义 Readline 的键绑定。Readline 在启动时会读取文件 `~/.inputrc`,它可以用来配置各种选项与键绑定,我做的一件事是重新配置了 `Ctrl-K`:通常情况下该命令会从光标处删除到行末,但我很少这样做,所以我在 `~/.inputrc` 中添加了以下内容,把它绑定为直接删除整行: + +``` +Control-k: kill-whole-line +``` + +每个 Readline 命令(文档中称它们为 “函数” )都有一个名称,你可以用这种方式将其与一个键序列联系起来。如果你在 Vim 中编辑 `~/.inputrc`,就会发现 Vim 知道这种文件类型,还会帮你高亮显示有效的函数名,而不高亮无效的函数名。 + +`~/.inputrc` 可以做的另一件事是通过将键序列映射到输入字符串上来创建预制宏。[Readline 手册][1]给出了一个我认为特别有用的例子:我经常想把一个程序的输出保存到文件中,这意味着我得经常在 Bash 命令中追加类似 `> output.txt` 这样的东西,为了节省时间,可以把它做成一个 Readline 宏: + +``` +Control-o: "> output.txt" +``` + +这样每当你按下 `Ctrl-O` 时,你都会看到 `> output.txt` 被添加到了命令行光标的后面,这样很不错! + +不过你可以用宏做的可不仅仅是为文本串创建快捷方式;在 `~/.inputrc` 中使用以下条目意味着每次按下 `Ctrl-J` 时,行内已有的文本都会被 `$(` 和 `)` 包裹住。该宏先用 `Ctrl-A` 移动到行首,添加 `$(` ,然后再用 `Ctrl-E` 移动到行尾,添加 `)`: + +``` +Control-j: "\C-a$(\C-e)" +``` + +如果你经常需要像下面这样把一个命令的输出用于另一个命令的话,这个宏可能会对你有帮助: + +``` +$ cd $(brew --prefix) +``` + +`~/.inputrc` 文件也允许你为 Readline 手册中所谓的 “变量” 设置不同的值,这些变量会启用或禁用某些 Readline 行为,你也可以使用这些变量来改变 Readline 中像是自动补全或者历史搜索这些行为的工作方式。我建议开启的一个变量是 `revert-all-at-newline`,它是默认关闭的,当这个变量关闭时,如果你使用反向搜索功能从命令历史记录中提取一行并编辑,但随后又决定搜索另一行,那么你所做的编辑会被保存在历史记录中。我觉得这样会很混乱,因为这会导致你的 Bash 命令历史中出现从未运行过的行。所以在你的 `~/.inputrc` 中加入这个: + +``` +set revert-all-at-newline on +``` + +在你用 `~/.inputrc` 设置了选项或键绑定以后,它们会适用于任何使用 Readline 库的地方,显然 Bash 也包括在内,不过你也会在其它像是 `irb` 和 `psql` 这样的程序中受益。如果你经常使用关系型数据库的命令行界面,一个用于插入 `SELECT * FROM` 的 Readline 宏可能会很有用。 + +### Chet Ramey + +GNU Readline 如今由凯斯西储大学的高级技术架构师 Chet Ramey 维护,Ramey 同时还负责维护 Bash shell;这两个项目都是由一位名叫 Brian Fox 的自由软件基金会员工在 1988 年开始编写的,但从 1994 年左右开始,Ramey 一直是它们唯一的维护者。 + +Ramey 通过电子邮件告诉我,Readline 远非一个原创的想法,它是为了实现 POSIX 规范所规定的功能而被创建的,而 POSIX 规范又是在 20 世纪 80 年代末被制定的。许多早期的 shell,包括 Korn shell 和至少一个版本的 Unix System V shell,都包含行编辑功能。1988 年版的 Korn shell(`ksh88`)提供了 Emacs 风格和 Vi/Vim 风格的编辑模式。据我从[手册页][2]中得知,Korn shell 会通过查看 `VISUAL` 和 `EDITOR` 环境变量来决定你使用的模式,这一点非常巧妙。POSIX 中指定 shell 功能的部分近似于 `ksh88` 的实现,所以 GNU Bash 也要实现一个类似的灵活的行编辑系统来保持兼容,因此就有了 Readline。 + +Ramey 第一次参与 Bash 开发时,Readline 还是 Bash 项目目录下的一个单一的源文件,它其实只是 Bash 的一部分;随着时间的推移,Readline 文件慢慢地成为了独立的项目,不过直到 1994 年(Readline 2.0 版本发布),Readline 才完全成为了一个独立的库。 + +Readline 与 Bash 密切相关,Ramey 也通常把 Readline 与 Bash 的发布配对,但正如我上面提到的,Readline 是一个可以被任何有命令行界面的软件使用的库,而且它真的很容易使用。下面是一个例子,虽然简单,但这就是在 C 程序中使用 Readline 的方法。向 `readline()` 函数传递的字符串参数就是你希望 Readline 向用户显示的提示符: + +``` +#include +#include +#include "readline/readline.h" + +int main(int argc, char** argv) +{ + char* line = readline("my-rl-example> "); + printf("You entered: \"%s\"\n", line); + + free(line); + + return 0; +} +``` + +你的程序会把控制权交给 Readline,它会负责从用户那里获得一行输入(以这样的方式让用户可以做所有花哨的行编辑工作),一旦用户真正提交了这一行,Readline 就会把它返回给你。在我的库搜索路径中有 Readline 库,所以我可以通过调用以下内容来链接 Readline 库,从而编译上面的内容: + +``` +$ gcc main.c -lreadline +``` + +当然,Readline 的 API 比起那个单一的函数要丰富得多,任何使用它的人都可以对库的行为进行各种调整,库的用户(开发者)甚至可以添加新的函数,来让最终用户可以通过 `~/.inputrc` 来配置它们,这意味着 Readline 非常容易扩展。但是据我所知,即使是 Bash ,虽然事先有很多配置,最终也会像上面的例子一样调用简单的 `readline()` 函数来获取输入。(参见 GNU Bash 源代码中的[这一行][3],Bash 似乎在这里将获取输入的责任交给了 Readline)。 + +Ramey 现在已经在 Bash 和 Readline 上工作了二十多年,但他的工作却从来没有得到过报酬 —— 他一直都是一名志愿者。Bash 和 Readline 仍然在积极开发中,尽管 Ramey 说 Readline 的变化比 Bash 慢得多。我问 Ramey 作为这么多人使用的软件唯一的维护者是什么感觉,他说可能有几百万人在不知不觉中使用 Bash(因为每个苹果设备都运行 Bash),这让他担心一个破坏性的变化会造成多大的混乱,不过他已经慢慢习惯了所有这些人的想法。他还说他会继续在 Bash 和 Readline 上工作,因为在这一点上他已经深深地投入了,而且他也只是单纯地喜欢把有用的软件提供给世界。 + +_你可以在 [Chet Ramey 的网站][4]上找到更多关于他的信息。_ + +_喜欢这篇文章吗?我会每四周写出一篇像这样的文章。关注推特帐号 [@TwoBitHistory][5] 或者[订阅 RSS][6] 来获取更新吧!_ + +-------------------------------------------------------------------------------- + +via: https://twobithistory.org/2019/08/22/readline.html + +作者:[Two-Bit History][a] +选题:[lujun9972][b] +译者:[rakino](https://github.com/rakino) +校对:[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://tiswww.case.edu/php/chet/readline/readline.html +[2]: https://web.archive.org/web/20151105130220/http://www2.research.att.com/sw/download/man/man1/ksh88.html +[3]: https://github.com/bminor/bash/blob/9f597fd10993313262cab400bf3c46ffb3f6fd1e/parse.y#L1487 +[4]: https://tiswww.case.edu/php/chet/ +[5]: https://twitter.com/TwoBitHistory +[6]: https://twobithistory.org/feed.xml +[7]: https://twitter.com/TwoBitHistory/status/1112492084383092738?ref_src=twsrc%5Etfw diff --git a/published/202010/20191105 My first contribution to open source- Making a decision.md b/published/202010/20191105 My first contribution to open source- Making a decision.md new file mode 100644 index 0000000000..a8863ea7ff --- /dev/null +++ b/published/202010/20191105 My first contribution to open source- Making a decision.md @@ -0,0 +1,59 @@ +[#]: collector: (lujun9972) +[#]: translator: (chenmu-kk) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12768-1.html) +[#]: subject: (My first contribution to open source: Making a decision) +[#]: via: (https://opensource.com/article/19/11/my-first-open-source-contribution-mistake-decisions) +[#]: author: (Galen Corey https://opensource.com/users/galenemco) + +我的第一次开源贡献:做出决定 +====== + +> 一位新的开源贡献者告诉你如何加入到开源项目中。 + +![](https://img.linux.net.cn/data/attachment/album/202010/30/112350rh0xwp1x1y6awehn.jpg) + +先前,我把我的第一次开源贡献的拖延归咎于[冒牌综合症][2]。但还有一个我无法忽视的因素:我做出决定太艰难了。在[成千上百万][3]的开源项目中选择时,选择一个要做贡献的项目是难以抉择的。如此重负,以至于我常常不得不关掉我的笔记本去思考:“或许我改天再做吧”。 + +错误之二是让我对做出决定的恐惧妨碍了我做出第一次贡献。在理想世界里,也许开始我的开源之旅时,心中就已经有了一个真正关心和想去做的具体项目,但我有的只是总得为开源项目做出贡献的模糊目标。对于那些处于同一处境的人来说,这儿有一些帮助我挑选出合适的项目(或者至少是一个好的项目)来做贡献的策略。 + +### 经常使用的工具 + +一开始,我不认为有必要将自己局限于已经熟悉的工具或项目。有一些项目我之前从未使用过,但由于它们的社区很活跃,或者它们解决的问题很有趣,因此看起来很有吸引力。 + +但是,考虑我投入到这个项目中的时间有限,我决定继续投入到我了解的工具上去。要了解工具需求,你需要熟悉它的工作方式。如果你想为自己不熟悉的项目做贡献,则需要完成一个额外的步骤来了解代码的功能和目标。这个额外的工作量可能是有趣且值得的,但也会使你的工作时间加倍。因为我的目标主要是贡献,投入到我了解的工具上是缩小范围的很好方式。回馈一个你认为有用的项目也是有意义的。 + +### 活跃而友好的社区 + +在选择项目的时候,我希望在那里有人会审查我写的代码才会觉得有信心。当然,我也希望审核我代码的人是个和善的人。毕竟,把你的作品放在那里接受公众监督是很可怕的。虽然我对建设性的反馈持开放态度,但开发者社区中的一些有毒角落是我希望避免的。 + +为了评估我将要加入的社区,我查看了我正在考虑加入的仓库的议题issue部分。我要查看核心团队中是否有人定期回复。更重要的是,我试着确保没有人在评论中互相诋毁(这在议题讨论中是很常见的)。我还留意了那些有行为准则的项目,概述了什么是适当的和不适当的在线互动行为。 + +### 明确的贡献准则 + +因为这是我第一次为开源项目做出贡献,在此过程中我有很多问题。一些项目社区在流程的文档记录方面做的很好,可以用来指导挑选其中的议题并发起拉取请求。 [Gatsby][4] 是这种做法的典范,尽管那时我没有选择它们,因为在此之前我从未使用过该产品。 + +这种清晰的文档帮助我们缓解了一些不知如何去做的不安全感。它也给了我希望:项目对新的贡献者是开放的,并且会花时间来查看我的工作。除了贡献准则外,我还查看了议题部分,看看这个项目是否使用了“第一个好议题good first issue”标志。这是该项目对初学者开放的另一个迹象(并可以帮助你学会要做什么)。 + +### 总结 + +如果你还没有计划好选择一个项目,那么选择合适的领域进行你的第一个开源贡献更加可行。列出一系列标准可以帮助自己缩减选择范围,并为自己的第一个拉取请求找到一个好的项目。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/11/my-first-open-source-contribution-mistake-decisions + +作者:[Galen Corey][a] +选题:[lujun9972][b] +译者:[chenmu-kk](https://github.com/chenmu-kk) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/galenemco +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/lightbulb-idea-think-yearbook-lead.png?itok=5ZpCm0Jh (Lightbulb) +[2]: https://opensource.com/article/19/10/my-first-open-source-contribution-mistakes +[3]: https://github.blog/2018-02-08-open-source-project-trends-for-2018/ +[4]: https://www.gatsbyjs.org/contributing/ diff --git a/published/202010/20200512 Scan your Linux security with Lynis.md b/published/202010/20200512 Scan your Linux security with Lynis.md new file mode 100644 index 0000000000..e945d3b86d --- /dev/null +++ b/published/202010/20200512 Scan your Linux security with Lynis.md @@ -0,0 +1,380 @@ +[#]: collector: (lujun9972) +[#]: translator: (wxy) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12696-1.html) +[#]: subject: (Scan your Linux security with Lynis) +[#]: via: (https://opensource.com/article/20/5/linux-security-lynis) +[#]: author: (Gaurav Kamathe https://opensource.com/users/gkamathe) + +使用 Lynis 扫描 Linux 安全性 +====== + +> 使用这个全面的开源安全审计工具检查你的 Linux 机器的安全性。 + +![](https://img.linux.net.cn/data/attachment/album/202010/08/095516k6bdgeb6jhiajutm.jpg) + +你有没有想过你的 Linux 机器到底安全不安全?Linux 发行版众多,每个发行版都有自己的默认设置,你在上面运行着几十个版本各异的软件包,还有众多的服务在后台运行,而我们几乎不知道或不关心这些。 + +要想确定安全态势(指你的 Linux 机器上运行的软件、网络和服务的整体安全状态),你可以运行几个命令,得到一些零碎的相关信息,但你需要解析的数据量是巨大的。 + +如果能运行一个工具,生成一份关于机器安全状况的报告,那就好得多了。而幸运的是,有一个这样的软件:[Lynis][2]。它是一个非常流行的开源安全审计工具,可以帮助强化基于 Linux 和 Unix 的系统。根据该项目的介绍: + +> “它运行在系统本身,可以进行深入的安全扫描。主要目标是测试安全防御措施,并提供进一步强化系统的提示。它还将扫描一般系统信息、易受攻击的软件包和可能的配置问题。Lynis 常被系统管理员和审计人员用来评估其系统的安全防御。” + +### 安装 Lynis + +你的 Linux 软件仓库中可能有 Lynis。如果有的话,你可以用以下方法安装它: + +``` +dnf install lynis +``` + +或 + +``` +apt install lynis +``` + +然而,如果你的仓库中的版本不是最新的,你最好从 GitHub 上安装它。(我使用的是 Red Hat Linux 系统,但你可以在任何 Linux 发行版上运行它)。就像所有的工具一样,先在虚拟机上试一试是有意义的。要从 GitHub 上安装它: + +``` +$ cat /etc/redhat-release +Red Hat Enterprise Linux Server release 7.8 (Maipo) +$ +$ uname  -r +3.10.0-1127.el7.x86_64 +$ +$ git clone https://github.com/CISOfy/lynis.git +Cloning into 'lynis'... +remote: Enumerating objects: 30, done. +remote: Counting objects: 100% (30/30), done. +remote: Compressing objects: 100% (30/30), done. +remote: Total 12566 (delta 15), reused 8 (delta 0), pack-reused 12536 +Receiving objects: 100% (12566/12566), 6.36 MiB | 911.00 KiB/s, done. +Resolving deltas: 100% (9264/9264), done. +$ +``` + +一旦你克隆了这个版本库,那么进入该目录,看看里面有什么可用的。主要的工具在一个叫 `lynis` 的文件里。它实际上是一个 shell 脚本,所以你可以打开它看看它在做什么。事实上,Lynis 主要是用 shell 脚本来实现的: + +``` +$ cd lynis/ +$ ls +CHANGELOG.md        CONTRIBUTING.md  db           developer.prf  FAQ             include  LICENSE  lynis.8  README     SECURITY.md +CODE_OF_CONDUCT.md  CONTRIBUTORS.md  default.prf  extras         HAPPY_USERS.md  INSTALL  lynis    plugins  README.md +$ +$ file lynis +lynis: POSIX shell script, ASCII text executable, with very long lines +$ +``` + +### 运行 Lynis + +通过给 Lynis 一个 `-h` 选项来查看帮助部分,以便有个大概了解: + +``` +$ ./lynis -h +``` + +你会看到一个简短的信息屏幕,然后是 Lynis 支持的所有子命令。 + +接下来,尝试一些测试命令以大致熟悉一下。要查看你正在使用的 Lynis 版本,请运行: + +``` +$ ./lynis show version +3.0.0 +$ +``` + +要查看 Lynis 中所有可用的命令: + +``` +$ ./lynis show commands + +Commands: +lynis audit +lynis configure +lynis generate +lynis show +lynis update +lynis upload-only + +$ +``` + +### 审计 Linux 系统 + +要审计你的系统的安全态势,运行以下命令: + +``` +$ ./lynis audit system +``` + +这个命令运行得很快,并会返回一份详细的报告,输出结果可能一开始看起来很吓人,但我将在下面引导你来阅读它。这个命令的输出也会被保存到一个日志文件中,所以你可以随时回过头来检查任何可能感兴趣的东西。 + +Lynis 将日志保存在这里: + +``` +  Files: +  - Test and debug information      : /var/log/lynis.log +  - Report data                     : /var/log/lynis-report.dat +``` + +你可以验证是否创建了日志文件。它确实创建了: + +``` +$ ls -l /var/log/lynis.log +-rw-r-----. 1 root root 341489 Apr 30 05:52 /var/log/lynis.log +$ +$ ls -l /var/log/lynis-report.dat +-rw-r-----. 1 root root 638 Apr 30 05:55 /var/log/lynis-report.dat +$ +``` + +### 探索报告 + +Lynis 提供了相当全面的报告,所以我将介绍一些重要的部分。作为初始化的一部分,Lynis 做的第一件事就是找出机器上运行的操作系统的完整信息。之后是检查是否安装了什么系统工具和插件: + +``` +[+] Initializing program +------------------------------------ + - Detecting OS... [ DONE ] + - Checking profiles... [ DONE ] + + --------------------------------------------------- + Program version: 3.0.0 + Operating system: Linux + Operating system name: Red Hat Enterprise Linux Server 7.8 (Maipo) + Operating system version: 7.8 + Kernel version: 3.10.0 + Hardware platform: x86_64 + Hostname: example + --------------------------------------------------- +<<截断>> + +[+] System Tools +------------------------------------ + - Scanning available tools... + - Checking system binaries... + +[+] Plugins (phase 1) +------------------------------------ + Note: plugins have more extensive tests and may take several minutes to complete + + - Plugin: pam + [..] + - Plugin: systemd + [................] +``` + +接下来,该报告被分为不同的部分,每个部分都以 `[+]` 符号开头。下面可以看到部分章节。(哇,要审核的地方有这么多,Lynis 是最合适的工具!) + +``` +[+] Boot and services +[+] Kernel +[+] Memory and Processes +[+] Users, Groups and Authentication +[+] Shells +[+] File systems +[+] USB Devices +[+] Storage +[+] NFS +[+] Name services +[+] Ports and packages +[+] Networking +[+] Printers and Spools +[+] Software: e-mail and messaging +[+] Software: firewalls +[+] Software: webserver +[+] SSH Support +[+] SNMP Support +[+] Databases +[+] LDAP Services +[+] PHP +[+] Squid Support +[+] Logging and files +[+] Insecure services +[+] Banners and identification +[+] Scheduled tasks +[+] Accounting +[+] Time and Synchronization +[+] Cryptography +[+] Virtualization +[+] Containers +[+] Security frameworks +[+] Software: file integrity +[+] Software: System tooling +[+] Software: Malware +[+] File Permissions +[+] Home directories +[+] Kernel Hardening +[+] Hardening +[+] Custom tests +``` + +Lynis 使用颜色编码使报告更容易解读。 + + * 绿色。一切正常 + * 黄色。跳过、未找到,可能有个建议 + * 红色。你可能需要仔细看看这个 + +在我的案例中,大部分的红色标记都是在 “Kernel Hardening” 部分找到的。内核有各种可调整的设置,它们定义了内核的功能,其中一些可调整的设置可能有其安全场景。发行版可能因为各种原因没有默认设置这些,但是你应该检查每一项,看看你是否需要根据你的安全态势来改变它的值: + +``` +[+] Kernel Hardening +------------------------------------ +  - Comparing sysctl key pairs with scan profile +    - fs.protected_hardlinks (exp: 1)                         [ OK ] +    - fs.protected_symlinks (exp: 1)                          [ OK ] +    - fs.suid_dumpable (exp: 0)                               [ OK ] +    - kernel.core_uses_pid (exp: 1)                           [ OK ] +    - kernel.ctrl-alt-del (exp: 0)                            [ OK ] +    - kernel.dmesg_restrict (exp: 1)                          [ DIFFERENT ] +    - kernel.kptr_restrict (exp: 2)                           [ DIFFERENT ] +    - kernel.randomize_va_space (exp: 2)                      [ OK ] +    - kernel.sysrq (exp: 0)                                   [ DIFFERENT ] +    - kernel.yama.ptrace_scope (exp: 1 2 3)                   [ DIFFERENT ] +    - net.ipv4.conf.all.accept_redirects (exp: 0)             [ DIFFERENT ] +    - net.ipv4.conf.all.accept_source_route (exp: 0)          [ OK ] +    - net.ipv4.conf.all.bootp_relay (exp: 0)                  [ OK ] +    - net.ipv4.conf.all.forwarding (exp: 0)                   [ OK ] +    - net.ipv4.conf.all.log_martians (exp: 1)                 [ DIFFERENT ] +    - net.ipv4.conf.all.mc_forwarding (exp: 0)                [ OK ] +    - net.ipv4.conf.all.proxy_arp (exp: 0)                    [ OK ] +    - net.ipv4.conf.all.rp_filter (exp: 1)                    [ OK ] +    - net.ipv4.conf.all.send_redirects (exp: 0)               [ DIFFERENT ] +    - net.ipv4.conf.default.accept_redirects (exp: 0)         [ DIFFERENT ] +    - net.ipv4.conf.default.accept_source_route (exp: 0)      [ OK ] +    - net.ipv4.conf.default.log_martians (exp: 1)             [ DIFFERENT ] +    - net.ipv4.icmp_echo_ignore_broadcasts (exp: 1)           [ OK ] +    - net.ipv4.icmp_ignore_bogus_error_responses (exp: 1)     [ OK ] +    - net.ipv4.tcp_syncookies (exp: 1)                        [ OK ] +    - net.ipv4.tcp_timestamps (exp: 0 1)                      [ OK ] +    - net.ipv6.conf.all.accept_redirects (exp: 0)             [ DIFFERENT ] +    - net.ipv6.conf.all.accept_source_route (exp: 0)          [ OK ] +    - net.ipv6.conf.default.accept_redirects (exp: 0)         [ DIFFERENT ] +    - net.ipv6.conf.default.accept_source_route (exp: 0)      [ OK ] +``` + +看看 SSH 这个例子,因为它是一个需要保证安全的关键领域。这里没有什么红色的东西,但是 Lynis 对我的环境给出了很多强化 SSH 服务的建议: + +``` +[+] SSH Support +------------------------------------ +  - Checking running SSH daemon                               [ FOUND ] +    - Searching SSH configuration                             [ FOUND ] +    - OpenSSH option: AllowTcpForwarding                      [ SUGGESTION ] +    - OpenSSH option: ClientAliveCountMax                     [ SUGGESTION ] +    - OpenSSH option: ClientAliveInterval                     [ OK ] +    - OpenSSH option: Compression                             [ SUGGESTION ] +    - OpenSSH option: FingerprintHash                         [ OK ] +    - OpenSSH option: GatewayPorts                            [ OK ] +    - OpenSSH option: IgnoreRhosts                            [ OK ] +    - OpenSSH option: LoginGraceTime                          [ OK ] +    - OpenSSH option: LogLevel                                [ SUGGESTION ] +    - OpenSSH option: MaxAuthTries                            [ SUGGESTION ] +    - OpenSSH option: MaxSessions                             [ SUGGESTION ] +    - OpenSSH option: PermitRootLogin                         [ SUGGESTION ] +    - OpenSSH option: PermitUserEnvironment                   [ OK ] +    - OpenSSH option: PermitTunnel                            [ OK ] +    - OpenSSH option: Port                                    [ SUGGESTION ] +    - OpenSSH option: PrintLastLog                            [ OK ] +    - OpenSSH option: StrictModes                             [ OK ] +    - OpenSSH option: TCPKeepAlive                            [ SUGGESTION ] +    - OpenSSH option: UseDNS                                  [ SUGGESTION ] +    - OpenSSH option: X11Forwarding                           [ SUGGESTION ] +    - OpenSSH option: AllowAgentForwarding                    [ SUGGESTION ] +    - OpenSSH option: UsePrivilegeSeparation                  [ OK ] +    - OpenSSH option: AllowUsers                              [ NOT FOUND ] +    - OpenSSH option: AllowGroups                             [ NOT FOUND ] +``` + +我的系统上没有运行虚拟机或容器,所以这些显示的结果是空的: + +``` +[+] Virtualization +------------------------------------ + +[+] Containers +------------------------------------ +``` + +Lynis 会检查一些从安全角度看很重要的文件的文件权限: + +``` +[+] File Permissions +------------------------------------ +  - Starting file permissions check +    File: /boot/grub2/grub.cfg                                [ SUGGESTION ] +    File: /etc/cron.deny                                      [ OK ] +    File: /etc/crontab                                        [ SUGGESTION ] +    File: /etc/group                                          [ OK ] +    File: /etc/group-                                         [ OK ] +    File: /etc/hosts.allow                                    [ OK ] +    File: /etc/hosts.deny                                     [ OK ] +    File: /etc/issue                                          [ OK ] +    File: /etc/issue.net                                      [ OK ] +    File: /etc/motd                                           [ OK ] +    File: /etc/passwd                                         [ OK ] +    File: /etc/passwd-                                        [ OK ] +    File: /etc/ssh/sshd_config                                [ OK ] +    Directory: /root/.ssh                                     [ SUGGESTION ] +    Directory: /etc/cron.d                                    [ SUGGESTION ] +    Directory: /etc/cron.daily                                [ SUGGESTION ] +    Directory: /etc/cron.hourly                               [ SUGGESTION ] +    Directory: /etc/cron.weekly                               [ SUGGESTION ] +    Directory: /etc/cron.monthly                              [ SUGGESTION ] +``` + +在报告的底部,Lynis 根据报告的发现提出了建议。每项建议后面都有一个 “TEST-ID”(为了下一部分方便,请将其保存起来)。 + +``` + Suggestions (47): + ---------------------------- + * If not required, consider explicit disabling of core dump in /etc/security/limits.conf file [KRNL-5820] + https://cisofy.com/lynis/controls/KRNL-5820/ + + * Check PAM configuration, add rounds if applicable and expire passwords to encrypt with new values [AUTH-9229] + https://cisofy.com/lynis/controls/AUTH-9229/ +``` + +Lynis 提供了一个选项来查找关于每个建议的更多信息,你可以使用 `show details` 命令和 TEST-ID 号来访问: + +``` +./lynis show details TEST-ID +``` + +这将显示该测试的其他信息。例如,我检查了 SSH-7408 的详细信息: + +``` +$ ./lynis show details SSH-7408 +2020-04-30 05:52:23 Performing test ID SSH-7408 (Check SSH specific defined options) +2020-04-30 05:52:23 Test: Checking specific defined options in /tmp/lynis.k8JwazmKc6 +2020-04-30 05:52:23 Result: added additional options for OpenSSH < 7.5 +2020-04-30 05:52:23 Test: Checking AllowTcpForwarding in /tmp/lynis.k8JwazmKc6 +2020-04-30 05:52:23 Result: Option AllowTcpForwarding found +2020-04-30 05:52:23 Result: Option AllowTcpForwarding value is YES +2020-04-30 05:52:23 Result: OpenSSH option AllowTcpForwarding is in a weak configuration state and should be fixed +2020-04-30 05:52:23 Suggestion: Consider hardening SSH configuration [test:SSH-7408] [details:AllowTcpForwarding (set YES to NO)] [solution:-] +``` + +### 试试吧 + +如果你想更多地了解你的 Linux 机器的安全性,请试试 Lynis。如果你想了解 Lynis 是如何工作的,可以研究一下它的 shell 脚本,看看它是如何收集这些信息的。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/5/linux-security-lynis + +作者:[Gaurav Kamathe][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/gkamathe +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/yearbook-haff-rx-linux-file-lead_0.png?itok=-i0NNfDC (Hand putting a Linux file folder into a drawer) +[2]: https://github.com/CISOfy/lynis diff --git a/published/202010/20200521 Use the internet from the command line with curl.md b/published/202010/20200521 Use the internet from the command line with curl.md new file mode 100644 index 0000000000..9880cead4e --- /dev/null +++ b/published/202010/20200521 Use the internet from the command line with curl.md @@ -0,0 +1,171 @@ +[#]: collector: (lujun9972) +[#]: translator: (MjSeven) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12772-1.html) +[#]: subject: (Use the internet from the command line with curl) +[#]: via: (https://opensource.com/article/20/5/curl-cheat-sheet) +[#]: author: (Seth Kenlon https://opensource.com/users/seth) + +使用 curl 从命令行访问互联网 +====== + +> 下载我们整理的 curl 备忘录。要在不使用图形界面的情况下从互联网上获取所需的信息,curl 是一种快速有效的方法。 + +![](https://img.linux.net.cn/data/attachment/album/202010/31/000543n032ud499yy4d94v.jpg) + +`curl` 通常被视作一款非交互式 Web 浏览器,这意味着它能够从互联网上获取信息,并在你的终端中显示,或将其保存到文件中。从表面看,这是 Web 浏览器,类似 Firefox 或 Chromium 所做的工作,只是它们默认情况下会*渲染*信息,而 `curl` 会下载并显示原始信息。实际上,`curl` 命令可以做更多的事情,并且能够使用多种协议与服务器进行双向传输数据,这些协议包括 HTTP、FTP、SFTP、IMAP、POP3、LDAP、SMB、SMTP 等。对于普通终端用户来说,这是一个有用的工具;而对于系统管理员,这非常便捷;对于微服务和云开发人员来说,它是一个质量保证工具。 + +`curl` 被设计为在没有用户交互的情况下工作,因此与 Firefox 不同,你必须从头到尾考虑与在线数据的交互。例如,如果想要在 Firefox 中查看网页,你需要启动 Firefox 窗口。打开 Firefox 后,在地址栏或搜索引擎中输入要访问的网站。然后,导航到网站,然后单击要查看的页面。 + +对于 `curl` 来说也是如此,不同之处在于你需要一次执行所有操作:在启动 `curl` 的同时提供需要访问的互联网地址,并告诉它是否要将数据保存在终端或文件中。当你必须与需要身份验证的网站或 API 进行交互时,会变得有点复杂,但是一旦你学习了 `curl` 命令语法,它就会变得自然而然。为了帮助你掌握它,我们在一个方便的[备忘录][2]中收集了相关的语法信息。 + +### 使用 curl 下载文件 + +你可以通过提供指向特定 URL 的链接来使用 `curl` 命令下载文件。如果你提供的 URL 默认为 `index.html`,那么将下载此页面,并将下载的文件显示在终端屏幕上。你可以将数据通过管道传递到 `less`、`tail` 或任何其它命令: + +``` +$ curl "http://example.com" | tail -n 4 +

        Example Domain

        +

        This domain is for use in illustrative examples in documents. You may use this domain in literature without prior coordination or asking for permission.

        +

        More information...

        +
      +``` + +由于某些 URL 包含特殊字符,shell 通常会将其解释,因此最安全的做法用引号将 URL 包起来。 + +某些文件无法很好的在终端中转换显示。你可以使用 `--remote-name` 选项使文件根据服务器上的命名进行保存: + +``` +$ curl --remote-name "https://example.com/linux-distro.iso" +$ ls +linux-distro.iso +``` + +或者,你可以使用 `--output` 选项来命名你想要下载的内容: + +``` +curl "http://example.com/foo.html" --output bar.html +``` + +### 使用 curl 列出带有远程目录的内容 + +因为 `curl` 不是交互式的,所以很难浏览页面上的可下载元素。如果你要连接的远程服务器允许,可以使用 `curl` 来列出目录的内容: + +``` +$ curl --list-only "https://example.com/foo/" +``` + +### 继续中断下载 + +如果你正在下载一个非常大的文件,你可能会发现有时候必须中断下载。`curl` 非常智能,可以确定下载从何处中断并继续下载。这意味着,下一次当你下载一个 4GB 的 Linux 发行版的 ISO 出现问题时,就不必重新开始了。`--continue-at` 的语法有点不寻常:如果你知道下载中断时的字节数,你可以提供给 `curl`;否则,你可以使用单独的一个破折号(`-`)指示 curl 自动检测: + +``` +$ curl --remote-name --continue-at - "https://example.com/linux-distro.iso" +``` + +### 下载文件序列 + +如果你需要下载多个文件而不是一个大文件,那么 `curl` 可以帮助你解决这个问题。假设你知道要下载的文件的位置和文件名模式,则可以使用 `curl` 的序列标记:中括号里是整数范围的起点和终点。对于输出文件名,使用 `#1` 表示第一个变量: + +``` +$ curl "https://example.com/file_[1-4].webp" --output "file_#1.webp" +``` + +如果你需要使用其它变量来表示另一个序列,按照每个变量在命令中出现的顺序表示它们。例如,在这个命令中,`#1` 指目录 `images_000` 到 `images_009`,而 `#2` 指目录 `file_1.webp` 至 `file_4.webp`: + +``` +$ curl "https://example.com/images_00[0-9]/file_[1-4].webp" --output "file_#1-#2.webp" +``` + +### 从站点下载所有 PNG 文件 + +你也可以仅使用 `curl` 和 `grep` 进行一些基本的 Web 抓取操作,以找到想要下载的内容。例如,假设你需要下载与正在归档网页关联的所有图像,首先,下载引用了图像的页面。将页面内通过管道传输到 `grep`,搜索所需的图片类型(在此示例中为 PNG)。最后,创建一个 `while` 循环来构造下载 URL,并将文件保存到你的计算机: + +``` +$ curl https://example.com |\ +grep --only-matching 'src="[^"]*.[png]"' |\ +cut -d\" -f2 |\ +while read i; do \ +curl https://example.com/"${i}" -o "${i##*/}"; \ +done +``` + +这只是一个示例,但它展示了 `curl` 与 Unix 管道和一些基本而巧妙的解析结合使用时是多么的灵活。 + +### 获取 HTML 头 + +用于数据交换的协议在计算机发送通信的数据包中嵌入了大量元数据。HTTP 头是数据初始部分的组件。在连接一个网站出现问题时,查看这些报文头(尤其是响应码)会有所帮助: + +``` +curl --head "https://example.com" +HTTP/2 200 +accept-ranges: bytes +age: 485487 +cache-control: max-age=604800 +content-type: text/html; charset=UTF-8 +date: Sun, 26 Apr 2020 09:02:09 GMT +etag: "3147526947" +expires: Sun, 03 May 2020 09:02:09 GMT +last-modified: Thu, 17 Oct 2019 07:18:26 GMT +server: ECS (sjc/4E76) +x-cache: HIT +content-length: 1256 +``` + +### 快速失败 + +响应 200 通常是 HTTP 成功指示符,这是你与服务器连接时通常期望的结果。著名的 404 响应表示找不到页面,而 500 则表示服务器在处理请求时出现了错误。 + +要查看协商过程中发生了什么错误,添加 `--show-error` 选项: + +``` +$ curl --head --show-error "http://opensource.ga" +``` + +除非你可以访问要连接的服务器,否则这些问题将很难解决,但是 `curl` 通常会尽力连接你指定的地址。有时在网络上进行测试时,无休止的重试似乎只会浪费时间,因此你可以使用 `--fail-early` 选项来强制 `curl` 在失败时迅速退出: + +``` +curl --fail-early "http://opensource.ga" +``` + +### 由 3xx 响应指定的重定向查询 + +300 这个系列的响应更加灵活。具体来说,301 响应意味着一个 URL 已被永久移动到其它位置。对于网站管理员来说,重新定位内容并留下“痕迹”是一种常见的方式,这样访问旧地址的人们仍然可以找到它。默认情况下,`curl` 不会进行 301 重定向,但你可以使用 `--localtion` 选项使其继续进入 301 响应指向的目标: + +``` +$ curl "https://iana.org" | grep title +301 Moved Permanently +$ curl --location "https://iana.org" +Internet Assigned Numbers Authority +``` + +### 展开短网址 + +如果你想要在访问短网址之前先查看它们,那么 `--location` 选项非常有用。短网址对于有字符限制的社交网络(当然,如果你使用[现代和开源的社交网络][4]的话,这可能不是问题),或者对于用户不能复制粘贴长地址的印刷媒体来说是有用处的。但是,它们也可能存在风险,因为其目的地址本质上是隐藏的。通过结合使用 `--head` 选项仅查看 HTTP 头,`--location` 选项可以查看一个 URL 的最终地址,你可以查看一个短网址而无需加载其完整的资源: + +``` +$ curl --head --location "" +``` + +### 下载我们的 curl 备忘录 + +一旦你开始考虑了将探索 web 由一条命令来完成,那么 `curl` 就成为一种快速有效的方式,可以从互联网上获取所需的信息,而无需麻烦图形界面。为了帮助你适应到工作流中,我们创建了一个 [curl 备忘录][2],它包含常见的 `curl` 用法和语法,包括使用它查询 API 的概述。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/5/curl-cheat-sheet + +作者:[Seth Kenlon][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/seth +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/coverimage_cheat_sheet.png?itok=lYkNKieP (Cheat Sheet cover image) +[2]: https://opensource.com/downloads/curl-command-cheat-sheet +[3]: https://www.iana.org/domains/example"\>More +[4]: https://opensource.com/article/17/4/guide-to-mastodon diff --git a/published/202010/20200629 Using Bash traps in your scripts.md b/published/202010/20200629 Using Bash traps in your scripts.md new file mode 100644 index 0000000000..361a1aba6b --- /dev/null +++ b/published/202010/20200629 Using Bash traps in your scripts.md @@ -0,0 +1,142 @@ +[#]: collector: (lujun9972) +[#]: translator: (HankChow) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12715-1.html) +[#]: subject: (Using Bash traps in your scripts) +[#]: via: (https://opensource.com/article/20/6/bash-trap) +[#]: author: (Seth Kenlon https://opensource.com/users/seth) + +在脚本中使用 Bash 信号捕获 +====== + +> 无论你的脚本是否成功运行,信号捕获trap都能让它平稳结束。 + +![](https://img.linux.net.cn/data/attachment/album/202010/13/182135f2nktcrnryncisg8.jpg) + +Shell 脚本的启动并不难被检测到,但 Shell 脚本的终止检测却并不容易,因为我们无法确定脚本会按照预期地正常结束,还是由于意外的错误导致失败。当脚本执行失败时,将正在处理的内容记录下来是非常有用的做法,但有时候这样做起来并不方便。而 [Bash][2] 中 `trap` 命令的存在正是为了解决这个问题,它可以捕获到脚本的终止信号,并以某种预设的方式作出应对。 + +### 响应失败 + +如果出现了一个错误,可能导致发生一连串错误。下面示例脚本中,首先在 `/tmp` 中创建一个临时目录,这样可以在临时目录中执行解包、文件处理等操作,然后再以另一种压缩格式进行打包: + +``` +#!/usr/bin/env bash +CWD=`pwd` +TMP=${TMP:-/tmp/tmpdir} + +## create tmp dir +mkdir "${TMP}" + +## extract files to tmp +tar xf "${1}" --directory "${TMP}" + +## move to tmpdir and run commands +pushd "${TMP}" +for IMG in *.jpg; do + mogrify -verbose -flip -flop "${IMG}" +done +tar --create --file "${1%.*}".tar *.jpg + +## move back to origin +popd + +## bundle with bzip2 +bzip2 --compress "${TMP}"/"${1%.*}".tar \ + --stdout > "${1%.*}".tbz + +## clean up +/usr/bin/rm -r /tmp/tmpdir +``` + +一般情况下,这个脚本都可以按照预期执行。但如果归档文件中的文件是 PNG 文件而不是期望的 JPEG 文件,脚本就会在中途失败,这时候另一个问题就出现了:最后一步删除临时目录的操作没有被正常执行。如果你手动把临时目录删掉,倒是不会造成什么影响,但是如果没有手动把临时目录删掉,在下一次执行这个脚本的时候,它必须处理一个现有的临时目录,里面充满了不可预知的剩余文件。 + +其中一个解决方案是在脚本开头增加一个预防性删除逻辑用来处理这种情况。但这种做法显得有些暴力,而我们更应该从结构上解决这个问题。使用 `trap` 是一个优雅的方法。 + +### 使用 trap 捕获信号 + +我们可以通过 `trap` 捕捉程序运行时的信号。如果你使用过 `kill` 或者 `killall` 命令,那你就已经使用过名为 `SIGTERM` 的信号了。除此以外,还可以执行 `trap -l` 或 `trap --list` 命令列出其它更多的信号: + +``` +$ trap --list + 1) SIGHUP       2) SIGINT       3) SIGQUIT      4) SIGILL       5) SIGTRAP + 6) SIGABRT      7) SIGBUS       8) SIGFPE       9) SIGKILL     10) SIGUSR1 +11) SIGSEGV     12) SIGUSR2     13) SIGPIPE     14) SIGALRM     15) SIGTERM +16) SIGSTKFLT   17) SIGCHLD     18) SIGCONT     19) SIGSTOP     20) SIGTSTP +21) SIGTTIN     22) SIGTTOU     23) SIGURG      24) SIGXCPU     25) SIGXFSZ +26) SIGVTALRM   27) SIGPROF     28) SIGWINCH    29) SIGIO       30) SIGPWR +31) SIGSYS      34) SIGRTMIN    35) SIGRTMIN+1  36) SIGRTMIN+2  37) SIGRTMIN+3 +38) SIGRTMIN+4  39) SIGRTMIN+5  40) SIGRTMIN+6  41) SIGRTMIN+7  42) SIGRTMIN+8 +43) SIGRTMIN+9  44) SIGRTMIN+10 45) SIGRTMIN+11 46) SIGRTMIN+12 47) SIGRTMIN+13 +48) SIGRTMIN+14 49) SIGRTMIN+15 50) SIGRTMAX-14 51) SIGRTMAX-13 52) SIGRTMAX-12 +53) SIGRTMAX-11 54) SIGRTMAX-10 55) SIGRTMAX-9  56) SIGRTMAX-8  57) SIGRTMAX-7 +58) SIGRTMAX-6  59) SIGRTMAX-5  60) SIGRTMAX-4  61) SIGRTMAX-3  62) SIGRTMAX-2 +63) SIGRTMAX-1  64) SIGRTMAX +``` + +可以被 `trap` 识别的信号除了以上这些,还包括: + + * `EXIT`:进程退出时发出的信号 + * `ERR`:进程以非 0 状态码退出时发出的信号 + * `DEBUG`:表示调试模式的布尔值 + +如果要在 Bash 中实现信号捕获,只需要在 `trap` 后加上需要执行的命令,再加上需要捕获的信号列表就可以了。 + +例如,下面的这行语句可以捕获到在进程运行时用户按下 `Ctrl + C` 组合键发出的 `SIGINT` 信号: + +``` +trap "{ echo 'Terminated with Ctrl+C'; }" SIGINT +``` + +因此,上文中脚本的缺陷可以通过使用 `trap` 捕获 `SIGINT`、`SIGTERM`、进程错误退出、进程正常退出等信号,并正确处理临时目录的方式来修复: + +``` +#!/usr/bin/env bash +CWD=`pwd` +TMP=${TMP:-/tmp/tmpdir} + +trap \ + "{ /usr/bin/rm -r "${TMP}" ; exit 255; }" \ + SIGINT SIGTERM ERR EXIT + +## create tmp dir +mkdir "${TMP}" +tar xf "${1}" --directory "${TMP}" + +## move to tmp and run commands +pushd "${TMP}" +for IMG in *.jpg; do + mogrify -verbose -flip -flop "${IMG}" +done +tar --create --file "${1%.*}".tar *.jpg + +## move back to origin +popd + +## zip tar +bzip2 --compress $TMP/"${1%.*}".tar \ + --stdout > "${1%.*}".tbz +``` + +对于更复杂的功能,还可以用 [Bash 函数][3]来简化 `trap` 语句。 + +### Bash 中的信号捕获 + +信号捕获可以让脚本在无论是否成功执行所有任务的情况下都能够正确完成清理工作,能让你的脚本更加可靠,这是一个很好的习惯。尽管尝试把信号捕获加入到你的脚本里看看能够起到什么作用吧。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/6/bash-trap + +作者:[Seth Kenlon][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/seth +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/programming-code-keyboard-laptop.png?itok=pGfEfu2S (Hands programming) +[2]: https://opensource.com/resources/what-bash +[3]: https://opensource.com/article/20/6/how-write-functions-bash diff --git a/published/202010/20200723 Automate testing for website errors with this Python tool.md b/published/202010/20200723 Automate testing for website errors with this Python tool.md new file mode 100644 index 0000000000..5b0284b231 --- /dev/null +++ b/published/202010/20200723 Automate testing for website errors with this Python tool.md @@ -0,0 +1,140 @@ +[#]: collector: "lujun9972" +[#]: translator: "lxbwolf" +[#]: reviewer: "wxy" +[#]: publisher: "wxy" +[#]: url: "https://linux.cn/article-12700-1.html" +[#]: subject: "Automate testing for website errors with this Python tool" +[#]: via: "https://opensource.com/article/20/7/seodeploy" +[#]: author: "JR Oakes https://opensource.com/users/jroakes" + +使用这个 Python 工具对网站 SEO 问题进行自动化测试 +====== + +> SEODeploy 可以帮助我们在网站部署之前识别出 SEO 问题。 + +![](https://img.linux.net.cn/data/attachment/album/202010/09/194928xbqvdd81amapgdae.jpg) + +作为一个技术性搜索引擎优化开发者,我经常被请来协助做网站迁移、新网站发布、分析实施和其他一些影响网站在线可见性和测量等领域,以控制风险。许多公司每月经常性收入的很大一部分来自用户通过搜索引擎找到他们的产品和服务。虽然搜索引擎已经能妥善地处理没有被良好格式化的代码,但在开发过程中还是会出问题,对搜索引擎如何索引和为用户显示页面产生不利影响。 + +我曾经也尝试通过评审各阶段会破坏 SEO(搜索引擎优化search engine optimization)的问题来手动降低这种风险。我的团队最终审查到的结果,决定了该项目是否可以上线。但这个过程通常很低效,只能用于有限的页面,而且很有可能出现人为错误。 + +长期以来,这个行业一直在寻找可用且值得信赖的方式来自动化这一过程,同时还能让开发人员和搜索引擎优化人员在必须测试的内容上获得有意义的发言权。这是非常重要的,因为这些团队在开发冲刺中优先级通常会发生冲突,搜索引擎优化者需要推动变化,而开发人员需要控制退化和预期之外的情况。 + +### 常见的破坏 SEO 的问题 + +我合作过的很多网站有成千上万的页面,甚至上百万。实在令人费解,为什么一个开发过程中的改动能影响这么多页面。在 SEO 的世界中,Google 或其他搜索引擎展示你的页面时,一个非常微小和看起来无关紧要的修改也可能导致全网站范围的变化。在部署到生产环境之前,必须要处理这类错误。 + +下面是我去年见过的几个例子。 + +#### 偶发的 noindex + +在部署到生产环境之后,我们用的一个专用的第三方 SEO 监控工具 [ContentKing][2] 马上发现了这个问题。这个错误很隐蔽,因为它在 HTML 中是不可见的,确切地说,它隐藏在服务器响应头里,但它能很快导致搜索不可见。 + +``` +HTTP/1.1 200 OK +Date: Tue May 25 2010 21:12:42 GMT +[...] +X-Robots-Tag: noindex +[...] +``` + +#### canonical 小写 + +上线时错误地把整个网站的 [canonical 链接元素][3]全改成小写了。这个改动影响了接近 30000 个 URL。在修改之前,所有的 URL 大小写都正常(例如 `URL-Path` 这样)。这之所以是个问题是因为 `canonical` 链接元素是用来给 Google 提示一个网页真实的规范 URL 版本的。这个改动导致很多 URL 被从 Google 的索引中移除并用小写的版本(`/url-path`)重新建立索引。影响范围是流量损失了 10% 到 15%,也污染了未来几个星期的网页监控数据。 + +#### 源站退化 + +有个网站的 React 实现复杂而奇特,它有个神奇的问题,`origin.domain.com` URL 退化显示为 CDN 服务器的源站。它会在网站元数据(如 `canonical` 链接元素、URL 和 Open Graph 链接)中间歇性地显示原始的主机而不是 CDN 边缘主机。这个问题在原始的 HTML 和渲染后的 HTML 中都存在。这个问题影响搜索的可见性和在社交媒体上的分享质量。 + +### SEODeploy 介绍 + +SEO 通常使用差异测试工具来检测渲染后和原始的 HTML 的差异。差异测试是很理想的,因为它避免了肉眼测试的不确定性。你希望检查 Google 对你的页面的渲染过程的差异,而不是检查用户对你页面的渲染。你希望查看下原始的 HTML 是什么样的,而不是渲染后的 HTML,因为 Google 的渲染过程是有独立的两个阶段的。 + +这促使我和我的同事创造了 [SEODeploy][4] 这个“在部署流水线中用于自动化 SEO 测试的 Python 库。”我们的使命是: + +> 开发一个工具,让开发者能提供若干 URL 路径,并允许这些 URL 在生产环境和预演环境的主机上进行差异测试,尤其是对 SEO 相关数据的非预期的退化。 + +SEODeploy 的机制很简单:提供一个每行内容都是 URL 路径的文本文件,SEODeploy 对那些路径运行一系列模块,对比生产环境production预演环境staging的 URL,把检测到的所有的错误和改动信息报告出来。 + +![SEODeploy overview][5] + +这个工具及其模块可以用一个 YAML 文件来配置,可以根据预期的变化进行定制。 + +![SEODeploy output][7] + +最初的发布版本包含下面的的核心功能和概念: + + 1. **开源**:我们坚信分享代码可以被大家批评、改进、扩展、分享和复用。 + 2. **模块化**:Web 开发中有许多不同的堆栈和边缘案例。SEODeploy 工具在概念上很简单,因此采用模块化用来控制复杂性。我们提供了两个建好的模块和一个实例模块来简述基本结构。 + 3. **URL 抽样**:由于它不是对所有 URL 都是可行和有效的,因此我们引入了一种随机抽取 XML 网站地图 URL 或被 ContentKing 监控的 URL 作为样本的方法。 + 4. **灵活的差异检测**:Web 数据是凌乱的。无论被检测的数据是什么类型(如 ext、数组或列表、JSON 对象或字典、整数、浮点数等等),差异检测功能都会尝试将这些数据转换为差异信息。 + 5. **自动化**: 你可以在命令行来调用抽样和运行方法,将 SEODeploy 融合到已有的流水线也很简单。 + +### 模块 + +虽然核心功能很简单,但在设计上,SEODeploy 的强大功能和复杂度体现在模块上。模块用来处理更难的任务:获取、清理和组织预演服务器和生产服务器上的数据来作对比。 + +#### Headless 模块 + +[Headless 模块][8] 是为那些从库里获取数据时不想为第三方服务付费的开发者准备的。它可以运行任意版本的 Chrome,会从每组用来比较的 URL 中提取渲染的数据。 + +Headless 模块会提取下面的核心数据用来比较: + + 1. SEO 内容,如标题、H1-H6、链接等等。 + 2. 从 Chrome 计时器Timings和 CDP(Chrome 开发工具协议Chrome DevTools Protocol)性能 API 中提取性能数据 + 3. 计算出的性能指标,包括 CLS(累积布局偏移Cumulative Layout Shift),这是 Google 最近发布的一个很受欢迎的 [Web 核心数据][9] + 4. 从上述 CDP 的覆盖率 API 获取的 CSS 和 JavaScript 的覆盖率数据 + +这个模块引入了处理预演环境、网络速度预设(为了让对比更规范化)等功能,也引入了一个处理在预演对比数据中替换预演主机的方法。开发者也能很容易地扩展这个模块,以收集他们想要在每个页面上进行比较的任何其他数据。 + +#### 其他模块 + +我们为开发者创建了一个[示例模块][10],开发者可以参照它来使用框架创建一个自定义的提取模块。另一个示例模块是与 ContentKing 结合的。ContentKing 模块需要有 ContentKing 订阅,而 Headless 可以在所有能运行 Chrome 的机器上运行。 + +### 需要解决的问题 + +我们有扩展和强化工具库的[计划][11],但正在寻求开发人员的[反馈][12],了解哪些是可行的,哪些是不符合他们的需求。我们正在解决的问题和条目有: + + 1. 对于某些对比元素(尤其是 schema),动态时间戳会产生误报。 + 2. 把测试数据保存到数据库,以便查看部署历史以及与上次的预演推送进行差异测试。 + 3. 通过云基础设施的渲染,强化提取的规模和速度。 + 4. 把测试覆盖率从现在的 46% 提高到 99% 以上。 + 5. 目前,我们依赖 [Poetry][13] 进行部署管理,但我们希望发布一个 PyPl 库,这样就可以用 `pip install` 轻松安装。 + 6. 我们还在关注更多使用时的问题和相关数据。 + +### 开始使用 + +这个项目在 [GitHub][4] 上,我们对大部分功能都提供了 [文档][14]。 + +我们希望你能克隆 SEODeploy 并试试它。我们的目标是通过这个由技术性搜索引擎优化开发者开发的、经过开发者和工程师们验证的工具来支持开源社区。我们都见过验证复杂的预演问题需要多长时间,也都见过大量 URL 的微小改动能有什么样的业务影响。我们认为这个库可以为开发团队节省时间、降低部署过程中的风险。 + +如果你有问题或者想提交代码,请查看项目的[关于][15]页面。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/7/seodeploy + +作者:[JR Oakes][a] +选题:[lujun9972][b] +译者:[lxbwolf](https://github.com/lxbwolf) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/jroakes +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/browser_screen_windows_files.png?itok=kLTeQUbY "Computer screen with files or windows open" +[2]: https://www.contentkingapp.com/ +[3]: https://en.wikipedia.org/wiki/Canonical_link_element +[4]: https://github.com/locomotive-agency/SEODeploy +[5]: https://opensource.com/sites/default/files/uploads/seodeploy.png "SEODeploy overview" +[6]: https://creativecommons.org/licenses/by-sa/4.0/ +[7]: https://opensource.com/sites/default/files/uploads/seodeploy_output.png "SEODeploy output" +[8]: https://locomotive-agency.github.io/SEODeploy/modules/headless/ +[9]: https://web.dev/vitals/ +[10]: https://locomotive-agency.github.io/SEODeploy/modules/creating/ +[11]: https://locomotive-agency.github.io/SEODeploy/todo/ +[12]: https://locomotive-agency.github.io/SEODeploy/about/#contact +[13]: https://python-poetry.org/ +[14]: https://locomotive-agency.github.io/SEODeploy/ +[15]: https://locomotive-agency.github.io/SEODeploy/about/ diff --git a/published/202010/20200810 How to read Lynis reports to improve Linux security.md b/published/202010/20200810 How to read Lynis reports to improve Linux security.md new file mode 100644 index 0000000000..41188a41c1 --- /dev/null +++ b/published/202010/20200810 How to read Lynis reports to improve Linux security.md @@ -0,0 +1,216 @@ +[#]: collector: (lujun9972) +[#]: translator: (wxy) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12697-1.html) +[#]: subject: (How to read Lynis reports to improve Linux security) +[#]: via: (https://opensource.com/article/20/8/linux-lynis-security) +[#]: author: (Alan Formy-Duval https://opensource.com/users/alanfdoss) + +如何阅读 Lynis 报告提高 Linux 安全性 +====== + +> 使用 Lynis 的扫描和报告来发现和修复 Linux 安全问题。 + +![](https://img.linux.net.cn/data/attachment/album/202010/08/102355k7jakojhz9x8xamx.jpg) + +当我读到 Gaurav Kamathe 的文章《[使用 Lynis 扫描 Linux 安全性][2]》时,让我想起了我在美国劳工部担任系统管理员的日子。我那时的职责之一是保证我们的 Unix 服务器的安全。每个季度,都会有一个独立的核查员来审查我们服务器的安全状态。每次在核查员预定到达的那一天,我都会运行 Security Readiness Review(SRR),这是一个扫描工具,它使用一大套脚本来识别和报告任何安全线索。SRR 是开源的,因此我可以查看所有源码脚本及其功能。这使我能够查看其代码,确定具体是什么问题,并迅速修复它发现的每个问题。 + +### 什么是 Lynis? + +[Lynis][3] 是一个开源的安全审计工具,它的工作原理和 SRR 很像,它会扫描 Linux 系统,并提供它发现的任何弱点的详细报告。同样和 SRR 一样,它也是由一大套脚本组成的,每个脚本都会检查一个特定的项目,例如,最小和最大密码时间要求。 + +运行 Lynis 后,你可以使用它的报告来定位每个项目的脚本,并了解 Lynis 是如何检查和报告每个问题的。你也可以使用相同的脚本代码来创建新的代码来自动解决。 + +### 如何阅读 Lynis 报告 + +由于 Gaurav 的文章介绍了 Lynis 的安装和使用,在本文中,我将展示一些如何阅读和使用其报告的例子。 + +请从运行一次审计开始: + +``` +# lynis audit system --quick +``` + +完成后,完整的报告将显示在你的屏幕上。在底部,“Suggestions” 部分列出了所有可能需要修复以更好地加固系统的项目,以及每个项目的 TEST-ID。 + +要想加固系统并减少列表的大小,请开始解决每个项目。在 “Suggestions” 部分的描述可能包含了你需要采取的全部行动。如果没有,你可以使用 `show details` 命令。 + +``` +# lynis show details TEST-ID +``` + +例如,在我的系统中,有一条建议是: + +> 找不到 `locate` 所需的数据库,运行 `updatedb` 或 `locate.updatedb` 来创建这个文件。[FILE-6410] + +看起来我只需要运行 `updatedb` 命令就行,但如果我想确定一下,我可以使用 Lynis 的 `show details` 选项。 + +``` +# lynis show details FILE-6410 +2020-06-16 20:54:33 Performing test ID FILE-6410 (Checking Locate database) +2020-06-16 20:54:33 Test: Checking locate database +2020-06-16 20:54:33 Result: file /var/lib/mlocate/mlocate.db not found +2020-06-16 20:54:33 Result: file /var/lib/locate/locatedb not found +2020-06-16 20:54:33 Result: file /var/lib/locatedb not found +2020-06-16 20:54:33 Result: file /var/lib/slocate/slocate.db not found +2020-06-16 20:54:33 Result: file /var/cache/locate/locatedb not found +2020-06-16 20:54:33 Result: file /var/db/locate.database not found +2020-06-16 20:54:33 Result: database not found +2020-06-16 20:54:33 Suggestion: The database required for 'locate' could not be found. Run 'updatedb' or 'locate.updatedb' to create this file. [test:FILE-6410] [details:-] [solution:-] +2020-06-16 20:54:33 ==== +``` + +这些细节表明 Lynis 无法找到各种文件。这个情况描述的非常清楚。我可以运行 `updatedb` 命令,然后重新检查这个测试。 + +``` +# updatedb +# lynis --tests FILE-6410 +``` + +重新检查细节时,会显示它发现哪个文件满足了测试: + +``` +# lynis show details FILE-6410 +2020-06-16 21:38:40 Performing test ID FILE-6410 (Checking Locate database) +2020-06-16 21:38:40 Test: Checking locate database +2020-06-16 21:38:40 Result: locate database found (/var/lib/mlocate/mlocate.db) +2020-06-16 21:38:40 Result: file /var/lib/locate/locatedb not found +2020-06-16 21:38:40 Result: file /var/lib/locatedb not found +2020-06-16 21:38:40 Result: file /var/lib/slocate/slocate.db not found +2020-06-16 21:38:40 Result: file /var/cache/locate/locatedb not found +2020-06-16 21:38:40 Result: file /var/db/locate.database not found +2020-06-16 21:38:40 ==== +``` + +### 深入挖掘 + +Lynis 的许多建议并不像这个建议那样直接。如果你不确定某个发现或建议指的是什么,就很难知道如何解决问题。假设你在一个新的 Linux 服务器上运行 Lynis,有几项与 SSH 守护进程有关的内容,其中一项是关于 `MaxAuthTries` 的设置: + +``` +* Consider hardening SSH configuration [SSH-7408] + - Details : MaxAuthTries (6 --> 3) + https://cisofy.com/lynis/controls/SSH-7408/ +``` + +要解决这个问题,你需要知道 SSH 配置文件的位置。一个经验丰富的 Linux 管理员可能已经知道在哪里找到它们,但如果你不知道,有一个方法可以看到 Lynis 在哪里找到它们。 + +#### 定位 Lynis 测试脚本 + +Lynis 支持多种操作系统,因此你的安装位置可能有所不同。在 Red Hat Enterprise Linux 或 Fedora Linux 系统中,使用 `rpm` 命令来查找测试文件: + +``` +# rpm -ql lynis +``` + +这将列出所有测试文件,并报告它们在 `lynis/include` 目录下的位置。在这个目录下搜索你想知道的 TEST-ID(本例中为 SSH-7408): + +``` +# grep SSH-7408 /usr/share/lynis/include/* +/usr/share/lynis/include/tests_ssh:    # Test        : SSH-7408 +``` + +#### 查找 SSH 问题 + +名为 `tests_ssh` 的文件中包含了 TEST-ID,在这里可以找到与 SSH 相关的扫描函数。看看这个文件,就可以看到 Lynis 扫描器调用的各种函数。第一部分在一个名为 `SSH_DAEMON_CONFIG_LOCS` 的变量中定义了一个目录列表。下面几节负责检查 SSH 守护进程的状态、定位它的配置文件,并识别它的版本。我在 SSH-7404 测试中找到了查找配置文件的代码,描述为 “确定 SSH 守护进程配置文件位置”。这段代码包含一个 `for` 循环,在列表中的项目中搜索一个名为 `sshd_config` 的文件。我可以用这个逻辑来自己进行搜索: + +``` +# find /etc /etc/ssh /usr/local/etc/ssh /opt/csw/etc/ssh -name sshd_config +/etc/ssh/sshd_config +/etc/ssh/sshd_config +find: ‘/usr/local/etc/ssh’: No such file or directory +find: ‘/opt/csw/etc/ssh’: No such file or directory +``` + +进一步探索这个文件,就会看到寻找 SSH-7408 的相关代码。这个测试涵盖了 `MaxAuthTries` 和其他一些设置。现在我可以在 SSH 配置文件中找到该变量: + +``` +# grep MaxAuthTries /etc/ssh/sshd_config +#MaxAuthTries 6 +``` + +#### 修复法律横幅问题 + +Lynis 还报告了一个与登录系统时显示的法律横幅有关的发现。在我的家庭桌面系统上(我并不希望有很多其他人登录),我没有去改变默认的 `issue` 文件。企业或政府的系统很可能被要求包含一个法律横幅,以警告用户他们的登录和活动可能被记录和监控。Lynis 用 BANN-7126 测试和 BANN-7130 测试报告了这一点: + +``` +* Add a legal banner to /etc/issue, to warn unauthorized users [BANN-7126] + https://cisofy.com/lynis/controls/BANN-7126/ + +* Add legal banner to /etc/issue.net, to warn unauthorized users [BANN-7130] + https://cisofy.com/lynis/controls/BANN-7130/ +``` + +我在运行 Fedora 32 工作站的系统上没有发现什么: + +``` +# cat /etc/issue /etc/issue.net +\S +Kernel \r on an \m (\l) + +\S +Kernel \r on an \m (\l) +``` + +我可以添加一些诸如 “keep out” 或 “don't break anything” 之类的内容,但测试的描述并没有提供足够的信息来解决这个问题,所以我又看了看 Lynis 的脚本。我注意到 `include` 目录下有一个叫 `tests_banners` 的文件;这似乎是一个很好的地方。在 `grep` 的帮助下,我看到了相关的测试: + +``` +# grep -E 'BANN-7126|BANN-7130' /usr/share/lynis/include/tests_banners +    # Test        : BANN-7126 +    Register --test-no BANN-7126 --preqs-met ${PREQS_MET} --weight L --network NO --category security --description "Check issue banner file contents" +    # Test        : BANN-7130 +    Register --test-no BANN-7130 --preqs-met ${PREQS_MET} --weight L --network NO --category security --description "Check issue.net banner file contents" +``` + +在检查了测试文件中的相关代码后,我发现这两个测试都是通过一个 `for` 循环来迭代一些预定义的法律术语: + +``` +for ITEM in ${LEGAL_BANNER_STRINGS}; do +``` + +这些法律术语存储在文件顶部定义的变量 `LEGAL_BANNER_STRINGS` 中。向后滚动到顶部可以看到完整的清单: + +``` +LEGAL_BANNER_STRINGS="audit access authori condition connect consent continu criminal enforce evidence forbidden intrusion law legal legislat log monitor owner penal policy policies privacy private prohibited record restricted secure subject system terms warning" +``` + +我最初的建议(“keep out” 或 “don't break anything”)不会满足这个测试,因为它们不包含这个列表中的任何单词。 + +下面这条横幅信息包含了几个必要的词,因此,它将满足这个测试,并防止 Lynis 报告它: + +> Attention, by continuing to connect to this system, you consent to the owner storing a log of all activity. Unauthorized access is prohibited. + +请注意,这条信息必须被添加到 `/etc/issue` 和 `/etc/issue.net` 中。 + +### 使其可重复 + +你可以手动进行这些编辑,但你可能要考虑自动化。例如,可能有许多设置需要更改,或者你可能需要在许多服务器上定期进行这些编辑。创建一个加固脚本将是简化这个过程的好方法。对于 SSH 配置,在你的加固脚本中的一些 `sed` 命令可以解决这些发现。或者,你可以使用 `echo` 语句来添加合法的横幅。 + +``` +sed -i '/MaxAuthTries/s/#MaxAuthTries 6/MaxAuthTries 3/' /etc/ssh/sshd_config + +echo "Legal Banner" | tee -a /etc/issue /etc/issue.net +``` + +自动化使你能够创建一个可重复的脚本,可以在你的基础设施中保存和管理。你也可以在你的初始服务器配置中加入这个脚本。 + +### 加固你的系统 + +这种类型的练习可以提高你的脚本技能,既可以跟着现有的代码走,也可以写自己的脚本。因为 Lynis 是开源的,所以你可以很容易地看到你的系统是如何被检查的,以及它的报告意味着什么。最终的结果将是一个完善的系统,你可以在审计人员来的时候随时向他们炫耀。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/8/linux-lynis-security + +作者:[Alan Formy-Duval][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/alanfdoss +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/security-lock-password.jpg?itok=KJMdkKum (Lock) +[2]: https://linux.cn/article-12696-1.html +[3]: https://github.com/CISOfy/lynis diff --git a/published/202010/20200811 TCP window scaling, timestamps and SACK.md b/published/202010/20200811 TCP window scaling, timestamps and SACK.md new file mode 100644 index 0000000000..cd47284eb7 --- /dev/null +++ b/published/202010/20200811 TCP window scaling, timestamps and SACK.md @@ -0,0 +1,304 @@ +[#]: collector: (lujun9972) +[#]: translator: (gxlct008) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12710-1.html) +[#]: subject: (TCP window scaling, timestamps and SACK) +[#]: via: (https://fedoramagazine.org/tcp-window-scaling-timestamps-and-sack/) +[#]: author: (Florian Westphal https://fedoramagazine.org/author/strlen/) + +TCP 窗口缩放、时间戳和 SACK +====== + +![](https://img.linux.net.cn/data/attachment/album/202010/12/114050up4695djpw6n4tu9.jpg) + +Linux TCP 协议栈具有无数个可以更改其行为的 `sysctl` 旋钮。 这包括可用于接收或发送操作的内存量、套接字的最大数量、可选的特性和协议扩展。 + +有很多文章出于各种“性能调优”或“安全性”原因,建议禁用 TCP 扩展,比如时间戳或选择性确认Selective ACKnowledgments(SACK)。 + +本文提供了这些扩展功能的背景,为什么会默认启用,它们之间是如何关联的,以及为什么通常情况下将它们关闭是个坏主意。 + +### TCP 窗口缩放 + +TCP 可以承受的数据传输速率受到几个因素的限制。其中包括: + +* 往返时间Round trip time(RTT)。 + + 这是数据包到达目的地并返回回复所花费的时间。越低越好。 +* 所涉及的网络路径的最低链路速度。 +* 丢包频率。 +* 新数据可用于传输的速度。 + + 例如,CPU 需要能够以足够快的速度将数据传递到网络适配器。如果 CPU 需要首先加密数据,则适配器可能必须等待新数据。同样地,如果磁盘存储不能足够快地读取数据,则磁盘存储可能会成为瓶颈。 +* TCP 接收窗口的最大可能大小。 + + 接收窗口决定了 TCP 在必须等待接收方报告接收到该数据之前可以传输多少数据(以字节为单位)。这是由接收方宣布的。接收方将在读取并确认接收到传入数据时不断更新此值。接收窗口的当前值包含在 [TCP 报头][2] 中,它是 TCP 发送的每个数据段的一部分。因此,只要发送方接收到来自对等方的确认,它就知道当前的接收窗口。这意味着往返时间(RTT)越长,发送方获得接收窗口更新所需的时间就越长。 + +TCP 的未确认(正在传输)数据被限制为最多 64KB。在大多数网络场景中,这甚至还不足以维持一个像样的数据速率。让我们看看一些例子。 + +**理论数据速率** + +在往返时间(RTT)为 100 毫秒的情况下,TCP 每秒最多可以传输 640KB。在延迟为 1 秒的情况下,最大理论数据速率降至只有 64KB/s。 + +这是因为接收窗口的原因。一旦发送了 64KB 的数据,接收窗口就已经满了。发送方必须等待,直到对等方通知它应用程序已经读取了至少一部分数据。 + +发送的第一个段会把 TCP 窗口缩减去该段的大小。在接收窗口值的更新信息可用之前,需要往返一次。当更新以 1 秒的延迟到达时,即使链路有足够的可用带宽,也会导致 64KB 的限制。 + +为了充分利用一个具有几毫秒延迟的快速网络,必须有一个比传统 TCP 支持的窗口更大的窗口。“64KB 限制”是协议规范的产物:TCP 头只为接收窗口大小保留了 16 个位。这允许接收窗口最大为 64KB。在 TCP 协议最初设计时,这个大小并没有被视为一个限制。 + +不幸的是,想通过仅仅更改 TCP 头来支持更大的最大窗口值是不可能的。如果这样做就意味着 TCP 的所有实现都必须同时更新,否则它们将无法相互理解。为了解决这个问题,我们改变了对接收窗口值的解释。 + +“窗口缩放选项”允许你改变这个解释,同时保持与现有实现的兼容性。 + +#### TCP 选项:向后兼容的协议扩展 + +TCP 支持可选扩展。这允许使用新特性增强协议,而无需立即更新所有实现。当 TCP 发起方连接到对等方时,它还会发送一个支持的扩展列表。所有扩展都遵循相同的格式:一个唯一的选项号,后跟选项的长度以及选项数据本身。 + +TCP 响应方检查连接请求中包含的所有选项号。如果它遇到一个不能理解的选项号,则会跳过 +该选项号附带的“长度”字节的数据,并检查下一个选项号。响应方忽略了从答复中无法理解的内容。这使发送方和接收方都够理解所支持的公共选项集。 + +使用窗口缩放时,选项数据总是由单个数字组成。 + +### 窗口缩放选项 + +``` +Window Scale option (WSopt): Kind: 3, Length: 3 +    +---------+---------+---------+ +    | Kind=3  |Length=3 |shift.cnt| +    +---------+---------+---------+ +         1         1         1 +``` + +[窗口缩放][3] 选项告诉对等方,应该使用给定的数字缩放 TCP 标头中的接收窗口值,以获取实际大小。 + +例如,一个宣告窗口缩放因子为 7 的 TCP 发起方试图指示响应方,任何将来携带接收窗口值为 512 的数据包实际上都会宣告 65536 字节的窗口。增加了 128 倍(2^7)。这将允许最大为 8MB 的 TCP 窗口。 + +不能理解此选项的 TCP 响应方将会忽略它,为响应连接请求而发送的 TCP 数据包(SYN-ACK)不会包含该窗口缩放选项。在这种情况下,双方只能使用 64k 的窗口大小。幸运的是,默认情况下,几乎每个 TCP 栈都支持并默认启用了此选项,包括 Linux。 + +响应方包括了它自己所需的缩放因子。两个对等方可以使用不同的因子。宣布缩放因子为 0 也是合法的。这意味着对等方应该如实处理它接收到的接收窗口值,但它允许应答方向上的缩放值,然后接收方可以使用更大的接收窗口。 + +与 SACK 或 TCP 时间戳不同,窗口缩放选项仅出现在 TCP 连接的前两个数据包中,之后无法更改。也不可能通过查看不包含初始连接三次握手的连接的数据包捕获来确定缩放因子。 + +支持的最大缩放因子为 14。这将允许 TCP 窗口的大小高达 1GB。 + +**窗口缩放的缺点** + +在非常特殊的情况下,它可能导致数据损坏。但在你禁用该选项之前,要知道通常情况下是不可能损坏的。还有一种解决方案可以防止这种情况。不幸的是,有些人在没有意识到它与窗口缩放的关系的情况下禁用了该解决方案。首先,让我们看一下需要解决的实际问题。想象以下事件序列: + + 1. 发送方发送段:s_1、s_2、s_3、... s_n。 + 2. 接收方看到:s_1、s_3、... s_n,并发送对 s_1 的确认。 + 3. 发送方认为 s_2 丢失,然后再次发送。它还发送了段 s_n+1 中包含的新数据。 + 4. 接收方然后看到:s_2、s_n+1,s_2:数据包 s_2 被接收两次。 + +当发送方过早触发重新传输时,可能会发生这种情况。在正常情况下,即使使用窗口缩放,这种错误的重传也绝不会成为问题。接收方将只丢弃重复项。 + +#### 从旧数据到新数据 + +TCP 序列号最多可以为 4GB。如果它变得大于此值,则该序列会回绕到 0,然后再次增加。这本身不是问题,但是如果这种问题发生得足够快,则上述情况可能会造成歧义。 + +如果在正确的时刻发生回绕,则序列号 s_2(重新发送的数据包)可能已经大于 s_n+1。因此,在最后的步骤(4)中,接收方可以将其解释为:s_2、s_n+1、s_n+m,即它可以将 “旧” 数据包 s_2 视为包含新数据。 + +通常,这不会发生,因为即使在高带宽链接上,“回绕”也只会每隔几秒钟或几分钟发生一次。原始数据包和不需要的重传的数据包之间的间隔将小得多。 + +例如,对于 50MB/s 的传输速度,重复项要迟到一分钟以上才会成为问题。序列号的回绕速度没有快到让小的延迟会导致这个问题。 + +一旦 TCP 达到 “GB/s” 的吞吐率,序列号的回绕速度就会非常快,以至于即使只有几毫秒的延迟也可能会造成 TCP 无法检测出的重复项。通过解决接收窗口太小的问题,TCP 现在可以用于以前无法实现的网络速度,这会产生一个新的,尽管很少见的问题。为了在 RTT 非常低的环境中安全使用 GB/s 的速度,接收方必须能够检测到这些旧的重复项,而不必仅依赖序列号。 + +### TCP 时间戳 + +#### 最佳截止日期 + +用最简单的术语来说,[TCP 时间戳][3]只是在数据包上添加时间戳,以解决由非常快速的序列号回绕引起的歧义。如果一个段看起来包含新数据,但其时间戳早于上一个在接收窗口内的数据包,则该序列号已被重新回绕,而“新”数据包实际上是一个较旧的重复项。这解决了即使在极端情况下重传的歧义。 + +但是,该扩展不仅仅是检测旧数据包。TCP 时间戳的另一个主要功能是更精确的往返时间测量(RTTm)。 + +#### 需要准确的 RTT 估算 + +当两个对等方都支持时间戳时,每个 TCP 段都携带两个附加数字:时间戳值和回显时间戳。 + +``` +TCP Timestamp option (TSopt): Kind: 8, Length: 10 ++-------+----+----------------+-----------------+ +|Kind=8 | 10 |TS Value (TSval)|EchoReply (TSecr)| ++-------+----+----------------+-----------------+ +    1      1         4                4 +``` + +准确的 RTT 估算对于 TCP 性能至关重要。TCP 会自动重新发送未确认的数据。重传由计时器触发:如果超时,则 TCP 会将尚未收到确认的一个或多个数据包视为丢失。然后再发送一次。 + +但是,“尚未得到确认” 并不意味着该段已丢失。也有可能是接收方到目前为止没有发送确认,或者确认仍在传输中。这就造成了一个两难的困境:TCP 必须等待足够长的时间,才能让这种轻微的延迟变得无关紧要,但它也不能等待太久。 + +**低网络延迟 VS 高网络延迟** + +在延迟较高的网络中,如果计时器触发过快,TCP 经常会将时间和带宽浪费在不必要的重发上。 + +然而,在延迟较低的网络中,等待太长时间会导致真正发生数据包丢失时吞吐量降低。因此,在低延迟网络中,计时器应该比高延迟网络中更早到期。所以,TCP 重传超时不能使用固定常量值作为超时。它需要根据其在网络中所经历的延迟来调整该值。 + +**往返时间的测量** + +TCP 选择基于预期的往返时间(RTT)的重传超时。RTT 事先是未知的。它是通过测量发送的段与 TCP 接收到该段所承载数据的确认之间的增量来估算的。 + +由于多种因素使其而变得复杂。 + + * 出于性能原因,TCP 不会为收到的每个数据包生成新的确认。它等待的时间非常短:如果有更多的数据段到达,则可以通过单个 ACK 数据包确认其接收。这称为“累积确认”cumulative ACK。 + * 往返时间并不恒定。这是有多种因素造成的。例如,客户端可能是一部移动电话,随其移动而切换到不同的基站。也可能是当链路或 CPU 的利用率提高时,数据包交换花费了更长的时间。 + * 必须重新发送的数据包在计算过程中必须被忽略。这是因为发送方无法判断重传数据段的 ACK 是在确认原来的传输数据(毕竟已到达)还是在确认重传数据。 + +最后一点很重要:当 TCP 忙于从丢失中恢复时,它可能仅接收到重传段的 ACK。这样,它就无法在此恢复阶段测量(更新)RTT。所以,它无法调整重传超时,然后超时将以指数级增长。那是一种非常具体的情况(它假设其他机制,如快速重传或 SACK 不起作用)。但是,使用 TCP 时间戳,即使在这种情况下也会进行 RTT 评估。 + +如果使用了扩展,则对等方将从 TCP 段的扩展空间中读取时间戳值并将其存储在本地。然后,它将该值作为 “回显时间戳” 放入发回的所有数据段中。 + +因此,该选项带有两个时间戳:它的发送方自己的时间戳和它从对等方收到的最新时间戳。原始发送方使用 “回显时间戳” 来计算 RTT。它是当前时间戳时钟与 “回显时间戳” 中所反映的值之间的增量。 + +**时间戳的其他用途** + +TCP 时间戳甚至还有除 PAWS(防止序列号回绕Protection Against Wrapped Sequences) 和 RTT 测量以外的其他用途。例如,可以检测是否不需要重发。如果该确认携带较旧的回显时间戳,则该确认针对的是初始数据包,而不是重新发送的数据包。 + +TCP 时间戳的另一个更晦涩的用例与 TCP [syn cookie][4] 功能有关。 + +**在服务器端建立 TCP 连接** + +当连接请求到达的速度快于服务器应用程序可以接受新的传入连接的速度时,连接积压最终将达到其极限。这可能是由于系统配置错误或应用程序中的错误引起的。当一个或多个客户端发送连接请求而不对 “SYN ACK” 响应做出反应时,也会发生这种情况。这将用不完整的连接填充连接队列。这些条目需要几秒钟才会超时。这被称为“同步泛洪攻击”syn flood attack。 + +**TCP 时间戳和 TCP Syn Cookie** + +即使队列已满,某些 TCP 协议栈也允许继续接受新连接。发生这种情况时,Linux 内核将在系统日志中打印一条突出的消息: + +> 端口 P 上可能发生 SYN 泛洪。正在发送 Cookie。检查 SNMP 计数器。 + +此机制将完全绕过连接队列。通常存储在连接队列中的信息被编码到 SYN/ACK 响应 TCP 序列号中。当 ACK 返回时,可以根据序列号重建队列条目。 + +序列号只有有限的空间来存储信息。因此,使用 “TCP Syn Cookie” 机制建立的连接不能支持 TCP 选项。 + +但是,对两个对等点都通用的 TCP 选项可以存储在时间戳中。ACK 数据包在回显时间戳字段中反映了该值,这也允许恢复已达成共识的 TCP 选项。否则,cookie 连接受标准的 64KB 接收窗口限制。 + +**常见误区 —— 时间戳不利于性能** + +不幸的是,一些指南建议禁用 TCP 时间戳,以减少内核访问时间戳时钟来获取当前时间所需的次数。这是不正确的。如前所述,RTT 估算是 TCP 的必要部分。因此,内核在接收/发送数据包时总是采用微秒级的时间戳。 + +在包处理步骤的其余部分中,Linux 会重用 RTT 估算所需的时钟时间戳。这还避免了将时间戳添加到传出 TCP 数据包的额外时钟访问。 + +整个时间戳选项在每个数据包中仅需要 10 个字节的 TCP 选项空间,这不会显著减少可用于数据包有效负载的空间。 + +**常见误区 —— 时间戳是个安全问题** + +一些安全审计工具和(较旧的)博客文章建议禁用 TCP 时间戳,因为据称它们泄露了系统正常运行时间:这样一来,便可以估算系统/内核的补丁级别。这在过去是正确的:时间戳时钟基于不断增加的值,该值在每次系统引导时都以固定值开始。时间戳值可以估计机器已经运行了多长时间(正常运行时间 `uptime`)。 + +从 Linux 4.12 开始,TCP 时间戳不再显示正常运行时间。发送的所有时间戳值都使用对等设备特定的偏移量。时间戳值也每 49 天回绕一次。 + +换句话说,从地址 “A” 出发,或者终到地址 “A” 的连接看到的时间戳与到远程地址 “B” 的连接看到的时间戳不同。 + +运行 `sysctl net.ipv4.tcp_timeamp=2` 以禁用随机化偏移。这使得分析由诸如 `wireshark` 或 `tcpdump` 之类的工具记录的数据包跟踪变得更容易 —— 从主机发送的数据包在其 TCP 选项时间戳中都具有相同的时钟基准。因此,对于正常操作,默认设置应保持不变。 + +### 选择性确认 + +如果同一数据窗口中的多个数据包丢失了,TCP 将会出现问题。这是因为 TCP 确认是累积的,但仅适用于按顺序到达的数据包。例如: + + * 发送方发送段 s_1、s_2、s_3、... s_n + * 发送方收到 s_2 的 ACK + * 这意味着 s_1 和 s_2 都已收到,并且发送方不再需要保留这些段。 + * s_3 是否应该重新发送? s_4 呢? s_n? + +发送方等待 “重传超时” 或 “重复 ACK” 以使 s_2 到达。如果发生重传超时或到达了 s_2 的多个重复 ACK,则发送方再次发送 s_3。 + +如果发送方收到对 s_n 的确认,则 s_3 是唯一丢失的数据包。这是理想的情况。仅发送单个丢失的数据包。 + +如果发送方收到的确认段小于 s_n,例如 s_4,则意味着丢失了多个数据包。发送方也需要重传下一个数据段。 + +**重传策略** + +可能只是重复相同的序列:重新发送下一个数据包,直到接收方指示它已处理了直至 s_n 的所有数据包为止。这种方法的问题在于,它需要一个 RTT,直到发送方知道接下来必须重新发送的数据包为止。尽管这种策略可以避免不必要的重传,但要等到 TCP 重新发送整个数据窗口后,它可能要花几秒钟甚至更长的时间。 + +另一种方法是一次重新发送几个数据包。当丢失了几个数据包时,此方法可使 TCP 恢复更快。在上面的示例中,TCP 重新发送了 s_3、s_4、s_5、...,但是只能确保已丢失 s_3。 + +从延迟的角度来看,这两种策略都不是最佳的。如果只有一个数据包需要重新发送,第一种策略是快速的,但是当多个数据包丢失时,它花费的时间太长。 + +即使必须重新发送多个数据包,第二个也是快速的,但是以浪费带宽为代价。此外,这样的 TCP 发送方在进行不必要的重传时可能已经发送了新数据。 + +通过可用信息,TCP 无法知道丢失了哪些数据包。这就是 TCP [选择性确认][5](SACK)的用武之地了。就像窗口缩放和时间戳一样,它是另一个可选的但非常有用的 TCP 特性。 + +**SACK 选项** + +``` +   TCP Sack-Permitted Option: Kind: 4, Length 2 +   +---------+---------+ +   | Kind=4  | Length=2| +   +---------+---------+ +``` + +支持此扩展的发送方在连接请求中包括 “允许 SACK” 选项。如果两个端点都支持该扩展,则检测到数据流中丢失数据包的对等方可以将此信息通知发送方。 + +``` +   TCP SACK Option: Kind: 5, Length: Variable +                     +--------+--------+ +                     | Kind=5 | Length | +   +--------+--------+--------+--------+ +   |      Left Edge of 1st Block       | +   +--------+--------+--------+--------+ +   |      Right Edge of 1st Block      | +   +--------+--------+--------+--------+ +   |                                   | +   /            . . .                  / +   |                                   | +   +--------+--------+--------+--------+ +   |      Left Edge of nth Block       | +   +--------+--------+--------+--------+ +   |      Right Edge of nth Block      | +   +--------+--------+--------+--------+ +``` + +接收方遇到 s_2 后跟 s_5 ... s_n,则在发送对 s_2 的确认时将包括一个 SACK 块: + +``` + +                +--------+-------+ +                | Kind=5 |   10  | ++--------+------+--------+-------+ +| Left edge: s_5                 | ++--------+--------+-------+------+ +| Right edge: s_n                | ++--------+-------+-------+-------+ +``` + +这告诉发送方到 s_2 的段都是按顺序到达的,但也让发送方知道段 s_5 至 s_n 也已收到。然后,发送方可以重新发送那两个数据包(s_3、s_4),并继续发送新数据。 + +**神话般的无损网络** + +从理论上讲,如果连接不会丢包,那么 SACK 就没有任何优势。或者连接具有如此低的延迟,甚至等待一个完整的 RTT 都无关紧要。 + +在实践中,无损行为几乎是不可能保证的。即使网络及其所有交换机和路由器具有足够的带宽和缓冲区空间,数据包仍然可能丢失: + + * 主机操作系统可能面临内存压力并丢弃数据包。请记住,一台主机可能同时处理数万个数据包流。 + * CPU 可能无法足够快地消耗掉来自网络接口的传入数据包。这会导致网络适配器本身中的数据包丢失。 + * 如果 TCP 时间戳不可用,即使一个非常小的 RTT 的连接也可能在丢失恢复期间暂时停止。 + +使用 SACK 不会增加 TCP 数据包的大小,除非连接遇到数据包丢失。因此,几乎没有理由禁用此功能。几乎所有的 TCP 协议栈都支持 SACK —— 它通常只在不进行 TCP 批量数据传输的低功耗 IOT 类的设备上才不存在。 + +当 Linux 系统接受来自此类设备的连接时,TCP 会自动为受影响的连接禁用 SACK。 + +### 总结 + +本文中研究的三个 TCP 扩展都与 TCP 性能有关,最好都保留其默认设置:启用。 + +TCP 握手可确保仅使用双方都可以理解的扩展,因此,永远不需因为对等方可能不支持而全局禁用该扩展。 + +关闭这些扩展会导致严重的性能损失,尤其是 TCP 窗口缩放和 SACK。可以禁用 TCP 时间戳而不会立即造成不利影响,但是现在没有令人信服的理由这样做了。启用它们还可以支持 TCP 选项,即使在 SYN cookie 生效时也是如此。 + +-------------------------------------------------------------------------------- + +via: https://fedoramagazine.org/tcp-window-scaling-timestamps-and-sack/ + +作者:[Florian Westphal][a] +选题:[lujun9972][b] +译者:[gxlct008](https://github.com/gxlct008) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://fedoramagazine.org/author/strlen/ +[b]: https://github.com/lujun9972 +[1]: https://fedoramagazine.org/wp-content/uploads/2020/08/tcp-window-scaling-816x346.png +[2]: https://en.wikipedia.org/wiki/Transmission_Control_Protocol#TCP_segment_structure +[3]: https://www.rfc-editor.org/info/rfc7323 +[4]: https://en.wikipedia.org/wiki/SYN_cookies +[5]: https://www.rfc-editor.org/info/rfc2018 diff --git a/published/202010/20200820 Learn the basics of programming with C.md b/published/202010/20200820 Learn the basics of programming with C.md new file mode 100644 index 0000000000..8e54cdc13d --- /dev/null +++ b/published/202010/20200820 Learn the basics of programming with C.md @@ -0,0 +1,266 @@ +[#]: collector: (lujun9972) +[#]: translator: (robsean) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12732-1.html) +[#]: subject: (Learn the basics of programming with C) +[#]: via: (https://opensource.com/article/20/8/c-programming-cheat-sheet) +[#]: author: (Seth Kenlon https://opensource.com/users/seth) + +C 语言简单编程速成 +====== + +> 我们将所有的 C 语言要素放置到一份易读的备忘录上。 + +![](https://img.linux.net.cn/data/attachment/album/202010/18/213610t3do3u7oev2udoyn.png) + +1972 年,丹尼斯·里奇Dennis Ritchie任职于贝尔实验室Bell Labs,在几年前,他和他的团队成员发明了 Unix 。在创建了一个经久不衰的操作系统(至今仍在使用)之后,他需要一种好的方法来对这些 Unix 计算机编程,以便它们可用执行新的任务。在现在看来,这很奇怪,但在当时,编程语言相对较少,Fortran、Lisp、[Algol][2] 以及 B 语言都很流行,但是,对于贝尔实验室的研究员们想要做的事情来说,它们还是远远不够的。丹尼斯·里奇表现出一种后来被称为程序员的主要特征的特质:创造了他自己的解决方案。他称之为 C 语言,并且在近 50 年后,它仍在广泛的使用。 + +### 为什么你应该学习 C 语言 + +今天,有很多语言为程序员提供了比 C 语言更多的特性。最明显的是 C++ 语言,这是一种以相当露骨的方式命名的语言,它构建在 C 语言之上,创建了一种很好的面向对象语言。不过,许多其它语言的存在是有充分理由的。计算机擅长一致的重复,因此任何可预见的东西都可以构建在编程语言中,对程序员来说这意味着更少的工作量。为什么在 C++ 语言中用一行语句就可以将一个 `int` 转换为一个 `long` 时(`long x = long(n);`),还要在 C 语言用两行语句呢? + +然而,C 语言在今天仍然有用。 + +首先,C 语言是一种相当简约和直接的语言。除了编程的基础知识之外,并没有很高级的概念,这很大程度上是因为 C 语言实际上就是现代编程语言的基础之一。例如,C 语言的特性之一是数组,但是它不提供字典(除非你自己写一个)。当你学习 C 语言时,你会学习编程的基础组成部分,它可以帮助你认识到如今的编程语言的改进及其的精心设计。 + +因为 C 语言是一种最小化的编程语言,你的应用程序很可能会获得性能上的提升,这在其它许多编程语言中是看不到的。当你考虑你的代码可以执行多快的时候,很容易陷入锱铢必较的境地,因此,重要的是要问清楚你是否*需要*为某一特定任务提供更多的速度。与 Python 或 Java 相比,使用 C 语言,你在每行代码中需要纠结的地方更少。C 语言程序运行很快。这是 Linux 内核使用 C 语言编写的一个很好的理由。 + +最后,C 语言很容易入门,特别是,如果你正在运行 Linux,就已经能运行 C 语言代码了,因为 Linux 系统包含 GNU C 库(`glibc`)。为了编写和构建 C 语言程序,你需要做的全部工作就是安装一个编译器,打开一个文本编辑器,开始编码。 + +### 开始学习 C 语言 + +如果你正在运行 Linux ,你可以使用你的软件包管理器安装一个 C 编译器。在 Fedora 或 RHEL 上: + +``` +$ sudo dnf install gcc +``` + +在 Debian 及其衍生系统上: + +``` +$ sudo apt install build-essential +``` + +在 macOS 上,你可以 [安装 Homebrew][3] ,并使用它来安装 [GCC][4]: + +``` +$ brew install gcc +``` + +在 Windows 上, 你可以使用 [MinGW][5] 安装一套最小的包含 GCC 的 GNU 实用程序集。 + +在 Linux 或 macOS 上验证你已经安装的 GCC: + +``` +$ gcc --version +gcc (GCC) x.y.z +Copyright (C) 20XX Free Software Foundation, Inc. +``` + +在 Windows 上,提供 EXE 文件的完整路径: + +``` +PS> C:\MinGW\bin\gcc.exe --version +gcc.exe (MinGW.org GCC Build-2) x.y.z +Copyright (C) 20XX Free Software Foundation, Inc. +``` + +### C 语法 + +C 语言不是一种脚本语言。它是一种编译型语言,这意味着它由 C 编译器处理来产生一个二进制可执行文件。这不同于脚本语言(如 [Bash][6])或混合型语言(如 [Python][7])。 + +在 C 语言中,你可以创建*函数*来执行你希望做到的任务。默认情况下,执行的是一个名为 `main` 的函数。 + +这里是一个使用 C 语言写的简单的 “hello world” 程序: + +``` +#include + +int main() { + printf("Hello world"); + return 0; +} +``` + +第一行包含一个被称为 `stdio.h`(标准输入和输出)的 *头文件*,它基本上是自由使用的、非常初级的 C 语言代码,你可以在你自己的程序中重复使用它。然后创建了一个由一条基本的输出语句构成的名为 `main` 的函数。保存这些文本到一个被称为 `hello.c` 的文件中,然后使用 GCC 编译它: + +``` +$ gcc hello.c --output hello +``` + +尝试运行你的 C 语言程序: + +``` +$ ./hello +Hello world$ +``` + +#### 返回值 + +这是 Unix 哲学的一部分,一个函数在执行后“返回”一些东西:在成功时不返回任何东西,在失败时返回其它的一些东西(例如,一个错误信息)。这些返回的内容通常使用数字(确切地说是整数)表示:`0` 表示没有错误,任何大于 `0` 的数字都表示一些不成功的状态。 + +Unix 和 Linux 被设计成在运行成功时保持沉默是很明智的。这是为了让你在执行一系列命令时,假设没有任何错误或警告会妨碍你的工作,从而可以始终为成功执行做准备。类似地,在 C 语言中的函数在设计上也预期不出现错误。 + +你可以通过一个小的修改,让你的程序看起来是失败的,就可以看到这一点: + +``` +include + +int main() { + printf("Hello world"); + return 1; +} +``` + +编译它: + +``` +$ gcc hello.c --output failer +``` + +现在使用一个内置的 Linux 测试方式来运行它。仅在*成功*时,`&&` 操作符才会执行一个命令的第二部分。例如: + +``` +$ echo "success" && echo "it worked" +success +it worked +``` + +在*失败*时,`||` 测试会执行一个命令的第二部分。 + +``` +$ ls blah || echo "it did not work" +ls: cannot access 'blah': No such file or directory +it did not work +``` + +现在,尝试你的程序,在成功时,它*不*返回 `0`;而是返回 `1`: + +``` +$ ./failer && echo "it worked" +String is: hello +``` + +这个程序成功地执行了,但是没有触发第二个命令。 + +#### 变量和类型 + +在一些语言中,你可以创建变量而不具体指定变量所包含的数据的*类型*。这些语言如此设计使得解释器需要对一个变量运行一些测试来视图发现变量是什么样的数据类型。例如,`var=1` 定义了一个整型数,当你创建一个表达式将 `var` 与某些东西相加时,Python 知道显然它是一个整型数。它同样知道当你连接 `hello` 和 `world` 时,单词 `world` 是一个字符串。 + +C 语言不会为你做任何这些识别和调查;你必须自己定义你的变量类型。这里有几种变量类型,包括整型(`int`),字符型(`char`),浮点型(`float`),布尔型(`boolean`)。 + +你可能也注意到这里没有字符串类型。与 Python 和 Java 和 Lua 以及其它的编程语言不同,C 语言没有字符串类型,而是将字符串看作一个字符数组。 + +这里是一些简单的代码,它建立了一个 `char` 数组变量,然后使用 [printf][9] 将数组变量和一段简单的信息打印到你的屏幕上: + +``` +#include + +int main() { + char var[6] = "hello"; + printf("Your string is: %s\r\n",var); +} +``` + +你可能会注意到,这个代码示例向一个由五个字母组成的单词提供了六个字符的空间。这是因为在字符串的结尾有处一个隐藏的终止符,它占用了数组中的一个字节。你可以通过编译和执行代码来运行它: + +``` +$ gcc hello.c --output hello +$ ./hello +hello +``` + +### 函数 + +和其它的编程语言一样,C 函数也接受可选的参数。你可以通过定义你希望函数接受的数据类型,来将参数从一个函数传递到另一个函数: + +``` +#include + +int printmsg(char a[]) { + printf("String is: %s\r\n",a); +} + +int main() { + char a[6] = "hello"; + printmsg(a); + return 0; +} +``` + +简单地将一个函数分解为两个函数的这种方法并不是非常有用,但是它演示了默认运行 `main` 函数以及如何在函数之间传递数据。 + +### 条件语句 + +在真实的编程中,你通常希望你的代码根据数据做出判断。这是使用*条件*语句完成的,`if` 语句是其中最基础的一个语句。 + +为了使这个示例程序更具动态性,你可以包含 `string.h` 头文件,顾名思义,它包含用于检查字符串的代码。尝试使用来自 `string.h` 文件中的 `strlen` 函数测试传递给 `printmsg` 函数的字符串是否大于 `0`: + +``` +#include +#include + +int printmsg(char a[]) { + size_t len = strlen(a); + if ( len > 0) { + printf("String is: %s\r\n",a); + } +} + +int main() { + char a[6] = "hello"; + printmsg(a); + return 1; +} +``` + +正如在这个示例中所实现的,该条件永远都不会是非真的,因为所提供的字符串总是 `hello`,它的长度总是大于 `0`。这个不够认真的重新实现的 `echo` 命令的最后一点要做是接受来自用户的输入。 + +### 命令参数 + +`stdio.h` 文件包含的代码在每次程序启动时提供了两个参数: 一个是命令中包含多少项的计数(`argc`),一个是包含每个项的数组(`argv`)。例如, 假设你发出这个虚构的命令: + +``` +$ foo -i bar +``` + +`argc` 是 `3`,`argv` 的内容是: + + * `argv[0] = foo` + * `argv[1] = -i` + * `argv[2] = bar` + +你可以修改示例 C 语言程序来以字符串方式接受 `argv[2]`,而不是默认的 `hello` 吗? + +### 命令式编程语言 + +C 语言是一种命令式编程语言。它不是面向对象的,也没有类结构。使用 C 语言的经验可以教你很多关于如何处理数据,以及如何更好地管理你的代码运行时生成的数据。多使用 C 语言,你最后能够编写出其它语言(例如 Python 和 Lua)可以使用的库。 + +想要了解更多关于 C 的知识,你需要使用它。在 `/usr/include/` 中查找有用的 C 语言头文件,并且看看你可以做什么小任务来使 C 语言对你有用。在学习的过程中,使用来自 FreeDOS 的 [Jim Hall][12] 编写的 [C 语言忘备录][11]。它在一张双面纸忘备录上放置了所有的基本要素,所以在你练习时,可以立即访问 C 语言语法的所有要素。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/8/c-programming-cheat-sheet + +作者:[Seth Kenlon][a] +选题:[lujun9972][b] +译者:[robsean](https://github.com/robsean) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/seth +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/coverimage_cheat_sheet.png?itok=lYkNKieP (Cheat Sheet cover image) +[2]: https://opensource.com/article/20/6/algol68 +[3]: https://opensource.com/article/20/6/homebrew-mac +[4]: https://gcc.gnu.org/ +[5]: https://opensource.com/article/20/8/gnu-windows-mingw +[6]: https://opensource.com/resources/what-bash +[7]: https://opensource.com/resources/python +[8]: http://www.opengroup.org/onlinepubs/009695399/functions/printf.html +[9]: https://opensource.com/article/20/8/printf +[10]: http://www.opengroup.org/onlinepubs/009695399/functions/strlen.html +[11]: https://opensource.com/downloads/c-programming-cheat-sheet +[12]: https://opensource.com/users/jim-hall diff --git a/published/202010/20200826 What is IPv6, and why aren-t we there yet.md b/published/202010/20200826 What is IPv6, and why aren-t we there yet.md new file mode 100644 index 0000000000..9eb7aef27a --- /dev/null +++ b/published/202010/20200826 What is IPv6, and why aren-t we there yet.md @@ -0,0 +1,95 @@ +[#]: collector: (lujun9972) +[#]: translator: (wxy) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12688-1.html) +[#]: subject: (What is IPv6, and why aren’t we there yet?) +[#]: via: (https://www.networkworld.com/article/3254575/what-is-ipv6-and-why-aren-t-we-there-yet.html) +[#]: author: (Keith Shaw, Josh Fruhlinger ) + +什么是 IPv6,为什么我们还未普及? +====== + +> 自 1998 年以来,IPv6 一直在努力解决 IPv4 可用 IP 地址的不足的问题,然而尽管 IPv6 在效率和安全方面具有优势,但其采用速度仍然缓慢。 + +![](https://images.idgesg.net/images/article/2017/11/ipv6newip-100740801-large.jpg) + +在大多数情况下,已经没有人一再对互联网地址耗尽的可怕境况发出警告,因为,从互联网协议版本 4(IPv4)的世界到 IPv6 的迁移,虽然缓慢,但已经坚定地开始了,并且相关软件已经到位,以防止许多人预测的地址耗竭。 + +但在我们看到 IPv6 的现状和发展方向之前,让我们先回到互联网寻址的早期。 + +### 什么是 IPv6,为什么它很重要? + +IPv6 是最新版本的互联网协议Internet Protocol(IP),它可以跨互联网识别设备,从而确定它们的位置。每一个使用互联网的设备都要通过自己的 IP 地址来识别,以便可以通过互联网通信。在这方面,它就像你需要知道街道地址和邮政编码一样,以便邮寄信件。 + +之前的版本 IPv4 采用 32 位寻址方案,可以支持 43 亿台设备,本以为已经足够。然而,互联网、个人电脑、智能手机以及现在物联网设备的发展证明,这个世界需要更多的地址。 + +幸运的是,互联网工程任务组Internet Engineering Task Force(IETF)在 20 年前就认识到了这一点。1998 年,它创建了 IPv6,使用 128 位寻址方式来支持大约 340 亿亿亿trillion trillion(或者 2 的 128 次幂,如果你喜欢用这种表示方式的话)。IPv4 的地址可表示为四组一至三位十进制数,IPv6 则使用八组四位十六进制数字,用冒号隔开。 + +### IPv6 的好处是什么? + +IETF 在其工作中为 IPv6 加入了对 IPv4 增强的功能。IPv6 协议可以更有效地处理数据包,提高性能和增加安全性。它使互联网服务提供商(ISP)能够通过使他们的路由表更有层次性来减少其大小。 + +### 网络地址转换(NAT)和 IPv6 + +IPv6 的采用被推迟,部分原因是网络地址转换network address translation(NAT)导致的,NAT 可以将私有 IP 地址转化为公共 IP 地址。这样一来,拥有私有 IP 地址的企业的机器就可以向位于私有网络之外拥有公共 IP 地址的机器发送和接收数据包。 + +如果没有 NAT,拥有数千台或数万台计算机的大公司如果要与外界通信,就会吞噬大量的公有 IPv4 地址。但是这些 IPv4 地址是有限的,而且接近枯竭,以至于不得不限制分配。 + +NAT 有助于缓解这个问题。有了 NAT,成千上万的私有地址计算机可以通过防火墙或路由器等 NAT 设备呈现在公共互联网上。 + +NAT 的工作方式是,当一台拥有私有 IP 地址的企业计算机向企业网络外的公共 IP 地址发送数据包时,首先会进入 NAT 设备。NAT 在翻译表中记下数据包的源地址和目的地址。NAT 将数据包的源地址改为 NAT 设备面向公众的地址,并将数据包一起发送到外部目的地。当数据包回复时,NAT 将目的地址翻译成发起通信的计算机的私有 IP 地址。这样一来,一个公网 IP 地址可以代表多台私有地址的计算机。 + +### 谁在部署 IPv6? + +运营商网络和互联网服务供应商是最早开始在其网络上部署 IPv6 的群体,其中移动网络处于领先地位。例如,T-Mobile USA 有超过 90% 的流量通过 IPv6,Verizon Wireless 紧随其后,占 82.25%。根据行业组织 [World Ipv6 Launch][3] 的数据,Comcast 和 AT&T 的网络分别为 63% 和 65%。 + +主要网站则排在其后 —— World IPv6 Launch 称,目前 Alexa 前 1000 的网站中只有不到 30% 可以通过 IPv6 到达。 + +企业在部署方面比较落后,根据互联网协会Internet Society的[《2017年 IPv6 部署状况》报告][4],只有不到四分之一的企业宣传其 IPv6 前缀。复杂性、成本和完成迁移所需时间都是他们给出的理由。此外,一些项目由于软件兼容性的问题而被推迟。例如,一份 [2017 年 1 月的报告][5]称,Windows 10 中的一个 bug “破坏了微软在其西雅图总部推出纯 IPv6 网络的努力”。 + +### 何时会有更多部署? + +互联网协会表示,IPv4 地址的价格将在 2018 年达到顶峰,然后在 IPv6 部署通过 50% 大关后,价格会下降。目前,[根据 Google][6],全球的 IPv6 采用率为 20% 到 22%,但在美国约为 32%。 + +随着 IPv4 地址的价格开始下降,互联网协会建议企业出售现有的 IPv4 地址,以帮助资助其 IPv6 的部署。根据[一个发布在 GitHub 上的说明][7],麻省理工学院已经这样做了。这所大学得出的结论是,其有 800 万个 IPv4 地址是“过剩”的,可以在不影响当前或未来需求的情况下出售,因为它还持有 20 个非亿级nonillion IPv6 地址。(非亿级地址是指数字 1 后面跟着 30 个零)。 + +此外,随着部署的增多,更多的公司将开始对 IPv4 地址的使用收费,而免费提供 IPv6 服务。[英国的 ISP Mythic Beasts][8] 表示,“IPv6 连接是标配”,而 “IPv4 连接是可选的额外服务”。 + +### IPv4 何时会被“关闭”? + +在 2011 年至 2018 年期间,世界上大部分地区[“用完”了新的 IPv4 地址][9] —— 但我们不会完全没有 IPv4 地址,因为 IPv4 地址会被出售和重新使用(如前所述),而剩余的地址将用于 IPv6 过渡。 + +目前还没有正式的 IPv4 关闭日期,所以人们不用担心有一天他们的互联网接入会突然消失。随着越来越多的网络过渡,越来越多的内容网站支持 IPv6,以及越来越多的终端用户为 IPv6 功能升级设备,世界将慢慢远离 IPv4。 + +### 为什么没有 IPv5? + +曾经有一个 IPv5,也被称为互联网流协议Internet Stream Protocol,简称 ST。它被设计用于跨 IP 网络的面向连接的通信,目的是支持语音和视频。 + +它在这个任务上是成功的,并被实验性地使用。它的一个缺点是它的 32 位地址方案 —— 与 IPv4 使用的方案相同,从而影响了它的普及。因此,它存在着与 IPv4 相同的问题 —— 可用的 IP 地址数量有限。这导致了发展出了 IPv6 并和最终得到采用。尽管 IPv5 从未被公开采用,但它已经用掉了 IPv5 这个名字。 + +-------------------------------------------------------------------------------- + +via: https://www.networkworld.com/article/3254575/what-is-ipv6-and-why-aren-t-we-there-yet.html + +作者:[Keith Shaw][a],[Josh Fruhlinger][c] +选题:[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.networkworld.com/author/Keith-Shaw/ +[c]: https://www.networkworld.com/author/Josh-Fruhlinger/ +[b]: https://github.com/lujun9972 +[1]: https://www.networkworld.com/article/3235805/lan-wan/ipv6-deployment-guide.html#tk.nww-fsb +[2]: https://www.networkworld.com/article/3214388/lan-wan/how-to-plan-your-migration-to-ipv6.html#tk.nww-fsb +[3]: http://www.worldipv6launch.org/measurements/ +[4]: https://www.internetsociety.org/resources/doc/2017/state-of-ipv6-deployment-2017/ +[5]: https://www.theregister.co.uk/2017/01/19/windows_10_bug_undercuts_ipv6_rollout/https://www.theregister.co.uk/2017/01/19/windows_10_bug_undercuts_ipv6_rollout/ +[6]: https://www.google.com/intl/en/ipv6/statistics.html +[7]: https://gist.github.com/simonster/e22e50cd52b7dffcf5a4db2b8ea4cce0 +[8]: https://www.mythic-beasts.com/sales/ipv6 +[9]: https://ipv4.potaroo.net/ +[10]: https://www.facebook.com/NetworkWorld/ +[11]: https://www.linkedin.com/company/network-world diff --git a/published/202010/20200901 Create a mobile app with Flutter.md b/published/202010/20200901 Create a mobile app with Flutter.md new file mode 100644 index 0000000000..3b525da7c6 --- /dev/null +++ b/published/202010/20200901 Create a mobile app with Flutter.md @@ -0,0 +1,245 @@ +[#]: collector: (lujun9972) +[#]: translator: (gxlct008) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12693-1.html) +[#]: subject: (Create a mobile app with Flutter) +[#]: via: (https://opensource.com/article/20/9/mobile-app-flutter) +[#]: author: (Vitaly Kuprenko https://opensource.com/users/kooper) + +使用 Flutter 创建 App +====== + +> 使用流行的 Flutter 框架开始你的跨平台开发之旅。 + +![](https://img.linux.net.cn/data/attachment/album/202010/07/112953m9g419z1gc2i07z1.jpg) + +[Flutter][2] 是一个深受全球移动开发者欢迎的项目。该框架有一个庞大的、友好的爱好者社区,随着 Flutter 帮助程序员将他们的项目带入移动领域,这个社区还在继续增长。 + +本教程旨在帮助你开始使用 Flutter 进行移动开发。阅读之后,你将了解如何快速安装和设置框架,以便开始为智能手机、平板电脑和其他平台开发。 + +本操作指南假定你已在计算机上安装了 [Android Studio][3],并且具有一定的使用经验。 + +### 什么是 Flutter ? + +Flutter 使得开发人员能够为多个平台构建应用程序,包括: + + * Android + * iOS + * Web(测试版) + * macOS(正在开发中) + * Linux(正在开发中) + +对 macOS 和 Linux 的支持还处于早期开发阶段,而 Web 支持预计很快就会发布。这意味着你可以立即试用其功能(如下所述)。 + +### 安装 Flutter + +我使用的是 Ubuntu 18.04,但其他 Linux 发行版安装过程与之类似,比如 Arch 或 Mint。 + +#### 使用 snapd 安装 + +要使用 [Snapd][4] 在 Ubuntu 或类似发行版上安装 Flutter,请在终端中输入以下内容: + +``` +$ sudo snap install flutter --classic + +$ sudo snap install flutter –classic +flutter 0+git.142868f from flutter Team/ installed +``` + +然后使用 `flutter` 命令启动它。 首次启动时,该框架会下载到你的计算机上: + +``` +$ flutter +Initializing Flutter +Downloading https://storage.googleapis.com/flutter_infra[...] +``` + +下载完成后,你会看到一条消息,告诉你 Flutter 已初始化: + +![Flutter initialized][5] + +#### 手动安装 + +如果你没有安装 Snapd,或者你的发行版不是 Ubuntu,那么安装过程会略有不同。在这种情况下,请[下载][7] 为你的操作系统推荐的 Flutter 版本。 + +![Install Flutter manually][8] + +然后将其解压缩到你的主目录。 + +在你喜欢的文本编辑器中打开主目录中的 `.bashrc` 文件(如果你使用 [Z shell][9],则打开 `.zshc`)。因为它是隐藏文件,所以你必须首先在文件管理器中启用显示隐藏文件,或者使用以下命令从终端打开它: + +``` +$ gedit ~/.bashrc & +``` + +将以下行添加到文件末尾: + +``` +export PATH="$PATH:~/flutter/bin" +``` + +保存并关闭文件。 请记住,如果在你的主目录之外的其他位置解压 Flutter,则 [Flutter SDK 的路径][10] 将有所不同。 + +关闭你的终端,然后再次打开,以便加载新配置。 或者,你可以通过以下命令使配置立即生效: + +``` +$ . ~/.bashrc +``` + +如果你没有看到错误,那说明一切都是正常的。 + +这种安装方法比使用 `snap` 命令稍微困难一些,但是它非常通用,可以让你在几乎所有的发行版上安装该框架。 + +#### 检查安装结果 + +要检查安装结果,请在终端中输入以下内容: + +``` +flutter doctor -v +``` + +你将看到有关已安装组件的信息。 如果看到错误,请不要担心。 你尚未安装任何用于 Flutter SDK 的 IDE 插件。 + +![Checking Flutter installation with the doctor command][11] + +### 安装 IDE 插件 + +你应该在你的 [集成开发环境(IDE)][12] 中安装插件,以帮助它与 Flutter SDK 接口、与设备交互并构建代码。 + +Flutter 开发中常用的三个主要 IDE 工具是 IntelliJ IDEA(社区版)、Android Studio 和 VS Code(或 [VSCodium][13])。我在本教程中使用的是 Android Studio,但步骤与它们在 IntelliJ Idea(社区版)上的工作方式相似,因为它们构建在相同的平台上。 + +首先,启动 Android Studio。打开 “Settings”,进入 “Plugins” 窗格,选择 “Marketplace” 选项卡。在搜索行中输入 “Flutter”,然后单击 “Install”。 + +![Flutter plugins][14] + +你可能会看到一个安装 “Dart” 插件的选项;同意它。如果看不到 Dart 选项,请通过重复上述步骤手动安装它。我还建议使用 “Rainbow Brackets” 插件,它可以让代码导航更简单。 + +就这样!你已经安装了所需的所有插件。你可以在终端中输入一个熟悉的命令进行检查: + +``` +flutter doctor -v +``` + +![Checking Flutter plugins with the doctor command][15] + +### 构建你的 “Hello World” 应用程序 + +要启动新项目,请创建一个 Flutter 项目: + +1、选择 “New -> New Flutter project”。 + +![Creating a new Flutter plugin][16] + +2、在窗口中,选择所需的项目类型。 在这种情况下,你需要选择 “Flutter Application”。 + +3、命名你的项目为 `hello_world`。 请注意,你应该使用合并的名称,因此请使用下划线而不是空格。 你可能还需要指定 SDK 的路径。 + +![Naming a new Flutter plugin][17] + +4、输入软件包名称。 + +你已经创建了一个项目!现在,你可以在设备上或使用模拟器启动它。 + +![Device options in Flutter][18] + +选择你想要的设备,然后按 “Run”。稍后,你将看到结果。 + +![Flutter demo on mobile device][19] + +现在你可以在一个 [中间项目][20] 上开始工作了。 + +### 尝试 Flutter for web + +在安装 Flutter 的 Web 组件之前,你应该知道 Flutter 目前对 Web 应用程序的支持还很原始。 因此,将其用于复杂的项目并不是一个好主意。 + +默认情况下,基本 SDK 中不启用 “Flutter for web”。 要打开它,请转到 beta 通道。 为此,请在终端中输入以下命令: + +``` +flutter channel beta +``` + +![flutter channel beta output][21] + +接下来,使用以下命令根据 beta 分支升级 Flutter: + +``` +flutter upgrade +``` + +![flutter upgrade output][22] + +要使 “Flutter for web” 工作,请输入: + +``` +flutter config --enable-web +``` + +重新启动 IDE;这有助于 Android Studio 索引新的 IDE 并重新加载设备列表。你应该会看到几个新设备: + +![Flutter for web device options][23] + +选择 “Chrome” 会在浏览器中启动一个应用程序, “Web Server” 会提供指向你的 Web 应用程序的链接,你可以在任何浏览器中打开它。 + +不过,现在还不是急于开发的时候,因为你当前的项目不支持 Web。要改进它,请打开项目根目录下的终端,然后输入: + +``` +flutter create +``` + +此命令重新创建项目,并添加 Web 支持。 现有代码不会被删除。 + +请注意,目录树已更改,现在有了一个 `web` 目录: + +![File tree with web directory][24] + +现在你可以开始工作了。 选择 “Chrome”,然后按 “Run”。 稍后,你会看到带有应用程序的浏览器窗口。 + +![Flutter web app demo][25] + +恭喜你! 你刚刚为浏览器启动了一个项目,并且可以像其他任何网站一样继续使用它。 + +所有这些都来自同一代码库,因为 Flutter 使得几乎无需更改就可以为移动平台和 Web 编写代码。 + +### 用 Flutter 做更多的事情 + +Flutter 是用于移动开发的强大工具,而且它也是迈向跨平台开发的重要一步。 了解它,使用它,并将你的应用程序交付到所有平台! + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/9/mobile-app-flutter + +作者:[Vitaly Kuprenko][a] +选题:[lujun9972][b] +译者:[gxlct008](https://github.com/gxlct008) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/kooper +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/idea_innovation_mobile_phone.png?itok=RqVtvxkd (A person looking at a phone) +[2]: https://flutter.dev/ +[3]: https://developer.android.com/studio +[4]: https://snapcraft.io/docs/getting-started +[5]: https://opensource.com/sites/default/files/uploads/flutter1_initialized.png (Flutter initialized) +[6]: https://creativecommons.org/licenses/by-sa/4.0/ +[7]: https://flutter.dev/docs/get-started/install/linux +[8]: https://opensource.com/sites/default/files/uploads/flutter2_manual-install.png (Install Flutter manually) +[9]: https://opensource.com/article/19/9/getting-started-zsh +[10]: https://opensource.com/article/17/6/set-path-linux +[11]: https://opensource.com/sites/default/files/uploads/flutter3_doctor.png (Checking Flutter installation with the doctor command) +[12]: https://www.redhat.com/en/topics/middleware/what-is-ide +[13]: https://opensource.com/article/20/6/open-source-alternatives-vs-code +[14]: https://opensource.com/sites/default/files/uploads/flutter4_plugins.png (Flutter plugins) +[15]: https://opensource.com/sites/default/files/uploads/flutter5_plugincheck.png (Checking Flutter plugins with the doctor command) +[16]: https://opensource.com/sites/default/files/uploads/flutter6_newproject.png (Creating a new Flutter plugin) +[17]: https://opensource.com/sites/default/files/uploads/flutter7_projectname.png (Naming a new Flutter plugin) +[18]: https://opensource.com/sites/default/files/uploads/flutter8_launchflutter.png (Device options in Flutter) +[19]: https://opensource.com/sites/default/files/uploads/flutter9_demo.png (Flutter demo on mobile device) +[20]: https://opensource.com/article/18/6/flutter +[21]: https://opensource.com/sites/default/files/uploads/flutter10_beta.png (flutter channel beta output) +[22]: https://opensource.com/sites/default/files/uploads/flutter11_upgrade.png (flutter upgrade output) +[23]: https://opensource.com/sites/default/files/uploads/flutter12_new-devices.png (Flutter for web device options) +[24]: https://opensource.com/sites/default/files/uploads/flutter13_tree.png (File tree with web directory) +[25]: https://opensource.com/sites/default/files/uploads/flutter14_webapp.png (Flutter web app demo) diff --git a/published/202010/20200903 A practical guide to learning awk.md b/published/202010/20200903 A practical guide to learning awk.md new file mode 100644 index 0000000000..66c613a352 --- /dev/null +++ b/published/202010/20200903 A practical guide to learning awk.md @@ -0,0 +1,142 @@ +[#]: collector: (lujun9972) +[#]: translator: (HankChow) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12686-1.html) +[#]: subject: (A practical guide to learning awk) +[#]: via: (https://opensource.com/article/20/9/awk-ebook) +[#]: author: (Seth Kenlon https://opensource.com/users/seth) + +awk 实用学习指南 +====== + +> 下载我们的电子书,学习如何更好地使用 `awk`。 + +![](https://img.linux.net.cn/data/attachment/album/202010/05/100648zcubcpww627627nw.jpg) + +在众多 [Linux][2] 命令中,`sed`、`awk` 和 `grep` 恐怕是其中最经典的三个命令了。它们引人注目或许是由于名字发音与众不同,也可能是它们无处不在,甚至是因为它们存在已久,但无论如何,如果要问哪些命令很有 Linux 风格,这三个命令是当之无愧的。其中 `sed` 和 `grep` 已经有很多简洁的标准用法了,但 `awk` 的使用难度却相对突出。 + +在日常使用中,通过 `sed` 实现字符串替换、通过 `grep` 实现过滤,这些都是司空见惯的操作了,但 `awk` 命令相对来说是用得比较少的。在我看来,可能的原因是大多数人都只使用 `sed` 或者 `grep` 的一些变化实现某些功能,例如: + +``` +$ sed -e 's/foo/bar/g' file.txt +$ grep foo file.txt +``` + +因此,尽管你可能会觉得 `sed` 和 `grep` 使用起来更加顺手,但实际上它们还有更多更强大的作用没有发挥出来。当然,我们没有必要在这两个命令上钻研得很深入,但我有时会好奇自己“学习”命令的方式。很多时候我会记住一整串命令“咒语”,而不会去了解其中的运作过程,这就让我产生了一种很熟悉命令的错觉,我可以随口说出某个命令的好几个选项参数,但这些参数具体有什么作用,以及它们的相关语法,我都并不明确。 + +这大概就是很多人对 `awk` 缺乏了解的原因了。 + +### 为使用而学习 awk + +`awk` 并不深奥。它是一种相对基础的编程语言,因此你可以把它当成一门新的编程语言来学习:使用一些基本命令来熟悉语法、了解语言中的关键字并实现更复杂的功能,然后再多加练习就可以了。 + +### awk 是如何解析输入内容的 + +`awk` 的本质是将输入的内容看作是一个数组。当 `awk` 扫描一个文本文件时,会把每一行作为一条记录record,每一条记录中又分割为多个字段field。`awk` 记录了各条记录各个字段的信息,并通过内置变量 `NR`(记录数) 和 `NF`(字段数) 来调用相关信息。例如一下这个命令可以查看文件的行数: + +``` +$ awk 'END { print NR;}' example.txt +36 +``` + +从上面的命令可以看出 `awk` 的基本语法,无论是一个单行命令还是一整个脚本,语法都是这样的: + +``` +模式或关键字 { 操作 } +``` + +在上面的例子中,`END` 是一个关键字而不是模式,与此类似的另一个关键字是 `BEGIN`。使用 `BEGIN` 或 `END` 可以让 `awk` 在解析内容前或解析内容后执行大括号中指定的操作。 + +你可以使用模式pattern作为过滤器或限定符,这样 `awk` 只会对匹配模式的对应记录执行指定的操作。以下这个例子就是使用 `awk` 实现 `grep` 命令在文件中查找“Linux”字符串的功能: + +``` +$ awk '/Linux/ { print $0; }' os.txt +OS: CentOS Linux (10.1.1.8) +OS: CentOS Linux (10.1.1.9) +OS: Red Hat Enterprise Linux (RHEL) (10.1.1.11) +OS: Elementary Linux (10.1.2.4) +OS: Elementary Linux (10.1.2.5) +OS: Elementary Linux (10.1.2.6) +``` + +`awk` 会将文件中的每一行作为一条记录,将一条记录中的每个单词作为一个字段,默认情况下会以空格作为字段分隔符field separator(`FS`)切割出记录中的字段。如果想要使用其它内容作为分隔符,可以使用 `--field-separator` 选项指定分隔符: + +``` +$ awk --field-separator ':' '/Linux/ { print $2; }' os.txt + CentOS Linux (10.1.1.8) + CentOS Linux (10.1.1.9) + Red Hat Enterprise Linux (RHEL) (10.1.1.11) + Elementary Linux (10.1.2.4) + Elementary Linux (10.1.2.5) + Elementary Linux (10.1.2.6) +``` + +在上面的例子中,可以看到在 `awk` 处理后每一行的行首都有一个空格,那是因为在源文件中每个冒号(`:`)后面都带有一个空格。和 `cut` 有所不同的是,`awk` 可以指定一个字符串作为分隔符,就像这样: + +``` +$ awk --field-separator ': ' '/Linux/ { print $2; }' os.txt +CentOS Linux (10.1.1.8) +CentOS Linux (10.1.1.9) +Red Hat Enterprise Linux (RHEL) (10.1.1.11) +Elementary Linux (10.1.2.4) +Elementary Linux (10.1.2.5) +Elementary Linux (10.1.2.6) +``` + +### awk 中的函数 + +可以通过这样的语法在 `awk` 中自定义函数: + +``` +函数名称(参数) { 操作 } +``` + +函数的好处在于只需要编写一次就可以多次复用,因此函数在脚本中起到的作用会比在构造单行命令时大。同时 `awk` 自身也带有很多预定义的函数,并且工作原理和其它编程语言或电子表格一样。你只需要了解函数需要接受什么参数,就可以放心使用了。 + +`awk` 中提供了数学运算和字符串处理的相关函数。数学运算函数通常比较简单,传入一个数字,它就会传出一个结果: + +``` +$ awk 'BEGIN { print sqrt(1764); }' +42 +``` + +而字符串处理函数则稍微复杂一点,但 [GNU awk 手册][3]中也有充足的文档。例如 `split()` 函数需要传入一个待分割的单一字段、一个用于存放分割结果的数组,以及用于分割的定界符delimiter。 + +例如前面示例中的输出内容,每条记录的末尾都包含了一个 IP 地址。由于变量 `NF` 代表的是每条记录的字段数量,刚好对应的是每条记录中最后一个字段的序号,因此可以通过引用 `NF` 将每条记录的最后一个字段传入 `split()` 函数: + +``` +$ awk --field-separator ': ' '/Linux/ { split($NF, IP, "."); print "subnet: " IP[3]; }' os.txt +subnet: 1 +subnet: 1 +subnet: 1 +subnet: 2 +subnet: 2 +subnet: 2 +``` + +还有更多的函数,没有理由将自己限制在每个 `awk` 代码块中。你可以在终端中使用 `awk` 构建复杂的管道,也可以编写 `awk` 脚本来定义和使用你自己的函数。 + +### 下载电子书 + +使用 `awk` 本身就是一个学习 `awk` 的过程,即使某些操作使用 `sed`、`grep`、`cut`、`tr` 命令已经完全足够了,也可以尝试使用 `awk` 来实现。只要熟悉了 `awk`,就可以在 Bash 中自定义一些 `awk` 函数,进而解析复杂的数据。 + +[下载我们的这本电子书][4](需注册)学习并开始使用 `awk` 吧! + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/9/awk-ebook + +作者:[Seth Kenlon][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/seth +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/computer_code_programming_laptop.jpg?itok=ormv35tV (Person programming on a laptop on a building) +[2]: https://opensource.com/resources/linux +[3]: https://www.gnu.org/software/gawk/manual/gawk.html +[4]: https://opensource.com/downloads/awk-ebook diff --git a/published/202010/20200908 How to install software with Ansible.md b/published/202010/20200908 How to install software with Ansible.md new file mode 100644 index 0000000000..40a7ea77ad --- /dev/null +++ b/published/202010/20200908 How to install software with Ansible.md @@ -0,0 +1,215 @@ +[#]: collector: (lujun9972) +[#]: translator: (MjSeven) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12703-1.html) +[#]: subject: (How to install software with Ansible) +[#]: via: (https://opensource.com/article/20/9/install-packages-ansible) +[#]: author: (Seth Kenlon https://opensource.com/users/seth) + +如何使用 Ansible 安装软件 +====== + +> 使用 Ansible 剧本自动安装和更新设备上的软件。 + +![](https://img.linux.net.cn/data/attachment/album/202010/10/095024hh65atkh6cc8ntn9.jpg) + +Ansible 是系统管理员和开发人员用来保持计算机系统处于最佳状态的一种流行的自动化工具。与可扩展框架一样,[Ansible][2] 本身功能有限,它真正的功能体现在许多模块中。在某种程度上,Ansible 模块就是 [Linux][3] 系统的命令。它们针对特定问题提供解决方案,而维护计算机时的一项常见任务是使所有计算机的更新和一致。 + +我曾经使用软件包的文本列表来保持系统或多或少的同步:我会列出笔记本电脑上安装的软件包,然后将其与台式机或另一台服务器之间进行交叉参考,手动弥补差异。当然,在 Linux 机器上安装和维护应用程序是 Ansible 的一项基本功能,这意味着你可以在自己关心的计算机上列出所需的内容。 + +### 寻找正确的 Ansible 模块 + +Ansible 模块的数量非常庞大,如何找到能完成你任务的模块?在 Linux 中,你可以在应用程序菜单或 `/usr/bin` 中查找要运行的应用程序。使用 Ansible 时,你可以参考 [Ansible 模块索引][4]。 + +这个索引按照类别列出。稍加搜索,你就很可能找到所需的模块。对于包管理,[Packaging 模块][5]几乎适用于所有带包管理器的系统。 + +### 动手写一个 Ansible 剧本 + +首先,选择本地计算机上的包管理器。例如,如果你打算在运行 Fedora 的笔记本电脑上编写 Ansible 指令(在 Ansible 中称为“剧本playbook”),那么从 `dnf` 模块开始。如果你在 Elementary OS 上编写,使用 `apt` 模块,以此类推。这样你就可以开始进行测试和验证,并可以在以后扩展到其它计算机。 + +第一步是创建一个代表你的剧本的目录。这不是绝对必要的,但这是一个好习惯。Ansible 只需要一个配置文件就可以运行在 YAML 中,但是如果你以后想要扩展剧本,你就可以通过改变目录和文件的方式来控制 Ansible。现在,只需创建一个名为 `install_packages` 或类似的目录: + +``` +$ mkdir ~/install_packages +``` + +你可以根据自己的喜好来命名 Ansible 的剧本,但通常将其命名为 `site.yml`: + +``` +$ touch ~/install_packages/site.yml +``` + +在你最喜欢的文本编辑器中打开 `site.yml`,添加以下内容: + +``` +--- +- hosts: localhost + tasks: + - name: install packages + become: true + become_user: root + dnf: + state: present + name: + - tcsh + - htop +``` + +你必须调整使用的模块名称以匹配你使用的发行版。在此示例中,我使用 `dnf` 是因为我在 Fedora Linux 上编写剧本。 + +就像 Linux 终端中的命令一样,知道 **如何** 来调用 Ansible 模块就已经成功了一半。这个示例剧本遵循标准剧本格式: + + * `hosts` 是一台或多台计算机。在本示例中,目标计算机是 `localhost`,即你当前正在使用的计算机(而不是你希望 Ansible 连接的远程系统)。 + * `tasks` 是你要在主机上执行的任务列表。 + * `name` 是任务的人性化名称。在这种情况下,我使用 `install packages`,因为这就是该任务正在做的事情。 + * `become` 允许 Ansible 更改运行此任务的用户。 + * `become_user` 允许 Ansible 成为 `root` 用户来运行此任务。这是必须的,因为只有 root 用户才能使用 `dnf` 安装应用程序。 + * `dnf` 是模块名称,你可以在 Ansible 网站上的模块索引中找到。 + +`dnf` 下的节点是 `dnf` 模块专用的。这是模块文档的关键所在。就像 Linux 命令的手册页一样,模块文档会告诉你可用的选项和所需的参数。 + +![Ansible 文档][6] + +安装软件包是一个相对简单的任务,仅需要两个元素。`state` 选项指示 Ansible 检查系统上是否存在 **软件包**,而 `name` 选项列出要查找的软件包。Ansible 会针对机器的 **状态** 进行调整,因此模块指令始终意味着更改。假如 Ansible 扫描了系统状态,发现剧本里描述的系统(在本例中,`tcsh` 和 `htop` 存在)与实际状态存在冲突,那么 Ansible 的任务是进行必要的更改来使系统与剧本匹配。Ansible 可以通过 `dnf`(或 `apt` 或者其它任何包管理器)模块进行更改。 + +每个模块可能都有一组不同的选项,所以在编写剧本时,要经常参考模块文档。除非你对模块非常熟悉,否则这是期望模块完成工作的唯一合理方法。 + +### 验证 YAML + +剧本是用 YAML 编写的。因为 YAML 遵循严格的语法,所以安装 `yamllint` 来检查剧本是很有帮助的。更妙的是,有一个专门针对 Ansible 的检查工具称为 `ansible-lint`,它专门为剧本而生。在继续之前,安装它。 + +在 Fedora 或 CentOs 上: + +``` +$ sudo dnf ins tall yamllint python3-ansible-lint +``` + +在 Debian、Elementary 或 Ubuntu 上,同样的: + +``` +$ sudo apt install yamllint ansible-lint +``` + +使用 `ansible-link` 来验证你的剧本。如果你无法使用 `ansible-lint`,你可以使用 `yamllint`。 + +``` +$ ansible-lint ~/install_packages/site.yml +``` + +成功则不返回任何内容,但如果文件中有错误,则必须先修复它们,然后再继续。复制和粘贴过程中的常见错误包括在最后一行的末尾省略换行符、使用制表符而不是空格来缩进。在文本编辑器中修复它们,重新运行 `ansible-lint`,重复这个过程,直到 `ansible-lint` 或 `yamllint` 没有返回为止。 + +### 使用 Ansible 安装一个应用 + +现在你有了一个可验证的有效剧本,你终于可以在本地计算机上运行它了,因为你碰巧知道该剧本定义的任务需要 root 权限,所以在调用 Ansible 时必须使用 `--ask-become-pass` 选项,因此系统会提示你输入管理员密码。 + +开始安装: + +``` +$ ansible-playbook --ask-become-pass ~/install_packages/site.yml +BECOME password: +PLAY [localhost] ****************************** + +TASK [Gathering Facts] ****************************** +ok: [localhost] + +TASK [install packages] ****************************** +ok: [localhost] + +PLAY RECAP ****************************** +localhost: ok=0 changed=2 unreachable=0 failed=0 [...] +``` + +这些命令被执行后,目标系统将处于与剧本中描述的相同的状态。 + +### 在远程系统上安装应用程序 + +通过这么多操作来替换一个简单的命令可能会适得其反,但是 Ansible 的优势是它可以在你的所有系统中实现自动化。你可以使用条件语句使 Ansible 在不同的系统上使用特定的模块,但是现在,假定所有计算机都使用相同的包管理器。 + +要连接到远程系统,你必须在 `/etc/ansible/hosts` 文件中定义远程系统,该文件与 Ansible 是一起安装的,所以它已经存在了,但它可能是空的,除了一些解释性注释之外。使用 `sudo` 在你喜欢的文本编辑器中打开它。 + +你可以通过其 IP 地址或主机名(只要主机名可以解析)定义主机。例如,如果你已经在 `/etc/hosts` 中定义了 `liavara` 并可以成功 `ping` 通,那么你可以在 `/etc/ansible/hosts` 中将 `liavara` 设置为主机。或者,如果你正在运行一个域名服务器或 Avahi 服务器并且可以 `ping` 通 `liavara`,那么你就可以在 `/etc/ansible/hosts` 中定义它。否则,你必须使用它的 IP 地址。 + +你还必须成功地建立与目标主机的安全 shell(SSH)连接。最简单的方法是使用 `ssh-copy-id` 命令,但是如果你以前从未与主机建立 SSH 连接,[阅读我关于如何创建自动 SSH 连接的文章][8]。 + +一旦你在 `/etc/ansible/hosts` 文件中输入了主机名或 IP 地址后,你就可以在剧本中更改 `hosts` 定义: + +``` +--- +- hosts: all +  tasks: +    - name: install packages +      become: true +      become_user: root +      dnf: +        state: present +        name: +         - tcsh +         - htop +``` + +再次运行 `ansible-playbook`: + +``` +$ ansible-playbook --ask-become-pass ~/install_packages/site.yml +``` + +这次,剧本会在你的远程系统上运行。 + +如果你添加更多主机,则有许多方法可以过滤哪个主机执行哪个任务。例如,你可以创建主机组(服务器的 `webserves`,台式机的 `workstations`等)。 + +### 适用于混合环境的 Ansible + +到目前为止,我们一直假定 Ansible 配置的所有主机都运行相同的操作系统(都是是使用 `dnf` 命令进行程序包管理的操作系统)。那么,如果你要管理不同发行版的主机,例如 Ubuntu(使用 `apt`)或 Arch(使用 `pacman`),或者其它的操作系统时,该怎么办? + +只要目标操作系统具有程序包管理器([MacOs 有 Homebrew][9],[Windows 有 Chocolatey][10]),Ansible 就能派上用场。 + +这就是 Ansible 优势最明显的地方。在 shell 脚本中,你必须检查目标主机上有哪些可用的包管理器,即使使用纯 Python,也必须检查操作系统。Ansible 不仅内置了这些功能,而且还具有在剧本中使用命令结果的机制。你可以使用 `action` 关键字来执行由 Ansible 事实收集子系统提供的变量定义的任务,而不是使用 `dnf` 模块。 + +``` +--- +- hosts: all +  tasks: +    - name: install packages +      become: true +      become_user: root +      action: > +       {{ ansible_pkg_mgr }} name=htop,transmission state=present update_cache=yes +``` + +`action` 关键字会加载目标插件。在本例中,它使用了 `ansible_pkg_mgr` 变量,该变量由 Ansible 在初始 **收集信息** 期间填充。你不需要告诉 Ansible 收集有关其运行操作系统的事实,所以很容易忽略这一点,但是当你运行一个剧本时,你会在默认输出中看到它: + +``` +TASK [Gathering Facts] ***************************************** +ok: [localhost] +``` + +`action` 插件使用来自这个探针的信息,使用相关的包管理器命令填充 `ansible_pkg_mgr`,以安装在 `name` 参数之后列出的程序包。使用 8 行代码,你可以克服在其它脚本选项中很少允许的复杂跨平台难题。 + +### 使用 Ansible + +现在是 21 世纪,我们都希望我们的计算机设备能够互联并且相对一致。无论你维护的是两台还是 200 台计算机,你都不必一次又一次地执行相同的维护任务。使用 Ansible 来同步生活中的计算机设备,看看 Ansible 还能为你做些什么。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/9/install-packages-ansible + +作者:[Seth Kenlon][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/seth +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/puzzle_computer_solve_fix_tool.png?itok=U0pH1uwj (Puzzle pieces coming together to form a computer screen) +[2]: https://opensource.com/resources/what-ansible +[3]: https://opensource.com/resources/linux +[4]: https://docs.ansible.com/ansible/latest/modules/modules_by_category.html +[5]: https://docs.ansible.com/ansible/latest/modules/list_of_packaging_modules.html +[6]: https://opensource.com/sites/default/files/uploads/ansible-module.png (Ansible documentation) +[7]: https://creativecommons.org/licenses/by-sa/4.0/ +[8]: https://opensource.com/article/20/8/how-ssh +[9]: https://opensource.com/article/20/6/homebrew-mac +[10]: https://opensource.com/article/20/3/chocolatey diff --git a/published/202010/20200910 Automate your container orchestration with Ansible modules for Kubernetes.md b/published/202010/20200910 Automate your container orchestration with Ansible modules for Kubernetes.md new file mode 100644 index 0000000000..c30f1e28d9 --- /dev/null +++ b/published/202010/20200910 Automate your container orchestration with Ansible modules for Kubernetes.md @@ -0,0 +1,252 @@ +[#]: collector: (lujun9972) +[#]: translator: (HankChow) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12766-1.html) +[#]: subject: (Automate your container orchestration with Ansible modules for Kubernetes) +[#]: via: (https://opensource.com/article/20/9/ansible-modules-kubernetes) +[#]: author: (Seth Kenlon https://opensource.com/users/seth) + +使用 Ansible 的 Kubernetes 模块实现容器编排自动化 +====== + +> 将 Kubernetes 与 Ansible 结合实现云端自动化。此外,还可以参照我们的 Ansible 的 k8s 模块速查表。 + +![](https://img.linux.net.cn/data/attachment/album/202010/28/211747jhlttlf3f81xrffi.jpg) + +[Ansible][2] 是实现自动化工作的优秀工具,而 [Kubernetes][3] 则是容器编排方面的利器,要是把两者结合起来,会有怎样的效果呢?正如你所猜测的,Ansible + Kubernetes 的确可以实现容器编排自动化。 + +### Ansible 模块 + +实际上,Ansible 本身只是一个用于解释 YAML 文件的框架。它真正强大之处在于它[丰富的模块][4],所谓模块module,就是在 Ansible 剧本playbook 中让你得以通过简单配置就能调用外部应用程序的一些工具。 + +Ansible 中有模块可以直接操作 Kubernetes,也有对一些相关组件(例如 [Docker][5] 和 [Podman][6])实现操作的模块。学习使用一个新模块的过程和学习新的终端命令、API 一样,可以先从文档中了解这个模块在调用的时候需要接受哪些参数,以及这些参数在外部应用程序中产生的具体作用。 + +### 访问 Kubernetes 集群 + +在使用 Ansible Kubernetes 模块之前,先要有能够访问 Kubernetes 集群的权限。在没有权限的情况下,可以尝试使用一个短期在线试用账号,但我们更推荐的是按照 Kubernetes 官网上的指引,或是参考 Braynt Son 《[入门 Kubernetes][8]》的教程安装 [Minikube][7]。Minikube 提供了一个单节点 Kubernetes 实例的安装过程,你可以像使用一个完整集群一样对其进行配置和交互。 + +- 下载 [Ansible k8s 速记表][9](需注册) + +在安装 Minikube 之前,你需要确保你的环境支持虚拟化并安装 `libvirt`,然后对 `libvirt` 用户组授权: + +``` +$ sudo dnf install libvirt +$ sudo systemctl start libvirtd +$ sudo usermod --append --groups libvirt `whoami` +$ newgrp libvirt +``` + +#### 安装 Python 模块 + +为了能够在 Ansible 中使用 Kubernetes 相关的模块,你需要安装以下这些 Python 模块: + +``` +$ pip3.6 install kubernetes --user +$ pip3.6 install openshift --user +``` + +#### 启动 Kubernetes + +如果你使用的是 Minikube 而不是完整的 Kubernetes 集群,请使用 `minikube` 命令在本地创建一个最精简化的 Kubernetes 实例: + +``` +$ minikube start --driver=kvm2 --kvm-network default +``` + +然后等待 Minikube 完成初始化,这个过程所需的时间会因实际情况而异。 + +### 获取集群信息 + +集群启动以后,通过 `cluster-info` 选项就可以获取到集群相关信息了: + +``` +$ kubectl cluster-info +Kubernetes master is running at https://192.168.39.190:8443 +KubeDNS is running at https://192.168.39.190:8443/api/v1/namespaces/kube-system/services/kube-dns:dns/proxy + +To further debug and diagnose cluster problems, use 'kubectl cluster-info dump'. +``` + +### 使用 k8s 模块 + +Ansible 使用 `k8s` 这个模块来实现对 Kubernetes 的操作,在剧本中使用 `k8s` 模块就可以对 Kuvernetes 对象进行管理。这个模块描述了 `kubectl` 命令的最终状态,例如对于以下这个使用 `kubectl` 创建新的[命名空间][10]的操作: + +``` +$ kubectl create namespace my-namespace +``` + +这是一个很简单的操作,而对这个操作的最终状态用 YAML 文件来描述是这样的: + +``` +- hosts: localhost +  tasks: +    - name: create namespace +      k8s: +        name: my-namespace +        api_version: v1 +        kind: Namespace +        state: present +``` + +如果你使用的是 Minikube,那么主机名(`hosts`)应该定义为 `localhost`。需要注意的是,所使用的模块也定义了可用参数的语法(例如 `api_version` 和 `kind` 参数)。 + +在运行这个剧本之前,先通过 `yamllint` 命令验证是否有错误: + +``` +$ yamllint example.yaml +``` + +确保没有错误之后,运行剧本: + +``` +$ ansible-playbook ./example.yaml +``` + +可以验证新的命名空间是否已经被创建出来: + +``` +$ kubectl get namespaces +NAME              STATUS   AGE +default           Active   37h +kube-node-lease   Active   37h +kube-public       Active   37h +kube-system       Active   37h +demo              Active   11h +my-namespace      Active   3s +``` + +### 使用 Podman 拉取容器镜像 + +容器是个 Linux 系统,几乎是最小化的,可以由 Kubernetes 管理。[LXC 项目][11]和 Docker 定义了大部分的容器规范。最近加入容器工具集的是 Podman,它不需要守护进程就可以运行,为此受到了很多用户的欢迎。 + +通过 Podman 可以从 Docker Hub 或者 Quay.io 等存储库拉取容器镜像。这一操作对应的 Ansible 语法也很简单,只需要将存储库网站提供的镜像路径写在剧本中的相应位置就可以了: + +``` +   - name: pull an image +      podman_image: +        name: quay.io/jitesoft/nginx +``` + +使用 `yamllint` 验证: + +``` +$ yamllint example.yaml +``` + +运行剧本: + +``` +$ ansible-playbook ./example.yaml +[WARNING]: provided hosts list is empty, only localhost is available. +Note that the implicit localhost does not match 'all' + +PLAY [localhost] ************************ + +TASK [Gathering Facts] ************************ +ok: [localhost] + +TASK [create k8s namespace] ************************ +ok: [localhost] + +TASK [pull an image] ************************ +changed: [localhost] + +PLAY RECAP ************************ +localhost: ok=3 changed=1 unreachable=0 failed=0 +           skipped=0 rescued=0 ignored=0 +``` + +### 使用 Ansible 实现部署 + +Ansible 除了可以执行小型维护任务以外,还可以通过剧本实现其它由 `kubectl` 实现的功能,因为两者的 YAML 文件之间只有少量的差异。在 Kubernetes 中使用的 YAML 文件只需要稍加改动,就可以在 Ansible 剧本中使用。例如下面这个用于使用 `kubectl` 命令部署 Web 服务器的 YAML 文件: + +``` +apiVersion: apps/v1 +kind: Deployment +metadata: +  name: my-webserver +spec: +  selector: +    matchLabels: +      run: my-webserver +  replicas: 1 +  template: +    metadata: +      labels: +        run: my-webserver +    spec: +      containers: +      - name: my-webserver +        image: nginx +        ports: +        - containerPort: 80 +``` + +如果你对其中的参数比较熟悉,你只要把 YAML 文件中的大部分内容放到剧本中的 `definition` 部分,就可以在 Ansible 中使用了: + +``` +   - name: deploy a web server +      k8s: +        api_version: v1 +        namespace: my-namespace +        definition: +          kind: Deployment +          metadata: +            labels: +              app: nginx +            name: nginx-deploy +          spec: +            replicas: 1 +            selector: +              matchLabels: +                app: nginx +            template: +              metadata: +                labels: +                  app: nginx +              spec: +                containers: +                  - name: my-webserver +                    image: quay.io/jitesoft/nginx +                    ports: +                      - containerPort: 80 +                        protocol: TCP +``` + +执行完成后,使用 `kubectl` 命令可以看到预期中的的部署deployment: + +``` +$ kubectl -n my-namespace get pods +NAME                      READY  STATUS +nginx-deploy-7fdc9-t9wc2  1/1    Running +``` + +### 在云上使用模块 + +随着现在越来越多的开发和部署工作往云上转移的趋势,我们必须了解如何在云上实现自动化。其中 `k8s` 和 `podman_image` 这两个模块只是云开发中的其中一小部分。你可以在你的工作流程中寻找一些需要自动化的任务,并学习如何使用 Ansible 让你在这些任务上事半功倍。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/9/ansible-modules-kubernetes + +作者:[Seth Kenlon][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/seth +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/ship_captain_devops_kubernetes_steer.png?itok=LAHfIpek (Ship captain sailing the Kubernetes seas) +[2]: https://opensource.com/resources/what-ansible +[3]: https://opensource.com/resources/what-is-kubernetes +[4]: https://docs.ansible.com/ansible/latest/modules/modules_by_category.html +[5]: https://opensource.com/resources/what-docker +[6]: http://podman.io +[7]: https://kubernetes.io/docs/tasks/tools/install-minikube +[8]: https://opensource.com/article/18/10/getting-started-minikube +[9]: https://opensource.com/downloads/ansible-k8s-cheat-sheet +[10]: https://opensource.com/article/19/10/namespaces-and-containers-linux +[11]: https://www.redhat.com/sysadmin/exploring-containers-lxc diff --git a/published/202010/20200914 NFC vs. Bluetooth LE- When to use which.md b/published/202010/20200914 NFC vs. Bluetooth LE- When to use which.md new file mode 100644 index 0000000000..ddac09e47d --- /dev/null +++ b/published/202010/20200914 NFC vs. Bluetooth LE- When to use which.md @@ -0,0 +1,64 @@ +[#]: collector: (lujun9972) +[#]: translator: (chenmu-kk) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12735-1.html) +[#]: subject: (NFC vs. Bluetooth LE: When to use which) +[#]: via: (https://www.networkworld.com/article/3574932/nfc-vs-bluetooth-le-when-to-use-which.html) +[#]: author: (Jon Gold https://www.networkworld.com/author/Jon-Gold/) + +近场通信 vs. 低功耗蓝牙:如何抉择 +====== + +> 近场通信(NFC)和低功耗蓝牙(BLE)是适合企业不同用途的低功耗无线技术。 + +![](https://images.idgesg.net/images/article/2020/08/distributed_network_of_wifi_wi-fi_internet_connections_across_cityscape_by_metamorworks_gettyimages-926502948_2400x1600-100855926-large.jpg) + +在低功率、相对短距离连接的众多选择中,有两种技术脱颖而出——近场通信(NFC)和低功耗蓝牙(BLE)。两者都具有相对低廉的部署成本且易于使用。 + +NFC 作为许多现代智能卡片的背后技术而为大众所熟知。NFC 芯片必须十分接近(在几厘米内)读卡器来实现连接,但这是它主要企业用例(安全性和访问控制)的一个优势。 + +BLE 是主要蓝牙标准的低功耗衍生品,以较低的潜在吞吐量换来了能耗的显著降低,从而能够适应更广泛的潜在用例。 + +接下来,我们将对每种技术及其主要用例进行更深入的描述。 + +### NFC 的未来 + +NFC 在近距离接触范围内工作(设备间必须靠近到几厘米范围内来进行连接),一个可读的无源 NFC “标签”根本不需要任何独立电源,它会从读卡器的信号中汲取能量,工作频率约为 13.5MHz,在主动读取芯片时需要 100-700µA 的电量。 + +“短距离实际上是它的优势。”Gartner 研究高级总监兼分析师说, “NFC 的一大优点是它不仅仅是无线电,还内置了一个庞大的安全协议。”也就是说,潜在的不良行为者必须非常接近——使用专用设备、在几米的范围内——才能检测到正在发生的 NFC 连接。NFC 还可以施行在 SSL 技术上面一层以提高安全性。 + +考虑到 NFC 本就起源于非接触式支付技术,这不足为奇。它在这一领域的根基在于对零售商的吸引力,零售商可以利用 NFC 让客户在购买商品前获取相关的信息、获得优惠券或者向店员寻求帮助,只需将手机接触到 NFC 热点即可。 + +尽管 NFC 只能在一个很近的范围内使用,这限制了使用 NFC 技术用例场景,但它不仅仅是为了开门和买一杯拿铁。NFC 可以用于引导连接,便于设备间轻松快速的配对,因此用户只需在会议室中将手机贴近配备好的投影仪,即可创建一个 NFC 连接,并验证智能手机是否是一个可连接的授权设备,并进行演示。演示文稿或者视频数据本身不会通过 NFC 来传输,但是 NFC 握手可作为另外的无线协议(例如 Wi-Fi 网络或者任何其他更高带宽可以传输数据的网络)间的验证,从而无需用户登录。 + +### BLE 的特点 + +相较之下,BLE 的工作距离要远的多(长达几十米),其最大带宽 :1 Mbit/s 约为 NFC 连接的两倍。它是著名的蓝牙技术的产物,相较于主线标准的更低功耗,它为机器到机器的连接做了优化。在连接两端的耗电量均小于 15 mA,实用范围约为 10米,可通过 AES 加密保护连接。 + +然而,根据 Forrester 首席分析师 Andre Kindness 的说法,它远非 NFC 的替代品。 + +他说:“从信息传递角度来看, [NFC] 比 BLE 快得多。”BLE 通常需要几分之一秒或更长时间的验证并安全连接,而 NFC 几乎在瞬间完成连接。 + +不过,根据 IDC 高级研究分析师 Patrick Filkins 的说法,相较于 NFC,BLE 由于范围更广而有着更多的通用性。 + +他说:“我认为 BLE 比较适合企业”。而类似于资产追踪、室内导航和目标广告的用例只是冰山一角。 + +对于企业,结果是相当直接的——NFC 用例大多与公司使用蓝牙的用例是分开的,对于少有的可以选择的重叠,相对的优势和劣势显而易见。NFC 距离很短、价格便宜、可即时连接以及数据转换率较低。BLE 的工作距离更远、传输速率更高,成本也更高,连接时还需要一点时间来进行“握手”。 + +-------------------------------------------------------------------------------- + +via: https://www.networkworld.com/article/3574932/nfc-vs-bluetooth-le-when-to-use-which.html + +作者:[Jon Gold][a] +选题:[lujun9972][b] +译者:[chenmu-kk](https://github.com/chenmu-kk) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://www.networkworld.com/author/Jon-Gold/ +[b]: https://github.com/lujun9972 +[1]: https://www.networkworld.com/newsletters/signup.html +[2]: https://www.facebook.com/NetworkWorld/ +[3]: https://www.linkedin.com/company/network-world diff --git a/published/202010/20200916 How to Create-Configure LVM (Logical Volume Management) in Linux.md b/published/202010/20200916 How to Create-Configure LVM (Logical Volume Management) in Linux.md new file mode 100644 index 0000000000..d89593b28d --- /dev/null +++ b/published/202010/20200916 How to Create-Configure LVM (Logical Volume Management) in Linux.md @@ -0,0 +1,325 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12670-1.html) +[#]: subject: (How to Create/Configure LVM in Linux) +[#]: via: (https://www.2daygeek.com/create-lvm-storage-logical-volume-manager-in-linux/) +[#]: author: (Magesh Maruthamuthu https://www.2daygeek.com/author/magesh/) + +如何在 Linux 中创建/配置 LVM(逻辑卷管理) +====== + +![](https://img.linux.net.cn/data/attachment/album/202010/01/111414m2y0mdhgvd9j1bgv.jpg) + +逻辑卷管理Logical Volume Management(LVM)在 Linux 系统中扮演着重要的角色,它可以提高可用性、磁盘 I/O、性能和磁盘管理的能力。 + +LVM 是一种被广泛使用的技术,对于磁盘管理来说,它是非常灵活的。 + +它在物理磁盘和文件系统之间增加了一个额外的层,允许你创建一个逻辑卷而不是物理磁盘。 + +LVM 允许你在需要的时候轻松地调整、扩展和减少逻辑卷的大小。 + +![](https://img.linux.net.cn/data/attachment/album/202010/01/111230el14fubc4ku55o3k.jpeg) + +### 如何创建 LVM 物理卷? + +你可以使用任何磁盘、RAID 阵列、SAN 磁盘或分区作为 LVM 物理卷Physical Volume(PV)。 + +让我们想象一下,你已经添加了三个磁盘,它们是 `/dev/sdb`、`/dev/sdc` 和 `/dev/sdd`。 + +运行以下命令来[发现 Linux 中新添加的 LUN 或磁盘][2]: + +``` +# ls /sys/class/scsi_host +host0 +``` + +``` +# echo "- - -" > /sys/class/scsi_host/host0/scan +``` + +``` +# fdisk -l +``` + +**创建物理卷 (`pvcreate`) 的一般语法:** + +``` +pvcreate [物理卷名] +``` + +当在系统中检测到磁盘,使用 `pvcreate` 命令初始化 LVM PV: + +``` +# pvcreate /dev/sdb /dev/sdc /dev/sdd +Physical volume "/dev/sdb" successfully created +Physical volume "/dev/sdc" successfully created +Physical volume "/dev/sdd" successfully created +``` + +**请注意:** + + * 上面的命令将删除给定磁盘 `/dev/sdb`、`/dev/sdc` 和 `/dev/sdd` 上的所有数据。 + * 物理磁盘可以直接添加到 LVM PV 中,而不必是磁盘分区。 + +使用 `pvdisplay` 和 `pvs` 命令来显示你创建的 PV。`pvs` 命令显示的是摘要输出,`pvdisplay` 显示的是 PV 的详细输出: + +``` +# pvs +PV VG Fmt Attr PSize PFree +/dev/sdb lvm2 a-- 15.00g 15.00g +/dev/sdc lvm2 a-- 15.00g 15.00g +/dev/sdd lvm2 a-- 15.00g 15.00g +``` + +``` +# pvdisplay + +"/dev/sdb" is a new physical volume of "15.00 GiB" +--- NEW Physical volume --- +PV Name /dev/sdb +VG Name +PV Size 15.00 GiB +Allocatable NO +PE Size 0 +Total PE 0 +Free PE 0 +Allocated PE 0 +PV UUID 69d9dd18-36be-4631-9ebb-78f05fe3217f + +"/dev/sdc" is a new physical volume of "15.00 GiB" +--- NEW Physical volume --- +PV Name /dev/sdc +VG Name +PV Size 15.00 GiB +Allocatable NO +PE Size 0 +Total PE 0 +Free PE 0 +Allocated PE 0 +PV UUID a2092b92-af29-4760-8e68-7a201922573b + +"/dev/sdd" is a new physical volume of "15.00 GiB" +--- NEW Physical volume --- +PV Name /dev/sdd +VG Name +PV Size 15.00 GiB +Allocatable NO +PE Size 0 +Total PE 0 +Free PE 0 +Allocated PE 0 +PV UUID d92fa769-e00f-4fd7-b6ed-ecf7224af7faS +``` + +### 如何创建一个卷组 + +卷组Volume Group(VG)是 LVM 结构中的另一层。基本上,卷组由你创建的 LVM 物理卷组成,你可以将物理卷添加到现有的卷组中,或者根据需要为物理卷创建新的卷组。 + +**创建卷组 (`vgcreate`) 的一般语法:** + +``` +vgcreate [卷组名] [物理卷名] +``` + +使用以下命令将一个新的物理卷添加到新的卷组中: + +``` +# vgcreate vg01 /dev/sdb /dev/sdc /dev/sdd +Volume group "vg01" successfully created +``` + +**请注意:**默认情况下,它使用 4MB 的物理范围Physical Extent(PE),但你可以根据你的需要改变它。 + +使用 `vgs` 和 `vgdisplay` 命令来显示你创建的 VG 的信息: + +``` +# vgs vg01 +VG #PV #LV #SN Attr VSize VFree +vg01 3 0 0 wz--n- 44.99g 44.99g +``` + +``` +# vgdisplay vg01 +--- Volume group --- +VG Name vg01 +System ID +Format lvm2 +Metadata Areas 3 +Metadata Sequence No 1 +VG Access read/write +VG Status resizable +MAX LV 0 +Cur LV 0 +Open LV 0 +Max PV 0 +Cur PV 3 +Act PV 3 +VG Size 44.99 GiB +PE Size 4.00 MiB +Total PE 11511 +Alloc PE / Size 0 / 0 +Free PE / Size 11511 / 44.99 GiB +VG UUID d17e3c31-e2c9-4f11-809c-94a549bc43b7 +``` + +### 如何扩展卷组 + +如果 VG 没有空间,请使用以下命令将新的物理卷添加到现有卷组中。 + +**卷组扩展 (`vgextend`)的一般语法:** + +``` +vgextend [已有卷组名] [物理卷名] +``` + +``` +# vgextend vg01 /dev/sde + Volume group "vg01" successfully extended +``` + +### 如何以 GB 为单位创建逻辑卷? + +逻辑卷Logical Volume(LV)是 LVM 结构中的顶层。逻辑卷是由卷组创建的块设备。它作为一个虚拟磁盘分区,可以使用 LVM 命令轻松管理。 + +你可以使用 `lvcreate` 命令创建一个新的逻辑卷。 + +**创建逻辑卷(`lvcreate`) 的一般语法:** + +``` +lvcreate –n [逻辑卷名] –L [逻辑卷大小] [要创建的 LV 所在的卷组名称] +``` + +运行下面的命令,创建一个大小为 10GB 的逻辑卷 `lv001`: + +``` +# lvcreate -n lv001 -L 10G vg01 +Logical volume "lv001" created +``` + +使用 `lvs` 和 `lvdisplay` 命令来显示你所创建的 LV 的信息: + +``` +# lvs /dev/vg01/lvol01 +LV VG Attr LSize Pool Origin Data% Move Log Cpy%Sync Convert +lv001 vg01 mwi-a-m-- 10.00g lv001_mlog 100.00 +``` + +``` +# lvdisplay /dev/vg01/lv001 +--- Logical volume --- +LV Path /dev/vg01/lv001 +LV Name lv001 +VG Name vg01 +LV UUID ca307aa4-0866-49b1-8184-004025789e63 +LV Write Access read/write +LV Creation host, time localhost.localdomain, 2020-09-10 11:43:05 -0700 +LV Status available +# open 0 +LV Size 10.00 GiB +Current LE 2560 +Segments 1 +Allocation inherit +Read ahead sectors auto +- currently set to 256 +Block device 253:4 +``` + +### 如何以 PE 大小创建逻辑卷? + +或者,你可以使用物理范围(PE)大小创建逻辑卷。 + +### 如何计算 PE 值? + +很简单,例如,如果你有一个 10GB 的卷组,那么 PE 大小是多少? + +默认情况下,它使用 4MB 的物理范围,但可以通过运行 `vgdisplay` 命令来检查正确的 PE 大小,因为这可以根据需求进行更改。 + +``` +10GB = 10240MB / 4MB (PE 大小) = 2560 PE +``` + +**用 PE 大小创建逻辑卷 (`lvcreate`) 的一般语法:** + +``` +lvcreate –n [逻辑卷名] –l [物理扩展 (PE) 大小] [要创建的 LV 所在的卷组名称] +``` + +要使用 PE 大小创建 10GB 的逻辑卷,命令如下: + +``` +# lvcreate -n lv001 -l 2560 vg01 +``` + +### 如何创建文件系统 + +在创建有效的文件系统之前,你不能使用逻辑卷。 + +**创建文件系统的一般语法:** + +``` +mkfs –t [文件系统类型] /dev/[LV 所在的卷组名称]/[LV 名称] +``` + +使用以下命令将逻辑卷 `lv001` 格式化为 ext4 文件系统: + +``` +# mkfs -t ext4 /dev/vg01/lv001 +``` + +对于 xfs 文件系统: + +``` +# mkfs -t xfs /dev/vg01/lv001 +``` + +### 挂载逻辑卷 + +最后,你需要挂载逻辑卷来使用它。确保在 `/etc/fstab` 中添加一个条目,以便系统启动时自动加载。 + +创建一个目录来挂载逻辑卷: + +``` +# mkdir /lvmtest +``` + +使用挂载命令[挂载逻辑卷][3]: + +``` +# mount /dev/vg01/lv001 /lvmtest +``` + +在 [/etc/fstab 文件][4]中添加新的逻辑卷详细信息,以便系统启动时自动挂载: + +``` +# vi /etc/fstab +/dev/vg01/lv001 /lvmtest xfs defaults 0 0 +``` + +使用 [df 命令][5]检查新挂载的卷: + +``` +# df -h /lvmtest +Filesystem Size Used Avail Use% Mounted on +/dev/mapper/vg01-lv001 15360M 34M 15326M 4% /lvmtest +``` + +-------------------------------------------------------------------------------- + +via: https://www.2daygeek.com/create-lvm-storage-logical-volume-manager-in-linux/ + +作者:[Magesh Maruthamuthu][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://www.2daygeek.com/author/magesh/ +[b]: https://github.com/lujun9972 +[1]: https://www.2daygeek.com/wp-content/uploads/2020/09/create-lvm-storage-logical-volume-manager-in-linux-2.png +[2]: https://www.2daygeek.com/scan-detect-luns-scsi-disks-on-redhat-centos-oracle-linux/ +[3]: https://www.2daygeek.com/mount-unmount-file-system-partition-in-linux/ +[4]: https://www.2daygeek.com/understanding-linux-etc-fstab-file/ +[5]: https://www.2daygeek.com/linux-check-disk-space-usage-df-command/ diff --git a/published/202010/20200917 GNOME 3.38 is Here With Customizable App Grid, Performance Improvements and Tons of Other Changes.md b/published/202010/20200917 GNOME 3.38 is Here With Customizable App Grid, Performance Improvements and Tons of Other Changes.md new file mode 100644 index 0000000000..b51f072124 --- /dev/null +++ b/published/202010/20200917 GNOME 3.38 is Here With Customizable App Grid, Performance Improvements and Tons of Other Changes.md @@ -0,0 +1,121 @@ +[#]: collector: (lujun9972) +[#]: translator: (robsean) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12726-1.html) +[#]: subject: (GNOME 3.38 is Here With Customizable App Grid, Performance Improvements and Tons of Other Changes) +[#]: via: (https://itsfoss.com/gnome-3-38-release/) +[#]: author: (Ankush Das https://itsfoss.com/author/ankush/) + +GNOME 3.38:可定制应用程序网格、性能改善 +====== + +![](https://img.linux.net.cn/data/attachment/album/202010/16/203906xys0py0nvi1d01ss.jpg) + +[GNOME 3.36][1] 带来大量亟需的改进,同时也带来性能的重大提升。现在,在 6 个月后,我们终于引来了 GNOME 3.38,并带来了一系列重大的变化。 + +### GNOME 3.38 主要特色 + +这里是 GNOME 3.38 (代码名称:Orbis) 的主要亮点: + +- [video](https://www.youtube.com/embed/DZ_P5W9r2JY) + +#### 可定制应用程序菜单 + +作为 GNOME 3.38 重大更改中的一部分,应用程序网格(或称应用菜单)现在是可以可定制的。 + +现在,你可以通过拖拽每个应用程序图标来创建文件夹,将它们移到文件夹,或移出文件夹并将其设置回应用网格。你也可以在应用网格中随心所欲地调整图标的位置。 + +![][3] + +此外,这些变化是一些即将到来的设计更改的基本组成部分,因此,看到我们可以期待的东西会很令人兴奋。 + +#### 日历菜单更新 + +![][4] + +随着最近一次的 GNOME 更新,通知区整洁了很多,但是现在随着 GNOME 3.38 的到来,你终于可以通过日历区域的正下方访问日历事件,使事情变得方便且容易访问。 + +它不是一个重大的视觉改造,但也是一些改善。 + +#### 家长控制改善 + +作为 GNOME 3.38 一部分,你将会注意家长控制服务。它支持与桌面、shell、设置以及其它各种各样组件的集成,来帮助你限制用户可以访问的内容。 + +#### 重新启动按钮 + +一些细微的改善导致了巨大的变化,重新启动按钮正是其中的一个变化。先单击 “关闭电源” / “关机” 按钮,再单击 “重新启动” 按钮的操作来重新启动系统总是让人很烦。 + +因此,随着 GNOME 3.38 的到来,你将最终会注意到一个作为单独按钮的 “重新启动” ,这将节省你的单击次数,平复你烦闷的心情。 + +#### 屏幕录制改善 + +[GNOME shell 内置的屏幕录制][5] 现在是一项独立的系统服务,这可能会使录制屏幕成为一种平滑流畅的体验。 + +另外,窗口截屏也有一些改善,并修复了一些错误: + +- [video](https://www.youtube.com/embed/c29ge3KwBk8) + +#### GNOME 应用程序更新 + +GNOME 计算器也收到很多的错误修复。除此之外,你也将发现 [epiphany GNOME 浏览器][6] 的一些重大改变。 + +GNOME Boxes 现在允许你从一个操作系统列表中选择将要运行的操作系统,GNOME 地图也有一些图像用户界面上的更改。 + +当然,不仅限于这些,你页将注意到 GNOME 控制中心、联系人、照片、Nautilus,以及其它一些软件包的细微更新和修复。 + +#### 性能和多显示器支持改善 + +这里有一大堆底层的改进来全面地改善 GNOME 3.38 。例如,[Mutter][7] 有一些重要的修正,它现在允许在两个显示器中使用不同的刷新频率。 + +![][8] + +先前,如果一台显示器的刷新频率为 60 Hz,而另一台的刷新频率为 144 Hz ,那么刷新频率较慢的显示器将限制另外一台显示器的刷新频率。但是,随着在 GNOME 3.38 中的改善,它将能够处理多个显示器,而不会使显示器相互限制。 + +另外,[Phoronix][9] 报告的一些更改指出,在一些情况下,缩短大约 10% 的渲染时间。因此,这绝对是一个很棒的性能优化。 + +#### 各种各样的其它更改 + + * 电池百分比指示器 + * 电源菜单中的重新启动选项 + * 新的欢迎指引 + * 指纹登录 + * 二维码扫描以共享 Wi-Fi 热点 + * GNOME 浏览器的隐私和其它改善 + * GNOME 地图现在反应敏捷并能根据屏幕大小改变其大小 + * 重新修订的图标 + +你可以在它们的官方 [更改日志][10] 中找到一个详细的更改列表。 + +### 总结 + +GNOME 3.38 确实是一个令人赞叹的更新,它改善了 GNOME 用户体验。尽管 GNOME 3.36 带来了性能的很大改善,但是针对 GNOME 3.38 的更多优化仍然是一件非常好的事. + +GNOME 3.38 将在 Ubuntu 20.10 和 [Fedora 33][11] 中可用。Arch 和 Manjaro 用户应该很快就能获得。 + +我认为有很多变化是朝着正确的方向发展的。你觉得呢? + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/gnome-3-38-release/ + +作者:[Ankush Das][a] +选题:[lujun9972][b] +译者:[robsean](https://github.com/robsean) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://itsfoss.com/author/ankush/ +[b]: https://github.com/lujun9972 +[1]: https://itsfoss.com/gnome-3-36-release/ +[2]: https://www.youtube.com/c/itsfoss?sub_confirmation=1 +[3]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/09/gnome-app-arranger.jpg?resize=799%2C450&ssl=1 +[4]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/09/gnome-3-38-calendar-menu.png?resize=800%2C721&ssl=1 +[5]: https://itsfoss.com/gnome-screen-recorder/ +[6]: https://en.wikipedia.org/wiki/GNOME_Web +[7]: https://en.wikipedia.org/wiki/Mutter_(software) +[8]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/09/gnome-multi-monitor-refresh-rate.jpg?resize=800%2C369&ssl=1 +[9]: https://www.phoronix.com/scan.php?page=news_item&px=GNOME-3.38-Last-Min-Mutter +[10]: https://help.gnome.org/misc/release-notes/3.38 +[11]: https://itsfoss.com/fedora-33/ diff --git a/published/202010/20200918 How to Extend-Increase LVM-s (Logical Volume Resize) in Linux.md b/published/202010/20200918 How to Extend-Increase LVM-s (Logical Volume Resize) in Linux.md new file mode 100644 index 0000000000..db9b0c9679 --- /dev/null +++ b/published/202010/20200918 How to Extend-Increase LVM-s (Logical Volume Resize) in Linux.md @@ -0,0 +1,173 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12673-1.html) +[#]: subject: (How to Extend/Increase LVM’s in Linux) +[#]: via: (https://www.2daygeek.com/extend-increase-resize-lvm-logical-volume-in-linux/) +[#]: author: (Magesh Maruthamuthu https://www.2daygeek.com/author/magesh/) + +如何在 Linux 中扩展/增加 LVM 大小(逻辑卷调整) +====== + +![](https://img.linux.net.cn/data/attachment/album/202010/01/234018qgnwilmmzom8xarb.jpg) + +扩展逻辑卷非常简单,只需要很少的步骤,而且不需要卸载某个逻辑卷就可以在线完成。 + +LVM 的主要目的是灵活的磁盘管理,当你需要的时候,可以很方便地调整、扩展和缩小逻辑卷的大小。 + +如果你是逻辑卷管理(LVM) 新手,我建议你从我们之前的文章开始学习。 + + * **第一部分:[如何在 Linux 中创建/配置 LVM(逻辑卷管理)][1]** + +![](https://img.linux.net.cn/data/attachment/album/202010/01/233946ybwbnw4zanjbn00e.jpeg) + +扩展逻辑卷涉及到以下步骤: + + * 检查逻辑卷(LV)所在的卷组中是否有足够的未分配磁盘空间 + * 如果有,你可以使用这些空间来扩展逻辑卷 + * 如果没有,请向系统中添加新的磁盘或 LUN + * 将物理磁盘转换为物理卷(PV) + * 扩展卷组 + * 增加逻辑卷大小 + * 扩大文件系统 + * 检查扩展的文件系统大小 + +### 如何创建 LVM 物理卷? + +使用 `pvcreate` 命令创建 LVM 物理卷。 + +当在操作系统中检测到磁盘,使用 `pvcreate` 命令初始化 LVM 物理卷: + +``` +# pvcreate /dev/sdc +Physical volume "/dev/sdc" successfully created +``` + +**请注意:** + + * 上面的命令将删除磁盘 `/dev/sdc` 上的所有数据。 + * 物理磁盘可以直接添加到 LVM 物理卷中,而不是磁盘分区。 + +使用 `pvdisplay` 命令来显示你所创建的物理卷: + +``` +# pvdisplay /dev/sdc + +"/dev/sdc" is a new physical volume of "10.00 GiB" +--- NEW Physical volume --- +PV Name /dev/sdc +VG Name +PV Size 10.00 GiB +Allocatable NO +PE Size 0 +Total PE 0 +Free PE 0 +Allocated PE 0 +PV UUID 69d9dd18-36be-4631-9ebb-78f05fe3217f +``` + +### 如何扩展卷组 + +使用以下命令在现有的卷组(VG)中添加一个新的物理卷: + +``` +# vgextend vg01 /dev/sdc +Volume group "vg01" successfully extended +``` + +使用 `vgdisplay` 命令来显示你所创建的物理卷: + +``` +# vgdisplay vg01 +--- Volume group --- +VG Name vg01 +System ID +Format lvm2 +Metadata Areas 2 +Metadata Sequence No 1 +VG Access read/write +VG Status resizable +MAX LV 0 +Cur LV 0 +Open LV 0 +Max PV 0 +Cur PV 2 +Act PV 2 +VG Size 14.99 GiB +PE Size 4.00 MiB +Total PE 3840 +Alloc PE / Size 1280 / 4.99 +Free PE / Size 2560 / 9.99 GiB +VG UUID d17e3c31-e2c9-4f11-809c-94a549bc43b7 +``` + +### 如何扩展逻辑卷? + +使用以下命令增加现有逻辑卷大小。 + +**逻辑卷扩展(`lvextend`)的常用语法:** + +``` +lvextend [要增加的额外空间] [现有逻辑卷名称] +``` + +使用下面的命令将现有的逻辑卷增加 10GB: + +``` +# lvextend -L +10G /dev/mapper/vg01-lv002 +Rounding size to boundary between physical extents: 5.90 GiB +Size of logical volume vg01/lv002 changed from 5.00 GiB (1280 extents) to 15.00 GiB (3840 extents). +Logical volume var successfully resized +``` + +使用 PE 大小来扩展逻辑卷: + +``` +# lvextend -l +2560 /dev/mapper/vg01-lv002 +``` + +要使用百分比(%)扩展逻辑卷,请使用以下命令: + +``` +# lvextend -l +40%FREE /dev/mapper/vg01-lv002 +``` + +现在,逻辑卷已经扩展,你需要调整文件系统的大小以扩展逻辑卷内的空间: + +对于基于 ext3 和 ext4 的文件系统,运行以下命令: + +``` +# resize2fs /dev/mapper/vg01-lv002 +``` + +对于 xfs 文件系统,使用以下命令: + +``` +# xfs_growfs /dev/mapper/vg01-lv002 +``` + +使用 [df 命令][3]查看文件系统大小: + +``` +# df -h /lvmtest1 +Filesystem Size Used Avail Use% Mounted on +/dev/mapper/vg01-lv002 15360M 34M 15326M 4% /lvmtest1 +``` + +-------------------------------------------------------------------------------- + +via: https://www.2daygeek.com/extend-increase-resize-lvm-logical-volume-in-linux/ + +作者:[Magesh Maruthamuthu][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://www.2daygeek.com/author/magesh/ +[b]: https://github.com/lujun9972 +[1]: https://linux.cn/article-12670-1.html +[2]: https://www.2daygeek.com/wp-content/uploads/2020/09/extend-increase-resize-lvm-logical-volume-in-linux-3.png +[3]: https://www.2daygeek.com/linux-check-disk-space-usage-df-command/ diff --git a/published/202010/20200921 Installing and running Vagrant using qemu-kvm.md b/published/202010/20200921 Installing and running Vagrant using qemu-kvm.md new file mode 100644 index 0000000000..336a5bd209 --- /dev/null +++ b/published/202010/20200921 Installing and running Vagrant using qemu-kvm.md @@ -0,0 +1,153 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12676-1.html) +[#]: subject: (Installing and running Vagrant using qemu-kvm) +[#]: via: (https://fedoramagazine.org/vagrant-qemukvm-fedora-devops-sysadmin/) +[#]: author: (Andy Mott https://fedoramagazine.org/author/amott/) + +使用 qemu-kvm 安装和运行 Vagrant +====== + +![][1] + +Vagrant 是一个出色的工具,DevOps 专业人员、程序员、系统管理员和普通极客来使用它来建立可重复的基础架构来进行开发和测试。引用自它的网站: + +> Vagrant 是用于在单工作流程中构建和管理虚拟机环境的工具。凭借简单易用的工作流程并专注于自动化,Vagrant 降低了开发环境的设置时间,提高了生产效率,并使“在我的机器上可以工作”的借口成为过去。 +> +> 如果你已经熟悉 Vagrant 的基础知识,那么该文档为所有的功能和内部结构提供了更好的参考。 +> +> Vagrant 提供了基于行业标准技术构建的、易于配置、可复制、可移植的工作环境,并由一个一致的工作流程控制,帮助你和你的团队最大限度地提高生产力和灵活性。 +> +> + +本指南将逐步介绍使 Vagrant 在基于 Fedora 的计算机上工作所需的步骤。 + +我从最小化安装 Fedora 服务器开始,因为这样可以减少宿主机操作系统的内存占用,但如果你已经有一台可以使用的 Fedora 机器,无论是服务器还是工作站版本,那么也没问题。 + +### 检查机器是否支持虚拟化 + +``` +$ sudo lscpu | grep Virtualization +``` + +``` +Virtualization: VT-x +Virtualization type: full +``` + +### 安装 qemu-kvm + +``` +sudo dnf install qemu-kvm libvirt libguestfs-tools virt-install rsync +``` + +### 启用并启动 libvirt 守护进程 + +``` +sudo systemctl enable --now libvirtd +``` + +### 安装 Vagrant + +``` +sudo dnf install vagrant +``` + +### 安装 Vagrant libvirtd 插件 + +``` +sudo vagrant plugin install vagrant-libvirt +``` + +### 添加一个 box + +``` +vagrant box add fedora/32-cloud-base --provider=libvirt +``` + +(LCTT 译注:以防你不知道,box 是 Vagrant 中的一种包格式,Vagrant 支持的任何平台上的任何人都可以使用盒子来建立相同的工作环境。) + +### 创建一个最小化的 Vagrantfile 来测试 + +``` +$ mkdir vagrant-test +$ cd vagrant-test +$ vi Vagrantfile +``` + +``` +Vagrant.configure("2") do |config| + config.vm.box = "fedora/32-cloud-base" +end +``` + +**注意文件名和文件内容的大小写。** + +### 检查文件 + +``` +vagrant status +``` + +``` +Current machine states: + +default not created (libvirt) + +The Libvirt domain is not created. Run 'vagrant up' to create it. +``` + +### 启动 box + +``` +vagrant up +``` + +### 连接到你的新机器 + +``` +vagrant ssh +``` + +完成了。现在你的 Fedora 机器上 Vagrant 可以工作了。 + +要停止该机器,请使用 `vagrant halt`。这只是简单地停止机器,但保留虚拟机和磁盘。 +要关闭并删除它,请使用 `vagrant destroy`。这将删除整个机器和你在其中所做的任何更改。 + +### 接下来的步骤 + +在运行 `vagrant up` 命令之前,你不需要下载 box。你可以直接在 Vagrantfile 中指定 box 和提供者,如果还没有的话,Vagrant 会下载它。下面是一个例子,它还设置了内存量和 CPU 数量: + +``` +# -*- mode: ruby -*- +# vi: set ft=ruby : + +Vagrant.configure("2") do |config| + config.vm.box = "fedora/32-cloud-base" + config.vm.provider :libvirt do |libvirt| + libvirt.cpus = 1 + libvirt.memory = 1024 + end +end +``` + +关于使用 Vagrant、创建你自己的机器和使用不同 box 的更多信息,请参见官方文档 。 + +有一个庞大的仓库,你可以随时下载使用这些 box,它们的的官方仓库是 Vagrant Cloud - 。这里有些是基本的操作系统,有些提供完整的功能,如数据库、网络服务器等。 + +-------------------------------------------------------------------------------- + +via: https://fedoramagazine.org/vagrant-qemukvm-fedora-devops-sysadmin/ + +作者:[Andy Mott][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://fedoramagazine.org/author/amott/ +[b]: https://github.com/lujun9972 +[1]: https://fedoramagazine.org/wp-content/uploads/2020/09/vagrant-beginner-howto-816x346.png diff --git a/published/202010/20200922 How to Reduce-Shrink LVM-s (Logical Volume Resize) in Linux.md b/published/202010/20200922 How to Reduce-Shrink LVM-s (Logical Volume Resize) in Linux.md new file mode 100644 index 0000000000..7d1348c83f --- /dev/null +++ b/published/202010/20200922 How to Reduce-Shrink LVM-s (Logical Volume Resize) in Linux.md @@ -0,0 +1,169 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12740-1.html) +[#]: subject: (How to Reduce/Shrink LVM’s \(Logical Volume Resize\) in Linux) +[#]: via: (https://www.2daygeek.com/reduce-shrink-decrease-resize-lvm-logical-volume-in-linux/) +[#]: author: (Magesh Maruthamuthu https://www.2daygeek.com/author/magesh/) + +如何在 Linux 中减少/缩小 LVM 大小(逻辑卷调整) +====== + +![](https://img.linux.net.cn/data/attachment/album/202010/21/210459ydp5an23nfzgglyy.jpg) + +减少/缩小逻辑卷是数据损坏的最高风险。 + +所以,如果可能的话,尽量避免这种情况,但如果没有其他选择的话,那就继续。 + +缩减 LVM 之前,建议先做一个备份。 + +当你在 LVM 中的磁盘空间耗尽时,你可以通过缩小现有的没有使用全部空间的 LVM,而不是增加一个新的物理磁盘,在卷组上腾出一些空闲空间。 + +**需要注意的是:** 在 GFS2 或者 XFS 文件系统上不支持缩小。 + +如果你是逻辑卷管理 (LVM) 的新手,我建议你从我们之前的文章开始学习。 + +* **第一部分:[如何在 Linux 中创建/配置 LVM(逻辑卷管理)][1]** +* **第二部分:[如何在 Linux 中扩展/增加 LVM(逻辑卷调整)][2]** + +![](https://img.linux.net.cn/data/attachment/album/202010/21/210610kikq1xynfje7hjaa.jpeg) + +减少逻辑卷涉及以下步骤: + + * 卸载文件系统 + * 检查文件系统是否有任何错误 + * 缩小文件系统的大小 + * 缩小逻辑卷的大小 + * 重新检查文件系统是否存在错误(可选) + * 挂载文件系统 + * 检查减少后的文件系统大小 + +**比如:** 你有一个 **100GB** 的没有使用全部空间的 LVM,你想把它减少到 **80GB**,这样 **20GB** 可以用于其他用途。 + +``` +# df -h /testlvm1 + +Filesystem Size Used Avail Use% Mounted on +/dev/mapper/vg01-lv002 100G 15G 85G 12% /testlvm1 +``` + +### 卸载文件系统 + +使用 `umount` 命令卸载文件系统: + +``` +# umount /testlvm1 +``` + +### 检查文件系统是否有任何错误 + +使用 `e2fsck` 命令检查文件系统是否有错误: + +``` +# e2fsck -f /dev/mapper/vg01-lv002 + +e2fsck 1.42.9 (28-Dec-2013) +Pass 1: Checking inodes, blocks, and sizes +Pass 2: Checking directory structure +Pass 3: Checking directory connectivity +Pass 4: Checking reference counts +Pass 5: Checking group summary information +/dev/mapper/vg01-lv002: 13/6553600 files (0.0% non-contiguous), 12231854/26212352 blocks +``` + +### 缩小文件系统 + +下面的命令将把 `testlvm1` 文件系统从 **100GB** 缩小到 **80GB**。 + +**文件系统大小调整的常用语法(`resize2fs`)**: + +``` +resize2fs [现有逻辑卷名] [新的文件系统大小] +``` + +实际命令如下: + +``` +# resize2fs /dev/mapper/vg01-lv002 80G + +resize2fs 1.42.9 (28-Dec-2013) +Resizing the filesystem on /dev/mapper/vg01-lv002 to 28321400 (4k) blocks. +The filesystem on /dev/mapper/vg01-lv002 is now 28321400 blocks long. +``` + +### 减少逻辑卷 (LVM) 容量 + +现在使用 `lvreduce` 命令缩小逻辑卷(LVM) 的大小。通过下面的命令, `/dev/mapper/vg01-lv002` 将把逻辑卷 (LVM) 从 100GB 缩小到 80GB。 + +**LVM 缩减 (`lvreduce`) 的常用语法**: + +``` +lvreduce [新的 LVM 大小] [现有逻辑卷名称] +``` + +实际命令如下: + +``` +# lvreduce -L 80G /dev/mapper/vg01-lv002 + +WARNING: Reducing active logical volume to 80.00 GiB +THIS MAY DESTROY YOUR DATA (filesystem etc.) +Do you really want to reduce lv002? [y/n]: y +Reducing logical volume lv002 to 80.00 GiB +Logical volume lv002 successfully resized +``` + +### 可选:检查文件系统是否有错误 + +缩减 LVM 后再次检查文件系统是否有错误: + +``` +# e2fsck -f /dev/mapper/vg01-lv002 + +e2fsck 1.42.9 (28-Dec-2013) +Pass 1: Checking inodes, blocks, and sizes +Pass 2: Checking directory structure +Pass 3: Checking directory connectivity +Pass 4: Checking reference counts +Pass 5: Checking group summary information +/dev/mapper/vg01-lv002: 13/4853600 files (0.0% non-contiguous), 1023185/2021235 blocks +``` + +### 挂载文件系统并检查缩小后的大小 + +最后挂载文件系统,并检查缩小后的文件系统大小。 + +使用 `mount` 命令[挂载逻辑卷][4]: + +``` +# mount /testlvm1 +``` + +使用 [df 命令][5]检查挂载的卷。 + +``` +# df -h /testlvm1 + +Filesystem Size Used Avail Use% Mounted on +/dev/mapper/vg01-lv002 80G 15G 65G 18% /testlvm1 +``` + +-------------------------------------------------------------------------------- + +via: https://www.2daygeek.com/reduce-shrink-decrease-resize-lvm-logical-volume-in-linux/ + +作者:[Magesh Maruthamuthu][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://www.2daygeek.com/author/magesh/ +[b]: https://github.com/lujun9972 +[1]: https://linux.cn/article-12670-1.html +[2]: https://linux.cn/article-12673-1.html +[3]: https://www.2daygeek.com/wp-content/uploads/2020/09/reduce-shrink-decrease-resize-lvm-logical-volume-in-linux-1.png +[4]: https://www.2daygeek.com/mount-unmount-file-system-partition-in-linux/ +[5]: https://www.2daygeek.com/linux-check-disk-space-usage-df-command/ diff --git a/published/202010/20200923 Find security issues in Go code using gosec.md b/published/202010/20200923 Find security issues in Go code using gosec.md new file mode 100644 index 0000000000..a18b93ad79 --- /dev/null +++ b/published/202010/20200923 Find security issues in Go code using gosec.md @@ -0,0 +1,378 @@ +[#]: collector: "lujun9972" +[#]: translator: "lxbwolf" +[#]: reviewer: "wxy" +[#]: publisher: "wxy" +[#]: url: "https://linux.cn/article-12681-1.html" +[#]: subject: "Find security issues in Go code using gosec" +[#]: via: "https://opensource.com/article/20/9/gosec" +[#]: author: "Gaurav Kamathe https://opensource.com/users/gkamathe" + +使用 gosec 检查 Go 代码中的安全问题 +====== + +> 来学习下 Go 语言的安全检查工具 gosec。 + +![](https://img.linux.net.cn/data/attachment/album/202010/04/125129bh4qxxsyqpvqjtx4.jpg) + +[Go 语言][2]写的代码越来越常见,尤其是在容器、Kubernetes 或云生态相关的开发中。Docker 是最早采用 Golang 的项目之一,随后是 Kubernetes,之后大量的新项目在众多编程语言中选择了 Go。 + +像其他语言一样,Go 也有它的长处和短处(如安全缺陷)。这些缺陷可能会因为语言本身的缺陷加上程序员编码不当而产生,例如,C 代码中的内存安全问题。 + +无论它们出现的原因是什么,安全问题都应该在开发过程的早期修复,以免在封装好的软件中出现。幸运的是,静态分析工具可以帮你以更可重复的方式处理这些问题。静态分析工具通过解析用某种编程语言写的代码来找到问题。 + +这类工具中很多被称为 linter。传统意义上,linter 更注重的是检查代码中编码问题、bug、代码风格之类的问题,它们可能不会发现代码中的安全问题。例如,[Coverity][3] 是一个很流行的工具,它可以帮助寻找 C/C++ 代码中的问题。然而,也有一些工具专门用来检查源码中的安全问题。例如,[Bandit][4] 可以检查 Python 代码中的安全缺陷。而 [gosec][5] 则用来搜寻 Go 源码中的安全缺陷。`gosec` 通过扫描 Go 的 AST(抽象语法树abstract syntax tree)来检查源码中的安全问题。 + +### 开始使用 gosec + +在开始学习和使用 `gosec` 之前,你需要准备一个 Go 语言写的项目。有这么多开源软件,我相信这不是问题。你可以在 GitHub 的 [热门 Golang 仓库][6]中找一个。 + +本文中,我随机选了 [Docker CE][7] 项目,但你可以选择任意的 Go 项目。 + +#### 安装 Go 和 gosec + +如果你还没安装 Go,你可以先从仓库中拉取下来。如果你用的是 Fedora 或其他基于 RPM 的 Linux 发行版本: + +``` +$ dnf install golang.x86_64 +``` + +如果你用的是其他操作系统,请参照 [Golang 安装][8]页面。 + +使用 `version` 参数来验证 Go 是否安装成功: + +``` +$ go version +go version go1.14.6 linux/amd64 +``` + +运行 `go get` 命令就可以轻松地安装 `gosec`: + +``` +$ go get github.com/securego/gosec/cmd/gosec +``` + +上面这行命令会从 GitHub 下载 `gosec` 的源码,编译并安装到指定位置。在仓库的 `README` 中你还可以看到[安装该工具的其他方法][9]。 + +`gosec` 的源码会被下载到 `$GOPATH` 的位置,编译出的二进制文件会被安装到你系统上设置的 `bin` 目录下。你可以运行下面的命令来查看 `$GOPATH` 和 `$GOBIN` 目录: + +``` +$ go env | grep GOBIN +GOBIN="/root/go/gobin" +$ go env | grep GOPATH +GOPATH="/root/go" +``` + +如果 `go get` 命令执行成功,那么 `gosec` 二进制应该就可以使用了: + +``` +$ ls -l ~/go/bin/ +total 9260 +-rwxr-xr-x. 1 root root 9482175 Aug 20 04:17 gosec +``` + +你可以把 `$GOPATH` 下的 `bin` 目录添加到 `$PATH` 中。这样你就可以像使用系统上的其他命令一样来使用 `gosec` 命令行工具(CLI)了。 + +``` +$ which gosec +/root/go/bin/gosec +$ +``` + +使用 `gosec` 命令行工具的 `-help` 选项来看看运行是否符合预期: + +``` +$ gosec -help + +gosec - Golang security checker + +gosec analyzes Go source code to look for common programming mistakes that +can lead to security problems. + +VERSION: dev +GIT TAG: +BUILD DATE: + +USAGE: +``` + +之后,创建一个目录,把源码下载到这个目录作为实例项目(本例中,我用的是 Docker CE): + +``` +$ mkdir gosec-demo +$ cd gosec-demo/ +$ pwd +/root/gosec-demo +$ git clone https://github.com/docker/docker-ce.git +Cloning into 'docker-ce'... +remote: Enumerating objects: 1271, done. +remote: Counting objects: 100% (1271/1271), done. +remote: Compressing objects: 100% (722/722), done. +remote: Total 431003 (delta 384), reused 981 (delta 318), pack-reused 429732 +Receiving objects: 100% (431003/431003), 166.84 MiB | 28.94 MiB/s, done. +Resolving deltas: 100% (221338/221338), done. +Updating files: 100% (10861/10861), done. +``` + +代码统计工具(本例中用的是 `cloc`)显示这个项目大部分是用 Go 写的,恰好迎合了 `gosec` 的功能。 + + +``` +$ ./cloc /root/gosec-demo/docker-ce/ + 10771 text files. + 8724 unique files. + 2560 files ignored. + + +----------------------------------------------------------------------------------- +Language files blank comment code +----------------------------------------------------------------------------------- +Go 7222 190785 230478 1574580 +YAML 37 4831 817 156762 +Markdown 529 21422 0 67893 +Protocol Buffers 149 5014 16562 10071 +``` + +### 使用默认选项运行 gosec + +在 Docker CE 项目中使用默认选项运行 `gosec`,执行 `gosec ./...` 命令。屏幕上会有很多输出内容。在末尾你会看到一个简短的 “Summary”,列出了浏览的文件数、所有文件的总行数,以及源码中发现的问题数。 + +``` +$ pwd +/root/gosec-demo/docker-ce +$ time gosec ./... +[gosec] 2020/08/20 04:44:15 Including rules: default +[gosec] 2020/08/20 04:44:15 Excluding rules: default +[gosec] 2020/08/20 04:44:15 Import directory: /root/gosec-demo/docker-ce/components/engine/opts +[gosec] 2020/08/20 04:44:17 Checking package: opts +[gosec] 2020/08/20 04:44:17 Checking file: /root/gosec-demo/docker-ce/components/engine/opts/address_pools.go +[gosec] 2020/08/20 04:44:17 Checking file: /root/gosec-demo/docker-ce/components/engine/opts/env.go +[gosec] 2020/08/20 04:44:17 Checking file: /root/gosec-demo/docker-ce/components/engine/opts/hosts.go + +# End of gosec run + +Summary: + Files: 1278 + Lines: 173979 + Nosec: 4 + Issues: 644 + +real 0m52.019s +user 0m37.284s +sys 0m12.734s +$ +``` + +滚动屏幕你会看到不同颜色高亮的行:红色表示需要尽快查看的高优先级问题,黄色表示中优先级的问题。 + +#### 关于误判 + +在开始检查代码之前,我想先分享几条基本原则。默认情况下,静态检查工具会基于一系列的规则对测试代码进行分析,并报告出它们发现的*所有*问题。这是否意味着工具报出来的每一个问题都需要修复?非也。这个问题最好的解答者是设计和开发这个软件的人。他们最熟悉代码,更重要的是,他们了解软件会在什么环境下部署以及会被怎样使用。 + +这个知识点对于判定工具标记出来的某段代码到底是不是安全缺陷至关重要。随着工作时间和经验的积累,你会慢慢学会怎样让静态分析工具忽略非安全缺陷,使报告内容的可执行性更高。因此,要判定 `gosec` 报出来的某个问题是否需要修复,让一名有经验的开发者对源码做人工审计会是比较好的办法。 + +#### 高优先级问题 + +从输出内容看,`gosec` 发现了 Docker CE 的一个高优先级问题,它使用的是低版本的 TLS(传输层安全Transport Layer Security)。无论什么时候,使用软件和库的最新版本都是确保它更新及时、没有安全问题的最好的方法。 + +``` +[/root/gosec-demo/docker-ce/components/engine/daemon/logger/splunk/splunk.go:173] - G402 (CWE-295): TLS MinVersion too low. (Confidence: HIGH, Severity: HIGH) + 172: + > 173: tlsConfig := &tls.Config{} + 174: +``` + +它还发现了一个弱随机数生成器。它是不是一个安全缺陷,取决于生成的随机数的使用方式。 + +``` +[/root/gosec-demo/docker-ce/components/engine/pkg/namesgenerator/names-generator.go:843] - G404 (CWE-338): Use of weak random number generator (math/rand instead of crypto/rand) (Confidence: MEDIUM, Severity: HIGH) + 842: begin: + > 843: name := fmt.Sprintf("%s_%s", left[rand.Intn(len(left))], right[rand.Intn(len(right))]) + 844: if name == "boring_wozniak" /* Steve Wozniak is not boring */ { +``` + +#### 中优先级问题 + +这个工具还发现了一些中优先级问题。它标记了一个通过与 `tar` 相关的解压炸弹这种方式实现的潜在的 DoS 威胁,这种方式可能会被恶意的攻击者利用。 + +``` +[/root/gosec-demo/docker-ce/components/engine/pkg/archive/copy.go:357] - G110 (CWE-409): Potential DoS vulnerability via decompression bomb (Confidence: MEDIUM, Severity: MEDIUM) + 356: + > 357: if _, err = io.Copy(rebasedTar, srcTar); err != nil { + 358: w.CloseWithError(err) +``` + +它还发现了一个通过变量访问文件的问题。如果恶意使用者能访问这个变量,那么他们就可以改变变量的值去读其他文件。 + +``` +[/root/gosec-demo/docker-ce/components/cli/cli/context/tlsdata.go:80] - G304 (CWE-22): Potential file inclusion via variable (Confidence: HIGH, Severity: MEDIUM) + 79: if caPath != "" { + > 80: if ca, err = ioutil.ReadFile(caPath); err != nil { + 81: return nil, err +``` + +文件和目录通常是操作系统安全的最基础的元素。这里,`gosec` 报出了一个可能需要你检查目录的权限是否安全的问题。 + +``` +[/root/gosec-demo/docker-ce/components/engine/contrib/apparmor/main.go:41] - G301 (CWE-276): Expect directory permissions to be 0750 or less (Confidence: HIGH, Severity: MEDIUM) + 40: // make sure /etc/apparmor.d exists + > 41: if err := os.MkdirAll(path.Dir(apparmorProfilePath), 0755); err != nil { + 42: log.Fatal(err) +``` + +你经常需要在源码中启动命令行工具。Go 使用内建的 exec 库来实现。仔细地分析用来调用这些工具的变量,就能发现安全缺陷。 + +``` +[/root/gosec-demo/docker-ce/components/engine/testutil/fakestorage/fixtures.go:59] - G204 (CWE-78): Subprocess launched with variable (Confidence: HIGH, Severity: MEDIUM) + 58: + > 59: cmd := exec.Command(goCmd, "build", "-o", filepath.Join(tmp, "httpserver"), "github.com/docker/docker/contrib/httpserver") + 60: cmd.Env = append(os.Environ(), []string{ +``` + +#### 低优先级问题 + +在这个输出中,gosec 报出了一个 `unsafe` 调用相关的低优先级问题,这个调用会绕开 Go 提供的内存保护。再仔细分析下你调用 `unsafe` 的方式,看看是否有被别人利用的可能性。 + +``` +[/root/gosec-demo/docker-ce/components/engine/pkg/archive/changes_linux.go:264] - G103 (CWE-242): Use of unsafe calls should be audited (Confidence: HIGH, Severity: LOW) + 263: for len(buf) > 0 { + > 264: dirent := (*unix.Dirent)(unsafe.Pointer(&buf[0])) + 265: buf = buf[dirent.Reclen:] + + + +[/root/gosec-demo/docker-ce/components/engine/pkg/devicemapper/devmapper_wrapper.go:88] - G103 (CWE-242): Use of unsafe calls should be audited (Confidence: HIGH, Severity: LOW) + 87: func free(p *C.char) { + > 88: C.free(unsafe.Pointer(p)) + 89: } +``` + +它还标记了源码中未处理的错误。源码中出现的错误你都应该处理。 + +``` +[/root/gosec-demo/docker-ce/components/cli/cli/command/image/build/context.go:172] - G104 (CWE-703): Errors unhandled. (Confidence: HIGH, Severity: LOW) + 171: err := tar.Close() + > 172: os.RemoveAll(dockerfileDir) + 173: return err +``` + +### 自定义 gosec 扫描 + +使用 `gosec` 的默认选项会带来很多的问题。然而,经过人工审计,随着时间推移你会掌握哪些问题是不需要标记的。你可以自己指定排除和包含哪些测试。 + +我上面提到过,`gosec` 是基于一系列的规则从 Go 源码中查找问题的。下面是它使用的完整的[规则][10]列表: + +- G101:查找硬编码凭证 +- G102:绑定到所有接口 +- G103:审计 `unsafe` 块的使用 +- G104:审计未检查的错误 +- G106:审计 `ssh.InsecureIgnoreHostKey` 的使用 +- G107: 提供给 HTTP 请求的 url 作为污点输入 +- G108: `/debug/pprof` 上自动暴露的剖析端点 +- G109: `strconv.Atoi` 转换到 int16 或 int32 时潜在的整数溢出 +- G110: 潜在的通过解压炸弹实现的 DoS +- G201:SQL 查询构造使用格式字符串 +- G202:SQL 查询构造使用字符串连接 +- G203:在 HTML 模板中使用未转义的数据 +- G204:审计命令执行情况 +- G301:创建目录时文件权限分配不合理 +- G302:使用 `chmod` 时文件权限分配不合理 +- G303:使用可预测的路径创建临时文件 +- G304:通过污点输入提供的文件路径 +- G305:提取 zip/tar 文档时遍历文件 +- G306: 写到新文件时文件权限分配不合理 +- G307: 把返回错误的函数放到 `defer` 内 +- G401:检测 DES、RC4、MD5 或 SHA1 的使用 +- G402:查找错误的 TLS 连接设置 +- G403:确保最小 RSA 密钥长度为 2048 位 +- G404:不安全的随机数源(`rand`) +- G501:导入黑名单列表:crypto/md5 +- G502:导入黑名单列表:crypto/des +- G503:导入黑名单列表:crypto/rc4 +- G504:导入黑名单列表:net/http/cgi +- G505:导入黑名单列表:crypto/sha1 +- G601: 在 `range` 语句中使用隐式的元素别名 + +#### 排除指定的测试 + +你可以自定义 `gosec` 来避免对已知为安全的问题进行扫描和报告。你可以使用 `-exclude` 选项和上面的规则编号来忽略指定的问题。 + +例如,如果你不想让 `gosec` 检查源码中硬编码凭证相关的未处理的错误,那么你可以运行下面的命令来忽略这些错误: + +``` +$ gosec -exclude=G104 ./... +$ gosec -exclude=G104,G101 ./... +``` + +有时候你知道某段代码是安全的,但是 `gosec` 还是会报出问题。然而,你又不想完全排除掉整个检查,因为你想让 `gosec` 检查新增的代码。通过在你已知为安全的代码块添加 `#nosec` 标记可以避免 `gosec` 扫描。这样 `gosec` 会继续扫描新增代码,而忽略掉 `#nosec` 标记的代码块。 + +#### 运行指定的检查 + +另一方面,如果你只想检查指定的问题,你可以通过 `-include` 选项和规则编号来告诉 `gosec` 运行哪些检查: + +``` +$ gosec -include=G201,G202 ./... +``` + +#### 扫描测试文件 + +Go 语言自带对测试的支持,通过单元测试来检验一个元素是否符合预期。在默认模式下,`gosec` 会忽略测试文件,你可以使用 `-tests` 选项把它们包含进来: + +``` +gosec -tests ./... +``` + +#### 修改输出的格式 + +找出问题只是它的一半功能;另一半功能是把它检查到的问题以用户友好同时又方便工具处理的方式报告出来。幸运的是,`gosec` 可以用不同的方式输出。例如,如果你想看 JSON 格式的报告,那么就使用 `-fmt` 选项指定 JSON 格式并把结果保存到 `results.json` 文件中: + +``` +$ gosec -fmt=json -out=results.json ./... + +$ ls -l results.json +-rw-r--r--. 1 root root 748098 Aug 20 05:06 results.json +$ + + { + "severity": "LOW", + "confidence": "HIGH", + "cwe": { + "ID": "242", + "URL": "https://cwe.mitre.org/data/definitions/242.html" + }, + "rule_id": "G103", + "details": "Use of unsafe calls should be audited", + "file": "/root/gosec-demo/docker-ce/components/engine/daemon/graphdriver/graphtest/graphtest_unix.go", + "code": "304: \t// Cast to []byte\n305: \theader := *(*reflect.SliceHeader)(unsafe.Pointer(\u0026buf))\n306: \theader. Len *= 8\n", + "line": "305", + "column": "36" + }, +``` + +### 用 gosec 检查容易被发现的问题 + +静态检查工具不能完全代替人工代码审计。然而,当代码量变大、有众多开发者时,这样的工具往往有助于以可重复的方式找出容易被发现的问题。它对于帮助新开发者识别和在编码时避免引入这些安全缺陷很有用。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/9/gosec + +作者:[Gaurav Kamathe][a] +选题:[lujun9972][b] +译者:[lxbowlf](https://github.com/lxbwolf) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/gkamathe +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/BUSINESS_3reasons.png?itok=k6F3-BqA "A lock on the side of a building" +[2]: https://golang.org/ +[3]: https://www.synopsys.com/software-integrity/security-testing/static-analysis-sast.html +[4]: https://pypi.org/project/bandit/ +[5]: https://github.com/securego/gosec +[6]: https://github.com/trending/go +[7]: https://github.com/docker/docker-ce +[8]: https://golang.org/doc/install +[9]: https://github.com/securego/gosec#install +[10]: https://github.com/securego/gosec#available-rules + diff --git a/published/202010/20200925 5 questions to ask yourself when writing project documentation.md b/published/202010/20200925 5 questions to ask yourself when writing project documentation.md new file mode 100644 index 0000000000..3b59da6ca5 --- /dev/null +++ b/published/202010/20200925 5 questions to ask yourself when writing project documentation.md @@ -0,0 +1,75 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12691-1.html) +[#]: subject: (5 questions to ask yourself when writing project documentation) +[#]: via: (https://opensource.com/article/20/9/project-documentation) +[#]: author: (Alexei Leontief https://opensource.com/users/alexeileontief) + +编写项目文档时要问自己的 5 个问题 +====== + +> 使用有效沟通的一些基本原则可以帮助你创建与你的品牌一致的、编写良好、内容丰富的项目文档。 + +![](https://img.linux.net.cn/data/attachment/album/202010/06/223150omjnutjpml8inc9n.jpg) + +在开始实际撰写又一个开源项目的文档之前,甚至在采访专家之前,最好回答一些有关新文档的高级问题。 + +著名的传播理论家 Harold Lasswell 在他 1948 年的文章《社会中的传播结构和功能The Structure and Function of Communication in Society》中写道: + +> (一种)描述沟通行为的方便方法是回答以下问题: +> +> * 谁 +> * 说什么 +> * 在哪个渠道 +> * 对谁 +> * 有什么效果? + +作为一名技术交流者,你可以运用 Lasswell 的理论,回答关于你文档的类似问题,以更好地传达你的信息,达到预期的效果。 + +### 谁:谁是文档的所有者? + +或者说,文档背后是什么公司?它想向受众传达什么品牌形象?这个问题的答案将极大地影响你的写作风格。公司可能有自己的风格指南,或者至少有正式的使命声明,在这种情况下,你应该从这开始。 + +如果公司刚刚起步,你可以向文件的主人提出上述问题。作为作者,将你为公司创造的声音和角色与你自己的世界观和信念结合起来是很重要的。这将使你的写作看起来更自然,而不像公司的行话。 + +### 说什么:文件类型是什么? + +你需要传达什么信息?它是什么类型的文档:用户指南、API 参考、发布说明等?许多文档类型有模板或普遍认可的结构,这些结构为你提供一个开始的地方,并帮助确保包括所有必要的信息。 + +### 在哪个渠道:文档的格式是什么? + +对于技术文档,沟通的渠道通常会告诉你文档的最终格式,也就是 PDF、HTML、文本文件等。这很可能也决定了你应该使用什么工具来编写你的文档。 + +### 对谁:目标受众是谁? + +谁会阅读这份文档?他们的知识水平如何?他们的工作职责和主要挑战是什么?这些问题将帮助你确定你应该覆盖什么内容,是否应该应该涉及细节,是否可以使用特定的术语,等等。在某些情况下,这些问题的答案甚至可以影响你使用的语法的复杂性。 + +### 有什么效果:文档的目的是什么? + +在这里,你应该定义这个文档要为它的潜在读者解决什么问题,或者它应该为他们回答什么问题。例如,你的文档的目的可以是教你的客户如何使用你的产品。 + +这时,你可以参考 [Divio][2] 建议的方法。根据这种方法,你可以根据文档的总体方向,将任何文档分为四种类型之一:学习、解决问题、理解或获取信息。 + +在这个阶段,另一个很好的问题是,这个文档要解决什么业务问题(例如,如何削减支持成本)。带着业务问题,你可能会看到你写作的一个重要角度。 + +### 总结 + +上面的问题旨在帮助你形成有效沟通的基础,并确保你的文件涵盖了所有应该涵盖的内容。你可以把它们分解成你自己的问题清单,并把它们放在身边,以便在你有文件要创建的时候使用。当你面对空白页无从着笔时,这份清单也可能会派上用场。希望它能激发你的灵感,帮助你产生想法。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/9/project-documentation + +作者:[Alexei Leontief][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/alexeileontief +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/rh_003784_02_os.comcareers_resume_rh1x.png?itok=S3HGxi6E (A person writing.) +[2]: https://documentation.divio.com/ diff --git a/published/202010/20200926 10 Open Source Static Site Generators to Create Fast and Resource-Friendly Websites.md b/published/202010/20200926 10 Open Source Static Site Generators to Create Fast and Resource-Friendly Websites.md new file mode 100644 index 0000000000..6878aea281 --- /dev/null +++ b/published/202010/20200926 10 Open Source Static Site Generators to Create Fast and Resource-Friendly Websites.md @@ -0,0 +1,218 @@ +[#]: collector: "lujun9972" +[#]: translator: "lxbwolf" +[#]: reviewer: "wxy" +[#]: publisher: "wxy" +[#]: url: "https://linux.cn/article-12671-1.html" +[#]: subject: "10 Open Source Static Site Generators to Create Fast and Resource-Friendly Websites" +[#]: via: "https://itsfoss.com/open-source-static-site-generators/" +[#]: author: "Ankush Das https://itsfoss.com/author/ankush/" + +10 大静态网站生成工具 +====== + +![](https://img.linux.net.cn/data/attachment/album/202010/01/123903lx1q0w2oh1lxx7wh.jpg) + +> 在寻找部署静态网页的方法吗?这几个开源的静态网站生成工具可以帮你迅速部署界面优美、功能强大的静态网站,无需掌握复杂的 HTML 和 CSS 技能。 + +### 静态网站是什么? + +技术上来讲,静态网站是指网页不是由服务器动态生成的。HTML、CSS 和 JavaScript 文件就静静地躺在服务器的某个路径下,它们的内容与终端用户接收到的版本是一样的。原始的源码文件已经提前编译好了,源码在每次请求后都不会变化。 + +Linux.CN 是一个依赖多个数据库的动态网站,当有浏览器的请求时,网页就会生成并提供服务。大部分网站是动态的,你与这些网站互动时,大量的内容会经常改变。 + +静态网站有一些好处,比如加载时间更短,请求的服务器资源更少、更安全(值得商榷)。 + +传统上,静态网站更适合于创建只有少量网页、内容变化不频繁的小网站。 + +然而,随着静态网站生成工具出现后,静态网站的适用范围越来越大。你还可以使用这些工具搭建博客网站。 + +我整理了几个开源的静态网站生成工具,这些工具可以帮你搭建界面优美的网站。 + +### 最好的开源静态网站生成工具 + +请注意,静态网站不会提供很复杂的功能。如果你需要复杂的功能,那么你可以参考适用于动态网站的[最佳开源 CMS][1]列表。 + +#### 1、Jekyll + +![][2] + +Jekyll 是用 [Ruby][3] 写的最受欢迎的开源静态生成工具之一。实际上,Jekyll 是 [GitHub 页面][4] 的引擎,它可以让你免费用 GitHub 托管网站。 + +你可以很轻松地跨平台配置 Jekyll,包括 Ubuntu。它利用 [Markdown][5]、[Liquid][5](模板语言)、HTML 和 CSS 来生成静态的网页文件。如果你要搭建一个没有广告或推广自己工具或服务的产品页的博客网站,它是个不错的选择。 + +它还支持从常见的 CMS(内容管理系统Content management system)如 Ghost、WordPress、Drupal 7 迁移你的博客。你可以管理永久链接、类别、页面、文章,还可以自定义布局,这些功能都很强大。因此,即使你已经有了一个网站,如果你想转成静态网站,Jekyll 会是一个完美的解决方案。你可以参考[官方文档][6]或 [GitHub 页面][7]了解更多内容。 + +- [Jekyll][8] + +#### 2、Hugo + +![][9] + +Hugo 是另一个很受欢迎的用于搭建静态网站的开源框架。它是用 [Go 语言][10]写的。 + +它运行速度快、使用简单、可靠性高。如果你需要,它也可以提供更高级的主题。它还提供了一些有用的快捷方式来帮助你轻松完成任务。无论是组合展示网站还是博客网站,Hogo 都有能力管理大量的内容类型。 + +如果你想使用 Hugo,你可以参照它的[官方文档][11]或它的 [GitHub 页面][12]来安装以及了解更多相关的使用方法。如果需要的话,你还可以将 Hugo 部署在 GitHub 页面或任何 CDN 上。 + +- [Hugo][13] + +#### 3、Hexo + +![][14] + +Hexo 是一个有趣的开源框架,基于 [Node.js][15]。像其他的工具一样,你可以用它搭建相当快速的网站,不仅如此,它还提供了丰富的主题和插件。 + +它还根据用户的每个需求提供了强大的 API 来扩展功能。如果你已经有一个网站,你可以用它的[迁移][16]扩展轻松完成迁移工作。 + +你可以参照[官方文档][17]或 [GitHub 页面][18] 来使用 Hexo。 + +- [Hexo][19] + +#### 4、Gatsby + +![][20] + +Gatsby 是一个越来越流行的开源网站生成框架。它使用 [React.js][21] 来生成快速、界面优美的网站。 + +几年前在一个实验性的项目中,我曾经非常想尝试一下这个工具,它提供的成千上万的新插件和主题的能力让我印象深刻。与其他静态网站生成工具不同的是,你可以使用 Gatsby 生成一个网站,并在不损失任何功能的情况下获得静态网站的好处。 + +它提供了与很多流行的服务的整合功能。当然,你可以不使用它的复杂的功能,或将其与你选择的流行 CMS 配合使用,这也会很有趣。你可以查看他们的[官方文档][22]或它的 [GitHub 页面][23]了解更多内容。 + +- [Gatsby][24] + +#### 5、VuePress + +![][25] + +VuePress 是由 [Vue.js][26] 支持的静态网站生成工具,而 Vue.js 是一个开源的渐进式 JavaScript 框架。 + +如果你了解 HTML、CSS 和 JavaScript,那么你可以无压力地使用 VuePress。你应该可以找到几个有用的插件和主题来为你的网站建设开个头。此外,看起来 Vue.js 的更新一直很活跃,很多开发者都在关注 Vue.js,这是一件好事。 + +你可以参照他们的[官方文档][27]和 [GitHub 页面][28]了解更多。 + +- [VuePress][29] + +#### 6、Nuxt.js + +![][30] + +Nuxt.js 使用了 Vue.js 和 Node.js,但它致力于模块化,并且有能力依赖服务端而非客户端。不仅如此,它的目标是为开发者提供直观的体验,并提供描述性错误,以及详细的文档等。 + +正如它声称的那样,在你用来搭建静态网站的所有工具中,Nuxt.js 可以做到功能和灵活性两全其美。他们还提供了一个 [Nuxt 线上沙盒][31],让你不费吹灰之力就能直接测试它。 + +你可以查看它的 [GitHub 页面][32]和[官方网站][33]了解更多。 + +- [Nuxt.js][33] + +#### 7、Docusaurus + +![][34] + +Docusaurus 是一个有趣的开源静态网站生成工具,为搭建文档类网站量身定制。它还是 [Facebook 开源计划][35]的一个项目。 + +Docusaurus 是用 React 构建的。你可以使用所有的基本功能,像文档版本管理、文档搜索和翻译大多是预先配置的。如果你想为你的产品或服务搭建一个文档网站,那么可以试试 Docusaurus。 + +你可以从它的 [GitHub 页面][36]和它的[官网][37]获取更多信息。 + +- [Docusaurus][37] + +#### 8、Eleventy + +![][38] + +Eleventy 自称是 Jekyll 的替代品,旨在以更简单的方法来制作更快的静态网站。 + +它似乎很容易上手,而且它还提供了适当的文档来帮助你。如果你想找一个简单的静态网站生成工具,Eleventy 似乎会是一个有趣的选择。 + +你可以参照它的 [GitHub 页面][39]和[官网][40]来了解更多的细节。 + +- [Eleventy][40] + +#### 9、Publii + +![][41] + +Publii 是一个令人印象深刻的开源 CMS,它能使生成一个静态网站变得很容易。它是用 [Electron][42] 和 Vue.js 构建的。如果有需要,你也可以把你的文章从 WorkPress 网站迁移过来。此外,它还提供了与 GitHub 页面、Netlify 及其它类似服务的一键同步功能。 + +如果你利用 Publii 生成一个静态网站,你还可以得到一个所见即所得的编辑器。你可以从[官网][43]下载它,或者从它的 [GitHub 页面][44]了解更多信息。 + +- [Publii][43] + +#### 10、Primo + +![][45] + +一个有趣的开源静态网站生成工具,目前开发工作仍很活跃。虽然与其他的静态生成工具相比,它还不是一个成熟的解决方案,有些功能还不完善,但它是一个独特的项目。 + +Primo 旨在使用可视化的构建器帮你构建和搭建网站,这样你就可以轻松编辑和部署到任意主机上。 + +你可以参照[官网][46]或查看它的 [GitHub 页面][47]了解更多信息。 + +- [Primo][46] + +### 结语 + +还有很多文章中没有列出的网站生成工具。然而,我试图提到最好的静态生成器,为您提供最快的加载时间,最好的安全性和令人印象深刻的灵活性。 + +列表中没有你最喜欢的工具?在下面的评论中告诉我。 + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/open-source-static-site-generators/ + +作者:[Ankush Das][a] +选题:[lujun9972][b] +译者:[lxbwolf](https://github.com/lxbwolf) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://itsfoss.com/author/ankush/ +[b]: https://github.com/lujun9972 +[1]: https://itsfoss.com/open-source-cms/ +[2]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2018/01/jekyll-screenshot.jpg?resize=800%2C450&ssl=1 +[3]: https://www.ruby-lang.org/en/ +[4]: https://pages.github.com/ +[5]: https://github.com/Shopify/liquid/wiki +[6]: https://jekyllrb.com/docs/ +[7]: https://github.com/jekyll/jekyll +[8]: https://jekyllrb.com/ +[9]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/09/hugo.jpg?resize=800%2C414&ssl=1 +[10]: https://golang.org/ +[11]: https://gohugo.io/getting-started/ +[12]: https://github.com/gohugoio/hugo +[13]: https://gohugo.io/ +[14]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/09/hexo.jpg?resize=800%2C213&ssl=1 +[15]: https://nodejs.org/en/ +[16]: https://hexo.io/api/migrator.html +[17]: https://hexo.io/docs/ +[18]: https://github.com/hexojs/hexo +[19]: https://hexo.io/ +[20]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/09/gatsbyjs.png?resize=800%2C388&ssl=1 +[21]: https://reactjs.org/ +[22]: https://www.gatsbyjs.com/docs/ +[23]: https://github.com/gatsbyjs/gatsby +[24]: https://www.gatsbyjs.com/ +[25]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/09/VuePress.jpg?resize=800%2C498&ssl=1 +[26]: https://vuejs.org/ +[27]: https://vuepress.vuejs.org/guide/ +[28]: https://github.com/vuejs/vuepress +[29]: https://vuepress.vuejs.org/ +[30]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/09/nuxtjs.jpg?resize=800%2C415&ssl=1 +[31]: https://template.nuxtjs.org/ +[32]: https://github.com/nuxt/nuxt.js +[33]: https://nuxtjs.org/ +[34]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/09/docusaurus.jpg?resize=800%2C278&ssl=1 +[35]: https://opensource.facebook.com/ +[36]: https://github.com/facebook/docusaurus +[37]: https://docusaurus.io/ +[38]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/09/eleventy.png?resize=800%2C375&ssl=1 +[39]: https://github.com/11ty/eleventy/ +[40]: https://www.11ty.dev/ +[41]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/09/publii.jpg?resize=800%2C311&ssl=1 +[42]: https://www.electronjs.org +[43]: https://getpublii.com/ +[44]: https://github.com/GetPublii/Publii +[45]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/09/primo-af.jpg?resize=800%2C394&ssl=1 +[46]: https://primo.af/ +[47]: https://github.com/primo-app/primo-desktop diff --git a/published/202010/20200926 Linux Jargon Buster- What is FOSS (Free and Open Source Software)- What is Open Source.md b/published/202010/20200926 Linux Jargon Buster- What is FOSS (Free and Open Source Software)- What is Open Source.md new file mode 100644 index 0000000000..69af9d8b63 --- /dev/null +++ b/published/202010/20200926 Linux Jargon Buster- What is FOSS (Free and Open Source Software)- What is Open Source.md @@ -0,0 +1,129 @@ +[#]: collector: (lujun9972) +[#]: translator: (wxy) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12748-1.html) +[#]: subject: (Linux Jargon Buster: What is FOSS \(Free and Open Source Software\)? What is Open Source?) +[#]: via: (https://itsfoss.com/what-is-foss/) +[#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/) + +Linux 黑话解释:什么是 FOSS(自由和开源软件)?什么是开源? +====== + +![][7] + +什么是 FOSS? + +在过去,我曾多次被问到这个问题,现在是时候解释一下什么是 Linux 和软件世界中的 FOSS 了。 + +这个区别很重要,因为 FOSS 是一个通用的词汇,它可以根据上下文的不同而有不同的含义。在这里,我讨论的是软件中的 FOSS 原则。 + +### 什么是 FOSS? + +FOSS 是指自由和开放源码软件Free and Open Source Software。这并不意味着软件是免费的。它意味着软件的源代码是开放的,任何人都可以自由使用、研究和修改代码。这个原则允许人们像一个社区一样为软件的开发和改进做出贡献。 + +#### FOSS 的起源 + +在上世纪 60、70 年代,计算机以硬件为主,硬件价格昂贵。它们主要由大学的学者或实验室的研究人员使用。以前有限的软件都是免费的,或者是带有它们的源代码,用户可以根据自己的需要修改源代码。 + +在上世纪 70 年代末和 80 年代初,制造商为了不让自己的软件在竞争对手的计算机上运行,停止了分发源代码。 + +这种限制性的许可导致了那些习惯和喜欢修改软件的人的不便和不喜。上世纪 80 年代中期,Richard Stallman 发起了自由软件运动Free Software Movement。 + +[Stallman 指明了一个软件要成为 FOSS 的四个基本自由][1]。 + +![自由软件自由][2] + +为了便于理解,我将它们重新表述: + + * 任何用户应能为任何目的运行软件。 + * 用户应能自由查看软件的源代码,如有需要,应允许用户修改代码。 + * 用户应能自由地将软件的副本分发给他人。 + * 如果用户修改了代码,她/他应该可以自由地将修改后的代码发布给他人。修改后的代码必须开放源代码。 + +如果有兴趣,我建议阅读这篇关于 [FOSS 的历史][3]的文章。 + +### FOSS 中的 “Free” 并不意味着免费 + +![][4] + +你可能已经注意到了,自由和开源软件中的 “Free” 并不意味着它是免费的,它意味着运行、修改和分发软件的“自由”。 + +人们经常错误地认为,FOSS 或开源软件不能有价格标签。这是不正确的。 + +大多数 FOSS 都是免费提供的,原因有很多: + + * 源代码已经向公众开放,所以一些开发者认为没有必要在下载软件时贴上价格标签。 + * 有些项目是由一些志愿者免费提供的。因此,主要的开发者认为对这么多人免费贡献的东西收费是不道德的。 + * 有些项目是由较大的企业或非营利组织支持和/或开发的,这些组织会雇佣开发人员在他们的开源项目上工作。 + * 有些开发者创建开源项目是出于兴趣,或者出于他们对用代码为世界做贡献的热情。对他们来说,下载量、贡献和感谢的话比金钱更重要。 + +为了避免强调 “免费”,有些人使用了 FLOSS 这个词(LCTT 译注:有时候也写作 F/LOSS)。FLOSS 是自由和开源软件Free/Libre Open Source Software的缩写。单词 Libre(意为自由)与 gartuit/gratis(免费)不同。 + +> “Free” 是言论自由的自由,而不是免费啤酒的免费。 + +### FOSS 项目如何赚钱? + +开源项目不赚钱是一个神话。红帽是第一个达到 10 亿美元大关的开源公司。[IBM 以 340 亿美元收购了红帽][5]。这样的例子有很多。 + +许多开源项目,特别是企业领域的项目,都会提供收费的支持和面向企业的功能。这是红帽、SUSE Linux 和更多此类项目的主要商业模式。 + +一些开源项目,如 Discourse、WordPress 等,则提供其软件的托管实例,并收取一定的费用。 + +许多开源项目,特别是桌面应用程序,依靠捐赠。VLC、GIMP、Inkscape 等这类开源软件就属于这一类。有[资助开源项目的方法][6],但通常,你会在项目网站上找到捐赠链接。 + +利用开源软件赚钱可能很难,但也不是完全不可能。 + +### 但我不是程序员,我为什么要关心一个软件是否开源? + +这是一个合理的问题。你不是一个软件开发者,只是一个普通的计算机用户。即使软件的源代码是可用的,你也不会理解程序的工作原理。 + +这很好。你不会明白,但有必要技能的人就会明白,这才是最重要的。 + +你可以这样想。也许你不会理解一份复杂的法律文件。但如果你有看文件的自由,并保留一份副本,你就可以咨询某个人,他可以检查文件中的法律陷阱。 + +换句话说,开源软件具有透明度。 + +### FOSS 与开源之间的区别是什么? + +你会经常遇到 FOSS 和开源Open Source的术语。它们经常被互换使用。 + +它们是同一件事吗?这很难用“是”和“不是”来回答。 + +你看,FOSS 中的“Free”一词让很多人感到困惑,因为人们错误地认为它是免费的。企业高管、高层和决策者往往会关注自由和开源中的“免费”。由于他们是商业人士,专注于为他们的公司赚钱,“自由”一词在采用 FOSS 原则时起到了威慑作用。 + +这就是为什么在上世纪 90 年代中期创立了一个名为[开源促进会][8]Open Source Initiative的新组织。他们从自由和开放源码软件中去掉了“自由”一词,并创建了自己的[开放源码的定义][9],以及自己的一套许可证。 + +“开源Open Source”一词在软件行业特别流行。高管们对开源更加适应。开源软件的采用迅速增长,我相信 “免费”一词的删除确实起到了作用。 + +### 有问题吗? + +这正如我在[什么是 Linux 发行版][10]一文中所解释的那样,FOSS/开源的概念在 Linux 的发展和普及中起到了很大的作用。 + +我试图在这篇黑话解释文章中用更简单的语言解释 FOSS 和开源的概念,而试图避免在细节或技术精度上做过多的阐述。 + +我希望你现在对这个话题有了更好的理解。如果你有问题或建议,欢迎留言并继续讨论。 + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/what-is-foss/ + +作者:[Abhishek Prakash][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://itsfoss.com/author/abhishek/ +[b]: https://github.com/lujun9972 +[1]: https://www.gnu.org/philosophy/free-sw.html +[2]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/09/foss-freedoms.jpg?resize=800%2C671&ssl=1 +[3]: https://itsfoss.com/history-of-foss/ +[4]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/09/think-free-speech-not-free-beer.jpg?resize=800%2C800&ssl=1 +[5]: https://itsfoss.com/ibm-red-hat-acquisition/ +[6]: https://itsfoss.com/open-source-funding-platforms/ +[7]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/09/what-is-foss.png?resize=800%2C450&ssl=1 +[8]: https://opensource.org/ +[9]: https://opensource.org/osd +[10]: https://itsfoss.com/what-is-linux-distribution/ diff --git a/published/202010/20200928 Create template files in GNOME.md b/published/202010/20200928 Create template files in GNOME.md new file mode 100644 index 0000000000..932b6d352c --- /dev/null +++ b/published/202010/20200928 Create template files in GNOME.md @@ -0,0 +1,72 @@ +[#]: collector: (lujun9972) +[#]: translator: (rakino) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12699-1.html) +[#]: subject: (Create template files in GNOME) +[#]: via: (https://opensource.com/article/20/9/gnome-templates) +[#]: author: (Alan Formy-Duval https://opensource.com/users/alanfdoss) + +在 GNOME 中创建文档模板 +====== + +> 制作模板可以让你更快地开始写作新的文档。 + +![](https://img.linux.net.cn/data/attachment/album/202010/08/215333mgqpiuqufhgidfpz.jpg) + +我只是偶然发现了 [GNOME][2] 的一个新功能(对我来说是的):创建文档模版。模版template也被称作样版文件boilerplate,一般是有着特定格式的空文档,例如律师事务所的信笺,在其顶部有着律所的名称和地址;另一个例子是银行以及保险公司的保函,在其底部页脚包含着某些免责声明。由于这类信息很少改变,你可以把它们添加到空文档中作为模板使用。 + +一天,在浏览我的 Linux 系统文件的时候,我点击了模板Templates文件夹,然后刚好发现窗口的上方有一条消息写着:“将文件放入此文件夹并用作新文档的模板”,以及一个“获取详情……” 的链接,打开了模板的 [GNOME 帮助页面][3]。 + +![Message at top of Templates folder in GNOME Desktop][4] + +### 创建模板 + +在 GNOME 中创建模板非常简单。有几种方法可以把文件放进模板文件夹里:你既可以通过图形用户界面(GUI)或是命令行界面(CLI)从另一个位置复制或移动文件,也可以创建一个全新的文件;我选择了后者,实际上,我创建了两个文件。 + +![My first two GNOME templates][6] + +我的第一份模板是为 Opensource.com 的文章准备的,它有一个输入标题的位置以及关于我的名字和文章使用的许可证的几行。我的文章使用 Markdown 格式,所以我将模板创建为了一个新的 Markdown 文档——`Opensource.com Article.md`: + +```` +# Title     +``` +An article for Opensource.com +by: Alan Formy-Duval +Creative Commons BY-SA 4.0 +``` + +```` + +我将这份文档保存在了 `/home/alan/Templates` 文件夹内,现在 GNOME 就可以将这个文件识别为模板,并在我要创建新文档的时候提供建议了。 + +### 使用模板 + +每当我有了新文章的灵感的时候,我只需要在我计划用来组织内容的文件夹里单击右键,然后从新建文档New Document列表中选择我想要的模板就可以开始了。 + +![Select the template by name][7] + +你可以为各种文档或文件制作模板。我写这篇文章时使用了我为 Opensource.com 的文章创建的模板。程序员可能会把模板用于软件代码,这样的话也许你想要只包含 `main()` 的模板。 + +GNOME 桌面环境为 Linux 及相关操作系统的用户提供了一个非常实用、功能丰富的界面。你最喜欢的 GNOME 功能是什么,你又是怎样使用它们的呢?请在评论中分享~ + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/9/gnome-templates + +作者:[Alan Formy-Duval][a] +选题:[lujun9972][b] +译者:[rakino](https://github.com/rakino) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/alanfdoss +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/computer_desk_home_laptop_browser.png?itok=Y3UVpY0l (Digital images of a computer desktop) +[2]: https://www.gnome.org/ +[3]: https://help.gnome.org/users/gnome-help/stable/files-templates.html.en +[4]: https://opensource.com/sites/default/files/uploads/gnome-message_at_top_border.png (Message at top of Templates folder in GNOME Desktop) +[5]: https://creativecommons.org/licenses/by-sa/4.0/ +[6]: https://opensource.com/sites/default/files/uploads/gnome-first_two_templates_border.png (My first two GNOME templates) +[7]: https://opensource.com/sites/default/files/uploads/gnome-new_document_menu_border.png (Select the template by name) diff --git a/published/202010/20200928 How to Use the Firefox Task Manager (to Find and Kill RAM and CPU Eating Tabs and Extensions).md b/published/202010/20200928 How to Use the Firefox Task Manager (to Find and Kill RAM and CPU Eating Tabs and Extensions).md new file mode 100644 index 0000000000..7fbd012005 --- /dev/null +++ b/published/202010/20200928 How to Use the Firefox Task Manager (to Find and Kill RAM and CPU Eating Tabs and Extensions).md @@ -0,0 +1,91 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12708-1.html) +[#]: subject: (How to Use the Firefox Task Manager \(to Find and Kill RAM and CPU Eating Tabs and Extensions\)) +[#]: via: (https://itsfoss.com/firefox-task-manager/) +[#]: author: (Ankush Das https://itsfoss.com/author/ankush/) + +如何使用 Firefox 任务管理器 +====== + +![](https://img.linux.net.cn/data/attachment/album/202010/11/103209cc1l7ktc7asacjhe.jpg) + +> 查找并杀死占用内存和 CPU 的标签页和扩展程序 + +Firefox 在 Linux 用户中很受欢迎。它是几个 Linux 发行版上的默认 Web 浏览器。 + +在它所提供的许多功能之中,Firefox 也提供了一个自己的任务管理器。 + +不过,在 Linux 中既然你有[任务管理器][1]这种形式的[系统监控工具][2],为什么还要使用 Firefox 的呢?这里有个很好的理由。 + +假设你的系统占用了太多的内存或 CPU。如果你使用 `top` 或其他一些系统[资源监控工具,如 Glances][3],你会发现这些工具无法区分是哪个打开的标签或扩展占用了资源。 + +通常情况下,每个 Firefox 标签页都显示为 “Web 内容Web Content”。你可以看到是某个 Firefox 进程导致了这个问题,但这无法准确判断是哪个标签页或扩展。 + +这时你可以使用 Firefox 任务管理器。让我来告诉你怎么做! + +### Firefox 任务管理器 + +有了 Firefox 任务管理器,你就可以列出所有消耗系统资源的标签页、跟踪器和附加组件。 + +![][4] + +正如你在上面的截图中所看到的,你会看到标签页的名称、类型(标签或附加组件)、能源影响和消耗的内存。 + +其它的都不言自明,但**“能源影响”指的是 CPU 的使用**,如果你使用的是笔记本电脑,它是一个很好的指标,可以告诉你什么东西会更快耗尽电池电量。 + +#### 在 Firefox 中访问任务管理器 + +令人意外的是,任务管理器没有 [Firefox 键盘快捷键][5]。 + +要快速启动 Firefox 任务管理器,可以在地址栏中输入 `about:performance`,如下图所示。 + +![Quickly access task manager in Firefox][6] + +另外,你也可以点击“菜单”图标,然后进入“更多”选项,如下截图所示。 + +![Accessing task manager in Firefox][7] + +接下来,你会发现选择“任务管理器”的选项,只需点击它就行。 + +![][8] + +#### 使用 Firefox 任务管理器 + +到这后,你可以检查资源的使用情况,展开标签页来查看跟踪器和它的使用情况,也可以选择关闭标签,如下截图高亮所示。 + +![][9] + +以下是你应该知道的: + + * “能源影响”指的是 CPU 消耗。 + * 子框架或子任务通常是与需要在后台运行的标签相关联的跟踪器/脚本。 + +通过这个任务管理器,你可以发现网站上的流氓脚本,以及它是否导致你的浏览器变慢。 + +这并不是什么 高科技,但并不是所有人都知道 Firefox 任务管理器。现在你知道了,它应该很方便,你觉得呢? + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/firefox-task-manager/ + +作者:[Ankush Das][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://itsfoss.com/author/ankush/ +[b]: https://github.com/lujun9972 +[1]: https://itsfoss.com/task-manager-linux/ +[2]: https://itsfoss.com/linux-system-monitoring-tools/ +[3]: https://itsfoss.com/glances/ +[4]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/09/firefox-task-manager-shot.png?resize=800%2C519&ssl=1 +[5]: https://itsfoss.com/firefox-keyboard-shortcuts/ +[6]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/09/firefox-url-performance.jpg?resize=800%2C357&ssl=1 +[7]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/09/firefox-task-manager-steps.jpg?resize=800%2C779&ssl=1 +[8]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/09/firefox-task-manager-menu.jpg?resize=800%2C465&ssl=1 +[9]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/09/firefox-task-manager-close-tab.png?resize=800%2C496&ssl=1 diff --git a/published/202010/20200928 How to view information on your Linux devices with lshw.md b/published/202010/20200928 How to view information on your Linux devices with lshw.md new file mode 100644 index 0000000000..b2a76f2661 --- /dev/null +++ b/published/202010/20200928 How to view information on your Linux devices with lshw.md @@ -0,0 +1,269 @@ +[#]: collector: (lujun9972) +[#]: translator: (rakino) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12702-1.html) +[#]: subject: (How to view information on your Linux devices with lshw) +[#]: via: (https://www.networkworld.com/article/3583598/how-to-view-information-on-your-linux-devices-with-lshw.html) +[#]: author: (Sandra Henry-Stocker https://www.networkworld.com/author/Sandra-Henry_Stocker/) + +如何使用 lshw 查看 Linux 设备信息 +====== + +> Linux 系统上的 lshw 命令提供的系统设备信息比我们大多数人想象的要多得多。 + +![Kali Linux logo / gears / binary data][1] + +虽然 `lshw` 命令(列出硬件list hardware,读作 “ls hardware”)远不是每个人最先学会的 50 个 Linux 命令之一,但它可以提供很多系统硬件的有用信息。 + +它以一种相当易于理解的格式提取出可能比你知道的更多的信息。在看到描述、(设备)逻辑名称、大小等以后,你可能会理解到自己能获得多少信息。 + +这篇文章会研究 `lshw` 给出的信息,但侧重于磁盘及相关硬件。下面是 `lshw` 的输出示例: + +``` +$ sudo lshw -C disk + *-disk:0 + description: SCSI Disk + product: Card Reader-1 + vendor: JIE LI + physical id: 0.0.0 + bus info: scsi@4:0.0.0 + logical name: /dev/sdc + version: 1.00 + capabilities: removable + configuration: logicalsectorsize=512 sectorsize=512 + *-medium + physical id: 0 + logical name: /dev/sdc +``` + +请注意,你需要使用 `sudo` 运行 `lshw` 命令以确保能得到所有可用的信息。 + +虽然我们在上面的命令中要求了输出“磁盘(`disk`)”(上面只包含了原始输出里五个条目中的一个),这里的输出却不是一个硬盘,而是读卡器——磁盘的一种。注意系统将这个设备命名为了 `/dev/sdc`。 + +系统的主磁盘上也有相似的信息: + +``` +*-disk + description: ATA Disk + product: SSD2SC120G1CS175 + physical id: 0 + bus info: scsi@0:0.0.0 + logical name: /dev/sda <==这里 + version: 1101 + serial: PNY20150000778410606 + size: 111GiB (120GB) + capabilities: partitioned partitioned:dos + configuration: ansiversion=5 logicalsectorsize=512 sectorsize=512 signature= + f63b5929 +``` + +这块硬盘是 `/dev/sda`。这个系统上的硬盘都显示为 `ATA` 磁盘,`ATA` 是一种把控制器与盘体集成在一起的磁盘驱动器实现。 + +要获得“磁盘”类设备的简略列表,可以运行下面这条命令。注意其中有两个设备被列出了两次,所以我们看到的仍然是五个磁盘设备。 + +``` +$ sudo lshw -short -C disk +H/W path Device Class Description +============================================================= +/0/100/1d/1/1/0.0.0 /dev/sdc disk Card Reader-1 +/0/100/1d/1/1/0.0.0/0 /dev/sdc disk +/0/100/1d/1/1/0.0.1 /dev/sdd disk 2 +/0/100/1d/1/1/0.0.1/0 /dev/sdd disk +/0/100/1f.2/0 /dev/sda disk 120GB SSD2SC120G1CS175 +/0/100/1f.2/1 /dev/cdrom disk DVD+-RW GSA-H73N +/0/100/1f.5/0.0.0 /dev/sdb disk 500GB SAMSUNG HE502HJ +``` + +如果你决定要查看系统上的 **所有** 设备,请坐稳了;你会得到一个包含的东西比你通常认为的“设备”要多得多的列表,下面是一个例子,这是一个“简短(`short`)”(信息很少)的列表: + +``` +$ sudo lshw -short +[sudo] password for shs: +H/W path Device Class Description +============================================================= + system Inspiron 530s +/0 bus 0RY007 +/0/0 memory 128KiB BIOS +/0/4 processor Intel(R) Core(TM)2 Duo CPU +/0/4/a memory 32KiB L1 cache +/0/4/b memory 6MiB L2 cache +/0/24 memory 6GiB System Memory +/0/24/0 memory 2GiB DIMM DDR2 Synchronous 667 +/0/24/1 memory 1GiB DIMM DDR2 Synchronous 667 +/0/24/2 memory 2GiB DIMM DDR2 Synchronous 667 +/0/24/3 memory 1GiB DIMM DDR2 Synchronous 667 +/0/1 generic +/0/10 generic +/0/11 generic +/0/12 generic +/0/13 generic +/0/14 generic +/0/15 generic +/0/17 generic +/0/18 generic +/0/19 generic +/0/2 generic +/0/20 generic +/0/100 bridge 82G33/G31/P35/P31 Express DRAM +/0/100/1 bridge 82G33/G31/P35/P31 Express PCI +/0/100/1/0 display Caicos [Radeon HD 6450/7450/84 +/0/100/1/0.1 multimedia Caicos HDMI Audio [Radeon HD 6 +/0/100/19 enp0s25 network 82562V-2 10/100 Network Connec +/0/100/1a bus 82801I (ICH9 Family) USB UHCI +/0/100/1a/1 usb3 bus UHCI Host Controller +/0/100/1a.1 bus 82801I (ICH9 Family) USB UHCI +/0/100/1a.1/1 usb4 bus UHCI Host Controller +/0/100/1a.1/1/2 input Rock Candy Wireless Keyboard +/0/100/1a.2 bus 82801I (ICH9 Family) USB UHCI +/0/100/1a.2/1 usb5 bus UHCI Host Controller +/0/100/1a.2/1/2 input USB OPTICAL MOUSE +/0/100/1a.7 bus 82801I (ICH9 Family) USB2 EHCI +/0/100/1a.7/1 usb1 bus EHCI Host Controller +/0/100/1b multimedia 82801I (ICH9 Family) HD Audio +/0/100/1d bus 82801I (ICH9 Family) USB UHCI +/0/100/1d/1 usb6 bus UHCI Host Controller +/0/100/1d/1/1 scsi4 storage CD04 +/0/100/1d/1/1/0.0.0 /dev/sdc disk Card Reader-1 +/0/100/1d/1/1/0.0.0/0 /dev/sdc disk +/0/100/1d/1/1/0.0.1 /dev/sdd disk 2 +/0/100/1d/1/1/0.0.1/0 /dev/sdd disk +/0/100/1d.1 bus 82801I (ICH9 Family) USB UHCI +/0/100/1d.1/1 usb7 bus UHCI Host Controller +/0/100/1d.2 bus 82801I (ICH9 Family) USB UHCI +/0/100/1d.2/1 usb8 bus UHCI Host Controller +/0/100/1d.7 bus 82801I (ICH9 Family) USB2 EHCI +/0/100/1d.7/1 usb2 bus EHCI Host Controller +/0/100/1d.7/1/2 multimedia USB Live camera +/0/100/1e bridge 82801 PCI Bridge +/0/100/1e/1 communication HSF 56k Data/Fax Modem +/0/100/1f bridge 82801IR (ICH9R) LPC Interface +/0/100/1f.2 scsi0 storage 82801IR/IO/IH (ICH9R/DO/DH) 4 +/0/100/1f.2/0 /dev/sda disk 120GB SSD2SC120G1CS175 +/0/100/1f.2/0/1 /dev/sda1 volume 111GiB EXT4 volume +/0/100/1f.2/1 /dev/cdrom disk DVD+-RW GSA-H73N +/0/100/1f.3 bus 82801I (ICH9 Family) SMBus Con +/0/100/1f.5 scsi3 storage 82801I (ICH9 Family) 2 port SA +/0/100/1f.5/0.0.0 /dev/sdb disk 500GB SAMSUNG HE502HJ +/0/100/1f.5/0.0.0/1 /dev/sdb1 volume 433GiB EXT4 volume +/0/3 system PnP device PNP0c02 +/0/5 system PnP device PNP0b00 +/0/6 storage PnP device PNP0700 +/0/7 system PnP device PNP0c02 +/0/8 system PnP device PNP0c02 +/0/9 system PnP device PNP0c01 +``` + +运行下面的命令来列出设备类别,并统计每个类别中的设备数量。 + +``` +$ sudo lshw -short | awk ‘{print substr($0,36,13)}’ | tail -n +3 | sort | uniq -c + 4 bridge + 18 bus + 1 communication + 7 disk + 1 display + 12 generic + 2 input + 8 memory + 3 multimedia + 1 network + 1 processor + 4 storage + 6 system + 2 volume +``` + +**注意:** 上面使用 `awk` 命令从 `lshw` 的输出中选择 Class(类别)栏是这样实现的:使用 `$0`(选取完整行),但只取从正确位置(第 36 个字符)开始的子串,而因为“类别”中并没有条目的长度超过 13 个字符,所以子串就在那里结束。命令中 `tail -n +3` 的部分移除了标题和下面的`=====`,所以最终的列表中只包含了那 14 种设备类型。 + +(LCTT 译注:上面的命令中 `awk` 的部分在选取子串时是从第 36 个字符开始的,这个数字基本上取决于最长的设备逻辑名称的长度,因而在不同的系统环境中可能有所不同,一个例子是,当你的系统上有 NVMe SSD 时,可能需要将其改为 41。) + +你会发现在没有使用 `-short` 选项的时候,每一个磁盘类设备都会有大约 12 行的输出,包括像是 `/dev/sda` 这样的逻辑名称,磁盘大小和种类等等。 + +``` +$ sudo lshw -C disk +[sudo] password for shs: + *-disk:0 + description: SCSI Disk + product: Card Reader-1 <== 读卡器? + vendor: JIE LI + physical id: 0.0.0 + bus info: scsi@4:0.0.0 + logical name: /dev/sdc + version: 1.00 + capabilities: removable + configuration: logicalsectorsize=512 sectorsize=512 + *-medium + physical id: 0 + logical name: /dev/sdc + *-disk:1 + description: SCSI Disk + product: 2 + vendor: AC4100 - + physical id: 0.0.1 + bus info: scsi@4:0.0.1 + logical name: /dev/sdd + capabilities: removable + configuration: logicalsectorsize=512 sectorsize=512 + *-medium + physical id: 0 + logical name: /dev/sdd + *-disk + description: ATA Disk + product: SSD2SC120G1CS175 + physical id: 0 + bus info: scsi@0:0.0.0 + logical name: /dev/sda <== 主要磁盘 + version: 1101 + serial: PNY20150000778410606 + size: 111GiB (120GB) + capabilities: partitioned partitioned:dos + configuration: ansiversion=5 logicalsectorsize=512 sectorsize=512 signature=f63b5929 + *-cdrom <== 也叫 /dev/sr0 + description: DVD writer + product: DVD+-RW GSA-H73N + vendor: HL-DT-ST + physical id: 1 + bus info: scsi@1:0.0.0 + logical name: /dev/cdrom + logical name: /dev/cdrw + logical name: /dev/dvd + logical name: /dev/dvdrw + logical name: /dev/sr0 + version: B103 + serial: [ + capabilities: removable audio cd-r cd-rw dvd dvd-r + configuration: ansiversion=5 status=nodisc + *-disk + description: ATA Disk + product: SAMSUNG HE502HJ + physical id: 0.0.0 + bus info: scsi@3:0.0.0 + logical name: /dev/sdb <== 次要磁盘 + version: 0002 + serial: S2B6J90B501053 + size: 465GiB (500GB) + capabilities: partitioned partitioned:dos + configuration: ansiversion=5 logicalsectorsize=512 sectorsize=512 signature=7e67ccf3 +``` + +### 总结 + +`lshw` 命令提供了一些我们许多人通常不会处理的信息,不过即使你只用了其中的一部分,知道有多少信息可用还是很不错的。 + +-------------------------------------------------------------------------------- + +via: https://www.networkworld.com/article/3583598/how-to-view-information-on-your-linux-devices-with-lshw.html + +作者:[Sandra Henry-Stocker][a] +选题:[lujun9972][b] +译者:[rakino](https://github.com/rakino) +校对:[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://images.idgesg.net/images/article/2020/02/kali_linux_tools_abstract_gears_binary_data_by_nevarpp_gettyimages-688718788_2400x1600-100832674-large.jpg +[2]: https://www.facebook.com/NetworkWorld/ +[3]: https://www.linkedin.com/company/network-world diff --git a/published/202010/20200929 Drawing is an Open Source MS-Paint Type of App for Linux Desktop.md b/published/202010/20200929 Drawing is an Open Source MS-Paint Type of App for Linux Desktop.md new file mode 100644 index 0000000000..2c998c10ba --- /dev/null +++ b/published/202010/20200929 Drawing is an Open Source MS-Paint Type of App for Linux Desktop.md @@ -0,0 +1,119 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12712-1.html) +[#]: subject: (Drawing is an Open Source MS-Paint Type of App for Linux Desktop) +[#]: via: (https://itsfoss.com/drawing-app/) +[#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/) + +Drawing:一款开源的类似微软画图的 Linux 桌面应用 +====== + +![](https://img.linux.net.cn/data/attachment/album/202010/12/231731q0pgrkzidsguosps.jpg) + +> Drawing 是一个基本的图像编辑器,就像微软画图一样。有了这个开源的应用,你可以画箭头、线条、几何图形、添加颜色和其他你期望在普通绘图应用程序中做的事情。 + +### Drawing: 一个简单的 Linux 绘图应用 + +![][1] + +对于从 Windows XP (或更早版本)开始使用电脑的人来说,微软画图Paint是一个有趣的应用,是个可以随便画一些草图的应用。在这个被 Photoshop 和 GIMP 主导的世界里,画图应用仍然具有一定的现实意义。 + +有几个[可用于 Linux 的绘画应用][2],我打算在这个列表中再添加一个。 + +这款应用不出意外地叫做 [Drawing][3],你可以在 Linux 桌面和 Linux 智能手机上使用它。 + +### Drawing 应用的功能 + +![][4] + +Drawing 拥有你所期待的绘图应用的所有功能。你可以: + + * 从头开始创建新的绘图 + * 编辑现有的 PNG、JPEG 或 BMP 图像文件 + * 添加几何图形、线条、箭头等 + * 虚线 + * 使用铅笔工具进行自由手绘 + * 使用曲线和形状工具 + * 裁剪图像 + * 缩放图像到不同的像素大小 + * 添加文本 + * 选择图像的一部分(矩形、自由选择和颜色选择) + * 旋转图像 + * 添加复制到剪贴板的图像 + * 可在偏好中使用橡皮擦、荧光笔、油漆桶、颜色选择、颜色选择器工具 + * 无限撤销 + * 滤镜可以增加模糊、像素化、透明度等 + +### 我使用 Drawing 的经验 + +![][5] + +这个应用是新出现的,并且有不错的用户界面。它具有你期望在标准的绘画应用中找到的所有基本功能。 + +它有一些额外的工具,如颜色选择和拾色器,但在使用时可能会混淆。没有什么文档描述这些工具的使用,要全靠你自己摸索。 + +它的体验很流畅,作为图像编辑工具,我觉得这个工具很有潜力取代 Shutter (是的,我[用 Shutter 编辑截图][6])。 + +我觉得最麻烦的是,添加元素后无法编辑/修改。你有撤消和重做选项,但如果你想修改一个你在 12 步前添加的文本,你就必须重做所有的步骤。这是未来的版本中开发者可能要做的一些改进。 + +### 在 Linux 上安装 Drawing + +这是一款 Linux 专属应用。它也适用于基于 Linux 的智能手机,如 [PinePhone][7]。 + +有多种方式可以安装 Drawing。它在许多主要的 Linux 发行版的仓库中都有。 + +#### 基于 Ubuntu 的发行版 + +Drawing 包含在 Ubuntu 的 universe 仓库中,这意味着你可以从 Ubuntu 软件中心安装它。 + +但是,如果你想要最新的版本,有一个 [PPA][8] 可以轻松地在 Ubuntu、Linux Mint 和其他基于 Ubuntu 的发行版上安装 Drawing。 + +使用下面的命令: + +``` +sudo add-apt-repository ppa:cartes/drawing +sudo apt update +sudo apt install drawing +``` + +如果你想删除它,你可以使用以下命令: + +``` +sudo apt remove drawing +sudo add-apt-repository -r ppa:cartes/drawing +``` + +#### 其他 Linux 发行版 + +检查你的发行版的包管理器中是否有 Drawing,然后在那里安装。如果你想要最新的版本,你可以使用 Flatpak 版本的应用。 + +- [Drawing Flatpak][9] + +### 总结 + +你还在用画图应用么?你用的是哪一款?如果你已经尝试过 Drawing,你的体验如何? + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/drawing-app/ + +作者:[Abhishek Prakash][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://itsfoss.com/author/abhishek/ +[b]: https://github.com/lujun9972 +[1]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/09/drawing-app-interface.jpg?resize=789%2C449&ssl=1 +[2]: https://itsfoss.com/open-source-paint-apps/ +[3]: https://maoschanz.github.io/drawing/ +[4]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/09/drawing-screenshot.jpg?resize=800%2C489&ssl=1 +[5]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/09/using-drawing-app-linux.png?resize=787%2C473&ssl=1 +[6]: https://itsfoss.com/install-shutter-ubuntu/ +[7]: https://itsfoss.com/pinephone/ +[8]: https://launchpad.net/~cartes/+archive/ubuntu/drawing +[9]: https://flathub.org/apps/details/com.github.maoschanz.drawing diff --git a/published/202010/20200930 Present Slides in Linux Terminal With This Nifty Python Tool.md b/published/202010/20200930 Present Slides in Linux Terminal With This Nifty Python Tool.md new file mode 100644 index 0000000000..d780724635 --- /dev/null +++ b/published/202010/20200930 Present Slides in Linux Terminal With This Nifty Python Tool.md @@ -0,0 +1,101 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12719-1.html) +[#]: subject: (Present Slides in Linux Terminal With This Nifty Python Tool) +[#]: via: (https://itsfoss.com/presentation-linux-terminal/) +[#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/) + +在 Linux 终端中展示幻灯片 +====== + +![](https://img.linux.net.cn/data/attachment/album/202010/15/000226j34xnkzzg7z7x9ka.jpg) + +演示文稿往往是枯燥的。这就是为什么有些人会添加动画或漫画/meme 来增加一些幽默和风格来打破单调。 + +如果你需要在你的大学或公司的演示文稿中加入一些独特的风格,那么使用 Linux 终端怎么样?想象一下,这将是多么酷的事情啊! + +### Present:Linux 终端中进行演示 + +在终端中可以做很多[有趣好玩的事情][1]。制作和展示幻灯片只是其中之一。 + +这个基于 Python 的应用名为 [Present][2],它可以让你创建基于 Markdown 和 YML 的幻灯片,你可以在你的大学或公司里演讲,并以真正的极客风格取悦人们。 + +我制作了一个视频,展示了在 Linux 终端中用 Present 演示一些东西的样子。 + +- [VIDEO](https://img.linux.net.cn/static/video/Makes%20ASCII%20Based%20Presentation%20Slides%20in%20Linux%20terminal-462902030.mp4) + +#### Present 的功能 + +你可以用 Present 做以下事情: + + * 使用 Markdown 语法在幻灯片中添加文本 + * 用箭头或 `PgUp`/`Down` 键控制幻灯片 + * 改变前景和背景颜色 + * 在幻灯片中添加图像 + * 增加代码块 + * 播放模拟代码,并用 codio YML 文件输出 + +#### 在 Linux 上安装 Present + +Present 是一个基于 Python 的工具,你可以使用 PIP 来安装它。你应该确保用这个命令[在 Ubuntu 上安装 Pip][4]: + +``` +sudo apt install python3-pip +``` + +如果你使用的是其他发行版,请检查你的包管理器来安装 PIP3。 + +安装 PIP 后,你就可以以这种方式全局安装 Present: + +``` +sudo pip3 install present +``` + +你也可以只为当前用户安装,但你也必须将 `~/.local/bin` 添加到你的 `PATH` 环境变量。 + +#### 在 Linux 终端中使用 Present 来创建和展示幻灯片 + +![][5] + +由于 Present 使用了 Markdown 语法,你应该用它来创建自己的幻灯片。在这里使用 [Markdown 编辑器][6]会有帮助。 + +Present 需要一个 Markdown 文件来读取和播放幻灯片。你可以[下载这个示例幻灯片][7],但你需要单独下载嵌入的图像,并将它放在图像文件夹内。 + + * 在 Markdown 文件中使用 `—` 来分隔幻灯片。 + * 使用 Markdown 语法在幻灯片中添加文本。 + * 使用以下语法添加图片 `![RC] (images/name.png)`。 + * 通过添加像 `` 这样的语法来改变幻灯片的颜色。 + * 使用像 `` 这样的语法来添加带有效果的幻灯片。 + * 使用 [codio 语法][8] 添加代码运行模拟。 + * 使用 `q` 退出演示,并用左/右箭头或 `PgUp`/`Down` 键控制幻灯片。 + +请记住,在演示时调整终端窗口的大小会把东西搞乱,按回车键也是如此。 + +### 总结 + +如果你熟悉 Markdown 和终端,使用 Present 对你来说并不困难。 + +你不能把它和常规的用 Impress、MS Office 等制作的幻灯片相比,但偶尔使用,它是一个很酷的工具。如果你是计算机科学/网络专业的学生,或者是开发人员或系统管理员,你的同事一定会觉得很有趣。 + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/presentation-linux-terminal/ + +作者:[Abhishek Prakash][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://itsfoss.com/author/abhishek/ +[b]: https://github.com/lujun9972 +[1]: https://itsfoss.com/funny-linux-commands/ +[2]: https://github.com/vinayak-mehta/present +[4]: https://itsfoss.com/install-pip-ubuntu/ +[5]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/09/presentation-in-linux-terminal.png?resize=800%2C494&ssl=1 +[6]: https://itsfoss.com/best-markdown-editors-linux/ +[7]: https://github.com/vinayak-mehta/present/blob/master/examples/sample.md +[8]: https://present.readthedocs.io/en/latest/codio.html diff --git a/published/202010/20200930 Recovering deleted files on Linux with testdisk.md b/published/202010/20200930 Recovering deleted files on Linux with testdisk.md new file mode 100644 index 0000000000..c8c8e0dac0 --- /dev/null +++ b/published/202010/20200930 Recovering deleted files on Linux with testdisk.md @@ -0,0 +1,201 @@ +[#]: collector: (lujun9972) +[#]: translator: (wxy) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12674-1.html) +[#]: subject: (Recovering deleted files on Linux with testdisk) +[#]: via: (https://www.networkworld.com/article/3575524/recovering-deleted-files-on-linux-with-testdisk.html) +[#]: author: (Sandra Henry-Stocker https://www.networkworld.com/author/Sandra-Henry_Stocker/) + +用 testdisk 恢复 Linux 上已删除的文件 +====== + +> 这篇文章介绍了 testdisk,这是恢复最近删除的文件(以及用其他方式修复分区)的工具之一,非常方便。 + +![](https://images.idgesg.net/images/article/2018/01/survival_life-preserver_risk_swimming_rescue-100747102-large.jpg) + +当你在 Linux 系统上删除一个文件时,它不一定会永远消失,特别是当你最近才刚刚删除了它的时候。 + +除非你用 `shred` 等工具把它擦掉,否则数据仍然会放在你的磁盘上 —— 而恢复已删除文件的最佳工具之一 `testdisk` 可以帮助你拯救它。虽然 `testdisk` 具有广泛的功能,包括恢复丢失或损坏的分区和使不能启动磁盘可以重新启动,但它也经常被用来恢复被误删的文件。 + +在本篇文章中,我们就来看看如何使用 `testdisk` 恢复已删除的文件,以及该过程中的每一步是怎样的。由于这个过程需要不少的步骤,所以当你做了几次之后,你可能会觉得操作起来会更加得心应手。 + +### 安装 testdisk + +可以使用 `apt install testdisk` 或 `yum install testdisk` 等命令安装 `testdisk`。有趣的是,它不仅是一个 Linux 工具,而且还适用于 MacOS、Solaris 和 Windows。 + +文档可在 [cgsecurity.org][1] 中找到。 + +### 恢复文件 + +首先,你必须以 `root` 身份登录,或者有 `sudo` 权限才能使用 `testdisk`。如果你没有 `sudo` 访问权限,你会在这个过程一开始就被踢出,而如果你选择创建了一个日志文件的话,最终会有这样的消息: + +``` +TestDisk exited normally. +jdoe is not in the sudoers file. This incident will be reported. +``` + +当你用 `testdisk` 恢复被删除的文件时,你最终会将恢复的文件放在你启动该工具的目录下,而这些文件会属于 `root`。出于这个原因,我喜欢在 `/home/recovery` 这样的目录下启动。一旦文件被成功地还原和验证,就可以将它们移回它们的所属位置,并将它们的所有权也恢复。 + +在你可以写入的选定目录下开始: + +``` +$ cd /home/recovery +$ testdisk +``` + +`testdisk` 提供的第一页信息描述了该工具并显示了一些选项。至少在刚开始,创建个日志文件是个好主意,因为它提供的信息可能会被证明是有用的。下面是如何做的: + +``` +Use arrow keys to select, then press Enter key: +>[ Create ] Create a new log file + [ Append ] Append information to log file + [ No Log ] Don’t record anything +``` + +左边的 `>` 以及你看到的反转的字体和背景颜色指出了你按下回车键后将使用的选项。在这个例子中,我们选择了创建日志文件。 + +然后会提示你输入密码(除非你最近使用过 `sudo`)。 + +下一步是选择被删除文件所存储的磁盘分区(如果没有高亮显示的话)。根据需要使用上下箭头移动到它。然后点两次右箭头,当 “Proceed” 高亮显示时按回车键。 + +``` +Select a media (use Arrow keys, then press Enter): + Disk /dev/sda - 120 GB / 111 GiB - SSD2SC120G1CS1754D117-551 +>Disk /dev/sdb - 500 GB / 465 GiB - SAMSUNG HE502HJ + Disk /dev/loop0 - 13 MB / 13 MiB (RO) + Disk /dev/loop1 - 101 MB / 96 MiB (RO) + Disk /dev/loop10 - 148 MB / 141 MiB (RO) + Disk /dev/loop11 - 36 MB / 35 MiB (RO) + Disk /dev/loop12 - 52 MB / 49 MiB (RO) + Disk /dev/loop13 - 78 MB / 75 MiB (RO) + Disk /dev/loop14 - 173 MB / 165 MiB (RO) + Disk /dev/loop15 - 169 MB / 161 MiB (RO) +>[Previous] [ Next ] [Proceed ] [ Quit ] +``` + +在这个例子中,被删除的文件在 `/dev/sdb` 的主目录下。 + +此时,`testdisk` 应该已经选择了合适的分区类型。 + +``` +Disk /dev/sdb - 500 GB / 465 GiB - SAMSUNG HE502HJ + +Please select the partition table type, press Enter when done. + [Intel ] Intel/PC partition +>[EFI GPT] EFI GPT partition map (Mac i386, some x86_64...) + [Humax ] Humax partition table + [Mac ] Apple partition map (legacy) + [None ] Non partitioned media + [Sun ] Sun Solaris partition + [XBox ] XBox partition + [Return ] Return to disk selection +``` + +在下一步中,按向下箭头指向 “[ Advanced ] Filesystem Utils”。 + +``` +[ Analyse ] Analyse current partition structure and search for lost partitions +>[ Advanced ] Filesystem Utils + [ Geometry ] Change disk geometry + [ Options ] Modify options + [ Quit ] Return to disk selection +``` + +接下来,查看选定的分区。 + +``` +Partition Start End Size in sectors +> 1 P Linux filesys. data 2048 910155775 910153728 [drive2] +``` + +然后按右箭头选择底部的 “[ List ]”,按回车键。 + +``` +[ Type ] [Superblock] >[ List ] [Image Creation] [ Quit ] +``` + +请注意,它看起来就像我们从根目录 `/` 开始,但实际上这是我们正在工作的文件系统的基点。在这个例子中,就是 `/home`。 + +``` +Directory / <== 开始点 + +>drwxr-xr-x 0 0 4096 23-Sep-2020 17:46 . + drwxr-xr-x 0 0 4096 23-Sep-2020 17:46 .. + drwx——— 0 0 16384 22-Sep-2020 11:30 lost+found + drwxr-xr-x 1008 1008 4096 9-Jul-2019 14:10 dorothy + drwxr-xr-x 1001 1001 4096 22-Sep-2020 12:12 nemo + drwxr-xr-x 1005 1005 4096 19-Jan-2020 11:49 eel + drwxrwxrwx 0 0 4096 25-Sep-2020 08:08 recovery +... +``` + +接下来,我们按箭头指向具体的主目录。 + +``` +drwxr-xr-x 1016 1016 4096 17-Feb-2020 16:40 gino +>drwxr-xr-x 1000 1000 20480 25-Sep-2020 08:00 shs +``` + +按回车键移动到该目录,然后根据需要向下箭头移动到子目录。注意,如果选错了,可以选择列表顶部附近的 `..` 返回。 + +如果找不到文件,可以按 `/`(就像在 `vi` 中开始搜索时一样),提示你输入文件名或其中的一部分。 + +``` +Directory /shs <== current location + Previous +... + -rw-rw-r— 1000 1000 426 8-Apr-2019 19:09 2-min-topics +>-rw-rw-r— 1000 1000 24667 8-Feb-2019 08:57 Up_on_the_Roof.pdf +``` + +一旦你找到需要恢复的文件,按 `c` 选择它。 + +注意:你会在屏幕底部看到有用的说明: + +``` +Use Left arrow to go back, Right to change directory, h to hide deleted files + q to quit, : to select the current file, a to select all files + C to copy the selected files, c to copy the current file <== +``` + +这时,你就可以在起始目录内选择恢复该文件的位置了(参见前面的说明,在将文件移回原点之前,先在一个合适的地方进行检查)。在这种情况下,`/home/recovery` 目录没有子目录,所以这就是我们的恢复点。 + +注意:你会在屏幕底部看到有用的说明: + +``` +Please select a destination where /shs/Up_on_the_Roof.pdf will be copied. +Keys: Arrow keys to select another directory + C when the destination is correct + Q to quit +Directory /home/recovery <== 恢复位置 +``` + +一旦你看到 “Copy done! 1 ok, 0 failed” 的绿色字样,你就会知道文件已经恢复了。 + +在这种情况下,文件被留在 `/home/recovery/shs` 下(起始目录,附加所选目录)。 + +在将文件移回原来的位置之前,你可能应该先验证恢复的文件看起来是否正确。确保你也恢复了原来的所有者和组,因为此时文件由 root 拥有。 + +**注意:** 对于文件恢复过程中的很多步骤,你可以使用退出(按 `q` 或“[ Quit ]”)来返回上一步。如果你愿意,可以选择退出选项一直回到该过程中的第一步,也可以选择按下 `^c` 立即退出。 + +#### 恢复训练 + +使用 `testdisk` 恢复文件相对来说没有痛苦,但有些复杂。在恐慌时间到来之前,最好先练习一下恢复文件,让自己有机会熟悉这个过程。 + +-------------------------------------------------------------------------------- + +via: https://www.networkworld.com/article/3575524/recovering-deleted-files-on-linux-with-testdisk.html + +作者:[Sandra Henry-Stocker][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.networkworld.com/author/Sandra-Henry_Stocker/ +[b]: https://github.com/lujun9972 +[1]: https://www.cgsecurity.org/testdisk.pdf +[2]: https://www.facebook.com/NetworkWorld/ +[3]: https://www.linkedin.com/company/network-world diff --git a/published/202010/20201005 Linux Jargon Buster- What is a Package Manager in Linux- How Does it Work.md b/published/202010/20201005 Linux Jargon Buster- What is a Package Manager in Linux- How Does it Work.md new file mode 100644 index 0000000000..ea001d9fd9 --- /dev/null +++ b/published/202010/20201005 Linux Jargon Buster- What is a Package Manager in Linux- How Does it Work.md @@ -0,0 +1,112 @@ +[#]: collector: (lujun9972) +[#]: translator: (wxy) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12713-1.html) +[#]: subject: (Linux Jargon Buster: What is a Package Manager in Linux? How Does it Work?) +[#]: via: (https://itsfoss.com/package-manager/) +[#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/) + +Linux 黑话解释:什么是包管理器?它是如何工作的? +====== + +![](https://img.linux.net.cn/data/attachment/album/202010/13/094827peunhns3nn3qceno.jpg) + +[Linux 发行版之间有什么不同][1]的要点之一是包管理。在这篇 Linux 黑话解释中,你将了解 Linux 中的打包和包管理器。你将了解什么是包,什么是包管理器,它们是如何工作的,以及有什么包管理器。 + +### 什么是包管理器? + +简单来说,“包管理器package manager”(或“软件包管理器”)是一种工具,它允许用户在操作系统上安装、删除、升级、配置和管理软件包。软件包管理器可以是像“软件中心”这样的图形化应用,也可以是像 [apt-get][2] 或 [pacman][3] 这样的命令行工具。 + +你会发现我经常在教程和文章中使用“包”这个词。要了解包管理器,你必须了解什么是包。 + +### 什么是包? + +一个“package”(或“软件包”)通常指的是一个应用程序,它可以是一个 GUI 应用程序、命令行工具或(其他软件程序需要的)软件库。包本质上是一个存档文件,包含二进制可执行文件、配置文件,有时还包含依赖关系的信息。 + +在旧时代,[软件曾经是从它的源代码安装的][4]。你会参考一个文件(通常命名为 `README`),看看它需要什么软件组件、二进制文件的位置。它通常包括一个配置脚本或 `Makefile`。你必须自己编译该软件或自己处理所有的依赖关系(有些软件需要安装其他软件)。 + +为了摆脱这种复杂性,Linux 发行版创建了自己的打包格式,为终端用户提供随时可用的二进制文件(预编译软件),以便安装软件,同时提供一些[元数据][5](版本号、描述)和依赖关系。 + +这就像烤蛋糕与买蛋糕一样。 + +![][6] + +大约在上世纪 90 年代中期,Debian 创建了 DEB 打包格式(`.deb`),Red Hat Linux 创建了 RPM(Red Hat Package Manager 的缩写)打包系统(`.rpm`)。编译源代码的方式仍然存在,但现在是可选的。 + +要与打包系统交互或使用打包系统,你需要一个包管理器。 + +### 包管理器是如何工作的? + +请记住,包管理器是一个通用的概念,它并不是 Linux 独有的。你会经常发现各种软件或编程语言的包管理器。有[只是针对 Python 包的 PIP 包管理器][7]。甚至 [Atom 编辑器也有自己的包管理器][8]。 + +由于本文的重点是 Linux,所以我会从 Linux 的角度出发。不过,这里的大部分解释也可以应用于一般的包管理器。 + +我创建了这个图(基于 SUSE Wiki),这样你就可以很容易理解包管理器是如何工作的。 + +![][9] + +几乎所有的 Linux 发行版都有“软件仓库software repository”,它基本上是软件包的集合。是的,可以有不止一个软件库。软件库包含不同种类的软件包。 + +软件仓库也有元数据文件,其中包含了软件包的信息,如软件包的名称、版本号、软件包的描述和软件仓库名称等。这就是你在 Ubuntu/Debian 中使用 [apt show 命令][10]所看到的。 + +你的系统上的包管理器首先会与元数据进行交互。包管理器在你的系统上创建了一个元数据的本地缓存。当你运行包管理器的更新选项(例如 `apt update`)时,它会通过引用仓库中的元数据来更新本地元数据缓存。 + +当你运行软件包管理器的安装命令(例如 `apt install package_name`)时,软件包管理器会引用这个缓存。如果它在缓存中找到了包的信息,它就会使用互联网连接到相应的仓库,并在你的系统上安装之前先下载包。 + +一个包可能有依赖关系。意思是说,它可能需要安装其他软件包。软件包管理器通常会处理这些依赖关系,并将其与你正在安装的软件包一起自动安装。 + +![Linux 中包管理器会处理依赖关系][11] + +同样,当你使用包管理器删除一个包时,它要么自动删除,要么通知你系统有未使用的包可以清理。 + +除了安装、删除这些显而易见的任务外,你还可以使用包管理器对包进行配置,并根据自己的需要进行管理。例如,你可以在常规的系统更新中[防止升级某个包的版本][12]。你的包管理器可能还能做很多事情。 + +### 不同种类的包管理器 + +包管理器因打包系统而异,但同一打包系统却可能有多个包管理器。 + +例如,RPM 有 [Yum][13] 和 [DNF][14] 包管理器。对于 DEB,你有 `apt-get`、[aptitude][15] 等基于命令行的包管理器。 + +![Synaptic 包管理器][16] + +软件包管理器不一定是基于命令行的,也有图形化的软件包管理工具,比如 [Synaptic][17]。你的发行版的“软件中心”也是一个软件包管理器,即使它在底层运行的是 `apt-get` 或 DNF。 + +### 结论 + +我不想进一步详细介绍这个话题,虽然我可以继续说下去,但这将偏离本主题的目标 —— 即让你对 Linux 中的包管理器有一个基本的了解。 + +我暂时忽略了新的通用打包格式,比如 Snap 和 Flatpak。 + +我希望你对 Linux 中的包管理系统有更好的理解。如果你还有困惑,或者你对这个主题有一些问题,请发表评论。我会尽量回答你的问题,如果需要的话,我会在本文中更新新的内容。 + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/package-manager/ + +作者:[Abhishek Prakash][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://itsfoss.com/author/abhishek/ +[b]: https://github.com/lujun9972 +[1]: https://itsfoss.com/what-is-linux/ +[2]: https://itsfoss.com/apt-vs-apt-get-difference/ +[3]: https://itsfoss.com/pacman-command/ +[4]: https://itsfoss.com/install-software-from-source-code/ +[5]: https://www.computerhope.com/jargon/m/metadata.htm +[6]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/10/source-code-comilation-vs-packaging.png?resize=800%2C450&ssl=1 +[7]: https://itsfoss.com/install-pip-ubuntu/ +[8]: https://itsfoss.com/install-packages-in-atom/ +[9]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/10/linux-package-manager-explanation.png?resize=800%2C450&ssl=1 +[10]: https://itsfoss.com/apt-search-command/ +[11]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/10/package-manager-handling-dependencies-in-linux.png?resize=800%2C450&ssl=1 +[12]: https://itsfoss.com/prevent-package-update-ubuntu/ +[13]: https://fedoraproject.org/wiki/Yum +[14]: https://fedoraproject.org/wiki/DNF +[15]: https://wiki.debian.org/Aptitude +[16]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/06/see-packages-by-repositories-synaptic.png?resize=799%2C548&ssl=1 +[17]: https://itsfoss.com/synaptic-package-manager/ diff --git a/published/202010/20201006 Simplify your web experience with this internet protocol alternative.md b/published/202010/20201006 Simplify your web experience with this internet protocol alternative.md new file mode 100644 index 0000000000..dd013f7416 --- /dev/null +++ b/published/202010/20201006 Simplify your web experience with this internet protocol alternative.md @@ -0,0 +1,99 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12738-1.html) +[#]: subject: (Simplify your web experience with this internet protocol alternative) +[#]: via: (https://opensource.com/article/20/10/gemini-internet-protocol) +[#]: author: (Seth Kenlon https://opensource.com/users/seth) + +使用互联网协议替代方案 Gemini 简化你的 Web 体验 +====== + +> 用 Gemini 协议发现更安静、更简单的互联网新角落。 + +![](https://img.linux.net.cn/data/attachment/album/202010/21/070950dzph7mlm0h035h3o.jpg) + +如果你很久以前就已经上网了,或者是知识非常丰富,你可能还记得一个早期的文本共享协议,叫做 [Gopher][2]。Gopher 最终被 HTTP 协议所取代,当然,HTTP 协议是现代万维网的基础。对于很多人来说,“互联网internet”和“万维网World Wide Web”是一回事,因为很多人没有意识到在网上进行了*非* www 子域下的任何操作。 + +但一直以来,都有各种网络协议在互联网络上共享信息:Telnet、FTP、SSH、Torrent、GNUnet 等等。最近,在这一系列的替代品中又多了一个,它叫 [Gemini][3]。 + +Gemini(双子座)协议,以“水星计划”和“阿波罗计划”的基础实验之间的太空任务命名,旨在和平地处在 Gopher 和 HTTP 之间。无论如何,它的目的并不是要取代现代 Web,但它确实试图创造一个简化的网络和一个现代化的 Gopher。 + +它的发展历史虽然可能很年轻,但意义重大,原因有很多。当然,人们会因为技术和哲学上的原因而对现代 Web 表示质疑,但它只是一般的臃肿。当你真正想要的是一个非常具体的问题的可靠答案时,那么无数次点击谷歌搜索的结果让人感觉过头了。 + +许多人使用 Gopher 就是因为这个原因:它的规模小到可以让小众的兴趣很容易找到。然而,Gopher 是一个旧的协议,它对编程、网络和浏览做出了一些假设,但这些假设已经不再适用了。 Gemini 的目标是将最好的网络带入一种类似于 Gopher 但易于编程的格式。一个简单的 Gemini 浏览器可以用几百行代码写成,并且有一个非常好的浏览器用 1600 行左右写成。这对于程序员、学生和极简主义者来说都是一个强大的功能。 + +### 如何浏览 Gemini + +就像早期的网络一样,Gemini 的规模很小,所以有一个列表列出了运行 Gemini 网站的已知服务器。就像浏览 HTTP 站点需要一个网页浏览器一样,访问 Gemini 站点也需要一个 Gemini 浏览器。在 [Gemini 网站][4]上列出了有几个可用的浏览器。 + +最简单的一个是 [AV-98][5] 客户端。它是用 Python 编写的,在终端中运行。要想试试的话,请下载它: + +``` +$ git clone https://tildegit.org/solderpunk/AV-98.git +``` + +进入下载目录,运行 AV-98: + +``` +$ cd AV-98.git +$ python3 ./main.py +``` + +客户端是一个交互式的提示符。它有有限的几个命令,主要的命令是简单的 `go`,后面跟着一个 Gemini 服务器地址。在已知的 [Gemini 服务器][6]列表中选择一个看起来很有趣的服务器,然后尝试访问它: + +``` +AV-98> go gemini://example.club + +Welcome to the example.club Gemini server! + +Here are some folders of ASCII art: + +[1] Penguins +[2] Wildebeests +[3] Demons +``` + +导航是按照编号的链接来进行的。例如,要进入 `Penguins` 目录,输入 `1` 然后按回车键: + + +``` +AV-98> 1 + +[1] Gentoo +[2] Emperor +[3] Little Blue +``` + +要返回,输入 `back` 并按回车键: + +``` +AV-98> back +``` + +更多命令,请输入 `help`。 + +### 用 Gemini 作为你的 web 替代 + +Gemini 协议非常简单,初级和中级程序员都可以为其编写客户端,而且它是在互联网上分享内容的一种简单快捷的方式。虽然万维网的无处不在对广泛传播是有利的,但总有替代方案的空间。看看 Gemini,发现更安静、更简单的互联网的新角落。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/10/gemini-internet-protocol + +作者:[Seth Kenlon][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/seth +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/1980s-computer-yearbook.png?itok=eGOYEKK- (Person typing on a 1980's computer) +[2]: https://en.wikipedia.org/wiki/Gopher_%28protocol%29 +[3]: https://gemini.circumlunar.space/ +[4]: https://gemini.circumlunar.space/clients.html +[5]: https://tildegit.org/solderpunk/AV-98 +[6]: https://portal.mozz.us/gemini/gemini.circumlunar.space/servers diff --git a/published/202010/20201008 Integrate your calendar with Ansible to avoid schedule conflicts.md b/published/202010/20201008 Integrate your calendar with Ansible to avoid schedule conflicts.md new file mode 100644 index 0000000000..a37438c779 --- /dev/null +++ b/published/202010/20201008 Integrate your calendar with Ansible to avoid schedule conflicts.md @@ -0,0 +1,106 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12733-1.html) +[#]: subject: (Integrate your calendar with Ansible to avoid schedule conflicts) +[#]: via: (https://opensource.com/article/20/10/calendar-ansible) +[#]: author: (Nicolas Leiva https://opensource.com/users/nicolas-leiva) + +将你的日历与 Ansible 集成,以避免与日程冲突 +====== + +> 通过将日历应用集成到 Ansible 中,确保你的自动化工作流计划不会与其他东西冲突。 + +![](https://img.linux.net.cn/data/attachment/album/202010/18/221110wk9kd9ewrde11zxx.jpg) + +“随时”是执行自动化工作流的好时机吗?出于不同的原因,答案可能是否定的。 + +如果要避免同时进行更改,以最大限度地减少对关键业务流程的影响,并降低意外服务中断的风险,则在你的自动化运行的同时,其他任何人都不应该试图进行更改。 + +在某些情况下,可能存在一个正在进行的计划维护窗口。或者,可能有大型事件即将来临、一个关键的业务时间、或者假期(你或许不想在星期五晚上进行更改)。 + +![Street scene with a large calendar and people walking][2] + +无论出于什么原因,你都希望将此信息发送到你的自动化平台,以防止在特定时间段内执行周期性或临时任务。用变更管理的行话,我说的是当变更活动不应该发生时,指定封锁窗口。 + +### Ansible 中的日历集成 + +如何在 [Ansible][5] 中实现这个功能?虽然它本身没有日历功能,但 Ansible 的可扩展性将允许它与任何具有 API 的日历应用集成。 + +目标是这样的:在执行任何自动化或变更活动之前,你要执行一个 `pre-task` ,它会检查日历中是否已经安排了某些事情(目前或最近),并确认你没有在一个阻塞的时间段中。 + +想象一下,你有一个名为 `calendar` 的虚构模块,它可以连接到一个远程日历,比如 Google 日历,以确定你指定的时间是否已经以其他方式被标记为繁忙。你可以写一个类似这样的剧本: + +``` +- name: Check if timeslot is taken +  calendar: +    time: "{{ ansible_date_time.iso8601 }}" +  register: output +``` + +Ansible 实际会给出 `ansible_date_time`,将其传递给 `calendar` 模块,以验证时间的可用性,以便它可以注册响应 (`output`),用于后续任务。 + +如果你的日历是这样的: + +![Google Calendar screenshot][6] + +那么这个任务的输出就会指明这个时间段被占用的事实 (`busy: true`): + +``` +ok: [localhost] => { +   "output": { +       "busy": true, +       "changed": false, +       "failed": false, +       "msg": "The timeslot 2020-09-02T17:53:43Z is busy: true" +   } +} +``` + +### 阻止任务运行 + +接下来,[Ansible Conditionals][8] 将帮助阻止所有之后任务的执行。一个简单的例子,你可以在下一个任务上使用 `when` 语句来强制它只有当上一个输出中的 `busy` 字段不是 `true` 时,它才会运行: + +``` +tasks: +  - shell: echo "Run this only when not busy!" +    when: not output.busy +``` + +### 总结 + +在[上一篇文章][9]中,我说过 Ansible 是一个将事物连接在一起的框架,将不同的组成部分相互连接,以协调端到端自动化工作流。 + +这篇文章探讨了 Ansible 剧本如何与日历应用集成以检查可用性。然而,我只做了一些表面工作!例如,你的任务也可以阻止日历中的一个时间段,这里的发挥空间很大。 + +在我的下一篇文章中,我将深入 `calendar` 模块是如何构建的,以及其他编程语言如何与 Ansible 一起使用。如果你和我一样是 [Go][10] 的粉丝,请继续关注! + +* * * + +_这篇文章最初发表在 Medium 上,名为 [Ansible and Google Calendar integration for change management][11],采用 CC BY-SA 4.0 许可,经许可后转载。_ + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/10/calendar-ansible + +作者:[Nicolas Leiva][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/nicolas-leiva +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/calendar.jpg?itok=jEKbhvDT (Calendar close up snapshot) +[2]: https://opensource.com/sites/default/files/uploads/street-calendar.jpg (Street scene with a large calendar and people walking) +[3]: https://www.flickr.com/photos/7841127@N02/4217116202 +[4]: https://creativecommons.org/licenses/by-nd/2.0/ +[5]: https://docs.ansible.com/ansible/latest/index.html +[6]: https://opensource.com/sites/default/files/uploads/googlecalendarexample.png (Google Calendar screenshot) +[7]: https://creativecommons.org/licenses/by-sa/4.0/ +[8]: https://docs.ansible.com/ansible/latest/user_guide/playbooks_conditionals.html +[9]: https://medium.com/swlh/python-and-ansible-to-automate-a-network-security-workflow-28b9a44660c6 +[10]: https://golang.org/ +[11]: https://medium.com/swlh/ansible-and-google-calendar-integration-for-change-management-7c00553b3d5a diff --git a/published/202010/20201009 How to Install Deepin Desktop on Ubuntu 20.04 LTS.md b/published/202010/20201009 How to Install Deepin Desktop on Ubuntu 20.04 LTS.md new file mode 100644 index 0000000000..84fc35c76f --- /dev/null +++ b/published/202010/20201009 How to Install Deepin Desktop on Ubuntu 20.04 LTS.md @@ -0,0 +1,133 @@ +[#]: collector: (lujun9972) +[#]: translator: (gxlct008) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12724-1.html) +[#]: subject: (How to Install Deepin Desktop on Ubuntu 20.04 LTS) +[#]: via: (https://itsfoss.com/install-deepin-ubuntu/) +[#]: author: (Ankush Das https://itsfoss.com/author/ankush/) + +如何在 Ubuntu 20.04 LTS 上安装深度(Deepin)桌面环境 +====== + +![](https://img.linux.net.cn/data/attachment/album/202010/15/223607kqs5zguiq53fkkig.png) + +> 本教程向你展示在 Ubuntu 上安装深度(Deepin)桌面环境的正确步骤。还提到了移除步骤。 + +毫无疑问,深度操作系统(Deepin OS)是一个 [漂亮的 Linux 发行版][1]。最近发布的 [深度操作系统 V20][2] 就更加美观了。 + +[深度操作系统][3] 是基于 [Debian][4] 的,默认的存储库镜像太慢了。如果你更愿意使用 Ubuntu,可以选择 [UbuntuDDE Linux 发行版][5] 形式的 Ubuntu 的深度操作系统的变体。它还不是 [官方的 Ubuntu 风格][6] 之一。 + +[重新安装新的发行版][7] 是一个麻烦,因为你会丢失数据,你将不得不在新安装的 UbuntuDDE 上重新安装你的应用程序。 + +一个更简单的选择是在现有的 Ubuntu 系统上安装深度桌面环境(DDE)。毕竟,你可以轻松地在一个系统中安装多个[桌面环境][8]。 + +不要烦恼,这很容易做到,如果你不喜欢,也可以恢复这些更改。让我来告诉你怎么做。 + +### 在 Ubuntu 20.04 上安装深度桌面环境 + +UbuntuDDE 团队已为他们的发行版创建了一个 PPA,你可以使用相同的 PPA 在 Ubuntu 20.04 上安装深度桌面环境。请记住,此 PPA 仅适用于 Ubuntu 20.04。请阅读有关 [在 Ubuntu 中使用 PPA][10]。 + +> 没有深度桌面环境 V20 +> +> 你将在此处使用 PPA 安装的深度桌面环境还不是新的 V20。它可能会在 Ubuntu 20.10 发布后出现,但是我们不能担保。 + +以下是你需要遵循的步骤: + +**步骤 1**:你需要首先在终端上输入以下内容,来添加 [Ubuntu DDE Remix 团队的官方 PPA][11]: + +``` +sudo add-apt-repository ppa:ubuntudde-dev/stable +``` + +**步骤 2**:添加存储库以后,继而安装深度桌面环境。 + +``` +sudo apt install ubuntudde-dde +``` + +![][12] + +现在,安装将启动,一段时间后,将要求你选择显示管理器display manager。 + +![][13] + +如果需要深度桌面主题的锁屏,则需要选择 “lightdm”。如果不需要,你可以将其设置为 “gdm3”。 + +如果你看不到此选项,可以通过键入以下命令来获得它,然后选择你首选的显示管理器: + +``` +sudo dpkg-reconfigure lightdm +``` + +**步骤 3**: 完成后,你必须退出并通过选择 “Deepin” 会话再次登录,或者重新启动系统。 + +![][14] + + +就是这样。马上在你的 Ubuntu 20.04 LTS 系统上享受深度桌面环境体验吧! + +![][15] + +### 从 Ubuntu 20.04 删除深度桌面 + +如果你不喜欢这种体验,或者由于某些原因它有 bug,可以按照以下步骤将其删除。 + +**步骤 1**: 如果你已将 “lightdm” 设置为显示管理器,则需要在卸载深度桌面环境之前将显示管理器设置为 “gdm3”。为此,请键入以下命令: + +``` +sudo dpkg-reconfigure lightdm +``` + +![Select gdm3 on this screen][13] + +然后,选择 “gdm3” 继续。 + +完成此操作后,你只需输入以下命令即可完全删除深度桌面环境: + +``` +sudo apt remove startdde ubuntudde-dde +``` + +你只需重启即可回到原来的 Ubuntu 桌面环境。如果图标没有响应,只需打开终端(`CTRL + ALT + T`)并输入: + + +``` +reboot +``` + +### 总结 + +有不同的 [桌面环境选择][16] 是件好事。如果你真的喜欢深度桌面环境的界面,那么这可能是在 Ubuntu 上体验深度操作系统的一种方式。 + +如果你有任何疑问或遇到任何问题,请在评论中告诉我。 + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/install-deepin-ubuntu/ + +作者:[Ankush Das][a] +选题:[lujun9972][b] +译者:[gxlct008](https://github.com/gxlct008) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://itsfoss.com/author/ankush/ +[b]: https://github.com/lujun9972 +[1]: https://itsfoss.com/beautiful-linux-distributions/ +[2]: https://itsfoss.com/deepin-20-review/ +[3]: https://www.deepin.org/en/ +[4]: https://www.debian.org/ +[5]: https://itsfoss.com/ubuntudde/ +[6]: https://itsfoss.com/which-ubuntu-install/ +[7]: https://itsfoss.com/reinstall-ubuntu/ +[8]: https://itsfoss.com/what-is-desktop-environment/ +[9]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/10/ubuntu-20-with-deepin.jpg?resize=800%2C386&ssl=1 +[10]: https://itsfoss.com/ppa-guide/ +[11]: https://launchpad.net/~ubuntudde-dev/+archive/ubuntu/stable +[12]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/10/deepin-desktop-install.png?resize=800%2C534&ssl=1 +[13]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/10/deepin-display-manager.jpg?resize=800%2C521&ssl=1 +[14]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/10/deepin-session-ubuntu.jpg?resize=800%2C414&ssl=1 +[15]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/10/ubuntu-20-with-deepin-1.png?resize=800%2C589&ssl=1 +[16]: https://itsfoss.com/best-linux-desktop-environments/ diff --git a/published/202010/20201009 How to Remove Physical Volume from a Volume Group in LVM.md b/published/202010/20201009 How to Remove Physical Volume from a Volume Group in LVM.md new file mode 100644 index 0000000000..92d4b4c6c1 --- /dev/null +++ b/published/202010/20201009 How to Remove Physical Volume from a Volume Group in LVM.md @@ -0,0 +1,181 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12750-1.html) +[#]: subject: (How to Remove Physical Volume from a Volume Group in LVM) +[#]: via: (https://www.2daygeek.com/linux-remove-delete-physical-volume-pv-from-volume-group-vg-in-lvm/) +[#]: author: (Magesh Maruthamuthu https://www.2daygeek.com/author/magesh/) + +如何从 LVM 的卷组中删除物理卷? +====== + +![](https://img.linux.net.cn/data/attachment/album/202010/25/101355kav72t5iy5yj55tg.jpg) + +如果你的 LVM 不再需要使用某个设备,你可以使用 `vgreduce` 命令从卷组中删除物理卷。 + +`vgreduce` 命令可以通过删除物理卷来缩小卷组的容量。但要确保该物理卷没有被任何逻辑卷使用,请使用 `pvdisplay` 命令查看。如果物理卷仍在使用,你必须使用 `pvmove` 命令将数据转移到另一个物理卷。 + +数据转移后,它就可以从卷组中删除。 + +最后使用 `pvremove` 命令删除空物理卷上的 LVM 标签和 LVM 元数据。 + + * **第一部分:[如何在 Linux 中创建/配置 LVM(逻辑卷管理)][1]** + * **第二部分:[如何在 Linux 中扩展/增加 LVM 大小(逻辑卷调整)][2]** + * **第三部分:[如何在 Linux 中减少/缩小 LVM 大小(逻辑卷调整)][3]** + +![](https://img.linux.net.cn/data/attachment/album/202010/25/101424vgcio5fooi9uo5gh.jpeg) + +### 将扩展块移动到现有物理卷上 + +使用 `pvs` 命令检查是否使用了所需的物理卷(我们计划删除 LVM 中的 `/dev/sdc` 磁盘)。 + +``` +# pvs -o+pv_used + +PV VG Fmt Attr PSize PFree Used +/dev/sda myvg lvm2 a- 75.00G 14.00G 61.00G +/dev/sdb myvg lvm2 a- 50.00G 45.00G 5.00G +/dev/sdc myvg lvm2 a- 17.15G 12.15G 5.00G +``` + +如果使用了,请检查卷组中的其他物理卷是否有足够的空闲扩展块extent。 + +如果有的话,你可以在需要删除的设备上运行 `pvmove` 命令。扩展块将被分配到其他设备上。 + +``` +# pvmove /dev/sdc + +/dev/sdc: Moved: 2.0% +… +/dev/sdc: Moved: 79.2% +… +/dev/sdc: Moved: 100.0% +``` + +当 `pvmove` 命令完成后。再次使用 `pvs` 命令检查物理卷是否有空闲。 + +``` +# pvs -o+pv_used + +PV VG Fmt Attr PSize PFree Used +/dev/sda myvg lvm2 a- 75.00G 1.85G 73.15G +/dev/sdb myvg lvm2 a- 50.00G 45.00G 5.00G +/dev/sdc myvg lvm2 a- 17.15G 17.15G 0 +``` + +如果它是空闲的,使用 `vgreduce` 命令从卷组中删除物理卷 `/dev/sdc`。 + +``` +# vgreduce myvg /dev/sdc +Removed "/dev/sdc" from volume group "vg01" +``` + +最后,运行 `pvremove` 命令从 LVM 配置中删除磁盘。现在,磁盘已经完全从 LVM 中移除,可以用于其他用途。 + +``` +# pvremove /dev/sdc +Labels on physical volume "/dev/sdc" successfully wiped. +``` + +### 移动扩展块到新磁盘 + +如果你在卷组中的其他物理卷上没有足够的可用扩展。使用以下步骤添加新的物理卷。 + +向存储组申请新的 LUN。分配完毕后,运行以下命令来[在 Linux 中发现新添加的 LUN 或磁盘][5]。 + +``` +# ls /sys/class/scsi_host +host0 +``` + +``` +# echo "- - -" > /sys/class/scsi_host/host0/scan +``` + +``` +# fdisk -l +``` + +操作系统中检测到磁盘后,使用 `pvcreate` 命令创建物理卷。 + +``` +# pvcreate /dev/sdd +Physical volume "/dev/sdd" successfully created +``` + +使用以下命令将新的物理卷 `/dev/sdd` 添加到现有卷组 `vg01` 中。 + +``` +# vgextend vg01 /dev/sdd +Volume group "vg01" successfully extended +``` + +现在,使用 `pvs` 命令查看你添加的新磁盘 `/dev/sdd`。 + +``` +# pvs -o+pv_used + +PV VG Fmt Attr PSize PFree Used +/dev/sda myvg lvm2 a- 75.00G 14.00G 61.00G +/dev/sdb myvg lvm2 a- 50.00G 45.00G 5.00G +/dev/sdc myvg lvm2 a- 17.15G 12.15G 5.00G +/dev/sdd myvg lvm2 a- 60.00G 60.00G 0 +``` + +使用 `pvmove` 命令将数据从 `/dev/sdc` 移动到 `/dev/sdd`。 + +``` +# pvmove /dev/sdc /dev/sdd + +/dev/sdc: Moved: 10.0% +… +/dev/sdc: Moved: 79.7% +… +/dev/sdc: Moved: 100.0% +``` + +数据移动到新磁盘后。再次使用 `pvs` 命令检查物理卷是否空闲。 + +``` +# pvs -o+pv_used + +PV VG Fmt Attr PSize PFree Used +/dev/sda myvg lvm2 a- 75.00G 14.00G 61.00G +/dev/sdb myvg lvm2 a- 50.00G 45.00G 5.00G +/dev/sdc myvg lvm2 a- 17.15G 17.15G 0 +/dev/sdd myvg lvm2 a- 60.00G 47.85G 12.15G +``` + +如果空闲,使用 `vgreduce` 命令从卷组中删除物理卷 `/dev/sdc`。 + +``` +# vgreduce myvg /dev/sdc +Removed "/dev/sdc" from volume group "vg01" +``` + +最后,运行 `pvremove` 命令从 LVM 配置中删除磁盘。现在,磁盘已经完全从 LVM 中移除,可以用于其他用途。 + +``` +# pvremove /dev/sdc +Labels on physical volume "/dev/sdc" successfully wiped. +``` + +-------------------------------------------------------------------------------- + +via: https://www.2daygeek.com/linux-remove-delete-physical-volume-pv-from-volume-group-vg-in-lvm/ + +作者:[Magesh Maruthamuthu][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://www.2daygeek.com/author/magesh/ +[b]: https://github.com/lujun9972 +[1]: https://linux.cn/article-12670-1.html +[2]: https://linux.cn/article-12673-1.html +[3]: https://linux.cn/article-12740-1.html +[4]: https://www.2daygeek.com/wp-content/uploads/2020/10/remove-delete-physical-volume-pv-from-volume-group-vg-lvm-linux-2.png +[5]: https://www.2daygeek.com/scan-detect-luns-scsi-disks-on-redhat-centos-oracle-linux/ diff --git a/published/202010/20201010 6 Essential Things To Do After Installing Manjaro Linux.md b/published/202010/20201010 6 Essential Things To Do After Installing Manjaro Linux.md new file mode 100644 index 0000000000..9f4147f6c6 --- /dev/null +++ b/published/202010/20201010 6 Essential Things To Do After Installing Manjaro Linux.md @@ -0,0 +1,136 @@ +[#]: collector: (lujun9972) +[#]: translator: (rakino) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12721-1.html) +[#]: subject: (6 Essential Things To Do After Installing Manjaro Linux) +[#]: via: (https://itsfoss.com/things-to-do-after-installing-manjaro/) +[#]: author: (Dimitrios Savvopoulos https://itsfoss.com/author/dimitrios/) + +安装 Manjaro Linux 后必做的 6 件事 +====== + +你刚刚[全新安装了 Manjaro Linux][1],那么现在该做什么呢? + +下面是我推荐你在安装后进行的一些必不可少的步骤。 + +不过说实话,这些都是我在安装 Manjaro 后喜欢做的事,根据你的需求,步骤可能会有所不同。 + +### 推荐在安装完 Manjaro Linux 后去做的事 + +![][2] + +我使用的是 Xfce 版的 Manjaro,但这些步骤也适用于 [Manjaro][3] 的其它桌面环境版本。 + +#### 1、设置最快的镜像 + +在更新系统之前,我建议先整理一下镜像列表。在刷新 Manjaro 系统和从软件仓库下载软件包的时候,优化后的镜像列表会对系统的性能产生明显的影响。 + +打开终端模拟器并输入以下命令: + +``` +sudo pacman-mirrors --fasttrack +``` + +![][4] + +#### 2、更新系统 + +保持系统更新可以降低安全漏洞的发生机率,在安装新的软件之前也建议刷新一下系统的软件仓库。 + +你可以用下面的命令来[更新 Manjaro 系统][5]: + +``` +sudo pacman -Syu +``` + +![][6] + +#### 3、启用 AUR、Snap 以及 Flatpak 支持 + +[Arch 用户仓库Arch User Repository(AUR)][7]是用户选择[基于 Arch Linux 的系统][8]的一个主要理由。你可以在 AUR 中访问到大量的附加软件。 + +(LCTT 译注:AUR 中的 PKGBUILD 均为用户上传且未经审核,使用者需要自负责任,在构建软件包前请注意检查其中内容是否合理。) + +作为可选项,你可以直接在 Pacman 图形化软件包管理器中启用对 [Snap][9] 以及 [Flatpak][10] 的支持。 + +![][11] + +#### 启用 TRIM(仅 SSD) + +如果你的根分区已经安装在了 SSD 上,启用 [TRIM][12] 会是你在安装 Manjaro 后需要做的一件事。TRIM 会帮助清理 SSD 中的块,从而延长 SSD 的使用寿命。 + +要在 Manjaro 中启用 TRIM,请在终端中输入以下命令: + +``` +sudo systemctl enable fstrim.timer +``` + +![][13] + +#### 5、安装内核(高级用户) + +我在 [Manjaro 评测][14]中提到的一个话题就是,你可以在图形界面中轻易地更换内核。 + +喜欢使用命令行?你也可以在终端中列出系统中已安装的内核以及安装新的内核。 + +列出已安装的内核: + +``` +mhwd-kernel -li +``` + +安装新内核(以最新的 5.8 版本内核为例): + +``` +sudo mhwd-kernel -i linux58 +``` + +![][15] + +#### 6、安装微软 TrueType 字体(如果需要) + +我经常在个人电脑上编辑工作文件,因此我需要 Times New Roman 或 Arial 等微软字体。 + +如果你也需要使用微软字体,可以从 [AUR][7] 中取得这个[软件包][16]。如果你想要在命令行中管理 AUR 软件包,可以选择安装一个 [AUR 助手][17]。 + +![][18] + +### 结论 + +如果你想在一个预配置、为桌面优化的发行版上享受 Arch Linux 的优点,[Manjaro 是一个很好的发行版][19]。虽然它预置了很多东西,但由于每个人设置和需求的不同,有几个步骤是不能提前完成的。 + +除开已经提到的步骤,还有哪一步对你来说是必不可少的?请在下面的评论中告诉我们。 + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/things-to-do-after-installing-manjaro/ + +作者:[Dimitrios Savvopoulos][a] +选题:[lujun9972][b] +译者:[rakino](https://github.com/rakino) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://itsfoss.com/author/dimitrios/ +[b]: https://github.com/lujun9972 +[1]: https://itsfoss.com/install-manjaro-linux/ +[2]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/10/things-to-do-after-installing-manjaro.jpg?resize=800%2C450&ssl=1 +[3]: https://manjaro.org +[4]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/08/manjaro-fasttrack.png?resize=800%2C600&ssl=1 +[5]: https://itsfoss.com/update-arch-linux/ +[6]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/03/sudo-pacman-Syu.png?resize=800%2C504&ssl=1 +[7]: https://itsfoss.com/aur-arch-linux/ +[8]: https://itsfoss.com/arch-based-linux-distros/ +[9]: https://itsfoss.com/use-snap-packages-ubuntu-16-04/ +[10]: https://itsfoss.com/flatpak-guide/ +[11]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/08/pamac-2.png?resize=800%2C600&ssl=1 +[12]: https://en.wikipedia.org/wiki/Trim_(computing) +[13]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/08/fstrim.timer_.png?resize=800%2C600&ssl=1 +[14]: https://itsfoss.com/manjaro-linux-review/ +[15]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/08/manjaro-cli-kernels.png?resize=800%2C600&ssl=1 +[16]: https://aur.archlinux.org/packages/ttf-ms-fonts +[17]: https://itsfoss.com/best-aur-helpers/ +[18]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/08/ttf-ms-fonts.png?resize=800%2C600&ssl=1 +[19]: https://itsfoss.com/why-use-manjaro-linux/ diff --git a/published/202010/20201012 Could Microsoft be en route to dumping Windows in favor of Linux.md b/published/202010/20201012 Could Microsoft be en route to dumping Windows in favor of Linux.md new file mode 100644 index 0000000000..db061a927a --- /dev/null +++ b/published/202010/20201012 Could Microsoft be en route to dumping Windows in favor of Linux.md @@ -0,0 +1,88 @@ +[#]: collector: (wxy) +[#]: translator: (gxlct008) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12718-1.html) +[#]: subject: (Could Microsoft be en route to dumping Windows in favor of Linux?) +[#]: via: (https://www.techrepublic.com/article/could-microsoft-be-en-route-to-dumping-windows-in-favor-of-linux/) +[#]: author: (Jack Wallen https://www.techrepublic.com/meet-the-team/us/jack-wallen/) + +微软能否放弃 Windows 转向 Linux? +====== + +> Jack Wallen 认为,Microsoft Linux 是 Microsoft 桌面操作系统的下一个演进方向。他解释了为什么这将是一个对 Microsoft、IT 专业人士、用户和 Linux 社区的双赢。 + +![](https://tr1.cbsistatic.com/hub/i/r/2014/08/20/123daeb8-d6ce-4f0b-986e-225d55bf12e3/resize/770x/a693d56694587dbe5d025db7b8d79c48/linux-and-windows.jpg) + +我尊敬的同事 Steven J. Vaughan-Nichols 在姊妹网站 ZDNet 上发表了一篇出色的文章,名为《[基于 Linux 的 Windows 非常有意义][1]》,他在文中讨论了 Eric S. Raymond 的[观点](https://linux.cn/article-12664-1.html),即我们正接近桌面战争的最后阶段。Vaughan-Nichols 猜测,下一个合乎逻辑的步骤是在 Linux 内核上运行的 Windows 界面。 + +这是有道理的,尤其是考虑到微软在 [Windows 的 Linux 子系统(WSL)][2] 上的努力。然而,从我过去几年所目睹的一切来看,我认为可以得出一个对微软更有意义的结论。 + +### Microsoft Linux: 为什么它是最好的解决方案 + +一度,微软的最大摇钱树是软件,确切地说是 Windows 和 Microsoft Office。但是,就像科技行业中的所有事物一样,进化也在发生,而拒绝进化的科技公司失败了。 + +微软明白这一点,并且它已经进化了。一个恰当的例子是:[Microsoft Azure][4]。微软的云计算服务,以及 [AWS][5] 和 [Google Cloud][6] 已经成为这个不断变化的行业的巨大推动力。Azure 已成为微软新世界的摇钱树 —— 多到以至于这家在桌面电脑市场上享有垄断地位的公司已经开始意识到,或许还有更好的方式来利用桌面计算机。 + +这种优势很容易通过 Linux 来实现,但不是你可能想到的 Linux。Vaughan-Nichols 所建议的 Microsoft Linux 对于微软来说可能是一个很好的垫脚石,但我相信该公司需要做出一个更大的飞跃。我说的是登月规模的飞跃 —— 这将使所有参与者的生活变得更加轻松。 + +我说的是深入 Linux 领域。忘掉在 Linux 内核上运行 [Windows 10][7] 界面的桌面版本吧,最后承认 Microsoft Linux 可能是当今世界的最佳解决方案。 + +微软发布一个完整的 Linux 发行版将对所有参与者来说意味着更少的挫败感。微软可以将其在 Windows 10 桌面系统上的开发工作转移到一个更稳定、更可靠、更灵活、更经考验的桌面系统上来。微软可以从任意数量的桌面系统中选择自己的官方风格:GNOME、KDE、Pantheon、Xfce、Mint、Cinnamon... 不胜枚举。微软可以按原样使用桌面,也可以为它们做出贡献,创造一些更符合用户习惯的东西。 + +### 开发:微软并没有摆脱困境 + +这并不意味着微软在开发方面将摆脱困境。微软也希望对 Wine 做出重大贡献,以确保其所有产品均可在兼容层上顺畅运行,并且默认集成到操作系统中,这样最终用户就不必为安装 Windows 应用程序做任何额外的工作。 + +### Windows 用户需要 Defender + +微软开发团队也希望将 Windows Defender 移植到这个新的发行版中。等一等。什么?我真的是在暗示 Microsoft Linux 需要 Windows Defender 吗?是的,我确定。为什么? + +最终用户仍然需要防范 [网络钓鱼][8] 诈骗phishing scams、恶意 URL 和其他类型的攻击。普通的 Windows 用户可能不会意识到,Linux 和安全使用实践的结合远比 Windows 10 和 Windows Defender 要安全得多。所以,是的,将 Windows Defender 移植到 Microsoft Linux 将是保持用户基础舒适的一个很好的步骤。 + +这些用户将很快了解在台式计算机上工作的感觉,而不必处理 Windows 操作系统带来的日常困扰。更新更流畅、更值得信赖、更安全,桌面更有意义。 + +### 微软、用户和 IT 专业人士的双赢 + +微软一直在尽其所能将用户从标准的基于客户端的软件迁移到云和其他托管解决方案,并且其软件摇钱树已经变成了以网络为中心和基于订阅的软件。所有这些 Linux 用户仍然可以使用 [Microsoft 365][10] 和它必须提供的任何其他 [软件即服务][11]Software as a Service(SaaS)解决方案——所有这些都来自于 Linux 操作系统的舒适性和安全性。 + +这对微软和消费者而言是双赢的,因为这样 Windows 没有那么多令人头疼的事情要处理(通过捕获漏洞和对其专有解决方案进行安全补丁),消费者可以得到一个更可靠的解决方案而不会错过任何东西。 +如果微软打对了牌,他们可以对 KDE 或几乎任何 Linux 桌面环境重新设置主题,使其与 Windows 10 界面没有太大区别。 + +如果布局得当,消费者甚至可能都不知道其中的区别——“Windows 11” 将仅仅是 Microsoft 桌面操作系统的下一个演进版本。 + +说到胜利,IT 专业人员将花费更少的时间来处理病毒、恶意软件和操作系统问题,而把更多的时间用于保持网络(以及为该网络供动力的服务器)的运行和安全上。 + +### 大卖场怎么办? + +这是个关键的地方。为了让这一做法真正发挥作用,微软将不得不完全放弃 Windows,转而使用自己风格的 Linux。基于同样的思路,微软需要确保大卖场里的 PC 都安装了 Microsoft Linux 系统。没有半途而废的余地——微软必须全力以赴,以确保这次转型的成功。 + +一旦大卖场开始销售安装了 Microsoft Linux 的 PC 和笔记本电脑,我预测这一举措对所有相关人员来说将会是一个巨大的成功。微软会被视为终于推出了一款值得消费者信赖的操作系统;消费者将拥有一个这样的桌面操作系统,它不会带来太多令人头疼的事情,而会带来真正的生产力和乐趣;Linux 社区最终将主导桌面计算机。 + +### Microsoft Linux:时机已到 + +你可能会认为这个想法很疯狂,但如果你真的仔细想想,微软 Windows 的演进就是朝着这个方向发展的。为什么不绕过这个时间线的中途部分,而直接跳到一个为所有参与者带来成功的终极游戏呢? Microsoft Linux 正当其时。 + +--- +via: https://www.techrepublic.com/article/could-microsoft-be-en-route-to-dumping-windows-in-favor-of-linux/ + +作者:[jack-wallen][a] +选题:[wxy][b] +译者:[gxlct008](https://github.com/gxlct008) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://www.techrepublic.com/meet-the-team/us/jack-wallen/ +[b]: https://github.com/wxy +[1]: https://www.zdnet.com/article/linux-based-windows-makes-perfect-sense/ +[2]: https://www.techrepublic.com/article/microsoft-older-windows-10-versions-now-get-to-run-windows-subsystem-for-linux-2/ +[3]: https://www.techrepublic.com/resource-library/whitepapers/microsoft-build-2020-highlights/ +[4]: https://www.techrepublic.com/article/microsoft-azure-the-smart-persons-guide/ +[5]: https://www.techrepublic.com/article/amazon-web-services-the-smart-persons-guide/ +[6]: https://www.techrepublic.com/article/google-cloud-platform-the-smart-persons-guide/ +[7]: https://www.techrepublic.com/article/windows-10-the-smart-persons-guide/ +[8]: https://www.techrepublic.com/article/phishing-and-spearphishing-a-cheat-sheet/ +[9]: https://www.techrepublic.com/article/everything-a-linux-admin-needs-to-know-about-working-from-the-command-line/ +[10]: https://www.techrepublic.com/article/microsoft-365-a-cheat-sheet/ +[11]: https://www.techrepublic.com/article/software-as-a-service-saas-a-cheat-sheet/ diff --git a/published/202010/20201012 Linux Jargon Buster- What is Display Manager in Linux.md b/published/202010/20201012 Linux Jargon Buster- What is Display Manager in Linux.md new file mode 100644 index 0000000000..2aef0b010f --- /dev/null +++ b/published/202010/20201012 Linux Jargon Buster- What is Display Manager in Linux.md @@ -0,0 +1,101 @@ +[#]: collector: (lujun9972) +[#]: translator: (wxy) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12773-1.html) +[#]: subject: (Linux Jargon Buster: What is Display Manager in Linux?) +[#]: via: (https://itsfoss.com/display-manager/) +[#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/) + +Linux 黑话解释:什么是显示管理器? +====== + +> 在这篇 Linux 黑话解释中,你将了解 Linux 中的显示管理器。它是桌面环境的一部分吗?它的作用是什么? + +### 什么是 Linux 中的显示管理器? + +简单来说,显示管理器display manager(DM)是一个为你的 Linux 发行版提供图形登录功能的程序。它控制用户会话并管理用户认证。显示管理器会在你输入用户名和密码后,立即启动[显示服务器][1]并加载[桌面环境][2]。 + +显示管理器通常是登录界面的代名词。毕竟它是可见的部分。然而,可见的登录屏幕,也叫欢迎页greeter,只是显示管理器的一部分。 + +![登录屏幕是显示管理器的可见部分][3] + +像[各种桌面环境][4]和显示服务器一样,也有各种显示管理器。我们来看看它们。 + +### 不同的显示管理器 + +有些人认为显示管理器是桌面环境的一部分,但事实并非如此。它是一个独立的程序。 + +桌面环境可能会推荐某个显示管理器,但这并不意味着它不能与其它一些显示管理器一起工作。如果你曾经在同一个系统中安装过不止一个桌面环境,你会记得,登录界面(即显示管理器)允许你切换桌面环境。 + +![显示管理器可以与各种桌面环境配合使用][5] + +虽然显示管理器不是桌面环境本身的一部分,但它往往与桌面环境由同一个开发团队开发。它也成为桌面环境的代表。 + +例如,GNOME 桌面环境开发了 GDM(GNOME Display Manager),光看登录界面就会想到 GNOME 桌面环境。 + +![GNOME登录屏幕与GDM][6] + +一些流行的显示管理器有: + + * [GDM][7](GNOME 显示管理器GNOME Display Manager):GNOME 的首选。 + * [SDDM][8](简单桌面显示管理器Simple Desktop Display Manager):KDE 首选。 + * LightDM:由 Ubuntu 为 Unity 桌面开发。 + +### 显示管理器可以定制 + +有这么多的桌面环境可供选择,它们都有自己的显示管理器吗?不,不是这样的。 + +正如我之前提到的,可见的登录屏幕被称为欢迎页。这个欢迎页可以进行自定义来改变登录屏幕的外观。 + +事实上,许多发行版和/或桌面环境都制作了自己的欢迎页,以给用户提供一个类似于他们品牌的登录屏幕。 + +例如,Mint 的 Cinnamon 桌面使用了 LightDM,但有自己的欢迎页来给它更多的 Mint 式(或者我应该说是 Cinnamon)的外观。 + +![基于 LightDM 的 Linux Mint 登录屏幕][9] + +来看看 Kali Linux 的登录界面: + +![Kali Linux 登录界面][10] + +如果你喜欢编码和调整,你可以根据自己的喜好修改或编码自己的欢迎页。 + +### 改变显示管理器 + +如果你愿意,可以[更改显示管理器][11]。你需要先安装显示管理器。安装时你会看到切换显示管理器的选项。 + +![][12] + +如果当时没有做切换,那么以后可以通过手动配置来改变显示管理器。不同的发行版重新配置显示管理器的方法略有不同,这不在本文讨论范围内。 + +### 结语 + +希望大家对 Linux 中的显示管理器这个术语有一点了解。本黑话解释系列的目的是用非技术性的语言解释常见的 Linux 俗语和技术术语,而不涉及太多的细节。 + +欢迎大家提出意见和建议。 + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/display-manager/ + +作者:[Abhishek Prakash][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://itsfoss.com/author/abhishek/ +[b]: https://github.com/lujun9972 +[1]: https://itsfoss.com/display-server/ +[2]: https://itsfoss.com/what-is-desktop-environment/ +[3]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2018/05/login-screen-opensuse.jpg?resize=800%2C474&ssl=1 +[4]: https://itsfoss.com/best-linux-desktop-environments/ +[5]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/10/deepin-session-ubuntu.jpg?resize=800%2C414&ssl=1 +[6]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/06/Login-screen-1.png?resize=800%2C450&ssl=1 +[7]: https://wiki.gnome.org/Projects/GDM +[8]: https://github.com/sddm +[9]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/10/linux-mint-login-screen.jpg?resize=800%2C418&ssl=1 +[10]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/10/kali-linux-login-screen.jpg?resize=799%2C450&ssl=1 +[11]: https://itsfoss.com/switch-gdm-and-lightdm-in-ubuntu-14-04/ +[12]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2014/06/Switch_between_gdm_and_lightgdm_Ubuntu.jpeg?resize=700%2C448&ssl=1 diff --git a/published/202010/20201013 Install MariaDB or MySQL on Linux.md b/published/202010/20201013 Install MariaDB or MySQL on Linux.md new file mode 100644 index 0000000000..62bd23b48e --- /dev/null +++ b/published/202010/20201013 Install MariaDB or MySQL on Linux.md @@ -0,0 +1,112 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12743-1.html) +[#]: subject: (Install MariaDB or MySQL on Linux) +[#]: via: (https://opensource.com/article/20/10/mariadb-mysql-linux) +[#]: author: (Seth Kenlon https://opensource.com/users/seth) + +在 Linux 上安装 MariaDB 或 MySQL +====== + +> 开始在 Linux 系统上使用开源的 SQL 数据库吧。 + +![](https://img.linux.net.cn/data/attachment/album/202010/22/144122hkkqrs2dhi9c7kif.jpg) + +[MariaDB][2] 和 [MySQL][3] 都是使用 SQL 的开源数据库,并且共享相同的初始代码库。MariaDB 是 MySQL 的替代品,你可以使用相同的命令(`mysql`)与 MySQL 和 MariaDB 数据库进行交互。因此,本文同时适用于 MariaDB 和 MySQL。 + +### 安装 MariaDB + +你可以使用你的 Linux 发行版的包管理器安装 MariaDB。在大多数发行版上,MariaDB 分为服务器包和客户端包。服务器包提供了数据库“引擎”,即 MariaDB 在后台运行(通常在物理服务器上)的部分,它监听数据输入或数据输出请求。客户端包提供了 `mysql` 命令,你可以用它来与服务器通信。 + +在 RHEL、Fedora、CentOS 或类似的发行版上: + +``` +$ sudo dnf install mariadb mariadb-server +``` + +在 Debian、Ubuntu、Elementary 或类似的发行版上: + +``` +$ sudo apt install mariadb-client mariadb-server +``` + +其他操作系统可能会以不同的打包系统封装 MariaDB,所以你可能需要搜索你的软件仓库来了解你的发行版的维护者是如何提供它的。 + +### 启动 MariaDB + +因为 MariaDB 被设计为部分作为数据库服务器,它可以在一台计算机上运行,并从另一台计算机上进行管理。只要你能访问运行它的计算机,你就可以使用 `mysql` 命令来管理数据库。在写这篇文章时,我在本地计算机上运行了 MariaDB,但你同样可与远程系统上托管的 MariaDB 数据库进行交互。 + +在启动 MariaDB 之前,你必须创建一个初始数据库。在初始化其文件结构时,你应该定义你希望 MariaDB 使用的用户。默认情况下,MariaDB 使用当前用户,但你可能希望它使用一个专用的用户帐户。你的包管理器可能为你配置了一个系统用户和组。使用 `grep` 查找是否有一个 `mysql` 组: + +``` +$ grep mysql /etc/group +mysql:x:27: +``` + +你也可以在 `/etc/passwd` 中寻找这个专门的用户,但通常情况下,有组就会有用户。如果没有专门的 `mysql` 用户和组,可以在 `/etc/group` 中寻找一个明显的替代品(比如 `mariadb`)。如果没有,请阅读你的发行版文档来了解 MariaDB 是如何运行的。 + +假设你的安装使用 `mysql`,初始化数据库环境: + +``` +$ sudo mysql_install_db --user=mysql +Installing MariaDB/MySQL system tables in '/var/lib/mysql'... +OK +[...] +``` + +这一步的结果显示了接下来你必须执行的配置 MariaDB 的任务: + +``` +PLEASE REMEMBER TO SET A PASSWORD FOR THE MariaDB root USER ! +To do so, start the server, then issue the following commands: + +'/usr/bin/mysqladmin' -u root password 'new-password' +'/usr/bin/mysqladmin' -u root -h $(hostname) password 'new-password' + +Alternatively you can run: +'/usr/bin/mysql_secure_installation' + +which will also give you the option of removing the test +databases and anonymous user created by default.  This is +strongly recommended for production servers. +``` + +使用你的发行版的初始化系统启动 MariaDB: + +``` +$ sudo systemctl start mariadb +``` + +在启动时启用 MariaDB 服务器: + +``` +$ sudo systemctl enable --now mariadb +``` + +现在你已经有了一个 MariaDB 服务器,为它设置一个密码: + +``` +mysqladmin -u root password 'myreallysecurepassphrase' +mysqladmin -u root -h $(hostname) password 'myreallysecurepassphrase' +``` + +最后,如果你打算在生产服务器上使用它,请在上线前运行 `mysql_secure_installation` 命令。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/10/mariadb-mysql-linux + +作者:[Seth Kenlon][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/seth +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/data_metrics_analytics_desktop_laptop.png?itok=9QXd7AUr (Person standing in front of a giant computer screen with numbers, data) +[2]: https://mariadb.org/ +[3]: https://www.mysql.com/ diff --git a/published/202010/20201014 2 Ways to Download Files From Linux Terminal.md b/published/202010/20201014 2 Ways to Download Files From Linux Terminal.md new file mode 100644 index 0000000000..0fa87fe9f0 --- /dev/null +++ b/published/202010/20201014 2 Ways to Download Files From Linux Terminal.md @@ -0,0 +1,190 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12752-1.html) +[#]: subject: (2 Ways to Download Files From Linux Terminal) +[#]: via: (https://itsfoss.com/download-files-from-linux-terminal/) +[#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/) + +2 种从 Linux 终端下载文件的方法 +====== + +如果你被困在 Linux 终端,比如说在服务器上,如何从终端下载文件? + +在 Linux 中是没有 `download` 命令的,但是有几个 Linux 命令可用于下载文件。 + +在这篇终端技巧中,你将学习两种在 Linux 中使用命令行下载文件的方法。 + +我在这里使用的是 Ubuntu,但除了安装,其余的命令同样适用于所有其他 Linux 发行版。 + +### 使用 wget 命令从 Linux 终端下载文件 + +![][1] + +[wget][2] 也许是 Linux 和类 UNIX 系统中使用最多的命令行下载管理器。你可以使用 `wget` 下载一个文件、多个文件、整个目录甚至整个网站。 + +`wget` 是非交互式的,可以轻松地在后台工作。这意味着你可以很容易地在脚本中使用它,甚至构建像 [uGet 下载管理器][3]这样的工具。 + +让我们看看如何使用 `wget` 从终端下载文件。 + +#### 安装 wget + +大多数 Linux 发行版都预装了 `wget`。它也可以在大多数发行版的仓库中找到,你可以使用发行版的包管理器轻松安装它。 + +在基于 Ubuntu 和 Debian 的发行版上,你可以使用 [apt 包管理器][4]命令: + +``` +sudo apt install wget +``` + +#### 使用 wget 下载文件或网页 + +你只需要提供文件或网页的 URL。它将在你所在的目录下以原始名下载该文件。 + +``` +wget URL +``` + +![][5] + +要下载多个文件,你必须将它们的 URL 保存在一个文本文件中,并将该文件作为输入提供给 `wget`,就像这样: + +``` +wget -i download_files.txt +``` + +#### 用 wget 下载不同名字的文件 + +你会注意到,网页在 `wget` 中几乎总是以 `index.html` 的形式保存。为下载的文件提供自定义名称是个好主意。 + +你可以在下载时使用 `-O` (大写字母 `O`) 选项来提供输出文件名: + +``` +wget -O filename URL +``` + +![][6] + +#### 用 wget 下载一个文件夹 + +假设你正在浏览一个 FTP 服务器,你需要下载整个目录,你可以使用递归选项 `-r`: + +``` +wget -r ftp://server-address.com/directory +``` + +#### 使用 wget 下载整个网站 + +是的,你完全可以做到这一点。你可以用 `wget` 镜像整个网站。我说的下载整个网站是指整个面向公众的网站结构。 + +虽然你可以直接使用镜像选项 `-m`,但最好加上: + + * `–convert-links`:链接将被转换,使内部链接指向下载的资源,而不是网站。 + * `–page-requisites`:下载额外的东西,如样式表,使页面在离线状态下看起来更好。 + +``` +wget -m --convert-links --page-requisites website_address +``` + +![][7] + +#### 额外提示:恢复未完成的下载 + +如果你因为某些原因按 `CTRL-C` 键中止了下载,你可以用选项 `-c` 恢复之前的下载: + +``` +wget -c +``` + +### 使用 curl 在 Linux 命令行中下载文件 + +和 `wget` 一样,[curl][8] 也是 Linux 终端中最常用的下载文件的命令之一。[使用 curl][9] 的方法有很多,但我在这里只关注简单的下载。 + +#### 安装 curl + +虽然 `curl` 并不是预装的,但在大多数发行版的官方仓库中都有。你可以使用你的发行版的包管理器来安装它。 + +要[在 Ubuntu][10] 和其他基于 Debian 的发行版上安装 `curl`,请使用以下命令: + +``` +sudo apt install curl +``` + +#### 使用 curl 下载文件或网页 + +如果你在使用 `curl` 命令时没有在 URL 中带任何选项,它就会读取文件并打印在终端上。 + +要在 Linux 终端中使用 `curl` 命令下载文件,你必须使用 `-O`(大写字母 `O`)选项: + +``` +curl -O URL +``` + +![][11] + +在 Linux 中,用 `curl` 下载多个文件是比较简单的。你只需要指定多个 URL 即可: + +``` +curl -O URL1 URL2 URL3 +``` + +请记住,`curl` 不像 `wget` 那么简单。`wget` 可以将网页保存为 `index.html`,`curl` 却会抱怨远程文件没有网页的名字。你必须按照下一节的描述用一个自定义的名字来保存它。 + +#### 用不同的名字下载文件 + +这可能会让人感到困惑,但如果要为下载的文件提供一个自定义的名称(而不是原始名称),你必须使用 `-o`(小写 `O`)选项: + +``` +curl -o filename URL +``` + +![][12] + +有些时候,`curl` 并不能像你期望的那样下载文件,你必须使用选项 `-L`(代表位置)来正确下载。这是因为有些时候,链接会重定向到其他链接,而使用选项 `-L`,它就会跟随最终的链接。 + +#### 用 curl 暂停和恢复下载 + +和 `wget` 一样,你也可以用 `curl` 的 `-c` 选项恢复暂停的下载: + +``` +curl -c URL +``` + +### 总结 + +和以往一样,在 Linux 中做同一件事有多种方法。从终端下载文件也不例外。 + +`wget` 和 `curl` 只是 Linux 中最流行的两个下载文件的命令。还有更多这样的命令行工具。基于终端的网络浏览器,如 [elinks][13]、[w3m][14] 等也可以用于在命令行下载文件。 + +就个人而言,对于一个简单的下载,我更喜欢使用 `wget` 而不是 `curl`。它更简单,也不会让你感到困惑,因为你可能很难理解为什么 `curl` 不能以预期的格式下载文件。 + +欢迎你的反馈和建议。 + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/download-files-from-linux-terminal/ + +作者:[Abhishek Prakash][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://itsfoss.com/author/abhishek/ +[b]: https://github.com/lujun9972 +[1]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/10/Download-Files-from-Linux-terminal.png?resize=800%2C450&ssl=1 +[2]: https://www.gnu.org/software/wget/ +[3]: https://itsfoss.com/install-latest-uget-ubuntu-linux-mint/ +[4]: https://itsfoss.com/apt-command-guide/ +[5]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/10/download-file-in-linux-terminal-using-wget.png?resize=795%2C418&ssl=1 +[6]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/10/download-file-in-linux-terminal-using-wget-2.png?resize=795%2C418&ssl=1 +[7]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/10/download-entire-website-using-wget.png?resize=795%2C418&ssl=1 +[8]: https://curl.haxx.se/ +[9]: https://linuxhandbook.com/curl-command-examples/ +[10]: https://itsfoss.com/install-curl-ubuntu/ +[11]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/10/download-files-in-linux-using-curl.png?resize=795%2C418&ssl=1 +[12]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/10/download-files-in-linux-using-curl-1.png?resize=795%2C418&ssl=1 +[13]: http://elinks.or.cz/ +[14]: http://w3m.sourceforge.net/ diff --git a/published/202010/20201014 MellowPlayer is a Desktop App for Various Streaming Music Services.md b/published/202010/20201014 MellowPlayer is a Desktop App for Various Streaming Music Services.md new file mode 100644 index 0000000000..b9a67ba724 --- /dev/null +++ b/published/202010/20201014 MellowPlayer is a Desktop App for Various Streaming Music Services.md @@ -0,0 +1,92 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12759-1.html) +[#]: subject: (MellowPlayer is a Desktop App for Various Streaming Music Services) +[#]: via: (https://itsfoss.com/mellow-player/) +[#]: author: (Ankush Das https://itsfoss.com/author/ankush/) + +MellowPlayer:一款用于各种流媒体音乐服务的桌面应用 +====== + +> MellowPlayer 是一个自由开源的桌面应用,可以让你在 Linux 和 Windows 上整合基于网络的音乐流媒体服务。 + +![][8] + +毋庸置疑,很多用户都喜欢使用流媒体服务来收听自己喜欢的音乐,而不是从商店购买单首音乐或者下载收藏。 + +当然,流媒体服务可以让你探索新的音乐,帮助艺术家轻松传播到更多的听众。但是,由于有许多的音乐流媒体服务([Soundcloud][1]、[Spotify][2]、[YouTube Music][3]、[Amazon Music][4] 等),因此当在使用电脑时,要有效地使用它们往往会变得很麻烦。 + +你可以[在 Linux 上安装 Spotify][5],但没有 Amazon Music 的桌面应用,所以,有可能你无法从单一门户管理流媒体服务。 + +如果一个桌面应用可以让你同时在 Windows 和 Linux 上免费整合流媒体服务呢?在本文中,我将介绍这样一款应用:[MellowPlayer][6]。 + +### MellowPlayer: 集成各种流媒体音乐服务的开源应用 + +![][7] + +MellowPlayer 是一款自由开源的跨平台桌面应用,它可以让你整合多个流媒体服务,并在一个界面上管理它们。 + +你可以整合多个支持的流媒体服务。你还可以从每个服务中获得一定程度的控制权,来调整你的体验。例如,你可以设置在 YouTube 上自动跳过或静音广告。 + +对 Windows 和 Linux 的跨平台支持绝对是一个加分项。 + +除了能够管理流媒体服务外,它还将播放器与系统托盘整合在一起来轻松控制音乐。这意味着你可以使用键盘上的媒体键来控制音乐播放器。 + +另外值得一提的是,你只要在应用内自己创建一个插件,就可以添加一个官方不支持的新服务。为了让你对它有更多的了解,下面就让我重点介绍一下所有的主要特点。 + +### MellowPlayer 的特点 + + * 跨平台 (Windows 和 Linux) + * 自由且开源 + * 基于插件的应用,让你可以通过创建一个插件来添加新的服务 + * 将服务作为本地桌面应用与系统托盘整合 + * 支持热键 + * 支持通知 + * 收听历史 + +### 在 Linux 上安装 MellowPlayer + +![][9] + +MellowPlayer 是以 [Flatpak 包][10]的形式提供的。我知道这让一些人很失望,但它在 Linux 中只有 Flaptak,Windows 中只有一个可执行文件。如果你不知道,请按照我们的[在 Linux 上使用 Flatpak][11] 指南来开始使用。 + +- [下载 MellowPlayer][12] + +### 总结 + +MellowPlayer 是一款方便的桌面应用,适合经常涉猎多种流媒体音乐服务的用户使用。尽管根据我的测试,它在 SoundCloud、YouTube 和 Spotify 上都能正常工作,但我确实注意到,当我试图重新调整窗口大小时,应用会崩溃,只是在此提醒一下。你可以在它的 [GitLab 页面][13]上了解更多关于它的内容。 + +还有两个类似的应用,可以让你播放多个流媒体音乐服务。[Nuvola][14] 和 [Nuclear Music Player][15]。你可能会想看看它们。 + +你试过 MellowPlayer 吗?欢迎在下方评论中分享你的想法。 + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/mellow-player/ + +作者:[Ankush Das][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://itsfoss.com/author/ankush/ +[b]: https://github.com/lujun9972 +[1]: https://soundcloud.com +[2]: https://www.spotify.com +[3]: https://music.youtube.com +[4]: https://music.amazon.com/home +[5]: https://itsfoss.com/install-spotify-ubuntu-linux/ +[6]: https://colinduquesnoy.gitlab.io/MellowPlayer/ +[7]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/10/mellowplayer-screenshot.jpg?resize=800%2C439&ssl=1 +[8]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/10/mellowplayer.png?resize=800%2C442&ssl=1 +[9]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/10/mellowplayer-system-integration.jpg?resize=800%2C438&ssl=1 +[10]: https://flathub.org/apps/details/com.gitlab.ColinDuquesnoy.MellowPlayer +[11]: https://itsfoss.com/flatpak-guide/ +[12]: https://colinduquesnoy.gitlab.io/MellowPlayer/#features +[13]: https://gitlab.com/ColinDuquesnoy/MellowPlayer +[14]: https://itsfoss.com/nuvola-music-player/ +[15]: https://itsfoss.com/nuclear-music-player-linux/ diff --git a/published/202010/20201014 Try Linux on any computer with this bootable USB tool.md b/published/202010/20201014 Try Linux on any computer with this bootable USB tool.md new file mode 100644 index 0000000000..9e72c9dab8 --- /dev/null +++ b/published/202010/20201014 Try Linux on any computer with this bootable USB tool.md @@ -0,0 +1,95 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12769-1.html) +[#]: subject: (Try Linux on any computer with this bootable USB tool) +[#]: via: (https://opensource.com/article/20/10/fedora-media-writer) +[#]: author: (Sumantro Mukherjee https://opensource.com/users/sumantro) + +用这个创建可引导 USB 的工具在电脑上尝试 Linux +====== + +> Fedora Media Writer 是创建临场版 USB 以尝试 Linux 的方便方法。 + +![](https://img.linux.net.cn/data/attachment/album/202010/30/122142c1cmcv7cxgjmw5vw.jpg) + +[Fedora Media Writer][2] 是一个小巧、轻量、全面的工具,它简化了 Linux 的入门体验。它可以下载 Fedora 的 Workstation 或 Server 版本并写入到一个可以在任何系统上引导的 USB 驱动器上,使你无需将其安装到硬盘上就可以试用 Fedora Linux。 + +Media Writer 工具可以用来创建一个临场体验的Live、可引导的 USB 驱动器。在你的平台上安装 Fedora Media Writer 应用后,你可以下载并烧录最新的 Fedora Workstation 或 Server 稳定版,也可以选择烧录你下载的任何其他镜像。而且它并不局限于英特尔 64 位设备。它还可以用于 ARM 设备,如[树莓派][3],这些设备日益变得更加强大和有用。 + +![Fedora Media Writer main screen][4] + +### 安装 Fedora Media Writer + +[安装 Fedora Media Writer][6] 有几种方式。你可以通过 GitHub [从源码编译][7]、下载 MacOS 或 Windows 版本、使用 `dnf` 或 `yum` 安装 RPM 包,或者以 Flatpak 的形式获得。 + +在 Fedora 上: + +``` +$ sudo dnf install mediawriter +``` + +最新版本请参见 GitHub 仓库的[发布][8]部分。 + +### 准备好你的媒体介质 + +首先,你需要一个 USB 驱动器来安装你的 Linux 操作系统。这就是 Fedora Media Writer 要烧录的设备。这个驱动器必须是空白或可擦除的,因为 **该 USB 驱动器上的所有数据都会被删除**。如果有任何数据,哪怕只是一个文件,如果你不想丢失,那么你必须在继续之前备份它! + +确认你的 USB 驱动器是可擦除的之后,将它插入你的电脑并启动 Fedora Media Writer。 + +### 使用 Fedora Media Writer + +当你启动 Fedora Media Writer 时,你会看到一个页面,提示你从互联网上获取一个可引导的镜像,或者从你的硬盘上加载一个自定义镜像。第一个选择是 Fedora 的最新版本。Workstation 版本适用于台式机和笔记本电脑,Server 版本适用于虚拟化、机架服务器或任何你想作为服务器运行的情况。 + +如果你选择了 Fedora 镜像,Media Writer 会下载一个光盘镜像(通常称为 “iso”,文件扩展名为 .iso),并将其保存到你的下载文件夹中,这样你就可以重复使用它来烧录另一个驱动器。 + +![Select your image][9] + +另外还有 Fedora Spins,这是来自 Fedora 社区的镜像,它旨在满足小众的兴趣。例如,如果你是 [MATE 桌面][10]的粉丝,那么你会很高兴地发现 Media Writer 提供了 MATE spin。它有很多,所以请滚动查看所有的选择。如果你是 Linux 的新手,不要被吓到或感到困惑:这些额外的选项是为老用户准备的,这些用户除了默认的选项外,还发展出了自己的偏好,所以对你来说,只使用 Workstation 或 Server 选项就行,这取决于你是想把 Fedora 作为一个桌面还是作为一个服务器操作系统来运行。 + +如果你需要一个与你当前使用的 CPU 不同架构的镜像,从窗口右上角的下拉菜单中选择 CPU 架构。 + +如果你已经将镜像保存在硬盘上,请选择“Custom Image”选项,并选择你要烧录到 USB 的发行版的 .iso 文件。 + +### 写入 USB 驱动器 + +当你下载或选择了一个镜像,你必须确认你要将该镜像写入驱动器。 + +驱动器选择下拉菜单只显示了外部驱动器,所以你不会意外地覆盖自己的硬盘驱动器。这是 Fedora Media Writer 的一个重要功能,它比你在网上看到的许多手动说明要安全得多。然而,如果你的计算机上连接了多个外部驱动器,除了你想覆盖的那个,你应该将它们全部移除,以增加安全性。 + +选择你要安装镜像的驱动器,然后单击“Write to Disk”按钮。 + +![Media write][11] + +稍等一会儿,镜像就会被写入到你的驱动器,然后可以看看 Don Watkins 对[如何从 USB 驱动器启动到 Linux][12]的出色介绍。 + +### 开始使用 Linux + +Fedora Media Writer 是一种将 Fedora Workstation 或 Server,或任何 Linux 发行版烧录到 USB 驱动器的方法,因此你可以在安装它到设备上之前试用它。试试吧,并在评论中分享你的经验和问题。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/10/fedora-media-writer + +作者:[Sumantro Mukherjee][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/sumantro +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/usb-hardware.png?itok=ROPtNZ5V (Multiple USB plugs in different colors) +[2]: https://github.com/FedoraQt/MediaWriter +[3]: https://fedoraproject.org/wiki/Architectures/ARM/Raspberry_Pi +[4]: https://opensource.com/sites/default/files/uploads/fmw_mainscreen.png (Fedora Media Writer main screen) +[5]: https://creativecommons.org/licenses/by-sa/4.0/ +[6]: https://docs.fedoraproject.org/en-US/fedora/f32/install-guide/install/Preparing_for_Installation/#_fedora_media_writer +[7]: https://github.com/FedoraQt/MediaWriter#building +[8]: https://github.com/FedoraQt/MediaWriter/releases +[9]: https://opensource.com/sites/default/files/mediawriter-image.png +[10]: https://opensource.com/article/19/12/mate-linux-desktop +[11]: https://opensource.com/sites/default/files/mediawriter-write.png (Media write) +[12]: https://opensource.com/article/20/4/first-linux-computer diff --git a/published/202010/20201016 Set up ZFS on Linux with yum.md b/published/202010/20201016 Set up ZFS on Linux with yum.md new file mode 100644 index 0000000000..1386118d8b --- /dev/null +++ b/published/202010/20201016 Set up ZFS on Linux with yum.md @@ -0,0 +1,122 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12754-1.html) +[#]: subject: (Set up ZFS on Linux with yum) +[#]: via: (https://opensource.com/article/20/10/zfs-dnf) +[#]: author: (Sheng Mao https://opensource.com/users/ivzhh) + +在 Linux 上使用 yum 设置 ZFS +====== + +> 在 Fedora 上使用 yum 仓库来获取最新的 ZFS 特性。 + +![](https://img.linux.net.cn/data/attachment/album/202010/26/103028g9q3v3e391c9b62v.jpg) + +我是一名 Fedora Linux 用户,我每天都会运行 `yum upgrade`。虽然这个习惯使我能够运行所有最新的软件([Fedora 的四个基础][2]之一的 “First” ,它也做到了),但它也会提醒 [ZFS][3] 存储平台和新内核之间的不兼容性。 + +作为一名开发者,有时我需要最新的 ZFS 分支的新特性。例如,ZFS 2.0.0 包含了一个令人兴奋的新功能,它大大[提高了 ZVOL 同步性能][4],这对我这个 KVM 用户来说至关重要。但这意味着,如果我想使用 2.0.0 分支,我必须自己构建 ZFS。 + +起初,我只是在每次内核更新后从它的 Git 仓库中手动编译 ZFS。如果我忘记了,ZFS 就会在下次启动时无法被识别。幸运的是,我很快就学会了如何为 ZFS 设置动态内核模块支持 ([DKMS][5])。然而,这个解决方案并不完美。首先,它没有利用强大的 [yum][6] 系统,而这个系统可以帮助解决依赖关系和升级。此外,使用 `yum` 在你自己的包和上游包之间进行切换是非常容易的。 + +在本文中,我将演示如何设置 `yum` 仓库来打包 ZFS。这个方案有两个步骤: + + 1. 从 ZFS 的 Git 仓库中创建 RPM 包。 + 2. 建立一个 `yum` 仓库来托管这些包。 + +### 创建 RPM 包 + +要创建 RPM 包,你需要安装 RPM 工具链。`yum` 提供了一个组来捆绑安装这些工具: + +``` +sudo dnf group install 'C Development Tools and Libraries' 'RPM Development Tools' +``` + +安装完这些之后,你必须从 ZFS Git 仓库中安装构建 ZFS 所需的所有包。这些包属于三个组: + + 1. [Autotools][7],用于从平台配置中生成构建文件。 + 2. 用于构建 ZFS 内核和用户态工具的库。 + 3. 构建 RPM 包的库。 + +``` +sudo dnf install libtool autoconf automake gettext createrepo \ +    libuuid-devel libblkid-devel openssl-devel libtirpc-devel \ +    lz4-devel libzstd-devel zlib-devel \ +    kernel-devel elfutils-libelf-devel \ +    libaio-devel libattr-devel libudev-devel \ +    python3-devel libffi-devel +``` + +现在你已经准备好创建你自己的包了。 + +### 构建 OpenZFS + +[OpenZFS][8] 提供了优秀的基础设施。要构建它: + + 1. 用 `git` 克隆仓库,并切换到你希望使用的分支/标签。 + 2. 运行 Autotools 生成一个 makefile。 + 3. 运行 `make rpm`,如果一切正常,RPM 文件将被放置在 `build` 文件夹中。 + +``` +$ git clone --branch=zfs-2.0.0-rc3 zfs +$ cd zfs +$ ./autogen.sh +$ ./configure +$ make rpm +``` + +### 建立一个 yum 仓库 + +在 `yum` 中,仓库是一个服务器或本地路径,包括元数据和 RPM 文件。用户设置一个 INI 配置文件,`yum` 命令会自动解析元数据并下载相应的软件包。 + +Fedora 提供了 `createrepo` 工具来设置 `yum` 仓库。首先,创建仓库,并将 ZFS 文件夹中的所有 RPM 文件复制到仓库中。然后运行 `createrepo --update` 将所有的包加入到元数据中。 + +``` +$ sudo mkdir -p /var/lib/zfs.repo +$ sudo createrepo /var/lib/zfs.repo +$ sudo cp *.rpm /var/lib/zfs.repo/ +$ sudo createrepo --update /var/lib/zfs.repo +``` + +在 `/etc/yum.repos.d` 中创建一个新的配置文件来包含仓库路径: + +``` +$ echo \ +"[zfs-local]\\nname=ZFS Local\\nbaseurl=file:///var/lib/zfs.repo\\nenabled=1\\ngpgcheck=0" |\ +sudo tee /etc/yum.repos.d/zfs-local.repo + +$ sudo dnf --repo=zfs-local list available --refresh +``` + +终于完成了!你已经有了一个可以使用的 `yum` 仓库和 ZFS 包。现在你只需要安装它们。 + +``` +$ sudo dnf install zfs +$ sudo /sbin/modprobe zfs +``` + +运行 `sudo zfs version` 来查看你的用户态和内核工具的版本。恭喜!你拥有了 [Fedora 中的 ZFS][9]。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/10/zfs-dnf + +作者:[Sheng Mao][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/ivzhh +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/puzzle_computer_solve_fix_tool.png?itok=U0pH1uwj (Puzzle pieces coming together to form a computer screen) +[2]: https://docs.fedoraproject.org/en-US/project/#_what_is_fedora_all_about +[3]: https://zfsonlinux.org/ +[4]: https://www.phoronix.com/scan.php?page=news_item&px=OpenZFS-3x-Boost-Sync-ZVOL +[5]: https://www.linuxjournal.com/article/6896 +[6]: https://en.wikipedia.org/wiki/Yum_%28software%29 +[7]: https://opensource.com/article/19/7/introduction-gnu-autotools +[8]: https://openzfs.org/wiki/Main_Page +[9]: https://openzfs.github.io/openzfs-docs/Getting%20Started/Fedora.html diff --git a/published/202010/20201027 Fedora 33 is officially here.md b/published/202010/20201027 Fedora 33 is officially here.md new file mode 100644 index 0000000000..f1fa986952 --- /dev/null +++ b/published/202010/20201027 Fedora 33 is officially here.md @@ -0,0 +1,93 @@ +[#]: collector: (lujun9972) +[#]: translator: (wxy) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12764-1.html) +[#]: subject: (Fedora 33 is officially here!) +[#]: via: (https://fedoramagazine.org/announcing-fedora-33/) +[#]: author: (Matthew Miller https://fedoramagazine.org/author/mattdm/) + +Fedora 33 正式发布了 +====== + +![][1] + +> 本文译自 Fedora 官方发布公告。 + +今天,我很兴奋地与大家分享数千名 Fedora 项目贡献者辛勤工作的成果:我们的最新版本 Fedora 33 来了! 这是一个有着很多变化的大版本,但我相信所有这些工作也会让您感到舒适,实现我们的目标:即为您带来最新的稳定、强大、健壮的自由和开源软件,并提供许多易于使用的产品。  + +如果您不想耽误时间,直接体验,现在就去 下载吧,欲了解详情请继续阅读! + +### 找到适合您的 Fedora 风味! + +Fedora Edition 是针对桌面、服务器和云环境中各种“体现”特定用途的目标产品,现在它也适用于物联网。 + +Fedora Workstation 专注于桌面,尤其是面向那些想要“只管去用”的 Linux 操作系统体验的软件开发者。这个版本的特点是 [GNOME 3.38][2],它一如既往地有很多很棒的改进。新增的 Tour 应用可以帮助新用户学习它们的操作方式。和我们所有其他面向桌面的变体一样,Fedora Workstation 现在使用 [BTRFS 作为默认文件系统][3]。这些发布的版本中带来了很多伟大的增强功能,这个先进的文件系统为之奠定了基础。为了您的视觉享受,Fedora 33 Workstation 现在默认提供了一个动画背景(它会基于一天中的时间变化)。 + +Fedora CoreOS 是一个新兴的 Fedora 版本。它是一个自动更新的、最小化的操作系统,用于安全地、大规模地运行容器化工作负载。它提供了几个[更新流][4],可以遵循大致每两周一次的自动更新。目前 **next** 流是基于 Fedora 33 的,**testing** 和 **stable** 流后继也会跟进。您可以从[下载页面][5]中找到关于跟随 **next** 流发布的工件的信息,并在 [Fedora CoreOS 文档][6]中找到关于如何使用这些工件的信息。 + +新晋升为 Edition 状态的 [Fedora IoT][7],为物联网生态系统和边缘计算用例提供了坚实的基础。在许多功能之外,Fedora 33 IoT 还引入了平台抽象安全Platform AbstRaction for SECurity(PARSEC),这是一个开源倡议,以平台无关的方式为硬件安全和加密服务提供了通用 API。 + +当然,我们制作的不仅仅是“官方版本”,还有 [Fedora Spin][8]和 [Lab][9]。[Fedora Spin][8] 和 [Lab][9] 针对不同的受众和用例,包括 [Fedora CompNeuro][10],它为神经科学带来了大量的开源计算建模工具,以及 [KDE Plasma][11] 和 [Xfce][12]等桌面环境。  + +此外,别忘了我们还有备用架构:[ARM AArch64、Power 和 S390x][13]。在 Fedora 33 中提供的新功能,AArch64 用户可以使用 .NET Core 语言进行跨平台开发。我们改进了对 Pine64 设备、NVidia Jetson 64 位平台以及 Rockchip 片上系统(SoC)设备的支持,包括 Rock960、RockPro64 和 Rock64。(不过,有个最新的说明:在其中一些设备上可能会出现启动问题。从现有的 Fedora 32 升级是没问题的。更多信息将在[常见错误][14]页面上公布。) + +我们也很高兴地宣布,Fedora 云镜像和 Fedora CoreOS 将首次与 Fedora 33 一起在亚马逊的 [AWS 市场][15] 中提供。Fedora 云镜像在亚马逊云中已经存在了十多年,您可以通过 AMI ID 或[点击一下][16]来启动我们的官方镜像。该市场提供了获得同样东西的另一种方式,显著扩大了 Fedora 的知名度。这也将使我们的云镜像可以更快地在新的 AWS 区域中可用。特别感谢 David Duncan 让这一切成为现实! + +### 常规改进 + +无论您使用的是哪种版本的 Fedora,您都会得到开源世界提供的最新版本。遵循我们的 [First][17] 原则,我们更新了关键的编程语言和系统库包,包括 Python 3.9、Ruby on Rails 6.0 和 Perl 5.32。在 Fedora KDE 中,我们沿用了 Fedora 32 Workstation 中的工作,默认启用了 EarlyOOM 服务,以改善低内存情况下的用户体验。 + +为了让 Fedora 的默认体验更好,我们将 nano 设置为默认编辑器。nano 是一个对新用户友好的编辑器。当然,那些想要像 vi 这样强大的编辑器的用户可以自己设置默认编辑器。 + +我们很高兴您能试用新版本! 前往 并立即下载它。或者如果您已经在运行 Fedora 操作系统,请按照这个简单的[升级说明][18]进行升级。关于 Fedora 33 新特性的更多信息,请参见[发布说明][19]。 + +### 关于安全启动的说明 + +安全启动Secure Boot是一种安全标准,它确保只有官方签署的操作系统软件才能加载到您的计算机上。这对于防止持久恶意软件非常重要,因为这些恶意软件可能会隐藏在您的计算机固件中,甚至在重新安装操作系统时也能存活。然而,在 [Boot Hole][20] 漏洞发生后,用于签署 Fedora 引导加载器Bootloader软件的加密证书将被撤销,并被新的证书取代。由于这将产生大范围的影响,撤销应该要到 2021 年第二季度或更晚才会广泛推行。 + +然而,一些用户可能已经从其他操作系统或固件更新中收到了这种撤销。在这种情况下,Fedora 将不能在启用了安全启动时进行安装。要说明的是,这不会影响大多数用户。如果它确实影响到了您,您可以暂时禁用安全启动。我们会在大范围的证书撤销之前发布一个用新证书签署的更新,在所有支持的版本上都可以使用,到那时,安全启动应该可以重新启用。 + +### 万一出现问题时…… + +如果您遇到问题,请查看 [Fedora 33 常见错误][14]页面;如果您有疑问,请访问我们的 [Ask Fedora][21] 用户支持平台。 + +### 谢谢大家 + +感谢在这个发布周期中为 Fedora 项目做出贡献的成千上万的人,尤其是那些在疫情大流行期间为使这个版本准时发布而付出额外努力的人。Fedora 是一个社区,很高兴看到我们如此互相支持。 + + +-------------------------------------------------------------------------------- + +via: https://fedoramagazine.org/announcing-fedora-33/ + +作者:[Matthew Miller][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://fedoramagazine.org/author/mattdm/ +[b]: https://github.com/lujun9972 +[1]: https://fedoramagazine.org/wp-content/uploads/2020/10/f33-final-816x345.jpg +[2]: https://www.gnome.org/news/2020/09/gnome-3-38-released/ +[3]: https://fedoramagazine.org/btrfs-coming-to-fedora-33/ +[4]: https://docs.fedoraproject.org/en-US/fedora-coreos/update-streams/ +[5]: https://getfedora.org/en/coreos/download?stream=next +[6]: https://docs.fedoraproject.org/en-US/fedora-coreos/getting-started/ +[7]: https://getfedora.org/iot +[8]: https://spins.fedoraproject.org/ +[9]: https://labs.fedoraproject.org/ +[10]: https://labs.fedoraproject.org/en/comp-neuro/ +[11]: https://spins.fedoraproject.org/en/kde/ +[12]: https://spins.fedoraproject.org/en/xfce/ +[13]: https://alt.fedoraproject.org/alt/ +[14]: https://fedoraproject.org/wiki/Common_F33_bugs +[15]: https://aws.amazon.com/marketplace +[16]: https://getfedora.org/en/coreos/download?tab=cloud_launchable&stream=stable +[17]: https://docs.fedoraproject.org/en-US/project/#_first +[18]: https://docs.fedoraproject.org/en-US/quick-docs/upgrading/ +[19]: https://docs.fedoraproject.org/en-US/fedora/f33/release-notes/ +[20]: https://access.redhat.com/security/vulnerabilities/grub2bootloader +[21]: http://ask.fedoraproject.org diff --git a/published/20201026 7 Git tricks that changed my life.md b/published/20201026 7 Git tricks that changed my life.md new file mode 100644 index 0000000000..e1bfdbfa84 --- /dev/null +++ b/published/20201026 7 Git tricks that changed my life.md @@ -0,0 +1,189 @@ +[#]: collector: (lujun9972) +[#]: translator: (wxy) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12894-1.html) +[#]: subject: (7 Git tricks that changed my life) +[#]: via: (https://opensource.com/article/20/10/advanced-git-tips) +[#]: author: (Rajeev Bera https://opensource.com/users/acompiler) + +改变我使用 Git 工作方式的七个技巧 +====== + +> 这些有用的技巧将改变你使用这个流行的版本控制系统的工作方式。 + +![](https://img.linux.net.cn/data/attachment/album/202012/07/092803d67fa7bttuuj98fb.jpg) + +Git 是目前最常见的版本控制系统之一,无论是私有系统还是公开托管的网站,都在使用它进行各种开发工作。但无论我对 Git 的使用有多熟练,似乎总有一些功能还没有被发现,下面是改变我使用 Git 工作方式的七个技巧。 + +### 1、Git 中的自动更正 + +我们有时都会打错字,但如果启用了 Git 的自动更正功能,就可以让 Git 自动修正打错的子命令。 + +假设你想用 `git status` 检查状态,却不小心输入了 `git stats`。正常情况下,Git 会告诉你 `stats` 不是一条有效的命令: + +``` +$ git stats +git: ‘stats’ is not a git command. See ‘git --help’. + +The most similar command is +status +``` + +为了避免类似的情况发生,请在 Git 配置中启用 Git 自动更正功能: + +``` +$ git config --global help.autocorrect 1 +``` + +如果你希望这个命令只适用于你当前的版本库,请省略 `--global` 选项。 + +这条命令启用了自动更正功能。更深入的教程可以在 [Git Docs][2] 中找到,但尝试一下和上面一样的错误命令,就能很好地了解这个配置的作用: + +``` +$ git stats +git: ‘stats’ is not a git command. See ‘git --help’. +On branch master +Your branch is up to date with ‘origin/master’. + +nothing to commit, working tree clean +``` + +Git 现在不会建议使用其他子命令,而是直接运行最上面的建议,在本例中是 `git status`。 + +### 2、计算你的提交量 + +你需要计算提交数量可能有很多原因。例如,许多开发者通过计算提交数量来判断何时该增加构建版本号,或者只是想了解项目的进展情况。 + +要计算提交数量其实很简单直接,下面是 Git 的命令: + +``` +$ git rev-list --count branch-name +``` + +在上面的命令中,`branch-name` 应该是当前版本库中有效的分支名称: + +``` +$ git rev-list –count master +32 +$ git rev-list –count dev +34 +``` + +### 3、优化你的仓库 + +你的代码仓库不仅对你有价值,对你的组织也有价值。你可以通过一些简单的做法来保持你的版本库的清洁和更新。其中一个最好的做法是 [使用 .gitignore 文件][3]。使用这个文件,就是告诉 Git 不要存储许多不需要的文件,比如二进制文件、临时文件等等。 + +为了进一步优化你的版本库,你可以使用 Git 的垃圾收集功能: + +``` +$ git gc --prune=now --aggressive +``` + +当你或你的团队大量使用 `pull` 或 `push` 命令时,这条命令就会起到帮助作用。 + +这个命令是一个内部工具,可以清理仓库中无法访问或 “孤儿” Git 对象。 + +### 4、备份未被跟踪的文件 + +大多数时候,删除所有未被跟踪的文件是安全的。不过很多时候,你不仅要删除,还要为你的未跟踪文件创建一个备份,以备以后需要。 + +通过 Git 和一些 Bash 命令管道,可以很容易地为你的未被跟踪的文件创建一个压缩包: + +``` +$ git ls-files --others --exclude-standard -z |\ +xargs -0 tar rvf ~/backup-untracked.zip +``` + +上面的命令制作了一个名为 `backup-untracked.zip` 的存档(并排除了 `.gitignore` 中列出的文件)。 + +### 5、了解你的 .git 文件夹 + +每个版本库都有一个 `.git` 文件夹。它是一个特殊的隐藏文件夹。 + +``` +$ ls -a +. … .git +``` + +Git 的工作主要依赖于两个部分: + + 1. 工作树(你当前签出的文件状态)。 + 2. 你的 Git 仓库的路径(即你的 `.git` 文件夹的位置,其中包含版本信息)。 + +这个文件夹存储了所有的引用和其他重要的细节,比如配置、仓库数据、HEAD 状态、日志等等。 + +如果你删除这个文件夹,你的源代码的当前状态不会被删除,但你的远程信息,如你的项目历史记录,会被删除。删除这个文件夹意味着你的项目(至少是本地副本)不再处于版本控制之下。这意味着你不能跟踪你的变化;你不能从远程拉取或推送。 + +一般来说,不需要在 `.git` 文件夹里做什么,也没有什么应该做的。它是由 Git 管理的,基本上被认为是个禁区。然而,这个目录里有一些有趣的工件,包括 HEAD 的当前状态。 + +``` +$ cat .git/HEAD +ref: refs/heads/master +``` + +它还可能包含对你的存储库的描述: + +``` +$ cat .git/description +``` + +这是一个未命名的仓库,编辑这个 `description` 文件可以命名这个仓库。 + +Git 钩子文件夹(`hooks`)也在这里,里面有一些钩子示例文件。你可以阅读这些示例来了解通过 Git 钩子可以实现什么,你也可以 [阅读 Seth Kenlon 的 Git 钩子介绍][4]。 + +### 6、查看另一个分支的文件 + +有时你想查看另一个分支的文件的内容。用一个简单的 Git 命令就可以实现,而且不需要切换分支。 + +假设你有一个名为 [README.md][5] 的文件,它在 `main` 分支中,而你正在 `dev` 分支上工作。 + +使用下面的 Git 命令,你可以在终端上完成: + +``` +$ git show main:README.md +``` + +一旦你执行了这个命令,你就可以在你的终端上查看文件的内容。 + +### 7、在 Git 中搜索 + +只需一个简单的命令,你就可以像专业人士一样在 Git 中搜索。更棒的是,即使你不确定是在哪个提交或分支上做的修改,也可以在 Git 中搜索。 + +``` +$ git rev-list --all | xargs git grep -F 'string' +``` + +例如,假设你想在你的版本库中搜索 `font-size: 52 px;` 这个字符串: + +``` +$ git rev-list –all | xargs git grep -F 'font-size: 52 px;' +F3022…9e12:HtmlTemplate/style.css: font-size: 52 px; +E9211…8244:RR.Web/Content/style/style.css: font-size: 52 px; +``` + +### 试试这些技巧 + +希望这些高级技巧对你有用,提高你的工作效率,为你节省很多时间。 + +你有喜欢的 [Git 小技巧][6] 吗?在评论中分享吧。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/10/advanced-git-tips + +作者:[Rajeev Bera][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/acompiler +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/browser_screen_windows_files.png?itok=kLTeQUbY (Computer screen with files or windows open) +[2]: https://git-scm.com/book/en/v2/Customizing-Git-Git-Configuration#_code_help_autocorrect_code +[3]: https://linux.cn/article-12524-1.html +[4]: https://opensource.com/life/16/8/how-construct-your-own-git-server-part-6 +[5]: http://README.md +[6]: https://acompiler.com/git-tips/ diff --git a/published/20201030 How to rebase to Fedora 33 on Silverblue.md b/published/20201030 How to rebase to Fedora 33 on Silverblue.md new file mode 100644 index 0000000000..c0c218cd07 --- /dev/null +++ b/published/20201030 How to rebase to Fedora 33 on Silverblue.md @@ -0,0 +1,93 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12880-1.html) +[#]: subject: (How to rebase to Fedora 33 on Silverblue) +[#]: via: (https://fedoramagazine.org/how-to-rebase-to-fedora-33-on-silverblue/) +[#]: author: (Michal Konečný https://fedoramagazine.org/author/zlopez/) + +如何在 Silverblue 上变基到 Fedora 33? +====== + +![](https://img.linux.net.cn/data/attachment/album/202012/02/232440exewdbwdhde4mqhv.jpg) + +Silverblue 是[一个建立在 Fedora 之上的桌面操作系统][2]。它非常适合日常使用、开发和基于容器的工作流程。它提供了[众多的优势][3],例如在出现任何问题时能够回滚。如果你想在你的 Silverblue 系统上更新到 Fedora 33,这篇文章会告诉你如何做。它不仅告诉你该怎么做,还告诉你如果发生了不可预见的事情时该如何回退。 + +在实际做变基到 Fedora 33 之前,你应该应用任何挂起的更新。在终端中输入以下内容: + +``` +$ rpm-ostree update +``` + +或通过 GNOME 软件中心安装更新并重启。 + +### 使用 GNOME 软件中心变基 + +GNOME 软件中心会在更新界面显示有新版本的 Fedora 可用。 + +![Fedora 33 is available][4] + +首先你需要做的是下载新镜像,点击 “Download” 按钮。这将需要一些时间,完成后你会看到更新已经准备好安装了。 + +![Fedora 33 is ready for installation][5] + +点击 “Install” 按钮。这一步只需要几分钟,然后会提示你重启电脑。 + +![Restart is needed to rebase to Fedora 33 Silverblue][6] + +点击 “Restart” 按钮就可以了。重启后,你将进入新的 Fedora 33 版本。很简单,不是吗? + +### 使用终端变基 + +如果你喜欢在终端上做所有的事情,那么接下来的指南就适合你。 + +使用终端变基到 Fedora 33 很简单。首先,检查 33 版本分支是否可用: + +``` +$ ostree remote refs fedora +``` + +你应该在输出中看到以下内容: + +``` +fedora:fedora/33/x86_64/silverblue +``` + +接下来,将你的系统变基到 Fedora 33 分支。 + +``` +$ rpm-ostree rebase fedora:fedora/33/x86_64/silverblue +``` + +最后要做的是重启你的电脑并启动到 Fedora 33。 + +### 如何回滚 + +如果有什么不好的事情发生。例如,如果你无法启动到 Fedora 33,那很容易回滚回去。在启动时选择 GRUB 菜单中的前一个条目,你的系统就会以切换到 Fedora 33 之前的状态启动。要使这一改变永久化,请使用以下命令: + +``` +$ rpm-ostree rollback +``` + +就是这样了。现在你知道如何将 Silverblue 变基为 Fedora 33 并回滚了。那为什么不在今天就做呢? + +-------------------------------------------------------------------------------- + +via: https://fedoramagazine.org/how-to-rebase-to-fedora-33-on-silverblue/ + +作者:[Michal Konečný][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://fedoramagazine.org/author/zlopez/ +[b]: https://github.com/lujun9972 +[1]: https://fedoramagazine.org/wp-content/uploads/2020/02/fedora-silverblue-logo.png +[2]: https://docs.fedoraproject.org/en-US/fedora-silverblue/ +[3]: https://fedoramagazine.org/give-fedora-silverblue-a-test-drive/ +[4]: https://fedoramagazine.org/wp-content/uploads/2020/10/Screenshot-from-2020-10-29-12-53-37-1024x725.png +[5]: https://fedoramagazine.org/wp-content/uploads/2020/10/Screenshot-from-2020-10-29-13-00-15-1024x722.png +[6]: https://fedoramagazine.org/wp-content/uploads/2020/10/Screenshot-from-2020-10-29-13-01-32-1024x727.png diff --git a/published/202011/20180503 Go on very small hardware (Part 3).md b/published/202011/20180503 Go on very small hardware (Part 3).md new file mode 100644 index 0000000000..4fa8c39c6d --- /dev/null +++ b/published/202011/20180503 Go on very small hardware (Part 3).md @@ -0,0 +1,434 @@ +[#]: collector: (lujun9972) +[#]: translator: (gxlct008) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12782-1.html) +[#]: subject: (Go on very small hardware Part 3) +[#]: via: (https://ziutek.github.io/2018/05/03/go_on_very_small_hardware3.html) +[#]: author: (Michał Derkacz ) + +Go 语言在极小硬件上的运用(三) +====== + +![](https://img.linux.net.cn/data/attachment/album/202010/24/090026to9c9sweyrw9ww37.png) + + +在本系列的 [第一][3] 和 [第二][4] 部分中讨论的大多数示例都是以某种方式闪烁的 LED。起初它可能很有趣,但是一段时间后变得有些无聊。让我们做些更有趣的事情…… + +…让我们点亮更多的 LED! + +![STM32F030F4P6][1] + +### WS281x LED + +[WS281x][5] RGB LED(及其克隆品)非常受欢迎。你可以以单个元素购买、链成长条或组装成矩阵、环或其他形状。 + +![WS2812B][6] + +它们可以串联连接,基于这个事实,你可以只用 MCU 的单个引脚就可以控制一个很长的 LED 灯条。不幸的是,它们的内部控制器使用的物理协议不能直接适用于你在 MCU 中可以找到的任何外围设备。你必须使用 位脉冲bit-banging或以特殊方式使用可用的外设。 + +哪种可用的解决方案最有效取决于同时控制的 LED 灯条数量。如果你必须驱动 4 到 16 个灯条,那么最有效的方法是 [使用定时器和 DMA][7](请不要忽略这篇文章末尾的链接)。 + +如果只需要控制一个或两个灯条,请使用可用的 SPI 或 UART 外设。对于 SPI,你只能在发送的一个字节中编码两个 WS281x 位。由于巧妙地使用了起始位和停止位,UART 允许更密集的编码:每发送一个字节 3 位。 + +我在 [此站点][8] 上找到了有关 UART 协议如何适用于 WS281x 协议的最佳解释。如果你不懂波兰语,这里是 [英文翻译][9]。 + +基于 WS281x 的 LED 仍然是最受欢迎的,但市场上也有 SPI 控制的 LED:[APA102][10]、[SK9822][11]。关于它们的三篇有趣的文章在这里:[1][12]、[2][13]、[3][14]。 + +### LED 环 + +市场上有许多基于 WS2812 的环。我有一个这样的: + +![WS2812B][15] + +它具有 24 个可单独寻址的 RGB LED(WS2812B),并暴露出四个端子:GND、5V、DI 和 DO。通过将 DI(数据输入)端子连接到上一个的 DO(数据输出)端子,可以链接更多的环或其他基于 WS2812 的东西。 + +让我们将这个环连接到我们的 STM32F030 板上。我们将使用基于 UART 的驱动程序,因此 DI 应连接到 UART 接头连接器上的 TXD 引脚。 WS2812B LED 需要至少 3.5V 的电源。 24 个 LED 会消耗大量电流,因此在编程/调试期间,最好将环上的 GND 和 5V 端子直接连接到 ST-LINK 编程器上可用的 GND 和 5V 引脚: + +![WS2812B][16] + +我们的 STM32F030F4P6 MCU 和整个 STM32 F0、F3、F7、L4 系列具有 F1、F4、L1 MCU 不具备的一项重要功能:它可以反转 UART 信号,因此我们可以将环直接连接到 UART TXD 引脚。如果你不知道我们需要这种反转,那么你可能没有读过我上面提到的 [文章][9]。 + +因此,你不能以这种方式使用流行的 [Blue Pill][17] 或 [STM32F4-DISCOVERY][18]。使用其 SPI 外设或外部反相器。有关使用 SPI 的 NUCLEO-F411RE,请参见 [圣诞树灯][19] 项目作为 UART + 逆变器的示例或 [WS2812示例][20]。 + +顺便说一下,大多数 DISCOVERY 板可能还有一个问题:它们在 VDD = 3V 而不是 3.3V 的情况下工作。 对于高 DI,WS281x 至少要求电源电压 * 0.7。如果是 5V 电源,则为 3.5V;如果是 4.7V 电源,则为 3.3V;可在 DISCOVERY 的 5V 引脚上找到。如你所见,即使在我们的情况下,第一个 LED 的工作电压也低于规格 0.2V。对于 DISCOVERY 板,如果供电 4.7V,它将工作在低于规格的 0.3V 下;如果供电 5V,它将工作在低于规格 0.5V 下。 + +让我们结束这段冗长的介绍并转到代码: + +``` +package main + +import ( + "delay" + "math/rand" + "rtos" + + "led" + "led/ws281x/wsuart" + + "stm32/hal/dma" + "stm32/hal/gpio" + "stm32/hal/irq" + "stm32/hal/system" + "stm32/hal/system/timer/systick" + "stm32/hal/usart" +) + +var tts *usart.Driver + +func init() { + system.SetupPLL(8, 1, 48/8) + systick.Setup(2e6) + + gpio.A.EnableClock(true) + tx := gpio.A.Pin(9) + + tx.Setup(&gpio.Config{Mode: gpio.Alt}) + tx.SetAltFunc(gpio.USART1_AF1) + + d := dma.DMA1 + d.EnableClock(true) + + tts = usart.NewDriver(usart.USART1, d.Channel(2, 0), nil, nil) + tts.Periph().EnableClock(true) + tts.Periph().SetBaudRate(3000000000 / 1390) + tts.Periph().SetConf2(usart.TxInv) + tts.Periph().Enable() + tts.EnableTx() + + rtos.IRQ(irq.USART1).Enable() + rtos.IRQ(irq.DMA1_Channel2_3).Enable() +} + +func main() { + var rnd rand.XorShift64 + rnd.Seed(1) + rgb := wsuart.GRB + strip := wsuart.Make(24) + black := rgb.Pixel(0) + for { + c := led.Color(rnd.Uint32()).Scale(127) + pixel := rgb.Pixel(c) + for i := range strip { + strip[i] = pixel + tts.Write(strip.Bytes()) + delay.Millisec(40) + } + for i := range strip { + strip[i] = black + tts.Write(strip.Bytes()) + delay.Millisec(20) + } + } +} + +func ttsISR() { + tts.ISR() +} + +func ttsDMAISR() { + tts.TxDMAISR() +} + +//c:__attribute__((section(".ISRs"))) +var ISRs = [...]func(){ + irq.USART1: ttsISR, + irq.DMA1_Channel2_3: ttsDMAISR, +} +``` + +#### 导入部分 + +与前面的示例相比,导入部分中的新内容是 `rand/math` 包和带有 `led/ws281x` 子树的 `led` 包。 `led` 包本身包含 `Color` 类型的定义。 `led/ws281x/wsuart` 定义了 `ColorOrder`、`Pixel` 和 `Strip` 类型。 + +我想知道如何使用 `image/color` 中的 `Color` 或 `RGBA` 类型,以及如何以它将实现 `image.Image` 接口的方式定义 `Strip`。 但是由于使用了 [gamma 校正][21] 和 大开销的 `color/draw` 包,我以简单的方式结束: + +``` +type Color uint32 +type Strip []Pixel +``` + +使用一些有用的方法。然而,这种情况在未来可能会改变。 + +#### init 函数 + +`init` 函数没有太多新颖之处。 UART 波特率从 115200 更改为 3000000000/1390 ≈ 2158273,相当于每个 WS2812 位 1390 纳秒。 CR2 寄存器中的 TxInv 位设置为反转 TXD 信号。 + +#### main 函数 + +`XorShift64` 伪随机数生成器用于生成随机颜色。 [XORSHIFT][22] 是目前由 `math/rand` 包实现的唯一算法。你必须使用带有非零参数的 `Seed` 方法显式初始化它。 + +`rgb` 变量的类型为 `wsuart.ColorOrder`,并设置为 WS2812 使用的 GRB 颜色顺序(WS2811 使用 RGB 顺序)。然后用于将颜色转换为像素。 + +`wsuart.Make(24)` 创建 24 像素的初始化条带。它等效于: + +``` +strip := make(wsuart.Strip, 24) +strip.Clear() +``` + +其余代码使用随机颜色绘制类似于 “Please Wait…” 微调器的内容。 + +`strip` 切片充当帧缓冲区。 `tts.Write(strip.Bytes())` 将帧缓冲区的内容发送到环。 + +#### 中断 + +该程序由处理中断的代码组成,与先前的 [UART 示例][23] 中的代码相同。 + +让我们编译并运行: + +``` +$ egc +$ arm-none-eabi-size cortexm0.elf + text data bss dec hex filename + 14088 240 204 14532 38c4 cortexm0.elf +$ openocd -d0 -f interface/stlink.cfg -f target/stm32f0x.cfg -c 'init; program cortexm0.elf; reset run; exit' +``` + +我跳过了 `openocd` 的输出。下面的视频显示了该程序的工作原理: + +![video](https://ziutek.github.io/videos/rgbspinner.mp4) + +### 让我们做些有用的事情... + +在 [第一部分][3] 的开头,我曾问过:“Go 能深入到多低层,而还能做一些有用的事情?”。 我们的 MCU 实际上是一种低端设备(8 比特的人可能会不同意我的看法),但到目前为止,我们还没有做任何有用的事情。 + +所以... 让我们做些有用的事情... 让我们做个时钟! + +在互联网上有许多由 RGB LED 构成的时钟示例。让我们用我们的小板子和 RGB 环制作自己的时钟。我们按照下面的描述更改先前的代码。 + +#### 导入部分 + +删除 `math/rand` 包,然后添加 `stm32/hal/exti`。 + +#### 全局变量 + +添加两个新的全局变量:`btn` 和 `btnev`: + +``` +var ( + tts *usart.Driver + btn gpio.Pin + btnev rtos.EventFlag +) +``` + +它们将用来处理那些用于设置时钟的 “按钮”。我们的板子除了重置之外没有其他按钮,但是如果没有它,我们仍然可以通过某种方式进行管理。 + +#### init 函数 + +将这段代码添加到 `init` 函数: + +``` +btn = gpio.A.Pin(4) + +btn.Setup(&gpio.Config{Mode: gpio.In, Pull: gpio.PullUp}) +ei := exti.Lines(btn.Mask()) +ei.Connect(btn.Port()) +ei.EnableFallTrig() +ei.EnableRiseTrig() +ei.EnableIRQ() + +rtos.IRQ(irq.EXTI4_15).Enable() +``` + +在内部上拉电阻pull-up resistor启用的情况下,将 PA4 引脚配置为输入。它已连接至板载 LED,但这不会妨碍任何事情。更重要的是它位于 GND 引脚旁边,所以我们可以使用任何金属物体来模拟按钮并设置时钟。作为奖励,我们还有来自板载 LED 的其他反馈。 + +我们使用 EXTI 外设来跟踪 PA4 状态。它被配置为在发生任何更改时都会产生中断。 + +#### btnWait 函数 + +定义一个新的辅助函数: + +``` +func btnWait(state int, deadline int64) bool { + for btn.Load() != state { + if !btnev.Wait(1, deadline) { + return false // timeout + } + btnev.Reset(0) + } + delay.Millisec(50) // debouncing + return true +} +``` + +它等待 “按钮” 引脚上的指定状态,但只等到最后期限出现。这是稍微改进的轮询代码: + +``` +for btn.Load() != state { + if rtos.Nanosec() >= deadline { + // timeout + } +} +``` + +我们的 `btnWait` 函数不是忙于等待 `state` 或 `deadline`,而是使用 `rtos.EventFlag` 类型的 `btnev` 变量休眠,直到有事情发生。你当然可以使用通道而不是 `rtos.EventFlag`,但是后者便宜得多。 + +#### main 函数 + +我们需要全新的 `main` 函数: + +``` +func main() { + rgb := wsuart.GRB + strip := wsuart.Make(24) + ds := 4 * 60 / len(strip) // Interval between LEDs (quarter-seconds). + adjust := 0 + adjspeed := ds + for { + qs := int(rtos.Nanosec() / 25e7) // Quarter-seconds since reset. + qa := qs + adjust + + qa %= 12 * 3600 * 4 // Quarter-seconds since 0:00 or 12:00. + hi := len(strip) * qa / (12 * 3600 * 4) + + qa %= 3600 * 4 // Quarter-seconds in the current hour. + mi := len(strip) * qa / (3600 * 4) + + qa %= 60 * 4 // Quarter-seconds in the current minute. + si := len(strip) * qa / (60 * 4) + + hc := led.Color(0x550000) + mc := led.Color(0x005500) + sc := led.Color(0x000055) + + // Blend the colors if the hands of the clock overlap. + if hi == mi { + hc |= mc + mc = hc + } + if mi == si { + mc |= sc + sc = mc + } + if si == hi { + sc |= hc + hc = sc + } + + // Draw the clock and write to the ring. + strip.Clear() + strip[hi] = rgb.Pixel(hc) + strip[mi] = rgb.Pixel(mc) + strip[si] = rgb.Pixel(sc) + tts.Write(strip.Bytes()) + + // Sleep until the button pressed or the second hand should be moved. + if btnWait(0, int64(qs+ds)*25e7) { + adjust += adjspeed + // Sleep until the button is released or timeout. + if !btnWait(1, rtos.Nanosec()+100e6) { + if adjspeed < 5*60*4 { + adjspeed += 2 * ds + } + continue + } + adjspeed = ds + } + } +} +``` + +我们使用 `rtos.Nanosec` 函数代替 `time.Now` 来获取当前时间。这样可以节省大量的闪存,但也使我们的时钟变成了不知道日、月、年的老式设备,最糟糕的是它无法处理夏令时的变化。 + +我们的环有 24 个 LED,因此秒针的显示精度可以达到 2.5 秒。为了不牺牲这种精度并获得流畅的运行效果,我们使用 1/4 秒作为基准间隔。半秒就足够了,但四分之一秒更准确,而且与 16 和 48 个 LED 配合使用也很好。 + +红色、绿色和蓝色分别用于时针、分针和秒针。这允许我们使用简单的“逻辑或操作”进行颜色混合。我们 `Color.Blend` 方法可以混合任意颜色,但是我们闪存不多,所以我们选择最简单的解决方案。 + +我们只有在秒针移动时才重画时钟。 + +``` +btnWait(0, int64(qs+ds)*25e7) +``` + +上面的这行代码等待的正是那一刻,或者是按钮的按下。 + +每按一下按钮就会把时钟向前调一调。按住按钮一段时间会加速调整。 + +#### 中断 + +定义新的中断处理程序: + +``` +func exti4_15ISR() { + pending := exti.Pending() & 0xFFF0 + pending.ClearPending() + if pending&exti.Lines(btn.Mask()) != 0 { + btnev.Signal(1) + } +} +``` + +并将 `irq.EXTI4_15: exti4_15ISR` 条目添加到 ISR 数组。 + +该处理程序(或中断服务程序)处理 EXTI4_15 IRQ。 Cortex-M0 CPU 支持的 IRQ 明显少于其较大的同类兄弟处理器,因此你经常可以看到一个 IRQ 被多个中断源共享。在我们的例子中,一个 IRQ 由 12 个 EXTI 线共享。 + +exti4_15ISR 读取所有挂起的位,并从中选择 12 个更高的有效位。接下来,它清除 EXTI 中选中的位并开始处理它们。在我们的例子中,仅检查第 4 位。 `btnev.Signal(1)` 引发 `btnev.Wait(1, deadline)` 唤醒并返回 `true`。 + +你可以在 [Github][24] 上找到完整的代码。让我们来编译它: + +``` +$ egc +$ arm-none-eabi-size cortexm0.elf + text data bss dec hex filename + 15960 240 216 16416 4020 cortexm0.elf +``` + +这里所有的改进只得到 184 个字节。让我们再次重新构建所有内容,但这次在 typeinfo 中不使用任何类型和字段名: + +``` +$ cd $HOME/emgo +$ ./clean.sh +$ cd $HOME/firstemgo +$ egc -nf -nt +$ arm-none-eabi-size cortexm0.elf + text data bss dec hex filename + 15120 240 216 15576 3cd8 cortexm0.elf +``` + +现在,有了千字节的空闲空间,你可以改进一些东西。让我们看看它是如何工作的: + +![video](https://ziutek.github.io/videos/rgbclock.mp4) + +我不知道我是怎么精确打到 3:00 的!? + +以上就是所有内容!在第 4 部分(本系列的结束)中,我们将尝试在 LCD 上显示一些内容。(LCTT 译注:然而烂尾了,第三篇写于 2018 年,整个博客当年就停更了。) + +-------------------------------------------------------------------------------- + +via: https://ziutek.github.io/2018/05/03/go_on_very_small_hardware3.html + +作者:[Michał Derkacz][a] +选题:[lujun9972][b] +译者:[gxlct008](https://github.com/gxlct008) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://ziutek.github.io +[b]: https://github.com/lujun9972 +[1]: https://ziutek.github.io/images/mcu/f030-demo-board/board.jpg +[2]: https://ziutek.github.io/2018/05/03/go_on_very_small_hardware3.html +[3]: https://linux.cn/article-11383-1.html +[4]: https://linux.cn/article-12747-1.html +[5]: http://www.world-semi.com/solution/list-4-1.html +[6]: https://ziutek.github.io/images/led/ws2812b.jpg +[7]: http://www.martinhubacek.cz/arm/improved-stm32-ws2812b-library +[8]: http://mikrokontrolery.blogspot.com/2011/03/Diody-WS2812B-sterowanie-XMega-cz-2.html +[9]: https://translate.google.pl/translate?sl=pl&tl=en&u=http://mikrokontrolery.blogspot.com/2011/03/Diody-WS2812B-sterowanie-XMega-cz-2.html +[10]: http://neon-world.com/en/product.php +[11]: http://www.normandled.com/index.php/Product/view/id/800.html +[12]: https://cpldcpu.wordpress.com/2014/08/27/apa102/ +[13]: https://cpldcpu.wordpress.com/2014/11/30/understanding-the-apa102-superled/ +[14]: https://cpldcpu.wordpress.com/2016/12/13/sk9822-a-clone-of-the-apa102/ +[15]: https://ziutek.github.io/images/led/rgbring.jpg +[16]: https://ziutek.github.io/images/led/ring-stlink-f030.jpg +[17]: https://jeelabs.org/article/1649a/ +[18]: http://www.st.com/en/evaluation-tools/stm32f4discovery.html +[19]: https://github.com/ziutek/emgo/tree/master/egpath/src/stm32/examples/minidev/treelights +[20]: https://github.com/ziutek/emgo/tree/master/egpath/src/stm32/examples/nucleo-f411re/ws2812 +[21]: https://en.wikipedia.org/wiki/Gamma_correction +[22]: https://en.wikipedia.org/wiki/Xorshift +[23]: https://ziutek.github.io/2018/04/14/go_on_very_small_hardware2.html#uart +[24]: https://github.com/ziutek/emgo/tree/master/egpath/src/stm32/examples/f030-demo-board/ws2812-clock diff --git a/published/202011/20190402 When Wi-Fi is mission-critical, a mixed-channel architecture is the best option.md b/published/202011/20190402 When Wi-Fi is mission-critical, a mixed-channel architecture is the best option.md new file mode 100644 index 0000000000..e121eea3b0 --- /dev/null +++ b/published/202011/20190402 When Wi-Fi is mission-critical, a mixed-channel architecture is the best option.md @@ -0,0 +1,75 @@ +[#]: collector: (lujun9972) +[#]: translator: (chenmu-kk) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12817-1.html) +[#]: subject: (When Wi-Fi is mission-critical, a mixed-channel architecture is the best option) +[#]: via: (https://www.networkworld.com/article/3386376/when-wi-fi-is-mission-critical-a-mixed-channel-architecture-is-the-best-option.html#tk.rss_all) +[#]: author: (Zeus Kerravala https://www.networkworld.com/author/Zeus-Kerravala/) + +当 Wi-Fi 成为关键业务时,混合信道架构是最好的多信道选择 +====== + +> 混合信道架构是最好的多信道选择,但它并不总是最佳的选择。当需要可靠的 Wi-Fi 时,单信道和混合 AP 提供了令人信服的替代方案。 + +![Getty Images][1] + +我曾与许多实施数字项目的公司合作过,结果却发现它们失败了。正确的想法,健全地施行,现存的市场机遇。哪里是薄弱的环节?是 Wi-Fi 网络。 + +例如,一家大型医院希望通过将遥测信息发送到移动设备,来提高临床医生对患者警报的响应时间。如果没有这个系统,护士了解病人警报的唯一途径就是通过声音警报。在所有嘈杂的背景音中,通常很难分辨噪音来自哪里。问题是这家医院中的 Wi-Fi 网络已经很多年未升级了,这导致信息传递严重延迟(通常需要 4~5 分钟)。过长的信息传递导致人们对该系统失去信心,因此许多临床医生停止使用该系统,转而使用手动警报。最终,人们认为这个项目是失败的。 + +我曾在制造业、K-12 教育、娱乐和其他行业中见过类似的案例。企业竞争的基础是客户体验,而竞争的动力来自不断扩展又无处不在的无线优势。好的 Wi-Fi 并不意味着市场领导地位,但是劣质的 Wi-Fi 将会对客户和员工产生负面影响。而在当今竞争激烈的环境下,这是灾难的根源。 + +### Wi-Fi 性能历来不一致 + +Wi-Fi 的问题在于它本身就很脆弱。我相信每个阅读这篇文章的人都经历过下载失败、连接中断、性能不一致以及连接公用热点的漫长等待时间等缺陷。 + +想象一下,你在一个会议上,在一个主题演讲之前,你可以随意地发推特、发电子邮件、浏览网页以及做其他事情。然后主讲人上台,所有观众开始拍照,上传并流传信息——然后网络崩溃了。我发现这不仅仅是一个例外,更是一种常态,强调了对[无损 Wi-Fi][3]的需求。 + +对于网络技术人员的问题是如何让一个地方的 Wi-Fi 达到全部时间都保持不间断。有人说只要加强现存的网络可以做到,这也许可以,但在某些情况下,Wi-Fi 的类型可能并不合适。 + +最常见的 Wi-Fi 部署类型是多信道,也称为微蜂窝,每个客户端通过无线信道连接到接入点(AP)。高质量的通话体验基于两点:良好的信号强度和最小的干扰。有几个因素会导致干扰,例如接入点距离太近、布局问题或者来自其他设备的干扰。为了最大程度地减少干扰,企业需要投入大量的时间和资金在[现场调查中规划最佳的信道地图][2],但即使这些做得很好,Wi-Fi 故障仍然可能发生。 + +## 多通道 Wi-Fi 并非总是最佳选择 + +对于许多铺着地毯的办公室来说,多通道 Wi-Fi 可能是可靠的,但在某些环境中,外部环境会影响性能。一个很好的例子是多租户建筑,其中有多个 Wi-Fi 网络在同一信道上传输并相互干扰。另一个例子是医院,这里有许多工作人员在多个接入点间流动。客户端将试图连接到最佳接入点,导致客户端不断断开连接并重新连接,从而导致会话中断。还有一些环境,例如学校、机场和会议设施,那里存在大量的瞬态设备,而多通道则难以跟上。 + +## 单通道 Wi-Fi 提供更好的可靠性但与此同时性能会受到影响 + +网络管理器要做什么?不一致的 Wi-Fi 只是一个既成事实吗?多信道是一种标准,但它并非是为动态物理环境或那些需要可靠的连接环境而设计的。 + +几年前提出了一项解决这些问题的替代架构。顾名思义,“单信道”Wi-Fi 在网络中为所有接入点使用单一的无线频道。可以把它想象成在一个信道上运行的单个 Wi-Fi 结构。这种架构中,接入点的位置无关紧要,因为它们都利用相同的通道,因此不会互相干扰。这有一个显而易见的简化优势,比如,如果覆盖率很低,那就没有理由再做一次昂贵的现场调查。相反,只需在需要的地方布置接入点就可以了。 + +单通道的缺点之一是总网络吞吐量低于多通道,因为只能使用一个通道。在可靠性高于性能的环境中,这可能会很好,但许多组织希望二者兼而有之。 + +## 混合接入点提供了两全其美的优势 + +单信道系统制造商最近进行了创新,将信道架构混合在一起,创造了一种“两全其美”的部署,可提供多信道的吞吐量和单信道的可靠性。举个例子,Allied Telesis 提供了混合接入点,可以同时在多信道和单信道模式下运行。这意味着可以分配一些 Web 客户端到多信道以获得最大的吞吐量,而其他的 Web 客户端则可使用单信道来获得无缝漫游体验。 + +这种混合的实际用例可能是物流设施,办公室工作人员使用多通道,但叉车操作员在整个仓库移动时使用单一通道持续连接。 + +Wi-Fi 曾是一个便利的网络,但如今它或许是所有网络中最关键的任务。传统的多信道体系也许可以工作,但应该做一些尽职调查来看看它在重负下如何运转。IT 领导者需要了解 Wi-Fi 对数字转型计划的重要性,并进行适当的测试,以确保它不是基础设施链中的薄弱环节,并为当今环境选择最佳技术。 + +-------------------------------------------------------------------------------- + +via: https://www.networkworld.com/article/3386376/when-wi-fi-is-mission-critical-a-mixed-channel-architecture-is-the-best-option.html + +作者:[Zeus Kerravala][a] +选题:[lujun9972][b] +译者:[chenmu-kk](https://github.com/chenmu-kk) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://www.networkworld.com/author/Zeus-Kerravala/ +[b]: https://github.com/lujun9972 +[1]: https://images.idgesg.net/images/article/2018/09/tablet_graph_wifi_analytics-100771638-large.jpg +[2]: https://www.networkworld.com/article/3315269/wi-fi-site-survey-tips-how-to-avoid-interference-dead-spots.html +[3]: https://www.alliedtelesis.com/blog/no-compromise-wi-fi +[4]: https://pluralsight.pxf.io/c/321564/424552/7490?u=https%3A%2F%2Fwww.pluralsight.com%2Fcourses%2Fmobile-device-management-big-picture +[5]: https://www.networkworld.com/article/3273439/review-icinga-enterprise-grade-open-source-network-monitoring-that-scales.html?nsdr=true#nww-fsb +[6]: https://www.networkworld.com/article/3304307/nagios-core-monitoring-software-lots-of-plugins-steep-learning-curve.html +[7]: https://www.networkworld.com/article/3269279/review-observium-open-source-network-monitoring-won-t-run-on-windows-but-has-a-great-user-interface.html?nsdr=true#nww-fsb +[8]: https://www.networkworld.com/article/3304253/zabbix-delivers-effective-no-frills-network-monitoring.html +[9]: https://www.facebook.com/NetworkWorld/ +[10]: https://www.linkedin.com/company/network-world diff --git a/published/202011/20190925 Most enterprise networks can-t handle big data loads.md b/published/202011/20190925 Most enterprise networks can-t handle big data loads.md new file mode 100644 index 0000000000..ae1615b66f --- /dev/null +++ b/published/202011/20190925 Most enterprise networks can-t handle big data loads.md @@ -0,0 +1,60 @@ +[#]: collector: (lujun9972) +[#]: translator: (chenmu-kk) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12803-1.html) +[#]: subject: (Most enterprise networks can't handle big data loads) +[#]: via: (https://www.networkworld.com/article/3440519/most-enterprise-networks-cant-handle-big-data-loads.html) +[#]: author: (Andy Patrizio https://www.networkworld.com/author/Andy-Patrizio/) + +大多数企业网络无法处理大数据负载 +====== + +> 随着网络中流动着越来越多的数据,由于领导力和技术问题,网络正在滞后于数据的发展速度。 + +![](https://images.idgesg.net/images/article/2019/08/gettyimages-811109186-100808291-large.jpg) + +又过了一周,另一项调查发现,IT 已经无法跟上不断膨胀的数据过载。这次的问题将主要是网络带宽和整体性能。 + +管理咨询公司埃森哲对 [300 名 IT 专业人士进行的一项调查][1] 发现,大多数人认为他们企业网络无法胜任处理大数据的任务和物联网部署的任务。只有 43% 的受访公司表示他们的网络已经准备好支持云服务、物联网和其他数字技术。 + +一个关键原因(58%)是“IT 与商业需求之间的错位”,这延缓了这些项目的进展。这是一个不同寻常的发现,因为 85% 的受访者还表示他们的网络已经完全或者大体上已经准备好支持企业的数字化计划。那么,究竟是哪一种情况呢? + +第二和第三大时常提及的障碍是“业务需求和运营需求间固有的复杂性”以及“对带宽、性能等方面的需求超过交付能力”,各占 45%。 + +由于分析技术和其他大数据技术的推动,大量传输的数据持续涌入网络线路,网络瓶颈持续增长。调查发现,带宽需求并未得到满足,目前的网络性能依旧达不到要求。 + +其他原因还包括缺乏网络技术、设备扩展和设备老化。 + +### 网络性能问题的一个解决方案:SDN + +埃森哲发现,大多数公司表示 [软件定义网络(SDN)][5] 是应对带宽和性能挑战的解决方案,77% 的受访企业在调查中表示正在部署 SDN 或者已完成部署。它指出,虽然 SDN 可能在组织的某部分中存在,它并不总是在整个企业范围内统一地推出。 + +如今看来,似乎从未有人有足够的预算来满足他们所有的 IT 雄心,但 31% 受访者认为为网络改善提供资金是“简单的”,而且是在网络基础设施团队的控制范围内,相较于直接下属(13%)或基础设施/网络主管和副总裁(19%),首席信息官/首席技术官更可能将融资过程报告为“轻松”(40%)。 + +报告指出,“仅靠传统网络无法支持数字时代所需的创新和性能。”报告呼吁拥抱新技术,但没有提到 SDN 的名字。同时它还呼吁首席执行官和他们直接下属间加强合作,因为很明显,双方在看待问题的方式上存在分歧。 + +报告总结说,“我们认为需要一种新的网络范式来确保网络满足当前和未来的业务需求。然而,尽管有进步的迹象,但变革的步伐缓慢。公司必须承担起重担,才能实现统一和标准化企业能力,提供必要的带宽、性能和安全,以支持当前和未来的业务需求”。 + +-------------------------------------------------------------------------------- + +via: https://www.networkworld.com/article/3440519/most-enterprise-networks-cant-handle-big-data-loads.html + +作者:[Andy Patrizio][a] +选题:[lujun9972][b] +译者:[chenmu-kk](https://github.com/chenmu-kk) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://www.networkworld.com/author/Andy-Patrizio/ +[b]: https://github.com/lujun9972 +[1]: https://www.accenture.com/_acnmedia/pdf-107/accenture-network-readiness-survey.pdf#zoom=50 +[2]: https://www.networkworld.com/article/3209131/lan-wan/what-sdn-is-and-where-its-going.html +[3]: https://www.networkworld.com/article/3206709/lan-wan/what-s-the-difference-between-sdn-and-nfv.html +[4]: https://www.networkworld.com/newsletters/signup.html +[5]: https://www.networkworld.com/article/3209131/what-sdn-is-and-where-its-going.html +[6]: https://www.networkworld.com/blog/itaas-and-the-corporate-storage-technology/ +[7]: https://www.networkworld.com/article/3405522/how-network-pros-acquire-skills-for-sdn-programmable-networks.html +[8]: https://www.facebook.com/NetworkWorld/ +[9]: https://www.linkedin.com/company/network-world diff --git a/published/202011/20191003 4 open source eBook readers for Android.md b/published/202011/20191003 4 open source eBook readers for Android.md new file mode 100644 index 0000000000..89cbee1312 --- /dev/null +++ b/published/202011/20191003 4 open source eBook readers for Android.md @@ -0,0 +1,153 @@ +[#]: collector: (lujun9972) +[#]: translator: (chenmu-kk) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12826-1.html) +[#]: subject: (4 open source eBook readers for Android) +[#]: via: (https://opensource.com/article/19/10/open-source-ereaders-android) +[#]: author: (Scott Nesbitt https://opensource.com/users/scottnesbitt) + +四款安卓开源电子书阅读器 +====== + +> 你在寻找新的电子书阅读软件吗?来看看这四款适用于安卓的可靠的开源电子书阅读器吧。 + +![](https://img.linux.net.cn/data/attachment/album/202011/16/135728ayhh1aiqwrva50zy.jpg) + +谁不想有一个好的阅读体验?与其将时间浪费在社交媒体或[即时消息软件][2]上,不如在自己的安卓手机或平板上阅读一本书、杂志或其他文档。 + +要做到这一点,你需要的是一个适合的电子书阅读软件。接下来让我们来看一看四款可靠的、开源安卓电子书阅读器。 + +### Book Reader + +那我们先从我最喜欢的一款开源安卓电子书阅读器开始:[Book Reader][3]。它基于现在专有的 FBReader 应用的开源老版本。像 FBReader 的早期版本一样,Book Reader 小而简单,但是好用。 + +**优点:** + + * 易于操作。 + * 该应用界面遵循安卓的 [Material Design 指南][4],因此非常干净。 + * 你可以为电子书添加书签,并将文本分享至你设备上的其他应用。 + * 不断提供除英语外的其他语言的支持。 + +**缺点** + + * Book Reader 的自定义选项较少。 + * 没有内置词典或支持外部词典的功能。 + +**支持的电子书格式:** + +Book Reader 支持 EPUB、.mobi、PDF、[DjVu][5]、HTML、纯文本、 Word 文档、RTF 和 [FictionBook][6]。 + +![Book Reader Android app][7] + +Book Reader 的源码在 GNU GPL 3.0 下授权,你可以在[GitLab][8]中找到它。 + +### Cool Reader + +[Cool Reader][9] 是一个灵活易用的电子书软件。虽然我觉得该软件的图标会让想起 Windows vista 中的图标,但它确实有一些好用的功能。 + +**优点** + + * 高度自定义,你可以更改字体、行宽、段间距、连字符、字体大小、页边距以及背景色。 + * 你可以覆盖书中的样式表。我发现这对于两三本将所有文本设置为小写字母的书很有用。 + * 它会在设备启动时自动搜寻设备中的新书资源。你也可以查阅[古腾堡计划][10]和[互联网档案馆][11]中的书籍。 + +**缺点** + + * Cool Reader 的界面并不是极简或者说最现代化的。 + * 虽然它开箱即用,但实际上你需要调整一些配置来更舒适地使用 Cool Reader。 + * 应用的默认词典是专有的,尽管你可以用[开源的词典][12]来替换掉它。 + +**支持的电子书格式:** + +你可以使用 Cool Reader 来浏览 EPUB、小说、纯文本、RTF、HTML、[CHM][13] 和 TCR(Psion 系列掌上电脑的电子书格式)文件。 + +![Cool Reader Android app][14] + +Cool Reader 的源码在 GNU GPL 2 下授权,你可以在 [Sourceforge][15] 中找到它。 + +### KOReader + +[KOReader][16] 最初是为了 [E Ink][17] 电子书阅读器创建的,但后来发现它可用于安卓。在测试它时,我发现 KOReader 在同等程度下既有用又令人沮丧。很明显它绝不是一款不好的应用,但不会是我的首选。 + +**优点** + + * 高度自定义。 + * 支持多种语言。 + * 它允许你使用[词典][18](若你已安装)或者 Wikipedia(若你已连接至网络)来查单词。 + +**缺点** + + * 每一本书你都需要改变设置。在你打开一本新书时,KOReader 不会记住相关设置 + * 它的界面会让人觉得是一款专门的电子书阅读器。该应用没有安卓的外形和感受。 + +**支持的电子书格式:** + +你可以查阅 PDF、DjVu、CBT、以及 [CBZ][5] 电子书。它也支持 EPUB、小说、.mobi、Word 文档、文本文件和 [CHM][13] 文件。 + +![KOReader Android app][19] + +Cool Reader 的源码在 GNU Affero GPL 3.0 下授权,你可以在 [GitHub][20] 上找到它。 + +### Booky McBookface + +是的,这确实是[这款电子书阅读器][21]的名字。它是这篇文章中最基础的电子书阅读器,但不要因此(或者这个傻乎乎的名字)使你失望。Booky McBookface 易于使用,并且有一件事它做的很好。 + +**优点** + + * 没有多余的装饰。只有你和你的电子书。 + * 界面简洁。 + * 在安卓启动栏中的长按软件图标会弹出一个菜单,你可以从中打开正在阅读的最后一本书、获得未读书籍的列表、或者查找并打开设备上的一本书。 + +**缺点** + + * 软件中几乎没有配置选项——你可以更改字体大小和亮度,仅此而已。 + * 你需要使用屏幕底部的按钮浏览电子书。点击屏幕边缘无法操作。 + * 无法为电子书添加书签。 + +**支持的电子书格式** + +你可以使用该软件阅读 EPUB 格式、HTML 文档,或纯文本格式的电子书。 + +![Booky McBookface Android app][22] + +Booky McBookface 的源码在 GNU GPL 3.0 下授权,你可以在 [GitHub][23] 中找到它。 + +你有最喜欢的安卓开源电子书阅读器吗?在社区中留言分享一下吧。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/10/open-source-ereaders-android + +作者:[Scott Nesbitt][a] +选题:[lujun9972][b] +译者:[chenmu-kk](https://github.com/chenmu-kk) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/scottnesbitt +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/computer_browser_program_books_read.jpg?itok=iNMWe8Bu (Computer browser with books on the screen) +[2]: https://opensource.com/article/19/3/open-messenger-client +[3]: https://f-droid.org/en/packages/com.github.axet.bookreader/ +[4]: https://material.io/design/ +[5]: https://opensource.com/article/19/3/comic-book-archive-djvu +[6]: https://en.wikipedia.org/wiki/FictionBook +[7]: https://opensource.com/sites/default/files/uploads/book_reader-book-list.png (Book Reader Android app) +[8]: https://gitlab.com/axet/android-book-reader/tree/HEAD +[9]: https://f-droid.org/en/packages/org.coolreader/ +[10]: https://www.gutenberg.org/ +[11]: https://archive.org +[12]: http://aarddict.org/ +[13]: https://fileinfo.com/extension/chm +[14]: https://opensource.com/sites/default/files/uploads/cool_reader-icons.png (Cool Reader Android app) +[15]: https://sourceforge.net/projects/crengine/ +[16]: https://f-droid.org/en/packages/org.koreader.launcher/ +[17]: https://en.wikipedia.org/wiki/E_Ink +[18]: https://github.com/koreader/koreader/wiki/Dictionary-support +[19]: https://opensource.com/sites/default/files/uploads/koreader-lookup.png (KOReader Android app) +[20]: https://github.com/koreader/koreader +[21]: https://f-droid.org/en/packages/com.quaap.bookymcbookface/ +[22]: https://opensource.com/sites/default/files/uploads/booky_mcbookface-menu.png (Booky McBookface Android app) +[23]: https://github.com/quaap/BookyMcBookface diff --git a/published/202011/20200310 Getting started with Emacs.md b/published/202011/20200310 Getting started with Emacs.md new file mode 100644 index 0000000000..01283be5a9 --- /dev/null +++ b/published/202011/20200310 Getting started with Emacs.md @@ -0,0 +1,177 @@ +[#]: collector: (lujun9972) +[#]: translator: (wxy) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12868-1.html) +[#]: subject: (Getting started with Emacs) +[#]: via: (https://opensource.com/article/20/3/getting-started-emacs) +[#]: author: (Seth Kenlon https://opensource.com/users/seth) + +10 个让你进入 Emacs 世界的技巧 +====== + +> 10 个技巧,让你深入这个有用的开源文本编辑器的世界。 + +![](https://img.linux.net.cn/data/attachment/album/202011/29/103757lccy9ljxiowooyzy.jpg) + +很多人都说想学 [Emacs][2],但很多人在短暂的接触后就退缩了。这并不是因为 Emacs 不好,也不是 Emacs 复杂。我相信,问题在于人们其实并不想“学习” Emacs,而是他们想习惯 Emacs 的传统。他们想了解那些神秘的键盘快捷键和不熟悉的术语。他们想按照他们认为的“使用目的”来使用 Emacs。 + +我很同情这一点,因为我对 Emacs 的感觉就是这样。我以为真正的 Emacs 用户都只会在终端里面运行,从来不用方向键和菜单,更不会用鼠标。这是个阻止自己开始使用 Emacs 的好办法。有足够多的独特的 `.emacs` 配置文件证明,如果说 Emacs 用户有一个共同的变化,那就是每个人使用 Emacs 的方式不同。 + +学习 Emacs 很容易。爱上 Emacs 才是最难的。要爱上 Emacs,你必须发现它所拥有的功能,而这些功能是你一直在寻找的,有时你并不知道你已经错过了它们。这需要经验。 + +获得这种经验的唯一方法就是从一开始就积极使用 Emacs。这里有十个小提示,可以帮助你找出最适合你的方法。 + +### 从 GUI 开始 + +Emacs(以及它的友好竞争者 [Vim][3])最伟大的事情之一是它可以在终端中运行,这在你 SSH 进入服务器时很有用,但在过去 15 年来制造的计算机上意义不大。Emacs 的 GUI 版本可以在极度[低功耗的设备][4]上运行,它有很多实用的功能,无论是新手还是有经验的用户都可以使用它。 + +例如,如果你不知道如何在 Emacs 中只用键盘快捷键复制一个单词,编辑菜单的复制、剪切和粘贴选择提供了最轻松的路径。没有理由因为选择了 Emacs 而惩罚自己。使用它的菜单,用鼠标选择区域,点击缓冲区内的按钮,不要让陌生感阻碍你的工作效率。 + +![Emacs slackware][5] + +这些功能被内置到 Emacs 中,是因为用户在使用它们。你应该在你需要的时候使用它们,而当你最终在 VT100 终端上通过 SSH 使用 Emacs,没有 `Alt` 或方向键的时候,你才应该使用这些晦涩的命令。 + +### 习惯术语 + +Emacs 的 UI 元素有着特殊的术语。个人计算的发展并不是建立在相同的术语上,所以很多术语对现代计算机用户来说比较陌生,还有一些术语虽然相同,但含义不同。下面是一些最常见的术语。 + + * 框架Frame。在 Emacs 中,“框架”就是现代计算机所说的“窗口”。 + * 缓冲区Buffer:“缓冲区”是 Emacs 的一个通信通道。它可以作为 Emacs 进程的命令行,也可以作为 shell,或者只是一个文件的内容。 + * 窗口Window:“窗口”是你进入一个缓冲区的视角。 + * 迷你缓冲区Mini-buffer。它是主要的命令行,位于 Emacs 窗口的底部。 + +![Emacs tutorial map][6] + +### 让 Emacs 的修饰键变得更有意义 + +在 PC 键盘上,`Ctrl` 键被称为 `C`,`Alt` 键被称为 `M`,这些键并不是 `C` 和 `M` 键,由于它们总是与相应的字母或符号键配对,所以在文档中很容易识别。 + +例如,`C-x` 在现代键盘符号中的意思是 `Ctrl+X`,`M-x` 是 `Alt+X`。就像你从任何应用程序中剪切文本时一样,同时按下这两个键。 + +不过,还有另一个层次的键盘快捷键,与现代电脑上的任何东西都完全不同。有时,键盘快捷键并不只是一个键组合,而是由一系列的按键组成。 + +例如,`C-x C-f` 的意思是像往常一样按 `Ctrl+X`,然后再按 `Ctrl+C`。 + +有时,一个键盘快捷键有混合的键型。组合键 `C-x 3` 意味着像往常一样按 `Ctrl+X`,然后按数字 `3` 键。 + +Emacs 之所以能做到这些花哨的强力组合,是因为某些键会让 Emacs 进入一种特殊的命令模式。如果你按 `C-X`(也就是 `Ctrl+X`),就是告诉 `Emacs` 进入空闲状态,等待第二个键或键盘快捷键。 + +Emacs 的文档,无论是官方的还是非官方的,都有很多键盘快捷键。在心里练习把 `C` 键翻译成 `Ctrl` 键,`M` 键翻译成 `Alt` 键,那么这些文档对你来说都会变得更有意义。 + +### 剪切、复制和粘贴的备用快捷方式 + +从规范上,复制文本是通过一系列的键盘快捷键进行的,这些快捷键取决于你想要复制或剪切的方式。 + +例如,你可以用 `M-d`(`Alt+d` 的 Emacs 行话)剪切一整个单词,或者用`C-k`(`Ctrl+K`)剪切一整行,或者用 `M-m`(`Alt+M`)剪切一个高亮区域。如果你想的话,你可以习惯这样,但如果你喜欢 `Ctrl+C` 和 `Ctrl+X` 和 `Ctrl-V`,那么你可以用这些来代替。 + +启用现代的“剪切-复制-粘贴”需要激活一个名为 CUA(通用用户访问Common User Access)的功能。要激活 CUA,请单击“选项”菜单并选择“使用 CUA 键”。启用后,`C-c` 复制高亮显示的文本,`C-x` 剪切高亮显示的文本,`C-v` 粘贴文本。这个模式只有在你选择了文本之后才会实际激活,所以你仍然可以学习 Emacs 通常使用的 `C-x` 和 `C-c` 绑定。 + +### 用哪个都好 + +Emacs 是一个应用程序,它不会意识到你对它的感情或忠诚度。如果你想只用 Emacs 来完成那些“感觉”适合 Emacs 的任务,而用不同的编辑器(比如 Vim)来完成其他任务,你可以这样做。 + +你与一个应用程序的交互会影响你的工作方式,所以如果 Emacs 中所需要的按键模式与特定任务不一致,那么就不要强迫自己使用 Emacs 来完成该任务。Emacs 只是众多可供你使用的开源工具之一,没有理由让自己只限于一种工具。 + +### 探索新函数 + +Emacs 所做的大部分工作都是一个 elisp 函数,它可以从菜单选择和键盘快捷键调用,或者在某些情况下从特定事件中调用。所有的函数都可以从迷你缓冲区(Emacs 框架底部的命令行)执行。理论上,你甚至可以通过键入 `forward-word` 和 `backward-word` 以及 `next-line` 和 `previous-line` 等函数来导航光标。这肯定是无比低效的,但这就是一种直接访问你运行的代码的方式。在某种程度上,Emacs 就是自己的 API。 + +你可以通过在社区博客上阅读有关 Emacs 的资料来了解新函数,或者你可以采取更直接的方法,使用描述函数(`describe-function`)。要获得任何函数的帮助,按 `M-x`(也就是 `Alt+X`),然后输入 `describe-function`,然后按回车键。系统会提示你输入一个函数名称,然后显示该函数的描述。 + +你可以通过键入`M-x(`Alt+X`),然后键入 `?` 来获得所有可用函数的列表。 + +你也可以在输入函数时,通过按 `M-x` 键,然后输入 `auto-complete-mode`,再按回车键,获得弹出的函数描述。激活该模式后,当你在文档中键入任何 Emacs 函数时,都会向你提供自动补完选项,以及函数的描述。 + +![Emacs function][7] + +当你找到一个有用的函数并使用它时,Emacs 会告诉你它的键盘绑定,如果有的话。如果没有的话,你可以通过打开你的 `$HOME/.emacs` 配置文件并输入键盘快捷键来自己分配一个。语法是 ` global-set-key`,后面是你要使用的键盘快捷键,然后是你要调用的函数。 + +例如,要将 `screenwriter-slugline` 函数分配一个键盘绑定: + +``` +(global-set-key (kbd “C-c s”) 'screenwriter-slugline) +``` + +重新加载配置文件,键盘快捷键就可以使用了: + +``` +M-x load-file ~/.emacs +``` + +### 紧急按钮 + +当你使用 Emacs 并尝试新的函数时,你一定会开始调用一些你并不想调用的东西。Emacs 中通用的紧急按钮是 `C-g`(就是 `Ctrl+G`)。 + +我通过将 G 与 GNU 联系起来来记住这一点,我想我是在呼吁 GNU 将我从一个错误的决定中拯救出来,但请随意编造你自己的记忆符号。 + +如果你按几下 `C-g`,Emacs 的迷你缓冲区就会回到潜伏状态,弹出窗口被隐藏,你又回到了一个普通的、无聊的文本编辑器的安全状态。 + +### 忽略键盘快捷键 + +潜在的键盘快捷键太多,在这里无法一一总结,更不希望你能记住。这是设计好的。Emacs 的目的是为了定制,当人们为 Emacs 编写插件时,他们可以定义自己的特殊键盘快捷键。 + +我们的想法不是要马上记住所有的快捷键。相反,你的目标是让你在使用 Emacs 时感到舒适。你在 Emacs 中变得越舒适,你就越会厌倦总是求助于菜单栏,你就会开始记住对你重要的组合键。 + +根据自己在 Emacs 中通常做的事情,每个人都有自己喜欢的快捷方式。一个整天用 Emacs 写代码的人可能知道运行调试器或启动特定语言模式的所有键盘快捷键,但对 Org 模式或 Artist 模式一无所知。这很自然,也很好。 + +### 使用 Bash 时练习 Emacs + +了解 Emacs 键盘快捷键的一个好处是,其中许多快捷键也适用于 Bash。 + + * `C-a`:到行首 + * `C-e`:到行尾 + * `C-k`:剪切整行 + * `M-f`:向前一个字 + * `M-b`:向后一个字 + * `M-d`:剪切一个字 + * `C-y`:贴回(粘贴)最近剪切的内容 + * `M-Shift-U`:大写一个词 + * `C-t`:交换两个字符(例如,`sl` 变成 `ls`) + +还有更多的例子,它能让你与 Bash 终端的交互速度超乎你的想象。 + +### 包 + +Emacs 有一个内置的包管理器来帮助你发现新的插件。它的包管理器包含了帮助你编辑特定类型文本的模式(例如,如果你经常编辑 JSON 文件,你可以尝试使用 ejson 模式)、嵌入的应用程序、主题、拼写检查选项、linter 等。这就是 Emacs 有可能成为你日常计算的关键所在;一旦你找到一个优秀的 Emacs 包,你可能离不开它了。 + +![Emacs emoji][8] + +你可以按 `M-x`(就是 `Alt+X`)键,然后输入 `package-list-packages` 命令,再按回车键来浏览包。软件包管理器在每次启动时都会更新缓存,所以第一次使用时要耐心等待它下载可用软件包的列表。一旦加载完毕,你可以用键盘或鼠标进行导航(记住,Emacs 是一个 GUI 应用程序)。每一个软件包的名称都是一个按钮,所以你可以将光标移到它上面,然后按回车键,或者直接用鼠标点击它。你可以在 Emacs 框架中出现的新窗口中阅读有关软件包的信息,然后用安装按钮来安装它。 + +有些软件包需要特殊的配置,有时会在它的描述中列出,但有时需要你访问软件包的主页来阅读更多的信息。例如,自动完成包 `ac-emoji` 很容易安装,但需要你定义一个符号字体。无论哪种方式都可以使用,但你只有在安装了字体的情况下才能看到相应的表情符号,除非你访问它的主页,否则你可能不会知道。 + +### 俄罗斯方块 + +Emacs 有游戏,信不信由你。有数独、拼图、扫雷、一个好玩的心理治疗师,甚至还有俄罗斯方块。这些并不是特别有用,但在任何层面上与 Emacs 进行交互都是很好的练习,游戏是让你在 Emacs 中花费时间的好方法。 + +![Emacs tetris][9] + +俄罗斯方块也是我最初接触 Emacs 的方式,所以在该游戏的所有版本中,Emacs 版本才是我真正的最爱。 + +### 使用 Emacs + +GNU Emacs 之所以受欢迎,是因为它的灵活性和高度可扩展性。人们习惯了 Emacs 的键盘快捷键,以至于他们习惯性地尝试在其他所有的应用程序中使用这些快捷键,他们将应用程序构建到 Emacs 中,所以他们永远不需要离开。如果你想让 Emacs 在你的计算生活中扮演重要角色,最终的关键是拥抱未知,开始使用 Emacs。磕磕绊绊地,直到你发现如何让它为你工作,然后安下心来,享受 40 年的舒适生活。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/3/getting-started-emacs + +作者:[Seth Kenlon][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/seth +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/keyboaord_enter_writing_documentation.jpg?itok=kKrnXc5h (Computer keyboard typing) +[2]: https://opensource.com/downloads/emacs-cheat-sheet +[3]: https://opensource.com/downloads/cheat-sheet-vim +[4]: https://opensource.com/article/17/2/pocketchip-or-pi +[5]: https://opensource.com/sites/default/files/uploads/emacs-slackware.jpg (Emacs slackware) +[6]: https://opensource.com/sites/default/files/uploads/emacs-tutorial-map.png (Emacs tutorial map) +[7]: https://opensource.com/sites/default/files/uploads/emacs-function.jpg (Emacs function) +[8]: https://opensource.com/sites/default/files/uploads/emacs-emoji_0.jpg (Emacs emoji) +[9]: https://opensource.com/sites/default/files/uploads/emacs-tetris.jpg (Emacs tetris) diff --git a/published/202011/20200720 An introduction to mutation testing in Python.md b/published/202011/20200720 An introduction to mutation testing in Python.md new file mode 100644 index 0000000000..8d737a7cf5 --- /dev/null +++ b/published/202011/20200720 An introduction to mutation testing in Python.md @@ -0,0 +1,155 @@ +[#]: collector: (lujun9972) +[#]: translator: (MjSeven) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12871-1.html) +[#]: subject: (An introduction to mutation testing in Python) +[#]: via: (https://opensource.com/article/20/7/mutmut-python) +[#]: author: (Moshe Zadka https://opensource.com/users/moshez) + +Python 突变测试介绍 +====== + +> 通过突变测试来修复未知的 bug。 + +![](https://img.linux.net.cn/data/attachment/album/202011/29/230106ie9xc89dj3jx1yj9.jpg) + +你一定对所有内容都进行了测试,也许你甚至在项目仓库中有一个徽章,标明有 100% 的测试覆盖率,但是这些测试真的帮到你了吗?你怎么知道的? + +开发人员很清楚单元测试的*成本*。测试必须要编写。有时它们无法按照预期工作:存在假告警或者抖动测试。在不更改任何代码的情况下有时成功,有时失败。通过单元测试发现的小问题很有价值,但是通常它们悄无声息的出现在开发人员的机器上,并且在提交到版本控制之前就已得到修复。但真正令人担忧的问题大多是看不见的。最糟糕的是,*丢失的告警*是完全不可见的:你看不到没能捕获的错误,直到出现在用户手上 —— 有时甚至连用户都看不到。 + +有一种测试可以使不可见的错误变为可见:[突变测试][2]mutation testing。 + +变异测试通过算法修改源代码,并检查每次测试是否都有“变异体”存活。任何在单元测试中幸存下来的变异体都是问题:这意味着对代码的修改(可能会引入错误)没有被标准测试套件捕获。 + +[Python][3] 中用于突变测试的一个框架是 `mutmut`。 + +假设你需要编写代码来计算钟表中时针和分针之间的角度,直到最接近的度数,代码可能会这样写: + +``` +def hours_hand(hour, minutes): +    base = (hour % 12 ) * (360 // 12) +    correction = int((minutes / 60) * (360 // 12)) +    return base + correction + +def minutes_hand(hour, minutes): +    return minutes * (360 // 60) + +def between(hour, minutes): +    return abs(hours_hand(hour, minutes) - minutes_hand(hour, minutes)) +``` + +首先,写一个简单的单元测试: + +``` +import angle + +def test_twelve(): +    assert angle.between(12, 00) == 0 +``` + +足够了吗?代码没有 `if` 语句,所以如果你查看覆盖率: + +``` +$ coverage run `which pytest` +============================= test session starts ============================== +platform linux -- Python 3.8.3, pytest-5.4.3, py-1.8.2, pluggy-0.13.1 +rootdir: /home/moshez/src/mut-mut-test +collected 1 item                                                               + +tests/test_angle.py .                                                    [100%] + +============================== 1 passed in 0.01s =============================== +``` + +完美!测试通过,覆盖率为 100%,你真的是一个测试专家。但是,当你使用突变测试时,覆盖率会变成多少? + +``` +$ mutmut run --paths-to-mutate angle.py + +Legend for output: +🎉 Killed mutants. The goal is for everything to end up in this bucket. +⏰ Timeout. Test suite took 10 times as long as the baseline so were killed. +🤔 Suspicious. Tests took a long time, but not long enough to be fatal. +🙁 Survived. This means your tests needs to be expanded. +🔇 Skipped. Skipped. + +⠋ 21/21 🎉 5 ⏰ 0 🤔 0 🙁 16 🔇 0 +``` + +天啊,在 21 个突变体中,有 16 个存活。只有 5 个通过了突变测试,但是,这意味着什么呢? + +对于每个突变测试,`mutmut` 会修改部分源代码,以模拟潜在的错误,修改的一个例子是将 `>` 比较更改为 `>=`,查看会发生什么。如果没有针对这个边界条件的单元测试,那么这个突变将会“存活”:这是一个没有任何测试用例能够检测到的潜在错误。 + +是时候编写更好的单元测试了。很容易检查使用 `results` 所做的更改: + +``` +$ mutmut results + +Survived 🙁 (16) + +---- angle.py (16) ---- + +4-7, 9-14, 16-21 +$ mutmut apply 4 +$ git diff +diff --git a/angle.py b/angle.py +index b5dca41..3939353 100644 +--- a/angle.py ++++ b/angle.py +@@ -1,6 +1,6 @@ + def hours_hand(hour, minutes): + hour = hour % 12 +- base = hour * (360 // 12) ++ base = hour / (360 // 12) + correction = int((minutes / 60) * (360 // 12)) + return base + correction +``` + +这是 `mutmut` 执行突变的一个典型例子,它会分析源代码并将运算符更改为不同的运算符:减法变加法。在本例中由乘法变为除法。一般来说,单元测试应该在操作符更换时捕获错误。否则,它们将无法有效地测试行为。按照这种逻辑,`mutmut` 会遍历源代码仔细检查你的测试。 + +你可以使用 `mutmut apply` 来应用失败的突变体。事实证明你几乎没有检查过 `hour` 参数是否被正确使用。修复它: + +``` +$ git diff +diff --git a/tests/test_angle.py b/tests/test_angle.py +index f51d43a..1a2e4df 100644 +--- a/tests/test_angle.py ++++ b/tests/test_angle.py +@@ -2,3 +2,6 @@ import angle + + def test_twelve(): + assert angle.between(12, 00) == 0 ++ ++def test_three(): ++ assert angle.between(3, 00) == 90 +``` + +以前,你只测试了 12 点钟,现在增加一个 3 点钟的测试就足够了吗? + +``` +$ mutmut run --paths-to-mutate angle.py + +⠋ 21/21 🎉 7 ⏰ 0 🤔 0 🙁 14 🔇 0 +``` + +这项新测试成功杀死了两个突变体,比以前更好,当然还有很长的路要走。我不会一一解决剩下的 14 个测试用例,因为我认为模式已经很明确了。(你能将它们降低到零吗?) + +变异测试和覆盖率一样,是一种工具,它允许你查看测试套件的全面程度。使用它使得测试用例需要改进:那些幸存的突变体中的任何一个都是人类在篡改代码时可能犯的错误,以及潜伏在程序中的隐藏错误。继续测试,愉快地搜寻 bug 吧。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/7/mutmut-python + +作者:[Moshe Zadka][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/moshez +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/search_find_code_python_programming.png?itok=ynSL8XRV (Searching for code) +[2]: https://opensource.com/article/19/8/mutation-testing-evolution-tdd +[3]: https://opensource.com/resources/python diff --git a/published/202011/20200804 Use your favorite programming language to provision Infrastructure as Code.md b/published/202011/20200804 Use your favorite programming language to provision Infrastructure as Code.md new file mode 100644 index 0000000000..2429ce55ae --- /dev/null +++ b/published/202011/20200804 Use your favorite programming language to provision Infrastructure as Code.md @@ -0,0 +1,452 @@ +[#]: collector: (lujun9972) +[#]: translator: (wxy) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12862-1.html) +[#]: subject: (Use your favorite programming language to provision Infrastructure as Code) +[#]: via: (https://opensource.com/article/20/8/infrastructure-as-code-pulumi) +[#]: author: (Lee Briggs https://opensource.com/users/lbriggs) + +使用你喜欢的编程语言,将基础设施作为代码进行配置 +====== + +> 用 Node.js 或其他编程语言为你提供启动基础设施所需的一切服务。 + +![](https://img.linux.net.cn/data/attachment/album/202011/27/151108bnnggmxegfzwog46.jpg) + +当你在 IT 和技术的世界里遨游时,你会反复遇到一些术语。其中有些术语很难量化,随着时间的推移,可能会有不同的含义。[“DevOps”][2] 就是一个例子,这个词似乎(在我看来)会根据使用它的人而改变;最初的 DevOps 先驱者可能甚至不认识我们今天所说的 DevOps。 + +如果你是一个软件开发者,“基础架构即代码Infrastructure as Code”(IaC)可能是其中一个术语。IaC 是使用与你编写面向用户的功能相同的软件开发实践来声明应用程序运行的基础设施。这通常意味着使用 [Git][3] 或 [Mercurial][4] 等工具进行版本控制,使用 Puppet、Chef 或 Ansible 进行[配置管理][5]。在基础设施供应层,最常见的技术是 CloudFormation(专用于 AWS),或开源替代品 [Terraform][6],用来创建供你的应用程序运行的混合云资源。 + +在配置管理领域有很好产品可供选择,可以将 IaC 写成配置文件或首选的编程语言,但这种选择在基础设施供应领域并不常见。 + +[Pulumi][7] 提供了一个使用标准编程语言来定义基础设施的方式。它支持一系列语言,包括 [JavaScript][8]、[TypeScript][9]、[Go][10]、[Python][11] 和 [C#][12]。就像 Terraform 一样,Pulumi 对许多熟悉的云提供商有一流的支持,比如 [AWS][13]、[Azure][14]、[Google Cloud][15] 和[其他提供商][16]。 + +在本文中,我将向你展示如何使用 Pulumi 以 Node.js 编写基础设施。 + +### 先决条件 + +首先,确保你已经做好了使用 Pulumi 的准备。Pulumi 支持所有主流的操作系统,所以你安装其先决条件的方法取决于你使用的操作系统。 + +首先,安装你喜欢的编程语言的解释器。我将使用 TypeScript,所以我需要安装 `node` 二进制。请查阅 Node 的[安装说明][17],了解你的操作系统的信息。你可以在 [Mac][19] 或 [Linux][20] 上使用 [Homebrew][18] 来安装: + +``` +brew install node +``` + +在 Linux 上,你可以使用你常用的软件包管理器,如 `apt` 或 `dnf`。 + +``` +$ sudo dnf install nodejs +``` + +无论哪种情况,结果都应该是 `node` 二进制文件在你的 `$PATH` 中可用。要确认它是可访问的,运行: + +``` +node --version +``` + +接下来,安装 Pulumi 命令行界面(CLI)。你可以在 Pulumi 的文档中找到针对不同操作系统的[安装说明][21]。在 Mac 或 Linux 上使用 `brew`: + +``` +brew install pulumi +``` + +另外,你也可以使用安装脚本。首先下载并审查它,然后执行它: + +``` +$ curl -fsSL --output pulumi_installer.sh https://get.pulumi.com/ +$ more  pulumi_installer.sh +$ sh ./pulumi_installer.sh +``` + +同样,我们所希望的结果是在你的路径上有 `pulumi` 二进制。检查版本以确保你已经准备好了: + +``` +pulumi version +v2.5.0 +``` + +### 配置 Pulumi + +在你开始配置任何基础设施之前,给 Pulumi 一个存储其[状态][22]的地方。 + +Pulumi 将其状态存储在后端。默认的后端是 Pulumi 的软件即服务(它有一个针对个人用户的免费计划),但在这个例子中,我使用替代的文件后端。文件后端将在你的本地文件系统上创建一个文件来存储状态: + +``` +pulumi login --local +``` + +如果你打算和别人分享这个项目,文件后台可能不是一个好的起点。Pulumi 还可以将其状态存储在 AWS S3 等云对象存储中。要使用它,请创建一个 S3 bucket 并登录: + +``` +pulumi login --cloud-url s3://my-pulumi-state-bucket +``` + +现在你已经登录到了状态后端,你可以创建一个项目和一个堆栈了! + +在你开始创建 Pulumi 项目之前,请先了解以下 Pulumi 术语,你将在本教程中看到这些术语。 + +#### 项目 + +[项目][23]project是一个包含 `Pulumi.yaml` 文件的目录。这个文件包含了 Pulumi 需要知道的元数据,以便进行它的工作。在 `Pulumi.yaml` 文件中可以找到的示例字段有: + + * 运行时(例如,Python、Node、Go、.Net) + * 项目说明(如“我的第一个 Pulumi 项目”) + * 项目名称 + +项目是一个松散的概念,可以满足你的需求。一般来说,一个项目包含了一系列的*资源*,这些资源是你想要提供和控制的东西。你可以选择拥有资源很少的小型 Pulumi 项目,也可以选择包含所有你需要的资源的大型项目。随着你对 Pulumi 越来越熟悉,你想如何布局你的项目会变得更加清晰。 + +#### 堆栈 + +Pulumi [堆栈][24]stack允许你根据可配置的值来区分你的 Pulumi 项目。一个常见的用途是将一个项目部署到不同的环境,如开发或生产环境,或不同的地区,如欧洲、中东和非洲以及美国。 + +在入门时,你不大需要一个复杂的堆栈设置,所以本演练使用默认的堆栈名称 `dev`。 + +### 在 IaC 中使用 TypeScript + +你可以使用方便的 `pulumi new` 命令来初建bootstrap一个 Pulumi 项目。`new` 命令有一大堆标志和选项,可以帮助你入门 Pulumi,所以请继续创建你的第一个项目: + +``` +$ pulumi new typescript +This command will walk you through creating a new Pulumi project. + +Enter a value or leave blank to accept the (default), and press . +Press ^C at any time to quit. + +project name: (pulumi) my-first-project +project description: (A minimal TypeScript Pulumi program) My very first Pulumi program +Created project 'my-first-project' + +Please enter your desired stack name. +To create a stack in an organization, use the format / (e.g. `acmecorp/dev`). +stack name: (dev) dev +Created stack 'dev' + +Installing dependencies... + + +> node scripts/postinstall + +added 82 packages from 126 contributors and audited 82 packages in 2.84s + +13 packages are looking for funding + run `npm fund` for details + +found 0 vulnerabilities + +Finished installing dependencies + +Your new project is ready to go! ✨ + +To perform an initial deployment, run 'pulumi up' +``` + +这里发生了很多事情,我将其展开来说: + +第一部分是为你的 Pulumi 项目确定一个模板。我选择了通用的 `typescript` 选项,但是有[很多选项可供选择][25]。 + +这个 `new` 命令从你的模板库中抓取模板,并将这个文件复制到本地,包括运行时的依赖关系(在本例中是 `package.json`)。 + +`new` 命令通过在这个目录下运行 `npm install` 来安装这些依赖关系。然后 `npm install` 下载并安装运行 Pulumi 程序所需的一切,在这种情况下就是:`@pulumi/pulumi` NPM 包。 + +你已经准备好创建你的第一个资源了! + +### 创建你的第一个云资源 + +资源是一个由你的基础设施供应软件生命周期进行管理的东西。资源一般是一个云提供商对象cloud provider object,比如 S3 桶。Pulumi 的提供商处理 Pulumi 资源,提供商是具体的云提供商。Pulumi 有大约 [40 个提供商][26]可供你使用,但对于你的第一个资源,使用一个最简单的:[随机提供商][27]random provider。 + +随机提供者顾名思义:它幂等地创建一个随机资源(例如,可以是一个字符串),并将其存储在 Pulumi 状态中。 + +使用 `npm` 将其添加到你的 Pulumi 项目中作为依赖关系: + +``` +npm install @pulumi/random +``` + +npm 包管理器下载并安装随机提供者包,并为你安装。现在你已经准备好编写你的 Pulumi 程序了。 + +当你之前生成你的项目时,Pulumi 的初建过程创建了一个 `index.ts` TypeScript 文件。在你喜欢的集成开发环境(IDE)中打开它,并添加你的第一个资源: + +``` +import * as pulumi from "@pulumi/pulumi"; +import * as random from "@pulumi/random"; + +const password = new random.RandomString(`password`, { +    length: 10 +}) +``` + +如果你对 TypeScript 或 JavaScript 非常熟悉,这看起来会非常熟悉,因为它是用你熟悉的编程语言编写的。如果你使用的是 Pulumi 支持的其他语言之一,也是一样的。这里是之前的那个随机资源,但这次是用 Python 写的: + +``` +import pulumi_random as random + +password = random.RandomString("password", length=10) +``` + +一个 Pulumi 项目目前只支持单一一种语言,但每个项目都可以引用其他语言编写的项目,这对于多语言团队的成员来说是一个很有用的技巧。 + +你已经编写了第一个 Pulumi 资源。现在你需要部署它。 + +离开编辑器,回到命令行。在你的项目目录下,运行 `pulumi up`,然后看着神奇的事情发生: + +``` +pulumi up + +Previewing update (dev): +     Type                          Name                  Plan + +   pulumi:pulumi:Stack           my-first-project-dev  create + +   └─ random:index:RandomString  password              create + +Resources: +    + 2 to create + +Do you want to perform this update? yes +Updating (dev): +     Type                          Name                  Status + +   pulumi:pulumi:Stack           my-first-project-dev  created + +   └─ random:index:RandomString  password              created + +Resources: +    + 2 created + +Duration: 2s + +Permalink: file:///Users/lbriggs/.pulumi/stacks/dev.json +``` + +太好了,你有了第一个 Pulumi 资源! 虽然你可能很享受这种成就感,但不幸的是,这个随机资源并没有那么有用:它只是一个随机的字符串,你甚至看不到它是什么。先解决这部分问题。修改你之前的程序,在你创建的常量中加入 `export`: + +``` +import * as pulumi from "@pulumi/pulumi"; +import * as random from "@pulumi/random"; + +export const password = new random.RandomString(`password`, { +    length: 10 +}) +``` + +重新运行 `pulumi up`,看看输出: + +``` +pulumi up +Previewing update (dev): + Type Name Plan + pulumi:pulumi:Stack my-first-project-dev + +Outputs: + + password: { + + id : "&+r?{}J$J7" + + keepers : output + + length : 10 + + lower : true + + minLower : 0 + + minNumeric : 0 + + minSpecial : 0 + + minUpper : 0 + + number : true + + overrideSpecial: output + + result : "&+r?{}J$J7" + + special : true + + upper : true + + urn : "urn:pulumi:dev::my-first-project::random:index/randomString:RandomString::password" + } + +Resources: + 2 unchanged + +Do you want to perform this update? yes +Updating (dev): + Type Name Status + pulumi:pulumi:Stack my-first-project-dev + +Outputs: + + password: { + + id : "&+r?{}J$J7" + + length : 10 + + lower : true + + minLower : 0 + + minNumeric: 0 + + minSpecial: 0 + + minUpper : 0 + + number : true + + result : "&+r?{}J$J7" + + special : true + + upper : true + + urn : "urn:pulumi:dev::my-first-project::random:index/randomString:RandomString::password" + } + +Resources: + 2 unchanged + +Duration: 1s +Permalink: file:///Users/lbriggs/.pulumi/stacks/dev.json +``` + +现在你可以在 `Outputs` 的 `result` 部分下看到一个随机生成的字符串。你现在可以看到你创建的资源有很多属性。 + +这一切都很好,但如果你想享受 IaC,你得提供一些随机字符串以外的东西。试试吧。 + +### 部署一个容器 + +到目前为止,你已经通过安装依赖关系和注册一个简单的随机资源来 体验了初建你的 Pulumi。现在部署一些实际的基础设施,尽管是在你的本地机器上。 + +首先,将 `@pulumi/docker` 提供者添加到你的堆栈中。使用你选择的包管理器将其添加到项目中: + +``` +npm install @pulumi/docker +``` + +你已经从 `npm` 下拉了 Pulumi Docker 提供商包,这意味着你现在可以在你的项目中创建 Docker 镜像。 + +如果你的机器上还没有安装 Docker,现在是一个极好的时机去安装它。说明将取决于你的操作系统,所以看看 [Docker 的安装页面][28]了解信息。 + +再次打开你喜欢的 IDE,运行一个 Docker 容器。修改你之前的 `index.ts` 文件,让它看起来像这样: + +``` +import * as pulumi from "@pulumi/pulumi"; +import * as random from "@pulumi/random"; +import * as docker from "@pulumi/docker"; + +const password = new random.RandomString(`password`, { +    length: 10 +}) + +const container = new docker.Container(`my-password`, { +    image: 'hashicorp/http-echo', +    command: [ pulumi.interpolate`-text=Your super secret password is: ${password.result}` ], +    ports: [{ +        internal: 5678, +        external: 5678, +    }] +}) + +export const id = container.id +``` + +这将创建一个容器,创建一个 Web 服务器。Web 服务器的输出是你随机生成的字符串,在本例中是一个密码。运行这个,看看会发生什么: + +``` +pulumi up + +Previewing update (dev): + Type Name Plan + pulumi:pulumi:Stack my-first-project-dev + + └─ docker:index:Container my-password create + +Outputs: + + id : output + ~ password: { + id : "&+r?{}J$J7" + length : 10 + lower : true + minLower : 0 + minNumeric: 0 + minSpecial: 0 + minUpper : 0 + number : true + result : "&+r?{}J$J7" + special : true + upper : true + urn : "urn:pulumi:dev::my-first-project::random:index/randomString:RandomString::password" + } + +Resources: + + 1 to create + 2 unchanged + +Do you want to perform this update? yes +Updating (dev): + Type Name Status + pulumi:pulumi:Stack my-first-project-dev + + └─ docker:index:Container my-password created + +Outputs: + + id : "e73b34aeca34a64b72b61b0b9b8438637ce28853937bc359a1528ca99f49ddda" + password: { + id : "&+r?{}J$J7" + length : 10 + lower : true + minLower : 0 + minNumeric: 0 + minSpecial: 0 + minUpper : 0 + number : true + result : "&+r?{}J$J7" + special : true + upper : true + urn : "urn:pulumi:dev::my-first-project::random:index/randomString:RandomString::password" + } + +Resources: + + 1 created + 2 unchanged + +Duration: 2s +Permalink: file:///Users/lbriggs/.pulumi/stacks/dev.json +``` + +你会注意到在 `Outputs` 部分,你输出的值已经改变了,它只是一个 Docker 容器 ID。检查你的非常简单的密码生成器是否工作: + +``` +curl http://localhost:5678 +Your super secret password is: &+r?{}J$J7 +``` + +就是这样! 你刚刚用 TypeScript 配置了你的第一个基础架构。 + +#### 关于 Pulumi 输出的快速说明 + +你会注意到在创建 Docker 容器的代码中,它使用了一个特殊的 `pulumi.interpolate` 调用。如果你熟悉 TypeScript,你可能会好奇为什么需要这样做(因为它是 Pulumi 特有的)。这有一个有趣的原因。 + +当 Pulumi 创建一个资源时,直到程序执行时有一些值是 Pulumi 不知道的。在 Pulumi 中,这些值被称为 `Outputs`。这些 `Outputs` 可以在上面的代码中看到,例如,在你的第一个随机资源中,你使用 `export` 关键字来输出随机资源的属性,你还输出了你创建的容器的容器 ID。 + +因为 Pulumi 直到执行时才知道这些 `Outputs` 的值,所以在操作字符串时,它需要特殊的助手来使用它们。如果你想了解更多关于这个特殊的编程模型,请观看[这个短视频][29]。 + +### 总结 + +随着混合云基础架构中出现的复杂性,IaC 在很多方面都有了发展。在基础设施供应领域,Pulumi 是一个很好的选择,它可以使用你最喜欢的编程语言来供应你所需要的一切基础设施,然后你可以在你最喜欢的配置管理工具中进行标记,以采取下一步措施。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/8/infrastructure-as-code-pulumi + +作者:[Lee Briggs][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/lbriggs +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/puzzle_computer_solve_fix_tool.png?itok=U0pH1uwj (Puzzle pieces coming together to form a computer screen) +[2]: https://opensource.com/resources/devops +[3]: https://git-scm.com/ +[4]: https://www.mercurial-scm.org/ +[5]: https://opensource.com/article/18/12/configuration-management-tools +[6]: https://opensource.com/article/20/7/terraform-kubernetes +[7]: https://www.pulumi.com/ +[8]: https://developer.mozilla.org/en-US/docs/Web/JavaScript +[9]: https://www.typescriptlang.org/ +[10]: https://golang.org/ +[11]: https://www.python.org/ +[12]: https://en.wikipedia.org/wiki/C_Sharp_(programming_language) +[13]: https://www.pulumi.com/docs/intro/cloud-providers/aws/ +[14]: https://www.pulumi.com/docs/intro/cloud-providers/azure/ +[15]: https://www.pulumi.com/docs/intro/cloud-providers/gcp/ +[16]: https://www.pulumi.com/docs/reference/pkg/ +[17]: https://nodejs.org/en/download/ +[18]: https://brew.sh/ +[19]: https://opensource.com/article/20/6/homebrew-mac +[20]: https://opensource.com/article/20/6/homebrew-linux +[21]: https://www.pulumi.com/docs/get-started/install/ +[22]: https://www.pulumi.com/docs/intro/concepts/state/ +[23]: https://www.pulumi.com/docs/intro/concepts/project/ +[24]: https://www.pulumi.com/docs/intro/concepts/stack/ +[25]: https://github.com/pulumi/templates +[26]: https://www.pulumi.com/docs/intro/cloud-providers/ +[27]: https://www.pulumi.com/docs/intro/cloud-providers/random/ +[28]: https://docs.docker.com/get-docker/ +[29]: https://www.youtube.com/watch?v=lybOxul2otM diff --git a/published/202011/20200909 How to Install Ubuntu Server on a Raspberry Pi.md b/published/202011/20200909 How to Install Ubuntu Server on a Raspberry Pi.md new file mode 100644 index 0000000000..58c77ccb7f --- /dev/null +++ b/published/202011/20200909 How to Install Ubuntu Server on a Raspberry Pi.md @@ -0,0 +1,202 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12783-1.html) +[#]: subject: (How to Install Ubuntu Server on a Raspberry Pi) +[#]: via: (https://itsfoss.com/install-ubuntu-server-raspberry-pi/) +[#]: author: (Dimitrios Savvopoulos https://itsfoss.com/author/dimitrios/) + +如何在树莓派上安装 Ubuntu 服务器? +====== + +![][6] + +[树莓派][1]是最著名的[单板计算机][2]。最初,树莓派项目的范围旨在促进学校和发展中国家的计算机基础科学的教学。 + +它的低成本、便携性和极低的功耗,使得它的受欢迎程度远远超过预期。从气象站到家庭自动化,玩家们用树莓派搭建了许多[酷炫的项目][3]。 + +[第四代树莓派][4]具备了普通台式电脑的功能和处理能力。但本文并不是要介绍如何使用树莓派作为桌面。相反,我会告诉你如何在树莓派上安装 Ubuntu 服务器。 + +在本教程中,我将使用树莓派 4,以下是我将介绍的内容: + + * 在 microSD 卡上安装 Ubuntu 服务器 + * 在树莓派上设置无线网络连接 + * 通过 SSH 访问你的树莓派 + +![][5] + +**本教程需要以下设备**: + + * 一张 micro SD 卡(建议使用 8GB 或更大的卡) + * 一台带有 micro SD 卡读卡器的计算机(运行 Linux、Windows 或 macOS) + * 树莓派 2、3 或 4 + * 良好的互联网连接 + * 用于树莓派 2 和 3 的 HDMI 线和用于树莓派 4 的 micro HDMI 线(可选) + * 一套 USB 键盘(可选) + +### 在树莓派上安装 Ubuntu 服务器 + +在本教程中,我使用 Ubuntu 来创建树莓派 SD 卡,但你可以在其他 Linux 发行版、macOS 和 Windows 上创建它。这是因为准备 SD 卡的步骤对 Raspberry Pi Imager 工具而言是一样的。 + +Raspberry Pi Imager 工具会自动下载你[选择的树莓派系统][7]镜像。这意味着你需要一个良好的网络连接来下载 1GB 左右的数据。 + +#### 步骤 1:用 Raspberry Pi Imager 准备 SD 卡 + +确保你已将 microSD 卡插入电脑,并在电脑上安装 Raspberry Pi Imager。 + +你可以从这些链接中下载适合你操作系统的 Imager 工具: + + * [用于 Ubuntu/Debian 的 Raspberry Pi Imager][8] + * [用于 Windows 的 Raspberry Pi Imager][9] + * [用于 MacOS 的 Raspberry Pi Imager][10] + +尽管我使用的是 Ubuntu,但我不会使用上面列出的 Debian 软件包,而是使用命令行安装 snap 包。这个方法可以适用于更广泛的 Linux 发行版。 + +``` +sudo snap install rpi-imager +``` + +安装好 Raspberry Pi Imager 工具后,找到并打开它,点击 “CHOOSE OS” 菜单。 + +![][11] + +滚动菜单并点击 “Ubuntu” (“核心”和“服务器”镜像)。 + +![][12] + +从可用的镜像中,我选择了 Ubuntu 20.04 LTS 64 位。如果你有一个树莓派 2,那你只能选择 32 位镜像。 + +**重要提示:如果你使用的是最新的树莓派 4 - 8 GB 内存型号,你应该选择 64 位操作系统,否则只能使用 4 GB 内存。** + +![][13] + +从 “SD Card” 菜单中选择你的 microSD 卡,然后点击 “WRITE”。 + +![][14] + +如果它显示一些错误,请尝试再次写入它。现在它将下载 Ubuntu 服务器镜像并将其写入 micro SD 卡。 + +当这个过程完成时,它将通知你。 + +![][15] + +#### 步骤 2:在 Ubuntu 服务器上添加 WiFi 支持 + +烧录完 micro SD 卡后,你就差不多可以使用它了。在使用它之前,有一件事情你可能想做,那就是添加 Wi-Fi 支持。 + +SD 卡仍然插入读卡器中,打开文件管理器,找到卡上的 “system-boot” 分区。 + +你要找的和需要编辑的文件名为 `network-config`。 + +![][16] + +这个过程也可以在 Windows 和 MacOS 上完成。如前所述,编辑 `network-config` 文件,添加你的 Wi-Fi 凭证。 + +首先,取消矩形框内的行的注释(删除开头的标签 `#`)。 + +之后,将 `myhomewifi` 替换为你的 Wi-Fi 网络名,比如 `"itsfoss"`,将 `"S3kr1t"` 替换为 Wi-Fi 密码,用引号括起来,比如 `"12345679"`。 + +![][17] + +它可能看上去像这样: + +``` +wifis: + wlan0: + dhcp4: true + optional: true + access-points: + "your wifi name": + password: "your_wifi_password" +``` + +保存文件并将 micro SD 卡插入到你的树莓派中。在第一次启动时,如果你的树莓派无法连接到 Wi-Fi 网络,只需重启你的设备。 + +#### 步骤 3:在树莓派上使用 Ubuntu 服务器(如果你有专门的显示器、键盘和鼠标的话) + +如果你有一套额外的鼠标,键盘和显示器,你可以很容易地像其他电脑一样使用树莓派(但没有 GUI)。 + +只需将 micro SD 卡插入树莓派,连接显示器、键盘和鼠标。现在[打开你的树莓派][18]。它将出现 TTY 登录屏幕(黑色终端屏幕)并询问用户名和密码。 + + * 默认用户名:`ubuntu` + * 默认密码:`ubuntu` + +看到提示符时,用 `ubuntu` 作为密码。登录成功后,[Ubuntu 会要求你更改默认密码][19]。 + +享受你的 Ubuntu 服务器吧! + +#### 步骤 3:通过 SSH 远程连接到你的树莓派(如果你没有树莓派的显示器、键盘和鼠标的话) + +如果你没有专门与树莓派一起使用的显示器也没关系。当你可以直接通过 SSH 进入它并按照你的方式使用它时,谁还需要一个带有显示器的服务器呢? + +**在 Ubuntu 和 Mac OS**上,通常已经安装了一个 SSH 客户端。要远程连接到你的树莓派,你需要找到它的 IP 地址。检查[连接到你的网络的设备][20],看看哪个是树莓派。 + +由于我没有 Windows 机器,你可以访问[微软][21]提供的综合指南。 + +打开终端,运行以下命令: + +``` +ssh ubuntu@raspberry_pi_ip_address +``` + +你可能会看到以下信息确认连接: + +``` +Are you sure you want to continue connecting (yes/no/[fingerprint])? +``` + +输入 `yes`,然后点击回车键。 + +![][22] + +当提示时,用前面提到的 `ubuntu` 作为密码。当然,你会被要求更改密码。 + +完成后,你将自动注销,你必须使用新密码重新连接。 + +你的 Ubuntu 服务器就可以在树莓派上运行了! + +### 总结 + +在树莓派上安装 Ubuntu 服务器是一个简单的过程,而且它的预配置程度很高,使用起来很愉快。 + +我不得不说,在所有[我在树莓派上尝试的操作系统][7]中,Ubuntu 服务器是最容易安装的。我并没有夸大其词。请查看我的[在树莓派上安装 Arch Linux][23] 的指南,以供参考。 + +希望这篇指南也能帮助你在树莓派上安装 Ubuntu 服务器。如果你有问题或建议,请在评论区告诉我。 + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/install-ubuntu-server-raspberry-pi/ + +作者:[Dimitrios Savvopoulos][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://itsfoss.com/author/dimitrios/ +[b]: https://github.com/lujun9972 +[1]: https://www.raspberrypi.org/ +[2]: https://itsfoss.com/raspberry-pi-alternatives/ +[3]: https://itsfoss.com/raspberry-pi-projects/ +[4]: https://itsfoss.com/raspberry-pi-4/ +[5]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/09/Ubuntu-Server-20.04.1-LTS-aarch64.png?resize=800%2C600&ssl=1 +[6]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/09/ubuntu-server-raspberry-pi.png?resize=800%2C450&ssl=1 +[7]: https://itsfoss.com/raspberry-pi-os/ +[8]: https://downloads.raspberrypi.org/imager/imager_amd64.deb +[9]: https://downloads.raspberrypi.org/imager/imager.exe +[10]: https://downloads.raspberrypi.org/imager/imager.dmg +[11]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/09/raspberry-pi-imager.png?resize=800%2C600&ssl=1 +[12]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/09/raspberry-pi-imager-choose-ubuntu.png?resize=800%2C600&ssl=1 +[13]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/09/raspberry-pi-imager-ubuntu-server.png?resize=800%2C600&ssl=1 +[14]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/09/raspberry-pi-imager-sd-card.png?resize=800%2C600&ssl=1 +[15]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/09/ubuntu-server-installed-raspberry-pi.png?resize=799%2C506&ssl=1 +[16]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/09/ubuntu-server-pi-network-config.png?resize=800%2C565&ssl=1 +[17]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/09/Ubuntu-server-wifi.png?resize=800%2C600&ssl=1 +[18]: https://itsfoss.com/turn-on-raspberry-pi/ +[19]: https://itsfoss.com/change-password-ubuntu/ +[20]: https://itsfoss.com/how-to-find-what-devices-are-connected-to-network-in-ubuntu/ +[21]: https://docs.microsoft.com/en-us/windows-server/administration/openssh/openssh_install_firstuse +[22]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/09/ubuntu-server-change-password.png?resize=800%2C600&ssl=1 +[23]: https://itsfoss.com/install-arch-raspberry-pi/ diff --git a/published/202011/20200918 Add throwing mechanics to your Python game.md b/published/202011/20200918 Add throwing mechanics to your Python game.md new file mode 100644 index 0000000000..b9540d8444 --- /dev/null +++ b/published/202011/20200918 Add throwing mechanics to your Python game.md @@ -0,0 +1,665 @@ +[#]: collector: (lujun9972) +[#]: translator: (robsean) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12872-1.html) +[#]: subject: (Add throwing mechanics to your Python game) +[#]: via: (https://opensource.com/article/20/9/add-throwing-python-game) +[#]: author: (Seth Kenlon https://opensource.com/users/seth) + +在你的 Python 游戏中添加投掷机制 +====== + +> 四处奔跑躲避敌人是一回事,反击敌人是另一回事。学习如何在这系列的第十二篇文章中在 Pygame 中创建平台游戏。 + +![](https://img.linux.net.cn/data/attachment/album/202011/30/124457xcj9mztw9kx9c7zj.jpg) + +这是仍在进行中的关于使用 [Pygame][3] 模块在 [Python 3][2] 中创建电脑游戏的第十二部分。先前的文章是: + + 1. [通过构建一个简单的掷骰子游戏去学习怎么用 Python 编程][4] + 2. [使用 Python 和 Pygame 模块构建一个游戏框架][5] + 3. [如何在你的 Python 游戏中添加一个玩家][6] + 4. [用 Pygame 使你的游戏角色移动起来][7] + 5. [如何向你的 Python 游戏中添加一个敌人][8] + 6. [在 Pygame 游戏中放置平台][9] + 7. [在你的 Python 游戏中模拟引力][10] + 8. [为你的 Python 平台类游戏添加跳跃功能][11] + 9. [使你的 Python 游戏玩家能够向前和向后跑][12] + 10. [在你的 Python 平台类游戏中放一些奖励][13] + 11. [添加计分到你的 Python 游戏][14] + +我的上一篇文章本来是这一系列文章的最后一篇,它鼓励你为这个游戏编写自己的附加程序。你们很多人都这么做了!我收到了一些电子邮件,要求帮助我还没有涵盖的常用机制:战斗。毕竟,跳起来躲避坏人是一回事,但是有时候让他们走开是一件非常令人满意的事。在电脑游戏中向你的敌人投掷一些物品是很常见的,不管是一个火球、一支箭、一道闪电,还是其它适合游戏的东西。 + +与迄今为止你在这个系列中为你的平台游戏编程的任何东西不同,可投掷物品有一个*生存时间*。在你投掷一个物品后,它会如期在移动一段距离后消失。如果它是一支箭或其它类似的东西,它可能会在通过屏幕的边缘时而消失。如果它是一个火球或一道闪电,它可能会在一段时间后熄灭。 + +这意味着每次生成一个可投掷的物品时,也必须生成一个独特的衡量其生存时间的标准。为了介绍这个概念,这篇文章演示如何一次只投掷一个物品。(换句话说,每次仅存在一个投掷物品)。 一方面,这是一个游戏的限制条件,但另一方面,它却是游戏本身的运行机制。你的玩家不能每次同时投掷 50 个火球,因为每次仅允许一个投掷物品,所以当你的玩家释放一个火球来尝试击中一名敌人就成为了一项挑战。而在幕后,这也使你的代码保持简单。 + +如果你想启用每次投掷多个项目,在完成这篇教程后,通过学习这篇教程所获取的知识来挑战你自己。 + +### 创建 Throwable 类 + +如果你跟随学习这系列的其它文章,那么你应该熟悉在屏幕上生成一个新的对象基础的 `__init__` 函数。这和你用来生成你的 [玩家][6] 和 [敌人][8] 的函数是一样的。这里是生成一个 `throwable` 对象的 `__init__` 函数来: + +``` +class Throwable(pygame.sprite.Sprite): + """ + 生成一个 throwable 对象 + """ + def __init__(self, x, y, img, throw): + pygame.sprite.Sprite.__init__(self) + self.image = pygame.image.load(os.path.join('images',img)) + self.image.convert_alpha() + self.image.set_colorkey(ALPHA) + self.rect = self.image.get_rect() + self.rect.x = x + self.rect.y = y + self.firing = throw +``` + +同你的 `Player` 类或 `Enemy` 类的 `__init__` 函数相比,这个函数的主要区别是,它有一个 `self.firing` 变量。这个变量保持跟踪一个投掷的物品是否在当前屏幕上活动,因此当一个 `throwable` 对象创建时,将变量设置为 `1` 的合乎情理的。 + +### 判断存活时间 + +接下来,就像使用 `Player` 和 `Enemy` 一样,你需要一个 `update` 函数,以便投掷的物品在瞄准敌人抛向空中时,它会自己移动。 + +测定一个投掷的物品存活时间的最简单方法是侦测它何时离开屏幕。你需要监视的屏幕边缘取决于你投掷的物品的物理特性。 + + * 如果你的玩家正在投掷的物品是沿着水平轴快速移动的,像一只弩箭或箭或一股非常快的魔法力量,而你想监视你游戏屏幕的水平轴极限。这可以通过 `worldx` 定义。 + * 如果你的玩家正在投掷的物品是沿着垂直方向或同时沿着水平方向和垂直方向移动的,那么你必须监视你游戏屏幕的垂直轴极限。这可以通过 `worldy` 定义。 + +这个示例假设你投掷的物品向前移动一点并最终落到地面上。不过,投掷的物品不会从地面上反弹起来,而是继续掉落出屏幕。你可以尝试不同的设置来看看什么最适合你的游戏: + +``` + def update(self,worldy): + ''' + 投掷物理学 + ''' + if self.rect.y < worldy: #垂直轴 + self.rect.x += 15 #它向前移动的速度有多快 + self.rect.y += 5 #它掉落的速度有多快 + else: + self.kill() #移除投掷对象 + self.firing = 0 #解除火力发射 +``` + +为使你的投掷物品移动地更快,增加 `self.rect` 的动量值。 + +如果投掷物品不在屏幕上,那么该物品将被销毁,以及释放其所占用的寄存器。另外,`self.firing` 将被设置回 `0` 以允许你的玩家来进行另一次射击。 + +### 设置你的投掷对象 + +就像使用你的玩家和敌人一样,你必须在你的设置部分中创建一个精灵组来保持投掷对象。 + +此外,你必须创建一个非活动的投掷对象来供开始的游戏使用。如果在游戏开始时却没有一个投掷对象,那么玩家在第一次尝试投掷一柄武器时,投掷将失败。 + +这个示例假设你的玩家使用一个火球作为开始的武器,因此,每一个投掷实例都是由 `fire` 变量指派的。在后面的关卡中,当玩家获取新的技能时,你可以使用相同的 `Throwable` 类来引入一个新的变量以使用一张不同的图像。 + +在这代码块中,前两行已经在你的代码中,因此不要重新键入它们: + +``` +player_list = pygame.sprite.Group() #上下文 +player_list.add(player) #上下文 +fire = Throwable(player.rect.x,player.rect.y,'fire.png',0) +firepower = pygame.sprite.Group() +``` + +注意,每一个投掷对象的起始位置都是和玩家所在的位置相同。这使得它看起来像是投掷对象来自玩家。在第一个火球生成时,使用 `0` 来显示 `self.firing` 是可用的。 + +### 在主循环中获取投掷行为 + +没有在主循环中出现的代码不会在游戏中使用,因此你需要在你的主循环中添加一些东西,以便能在你的游戏世界中获取投掷对象。 + +首先,添加玩家控制。当前,你没有火力触发器。在键盘上的按键是有两种状态的:释放的按键,按下的按键。为了移动,你要使用这两种状态:按下按键来启动玩家移动,释放按键来停止玩家移动。开火仅需要一个信号。你使用哪个按键事件(按键按下或按键释放)来触发你的投掷对象取决于你的品味。 + +在这个代码语句块中,前两行是用于上下文的: + +``` + if event.key == pygame.K_UP or event.key == ord('w'): + player.jump(platform_list) + if event.key == pygame.K_SPACE: + if not fire.firing: + fire = Throwable(player.rect.x,player.rect.y,'fire.png',1) + firepower.add(fire) +``` + +与你在设置部分创建的火球不同,你使用一个 `1` 来设置 `self.firing` 为不可用。 + +最后,你必须更新和绘制你的投掷物品。这个顺序很重要,因此把这段代码放置到你现有的 `enemy.move` 和 `player_list.draw` 的代码行之间: + +``` + enemy.move() # 上下文 + + if fire.firing: + fire.update(worldy) + firepower.draw(world) + player_list.draw(screen) # 上下文 + enemy_list.draw(screen) # 上下文 +``` + +注意,这些更新仅在 `self.firing` 变量被设置为 1 时执行。如果它被设置为 0 ,那么 `fire.firing` 就不为 `true`,接下来就跳过更新。如果你尝试做上述这些更新,不管怎样,你的游戏都会崩溃,因为在游戏中将不会更新或绘制一个 `fire` 对象。 + +启动你的游戏,尝试挑战你的武器。 + +### 检测碰撞 + +如果你玩使用了新投掷技巧的游戏,你可能会注意到,你可以投掷对象,但是它却不会对你的敌人有任何影响。 + +原因是你的敌人没有被查到碰撞事故。一名敌人可能会被你的投掷物品所击中,但是敌人却从来不知道被击中了。 + +你已经在你的 `Player` 类中完成了碰撞检测,这非常类似。在你的 `Enemy` 类中,添加一个新的 `update` 函数: + +``` + def update(self,firepower, enemy_list): + """ + 检测火力碰撞 + """ + fire_hit_list = pygame.sprite.spritecollide(self,firepower,False) + for fire in fire_hit_list: + enemy_list.remove(self) +``` + +代码很简单。每个敌人对象都检查并看看它自己是否被 `firepower` 精灵组的成员所击中。如果它被击中,那么敌人就会从敌人组中移除和消失。 + +为集成这些功能到你的游戏之中,在主循环中调用位于新触发语句块中的函数: + +``` + if fire.firing: # 上下文 + fire.update(worldy) # 上下文 + firepower.draw(screen) # 上下文 + enemy_list.update(firepower,enemy_list) # 更新敌人 +``` + +你现在可以尝试一下你的游戏了,大多数的事情都如预期般的那样工作。不过,这里仍然有一个问题,那就是投掷的方向。 + +### 更改投掷机制的方向 + +当前,你英雄的火球只会向右移动。这是因为 `Throwable` 类的 `update` 函数将像素添加到火球的位置,在 Pygame 中,在 X 轴上一个较大的数字意味着向屏幕的右侧移动。当你的英雄转向另一个方向时,你可能希望它投掷的火球也抛向左侧。 + +到目前为止,你已经知道如何实现这一点,至少在技术上是这样的。然而,最简单的解决方案却是使用一个变量,在一定程度上对你来说可能是一种新的方法。一般来说,你可以“设置一个标记”(有时也被称为“翻转一个位”)来标明你的英雄所面向的方向。在你做完后,你就可以检查这个变量来得知火球是向左移动还是向右移动。 + +首先,在你的 `Player` 类中创建一个新的变量来代表你的游戏所面向的方向。因为我的游戏天然地面向右侧,由此我把面向右侧作为默认值: + +``` + self.score = 0 + self.facing_right = True # 添加这行 + self.is_jumping = True +``` + +当这个变量是 `True` 时,你的英雄精灵是面向右侧的。当玩家每次更改英雄的方向时,变量也必须重新设置,因此,在你的主循环中相关的 `keyup` 事件中这样做: + +``` + if event.type == pygame.KEYUP: + if event.key == pygame.K_LEFT or event.key == ord('a'): + player.control(steps, 0) + player.facing_right = False # 添加这行 + if event.key == pygame.K_RIGHT or event.key == ord('d'): + player.control(-steps, 0) + player.facing_right = True # 添加这行 +``` + +最后,更改你的 `Throwable` 类的 `update` 函数,以检测英雄是否面向右侧,并恰当地添加或减去来自火球位置的像素: + +``` + if self.rect.y < worldy: + if player.facing_right: + self.rect.x += 15 + else: + self.rect.x -= 15 + self.rect.y += 5 +``` + +再次尝试你的游戏,清除掉你游戏世界中的一些坏人。 + +![Python 平台类使用投掷能力][15] + +作为一项额外的挑战,当彻底打败敌人时,尝试增加你玩家的得分。 + +### 完整的代码 + +``` +#!/usr/bin/env python3 +# 作者: Seth Kenlon + +# GPLv3 +# This program is free software: you can redistribute it and/or +# modify it under the terms of the GNU General Public License as +# published by the Free Software Foundation, either version 3 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see <[http://www.gnu.org/licenses/>][17]. + +import pygame +import pygame.freetype +import sys +import os + +''' +变量 +''' + +worldx = 960 +worldy = 720 +fps = 40 +ani = 4 +world = pygame.display.set_mode([worldx, worldy]) +forwardx = 600 +backwardx = 120 + +BLUE = (80, 80, 155) +BLACK = (23, 23, 23) +WHITE = (254, 254, 254) +ALPHA = (0, 255, 0) + +tx = 64 +ty = 64 + +font_path = os.path.join(os.path.dirname(os.path.realpath(__file__)), "fonts", "amazdoom.ttf") +font_size = tx +pygame.freetype.init() +myfont = pygame.freetype.Font(font_path, font_size) + +''' +对象 +''' + +def stats(score, health): + myfont.render_to(world, (4, 4), "Score:"+str(score), BLUE, None, size=64) + myfont.render_to(world, (4, 72), "Health:"+str(health), BLUE, None, size=64) + +class Throwable(pygame.sprite.Sprite): + """ + 生成一个投掷的对象 + """ + def __init__(self, x, y, img, throw): + pygame.sprite.Sprite.__init__(self) + self.image = pygame.image.load(os.path.join('images', img)) + self.image.convert_alpha() + self.image.set_colorkey(ALPHA) + self.rect = self.image.get_rect() + self.rect.x = x + self.rect.y = y + self.firing = throw + + def update(self, worldy): + ''' + 投掷物理学 + ''' + if self.rect.y < worldy: + if player.facing_right: + self.rect.x += 15 + else: + self.rect.x -= 15 + self.rect.y += 5 + else: + self.kill() + self.firing = 0 + +# x 位置, y 位置, img 宽度, img 高度, img 文件 +class Platform(pygame.sprite.Sprite): + def __init__(self, xloc, yloc, imgw, imgh, img): + pygame.sprite.Sprite.__init__(self) + self.image = pygame.image.load(os.path.join('images', img)).convert() + self.image.convert_alpha() + self.image.set_colorkey(ALPHA) + self.rect = self.image.get_rect() + self.rect.y = yloc + self.rect.x = xloc + +class Player(pygame.sprite.Sprite): + """ + 生成一名玩家 + """ + + def __init__(self): + pygame.sprite.Sprite.__init__(self) + self.movex = 0 + self.movey = 0 + self.frame = 0 + self.health = 10 + self.damage = 0 + self.score = 0 + self.facing_right = True + self.is_jumping = True + self.is_falling = True + self.images = [] + for i in range(1, 5): + img = pygame.image.load(os.path.join('images', 'walk' + str(i) + '.png')).convert() + img.convert_alpha() + img.set_colorkey(ALPHA) + self.images.append(img) + self.image = self.images[0] + self.rect = self.image.get_rect() + + def gravity(self): + if self.is_jumping: + self.movey += 3.2 + + def control(self, x, y): + """ + 控制玩家移动 + """ + self.movex += x + + def jump(self): + if self.is_jumping is False: + self.is_falling = False + self.is_jumping = True + + def update(self): + """ + 更新精灵位置 + """ + + # 向左移动 + if self.movex < 0: + self.is_jumping = True + self.frame += 1 + if self.frame > 3 * ani: + self.frame = 0 + self.image = pygame.transform.flip(self.images[self.frame // ani], True, False) + + # 向右移动 + if self.movex > 0: + self.is_jumping = True + self.frame += 1 + if self.frame > 3 * ani: + self.frame = 0 + self.image = self.images[self.frame // ani] + + # 碰撞 + enemy_hit_list = pygame.sprite.spritecollide(self, enemy_list, False) + if self.damage == 0: + for enemy in enemy_hit_list: + if not self.rect.contains(enemy): + self.damage = self.rect.colliderect(enemy) + if self.damage == 1: + idx = self.rect.collidelist(enemy_hit_list) + if idx == -1: + self.damage = 0 # 设置伤害回 0 + self.health -= 1 # 减去 1 单位健康度 + + ground_hit_list = pygame.sprite.spritecollide(self, ground_list, False) + for g in ground_hit_list: + self.movey = 0 + self.rect.bottom = g.rect.top + self.is_jumping = False # 停止跳跃 + + # 掉落世界 + if self.rect.y > worldy: + self.health -=1 + print(self.health) + self.rect.x = tx + self.rect.y = ty + + plat_hit_list = pygame.sprite.spritecollide(self, plat_list, False) + for p in plat_hit_list: + self.is_jumping = False # 停止跳跃 + self.movey = 0 + if self.rect.bottom <= p.rect.bottom: + self.rect.bottom = p.rect.top + else: + self.movey += 3.2 + + if self.is_jumping and self.is_falling is False: + self.is_falling = True + self.movey -= 33 # 跳跃多高 + + loot_hit_list = pygame.sprite.spritecollide(self, loot_list, False) + for loot in loot_hit_list: + loot_list.remove(loot) + self.score += 1 + print(self.score) + + plat_hit_list = pygame.sprite.spritecollide(self, plat_list, False) + + self.rect.x += self.movex + self.rect.y += self.movey + +class Enemy(pygame.sprite.Sprite): + """ + 生成一名敌人 + """ + + def __init__(self, x, y, img): + pygame.sprite.Sprite.__init__(self) + self.image = pygame.image.load(os.path.join('images', img)) + self.image.convert_alpha() + self.image.set_colorkey(ALPHA) + self.rect = self.image.get_rect() + self.rect.x = x + self.rect.y = y + self.counter = 0 + + def move(self): + """ + 敌人移动 + """ + distance = 80 + speed = 8 + + if self.counter >= 0 and self.counter <= distance: + self.rect.x += speed + elif self.counter >= distance and self.counter <= distance * 2: + self.rect.x -= speed + else: + self.counter = 0 + + self.counter += 1 + + def update(self, firepower, enemy_list): + """ + 检测火力碰撞 + """ + fire_hit_list = pygame.sprite.spritecollide(self, firepower, False) + for fire in fire_hit_list: + enemy_list.remove(self) + +class Level: + def ground(lvl, gloc, tx, ty): + ground_list = pygame.sprite.Group() + i = 0 + if lvl == 1: + while i < len(gloc): + ground = Platform(gloc[i], worldy - ty, tx, ty, 'tile-ground.png') + ground_list.add(ground) + i = i + 1 + + if lvl == 2: + print("Level " + str(lvl)) + + return ground_list + + def bad(lvl, eloc): + if lvl == 1: + enemy = Enemy(eloc[0], eloc[1], 'enemy.png') + enemy_list = pygame.sprite.Group() + enemy_list.add(enemy) + if lvl == 2: + print("Level " + str(lvl)) + + return enemy_list + + # x 位置, y 位置, img 宽度, img 高度, img 文件 + def platform(lvl, tx, ty): + plat_list = pygame.sprite.Group() + ploc = [] + i = 0 + if lvl == 1: + ploc.append((200, worldy - ty - 128, 3)) + ploc.append((300, worldy - ty - 256, 3)) + ploc.append((550, worldy - ty - 128, 4)) + while i < len(ploc): + j = 0 + while j <= ploc[i][2]: + plat = Platform((ploc[i][0] + (j * tx)), ploc[i][1], tx, ty, 'tile.png') + plat_list.add(plat) + j = j + 1 + print('run' + str(i) + str(ploc[i])) + i = i + 1 + + if lvl == 2: + print("Level " + str(lvl)) + + return plat_list + + def loot(lvl): + if lvl == 1: + loot_list = pygame.sprite.Group() + loot = Platform(tx*5, ty*5, tx, ty, 'loot_1.png') + loot_list.add(loot) + + if lvl == 2: + print(lvl) + + return loot_list + +''' +Setup 部分 +''' + +backdrop = pygame.image.load(os.path.join('images', 'stage.png')) +clock = pygame.time.Clock() +pygame.init() +backdropbox = world.get_rect() +main = True + +player = Player() # 生成玩家 +player.rect.x = 0 # 转到 x +player.rect.y = 30 # 转到 y +player_list = pygame.sprite.Group() +player_list.add(player) +steps = 10 +fire = Throwable(player.rect.x, player.rect.y, 'fire.png', 0) +firepower = pygame.sprite.Group() + +eloc = [] +eloc = [300, worldy-ty-80] +enemy_list = Level.bad(1, eloc) +gloc = [] + +i = 0 +while i <= (worldx / tx) + tx: + gloc.append(i * tx) + i = i + 1 + +ground_list = Level.ground(1, gloc, tx, ty) +plat_list = Level.platform(1, tx, ty) +enemy_list = Level.bad( 1, eloc ) +loot_list = Level.loot(1) + +''' +主循环 +''' + +while main: + for event in pygame.event.get(): + if event.type == pygame.QUIT: + pygame.quit() + try: + sys.exit() + finally: + main = False + + if event.type == pygame.KEYDOWN: + if event.key == ord('q'): + pygame.quit() + try: + sys.exit() + finally: + main = False + if event.key == pygame.K_LEFT or event.key == ord('a'): + player.control(-steps, 0) + if event.key == pygame.K_RIGHT or event.key == ord('d'): + player.control(steps, 0) + if event.key == pygame.K_UP or event.key == ord('w'): + player.jump() + + if event.type == pygame.KEYUP: + if event.key == pygame.K_LEFT or event.key == ord('a'): + player.control(steps, 0) + player.facing_right = False + if event.key == pygame.K_RIGHT or event.key == ord('d'): + player.control(-steps, 0) + player.facing_right = True + if event.key == pygame.K_SPACE: + if not fire.firing: + fire = Throwable(player.rect.x, player.rect.y, 'fire.png', 1) + firepower.add(fire) + + # 向向滚动世界 + if player.rect.x >= forwardx: + scroll = player.rect.x - forwardx + player.rect.x = forwardx + for p in plat_list: + p.rect.x -= scroll + for e in enemy_list: + e.rect.x -= scroll + for l in loot_list: + l.rect.x -= scroll + + # 向后滚动世界 + if player.rect.x <= backwardx: + scroll = backwardx - player.rect.x + player.rect.x = backwardx + for p in plat_list: + p.rect.x += scroll + for e in enemy_list: + e.rect.x += scroll + for l in loot_list: + l.rect.x += scroll + + world.blit(backdrop, backdropbox) + player.update() + player.gravity() + player_list.draw(world) + if fire.firing: + fire.update(worldy) + firepower.draw(world) + enemy_list.draw(world) + enemy_list.update(firepower, enemy_list) + loot_list.draw(world) + ground_list.draw(world) + plat_list.draw(world) + for e in enemy_list: + e.move() + stats(player.score, player.health) + pygame.display.flip() + clock.tick(fps) +``` + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/9/add-throwing-python-game + +作者:[Seth Kenlon][a] +选题:[lujun9972][b] +译者:[robsean](https://github.com/robsean) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/seth +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/game_pawn_grid_linux.png?itok=4gERzRkg (Gaming on a grid with penguin pawns) +[2]: https://www.python.org/ +[3]: https://www.pygame.org/news +[4]: https://linux.cn/article-9071-1.html +[5]: https://linux.cn/article-10850-1.html +[6]: https://linux.cn/article-10858-1.html +[7]: https://linux.cn/article-10874-1.html +[8]: https://linux.cn/article-10883-1.html +[9]: https://linux.cn/article-10902-1.html +[10]: https://linux.cn/article-11780-1.html +[11]: https://linux.cn/article-11790-1.html +[12]: https://linux.cn/article-11819-1.html +[13]: https://linux.cn/article-11828-1.html +[14]: https://linux.cn/article-11839-1.html +[15]: https://opensource.com/sites/default/files/uploads/pygame-throw.jpg (Python platformer with throwing capability) +[16]: https://creativecommons.org/licenses/by-sa/4.0/ +[17]: http://www.gnu.org/licenses/\> diff --git a/published/202011/20200922 Easily set image transparency using GIMP.md b/published/202011/20200922 Easily set image transparency using GIMP.md new file mode 100644 index 0000000000..435c5e3b37 --- /dev/null +++ b/published/202011/20200922 Easily set image transparency using GIMP.md @@ -0,0 +1,136 @@ +[#]: collector: (lujun9972) +[#]: translator: (robsean) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12874-1.html) +[#]: subject: (Easily set image transparency using GIMP) +[#]: via: (https://opensource.com/article/20/9/chroma-key-gimp) +[#]: author: (Seth Kenlon https://opensource.com/users/seth) + +使用 GIMP 轻松地设置图片透明度 +====== + +> 使用色键(绿屏)技巧来设置你电脑游戏中图片的透明度。 + +![](https://img.linux.net.cn/data/attachment/album/202011/30/223815rdmrgx1109ngng0g.jpg) + +不管你是否正在使用 [Python][2] 或 [Lua][3] 编程一个游戏或一个 APP,你都有可能在你的游戏资源中使用 PNG 图像。PNG 格式图像的一个优点是能够存储一个 **alpha 通道**,这在一个 JPEG 格式的图像中是不可能获得的。alpha 在本质上是不可见的或透明的“颜色”。alpha 是你图像 _不可见_ 的一部分。例如,你要绘制一个甜甜圈,甜甜圈的空洞将使用 alpha 填充,你就可以看到它后面的任何东西。 + +一个常见的问题是如何找到一幅图像的 alpha 部分。有时你的编程框架,不管它是 [Python Arcade][4]、[Pygame][5]、LÖVE,或者其它的任何东西都会检测出 alpha 通道,(在适当地调用函数后)将其作为透明处理。这意味着它将不会在 alpha 部分来渲染新的像素,而留下甜甜圈的空洞。100% 是透明的,0% 是不透明的,在功能上起到“不可见”的作用。 + +有些时候,你的框架与你的图像资源在 alpha 通道的位置上是不一致的(或者,alpha 通道根本就不存在),你在你想要透明度的地方却得到像素。 + +这篇文章描述了我所知道的最可靠的方法来解决透明度的问题。 + +### 色键 + +在计算机图形学中,有一些有助于确定每一个像素是如何渲染的值。色度Chrominance(或者 chroma),描述一个像素的饱和度或强度。色键chroma key技术(也称为绿屏green screening)最初是作为一种化学工艺而发展起来的,在复印一张底片时,使用一种特定的 **无光泽** 的颜色(最初是蓝色,后来是绿色)来故意遮掩,以允许使用另一幅图像来取代曾经有蓝色或绿色屏幕的地方。这是一种简化的解释,但是它说明了计算机图形学中被称为 alpha 通道的起源。 + +alpha 通道是保存在图像中的信息,用以标识要透明的像素。例如,RGB 图像有红、绿、蓝通道。RGBA 图像包含红、绿、蓝通道,以及 alpha 通道。alpha 值的范围可以从 0 到 1 ,使用小数是也有效的。 + +因为一个 alpha 通道可以用几种不同的方法表达,因此依赖于嵌入的 alpha 通道可能是有问题的。作为替代方案,你可以在你的游戏框架中选择一种颜色并将其转化为一个 0 的 alpha 值。要做到这一点,你必须知道在你图像中的颜色值。 + +### 准备你的图片 + +要准备一个专门为色度键保留明确颜色的图形,在你最喜欢的图片编辑器中打开图片。我建议使用 [GIMP][6] 或 [Glimpse][7],但是 [mtPaint][8] 或 [Pinta][9],甚至 [Inkscape][10] 也能很好地工作,这取决于你的图像的性质,以及你将这些操作指南转换到一种不同图片编辑器工具的能力。 + +首先打开这幅 Tux 企鹅的图像: + +![Tux 企鹅][11] + +### 选择图片 + +在图片打开后,转到 **窗口** 菜单,选择 **可停靠对话框** ,接下来选择 **图层**。在 **图层** 面板中 Tux 图层上右击。从弹出菜单中,选择 **Alpha 到选区** 。如果你的图像没有内置的 alpha 通道,那么你必须手动创建你自己的选区。 + +![Alpha 到选区][13] + +为手动创建一个选区,单击来自工具箱的 **路径** 工具。 + +![GIMP 的路径工具][14] + +使用 **路径** 工具,在图像周围移动鼠标,在其轮廓的每个主要交叉点处都单击和释放(不要拖动)。 不要担心沿着曲线走;只需要找到主要的交叉点和拐角。这将在每个点处创建一个节点,并在节点中间绘制一条条线段。你不需要闭合你的路径,因此当你最后到达你开始时的交叉点时,你就完成了。 + +![在 GIMP 中创建一个路径][15] + +在你创建你的轮廓路径后,转到 **窗口** 菜单,选择 **可停靠对话框** ,接下来选择 **工具选项** 。在 **工具选项** 面板中,选择 **编辑 (Ctrl)** 。随着这项操作的激活,你可以编辑你刚刚通过单击线或单击节点绘制的路径,并通过调整它们来更好地适应你的图像。你甚至能够将直线弯曲。 + +![编辑路径][16] + +现在从 **窗口 > 可停靠对话框** 菜单中选择 **路径** 面板。在 **路径** 面板中,单击 **路径到选区** 按钮。你的绘图现在已经被选中了。 + +### 扩大选区 + +如果你觉得你的选区太紧贴了,你可以通过扩大来给予你自己的选区一些富余。当我想在一张图像周围采用或加厚一个边框时,我有时会这么扩大选区。 + +为扩大一个选区,单击 **选择** 菜单,选择 **扩大** 。输入一个像素值并单击 **确定** 。 + +### 反转选区 + +你已经选择了你的图形,但是你真正想选择的东西却 _不包括_ 你所选择的图像。这是因为你要创建一个 alpha 蒙版来定义图像中的一些内容的来被其它一些内容所替换。换句话说,你需要标记那些将被转变为不可见的像素。 + +为了反转选择区,单击 **选择** 菜单,选择 **反转** 。现在除你的图像以外的一切东西都是被选择的。 + +### 使用 alpha 填充 + +随着选择了除了你的图像以外的一切东西,再选择你想使用的颜色来指定你的 alpha 蒙版。最常用的颜色是绿色(正如你可能从术语“绿屏”中所猜到的一样)。绿色不是什么神奇的颜色,甚至也不是特定的绿色色调。之所以使用它是因为人们经常处理不包含绿色色素的图像,这样人们能够很容易分离出绿色,而不会意外地分离出图像中重要的部分。当然,如果你的图像是一位绿色的外星人或一枚绿宝石或一些 _确实_ 包含绿色的东西,那么你应该使用一种不同的颜色。只要你所选择的颜色是单一的单色,那么你就可以使用你所希望的任意颜色。如果你正在处理很多图像,你的选择应该在所有图像中保持一致。 + +![在工具箱中的前景色][17] + +使用你选择的颜色值来设置你的前景色。为确保你的选择是精确的,使用 [HTML][18] 或 [HSV][19] 表示的颜色。例如,如果你正在使用纯绿色,它可以在 GIMP(以及大多数的开放源码图像应用程序)中表示为 `00ff00`(`00` 是红色,`FF` 是绿色,`00` 是蓝色,`F` 是最大值)。 + +![设置颜色值][20] + +不管你选择什么颜色,务必记录下 HTML 或 HSV 的值,以便你可以为每一张图像使用完全相同的颜色。 + +为填充你的 alpha 蒙版,单击 **编辑** 菜单,选择 **使用前景色填充** 。 + +### 平整和导出 + +如果你在你的图像周围留下边框,设置背景颜色来着色你想使用的边界笔刷。这通常是黑色或白色,但是它也可以是任何适宜你游戏审美观的颜色。 + +在你设置背景颜色后,单击 **图像** 菜单,选择 **平整图像**。不管你是否添加了边框,这样做都是安全的。这个过程将从图像中移除 alpha 通道,并使用背景色填充任何“透明的”像素。 + +![平整图像][21] + +你现在已经为你的游戏引擎准备好了一张图像。导出图像为你的游戏引擎喜欢的任何格式,接下来使用游戏引擎所需要的每一个函数来将图像导入的你的游戏中。在的代码中,设置 alpha 值为 `00ff00`(或你使用的任何颜色),接下来使用游戏引擎的图像转换器来将该颜色作为 alpha 通道处理。 + +### 其它的方法 + +这不是唯一能在你游戏图像中获取透明度的方法。查看你游戏引擎的文档来找出它是如何默认尝试处理 alpha 通道的,在你不确定的时候,尝试让你的游戏引擎来自动侦测图像中透明度,然后再去编辑它。有时,你游戏引擎的预期值和你图像的预设值恰巧匹配,那么你就可以直接获取透明度,而不需要做任何额外的工作。 + +不过,当这些尝试都失败时,尝试一下色键。它为电影业工作了将近 100 年,它也可以为你工作。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/9/chroma-key-gimp + +作者:[Seth Kenlon][a] +选题:[lujun9972][b] +译者:[robsean](https://github.com/robsean) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/seth +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/gaming_grid_penguin.png?itok=7Fv83mHR (Gaming with penguin pawns) +[2]: https://opensource.com/article/17/10/python-101 +[3]: https://opensource.com/article/17/4/how-program-games-raspberry-pi +[4]: https://opensource.com/article/18/4/easy-2d-game-creation-python-and-arcade +[5]: https://opensource.com/article/17/12/game-framework-python +[6]: http://gimp.org +[7]: https://glimpse-editor.github.io +[8]: https://opensource.com/article/17/2/mtpaint-pixel-art-animated-gifs +[9]: https://www.pinta-project.com/ +[10]: http://inkscape.org +[11]: https://opensource.com/sites/default/files/uploads/tux.png (Tux the penguin) +[12]: https://creativecommons.org/licenses/by-sa/4.0/ +[13]: https://opensource.com/sites/default/files/uploads/gimp_alpha-to-selection.jpg (Alpha to selection) +[14]: https://opensource.com/sites/default/files/uploads/gimp_path-tool.jpg (GIMP Paths tool) +[15]: https://opensource.com/sites/default/files/uploads/gimp_path-create.jpg (Create a path in GIMP) +[16]: https://opensource.com/sites/default/files/uploads/gimp_path-edit.jpg (Edit path) +[17]: https://opensource.com/sites/default/files/uploads/gimp_foreground-colour.jpg (Foreground color in toolbox) +[18]: https://www.w3schools.com/colors/colors_picker.asp +[19]: https://en.wikipedia.org/wiki/HSL_and_HSV +[20]: https://opensource.com/sites/default/files/uploads/gimp_colour.jpg (Setting color values) +[21]: https://opensource.com/sites/default/files/uploads/gimp_matte.jpg (Flattening image) diff --git a/published/202011/20201001 How open source underpins blockchain technology.md b/published/202011/20201001 How open source underpins blockchain technology.md new file mode 100644 index 0000000000..8205d3b2ce --- /dev/null +++ b/published/202011/20201001 How open source underpins blockchain technology.md @@ -0,0 +1,88 @@ +[#]: collector: "lujun9972" +[#]: translator: "xiao-song-123" +[#]: reviewer: "wxy" +[#]: publisher: "wxy" +[#]: url: "https://linux.cn/article-12776-1.html" +[#]: subject: "How open source underpins blockchain technology" +[#]: via: "https://opensource.com/article/20/10/open-source-blockchain" +[#]: author: "Matt Shealy https://opensource.com/users/mshealy" + +开源是如何支撑区块链技术发展的 +====== + +> 创造出区块链安全性和可靠性的原因:是开放,而非监管。 + +![](https://img.linux.net.cn/data/attachment/album/202011/01/155124l5c81g86mfwgjxfx.jpg) + +当人们发现以安全性而闻名的区块链技术居然是建立在开源软件代码之上时,通常会感到非常惊讶。事实上,正是这种开放性才赋予了区块链技术的安全性和可靠性。 + +以开源方式构建的任何事物,其核心价值之一就是为了提高效率。建立起一个有着不同观点和技能的开发人员社区,这些开发人员工作在同一个代码库的时候,可以成倍增加构建出来的应用程序数量以及复杂性。 + +### 开源比人们想象中的要更加普遍 + +开源的 Linux,就是一种比较流行的操作系统。Linux 为服务器提供了许多服务,这些服务让我们可以轻松地共享个人信息。其中包括 Google、Facebook 和数千个主要网站。当我们使用这些服务时,就是在和这些在网络上运行着 Linux 系统的计算机进行交互。Chromebook 也使用 Linux,Android 手机使用的操作系统也是基于 Linux 的。 + +Linux 不属于任何一家公司,人们可以免费使用并且可以共同协作来完善创造它。自 2005 年推出以来,已经有来自 1,700 多家公司的 20,000 多名开发人员 [为其中的代码做出了贡献][2] 。 + +这就是开源软件的运作方式。大量的人为此贡献,并不断添加、修改或构建开源代码库来创建新的应用程序和平台。区块链和加密货币的大部分代码都是使用开源软件开发的。开源软件是由充满热情的用户构建的,这些用户对错误、故障或缺陷时刻保持警惕。当发现问题时,开源社区中的开发人员将一起努力来解决问题。 + +### 区块链和开源 + +整个开源区块链开发者社区都在不断地添加和完善代码库。 + +以下是区块链的基本表现方式: + + * 区块链平台具有一个交易数据库,该交易数据库允许对等方在任何时候彼此进行交易。 + * 附有用户识别标签,以方便交易。 + * 平台一定有一种安全的方式来在交易批准前对交易进行验证。 + * 无法被验证的交易不会进行。 + +开源软件允许开发者在 [去中心化应用程序(Dapp)][3]中创建这些平台,这是区块链中交易的安全、保障和可变性的关键。 + +这种去中心化的方式意味着没有中央权威机构来调解交易,没有人能控制发生的事情。直接的点对点的交易可以更快速、安全的进行。由于交易被记录在分类账簿中,它们也会分发到整个生态系统中。 + +区块链使用密码学来保证安全。每一笔交易都携带着与前一笔交易相关联的信息,以验证其真实性。这可以防止威胁者篡改数据,因为一旦数据被添加到公共分类账中,其他用户就不能更改。 + +### 区块链是开源的吗? + +虽然区块链本身在技术上可以是不开源的,但区块链系统通常是使用开源软件实现的,因为没有政府机构对其进行监管,所以这些开源软件使用的概念体现了一种开放文化。私人公司开发的用于处理金融交易的专有软件很可能受到 [政府机构][4] 的监管。在美国,这可能包括美国证券交易委员会(SEC)、联邦储备委员会和联邦存款保险公司(FDIC)。区块链技术在开放环境下使用不需要政府监管,实际上,用来验证交易的是用户社区。 + +你可以称它为一种极端的众包形式,既用于开发构建区块链平台的开源软件,也用于验证交易。这就是区块链得到如此多关注的原因之一:它有可能颠覆整个行业,因为它可以作为处理和验证交易的权威中介。 + +### 比特币,以太坊和其他加密货币 + +截至 2020 年 6 月,超过 [5000 万人拥有区块链钱包][5] 。他们大多数用于金融交易,例如交易比特币、以太坊和其他加密货币。对许多人来说,像交易员观察股票价格一样,[查看加密货币价格][6] 已成为主流。 + +加密货币平台也使用开源软件。[以太坊项目][7] 开发出了任何人都可以免费使用的开源软件,社区中大量的开发者都为此贡献了代码。比特币客户端的参考实现版是由 450 多个开发人员和工程师进行开发的,他们已经贡献了超过 150,000 个贡献。 + +加密货币区块链是一个持续增长的记录。每个被称作为块的记录按顺序链接在一起,它们互相链接形成一条链。每个块都有其自己的唯一标记,这个标记称为 [哈希][8] 。一个块包含自身的哈希值和前一个块的加密计算出的哈希值。从本质上讲,每个块都链接到前一个块,形成了无法中断的长链,每个块都包含其它区块的信息,用于验证交易。 + +在金融或是加密货币的区块链中没有中央银行。这些分布在整个互联网中的区块,建立了一个性能强大的审计跟踪系统。任何人都能够通过区块链来验证交易,但却不能更改上面的记录。 + +### 牢不可破的区块链 + +尽管区块链不受任何政府或机构的监管,但分布式的网络保证了它们的安全。随着链的增长,每一笔交易都会增加伪造的难度。区块分布在世界各地的网络中,它们使用的信任标记不可被改变,这条链条几乎变得牢不可破。 + +这种去中心化的网络,其背后的代码是开源的,这也是用户在交易中不必使用诸如银行或经纪人之类的中介就可以相互信任的原因之一。支撑加密货币平台的软件是由相互独立的开发者组建的联盟创建的,并且任何人都可以免费使用。这创造了世界上最大的制衡体系之一。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/10/open-source-blockchain + +作者:[Matt Shealy][a] +选题:[lujun9972][b] +译者:[xiao-song-123](https://github.com/xiao-song-123) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/mshealy +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/cube_innovation_process_block_container.png?itok=vkPYmSRQ "cubes coming together to create a larger cube" +[2]: https://www.linuxfoundation.org/wp-content/uploads/2020/08/2020_kernel_history_report_082720.pdf +[3]: https://www.freecodecamp.org/news/what-is-a-dapp-a-guide-to-ethereum-dapps/ +[4]: https://www.investopedia.com/ask/answers/063015/what-are-some-major-regulatory-agencies-responsible-overseeing-financial-institutions-us.asp +[5]: https://www.statista.com/statistics/647374/worldwide-blockchain-wallet-users/ +[6]: https://www.okex.com/markets +[7]: https://ethereum.org/en/ +[8]: https://opensource.com/article/18/7/bitcoin-blockchain-and-open-source diff --git a/published/202011/20201002 How to Free Up Space in -boot Partition on Ubuntu Linux.md b/published/202011/20201002 How to Free Up Space in -boot Partition on Ubuntu Linux.md new file mode 100644 index 0000000000..c73bd3a14d --- /dev/null +++ b/published/202011/20201002 How to Free Up Space in -boot Partition on Ubuntu Linux.md @@ -0,0 +1,173 @@ +[#]: collector: (lujun9972) +[#]: translator: (robsean) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12779-1.html) +[#]: subject: (How to Free Up Space in /boot Partition on Ubuntu Linux?) +[#]: via: (https://itsfoss.com/free-boot-partition-ubuntu/) +[#]: author: (Ankush Das https://itsfoss.com/author/ankush/) + +如何在 Ubuntu Linux 上释放 /boot 分区的空间? +====== + +前几天,我收到一个警告,`/boot` 分区已经几乎满了,没有剩余空间了。是的,我有一个独立的 `/boot` 分区,我相信现在很少有人这样做了。(LCTT 译注:个人认为保留单独的 /boot 分区是个好的运维经验,除此以外,/tmp、/var 也单独划定分区比较好。) + +这是我第一次看到这样一个错误,它让我很迷惑。现在,这里有一些 [方法来释放在 Ubuntu (或基于 Ubuntu 的分区)上的分区][1] ,但是在这种情况下并不是所有的方法都能用。 + +这就是为什么我决定写这些我释放 `/boot` 分区空间的步骤的原因。 + +### 如何在 Ubuntu 上释放 /boot 分区的空间 + +![][2] + +我建议你仔细阅读这些解决方案,并由此得出最适合你情况的解决方案。解决方案的操作很容易,但是你需要在你的生产力系统上小心的执行这些解决方案。 + +#### 方法 1: 使用 apt autoremove + +你不必是一名终端专家来做这件事,它只需要一个命令,你将移除未使用的内核来释放 `/boot` 分区中是空间。 + +你所有要做的事情是,输入: + +``` +sudo apt autoremove +``` + +这个命令不仅仅可以移除未使用的内核,而且也将移除你不需要的或工具安装后所不需要的依赖项。 + +在你输入命令后,它将列出将被移除的东西,你只需要确认操作即可。如果你很好奇它将移除什么,你可以仔细检查一下看看它实际移除了什么。 + +这里是它应该看起来的样子: + +![][3] + +你必须按 `Y` 按键来继续。 + +**值得注意的是,这种方法只在你还剩余一点点空间,并且得到警告的情况下才有效。但是,如果你的 `/boot` 分区已经满了,APT 甚至可能不会工作。** + +在接下来的方法中,我将重点介绍两种不同的方法,通过这些方法你可以使用 GUI 和终端来移除旧内核来释放空间。 + +#### 方法 2: 手动移除未使用的内核 + +在你尝试 [移除一些旧内核][4] 来释放空间前,你需要识别当前活动的内核,并且确保你不会删除它。 + +为 [检查你的内核的版本][5] ,在终端中输入下面的命令: + +``` +uname -r +``` + +[uname 命令通常用于获取 Linux 系统信息][6]。在这里,这个命令显示当前正在被使用的 Linux 内核。它看起来应该是这样: + +![][7] + +现在,你已经知道你当前的 Linux 内核是什么,你必须移除一个不同于这个版本的内核。你应该把它记录在某些地方,以便你不会不知不觉地移除它。 + +接下来,要移除它,你可以使用终端或 GUI。 + +> 警告! +> +> 在删除内核时一定要额外的小心。只识别和删除旧内核,而不是当前你正在使用的内核,否则你将会拥有一个残缺的系统。 + +##### 使用一个 GUI 工具来移除旧的 Linux 内核 + +你可以使用 [Synaptic 软件包管理器][8] 或一个类似 [Stacer][9] 的工具来开始。就我个人而言,当我遇到一个满满的 `/boot` 分区且 APT 损坏时,我使用 [Stacer][6] 来丢弃旧内核。因此,让我向你展示一下它看起的样子。 + +首先,你需要启动 Stacer ,然后导航到软件包卸载器,如下面屏幕截图所示。 + +![][10] + +在这里,搜索 “image” ,你将找到你所拥有的 Linux 内核。你只需要删除旧内核版本的镜像,而不是当前内核的镜像。 + +在上面的屏幕截图中,我已经指出了我系统上的当前内核和旧内核,因此你必须注意你系统上的内核。 + +你没有必要删除任何其它东西,只需要删除旧的内核版本。 + +同样的,只需要在软件包列表中搜索 “headers” ,并删除如下显示的旧的 “headers” 版本。 + +![][11] + +作为提醒,你 **不会希望移除 `linux-headers-generic`** 。只关注一下那些与其相关的有版本号的就行。 + +然后,就这样,你完成了所有的工作,APT 将会再次工作,并且你将成功地释放来自 `/boot` 分区的一些空间。同样地,你也可以使用任意其它的软件包管理器来完成这些工作。 + +#### 使用命令行来移除旧内核 + +使用命令行来移除旧内核与使用 GUI 来移除旧内核是一样的。因此,如果你没有选择使用 GUI 软件(如果它是一台远程机器/一项远程服务)的权利,或者如果你只是对终端情有独钟,你可以仿效下面的步骤。 + +首先,使用下面的命令列出所有已安装的内核: + +``` +ls -l /boot +``` + +它应该看起来像这样: + +![][12] + +标记为 “old” 的内核,或者不匹配你当前内核版本,都是未使用的内核,你可以删除它们。 + +现在,你可以使用 `rm` 命令来移除具体指定来自 `/boot` 分区中的内核,使用下面的命令(一个命令对应一个内核): + +``` +sudo rm /boot/vmlinuz-5.4.0-7634-generic +``` + +务必检查系统的版本 — 这里可能与你的系统的版本不同。 + +如果你有很多未使用的内核,这将需要一些时间。因此,你也可以下面的命令丢弃多个内核: + +``` +sudo rm /boot/*-5.4.0-{7634}-* +``` + +为了清晰起见,你需要用逗号分隔内核版本号的最后一部分/编码,以便同时删除它们。 + +假设,我有两个旧的内核 5.4.0-7634-generic 和 5.4.0-7624 ,那么命令将是: + +``` +sudo rm /boot/*-5.4.0-{7634,7624}-* +``` + +如果你不希望在 grub 启动菜单中再看到这些旧的内核版本,你可以使用下面的命令简单地 [更新 grub][13]: + +``` +sudo update-grub +``` + +就这样,你完成了所有的工作。你已经释放了空间,还修复了可能潜在的破损的 APT 问题,如果它是一个在你的 `/boot` 分区填满后出现的重要的问题的话。 + +在一些情况下,你需要输入这些命令来修复破损的(正如我在论坛中注意到的): + +``` +sudo dpkg --configure -a +sudo apt install -f +``` + +注意,除非你发现 APT 已破损,否则你不需要输入上面的命令。就我个人而言,我不需要这些命令,但是我发现这些命令对论坛上的一些人很有用。 + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/free-boot-partition-ubuntu/ + +作者:[Ankush Das][a] +选题:[lujun9972][b] +译者:[robsean](https://github.com/robsean) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://itsfoss.com/author/ankush/ +[b]: https://github.com/lujun9972 +[1]: https://itsfoss.com/free-up-space-ubuntu-linux/ +[2]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/10/free-boot-space-ubuntu-linux.jpg?resize=800%2C450&ssl=1 +[3]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/09/apt-autoremove-screenshot.jpg?resize=800%2C415&ssl=1 +[4]: https://itsfoss.com/remove-old-kernels-ubuntu/ +[5]: https://itsfoss.com/find-which-kernel-version-is-running-in-ubuntu/ +[6]: https://linuxhandbook.com/uname/ +[7]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/09/uname-r-screenshot.jpg?resize=800%2C198&ssl=1 +[8]: https://itsfoss.com/synaptic-package-manager/ +[9]: https://itsfoss.com/optimize-ubuntu-stacer/ +[10]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/09/stacer-remove-kernel.jpg?resize=800%2C562&ssl=1 +[11]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/09/stacer-remove-kernel-header.png?resize=800%2C576&ssl=1 +[12]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/09/command-kernel-list.png?resize=800%2C432&ssl=1 +[13]: https://itsfoss.com/update-grub/ diff --git a/published/202011/20201006 Start using virtual tables in Apache Cassandra 4.0.md b/published/202011/20201006 Start using virtual tables in Apache Cassandra 4.0.md new file mode 100644 index 0000000000..ba78aa772f --- /dev/null +++ b/published/202011/20201006 Start using virtual tables in Apache Cassandra 4.0.md @@ -0,0 +1,61 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12791-1.html) +[#]: subject: (Start using virtual tables in Apache Cassandra 4.0) +[#]: via: (https://opensource.com/article/20/10/virtual-tables-apache-cassandra) +[#]: author: (Ben Bromhead https://opensource.com/users/ben-bromhead) + +如何在 Apache Cassandra 4.0 中使用虚拟表 +====== + +> 虚拟表是什么以及如何使用。 + +![](https://img.linux.net.cn/data/attachment/album/202011/04/234511kpmv6dzac6fjmr65.jpg) + +在最近的发布的 [Apache Cassandra 4.0 测试版][3]中的[众多新增功能][2]中,虚拟表virtual table是一个值得关注的功能。 + +在以前的 Cassandra 版本中,用户需要访问 Java 管理扩展Java Management Extensions([JMX][4]) 来查看 Cassandra 的细节,如运行中的压实compaction、客户端、度量和各种配置设置。虚拟表消除了这些挑战。Cassandra 4.0 测试版让用户能够从一个只读的系统表中以 Cassandra 查询语言Cassandra Query Language(CQL)行的形式查询这些细节和数据。 + +以下是之前 Cassandra 版本中基于 JMX 的机制是如何工作的。想象一下,一个用户想要检查集群中某个节点的压实状态。用户首先要建立一个 JMX 连接,在节点上运行 `nodetool compactionstats`。这个要求马上就给用户带来了一些复杂的问题。用户的客户端是否配置了 JMX 访问?Cassandra 节点和防火墙是否配置为允许 JMX 访问?是否准备好了适当的安全和审计措施,并落实到位?这些只是用户在处理 Cassandra 以前版本时必须面对的其中一些问题。 + +在 Cassandra 4.0 中,虚拟表使得用户可以利用之前配置的驱动来查询所需信息。这一变化消除了与实现和维护 JMX 访问相关的所有开销。 + +Cassandra 4.0 创建了两个新的键空间keyspace来帮助用户利用虚拟表:`system_views` 和 `system_virtual_schema`。`system_views` 键空间包含了用户查询的所有有价值的信息,有用地存储在一些表中。`system_virtual_schema` 键空间,顾名思义,存储了这些虚拟表的所有必要的模式信息。 + +![system_views and system_virtual_schema keyspaces and tables][5] + +重要的是要明白,每个虚拟表的范围仅限于其节点。任何虚拟表查询都将返回的数据,只对其协调器的节点有效,而不管一致性如何。为了简化这一要求,已经在几个驱动中添加了支持,以便在这些查询中指定协调器节点 (Python、DataStax Java 和其他驱动现在提供了这种支持)。 + +为了说明这一点,请查看这个 `sstable_tasks` 虚拟表。这个虚拟表显示了对 [SSTables][7] 的所有操作,包括压实、清理、升级等。 + +![Querying the sstable_tasks virtual table][8] + +如果用户在以前的 Cassandra 版本中运行 `nodetool compactionstats`,则会显示相同类型的信息。 在这里,这个查询发现该节点当前有一个活动的压缩。它还显示了它的进度以及它的键空间和表。得益于虚拟表,用户可以快速收集这些信息,并同样有效地获得正确诊断集群健康状况所需的能力。 + +需要说明的是,Cassandra 4.0 并没有去除对 JMX 访问的需求。JMX 仍然是查询某些指标的唯一选择。尽管如此,用户会欢迎简单地使用 CQL 来获取关键集群指标的能力。由于虚拟表提供的便利,用户可能会将之前投入到 JMX 工具的时间和资源重新投入到 Cassandra 本身。客户端工具也应该开始利用虚拟表提供的优势。 + +如果你对 Cassandra 4.0 测试版及其虚拟表功能感兴趣,请[试试试它][3]。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/10/virtual-tables-apache-cassandra + +作者:[Ben Bromhead][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/ben-bromhead +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/computer_space_graphic_cosmic.png?itok=wu493YbB (Computer laptop in space) +[2]: https://www.instaclustr.com/apache-cassandra-4-0-beta-released/ +[3]: https://cassandra.apache.org/download/ +[4]: https://en.wikipedia.org/wiki/Java_Management_Extensions +[5]: https://opensource.com/sites/default/files/uploads/cassandra_virtual-tables.png (system_views and system_virtual_schema keyspaces and tables) +[6]: https://creativecommons.org/licenses/by-sa/4.0/ +[7]: https://cassandra.apache.org/doc/latest/architecture/storage_engine.html#sstables +[8]: https://opensource.com/sites/default/files/uploads/cassandra_virtual-tables_sstable_tasks.png (Querying the sstable_tasks virtual table) diff --git a/published/202011/20201007 How to Clear Apt Cache and Reclaim Precious Disk Space.md b/published/202011/20201007 How to Clear Apt Cache and Reclaim Precious Disk Space.md new file mode 100644 index 0000000000..de0b5a3659 --- /dev/null +++ b/published/202011/20201007 How to Clear Apt Cache and Reclaim Precious Disk Space.md @@ -0,0 +1,123 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12787-1.html) +[#]: subject: (How to Clear Apt Cache and Reclaim Precious Disk Space) +[#]: via: (https://itsfoss.com/clear-apt-cache/) +[#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/) + +如何清除 APT 缓存来回收宝贵的磁盘空间 +====== + +![][13] + +如何清除 APT 缓存?你只需使用这个 [apt-get 命令][1]选项: + +``` +sudo apt-get clean +``` + +但是,清理 APT 缓存不仅仅是运行上面的命令。 + +在本教程中,我将解释什么是 APT 缓存、为什么会使用它、为什么你要清理它,以及关于清理 APT 缓存你应该知道的其他事情。 + +我将在这里使用 Ubuntu 作为参考,但由于这是关于 APT 的,因此它也适用于 [Debian][2] 和其他基于 Debian 和 Ubuntu 的发行版,比如 Linux Mint、Deepin 等等。 + +### 什么是 APT 缓存?为什么要使用它? + +当你使用 `apt-get` 或 [apt 命令][3]安装一个软件包时(或在软件中心安装 DEB 包),APT [包管理器][4]会以 .deb 格式下载软件包及其依赖关系,并将其保存在 `/var/cache/apt/archives` 文件夹中。 + +![][5] + +下载时,`apt` 将 deb 包保存在 `/var/cache/apt/archives/partial` 目录下。当 deb 包完全下载完毕后,它会被移到 `/var/cache/apt/archives` 目录下。 + +下载完包的 deb 文件及其依赖关系后,你的系统就会[从这些 deb 文件中安装包][6]。 + +现在你明白缓存的用途了吧?系统在安装软件包之前,需要一个地方把软件包文件存放在某个地方。如果你了解 [Linux 目录结构][7],你就会明白,`/var/cache` 是合适的地方。 + +#### 为什么安装包后要保留缓存? + +下载的 deb 文件在安装完成后并不会立即从目录中删除。如果你删除了一个软件包,然后重新安装,你的系统会在缓存中查找这个软件包,并从这里获取它,而不是重新下载(只要缓存中的软件包版本与远程仓库中的版本相同)。 + +这样就快多了。你可以自己尝试一下,看看一个程序第一次安装,删除后再安装需要多长时间。你可以[使用 time 命令来了解完成一个命令需要多长时间][8]:`time sudo apt install package_name`。 + +我找不到任何关于缓存保留策略的内容,所以我无法说明 Ubuntu 会在缓存中保留下载的包多长时间。 + +#### 你应该清理 APT 缓存吗? + +这取决于你。如果你的根目录下的磁盘空间用完了,你可以清理 APT 缓存来回收磁盘空间。这是 [Ubuntu 上释放磁盘空间的几种方法][9]之一。 + +使用 [du 命令][10]检查缓存占用了多少空间: + +![][11] + +有的时候,这可能会占用几百兆,如果你正在运行一个服务器,这些空间可能是至关重要的。 + +#### 如何清理 APT 缓存? + +如果你想清除 APT 缓存,有一个专门的命令来做。所以不要去手动删除缓存目录。只要使用这个命令就可以了: + +``` +sudo apt-get clean +``` + +这将删除 `/var/cache/apt/archives` 目录的内容(除了锁文件)。以下是 `apt-get clean` 命令模拟删除内容: + +![][12] + +还有一个命令是关于清理 APT 缓存的: + +``` +sudo apt-get autoclean +``` + +与 `clean` 不同的是,`autoclean` 只删除那些无法从仓库中下载的包。 + +假设你安装了包 xyz。它的 deb 文件仍然保留在缓存中。如果现在仓库中有新的 xyz 包,那么缓存中现有的这个 xyz 包就已经过时了,没有用了。`autoclean` 选项会删除这种不能再下载的无用包。 + +#### 删除 apt 缓存安全吗? + +是的,清除 APT 创建的缓存是完全安全的。它不会对系统的性能产生负面影响。也许如果你重新安装软件包,下载时间会更长一些,但也仅此而已。 + +再说一次,使用 `apt-get clean` 命令。它比手动删除缓存目录更快、更简单。 + +你也可以使用像 [Stacer][14] 或 [Bleachbit][15] 这样的图形工具来实现这个目的。 + +#### 总结 + +在写这篇文章的时候,新的 `apt` 命令没有这样的内置选项。不过,为了保持向后的兼容性,仍然可以运行 `apt clean` (内部应该是运行了 `apt-get clean`)。请参考这篇文章来[了解 apt 和 apt-get 的区别][16]。 + +我希望你觉得这个关于 APT 缓存的解释很有趣。虽然这不是什么必要的东西,但了解这些小东西会让你对你的 Linux 系统更加了解。 + +欢迎你在评论区提出反馈和建议。 + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/clear-apt-cache/ + +作者:[Abhishek Prakash][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://itsfoss.com/author/abhishek/ +[b]: https://github.com/lujun9972 +[1]: https://itsfoss.com/apt-get-linux-guide/ +[2]: https://www.debian.org/ +[3]: https://itsfoss.com/apt-command-guide/ +[4]: https://itsfoss.com/package-manager/ +[5]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/10/apt-get-clean-cache.png?resize=800%2C470&ssl=1 +[6]: https://itsfoss.com/install-deb-files-ubuntu/ +[7]: https://linuxhandbook.com/linux-directory-structure/ +[8]: https://linuxhandbook.com/time-command/ +[9]: https://itsfoss.com/free-up-space-ubuntu-linux/ +[10]: https://linuxhandbook.com/find-directory-size-du-command/ +[11]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/10/apt-cache-archive-size.png?resize=800%2C233&ssl=1 +[12]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/10/apt-get-clean-ubuntu.png?resize=800%2C339&ssl=1 +[13]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/10/Clear-Apt-Cache.png?resize=800%2C450&ssl=1 +[14]: https://itsfoss.com/optimize-ubuntu-stacer/ +[15]: https://itsfoss.com/use-bleachbit-ubuntu/ +[16]: https://itsfoss.com/apt-vs-apt-get-difference/ diff --git a/published/202011/20201014 LibreOffice Wants Apache to Drop the Ailing OpenOffice and Support LibreOffice Instead.md b/published/202011/20201014 LibreOffice Wants Apache to Drop the Ailing OpenOffice and Support LibreOffice Instead.md new file mode 100644 index 0000000000..216a944683 --- /dev/null +++ b/published/202011/20201014 LibreOffice Wants Apache to Drop the Ailing OpenOffice and Support LibreOffice Instead.md @@ -0,0 +1,81 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12775-1.html) +[#]: subject: (LibreOffice Wants Apache to Drop the Ailing OpenOffice and Support LibreOffice Instead) +[#]: via: (https://itsfoss.com/libreoffice-letter-openoffice/) +[#]: author: (Ankush Das https://itsfoss.com/author/ankush/) + +文档基金会希望 Apache 放弃陷入困境的 OpenOffice,转而支持 LibreOffice +====== + +对于 Linux 用户来说,当我们想到[微软 Office 的开源替代品][1]时,Apache OpenOffice 仍然是一个相关的推荐,这是不言而喻的。然而,在过去的几年里,OpenOffice 的发展几乎是停滞的。 + +当然,考虑到 Abhishek 早在 2016 年就写过 [Apache OpenOffice 关闭的可能性][2],这并不令人震惊。 + +现在,在一封[文档基金会的公开信][3]中,他们呼吁 Apache OpenOffice 推荐用户开始使用更好的替代品,比如 LibreOffice。在本文中,我将提到文档基金会的博文中的一些重点,以及它对 Apache OpenOffice 的意义。 + +![][4] + +### Apache OpenOffice 是历史,LibreOffice 是未来? + +尽管我当年没有使用过 OpenOffice,但可以肯定地说,它绝对不是微软 Office 的现代开源替代品。至少现在不是了。 + +是的,Apache OpenOffice 对于传统用户来说仍然是很重要的东西,在几年前是一个很好的替代品。 + +以下是 OpenOffice 和 LibreOffice 的主要发布时间线: + +![][5] + +现在 OpenOffice 已经没有重大的开发了,Apache OpenOffice 的未来是什么?一个相当活跃的项目,这个最大的开源基金会会不发布重大版本? + +这听起来并不乐观,而这正是文档基金会在他们的公开信中所强调的: + +> OpenOffice(.org),是 LibreOffice 的”父项目“,它是一个伟大的办公套件,它改变了世界。它有着引人入胜的历史,但**自从 2014 年以来,Apache OpenOffice (它现在的家)还没有一个重大的版本**。没错,六年多来,没有重大的新功能或重大更新到来,也很少发布次要版本,而且在及时的安全更新方面也存在问题。 + +对于一个普通用户来说,如果他们不知道 [LibreOffice][6],我肯定希望他们知道。但是,Apache 基金会是否应该建议 OpenOffice 用户尝试使用 LibreOffice 来体验更好或更高级的办公套件呢? + +我不知道,也许是,或者不是? + +> ...很多用户不知道 LibreOffice 的存在。OpenOffice 的品牌仍然如此强大,尽管该软件已经有六年多没有重大的版本发布,而且几乎没有人开发或支持它。 + +正如在公开信中提到的,文档基金会强调了 LibreOffice 相对于 OpenOffice的 优势/改进,并呼吁 Apache OpenOffice 开始推荐他们的用户尝试更好的东西(即 LibreOffice): + +> 我们呼吁 Apache OpenOffice 做正确的事情。我们的目标应该是**把强大的、最新的、维护良好的生产力工具送到尽可能多的人手中**。让我们一起努力吧! + +### Apache OpenOffice 应该做什么? + +如果 OpenOffice 能完成工作,用户可能不需要努力寻找替代品。那么,因为他们的缓慢开发而呼唤另一个项目,建议用户采用未来工具并推荐它是一个好主意么? + +在争论中,有人可能会说,如果你已经完成了你的目标,并且对改进 OpenOffice 没有兴趣,那么推广你的竞争对手才是公平的。而且,这并没有错,开源社区应该一直合作,以确保新用户得到最好的选择。 + +从另一个侧面来看,我们可以说,文档基金会对于 OpenOffice 到了 2020 年即使没有任何重大改进却仍然有重要意义感到沮丧。 + +我不会去评判,但当我看了这封公开信时,这些矛盾的想法就浮现在我的脑海里。 + +### 你认为是时候把 OpenOffice 搁置起来,依靠 LibreOffice 了吗? + +即使 LibreOffice 似乎是一个更优越的选择,并且绝对值得关注,你认为应该怎么做?Apache 是否应该停止 OpenOffice,并将用户重定向到 LibreOffice? + +欢迎你的意见。 + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/libreoffice-letter-openoffice/ + +作者:[Ankush Das][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://itsfoss.com/author/ankush/ +[b]: https://github.com/lujun9972 +[1]: https://itsfoss.com/best-free-open-source-alternatives-microsoft-office/ +[2]: https://itsfoss.com/openoffice-shutdown/ +[3]: https://blog.documentfoundation.org/blog/2020/10/12/open-letter-to-apache-openoffice/ +[4]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/10/libre-office-open-office.png?resize=800%2C450&ssl=1 +[5]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/10/libre-office-open-office-derivatives.jpg?resize=1536%2C319&ssl=1 +[6]: https://itsfoss.com/libreoffice-tips/ diff --git a/published/202011/20201021 5 open source tools I can-t live without.md b/published/202011/20201021 5 open source tools I can-t live without.md new file mode 100644 index 0000000000..d60f272f59 --- /dev/null +++ b/published/202011/20201021 5 open source tools I can-t live without.md @@ -0,0 +1,101 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12804-1.html) +[#]: subject: (5 open source tools I can't live without) +[#]: via: (https://opensource.com/article/20/10/open-source-tools) +[#]: author: (Victoria Martinez de la Cruz https://opensource.com/users/vkmc) + +5 个我不可或缺的开源工具 +====== + +> 通过将这些工具放在自己的技能包中,提高你在终端内、外的工作效率。 + +![](https://img.linux.net.cn/data/attachment/album/202011/08/185810ffjljj7o830fboz3.jpg) + +前段时间,我参与了一个在科技人士中广为流传的 Twitter 话题。“挑战?只挑选五个你不能没有的工具。”我开始结合我的日常生活来思考这个问题,只挑出五个工具并不容易。我使用了许多我认为必不可少的工具,比如用来与同事和朋友联系的 [IRC][2] 客户端(是的,我仍然使用 IRC),一个用来做各种事情的出色的文本编辑器,一个用来保持有条不紊的日历应用,以及当需要更直接的互动时的一个视频会议平台。 + +所以,让我给这个挑战来个变化:选出五个能提高你工作效率的开源工具。这是我的清单。请在评论中分享你的清单。 + +### tmate + +![tmate screenshot][3] + +哦,我喜欢这个工具。`tmate` 是著名的 [tmux][5] 终端多路复用器的一个复刻,它允许你启动一个 `tmux` 会话并通过 SSH 共享。你可以用它来进行[结对编程][6](这是我的主要使用场景),也可以用来进行远程控制。 + +如果你经常与你的团队成员合作,并且你想要一个简单的、与发行版无关的、开源的方式与他们一起编程(而且共享终端访问对你来说已经足够了),这绝对是你必须加到列表中的东西。 + +在 [tmate 的网站][7]上获取更多信息,或者在 [GitHub][8] 上查看代码。 + +### ix + +`ix` 是一个命令行粘贴板。你不需要安装任何东西。你可以通过 `curl` 到 [ix.io][9] 站点来创建新的粘贴。例如,`echo Hello world. | curl -F 'f:1=<-' ix.io` 会给你一个到 ix.io 的链接,那里粘贴了消息 “Hello world” 的信息。当你想分享日志用于调试或在没有桌面环境的服务器上保存配置文件时,这非常方便。 + +有一个缺点是源码还没有公布,尽管它的目的是自由开源。如果你是作者,并且正在阅读这篇文章,请发布代码,这样我们就可以为打磨它的过程做出贡献。 + +### asciinema + +是的,这是另一个终端工具,`asciinema` 可以让你记录你的终端。使用它的方法有很多,但我一般用它来制作演示。它非常容易使用,而且有很多 Linux 发行版和其他平台的软件包。 + +要想知道它是如何工作的,可以看看这个[酷炫的演示][10]。是不是很棒? + +在 [asciinema 的网站][11]上获取更多信息,在 [GitHub][12] 上访问其源代码。 + +### GNOME Pomodoro + +![pomodoro timer gnome][13] + +好了,关于终端工具的介绍就到此为止。现在我想和大家分享一下这个简单的宝物,它让你的工作变得有条不紊。你听说过 [番茄工作法][14] 吗?Pomodoro 基本上是一个时间管理工具。它使用一个番茄形状的计时器,帮助你将时间分成工作时间和休息时间(默认情况下,25 分钟的工作后有 5 分钟的休息时间)。而且,每隔 4 个“番茄”之后,你就会有更长的休息时间(默认为 15 分钟)。这样做的目的是让你在工作时间内保持专注,而在休息时间内进行伸展和放松。 + +这听起来非常非常简单,你可能会对让一个番茄形状的时钟来控制你的生活感到犹豫,但它确实帮助我变得跟有条理,并且在试图同时专注于许多事情时避免感到疲惫。 + +无论你是什么角色,我都强烈推荐这种做法。而在众多实现它的不同工具中,我推荐 GNOME Pomodoro 应用。它适用于主要的 GNU/Linux 发行版,所以它需要你使用 GNOME 桌面环境(这可能是它的缺点)。 + +在 [GNOME Pomodoro 的网站][15]上查看更多信息,并访问其 [GitHub][16] 仓库来获取源码并了解如何做出贡献。 + +### Jitsi + +最后但同样重要的是 Jitsi。当你在一个远程、遍布全球的团队中工作时,你需要一种与人们联系的方式。即时通讯是好的,但有时最好还是开个快速会议,面对面地讨论事情(嗯,看到对方的脸)。有很多[视频会议工具][17]可用,但我很喜欢 Jitsi。不仅因为它是免费和开源的,还因为它提供了一个简洁、实用的界面。你可以设置自己的 Jitsi 服务器(用于商业目的),但你也可以通过访问 [Jitsi Meet][18] 网站来试用一个公共的 Jitsi 实例。 + +设置这种会议的一个好做法是:只有在你心中有明确的议程时才使用它。而且要时刻问自己,这个会议能不能用电子邮件代替?遵循这些准则,谨慎使用 Jitsi,你的工作日将会非常高效! + +在 [Jitsi 网站][19]上了解更多信息,并通过访问其 [GitHub][20] 仓库开始贡献。 + +* * * + +我希望我的清单能帮助你在生产力上达到一个新的水平。你的 5 个不能离开的开源生产力工具是什么?在评论中告诉我。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/10/open-source-tools + +作者:[Victoria Martinez de la Cruz][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/vkmc +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/lenovo-thinkpad-laptop-window-focus.png?itok=g0xPm2kD (young woman working on a laptop) +[2]: https://en.wikipedia.org/wiki/Internet_Relay_Chat +[3]: https://opensource.com/sites/default/files/pictures/tmate-opensource.jpg (tmate screenshot) +[4]: https://creativecommons.org/licenses/by-sa/4.0/ +[5]: https://opensource.com/article/20/7/tmux-cheat-sheet +[6]: https://en.wikipedia.org/wiki/Pair_programming +[7]: https://tmate.io/ +[8]: https://github.com/tmate-io/tmate +[9]: http://ix.io/ +[10]: https://asciinema.org/a/239367 +[11]: https://asciinema.org/ +[12]: https://github.com/asciinema/asciinema +[13]: https://opensource.com/sites/default/files/pictures/pomodoro_timer_gnome.jpg (pomodoro timer gnome) +[14]: https://en.wikipedia.org/wiki/Pomodoro_Technique +[15]: https://gnomepomodoro.org/ +[16]: https://github.com/codito/gnome-pomodoro +[17]: https://opensource.com/article/20/5/open-source-video-conferencing +[18]: https://meet.jit.si/ +[19]: https://jitsi.org/ +[20]: https://github.com/jitsi diff --git a/published/202011/20201022 5 steps to learn any programming language.md b/published/202011/20201022 5 steps to learn any programming language.md new file mode 100644 index 0000000000..e4fae4c258 --- /dev/null +++ b/published/202011/20201022 5 steps to learn any programming language.md @@ -0,0 +1,184 @@ +[#]: collector: "lujun9972" +[#]: translator: "xiao-song-123" +[#]: reviewer: "wxy" +[#]: publisher: "wxy" +[#]: url: "https://linux.cn/article-12842-1.html" +[#]: subject: "5 steps to learn any programming language" +[#]: via: "https://opensource.com/article/20/10/learn-any-programming-language" +[#]: author: "Seth Kenlon https://opensource.com/users/seth" + +五步学会任何编程语言 +====== + +> 只需一点编程经验,你就可以在短短几天内(有时更少)学会一种新编程语言。 + +![](https://img.linux.net.cn/data/attachment/album/202011/19/225851j7miw3kd17joowa7.jpg) + +有些人喜欢学习新的编程语言,也有一些人觉得学习一种都是可望不可及的事情。在本文中,我将向你展示如何像程序员一样思考,这样你就可以自信地学习任何一门你想要学习的编程语言。 + +事实上,一旦你学会了如何编程,你使用的编程语言就不再是一个障碍,而更像是一种形式。实际上,这就是教育家们倡导 [让孩子尽早学习编程][2] 的众多原因之一。不管他们的入门语言有多简单,这种编程的逻辑和儿童们(或成人学习者)以后可能遇到的其他语言的逻辑有着想通之处。 + +只需有一点编程经验(你可以从我们这里的几篇介绍性文章中获得),你就可以在短短几天内(有时更短)学习任何编程语言。这并不是魔法,你也确实要为此付出一些努力。诚然,学习一种编程语言每个的可用库,或者学习打包代码以及进行交付的细微差别,需要的时间远远不止几天。但是,就入门来说,比你想像中的要容易许多,剩下的则要通过不断练习来完成。 + +当有经验的程序员静下心来学习一门新的编程语言时,他们会寻找五样东西。只要你知道了这五件事,你就可以开始编码了。 + +### 1、语法 + +![Syntax][3] + +语言的语法描述了代码的结构。这包括如何逐行编写代码,以及用于构造代码语句的实际单词。 + +例如,[Python][5] 以使用缩进来指示一个代码块在哪里结束以及另一代码块在哪里开始而闻名: + +``` +while j < rows: + while k < columns: + tile = Tile(k * w) + board.add(tile) + k += 1 + j += 1 + k = 0 +``` + +[Lua][6] 只是使用关键字 `end`: + +``` +for i,obj in ipairs(hit) do + if obj.moving == 1 then + obj.x,obj.y = v.mouse.getPosition() + end +end +``` + +[Java][7]、[C][8]、C++ 之类的编程语言使用花括号: + +``` +while (std::getline(e,r)) { + wc++; + } +``` + +编程语言的语法还包括包括库、设置变量和终止行等内容。通过练习,你将学会在阅读示例代码时下意识地识别语法需求(和惯例)。 + +#### 实践 + +当学习一门新的编程语言时,要努力理解它的语法。你不需要去记住它,只需要知道如果忘记了以后去哪里查找。使用好的 [IDE][9] 也很有帮助,因为很多 IDE 在出现语法错误时会提醒你。 + +### 2、内置函数和条件 + +![built-in words][10] + +就像自然语言一样,编程语言可以识别的合法单词是有限的。这个词汇表可以使用其他库进行扩展,但是核心语言知道一组特定的关键字。大多数语言并没有你想的那么多关键字。即使在像 C 语言这样非常低级的语言中,也只有 32 个关键字,比如 `for`、`do`、`while`、`int`、`float`、`char`、`break` 等等。 + +了解了这些关键字,你就可以编写基本的表达式,也就是构建程序的代码块。许多内置的关键字能帮助你构建条件语句,这些条件语句影响整个程序的流程。例如,如果你想编写一个允许单击和拖动图标的程序,那么你的代码就必须检测用户的鼠标指针何时位于图标上。只有当鼠标光标位于图标外部边缘相同的坐标时,才执行导致使鼠标抓取图标的代码。这是一个经典的 `if` / `then` 语句,但不同的语言可以用不同的方式表达。 + +Python 使用 `if`、`elif `和 `else` 的组合来实现条件语句,但是并不显式的关闭语句: + +``` +if var == 1: +    # action +elif var == 2: +    # some action +else: +    # some other action +``` + +[Bash][11] 使用 `if`、`elif`、`else`,并且使用 `fi` 来结束语句: + +``` +if [ "$var" = "foo" ]; then +   # action +elif [ "$var" = "bar" ]; then +   # some action +else +   # some other action +fi +``` + +然而 C 和 Java, 使用 `if`、`else` 和 `else if`,用花括号把它们括起来: + +``` +if (boolean) { +   // action +} else if (boolean) { +   // some action +} else { +   // some other action +} +``` + +各种编程语言虽然在关键字的选择和语法上有细微的变化,但基本是相同的。学习如何在编程语言中定义条件语句,包括 `if` / `then`、`do...while` 和 `case` 语句。 + +#### 实践 + +要熟悉编程语言能够理解的关键字集。在实践中,你的代码将不仅仅包含编程语言的关键字,可以肯定的是,有包含很多简单函数的库来帮助你做一些事情,诸如将输出打印到屏幕或显示窗口之类。然而,驱动这些库的逻辑始于编程语言的内置关键字。 + +### 3、数据类型 + +![Data types][12] + +代码是用来处理数据的,因此你必须学习编程语言如何识别不同类型的数据。所有编程语言都能理解整数,大多数的语言能理解小数和单个字符(`a`、`b`、`c` 等等)。它们通常被表示为 `int`、 `float`、`double` 和 `char`,当然,语言的内置词汇表会告诉你如何引用这些实体。 + +有时候,在编程语言中内置了一些额外的数据类型,也有时是通过引用库来启用复杂的数据类型。例如,Python 可以识别关键字为 `str` 的字符串,但是 C 语言的代码中必须包含 `string.h` 头文件才能实现字符串特性。 + +#### 实践 + +库可以为你的代码解锁各种类型的数据,但是学习编程语言中包含的基本数据类型是一个明智的起点。 + +### 4、运算符和解析器 + +![Operators][13] + +一旦你理解了编程语言可处理的数据类型,就可以学习如何分析这些数据了。幸运的是,数学这门学科是相当稳定的,所以算数运算符在许多语言中通常是相同的(或至少非常相似)。例如,两个整数相加通常用 `+` 符号完成,而测试一个整数是否大于另一个整数通常用 `>` 符号完成。测试是否相等通常使用 `==` 来完成(是的,是两个等号,因为通常一个等号用来赋值)。 + +当然也有一些例外,比如像 Lisp 和 Bash 语言算数运算符就不是如此,但与其他语言一样,这只是一个心理翻译的问题。一旦你了解了表达方式有何不同,很快就可以适应它。快速浏览一下一门编程语言的算数运算符通常足以让你了解算数操作是如何完成的。 + +你还需要知道如何比较和操作非数值数据,比如字符和字符串。这些通常是通过编程语言的核心库来进行的的。例如,Python 提供了 `split()` 方法,而 C 语言需要引入头文件 `string.h` 来提供 `strtok()` 函数。 + +#### 实践 + +了解用于处理基本数据类型的基本函数和关键字,并寻找可帮助你完成复杂操作的核心库。 + +### 5、函数 + +![Class][14] + +代码不只是计算机的待办清单。通常情况下,在编写代码时你往往希望向计算机提供一组理论条件和一组操作指令,当满足每个条件时计算机就会采取这些操作。尽管使用条件语句以及数学和逻辑运算符进行流控制可以做很多事情,但是引入了函数和类之后,代码会变得更加高效,因为它们使你可以定义子程序。例如,如果应用程序非常频繁地需要一个确认对话框,那么将其作为类的实例编写一次要比每次需要它时重新编写实现起来要容易得多。 + +你需要学习如何在编程语言中定义类和函数。更准确地说,你首先需要了解编程语言中是否支持类和函数。大多数现代语言都支持函数,但是类是面向对象的编程语言中所特有的。 + +#### 实践 + +学习语言中可用的结构,这些结构可以帮助你高效地编写和使用代码。 + +### 你可以学到任何东西 + +学习编程语言,就其本身而言,是一种编码过程中的子程序。一旦理解了代码如何工作,你所使用的语言就只是一种传递逻辑的媒介。学习一门新编程语言的过程几乎都是一样的:通过简单的练习来学习语法,通过学习词汇来积累进行复杂动作的能力,然后练习、练习、再练习。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/10/learn-any-programming-language + +作者:[Seth Kenlon][a] +选题:[lujun9972][b] +译者:[xiao-song-123](https://github.com/xiao-song-123) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/seth +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/learn-programming-code-keyboard.png?itok=xaLyptT4 "Learning to program" +[2]: https://opensource.com/article/20/9/scratch +[3]: https://opensource.com/sites/default/files/uploads/syntax_0.png "Syntax" +[4]: https://creativecommons.org/licenses/by-sa/4.0/ +[5]: https://opensource.com/downloads/cheat-sheet-python-37-beginners +[6]: https://opensource.com/article/20/2/lua-cheat-sheet +[7]: https://opensource.com/downloads/java-cheat-sheet +[8]: https://opensource.com/downloads/c-programming-cheat-sheet +[9]: https://opensource.com/resources/what-ide +[10]: https://opensource.com/sites/default/files/uploads/builtin.png "built-in words" +[11]: https://opensource.com/downloads/bash-cheat-sheet +[12]: https://opensource.com/sites/default/files/uploads/type.png "Data types" +[13]: https://opensource.com/sites/default/files/uploads/operator.png "Operators" +[14]: https://opensource.com/sites/default/files/uploads/class.png "Class" diff --git a/published/202011/20201023 Secure NTP with NTS.md b/published/202011/20201023 Secure NTP with NTS.md new file mode 100644 index 0000000000..56b4d47fce --- /dev/null +++ b/published/202011/20201023 Secure NTP with NTS.md @@ -0,0 +1,167 @@ +[#]: collector: (lujun9972) +[#]: translator: (wxy) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12860-1.html) +[#]: subject: (Secure NTP with NTS) +[#]: via: (https://fedoramagazine.org/secure-ntp-with-nts/) +[#]: author: (Miroslav Lichvar https://fedoramagazine.org/author/mlichvar/) + +用 NTS 保证 NTP 的安全 +====== + +![](https://img.linux.net.cn/data/attachment/album/202011/26/111649pt32v9j22x3ooa33.jpg) + +许多计算机使用网络时间协议Network Time Protocol(NTP)通过互联网来同步系统时钟。NTP 是少数几个仍在普遍使用的不安全的互联网协议之一。攻击者如果能够观察到客户端和服务器之间的网络流量,就可以向客户端提供虚假的数据,并根据客户端的实现和配置,强迫其将系统时钟设置为任何时间和日期。如果客户端的系统时钟不准确,一些程序和服务就可能无法工作。例如,如果根据客户端的系统时钟,Web 服务器的证书似乎已经过期,Web 浏览器将无法正常工作。可以使用网络时间安全Network Time Security(NTS)来保证 NTP 的安全。 + +Fedora 33 [^1] 是第一个支持 NTS 的 Fedora 版本。NTS 是一种新的 NTP 验证机制。它使客户端能够验证它们从服务器接收的数据包在传输过程中有没有被修改。当 NTS 启用时,攻击者唯一能做的就是丢弃或延迟数据包。关于 NTS 的更多细节,请参见 [RFC8915][3]。 + +使用对称密钥可以很好地保证 NTP 的安全。遗憾的是,服务器必须为每个客户端配备不同的密钥,而且密钥必须安全地分发才行。这对于本地网络上的私有服务器来说可能是实用的,但它不能扩展到有着数百万客户端的公共服务器上。 + +NTS 包括一个密钥建立Key Establishment(NTS-KE)协议,它可以自动创建服务器与其客户端之间使用的加密密钥。它在 TCP 端口 4460 上使用传输层安全Transport Layer Security(TLS)。它被设计成可以扩展到非常多的客户端,而对准确性的影响最小。服务器不需要保存任何客户端特定的状态。它为客户提供 cookie,cookie 是加密的,包含验证 NTP 数据包所需的密钥。隐私是 NTS 的目标之一。客户端在每次服务器响应时都会得到一个新的 cookie,所以它不必重复使用 cookie。这可以防止被动观察者跟踪在网络之间迁移的客户端。 + +Fedora 中默认的 NTP 客户端是 Chrony。Chrony 在 4.0 版本中增加了 NTS 支持,但并没有改变默认配置。Chrony 仍然使用 [pool.ntp.org][4] 项目中的公共服务器,而且默认情况下 NTS 没有启用。 + +目前,支持 NTS 的公共 NTP 服务器非常少。两个主要的提供商是 Cloudflare 和 Netnod。[Cloudflare 服务器][5]分布在世界各地的不同地方。他们使用的是任播anycast地址,应该可以让大多数客户到达一个接近的服务器。[Netnod 服务器][6]位于瑞典。在未来,我们可能会看到更多支持 NTS 的公共 NTP 服务器。 + +为了获得最佳的可靠性,配置 NTP 客户端的一般建议是至少有三个工作的服务器。为了达到最好的精度,建议选择距离较近的服务器,以减少网络延迟和非对称网络路由造成的不对称性。如果你不关心细粒度的精度,你可以忽略这个建议,使用任何你信任的 NTS 服务器,无论它们位于哪里。 + +如果你确实想要高准确度,但又没有近距离的 NTS 服务器,你可以将远处的 NTS 服务器和近处的非 NTS 服务器混合使用。但是,这样的配置不如只使用 NTS 服务器的配置安全。攻击者仍然不能强迫客户机接受任意时间,但他们确实对客户机的时钟及其估计精度有更大的控制权,这在某些环境下可能是不可接受的。 + +### 在安装程序中启用客户端 NTS + +安装 Fedora 33 时,你可以在“Time & Date”对话框的“Network Time”配置中启用 NTS。在点击“+”(添加)按钮之前,请输入服务器的名称并检查 NTS 支持情况。你可以添加一个或多个具有 NTS 的服务器或池。要删除默认的服务器池(`2.fedora.pool.ntp.org`),请取消选中“Use”列中的相应标记。 + +![Fedora 安装程序中的网络时间配置][7] + +### 在配置文件中启用客户端 NTS + +如果你从之前的 Fedora 版本升级,或者你没有在安装程序中启用 NTS,你可以直接在 `/etc/chrony.conf` 中启用 NTS。除了推荐的 `iburst` 选项外,还可以对指定服务器使用 `nts` 选项。例如: + +``` +server time.cloudflare.com iburst nts +server nts.sth1.ntp.se iburst nts +server nts.sth2.ntp.se iburst nts +``` + +你还应该允许客户端将 NTS 密钥和 cookie 保存到磁盘上,这样它就不必在每次启动时重复 NTS-KE 会话。在 `chrony.conf` 中添加以下一行,如果还没有的话: + +``` +ntsdumpdir /var/lib/chrony +``` + +如果不想让 DHCP 提供的 NTP 服务器与你指定的服务器混在一起,请在 `chrony.conf` 中删除或注释以下一行: + +``` +sourcedir /run/chrony-dhcp +``` + +当你完成编辑 `chrony.conf` 后,保存你的更改并重新启动 `chronyd` 服务: + +``` +systemctl restart chronyd +``` + +### 检查客户端状态 + +在 root 用户下运行以下命令,检查 NTS 密钥建立是否成功: + +``` +# chronyc -N authdata +Name/IP address Mode KeyID Type KLen Last Atmp NAK Cook CLen +========================================================================= +time.cloudflare.com NTS 1 15 256 33m 0 0 8 100 +nts.sth1.ntp.se NTS 1 15 256 33m 0 0 8 100 +nts.sth2.ntp.se NTS 1 15 256 33m 0 0 8 100 +``` + +`KeyID`、`Type` 和 `KLen` 列应该有非零值。如果它们为零,请检查系统日志中是否有来自 `chronyd` 的错误信息。一个可能的故障原因是防火墙阻止了客户端与服务器的 TCP 端口(端口 4460)的连接。 + +另一个可能的故障原因是由于客户机的时钟错误而导致证书无法验证。这是 NTS 的先有鸡还是先有蛋的问题。你可能需要手动修正日期或暂时禁用 NTS,以使 NTS 正常工作。如果你的电脑有实时时钟,几乎所有的电脑都有,而且有好的电池做备份,这种操作应该只需要一次。 + +如果计算机没有实时时钟或电池,就像一些常见的小型 ARM 计算机(如树莓派)那样,你可以在 `/etc/sysconfig/chronyd` 中添加 `-s` 选项来恢复上次关机或重启时保存的时间。时钟会落后于真实时间,但如果电脑没有关机太久,服务器的证书也没有在离到期时间太近的时候更新,应该足以让时间检查成功。作为最后的手段,你可以用 `nocerttimecheck` 指令禁用时间检查。详情请参见`chrony.conf(5)` 手册页。 + +运行下面的命令来确认客户端是否在进行 NTP 测量: + +``` +# chronyc -N sources +MS Name/IP address Stratum Poll Reach LastRx Last sample +=============================================================================== +^* time.cloudflare.com 3 6 377 45 +355us[ +375us] +/- 11ms +^+ nts.sth1.ntp.se 1 6 377 44 +237us[ +237us] +/- 23ms +^+ nts.sth2.ntp.se 1 6 377 44 -170us[ -170us] +/- 22ms +``` + +`Reach` 列应该有一个非零值,最好是 377。上图所示的值 377 是一个八进制数,它表示最后八个请求都有有效的响应。如果启用了 NTS 的话,验证检查将包括 NTS 认证。如果该值一直很少或从未达到 377,则表明 NTP 请求或响应在网络中丢失了。众所周知,一些主要的网络运营商有中间设备,它可以阻止或限制大的 NTP 数据包的速率,以缓解利用 `ntpd` 的监控协议进行的放大攻击。不幸的是,这影响了受 NTS 保护的 NTP 数据包,尽管它们不会引起任何放大。NTP 工作组正在考虑为 NTP 提供一个替代端口,作为解决这个问题的办法。 + +### 在服务器上启用 NTS + +如果你有自己的 NTP 服务器,运行着 `chronyd`,你可以启用服务器的 NTS 支持,让它的客户端安全同步。如果该服务器是其他服务器的客户端,它应该使用 NTS 或对称密钥与之同步。客户端假设同步链在所有服务器到主时间服务器之间是安全的。 + +启用服务器 NTS 类似于在 Web 服务器上启用 HTTPS。你只需要一个私钥和证书。例如,证书可以由 Let's Encrypt 权威机构使用 `certbot` 工具签署。当你有了密钥和证书文件(包括中间证书),在 `chrony.conf` 中用以下指令指定它们: + +``` +ntsserverkey /etc/pki/tls/private/foo.example.net.key +ntsservercert /etc/pki/tls/certs/foo.example.net.crt +``` + +确保之前在客户端配置中提到的 `ntsdumpdir` 指令存在于 `chrony.conf` 中。它允许服务器将其密钥保存到磁盘上,这样服务器的客户端在重启服务器时就不必获取新的密钥和 cookie 了。 + +重新启动 `chronyd` 服务: + +``` +systemctl restart chronyd +``` + +如果系统日志中没有来自 `chronyd` 的错误信息,那么它应该是可以接受客户端连接的,如果服务器有防火墙,则需要同时允许 UDP 123 和 TCP 4460 端口的 NTP 和 NTS-KE 服务。 + +你可以用下面的命令在客户端机器上进行快速测试: + +``` +$ chronyd -Q -t 3 'server foo.example.net iburst nts maxsamples 1' +2020-10-13T12:00:52Z chronyd version 4.0 starting (+CMDMON +NTP +REFCLOCK +RTC +PRIVDROP +SCFILTER +SIGND +ASYNCDNS +NTS +SECHASH +IPV6 +DEBUG) +2020-10-13T12:00:52Z Disabled control of system clock +2020-10-13T12:00:55Z System clock wrong by -0.001032 seconds (ignored) +2020-10-13T12:00:55Z chronyd exiting +``` + +如果你看到一个“System clock wrong”消息,说明它是正确工作的。 + +在服务器上,你可以使用下面的命令来检查它已经处理了多少个 NTS-KE 连接和认证的 NTP 数据包: + +``` +# chronyc serverstats +NTP packets received : 2143106240 +NTP packets dropped : 117180834 +Command packets received : 16819527 +Command packets dropped : 0 +Client log records dropped : 574257223 +NTS-KE connections accepted: 104 +NTS-KE connections dropped : 0 +Authenticated NTP packets : 52139 +``` + +如果你看到非零的 “NTS-KE connections accepted” 和 “Authenticated NTP packets”,这意味着至少有一些客户端能够连接到 NTS-KE 端口,并发送一个认证的 NTP 请求。 + +[^1]: Fedora 33 Beta 安装程序包含一个较旧的 Chrony 预发布版本,它不能与当前的 NTS 服务器一起工作,因为 NTS-KE 端口已经改变。因此,在安装程序中的网络时间配置中,服务器总是显示为不工作。安装后,需要更新 chrony 包,才能与当前的服务器配合使用。 + +-------------------------------------------------------------------------------- + +via: https://fedoramagazine.org/secure-ntp-with-nts/ + +作者:[Miroslav Lichvar][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://fedoramagazine.org/author/mlichvar/ +[b]: https://github.com/lujun9972 +[1]: https://fedoramagazine.org/wp-content/uploads/2020/10/secure-ntp-with-nts-816x345.jpg +[2]: tmp.rl0XC1HIGm#footnote1 +[3]: https://tools.ietf.org/html/rfc8915 +[4]: https://www.pool.ntp.org +[5]: https://developers.cloudflare.com/time-services/nts/usage +[6]: https://www.netnod.se/time-and-frequency/how-to-use-nts +[7]: https://fedoramagazine.org/wp-content/uploads/2020/10/anaconda-nts.png diff --git a/published/202011/20201026 ninja- a simple way to do builds.md b/published/202011/20201026 ninja- a simple way to do builds.md new file mode 100644 index 0000000000..43911730e3 --- /dev/null +++ b/published/202011/20201026 ninja- a simple way to do builds.md @@ -0,0 +1,117 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12798-1.html) +[#]: subject: (ninja: a simple way to do builds) +[#]: via: (https://jvns.ca/blog/2020/10/26/ninja--a-simple-way-to-do-builds/) +[#]: author: (Julia Evans https://jvns.ca/) + +ninja:一个简单的构建方式 +====== + +大家好!每隔一段时间,我就会发现一款我非常喜欢的新软件,今天我想说说我最近喜欢的一款软件:[ninja][1]! + +### 增量构建很有用 + +我做了很多小项目,在这些项目中,我想设置增量构建。例如,现在我正在写一本关于 bash 的杂志,杂志的每一页都有一个 `.svg`文件。我需要将 SVG 转换为 PDF,我的做法是这样的: + +``` +for i in *.svg +do + svg2pdf $i $i.pdf # or ${i/.svg/.pdf} if you want to get really fancy +done +``` + +这很好用,但是我的 `svg2pdf` 脚本有点慢(它使用 Inkscape),而且当我刚刚只更新了一页的时候,必须等待 90 秒或者其他什么时间来重建所有的 PDF 文件,这很烦人。 + +### 构建系统是让人困惑的 + +在过去,我对使用 `make` 或 `bazel` 这样的构建系统来做我的小项目一直很反感,因为 `bazel` 是个大而复杂的东西,而 `make` 对我来说感觉有点神秘。我真的不想使用它们中的任何一个。 + +所以很长时间以来,我只是写了一个 bash 脚本或者其他的东西来进行构建,然后就认命了,有时候只能等一分钟。 + +### ninja 是一个极其简单的构建系统 + +但 `ninja` 并不复杂!以下是我所知道的关于 ninja 构建文件的语法:创建一个 `rule` 和一个 `build`: + +`rule` 有一个命令(`command`)和描述(`description`)参数(描述只是给人看的,所以你可以知道它在构建你的代码时在做什么)。 + +``` +rule svg2pdf + command = inkscape $in --export-text-to-path --export-pdf=$out + description = svg2pdf $in $out +``` + +`build` 的语法是 `build output_file: rule_name input_files`。下面是一个使用 `svg2pdf` 规则的例子。输出在规则中的 `$out` 里,输入在 `$in` 里。 + +``` +build pdfs/variables.pdf: svg2pdf variables.svg +``` + +这就完成了!如果你把这两个东西放在一个叫 `build.ninja` 的文件里,然后运行 `ninja`,ninja 会运行 `inkscape variables.svg --export-text-to-path --export-pdf=pdfs/variables.pdf`。然后如果你再次运行它,它不会运行任何东西(因为它可以告诉你已经构建了 `pdfs/variables.pdf`,而且是最新的)。 + +Ninja 还有一些更多的功能(见[手册][2]),但我还没有用过。它最初是[为 Chromium][3] 构建的,所以即使只有一个小的功能集,它也能支持大型构建。 + +### ninja 文件通常是自动生成的 + +ninja 的神奇之处在于,你不必使用一些混乱的构建语言,它们很难记住,因为你不经常使用它(比如 `make`),相反,ninja 语言超级简单,如果你想做一些复杂的事情,那么你只需使用任意编程语言生成你想要的构建文件。 + +我喜欢写一个 `build.py` 文件,或者像这样的文件,创建 ninja 的构建文件,然后运行 `ninja`: + +``` +with open('build.ninja', 'w') as ninja_file: + # write some rules + ninja_file.write(""" +rule svg2pdf + command = inkscape $in --export-text-to-path --export-pdf=$out + description = svg2pdf $in $out +""") + + # some for loop with every file I need to build + for filename in things_to_convert: + ninja_file.write(f""" +build {filename.replace('svg', 'pdf')}: svg2pdf {filename} +""") + +# run ninja +import subprocess +subprocess.check_call(['ninja']) +``` + +我相信有一堆 `ninja` 的最佳实践,但我不知道。对于我的小项目而言,我发现它很好用。 + +### meson 是一个生成 ninja 文件的构建系统 + +我对 [Meson][4] 还不太了解,但最近我在构建一个 C 程序 ([plocate][5],一个比 `locate` 更快的替代方案)时,我注意到它有不同的构建说明,而不是通常的 `./configure; make; make install`: + +``` +meson builddir +cd builddir +ninja +``` + +看起来 Meson 是一个可以用 ninja 作为后端的 C/C++/Java/Rust/Fortran 构建系统。 + +### 就是这些! + +我使用 ninja 已经有几个月了。我真的很喜欢它,而且它几乎没有给我带来让人头疼的构建问题,这让我感觉非常神奇。 + +-------------------------------------------------------------------------------- + +via: https://jvns.ca/blog/2020/10/26/ninja--a-simple-way-to-do-builds/ + +作者:[Julia Evans][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://jvns.ca/ +[b]: https://github.com/lujun9972 +[1]: https://ninja-build.org/ +[2]: https://ninja-build.org/manual.html +[3]: http://neugierig.org/software/chromium/notes/2011/02/ninja.html +[4]: https://mesonbuild.com/Tutorial.html +[5]: https://blog.sesse.net/blog/tech/2020-09-28-00-37_introducing_plocate diff --git a/published/202011/20201027 KDE Neon vs Kubuntu- What-s the Difference Between the Two KDE Distribution.md b/published/202011/20201027 KDE Neon vs Kubuntu- What-s the Difference Between the Two KDE Distribution.md new file mode 100644 index 0000000000..79b0f00628 --- /dev/null +++ b/published/202011/20201027 KDE Neon vs Kubuntu- What-s the Difference Between the Two KDE Distribution.md @@ -0,0 +1,117 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12834-1.html) +[#]: subject: (KDE Neon vs Kubuntu: What’s the Difference Between the Two KDE Distribution?) +[#]: via: (https://itsfoss.com/kde-neon-vs-kubuntu/) +[#]: author: (Ankush Das https://itsfoss.com/author/ankush/) + +KDE Neon vs Kubuntu:这两款 KDE 发行版有什么区别? +====== + +当你发现两款基于 [Ubuntu][1] 并由 [KDE][2] 驱动的 Linux 发行版,你会选择哪一个? + + * [Kubuntu][3] 是 Ubuntu 的官方 KDE 版本。 + * [KDE Neon][4] 是 KDE 自己发布的基于 Ubuntu 的发行版。 + +我知道这常常会让人感到困惑,尤其是当你从来没有使用过这两个版本,但有人推荐你使用它们。因此,为了帮助你做出决定,我想整理一份 KDE Neon 和 Kubuntu 的区别(和相似之处)。 + +让我们先开始了解相似之处,然后再继续了解不同之处。 + +注:根据你的系统,你对这两个发行版的体验可能有所不同。所以,请把这篇文章作为一个参考,而不是一个”哪个更好“的比较。 + +### KDE Neon vs Kubuntu:功能上的比较 + +![][5] + +基于相似性比较发行版是一个不错的做法。所以,从理论上,我试图把最重要的区别写下来。 + +然而,值得注意的是,发行版的兼容性、性能和稳定性会根据你的硬件而有所不同,而这里没有考虑到这一点。 + +#### Ubuntu 作为基础 + +![][6] + +是的,这两个 Linux 发行版都是基于 Ubuntu 的,但 KDE Neon 只基于最新的 Ubuntu LTS 版本,而 Kubuntu 则提供了基于 Ubuntu LTS 的版本和非 LTS 版本。 + +所以,如果使用 KDE Neon,你可以期望在下一个 Ubuntu LTS 版本(每 2 年)的几个月后就能用上最新的 Ubuntu 功能。但是,对于 Kubuntu 来说,你可以选择一个非 LTS 版本,并尝试使用带有 6 个月的软件更新的最新 Ubuntu 版本。 + +KDE Neon 确实提供了测试版和开发者版,但这些都是为了测试预发布的 KDE 软件而提供的。 + +#### KDE Plasma 桌面 + +![][7] + +尽管这两个发行版都采用了 KDE plasma 桌面,而且你可以获得相同程度的定制,但 KDE Neon 会首先获得最新的 KDE Plasma 桌面。 + +如果你还不知道,KDE Neon 是由 KDE 官方团队开发的,由 Jonathan Riddell(Kubuntu 创始人)在[被 Canonical 强制赶出 Kubuntu][8] 后宣布的。 + +所以,不仅限于最新的 Plasma 桌面,如果你想尽快获得最新最好的 KDE,KDE Neon 是最佳选择。 + +Kubuntu 最终会得到更新的 KDE 软件的更新,但这需要时间。如果你不太确定需要最新的 KDE 软件/桌面,而只是需要一个稳定的 KDE 系统,你应该选择 Kubuntu LTS 版本。 + +#### 预装软件 + +开箱即用,你会发现 Kubuntu 已经预装了一些必要的工具和应用程序,但是,对于 KDE Neon,你需要找到并安装一些应用和工具。 + +从某些方面看,与 Kubuntu 相比,KDE Neon 可能是一个轻量级的发行版。然而,对于新的 Linux 用户来说,他们可能会发现 Kubuntu 是一个易于使用的体验,并预装了更多必要的软件和工具。 + +#### 软件更新 + +如果你没有使用按流量计费的连接,这可能根本不重要。但是,我应该提一下,考虑到常规的 Ubuntu LTS 修复/更新以及 KDE 软件更新,KDE Neon 会有更多的软件更新。 + +对于 Kubuntu,你只会得到 Ubuntu LTS 的更新(除非你使用的是非 LTS 版本)。所以,从技术上讲,你会有更少的更新数量。 + +#### Ubuntu KDE 版与 Plasma 的体验差异 + +![][11] + +我知道如果你没有尝试过这两个版本,你可能会认为它们很相似。但是,Kubuntu 是 Ubuntu 的官方版本,它更注重 Ubuntu 在 KDE 桌面环境上的使用体验。 + +而 KDE Neon 在技术上是一样的,但它的目的是为了获得一流的 Plasma 桌面体验,并搭载最新的东西。 + +尽管这两个发行版开箱即可完美工作,但它们有不同的愿景和相应的开发工作。你只需要决定你自己想要什么,然后选择其中之一。 + +#### 硬件兼容性 + +![Kubuntu Focus Laptop][12] + +正如我前面提到的,这不是一个基于事实的观点。但是,根据我在网上快速了解用户分享的反馈或经验,似乎 Kubuntu 可以与各种旧硬件以及新硬件(可能追溯到 2012 年)一起工作,而 KDE Neon 可能不能。 + +只需要记住,如果你尝试 KDE Neon,但由于某些原因不能工作。你知道该怎么做。 + +### 总结 + +那么,你会选择哪个呢?KDE Neon 还是 Kubuntu?这完全是你的选择。 + +两者都是[初学者友好的 Linux 发行版][13]的不错选择,但如果你想要最新的 KDE Plasma 桌面,KDE Neon 会更有优势。你可以在我们的 [KDE Neon 评测][10]中阅读更多关于它的内容。 + +欢迎在下面的评论中告诉我你的想法,你觉得它们中的任何一个有什么好的/坏的地方。 + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/kde-neon-vs-kubuntu/ + +作者:[Ankush Das][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://itsfoss.com/author/ankush/ +[b]: https://github.com/lujun9972 +[1]: https://ubuntu.com/ +[2]: https://kde.org/ +[3]: https://kubuntu.org +[4]: https://neon.kde.org +[5]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/10/kde-neon-vs-kubuntu.png?resize=800%2C450&ssl=1 +[6]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/01/install_ubuntu_8.jpg?resize=796%2C611&ssl=1 +[7]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/10/kde-plasma-5-20-feat.png?resize=800%2C394&ssl=1 +[8]: https://lwn.net/Articles/645973/ +[9]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/08/kde-neon-review.jpg?fit=800%2C450&ssl=1 +[10]: https://itsfoss.com/kde-neon-review/ +[11]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/01/kubuntu-kde.jpg?resize=800%2C450&ssl=1 +[12]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/01/kubuntu-focus-laptop.jpg?resize=800%2C600&ssl=1 +[13]: https://itsfoss.com/best-linux-beginners/ diff --git a/published/202011/20201027 You can Surf Internet in Linux Terminal With These Command Line Browsers.md b/published/202011/20201027 You can Surf Internet in Linux Terminal With These Command Line Browsers.md new file mode 100644 index 0000000000..54811507c5 --- /dev/null +++ b/published/202011/20201027 You can Surf Internet in Linux Terminal With These Command Line Browsers.md @@ -0,0 +1,172 @@ +[#]: collector: (lujun9972) +[#]: translator: (wxy) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12850-1.html) +[#]: subject: (You can Surf Internet in Linux Terminal With These Command Line Browsers) +[#]: via: (https://itsfoss.com/terminal-web-browsers/) +[#]: author: (Ankush Das https://itsfoss.com/author/ankush/) + +使用命令行浏览器在 Linux 终端上网浏览 +====== + +![](https://img.linux.net.cn/data/attachment/album/202011/22/212007f9s7aabmcj4aa9lo.jpg) + +我猜你阅读这篇文章可能是用 Firefox 或基于 Chrome 的浏览器(如 [Brave][1]),或者,也可能是 Chrome 浏览器或 [Chromium][2]。 + +换句话说,你正在利用基于 GUI 的方式浏览网页。然而,在以前,人们使用终端来获取资源和浏览网页,因为所有的东西大多是基于文本的。 + +虽然现在不能从终端上获取每个信息,但对于一些文本信息,还是可以尝试使用命令行浏览器,从 Linux 终端上打开网页。 + +不仅如此,如果你访问的是远程服务器,或者只有一个没有 GUI 的终端,终端网页浏览器就可以发挥用处了。 + +因此,在本文中,我将介绍一些基于终端的 Web 浏览器,你可以在 Linux 上尝试它们。 + +### Linux 用户的最佳终端 Web 浏览器 + +注:此榜单排名不分先后。 + +#### 1、W3M + +![][3] + +`w3m` 是一个流行的基于文本的开源终端 Web 浏览器。尽管其初始项目已经不再活跃,但另一个开发者 Tatsuya Kinoshita 正在维护着它的一个活跃分支。 + +`w3m` 相当简单,支持 SSL 连接、色彩,也支持内嵌图片。当然,根据你试图访问的资源,你那边的情况可能会有所不同。根据我的简单测试,它似乎无法加载 [DuckDuckGo][4],但我可以[在终端中使用 Google][5]就够了。 + +安装后,你可以简单的在终端中输入 `w3m` 以得到帮助。如果你感兴趣的话,也可以到 [GitHub][6] 上去查看它的仓库。 + +**如何安装和使用 w3m?** + +`w3m` 在任何基于 Debian 的 Linux 发行版的默认仓库中都是可用的。如果你有一个基于 Arch 的发行版,但没有直接可用的软件包,你可能需要查看一下 [AUR][7]。 + +对于 Ubuntu,你可以通过键入以下内容来安装它: + +``` +sudo apt install w3m w3m-img +``` + +在这里,我们将 w3m 包和图片扩展一起安装,以支持内嵌图片。接下来,要开始安装,你只需要按照下面的命令进行操作即可: + +``` +w3m xyz.com +``` + +当然,你需要将 `xyz.com` 替换成任何你想浏览或测试的网站。最后,你应该知道,你可以使用键盘上的方向键来导航,当你想采取一个动作时,按回车键。 + +要退出,你可以按 `SHIFT+Q`,返回上一页是 `SHIFT+B`。其他快捷键包括用 `SHIFT+T` 打开新标签页和用 `SHIFT+U` 打开新的 URL。 + +你可以通过访问它的手册页来了解更多信息。 + +#### 2、Lynx + +![][8] + +Lynx 是另一个开源的命令行浏览器,你可以试试。幸运的是,很多的网站在使用 Lynx 时往往能正常工作,所以我说它在这方面肯定更好。我能够加载 DuckDuckGo,并使其工作。 + +除此之外,我还注意到它可以让你在访问各种 Web 资源时接受或拒绝 cookie。你也可以将它设置为总是接受或拒绝。所以,这是件好事。 + +另一方面,在终端上使用时,窗口不能很好地调整大小。我还没有寻找到任何解决方法,所以如果你正在尝试这个,你可能会想要这样做。不论如何,它都很好用,当你在终端启动它时,你会得到所有键盘快捷键的说明。 + +请注意,它与系统终端主题不匹配,所以无论你的终端看起来如何,它都会看起来不同。 + +**如何安装 Lynx?** + +与 w3m 不同的是,如果你有兴趣尝试的话,确实可以找到一些 Win32 上的安装程序。不过,在 Linux 上,它在大多数的默认仓库中都是可用的。 + +对于 Ubuntu 来说,你只需要输入: + +``` +sudo apt install lynx +``` + +要想使用,你只需要按照下面的命令进行操作: + +``` +lynx examplewebsite.com +``` + +在这里,你只需要将示例网站替换成你想要访问的资源即可。 + +如果你想找其他 Linux 发行版的软件包,可以查看他们的[官网资源][9]。 + +#### 3、Links2 + +![][10] + +Links2 是一款有趣的基于文本的浏览器,你可以在你的终端上轻松使用,用户体验良好。它提供了一个很好的界面,你启动它后,只要输入网址就可以了。 + +![][11] + +值得注意的是,主题将取决于你的终端设置,我设置为“黑绿色”主题,因此你看到的就是这个。当你以命令行浏览器的方式启动它后,你只需要按任意键就会出现 URL 提示,或者按 `Q` 键退出。它相当好用,可以渲染大多数网站的文字。 + +与 Lynx 不同的是,你没有接受或拒绝 cookie 的功能。除此之外,它似乎工作的还不错。 + +**如何安装 Links2?** + +正如你所期望的,你会发现它在大多数默认的仓库中都有。对于 Ubuntu,你可以在终端输入以下命令来安装它: + +``` +sudo apt install links2 +``` + +如果你想在其他 Linux 发行版上安装它,你可以参考它的[官方网站][12]获取软件包或文档。 + +#### 4、eLinks + +![][13] + +eLinks 类似于 Links2,但它已经不再维护了。你仍然可以在各种发行版的默认仓库中找到它,因此,我把它保留在这个列表中。 + +它不会与你的系统终端主题相融合。所以,如果你需要的话,作为一个没有“黑暗”模式的文本型浏览器,这可能不是一个漂亮的体验。 + +**如何安装 eLinks?** + +在 Ubuntu 上,安装它很容易。你只需要在终端中输入以下内容: + +``` +sudo apt install elinks +``` + +对于其他 Linux 发行版,你应该可以在标准软件仓库中找到它。但是,如果你在软件仓库中找不到它,你可以参考[官方安装说明][14]。 + +### 总结 + +在终端上运行的基于文本的 Web 浏览器并不多,这并不奇怪。一些项目,如 [Browsh][15],试图呈现一个现代的 Linux 命令行浏览器,但在我这里它不能工作。 + +虽然像 `curl` 和 `wget` 这样的工具允许你[从 Linux 命令行下载文件][16],但这些基于终端的 Web 浏览器提供了额外的功能。 + +除了命令行浏览器之外,如果你想在终端上玩玩,也可以尝试一些[Linux 命令行游戏][17]。 + +对于 Linux 终端上的文本型 Web 浏览器,你有什么看法?欢迎在下面的评论中告诉我你的想法。 + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/terminal-web-browsers/ + +作者:[Ankush Das][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://itsfoss.com/author/ankush/ +[b]: https://github.com/lujun9972 +[1]: https://itsfoss.com/brave-web-browser/ +[2]: https://itsfoss.com/install-chromium-ubuntu/ +[3]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/10/w3m-google.jpg +[4]: https://duckduckgo.com/ +[5]: https://itsfoss.com/review-googler-linux/ +[6]: https://github.com/tats/w3m +[7]: https://itsfoss.com/aur-arch-linux/ +[8]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/10/lynx-terminal.jpg +[9]: https://lynx.invisible-island.net/lynx-resources.html +[10]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/10/links2-terminal.jpg +[11]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/10/links2-terminal-welcome.jpg +[12]: http://links.twibright.com/download.php +[13]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/10/elinks-terminal.jpg +[14]: http://elinks.or.cz/documentation/installation.html +[15]: https://www.brow.sh/ +[16]: https://itsfoss.com/download-files-from-linux-terminal/ +[17]: https://itsfoss.com/best-command-line-games-linux/ diff --git a/published/202011/20201028 5 new sudo features you need to know in 2020.md b/published/202011/20201028 5 new sudo features you need to know in 2020.md new file mode 100644 index 0000000000..8472f95e4c --- /dev/null +++ b/published/202011/20201028 5 new sudo features you need to know in 2020.md @@ -0,0 +1,126 @@ +[#]: collector: (lujun9972) +[#]: translator: (wxy) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12865-1.html) +[#]: subject: (5 new sudo features you need to know in 2020) +[#]: via: (https://opensource.com/article/20/10/sudo-19) +[#]: author: (Peter Czanik https://opensource.com/users/czanik) + +2020 年 5 个新 sudo 功能 +====== + +> 从集中会话记录、chroot 支持到 Python API,sudo 1.9 提供了许多新功能。 + +![](https://img.linux.net.cn/data/attachment/album/202011/28/143544x5cdcxzf9dcujdng.jpg) + +当你想在 [POSIX 系统][2]上执行一个操作时,最安全的方法之一就是使用 `sudo` 命令。与以 root 用户身份登录并执行命令可能是个危险的操作不同,`sudo` 授予任何被系统管理员[指定为 “sudoer”][3]的用户临时权限,来执行通常受限制的活动。 + +几十年来,这个系统帮助 Linux、Unix 和 macOS 系统免受愚蠢的错误和恶意攻击,它是当今所有主要 Linux 发行版的默认管理机制。 + +当在 2020 年 5 月发布 sudo 1.9 时,它带来了许多新功能,包括集中收集会话记录,支持 `sudo` 内的 chroot,以及 Python API。如果你对其中的任何一项感到惊讶,请阅读我的文章,了解一些 [sudo 鲜为人知的功能][4]。 + +`sudo` 不仅仅是一个管理命令的前缀。你可以微调权限,记录终端上发生的事情,使用插件扩展`sudo`,在 LDAP 中存储配置,进行广泛的日志记录,以及更多。 + +1.9.0 版本和后续的小版本增加了各种新功能(我将在下面介绍),包括: + + * 一个集中收集 `sudo` 会话记录的记录服务 + * 审计插件 API + * 审批插件 API + * Python 对插件的支持 + * `sudo` 内置 chroot 和 CWD 支持(从 1.9.3 开始) + +### 哪里可以得到 sudo 1.9? + +大多数的 Linux 发行版仍然封装了上一代的 `sudo`(1.8 版本),并且在长期支持(LTS)的发行版中会保持这个版本数年。据我所知,提供了最完整的 sudo 1.9 包的 Linux 发行版是 openSUSE[Tumbleweed][5],它是一个滚动发行版,而且该 `sudo` 包的子包中有 Python 支持。最近的 [Fedora][6] 版本包含了 sudo 1.9,但没有 Python 支持。[FreeBSD Ports][7] 有最新的 `sudo` 版本,如果你自己编译 `sudo` 而不是使用软件包,你可以启用 Python 支持。 + +如果你喜欢的 Linux 发行版还没有包含 sudo 1.9,请查看 [sudo 二进制页面][8]来查看是否有现成的包可以用于你的系统。这个页面还提供了一些商用 Unix 变种的软件包。 + +像往常一样,在你开始试验 `sudo` 设置之前,*确保你知道 root 密码*。是的,即使在 Ubuntu 上也是如此。有一个临时的“后门”是很重要的;如果没有这个后门,如果出了问题,你就必须得黑掉自己的系统。记住:语法正确的配置并不意味着每个人都可以在该系统上通过 `sudo` 做任何事情! + +### 记录服务 + +记录服务可以集中收集会话记录。与本地会话记录存储相比,这有很多优势: + + * 更方便地在一个地方进行搜索,而不是访问各个机器来寻找记录 + * 即使在发送机器停机的情况下也可以进行记录 + * 本地用户若想掩盖其轨迹,不能删除记录 + +为了快速测试,你可以通过非加密连接向记录服务发送会话。我的博客中包含了[说明][9],可以在几分钟内完成设置。对于生产环境,我建议使用加密连接。有很多可能性,所以请阅读最适合你的环境的[文档][10]。 + +### 审计插件 API + +新的审计插件 API 不是一个用户可见的功能。换句话说,你不能从 `sudoers` 文件中配置它。它是一个 API,意味着你可以从插件中访问审计信息,包括用 Python 编写的插件。你可以用很多不同的方式来使用它,比如当一些有趣的事情发生时,从 `sudo` 直接发送事件到 Elasticsearch 或日志即服务(LaaS)上。你也可以用它来进行调试,并以任何你喜欢的格式将其他难以访问的信息打印到屏幕上。 + +根据你使用它的方式,你可以在 `sudo` 插件手册页(针对 C 语言)和 `sudo` Python 插件手册中找到它的文档。在 `sudo` 源代码中可以找到 [Python 代码示例][11],在我的博客上也有一个[简化的例子][12]。 + +### 审批插件 API + +审批插件 API 可以在命令执行之前加入额外的限制。这些限制只有在策略插件成功后才会运行,因此你可以有效地添加额外的策略层,而无需更换策略插件,进而无需更换 `sudoers`。可以定义多个审批插件,而且所有插件都必须成功,命令才能执行。 + +与审计插件 API 一样,你可以从 C 和 Python 中使用它。我博客上记录的[示例 Python 代码][13]是对该 API 的一个很好的介绍。一旦你理解了它是如何工作的,你就可以扩展它来将 `sudo` 连接到工单系统,并且只批准有相关开放工单的会话。你也可以连接到人力资源数据库,这样只有当班的工程师才能获得管理权限。 + +### Python 对插件的支持 + +尽管我不是程序员,但我最喜欢的 sudo 1.9 新特性是 Python 对插件的支持。你可以用 Python 也能使用 C 语言调用大部分 API。幸运的是,`sudo` 对性能不敏感,所以运行速度相对较慢的 Python 代码对 `sudo` 来说不是问题。使用 Python 来扩展 `sudo` 有很多优势: + + * 更简单、更快速的开发 + * 不需要编译;甚至可以通过配置管理分发代码 + * 许多 API 没有现成的 C 客户端,但有 Python 代码 + +除了审计和审批插件 API 之外,还有一些其他的 API,你可以用它们做一些非常有趣的事情。 + +通过使用策略插件 API,你可以取代 `sudo` 策略引擎。请注意,你将失去大部分的 `sudo` 功能,而且没有基于 `sudoers` 的配置。这在小众情况下还是很有用的,但大多数时候,最好还是继续使用 `sudoers`,并使用审批插件 API 创建额外的策略。如果你想尝试一下,我的 [Python 插件介绍][14]提供了一个非常简单的策略:只允许使用 `id` 命令。再次确认你知道 root 密码,因为一旦启用这个策略,它就会阻止任何实际使用 `sudo` 的行为。 + +使用 I/O 日志 API,你可以访问用户会话的输入和输出。这意味着你可以分析会话中发生了什么,甚至在发现可疑情况时终止会话。这个 API 有很多可能的用途,比如防止数据泄露。你可以监控屏幕上的关键字,如果数据流中出现任何关键字,你可以在关键字出现在用户的屏幕上之前中断连接。另一种可能是检查用户正在输入的内容,并使用这些数据来重建用户正在输入的命令行。例如,如果用户输入 `rm -fr /`,你可以在按下回车键之前就断开用户的连接。 + +组插件 API 允许非 Unix 组的查找。在某种程度上,这与审批插件 API 类似,因为它也扩展了策略插件。你可以检查一个用户是否属于一个给定的组,并在后面的配置部分基于此采取行动。 + +### chroot 和 CWD 支持 + +`sudo` 的最新功能是支持 chroot 和改变工作目录(CWD),这两个选项都不是默认启用的,你需要在 `sudoers` 文件中明确启用它们。当它们被启用时,你可以调整目标目录或允许用户指定使用哪个目录。日志反映了这些设置何时被使用。 + +在大多数系统中,chroot 只对 root 用户开放。如果你的某个用户需要 chroot,你需要给他们 root 权限,这比仅仅给他们 chroot 权限要大得多。另外,你可以通过 `sudo` 允许访问 chroot 命令,但它仍然允许漏洞,他们可以获得完全的权限。当你使用 `sudo` 内置的 chroot 支持时,你可以轻松地限制对单个目录的访问。你也可以让用户灵活地指定根目录。当然,这可能会导致灾难(例如,`sudo --chroot / -s`),但至少事件会被记录下来。 + +当你通过 `sudo` 运行一个命令时,它会将工作目录设置为当前目录。这是预期的行为,但可能有一些情况下,命令需要在不同的目录下运行。例如,我记得使用过一个应用程序,它通过检查我的工作目录是否是 `/root` 来检查我的权限。 + +### 尝试新功能 + +希望这篇文章能启发你仔细研究一下 sudo 1.9。集中会话记录比在本地存储会话日志更加方便和安全。chroot 和 CWD 支持为你提供了额外的安全性和灵活性。而使用 Python 来扩展 `sudo`,可以很容易地根据你的环境来定制 `sudo`。你可以通过使用最新的 Linux 发行版或 `sudo` 网站上的即用型软件包来尝试这些新功能。 + +如果你想了解更多关于 sudo 的信息,这里有一些资源: + + * [Sudo 官网][15] + * [Sudo 博客][16] + * [Sudo on Twitter][17] + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/10/sudo-19 + +作者:[Peter Czanik][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/czanik +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/tools_osyearbook2016_sysadmin_cc.png?itok=Y1AHCKI4 (Wratchet set tools) +[2]: https://opensource.com/article/19/7/what-posix-richard-stallman-explains +[3]: https://opensource.com/article/17/12/using-sudo-delegate +[4]: https://opensource.com/article/19/10/know-about-sudo +[5]: https://software.opensuse.org/distributions/tumbleweed +[6]: https://getfedora.org/ +[7]: https://www.freebsd.org/ports/ +[8]: https://www.sudo.ws/download.html#binary +[9]: https://blog.sudo.ws/posts/2020/03/whats-new-in-sudo-1.9-recording-service/ +[10]: https://www.sudo.ws/man/sudo_logsrvd.man.html#EXAMPLES +[11]: https://github.com/sudo-project/sudo/blob/master/plugins/python/example_audit_plugin.py +[12]: https://blog.sudo.ws/posts/2020/06/sudo-1.9-using-the-new-audit-api-from-python/ +[13]: https://blog.sudo.ws/posts/2020/08/sudo-1.9-using-the-new-approval-api-from-python/ +[14]: https://blog.sudo.ws/posts/2020/01/whats-new-in-sudo-1.9-python/ +[15]: https://www.sudo.ws/ +[16]: https://blog.sudo.ws/ +[17]: https://twitter.com/sudoproject diff --git a/published/202011/20201028 How JavaScript became a serious programming language.md b/published/202011/20201028 How JavaScript became a serious programming language.md new file mode 100644 index 0000000000..3b6b15fd92 --- /dev/null +++ b/published/202011/20201028 How JavaScript became a serious programming language.md @@ -0,0 +1,82 @@ +[#]: collector: (lujun9972) +[#]: translator: (wxy) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12813-1.html) +[#]: subject: (How JavaScript became a serious programming language) +[#]: via: (https://opensource.com/article/20/10/history-javascript) +[#]: author: (Nimisha Mukherjee https://opensource.com/users/nimisha) + +JavaScript 是如何成为一门严肃的编程语言的 +====== + +> 从最开始作为一种使网站变得漂亮的方式,JavaScript 已转变为一种严肃的编程语言。 + +![](https://img.linux.net.cn/data/attachment/album/202011/12/010945vezib4p1b1ti6pjt.jpg) + +JavaScript 的卑微起步始于 1995 年,是由当时在 Netscape 通信公司工作的 Brendan Eich [在短短 10 天内创建的][2]。从那时起,JavaScript 已经走过了漫长的道路,从一个让网站变得漂亮的工具变成了一种严肃的编程语言。 + +在其早期,JavaScript 被认为是一种视觉工具,它使网站变得更有趣和更有吸引力。像 [Jakarta Server Pages][3](即 JSP,以前称作 JavaServer Pages)这样的语言曾经用来完成渲染网页的繁重工作,而 JavaScript 则被用来创建基本的交互、视觉增强和动画。 + +长期以来,HTML、CSS 和 JavaScript 之间的分界并不明确。前端开发主要由 HTML、CSS 和 JavaScript 组成,形成了标准 Web 技术的“[多层蛋糕][4]”。 + +![标准 Web 技术的多层蛋糕][5] + +*标准网络技术的“[多层蛋糕][4]”(Mozilla 开发者网络,[CC BY-SA 4.0][6])* + +HTML 和 CSS 为内容提供结构、格式和样式。一旦网页要做一些超越了显示静态内容的事情,就是 JavaScript 的用武之地。Ecma 国际部开发了 JavaScript 规范,万维网联盟World Wide Web Consortium(W3C)开发了 HTML 和 CSS 规范。 + +### JavaScript 是如何获得突出地位的 + +JavaScript 是如何成为[最受欢迎的][8]编程语言的,背后有一段漫长的[历史][7]。早在 20 世纪 90 年代,Java 是王者,不可避免的人们会与它进行比较。许多工程师认为 JavaScript 不是一门好的编程语言,因为它缺乏对面向对象编程的支持。尽管当时并不明显,但其实 JavaScript 的对象模型和功能特性在其第一个版本中就已经出现了。 + +1995 年 JavaScript 匆匆发布后,网景公司将其提交给了欧洲计算机制造商协会European Computer Manufacturers Association(ECMA)国际部进行标准化。由此产生了 [ECMAScript][9],这是一个 JavaScript 标准,旨在确保不同 Web 浏览器之间网页的互操作性。ECMAScript 1 于 1997 年 6 月问世,帮助推进了 JavaScript 的标准化。 + +在此期间,PHP 和 JSP 成为了服务器端编程语言的流行选择。JSP 作为通用网关接口Common Gateway Interface([CGI][10])的首选替代方案获得了突出的地位,因为它可以在 HTML 中嵌入 Java 代码。虽然它很受欢迎,但开发人员发现将 Java 嵌入 HTML 中是不自然的。此外,即使是 HTML 上最简单的文本变化,JSP 也必须经历一个耗时的生命周期。在今天的微服务世界里,面向 JSP 的页面被认为是技术债务。  + +[PHP][11] 的工作原理与 JSP 类似,但 PHP 代码以一个通用网关接口([CGI][10])的可执行文件来处理。基于 PHP 的 Web 应用比基于 JSP 的应用更容易部署。总的来说,使用 PHP 更容易上手和运行。今天,PHP 和 JavaScript 是创建动态网站最流行的组合之一:PHP 作为服务器端脚本,JavaScript 作为客户端脚本。 + +伴随着 2006 年 [jQuery][12] 的发布,JavaScript 的应用越来越多。jQuery 是一个多用途的 JavaScript 库,简化了繁琐的文档对象模型Document Object Model(DOM)管理、事件处理和 [Ajax][13]。  + +2009 年 [Node.js][14] 的发布是 JavaScript 发展的转折点。开发者现在可以用 JavaScript 编写服务器端脚本了。紧随其后的是 2010 年发布的 [Backbone.js][15] 和 [AngularJS][16] 等框架。这导致了出现了使用单一语言进行全栈开发的概念。 + +2015 年,Ecma 国际部发布了 ECMAScript 6(ES6),它为编写复杂的应用程序增加了包括类声明在内的重要新语法。其他新特性还包括迭代器、箭头函数表达式、`let` 和 `const` 关键字、类型化数组、新的集合(映射、集合和 WeakMap)、Promise、字符串的模板字元以及许多其它很酷的特性。后来的版本又继续增加了更多的功能,使 JavaScript 更加强大、精简和可靠。 + +### 总结 + +在过去的 20 年里,JavaScript 有了长足的进步。现在大多数浏览器都在争相满足合规性,因此最新的规范推出得更快。 + +根据你的项目需求,有大量稳定的 JavaScript 框架可供选择,包括最流行的 [React][17]、[Angular][18] 和 [Vue.js][19] 等等。在本系列的下一篇文章中,我将深入探讨为什么 JavaScript 如此受欢迎。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/10/history-javascript + +作者:[Nimisha Mukherjee][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/nimisha +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/code_javascript.jpg?itok=60evKmGl (Javascript code close-up with neon graphic overlay) +[2]: https://en.wikipedia.org/wiki/JavaScript +[3]: https://en.wikipedia.org/wiki/Jakarta_Server_Pages +[4]: https://developer.mozilla.org/en-US/docs/Learn/JavaScript/First_steps/What_is_JavaScript +[5]: https://opensource.com/sites/default/files/uploads/layercakewebtech.png (Layer cake of standard web technologies) +[6]: https://creativecommons.org/licenses/by-sa/4.0/ +[7]: https://blog.logrocket.com/history-of-frontend-frameworks/ +[8]: https://octoverse.github.com/ +[9]: https://en.wikipedia.org/wiki/ECMAScript +[10]: https://en.wikipedia.org/wiki/Common_Gateway_Interface +[11]: https://en.wikipedia.org/wiki/PHP#:~:text=PHP%20development%20began%20in%201994,Interpreter%22%20or%20PHP%2FFI. +[12]: https://en.wikipedia.org/wiki/JQuery +[13]: https://en.wikipedia.org/wiki/Ajax_(programming) +[14]: https://en.wikipedia.org/wiki/Node.js +[15]: https://en.wikipedia.org/wiki/Backbone.js +[16]: https://en.wikipedia.org/wiki/AngularJS +[17]: https://reactjs.org/ +[18]: https://angular.io/ +[19]: https://vuejs.org/ diff --git a/published/202011/20201028 How to Clear Terminal Screen in Ubuntu and Other Linux Distributions -Beginner-s Tip.md b/published/202011/20201028 How to Clear Terminal Screen in Ubuntu and Other Linux Distributions -Beginner-s Tip.md new file mode 100644 index 0000000000..bb5988667c --- /dev/null +++ b/published/202011/20201028 How to Clear Terminal Screen in Ubuntu and Other Linux Distributions -Beginner-s Tip.md @@ -0,0 +1,87 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12806-1.html) +[#]: subject: (How to Clear Terminal Screen in Ubuntu and Other Linux Distributions [Beginner’s Tip]) +[#]: via: (https://itsfoss.com/clear-terminal-ubuntu/) +[#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/) + +如何清除 Ubuntu 和其他 Linux 发行版的终端屏幕 +====== + +![][2] + +在终端上工作时,通常会发现终端屏幕上显示了太多的命令及其输出。 + +你可能需要清除终端屏幕并专注于要执行的下一个任务。相信我,清除 Linux 终端屏幕会很有帮助。 + +### 使用 clear 命令清除 Linux 终端 + +那么,如何清除 Linux 中的终端?最简单,最常见的方法是使用 `clear` 命令: + +``` +clear +``` + +`clear` 命令无需选项。就是这么简单,但是你还需要了解其他一些内容。 + +![][1] + +`clear` 命令和其他清除屏幕的方法可能取决于你使用的终端模拟器。终端模拟器是用于访问 Linux Shell(命令行)的终端应用。 + +如果你在带有 GNOME 终端的 Ubuntu 上使用 `clear` 命令,它将清除屏幕,并且你将无法看到之前屏幕上的内容。 + +在许多其他终端模拟器或 Putty 中,它可能只清除一页屏幕。如果使用鼠标或 `PageUp` 和 `PageDown` 键滚动,那么仍然可以看到以前的屏幕输出。 + +坦白说,这取决于你的需要。如果你突然意识到需要引用以前运行的命令的输出,那么也许可以使用该方式。 + +### 在 Linux 中清除终端屏幕的其他方法 + +`clear` 命令不是清除终端屏幕的唯一方法。 + +你可以在 Linux 中使用 `Ctrl+L` [键盘快捷键][3]来清除屏幕。它适用于大多数终端模拟器。 + +``` +Ctrl+L +``` + +如果你在 GNOME 终端(Ubuntu 中默认)中使用 `Ctrl+L` 和 `clear` 命令,那么你会注意到它们的影响有所不同。`Ctrl+L` 将屏幕向下移动一页,给人一种干净的错觉,但是你仍然可以通过向上滚动来访问命令输出历史。 + +**某些其他终端模拟器将此键盘快捷键设置为 `Ctrl+Shift+K`**。 + +你也可以使用 `reset` 命令清除终端屏幕。实际上,此命令执行完整的终端重新初始化。但是,它可能比 `clear` 命令要花费更长的时间。 + +``` +reset +``` + +当你想完全清除屏幕时,还有几种其他复杂的方法可以清除屏幕。但是由于命令有点复杂,所以最好将它作为 [Linux 中的别名][4]: + +``` +alias cls='printf "\033c"' +``` + +你可以将此别名添加到你的 bash 配置文件中,以便作为命令使用。 + +我知道这是一个非常基本的主题,大多数 Linux 用户可能已经知道了,但这对于为新 Linux 用户介绍基本主题并没有什么坏处。是不是? + +在清除终端屏幕上有些秘密提示​​吗?为什么不与我们分享呢? + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/clear-terminal-ubuntu/ + +作者:[Abhishek Prakash][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://itsfoss.com/author/abhishek/ +[b]: https://github.com/lujun9972 +[1]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/10/clear-command-linux.gif?resize=800%2C432&ssl=1 +[2]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/10/clear-terminal-screen-linux.png?resize=800%2C450&ssl=1 +[3]: https://linuxhandbook.com/linux-shortcuts/ +[4]: https://linuxhandbook.com/linux-alias-command/ diff --git a/published/202011/20201028 What-s new in Fedora 33 Workstation.md b/published/202011/20201028 What-s new in Fedora 33 Workstation.md new file mode 100644 index 0000000000..c4027535d2 --- /dev/null +++ b/published/202011/20201028 What-s new in Fedora 33 Workstation.md @@ -0,0 +1,75 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12801-1.html) +[#]: subject: (What’s new in Fedora 33 Workstation) +[#]: via: (https://fedoramagazine.org/whats-new-fedora-33-workstation/) +[#]: author: (Gregory Bartholomew https://fedoramagazine.org/author/glb/) + +Fedora 33 Workstation 的新功能 +====== + +![][1] + +Fedora 33 Workstation 是我们这个免费的、领先的操作系统的[最新版本][2]。你现在就可以从[官方网站][3]下载它。Fedora 33 Workstation 中有一些新的和值得注意的变化。请阅读如下更多细节。 + +### GNOME 3.38 + +Fedora 33 Workstation 为各类用户提供了最新版本的 GNOME 桌面环境。在 Fedora 33 Workstation 中的 GNOME 3.38 包含了许多更新和改进,包括: + +#### 一个新的 GNOME Tour 应用 + +现在,新用户会看到一个“新的 Tour 应用,重点展示了桌面的主要功能,并为第一次使用 GNOME 的用户提供一个很好的欢迎页”。 + +![The new GNOME Tour application in Fedora 33][4] + +#### 拖动重排序应用 + +GNOME 3.38 用一个单一的可定制的、一致的视图取代了之前分开的“常用”和“所有”应用视图,这允许你重新排列应用并将它们组织到自定义文件夹中。只需点击并拖动即可移动应用。 + +![GNOME 3.38 Drag to Reorder][5] + +#### 改进屏幕录制 + +GNOME Shell 中的屏幕录制基础架构已被改进,以利用 PipeWire 和内核 API。这将有助于减少资源消耗并提高响应速度。 + +GNOME 3.38 还提供了许多额外的功能和改进。查看 [GNOME 3.38 发行说明][6]以获得更多信息。 + +#### B-tree 文件系统 + +正如[之前宣布的][7],新安装的 Fedora 33 将默认使用 [Btrfs][8]。每一个新的内核版本都会为 Btrfs 增加一些特性和增强功能。[变更日志][9]有一个完整的总结,它介绍了每个新内核版本给 Btrfs 带来的功能。 + +#### Swap on ZRAM + +Anaconda 和 Fedora IoT 多年来一直默认使用 swap-on-zram。在 Fedora 33 中,将默认启用 swap-on-zram,而不是交换分区。查看 [Fedora wiki 页面][10]了解更多关于 swap-on-zram 的细节。 + +#### 默认使用 Nano + +新的 Fedora 33 将把 `EDITOR` 环境变量默认设置为 [nano][11]。这个变化影响了一些命令行工具,当它们需要用户输入时,会打开一个文本编辑器。在早期的版本中,这个环境变量的默认值并没有被指定,而是由各个应用程序来选择一个默认的编辑器。通常情况下,应用程序会使用 [vi][12] 作为它们的默认编辑器,因为它是一个小应用,通常在大多数 Unix/Linux 操作系统的基础安装中都可以使用。由于 Fedora 33 的基本安装中包含了 nano,而且 nano 对于初学者来说更加直观,所以 Fedora 33 将默认使用 nano。当然,想要使用 vi 的用户可以在自己的环境中覆盖 `EDITOR` 变量的值。详见[Fedora 修改请求][11]获取更多信息。 + +-------------------------------------------------------------------------------- + +via: https://fedoramagazine.org/whats-new-fedora-33-workstation/ + +作者:[Gregory Bartholomew][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://fedoramagazine.org/author/glb/ +[b]: https://github.com/lujun9972 +[1]: https://fedoramagazine.org/wp-content/uploads/2020/10/f33workstation-816x345.jpg +[2]: https://fedoramagazine.org/announcing-fedora-33/ +[3]: https://getfedora.org/workstation +[4]: https://fedoramagazine.org/wp-content/uploads/2020/10/fedora-33-gnome-tour-1.png +[5]: https://fedoramagazine.org/wp-content/uploads/2020/10/drag-to-reorder-1.gif +[6]: https://help.gnome.org/misc/release-notes/3.38/ +[7]: https://fedoramagazine.org/btrfs-coming-to-fedora-33/ +[8]: https://en.wikipedia.org/wiki/Btrfs +[9]: https://btrfs.wiki.kernel.org/index.php/Changelog#By_feature +[10]: https://fedoraproject.org/wiki/Changes/SwapOnZRAM +[11]: https://fedoraproject.org/wiki/Changes/UseNanoByDefault +[12]: https://en.wikipedia.org/wiki/Vi diff --git a/published/202011/20201029 Improve your database knowledge with this MariaDB and MySQL cheat sheet.md b/published/202011/20201029 Improve your database knowledge with this MariaDB and MySQL cheat sheet.md new file mode 100644 index 0000000000..6ef5aef401 --- /dev/null +++ b/published/202011/20201029 Improve your database knowledge with this MariaDB and MySQL cheat sheet.md @@ -0,0 +1,368 @@ +[#]: collector: "lujun9972" +[#]: translator: "lxbwolf" +[#]: reviewer: "wxy" +[#]: publisher: "wxy" +[#]: url: "https://linux.cn/article-12822-1.html" +[#]: subject: "Improve your database knowledge with this MariaDB and MySQL cheat sheet" +[#]: via: "https://opensource.com/article/20/10/mariadb-mysql-cheat-sheet" +[#]: author: "Seth Kenlon https://opensource.com/users/seth" + +备忘单:提升你的 MariaDB 和 MySQL 数据库技能 +====== + +> 阅读本文并下载我们的免费备忘单,去使用开源的数据库吧。 + +![](https://img.linux.net.cn/data/attachment/album/202011/14/065421hq1qocmk3rf4npq1.jpg) + +当你写一个程序或配置一个服务时,你最终都要持久化存储信息。有时候,你只需要一个 INI 或者 [YAML][2] 配置文件就够了。而有时候,一个自定义格式的 XML 或者 JSON 或其他类似的文件会更好。 + +但也有时候你需要校验输入、快速查询信息、关联数据、通常还要熟练地处理你的用户的请求。这就是设计数据库的目的,而 [MariaDB][3](由 [MySQL][4] 的原始开发人员开发的一个分支) 是一个极佳的选项。在本文中我使用的是 MariaDB,但这些信息同样适用于 MySQL。 + +通过编程语言与数据库进行交互是很普遍的。正因如此,出现了大量 Java、Python、Lua、PHP、Ruby、C++ 和其他语言的 [SQL][5] 库。然而,在使用这些库之前,理解数据库引擎做了什么以及为什么选择数据库是重要的对我们会很有帮助。本文介绍 MariaDB 和 `mysql` 命令来帮助你熟悉数据库处理数据的基本原理。 + +如果你还没有安装 MariaDB,请查阅我的文章 [在 Linux 上安装 MariaDB][6]。如果你没有使用 Linux,请参照 MariaDB [下载页面][7]提供的指导方法。 + +### 与 MariaDB 交互 + +你可以使用 `mysql` 命令与 MariaDB 进行交互。首先使用子命令 `ping` 确认你的服务是运行着的,在提示后输入密码: + +``` +$ mysqladmin -u root -p ping +Enter password: +mysqld is alive +``` + +为了易于读者理解,打开一个交互式的 MariaDB 会话: + +``` +$ mysql -u root -p +Enter password: +Welcome to the MariaDB monitor. +Commands end with ; or \g. +[...] +Type 'help;' or '\h' for help. +Type '\c' to clear the current input statement. + +MariaDB [(none)]> +``` + +你现在是在一个 MariaDB 子 shell 中,提示符是 MariaDB 提示符。普通的 Bash 命令在这里不能使用,只能用 MariaDB 命令。输入 `help` (或 `?`)查看命令列表。这些是你的 MariaDB shell 的管理命令,使用它们可以定制你的 shell,但它们不属于 SQL 语言。 + +### 学习 SQL 基本知识 + +[结构化查询语言][8]是基于它们的能力定义的:一种通过有规则且一致的语法来查询数据库中的内容以得到有用的结果的方法。SQL 看起来像是普通的英文语句,有一点点生硬。例如,如果你登入数据库服务器,想查看有哪些库,输入 `SHOW DATABASES;` 并回车就能看到结果。 + +SQL 命令以分号作为结尾。如果你忘记输入分号,MariaDB 会认为你是想在下一行继续输入你的查询命令,在下一行你可以继续输入命令也可以输入分号结束命令。 + +``` +MariaDB [(NONE)]> SHOW DATABASES; ++--------------------+ +| DATABASE | ++--------------------+ +| information_schema | +| mysql | +| performance_schema | +| test | ++--------------------+ +4 ROWS IN SET (0.000 sec) +``` + +上面的例子显示当前有四个数据库:`information_schema`、`mysql`、`performance_schema` 和 `test`。你必须指定 MariaDB 使用哪个库,才能对该库使用查询语句。指定数据库的命令是 `use`。当你选择了一个库后,MariaDB 提示框会切换为选择的库。 + +``` +MariaDB [(NONE)]> USE test; +MariaDB [(test)]> +``` + +#### 显示数据库的表 + +数据库里有*表*,与电子表格类似:有一系列的行(在数据库中称为*记录*)和列。一个行和一个列唯一确定一个*字段*。 + +查看一个数据库中可用的表(可以理解为多表单电子表格中的一页),使用 SQL 关键字 `SHOW`: + +``` +MariaDB [(test)]> SHOW TABLES; +empty SET +``` + +`test` 数据库是空的,所以使用 `use` 命令切换到 `mysql` 数据库: + +``` +MariaDB [(test)]> USE mysql; +MariaDB [(mysql)]> SHOW TABLES; + ++---------------------------+ +| Tables_in_mysql | ++---------------------------+ +| column_stats | +| columns_priv | +| db | +[...] +| time_zone_transition_type | +| transaction_registry | +| USER | ++---------------------------+ +31 ROWS IN SET (0.000 sec) +``` + +这个数据库中有很多表!`mysql` 数据库是这个 MariaDB 实例的系统管理数据库。它里面包含重要数据,比如用来管理数据库权限的用户结构。这个数据库很重要,你不需要经常直接与它交互,但是使用 SQL 脚本来操作它却很常见。当你学习 MariaDB 时理解 `mysql` 数据库很有用,因为它有助于说明一些基本的 SQL 命令。 + +#### 检查一个表 + +这个实例的 `mysql` 数据库的最后一个表名为 `USER`。这个表包含了可以访问这个数据库的用户。当前里面只有一个 root 用户,但是你可以添加不同权限的用户,赋予它们查看、更新或创建数据的权限。你可以查看一个表的列首来了解一个 MariaDB 用户的所有属性: + +``` +> SHOW COLUMNS IN USER; +MariaDB [mysql]> SHOW COLUMNS IN USER; ++-------------+---------------+------+-----+----------+ +| FIELD | TYPE | NULL | KEY | DEFAULT | ++-------------+---------------+------+-----+----------+ +| Host | CHAR(60) | NO | PRI | | +| USER | CHAR(80) | NO | PRI | | +| Password | CHAR(41) | NO | | | +| Select_priv | enum('N','Y') | NO | | N | +| Insert_priv | enum('N','Y') | NO | | N | +| Update_priv | enum('N','Y') | NO | | N | +| Delete_priv | enum('N','Y') | NO | | N | +| Create_priv | enum('N','Y') | NO | | N | +| Drop_priv | enum('N','Y') | NO | | N | +[...] +47 ROWS IN SET (0.001 sec) +``` + +#### 创建一个新的用户 + +不论你是否需要一个普通的账号来管理数据库或者为计算机配置数据库(例如安装 WordPress、Drupal 或 Joomla时),在 MariaDB 中多建一个用户账号是很普遍的。你可以通过向 `mysql` 数据库的 `USER` 表中添加一个用户或使用 SQL 关键字 `CREATE` 来提示 MariaDB 创建一个 MariaDB 用户。使用 `CREATE` 来创建新用户会默认执行一些有用的方法,因此你不需要手动生成所有的信息: + +``` +> CREATE USER 'tux'@'localhost' IDENTIFIED BY 'really_secure_password'; +``` + +#### 查看表的字段 + +你可以使用 `SELECT` 关键字来查看数据库表的字段和值。这本例中,你创建了一个名为 `tux` 的用户,因此查询 `USER` 表中的列: + +``` +> SELECT USER,host FROM USER; ++------+------------+ +| USER | host | ++------+------------+ +| root | localhost | +[...] +| tux | localhost | ++------+------------+ +7 ROWS IN SET (0.000 sec) +``` + +#### 为一个用户赋予权限 + +通过查看 `USER` 表列出的信息,你可以看到用户的状态。例如,新用户 `tux` 对这个数据库没有任何权限。使用 `WHERE` 语句你可以只查 `tux` 那一条记录。 + +``` +> SELECT USER,select_priv,insert_priv,update_priv FROM USER WHERE USER='tux'; ++------+-------------+-------------+-------------+ +| USER | select_priv | insert_priv | update_priv | ++------+-------------+-------------+-------------+ +| tux | N | N | N | ++------+-------------+-------------+-------------+ +``` + +使用 `GRANT` 命令修改用户的权限: + +``` +> GRANT SELECT ON *.* TO 'tux'@'localhost'; +> FLUSH PRIVILEGES; +``` + +验证你的修改: + +``` +> SELECT USER,select_priv,insert_priv,update_priv FROM USER WHERE USER='tux'; ++------+-------------+-------------+-------------+ +| USER | select_priv | insert_priv | update_priv | ++------+-------------+-------------+-------------+ +| tux | Y | N | N | ++------+-------------+-------------+-------------+ +``` + +`tux` 用户现在有了从所有表中查询记录的权限。 + +### 创建自定义的数据库 + +到目前为止,你一直在与默认的数据库进行交互。除了用户管理,大部分人很少会与默认的数据库进行交互。通常,你会用自定义的数据来填充创建的数据库。 + +#### 创建一个 MariaDB 数据库 + +你可能已经可以自己在 MariaDB 中创建新数据库了。创建数据库跟新建用户差不多。 + +``` +> CREATE DATABASE example; +Query OK, 1 ROW affected (0.000 sec) +> SHOW DATABASES; ++--------------------+ +| DATABASE | ++--------------------+ +| example | +[...] +``` + +使用 `use` 命令来把这个新建的数据库作为当前使用的库: + +``` +> USE example; +``` + +#### 创建一个表 + +创建表比创建数据库要复杂,因为你必须定义列首。MariaDB 提供了很多方便的函数,可以用于创建列,引入数据类型定义,自增选项,对空值的约束,自动时间戳等等。 + +下面是用来描述一系列用户的一个简单的表: + +``` +> CREATE TABLE IF NOT EXISTS member ( + -> id INT AUTO_INCREMENT PRIMARY KEY, + -> name VARCHAR(128) NOT NULL, + -> startdate TIMESTAMP DEFAULT CURRENT_TIMESTAMP); +Query OK, 0 ROWS affected (0.030 sec) +``` + +这个表通过使用一个自动递增的方法来唯一标识每一行。表示用户名字的字段不能为空(或 `null`),每一行被创建时会自动生成时间戳。 + +使用 SQL 关键字 `INSERT` 向这个表填充一些示例数据: + +``` +> INSERT INTO member (name) VALUES ('Alice'); +Query OK, 1 ROW affected (0.011 sec) +> INSERT INTO member (name) VALUES ('Bob'); +Query OK, 1 ROW affected (0.011 sec) +> INSERT INTO member (name) VALUES ('Carol'); +Query OK, 1 ROW affected (0.011 sec) +> INSERT INTO member (name) VALUES ('David'); +Query OK, 1 ROW affected (0.011 sec) +``` + +验证一下表里的数据: + +``` +> SELECT * FROM member; ++----+-------+---------------------+ +| id | name | startdate | ++----+-------+---------------------+ +| 1 | Alice | 2020-10-03 15:25:06 | +| 2 | Bob | 2020-10-03 15:26:43 | +| 3 | Carol | 2020-10-03 15:26:46 | +| 4 | David | 2020-10-03 15:26:51 | ++----+-------+---------------------+ +4 ROWS IN SET (0.000 sec) +``` + +#### 同时增加多行数据 + +再创建一个表: + +``` +> CREATE TABLE IF NOT EXISTS linux ( + -> id INT AUTO_INCREMENT PRIMARY KEY, + -> distro VARCHAR(128) NOT NULL); +Query OK, 0 ROWS affected (0.030 sec) +``` + +填充一些示例数据,这次使用 `VALUES` 快捷方式,这样你可以一次添加多行数据。`VALUES` 关键字需要一个用括号包围的列表作为参数,也可以用逗号分隔的多个列表作为参数。 + +``` +> INSERT INTO linux (distro) + -> VALUES ('Slackware'), ('RHEL'),('Fedora'),('Debian'); +Query OK, 4 ROWS affected (0.011 sec) +Records: 4 Duplicates: 0 Warnings: 0 +> SELECT * FROM linux; ++----+-----------+ +| id | distro | ++----+-----------+ +| 1 | Slackware | +| 2 | RHEL | +| 3 | Fedora | +| 4 | Debian | ++----+-----------+ +``` + +### 关联多个表 + +现在你有两个表,之间没有关联。两个表的数据是独立的,但是你可能需要表一中的一个值来识别表二的记录。 + +你可以在表一中新增一列对应表二中的值。因为两个表都有唯一的标识符(自动递增的 `id` 字段),关联的它们的最简单的方式是,使用表一中的 `id` 字段作为表二的查询条件。 + +在表一中创建一列用来表示表二中的一个值: + +``` +> ALTER TABLE member ADD COLUMN (os INT); +Query OK, 0 ROWS affected (0.012 sec) +Records: 0 Duplicates: 0 Warnings: 0 +> DESCRIBE member; +DESCRIBE member; ++-----------+--------------+------+-----+---------+------+ +| FIELD | TYPE | NULL | KEY | DEFAULT | Extra| ++-----------+--------------+------+-----+---------+------+ +| id | INT(11) | NO | PRI | NULL | auto_| +| name | VARCHAR(128) | NO | | NULL | | +| startdate | TIMESTAMP | NO | | cur[...]| | +| os | INT(11) | YES | | NULL | | ++-----------+--------------+------+-----+---------+------+ +``` + +把 `linux` 表中的唯一 ID 分配给每个成员。因为记录已经存在,使用 `UPDATE` 关键字而不是 `INSERT`。尤其是当你想查询某行然后再更新某列值时。语法上,表达方式有点倒装,先更新后查询: + +``` +> UPDATE member SET os=1 WHERE name='Alice'; +Query OK, 1 ROW affected (0.007 sec) +ROWS matched: 1 Changed: 1 Warnings: 0 +``` + +要填充数据,请对其他名字重复执行这个过程。为了数据的多样性,在四行记录中分配三个不同的值。 + +#### 连接表 + +现在这两个表彼此有了关联,你可以使用 SQL 来展示关联的数据。数据库中有很多种连接方式,你可以尽请尝试。下面的例子是关联 `member` 表中 `os` 字段和 `linux` 表中 `id` 字段: + +``` +SELECT * FROM member JOIN linux ON member.os=linux.id; ++----+-------+---------------------+------+----+-----------+ +| id | name | startdate | os | id | distro | ++----+-------+---------------------+------+----+-----------+ +| 1 | Alice | 2020-10-03 15:25:06 | 1 | 1 | Slackware | +| 2 | Bob | 2020-10-03 15:26:43 | 3 | 3 | Fedora | +| 4 | David | 2020-10-03 15:26:51 | 3 | 3 | Fedora | +| 3 | Carol | 2020-10-03 15:26:46 | 4 | 4 | Debian | ++----+-------+---------------------+------+----+-----------+ +4 ROWS IN SET (0.000 sec) +``` + +连接 `os` 和 `id` 字段。 + +在图形化的应用中,你可以想象 `os` 字段可以在下拉菜单中设置,值的来源是 `linux` 表中的 `distro` 字段。通过使用多个表中独立却有关联的数据,你可以保证数据的一致性和有效性,使用 SQL 你可以动态地关联它们。 + +### 下载 MariaDB 和 MySQL 备忘单 + +MariaDB 是企业级的数据库。它是健壮、强大、高效的数据库引擎。学习它是你向管理 web 应用和编写语言库迈出的伟大的一步。你可以[下载 MariaDB 和 MySQL 备忘单][9],在你使用 MariaDB 时可以快速参考。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/10/mariadb-mysql-cheat-sheet + +作者:[Seth Kenlon][a] +选题:[lujun9972][b] +译者:[lxbwolf](https://github.com/lxbwolf) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/seth +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/coverimage_cheat_sheet.png?itok=lYkNKieP "Cheat Sheet cover image" +[2]: https://www.redhat.com/sysadmin/yaml-tips +[3]: https://mariadb.org/ +[4]: https://www.mysql.com/ +[5]: https://en.wikipedia.org/wiki/SQL +[6]: https://opensource.com/article/20/10/install-mariadb-and-mysql-linux +[7]: https://mariadb.org/download +[8]: https://publications.opengroup.org/c449 +[9]: https://opensource.com/downloads/mariadb-mysql-cheat-sheet \ No newline at end of file diff --git a/published/202011/20201029 Linux Kernel 5.10 Will be the Next LTS Release and it has Some Exciting Improvements Lined Up.md b/published/202011/20201029 Linux Kernel 5.10 Will be the Next LTS Release and it has Some Exciting Improvements Lined Up.md new file mode 100644 index 0000000000..ac2f20a8e5 --- /dev/null +++ b/published/202011/20201029 Linux Kernel 5.10 Will be the Next LTS Release and it has Some Exciting Improvements Lined Up.md @@ -0,0 +1,79 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12807-1.html) +[#]: subject: (Linux Kernel 5.10 Will be the Next LTS Release and it has Some Exciting Improvements Lined Up) +[#]: via: (https://itsfoss.com/kernel-5-10/) +[#]: author: (Ankush Das https://itsfoss.com/author/ankush/) + +Linux 内核 5.10 LTS 的一些令人兴奋的改进 +====== + +> Linux 内核 5.10 的开发正在进行中。已确认这是一个长期支持的版本,将带来更新的硬件支持和其他承诺的功能。 + +### Linux Kernel 5.10 将是长期支持版本 + +主要稳定内核维护者 **Greg Kroah-Hartman** 在 Linux 基金会欧洲开源峰会的 “Ask the Expert” 环节上发言,确认 Linux 5.10 将是下一个 LTS 版本。 + +尽管早期有一些关于 5.9 是 LTS 版本的猜测,但 Greg 澄清说,**一年的最后一个内核版本永远是 LTS 版本**。 + +目前来看,[Linux 内核 5.4][1] 系列恰好是最新的 LTS 版本,它增加了很多改进和硬件支持。另外,考虑到开发进度,Linux [内核 5.8][2] 是目前最大的版本,而 Linux 5.10 的第一个候选版本也很接近,所以下面有很多事情要做。 + +让我们来看看 Linux 内核 5.10 的一些功能和改进。 + +### Linux 内核 5.10 特性 + +![][4] + +**注意:** Linux 内核 5.10 仍处于早期开发阶段。因此,我们将定期更新文章,以更新最新的补充/功能。 + +#### AMD Zen 3 处理器支持 + +新的 [Ryzen 5000][5] 产品线是 2020 年最大的看点之一。所以,随着 Linux 内核 5.10 发布候选版本的推出,针对 Zen 3 处理器的各种新增功能也在陆续推出。 + +#### Intel Rocket Lake 支持 + +我并不对 Intel 的 Rocket Lake 芯片组在明年(2021 年) Q1 出货报太大希望。但是,考虑到英特尔在不断地压榨 14 纳米制程,看到 Intel Rocket Lake 在 Linux 内核 5.10 上所做的工作,绝对是一件好事。 + +#### Radeon RX 6000 系列开源驱动 + +尽管我们是在 Big Navi 揭晓前一天才报道的,但 Radeon RX 6000 系列绝对会是一个令人印象深刻的东西,可以和 NVIDIA RTX 3000 系列竞争。 + +当然,除非它和 Vega 系列或 5000 系列遇到的同样问题。 + +很高兴在 Linux 内核 5.10 上看到下一代 Radeon GPU 的开源驱动已经完成。 + +#### 文件系统优化和存储改进 + +[Phoronix][6] 报道了 5.10 也对文件系统进行了优化和存储改进。所以,从这一点来看,我们应该会看到一些性能上的改进。 + +#### 其他改进 + +毫无疑问,你应该期待新内核带来大量的驱动更新和硬件支持。 + +目前,对 SoundBlaster AE-7 的支持、对 NVIDIA Orin(AI 处理器)的早期支持以及 Tiger Lake GPU 的改进似乎是主要亮点。 + +Linux 内核 5.10 的稳定版本应该会在 12 月中旬左右发布。它将被支持至少 2 年,但可能一直会有安全和 bug 修复更新,直到 2026 年。因此,我们将继续关注下一个 Linux 内核 5.10 LTS 版本的发展,以获得任何令人兴奋的东西。 + +你对即将发布的 Linux 内核 5.10 有什么看法?请在评论中告诉我们你的想法。 + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/kernel-5-10/ + +作者:[Ankush Das][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://itsfoss.com/author/ankush/ +[b]: https://github.com/lujun9972 +[1]: https://itsfoss.com/linux-kernel-5-4/ +[2]: https://itsfoss.com/kernel-5-8-release/ +[3]: https://twitter.com/gregkh/status/1320745076566433793?ref_src=twsrc%5Etfw +[4]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/10/kernel-5-10-release.png?resize=800%2C450&ssl=1 +[5]: https://www.tomsguide.com/news/amd-ryzen-5000-revealed-what-it-means-for-pc-gaming +[6]: https://www.phoronix.com/scan.php?page=article&item=linux-510-features&num=1 diff --git a/published/202011/20201030 How to Use apt-cache Command in Debian, Ubuntu and Other Linux Distributions.md b/published/202011/20201030 How to Use apt-cache Command in Debian, Ubuntu and Other Linux Distributions.md new file mode 100644 index 0000000000..32432da3d8 --- /dev/null +++ b/published/202011/20201030 How to Use apt-cache Command in Debian, Ubuntu and Other Linux Distributions.md @@ -0,0 +1,169 @@ +[#]: collector: (lujun9972) +[#]: translator: (wxy) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12786-1.html) +[#]: subject: (How to Use apt-cache Command in Debian, Ubuntu and Other Linux Distributions) +[#]: via: (https://itsfoss.com/apt-cache-command/) +[#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/) + +如何在 Debian、Ubuntu 中使用 apt-cache 命令 +====== + +> 使用 apt-cache 命令,你可以在本地 APT 缓存中搜索软件包的详细信息。在本教程中学习使用 apt-cache 命令。 + +### apt-cache 命令是用来干什么的? + +[APT][1] [包管理器][2]工作在软件包元数据的本地缓存上。元数据通常由包名、版本、描述、依赖关系、仓库和开发者等信息组成。通过 `apt-cache` 命令,你可以查询这个本地 APT 缓存并获得相关信息。 + +你可以搜索一个包的可用性、它的版本号、它的依赖关系等等。我将通过实例告诉你如何使用 `apt-cache`命令。 + +APT 缓存的位置是 `/var/lib/apt/lists/` 目录。缓存哪些仓库元数据取决于你的源列表中 `/etc/apt/sources.list` 文件中添加的仓库,以及位于 `/etc/apt/sources.list.d` 目录下的额外仓库文件。 + +令人惊讶的是,`apt-cache` 并不能清除 APT 缓存。为此,你必须[使用 apt-get clean 命令][3]。 + +不用说,APT 打包系统是在 Debian 和基于 Debian 的 Linux 发行版上使用的,比如 Ubuntu、Linux Mint、Elementary OS 等。你不能在 Arch 或 Fedora 上使用它。 + +### 使用 apt-cache 命令 + +![][4] + +就像其他 Linux 命令一样,`apt-cache` 也有一些可用的选项,你可以随时参考它的手册页来了解这些选项。 + +然而,你可能并不需要使用所有的选项。这就是为什么我在本教程中只向你展示 `apt-cache` 命令中最常见和最有用的例子。 + +#### 始终更新 + +更新本地 APT 缓存以与远程仓库同步是一个好主意。如何做到这一点呢?你可以使用命令: + +``` +sudo apt update +``` + +#### 搜索软件包 + +`apt-cache` 命令最常见的用途是查找软件包。你可以使用一个正则表达式来搜索本地 APT 缓存中的包。 + +``` +apt-cache search package_name +``` + +默认情况下,它会在软件包的名称和描述中查找搜索关键词。它按字母顺序显示匹配的软件包及其简短的描述。 + +![][5] + +你也可以缩小搜索范围,只在软件包名称中查找搜索词。 + +``` +apt-cache search --names-only package_name +``` + +![][6] + +如果你想知道所有匹配软件包的完整细节,你可以使用 `--full` 标志。 + +![][7] + +#### 获取详细的包装信息 + +如果你知道确切的软件包名称(或者你已经成功地通过搜索找到了它),你可以得到软件包的详细元数据信息。 + +``` +apt-cache show package_name +``` + +![][8] + +你可以看到软件包元数据中的所有细节,比如名称、版本、开发者、维护者、仓库、长短描述、软件包大小甚至是校验和。 + +还有一个选项 `showpkg` 可以显示软件包的名称、版本、正向和反向依赖关系等信息。 + +``` +apt-cache showpkg package_name +``` + +#### apt-cache 的策略 + +这是 `apt-cache` 命令中很少使用的一个选项。`policy` 选项可以帮助你调试与 [preference 文件][9]相关的问题。 + +如果你指定了软件包的名称,它将显示该软件包是否已经安装,在哪个版本的仓库中可用,以及它的优先级。 + +![][10] + +默认情况下,每个已安装的软件包版本的优先级为 100,未安装的软件包的优先级为 500。同一软件包可能有多个不同优先级的版本。APT 会安装优先级较高的版本,除非安装的版本较新。 + +如果不理解这个部分,也没关系。对于一个普通的 Linux 用户来说,会极少纠结于这么深的软件包管理知识。 + +#### 检查软件包的依赖关系和反向依赖关系。 + +你可以在安装之前(甚至在安装之后)[检查一个包的依赖关系][11]。它还会显示所有可能满足依赖关系的软件包。 + +``` +apt-cache depends package +``` + +![][12] + +你也可以通过 `apt-cahce` 检查反向依赖关系来检查哪些包是依赖于某个包的。 + +![][13] + +坦白说,看到 Ansible 这样的 DevOps 工具对 [Cowsay 这样有趣的 Linux 命令][14]有依赖性,我也很惊讶。我想可能是因为在[安装 Ansible][15]之后,它会在节点上显示一些信息。 + +#### 检查未满足的依赖性 + +你可能会被 [Ubuntu 中未满足的依赖问题][16]所困扰,其他 Linux 也有类似问题。`apt-cache` 命令提供了一个选项来检查系统中各种可用软件包的所有未满足的依赖关系。 + +``` +apt-cache unmet +``` + +![][17] + +### 结论 + +你可以用 `apt-cache` 命令列出所有可用的软件包。输出结果会很庞大,所以我建议将其与 [wc 命令][18] 结合起来,得到可用软件包的总数,就像这样: + +``` +apt-cache pkgnames | wc -l +``` + +你是否注意到你不需要成为 [root 用户][19]就可以使用 `apt-cache` 命令? + +较新的 [apt 命令][20]也有一些与 `apt-cache` 命令相对应的功能选项。由于 `apt` 比较新,所以在脚本中还是首选使用 `apt-get` 及其相关的 `apt-cache` 等命令。 + +希望你觉得本教程对你有帮助。如果你对上面讨论的任何一点有疑问或者有改进的建议,请在评论中告诉我。 + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/apt-cache-command/ + +作者:[Abhishek Prakash][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://itsfoss.com/author/abhishek/ +[b]: https://github.com/lujun9972 +[1]: https://wiki.debian.org/Apt +[2]: https://itsfoss.com/package-manager/ +[3]: https://itsfoss.com/clear-apt-cache/ +[4]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/10/apt-cache-command.png?resize=800%2C450&ssl=1 +[5]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/10/apt-cache-search.png?resize=759%2C437&ssl=1 +[6]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/10/apt-cache-search-names-only.png?resize=759%2C209&ssl=1 +[7]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/10/apt-cache-show-full.png?resize=759%2C722&ssl=1 +[8]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/10/apt-cache-show-pkgname.png?resize=800%2C795&ssl=1 +[9]: https://debian-handbook.info/browse/stable/sect.apt-get.html#sect.apt.priorities +[10]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/10/apt-cache-policy.png?resize=795%2C456&ssl=1 +[11]: https://itsfoss.com/check-dependencies-package-ubuntu/ +[12]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/10/apt-cache-dependency-check.png?resize=768%2C304&ssl=1 +[13]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/10/apt-cache-reverse-dependency.png?resize=768%2C304&ssl=1 +[14]: https://itsfoss.com/funny-linux-commands/ +[15]: https://linuxhandbook.com/install-ansible-linux/ +[16]: https://itsfoss.com/held-broken-packages-error/ +[17]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/10/apt-cache-unmet.png?resize=759%2C399&ssl=1 +[18]: https://linuxhandbook.com/wc-command/ +[19]: https://itsfoss.com/root-user-ubuntu/ +[20]: https://itsfoss.com/apt-command-guide/ diff --git a/published/202011/20201102 4 cool new projects to try in COPR from October 2020.md b/published/202011/20201102 4 cool new projects to try in COPR from October 2020.md new file mode 100644 index 0000000000..a3e17071d5 --- /dev/null +++ b/published/202011/20201102 4 cool new projects to try in COPR from October 2020.md @@ -0,0 +1,109 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12810-1.html) +[#]: subject: (4 cool new projects to try in COPR from October 2020) +[#]: via: (https://fedoramagazine.org/4-cool-new-projects-to-try-in-copr-from-october-2020/) +[#]: author: (frostyx https://fedoramagazine.org/author/frostyx/) + +COPR 仓库中 4 个很酷的新项目(2020.10) +====== + +![][1] + +COPR 是个人软件仓库[集合][2],它不在 Fedora 中。这是因为某些软件不符合轻松打包的标准;或者它可能不符合其他 Fedora 标准,尽管它是自由而开源的。COPR 可以在 Fedora 套件之外提供这些项目。COPR 中的软件不受 Fedora 基础设施的支持,或者是由项目自己背书的。但是,这是一种尝试新的或实验性的软件的一种巧妙的方式。 + +本文介绍了 COPR 中一些有趣的新项目。如果你第一次使用 COPR,请参阅 [COPR 用户文档][3]。 + +### Dialect + +[Dialect][4] 使用谷歌翻译将文本翻译成外语。它可以记住你的翻译历史,并支持自动语言检测和文本到语音等功能。用户界面简约,模仿谷歌翻译工具本身,所以它真的很容易使用。 + +![][5] + +#### 安装说明 + +目前[仓库][6]在 Fedora 33 和 Fedora Rawhide 中提供了 Dialect。要安装它,请使用下面的命令: + +``` +sudo dnf copr enable lyessaadi/dialect +sudo dnf install dialect +``` + +### GitHub CLI + +[gh][7] 是一个官方的 GitHub 命令行客户端。它在终端提供了快速的访问,并完全控制你的项目问题、拉取请求和发布。议题(和其他东西)也可以在浏览器中轻松查看,以获得更标准的用户界面,或与他人分享。 + +![][8] + +#### 安装说明 + +目前[仓库][9]在 Fedora 33 和 Fedora Rawhide 中提供了 `gh` 。要安装它,请使用下面的命令: + +``` +sudo dnf copr enable jdoss/github-cli +sudo dnf install github-cli +``` + +### Glide + +[Glide][10] 是一个基于 GStreamer 的极简主义媒体播放器。它可以播放任何 GStreamer 支持的多媒体格式的本地和远程文件。如果你需要一个多平台的具有简单用户界面的媒体播放器,你可能会想试试 Glide。 + +![][11] + +#### 安装说明 + +目前[仓库][12]在 Fedora 32、33 和 Rawhide 中提供了 Glide。要安装它,请使用下面的命令: + +``` +sudo dnf copr enable atim/glide-rs +sudo dnf install glide-rs +``` + +### Vim ALE + +[ALE][13] 是 Vim 文本编辑器的一个插件,它提供了语法和语义错误检查。它还带来了诸如代码修复和许多其他类似于 IDE 的功能,如 TAB 补全、跳转到定义、查找引用、查看文档等。 + +![][14] + +#### 安装说明 + +目前[仓库][15]在 Fedora 31、32、33 和 Rawhide 还有 EPEL8 中提供了 `vim-ale` 。要安装它,请使用下面的命令: + +``` +sudo dnf copr enable praiskup/vim-ale +sudo dnf install vim-ale +``` + +编者注:可在[此处][16]查阅以前的 COPR 文章。 + +-------------------------------------------------------------------------------- + +via: https://fedoramagazine.org/4-cool-new-projects-to-try-in-copr-from-october-2020/ + +作者:[frostyx][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://fedoramagazine.org/author/frostyx/ +[b]: https://github.com/lujun9972 +[1]: https://fedoramagazine.org/wp-content/uploads/2017/08/4-copr-945x400.jpg +[2]: https://copr.fedorainfracloud.org/ +[3]: https://docs.pagure.org/copr.copr/user_documentation.html +[4]: https://github.com/gi-lom/dialect +[5]: https://fedoramagazine.org/wp-content/uploads/2020/10/dialect.png +[6]: https://copr.fedorainfracloud.org/coprs/lyessaadi/dialect/ +[7]: https://github.com/cli/cli +[8]: https://fedoramagazine.org/wp-content/uploads/2020/10/github-cli.png +[9]: https://copr.fedorainfracloud.org/coprs/jdoss/github-cli/ +[10]: https://github.com/philn/glide +[11]: https://fedoramagazine.org/wp-content/uploads/2020/10/glide.png +[12]: https://copr.fedorainfracloud.org/coprs/atim/glide-rs/ +[13]: https://github.com/dense-analysis/ale +[14]: https://fedoramagazine.org/wp-content/uploads/2020/10/vim-ale.png +[15]: https://copr.fedorainfracloud.org/coprs/praiskup/vim-ale/ +[16]: https://fedoramagazine.org/?s=COPR diff --git a/published/202011/20201102 4 reasons why JavaScript is so popular.md b/published/202011/20201102 4 reasons why JavaScript is so popular.md new file mode 100644 index 0000000000..4ac7718161 --- /dev/null +++ b/published/202011/20201102 4 reasons why JavaScript is so popular.md @@ -0,0 +1,115 @@ +[#]: collector: (lujun9972) +[#]: translator: (wxy) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12830-1.html) +[#]: subject: (4 reasons why JavaScript is so popular) +[#]: via: (https://opensource.com/article/20/11/javascript-popular) +[#]: author: (Nimisha Mukherjee https://opensource.com/users/nimisha) + +JavaScript 如此受欢迎的 4 个原因 +====== + +> JavaScript 之所以能在编程语言中名列前茅,是有充分的理由的。 + +![](https://img.linux.net.cn/data/attachment/album/202011/17/102936u1hghm95bbu7xjxg.jpg) + +如 GitHub 的 [The State of the Octoverse][2] 报告的这张图所示,如果按 GitHub 上项目的贡献者数量统计,[JavaScript][3] 一直是最受欢迎的编程语言。 + +![The State of the Octoverse 报告中的热门语言][4] + +*热门语言,根据《The State of the Octoverse》(©2019,[GitHub Corp][2])* + +在本系列的 [上一篇][5] 中,我们深入了解了 JavaScript 的历史。在这篇文章中,我将分享它如此受欢迎的四个[原因][6]。 + +### 1、JavaScript 适合初级、中级和高级开发人员 + +JavaScript 不需要任何环境设置,只要打开浏览器,比如 Chrome 浏览器,导航到[开发者工具][7],就可以开始编码。编写一个 “Hello World” 的程序,就这么简单: + +``` +console.log("Hello World"); +``` + +JavaScript 的灵活性最适合中级开发人员。该语言通过让开发人员专注于解决问题来帮助你完成任务。开发者可以混合使用插件和自己的代码片段来让一个应用程序工作。 + +虽然 JavaScript 比较容易上手,但它也并不是一下子就能掌握的。如果你想达到高级水平,这里有一些你需要了解的概念: + + * **JavaScript 的[多范式][8]特性:** JavaScript 同时支持函数式编程和面向对象编程(OOP)。 + * **在 JavaScript 中应用[设计模式][9]:** 模型-视图-*([MV*][10])设计模式一直是最流行的模式之一,并促成了[多个现代框架][11]的发展。 + * **[带原型链的继承][12]:** JavaScript 由于其动态的特性,无法实现传统的 Java 基于类的模式下的 OOP。JavaScript 中的 OOP 是通过原型继承模型实现的。 + * **[闭包][13]:** 闭包可以从内部函数中访问外部函数的作用域。 + * **[柯里化][14]Currying:** 柯里化是函数的一种转换,它将函数从 `f(a, b, c)` 的调用形式转换为 `f(a)(b)(c)` 调用形式。 + * **[Promises][15] 和 [Observables][16]:** 这些可以帮助你处理异步函数。 + * **[TypeScript][17]:** 在 JavaScript 中添加了静态类型。 + +### 2、全平台 + +JavaScript 可以在任何地方运行,包括: + + * 手机、平板电脑和笔记本电脑等设备。 + * 在客户端和服务器端。 + +这种在任何地方都能运行的能力使 JavaScript 成为一种通用语言。 + +### 3、开放标准和社区 + +[ECMAScript][18] 是 JavaScript 的标准化版本,也是一种开放的标准语言。公司可以使用 ECMAScript 来创建 JavaScript 的实现。根据[维基百科][19],“ECMAScript 引擎是执行以 ECMAScript 语言标准编写的源代码(例如,JavaScript)的程序”。最流行的引擎 [V8][20] 和 [SpiderMonkey][21] 是开源项目。 + +JavaScript 已经存在了 25 年,背后有一个庞大的社区。开发者们简直目不暇接,社区已经构建了如此多的插件和框架,以至于创造了“[框架疲劳][22]”这个词。 + +### 4、现代框架 + +现代框架如 [React][23]、[Angular][24] 和 [Vue.js][25] 已经稳定下来,并且正在进行优化以获得更好的性能。大多数框架对开发者非常友好,有良好的社区支持。 + +### 未来 + +JavaScript 将长期存在。全栈开发和现代前端框架继续帮助 JavaScript 巩固其作为最受欢迎的编程语言之一的地位。 + +JavaScript 的[下一波][26]可能会将焦点放在。 + + * **[Deno][27]:** JavaScript 的现代安全运行时。 + * **网络组件:** 可重复使用的自定义元素。 + * **与 AI 和 ML 的整合:** 像 [Supernova][28] 和 [BAYOU][29] 这样的项目在将 JavaScript 与人工智能和机器学习整合方面取得了实质性的突破。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/11/javascript-popular + +作者:[Nimisha Mukherjee][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/nimisha +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/javascript_vim.jpg?itok=mqkAeakO (JavaScript in Vim) +[2]: https://octoverse.github.com/ +[3]: https://en.wikipedia.org/wiki/JavaScript +[4]: https://opensource.com/sites/default/files/uploads/toplanguages-the_state_of_the_octoverse.png (Top Languages from The State of the Octoverse report) +[5]: https://linux.cn/article-12813-1.html +[6]: https://medium.com/paul-heintzelman/so-why-is-javascript-so-popular-f35bd6cfeb39 +[7]: https://developers.google.com/web/tools/chrome-devtools +[8]: https://medium.com/javascript-in-plain-english/what-are-javascript-programming-paradigms-3ef0f576dfdb +[9]: https://addyosmani.com/resources/essentialjsdesignpatterns/book/ +[10]: https://developpaper.com/javascript-mv-pattern/ +[11]: https://en.wikipedia.org/wiki/Model%E2%80%93view%E2%80%93viewmodel#JavaScript_frameworks +[12]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Inheritance_and_the_prototype_chain +[13]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Closures +[14]: https://javascript.info/currying-partials +[15]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise +[16]: https://rxjs-dev.firebaseapp.com/guide/observable +[17]: https://en.wikipedia.org/wiki/TypeScript +[18]: https://en.wikipedia.org/wiki/ECMAScript +[19]: https://en.wikipedia.org/wiki/List_of_ECMAScript_engines +[20]: https://en.wikipedia.org/wiki/V8_%28JavaScript_engine%29 +[21]: https://en.wikipedia.org/wiki/SpiderMonkey +[22]: https://teropa.info/blog/2015/07/15/overcoming-javascript-framework-fatigue.html +[23]: https://en.wikipedia.org/wiki/React_%28web_framework%29 +[24]: https://en.wikipedia.org/wiki/Angular_%28web_framework%29 +[25]: https://en.wikipedia.org/wiki/Vue.js +[26]: https://medium.com/@rangleio/the-future-of-javascript-in-the-front-end-world-2544c1814e2 +[27]: https://en.wikipedia.org/wiki/Deno_%28software%29 +[28]: https://techcrunch.com/2018/03/13/supernova-studio/ +[29]: https://futurism.com/military-created-ai-learned-to-program diff --git a/published/202011/20201102 Understand your Python code with this open source visualization tool.md b/published/202011/20201102 Understand your Python code with this open source visualization tool.md new file mode 100644 index 0000000000..460bdbee1f --- /dev/null +++ b/published/202011/20201102 Understand your Python code with this open source visualization tool.md @@ -0,0 +1,101 @@ +[#]: collector: "lujun9972" +[#]: translator: "xiao-song-123" +[#]: reviewer: "wxy" +[#]: publisher: "wxy" +[#]: url: "https://linux.cn/article-12819-1.html" +[#]: subject: "Understand your Python code with this open source visualization tool" +[#]: via: "https://opensource.com/article/20/11/python-code-viztracer" +[#]: author: "Tian Gao https://opensource.com/users/gaogaotiantian" + +使用开源可视化工具来理解你的 Python 代码 +====== + +> VizTracer 工具可以可视化并跟踪 Python 代码,让你可以更深入地了解其工作原理。 + +![](https://img.linux.net.cn/data/attachment/album/202011/13/225531g64gdav22n6d6va9.jpg) + +随着 Python 项目变得越来越大、越复杂,理解起它来就变得充满挑战性。即使是你自己独自编写了整个项目,也不可能完全知道项目是如何工作的。为了能更好的理解你的代码,调试和分析代码变得至关重要。 + +[VizTracer][2] 是一个这样的工具,它通过跟踪和可视化 Python 代码的执行过程,来帮助你对代码的理解。无需对源代码进行任何更改,VizTracer 即可记录函数的入口 / 出口,函数参数 / 返回值以及任意变量,然后通过 [Trace-Viewer][3] 使用直观的谷歌前端界面来显示数据。 + +下面是一个运行[蒙特卡洛树搜索][4]的例子: + +![Monte Carlo tree search visualization][5] + +每个函数都在时间线上以堆栈的形式记录和可视化,这样你就可以看到在运行程序时发生了什么。你可以放大查看任意特定点的详细信息: + +![Zooming in on VizTracer visualization][7] + +VizTracer 还可以自动记录函数参数和返回值。你可以单击函数条目并查看详细信息: + +![Viewing VizTracer details][8] + +或者你可以创建一个全新的信号,并用它来记录变量。例如,这显示了执行梯度下降时的成本值: + +![VizTracer gradient descent][9] + +与其他设置复杂的工具相比,VizTracer 使用起来非常简单,并且没有任何依赖关系。你可以从 pip 安装它: + +``` +pip install viztracer +``` + +你也可以通过输入来跟踪你的程序(`` 是你脚本的名称): + +``` +viztracer +``` + +VizTracer 将在你的工作目录中生成一个 HTML 报告,你可以在 Chrome 浏览器中打开它。 + +VizTracer 还提供了其他高级功能,比如过滤器功能,你可以使用它过滤掉不想跟踪的函数,获得更清晰的报告。例如,要仅包含文件中的函数,你需要: + +``` +viztracer include_files ./ --run +``` + +记录函数参数和返回值: + +``` +viztracer --log_function_args --log_return_value +``` + +记录与某个正则表达式匹配的任意变量: + +``` +# log variables starts with a +viztracer --log_var a.* --run <your_script.py> +``` + +你可以通过对源代码进行较小的修改来获得其他功能,例如自定义事件来记录数值和对象。 + +VizTracer 还包括一个虚拟调试器(vdb),它可以调试 VizTracer 的日志文件。可以用 vdb 调试你运行中的代码(与 [pdb][10] 非常相似)以便你了解代码流。有用的是,它还支持时间回溯,因为它知道发生的一切。 + +与一些原型不同,VizTracer 使用纯 C 语言实现其核心,这将极大地减少开销,使其达到类似于 [cProfile][11] 的水平。 + +VizTracer 是开源的,在 Apache 2.0 许可下发布,支持所有常见的操作系统平台(Linux、macOS 和 Windows)。你可以在 [GitHub][2] 上了解关于它的更多特性并访问源代码。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/11/python-code-viztracer + +作者:[Tian Gao][a] +选题:[lujun9972][b] +译者:[xiao-song-123](https://github.com/xiao-song-123) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/gaogaotiantian +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/python_programming_question.png?itok=cOeJW-8r "Python programming language logo with question marks" +[2]: https://github.com/gaogaotiantian/viztracer +[3]: http://google.github.io/trace-viewer/ +[4]: https://en.wikipedia.org/wiki/Monte_Carlo_tree_search +[5]: https://opensource.com/sites/default/files/uploads/viztracer_mcts.png "Monte Carlo tree search visualization" +[6]: https://creativecommons.org/licenses/by-sa/4.0/ +[7]: https://opensource.com/sites/default/files/uploads/viztracer_zoomin.png "Zooming in on VizTracer visualization" +[8]: https://opensource.com/sites/default/files/uploads/viztracer_details.png "Viewing VizTracer details" +[9]: https://opensource.com/sites/default/files/uploads/viztracer_gradient.png "VizTracer gradient descent" +[10]: https://docs.python.org/3/library/pdb.html +[11]: https://docs.python.org/2/library/profile.html#module-cProfile diff --git a/published/202011/20201103 4 ways to run Kubernetes locally.md b/published/202011/20201103 4 ways to run Kubernetes locally.md new file mode 100644 index 0000000000..9778b00d30 --- /dev/null +++ b/published/202011/20201103 4 ways to run Kubernetes locally.md @@ -0,0 +1,121 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12825-1.html) +[#]: subject: (4 ways to run Kubernetes locally) +[#]: via: (https://opensource.com/article/20/11/run-kubernetes-locally) +[#]: author: (Bryant Son https://opensource.com/users/brson) + +本地运行 Kubernetes 的 4 种方法 +====== + +> 设置一个本地开发环境,或者直接用这些工具尝试容器编排平台。 + +![](https://img.linux.net.cn/data/attachment/album/202011/16/132219hn9q9dszudbdtn35.jpg) + +[Kubernetes][2] 是一个开源的容器编排平台。它由 Google 开发,为自动化部署、扩展和管理容器化应用提供了一个开源系统。虽然大多数人在云环境中运行 Kubernetes,但在本地运行 Kubernetes 集群不仅是可能的,它还至少有两个好处: + +* 在决定使用 Kubernetes 作为主要平台部署应用之前,你可以快速试用它。 +* 在将任何东西推送到公共云之前,你可以将其设置为本地开发环境,从而实现开发环境和生产环境之间的分离。 + +无论你的情况如何,将本地 Kubernetes 环境设置为你的开发环境都是推荐的选择,因为这种设置可以创建一个安全而敏捷的应用部署流程。 + +幸运的是,有多个平台可以让你尝试在本地运行 Kubernetes,它们都是开源的,并且都是 [Apache 2.0][3] 许可。 + +* [Minikube][4] 的主要目标是成为本地 Kubernetes 应用开发的最佳工具,并支持所有适合的 Kubernetes 特性。 +* [kind][5] 使用 Docker 容器“节点”运行本地 Kubernetes 集群。 +* [CodeReady Containers][6](CRC)用来管理为测试和开发目的优化的本地 OpenShift 4.x 集群。 +* [Minishift][7] 通过在虚拟机 (VM) 内运行单节点的 OpenShift 集群,帮助你在本地运行 OpenShift 3.x 集群。 + +### Minikube + +![Minikube][8] + +[Minikube][10] 是在本地计算机上运行 Kubernetes 环境的最知名、最流行的选择。无论你使用什么操作系统,[Minikube 的文档][11]都会为你提供一个简单的[安装][12]指南。一般来说,安装 Minikube 只需运行两条命令: + +``` +$ curl -LO https://storage.googleapis.com/minikube/releases/latest/minikube-PLATFORM-amd64 +$ sudo install minikube-PLATFORM-amd64 /usr/local/bin/minikube +``` + +Minikube 可在 Linux、macOS 或 Windows 上快速设置本地 Kubernetes 集群,其功能如下: + +* 支持最新的 Kubernetes 版本(包括 6 个以前的小版本) +* 跨平台(Linux、macOS、Windows) +* 以虚拟机、容器或裸机的形式部署 +* 支持多个容器运行时(CRI-O、containerd、Docker) +* 用于快速推送镜像的 Docker API 端点 +* 负载均衡器、文件系统挂载、FeatureGates 和其他高级功能 +* 用于轻松安装 Kubernetes 应用的附加组件 + +因为 Minikube 是一个开源项目,你可以对它的[源代码][4]做贡献。 + +### kind + +![kind][13] + +[kind][14] 的开发者将其描述为“一个使用 Docker 容器‘节点’运行本地 Kubernetes 集群的工具”。它是为测试 Kubernetes 而设计的,但也可能用于本地开发或持续集成。 + +kind 支持: + +* 多节点(包括高可用性)集群 +* 从源码构建 Kubernetes 版本 +* Make/Bash/Docker 或 Bazel,以及预发布构建 +* Linux、MacOS 和 Windows + +此外,kind 是一个经过云原生计算基金会(CNCF)认证的 Kubernetes 合规安装程序。因为它是开源的,你可以在它的 GitHub 仓库中找到 kind 的[源码][5]。 + +### CodeReady Container (CRC) + +![CodeReady Container][15] + +如果你想在本地尝试最新版本的 OpenShift,可以尝试红帽的 [CodeReady Containers][16] (CRC)。CRC 将一个最小的 OpenShift 4.x 集群带到你的本地计算机上,为开发和测试目的提供一个最小的环境。CRC 主要针对开发者的桌面使用。 + +你可以在 GitHub 上找到 CodeReady Container 的[源码][6],也是在 Apache 2.0 许可下提供的。 + +### Minishift + +![Minishift][17] + +[Minishift][7] 项目帮助你在本地用 [OKD][19] 在虚拟机内的单节点 OpenShift 集群[运行一个版本的 OpenShift][18]。你可以用它来[尝试 OpenShift][20],或者在你的本地主机上为云开发。 + +和这个列表中的其他工具一样,Minishift 也是开源的,你可以在 GitHub 上访问它的[源码][7]。 + +### 为人服务的 Kubernetes + +正如你所看到的,有几种方法可以在本地环境中试用 Kubernetes。我有遗漏么?欢迎留言提问或提出建议。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/11/run-kubernetes-locally + +作者:[Bryant Son][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/brson +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/lenovo-thinkpad-laptop-concentration-focus-windows-office.png?itok=-8E2ihcF (Woman using laptop concentrating) +[2]: https://kubernetes.io/ +[3]: https://www.apache.org/licenses/LICENSE-2.0 +[4]: https://github.com/kubernetes/minikube +[5]: https://github.com/kubernetes-sigs/kind +[6]: https://github.com/code-ready/crc +[7]: https://github.com/minishift/minishift +[8]: https://opensource.com/sites/default/files/uploads/1_minikube.jpg (Minikube) +[9]: https://creativecommons.org/licenses/by-sa/4.0/ +[10]: https://minikube.sigs.k8s.io/docs/ +[11]: https://minikube.sigs.k8s.io/docs +[12]: https://minikube.sigs.k8s.io/docs/start/ +[13]: https://opensource.com/sites/default/files/uploads/2_kind.jpg (kind) +[14]: https://kind.sigs.k8s.io +[15]: https://opensource.com/sites/default/files/uploads/4_crc.jpg (CodeReady Container) +[16]: https://code-ready.github.io/crc +[17]: https://opensource.com/sites/default/files/uploads/3_minishift.jpg (Minishift) +[18]: https://www.redhat.com/sysadmin/kubernetes-cluster-laptop +[19]: https://www.okd.io/ +[20]: https://www.redhat.com/sysadmin/learn-openshift-minishift \ No newline at end of file diff --git a/published/202011/20201103 GnuCash- A Powerful Open Source Accounting Software.md b/published/202011/20201103 GnuCash- A Powerful Open Source Accounting Software.md new file mode 100644 index 0000000000..f8086ecdaa --- /dev/null +++ b/published/202011/20201103 GnuCash- A Powerful Open Source Accounting Software.md @@ -0,0 +1,95 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12823-1.html) +[#]: subject: (GnuCash: A Powerful Open Source Accounting Software) +[#]: via: (https://itsfoss.com/gnucash/) +[#]: author: (Ankush Das https://itsfoss.com/author/ankush/) + +GnuCash:一个强大的开源会计软件 +====== + +> GnuCash 是一款流行的自由开源的会计软件,可用于管理个人财务和商业交易。 + +![](https://img.linux.net.cn/data/attachment/album/202011/14/070431j1547hbh3v2j4vhh.jpg) + +考虑到管理个人财务和商业交易的复杂性,你会发现有很多旨在简化这些的在线服务或软件工具。有些工具只是让你添加支出和收入来跟踪你的储蓄,而其他一些工具则提供不同的功能。 + +我在过去已经介绍过几个[开源会计软件][1]。在这里,我将重点介绍其中一个 — **GnuCash**,它是一款很流行的免费会计软件,为所有用户提供了很多功能。 + +### GnuCash: 自由开源的会计软件 + +![][2] + +GnuCash 是一款为专业需求量身定做的免费会计软件,可以追踪交易、股票等。它适用于 Linux、BSD、macOS 和 Windows。 + +虽然刚开始使用可能会让人不知所措,但对于管理个人交易而言很容易使用。在你开始管理一个账户,并添加交易后,你可以得到一个详细的报告。 + +### GnuCash 的功能 + +![][3] + +正如我前面提到的,GnuCash 带来了一大堆功能,这对于一个刚接触会计的人来说可能会让人不知所措,但我认为它应该是值得的: + + * 复式记账 + * 股票/债券/共同基金账户 + * 有税务支持的小企业会计(如印度的商品和服务税) + * 详细的分类报告 + * 便于分析的图表 + * 支持财务计算 + * 自动保存功能 + * 彩色编码 + * 网上银行向导 + * 日志 + * 贷款还款计算器 + * 用于快速计算的价格数据库 + * 每个类别的预算平衡表、流程、图表 + * 能够以 CSV 格式导出 + * 分别添加客户、供应商和雇员记录。 + * 计划交易记录 + * 制定预算的能力 + * 配置账单生成器,以简化会计程序。 + +我不是专家,但这只是冰山一角。你会发现有很多选项可以根据你的会计需求进行定制和设置。 + +![Gnucash Report][4] + +### 在 Linux 上安装 GnuCash + +你可以在你的 Linux 发行版的软件中心找到 GnuCash。从那里安装或使用[发行版的软件包管理器][5]。 + +对于那些想要最新版本的人来说,还可以使用 [Flatpak 包][6]。如果你不知道它,我建议你去看看我们的 [Flatpak 指南][7]。 + +另外,你也可以从源码构建,或者你可以前往他们的[官方下载页面][8]来探索适合你的 Linux 发行版选项。 + +- [GnuCash][9] + +### 总结 + +对于基本的个人理财来说,这对我来说有点复杂,因为我更喜欢安卓应用的简单。不过,如果你试上几分钟,就会发现它很容易理解,GnuCash 似乎可以灵活地满足大多数要求。 + +如果你想管理自己或企业的财务,你可以尝试一下。它绝对比在电子表格中保存数据要好。 :) + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/gnucash/ + +作者:[Ankush Das][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://itsfoss.com/author/ankush/ +[b]: https://github.com/lujun9972 +[1]: https://itsfoss.com/open-source-accounting-software/ +[2]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/11/gnucash.jpg?resize=800%2C633&ssl=1 +[3]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/11/gnucash-screenshot.jpg?resize=800%2C636&ssl=1 +[4]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/11/gnucash-report.jpg?resize=800%2C638&ssl=1 +[5]: https://itsfoss.com/package-manager/ +[6]: https://flathub.org/apps/details/org.gnucash.GnuCash +[7]: https://itsfoss.com/flatpak-guide/ +[8]: https://www.gnucash.org/download.phtml#distribution +[9]: https://www.gnucash.org diff --git a/published/202011/20201103 Linux Jargon Buster- What are GUI, CLI and TUI in Linux.md b/published/202011/20201103 Linux Jargon Buster- What are GUI, CLI and TUI in Linux.md new file mode 100644 index 0000000000..b75edaa882 --- /dev/null +++ b/published/202011/20201103 Linux Jargon Buster- What are GUI, CLI and TUI in Linux.md @@ -0,0 +1,104 @@ +[#]: collector: (lujun9972) +[#]: translator: (wxy) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12809-1.html) +[#]: subject: (Linux Jargon Buster: What are GUI, CLI and TUI in Linux?) +[#]: via: (https://itsfoss.com/gui-cli-tui/) +[#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/) + +Linux 黑话解释:什么是 Linux 中的 GUI、CLI 和 TUI? +====== + +![](https://img.linux.net.cn/data/attachment/album/202011/10/092051zw3ofb365a63fahl.jpg) + +当你开始使用 Linux 并关注关于 Linux 的网站和论坛时,你会经常遇到诸如 GUI、CLI 等术语,有时还会遇到 TUI。 + +这一章的 Linux 黑话解释简要解释了这些术语,以便你作为一个(新的)Linux 用户在使用这些缩写词时能够更好地理解上下文。 + +说实话,像 GUI、CLI 或 TUI 这样的术语并不是 Linux 的专属术语。这些都是通用的计算术语,你会发现在非 Linux 的讨论中也会用到它们。 + +### GUI - 图形用户界面Graphical User Interface + +这可能是你在这里最常遇到的词汇。这是因为我们专注于桌面 Linux 用户,并试图涵盖易于使用的图形化方法和应用程序。 + +GUI 应用程序(或图形应用程序)基本上是指任何可以与你的鼠标、触摸板或触摸屏交互的东西。有了图标和其他视觉概念,你可以使用鼠标指针来访问功能。 + +![GIMP:一个用于照片编辑的GUI应用程序][1] + +在 Linux 上,[桌面环境][2]为你提供了与系统交互的图形界面,然后,你可以使用 GUI 应用程序,如 GIMP,VLC、Firefox、LibreOffice、文件管理器等来完成各种任务。 + +GUI 使普通用户的计算机使用变得更加容易,否则它将仍然是一个极客专用区。 + +### CLI - 命令行界面Command Line Interface + +CLI 基本上是一个接受输入来执行某种功能的命令行程序。基本上,任何可以在终端中通过命令使用的应用程序都属于这一类。 + +![apt-cache 是一个 CLI 工具,用于在基于 Debian 的系统上与 APT 缓存交互][3] + +早期的电脑与操作系统交互没有鼠标,你必须使用命令与机器互动。 + +如果你认为这都算困难,那你应该知道,早期的计算机甚至没有一个屏幕可以看到正在输入的东西,他们用实体的纸质打印机看到他们的输入命令。我从来没有用过这样的电脑,也没有在现实生活中看到过。我用过的最接近的东西是学习期间的单片机套件。 + +![肯•汤普森和丹尼斯•里奇在 PDP11 电脑上开发 UNIX 操作系统][4] + +现在的 CLI 还有用吗?当然有。命令总是有它的好处,特别是当你处理操作系统的核心功能和配置时,比如设置防火墙、管理网络甚至[包管理][5]。 + +你可能会有一个基于 GUI 的应用程序来完成同样的任务,但命令可以让你更精细地访问这些功能。在一些情况下,你会发现 GUI 应用程序也会用命令(在它们的代码中使用)与操作系统交互。 + +![Handbrake GUI 应用程序在底层使用 FFMPEG CLI 工具][6] + +许多流行的 GUI 应用程序往往是基于 CLI 工具的。以[Handbrake][7] 为例。这是一个流行的开源媒体转换器,它底层使用的是 [FFMPEG 命令行][8]工具。 + +很明显,使用命令行工具没有图形工具那么简单。不要担心。除非你有特殊需要,否则你应该可以用图形化的方式使用 Linux 系统。然而,了解基本的 Linux 命令会有很大的帮助。 + +### TUI - 终端用户界面Terminal User Interface(也称为基于文本的用户界面Text-based User Interface) + +这是三者中最不常见的名词。TUI 基本上部分是 GUI,部分是 CLI。糊涂了吗?让我为你解释一下。 + +你已经知道,早期的计算机使用 CLI。在实际的 GUI 出现之前,基于文本的用户界面在终端中提供了一种非常基本的图形交互。你会有更多的视觉效果,也可以使用鼠标和键盘与应用程序进行交互。 + +![终端中的 nnn 文件浏览器][9] + +TUI 是基于文本的用户界面或终端用户界面的缩写。“基于文本”这个说法主要是因为你在屏幕上有一堆文本,而“终端用户界面”的说法是因为它们只在终端中使用。 + +TUI 的应用虽然不是那么常见,但你还是有一些的。[基于终端的 Web 浏览器][10]是 TUI 程序的好例子。[基于终端的游戏][11]也属于这一类。 + +![CMUS 是基于终端的音乐播放器][12] + +当你在 [Ubuntu 中安装多媒体编解码器][13]时,你可能会遇到 TUI,你必须接受 EULA 或做出选择。 + +TUI 应用程序不像 GUI 应用程序那样用户友好,它们经常会有学习曲线,但它们比命令行工具更容易使用一些。 + +### 最后…… + +TUI 应用程序通常也被认为是 CLI 应用程序,因为它们被限制在终端上。在我看来,你是否认为它们与 CLI 不同,这取决于你。 + +我希望你喜欢这篇 Linux 黑话解释。如果你对这个系列的主题有什么建议,请在评论中告诉我,我将在以后尽量涵盖它们。 + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/gui-cli-tui/ + +作者:[Abhishek Prakash][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://itsfoss.com/author/abhishek/ +[b]: https://github.com/lujun9972 +[1]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2018/04/gimp-2-10-interface.jpg?resize=800%2C450&ssl=1 +[2]: https://itsfoss.com/what-is-desktop-environment/ +[3]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/10/apt-cache-search-names-only.png?resize=759%2C209&ssl=1 +[4]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/11/Ken_Thompson_and_Dennis_Ritchie_at_PDP-11.jpg?resize=800%2C641&ssl=1 +[5]: https://itsfoss.com/package-manager/ +[6]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2019/11/handbrake.png?resize=800%2C537&ssl=1 +[7]: https://itsfoss.com/handbrake/ +[8]: https://itsfoss.com/ffmpeg/ +[9]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/10/nnn-file-browser.jpg?resize=800%2C597&ssl=1 +[10]: https://itsfoss.com/terminal-web-browsers/ +[11]: https://itsfoss.com/best-command-line-games-linux/ +[12]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2017/07/cmus-interface.png?resize=734%2C436&ssl=1 +[13]: https://itsfoss.com/install-media-codecs-ubuntu/ diff --git a/published/202011/20201103 The New Raspberry Pi 400 is Basically a Tiny Computer Inside a Keyboard.md b/published/202011/20201103 The New Raspberry Pi 400 is Basically a Tiny Computer Inside a Keyboard.md new file mode 100644 index 0000000000..1a070873f6 --- /dev/null +++ b/published/202011/20201103 The New Raspberry Pi 400 is Basically a Tiny Computer Inside a Keyboard.md @@ -0,0 +1,99 @@ +[#]: collector: (lujun9972) +[#]: translator: (wxy) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12793-1.html) +[#]: subject: (The New Raspberry Pi 400 is Basically a Tiny Computer Inside a Keyboard) +[#]: via: (https://itsfoss.com/raspberry-pi-400/) +[#]: author: (Ankush Das https://itsfoss.com/author/ankush/) + +新的树莓派 400:一台藏身于键盘内微型计算机 +====== + +树莓派是什么已经无需介绍。这台起初是为 DIY 爱好者打造的低规格电脑,现在可以作为全功能桌面使用了。 + +随着树莓派 400 的发布,使得它更加适合作为家庭电脑使用。树莓派 400 基本上是一台藏身于键盘内微型计算机。 + +如果你还记得,[Commodore 64][1] 在 1982 年时也是一台键盘形式的电脑。尽管树莓派 400 并不是独一无二的,但对于树莓派这样的成功产品来说,这是一个令人心仪的产品。 + +### 树莓派 400 概观 + +![][2] + +它是基于树莓派 4 的(带有 4GB 内存),并已调整附加了冷却器。它采用四核处理器,速度比以往更快。 + +除了易用性和便携性,它还可以为你节省很多桌面空间。而且,就像我一样,如果你打算买一台备用电脑来测试东西,我想我可能会选择树莓派 400,而不是组装另一台 PC 或[基于 Linux 的迷你 PC][3]。 + +尽管我在下面提到了它的技术规格,但你可以观看官方视频来了解它的外观,以及它所承诺的是否可以满足作为你的家用电脑的需求。 + +![video](https://www.youtube.com/embed/ZSvHJ97d8n8) + +### 树莓派 400 技术规格 + + * 博通 BCM2711 四核 Cortex-A72(ARM v8)64 位 SoC @ 1.8GHz + * 4GB LPDDR4-3200 + * 双频(2.4GHz 和 5.0GHz)IEEE 802.11b/g/n/ac 无线局域网 + * 蓝牙 5.0,BLE + * 千兆以太网 + * 2 个 USB 3.0 和 1 个 USB 2.0 端口 + * 水平 40 针 GPIO 头 + * 2 个 micro HDMI 端口(支持最高 4Kp60) + * H.265(4Kp60 解码);H.264(1080p60 解码,1080p30 编码);OpenGL ES 3.0 图形 + * micro SD 卡插槽,用于操作系统和数据存储 + * 78 或 79 键的小型键盘(取决于地区差异) + * 5V DC,通过 USB 连接器 + * 工作温度:环境温度 0℃ 至 +50℃。 + * 最大尺寸 286 毫米 × 122 毫米 × 23 毫米 + +![][4] + +### 定价与供应 + +这是你付出 **70** 美元,所能得到的最好的现代家用电脑,只需一个键盘就可以简单的携带到任何地方(你只需要一个屏幕连接)。 + +你可以花 70 美元只买树莓派 400,也可以花 100 美元买完整的套装,它还包括一个 USB 鼠标、micro HDMI 转 HDMI 线、USB-C 电源、一本初学者指南和一张预装了树莓派操作系统的 SD 卡。 + +如果你想知道,对于键盘布局的支持,新闻稿中是这样提到的: + +> 在发布时,我们支持英语(英国和美国)、法语、意大利语、德语和西班牙语的键盘布局,并(首次)提供翻译版的新手指南。在不久的将来,我们计划支持与我们的[官方键盘][5]相同的语言集。 + +换句话说,一开始他们就支持所有主要的键盘布局。所以,对于大多数人来说,这应该不是问题。 + +除了键盘布局的细节外,下面是你如何获得树莓派 400 的方法: + +> 英国、美国和法国的树莓派 400 [套件][6]和[电脑][7]现在就可以购买。意大利、德国和西班牙的产品正在送往树莓派授权经销商的路上,他们应该在下周就会有货。 +> +> 我们预计,印度、澳大利亚和新西兰的授权经销商将在今年年底前拿到套件和电脑。我们也在迅速推出其他地区的合规认证,因此树莓派 400 将在 2021 年的前几个月在全球范围内上市。 +> +> 当然,如果你在剑桥附近的任何地方,你可以前往[树莓派商店][8],今天就可以领取你的树莓派 400。 + +- [树莓派 400][9] + +### 总结 + +在远程办公成为新常态的当下,树莓派 400 绝对是令人印象深刻的好东西,也是非常有用的。 + +你对新的树莓派 400 有什么看法?打算买一台吗?在下面的评论中告诉我你的想法。 + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/raspberry-pi-400/ + +作者:[Ankush Das][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://itsfoss.com/author/ankush/ +[b]: https://github.com/lujun9972 +[1]: https://en.wikipedia.org/wiki/Commodore_64 +[2]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/11/raspberry-pi-400.jpg?resize=800%2C554&ssl=1 +[3]: https://itsfoss.com/linux-based-mini-pc/ +[4]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/11/raspberry-pi-400-shot.jpeg?resize=800%2C572&ssl=1 +[5]: https://www.raspberrypi.org/products/raspberry-pi-keyboard-and-hub/ +[6]: https://www.raspberrypi.org/products/raspberry-pi-400/ +[7]: https://www.raspberrypi.org/products/raspberry-pi-400-unit/ +[8]: https://www.raspberrypi.org/raspberry-pi-store/ +[9]: https://www.raspberrypi.org/products/raspberry-pi-400 diff --git a/published/202011/20201105 5 surprising ways I use Jupyter to improve my life.md b/published/202011/20201105 5 surprising ways I use Jupyter to improve my life.md new file mode 100644 index 0000000000..8caca94e32 --- /dev/null +++ b/published/202011/20201105 5 surprising ways I use Jupyter to improve my life.md @@ -0,0 +1,89 @@ +[#]: collector: (lujun9972) +[#]: translator: (wxy) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12816-1.html) +[#]: subject: (5 surprising ways I use Jupyter to improve my life) +[#]: via: (https://opensource.com/article/20/11/surprising-jupyter) +[#]: author: (Moshe Zadka https://opensource.com/users/moshez) + +5 种令人惊讶的使用 Jupyter 的方式 +====== + +> Jupyter 不仅仅是一个数据分析工具,让我们看看如何以最有创意的方式使用这个基于 Python 的软件。 + +![](https://img.linux.net.cn/data/attachment/album/202011/12/224138d99jlp3q5qjqv5v7.jpg) + +[Jupyter][2] 项目提供了用 JupyterLab 和 Jupyter Notebook 等交互式编写软件的技术方式。这个软件通常用于数据分析,但你可能不知道(Jupyter 社区也没有想到),你可以用它做多少事情。 + +以下是我使用 Jupyter 的五大意想不到的创造性方法。 + +### 1、处理图像 + +在[图像编辑和处理][3]方面,有很多很好的开源工具 —— 从那些可以与 Photoshop 媲美的工具到实验性的 [Glimpse][4]。但即使有这么多选择,有时我还是不想离开 [Python][5] 的世界。 + +幸运的是,Jupyter 是一个做轻量级图像处理的好选择。利用 Jupyter 直接将 [Pillow][6] 对象显示为图像的优势,让你可以尽情地对图片进行实验。我甚至还用它给孩子[做了一个涂色画][7]。 + +### 2、做一个 SSH 跳板遥控器 + +由于 JupyterLab 可以让你[上传和下载][8]文件、[编辑][9]文件,甚至[运行终端][10],所以它拥有制作 SSH 跳板环境所需的所有部件。 + +通过一些 SSH 转发魔法,你可以让 Jupyter 成为防火墙另一边的[远程控制台][11]。 + +### 3、开发 Web 应用程序 + +我最喜欢的使用 Jupyter 的方式之一是用于一种意想不到的软件开发。我[做了一次演讲][12],在演讲中,我使用 Jupyter Notebook 实时开发了一个 [Web 应用][13]。讲演的最后是一个简单的表单,它是 XSS 和 CSS 安全的,并包括一些轻量级的服务器端计算。 + +一个日常的 Jupyter 用户可能不会期望它是一个最棒的 Web 开发环境,但它是一个非常强大的环境。 + +### 4、从你喜欢的服务中提取报告 + +JupyterLab 中的数据分析是一种常见的用法,但自我提升分析self-improvement analysis呢? + +你可以使用 Jupyter 来[分析你的日历][14]。如果你最喜欢的服务允许 API 导出,甚至可以让你导出一个 CSV,你可以将这些与你的日历进行关联。如果你发现你在社交媒体上发帖的时候,你的日历上写着你应该和你的经理开会,那 Jupyter 也救不了你! + +### 5、开发游戏 + +对于扩大对 Jupyter Notebook 的期望值,我最喜欢的方式是和孩子一起建立一个游戏。我之前写过这方面的文章,有一个使用 [PursuedPyBear][16] 和 Jupyter [编写游戏][15]的分步教程。 + +在试图弄清游戏机制时,这种迭代式的游戏开发方法特别有用。能够在游戏中途改变规则(对不起,我必须得这样做)是一个改变游戏规则的方法。 + +你甚至可以使用 IPywidgets 来修改数字参数,就像[这个视频][17]所示。 + +### 下载电子书 + +JupyterLab 和 Jupyter Notebooks 提供了一个不可思议的实验环境。[下载这本指南][18],其中包含了以令人吃惊的方式使用 Jupyter 的教程。  + +你是如何以创造性的方式使用它的?在下面的评论中分享你的最爱。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/11/surprising-jupyter + +作者:[Moshe Zadka][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/moshez +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/computer_space_graphic_cosmic.png?itok=wu493YbB (Computer laptop in space) +[2]: https://jupyter.org/ +[3]: https://opensource.com/life/12/6/design-without-debt-five-tools-for-designers +[4]: https://glimpse-editor.github.io/ +[5]: https://opensource.com/resources/python +[6]: https://pillow.readthedocs.io/en/stable/index.html +[7]: https://opensource.com/article/20/8/edit-images-python +[8]: https://jupyterlab.readthedocs.io/en/stable/user/files.html#uploading-and-downloading +[9]: https://jupyterlab.readthedocs.io/en/stable/user/files.html#opening-files +[10]: https://jupyterlab.readthedocs.io/en/stable/user/terminal.html +[11]: https://opensource.com/article/20/8/remote-management-jupyter +[12]: https://opensource.com/article/20/8/write-talk-using-jupyter-notebooks +[13]: https://github.com/moshez/interactive-web-development/blob/e31ae72d8cab7637d18bc734c4e8afc10c60251f/interactive-web-development.ipynb +[14]: https://opensource.com/article/20/9/analyze-your-life-jupyter +[15]: https://opensource.com/article/20/5/python-games +[16]: https://ppb.dev/ +[17]: https://www.youtube.com/watch?v=JaTf_ZT7tE8 +[18]: https://opensource.com/downloads/jupyter-guide diff --git a/published/202011/20201105 Got Kids- Limit Computer Usage Per Account in Linux With Timekpr-nExt.md b/published/202011/20201105 Got Kids- Limit Computer Usage Per Account in Linux With Timekpr-nExt.md new file mode 100644 index 0000000000..50d25c00a5 --- /dev/null +++ b/published/202011/20201105 Got Kids- Limit Computer Usage Per Account in Linux With Timekpr-nExt.md @@ -0,0 +1,109 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12835-1.html) +[#]: subject: (Got Kids? Limit Computer Usage Per Account in Linux With Timekpr-nExt) +[#]: via: (https://itsfoss.com/timekpr-next/) +[#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/) + +有孩子吗?使用 Timekpr-nExt 限制 Linux 中每个账户的电脑使用 +====== + +![](https://img.linux.net.cn/data/attachment/album/202011/18/004039svxva9wrvva2xias.jpg) + +> 本周的开源软件亮点是 Timekpr-nExt。它是一个 GUI 应用,用于限制 Linux 系统中某些账户的电脑使用。对于不想让孩子花太多时间在电脑上的父母来说,这是一个方便的工具。 + +### 使用 Timekpr-nExt 在 Linux 上限制电脑使用 + +如果你家里有小孩,他们花太多时间在电脑上,你可能想对他们的使用进行一些限制。 + +可以让你根据一天的时间、一天、一周或者一月的小时数来限制某些账户的电脑使用。你也可以设置时间间隔来强制账户用户休息。 + +![][1] + +给定的时间超过后,用户会自动登出,直到满足限制条件才可以重新登录。 + +![][2] + +当然,这意味着你需要为孩子们单独设置非管理员(无 `sudo` 权限)账户。如果孩子们的账户也有管理员权限,他们可以很容易地改变设置。孩子们很聪明,你知道的。 + +### Timekpr-nExt 的功能 + +除了一个令人讨厌的风格化的名字,Timekpr-nExt 有以下功能: + +* 将系统使用限制设置为按日智能限制、每日、每周或每月限制 +* 你还可以根据时间和小时设置访问限制 +* 用户可以看到关于他们还剩多少时间的通知 +* 设置锁定动作(终止会话、关闭、暂停或锁定屏幕) +* 追踪账户的时间使用情况 + +请注意以下事项: + +* 仔细检查你正在配置的账户。**不要把自己锁定** +* 每次更改配置时,请点击应用或设置按钮,否则更改将不会被设置 +* 儿童帐户不应该有管理员操作,否则他们会覆盖设置 + +这里阅读[关于使用 Timekpr-nExt 的更多信息的文档][3]。 + +### 在 Linux 中安装 Timekpr-nExt + +对于基于 Ubuntu 的 Linux 发行版(如 Mint、Linux Lite 等),有一个[官方 PPA 可用][4]。你可以通过以下命令逐步安装它: + +``` +sudo add-apt-repository ppa:mjasnik/ppa +sudo apt update +sudo apt install timekpr-next +``` + +Arch Linux 用户可以[在 AUR 中找到它][5]。对于其他用户,请检查你的发行版仓库。如果没有这样的包,你可以尝试使用源码。 + +- [Timekpr-nExt 源码][6] + +**再说一次,不要在主账户中使用 Timekpr-nExt。你可能会把自己锁在外面。** + +你会看到两个应用的实例。使用开头有 (SU) 的那个。 + +![][7] + +#### 删除 Timekpr-nExt + +我不能确定删除 Timekpr-nExt 是否也会删除你为用户设置的限制。手动恢复他们(间隔一天 24 小时)会是一个好主意。这里没有重置按钮。 + +要删除这个应用(如果你使用 PPA 安装它),使用以下命令: + +``` +sudo apt-get remove --purge timekpr-next +``` + +同时删除 PPA 仓库: + +``` +sudo add-apt-repository -r ppa:mjasnik/ppa +``` + +和[在 Linux 上屏蔽成人内容][8]一样,这个应用也是专门针对儿童的。并不是每个人都会觉得它有用,但家里有小孩的人如果觉得有必要的话,可以使用它。 + +你是否使用其他应用来监控/限制儿童访问计算机? + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/timekpr-next/ + +作者:[Abhishek Prakash][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://itsfoss.com/author/abhishek/ +[b]: https://github.com/lujun9972 +[1]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/10/timekpr-next-ubuntu.png?resize=800%2C612&ssl=1 +[2]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/10/timekpr-next-icon-system-notification-area.png?resize=640%2C94&ssl=1 +[3]: https://mjasnik.gitlab.io/timekpr-next/ +[4]: https://launchpad.net/~mjasnik/+archive/ubuntu/ppa +[5]: https://aur.archlinux.org/packages/timekpr-next/ +[6]: https://launchpad.net/timekpr-next +[7]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/10/timekeeper-next.jpg?resize=799%2C250&ssl=1 +[8]: https://itsfoss.com/how-to-block-porn-by-content-filtering-on-ubuntu/ \ No newline at end of file diff --git a/published/202011/20201105 How to Check Free Disk Space on Linux -Terminal and GUI Methods.md b/published/202011/20201105 How to Check Free Disk Space on Linux -Terminal and GUI Methods.md new file mode 100644 index 0000000000..f8ac5b6f0e --- /dev/null +++ b/published/202011/20201105 How to Check Free Disk Space on Linux -Terminal and GUI Methods.md @@ -0,0 +1,127 @@ +[#]: collector: (lujun9972) +[#]: translator: (robsean) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12831-1.html) +[#]: subject: (How to Check Free Disk Space on Linux [Terminal and GUI Methods]) +[#]: via: (https://itsfoss.com/check-free-disk-space-linux/) +[#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/) + +如何在 Linux 上检查可用的磁盘空间 +====== + +![](https://img.linux.net.cn/data/attachment/album/202011/17/111346h0vrdvldsy6hlhlh.jpg) + +> 我已经使用了多少磁盘空间? + +在 Linux 上查找可用磁盘空间的最简单的方法是[使用 df 命令][1] 。`df` 命令从字面意思上代表着磁盘可用空间disk free,很明显,它将向你显示在 Linux 系统上的可用磁盘空间。 + +``` +df -h +``` + +使用 `-h` 选项,它将以人类可读的格式(MB 和 GB)来显示磁盘空间。 + +这里是针对我 Dell XPS 系统的 `df` 命令的输出,它使用了加密磁盘并且只安装了 Linux: + +![在 Linux 中使用 df 命令检查可用磁盘空间][2] + +如果上面的输出使你感到困惑,不用担心。我将介绍一些关于在 Linux 中检查可用磁盘空间的东西。我也将为桌面 Linux 用户展示 GUI 方法。 + +### 方法 1: 使用 df 命令来检查在 Linux 中的可用磁盘空间(并理解它的输出) + +当你使用 `df` 命令来检查磁盘空间时,它将显示一组“文件系统”,包括它们的大小、使用的空间和可用的空间。你实际的磁盘通常应该下面列表中的一个: + + * `/dev/sda` + * `/dev/sdb` + * `/dev/nvme0n1p` + +这不是硬性的标准,但是它可以给予你一个指示,它可以让你能够很容易地从一堆文字中辨别出真正的磁盘。 + +你的 Linux 系统在你的磁盘上可能有一些用于引导 分区、EFI 分区、根分区、交换分区、家目录等的分区。在这种情况下,这些分区在“磁盘名称”的结尾处使用一个数字来标示,像 `/dev/sda1`、`/dev/nvme0n1p2` 等等。 + +你可以从它们的挂载点来辨认出哪个分区是用于做什么的。根分区挂载在 `/`、EFI 分区在 `/boot/EFI` 等等。 + +就我的情况来说,我已经使用了根分区下磁盘空间(232 GB)的 41% 。如果你有 2 到 3 个大分区(像根分区、家目录分区等等),你将不得不在这里计算一下已使用的磁盘空间。 + +![理解 df 命令输出][3] + + * `tmpfs`:[tmpfs][4](临时文件系统)用于在虚拟存储器中保持文件。你可以随意地忽略这个虚拟文件系统。 + * `udev`:[udev 文件系统][5] 用于存储插入到你系统的设备(像 USB、网卡、CD ROM 等等)的相关信息。你也可以忽略它。 + * `/dev/loop`: 它们是环回设备。由于 snap 应用程序,在 Ubuntu 中查看磁盘时,你将看到很多的这样的设备。环回设备是虚拟设备,它们允许普通文件作为块设备文件来访问。使用环回设备,snap 应用程序在它们自己的虚拟磁盘中进行沙盒处理。尽管它们是在根分区下,但是你不需要单独计算它们使用的磁盘空间。 + +#### 丢失了磁盘空间?检查你是否挂载了所有是磁盘和分区 + +记住,`df` 命令仅显示已挂载文件系统的磁盘空间。如果你在同一块磁盘上使用多个 Linux 发行版(或者多个操作系统),或者在你的系统上有多个磁盘,你需要先挂载它们,以便查看在这些分区和磁盘上的可用磁盘空间。 + +例如,我的 [Intel NUC][6] 有两个 SSD 磁盘,并且在其上有 4 个或 5 个 Linux 分区。仅当我明确地挂载它们时,`df` 命令才会显示更多磁盘。 + +![][7] + +你可以使用 `lsblk` 命令来查看在你系统上的所有磁盘和分区。 + +![][8] + +在你有了磁盘分区名称后,你可以用这种方式来挂载它: + +``` +sudo mount /dev/sdb2 /mnt +``` + +我希望这种方法能够给你提供一个在 Linux 上检查硬盘驱动器空间的好主意。让我们看看如何在 GUI 下来完成。 + +### 方法 2: 在 GUI 下检查可用磁盘使用情况 + +在 Ubuntu 中使用 “Disk Usage Analyzer” 工具来在 GUI 的方式下检查可用磁盘空间是很容易的。 + +![Disk Usage Analyzer 工具][9] + +在这里,你将看到所有实际的磁盘和分区。你可能需要单击一些分区来挂载它们。它显示所有已挂载分区的磁盘使用情况。 + +![磁盘使用情况检查][10] + +#### 使用 GNOME 的 Disks 实用程序来检查可用磁盘空间 + +除此之外,GNOME 的 Disks 实用程序也是非常容易使用的工具。 + +![GNOME 的 Disks 工具][11] + +启动工具和选择磁盘。选择一个分区来查看可用磁盘空间。如果没有挂载分区,那么先通过单击 “▶” 图标来挂载它。 + +![检查 Ubuntu 的桌面版本的可用磁盘空间][12] + +我认为在 Linux 上的所有主要桌面环境都有某种图形工具来检查磁盘使用情况。你可以在你是桌面 Linux 系统的菜单中搜索它。 + +### 结束语 + +当然,有很多方法和工具来检查磁盘空间。为此,我向你显示了最常用的命令行方法和 GUI 方法。 + +我也解释一些可能会让你很难理解磁盘使用情况的东西。希望你喜欢它。 + +如果你有问题或建议,请在评论区告诉我。 + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/check-free-disk-space-linux/ + +作者:[Abhishek Prakash][a] +选题:[lujun9972][b] +译者:[robsean](https://github.com/robsean) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://itsfoss.com/author/abhishek/ +[b]: https://github.com/lujun9972 +[1]: https://linuxhandbook.com/df-command/ +[2]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/11/free-disk-space-linux-df-command-output.png?resize=786%2C475&ssl=1 +[3]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/11/df-command-output.png?resize=800%2C600&ssl=1 +[4]: https://www.kernel.org/doc/html/latest/filesystems/tmpfs.html +[5]: https://wiki.debian.org/udev +[6]: https://itsfoss.com/install-linux-on-intel-nuc/ +[7]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/11/df-command-ubuntu-1.png?resize=786%2C443&ssl=1 +[8]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/11/lsblk-command-to-see-disks-linux.png?resize=786%2C538&ssl=1 +[9]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/11/disk-usage-analyzer-tool-linux.jpg?resize=800%2C250&ssl=1 +[10]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/11/free-disk-space-ubuntu-desktop.png?resize=800%2C648&ssl=1 +[11]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/11/disks-tool-linux.jpg?resize=800%2C250&ssl=1 +[12]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/11/free-disk-space-check-ubuntu-desktop.png?resize=800%2C600&ssl=1 diff --git a/published/202011/20201105 How to Scan-Detect New LUNs and SCSI Disks on Linux.md b/published/202011/20201105 How to Scan-Detect New LUNs and SCSI Disks on Linux.md new file mode 100644 index 0000000000..7946201c1d --- /dev/null +++ b/published/202011/20201105 How to Scan-Detect New LUNs and SCSI Disks on Linux.md @@ -0,0 +1,163 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12820-1.html) +[#]: subject: (How to Scan/Detect New LUNs and SCSI Disks on Linux) +[#]: via: (https://www.2daygeek.com/scan-detect-luns-scsi-disks-on-redhat-centos-oracle-linux/) +[#]: author: (Magesh Maruthamuthu https://www.2daygeek.com/author/magesh/) + +如何在 Linux 上扫描/检测新的 LUN 和 SCSI 磁盘 +====== + +![](https://img.linux.net.cn/data/attachment/album/202011/14/001530vgyym7779ys09y7m.jpg) + +当 Linux 系统连接到 SAN(存储区域网络)后,你需要重新扫描 iSCSI 服务以发现新的 LUN。 + +要做到这一点,你必须向存储团队提供 Linux 主机的 WWN 号和所需的 LUN 大小。 + +这篇文章将帮助你[查找 Linux 主机的 WWN 号][1]。 + +当存储团队将 LUN 与给定的 Linux 主机进行了映射,他们将为你提供新的 LUN 详细信息。 + +LUN 在存储术语中被称为 LUN 的串行十六进制。 + +你需要扫描 SCSI 主机来寻找存储团队分配的新 LUN。 + +这可以通过两种方式进行,扫描每个 scsi 主机设备或运行 `rescan-scsi-bus.sh` 脚本来检测新磁盘。 + +扫描后可以在 `/dev/disk/by-id` 目录下找到它们。 + +``` +# ll /dev/disk/by-id + +total 0 +lrwxrwxrwx 1 root root 10 Jul 9 17:52 scsi-60a98000486e542d4f5a2f47694d684b -> ../../sdah +lrwxrwxrwx 1 root root 9 Jul 9 17:52 scsi-60a98000486e542d4f5a2f47694d684c -> ../../sdw +. +. +lrwxrwxrwx 1 root root 10 Jul 9 17:52 scsi-60a98000486e542d4f5a2f47694d684d -> ../../sdjk +lrwxrwxrwx 1 root root 10 Jul 9 17:52 scsi-60a98000486e542d4f5a2f47694d684e -> ../../sdaa +lrwxrwxrwx 1 root root 9 Jul 9 17:52 scsi-60a98000486e542d4f5a2f47694d684f -> ../../sdh +``` + +另外,如果你已经用 `multipath` 配置了它们,那么可以用 `multipath` 命令找到。 + +`multipath 主要是配置到 Oracle 数据库服务器中,以提高性能。 + +``` +# multipath -ll + +60a98000486e542d4f5a2f47694d684b dm-37 NETAPP,LUN C-Mode +size=512G features='3 queue_if_no_path pg_init_retries 50' hwhandler='1 alua' wp=rw +|-+- policy='round-robin 0' prio=50 status=active +| |- 1:0:4:18 sdoe 128:416 active ready running +| |- 0:0:4:18 sdpq 131:256 active ready running +| |- 0:0:5:18 sdsr 135:496 active ready running +| `- 1:0:5:18 sdsq 135:480 active ready running +`-+- policy='round-robin 0' prio=10 status=enabled +|- 1:0:1:18 sdfw 131:32 active ready running +|- 1:0:0:18 sdci 69:96 active ready running +|- 0:0:1:18 sdbz 68:208 active ready running +|- 0:0:0:18 sds 65:32 active ready running +|- 1:0:3:18 sdmd 69:336 active ready running +|- 1:0:2:18 sdjj 8:464 active ready running +|- 0:0:3:34 sdjt 65:368 active ready running +`- 0:0:2:34 sdgi 131:224 active ready running +``` + +这个过程适用于基于 Red Hat 6.x、7.x 和 8.x(RHEL - Red Hat Enterprise Linux)的系统,如 CentOS 和 Oracle Linux。 + +### 方法 1:如何使用 /sys 类文件在 Linux 上扫描新的 LUN 和 SCSI 磁盘 + +sysfs 文件系统是一个伪文件系统,它为内核数据结构提供了一个接口。 + +sysfs 下的文件提供了关于设备、内核模块、文件系统和其他内核组件的信息。 + +sysfs 文件系统通常被挂载在 `/sys`。通常,它是由系统自动挂载的。 + +你可以使用 `echo` 命令来扫描每个 SCSI 主机设备,如下所示: + +``` +# echo "- - -" > /sys/class/scsi_host/host[n]/scan +``` + +当你运行上面的重新扫描所有的命令时,三个破折号(`- – -`)指的是通配符选项。这些值如下: + +``` +# echo "c t l" > /sys/class/scsi_host/host[n]/scan +``` + +这里: + +* `c`:HBA 上的通道 +* `t`:SCSI 目标 ID +* `l`:LUN ID +* `n`:HBA 编号 + +运行下面的命令来查找系统中所有的主机总线编号: + +``` +# ls /sys/class/scsi_host +host0 host1 host2 +``` + +得到主机总线编号后,运行以下命令来发现新的磁盘: + +``` +# echo "- - -" > /sys/class/scsi_host/host0/scan +# echo "- - -" > /sys/class/scsi_host/host1/scan +# echo "- - -" > /sys/class/scsi_host/host2/scan +``` + +另外,还可以用 `for` 循环用一条命令进行扫描。 + +``` +# for host in ls /sys/class/scsi_host/;do echo "- - -" >/sys/class/scsi_host/${host}/scan; done +``` + +你可以使用文章开头提到的 [ls 命令][2]来检查它们。 + +``` +# ls /dev/disk/by-id | grep -i "serial-hex of LUN" +``` + +### 方法 2:如何使用 rescan-scsi-bus.sh 脚本在 Linux 上扫描新的 LUN 和 SCSI 磁盘 + +确保你已经安装了 `sg3_utils` 包来使用这个脚本。否则,运行以下命令来安装它。 + +对于 RHEL/CentOS 6/7 系统,使用 [yum 命令][3]安装 `sg3_utils`。 + +``` +# yum install -y sg3_utils +``` + +对于 RHEL/CentOS 8 和 Fedora 系统,使用 [dnf 命令][4]安装 sg3_utils。 + +``` +# dnf install -y sg3_utils +``` + +现在你可以使用 `rescan-scsi-bus.sh` 脚本重新扫描 LUN。 + +``` +# ./rescan-scsi-bus.sh +``` + +-------------------------------------------------------------------------------- + +via: https://www.2daygeek.com/scan-detect-luns-scsi-disks-on-redhat-centos-oracle-linux/ + +作者:[Magesh Maruthamuthu][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://www.2daygeek.com/author/magesh/ +[b]: https://github.com/lujun9972 +[1]: https://www.2daygeek.com/how-to-find-wwn-wwnn-wwpn-number-of-hba-card-in-linux/ +[2]: https://www.2daygeek.com/linux-unix-ls-command-display-directory-contents/ +[3]: https://www.2daygeek.com/linux-yum-command-examples-manage-packages-rhel-centos-systems/ +[4]: https://www.2daygeek.com/linux-dnf-command-examples-manage-packages-fedora-centos-rhel-systems/ \ No newline at end of file diff --git a/published/202011/20201105 Tweak your Git config for multiple user IDs.md b/published/202011/20201105 Tweak your Git config for multiple user IDs.md new file mode 100644 index 0000000000..746d6fc422 --- /dev/null +++ b/published/202011/20201105 Tweak your Git config for multiple user IDs.md @@ -0,0 +1,74 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12814-1.html) +[#]: subject: (Tweak your Git config for multiple user IDs) +[#]: via: (https://opensource.com/article/20/10/git-config) +[#]: author: (Ramanathan M https://opensource.com/users/muthiahramanathan) + +调整你的 Git 配置以适应多个用户 ID 的需要 +====== + +> 可以使用相同的机器用于工作和个人的 Git 提交,而无需手动重置你的配置。 + +![](https://img.linux.net.cn/data/attachment/album/202011/12/013805t4u4nu57rc6ur7nt.jpg) + +Git 的 [git config][2] 命令可以让你为 Git 设置仓库或全局选项。它有很多选项,其中的一个选项 `includeIf` 在你使用在 Git 时有双重角色时非常方便,比如说,你既是全职的开发者,又在业余时间为开源项目做贡献。在这种情况下,大多数人都不想为两个角色使用一个共同的配置,或者,至少,他们肯定希望保持配置的某些部分是不同的,尤其是当他们在两个角色中使用同一台计算机时。 + +我的情况就是这样,所以我在 Git 配置中保留了两组不同的邮件 ID。这样一来,在我工作场所的项目仓库中提交的内容就会使用我办公室的邮件 ID,而在我个人 GitHub 帐户中提交的内容则使用我个人的邮件 ID。 + +以下是我的全局配置(维护在 `$HOME/.gitconfig`)中的一个片段,我将在下文中介绍。 + +``` +[includeIf "gitdir:~/priv_scm/"] +        path = ~/priv_scm/.gitconfig +[includeIf "gitdir:~/work_scm/"] +        path = ~/work_scm/.gitconfig +``` + +### 什么是 includeIf? + +`includeIf.condition.path` 变量,是 `include` 配置指令的一部分,允许你有条件地设置自定义配置。同时,自定义配置的路径也可以作为指令的一部分来设置。 + +这个指令支持三个关键字:`gitdir`、`gitdir/I` 和 `onbranch`。我将简单解释一下 `gitdir`,我在上面的代码片段中使用了它。你可以在[文档][3]中了解其他两个关键词。 + +在 `includeIf` 指令中使用 `gitdir` 关键字会对模式进行条件检查。根据规则,如果当前工作目录与 `gitdir` 中指定的目录模式相匹配,那么它就会从给定的路径中选取配置。我将在配置片段上应用这个规则来展示它是如何被应用的。 + +在配置片段中,你可以看到一个简单的模式,`~/`,它与 `gitdir` 关键字一起使用。这个模式会被存储在 `$HOME` 环境变量中的值所替代。 + +### 如何使用它 + +如果你使用同一个系统在 GitHub 或 GitLab 上的开源项目上工作,并在工作中提交到 Git 仓库,你可以有两个顶级目录,比如 `$HOME/priv_scm` 和 `$HOME/work_scm`。在这两个目录中,你可以有两个单独的 `.gitconfig` 文件,其中包含与你的 `user.name` 和 `user.email` 相关的设置。然而,它们也可以包含存储在 `$HOME` 的全局 `.gitconfig` 中,它可以保存两个环境通用的所有自定义项。 + +这里是一个例子 `$HOME/priv_scm/.gitconfig` 的片段: + +``` +$ cat $HOME/priv_scm/.gitconfig +[user] +    name  = Ramanathan Muthiah +    email = <personal-mailid-goes-here> +``` + +有了这个配置,你就可以切换目录,并开始在开源项目上工作,而无需手动重置一些与 Git 相关的配置。这些更改会在主 `.gitconfig` 中借助 `includeIf` 条件指令自动处理。 + +### Git 小贴士 + +希望这个小贴士能帮助你组织 Git 项目。你最喜欢的 Git 小贴士是什么?请在评论中分享吧! + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/10/git-config + +作者:[Ramanathan M][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/muthiahramanathan +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/email_chat_communication_message.png?itok=LKjiLnQu (Chat via email) +[2]: https://git-scm.com/docs/git-config +[3]: https://git-scm.com/docs/git-config#_conditional_includes diff --git a/published/202011/20201106 Reclaim hard-drive space with LVM.md b/published/202011/20201106 Reclaim hard-drive space with LVM.md new file mode 100644 index 0000000000..e40862864f --- /dev/null +++ b/published/202011/20201106 Reclaim hard-drive space with LVM.md @@ -0,0 +1,90 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12864-1.html) +[#]: subject: (Reclaim hard-drive space with LVM) +[#]: via: (https://fedoramagazine.org/reclaim-hard-drive-space-with-lvm/) +[#]: author: (Troy Curtis Jr https://fedoramagazine.org/author/troycurtisjr/) + +使用 LVM 扩展卷空间 +====== + +![](https://img.linux.net.cn/data/attachment/album/202011/27/193719d3df4p4z748f33f3.jpg) + +LVM 是一个逻辑卷管理工具,包括分配磁盘、条带化、镜像和调整逻辑卷的大小。它在 Fedora 安装中被普遍使用(在 BTRFS 作为默认文件系统之前是 LVM + Ext4)。但是你是否曾经遇到过启动系统时,GNOME 提示 home 卷几乎没有空间了!幸运的是,很有可能有一些空间在另一个卷中,而未被使用,可以用于重新分配。下面就来看看如何用 LVM 回收硬盘空间。 + +在卷之间轻松重新分配空间的关键是[逻辑卷管理器(LVM)][2]。Fedora 32 及以前的系统默认使用 LVM 来划分磁盘空间。这种技术类似于标准的硬盘分区,但 LVM 更加灵活。LVM 不仅可以实现灵活的卷大小管理,还可以实现一些高级功能,比如读写快照、在多个硬盘上进行数据条带化或镜像、将高速硬盘作为慢速硬盘的缓存等等。所有这些高级选项可能会让人有点不知所措,但调整卷的大小很简单的。 + +### LVM 基础 + +**卷组**(VG)作为 LVM 系统中的主要容器。默认情况下,Fedora 只定义了一个卷组,但你可以根据需要定义多个卷组。实际的硬盘和硬盘分区被添加到卷组中作为**物理卷**(PV)。物理卷会将可用的空间添加到卷组中。一个典型的 Fedora 安装有一个格式化的启动分区,其余的硬盘是一个配置为 LVM 物理卷的分区。 + +从这个可用空间池中,卷组分配了一个或多个**逻辑卷**(LV)。这些卷类似于硬盘分区,但没有磁盘上连续空间的限制。LVM 的逻辑卷甚至可以跨越多个设备!就像硬盘分区一样,逻辑卷有一个定义的大小,可以包含任何文件系统,然后可以挂载到特定的目录。 + +### 需要什么 + +在 gnome-disks 应用中确认系统使用 LVM ,并确保其他卷中有可用的空间。如果没有可以从另一个卷中回收的空间,这个指南就没有用。还需要一个 [Fedora 临场 CD/USB][3]。任何需要收缩的文件系统都必须卸载。从临场Live镜像运行,可以让硬盘上的所有卷保持未挂载状态,甚至包括像 `/` 和 `/home` 这样的重要目录。 + +![Use gnome-disks to verify free space][4] + +### 一句话警告 + +按照这个指南,应该不会丢失任何数据,但它确实会使用一些非常底层和强大的命令。一个错误可能会破坏硬盘上的所有数据。所以要先备份磁盘上的所有数据! + +### 调整 LVM 卷的大小 + +开始时,启动 Fedora 临场镜像并在对话框中选择 “Try Fedora”。接下来,使用 “Run Command” 启动 “blivet-gui” 应用(按 `Alt-F2`,输入 `blivet-gui`,然后按回车)。选择左侧 “LVM” 下的卷组。逻辑卷在右边。 + +![Explore logical volumes in blivet-gui][5] + +逻辑卷标签由卷组名称和逻辑卷名称组成。在本例中,卷组是 `fedora_localhost-live`,分配了 `home`、`root` 和 `swap` 逻辑卷。要找到完整的卷,选择每一个卷,点击“齿轮”图标,然后选择 “resize”。调整大小对话框中的滑块表示卷的允许大小。左边的最小值是文件系统中已经使用的空间,所以这是最小可能的尺寸大小(不删除数据)。右边的最大值是基于卷组中的最大可用空间。 + +![Resize dialog in blivet-gui][6] + +灰色的 “resize” 选项意味着该卷已经满了,而且卷组中没有可用空间。 + +现在可以更改大小了!查看所有的卷,就像上面的截图那样,找到一个有足够空间的卷。并像上面的截图那样,在所有的卷中找到一个有大量额外空间的卷。向左移动滑块来设置新的大小。腾出足够的空间对整个卷有用,但仍然要为未来的数据增长留出足够的空间。否则,这个卷将是下一个被填满的卷。 + +点击 “resize”,注意卷列表中出现了一个新项目:“free space”。现在选择这次要调整的卷,并将滑块一直向右移动。按 “resize” 键,并查看新改进的卷的布局。然而,硬盘驱动器上的任何东西现在都还没有改变。点击“勾选”选项将更改提交到磁盘。 + +![Review changes in blivet-gui][7] + +查看更改的摘要,如果一切看起来都是正确的,点击 “Ok” 继续。等待 “blivet-gui” 完成。现在重新启动回到 Fedora,可以使用之前被充满的卷上的新空间了。 + +### 为未来计划 + +要知道任何特定卷在未来需要多少空间是很困难的。与其立即分配所有可用的空闲空间,不如考虑在卷组中留出空闲空间。事实上,Fedora Server 默认在卷组中保留空间。当一个卷处于在线和使用中时,扩展卷是可能的。不需要临场镜像或重启。当一个卷几乎满的时候,可以使用部分可用空间轻松扩展卷并继续工作。遗憾的是,默认的磁盘管理器 gnome-disks 不支持 LVM 卷的大小调整,所以安装 [blivet-gui][8] 作为图形化管理工具。另外,还有一个简单的终端命令来扩展卷: + +``` +lvresize -r -L +1G /dev/fedora_localhost-live/root +``` + +### 总结 + +用 LVM 回收硬盘空间只是 LVM 功能的表面。大多数人,特别是在桌面中,可能不需要更高级的功能。然而,当需要的时候,LVM 就在那里,尽管它的实现可能会变得有点复杂。从 [Fedora 33][10] 开始,[BTRFS][9] 是默认的文件系统,没有 LVM。BTRFS 可以更容易管理,同时对于大多数常见的使用来说也足够灵活。查看最近 [Fedora Magazine 关于 BTRFS 的文章][11]了解更多。 + +-------------------------------------------------------------------------------- + +via: https://fedoramagazine.org/reclaim-hard-drive-space-with-lvm/ + +作者:[Troy Curtis Jr][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://fedoramagazine.org/author/troycurtisjr/ +[b]: https://github.com/lujun9972 +[1]: https://fedoramagazine.org/wp-content/uploads/2020/11/lvm-resize-816x345.jpg +[2]: http://sourceware.org/lvm2/ +[3]: https://getfedora.org/en/workstation/download/ +[4]: https://fedoramagazine.org/wp-content/uploads/2020/11/gnome-disks.png +[5]: https://fedoramagazine.org/wp-content/uploads/2020/11/blivet-overview.png +[6]: https://fedoramagazine.org/wp-content/uploads/2020/11/blivet-resize-1024x525.png +[7]: https://fedoramagazine.org/wp-content/uploads/2020/11/blivet-summary-1024x525.png +[8]: https://fedoraproject.org/wiki/Blivet-gui +[9]: https://fedoramagazine.org/btrfs-coming-to-fedora-33/ +[10]: https://fedoramagazine.org/whats-new-fedora-33-workstation/ +[11]: https://fedoramagazine.org/btrfs-snapshots-backup-incremental/ diff --git a/published/202011/20201110 What I love about the newest GNOME desktop.md b/published/202011/20201110 What I love about the newest GNOME desktop.md new file mode 100644 index 0000000000..0246663267 --- /dev/null +++ b/published/202011/20201110 What I love about the newest GNOME desktop.md @@ -0,0 +1,78 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12839-1.html) +[#]: subject: (What I love about the newest GNOME desktop) +[#]: via: (https://opensource.com/article/20/11/new-gnome) +[#]: author: (Jim Hall https://opensource.com/users/jim-hall) + +我喜欢最新的 GNOME 桌面 +====== + +> 看看 GNOME 3.38 桌面最重要的新功能。 + +![](https://img.linux.net.cn/data/attachment/album/202011/18/225213tmv6aeev1x0t1p4k.jpg) + +Fedora 33 [刚出来][2],我就马上安装了它。在这个新版 Linux 发行版的众多功能中,其中之一是最新的 GNOME 桌面。GNOME 3.38 于 2020 年 9 月发布,我很喜欢它。 + +### 我为什么喜欢 GNOME 3.38? + +GNOME 3.38 [发布说明][3]中列出了这次更新中的一些重大的新功能。其中,新用户的欢迎页面有了重大改版,现在更加容易使用,如果你是新用户的话,它提供了更多有用的信息。 + +![The new "Welcome GNOME"][4] + +我还喜欢在 GNOME 应用概览中拖动来重新排列应用图标的功能。这让我在 GNOME 下组织我一直使用的应用变得轻而易举。你甚至可以将图标拖放到一起,并自动将它们放入一个文件夹。 + +![GNOME 3.38 Application Overview][7] + +我的家人在不同的时区,更新后的 GNOME 时钟使得添加新的世界时钟变得更加容易,所以当我给家人打电话时,我不必弄清楚现在是什么时间,他们是早一个小时还是晚一个小时?我只需查看 GNOME 时钟,就能一目了然地看到每个人的当地时间。另外,虽然我并不经常使用闹钟功能,但我喜欢我可以自己设置铃声持续时间和每个闹钟的默认“打盹”时间。 + +![Adding a new world clock in GNOME Clocks][8] + +除了所有这些功能更新之外,GNOME 3.38 中最大的改进是性能。正如 GNOME 开发者 Emmanuele Bassi [今年早些时候的解释][9]:“GNOME 中的每个人都为使速度更快而做了很多工作,即使是在树莓派等这样受限的系统上运行的人也是如此。为了让 GNOME 表现得更好,大家做了很多工作。因为人们真的很关心它”。而这一点在新版本中体现得淋漓尽致!GNOME 桌面感觉反应更灵敏。 + +![Applications running on GNOME 3.38][10] + +作为我的咨询和培训业务的一部分,我经常在几个打开的应用之间切换,包括 LibreOffice、GIMP、Inkscape、Web 浏览器等。在 GNOME 3.38 中,启动一个新的应用或在打开的应用之间切换感觉更快。 + +### 除了一件事 + +如果说新版 GNOME 中有什么我不喜欢的地方,那就是重新设计的屏幕截图工具。我一直使用这个工具来抓取屏幕上的一部分内容,并将其插入到我的演示文稿和培训文档中。 + +![GNOME Screenshot tool][11] + +当我浏览用户界面或电脑屏幕时,我自然会像阅读书籍或杂志那样浏览:从左到右,从上到下。当我使用新的屏幕截图工具进行屏幕截图时,我从左上角开始,然后进行选择。大多数时候,我只需要改变选区的捕捉区域,所以我点击那个按钮,然后寻找截图的按钮。但我总是要花点时间才能找到左上角的**截图**按钮。它并不在窗口的底部,也不是我希望找到它的地方。 + +![GNOME Screenshot tool][12] + +到目前为止,这似乎是我在 GNOME 3.38 中唯一的烦恼。总的来说,我对新的 GNOME 感到非常兴奋。我希望你也是! + +要了解更多关于 GNOME 3.38 的信息,请访问 [GNOME 网站][13]或阅读 [GNOME 3.38 公告][5]。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/11/new-gnome + +作者:[Jim Hall][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/jim-hall +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/computer_browser_web_desktop.png?itok=Bw8ykZMA (Digital images of a computer desktop) +[2]: https://fedoramagazine.org/announcing-fedora-33/ +[3]: https://help.gnome.org/misc/release-notes/3.38/ +[4]: https://opensource.com/sites/default/files/uploads/welcome-tour.png (The new "Welcome GNOME" ) +[5]: https://www.gnome.org/news/2020/09/gnome-3-38-released/ +[6]: https://creativecommons.org/licenses/by-sa/4.0/ +[7]: https://opensource.com/sites/default/files/uploads/app-overview.png (GNOME 3.38 Application Overview) +[8]: https://opensource.com/sites/default/files/uploads/world-clocks.png (Adding a new world clock in GNOME Clocks) +[9]: https://opensource.com/article/20/7/new-gnome-features +[10]: https://opensource.com/sites/default/files/uploads/desktop-busy.png (Applications running on GNOME 3.38) +[11]: https://opensource.com/sites/default/files/uploads/gnome-screenshot-tool.png (GNOME Screenshot tool) +[12]: https://opensource.com/sites/default/files/uploads/screenshot-tool-path.png (GNOME Screenshot tool) +[13]: https://www.gnome.org/ diff --git a/published/202011/20201111 Using Fedora 33 with Microsoft-s WSL2.md b/published/202011/20201111 Using Fedora 33 with Microsoft-s WSL2.md new file mode 100644 index 0000000000..fb2f0d24bd --- /dev/null +++ b/published/202011/20201111 Using Fedora 33 with Microsoft-s WSL2.md @@ -0,0 +1,112 @@ +[#]: collector: (lujun9972) +[#]: translator: (wxy) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12845-1.html) +[#]: subject: (Using Fedora 33 with Microsoft’s WSL2) +[#]: via: (https://fedoramagazine.org/wsl-fedora-33/) +[#]: author: (Jim Perrin https://fedoramagazine.org/author/jperrin/) + +通过微软的 WSL2 使用 Fedora 33 +====== + +![][1] + +如果你像我一样,你可能会发现自己因为各种原因而运行 Windows,无论是因为工作还是游戏。当然,你可以在虚拟机或容器中运行 Fedora,但这些并不像 Windows 的 Linux 子系统(WSL)那样容易融合到普通的 Windows 体验中。通过 WSL 使用 Fedora 可以让你将这两种环境融合在一起,创造一个奇妙的开发环境。 + +### 先决条件 + +为了达成这一目标,你需要一些基本条件。你应该运行 Windows 10,并且已经安装了 WSL2。如果没有,请查看[微软文档说明][4],完成后再回来这里。微软建议为了简单起见,将 WSL2 设置为发行版的默认设置。本指南假设你已经这样做了。 + +接下来,你将需要一些解压 xz 压缩文件的方法。你可以用另一个基于 WSL 的发行版来解压,或者使用 [7zip][5]。 + +### 下载 Fedora 33 rootfs + +由于 Fedora 并没有提供实际的 rootfs 存档,所以我们将借用一个用于生成 Dockerhub 容器镜像的存档。你需要从 fedora-cloud 的 GitHub 仓库下载该 [tar.xz 文件][6] 。一旦你有了这个 tar.xz 文件,解压它,但不要展开 tar 包。你会得到一个类似 `fedora-33-时间标签.tar` 的文件。有了这个文件,你就可以构建镜像了。 + +### 组合 WSL Fedora 的构建版本 + +我喜欢使用 `c:\distros` 目录,但你可以选择几乎任何你想要的位置。无论你选择什么目录,在你导入该构建版本之前,确保其顶层路径存在。现在打开一个 CMD 或 Powershell 提示符,因为是时候导入了: + +``` +wsl.exe --import Fedora-33 c:\distros\Fedora-33 $HOME\Downloads\fedora-33.tar +``` + +你会看到 Fedora-33 显示在 WSL 的列表当中: + +``` +PS C:\Users\jperrin> wsl.exe -l -v + NAME STATE VERSION + Fedora-33 Stopped 2 +``` + +下面,你就可以开始在 WSL 中摆弄 Fedora 了,但我们还需要做一些事情来使它真正成为一个有用的 WSL 发行版。 + +``` +wsl -d Fedora-33 +``` + +这将以 root 用户的身份启动 Fedora 的 WSL 实例。下面,你将安装一些核心包并设置一个新的默认用户。你还需要配置 `sudo`,否则你将无法在以后需要安装其他东西时轻松提升权限。 + +``` +dnf update +dnf install wget curl sudo ncurses dnf-plugins-core dnf-utils passwd findutils +``` + +`wslutilites` 使用 `curl` 和 `wget` 来实现与 VS Code 的集成,所以它们很有用。由于你需要使用 COPR 仓库,你需要增加 `dnf` 功能。 + +### 添加你的用户 + +现在是时候添加你的用户,并将其设置为默认用户。 + +``` +useradd -G wheel 用户名 +passwd 用户名 +``` + +现在,你已经创建了你的用户名,并添加了密码,确保它们可以工作。退出 WSL 实例,并再次启动它,这次指定用户名。你还要测试 `sudo`,并检查你的 uid。 + +``` +wsl -d Fedora-33 -u 用户名 +$id -u +1000 +$ sudo cat /etc/shadow +``` + +假设一切正常,你现在已经准备好在 Windows 中为你的 Fedora 环境设置默认用户。要做到这一点,请退出 WSL 实例并回到 Powershell 中。这个 Powershell 单行代码可以正确配置你的用户: + +``` +Get-ItemProperty Registry::HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Lxss\\*\ DistributionName | Where-Object -Property DistributionName -eq Fedora-33  | Set-ItemProperty -Name DefaultUid -Value 1000 +``` + +现在你应该可以再次启动 WSL,而不需要指定就可以成为自己的用户而不是 root。 + +### 自定义! + +至此,你已经有了可以在 WSL 中运行的基本 Fedora 33 环境,但它还没有 Windows 集成的部分。如果你想要这个,有一个 COPR 仓库可以启用。如果你选择添加这部分,你就可以直接在 shell 里面运行 Windows 应用,也可以轻松地将你的 Linux 环境与 VS Code 集成。需要注意的是,COPR 并没有得到 Fedora 基础架构的官方支持。使用该软件包,风险自担。 + +``` +dnf copr enable trustywolf/wslu +``` + +现在你可以去配置终端、设置一个 Python 开发环境,或者其它你想使用 Fedora 33 的方式。享受吧! + +-------------------------------------------------------------------------------- + +via: https://fedoramagazine.org/wsl-fedora-33/ + +作者:[Jim Perrin][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://fedoramagazine.org/author/jperrin/ +[b]: https://github.com/lujun9972 +[1]: https://fedoramagazine.org/wp-content/uploads/2020/11/wsl-fedora33-816x345.jpg +[2]: https://unsplash.com/@matthias_heil?utm_source=unsplash&utm_medium=referral&utm_content=creditCopyText +[3]: https://unsplash.com/s/photos/windows?utm_source=unsplash&utm_medium=referral&utm_content=creditCopyText +[4]: https://docs.microsoft.com/en-us/windows/wsl/install-win10 +[5]: https://www.7-zip.org/download.html +[6]: https://github.com/fedora-cloud/docker-brew-fedora/tree/33/x86_64 diff --git a/published/202011/20201112 How to Install Google Chrome on Fedora -Beginner-s Tutorial.md b/published/202011/20201112 How to Install Google Chrome on Fedora -Beginner-s Tutorial.md new file mode 100644 index 0000000000..e78e3a2c92 --- /dev/null +++ b/published/202011/20201112 How to Install Google Chrome on Fedora -Beginner-s Tutorial.md @@ -0,0 +1,124 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12856-1.html) +[#]: subject: (How to Install Google Chrome on Fedora [Beginner’s Tutorial]) +[#]: via: (https://itsfoss.com/install-google-chrome-fedora/) +[#]: author: (Dimitrios Savvopoulos https://itsfoss.com/author/dimitrios/) + +如何在 Fedora 上安装 Google Chrome 浏览器 +====== + +![](https://img.linux.net.cn/data/attachment/album/202011/25/094346ig44av4l4lzh1v7t.jpg) + +Fedora 的默认网页浏览器是 Firefox。尽管它是一个优秀的网络浏览器,你可能更喜欢流行的 Google Chrome 浏览器。 + +如果你想知道如何在 Fedora 上安装 Google Chrome 浏览器,让我告诉你两种安装 Google Chrome 浏览器的方式:图形化方式和命令行方式。 + +* [图形化方式 1:通过启用 Fedora 第三方仓库从软件中心安装 Chrome 浏览器][1] +* [图形化方式 2:从谷歌浏览器网站下载 RPM 文件][2] +* [命令行方式:从 Fedora 第三方仓库安装 Chrome,一切使用命令(与 GUI 方式 1 相同)][3] + +这全取决于你喜欢哪种方式。你在 [Fedora][4] 上的 Google Chrome 浏览器都将通过这三种方式的系统更新获取定期更新。 + +### 方式 1:在 Fedora 中从软件中心安装 Google Chrome + +Fedora 提供了一个第三方仓库,其中包含了一些流行的专有软件、图形驱动程序。Google Chrome 就是其中之一。 + +第一步,确保在 Fedora 中启用第三方仓库。你应该在软件中心中看到这个选项。 + +![Step1: Fedora Third Party Repositories][5] + +启用后,只需在软件中心搜索 Chrome: + +![Step 2: Search for Chrome In Fedora Software Center][6] + +并从那里安装它: + +![Step 3: Install Chrome Fedora][7] + +还有比这更简单的吗?我觉得没有。 + +### 方式 2:在 Fedora 上从 Chrome 网站安装 Google Chrome + +如果你不想启用第三方仓库,也没关系。你不必这样做。你可以从 Chrome 的网站上下载 RPM 文件,双击并安装它。 + +访问 Google Chrome 的网站,点击下载按钮。 + +- [获取 Google Chrome][8] + +![][9] + +然后选择 .rpm 包,点击“接受并安装”。 + +![][10] + +下载结束后,双击文件,在包管理器提示时点击安装。输入密码,等待安装完成。 + +![][11] + +这是超级简单的,对吧?让我们来看看有点复杂的方式(如果你不是一个终端爱好者)。 + +### 方式 3:使用命令行在 Fedora 上安装 Chrome + +首先,你需要添加额外的 Fedora 仓库(你在方式 1 中看到的): + +``` +sudo dnf install fedora-workstation-repositories +``` + +然后启用 Google Chrome 仓库。 + +``` +sudo dnf config-manager --set-enabled google-chrome +``` + +![][12] + +要安装 Google Chrome 稳定版,请在终端运行以下命令。 + +``` +sudo dnf install google-chrome-stable +``` + +你会看到一个导入 GPG 密钥的警告,输入 `y` 继续。 + +![][13] + +你正在添加 Google Chrome 仓库。这个软件包来自这个仓库,它直接来自 Google。 + +### 总结 + +即使你使用命令行,在 Fedora 上安装 Google chrome 也相当简单。除了第三方仓库的部分,这和[在 Ubuntu 上安装 Chrome][14] 差不多。 + +现在你已经安装好了,你可能会想[查看我们的 Google Chrome 键盘快捷键列表][15]来更快地使用浏览器。 + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/install-google-chrome-fedora/ + +作者:[Dimitrios Savvopoulos][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://itsfoss.com/author/dimitrios/ +[b]: https://github.com/lujun9972 +[1]: tmp.VFVwBw56ac#gui-method-1 +[2]: tmp.VFVwBw56ac#gui-method-2 +[3]: tmp.VFVwBw56ac#cli-method +[4]: https://getfedora.org/ +[5]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/11/fedora-third-party-repositories.jpg?resize=800%2C400&ssl=1 +[6]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/11/chrome-in-fedora.png?resize=800%2C400&ssl=1 +[7]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/11/installing-chrome-fedora.png?resize=800%2C400&ssl=1 +[8]: https://www.google.com/chrome/ +[9]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/01/install-google-chrome-ubuntu-1.jpeg?resize=800%2C374&ssl=1 +[10]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/11/3.-download-rpm-chrome.png?resize=800%2C600&ssl=1 +[11]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/11/4.-install-chrome-fedora.png?resize=800%2C550&ssl=1 +[12]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/11/1.-Fedora-extra-repos.png?resize=800%2C550&ssl=1 +[13]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/11/2.-Fedora-GPG-key.png?resize=800%2C550&ssl=1 +[14]: https://itsfoss.com/install-chrome-ubuntu/ +[15]: https://itsfoss.com/google-chrome-shortcuts/ \ No newline at end of file diff --git a/published/202011/20201112 How to Install and Use Etcher on Linux for Making Live Linux USB.md b/published/202011/20201112 How to Install and Use Etcher on Linux for Making Live Linux USB.md new file mode 100644 index 0000000000..74ab8519d5 --- /dev/null +++ b/published/202011/20201112 How to Install and Use Etcher on Linux for Making Live Linux USB.md @@ -0,0 +1,136 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12847-1.html) +[#]: subject: (How to Install and Use Etcher on Linux for Making Live Linux USB) +[#]: via: (https://itsfoss.com/install-etcher-linux/) +[#]: author: (Ankush Das https://itsfoss.com/author/ankush/) + +如何在 Linux 上安装和使用 Etcher 来制作 Linux 临场 USB +====== + +![](https://img.linux.net.cn/data/attachment/album/202011/21/214209xor9upp7jznd9djd.jpg) + +> Etcher 是一款流行的 USB 烧录应用,可用于创建可启动的 Linux USB。让我来告诉你如何安装它,以及如何使用它来制作一个 Linux 临场盘。 + +### Etcher:一个用于在 SD 卡和 USB 驱动器中烧录 Linux ISO 的开源工具 + +Etcher 是一个由 [Balena][1] 开发的开源项目,来用于为树莓派烧录 SD 卡。事实上,我们在[如何在 SD 卡上安装 Raspbian OS][2] 的教程中就使用了它。 + +它不仅仅局限于 SD 卡,你还可以使用 Etcher 来[制作一个可启动的 USB 驱动器][3],我们就通过它的帮助在 Linux 中制作了一个 [Manjaro 的临场 USB][4]。 + +自首次发布以来,Etcher 就以其整洁的界面和简单的使用方式引起了人们的注意。 + +![][5] + +在本文中,我将重点介绍帮助你在 Linux 上安装 Etcher 的步骤。然后,我还将展示如何使用它。在这之前,让我先给大家介绍一下它的功能。 + +### Etcher 的功能 + + * 在烧录前验证驱动器 + * 漂亮的用户界面 + * 自动检测 USB 驱动器/SD 卡,防止电脑上的硬盘被擦除。 + * 跨平台支持(Windows、macOS 和 Linux)。 + * 快速烧录 + * 简单的三步过程 + +理论上,你已经有了在 SD 卡和 USB 驱动器上烧录操作系统镜像所需的一切。同样令人激动的是,根据他们的[路线图][6],他们计划增加对多个设备的同步写入支持。 + +### 在 Linux 上安装 Etcher + +要开始使用,你需要从它的官方网站上下载它提供的 AppImage 文件(适用于任何 Linux 发行版)。 + +你只需要前往它的[主页][7],并根据你的系统(32 位/64 位)下载一个程序: + +![][8] + +在我的例子中,我下载了 Ubuntu 的 64 位 AppImage 文件。你可以通过我们的指南来了解[在 Linux 上使用 AppImage文件][9],但我会让你先知道下一步需要做什么。 + +你需要给文件执行权限,你可以右击**AppImage 文件 -> 属性**来实现。 + +![][10] + +接下来,点击权限选项卡下的“**允许作为程序执行**”,如下图所示。 + +![][11] + +现在,只需双击 AppImage 文件即可启动 Etcher! + +这应该可以在任何 Linux 发行版上运行。在任何情况下,如果你想从源码构建或者直接使用 .rpm 或 .deb 文件安装,你也可以前往它的 [Github 发布页][12]找到 RPM、DEB 和源码。 + +你也可以参考我们的[在 Ubuntu 中使用 deb 文件][13]来安装应用。 + +> 注意! +> +> 我们注意到,当你使用 Etcher 创建 Linux 发行版的临场 USB 时,它会使 USB 处于明显的不可使用状态,即它只有几 MB 的空闲空间,并且不能直接格式化。在 Linux 上,你可以[使用磁盘工具手动删除分区,然后格式化它][14]。 + +### 在 Linux 上使用 Etcher + +只需三步就可以开始使用 Etcher。在你启动它之后,根据屏幕上的提示应该是清晰的,但为了给你一个好的开始,以下是你要做的事情: + +**步骤 1:** 选择合适的 ISO 镜像文件或你需要烧录的文件的 URL(如下图所示)。 + +![][15] + +**步骤 2:** 接下来,你需要选择目标设备。它会自动检测并高亮显示可移动设备,以防止你选择任何内部存储位置。 + +![][16] + +在这里,我连接了一个 USB 驱动器,我也选择了它(如下图所示)。 + +![][17] + +**步骤 3:** 现在,你所有需要做的就是烧录镜像并等待它成功完成。 + +![][18] + +这是进度的样子: + +![][19] + +完成了! + +![][20] + +- [下载 balenaEtcher][7] + +### 总结 + +Etcher 是一个有用的工具,可以为 SD 卡和 USB 驱动器烧录操作系统镜像。我倾向于主要使用它来创建临场 USB 驱动器来测试 Linux 发行版,我对它很满意。 + +你更喜欢用什么来创建可启动驱动器?你是否已经尝试过 Etcher?请在下面的评论中告诉我你的想法。 + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/install-etcher-linux/ + +作者:[Ankush Das][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://itsfoss.com/author/ankush/ +[b]: https://github.com/lujun9972 +[1]: https://www.balena.io/ +[2]: https://itsfoss.com/tutorial-how-to-install-raspberry-pi-os-raspbian-wheezy/ +[3]: https://itsfoss.com/create-bootable-ubuntu-usb-drive-mac-os/ +[4]: https://itsfoss.com/create-live-usb-manjaro-linux/ +[5]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/10/etcher-mxlinux-2.png?resize=800%2C518&ssl=1 +[6]: https://github.com/balena-io/etcher/milestones +[7]: https://www.balena.io/etcher +[8]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/11/etcher-official-site-download.png?resize=800%2C580&ssl=1 +[9]: https://itsfoss.com/use-appimage-linux/ +[10]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/11/balena-etcher-permission.jpg?resize=800%2C378&ssl=1 +[11]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/11/balena-etcher-execute.jpg?resize=800%2C445&ssl=1 +[12]: https://github.com/balena-io/etcher/releases/tag/v1.5.109 +[13]: https://itsfoss.com/install-deb-files-ubuntu/ +[14]: https://itsfoss.com/cant-format-usb-disk/ +[15]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/11/balena-etcher-select.jpg?resize=800%2C521&ssl=1 +[16]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/11/etcher-select-target.jpg?resize=800%2C509&ssl=1 +[17]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/11/etcher-target-device.jpg?resize=800%2C521&ssl=1 +[18]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/11/etcher-flash.jpg?resize=800%2C516&ssl=1 +[19]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/11/etcher-flashing.jpg?resize=800%2C510&ssl=1 +[20]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/11/etcher-flash-complete.jpg?resize=800%2C507&ssl=1 diff --git a/published/202011/20201114 How to Install Fedora in VirtualBox -With Steps for USB, Clipboard and Folder Sharing.md b/published/202011/20201114 How to Install Fedora in VirtualBox -With Steps for USB, Clipboard and Folder Sharing.md new file mode 100644 index 0000000000..23edba8404 --- /dev/null +++ b/published/202011/20201114 How to Install Fedora in VirtualBox -With Steps for USB, Clipboard and Folder Sharing.md @@ -0,0 +1,283 @@ +[#]: collector: (lujun9972) +[#]: translator: (frogOAO) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12854-1.html) +[#]: subject: (How to Install Fedora in VirtualBox [With Steps for USB, Clipboard and Folder Sharing]) +[#]: via: (https://itsfoss.com/install-fedora-in-virtualbox/) +[#]: author: (Dimitrios Savvopoulos https://itsfoss.com/author/dimitrios/) + +如何在 VirtualBox 中安装 Fedora +====== + +如果你对 Fedora Linux 感兴趣,这有几种方式可以尝试它。 + +最简单还不影响你操作系统的方式是 [制作 Fedora 的 USB 临场启动盘][1]。 + +> **LCTT 译注**: +> +> 在 Linux 发行版的使用方式上,有一种可以无需安装而通过光盘或 USB 存储棒直接在计算机上启动完整的 Linux 操作系统的方式,这种方式称之为 “Live” 方式,如 Live CD、Live USB。 +> +> 通常,Live 一词并不翻译,不过,我认为,除了英文缩写和部分历史原因造成直接使用的英文单词,大部分场景都应该使用本地化的语言来描述,否则,中英文混杂的港台式中文,实在有些不伦不类;抑或,外文翻译本身就不存在意义了。 +> +> 因此,对于 “Live” 一词如何翻译,我们也颇费心思。这个词,在维基百科中文中,被翻译为“[自生系统](https://zh.wikipedia.org/wiki/Live_CD)”,在某些场景下偶见 “现场”、“临场” 等翻译。考虑到 Live CD/USB 的特性,我认为翻译为 “临场” 比较好。 +> +> 于此抛出愚见,希望得到大家的积极反馈。wxy@LCTT + +另一种方式是安装 VirtualBox 利用虚拟化技术来尝试 Fedora。这样,你可以在你的操作系统上像使用应用程序一样使用 Fedora。 + +通过这种方式,你可以执行更彻底的测试,而不会搞乱当前的操作系统。 + +你甚至可以复制你的虚拟环境,并在其他系统上重新安装它。听起来方便吗?让我来教你怎么做。 + +### 在 VirtualBox 上安装 Fedora + +![][2] + +让我们分步在 Oracle VirtualBox 上安装 Fedora。 + +#### 步骤一:安装 VirtualBox + +如果你的系统还没有安装 VirtualBox,你可以从官方网站下载。你可以找到 Windows、MacOs 和 Linux 的说明。 [Ubuntu 用户可以参考这个关于安装 VirtualBox 的详细教程。][3] + +![][4] + +- [下载 VirtualBox][5] + +#### 步骤二: 下载 Fedora ISO + +如果你不熟悉 Fedora,那么这些镜像你需要知道。 + +[Fedora IoT][6] 是用于可扩展基础设施的,[Fedora workstation][7] 是一个带有一组面向普通 GNOME 桌面环境中的桌面工具的镜像。[Fedora server][8] 顾名思义,是为服务器或数据中心定制的。 + +如果 GNOME 不是你的首选,你可以下载一个带有替代桌面环境的[定制版][9] Fedora 桌面。对于本教程,我选择了带有 GNOME 桌面环境的[Fedora 33][10]。 + +- [下载 Fedora][11] + +#### 步骤三: 创建一个空虚拟机并对其进行配置 + +要成功安装和运行 Fedora,至少需要 20GB 磁盘空间和 2GB RAM。不过,为了获得更流畅的用户体验,建议增加一倍。在此基础上,我将创建并配置虚拟机。 + +开启 Virtual Box 点击 “New”。 + +![创建一个新的虚拟机][12] + +需要注意,最重要的选项是 **将类型设置为 Linux ,版本设置为 Fedora (64-bit)**。如果你在名称提示符处开始输入 “Fedora”,VirtualBox 将自动为你选择正确的设置。虽然名字不一定非得是 Fedora,它可以是任何你喜欢的。 + +*如果你只能访问 32 位版本,那么你需要在 BIOS 上启用虚拟化技术,如果你有一个 AMD CPU,它被称为 SVM。最坏的情况是你的 CPU 不支持虚拟化技术。如果你不确定,先检查这个。 + +如果你的设置和我类似,点击 “create” 按钮。 + +![命名你的虚拟机,并未它指定至少 3 GB RAM][13] + +如前所述,至少需要 20GB 的磁盘空间才能安装 Fedora。我的系统上有 32GB 的内存,所以我分配了 8GB 内存。3 GB 的内存应该也没问题。 + +顺便说下内存的使用,只有在运行虚拟机时,虚拟机才会使用内存。否则,它将可用于常规使用。 + +确保其余设置与示例匹配,并点击 “Create” 按钮。 + +![以 VDI 格式分配 15-20 GB 的磁盘空间][14] + +在你点击虚拟机的 Start 按钮之前,你需要加载如下所示的 ISO [光驱]。 + +![将 Fedora ISO 添加到光驱存储中][15] + +因为你的虚拟硬盘是空的,虚拟机将从这个 ISO 启动。可以把它看作是使用临场 USB 或磁盘安装 Linux。 + +![在设置中将 ISO 添加为光驱][16] + +然后,如果你有一个多核 CPU,建议为虚拟机分配 2 个或更多的核。你可以在 “System” 选项卡下找到 CPU 核心。配置系统时,单击 “OK” 并启动虚拟机。 + +![可选:分配 CPU 核数][17] + +配置好所有内容后,单击 “Start” 按钮开始安装。 + +#### 步骤四:在 VirtualBox 中安装 Fedora。 + +如果你正确地遵循了这个过程,那么当你启动虚拟机时,你将直接从 ISO 文件启动。当你看到类似下面的屏幕时,选择 “Start Fedora”,并按回车键。 + +![Fedora 运行在虚拟机的临场环境中][18] + +要启动安装对话框,单击 “Install To Hard Drive”。 + +![点击 “install to hard drive”][19] + +在你继续安装之前,有必要定义你的键盘布局、你的时区以及最终安装操作系统的位置。 + +![选择键盘布局、日期和时间,然后是安装目标位置][20] + +分区过程很简单。你像前面的 VDI 那样划分一些空闲空间。它应该被自动识别。 + +选择你的磁盘并将存储配置设置为 “Automatic”。单击 “Done” 进入上一个对话框。 + +![磁盘应该会自动识别][21] + +一旦你配置完了上面的,点击 “Begin Installation”。 + +![开始 Fedora 的安装][22] + +现在只需等待 5 - 6 分钟即可完成安装。安装完成后,点击 “Finish installation” 按钮。 + +最后一步,需要关闭系统的电源。如果你不熟悉 GNOME 桌面环境,你可以如下这样做。 + +![安装后关闭 Fedora 临场环境][23] + +你必须手动卸载在初始步骤中加载的 ISO 文件。 + +![从光驱中移走 Fedora ISO][24] + +下一次使用 Fedora 启动虚拟机时,系统将提示你为 Fedora Linux 创建用户帐户并设置密码。 + +### 使用 VirtualBox Guest Additions 的附加功能,如剪贴板共享,文件夹共享等 + +[Guest Additions][25] 设计为在访客guest操作系统安装后安装在虚拟机中。它们包含对客户操作系统进行优化的设备驱动程序和系统应用程序,以获得更好的性能和可用性。 + +Guest Additions ISO 文件被安装为虚拟 CD-ROM 以便安装。 + +这是一个简单的过程。只需单击设备选项卡,然后单击 “Insert Guest Additions CD image”。 + +![][26] + +当提示单击 “Download” 时,系统将弹出下载 Guest Additions 镜像界面。 + +![安装 VirtualBox Guest Additions][27] + +#### 共享剪贴板 + +有时候,你需要在虚拟机和宿主机host操作系统之间移动一些内容。共享剪贴板/拖放支持将允许你在一个平台上复制项目,并将它们粘贴到另一个平台上。 + +要启用此功能,请在 VirtualBox 主页上选择 “Settings”,并按照下面的说明操作。“Bidirectional” 的选项是最方便的。 + +![启用访客和宿主系统间的剪贴板共享][28] + +#### 共享文件夹 + +有两种类型的分享: + + * 永久共享,与虚拟机设置一起保存。 + * 暂时共享,当虚拟机关闭时就会消失。可以使用 VirtualBox 管理器中的复选框创建暂时共享。 + +在本教程中,我将创建一个永久共享文件夹。在 VM 设置中添加你想要共享的宿主机系统文件夹,并选择你想要在 VM 中出现的名称。 + +![][29] + +下次启动虚拟机时,该文件夹应该显示为网络驱动器。 + +![][30] + +#### 更好的视频支持 + +虽然 Oracle VirtualBox 提供了具有基本功能的虚拟显卡,但访客系统添加的自定义视频驱动程序为你提供了超高和非标准的视频模式,以及视频加速。 + +使用 Guest Additions,操作系统的分辨率将随着你调整计算机上的 VirtualBox 窗口而动态调整大小。 + +最后,Guest Additions 可以利用你的计算机的显卡。如果你是一名游戏玩家或在 WM 中使用高效软件,这就会产生巨大的改变。 + +#### USB 和网络设备共享 + +有了 VirtualBox,用户就可以使用一个功能齐全的操作系统,而不必在不同的硬件上进行设置。然而,在宿主机和访客机器之间共享 USB 和网络设备并不像想的那样简单。 + +要访问 USB 设备,你将需要安装 [VirtualBox 扩展包][31]。 + +![安装 VirtualBox 扩展包][32] + +**下面这些仅对 Linux**,因为我使用的是 Linux。 + +为了使 VirtualBox 能够访问 USB 子系统,运行 VirtualBox 的用户(在宿主机系统上)必须属于 `vboxuser` 组。为此,打开一个终端并发出以下命令: + +``` +sudo usermod -aG vboxusers 'your username' +``` + +运行该命令后,你应该注销并重新登录,或者重新启动主机。 + +在这一步,插入你的 U 盘,通过你的 VM 设置,你应该能够找到并添加介质,如例子中所示。 + +![][33] + +当你下次启动虚拟机,你的 USB 将是可访问的。 + +![][34] + +### 额外提示:保存并导出虚拟机,以便以后可以在任何系统上使用它 + +你可能想在另一台计算机上使用虚拟机,或者是时候构建一台新机器了,并且你需要保持虚拟机的原样。只需几个简单的步骤,就可以轻松地导出当前设置并将其导入到另一台机器。 + +在 VirtualBox 主面板上,单击 “file”、“Export Appliance”。如果你喜欢键盘快捷键,你可以简单地点击 `Ctrl+E`。 + +![][35] + +选择要导出的虚拟机,然后单击 “Next”。 + +![][36] + +“Format” 选项需要注意一下。有三种不同的选项:开放虚拟化格式Open Virtualization Format 0.9、1.0 和 2.0 ,可以是 ovf 或 ova 扩展名。 + +使用 ovf 扩展名,会分别写入几个文件,而 ova 扩展名则将所有文件合并到一个开放虚拟化格式归档文件中。 + +默认格式 OVF 1.0 应该没问题。 + +![][37] + +要完成该过程,单击 “Next”,然后在下一个对话框中单击 “Export”。 + +### 总结 + +通过使用虚拟机,你不仅可以测试操作系统,还可以部署与物理机器同等重要的功能完整的系统。如今,硬件已经变得如此强大和廉价,它的大部分功能都没有被利用。 + +通过虚拟化技术,你可以使用这些浪费的资源。对物理机器的需求减少了,因此能源消耗也减少了。你可以从硬件和降低运行成本两方面省钱。 + +在大规模服务环境中,服务器虚拟化更多的是一种基本需求,而不是一种高级概念。 + +我希望本教程对你在 VirtualBox 中安装 Fedora Linux 有帮助。如果你遇到任何问题,请在评论中告诉我。 + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/install-fedora-in-virtualbox/ + +作者:[Dimitrios Savvopoulos][a] +选题:[lujun9972][b] +译者:[frogOAO](https://github.com/frogOAO) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://itsfoss.com/author/dimitrios/ +[b]: https://github.com/lujun9972 +[1]: https://itsfoss.com/create-fedora-live-usb-ubuntu/ +[2]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/11/install-fedora-in-virtualbox.png?resize=800%2C450&ssl=1 +[3]: https://itsfoss.com/install-virtualbox-ubuntu/ +[4]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/05/download-virtulabox.jpg?resize=799%2C294&ssl=1 +[5]: https://www.virtualbox.org/ +[6]: https://getfedora.org/en/iot/ +[7]: https://getfedora.org/en/workstation/ +[8]: https://getfedora.org/en/server/ +[9]: https://spins.fedoraproject.org/ +[10]: https://itsfoss.com/fedora-33/ +[11]: https://getfedora.org/ +[12]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/10/0.-create-a-new-vm.png?resize=800%2C550&ssl=1 +[13]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/10/1-create-vm-fedora.png?resize=800%2C533&ssl=1 +[14]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/10/2-fedora-vm-disk.png?resize=800%2C533&ssl=1 +[15]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/11/fedora-vm-settings-iso.png?resize=800%2C640&ssl=1 +[16]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/11/3-fedora-vm-settings2.png?resize=800%2C600&ssl=1 +[17]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/10/4-fedora-vm-cpu.png?resize=800%2C533&ssl=1 +[18]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/11/6-fedora-vm-boot.png?resize=800%2C600&ssl=1 +[19]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/10/7-fedora-vm-install-1.png?resize=800%2C622&ssl=1 +[20]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/10/9-fedora-vm-partitioning-2.png?resize=800%2C706&ssl=1 +[21]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/11/10-fedora-vm-hdd.png?resize=732%2C645&ssl=1 +[22]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/11/12-fedora-vm-installation-1.png?resize=800%2C706&ssl=1 +[23]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/11/15-power-off-fedora-gnome.png?resize=800%2C706&ssl=1 +[24]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/11/remove-fedora-iso-from-optical-drive.png?resize=800%2C589&ssl=1 +[25]: https://www.virtualbox.org/manual/ch04.html +[26]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/11/16-Fedora-vm-guest-additions.png?resize=800%2C706&ssl=1 +[27]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/11/17-Fedora-vm-guest-additions.png?resize=800%2C686&ssl=1 +[28]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/11/19-fedora-vm-shared-clipboard-2.png?resize=800%2C650&ssl=1 +[29]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/11/20-fedora-vm-shared-folders-1.png?resize=800%2C650&ssl=1 +[30]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/11/22-fedora-vm-shared-folders2-1.png?resize=800%2C547&ssl=1 +[31]: https://download.virtualbox.org/virtualbox/6.1.16/Oracle_VM_VirtualBox_Extension_Pack-6.1.16.vbox-extpack +[32]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/11/21.-fedora-vm-extension-pack.png?resize=800%2C600&ssl=1 +[33]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/11/25.-fedora-vm-usb-1.png?resize=800%2C527&ssl=1 +[34]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/11/26.-fedora-vm-usb-1.png?resize=800%2C578&ssl=1 +[35]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/11/23.-fedora-vm-export.png?resize=800%2C600&ssl=1 +[36]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/11/24.-fedora-vm-export-1.png?resize=800%2C545&ssl=1 +[37]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/11/25.-fedora-vm-export-800x545.png?resize=800%2C545&ssl=1 diff --git a/published/202011/20201116 Podman with capabilities on Fedora.md b/published/202011/20201116 Podman with capabilities on Fedora.md new file mode 100644 index 0000000000..92123795f3 --- /dev/null +++ b/published/202011/20201116 Podman with capabilities on Fedora.md @@ -0,0 +1,115 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12859-1.html) +[#]: subject: (Podman with capabilities on Fedora) +[#]: via: (https://fedoramagazine.org/podman-with-capabilities-on-fedora/) +[#]: author: (shiwanibiradar https://fedoramagazine.org/author/shiwanibiradar/) + +在 Fedora 中结合权能使用 Podman +====== + +![][1] + +容器化是一项蓬勃发展的技术。在不久的将来,多达百分之七十五的全球组织可能会运行某种类型的容器化技术。由于广泛使用的技术更容易成为黑客攻击的目标,因此保护容器的安全就显得尤为重要。本文将演示如何使用 POSIX [权能][2]Capability 来保护 Podman 容器的安全。Podman 是 RHEL8 中默认的容器管理工具。 + +### 确定 Podman 容器的权限模式 + +容器以特权模式或无特权模式运行。在特权模式下,[容器的 uid 0 被映射到宿主机的 uid 0][3]。对于某些情况,无特权的容器[缺乏对宿主机资源的充分访问能力][4]。但不管其操作模式如何,包括强制访问控制Mandatory Access Control(MAC:如 apparmor、SELinux 等)、seccomp 过滤器、删除权能Capability、命名空间等在内的技术有助于确保容器的安全。 + +要从容器外部确定特权模式: + +``` +$ podman inspect --format="{{.HostConfig.Privileged}}" +``` + +如果上面的命令返回 `true`,那么容器在特权模式下运行。如果返回 `false`,那么容器在非特权模式下运行。 + +要从容器内部确定特权模式: + +``` +$ ip link add dummy0 type dummy +``` + +如果该命令允许你创建一个接口,那么你运行的是一个特权容器,否则你运行的是一个非特权容器。 + +### 权能 + +命名空间隔离了容器的进程,使其无法任意访问宿主机的资源,也无法访问在同一宿主机上运行的其他容器的资源。然而,在**特权**容器内的进程仍然可以做一些事情,如改变 IP 路由表、跟踪任意进程和加载内核模块。权能Capability允许人们对容器内的进程可以访问或更改的资源施加更细微的限制,即使容器在特权模式下运行也一样。权能还允许人们为无特权的容器分配它本来不会拥有的特权。 + +例如,如果要将 `NET_ADMIN` 功能添加到一个无特权的容器中,以便在容器内部创建一个网络接口,你可以用下面的参数运行 `podman`: + +``` +[root@vm1 ~]# podman run -it --cap-add=NET_ADMIN centos +[root@b27fea33ccf1 /]# ip link add dummy0 type dummy +[root@b27fea33ccf1 /]# ip link +``` + +上面的命令演示了在一个无特权的容器中创建一个 `dummy0` 接口。如果没有 `NET_ADMIN` 权能,非特权容器将无法创建接口。上面的命令演示了如何将一个权能授予一个无特权的容器。 + +目前,大约有 [39 种权能][5]可以被授予或拒绝。特权容器默认会被授予许多权能。建议从特权容器中删除不需要的权能,以使其更加安全。 + +要从容器中删除所有权能: + +``` +$ podman run -it -d --name mycontainer --cap-drop=all centos +``` + +列出一个容器的权能: + +``` +$ podman exec -it 48f11d9fa512 capsh --print +``` + +上述命令显示没有向容器授予任何权能。 + +请参考 `capabilities` 手册页以获取完整的权能列表: + +``` +$ man capabilities +``` + +可以使用 `capsh` 命令来列出目前拥有的权能: + +``` +$ capsh --print +``` + +作为另一个例子,下面的命令演示了如何从容器中删除 `NET_RAW` 权能。如果没有 `NET_RAW` 权能,就不能从容器中 `ping` 互联网上的服务器。 + +``` +$ podman run -it --name mycontainer1 --cap-drop=net_raw centos +>>> ping google.com (will output error, operation not permitted) +``` + +最后一个例子,如果你的容器只需要 `SETUID` 和 `SETGID` 权能,你可以删除所有权能,然后只重新添加这两个权能来实现这样的权限设置。 + +``` +$ podman run -d --cap-drop=all --cap-add=setuid --cap-add=setgid fedora sleep 5 > /dev/null; pscap | grep sleep +``` + +上面的 `pscap` 命令会显示容器被授予的权能。 + +我希望你喜欢这个关于如何使用权能来保护 Podman 容器的简短探索。 + +谢谢! + +-------------------------------------------------------------------------------- + +via: https://fedoramagazine.org/podman-with-capabilities-on-fedora/ + +作者:[shiwanibiradar][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://fedoramagazine.org/author/shiwanibiradar/ +[b]: https://github.com/lujun9972 +[1]: https://fedoramagazine.org/wp-content/uploads/2018/10/podman-816x345.jpg +[2]: https://www.linuxjournal.com/magazine/making-root-unprivileged +[3]: https://linuxcontainers.org/lxc/security/#privileged-containers +[4]: https://github.com/containers/podman/blob/master/rootless.md +[5]: https://man7.org/linux/man-pages/man7/capabilities.7.html diff --git a/published/202011/20201116 Unlock encrypted disks on Linux automatically.md b/published/202011/20201116 Unlock encrypted disks on Linux automatically.md new file mode 100644 index 0000000000..e7a44a312b --- /dev/null +++ b/published/202011/20201116 Unlock encrypted disks on Linux automatically.md @@ -0,0 +1,249 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12851-1.html) +[#]: subject: (Unlock encrypted disks on Linux automatically) +[#]: via: (https://opensource.com/article/20/11/nbde-linux) +[#]: author: (Curt Warfield https://opensource.com/users/rcurtiswarfield) + +自动解锁 Linux 上的加密磁盘 +====== + +> 通过使用网络绑定磁盘加密(NBDE),无需手动输入密码即可打开加密磁盘。 + +![](https://img.linux.net.cn/data/attachment/album/202011/23/104735lmx18sxxs18f4xcc.jpg) + +从安全的角度来看,对敏感数据进行加密以保护其免受窥探和黑客的攻击是很重要的。Linux 统一密钥设置Linux Unified Key Setup([LUKS][2])是一个很好的工具,也是 Linux 磁盘加密的通用标准。因为它将所有相关的设置信息存储在分区头部中,所以它使数据迁移变得简单。 + +要使用 LUKS 配置加密磁盘或分区,你需要使用 [cryptsetup][3] 工具。不幸的是,加密磁盘的一个缺点是,每次系统重启或磁盘重新挂载时,你都必须手动提供密码。 + +然而,网络绑定磁盘加密Network-Bound Disk Encryption(NBDE) 可以在没有任何用户干预的情况下自动安全地解锁加密磁盘。它可以在一些 Linux 发行版中使用,包括从 Red Hat Enterprise Linux 7.4、CentOS 7.4 和 Fedora 24 开始,以及之后的后续版本。 + +NBDE 采用以下技术实现: + +* [Clevis 框架][4]:一个可插拔的框架工具,可自动解密和解锁 LUKS 卷 +* [Tang 服务器][5]:用于将加密密钥绑定到网络状态的服务 + +Tang 向 Clevis 客户端提供加密密钥。据 Tang 的开发人员介绍,这为密钥托管服务提供了一个安全、无状态、匿名的替代方案。 + +由于 NBDE 使用客户端-服务器架构,你必须同时配置客户端和服务器。你可以在你的本地网络上使用一个虚拟机作为 Tang 服务器。 + +### 服务器安装 + +用 sudo 安装 Tang: + +``` +sudo yum install tang -y +``` + +启用 Tang 服务器: + +``` +sudo systemctl enable tangd.socket --now +``` + +Tang 服务器工作在 80 端口,需加入到 firewalld 防火墙。添加相应的 firewalld 规则: + + +``` +sudo firewall-cmd --add-port=tcp/80 --perm +sudo firewall-cmd --reload +``` + +现在安装好了服务器。 + +### 客户端安装 + +在本例中,假设你已经添加了一个名为 `/dev/vdc` 的新的 1GB 磁盘到你的系统中。 + +使用 `fdisk` 或 `parted` 创建主分区: + +``` +sudo fdisk /dev/vdc +``` + +完成以下步骤来安装客户端: + +``` +Welcome to fdisk (util-linux 2.23.2). + +Changes will remain in memory only, until you decide to write them. +Be careful before using the write command. + +Device does not contain a recognized partition table +Building a new DOS disklabel with disk identifier 0x4a6812d4. + +Command (m for help): +``` + +输入 `n` 来创建新的分区: + +``` +Partition type: + p primary (0 primary, 0 extended, 4 free) + e extended +Select (default p): +``` + +按下**回车**键选择主分区: + + +``` +Using default response p +Partition number (1-4, default 1): +``` + +按下回车键选择默认分区号: + +``` +First sector (2048-2097151, default 2048): +Using default value 2048 +Last sector, +sectors or +size{K,M,G} (2048-2097151, default 2097151): +``` + +按回车键选择最后一个扇区: + +``` +Using default value 2097151 +Partition 1 of type Linux and of size 1023 MiB is set + +Command (m for help): wq +``` + +输入 `wq` 保存更改并退出 `fdisk`: + +``` +The partition table has been altered! + +Calling ioctl() to re-read partition table. +Syncing disks. +``` + +运行 `partprobe` 通知系统分区表的变化: + +``` +sudo partprobe +``` + +使用 `sudo` 安装 cryptsetup 软件包: + +``` +sudo yum install cryptsetup -y +``` + +使用 `cryptsetup luksFormat` 命令对磁盘进行加密。当提示时,你需要输入大写的 `YES`,并输入密码来加密磁盘: + +``` +sudo cryptsetup luksFormat /dev/vdc1 +WARNING! +======== +This will overwrite data on /dev/vdc1 irrevocably. + +Are you sure? (Type uppercase yes): + +Enter passphrase for /dev/vdc1: +Verify passphrase: +``` + +使用 `cryptsetup luksOpen` 命令将加密的分区映射到一个逻辑设备上。例如,使用 `encryptedvdc1` 作为名称。你还需要再次输入密码: + +``` +sudo cryptsetup luksOpen /dev/vdc1 encryptedvdc1 +Enter passphrase for /dev/vdc1: +``` + +加密分区现在在 `/dev/mapper/encryptedvdc1` 中可用。 + +在加密的分区上创建一个 XFS 文件系统: + +``` +sudo mkfs.xfs /dev/mapper/encryptedvdc1 +``` + +创建一个挂载加密分区的目录: + +``` +sudo mkdir /encrypted +``` + +使用 `cryptsetup luksClose` 命令锁定分区: + +``` +cryptsetup luksClose encryptedvdc1 +``` + +使用 `sudo` 安装 Clevis 软件包: + +``` +sudo yum install clevis clevis-luks clevis-dracut -y +``` + +修改 `/etc/crypttab`,在启动时打开加密卷: + +``` +sudo vim /etc/crypttab +``` + +增加以下一行: + +``` +encryptedvdc1 /dev/vdc1 none _netdev +``` + +修改 `/etc/fstab`,在重启时或启动时自动挂载加密卷: + +``` +sudo vim /etc/fstab +``` + +增加以下一行: + +``` +/dev/mapper/encryptedvdc1 /encrypted xfs _netdev 1 2 +``` + +在这个例子中,假设 Tang 服务器的 IP 地址是 `192.168.1.20`。如果你喜欢,也可以使用主机名或域名。 + +运行以下 `clevis` 命令: + +``` +sudo clevis bind luks -d /dev/vdc1 tang '{"url":"http://192.168.1.20"}' +The advertisement contains the following signing keys: + +rwA2BAITfYLuyNiIeYUMBzkhk7M + +Do you wish to trust these keys? [ynYN] Y +Enter existing LUKS password: +``` + +输入 `Y` 接受 Tang 服务器的密钥,并提供现有的 LUKS 密码进行初始设置。 + +通过 `systemctl` 启用 `clevis-luks-askpass.path`,以防止非根分区被提示输入密码。 + +``` +sudo systemctl enable clevis-luks-askpass.path +``` + +客户端已经安装完毕。现在,每当你重启服务器时,加密后的磁盘应该会自动解密,并通过 Tang 服务器取回密钥进行挂载。 + +如果 Tang 服务器因为任何原因不可用,你需要手动提供密码,才能解密和挂载分区。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/11/nbde-linux + +作者:[Curt Warfield][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/rcurtiswarfield +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/security-lock-password.jpg?itok=KJMdkKum (Lock) +[2]: https://en.wikipedia.org/wiki/Linux_Unified_Key_Setup +[3]: https://gitlab.com/cryptsetup/cryptsetup +[4]: https://github.com/latchset/clevis +[5]: https://github.com/latchset/tang \ No newline at end of file diff --git a/published/202011/20201118 LazPaint- A Free - Open Source Paint.NET Alternative.md b/published/202011/20201118 LazPaint- A Free - Open Source Paint.NET Alternative.md new file mode 100644 index 0000000000..3828710bf1 --- /dev/null +++ b/published/202011/20201118 LazPaint- A Free - Open Source Paint.NET Alternative.md @@ -0,0 +1,95 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12858-1.html) +[#]: subject: (LazPaint: A Free & Open Source Paint.NET Alternative) +[#]: via: (https://itsfoss.com/lazpaint/) +[#]: author: (Ankush Das https://itsfoss.com/author/ankush/) + +LazPaint:一个自由开源的 Paint.NET 替代品 +====== + +![](https://img.linux.net.cn/data/attachment/album/202011/25/120828b330z4cem3i030tl.jpg) + +> LazPaint 是一款开源 Paint.NET 替代品,支持跨平台。它是一个轻量级的程序,拥有一堆快速编辑图像的基本选项。下面是 LazPaint 的概述。 + +### LazPaint:Linux 下的开源 Paint.NET 替代品 + +![][1] + +如果你喜欢使用工具来快速编辑和处理图像和截图,你可能听说过 [Paint.NET][2],但它只适用于 Windows 系统。 + +它是一个流行的小工具,可以完成很多基本的编辑任务,同时还有一堆可用的选项。你可能知道一些[图像编辑工具][3],但 Paint.NET 是一个相当受欢迎的选择,因为对于一个普通用户来说,它易于使用,且没有任何臃肿的功能。 + +[LazPaint][4]作为 Linux、Windows 和 macOS 上 Paint.NET 的令人印象深刻的开源替代品而出现。它提供了操作图像所需的大部分基本功能,同时又易于使用。 + +![][5] + +由于它是跨平台的应用,即使你不使用 Linux 系统,你仍然可以以自由开源工具使用它,这并非没有意义。现在,让我们看一下它提供的一些功能。 + +### LazPaint 的功能 + +![][6] + +正如我前面提到的,LazPaint 提供了一堆必要的功能。在这里,我将列出关键的部分,这可以帮助你决定是否需要它。然而,我建议你去探索它,以了解更多关于它的信息。 + +* 支持所有主要的文件格式(包括分层位图和 3D 文件) +* 选区工具、裁剪选区、选区笔、反转选区 +* 支持导出到 [Krita][7] +* 以各种质量设置对图像进行重新采样 +* 运动模糊、自定义模糊、径向模糊和像素化工具 +* 可以移除透明度和扁平化图像 +* 旋转和翻转图像 +* 将图像转换为负片 +* 能够调整画布的大小 +* 变形工具(透视) +* 高级绘图工具 +* 设置工作区颜色 +* 黑暗主题 +* 支持脚本功能 +* 具有基本管理选项的层支持 +* 层效果 +* 过滤器 +* 灰度效果 +* 能够启用/禁用工具栏或将其添加到 Dock 上 + +### 在 Linux 上安装 LazPaint + +你应该可以在你的官方软件仓库中找到它,通过你的默认软件包管理器来安装它,但要获得最新版本,你需要下载 .deb 文件,或者在非 Debian 的发行版上从源码编译它。 + +我希望有一个可以在每个 Linux 发行版上获得最新的版本的 Flatpak 软件包,但目前还没有。 + +它也适用于 Windows 和 macOS。你会发现 Windows 还有一个便携版,可以派上用场。 + +- [LazPaint][4] + +### 关于 LazPaint 的总结 + +我发现它真的很容易使用,以各种质量设置来重新采样(或调整大小)图像绝对是一个加分项。如果你已经安装了它,你一定注意到,它不需要大量的存储空间,总体上是一个轻量级的程序。 + +它的速度很快,我在快速测试中的大部分功能都相当好用,没有任何问题。 + +你觉得 LazPaint 作为 Paint.NET 的替代品怎么样?请在下面的评论中告诉我你的想法。 + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/lazpaint/ + +作者:[Ankush Das][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://itsfoss.com/author/ankush/ +[b]: https://github.com/lujun9972 +[1]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/11/lazpaint.jpg?resize=800%2C397&ssl=1 +[2]: https://www.getpaint.net +[3]: https://itsfoss.com/image-applications-ubuntu-linux/ +[4]: https://lazpaint.github.io/ +[5]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/11/lazpaint-screenshot-2.png?resize=800%2C481&ssl=1 +[6]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/11/lazpaint-screenshot.jpg?resize=800%2C484&ssl=1 +[7]: https://krita.org/en +[9]: https://itsfoss.com/drawing-app/ \ No newline at end of file diff --git a/published/202011/20201120 How to Increase Disk Size of Your Existing Virtual Machines in VirtualBox.md b/published/202011/20201120 How to Increase Disk Size of Your Existing Virtual Machines in VirtualBox.md new file mode 100644 index 0000000000..bd09032fe7 --- /dev/null +++ b/published/202011/20201120 How to Increase Disk Size of Your Existing Virtual Machines in VirtualBox.md @@ -0,0 +1,89 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12869-1.html) +[#]: subject: (How to Increase Disk Size of Your Existing Virtual Machines in VirtualBox) +[#]: via: (https://itsfoss.com/increase-disk-size-virtualbox/) +[#]: author: (Dimitrios Savvopoulos https://itsfoss.com/author/dimitrios/) + +如何在 VirtualBox 中增加现有虚拟机的磁盘大小 +====== + +下面是你迟早会遇到的情况。 + +你在 [VirtualBox][1] 中安装了一个或多个操作系统。在创建这些虚拟操作系统的同时,你还在 VirtualBox 中为它们创建了虚拟硬盘。 + +你指定了虚拟磁盘的最大大小,比如说 15 或 20GB,但现在使用了一段时间后,你发现你的虚拟机已经没有空间了。 + +虽然[在 Ubuntu 和其他操作系统上有释放磁盘空间的方法][2],但更稳健的处理方式是增加 VirtualBox 中创建的虚拟机的磁盘大小。 + +是的,你可以在 VirtualBox 中扩大虚拟硬盘,即使在创建之后也可以。虽然这是一个安全且经过测试的过程,但我们强烈建议你在执行这样的操作之前,先创建一个虚拟机的备份。 + +### 如何扩大 VirtualBox 磁盘大小 + +![][3] + +我将向你展示如何在 VirtualBox 中以图形和命令行(对于 Linux 极客)方式调整磁盘大小。这两种方法都很简单直接。 + +#### 方法 1:在 VirtualBox 中使用虚拟媒体管理器 + +VirtualBox 6 增加了一个调整虚拟磁盘大小的图形化选项。你可以在 VirtualBox 主页的文件选项卡中找到它。 + +进入 “File -> Virtual Media Manager”: + +![][4] + +在列表中选择一个虚拟机,然后使用 “Size” 滑块或输入你需要的大小值。完成后点击 “Apply”。 + +![][5] + +请记住,虽然你增加了虚拟磁盘的大小,但**如果你的空间是动态分配的,那么实际的分区大小仍然不变**。 + +#### 方法 2:使用 Linux 命令行增加 VirtualBox 磁盘空间 + +如果你使用 Linux 操作系统作为宿主机,在宿主机中打开终端并输入以下命令来调整 VDI 的大小: + +``` +VBoxManage modifymedium "/path_to_vdi_file" --resize +``` + +在你按下回车执行命令后,调整大小的过程应该马上结束。 + +> 注意事项 +> +> VirtualBox 早期版本命令中的 `*modifyvdi` 和 `modifyhd` 命令也支持,并在内部映射到 `modifymedium` 命令。 + +![][6] + +如果你不确定虚拟机的保存位置,可以在 VirtualBox 主页面点击 “Files -> Preferences” 或使用键盘快捷键 `Ctrl+G` 找到默认位置。 + +![][7] + +### 总结 + +就我个人而言,我更喜欢在每个 Linux 发行版上使用终端来扩展磁盘,图形化选项是最新的 VirtualBox 版本的一个非常方便的补充。 + +这是一个简单快捷的小技巧,但对 VirtualBox 基础知识是一个很好的补充。如果你觉得这个小技巧很有用,可以看看 [VirtualBox 客户端增强包][8]的几个功能。 + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/increase-disk-size-virtualbox/ + +作者:[Dimitrios Savvopoulos][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://itsfoss.com/author/dimitrios/ +[b]: https://github.com/lujun9972 +[1]: https://www.virtualbox.org/ +[2]: https://itsfoss.com/free-up-space-ubuntu-linux/ +[3]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/11/enlarge-disk-size-virtualbox.png?resize=800%2C450&ssl=1 +[4]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/11/1-virtual-box-media-manager.png?resize=800%2C600&ssl=1 +[5]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/11/2-virtual-box-increase-disc-space.png?resize=800%2C505&ssl=1 +[6]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/11/3-virtual-box-increase-disc-space-terminal.png?resize=800%2C600&ssl=1 +[7]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/11/4-virtual-box-preferences.png?resize=800%2C450&ssl=1 +[8]: https://itsfoss.com/install-fedora-in-virtualbox/ diff --git a/published/202011/20201124 Compare Files and Folders Graphically in Linux With Meld.md b/published/202011/20201124 Compare Files and Folders Graphically in Linux With Meld.md new file mode 100644 index 0000000000..619f4dd774 --- /dev/null +++ b/published/202011/20201124 Compare Files and Folders Graphically in Linux With Meld.md @@ -0,0 +1,113 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12866-1.html) +[#]: subject: (Compare Files and Folders Graphically in Linux With Meld) +[#]: via: (https://itsfoss.com/meld-gui-diff/) +[#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/) + +使用 Meld 在 Linux 中以图形方式比较文件和文件夹 +====== + +![](https://img.linux.net.cn/data/attachment/album/202011/28/145914mr5zcl2wnns8rj5j.jpg) + +如何比较两个相似的文件来检查差异?答案显而易见,就是[使用 Linux 中的 diff 命令][1]。 + +问题是,并不是每个人都能自如地在 Linux 终端中比较文件,而且 `diff` 命令的输出可能会让一些人感到困惑。 + +以这个 `diff` 命令的输出为例: + +![][2] + +这里肯定涉及到一个学习曲线。然而,如果你使用的是桌面 Linux,你可以使用 [GUI][3] 应用来轻松比较两个文件是否有任何差异。 + +有几个 Linux 中的 GUI 差异比较工具。我将在本周的 Linux 应用亮点中重点介绍我最喜欢的工具 Meld。 + +### Meld:Linux(及 Windows)下的可视化比较和合并工具 + +通过 [Meld][4],你可以将两个文件并排比较。不仅如此,你还可以对文件进行相应的修改。这是你在大多数情况下想做的事情,对吗? + +![File Comparison][5] + +Meld 还能够比较目录,并显示哪些文件是不同的。它还会显示而文件是新的或是缺失的。 + +![Directory Comparison][6] + +你也可以使用 Meld 进行三向比较。 + +![Three Way File Comparison][7] + +图形化的并排比较在很多情况下都有帮助。如果你是开发人员,你可以用它来了解代码补丁。Meld 还支持版本控制系统,如 Git、[Mercurial][8]、[Subversion][9] 等。 + +### Meld 的功能 + +![][10] + +开源的 Meld 工具具有以下主要功能: + + * 进行双向和三向差异比较 + * 就地编辑文件,差异比较立即更新 + * 在差异和冲突之间进行导航 + * 通过插入、更改和冲突相应地标示出全局和局部差异,使其可视化 + * 使用正则文本过滤来忽略某些差异 + * 语法高亮显示 + * 比较两个或三个目录,看是否有新增加、缺失和更改的文件 + * 将一些文件排除在比较之外 + * 支持流行的版本控制系统,如 Git、Mercurial、Bazaar 和 SVN + * 支持多种国际语言 + * 开源 GPL v2 许可证 + * 既可用于 Linux,也可用于 Windows + +### 在 Linux 上安装 Meld + +Meld 是一个流行的应用程序,它在大多数 Linux 发行版的官方仓库中都有。 + +检查你的发行版的软件中心,看看 Meld 是否可用。 + +![Meld In Ubuntu Software Center][11] + +另外,你也可以使用你的发行版的命令行包管理器来安装 Meld。在 [Ubuntu 上,它可以在 Universe 仓库中找到][12],并且可以[使用 apt 命令安装][13]: + +``` +sudo apt install meld +``` + +你可以在 GNOME 的 GitLab 仓库中找到 Meld 的源码: + +[Meld Source Code][14] + +### 它值得使用吗? + +我知道[大多数现代开源编辑器][15]都有这个功能,但有时你只是想要一个简单的界面,而不需要安装额外的附加软件来比较文件。Meld 就为你提供了这样的功能。 + +你是否使用一些其他工具来检查文件之间的差异?是哪种工具呢?如果你用过 Meld,你有什么经验?请在评论区分享你的意见。 + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/meld-gui-diff/ + +作者:[Abhishek Prakash][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://itsfoss.com/author/abhishek/ +[b]: https://github.com/lujun9972 +[1]: https://linuxhandbook.com/diff-command/ +[2]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/11/diff-command-complicated-output.png?resize=795%2C551&ssl=1 +[3]: https://itsfoss.com/gui-cli-tui/ +[4]: https://meldmerge.org +[5]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/11/file-comaprison-in-Linux-with-meld.png?resize=800%2C498&ssl=1 +[6]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/11/directory-comparison-in-Linux-with_meld.png?resize=800%2C497&ssl=1 +[7]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/11/three-way-file-comaprison-with-meld-in-linux.png?resize=800%2C466&ssl=1 +[8]: https://www.mercurial-scm.org/ +[9]: https://subversion.apache.org/ +[10]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/11/meld-visual-diff.png?resize=786%2C455&ssl=1 +[11]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/11/Meld-in-Ubuntu-Software-Center.png?resize=800%2C384&ssl=1 +[12]: https://itsfoss.com/ubuntu-repositories/ +[13]: https://itsfoss.com/apt-command-guide/ +[14]: https://gitlab.gnome.org/GNOME/meld +[15]: https://itsfoss.com/best-modern-open-source-code-editors-for-linux/ diff --git a/published/20201109 Day 1- a confusing Rails error message.md b/published/20201109 Day 1- a confusing Rails error message.md new file mode 100644 index 0000000000..32c5ef8659 --- /dev/null +++ b/published/20201109 Day 1- a confusing Rails error message.md @@ -0,0 +1,97 @@ +[#]: collector: (lujun9972) +[#]: translator: (wxy) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12884-1.html) +[#]: subject: (Day 1: a confusing Rails error message) +[#]: via: (https://jvns.ca/blog/2020/11/09/day-1--a-little-rails-/) +[#]: author: (Julia Evans https://jvns.ca/) + +Rails 之旅第 1 天:一个令人困惑的 Rails 错误信息 +====== + +![](https://img.linux.net.cn/data/attachment/album/202012/04/080957f0p4piqz52bypqb5.jpg) + +今天,我开始了一个 Recurse Center 的班次学习!我认识了一些人,并开始了一个小小的有趣的 Rails 项目。我想我今天不会谈太多关于这个项目的实际内容,但这里有一些关于 Rails 一天的快速笔记。 + +### 一些关于开始的笔记 + +在建立 Rails 项目的过程中,我学到的主要是: + + 1. 它默认使用 sqlite,你必须告诉它使用 Postgres。 + 2. Rails 默认包含了大量的东西,你可以禁用。 + +我安装并 `rm -rf` Rails 大概 7 次后才满意,最后用了这个咒语: + +``` +rails new . -d postgresql --skip-sprockets --skip-javascript +``` + +主要是因为我想用 Postgres 而不是 sqlite,而且跳过 sprockets 和 javascript 似乎能让安装 Rails 的速度更快,而且我想如果我决定要它们的话,我可以在以后再安装。 + +### 官方的 Rails 指南真的很不错 + +我在创建我的 Rails 入门应用时主要参考了 2 个资源: + + * DHH 在 2005 年的 Rails 原版演讲 (这次我没有看,但上次我花了一天时间学习 Rails 时看了,我发现它很有启发和帮助)。 + * 官方的 Rails 入门指南,似乎非常简短明了 。 + +### 一个神秘的错误信息:`undefined method 'user'` + +我喜欢 bug,所以今天我遇到了一个奇怪的 Rails 错误! 我有一些看起来像这样的代码: + +``` +@user = User.new(user_params) +@user.save +``` + +很简单吧?但当这段代码运行时,我得到了这个令人费解的错误信息: + +``` +undefined method `user' for # Did you mean? super +``` + +我对这里发生的事情感到**超级**困惑,因为我没有调用一个叫做 `user` 的方法。我调用的是 `.save`。什么嘛?!我对此感到困惑和沮丧,大概呆了 20 分钟,最后我看了看我的 `User` 模型,发现了这段代码: + +``` +class User < ApplicationRecord + has_secure_password + + validates :user, presence: true, uniqueness: true +end +``` + +`validates :user...` *应该*是一些 Rails 魔法,验证每个 `User` 都有一个 `username`,而且用户名必须是唯一的。但我犯了一个错,我写的是 `user` 而不是 `username`。我把这个问题解决了,然后一切都正常了!万岁。 + +我仍然不明白我应该如何调试这个问题:堆栈跟踪告诉我问题出在 `@user.save` 行,根本没有提到 `validates :user` 的事情。我觉得一定有办法调试这个问题,但我不知道是什么办法。 + +我学 Rails 的目的就是想看看 Rails 的魔力在实践中是如何发挥的,所以这是个很有意思的 bug,早早的就掉坑里了。 + +### 一个简单的用户管理系统 + +我决定在我的玩具应用中加入用户。我在网上搜索了一下,发现有一个非常流行的叫做 [devise][1] 的工具可以处理用户。我发现它的 `README` 有点让人不知所措,而且我知道想要在我的玩具应用中建立一个非常简陋的用户管理系统,所以我遵循了这个名为《[Rails 5.2 中从零开始进行用户验证][2]》的指南,到目前为止,这个指南似乎还不错。Rails 似乎已经有了一大堆管理用户的内置东西,我真的很惊讶于这本指南的短小和我需要写的代码之少。 + +我在实现用户功能的时候了解到,Rails 有一个内置的神奇的会话管理系统(参见 [Rails 会话如何工作][3]。默认情况下,所有的会话数据似乎都存储在用户电脑上的 cookie 中,不过我想如果 cookie 太大了,你也可以把会话数据存储在数据库中。 + +已经有了会话管理系统,有了 cookie 和用户,却不太清楚到底发生了什么,这肯定是有点奇怪的,但也是挺好玩的!我们会看看情况如何。我们将拭目以待。 + +### 明天:更多的 Rails! + +也许明天我可以在实现我的有趣的 rails 应用的想法上取得一些进展! + +-------------------------------------------------------------------------------- + +via: https://jvns.ca/blog/2020/11/09/day-1--a-little-rails-/ + +作者:[Julia Evans][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://jvns.ca/ +[b]: https://github.com/lujun9972 +[1]: https://github.com/heartcombo/devise +[2]: https://medium.com/@wintermeyer/authentication-from-scratch-with-rails-5-2-92d8676f6836 +[3]: https://www.justinweiss.com/articles/how-rails-sessions-work/ diff --git a/published/20201110 Day 2- Rails associations - dragging divs around.md b/published/20201110 Day 2- Rails associations - dragging divs around.md new file mode 100644 index 0000000000..38bf83bcf2 --- /dev/null +++ b/published/20201110 Day 2- Rails associations - dragging divs around.md @@ -0,0 +1,117 @@ +[#]: collector: (lujun9972) +[#]: translator: (wxy) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12890-1.html) +[#]: subject: (Day 2: Rails associations & dragging divs around) +[#]: via: (https://jvns.ca/blog/2020/11/10/day-2--rails-associations---dragging-divs-around/) +[#]: author: (Julia Evans https://jvns.ca/) + +Rails 之旅第 2 天:Rails 关联和拖动 div +====== + +![](https://img.linux.net.cn/data/attachment/album/202012/05/212345zz8jajhaj0hh8h2f.jpg) + +大家好!今天是我搭建这个玩具项目的第 2 天。下面再来记录一下关于 Rails 的一些有趣的事情吧! + +### 目标:做一个冰箱诗歌论坛 + +我想做一种无聊的标准网站来学习 Rails,并且其他人可以与之互动,就像一个论坛一样! 但如果人们真的可以在网站上打字,那就会产生各种各样的问题(如果他们是垃圾邮件发送者怎么办?又或者只是言语刻薄?)。 + +我想到的第一个想法是,可以让人们与网站互动,但实际上却不能在网站上打字,那就是一个“冰箱诗歌论坛”,只给你一组固定的字,你就可以随意组合。 + +所以,这就是我们的计划! + +我这个项目的目标是想知道我是否能用 Rails 来做其他的小型网络项目(而不是像我通常做的那样,使用一些更基本的东西,比如 Flask,或者放弃后端,用 Javascript 来写所有东西)。 + +### 怎么把字拖来拖去呢?jQuery 的可拖放 UI! + +我想让大家能够把文字拖动起来,但我又不想写很多 Javascript。结果发现这超级简单 —— 有一个 jQuery 库可以做到,它叫做 `draggable`!一开始,拖动并不成功。 + +一开始拖动在手机上是不行的,但是有一个技巧可以让 jQuery UI 在手机上工作,叫做 [jQuery UI touch punch][1]。下面是它的样子(有兴趣看工作原理的可以查看源码,代码很少)。 + +> `banana` `forest` `cake` `is` + +### 一个有趣的 Rails 功能:关联 + +我以前从来没有使用过关系型 ORM,对于 Rails,我很兴奋的一件事就是想看看使用 Active Record 是什么样子的!今天我了解了 Rails 的 ORM 功能之一:[关联][2]。如果你像我一样对 ORM 完全不了解的话,那就来看看是怎么回事吧。 + +在我的论坛中,我有: + + * 用户 + * 话题(我本来想把它叫做“线索”,但显然这在 Rails 中是一个保留词,所以现在叫做“话题”)。 + * 帖子 + +当显示一个帖子时,我需要显示创建该帖子的用户的用户名。所以我想我可能需要写一些代码来加载帖子,并为每个帖子加载用户,就像这样(在 Rails 中,`Post.where` 和 `User.find` 将会运行 SQL 语句,并将结果转化为 Ruby 对象): + +``` +@posts = Post.where(topic_id: id) +@posts.each do |post| + user = User.find(post.user_id) + post.user = user +end +``` + +这还不够好,它要为每个帖子做一次单独的 SQL 查询!我知道有一个更好的方法,我发现它叫做[关联][2]。这个链接是来自 的指南,到目前为止,它对我很有帮助。 + +基本上我需要做的就是: + + 1. 在 `User` 模型中添加一行 `has_many :post`。 + 2. 在 `Post` 模型中添加一行 `belongs_to :user`。 + 3. Rails 现在知道如何将这两个表连接起来,尽管我没有告诉它要连接到什么列上!我认为这是因为我按照它所期望的惯例命名了 `posts` 表中的 `user_id` 列。 + 4. 对 `User` 和 `Topic` 做完全相同的事情(一个主题也有很多帖子:`has_many :posts`)。 + +然后我加载每一个帖子和它的关联用户的代码就变成了只有一行! 就是这一行: + +``` +@posts = @topic.posts.order(created_at: :asc).preload(:user) +``` + +比起只有一行更重要的是,它不是单独做一个查询来获取每个帖子的用户,而是在 1 个查询中获取所有用户。显然,在 Rails 中,有一堆[不同的方法][3]来做类似的事情(预加载、急切加载、联接和包含?),我还不知道这些都是什么,但也许我以后会知道的。 + +### 一个有趣的 Rails 功能:脚手架! + +Rails 有一个叫 `rails` 的命令行工具,它可以生成很多代码。例如,我想添加一个 `Topic` 模型/控制器。我不用去想在哪里添加所有的代码,可以直接运行 + +``` +rails generate scaffold Topic title:text +``` + +并生成了一堆代码,这样我已经有了基本的端点来创建/编辑/删除主题(`Topic`)。例如,这是我的[现在的主题控制器][4],其中大部分我没有写(我只写了高亮的 3 行)。我可能会删除很多内容,但是有一个起点,让我可以扩展我想要的部分,删除我不想要的部分,感觉还不错。 + +### 数据库迁移! + +`rails` 工具还可以生成数据库迁移! 例如,我决定要删除帖子中的 `title` 字段。 + +下面是我要做的: + +``` +rails generate migration RemoveTitleFromPosts title:string +rails db:migrate +``` + +就是这样 —— 只要运行几个命令行咒语就可以了! 我运行了几个这样的迁移,因为我改变了对我的数据库模式的设想。它是相当直接的,到目前为止 —— 感觉很神奇。 + +当我试图在一列中的某些字段为空的地方添加一个“不为空”(`not null`)约束时,情况就变得有点有趣了 —— 迁移失败。但我可以修复违例的记录,并轻松地重新运行迁移。 + +### 今天就到这里吧! + +明天,如果我有更多的进展,也许我会把它放在互联网上。 + +-------------------------------------------------------------------------------- + +via: https://jvns.ca/blog/2020/11/10/day-2--rails-associations---dragging-divs-around/ + +作者:[Julia Evans][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://jvns.ca/ +[b]: https://github.com/lujun9972 +[1]: https://github.com/furf/jquery-ui-touch-punch +[2]: https://guides.rubyonrails.org/association_basics.html +[3]: https://blog.bigbinary.com/2013/07/01/preload-vs-eager-load-vs-joins-vs-includes.html +[4]: https://github.com/jvns/refrigerator-forum/blob/776b3227cfd7004cb1efb00ec7e3f82a511cbdc4/app/controllers/topics_controller.rb#L13-L15 diff --git a/published/20201116 How to use Serializers in the Django Python web framework.md b/published/20201116 How to use Serializers in the Django Python web framework.md new file mode 100644 index 0000000000..f3f83f18a1 --- /dev/null +++ b/published/20201116 How to use Serializers in the Django Python web framework.md @@ -0,0 +1,242 @@ +[#]: collector: (lujun9972) +[#]: translator: (MjSeven) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12900-1.html) +[#]: subject: (How to use Serializers in the Django Python web framework) +[#]: via: (https://opensource.com/article/20/11/django-rest-framework-serializers) +[#]: author: (Renato Oliveira https://opensource.com/users/renato-oliveira) + +如何在 Python Web 框架 Django 中使用序列化器 +====== + +> 序列化用于将数据转换为方便存储或传输的格式,然后将其重新构建以供使用。DRF 是最具有知名的序列化器。 + +![](https://img.linux.net.cn/data/attachment/album/202012/08/220845q5tz7cfftze5oem5.jpg) + +序列化是将数据转换为可以存储或传输的格式,然后对其进行重新构建的过程。在开发应用程序或将数据存储在数据库、内存或将其转换为文件时,一直会用到它。 + +我最近帮助 [Labcodes][2] 的两名初级开发人员理解序列化器,我想也可以与诸位读者分享一下我的方法。 + +假设你正在编写一个电子商务网站,你有一个订单,该订单记录了某人在某个日期以某种价格购买了一个产品: + +``` +class Order: +    def __init__(self, product, customer, price, date): +        self.product = product +        self.customer = customer +        self.price = price +        self.date = date +``` + +现在,假设你想从一个键值数据库中存储和检索订单数据。幸运的是,它的接口可以接受和返回字典,因此你需要将对象转换成字典: + +``` +def serialize_order(order): +    return { +        'product': order.product, +        'customer': order.customer, +        'price': order.price, +        'date': order.date +    } +``` + +如果你想从数据库中获取一些数据,你可以获取字典数据并将其转换为订单对象(`Order`): + +``` +def deserialize_order(order_data): +    return Order( +        product=order_data['product'], +        customer=order_data['customer'], +        price=order_data['price'], +        date=order_data['date'], +    ) +``` + +这对于简单的数据非常直接了当,但是当你需要处理一些由复杂属性构成的复杂对象时,这种方法就无法很好地扩展。你还需要处理不同类型字段的验证,这需要手工完成大量工作。 + +此时框架的序列化可以很方便的派上用场。它们使你可以创建带有少量模板的序列化器,这将适用于复杂的情况。 + +[Django][3] 提供了一个序列化模块,允许你将模型“转换”为其它格式: + +``` +from django.core import serializers + +serializers.serialize('json', Order.objects.all()) +``` + +它涵盖了 Web 应用程序最常用的种类,例如 JSON、YAML 和 XML。但是你也可以使用第三方序列化器或创建自己的序列化器。你只需要在 `settings.py` 文件中注册它: + +``` +# settings.py +SERIALIZATION_MODULES = { +    'my_format': appname.serializers.MyFormatSerializer, +} +``` + +要创建自己的 `MyFormatSerializer`,你需要实现 `.serialize()` 方法并接受一个查询集和其它选项作为参数: + +``` +class MyFormatSerializer: +    def serialize(self, queryset, **options): +        # serious serialization happening +``` + +现在,你可以将查询集序列化为新格式: + +``` +from django.core import serializers + +serializers.serialize('my_format', Order.objects.all()) +``` + +你可以使用选项参数来定义序列化程序的行为。例如,如果要定义在处理 `ForeignKeys` 时要使用嵌套序列化,或者只希望数据返回其主键,你可以传递一个 `flat=True` 参数作为选项,并在方法中处理: + +``` +class MyFormatSerializer: +    def serializer(self, queryset, **options): +        if options.get('flat', False): +            # don't recursively serialize relationships +        # recursively serialize relationships +``` + +使用 Django 序列化的一种方法是使用 `loaddata` 和 `dumpdata` 管理命令。 + +### DRF 序列化器 + +在 Django 社区中,[Django REST 框架][4](DRF)提供了最著名的序列化器。尽管你可以使用 Django 的序列化器来构建将在 API 中响应的 JSON,但 REST 框架中的序列化器提供了更出色的功能,可以帮助你处理并轻松验证复杂的数据。 + +在订单的例子中,你可以像这样创建一个序列化器: + +``` +from restframework import serializers + +class OrderSerializer(serializers.Serializer): +    product = serializers.CharField(max_length=255) +    customer = serializers.CharField(max_lenght=255) +    price = serializers.DecimalField(max_digits=5, decimal_places=2) +    date = serializers.DateField() +``` + +轻松序列化其数据: + +``` +order = Order('pen', 'renato', 10.50, date.today()) +serializer = OrderSerializer(order) + +serializer.data +# {'product': 'pen', 'customer': 'renato', 'price': '10.50', 'date': '2020-08-16'} +``` + +为了能够从数据返回实例,你需要实现两个方法:`create` 和 `update`: + +``` +from rest_framework import serializers + +class OrderSerializer(serializers.Serializer): +    product = serializers.CharField(max_length=255) +    customer = serializers.CharField(max_length=255) +    price = serializers.DecimalField(max_digits=5, decimal_places=2) +    date = serializers.DateField() + +    def create(self, validated_data): +        # 执行订单创建 +        return order + +    def update(self, instance, validated_data): +       # 执行实例更新 +       return instance +``` + +之后,你可以通过调用 `is_valid()` 来验证数据,并通过调用 `save()` 来创建或更新实例: + +``` +serializer = OrderSerializer(**data) +## 若要验证数据,在调用 save 之前必须执行 +serializer.is_valid() +serializer.save() +``` + +### 模型序列化器 + +序列化数据时,通常需要从数据库(即你创建的模型)进行数据处理。`ModelSerializer` 与 `ModelForm` 一样,提供了一个 API,用于从模型创建序列化器。假设你有一个订单模型: + +``` +from django.db import models + +class Order(models.Model): +    product = models.CharField(max_length=255) +    customer = models.CharField(max_length=255) +    price = models.DecimalField(max_digits=5, decimal_places=2) +    date = models.DateField()     +``` + +你可以像这样为它创建一个序列化器: + +``` +from rest_framework import serializers + +class OrderSerializer(serializers.ModelSerializer): +    class Meta: +        model = Order +        fields = '__all__' +``` + +Django 会自动在序列化器中包含所有模型字段,并创建 `create` 和 `udpate` 方法。 + +### 在基于类的视图(CBV)中使用序列化器 + +像 Django CBV 中的 `Forms` 一样,序列化器可以很好地与 DRF 集成。你可以设置 `serializer_class` 属性,方便序列化器用于视图: + +``` +from rest_framework import generics + +class OrderListCreateAPIView(generics.ListCreateAPIView): +    queryset = Order.objects.all() +    serializer_class = OrderSerializer +``` + +你也可以定义 `get_serializer_class()` 方法: + +``` +from rest_framework import generics + +class OrderListCreateAPIView(generics.ListCreateAPIView): +    queryset = Order.objects.all() +    +    def get_serializer_class(self): +        if is_free_order(): +            return FreeOrderSerializer +        return OrderSerializer +``` + +在 CBV 中还有其它与序列化器交互的方法。例如,[get_serializer()][5] 返回一个已经实例化的序列化器,[get_serializer_context()][6] 返回创建实例时传递给序列化器的参数。对于创建或更新数据的视图,有 `create` 和 `update`,它们使用 `is_valid` 方法验证数据,还有 [perform_create][7] 和 [perform_update][8] 调用序列化器的 `save` 方法。 + +### 了解更多 + +要了解更多资源,参考我朋友 André Ericson 的[经典 Django REST 框架][9]网站。它是一个[基于类的经典视图][10]的 REST 框架版本,可让你深入查看组成 DRF 的类。当然,官方[文档][11]也是一个很棒的资源。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/11/django-rest-framework-serializers + +作者:[Renato Oliveira][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/renato-oliveira +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/data_analytics_cloud.png?itok=eE4uIoaB (Net catching 1s and 0s or data in the clouds) +[2]: http://www.labcodes.com.br +[3]: https://www.djangoproject.com/ +[4]: https://www.django-rest-framework.org/ +[5]: http://www.cdrf.co/3.9/rest_framework.generics/CreateAPIView.html#get_serializer +[6]: http://www.cdrf.co/3.9/rest_framework.generics/CreateAPIView.html#get_serializer_context +[7]: http://www.cdrf.co/3.9/rest_framework.generics/CreateAPIView.html#perform_create +[8]: http://www.cdrf.co/3.9/rest_framework.generics/RetrieveUpdateAPIView.html#perform_update +[9]: http://www.cdrf.co/ +[10]: https://ccbv.co.uk/ +[11]: https://www.django-rest-framework.org/api-guide/serializers/#serializers diff --git a/published/20201125 Get started with Fossil, an alternative to Git.md b/published/20201125 Get started with Fossil, an alternative to Git.md new file mode 100644 index 0000000000..f5f40fb054 --- /dev/null +++ b/published/20201125 Get started with Fossil, an alternative to Git.md @@ -0,0 +1,227 @@ +[#]: collector: "lujun9972" +[#]: translator: "lxbwolf" +[#]: reviewer: "wxy" +[#]: publisher: "wxy" +[#]: url: "https://linux.cn/article-12875-1.html" +[#]: subject: "Get started with Fossil, an alternative to Git" +[#]: via: "https://opensource.com/article/20/11/fossil" +[#]: author: "Klaatu https://opensource.com/users/klaatu" + +了解一下 Fossil,一个 Git 的替代品 +====== + +> Fossil 是一个集版本控制系统、bug 追踪、维基、论坛以及文档解决方案于一体的系统。 + +![](https://img.linux.net.cn/data/attachment/album/202012/01/173057hfhyzyw921zll219.jpg) + +每个开发者都知道,追踪代码的修改是至关重要的。有时候你会处于好奇或者教育的目的需要展示你的项目开始和进化的历史。有时候你想让其他的开发者参与到你的项目中,因此你需要一种值得信赖的能合并不同代码分支的方法。更极端一点,有时候你为了解决一个问题而修改的代码导致已有的功能不能正常使用。 + +[Fossil][2] 源码管理系统是由著名的 [SQLite][3] 数据库的作者开发的一个集版本控制系统、bug 追踪、维基、论坛以及文档解决方案于一体的系统。 + +### 安装 Fossil + +Fossil 是一个独立的 C 程序,因此你可以从它的网站上[下载][4]后放在环境变量 [PATH][5] 中的任意位置。例如,假定 `/usr/local/bin` 已经在你的环境变量中(默认情况下是在的): + +``` +$ wget https://fossil-scm.org/home/uv/fossil-linux-x64-X.Y.tar.gz +$ sudo tar xvf fossil-linux-x64-X.Y.tar.gz --directory /usr/local/bin +``` + +你也可以通过包管理器从软件仓库中找到 Fossil,或者直接从源码编译。 + +### 创建一个 Fossil 仓库 + +如果你已经有一个代码项目,想用 Fossil 来追踪,那么第一步就是创建一个 Fossil 仓库: + +``` +$ fossil init myproject.fossil +project-id: 010836ac6112fefb0b015702152d447c8c1d8604 +server-id:  54d837e9dc938ba1caa56d31b99c35a4c9627f44 +admin-user: klaatu (initial password is "14b605") +``` + +创建 Fossil 仓库的过程中会返回三行信息:一个唯一的项目 ID、一个唯一的服务器 ID 以及管理员 ID 和密码。项目 ID 和服务器 ID 是版本数字。管理员凭证表明你对这个仓库的所有权,当你把 Fossil 作为服务器让其他用户来访问时可以使用管理员权限。 + +### Fossil 仓库工作流 + +在你使用 Fossil 仓库之前,你需要先为它的数据创建一个工作路径。你可以把这个过程类比为使用 Python 时创建一个虚拟环境或者解压一个只用来备份的 ZIP 文件。 + +创建一个工作目录并进入: + +``` +$ mkdir myprojectdir +$ cd myprojectdir +``` + +把你的 Fossil 打开到刚刚创建的目录: + +``` +$ fossil open ../myproject +project-name: +repository: /home/klaatu/myprojectdir/../myproject +local-root: /home/klaatu/myprojectdir/ +config-db: /home/klaatu/.fossil +project-code: 010836ac6112fefb0b015702152d447c8c1d8604 +checkout: 9e6cd96dd675544c58a246520ad58cdd460d1559 2020-11-09 04:09:35 UTC +tags: trunk +comment: initial empty check-in (user: klaatu) +check-ins: 1 +``` + +你可能注意到了,Fossil 在你的家目录下创建了一个名为 `.fossil` 的隐藏文件,用来追踪你的全局 Fossil 配置。这个配置不是只适用于你的一个项目的;这个文件只会在你第一次使用 Fossil 时生成。 + +#### 添加文件 + +使用 `add` 和 `commit` 子命令来向你的仓库添加文件。例如,创建一个简单的 `README` 文件,把它添加到仓库: + +``` +$ echo "My first Fossil project" > README +$ fossil add README +ADDED  README +$ fossil commit -m 'My first commit' +New_Version: 2472a43acd11c93d08314e852dedfc6a476403695e44f47061607e4e90ad01aa +``` + +#### 使用分支 + +Fossil 仓库开始时默认使用的主分支名为 `trunk`。当你想修改代码而又不影响主干代码时,你可以从 trunk 分支切走。创建新分支需要使用 `branch` 子命令,这个命令需要两个参数:一个新分支的名字,一个新分支的基分支名字。在本例中,只有一个分支 `trunk`,因此尝试创建一个名为 `dev` 的新分支: + +``` +$ fossil branch --help +Usage: fossil branch new BRANCH-NAME BASIS ?OPTIONS? +$ fossil branch new dev trunk +New branch: cb90e9c6f23a9c98e0c3656d7e18d320fa52e666700b12b5ebbc4674a0703695 +``` + +你已经创建了一个新分支,但是你当前所在的分支仍然是 `trunk`: + +``` +$ fossil branch current +trunk +``` + +使用 `checkout` 命令切换到你的新分支 `dev`: + +``` +$ fossil checkout dev +dev +``` + +#### 合并修改 + +假设你在 `dev` 分支中添加了一个新文件,完成了测试,现在想把它合并到 `trunk`。这个过程叫做*合并*。 + +首先,切回目标分支(本例中目标分支为 `trunk`): + + +``` +$ fossil checkout trunk +trunk +$ ls +README +``` + +这个分支中没有你的新文件(或者你对其他文件的修改),而那些内容是合并的过程需要的信息: + +``` +$ fossil merge dev + "fossil undo" is available to undo changes to the working checkout. +$ ls +myfile.lua  README +``` + +### 查看 Fossil 时间线 + +使用 `timeline` 选项来查看仓库的历史。这个命令列出了你的仓库的所有活动的详细信息,包括用来表示每次修改的哈希值、每次提交时填写的信息以及提交者: + +``` +$ fossil timeline +=== 2020-11-09 === +06:24:16 [5ef06e668b] added exciting new file (user: klaatu tags: dev) +06:11:19 [cb90e9c6f2] Create new branch named "dev" (user: klaatu tags: dev) +06:08:09 [a2bb73e4a3] *CURRENT* some additions were made (user: klaatu tags: trunk) +06:00:47 [2472a43acd] This is my first commit. (user: klaatu tags: trunk) +04:09:35 [9e6cd96dd6] initial empty check-in (user: klaatu tags: trunk) ++++ no more data (5) +++ +``` + +![Fossil UI][6] + +### 公开你的 Fossil 仓库 + +因为 Fossil 有个内置的 web 界面,所以 Fossil 不像 GitLab 和 Gitea 那样需要主机服务。Fossil 就是它自己的主机服务,只要你把它放在一台机器上就行了。在你公开你的 Fossil 仓库之前,你还需要通过 web 用户界面(UI)来配置一些信息: + +使用 `ui` 子命令启动一个本地的实例: + +``` +$ pwd +/home/klaatu/myprojectdir/ +$ fossil ui +``` + +“Users” 和 “Settings” 是安全相关的,“Configuration” 是项目属性相关的(包括一个合适的标题)。web 界面不仅仅是一个方便的功能。 它是能在生产环境中使用并作为 Fossil 项目的宿主机来使用的。它还有一些其他的高级选项,比如用户管理(或者叫自我管理)、在同一个服务器上与其他的 Fossil 仓库进行单点登录(SSO)。 + +当配置完成后,关掉 web 界面并按下 `Ctrl+C` 来停止 UI 引擎。像提交代码一样提交你的 web 修改。 + +``` +$ fossil commit -m 'web ui updates' +New_Version: 11fe7f2855a3246c303df00ec725d0fca526fa0b83fa67c95db92283e8273c60 +``` + +现在你可以配置你的 Fossil 服务器了。 + + 1. 把你的 Fossil 仓库(本例中是 `myproject.fossil`)复制到服务器,你只需要这一个文件。 + 2. 如果你的服务器没有安装 Fossil,就在你的服务器上安装 Fossil。在服务器上安装的过程跟在本地一样。 + 3. 在你的 `cgi-bin` 目录下(或它对应的目录,这取决于你的 HTTP 守护进程)创建一个名为 `repo_myproject.cgi` 的文件: + +``` +#!/usr/local/bin/fossil +repository: /home/klaatu/public_html/myproject.fossil +``` + +添加可执行权限: + +``` +$ chmod +x repo_myproject.cgi +``` + +你需要做的都已经做完了。现在可以通过互联网访问你的项目了。 + +你可以通过 CGI 脚本来访问 web UI,例如 `https://example.com/cgi-bin/repo_myproject.cgi`。 + +你也可以通过命令行来进行交互: + +``` +$ fossil clone https://klaatu@example.com/cgi-bin/repo_myproject.cgi +``` + +在本地的克隆仓库中工作时,你需要使用 `push` 子命令把本地的修改推送到远程的仓库,使用 `pull` 子命令把远程的修改拉取到本地仓库: + +``` +$ fossil push https://klaatu@example.com/cgi-bin/repo_myproject.cgi +``` + +### 使用 Fossil 作为独立的托管 + +Fossil 将大量的权力交到了你的手中(以及你的合作者的手中),让你不再依赖托管服务。本文只是简单的介绍了基本概念。你的代码项目还会用到很多有用的 Fossil 功能。尝试一下 Fossil。它不仅会改变你对版本控制的理解;它会让你不再考虑其他的版本控制系统。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/11/fossil + +作者:[Klaatu][a] +选题:[lujun9972][b] +译者:[lxbwolf](https://github.com/lxbwolf) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/klaatu +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/osdc_dinosaur_sunset.png?itok=lbzpbW5p "Dinosaurs on land at sunset" +[2]: https://fossil-scm.org/home/doc/trunk/www/index.wiki +[3]: https://www.sqlite.org/index.html +[4]: https://fossil-scm.org/home/uv/download.html +[5]: https://opensource.com/article/17/6/set-path-linux +[6]: https://opensource.com/sites/default/files/uploads/fossil-ui.jpg "Fossil UI" +[7]: https://creativecommons.org/licenses/by-sa/4.0/ diff --git a/published/20201129 How to Go Full Dark Mode With LibreOffice.md b/published/20201129 How to Go Full Dark Mode With LibreOffice.md new file mode 100644 index 0000000000..21ca4829cb --- /dev/null +++ b/published/20201129 How to Go Full Dark Mode With LibreOffice.md @@ -0,0 +1,82 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12893-1.html) +[#]: subject: (How to Go Full Dark Mode With LibreOffice) +[#]: via: (https://itsfoss.com/libreoffice-dark-mode/) +[#]: author: (Dimitrios Savvopoulos https://itsfoss.com/author/dimitrios/) + +如何在 LibreOffice 中完全启用深色模式 +====== + +![](https://img.linux.net.cn/data/attachment/album/202012/07/083812n0zgss9qt175pm9z.jpg) + +[LibreOffice][1] 是一款自由开源的跨平台办公生产力软件。如果你没有充分利用它,那么必须看下 [LibreOffice 小技巧][2]。 + +甚至在非编程人员中,深色主题也越来越受欢迎。它减轻了眼睛的压力,特别适合长时间使用屏幕。有人认为,这使文本看起来清晰明了,有助于提高生产率。 + +如今,某些 Linux 发行版例如 [Ubuntu 带有深色模式][3],使你的系统具有更暗的色彩。当你打开深色模式dark mode时,某些应用将自动切换到深色模式。 + +LibreOffice 也会这样,但你编辑的主区域除外: + +![LibreOffice semi dark mode matching with the system theme][4] + +你可以更改它。如果要让 LibreOffice 进入完全深色模式,只需更改一些设置。让我告诉你如何做。 + +### 如何在 LibreOffice 中完全启用深色模式 + +如前所述,你需要先启用系统范围的深色模式。这样可以确保窗口颜色(或标题栏)与应用内深色完全融合。 + +接下来,打开套件中的**任意** LibreOffice 应用,例如 **Writer**。然后从菜单中,依次点击 **Tools -> Options -> Application Colors**,然后选择 **Document background 和 Application background** 为 **Black** 或 **Automatic**(任意适合你的方式)。 + +![][5] + +如果图标不是深色,那么可以从菜单(如下图所示)中更改它们,**Tools -> Options -> View** ,我在 MX Linux 上的个人选择是 Ubuntu 的 [Yaru][6] 图标样式(如果你使用的图标包为深色版本,请选择它) 。 + +![][7] + +当然,你也可以尝试其他 Linux 发行版的 [icon 主题][8]。 + +最终结果应如下所示: + +![][9] + +#### LibreOffice flatpak 软件包的其他技巧 + +如果你使用的是 LibreOffice 套件的 [Flatpak 软件包][10],那么 LibreOffice 的标题区域(或菜单区域)可能看起来是白色的。在这种情况下,你可以尝试进入 **Tools -> Options -> Personalization**,然后选择 “**灰色主题**”,如下截图所示。 + +![][11] + +它并不完全是黑色的,但应该可以使外观看起来更好。希望可以帮助你切换到深色主题的 LibreOffice 体验! + +#### 总结 + +深色主题逐渐开始在我们的台式机中占主导地位,它具有现代品味并减少了眼睛疲劳,尤其是在弱光条件下。 + +LibreOffice 使你可以自由地将工作环境切换为深色主题或保留浅色主题元素。实际上,你将有大量的自定义选项来调整你喜欢的内容。你是否已在 LibreOffice 上切换为深色主题?你首选哪种颜色组合?在下面的评论中让我们知道! + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/libreoffice-dark-mode/ + +作者:[Dimitrios Savvopoulos][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://itsfoss.com/author/dimitrios/ +[b]: https://github.com/lujun9972 +[1]: https://www.libreoffice.org +[2]: https://itsfoss.com/libreoffice-tips/ +[3]: https://itsfoss.com/dark-mode-ubuntu/ +[4]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/11/libreOffice-dark-mode.png?resize=799%2C450&ssl=1 +[5]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/11/1-libreoffice-application-colours.png?resize=800%2C551&ssl=1 +[6]: https://extensions.libreoffice.org/en/extensions/show/yaru-icon-theme +[7]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/11/2-libreoffice-iconstyle-1.png?resize=800%2C531&ssl=1 +[8]: https://itsfoss.com/best-icon-themes-ubuntu-16-04/ +[9]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/11/3-libreoffice-dark.png?resize=800%2C612&ssl=1 +[10]: https://itsfoss.com/what-is-flatpak/ +[11]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/11/libre-office-personalization.png?resize=800%2C636&ssl=1 diff --git a/published/20201130 8 Git aliases that make me more efficient.md b/published/20201130 8 Git aliases that make me more efficient.md new file mode 100644 index 0000000000..67e9e75811 --- /dev/null +++ b/published/20201130 8 Git aliases that make me more efficient.md @@ -0,0 +1,256 @@ +[#]: collector: (lujun9972) +[#]: translator: (wxy) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12904-1.html) +[#]: subject: (8 Git aliases that make me more efficient) +[#]: via: (https://opensource.com/article/20/11/git-aliases) +[#]: author: (Ricardo Gerardi https://opensource.com/users/rgerardi) + +8 个让我更有效率的 Git 别名 +====== + +> 使用别名为你最常用或复杂的 Git 命令创建快捷方式。 + +![](https://img.linux.net.cn/data/attachment/album/202012/09/202245q50ss5kncqc241sf.jpg) + +这篇出色的文章《[改变我使用 Git 工作方式的七个技巧][2]》启发了我写下另一个对我在命令行上使用 Git 的经验有重大影响的 Git 特性:别名。 + +定义 Git 的别名来替代命令有两大好处。 + + * 它简化了有许多选项的长命令,使它们更短,更容易记住。 + * 缩短了经常使用的命令,使你的工作更有效率。 + +### 如何定义和使用别名 + +要定义 Git 的别名,请使用 `git config` 命令,加上别名和要替换的命令。例如,要为 `git push` 创建别名 `p`: + +``` +$ git config --global alias.p 'push' +``` + +你可以通过将别名作为 `git` 的参数来使用别名,就像其他命令一样: + +``` +$ git p +``` + +要查看所有的别名,用 `git config` 列出你的配置: + +``` +$ git config --global -l +user.name=ricardo +user.email=ricardo@example.com +alias.p=push +``` + +你也可以用你喜欢的 shell 来定义别名,比如 Bash 或 Zsh。不过,用 Git 定义别名有几个功能是用 shell 无法实现的。首先,它允许你在不同的 shell 中使用别名,而无需额外配置。此外,它还集成了 Git 的自动更正功能,所以当你输入错误的命令时,Git 可以建议你正确的别名。最后,Git 还会将别名保存在用户配置文件中,你可以通过复制一个文件将别名转移到其他机器上。 + +无论使用哪种方法,定义别名都能改善你使用 Git 的整体体验。更多关于定义 Git 别名的信息,请看《[Git Book][4]》。 + +### 8 个有用的 Git 别名 + +现在你知道如何创建和使用别名了,来看看一些有用的别名。 + +#### 1、Git 状态 + +Git 命令行用户经常使用 `status` 命令来查看已更改或未跟踪的文件。默认情况下,这个命令提供了很多行的冗长输出,你可能不想要或不需要。你可以使用一个别名来处理这两个组件。定义别名 `st` 来缩短命令,并使用选项 `-sb` 来输出一个不那么啰嗦的状态和分支信息。 + +``` +$ git config --global alias.st 'status -sb' +``` + +如果你在一个干净的分支上使用这个别名,你的输出就像这样: + +``` +$  git st +## master +``` + +在一个带有已更改和未跟踪文件的分支上使用它,会产生这样的输出: + +``` +$ git st +## master + M test2 +?? test3 +``` + +#### 2、Git 单行日志 + +创建一个别名,以单行方式显示你的提交,使输出更紧凑: + +``` +$ git config --global alias.ll 'log --oneline' +``` + +使用这个别名可以提供所有提交的简短列表: + +``` +$ git ll +33559c5 (HEAD -> master) Another commit +17646c1 test1 +``` + +#### 3、Git 的最近一次提交 + +这将显示你最近一次提交的详细信息。这是扩展了《Git Book》中 [别名][4] 一章的例子: + +``` +$ git config --global alias.last 'log -1 HEAD --stat' +``` + +用它来查看最后的提交: + +``` +$ git last +commit f3dddcbaabb928f84f45131ea5be88dcf0692783 (HEAD -> branch1) +Author: ricardo +Date:   Tue Nov 3 00:19:52 2020 +0000 + +    Commit to branch1 + + test2 | 1 + + test3 | 0 + 2 files changed, 1 insertion(+) +``` + +#### 4、Git 提交 + +当你对 Git 仓库进行修改时,你会经常使用 `git commit`。使用 `cm` 别名使 `git commit -m` 命令更有效率: + +``` +$ git config --global alias.cm 'commit -m' +``` + +因为 Git 别名扩展了命令,所以你可以在执行过程中提供额外的参数: + +``` +$ git cm "A nice commit message" +[branch1 0baa729] A nice commit message + 1 file changed, 2 insertions(+) +``` + +#### 5、Git 远程仓库 + +`git remote -v` 命令列出了所有配置的远程仓库。用别名 `rv` 将其缩短: + +``` +$ git config --global alias.rv 'remote -v' +``` + +#### 6、Git 差异 + +`git diff` 命令可以显示不同提交的文件之间的差异,或者提交和工作树之间的差异。用 `d` 别名来简化它: + +``` +$ git config --global alias.d 'diff' +``` + +标准的 `git diff` 命令对小的改动很好用,但对于比较复杂的改动,外部工具如 `vimdiff` 就更有用。创建别名 `dv` 来使用 `vimdiff` 显示差异,并使用 `y` 参数跳过确认提示: + +``` +$ git config --global alias.dv 'difftool -t vimdiff -y' +``` + +使用这个别名来显示两个提交之间的 `file1` 差异: + +``` +$ git dv 33559c5 ca1494d file1 +``` + +![vim-diff results][5] + +#### 7、Git 配置列表 + +`gl` 别名可以更方便地列出所有用户配置: + +``` +$ git config --global alias.gl 'config --global -l' +``` + +现在你可以看到所有定义的别名(和其他配置选项): + +``` +$ git gl +user.name=ricardo +user.email=ricardo@example.com +alias.p=push +alias.st=status -sb +alias.ll=log --oneline +alias.last=log -1 HEAD --stat +alias.cm=commit -m +alias.rv=remote -v +alias.d=diff +alias.dv=difftool -t vimdiff -y +alias.gl=config --global -l +alias.se=!git rev-list --all | xargs git grep -F +``` + +#### 8、搜索提交 + +Git 别名允许你定义更复杂的别名,比如执行外部 shell 命令,可以在别名前加上 `!` 字符。你可以用它来执行自定义脚本或更复杂的命令,包括 shell 管道。 + +例如,定义 `se` 别名来搜索你的提交: + +``` +$ git config --global alias.se '!git rev-list --all | xargs git grep -F' +``` + +使用这个别名来搜索提交中的特定字符串: + +``` +$ git se test2 +0baa729c1d683201d0500b0e2f9c408df8f9a366:file1:test2 +ca1494dd06633f08519ec43b57e25c30b1c78b32:file1:test2 +``` + +### 自动更正你的别名 + +使用 Git 别名的一个很酷的好处是它与自动更正功能的原生集成。如果你犯了错误,默认情况下,Git 会建议使用与你输入的命令相似的命令,包括别名。例如,如果你把 `status` 打成了 `ts`,而不是 `st`,Git 会推荐正确的别名: + +``` +$ git ts +git: 'ts' is not a git command. See 'git --help'. + +The most similar command is +        st +``` + +如果你启用了自动更正功能,Git 会自动执行正确的命令: + +``` +$ git config --global help.autocorrect 20 +$ git ts +WARNING: You called a Git command named 'ts', which does not exist. +Continuing in 2.0 seconds, assuming that you meant 'st'. +## branch1 +?? test4 +``` + +### 优化 Git 命令 + +Git 别名是一个很有用的功能,它可以优化常见的重复性命令的执行,从而提高你的效率。Git 允许你定义任意数量的别名,有些用户会定义很多别名。我更喜欢只为最常用的命令定义别名 —— 定义太多别名会让人难以记忆,而且可能需要查找才能使用。 + +更多关于别名的内容,包括其他有用的内容,请参见 [Git 维基的别名页面][7]。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/11/git-aliases + +作者:[Ricardo Gerardi][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/rgerardi +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/terminal_command_linux_desktop_code.jpg?itok=p5sQ6ODE (Terminal command prompt on orange background) +[2]: https://linux.cn/article-12894-1.html +[3]: mailto:ricardo@example.com +[4]: https://git-scm.com/book/en/v2/Git-Basics-Git-Aliases +[5]: https://opensource.com/sites/default/files/uploads/vimdiff.png (vim-diff results) +[6]: https://creativecommons.org/licenses/by-sa/4.0/ +[7]: https://git.wiki.kernel.org/index.php/Aliases diff --git a/published/20201130 Journal five minutes a day with Jupyter.md b/published/20201130 Journal five minutes a day with Jupyter.md new file mode 100644 index 0000000000..d30d609646 --- /dev/null +++ b/published/20201130 Journal five minutes a day with Jupyter.md @@ -0,0 +1,151 @@ +[#]: collector: (lujun9972) +[#]: translator: (wxy) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12887-1.html) +[#]: subject: (Journal five minutes a day with Jupyter) +[#]: via: (https://opensource.com/article/20/11/daily-journal-jupyter) +[#]: author: (Moshe Zadka https://opensource.com/users/moshez) + +每天用 Jupyter 写 5 分钟的日记 +====== + +> 用 Jupyter 和 Python 在你的日常写作背后实现一些自动化。 + +![](https://img.linux.net.cn/data/attachment/album/202012/05/131314woxpksatp2toe7tz.jpg) + +有些人会遵循传统,制定一年的计划。不过,一年的时间很长,所以我以季节性的主题或轨迹来规划。每个季度,我都会坐下来,看看即将到来的三个月的季节,并决定在这段时间里我将努力做什么。 + +对于我最新的主题,我决定要每天写一篇日记。我喜欢有明确的承诺,所以我承诺每天写 5 分钟。我也喜欢有可观察的承诺,哪怕只是对我而言,所以我把我的记录放在 Git 里。 + +我决定在写日记的过程中实现一些自动化,于是我使用了我最喜欢的自动化工具:[Jupyter][2]。Jupyter 有一个有趣的功能 [ipywidgets][3],这是一套用于 Jupyter Notebooks、JupyterLab 和 IPython 内核的交互式 HTML 组件。 + +如果你想跟着本文的代码走,请注意,让你的 JupyterLab 实例支持组件可能有点复杂,请按照[这些说明][4]来进行设置。 + +### 导入 ipywidgets 模块 + +首先,你需要导入一堆东西,比如 ipywidgets 和 [Twisted][5]。Twisted 模块可以用来创建一个异步时间计数器: + +``` +import twisted.internet.asyncioreactor +twisted.internet.asyncioreactor.install() +from twisted.internet import reactor, task +import ipywidgets, datetime, subprocess, functools, os +``` + +### 设置定时条目 + +用 Twisted 实现时间计数器是利用了 `task.LoopingCall`。然而,结束循环调用的唯一方法是用一个异常。倒计时时钟总会停止,所以你需要一个自定义的异常来指示“一切正常;计数器结束”: + +``` +class DoneError(Exception): +    pass +``` + +现在你已经写好了异常,你可以写定时器了。第一步是创建一个 `ipywidgets.Label` 的文本标签组件。循环使用 `divmod` 计算出分和秒,然后设置标签的文本值: + +``` +def time_out_counter(reactor): + label = ipywidgets.Label("Time left: 5:00") + current_seconds = datetime.timedelta(minutes=5).total_seconds() + def decrement(count): + nonlocal current_seconds + current_seconds -= count + time_left = datetime.timedelta(seconds=max(current_seconds, 0)) + minutes, left = divmod(time_left, minute) + seconds = int(left.total_seconds()) + label.value = f"Time left: {minutes}:{seconds:02}" + if current_seconds < 0: + raise DoneError("finished") + minute = datetime.timedelta(minutes=1) + call = task.LoopingCall.withCount(decrement) + call.reactor = reactor + d = call.start(1) + d.addErrback(lambda f: f.trap(DoneError)) + return d, label +``` + +### 从 Jupyter 组件中保存文本 + +下一步是写一些东西,将你输入的文字保存到一个文件中,并提交到 Git。另外,由于你要写 5 分钟的日记,你需要一个能给你提供写字区域的组件(滚动肯定是可以的,但一次能看到更多的文字就更好了)。 + +这就用到了组件 `Textarea`,这是一个你可以书写的文本字段,而 `Output` 则是用来给出反馈的。这一点很重要,因为 `git push` 可能会花点时间或失败,这取决于网络。如果备份失败,用反馈提醒用户很重要: + +``` +def editor(fname): +    textarea = ipywidgets.Textarea(continuous_update=False) +    textarea.rows = 20 +    output = ipywidgets.Output() +    runner = functools.partial(subprocess.run, capture_output=True, text=True, check=True) +    def save(_ignored): +        with output: +            with open(fname, "w") as fpout: +                fpout.write(textarea.value) +            print("Sending...", end='') +            try: +                runner(["git", "add", fname]) +                runner(["git", "commit", "-m", f"updated {fname}"]) +                runner(["git", "push"]) +            except subprocess.CalledProcessError as exc: +                print("Could not send") +                print(exc.stdout) +                print(exc.stderr) +            else: +                 print("Done") +    textarea.observe(save, names="value") +    return textarea, output, save +``` + +`continuous_update=False` 是为了避免每个字符都保存一遍并发送至 Git。相反,只要脱离输入焦点,它就会保存。这个函数也返回 `save` 函数,所以可以明确地调用它。 + +### 创建一个布局 + +最后,你可以使用 `ipywidgets.VBox` 把这些东西放在一起。这是一个包含一些组件并垂直显示的东西。还有一些其他的方法来排列组件,但这足够简单: + +``` +def journal(): +    date = str(datetime.date.today()) +    title = f"Log: Startdate {date}" +    filename = os.path.join(f"{date}.txt") +    d, clock = time_out_counter(reactor) +    textarea, output, save = editor(filename) +    box = ipywidgets.VBox([ +        ipywidgets.Label(title), +        textarea, +        clock, +        output +    ]) +    d.addCallback(save) +    return box +``` + +biu!你已经定义了一个写日记的函数了,所以是时候试试了。 + +``` +journal() +``` + +![Jupyter journal][6] + +你现在可以写 5 分钟了! + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/11/daily-journal-jupyter + +作者:[Moshe Zadka][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/moshez +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/tea-cup-mug-flowers-book-window.jpg?itok=JqThhl51 (Ceramic mug of tea or coffee with flowers and a book in front of a window) +[2]: https://jupyter.org/ +[3]: https://ipywidgets.readthedocs.io/en/latest/ +[4]: https://ipywidgets.readthedocs.io/en/latest/user_install.html +[5]: https://twistedmatrix.com/trac/ +[6]: https://opensource.com/sites/default/files/uploads/journaling_output_13_0.png (Jupyter journal) +[7]: https://creativecommons.org/licenses/by-sa/4.0/ diff --git a/published/20201201 How this open source security tool halted significant DDoS attacks.md b/published/20201201 How this open source security tool halted significant DDoS attacks.md new file mode 100644 index 0000000000..13224450d9 --- /dev/null +++ b/published/20201201 How this open source security tool halted significant DDoS attacks.md @@ -0,0 +1,69 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12897-1.html) +[#]: subject: (How this open source security tool halted significant DDoS attacks) +[#]: via: (https://opensource.com/article/20/12/open-source-vs-ddos-attacks) +[#]: author: (Philippe Humeau https://opensource.com/users/philippe-humeau) + +如何在 1 分钟内阻止 7000 台机器的僵尸网络 +====== + +> 对 CrowdSec 的配置更改,在不到一分钟的时间内阻止了一个 7000 台机器的僵尸网络的攻击。 + +![](https://img.linux.net.cn/data/attachment/album/202012/07/220444x6kaedeu6ko0e7uo.jpg) + +2020 年,我们的生活和工作方式在短短几天内被彻底颠覆。随着 COVID-19 开始在全球范围内蔓延,我们将工作带回家,与同事、朋友和家人保持在线联系成为关键的必需品。这为黑客造成破坏打开了大门。例如,根据 Neustar 的数据,今年上半年全球的分布式拒绝服务(DDOS) 攻击[增长了 151%][2]。 + +[CrowdSec][3] 是一个开源的安全引擎,它可以分析访问者的行为,并提供适应各种攻击的响应。它能解析来自各种来源的日志,并应用启发式方案来识别攻击性行为,并防范大多数攻击类别。并且,它与其它安装的 CrowdSec 系统共享该情报。每次 IP 地址被阻止时,它都会通知整个用户社区。这就创建了一个[实时、协作的 IP 信誉数据库][4],利用人群的力量使互联网更加安全。 + +### CrowdSec 如何工作:案例研究 + +Sorf Networks 是一家总部位于土耳其的技术公司,为客户提供高配置的托管服务器和 DDoS 防护解决方案,它提供了一个 CrowdSec 工作的例子。Sorf 的一个客户每天都会遇到来自 1 万多台机器僵尸网络的 DDoS 攻击,并努力寻找一种能够满足技术要求的解决方案来及时处理这些攻击。 + +虽然客户采取了一般的预防措施来缓解这些攻击,比如引入 JavaScript(JS)挑战challenges、限速等,但这些措施在整个攻击面并不可行。一些 URL 需要被非常基本的软件使用,而这些软件不支持 JS 挑战。黑客就是黑客,这正是他们每天的目标:链条上最薄弱的环节。 + +Sorf Networks 首先使用 [Fail2ban][5](这启发了 CrowdSec)为其客户建立了一个 DDoS 缓解策略。它在一定程度上帮助了客户,但它太慢了。它需要 50 分钟来处理日志和处理 7000 到 10000 台机器的 DDoS 攻击。这使得它在这种情况下没有效果。另外,因为它没有禁止 IP,日志会持续堆积,它需要每秒处理几千条日志,这是不可能的。 + +在使用租用的僵尸网络进行的 DDoS 测试中,一次攻击可以高达每秒 6700 个左右的请求,这些请求来自 8600 个独立 IP。这是对一台服务器流量的捕捉: + +![Server traffic][6] + +虽然 CrowdSec 技术可以应对巨大的攻击,但其默认设置每秒只能处理约 1000 个端点。Sorf 需要一个量身定做的配置来处理单台机器上这么多的流量。 + +Sorf 的团队对 CrowdSec 的配置进行了修改,以显著提高其吞吐量来处理日志。首先,它去掉了高消耗且非关键的富集enrichment解析器,例如 [GeoIP 富集][7]。它还将允许的 goroutine 的默认数量从一个增加到五个。之后,团队又用 8000 到 9000 台主机做了一次实测,平均每秒 6000 到 7000 个请求。这个方案是有代价的,因为 CrowdSec 在运行过程中吃掉了 600% 的 CPU,但其内存消耗却保持在 270MB 左右。 + +然而,结果却显示出明显的成功: + + * 在一分钟内,CrowdSec 能够处理所有的日志 + * 95% 的僵尸网络被禁止,攻击得到有效缓解 + * 15 个域现在受到保护,不受 DDoS 攻击 + +根据 Sorf Networks 的总监 Cagdas Aydogdu 的说法,CrowdSec 的平台使团队“能够在令人难以置信的短时间内提供一个世界级的高效防御系统”。 + +* * * + +本文改编自[如何用 CrowdSec 在 1 分钟内阻止 7000 台机器的僵尸网络][8],原载于 CrowdSec 网站。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/12/open-source-vs-ddos-attacks + +作者:[Philippe Humeau][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/philippe-humeau +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/security_password_chaos_engineer_monster.png?itok=J31aRccu (Security monster) +[2]: https://www.businesswire.com/news/home/20200916005046/en/DDoS-Attacks-Increase-by-151-in-First-Half-Of-2020 +[3]: https://crowdsec.net/ +[4]: https://opensource.com/article/20/10/crowdsec +[5]: https://www.fail2ban.org +[6]: https://opensource.com/sites/default/files/uploads/crowdsec_servertraffic.png (Server traffic) +[7]: https://hub.crowdsec.net/author/crowdsecurity/configurations/geoip-enrich +[8]: https://crowdsec.net/2020/10/21/how-to-stop-a-botnet-with-crowdsec/ diff --git a/published/20201201 Try Jed as your Linux terminal text editor.md b/published/20201201 Try Jed as your Linux terminal text editor.md new file mode 100644 index 0000000000..b4197674e1 --- /dev/null +++ b/published/20201201 Try Jed as your Linux terminal text editor.md @@ -0,0 +1,115 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12901-1.html) +[#]: subject: (Try Jed as your Linux terminal text editor) +[#]: via: (https://opensource.com/article/20/12/jed) +[#]: author: (Seth Kenlon https://opensource.com/users/seth) + +尝试将 Jed 作为你的 Linux 终端文本编辑器 +====== + +> Jed 方便的下拉菜单,让新用户可以轻松地使用终端文本编辑器。 + +![](https://img.linux.net.cn/data/attachment/album/202012/09/085456f7fmt74eu6eekpmt.jpg) + +你可能听说过 Emacs、Vim 和 Nano 这些典型的 Linux 文本编辑器,但 Linux 有大量的开源文本编辑器,我的目标是在 12 月份对其中的 31 个文本编辑器进行一次公平的测试。 + +在这篇文章中,我将介绍 [Jed][2],它是一个基于终端的编辑器,它的特点是有一个方便的下拉菜单,这让那些刚刚接触终端编辑器的用户,以及那些不喜欢记住每个功能的组合键的用户而言变得特别容易。 + +### 安装 Jed + +在 Linux 上,你的发行版软件仓库可能会让 Jed 通过你的软件包管理器安装: + +``` +$ sudo dnf install jed +``` + +并不是所有发行版都是如此,但它是一个很容易从源码编译的应用。首先,下载 [S 语言][3](Jed 的编写语言)并安装(其中 `x.y.z` 请替换为对应的版本号): + +``` +$ wget https://www.jedsoft.org/releases/slang/slang-x.y.z.tar.bz2 +$ tar xvf slang*bz2 +$ cd slang-x.y.z +$ ./configure ; make +$ sudo make install +``` + +安装好后,对 [Jed 源码][4]也同样操作(其中 `x.y.z` 请替换为对应的版本号): + +``` +$ wget https://www.jedsoft.org/releases/jed/jed-x.y.z.tar.bz2 +$ tar xvf jed*bz2 +$ cd jed-x.y.z +$ ./configure ; make +$ sudo make install +``` + +### 启动 Jed + +Jed 在终端中运行,所以要启动它,只需打开终端,输入 `jed`: + +``` +F10 key ==> File Edit Search Buffers Windows System Help + + + This is a scratch buffer. It is NOT saved when you exit. + + To access the menus, press F10 or ESC-m and the use the arrow + keys to navigate. + + Latest version information is available on the web from + . Other sources of JED + information include the usenet newsgroups comp.editors and + alt.lang.s-lang. To subscribe to the jed-users mailing list, see + . + + Copyright (C) 1994, 2000-2009 John E. Davis + Email comments or suggestions to . + +[ (Jed 0.99.19U) Emacs: *scratch* () 1/16 8:49am ] +``` + +### 如何使用 Jed + +Jed 自动加载的说明很清晰且很有帮助。你可以按 `F10` 键或 `Esc` 键,然后按字母 `M` 进入顶部菜单。这将使你的光标进入 Jed 顶部的菜单栏,但它不会打开菜单。要打开菜单,请按键盘上的回车键。使用方向键来浏览每个菜单。 + +屏幕上的菜单不仅对初次使用的用户很有帮助,对有经验的用户来说,它还提供了很好的键盘快捷键提醒。例如,你大概能猜到如何保存正在处理的文件。进入 **File** 菜单,选择 **Save**。如果你想加快这个过程,你可以记住 `Ctrl+X`,然后 `Ctrl+S` 的组合键(是的,这是连续的两个组合键)。 + +### 探索 Jed 的功能 + +对于一个简单的编辑器来说,Jed 拥有一系列令人惊讶的实用功能。它有一个内置的多路复用器,允许你同时打开多个文件,但它会“叠”在另一个文件之上,所以你可以在它们之间切换。你可以分割你的 Jed 窗口,让多个文件同时出现在屏幕上,改变你的颜色主题,或者打开一个 shell。 + +对于任何有 Emacs 使用经验的人来说,Jed 的许多“没有宣传”的功能,例如用于导航和控制的组合键,都是一目了然的。然而,当一个组合键与你所期望的大相径庭时,就会有一个轻微的学习(或者说没有学习)曲线。例如,GNU Emacs 中的 `Alt+B` 可以将光标向后移动一个字,但在 Jed 中,默认情况下,它是 **Buffers** 菜单的快捷键。这让我措手不及,大约本文每句话都遇到一次。 + +![Jed][8] + +Jed 也有**模式**,允许你加载模块或插件来帮助你编写特定种类的文本。例如,我使用默认的 text 模式写了这篇文章,但当我在编写 [Lua][9] 时,我能够切换到 lua 模式。这些模式提供语法高亮,并帮助匹配括号和其他分隔符。你可以在 `/usr/share/jed/lib` 中查看 Jed 捆绑了哪些模式,而且因为它们是用 S 语言编写的,你可以浏览代码,并可能学习一种新的语言。 + +### 尝试 Jed + +Jed 是一个令人愉快且清新的 Linux 终端文本编辑器。它轻量级,易于使用,设计相对简单。作为 Vi 的替代方案,你可以在你的 `~/.bashrc` 文件中(如果你是 root 用户,在 root 用户的 `~/.bashrc` 文件中)将 Jed 设置为 `EDITOR` 和 `VISUAL` 变量。今天就试试 Jed 吧。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/12/jed + +作者:[Seth Kenlon][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/seth +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/laptop_screen_desk_work_chat_text.png?itok=UXqIDRDD (Person using a laptop) +[2]: https://www.jedsoft.org/jed +[3]: https://www.jedsoft.org/releases/slang/ +[4]: https://www.jedsoft.org/releases/jed +[5]: http://www.jedsoft.org/jed/\> +[6]: http://www.jedsoft.org/jed/mailinglists.html\> +[7]: mailto:jed@jedsoft.org +[8]: https://opensource.com/sites/default/files/jed.png (Jed) +[9]: https://opensource.com/article/20/2/lua-cheat-sheet diff --git a/published/20201201 Zotero- An Open Source App to Help You Collect - Share Research.md b/published/20201201 Zotero- An Open Source App to Help You Collect - Share Research.md new file mode 100644 index 0000000000..b07ffa5d81 --- /dev/null +++ b/published/20201201 Zotero- An Open Source App to Help You Collect - Share Research.md @@ -0,0 +1,109 @@ +[#]: collector: (lujun9972) +[#]: translator: (geekpi) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12905-1.html) +[#]: subject: (Zotero: An Open Source App to Help You Collect & Share Research) +[#]: via: (https://itsfoss.com/zotero/) +[#]: author: (Ankush Das https://itsfoss.com/author/ankush/) + +Zotero:一款帮助你收集和分享研究成果的开源应用 +====== + +> Zotero 是一款令人印象深刻的自由开源的应用,它让你可以收集、组织、引用和共享研究成果。你还可以使用 Zotero 为你的文档即时创建参考文献和书目。 + +![](https://img.linux.net.cn/data/attachment/album/202012/09/213010i6o78b6y5gifyjtf.jpg) + +通常,你可以[使用 Linux 上任何一款笔记应用][1]来收集和分享你的想法。但是,在这里,我想分享一些专门为你量身定做的东西,来帮助你收集、整理和分享你的研究成果,即 [Zotero][2]。 + +### Zotero:收集、整理和分享研究成果 + +![][3] + +Zotero 是一个完全开源的项目,你可以在 [GitHub][4] 上找到它。它的目的是帮助你轻松地收集、整理、添加笔记和分享你的研究成果。 + +而且,这一切都不需要基于云端的服务,它是完全离线的。所以,你的研究成果是属于你的。当然,除非你出于协作目的想将其同步,为此你可能需要参考[该文档][5]。 + +作为一个好的起点,你可以选择 [WebDAV 存储][6],或者直接创建一个 Zotero 帐户来轻松同步和分享你的研究成果。 + +例如,我创建了一个名为 `ankush9` 的 Zotero 账户,你可以在 找到我的研究合集(我添加到我的出版物中)。 + +![][7] + +这使得它很容易分享你组织的研究成果,你可以选择将哪些部分共享到出版物中。 + +让我着重介绍一下 Zotero 的主要功能,来帮助你决定是否需要尝试一下。 + +### Zotero 的功能 + +![][8] + + * 能够使用浏览器插件从网页直接添加信息 + * 为每份资料添加说明 + * 支持添加标签 + * 支持添加语音记录 + * 添加视频作为附件 + * 添加软件作为附件 + * 将电子邮件作为附件 + * 将播客作为附件 + * 添加博客文章 + * 添加一个文件链接 + * 根据项目建立书目 + * 离线快照存储(无需连接互联网即可访问保存的网页) + * 可以复制项目 + * 整理库中的项目 + * 提供了一个垃圾箱,可以删除你的项目,并在需要时轻松恢复。 + * 支持同步 + * 支持数据导出 + * 可整合 LibreOffice 插件 + * 使用你的 Zotero 个人资料链接轻松分享你的研究笔记。 + * 跨平台支持 + +如果你只是想快速创建书目,你可以尝试他们的另一个工具,[ZoteroBib][9]。 + +### 在 Linux 上安装 Zotero + +![][12] + +它适用于 Windows、macOS 和 Linux。对于 Linux,如果你使用的是基于 Ubuntu 的发行版(或 Ubuntu 本身),你可以下载一个 deb 文件(由第三方维护)并安装它。 + +安装 [deb 文件][13]很简单,它在 Pop OS 20.04 上工作得很好。如果你使用的是其他 Linux 发行版,你可以[解压 tar 包][14]并进行安装。 + +你可以按照[官方安装说明][15]来找到合适的方法。 + +- [下载 Zotero][2] + +### 总结 + +它有大量的功能,你可以组织、分享、引用和收集资源,以供你进行搜索。由于支持音频、视频、文本和链接,它应该适合几乎所有的东西。 + +当然,我会将它推荐给有经验的用户,让它发挥最大的作用。而且,如果你之前使用过树状图(思维导图)笔记工具的人,你就知道要做什么了。 + +你觉得 Zotero 怎么样?如果它不适合你,你有更好的替代品建议么?请在下面的评论中告诉我你的想法。 + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/zotero/ + +作者:[Ankush Das][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://itsfoss.com/author/ankush/ +[b]: https://github.com/lujun9972 +[1]: https://itsfoss.com/note-taking-apps-linux/ +[2]: https://www.zotero.org/ +[3]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/11/zotero-app.png?resize=800%2C481&ssl=1 +[4]: https://github.com/zotero/zotero +[5]: https://www.zotero.org/support/ +[6]: https://en.wikipedia.org/wiki/WebDAV +[7]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/11/zotero-online-publication.jpg?resize=800%2C600&ssl=1 +[8]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/11/zotero-extension.jpg?resize=800%2C414&ssl=1 +[9]: https://zbib.org/ +[12]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/11/zotero-preferences.png?resize=800%2C489&ssl=1 +[13]: https://itsfoss.com/install-deb-files-ubuntu/ +[14]: https://en.wikipedia.org/wiki/Tarball +[15]: https://www.zotero.org/support/installation diff --git a/published/20201202 How to Add Third-Party Repositories in Fedora and Get Access to a Huge Number of Additional Software.md b/published/20201202 How to Add Third-Party Repositories in Fedora and Get Access to a Huge Number of Additional Software.md new file mode 100644 index 0000000000..198b496a83 --- /dev/null +++ b/published/20201202 How to Add Third-Party Repositories in Fedora and Get Access to a Huge Number of Additional Software.md @@ -0,0 +1,118 @@ +[#]: collector: (lujun9972) +[#]: translator: (robsean) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12898-1.html) +[#]: subject: (How to Add Third-Party Repositories in Fedora and Get Access to a Huge Number of Additional Software) +[#]: via: (https://itsfoss.com/fedora-third-party-repos/) +[#]: author: (John Paul https://itsfoss.com/author/john/) + +如何在 Fedora 中添加第三方存储库以访问大量附加软件 +====== + +![](https://img.linux.net.cn/data/attachment/album/202012/08/074323tkjpr2499rtjnjq0.jpg) + +在你安装 Fedora 后。你可能会发现你想要安装和使用的一些软件在软件商店中找不到。出于一些原因,这些软件包不能出现在 Fedora 存储库中。 + +不用担心,我将告诉你如何为 Fedora 添加第三方存储库来使这些软件包可使用。 + +### 在 Fedora 中的第三方存储库是什么? + +操作系统开发人员通常会决定哪些软件包可以在其存储库中使用,哪些软件包不可以在其存储库中使用。Fedora 也是如此。依据 [Fedora 文档][1] ,第三方存储库包含有 “拥有更为宽松的许可政策,并提供 Fedora 因各种原因所排除软件包” 的软件包。 + +Fedora 强制执行下面的 [准则][2] ,当它打包软件包时: + + * 如果它是专有的,它就不能包含在 Fedora 中 + * 如果它在法律上被限制,它就不能包含在 Fedora 中 + * 如果它违反美国法律(特别是联邦政府或适用于州政府的法律),它就不能包含在 Fedora 中 + +因此,有一些可以由用户自行添加的存储库。这使得用户能够访问附加的软件包。 + +### 在 Fedora 中启用 RPM Fusion 存储库 + +[RPM Fusion][3] 是 Fedora 的第三方应用程序的主要来源。RPM Fusion 是由三个项目(Dribble、Freshrpms 和 Livna)合并而成的。RPM Fusion 提供两种不同的软件存储库。 + + * free 存储库:包含开源软件。 + * nonfree 存储库:包含没有开源协议的软件,但是它们的源文件代码却是可以自由使用的。 + +这里有两种方法来启动 RPM Fusion:从终端启用,或通过点击几个按钮来启用。我们将逐一查看。 + +#### 方法 1:命令行方法 + +这是启用 RPM Fusion 存储库的最简单的方法。只需要输入下面的命令即可启用两个存储库: + +``` +sudo dnf install https://mirrors.rpmfusion.org/free/fedora/rpmfusion-free-release-$(rpm -E %fedora).noarch.rpm https://mirrors.rpmfusion.org/nonfree/fedora/rpmfusion-nonfree-release-$(rpm -E %fedora).noarch.rpm +``` + +会要求你输入密码、确认是否你想要安装这些存储库。在你确认后,安装过程将在几秒钟或几分钟内完成。 + +![通过命令行安装 RPM Fusion][4] + +#### 方法 2:图形用户界面方法 + +使用这个方法来启用 RPM Fusion 存储库,你需要访问 [RPM Fusion 网站][5] 。你将看到针对不同 Fedora 版本的两个存储库的链接。 + +RPM Fusion 建议先安装 free 存储库。因此,单击针对你 Fedora 版本的 free 存储库的链接。然后会打开一个窗口来询问你是否想安装该存储库。单击安装。 + +![通过图形用户界面安装 RPM Fusion][6] + +在安装过程完成后,返回并使用相同的步骤安装 nonfree 存储库。 + +### 启用 Fedora 的第三方存储库 + +Fedora 最近开始提供它自己的 [第三方应用程序存储库][7] 。在这个存储库中 [可使用的应用程序的数量][8] 是非常少的。你可以 [使用它来在 Fedora 上安装 Chrome 浏览器][9] 。除 Chrome 外,它也包含 Adobe Brackets、Atom、Steam、Vivaldi、Opera 等应用程序。 + +就像 RPM Fusion 一样,你可以通过终端或图形用户界面的方法来启用这个存储库。 + +#### 方法 1:命令行方法 + +为启用 Fedora 的第三方存储库,输入下面的命令到你的终端中: + +``` +sudo dnf install fedora-workstation-repositories +``` + +当被提示时,确保输入你的密码并输入 `Y` 来确认安装。 + +#### 方法 2:图形用户界面方法 + +如果你不习惯使用终端,你可以使用图形用户界面方法。 + +首先,你需要打开 Gnome “软件”。接下来,你需要单击右上角的汉堡菜单,并从菜单中选择“软件存储库”。 + +![Gnome 软件的菜单][10] + +在软件存储库窗口中,你将在其顶部看到写着 “第三方存储库” 字样的部分。单击“安装”按钮。当你被提示时,输入你的密码。 + +![Fedora 第三方存储库安装][11] + +随着这些附加存储库的启用,你可以安装软件到你的系统当中。你可以从软件中心管理器或使用 DNF 软件包管理器来轻松地安装它们。 + +如果你发现这篇文章很有趣,请花费一些时间来在社交媒体上分享它。 + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/fedora-third-party-repos/ + +作者:[John Paul][a] +选题:[lujun9972][b] +译者:[robsean](https://github.com/robsean) +校对:[wxy](https://github.com/wxy) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://itsfoss.com/author/john/ +[b]: https://github.com/lujun9972 +[1]: https://docs.fedoraproject.org/en-US/quick-docs/setup_rpmfusion/#third-party-repositories +[2]: https://fedoraproject.org/wiki/Forbidden_items +[3]: https://rpmfusion.org/RPM%20Fusion +[4]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/11/install-rpmfusion-cli.png?resize=800%2C604&ssl=1 +[5]: https://rpmfusion.org/Configuration +[6]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/11/install-rpmfusion-gui.png?resize=800%2C582&ssl=1 +[7]: https://fedoraproject.org/wiki/Workstation/Third_Party_Software_Repositories +[8]: https://fedoraproject.org/wiki/Workstation/Third_party_software_list +[9]: https://itsfoss.com/install-google-chrome-fedora/ +[10]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/11/software-meni.png?resize=800%2C672&ssl=1 +[11]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/11/fedora-third-party-repo-gui.png?resize=746%2C800&ssl=1 +[12]: https://%0Areddit.com/r/linuxusersgroup diff --git a/published/20201203 Download the 2020 Linux Foundation Annual Report.md b/published/20201203 Download the 2020 Linux Foundation Annual Report.md new file mode 100644 index 0000000000..a7ecaa4c55 --- /dev/null +++ b/published/20201203 Download the 2020 Linux Foundation Annual Report.md @@ -0,0 +1,73 @@ +[#]: collector: (lujun9972) +[#]: translator: (wxy) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-12889-1.html) +[#]: subject: (Download the 2020 Linux Foundation Annual Report) +[#]: via: (https://www.linux.com/news/download-the-2020-linux-foundation-annual-report/) +[#]: author: (The Linux Foundation https://www.linuxfoundation.org/blog/2020/12/download-the-2020-linux-foundation-annual-report/) + +下载 2020 年度 Linux 基金会年度报告 +====== + +![][1] + +2020 年对于 Linux 基金会Linux Foundation(LF)和我们托管的社区来说,是充满挑战的一年。在这次大流行期间,我们都看到我们和世界各地许多同事、朋友和家人的日常生活完全改变了。在我们的社区中,有太多的人也为失去家人和朋友而悲痛。 + +看到 LF 的成员加入到对抗 COVID-19 的斗争中,令人振奋。我们在世界各地的成员为科研人员贡献了技术资源,为挣扎中的家庭和个人提供了援助,为国家和国际努力做出了贡献,有些人甚至一起在 [LF 公共卫生][3] 下创建了开源项目,以帮助各国应对这场大流行病。 + +今年,我们的项目社区在继续发展,在许多开放技术领域、开放标准、开放数据和开放硬件方面都有新的举措。今年,我们迎接了 150 多个新社区加入 LF,包括 [FINOS 基金会][4],它是开源金融服务项目的保护项目。 + +我们的 [活动团队][5] 不得不进行了重大转型,在几周内,从面对面的活动转变为虚拟活动,参与者从不足 100 人到数万人不等。这些虚拟聚会帮助我们社区中的许多人在这个困难时期建立了联系。我们也学到了很多关于未来可能通过提供虚拟体验的混合亲身活动hybrid in-person events来提供更具包容性的体验。今年,我们很想念在我们的社区中见到的许多朋友,并期待着在安全的情况下再次见到你们。 + +我们的 [培训和认证][6] 团队能够帮助 170 多万名报名参加我们免费培训课程的人。我要祝贺今年获得 LF 认证的 4 万多人。 + +《[LF 的 2020 年度工作报告][7]》显示,尽管商业环境充满挑战,但经过培训和认证的开源专业人员仍有大有需求,并能轻松地展示其价值。 + +作为我们正在进行的多元化努力的一部分,在加入反对不平等的斗争中,我们的社区专注于该如何在项目中使用语言,并寻找导师来指导下一代的贡献者。我们的社区,如 Linux 内核团队和在北美 KubeCon 上发起的 [包容性命名倡议][8]Inclusive Naming Initiative,在加强我们的互动方式上取得了进展。 + +今年是我们联合发展基金会Joint Development Foundation(JDF)和开放标准社区open standards communities的突破性一年。我们迎来了六个建立开放标准的新项目。[JDF 还被批准为 ISO/IEC JTC 1 公开发布规范(PAS)提交者][9]。今年还标志着我们的第一个开放标准社区 OpenChain 通过 PAS 程序,被正式认可为国际标准。今天,Linux 基金会可以把我们的社区,从开源仓库带到一个公认的全球标准。 + +今年,我们生态系统中的许多人已经站出来帮助安全工作。一个新的社区 [开源安全基金会][10]Open Source Security Foundation(OpenSSF)启动了,以协调专注于提高开源软件安全性的努力。 + +当我们继续在美国与挑战作斗争时,[我们也重申 LF 是全球社区的一部分][11]。 + +我们的成员必须得应对国际贸易政策变化的一年,并了解到开放源码在政治上的蓬勃发展。来自世界各地的我们的成员社区参与了开放合作open collaboration,因为它是开放、中立和透明的。这些参与者显然希望继续与全球同行合作,以应对大大小小的挑战。 + +在这困难的一年结束时,所有这些都让我们确信,开放合作是解决世界上最复杂挑战的模式。没有任何一个人、组织或政府能够单独创造出我们解决最紧迫问题所需的技术。我们代表整个 Linux 基金会团队,期待着帮助您和我们的社区应对接下来的任何挑战。 + +![][12] + +Jim Zemlin,Linux 基金会执行总监 + +- [下载 Linux 基金会 2020 年度报告][2] + +这篇文章首先发布于 [Linux 基金会][14]。 + +-------------------------------------------------------------------------------- + +via: https://www.linux.com/news/download-the-2020-linux-foundation-annual-report/ + +作者:[The Linux Foundation][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.linuxfoundation.org/blog/2020/12/download-the-2020-linux-foundation-annual-report/ +[b]: https://github.com/lujun9972 +[1]: https://www.linuxfoundation.org/wp-content/uploads/2020/12/2020-Linux-Foundation-Annual-Report_blogheader.png +[2]: http://linuxfoundation.org/2020-annual-report +[3]: https://www.lfph.io/ +[4]: https://www.finos.org/ +[5]: https://events.linuxfoundation.org/ +[6]: https://training.linuxfoundation.org/ +[7]: https://training.linuxfoundation.org/resources/2020-open-source-jobs-report/ +[8]: https://inclusivenaming.org/ +[9]: https://www.linuxfoundation.org/blog/2020/05/joint-development-foundation-recognized-as-an-iso-iec-jtc-1-pas-submitter-and-submits-openchain-for-international-review/ +[10]: https://openssf.org/ +[11]: https://www.linuxfoundation.org/blog/2020/08/open-source-collaboration-is-a-global-endeavor/ +[12]: https://www.linuxfoundation.org/wp-content/uploads/2020/12/JimZemlin_Sig-150x150.png +[13]: https://www.linuxfoundation.org/blog/2020/12/download-the-2020-linux-foundation-annual-report/ +[14]: https://www.linuxfoundation.org/ diff --git a/sources/news/20200130 NSA cloud advice, Facebook open source year in review, and more industry trends.md b/sources/news/20200130 NSA cloud advice, Facebook open source year in review, and more industry trends.md deleted file mode 100644 index 7a3a40d845..0000000000 --- a/sources/news/20200130 NSA cloud advice, Facebook open source year in review, and more industry trends.md +++ /dev/null @@ -1,71 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: ( ) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (NSA cloud advice, Facebook open source year in review, and more industry trends) -[#]: via: (https://opensource.com/article/20/1/nsa-facebook-more-industry-trends) -[#]: author: (Tim Hildred https://opensource.com/users/thildred) - -NSA cloud advice, Facebook open source year in review, and more industry trends -====== -A weekly look at open source community and industry trends. -![Person standing in front of a giant computer screen with numbers, data][1] - -As part of my role as a senior product marketing manager at an enterprise software company with an open source development model, I publish a regular update about open source community, market, and industry trends for product marketers, managers, and other influencers. Here are five of my and their favorite articles from that update. - -## [Facebook open source year in review][2] - -> Last year was a busy one for our [open source][3] engineers. In 2019 we released 170 new open source projects, bringing our portfolio to a total of 579 [active repositories][3]. While it’s important for our internal engineers to contribute to these projects (and they certainly do — with more than 82,000 commits this year), we are also incredibly grateful for the massive support from external contributors. Approximately 2,500 external contributors committed more than 32,000 changes. In addition to these contributions, nearly 93,000 new people starred our projects this year, growing the most important component of any open source project — the community! Facebook Open Source would not be here without your contributions, so we want to thank you for your participation in 2019. - -**The impact**: Facebook got ~33% more changes than they would have had they decided to develop these as closed projects. Organizations addressing similar challenges got an 82,000-commit boost in exchange. What a clear illustration of the business impact of open source development. - -## [Cloud advice from the NSA][4] - -> This document divides cloud vulnerabilities into four classes (misconfiguration, poor access control, shared tenancy vulnerabilities, and supply chain vulnerabilities) that encompass the vast majority of known vulnerabilities. Cloud customers have a critical role in mitigating misconfiguration and poor access control, but can also take actions to protect cloud resources from the exploitation of shared tenancy and supply chain vulnerabilities. Descriptions of each vulnerability class along with the most effective mitigations are provided to help organizations lock down their cloud resources. By taking a risk-based approach to cloud adoption, organizations can securely benefit from the cloud’s extensive capabilities. - -**The impact**: The Fear, Uncertainty, and Doubt (FUD) that has been associated with cloud adoption is being debunked more all the time. None other then the US Department of Defense has done a lot of the thinking so you don't have to, and there is a good chance that their concerns are at least as dire as yours are. - -## [With Kubernetes, China Minsheng Bank transformed its legacy applications][5] - -> But all of CMBC’s legacy applications—for example, the core banking system, payment systems, and channel systems—were written in C and Java, using traditional architecture. “We wanted to do distributed applications because in the past we used VMs in our own data center, and that was quite expensive and with low resource utilization rate,” says Zhang. “Our biggest challenge is how to make our traditional legacy applications adaptable to the cloud native environment.” So far, around 20 applications are running in production on the Kubernetes platform, and 30 new applications are in active development to adopt the Kubernetes platform. - -**The impact**: This illustrates nicely the challenges and opportunities facing businesses in a competitive environment, and suggests a common adoption pattern. Do new stuff the new way, and move the old stuff as it makes sense. - -## [The '5 Rs' of the move to cloud native: Re-platform, re-host, re-factor, replace, retire][6] - -> The bottom line is that telcos and service providers will go cloud native when it is cheaper for them to migrate to the cloud and pay cloud costs than it is to remain in the data centre. That time is now and by adhering to the "5 Rs" of the move to cloud native, Re-platform, Re-host, Re-factor, Replace and/or Retire, the path is open, clearly marked and the goal eminently achievable. - -**The impact**: Cloud-native is basically used as a synonym for open source in this interview; there is no other type of technology that will deliver the same lift. - -## [Fedora CoreOS out of preview][7] - -> Fedora CoreOS is a new Fedora Edition built specifically for running containerized workloads securely and at scale. It’s the successor to both [Fedora Atomic Host][8] and [CoreOS Container Linux][9] and is part of our effort to explore new ways of assembling and updating an OS. Fedora CoreOS combines the provisioning tools and automatic update model of Container Linux with the packaging technology, OCI support, and SELinux security of Atomic Host.  For more on the Fedora CoreOS philosophy, goals, and design, see the [announcement of the preview release][10]. - -**The impact**: Collapsing these two branches of the Linux family tree into one another moves the state of the art forward for everyone (once you get through the migration). - -_I hope you enjoyed this list of what stood out to me from last week and come back next Monday for more open source community, market, and industry trends._ - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/20/1/nsa-facebook-more-industry-trends - -作者:[Tim Hildred][a] -选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]: https://opensource.com/users/thildred -[b]: https://github.com/lujun9972 -[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/data_metrics_analytics_desktop_laptop.png?itok=9QXd7AUr (Person standing in front of a giant computer screen with numbers, data) -[2]: https://opensource.com/article/20/1/hybrid-developer-future-industry-trends -[3]: https://opensource.facebook.com/ -[4]: https://media.defense.gov/2020/Jan/22/2002237484/-1/-1/0/CSI-MITIGATING-CLOUD-VULNERABILITIES_20200121.PDF -[5]: https://www.cncf.io/blog/2020/01/23/with-kubernetes-china-minsheng-bank-transformed-its-legacy-applications-and-moved-into-ai-blockchain-and-big-data/ -[6]: https://www.telecomtv.com/content/cloud-native/the-5-rs-of-the-move-to-cloud-native-re-platform-re-host-re-factor-replace-retire-37473/ -[7]: https://fedoramagazine.org/fedora-coreos-out-of-preview/ -[8]: https://www.projectatomic.io/ -[9]: https://coreos.com/os/docs/latest/ -[10]: https://fedoramagazine.org/introducing-fedora-coreos/ diff --git a/sources/news/20200205 The Y2038 problem in the Linux kernel, 25 years of Java, and other industry news.md b/sources/news/20200205 The Y2038 problem in the Linux kernel, 25 years of Java, and other industry news.md deleted file mode 100644 index 2e814fdfc0..0000000000 --- a/sources/news/20200205 The Y2038 problem in the Linux kernel, 25 years of Java, and other industry news.md +++ /dev/null @@ -1,71 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: ( ) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (The Y2038 problem in the Linux kernel, 25 years of Java, and other industry news) -[#]: via: (https://opensource.com/article/20/2/linux-java-and-other-industry-news) -[#]: author: (Tim Hildred https://opensource.com/users/thildred) - -The Y2038 problem in the Linux kernel, 25 years of Java, and other industry news -====== -A weekly look at open source community and industry trends. -![Person standing in front of a giant computer screen with numbers, data][1] - -As part of my role as a senior product marketing manager at an enterprise software company with an open source development model, I publish a regular update about open source community, market, and industry trends for product marketers, managers, and other influencers. Here are five of my and their favorite articles from that update. - -## [Need 32-bit Linux to run past 2038? When version 5.6 of the kernel pops, you're in for a treat][2] - -> Arnd Bergmann, an engineer working on the thorny Y2038 problem in the Linux kernel, posted to the [mailing list][3] that, yup, Linux 5.6 "should be the first release that can serve as a base for a 32-bit system designed to run beyond year 2038." - -**The impact:** Y2K didn't get fixed; it just got bigger and delayed. There is no magic in software or computers; just people trying to solve complicated problems as best they can, and some times introducing more complicated problems for different people to solve at some point in the future. - -## [What the dev? Celebrating Java's 25th anniversary][4] - -> Java is coming up on a big milestone: Its 25th anniversary! To celebrate, we take a look back over the last 25 years to see how Java has evolved over time. In this episode, Social Media and Online Editor Jenna Sargent talks to Rich Sharples, senior director of product management for middleware at Red Hat, to learn more. - -**The impact:** There is something comforting about immersing yourself in a deep well of lived experience. Rich clearly lived through what he is talking about and shares insider knowlege with you (and his dog). - -## [Do I need an API Gateway if I use a service mesh?][5] - -> This post may not be able to break through the noise around API Gateways and Service Mesh. However, it’s 2020 and there is still abundant confusion around these topics. I have chosen to write this to help bring real concrete explanation to help clarify differences, overlap, and when to use which. Feel free to [@ me on twitter (@christianposta)][6] if you feel I’m adding to the confusion, disagree, or wish to buy me a beer (and these are not mutually exclusive reasons). - -**The impact:** Yes, though they use similar terms and concepts they have different concerns and scopes. - -## [What Australia's AGL Energy learned about Cloud Native compliance][7] - -> This is really at the heart of what open source is, enabling everybody to contribute equally. Within large enterprises, there are controls that are needed, but if we can automate the management of the majority of these controls, we can enable an amazing culture and development experience. - -**The impact:** They say "software is eating the world" and "developers are the new kingmakers." The fact that compliance in an energy utility is subject to developer experience improvement basically proves both statements. - -## [Monoliths are the future][8] - -> And then what they end up doing is creating 50 deployables, but it’s really a _distributed_ monolith. So it’s actually the same thing, but instead of function calls and class instantiation, they’re initiating things and throwing it over a network and hoping that it comes back. And since they can’t reliably _make it_ come back, they introduce things like [Prometheus][9], [OpenTracing][10], all of this stuff. I’m like, **“What are you doing?!”** - -**The impact:** Do things for real reasons with a clear-eyed understanding of what those reasons are and how they'll make your business or your organization better. - -_I hope you enjoyed this list of what stood out to me from last week and come back next Monday for more open source community, market, and industry trends._ - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/20/2/linux-java-and-other-industry-news - -作者:[Tim Hildred][a] -选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]: https://opensource.com/users/thildred -[b]: https://github.com/lujun9972 -[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/data_metrics_analytics_desktop_laptop.png?itok=9QXd7AUr (Person standing in front of a giant computer screen with numbers, data) -[2]: https://www.theregister.co.uk/2020/01/30/linux_5_6_2038/ -[3]: https://lkml.org/lkml/2020/1/29/355 -[4]: https://whatthedev.buzzsprout.com/673192/2543290-celebrating-java-s-25th-anniversary-episode-16 -[5]: https://blog.christianposta.com/microservices/do-i-need-an-api-gateway-if-i-have-a-service-mesh/ (Do I Need an API Gateway if I Use a Service Mesh?) -[6]: http://twitter.com/christianposta?lang=en -[7]: https://thenewstack.io/what-australias-agl-energy-learned-about-cloud-native-compliance/ -[8]: https://changelog.com/posts/monoliths-are-the-future -[9]: https://prometheus.io/ -[10]: https://opentracing.io diff --git a/sources/news/20200820 Rejoice KDE Lovers- MX Linux Joins the KDE Bandwagon and Now You Can Download MX Linux KDE Edition.md b/sources/news/20200820 Rejoice KDE Lovers- MX Linux Joins the KDE Bandwagon and Now You Can Download MX Linux KDE Edition.md new file mode 100644 index 0000000000..d5fcf0d379 --- /dev/null +++ b/sources/news/20200820 Rejoice KDE Lovers- MX Linux Joins the KDE Bandwagon and Now You Can Download MX Linux KDE Edition.md @@ -0,0 +1,91 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Rejoice KDE Lovers! MX Linux Joins the KDE Bandwagon and Now You Can Download MX Linux KDE Edition) +[#]: via: (https://itsfoss.com/mx-linux-kde-edition/) +[#]: author: (Ankush Das https://itsfoss.com/author/ankush/) + +Rejoice KDE Lovers! MX Linux Joins the KDE Bandwagon and Now You Can Download MX Linux KDE Edition +====== + +Debian-based [MX Linux][1] is already an impressive Linux distribution with [Xfce desktop environment][2] as the default. Even though it works good and is suitable to run with minimal hardware configuration, it still isn’t the best Linux distribution in terms of eye candy. + +That’s where KDE comes to the rescue. Of late, KDE Plasma has reduced a lot of weight and it uses fewer system resources without compromising on the modern looks. No wonder KDE Plasma is one of [the best desktop environments][3] out there. + +![][4] + +With [MX Linux 19.2][5], they began testing a KDE edition and have finally released their first KDE version. + +Also, the KDE edition comes with Advanced Hardware Support (AHS) enabled. Here’s what they have mentioned in their release notes: + +> MX-19.2 KDE is an **Advanced Hardware Support (AHS) **enabled **64-bit only** version of MX featuring the KDE/plasma desktop. Applications utilizing Qt library frameworks are given a preference for inclusion on the iso. + +As I mentioned it earlier, this is MX Linux’s first KDE edition ever, and they’ve also shed some light on it with the announcement as well: + +> This will be first officially supported MX/antiX family iso utilizing the KDE/plasma desktop since the halting of the predecessor MEPIS project in 2013. + +Personally, I enjoyed the experience of using MX Linux until I started using [Pop OS 20.04][6]. So, I’ll give you some key highlights of MX Linux 19.2 KDE edition along with my impressions of testing it. + +### MX Linux 19.2 KDE: Overview + +![][7] + +Out of the box, MX Linux looks cleaner and more attractive with KDE desktop on board. Unlike KDE Neon, it doesn’t feature the latest and greatest KDE stuff, but it looks to be doing the job intended. + +Of course, you will get the same options that you expect from a KDE-powered distro to customize the look and feel of your desktop. In addition to the obvious KDE perks, you will also get the usual MX tools, antiX-live-usb-system, and snapshot feature that comes baked in the Xfce edition. + +It’s a great thing to have the best of both worlds here, as stated in their announcement: + +> MX-19.2 KDE includes the usual MX tools, antiX-live-usb-system, and snapshot technology that our users have come to expect from our standard flagship Xfce releases. Adding KDE/plasma to the existing Xfce/MX-fluxbox desktops will provide for a wider range user needs and wants. + +I haven’t performed a great deal of tests but I did have some issues with extracting archives (it didn’t work the first try) and copy-pasting a file to a new location. Not sure if those are some known bugs — but I thought I should let you know here. + +![][8] + +Other than that, it features every useful tool you’d want to have and works great. With KDE on board, it actually feels more polished and smooth in my case. + +Along with KDE Plasma 5.14.5 on top of Debian 10 “buster”, it also comes with GIMP 2.10.12, MESA, Debian (AHS) 5.6 Kernel, Firefox browser, and few other goodies like VLC, Thunderbird, LibreOffice, and Clementine music player. + +You can also look for more stuff in the MX repositories. + +![][9] + +There are some known issues with the release like the System clock settings not being able adjustable via KDE settings. You can check their [announcement post][10] for more information or their [bug list][11] to make sure everything’s fine before trying it out on your production system. + +### Wrapping Up + +MX Linux 19.2 KDE edition is definitely more impressive than its Xfce offering in my opinion. It would take a while to iron out the bugs for this first KDE release — but it’s not a bad start. + +Speaking of KDE, I recently tested out KDE Neon, the official KDE distribution. I shared my experience in this video. I’ll try to do a video on MX Linux KDE flavor as well. + +[Subscribe to our YouTube channel for more Linux videos][12] + +Have you tried it yet? Let me know your thoughts in the comments below! + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/mx-linux-kde-edition/ + +作者:[Ankush Das][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://itsfoss.com/author/ankush/ +[b]: https://github.com/lujun9972 +[1]: https://mxlinux.org/ +[2]: https://www.xfce.org/ +[3]: https://itsfoss.com/best-linux-desktop-environments/ +[4]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/08/mx-linux-kde-edition.jpg?resize=800%2C450&ssl=1 +[5]: https://mxlinux.org/blog/mx-19-2-now-available/ +[6]: https://itsfoss.com/pop-os-20-04-review/ +[7]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/08/mx-linux-19-2-kde.jpg?resize=800%2C452&ssl=1 +[8]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/08/mx-linux-19-2-kde-filemanager.jpg?resize=800%2C452&ssl=1 +[9]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/08/mx-linux-19-2-kde-info.jpg?resize=800%2C452&ssl=1 +[10]: https://mxlinux.org/blog/mx-19-2-kde-now-available/ +[11]: https://bugs.mxlinux.org/ +[12]: https://www.youtube.com/c/itsfoss?sub_confirmation=1 diff --git a/sources/news/20200822 Cisco open-source code boosts performance of Kubernetes apps over SD-WAN.md b/sources/news/20200822 Cisco open-source code boosts performance of Kubernetes apps over SD-WAN.md new file mode 100644 index 0000000000..72ce014ff4 --- /dev/null +++ b/sources/news/20200822 Cisco open-source code boosts performance of Kubernetes apps over SD-WAN.md @@ -0,0 +1,66 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Cisco open-source code boosts performance of Kubernetes apps over SD-WAN) +[#]: via: (https://www.networkworld.com/article/3572310/cisco-open-source-code-boosts-performance-of-kubernetes-apps-over-sd-wan.html) +[#]: author: (Michael Cooney https://www.networkworld.com/author/Michael-Cooney/) + +Cisco open-source code boosts performance of Kubernetes apps over SD-WAN +====== +Cisco's Cloud-Native SD-WAN project marries SD-WANs to Kubernetes applications to cut down on the manual work needed to optimize latency and packet loss. +Thinkstock + +Cisco has introduced an open-source project that it says could go a long way toward reducing the manual work involved in optimizing performance of Kubernetes-applications across [SD-WANs][1]. + +Cisco said it launched the Cloud-Native SD-WAN (CN-WAN) project to show how Kubernetes applications can be automatically mapped to SD-WAN with the result that the applications perform better over the WAN. + +**More about SD-WAN**: [How to buy SD-WAN technology: Key questions to consider when selecting a supplier][2] • [How to pick an off-site data-backup method][3] •  [SD-Branch: What it is and why you’ll need it][4] • [What are the options for security SD-WAN?][5] + +“In many cases, enterprises deploy an SD-WAN to connect a Kubernetes cluster with users or workloads that consume cloud-native applications. In a typical enterprise, NetOps teams leverage their network expertise to program SD-WAN policies to optimize general connectivity to the Kubernetes hosted applications, with the goal to reduce latency, reduce packet loss, etc.” wrote John Apostolopoulos, vice president and CTO of Cisco’s intent-based networking group in a group [blog][6]. + +“The enterprise usually also has DevOps teams that maintain and optimize the Kubernetes infrastructure. However, despite the efforts of NetOps and DevOps teams, today Kubernetes and SD-WAN operate mostly like ships in the night, often unaware of each other. Integration between SD-WAN and Kubernetes typically involves time-consuming manual coordination between the two teams.” + +Current SD-WAN offering often have APIs that let customers programmatically influence how their traffic is handled over the WAN. This enables interesting and valuable opportunities for automation and application optimization, Apostolopoulos stated.  “We believe there is an opportunity to pair the declarative nature of Kubernetes with the programmable nature of modern SD-WAN solutions,”  he stated. + +Enter CN-WAN, which defines a set of components that can be used to integrate an SD-WAN package, such as Cisco Viptela SD-WAN, with Kubernetes to enable DevOps teams to express the WAN needs of the microservices they deploy in a Kubernetes cluster, while simultaneously letting NetOps automatically render the microservices needs to optimize the application performance over the WAN, Apostolopoulos stated. + +Apostolopoulos wrote that CN-WAN is composed of a Kubernetes Operator, a Reader, and an Adaptor. It works like this: The CN-WAN Operator runs in the Kubernetes cluster, actively monitoring the deployed services. DevOps teams can use standard Kubernetes annotations on the services to define WAN-specific metadata, such as the traffic profile of the application. The CN-WAN Operator then automatically registers the service along with the metadata in a service registry. In a demo at KubeCon EU this week Cisco used Google Service Directory as the service registry. + +Earlier this year [Cisco and Google][7] deepened their relationship with a turnkey package that lets customers mesh SD-WAN connectivity with applications running in a private [data center][8], Google Cloud or another cloud or SaaS application. That jointly developed platform, called Cisco SD-WAN Cloud Hub with Google Cloud, combines Cisco’s SD-WAN policy-, telemetry- and security-setting capabilities with Google's software-defined backbone to ensure that application service-level agreement, security and compliance policies are extended across the network. + +Meanwhile, on the SD-WAN side, the CN-WAN Reader connects to the service registry to learn about how Kubernetes is exposing the services and the associated WAN metadata extracted by the CN-WAN operator, Cisco stated. When new or updated services or metadata are detected, the CN-WAN Reader sends a message towards the CN-WAN Adaptor so SD-WAN policies can be updated. + +Finally, the CN-WAN Adaptor, maps the service-associated metadata into the detailed SD-WAN policies programmed by NetOps in the SD-WAN controller. The SD-WAN controller automatically renders the SD-WAN policies, specified by the NetOps for each metadata type, into specific SD-WAN data-plane optimizations for the service, Cisco stated.   + +“The SD-WAN may support multiple types of access at both sender and receiver (e.g., wired Internet, MPLS, wireless 4G or 5G), as well as multiple service options and prioritizations per access network, and of course multiple paths between source and destination,” Apostolopoulos stated. + +The code for the CN-WAN project is available as open-source in [GitHub][9]. + +Join the Network World communities on [Facebook][10] and [LinkedIn][11] to comment on topics that are top of mind. + +-------------------------------------------------------------------------------- + +via: https://www.networkworld.com/article/3572310/cisco-open-source-code-boosts-performance-of-kubernetes-apps-over-sd-wan.html + +作者:[Michael Cooney][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.networkworld.com/author/Michael-Cooney/ +[b]: https://github.com/lujun9972 +[1]: https://www.networkworld.com/article/3031279/sd-wan-what-it-is-and-why-you-ll-use-it-one-day.html +[2]: https://www.networkworld.com/article/3323407/sd-wan/how-to-buy-sd-wan-technology-key-questions-to-consider-when-selecting-a-supplier.html +[3]: https://www.networkworld.com/article/3328488/backup-systems-and-services/how-to-pick-an-off-site-data-backup-method.html +[4]: https://www.networkworld.com/article/3250664/lan-wan/sd-branch-what-it-is-and-why-youll-need-it.html +[5]: https://www.networkworld.com/article/3285728/sd-wan/what-are-the-options-for-securing-sd-wan.html +[6]: https://blogs.cisco.com/networking/introducing-the-cloud-native-sd-wan-project +[7]: https://www.networkworld.com/article/3539252/cisco-integrates-sd-wan-connectivity-with-google-cloud.html +[8]: https://www.networkworld.com/article/3223692/what-is-a-data-centerhow-its-changed-and-what-you-need-to-know.html +[9]: https://github.com/CloudNativeSDWAN/cnwan-docs +[10]: https://www.facebook.com/NetworkWorld/ +[11]: https://www.linkedin.com/company/network-world diff --git a/sources/news/20201014 KDE Plasma 5.20 is Here With Exciting Improvements.md b/sources/news/20201014 KDE Plasma 5.20 is Here With Exciting Improvements.md new file mode 100644 index 0000000000..2572d75bba --- /dev/null +++ b/sources/news/20201014 KDE Plasma 5.20 is Here With Exciting Improvements.md @@ -0,0 +1,122 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (KDE Plasma 5.20 is Here With Exciting Improvements) +[#]: via: (https://itsfoss.com/kde-plasma-5-20/) +[#]: author: (Ankush Das https://itsfoss.com/author/ankush/) + +KDE Plasma 5.20 is Here With Exciting Improvements +====== + +KDE Plasma 5.20 is finally here and there’s a lot of things to be excited about, including the new wallpaper ‘**Shell’** by Lucas Andrade. + +It is worth noting that is not an LTS release unlike [KDE Plasma 5.18][1] and will be maintained for the next 4 months or so. So, if you want the latest and greatest, you can surely go ahead and give it a try. + +In this article, I shall mention the key highlights of KDE Plasma 5.20 from [my experience with it on KDE Neon][2] (Testing Edition). + +![][3] + +### Plasma 5.20 Features + +If you like to see things in action, we made a feature overview video for you. + +[Subscribe to our YouTube channel for more Linux videos][4] + +#### Icon-only Taskbar + +![][5] + +You must be already comfortable with a taskbar that mentions the title of the window along the icon. However, that takes a lot of space in the taskbar, which looks bad when you want to have a clean look with multiple applications/windows opened. + +Not just limited to that, if you launch several windows of the same application, it will group them together and let you cycle through it from a single icon on the task bar. + +So, with this update, you get an icon-only taskbar by default which makes it look a lot cleaner and you can have more things in the taskbar at a glance. + +#### Digital Clock Applet with Date + +![][6] + +If you’ve used any KDE-powered distro, you must have noticed that the digital clock applet (in the bottom-right corner) displays the time but not the date by default. + +It’s always a good choice to have the date and time as well (at least I prefer that). So, with KDE Plasma 5.20, the applet will have both time and date. + +#### Get Notified When your System almost Runs out of Space + +I know this is not a big addition, but a necessary one. No matter whether your home directory is on a different partition, you will be notified when you’re about to run out of space. + +#### Set the Charge Limit Below 100% + +You are in for a treat if you are a laptop user. To help you preserve the battery health, you can now set a charge limit below 100%. I couldn’t show it to you because I use a desktop. + +#### Workspace Improvements + +Working with the workspaces on KDE desktop was already an impressive experience, now with the latest update, several tweaks have been made to take the user experience up a notch. + +To start with, the system tray has been overhauled with a grid-like layout replacing the list view. + +The default shortcut has been re-assigned with Meta+drag instead of Alt+drag to move/re-size windows to avoid conflicts with some other productivity apps with Alt+drag keybind support. You can also use the key binds like Meta + up/left/down arrow to corner-tile windows. + +![][7] + +It is also easier to list all the disks using the old “**Device Notifier**” applet, which has been renamed to “**Disks & Devices**“. + +If that wasn’t enough, you will also find improvements to [KRunner][8], which is the essential application launcher or search utility for users. It will now remember the search text history and you can also have it centered on the screen instead of having it on top of the screen. + +#### System Settings Improvements + +The look and feel of the system setting is the same but it is more useful now. You will notice a new “**Highlight changed settings**” option which will show you the recent/modified changes when compared to the default values. + +So, in that way, you can monitor any changes that you did accidentally or if someone else did it. + +![][9] + +In addition to that, you also get to utilize S.M.A.R.T monitoring and disk failure notifications. + +#### Wayland Support Improvements + +If you prefer to use a Wayland session, you will be happy to know that it now supports [Klipper][10] and you can also middle-click to paste (on KDE apps only for the time being). + +The much-needed screencasting support has also been added. + +#### Other Improvements + +Of course, you will notice some subtle visual improvements or adjustments for the look and feel. You may notice a smooth transition effect when changing the brightness. Similarly, when changing the brightness or volume, the on-screen display that pops up is now less obtrusive + +Options like controlling the scroll speed of mouse/touchpad have been added to give you finer controls. + +You can find the detailed list of changes in its [official changelog][11], if you’re curious. + +### Wrapping Up + +The changes are definitely impressive and should make the KDE experience better than ever before. + +If you’re running KDE Neon, you should get the update soon. But, if you are on Kubuntu, you will have to try the 20.10 ISO to get your hands on Plasma 5.20. + +What do you like the most among the list of changes? Have you tried it yet? Let me know your thoughts in the comments below. + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/kde-plasma-5-20/ + +作者:[Ankush Das][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://itsfoss.com/author/ankush/ +[b]: https://github.com/lujun9972 +[1]: https://itsfoss.com/kde-plasma-5-18-release/ +[2]: https://itsfoss.com/kde-neon-review/ +[3]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/10/kde-plasma-5-20-feat.png?resize=800%2C394&ssl=1 +[4]: https://www.youtube.com/c/itsfoss?sub_confirmation=1 +[5]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/10/kde-plasma-5-20-taskbar.jpg?resize=472%2C290&ssl=1 +[6]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/10/kde-plasma-5-20-clock.jpg?resize=372%2C224&ssl=1 +[7]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/10/kde-plasma-5-20-notify.jpg?resize=800%2C692&ssl=1 +[8]: https://docs.kde.org/trunk5/en/kde-workspace/plasma-desktop/krunner.html +[9]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/10/plasma-disks-smart.png?resize=800%2C539&ssl=1 +[10]: https://userbase.kde.org/Klipper +[11]: https://kde.org/announcements/plasma-5.20.0 diff --git a/sources/talk/20181218 The Rise and Demise of RSS.md b/sources/talk/20181218 The Rise and Demise of RSS.md index e260070c5c..2dfea2074c 100644 --- a/sources/talk/20181218 The Rise and Demise of RSS.md +++ b/sources/talk/20181218 The Rise and Demise of RSS.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (beamrolling) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) diff --git a/sources/talk/20190105 Why Sorting is O(N log N).md b/sources/talk/20190105 Why Sorting is O(N log N).md deleted file mode 100644 index 34a1d3bf97..0000000000 --- a/sources/talk/20190105 Why Sorting is O(N log N).md +++ /dev/null @@ -1,115 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: ( ) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Why Sorting is O(N log N)) -[#]: via: (https://theartofmachinery.com/2019/01/05/sorting_is_nlogn.html) -[#]: author: (Simon Arneaud https://theartofmachinery.com) - -Why Sorting is O(N log N) -====== - -Any decent algorithms textbook will explain how fast sorting algorithms like quicksort and heapsort are, but it doesn’t take crazy maths to prove that they’re as asymptotically fast as you can possibly get. - -### A pedantic note about notation - -Most computer scientists use big-O notation to mean “asymptotically equal, up to a constant scaling factor”, which isn’t quite what it means to other mathematicians. Sorry, I’ll use big-O like in CS textbooks, but at least I won’t mix it with other mathematical notation. - -## Comparison-based sorting - -Let’s look at the special case of algorithms that compare values two at a time (like quicksort and heapsort, and most other popular algorithms). The ideas can be extended to all sorting algorithms later. - -### A simple counting argument for the worst case - -Suppose you have an array of four elements, all different, in random order. Can you sort it by comparing just one pair of elements? Obviously not, but here’s one good reason that proves you can’t: By definition, to sort the array, you need to how to rearrange the elements to put them in order. In other words, you need to know which permutation is needed. How many possible permutations are there? The first element could be moved to one of four places, the second one could go to one of the remaining three, the third element has two options, and the last element has to take the one remaining place. So there are (4 \times 3 \times 2 \times 1 = 4! = 24) possible permutations to choose from, but there are only two possible results from comparing two different things: “BIGGER” and “SMALLER”. If you made a list of all the possible permutations, you might decide that “BIGGER” means you need permutation #8 and “SMALLER” means you need permutation #24, but there’s no way you could know when you need the other 22 permutations. - -With two comparisons, you have (2 \times 2 = 4) possible outputs, which still isn’t enough. You can’t sort every possible shuffled array unless you do at least five comparisons ((2^{5} = 32)). If (W(N)) is the worst-case number of comparisons needed to sort (N) different elements using some algorithm, we can say - -[2^{W(N)} \geq N!] - -Taking a logarithm base 2, - -[W(N) \geq \log_{2}{N!}] - -Asymptotically, (N!) grows like (N^{N}) (see also [Stirling’s formula][1]), so - -[W(N) \succeq \log N^{N} = N\log N] - -And that’s an (O(N\log N)) limit on the worst case just from counting outputs. - -### Average case from information theory - -We can get a stronger result if we extend that counting argument with a little information theory. Here’s how we could use a sorting algorithm as a code for transmitting information: - - 1. I think of a number — say, 15 - 2. I look up permutation #15 from the list of permutations of four elements - 3. I run the sorting algorithm on this permutation and record all the “BIGGER” and “SMALLER” comparison results - 4. I transmit the comparison results to you in binary code - 5. You re-enact my sorting algorithm run, step by step, referring to my list of comparison results as needed - 6. Now that you know how I rearranged my array to make it sorted, you can reverse the permutation to figure out my original array - 7. You look up my original array in the permutation list to figure out I transmitted the number 15 - - - -Okay, it’s a bit strange, but it could be done. That means that sorting algorithms are bound by the same laws as normal encoding schemes, including the theorem proving there’s no universal data compressor. I transmitted one bit per comparison the algorithm does, so, on average, the number of comparisons must be at least the number of bits needed to represent my data, according to information theory. More technically, [the average number of comparisons must be at least the Shannon entropy of my input data, measured in bits][2]. Entropy is a mathematical measure of the information content, or unpredictability, of something. - -If I have an array of (N) elements that could be in any possible order without bias, then entropy is maximised and is (\log_{2}{N!}) bits. That proves that (O(N\log N)) is an optimal average for a comparison-based sort with arbitrary input. - -That’s the theory, but how do real sorting algorithms compare? Below is a plot of the average number of comparisons needed to sort an array. I’ve compared the theoretical optimum against naïve quicksort and the [Ford-Johnson merge-insertion sort][3], which was designed to minimise comparisons (though it’s rarely faster than quicksort overall because there’s more to life than minimising comparisons). Since it was developed in 1959, merge-insertion sort has been tweaked to squeeze a few more comparisons out, but the plot shows it’s already almost optimal. - -![Plot of average number of comparisons needed to sort randomly shuffled arrays of length up to 100. Bottom line is theoretical optimum. Within about 1% is merge-insertion sort. Naïve quicksort is within about 25% of optimum.][4] - -It’s nice when a little theory gives such a tight practical result. - -### Summary so far - -Here’s what’s been proven so far: - - 1. If the array could start in any order, at least (O(N\log N)) comparisons are needed in the worst case - 2. The average number of comparisons must be at least the entropy of the array, which is (O(N\log N)) for random input - - - -Note that #2 allows comparison-based sorting algorithms to be faster than (O(N\log N)) if the input is low entropy (in other words, more predictable). Merge sort is close to (O(N)) if the input contains many sorted subarrays. Insertion sort is close to (O(N)) if the input is an array that was sorted before being perturbed a bit. None of them beat (O(N\log N)) in the worst case unless some array orderings are impossible as inputs. - -## General sorting algorithms - -Comparison-based sorts are an interesting special case in practice, but there’s nothing theoretically special about [`CMP`][5] as opposed to any other instruction on a computer. Both arguments above can be generalised to any sorting algorithm if you note a couple of things: - - 1. Most computer instructions have more than two possible outputs, but still have a limited number - 2. The limited number of outputs means that one instruction can only process a limited amount of entropy - - - -That gives us the same (O(N\log N)) lower bound on the number of instructions. Any physically realisable computer can only process a limited number of instructions at a time, so that’s an (O(N\log N)) lower bound on the time required, as well. - -### But what about “faster” algorithms? - -The most useful practical implication of the general (O(N\log N)) bound is that if you hear about any asymptotically faster algorithm, you know it must be “cheating” somehow. There must be some catch that means it isn’t a general purpose sorting algorithm that scales to arbitrarily large arrays. It might still be a useful algorithm, but it’s a good idea to read the fine print closely. - -A well-known example is radix sort. It’s often called an (O(N)) sorting algorithm, but the catch is that it only works if all the numbers fit into (k) bits, and it’s really (O({kN})). - -What does that mean in practice? Suppose you have an 8-bit machine. You can represent (2^{8} = 256) different numbers in 8 bits, so if you have an array of thousands of numbers, you’re going to have duplicates. That might be okay for some applications, but for others you need to upgrade to at least 16 bits, which can represent (2^{16} = 65,536) numbers distinctly. 32 bits will support (2^{32} = 4,294,967,296) different numbers. As the size of the array goes up, the number of bits needed will tend to go up, too. To represent (N) different numbers distinctly, you’ll need (k \geq \log_{2}N). So, unless you’re okay with lots of duplicates in your array, (O({kN})) is effectively (O(N\log N)). - -The need for (O(N\log N)) of input data in the general case actually proves the overall result by itself. That argument isn’t so interesting in practice because we rarely need to sort billions of integers on a 32-bit machine, and [if anyone’s hit the limits of a 64-bit machine, they haven’t told the rest of us][6]. - --------------------------------------------------------------------------------- - -via: https://theartofmachinery.com/2019/01/05/sorting_is_nlogn.html - -作者:[Simon Arneaud][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://theartofmachinery.com -[b]: https://github.com/lujun9972 -[1]: http://hyperphysics.phy-astr.gsu.edu/hbase/Math/stirling.html -[2]: https://en.wikipedia.org/wiki/Shannon%27s_source_coding_theorem -[3]: https://en.wikipedia.org/wiki/Merge-insertion_sort -[4]: /images/sorting_is_nlogn/sorting_algorithms_num_comparisons.svg -[5]: https://c9x.me/x86/html/file_module_x86_id_35.html -[6]: https://sortbenchmark.org/ diff --git a/sources/talk/20190222 Developer happiness- What you need to know.md b/sources/talk/20190222 Developer happiness- What you need to know.md deleted file mode 100644 index 8ef7772193..0000000000 --- a/sources/talk/20190222 Developer happiness- What you need to know.md +++ /dev/null @@ -1,79 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: ( ) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Developer happiness: What you need to know) -[#]: via: (https://opensource.com/article/19/2/developer-happiness) -[#]: author: (Bart Copeland https://opensource.com/users/bartcopeland) - -Developer happiness: What you need to know -====== -Developers need the tools and the freedom to code quickly, without getting bogged down by compliance and security. -![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/computer_happy_sad_developer_programming.png?itok=72nkfSQ_) - -A person needs the right tools for the job. There's nothing as frustrating as getting halfway through a car repair, for instance, only to discover you don't have the specialized tool you need to complete the job. The same concept applies to developers: you need the tools to do what you are best at, without disrupting your workflow with compliance and security needs, so you can produce code faster. - -Over half—51%, to be specific—of developers spend only one to four hours each day programming, according to ActiveState's recent [Developer Survey 2018: Open Source Runtime Pains][1]. In other words, the majority of developers spend less than half of their time coding. According to the survey, 50% of developers say security is one of their biggest concerns, but 67% of developers choose not to add a new language when coding because of the difficulties related to corporate policies. - -The result is developers have to devote time to non-coding activities like retrofitting software for security and compliance criteria checked after software and languages have been built. And they won't choose the best tool or language for the job because of corporate policies. Their satisfaction goes down and risk goes up. - -So, developers aren't able to devote time to high-value work. This creates additional business risk because their time-to-market is slowed, and the organization increases tech debt by not empowering developers to decide on "the best" tech, unencumbered by corporate policy drag. - -### Baking in security and compliance workflows - -How can we solve this issue? One way is to integrate security and compliance workflows into the software development process in four easy steps: - -#### 1\. Gather your forces - -Get support from everyone involved. This is an often-forgotten but critical first step. Make sure to consider a wide range of stakeholders, including: - - * DevOps - * Developers - * InfoSec - * Legal/compliance - * IT security - - - -Stakeholders want to understand the business benefits, so make a solid case for eliminating the security and compliance checkpoints after software builds. You can consider any (or all) of the following in building your business case: time savings, opportunity cost, and developer productivity. By integrating security and compliance workflows into the development process, you also avoid retrofitting of languages. - -#### 2\. Find trustworthy sources - -Next, choose the trusted sources that can be used, along with their license and security requirements. Consider including information such as: - - * Restrictions on usage based on environment or application type and version controls per language - * Which open source components are allowable, e.g., specific packages - * Which licenses can be used in which types of environments (e.g., research vs. production) - * The definition of security levels, acceptable vulnerability risk levels, what risk levels trigger an action, what that action would be, and who would be responsible for its implementation - - - -#### 3\. Incorporate security and compliance from day one - -The upshot of incorporating security and compliance workflows is that it ultimately bakes security and compliance into the first line of code. It eliminates the drag of corporate policy because you're coding to spec versus having to fix things after the fact. But to do this, consider mechanisms for automatically scanning code as it's being built, along with using agentless monitoring of your runtime code. You're freeing up your time, and you'll also be able to programmatically enforce policies to ensure compliance across your entire organization. - -New vulnerabilities arise, and new patches and versions become available. Consequently, security and compliance need to be considered when deploying code into production and also when running code. You need to know what, if any, code is at risk and where that code is running. So, the process for deploying and running code should include monitoring, reporting, and updating code in production. - -By integrating security and compliance into your software development process from the start, you can also benefit by tracking where your code is running once deployed and be alerted of new threats as they arise. You will be able to track when your applications were vulnerable and respond with automatic enforcement of your software policies. - -If your software development process has security and compliance workflows baked in, you will improve your productivity. And you'll be able to measure value through increased time spent coding; gains in security and stability; and cost- and time-savings in maintenance and discovery of security and compliance threats. - -### Happiness through integration - -If you don't develop and update software, your organization can't go forward. Developers are a linchpin in the success of your company, which means they need the tools and the freedom to code quickly. You can't let compliance and security needs—though they are critical—bog you down. Developers clearly worry about security, so the happy medium is to "shift left" and integrate security and compliance workflows from the start. You'll get more done, get it right the first time, and spend far less time retrofitting code. - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/19/2/developer-happiness - -作者:[Bart Copeland][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/bartcopeland -[b]: https://github.com/lujun9972 -[1]: https://www.activestate.com/company/press/press-releases/activestate-developer-survey-examines-open-source-challenges/ diff --git a/sources/talk/20190225 Teaching scientists how to share code.md b/sources/talk/20190225 Teaching scientists how to share code.md index 074da27476..541cce2719 100644 --- a/sources/talk/20190225 Teaching scientists how to share code.md +++ b/sources/talk/20190225 Teaching scientists how to share code.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: ( jiangyaomin) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) @@ -56,7 +56,7 @@ via: https://opensource.com/article/19/2/open-science-git 作者:[Jon Tennant][a] 选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) +译者:[译者ID](https://github.com/jiangyaomin) 校对:[校对者ID](https://github.com/校对者ID) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 diff --git a/sources/talk/20190226 Reducing security risks with centralized logging.md b/sources/talk/20190226 Reducing security risks with centralized logging.md deleted file mode 100644 index 60bbd7a80b..0000000000 --- a/sources/talk/20190226 Reducing security risks with centralized logging.md +++ /dev/null @@ -1,82 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: ( ) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Reducing security risks with centralized logging) -[#]: via: (https://opensource.com/article/19/2/reducing-security-risks-centralized-logging) -[#]: author: (Hannah Suarez https://opensource.com/users/hcs) - -Reducing security risks with centralized logging -====== -Centralizing logs and structuring log data for processing can mitigate risks related to insufficient logging. - -![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/security_privacy_lock.png?itok=ZWjrpFzx) - -Logging and log analysis are essential to securing infrastructure, particularly when we consider common vulnerabilities. This article, based on my lightning talk [Let's use centralized log collection to make incident response teams happy][1] at FOSDEM'19, aims to raise awareness about the security concerns around insufficient logging, offer a way to avoid the risk, and advocate for more secure practices _(disclaimer: I work for NXLog)._ - -### Why log collection and why centralized logging? - -Logging is, to be specific, an append-only sequence of records written to disk. In practice, logs help you investigate an infrastructure issue as you try to find a cause for misbehavior. A challenge comes up when you have heterogeneous systems with their own standards and formats, and you want to be able to handle and process these in a dependable way. This often comes at the cost of metadata. Centralized logging solutions require commonality, and that commonality often removes the rich metadata many open source logging tools provide. - -### The security risk of insufficient logging and monitoring - -The Open Web Application Security Project ([OWASP][2]) is a nonprofit organization that contributes to the industry with incredible projects (including many [tools][3] focusing on software security). The organization regularly reports on the riskiest security challenges for application developers and maintainers. In its most recent report on the [top 10 most critical web application security risks][4], OWASP added Insufficient Logging and Monitoring to its list. OWASP warns of risks due to insufficient logging, detection, monitoring, and active response in the following types of scenarios. - - * Important auditable events, such as logins, failed logins, and high-value transactions are not logged. - * Warnings and errors generate none, inadequate, or unclear log messages. - * Logs are only being stored locally. - * The application is unable to detect, escalate, or alert for active attacks in real time or near real time. - - - -These instances can be mitigated by centralizing logs (i.e., not storing logs locally) and structuring log data for processing (i.e., in alerting dashboards and security suites). - -For example, imagine a DNS query leads to a malicious site named **hacked.badsite.net**. With DNS monitoring, administrators monitor and proactively analyze DNS queries and responses. The efficiency of DNS monitoring relies on both sufficient logging and log collection in order to catch potential issues as well as structuring the resulting DNS log for further processing: - -``` -2019-01-29 -Time (GMT)      Source                  Destination             Protocol-Info -12:42:42.112898 SOURCE_IP               xxx.xx.xx.x             DNS     Standard query 0x1de7  A hacked.badsite.net -``` - -You can try this yourself and run through other examples and snippets with the [NXLog Community Edition][5] _(disclaimer again: I work for NXLog)._ - -### Important aside: unstructured vs. structured data - -It's important to take a moment and consider the log data format. For example, let's consider this log message: - -``` -debug1: Failed password for invalid user amy from SOURCE_IP port SOURCE_PORT ssh2 -``` - -This log contains a predefined structure, such as a metadata keyword before the colon ( **debug1** ). However, the rest of the log field is an unstructured string ( **Failed password for invalid user amy from SOURCE_IP port SOURCE_PORT ssh2** ). So, while the message is easily available in a human-readable format, it is not a format a computer can easily parse. - -Unstructured event data poses limitations including difficulty of parsing, searching, and analyzing the logs. The important metadata is too often set in an unstructured data field in the form of a freeform string like the example above. Logging administrators will come across this problem at some point as they attempt to standardize/normalize log data and centralize their log sources. - -### Where to go next - -Alongside centralizing and structuring your logs, make sure you're collecting the right log data—Sysmon, PowerShell, Windows EventLog, DNS debug, NetFlow, ETW, kernel monitoring, file integrity monitoring, database logs, external cloud logs, and so on. Also have the right tools and processes in place to collect, aggregate, and help make sense of the data. - -Hopefully, this gives you a starting point to centralize log collection across diverse sources; send them to outside sources like dashboards, monitoring software, analytics software, specialized software like security information and event management (SEIM) suites; and more. - -What does your centralized logging strategy look like? Share your thoughts in the comments. - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/19/2/reducing-security-risks-centralized-logging - -作者:[Hannah Suarez][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/hcs -[b]: https://github.com/lujun9972 -[1]: https://fosdem.org/2019/schedule/event/lets_use_centralized_log_collection_to_make_incident_response_teams_happy/ -[2]: https://www.owasp.org/index.php/Main_Page -[3]: https://github.com/OWASP -[4]: https://www.owasp.org/index.php/Top_10-2017_Top_10 -[5]: https://nxlog.co/products/nxlog-community-edition/download diff --git a/sources/talk/20190329 9 open source tools for building a fault-tolerant system.md b/sources/talk/20190329 9 open source tools for building a fault-tolerant system.md deleted file mode 100644 index 78282fb853..0000000000 --- a/sources/talk/20190329 9 open source tools for building a fault-tolerant system.md +++ /dev/null @@ -1,139 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: ( ) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (9 open source tools for building a fault-tolerant system) -[#]: via: (https://opensource.com/article/19/3/tools-fault-tolerant-system) -[#]: author: (Bryant Son (Red Hat, Community Moderator) https://opensource.com/users/brson) - -9 open source tools for building a fault-tolerant system -====== - -Maximize uptime and minimize problems with these open source tools. - -![magnifying glass on computer screen, finding a bug in the code][1] - -I've always been interested in web development and software architecture because I like to see the broader picture of a working system. Whether you are building a mobile app or a web application, it has to be connected to the internet to exchange data among different modules, which means you need a web service. - -If you use a cloud system as your application's backend, you can take advantage of greater computing power, as the backend service will scale horizontally and vertically and orchestrate different services. But whether or not you use a cloud backend, it's important to build a _fault-tolerant system_ —one that is resilient, stable, fast, and safe. - -To understand fault-tolerant systems, let's use Facebook, Amazon, Google, and Netflix as examples. Millions and billions of users access these platforms simultaneously while transmitting enormous amounts of data via peer-to-peer and user-to-server networks, and you can be sure there are also malicious users with bad intentions, like hacking or denial-of-service (DoS) attacks. Even so, these platforms can operate 24 hours a day and 365 days a year without downtime. - -Although machine learning and smart algorithms are the backbones of these systems, the fact that they achieve consistent service without a single minute of downtime is praiseworthy. Their expensive hardware and gigantic datacenters certainly matter, but the elegant software designs supporting the services are equally important. And the fault-tolerant system is one of the principles to build such an elegant system. - -### Two behaviors that cause problems in production - -Here's another way to think of a fault-tolerant system. When you run your application service locally, everything seems to be fine. Great! But when you promote your service to the production environment, all hell breaks loose. In a situation like this, a fault-tolerant system helps by addressing two problems: Fail-stop behavior and Byzantine behavior. - -#### Fail-stop behavior - -Fail-stop behavior is when a running system suddenly halts or a few parts of the system fail. Server downtime and database inaccessibility fall under this category. For example, in the diagram below, Service 1 can't communicate with Service 2 because Service 2 is inaccessible: - -![Fail-stop behavior due to Service 2 downtime][2] - -But the problem can also occur if there is a network problem between the services, like this: - -![Fail-stop behavior due to network failure][3] - -#### Byzantine behavior - -Byzantine behavior is when the system continuously runs but doesn't produce the expected behavior (e.g., wrong data or an invalid value). - -Byzantine failure can happen if Service 2 has corrupted data or values, even though the service looks to be operating just fine, like in this example: - -![Byzantine failure due to corrupted service][4] - -Or, there can be a malicious middleman intercepting between the services and injecting unwanted data: - -![Byzantine failure due to malicious middleman][5] - -Neither fail-stop nor Byzantine behavior is a desired situation, so we need ways to prevent or fix them. That's where fault-tolerant systems come into play. Following are eight open source tools that can help you address these problems. - -### Tools for building a fault-tolerant system - -Although building a truly practical fault-tolerant system touches upon in-depth _distributed computing theory_ and complex computer science principles, there are many software tools—many of them, like the following, open source—to alleviate undesirable results by building a fault-tolerant system. - -#### Circuit-breaker pattern: Hystrix and Resilience4j - -The [circuit-breaker pattern][6] is a technique that helps to return a prepared dummy response or a simple response when a service fails: - -![Circuit breaker pattern][7] - -Netflix's open source **[Hystrix][8]** is the most popular implementation of the circuit-breaker pattern. - -Many companies where I've worked previously are leveraging this wonderful tool. Surprisingly, Netflix announced that it will no longer update Hystrix. (Yeah, I know.) Instead, Netflix recommends using an alternative solution like [**Resilence4j**][9], which supports Java 8 and functional programming, or an alternative practice like [Adaptive Concurrency Limit][10]. - -#### Load balancing: Nginx and HaProxy - -Load balancing is one of the most fundamental concepts in a distributed system and must be present to have a production-quality environment. To understand load balancers, we first need to understand the concept of _redundancy_. Every production-quality web service has multiple servers that provide redundancy to take over and maintain services when servers go down. - -![Load balancer][11] - -Think about modern airplanes: their dual engines provide redundancy that allows them to land safely even if an engine catches fire. (It also helps that most commercial airplanes have state-of-art, automated systems.) But, having multiple engines (or servers) means that there must be some kind of scheduling mechanism to effectively route the system when something fails. - -A load balancer is a device or software that optimizes heavy traffic transactions by balancing multiple server nodes. For instance, when thousands of requests come in, the load balancer acts as the middle layer to route and evenly distribute traffic across different servers. If a server goes down, the load balancer forwards requests to the other servers that are running well. - -There are many load balancers available, but the two best-known ones are Nginx and HaProxy. - -[**Nginx**][12] is more than a load balancer. It is an HTTP and reverse proxy server, a mail proxy server, and a generic TCP/UDP proxy server. Companies like Groupon, Capital One, Adobe, and NASA use it. - -[**HaProxy**][13] is also popular, as it is a free, very fast and reliable solution offering high availability, load balancing, and proxying for TCP and HTTP-based applications. Many large internet companies, including GitHub, Reddit, Twitter, and Stack Overflow, use HaProxy. Oh and yes, Red Hat Enterprise Linux also supports HaProxy configuration. - -#### Actor model: Akka - -The [actor model][14] is a concurrency design pattern that delegates responsibility when an _actor_ , which is a primitive unit of computation, receives a message. An actor can create even more actors and delegate the message to them. - -[**Akka**][15] is one of the most well-known tools for the actor model implementation. The framework supports Java and Scala, which are both based on JVM. - -#### Asynchronous, non-blocking I/O using messaging queue: Kafka and RabbitMQ - -Multi-threaded development has been popular in the past, but this practice has been discouraged and replaced with asynchronous, non-blocking I/O patterns. For Java, this is explicitly stated in its [Enterprise Java Bean (EJB) specifications][16]: - -> "An enterprise bean must not use thread synchronization primitives to synchronize execution of multiple instances. -> -> "The enterprise bean must not attempt to manage threads. The enterprise bean must not attempt to start, stop, suspend, or resume a thread, or to change a thread's priority or name. The enterprise bean must not attempt to manage thread groups." - -Now, there are other practices like stream APIs and actor models. But messaging queues like [**Kafka**][17] and [**RabbitMQ**][18] offer the out-of-box support for asynchronous and non-blocking IO features, and they are powerful open source tools that can be replacements for threads by handling concurrent processes. - -#### Other options: Eureka and Chaos Monkey - -Other useful tools for fault-tolerant systems include monitoring tools, such as Netflix's **[Eureka][19]** , and stress-testing tools, like **[Chaos Monkey][20]**. They aim to discover potential issues earlier by testing in lower environments, like integration (INT), quality assurance (QA), and user acceptance testing (UAT), to prevent potential problems before moving to the production environment. - -* * * - -What open source tools are you using for building a fault-tolerant system? Please share your favorites in the comments. - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/19/3/tools-fault-tolerant-system - -作者:[Bryant Son (Red Hat, Community Moderator)][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/brson -[b]: https://github.com/lujun9972 -[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/mistake_bug_fix_find_error.png?itok=PZaz3dga (magnifying glass on computer screen, finding a bug in the code) -[2]: https://opensource.com/sites/default/files/uploads/1_errordowntimeservice.jpg (Fail-stop behavior due to Service 2 downtime) -[3]: https://opensource.com/sites/default/files/uploads/2_errordowntimenetwork.jpg (Fail-stop behavior due to network failure) -[4]: https://opensource.com/sites/default/files/uploads/3_byzantinefailuremalicious.jpg (Byzantine failure due to corrupted service) -[5]: https://opensource.com/sites/default/files/uploads/4_byzantinefailuremiddleman.jpg (Byzantine failure due to malicious middleman) -[6]: https://martinfowler.com/bliki/CircuitBreaker.html -[7]: https://opensource.com/sites/default/files/uploads/5_circuitbreakerpattern.jpg (Circuit breaker pattern) -[8]: https://github.com/Netflix/Hystrix/wiki -[9]: https://github.com/resilience4j/resilience4j -[10]: https://medium.com/@NetflixTechBlog/performance-under-load-3e6fa9a60581 -[11]: https://opensource.com/sites/default/files/uploads/7_loadbalancer.jpg (Load balancer) -[12]: https://www.nginx.com -[13]: https://www.haproxy.org -[14]: https://en.wikipedia.org/wiki/Actor_model -[15]: https://akka.io -[16]: https://jcp.org/aboutJava/communityprocess/final/jsr220/index.html -[17]: https://kafka.apache.org -[18]: https://www.rabbitmq.com -[19]: https://github.com/Netflix/eureka -[20]: https://github.com/Netflix/chaosmonkey diff --git a/sources/talk/20190331 Codecademy vs. The BBC Micro.md b/sources/talk/20190331 Codecademy vs. The BBC Micro.md new file mode 100644 index 0000000000..a85aadad46 --- /dev/null +++ b/sources/talk/20190331 Codecademy vs. The BBC Micro.md @@ -0,0 +1,145 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Codecademy vs. The BBC Micro) +[#]: via: (https://twobithistory.org/2019/03/31/bbc-micro.html) +[#]: author: (Two-Bit History https://twobithistory.org) + +Codecademy vs. The BBC Micro +====== + +In the late 1970s, the computer, which for decades had been a mysterious, hulking machine that only did the bidding of corporate overlords, suddenly became something the average person could buy and take home. An enthusiastic minority saw how great this was and rushed to get a computer of their own. For many more people, the arrival of the microcomputer triggered helpless anxiety about the future. An ad from a magazine at the time promised that a home computer would “give your child an unfair advantage in school.” It showed a boy in a smart blazer and tie eagerly raising his hand to answer a question, while behind him his dim-witted classmates look on sullenly. The ad and others like it implied that the world was changing quickly and, if you did not immediately learn how to use one of these intimidating new devices, you and your family would be left behind. + +In the UK, this anxiety metastasized into concern at the highest levels of government about the competitiveness of the nation. The 1970s had been, on the whole, an underwhelming decade for Great Britain. Both inflation and unemployment had been high. Meanwhile, a series of strikes put London through blackout after blackout. A government report from 1979 fretted that a failure to keep up with trends in computing technology would “add another factor to our poor industrial performance.”[1][1] The country already seemed to be behind in the computing arena—all the great computer companies were American, while integrated circuits were being assembled in Japan and Taiwan. + +In an audacious move, the BBC, a public service broadcaster funded by the government, decided that it would solve Britain’s national competitiveness problems by helping Britons everywhere overcome their aversion to computers. It launched the _Computer Literacy Project_, a multi-pronged educational effort that involved several TV series, a few books, a network of support groups, and a specially built microcomputer known as the BBC Micro. The project was so successful that, by 1983, an editor for BYTE Magazine wrote, “compared to the US, proportionally more of Britain’s population is interested in microcomputers.”[2][2] The editor marveled that there were more people at the Fifth Personal Computer World Show in the UK than had been to that year’s West Coast Computer Faire. Over a sixth of Great Britain watched an episode in the first series produced for the _Computer Literacy Project_ and 1.5 million BBC Micros were ultimately sold.[3][3] + +[An archive][4] containing every TV series produced and all the materials published for the _Computer Literacy Project_ was put on the web last year. I’ve had a huge amount of fun watching the TV series and trying to imagine what it would have been like to learn about computing in the early 1980s. But what’s turned out to be more interesting is how computing was _taught_. Today, we still worry about technology leaving people behind. Wealthy tech entrepreneurs and governments spend lots of money trying to teach kids “to code.” We have websites like Codecademy that make use of new technologies to teach coding interactively. One would assume that this approach is more effective than a goofy ’80s TV series. But is it? + +### The Computer Literacy Project + +The microcomputer revolution began in 1975 with the release of [the Altair 8800][5]. Only two years later, the Apple II, TRS-80, and Commodore PET had all been released. Sales of the new computers exploded. In 1978, the BBC explored the dramatic societal changes these new machines were sure to bring in a documentary called “Now the Chips Are Down.” + +The documentary was alarming. Within the first five minutes, the narrator explains that microelectronics will “totally revolutionize our way of life.” As eerie synthesizer music plays, and green pulses of electricity dance around a magnified microprocessor on screen, the narrator argues that the new chips are why “Japan is abandoning its ship building, and why our children will grow up without jobs to go to.” The documentary goes on to explore how robots are being used to automate car assembly and how the European watch industry has lost out to digital watch manufacturers in the United States. It castigates the British government for not doing more to prepare the country for a future of mass unemployment. + +The documentary was supposedly shown to the British Cabinet.[4][6] Several government agencies, including the Department of Industry and the Manpower Services Commission, became interested in trying to raise awareness about computers among the British public. The Manpower Services Commission provided funds for a team from the BBC’s education division to travel to Japan, the United States, and other countries on a fact-finding trip. This research team produced a report that cataloged the ways in which microelectronics would indeed mean major changes for industrial manufacturing, labor relations, and office work. In late 1979, it was decided that the BBC should make a ten-part TV series that would help regular Britons “learn how to use and control computers and not feel dominated by them.”[5][7] The project eventually became a multimedia endeavor similar to the _Adult Literacy Project_, an earlier BBC undertaking involving both a TV series and supplemental courses that helped two million people improve their reading. + +The producers behind the _Computer Literacy Project_ were keen for the TV series to feature “hands-on” examples that viewers could try on their own if they had a microcomputer at home. These examples would have to be in BASIC, since that was the language (really the entire shell) used on almost all microcomputers. But the producers faced a thorny problem: Microcomputer manufacturers all had their own dialects of BASIC, so no matter which dialect they picked, they would inevitably alienate some large fraction of their audience. The only real solution was to create a new BASIC—BBC BASIC—and a microcomputer to go along with it. Members of the British public would be able to buy the new microcomputer and follow along without worrying about differences in software or hardware. + +The TV producers and presenters at the BBC were not capable of building a microcomputer on their own. So they put together a specification for the computer they had in mind and invited British microcomputer companies to propose a new machine that met the requirements. The specification called for a relatively powerful computer because the BBC producers felt that the machine should be able to run real, useful applications. Technical consultants for the _Computer Literacy Project_ also suggested that, if it had to be a BASIC dialect that was going to be taught to the entire nation, then it had better be a good one. (They may not have phrased it exactly that way, but I bet that’s what they were thinking.) BBC BASIC would make up for some of BASIC’s usual shortcomings by allowing for recursion and local variables.[6][8] + +The BBC eventually decided that a Cambridge-based company called Acorn Computers would make the BBC Micro. In choosing Acorn, the BBC passed over a proposal from Clive Sinclair, who ran a company called Sinclair Research. Sinclair Research had brought mass-market microcomputing to the UK in 1980 with the Sinclair ZX80. Sinclair’s new computer, the ZX81, was cheap but not powerful enough for the BBC’s purposes. Acorn’s new prototype computer, known internally as the Proton, would be more expensive but more powerful and expandable. The BBC was impressed. The Proton was never marketed or sold as the Proton because it was instead released in December 1981 as the BBC Micro, also affectionately called “The Beeb.” You could get a 16k version for £235 and a 32k version for £335. + +In 1980, Acorn was an underdog in the British computing industry. But the BBC Micro helped establish the company’s legacy. Today, the world’s most popular microprocessor instruction set is the ARM architecture. “ARM” now stands for “Advanced RISC Machine,” but originally it stood for “Acorn RISC Machine.” ARM Holdings, the company behind the architecture, was spun out from Acorn in 1990. + +![Picture of the BBC Micro.][9] _A bad picture of a BBC Micro, taken by me at the Computer History Museum +in Mountain View, California._ + +### The Computer Programme + +A dozen different TV series were eventually produced as part of the _Computer Literacy Project_, but the first of them was a ten-part series known as _The Computer Programme_. The series was broadcast over ten weeks at the beginning of 1982. A million people watched each week-night broadcast of the show; a quarter million watched the reruns on Sunday and Monday afternoon. + +The show was hosted by two presenters, Chris Serle and Ian McNaught-Davis. Serle plays the neophyte while McNaught-Davis, who had professional experience programming mainframe computers, plays the expert. This was an inspired setup. It made for [awkward transitions][10]—Serle often goes directly from a conversation with McNaught-Davis to a bit of walk-and-talk narration delivered to the camera, and you can’t help but wonder whether McNaught-Davis is still standing there out of frame or what. But it meant that Serle could voice the concerns that the audience would surely have. He can look intimidated by a screenful of BASIC and can ask questions like, “What do all these dollar signs mean?” At several points during the show, Serle and McNaught-Davis sit down in front of a computer and essentially pair program, with McNaught-Davis providing hints here and there while Serle tries to figure it out. It would have been much less relatable if the show had been presented by a single, all-knowing narrator. + +The show also made an effort to demonstrate the many practical applications of computing in the lives of regular people. By the early 1980s, the home computer had already begun to be associated with young boys and video games. The producers behind _The Computer Programme_ sought to avoid interviewing “impressively competent youngsters,” as that was likely “to increase the anxieties of older viewers,” a demographic that the show was trying to attract to computing.[7][11] In the first episode of the series, Gill Nevill, the show’s “on location” reporter, interviews a woman that has bought a Commodore PET to help manage her sweet shop. The woman (her name is Phyllis) looks to be 60-something years old, yet she has no trouble using the computer to do her accounting and has even started using her PET to do computer work for other businesses, which sounds like the beginning of a promising freelance career. Phyllis says that she wouldn’t mind if the computer work grew to replace her sweet shop business since she enjoys the computer work more. This interview could instead have been an interview with a teenager about how he had modified _Breakout_ to be faster and more challenging. But that would have been encouraging to almost nobody. On the other hand, if Phyllis, of all people, can use a computer, then surely you can too. + +While the show features lots of BASIC programming, what it really wants to teach its audience is how computing works in general. The show explains these general principles with analogies. In the second episode, there is an extended discussion of the Jacquard loom, which accomplishes two things. First, it illustrates that computers are not based only on magical technology invented yesterday—some of the foundational principles of computing go back two hundred years and are about as simple as the idea that you can punch holes in card to control a weaving machine. Second, the interlacing of warp and weft threads is used to demonstrate how a binary choice (does the weft thread go above or below the warp thread?) is enough, when repeated over and over, to produce enormous variation. This segues, of course, into a discussion of how information can be stored using binary digits. + +Later in the show there is a section about a steam organ that plays music encoded in a long, segmented roll of punched card. This time the analogy is used to explain subroutines in BASIC. Serle and McNaught-Davis lay out the whole roll of punched card on the floor in the studio, then point out the segments where it looks like a refrain is being repeated. McNaught-Davis explains that a subroutine is what you would get if you cut out those repeated segments of card and somehow added an instruction to go back to the original segment that played the refrain for the first time. This is a brilliant explanation and probably one that stuck around in people’s minds for a long time afterward. + +I’ve picked out only a few examples, but I think in general the show excels at demystifying computers by explaining the principles that computers rely on to function. The show could instead have focused on teaching BASIC, but it did not. This, it turns out, was very much a conscious choice. In a retrospective written in 1983, John Radcliffe, the executive producer of the _Computer Literacy Project_, wrote the following: + +> If computers were going to be as important as we believed, some genuine understanding of this new subject would be important for everyone, almost as important perhaps as the capacity to read and write. Early ideas, both here and in America, had concentrated on programming as the main route to computer literacy. However, as our thinking progressed, although we recognized the value of “hands-on” experience on personal micros, we began to place less emphasis on programming and more on wider understanding, on relating micros to larger machines, encouraging people to gain experience with a range of applications programs and high-level languages, and relating these to experience in the real world of industry and commerce…. Our belief was that once people had grasped these principles, at their simplest, they would be able to move further forward into the subject. + +Later, Radcliffe writes, in a similar vein: + +> There had been much debate about the main explanatory thrust of the series. One school of thought had argued that it was particularly important for the programmes to give advice on the practical details of learning to use a micro. But we had concluded that if the series was to have any sustained educational value, it had to be a way into the real world of computing, through an explanation of computing principles. This would need to be achieved by a combination of studio demonstration on micros, explanation of principles by analogy, and illustration on film of real-life examples of practical applications. Not only micros, but mini computers and mainframes would be shown. + +I love this, particularly the part about mini-computers and mainframes. The producers behind _The Computer Programme_ aimed to help Britons get situated: Where had computing been, and where was it going? What can computers do now, and what might they do in the future? Learning some BASIC was part of answering those questions, but knowing BASIC alone was not seen as enough to make someone computer literate. + +### Computer Literacy Today + +If you google “learn to code,” the first result you see is a link to Codecademy’s website. If there is a modern equivalent to the _Computer Literacy Project_, something with the same reach and similar aims, then it is Codecademy. + +“Learn to code” is Codecademy’s tagline. I don’t think I’m the first person to point this out—in fact, I probably read this somewhere and I’m now ripping it off—but there’s something revealing about using the word “code” instead of “program.” It suggests that the important thing you are learning is how to decode the code, how to look at a screen’s worth of Python and not have your eyes glaze over. I can understand why to the average person this seems like the main hurdle to becoming a professional programmer. Professional programmers spend all day looking at computer monitors covered in gobbledygook, so, if I want to become a professional programmer, I better make sure I can decipher the gobbledygook. But dealing with syntax is not the most challenging part of being a programmer, and it quickly becomes almost irrelevant in the face of much bigger obstacles. Also, armed only with knowledge of a programming language’s syntax, you may be able to _read_ code but you won’t be able to _write_ code to solve a novel problem. + +I recently went through Codecademy’s “Code Foundations” course, which is the course that the site recommends you take if you are interested in programming (as opposed to web development or data science) and have never done any programming before. There are a few lessons in there about the history of computer science, but they are perfunctory and poorly researched. (Thank heavens for [this noble internet vigilante][12], who pointed out a particularly egregious error.) The main focus of the course is teaching you about the common structural elements of programming languages: variables, functions, control flow, loops. In other words, the course focuses on what you would need to know to start seeing patterns in the gobbledygook. + +To be fair to Codecademy, they offer other courses that look meatier. But even courses such as their “Computer Science Path” course focus almost exclusively on programming and concepts that can be represented in programs. One might argue that this is the whole point—Codecademy’s main feature is that it gives you little interactive programming lessons with automated feedback. There also just isn’t enough room to cover more because there is only so much you can stuff into somebody’s brain in a little automated lesson. But the producers at the BBC tasked with kicking off the _Computer Literacy Project_ also had this problem; they recognized that they were limited by their medium and that “the amount of learning that would take place as a result of the television programmes themselves would be limited.”[8][13] With similar constraints on the volume of information they could convey, they chose to emphasize general principles over learning BASIC. Couldn’t Codecademy replace a lesson or two with an interactive visualization of a Jacquard loom weaving together warp and weft threads? + +I’m banging the drum for “general principles” loudly now, so let me just explain what I think they are and why they are important. There’s a book by J. Clark Scott about computers called _But How Do It Know?_ The title comes from the anecdote that opens the book. A salesman is explaining to a group of people that a thermos can keep hot food hot and cold food cold. A member of the audience, astounded by this new invention, asks, “But how do it know?” The joke of course is that the thermos is not perceiving the temperature of the food and then making a decision—the thermos is just constructed so that cold food inevitably stays cold and hot food inevitably stays hot. People anthropomorphize computers in the same way, believing that computers are digital brains that somehow “choose” to do one thing or another based on the code they are fed. But learning a few things about how computers work, even at a rudimentary level, takes the homunculus out of the machine. That’s why the Jacquard loom is such a good go-to illustration. It may at first seem like an incredible device. It reads punch cards and somehow “knows” to weave the right pattern! The reality is mundane: Each row of holes corresponds to a thread, and where there is a hole in that row the corresponding thread gets lifted. Understanding this may not help you do anything new with computers, but it will give you the confidence that you are not dealing with something magical. We should impart this sense of confidence to beginners as soon as we can. + +Alas, it’s possible that the real problem is that nobody wants to learn about the Jacquard loom. Judging by how Codecademy emphasizes the professional applications of what it teaches, many people probably start using Codecademy because they believe it will help them “level up” their careers. They believe, not unreasonably, that the primary challenge will be understanding the gobbledygook, so they want to “learn to code.” And they want to do it as quickly as possible, in the hour or two they have each night between dinner and collapsing into bed. Codecademy, which after all is a business, gives these people what they are looking for—not some roundabout explanation involving a machine invented in the 18th century. + +The _Computer Literacy Project_, on the other hand, is what a bunch of producers and civil servants at the BBC thought would be the best way to educate the nation about computing. I admit that it is a bit elitist to suggest we should laud this group of people for teaching the masses what they were incapable of seeking out on their own. But I can’t help but think they got it right. Lots of people first learned about computing using a BBC Micro, and many of these people went on to become successful software developers or game designers. [As I’ve written before][14], I suspect learning about computing at a time when computers were relatively simple was a huge advantage. But perhaps another advantage these people had is shows like _The Computer Programme_, which strove to teach not just programming but also how and why computers can run programs at all. After watching _The Computer Programme_, you may not understand all the gobbledygook on a computer screen, but you don’t really need to because you know that, whatever the “code” looks like, the computer is always doing the same basic thing. After a course or two on Codecademy, you understand some flavors of gobbledygook, but to you a computer is just a magical machine that somehow turns gobbledygook into running software. That isn’t computer literacy. + +_If you enjoyed this post, more like it come out every four weeks! Follow [@TwoBitHistory][15] on Twitter or subscribe to the [RSS feed][16] to make sure you know when a new post is out._ + +_Previously on TwoBitHistory…_ + +> FINALLY some new damn content, amirite? +> +> Wanted to write an article about how Simula bought us object-oriented programming. It did that, but early Simula also flirted with a different vision for how OOP would work. Wrote about that instead! +> +> — TwoBitHistory (@TwoBitHistory) [February 1, 2019][17] + + 1. Robert Albury and David Allen, Microelectronics, report (1979). [↩︎][18] + + 2. Gregg Williams, “Microcomputing, British Style”, Byte Magazine, 40, January 1983, accessed on March 31, 2019, . [↩︎][19] + + 3. John Radcliffe, “Toward Computer Literacy,” Computer Literacy Project Achive, 42, accessed March 31, 2019, [https://computer-literacy-project.pilots.bbcconnectedstudio.co.uk/media/Towards Computer Literacy.pdf][20]. [↩︎][21] + + 4. David Allen, “About the Computer Literacy Project,” Computer Literacy Project Archive, accessed March 31, 2019, . [↩︎][22] + + 5. ibid. [↩︎][23] + + 6. Williams, 51. [↩︎][24] + + 7. Radcliffe, 11. [↩︎][25] + + 8. Radcliffe, 5. [↩︎][26] + + + + +-------------------------------------------------------------------------------- + +via: https://twobithistory.org/2019/03/31/bbc-micro.html + +作者:[Two-Bit History][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://twobithistory.org +[b]: https://github.com/lujun9972 +[1]: tmp.05mfBL4kP8#fn:1 +[2]: tmp.05mfBL4kP8#fn:2 +[3]: tmp.05mfBL4kP8#fn:3 +[4]: https://computer-literacy-project.pilots.bbcconnectedstudio.co.uk/ +[5]: https://twobithistory.org/2018/07/22/dawn-of-the-microcomputer.html +[6]: tmp.05mfBL4kP8#fn:4 +[7]: tmp.05mfBL4kP8#fn:5 +[8]: tmp.05mfBL4kP8#fn:6 +[9]: https://twobithistory.org/images/beeb.jpg +[10]: https://twitter.com/TwoBitHistory/status/1112372000742404098 +[11]: tmp.05mfBL4kP8#fn:7 +[12]: https://twitter.com/TwoBitHistory/status/1111305774939234304 +[13]: tmp.05mfBL4kP8#fn:8 +[14]: https://twobithistory.org/2018/09/02/learning-basic.html +[15]: https://twitter.com/TwoBitHistory +[16]: https://twobithistory.org/feed.xml +[17]: https://twitter.com/TwoBitHistory/status/1091148050221944832?ref_src=twsrc%5Etfw +[18]: tmp.05mfBL4kP8#fnref:1 +[19]: tmp.05mfBL4kP8#fnref:2 +[20]: https://computer-literacy-project.pilots.bbcconnectedstudio.co.uk/media/Towards%20Computer%20Literacy.pdf +[21]: tmp.05mfBL4kP8#fnref:3 +[22]: tmp.05mfBL4kP8#fnref:4 +[23]: tmp.05mfBL4kP8#fnref:5 +[24]: tmp.05mfBL4kP8#fnref:6 +[25]: tmp.05mfBL4kP8#fnref:7 +[26]: tmp.05mfBL4kP8#fnref:8 diff --git a/sources/talk/20190612 When to use 5G, when to use Wi-Fi 6.md b/sources/talk/20190612 When to use 5G, when to use Wi-Fi 6.md index a2271052c9..c7d242ba63 100644 --- a/sources/talk/20190612 When to use 5G, when to use Wi-Fi 6.md +++ b/sources/talk/20190612 When to use 5G, when to use Wi-Fi 6.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (chenmu-kk) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) diff --git a/sources/talk/20190822 How the Linux desktop has grown.md b/sources/talk/20190822 How the Linux desktop has grown.md deleted file mode 100644 index e46b310502..0000000000 --- a/sources/talk/20190822 How the Linux desktop has grown.md +++ /dev/null @@ -1,201 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: ( ) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (How the Linux desktop has grown) -[#]: via: (https://opensource.com/article/19/8/how-linux-desktop-grown) -[#]: author: (Jim Hall https://opensource.com/users/jim-hallhttps://opensource.com/users/jason-bakerhttps://opensource.com/users/jlacroixhttps://opensource.com/users/doni08521059https://opensource.com/users/etc-eterahttps://opensource.com/users/marcobravohttps://opensource.com/users/alanfdoss) - -How the Linux desktop has grown -====== -Since the early 1990s, the Linux desktop has matured from a simple -window manager to a full desktop. Join us on a journey through the -history of the Linux desktop. -![Person typing on a 1980's computer][1] - -I first installed Linux in 1993. At that time, you really didn't have many options for installing the operating system. In those early days, many people simply copied a running image from someone else. Then someone had the neat idea to create a "distribution" of Linux that let you customize what software you wanted to install. That was the Softlanding Linux System (SLS) and my first introduction to Linux. - -My '386 PC didn't have much memory, but it was enough. SLS 1.03 required 2MB of memory to run, or 4MB if you wanted to compile programs. If you wanted to run the X Window System, you needed a whopping 8MB of memory. And my PC had just enough memory to run X. - -As I'd grown up with the command line, a graphical user interface wasn't essential to me. But it sure was convenient. I could run applications in different windows and easily switch between tasks. - -From my first experiment with Linux, I was hooked. I've stuck with Linux on my desktop ever since. Like many people, I ran Linux in a dual-boot configuration for a while so I could jump back to MS-DOS and Windows to run certain programs. Until 1998, when I finally took the plunge and went all-in with Linux. - -Over the last 26 years, I have watched the Linux desktop mature. I've also tried an interesting combination of desktop environments over that time, which I'll share by taking a journey through the history of the Linux desktop. - -### X and window managers - -The first "desktops" on Linux weren't yet desktops. Instead, they were _window managers_ running on the X Window System. X provided the basic building blocks for a graphical user interface, such as creating windows on the screen and providing keyboard and mouse input. By itself, X didn't do much. To make the X graphical environment useful, you needed a way to manage all the windows in your session. That's where the _window manager_ came in. Running an X program like xterm or xclock opens that program in a window. The window manager keeps track of windows and does basic housekeeping, such as letting you move windows around and minimize them. The rest is up to you. You could launch programs when X started by listing them in the **~/.xinitrc** file, but usually, you'd run new programs from an xterm. - -The most common window manager in 1993 was TWM, which dates back to 1988. TWM was quite simple and provided only basic window management. - -![TWM on SLS 1.05][2] - -TWM on SLS 1.05 showing xterm, xclock, and the Emacs editor - -Yet another early window manager was the OpenLook Virtual Window Manager (OLVWM). OpenLook was a graphical user interface developed by Sun Microsystems in the 1980s and later ported to other Unix platforms. As a _virtual_ window manager, OLVWM supported multiple workspaces. - -![OLVWM on SLS 1.05][3] - -OLVWM on SLS 1.05 showing xterm and the Virtual Workspaces selector - -When Linux began to grow in popularity, it didn't take long for others to create new window managers with smoother performance and improved interfaces. The first of these new window managers was FVWM, a virtual window manager. FVWM sported a more modern look than TWM or OLVWM. But we didn't yet have a desktop. - -![FVWM on SLS 1.05][4] - -FVWM on SLS 1.05 showing xterm and a file manager - -To modern eyes, TWM and FVWM may look pretty plain. But it's important to remember what other graphical environments looked like at the time. The then-current version of Windows looked rather simple. Windows versions 1 through 3 used a plain launcher called the Program Manager. - -![Windows 3.11][5] - -Windows 3.11 showing the Program Manager and the Notepad editor - -In August 1995, Microsoft released Windows 95 and changed the modern PC desktop landscape. Certainly, I was impressed. I thought Windows 3.x was ungainly and ugly, but Windows 95 was smooth and pretty. More importantly, Windows 95 was what we now consider a _desktop_. The new desktop metaphor was a huge step forward. You could put icons on the desktop—and in fact, Windows 95 presented two default desktop icons, for My Computer (to open a file manager) and the Recycle Bin (where you put files to be deleted later). - -But more importantly, the Windows 95 desktop meant _integration_. The Program Manager was gone, replaced by a Taskbar at the bottom of the screen that let you launch new programs using a simpler Start menu. The Taskbar was multifunctional and also showed your running programs via a series of buttons and a dock showing the time, speaker volume, and other simple controls. You could right-click on any object on the new desktop, and Windows 95 would present you with a context-sensitive menu with actions you could perform. - -![Windows 95][6] - -Windows 95 showing the Notepad editor - -The Windows 95 interface was slick and much easier to use than previous versions of Windows—and even other Linux window managers. Not to be outdone, Linux developers created a new version of FVWM that mimicked the Windows 95 interface. Called FVWM95, the new window manager still wasn't a desktop, but it looked very nice. The new taskbar let you start new X programs using the Start menu. The taskbar also showed your running programs using buttons similar to Windows 95's. - -![FVWM95 on Red Hat Linux 5.2][7] - -FVWM95 on Red Hat Linux 5.2 showing xterm and a quick-access program launcher with icons for xterm, the file manager, and other programs - -While FVWM95 and other window managers were improving, the core problem remained: Linux didn't really have a desktop. It had a collection of window managers, and that was about it. Linux applications that used a graphical user interface (GUI, pretty much meaning they were X applications) all looked different and worked differently. You couldn't copy and paste from one application to another, except the simple text-only copy/paste provided by the X Window System. What Linux really needed was a complete redo in its GUI to create the first desktop. - -### The first Linux desktop - -In 1996, Matthias Ettrich was troubled by the inconsistency of Linux applications under X. He wanted to make the graphical environment easy to use. And more importantly, he wanted to make everything _integrated_—like an actual desktop. - -Matthias started work on the K Desktop Environment. That's K for "Kool." But the name KDE was also meant to be a play on the Common Desktop Environment (CDE) that was the standard in the "Big Unix" world. Although by 1996, CDE was looking pretty dated. CDE was based on the Motif widget set, which is the same design that FVWM mimicked. Finalized in July 1998, KDE 1.0 was a definite improvement over plain window managers like FVWM95. - -![KDE 1.0][8] - -K Desktop Environment (KDE) version 1.0 - -Image credit: Paul Brown / KDE - -KDE was a big step forward for Linux. Finally, Linux had a true desktop with application integration and more modern desktop icons. KDE's design was not dissimilar from Windows 95. You had a kind-of taskbar along the bottom of the screen that provided the equivalent of Windows 95's Start menu as well as several application shortcuts. KDE also supported virtual desktops, which were cleverly labeled One, Two, Three, and Four. Running applications were represented via buttons in a separate taskbar at the top of the screen. - -But not everyone was happy with KDE. To abstract the GUI from the system, KDE used Trolltech's Qt toolkit library. Unfortunately, Qt was not distributed under a free software license. Trolltech allowed Qt to be used at no charge in free software applications but charged a fee to use it in commercial or proprietary applications. And that dichotomy is not aligned with free software. This caused problems for Linux distributions: Should they include KDE? Or default to an older but free software graphical user interface like FVWM? - -In response, Miguel de Icaza and Federico Mena started work in 1997 on a new Linux desktop. The new project was dubbed GNOME, for GNU Network Object Model Environment. GNOME aimed to be completely free software and used a different toolkit, called GTK, from the GIMP image editor. GTK literally stood for GIMP Tool Kit. When GNOME 1.0 was finally released in 1999, Linux had another modern desktop environment. - -![GNOME 1.0][9] - -GNOME version 1.0 - -Image credit: GNOME Documentation Project - -While it was great to have two desktop environments for Linux, the "KDE versus GNOME" rivalry continued for some time. By 1999, Trolltech re-released the Qt library under a new public license, the Q Public License (QPL). But the new license carried its own baggage—the QPL only applied to Qt's use in open source software projects, not commercial projects. Thus the Free Software Foundation deemed the QPL [not compatible][10] with the GNU General Public License (GNU GPL). This licensing issue would remain until Trolltech re-re-released the Qt library under the GNU GPL version 2 in 2000. - -### Development over time - -The Linux desktop continued to mature. KDE and GNOME settled into a friendly competition that pushed both to add new features and to exchange ideas and concepts. By 2004, both GNOME and KDE had made significant strides, yet brought only incremental changes to the user interface. - -KDE 2 and 3 continued to rely on a taskbar concept at the bottom of the screen but incorporated the buttons for running applications. One of KDE's most visible changes was the addition of the Konqueror browser, which first appeared in KDE 2. - -![KDE 2.2.2 \(2001\) showing the Konqueror browser][11] - -KDE 2.2.2 (2001) showing the Konqueror browser - -Image credit: Paul Brown / KDE - -![KDE 3.2.2][12] - -KDE 3.2.2 (2004) on Fedora Core 2 showing the Konqueror file manager (using a Fedora Core 2 theme) - -GNOME 2 also used a taskbar concept but split the bar into two: a taskbar at the top of the screen to launch applications and respond to desktop alerts, and a taskbar at the bottom of the page to show running applications. On my own, I referred to the two taskbars as "things you can do" (top) and "things are you doing" (bottom). In addition to the streamlined user interface, GNOME also added an updated file manager called Nautilus, developed by Eazel. - -![GNOME 2.6.0][13] - -GNOME 2.6.0 (2004) on Fedora Core 2 showing the Nautilus file manager (using a Fedora Core 2 theme) - -Over time, KDE and GNOME have taken different paths. Both provide a feature-rich, robust, and modern desktop environment—but with different user interface goals. In 2011, there was a major deviation between how GNOME and KDE approached the desktop interface. KDE 4.6 (January 2011) and KDE 4.7 (July 2011) provided a more traditional desktop metaphor while continuing to rely on the taskbar concept familiar to many users. Of course, KDE saw lots of changes under the hood, but the familiar look and feel remained. - -![KDE 4.6][14] - -KDE 4.6 showing the Gwenview image viewer - -Image credit: KDE - -In 2011, GNOME completely changed gears with a new desktop concept. GNOME 3 aimed to create a simpler, more streamlined desktop experience, allowing users to focus on what they were working on. The taskbar disappeared, replaced by a black status bar at the top of the screen that included volume and network controls, displayed the time and battery status, and allowed users to launch new programs via a redesigned menu. - -The menu was the most dramatic change. Clicking the Activities menu or moving the mouse into the Activities "hot corner" showed all open applications as separate windows. Users could also click an Applications tab from the Overview to start a new program. The Overview also provided an integrated search function. - -![GNOME 3.0][15] - -GNOME 3.0 showing the GNOME Pictures application - -Image credit: GNOME - -![GNOME 3.0][16] - -GNOME 3.0 showing the Activities Overview - -Image credit: GNOME - -### Your choice of desktop - -Having two desktops for Linux means users have great choice. Some prefer KDE and others like GNOME. That's fine. Pick the desktop that best suits you. - -To be sure, both KDE and GNOME have fans and detractors. For example, GNOME received a fair bit of criticism for dropping the taskbar in favor of the Activities Overview. Perhaps the most well-known critic was Linus Torvalds, who [loudly denounced and abandoned][17] the new GNOME as an "unholy mess" in 2011—before [moving back][18] to GNOME two years later. - -Others have made similar criticisms of GNOME 3, to the point that some developers forked the GNOME 2 source code to create the MATE desktop. MATE (which stands for MATE Advanced Traditional Environment) continues the traditional taskbar interface from GNOME 2. - -Regardless, there's no doubt that the two most popular Linux desktops today are KDE and GNOME. Their current versions are both very mature and packed with features. Both KDE 5.16 (2019) and GNOME 3.32 (2019) try to simplify and streamline the Linux desktop experience—but in different ways. GNOME 3.32 continues to aim for a minimal appearance, removing all distracting user interface elements so users can focus on their applications and work. KDE 5.16 takes a more familiar approach with the taskbar but has added other visual improvements and flair, especially around improved widget handling and icons. - -![KDE 5.16 Plasma][19] - -KDE 5.16 Plasma - -Image credit: KDE - -![GNOME 3.32][20] - -GNOME 3.32 - -Image credit: GNOME - -At the same time, you don't completely lose out on compatibility. Every major Linux distribution provides compatibility libraries, so you can run applications from, say, KDE while running GNOME. This is immensely useful when an application you really want to use is written for the other desktop environment—not a problem; you can run KDE applications on GNOME and vice versa. - -I don't see this changing anytime soon. And I think that's a good thing. Healthy competition between KDE and GNOME has allowed developers in both camps to push the envelope. Whether you use KDE or GNOME, you have a modern desktop with great integration. And above all, this means Linux has the best feature in free software: choice. - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/19/8/how-linux-desktop-grown - -作者:[Jim Hall][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/jim-hallhttps://opensource.com/users/jason-bakerhttps://opensource.com/users/jlacroixhttps://opensource.com/users/doni08521059https://opensource.com/users/etc-eterahttps://opensource.com/users/marcobravohttps://opensource.com/users/alanfdoss -[b]: https://github.com/lujun9972 -[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/1980s-computer-yearbook.png?itok=eGOYEKK- (Person typing on a 1980's computer) -[2]: https://opensource.com/sites/default/files/uploads/twm-sls105.png (TWM on SLS 1.05) -[3]: https://opensource.com/sites/default/files/uploads/olvwm-sls105.png (OLVWM on SLS 1.05) -[4]: https://opensource.com/sites/default/files/uploads/fvwm-sls105.png (FVWM on SLS 1.05) -[5]: https://opensource.com/sites/default/files/uploads/win311.png (Windows 3.11) -[6]: https://opensource.com/sites/default/files/uploads/win95.png (Windows 95) -[7]: https://opensource.com/sites/default/files/uploads/fvwm95-rh52.png (FVWM95 on Red Hat Linux 5.2) -[8]: https://opensource.com/sites/default/files/uploads/kde1.png (KDE 1.0) -[9]: https://opensource.com/sites/default/files/uploads/gnome10.png (GNOME 1.0) -[10]: https://www.linuxtoday.com/developer/2000090500121OPLFKE -[11]: https://opensource.com/sites/default/files/uploads/kde_2.2.2.png (KDE 2.2.2 (2001) showing the Konqueror browser) -[12]: https://opensource.com/sites/default/files/uploads/kde322-fc2.png (KDE 3.2.2) -[13]: https://opensource.com/sites/default/files/uploads/gnome26-fc2.png (GNOME 2.6.0) -[14]: https://opensource.com/sites/default/files/uploads/kde46.png (KDE 4.6) -[15]: https://opensource.com/sites/default/files/uploads/gnome30.png (GNOME 3.0) -[16]: https://opensource.com/sites/default/files/uploads/gnome30-overview.png (GNOME 3.0) -[17]: https://www.theregister.co.uk/2011/08/05/linus_slams_gnome_three/ -[18]: https://www.phoronix.com/scan.php?page=news_item&px=MTMxNjc -[19]: https://opensource.com/sites/default/files/uploads/kde516.png (KDE 5.16 Plasma) -[20]: https://opensource.com/sites/default/files/uploads/gnome332.png (GNOME 3.32) diff --git a/sources/talk/20190822 Things You Didn-t Know About GNU Readline.md b/sources/talk/20190822 Things You Didn-t Know About GNU Readline.md deleted file mode 100644 index 189f1152b9..0000000000 --- a/sources/talk/20190822 Things You Didn-t Know About GNU Readline.md +++ /dev/null @@ -1,136 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: ( ) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Things You Didn't Know About GNU Readline) -[#]: via: (https://twobithistory.org/2019/08/22/readline.html) -[#]: author: (Two-Bit History https://twobithistory.org) - -Things You Didn't Know About GNU Readline -====== - -I sometimes think of my computer as a very large house. I visit this house every day and know most of the rooms on the ground floor, but there are bedrooms I’ve never been in, closets I haven’t opened, nooks and crannies that I’ve never explored. I feel compelled to learn more about my computer the same way anyone would feel compelled to see a room they had never visited in their own home. - -GNU Readline is an unassuming little software library that I relied on for years without realizing that it was there. Tens of thousands of people probably use it every day without thinking about it. If you use the Bash shell, every time you auto-complete a filename, or move the cursor around within a single line of input text, or search through the history of your previous commands, you are using GNU Readline. When you do those same things while using the command-line interface to Postgres (`psql`), say, or the Ruby REPL (`irb`), you are again using GNU Readline. Lots of software depends on the GNU Readline library to implement functionality that users expect, but the functionality is so auxiliary and unobtrusive that I imagine few people stop to wonder where it comes from. - -GNU Readline was originally created in the 1980s by the Free Software Foundation. Today, it is an important if invisible part of everyone’s computing infrastructure, maintained by a single volunteer. - -### Feature Replete - -The GNU Readline library exists primarily to augment any command-line interface with a common set of keystrokes that allow you to move around within and edit a single line of input. If you press `Ctrl-A` at a Bash prompt, for example, that will jump your cursor to the very beginning of the line, while pressing `Ctrl-E` will jump it to the end. Another useful command is `Ctrl-U`, which will delete everything in the line before the cursor. - -For an embarrassingly long time, I moved around on the command line by repeatedly tapping arrow keys. For some reason, I never imagined that there was a faster way to do it. Of course, no programmer familiar with a text editor like Vim or Emacs would deign to punch arrow keys for long, so something like Readline was bound to be created. Using Readline, you can do much more than just jump around—you can edit your single line of text as if you were using a text editor. There are commands to delete words, transpose words, upcase words, copy and paste characters, etc. In fact, most of Readline’s keystrokes/shortcuts are based on Emacs. Readline is essentially Emacs for a single line of text. You can even record and replay macros. - -I have never used Emacs, so I find it hard to remember what all the different Readline commands are. But one thing about Readline that is really neat is that you can switch to using a Vim-based mode instead. To do this for Bash, you can use the `set` builtin. The following will tell Readline to use Vim-style commands for the current shell: - -``` -$ set -o vi -``` - -With this option enabled, you can delete words using `dw` and so on. The equivalent to `Ctrl-U` in the Emacs mode would be `d0`. - -I was excited to try this when I first learned about it, but I’ve found that it doesn’t work so well for me. I’m happy that this concession to Vim users exists, and you might have more luck with it than me, particularly if you haven’t already used Readline’s default command keystrokes. My problem is that, by the time I heard about the Vim-based interface, I had already learned several Readline keystrokes. Even with the Vim option enabled, I keep using the default keystrokes by mistake. Also, without some sort of indicator, Vim’s modal design is awkward here—it’s very easy to forget which mode you’re in. So I’m stuck at a local maximum using Vim as my text editor but Emacs-style Readline commands. I suspect a lot of other people are in the same position. - -If you feel, not unreasonably, that both Vim and Emacs’ keyboard command systems are bizarre and arcane, you can customize Readline’s key bindings and make them whatever you like. This is not hard to do. Readline reads a `~/.inputrc` file on startup that can be used to configure various options and key bindings. One thing I’ve done is reconfigured `Ctrl-K`. Normally it deletes from the cursor to the end of the line, but I rarely do that. So I’ve instead bound it so that pressing `Ctrl-K` deletes the whole line, regardless of where the cursor is. I’ve done that by adding the following to `~/.inputrc`: - -``` -Control-k: kill-whole-line -``` - -Each Readline command (the documentation refers to them as _functions_) has a name that you can associate with a key sequence this way. If you edit `~/.inputrc` in Vim, it turns out that Vim knows the filetype and will help you by highlighting valid function names but not invalid ones! - -Another thing you can do with `~/.inputrc` is create canned macros by mapping key sequences to input strings. [The Readline manual][1] gives one example that I think is especially useful. I often find myself wanting to save the output of a program to a file, which means that I often append something like `> output.txt` to Bash commands. To save some time, you could make this a Readline macro: - -``` -Control-o: "> output.txt" -``` - -Now, whenever you press `Ctrl-O`, you’ll see that `> output.txt` gets added after your cursor on the command line. Neat! - -But with macros you can do more than just create shortcuts for strings of text. The following entry in `~/.inputrc` means that, every time I press `Ctrl-J`, any text I already have on the line is surrounded by `$(` and `)`. The macro moves to the beginning of the line with `Ctrl-A`, adds `$(`, then moves to the end of the line with `Ctrl-E` and adds `)`: - -``` -Control-j: "\C-a$(\C-e)" -``` - -This might be useful if you often need the output of one command to use for another, such as in: - -``` -$ cd $(brew --prefix) -``` - -The `~/.inputrc` file also allows you to set different values for what the Readline manual calls _variables_. These enable or disable certain Readline behaviors. You can use these variables to change, for example, how Readline auto-completion works or how the Readline history search works. One variable I’d recommend turning on is the `revert-all-at-newline` variable, which by default is off. When the variable is off, if you pull a line from your command history using the reverse search feature, edit it, but then decide to search instead for another line, the edit you made is preserved in the history. I find this confusing because it leads to lines showing up in your Bash command history that you never actually ran. So add this to your `~/.inputrc`: - -``` -set revert-all-at-newline on -``` - -When you set options or key bindings using `~/.inputrc`, they apply wherever the Readline library is used. This includes Bash most obviously, but you’ll also get the benefit of your changes in other programs like `irb` and `psql` too! A Readline macro that inserts `SELECT * FROM` could be useful if you often use command-line interfaces to relational databases. - -### Chet Ramey - -GNU Readline is today maintained by Chet Ramey, a Senior Technology Architect at Case Western Reserve University. Ramey also maintains the Bash shell. Both projects were first authored by a Free Software Foundation employee named Brian Fox beginning in 1988. But Ramey has been the sole maintainer since around 1994. - -Ramey told me via email that Readline, far from being an original idea, was created to implement functionality prescribed by the POSIX specification, which in the late 1980s had just been created. Many earlier shells, including the Korn shell and at least one version of the Unix System V shell, included line editing functionality. The 1988 version of the Korn shell (`ksh88`) provided both Emacs-style and Vi/Vim-style editing modes. As far as I can tell from [the manual page][2], the Korn shell would decide which mode you wanted to use by looking at the `VISUAL` and `EDITOR` environment variables, which is pretty neat. The parts of POSIX that specified shell functionality were closely modeled on `ksh88`, so GNU Bash was going to have to implement a similarly flexible line-editing system to stay compliant. Hence Readline. - -When Ramey first got involved in Bash development, Readline was a single source file in the Bash project directory. It was really just a part of Bash. Over time, the Readline file slowly moved toward becoming an independent project, though it was not until 1994 (with the 2.0 release of Readline) that Readline became a separate library entirely. - -Readline is closely associated with Bash, and Ramey usually pairs Readline releases with Bash releases. But as I mentioned above, Readline is a library that can be used by any software implementing a command-line interface. And it’s really easy to use. This is a simple example, but here’s how you would you use Readline in your own C program. The string argument to the `readline()` function is the prompt that you want Readline to display to the user: - -``` -#include -#include -#include "readline/readline.h" - -int main(int argc, char** argv) -{ - char* line = readline("my-rl-example> "); - printf("You entered: \"%s\"\n", line); - - free(line); - - return 0; -} -``` - -Your program hands off control to Readline, which is responsible for getting a line of input from the user (in such a way that allows the user to do all the fancy line-editing things). Once the user has actually submitted the line, Readline returns it to you. I was able to compile the above by linking against the Readline library, which I apparently have somewhere in my library search path, by invoking the following: - -``` -$ gcc main.c -lreadline -``` - -The Readline API is much more extensive than that single function of course, and anyone using it can tweak all sorts of things about the library’s behavior. Library users can even add new functions that end users can configure via `~/.inputrc`, meaning that Readline is very easy to extend. But, as far as I can tell, even Bash ultimately calls the simple `readline()` function to get input just as in the example above, though there is a lot of configuration beforehand. (See [this line][3] in the source for GNU Bash, which seems to be where Bash hands off responsibility for getting input to Readline.) - -Ramey has now worked on Bash and Readline for well over a decade. He has never once been compensated for his work—he is and has always been a volunteer. Bash and Readline continue to be actively developed, though Ramey said that Readline changes much more slowly than Bash does. I asked Ramey what it was like being the sole maintainer of software that so many people use. He said that millions of people probably use Bash without realizing it (because every Apple device runs Bash), which makes him worry about how much disruption a breaking change might cause. But he’s slowly gotten used to the idea of all those people out there. He said that he continues to work on Bash and Readline because at this point he is deeply invested and because he simply likes to make useful software available to the world. - -_You can find more information about Chet Ramey at [his website][4]._ - -_If you enjoyed this post, more like it come out every four weeks! Follow [@TwoBitHistory][5] on Twitter or subscribe to the [RSS feed][6] to make sure you know when a new post is out._ - -_Previously on TwoBitHistory…_ - -> Please enjoy my long overdue new post, in which I use the story of the BBC Micro and the Computer Literacy Project as a springboard to complain about Codecademy. -> -> — TwoBitHistory (@TwoBitHistory) [March 31, 2019][7] - --------------------------------------------------------------------------------- - -via: https://twobithistory.org/2019/08/22/readline.html - -作者:[Two-Bit History][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://twobithistory.org -[b]: https://github.com/lujun9972 -[1]: https://tiswww.case.edu/php/chet/readline/readline.html -[2]: https://web.archive.org/web/20151105130220/http://www2.research.att.com/sw/download/man/man1/ksh88.html -[3]: https://github.com/bminor/bash/blob/9f597fd10993313262cab400bf3c46ffb3f6fd1e/parse.y#L1487 -[4]: https://tiswww.case.edu/php/chet/ -[5]: https://twitter.com/TwoBitHistory -[6]: https://twobithistory.org/feed.xml -[7]: https://twitter.com/TwoBitHistory/status/1112492084383092738?ref_src=twsrc%5Etfw diff --git a/sources/talk/20190925 Most enterprise networks can-t handle big data loads.md b/sources/talk/20190925 Most enterprise networks can-t handle big data loads.md deleted file mode 100644 index 191900c10a..0000000000 --- a/sources/talk/20190925 Most enterprise networks can-t handle big data loads.md +++ /dev/null @@ -1,66 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: ( ) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Most enterprise networks can't handle big data loads) -[#]: via: (https://www.networkworld.com/article/3440519/most-enterprise-networks-cant-handle-big-data-loads.html) -[#]: author: (Andy Patrizio https://www.networkworld.com/author/Andy-Patrizio/) - -Most enterprise networks can't handle big data loads -====== -As more data moves through the network, efforts to keep up are lagging due to leadership and technology issues. -Metamorworks / Getty Images - -Another week, another survey that finds IT cannot keep up with the ever-expanding data overload. This time the problem surrounds network bandwidth and overall performance. - -[A survey of 300 IT professionals][1] conducted by management consultant firm Accenture found the majority feel their enterprise networks are not up to the task of handling big data and internet of things (IoT) deployments. Only 43% of those companies polled said their networks are ready to support the cloud, IoT, and other digital technologies. - -**[ Learn more about SDN: Find out [where SDN is going][2] and learn the [difference between SDN and NFV][3]. | Get regularly scheduled insights: [Sign up for Network World newsletters][4]. ]** - -A key reason (58%) is a “misalignment between IT and business needs” that is slowing those rollouts. That is an unusual finding, since 85% of respondents also reported that their networks were completely or mostly ready to support the business’ digital initiatives. So which is it? - -The second and third most commonly cited barriers were “inherent complexities between business requirements and operational needs” and “demands for bandwidth, performance, etc. outpacing the ability to deliver” at 45% each. - -Network bottlenecks continue to grow as the sheer amount of data being pumped over the wires continues to increase thanks to analytics and other big data technologies. The survey found that bandwidth demands were not being met and current network performance continues to fall short. - -Other reasons cited were lack of networking skills, device sprawl, and aging equipment. - -### One solution to network performance woes: SDN - -Accenture found that most firms said [software-defined networks (SDN)][5] were the solution for bandwidth and performance challenges, with 77% of those surveyed reporting they were in the process of deploying SDN or have completed the deployment. It qualified that, noting that while SDN may be in place in parts of the organization, it is not always rolled out uniformly enterprise-wide. - -**** From HPE: [ITaaS and Corporate Storage Technology][6]: This blog explains why pay-per-use IT models, such as ITaaS, could be the next chapter in IT infrastructure. (Sponsored) **** - -Now, while it seems no one ever has enough budget for all of their IT ambitions, 31% of those surveyed describe funding network improvements as “easy” and within the network infrastructure team’s control, with CIOs/CTOs being much more likely to report the funding process as “easy” (40%), compared to their direct reports (13%) or directors and vice presidents of infrastructure/network (19%).  - -Saying, "Legacy networks alone cannot support the innovation and performance required in the digital age," the report calls for embracing new technologies, without saying SDN by name. It also called for greater collaboration between the C suite and their direct reports because it was clear there was a disconnect between how the two sides viewed things. - -"We believe a new network paradigm is needed to ensure networks meet current and future business needs. However, although there are signs of progress, the pace of change is slow. Companies must undertake significant work before they achieve a unified and standardized enterprise capability that will offer the bandwidth, performance and security necessary to support business needs today—and tomorrow," the report concluded. - -**[ Now see: [How network pros acquire skills for SDN, programmable networks][7] ]** - -Join the Network World communities on [Facebook][8] and [LinkedIn][9] to comment on topics that are top of mind. - --------------------------------------------------------------------------------- - -via: https://www.networkworld.com/article/3440519/most-enterprise-networks-cant-handle-big-data-loads.html - -作者:[Andy Patrizio][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.networkworld.com/author/Andy-Patrizio/ -[b]: https://github.com/lujun9972 -[1]: https://www.accenture.com/_acnmedia/pdf-107/accenture-network-readiness-survey.pdf#zoom=50 -[2]: https://www.networkworld.com/article/3209131/lan-wan/what-sdn-is-and-where-its-going.html -[3]: https://www.networkworld.com/article/3206709/lan-wan/what-s-the-difference-between-sdn-and-nfv.html -[4]: https://www.networkworld.com/newsletters/signup.html -[5]: https://www.networkworld.com/article/3209131/what-sdn-is-and-where-its-going.html -[6]: https://www.networkworld.com/blog/itaas-and-the-corporate-storage-technology/ -[7]: https://www.networkworld.com/article/3405522/how-network-pros-acquire-skills-for-sdn-programmable-networks.html -[8]: https://www.facebook.com/NetworkWorld/ -[9]: https://www.linkedin.com/company/network-world diff --git a/sources/talk/20191031 A Bird-s Eye View of Big Data for Enterprises.md b/sources/talk/20191031 A Bird-s Eye View of Big Data for Enterprises.md index 23db96ce3d..c62169b830 100644 --- a/sources/talk/20191031 A Bird-s Eye View of Big Data for Enterprises.md +++ b/sources/talk/20191031 A Bird-s Eye View of Big Data for Enterprises.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: (chai-yuan) +[#]: translator: ( ) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) diff --git a/sources/talk/20191105 My first contribution to open source- Making a decision.md b/sources/talk/20191105 My first contribution to open source- Making a decision.md deleted file mode 100644 index 0640ff1cf4..0000000000 --- a/sources/talk/20191105 My first contribution to open source- Making a decision.md +++ /dev/null @@ -1,58 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: ( ) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (My first contribution to open source: Making a decision) -[#]: via: (https://opensource.com/article/19/11/my-first-open-source-contribution-mistake-decisions) -[#]: author: (Galen Corey https://opensource.com/users/galenemco) - -My first contribution to open source: Making a decision -====== -A new open source contributor documents a series of five mistakes she -made starting out in open source. -![Lightbulb][1] - -Previously, I put a lot of [blame on impostor syndrome][2] for delaying my first open source contribution. But there was another factor that I can’t ignore: I can’t make a decision to save my life. And with [millions][3] of open source projects to choose from, choosing one to contribute to is overwhelming. So overwhelming that I would often end up closing my laptop, thinking, "Maybe I’ll just do this another day." - -Mistake number two was letting my fear of making a decision get in the way of making my first contribution. In an ideal world, perhaps I would have come into my open source journey with a specific project in mind that I genuinely cared about and wanted to work on, but all I had was a vague goal of contributing to open source somehow. For those of you in the same position, here are strategies that helped me pick out the right project (or at least a good one) for my contribution. - -### Tools that I used frequently - -At first, I did not think it would be necessary to limit myself to tools or projects with which I was already familiar. There were projects that I had never used before but seemed like appealing candidates because of their active community, or the interesting problems that they solved. - -However, given that I had a limited amount of time to devote to this project, I decided to stick with a tool that I already knew. To understand what a tool needs, you need to be familiar with how it is supposed to work. If you want to contribute to a project that you are unfamiliar with, you need to complete an additional step of getting to know the functionality and goals of the code. This extra load can be fun and rewarding, but it can also double your work time. Since my goal was primarily to contribute, sticking to what I knew was a helpful way to narrow things down. It is also rewarding to give back to a project that you have found useful. - -### An active and friendly community - -When choosing my project, I wanted to feel confident that someone would be there to review the code that I wrote. And, of course, I wanted the person who reviewed my code to be a nice person. Putting your work out there for public scrutiny is scary, after all. While I was open to constructive feedback, there were toxic corners of the developer community that I hoped to avoid. - -To evaluate the community that I would be joining, I checked out the _issues_ sections of the repos that I was considering. I looked to see if someone from the core team responded regularly. More importantly, I tried to make sure that no one was talking down to each other in the comments (which is surprisingly common in issues discussions). I also looked out for projects that had a code of conduct, outlining what was appropriate vs. inappropriate behavior for online interaction. - -### Clear contribution guidelines - -Because this was my first time contributing to open source, I had a lot of questions around the process. Some project communities are excellent about documenting the procedures for choosing an issue and making a pull request. Although I did not select them at the time because I had never worked with the product before, [Gatsby][4] is an exemplar of this practice. - -This type of clear documentation helped ease some of my insecurity about not knowing what to do. It also gave me hope that the project was open to new contributors and would take the time to look at my work. In addition to contribution guidelines, I looked in the issues section to see if the project was making use of the "good first issue" flag. This is another indication that the project is open to beginners (and helps you discover what to work on). - -### Conclusion - -If you don’t already have a project in mind, choosing the right place to make your first open source contribution can be overwhelming. Coming up with a list of standards helped me narrow down my choices and find a great project for my first pull request. - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/19/11/my-first-open-source-contribution-mistake-decisions - -作者:[Galen Corey][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/galenemco -[b]: https://github.com/lujun9972 -[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/lightbulb-idea-think-yearbook-lead.png?itok=5ZpCm0Jh (Lightbulb) -[2]: https://opensource.com/article/19/10/my-first-open-source-contribution-mistakes -[3]: https://github.blog/2018-02-08-open-source-project-trends-for-2018/ -[4]: https://www.gatsbyjs.org/contributing/ diff --git a/sources/talk/20200103 What you need to know about Rust in 2020.md b/sources/talk/20200103 What you need to know about Rust in 2020.md deleted file mode 100644 index ddb91f42ea..0000000000 --- a/sources/talk/20200103 What you need to know about Rust in 2020.md +++ /dev/null @@ -1,73 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: ( ) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (What you need to know about Rust in 2020) -[#]: via: (https://opensource.com/article/20/1/rust-resources) -[#]: author: (Ryan Levick https://opensource.com/users/ryanlevick) - -What you need to know about Rust in 2020 -====== -While many programmers have long used Rust for hobby projects, in 2019, -the language attracted support from major technology companies, as the -top Rust articles on Opensource.com explain. -![Person using a laptop][1] - -[Rust][2] has drawn plenty of attention from programmers on sites like Hacker News for a while. While many have long [loved using the language][3] for hobby projects, it didn't start catching on in industry until 2019, when this really started to change. - -Over the last year, many large companies, including [Microsoft][4], [Facebook][5], and [Intel][6], came out in support of Rust, and many [smaller ones][7] took notice. As the first emcee at [RustFest][8], the largest Rust conference in Europe, in 2016, I didn't meet a single person professionally using Rust who didn't work at Mozilla. Three years later, it seemed like every other person I talked to at RustFest 2019 was using Rust in their day job for another company, whether as a game developer, a backend engineer at a bank, a creator of developer tools, or something else. - -In 2019, Opensource.com also played a role by reporting on the growing interest in Rust. In case you missed them, here are the top articles about Rust on Opensource.com over the last year. - -### Building the virtualization stack of the future with rust-vmm - -Amazon's [Firecracker][9] is the virtualization technology that powers AWS Lambda and Fargate, and it is written completely in Rust. One of the technology's authors, Andreea Florescu, offers insight into Firecracker and its related technologies in [_**Building the virtualization stack of the future with rust-vmm**_][10]. - -Firecracker started life as a fork of Google's [CrosVM][11] but quickly diverged due to the differing needs of the two projects. Despite this, there are many common pieces that are best shared across the project and in any other virtual machine manager (VMM) written in Rust. With that in mind, the [rust-vmm][12] project started as a way for Amazon and Google, as well as Intel and Red Hat, to share common Rust "crates" (i.e., packages) with each other and the rest of the open source community. These include interfaces to KVM (Linux virtualization APIs), Virtio device support, and a kernel loader. - -It's truly amazing to see some of the titans of the software industry working together around a common technology stack written in Rust. Given this and other partnerships around [technology stacks written in Rust][13], I wouldn't be surprised to see more of this in 2020. - -### Why to choose Rust as your next programming language - -Adopting a new language, especially at a large company with a long-established technology stack, is no easy task. I had the pleasure of writing [_**Why to choose Rust as your next programming language**_][14] about how Microsoft is looking into adopting Rust when so many other interesting programming languages have not been considered. - -Choosing a programming language involves many different criteria—from technical to organizational to even emotional. Some of these criteria are easier to measure than others. For instance, it's easier to understand the costs of technical changes, like adapting build systems and building new tooling, than it is to understand organizational or emotional issues like how productive or happy developers will be using this new language. What's more, the easy-to-measure criteria are often cost-related, while the hard-to-measure criteria are often benefits-oriented. This often leads to costs getting more weight in the decision-making process, even though it's not necessarily true that the costs outweigh the benefits—it's just that they're easier to measure. This makes it unlikely for a company to adopt a new language. - -However, one of Rust's largest benefits is how easy it is to measure its ability to write secure yet performant systems software. Given that 70% of severe vulnerabilities at Microsoft are due to memory-safety issues that Rust is designed to prevent, and that these issues cost the company billions of dollars per year, it's easy to measure and understand the benefits of adopting the language. - -Whether full-scale adoption of Rust at Microsoft will happen remains to be seen, but Rust's future is bright if only for the fact that is has a clear and measurable benefit over existing technologies. - -### Rust in 2020 - -Rust is really starting to gain traction in industry. Although it still has a long way to go to reach the popularity of languages like C++. I expect more companies to start adopting Rust in 2020. The Rust community must now set its sights on welcoming people and companies into the community while ensuring that the things that have driven the language to this point remain in place. - -Rust is more than just a compiler and a set of libraries. It's a group of people who care about making systems programming easy, safe, and fun. The coming year will be critical in Rust's journey from a hobbyist language to one of the main languages used in the software industry. - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/20/1/rust-resources - -作者:[Ryan Levick][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/ryanlevick -[b]: https://github.com/lujun9972 -[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/laptop_screen_desk_work_chat_text.png?itok=UXqIDRDD (Person using a laptop) -[2]: http://rust-lang.org/ -[3]: https://insights.stackoverflow.com/survey/2019#technology-_-most-loved-dreaded-and-wanted-languages -[4]: https://youtu.be/o01QmYVluSw -[5]: https://youtu.be/kylqq8pEgRs -[6]: https://youtu.be/l9hM0h6IQDo -[7]: https://oxide.computer/blog/introducing-the-oxide-computer-company/ -[8]: https://rustfest.eu -[9]: https://firecracker-microvm.github.io/ -[10]: https://opensource.com/article/19/3/rust-virtual-machine -[11]: https://chromium.googlesource.com/chromiumos/platform/crosvm/ -[12]: https://github.com/rust-vmm -[13]: https://bytecodealliance.org/ -[14]: https://opensource.com/article/19/10/choose-rust-programming-language diff --git a/sources/talk/20200117 Insights into Why Hyperbola GNU-Linux is Turning into Hyperbola BSD.md b/sources/talk/20200117 Insights into Why Hyperbola GNU-Linux is Turning into Hyperbola BSD.md index a2bca0089f..68ede9acfa 100644 --- a/sources/talk/20200117 Insights into Why Hyperbola GNU-Linux is Turning into Hyperbola BSD.md +++ b/sources/talk/20200117 Insights into Why Hyperbola GNU-Linux is Turning into Hyperbola BSD.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: (Morisun029) +[#]: translator: ( ) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) diff --git a/sources/talk/20200211 Future ‘smart walls- key to IoT.md b/sources/talk/20200211 Future ‘smart walls- key to IoT.md new file mode 100644 index 0000000000..28a4624231 --- /dev/null +++ b/sources/talk/20200211 Future ‘smart walls- key to IoT.md @@ -0,0 +1,74 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Future ‘smart walls’ key to IoT) +[#]: via: (https://www.networkworld.com/article/3519440/future-smart-walls-key-to-iot.html) +[#]: author: (Patrick Nelson https://www.networkworld.com/author/Patrick-Nelson/) + +Future ‘smart walls’ key to IoT +====== +MIT researchers are developing a wallpaper-like material that’s made up of simple RF switch elements and can be applied to building surfaces. Using beamforming, the antenna array could potentially improve wireless signal strength nearly tenfold. +Jason Dorfman, MIT CSAIL + +IoT equipment designers shooting for efficiency should explore the potential for using buildings as antennas, researchers say. + +Environmental surfaces such as walls can be used to intercept and beam signals, which can increase reliability and data throughput for devices, according to MIT's Computer Science and Artificial Intelligence Laboratory ([CSAIL][1]). + +Researchers at CSAIL have been working on a smart-surface repeating antenna array called RFocus. The antennas, which could be applied in sheets like wallpaper, are designed to be incorporated into office spaces and factories. Radios that broadcast signals could then become smaller and less power intensive. + +[[Get regularly scheduled insights by signing up for Network World newsletters.]][2] + +“Tests showed that RFocus could improve the average signal strength by a factor of almost 10,” CSAIL's Adam Conner-Simons [writes in MIT News][3]. “The platform is also very cost-effective, with each antenna costing only a few cents.” + +The prototype system CSAIL developed uses more than 3,000 antennas embedded into sheets, which are then hung on walls. In future applications, the antennas could adhere directly to the wall or be integrated during building construction. + +“People have had things completely backwards this whole time,” the article claims. “Rather than focusing on the transmitters and receivers, what if we could amplify the signal by adding antennas to an external surface in the environment itself?” + +RFocus relies on [beamforming][4]; multiple antennas broadcast the same signal at slightly different times, and as a result, some of the signals cancel each other and some strengthen each other. When properly executed, beamforming can focus a stronger signal in a particular direction. + +[][5] + +"The surface does not emit any power of its own," the developers explain in their paper ([PDF][6]). The antennas, or RF switch elements, as the group describes them, either let a signal pass through or reflect it through software. Signal measurements allow the apparatus to define exactly what gets through and how it’s directed. + +Importantly, the RFocus surface functions with no additional power requirements. The “RFocus surface can be manufactured as an inexpensive thin ‘wallpaper’ requiring no wiring,” the group says. + +### Antenna design + +Antenna engineering is turning into a vital part of IoT development. It's one of the principal reasons data throughput and reliability keeps improving in wireless networks. + +Arrays where multiple, active panel components make up antennas, rather than a simple passive wire, as is the case in traditional radio, is an example of advancements in antenna engineering. + +[Spray-on antennas][7] (unrelated to the CSAIL work) is another in-the-works technology I've written about. In that case, flexible substrates create the antenna, which is applied in a manner that's similar to spray paint. Another future direction could be anti-laser antennas: [Reversing a laser][8], where the laser becomes an absorber of light rather than the sender of it, could allow all data-carrying energy to be absorbed, making it the perfect light-based antenna. + +Development of 6G wireless, which is projected to supersede 5G sometime around 2030, includes efforts to figure out how to directly [couple antennas to fiber][9]—the radio ends up being part of the cable, in other words. + +"We can’t get faster internet speeds without more efficient ways of delivering wireless signals," CSAIL’s Conner-Simons says. + +Join the Network World communities on [Facebook][10] and [LinkedIn][11] to comment on topics that are top of mind. + +-------------------------------------------------------------------------------- + +via: https://www.networkworld.com/article/3519440/future-smart-walls-key-to-iot.html + +作者:[Patrick Nelson][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.networkworld.com/author/Patrick-Nelson/ +[b]: https://github.com/lujun9972 +[1]: https://www.csail.mit.edu/ +[2]: https://www.networkworld.com/newsletters/signup.html +[3]: http://news.mit.edu/2020/smart-surface-smart-devices-mit-csail-0203 +[4]: https://www.networkworld.com/article/3445039/beamforming-explained-how-it-makes-wireless-communication-faster.html +[5]: https://www.networkworld.com/article/3440100/take-the-intelligent-route-with-consumption-based-storage.html?utm_source=IDG&utm_medium=promotions&utm_campaign=HPE21620&utm_content=sidebar ( Take the Intelligent Route with Consumption-Based Storage) +[6]: https://drive.google.com/file/d/1TLfH-r2w1zlGBbeeM6us2sg0yq6Lm2wF/view +[7]: https://www.networkworld.com/article/3309449/spray-on-antennas-will-revolutionize-the-internet-of-things.html +[8]: https://www.networkworld.com/article/3386879/anti-lasers-could-give-us-perfect-antennas-greater-data-capacity.html +[9]: https://www.networkworld.com/article/3438337/how-6g-will-work-terahertz-to-fiber-conversion.html +[10]: https://www.facebook.com/NetworkWorld/ +[11]: https://www.linkedin.com/company/network-world diff --git a/sources/talk/20200211 Who should lead the push for IoT security.md b/sources/talk/20200211 Who should lead the push for IoT security.md new file mode 100644 index 0000000000..a8d028ad33 --- /dev/null +++ b/sources/talk/20200211 Who should lead the push for IoT security.md @@ -0,0 +1,75 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Who should lead the push for IoT security?) +[#]: via: (https://www.networkworld.com/article/3526490/who-should-lead-the-push-for-iot-security.html) +[#]: author: (Jon Gold https://www.networkworld.com/author/Jon-Gold/) + +Who should lead the push for IoT security? +====== +Industry groups and governmental agencies have been taking a stab at rules to improve the security of the internet of things, but so far there’s nothing comprehensive. +Thinkstock + +The ease with which internet of things devices can be compromised, coupled with the potentially extreme consequences of breaches, have prompted action from legislatures and regulators, but what group is best to decide? + +Both the makers of [IoT][1] devices and governments are aware of the security issues, but so far they haven’t come up with standardized ways to address them. + +[[Get regularly scheduled insights by signing up for Network World newsletters.]][2] + +“The challenge of this market is that it’s moving so fast that no regulation is going to be able to keep pace with the devices that are being connected,” said Forrester vice president and research director Merritt Maxim. “Regulations that are definitive are easy to enforce and helpful, but they’ll quickly become outdated.” + +The latest such effort by a governmental body is a proposed regulation in the U.K. that would impose three major mandates on IoT device manufacturers that would address key security concerns: + + * device passwords would have to be unique, and resetting them to factory defaults would be prohibited + * device makers would have to offer a public point of contact for the disclosure of vulnerabilities + * device makers would have to “explicitly state the minimum length of time for which the device will receive security updates” + + + +This proposal is patterned after a California law that took effect last month. Both sets of rules would likely have a global impact on the manufacture of IoT devices, even though they’re being imposed on limited jurisdictions. That’s because it’s expensive for device makers to create separate versions of their products. + +IoT-specific regulations aren’t the only ones that can have an impact on the marketplace. Depending on the type of information a given device handles, it could be subject to the growing list of data-privacy laws being implemented around the world, most notably Europe’s General Data Protection Regulation, as well as industry-specific regulations in the U.S. and elsewhere. + +The U.S. Food and Drug Administration, noted Maxim, has been particularly active in trying to address device-security flaws. For example, last year it issued [security warnings][3] about 11 vulnerabilities that could compromise medical IoT devices that had been discovered by IoT security vendor [Armis][4]. In other cases it issued fines against healthcare providers. + +**[ [Prepare to become a Certified Information Security Systems Professional with this comprehensive online course from PluralSight. Now offering a 10-day free trial!][5] ]** + +But there’s a broader issue with devising definitive regulation for IoT devices in general, as opposed to prescriptive ones that simply urge manufacturers to adopt best practices, he said. + +Particular companies might have integrated security frameworks covering their vertically integrated products – such as an [industrial IoT][6] company providing security across factory floor sensors – but that kind of security is incomplete in the multi-vendor world of IoT. + +Perhaps the closest thing to a general IoT-security standard is currently being worked on by Underwriters Laboratories (UL), the security-testing non-profit best known for its century-old certification program for electrical equipment. UL’s [IoT Security Rating Program][7] offers a five-tier system for ranking the security of connected devices – bronze, silver, gold, platinum and diamond. + +Bronze certification means that the device has addressed the most glaring security flaws, similar to those outlined in the recent U.K. and California legislations. [The higher ratings][8] include capabilities like ongoing security maintenance, improved access control and known threat testing. + +While government regulation and voluntary industry improvements can help keep future IoT systems safe, neither addresses two key issues in the IoT security puzzle – the millions of insecure devices that have already been deployed, and user apathy around making their systems as safe as possible, according to Maxim. + +“Requiring a non-default passwords is good, but that doesn’t stop users from setting insecure passwords,” he warned. “The challenge is, do customers care? Are they willing to pay extra for products with that certification?” + +Join the Network World communities on [Facebook][9] and [LinkedIn][10] to comment on topics that are top of mind. + +-------------------------------------------------------------------------------- + +via: https://www.networkworld.com/article/3526490/who-should-lead-the-push-for-iot-security.html + +作者:[Jon Gold][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.networkworld.com/author/Jon-Gold/ +[b]: https://github.com/lujun9972 +[1]: https://www.networkworld.com/article/3207535/what-is-iot-the-internet-of-things-explained.html +[2]: https://www.networkworld.com/newsletters/signup.html +[3]: https://www.fda.gov/medical-devices/safety-communications/urgent11-cybersecurity-vulnerabilities-widely-used-third-party-software-component-may-introduce +[4]: https://www.armis.com/ +[5]: https://pluralsight.pxf.io/c/321564/424552/7490?u=https%3A%2F%2Fwww.pluralsight.com%2Fpaths%2Fcertified-information-systems-security-professional-cisspr +[6]: https://www.networkworld.com/article/3243928/what-is-the-industrial-internet-of-things-essentials-of-iiot.html +[7]: https://ims.ul.com/iot-security-rating-levels +[8]: https://www.cnx-software.com/2019/12/30/ul-iot-security-rating-system-ranks-iot-devices-security-from-bronze-to-diamond/ +[9]: https://www.facebook.com/NetworkWorld/ +[10]: https://www.linkedin.com/company/network-world diff --git a/sources/talk/20200211 Why innovation can-t happen without standardization.md b/sources/talk/20200211 Why innovation can-t happen without standardization.md new file mode 100644 index 0000000000..53e82ccde6 --- /dev/null +++ b/sources/talk/20200211 Why innovation can-t happen without standardization.md @@ -0,0 +1,91 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Why innovation can't happen without standardization) +[#]: via: (https://opensource.com/open-organization/20/2/standardization-versus-innovation) +[#]: author: (Len Dimaggio https://opensource.com/users/ldimaggi) + +Why innovation can't happen without standardization +====== +Balancing standardization and innovation is critical during times of +organizational change. And it's an ongoing issue in open organizations, +where change is constant. +![and old computer and a new computer, representing migration to new software or hardware][1] + +Any organization facing the prospect of change will confront an underlying tension between competing needs for standardization and innovation. Achieving the correct balance between these needs can be essential to an organization's success. + +Experiencing too much of either can lead to morale and productivity problems. Over-stressing standardization, for example, can have a stifling effect on the team's ability to innovate to solve new problems. Unfettered innovation, on the other hand, can lead to time lost due to duplicated or misdirected efforts. + +Finding and maintaining the correct balance between standardization and innovation is critical during times of organizational change. In this article, I'll outline various considerations your organization might make when attempting to strike this critical balance. + +### The need for standardization + +When North American beavers hear running water, they instinctively start building a dam. When some people see a problem, they look to build or buy a new product or tool to solve that problem. Technological advances make modeling business process solutions or setting up production or customer-facing systems much easier than in the past. The ease with which organizational actors can introduce new systems can occasionally, however, lead to problems. Duplicate, conflicting, or incompatible systems—or systems that, while useful, do not address a team's highest priorities—can find their way into organizations, complicating processes. + +This is where standardization can help. By agreeing on and implementing a common set of tools and processes, teams become more efficient, as they reduce the need for new development methods, customized training, and maintenance. + +Standardization has several benefits: + + * **Reliability, predictability, and safety.** Think about the electricity in your own home and the history of electrical systems. In the early days of electrification, companies competed to establish individual standards for basic elements like plug configurations and safety requirements like insulation. Thanks to standardization, when you buy a light bulb today you can be sure that it will fit and not start a fire. + * **Lower costs and more dependable, repeatable processes.** Standarsization frees people in organizations to focus more attention on other things—products, for instance—and not on the need to coordinate the use of potentially conflicting new tools and processes. And it can make people's skills more portable (or, in budgeting terms more "fungible") across projects, since all projects share a common set of standards. In addition to helping project teams be more flexible, this portability of skills makes it easier for people to adopt new assignments. + * **Consistent measurements.** Creating a set of consistent metrics people can use to assess product quality across multiple products or multiple releases of individual products is possible through standardization. Without it, applying this kind of consistent measurement to product quality and maintaining any kind of history of tracking such quality can be difficult. Standardization effectively provides the organization a common language for measuring quality. + + + +A danger of standardization arises when it becomes an all-consuming end in itself. A constant push to standardize can result in it inadvertently stifling creativity and innovation. If taken too far, policies that over emphasize standardization appear to discourage support for people's need to find new solutions to new problems. Taken to an extreme, this can lead to a suffocating organizational atmosphere in which people are reluctant to propose new solutions in the interest of maintaining standardization or conformity. In an open organization especially focused on generating new value and solutions, an attempt to impose standardization can have a negative impact on team morale. + +Viewing new challenges through the lens of former solutions is natural. Likewise, it's common (and in fact generally practical) to apply legacy tools and processes to solving new problems. + +But in open organizations, change is constant. We must always adapt to it. + +Finding and maintaining the correct balance between standardization and innovation is critical during times of organizational change. + +### The need for innovation + +Digital technology changes at a rapid rate, and that rate of change is always increasing. New opportunities result in new problems that require new solutions. Any organization must be able to adapt and its people must have the freedom to innovate. This is even more important in an open organization and with open source source software, as many of the factors (e.g., restrictive licenses) that blocked innovation in the past no longer apply. + +When considering the prospect of innovation in your organization, keep in mind the following: + + * **Standardization doesn't have to be the end of innovation.** Even tools and processes that are firmly established and in use by an organization were once very new and untried, and they only came about through processes of organizational innovation. + * **Progress through innovation also involves failure.** It's very often the case that some innovations fail, but when they fail, they point the way forward to solutions. This progress therefore requires that an organization protect the freedom to fail. (In competitive sports, athletes and teams seldom learn lessons from easy victories; they learn lessons about how to win, including how to innovate to win, from failures and defeats.) + + + +Freedom to innovate, however, cannot be freedom to do whatever the heck we feel like doing. The challenge for any organization is to be able to encourage and inspire innovation, but at the same time to keep innovation efforts focused towards meeting your organization's goals and to address the problems that you're trying to solve. + +In closed organizations, leaders may be inclined to impose rigid, top-down limits on innovation. A better approach is to instead provide a direction or path forward in terms of goals and deliverables, and then enable people to find their own ways along that path. That forward path is usually not a straight line; [innovation is almost never a linear process][2]. Like a sailboat making progress into the wind, it's sometimes [necessary to "tack" or go sideways][3] in order to make forward progress. + +### Blending standardization with focused innovation + +Are we doomed to always think of standardization as the broccoli we must eat, while innovation is the ice cream we want to eat? + +Are we doomed to always think of standardization as the broccoli we _must_ eat, while innovation is the ice cream we _want_ to eat? + +It doesn't have to be this way. + +Perceptions play a role in the conflict between standardization and innovation. People who only want to focus on standardization must remember that even the tools and processes that they want to promote as "the standard" were once new and represented change. Likewise, people who only want to focus on innovation have to remember that in order for a tool or process to provide value to an organization, it has to be stable enough for that organization to use it over time. + +An important element of any successful organization, especially an open organization where everyone is free to express their views, is empathy for other people's views. A little empathy is necessary for understanding both perceptions of impending change. + +I've always thought about standardization and innovation as being two halves of one solution. A good analogy is that of college course catalog. In many colleges, all incoming first-year students regardless of their major will take a core set of classes. These core classes can cover a wide range of subjects and provide each student with an educational foundation. Every student receives a standard grounding in these disciplines regardless of their major course of study. Beyond the standardized core curriculum, then, each student is free to take specialized courses depending upon his or her major degree requirements and selected elective courses, as they work to innovate in their respective fields. + +Similarly, standardization provides a foundation on which innovation can build. Think of standardization as a core set of tools and practices you might applied to _all_ products. Innovation can take the form of tools and practices that go _above and beyond_ this standard. This will enable every team to extend the core set of standardized tools and processes to meet the individual needs of their own specific projects. Standardization does not mean that all forward-looking actions stop. Over time, what was an innovation can become a standard, and thereby make room for the next innovation (and the next). + +-------------------------------------------------------------------------------- + +via: https://opensource.com/open-organization/20/2/standardization-versus-innovation + +作者:[Len Dimaggio][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/ldimaggi +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/migration_innovation_computer_software.png?itok=VCFLtd0q (and old computer and a new computer, representing migration to new software or hardware) +[2]: https://opensource.com/open-organization/19/6/innovation-delusion +[3]: https://opensource.com/open-organization/18/5/navigating-disruption-1 diff --git a/sources/talk/20200212 A SASE Crash Course.md b/sources/talk/20200212 A SASE Crash Course.md new file mode 100644 index 0000000000..88e85a9c15 --- /dev/null +++ b/sources/talk/20200212 A SASE Crash Course.md @@ -0,0 +1,67 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (A SASE Crash Course) +[#]: via: (https://www.networkworld.com/article/3526455/a-sase-crash-course.html) +[#]: author: (Cato Networks https://www.networkworld.com/author/Matt-Conran/) + +A SASE Crash Course +====== +Get up to speed fast on the Secure Access Service Edge, an emerging converged networking and security category that Gartner has labelled transformational. +peshkov + +2020! What could better motivate you to push ahead with your resolutions and organization’s digital transformation than a new year AND a new decade. As you put together your digital strategy, check out a new transformation-empowering (and transformational) technology category Gartner coined the [Secure Access Service Edge][1] or SASE (pronounced “Sassy”). SASE converges wide area networking and identity-based security into a cloud service targeted directly to your branch offices, mobile users, cloud services, and even IoT devices, wherever they happen to be. The result: consistently high WAN performance, security, productivity, agility, and flexibility across the global, mobile, cloud-enabled enterprise. + +To jumpstart your research into one of the few networking categories Gartner has labelled “transformational,” we’ve put together a very workable SASE crash course and reading list. Each lesson helps you dig a little deeper into SASE, so you can develop a good grasp of its components and transformational potential. + +**Lesson 1: SASE as Defined by Gartner** + +So, what is SASE exactly and why should you care? SASE was coined by [Gartner][2] analysts Neil McDonald and Joe Skorupa in a [July 29, 2019 Networking Hype Cycle][3] [Market Trends Report, How to Win as WAN Edge and Security Converge into the Secure Access Service Edge][4] and an August 30, 2019 [Gartner][2] report, The Future of Network Security is in the Cloud. If you don’t have access to these reports, Cato quotes the highlights of the former word for word in this short blog: [The Secure Access Service Edge (SASE), as Described in Gartner’s Hype Cycle for Enterprise Networking, 2019][5]. It’s a great place to get started on exactly what Gartner has to say about SASE and its drivers, likely development, and place in the digitally transforming enterprise. There are also some valuable links to more information on SASE and exactly how the Cato cloud fits into the SASE trend. + +**Lesson 2: What SASE _Is_ and What It _Isn’t_** + +After Gartner piques your interest, get some valuable insight from Cato in this blog: [The Secure Access Service Edge (SASE): Here’s Where Your Digital Business Network Starts][6]. Here you can learn why convergence of wide area networking and security is absolutely vital for the agile, digitally transforming enterprise and why legacy data center-centric solutions can’t deliver any more in a world of user mobility and the cloud. This blog breaks down the four essential attributes of SASE—identity driven, cloud native, support for all edges, and globally distributed—in detail. It also explains why SASE is _not_ anything like telco-managed services and summarizes how Cato delivers SASE effectively. + +**Lesson 3: How Cato Delivers SASE** + +Sometimes visual/audio-based learning can bring things into better focus than straight text, and few people are better at explaining WAN and security concepts than Yishay Yovel, Cato Network’s Chief Marketing Officer. In this short, 17-minute video presentation, [Intro to SASE by Yishay][7], Yishay digs into Gartner’s take on SASE, why WAN and security need to converge, and why SASE is one of only three (out of 29) Networking Hype Cycle categories that Gartner has labeled “transformational.” Yishay gets into a lot of nitty-gritty SASE details and offers valuable perspective on how Cato Networks delivers a complete cloud-native SASE software stack that supports all edges and is identity-driven, scalable, flexible, and easy to deploy and manage. Yishay also explains clearly why some of the other WAN and security solutions out there don’t fulfill some essential requirements of SASE, such as processing traffic close to the source. For visual learners, there are also some great architectural diagrams. + +**Lesson 4: Gartner Webinar Breaks Down SASE and its Implications** + +You’ve heard it from Yishay, now hear it from Gartner’s VP Distinguished Analyst Neil MacDonald _and_ Yishay in this 37-minute [Gartner Webinar: Is SASE the Future of SD-WAN and Network Security][8]? MacDonald explains SASE elements and drivers in depth, why SASE belongs in the cloud, how enterprises will adopt SASE, and how organizations should evaluate SASE offerings. There’s some good detail here on how SASE works in different contexts and scenarios, such as a mobile employee connecting to Salesforce securely from the airport, a contractor accessing a Web application from an unmanaged device, and even wind turbines collecting and aggregating data and sending it to the cloud for processing. Neil digs into core SASE requirements and recommends additional services and some other useful options. Yishay then takes over with why Cato is the world’s first true SASE platform. + +**Lesson 5: The White Paper** + +But wait, there’s more. Here’s a clear and concise white paper from Cato, [The Network for the Digital Business Starts with the Secure Access Service Edge][9]. This is a good piece to give out to the other digital transformation stakeholders in your business if you want them to get up to speed on SASE fast. It’s a quick read that explains why the digital, mobile, cloud-enabled business needs a new converged network/security model. It also covers the four elements of SASE, core SASE capabilities, SASE benefits, and clear examples of what SASE _isn’t_ and why. It describes the features that make Cato one of the most comprehensive SASE offerings on the market. It’s a clear, concise presentation broken into short paragraphs and bullet points to provide a fast introduction to SASE and the Cato Cloud. + +**Lesson 6: Icing on the Cake: The Short and Sweet Video** + +[SASE (Secure Access Service Edge)][10] is a short YouTube video to go along with the white paper, combining perspective and information from Gartner and Cato on why you need SASE simplicity for your digital transforming business. + +We hope you have a happy, healthy, transforming New Year. To accelerate your organization’s digital transformation over the next decade, get up to speed on SASE with these useful blogs, videos, and white papers and find out how SASE can help you make that transformation happen quickly and more easily. + +-------------------------------------------------------------------------------- + +via: https://www.networkworld.com/article/3526455/a-sase-crash-course.html + +作者:[Cato Networks][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.networkworld.com/author/Matt-Conran/ +[b]: https://github.com/lujun9972 +[1]: http://www.catonetworks.com/sase?utm_source=idg +[2]: https://en.wikipedia.org/wiki/Gartner +[3]: https://www.gartner.com/en/documents/3947237 +[4]: https://www.gartner.com/en/documents/3953690/market-trends-how-to-win-as-wan-edge-and-security-conver +[5]: https://www.catonetworks.com/blog/the-secure-access-service-edge-sase-as-described-in-gartners-hype-cycle-for-enterprise-networking-2019/ +[6]: https://www.catonetworks.com/blog/the-secure-access-service-edge-sase?utm_source=idg +[7]: https://catonetworks.wistia.com/medias/kn86smj7q4 +[8]: https://go.catonetworks.com/VOD-REG-Gartner-SASE?utm_source=idg +[9]: https://go.catonetworks.com/The-Network-Starts-with-SASE?utm_source=idg +[10]: https://www.youtube.com/watch?v=gLN4NUbjml8 diff --git a/sources/talk/20200213 Server sales projected to decline 10- due to coronavirus.md b/sources/talk/20200213 Server sales projected to decline 10- due to coronavirus.md new file mode 100644 index 0000000000..32852586e1 --- /dev/null +++ b/sources/talk/20200213 Server sales projected to decline 10- due to coronavirus.md @@ -0,0 +1,63 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Server sales projected to decline 10% due to coronavirus) +[#]: via: (https://www.networkworld.com/article/3526605/server-sales-projected-to-decline-10-due-to-coronavirus.html) +[#]: author: (Andy Patrizio https://www.networkworld.com/author/Andy-Patrizio/) + +Server sales projected to decline 10% due to coronavirus +====== +Demand isn’t tapering off, but China is grinding to a halt under the strain of the pandemic. +Writerfantast / Getty Images + +Global server sales had been projected to grow by 1.2% compared to the most recent quarter, but the chaos wrought by the coronavirus in China will cause sales to decline 9.8% sequentially, according to DigiTimes Research. + +DigiTimes is an IT publication based in Taiwan. Its proximity to Taiwanese and Chinese vendors gives it some good sources, but it can also be way off target. However, the signs are piling up that coronavirus is causing some real mayhem. + +For example, DigiTimes also [reported][1] that less than 20% of Chinese factory employees would return to work after an extended Lunar New Year break due to the coronavirus outbreak, and that many components plants in China have decided not to restart production until February 25. + +**[ Now read: [What is quantum computing (and why enterprises should care)][2] ]** + +The Lunar New Year was January 25, so that means Chinese factories have been idle for a month. That’s a lot of supply not being answered, and DigiTimes notes that server demand from large data centers remained strong in the first quarter of 2020. + +Facebook in particular is interested in buying high-density models from white box vendors like Wiwynn and Quanta Computer, but due to the outbreak, these orders, which were originally scheduled for shipment this quarter, have been postponed. + +So it’s not like an economic crash is causing sales to go off a cliff like in 2008. Demand is there, but China can’t make the product right now. This year was expected to be a good year for the server vendors, with all of them projecting sales increases over last year. AMD is ramping up Epyc production, and Intel is expected to release its next-generation “Ice Lake” Xeon platform in the third or the fourth quarter of 2020. + +The good news here is that Wuhan isn’t a major tech manufacturing hub. It does have five display fabs, both LCD and OLED, but so does Shanhai. However, Wuhan has the most advanced display fabs, producing flexible OLEDs, and has the largest capacity, according to David Hsieh, senior director, displays, at Omdia. + +**[ [Get certified as an Apple Technical Coordinator with this seven-part online course from PluralSight.][3] ]** + +Vladimir Galabov, principal analyst for data-center compute in Omdia’s cloud and data-center research practice, also expects to see server shipments impacted by the coronavirus driving a prolonged holiday period in China. + +“I think the majority of the hit will be in the Chinese market,” he said. “This does impact server shipments globally as China represents about 30% of server shipments worldwide. So, I expect the quarterly decline to be more significant than the seasonal 10%. I expect that China will have a 5% additional downward impact on the growth.” + +He added that Q4 of 2019 did significantly overachieve his expectations due to cloud service providers making massive purchases. Omdia expected servers shipped in 2019 to be flat compared to 2018 based on data from 1Q19-3Q19. Instead, it was up 2% to 3% for the year, thanks to the fourth-quarter spurt. + +And servers aren’t the only products taking a hit. DigiTimes says that should the outbreak of the coronavirus last until June, sales of smartphones in the country would be slashed by about 30%, from a projected 400 million units to 280 million units in 2020. + +Also, Mobile World Congress in Barcelona is cancelled due to concerns about the global coronavirus outbreak. The [official cancellation][4] came after a number of big-name companies, including Intel, Cisco, Amazon, Sony, NTT Docomo LG, ZTE, Nvidia, and Ericsson, bowed out of various events that were set for the show.  + +Join the Network World communities on [Facebook][5] and [LinkedIn][6] to comment on topics that are top of mind. + +-------------------------------------------------------------------------------- + +via: https://www.networkworld.com/article/3526605/server-sales-projected-to-decline-10-due-to-coronavirus.html + +作者:[Andy Patrizio][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.networkworld.com/author/Andy-Patrizio/ +[b]: https://github.com/lujun9972 +[1]: https://www.digitimes.com/news/a20200210VL202.html +[2]: https://www.networkworld.com/article/3275367/what-s-quantum-computing-and-why-enterprises-need-to-care.html +[3]: https://pluralsight.pxf.io/c/321564/424552/7490?u=https%3A%2F%2Fwww.pluralsight.com%2Fpaths%2Fapple-certified-technical-trainer-10-11 +[4]: https://www.mwcbarcelona.com/attend/safety-security/gsma-statement-on-mwc-2020/ +[5]: https://www.facebook.com/NetworkWorld/ +[6]: https://www.linkedin.com/company/network-world diff --git a/sources/talk/20200215 3 steps for product marketing your open source project.md b/sources/talk/20200215 3 steps for product marketing your open source project.md new file mode 100644 index 0000000000..5f73f72bb2 --- /dev/null +++ b/sources/talk/20200215 3 steps for product marketing your open source project.md @@ -0,0 +1,115 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (3 steps for product marketing your open source project) +[#]: via: (https://opensource.com/article/20/2/product-marketing-open-source-project) +[#]: author: (Kevin Xu https://opensource.com/users/kevin-xu) + +3 steps for product marketing your open source project +====== +Marketing an open source project is mainly about education, and +traditional marketing techniques do not apply. +![People meeting][1] + +I frequently get questions from open source project creators or new founders of commercial open source software (COSS) companies about the best way to market their product. Implicit in that inquiry lies more foundational questions: "What the hell is product marketing? How much time should I spend on it?" + +This article aims to share some knowledge and specific action items to help open source creators understand product marketing as a concept and how to bootstrap it on their own until a project reaches the next level of traction. + +### What is product marketing? + +Product marketing for COSS is materially different from product marketing for proprietary software and from general marketing practices like ads, lead generation, sponsorships, booths at conferences and trade shows, etc. Because the source code is open for all to see and the project's evolutionary history is completely transparent, you need to articulate—from a technical level to a technical audience—how and why your project works. + +Using the word "marketing" in this context is, in fact, misleading. It's really about product _education_. Your role is more like a coach, mentor, or teaching assistant in a computer science class or a code bootcamp than a "marketing person." + +Proprietary software products rarely need this level of technical education because no one can see the source code anyway. Therefore, these companies focus on educating their audience about the product's business value, not its technical advantages. + +To build a successful open source project (and any commercial product that may be derived from it), you must educate your audience on _both_ its technical details and business value. + +While this may sound like extra work, it's an advantage inherent to COSS because so much buying power for technology products is shifting to developers. They care deeply about technical details and want to see and understand the source code. Being able to learn, appreciate, and have confidence in a project's technical design, architecture, and future roadmap are key to its adoption. + +Also, developers often treat open source technology as a way to scratch their technical itch and stay sharp in a fast-moving technology landscape. It's an audience that yearns for education, above all. + +Being able to speak to an audience that has these goals and desires is what product marketing and education in the COSS context is all about. + +### How to bootstrap product marketing + +So you (or maybe one or two other engineers) are laboring away to create your open source project, likely in the evening after your day job or on the weekends. How do you bootstrap some effective product marketing on your own? + +I recommend a three-step process to yield the best return for your time: + + 1. Peruse online forums + 2. Write content + 3. Do in-person meetups + + + +#### Online forums + +Rummaging through forums—from general ones like HackerNews and Reddit to ones like Discourse or Slack channels geared to projects that are closely related to what you are building—is a great way to figure out what questions developers have in your space. Starting with this step is less about inserting your project into the discussion and more about gathering ideas on what you should focus on when putting together educational materials about your project. + +Effectively, what you are doing is akin to "listening to your customer." + +Let's be honest; you already spend a lot of time on these forums anyway. The only change is one of mindset, not behavior: Have more focus, jot ideas down actively, practice absorbing critiques (you may see threads critical of your project), and develop some intuition about what developers are thinking about. + +This step assumes you don't already have an active community where developers are asking questions directly. The long-term goal is to build your own community, and good product marketing directly helps with this. + +#### Write + +Now that you have gathered some ideas, it's time to produce some content. Compared to formats like videos and podcasts, _writing_ is the highest-leveraged medium. It has the best long-tail benefits, is most suited for ongoing reference material, and can be most easily repackaged into other mediums. Another factor: open source has a global audience, many of whom might speak English as a second (third, or fourth) language, and written content is easily consumable at a person's own pace. + +Focus your writing on three categories that answer three fundamental questions: + + * What problem does your project solve? In other words: _Why should it exist?_ + * How is the project architected, and why is it done that way? _Is this a technically well-designed solution that has potential, thus worth investing time in?_ + * How do I get a taste of it? _How quickly can I get some value out of it?_ This is crucial to reducing your time-to-value metric to the shortest amount possible. For more on this topic, please read my article [_A framework for building products from open source projects_][2]. + + + +A smart way to begin is by writing three blog posts, each addressing one of the three points. The posts should be canonical to your specific project so that repackaging them into different formats (e.g., slide decks, Quora answers, Twitter threads, podcast interviews, etc.) for different channels should be straightforward. + +After you publish the posts, work the materials into your GitHub, GitLab, Bitbucket, or other repository along with the project's documentation. This is important because your public repo will likely be the face of your project for a long time, even if also you have a dedicated website. A repo with strong educational content will go a long way in building your social proof in the form of stars, forks, and downloads and may even yield some contributions. + +One note on writing: Be patient! Your words likely won't go viral overnight (unless you are a celebrity developer). But if the material is educational, useful, and accessible (no need for fancy language), it will draw attention to your project in time. You do your part, and let Google's SEO algorithm do its part. + +#### In-person meetups + +With a few posts out in the wild, the next step is to find an in-person meetup where you can give a presentation about your project using your writing as foundational material to build a compelling talk. + +You may wonder: "Why? Isn't doing something in-person the biggest time suck? I'd rather code!" + +True. You are not wrong. I recommend this step _specifically_ at this moment, not earlier or later, because you'll get feedback on your output more quickly than what the internet can give. Comments and feedback on your posts will trickle in, but giving a talk at a meetup, taking questions, and chatting with attendees afterward over pizza is valuable and immediate. + +The goal is not to shamelessly pitch your project (reminder: you are an educator, not a marketer), but to listen for the kinds of questions you get when you put your project (and yourself) out there. Another benefit is that it gives you practice delivering presentations, which will become important as your project grows, and you need to present in higher-stakes situations, including large conferences, demos with prospective users, etc. + +I know this may not be practical if you don't live in a tech hub where meetups are aplenty. You may want to look for groups that are open to doing virtual meetups via video or work this into your existing travel plans. (But don't fly across the world to talk at one meetup.) + +In-person meetups can feel scary. Public speaking is not for everyone, and it's a legitimate source of fear. My main tips: Just think of yourself as free entertainment, lower your expectations, don't overthink it, and offer yourself up to meetup organizers proactively because they will love you! Having been both a presenter and a meetup organizer, I know developer-focused meetups are very hungry for good technical education. + +### Final words + +There's a lot more nuance, strategy, and sheer work to effective product marketing, but I hope this post gives you enough guidance and specific action items to bootstrap it. Ultimately, you should still spend the bulk of your time building your technology. And if you have some revenue or funding, it's worth hiring someone who has deep expertise in product marketing, even as a part-time adviser. + +Frankly, product marketing talent is hard to find. You need someone with both the technical chops and curiosity to learn about your project on a deep level and the communication skills to compellingly tell the world about it. + +* * * + +_This article originally appeared on [COSS Media][3] and is republished with permission._ + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/2/product-marketing-open-source-project + +作者:[Kevin Xu][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/kevin-xu +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/people_team_community_group.png?itok=Nc_lTsUK (People meeting) +[2]: https://opensource.com/article/19/11/products-open-source-projects +[3]: https://coss.media/open-source-creator-product-marketing/ diff --git a/sources/talk/20200215 The Background Story of AppImage -Interview.md b/sources/talk/20200215 The Background Story of AppImage -Interview.md new file mode 100644 index 0000000000..d3e95a1a0f --- /dev/null +++ b/sources/talk/20200215 The Background Story of AppImage -Interview.md @@ -0,0 +1,128 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (The Background Story of AppImage [Interview]) +[#]: via: (https://itsfoss.com/appimage-interview/) +[#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/) + +The Background Story of AppImage [Interview] +====== + +As a Linux user, you might have come across [AppImages][1]. This is a portable packaging format that allows you to run an application on any Linux distribution. + +[Using AppImage][2] is really simple. You just need to give it execute permission and double click to run it, like the .exe files in Windows. This solves a major problem in Linux as different kind of distributions have different kind of packaging formats. You cannot [install .deb files][3] (of Debian/Ubuntu) on [Fedora][4] and vice versa. + +We talked to Simon, the developer of AppImage, about how and why he created this project. Read some of the interesting background story and insights Simon shares about AppImage. + +### Interacting with Simon Peter, the creator of AppImage + +![][5] + +_**It’s FOSS: Few people know about the person behind AppImage. How about sharing a little background information about yourself?**_ + +**Simon:** Hi, I’m Simon Peter, based near Frankfurt in Germany. My background is in Economics and Business Administration, but I’ve always been a tinkerer and hacker in my free time, and been working in tech ever since I graduated. + +AppImage, though, is strictly a hobby which I enjoy working on in my spare time. I do a lot of my AppImage work while I’m on a train going from here to there. Somehow I seem to be on the move all the time. Professionally, I work in the product management of a large telecommunications company. + +_**It’s FOSS: Why did you create AppImage?**_ + +**Simon:** The first computer I could get my hands on was a [Macintosh][6] in the late 80s. For me, this is the benchmark when it comes to simplicity and usability. When I started to experiment with Linux on the desktop, I always wished it was as elegant and simple to operate and gave me as much flexibility as the early Macs. + +When I tried Linux for the first time in the late 90s, I had to go through a cumbersome process formatting and partitioning hard disks, installing stuff – it took a lot of time and was really cumbersome. A couple of years later, I tried out a Linux Live CD-ROM. It was a complete game changer. You popped in the CD, booted the computer, and everything just worked, right out of the box. No installation, no configuration. The system was always in factory-new state whenever you rebooted the machine. Exactly how I liked it. + +There was only one downside: You could not install additional applications on a read-only CD. Packages always insisted on writing in /usr, where the Live CD was not writeable. Thus, I asked myself: Why can’t I just put applications wherever I want, like on a USB drive or a network share, as I am used from the Mac? How cool would it be if every application was just one single file that I could put wherever I want? And thus the idea for AppImage was born (back then under the name of “klik”). + +Turns out that over time Live systems have become more capable, but I still like the simplicity and freedom that comes with the “one app = one file” idea. For example, I want to be in control of where stuff resides on my hard disks. I want to decide what to update or not to update and when. For most tasks I need a stable, rarely-changing operating system with the latest applications. To this day all I ever run are Live systems, because the operating system “just works” out of the box without any installation or configuration on my side, and every time I reboot the machine I have a “factory new”, known-good state. + +_**It’s FOSS: What challenges did you face in the past and what challenges are you facing right now?**_ + +**Simon:** People told me that the idea was nuts, and I had no clue how “things are done on Linux”. Just about when I was beginning to give in, I came across a video of [Linus Torvalds][7] of all people who I noticed was complaining about many of the same things that I always had felt were too complicated when it came to distributing applications for Linux. While I was watching his rant, I also noticed, hey, AppImage actually solves many of those issues. Some time later, Linus came across AppImage, and he apparently liked the idea. That made me think, maybe it’s not that stupid an idea as people had made me believe all the time up to that point. + +Today, people tend to mention AppImage as “one of the new package formats” together with [Snap][8] and [Flatpak][9]. I think that’s comparing apples to oranges. Not only is AppImage not “new” (it’s been around since well over a decade by now), but also it has very different objectives and design principles than the other systems. AppImage is all about single-file application bundles that can be “managed” by nothing else than a web browser and a file manager. It’s meant for “mere morals”, end users, not system administrators. It needs no package manager, it needs no root rights, it needs nothing to be installed on the system. It gives complete freedom to application developers and users. + +_**It’s FOSS: AppImage is a “universal packaging system” and there you compete with Snap (backed by Ubuntu) and Flatpak (backed by Fedora). How do you plan to ‘fight’ against these big corporates?**_ + +**Simon:** See? That’s what I mean. AppImage plays in an entirely different playing field. + +AppImage wants to be what exe files or PortableApps are for Windows and what apps inside dmg files are on the Mac – but better. + +Besides, Snap (backed by [Canonical][10]) does not work out-of-the-box on Fedora, and Flatpak (backed by [Red Hat][11]) does not work out-of-the-box on Ubuntu. AppImages can run on either system, and many more, without the need to install anything. + +_**It’s FOSS: How do you see the adoption of AppImage? Are you happy with its growth?**_ + +**Simon:** As of early 2020, there are now around 1,000 official AppImages made by the respective application authors that are passing my compatibility tests and can run on the oldest still-supported Ubuntu LTS release, and hundreds more are being worked on as we speak. “Household name” applications like Inkscape, Kdenlive, KDevelop, LibreOffice, PrusaSlicer, Scribus, Slic3r, Ultimaker Cura (too many to name them all) are being distributed in AppImage format. This makes me very happy and I am always excited when I read about a new version being released on Twitter, and then am able to download and run the AppImage instantly, without having to wait for my Linux distribution to carry that new version, and without having to throw away the old (known-good) version just because I want to try out the new (bleeding edge) one. + +The adoption of AppImage is especially strong for nightly and continuous builds. This is because the “one app = one file” concept of AppImage lends itself especially well to try-out software, where you keep multiple versions around for testing purposes, and never have to install anything into the running system. Worst thing that can happen with AppImage is that an application does not launch. In that case, file a bug, delete the file, done. Worst thing that can happen with distribution packages: complete system breakage… + +_**It’s FOSS: One major issue with AppImage is that not all the developers provide an easy way of updating the AppImage versions. Any suggestions for handling it?**_ + +**Simon:** AppImage has this concept of “binary delta updates”. Think of it as “diff for applications”. A new version of an application comes out, you download only the parts that have changed, and apply them to the old version. As a result, you get both the old and the new version and can keep them in parallel until you have determined that you don’t need the old version any longer, and throw it away. + +In general, I don’t want to enforce anything with AppImage. Application authors are at liberty to control the whole experience. Up to now, application authors have to do some setup work to make AppImages with this update capability. That being said, I am convinced that if we make it easy enough for developers to get working binary delta updates “for free”, then many will offer them. To this end, I am currently working on a new set of tools written in Go that will set up updates almost automatically, and I hope this will significantly increase the percentage of AppImages that come with this capability. + +_**It’s FOSS: [Nitrux][12] is one of the rare distributions that relies heavily on AppImage. Or there any other such distributions? What can be done make AppImage more popular?**_ + +**Simon:** Linux distributions traditionally have thought of themselves as more than just the base operating system itself – they also wanted to control application distribution. Now, as Apple and Microsoft are trying to get more control over application distribution on their desktop platforms, the trend is slowly reversing in Linux land where people are slowly beginning to understand that distributions could be much more polished if they focused on the base operating system and left the packaging of applications to the application authors. + +To make AppImage more popular, I think users and application authors should continue to spread the word that upstream-provided AppImages are in many cases working better than distribution packages. With AppImage, you get a software stack where the application author had a chance to cherry-pick which versions of libraries work together, test and tune both functionality and performance. Who is surprised that the result tends to work better than a “random” combination of whatever versions happened to be in a Linux distribution at a certain, random point in time when a distribution release was put together? + +[Desktop environments][13] could greatly increase usability, not only for AppImages, but also for any other kind of “side-loaded” applications that are not being installed. Just see how a desktop environments handles double-clicking on an executable file that is missing the executable bit. Some are doing a great job in this regard, like [Deepin Linux][14]. Stuff tends to “just work” there as it should. + +Finally, I am currently working on a new set of tools written in Go which I hope will greatly simplify, and make yet more enjoyable, the production and consumption of AppImages. My goal here is to make things less complex for users, remove the need for configuration, make things “just work”, like on the early Macintoshes. Are there any Go developers out here interested to join the effort? + +_**It’s FOSS: I can see there is a website that lists available AppImage applications. Do you have plans to integrate it with other software managers on Linux or create a software manager for AppImage?**_ + +**Simon:** [appimage.github.io][15] lists AppImages that have passed my compatibility tests on the oldest still-supported Ubuntu LTS release. Projects creating app stores or software managers are free to use this data. Myself, I am not much interested in those things as I always download AppImages right from the respective project’s download pages. My typical AppImage discovery goes like this: + + 1. Read on Twitter that PrusaSlicer has this cool new feature + 2. Go to the PrusaSlicer GitHub project and read the release notes there + 3. While there, download the AppImage and have it running a few seconds later + + + +So for me personally, I have no need for app centers and app stores, but if people like them, they are free to put AppImages in there. I just never felt the need… + +_**It’s FOSS: What plans do you have for AppImage in future (new features that you plan to add)?**_ + +**Simon:** Simplify things even more, remove configuration options, make things “just work”. Reduce the number of GitHub projects needed to get the core AppImage experience for producing and consuming AppImages, including aspects like binary delta updates, sandboxing, etc. Improve usability. + +_**It’s FOSS: Does AppImage project makes money? What kind of support (if any) do you seek from the end users?**_ + +**Simon:** No, AppImage makes no money whatsoever. + +I’ll just request the readers to spread the word. Tell your favorite application’s authors that you’d like to see an AppImage, and why. + +* * * + +Team It’s FOSS congratulates Simon for his hard work. Please feel free to convey any message and queries to him in the comment section. + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/appimage-interview/ + +作者:[Abhishek Prakash][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/abhishek/ +[b]: https://github.com/lujun9972 +[1]: https://appimage.org/ +[2]: https://itsfoss.com/use-appimage-linux/ +[3]: https://itsfoss.com/install-deb-files-ubuntu/ +[4]: https://getfedora.org/ +[5]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/02/appimage_simon_interview.jpg?ssl=1 +[6]: https://en.wikipedia.org/wiki/Macintosh +[7]: https://itsfoss.com/linus-torvalds-facts/ +[8]: https://itsfoss.com/install-snap-linux/ +[9]: https://flatpak.org/ +[10]: https://canonical.com/ +[11]: https://www.redhat.com/en +[12]: https://itsfoss.com/nitrux-linux-overview/ +[13]: https://itsfoss.com/best-linux-desktop-environments/ +[14]: https://www.deepin.org/en/ +[15]: https://appimage.github.io/ diff --git a/sources/talk/20200216 Minicomputers and The Soul of a New Machine.md b/sources/talk/20200216 Minicomputers and The Soul of a New Machine.md new file mode 100644 index 0000000000..c1e68b1a8d --- /dev/null +++ b/sources/talk/20200216 Minicomputers and The Soul of a New Machine.md @@ -0,0 +1,95 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Minicomputers and The Soul of a New Machine) +[#]: via: (https://opensource.com/article/20/2/minicomputers-and-soul-new-machine) +[#]: author: (Matthew Broberg https://opensource.com/users/mbbroberg) + +Minicomputers and The Soul of a New Machine +====== +The new season of Command Line Heroes begins with a story of increases +in memory, company politics, and a forgotten technology at the heart of +our computing history. +![Command Line Heroes season 4 episode 1 covers the rise of minicomputers][1] + +The [Command Line Heroes podcast][2] is back, and this season it covers the machines that run all the programming languages [I covered last season][3]. As the podcast staff puts it: + +"This season, we'll look at what happens when idealistic teams come together to build visionary machines. Machines made with leaps of faith and a lot of hard, often unrecognized, work in basements and stifling cubicles. Machines that brought teams together and changed us as a society in ways we could only dream of." + +This first episode looks at the non-fiction book (and engineering classic), [_The Soul of a New Machine_][4], to look at a critical moment in computing history. It covers the transition from large, hulking mainframes to the intermediate step of the minicomputer, which will eventually lead us to the PC revolution that we're still living in the wake of. + +### The rise of minicomputers + +One of the most important machines on the path to modern machines, most of us have since forgotten: the minicomputer. + +It was a crucial link in the evolution from mainframe to PC (aka microcomputer). It was also extremely important in the development of software that would fuel the PC revolution, chiefly the operating system. The PDP-7 and PDP-11—on which [UNIX was developed][5]—were examples of minicomputers. So was the machine at the heart of _The Soul of the New Machine_. + +This episode takes us back to this important time in computing and explores this forgotten machine—both in terms of its hardware and software. + +From 1963 to 1977, minicomputers were 12 to 16-bit machines from computing giants DEC ([PDP][6]) and rival upstart [Data General][7] ([Nova][8], [Eclipse][9]). But in October 1977, DEC unveiled the VAX 11/780, a 32-bit CPU built from transistor-transistor logic with a five megahertz cycle-time and 2 megabytes of memory. The VAX launched DEC [into second place][10] in the largest computer company in the world. + +The jump from a 12-bit to a 32-bit CPU is a jump from 4,096 bytes to 4,294,967,296 bytes of data. That increase massively increased the potential for software to do complex tasks while drastically shrinking the size of the computer. And with a 32-bit CPU, the VAX was nearly as powerful as an IBM/360 mainframe—but much smaller and much, much less expensive. + +[The episode][11] goes into the drama that unfolds as teams within Data General race to have the most marketable minicomputer while working through company politics and strong personalities. + +### Revisiting _The Soul of a New Machine_ + +_The Soul of a New Machine_ was written in 1981 by Tracy Kidder, and chronicles a small group of engineers at the now-former tech company, Data General, as they attempt to compete with a rival internal group and create a 32-bit minicomputer as a skunkworks project known as "Eagle." For those okay with spoilers, the computer would eventually be known as the [Eclipse MV/8000][12]. + +Earlier this year, [Jessie Frazelle][13], of Docker, Go, and Kubernetes fame, and [Bryan Cantrill][14], known for [DTrace][15], Joyent, and many other technologies, publicly wrote about reading the non-fiction classic. As it's written, Cantrill mentioned the book to Frazelle, who read it and then wrote an enthusiastic [blog post][16] about the book. As Frazelle put it: + +"Personally, I look back on the golden age of computers as the time when people were building the first personal computers in their garage. There is a certain whimsy of that time fueled with a mix of hard work and passion for building something crazy with a very small team. In today's age, at large companies, most engineers take jobs where they work on one teeny aspect of a machine or website or app. Sometimes they are not even aware of the larger goal or vision but just their own little world. + +In the book, a small team built an entire machine… The team wasn't driven by power or greed, but by accomplishment and self-fulfillment. They put a part of themselves in the machine, therefore, producing a machine with a soul…The team was made up of programmers with the utmost expertise and experience and also with new programmers." + +Inspired by Frazelle's reaction, Cantrill re-read it and wrote [a blog article][17] about it and writes this beautiful note: + +"…_The Soul of a New Machine_ serves to remind us that the soul of what we build is, above all, shared — that we do not endeavor alone but rather with a group of like-minded individuals." + +Frazelle's and Cantrill's reading of the book and blog [sparked a wave of people][18] exploring and talking about this text. While it remains on my book list, this dialogue-by-book-review is at the heart of the CLH season 4 as it explores the entire machine. + +### Why did the minicomputer go the way of the Neanderthal? + +As we all know, minicomputers are not a popular purchase in today's technology market. Minicomputers ended up being great technology for timesharing. The irony is that they unwittingly sealed their own fate. The Internet, which started off as ARPANET, was basically a new kind of timesharing. They were so good at timesharing that at one point, the DEC PDP 11 accounted for over 30% of the nodes on ARPANET. Minicomputers were powering their own demise.* + +Minicomputers paved the way for smaller computers and for more and more people to have access to these powerful, society-changing machines. But I'm getting ahead of myself. Keep listening to the [new season of Command Line Heroes][2] to continue the story of machines in computing history. + +* * * + +What's your minicomputer story? I'd love to read them in the comments. + +(There were, of course, other factors leading to the end of this era. Minicomputers were fighting at the low end of the market with the rise of microcomputers, while Unix systems continued to push into the midrange market. The rise of the Internet was perhaps its final blow.) + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/2/minicomputers-and-soul-new-machine + +作者:[Matthew Broberg][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/mbbroberg +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/command-line-heroes-minicomputers-s4-e1.png?itok=FRaff5i6 (Command Line Heroes season 4 episode 1 covers the rise of minicomputers) +[2]: https://www.redhat.com/en/command-line-heroes +[3]: https://opensource.com/article/19/6/command-line-heroes-python +[4]: https://en.wikipedia.org/wiki/The_Soul_of_a_New_Machine +[5]: https://opensource.com/19/9/command-line-heroes-bash +[6]: https://en.wikipedia.org/wiki/PDP +[7]: https://en.wikipedia.org/wiki/Data_General +[8]: https://en.wikipedia.org/wiki/Data_General_Nova +[9]: https://en.wikipedia.org/wiki/Data_General_Eclipse +[10]: http://www.old-computers.com/history/detail.asp?n=20&t=3 +[11]: https://www.redhat.com/en/command-line-heroes/season-4/minicomputers +[12]: https://en.wikipedia.org/wiki/Data_General_Eclipse_MV/8000 +[13]: https://twitter.com/jessfraz?lang=en +[14]: https://en.wikipedia.org/wiki/Bryan_Cantrill +[15]: https://en.wikipedia.org/wiki/DTrace +[16]: https://blog.jessfraz.com/post/new-golden-age-of-building-with-soul/ +[17]: http://dtrace.org/blogs/bmc/2019/02/10/reflecting-on-the-soul-of-a-new-machine/ +[18]: https://twitter.com/search?q=jessfraz%20soul%20new%20machine&src=typed_query&f=live diff --git a/sources/talk/20200218 Building a community of practice in 5 steps.md b/sources/talk/20200218 Building a community of practice in 5 steps.md new file mode 100644 index 0000000000..c763a78660 --- /dev/null +++ b/sources/talk/20200218 Building a community of practice in 5 steps.md @@ -0,0 +1,99 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Building a community of practice in 5 steps) +[#]: via: (https://opensource.com/article/20/2/building-community-practice-5-steps) +[#]: author: (Tracy Buckner https://opensource.com/users/tracyb) + +Building a community of practice in 5 steps +====== +A community of practice can kickstart innovation in your organization. +Here's how to build one—and ensure it thrives. +![Blocks for building][1] + +In the [first part of this series][2], we defined community as a fundamental principle in open organizations, where people often define their roles, responsibilities, and affiliations through shared interests and passions, [not title, role, or position on an organizational chart][3]. Then, in the [second part of the series][4], we explored the many benefits communities of practice bring to open organizations—including fostering learning, encouraging collaboration, and offering an opportunity for creative problem-solving and innovation. + +Now you know you'd like to _start_ a community of practice, but you may still be unsure _where_ to start. This article will help define your roadmap and build a plan for a successful community of practice—in five simple steps (summarized in Figure 1). + +![][5] + +### Step 1: Obtain executive sponsorship + +While having a community manager focused on the day-to-day execution of community matters is important, an executive sponsor is also integral to the success of the community of practice. Typically, an executive sponsor will shoulder higher-level responsibilities, such as focusing on strategy and creating conditions for success (rather than implementation). + +An executive sponsor can help ensure the community's goals are aligned with the overall strategy of the organization. This person can also communicate those goals and gather support for the community from other senior executives (potentially instrumental in securing financial support and resources for the community!). + +Finding the right sponsor is important for the success of the program. An executive leader committed to fostering open culture, transparency, and collaboration will be very successful. Alternatively, you may wish to tap an executive focused on finding new ways to grow and reskill high-potential employees. + +### Step 2: Determine mission and goals + +Once you've established a vision for the community, you'll need to develop its mission statement. This is critical to your success because the mission begins explaining _how you'll achieve that vision_. Primarily, your community's mission should be to share knowledge, promote learning in a particular area, and align that work with organizational strategy. However, the mission statement may also include references to the audience that the community will serve. + +Here's one example mission statement: + +> _To identify and address needs within the cloud infrastructure space in support of the organization’s mission of defining the next generation of open hybrid cloud._ + +After articulating a mission like this, you'll need to set specific goals for achieving it. The goals can be long- or short-term, but in either case, you'll need to provide a clear roadmap explaining to community members what the community is trying to achieve. + +### Step 3: Build a core team + +Building a core team is essential to the success of a community. In a typical community of practice—or "CoP," for short—you'll notice four main roles: + + * CoP program manager + * CoP manager + * Core team members + * Members + + + +The **CoP program manager** is the face of the community. This person is primarily responsible for supporting the managers and core teams by resolving questions, issues, and concerns. The program manager also guides new communities and evangelizes the communities of practice program inside the organization. + +The **CoP manager** determines community strategy based on business and community needs. This person makes the latest news, content, and events available to community members and ensures that the CoP remains focused on its goals. This person also schedules regular meetings for members and shares other events that may be of interest to them. + +The **CoP core team** is responsible for managing community collateral and best practices to meet the community's goals. The core team supports CoP manager(s) and assists with preparing and leading community meetings. + +**Members** of a community attend meetings, share relevant content and best practices, and support the core team and manager(s) in reaching community goals. + +### Step 4: Promote knowledge management + +Communities of practice produce information—and members must be able to easily access and share that information. So it's important to develop a knowledge-management system for storing that information in a way that keeps it relevant and timely. + +Communities of practice produce information—and members must be able to easily access and share that information. So it's important to develop a knowledge-management system for storing that information in a way that keeps it relevant and timely. + +Over time, your community of practice will likely generate a lot of content. Some of that content may be duplicated, outdated or simply no longer relevant to the community. So it's important to periodically conduct a ROT Analysis of the content validating that the content is not **R**edundant, **O**utdated, or **T**rivial. Consider conducting a ROT analysis every six months or so, in order to keep the content fresh and relevant. + +A number of different content management tools can assist with maintaining and displaying the content for community members. Some organizations use an intranet, while others prefer more robust content management such as [AO Docs][6] or [Drupal][7]. + +### Step 5: Engage in regular communication + +The secret to success in maintaining a community of practice is regular communication and collaboration. Communities that speak with each other frequently and share knowledge, ideas, and best practices are most likely to remain intact. CoP managers should schedule regular meetings, meet-ups, and content creation sessions to ensure that members are engaged in the community. It is recommended to have at least a monthly meeting to maintain communication with the community members. + +Chat/messaging apps are also a great tool for facilitating regular communication in communities of practice. These apps offer teams across the globe the ability to communicate in real-time, removing some collaboration boundaries. Members can pose questions and receive answers immediately, without the delay of sending and receiving emails. And should the questions arise again, most messaging apps also provide an easy search mechanism that can help members discover answers. + +### Building your community + +Remember: A community of practice is a cost-effective way to foster learning, encourage collaboration, and promote innovation in an organization. In [_The Open Organization_][8], Jim Whitehurst argues that "the beauty of an open organization is that it is not about pedaling harder, but about tapping into new sources of power both inside and outside to keep pace with all the fast-moving changes in your environment." Building communities of practice are the perfect way to do just that: stop pedaling harder and to tap into new sources of power within your organization. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/2/building-community-practice-5-steps + +作者:[Tracy Buckner][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/tracyb +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/blocks_building.png?itok=eMOT-ire (Blocks for building) +[2]: https://opensource.com/open-organization/19/11/what-is-community-practice +[3]: https://opensource.com/open-organization/resources/open-org-definition +[4]: https://opensource.com/open-organization/20/1/why-build-community-of-practice +[5]: https://opensource.com/sites/default/files/resize/images/open-org/comm_practice_5_steps-700x440.png +[6]: https://www.aodocs.com/ +[7]: https://www.drupal.org/ +[8]: https://opensource.com/open-organization/resources/what-open-organization diff --git a/sources/talk/20200219 A -399 device that translates brain signals into digital commands.md b/sources/talk/20200219 A -399 device that translates brain signals into digital commands.md new file mode 100644 index 0000000000..e9c13ff8d2 --- /dev/null +++ b/sources/talk/20200219 A -399 device that translates brain signals into digital commands.md @@ -0,0 +1,62 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (A $399 device that translates brain signals into digital commands) +[#]: via: (https://www.networkworld.com/article/3526446/nextmind-wearable-device-translates-brain-signals-into-digital-commands.html) +[#]: author: (Patrick Nelson https://www.networkworld.com/author/Patrick-Nelson/) + +A $399 device that translates brain signals into digital commands +====== +Startup NextMind is readying a $399 development kit for its brain-computer interface technology that enables users to interact, hands-free, with computers and VR/AR headsets. +MetamorWorks / Getty Images + +Scientists have long envisioned brain-sensing technology that can translate thoughts into digital commands, eliminating the need for computer-input devices like a keyboard and mouse. One company is preparing to ship its latest contribution to the effort: a $399 development package for a noninvasive, AI-based, brain-computer interface. + +The kit will let "users control anything in their digital world by using just their thoughts," [NextMind][1], a commercial spinoff of a cognitive neuroscience lab claims in a [press release][2]. + +[[Get regularly scheduled insights by signing up for Network World newsletters.]][3] + +The company says that its puck-like device inserts into a cap or headband and rests on the back of the head. The dry electrode-based receiver then grabs data from the electrical signals generated through neuron activity. It uses machine learning algorithms to convert that signal output into computer controls. The interaction could be with a computer, artificial-reality or virtual-reality headset, or [IoT][4] module. + +"Imagine taking your phone to send a text message without ever touching the screen, without using Siri, just by using the speed and power of your thoughts," said NextMind founder Sid Kouider in a [video presentation][5] at Helsinki startup conference Slush in late 2019. + +Advances in neuroscience are enabling real-time consciousness-decoding, without surgery or a doctor visit, according to Kouider. + +One obstacle that has thwarted previous efforts is the human skull, which can act as a barrier to sensors. It’s been difficult for scientists to differentiate indicators from noise, and some past efforts have only been able to discern basic things, such as whether or not a person is in a state of sleep or relaxation. New materials, better sensors, and more sophisticated algorithms and modeling have overcome some of those limitations. NextMind’s noninvasive technology "translates the data in real time," Kouider says. + +Essentially, what happens is that a person’s eyes project an image of what they see onto the visual cortex in the back of the head, a bit like a projector. The NextMind device decodes the neural activity created as the object is viewed and sends that information, via an SDK, back as an input to a computer. So, by fixing one’s gaze on an object, one selects that object. For example, a user could select a screen icon by glancing at it. + +[][6] + +"The demos were by no means perfect, but there was no doubt in my mind that the technology worked," [wrote VentureBeat writer Emil Protalinski][7], who tested a pre-release device in January. + +Kouider has stated it’s the "intent" aspect of the technology that’s most interesting; if a person focuses on one thing more than something else, the technology can decode the neural signals to capture that user’s intent. + +"It really gives you a kind of sixth sense, where you can feel your brain in action, thanks to the feedback loop between your brain and a display," Kouider says in the Slush presentation. + +Join the Network World communities on [Facebook][8] and [LinkedIn][9] to comment on topics that are top of mind. + +-------------------------------------------------------------------------------- + +via: https://www.networkworld.com/article/3526446/nextmind-wearable-device-translates-brain-signals-into-digital-commands.html + +作者:[Patrick Nelson][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.networkworld.com/author/Patrick-Nelson/ +[b]: https://github.com/lujun9972 +[1]: https://www.next-mind.com/ +[2]: https://www.businesswire.com/news/home/20200105005107/en/CES-2020-It%E2%80%99s-Mind-Matter +[3]: https://www.networkworld.com/newsletters/signup.html +[4]: http://www.networkworld.com/cms/article/3207535 +[5]: https://youtu.be/RHuaNDSxH0o +[6]: https://www.networkworld.com/article/3440100/take-the-intelligent-route-with-consumption-based-storage.html?utm_source=IDG&utm_medium=promotions&utm_campaign=HPE21620&utm_content=sidebar ( Take the Intelligent Route with Consumption-Based Storage) +[7]: https://venturebeat.com/2020/01/05/nextmind-is-building-a-real-time-brain-computer-interface-unveils-dev-kit-for-399/ +[8]: https://www.facebook.com/NetworkWorld/ +[9]: https://www.linkedin.com/company/network-world diff --git a/sources/talk/20200219 Fedora at the Czech National Library of Technology.md b/sources/talk/20200219 Fedora at the Czech National Library of Technology.md new file mode 100644 index 0000000000..d1354b99ff --- /dev/null +++ b/sources/talk/20200219 Fedora at the Czech National Library of Technology.md @@ -0,0 +1,54 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Fedora at the Czech National Library of Technology) +[#]: via: (https://fedoramagazine.org/fedora-at-the-national-library-of-technology/) +[#]: author: (Ben Cotton https://fedoramagazine.org/author/bcotton/) + +Fedora at the Czech National Library of Technology +====== + +![][1] + +Where do you turn when you have a fleet of public workstations to manage? If you’re the Czech [National Library of Technology][2] (NTK), you turn to Fedora. Located in Prague, the NTK is the Czech Republic’s largest science and technology library. As part of its public service mission, the NTK provides 150 workstations for public use. + +In 2018, the NTK moved these workstations from Microsoft Windows to Fedora. In the [press release][3] announcing this change, Director Martin Svoboda said switching to Fedora will “reduce operating system support costs by about two-thirds.” The choice to use Fedora was easy, according to NTK Linux Engineer Miroslav Brabenec. “Our entire Linux infrastructure runs on RHEL or CentOS. So for desktop systems, Fedora was the obvious choice,” he told Fedora Magazine. + +### User reception + +Changing an operating system is always a little bit risky—it requires user training and outreach. Brabenec said that non-IT staff asked for training on the new system. Once they learned that the same (or compatible) software was available, they were fine. + +The Library’s customers were on board right away. The Windows environment was based on thin client terminals, which were slow for intensive tasks like video playback and handling large office suite files. The only end-user education that the NTK needed to create was a [basic usage guide][4] and a desktop wallpaper that pointed to important UI elements. + +![User guidance desktop wallpaper from the National Technology Library.][5] + +Although Fedora provides development tools used by the Faculty of Information Technology at the Czech Technical University—and many of the NTK’s workstation users are CTU students—most of the application usage is what you might expect of a general-purpose workstation. Firefox dominates the application usage, followed by the Evince PDF viewer,  and the LibreOffice suite. + +### Updates + +NTK first deployed the workstations with Fedora 28. They decided to skip Fedora 29 and upgraded to Fedora 30 in early June 2019. The process was simple, according to Brabenec. “We prepared configuration, put it into Ansible. Via AWX I restarted all systems to netboot, image with kickstart, after first boot called provisioning callback on AWX, everything automatically set up via Ansible.” + +Initially, they had difficulties applying updates. Now they have a process for installing security updates daily. Each system is rebooted approximately every two weeks to make sure all of the updates get applied. + +Although he isn’t aware of any concrete plans for the future, Brabenec expects the NTK to continue using Fedora for public workstations. “Everyone is happy with it and I think that no one has a good reason to change it.” + +-------------------------------------------------------------------------------- + +via: https://fedoramagazine.org/fedora-at-the-national-library-of-technology/ + +作者:[Ben Cotton][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://fedoramagazine.org/author/bcotton/ +[b]: https://github.com/lujun9972 +[1]: https://fedoramagazine.org/wp-content/uploads/2020/02/czech-techlib-816x345.png +[2]: https://www.techlib.cz/en/ +[3]: https://www.techlib.cz/default/files/download/id/86431/tiskova-zprava-z-31-7-2018.pdf +[4]: https://www.techlib.cz/en/82993-public-computers +[5]: https://fedoramagazine.org/wp-content/uploads/2020/02/ntk-wallpaper-1024x576.jpeg diff --git a/sources/talk/20200219 Multicloud, security integration drive massive SD-WAN adoption.md b/sources/talk/20200219 Multicloud, security integration drive massive SD-WAN adoption.md new file mode 100644 index 0000000000..3d690bdc3a --- /dev/null +++ b/sources/talk/20200219 Multicloud, security integration drive massive SD-WAN adoption.md @@ -0,0 +1,84 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Multicloud, security integration drive massive SD-WAN adoption) +[#]: via: (https://www.networkworld.com/article/3527194/multicloud-security-integration-drive-massive-sd-wan-adoption.html) +[#]: author: (Michael Cooney https://www.networkworld.com/author/Michael-Cooney/) + +Multicloud, security integration drive massive SD-WAN adoption +====== +40% year-over year SD-WAN growth through 2022 is being fueled by relationships built between vendors including Cisco, VMware, Juniper, and Arista and service provders AWS, Microsoft Azure, Google Anthos, and IBM RedHat. +[Gratisography][1] [(CC0)][2] + +Increasing cloud adoption as well as improved network security, visibility and manageability are driving enterprise software-defined WAN ([SD-WAN][3]) deployments at a breakneck pace. + +According to research from IDC, software- and infrastructure-as-a-service (SaaS and IaaS) offerings in particular have been driving SD-WAN implementations in the past year, said Rohit Mehra, vice president, network infrastructure at  IDC. + +**Read about edge networking** + + * [How edge networking and IoT will reshape data centers][4] + * [Edge computing best practices][5] + * [How edge computing can help secure the IoT][6] + + + +For example, IDC says that its recent surveys of customers show that 95% will be using [SD-WAN][7] technology within two years, and that 42% have already deployed it. IDC also says the SD-WAN infrastructure market will hit $4.5 billion by 2022, growing at a more than 40% yearly clip between now and then. + +“The growth of SD-WAN is a broad-based trend that is driven largely by the enterprise desire to optimize cloud connectivity for remote sites,” Mehra said. + +Indeed the growth of multicloud networking is prompting many businesses to re-tool their networks in favor of SD-WAN technology, Cisco wrote recently. SD-WAN is critical for businesses adopting cloud services, acting as a connective tissue between the campus, branch, [IoT][8], [data center][9] and cloud.  The company said surveys show Cisco customers have, on average, 30 paid SaaS applications each. And that they are actually using many more – over 100 in several cases, the company said. + +Part of this trend is driven by the relationships that networking vendors such as Cisco, VMware, Juniper, Arista and others have been building with the likes of Amazon Web Services, Microsoft Azure, Google Anthos and IBM RedHat.  + +An indicator of the growing importance of the SD-WAN and multicloud relationship came last December when AWS announced key services for its cloud offering that included new integration technologies such as [AWS Transit Gateway][10], which lets customers connect their Amazon Virtual Private Clouds and their on-premises networks to a single gateway. Aruba, Aviatrix Cisco, Citrix Systems, Silver Peak and Versa already announced support for the technology which promises to simplify and enhance the performance of SD-WAN integration with AWS cloud resources. + +[][11] + +Going forward the addition of features such as cloud-based application insights and performance monitoring will be a key part of SD-WAN rollouts, Mehra said. + +While the SD-WAN and cloud relationship is growing, so, too, is the need for integrated security features. + +“The way SD-WAN offerings integrate security is so much better than traditional ways of securing WAN traffic which usually involved separate packages and services," Mehra said. "SD-WAN is a much more agile security environment.” Security, analytics and WAN optimization are viewed as top SD-WAN component, with integrated security being the top requirement for next-generation SD-WAN solutions, Mehra said.  + +Increasingly, enterprises will look less at point SD-WAN solutions and instead will favor platforms that solve a wider range of network management and security needs, Mehra said. They will look for SD-WAN platforms that integrate with other aspects of their IT infrastructure including corporate data-center networks, enterprise campus LANs, or [public-cloud][12] resources, he said. They will look for security services to be baked in, as well as support for a variety of additional functions such as visibility, analytics, and unified communications, he said. + +“As customers continue to integrate their infrastructure components with software they can do things like implement consistent management and security policies based on user, device or application requirements across their LANs and WANs and ultimately achieve a better overall application experience,” Mehra said. + +An emerging trend is the need for SD-WAN packages to support [SD-branch][13] technology. More than 70% of IDC's surveyed customers expect to use SD-Branch within next year, Mehra said.  In recent weeks [Juniper][14] and [Aruba][15] have enhanced SD-Branch offerings, a trend that is expected to continue this year.  + +SD-Branch builds on the concepts and support of SD-WAN but is more specific to the networking and management needs of LANs in the branch. Going forward, how SD-Branch integrates other technologies such as analytics, voice, unified communications and video will be key drivers of that technology.   + +Join the Network World communities on [Facebook][16] and [LinkedIn][17] to comment on topics that are top of mind. + +-------------------------------------------------------------------------------- + +via: https://www.networkworld.com/article/3527194/multicloud-security-integration-drive-massive-sd-wan-adoption.html + +作者:[Michael Cooney][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.networkworld.com/author/Michael-Cooney/ +[b]: https://github.com/lujun9972 +[1]: https://www.pexels.com/photo/black-and-white-branches-tree-high-279/ +[2]: https://creativecommons.org/publicdomain/zero/1.0/ +[3]: https://www.networkworld.com/article/3031279/sd-wan-what-it-is-and-why-you-ll-use-it-one-day.html +[4]: https://www.networkworld.com/article/3291790/data-center/how-edge-networking-and-iot-will-reshape-data-centers.html +[5]: https://www.networkworld.com/article/3331978/lan-wan/edge-computing-best-practices.html +[6]: https://www.networkworld.com/article/3331905/internet-of-things/how-edge-computing-can-help-secure-the-iot.html +[7]: https://www.networkworld.com/article/3489938/what-s-hot-at-the-edge-for-2020-everything.html +[8]: https://www.networkworld.com/article/3207535/what-is-iot-the-internet-of-things-explained.html +[9]: https://www.networkworld.com/article/3223692/what-is-a-data-centerhow-its-changed-and-what-you-need-to-know.html +[10]: https://aws.amazon.com/transit-gateway/ +[11]: https://www.networkworld.com/article/3440100/take-the-intelligent-route-with-consumption-based-storage.html?utm_source=IDG&utm_medium=promotions&utm_campaign=HPE21620&utm_content=sidebar ( Take the Intelligent Route with Consumption-Based Storage) +[12]: https://www.networkworld.com/article/2159885/cloud-computing-gartner-5-things-a-private-cloud-is-not.html +[13]: https://www.networkworld.com/article/3250664/sd-branch-what-it-is-and-why-youll-need-it.html +[14]: https://www.networkworld.com/article/3487801/juniper-broadens-sd-branch-management-switch-options.html +[15]: https://www.networkworld.com/article/3513357/aruba-reinforces-sd-branch-with-security-management-upgrades.html +[16]: https://www.facebook.com/NetworkWorld/ +[17]: https://www.linkedin.com/company/network-world diff --git a/sources/talk/20200221 Google Cloud moves to aid mainframe migration.md b/sources/talk/20200221 Google Cloud moves to aid mainframe migration.md new file mode 100644 index 0000000000..64b3565109 --- /dev/null +++ b/sources/talk/20200221 Google Cloud moves to aid mainframe migration.md @@ -0,0 +1,64 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Google Cloud moves to aid mainframe migration) +[#]: via: (https://www.networkworld.com/article/3528451/google-cloud-moves-to-aid-mainframe-migration.html) +[#]: author: (Michael Cooney https://www.networkworld.com/author/Michael-Cooney/) + +Google Cloud moves to aid mainframe migration +====== +Google bought Cornerstone Technology, whose technology facilitates moving mainframe applications to the cloud. +Thinkstock + +Google Cloud this week bought a mainframe cloud-migration service firm Cornerstone Technology with an eye toward helping Big Iron customers move workloads to the private and public cloud.  + +Google said the Cornerstone technology – found in its [G4 platform][1] – will shape the foundation of its future mainframe-to-Google Cloud offerings and help mainframe customers modernize applications and infrastructure. + +[[Get regularly scheduled insights by signing up for Network World newsletters.]][2] + +“Through the use of automated processes, Cornerstone’s tools can break down your Cobol, PL/1, or Assembler programs into services and then make them cloud native, such as within a managed, containerized environment” wrote Howard Weale, Google’s director, Transformation Practice, in a [blog][3] about the buy. + +“As the industry increasingly builds applications as a set of services, many customers want to break their mainframe monolith programs into either Java monoliths or Java microservices,” Weale stated.  + +Google Cloud’s Cornerstone service will: + + * Develop a migration roadmap where Google will assess a customer’s mainframe environment and create a roadmap to a modern services architecture. + * Convert any language to any other language and any database to any other database to prepare applications for modern environments. + * Automate the migration of workloads to the Google Cloud. + + + +“Easy mainframe migration will go a long way as Google attracts large enterprises to its cloud,” said Matt Eastwood, senior vice president, Enterprise Infrastructure, Cloud, Developers and Alliances, IDC wrote in a statement. + +The Cornerstone move is also part of Google’s effort stay competitive in the face of mainframe-migration offerings from [Amazon Web Services][4], [IBM/RedHat][5] and [Microsoft][6]. + +While the idea of moving legacy applications off the mainframe might indeed be beneficial to a business, Gartner last year warned that such decisions should be taken very deliberately. + +“The value gained by moving applications from the traditional enterprise platform onto the next ‘bright, shiny thing’ rarely provides an improvement in the business process or the company’s bottom line. A great deal of analysis must be performed and each cost accounted for,” Gartner stated in a report entitled *[_Considering Leaving Legacy IBM Platforms? Beware, as Cost Savings May Disappoint, While Risking Quality_][7]. * “Legacy platforms may seem old, outdated and due for replacement. Yet IBM and other vendors are continually integrating open-source tools to appeal to more developers while updating the hardware. Application leaders should reassess the capabilities and quality of these platforms before leaving them.” + +Join the Network World communities on [Facebook][8] and [LinkedIn][9] to comment on topics that are top of mind. + +-------------------------------------------------------------------------------- + +via: https://www.networkworld.com/article/3528451/google-cloud-moves-to-aid-mainframe-migration.html + +作者:[Michael Cooney][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.networkworld.com/author/Michael-Cooney/ +[b]: https://github.com/lujun9972 +[1]: https://www.cornerstone.nl/solutions/modernization +[2]: https://www.networkworld.com/newsletters/signup.html +[3]: https://cloud.google.com/blog/topics/inside-google-cloud/helping-customers-migrate-their-mainframe-workloads-to-google-cloud +[4]: https://aws.amazon.com/blogs/enterprise-strategy/yes-you-should-modernize-your-mainframe-with-the-cloud/ +[5]: https://www.networkworld.com/article/3438542/ibm-z15-mainframe-amps-up-cloud-security-features.html +[6]: https://azure.microsoft.com/en-us/migration/mainframe/ +[7]: https://www.gartner.com/doc/reprints?id=1-6L80XQJ&ct=190429&st=sb +[8]: https://www.facebook.com/NetworkWorld/ +[9]: https://www.linkedin.com/company/network-world diff --git a/sources/talk/20200221 Japanese firm announces potential 80TB hard drives.md b/sources/talk/20200221 Japanese firm announces potential 80TB hard drives.md new file mode 100644 index 0000000000..c44e9ded6e --- /dev/null +++ b/sources/talk/20200221 Japanese firm announces potential 80TB hard drives.md @@ -0,0 +1,57 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Japanese firm announces potential 80TB hard drives) +[#]: via: (https://www.networkworld.com/article/3528211/japanese-firm-announces-potential-80tb-hard-drives.html) +[#]: author: (Andy Patrizio https://www.networkworld.com/author/Andy-Patrizio/) + +Japanese firm announces potential 80TB hard drives +====== +Using some very fancy physics for stacking electrons, Showa Denko K.K. plans to quadruple the top end of proposed capacity. +[geralt][1] [(CC0)][2] + +Hard drive makers are staving off obsolescence to solid-state drives (SSDs) by offering capacities that are simply not feasible in an SSD. Seagate and Western Digital are both pushing to release 20TB hard disks in the next few years. A 20TB SSD might be doable but also cost more than a new car. + +But Showa Denko K.K. of Japan has gone one further with the announcement of its next-generation of heat-assisted magnetic recording (HAMR) media for hard drives. The platters use all-new magnetic thin films to maximize their data density, with the goal of eventually enabling 70TB to 80TB hard drives in a 3.5-inch form factor. + +[[Get regularly scheduled insights by signing up for Network World newsletters.]][3] + +Showa Denko is the world’s largest independent maker of platters for hard drives, selling them to basically anyone left making hard drives not named Seagate and Western Digital. Those two make their own platters and are working on their own next-generation drives for release in the coming years. + +While similar in concept, Seagate and Western Digital have chosen different solutions to the same problem. HAMR, championed by Seagate and Showa, works by temporarily heating the disk material during the write process so data can be written to a much smaller space, thus increasing capacity. + +Western Digital supports a different technology called microwave-assisted magnetic recording (MAMR). It operates under a similar concept as HAMR but uses microwaves instead of heat to alter the drive platter. Seagate hopes to get to 48TB by 2023, while Western Digital is planning on releasing 18TB and 20TB drives this year. + +Heat is never good for a piece of electrical equipment, and Showa Denko’s platters for HAMR HDDs are made of a special composite alloy to tolerate temperature and reduce wear, not to mention increase density. A standard hard disk has a density of about 1.1TB per square inch. Showa’s drive platters have a density of 5-6TB per square inch. + +The question is when they will be for sale, and who will use them. Fellow Japanese electronics giant Toshiba is expected to ship drives with Showa platters later this year. Seagate will be the first American company to adopt HAMR, with 20TB drives scheduled to ship in late 2020. + +[][4] + +Know what’s scary? That still may not be enough. IDC predicts that our global datasphere – the total of all of the digital data we create, consume, or capture – will grow from a total of approximately 40 zettabytes of data in 2019 to 175 zettabytes total by 2025. + +So even with the growth in hard-drive density, the growth in the global data pool – everything from Oracle databases to Instagram photos – may still mean deploying thousands upon thousands of hard drives across data centers. + +Join the Network World communities on [Facebook][5] and [LinkedIn][6] to comment on topics that are top of mind. + +-------------------------------------------------------------------------------- + +via: https://www.networkworld.com/article/3528211/japanese-firm-announces-potential-80tb-hard-drives.html + +作者:[Andy Patrizio][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.networkworld.com/author/Andy-Patrizio/ +[b]: https://github.com/lujun9972 +[1]: https://pixabay.com/en/data-data-loss-missing-data-process-2764823/ +[2]: https://creativecommons.org/publicdomain/zero/1.0/ +[3]: https://www.networkworld.com/newsletters/signup.html +[4]: https://www.networkworld.com/article/3440100/take-the-intelligent-route-with-consumption-based-storage.html?utm_source=IDG&utm_medium=promotions&utm_campaign=HPE21620&utm_content=sidebar ( Take the Intelligent Route with Consumption-Based Storage) +[5]: https://www.facebook.com/NetworkWorld/ +[6]: https://www.linkedin.com/company/network-world diff --git a/sources/talk/20200224 Discussing Past, Present and Future of FreeBSD Project.md b/sources/talk/20200224 Discussing Past, Present and Future of FreeBSD Project.md new file mode 100644 index 0000000000..4a02a80f20 --- /dev/null +++ b/sources/talk/20200224 Discussing Past, Present and Future of FreeBSD Project.md @@ -0,0 +1,106 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Discussing Past, Present and Future of FreeBSD Project) +[#]: via: (https://itsfoss.com/freebsd-interview-deb-goodkin/) +[#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/) + +Discussing Past, Present and Future of FreeBSD Project +====== + +[FreeBSD][1] is one of the most popular BSD distributions. It is used on desktop, servers and embedded devices for more than two decades. + +We talked to Deb Goodkin, executive director, [FreeBSD Foundation][2] and discussed the past, present and future of FreeBSD project. + +![][3] + +**It’s FOSS: FreeBSD has been in the scene for more than 25 years. How do you see the journey of FreeBSD? ** + +Over the years, we’ve seen a lot of innovation happening on and with FreeBSD. When the Foundation came into play 20 years ago, we were able to step in and help accelerate changes in the operating system. Over the years, we’ve increased our marketing support, to provide more advocacy and educational material, and to increase the awareness and use of FreeBSD. + +In addition, we’ve increased our staff of software developers to allow us to quickly step in to fix bugs, review patches, implement workarounds to hardware issues, and implement new features and functionality. We have also increased the number of development projects we are funding to improve various areas of FreeBSD. + +The history of stability and reliability, along with all the improvements and growth with FreeBSD, is making it a compelling choice for companies, universities, and individuals. + +**It’s FOSS: We know that Netflix uses FreeBSD extensively. What other companies or groups rely on FreeBSD? How do they contribute to BSD/FreeBSD (if they do at all)?** + +Sony’s Playstation 4 uses a modified version of FreeBSD as their operating system, Apple with their MacOS and iOS, NetApp in their ONTAP product, Juniper Networks  in [JunOS][4], Trivago in their backend infrastructure, University of Cambridge in security research including the Capability Hardware Enhanced RISC Instruction (CHERI) project, University of Notre Dame in their Engineering Department, Groupon in their datacenter, LA Times in their data center, as well as, other notable companies like Panasonic, and Nintendo. + +I listed a variety of organizations to highlight the different FreeBSD use cases. Companies like [Netflix support FreeBSD][5] by supporting the Project financially, as well as, by upstreaming their code. Some of the companies, like Sony, take advantage of the BSD license and don’t give back at all.  + +![Deb Goodkin And Friend Promoting FreeBSD At Oscon][6] + +**It’s FOSS: Linux is ruling the servers and cloud computing. It seems that BSD is lagging in that field?** + +I wouldn’t characterize it as lagging, per se. Linux distributions do have a much higher market share than FreeBSD, but our strength falls in those two markets. FreeBSD does extremely well in these markets, because it provides a consistent and reliable foundation, and tends to just work. Known for having long term API stability, the user will integrate once and upgrade on their terms as both FreeBSD and their product evolves.  + +**It’s FOSS: Do you see the emergence of Linux as a threat to BSD? ** + +Sure, [there are so many Linux distributions][7] already, and most of them are supported by for profit companies. In fact, companies like Intel have many Linux developers on staff, so Linux is easily supported on their hardware. + +However, thanks to the continuing education efforts and as our market share continues to grow, more developers will be available to support companies’ various FreeBSD use cases.  + +**It’s FOSS: Let’s talk about desktop. Recently, the devs of Project Trident announced that they were moving away from FreeBSD as a base. They said that they made this decision because FreeBSD is slow to review updates and support for new hardware. For example, the most recent version of Telegram on FreeBSD is 9 releases behind the version available on Linux. How would you respond to their comments?** + +There are quite a few FreeBSD distros for the desktop, with various focuses. The latest, is [FuryBSD][8], which coincidentally was started by iXsystems employees, but is independent of iXsystems, just like Project Trident is. In addition to FuryBSD, you may want to check out [NomadBSD][9] and [MidnightBSD][10]. + +Regarding supporting new hardware, we’ve stepped up our efforts to get FreeBSD working on more popular newer laptops. For example, the Foundation recently purchased a couple of the latest generation Lenovo X1 Carbon laptops and sponsored work to make sure that peripherals are supported out-of-the-box. + +**It’s FOSS: Why should a desktop user consider choosing FreeBSD?** + +There are many reasons people should consider using FreeBSD on their desktop! Just to highlight a few, it has rock solid stability; high performance; supports [ZFS][11] to protect your data; a community that is friendly, helpful, and approachable; excellent documentation to easily find answers; over 30,000 open source software packages that are easy to install, allowing you to easily set up your environment without a lot of extras, and that includes many choices of popular GUIs, and it follows the POLA philosophy ([Principle of Least Astonishment][12]) which means, don’t break things that work and upgrades are generally painless (even across major releases).  + +**It’s FOSS: Are there any plans to make it easier to install FreeBSD as a desktop system? The current focus seems to be on servers.** + +The Foundation is supporting efforts to make sure FreeBSD works on the latest hardware and peripherals that appear in desktop systems, and will continue to support making FreeBSD easy to deploy, monitor, and configure to provide a great toolbox for building a desktop on top of it. That allows others to take as much or as little of FreeBSD to build a desktop version to produce a specific user experience they desire. + +Like I mentioned above, there are other FreeBSD distributions that have taken these FreeBSD components and created their own desktop versions. + +**It’s FOSS: What are your plans/roadmap for FreeBSD in the coming years?** + +The FreeBSD Foundation’s purpose is to support the FreeBSD Project. While we’re an entirely separate entity, we work closely with the Core Team and the community to help move the Project forward. The Foundation identifies key areas we should support in the coming years, based on input from users and what we are seeing in the industry.  + +In 2019, we embarked on an even broader spectrum advocacy project to recruit new members throughout the world, while raising awareness about the benefits of learning FreeBSD. We are funding development projects including WiFi improvements, supporting OpenJDK, ZFS RAID-Z expansion, security, toolchain, performance improvements, and other features to keep FreeBSD innovative. + +The FreeBSD Foundation will continue to host workshops and expand the amount of training opportunities and materials we provide. Finally, the [BSD Certification program][13] recently launched through Linux Professional Institute with greater availability.  + +**It’s FOSS: How can we bring more people to the BSD hold?** + +We need more PR for FreeBSD and get more tech journalists like yourself to write about FreeBSD. We also need more trainings and classes that include FreeBSD in universities, trainings/workshops at technical conferences, more FreeBSD contributors giving talks at those conferences, more technical journalists, as well as, users writing about FreeBSD, and finally we need case studies from companies and organizations successfully using FreeBSD. It all takes having more resources! We’re working on all of the above.  + +**It’s FOSS: Any message you would like to convey to our readers?** + +Readers should consider getting involved with the largest and oldest democratically run open source project! + +Whether you want to learn systems programming or how an operating system works, the small size of the operating system makes it a great platform to learn from. The size of the Project makes it easier for anyone to make a notable contribution, and there is a strong mentorship culture to support new contributors. + +Being a democratically run project, allows your voice to be heard and work in the areas you are interested in. I hope your readers will go to [freebsd.org][1] and try it out themselves. + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/freebsd-interview-deb-goodkin/ + +作者:[Abhishek Prakash][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/abhishek/ +[b]: https://github.com/lujun9972 +[1]: https://www.freebsd.org/ +[2]: https://www.freebsdfoundation.org/ +[3]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/02/deb-goodkin-interview.png?ssl=1 +[4]: https://www.juniper.net/us/en/products-services/nos/junos/ +[5]: https://itsfoss.com/netflix-freebsd-cdn/ +[6]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/02/FreeBSDFoundation_Deb_Goodkin_and_friend_promoting_FreeBSD_at_OSCON.jpg?ssl=1 +[7]: https://itsfoss.com/best-linux-distributions/ +[8]: https://itsfoss.com/furybsd/ +[9]: https://itsfoss.com/nomadbsd/ +[10]: https://itsfoss.com/midnightbsd-1-0-release/ +[11]: https://itsfoss.com/what-is-zfs/ +[12]: https://en.wikipedia.org/wiki/Principle_of_least_astonishment +[13]: https://www.lpi.org/our-certifications/bsd-overview diff --git a/sources/talk/20200225 Spilling over- How working openly with anxiety affects my team.md b/sources/talk/20200225 Spilling over- How working openly with anxiety affects my team.md new file mode 100644 index 0000000000..2a89fd37a5 --- /dev/null +++ b/sources/talk/20200225 Spilling over- How working openly with anxiety affects my team.md @@ -0,0 +1,86 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Spilling over: How working openly with anxiety affects my team) +[#]: via: (https://opensource.com/open-organization/20/2/working-anxiety-team-performance) +[#]: author: (Sam Knuth https://opensource.com/users/samfw) + +Spilling over: How working openly with anxiety affects my team +====== +The team might interpret my behavior as evidence of exacting standards +or high expectations. But I know my anxiety does impact their +performance. +![Spider web on green background][1] + +_Editor's note: This article is part of a series on working with mental health conditions. It details the author's personal experiences and is not meant to convey professional medical advice or guidance._ + +I was speaking with one of my direct reports recently about a discussion we'd had with the broader team earlier in the week. In that discussion I had expressed some frustration that we weren't as far along on a particular project as I thought we needed to be. + +"I knew you were disappointed," my staff member said, recalling the meeting, "like you wanted us to be doing something that we weren't doing, or that what we were doing wasn't good enough." + +They paused for a moment and then said, "Sam, I get this feeling from you all the time." + +That comment struck me pretty profoundly. To my team member, perhaps the scenario above is a reflection of my exacting standards, my high expectations, or my desire to see continual improvement with the team. Those are all reasonable explanations for my behavior. + +But there's another ingredient my team may not be aware of: my anxiety. + +### It's not just personal + +[Previously I discussed][2] how my anxiety, beginning with a worry that I'm not "doing enough," can fuel my proactive tendencies, leading to higher performance at work. What I hadn't considered is my team can interpret my _personal_ feeling of not doing enough as an indicator that _they_ are not doing enough. + +Living with anxiety and other mental health conditions feels personal. It's not something I've talked about at work. It's not something I generally discuss, and it's something I've always felt I was coping with as a private part of my life. + +Living with anxiety and other mental health conditions feels personal. It's not something I've talked about at work. It's not something I generally discuss, and it's something I've always felt I was coping with as a private part of my life. + +But that discussion with my staff member made me realize that I can't contain my personality so neatly. In truth, my anxiety spills over to my team in ways I hadn't considered. I don't know if anxiety can "rub off" on someone, but when I try to think about it objectively, I imagine someone with anxiety would feel it heightened if they worked for me (perhaps my anxiety would feed theirs), and one without anxiety might feel I have unreasonable or unmeetable expectations. + +As a leader—even in an open organization, where [hierarchy is not the most important factor][3] in determining influence—I'm aware that I am in a position of a certain amount of power. People observe my behavior more closely than I realize; how I treat people has a big impact on them, the broader organization, and ultimately the success of the team. + +I try hard to treat people with respect, [to assume positive intent][4], to give people the room to do their work in the way they see fit. But, nonetheless, do my team members feel the kind of judgment from me that I continually impose on myself? + +### Counting our achievements + +What feels "good" to me (what calms my anxiety) is to focus _not_ on what we _have achieved_, but on what we _have yet to do_; not to _celebrate success_, but to _find areas for improvement_. So, when we hit a big milestone, my gut reaction is to say, "Great, now that we've come this far, what else can we do to have a bigger impact?" Stopping and celebrating the team's accomplishments before moving on to the next challenge feels foriegn to me. It also makes me anxious that we are pausing in our progress. + +This is [what I've called an anxiety-driven performance loop][2]. The sense of accomplishment (and the external acknowledgement) after an achievement fuels a desire to immediately start looking for the next challenge. To some extent, this performance loop keeps me productive—even though it has other consequences, too. + +What I want to _avoid_ is transferring my anxiety to my team members. I don't want them to feel that I am continually saying, "What have you done for me lately?" even though that is how I feel the world is looking at me. That's an aspect of what I've called [an anxiety inaction loop][5]. + +I try hard to treat people with respect, to assume positive intent, to give people the room to do their work in the way they see fit. But, nonetheless, do my team members feel the kind of judgment from me that I continually impose on myself? + +At a fundamental level, I believe work is never done, that there is always another challenge to explore, other ways to have a larger impact. Leaders need to inspire and motivate us to embrace that reality as an exciting opportunity rather than an endless drudge or a source of continual worry. + +As a leader who suffers from anxiety, this is more challenging to do in practice than it is to understand intellectually. + +While this is an area of continual work for me, I've received some good advice on how to shield my colleagues from my own anxiety-driven loops, like: + + * If celebrating success and acknowledging achievement doesn't come naturally for you, build it into the plan from the start. Ensure you have the celebration of accomplishment accounted for from the beginning of a project. This can help reduce the "what have you done for me lately?" impulse that comes from moving quickly to the next challenge without pausing to acknowledge achievements. + * Work with another team member on acknowledgment and celebration efforts. Others might have different ideas on how to do this effectively, and may also enjoy the process. Giving this responsibility to someone else can help ensure it isn't lost. + * Practice compassion, gratitude, and empathy. This may not come naturally and may take some effort. Putting yourself in someone else's shoes, thinking about their perspective, thanking people for what they have done, and understanding their challenges can go a long way in shifting your own perspective. + * If you find yourself judging others, ask yourself, "Is this useful in terms of what I want or need from this situation?" That is, is carrying judgment going to help you accomplish your goal? Most likely, the answer is no. And, in fact, it may have the opposite effect! + + + +The above tips have been helpful for me. But the goal of this series hasn't been to provide solutions but rather to share my experiences and to use writing to explore my own tendencies and the impact they have on myself and others. I believe that acknowledging and sharing our personal challenges can reduce the [stigma][6] associated with mental illness, create the space needed to start exploring solutions, and to create environments that are more positive and invigorating to work in. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/open-organization/20/2/working-anxiety-team-performance + +作者:[Sam Knuth][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/samfw +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/osdc-lead-web-internet.png?itok=UQ0zMNJ3 (Spider web on green background) +[2]: https://opensource.com/open-organization/20/1/leading-openly-anxiety +[3]: https://opensource.com/open-organization/resources/open-org-definition +[4]: https://opensource.com/article/17/2/what-happens-when-we-just-assume-positive-intent +[5]: https://opensource.com/open-organization/20/2/working-anxiety-inaction-loop +[6]: https://www.bloomberg.com/news/articles/2019-11-13/mental-health-is-still-a-don-t-ask-don-t-tell-subject-at-work diff --git a/sources/talk/20200226 How we decide when to release Fedora.md b/sources/talk/20200226 How we decide when to release Fedora.md new file mode 100644 index 0000000000..204a917ee4 --- /dev/null +++ b/sources/talk/20200226 How we decide when to release Fedora.md @@ -0,0 +1,74 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How we decide when to release Fedora) +[#]: via: (https://fedoramagazine.org/how-we-decide-when-to-release-fedora/) +[#]: author: (Ben Cotton https://fedoramagazine.org/author/bcotton/) + +How we decide when to release Fedora +====== + +![][1] + +Open source projects can use a variety of different models for deciding when to put out a release. Some projects release on a set schedule. Others decide on what the next release should contain and release whenever that is ready. Some just wake up one day and decide it’s time to release. And other projects go for a rolling release model, avoiding the question entirely. + +For Fedora, we go with a [schedule-based approach][2]. Releasing twice a year means we can give our contributors time to implement large changes while still keeping on the leading edge. Targeting releases for the end of April and the end of October gives everyone predictability: contributors, users, upstreams, and downstreams. + +But it’s not enough to release whatever’s ready on the scheduled date. We want to make sure that we’re releasing _quality_ software. Over the years, the Fedora community has developed a set of processes to help ensure we can meet both our time and and quality targets. + +### Changes process + +Meeting our goals starts months before the release. Contributors propose changes through our [Changes process][3], which ensures that the community has a chance to provide input and be aware of impacts. For changes with a broad impact (called “system-wide changes”), we require a contingency plan that describes how to back out the change if it’s broken or won’t be ready in time. In addition, the change process includes providing steps for testing. This helps make sure we can properly verify the results of a change. + +Change proposals are due 2-3 months before the beta release date. This gives the community time to evaluate the impact of the change and make adjustments necessary. For example, a new compiler release might require other package maintainers to fix bugs exposed by the new compiler or to make changes that take advantage of new capabilities. + +A few weeks before the beta and final releases, we enter a [code freeze][4]. This ensures a stable target for testing. Bugs identified as blockers and non-blocking bugs that are granted a freeze exception are updated in the repo, but everything else must wait. The freeze lasts until the release. + +### Blocker and freeze exception process + +In a project as large as Fedora, it’s impossible to test every possible combination of packages and configurations. So we have a set of test cases that we run to make sure the key features are covered. + +As much as we’d like to ship with zero bugs, if we waited until we reached that state, there’d never be another Fedora release again. Instead, we’ve defined release criteria that define what bugs can [block the release][5]. We have [basic release criteria][6] that apply to all release milestones, and then separate, cumulative criteria for [beta][7] and [final][8] releases. With beta releases, we’re generally a little more forgiving of rough edges. For a final release, it needs to pass all of beta’s criteria, plus some more that help make it a better user experience. + +The week before a scheduled release, we hold a “[go/no go meeting][9]“. During this meeting, the QA team, release engineering team, and the Fedora Engineering Steering Committee (FESCo) decide whether or not we will ship the release. As part of the decision process, we conduct a final review of blocker bugs. If any accepted blockers remain, we push the release back to a later date. + +Some bugs aren’t severe enough to block the release, but we still would like to get them fixed before the release. This is particularly true of bugs that affect the live image experience. In that case, we grant an [exception for updates that fix those bugs][10]. + +### How you can help + +In all my years as a Fedora contributor, I’ve never heard the QA team say “we don’t need any more help.” Contributing to the pre-release testing processes can be a great way to make your first Fedora contribution. + +The Blocker Review meetings happen most Mondays in #fedora-blocker-review on IRC. All members of the Fedora community are welcome to participate in the discussion and voting. One particularly useful contribution is to look at the [proposed blockers][11] and see if you can reproduce them. Knowing if a bug is widespread or not is important to the blocker decision. + +In addition, the QA team conducts test days and test weeks focused on various parts of the distribution: the kernel, GNOME, etc. Test days are announced on [Fedora Magazine][12]. + +There are plenty of other ways to contribute to the QA process. The Fedora wiki has a [list of tasks and how to contact the QA team][13]. The Fedora 32 Beta release is a few weeks away, so now’s a great time to get started! + +-------------------------------------------------------------------------------- + +via: https://fedoramagazine.org/how-we-decide-when-to-release-fedora/ + +作者:[Ben Cotton][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://fedoramagazine.org/author/bcotton/ +[b]: https://github.com/lujun9972 +[1]: https://fedoramagazine.org/wp-content/uploads/2020/02/releasing-fedora-1-816x345.png +[2]: https://fedoraproject.org/wiki/Fedora_Release_Life_Cycle#Development_Schedule +[3]: https://docs.fedoraproject.org/en-US/program_management/changes_policy/ +[4]: https://fedoraproject.org/wiki/Milestone_freezes +[5]: https://fedoraproject.org/wiki/QA:SOP_blocker_bug_process +[6]: https://fedoraproject.org/wiki/Basic_Release_Criteria +[7]: https://fedoraproject.org/wiki/Fedora_32_Beta_Release_Criteria +[8]: https://fedoraproject.org/wiki/Fedora_32_Final_Release_Criteria +[9]: https://fedoraproject.org/wiki/Go_No_Go_Meeting +[10]: https://fedoraproject.org/wiki/QA:SOP_freeze_exception_bug_process +[11]: https://qa.fedoraproject.org/blockerbugs/ +[12]: https://fedoramagazine.org/tag/test-day/ +[13]: https://fedoraproject.org/wiki/QA/Join diff --git a/sources/talk/20200226 Mirantis- Balancing Open Source with Guardrails.md b/sources/talk/20200226 Mirantis- Balancing Open Source with Guardrails.md new file mode 100644 index 0000000000..5eeb400060 --- /dev/null +++ b/sources/talk/20200226 Mirantis- Balancing Open Source with Guardrails.md @@ -0,0 +1,86 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Mirantis: Balancing Open Source with Guardrails) +[#]: via: (https://www.linux.com/articles/mirantis-balancing-open-source-with-guardrails/) +[#]: author: (Swapnil Bhartiya https://www.linux.com/author/swapnil/) + +Mirantis: Balancing Open Source with Guardrails +====== + +[![][1]][2] + +[![][1]][2] + +Mirantis, an open infrastructure company that rose to popularity with its OpenStack offering, is now moving into the Kubernetes space very aggressively. [Last year, the company acquired the Docker Enterprise business from Docker.][3] [This week, it announced that they were hiring the Kubernetes experts from the Finnish company Kontena a][4]nd established a Mirantis office in Finland, expanding the company’s footprint in Europe. Mirantis already has a significant presence in Europe due to large customers such as Bosch and [Volkswagen][5]. + +The Kontena team primarily focused on two technologies. One was a Kubernetes distro called [Pharos][6], which differentiated itself from other distributions by specializing in addressing life cycle management challenges. They had developed some unique capabilities for deployment and for updating Kubernetes itself. + +The second product by Kontena is [Lens][6]. “It’s like a Kubernetes dashboard on steroids. In addition to offering the standard dashboard functions, it went multiple steps further by providing a terminal for command line interfacing to nodes and containers, and additional real-time insights, role-based access controls and a number of other capabilities that are currently absent from the Kubernetes dashboard,” said [Dave Van Everen][7], SVP of Marketing at Mirantis. + +Everything that Kontena does is open source. These open source projects are already used by hundreds of organizations around the world. “They have a proven track record of contributing valuable technology pieces to the Kubernetes ecosystem, and we saw an opportunity to bring the team on board and capitalized on that opportunity as quickly as we could,” said Van Everen. + +Mirantis will integrate many of the technology concepts and benefits from Pharos into its Docker Enterprise offering. With Kontena engineers on board, Mirantis expects to incorporate the best of what Kontena offered into its commercially supported Docker Enterprise and [Kubernetes][8] technology. + +With this acquisition, Mirantis has hinted at a very aggressive 2020. The company is weeks away from launching the first Docker Enterprise release since the acquisition. The release brings many new capabilities on top of Docker Enterprise 3.0. The company is working on merging the [Mirantis KaaS][9] capabilities with Docker Enterprise. “We will add new capabilities, including multi-cluster management and continuous automated updates to the Kubernetes that’s already within Docker Enterprise,” said Van Everen. + +**What is Mirantis today?** + +Mirantis started out as a pure-play OpenStack company, but as the market dynamics changed, the company adjusted its own positioning and bet on CD platforms like Spinnaker and container orchestration technologies like Kubernetes. So, what are they focusing on today? + +Van Everen said that Mirantis is definitely embracing Kubernetes as the open standard used by enterprises for modern applications. Kubernetes itself has a massive ecosystem of technologies that a customer needs to leverage. “When we speak about Kubernetes, we speak about full-stack Kubernetes, which includes that ecosystem consisting of a couple dozen components in a typical cluster deployment. Our job as a trusted partner in helping our customers accelerate their path to modern applications is to streamline and automate all of the infrastructure and DevOps tooling supporting their app development lifecycle,” san Van Everen. + +In a nutshell, Mirantis is making it easier for customers to use Kubernetes. + +Over the years, [Mirantis][10] has gained expertise in IaaS with the work they did on OpenStack. “All of that plays a role in helping companies move faster and become more agile as they’re modernizing their applications. We apply many of those same strengths to the Kubernetes ecosystem,” he said. + +Mirantis is also building expertise in continuous delivery platforms like [Argo CD][11] and is offering customers a spectrum of professional services around application modernization, from writing code that is based in microservices architecture, to integrating CI/CD pipelines and modernizing the tooling for CI/CD to better support cloud-native patterns. By supporting Kubernetes technology with app modernization services, Mirantis is helping customers wherever they are in their digital transformation and cloud-native journey. + +“All of those things that our services team provides are complementary to the technology. That’s a unique value that only Mirantis can provide to the market, where we can couple open source technologies with strong services to ensure that companies really get the most out of that open source technology and fulfill their ultimate goal, which is to accelerate their pace of innovation,” Van Everen said. + +Container networking is a critical piece of the cloud-native world and Mirantis already has expertise in the area, thanks to their work on OpenStack. The company recently joined the Linux Foundation’s [LF Networking project][12] which is home to [Tungsten Fabric][13] (formerly known as OpenContrail), a technology that Mirantis uses for its [OpenStack][14] offerings. + +He explains, “While we use Calico for the container networking, Tungsten Fabric would be an important part of the underlying networking supporting Kubernetes deployments. Staying true to our heritage, we want to be involved in the open community and have both a voice and a stake in the direction the communities are moving in.” + +[As for the ongoing debate or controversy around two competing service mesh technologies Istio and Linkerd,][15] the company has made its bet on Istio. A few months ago, Mirantis announced a training program for Istio, which was bundled with Mirantis’ KaaS offerings. + +“We include Istio as a service mesh by default in child clusters under Mirantis KaaS management. It’ll be used as an ingress with Docker Enterprise initially. Moving forward, we’re still looking at how to best deploy it in a service mesh configuration by default and provide a configurable but still functional default deployment for Istio as a service mesh,” said Van Everen. + +It might seem like Mirantis is latching on to the latest hot technologies like OpenStack, [Spinnaker][16], Docker Enterprise, Kubernetes, and Istio to see what sticks. In reality, there is a method to it: the company is going where its customers are going, with the technologies that customers are using. It’s a fine balancing act. + +“That’s the type of technology challenge that Mirantis embraces. We are open source experts and continue to provide the greatest flexibility and choice in our industry, but we do it in such a way that there are guardrails in place so that companies don’t end up having something that’s overly complex and unmanageable, or configured incorrectly,” he concluded. + +Note: Cross posted to [TFIR][17] + +-------------------------------------------------------------------------------- + +via: https://www.linux.com/articles/mirantis-balancing-open-source-with-guardrails/ + +作者:[Swapnil Bhartiya][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://www.linux.com/author/swapnil/ +[b]: https://github.com/lujun9972 +[1]: https://www.linux.com/wp-content/uploads/2019/09/world-network-1068x713.jpg (world-network) +[2]: https://www.linux.com/wp-content/uploads/2019/09/world-network.jpg +[3]: https://www.youtube.com/watch?v=cBOrVKuomcU&feature=emb_title +[4]: https://containerjournal.com/topics/container-ecosystems/mirantis-acquires-kubernetes-assets-from-kontena/ +[5]: https://www.mirantis.com/company/press-center/company-news/volkswagen-group-selects-mirantis-openstack-software-next-generation-cloud/ +[6]: https://github.com/kontena +[7]: https://twitter.com/davidvaneveren?lang=en +[8]: https://kubernetes.io/ +[9]: https://www.tfir.io/mirantis-launches-kaas-across-bare-metal-public-and-private-clouds/ +[10]: https://www.mirantis.com/ +[11]: https://argoproj.github.io/argo-cd/ +[12]: https://www.linuxfoundation.org/projects/networking/ +[13]: https://tungsten.io/ +[14]: https://www.openstack.org/ +[15]: https://twitter.com/hashtag/istio?lang=en +[16]: https://www.tfir.io/?s=spinnaker +[17]: https://www.tfir.io/mirantis-balancing-open-source-with-guardrails/ diff --git a/sources/talk/20200227 How Melissa Di Donato Is Going To Reinvent SUSE.md b/sources/talk/20200227 How Melissa Di Donato Is Going To Reinvent SUSE.md new file mode 100644 index 0000000000..eb5fa59eb0 --- /dev/null +++ b/sources/talk/20200227 How Melissa Di Donato Is Going To Reinvent SUSE.md @@ -0,0 +1,91 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How Melissa Di Donato Is Going To Reinvent SUSE) +[#]: via: (https://www.linux.com/articles/how-melissa-di-donato-is-going-to-reinvent-suse/) +[#]: author: (Swapnil Bhartiya https://www.linux.com/author/swapnil/) + +How Melissa Di Donato Is Going To Reinvent SUSE +====== + +[![][1]][2] + +[![][1]][2] + +SUSE is one of the oldest open source companies and the first to market Linux for the enterprise. Even though it has undergone several acquisitions and a merger, it remains a strong player in the business. It has maintained its integrity and core values around open source. It continues to rely on its tried-and-tested Linux business and European markets, and generally shies away from making big moves taking big risks. + +Until now. + +[SUSE appointed Melissa Di Donato as its first female CEO][3]. She is making some serious changes to the company, from building a diverse and inclusive culture to betting on emerging technologies and taking risks. + +Soon after taking the helm last year, Di Donato spent the first few months traveling around the globe to meet SUSE teams and customers and get a better sense of the perception of the market about the company. + +Just like [Red Hat CEO Jim Whitehurst,][4] Di Donato didn’t come to the company from an open source background. She had spent the last 25 years of her career as a SUSE customer, so she did have an outsider’s perspective of the company. + +“I am not interested in what SUSE was when I joined. I am more interested in what we want to become,” she said. + +**Innovating for customers** + +After her 100-day global tour, Di Donato had a much clearer picture of the company. She found that more than 80% of SUSE customers were still traditionalists, i.e., companies such as Walgreens and Daimler who have been around for a long time. + +Over the years, these customers brought technologies into their environments to simplify things, but they ended up creating more complexities. It’s a tall order to weave through the legacy technical debt they incurred and embrace emerging technologies such as Cloud Foundry, Kubernetes and so on. + +These customers want to modernize their legacy environments and workloads, but they can’t do that with the complex environments they have built. They can’t iterate faster; they can’t respond to new opportunities and new competitors faster. + +They want to leverage cloud-native technologies like Kubernetes and containers, but it is overwhelming to evaluate technologies that are emerging at such a rapid pace. Which ones are just shiny new things and which ones do they really need them to accelerate their business goals? + +“We have to help our customers simplify their infrastructure and environment so that they can start modernizing it and start leveraging new technologies,” Di Donato said. + +While SUSE will continue to focus on core Linux OS, it will also invest in the next generation of Linux. It has been working on technologies like Kubic and MicroOS that change the way Linux is installed, managed, and operated. + +She explains, “We are going to reinvent the way operating systems are used. We are going to make sure that we provide solutions that help our customers optimize their environment, automate components to help the applications run in a much more efficient and modern way. That’s what SUSE is going to be — an innovator. We’re not there quite yet, but that’s our focus.”. + +**Evolving the company ** + +Historically, SUSE has been a fairly conservative company compared to other companies like Red Hat, which has been embracing emerging technologies at a much faster rate than any other open source software vendor. + +“We have not been in a place where we’ve been considered the risk taker. We’re the steady, stable provider of the most comprehensive unbreakable solutions in the market,” Di Donato admitted. “But we need to take that strong foundation and begin to become a bit of a risk taker, and begin to become very innovative.” + +She is also gunning for explosive growth. “We’re going to double in size by 2023. We have to go from just under half-a-billion in revenue to a billion.” + +To achieve that, SUSE will be looking at both organic and inorganic growth, including acquisition of companies, talent and technologies. “We are going to be the default choice for innovation. We are going to be the default choice for highly innovative technologies that really change the landscape,” Di Donato said. + +**Refining the brand** + +Aside from making significant changes within the company, Di Donato is working on refining the SUSE brand. She hired seasoned Ivo Totev to lead Product and Marketing and showcase the company’s differentiation. + +“We’re trying to get into the psychology of reinventing the brand,” Di Donato said. Her goal is to allocate 30-40% of SUSE’s total revenue outside of the core Linux OS towards emerging markets and develop the technologies that they’ve already built. + +SUSE _is_ home to many innovative technologies that are being used by other open source communities, even its competitors. It just didn’t market them the way Red Hat would market its technologies and projects. Even though SUSE started before Red Hat, the latter has much more visibility around the globe. + +“It’s a matter of getting the word out. We build things, but we don’t talk about it or do anything about it. We actually have to put a package around it and start selling it so people can see who we are and what value we bring to them.” + +In Di Donato’s eyes, though, good marketing isn’t everything. She argued that customers are going to demand flexibility and they are going to demand innovation that is not tied to the stack of a company. “Red Hat has a very locked-in stack that doesn’t allow them to be agnostic at all.” + +It’s quite true that unlike Red Hat, SUSE is known as an “open open-source company”, one that believes in working with partners to create an ecosystem around open source, instead of creating a tightly integrated stack that locks everyone out. + +She believes that eventually, customers would want the freedom and flexibility of picking and choosing the components they want in their stack. + +**Conclusion** + +Expect some big moves from SUSE in the near future. Less than a year into the company, new CEO Di Donato has developed a very clear vision. “We’re going to build this company based on an innovative and agile mindset. We’re not going to give up the stability and the quality of our core. What we are going to do is surround the core with really innovative thought-leading technologies that are going to set us apart from our competition… You are going to feel and experience a very different sense of excitement because we’re going to be talking much, much louder than we’ve ever talked about it before.” + +-------------------------------------------------------------------------------- + +via: https://www.linux.com/articles/how-melissa-di-donato-is-going-to-reinvent-suse/ + +作者:[Swapnil Bhartiya][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://www.linux.com/author/swapnil/ +[b]: https://github.com/lujun9972 +[1]: https://www.linux.com/wp-content/uploads/2020/02/Melissa-Di-Donato-1068x763.jpg (Melissa Di Donato) +[2]: https://www.linux.com/wp-content/uploads/2020/02/Melissa-Di-Donato-scaled.jpg +[3]: https://www.tfir.io/suse-gets-its-first-female-ceo-melissa-di-donato/ +[4]: https://www.cio.com/article/3090140/jim-whitehurst-if-its-important-to-the-linux-community-its-important-to-red-hat.html diff --git a/sources/talk/20200228 Intel takes aim at Huawei 5G market presence.md b/sources/talk/20200228 Intel takes aim at Huawei 5G market presence.md new file mode 100644 index 0000000000..22caa3c0f6 --- /dev/null +++ b/sources/talk/20200228 Intel takes aim at Huawei 5G market presence.md @@ -0,0 +1,59 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Intel takes aim at Huawei 5G market presence) +[#]: via: (https://www.networkworld.com/article/3529354/intel-takes-aim-at-huawei-5g-market-presence.html) +[#]: author: (Andy Patrizio https://www.networkworld.com/author/Andy-Patrizio/) + +Intel takes aim at Huawei 5G market presence +====== +Intel has ambitious plans to grab the 5G base station marketplace, which is still in its infancy. +Christopher Hebert/IDG + +Intel on Monday introduced a raft of new processors, and while updates to the Xeon Scalable lineup led the parade, the real news is Intel's efforts to go after the embattled Huawei Technologies in the 5G market. + +Intel unveiled its first ever 5G integrated chip platform, the Atom P5900, for use in base stations. Navin Shenoy, executive vice president and general manager of the data platforms group at Intel, said the product is designed for 5G's high bandwidth and low latency and combines compute, 100Gb performance and acceleration into a single SoC. + +"It delivers a performance punch in packet security throughput, and improved packet balancing throughput versus using software alone," Shenoy said in the video accompanying the announcement. Intel claims the dynamic load balancer native to the Atom P5900 chip is 3.7 times more efficient at packet balancing throughput than software alone. + +Shenoy said Ericsson, Nokia, and ZTE have announced that they will use the Atom P5900 in their base stations. Intel hopes to be the market leader for silicon base station chips by 2021, aiming for 40% of the market and six million 5G base stations by 2024. + +That's pretty aggressive, but the 5G fields are very green and there is plenty of room for growth. Despite all the mobile provider's commercials boasting of 5G availability, the fact is, true 5G phones are only just coming to market now, and the number of base stations is minimal. 5G has a long ramp ahead. + +The Atom P5900 puts Intel in competition with China's Huawei, which U.S. federal authorities have repeatedly labeled a security risk. Huawei has been barred from several nations, including the U.S., England, Japan, and Australia. However, Huawei also said it has secured more than 90 commercial 5G contracts globally. + +Until now, Ericsson and Nokia have asked developers such as Broadcom to help develop base station chips, while Samsung designs and manufactures its own 5G base station chips. + +**[ [Take this mobile device management course from PluralSight and learn how to secure devices in your company without degrading the user experience.][1] ]** + +### Second Generation Xeon Scalable processors + +Intel's latest launch also includes 18 2nd Gen Xeon Scalable processors; one is branded Bronze, four are Silver, and 13 are Gold. The upgraded lineup targets the entry-level to medium-range market, leaving the Platinum to duke it out with the high end AMD Epyc processors. + +The new processors range from 8 to 28 cores and include a variety of clock speeds that go down as the core count goes up. They have TDP ratings that range from 85 watts for the eight-core, 1.9Ghz Bronze 3206R to 205 watts for the 28-core, 2.7Ghz Gold 6258R. (Intel and other chip makers measure a processor's power draw with a specification called thermal design power, or TDP.) ** +** + +While most of the chips are meant for standard data center use, some processors – including the Xeon Gold 6200U, Silver 4200R, Sliver 4210T and Bronze 3200R – are specifically meant for single-socket, entry-level servers, as well as edge, networking and IoT uses. + +Intel also introduced the Intel Ethernet 700 Network Adapter, which comes with hardware-enhanced precision timing designed specifically for 5G and other scenarios with very low latency and timing requirements. + +Join the Network World communities on [Facebook][2] and [LinkedIn][3] to comment on topics that are top of mind. + +-------------------------------------------------------------------------------- + +via: https://www.networkworld.com/article/3529354/intel-takes-aim-at-huawei-5g-market-presence.html + +作者:[Andy Patrizio][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.networkworld.com/author/Andy-Patrizio/ +[b]: https://github.com/lujun9972 +[1]: https://pluralsight.pxf.io/c/321564/424552/7490?u=https%3A%2F%2Fwww.pluralsight.com%2Fcourses%2Fmobile-device-management-big-picture +[2]: https://www.facebook.com/NetworkWorld/ +[3]: https://www.linkedin.com/company/network-world diff --git a/sources/talk/20200228 No More WhatsApp- The EU Commission Switches To ‘Signal- For Internal Communication.md b/sources/talk/20200228 No More WhatsApp- The EU Commission Switches To ‘Signal- For Internal Communication.md new file mode 100644 index 0000000000..8b47602a54 --- /dev/null +++ b/sources/talk/20200228 No More WhatsApp- The EU Commission Switches To ‘Signal- For Internal Communication.md @@ -0,0 +1,70 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (No More WhatsApp! The EU Commission Switches To ‘Signal’ For Internal Communication) +[#]: via: (https://itsfoss.com/eu-commission-switches-to-signal/) +[#]: author: (Ankush Das https://itsfoss.com/author/ankush/) + +No More WhatsApp! The EU Commission Switches To ‘Signal’ For Internal Communication +====== + +_**In a move to improve the cyber-security, EU has recommended its staff to use open source secure messaging app Signal instead of the popular apps like WhatsApp.**_ + +[Signal is an open source secure messaging application][1] with end to end encryption. It is praised by the likes of [Edward Snowden][2] and other privacy activists, journalists and researchers. We’ve recently covered it in our ‘[open source app of the week][3]‘ series. + +[Signal][4] is in news for good reasons. The European Union Commissions have instructed its staff to use Signal for public instant messaging. + +This is part of EU”s new cybersecurity strategy. There has been cases of data leaks and hacking against EU diplomats and thus policy is being put in place to encourage better security practices. + +### Governments recommending open source technology is a good sign + +![][5] + +No matter what the reason is, Government bodies recommending open-source services for better security is definitely a good thing for the open-source community in general. + +[Politico][6] originally reported this by mentioning that the EU instructed its staff to use Signal as the recommended public instant messaging app: + +> The instruction appeared on internal messaging boards in early February, notifying employees that “Signal has been selected as the recommended application for public instant messaging.” + +The report also mentioned the potential advantage of Signal (which is why the EU is considering using it): + +> “It’s like Facebook’s WhatsApp and Apple’s iMessage but it’s based on an encryption protocol that’s very innovative,” said Bart Preneel, cryptography expert at the University of Leuven. “Because it’s open-source, you can check what’s happening under the hood,” he added. + +Even though they just want to secure their communication or want to prevent high-profile leaks, switching to an open-source solution instead of [WhatsApp][7] sounds good to me. + +### Signal gets a deserving promotion + +Even though Signal is a centralized solution that requires a phone number as of now, it is still a no-nonsense open-source messaging app that you may trust. + +Privacy enthusiasts already know a lot of services (or alternatives) to keep up with the latest security and privacy threats. However, with the EU Commission recommending it to its staff, Signal will get an indirect promotion for common mobile and desktop users. + +### Wrapping Up + +It is still an irony that some Government bodies hate encrypted solutions while opting to use them for their own requirement. + +Nevertheless, it is good progress for open-source services and tech, in general, is recommended as a secure alternative. + +What do you think about the EU’s decision on switching to the Signal app for its internal communication? Feel free to let me know your thoughts in the comments below. + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/eu-commission-switches-to-signal/ + +作者:[Ankush Das][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://itsfoss.com/author/ankush/ +[b]: https://github.com/lujun9972 +[1]: https://itsfoss.com/signal-messaging-app/ +[2]: https://en.wikipedia.org/wiki/Edward_Snowden +[3]: https://itsfoss.com/tag/app-of-the-week/ +[4]: https://www.signal.org/ +[5]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/02/Signal-eu.jpg?ssl=1 +[6]: https://www.politico.eu/pro/eu-commission-to-staff-switch-to-signal-messaging-app/ +[7]: https://www.whatsapp.com/ diff --git a/sources/talk/20200229 Solus Linux Creator Ikey Doherty Enters the Game Dev Business With a New Open Source Game Engine.md b/sources/talk/20200229 Solus Linux Creator Ikey Doherty Enters the Game Dev Business With a New Open Source Game Engine.md new file mode 100644 index 0000000000..a61dfca27f --- /dev/null +++ b/sources/talk/20200229 Solus Linux Creator Ikey Doherty Enters the Game Dev Business With a New Open Source Game Engine.md @@ -0,0 +1,120 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Solus Linux Creator Ikey Doherty Enters the Game Dev Business With a New Open Source Game Engine) +[#]: via: (https://itsfoss.com/ikey-doherty-serpent-interview/) +[#]: author: (John Paul https://itsfoss.com/author/john/) + +Solus Linux Creator Ikey Doherty Enters the Game Dev Business With a New Open Source Game Engine +====== + +[Ikey Doherty][1], the creator and former lead dev of [Solus][2], is back with a new project. His new company, [Lispy Snake, Ltd][3], uses open source technology to create games, with a focus on Linux support. + +I asked Ikey some questions about his new project. Here are his answers. + +![][4] + +_**It’s FOSS: What made you decide to get into game development?**_ + +**Ikey**: Honestly I would have to say a respect for older games. The creativity that came from so much limitation is frankly amazing. If you think of how limited the NES or C64 were, (or indeed my [Amstrad CPC][5]) – yet how much joy people experienced from those platforms. It’s a buzz I can’t avoid. Even though we’re a long way now from that world, I still look to model that technical excellence and creativity as best I can. I’m a sucker for good stories. + +_**It’s FOSS: There are already several open-source game engines. Why did you decide to make your own? What is Serpent’s killer feature?**_ + +**Ikey**: There are a good number of open and closed source ones, each with a great set of features. However, I’m a pretty old school developer and there is nothing I hate more than an IDE or ‘drag n drop’ codeless environment. I simply wanted to create indie games with the least fuss possible and using a framework where I didn’t have to compromise. Once you get to ‘must work nicely on Linux and be open source’ you’re kinda short on choice. + +I collected a set of projects that I’d use as the foundation for Lispy Snake’s first games, but needed something of a framework to tie them all together, as a reusable codebase across all games and updates. + +I wouldn’t say killer features are present yet – just a set of sensible decisions. Serpent is written in D so it’s highly performant with a lower barrier of entry than say C or C++. It’s allowing me to flesh out a framework that suits my development ideals and pays attention to industry requirements, such as a performant multithreading Entity Component System or the sprite batching system. + +When you rope together all the features and decisions, you get a portable codebase, that thanks to its choice of libraries like SDL and bgfx, will eventually run on all major platforms with minimal effort on our part. That basically means we’re getting OpenGL, DirectX, Vulkan and Metal “for free”. + +Being able to target the latest APIs and create indie games easily, with industry standard features emerging constantly, from a framework that doesn’t impose itself on your workflow…that’s a pretty good combination. + +![][6] + +_**It’s FOSS: Why did you name your company LispySnake? Did you have a pet snake with a speech impediment when you were a kid?**_ + +**Ikey**: Honestly? [Naughty Dog][7] was taken. Gotta love some Bandicoot. Plus, originally we were taking on some Python contracting work and I found the name amusing. It’s pretty much a nonsensical name like many of my previous projects (Like Dave. Or Dave2.) + +_**It’s FOSS: After being an operating system developer for many years, how does it feel to be working on something smaller? Would you say that your time as an OS developer gives you an edge as a game dev?**_ + +**Ikey**: OS dev needs a very high level view constantly, with the ability to context switch from macro to micro and back again. Many, many moving parts in a large ecosystem. + +Serpent is much more task orientated – though similarities in the workflow exist in terms of defining macro systems and interleaving micro features to build a cohesive whole. My background in OS dev is obviously a huge help here. + +Where it especially shines is dealing with the ‘guts’. I think a lot of indie devs (forgive me for being sweeping) are generally happy to just build from an existing kit and either embrace it or workaround the issues. There are some true gems out there like Factorio that go above and beyond and I have to hold my hat to them. + +In terms of building a new kit we get to think, properly, about cache coherency, parallel performance, memory fragmentation, context switching and such. + +Consumers of Serpent (when released in a more stable form) will know that the framework has been designed to leverage Linux features, not just spitting out builds for it. + +![][8] + +_**It’s FOSS: Recently you ported your [Serpent][9] game engine from C to the [D language][10]. Why did you make this move? What features does D have over C?**_ + +**Ikey**: Yeah honestly that was an interesting move. We were originally working on a project called lispysnake2d which was to be a trivial wrapper around SDL to give us a micro-game library. This simply used SDL_Renderer APIs to blit 2D sprites and initially seemed sufficient. Unfortunately as development progressed it was clear we needed a 3D pipeline for 2D, so we could utilize shaders and special effects. At that point SDL_Renderer is no good to you anymore and you need to go with Vulkan or OpenGL. We began abstracting the pipelines and saw the madness ensue. + +After taking a step back, I analyzed all the shortcomings in the approach, and tired of the portability issues that would definitely arise. I’m not talking in terms of libraries, I’m talking about dealing with various filepaths, encodings, Win32 APIs, DirectX vs OpenGL vs Vulkan…etc. Then whack in boilerplate time, C string shortcomings, and the amount of reinventing required to avoid linking to bloated “cross-platform” standard library style libraries. It was a bad picture. + +Having done a lot of [Go][11] development, I started researching alternatives to C that were concurrency-aware, string-sane, and packed with a powerful cross-platform standard library. This is the part where everyone will automatically tell you to use Rust. + +Unfortunately, I’m too stupid to use [Rust][12] because the syntax literally offends my eyes. I don’t get it, and I never will. Rust is a fantastic language and as academic endeavours go, highly successful. Unfortunately, I’m too practically minded and seek comfort in C-style languages, having lived in that world too long. So, D was the best candidate to tick all the boxes, whilst having C & C++ interoptability. + +It took us a while to restore feature parity but now we have a concurrency-friendly framework which is tested with both OpenGL and Vulkan, supports sprite batching and has nice APIs. Plus, much of the reinvention is gone as we’re leveraging all the features of SDL, bgfx and the DLang standard library. Win win. + +![The first game from LispySnake][13] + +_**It’s FOSS: How are you planning to distribute your games?**_ + +**Ikey**: Demo wise we’ll initially only focus on Linux, and it’s looking like we’ll use Flatpak for that. As time goes on, when we’ve introduced support and testing for macOS + Windows, we’ll likely look to the Steam Store. Despite the closed source nature, Valve have been far more friendly and supportive of Linux over the years, whilst the likes of Epic Games have a long history of being highly anti-Linux. So that’s a no go. + +_**It’s FOSS: How can people support and contribute to the development of the Serpent game engine?**_ + +**Ikey**: We have a few different methods, for what it’s worth. The easiest is to [buy a Lifetime License][14] – which is $20. This grants you lifetime access to all of our 2D games and helps fund development of our game titles and Serpent. + +Alternatively, you can [sponsor me directly on GitHub][15] to work on Serpent and upstream where needed. Bit of FOSS love. + +[Support with Lifetime License][16] + +[Sponsor the development on GitHub][15] + +* * * + +I would like to thank Ikey for taking the time to answer my questions about his latest project. + +Have any of you created a game with open source tools? If so, what tools and how was the experience? Please 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][17]. + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/ikey-doherty-serpent-interview/ + +作者:[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://twitter.com/ikey_doherty +[2]: https://getsol.us/home/ +[3]: https://lispysnake.com/ +[4]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/02/ikey_doherty_serpent_interview.png?ssl=1 +[5]: https://en.wikipedia.org/wiki/Amstrad_CPC +[6]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/02/lipsy_snake_screenshot.png?ssl=1 +[7]: https://www.naughtydog.com/ +[8]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/02/lipsy_snake.png?ssl=1 +[9]: https://github.com/lispysnake/serpent +[10]: https://dlang.org/ +[11]: https://golang.org/ +[12]: https://www.rust-lang.org/ +[13]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/02/last_peacekeeper_game.png?ssl=1 +[14]: https://lispysnake.com/the-game-raiser/ +[15]: https://github.com/sponsors/ikeycode +[16]: https://lispysnake.com/the-game-raiser +[17]: https://reddit.com/r/linuxusersgroup diff --git a/sources/talk/20200302 8 reasons to consider hyperconverged infrastructure for your data center.md b/sources/talk/20200302 8 reasons to consider hyperconverged infrastructure for your data center.md new file mode 100644 index 0000000000..10b1e0575d --- /dev/null +++ b/sources/talk/20200302 8 reasons to consider hyperconverged infrastructure for your data center.md @@ -0,0 +1,113 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (8 reasons to consider hyperconverged infrastructure for your data center) +[#]: via: (https://www.networkworld.com/article/3530072/eight-reasons-to-consider-hyperconverged-infrastructure-for-your-data-center.html) +[#]: author: (Andy Patrizio https://www.networkworld.com/author/Andy-Patrizio/) + +8 reasons to consider hyperconverged infrastructure for your data center +====== + +Thinkstock + +Demand for on-premises data center equipment is shrinking as organizations move workloads to the cloud. But on-prem is far from dead, and one segment that’s thriving is hyperconverged infrastructure ([HCI][1]). + +HCI is a form of scale-out, software-integrated infrastructure that applies a modular approach to compute, network and storage capacity. Rather than silos with specialized hardware, HCI leverages distributed, horizontal blocks of commodity hardware and delivers a single-pane dashboard for reporting and management. Form factors vary: Enterprises can choose to deploy hardware-agnostic [hyperconvergence software][2] from vendors such as Nutanix and VMware, or an integrated HCI appliance from vendors such as HP Enterprise, Dell, Cisco, and Lenovo. + +**Learn more about enterprise infrastructure trends** + + * [Making the right hyperconvergence choice: HCI hardware or software?][3] + * [10 of the world's fastest supercomputers][4] + * [NVMe over Fabrics creates data-center storage disruption][5] + * [For enterprise storage, persistent memory is here to stay][6] + + + +The market is growing fast. By 2023, Gartner projects 70% of enterprises will be running some form of hyperconverged infrastructure, up from less than 30% in 2019. And as HCI grows in popularity, cloud providers such as Amazon, Google and Microsoft are providing connections to on-prem HCI products for hybrid deployment and management. + +So why is it so popular? Here are some of the top reasons. + +### 1) Simplified design + +A traditional data center design is comprised of separate storage silos with individual tiers of servers and specialized networking spanning the compute and storage silos. This worked in the pre-cloud era, but it’s too rigid for the cloud era. “It’s untenable for IT teams to take weeks or months to provision new infrastructure so the dev team can produce new apps and get to market quickly,” says Greg Smith, vice president of product marketing at Nutanix. + +“HCI radically simplifies data center architectures and operations, reducing the time and expense of managing data and delivering apps,” he says. + +### 2) Cloud integration + +HCI software, such as from Nutanix or VMware, is deployed the same way in both a customer’s data center and cloud instances; it runs on bare metal instances in the cloud exactly the same as it does in a data center. HCI “is the best foundation for companies that want to build a hybrid cloud. They can deploy apps in their data center and meld it with a public cloud,” Smith says. + +[][7] + +“Because it’s the same on both ends, I can have one team manage an end-to-end hybrid cloud and with confidence that whatever apps run in my private cloud will also run in that public cloud environment,” he adds. + +### 3) Ability to start small, grow large + +“HCI allows you to consolidate compute, network, and storage into one box, and grow this solution quickly and easily without a lot of downtime,” says Tom Lockhart, IT systems manager with Hastings Prince Edward Public Health in Bellville, Ontario, Canada. + +In a legacy approach, multiple pieces of hardware – a server, Fiber Channel switch, host-based adapters, and a hypervisor – have to be installed and configured separately. With hyperconvergence, everything is software-defined. HCI uses the storage in the server, and the software almost entirely auto-configures and detects the hardware, setting up the connections between compute, storage, and networking. + +“Once we get in on a workload, [customers] typically have a pretty good experience. A few months later, they try another workload, then another, and they start to extend it out of their data center to remote sites,” says Chad Dunn, vice president of product management for HCI at Dell. + +“They can start small and grow incrementally larger but also have a consistent operating model experience, whether they have 1,000 nodes or three nodes per site across 1,000 sites, whether they have 40 terabytes of data or 40 petabytes. They have consistent software updates where they don’t have to retrain their people because it’s the same toolset,” Dunn added. + +### 4) Reduced footprint + +By starting small, customers find they can reduce their hardware stack to just what they need, rather than overprovision excessive capacity. Moving away from the siloed approach also allows users to eliminate certain hardware. + +Josh Goodall, automation engineer with steel fabricator USS-POSCO Industries, says his firm deployed HCI primarily for its ability to do stretched clusters, where the hardware cluster is in two physical locations but linked together. This is primarily for use as a backup, so if one site went down, the other can take over the workload. In the process, though, USS-POSCO got rid of a lot of expensive hardware and software. “We eliminated several CPU [software] licenses, we eliminated the SAN from other site, we didn’t need SRM [site recovery management] software, and we didn’t need Commvault licensing. We saved between $25,000 and $30,000 on annual license renewals,” Goodall says. + +### 5) No special skills needed + +To run a traditional three-tiered environment, companies need specialists in compute, storage, and networking. With HCI, a company can manage its environment with general technology consultants and staff rather than the more expensive specialists. + +“HCI has empowered the storage generalist,” Smith says. “You don’t have to hire a storage expert, a network expert. Everyone has to have infrastructure, but they made the actual maintenance of infrastructure a lot easier than under a typical scenario, where a deep level of expertise is needed to manage under those three skill sets.” + +Lockhart of Hastings Prince Edward Public Health says adding new compute/storage/networking is also much faster when compared to traditional infrastructure. “An upgrade to our server cluster was 20 minutes with no down time, versus hours of downtime with an interruption in service using the traditional method,” he says. + +“Instead of concentrating on infrastructure, you can expand the amount of time and resources you spend on workloads, which adds value to your business. When you don’t have to worry about infrastructure, you can spend more time on things that add value to your clients,” Lockhart adds. + +### 6) Faster disaster recovery + +Key elements of hyperconvergence products are their backup, recovery, data protection, and data deduplication capabilities, plus analytics to examine it all. Disaster recovery components are managed from a single dashboard, and HCI monitors not only the on-premises storage but also cloud storage resources. With deduplication, compression rates as high as 55:1, and backups can be done in minutes. + +USS-POSCO Industries is an HP Enterprise shop and uses HPE’s SimpliVity HCI software, which includes dedupe, backup, and recovery. Goodall says he gets about 12-15:1 compression on mixed workloads, and that has eliminated the need for third-party backup software. + +More importantly, recovery timeframes have dropped. “The best recent example is a Windows update messed up a manufacturing line, and the error wasn’t realized for a few weeks. In about 30 minutes, I rolled through four weeks of backups, updated the system, rebooted and tested a 350GB system. Restoring just one backup would have been a multi-hour process,” Goodall says. + +### 7) Hyperconvergence analytics + +HCI products come with a considerable amount of analytics software to monitor workloads and find resource constraints. The monitoring software is consolidated into a single dashboard view of system performance, including negatively impacted performance. + +Hastings recently had a problem with a Windows 7 migration, but the HCI model made it easy to get performance info. “It showed that workloads, depending on time of day, were running out of memory, and there was excessive CPU queuing and paging,” Lockhart says. “We had the entire [issue] written up in an hour. It was easy to determine where problems lie. It can take a lot longer without that single-pane-of-glass view.” + +### 8) Less time managing network, storage resources + +Goodall says he used to spend up to 50% of his time dealing with storage issues and backup matrixes. Now he spends maybe 20% of his time dealing with it and most of his time tackling and addressing legacy systems. And his apps are better performing under HCI. “We’ve had no issues with our SQL databases; if anything, we’ve seen huge performance gain due to the move to full SSDs [instead of hard disks] and the data dedupe, reducing reads and writes in the environment.” + +Join the Network World communities on [Facebook][8] and [LinkedIn][9] to comment on topics that are top of mind. + +-------------------------------------------------------------------------------- + +via: https://www.networkworld.com/article/3530072/eight-reasons-to-consider-hyperconverged-infrastructure-for-your-data-center.html + +作者:[Andy Patrizio][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.networkworld.com/author/Andy-Patrizio/ +[b]: https://github.com/lujun9972 +[1]: https://www.networkworld.com/article/3207567/what-is-hyperconvergence.html?nsdr=true +[2]: https://www.networkworld.com/article/3318683/making-the-right-hyperconvergence-choice-hci-hardware-or-software.html +[3]: https://www.networkworld.com/article/3318683/making-the-right-hyperconvergence-choice-hci-hardware-or-software +[4]: https://www.networkworld.com/article/3236875/embargo-10-of-the-worlds-fastest-supercomputers.html#slide1 +[5]: https://www.networkworld.com/article/3394296/nvme-over-fabrics-creates-data-center-storage-disruption.html +[6]: https://www.networkworld.com/article/3398988/for-enterprise-storage-persistent-memory-is-here-to-stay.html +[7]: https://www.networkworld.com/article/3440100/take-the-intelligent-route-with-consumption-based-storage.html?utm_source=IDG&utm_medium=promotions&utm_campaign=HPE21620&utm_content=sidebar ( Take the Intelligent Route with Consumption-Based Storage) +[8]: https://www.facebook.com/NetworkWorld/ +[9]: https://www.linkedin.com/company/network-world diff --git a/sources/talk/20200303 How to assess your organization-s technological maturity.md b/sources/talk/20200303 How to assess your organization-s technological maturity.md new file mode 100644 index 0000000000..75c3cda6ff --- /dev/null +++ b/sources/talk/20200303 How to assess your organization-s technological maturity.md @@ -0,0 +1,173 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How to assess your organization's technological maturity) +[#]: via: (https://opensource.com/open-organization/20/3/communication-technology-worksheet) +[#]: author: (Ron McFarland https://opensource.com/users/ron-mcfarland) + +How to assess your organization's technological maturity +====== +Implementing new communications technologies can make your organization +more open. Use this worksheet to determine whether your organization—and +its people—are prepared. +![Someone wearing a hardhat and carrying code ][1] + +New communication technologies can promote and improve [open organizational principles and practices][2]—both within a company and between customers and strategic partners, leading to greater sales and business opportunities. + +Previously, I've discussed how companies adopting new communication technologies tend to [fall into four basic categories][3] of investment and utilization. In this article, I'll demonstrate how someone might assess an organization's level of preparedness for technological innovations and the cultural changes it requires. + +### Becoming a superstar + +For the purpose of this exercise, imagine you're a salesperson working for a company that provides communication or information technology solutions to companies that need advanced information systems and would benefit by becoming "[communication superstars][3]." You'll likely want to impress upon your customers the benefits of becoming this type of user—benefits such as: + + * Enhanced customer interaction: When _our_ customers' salespeople visit _their_ customers, they'll need to make the best impression they can to build some level of trust. Therefore—before offering any product—a salesperson must get a customer talking about his situation in order to discover his particular needs, concerns, and opportunities for growth. When the customer asks the salesperson questions about what he can do to address these issues, imagine our customer's salespeople being able to answer him in seconds with detailed information, instead of making the customer wait for hours, day, or even weeks for the answers. Such technologies can increase one's capacity to make proposals, lead to faster and wiser purchasing decisions, and maximize salesperson-customer interactions—all extremely important benefits. + * Better operations: In manufacturing especially, production bottlenecks can be a drain on in-process inventory costs, and alleviating those bottlenecks is critical. Knowing _exactly_ the situation (in-process inventory levels and processing speed, for example) of _every_ stage of a production line in real time can greatly [improve productivity][4]. + * Development of new business strategies: With new communication technology expertise, a company could open up new markets and opportunities that would have historically been out of its reach. + + + +### **Let's do some research** + +Armed with knowledge of those benefits, again imagine you're a salesperson at an enterprise communication or information technology company. You meet a potential customer at an exhibition or business summit, and she describes the following situation to you: + +> "I'm the Operations Manager of a small, local transportation company that makes deliveries within and between several of the surrounding cities. We have a fleet of 30 trucks, all of various sizes and makes. I know the company's information system must to be improved; much of our communication is done through email attachments, texting, and mobile phone calls. We have no central information operating system." + +A large, public, national trucking company has set up in her area. She's studied this competitor and read several of its news releases and annual reports. She's learned the company has a centralized communications system, and that all its trucks have tracking technologies that monitor the location of every truck in operation. Trucks also feature sensors that monitor many vehicle operations, including average and specific engine RPM per route by vehicle and driver, and miles travelled in particular conditions (to determine fuel economy and maintenance schedules). An electronic parts delivery system connects this company's service operations with a network of dealers to reduce the time service technicians must wait for parts. + +This is what the small local trucking company must compete against. So its operations manager asks you, the IT company salesperson, what you can do to help. + +You decide that your first step is to conduct a survey to learn more about both the company's current communication technology system and the personnel's attitude toward this system in order to see what _could_ and _should_ be done to improve the situation. While there, you want to learn this trucking company's IT status _before_ making any recommendations. + +I've created a worksheet you might use to facilitate this conversation. + +### Taking the temperature + +The first part of the worksheet can help you develop a baseline assessment of an organization's readiness for technological change. + +#### Part 1: Baseline maturity relative to competitors + +Generally, if the customer scores between 10 and 42, then that customer needs more assistance adopting new communication technology, but this varies by industry. If the score is between 43 and 70, then (when compared to competitors the customer is likely already mature in its use of communication technologies. + +#### Part 2: Leaders' relationship to communication technologies + +Next, you need to assess the company leadership's relationship to technologies, associated processes, and cultural changes. So let's make those calculations in Part 2 of the worksheet. + +Here again, depending on the competitive environment, if the score is between 10 and 42, then the company is generally _not_ completely utilizing the communication technology it has. If the score is between 43 and 70, then generally the company puts the communication technology it has to good, creative use. + +Organizational leaders must lead the conversation about using more advanced communication systems in the organization. Therefore management must establish training programs to teach everyone in the organization the skills required to _use_ that technology (a step often forgotten or poorly implemented). + +#### Part 3: Awareness of challenges and opportunities + +We now need to help the organization think more strategically about its use of communication technologies to implement open processes and open culture. We'll do this with Part 3 of the worksheet. + +If an organization scores higher than 15, the company understands the communication technology landscape fairly well. If the score is between 9 and 15, the organization needs to isolate its weakest areas and remedy them. A score of less than 9 indicates that the organization should consider conducting new awareness exercises and/or communication technology discovery programs. + +#### Part 4: Technological mastery relative to competitors + +Next, we need to better understand the trucking company's current strategic assets and its level of technological mastery relative to competitors. We'll do that with Part 4 of the worksheet. + +An organization that scores above 16 in this section likely knows where it stands and what its innovation trajectory is in comparison to competitors. A score of 7 to 16 means the organization needs to build alignment around a viable renewal path. A score of less than 7 might mean the organization should conduct a communication technology maturity assessment and update its best practices. + +#### Part 5: Ability to articulate technological vision + +Now let's explore how well the organization's senior leaders can articulate a vision for the role communication technology will play in the company's future. That's Part 5 of the worksheet. + +If the organization scores over 24, then its members likely believe its executives are aligned on a technological vision (and are considering competitors). A score of 14 to 24 should prompt us to isolate the root causes of the concerns and work with the team to remedy them. Anything less than 14 should spur a structured senior executive alignment initiative. + +Questions like these can clarify the extent to which employees must be involved in communication technology investment decision-making and utilization. Front-line members typically know what's necessary, what's available, and what the organization should introduce. + +### From vision to action + +I've seen first-hand that in situations like these, purchasing technologies is only half the problem. Getting people to buy into the system and use it to full capacity are far bigger challenges. + +In this section, we'll assess the organization's ability to translate technological vision into action. + +#### Part 6: Ability to translate vision to action + +First, let's see how the company is currently converting its vision into an action plan relative to competitors. We'll return to the worksheet, specifically Part 6. + +A company scoring more than 17 points likely has a robust plan and evaluation system in place, and is focused on engaging people in executing technological adoption efforts relative to competitors. Organizations scoring 7 to 17 should review the action plan and milestone checklist weekly for content and alignment. Those scoring less than 7 should conduct a full review of its milestone checklist and action plan processes. + +#### Part 7: Supervision strategies + +Few plans succeed without proper supervision, so you'll want to assess the organization's plans to oversee change management efforts. We'll use the trusty worksheet—this time, Part 7. + +Did the company score something greater than 15? Then its supervision model is in good shape. Maybe 8 to 15? It should check its governance principles and/or program leadership. Less than 8? Time to rework (or design for the first time) its supervision principles. + +#### Part 8: Funding strategy for implementation + +Of course, organizational initiatives like these require funding. So you'll want to assess the organization's financial commitment to technological change. Once again, let's use our worksheet (Part 8 this time). + +Scoring more than 16 points means the company's funding for new communication technologies is strong. Scoring 8 to 16 means the company should work to ensure that the company portfolio, funding, and business strategy are better aligned. Anything less than 8 means company needs to rework its investment and funding strategy for new technologies. + +#### Part 9: Clarity and promotion of vision + +Organizational leaders should constantly be clarifying and advocating plans to adopt new technologies. How are they doing? Let's review Part 9 of our worksheet. + +If the company scores over 17, then it's likely doing a good job of marketing its ambitions. If it scores somewhere between 7 and 17, it should isolate dimensions of its messaging that need refinement and work with the team to remedy them. If it scores less than 7, it should consider developing a specific program to convey the company's ambition more broadly. + +#### Part 10: Ability to build and sustain engagement + +Changes to technological systems and processes don't happen automatically. People need to invest in them, and leaders need to sustain their engagement in the organizational changes. Not everyone will buy in (as I've [written previously][5]). We can assess how well the organization is doing this with Part 10 of the worksheet. + +A score over 23 indicates that the company is doing a good job building momentum while introducing communication technologies. A score of 12 to 23 means that organization might need to isolate some part of the process that's not proceeding satisfactorily and remedy that component. Less than 12? The company needs to design and conduct a full engagement program. + +### Organizational considerations + +This final section assesses specific _organizational_ capacities—that is, the organization's culture, its structure, and its processes. Becoming more open by adopting new communication technologies is only possible if the organization itself is flexible and willing to change. + +#### Part 11: Organizational culture + +Is the organizational environment amenable to the kinds of changes necessary for effectively adopting new communication activities? We'll assess that in Part 11 of our worksheet. + +An organization scoring more than 16 points is already shifting its organizational behaviors and culture ahead of competitors. One scoring between 7 and 16 points should investigate root causes of concerns about cultural changes and work with the team to remedy problems. An organization scoring less than 7 should begin working to shift its culture around communication practices and expectations. + +#### Part 12: Organizational structure + +Does the organization's current structure allow it to sustain communication technology innovations? Use Part 12 of the worksheet to gather an initial impression. + +Scoring over 16 means the company possesses the basic structural capabilities necessary for sustained, steady, technical changes. Scoring between 8 and 16 means the company has only begun implementing projects aimed at developing necessary structural capabilities, but more effort is needed. And a score of less than 8 indicates that the company needs to consider specific programs for improving basic structural capabilities. + +#### Part 13: Reward and incentive structures + +Are the organization's reward and incentive structures aligned with the organization's goals for introducing and adopting new communication technologies? Let's look at the worksheet one last time. + +A score over 14 indicates that the company's current reward structures are aligned with its communication technology objectives. A score between 6 and 14 tells us that the organization should build stronger consensus around a viable reward strategy aligned to communication technology renewal. And a score of less than 6 should prompt leadership to implement specific reward structures that accomplish its communication technology adoption goals. + +### Post-survey debrief + +After collecting those data, you're now in a position to ask how your information technology company can help your potential customer in four areas: + + 1. Data gathering and company strategy analytics + 2. Social media, internet utilization, and interaction internally + 3. Telecommunication utilization within company (to avoid excess and unnecessary traveling for meetings, etc.) + 4. Automation technology utilization within the company + + + +You're also able to inquire within your company (among solution architects, for example) who we potentially should partner with if need be in order to achieve this transportation company's goals in these four areas." + +In these kinds of strategic partnerships, open organization principles—especially transparency, inclusivity, collaboration, and community—come alive. One person cannot do this kind of work alone. + +I've seen first-hand that in situations like these, purchasing technologies is only _half the problem._ Getting people to _buy into the system_ and _use it to full capacity_ are far bigger challenges. These challenges are cultural, not technological. Being a "communication superstar" means being great in both those areas—both the communication technology itself, as well as the culture and process expertise necesasry for actual utilization. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/open-organization/20/3/communication-technology-worksheet + +作者:[Ron McFarland][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/ron-mcfarland +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/build_structure_tech_program_code_construction.png?itok=nVsiLuag (Someone wearing a hardhat and carrying code ) +[2]: https://opensource.com/open-organization/resources/open-org-definition +[3]: https://opensource.com/open-organization/20/1/communication-technology-superstars +[4]: https://www.slideshare.net/RonMcFarland1/improving-processes-65115172?qid=b0a0fde3-62c6-4538-88c8-1bfd70485cee&v=&b=&from_search=5 +[5]: https://opensource.com/open-organization/17/1/escape-the-cave diff --git a/sources/talk/20200303 Key Takeaways from Cisco-s Annual Internet Report.md b/sources/talk/20200303 Key Takeaways from Cisco-s Annual Internet Report.md new file mode 100644 index 0000000000..d450597913 --- /dev/null +++ b/sources/talk/20200303 Key Takeaways from Cisco-s Annual Internet Report.md @@ -0,0 +1,78 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Key Takeaways from Cisco’s Annual Internet Report) +[#]: via: (https://www.networkworld.com/article/3529989/key-takeaways-from-cisco-s-annual-internet-report.html) +[#]: author: (Zeus Kerravala https://www.networkworld.com/author/Zeus-Kerravala/) + +Key Takeaways from Cisco’s Annual Internet Report +====== +Businesses need to be ready for the massive wave of devices and bandwidth that are coming in the next vide years +Natalya Burova / Getty Images + +By 2023, two-thirds of the world’s population will have Internet access—that’s 5.3 billion total Internet users, compared to 3.9 billion in 2018. The number of devices and connections will also skyrocket. There will be 3.6 networked devices per capita by 2023, whereas in 2018, there were 2.4 networked devices per capita. + +These findings come from Cisco’s _[Annual Internet Report (2018 – 2023) ][1]_(AIR) - previously known as Visual Network Index (VNI), which assesses the digital transformation across different business segments and their adoption of networking technologies, including fixed broadband, Wi-Fi, and mobile (3G, 4G, 5G).  + +[[Get regularly scheduled insights by signing up for Network World newsletters.]][2] + +The report described an increased demand for new or enhanced applications that boost workforce productivity or improve customer experiences. In today’s mobile world, users expect their devices (and networks) to deliver on all fronts: quality, ease of use, and seamless connectivity.  + +[Cisco][3] + +The report can be useful as companies plan out their network strategies. One of the aspects of the VNI that Cisco carried over to AIR is an [online tool][4] that lets people slice and dice the information by country, device or other factors. They also included an [“Internet readiness” tool ][5]that explores how prepared different regions are for the coming wave of devices and need for bandwidth.  + +**More network automation is needed** + +To meet growing demand for enhanced apps, enterprises need automated network monitoring and optimization, andt that can be achieved with software-defined wide area networking (SD-WAN). Software-driven networks create more flexible infrastructures that can adapt to changing traffic requirements, which becomes necessary as more enterprises move to hybrid clouds, the report says. + +Policy-based automation and Intent-Based Networking (IBN) are just as important when it comes to building agile, portable, and scalable networks. IBN, as the name implies, captures business intent through analytics and machine learning. One trend Cisco observed in its report is how business WAN traffic flow patterns are becoming more software-based and hybrid in nature, creating a need for IBN solutions, the report says. + +[][6] + +**SD-WAN is core to network success** + +SD-WAN is important to the network edge, which brings computing, storage, and networking resources closer to users and devices. Cisco found many use cases driving the need for greater edge-computing capabilities. One of them is finding ways to control data from the billions of Internet of Things (IoT) endpoints being added to the network edge. + +Out of the 29.3 billion networked devices in use by 2023, about half will support various IoT applications, per Cisco’s report. As for machine-to-machine (M2M) communication, there will be 14.7 billion connections by 2023. Consumers will hold the biggest share (74%) of total devices and connections, with businesses claiming approximately 26%. However, the consumer share will grow at a slower rate than business. + +How will enterprises manage to secure all networked devices and data? Cisco recommends creating a security policy that strikes a balance between data protection and ease of use. In other words, networks will have to be intelligent enough to grant access to the right users without putting them through a difficult authentication process. + +**Network managers still struggle to lower operational costs** + +Network managers continue to struggle with rising operational costs, as the explosion of devices and data outpaces IT resources. Cisco found nearly 95% of network changes are still performed manually, resulting in operational costs that outweigh network costs. That’s where IT automation can help, enabled by SDN, intelligent network-edge enhancements, and unified domain controls. + +In addition to exploring business-specific networking needs, Cisco outlined some trends in consumer and small-to-medium business (SMB) markets. Here are the key takeaways: + + * **Next-generation applications**—built with artificial intelligence (AI) and machine learning—will create complex requirements and new business models. Mobile applications, specifically, will drive future consumer, SMB, and enterprise needs, with 299.1 billion mobile apps downloaded worldwide by 2023. + * **Mixed devices and connections** are enabling myriad M2M apps. Connected-home, video-surveillance, connected appliances, and tracking apps will make up 48% of M2M connections by 2023. Connected-car apps will be the fastest-growing category, with connected cities coming in second. + * **Accelerating broadband speeds** will affect traffic growth and use of high-bandwidth content and applications. Average broadband speeds will more than double globally from 45.9 Mbps (in 2018) to 110.4 Mbps (in 2023). Fiber-to-the-home (FTTH), high-speed DSL, and cable broadband adoption will contribute to the growth. + * **Wi-Fi will gain momentum** as devices and IoT connections increase. By 2023, the number of public Wi-Fi hotspots will grow to 628 million, up from 169 million in 2018. Wi-Fi 6 promises to boost speeds by up to 30%, compared to the current generation. More importantly, next-gen Wi-Fi will significantly improve real-time communications and high-definition video, impacting both consumer and business sectors. + + + +Join the Network World communities on [Facebook][7] and [LinkedIn][8] to comment on topics that are top of mind. + +-------------------------------------------------------------------------------- + +via: https://www.networkworld.com/article/3529989/key-takeaways-from-cisco-s-annual-internet-report.html + +作者:[Zeus Kerravala][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.networkworld.com/author/Zeus-Kerravala/ +[b]: https://github.com/lujun9972 +[1]: http://www.cisco.com/go/ciscoair +[2]: https://www.networkworld.com/newsletters/signup.html +[3]: https://www.cisco.com/c/en/us/solutions/collateral/executive-perspectives/annual-internet-report/white-paper-c11-741490.html +[4]: https://www.cisco.com/c/en/us/solutions/executive-perspectives/annual-internet-report/air-highlights.html +[5]: https://www.cisco.com/c/en/us/solutions/service-provider/cloud-readiness-tool/index.html +[6]: https://www.networkworld.com/article/3440100/take-the-intelligent-route-with-consumption-based-storage.html?utm_source=IDG&utm_medium=promotions&utm_campaign=HPE21620&utm_content=sidebar ( Take the Intelligent Route with Consumption-Based Storage) +[7]: https://www.facebook.com/NetworkWorld/ +[8]: https://www.linkedin.com/company/network-world diff --git a/sources/talk/20200303 Most-used libraries, open source adoption, and more industry trends.md b/sources/talk/20200303 Most-used libraries, open source adoption, and more industry trends.md new file mode 100644 index 0000000000..769f4f550e --- /dev/null +++ b/sources/talk/20200303 Most-used libraries, open source adoption, and more industry trends.md @@ -0,0 +1,61 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Most-used libraries, open source adoption, and more industry trends) +[#]: via: (https://opensource.com/article/20/3/libraries-5G-more-industry-trends) +[#]: author: (Tim Hildred https://opensource.com/users/thildred) + +Most-used libraries, open source adoption, and more industry trends +====== +A weekly look at open source community and industry trends. +![Person standing in front of a giant computer screen with numbers, data][1] + +As part of my role as a senior product marketing manager at an enterprise software company with an open source development model, I publish a regular update about open source community, market, and industry trends for product marketers, managers, and other influencers. Here are five of my and their favorite articles from that update. + +## [Most-used libraries revealed – plus 10 things developers should be doing to keep their code secure][2] + +> “The report begins to give us an inventory of the most important shared software and potential vulnerabilities and is the first step to understand more about these projects so that we can create tools and standards that results in trust and transparency in software," explained Jim Zemlin, executive director at the Linux Foundation, in a statement. + +**The impact**: Importantly, there is also a great list of packages for backdoors here. + +## [Survey: Open source adoption, quality gains][3] + +> Overall, the survey finds there has been [a marked shift away from proprietary software][4]. Only 42% said that more than half of the software they use today is proprietary, down from 55% a year ago. Two years from now only 32% said they expect proprietary software to account for more than half their portfolio. On average, respondents said 36% of their organization’s software is open source, which in two years is expected to increase to 44% in two years. A total of 77% said they would increase usage of open source software over the next 12 months. + +**The impact**: There is a clear virtuous cycle of companies getting more comfortable with open source and more open source software being created. If there isn't already, there will be a rule 34 about open source software. + +## [5G must go cloud-native from edge to core][5] + +> A containerised core will be the heart of cloud-native 5G networks. Managing and scaling networking apps in containers using a modular microservices approach will help service providers to dynamically orchestrate and grow service capacity across a distributed architecture. + +**The impact**: When you're building something complicated and reliable, you really can't look past starting with open source software. Unless you want to be in a foot race against "a Kawasaki" (that's a motorbike, right?). + +## [High-performance object storage, Kubernetes, + why you can't containerize a storage appliance][6] + +> True multi-tenancy isn’t possible unless the storage system is extremely lightweight and able to be packaged with the application stack. If the storage system takes too many resources or contains too many APIs, it won’t be possible to pack many tenants on the same infrastructure. + +**The impact**: The title of this post is a challenge to someone much more skilled and knowledgable than I. + +_I hope you enjoyed this list and come back next week for more open source community, market, and industry trends._ + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/3/libraries-5G-more-industry-trends + +作者:[Tim Hildred][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/thildred +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/data_metrics_analytics_desktop_laptop.png?itok=9QXd7AUr (Person standing in front of a giant computer screen with numbers, data) +[2]: https://www.theregister.co.uk/2020/02/20/linux_foundation_report/ +[3]: https://devops.com/surevey-sees-open-source-adoption-quality-gains/ +[4]: https://devops.com/devops-deeper-dive-devops-accelerates-open-source-innovation-pace/ +[5]: https://www.5gradar.com/features/5g-must-go-cloud-native-from-edge-to-core +[6]: https://blog.min.io/high-performance-object-storage-with-kubernetes/ diff --git a/sources/talk/20200304 Seawater, humidity inspire new ways to generate power.md b/sources/talk/20200304 Seawater, humidity inspire new ways to generate power.md new file mode 100644 index 0000000000..7e2dc5927f --- /dev/null +++ b/sources/talk/20200304 Seawater, humidity inspire new ways to generate power.md @@ -0,0 +1,79 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Seawater, humidity inspire new ways to generate power) +[#]: via: (https://www.networkworld.com/article/3529893/seawater-humidity-inspire-new-ways-to-generate-power.html) +[#]: author: (Patrick Nelson https://www.networkworld.com/author/Patrick-Nelson/) + +Seawater, humidity inspire new ways to generate power +====== +Researchers around the globe are working on new ways to generate huge amounts of power that will be needed for the shift to a data-driven society. +Getty Imags + +The possiblity of a future power-availability crunch – spurred in part by a global increase in data usage – is driving researchers to get creative with a slew of new and modified ways to generate and store energy. + +Ongoing projects include the use of seawater for batteries; grabbing ambient humidity; massive water storage systems for hydropower; and solar panels that work at night. Here are some details: + +### Batteries based on seawater + +Seawater will provide "super-batteries," says the University of Southern Denmark. Researchers there have been studying how to use sodium, which is abundant in seawater, as an alternative to lithium in batteries. + +[[Get regularly scheduled insights by signing up for Network World newsletters.]][1] + +"Sodium is a very readily available resource," the school says in a [press release][2], and it can be easily extracted from seawater. Lithium, on the other hand, is a limited resource that's mined only in a few places in the world, says research leader Dorthe Bomholdt Ravnsbæk of the department of physics, chemistry and pharmacy at the university. Batteries based on seawater would also alleviate the need for cobalt, which is used in lithium cells. The team in Denmark (working with Massachusetts Institute of Technology) believes it has come up with a new electrode material, based on manganese, that will make the seawater battery ultimately viable. + +### Using ambient moisture to generate power + +Humidity captured with bio-electronics could end up being a viable power source for sensors, say some scientists. + +"Harvesting energy from the environment offers the promise of clean power for self-sustained systems," notes University of Massachusetts researchers [in an article published in Nature][3]. However, known technologies often have restrictive environmental requirements – solar panels that must be mounted outside, for example – that limit their energy-producing potential. + +Moisture harvesting with thin-film, protein nanowires doesn't have restrictive environmental requirements. Sustained voltages of about half a volt can be obtained from moisture present in normal, ambient air. "Connecting several devices linearly scales up the voltage and current to power electronics," the Amherst group claims. "Our results demonstrate the feasibility of a continuous energy-harvesting strategy that is less restricted by location or environmental conditions than other sustainable approaches." + +[][4] + +### Seasonally pumped hydropower storage  + +On a larger scale, inland water storage could solve renewable power issues, say scientists at the International Institute for Applied Systems Analysis. + +One big problem collecting power from the environment, as opposed to using fossil fuels, is where to store the on-the-fly electricity being generated. The Austrian organization believes that hydropower systems should be used to contain renewable energy. It's cheap, for starters. In addition, seasonal pumped hydropower storage (SPHS) is better than wind or solar, the group claims, because it not only generates the power in real time as it’s needed, but also isn't affected by variations— a windy day isn't required, for example. + +SPHS operates by pumping water into dammed, river-adjacent reservoirs when water flow is high but power demand is low. Water is then allowed to flow out of the reservoir, through turbines—similar to hydroelectric—when energy demand increases. Electricity is thus created. The group, in a [press release][5] related to a study just released, says the technique is highly economical, even including required land purchases, excavation and tunneling. + +### Nighttime, anti-solar cells + +Contrary to popular belief, photovoltaic solar panels don't actually need full sun to function. Cloud cover allows some to work just fine, just not as well. Nighttime photovoltaic, however, is something more radical: + +The earth should be used as a heat source, and the night sky a heat sink, say Jeremy Munday and Tristan Deppe of the department of electrical and computer engineering at University of California, Davis. They shared their idea for nighttime photovoltaic cells in an [abstract of a paper][6] published by American Chemical Society's ACS Photonics. + +What they are suggesting is using thermoradiative photovoltaics, where deep space radiative cooling ([which I’ve written about before][7]) is combined with photovoltaics. Current is created as infrared light – or heat, in other words – is radiated into extremely cold, deep space. + +"Similar to the way a normal solar cell works, but in reverse," Munday says of their anti-solar panel concept, quoted in a [UC Davis news article][8].  + +Join the Network World communities on [Facebook][9] and [LinkedIn][10] to comment on topics that are top of mind. + +-------------------------------------------------------------------------------- + +via: https://www.networkworld.com/article/3529893/seawater-humidity-inspire-new-ways-to-generate-power.html + +作者:[Patrick Nelson][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.networkworld.com/author/Patrick-Nelson/ +[b]: https://github.com/lujun9972 +[1]: https://www.networkworld.com/newsletters/signup.html +[2]: https://www.sdu.dk/en/nyheder/Forskningsnyheder/skal_fremtidens_superbatterier_laves_af_havvand +[3]: https://www.nature.com/articles/s41586-020-2010-9 +[4]: https://www.networkworld.com/article/3440100/take-the-intelligent-route-with-consumption-based-storage.html?utm_source=IDG&utm_medium=promotions&utm_campaign=HPE21620&utm_content=sidebar ( Take the Intelligent Route with Consumption-Based Storage) +[5]: https://iiasa.ac.at/web/home/about/news/200219-seasonal-pumped-storage.html +[6]: https://pubs.acs.org/toc/apchd5/7/1 +[7]: https://www.networkworld.com/article/3222850/space-radiated-cooling-cuts-power-use-21.html +[8]: https://www.ucdavis.edu/news/anti-solar-cells-photovoltaic-cell-works-night +[9]: https://www.facebook.com/NetworkWorld/ +[10]: https://www.linkedin.com/company/network-world diff --git a/sources/talk/20200305 Chinese auto giant Geely plans a private satellite network to support autonomous vehicles.md b/sources/talk/20200305 Chinese auto giant Geely plans a private satellite network to support autonomous vehicles.md new file mode 100644 index 0000000000..8bf990573e --- /dev/null +++ b/sources/talk/20200305 Chinese auto giant Geely plans a private satellite network to support autonomous vehicles.md @@ -0,0 +1,61 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Chinese auto giant Geely plans a private satellite network to support autonomous vehicles) +[#]: via: (https://www.networkworld.com/article/3530336/chinese-auto-giant-geely-plans-a-private-satellite-network-to-support-autonomous-vehicles.html) +[#]: author: (Patrick Nelson https://www.networkworld.com/author/Patrick-Nelson/) + +Chinese auto giant Geely plans a private satellite network to support autonomous vehicles +====== +Geely is developing a satellite network to provide high-bandwidth wireless needed by on-board applications in self-driving vehicles. +Olivier Le Moal / Getty Images + +What does a large automaker that’s morphing into a mobile-technology company and heavily investing in autonomous vehicles need to add to its ecosystem? Probably connectivity, and that’s likely why Chinese car giant Geely says it will be building its own satellite data network. + +A need for “highly accurate, autonomous driving solutions,” is part of what’s driving the strategy, the company says in a [press release][1]. Geely – the largest car maker in China and whose assets include Volvo and a stake in Lotus – has begun building a test facility in Taizhou City where it will develop satellite models, the company says. + +[[Get regularly scheduled insights by signing up for Network World newsletters.]][2] + +“The creation of a truly smart, three-dimensional mobility ecosystem,” as the company describes its Geespace project, will include precise navigation, cloud computing and high-speed Internet functions. Geely is investing $326 million in the project [according to Reuters][3], citing a statement from the company. + +Over-the-air updating of vehicle software is a principal reason data networks will become prevalent in automobile technology. Historically, car companies haven’t worried much about the speedy updating of end-user’s systems, in part because they’ve liked getting customers back into the dealership to upsell service options and pitch new cars. A leisurely software patch while the customer hangs around drinking warm coffee and watching daytime soaps suits that purpose. However, autonomous cars are a different story: The safety of self-driving cars can’t tolerate software vulnerabilities. + +Control over vehicle positioning also comes into play. Knowing where the car is and where obstacles are is more important than in traditional vehicles. Lane-change and accident avoidance, for example, are autonomous-vehicle features that require high levels of accuracy. + +“The Geespace low-orbit satellite network will offer much higher centimeter-accurate precision,” Geely says, comparing its proposed constellation with the U.S. government-owned Global Positioning System. + +Data processing, artificial intelligence and infotainment onboard the vehicles all need fat networks, too. Former Intel CEO Brian Krzanich [said at a talk I attended a few years ago][4] that he thought cars would soon create 4,000 GB of data per hour of driving because of the number of sensors, such as cameras, that they’ll be equipped with. + +[][5] + +The Geely private satellite network is the first of its kind for an industrial use and joins [a trend in private wireless networking][6]. Private, terrestrial 5G networks and private LTE networks allow companies to control their own data and uptime, rather than relying on service providers. Mercedes-Benz is reportedly working on a private 5G network for privacy and security. + +“As vehicles become more connected and integrated into the Internet of Things ecosystem, the demand for data has grown exponentially,” Geely says. + +Geely will begin launching the Geespace satellites by the end of 2020. + +Join the Network World communities on [Facebook][7] and [LinkedIn][8] to comment on topics that are top of mind. + +-------------------------------------------------------------------------------- + +via: https://www.networkworld.com/article/3530336/chinese-auto-giant-geely-plans-a-private-satellite-network-to-support-autonomous-vehicles.html + +作者:[Patrick Nelson][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.networkworld.com/author/Patrick-Nelson/ +[b]: https://github.com/lujun9972 +[1]: http://zgh.com/media-center/news/2020-03-03-1/?lang=en +[2]: https://www.networkworld.com/newsletters/signup.html +[3]: https://www.reuters.com/article/geely-china-satellite-autonomous/chinas-geely-invests-326-mln-to-build-satellites-for-autonomous-cars-idUSL4N2AV45H +[4]: https://www.networkworld.com/article/3147892/one-autonomous-car-will-use-4000-gb-of-dataday.html +[5]: https://www.networkworld.com/article/3440100/take-the-intelligent-route-with-consumption-based-storage.html?utm_source=IDG&utm_medium=promotions&utm_campaign=HPE21620&utm_content=sidebar ( Take the Intelligent Route with Consumption-Based Storage) +[6]: https://www.networkworld.com/article/3319176/private-5g-networks-are-coming.html +[7]: https://www.facebook.com/NetworkWorld/ +[8]: https://www.linkedin.com/company/network-world diff --git a/sources/talk/20200305 Report- Most IoT transactions are not secure.md b/sources/talk/20200305 Report- Most IoT transactions are not secure.md new file mode 100644 index 0000000000..96a2add2d7 --- /dev/null +++ b/sources/talk/20200305 Report- Most IoT transactions are not secure.md @@ -0,0 +1,61 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Report: Most IoT transactions are not secure) +[#]: via: (https://www.networkworld.com/article/3530476/report-most-iot-transactions-are-not-secure.html) +[#]: author: (Andy Patrizio https://www.networkworld.com/author/Andy-Patrizio/) + +Report: Most IoT transactions are not secure +====== +Data gathered by security provider Zscaler shows that not only are most internet-of-things transactions unsecured, they are also unauthorized as IoT creeps in as shadow-IT devices. +Iot + +The majority of [Internet of Things (IoT)][1] transactions don’t use even basic security, and there is a great deal of unauthorized IoT taking place inside the perimeter of enterprise firewalls thanks to shadow IT, a new study finds. + +Security vendor Zscaler analyzed nearly 500 million IoT transactions from more than 2,000 organizations over a two-week period. [The survey][2] found 553 different IoT devices from more than 200 different manufacturers, many of which had their security turned off. + +[[Get regularly scheduled insights by signing up for Network World newsletters.]][3] + +The study was done on Zscaler’s own Internet Access security service. It found the rate of IoT growth to be explosive: When it first started monitoring IoT traffic in May 2019, IoT traffic generated by its enterprise customer base was 56 million IoT transactions per month. By February 2020, that number had soared to 33 million transactions _per day_, or one billion IoT transactions per month, a 1,500% increase. + +Zscaler is a bit generous in what it defines as enterprise IoT devices, from devices such as data-collection terminals, digital signage media players, industrial control devices, medical devices, to decidedly non-business devices like digital home assistants, TV set-top boxes, IP cameras, smart home devices, smart TVs, smart watches and even automotive multimedia systems. + +“What this tells us is that employees inside the office might be checking their nanny cam over the corporate network. Or using their Apple Watch to look at email. Or working from home, connected to the enterprise network, and periodically checking the home security system or accessing media devices,” the company said in its report. + +Which is typical, to be honest, and let (s)he who is without sin cast the first stone in that regard. What’s troubling is that roughly 83% of IoT-based transactions are happening over plaintext channels, while only 17% are using [SSL][4]. The use of plaintext is risky, opening traffic to packet sniffing, eavesdropping, man-in-the-middle attacks and other exploits. + +And there are a lot of exploits. Zscaler said it detects about 14,000 IoT-based malware exploits per month, a seven-fold increase over the previous year. + +“Folks can keep their smart watches, smart closets, and whatever else they think is making them smart. Banning devices is not going to be the answer here. The answer is changing up the narrative on how we think about IoT devices from a security and risk standpoint, and what expectations we put on manufacturers to increase the security posture of these devices,” wrote Deepen Desai, Zscaler’s vice president of security research in a [blog post][5]. + +Desai said the solution is “taking a [zero-trust][6] mentality.” It may be a buzzword but, “it’s about security people not trusting any person or device to touch the network—that is, until you know who the user is, what the device is, and whether that user and device are allowed to access the applications they’re trying to reach.” + +Naturally Zscaler sells such a solution, but he makes a valid point. This is an ages-old problem I have seen time and again; a hot new technology comes along, everyone rushes to embrace it, then they think about securing it later. IoT is no different. + +Whatever your device, at least go into the settings and turn on SSL. + +Join the Network World communities on [Facebook][7] and [LinkedIn][8] to comment on topics that are top of mind. + +-------------------------------------------------------------------------------- + +via: https://www.networkworld.com/article/3530476/report-most-iot-transactions-are-not-secure.html + +作者:[Andy Patrizio][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.networkworld.com/author/Andy-Patrizio/ +[b]: https://github.com/lujun9972 +[1]: https://www.networkworld.com/article/3207535/what-is-iot-the-internet-of-things-explained.html +[2]: https://info.zscaler.com/resources-industry-iot-in-the-enterprise +[3]: https://www.networkworld.com/newsletters/signup.html +[4]: https://www.networkworld.com/article/2303073/lan-wan-what-is-transport-layer-security-protocol.html +[5]: https://www.zscaler.com/blogs/corporate/shining-light-shadow-iot-protect-your-organization +[6]: https://www.networkworld.com/article/3487720/the-vpn-is-dying-long-live-zero-trust.html +[7]: https://www.facebook.com/NetworkWorld/ +[8]: https://www.linkedin.com/company/network-world diff --git a/sources/talk/20200306 How I learned about burnout the hard way.md b/sources/talk/20200306 How I learned about burnout the hard way.md new file mode 100644 index 0000000000..ce9af6fb52 --- /dev/null +++ b/sources/talk/20200306 How I learned about burnout the hard way.md @@ -0,0 +1,111 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How I learned about burnout the hard way) +[#]: via: (https://opensource.com/article/20/3/burnout) +[#]: author: (Jason Hibbets https://opensource.com/users/jhibbets) + +How I learned about burnout the hard way +====== +Burnout can happen to anyone. Here are the 3 things I wish I knew before +I burned out. +![Light bulb][1] + +In early 2017, I was mentally in a bad spot. It was the perfect storm of stress, the kind that no one asks for, but you deal with the hand you're dealt. Work was piling up to a point where I couldn't process all the things that were expected of me. I was training for spring half-marathons, which should have been stress relief, but I was putting too much pressure on myself to perform at a high level. And then on top of the everyday family obligations, a surgery in our household turned us into a one-car family and seriously added to the mounting pressure on me to provide and take care of the family. + +Then I broke. + +It wasn't one thing. It was the culmination of things. And it hit me from the blind side, unexpected. I never thought I would be a victim of burnout. I was aware of it and thoughtful about the community I was managing. But "not me," I thought to myself, "I've got this under control." I remember thinking that something was wrong; something was off. But I couldn't quite put my finger on the source. + +I distinctly remember the day where I cried at work, crumbling under the pressure that I was putting on myself. I consider myself a high performer in the office environment. I push myself to exceed the goals that my team co-creates because I want that success. I want the feeling that comes with it. But this experience was different. This wasn't a healthy win for my team or me. I felt like I let everyone down, including myself. + +I was attending South by Southwest in Austin, Texas, where I was [presenting my first Ignite Talk][2] on applying open source principles to government—a talk that was well received by the audience. I remember practicing, and practicing, and practicing more the day before and the morning of my talk. I got that high that comes after delivering a great talk. I had a book signing at the City of Raleigh's Economic Development booth during the event, which was another emotional boost. Life was good. Upon reflection, that's when I started noticing signs of my burnout. + +I didn't have much of an appetite. I was tired all the time. I was sleeping in, and not because of jet lag. I was exercising but wasn't getting the endorphins I was used to. And I wasn't motivated to do the work that I normally love to do. I was very blah and meh about getting work done or hanging out with people I love. These are all signs of depression and burnout. + +After the trip, I scheduled my annual physical and talked to my doctor about my situation, who recommended I see a psychologist. I sat on the couch and talked things out. I was diagnosed with severe anxiety, which was enough for me to know that I didn't want to know what true depression felt like. + +I learned my lesson the hard way. I'd like to share my experience so that you can recognize the signs and avoid going down this path. And before we move on, I must say that it's perfectly fine to ask for help. Ask a trusted co-worker or friend for help or guidance. We're human, and we need to help each other through the ups and the downs. + +### Three things to know about burnout + +Work burnout is a form of depression where you are not motivated to do the things that are expected of you at your job. It's not the occasional slacking off or spring fever because the weather is nice. It's a buildup of emotional stress where you don't want to do what is asked of you at work. There are numerous factors that can lead to burnout. + +#### Know the signs of burnout + +Lesson number one about burnout is to know the signs. I mentioned some of the things I was experiencing, but there are many others. I remember one thing that was extremely abnormal for me (because I'm so social) is that I started to separate myself from my usual team activities and people. + + * Hey Jason, want to grab lunch with us? Nope, I'm too busy. + * Hey Jason, Matt's in town, want to join us for happy hour? No. I've got work to do. + + + +This is totally unlike me. I would normally have said yes to both those opportunities. According to the [Mayo Clinic][3], here are a few things to ask yourself if you think you are experiencing burnout: + + * Do you drag yourself to work? + * Do you have trouble getting started with work? + * Are you cynical or critical at work? + * Have you become irritable or impatient with co-workers or customers? + * Do you lack the energy to be productive? + * Do you find it hard to concentrate? + * Do you lack satisfaction from your achievements? + * Do you feel disillusioned about your work? + * Are you using food, drugs, or alcohol to feel better or to simply not feel? + * Have your sleep habits changed? + * Are you troubled by unexplained headaches, stomach or bowel problems, or other physical complaints? + + + +You can check your own burnout risk at [BurnoutIndex.org][4], an anonymous online questionnaire created in response to the [high level of burnout][5] in the tech industry. + +#### Prevent burnout + +The second lesson is to identify ways [to prevent burnout][6]. First, take time away from your job and plan time to unplug and unwind. This means planning vacations, staycations, or other time away from work. It's sometimes hard to unplug like this with the pressures and obligations we put on ourselves. + +There are three different levels of paid time off (PTO): + + 1. **Best way to unplug:** I'm totally cut-off, not logging in, not checking email. + 2. **Decent way to unplug:** I'm kind of checking in, but not as responsive as normal. + 3. **Meh way to unplug:** I'm available if you need me, I'll monitor email, but I'm away from normal office life. + + + +Your situation will dictate which of these levels of time off will work for you. In my experience, you need at least two total check-outs a year. I typically have a blend of all three throughout the year, but since 2017, I have taken at least three week-long vacations each year to completely escape. It's working so far! + +#### Manage stress + +The third and final lesson is to manage stress effectively. My first go-to for stress management is exercise. I'm addicted to it. I work out pretty much every single day. And I like to mix it up: Cardio, weight lifting, swimming, running, cycling, surfing, and high-intensity interval training (HIIT) are staples in my exercise routine. I used to focus solely on running four to six half marathons a year, but I recently switched to triathlons. The multidisciplinary aspect of the activity has brought more joy and different challenges to my life. + +Another way to reduce stress is to manage your time better. Time is our most precious resource. You've got to choose how you want to spend your time. Family, work, self, social? It's up to you. Find ways to work more efficiently, more effectively, and make sure that you put yourself first. It may sound selfish, but as I've learned from the airplane preflight safety videos, "you need to put your mask on first before helping others." + +### Conclusion + +Burnout can lead to fatigue, excessive stress, sadness, anger, irritability, insomnia, alcohol or substance misuse, heart disease, and other medical conditions—all things that are not good for humans or for your team at work. I hope you can use these tips to put yourself first, reduce stress, and prevent burnout. + +* * * + +_Jason Hibbets will present "[10 things I wish I knew before experiencing burnout][7]" at [SCaLE 18x][8], March 5–8, 2020, in Pasadena, Calif. This article is a preview for the talk and a way to share a bit of his experience._ + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/3/burnout + +作者:[Jason Hibbets][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/jhibbets +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/bulb-light-energy-power-idea.png?itok=zTEEmTZB (Light bulb) +[2]: https://schedule.sxsw.com/2017/events/PP96070 +[3]: https://www.mayoclinic.org/healthy-lifestyle/adult-health/in-depth/burnout/art-20046642 +[4]: https://burnoutindex.org/ +[5]: https://opensource.com/article/19/11/burnout-open-source-communities +[6]: https://www.redhat.com/sysadmin/tips-avoiding-burnout +[7]: https://www.socallinuxexpo.org/scale/18x/presentations/10-things-i-wish-i-knew-experiencing-burnout +[8]: https://www.socallinuxexpo.org/scale/18x/ diff --git a/sources/talk/20200306 What is Linux and Why There are 100-s of Linux Distributions.md b/sources/talk/20200306 What is Linux and Why There are 100-s of Linux Distributions.md new file mode 100644 index 0000000000..be6a45e211 --- /dev/null +++ b/sources/talk/20200306 What is Linux and Why There are 100-s of Linux Distributions.md @@ -0,0 +1,193 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (What is Linux and Why There are 100’s of Linux Distributions?) +[#]: via: (https://itsfoss.com/what-is-linux/) +[#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/) + +What is Linux and Why There are 100’s of Linux Distributions? +====== + +When you are just starting with Linux, it’s easy to get overwhelmed. + +You probably know only Windows and now you want to use Linux because you read that [Linux is better than Windows][1] as it is more secure and you don’t have to buy a license to use Linux. + +But then when you go about downloading and installing Linux, you learn that Linux is not a single entity. There are [Ubuntu][2], [Fedora][3], [Linux Mint][4], elementary and hundreds of such ‘Linux variants’. The trouble is that some of them look just like the other. + +If that’s the case, why are there multiple of those Linux operating systems? And then you also learn that Linux is just a kernel not an operating system. + +![Too Many Linux!][5] + +It gets messy. And you may feel like pulling out your hair. For a person who has a receding hairline, I would like you to keep your hair intact by explaining things in a way you could easily understand. + +I am going to take an analogy and explain why Linux is just a kernel, why there are hundreds of Linux and why, despite looking similar, they are different. + +The explanation here may not be considered good enough for an answer in an exam or interview but it should give you a better understanding of the topic. + +Apology in advance! + +My analogy may not be entirely correct from mechanical point of view as well. I am not knowledgeable about engines, cars and other related mechanical stuff. +But in my experience, I have noticed that this analogy helps people clearly understand the concept of Linux and operating system. +Also, I have used the term Linux OS instead of Linux distribution deliberately so that newcomers don’t start wondering about distribution. + +### Linux is just a kernel + +_**Linux is not an operating system, it’s just a kernel.**_ + +The statement is entirely true. But how do you understand it. If you look into books, you’ll find Linux kernel structure described like this: + +![Linux Kernel Structure][6] + +There is absolutely correct, however, let’s take a different approach. Think of operating systems as vehicles, any kind of vehicle be it motorbikes, cars or trucks. + +What is at the core of a vehicle? An engine. + +Think of kernel as the engine. It’s an essential part of the vehicle and you cannot use a vehicle without the engine. + +![The Operating System Analogy][7] + +But you cannot drive an engine, can you? You need a lot of other stuff to interact with the engine and drive the vehicle. You need wheels, steering, gears, clutch, brakes and more to drive a vehicle on top of that engine. + +Similarly, you cannot use a kernel on its own. You need lots of tool to interact with the kernel and use the operating system. These stuff could be shell, commands, graphical interface (also called desktop environments) etc. + +This makes sense, right? Now that you understand this analogy, let’s take it further so that you understand the rest of it. + +Windows and other operating systems have kernel too + +Kernel is not something exclusive to Linux. You may not have realized but Windows, macOS and other operating systems have a kernel underneath as well. +Microsoft Windows operating systems are based on [Windows NT kernel][8]. Apple’s macOS is based on the [XNU kernel][9]. + +### Think of operating systems as vehicles + +Think of Microsoft as an automobile company that makes a general purpose car (Windows operating system) that is hugely popular and dominates the car market. They use their own patented engine that no one else can use. But these ‘Microsoft cars’ do not offer scope of customization. You cannot modify the engine on your own. + +Now come to ‘Apple automobile’. They offer shiny looking, luxury cars at an expensive price. If you got a problem, they have a premium support system where they might just replace the car. + +Now comes Linux. Remember, Linux is just an engine (kernel). But this ‘Linux engine’ is not patented and thus anyone is free to modify and build cars (desktop operating system), bikes (small embed system in your toys, tvs etc), trucks (servers) or jet-planes ([supercomputers][10]) on top of it. In real world, no such engine exists but accept it for the sake of this analogy. + +![][11] + + * kernel = engine + * Linux kernel = specific type of engine + * desktop operating systems = cars + * server operating systems = heavy trucks + * embed systems = motor-bikes + * desktop environment = body of the vehicle along with interiors (dashboard and all) + * themes and icons = paint job, rim job and other customization + * applications = accessories you put for specific purpose (like music system) + + + +### Why there are so many Linux OS/distributions? Why some look similar? + +Why there are so many cars? Because there are several vehicle manufacturers using the ‘Linux engine’ and each of them have so many cars of different type and for different purposes. + +Since ‘Linux engine’ is free to use and modify, anyone can use it to build a vehicle on top of it. + +This is why Ubuntu, Debian, Fedora, SUSE, [Manjaro][12] and many other **Linux-based operating systems (also called Linux distributions or Linux distros)** exist. + +You might also have noticed that these Linux operating systems offer different variants but they look similar. I mean look at Fedora’s default GNOME version and Debian’s GNOME version. They do look the same, don’t they? + +![Fedora GNOME vs Debian GNOME: Virtually No Visual Difference][13] + +The component that gives the look and feel in a Linux OS is called [desktop environment][14]. In our analogy here, you can think of it as a combination of outer body and matching interiors. This is what provides the look and feel to your vehicle, does it not? + +It’s from the exterior that you can identify the cars into category of sedan, SUV, hatchback, station wagon, convertible, minivan, van, compact car, 4×4 etc. + +But these ‘type of cars’ are not exclusive to a single automobile company. Ford offers SUV, compact cars, vans etc and so do other companies like General Motors, Toyota. + +![Vehicles of same type look similar even if they are from different automobile companies][15] + +Similarly, distributions (Linux OSes) like Fedora, Ubuntu, Debian, Manjaro etc also offer different variants in the form of GNOME, KDE, Cinnamon, MATE and other [desktop environments][16]. + +Ford’s SUV may look similar to Toyota’s or Renault’s SUV. Fedora’s GNOME version may look similar to Manjaro or Debian’s GNOME version. + +#### Some type of cars consume more fuel, some desktop environments need more RAM + +You probably understand the ‘usefulness’ of different types of cars. Compact cars are good for driving in the cities, vans are good for long trip with family, 4×4 are good for adventures in jungles and other rough terrain. A SUV may look good and feel comfortable for sitting but it consumes more fuel than a compact car that might not be comfortable to sit in. + +Similarly, desktop environments (GNOME, MATE, KDE, Xfce etc) also serve some purpose other than just providing the looks to your Linux operating system. + +GNOME gives a modern looking desktop but it consumes more RAM and thus require that your computer has more than 4 GB of RAM. Xfce on the other hand may look old/vintage but it can run on systems with 1 GB of RAM. + +#### Difference between getting desktop environment from distribution and installing on your own + +As you start using Linux, you’ll also come across suggestions that you can easily install other desktop environments on your current system. + +Remember that Linux is a free world. You are free to modify the engine, customize the looks on your own, if you have the knowledge/experience or if you are an enthusiastic learner. + +Think of it as customizing cars. You may modify a Hundai i20 to look like Suzuki Swift Dzire. But it might not be the same as using a Swift Dzire. + +When you are inside the i20 modified to look like Swiftz Dzire, you’ll find that it may not have the same experience from the inside. Dashboard is different, seats are different. You may also notice that the exterior doesn’t fit the same on i20’s body. + +The same goes for switching desktop environments. You will find that you don’t have the same set of apps in Ubuntu that you should be getting in Mint Cinnamon. Few apps will look out of place. Not to mention that you may find a few things broken, such as network manager indicator missing etc. + +Of course, you can put time, effort and skills to make Hundai i20 look as much like Swift Dzire as possible but you may feel like getting Suzuki Swift Dzire is a better idea in the first place. + +This is the reason why installing Ubuntu MATE is better than installing Ubuntu (GNOME version) and then [installing MATE desktop][17] on it. + +### Linux operating systems also differ in the way they handle applications + +Another major criteria on which the Linux operating systems differ from each other is the package management. + +Package management is basically how you get new software and updates in your systems. It’s up to your Linux distribution/OS to provide the security and maintenance updates. Your Linux OS also provides the means of installing new software on your system. + +Some Linux OS provides all the new software version immediately after their release while some take time to test them for your own good. Some Linux OS (like Ubuntu) provides easier way of installing a new software while you may find it complicated in some other Linux OS (like [Gentoo][18]). + +Keeping the line of our analogy, consider installing software as adding accessories to your vehicle. + +Suppose you have to install a music system in your car. You may have two options here. Your car is designed in such a way that you just insert the music player, you hear the click sound and you know it’s installed. The second option could be to get a screwdriver and then fix the music player on screws. + +Most people would prefer the hassle-free click lock installing system. Some people might take matter (and screwdriver) into their own hands. + +If an automobile company provides scope for installing lots of accessories in click-lock fashion in their cars, they will be preferred, won’t they? + +This is why Linux distributions like Ubuntu have a more users because they have a huge collection of software that can be easily installed in matter of clicks. + +### Conclusion + +Before I conclude this article, I’ll also like to talk about support that plays a significant role in choosing a Linux OS. For your car, you would like to have its official service center or other garages that service the automobile brand you own, don’t you? If the automobile company is popular, naturally, it will have more and more garages providing services. + +The same goes for Linux as well. For a popular Linux OS like Ubuntu, you have some official forums to seek support and a good number of websites and forums providing troubleshooting tips to fix your problem. + +Again, I know this is not a perfect analogy but this helps understand the things slightly better. + +If you are absolutely new to Linux, did this article made things clear for you or you are more confused than before? + +If you already know Linux, how would you explain Linux to someone from non-technical background? + +Your suggestions and feedback is welcome. + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/what-is-linux/ + +作者:[Abhishek Prakash][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/abhishek/ +[b]: https://github.com/lujun9972 +[1]: https://itsfoss.com/linux-better-than-windows/ +[2]: https://ubuntu.com/ +[3]: https://getfedora.org/ +[4]: https://linuxmint.com/ +[5]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/03/too-many-linux-choices.png?ssl=1 +[6]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/03/Linux_Kernel_structure.png?ssl=1 +[7]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/03/operating_system_analogy.png?ssl=1 +[8]: https://en.wikipedia.org/wiki/Architecture_of_Windows_NT +[9]: https://en.wikipedia.org/wiki/XNU +[10]: https://itsfoss.com/linux-runs-top-supercomputers/ +[11]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/03/linux-kernel-as-engine.png?ssl=1 +[12]: https://manjaro.org/ +[13]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/03/fedora-gnome-vs-debian-gnome.jpg?ssl=1 +[14]: https://itsfoss.com/glossary/desktop-environment/ +[15]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/03/linux_suv_analogy.jpg?ssl=1 +[16]: https://itsfoss.com/best-linux-desktop-environments/ +[17]: https://itsfoss.com/install-mate-desktop-ubuntu/ +[18]: https://www.gentoo.org/ diff --git a/sources/talk/20200308 The De-Googled Android Fork is Making Good Progress.md b/sources/talk/20200308 The De-Googled Android Fork is Making Good Progress.md new file mode 100644 index 0000000000..e5d1838cd3 --- /dev/null +++ b/sources/talk/20200308 The De-Googled Android Fork is Making Good Progress.md @@ -0,0 +1,115 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (The De-Googled Android Fork is Making Good Progress) +[#]: via: (https://itsfoss.com/gael-duval-interview/) +[#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/) + +The De-Googled Android Fork is Making Good Progress +====== + +A couple years ago, we covered the [Eelo project][1]. If you remember, the Eelo project was started by [Gael Duval][2] who once created Mandrake Linux. The goal of the Eelo project was to remove all Google services from Android to give you an [alternate mobile operating system][3] that doesn’t track you and invade your privacy. + +A lot has happened to Eelo since then. It’s not called Eelo anymore, now it’s called /e/. So, what’s happening with this project? We talked to Gael Duval himself. Here’s what he shared with us. + +![][4] + +_**Why did you create this Eelo or /e/ project in the first place?**_ + +**Gael:** In 2017, I realized that using Android and iPhone, Google and many mobile apps was not compatible with my personal privacy. + +A later study by a US University confirmed this: using an iPhone or and Android phone sends between 6 to 12 MB of personal data to Google servers, daily! And this doesn’t count mobile apps. + +So I looked for reasonable alternatives to iPhone and Android phones but didn’t find any. Either I found options for hobbyists, like Ubuntu Touch, that were not compatible with existing apps and not fully unGoogled either. Or there were alternative ROMs with all the Google fat inside, and no associated basic online services that could be used without tweaking the system. + +Therefore, an idea came to mind: why not fork Android, remove all the Google features, even low level, such as connectivity check, DNS…, replace default apps with more virtuous apps, add basic online services, and integrate all this into a consistent form that could be used by Mum and Dad and any people without tech or expert knowledge? + +_**How is it any different from other custom Android ROMs?**_ + +**Gael:** It doesn’t send a bit of data to Google, and is and will be more and more privacy-focused. + +Low-level: we remove any Android feature that sends data to Google servers. Even the connectivity check when you start the smartphone! To my knowledge, there is not any other Android ROM that does this at the moment. We change default DNS settings and offer users an option to set the DNS of their choice. We change NTP (automatic time configuration) settings to the default NTP servers because there is no reason to use Google NTP servers actually. Then we remove Google services, and we replace with a software layout called microG that can still receive push notifications and have geolocation data for apps (using Mozilla geolocation service). + +Then we change the default apps by non-Google apps, including the maps applications, mail etc., most are open source applications and I can say that there is 99% probability that all will be open source before the end of this year. + +Then we add our own Android application installer, with close to 80 000 available applications at the moment. + +We provide a different web browser, which is a fork of Chromium, were all features that data to Google are removed, and were the default search engine is not Google… + +And we operate online services: + + * search, using a meta-search system that we have improve for a better user experience + * online drive with encrypted data, calendar etc. using a modified version of NextCloud + * mail… + + + +And for we provide a unique identifier that can be used to access all those services, either on the web or from the /e/ OS system, by login once. Then you can sync all your data, calendar, email etc. between your smartphone and your personal /e/ cloud (it can also be self-hosted). +The purpose of the project is to provide a normal, ready to use, and attractive “digital life” to users, without sending all your personal data to Google. + +_**If it is completely ‘ungoogled’, how do users install new apps? Do you have your own app store? If yes, how can we trust that these apps don’t spy on user data?**_ + +**Gael:** Yes – we have our own application installer, with about 80 000 applications. And we analyse each application to unveil the number of trackers, and we display this information to our users, for each application. We are also adding Progressive Web Apps soon to this application installer. + +/e/ OS is about freedom of choice. We want the core system to be better, and then offer as many possible options to users, by informing them as much as possible. In short: they can still any application they need. Next step will be to offer a feature to actually block trackers used in applications. + +_**What is the target user base for /e/? Can an average Joey use it without much trouble?**_ + +![][5] + +**Gael:** We started with tech-savvy users, and we’re expanding the user base to people with less knowledge. At the moment, our typical user base is a mix of tech-savvy users, who can flash a smartphone with /e/ OS and people who are very concerned with Google and their data privacy but have very limited technical knowledge. For those people we have some smartphones pre-installed with /e/ OS for sale, on high-grade refurbished hardware. + +We are also announcing this week an “/e/ easy installer” that will make the flashing process much more easier, by pluging the smartphone to a PC and launching a dedicated application that will make most of the job. + +Then, the next step will be to expand our target users to a more global market, once we find the good partners. But clearly, there is a demand for something different than the Apple-Google worldwide market duopoly on the mobile. + +_**Initially the project was named eelo and it is called /e/ or [e foundation][6]. Personally, I find the name /e/ weird and it is not easily recognizable. Why did you change the project name?**_ + +**Gael:** We have been “attacked” by a company called “eelloo”. They considered that “eelo” would interfere with their business. They are in the HR business solutions, but registered their trademark in all the classes related to mobile OS, smartphones etc. This is silly and a shame, but we had no money to defend us strongly at the time. + +However the/e/ name will be abandonned for something else quite soon. + +_**It’s been a couple of years since the initial launch. How do you see the adoption of /e/?**_ + +**Gael:** We launched the first beta 18 months ago, and we have started to sell smartphones with /e/ a little more than 6 months ago. The adoption is growing a lot at the moment, we have to add terabytes of online storage regularly! + +Also with the /e/ installer arriving, and some official partnerships with some hardware mobile manufacturers in the pipe, this is going to accelerate a lot this year. + +However, this is not surprising, privacy concerns are rising both for individuals and corporations, and I think the rejection of Google is also trending. + +_**What are your future plans to grow /e/?**_ + +**Gael:** The growth is very natural. There is a strong community of users who realize how unique our approach is. These guys are contributing, supporting us and talking a lot about the project. + +With the easy installer coming along and strategic partnerships with hardware makers, this is going to accelerate a lot. + +Also, and this is more personal, I think that there is a natural connection between /e/ OS, and the Linux world. OK, /e/ OS is based on Android, but it’s still a Linux kernel and it’s the same spirit, it’s Open Source… So I’d really like to have more natural integration between my /e/ smartphone and my Linux desktop. There should be some nice features added in this spirit in the next versions of /e/ OS. + +_**What can /e/ users and our readers do to help e foundation?**_ + +**Gael:** Join us, talk about what we are doing, send your feedback, organize some meetups… Help improve the /e/ Wikipedia page which is very poor and doesn’t represent at all what we are actually doing. + +We also have a [permanent crowdfunding campaign where users can support the project financially][7], pay for the servers etc. And, in addition to giving back in term of open source product, we send cool stuff in return :) + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/gael-duval-interview/ + +作者:[Abhishek Prakash][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/abhishek/ +[b]: https://github.com/lujun9972 +[1]: https://itsfoss.com/eelo-mobile-os/ +[2]: https://en.wikipedia.org/wiki/Ga%C3%ABl_Duval +[3]: https://itsfoss.com/open-source-alternatives-android/ +[4]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/03/e-os-interview.jpg?ssl=1 +[5]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/03/e-foundation-smartphones.jpg?resize=800%2C590&ssl=1 +[6]: https://e.foundation/ +[7]: https://e.foundation/donate/ diff --git a/sources/talk/20200311 Data-center power consumption holds steady.md b/sources/talk/20200311 Data-center power consumption holds steady.md new file mode 100644 index 0000000000..cfa6ba9fba --- /dev/null +++ b/sources/talk/20200311 Data-center power consumption holds steady.md @@ -0,0 +1,60 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Data-center power consumption holds steady) +[#]: via: (https://www.networkworld.com/article/3531316/data-center-power-consumption-holds-steady.html) +[#]: author: (Andy Patrizio https://www.networkworld.com/author/Andy-Patrizio/) + +Data-center power consumption holds steady +====== +While computing capacity has exploded in recent years, power consumption is growing more slowly thanks to greater energy efficiency. +Google + +A predicted explosion in power consumption by data centers has not manifested thanks to advances in power efficiency and, ironically enough, the move to the cloud, according to a new report. + +The [study][1], published in the journal _Science_ last week, notes that while there has been an increase in global data-center energy consumption over the past decade, this growth is negligible compared with the rise of workloads and deployed hardware during that time. + +Data centers accounted for about 205 terawatt-hours of electricity usage in 2018, which is roughly 1% of all electricity consumption worldwide, according to the report. (That's well below the often-cited stat that data centers consume 2% of the world's electricity). The 205 terawatt-hours represent a 6% increase in total power consumption since 2010, but global data center compute instances rose by 550% over that same time period. + +**[ Now read: [What is quantum computing (and why enterprises should care)][2] ]** + +To drive that point home: Considerably more compute is being deployed, yet the amount of power consumed is holding steady. + +The paper cites a number of reasons for this. For starters, hardware power efficiency is vastly improved. The move to server virtualization has meant a six-fold increase in compute instances with only a 25% increase in server energy use. And a shift to faster and more energy-efficient port technologies has brought about a 10-fold increase in data center IP traffic with only a modest increase in the energy use of network devices. + +Even more interesting, the report claims the rise of and migration to hyperscalers has helped curtail power consumption.  + +Hyperscale data centers and cloud data centers are generally more energy efficient than company-owned data centers because there is greater incentive for energy efficiency. The less power Amazon, Microsoft, Google, etc., have to buy, the more their bottom line grows. And hyperscalers are big on cheap, renewable energy, such as hydro and wind. + +[][3] + +So if a company trades its own old, inefficient data center for AWS or Google Cloud, they're reducing the overall power draw of data centers as a whole. + +"Total power consumption held steady as computing output has risen because of improvement efficiency of both IT and infrastructure equipment, and a shift from corporate data centers to more efficient cloud data centers (especially hyper scale)," said Jonathan Koomey, a Stanford professor and one of the authors of the research, in an email to me. He has spent years researching data center power and is an authority on the subject. + +"As always, the IT equipment progresses most quickly. In this article, we show that the peak output efficiency of computing doubled every 2.6 years after 2000. This doesn’t include the reduced idle power factored into the changes for servers we document," he added. + +Koomey notes that there is additional room for efficiency improvements to cover the next doubling of computing output over the next few years but was reluctant to make projections out too far. "We avoid projecting the future of IT because it changes so fast, and we are skeptical of those who think they can project IT electricity use 10-15 years hence," he said. + +Join the Network World communities on [Facebook][4] and [LinkedIn][5] to comment on topics that are top of mind. + +-------------------------------------------------------------------------------- + +via: https://www.networkworld.com/article/3531316/data-center-power-consumption-holds-steady.html + +作者:[Andy Patrizio][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.networkworld.com/author/Andy-Patrizio/ +[b]: https://github.com/lujun9972 +[1]: https://science.sciencemag.org/content/367/6481/984 +[2]: https://www.networkworld.com/article/3275367/what-s-quantum-computing-and-why-enterprises-need-to-care.html +[3]: https://www.networkworld.com/article/3440100/take-the-intelligent-route-with-consumption-based-storage.html?utm_source=IDG&utm_medium=promotions&utm_campaign=HPE21620&utm_content=sidebar ( Take the Intelligent Route with Consumption-Based Storage) +[4]: https://www.facebook.com/NetworkWorld/ +[5]: https://www.linkedin.com/company/network-world diff --git a/sources/talk/20200311 Setting yourself up for success while working remotely.md b/sources/talk/20200311 Setting yourself up for success while working remotely.md new file mode 100644 index 0000000000..bbe6b3f513 --- /dev/null +++ b/sources/talk/20200311 Setting yourself up for success while working remotely.md @@ -0,0 +1,61 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Setting yourself up for success while working remotely) +[#]: via: (https://opensource.com/article/20/3/remote-work) +[#]: author: (Dawn Parzych https://opensource.com/users/dawnparzych) + +Setting yourself up for success while working remotely +====== +Whether you are new to working remotely or are a seasoned veteran, here +are tips to improve the experience. +![Woman sitting in front of her computer][1] + +Remote work is not easy. While there are perks to being remote, it is a mind-shift and takes some getting used to. Talk to anybody that works remotely, and they will likely tell you some of the biggest challenges of remote work are _**feeling disconnected**_ and _**a loss of regime**_. Here are my tips gathered from 10 years as a remote worker on how to set yourself and your team up to work remotely successfully. + +### Environment and regime + + 1. **"Commute" to and from work**. I'm not saying go to the extremes in this [_Audible commercial_][2], but I suggest leaving your home to go for a walk or a bike ride before you begin working. Do the same at the end of the day. I take my dog, Barley (pictured here), for a walk at the start and end of most days.![Here's my dog, Barley, who gets regular walks during my morning "commute"][3] + 2. **Get dressed.** Don't be tempted to work in your PJs, because this blurs the line between work and home. People sometimes say that being able to work in your pajamas is a perk of remote work, but studies show this isn't great advice. You don't need to put on a suit and tie, but do change out of your pajamas; otherwise, before you know it, you will have gone three days without changing your clothes. For more reasons why check out this article from [_Fast Company_][4]. + 3. **Eat lunch away from your desk**. This is good advice even if you aren't working remotely. + 4. **Stick to a schedule**. It's easy to start working as soon as you wake up and continue late into the evening. Set a start time and an end time for your day and stick to it. When I stop work for the day, I try to close my office door. Configure your working hours in every app you use so others know when you are available. Don't use your work computer outside of working hours if you can. + 5. **Set up a dedicated work environment**, if possible. Try not to work from the kitchen table. This blurs the lines between home and work. My office (picture below) also has space for comfortable seating and desk seating to switch between the two. + 6. **Check-in with your team** or friends in the morning. Don't mistake this for a daily stand-up; this is more like saying _hi_ when you're getting coffee. + 7. **Sign-off at the end of the day**. This means both letting your team members know you are leaving and actually walking away from where you are working. Close the laptop. Turn off Slack notifications, etc. + 8. **Keep people posted** if you are leaving early or unavailable. It helps build trust. + 9. **Invest in a headset** if you will be doing a lot of calls. If there is more than one person in your household that is working remotely, they will thank you for this. It is no fun listening to somebody else's conference call. + 10. **Turn on your video** when on a video call to help you feel connected and stay engaged. When your video is disabled, it is easy to wander off and get distracted by Slack (or its [open source alternatives][5]), Twitter, or any other number of distractions. + 11. **Set up a weekly, casual remote chat**. At my company, we meet on Friday mornings via Zoom (or the open source alternative, [Jitsi][6]). This chat is open to remote and non-remote staff. It is an open call to talk about whatever is on our minds. Topics have ranged from music preferences to parenting challenges to what people are doing over the weekend. + 12. **Set-up chat-roulette **if one-on-one interaction is more your thing. There are applications on most chat platforms that randomly pairs two employees to chat and get to know one another. + 13. **Ask for help**. Chat with your colleagues if you're stuck, need encouragement, or need to vent. You are not alone. You are a member of a team. You can still grab a coffee or go for a walk with a teammate remotely. + + + +![Here’s my home office set up][7] + +Everybody is different. These tips work for me, I’d love to hear you share your advice below! + +Not all work-from-home gigs are created equal. There is a vast ocean between being a member of a... + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/3/remote-work + +作者:[Dawn Parzych][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/dawnparzych +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/OSDC_women_computing_2.png?itok=JPlR5aCA (Woman sitting in front of her computer) +[2]: https://www.youtube.com/watch?v=oVCJhZhrJ04 +[3]: https://opensource.com/sites/default/files/resize/pictures/barleywalking_0-300x379.png (Here's my dog, Barley, who gets regular walks during my morning "commute") +[4]: https://www.fastcompany.com/3064295/what-happened-when-i-dressed-up-to-work-from-home-for-a-week +[5]: https://opensource.com/alternatives/slack +[6]: https://meet.jit.si/ +[7]: https://opensource.com/sites/default/files/pictures/6151f75e-bbeb-4e64-a5ca-0bbe4e981054.jpeg (Here’s my home office set up) diff --git a/sources/talk/20200312 Next wave of digital transformation requires better security, automation.md b/sources/talk/20200312 Next wave of digital transformation requires better security, automation.md new file mode 100644 index 0000000000..d99b38c7b8 --- /dev/null +++ b/sources/talk/20200312 Next wave of digital transformation requires better security, automation.md @@ -0,0 +1,92 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Next wave of digital transformation requires better security, automation) +[#]: via: (https://www.networkworld.com/article/3531448/next-wave-of-digital-transformation-requires-better-security-automation.html) +[#]: author: (Zeus Kerravala https://www.networkworld.com/author/Zeus-Kerravala/) + +Next wave of digital transformation requires better security, automation +====== +F5 report highlights the challenges of digital initiatives, including a struggle to secure multi-cloud environments and a lack of IT skills required to extend automation efforts. +Loops7 / Getty Images + +Digital transformation is a top-of-mind priority for CIOs who want innovative ways to deploy applications and run IT operations. In today's digital economy, companies that don't depend on applications to support their business are rare. On the contrary, most companies have some kind of digital transformation initiative in place, which is driving the adoption of cloud-native architectures and application services. + +A new report from application delivery vendor F5 Networks finds businesses are entering the second phase of digital transformation by automating more parts of their networks. Based on a survey of nearly 2,600 senior leaders globally—from various industries, company sizes, and roles—the [_2020 State of Application Services Report_][1] uncovered five key trends shaping the application landscape. + +**READ MORE:** [Top 10 underused SD-WAN features][2] + +### 1\. Every company is undergoing a digital transformation + +Having conducted its annual survey for six years in a row, F5 consistently found IT optimization and business process optimization to be the top reported benefits for companies with digital transformation initiatives. At this point, most companies have mastered automation of individual tasks by digitizing IT and business processes—which the report classifies as phase one of digital transformation. + +Moving on to phase two, companies are shifting their focus to reducing complexity and supporting apps with a consistent set of services. External-facing apps make up a portion (45%) of an average company's portfolio and help generate revenue. Yet, the internal-facing ones—like productivity and operational apps—are vital to digitizing business processes. + +Modern, microservices/cloud-native apps now make up approximately 15% of a company's portfolio, compared to 11% for mainframe-hosted apps. This mix of new and older generation apps indicates that businesses are dealing with a diverse app portfolio. As more businesses adopt an application-centric mindset, they can start managing their app portfolio like a business asset. + +### 2\. Organizations struggle to secure multi-cloud environments + +Every company has different needs, which is why most choose the best cloud for their applications on a case-by-case basis, the report finds. Businesses are adopting cloud platforms at a high rate, with 27% planning to have more than half of their applications in the cloud by the end of 2020. + +For 87% of companies, multi-cloud is the preferred choice due to its flexibility. Multi-cloud typically includes a mix of infrastructure-as-a-service (IaaS) environments, so a company can choose to deploy multiple software-as-a-service (SaaS) or platform-as-a-service (PaaS) cloud services. + +[][3] + +However, multi-cloud environments pose challenges for businesses when it comes to maintaining security, policy, and compliance, according to the report's respondents. Companies are dealing with applications that reach hundreds to millions of end users—each one with its own security risk. Meanwhile, many don't have the expertise to protect the apps. + +A whopping 71% of companies surveyed by F5 reported a skills gap in security. Only 45% of companies are confident that they're able to secure apps in the public cloud, while 62% think they can protect apps in an on-premises data center. The most confident companies have consistency across multiple architectures and multiple infrastructures, ensuring security and performance of all apps in their portfolio. + +### 3\. Automation key to boosting efficiency + +Manual processes may have been the norm for legacy networks, but modern networks require automation. That's why most companies (73%) have embraced it. + +In this year's report, F5 observed more consistent use of automation in the deployment pipeline than in previous years. Automation of application infrastructure, network, application services, and security is nearly equal across the board at approximately 40% for survey respondents. (See also: [Enterprises being won over by speed, effectiveness of network automation][4]) + +Interestingly, more companies are choosing open source and continuous integration/continuous delivery (CI/CD) tools for automation over proprietary vendor solutions. The report found there is a need for open ecosystems with the increasing use of CI/CD tools, as businesses search for ways to address problems that slow down automation. Companies said their biggest struggles are with skill gaps in enterprise IT, integrating toolsets across vendors and devices, and the cost of new tools. + +### 4\. Security app services are most widely deployed + +Modern networks require application services—a pool of services necessary to deploy, run, and secure apps across on-premises or multi-cloud environments. Today, 69% of companies are using 10 or more application services, such as ingress control and service discovery. Ingress control is a relatively new application service that has become essential to companies with high API call volumes. It's one of many examples of the growing adoption of microservices-based apps. + +Security services remain as the most widely deployed, with these in particular dominating the top five: SSL VPN and firewall services (81%); IPS/IDS, antivirus, and spam mitigation (77%); load balancing and DNS (68%); web application firewalls (WAF) and DDoS protection (each at 67%). + +Over the next 12 months, the evolution of cloud and modern app architectures will continue to shape application services. At the top of the list (41%) is software-defined wide-area networking ([SD-WAN][5]). SD-WAN enables software-based provisioning from the cloud to meet modern application demands. Early SD-WAN deployments focused on replacing costly multi-protocol label switching (MPLS), but there is now greater emphasis on security as a core requirement for SD-WAN. + +### 5\. DevOps picks up responsibility for app services + +Although IT operations is still primarily responsible for deploying app services, the report revealed a shift taking place from single-function to ops-oriented team structures—such SecOps and DevOps. + +The responsibility for securing, optimizing, and managing apps by DevOps teams is growing, fueled by cloud and container-native applications. Compared to just a few years ago, businesses have developed a preference for containers over virtual appliances for app services. Container preference grew from just 6% in 2017 to 18% in 2020, surpassing virtual machines (15%) and hardware (15%). + +Regardless of preference, the challenges of modern app architectures call for collaboration between teams. IT operations and DevOps don't have to be mutually exclusive and can work together to address those challenges. + +### What's Next? + +Senior leaders surveyed in the report see big data analytics coming into play in the next two to five years. + +Companies today only use a small portion of their data and aren't taking full advantage of it. In the third phase of the digital transformation, businesses can begin leveraging data captured by apps via artificial intelligence (AI)-powered analytics. The harnessed data can provide valuable insights to improve business processes. + +Join the Network World communities on [Facebook][6] and [LinkedIn][7] to comment on topics that are top of mind. + +-------------------------------------------------------------------------------- + +via: https://www.networkworld.com/article/3531448/next-wave-of-digital-transformation-requires-better-security-automation.html + +作者:[Zeus Kerravala][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.networkworld.com/author/Zeus-Kerravala/ +[b]: https://github.com/lujun9972 +[1]: https://www.f5.com/state-of-application-services-report +[2]: https://www.networkworld.com/article/3518992/top-10-underused-sd-wan-features.html +[3]: https://www.networkworld.com/article/3440100/take-the-intelligent-route-with-consumption-based-storage.html?utm_source=IDG&utm_medium=promotions&utm_campaign=HPE21620&utm_content=sidebar ( Take the Intelligent Route with Consumption-Based Storage) +[4]: https://www.networkworld.com/article/3530275/enterprises-being-won-over-by-speed-effectiveness-of-network-automation.html +[5]: https://www.networkworld.com/article/3031279/sd-wan-what-it-is-and-why-you-ll-use-it-one-day.html +[6]: https://www.facebook.com/NetworkWorld/ +[7]: https://www.linkedin.com/company/network-world diff --git a/sources/talk/20200316 As the networks evolve enterprises need to rethink network security.md b/sources/talk/20200316 As the networks evolve enterprises need to rethink network security.md new file mode 100644 index 0000000000..4767aaafe1 --- /dev/null +++ b/sources/talk/20200316 As the networks evolve enterprises need to rethink network security.md @@ -0,0 +1,81 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (As the networks evolve enterprises need to rethink network security) +[#]: via: (https://www.networkworld.com/article/3531929/as-the-network-evolves-enterprises-need-to-rethink-security.html) +[#]: author: (Zeus Kerravala https://www.networkworld.com/author/Zeus-Kerravala/) + +As the networks evolve enterprises need to rethink network security +====== +Q&A: John Maddison, executive vice president of products for network security vendor Fortinet, discusses how to deal with network security in the digital era. +D3Damon / Getty Images + +_Digital innovation is disrupting businesses. Data and applications are at the hub of new business models, and data needs to travel across the extended network at increasingly high speeds without interruption. To make this possible, organizations are radically redesigning their networks by adopting multi-cloud environments, building hyperscale data centers, retooling their campuses, and designing new connectivity systems for their next-gen branch offices. Networks are faster than ever before, more agile and software-driven. They're also increasingly difficult to secure. To understand the challenges and how security needs to change, I recently talked with John Maddison, executive vice president of products for network security vendor Fortinet._ + +**ZK: As the speed and scale of data escalate, how do the challenges to secure it change?** + +JM: Security platforms were designed to provide things like enhanced visibility, control, and performance by monitoring and managing the perimeter. But the traditional perimeter has shifted from being a very closely monitored, single access point to a highly dynamic and flexible environment that has not only expanded outward but inward, into the core of the network as well. + +**[ Also see [What to consider when deploying a next generation firewall][1]. | Get regularly scheduled insights by [signing up for Network World newsletters][2]. ]** + +**READ MORE:** [The VPN is dying, long live zero trust][3] + +Today's perimeter not only includes multiple access points, the campus, the WAN, and the cloud, but also IoT, mobile, and virtual devices that are generating data, communicating with data centers and manufacturing floors, and literally creating thousands of new edges inside an organization. And with this expanded perimeter, there are a lot more places for attacks to get in. To address this new attack surface, security has to move from being a standalone perimeter solution to being fully integrated into the network. + +This convergence of security and networking needs to cover SD-WAN, VPN, Wi-Fi controllers, switching infrastructures, and data center environments – something we call security-driven networking. As we see it, security-driven networking is an essential approach for ensuring that security and networking are integrated together into a single system so that whenever the networking infrastructure evolves or expands, security automatically adapts as an integrated part of that environment. And it needs to do this by providing organizations with a new suite of security solutions, including network segmentation, dynamic multi-cloud controls, and [zero-trust network access][3]. And because of the speed of digital operations and the sophistication of today's attacks, this new network-centric security strategy also needs to be augmented with AI-driven security operations. + +The perimeter security devices that have been on the market weren't really built to run as part of the internal network, and when you put them there, they become bottlenecks. Customers don't put these traditional security devices in the middle of their networks because they just can't run fast enough. But the result is an open network environment that can become a playground for criminals that manage to breach perimeter defenses. It's why the dwell time for network malware is over six months. + +**[ [Prepare to become a Certified Information Security Systems Professional with this comprehensive online course from PluralSight. Now offering a 10-day free trial!][4] ]** + +As you combine networking applications, networking functionality, and security applications together to address this challenge, you absolutely need a different performance architecture. This can't be achieved using the traditional hardware most security platforms rely on. + +**ZK: Why can't traditional security devices secure the internal network?** + +JM: They simply aren't fast enough. And the ones that come close are prohibitively expensive… For example, internal segmentation not only enables organizations to see and separate all of the devices on their network but also dynamically create horizontal segments that support and secure applications and automated workflows that need to travel across the extended network. Inside the network, you're running at 100 gigs, 400 gigs, that sort of thing. But the interface for a lot of security systems today is just 10 gigs. Even with multiple ports, the device can't handle much more than that without having to spend a fortune… In order to handle today's capacity and performance demands, security needs to be done at network speeds that most security solutions cannot support without specialized content processors. + +**ZK: Hyperscale data centers have been growing steadily. What sort of additional security challenges do these environments face?** + +JM: Hyperscale architectures are being used to move and process massive amounts of data. A lot of the times, research centers will need to send a payload of over 10 gigabytes – one packet that's 10 gigabytes – to support advanced rendering and modeling projects. Most firewalls today cannot process these large payloads, also known as elephant flows. Instead, they often compromise on their security to let them flow through. Other hyperscale environment examples include financial organizations that need to process transactions with sub-second latency or online gaming providers that need to support massive numbers of connections per second while maintaining high user experience. … [Traditional security platforms] will never be able to secure hyperscale environments, or even worse, the next generation of ultra-fast converged networks that rely on hyperscale and hyperconnectivity to run things like smart cities or smart infrastructures, until they fundamentally change their hardware. + +**ZK: Do these approaches introduce new risks or increase the existing risk for these organizations?** + +JM: They do both. As the attack surface expands, existing risks often get multiplied across the network. We actually see more exploits in the wild targeting older vulnerabilities than new ones. But cybercriminals are also building new tools designed to exploit cloud environments and modern data centers. They are targeting mobile devices and exploiting IoT vulnerabilities. Some of these attacks are simply revisions of older, tried and true exploits. But many are new and highly sophisticated. We are also seeing new attacks that use machine learning and rely on AI enhancements to better bypass security and evade detection. + +To address this challenge, security platforms need to be broad, integrated, and automated. + +Broad security platforms come in a variety of form factors so they can be deployed everywhere across the expanding network. Physical hardware enhancements, such as our [security processing units], enable security platforms to be effectively deployed inside high-performance networks, including hyperscale data centers and SD-WAN environments. And virtualized versions need to support private cloud environments as well as all major cloud providers through thorough cloud-native integration. + +Next, these security platforms need to be integrated. The security components built into a security platform need to work together as a single solution ­– not the sort of loose affiliation most platforms provide – to enable extremely fast threat intelligence collection, correlation, and response. That security platform also needs to support common standards and APIs so third-party tools can be added and supported. And finally, these platforms need to be able to work together, regardless of their location or form factor, to create a single, unified security fabric. It's important to note that many cloud providers have developed their own custom hardware, such as Google's TPU, Amazon's Inferentia, and Microsoft's Corsica, to accelerate cloud functions. As a result, hardware acceleration on physical security platforms is essential to ensure consistent performance for data moving between physical and cloud environments + +And finally, security platforms need to be automated. Support for automated workflows and AI-enhanced security operations can significantly accelerate the speed of threat detection, analysis, and response. But like other processing-intensive functions, such as decrypting traffic for deep inspection, these functions also need specialized and purpose-built processors or they will become innovation-killing bottlenecks. + +**ZK: What's next for network security?** + +JM: This is just the start. As networking functions begin to converge even further, creating the next generation of smart environments – smart buildings, smart cities, and smart critical infrastructures – the lack of viable security tools capable of inspecting and protecting these hyperfast, hyperconnected, and hyper-scalable environments will seriously impact our digital economy and way of life. + +Security vendors need to understand this challenge and begin investing now in developing advanced hardware and security-driven networking technologies. Organizations aren't waiting for vendors to catch up so they can secure their networks of tomorrow. Their networks are being left exposed right now because the software-based security solutions they have in place are just not adequate. And it's up to the security industry to step up and solve this challenge. + +Join the Network World communities on [Facebook][5] and [LinkedIn][6] to comment on topics that are top of mind. + +-------------------------------------------------------------------------------- + +via: https://www.networkworld.com/article/3531929/as-the-network-evolves-enterprises-need-to-rethink-security.html + +作者:[Zeus Kerravala][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.networkworld.com/author/Zeus-Kerravala/ +[b]: https://github.com/lujun9972 +[1]: https://www.networkworld.com/article/3236448/lan-wan/what-to-consider-when-deploying-a-next-generation-firewall.html +[2]: https://www.networkworld.com/newsletters/signup.html +[3]: https://www.networkworld.com/article/3487720/the-vpn-is-dying-long-live-zero-trust.html +[4]: https://pluralsight.pxf.io/c/321564/424552/7490?u=https%3A%2F%2Fwww.pluralsight.com%2Fpaths%2Fcertified-information-systems-security-professional-cisspr +[5]: https://www.facebook.com/NetworkWorld/ +[6]: https://www.linkedin.com/company/network-world diff --git a/sources/talk/20200316 How to be the right person for DevOps.md b/sources/talk/20200316 How to be the right person for DevOps.md new file mode 100644 index 0000000000..02cdf8bedb --- /dev/null +++ b/sources/talk/20200316 How to be the right person for DevOps.md @@ -0,0 +1,108 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How to be the right person for DevOps) +[#]: via: (https://opensource.com/article/20/3/devops-relationships) +[#]: author: (Josh Atwell https://opensource.com/users/joshatwell) + +How to be the right person for DevOps +====== +Creating healthy relationships is the essential ingredient in DevOps +success. +![Team meeting][1] + +In my kitchen, we have a sign that reads "Marriage is more than finding the right person. It is being the right person." It serves as a great reminder of the individual responsibility everyone has in any healthy relationship. As organizations adopt [DevOps][2] as a model of developing and delivering value to customers, the impact of healthy relationships is extremely important for success. + +![Marriage sign][3] + +Historically, the relationship between development and operations teams has been unhealthy. Poor communication, limited empathy, and a history of mistrust make merging these teams into a tighter operating model challenging, to say the least. This is not entirely unfair to either side. + +Developers have long been frustrated by lead times and processes put in place by the operations organization. They just want to work, and they often see operations as an anchor on the ship of progress. + +Operations professionals have long been frustrated by the impatience and lack of clear requirements that come from development teams. They are often confused about why those teams are not able to use the available services and processes. They see developers as a liability to their ability to maintain stable services for customers and the business. + +A lingering gap here is that each side has been focused on protecting its own perspective. They emphasize how the other team is not being what _they_ need, and they never question whether they, too, could be doing something different. + +In DevOps, all sides must frame their role in the organization based on how they add value to others. + +There are a few things that everyone, including managers and leaders, can do right away to become a better contributor and partner in their DevOps relationships. + +### Communicate + +Most professionals in an organization adopting DevOps find themselves needing to work closely with new people, ones they have had limited exposure to in the past. It is important for everyone to take time to get to know their new teammates and learn more about their concerns, their interests, and also their preferred communication style. + +Successful communication in new relationships is often built on simply listening more and talking less. Our natural tendency is to talk about ourselves. Most people love sharing what they know best. However, it is extremely important to make more room to listen. + +Hearing someone is not the same as listening to them. I'm confident that we have all been in the situation where someone expresses a concern that we do not entirely internalize. Also, merely hearing does not encourage people to share–or to share as completely as they should. + +![Stick figures hearing][4] + +It is important to listen actively. Repeat what you hear, and seek validation that what you repeat is what they wanted you to understand. Once you understand their concern, it is important to make your initial response a selfless one. Even if you can't completely solve the problem, demonstrate sympathy and help the person move towards a solution. + +![Stick figures listening][5] + +### Selflessness + +Another key relationship challenge as organizations adopt DevOps is developing a perspective of selflessness. In DevOps, most people are responsible for delivering value to a wide variety of other people. Each person should begin by considering how their actions and work impact other people. + +This service mindset carries forward when you become more sensitive to when others are in need and then dedicate time in your schedule specifically for the purpose of helping them. This can be as simple as creating a small improvement in a process or helping to troubleshoot an issue. A positive side effect is that this effort will provide you more opportunities to work with others and develop deeper trust. + +It is also important not to hoard knowledge—either technical or institutional—especially when people ask questions or seek help. Maintain the mindset that there are no stupid questions. + +![Stick figure apologizing][6] + +Finally, selflessness includes being trustworthy. It is difficult to maintain a healthy relationship when there is no trust. Be honest and transparent. In IT, this is often seen as a liability, but in DevOps it is a requirement for success. + +### Self-care + +In order to be a strong contributor to a relationship, it is necessary to maintain a sense of self. Our individuality provides the diversity a relationship needs to grow. Make sure you maintain and share your interests with others. Be more than just the work you do. Apply your interests to your work. + +You are no good to others if you are not good to yourself. Healthy relationships are stronger with healthy people. Make sure you take time to enjoy your interests and recharge. Take your vacation and leave work behind! + +![Stick figure relaxing][7] + +I am also a strong advocate for mental health days. Sometimes our mental health is not sufficient to work effectively. You're not as effective when you are physically ill, and you're not as effective when your head is not 100%. Work with your manager and your team to support each other to maintain good mental health. + +Mental health is improved by learning. Invest in yourself and expand your knowledge. DevOps ideally needs "t-shaped" people who have depth on a topic and also broader system knowledge. Work to increase your depth, but balance that by learning new things about your environment. This knowledge can come from your teammates and create operational sympathy. + +![Stick figure with open arms][8] + +Finally, healthy relationships are not all work and no play. Take time to acknowledge the successes of others. If you know your team, you likely know how individuals prefer to receive praise. Respect those preferences, but always strive to praise vocally where possible. + +![Stick figures celebrating][9] + +Make sure to celebrate these successes as a team. All work and no play makes everyone dull. Celebrate milestones together as a team, and then articulate and target the next objectives. + +### Be the right person + +DevOps requires more from every individual, and its success is directly tied to the health of relationships. Each member of the organization should apply these techniques to grow and improve themselves. A focus on being the right person for the team will build stronger bonds and make the organization better equipped to reach its goals. + +* * * + +_This article is based on [a talk][10] Josh Atwell gave at All Things Open 2019._ + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/3/devops-relationships + +作者:[Josh Atwell][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/joshatwell +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/meeting-team-listen-communicate.png?itok=KEBP6vZ_ (Team meeting) +[2]: https://opensource.com/tags/devops +[3]: https://opensource.com/sites/default/files/uploads/marriage.png (Marriage sign) +[4]: https://opensource.com/sites/default/files/uploads/hearing.png (Stick figures hearing) +[5]: https://opensource.com/sites/default/files/uploads/listening.png (Stick figures listening) +[6]: https://opensource.com/sites/default/files/uploads/apologize.png (Stick figure apologizing) +[7]: https://opensource.com/sites/default/files/uploads/relax.png (Stick figure relaxing) +[8]: https://opensource.com/sites/default/files/uploads/open_0.png (Stick figure with open arms) +[9]: https://opensource.com/sites/default/files/uploads/celebrate.png (Stick figures celebrating) +[10]: https://opensource.com/article/20/1/devops-empathy diff --git a/sources/talk/20200316 OpenStreetMap- A Community-Driven Google Maps Alternative.md b/sources/talk/20200316 OpenStreetMap- A Community-Driven Google Maps Alternative.md new file mode 100644 index 0000000000..123b5f003f --- /dev/null +++ b/sources/talk/20200316 OpenStreetMap- A Community-Driven Google Maps Alternative.md @@ -0,0 +1,93 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (OpenStreetMap: A Community-Driven Google Maps Alternative) +[#]: via: (https://itsfoss.com/openstreetmap/) +[#]: author: (Ankush Das https://itsfoss.com/author/ankush/) + +OpenStreetMap: A Community-Driven Google Maps Alternative +====== + +_**Brief: OpenStreetMap is a community-driven map – which is a potential alternative to Google Maps. Learn more about this open source project.**_ + +[OpenStreetMap][1] (OSM) is a free editable map of the world. Anyone can contribute, edit, and make changes to the OpenStreetMap to improve it. + +![][2] + +You need to sign up for an account first – in order to be able to edit or add information to the OpenStreetMap. To view the map, you wouldn’t need an account. + +Even though it’s a free-to-use map under an [open data license][3], you cannot use the map API to build another service on top of it for commercial purpose. + +So, you can download the map data to use it and host it yourself while mentioning the credits to OSM. You can learn more about its [API usage policy][4] and [copyright][5] information on its official website to learn more. + +In this article, we shall take a brief look at how it works and what kind of projects use OpenStreetMaps as the source of their map data. + +### OpenStreetMap: Overview + +![][6] + +OpenStreetMap is a good alternative to Google Maps. You might not get the same level of information as Google Maps- but for basic navigation and traveling, OpenStreetMap is sufficient. + +Just like any other map, you will be able to switch between multiple layers in the map, get to know your location, and easily search for places. + +You may not find all the latest information for the businesses, shops, and restaurants nearby. But, for basic navigation, it’s more than enough. + +OpenStreetMap can be usually accessed through a web browser on both desktop and mobile by visiting the [OpenStreetMap site][7]. It does not have an official Android/iOS app yet. + +However, there are a variety of applications available that utilize OpenStreetMap at its core. So, if you want to utilize OpenStreetMap on a smartphone, you can take a look at some of the popular open-source Google Maps alternatives: + + * [OsmAnd][8] + * [MAPS.ME][9] + + + +**MAPS.ME** and **OsmAnd** are two open-source applications for Android and iOS that utilize OpenStreetMap data to provide a rich user experience with a bunch of useful information and features added to it. + +You can also opt for other proprietary options if you wish, like [Magic Earth][10]. + +In either case, you can take a look at the extensive list of applications on their official wiki page for [Android][11] and [iOS][12]. + +### Using OpenStreetMap On Linux + +![][13] + +The easiest way to use OpenStreetMap on Linux is to use it in a web browser. If you use GNOME desktop environment, you can install GNOME Maps which is built on top of OpenStreetMap. + +There are also several software (that are mostly obsolete) that utilize OpenStreetMap on Linux for specific purposes. You can check out the list of available packages in their [official wiki list][14]. + +### Wrapping Up + +OpenStreetMap may not be the best source for navigation for end users but its open source model allows it to be used freely. This means that many services can be built using OpenStreetMap. For example, [ÖPNVKarte][15] uses OpenStreetMap to display worldwide public transport facilities on a uniform map so that you don’t have to browse individual operator’s websites. + +What do you think about OpenStreetMap? Can you use it as a Google Maps alternative? Feel free to share your thoughts in the comments below. + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/openstreetmap/ + +作者:[Ankush Das][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://itsfoss.com/author/ankush/ +[b]: https://github.com/lujun9972 +[1]: https://www.openstreetmap.org/ +[2]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/03/openstreetmap.jpg?ssl=1 +[3]: https://opendatacommons.org/licenses/odbl/ +[4]: https://operations.osmfoundation.org/policies/api/ +[5]: https://www.openstreetmap.org/copyright +[6]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/03/open-street-map-2.jpg?ssl=1 +[7]: https://www.openstreetmap.org +[8]: https://play.google.com/store/apps/details?id=net.osmand +[9]: https://play.google.com/store/apps/details?id=com.mapswithme.maps.pro +[10]: https://www.magicearth.com/ +[11]: https://wiki.openstreetmap.org/wiki/Android#OpenStreetMap_applications +[12]: https://wiki.openstreetmap.org/wiki/Apple_iOS +[13]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/03/open-street-map-1.jpg?ssl=1 +[14]: https://wiki.openstreetmap.org/wiki/Linux +[15]: http://xn--pnvkarte-m4a.de/ diff --git a/sources/talk/20200317 -AI everywhere- IoT chips coming from Arm.md b/sources/talk/20200317 -AI everywhere- IoT chips coming from Arm.md new file mode 100644 index 0000000000..a5e61bce6d --- /dev/null +++ b/sources/talk/20200317 -AI everywhere- IoT chips coming from Arm.md @@ -0,0 +1,61 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: ('AI everywhere' IoT chips coming from Arm) +[#]: via: (https://www.networkworld.com/article/3532094/ai-everywhere-iot-chips-coming-from-arm.html) +[#]: author: (Patrick Nelson https://www.networkworld.com/author/Patrick-Nelson/) + +'AI everywhere' IoT chips coming from Arm +====== +Two new microprocessors from Arm promise to miniaturize artificial intelligence. +Healthcare + +Silicon microchip maker Arm is working on a new semiconductor design that it says will enable machine learning, at scale, on small sensor devices. Arm has completed testing of the technology and expects to bring it to market next year. + +Artificial intelligence, implemented locally on "billions and ultimately trillions" of devices is coming, the company says in a [press release][1]. Arm Holdings, owned by Japanese conglomerate Softbank, says its partners have shipped more than 160 billion Arm-based chips to date, and that 45 million of its microprocessor designs are being placed within electronics every day. + +The new machine-learning silicon will include micro neural processing units (microNPU) that can be used to identify speech patterns and perform other AI tasks. Importantly, the processing is accomplished on-device and in smaller form factors than have so far been available. The chips don't need the cloud or any network. + +[RELATED: Auto parts supplier has big plans for its nascent IoT effort][2] + +Arm, which historically has been behind mobile smartphone microchips, is aiming this design – the Cortex M55 processor, paired with the Ethos-U55, Arm's first microNPU – at Internet of Things instead. + +"Enabling AI everywhere requires device makers and developers to deliver machine learning locally on billions, and ultimately trillions of devices," said Dipti Vachani, senior vice president and general manager of Arm's automotive and IoT areas, in a statement. "With these additions to our AI platform, no device is left behind as on-device ML on the tiniest devices will be the new normal, unleashing the potential of AI securely across a vast range of life-changing applications." + +Arm wants to take advantage of the autonomous nature of chip-based number crunching, as opposed to doing it in the cloud. Privacy-conscious (and regulated) healthcare is an example of a vertical that might like the idea of localized processing.  + +Functioning AI without cloud dependence isn't entirely new. Intel's [Neural Compute Stick 2][3], a $69 self-contained computer vision and deep learning development kit, doesn't need it, for example. + +**[ [Get certified as an Apple Technical Coordinator with this seven-part online course from PluralSight.][4] ]** + +Arm is also going for power savings with its new AI technology. Not requiring a data network can mean longer battery life for the sensor— only the calculated results need to be sent, rather than every bit. Much of the time, raw sensor data is irrelevant and can be discarded. Arm's new endpoint ML technologies are going to help microcontroller developers "accelerate edge inference in devices limited by size and power," said Geoff Lees, senior vice president of edge processing at IoT semiconductor company [NXP][5], in the announcement.  + +Enabling machine learning in power-constrained settings and eliminating the need for network connectivity mean the sensor can be placed where there isn't a hardy power supply. Latency advantages and cost advantages also can come into play. + +"These devices can run neural network models on batteries for years, and deliver low-latency inference directly on the device," said Ian Nappier, product manager of TensorFlow Lite for Microcontrollers at Google, in a statement to Arm. [TensorFlow][6] is an open-source machine learning platform that's been used for detecting respiratory diseases, among other things. + +Join the Network World communities on [Facebook][7] and [LinkedIn][8] to comment on topics that are top of mind. + +-------------------------------------------------------------------------------- + +via: https://www.networkworld.com/article/3532094/ai-everywhere-iot-chips-coming-from-arm.html + +作者:[Patrick Nelson][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.networkworld.com/author/Patrick-Nelson/ +[b]: https://github.com/lujun9972 +[1]: https://www.arm.com/company/news/2020/02/new-ai-technology-from-arm +[2]: https://www.networkworld.com/article/3098084/internet-of-things/auto-parts-supplier-has-big-plans-for-its-nascent-iot-effort.html#tk.nww-fsb +[3]: https://store.intelrealsense.com/buy-intel-neural-compute-stick-2.html +[4]: https://pluralsight.pxf.io/c/321564/424552/7490?u=https%3A%2F%2Fwww.pluralsight.com%2Fpaths%2Fapple-certified-technical-trainer-10-11 +[5]: https://www.nxp.com/company/our-company/about-nxp:ABOUT-NXP +[6]: https://www.tensorflow.org/ +[7]: https://www.facebook.com/NetworkWorld/ +[8]: https://www.linkedin.com/company/network-world diff --git a/sources/talk/20200319 Electronics should sweat to cool down, say researchers.md b/sources/talk/20200319 Electronics should sweat to cool down, say researchers.md new file mode 100644 index 0000000000..ae2bce3e22 --- /dev/null +++ b/sources/talk/20200319 Electronics should sweat to cool down, say researchers.md @@ -0,0 +1,61 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Electronics should sweat to cool down, say researchers) +[#]: via: (https://www.networkworld.com/article/3532827/electronics-should-sweat-to-cool-down-say-researchers.html) +[#]: author: (Patrick Nelson https://www.networkworld.com/author/Patrick-Nelson/) + +Electronics should sweat to cool down, say researchers +====== +Scientists think that in much the same way the human body releases perspiration to cool down, special materials might release water to draw heat from electronics. +rclassenlayouts / Aleksei Derin / Getty Images + +Computing devices should sweat when they get too hot, say scientists at Shanghai Jiao Tong University in China, where they have developed a materials application they claim will cool down devices more efficiently and in smaller form-factors than existing fans. + +It’s “a coating for electronics that releases water vapor to dissipate heat from running devices,” the team explain in a news release. “Mammals sweat to regulate body temperature,” so should electronics, they believe. + +[[Get regularly scheduled insights by signing up for Network World newsletters.]][1] + +The group’s focus has been on studying porous materials that can absorb moisture from the environment and then release water vapor when warmed. MIL-101(Cr) checks the boxes, they say. The material is a metal organic framework, or MOF, which is a sorbent, a material that stores large amounts of water. The higher the water capacity one has, the greater the dissipation of heat when it's warmed. + +MOF projects have been attempted before. “Researchers have tried to use MOFs to extract water from the desert air,” says refrigeration-engineering scientist Ruzhu Wang, who is senior author of a paper on the university’s work that has just been [published in Joule][2]. + +Their proof-of-concept test involved applying a micrometers-thin coating of MIL-101(Cr) to metallic substrates that resulted in temperature drops of up to 8.6 degrees Celsius for 25 minutes, according to the abstract for their paper. + +That’s “a significant improvement compared to that of traditional PCMs,” they say. Phase change materials (PCM) include waxes and fatty acids that are used in electronics and melt to absorb heat. They are used in smartphones, but the solid-to-liquid transition doesn’t exchange all that much energy. + +“In contrast, the liquid-vapor transition of water can exchange 10 times the energy compared to that of PCM solid-liquid transition.” Plus the material used recovers almost immediately to start sweating again, just like a mammal. + +[][3] + +Shanghai Jiao Tong University isn’t the only school looking into sweat for future tech. Cornell University says it wants to get robots to sweat to bring their temperature below ambient. Researchers there say they have built a 3D-printed, sweating robot muscle. It [manages its own temperature][4], and they think it will one day let robots run for extended periods without overheating. + +Soft robots, which are the kind preferred by many developers for their flexibility, hold more heat than metal ones. As in electronic devices such as smartphones and IoT sensors, fans aren’t ideal because they take up too much space. That’s why new materials applications are being studied. + +The Cornell robot group uses light to cure resin into shapes that control the flow of heat. A base layer “smart sponge” made of poly-N-isopropylacrylamide retains water and squeezes it through fabricated, dilated pores when heated. The pores then close automatically when cooled. + +“Just when it seemed like robots couldn’t get any cooler,” the group says. + +Join the Network World communities on [Facebook][5] and [LinkedIn][6] to comment on topics that are top of mind. + +-------------------------------------------------------------------------------- + +via: https://www.networkworld.com/article/3532827/electronics-should-sweat-to-cool-down-say-researchers.html + +作者:[Patrick Nelson][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.networkworld.com/author/Patrick-Nelson/ +[b]: https://github.com/lujun9972 +[1]: https://www.networkworld.com/newsletters/signup.html +[2]: https://www.cell.com/joule/fulltext/S2542-4351(19)30590-2 +[3]: https://www.networkworld.com/blog/itaas-and-the-corporate-storage-technology/?utm_source=IDG&utm_medium=promotions&utm_campaign=HPE22140&utm_content=sidebar (ITAAS and Corporate Storage Strategy) +[4]: https://news.cornell.edu/stories/2020/01/researchers-create-3d-printed-sweating-robot-muscle +[5]: https://www.facebook.com/NetworkWorld/ +[6]: https://www.linkedin.com/company/network-world diff --git a/sources/talk/20200320 Cisco warns of five SD-WAN security weaknesses.md b/sources/talk/20200320 Cisco warns of five SD-WAN security weaknesses.md new file mode 100644 index 0000000000..6055b6c53b --- /dev/null +++ b/sources/talk/20200320 Cisco warns of five SD-WAN security weaknesses.md @@ -0,0 +1,74 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Cisco warns of five SD-WAN security weaknesses) +[#]: via: (https://www.networkworld.com/article/3533550/cisco-warns-of-five-sd-wan-security-weaknesses.html) +[#]: author: (Michael Cooney https://www.networkworld.com/author/Michael-Cooney/) + +Cisco warns of five SD-WAN security weaknesses +====== +Cisco warnings include three high-impact SD-WAN vulnerabilities +[Jaredd Craig][1] [(CC0)][2] + +Cisco has issued five  warnings about security weaknesses in its [SD-WAN][3] offerings, three of them on the high-end of the vulnerability scale. + +The worst problem is with the command-line interface (CLI) of its [SD-WAN][4] Solution software where a weakness could let a local attacker inject arbitrary commands that are executed with root privileges, Cisco [wrote.][5] + +[[Get regularly scheduled insights by signing up for Network World newsletters.]][6] + +An attacker could exploit this vulnerability – which has a 7.8 out if 10 on  the Common Vulnerability Scoring System – by authenticating to the device and submitting crafted input to the CLI utility. The attacker must be authenticated to access the CLI utility. The vulnerability is due to insufficient input validation, Cisco wrote. + +Another high warning problem lets an authenticated, local attacker elevate privileges to root on the underlying operating system.  An attacker could exploit this vulnerability by sending a crafted request to an affected system. A successful exploit could allow the attacker to gain root-level privileges, Cisco [wrote][7].  The vulnerability is due to insufficient input validation. + +The third high-level vulnerability in the SD-WAN Solution software could let an attacker cause a buffer overflow on an affected device. An attacker could exploit this vulnerability by sending crafted traffic to an affected device. A successful exploit could allow the attacker to gain access to information that they are not authorized to access and make changes to the system that they are not authorized to make, Cisco [wrote][8]. + +The vulnerabilities affect a number of Cisco products if they are running a Cisco SD-WAN Solution software release earlier than Release 19.2.2: vBond Orchestrator Software, vEdge 100-5000 Series Routers, vManage Network Management System and vSmart Controller Software. + +Cisco said there were no workarounds for any of the vulnerabilities and it suggested users accept automatic software updates to allay exploit risks. There are [software fixes for the problems][9] as well.  + +**[ [Prepare to become a Certified Information Security Systems Professional with this comprehensive online course from PluralSight. Now offering a 10-day free trial!][10] ]** + +All three of the high-level warnings were reported to Cisco by the Orange Group, Cisco said. + +The other two SD-WAN Solution software warnings – with medium threat levels -- include a one that allows a cross-site scripting (XSS) attack against the web-based management interface of the vManage software and SQL injection threat. + +The [XXS vulnerability][11] is due to insufficient validation of user-supplied input by the web-based management interface. An attacker could exploit this vulnerability by persuading a user of the interface to click a crafted link. A successful exploit could allow the attacker to execute arbitrary script code in the context of the interface or to access sensitive, browser-based information. + +The SQL vulnerability exists because the web UI improperly validates SQL values. An attacker could exploit this vulnerability by authenticating to the application and sending malicious SQL queries to an affected system. A successful exploit could let the attacker  modify values on, or return values from, the underlying database as well as the operating system, Cisco [wrote][12]. + +Cisco recognized Julien Legras and Thomas Etrillard of Synacktiv for reporting the problems. + +The company said release 19.2.2 of the [Cisco SD-WAN Solution][13] contains fixes for all five vulnerabilities. + +Join the Network World communities on [Facebook][14] and [LinkedIn][15] to comment on topics that are top of mind. + +-------------------------------------------------------------------------------- + +via: https://www.networkworld.com/article/3533550/cisco-warns-of-five-sd-wan-security-weaknesses.html + +作者:[Michael Cooney][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.networkworld.com/author/Michael-Cooney/ +[b]: https://github.com/lujun9972 +[1]: https://unsplash.com/photos/T15gG5nA9Xk +[2]: https://creativecommons.org/publicdomain/zero/1.0/ +[3]: https://www.networkworld.com/article/3031279/sd-wan-what-it-is-and-why-you-ll-use-it-one-day.html +[4]: https://www.networkworld.com/article/3527194/multicloud-security-integration-drive-massive-sd-wan-adoption.html +[5]: https://tools.cisco.com/security/center/content/CiscoSecurityAdvisory/cisco-sa-sdwclici-cvrQpH9v +[6]: https://www.networkworld.com/newsletters/signup.html +[7]: https://tools.cisco.com/security/center/content/CiscoSecurityAdvisory/cisco-sa-sdwpresc-ySJGvE9 +[8]: https://tools.cisco.com/security/center/content/CiscoSecurityAdvisory/cisco-sa-sdwanbo-QKcABnS2 +[9]: https://software.cisco.com/download/home +[10]: https://pluralsight.pxf.io/c/321564/424552/7490?u=https%3A%2F%2Fwww.pluralsight.com%2Fpaths%2Fcertified-information-systems-security-professional-cisspr +[11]: https://tools.cisco.com/security/center/content/CiscoSecurityAdvisory/cisco-sa-20200318-vmanage-xss +[12]: https://tools.cisco.com/security/center/content/CiscoSecurityAdvisory/cisco-sa-20200318-vmanage-cypher-inject +[13]: https://www.cisco.com/c/en/us/solutions/enterprise-networks/sd-wan/index.html#~benefits +[14]: https://www.facebook.com/NetworkWorld/ +[15]: https://www.linkedin.com/company/network-world diff --git a/sources/talk/20200320 How technical debt is risking your security.md b/sources/talk/20200320 How technical debt is risking your security.md new file mode 100644 index 0000000000..899696c7d3 --- /dev/null +++ b/sources/talk/20200320 How technical debt is risking your security.md @@ -0,0 +1,85 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How technical debt is risking your security) +[#]: via: (https://opensource.com/article/20/3/remove-security-debt) +[#]: author: (Sam Bocetta https://opensource.com/users/sambocetta) + +How technical debt is risking your security +====== +A few security fixes now will help lighten the load of future developers +using your software. +![A lock on the side of a building][1] + +Everyone knows they shouldn't take shortcuts, especially in their work, and yet everyone does. Sometimes it doesn't matter, but when it comes to code development, though, it definitely does. + +As any experienced programmer knows, building your code the quick and dirty way soon leads to problems down the line. These issues might not be disastrous, but they incur a small penalty every time you want to develop your code further. + +This is the basic idea behind [technical debt][2], a term first coined by well-known programmer Ward Cunningham. Technical debt is a metaphor that explains the long-term burden developers and software teams incur when taking shortcuts, and has become a popular way to think about the extra effort that we have to do in future development because of the quick and dirty design choice. + +"Security Debt" is an extension of this idea, and in this article, we'll take a look at what the term means, why it is a problem, and what you can do about it. + +### What is security debt? + +To get an idea of how security debt works, we have to consider the software development lifecycle. Today, it's very rare for developers to start with a blank page, even for a new piece of software. At the very least, most programmers will start a new project with open source code copied from online repositories. + +They will then adapt and change this code to make their project. While they are doing this, there will be many points where they notice a security vulnerability. Something as simple as an error establishing a database connection can be an indication that systems are not playing well together, and that someone has taken a fast and dirty approach. + +Then they have two options: they can either take an in-depth look at the code they are working with, and fix the issue at a fundamental level, or they can quickly paste extra code over the top that gets around the problem in a quick, inefficient way. + +Given the demands of today's development environment, most developers choose the second route, and we can't blame them. The problem is that the next person who looks at the code is going to have to spend longer working out how it operates. + +Time, as we all know, is money. Because of this, each time software needs to be changed, there will be a small cost to make it secure due to previous developers taking shortcuts. This is security debt. + +### How security debt threatens your software + +There was a time when security debt was not a huge problem, at least not in the open source community. A decade ago, open source components had lifetimes measured in years and were freely available to everyone. + +This meant that security issues in legacy code got fixed. Today, the increased speed of the development lifecycle and the increasingly censored internet means that developers can no longer trust third party code to the degree they used to. + +This has led to a considerable increase in security debt for developers using open source components. Veracode's latest [State of Software Security (SOSS)][3] report found that security issues in open source software take about a month longer to be fixed than those in software that is sourced internally. Insourced software recorded the highest fix rates, but even software sourced from external contractors gets fixed faster, by about two weeks, than open source software. + +The ultimate outcome of this – and one that the term "security debt" captures very well – is that most companies currently face security vulnerabilities throughout their entire software stack, and these are accumulating faster than they are fixed. In other words, developers have maxed out their security debt credit card, and are drowning in the debt they've incurred. This is particularly concerning when you consider that total household debt [reached nearly $14 trillion][4] in the United States alone in 2019. + +### How to avoid security debt + +Avoiding a build-up of security debt requires that developers take a different approach to security than the one that is prevalent in the industry at the moment. Proven methods such as zero-knowledge cloud encryption, VPNs to promote online anonymity, and network intrusion prevention software are great, but they may also not be enough. + +In fact, there might have been some developers who were scratching their heads during our definition of security debt above: how many of us think about the next poor soul who will have to check our code for security flaws? + +Changing that way of thinking is key to preventing a build-up of security debt. Developers should take the time to thoroughly [check their software for security vulnerabilities][5], not just during development, but after the release as well. Fix any errors now, rather than waiting for security holes to build up. + +If that instruction sounds familiar, then well done. A continuity approach to software development is a critical component of [layering security through DevOps][6], and one of the pillars of the emerging discipline of DevSecOps. Along with [chaos engineering][7], these approaches seek to integrate security into development, testing, and assessment processes, and thereby prevent a build-up of security debt. + +Just like a credit card, the key to avoiding security debt getting out of control is to avoid the temptation to take shortcuts in the first place. That's easier said than done, of course, but one of the key lessons from recent data breaches is that legacy systems that many developers assume are secure are just as full of shortcuts as recently written code. + +### Measure twice, cut once + +Since [security by default hasn't arrived yet][8], we must all try and do things properly in the future. Taking the fast, dirty approach might mean that you get to leave the office early, but ultimately that decision will come back to bite you. + +If you finish early anyway, well done: you can use the time to read [our best articles on security][9] and check whether your code is as secure as you think it is. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/3/remove-security-debt + +作者:[Sam Bocetta][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/sambocetta +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/BUSINESS_3reasons.png?itok=k6F3-BqA (A lock on the side of a building) +[2]: https://opensource.com/article/17/10/why-i-love-technical-debt +[3]: https://www.veracode.com/state-of-software-security-report +[4]: https://thetokenist.io/financial-statistics/ +[5]: https://opensource.com/article/17/6/3-security-musts-software-developers +[6]: https://opensource.com/article/19/9/layered-security-devops +[7]: https://www.infoq.com/articles/chaos-engineering-security-networking/ +[8]: https://opensource.com/article/20/1/confidential-computing +[9]: https://opensource.com/article/19/12/security-resources diff --git a/sources/talk/20200321 3 metrics to measure your open source community health.md b/sources/talk/20200321 3 metrics to measure your open source community health.md new file mode 100644 index 0000000000..57e3f7ae5f --- /dev/null +++ b/sources/talk/20200321 3 metrics to measure your open source community health.md @@ -0,0 +1,110 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (3 metrics to measure your open source community health) +[#]: via: (https://opensource.com/article/20/3/community-metrics) +[#]: author: (Kevin Xu https://opensource.com/users/kevin-xu) + +3 metrics to measure your open source community health +====== +Community building is critical to the success of any open source +project. Here's how to evaluate your community's health and strengthen +it. +![Green graph of measurements][1] + +Community building is table stakes in the success of any open source project. Even outside of open source, community is considered a competitive advantage for businesses in many industries—from retail, to gaming, to fitness. (For a deeper dive, see "[When community becomes your competitive advantage][2]" in the _Harvard Business Review_.) + +However, open source community building—especially offline activities—is notoriously hard to measure, track, and analyze. While we've all been to our fair share of meetups, conferences, and "summits" (and probably hosted a few of them ourselves), were they worth it? Did the community meaningfully grow? Was printing all those stickers and swags worth the money? Did we collect and track the right numbers to measure progress? + +To develop a better framework for measuring community, we can look to a different industry for guidance and fresh ideas: political campaigns. + +### My metrics start with politics + +I started my career in political campaigns in the US as a field organizer (aka a low-level staffer) for then-candidate Senator Obama in 2008. Thinking back, a field organizer's job is basically community building in a specifically assigned geographical area that your campaign needs to win. My day consisted of calling supporters to do volunteer activities, hosting events to gather supporters, bringing in guest speakers (called "surrogates" in politics) to events, and selling the vision and plan of our candidate (essentially our "product"). + +Another big chunk of my day was doing data entry. We logged everything: interactions on phone conversations with voters, contact rates, event attendance, volunteer recruitment rates, volunteer show-up rates, and myriad other numbers to constantly measure our effectiveness. + +Regardless of your misgivings about politics in general or specific politicians, the winning campaigns that lead to political victories are all giant community-building exercises that are data-driven, meticulously measured, and constantly optimized. They are well-oiled community-building machines. + +When I entered the world of open source a few years ago, the community-building part felt familiar and natural. What surprised me was how little community building as an operation is quantified and measured—especially with offline activities. + +### Three metrics to track + +Taking a page from the best-run political campaigns I've seen, here are the three most important metrics for an open source community to track and optimize: + + * Number of **community ambassadors** + * Number of **return attendees** (people who attend your activities two times or more) + * Rate of **churned attendees** (the percentage of people who attend your activities only once or say they will come but don't show up) + + + +If you're curious, the corresponding terms on a political campaign for these three metrics are typically community captains, super volunteers, and flake rate. + +#### Community ambassadors + +A "community ambassador" is a user or enthusiast of your project who is willing to _consistently_ host local meetups or activities where she or he lives. Growing the number of community ambassadors and supporting them with resources and guidance are core to your community's strength and scale. You can probably hire for these if you have a lot of funding, but pure volunteers speak more to your project's allure. + +These ambassadors should be your best friends, where you understand inside and out why they are motivated to evangelize your project in front of both peers and strangers. Their feedback on your project is also valuable and should be a critical part of your development roadmap and process. You can strategically cultivate ambassadors in different tech hubs geographically around the world, so your project can count on someone with local knowledge to reach and serve users of different business cultures with different needs. The beauty of open source is that it's global by default; take advantage of it! + +Some cities are arguably more of a developer hub than others. Some to consider are Amsterdam, Austin, Bangalore, Beijing, Berlin, Hangzhou, Istanbul, London, NYC, Paris, Seattle, Seoul, Shenzhen, Singapore, São Paulo, San Francisco-Bay Area, Vancouver, Tel Aviv, Tokyo, and Toronto (listed alphabetically and based on feedback I got through social media. Please add a comment if I missed any!). An example of this is the [Cloud Native Ambassadors program][3] of the Cloud Native Computing Foundation. + +#### Return attendees + +The number of return attendees is crucial to measuring the usefulness or stickiness of your community activities. Tracking return attendees is how you can draw a meaningful line between "the curious" and "the serious." + +Trying to grow this number should be an obvious goal. However, that's not the only goal. This is the group whose motivation you want to understand the clearest. This is the group that reflects your project's user persona. This is the group that can probably give you the most valuable feedback. This is the group that will become your future community ambassadors. + +Putting it differently, this is your [1,000 true fans][4] (if you can keep them). + +Having hosted and attended my fair share of these community meetups, my observation is that most people attend to be educated on a technical topic, look for tools to solve problems at work, or network for their next job opportunity. What they are not looking for is being "marketed to." + +There is a growing trend of developer community events becoming marketing events, especially when companies are flush with funding or have a strong marketing department that wants to "control the message." I find this trend troubling because it undermines community building. + +Thus, be laser-focused on technical education. If a developer community gets taken over by marketing campaigns, your return-attendees metric won't be pretty. + +#### Churned attendees rate + +Tracking churned attendees is the flipside of the returned-attendees coin, so I won't belabor the point. These are the people that join once and then disappear or who show interest but don't show up. They are important because they tell you what isn't working and for whom, which is more actionable than just counting the people who show up. + +One note of caution: Be brutally honest when measuring this number, and don't fool yourself (or others). On its own, if someone signs up but doesn't show up, it doesn't mean much. Similarly, if someone shows up once and never comes back, it doesn't mean much. Routinely sit down and assess _why_ someone isn't showing up, so you can re-evaluate and refine your community program and activities. Don't build the wrong incentives into your community-building operation to reward the wrong metric. + +### Value of in-person connections + +I purposely focused this post on measuring offline community activities because online activities are inherently more trackable and intuitive to digital-native open source creators. + +Offline community activities are essential to any project's journey to reaching traction and prominence. I have yet to see a successful project that does not have a sizable offline presence, regardless of its online popularity. + +Why is this the case? Why can't an open source community, usually born online, just stay and grow online? + +Because technology choice is ultimately a human decision; therefore, face-to-face interaction is an irreplaceable element of new technology adoption. No one wants to be the guinea pig. No one wants to be the first. The most effective way to not feel like the first is to literally _see_ other human beings trying out or being interested in the same thing. + +Being in the same room as other developers, learning about the same project, and doing that regularly is the most effective way to build trust for a project. And with trust comes traction. + +### These three metrics work + +There are other things you _can_ track, but more data does not necessarily mean clearer insight. Focusing your energy on these three metrics will make the most impact on your community-building operation. An open source community where the _number of ambassadors and return attendees are trending up_ and the _churned attendees rate is trending down_ is one that's healthy and growing in the right way. + +* * * + +_This article originally appeared on_ _[COSS Media][5]_ _and is republished with permission._ + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/3/community-metrics + +作者:[Kevin Xu][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/kevin-xu +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/metrics_lead-steps-measure.png?itok=DG7rFZPk (Green graph of measurements) +[2]: https://hbr.org/2020/01/when-community-becomes-your-competitive-advantage +[3]: https://www.cncf.io/people/ambassadors/ +[4]: https://kk.org/thetechnium/1000-true-fans/ +[5]: https://coss.media/how-to-measure-community-building/ diff --git a/sources/talk/20200321 Coronavirus challenges capacity, but core networks are holding up.md b/sources/talk/20200321 Coronavirus challenges capacity, but core networks are holding up.md new file mode 100644 index 0000000000..918ca93df3 --- /dev/null +++ b/sources/talk/20200321 Coronavirus challenges capacity, but core networks are holding up.md @@ -0,0 +1,107 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Coronavirus challenges capacity, but core networks are holding up) +[#]: via: (https://www.networkworld.com/article/3533438/coronavirus-challenges-capacity-but-core-networks-are-holding-up.html) +[#]: author: (Michael Cooney https://www.networkworld.com/author/Michael-Cooney/) + +Coronavirus challenges capacity, but core networks are holding up +====== +COVID-19 has sent thousands of employees to work from home, placing untold stress on remote-access networks. +Cicilie Arcurs / Getty Images + +As the coronavirus continues to spread and more people work from home, the impact of the increased traffic on networks in the US so far seems to be minimal. + +No doubt that web, VPN and data usage is growing dramatically with the [influx of remote workers][1].  For example, Verizon said it has seen a 34% increase in VPN traffic from March 10 to 17.  It has also seen a 75% increase in gaming traffic, and web traffic increased by just under 20% in that time period, according to Verizon. + +[[Get regularly scheduled insights by signing up for Network World newsletters.]][2] + +Verizon said its fiber optic and wireless networks “have been able to meet the shifting demands of customers and continue to perform well. In small pockets where there has been a significant increase in usage, our engineers have quickly added capacity to meet customers’ demand.” + +“As we see more and more individuals work from home and students engage in online learning, it is a natural byproduct that we would see an increase in web traffic and access to VPN. And as more entertainment options are cancelled in communities across the US, an increase in video traffic and online gaming is not surprising,” said Kyle Malady, Chief Technology Officer for Verizon in a [statement][3]. “We expect these peak hour percentages to fluctuate, so our engineers are continuing to closely monitor network usage patterns 24x7 and stand ready to adjust resources as changing demands arise." + +As of March 16, AT&T said that its network continues to perform well. “In cities where the coronavirus has had the biggest impact, we are seeing fewer spikes in wireless usage around particular cell towers or particular times of day because more people are working from home rather than commuting to work and fewer people are gathering in large crowds at specific locations.” + +In Europe, Vodaphone say it has seen an 50% increase in data traffic in some markets. + +“COVID-19 is already having a significant impact on our services and placing a greater demand on our network,” the company said in a statement. “Our technology teams throughout Europe have been focusing on capacity across our networks to make sure they are resilient and can absorb any new usage patterns arising as more people start working from home.” + +[][4] + +In Europe there have also been indications of problems.  + +Ireland-based [Spearline][5], which monitors international phone numbers for connectivity and audio quality, said this week that Italy's landline connection rate continues to be volatile with as much as a 10% failure rate and audio quality is running approximately 4% below normal levels.  + +Other Spearline research says: + + * Spain saw a drop in connection rates to 98.5% on March 16, but it is improving again. + * France saw a dip in connection rates approaching 5% on March17. Good quality has been maintained overall, though periodic slippage has been observed. + * Germany saw a 1.7% connection-failure rate March 17.  Good quality has been maintained, though periodic slippage has been observed. + + + +Such problems are not showing up in the US at this point, Spearline said. + +“The US is Spearline's most tested market with test calls over three main sectors being enterprise, unified communications and carrier. To date, there has been no significant impact on either the connection rates or the audio quality on calls throughout the US,” said Matthew Lawlor, co-founder and chief technical officer at Spearline.  + +The future impact is the real unknown of course, Lawlor said. + +“There are many potential issues which have happened in other countries which may have a similar impact on US infrastructure. For example, in many countries there have been hardware issues where engineers are unable to get physical access to resolve the issue,” Lawlor said.   “While rerouting calls may help resolve issues it does put more pressure on other segments of your network.” + +On March 19, one week after the CDC declarated the virus as pandemic, data analytics and broadband vendor OpenVault wrote: + + * Subscribers’ average usage from 9 a.m. to 5 p.m. has risen to 6.3 GB, 41.4% higher than the January figure of 4.4 GB.  + * During the same period, peak-hour (6 p.m. to 11 p.m.) usage has risen 17.2% from 5.0 GB per subscriber in January to 5.87 GB in March.  + * Overall daily usage has grown from 12.19 GB to 15.46 GB, an increase of 26.8%. + + + +Based on the current rate of growth, OpenVault projected that consumption for March will reach nearly 400 GB per subscriber, an increase of almost 11% over the previous monthly record of 361 GB, established in January. In addition, OpenVault projects a new coronavirus-influenced run rate of 460 GB per subscriber per month going forward. OpenVault’s research is based on the usage of more than 1 million broadband subscribers through the United States, the company said. + +“Broadband clearly is keeping the hearts of business, education and entertainment beating during this crisis,” said Mark Trudeau, CEO and founder of OpenVault in a  [statement][6]. “Networks built for peak-hours consumption so far are easily handling the rise in nine-to-five business-hours usage. We’ve had concerns about peak hours consumption given the increase in streaming entertainment and the trend toward temporary cessation of bandwidth caps, but operator networks seem to be handling the additional traffic without impacting customer experiences.” + +Increased use of conferencing apps may affect their availability for reasons other than network capacity. For example,  according to Thousand Eyes, users around the globe were unable to connect to their Zoom meetings for approximately 20 minutes on Friday due to failed DNS resolution.  + +Others too are monitoring data traffic looking for warning signs of slowdowns.  “Traffic towards video conferencing, streaming services and news, e-commerce websites has surged. We've seen growth in traffic from residential broadband networks, and a slowing of traffic from businesses and universities," wrote Louis Poinsignon a network engineer with CloudFlare in a [blog][7] about Internet traffic patterns. He noted that on March 13 when the US announced a state of emergency, CloudFlare’s US data centers served 20% more traffic than usual. + +Poinsignon  noted that  [Internet Exchange Points][8], where Internet service providers and content providers can exchange data directly (rather than via a third party) have also seen spikes in traffic. For example, Amsterdam ([AMS-IX][9]), London ([LINX][10]) and Frankfurt ([DE-CIX][11]), a 10-20% increase was seen around March 9. + +“Even though from time to time individual services, such as a web site or an app, have outages, the core of the Internet is robust,” Poinsignon wrote.  “Traffic is shifting from corporate and university networks to residential broadband, but the Internet was designed for change.” + +In related news: + + * Netflix said it would reduce streaming quality in Europe for at least the next 30 days to prevent the internet collapsing under the strain of unprecedented usage due to the coronavirus pandemic. "We estimate that this will reduce Netflix traffic on European networks by around 25% while also ensuring a good quality service for our members," Netflix said. + * DISH announced that it is providing 20 MHz of AWS-4 (Band 66) and all of its 700 MHz spectrum to AT&T at no cost for 60 days. Last week, DISH began lending its complete 600 MHz portfolio of spectrum to T-Mobile. With these two agreements, DISH has activated most of its spectrum portfolio to enhance national wireless capacity as the nation confronts the COVID-19 crisis. + + + +Join the Network World communities on [Facebook][12] and [LinkedIn][13] to comment on topics that are top of mind. + +-------------------------------------------------------------------------------- + +via: https://www.networkworld.com/article/3533438/coronavirus-challenges-capacity-but-core-networks-are-holding-up.html + +作者:[Michael Cooney][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.networkworld.com/author/Michael-Cooney/ +[b]: https://github.com/lujun9972 +[1]: https://www.networkworld.com/article/3532440/coronavirus-challenges-remote-networking.html +[2]: https://www.networkworld.com/newsletters/signup.html +[3]: https://www.verizon.com/about/news/how-americans-are-spending-their-time-temporary-new-normal +[4]: https://www.networkworld.com/blog/itaas-and-the-corporate-storage-technology/?utm_source=IDG&utm_medium=promotions&utm_campaign=HPE22140&utm_content=sidebar (ITAAS and Corporate Storage Strategy) +[5]: https://www.spearline.com/ +[6]: http://openvault.com/covid-19-impact-driving-business-hours-broadband-consumption-up-41/ +[7]: https://blog.cloudflare.com/on-the-shoulders-of-giants-recent-changes-in-internet-traffic/ +[8]: https://en.wikipedia.org/wiki/Internet_exchange_point +[9]: https://www.ams-ix.net/ams/documentation/total-stats +[10]: https://portal.linx.net/stats/lans +[11]: https://www.de-cix.net/en/locations/germany/frankfurt/statistics +[12]: https://www.facebook.com/NetworkWorld/ +[13]: https://www.linkedin.com/company/network-world diff --git a/sources/talk/20200324 COVID-19- Weekly health check of ISPs, cloud providers and conferencing services.md b/sources/talk/20200324 COVID-19- Weekly health check of ISPs, cloud providers and conferencing services.md new file mode 100644 index 0000000000..a5540c4ce2 --- /dev/null +++ b/sources/talk/20200324 COVID-19- Weekly health check of ISPs, cloud providers and conferencing services.md @@ -0,0 +1,96 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (COVID-19: Weekly health check of ISPs, cloud providers and conferencing services) +[#]: via: (https://www.networkworld.com/article/3534130/covid-19-weekly-health-check-of-isps-cloud-providers-and-conferencing-services.html) +[#]: author: (Tim Greene https://www.networkworld.com/author/Tim-Greene/) + +COVID-19: Weekly health check of ISPs, cloud providers and conferencing services +====== +ThousandEyes, which tracks internet and cloud traffic, is providing Network World with weekly updates on the performance of three categories of service provider: ISP, cloud provider, UCaaS +[ThousandEyes][1] + +_As COVID-19 continues to spread, forcing employees to work from home, the services of ISPs, cloud providers and conferencing services a.k.a. unified communications as a service (UCaaS) providers are experiencing increased traffic._ + +_Thousand Eyes is monitoring how these increases affect outages and the performance these providers undergo. It will provide Network World a roundup of interesting events of  the week in the delivery of these services, and Network World will provide a summary here. Stop back next week for another update._ + +With the increased use of remote-access VPNs, major carriers are reporting dramatic increases in their network traffic – with Verizon reporting a 20% week-over-week increase, and Vodafone reporting an increase of 50%. + +[Read about IPv6 and cloud-access security brokers][2] + +While there has been no corresponding spike in outages in service provider networks, over the past six weeks there has been a steady increase in outages across multiple provider types both worldwide and in the U.S., all according to ThousandEyes, which keeps track of internet and cloud traffic. + +### IDG Special Report: + +Navigating the Pandemic + + * [Business continuity: Coronavirus crisis puts CIOs’ plans to the test][3] + * [Coronavirus challenges remote networking][4] + * [A security guide for pandemic planning: 7 key steps][5] + * [10 tips to set up your home office for videoconferencing][6] + * [How to survive and thrive while working from home][7] + * [WTH? OSS knows how to WFH IRL][8] + + + +This includes “a concerning upward trajectory” since the beginning of March of ISP outages worldwide that coincides with the spread of COVID-19, [according to a ThousandEyes blog][9] by Angelique Medina, the company’s director of product marketing. ISP outages worldwide hovered around 150 per week between Feb. 10 and March 19, but then increased to between just under 200 and about 225 during the following three weeks. + +In the U.S. those numbers were a little over 50 in the first time range and reaching about 100 during the first week of March. “That early March level has been mostly sustained over the last couple of weeks,” Medina writes. + +Cogent Communications was one ISP with nearly identical large scale outages on March 11 and March 18, with “disruptions for the fairly lengthy period (by Internet standards) of 30 minutes,” she wrote. + +[][10] + +Hurricane Electric suffered an outage March 20 that was less extensive and shorter than Cogent’s but included smaller disruptions that altogether affected hundreds of sites and services, she wrote. + +Public-cloud provider networks have withstood the effects of COVID-19 well, with slight increases in the number of outages in the U.S., but otherwise relatively level around the world. The possible reason: “Major public cloud providers, such as AWS, Microsoft Azure, and Google Cloud, have built massive global networks that are incredibly well-equipped to handle traffic surges,” Medina wrote. And when these networks do have major outages it’s due to routing or infrastructure state changes, not traffic congestion. + +Some providers of collaboration applications – the likes of Zoom, Webex, MSFT Teams, RingCentral – also experienced performance problems between March 9 and March 20. ThousandEyes doesn’t name them, but does list performance numbers for what it describes “the top three” UCaaS providers. One actually showed improvements in availability, latency, packet loss and jitter. The other two “showed minimal (in the grand scheme of things) degradations on all fronts — not surprising given the unprecedented strain they’ve been under,” according to the blog. + +Each provider showed spikes in traffic loss over the time period that ranged from less than 1% to more than 4% in one case. In the case of one provider, “outages within its own network spiked last week, meaning that the network issues impacting users were taking place on infrastructure managed by the provider versus an external ISP.” + +“Outage incidents within large UCaaS provider networks are fairly infrequent; however, the recent massive surge in usage is clearly stressing current design limits. Capacity is reportedly being added across the board to meet new service demands,” according to the blog. + +Meanwhile, ThousandEyes has introduced a new feature on its site a [Global Internet Outages Map][1] that is updated every few minutes. It shows recent and ongoing outages + +## Google outage unrelated to COVID-19 + +On March 26 Google suffered a 20 minute outage on the East Coast of the U.S., apparently from a router failure in Atlanta, ThousandEyes said, agreeing with a statement put out by Googe to that effect. + +That problem affected other regions of the U.S. as evidenced by Google sites such as google.com intermittently returning server errors."These 500 server errors are consistent with an inability to reach the backend systems necessary to correctly load various services," ThousandEyes said in a statement. "Any traffic traversing the affected region — connecting from Google’s front-end servers to backend services — may have been impacted and seen the resulting server errors." + +ThousandEyes posted interactive results of tests it ran about the outage [here][11] and [here][12]. + +. + +Join the Network World communities on [Facebook][13] and [LinkedIn][14] to comment on topics that are top of mind. + +-------------------------------------------------------------------------------- + +via: https://www.networkworld.com/article/3534130/covid-19-weekly-health-check-of-isps-cloud-providers-and-conferencing-services.html + +作者:[Tim Greene][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.networkworld.com/author/Tim-Greene/ +[b]: https://github.com/lujun9972 +[1]: https://www.thousandeyes.com/outages +[2]: https://www.networkworld.com/article/3391380/does-your-cloud-access-security-broker-support-ipv6-it-should.html +[3]: https://www.cio.com/article/3532899/business-continuity-coronavirus-crisis-puts-cios-plans-to-the-test.html +[4]: https://www.networkworld.com/article/3532440/coronavirus-challenges-remote-networking.html +[5]: https://www.csoonline.com/article/3528878/a-security-guide-for-pandemic-planning-7-key-steps.html +[6]: https://www.computerworld.com/article/3250684/10-tips-to-set-up-your-home-office-for-videoconferencing.html +[7]: https://www.computerworld.com/article/3532283/how-to-survive-and-thrive-while-working-from-home.html +[8]: https://www.infoworld.com/article/3533050/wth-oss-knows-how-to-wfh-irl.html +[9]: https://blog.thousandeyes.com/internet-health-during-covid-19/ +[10]: https://www.networkworld.com/blog/itaas-and-the-corporate-storage-technology/?utm_source=IDG&utm_medium=promotions&utm_campaign=HPE22140&utm_content=sidebar (ITAAS and Corporate Storage Strategy) +[11]: https://agisi.share.thousandeyes.com/view/endpoint-agent/?roundId=1585237800&metric=loss&scenarioId=eyebrowNetwork&filters=%7B%22filters%22:%7B%22domain%22:%5B%22google.com%22%5D,%22geonameId%22:%5B4148757,4180439,4459467,4460243,4509177,4671240,4744709,4744870,4887398,4890864,4930956,5099836,5110266,5110302,5128581,5145476,5150529,5282804,5786882%5D%7D%7D&page=0,0&grouping=BY_NETWORK,BY_DOMAIN +[12]: https://ythkurgdz.share.thousandeyes.com/view/tests/?roundId=1585236900&metric=availability&scenarioId=httpServer&testId=1283781 +[13]: https://www.facebook.com/NetworkWorld/ +[14]: https://www.linkedin.com/company/network-world diff --git a/sources/talk/20200325 COVID-19 vs. Raspberry Pi- Researchers bring IoT technology to disease detection.md b/sources/talk/20200325 COVID-19 vs. Raspberry Pi- Researchers bring IoT technology to disease detection.md new file mode 100644 index 0000000000..cdcf720c0b --- /dev/null +++ b/sources/talk/20200325 COVID-19 vs. Raspberry Pi- Researchers bring IoT technology to disease detection.md @@ -0,0 +1,55 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (COVID-19 vs. Raspberry Pi: Researchers bring IoT technology to disease detection) +[#]: via: (https://www.networkworld.com/article/3534101/covid-19-vs-raspberry-pi-researchers-bring-iot-technology-to-disease-detection.html) +[#]: author: (Jon Gold https://www.networkworld.com/author/Jon-Gold/) + +COVID-19 vs. Raspberry Pi: Researchers bring IoT technology to disease detection +====== +Researchers from UMass say that a Raspberry Pi edge device can help identify flu-like symptoms in crowds, broadening the range of tools that can be used to track the spread of disease. +[Bill Oxford / Raspberry Pi / Modified by IDG Comm.][1] [(CC0)][2] + +An [IoT][3] device that tracks coughing and crowd size in real time could become a useful tool for identifying the presence of flu-like symptoms among large groups of people, according to a team of researchers at UMass Amherst. + +FluSense, as the researchers call it, is about the size of a dictionary. It contains a cheap microphone array, a thermal sensor, a Raspberry Pi and an Intel Movidius 2 neural computing engine. The idea is to use AI at the edge to classify audio samples and identify the number of people in a room at any given time. + +[[Get regularly scheduled insights by signing up for Network World newsletters.]][4] + +Since the system can distinguish coughing from other types of non-speech audio, correlating coughing with the size of a given crowd could give a useful index of how many people are likely to be experiencing flu-like symptoms. + +A test run between December 2018 and July 2019 saw FluSense installed in four waiting rooms at UMass’ University Health Services clinic, and the researchers said that they were able to “strongly” correlate the system’s results with clinical testing for influenza and other illnesses with similar symptoms. + +And bigger plans for FluSense are afoot, according to the paper’s lead author, Ph.D student Forsad Al Hossain and his co-author and adviser, assistant professor Tauhidur Rahman. + +“[C]urrently we are planning to deploy the FluSense system in several large public spaces (e.g., large cafeteria, classroom, dormitories, gymnasium, auditorium) to capture syndromic signals from a broad range of people who live in a certain town or city,” they said. “We are also looking for funding to run a large-scale multi-city trial. In the meantime, we are also diversifying our sensing capability by extending FluSense’s capability to capture more syndromic signals (e.g., recently we added sneeze sensing capability to FluSense). We definitely see a significant level of commercialization potential in this line of research.” + +FluSense is particularly interesting from a technical perspective because all of the meaningful processing work is done locally, via the Intel neural computing engine and Raspberry Pi. Symptom information is sent wirelessly to the lab for collation, of course, but the heavy lifting is accomplished at the edge. Al Hossain and Rahman were quick to emphasize that the device doesn’t collect personally identifiable information – the emphasis is on aggregating data in a given setting, rather than identifying sickness in any single patient – and everything it does collect is heavily encrypted, making it a minimal privacy concern. + +The key point of FluSense, according to the researchers, is to think of it as a health surveillance tool, rather than a piece of diagnostic equipment. Al Hossain and Rahman said that it has several important advantages over other health surveillance techniques, particularly those based on Internet tracking, like Google Flu Trend and Twitter. + +“FluSense is not easily influenced by public health campaigns or advertisements. Also, the contactless nature of this sensor is ideal to capture syndromic signals passively from different geographical locations and different socioeconomic groups (including underprivileged who may not have access to healthcare and may not go to a doctor/clinic,” they said. + +Join the Network World communities on [Facebook][5] and [LinkedIn][6] to comment on topics that are top of mind. + +-------------------------------------------------------------------------------- + +via: https://www.networkworld.com/article/3534101/covid-19-vs-raspberry-pi-researchers-bring-iot-technology-to-disease-detection.html + +作者:[Jon Gold][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.networkworld.com/author/Jon-Gold/ +[b]: https://github.com/lujun9972 +[1]: https://unsplash.com/photos/tR0PPLuN6Pw +[2]: https://creativecommons.org/publicdomain/zero/1.0/ +[3]: https://www.networkworld.com/article/3207535/what-is-iot-the-internet-of-things-explained.html +[4]: https://www.networkworld.com/newsletters/signup.html +[5]: https://www.facebook.com/NetworkWorld/ +[6]: https://www.linkedin.com/company/network-world diff --git a/sources/talk/20200325 The coming together of SD-WAN and AIOps.md b/sources/talk/20200325 The coming together of SD-WAN and AIOps.md new file mode 100644 index 0000000000..690a27686d --- /dev/null +++ b/sources/talk/20200325 The coming together of SD-WAN and AIOps.md @@ -0,0 +1,104 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (The coming together of SD-WAN and AIOps) +[#]: via: (https://www.networkworld.com/article/3533437/the-coming-together-of-aiops-and-sd-wan.html) +[#]: author: (Zeus Kerravala https://www.networkworld.com/author/Zeus-Kerravala/) + +The coming together of SD-WAN and AIOps +====== +SD-WAN delivers cost and resiliency benefits. Infusing AI into SD-WAN takes things further, enabling automated operations and business agility. +kohb / Getty Images + +Software-defined wide-area networking ([SD-WAN][1]) and AIOps are both red-hot technologies. SD-WANs increase application availability, reduce costs and in some cases improve performance. AIOps infuses machine learning into IT operations to increase the level of automation. This reduces errors and enables businesses to make changes at digital speeds. Most think of these as separate technologies, but the two are on a collision course and will give rise to what I'm calling the AI-WAN.  + +### SD-WAN not a panacea for all network woes + +SD-WAN is the biggest leap forward in networking since… well, the actual WAN. But many solutions still rely on manual configurations. SD-WANs certainly increase application resiliency, lower telecommunications costs, and often increase application performance, but they are more complicated than traditional WANs. Initial setup can be a challenge, but the bigger issue is ongoing operations. Manually tweaking and tuning the network to adapt to business changes can be time consuming and error-prone. A solution is needed to bring better automation to SD-WANs. + +**READ MORE:** [How AI can improve network capacity planning][2] + +Enter AI-WAN. Much like a self-driving car, an AI-WAN can make decisions based on different rules and adapt to changes faster than people can. Self-driving cars continually monitor road conditions, speed limits and other factors to determine what changes to make. Similarly, a self-driving network can monitor, correct, defend, and analyze with minimal to no human involvement. This is done through automation capabilities powered by AI, obviating the need for people to get involved. + +Make no mistake, manual operations will hold businesses back from reaching their full potential. An interesting data point from my research is that it takes enterprises an average of four months to make changes across a network. That's because maintaining legacy networks and fixing glitches takes too much time. One ZK Research study found 30% of engineers spend at least one day a week doing nothing but troubleshooting problems. SD-WANs can improve these metrics, but there's still a heavy people burden. + +With growing data challenges businesses face as they migrate to the cloud, they simply can't afford to wait that long. Instead of being afraid of AI taking over jobs, businesses should embrace it. AI can remove human error—which is the largest cause of unplanned network downtime—and help businesses focus on higher-level tasks instead. + +### AI-WAN will transform network operations + +So how will the evolution of SD-WAN into AI-WAN transform network management and operations? Administrators can use their time to focus on strategic initiatives instead of fixing problems. Another data point from ZK Research is that 90% of the time taken to fix a problem is spent identifying the source. Now that applications reside in the cloud and run on mobile devices, identifying the source of a problem has gotten harder. AI-WANs have the ability to spot even the smallest anomaly, even if it hasn't yet begun to impact business. + +SD-WANs are fundamentally designed so that all routing rules are managed centrally by administrators and can be transmitted across a network. AI-WAN takes it a step further and enables administrators to anticipate problems before they happen through fault prediction. It may even adjust network glitches on its own before users are affected, thus improving network performance. + +[][3] + +A self-driving car knows the rules of the road—where the blind spots are, how to synch with traffic signals, and which safety measures to take—using AI software, real-time data from IoT sensors, cameras, and much more. Similarly, a self-driving network knows the higher-level rules and can prevent administrators from making mistakes, such as allowing applications in countries where certain actions are banned.  + +Security is another concern. Everything from mobile devices to Internet of Things (IoT) to cloud computing is creating multiple new entry points and shifting resources to the network edge. This puts businesses at a security risk, as they struggle to respond to changes quickly. + +Businesses can miss security gaps created by users, with hundreds of software-as-a-service (SaaS) apps being used at the same time without IT's knowledge. Older networking technologies cannot support SaaS and cloud services, while SD-WANs can. But simply deploying an SD-WAN is not enough to protect a network. Security shouldn't be an afterthought in an SD-WAN deployment, but part of it from the get-go. + +Increasingly, vendors are bundling AI-based analytics with SD-WAN solutions to boost network security. Such solutions use AI to analyze how certain events impact the network, application performance, and security. Then, they create intelligent recommendations for any network changes, such as unauthorized use of SaaS apps. + +Going back to the autonomous car analogy, AI-WANs are designed to keep roads clear and accident-free. They enable smarter networks that can adapt quickly to changing conditions and self-heal if necessary. With the growing demands of cloud computing and SaaS apps, intelligent networks are the future and forward-thinking businesses are already in the driver’s seat. + +### AI-WAN exists today and will explode in the future + +AI-WAN may seem futuristic, but there are a number of vendors that are delivering it or in the process of bringing solutions to market. Managed service provider Masergy, for example, recently introduced [AIOps for SD-WAN][4] to deliver autonomous networking and has the most complete offering. + +Open System, another managed service provider, [snapped up cloud-based Sqooba][5] to add AIOps to its strong network and security services. Keeping with the M&A theme, VMware recently [acquired AIOps vendor Nyansa][6] and rolled it into its VeloCloud SD-WAN group. That move gives VMware similar capabilities to [Aruba Networks][7], which initially applied AI to WiFi troubleshooting but is now bringing it to its SD-Branch offering. [Cisco][8] is another networking vendor with an AIOps story, although it's trying to apply it network-wide, not just with the WAN.  + +Over time, I expect every SD-WAN or SASE vendor to bring AIOps into the fold, shifting the focus away from connectivity to automated operations. + +**Learn more about SD-WAN** + + * [Top 10 underused SD-WAN features][9] + * [SD-WAN: The inside scoop from real-world deployments][10] + * [5 reasons to choose a managed SD-WAN and 5 reasons to think twice][11] + * [10 essential SD-WAN considerations][12] + * [SD-WAN: What is it and why you’ll use it one day][13] + * [SD-WAN deployment options: DIY vs. cloud managed][14] + * [How SD-WAN can improve your security strategy][15] + * [10 hot SD-WAN startups to watch][16] + * [How SD-WAN saves $1.2M over 5 years for a radiology firm][17] + * [SD-WAN creates new security challenges][18] + + + +Join the Network World communities on [Facebook][19] and [LinkedIn][20] to comment on topics that are top of mind. + +-------------------------------------------------------------------------------- + +via: https://www.networkworld.com/article/3533437/the-coming-together-of-aiops-and-sd-wan.html + +作者:[Zeus Kerravala][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.networkworld.com/author/Zeus-Kerravala/ +[b]: https://github.com/lujun9972 +[1]: https://www.networkworld.com/article/3031279/sd-wan-what-it-is-and-why-you-ll-use-it-one-day.html +[2]: https://www.networkworld.com/article/3338100/using-ai-to-improve-network-capacity-planning-what-you-need-to-know.html +[3]: https://www.networkworld.com/blog/itaas-and-the-corporate-storage-technology/?utm_source=IDG&utm_medium=promotions&utm_campaign=HPE22140&utm_content=sidebar (ITAAS and Corporate Storage Strategy) +[4]: https://techcrunch.com/2020/03/19/nvidia-makes-its-gpu-powered-genome-sequencing-tool-available-free-to-those-studying-covid-19/?guccounter=1&guce_referrer=aHR0cHM6Ly93d3cuZ29vZ2xlLmNvbS8&guce_referrer_sig=AQAAAMI6we4H-fTz2mf5g-l6IP27C1O-V-u6EiQuJ5QzVnlrrPU04iS0fhyrZo5U8q5rAk5I9uVW5PQYKHX8ziMdWrFBxhBP7f__JshmAGevyu4Z5zm98nDnC6nEdIekjVX4RPPmF9Q_PImcQ0opZy6JukS-DZA62tHI9R7D1Q2JAog7 +[5]: https://open-systems.com/press-release/open-systems-acquires-sqooba +[6]: https://www.vmware.com/company/acquisitions/nyansa.html +[7]: https://blogs.arubanetworks.com/solutions/ai-doing-more-with-less-in-2020-and-beyond/ +[8]: https://www.cisco.com/c/en/us/products/cloud-systems-management/crosswork-network-automation/service-centric-approach-to-aiops.html#~overview +[9]: https://www.networkworld.com/article/3518992/top-10-underused-sd-wan-features.html +[10]: https://www.networkworld.com/article/3316568/sd-wan/sd-wan-the-inside-scoop-from-real-world-deployments.html +[11]: https://www.networkworld.com/article/3431080/5-reasons-to-choose-a-managed-sd-wan-and-5-reasons-to-think-twice.html +[12]: https://www.networkworld.com/article/3355138/sd-wan-10-essential-considerations.html +[13]: https://www.networkworld.com/article/3031279/sd-wan/sd-wan-what-it-is-and-why-you-ll-use-it-one-day.html +[14]: https://www.networkworld.com/article/3243701/wide-area-networking/sd-wan-deployment-options-diy-vs-cloud-managed.html +[15]: https://www.networkworld.com/article/3336483/how-sd-wan-can-improve-your-security-strategy.html +[16]: https://www.networkworld.com/article/3284367/sd-wan/10-hot-sd-wan-startups-to-watch.html +[17]: https://www.networkworld.com/article/3255291/lan-wan/sd-wan-helps-radiology-firm-cut-costs-scale-bandwidth.html +[18]: https://www.networkworld.com/article/3336155/sd-wan-creates-new-security-challenges.html +[19]: https://www.facebook.com/NetworkWorld/ +[20]: https://www.linkedin.com/company/network-world diff --git a/sources/talk/20200326 ROLLING UPDATE- The impact of COVID-19 on public networks and security.md b/sources/talk/20200326 ROLLING UPDATE- The impact of COVID-19 on public networks and security.md new file mode 100644 index 0000000000..7f8c0a2cd8 --- /dev/null +++ b/sources/talk/20200326 ROLLING UPDATE- The impact of COVID-19 on public networks and security.md @@ -0,0 +1,119 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (ROLLING UPDATE: The impact of COVID-19 on public networks and security) +[#]: via: (https://www.networkworld.com/article/3534037/rolling-update-the-impact-of-covid-19-on-public-networks-and-security.html) +[#]: author: (Michael Cooney https://www.networkworld.com/author/Michael-Cooney/) + +ROLLING UPDATE: The impact of COVID-19 on public networks and security +====== +Network World updates the latest coronavirus-related networking news +Ig0rZh / Getty Images + +_As the coronavirus spreads, public and private companies as well as government entities are requiring employees to work from home, putting unforeseen strain on all manner of networking technologies and causing bandwidth and security concerns.  What follows is a round-up of news and traffic updates that Network World will update as needed to help keep up with the ever-changing situation.  Check back frequently!_ + +**UPDATE 3.27** + +Broadband watchers at [BroadbandNow][1] say users in most of the cities it analyzed are experiencing normal network conditions, suggesting that ISP’s (and their networks) are holding up to the shifting demand. In a March 25 [post][2] the firm wrote: “Encouragingly, many of the areas hit hardest by the spread of the coronavirus are holding up to increased network demand. Cities like Los Angeles, Chicago, Brooklyn, and San Francisco have all experienced little or no disruption. New York City,  now the epicenter of the virus in the U.S., has seen a 24% dip out of its previous ten-week range. However, with a new median speed of nearly 52 Mbps, home connections still appear to be holding up overall.” + +**[ Also see [What to consider when deploying a next generation firewall][3]. | Get regularly scheduled insights by [signing up for Network World newsletters][4]. ]** + +Other BroadbandNow findings included: + + * Eighty eight (44%) of the 200 cities it analyzed experienced some degree of network degradation over the past week compared to the 10 weeks prior. However, only 27 (13.5%) cities experienced dips of 20% below range or greater. + * Seattle download speeds have continued to hold up over the past week, while New York City’s speeds have fallen out of range by 24%. Both cities are currently heavily affected by the coronavirus pandemic. + * Three cities – Austin, Texas, Winston Salem, N.C., and Oxnard, Calif. – have experienced significant degradations, falling out of their 10-week range by more than 40%. + + + +Cisco’s Talos threat-intelligence arm [wrote][5] on March 26 about the COVID security threat noting what it called three broad categories of attacks leveraging COVID with known advanced persistent threat participation in: [Malware and phishing campaigns][6] using COVID-themed lures; attacks against organizations that carry out research and other work related to COVID; and fraud and disinformation. From an enterprise security perspective, Talos recommended: + + * Remote access: Do not expose Remote Desktop Protocol (RDP) to the internet. Use secure VPN connections with multi-factor authentication schemes. Network access control packages can be used to ensure that systems attempting to remotely connect to the corporate environment meet a minimum set of security standards such as anti-malware protection, patch levels, etc,. prior to granting them access to corporate resources. Continually identify and remediate access-policy violations. + * Identity Management: Protect critical and public-facing applications with multi-factor authentication and supporting corporate policies. Verify that remote-account and access-termination capabilities work as intended in a remote environment. + * Endpoint Control: Because many people may be working from home networks, endpoint visibility, protection, and mitigation is now more important than ever. Consider whether remediation and reimaging capabilities will work as intended in a remote environment. Encrypt devices where possible, and add this check to your NAC solution as a gate for connectivity. Another simple method of protecting endpoints is via DNS, such as with [Cisco’s] Umbrella, by blocking the resolution of malicious domains before the host has a chance to make a connection. + + + +In an [FAQ][7] about the impact of COVID-19 on fulfilling customer hardware orders, VMware stated: “Some VMware SD-WAN hardware appliances are on backorder as a result of supply chain issues. As a result, we are extending the option to update existing orders with different appliances where inventory is more readily available. Customers may contact a special email hotline with questions related to backordered appliances. Please send an email to [sd-wan-hotline@vmware.com][8] with your questions and include the order number, urgent quantities, and contact information. We will do our best to respond within 48 hours.” + +Cisco said it has been analyzing traffic statistics with major carriers across Asia, Europe, and the Americas, and its data shows that typically, the most congested point in the network occurs at inter-provider peering points, Jonathan Davidson, senior vice president and general manager of Cisco's Mass-Scale Infrastructure Group wrote in a [blog][9] on March 26. “However, the traffic exchanged at these bottlenecks is only a part of the total internet traffic, meaning reports on traffic may be higher overall as private peering and local destinations also contribute to more traffic growth.” + +[][10] + +“Our analysis at these locations shows an increase in traffic of 10% to 33% over normal levels. In every country, traffic spiked with the decision to shut down non-essential businesses and keep people at home. Since then, traffic has remained stable or has experienced a slight uptick over the days that followed,” Davidson stated. + +He said that traffic during peak hours from 6 p.m. and 10 p.m. has increased slightly, but is not the primary driver for the overall inrease. Busy hours have extended to 9 a.m. 10 p.m., although the new busy-hour (9 a.m. to 6 p.m.) traffic is still below the traditional peak hours. "Service providers are certainly paying attention to these changes, but they are not yet a dire concern, as most networks are designed for growth. Current capacities are utilized more over the course of the entire day,” he wrote. + +Spanish multinational telecommunications company [Telefonica][11]’ said IP networks are experiencing traffic increases of close to 40% while mobile voice use is up about 50% and data is up 25%. In general, traffic through IP networks has experienced increases of nearly 40% while mobile use has increased by about 50% for voice and 25% for data. Likewise, traffic from instant-messaging tools such as Whatsapp has increased fivefold in recent days. + +**UPDATE: 3.26** + + * Week over week (ending March 23) [Ookla][12] says it has started to see a degradation of mobile and fixed-broadband performance worldwide. More detail on specific locations is available below. Comparing the week of March 16 to the week of March 9, mean download speed over mobile and fixed broadband decreased in Canada and the U.S. while both remained relatively flat in Mexico. + * What is the impact of the coronavirus on corporate network planning? Depends on how long the work-from-home mandate goes on really. Tom Nolle, president of CIMI Corp. [takes an interesting look at the situation][13] saying the shutdown “could eventually produce a major uptick for SD-WAN services, particularly in [managed service provider]    Businesses would be much more likely to embark on an SD-WAN VPN adventure that didn’t involve purchase/licensing, favoring a service approach in general, and in particular one with a fairly short contract period.” + * Statistics from VPN provider [NordVPN][14] show the growth of VPN usage across the globe.  For example, the company said the US has experienced a 65.93% growth in the use of business VPNs since March 11. It reported that mass remote working has contributed towards a rise in desktop (94.09%) and mobile app (0.39%) usage among Americans. Globally, NordVPN teams has seen a 165% spike in the use of business VPNs and business VPN usage in Netherlands (240.49%), Canada (206.29%) and Austria (207.86%) has skyrocketed beyond 200%. Italy has had the most modest growth in business VPN usage at just 10.57%. + + + +**UPDATE: 3. 25**: + + * According to [Atlas VPN][15] user data, VPN usage in the US increased by 124% during the last two weeks. VPN usage in the country increased by 71% between March 16 and 22 alone. Atlas said it measured how much traffic traveled through its servers during that period compared to March 9 to 15. The data came from the company's 53,000 weekly users. + * Verizon [reports][16] that voice usage, long declining in the age of texting, chat and social media, is up 25% in the last week. The network report shows the primary driver is accessing conference calls. In addition, people are talking longer on mobile devices with wireless voice usage notching a 10% increase and calls lasting 15% longer.  + * AT&T also [reported][17] increased calling, especially Wi-Fi calling, up 88% on March 22 versus a normal Sunday. It says that consumer home voice calls were up 74% more than an average Sunday; traffic from Netflix dipped after all-time highs on Friday and Saturday; and data traffic due to heavy video streaming between its network and peered networks tied record highs. AT&T said it has deployed portable cell nodes to bolster coverage supporting FirstNet customers in Indiana, Connecticut, New Jersey, California and New York. + * Microsoft this week advised users of Office 365 it was throttling back some services: + * **OneNote: ** OneNote in Teams will be read-only for commercial tenants, excluding EDU. Users can go to OneNote for the web for editing. Download size and sync frequency of file attachments has been changed. You can find details on these and other OneNote related updates as . + * **SharePoint:** We are rescheduling specific backend operations to regional evening and weekend business hours. Impacted capabilities include migration, DLP and delays in file management after uploading a new file, video or image. Reduced video resolution for playback videos. + * **Stream:** People timeline has been disabled for newly uploaded videos. Pre-existing videos will not be impacted. Meeting recording video resolution adjusted to 720p. + + + +**RELATED COVID-19 NEWS:** + + * Security vendor [Check Point’s Threat Intelligence][18] says that Since January 2020, there have been over 4,000 coronavirus-related domains registered globally. Out of these websites, 3% were found to be malicious and an additional 5% are suspicious. Coronavirus- related domains are 50% more likely to be malicious than other domains registered at the same period, and also higher than recent seasonal themes such as Valentine’s day. + * [Orange][19] an IT and communications **services** company aid that has increased its network capacity and upgraded its service platforms. These measures allow it to support the ongoing exponential increase in needs and uses. The number of users connecting to their company's network remotely has already increased by 700% among its customers. It has also doubled the capacity for simultaneous connections on its platforms. The use of remote collaboration solutions such as video conferencing has also risen massively with usage increasing by between 20% to 100%. + * Verizon said it has seen a 34% increase in VPN traffic from March 10 to 17. It has also seen a 75% increase in gaming traffic and web traffic increased by just under 20% in that time period according to Verizon. + * One week after the CDC declaration of the virus as a pandemic, data analytics and broadband vendor OpenVault wrote on March 19 that: + * Subscribers’ average usage during the 9 am-to-5 pm daypart has risen to 6.3 GB, 41.4% higher than the January figure of 4.4 GB.  + * During the same period, peak hours (6 pm–11 pm) usage has risen 17.2% from 5.0 GB per subscriber in January to 5.87 GB in March.  + * Overall daily usage has grown from 12.19 GB to 15.46 GB, an increase of 26.8%. + * Based on the current rate of growth, OpenVault projected that consumption for March will reach nearly 400 GB per subscriber, an increase of almost 11% over the previous monthly record of 361 GB, established in January of this year. In addition, OpenVault projects a new coronavirus-influenced run rate of 460 GB per subscriber per month going forward. + + + +Join the Network World communities on [Facebook][20] and [LinkedIn][21] to comment on topics that are top of mind. + +-------------------------------------------------------------------------------- + +via: https://www.networkworld.com/article/3534037/rolling-update-the-impact-of-covid-19-on-public-networks-and-security.html + +作者:[Michael Cooney][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.networkworld.com/author/Michael-Cooney/ +[b]: https://github.com/lujun9972 +[1]: https://broadbandnow.com/ +[2]: https://broadbandnow.com/report/internet-speed-analysis-march-15th-21st/ +[3]: https://www.networkworld.com/article/3236448/lan-wan/what-to-consider-when-deploying-a-next-generation-firewall.html +[4]: https://www.networkworld.com/newsletters/signup.html +[5]: https://blog.talosintelligence.com/2020/03/covid-19-pandemic-threats.html +[6]: https://blog.talosintelligence.com/2020/02/coronavirus-themed-malware.html +[7]: https://www.vmware.com/company/news/updates/vmware-response-covid-19.html?mid=31381&eid=CVMW2000048242496 +[8]: mailto:sd-wan-hotline@vmware.com +[9]: https://blogs.cisco.com/news/global-traffic-spikes-no-panic-at-the-cisco +[10]: https://www.networkworld.com/blog/itaas-and-the-corporate-storage-technology/?utm_source=IDG&utm_medium=promotions&utm_campaign=HPE22140&utm_content=sidebar (ITAAS and Corporate Storage Strategy) +[11]: https://www.telefonica.com/en/web/press-office/-/telefonica-announces-measures-related-to-covid-19 +[12]: https://downdetector.com/?utm_campaign=Ookla%20Insights%20Blog%20Subscription&utm_source=hs_email&utm_medium=email&utm_content=85202785&_hsenc=p2ANqtz--Nj93d_eQyJpsqxrPJyNPtTiMBWBQU984psLyalw51K61e4d1WODareMF5NWFriHY2Uzw3WF7rF-2vSfH5cR53Jg3K5Q&_hsmi=85202785 +[13]: https://blog.cimicorp.com/?p=4068 +[14]: https://nordvpnteams.com/ +[15]: https://atlasvpn.com/blog/lockdowns-and-panic-leads-to-a-124-surge-in-vpn-usage-in-the-us/ +[16]: https://www.verizon.com/about/news/update-verizon-serve-customers-covid-19 +[17]: https://about.att.com/pages/COVID-19.html +[18]: https://blog.checkpoint.com/2020/03/05/update-coronavirus-themed-domains-50-more-likely-to-be-malicious-than-other-domains/ +[19]: https://www.orange.com/en/Press-Room/press-releases/press-releases-2020/Orange-is-mobilised-to-ensure-continuity-of-service-for-all-customers-in-France-and-around-the-world +[20]: https://www.facebook.com/NetworkWorld/ +[21]: https://www.linkedin.com/company/network-world diff --git a/sources/talk/20200327 6 tricks for developing a work from home schedule.md b/sources/talk/20200327 6 tricks for developing a work from home schedule.md new file mode 100644 index 0000000000..9253f824fd --- /dev/null +++ b/sources/talk/20200327 6 tricks for developing a work from home schedule.md @@ -0,0 +1,108 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (6 tricks for developing a work from home schedule) +[#]: via: (https://opensource.com/article/20/3/work-from-home) +[#]: author: (Seth Kenlon https://opensource.com/users/seth) + +6 tricks for developing a work from home schedule +====== +Stay flexible, embrace change, and think of the transition to your home +office as an opportunity to create a healthier WFH experience. +![Working from home at a laptop][1] + +When you start working from home, one of the first things you might have noticed is that there almost no outside influences on your schedule. + +You probably have meetings—some over [team chat][2] and others over [video][3]— that you have to attend, but otherwise, there's nothing requiring you to do anything at any specific time. What you find out pretty quickly, though, is that there's an invisible influence that sneaks up on you: deadlines. + +This lack of structure fosters procrastination, sometimes willful and other times aimless, followed by frantic sprints to get something done. Learning to mitigate that, along with all the distractions working from home might offer, is often the hardest part of your home-based work. + +Here are a few ways to build in that structure for yourself do you don't end up feeling like you are falling behind. + +### You have always had your own schedule + +Everybody reacts to schedules differently. For some people, schedules offer guidance and comfort. For others, schedules are rigid and oppressive. + +An office space generally provides focus. There might be plenty of distractions at the office, but you usually find a good stretch of time at some point during your day when you can get a big chunk of work done. Even in an office, though, each person actually keeps their own schedule. Your colleague might arrive early in the day, happily completing a day's work in an empty office before anyone else arrives and then spending the rest of the day doing menial tasks and socializing. Another colleague might arrive late and leave early, maximizing time spent in the office for actual work. Still others follow a steady pace throughout the day. + +As you're settling into a WFH routine, take notes, either mentally or physically, on what seems to work well for you. If you like formalized systems, then build a schedule for yourself after a week or two, based on what you've been doing naturally. If there's something that isn't working for you, then drop it from your schedule. + +Once you've found a good rhythm for yourself, you can manage your day with a [to-do list][4] like [todo.txt][5], or if you prefer sledgehammers (or you actually manage a department), you can try a [project management][6] application. + +### Treat yourself as a new hire + +For the first week or two at home, you may find it helpful to treat yourself (and your remote team) as a new hire. Instead of trying to mimic or impose the same schedule you kept at the office or at school, take time to monitor your own activity. It takes time for your body and mind to establish new and comfortable habits, and if you're the kind of person who wanders into a routine, then you need to give yourself time to discover what those habits are. + +For instance, if you're consistently finding that you do your best work right after breakfast, then relegate menial tasks, like responding to email, reviewing tasks, or triaging bug reports, to the early morning, and make sure you have a big task set up for after breakfast. If you're having a hard time maintaining focus, then make time for morning tea so you can relax, reassess your workload, and plan your next step. Be curious about yourself like a manager would be for a brand new employee. Adjust accordingly. + +### There is no guilt to being interrupted at home + +Not everything on your schedule is under your control. If you have children too young for school, or if children are home from school, then their schedules take precedence. + +It's a perceived benefit of working from home that your schedule is more flexible than at an office, but with that assumption, there can sometimes come a little to a lot of guilt. You might feel you're not working "enough" because you have to stop to wake up and feed children, or because you want to take a few play breaks every now and again. + +That's mostly illusory, though, and here is how to think about it. If you swap out "children" for "manager," you might remember some times at the office where your "real" work was interrupted because you had to entertain upper management with sparkly presentations, or complete piles of paperwork for HR, or decompress by chatting with colleagues by the water cooler. + +Your work from home is really no different. There are plenty of distractions, and they're only a problem if you fail to acknowledge and work around them. + +### Making the choice to move beyond the 9-to-5 + +Unlike at the office, you're not forced into a rigid and dated 9-to-5 structure. If your day has to start at 7am, contains a lot of breaks, and doesn't end until 7pm, then that's alright. The essential part is to define that as your schedule for yourself (once you've established it as a schedule that works for you; remember to give yourself a few weeks to get a feel for what your schedule actually "wants" to be). Pick your start and end times, establish break times with your housemates, whether they're children, spouses, pets, or roommates/friends. Work when you're supposed to be working, and don't work when you're not scheduled to work. For most of us, colleagues don't need to know exactly when you are online as long as you're available when you're needed. In that case, your hours are your own. If the team is the kind that needs to know, run it by them. + +### Don't forget time for yourself + +It's important to at least establish times you stop thinking about work, no matter what. If you've got a very young child who's not given to staying on any schedule, then you might have to stay more flexible than most. Still, give yourself permission to actively be inactive. Do something you enjoy, even if it feels unproductive. It's normal to spend some idle time at the office to think or intentionally not think. Working from home deserves the same space. If anything, it's even more important as you establish working hours. The goal is to recognize when you're at home and when you're at work. + +Finding stuff to do at work is relatively easy, but sometimes finding things to do to relax can be hard. If you have children, you can collaborate with them using Scratch for [drawing beautiful art][7], [programming video games][8], or even [robotics][9]. For the times you're not necessarily looking to collaborate and need your little one to do some exploration of their own, there are some [great open source alternatives to Minecraft][10], too. If you're interested in getting away from the screen, though, you might try some [Arduino][11] or [Seeeduino][12] gardening projects. Start with some programming, and end up outside in the garden! + +### Choose to see change as exciting + +Some say humans don't generally love change and that we're primarily creatures of habit, so moving from an office into a home office can be upsetting. And yet, invariably, we've shown that change can be exciting and even good.  + +Use this thought experiment to remember how much you love change. Would you willingly revert to technology from even two years ago? How about five, or ten? + +If we can embrace change in technology and be uninterested in reverting back, why not embrace change elsewhere? + +When you work from home, you have the opportunity to be willing to explore change. If you find that a meeting time doesn't work for your schedule, mention it to your team. It may not work for them, either, and moving it to a different day could mean making room for a work sprint that knocks out a good chunk of your work for the week. If you find that a tool isn't working out for you, find a different one. + +In fact, some of the most productive people are constantly evaluating new applications and new methods of working. They're constantly learning new things, developing new skills. They don't do this because they need the new skill, at least not by the letter of their work contract, but learning new things often reveals a surprising applicability to something they do need. + +Need some examples? Tinkering with a Raspberry Pi for fun could result in a home server running [useful apps][13] to help you stay informed. [Learning][14] how to [write in Markdown][15] could introduce you to a new and more efficient workflow than you ever knew possible. Setting up a [computer with Linux][16] could reveal a new world of open source software that changes the way you approach problems, and improves the methods you use to solve them. The possibilities are limitless, but if you don't know where to start, you can browse through some of our articles or [cheat sheets][17] for ideas and tips. + +### Working from home is a new opportunity + +The habits we've built up around work aren't always healthy or efficient or fun. If you're starting to work from home, though, it's a chance to reinvent what work means for you. Keep the lines of [communication open][18] with your colleagues, embrace new ideas and the potential of change, and discover how you can be more productive by enjoying yourself and the place you call home (and **$HOME**). + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/3/work-from-home + +作者:[Seth Kenlon][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/seth +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/wfh_work_home_laptop_work.png?itok=VFwToeMy (Working from home at a laptop) +[2]: https://opensource.com/alternatives/slack +[3]: https://opensource.com/alternatives/skype +[4]: https://opensource.com/article/19/9/to-do-list-managers-linux +[5]: https://opensource.com/article/20/1/open-source-to-do-list +[6]: https://opensource.com/article/18/2/agile-project-management-tools +[7]: https://opensource.com/article/19/9/drawing-vectors-scratch-3 +[8]: https://opensource.com/article/18/4/designing-game-scratch-open-jam +[9]: https://opensource.com/education/13/8/student-programming-scratch-and-finch +[10]: https://opensource.com/alternatives/minecraft +[11]: https://opensource.com/article/17/3/arduino-garden-projects +[12]: https://opensource.com/article/19/12/seeeduino-nano-review +[13]: https://opensource.com/article/20/2/newsboat +[14]: https://opensource.com/article/19/9/introduction-markdown +[15]: https://opensource.com/article/18/11/markdown-editors +[16]: https://opensource.com/article/19/9/found-linux-video-gaming +[17]: https://opensource.com/article/20/1/cheat-sheets-guides +[18]: https://opensource.com/article/20/3/open-source-working-home diff --git a/sources/talk/20200330 Know the benefits of cloud-native networking for SASE.md b/sources/talk/20200330 Know the benefits of cloud-native networking for SASE.md new file mode 100644 index 0000000000..e4c38f352e --- /dev/null +++ b/sources/talk/20200330 Know the benefits of cloud-native networking for SASE.md @@ -0,0 +1,82 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Know the benefits of cloud-native networking for SASE) +[#]: via: (https://www.networkworld.com/article/3534720/know-the-benefits-of-cloud-native-networking-for-sase.html) +[#]: author: (Zeus Kerravala https://www.networkworld.com/author/Zeus-Kerravala/) + +Know the benefits of cloud-native networking for SASE +====== +Shlomo Kramer, CEO of Cato Networks discusses the benefits cloud-native networking brings to SASE +Metamorworks / Getty Images + +Gartner has positioned secure access service edge (SASE) as the next wave of SD-WANs. While most industry people I talk to agree on the concept of security and networking being brought together, there is some debate surrounding cloud-native versus cloud-managed. + +To get a better understanding of why cloud native matters, I sat down with Shlomo Kramer, CEO of Cato Networks, which designed its SASE service from the ground up for cloud delivery. + +**Last year Gartner coined the term SASE, do you agree or disagree with their premise?** + +[[Get regularly scheduled insights by signing up for Network World newsletters.]][1] + +Well I definitely agree.  The manifesto that Cato was founded on was the vision of converging network transport and network security and delivering it as a cloud service. The argument as to why you need SASE is topological in nature because traffic patterns have changed. Network traffic used to be inward bound because people sat at their desks, using corporate workstations and connecting to enterprise applications that resided in the company data centers. + +That meant security was effectively a hard shell placed around a soft core.  Security was applied at the edge and protected all the physical locations behind it. Today, the traffic patterns have changed, and the security needs to be applied everywhere.  Applications are built in AWS as well as on-premises, workers are in the office, at home and in the hotel or anywhere.  So now corporate assets are everywhere so the hard shell no longer works.  Security needs to be different and be integrated everywhere so I absolutely agree with the concept of SASE. + +**What are some other challenges with legacy technologies like MPLS and security appliances?** + +**T**he problems with MPLS are well documented, so I won’t spend too much time on this topic other than say every company we talk to wants to move off of MPLS because of high costs, long deployment times and a lack of agility.  MPLS does nothing for mobile users or cloud connectivity so organizations need to deploy VPN servers, cloud interconnects and other technologies to connect all of their company resources. + +[][2] + +On the security side, branch appliances have been an enormous problem that we as an industry accepted as the only possible solution.  Appliances need to be procured, deployed, maintained, upgraded and retired. All of which takes time and effort. They need to be integrated with one another, which requires more time and skills. Most appliances are managed from separate management consoles making operations complex and challenging.  Over time, more appliances are added, which raises the complexity level.  Also, when traffic jumps or too many features are turned on, upgrades are often required outside budget cycles.  Security professionals often lag behind when applying software patches because updating appliances is risky and needs to be carefully planned, leaving the company at risk. + +I can go on, but _appliances_ as an architecture involve too many headaches and too much cost for companies looking to become leaner and more agile. And by appliances, I also mean VNFs and virtual appliances. It's the same story again. You still need to deploy, manage and scale them. Appliances are a poor choice not because of anyone's solution's limitations but because of the architecture itself. + +**What benefit do cloud-native platforms provide?** + +For Gur (Co-Founder of Cato, Gur Shatz) and myself, who came from the security and networking worlds, we were well acquainted with these problems. As we thought about what the right architecture would be moving forward, the cloud seemed like the obvious choice. We had already seen how cloud computing changed markets for data centers, servers, storage, and applications. We thought the cloud could do the same for security and networking.  + +Like AWS for data centers and servers, we wanted to create a utility that would secure and network the complete enterprise, not just sites, but also remote users, cloud data centers, cloud applications, and third-party devices. We wanted enterprises to "tap" into this utility and instantly receive all the advanced security and networking services for the entire organization. It's why we called our SD-WAN device the "Cato Socket," like an electrical socket you plug into. This vision is in line with the SASE definition. + +Instead of appliances, we move the “heavy lifting” involved in security and networking into a global, distributed, cloud-native software platform. By cloud-native software, we mean several things.  We actually wrote a [blog on this topic][3] that talks about the value of cloud-native.  There are many benefits but in particular, multi-tenancy is game-changing. This allows cloud providers to amortize costs across their customer base, allowing them to deliver offerings at a price point unmatched by one based on purchasing appliances for customers.  + +This platform runs our single-pass, security and networking stack that performs all security inspections in parallel. A packet comes in, depacketized and decrypted by our software that then performs all the necessary security inspections in parallel before sending the packet on.  This is an incredible change from the way appliances work today. Today, each appliance must depacketize and decrypt packets, run a deep packet inspection (DPI) engine to understand the packet, apply the specific security inspections, and repacketize and re-encrypt for the next appliance to do the same.   + +**You’ve also stated that a global private network is necessary, why is that?** + +As for the network, enterprises require predictable, low latency performance everywhere all the time. That's simply not possible with Internet routing today when broadband is used. While the problems of unpredictable latency across global routes or in under-developed Internet regions is well known even within Internet regions, we've seen specific routes have problems.   + +How do you overcome latency AND the global connectivity costs of MPLS? Our answer was to leverage the massive build-out in global IP connectivity. By buying massive wholesale SLA-backed capacity across multiple IP backbones, and then dynamically selecting the best backbone at each hop across our network, we could deliver global, low-latency connections at a fraction of the cost of MPLS.    + +**The SASE industry is currently filled with start-ups and smaller vendors.  Why are the big incumbents struggling to make this shift?** + +** ** + +I think it should be evident by now, but existing appliance-based solutions simply can't be converted to become cloud-native. Re-engineering a platform for the cloud requires massive investments in R&D, which will come at the expense of existing and very successful product lines, so beyond engineering, there is also an internal conflict to overcome.    + +And that's why the "big incumbents," as you put it, are so threatened by SASE. We all recognize that SASE is the future, but to get that to that future, many of the established solution providers will need to disrupt their existing businesses. That's not easy to do, but what they can do is market.  + +We, as an industry, are seeing vendors trying to capitalize on SASE by rebranding their solutions as SASE offerings. Some are appliances without cloud capabilities; others are security services without networking capabilities. For IT to tell the difference between a true SASE platform and a "fake" one, the litmus test is simple: If the center of gravity is in the appliances. If the offer lacks SD-WAN and if there is more than one management console. It's not SASE, and it's not the future. It's a repackaging of the past.   + +Join the Network World communities on [Facebook][4] and [LinkedIn][5] to comment on topics that are top of mind. + +-------------------------------------------------------------------------------- + +via: https://www.networkworld.com/article/3534720/know-the-benefits-of-cloud-native-networking-for-sase.html + +作者:[Zeus Kerravala][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.networkworld.com/author/Zeus-Kerravala/ +[b]: https://github.com/lujun9972 +[1]: https://www.networkworld.com/newsletters/signup.html +[2]: https://www.networkworld.com/blog/itaas-and-the-corporate-storage-technology/?utm_source=IDG&utm_medium=promotions&utm_campaign=HPE22140&utm_content=sidebar (ITAAS and Corporate Storage Strategy) +[3]: https://www.catonetworks.com/blog/the-cloud-native-network-what-it-means-and-why-it-matters/ +[4]: https://www.facebook.com/NetworkWorld/ +[5]: https://www.linkedin.com/company/network-world diff --git a/sources/talk/20200330 SASE might be better than VPNs for quickly ramping up remote access.md b/sources/talk/20200330 SASE might be better than VPNs for quickly ramping up remote access.md new file mode 100644 index 0000000000..10f3abab83 --- /dev/null +++ b/sources/talk/20200330 SASE might be better than VPNs for quickly ramping up remote access.md @@ -0,0 +1,98 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (SASE might be better than VPNs for quickly ramping up remote access) +[#]: via: (https://www.networkworld.com/article/3534501/sase-might-be-better-than-vpns-for-quickly-ramping-up-remote-access.html) +[#]: author: (Linda Musthaler https://www.networkworld.com/author/Linda-Musthaler/) + +SASE might be better than VPNs for quickly ramping up remote access +====== +A secure access service edge model can quickly grow remote-worker capacity without requiring enterprises to deploy their own new VPN gear. +Getty Images + +The global pandemic now hitting almost every corner of the world is forcing countless millions of people to work from home. In one sense, we’re fortunate to now have the technology that allows us to do that. Between broadband Internet access in the home, corporate VPNs, team workspaces and videoconferencing services, many people can continue to do their jobs as effectively as if they were in their regular office environment. + +That doesn’t mean it’s all smooth sailing for the IT departments that have to enable and support those critical work-from-home services. Depending on the type of network architecture a company has, it can be relatively easy or significantly challenging to support tens of thousands of employees now suddenly working from home. + +[[Get regularly scheduled insights by signing up for Network World newsletters.]][1] + +I recently talked with Mark Casey, CEO of the network infrastructure services provider [Apcela][2], who conveyed the challenges that many large enterprises have. It’s these companies that typically still have a traditional hub-and-spoke kind of WAN anchored in a physical data center. Corporate traffic is backhauled from branch and remote locations (like workers’ homes) to a centralized [data center][3] to pass through a security stack before it is sent to the internet or to cloud services. Unfortunately, this legacy network architecture doesn’t adapt well to the dramatically different traffic patterns resulting from a massive surge in telework. + +When you look at the [VPN][4] architecture in this environment, it’s largely dominated by Cisco with its AnyConnect solution that pairs with the vendor’s ASA [firewall][5] products. Countless large enterprises have these hardware appliances in their on-premises data centers. Whether it’s Cisco equipment or some other vendor’s, the VPN/firewall combination is a real workhorse under normal conditions, but the vast increase in remote workers is causing a strain. + +**VPN capacity is strained** + +A home-based worker brings up a VPN connection that creates a secure tunnel to take him straight into the data center. This might be fine when the company expects 10% to 20% of its employees to work remotely at any given time, but now the numbers might approach 50% or 70%. This creates contention for resources and a poor VPN experience for all. What’s more, workers are routing a bunch of internet traffic to the data center along with traffic destined for on-premise applications like [Microsoft Office 365][6]. This is the landscape that Casey sees every day as he engages with large enterprise organizations. + +“We’ve talked to a number of companies recently that say they need to expand their VPN capacity but the legacy network architecture is holding them back. [Cisco][7], Palo Alto and others are offering free VPN client licenses but the enterprises still need to expand the VPN terminating appliances. It’s hard to quickly scale capacity in this environment,” says Casey. “Whether it’s coronavirus or some other catalyst that puts stress on the legacy network environment, we advocate that enterprises should diversify and shift portions of their network architecture to the cloud. This will give them much more flexibility to provide security and remote access services to their workforce in the long run.” + +[][8] + +**SASE for flexibility and capacity on demand** + +Casey points to the [Secure Access Service Edge][9] (SASE, pronounced “sassy”) framework as a model for re-architecting the enterprise network. SASE is Gartner’s name for a combination of [SD-WAN][10] capabilities with a number of security services that are primarily delivered through a cloud-based delivery model. + +Gartner defines the service edge as an offering that supports the access needs of digital enterprises by combining SD-WAN functions with network security services such as secure web gateway (SWG), cloud access security broker (CASB), and cloud-based firewall. In short, a SASE offering helps simplify network management by offering highly customizable policy-based control that can be tailored by user identity, session context, and application needs for performance and security – and it’s delivered from the cloud.  + +Casey explains the concept of a service edge with a geographical example. “Suppose an employee is VPNing into his corporate network from his New York area home, and the data center happens to be in Chicago. Ordinarily the traffic would all be directed to Chicago, but if he’s accessing internet content, it would be optimal to egress that traffic via secure web gateway much more locally to where the user is. It’s better to go to a site in New York where the VPN terminates on a local firewall, and there’s a secure web gateway there so the Internet traffic can be offloaded there instead of backhauling it to Chicago. This site in New York is called the service edge.” + +Casey continues his explanation: “A virtualized version of a company’s firewall sits in the hub. The VPN terminates on the VPN concentrator in the local hub and then the traffic is routed appropriately. That traffic going to the internet goes out through secure web gateway and that traffic that's destined for an application in the data center goes over a private network inside the security parameters. This is essentially another tunnel back to the data center. And that's a great use case for this whole concept of SASE, which is to lift some of your core security components and move them out to the cloud.” + +With the word cloud, people tend to think of AWS or Azure or Google Cloud Platform, but Casey gives cloud a broader definition. “Cloud is Software as a Service, like Salesforce and ServiceNow,” says Casey. “If you’re an enterprise, cloud is an Equinix data center. Cloud is anything that’s not you, and it’s delivered as a service.” + +**The service edge is a powerful hub** + +In Apcela’s parlance, a service edge is called an application hub, or AppHub. Other companies call them communication hubs, cloud hubs, or simply Points of Presence (PoPs). Regardless of the name, the concept is the same. + +These hubs consist of racks of switching and routing equipment that are typically deployed in carrier-neutral co-location centers. Then these data centers are interconnected with high-capacity, low-latency circuits that create a high-performance core network. SD-WAN, VPN and security stacks are typically deployed in the hubs. At the edge of this network, an enterprise can directly connect its own data centers, branch offices, remote and mobile users, and even third-party partners. The leading SASE providers have built hubs, or PoPs, around the world so that organizations and their workers can connect to the closest hub to obtain the communication and security services they need. Each enterprise chooses what services it wants to utilize. + +When considering how to deploy security as a virtual service, Casey says, “You don't necessarily want to put all the security in AWS because then it will work great with AWS, but it won't work for GCP or Azure, and it certainly won't help you for your SaaS applications. So having this hub environment that sits between the application clouds – Salesforce, Office 365, Workday, etc. – and the users and enterprise locations is the perfect location to put these security services. And because the hubs are essentially an Infrastructure as a Service, you're not stuck with having to move to some proprietary cloud-based platform.” + +SASE infrastructure is essentially on demand, so it’s fairly easy for new customers to adopt it. “It’s not complicated,” says Casey. “We have to find a place, somewhere in the world, and cross connect back into an enterprise’s infrastructure to deliver private connectivity. But it's all very cloud-like. It takes the agility of cloud and the speed of cloud and enables you to act quickly.” + +**SASE has VPN capacity pre-built** + +The SASE model allows companies to expand their VPN platforms easily because the capability is all pre-built. Once the service is turned on, the company is well positioned to support thousands of new home-based workers. + +I asked Casey about a realistic timeframe for companies that are new to the SASE approach before they can expect to be up and running with expanded VPN capacity. “I can only speak to the solution Apcela offers, of course, but I’d say it’s a matter of days to weeks, but certainly not months,” he says. “In our case, it depends on their security platform because we leverage virtualized network functions on the security side, so the whole concept of procuring and shipping equipment goes away.” Other vendors might do the deployment in different ways. + +Contrast this approach to the legacy model of installing new hardware in a data center to provide more capacity. By the time the company orders the hardware, gets it shipped to the data center, and then installed and configured, two or three months might pass. + +Another benefit of the SASE framework is that traffic travels over a private core network rather than the public Internet. “The Internet shouldn’t become your new [WAN][11] – certainly not for business and mission-critical platforms. You need a specialized sort of [MPLS][12]-like network for your cloud apps, which is what a SASE platform does,” says Casey. “Traffic is taken off the Internet at the secure edge, put onto a private secure network and routed directly to the appropriate SaaS or IaaS platform data center.” + +Having a private core network is especially important at this time because the public Internet is under great strain due to the traffic and content pattern shifts now that so many people are staying home or working from home. The [strain is so bad][13] that companies like Facebook and Netflix have been asked by the European Commissioner for internal market and services to throttle their services to consume less bandwidth. As Casey says, “You don’t want your corporate traffic to compete for bandwidth against Netflix and all these different videoconferencing services.” + +If your organization is struggling with ramping up work-from-home capacity in a hurry, consider how a SASE service might help you. + +Join the Network World communities on [Facebook][14] and [LinkedIn][15] to comment on topics that are top of mind. + +-------------------------------------------------------------------------------- + +via: https://www.networkworld.com/article/3534501/sase-might-be-better-than-vpns-for-quickly-ramping-up-remote-access.html + +作者:[Linda Musthaler][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.networkworld.com/author/Linda-Musthaler/ +[b]: https://github.com/lujun9972 +[1]: https://www.networkworld.com/newsletters/signup.html +[2]: https://www.apcela.com/ +[3]: https://www.networkworld.com/article/3223692/what-is-a-data-centerhow-its-changed-and-what-you-need-to-know.html +[4]: https://www.networkworld.com/article/3268744/understanding-virtual-private-networks-and-why-vpns-are-important-to-sd-wan.html +[5]: https://www.networkworld.com/article/3230457/what-is-a-firewall-perimeter-stateful-inspection-next-generation.html +[6]: https://techcommunity.microsoft.com/t5/office-365-blog/how-to-quickly-optimize-office-365-traffic-for-remote-staff-amp/ba-p/1214571; +[7]: https://blogs.cisco.com/security/cisco-expands-free-security-offerings-to-help-with-rise-in-remote-workers +[8]: https://www.networkworld.com/blog/itaas-and-the-corporate-storage-technology/?utm_source=IDG&utm_medium=promotions&utm_campaign=HPE22140&utm_content=sidebar (ITAAS and Corporate Storage Strategy) +[9]: https://www.networkworld.com/article/3516503/it-pros-need-to-weigh-in-on-that-sassy-security-model.html +[10]: https://www.networkworld.com/article/3031279/sd-wan-what-it-is-and-why-you-ll-use-it-one-day.html +[11]: https://www.networkworld.com/article/3248989/what-is-a-wan-wide-area-network-definition-and-examples.html +[12]: https://www.networkworld.com/article/2297171/network-security-mpls-explained.html +[13]: https://mashable.com/article/eu-netflix-standard-definition-coronavirus/ +[14]: https://www.facebook.com/NetworkWorld/ +[15]: https://www.linkedin.com/company/network-world diff --git a/sources/talk/20200401 How enterprise networking is changing with a work-at-home workforce.md b/sources/talk/20200401 How enterprise networking is changing with a work-at-home workforce.md new file mode 100644 index 0000000000..f87bc0a8f8 --- /dev/null +++ b/sources/talk/20200401 How enterprise networking is changing with a work-at-home workforce.md @@ -0,0 +1,114 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How enterprise networking is changing with a work-at-home workforce) +[#]: via: (https://www.networkworld.com/article/3534037/how-enterprise-networking-is-changing-with-a-work-at-home-workforce.html) +[#]: author: (Michael Cooney https://www.networkworld.com/author/Michael-Cooney/) + +How enterprise networking is changing with a work-at-home workforce +====== +Network World updates the latest COVID-19-related networking news +Ig0rZh / Getty Images + +_As the coronavirus spreads, public and private companies as well as government entities are requiring employees to work from home, putting unforeseen strain on all manner of networking technologies and causing bandwidth and security concerns.  What follows is a round-up of news and traffic updates that Network World will update as needed to help keep up with the ever-changing situation.  Check back frequently!_ + +UPDATE: 3.30 + +AT&T said its core network traffic – which includes business, home broadband and wireless  – was up 24% through March 30 compared to the same day last month.  It broke down some mobility traffic patterns as well: voice calls: +33%, instant messaging: +63%, text messaging: +41%, email: -18%, web browsing: -5%, video: +4% (also accounts for over half of all mobility traffic). It also usage for conferencing: AT&T’s global audio-conferencing solution: +200%; audio, web and video conferencing tools: +400%; Large-scale webcast events: +200%. + +[RELATED: Firewall face-off for the enterprise][1] + +AT&T said its investment in artificial intelligence technology is helping it keep up with demand. For example, the company said AI is helping remotely troubleshoot and diagnose problems with customer equipment, by identifying the cause or even proactively identifying a potential issue before it occurs. “We’ve expedited deployments of new AI capabilities in certain markets that will allow us to balance the traffic load within a sector and across sectors to help avoid overloading specific cells and improve the experience.” + +DNS vendor BlueCat says it has been tracking the use of DNS over HTTPS (DoH) – a method of encrypting queries to prevent visibility into DNS traffic patterns.  Over the last week through March 27, the company said it has  seen a massive increase in the use of DoH across its customer base wrote Ben Ball, director of strategy and content marketing at BlueCat in a [blog][2] about the trend. “In the course of a single weekend, the number of endpoints attempting to use DoH went from an average of 90 to about 1,400.  That’s a 1,500% increase in the use of DoH. Around 45% of these queries are from Firefox (which now activates DoH by default).  Aside from that, we’re seeing queries to eleven different DoH services from all kinds of applications. DoH usage is fairly uniform across our customer base as well – this isn’t one company or industry vertical; this is a broad trend. While we haven’t seen any clear indications that any of these queries are from [DoH enabled malware][3], that is an emerging threat that we are tracking,” Ball stated. + +Ookla’s [SpeedTest][4] shows mean download speed over fixed broadband declined only slightly in Mexico and the U.S. when comparing the week of March 23 to that of March 16, while a decline in Canada’s mean download speed over fixed broadband was more evident. Mean download speed over mobile was down in the U.S. and Canada during the week of March 23, while it rose slightly in Mexico during the same period. + +**UPDATE 3.27** + +[][5] + +Broadband watchers at [BroadbandNow][6] say users in most of the cities it analyzed are experiencing normal network conditions, suggesting that ISP’s (and their networks) are holding up to the shifting demand. In a March 25 [post][7] the firm wrote: “Encouragingly, many of the areas hit hardest by the spread of the coronavirus are holding up to increased network demand. Cities like Los Angeles, Chicago, Brooklyn, and San Francisco have all experienced little or no disruption. New York City,  now the epicenter of the virus in the U.S., has seen a 24% dip out of its previous ten-week range. However, with a new median speed of nearly 52 Mbps, home connections still appear to be holding up overall.” + +Other BroadbandNow findings included: + + * Eighty eight (44%) of the 200 cities it analyzed experienced some degree of network degradation over the past week compared to the 10 weeks prior. However, only 27 (13.5%) cities experienced dips of 20% below range or greater. + * Seattle download speeds have continued to hold up over the past week, while New York City’s speeds have fallen out of range by 24%. Both cities are currently heavily affected by the coronavirus pandemic. + * Three cities – Austin, Texas, Winston Salem, N.C., and Oxnard, Calif. – have experienced significant degradations, falling out of their 10-week range by more than 40%. + + + +Cisco’s Talos threat-intelligence arm [wrote][8] on March 26 about the COVID security threat noting what it called three broad categories of attacks leveraging COVID with known advanced persistent threat participation in: [Malware and phishing campaigns][9] using COVID-themed lures; attacks against organizations that carry out research and other work related to COVID; and fraud and disinformation. From an enterprise security perspective, Talos recommended: + + * Remote access: Do not expose Remote Desktop Protocol (RDP) to the internet. Use secure VPN connections with multi-factor authentication schemes. Network access control packages can be used to ensure that systems attempting to remotely connect to the corporate environment meet a minimum set of security standards such as anti-malware protection, patch levels, etc,. prior to granting them access to corporate resources. Continually identify and remediate access-policy violations. + * Identity Management: Protect critical and public-facing applications with multi-factor authentication and supporting corporate policies. Verify that remote-account and access-termination capabilities work as intended in a remote environment. + * Endpoint Control: Because many people may be working from home networks, endpoint visibility, protection, and mitigation is now more important than ever. Consider whether remediation and reimaging capabilities will work as intended in a remote environment. Encrypt devices where possible, and add this check to your NAC solution as a gate for connectivity. Another simple method of protecting endpoints is via DNS, such as with [Cisco’s] Umbrella, by blocking the resolution of malicious domains before the host has a chance to make a connection. + + + +In an [FAQ][10] about the impact of COVID-19 on fulfilling customer hardware orders, VMware stated: “Some VMware SD-WAN hardware appliances are on backorder as a result of supply chain issues. As a result, we are extending the option to update existing orders with different appliances where inventory is more readily available. Customers may contact a special email hotline with questions related to backordered appliances. Please send an email to [sd-wan-hotline@vmware.com][11] with your questions and include the order number, urgent quantities, and contact information. We will do our best to respond within 48 hours.” + +Cisco said it has been analyzing traffic statistics with major carriers across Asia, Europe, and the Americas, and its data shows that typically, the most congested point in the network occurs at inter-provider peering points, Jonathan Davidson, senior vice president and general manager of Cisco's Mass-Scale Infrastructure Group wrote in a [blog][12] on March 26. “However, the traffic exchanged at these bottlenecks is only a part of the total internet traffic, meaning reports on traffic may be higher overall as private peering and local destinations also contribute to more traffic growth.” + +“Our analysis at these locations shows an increase in traffic of 10% to 33% over normal levels. In every country, traffic spiked with the decision to shut down non-essential businesses and keep people at home. Since then, traffic has remained stable or has experienced a slight uptick over the days that followed,” Davidson stated. + +He said that traffic during peak hours from 6 p.m. and 10 p.m. has increased slightly, but is not the primary driver for the overall inrease. Busy hours have extended to 9 a.m. 10 p.m., although the new busy-hour (9 a.m. to 6 p.m.) traffic is still below the traditional peak hours. "Service providers are certainly paying attention to these changes, but they are not yet a dire concern, as most networks are designed for growth. Current capacities are utilized more over the course of the entire day,” he wrote. + +Spanish multinational telecommunications company [Telefonica][13]’ said IP networks are experiencing traffic increases of close to 40% while mobile voice use is up about 50% and data is up 25%. In general, traffic through IP networks has experienced increases of nearly 40% while mobile use has increased by about 50% for voice and 25% for data. Likewise, traffic from instant-messaging tools such as Whatsapp has increased fivefold in recent days. + +**UPDATE: 3.26** + + * Week over week (ending March 23) [Ookla][14] says it has started to see a degradation of mobile and fixed-broadband performance worldwide. More detail on specific locations is available below. Comparing the week of March 16 to the week of March 9, mean download speed over mobile and fixed broadband decreased in Canada and the U.S. while both remained relatively flat in Mexico. + * What is the impact of the coronavirus on corporate network planning? Depends on how long the work-from-home mandate goes on really. Tom Nolle, president of CIMI Corp. [takes an interesting look at the situation][15] saying the shutdown “could eventually produce a major uptick for SD-WAN services, particularly in [managed service provider]    Businesses would be much more likely to embark on an SD-WAN VPN adventure that didn’t involve purchase/licensing, favoring a service approach in general, and in particular one with a fairly short contract period.” + * Statistics from VPN provider [NordVPN][16] show the growth of VPN usage across the globe.  For example, the company said the US has experienced a 65.93% growth in the use of business VPNs since March 11. It reported that mass remote working has contributed towards a rise in desktop (94.09%) and mobile app (0.39%) usage among Americans. Globally, NordVPN teams has seen a 165% spike in the use of business VPNs and business VPN usage in Netherlands (240.49%), Canada (206.29%) and Austria (207.86%) has skyrocketed beyond 200%. Italy has had the most modest growth in business VPN usage at just 10.57%. + + + +**UPDATE: 3. 25**: + + * According to [Atlas VPN][17] user data, VPN usage in the US increased by 124% during the last two weeks. VPN usage in the country increased by 71% between March 16 and 22 alone. Atlas said it measured how much traffic traveled through its servers during that period compared to March 9 to 15. The data came from the company's 53,000 weekly users. + * Verizon [reports][18] that voice usage, long declining in the age of texting, chat and social media, is up 25% in the last week. The network report shows the primary driver is accessing conference calls. In addition, people are talking longer on mobile devices with wireless voice usage notching a 10% increase and calls lasting 15% longer.  + * AT&T also [reported][19] increased calling, especially Wi-Fi calling, up 88% on March 22 versus a normal Sunday. It says that consumer home voice calls were up 74% more than an average Sunday; traffic from Netflix dipped after all-time highs on Friday and Saturday; and data traffic due to heavy video streaming between its network and peered networks tied record highs. AT&T said it has deployed portable cell nodes to bolster coverage supporting FirstNet customers in Indiana, Connecticut, New Jersey, California and New York. + * Microsoft this week advised users of Office 365 it was throttling back some services: + * **OneNote: ** OneNote in Teams will be read-only for commercial tenants, excluding EDU. Users can go to OneNote for the web for editing. Download size and sync frequency of file attachments has been changed. You can find details on these and other OneNote related updates as . + * **SharePoint:** We are rescheduling specific backend operations to regional evening and weekend business hours. Impacted capabilities include migration, DLP and delays in file management after uploading a new file, video or image. Reduced video resolution for playback videos. + * **Stream:** People timeline has been disabled for newly uploaded videos. Pre-existing videos will not be impacted. Meeting recording video resolution adjusted to 720p. + + + +**RELATED COVID-19 NEWS:** + +-------------------------------------------------------------------------------- + +via: https://www.networkworld.com/article/3534037/how-enterprise-networking-is-changing-with-a-work-at-home-workforce.html + +作者:[Michael Cooney][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.networkworld.com/author/Michael-Cooney/ +[b]: https://github.com/lujun9972 +[1]: https://www.networkworld.com/article/3189176/security/face-off-cisco-vs-fortinet-for-enterprise-firewalls.html +[2]: https://www.bluecatnetworks.com/blog/wfh-doh/ +[3]: https://blog.netlab.360.com/an-analysis-of-godlua-backdoor-en/ +[4]: https://www.speedtest.net/insights/blog/tracking-covid-19-impact-global-internet-performance/ +[5]: https://www.networkworld.com/blog/itaas-and-the-corporate-storage-technology/?utm_source=IDG&utm_medium=promotions&utm_campaign=HPE22140&utm_content=sidebar (ITAAS and Corporate Storage Strategy) +[6]: https://broadbandnow.com/ +[7]: https://broadbandnow.com/report/internet-speed-analysis-march-15th-21st/ +[8]: https://blog.talosintelligence.com/2020/03/covid-19-pandemic-threats.html +[9]: https://blog.talosintelligence.com/2020/02/coronavirus-themed-malware.html +[10]: https://www.vmware.com/company/news/updates/vmware-response-covid-19.html?mid=31381&eid=CVMW2000048242496 +[11]: mailto:sd-wan-hotline@vmware.com +[12]: https://blogs.cisco.com/news/global-traffic-spikes-no-panic-at-the-cisco +[13]: https://www.telefonica.com/en/web/press-office/-/telefonica-announces-measures-related-to-covid-19 +[14]: https://downdetector.com/?utm_campaign=Ookla%20Insights%20Blog%20Subscription&utm_source=hs_email&utm_medium=email&utm_content=85202785&_hsenc=p2ANqtz--Nj93d_eQyJpsqxrPJyNPtTiMBWBQU984psLyalw51K61e4d1WODareMF5NWFriHY2Uzw3WF7rF-2vSfH5cR53Jg3K5Q&_hsmi=85202785 +[15]: https://blog.cimicorp.com/?p=4068 +[16]: https://nordvpnteams.com/ +[17]: https://atlasvpn.com/blog/lockdowns-and-panic-leads-to-a-124-surge-in-vpn-usage-in-the-us/ +[18]: https://www.verizon.com/about/news/update-verizon-serve-customers-covid-19 +[19]: https://about.att.com/pages/COVID-19.html diff --git a/sources/talk/20200402 When debugging, your attitude matters.md b/sources/talk/20200402 When debugging, your attitude matters.md new file mode 100644 index 0000000000..6968d3f8e3 --- /dev/null +++ b/sources/talk/20200402 When debugging, your attitude matters.md @@ -0,0 +1,101 @@ +[#]: collector: (lujun9972) +[#]: translator: (name1e5s) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (When debugging, your attitude matters) +[#]: via: (https://jvns.ca/blog/debugging-attitude-matters/) +[#]: author: (Julia Evans https://jvns.ca/) + +When debugging, your attitude matters +====== + +A while back I wrote [What does debugging a program look like?][1] on what to do when debugging (change one thing at a time! check your assumptions!). + +But I was debugging some CSS last week, and I think that post is missing something important: **your attitude**. + +Now – I’m not a very good CSS developer yet. I’ve never written CSS professionally and I don’t understand a lot of basic CSS concepts (I think I finally understood for the first time recently how `position: absolute` works). And last week I was working on the most complicated CSS project I’d ever attempted. + +While I was debugging my CSS, I noticed myself doing some bad things that I normally would not! I was: + + * making random changes to my code in the hopes that it would work + * googling a lot of things and trying them without understanding what they did + * if something broke, reverting my changes and starting again + + + +This strategy was exactly as effective as you might imagine (not very effective!), and it was because of my attitude about CSS! I had this unusual-for-me belief that CSS was Too Hard and impossible for me to understand. So let’s talk about that attitude a bit! + +### the problem attitude: “this is too hard for me to understand” + +One specific problem I was having was – I had 2 divs stacked on top of one another, and I wanted Div A to be on top of Div B. My model of CSS stacking order at the start of this was basically “if you want Thing A to be on top of Thing B, change the z-index to make it work”. So I changed the z-index of Div A to be 5 or something. + +But it didn’t work! In Firefox, div A was on top, but in Chrome, Div B was on top. Argh! Why? CSS is impossible!!! + +I googled a bit, and I found out that a possible reason z-index might not work was because Div A and Div B were actually in different “stacking contexts”. If that was true, even if I set the z-index of Div A to 999999 it would still not put it on top of Div B. ([here’s a small example of what this z-index problem looks like, though I think my specific bug had some extra complications][2]) + +I thought “man, this stacking context thing seems really complicated, why is it different between Firefox and Chrome, I’m not going to be able to figure this out”. So I tried a bunch of random things a bunch of blog posts suggested, which as usual did not work. + +Finally I gave up this “change random things and pray” strategy and thought “well, what if I just read the documentation on stacking order, maybe it’s not that bad”. + +So I read the [MDN page on stacking order][3], which says: + +> When the z-index property is not specified on any element, elements are stacked in the following order (from bottom to top): +> 1\. The background and borders of the root element +> 2\. Descendant non-positioned blocks, in order of appearance in the HTML +> 3\. Descendant positioned elements, in order of appearance in the HTML + +This is SO SIMPLE! It just depends on the order in the HTML! I put Div A after Div B in the HTML (as a sibling) and it made everything work in both browsers. + +### better attitude: “let’s learn the basics and see if that helps” + +This whole stacking problem turned out to really not be that complicated – all I needed to do was read a very short and simple documentation page to understand how stacking works! + +Of course, computer things are not always this simple (and even in this specific case the [rules about what creates a new stacking context][4] are pretty complicated.). But I did not need to understand those more complicated rules in order to put Div A on top of Div B! I only needed to know the much simpler 3 rules above. + +So – calm down for a second, learn a few of the basics, and see if that helps. + +### watching people who know what they’re doing is inspiring + +Another area of CSS that I thought was “too hard” for me to understand was this whole `position: absolute` and `position: relative` business. I kept seeing (and sometimes using!) examples where people made complicated CSS things with `position: absolute` but I didn’t understand how they worked. Doesn’t `position: absolute` mean that the element is always in the same place on the screen? Why are these `position: absolute` things moving when I scroll like the rest of the document? (spoiler: no, that’s `position: fixed`.) + +But last week, I paired with someone who’s a lot better at CSS than me on some code, and I saw that they were just typing in `position: absolute` and `position: relative` confidently into their code without seeming confused about it!! Could that be me? + +I looked up the [documentation on MDN][5] on `position: absolute`, and it said: + +> The element is removed from the normal document flow, and no space is created for the element in the page layout. It is positioned relative to its closest positioned ancestor… Its final position is determined by the values of top, right, bottom, and left. + +So things with `position: absolute` are positioned relative to their closest positioned ancestor! And you just use `top/bottom/right/left` to pick where! That’s so simple! + +### documentation that you can trust makes a big difference + +I think another big source of my frustration with CSS is that I didn’t have the best grasp of where to find accurate information & advice. I knew that MDN was a reliable reference, but MDN doesn’t really help answer questions like “ok but seriously how do I center a div???” and I found myself reading a lot of random Stack Overflow answers/blog posts that I wasn’t 100% sure were correct. + +This week I learned about [CSS Tricks][6] which has a lot of GREAT articles like [Centering in CSS: A Complete Guide][7] which seems very reputable and is written in a super clear way. + +### that’s all! + +I don’t really know why I started to believe that it was “impossible” to understand basic CSS concepts since I don’t believe that about computers in general. Maybe because I’ve been writing CSS at a beginner level for a very long time but hadn’t ever really tried to do a more involved CSS project than “let’s arrange some divs in a grid with flexbox”! + +But this attitude really got in the way of me writing the CSS I wanted to write! And once I let go of it and used my normal debugging techniques I was able to get a lot more things to work the way I wanted. + +-------------------------------------------------------------------------------- + +via: https://jvns.ca/blog/debugging-attitude-matters/ + +作者:[Julia Evans][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://jvns.ca/ +[b]: https://github.com/lujun9972 +[1]: https://jvns.ca/blog/2019/06/23/a-few-debugging-resources/ +[2]: https://codepen.io/jvns-css-fun/pen/YzXMMdQ +[3]: https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Positioning/Understanding_z_index/Stacking_without_z-index +[4]: https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Positioning/Understanding_z_index/The_stacking_context +[5]: https://developer.mozilla.org/en-US/docs/Web/CSS/position +[6]: https://css-tricks.com +[7]: https://css-tricks.com/centering-css-complete-guide/ diff --git a/sources/talk/20200405 Book review- Nine Lies About Work.md b/sources/talk/20200405 Book review- Nine Lies About Work.md new file mode 100644 index 0000000000..a4c06438aa --- /dev/null +++ b/sources/talk/20200405 Book review- Nine Lies About Work.md @@ -0,0 +1,106 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Book review: Nine Lies About Work) +[#]: via: (https://opensource.com/open-organization/20/4/book-review-nine-lies-about-work) +[#]: author: (Ron McFarland https://opensource.com/users/ron-mcfarland) + +Book review: Nine Lies About Work +====== +An examination of common work misconceptions and how open organizations +are often ahead of the curve. +![Carrot on a stick][1] + +In _Nine Lies About Work_, authors Marcus Buckingham and Ashley Goodall examine what we might consider "common theories" about aspects of contemporary organizational life—and they debunk those theories. The book's so-called "lies" are, therefore, not really lies but rather common beliefs about work that simply aren't accurate in actual working environments today. + +In this review, I'll outline all nine of those misconceptions and explain what the authors believe is really true in the case of each one. But then I'll focus more on explaining the misconceptions that are especially relevant to [open organizations][2]. + +### Liar, liar + +Buckingham and Goodall address the following nine "lies" about work. + +Lie #1—People care about which company they work for. The authors believe that people really care about which team they're directly working on. That is where we [find engagement][3]. + +Lie #2—The best plan wins. The authors believe that the best front-line intelligence and feedback wins. In this rapidly changing world, [plans only tell you where you are now][4] and where you may be in the very near future (that is, in a few weeks or months). + +Lie #3—The best companies cascade goals. The authors believe that the best companies [disseminate downward meaning][5] (that is, public purpose) to their staff. + +Lie #4—The best people are well-rounded. The authors believe that the best people are good only at specific tasks (and not _necessarily_ other tasks). + +Lie #5—People need feedback. The authors believe that people need nonjudgmental, uncritical attention, and to be recognized; they don't need criticism. + +Lie #6—People can reliably rate other people. The authors believe that people can reliably rate their own experience and [evaluate their own performance][6] often better than others can. + +Lie #7—People have potential. The authors believe that every person possesses individual needs and individual feelings of forward momentum and progress. Therefore, their potential cannot be determined. + +Lie #8—Work-life balance matters most. The authors believe that love-in-work matters most. Companies should promote each individual finding the [love of what they do at work][7], then expand on that love. Companies should promote having fun at work, but they rarely do. + +Lie #9—Leadership is a thing. The authors believe that [we each follow people with a vision][8] in which we believe. To say a person is "a good leader" is, therefore, only situational according to individual followers. No universal criteria, rule, or model for effective leadership exists. + +### Teams over companies + +Now let's take a hard look at Lie #1. The authors believe that someone seeking a job will care about the quality of a company, their status inside that company, and their pay, but as soon as work begins, team engagement becomes far more important to them. That's because teams focus on what we do on a daily basis. Those teams might even be unofficial groups inside an organization—"[internal communities][9]," we might call them. Buckingham and Goodall provide eight characteristics of great teams, and these characteristics would ring equally true in [open organization communities][2]. The authors present them separated into two categories—"We"-related and "Me"-related): + + * The members are enthusiastic about the team mission ("We"). + * Each is surrounded by people who share the same values ("We"). + * Their teammates will stand behind them when needed ("We") + * The members feel confident regarding the future of the company ("We"). + * Each member understands what is expected ("Me"). + * Everyone feels they have a chance to use their particular strengths ("Me"). According to a 2018 study from ADP Research Institute, cited in the book's appendix, if we can use our strengths that bring us joy and energizes us 20% of the time at work, total work engagement skyrockets. + * All members can be recognized for excellent work ("Me"). + * The members are challenged to grow ("Me"). + + + +All these characteristics describe a healthy culture in an open organization community. + +According to the authors, a company should explore what [informal, unofficial teams][10] it has and learn what they're involved in. Usually, they say, the average person is on five teams, each with different purposes. Ask people if they have these types of teams (or a single mentor) with whom they can consult inside the company. Larger, more formal groups are less important. + +More important, however, are lunch meetings between informal team members or chats in corners discussing how they can help each other. When I was providing sales seminars, for example, I would walk around the company cafeteria and have these discussions with global sales departments. By doing this, I developed strong communities over a 20-year period. The quality and quantities of these teams are directly connected to employee engagement and are extremely important to the success of a company, according to the authors. An organizational leader's primary job is to create an environment where these teams can grow and thrive. + +### Forget planning + +Next, let's turn to Lie #2: the best plan wins. Buckingham and Goodall believe the best front-line intelligence wins. Open organizations [rely a great deal on bottom-up management techniques][11], which fits nicely into what the authors are saying here. All the action is on the front-line, and real-time reporting to management on situational developments is extremely important, according to the authors. Conditions are changing so fast that [by the time some plans are introduced, they are already out-of-date][12]. That is why open organizations strongly believe in cultivating ground-level decision-making practices. People closest to the issues know what's happening. + +Regarding [open organization principles][2], we might note the emphasis on getting front-line information in real-time and broadly distributing it as much as possible (inclusivity, transparency, broader community), as well as encouraging and reporting front-line suggestions (collaboration, adaptability). Communication is two-way. To share information efficiently and understand when it's needed, Buckingham and Goodall believe that many small, short, frequent meetings are always more productive than large, long, infrequent ones. + +### Don't judge + +Next, let's examine Lie #5: People need feedback. The authors do recognize people's need for nonjudgmental, uncritical attention, and their desire to be recognized. A leader's level of uncritical attention is directly connected to the level of staff engagement. Just asking, "[How are you doing in your work?][13]" and "Well, how can I help?" is all that is needed. + +The authors believe that the worst managers are those that ignore people. Average managers don't ignore people, but they give negative feedback, which weakens their teams' feelings of engagement. The best managers, team leaders, or community leaders don't ignore and don't judge. At least weekly, they simply ask questions and provide help if needed. A high degree of managerial attention directly improves front-line engagement. The authors believe that it makes members feel connected, supported, and understood. + +Buckingham and Goodall believe that looking at a staff's negative qualities is a natural tendency. Therefore, leaders and managers must make strong efforts to avoid doing so. This effort is worth it, the authors argue, as it results in greater performance, engagement, and growth. For example, when I was giving sales manager training, I frequently needed to address the situation of handling sales staff coming to the manager to help them with a customer problem. I recommended that the manager just ask the sales staff a simple question: "What did you do and say when you met the customer, and what would you do differently if you could visit the customer all over again?" This forced salespeople to come up with their own advice. + +### Concluding thoughts + +_Nine Lies about Work_ has much to teach anyone interested in open organizations. Buckingham is a global researcher in human strengths development and performance; Goodall is a senior VP in leadership and team intelligence at Cisco. It is amazing how closely their beliefs align with open organization principles. The ways they articulate those beliefs in this book are enlightening. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/open-organization/20/4/book-review-nine-lies-about-work + +作者:[Ron McFarland][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/ron-mcfarland +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/BUSINESS_pink2.png?itok=I5Wgct6V (Carrot on a stick) +[2]: https://opensource.com/open-organization/resources/open-org-definition +[3]: https://opensource.com/open-organization/18/10/understanding-engagement-empowerment +[4]: https://opensource.com/open-organization/19/5/planning-future-unknowable +[5]: https://opensource.com/open-organization/18/7/culture-of-experimentation-in-4-steps +[6]: https://opensource.com/open-organization/15/5/measuring-performance-open-source-way +[7]: https://opensource.com/open-organization/15/11/reigniting-employee-passion +[8]: https://opensource.com/open-organization/18/12/what-is-open-leadership +[9]: https://opensource.com/open-organization/19/11/what-is-community-practice +[10]: https://opensource.com/open-organization/20/1/why-build-community-of-practice +[11]: https://opensource.com/open-organization/17/3/making-better-open-decisions +[12]: https://opensource.com/open-organization/18/3/try-learn-modify +[13]: https://opensource.com/open-organization/16/10/how-ask-why-without-upsetting-anyone diff --git a/sources/talk/20200406 How to Use a Differential Analyzer (to Murder People).md b/sources/talk/20200406 How to Use a Differential Analyzer (to Murder People).md new file mode 100644 index 0000000000..6796e25603 --- /dev/null +++ b/sources/talk/20200406 How to Use a Differential Analyzer (to Murder People).md @@ -0,0 +1,147 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How to Use a Differential Analyzer (to Murder People)) +[#]: via: (https://twobithistory.org/2020/04/06/differential-analyzer.html) +[#]: author: (Two-Bit History https://twobithistory.org) + +How to Use a Differential Analyzer (to Murder People) +====== + +A differential analyzer is a mechanical, analog computer that can solve differential equations. Differential analyzers aren’t used anymore because even a cheap laptop can solve the same equations much faster—and can do it in the background while you stream the new season of Westworld on HBO. Before the invention of digital computers though, differential analyzers allowed mathematicians to make calculations that would not have been practical otherwise. + +It is hard to see today how a computer made out of anything other than digital circuitry printed in silicon could work. A mechanical computer sounds like something out of a steampunk novel. But differential analyzers did work and even proved to be an essential tool in many lines of research. Most famously, differential analyzers were used by the US Army to calculate range tables for their artillery pieces. Even the largest gun is not going to be effective unless you have a range table to help you aim it, so differential analyzers arguably played an important role in helping the Allies win the Second World War. + +To understand how differential analyzers could do all this, you will need to know what differential equations are. Forgotten what those are? That’s okay, because I had too. + +### Differential Equations + +Differential equations are something you might first encounter in the final few weeks of a college-level Calculus I course. By that point in the semester, your underpaid adjunct professor will have taught you about limits, derivatives, and integrals; if you take those concepts and add an equals sign, you get a differential equation. + +Differential equations describe rates of change in terms of some other variable (or perhaps multiple other variables). Whereas a familiar algebraic expression like (y = 4x + 3) specifies the relationship between some variable quantity (y) and some other variable quantity (x), a differential equation, which might look like (\frac{dy}{dx} = x), or even (\frac{dy}{dx} = 2), specifies the relationship between a _rate of change_ and some other variable quantity. Basically, a differential equation is just a description of a rate of change in exact mathematical terms. The first of those last two differential equations is saying, “The variable (y) changes with respect to (x) at a rate defined exactly by (x),” and the second is saying, “No matter what (x) is, the variable (y) changes with respect to (x) at a rate of exactly 2.” + +Differential equations are useful because in the real world it is often easier to describe how complex systems change from one instant to the next than it is to come up with an equation describing the system at all possible instants. Differential equations are widely used in physics and engineering for that reason. One famous differential equation is the heat equation, which describes how heat diffuses through an object over time. It would be hard to come up with a function that fully describes the distribution of heat throughout an object given only a time (t), but reasoning about how heat diffuses from one time to the next is less likely to turn your brain into soup—the hot bits near lots of cold bits will probably get colder, the cold bits near lots of hot bits will probably get hotter, etc. So the heat equation, though it is much more complicated than the examples in the last paragraph, is likewise just a description of rates of change. It describes how the temperature of any one point on the object will change over time given how its temperature differs from the points around it. + +Let’s consider another example that I think will make all of this more concrete. If I am standing in a vacuum and throw a tennis ball straight up, will it come back down before I asphyxiate? This kind of question, posed less dramatically, is the kind of thing I was asked in high school physics class, and all I needed to solve it back then were some basic Newtonian equations of motion. But let’s pretend for a minute that I have forgotten those equations and all I can remember is that objects accelerate toward earth at a constant rate of (g), or about (10 ;m/s^2). How can differential equations help me solve this problem? + +Well, we can express the one thing I remember about high school physics as a differential equation. The tennis ball, once it leaves my hand, will accelerate toward the earth at a rate of (g). This is the same as saying that the velocity of the ball will change (in the negative direction) over time at a rate of (g). We could even go one step further and say that _the rate of change in the height of my ball above the ground_ (this is just its velocity) will change over time at a rate of negative (g). We can write this down as the following, where (h) represents height and (t) represents time: + +[\frac{d^2h}{dt^2} = -g] + +This looks slightly different from the differential equations we have seen so far because this is what is known as a second-order differential equation. We are talking about the rate of change of a rate of change, which, as you might remember from your own calculus education, involves second derivatives. That’s why parts of the expression on the left look like they are being squared. But this equation is still just expressing the fact that the ball accelerates downward at a constant acceleration of (g). + +From here, one option I have is to use the tools of calculus to solve the differential equation. With differential equations, this does not mean finding a single value or set of values that satisfy the relationship but instead finding a function or set of functions that do. Another way to think about this is that the differential equation is telling us that there is some function out there whose second derivative is the constant (-g); we want to find that function because it will give us the height of the ball at any given time. This differential equation happens to be an easy one to solve. By doing so, we can re-derive the basic equations of motion that I had forgotten and easily calculate how long it will take the ball to come back down. + +But most of the time differential equations are hard to solve. Sometimes they are even impossible to solve. So another option I have, given that I paid more attention in my computer science classes that my calculus classes in college, is to take my differential equation and use it as the basis for a simulation. If I know the starting velocity and the acceleration of my tennis ball, then I can easily write a little for-loop, perhaps in Python, that iterates through my problem second by second and tells me what the velocity will be at any given second (t) after the initial time. Once I’ve done that, I could tweak my for-loop so that it also uses the calculated velocity to update the height of the ball on each iteration. Now I can run my Python simulation and figure out when the ball will come back down. My simulation won’t be perfectly accurate, but I can decrease the size of the time step if I need more accuracy. All I am trying to accomplish anyway is to figure out if the ball will come back down while I am still alive. + +This is the numerical approach to solving a differential equation. It is how differential equations are solved in practice in most fields where they arise. Computers are indispensable here, because the accuracy of the simulation depends on us being able to take millions of small little steps through our problem. Doing this by hand would obviously be error-prone and take a long time. + +So what if I were not just standing in a vacuum with a tennis ball but were standing in a vacuum with a tennis ball in, say, 1936? I still want to automate my computation, but Claude Shannon won’t even complete his master’s thesis for another year yet (the one in which he casually implements Boolean algebra using electronic circuits). Without digital computers, I’m afraid, we have to go analog. + +### The Differential Analyzer + +The first differential analyzer was built between 1928 and 1931 at MIT by Vannevar Bush and Harold Hazen. Both men were engineers. The machine was created to tackle practical problems in applied mathematics and physics. It was supposed to address what Bush described, in [a 1931 paper][1] about the machine, as the contemporary problem of mathematicians who are “continually being hampered by the complexity rather than the profundity of the equations they employ.” + +A differential analyzer is a complicated arrangement of rods, gears, and spinning discs that can solve differential equations of up to the sixth order. It is like a digital computer in this way, which is also a complicated arrangement of simple parts that somehow adds up to a machine that can do amazing things. But whereas the circuitry of a digital computer implements Boolean logic that is then used to simulate arbitrary problems, the rods, gears, and spinning discs _directly_ simulate the differential equation problem. This is what makes a differential analyzer an analog computer—it is a direct mechanical analogy for the real problem. + +How on earth do gears and spinning discs do calculus? This is actually the easiest part of the machine to explain. The most important components in a differential analyzer are the six mechanical integrators, one for each order in a sixth-order differential equation. A mechanical integrator is a relatively simple device that can integrate a single input function; mechanical integrators go back to the 19th century. We will want to understand how they work, but, as an aside here, Bush’s big accomplishment was not inventing the mechanical integrator but rather figuring out a practical way to chain integrators together to solve higher-order differential equations. + +A mechanical integrator consists of one large spinning disc and one much smaller spinning wheel. The disc is laid flat parallel to the ground like the turntable of a record player. It is driven by a motor and rotates at a constant speed. The small wheel is suspended above the disc so that it rests on the surface of the disc ever so slightly—with enough pressure that the disc drives the wheel but not enough that the wheel cannot freely slide sideways over the surface of the disc. So as the disc turns, the wheel turns too. + +The speed at which the wheel turns will depend on how far from the center of the disc the wheel is positioned. The inner parts of the disc, of course, are rotating more slowly than the outer parts. The wheel stays fixed where it is, but the disc is mounted on a carriage that can be moved back and forth in one direction, which repositions the wheel relative to the center of the disc. Now this is the key to how the integrator works: The position of the disc carriage is driven by the input function to the integrator. The output from the integrator is determined by the rotation of the small wheel. So your input function drives the rate of change of your output function and you have just transformed the derivative of some function into the function itself—which is what we call integration! + +If that explanation does nothing for you, seeing a mechanical integrator in action really helps. The principle is surprisingly simple and there is no way to watch the device operate without grasping how it works. So I have created [a visualization of a running mechanical integrator][2] that I encourage you to take a look at. The visualization shows the integration of some function (f(x)) into its antiderivative (F(x)) while various things spin and move. It’s pretty exciting. + +![][3] _A nice screenshot of my visualization, but you should check out the real thing!_ + +So we have a component that can do integration for us, but that alone is not enough to solve a differential equation. To explain the full process to you, I’m going to use an example that Bush offers himself in his 1931 paper, which also happens to be essentially the same example we contemplated in our earlier discussion of differential equations. (This was a happy accident!) Bush introduces the following differential equation to represent the motion of a falling body: + +[\frac{d^2x}{dt^2} = -k,\frac{dx}{dt} - g] + +This is the same equation we used to model the motion of our tennis ball, only Bush has used (x) in place of (h) and has added another term that accounts for how air resistance will decelerate the ball. This new term describes the effect of air resistance on the ball in the simplest possible way: The air will slow the ball’s velocity at a rate that is proportional to its velocity (the (k) here is some proportionality constant whose value we don’t really care about). So as the ball moves faster, the force of air resistance will be stronger, further decelerating the ball. + +To configure a differential analyzer to solve this differential equation, we have to start with what Bush calls the “input table.” The input table is just a piece of graphing paper mounted on a carriage. If we were trying to solve a more complicated equation, the operator of the machine would first plot our input function on the graphing paper and then, once the machine starts running, trace out the function using a pointer connected to the rest of the machine. In this case, though, our input is just the constant (g), so we only have to move the pointer to the right value and then leave it there. + +What about the other variables (x) and (t)? The (x) variable is our output as it represents the height of the ball. It will be plotted on graphing paper placed on the output table, which is similar to the input table only the pointer is a pen and is driven by the machine. The (t) variable should do nothing more than advance at a steady rate. (In our Python simulation of the tennis ball problem as posed earlier, we just incremented (t) in a loop.) So the (t) variable comes from the differential analyzer’s motor, which kicks off the whole process by rotating the rod connected to it at a constant speed. + +Bush has a helpful diagram documenting all of this that I will show you in a second, but first we need to make one more tweak to our differential equation that will make the diagram easier to understand. We can integrate both sides of our equation once, yielding the following: + +[\frac{dx}{dt} = - \int \left(k,\frac{dx}{dt} + g\right),dt] + +The terms in this equation map better to values represented by the rotation of various parts of the machine while it runs. Okay, here’s that diagram: + +![][4] _The differential analyzer configured to solve the problem of a falling body in one dimension._ + +The input table is at the top of the diagram. The output table is at the bottom-right. The output table here is set up to graph both (x) and (\frac{dx}{dt}), i.e. height and velocity. The integrators appear at the bottom-left; since this is a second-order differential equation, we need two. The motor drives the very top rod labeled (t). (Interestingly, Bush referred to these horizontal rods as “buses.”) + +That leaves two components unexplained. The box with the little (k) in it is a multiplier respresnting our proportionality constant (k). It takes the rotation of the rod labeled (\frac{dx}{dt}) and scales it up or down using a gear ratio. The box with the (\sum) symbol is an adder. It uses a clever arrangement of gears to add the rotations of two rods together to drive a third rod. We need it since our equation involves the sum of two terms. These extra components available in the differential analyzer ensure that the machine can flexibly simulate equations with all kinds of terms and coefficients. + +I find it helpful to reason in ultra-slow motion about the cascade of cause and effect that plays out as soon as the motor starts running. The motor immediately begins to rotate the rod labeled (t) at a constant speed. Thus, we have our notion of time. This rod does three things, illustrated by the three vertical rods connected to it: it drives the rotation of the discs in both integrators and also advances the carriage of the output table so that the output pen begins to draw. + +Now if the integrators were set up so that their wheels are centered, then the rotation of rod (t) would cause no other rods to rotate. The integrator discs would spin but the wheels, centered as they are, would not be driven. The output chart would just show a flat line. This happens because we have not accounted for the initial conditions of the problem. In our earlier Python simulation, we needed to know the initial velocity of the ball, which we would have represented there as a constant variable or as a parameter of our Python function. Here, we account for the initial velocity and acceleration by displacing the integrator discs by the appropriate amount before the machine begins to run. + +Once we’ve done that, the rotation of rod (t) propagates through the whole system. Physically, a lot of things start rotating at the same time, but we can think of the rotation going first to integrator II, which combines it with the acceleration expression calculated based on (g) and then integrates it to get the result (\frac{dx}{dt}). This represents the velocity of the ball. The velocity is in turn used as input to integrator I, whose disc is displaced so that the output wheel rotates at the rate (\frac{dx}{dt}). The output from integrator I is our final output (x), which gets routed directly to the output table. + +One confusing thing I’ve glossed over is that there is a cycle in the machine: Integrator II takes as an input the rotation of the rod labeled ((k,\frac{dx}{dt} + g)), but that rod’s rotation is determined in part by the output from integrator II itself. This might make you feel queasy, but there is no physical issue here—everything is rotating at once. If anything, we should not be surprised to see cycles like this, since differential equations often describe rates of change in a function as a function of the function itself. (In this example, the acceleration, which is the rate of change of velocity, depends on the velocity.) + +With everything correctly configured, the output we get is a nice graph, charting both the position and velocity of our ball over time. This graph is on paper. To our modern digital sensibilities, that might seem absurd. What can you do with a paper graph? While it’s true that the differential analyzer is not so magical that it can write out a neat mathematical expression for the solution to our problem, it’s worth remembering that neat solutions to many differential equations are not possible anyway. The paper graph that the machine does write out contains exactly the same information that could be output by our earlier Python simulation of a falling ball: where the ball is at any given time. It can be used to answer any practical question you might have about the problem. + +The differential analyzer is a preposterously cool machine. It is complicated, but it fundamentally involves nothing more than rotating rods and gears. You don’t have to be an electrical engineer or know how to fabricate a microchip to understand all the physical processes involved. And yet the machine does calculus! It solves differential equations that you never could on your own. The differential analyzer demonstrates that the key material required for the construction of a useful computing machine is not silicon but human ingenuity. + +### Murdering People + +Human ingenuity can serve purposes both good and bad. As I have mentioned, the highest-profile use of differential analyzers historically was to calculate artillery range tables for the US Army. To the extent that the Second World War was the “Good Fight,” this was probably for the best. But there is also no getting past the fact that differential analyzers helped to make very large guns better at killing lots of people. And kill lots of people they did—if Wikipedia is to be believed, more soldiers were killed by artillery than small arms fire during the Second World War. + +I will get back to the moralizing in a minute, but just a quick detour here to explain why calculating range tables was hard and how differential analyzers helped, because it’s nice to see how differential analyzers were applied to a real problem. A range table tells the artilleryman operating a gun how high to elevate the barrel to reach a certain range. One way to produce a range table might be just to fire that particular kind of gun at different angles of elevation many times and record the results. This was done at proving grounds like the Aberdeen Proving Ground in Maryland. But producing range tables solely through empirical observation like this is expensive and time-consuming. There is also no way to account for other factors like the weather or for different weights of shell without combinatorially increasing the necessary number of firings to something unmanageable. So using a mathematical theory that can fill in a complete range table based on a smaller number of observed firings is a better approach. + +I don’t want to get too deep into how these mathematical theories work, because the math is complicated and I don’t really understand it. But as you might imagine, the physics that governs the motion of an artillery shell in flight is not that different from the physics that governs the motion of a tennis ball thrown upward. The need for accuracy means that the differential equations employed have to depart from the idealized forms we’ve been using and quickly get gnarly. Even the earliest attempts to formulate a rigorous ballistic theory involve equations that account for, among other factors, the weight, diameter, and shape of the projectile, the prevailing wind, the altitude, the atmospheric density, and the rotation of the earth[1][5]. + +So the equations are complicated, but they are still differential equations that a differential analyzer can solve numerically in the way that we have already seen. Differential analyzers were put to work solving ballistics equations at the Aberdeen Proving Ground in 1935, where they dramatically sped up the process of calculating range tables.[2][6] Nevertheless, during the Second World War, the demand for range tables grew so quickly that the US Army could not calculate them fast enough to accompany all the weaponry being shipped to Europe. This eventually led the Army to fund the ENIAC project at the University of Pennsylvania, which, depending on your definitions, produced the world’s first digital computer. ENIAC could, through rewiring, run any program, but it was constructed primarily to perform range table calculations many times faster than could be done with a differential analyzer. + +Given that the range table problem drove much of the early history of computing even apart from the differential analyzer, perhaps it’s unfair to single out the differential analyzer for moral hand-wringing. The differential analyzer isn’t uniquely compromised by its military applications—the entire field of computing, during the Second World War and well afterward, advanced because of the endless funding being thrown at it by the United States military. + +Anyway, I think the more interesting legacy of the differential analyzer is what it teaches us about the nature of computing. I am surprised that the differential analyzer can accomplish as much as it can; my guess is that you are too. It is easy to fall into the trap of thinking of computing as the realm of what can be realized with very fast digital circuits. In truth, computing is a more abstract process than that, and electronic, digital circuits are just what we typically use to get it done. In his paper about the differential analyzer, Vannevar Bush suggests that his invention is just a small contribution to “the far-reaching project of utilizing complex mechanical interrelationships as substitutes for intricate processes of reasoning.” That puts it nicely. + +_If you enjoyed this post, more like it come out every four weeks! Follow [@TwoBitHistory][7] on Twitter or subscribe to the [RSS feed][8] to make sure you know when a new post is out._ + +_Previously on TwoBitHistory…_ + +> Do you worry that your children are "BBS-ing"? Do you have a neighbor who talks too much about his "door games"? +> +> In this VICE News special report, we take you into the seedy underworld of bulletin board systems: +> +> — TwoBitHistory (@TwoBitHistory) [February 2, 2020][9] + + 1. Alan Gluchoff. “Artillerymen and Mathematicians: Forest Ray Moulton and Changes in American Exterior Ballistics, 1885-1934.” Historia Mathematica, vol. 38, no. 4, 2011, pp. 506–547., . [↩︎][10] + + 2. Karl Kempf. “Electronic Computers within the Ordnance Corps,” 1961, accessed April 6, 2020, . [↩︎][11] + + + + +-------------------------------------------------------------------------------- + +via: https://twobithistory.org/2020/04/06/differential-analyzer.html + +作者:[Two-Bit History][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://twobithistory.org +[b]: https://github.com/lujun9972 +[1]: http://worrydream.com/refs/Bush%20-%20The%20Differential%20Analyzer.pdf +[2]: https://sinclairtarget.com/differential-analyzer/ +[3]: https://twobithistory.org/images/diff-analyzer-viz.png +[4]: https://twobithistory.org/images/analyzer-diagram.png +[5]: tmp.GUgd146Tkg#fn:1 +[6]: tmp.GUgd146Tkg#fn:2 +[7]: https://twitter.com/TwoBitHistory +[8]: https://twobithistory.org/feed.xml +[9]: https://twitter.com/TwoBitHistory/status/1224014531778826240?ref_src=twsrc%5Etfw +[10]: tmp.GUgd146Tkg#fnref:1 +[11]: tmp.GUgd146Tkg#fnref:2 diff --git a/sources/talk/20200406 What is good documentation for software projects.md b/sources/talk/20200406 What is good documentation for software projects.md new file mode 100644 index 0000000000..7726287131 --- /dev/null +++ b/sources/talk/20200406 What is good documentation for software projects.md @@ -0,0 +1,156 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (What is good documentation for software projects?) +[#]: via: (https://opensource.com/article/20/4/documentation) +[#]: author: (Cameron Shorter https://opensource.com/users/cameronshorter) + +What is good documentation for software projects? +====== +Mixing experienced tech writers with open source communities reveals new +approaches for creating better docs. +![Typewriter with hands][1] + +The [Open Geospatial (OSGeo) Foundation][2] recently participated in Google's first [Season of Docs][3], in which Google sponsored senior technical writers to contribute to open source projects. OSGeo is an umbrella organization for around 50 geospatial open source projects. I've contributed to a number of these projects over the years and recently co-mentored the two Season of Docs technical writers Google allocated to OSGeo. + +We discovered during our involvement that, like many open source projects, we knew little about: + + * The state of our docs + * What we were aiming for + * Our priorities + * The details of the challenges we faced + * How to improve + + + +We discovered: + + * How hard it is to keep tech docs current + * Skillsets from multiple roles are needed to create good docs + * Open source's docs and writing processes are immature when compared to software development + + + +It is an exciting problem space with high-value challenges ready to be tackled. It reminds me of the early days of open source, before it became trendy with business. + +### What should tech writers work on? + +Open source communities welcomed the chance to have tech writers improve our docs and expressed a pressing need for it, but found it hard to articulate exactly what needed to be fixed: + + * People explained that their project docs often hadn't been updated between doc releases. + * Some projects had new features that had not been documented. + * Other projects had issue lists, collating observed deficiencies, but had no systematic review. + * Most observed that docs were created by developers with no formal tech writing training. + * Many noted that their English docs were written by non-native English speakers. + + + +But where should we start? We needed to decide on what we wanted and what we should work on first. + +### Defining good docs + +We then realized that we didn't have a good definition of "good documentation." For our software projects, we have a comprehensive [incubation process][4] to assess the maturity of software and the project's community, but we couldn't find a similar set of metrics to define "good documentation." So we started the [Good Docs Project][5] to collate "best-practice templates and writing instructions for documenting open source software." This helped us define what we were aiming for and prioritize what we can achieve with our available resources. + +### Documentation audit + +Once we knew what good docs looked like, we could audit the status of a project's docs: + + * What documentation do we have? + * Does it cover all the functionality? + * Does it cover end-user needs? + * Is the documentation any good? + + + +We discovered that the quality, currency, and completeness of our OSGeo docs were immature when compared to the quality of the software they described. + +### It takes a village to raise good docs + +In researching open source projects' documentation needs, it became clear that crafting good docs requires multiple skillsets. Ideally, a doc team has access to: + + * A developer with a deep understanding of the software being described + * A software user who can explain the application within the context of the application's domain + * An educator who understands the principles of learning + * An information architect who understands how to structure material + * A writer who writes clearly and concisely with good grammar + * Someone who speaks English as a first language (for English docs) + * A translator who is good at translating docs into multiple languages + * A DevOps person who can set up doc-build pipelines + * A community builder, facilitator, and coordinator who can inspire collective action, capture offers of help, and help all these different personas collaborate + + + +Technical writers usually have a high-level understanding of most of these domains, and their skills are often under-appreciated and under-utilized, especially if they are directed with a vague "just clean up the grammar and stuff." + +However, the best docs typically have been influenced by multiple stakeholders. This can be partly achieved by [using templates to collaborate][6] between domains, timeframes, projects, and organizations. + +### Tools for documenting open source projects are painful + +We experienced significant pain in trying to convert between software and [writing toolsets][7]. We love the versioning of Git, are frustrated by clunky Markdown interfaces, and want access to editing and review workflows in Word and Google Docs along with grammar and syntax plugin tools such as Grammarly. Translation tools such as Transifex are pretty cool, too. + +Could someone please write an application that addresses this use case? Maybe there is an idea in here for a future [Google Summer of Code][8]? + +### Achievements during OSGeo's Season of Docs + +We're quite proud of our achievements during OSGeo's participation in Google's Season of Docs. Our allocated tech writers amplified the effectiveness of our existing documentation communities, and our documentation communities amplified the effectiveness of these tech writers: + + * [Felicity Brand][9] worked with around 50 of OSGeo's open source projects to update the Quickstarts as part of our [OSGeoLive][10] distribution of software. + * [Swapnil Ogale][11] worked directly with [GeoNetwork's][12] documentation team, auditing the breadth and quality of docs, setting up templates for future docs, and updating many of the docs. + + + +Further: + + * We kicked off the Good Docs Project to establish "best-practice templates and writing instructions for documenting open source software." + * In conjunction with the [OGC][13] and [ISO][14] spatial standards communities, we kicked off an [OSGeo Lexicon][15] project to coordinate official definitions for terminology used within the OSGeo context. This will apply best-practice definitions to previously haphazard glossaries. + * We did a [deep-dive analysis][16] of the documentation challenges faced by QGIS, one of OSGeo's most successful projects. Surprisingly, its biggest problem isn't a lack of tech writers or complicated tools (although they are factors). Key problems center around: + * Poorly capturing community goodwill and offers of assistance + * Lack of direction + * Struggling to keep up with a rapidly evolving software baseline + * Insufficient writing expertise + * A high technical barrier to entry + * Documentation and training being generated outside of the core project + * Awkward documentation tools and processes + + + +### Thanks, Google + +We are grateful to Google for sponsoring Season of Docs. We've learned plenty from Felicity and Swapnil, the great writers that Google provided to us, and we hope what we have learned will help make future Season of Docs initiatives even better. + +* * * + +_This originally appeared on [Cameron Shorter's blog][17] and is republished with permission._ + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/4/documentation + +作者:[Cameron Shorter][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/cameronshorter +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/typewriter-hands.jpg?itok=oPugBzgv (Typewriter with hands) +[2]: https://www.osgeo.org/ +[3]: https://developers.google.com/season-of-docs +[4]: https://www.osgeo.org/about/committees/incubation/graduation/ +[5]: https://thegooddocsproject.dev/ +[6]: http://cameronshorter.blogspot.com/2019/02/inspiring-techies-to-become-great.html +[7]: https://opensource.com/article/20/3/open-source-writing-tools +[8]: https://summerofcode.withgoogle.com/ +[9]: https://flicstar.com/2019/11/27/project-report-for-season-of-docs-2019/ +[10]: https://live.osgeo.org/en/index.html +[11]: https://docs.google.com/document/d/1sTGz8aWPTS6moxgrtsBRz19roemJlilcdQk6B-9IZOo +[12]: https://geonetwork-opensource.org/ +[13]: https://www.ogc.org/ +[14]: https://committee.iso.org/home/tc211 +[15]: https://wiki.osgeo.org/wiki/Lexicon_Committee +[16]: http://cameronshorter.blogspot.com/2019/12/why-qgis-docs-team-is-struggling.html +[17]: https://cameronshorter.blogspot.com/2020/03/insights-from-mixing-writers-with-open.html diff --git a/sources/talk/20200411 5 open source activities while you work from home.md b/sources/talk/20200411 5 open source activities while you work from home.md new file mode 100644 index 0000000000..c52818f909 --- /dev/null +++ b/sources/talk/20200411 5 open source activities while you work from home.md @@ -0,0 +1,99 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (5 open source activities while you work from home) +[#]: via: (https://opensource.com/article/20/4/open-source-activities) +[#]: author: (Seth Kenlon https://opensource.com/users/seth) + +5 open source activities while you work from home +====== +Work-life balance is important whether you're working from home +temporarily or it's your usual mode of earning a living. +![Person in a field of dandelions][1] + +The mythos of the remote home office or the exciting archetype of the digital nomad are as appealing as they are dangerous. It's great to be able to avoid a commute, to be able to stay comfortable at home while getting lots of work done, and to be master of your own schedule. But along with those liberties, you inherit the responsibility of remembering to be a normal, functioning human being. Believe it or not, the two aren't mutually exclusive. You can do both, but you have to work at it. Here are some ideas on how. + +### Plant something + +![Seeeduino in the garden][2] + +You may have an abundance of little ones to care for during the day, and if you do, you should read our [article][3] about fun open source projects for kids and parents. If you don't, or if you're just keen to try caring for something that's quiet, then you might find it satisfying to plant something. + +I used to think gardening was something you did as a way to establish a routine: each morning, you wake up and tend to your plants before you start your day, each evening you might pull weeds, and so on. Now that I have a garden, I realize that it's more like a low-stress puzzle. Learning to tend to plants is a little like learning to program. You learn the basics first, you learn to debug (literally, in the case of aphids), and then you learn how to optimize growth and maybe even [how to automate plant care][4]. + +If you're not attracted to gardening, there are plenty of other [outdoor projects][5] that are useful in getting you outdoors with a purpose and encouraging you to go back out for more. + +### Go for a walk + +![Walking][6] + +The phrases "go for a walk" or "get some fresh air" are so common that they seem trite, but that doesn't make the result any less valid. Getting outside your usual workspace is vital for clarity and drive, but sometimes going outside feels a little pointless. You can only walk around the block so many times before the journey loses excitement. + +If you need a goal for ambling around your neighborhood, you can download a handy app called [StreetComplete][7]. It's a quest-based app that presents you with points of interest in your area with incomplete [Open Street Map][8] data. You can help crowdsource better open source maps by verifying and providing information through the app. Suddenly, that aimless meandering you don't really want to do is a fun quest for you and your family. + +### Diversify + +![Mini stapler][9] + +Being in an office can present exciting challenges, whether it's because you're in a dynamic industry or in a petty fight with a colleague over ownership of a stapler. When you work from home, your daily routine can get pretty, well, routine. If that's the case, it might be time to diversify. + +If you've been meaning to [get involved with open source][10], now's a great time for it. + +If you suspect you might be artistic (or even if you're convinced you're not, but you have something you want to express), then maybe it's time to finally learn how to create some [digital imagery][11]. + +Or maybe you're curious about programming. It might be easier than you think and given enough free time, you might even end up with [your own game written in Python][12]. + +### Make some music + +![Music keyboardas][13] + +Artistic expression is important, whether you're working from home or living with someone who's bored at home. The great thing about music is that you don't need to be _musical_ to [make some really cool noise][14]. In fact, you can make some [wild sounds on a Raspberry Pi][15], if you have one lying around. + +If you happen to be musical, though, you can have a go at a digital audio workstation like [Qtractor][16] or [Rosegarden][17]. For inspiration, read about a [professional composer][18] and the music festival he created. + +### Refurbish + +![Old computers][19] + +I don't like it when good things go to waste, especially computers. Read about [refurbishing old computers][20] and [really old computers][21], and then rummage around in your attic to find one for your own experiments. + +### Meet the challenge + +Being stuck at home for long periods of time, whether it's for a few weeks or the better part of your career, can be challenging. However, open source is a vast landscape of opportunity. Explore and find the parts of it that appeal to you. You can build a hobby, and maybe even a career, out of all the fun things you can do with other people's toys. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/4/open-source-activities + +作者:[Seth Kenlon][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/seth +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/OSDC_dandelion_520x292.png?itok=-xhFQvUj (Person in a field of dandelions) +[2]: https://opensource.com/sites/default/files/uploads/diversions_seeeduino.jpg (Seeeduino in the garden) +[3]: https://opensource.com/article/19/12/kids-students-education +[4]: https://opensource.com/article/17/3/arduino-garden-projects +[5]: https://opensource.com/article/19/5/hardware-outdoors +[6]: https://opensource.com/sites/default/files/uploads/diversions_walk.jpg (Walking) +[7]: https://opensource.com/article/20/1/streetcomplete-crowdsource-maps +[8]: https://opensource.com/article/17/8/openstreetmap +[9]: https://opensource.com/sites/default/files/uploads/diversions_stapler.jpg (Mini stapler) +[10]: https://opensource.com/article/17/10/open-source-cats +[11]: https://opensource.com/life/12/6/design-without-debt-five-tools-for-designers +[12]: https://opensource.com/article/17/10/python-101 +[13]: https://opensource.com/sites/default/files/uploads/diversions_keyboards.jpg (Music keyboards) +[14]: https://opensource.com/life/16/2/linux-multimedia-studio +[15]: https://opensource.com/article/20/3/sonic-pi +[16]: https://opensource.com/article/17/6/qtractor-audio +[17]: https://opensource.com/article/18/3/make-sweet-music-digital-audio-workstation-rosegarden +[18]: https://opensource.com/article/20/2/linux-open-source-music +[19]: https://opensource.com/sites/default/files/uploads/diversions_old-computers.jpg (Old computers) +[20]: https://opensource.com/article/19/7/how-make-old-computer-useful-again +[21]: https://opensource.com/article/20/2/restore-old-computer-linux diff --git a/sources/talk/20200414 How World of Warcraft introduced me to Linux.md b/sources/talk/20200414 How World of Warcraft introduced me to Linux.md new file mode 100644 index 0000000000..b1836ccb43 --- /dev/null +++ b/sources/talk/20200414 How World of Warcraft introduced me to Linux.md @@ -0,0 +1,82 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How World of Warcraft introduced me to Linux) +[#]: via: (https://opensource.com/article/20/4/wow-linux) +[#]: author: (Luke Rawlins, RHCE https://opensource.com/users/sudoluke) + +How World of Warcraft introduced me to Linux +====== +One Linux sysadmin traces his journey from video-gaming car mechanic to +a new career in IT. +![Gaming with penguin pawns][1] + +The story behind my career with [Linux][2] is a bit unusual. It starts back in 2005; I was working as an auto mechanic at a Nissan dealership in Toledo, Ohio. I had never used a computer for anything other than checking email, browsing the web, and playing World of Warcraft. + +I had never heard of Linux, I didn't know the term "open source," I probably couldn't even have walked you through how to copy a file from one place to another, and I certainly never thought that I would eventually find myself working in IT or running a website. + +### The "Blue Screen of Death" that changed my life + +I mentioned that I liked to play World of Warcraft (I still do, you can find me on my Mage "Elodinn—Twisting Nether" most of the time). This game was a huge hit in the early 2000s, and it consumed an enormous amount of my time (truth be told, probably a little too much of my time). + +You can imagine my horror one evening when I boot up my PC to be greeted by a blue screen with lots of cryptic messages, including "A problem has been detected…" Hmm weird, maybe I'll just unplug it and plug it back in—that works around the shop sometimes. No such luck, the same message comes up. Over and over, to no avail. + +### How do you fix this? + +So I called a friend and explained the problem. [Big blue screen][3]. Lots of little white letters. I'm going to miss the raid! + +He wasn't sure but said something about drivers, or maybe a hardware problem. I ended up calling around to a few computer repair shops to see if they could fix it. They all said the same thing after I read the message on the screen, and explained the problem to them. "I really can't be sure over the phone, but it sounds like the motherboard is bad. It's going to be $95 for diagnostics and I should be able to get it back to you in about a week." + +There was no way I was going to pay $95 for a diagnostic on an old crappy computer just to be told that either I needed a new one, or that the repair was going to be even more money on top of the diagnostic fee. So I thought to myself, if I can fix a car, then I can definitely fix this little computer. It was broken anyway; what was the worst that could happen? I end up breaking it more and need a new one? I was already in that situation. + +So I spent the next couple of days at work doing some research on computer parts, in between cars. I found out that replacing the motherboard meant that I was probably going to need a new processor. I found a motherboard/processor combo on Newegg for a decent price that I was fairly confident would work on my computer. Great! + +I ordered the parts, and a few days later, after printing out a few instructions, I had swapped out the motherboard and replaced it with my new hardware from Newegg. I was incredibly proud of my new found skills and naturally assumed that I was some kind of elite hacker. That is, until I started the computer up. + +I don't know if you know this, but Windows XP didn't like it when you replaced a lot of parts in your computer. I didn't know it at the time either, but now I had spent probably $150 because I didn't want to pay $95 for a diagnostic, and my computer was still broken. + +### The deep dark web has all the answers + +The next day, once again, I'm using all my breaks to research what went wrong. Pretty quickly I realized that my problem was tied to the fact that I needed a new Windows license. I also realized that there was no way I was going to purchase the software. I'd get a new computer before I purchased a new Windows license. But I wasn't quite ready to give up yet. + +One click leads to another, and I end up on a computer repair forum with someone complaining about a similar problem. All the replies are basically the same—buy a Windows license or buy a new PC—but one. Near the bottom of the forum, some unknown hero of the internet says, "You can always give Ubuntu a try." and leaves it at that. + +"What's Ubuntu?" I said to myself, "and how on earth do you even pronounce that word?" + +Anyway, after some more intensive searching, I found out that Ubuntu is a free operating system that is widely considered to be one of the most user-friendly Linux distributions (whatever that is) that you can get. What's more, I found a book that included an installation CD available at the Barnes and Noble bookstore that I passed on my way home from work. Why not give Ubuntu a try? After all, the computer was already broken, and the book was only $18.99. + +### This story is already too long + +I wish I still had that book. I think I sold it with a box full of old books at a garage sale when we moved a few years ago. I wanted to share my Linux story because it's different than many of the other stories I read about. I was not a college graduate at the time, I didn't learn to code as a child, and I am not an exceptionally intelligent person. I was, at best, an average student, a recently separated Marine, and I assumed that fixing computers couldn't be much different from fixing cars. At the end of the day, you're still just swapping out different parts, right? Different tools, different parts, same job—no problem. + +Along the way I ran into a lot of problems, the first one was the discovery that after all that work, I still couldn't play World of Warcraft. Eventually, I discovered WineHQ and Open Office, and all the incredible things that have come out of the open-source world. That mysterious blue screen and my World of Warcraft obsession redirected the course of my entire working life, for the better. That's an odd thing to admit, but it's probably true. + +### How does the story end? + +Well, it's not over, and I still have a lot to learn. After some frustrating trial and error, I did eventually learn how to install World of Warcraft using Wine. I missed a few weeks in the game, but I didn't lose my raid spot in the guild, and all things considered, I was no worse for the wear. At the time, I was playing a Druid, and everyone always had room for a healer when it came time to battle Ragnaros, the Fire Lord! + +Up to this point, however, my little computer repair project has turned into a wonderful career as a Linux systems administrator, a bachelor's degree, a whole bunch of IT certifications, including the Red Hat Certified Engineer certification, and a [blog][4] that I use as my way of giving back to the community that has given me so much. + +So, if you are like me, a person who is at best moderately intelligent, persistent, incredibly cheap, and not afraid to break a few things, go ahead and try out Linux the next time your computer breaks. + +I'm excited. I mean really excited. Excited to the point that I can hardly think. I'm talking six-... + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/4/wow-linux + +作者:[Luke Rawlins, RHCE][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/sudoluke +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/gaming_grid_penguin.png?itok=7Fv83mHR (Gaming with penguin pawns) +[2]: https://opensource.com/resources/linux +[3]: https://en.wikipedia.org/wiki/Blue_screen_of_death +[4]: https://sudoedit.com diff --git a/sources/talk/20200415 Fedora Origins - Part 01.md b/sources/talk/20200415 Fedora Origins - Part 01.md new file mode 100644 index 0000000000..43c381958e --- /dev/null +++ b/sources/talk/20200415 Fedora Origins - Part 01.md @@ -0,0 +1,126 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Fedora Origins – Part 01) +[#]: via: (https://fedoramagazine.org/fedora-origins-part-01/) +[#]: author: (Sylvia Sánchez https://fedoramagazine.org/author/lailah/) + +Fedora Origins – Part 01 +====== + +![][1] + +_Editor’s comment:_ The format of this article is different from the usual article that Fedora Magazine has published: a Fedora origins story told from the point of view of a Fedora user. The author has chosen to tell a story, since to simply present the bare facts is akin to just reading the wiki page about it. + +### Hello World! + +Hello, I am… no, I’m not going to give my real name. Let’s say I’m female, probably shorter and older than you. I used to go by the nick of Isadora, more on that later. + +![Here you have one of the old RH boxes][2] + +Now some context. Back in the late ’90s, internet became popular and PCs started to be a thing. However, most people didn’t have either because it was very expensive and often you could do better with the traditional methods. Yes, computers were very basic back then. I used to play with these pocket games that were fascinating at the time, but totally lame now. Monochrome screens with pixelated flat animations. Not going to dive there, just giving an idea how it was. + +In the mid-90s a company named Red Hat emerged and slowly started to make a profit of its own by selling its own business-oriented distribution and software utilities. The name comes from one of its founders, Marc Ewing, who used to wear a red lacrosse in university so other students could spot him easily and ask him questions. +Of course, as it was a business-oriented distribution, and I was busy with multiple other things, I didn’t pay much attention to it. It lacked the software I needed and since I wasn’t a customer, I was nobody to ask for additions. However, it was Linux and as such Open Source. People started to package stuff for RHL and put it in repositories. I was invited to join the community project, Fedora.us. I promptly declined, misunderstanding the name. It was the second time I got invited that I asked ‘what is with the “US” there (in the name)?` Another user explained it was ‘us’ as in ‘we’ not as in the ‘United States.’ They explained a bit about how the community worked and I decided to give it a go. + +Then my studies got in the way, and I had to shelve it. + +![Login Screen in Fedora Core][3] + +### Press Return + +By the time I came back to Fedora.us it had changed its name to Fedora Project and was actively being worked on from within Red Hat. Now, I wasn’t there so my direct knowledge of how this happened is a bit foggy. Some say that Fedora existed separately and Red Hat added/invited them, some say that Fedora was completely RH’s idea, some say they existed independently and at some point met or joined. Choose the version you like, I’ll put some links down there so you can know more details and decide for yourself. As far as I’m concerned, they worked together. + +Well, as usual someone dropped some CDs with ISOs for me. If I had an euro for every ISO I’ve been offered, or had tossed at my desk, for me to try it, I would be rich. As a matter of fact, I’m not rich but I do have a big rack full of old distros. + +_Anyways_… + +Now it’s the early 2000s and things have changed dramatically. Computers’ prices have dropped and internet speed is increasing, plus a set of new technologies make it cheaper and more reliable. Computers now can do so much more than just a decade ago, and they’re smaller too. Screens are bigger, with better colors and resolution. Laptops are starting to become popular though still expensive and less powerful than desktop PCs. + +During this time, I tried both Fedora and Red Hat. Now, as has been said before, Red Hat focuses on businesses and companies. Their main concern is having exactly the software their customers need, with the features their customers need, delivered as rock solid stability and a reliable update & support cycle. A lot of customization, variety of options and many cool new features are not their main core. More software means more testing and development work and bigger chances of things failing. Yet the technology industry is constantly changing and innovating. Sticking too much to older versions or proven formulas can be fatal for a company. + +So what to do? Well, they solved it with Fedora. Fedora Project would be the innovative, looking ahead test bed, and Red Hat Enterprise Linux was the more conservative, rock solid operating system for businesses. Yes, they changed the name from Red Hat Linux to Red Hat _Enterprise_ Linux. Sounds better, doesn’t it? + +Unsurprisingly, Fedora had a fame of being difficult, unstable and for “hackers only”. Whenever I said I was using Fedora, they would give me odd looks or say something like “I want something stable” or “I’m not into _that_” (meaning they didn’t fancy programming/hacking activities). Countless individuals suggested I might want to use one of the other, beginner-friendly distributions, without themselves even giving Fedora a try! Many would disregard Linux as a whole as an amateur thing, only valid for playing but not good for serious work and companies. To each their own, I suppose. + +![Note the F and the bubble already there][4] + +### Yes, but why? + +Those early versions were called Fedora Core and had a very uncertain release pattern. The six months cycle came much later. Fedora Core got its name because there were two repositories, Core and Extras. Core had the essentials, so to speak, and was maintained by Red Hat. Extras was, well, everything else. Any software that most users would want or need was included there, and it was maintained by a wide range of contributors. + +From the beginning, one of the most powerful reasons for me to use it was the community and its core values. The _Four Foundations_ of Fedora, _Freedom, Features, First & Friends_ were lived and breathed and not just a catchy line on a website or a leaflet. Fedora Project strove (and still does) to deliver the newest features first, caring for freedom (of choice and software) and keeping a good open community, making friends as we contribute to the project. + +I also liked the fact that Fedora, as its purpose was testing for Red Hat, delivered a lot of new software and technologies; it was like opening the window to see the future today. + +The downside was its unreliable upgrade cycle. You could get a new version in a few months or next year… nobody knew, there was no agreed schedule. + +![Note how, despite being Fedora, RH’s logo and signature is omnipresent][5] + +### What was in the box + +Fedora Core kept this name up to the sixth version. From the start, it was meant to be a distribution you could use right after installing it, so it came with Gnome 2, KDE 3, OpenOffice and some browser I forgot, possibly Firefox. + +I remember it being the first to introduce SELinux and SystemD by default, and to replace LILO with GRUB. I also remember the hardware requirements were something at the time, although they now sound laughable: Pentium II 400MHz, 256MB RAM (yes, you read it right) and 2GB of space in disk. It even had an option for terminal only! This would require only 64MB RAM and Pentium II 200MHz. Amazing, isn’t it? + +It had codenames. Not publicly, but it had, and they were quite peculiar. Fedora Core 1 was code named «Yarrow» which is a medium size plant with yellow or white crown-like flowers. Core 2 was Tettnang which is a small town in Baden-Württemberg, Germany. Not sure about Core 3, I think it was Heidelberg, but maybe I’m mixing with later releases. Core 4 was Stentz, if I recall correctly (no idea what it means), Core 5 was a colour, I think Bordeaux, and Core 6 was Zod that _I think_ it was a comic character but I could be wrong. If there was a method in their madness I have no idea. I thought the names amusing but didn’t give a second thought to it as they didn’t affect anything, not even the design of each release. + +![Ah… good ol` genetic helix][6] + +### So what now? + +Well, of course, Fedora Project has evolved from where we have stopped. But that’s for later articles or this one will be too long. For now, I leave you with an extract of an interview with Matthew Miller, current Project Leader and some links in case you want to know more. + +_**Extracts to interview with Matthew Miller, Project Leader.**_ + +Matthew Miller tells about the beginnings in Eduard Lucena’s podcast (transcription [here][7]): _“Fedora started about 15 years ago, really. It actually started as a thing called Fedora.us.” Back in those days, there was Red Hat Linux.” “Meanwhile, there was this thing called Fedora.us which was basically a project to make additional software available to users of Red Hat Linux. Find things that weren’t part of Red Hat Linux, and package them up, and make them available to everybody. That was started as a community project.”_ + +_“Red Hat_ (then) _merged with this [Fedora.us][8] project to form Fedora Project that produces an upstream operating system that Red Hat Enterprise Linux is derived from but then moves on a slower pace.”_ + +_“We were then two parts, Fedora Core, which was basically inherited from the old Red Hat Linux and only Red Hat employees could do anything with and then Fedora Extras, where community could come together to add things on top of that Fedora Core. It took a little while to get off the ground but it was fairly successful”_ + +“_Around the time of Fedora Core 6, those were actually merged together into one big Fedora where all of the packages were all part of the same thing. There was no more distinction of Core and Extras, and everything was all together and, more importantly, all the community was all together._ + +_They invited the community to take ownership of the whole thing and for Red Hat to become part of the community rather than separate. That was a huge success.”_ + +_**Links of interest**_ + +**Fedora, a visual history** +[https://www.phoronix.com/scan.php?page=article&item=678&num=1][9] + +**Red Hat Videos – Fedora’s anniversary** + + +**Red Hat Videos – Default to open** + + +**Fedora’s Mission & Foundations** + + +**A short history of Fedora** + + +-------------------------------------------------------------------------------- + +via: https://fedoramagazine.org/fedora-origins-part-01/ + +作者:[Sylvia Sánchez][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://fedoramagazine.org/author/lailah/ +[b]: https://github.com/lujun9972 +[1]: https://fedoramagazine.org/wp-content/uploads/2020/04/fedora-origins-816x352.png +[2]: https://fedoramagazine.org/wp-content/uploads/2020/03/IMG_0554-768x1024.jpeg +[3]: https://fedoramagazine.org/wp-content/uploads/2020/04/15112-1.png +[4]: https://fedoramagazine.org/wp-content/uploads/2020/04/Fedora_Core_5.png +[5]: https://fedoramagazine.org/wp-content/uploads/2020/04/Fedora_Core_3.png +[6]: https://fedoramagazine.org/wp-content/uploads/2020/04/Artwork_FC7Themes_Fc7ThemeProposalFlyingHigh_Fc7ThemeProposalFlyingHighRhgl_rhgb-core6-1.png +[7]: https://x3mboy.fedorapeople.org/podcast/transcripts/transcriptFedoraPodcastEpisode01.html +[8]: http://fedora.us/ +[9]: https://www.phoronix.com/scan.php?page=article&item=678&num=1 diff --git a/sources/talk/20200415 How to dispose of IT hardware without hurting the environment.md b/sources/talk/20200415 How to dispose of IT hardware without hurting the environment.md new file mode 100644 index 0000000000..511720d7fd --- /dev/null +++ b/sources/talk/20200415 How to dispose of IT hardware without hurting the environment.md @@ -0,0 +1,102 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How to dispose of IT hardware without hurting the environment) +[#]: via: (https://www.networkworld.com/article/3537928/how-to-dispose-of-it-hardware-without-hurting-the-environment.html) +[#]: author: (Andy Patrizio https://www.networkworld.com/author/Andy-Patrizio/) + +How to dispose of IT hardware without hurting the environment +====== +Find certified recyclers and disposal firms in order to know that the retirement of your old electronics gear is handled safely. +[Angelo Tsirekas][1] [(CC BY 3.0)][2] + +Many enterprises don’t think much about where their obsolete IT gear winds up, but it’s possible to be green-minded, not bust the budget, and even benefit a little from proper disposal. Here is how. + +### Go back to where you bought + +The first option to consider is returning the equipment the vendor or reseller you bought it from, says Susan Middleton, research director, financing strategies at IDC. “Every year we ask customers, ‘How do you handle end-of-lease?’ Overwhelmingly, they return to vendor or partner who are better equipped to handle recycling,” she says. + +[[Get regularly scheduled insights by signing up for Network World newsletters.]][3] + +Vendors often give a fair-market buyout for the devices that can go toward new products, Middleton says. “The big players like IBM and HPE do a great job because they can clean them up and resell them, and the facilities to do that are pretty big,” she says. + +### Vet disposal firms + +If that’s not an option,  and you have to find a disposal company – an IT Asset Disposition (ITAD) service – on your own, the first thing to check is whether it is properly certified, says Mike Satter, CEO of IT asset disposal and [data-center][4]-decommissioning provider OceanTech. Proper certification starts with a [Responsible Recycling (R2) certification][5]. + +R2s are administered by [Sustainable Electronics Recycling International][6] (SERI), a non-profit organization dedicated to the responsible reuse, repair, and recycling of electronic products. It sets the R2 standard and audits ITAD providers that carry the standard to make sure they are in compliance with the standard. Being responsible means creating a paper trail that shows the electronic waste – which contains heavy metals including arsenic, beryllium, cadmium, chromium, cobalt, indium, lead, mercury, nickel, and thallium, and are toxic in high enough doses – is reused, recovered or recycled. + +Some disposal firms dump old gear in general landfills or export them to other countries where regulations aren’t as strong.   + +“Any ITAD service provider that does not carry an R2 certification cannot fully guarantee zero landfill or zero export of materials,” says Satter. “Many recyclers will say they are compliant, but without verified certifications you’re taking a chance.” + +[][7] + +Mark Dobson, IT asset disposal security specialist with NextUse, a firm that removes and the resells second-hand IT assets, cites six disposal certifications that companies should look for: [R2][5],  [e-Stewards][8],  [NAID][9], [NAID AAA][10] (which has greater certification of regulatory compliance), [ISO 14001][11], and ISO 18001. “R2 would be the floor,” he says. + +Briefly, here’s what these certifications do. + + * **e-Stewards** is a standard set by the Basel Action Network in Sweden, which recognizes electronics recyclers that adhere to the most stringent environmentally and socially responsible practices when recovering hazardous electronic materials. In particular it is focused on making sure it was not shipped off to poor countries, where underage workers were exposed to toxic materials in careless work conditions. + * **NAID and NAID** AAA certification are set by The National Association of Information Destruction, a standards body that sets rules for the proper disposal of information devices, like hard drives. + * **ISO 14001** is a management framework for organizations to “achieve the intended outcomes of its environmental management system, which provide value for the environment, the organization itself and interested parties.” Outcomes of the framework should enhance environmental performance, fulfill compliance obligations and achieve environmental objectives. ISO is the International Organization of Standards, a global standards body. + * **ISO 18001** is the international standard for health and safety management systems. + + + +Dobson says ITAD companies that do it right are using one or more of the certification standards for data security and responsible recycling, and getting and maintaining those standard takes substantial initial and on-going investment in facilities, equipment, hardware, software, personnel, policies and procedures. + +“When those vendors charge more for their services, it is to cover those expenses, not to be excessively profitable,” he says. “Companies that do it the cheap way are skipping many if not all of those investments.” + +If an e-waste company says they will take retired equipment for free, consider that a red flag, says Satter. “Compliant e-waste companies have to hire vetted/credentialed employees, which must pass background checks to ensure compliance is delivered,” Satter says. “All of that costs money.” + +But the additional cost of using a certified company is minor. “We’re not talking hundreds of thousands of dollars,” says Dobson. “Even on the biggest job, it’s a few thousand dollars difference between the right way and the cheap way. For your average client, you’re talking thousands of dollars between the best vendors possible and totally half-assing it with the cheapest vendor that’s not operating in anyone’s best interest but their own.” + +### Penalties + +State environmental laws about illegal disposal are mainly enforced by state attorneys general. In addition, various federal agencies enforce violations of their agency's laws and regulations. + +Satter thinks enforcement needs to be tougher. “It will take the federal government to create extreme enforcement measures to ensure our e-waste is handled properly. The CEO or owner of companies should be arrested if they violate illegal e-waste dumping laws or knowingly exports e-waste to developing countries,” he says. + +In one case, two executives of a Seattle e-waste recycling company got [28 months in jail][12] for improper disposal of e-waste. In that case, it was e-Stewards that got wise to their illegal activities and turned them in to the Washington state AG. + +But that’s an exception, not the rule. Dobson says he sees very little enforcement. “The regulations are in place but spotily enforced, and penalties are not incentivizing. A lot of this is viewed as the cost of doing business. They build the fines for if they get caught into the cost of disposal,” he says. + +Fines for illegal dumping of old IT assets, are determined by the size of the violation, the clean-up cost, and the guidelines in the state or federal law. AT&T got one of the largest fines on record in 2014 for illegal disposal of e-waste, socked with a [$52 million fine][13]. Two years later, Apple got a spanking of $450,000 for its own [illegal dumping][14]. + +Middleton says first and foremost companies should ask for a paper trail to verify proper handling and disposal of assets from the moment they are picked up. “Ask about who certifies that your [disposal] partners are doing it correctly. When you don’t get a good answer, you walk away,” she says. + +But she says she thinks most firms are legit. “Anyone that’s lasted in this business isn’t shady. The majority that have been around a while are responsible,” says Middleton. + +Join the Network World communities on [Facebook][15] and [LinkedIn][16] to comment on topics that are top of mind. + +-------------------------------------------------------------------------------- + +via: https://www.networkworld.com/article/3537928/how-to-dispose-of-it-hardware-without-hurting-the-environment.html + +作者:[Andy Patrizio][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.networkworld.com/author/Andy-Patrizio/ +[b]: https://github.com/lujun9972 +[1]: https://en.wikipedia.org/wiki/Kerbside_collection#/media/File:ACT_recycling_truck.jpg +[2]: https://creativecommons.org/licenses/by/3.0/legalcode +[3]: https://www.networkworld.com/newsletters/signup.html +[4]: https://www.networkworld.com/article/3223692/what-is-a-data-centerhow-its-changed-and-what-you-need-to-know.html +[5]: https://sustainableelectronics.org/r2-standard +[6]: https://sustainableelectronics.org/ +[7]: https://www.networkworld.com/blog/itaas-and-the-corporate-storage-technology/?utm_source=IDG&utm_medium=promotions&utm_campaign=HPE22140&utm_content=sidebar (ITAAS and Corporate Storage Strategy) +[8]: http://e-stewards.org/ +[9]: https://naidonline.org/ +[10]: https://naidonline.org/certifications/why-become-certified/ +[11]: https://www.iso.org/iso-14001-environmental-management.html +[12]: https://www.theverge.com/2019/12/4/20992240/e-waste-recycling-electronic-basel-convention-crime-total-reclaim-fraud +[13]: https://www.reuters.com/article/us-usa-at-t-california/att-to-pay-california-52-million-in-hazardous-waste-disposal-settlement-idUSKCN0J50AG20141121 +[14]: https://www.mercurynews.com/2016/12/06/apple-to-pay-450000-after-allegations-of-hazardous-waste-violations/ +[15]: https://www.facebook.com/NetworkWorld/ +[16]: https://www.linkedin.com/company/network-world diff --git a/sources/talk/20200415 IBM extends z15 mainframe family, intensifies Linux security.md b/sources/talk/20200415 IBM extends z15 mainframe family, intensifies Linux security.md new file mode 100644 index 0000000000..2ec127350a --- /dev/null +++ b/sources/talk/20200415 IBM extends z15 mainframe family, intensifies Linux security.md @@ -0,0 +1,75 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (IBM extends z15 mainframe family, intensifies Linux security) +[#]: via: (https://www.networkworld.com/article/3537678/ibm-extends-z15-mainframe-family-intensifies-linux-security.html) +[#]: author: (Michael Cooney https://www.networkworld.com/author/Michael-Cooney/) + +IBM extends z15 mainframe family, intensifies Linux security +====== +IBM continued to reshape the mainframe with an eye toward further integrating it within hybrid clouds and further securing Linux-based workloads. +Kali Linux / nevarpp / Getty Images + +IBM continued to reshape the [mainframe][1] with an eye toward further integrating it within hybrid clouds and securing [Linux][2]-based workloads. + +On the hardware side, IBM rolled out two entry-level, 19” single-frame, air-cooled platforms, the  [z15 Model T02][3] and [LinuxONE III Model LT2][4]. The new machines are extensions of the IBM z15 family that [Big Blue rolled out in September][5] of last year.  + +Both can fit in cloud [data-center][6] racks and can be outfitted with a second drawer, should customers need to grow capacity.  Both feature 65 cores using commercial processors running at 4.5GHz and can be configured to support all manner of workloads.  + +[[Get regularly scheduled insights by signing up for Network World newsletters.]][7] + +IBM said new machines support z/OS Container Extensions that enable access to an ecosystem of open-source and Linux-on-IBM Z applications that may be deployed within the native z/OS environment without requiring a separate Linux server, using Docker container skills and patterns. In addition customers can use the latest open-source tools, popular NoSQL databases, analytics frameworks and application servers, IBM said. + +The LinuxONE Model LT2 can run a number of Linux systems including [Red Hat Enterprise Linux][8], SUSE and Ubuntu, alone or side by side with IBM z/VM environments on a single physical server. The IBM LinuxONE server can run Linux workloads independently on a single server. + +Both systems support IBM’s prepackaged Cloud Paks, which include a secured Kubernetes container and containerized IBM middleware designed to let customers quickly spin-up enterprise-ready containers, the company said. IBM has standard Cloud Paks for data, application, integration, automation and multicloud management and security. The idea is to help customers develop, deploy, and manage cloud-native applications for the z15 family, IBM stated. + +Security and privacy features are key for the z15 and those have been extended with the introduction of IBM Secure Execution for Linux for the all z15 models.  In a [blog post][9] about the security extensions, IBM stated that at its core, a Secure Execution provides a KVM-based virtual machine that is fully isolated and protected from the hypervisor with encryption keys that only the IBM Z hardware and firmware have access to. + +[][10] + +“In practice, an encrypted Linux image is created using the host public key and a customer-specific key. Since the encryption keys are stored on the IBM Z hardware and firmware, the encrypted image can only be executed in a virtual machine on the host(s) it has been prepared for, and the image can’t be decrypted or tampered with outside of the designated host(s). In addition, your unencrypted virtual machine memory cannot be accessed by the host operating system either,” IBM stated. “Applications are then run inside of that virtual machine, allowing the owner of the application to focus on just disk and network data encryption, both of which can be easily handled in userland.” + +In an environment where [customers are running Kubernetes][11] across servers running on x86 and Linux on Z systems, you can deploy the Secure Execution containers specifically for the applications you want to have protected, like sensitive databases and blockchain services. In this model, Kubernetes still manages the orchestration of containers, both on x86 and IBM Z, but it has no access to the data inside the Secure Execution environment container, IBM stated.  + +With Secure Execution IBM is trying to mitigate insider threats to enterprise data. + +From 2016 to 2019, the average number of incidents involving employee or contractor negligence has increased from 10.5 to 14.5–and the average number of credential theft incidents per company has tripled over the past three years, from 1.0 to 3.2, According to the [Ponemon Institute’s 2020 Cost of an Insider Breach Report][12], IBM stated.  “IBM Secure Execution for Linux helps to mitigate these concerns by enabling clients to isolate large numbers of workloads with granularity and at scale, within a trusted execution environment.” + +The z15 family already supports what IBM calls [Data Privacy Passports][13] that promise to let customers control privacy and security by defining how all data is accessed, stored and shared. The idea is to let customers  protect and provision data and revoke access to that data at any time, not only within the z15 environment but across an enterprise's hybrid [multicloud][14] environment, IBM stated.  + +The new systems and software are expected to be available by mid-May.  z15 T02 pricing starts at $160,000 but each machine is built to order so prices vary. + +Join the Network World communities on [Facebook][15] and [LinkedIn][16] to comment on topics that are top of mind. + +-------------------------------------------------------------------------------- + +via: https://www.networkworld.com/article/3537678/ibm-extends-z15-mainframe-family-intensifies-linux-security.html + +作者:[Michael Cooney][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.networkworld.com/author/Michael-Cooney/ +[b]: https://github.com/lujun9972 +[1]: https://www.networkworld.com/article/3446140/enterprises-find-a-new-use-for-mainframes-blockchain-and-containerized-apps.html +[2]: https://www.networkworld.com/article/3215226/what-is-linux-uses-featres-products-operating-systems.html +[3]: https://www-01.ibm.com/common/ssi/cgi-bin/ssialias?infotype=AN&subtype=CA&htmlfid=897/ENUS120-006&appname=USN +[4]: https://www-01.ibm.com/common/ssi/cgi-bin/ssialias?infotype=AN&subtype=CA&htmlfid=897/ENUS120-014&appname=USN +[5]: https://www.networkworld.com/article/3438542/ibm-z15-mainframe-amps-up-cloud-security-features.html +[6]: https://www.networkworld.com/article/3223692/what-is-a-data-centerhow-its-changed-and-what-you-need-to-know.html +[7]: https://www.networkworld.com/newsletters/signup.html +[8]: https://www.redhat.com/en/blog/enterprise-linux-all-architectures-bringing-red-hat-enterprise-linux-ibm-z15-and-linuxone-iii-single-frame-systems?sc_cid=701f2000000txokAAA&utm_source=bambu&utm_medium=social&utm_campaign=Partner +[9]: https://developer.ibm.com/blogs/inside-the-new-ibm-z15-t02-and-linuxone-iii-lt2/ +[10]: https://www.networkworld.com/blog/itaas-and-the-corporate-storage-technology/?utm_source=IDG&utm_medium=promotions&utm_campaign=HPE22140&utm_content=sidebar (ITAAS and Corporate Storage Strategy) +[11]: https://www.networkworld.com/article/3536654/ibm-taps-new-leaders-for-hybrid-cloud-battles-ahead.html +[12]: https://www.ibm.com/downloads/cas/LQZ4RONE +[13]: https://developer.ibm.com/blogs/data-privacy-passports-for-developers/ +[14]: https://www.networkworld.com/article/3429258/real-world-tools-for-multi-cloud-management.html +[15]: https://www.facebook.com/NetworkWorld/ +[16]: https://www.linkedin.com/company/network-world diff --git a/sources/talk/20200415 Network World 2020 State of the Network- SD-WAN, edge networking and security are hot.md b/sources/talk/20200415 Network World 2020 State of the Network- SD-WAN, edge networking and security are hot.md new file mode 100644 index 0000000000..7e9543e099 --- /dev/null +++ b/sources/talk/20200415 Network World 2020 State of the Network- SD-WAN, edge networking and security are hot.md @@ -0,0 +1,96 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Network World 2020 State of the Network: SD-WAN, edge networking and security are hot) +[#]: via: (https://www.networkworld.com/article/3537559/state-of-the-network-sd-wan-edge-networking-and-security-issues-heat-things-up.html) +[#]: author: (Michael Cooney https://www.networkworld.com/author/Michael-Cooney/) + +Network World 2020 State of the Network: SD-WAN, edge networking and security are hot +====== +Network World survey finds 5G, IoT, server consolidation and WAN optimization top priorities. +[orna wachman / Pixabay][1] [(CC0)][2] + +Networking trends including [SD-WAN][3], edge and [5G][4] technology dominate the plans of IT executives and management as they look to develop efficient, bulletproof enterprise communications strategies for the future. + +Those trends and others such as network security, server consolidation and WAN optimization were cited as primary IT drivers of future investment, according to Network World's 2020 State of the Network report. + +[[Get regularly scheduled insights by signing up for Network World newsletters.]][5] + +The  survey tapped 268 IT executives and management personnel with primary networking responsibilities for their organization to find out what initiatives are motivating the move to a more digital business environment. + +### SD-WAN and WAN optimization + +The survey found that 58% of respondents said SD-WAN can improve bandwidth efficiency, and 55% said it will expand connectivity options. 48% said it will encourage [hybrid cloud][6] and 41% said it would encourage multi-cloud adoption. The Network World survey found that the increased use of containers and cloud-based applications that need access from the edge is also driving the use of SD-WAN technologies. + +There are a few differences by company size: 63% of enterprises say SD-WAN will improve the bandwidth efficiency for its cloud resources compared to 55% of SMBs. Close to half (46%) of enterprises expect SD-WAN to encourage multi-cloud, while only 26% of SMBs agree, perhaps because multicloud is less prevalent in smaller organizations, the survey stated. + +The State of the Network survey found that 44% of organizations are currently piloting or using SD-WAN, and another 28% have it on their radar. Organizations expect SD-WAN to improve management and monitoring (52%), increase resiliency (51%), improve network security (50%) and prioritize business-critical traffic (46%), the survey stated. + +It will probably come as little surprise that the technologies around SD-WAN are hot. In separate recent survey reports, analyst firm IDC says that 95% of enterprises will be using [SD-WAN][7] technology within two years, and that 42% have already deployed it. IDC also says the SD-WAN infrastructure market will hit $4.5 billion by 2022, growing at a more than 40% yearly clip between now and then. + +[][8] + +“The growth of SD-WAN is a broad-based trend that is driven largely by the enterprise desire to optimize cloud connectivity for remote sites,” Rohit Mehra, vice president, network infrastructure at IDC [said recently][9]. Going forward, the addition of features such as cloud-based application insights and performance monitoring will be a key part of SD-WAN rollouts, Mehra said. + +Cisco has talked about the growth of multicloud networking motivating many businesses to re-tool their networks in favor of SD-WAN technology, Cisco wrote recently. SD-WAN is critical for businesses adopting cloud services, acting as a connective fabric between the campus, branch, [IoT][10], [data center][11] and cloud. + +While SD-WAN is popular, its predecessor, WAN optimiization, is still in heavy use. The IDG survey found that more than half of organizations (53%) are currently piloting or using WAN optimization, which was traditionally centered around a single centralized hub or data center where an organization’s applications and data are hosted. With widely disparate user communities, many enterprises are now viewing new application-centric or regionally distributed architecture as a way to replace MPLS sprawl with purpose-built regional hubs, the survey stated. + +### Edge is big + +Often associated with SD-WAN, edge computing is also a high priority for customers in the Network World study, which found that more than one-third of organizations surveyed (36%) already have edge computing tools in production or are piloting initiatives, and another 25% are actively researching the technology. + +Edge computing is driven by a number of factors. Gartner research says that by 2023, more than 50% of enterprise-generated data will be created and processed outside the [data center][11] or cloud, up from less than 10% in 2019. + +Hand-in-hand with that change is a shift in what technologies are supported at the edge of the network, and that means information processing, content collection and delivery are placed closer to the sources, repositories and consumers of this information. Edge networking tries to keep the traffic and processing local to reduce latency, exploit the capabilities of the edge and enable greater autonomy at the edge, Gartner says. + +The Network World survey stated that [edge-computing][12] adopters expect the technologies  to reduce network latency and operational expenses, allow real-time data processing and save bandwidth. It is also expected to preserve uptime and resilience by reducing the number of network failures, providing an [IoT][10] security framework and reducing the impact of data-center outages. + +Despite all of the virtues of edge computing, security concerns are still on the minds of the vast majority of respondents (77%). More than half of those surveyed believe that  edge devices were not built with security in mind (55%), that the need for middleware creates an additional attack surface (51%) and that there are many other potential attack vectors due to the heterogeneous computing environment (51%). + +The survey stated that 69% of respondents implementing edge computing said network security has already been or will be affected, and 55% said their network management will be affected. Additionally, 49% said their cloud will be affected, perhaps because edge computing has the ability to reduce the amount of data that needs to be processed in theh cloud. + +### Security is a hot spot + +The "State of the Network" survey found there are a variety of data-center security concerns. Topping the list are DDoS attacks, which are aimed at disrupting and disabling internet services, and web application attacks where attackers target vulnerable web servers and install malicious code. + +Organizations are taking a variety of actions when it comes to mitigating these security risks, according to the study. For example the survey found that for 88% of respondents, [firewalls][10] are still the front-line defense. Access-control technologies are being used by about 81% of respondents and anti-malware is being used by 70% of enterprise customers with intrusion prevention being used by 66%. + +With the increasing number and complexity of cyber threats, it’s not surprising that almost three-quarters of respondents (71%) are either piloting, currently using or upgrading network security-monitoring technology. Network security monitoring helps to identify slowdowns and problem areas as well as allows administrators to attack problems as they happen and help prevent future attacks, the survey stated. + +### 5G is on the radar + +51% of respondents say their organization is actively researching 5G, but just 11% are piloting or using it in any capacity. Uses interested organizations are considering include broadband mobile (51%), IoT connectivity (43%), [branch or remote site connectivity][13] (41%) and low-latency communications and fixed wireless access (40% each), the survey stated. + +Join the Network World communities on [Facebook][14] and [LinkedIn][15] to comment on topics that are top of mind. + +-------------------------------------------------------------------------------- + +via: https://www.networkworld.com/article/3537559/state-of-the-network-sd-wan-edge-networking-and-security-issues-heat-things-up.html + +作者:[Michael Cooney][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.networkworld.com/author/Michael-Cooney/ +[b]: https://github.com/lujun9972 +[1]: https://pixabay.com/photos/young-man-student-studying-learning-4053324/ +[2]: https://creativecommons.org/publicdomain/zero/1.0/ +[3]: https://www.networkworld.com/article/3031279/sd-wan-what-it-is-and-why-you-ll-use-it-one-day.html +[4]: https://www.networkworld.com/article/3203489/what-is-5g-how-is-it-better-than-4g.html +[5]: https://www.networkworld.com/newsletters/signup.html +[6]: https://www.networkworld.com/article/3429258/real-world-tools-for-multi-cloud-management.html +[7]: https://www.networkworld.com/article/3489938/what-s-hot-at-the-edge-for-2020-everything.html +[8]: https://www.networkworld.com/blog/itaas-and-the-corporate-storage-technology/?utm_source=IDG&utm_medium=promotions&utm_campaign=HPE22140&utm_content=sidebar (ITAAS and Corporate Storage Strategy) +[9]: https://www.networkworld.com/article/3527194/multicloud-security-integration-drive-massive-sd-wan-adoption.html +[10]: https://www.networkworld.com/article/3207535/what-is-iot-the-internet-of-things-explained.html +[11]: https://www.networkworld.com/article/3223692/what-is-a-data-centerhow-its-changed-and-what-you-need-to-know.html +[12]: https://www.networkworld.com/article/3224893/what-is-edge-computing-and-how-it-s-changing-the-network.html +[13]: https://www.networkworld.com/article/3250664/sd-branch-what-it-is-and-why-youll-need-it.html +[14]: https://www.facebook.com/NetworkWorld/ +[15]: https://www.linkedin.com/company/network-world diff --git a/sources/talk/20200416 Contact tracing via Bluetooth could help track COVID-19 transmission.md b/sources/talk/20200416 Contact tracing via Bluetooth could help track COVID-19 transmission.md new file mode 100644 index 0000000000..86fa318f1c --- /dev/null +++ b/sources/talk/20200416 Contact tracing via Bluetooth could help track COVID-19 transmission.md @@ -0,0 +1,55 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Contact tracing via Bluetooth could help track COVID-19 transmission) +[#]: via: (https://www.networkworld.com/article/3538333/contact-tracing-via-bluetooth-could-help-track-covid-19-transmission.html) +[#]: author: (Jon Gold https://www.networkworld.com/author/Jon-Gold/) + +Contact tracing via Bluetooth could help track COVID-19 transmission +====== + +Thinkstock + +[[Get regularly scheduled insights by signing up for Network World newsletters.]][1] + +A team of researchers from MIT has developed a novel method of tracking COVID-19 transmission among the population, using Bluetooth “chirps” that could automatically trace COVID-positive contacts and warn those who have potentially become infected, without violating their privacy. + +The system is called PACT, or Private Automated Contact Tracing. It works by sending random strings of numbers via low-power Bluetooth from a user’s smartphone to other nearby devices using the system, creating a coded list of smartphones that a given user has been close to in the past 14 days. + +If the user subsequently tests positive for COVID, he or she can upload that list of “chirps” to the database, so that other users can run a check to determine whether they might have exposed. + +MIT said that the system uses advanced privacy protection methods to ensure the privacy of both COVID sufferers and those checking to see whether they’ve been exposed. People would need to opt in, and researchers specifically highlighted that PACT does not use any GPS, wireless location or phone ID information. + +“For these broadcasts, we’re using cryptographic techniques to generate random, rotating numbers that are not just anonymous, but pseudonymous, constantly changing their ‘ID,’ and that can’t be traced back to an individual,” said MIT institute professor Ron Rivest, who led the project. (Rivest knows a  thing or two about cryptography: he’s the R in RSA, the first publicly available public-key cryptosystem.) + +The idea behind PACT is to make sure that the system isn’t tracking any individuals specifically. Rather, it’s meant to be a yes/no resource for those wondering whether they may have been in proximity to someone with COVID. It’s currently at the proof-of-concept stage – the team recently overcame the hurdle of getting Androids and iPhones to speak to each other – and overtures have been made to smartphone makers, Apple, Google and Microsoft to try and get the system into the public’s hands as quickly as possible. + +“The aim of the prototype is to prove to these developers that this is feasible for them to implement,” said Rivest. + +**[ [Take this mobile device management course from PluralSight and learn how to secure devices in your company without degrading the user experience.][2] ]** + +The team hopes that if PACT comes into widespread use it would enable a much more selective approach to quarantine and give communities the ability to return to normalcy more quickly. Tracking the spread of a disease like COVID with more speed and precision could let public health authorities suggest testing to specific groups of people if they notice a pattern emerging. + +MIT also said that the team has demonstrated PACT to various government agencies, and coordinating similar efforts elsewhere in the U.S., as well as in Europe. + +Join the Network World communities on [Facebook][3] and [LinkedIn][4] to comment on topics that are top of mind. + +-------------------------------------------------------------------------------- + +via: https://www.networkworld.com/article/3538333/contact-tracing-via-bluetooth-could-help-track-covid-19-transmission.html + +作者:[Jon Gold][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.networkworld.com/author/Jon-Gold/ +[b]: https://github.com/lujun9972 +[1]: https://www.networkworld.com/newsletters/signup.html +[2]: https://pluralsight.pxf.io/c/321564/424552/7490?u=https%3A%2F%2Fwww.pluralsight.com%2Fcourses%2Fmobile-device-management-big-picture +[3]: https://www.facebook.com/NetworkWorld/ +[4]: https://www.linkedin.com/company/network-world diff --git a/sources/talk/20200416 Harvesting ambient energy will power IoT, scientists say.md b/sources/talk/20200416 Harvesting ambient energy will power IoT, scientists say.md new file mode 100644 index 0000000000..8831fcbfbe --- /dev/null +++ b/sources/talk/20200416 Harvesting ambient energy will power IoT, scientists say.md @@ -0,0 +1,66 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Harvesting ambient energy will power IoT, scientists say) +[#]: via: (https://www.networkworld.com/article/3536697/harvesting-ambient-energy-will-power-iot-scientists-say.html) +[#]: author: (Patrick Nelson https://www.networkworld.com/author/Patrick-Nelson/) + +Harvesting ambient energy will power IoT, scientists say +====== +Magnetic fields found naturally around electrical devices could be diverted and converted into electricity to power the IoT. +Thinkstock + +Stray, ambient magnetic fields that are naturally created from electricity usage should be captured, diverted, and converted into power for Internet of Things sensors, researchers say. + +"Just like sunlight is a free source of energy we try to harvest, so are magnetic fields," said Shashank Priya, professor of materials science and engineering and associate vice president for research at Penn State, in a statement published [on the university's web site][1]. "We have this ubiquitous energy present in our homes, office spaces, work spaces and cars. It's everywhere, and we have an opportunity to harvest this background noise and convert it to useable electricity." + +Electricity produces tiny magnetic fields around common power cables, computers and lighting found in factories, homes and offices. That energy, if harnessed, could power sensors and small data-sending radios, the academics think. Penn State is attempting to design ambient power receptors for IoT. + +### Materials science + +The group at Penn State has been having some success getting it to work. Experimental devices that are thin and about 1.5 inches long are being tested. Placing the capture-device around or on common appliances does produce electricity, the researchers claim. The key is to put the device where the magnetic field is the strongest. In one experiment, the researchers were able to generate enough power to run 180 LED lighting arrays with a device placed about 4 inches from a space heater. At 8 inches, the device produced enough electricity to operate a clock. + +"These results provide significant advancements toward sustainable power for integrated sensors and wireless communication systems," said Min Gyu Kang, an assistant research professor at Penn State and joint lead author of the study. + +Electricity and magnetism have always gone hand in hand. Magnetism is created by a moving electric charge. It's that movement which creates the magnetic field. That's why low-level magnetism is manifested in electrical wires generally, for example—the electricity is moving along the cable. + +In this case, the scientists are converting the magnetic field, which is caused by the moving electricity, into a separate electrical current. They're doing it with materials science by combining two materials. One of the materials is a magnetostrictor – it converts the magnetic field into stress-generating vibrations. The another material is piezoelectric, which grabs the vibrations and translates that energy into electricity. + +[][2] + +### How to power sensors + +Producing usable power from stray magnetic fields is just one stab at powering the IoT. Just how one goes about producing power for the millions, and possibly billions, of environmental, factory process and other sensors that are expected to come on stream as IoT takes off is up for grabs. + +Batteries have limitations—they need to be changed or charged, for example. Ambient humidity is one possibility I [wrote about recently][3]. In that case, bio-electronics have been proven to capture half-a-volt from ambient air, scientists claim. That's enough to operate rudimentary sensors. Waste heat, too, is another possible source: Researchers are [exploring ways to convert excess heat][4], such as is found in data centers, into light, and then turn that light into electricity. + +Other angles include simply reducing energy consumption through more efficient chips or streamlined wireless communications hardware. Other parasitic techniques are being tried. They include [turning existing wireless noise into a data carrier][5]. It's efficient because one doesn't have to make so much power for radio transceivers—the carrier already exists. + +In the case of the Penn State work, less obvious benefits might exist, too. + +"In buildings, it's known that if you automate a lot of functions, you could actually improve the energy efficiency very significantly," Priya said. “Buildings are one of the largest consumers of electricity in the United States. So even a few percent drop in energy consumption could represent or translate into megawatts of savings. Sensors are what will make it possible to automate these controls, and this technology is a realistic way to power those sensors." + +Join the Network World communities on [Facebook][6] and [LinkedIn][7] to comment on topics that are top of mind. + +-------------------------------------------------------------------------------- + +via: https://www.networkworld.com/article/3536697/harvesting-ambient-energy-will-power-iot-scientists-say.html + +作者:[Patrick Nelson][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.networkworld.com/author/Patrick-Nelson/ +[b]: https://github.com/lujun9972 +[1]: https://news.psu.edu/story/613154/2020/03/31/research/scientists-tap-unused-energy-source-power-smart-sensor-networks +[2]: https://www.networkworld.com/blog/itaas-and-the-corporate-storage-technology/?utm_source=IDG&utm_medium=promotions&utm_campaign=HPE22140&utm_content=sidebar (ITAAS and Corporate Storage Strategy) +[3]: https://www.networkworld.com/article/3529893/seawater-humidity-inspire-new-ways-to-generate-power.html +[4]: https://www.networkworld.com/article/3410578/data-centers-may-soon-recycle-heat-into-electricity.html +[5]: https://www.networkworld.com/article/3449819/wireless-noise-protocol-can-extend-iot-range.html +[6]: https://www.facebook.com/NetworkWorld/ +[7]: https://www.linkedin.com/company/network-world diff --git a/sources/talk/20200416 How I-ve adjusted my work-from-home habits.md b/sources/talk/20200416 How I-ve adjusted my work-from-home habits.md new file mode 100644 index 0000000000..251e9a7b9e --- /dev/null +++ b/sources/talk/20200416 How I-ve adjusted my work-from-home habits.md @@ -0,0 +1,86 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How I've adjusted my work-from-home habits) +[#]: via: (https://opensource.com/article/20/4/healthy-remote-work-habits) +[#]: author: (Will Kelly https://opensource.com/users/willkelly) + +How I've adjusted my work-from-home habits +====== +WFH newbs and veterans alike have to adjust to self-quarantine; here's +how to maintain some balance. +![Oatmeal and a laptop.][1] + +I've been a remote worker during various chapters in my career, and have tried to carry those lessons into each new remote work experience. At the end of last year, I switched to a job that lets me work from home. Fast forward to the COVID-19 outbreak; even though I was no WFH novice, I found myself having to adapt just like the many other workers who've been suddenly thrust into remote work. + +In hopes of easing that transition, here are some healthy remote work habits to adapt during a pandemic. + +### Keep exercising even if your gym is closed + +I watched the crowd in my gym dwindle the week before my state government issued its stay at home orders. Whether I've been working in an office or at home, going to the gym helps me vent stress, plus it acts as a logical break in my daily routine because I put down my phone and keyboard to clear my head. + +Fortunately, my gym put some training activities online that I plan to use. I already have a stability ball and Bosu ball in my home office that I began using on day three after the pandemic closed all the offices, schools, and later gyms in my local area. As I write this article, I'm entering week 4 of COVID-19-mandated remote work, and I'm still trying to get back to the exercise dedication and momentum I had before this all happened. + +### Dress (and groom) yourself for work + +I've worked from home on and off during my career. When I started my new job, I decided not to repeat some mistakes I made during the last time I worked from home. One mistake I made was not shaving every day. I also stopped getting dressed for work. + +When you dress and groom yourself for work every day, it can help put you in focus for work. You don't have to be too strict; it is a pandemic after all. I'm still debating on sweatpants Fridays during this crisis. + +### Eat meals away from your desk + +It's too easy to just eat meals at your desk when you work at home. Many even do it at the office. I recommend as you get through your COVID-19-enforced remote working that you use eating as a natural break in the ebbs and flows of your day. For example, unless a deadline was calling, I would go out to lunch to break up my remote working days. These days I get up from my desk, walk outside to get a breath of fresh air and have lunch in my living room. + +### Keep a schedule and track your progress + +It's easy to sleep in when you don't have to go to the office. I recommend trying to keep to your regular schedule as much as possible. It's admittedly easy for me to say that because I live alone. If you're home with children, work with your employer to time-shift your schedule to accommodate the added responsibilities and other challenges you're facing right now. It may take a few iterations to get the right schedule, but you'll appreciate the consistency. + +Another word about keeping a schedule—you might add important work meetings to your personal calendar or as reminders on your mobile device, so you have another reminder as you adjust to the new normal of COVID-19. + +The open source community has a lot of great scheduling and project management tools that you can use to track your own time and progress. There are [project management tools][2] for agile development teams. You can also find open source alternatives to [Googl][3][e Calendar][3] available on Android. + +### Put backup communications channels in place + +Even companies with robust telework programs may see some communications outages. It may not even be their CIO's fault, such as the Microsoft Teams outage that happened in Europe early on during the COVID-19 pandemic. + +Having problems dialing into a conference bridge or your employer's group chat having sporadic issues will surprise nobody right now; most understand that workers are in a period of transition, and not everything will run smoothly. However, you still need to have backup channels in place to make that communication happen, even if it's just coworkers exchanging cell numbers so they can text or call each other as needed. + +There are some fully-featured open source [Slack alternatives][4] available that are worth exploring if your organization is lacking in chat applications or if you want to give your team a backup channel to your official corporate application. (Whether you do it with the approval of your corporate IT department is up to you). + +You should also consider installing implementing [MediaWiki][5] or [Twiki][6] to improve collaboration or to give your team an accessible document repository. + +### Pivot on communications when needed + +Every company where I've been an employee or contractor has had its own communications style. Remote working at scale during the COVID-19 epidemic will challenge those communication styles. + +Be prepared to shake up your communication style, whether you're a newb or long term remote worker. That could mean writing more detailed emails instead of the terse ones you normally send to becoming more of a power user with your company's group chat tool. There are also the open source wikis I mentioned earlier that can provide you a centralized platform for any long-form writing you need to do to help communicate project requirements and changes. + +I also extend this advice to your personal communications during the workday. For example, a friend and I video conference during the day. We never did that pre-COVID-19. + +### Final thoughts + +Lots of people will evolve and rethink their remote work habits. It's only healthy that you prepare yourself for adjusting your own remote working habits. What worked for me pre-COVID-19 doesn't necessarily work right now, so I'm adjusting my remote work habits weekly as I see fit so I can maximize my productivity during the current crisis. + +How are you adjusting your remote work habits during self-quarantine? + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/4/healthy-remote-work-habits + +作者:[Will Kelly][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/willkelly +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/oatmeal-and-fedora.jpg?itok=NBFUH9eF (Oatmeal and a laptop.) +[2]: https://opensource.com/article/18/2/agile-project-management-tools +[3]: https://www.androidpolice.com/2019/12/30/the-best-free-and-open-source-alternatives-to-google-calendar-on-android/ +[4]: https://opensource.com/alternatives/slack +[5]: http://www.mediawiki.org/ +[6]: http://www.twiki.org/ diff --git a/sources/talk/20200417 Face-to-face collaboration for community to become more impactful - Chip Childers.md b/sources/talk/20200417 Face-to-face collaboration for community to become more impactful - Chip Childers.md new file mode 100644 index 0000000000..ccc63dc914 --- /dev/null +++ b/sources/talk/20200417 Face-to-face collaboration for community to become more impactful - Chip Childers.md @@ -0,0 +1,58 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Face-to-face collaboration for community to become more impactful – Chip Childers) +[#]: via: (https://www.linux.com/articles/face-to-face-collaboration-for-community-to-become-more-impactful-chip-childers/) +[#]: author: (Swapnil Bhartiya https://www.linux.com/author/swapnil/) + +Face-to-face collaboration for community to become more impactful – Chip Childers +====== + +“Anytime there’s a crisis, there’s also an opportunity for open source communities to find ways to be helpful,” affirms Chip Childers, the Executive Director of Cloud Foundry Foundation. He believes the remarkable work the Cloud Foundry community has done over the years to enhance enterprise developer productivity will now help those who have adopted the platform to combat COVID-19.; + +“It (the platform) allows them to move quickly to respond to changing conditions, whether those are market conditions, or in this case, a global pandemic. We’re actually pretty proud of a lot of the end-users and how they’re able to use the software more efficiently now,” he says. + +Prior to becoming the Executive Director, Childers served as the CTO for a little over five years. He feels “it’s a very exciting time to be stepping into the role,” and has already chalked out a robust strategy to take the Foundation to the next level. + +For starters, Google has upped its membership of Cloud Foundry and is now at the technical tier. “We were quite happy to have them decide to upgrade and we appreciate their support on that,” says Childers. + +He is also happy with how Kubernetes and Cloud Foundry are coming together. + +“Cloud Foundry and Kubernetes are now becoming complementary. The Cloud Foundry developer platform should run on the Kube infrastructure platform. Both communities have reached the point where they’re ready to see this get blended,” says Childers. + +**Unswerving Support** +VMware ranks among the largest contributors to communities. Last year, it acquired Pivotal, which is one of the biggest stakeholders in the Cloud Foundry project. So, what are the implications on Cloud Foundry of a player that has stakes in both Kubernetes and Cloud Foundry? + +“It’s a clear indication the teams that used to work for Pivotal are being intermixed with the teams that were at VMware, and through some of their other acquisitions like Heptio, they’re all working together on the shared vision of creating the Tanzu platform. This happens to align well with the vision that other Cloud Foundry distributions have — like the way SUSE builds Kubernetes-based infrastructure layers Cloud Foundry on top for developer productivity,” explains Childers. + +Childers believes Paul Fazzone’s promotion to Chairman of the Board will provide an additional boost to Cloud Foundry. + +“Paul heads R&D for VMware’s modern applications business unit. He’s been on our board for a long time. So it’s great that we’re going to continue to see the investment in the open source community not just at the business level from VMware, but also in terms of supporting the contributors, be it developers, product managers, project management support, or marketing support. They’re not wavering in their commitment to open source across the board and Cloud Foundry is one of those communities that will benefit from that,” he states. + +**A Three-Pronged Strategy** +The core mission of the Foundation is to bring a world-class enterprise developer experience to as many enterprise developers as possible. Childers, therefore, considers “enterprise developer productivity for Kubernetes infrastructure our new north star” and has devised a three-pronged strategy to align with it. + +“The first thing is that we will focus on working with the contributing community — the Foundation staff, key member contacts and participants — to improve their experience. + +Next is to build upon the inclusivity and diversity work that the Foundation has done over the years. “We’ve always had a number of different audiences to whom we’ve tried to describe the work of the project: line of business leaders, CIOs, IT operations, and enterprise developers. It is important to make a little bit of a dent in the broader technology industry,” avers Childers. + +The third and final prong of Childers strategy is to encourage developers or companies participating in Cloud Foundry efforts to also participate in Istio (an open platform that connects, manages, and secures microservices), Kubernetes, and the various scenes within the community. + +“There’s a massive overlap, which I think will be very beneficial to everyone. The learnings that developers helping to code Kubernetes or Istio learn during that process should flow in such a way that the CF community builds the developer experience on top of those systems. From this perspective, cross-pollination is really, really important,” says Childers. + +Childers is also planning a tectonic shift in the way Foundation contributors work. “While now it’s going to become a little bit harder as we deal with some of the challenges around the pandemic, I’m very excited about spending a lot of our effort focused on increasing the impact of the face-to-face collaboration time that we’re able to create for the community,” adds Childers. +-------------------------------------------------------------------------------- + +via: https://www.linux.com/articles/face-to-face-collaboration-for-community-to-become-more-impactful-chip-childers/ + +作者:[Swapnil Bhartiya][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://www.linux.com/author/swapnil/ +[b]: https://github.com/lujun9972 diff --git a/sources/talk/20200418 My 10 guiding principles for open source community management.md b/sources/talk/20200418 My 10 guiding principles for open source community management.md new file mode 100644 index 0000000000..c5e62ba6b3 --- /dev/null +++ b/sources/talk/20200418 My 10 guiding principles for open source community management.md @@ -0,0 +1,116 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (My 10 guiding principles for open source community management) +[#]: via: (https://opensource.com/article/20/4/open-source-community-management) +[#]: author: (Florian Effenberger https://opensource.com/users/floeff) + +My 10 guiding principles for open source community management +====== +It's not just about subject matter expertise; leadership in the open +source world requires special skills and processes. +![community team brainstorming ideas][1] + +Many activities these days, be they sports, social work, arts or free and open source software, are organized in some sort of community. If backed by a respective legal entity, this not only helps with getting donations and entering contracts but also puts statutes and rules in place that establish the values and ideals all contributors share and abide by. + +Inside these communities, there can be various roles. Some of them have formal requirements and annual or biannual elections, e.g., the board of directors or the supervisory board; others exist ad hoc within dynamically grown groups and can change frequently. Either of those are ideally composed of experienced and enthusiastic community members who take leadership and responsibility. + +Many regular contributors will, therefore, eventually face the question of whether to accept a certain role. Based on my experience with being a board member of the former German associations [OpenOffice.org][2] Deutschland e.V. and Freies Office Deutschland e.V., previous chairman and current executive director of [The Document Foundation][3] and founding member of the Munich [Open-Source-Treffen e.V.][4], I would like to share some personal insights on the topic. + +These views are purely my own, and your mileage might vary. It is likely that others had both similar and different experiences, so I'm looking forward to any feedback and thoughts you might have. + +### 1\. Cooperation + +A community is all about cooperation. Boards, groups, and bodies are no different in this regard. Usually, you don't know who will co-serve on an elected committee with you until shortly before you start your duty. Therefore, it is important to cooperate openly with your new colleagues in a transparent, trustworthy, and effective way, within the committee as well as the larger community. + +Sharing a common understanding of responsibilities and duties, and even more importantly, of your goals, visions, and plans can help a lot. It's not necessary for these to all be totally aligned in the first place, as long as there are consensus and compromise to help you identify goals that benefit the community and their objectives at large. In a vivid and diverse community, several goals can often be pursued at once, as most won't be mutually exclusive or otherwise prohibitive. + +And then let's not forget one thing: the fun! Be proud that you have been entrusted by your peers to drive the community and its projects toward a bright future. Be proud that you can help steer the ship and shape the soul of something that is important to you. As is often the case in life, cooperating and working together with others is key to success. Joining forces is not only easier but also much more fun than working alone. + +### 2\. Commitment + +Taking over a role is something that can and should make you proud. See this as something you have been entrusted with for a certain amount of time because your contributions have been recognized by the community as extraordinary and remarkable. You acted in a visible and trustworthy fashion, and people credit you with leadership skills. + +Depending on the role you take, the honor often comes with a fair amount of new responsibility beyond what you already do, and it might involve subjects yet unknown to you. In other words: Be ready to put in some time and effort. + +How much time such a commitment takes obviously depends on multiple factors: what specific role you take, how many contributors you have to coordinate with, how large your organization is, and of course, what kind of projects you run. [In one of its annual reports][5], board members of The Document Foundation explained that every year "they each donate 15 to 20 days of activity to TDF for Board duties in addition to other volunteering" and the members of its membership committee donate "between 10 and 15 days of activity." + +### 3\. Variety + +Should you be elected into an organizations' formal body, you will see yourself responsible for representing the entity from a marketing perspective, but also from a legal and organizational point of view. Other than the more glamorous parts, these duties often also entail regular meetings, annual budget planning and reserve building, tax filings and annual activity reports, team management, trademark and copyright handling, planning and overseeing tenders, and all sorts of expected and unexpected legal matters and fostering liaisons with other entities, all of which are rather unglamorous tasks rarely seen by the general public. + +That requires the willingness to learn in a variety of areas and for having a rather high tolerance for frustration. Luckily, most of the groups I know are composed of members with different skills, so it's likely someone is either already experienced in or willing to learn one or more of the respective areas. Looking at The Document Foundation's [rules of procedure][6] for the board, a total of 13 different areas of oversight can be identified, each one staffed with one or more volunteers, matched to their area of interest. + +### 4\. Delegation + +Handling all the work alone as a pure volunteer will sooner or later become an impossible task and, unless you have magical superpowers, it's strongly advisable to share these with other seat holders, volunteers, and, if they exist, staff and external professionals. Often, growing organizational demands luckily come together with the financial growth of the entity, which makes paying professionals for certain tasks quite feasible and sensible. Accounting, administration, and legal advice are prime examples of things to outsource (unless that's the service you already provide, of course). + +If you oversee a large part of the organization, you primarily need to focus on strategy and the mission at large, so it is advisable to delegate many tasks to others. Remember, the community has entrusted you to steer the ship, to oversee the big picture; don't bother yourself with every little detail and micromanagement, but get enough insight to oversee those you task and trust that they do a good job. + +### 5\. Responsibility + +In the end, however, it still is the ultimate and shared responsibility of all representatives to oversee and coordinate the work, ensure all duties are fulfilled, and, especially for board members, take care that all legal obligations are met. Remember, donors trust you to make good use of their money, so you have a huge responsibility. + +In nearly all legislations, there exist numerous rules and regulations you are bound by, and the unfortunate tendency is often to make things more complicated instead of relaxing them. + +In case something goes wrong, those most exposed are first in line to be confronted with that, both from a social and legal point of view. + +### 6\. Social + +Depending on the size of the organization and your role, you might not only have responsibility for tasks and projects, but also for a paid team. Keep in mind that, for many, their economic situation depends on the success of your organization. Job security and a positive work environment are important factors to keep a happy and dedicated team. + +Gaining the skills and finding the time as a pure volunteer to oversee a large full-time team is demanding. Interacting by talking, listening, and being open helps a lot for both your team and the organization. In many organizations, the paid team is there to serve your community, to drive forward the success of the project, to take away annoying administrative tasks from you, and to work on tasks that support and enable your contributors. + +Working at charities can be a bit different from companies. Given most of your income consists of donor's money, you have less monetary flexibility than commercial employers. However, you provide a far superior experience than many traditional businesses. Use that as your advantage—your team does something for the good cause, can work with people around the world, can really make a difference, and at the same time make a living out of what they love. Communicate frequently, and don't forget to laud people if they do a good job, especially in remote working environments. + +### 7\. Diversity + +Crucial and essential is that representatives reflect the diversity of the community—different genders, religions, languages, cultures, backgrounds, and experiences add an incredibly exciting variety that you should aim hard to achieve in any board, committee, and group. While this can turn out to be challenging in the beginning, it for sure will enrich your community in ways you never dared to dream of before. + +This diversity is one of the most important and exciting assets a larger community offers; you'll soon learn how it widens the view, helps you to question your own thoughts and positions, and contributes greatly to your overall efforts. If you run an open source community, do exactly as the name suggests—be open, be passionate, and try to get to the bottom of things! + +### 8\. Coordination + +Having members from around the globe can make you face some practical problems though—most notably, languages and time zones. While English as a common denominator is spoken widely in Europe, it might be different for other countries, and including those who don't speak English as their mother tongue is key if you have a large community. You risk losing vital insight into what your worldwide community does if you don't manage to connect to them. + +Something the law of physics at least currently doesn't allow is overcoming the different time zones. Finding suitable meeting slots for participants on different continents, matching everyone's working schedule, and providing a work-life balance aren't trivial requirements, especially when you want to include a paid team. As you end your workday, colleagues from a different continent are just about to start theirs. While the volunteers need meeting times after office hours, your staff would probably rather not stay in the office until late or during the weekends. + +Likely there isn't an ideal meeting time, but you will end up finding a compromise that works for most people, possibly including alternate meeting times. A word to the wise: use calendar invites and meeting planners with time zones to avoid confusion, especially during times of daylight savings changes. + +The choice of medium is important as well—all stakeholders need to be aware of and included in important discussions. Some of these are thus better done in email; others are easier to handle on the phone. You might also find it convenient to prepare initial discussions via emails and have the final vote on the phone. + +Properly prefixing email subjects with votes and discussions can likewise be helpful to handle the influx of messages and catch people's attention. The same is true for meeting intervals, agendas, deadlines, quorum requirements, and sunset periods—these need to reflect everyone's needs, factoring in availabilities, vacations, and absences. The rationale behind this is that taking a role requires continuous, active participation in many communities, to keep up with what's going on, and that is much easier when the rules are clear. + +Depending on your setup and the jurisdiction you're in, votes and meetings also have formal requirements you have to stick to. + +### 9\. Trust + +Trustworthiness is probably one of the most important characteristics for anyone who fills a leadership role. Email conversations lack tone and gestures, making it harder to understand moods, emotions, and intentions. Thus it's even more important to assume best intentions on each side, trying to avoid what is known as confirmation bias, i.e., interpreting actions and words in a way that seems to confirm your existing negative assumptions. + +Trust especially comes into play when the entity is located in a country whose language you don't speak or whose legal system you are not familiar with—you will have to rely on translation services and people acting as gateways, be they volunteers or paid professionals. + +### 10\. Reward + +Filling a community role usually means plenty of hard work on top of your existing duties, but there are plenty of rewards for all that work. It is a very honorable and truly exciting opportunity that will not only enrich your professional life (and makes a good item on a CV) but beyond that, enriches your personality, your skills, and your point of view. If you're passionate about what you do, if you're open to new things, if you want to shape the future of what you love—then you indeed might be a great candidate to serve the community and lead by example. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/4/open-source-community-management + +作者:[Florian Effenberger][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/floeff +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/meeting_discussion_brainstorm.png?itok=7_m4CC8S (community team brainstorming ideas) +[2]: http://OpenOffice.org +[3]: https://www.documentfoundation.org/ +[4]: https://www.opensourcetreffen.de/ +[5]: https://wiki.documentfoundation.org/File:AnnualReport2016LR.pdf +[6]: https://wiki.documentfoundation.org/TDF/BoD_rules diff --git a/sources/talk/20200420 Why I use open source technology for web development.md b/sources/talk/20200420 Why I use open source technology for web development.md new file mode 100644 index 0000000000..03a2ea4148 --- /dev/null +++ b/sources/talk/20200420 Why I use open source technology for web development.md @@ -0,0 +1,102 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Why I use open source technology for web development) +[#]: via: (https://opensource.com/article/20/4/open-source-web-development) +[#]: author: (Jimmy McArthur https://opensource.com/users/jimmymcarthur) + +Why I use open source technology for web development +====== +Micro-frontends with an API-driven approach power the OpenStack +Foundation's platforms. +![Text editor on a browser, in blue][1] + +Every day, millions of people all over the world access the [OpenStack Foundation][2]'s (OSF) web properties to learn about open infrastructure. This level of usage requires a platform and toolsets that are fast, flexible, and affordable—and this is where open source comes in. Not only that, but given that we work for an open source software foundation, we naturally incorporate open source technologies into everything we do, including web development. + +### Considerations for web development + +When thinking about web development technologies, we must consider how we manage our software lifecycles. All software development includes some sort of [lifecycle management][3] with the opportunity to plan, analyze, design, and implement the code. Our web development team usually works on the fly, often under tight deadlines, and with other departments. That means our requirements and workflow must be flexible enough to allow for quick iterations, updates, and corrections. I'd rather push out something quickly and, if needed, go back in and make things pixel perfect after the fact. + +Our team also has to consider all the stakeholders involved in the website, including our talented marketing teams who aren't familiar with Git workflows. That led us, like many others, to utilize a content management system (CMS), so those professionals can make updates without having to use Git. + +### Building a CMS-agnostic web architecture + +In order to uphold this need for flexibility, traditionally, we relied on an open source CMS, [SilverStripe][4]. However, our requirements quickly outgrew the system. So, we built a standalone API and use static micro-sites with [React][5] JavaScript components to pull data into custom-designed presentation layers. We use this system in everything from mobile apps to websites to digital signs. This has become known as a [Jamstack][6] architecture. We found this model was extensible enough that it allowed us to move our data anywhere while being CMS-agnostic. + +When adopting this API-driven workflow, we realized that our data was used in many different places and presented in many different ways. Across our seven web properties, we share everything from graphics to dynamic content. A standard CMS won't do this without a lot of custom development work along with either cron jobs or costly database queries. + +When things are API-driven, you can access all these different datasets across a variety of platforms while largely protecting your infrastructure from major traffic spikes. For example, the OSF collaborated with [Tipit][7], the OSF's digital design and development partner, to develop a completely open source end-to-end event management software. Our event-schedule data is presented on web pages, mobile apps, and digital signage. It's the same data, managed from a single place, but with different presentation layers, formats, and platforms. + +### Open source identity access management + +A cornerstone of moving to a decentralized Jamstack architecture is the need to establish identity and access rights. When using JavaScript to call for things in an API, we may need to require authentication and authorization. Therefore, we had to separate the identity provider from any individual implementation. There are two concepts to this: identity (authN) and identity access management (authZ). The identity provider confirms who you are, while access management confirms what roles and permissions you have to do different things. One of the first requirements when developing the event-management software was to establish a standalone identity provider. + +Enter [OpenStackID][8], which is an [OpenID Connect][9] with oAuth2 SSO solution. OpenStackID started out as a more secure way for users to log into [Openstack.org][10] and manage their profiles. Even as the number of websites and event apps we manage grows, this creates a seamless authentication experience for users. The access-management portion allows us to build standalone React-based apps that use the identity provider to determine if a particular user has the rights to do the things they want to do in that specific application. + +One thing that runs through everyone's mind—especially in a global open source community—is privacy. It's a large factor in creating our web and event properties. With OpenStackID, users can log into their [OpenStackID account][11] and set application permissions using the OAuth 2 console. If they decide they no longer want their app associated with their OpenStackID, they can simply remove permissions. + +For example, we have users for our events that do not want their personal information to be associated with their presence at our conferences. The way the platforms are set up, all personally identifiable data is managed securely on the OpenID server, and it's not shared between applications unless the user strictly enables it. Beyond that, we never share things like the events a user attends or pieces of their user profile unless it's completely anonymized, or they specifically allow it in order to remain aligned with the [Four Opens][12] or our community philosophy. + +### Better web infrastructure using open source + +Taking our considerations and shifting toward a more flexible implementation of a CMS has helped our teams collaborate more effectively. Most importantly, we continue to follow our community values by providing great privacy and security options thanks to open source technology. + +If you're interested in our approach, check out the OSF Foundation website's [source code][13]. You can also access the following source code repos to see the approach in action: + + * [Zuul website][14] + * [Airship website][15] + * [StarlingX website][16] + * [Kata Containers website][17] + * [MOC and Open Infra Labs website][18] + * [Open Stack Foundation website][19] + * [Open Infrastructure Summit admin][20] + * [Open Infrastructure Summit CFP][21] + * [Open Infrastructure Summit Signage][22] + * [OpenStack Survey GraphQL API to access survey data and reports][23] + * [OpenStack Survey Graphene API to feed summit reports][24] + * [OpenStackID authentication system][25] + * [OpenStackID resource server][26] + + + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/4/open-source-web-development + +作者:[Jimmy McArthur][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/jimmymcarthur +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/browser_blue_text_editor_web.png?itok=lcf-m6N7 (Text editor on a browser, in blue) +[2]: https://osf.dev/ +[3]: https://en.wikipedia.org/wiki/Systems_development_life_cycle +[4]: https://www.silverstripe.org/ +[5]: https://reactjs.org/ +[6]: https://jamstack.org/ +[7]: https://www.tipit.net/ +[8]: https://opendev.org/explore/repos?q=openstackid&tab=&sort=recentupdate +[9]: https://openid.net/connect/ +[10]: http://Openstack.org +[11]: https://openstackid.org/ +[12]: https://osf.dev/about/four-opens/ +[13]: https://github.com/OpenStackweb/openstack-org +[14]: https://opendev.org/zuul/zuul-website +[15]: https://github.com/AirshipWeb/airship-website +[16]: https://github.com/StarlingXWeb/starlingx-website +[17]: https://github.com/kata-containers/www.katacontainers.io +[18]: https://github.com/OpenStackweb/openinfralabs-website +[19]: https://github.com/OpenStackweb/osf-website +[20]: https://github.com/OpenStackweb/summit-admin +[21]: https://github.com/OpenStackweb/call-for-presentations +[22]: https://github.com/OpenStackweb/openstacksignage +[23]: https://github.com/OpenStackweb/openstack-survey-api +[24]: https://github.com/OpenStackweb/summit-reports-api +[25]: https://opendev.org/osf/openstackid +[26]: https://opendev.org/osf/openstackid-resources diff --git a/sources/talk/20200421 How underwater Internet of Things will work.md b/sources/talk/20200421 How underwater Internet of Things will work.md new file mode 100644 index 0000000000..16503a8143 --- /dev/null +++ b/sources/talk/20200421 How underwater Internet of Things will work.md @@ -0,0 +1,61 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How underwater Internet of Things will work) +[#]: via: (https://www.networkworld.com/article/3538393/how-underwater-internet-of-things-will-work.html) +[#]: author: (Patrick Nelson https://www.networkworld.com/author/Patrick-Nelson/) + +How underwater Internet of Things will work +====== +Lasers will be used to power underwater devices and transmit data below the ocean's surface. +North Sea Port + +More than two-thirds of the world's surface is covered by water. It plays an important role in our economic existence, including in major verticals such as oil and gas, shipping and tourism. + +As the Internet of Things proliferates, questions arise as to how IoT will manifest itself underwater given that radio waves degrade over distance in seawater, and underwater acoustic communication (which does actually work okay) is easily eavesdropped on and isn't stealthy. + +To make the underwater Internet of Things happen, light is the answer, some say. Researchers at King Abdullah University of Science and Technology (KAUST) in Thuwal, Saudi Arabia, are proposing underwater optical communications. They're investigating simultaneous lightwave information and power transfer (SLIPT) configurations, which they're using to transmit energy and data to underwater electronic devices. Recently, the researchers announced a breakthrough experiment in which they were able to achieve an underwater, two-way transmission of data and power over 1.5 yards between a solar panel-equipped sensor and a receiver. + +The SLIPT system will be more usable than wires strung. And in the case of human underwater equipment inspections, for example, SLIPT will be less prone to error than hand signals and less prone to audible confusion than ultrasound voice-based communicators. Remarkably, to this day, hand signals are still a common form of communication between divers. + +"SLIPT can help charge devices in inaccessible locations where continuous powering is costly or not possible," said Jose Filho, a PhD student at KAUST, [in an article][1] on the school's web site. + +Filho, who has been involved in developing the laser project, envisages ships or boats on the water's surface beaming optical communications to underwater vehicles or IoT sensors on the ocean floor. The lasers would simultaneously communicate with and power underwater robots and devices. Return data is relayed to the surface vessel, which then communicates to land bases or data centers via RF (radio). + +Surface buoys – or even unmanned aerial vehicles (drones) flying well above turbulent waves – could be used to inject power down to the seabed surface and, at the same time, receive data, researchers believe. + +[][2] + +The school explains that there's still much development that needs to be performed before SLIPT is operational, but it sees potential. "Underwater optical communication provides an enormous bandwidth and is useful for reliably transmitting information over several meters," co-first author Abderrahmen Trichili said in the article. + +KAUST, located on the Red Sea coast, has been involved in this area of technical exploration for some years. It was involved in developing some early, record-breaking underwater data communications. In 2015 it ran a 4.8 gigabit per second, 16-QAM-OFDM transmission with a 450-nanometer laser. OFDM, or Orthogonal Frequency Division Multiplexing, splits single data streams into multiple channels to reduce interference. + +Interestingly, seas and oceans are becoming increasingly important to data centers. Large swaths of the world's population are found on or near coasts, rather than inland, and we're seeing a shift towards edge-style computing that positions resources closer to sources of data. There's also a need for compute cooling, which ocean water can provide. Even wave energy as a method of powering servers means sea and data are becoming intertwined. + +Microsoft launched an [undersea water-cooling data center][3] 117 feet below the water surface in 2018. Additionally, garden-hose-sized cables carry almost all global, public Internet traffic [underwater, across oceans and between continents][4]. It's not done through satellite, as many imagine. + +So, this is not a brand-new synergy. Apart from the eco-monitoring drivers, one of the likeliest and most important reasons that ocean-based computing is being explored keenly is that there isn't any rent payable or jurisdictional ownership on the high seas. + +Join the Network World communities on [Facebook][5] and [LinkedIn][6] to comment on topics that are top of mind. + +-------------------------------------------------------------------------------- + +via: https://www.networkworld.com/article/3538393/how-underwater-internet-of-things-will-work.html + +作者:[Patrick Nelson][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.networkworld.com/author/Patrick-Nelson/ +[b]: https://github.com/lujun9972 +[1]: https://discovery.kaust.edu.sa/en/article/952/the-power-of-light-for-internet-of-underwater-things +[2]: https://www.networkworld.com/blog/itaas-and-the-corporate-storage-technology/?utm_source=IDG&utm_medium=promotions&utm_campaign=HPE22140&utm_content=sidebar (ITAAS and Corporate Storage Strategy) +[3]: https://www.networkworld.com/article/3283332/microsoft-launches-undersea-free-cooling-data-center.html +[4]: https://www.networkworld.com/article/3004465/how-vulnerable-are-the-internets-undersea-cables.html +[5]: https://www.facebook.com/NetworkWorld/ +[6]: https://www.linkedin.com/company/network-world diff --git a/sources/talk/20200421 IoT offers a way to track COVID-19 via connected thermometers.md b/sources/talk/20200421 IoT offers a way to track COVID-19 via connected thermometers.md new file mode 100644 index 0000000000..a3ba9f972e --- /dev/null +++ b/sources/talk/20200421 IoT offers a way to track COVID-19 via connected thermometers.md @@ -0,0 +1,54 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (IoT offers a way to track COVID-19 via connected thermometers) +[#]: via: (https://www.networkworld.com/article/3539058/iot-offers-a-way-to-track-covid-19-via-connected-thermometers.html) +[#]: author: (Jon Gold https://www.networkworld.com/author/Jon-Gold/) + +IoT offers a way to track COVID-19 via connected thermometers +====== +The COVID-19 pandemic has catapulted one manufacturer of connected thermometers to national prominence, as Kinsa provides a possible window into the spread of the disease. +[Kinsa / Leaflet / OpenStreetMap / CARTO][1] + +A company called Kinsa is leveraging [IoT][2] tech to create a network of connected thermometers, collecting a huge amount of anonymous health data that could offer insights into the current and future pandemics. + +The company’s founder and CEO, Inder Singh, said that the ability to track fever levels across the U.S. in close to real time could be a crucial piece of information for both the public at large and for decision-makers in the healthcare sector and government. + +[[Get regularly scheduled insights by signing up for Network World newsletters.]][3] + +The system’s networking technology is relatively straightforward – the thermometer connects via Bluetooth to an app on the user’s phone, which reports anonymized data back to Kinsa’s cloud over the Internet. Singh emphasizes that the company only organizes data down to the county level, and asserts that identifying individuals through Kinsa’s data is more or less impossible. + +“We’re not providing PII, we’re not providing identified data,” he said. “The app just guides you to the care and services you need.” + +Armed with the temperature reading and some basic demographic information about the person whose temperature was taken and their other symptoms, the app can offer rudimentary guidance about whether a visit to the doctor is needed or not, and whether the user’s area is seeing unusual levels of fever. + +However, the real value is in the aggregated data that Kinsa analyzes and breaks out on its [U.S. Health Weather Map][1], gleaned from the million-plus thermometers in the company’s ecosystem. The idea, according to Singh, is to provide the public with a way to make more informed decisions about their health. + +“It’s very participatory,” he said. “Everyone gets the data, and everyone can respond.” + +Kinsa still sells its thermometers directly to consumers, but plans are afoot for the company to collaborate more closely with local governments, health authorities and even school districts – Singh said that Kinsa is already partnering with two U.S. states (which he declined to name), and several city governments, including St. Augustine, Florida. + +“Our hope is that we can figure out how to build a scalable model – we’re never gonna scale globally by just selling $20 thermometers,” he said. The goal is to become widespread enough that the product can act as a meaningful early warning system for the healthcare sector. + +Join the Network World communities on [Facebook][4] and [LinkedIn][5] to comment on topics that are top of mind. + +-------------------------------------------------------------------------------- + +via: https://www.networkworld.com/article/3539058/iot-offers-a-way-to-track-covid-19-via-connected-thermometers.html + +作者:[Jon Gold][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.networkworld.com/author/Jon-Gold/ +[b]: https://github.com/lujun9972 +[1]: https://healthweather.us/?mode=Atypical +[2]: https://www.networkworld.com/article/3207535/what-is-iot-the-internet-of-things-explained.html +[3]: https://www.networkworld.com/newsletters/signup.html +[4]: https://www.facebook.com/NetworkWorld/ +[5]: https://www.linkedin.com/company/network-world diff --git a/sources/talk/20200421 What is a High Traffic Website.md b/sources/talk/20200421 What is a High Traffic Website.md new file mode 100644 index 0000000000..d9207af7dd --- /dev/null +++ b/sources/talk/20200421 What is a High Traffic Website.md @@ -0,0 +1,98 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (What is a High Traffic Website?) +[#]: via: (https://theartofmachinery.com/2020/04/21/what_is_high_traffic.html) +[#]: author: (Simon Arneaud https://theartofmachinery.com) + +What is a High Traffic Website? +====== + +Terms like “high traffic” are hazardous when designing online services because salespeople, business analysts and engineers all have different perspectives about what they mean. If we’re talking about, say, a high-stakes online poker room, then “high traffic” for the business side will be very low compared to what it is for the technical side. However, all these people will be in a meeting room together making decisions, using the same words to mean different things. It’s obvious how that can lead to bad (and sometimes expensive) choices. + +A lot of my day job is talking to business stakeholders and figuring out the technical solutions they need, so this is a problem I have to deal with. So I’ve got my own purely technical way to think about traffic levels for online services. + +### Scalability vs performance + +First, let’s be clear about two concepts that come up a lot in online service design. + +For online services, performance is all about how well (usually how fast) the system can handle a single request or unit of work. Scalability is about the volume or size of work that can be handled. For online services, scalability is usually about the number of user requests that can be handled within a timeframe, while for batch jobs we typically care about the size of the dataset we can process. Sometimes we want the system capacity to grow and shrink based on demand, but sometimes we don’t care as long as we can handle the full range of workloads we expect. + +Scalability and performance often get confused because they commonly work together. For example, suppose you have some online service using a slow algorithm and you improve perfomance by replacing the algorithm with another that does the same job with less work. Primarily that’s a performance gain, but as long as the new algorithm doesn’t use more memory or something, you’ll be able to handle more requests in the same time. + +There’s a counterexample I’ve discussed before: [internal caches versus external cache servers][1]. Using an external cache server like Redis means your app has to make network calls to do cache lookups, so it has performance overhead. On the other hand, if your app is replicated across multiple machines, a shared, external cache is more effective than a per-app, in-memory cache. The external cache is more scalable. + +### Response time + +When designing systems, it’s helpful to start by thinking about latency or response time requirements, even if we have to make some up and revise them later. Adding more RAM, more caches, more machines or more disk can solve a lot of problems, but latency problems tend to be fundamental to the system design. For example, suppose you’re designing an online game, and you want latencies of under 100ms for all users. Straight away, the speed of light limit means you can’t have one central server supporting a global game, regardless of whatever algorithms or hardware you throw at the problem. + +There’s another reason it’s useful to focus on server response time in practice. If you have a simple, single-function website, such as a mortgage calculator, then the response time can be estimated based on technical things like the hardware specs and code quality. But that’s not how typical online services are built. The online service industry tends to emphasise adding more and more features for less development cost. That means [webpages tend to expand in complexity][2] using the easiest code possible, and only get optimised when they become too slow and users churn. Even the typical mortgage calculator site will end up bloated with advertising and tracking functionality. So the response time of a website in my day job depends mostly on the client’s budget and priorities, not on technical factors, regardless of whether it’s an ecommerce site or a cutting-edge data application. + +### Looking at a single worker + +Okay, so now imagine a simple web app that gets about one request an hour that takes about 5s to process (ignoring static assets because they’re not the bottleneck). That app has an obvious performance problem because many users will give up before 5s. But there’s no scaling problem because the server will practically never hit capacity limits and drop requests. Even if traffic rises, the performance problem is the bottleneck that takes priority over any hypothetical scalability problems. + +That’s a simple insight that we can take further. Lets say we target 100ms per request, and our simple web app processes requests one at a time serially (i.e., no scaling). With 86,400 seconds in a day, a naïve calculation says we can handle 86,400 / 0.1 = 864,000 requests per day before we have scaling problems. + +Of course, the real world isn’t that simple. + +First, there will be slower and faster requests, and [requests that arrive at random won’t balance themselves nicely][3]. They’ll come in clusters that fill up queues, and the backlog will cause large spikes in response time. (There’s a handy rule that says [if you want to keep response time under control, you should target about 80% usage of theoretical total capacity][4].) + +Then there’s diurnal variation. Some local websites get nearly all of their traffic during business hours, or about a third of the day. Even a very global website can easily have 2-3 times more traffic at peak than at trough because populations aren’t distributed evenly around the world (a lot of internet users live in East Asia and North/South America, but not in the huge Pacific ocean). The actual ratio depends on many factors that are hard to predict. + +But even if we can’t easily get exact capacity estimates, this simple model is the justification for splitting websites into three traffic levels. + +### The three traffic levels + +The first level is for sites that get well under 100k dynamic requests a day. Most websites are at this level, and a lot will stay that way while being totally useful and successful. They can also pose complex technical challenges, both for performance and functionality, and a lot of my work is on sites this size. But they don’t have true scalability problems (as opposed to problems that can be solved purely by improving performance). + +If a website gets bigger, it can get into the “growing pains” level, which is roughly around 100k-1M dynamic requests a day. This is where scalability problems start to appear. Often the site is at least a bit scalable (thanks to, e.g., async or multithreaded programming), but Web developers scaling a site through this level keep discovering new surprise pain points. Things that a smaller site can get away with start turning into real problems in this level. Some of the biggest challenges are actually sociotechnical, with the team that builds and manages the site needing to learn to think about it in new ways. + +The next level is after leaving the 1M dynamic requests a day boundary behind. I think of sites at this level as being high traffic. Let me stress that that’s a technical line, not a value judgment or ego statement. The world’s biggest websites are orders of magnitude bigger than that, while most of the world’s useful websites are smaller. But the line matters because you simply can’t run a site at that scale without treating it like a high traffic site. You can get away with it at low traffic levels, you can fumble through it at the growing pains level, but at high traffic levels you just have to work differently. Coincidentally, it’s around this traffic level where it makes more sense to talk about requests per second than requests per day. + +By the way, don’t focus too much on the exact traffic levels above. They’re very rough and honestly I picked them because they’re convenient round numbers that happen to be reasonable for typical websites. The real values depend on the target response time and all the other factors, of course. What I’m trying to explain is 1) that these levels exist, 2) why they exist and 3) what to expect if you’re trying to grow an online service. + +### Going to more levels + +What happens with sites that get even bigger? Once the problems at one set of bottlenecks are fixed, the site should just scale until it hits a new set of bottlenecks, either because the application has changed significantly, or just because of a very large increase in traffic. For example, once the application servers are scalable, the next scaling bottleneck could be database reads, followed by database writes. However, the basic ideas are the same, just applied to a different part of the system. + +Working on a very high-traffic site can be a lot less “exciting” than working on a plain high-traffic site, simply because most major problems need to be solved to get to very high traffic levels in the first place. + +### Scaling when you don’t have scaling problems + +Some developers try to make online services scalable long before they have any scalability problems on the horizon, usually by adding exotic databases or broker servers or something. In particular, startup founders are often especially concerned that their technical assets might not scale to meet their business ambitions. It’s understandable, but it’s a dangerous trap for a couple of reasons. + +One is that Paul Graham’s classic [Do Things That Don’t Scale][5] essay applies to your technology stack, too. You can’t beat bigger companies with scale, but your competitive advantage is that you can choose to _not_ solve the scalability problems that bigger companies are forced to with every step they take. That’s what makes smaller companies agile, and a startup that worries too much about scalability is just a big enterprise without the big to back it up. + +The other problem is that premature scalability solutions can easily backfire. If you don’t have real scalability problems to test your solutions against, it’s hard to be sure you’re correctly solving a real problem. In fact, rapidly growing services tend to change requirements rapidly, too, so the risk of a scalability “solution” turning into technical debt is high. If you keep trying to add scalability to a part of the system that’s already scalable enough, chances are the next scaling bottleneck will appear somewhere else, anyway. + +Architectures that err on the side of too simple are easier to scale in the long run than architectures that are too complex. + +To be more concrete, I personally can’t think of a low-traffic online service I’ve worked on that couldn’t have been implemented cleanly enough using a simple, monolithic web app (in whatever popular language) in front of [a boring relational database][6], maybe with a search index like Xapian or Elasticsearch. [Many major websites aren’t much different from that.][7] It’s not the only valid architecture, but it’s a tried-and-tested one. + +Having said all that, sometimes low-traffic sites need things that are sometimes sold as scalability solutions. For example, replicating an app behind a load balancer can help you deploy whenever you want without downtime. One fintech service I worked on split credit card code into its own service, making PCI DSS compliance simpler. In all these cases there’s a clear problem other than scalability that’s being solved, and that’s what avoids overengineering. + +I often wish I had a systematic way to just figure out all the technical requirements for an online service in my head. But the real world is complicated and messy, and sometimes the only practical way to be sure is to experiment. However, every piece of software starts with ideas, and this is how I think about scalability for online service ideas during the early design phase. + +-------------------------------------------------------------------------------- + +via: https://theartofmachinery.com/2020/04/21/what_is_high_traffic.html + +作者:[Simon Arneaud][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://theartofmachinery.com +[b]: https://github.com/lujun9972 +[1]: https://theartofmachinery.com/2016/07/30/server_caching_architectures.html +[2]: https://mobiforge.com/research-analysis/the-web-is-doom +[3]: https://theartofmachinery.com/2020/01/27/systems_programming_probability.html +[4]: https://www.johndcook.com/blog/2009/01/30/server-utilization-joel-on-queuing/ +[5]: http://www.paulgraham.com/ds.html +[6]: https://theartofmachinery.com/2017/10/28/rdbs_considered_useful.html +[7]: https://nickcraver.com/blog/2016/02/17/stack-overflow-the-architecture-2016-edition/ diff --git a/sources/talk/20200423 Getting to know our new, virtual world.md b/sources/talk/20200423 Getting to know our new, virtual world.md new file mode 100644 index 0000000000..70eebbbeee --- /dev/null +++ b/sources/talk/20200423 Getting to know our new, virtual world.md @@ -0,0 +1,72 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Getting to know our new, virtual world) +[#]: via: (https://opensource.com/article/20/4/virtual-community-management) +[#]: author: (Patricia Dugan https://opensource.com/users/patricia-dugan) + +Getting to know our new, virtual world +====== +Our current forced physical separation could generate innovations that +actually bring our communities closer together. +![Women in computing and open source v5][1] + +Witnessing the ongoing global impact of COVID-19 is a profoundly affecting experience that continues to humble us all in ways we couldn't have anticipated. Technology organizations are quickly evolving within this new reality, in which all of our human interactions are virtual until further notice. + +### Virtual open source community management + +When it comes to nurturing cultures designed to promote and reward open source innovation—as well as communities' economic, technological, and physical wellbeing—I can best speak to those I help build and manage. I believe communities should be built by weaving a tapestry of demographics and ranges of expertise. They should do this in a way that facilitates rich communication and empowers those building open source software to share knowledge with each other. + +The move to virtual connection and digitalized events only makes these methods more crucial. + +I'll share an example. Recently, I was speaking with a pillar of the Traefik open source community, known as a [Traefik Ambassador][2], based in Turkey, over video conference about a potential webinar. He suggested that, instead, we expand the speaker set to include other community members. Soon, we'd invited other contributors from Poland and Switzerland. We met online, and out of that conversation, the webinar has evolved into a collaborative series with community members taking turns presenting insights and melding different types of software together. What struck me was that if we'd had this conversation just one month ago, it would have simply focused on the creation of an asset. Now, contributors are bonding over a purpose-driven creation, with greater intention around facilitating innovation and excitement. + +Based on my experience building and growing open source communities, I believe that this new era of virtual connection offers an unprecedented opportunity for innovation and growth—as long as it is managed with equal focus on the people creating it. Below are five observations on how the world of open source can positively shape the future of innovation in a virtual and seemingly uncertain world. + +### The virtual world is flat. + +Open source communities, teams, and backing companies provide an exceptional model of how to accelerate innovation. That's especially true in these extraordinary times. At its core, open source democratizes the development process, something we see replicated more widely in our new virtual ecosystems. As the opportunity for input becomes more inclusive, organizations are seeing a flattening in infrastructure, both in communications and in operations. Existing hierarchical power structures are weakening as more voices are heard, and the best ideas are given the chance to rise to the top through greater exposure. + +As social distancing makes backchannel and handshake agreements much more complicated to execute, I predict that the traditional dance required to access and take positions in leadership will be replaced by flatter, more open methods that ultimately produce fresher—and better—perspectives. Online communication has a way of laying bare the real substance of interactions and ideas, bolstering meritocracy that's central to the strength of open source. + +### The virtual world is fast. + +This "flattening" structural shift has the potential to increase the pace and quality of innovation, as virtual events and communications widen the spotlight to now shine a light on previously unseen contributors. Creative minds among engineers, developers, and others outside of traditional leadership positions will leverage their comfort with the web and virtual channels to find each other and collaborate faster. This is nothing new for those in open source, and I expect organizations still clinging to legacy approaches will find themselves investing in learning how to implement flatter, virtual communications structures, and beginning to build them into traditional operational models. This means doubling down on efficiency and being willing to let go of the ["it's always been done this way"][3] mentality. + +### The virtual world needs community. + +Developers can conserve energy attending virtual events: there's no commute, nor other distractions from the work at hand. Working remotely and connecting only via virtual mediums enables open source contributors to create, share, and use code just about as fast as their brains allow, empowering rapid code contributions, collaborations, and new solutions produced with velocity. + +While this shift may result in productivity gains, organizations must be careful of creating the impression that a team member's most important asset is their brain. When open source developers were asked what the best part of their job was, [62% claimed it was their "personal passion."][4] Recognizing individuals as unique contributors to open source communities is necessary and essential to development—both technical and human. During this period, when we're hitting the pause button on in-person interaction, remote interactions via chats, video conferences, and phone calls will enable the human moments necessary for growth and connection. Those in open source rely on the power of community, and this extraordinary time will require the continuous and earnest commitment to it. + +### The virtual world is composed of individuals. + +The potential for greater innovation and meritocracy through virtual-only channels will only be realized if communities, organizations, and individuals also pursue and achieve wellness. It's crucial for the interpersonal bonds that maintain our energy and psychological health—traditionally forged through real-life, face-to-face contact—to continue to exist as part of the way we now work. If that disappears, there's the risk that our industry and communities become purely transactional, lacking the joy and drive that carries work forward, much less great work and innovation. Developers are especially rooted in a sense of purpose, with [only 3% reporting that money and perks were the best part of their job.][4] + +Overall wellness and support to prevent burnout should already have been central considerations for modern organizations, but they are even more important now. Virtual connectivity may set us up to work fast, but that can backfire if we're not also set up to be well. + +### The virtual world needs kindness. + +I also predict that virtual-only communication will close the distance between our online avatars and ourselves as real people. The impact of "toxic" individuals, hidden behind a computer, with little to no consequence for being a "bad actor," will be reduced and less acceptable. A growing presence of new voices will set the tone, adhering to well thought out codes of conduct, making poor behavior explicitly unwelcome. As much of our connection moves online, the norms that guide our offline behavior will become increasingly important. We'll transition to a less individualistic paradigm, and open source's long history of considering what defines good citizenship will offer insight to those looking to integrate a sense of shared responsibility into organizations. + +I feel extremely grateful to be in technology, particularly in the open source world, given it's an industry built upon the promise of innovation. At least for the moment, we as an industry can serve as a lighthouse for connection in difficult times, and as a model for collaboration and intention for those not as familiar with how to be highly productive in a virtual world. For the open source community and beyond, there is a great opportunity to lean into creating as much beneficial virtual culture as we can. Through this experience, we'll all learn new ways of interacting, which will serve us well in the future. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/4/virtual-community-management + +作者:[Patricia Dugan][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/patricia-dugan +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/OSDC_women_computing_5.png?itok=YHpNs_ss (Women in computing and open source v5) +[2]: https://info.containo.us/traefik-ambassador-program +[3]: https://goleansixsigma.com/the-most-dangerous-phrase/ +[4]: https://www.linuxfoundation.org/wp-content/uploads/2019/10/osjobsreport_2018.pdf diff --git a/sources/talk/20200424 FCC boosts Wi-Fi 6 spectrum five-fold.md b/sources/talk/20200424 FCC boosts Wi-Fi 6 spectrum five-fold.md new file mode 100644 index 0000000000..4d3545f522 --- /dev/null +++ b/sources/talk/20200424 FCC boosts Wi-Fi 6 spectrum five-fold.md @@ -0,0 +1,72 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (FCC boosts Wi-Fi 6 spectrum five-fold) +[#]: via: (https://www.networkworld.com/article/3540288/fcc-boosts-wi-fi-6-spectrum-five-fold.html) +[#]: author: (Jon Gold https://www.networkworld.com/author/Jon-Gold/) + +FCC boosts Wi-Fi 6 spectrum five-fold +====== +The Federal Communications Commission has approved a chunk of wireless spectrum called the 6GHz band for unlicensed use by Wi-Fi 6, and gear that supports it could be available by the end of the year. +[tejasp][1] [(CC0)][2] + +The Federal Communications commission has opened up a wide swath of wireless spectrum for unlicensed use by Wi-Fi devices, which will lead to Wi-Fi access points that have greatly expanded capacity. + +It’s a huge victory for the Wi-Fi industry, as the ruling means that the amount of spectrum available for Wi-Fi just about quintupled in an instant. That means big, spacious channels – and a lot more channels overall – that can handle a lot more data and a lot more connections at the same time, according to Aruba vice president of wireless strategy and standards Chuck Lukaszewski. + +[[Get regularly scheduled insights by signing up for Network World newsletters.]][3] + +“Overnight, you’re going to see an additional gigabit per second or more of potential throughput,” he said. + +That’s a major upside, certainly, even if “overnight” might be a slightly optimistic view of when [Wi-Fi 6E][4] – the trade name for the new version of Wi-Fi that will take advantage of the new spectrum – hits the market. While some of the necessary standards haven’t yet been finalized by the IEEE, the basic ability to use 6GHz frequencies is already written into the existing Wi-Fi 6 specification. + +Broadcom director of product marketing and government affairs Chris Szymanski said that the main technical hurdle to implementing Wi-Fi 6E will be new radios, but that his company is among those that has already been designing and building compatible silicon. + +“I expect that the FCC will provide guidance on how to certify devices in the next few months,” he said. “I expect product available in the US in the late fall before the holidays.” + +Enterprise uptake will likely have to wait until compatible smartphones, laptops and the like are on shelves because existing Wi-Fi 6 cliets won’t be able to take advantage of the new 6Ghz spectrum. + +**[ [Take this mobile device management course from PluralSight and learn how to secure devices in your company without degrading the user experience.][5] ]** + +New access points are likely to have three radios in them, as opposed to the usual two, noted senior vice president of Ruckus Wireless and cloud at Commscope Bart Giordano. One each for the existing 2.4GHz and 5GHz bands, and a third for 6Ghz. + +“Antennas will be very similar because these spectrums sit next to one another,” he said, “but there’s specific tunings you have to do.” + +The driving force behind the spectrum expansion is the bottomless demand for capacity caused by the increasing use of wireless just about everywhere. The FCC’s announcement cites projections from Cisco that say about 60% of worldwide data traffic will move across Wi-Fi links within the next two years. + +Incumbent licensed users of parts of the 6GHz spectrum – which are mostly businesses using microwave links for wireless backhaul and public safety services – are far less pleased by the FCC’s decision. The Utilities Technology Council is one of several groups critical of earlier proposals to open the 6GHz band to broad-based unlicensed use, saying earlier that assurances that existing users would be protected from interference are unconvincing. + +“We have and will continue to provide the FCC with technical detail demonstrating the very real interference potential from unlicensed use across all parts of the band and the need for thoroughly tested automated frequency coordination (AFC) to protect incumbent users,” the group said in a statement. “While we appreciate the FCC proposing to require AFC for the standard-power access points, these measures must also be applied to all unlicensed devices in the band to prevent interference to mission-critical utility communications systems.” + +Farpoint Group principal and Network World contributor Craig Mathias said that it’s not going to be a smooth process, but argues that the opening of 6GHz spectrum was too great an opportunity to ignore. + +“Yes, it’s a mess – spectral re-allocations always are,” he said. “[But] I don't see any issues here that can't be addressed, and more unlicensed spectrum is of course always desirable.” + +Incumbent users of the 6GHz spectrum are unlikely to see the type of interference they’re particularly worried about, he added, given the nature of the connections currently in use and the safeguards in the new rule that are designed to protect existing networks. + +“Point-to-point microwave links operate at fairly high power and use both directional antennas and error-checking protocols to ensure reliability and otherwise deal with typical radio issues beyond interference, like the various forms of fading,” said Mathias. “A nearby Wi-Fi transmitter will be operating at much lower power and use its own signal-integrity-management techniques as well. So likely no issues in the vast majority of cases, especially if history is any guide.” + +Join the Network World communities on [Facebook][6] and [LinkedIn][7] to comment on topics that are top of mind. + +-------------------------------------------------------------------------------- + +via: https://www.networkworld.com/article/3540288/fcc-boosts-wi-fi-6-spectrum-five-fold.html + +作者:[Jon Gold][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.networkworld.com/author/Jon-Gold/ +[b]: https://github.com/lujun9972 +[1]: https://pixabay.com/en/wifi-wireless-device-wi-fi-1371030/ +[2]: https://creativecommons.org/publicdomain/zero/1.0/ +[3]: https://www.networkworld.com/newsletters/signup.html +[4]: https://www.networkworld.com/article/3238664/80211-wi-fi-standards-and-speeds-explained.html +[5]: https://pluralsight.pxf.io/c/321564/424552/7490?u=https%3A%2F%2Fwww.pluralsight.com%2Fcourses%2Fmobile-device-management-big-picture +[6]: https://www.facebook.com/NetworkWorld/ +[7]: https://www.linkedin.com/company/network-world diff --git a/sources/talk/20200424 Red Hat Enterprise Linux 8.2 Hits the stage.md b/sources/talk/20200424 Red Hat Enterprise Linux 8.2 Hits the stage.md new file mode 100644 index 0000000000..e00e88716c --- /dev/null +++ b/sources/talk/20200424 Red Hat Enterprise Linux 8.2 Hits the stage.md @@ -0,0 +1,89 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Red Hat Enterprise Linux 8.2 Hits the stage) +[#]: via: (https://www.networkworld.com/article/3540189/red-hat-enterprise-linux-82-hits-the-stage.html) +[#]: author: (Sandra Henry-Stocker https://www.networkworld.com/author/Sandra-Henry_Stocker/) + +Red Hat Enterprise Linux 8.2 Hits the stage +====== +RHEL 8.2 has new capabilities for management of hybrid-cloud environments and container tools to help fuel cloud-native development. +Stephen Lawson/IDG + +Red Hat Enterprise Linux (RHEL) 8.2 brings new features that include expanded monitoring capabilities in Red Hat Insights for and new container tools, including containerized versions of Skopeo and Buildah. + +Red Hat says RHEL 8.2 is arriving at a time when, because of the Covid-19 pandemic, a growing percentage of IT staffers are working remotely. Their ability to support the management and monitoring of operations and their ability to detect and address problems has never been more critical, and upgrades to Red Hat Insights are designed to help. + +[[Get regularly scheduled insights by signing up for Network World newsletters.]][1] + +### Red Hat Insights + +[Red Hat Insights][2], is Red Hat’s operations and security-risk-management offering and helps detect, diagnose and remediate potential problems before they affect production systems or end users. It was included in RHEL in May 2019. + +The latest updates include: + + * Improved visibility and  security for managing large, complex environments + * Policy and patch services to help determine which product advisories apply and guidance for problem remediation + * A "drift service" to make it easier to compare baselines, shape strategies that reduce complexity, and make troubleshooting easier + + + +### Monitoring and performance updates + +RHEL 8.2 brings some performance upgrades includeing: + + * Improved resource management with Control Groups (cgroup) v2, which is designed to reserve and set limits on memory usage to help prevent processes from overconsuming memory and causing system failures or slowdowns. + * Optimizing performance-sensitive workloads via NUMA and sub-NUMA service policies. + * Performance Co-Pilot (PCP) 5.0.2 which adds collection agents for Microsoft SQL Server 2019 to gather and analyze SQL Server metrics to draw a clearer picture of database and operating-system performance. + * Red Hat subscription watch,a service for viewing and managing RHEL and Red Hat OpenShift Container Platform subscriptions. + + + +### Evolving container tools + +RHEL 8.2 includes new container tools that are supported for 24 months as part of Red Hat's Tech Preview, which provides early access to new products. The tools include Buildah for building and Skopeo for transferring container images. + +The new relase also introduces Udica, a policy tool for containerized SELinux that can make it less likely that processes will break out of containers and cause problems to other containers or the host. + +[][3] + +Red Hat Enterprise Linux 8.2 also introduces enhancements to the Red Hat Universal Base Image, including: + + * OpenJDK and .NET 3.0 for developing  certification-ready cloud-native Red Hat applications + * **Improved access to source code associated with a given image through a single command**, making it easier for Red Hat partners to meet source code requirements for open source licensing needs. + + + +### Ease of use + +Other new features are meant to make it easier to manage RHEL: + + * RHEL subscription registration as part of the installation process, making it easier to on-board new installations. + * Enabling Red Hat Insights during installation to simplify the launch of Insights for Red Hat Enterprise Linux deployments. + * Refinement and control of the Red Hat Enterprise Linux life cycle with testing for in-place upgrades, Red Hat Insights rules to help with upgrades, and the [Convert2 RHEL][4] tool that can help shift workloads from unsupported clones like CentOS to RHEL. + + + +Join the Network World communities on [Facebook][5] and [LinkedIn][6] to comment on topics that are top of mind. + +-------------------------------------------------------------------------------- + +via: https://www.networkworld.com/article/3540189/red-hat-enterprise-linux-82-hits-the-stage.html + +作者:[Sandra Henry-Stocker][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.networkworld.com/author/Sandra-Henry_Stocker/ +[b]: https://github.com/lujun9972 +[1]: https://www.networkworld.com/newsletters/signup.html +[2]: https://www.redhat.com/en/blog/expanding-management-operational-and-security-risks-new-red-hat-insights +[3]: https://www.networkworld.com/blog/itaas-and-the-corporate-storage-technology/?utm_source=IDG&utm_medium=promotions&utm_campaign=HPE22140&utm_content=sidebar (ITAAS and Corporate Storage Strategy) +[4]: https://www.redhat.com/en/blog/convert2rhel-how-update-rhel-systems-place-subscribe-rhel +[5]: https://www.facebook.com/NetworkWorld/ +[6]: https://www.linkedin.com/company/network-world diff --git a/sources/talk/20200427 Comparing subscription, pay-per-bug, and consulting software business models.md b/sources/talk/20200427 Comparing subscription, pay-per-bug, and consulting software business models.md new file mode 100644 index 0000000000..c7d76c5590 --- /dev/null +++ b/sources/talk/20200427 Comparing subscription, pay-per-bug, and consulting software business models.md @@ -0,0 +1,81 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Comparing subscription, pay-per-bug, and consulting software business models) +[#]: via: (https://opensource.com/article/20/4/open-source-business) +[#]: author: (Jos Poortvliet https://opensource.com/users/jospoortvliet) + +Comparing subscription, pay-per-bug, and consulting software business models +====== +Learn how NextCloud achieves business revenue that is one-third +consulting and two-thirds subscription. +![A chair in a field.][1] + +At FOSS Backstage this year, I hosted a discussion on open source models and shared why I think subscriptions are a great way to support open source products. + +### Picking a business model + +The company I co-founded, Nextcloud, only offers its services to customers on a (per user) subscription model. Some customers ask us during the sales conversation why they cannot just get access to our engineers on an hourly basis as they get from third party consultants: pay for the bug fix or support case, and be done? + +When we discussed how to build our new company in 2016 during our very first "[hackweek][2]," our business model was an important conversation. The team discussed different approaches, and we decided to go for a subscription model. Such a model felt more in line with our mission and principles to [create a great product and run a trustworthy company.][3] + +Why? While hourly rates seem like an easy way to get a quick fix for a problem, getting paid for fixing issues creates an incentive to create more buggy software, which of course, was not how we want to run our business. + +Let's look a bit deeper at the choices. + +### Subscription + +As a customer, you want the most reliable software. And when (not if, when) things go wrong, you want them fixed as quickly as possible. Our company offers customers a subscription to our services. Such a subscription includes direct and unlimited access to our engineers the moment you run into a problem. These two points are very important. It means that a customer has the certainty of having the very best resources at their fingertips at the moment they need them, and as much as they need them, in a way that only the original software vendor can deliver. + +For that, they pay a fee that scales with the number of users. + +### Pay-per-bug + +What if, instead, you could pay per issue fixed? In a way, this choice is similar to insurance. Indeed, when you need cold medicine once a year, the cost of a health insurance policy with a monthly premium seems prohibitive. But when a car accident crushes your spine and your medical costs skyrocket, not having to sell your house makes up for that premium and then some. + +There is also the bigger picture: The incentives potentially created by a pay-per-bug model. It is a simple, albeit cynical calculation: If we got paid per bug we fix for customers, leaving more bugs in our product would increase our income. Now we're not saying every company offering product consulting by the hour is extorting their customers, merely that this backward incentive exists, even when most moral businesses would not give in to it. + +Conversely, now that we offer insurance, we lower our support costs by building a better product, just like art insurance providers do what they can to ensure the art kept at their customers' exhibition is secure to keep their costs low. Our support team deeply cares about how our customers use our product: a better setup and good security practices not only make happier customers; it saves them time. + +Or, in other words, it helps maximize the ROI or TEI the customer gains from deploying Nextcloud. + +That is what we'd call a win-win and a business model an open source company can be proud of. + +### Consulting + +Now I discuss this business model regularly with others, and I invariably get told: "You might be right, but most of my customers only want to pay for the bugs we fix, or for features. Consulting is our main source of income! And I have no illusions about changing that." + +Yes, that's an issue. We open source folk honestly have a sales and marketing issue. And yes, you might think that, as a marketing guy, I just see everything as a nail I can hit with my communications hammer. But really, communication is core to the issue—how you communicate your value—which, in turn, requires you to be aware of your value. + +Recently, I had some challenging discussions with users on our forums who were upset that our engineers had not fixed their issues quickly enough. These users were clearly business users, and giving free support on GitHub obviously isn't exactly a great advertisement for the need for a subscription. So some abuse was thrown our way, and I took the hit. When complaining about it all to a fellow entrepreneurial friend of mine, he remarked: "Isn't that good news? They were frustrated and angry because clearly, you have something to offer, they need it, and are annoyed that they are forced to pay you for it. A good place to be in if you want to sell something!" Right he was, of course. + +The lesson I want to share with this anecdote is: You have something to offer. Your current customers will certainly be upset if you tell them that, going forward, they can only get your services under a subscription. But the angrier they are, the more you know they _need_ you, and you should persist! + +But moving to subscription from consulting requires a great deal of discipline, including saying "no" often. We have hard, internal rules, and one of these is that sales can only sell consulting valued at up to 50% of the subscription value, and only for deals greater than $10,000. + +But it has worked. The breakdown of our business revenue is now about one-third consulting and two-thirds subscription. Engineering hours for consulting work are not the limiting factor for expanding our customer base; sales and sales engineering is. We doubled our order intake last year and plan to do the same this year. + +### Bottomline: Sustainability + +For us, a better product and more sustainable business follows from the subscription model. It also benefits software engineers, who prefer to build a better product and spend less time on debugging issues with customers. A pay-by-the-hour model, with all the time tracking and incentive to keep customers dependent, does not work for us. + +What has your experience been? Tell us in the comments. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/4/open-source-business + +作者:[Jos Poortvliet][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/jospoortvliet +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/BIZ_WorkInPublic_4618517_1110_CS_A.png?itok=RwVrWArk (A chair in a field.) +[2]: https://nextcloud.com/blog/invitation-to-our-hackweek-in-stuttgart/ +[3]: https://nextcloud.com/blog/the-nextcloud-mission-and-principles/ diff --git a/sources/talk/20200427 DevOps vs. Agile- Do they have anything in common.md b/sources/talk/20200427 DevOps vs. Agile- Do they have anything in common.md new file mode 100644 index 0000000000..a8fcf422c6 --- /dev/null +++ b/sources/talk/20200427 DevOps vs. Agile- Do they have anything in common.md @@ -0,0 +1,85 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (DevOps vs. Agile: Do they have anything in common?) +[#]: via: (https://opensource.com/article/20/4/devops-vs-agile-common) +[#]: author: (Taz Brown https://opensource.com/users/heronthecli) + +DevOps vs. Agile: Do they have anything in common? +====== +Agile and DevOps have many differences, yet they both seek to address +complexity, improve quality, and innovate around software design. +![Women in tech boardroom][1] + +The topic of DevOps vs. Agile is almost like debating iPhone vs. Android—everyone has an opinion, and emotions can become heated, especially if people disagree. + +After writing _[DevOps v. Agile: What's the difference?][2]_ and reading the comments on the article, I wanted to add some more thoughts—including how some of my thinking has changed on the topic. + +My perspective comes from where I am now but also where I have been. I used to be a systems administrator and infrastructure engineer, and now I am a senior scrum master with a major utility company in Missouri. (I actually was a scrum master before I was an admin or engineer, but I digress.) + +My team consists of six frontend software engineers and IT programmer analysts, a business analyst, two product owners, and me. Recently, we learned that management wants our team to become a [DevSecOps][3] team, so our core scrum team is working with a DevSecOps team that is helping us make the transition. No one is naive to the fact that this will not be easy, but the DevSecOps team's experience gives us confidence that we can succeed. + +Our team's manager recently hired a senior software engineer who will drive the DevSecOps goal. As a scrum master, I will continue to focus on continuous improvement. The team is fairly young, so they don't have expansive work experience, but they are smart and driven, and there is much room for greatness. In addition, our entire organization is going through an Agile transformation, so most people are new to all things Agile, including the [Agile Manifesto][4] and the [Five Scrum Values][5]. + +![Spray paint on a container][6] + +Kyle Glenn on Unsplash + +### Agile, Scrum, DevOps, and more + +There is a clear relationship between DevOps and Agile. Agile is the methodology, Scrum is the framework, and DevOps falls under the agile [umbrella][7] along with kanban, lean, large-scale Scrum, Extreme Programming, Crystal, and more. For example, our Scrum team is an Agile team that will operate as a DevSecOps team. + +Neither DevOps nor Agile is about the tools. Rather, both are about the [mindset and culture][8]. When it is done right, teams think and act differently and achieve greater results, including faster software delivery, continuous integration (CI), continuous delivery (CD), continuous improvement, working software, faster solutions, more collaboration, and fewer silos. Additional results are seen in quality testing, better automation, and improved systems, processes, and practices. + +#### Common concepts + +Some of the Agile concepts they have in common are associated with the Agile Manifesto; the most familiar of the 12 principles are the first four: + + * Individual and interactions over processes and tools + * Working software over comprehensive documentation + * Customer collaboration over contract negotiations + * Responding to change over following a plan + + + +Some of the DevOps concepts they have in common are the CI/CD pipeline, optimizing software delivery and quality, a culture of innovation, service-level objectives and indicators (SLOs and SLIs), collaboration across teams, and automation. + +#### DevOps and Agile benefits + +DevOps speeds up things between developers and operations. Furthermore, even though DevOps isn't about the tools, the fact that the dev and ops teams use the same tech stack creates a shared language and empathy between the two. Our Scrum team uses Jira to track all bugs, enhancements, and team performance. Common DevOps tools are Jenkins, AWS, SonarQube, GitHub, Splunk, and Ansible. While the tools differ from team to team, the mindset and culture should be common across all. + +DevOps also creates less division between dev and ops and a sense of understanding of what it's like to walk in each other's shoes because now they function as one. + +Agile teams continuously deliver often and fast, adapting incrementally along the way. Working in two-week sprints appears to be the sweet spot for most software- or product-delivery teams. Agile teams may utilize DevOps principles in their work (e.g., implementing a CI/CD pipeline), and dev teams that work with ops are likely to work in the same two-week increments. + +DevOps traditionally leads to continuous deployment, delivery, and integration. Teamwork is integrated; problems and failures are jointly owned by development, operations, and other entities, such as quality assurance (QA), testing, automation, etc. + +### Summing up + +I believe that Agile and DevOps breathe the same air, with many concepts and theories crossing between them. + +While I have no doubts that there will be counter opinions and even some sharply worded disagreements with my opinions, I think we would all agree that Agile and DevOps seek to address complexity, improve quality, and innovate around software design. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/4/devops-vs-agile-common + +作者:[Taz Brown][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/heronthecli +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/christina-wocintechchat-com-rg1y72ekw6o-unsplash_1.jpg?itok=MoIv8HlK (Women in tech boardroom) +[2]: https://opensource.com/article/20/2/devops-vs-agile +[3]: https://opensource.com/article/19/1/what-devsecops +[4]: https://agilemanifesto.org/ +[5]: https://www.scrumalliance.org/about-scrum/values +[6]: https://opensource.com/sites/default/files/uploads/roomtogrow_kyleglenn.jpg (Spray paint on a container) +[7]: https://opensource.com/article/20/4/kanban-devops +[8]: https://opensource.com/article/19/5/values-devops-mindset diff --git a/sources/talk/20200428 How I empower and reach millions through open source.md b/sources/talk/20200428 How I empower and reach millions through open source.md new file mode 100644 index 0000000000..a3c23dd073 --- /dev/null +++ b/sources/talk/20200428 How I empower and reach millions through open source.md @@ -0,0 +1,78 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How I empower and reach millions through open source) +[#]: via: (https://opensource.com/article/20/4/interview-Netha-Hussain) +[#]: author: (Jay Barber https://opensource.com/users/jaybarber) + +How I empower and reach millions through open source +====== +Learn how Netha Hussain, winner of the 2020 Women in Open Source +Academic Award, shares knowledge and inspires people. +![Lightbulb][1] + +"I wanted to link to a particular Wikipedia article on my blog, but I found there wasn't one on that topic, so I wrote it myself," says Netha Hussain, 2020 [Women in Open Source Academic Award][2] winner. "That's the beauty of open source; anyone can contribute." + +![Photo by Lvova Anastasiya \(Львова Анастасия, Lvova\), CC BY-SA][3] + +Practicality drove Netha's entry into open source culture, and it has continued to be at the center of her work in the ten years since. + +She received her first computer in high school, but it did not immediately spark her passion. She says she mostly used it for games and other diversions, as many teenagers do. It wasn't until she entered medical school and realized that technology could be a powerful tool to help her achieve her goals that Netha truly found her path. Taking stock of her many contributions to [Wikimedia][4], [Mozilla][5], and [TED][6], it's fair to say that once she engaged with open source culture, she never looked back. + +### Finding ways to help + +Growing up in India, Netha was initially drawn to mathematics but soon found herself pulled in other directions. "At the time, I would have expected to continue down that path, mathematics or maybe writing, but the thing that I've always most wanted to do is help people," Netha says. "Medicine seemed to be the most direct path to providing real, tangible assistance to those around me, so I became a doctor." + +That drive to help continues to guide her now as she prepares to defend her doctoral thesis in clinical neuroscience at the University of Gothenburg in Sweden. + +"At a certain point, I decided that rather than limiting myself to what I could do through treating patients, I could also contribute in a research capacity, working to discover new, better ways to help others. I came to all of this via an unexpected route, but I love the idea of exploring and finding my own ways to help. I'm so satisfied and fulfilled by the work I'm doing now. It has been a wonderful journey." + +As she nears the completion of her degree, Netha reflects upon what she's looking forward to next. An infectious smile appears as she remarks, "I'm really excited to have more time to contribute to projects in the open source community." + +Why is she so enamored with open source? It comes back to utility. "In open source practices, I found a philosophy that closely matched my own ideals and a way of doing things that allowed me to help more people. Open source is fueled by collaboration. I've seen the things that can be accomplished by people working together, and it makes me very excited to think where it will take us in the future." + +### Reaching millions, one edit at a time + +Her first article, written to help an international audience understand her blog post, was only the first of many. Netha has now written 300 articles (200 in English and 100 in Malayalam), contributed 13,000 edits for [Wikipedia][7], added 9,000 images to [Wikimedia Commons][8], and provided 120,000 edits to [Wikidata][9]. Her commitment to bringing useful information to others can also be seen in her five years spent volunteering to translate Mozilla projects and TED talks into the Malayalam language. + +Such prolific output was born out of a simple realization. "I had shared so much on my blog but was only reaching a select audience. On Wikipedia and elsewhere, I had access to a potential audience of millions. There's a lot of power in that." + +Many of the articles Netha has written center on issues relevant to women, and that is very much by design. "I find myself writing on topics that are important to women because I feel they are an underserved community, and it is important to me that Wikipedia, as such a vital repository of information, be reflective of all users, all voices. I care deeply about the visibility of women on Wikipedia." + +Netha's commitment to women's issues led her to organize edit-a-thon initiatives and other activities with women's groups. She was also able to leverage similar strategies to assist the LGBTQ+ community in India during the campaign to legalize gay marriage. + +"In India, there are a lot of taboos around homosexuality, and I saw an opportunity to utilize my experience to help another segment of the population. Together, we were able to generate a lot of awareness, whether through raising up biographical articles on famous members of the LGBTQ+ community or shining a spotlight on anti-LGBTQ+ laws. I'm very proud of the opportunities I've had to support such efforts." + +### A path to the future + +It's clear that Netha believes strongly in empowering people, especially other women who may wish to explore open source methodologies as she has. Her advice is simple, but powerful. "Believe in yourself, and know that you have the skills and talent to do whatever you'd like to do," she finds the words easily, as if she's been waiting to be asked the question. "Follow your passion, and do what you want. There will be times of uncertainty but always move forward. Keep studying. Keep learning new things. That's how you grow, both in your field and as a person." + +Having achieved so much already, it's no surprise that Netha is enthusiastic about new challenges on the horizon. "I've put in a lot of effort to get here, but as you learn new strategies and new ways of collaborating, the work gets easier. Now, I don't consider it work at all. It's mostly fun to me." + +_Also read Jay Barber's [interview with Megan Byrd-Sanicki][10], who won the 2020 Women in Open Source Community Award._ + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/4/interview-Netha-Hussain + +作者:[Jay Barber][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/jaybarber +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/lightbulb-idea-think-yearbook-lead.png?itok=5ZpCm0Jh (Lightbulb) +[2]: https://www.redhat.com/en/about/women-in-open-source +[3]: https://opensource.com/sites/default/files/uploads/netha_headshot.png (Photo by Lvova Anastasiya (Львова Анастасия, Lvova), CC BY-SA) +[4]: https://www.wikimedia.org/ +[5]: https://www.mozilla.org/en-US/ +[6]: https://www.ted.com/ +[7]: https://www.wikipedia.org/ +[8]: https://commons.wikimedia.org/wiki/Main_Page +[9]: https://www.wikidata.org/wiki/Wikidata:Main_Page +[10]: https://opensource.com/article/20/4/interview-Megan-Byrd-Sanicki diff --git a/sources/talk/20200430 Industrial robots could -eat metal- to power themselves.md b/sources/talk/20200430 Industrial robots could -eat metal- to power themselves.md new file mode 100644 index 0000000000..45995a9660 --- /dev/null +++ b/sources/talk/20200430 Industrial robots could -eat metal- to power themselves.md @@ -0,0 +1,67 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Industrial robots could 'eat metal' to power themselves) +[#]: via: (https://www.networkworld.com/article/3540194/industrial-robots-could-eat-metal-to-power-themselves.html) +[#]: author: (Patrick Nelson https://www.networkworld.com/author/Patrick-Nelson/) + +Industrial robots could 'eat metal' to power themselves +====== +Scavenging energy by foraging for metal could power Internet of Things electronics and robots, suggest researchers at University of Pennsylvania. +Jiraroj Praditcharoenkul / Getty Images + +A fundamental manufacturing shift is on the horizon, some say. It's where robots run all elements of our future factories. The machines will operate using brain-copying artificial intelligence and handle not only manufacturing processes, but also supply-chain logistics, planning, and other roles formerly performed by humans. + +This vision of the future anticipates an industrial workplace where Internet-connected machines will mimic humans, yet do the jobs more precisely, faster and cheaper than humans. + +And the human-copying element may not end there. Researchers at the University of Pennsylvania are suggesting that robots could end up eating like humans, too. + +Robots will "eat metal for energy," according to a [news article][1] published in Medium. The researchers' vision for a "metal-air scavenger" could solve one of the quandaries of future IoT-enabled factories. That quandary is how to power a device that moves without adding mass and weight, as one does by adding bulky batteries. + +The answer, according to the University of Pennsylvania researchers, is to try to electromechanically forage for energy from the metal surfaces that a robot or IoT device traverses, thus converting material garnered, using a chemical reaction, into power. + +"Robots and electronics [would] extract energy from large volumes of energy dense material without having to carry the material on-board," the researchers say in a paper they've published in [ACS Energy Letters][2]. + +It would be like "eating metal, breaking down its chemical bonds for energy like humans do with food." Batteries work by repeatedly breaking and creating chemical bonds. + +The research references the dichotomy between computing and power storage. Computing is well suited to miniaturization, and processers have been progressively reduced in size while performance has increased, but battery storage hasn't. You need a bigger battery for more energy. + +Even if swarming, industrial robots became the size of insects (I've [written about][3] the possibility), there's an issue powering the nano devices – the required size of the power source would defeat the object of the miniaturization. The battery alone could crush the device, and even if it didn't, the machine would need excessive amounts of energy to move, because of the battery mass. This conundrum is one of the reasons there's an emphasis in IoT development to find ways to harvest energy ambiently. + +However, with ambient power – such as is found in [solar or potentially magnetism][4], for example – power density comes into play. That's where the harvesting technology can't pull enough energy out of the environment, or it does it so slowly that it's not as power-effective as traditional batteries. + +Enter the metal-eating robot. The University of Pennsylvania researchers' form of harvesting efficiently replicates a power-dense battery. Metal is more dense than the battery chemistry. + +The group performs their foraging energy production with a hydrogel electrolyte sponge towed by the robot. It uses a cathode, dragged over the surface, to extract amperages from the metal fuel source, such as steel or aluminum. + +"Our [metal-air scavenger] has a power density that's ten times better than the best harvesters, to the point that we can compete against batteries," said James Pikul, an assistant professor in the University of Pennsylvania's Department of Mechanical Engineering and Applied Mechanics and one of the paper authors, in the Medium post. "It's using battery chemistry, but doesn't have the associated weight, because it's taking those chemicals from the environment." + +This method is also potentially better than existing lithium-ion battery chemistry, according to Pikul. + +"One day, a robot that needs to recharge its batteries will just need to find some aluminum to 'eat,'" Pikul said. + +The robot, although ultimately likely to be a better worker than the human, is a messy eater. As it oxidizes the metal it passes over, it leaves a "microscopic layer of rust in its wake," according to the article. + +Join the Network World communities on [Facebook][5] and [LinkedIn][6] to comment on topics that are top of mind. + +-------------------------------------------------------------------------------- + +via: https://www.networkworld.com/article/3540194/industrial-robots-could-eat-metal-to-power-themselves.html + +作者:[Patrick Nelson][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.networkworld.com/author/Patrick-Nelson/ +[b]: https://github.com/lujun9972 +[1]: https://medium.com/penn-engineering/penn-engineerings-new-scavenger-technology-allows-robots-to-eat-metal-for-energy-bd12f3b83893 +[2]: https://pubs.acs.org/doi/10.1021/acsenergylett.9b02661 +[3]: https://www.networkworld.com/article/3429200/self-organizing-micro-robots-may-soon-swarm-the-industrial-iot.html +[4]: https://www.networkworld.com/article/3536697/harvesting-ambient-energy-will-power-iot-scientists-say.html +[5]: https://www.facebook.com/NetworkWorld/ +[6]: https://www.linkedin.com/company/network-world diff --git a/sources/talk/20200501 Red Hat Summit 2020 virtual experience.md b/sources/talk/20200501 Red Hat Summit 2020 virtual experience.md new file mode 100644 index 0000000000..334c52c1f9 --- /dev/null +++ b/sources/talk/20200501 Red Hat Summit 2020 virtual experience.md @@ -0,0 +1,64 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Red Hat Summit 2020 virtual experience) +[#]: via: (https://www.networkworld.com/article/3541289/red-hat-summit-2020-virtual-experience.html) +[#]: author: (Sandra Henry-Stocker https://www.networkworld.com/author/Sandra-Henry_Stocker/) + +Red Hat Summit 2020 virtual experience +====== + +[Virginiambe][1] [(CC BY-SA 3.0)][2] + +In the last couple days, Red Hat was able to demonstrate that an online technical conference can succeed. The Summit, normally held in Boston or San Francisco, was held online thanks to the Covid-19 pandemic still gripping the world. + +The fact that 80,000 people attended the online event warrants a huge applause. By comparison, last year’s in-person conference broke the record with only 8,900 attendees. + +[[Get regularly scheduled insights by signing up for Network World newsletters.]][3] + +### **Being “there”** + +The experience of attending the conference was in many ways what you would expect when attending a large conference in person. There were keynotes, general sessions and breakout sessions. There were many opportunities to ask questions. And it was often difficult but necessary to choose between parallel sessions. I attended both days and was very impressed. + +I also enjoyed some nostalgia about how we’ve all arrived at the places we are today with respect to Linux. It was clear that many attendees were overwhelmed by the progress that has been made just since last year. Linux, and [RHEL][4] in particular, is becoming more innovative, more clever in the ways that it can detect and respond to problems and yet in some important ways easier to manage because of the way the tools have evolved. + +Announcements at the conference included Red Hat OpenShift 4.4, OpenShift virtualization and Red Hat Advanced Container Management for Kubernetes. + +What was novel about attending a technical conference online was that we didn’t have to leave our home or office and that we could review sessions that we missed by selecting them later from the session layout pages. In fact, the sessions are still online and may well be for the coming year. If you didn’t participate in Red Hat Summit 2020, you can still sign up and you can still watch the sessions at your convenience. Just go to the [summit site][5]. And, did I mention, that it's free? + +### Catching up + +Once you’re signed up, you can click on the Watch and Learn at the top of the page and choose General Sessions or Sessions and Labs. The presentations will now all be labeled On Demand though they once displayed upcoming time slots. The individuals presenting information are excellent and the material is exciting. Even if you’re not working with Red Hat Enterprise Linux, you will learn a lot about Linux in general and how open source has evolved over the decades and is still evolving in important and critical ways. + +Topics covered at the conference include OpenShift, open hybrid cloud, future technologies, robotics and automation, advances on the edge and the power of open source. Red Hat Summit also includes joint sessions with both Red Hat and technology collaborators such as Ford, Verizon, Intel, Microsoft and Credit Suisse. + +### What’s next? + +Watching the conference online at a time when I can't leave my home was informative, but also encouraging and comforting. Linux has been an important part of my life for decades. It felt good to be connected to the larger community and to sense the currents of progress through my desktop system. + +While there’s no way to know at this point whether future Red Hat Summits or other Linux conferences will be held or made available online, the fact that Red Hat Summit 2020 was available online when so many of us are still huddled up at home wondering when our world will reopen was a testament not just to great technology but to the deep-seated conviction that it is critical that we work together and that open source can make that happen in ways that nothing else can. + +Join the Network World communities on [Facebook][6] and [LinkedIn][7] to comment on topics that are top of mind. + +-------------------------------------------------------------------------------- + +via: https://www.networkworld.com/article/3541289/red-hat-summit-2020-virtual-experience.html + +作者:[Sandra Henry-Stocker][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.networkworld.com/author/Sandra-Henry_Stocker/ +[b]: https://github.com/lujun9972 +[1]: https://commons.wikimedia.org/wiki/File:Red_hat_with_bow2.JPG +[2]: https://creativecommons.org/licenses/by-sa/3.0/legalcode +[3]: https://www.networkworld.com/newsletters/signup.html +[4]: https://www.networkworld.com/article/3540189/red-hat-enterprise-linux-82-hits-the-stage.html +[5]: https://www.redhat.com/summit +[6]: https://www.facebook.com/NetworkWorld/ +[7]: https://www.linkedin.com/company/network-world diff --git a/sources/talk/20200502 The real impact of canceling PyCon due to COVID-19.md b/sources/talk/20200502 The real impact of canceling PyCon due to COVID-19.md new file mode 100644 index 0000000000..aebbbf28c4 --- /dev/null +++ b/sources/talk/20200502 The real impact of canceling PyCon due to COVID-19.md @@ -0,0 +1,129 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (The real impact of canceling PyCon due to COVID-19) +[#]: via: (https://opensource.com/article/20/5/pycon-covid-19) +[#]: author: (Matthew Broberg https://opensource.com/users/mbbroberg) + +The real impact of canceling PyCon due to COVID-19 +====== +An interview with Ewa Jodlowska on how the Python Software Foundation is +responding to the cancelation of in-person events. +![A dollar sign in a network][1] + +The Python Software Foundation (PSF) had to [cancel its popular PyCon US][2] event in response to COVID-19. I interviewed [Ewa Jodlowska][3], Executive Director of the PSF, to talk about the experience and see what we all can learn, and how we can be supportive of the non-profit that supports one of my favorite programming languages. + +### The impact on PSF employees + +I asked Jodlowska "how have you had to adjust your work in light of COVID-19?" + +In her response, the day-to-day didn't sound like much of a change. PSF staff "have always worked remotely." The organization practices a [fully remote work][4] culture and doesn’t have an office. The small staff of seven employees is well versed in collaborating outside of an office. + +Familiarity aside, the emotional impact of needing to cancel an event they put a year’s worth of planning into hurt. + +> **"We all believe in what we do. Which is particularly why we’re such a great small team. So it really impacted us emotionally and mentally. And it continues to."** + +We spoke about how the team is reliving what the days would have looked like if PyCon wasn't interrupted by COVID-19–keynotes would start _now_, the sponsor booths would be in full motion right _now_–and just how emotionally taxing it all was. Throughout the discussion, Jodlowska always came back to recognizing the staff for their resiliency and energy to pivot the event online. + +### The cascading impact of event cancellation + +Jodlowska has been incredibly transparent about the experience. In her March 31st [article on the financial outcome][5], she outlines it clearly: the Python Software Foundation would take a hit from the event cancelation.  + +Jodlowska notes that part of the challenge is that PyCon accounts for too much of the organization’s financial health. About 63% of the 2020 revenue was projected to come from the show. While that number is down from the [2017 estimate of 80%][6], it’s still a concern when in-person events will remain limited to keep attendees safe during the COVID-19 outbreak. + +> **"We don’t want to rely on one event**–**or events in general**–**to operate and provide community support."** + +The PSF board of directors is hard at work to look into the diversification of funding. In the meantime, PyCon remains essential to sustainability running the organization. + +### Community support makes all the difference + +It's at this point that Jodlowska again recognizes the incredible work of the PSF staff. They quickly pivoted the vision of the event, and the community of attendees, sponsors, and speakers were all supportive of the move. + +> **"[We] have been brought to tears many times by the generosity of our sponsors and our individual donors."** + +Jodlowska noted that the generosity of so many resulted in reducing the financial impact on the PSF. An incredible amount of Individual attendees are donating their registration costs to the PSF. They are also showing up across social media sites to participate in their own distributed virtual experience of PyCon.  + +Another important part of the community, the corporate sponsors of the show, are also showing up to support the non-profit. Many sponsors had already canceled physical presence at the show before the event was officially moved online. Some of them were kind enough, as Jodlowska noted, to donate the cost of sponsorship to the PSF. In a huge turn of events, the list of sponsors **grew** as the online event came together. + +> **[M]any sponsors have opted into participating in PyCon 2020 online. Because of this we have decreased the amount needed from our reserve by 77%! The PSF will now only need $141,713 from its financial reserve to get through 2020.** + +For more on the data side, see Jodlowska’s article _[Thank you to donors & sponsors][7]_. + +Support in all its forms led to the conference feeling like it is well on its way. Some sponsors are even moving to a virtual booth experience. + +> Since our sponsors can’t be with you in person, we’ve created a place to provide their content online - . [#PyCon2020][8] Gold Sponsor Weekly Python Exercise shared this video to introduce you to their offerings: . +> +> — PyCon US (@pycon) [April 18, 2020][9] + +Maybe most impressively, many speakers and tutorial instructors made the effort of recording their sessions. That’s helped PyCon to [gradually unfold online][10] with incredible educational content. The audience is still able to interact as well: YouTube comments are open for moderation so speakers can interact with their audience. + +Lastly, there remains an army of volunteers who shifted their in-person plans online and continue to help in any way possible. + +### Some of the surprising positives from this difficult change + +While it is without a doubt a challenging time for the organization, Jodlowska noted a number of positives that are unfolding due to this move to virtual. + +To start, the staff of the PSF “have never been closer,” as they bond over the experience and spend more time getting to know each other through weekly video calls and baking competitions. + +Jodlowska was inspired to get involved in another open source effort, [FOSS responders][11], who are helping organizations respond to the cancelation of events due to COVID-19. (If you’ve been affected as well, they are there to help.) + +The generosity mentioned above is a silver lining to the experience and encouraging to the hardworking team that uplifts the popular Python programming language. + +There is also a broader impact on participation in PyCon. While the final numbers are not in yet, an international audience has access to all of PyCon as it unfolds, which gives the entire world a chance to be part of an excellent event [I got to attend][12] last year. On the development side, Jodlowska mentioned that the [core-dev team][13] that maintains Python, who would normally meet in person, shifted to a virtual meeting. As a result of that shift, some participants got to attend that otherwise would not have had the opportunity to join in person. + +### How you can help the Python Software Foundation + +I reached out to Jodlowska because I am impressed with and supportive of their mission to support the Python community. If you want to support them as well, you have options: + + * Become a [free or supporting member][14] of the PSF to get involved in our future. + * [Sign up for the PSF’s free newsletter][15] to stay up to date. + * [Donate][16] directly to the PSF (and thank you to those that already have). + * Ask your employer to [sponsor the PSF][17]. + * Ask your employer if they match donations to 501(c)(3) non-profits, and ask for your donations to the PSF to be matched. + + + +Last but not least, participate in PyCon over the next few weeks. You can learn from all kinds of smart people on a range of topics like [Matt Harrison][18]’s [Hands-on Python for Programmers][19] that guides attendees through analyzing COVID-19 data to [Katie McLaughlin][20]’s thoughtful talk on [What is deployment, anyway?][21] + +Be sure to [review the full][10] list and engage with the amazing lineup of speakers. + +* * * + +_Are you part of a non-profit looking to connect with your open source community at this time of social distancing? Let me know at matt @ opensource.com._ + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/5/pycon-covid-19 + +作者:[Matthew Broberg][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/mbbroberg +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/osdc_whitehurst_money.png?itok=ls-SOzM0 (A dollar sign in a network) +[2]: https://pycon.blogspot.com/2020/03/pycon-us-2020-in-pittsburgh.html +[3]: https://www.python.org/psf/records/staff/ +[4]: https://opensource.com/tags/wfh +[5]: http://pyfound.blogspot.com/2020/03/psfs-projected-2020-financial-outcome.html +[6]: https://www.youtube.com/watch?v=79AIzbjLzdk +[7]: http://pyfound.blogspot.com/2020/04/thank-you-to-donors-sponsors.html +[8]: https://twitter.com/hashtag/PyCon2020?src=hash&ref_src=twsrc%5Etfw +[9]: https://twitter.com/pycon/status/1251563142641000455?ref_src=twsrc%5Etfw +[10]: https://us.pycon.org/2020/online/ +[11]: https://fossresponders.com/ +[12]: https://opensource.com/article/19/5/jupyterlab-python-developers-magic +[13]: https://devguide.python.org/coredev/ +[14]: https://www.python.org/psf/membership/ +[15]: https://www.python.org/psf/newsletter/ +[16]: https://www.python.org/psf/donations/ +[17]: https://www.python.org/psf/sponsorship/ +[18]: https://us.pycon.org/2020/speaker/profile/454/ +[19]: https://youtu.be/fuJcSNUMrW0 +[20]: https://opensource.com/users/glasnt +[21]: https://youtu.be/8vstov3Y7uE diff --git a/sources/talk/20200505 11 DevOps lessons from My Little Pony.md b/sources/talk/20200505 11 DevOps lessons from My Little Pony.md new file mode 100644 index 0000000000..f550f871a1 --- /dev/null +++ b/sources/talk/20200505 11 DevOps lessons from My Little Pony.md @@ -0,0 +1,96 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (11 DevOps lessons from My Little Pony) +[#]: via: (https://opensource.com/article/20/5/devops-lessons) +[#]: author: (Moshe Zadka https://opensource.com/users/moshez) + +11 DevOps lessons from My Little Pony +====== +What you never thought you could learn about DevOps for Twilight Sparkle +and her friends. +![My Little Pony][1] + +In 2010, the My Little Pony franchise was rebooted with the animated show _My Little Pony: Friendship is Magic_. The combination of accessibility to children with the sophisticated themes the show tackled garnered a following that cut across ages. I was swept up in the wave and discovered there is a lot to learn about DevOps from the show. + +### Discovering technical debt + +The show begins with Twilight Sparkle reading obscure documentation, only to realize that Equestria, where the show is set, is due to suffer a calamity. Though someone named Nightmare Moon has been imprisoned for a thousand years, there is a prophecy she will return. + +#### Lesson 1: Technical debt matters. + +Nightmare Moon is a perfect stand-in for technical debt. Document it. Pay attention to the signs of risk no matter how infrequently they occur. Have a plan to resolve it. + +Twilight Sparkle goes to her manager with the news, only to be told that it is not a current priority. She is sent to Ponyville to prepare for the coming celebration, instead. + +#### Lesson 2: Communication with management is key. + +Twilight Sparkle communicated her priority (the risk of technical debt) but did not convince her management that it was more important than the celebration (of the next release or a new customer). + +We all need to make clear what the business case is for resolving critical issues. It is also not straightforward to explain technical debt in business terms. If management does not agree on the severity, find new ways to communicate the risk, and team up with others who speak that language. + +### When technical debt becomes an outage + +As the prophecy has foreseen, Nightmare Moon returns and declares eternal night. (In this DevOps story, this marks the beginning of a catastrophic outage.) Twilight quickly understands that she cannot resolve the issue by herself, and she recruits the ponies who will become, with her, the "Mane Six." They each stand for a different element of harmony—Applejack stands for Honesty, Fluttershy for Kindness, Pinkie Pie for Laughter, Rarity for Generosity, Rainbow Dash for Loyalty, and Twilight Sparkle herself for Magic. This team-building is full of lessons: + +#### Lesson 3: Few are the issues that can be resolved by one person. + +When facing an outage, reach out to other people with complementary skills who can help you. It is best if they are different than you: different backgrounds leads to differing perspectives, and that can lead to better problem-solving. + +#### Lesson 4: When resolving an outage, honest communication is key. + +Throughout the struggle against the eternal night, the Mane Six have to speak openly and honestly about what's not working. Their [blameless communication][2] is part of problem-solving. + +#### Lesson 5: When resolving an outage, kindness to yourself and to others is crucial. + +Though tempers flare hot in the land of Equestria, we all benefit from coming back to working together. + +#### Lesson 6: Laughter is important. + +Even when everything comes crashing down, remember to take a break, drink a glass of water, and take a deep breath. Stressing out does not help anything. + +#### Lesson 7: Be generous. + +Even if you are not on-call right now, if your help is needed to resolve a problem, help out as you hope your colleagues will do for you. + +#### Lesson 8: Be loyal. + +An outage is not a time to settle rivalries between teams. Focus on how to collaborate and resolve the outage as a team. + +#### Lesson 9: Though people skills are important, you have to understand the technology on a deep level. + +Keep your skills sharp. Expertise is not only the ability to learn; it is knowing when that information is needed. Part of being an expert is practice. + +### Growing into a culture of continual improvement + +After the issue is resolved, Princess Celestia realizes that the Mane Six are crucial to the long-term survival of Equestria, and tells Twilight Sparkle to stay in Ponyville and keep researching the magic of friendship. + +#### Lesson 10: After an outage is resolved, conduct a review, take concrete lessons, and act on them. + +I could go on, episode by episode, detailing lessons relevant for DevOps, but I will wrap up with one of my favorite ones. In the "Winter Wrap-Up" episode, all the ponies in Ponyville help in preparing for the spring. As per tradition, they do not use magic, leaving Twilight Sparkle to wonder how she can contribute. Eventually, she realizes that she can help by making a checklist to make sure everything is done in the right order. + +#### Lesson 11: When automation is impossible or inadvisable, write a solid checklist, and follow it. Do not depend on your memory. + +Twilight Sparkle and the Mane Six overcome great obstacles as a team, and now have a system to improve as a team. + +### A story of DevOps + +This story reflects how many organizations slowly adopt DevOps. The transition from recognizing a fear of technical debt toward addressing it is not simple. With courageous leadership, teamwork, and a willingness to improve, all organizations can come out on the other side with a similar story to Twilight Sparkle and her friends. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/5/devops-lessons + +作者:[Moshe Zadka][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/moshez +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/my-little-pony.jpg?itok=X-rwAGuE (My Little Pony) +[2]: https://opensource.com/article/19/4/psychology-behind-blameless-retrospective diff --git a/sources/talk/20200506 IBM rolls Red Hat into edge, AI, hybrid-cloud expansion.md b/sources/talk/20200506 IBM rolls Red Hat into edge, AI, hybrid-cloud expansion.md new file mode 100644 index 0000000000..ef7d152e55 --- /dev/null +++ b/sources/talk/20200506 IBM rolls Red Hat into edge, AI, hybrid-cloud expansion.md @@ -0,0 +1,78 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (IBM rolls Red Hat into edge, AI, hybrid-cloud expansion) +[#]: via: (https://www.networkworld.com/article/3542409/ibm-rolls-red-hat-into-edge-ai-hybrid-cloud-expansion.html) +[#]: author: (Michael Cooney https://www.networkworld.com/author/Michael-Cooney/) + +IBM rolls Red Hat into edge, AI, hybrid-cloud expansion +====== +Every company will be an AI company new IBM CEO Krishna tells Think! virtual gathering +Getty + +Deeply assimilating its Red Hat technology, IBM this week rolled out a set of new platforms and services designed to help customers manage edge-based application workloads and exploit artificial intelligence for infrastructure resiliency. + +The announcements came at IBM’s virtualized Think! 2020 event that also featured the first Big Blue keynote by [the company's new CEO Arvind Krishna][1], during which he told the online audience about challenges of COVID-19: "History will look back on this as the moment when the digital transformation of business and society suddenly accelerated,” but also that [hybrid cloud and AI][2] are the two dominant forces driving digital transformation. + +[Now see how AI can boost data-center availability and efficiency][3] + +“More than 20 years ago, experts predicted every company would become an internet company. I am predicting today that every company will become an AI company, not because they can, but because they must,” he said. + +With that idea in mind the company rolled out [IBM Watson AIOps][4], an application that uses AI to automate how enterprises detect, diagnose and respond to IT anomalies in real time. Watson AIOps works by grouping log anomalies and alerts based on spatial and temporal reasoning as well as similarity to past situations, IBM said. It uses IBM’s natural language processing technology to understand the content in trouble tickets to identify and extract resolution actions automatically. + +Then it provides a pointer to where the problem is and identifies other services that might be affected.  “It does this by showing details of the problem based on data from existing tools in the environment, all in the context of the application topology, distilling multiple signals into a succinct report” and eliminating the need for multiple dashboards, IBM stated. + +AI can automate tasks like shifting traffic from one router to another, freeing up space on a drive, or restarting an application. AI systems can also be trained to self-correct, IBM stated. + +“The problem is that many businesses are consumed with fixing problems after they occur, instead of preventing them before they happen. Watson AIOps relies on AI to solve and automate how enterprises self-detect, diagnose and respond to anomalies in real time,” Krishna said. + +AIOps is built on the latest release of Red Hat OpenShift, supports Slack and Box, and can be integrated with IT-monitoring packages from Mattermost and ServiceNow, IBM stated.  + +The Kubernetes-based OpenShift Container Platform lets enterprise customers deploy and manage containers on their infrastructure of choice, be it private or public clouds, including AWS, Microsoft Azure, Google Cloud Platform, Alibaba and IBM Cloud.  It also integrates with IBM prepackaged Cloud Paks, which include a secured Kubernetes container and containerized IBM middleware designed to let customers quickly spin-up enterprise-ready containers. + +OpenShift is also the underlying package for a new version of its [edge network][5] management application called IBM Edge Application Manager. Based on the open source project [Open Horizon][6], the Edge Application Manager can use AI and analytics to help deploy and manage up to 10,000 edge nodes simultaneously by a single administrator. With the platform customers can remotely add new capabilities to a single-purpose device or automatically direct a device to use a variety of cloud-based resources depending on what resources it needs.   + +Cisco said it was working with the IBM Edge Application Manager to deploy apps and analytics models that run on a broad range of Cisco products, such as servers, its industrial portfolio of gateways, routers, switches, SD-WAN, and wireless-connectivity offerings for edge computing.  + +“As an example, IBM Edge Application Manager leverages [Cisco HyperFlex Edge][7] and Cisco IC3000 Industrial Compute Gateway servers. The HyperFlex Edge and IC3K platforms are specifically designed to support a number of edge use cases, such as optimizing traffic management, increasing manufacturing productivity, and increasing the safety of oil and gas pipelines,” Cisco [stated][8]. + +In addition, Cisco said it has used the capabilities in IBM Edge Application Manager to build an “Edge in a Box proposal,” where customers can deploy remote edge applications that run entirely disconnected from public or private clouds but are also synchronized and managed remotely in controlled connectivity windows. For instance, client edge locations may need to operate in disconnected mode but have the ability to synch up for automated application updates and data exchanges, Cisco stated. + +Other edge-related announcements include: + + * IBM [Edge Ecosystem][9], a group of industry players who will target open technology developments to let customers move data and applications between private data centers, hybrid multicloud environments and the edge. The group includes Cisco, Juniper, Samsung and NVIDIA among others. IBM said a Telco Network Cloud Ecosystem will serve a similar function for their network cloud platforms. + * A preview of an upcoming service, called IBM Cloud Satellite. This will extend IBM’s public-cloud service to give customers the ability to use IBM Cloud anywhere – on-premises, in data centers or at the edge – delivered as a service that can be managed from a single pane of glass controlled through the public cloud. It lets customers run applications where it makes sense while utilizing cloud security and ops benefits, IBM stated. Satellite runs on Red Hat OpenShift. + * Telco Network Cloud Manager – a telco/service provider offering that runs  on Red Hat OpenShift to deliver intelligent automation capabilities to orchestrate virtual and container network functions in minutes. Service providers will have the ability to manage workloads on both Red Hat OpenShift and Red Hat OpenStack platforms, which will be critical as telcos increasingly look to modernize their networks for greater agility and efficiency, and to provide new services as 5G adoption expands, IBM stated. + * New capabilities for some of its Cloud Paks including extending the Cloud Pak for Data to include the ability to better automate planning, budgeting and forecasting in [hybrid-cloud][10] environments. IBM upgraded tools for business routing and data capture to the Cloud Pak for Automation as well. + + + +Join the Network World communities on [Facebook][11] and [LinkedIn][12] to comment on topics that are top of mind. + +-------------------------------------------------------------------------------- + +via: https://www.networkworld.com/article/3542409/ibm-rolls-red-hat-into-edge-ai-hybrid-cloud-expansion.html + +作者:[Michael Cooney][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.networkworld.com/author/Michael-Cooney/ +[b]: https://github.com/lujun9972 +[1]: https://www.networkworld.com/article/3536654/ibm-taps-new-leaders-for-hybrid-cloud-battles-ahead.html +[2]: https://www.infoworld.com/article/3541825/ibms-new-ceo-lays-out-his-roadmap.html +[3]: https://www.networkworld.com/article/3274654/ai-boosts-data-center-availability-efficiency.html +[4]: https://www.ibm.com/watson/assets/duo/pdf/WDDE814_IBM_Watson_AIOps_Web.pdf +[5]: https://www.networkworld.com/article/3224893/what-is-edge-computing-and-how-it-s-changing-the-network.html +[6]: https://developer.ibm.com/blogs/open-horizon-joins-linux-foundation-grow-open-edge-computing-platform/ +[7]: https://www.cisco.com/c/en/us/products/hyperconverged-infrastructure/index.html?dtid=oblgzzz001087 +[8]: https://blogs.cisco.com/partner/cisco-and-ibm-teaming-at-the-edge +[9]: https://www.ibm.com/blogs/business-partners/join-the-edge-ecosystem/ +[10]: https://www.networkworld.com/article/3268448/what-is-hybrid-cloud-really-and-whats-the-best-strategy.html +[11]: https://www.facebook.com/NetworkWorld/ +[12]: https://www.linkedin.com/company/network-world diff --git a/sources/talk/20200514 Ethernet Alliance study finds Power over Ethernet issues.md b/sources/talk/20200514 Ethernet Alliance study finds Power over Ethernet issues.md new file mode 100644 index 0000000000..983c11dac6 --- /dev/null +++ b/sources/talk/20200514 Ethernet Alliance study finds Power over Ethernet issues.md @@ -0,0 +1,67 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Ethernet Alliance study finds Power over Ethernet issues) +[#]: via: (https://www.networkworld.com/article/3543258/ethernet-alliance-study-finds-power-over-ethernet-issues.html) +[#]: author: (Michael Cooney https://www.networkworld.com/author/Michael-Cooney/) + +Ethernet Alliance study finds Power over Ethernet issues +====== +Reliability, connection issues, failure to deliver power traced to interoperability issues with Power over Ethernet. +Martyn Williams/IDGNS + +Four out five users experience challenges with power over Ethernet (PoE) deployments, according to a new survey of nearly 800 Ethernet designers, manufacturers, resellers, system integrators, network operators and others. + +Conducted by the Ethernet Alliance in January, the study  found a number of key PoE insights, including: + + * Four out of five users experienced issues, including support, reliability, or connection challenges. + * The top three PoE installations are cameras and phones, as well as computing and storage devices; + * Of customers planning to implement PoE 63% said they would need 30w; 47% would need between 30-60w and 27% need greater than 60w. + + + +**[ Now see [7 free network tools you must have][1]. ]** + +With the global market projected to grow to $2 billion by 2025, PoE remains a wellspring of lucrative opportunities for designers, systems integrators, and solutions providers, David Tremblay, chair of the alliance's PoE Subcommittee, and system architect for Aruba, said in a statement. “Despite this good news, there are significant challenges that could threaten PoE’s growing adoption.” + +According to the survey those chief PoE challenges include, vendor support, unreliable power or operation, long repair times, and first-time connection issues. + +The Alliance reported that while 78% of respondents experienced difficulties with PoE deployments, 72% expect improvement with products certified through the Ethernet Alliance’s [PoE Certification Program][2]. The study found 84% said they expect certified PoE devices would be more likely to work the first time, and 85% expect those devices to be more reliable. + +“Lacking a registered trademark, the use of the term ‘PoE’ is not formally regulated, allowing any vendor to freely describe products and solutions as PoE-enabled. Additionally, terminologies such as ‘PoE+’, as well as non-standard PoE implementations are causing confusion with device interoperability among technicians, designers, and end users,” the Alliance stated. + +[Experts say][3] the single greatest challenge for PoE  is assuring interoperability.  Multivendor interoperability is Ethernet’s hallmark and it's an important consideration for consumers who want to know the gear will just work, while industry players need a way to find new partnership opportunities with companies offering certified equipment, the Dell’Oro Group said. + +“With the diversity of application, come interoperability problems which dictate the need for testing and certification,” said Sameh Boujelbene, Senior Research Director for Ethernet Switch market research at Dell’Oro. + +Certified Ethernet Alliance products range from component level Ethernet evaluation boards, to power-sourcing equipment, enterprise switches, and adapters. + +Ultimately the Ethernet Alliance’s Power over Ethernet (PoE) Certification Program is the place customers should look to enable faster PoE installations with zero interoperability issues, Tremblay said. + +A number of key Ethernet vendors including Cisco, Hewlett Packard Enterprise, Huawei, Analog Devices, Texas Instruments, Microsemi and others are part of the certification program. + +Details about certified products are available via the [program’s public registry][4]. + +Join the Network World communities on [Facebook][5] and [LinkedIn][6] to comment on topics that are top of mind. + +-------------------------------------------------------------------------------- + +via: https://www.networkworld.com/article/3543258/ethernet-alliance-study-finds-power-over-ethernet-issues.html + +作者:[Michael Cooney][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.networkworld.com/author/Michael-Cooney/ +[b]: https://github.com/lujun9972 +[1]: https://www.networkworld.com/article/2825879/7-free-open-source-network-monitoring-tools.html +[2]: https://nam05.safelinks.protection.outlook.com/?url=https%3A%2F%2Fbit.ly%2FEA_PoECertification&data=02%7C01%7C%7Ca67fc55074c748affa8408d7f74fc98e%7C3aedb78fc8e04326888a74230d1978ff%7C0%7C0%7C637249794373724526&sdata=2QDd6oO2Yu6EiCj6m7i%2BtbVJD1wHxmNwtDr2oMe9TgQ%3D&reserved=0 +[3]: https://www.networkworld.com/article/2328615/the-power-over-ethernet.html +[4]: https://ea-poe-cert.iol.unh.edu/?utm_source=General%20Distribution&utm_medium=Press%20Release&utm_campaign=October%20PoE%20Certification%20Press%20Release +[5]: https://www.facebook.com/NetworkWorld/ +[6]: https://www.linkedin.com/company/network-world diff --git a/sources/talk/20200525 In Free Software, the Community is the Most Important Ingredient- Jerry Bezencon of Linux Lite -Interview.md b/sources/talk/20200525 In Free Software, the Community is the Most Important Ingredient- Jerry Bezencon of Linux Lite -Interview.md new file mode 100644 index 0000000000..b34f3508de --- /dev/null +++ b/sources/talk/20200525 In Free Software, the Community is the Most Important Ingredient- Jerry Bezencon of Linux Lite -Interview.md @@ -0,0 +1,95 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (In Free Software, the Community is the Most Important Ingredient: Jerry Bezencon of Linux Lite [Interview]) +[#]: via: (https://itsfoss.com/linux-lite-interview/) +[#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/) + +In Free Software, the Community is the Most Important Ingredient: Jerry Bezencon of Linux Lite [Interview] +====== + +You are probably aware of [Linux Lite][1]. It is a [lightweight Linux distribution][2] based on Ubuntu. If you have an older system with 1 GB of RAM, Linux Lite becomes an excellent choice for you. + +We have covered Linux Lite releases several times on It’s FOSS and if you are a regular reader, you would have come across it. + +![][3] + +We talked to Jerry Bezencon, the creator of Linux Lite project, to know some background details on this project. + +### Interview with Jerry Bezencon of Linux Lite + +Jerry is based in Auckland, New Zealand, and he devotes a good deal of time and effort on Linux Lite project. Jerry shares his vision of the project in this interview. + +_**Tell us about the origins of Linux Lite. When did you create it first and what made you create it in the first place?**_ + +Linux Lite was started in 2012 for 3 important reasons. One, I wanted to dispel myths that a Linux based operating system was hard to use. Two, at that time, there was a shortage of simple, intuitive desktop experiences on Linux that offered long-term support. Three, I had used Linux for over 10 years before starting Linux Lite. + +I felt I needed to give back to a community that had given so much to me. A community that taught me that by sharing code and knowledge, one could have a dramatically positive impact over peoples computing experiences. + +_**How is Linux Lite different from so many other Ubuntu-based distributions?**_ + +Our approach to problem solving and our support. The first sits within the system itself. Lite Tweaks is a good example of this. We try to think of all the things that could possibly go wrong with a computer system, then write applications that fix those problems as easily as possible, should they occur. There is a lot of foresight in the team. + +The second is our approach to support. This mainly comes in 2 forms. Our massive built-in and online Help Manual and [our large forum community][4] full of some of the nicest people I’ve ever dealt with in the free software and open source community. + +_**How do you and your team work on developing Linux Lite?**_ + +There are 24 hours in a day. With 6 – 8 hours for sleep and another 6 – 8 hours for my other job, that’s more than enough time to put towards any project, hobby or job, or all 3. + +I take a more professional approach to code writing. I’ll come up with an idea, mock-up the UI then write the base code, or the whole application myself. If I need help, I prefer to hire and pay via our generous donators, freelancers. + +That way I can set a budget, the user gets a solid, well-written application by a qualified professional who is fluent in that language, and get I exactly what I ask for on time and without the usual flame wars and egos that can exist in some teams. + +By using professional, paid programmers, I avoid all the negativity completely. Application writing has become an extremely peaceful and rewarding exercise. + +_**What are you most proud of about this project?**_ + +![Linux Lite Interview][5] + +I’m most proud of the community that has stayed loyal to us throughout the years. In a business, your staff are your most valuable asset, in free software, the community is the most important ingredient. + +_**What are your future plans with Linux Lite?**_ + +To always strive to look for ways to make a person’s computing experience simpler, faster and trouble free. Our target audience shouldn’t have to dive into the terminal to try and fix things. To continue to build a feature-complete operating system that is light on resources. + +_**What new features can we expect in Linux Lite in upcoming versions?**_ + +Due to tradition, we like to keep those as surprises. I never run out of ideas. Some nights I get no sleep because my mind is buzzing with ideas for our next application, or how to solve an ongoing, difficult bug. + +_**Are there any features that you really want to implement but haven’t been able to do so far?**_ + +You can always do more to enhance an operating system. I’m currently working on our most ambitious application to date. One that doesn’t need a GUI and that sits within the system, anticipates problems and solves them before they are seen by the user. It will have a Reports feature so that those who like to know what is going on, can see for themselves what the code is doing. It will, of course, be free software. My first foray into A.I. that I hope other Linux systems can benefit from in the future. + +_**Have you achieved the goal for which you started the project?**_ + +Goal setting is ongoing. There’s no such thing as the perfect operating system. But there is no harm in aiming for that. + +_**How can the users and readers help the project?**_ + +In the usual ways. Documentation, coding, volunteering on the Forums, buying merchandise, writing blogs, donating, making videos, starting websites like yours – the list goes on. + +* * * + +We hope you like reading about the background of open source projects. You may [read more interviews with various project leaders][6]. + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/linux-lite-interview/ + +作者:[Abhishek Prakash][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/abhishek/ +[b]: https://github.com/lujun9972 +[1]: https://www.linuxliteos.com/ +[2]: https://itsfoss.com/lightweight-linux-beginners/ +[3]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/05/Linux_Lite.jpg?ssl=1 +[4]: https://www.linuxliteos.com/forums/ +[5]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/05/linux-lite-interview.png?ssl=1 +[6]: https://itsfoss.com/interviews/ diff --git a/sources/talk/20200530 How open standards guide us in a world of change.md b/sources/talk/20200530 How open standards guide us in a world of change.md new file mode 100644 index 0000000000..3ee87d50ef --- /dev/null +++ b/sources/talk/20200530 How open standards guide us in a world of change.md @@ -0,0 +1,59 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How open standards guide us in a world of change) +[#]: via: (https://opensource.com/article/20/5/oasis-open) +[#]: author: (Guy Martin https://opensource.com/users/guyma) + +How open standards guide us in a world of change +====== +OASIS Open brings open source and standards communities together during +this time of crisis to help define a new, collaborative future to +benefit all. +![Globe up in the clouds][1] + +As I write this article in my home office in Beaverton, Oregon, a Portland suburb, I'm relying (and reflecting) on years of work that went into standards like TCP/IP, HTTP, NTP, XMPP, SAML, and many others, as well as open source implementations of these standards from organizations such as the [Apache Software Foundation][2]. The combination of these standards and technologies is literally saving lives, as many of us are able to work from home while "flattening the curve." + +Nothing has dominated the news more in 2020 than COVID-19. Yet, in the midst of challenging time, I've found opportunities for personal and industrial renewal. By fortunate (some may say unfortunate) timing, I found myself switching roles in the middle of this crisis from helping to build and run Open Source Program Offices (OSPOs) to becoming the executive director at [OASIS Open][3], a standards development organization that is helping bring standards and open source together in practical and productive ways. + +Looking through the many articles on Opensource.com related to [standards][4] (and there are [quite a few][5]), I went on an interesting journey through the different thought processes—and sometimes biases—that people involved in each community have. What stood out most was this: both standards professionals and open source advocates want the same thing—better technology that we all can rely on. + +As I was transitioning to this new role at OASIS, some colleagues and friends in the open source world that I've been a part of for many years questioned my motivations for making this move. In explaining why I took this job, I reflected on the larger role I think the intersection of standards and open source can play, especially in the current crisis we all face. + +### 4 reflections on open source and standards + +First, I've seen efforts like the [Open Connectivity Foundation][6], which I was fortunate to help start, get this right in balancing a standard with multiple reference implementations. Early in that effort, the standard was actively driven by the open source project, and the project took cues from the work of the standards teams. The result is both working code and a standard that can help shield IoT developers from having to worry about the many underlying network protocols in use in this ecosystem. + +Second, I'm extremely energized by the opportunity to work with some of the best minds in the open source community, many of whom I'm fortunate enough to call friends. One of the first steps OASIS took when developing its [Open Projects][7] program was to assemble an advisory council of open source all-stars. Chris Ferris, Jim Jagielski, Nithya Ruff, Deb Bryant, and many others regularly come together, with support from OASIS staffer Jory Burson, to hash out best practices with a path to standardization and recognition in international standards bodies like ISO, ITU, W3C, and others. + +This group, along with our staff, is rethinking everything from governance to IP to community building to funding and process, taking the best from both worlds to create something new. We're bridging the agile, collaborative excellence that is open source with the trusted, interoperable reliability that is open standards, and helping to demystify open source for heavily regulated procurement processes (government, financial, NGO, etc.). The possibility of getting open source into supply chains that have traditionally relied on standards is very exciting. + +Third, I see the huge potential for what the response to this pandemic represents. This is arguably a once-in-a-generation opportunity for standards and open source communities to help define and build the future of emergency management, e-learning, medical technologies, and many other aspects of our daily lives. Determining how these elements work together effectively will be paramount to our shared future. + +Finally, I'm excited to see the role that OASIS and other standards and open source bodies can play as we tackle some of our biggest challenges in the coming months and years together. COVID-19 is changing our world and our way of life forever; how we adapt and thrive will, in large part, be determined by how well we all collaborate, and I can think of no better time for the open source and standards communities to unite to chart a course forward for all of us. + +I'm proud to be part of the movement to build a stronger bridge between open source and open standards, and I invite you all to join us. If you have thoughts to share or a project you'd like to advance, I'd love to hear from you. You can [visit us][8] or use the comments section below. Let's write the next chapter together. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/5/oasis-open + +作者:[Guy Martin][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/guyma +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/cloud-globe.png?itok=_drXt4Tn (Globe up in the clouds) +[2]: https://apache.org +[3]: https://oasis-open.org +[4]: https://opensource.com/resources/what-are-open-standards +[5]: https://opensource.com/tags/open-standards +[6]: https://openconnectivity.org +[7]: https://oasis-open-projects.org/ +[8]: https://oasis-open-projects.org/get-involved diff --git a/sources/talk/20200531 Red Hat- Holding Its Own and Fueling Open Source Innovation.md b/sources/talk/20200531 Red Hat- Holding Its Own and Fueling Open Source Innovation.md new file mode 100644 index 0000000000..b2879802f2 --- /dev/null +++ b/sources/talk/20200531 Red Hat- Holding Its Own and Fueling Open Source Innovation.md @@ -0,0 +1,59 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Red Hat: Holding Its Own and Fueling Open Source Innovation) +[#]: via: (https://www.linux.com/articles/red-hat-holding-its-own-and-fueling-open-source-innovation/) +[#]: author: (Swapnil Bhartiya https://www.linux.com/author/swapnil/) + +Red Hat: Holding Its Own and Fueling Open Source Innovation +====== + +When IBM acquired Red Hat for $34 billion in 2019, it was considered the industry’s largest software acquisition. The synergy between the two companies led them to become one of the leading hybrid multi-cloud providers globally. + +In most acquisitions, the acquired entity sometimes loses momentum and sheds some of its original luster. This does not seem to be the case with Red Hat. + +**Distinct Identity** +“I would define it as a separate company and that’s how we run it,” affirms Paul Cormier, President & CEO of Red Hat, who is credited with conceptualizing the company’s open hybrid cloud platform. + +“We set our own strategy, we set our own road maps. It’s completely up to us. We have stayed as a self-contained company. Red Hat still has all the pieces to be a separate company: its own Engineering, product lines, back office, HR, Legal, and Finance. It’s very much like VMware is to Dell, or LinkedIn is to Microsoft,” he explains. + +Cormier believes it’s important to have separate identities for partner ecosystems to thrive. + +“We are talking about integrating Arc with OpenShift. IBM didn’t even know this was happening as we had kept it confidential,” he says. + +Microsoft’s Azure Arc is a management tool for hybrid cloud application infrastructures, while OpenShift is a family of containerization software developed by Red Hat. + +“We’re big on Intel platforms. We’re also big on IBM Z, IBM I, IBM P. Since we support Intel in Red Hat Enterprise Linux (REL), we know their road maps long before they’re implemented.  However, we have to show Intel that we would not give away their secrets to IBM. This is the most important reason that we must remain separate so that those partner ecosystems remain,” he says. + +**Linux: The Innovation Engine** +Cormier points out that what makes Red Hat very unique is its completely open-source software development model. + +“That’s our development model. Open source is not a thing — it’s an action,” he says. + +Underlining the importance of Linux, he explains that “Linux went by Unix a long time ago in terms of features, function, and performance. However, Linux was so available that eventually, it became the innovation engine. All the technologies today — on the infrastructure and the development side, on the tools side — they are all built-in and around Linux. OpenShift is still a Linux platform. Its containers are Linux. All the innovation is now around that.” + +Cormier is also confident of meeting the demand of customers adopting hybrid cloud. + +“For us, it doesn’t matter whether it’s 20% on-premise, 20% in the cloud and 80% on-premise, or 60/40 or 50/50 — it’s still a hybrid world. I can’t predict if the COVID thing is going to push people to the cloud more quickly or more slowly, but we don’t care. It doesn’t matter. For us, it’s the same value proposition,” he avers. + +**Virtualization meets Kubernetes ** +Red Hat is now working on bringing VMs into the Kubernetes architecture. + +“As opposed to some of our competitors that are trying to bring containers back to their world, we’re moving in the other direction. We are working on advanced cluster management on Kubernetes. As customers increasingly go hybrid, having OpenShift with containers running in different places will help them easily manage across clusters,” Cormier says. + +“We’re also focusing on telco 5G use cases on the OpenShift platform. We’re doing a lot of work with Verizon and the other telcos,” he adds. +-------------------------------------------------------------------------------- + +via: https://www.linux.com/articles/red-hat-holding-its-own-and-fueling-open-source-innovation/ + +作者:[Swapnil Bhartiya][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://www.linux.com/author/swapnil/ +[b]: https://github.com/lujun9972 diff --git a/sources/talk/20200603 5 common open source testing myths debunked.md b/sources/talk/20200603 5 common open source testing myths debunked.md new file mode 100644 index 0000000000..5ce22be725 --- /dev/null +++ b/sources/talk/20200603 5 common open source testing myths debunked.md @@ -0,0 +1,86 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (5 common open source testing myths debunked) +[#]: via: (https://opensource.com/article/20/6/open-source-testing-myths) +[#]: author: (Kevin Dunne https://opensource.com/users/kdunne916) + +5 common open source testing myths debunked +====== +These survey results paint a picture of the bright future of open source +testing. +![Collaboration on a mobile software design][1] + +Open source tools are constantly changing the landscape of testing, and the community around these tools is bigger and more vocal than ever. + +The first-ever _[State of Open Source Testing Survey][2]_ examines the latest trends and developments across the software development industry. This survey received over 2,000 responses from practitioners across the behavior-driven development, functional testing, and load testing domains. + +The survey reveals a great deal about software testing and how it uses open source, and based on the results, it's reasonable to expect an increased rate of adoption and deployment of open source tools. + +Importantly, the survey results also debunk some of the common myths around open source and software testing. Here's a look at the top five: + +### Myth #1: The biggest impediment to using open source testing tools are the skills required. + +There is undoubtedly a large jump in technical skill sets required to use open source testing tools, and typically a need to brush up on or learn new coding skills. However, while 40% of respondents did cite the lack of technical skills as one of their largest roadblocks, the most common roadblock cited was simply lack of time to learn new tools. + +![OS testing impediments][3] + +### Myth #2: Open source testing happens mostly in English-speaking countries. + +Of all respondents to the survey, 61% are in Asia. While many have believed that Agile and DevOps are making co-located work more essential, the significant number of respondents in countries like India, Vietnam, and the Philippines says otherwise. There's a possibility that the rise of remote work and distributed teams will continue to grow the importance of multilingual support for projects and more adoption of asynchronous communication practices. + +![OS testing offshore][4] + +### Myth 3: Open source tools are only used for cost savings. + +Sure, the largest reason for using open source testing tools stated was cost (39%). However, the overwhelming majority of respondents (61%) cited other primary reasons for leveraging open source tools, including community support, better integration, and more ability to customize to their liking. Simply put, the choice to use open source is not a purely economic one. + +![OS testing benefits][5] + +### Myth #4: Quality Assurance Engineering is no longer a career because developers write their own tests. + +An overwhelming majority (84%) of organizations surveyed still had dedicated testing and QA personnel contributing to the creation of functional automated tests against their applications. Only a small percentage (8%) left those tasks completely up to developers to handle. + +![functional testing roles][6] + +When looking at other types of testing, such as load and performance testing, there seemed to be a wider variety of titles/roles that were involved (performance engineering, operations, etc.). Still, the role of a dedicated tester, whether technically focused or otherwise, seems to be one that won't be eliminated anytime soon. + +![performance/load testing roles][7] + +### Myth #5: Behavior-driven development means you don't have to plan ahead. + +[Behavior-driven development][8] (BDD) is a hot topic in industry discussions these days, with anywhere between 15-40% of companies using it (depending on your source). While many have implemented the tools that support BDD (Cucumber, SpecFlow, and so on), few have implemented the true foundation of the approach: specification-by-example using scenarios. Teams have often managed to get by with suboptimal requirement definitions due to their frequent, in-person collaboration; requirements are defined along the way, as things develop. If only 20% of companies provide documentation in the required format, it's likely we'll see struggles now that teams are increasingly remote. + +![BDD usage][9] + +### Open source and the future + +The future of open source testing is bright, but it's changing. Few industries are as well-equipped to adapt to rapid change as open source development. + +Want to dig a little deeper? Head over to Tricentis' [infographic][10] to explore the detailed results and sign up to participate in the _2021 State of Open Source Testing Survey_. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/6/open-source-testing-myths + +作者:[Kevin Dunne][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/kdunne916 +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/mobile-device-phone-team-collaboration-demo.png?itok=q96f2Eao (Collaboration on a mobile software design) +[2]: https://www.tricentis.com/state-of-open-source-2020/ +[3]: https://opensource.com/sites/default/files/uploads/os_testing_1_0.png (OS testing impediments) +[4]: https://opensource.com/sites/default/files/uploads/os_testing_2.png (OS testing offshore) +[5]: https://opensource.com/sites/default/files/uploads/os_testing_3.png (OS testing benefits) +[6]: https://opensource.com/sites/default/files/uploads/os_testing_4.png (functional testing roles) +[7]: https://opensource.com/sites/default/files/uploads/os_testing_5.png (performance/load testing roles) +[8]: https://opensource.com/article/19/2/behavior-driven-development-tools +[9]: https://opensource.com/sites/default/files/uploads/os_testing_6.png (BDD usage) +[10]: https://www.tricentis.com/state-of-open-source-2020 diff --git a/sources/talk/20200604 Airbus tells quantum-computing developers what it needs from the the technology.md b/sources/talk/20200604 Airbus tells quantum-computing developers what it needs from the the technology.md new file mode 100644 index 0000000000..b078a5287d --- /dev/null +++ b/sources/talk/20200604 Airbus tells quantum-computing developers what it needs from the the technology.md @@ -0,0 +1,77 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Airbus tells quantum-computing developers what it needs from the the technology) +[#]: via: (https://www.networkworld.com/article/3561228/airbus-tells-quantum-computing-developers-what-it-needs-from-the-the-technology.html) +[#]: author: (Michael Cooney https://www.networkworld.com/author/Michael-Cooney/) + +Airbus tells quantum-computing developers what it needs from the the technology +====== +Aerospace multinational Airbus says it is 'quantum-ready' and helping to shape the future capabilities of quantum computing. +[Glosser.ca / Pete Linforth][1] [(CC BY-SA 3.0)][2] + +Airbus expects quantum computing to have major production, performance and efficiency benefits as the technology plays a role in its cybersecurity, aerospace and communications businesses. + +“We are users of quantum computing and intend to use it to deliver more powerful services and systems,” said [Paolo Bianco][3], global research & technology cooperation manager for Airbus to an online audience at the [Inside Quantum Technology][4] virtual event this week. + +[10 of the world's fastest supercomputers][5] + +“We are not very much interested in developing our own quantum technology but will help others develop quantum technologies so that we can integrate them into what we are doing.  Our aim is to be quantum-ready.  It’s a race, and we want to hit the ground running.” + +The multinational aerospace corporation and world’s largest airline manufacturer is well on its way to utilizing and helping influence the develop the future of quantum computing.  + +For example, Bianco pointed to three key quantum technology areas Airbus is interested in – communication/security, computing and sensing. + +"The field of quantum communications is where we started in 2012 as the company was evaluating the technology’s threat to secure communications," Bianco said. + +According to a recent Airbus [blog][6], "Today’s cryptographic algorithms—such as the widely used encryption via asymmetric keys—will not be able to sustain attacks by the quantum computers of tomorrow. Our goal is to develop a future secure communications infrastructure for our aerospace platforms based on security-enhancing quantum information technologies (algorithms, authentications, keys).”   + +Airbus wants to make quantum computing a significant part of its ongoing high-performance computing (HPC) work.  + +"We are an avid HPC user because we do a lot of simulations and design," the company says, "and we have invested a lot of time and money to understand how quantum computing can be used with HPC to improve our efficiency and performance." + +The third area Airbus is looking to develop is quantum sensors that "are effective at measuring physical quantities such as frequency, acceleration, rotation rates, electric and magnetic fields, and temperature with the highest relative and absolute accuracy," Airbus stated.  + +"We believe this could have direct applications in improving our navigation systems in which precise acceleration measurement is used to achieve position data," Airbus stated. "In addition, quantum sensors could act as payloads for a range of different applications, such as climate dynamics from satellites or underground resources surveying from an aircraft." + +In addition to those three areas, the company 18 months ago began the [Airbus Quantum Computing Challenge][7] (AQCC) to get the quantum community involved in addressing aerospace-flight physics problems. The challenge put forward five distinct  problems, such as saving fuel or designing aircraft wings, with varying degrees of complexity, ranging from a simple mathematical question to a global flight physics problem, Airbus stated.  + +The challenge involved quantum-computing research from Airbus’ team and third parties, and the results were expected earlier this year. But as with many things, the announcement of the winner has been delayed due the COVID-19 pandemic, but Bianco said results are expected soon.  + +Beyond the Challenge, Airbus has taken part in the development of the quantum computing community. For example it provided early funding to quantum-computing-as-a-service vendor QC Ware, which offers a cloud-based service that provides enterprises with access to quantum resources. Other vendors such as [D-Wave][8], Google, [IBM][9] and [Rigetti][10] offer similar cloud-based resource services. + +Airbus has also been involved in developing quantum technologies for use in [space][11], as well as facilitating [university research][12] with the Quantum Technology Application Centre. + +“We need to develop systems that are far away from the everyday experience…we are ready to go the extra mile to understand something we are going to use,” Bianco said.  Aerospace could be one of the technologies that helps everyone learn what quantum can do, particularly in extreme environments, he said. + +Join the Network World communities on [Facebook][13] and [LinkedIn][14] to comment on topics that are top of mind. + +-------------------------------------------------------------------------------- + +via: https://www.networkworld.com/article/3561228/airbus-tells-quantum-computing-developers-what-it-needs-from-the-the-technology.html + +作者:[Michael Cooney][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.networkworld.com/author/Michael-Cooney/ +[b]: https://github.com/lujun9972 +[1]: https://en.wikipedia.org/wiki/File:Bloch_Sphere.svg +[2]: https://creativecommons.org/licenses/by-sa/3.0/legalcode +[3]: https://www.linkedin.com/in/paolobianco1/?originalSubdomain=uk +[4]: https://www.insidequantumtechnology.com/news/inside-quantum-technology-new-york-online-tuesday-june-2/ +[5]: https://www.networkworld.com/article/3236875/embargo-10-of-the-worlds-fastest-supercomputers.html +[6]: https://www.airbus.com/innovation/future-technology/quantum-technologies.html +[7]: https://www.airbus.com/newsroom/news/en/2019/10/world-leading-experts-Airbus-Quantum-Computing-Challenge.html +[8]: https://www.dwavesys.com/quantum-computing +[9]: https://www.ibm.com/quantum-computing/ +[10]: https://rigetti.com/ +[11]: http://qtspace.eu:8080/sites/testqtspace.eu/files/QTspace_Stretegic_Report_Intermediate.pdf +[12]: http://www.bristol.ac.uk/temple-quarter-campus/research-teaching-and-partnerships/qtic/ +[13]: https://www.facebook.com/NetworkWorld/ +[14]: https://www.linkedin.com/company/network-world diff --git a/sources/talk/20200607 Is your team a -glue team.md b/sources/talk/20200607 Is your team a -glue team.md new file mode 100644 index 0000000000..d62fed9525 --- /dev/null +++ b/sources/talk/20200607 Is your team a -glue team.md @@ -0,0 +1,121 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Is your team a "glue team?") +[#]: via: (https://opensource.com/open-organization/20/6/glue-team) +[#]: author: (Lauri Apple https://opensource.com/users/lapple) + +Is your team a "glue team?" +====== +Glue teams help keep an organization running smoothly. Here's how to +help them do their best work and avoid burnout. +![Teamwork starts with communication amongst teams and across silos][1] + +In his book [_How to Win_][2], New York Times senior economic correspondent Neil Irwin championed the role of "glue people" in bringing about better alignment, collaboration, and organizational maturity. "There is particular value in being a 'glue person,'" [Irwin writes][3], "someone who understands how their specialty fits together with other types of technical expertise, who can ensure that teams containing people with diverse skills can work together to create something greater than the sum of its parts." + +In many organizations, "glue people" are identified by their roles—product managers, team leads, program manager, project manager, agile coach, business systems analyst. They're people like me—an agile program manager who's been developing cross-team and cross-organizational initiatives for the past seven years at large- and medium-sized companies. + +In one company, I served as program manager for a company-wide open source initiative—aligning 1,800 developers behind a common strategy and setting development practices. In another, I worked with three teams building out a self-service deployment platform based on Kubernetes and AWS. In these days of Coronavirus, I'm helping 14 delivery teams to launch an MVP offering that augments our core business. + +The subject matter has been different in each role, but the same key activities that I bring to work every day remain consistent: + + * Drive alignment + * Coordinate people, efforts, and teams + * Call out ambiguous language to drive clarity and replace assumptions with facts + * Be the neutral party or "fresh eyes" who distills detailed conversations and plans down into simple questions: "Are you doing this, or that?"; "Are you building two things or one thing?" So often, these basics go overlooked! + * Coach leaders on delegation, prioritization and strategic thinking + * Facilitate informed decision-making + * Forecast dependencies and other risks and help mitigate them + * Visualize complex packages of work in simple, clear diagrams and language to improve transparency and accountability + + + +The glue people in your organization might also be program managers, or agile coaches, scrum masters, or engineering managers. Some organizations rely on their savviest product managers and engineering managers to provide the glue; in other organizations, the CEO doubles as Chief Glue Officer. In any case, we glue people spend much of our workdays connecting the dots between people, topics, and themes, to paint the whole picture instead of little corners. + +Maybe you are a glue person. Have you ever considered the specific ways you may fulfill this role? + +### Understanding the need for coherent storytelling + +Do you ever think of yourself as a storyteller, embracing or asserting a narrative as a means of keeping your organization aligned? If so, you're fulfilling a valuable glue-person responsibility. + +Coherent storytelling essentially amounts to connecting the dots. In your average tech organization, there is lots of activity moving forward; maybe this is even documented. But does it all add up to a story anyone can follow? For example: + + * Have you ever seen a roadmap that was formatted as a to-do list, and wondered how the different items corresponded to each other? + * Have you ever seen goals stated on a vision document and wondered, "we've never fulfilled that function before, and we don't have a team set up to do it anytime soon. So what are the steps between now and that team forming? How do we get there?" + * Have you or your team ever been asked to drop what you're doing right now, even though last week it was "super-urgent," and start doing this other thing right now because it's suddenly also "super-urgent?" + * Does your product roadmap look more like spinning a bunch of plates to keep different customers happy than building increments of value to serve current and future customers? + * Does your organization try to do too much, making an extreme sport out of context-switching? + + + +I've seen all of the above. They're all pretty failsafe ways to get talented people to burn out, lose motivation, and leave your organization. These frustrated folks see their companies constantly [disrupting themselves][4] and determine that they will never get anything done. They don't know where they're headed, and no one is telling them that story in any clear, purpose-focused way. What's unfortunate is that such problems are usually not difficult to solve—the content and context are there, but no one is assembling it into the narrative or editing out the filler. + +Even the most clear-headed companies struggle to permanently bake common sense fundamentals like prioritization and evidence-based decision-making into their cultures and habits. They're aware of the importance of values like focus, clarity, and prioritization. Maybe the companies even worked hard to attain them through pragmatic-sounding values statements, objective and key results (OKR) strategies, offsites, workshops, and other common tools of the transformation trade. Nevertheless, hierarchies form, and a few teams start getting left out of decisions that affect them. Politics seep in. Inertia creeps. Docs—what are docs? Decision logs—what are decision logs? Meetings get longer and more boring. Time starts to run out, and you end up at the point where you "just have to ship something." The plot gets lost. + +> "We used to be excellent at getting work done. The more people we add, the less we're getting done." + +Some organizations lose the plot of their own story by over-reliance on oral storytelling. They hold a lot of meetings where much is said, but no one takes notes. There's no basic roadmap or vision posted; in fact, there is resistance to the idea of those things. "It takes too much time," is the usual argument. "No one will read them anyway," is another common one. Often, in these organizations, the processes they've developed rely too much on personal connections, and not enough on well-designed communication flow. Their processes are lightweight because they're nonexistent. + +From time to time, I've asked colleagues, "would you rather write this down once, or have three or four meetings where you have to clarify the same point with the same people?" Usually, they decide to write it down. But the habit of oral storytelling and hallway negotiation can take time to break. + +As a former reporter, it's not much of a stretch for me to view my role as that of a storyteller. Much of what I do on a daily basis is similar to when I was reporting: + + * Asking people questions + * Clarifying the responses + * Challenging the responses ("but what about this?") to sharpen their meaning + * Organizing the information into stories, starting with the most important details ("the lede") first + * Constantly asking, "who is going to care about this detail?" and segmenting the content by audience + * Categorizing related types of information to form sub-themes and identify sub-narratives + + + +When I give road-mapping workshops, I cover the 5 Ws—it feels like giving a Journalism 101 class to engineering managers and product teams: + + * WHO is the customer? The team/set of teams about to do the work? + * WHAT are we doing? + * WHY are we doing it? Why are we not doing this other thing instead? + * WHEN do we start? When do we hope to finish something? + * WHERE does this effort reside in the landscape of our other efforts? + * HOW do you want to do it? + + + +In leading these road-mapping sessions, I'm looking for a few key outcomes of success: + + * A story that reflects a very strict work-in-progress limit—i.e., a primary plot, and two to three related sub-plots maximum, but no more + * Stated objectives for whatever the organization is working on that are customer-agnostic and framed in a broader context (i.e., doing X will strengthen or complement Y, in these ways) + * Metrics and data points that clearly show the impact of delivering something + + + +One other similarity between being a "glue person" in a tech organization, and being a journalist, is that it's vital to ask tough questions, to get to the bottom of stories. This is to ensure that the "readers" of those stories—the teams, the departments, the C-level, and anyone else seeking the information—have all the clarity they need to follow the plot. Here some example questions from my real-life experience: + + * To a group of 15 engineering managers who have spent an hour-long meeting prioritizing a bunch of greenfield development initiatives—"How did protecting customer data from known potential leaks end up near the bottom of your list?" + * To a head of engineering, who wanted to create dashboards so he could survey team progress—"Who needs these bug-counting dashboards; the delivery teams, or you? How does this scale? Is 'number of bugs' a reliable metric?" + * To two teams who want to build their own Kubernetes cluster when one is sufficient—"Hey, what's the value of doing that?" + + + +A lot of what I'm suggesting depends on changing habits, which takes time. Unfortunately, you're in the middle of a global pandemic and don't have time to waste on getting the right teams and people assembled and a plan in motion. You probably don't have the bandwidth to do it all yourself. + +So, don't be the sole glue person in your organization. Be one of many glue people, and help other people adapt to playing this role. It's especially crucial during a crisis. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/open-organization/20/6/glue-team + +作者:[Lauri Apple][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/lapple +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/fistbump-team-teamwork.png?itok=WuSu8-wE (Teamwork starts with communication amongst teams and across silos) +[2]: https://www.neilirwin.com/how-to-win +[3]: https://www.theatlantic.com/ideas/archive/2019/06/its-a-winner-take-all-world-heres-how-to-get-ahead/591700/ +[4]: https://barryoreilly.com/when-your-startup-cant-stop-disrupting-itself/ diff --git a/sources/talk/20200610 8 steps to make your next meeting more productive.md b/sources/talk/20200610 8 steps to make your next meeting more productive.md new file mode 100644 index 0000000000..8b612dec2c --- /dev/null +++ b/sources/talk/20200610 8 steps to make your next meeting more productive.md @@ -0,0 +1,87 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (8 steps to make your next meeting more productive) +[#]: via: (https://opensource.com/article/20/6/meeting-productivity) +[#]: author: (Emily Brand https://opensource.com/users/emily-brand) + +8 steps to make your next meeting more productive +====== +Make your meeting a productivity powerhouse—not a time waster—with these +tips. +![interviewing for a job in a conference room][1] + +Many organizations' cultures encourage team meetings, as they can be a valuable time for groups of employees to collaborate and innovate together. However, too often, meetings are unproductive, repetitive, and waste valuable time that employees could use for work. According to a Korn Ferry survey, 67% of employees claim that their job performance is [negatively impacted][2] by spending too much time in meetings. That number is far too high for modern companies interested in growth and productivity. + +Because all types of organizations, including open source communities, depend on effective meetings and communication standards to get things done, many try to instill more effective meeting environments. For example, some carve out time each week when meetings are not allowed, so the company can reach a flow state. While this is helpful during that time, the rest of the week may be wasted by unproductive meetings. + +The following steps can help make meetings more efficient and create a focused, productive workforce. + +### Before the meeting + +#### 1\. Be prepared + +Too many meetings begin with the question, "why are we here?" One way to make a meeting more productive is to ensure every participant understands the meeting's purpose before the meeting. The agenda should include the start and end time, the topics that will be covered, and a short description written by the organizer answering that "why" question. The easiest way to communicate these things is to share the meeting's agenda in the invitation, and certainly enough time before the meeting that participants can familiarize themselves with the documents before starting. This enables everyone to think about the meeting's goal, plan ahead, and arrive prepared to work toward that goal. + +#### 2\. Is this necessary? + +To prevent unnecessary meetings, everyone must understand the intended outcomes in advance. If the organizer is unable to articulate intentional goals and outcomes, then the meeting should be canceled or postponed until that happens. Also, think about whether the meeting's outcomes and decisions could be completed in an asynchronous fashion (with chat or email). + +Thinking critically about the purpose of the meeting and the people who can contribute to that goal helps organizers and participants stay on task during the meeting. As Krystal D'Costa writes in _Scientific American_, "Since spectators aren't grounded in the project or invested in the outcome, they often derail the meeting." If you're an attendee and don't understand the meeting's purpose, don't be afraid to ask the organizer if you need to be there. + +#### 3\. Keep people engaged remotely + +For long-form remote meetings (beyond basic update calls), use videoconferencing to ensure attendance, accountability, and engagement. A full 93% of communication is nonverbal, and video meetings take advantage of that fact for productivity. Also, it is easy to disengage during a phone meeting by staying on mute or participating as little as possible while working on other things. This behavior perpetuates the cycle of unproductive meetings. + +Videoconferencing increases meeting productivity, so using this collaboration method for remote meetings will have a major impact on the success of decisions going forward. Running productive remote meetings is especially important for open source communities with volunteers spread across geography trying to give back to the project. There are several [open source videoconferencing][3] tools.  + +### During the meeting + +#### 1\. Encourage mindfulness + +Most people are running to and from meetings (literally and figuratively), which causes a lack of focus. A proven practice to encourage meeting participants to re-engage and be mindful is to begin every meeting with [at least 90 seconds][4] of technology-free silence. This will allow everybody to switch gears so they can focus on the current meeting. This is a good time to display the meeting agenda and brief on a screen in the meeting room to remind everyone of its goals and purpose. + +#### 2\. Begin with agreement + +Before beginning, verify that everyone understands the meeting's objectives and the reason they are there. You can do this with a verbal yes in a small group or a non-verbal hand raise in a larger group. If there is any disagreement or confusion regarding the purpose of the meeting, one tangent or participant may sidetrack the entire meeting. This can lead to separate conversations later, which further draws everyone away from the larger picture and the original meeting goals. + +#### 3\. Be conscious of time constraints + +Every meeting should have a stated start and end time. Once a meeting reaches (or worse, exceeds) the allotted time, participants will begin to lose focus and start thinking about the next thing on their to-do list. By ending meetings five minutes early, attendees will have time to reflect on their decisions with a sense of calmness, which is key to ending a meeting with purpose. + +#### 4\. Identify action items + +During the meeting, be sure to establish any follow-up that will be needed, including identifying someone to lead each task (or to assign it if no one volunteers). In addition, assign someone in the room to provide status reports on that task going forward to ensure accountability. Reiterate all action items before the end of the meeting to get consensus on each task and so that people claim purposeful responsibility for their assignments. + +### After the meeting + +#### 1\. Verify action items and next steps + +At the end of the meeting, someone should send out the action items and who owns them to all attendees so that everyone knows what their tasks are. Between meetings and official reports, tracking tools like Trello and its [open source alternatives][5] can help everyone track the ongoing status of action items. + +### Some changes are better than none + +Depending on your line of work, who you are meeting with, or the number of people in a meeting, it can be very difficult to implement all these changes. Even so, even implementing a few can dramatically increase productivity. + +It is tempting to banish meetings altogether when the load is overwhelming and the productivity is low, but that is not plausible. Instead, enforcing productivity through these steps is well within your control as a meeting host or attendee. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/6/meeting-productivity + +作者:[Emily Brand][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/emily-brand +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/team-meeting-notebook-conference-brainstorm.png?itok=Rb_rv8-d (interviewing for a job in a conference room) +[2]: https://www.cnbc.com/2019/11/17/67percent-of-workers-say-spending-too-much-time-in-meetings-distracts-them.html +[3]: https://opensource.com/article/20/5/open-source-video-conferencing +[4]: https://www.inc.com/chris-matyszczyk/this-is-astonishing-amount-of-time-it-takes-to-calm-down-when-youre-angry-according-to-a-police-organization.html +[5]: https://opensource.com/alternatives/trello diff --git a/sources/talk/20200612 3 lessons from remote meetings we-re taking back to the office.md b/sources/talk/20200612 3 lessons from remote meetings we-re taking back to the office.md new file mode 100644 index 0000000000..a073bda1d1 --- /dev/null +++ b/sources/talk/20200612 3 lessons from remote meetings we-re taking back to the office.md @@ -0,0 +1,92 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (3 lessons from remote meetings we’re taking back to the office) +[#]: via: (https://opensource.com/article/20/6/remote-meetings) +[#]: author: (Abigail Cabunoc Mayes https://opensource.com/users/abbycabs) + +3 lessons from remote meetings we’re taking back to the office +====== +Some of the ways we're accommodating working at home during the pandemic +can make in-real-life meetings better and more inclusive when we get +back to the office. +![Two people chatting via a video conference app][1] + +For those of us fortunate enough to work remotely during this pandemic, we'll likely be camped out in our home offices for a while yet. The transition back to in-person work will [take time and be geographically patchy][2]. + +As I've talked with colleagues who are working remotely, many people say this period is temporary and makeshift: "_Once it's safe to return to the office, we can resume all our old habits and processes_." But in truth, this period of working from home and our eventual return to the office are deeply entwined. The choices and changes we make now will impact the ways we work once we step back into our offices, laboratories, classrooms, and other workspaces. + +Rather than viewing this moment as temporary and makeshift, we should see it as formative. By investing in and improving our online meeting experience _now_, we can build the foundation for a better work environment that persists long after the pandemic. We can use this moment to recalibrate our culture and systems, so they are more robust, resilient, and inclusive. Those of us in scientific fields can use this moment to deliberately shift toward [kinder science][3]. + +Meetings are just one example: Rather than trying to recreate in-person meetings online, let's reimagine what remote meetings can be. With online meetings, you have to be intentional about setting up channels through which participants can contribute and take time to make sure that they know how and feel comfortable doing so. We can take this practice back to the office, providing an opportunity to be more inclusive in-person and break power balances (including leadership hierarchy and majority groups) that can keep folks silent. + +Using this difficult moment to build a better work environment may sound overwhelming. But, there's good news: There's no shortage of resources and experiences to draw from. Working remotely feels new to a lot of us, but folks in the open source software world have been working this way and building community online for a long time: Tim O'Reilly has described this as the [architecture of participation][4]. Mozilla has been empowering cohorts of [Open Leaders][5] around the globe for years. And [rOpenSci][6], [RStudio][7], and the [Carpentries][8] have created and support remote, collaborative communities of scientists and coders. We can learn a lot from these communities that have been building relationships and innovating together from afar. + +Ready to get started? Below, we share three principles for empowering remote interactions that we can also carry forward in real life (IRL). + +### Set an inclusive tone + +Remote meetings can easily feel disconnected or unnatural—especially if you're new to meeting online. Start all meetings with a welcome to earn buy-in and participation. For example, schedule time at the very beginning to welcome everyone, announce the meeting goals, and explain how to participate, like how to unmute microphones, use the chat, or write in a shared document. Starting with a quick roll call and icebreaker question during the meeting makes folks less anonymous and encourages participation. Additionally, outline the shared expectations and culture of the meeting by summarizing the code of conduct or community participation guidelines. + +Create a detailed agenda with specific minutes allotted to different topics, including the welcome. The agenda should be shared ahead of time and contain enough structure to allow for productive conversations, but also enough flexibility to allow for fruitful digressions. Agendas can be designed with [POP][9] to clearly state the _purpose_, _outcomes_, and _process_ of the meeting. + +Providing multiple communication channels during the meeting for folks to "speak up" is important not just for introverts but also for underrepresented minorities, students, and early career people, as well as international or multi-lingual participants. If you're using a shared document, writing feedback instead of verbalizing it can save time and also be used for side and asynchronous conversations. Using multiple channels also provides ways to be in touch and catch up if folks join the call late or drop off due to connectivity issues. + +### Provide robust documentation + +People can walk away (or log off) from meetings with different perceptions and expectations. Robust documentation can dispel this ambiguity and keep everyone on the same page. + +Write meeting notes in a document—preferably in the agenda document mentioned above. Use collaborative document software such as Google Docs or an open source alternative like [Etherpad][10] so that folks can take live notes together. Invite and teach participants how to contribute and have them get into the rhythm early on, for example, with a written roll call that also buffers time as folks arrive at the start. + +Encouraging everyone to participate in the document will result in a record of the meeting that is less brittle than anything produced by a single designated note-taker and will include more voices. Folks can contribute in many ways (including adding links, comments, +1's to affirm others' ideas, and emojis to provide quick emotion and color). Further, people can contribute to shared documents live during a meeting or asynchronously before and afterward. These notes can also be shared in many ways after the meeting (email digest, Slack, Twitter, [Mattermost][11], etc.) with different audiences and become more accessible in "post-production" (e.g., captioning, alt-tags on any images shared, etc.). + +### Choose the right tools + +Choosing the appropriate communication channels for meetings and follow-up is important. It also requires time and empathy to make sure everyone knows how to use the technology. + +For virtual meetings, videoconferencing software like [Jitsi][12] allow participants to engage with "faces on." This is a nice norm to set if participants are comfortable, but it is also important to state that it is fine to participate without enabling video for any reason, including bandwidth or privacy issues. + +Providing the opportunity for participants to have smaller conversations through [Big Blue Button][13]'s breakout rooms can be very fruitful for moving ideas forward and strengthening relationships and trust. Having prompts or tasks to center the conversations helps make the best use of time, and scheduling time for summaries once the whole group has reconvened allows more ideas and insights to be shared. + +Using collaborative software for creating presentations can strengthen engagement while reducing bandwidth issues. Asking participants to open the presentation on their computers and advance the slides themselves eliminates the need for screen-sharing—and the bandwidth issues, multiple windows kerfuffling, and passiveness that can arise as a result. + +Being deliberate about the communication platforms outside of meetings is also important. For example, [GitHub Issues][14] might be better for archiving decision-making conversations. And a messaging platform like [Mattermost][15] might be better for quick contact, co-working, and community-building. Whichever platforms you use, take some time to make sure that they meet your team's needs and provide enough control to make them as safe as possible for your participants. + +### Make meetings work online, offline, or both + +When we're in person again, these principles and tips don't become obsolete. They're relevant and critical to a productive, inclusive workplace, whether we're online, offline, or a hybrid of the two. We have led our [Mozilla Open Leaders][16] and [Openscapes Champions][17] programs this way, and we've learned that these approaches can transcend discipline and organization size. + +And while each principle takes time and practice, they're all attainable. We have a big chance here to redesign the way we interact and collaborate, so let's start with intention and kindness. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/6/remote-meetings + +作者:[Abigail Cabunoc Mayes][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/abbycabs +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/chat_video_conference_talk_team.png?itok=t2_7fEH0 (Two people chatting via a video conference app) +[2]: https://www.theatlantic.com/health/archive/2020/03/how-will-coronavirus-end/608719/ +[3]: https://blogs.scientificamerican.com/observations/open-software-means-kinder-science/ +[4]: http://radar.oreilly.com/2015/03/socialcivics-and-the-architecture-of-participation.html +[5]: https://foundation.mozilla.org/en/opportunity/mozilla-open-leaders/ +[6]: https://ropensci.org/ +[7]: https://community.rstudio.com/ +[8]: http://carpentries.org/ +[9]: https://suzannehawkes.com/2010/04/09/pop-everything/ +[10]: https://opensource.com/business/15/7/five-open-source-alternatives-google-docs +[11]: https://opensource.com/alternatives/slack +[12]: https://opensource.com/alternatives/skype +[13]: https://opensource.com/article/20/5/open-source-video-conferencing#bigbluebutton +[14]: https://openscapes.github.io/series/github-issues.html +[15]: https://mattermost.com/ +[16]: https://foundation.mozilla.org/en/blog/online-meeting-tips/ +[17]: https://www.openscapes.org/blog/2020/03/11/how-to-run-a-remote-workshop/ diff --git a/sources/talk/20200613 Introducing the Open Management Practices.md b/sources/talk/20200613 Introducing the Open Management Practices.md new file mode 100644 index 0000000000..df53d52ab4 --- /dev/null +++ b/sources/talk/20200613 Introducing the Open Management Practices.md @@ -0,0 +1,97 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Introducing the Open Management Practices) +[#]: via: (https://opensource.com/open-organization/20/6/open-management-practices) +[#]: author: (Heidi Hess von Ludewig https://opensource.com/users/heidi-hess-von-ludewig) + +Introducing the Open Management Practices +====== +What does great management look like in an open organization? DeLisa +Alexander of Red Hat explains a new, open resource that paints one +vision. +![Media ladder][1] + +For the second article in this series on [Managing with Open Values][2], I spoke with DeLisa Alexander, Executive Vice President and Chief People Officer at Red Hat, specifically about how managing with open values works in that organization. DeLisa's team recently created and open sourced a new resource—[the Open Management Practices][3]—to help Red Hat managers understand their roles in an open organization and to empower Red Hat associates to help those managers practice openness. + +I spoke with DeLisa, a 19-year veteran of Red Hat, about what led to the creation of the practices, how she and her team developed them, and how the organization plans to integrate them into its manager competencies. DeLisa came to Red Hat with a legal background and began her career at the company as inside counsel. The legal field is very hierarchical and not too open in its values (due in part to the confidentiality required of counsel). In our interview, DeLisa explains how, over the course of her career, she's been able to grow and guide the development of Red Hat's "bottom-up" organization. + +I've transcribed parts of our interview below and edited them for readability. + +* * * + +**Heidi:** This interview series is about "managing with open values," and one of the first questions we've been asking interviewees is: What does that mean to you, to "manage according to open values"? As the executive overseeing the People team at Red Hat, why is this issue important to you? + +**DeLisa:** Red Hat started as a movement, in part because of the internet and the connected, democratic nature the technology brought with it. Red Hat hired top contributors of open source communities, which meant that these associates, now hired into decision making roles, were "infused with open"—they lead like community members, not conventional executives. The expectation was that the culture supported collaboration, participation, and community—the values of the open source community. They brought the culture with them, in other words. Upholding and catalyzing this culture via the body of community members into a profitable company is very important, and very different from proprietary software companies. + +**Heidi:** That's so interesting, because as a relatively new Red Hatter I didn't really see that connection as clearly as you explain it. Now I can better understand the passion that a movement started while intersecting with a corporate culture. + +**DeLisa:** Yes. Having come from the law I felt the same way, and it took me a while to realize how it worked and what the expectations were. + +As I navigated my way in the open source community culture, we started to see that those who were not coming from Red Hat communities didn't know how to navigate this new culture. So, we created the [Open Decision Framework][4] (ODF) to help them grow and align to Red Hat values. + +Associates and leaders with decision making responsibilities needed to understand and practice open source practices because our culture is so important. In addition, when you use the ODF, you get better and more creative decisions—that might take longer to get, but then you don't have the change management, like at other companies, after the fact. The transparency offered by the framework aligned with the cultural expectations of the community. When people don't get what they expect, that's when things blow up. So the ODF helps associates and leaders navigate working and decision making in the Red Hat community in ways they expect. + +**Heidi:** So Red Hat is essentially an open source community culture _at scale_. + +**DeLisa:** Yes. Over time, we have had to develop and grow in ways that are consistent with our values. We've created tools and had projects that used open tools to do that. For example, [when we created our "Why,"][5] our shared purpose, the proposed plan was going to take a year before it opened to the associates. The focus of the proposal was on the leaders coming up with it in a closed room—which wouldn't work at Red Hat. But we decide to involve the associates and do the change management synchronously with the activity. The power of participation will create something amazing (when it's important to do) for Red Hat, but you have to take it on faith, and you don't know when it's going to be done. The iterative process means that project plans are less defined and you have to trust: when it's baked, it's baked. You have to lean into the instinct that you will know when it's baked. + +**Heidi:** From my own experience, I can see and feel that, from the associate perspective, there are large gains by being able to participate. But what are the benefits to the managers themselves when they manage with open values? + +**DeLisa:** One of the most important values of open source community members is that they want to contribute right away; there is a meritocracy where title doesn't matter. That's important and that's also what Millennials expect for themselves. Millennials are working this way now. That means that managers at Red Hat had to learn how to manage Millennial-like people 20 years before Millennials came into the workforce! There is a significant advantage in that, because it helps to create a highly engaged workforce where people have a part in making a great team and a great organization. Managers also develop associate capabilities: their skill, their understanding of context, and purpose. Managers are helping "develop these muscles' [in their associates] while creating a learning zone at the same time. + +Listen to DeLisa describe the importance and benefits of managing with open values + +**Heidi:** In this way, managers are creating their own succession plans, because there isn't an us/them context that some conventional organizations have about leadership. In my experience working at conventional organizations, there is a distinct disjointedness between leaders and associates—either you are In the club, or you are not. Where there are open values, leaders and associates are one and the same, or at least the boundary is less distinct. + +**DeLisa:** When I took this job, everyone was a leader. You might be a manager, a _role_ that manages people, but everyone was expected to be a leader. We have tried to carefully define "leader" so that we don't lose the concept and impact the meritocracy. + +**Heidi:** We've talked a little bit about the growth of Red Hat, and I wonder how you and your team have scaled the role of manager, and managing with open values, across the large and growing organization. What does it look like and what strategies are you working on? + +**DeLisa:** As you know, things always look and work a little differently at Red Hat. [Our competency model][6], for instance, helps people know what good looks like in their roles, and then we created the Open Decision Framework to help leaders make decisions in an open way. But we found that managers didn't understand what was expected of them in an open organization. Some brought with them ways of working from their former companies. And yet, as a people manager, they are a key leverage point for Red Hat, essentially responsible for supporting talent. The experience of the associate is greatly influenced by their manager and when you don't have managers who don't manage with open values, then the associates are not getting the full experience of working at an open organization. + +We started at the beginning, asking ourselves ["If everyone is a leader, do we even need people managers?"][7] And we decided we needed the manager role. There are too many operationalization points regarding hiring, development, performance, etc. Our next step was the practices (do's and don'ts) and mindsets for managers. The Do's and Don'ts were communicated to Red Hat as a whole to get feedback, including all the geos, using a global face-to-face tour. These became the six Open Management Practices. + +**Heidi:** Of the six Open Management Practices, which do you feel is most important? + +**DeLIsa:** Probably the one that is most important to us today is "Creating an environment of respect, belonging, and mutual support." It is foundational for meritocracy and the idea that people can contribute even if their style of thinking, language, or remote work are differences. People need to feel like they belong because every associate has to feel comfortable contributing at our very, very best. This is on my mind all the time because there is a lot of research about it, one book for instance is _The Fearless Organization_ by [Amy C. Edmonson][8]. Meritocracy is not just "being nice." It is linked to the learning organization—fail fast and often— and this is how the world's problems are getting solved these days. + +**Heidi:** So we've talked about how the Open Management Practices benefit both associates and managers, and I'm curious about the topic of accountability. How is Red Hat helping to make managers and associates accountable for using these practices? + +**DeLisa:** That's a great question and a hotly debated topic within my team. Part of the genesis for the Open Management Practices was to create accountability between associates and managers. We asked ourselves "how can we help people to want to be accountable?" We can't legislate this. These practices can't be done "because the People team told me to." We need to inspire ownership, so we made the idea of ownership part of the workshop conversation. The tool helps build a competence—"what good looks like"—by defining the practice. So, the People team asked managers, "Once you are enabled, would you be committed to these practices?" and 97% said "yes"! Therefore, we focused on enabling them knowing that the ownership and accountability would follow. + +Listen to DeLisa describe how managers and associates co-created the Open Management Practices + +In addition, the No. 1 request in the workshop was for a 360-degree feedback mechanism. We are excited to partner with TILT365 [Red Hat's vendor for personality style testing] to create a multi-factor survey that helped identify a questionnaire for management feedback. This makes the whole model and process very transparent. Associates know what the do's and don'ts for management practices are, and managers have feedback; leaders can support development plans for their managers. All this creates a full, virtuous cycle because the Open Management Practices created a path for managers to commit to their own development. + +Listen to DeLisa describe how managing openly can increase commitment and accountability + +**Heidi:** That's really interesting! I can see how the definition of the practices helped people understand what they were committing to, and the workshops and using the Open Decision Framework to get feedback from Red Hatters at all levels, helped to create the commitment needed in a natural way, as an obvious extension of the activity. + +DeLisa, thank you for your time! I appreciate your taking the time to speak with me today. + +**DeLisa:** I appreciate it, your time, and your interest in this! Thank you for having me. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/open-organization/20/6/open-management-practices + +作者:[Heidi Hess von Ludewig][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/heidi-hess-von-ludewig +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/BUSINESS_meritladder.png?itok=eWIDxnh2 (Media ladder) +[2]: https://opensource.com/open-organization/20/5/commitment-engagement-org-psychology +[3]: https://github.com/red-hat-people-team/open-management-practices +[4]: https://opensource.com/open-organization/resources/open-decision-framework +[5]: https://opensource.com/open-organization/17/9/rediscovering-your-why +[6]: https://github.com/red-hat-people-team/red-hat-multiplier +[7]: https://opensource.com/open-organization/18/10/understanding-engagement-empowerment +[8]: https://www.hbs.edu/faculty/Pages/profile.aspx?facId=6451 diff --git a/sources/talk/20200614 Who is the glue person on your team.md b/sources/talk/20200614 Who is the glue person on your team.md new file mode 100644 index 0000000000..9c855b01e6 --- /dev/null +++ b/sources/talk/20200614 Who is the glue person on your team.md @@ -0,0 +1,113 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Who is the glue person on your team?) +[#]: via: (https://opensource.com/open-organization/20/6/glue-person) +[#]: author: (Lauri Apple https://opensource.com/users/lapple) + +Who is the glue person on your team? +====== +How to identify and utilize the role of a clear-headed, storyteller on +your team. +![Business woman on laptop sitting in front of window][1] + +Here's a test: how long do you think it would take for your organization to kickstart a brand new effort? A few days? A week? + +How ready would your teams be—do they already know how to roadmap, align, prioritize, and coordinate with each other? + +Are your teams successfully ending any wasteful activities? These might include running unused AWS stacks, building the same thing twice, or consistently preferring tactical, localized optimizations over strategically collaborating with other teams. + +If your organization has such activities in motion, you're probably on the right track. If not, that's a warning signal that your team is lacking some core capabilities you'll need for successfully launching any new endeavor, pandemic or not. + +Does your organization allow your [glue people][2] to develop those core capabilities, or are you pressuring them to stay in their boxes? + +### Zombie scrum, velocity counters, clipboard dogmatists, and other occupational hazards + +Not long ago, on a lark, I interviewed for some freelance project management work with a US-based company. The experience was bizarre. The recruiter, who expressed all the enthusiasm of a bowl of cold pea soup, asked me to do tasks that require much more time and context than what was allotted, even to achieve the goals at a mediocre level. I was penalized for stating that I have never seen scrum by the book—aka [zombie scrum][3]—succeed in any organization. And I was somewhat scolded for asking analytical questions that, in my experience, are critical to driving focus and clarity. + +I didn't get passed to the next stage of the process, in part because the recruiter said my zombie scrum comment was a red flag. I took that as a compliment. But I also felt sorry for any project manager—or scrum master, agile coach, or any other creative person—who's made to apply cookie-cutter solutions to situations that require listening, empathy, and creativity. "Follow the book" is a simplistic, anti-intellectual way to crush innovation and generates stereotypes about professionals whose valuable work aims to glue teams, departments, and narratives together. + +Countless books, articles, and tweets from frustrated agile practitioners have been written about the tendency of many companies to pick an agile framework and force it to stick. A well-meaning company picks scrum, then instantly gets dogmatic about it and hires a bunch of scrum masters to hold the required ceremonies. In this environment, it's easy for the scrum masters to tie their competence to existing certifications instead of growing and expanding their skills into areas like psychology or conflict resolution. The company then puts a bunch of additional requirements on top of their framework of choice—checklists, team working agreements that look a certain way, mandatory JIRA fields separating "internal work" from "external work" (whatever that means). + +Maybe this stuff works somewhere? I have never seen it. + +There's never a good time to pressure your people to dumb down process and now is especially not a good time. Your organization needs even more of what makes a highly effective glue-person: + + * Pragmatism + * Objectivity and a habit of identifying assumptions + * Communication skills, which most tech companies struggle with even in calm times + * Good listening skills + * Pattern detection + * Research skills + * Neutrality and diplomacy + * Strategic mindset over tactical, quick-fix, trees-for-the-forest thinking + + + +If you're not supporting your team in valuing and encouraging these attributes in your people—regardless of whether their job title includes "agile" or not—please start now. + +Of course, some people who take on "agile practitioner" roles actually prefer to be dogmatists, by-the-book folks, and bug counters. In that case, you have two options: either see if they're willing to explore different approaches to their work, or, if they're not, explore other people. + +### Know your PMO + +If you hear teams grumble that your project management office (PMO) is a bunch of non-technical clipboard people who block progress, challenge those biases. Maybe your PMO really is ineffective; some are. But maybe there's a different issue at work—either micromanaging on their part or lack of accountability on the rest of the organization's part. + +A friend described to me a situation in which the two engineering executives in their company constantly complained about the PMO, for reasons that were never clear. What was clear was that the engineering executives did not value transparency or accountability. Meanwhile, my friend stated that many people in the company swore that without the PMO, nothing would have gotten done within any reasonable amount of time. After a leadership change, the engineering executives were replaced; the PMO remained. + +If the issue is with the PMO, consider coaching the team to be more effective. This can be done through a retrospective or, if you have time, one-on-ones. I have been lucky enough to work in three organizations with high-performing PMO organizations. They framed conversations with teams to similarly focus on goals and broader developments taking place around them. They were empathetic—trying to understand why programs lagged behind, instead of blaming or nagging. They were focused on producing value—aligning teams, making work transparent, keeping meetings well-organized and constructive, and asking pragmatic questions that averted disasters or surfaced gaps in strategy. + +Instead of checking in to see if people were doing their work, they helped teams find out ways to help each other. In many cases, they helped drive knowledge exchange to cross-pollinate new ideas and solutions either by running effective meetings or hosting dedicated conversations. + +If the issue is with your organization, work with the PMO to see how your leadership team can become better advocates for PMO work. Sometimes the issue for PMOs is a lack of public relations and reputation management. Sadly, PMOs can become the canvases upon which disgruntled parties project everything they're mad about, and this really isn't helpful to anyone. Neither are out-of-the-box expectations that PMOs can solve product strategy problems when product managers abdicate responsibility, or solve your technical architecture, or resolve every conflict between two engineers. Your organization might simply be misapplying your PMO power in ways that reinforce existing biases or misunderstandings of their work. Find ways to stop that. + +As a PMO of one person, I work closely with stakeholders across my organization to break down complexity, clarify outcomes, and track work-in-progress through lightweight visualizations. It's all storytelling. I work closely with our agile coaching team, laying the groundwork with delivery teams to form a coherent vision for what to build, then collaborating with the coaches to work with specific teams to boost performance and ensure better flow on that vision. It's not wizardry, and I've recycled it from what other successful PMOs have shown and taught me over the years. It seems to work. + +### Give your agile coaches and scrum masters meaningful metrics + +"I thought agile coaches just measured velocity and story points, and scrum masters do the same but also keep JIRA updated," more than one person on earth has said. How did they reach this conclusion? Possibly by working in an organization that asked coaches and scrum masters to focus on output instead of value. Maybe those organizations didn't expect or even care if the coaches demonstrated their effectiveness; the coaches and scrum masters were there to serve a purpose, like security blankets of agility. + +Story points and velocity are worthless metrics if the work delivered isn't valuable. So is counting the number of retrospectives, or counting the decline in the number of bugs per team (easily gamed), or the amount of time spent pair programming. These metrics do not necessarily tell a coherent story about your organization, and they do not help the coaches and scrum masters grow. + +I like [this list of agile coach metrics by Andy Sio][4]: measure impact by looking for evidence of efficiency, or reducing meetings, or collecting data points around teams using coaches' suggestions to make improvements. For the scrum masters, Ryan Ripley invites leaders to [rethink the role][5] as one of service, challenging the status quo. Find someone else to update the JIRAs and take the notes. + +Maybe you're cool with empowering coaches and scrum masters, but now you're asking, "we have product managers and business analysts—why do we need coaches to do this?" Because dysfunction in delivery is usually systemic. It's about a confluence of discussions, decisions, communications, and other bits and pieces of work going awry, slowly at first, until it all adds up to become A Bigger Problem. + +A coach can help your product managers, analysts, and devs surface those Bigger Problems, understand the root causes, and find more effective alternatives to right the ship. If urgent enough, this can mean the difference between success and failure. For example: + + * How effective can a scrum master assigned to two or three teams possibly be if those teams are facing a constant barrage of "this is urgent!" work chucked in from the leadership team? + * How can a team align with other teams, if those teams aren't sharing roadmaps? + * How can engineering and product remain aligned if there are two competing roadmaps? + * If you're facing Coronavirus, will your product managers, devs, and analysts have time to unpack all of this systemic dysfunction, or could they use a little help? + + + +Identify the "glue people" in your organization and find ways to leverage them through focused programs dedicated to one or two outcomes at most. Consider forming a "community of practice," an informal setting (Lean Coffee or other formats) for them to share best practices or highlight and resolve process-related needs in the organization. + +If your glue people are already overwhelmed, consider hiring more of them. This might sound counterintuitive if you're laying people off, but what costs more—hiring one program manager to do the job well, or having ten developers and product managers do the job with less focus, while not doing their usual jobs? + +Hopefully, you're able to identify the people in your organization who can connect the dots, tell your story, and bring everyone together. Maybe you've even hired people specifically to mind your processes and haven't laid them off yet. Please don't! They might save you and everyone else in your company. But only if you empower them. + +If you're starting something from scratch, support your glue people in keeping everyone else from losing the plot. Then you build a culture of maintaining the plot. It's easier to iterate and improve upon such a culture when it's the foundation of your new initiative or product than to force it after developing lots of antipatterns and worst-practice habits. Sure, incremental change can bring teams and organizations back on track—but why tolerate being off-track in the first place? "Going faster at the beginning" isn't a good reason; you can go super-fast and be experimental and still hold your team together. + +Process can be simple and lightweight—in fact, it should be. But it can't be solved simply by putting some meetings in a calendar and writing everything down in Confluence. It has to be customized and curated, created to achieve and sustain flow, and designed to be adapted depending on what's necessary. Otherwise, it will be an obstacle and a waste of time instead of an aid, and people will hate it. And it probably won't come from following scrum by the book, or anything by the book. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/open-organization/20/6/glue-person + +作者:[Lauri Apple][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/lapple +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/lenovo-thinkpad-laptop-concentration-focus-windows-office.png?itok=-8E2ihcF (Woman using laptop concentrating) +[2]: https://opensource.com/open-organization/20/6/glue-team +[3]: https://www.scrum.org/resources/blog/zombie-scrum-symptoms-causes-and-treatment?gclid=EAIaIQobChMI97Cr6v-96QIVFO3tCh25RgrWEAAYASAAEgIgYfD_BwE +[4]: https://www.strategicquadrant.com/blog/how-to-measure-your-successas-an-agile-coach/ +[5]: https://enterprisersproject.com/article/2020/4/scrum-master-role-how-rethink diff --git a/sources/talk/20200616 Changing the world with open source- GNOME president shares her story.md b/sources/talk/20200616 Changing the world with open source- GNOME president shares her story.md new file mode 100644 index 0000000000..98ddcd364c --- /dev/null +++ b/sources/talk/20200616 Changing the world with open source- GNOME president shares her story.md @@ -0,0 +1,164 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Changing the world with open source: GNOME president shares her story) +[#]: via: (https://opensource.com/article/20/6/nuritzi-sanchez-interview) +[#]: author: (Don Watkins https://opensource.com/users/don-watkins) + +Changing the world with open source: GNOME president shares her story +====== +GitLab's new senior open source program manager and founding team member +of Endless OS shares her vision for using open source to improve +society. +![Globe up in the clouds][1] + +Growing up in Silicon Valley, [Nuritzi Sanchez][2] saw the powerful impact software can make on the world. Yet, unlike many others who were also steeped in the tech industry, her journey has taken her into the world of open source, where she is contributing to that impact. + +After graduating from Stanford University with a degree in International Relations, she ****became a founding team member of open source computing company [Endless OS][3], served three terms as president and chair of GNOME's board of directors, and in February 2020 was hired as the senior open source program manager (OSPM) at GitLab. + +I am impressed by this talented woman, and I reached out to her to learn more about her and her work. I believe you will also be fascinated with her journey after reading our interview, which has been lightly edited for clarity. + +**Don Watkins:** How did you get started with open source? + +**Nuritzi Sanchez**: My first experience with open source software was using an Ubuntu-based computer at an immigration law clinic when I was interning there as an undergrad. I remember being really surprised that something other than Macs and Windows existed. I had a good experience using the Ubuntu machine. + +Later, in 2012, I helped start a company called [Endless][4] that aimed to make computing universally accessible. By leveraging the power of open source software, we wanted to create computers that were great for users that had little to no access to the internet or were new to computers. + +As I deep-dived into that world, I was amazed by how vast the open source application ecosystem is. In my college years, I had become an Apple fangirl, and I immediately noticed the difference in user experience and design. Thanks to the CEO and founder's strong interest in great design, Endless was created from the beginning to delight users. Our team hoped to bring more user-centered design to the Linux desktop world. + +![GUADEC 2015 newcomers' event][5] + +GUADEC 2015 newcomers' event (Nuritzi Sanchez, [CC BY-SA 4.0][6]) + +In 2015, I gave my first talk at [GUADEC][7] (the GNOME community's largest conference) about [adapting GNOME for the developing world][8]. I didn't know what to expect going into the conference since that was the first time I'd attended an open source software event, and I was incredibly impressed with how friendly and welcoming the GNOME community was. The newcomers' and social events helped me bond with the existing community, and when I attended a Birds of a Feather (BoF) session, I noticed that my project management and leadership skillset was immediately useful. Even though I was new to the community and was not an engineer, I felt like I could immediately contribute. I wished I had known about GNOME and the open source world years before! + +**DW:** What is the power of open source for you? + +**NS**: Open source software helps democratize the world and enables us to solve the challenges we know best. You can build on top of the work that others have done in order to solve unique challenges around you instead of having to recreate something completely from scratch. It thus spurs innovation. + +Since a lot of open source software is not only free as in philosophy but also free as in price, it also gives people who may not otherwise be able to afford it access to tools that are essential to be part of the modern workforce. + +**DW:** How did your family background drive your interest in open source? + +**NS**: My parents are from Mexico, and when we visited family there, I was struck by the differences between where I was growing up, in the Silicon Valley, and where my parents were from. Sometimes we would visit towns where people had cardboard instead of windows, elderly people were sitting in the heat trying to sell artisanal goods they made, and poverty was visible in every corner. I heard heartbreaking stories about the struggles that people were facing, and as an empathetic kid, that all greatly impacted me. I wanted to do something to help. + +During my undergraduate years at Stanford, I really struggled to find just one thing that I was interested in. I was drawn to social impact initiatives, but I wanted to help people be healthier, have access to great education, find jobs, and feel fulfilled. I basically wanted to do _all the things_. This led me to explore many potential career paths through internships. + +Unsurprisingly for someone who grew up in the Valley, I ended up believing that getting involved with software was the best way for me to make a huge impact. I saw how just a small team could create software that was used by millions of people and could impact their lives. It seemed like a superpower. I then became enamored with open source software because of all the reasons I've mentioned above. As a bonus, open source software usually already has an international community, and as I've gotten more involved, I've been keen on helping to expand its reach. + +**DW: How has your involvement with Endless shaped your vision and direction?** + +**NS:** One of the things that I loved about Endless is how much the team valued getting to know its users. Every employee was able to go to one of Endless' target markets and do in-field research. We were able to meet people whose lives we were actually being impacted by our work. + +My time at Endless allowed me to travel and become immersed in different cultures to an extent that I wouldn't have had otherwise. I sometimes spent several months in a target market when I was helping with special initiatives. I met people from the international open source community who are extremely dedicated to the open source philosophy—and I also learned more about the challenges they face when contributing. + +![Endless OS user testing in Guatemala][9] + +Endless OS user testing in Guatemala (Nuritzi Sanchez, [CC BY-SA 4.0][6]) + +The other theme is the importance of user-centered design. I'm very grateful to have been part of a team with extremely talented designers and executives that believed that great design was essential. Our COO attended the [Stanford d.school][10] and helped infuse the company with an appreciation for design thinking. Similarly, our CEO had a sharp eye for things being pixel-perfect and always challenged our designers to create beautiful software. I developed a certain aesthetic and a deep appreciation of the design process. My time at Endless helped me appreciate some of the unique challenges that designers face when trying to contribute to open source software. + +**DW:** Diversity and inclusion are really important to you. How does diversity improve products and communities? + +**NS**: Diversity of thought is something incredibly important when solving any kind of challenge. In order to do that, you need to bring in people from diverse backgrounds. New perspectives often bring new insights or new ideas into the mix. + +One of the tangible examples I have from my time at Endless is when we were working in Indonesia and wanted to do user research there to better understand the market. One of our Endless Ambassadors, Siska, belonged to a group of housewives that met regularly, and she introduced Endless at one of their meetings. Many of the housewives who attended got really excited about Endless and told their partners and children about it. Being great networkers, some of them helped us find people for our user research studies and became evangelists of our product in their communities. It was something that, at least to me, wasn't a normal path to take, and it was something that was hugely beneficial. + +![Meeting with open source community members in Indonesia][11] + +Meeting with open source community members in Indonesia (Nuritzi Sanchez, [CC BY-SA 4.0][6]) + +**DW:** What led you to leave Endless and move to GNOME? + +**NS**: Endless did a lot of things right, and it still faced a lot of the challenges that all open source desktops face in a world that is [dominated][12] by Microsoft. Endless had to make some hard choices about how to evolve its strategy and also started to explore some new ideas—like how to make Endless a great platform to teach children how to code. It was during this time that we parted ways, but I continue to be a huge fan and still use Endless OS on my personal computer. + +I ended up taking some time off after Endless to travel and to continue my third term as the president and chairperson of the board of directors at GNOME. + +![Women Who Code Taipei event][13] + +Meeting with Women Who Code Taipei (Nuritzi Sanchez, [CC BY-SA 4.0][6]) + +**DW:** GNOME experienced tremendous growth during your tenure. What do you attribute that to? + +**NS**: There were many things that factored into the growth we saw during my tenure. Here are the most important ones: + + * **Improving the newcomer's story:** Carlos Soriano, Bastian Ilso, and Christian Hergert, in particular, really helped set GNOME's momentum in motion by working on a newcomer's guide for code contributors. They developed the workflows and tools that made an immediate impact on our community's growth. Later, Carlos led an evaluation of tooling and helped GNOME find GitLab as the solution to further simplifying the contribution process. + + * **Broadcasting our story and promoting our brand:** As part of the Engagement team, I helped to amplify our work on the newcomers initiatives and helped to build our brand and online presence. GNOME's work on improving the newcomers' story gained a lot of interest within the wider community and brought about new interest in the GNOME project, and we used that to help build the sense that GNOME was in forward momentum. Marketing, brand, and dedicated community-building are really important for open source organizations. + + * [**Flatpak**][14]**,** [**Flathub**][15]**, and** [**Builder**][16]**!** There were several technological innovations that helped propel GNOME forward. For example, Flatpak and Builder helped to make creating a GNOME app easier than ever, and users were able to find and install apps directly from Flathub. These innovations were _huge_ because they made it possible for anyone to create and enjoy great Linux desktops. Furthermore, it helped unify the Linux desktop community a bit since any distribution that enabled Flatpak apps could benefit from easier distribution and management of apps. + + * **Hiring an** **executive** **director (ED):** GNOME had been without an ED for several years before I joined. With the help of a hiring committee, the board soon interviewed several highly qualified candidates for the ED position. Leveraging my startup experience in hiring, I worked with our vice president at the time to figure out all the logistics behind hiring our first-ever non-US employee and closing the loop. We soon announced that Neil McGovern would join as the GNOME executive director. This was an important step for us since the board had absorbed the ED's responsibilities while the position was unfilled. Since the board was elected annually, that meant that planning long-term, strategic initiatives was rather difficult because of turnover. + + * **Dreaming new dreams:** While I'm biased, I do think that Endless' new perspective helped the GNOME community to dream a new dream and start creating GNOME for a user beyond the "typical Linux desktop user." This meant working on features that enabled a less tech-savvy, more design-sensitive, and less-connected user. Since Endless worked heavily upstream, GNOME experienced an influx of contributors from Endless' employees and Endless' ecosystem. This, combined with the newcomers' story, helped propel GNOME into an era of being more accessible to more people around the world. This also helped attract donations from organizations, including a $1 million pledge that helped GNOME dream new dreams. As part of that, the board decided that expanding the GNOME Foundation would help sustain GNOME's momentum and that employees would be hired for the first time ever to work directly on aspects of the project, like on GTK and event planning. + + * **Restructuring the** **GNOME** **Foundation:** One of my short-term goals upon hiring our executive director was leading the board of directors to be more of a strategic entity and allowing the day-to-day work to be handled by employees. I proposed having a board hackathon so that we could set aside time to do some strategic planning, reassess how we did budgeting, and also work on important initiatives that often got pushed to the side. The first hackathon was a success, and it's now an annually recurring event. Once the employees had been hired, we worked on transferring responsibilities to them and helping to integrate them into the larger community. There were some challenges we faced along the way, but overall, this went smoothly, and the community was excited about seeing the Foundation grow to support its needs. + + * ![Linux App Summit 2019][17] + +Linux App Summit 2019 (Nuritzi Sanchez, [CC BY-SA 4.0][6]) + +**New policies to enable growth:** While on the board, I helped with some initiatives that also helped us build momentum. Two such policies were our [Code of Conduct][18] and our [Travel Policy][19]. These two helped make the GNOME community more inclusive and helped show that GNOME cares about continuing to build a great and diverse community. + + * **Linux App Summit:** Finally, another thing I think helped was the work we did around creating a new conference, the [Linux App Summit][20]. While the conference started in 2016, in 2019, we joined forces with KDE. This doubled attendance and showed the world that KDE and GNOME could work together towards a greater purpose. As part of the founding team of that conference, I'm very proud of our work there. + + + + +**DW:** You've recently moved to GitLab as senior open source program manager (OPSM). What are you doing there? What are your short-term and long-term goals there? + +**NS**: I am thrilled to be at GitLab! My main focus right now is on the [GitLab for Open Source][21] program, which offers our top tiers for free to qualifying open source projects. As part of that program, we also help large open source organizations with their migrations (GNOME, KDE, Drupal, etc.). I'm working on formalizing aspects of the program and streamlining processes that will allow us to scale the program. + +![GitLab's community relations team][22] + +GitLab's community relations team (Nuritzi Sanchez, [CC BY-SA 4.0][6]) + +As I work on this program, I'm being exposed to new open source communities, and I'm learning more about the DevOps world. It's been incredibly rewarding already! My hope is to help make GitLab the best place for open source organizations to thrive at scale, and in order to do so, there are many pieces involved. I see myself advocating for features that are important to open source projects, facilitating communication between our community and our internal team, and working with the community relations team to help make it a great experience to be part of our community. Apart from that, one thing that I've been interested in is how to help make open source more sustainable, so I'm keen on continuing to learn about and explore that topic. Last but not least, I’m also very excited about the work that the CHAOSS community is doing on creating metrics to measure the health of open source communities. I recently joined a new working group there to create a set of metrics that foundations like GNOME and KDE can use to measure their community’s health. + +**DW:** Would you recommend other open source companies have OSPMs? What about non-open source companies? + +**NS**: Since software is eating the world, and open source software is eating the software world, I absolutely would encourage companies to devote more resources into understanding their dependency on and growing their involvement in open source software. + +If a company is just starting off or isn't able to have an open source program office (OSPO) right away, having an open source program manager is a great entry point. These early hires can help lay down some initial structure and work on high-priority initiatives relating to the open source work that the company is doing or wants to participate in. This can later turn into a larger program office if and when the company is ready for that. + +* * * + +I appreciate the time Nuritizi took to share her journey with me and the work she's doing to support open source and the communities that build up around open source projects. If you'd like to learn more about her, I recommend you join me in following her on [Twitter][2]. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/6/nuritzi-sanchez-interview + +作者:[Don Watkins][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/don-watkins +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/cloud-globe.png?itok=_drXt4Tn (Globe up in the clouds) +[2]: https://twitter.com/1nuritzi +[3]: https://opensource.com/article/18/2/meet-endless-os-lightweight-linux +[4]: https://endlessos.com/home/ +[5]: https://opensource.com/sites/default/files/uploads/guadec_2015.jpg (GUADEC 2015 newcomers' event) +[6]: https://creativecommons.org/licenses/by-sa/4.0/ +[7]: https://events.gnome.org/event/1/ +[8]: https://www.youtube.com/watch?v=qs5J_IWSmiE +[9]: https://opensource.com/sites/default/files/uploads/endless_usertestingguatemala.jpg (Endless OS user testing in Guatemala) +[10]: https://dschool.stanford.edu/ +[11]: https://opensource.com/sites/default/files/uploads/indonesiacommunitygathering.jpg (Meeting with open source community members in Indonesia) +[12]: https://en.wikipedia.org/wiki/Usage_share_of_operating_systems +[13]: https://opensource.com/sites/default/files/uploads/womenwhocodetaipei.jpg (Women Who Code Taipei event) +[14]: https://flatpak.org/ +[15]: https://flathub.org/home +[16]: https://wiki.gnome.org/Apps/Builder +[17]: https://opensource.com/sites/default/files/uploads/linuxappsummit2019.jpg (Linux App Summit 2019) +[18]: https://wiki.gnome.org/Foundation/CodeOfConduct +[19]: https://wiki.gnome.org/Travel +[20]: https://linuxappsummit.org/ +[21]: https://about.gitlab.com/solutions/open-source/ +[22]: https://opensource.com/sites/default/files/uploads/gitlab_cr-team.jpg (GitLab's community relations team) diff --git a/sources/talk/20200619 What do Paketo Buildpacks Mean for Developers and Operators.md b/sources/talk/20200619 What do Paketo Buildpacks Mean for Developers and Operators.md new file mode 100644 index 0000000000..77ed828a9d --- /dev/null +++ b/sources/talk/20200619 What do Paketo Buildpacks Mean for Developers and Operators.md @@ -0,0 +1,83 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (What do Paketo Buildpacks Mean for Developers and Operators) +[#]: via: (https://www.linux.com/audience/developers/what-do-paketo-buildpacks-mean-for-developers-and-operators/) +[#]: author: (Swapnil Bhartiya https://www.linux.com/author/swapnil/) + +What do Paketo Buildpacks Mean for Developers and Operators +====== + +Cloud Foundry Foundation recently announced the launch of [Paketo Buildpacks][1] for cloud native developers and operators. But what’s the difference between Cloud Foundry’s Packet and the Buildpacks announced by CNCF? What does it mean for developers who are already using buildpacks? What kind of community is Cloud Foundry look at building around Paketo? What does the roadmap look like? + +To get answers to these questions and deep dive into Paketo Buildpacks, [Swapnil Bhartiya][2], Founder of TFiR.io spoke with Chip Childers, Executive Director, Cloud Foundry Foundation and Kashyap Vedurmudi, Product Manager at VMware. + +_Here is a lightly edited transcript of the interview:_ + +**Swapnil Bhartiya: Today we have two guests, Kashyap Vidurmudi, product manager at VMware, and Chip Childers, executive director of Cloud Foundry. Today we are going to talk about the recently announced Paketo Buildpacks. I don’t want to get into that old debate about Docker files versus Buildpacks, but there are two things that I do want to talk about before we talk about Paketo in specific – compliance and security. How does Paketo Buildpacks solve these two problems?** + +Kashyap Vidurmudi: So, we have a couple of things. We are constantly shipping Buildpacks just whenever upstream security vulnerability comes out, a new language family version, things like that. So Buildpacks make it much easier especially for enterprise users just to continuously make sure that their apps stay up to date, and secure, and compliant. So this is I think a huge value proposition of what Buildpacks offer versus using Docker files to run your apps and to build your apps and production. + +Chip Childers: The history of the Cloud Foundry project is, it’s been using Buildpack since nearly the beginning of its inception, originally at VMware, right, before it took it to journey to pivotal and then the CFF. So Buildpacks have demonstrated their value when used with a platform that’s able to implement them effectively, a few times, right? In particular, I’m thinking about the OpenSSL Heartbleed vulnerability. I found that to be a great example of when languages and runtimes don’t embed too many things in their distribution statically, then you’re able to use the Buildpack process to roll out security patches to these really important underlying libraries very quickly. + +Chip Childers: As an example, Kashyap said that the buildpack project with Paketo Buildpacks, they’ve always been keeping up to date with all their critical vulnerabilities or high vulnerabilities from all the languages and frameworks that get pulled together. We had the OpenSSL update rolled out to the whole ecosystem and it managed to percolate through all the platforms that had the CF Buildpacks embedded in them very quickly, like in a matter of days. And it was really smooth. The only hiccup back then was that no JS actually included the OpenSSL library in its own distribution. So I think it was about a month or so after Heartbleed that they split that out and then Buildpacks could be more effective at helping to support some of these underlying libraries. + +**Swapnil Bhartiya: Thanks for explaining that. If I’m not wrong, last year, CNCF also announced a Buildpack project. What is the difference between what CNCF is doing there versus what you guys are trying to do?** + +Kashyap Vidurmudi: That’s a great question and probably the biggest question we’ve been getting asked with this whole launch. So the CNCF Cloud Native Buildpacks project, they built the underlying specification and tooling needed to build a Cloud Native compliant Buildpack. Or the Paketo Buildpacks project is just a set of language family implementations on top of these Cloud Native Buildpack specifications. So we build implementations when we launched the other day, we have Java, node.js, PHP, .NET Core, and probably a couple of others that I’m missing, Buildpack implementations on top of that spec. + +**Swapnil Bhartiya: And why do you call it Paketo Buildpacks, the specific reasons for this naming?** + +Kashyap Vidurmudi: That’s a great question as well. To be completely honest with you, our whole engineering team went through about two different naming exercises just to generate different names for Buildpacks. At a team lunch, a couple of months ago, someone came up with the Paketo, which translates to Greek and… Sorry, it translates to package in Greek. What we really liked about it was Kubernetes translates to pilot and Greek, and we liked that with Paketo translating a package in Greek. We can come off with the association that Paketo packages your apps as container images that any Cloud Native platforms similar to Kubernetes can work as straight. So the name stuck at the end. + +**Swapnil Bhartiya: Talk a bit about the collaboration between Cloud Foundry and VMware for this project.** + +Chip Childers: I want to start probably by saying, the kind of Buildpack project is a Cloud Foundry Foundation project, right? And so what that means is it’s the same engineers and contributors that are working on the traditional Cloud Foundry. Buildpacks are building the Paketo Buildpacks collection, right? So you get all their past experience as a community building and maintaining, and keeping up to date these new Cloud Native Buildpack compliant things. One of the goals of the project team, which I’m sure Kashyap could share a little bit more about as well, is that traditionally the Cloud Foundry Buildpack collection has seen the majority of the effort that was put into maintaining it coming from pivotal. + +There were certainly a lot of casual contributors, but it was something, that pivotal bore the full burden on. And we think that it’s incredibly important that now that the Cloud Native Buildpacks spec can be used in many different platforms. That a lot of participants rally around this because it’s an opportunity to get really high-quality Buildpack code brought into whichever platform you’re using, whether it’s Tecton, or it’s Google Cloud run, or whether it’s the CF [inaudible 00:07:06] distribution of Cloud Foundry. There are going to be a lot of end-users that should be able to amplify the feedback loop back to the project team. And we’re very open to new contributors there. + +**Swapnil Bhartiya: What kind of community are you planning to build around these Paketo Buildpacks and what will be the resources available for the community to build and consume these Buildpacks?** + +Kashyap Vidurmudi: I think just to add on a little bit to what Chip said, the community is super important for us with this whole Paketo Buildpacks launch. I think what we’re looking for ideally is a mix of vendors helping us out similar to what Cloud Foundry Foundation has had in the past, as well as individual contributors. And what’s super exciting to see is we just launched a couple of days ago and we’re already seeing a bunch of people reaching out, and trying out Paketo Buildpacks, and interested in contributing. We’re seeing that maybe people might be interested in helping us develop a Python, Paketo Buildpacks, which is really cool to see. To answer the second part of your question around a marketplace or some ecosystem, I think in the future, that would be super cool to have something like that. In the short term, what we’re doing is we have with this concept of builder images where a builder is effectively a set of Buildpacks, Paketo Buildpacks that are packaged in there. So we ship our builders onto a GCR registry that users can then use to consume our Buildpacks. + +**Swapnil Bhartiya: Is there any specific Buildpacks that will be available or you’ll be focusing on to start with?** + +Kashyap Vidurmudi: Yeah. When we launched the other day, we officially have Java, node.js, .NET Core, PHP, and Nginx Paketo Buildpacks available at the moment. We’re currently just getting started around a Ruby Paketo Buildpacks and looking into publishing some official project-wide roadmap in the future to show what’s coming next. + +Chip Childers: I think that’s another really good opportunity for people to get involved. As you said, there’s been interest organically in helping to add Python as a Buildpack. There’s a very long tail of different languages and frameworks that are used in the enterprise context. And so Paketo Buildpacks was going out the door with a set of Buildpacks that basically solved the majority of enterprise development use cases, right? Python is used very heavily, but it’s a little bit less than Java, right? And so the tail starts to drop a little bit. But there’s a lot of opportunity in those languages and frameworks that the Paketo Buildpacks project team hasn’t created on their own. But those same patterns can be followed for languages that might be maybe less used. + +As the community grows around, not just the Cloud Native Buildpacks spec, right, because anyone can build a Buildpack to that spec. But I think the practices of the Paketo Buildpacks project lend themselves to quality distribution of a Buildpack, right? If you search and get up for Buildpacks, even if you’re just looking at the past version of the way Buildpacks work, you find thousands of them, right? But some of them are stale, some of them are, they have work. And I think the more important than exactly which Buildpacks are offered today is that the Paketo Buildpacks project is an opportunity for people to come together around the discipline of building quality Buildpacks and then maintaining them over time. + +Kashyap Vidurmudi: Yeah, exactly. That’s a really good point. And I think that over the next coming weeks to months, we’re really focused on improving a lot of our documentation to help enable things like this. We have a couple of tutorials right now just to help users create a Paketo style Buildpack and lots of tools and things like that out there. So my end goal and just sure Chip agrees with this, which is, I’d love to see a user just coming in with very little Buildpack experience and be able to build, say, a Rust Cloud Native Buildpack or something like that very simply and easily and support that. And that’s the end goal of where we want to go in terms of enabling the community to build Buildpacks easily. + +**Swapnil Bhartiya: So what happens to the existing Buildpacks that people are already using?** + +Kashyap Vidurmudi: For Cloud Foundry Buildpacks, we’re going to continue providing support for CF workloads into the foreseeable future. So what we did is we built a concept of a compatibility layer on top of every one of our Paketo Buildpacks, which allow us to ship a Cloud Foundry compatible Cloud Native Buildpack. And that enables your CF workflows to continue to work with Paketo Buildpacks. + +Chip Childers: I think one of the things to understand, and this is where it gets a little bit confusing, right? Buildpacks as a concept has a fairly long history. So it started at Heroku. CF was emulating Heroku, right? It was the open source alternative to Heroku and it implemented Buildpacks in order to have that support. And for a while, they were largely compatible, right? You could take a Heroku Buildpack and you could use that in a Cloud Foundry context or you could do the reverse. And so that worked for a while. The two platforms, right, Cloud Foundry and opensource community. And then Heroku as a product or a platform as a service, that’s all proprietary, they started to diverge, right? So the compatibility within the ecosystem started to break down. + +When the CNCF Cloud Native Buildpacks project kicked off, to me that was actually one of the most important moments in the platform as a service space in a number of years. Because it represented a reconvergence of streams of work and sets of experiences with different end-users that made a ton of sense for everyone. But what that means though, is that the CMB spec is, it’s a new way to build Buildpacks, right? So all that historical work for the CF community building that shim is important, but it’s really critical to understand that a Cloud Native Buildpack, compliant Buildpack is different from a traditional Heroku or Cloud Foundry, older version Buildpack. They’re implemented differently. And so it’s a new generation of them. And that’s where a new ecosystem because there are multiple platforms that don’t support their use, is really going to kick in here. + +**Swapnil Bhartiya: Kashyap, you mentioned there’ll be a lot of resources documentation that would be coming up. What are the resources that are available at this moment that people can either read or go to that to get more aware of the project at the same time, how they can get involved with the project?** + +Kashyap Vidurmudi: Yeah. So right now we have a couple of tutorials out there just around how to get started with Paketo Buildpacks as well as how to go ahead and create your own Paketo Buildpacks. In terms of getting started and helping out and getting involved, I think the best way to get started right now is to join us on Slack, our Slack is Slack.paketo, P-A-K-E-T-O.io, or visit our website and go through the content. The website is P-A-K-E-T-O.io. + +**Swapnil Bhartiya: Chip and Kashyap, thank you so much for taking time out of your schedule and talking to us today about this project. Good luck with that project and thank you once again.** + +-------------------------------------------------------------------------------- + +via: https://www.linux.com/audience/developers/what-do-paketo-buildpacks-mean-for-developers-and-operators/ + +作者:[Swapnil Bhartiya][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://www.linux.com/author/swapnil/ +[b]: https://github.com/lujun9972 +[1]: https://paketo.io/ +[2]: https://www.tfir.io/author/arnieswap/ diff --git a/sources/talk/20200628 Roy Fielding-s Misappropriated REST Dissertation.md b/sources/talk/20200628 Roy Fielding-s Misappropriated REST Dissertation.md new file mode 100644 index 0000000000..5906fd1d92 --- /dev/null +++ b/sources/talk/20200628 Roy Fielding-s Misappropriated REST Dissertation.md @@ -0,0 +1,125 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Roy Fielding's Misappropriated REST Dissertation) +[#]: via: (https://twobithistory.org/2020/06/28/rest.html) +[#]: author: (Two-Bit History https://twobithistory.org) + +Roy Fielding's Misappropriated REST Dissertation +====== + +RESTful APIs are everywhere. This is funny, because how many people really know what “RESTful” is supposed to mean? + +I think most of us can empathize with [this Hacker News poster][1]: + +> I’ve read several articles about REST, even a bit of the original paper. But I still have quite a vague idea about what it is. I’m beginning to think that nobody knows, that it’s simply a very poorly defined concept. + +I had planned to write a blog post exploring how REST came to be such a dominant paradigm for communication across the internet. I started my research by reading [Roy Fielding’s 2000 dissertation][2], which introduced REST to the world. After reading Fielding’s dissertation, I realized that the much more interesting story here is how Fielding’s ideas came to be so widely misunderstood. + +Many more people know that Fielding’s dissertation is where REST came from than have read the dissertation (fair enough), so misconceptions about what the dissertation actually contains are pervasive. + +The biggest of these misconceptions is that the dissertation directly addresses the problem of building APIs. I had always assumed, as I imagine many people do, that REST was intended from the get-go as an architectural model for web APIs built on top of HTTP. I thought perhaps that there had been some chaotic experimental period where people were building APIs on top of HTTP all wrong, and then Fielding came along and presented REST as the sane way to do things. But the timeline doesn’t make sense here: APIs for web services, in the sense that we know them today, weren’t a thing until a few years after Fielding published his dissertation. + +Fielding’s dissertation (titled “Architectural Styles and the Design of Network-based Software Architectures”) is not about how to build APIs on top of HTTP but rather about HTTP itself. Fielding contributed to the HTTP/1.0 specification and co-authored the HTTP/1.1 specification, which was published in 1999. He was interested in the architectural lessons that could be drawn from the design of the HTTP protocol; his dissertation presents REST as a distillation of the architectural principles that guided the standardization process for HTTP/1.1. Fielding used these principles to make decisions about which proposals to incorporate into HTTP/1.1. For example, he rejected a proposal to batch requests using new `MGET` and `MHEAD` methods because he felt the proposal violated the constraints prescribed by REST, especially the constraint that messages in a REST system should be easy to proxy and cache.[1][3] So HTTP/1.1 was instead designed around persistent connections over which multiple HTTP requests can be sent. (Fielding also felt that cookies are not RESTful because they add state to what should be a stateless system, but their usage was already entrenched.[2][4]) REST, for Fielding, was not a guide to building HTTP-based systems but a guide to extending HTTP. + +This isn’t to say that Fielding doesn’t think REST could be used to build other systems. It’s just that he assumes these other systems will also be “distributed hypermedia systems.” This is another misconception people have about REST: that it is a general architecture you can use for any kind of networked application. But you could sum up the part of the dissertation where Fielding introduces REST as, essentially, “Listen, we just designed HTTP, so if you also find yourself designing a _distributed hypermedia system_ you should use this cool architecture we worked out called REST to make things easier.” It’s not obvious why Fielding thinks anyone would ever attempt to build such a thing given that the web already exists; perhaps in 2000 it seemed like there was room for more than one distributed hypermedia system in the world. Anyway, Fielding makes clear that REST is intended as a solution for the scalability and consistency problems that arise when trying to connect hypermedia across the internet, _not_ as an architectural model for distributed applications in general. + +We remember Fielding’s dissertation now as the dissertation that introduced REST, but really the dissertation is about how much one-size-fits-all software architectures suck, and how you can better pick a software architecture appropriate for your needs. Only a single chapter of the dissertation is devoted to REST itself; much of the word count is spent on a taxonomy of alternative architectural styles[3][5] that one could use for networked applications. Among these is the Pipe-and-Filter (PF) style, inspired by Unix pipes, along with various refinements of the Client-Server style (CS), such as Layered-Client-Server (LCS), Client-Cache-Stateless-Server (C$SS), and Layered-Client-Cache-Stateless-Server (LC$SS). The acronyms get unwieldy but Fielding’s point is that you can mix and match constraints imposed by existing styles to derive new styles. REST gets derived this way and could instead have been called—but for obvious reasons was not—Uniform-Layered-Code-on-Demand-Client-Cache-Stateless-Server (ULCODC$SS). Fielding establishes this taxonomy to emphasize that different constraints are appropriate for different applications and that this last group of constraints were the ones he felt worked best for HTTP. + +This is the deep, deep irony of REST’s ubiquity today. REST gets blindly used for all sorts of networked applications now, but Fielding originally offered REST as an illustration of how to derive a software architecture tailored to an individual application’s particular needs. + +I struggle to understand how this happened, because Fielding is so explicit about the pitfalls of not letting form follow function. He warns, almost at the very beginning of the dissertation, that “design-by-buzzword is a common occurrence” brought on by a failure to properly appreciate software architecture.[4][6] He picks up this theme again several pages later: + +> Some architectural styles are often portrayed as “silver bullet” solutions for all forms of software. However, a good designer should select a style that matches the needs of a particular problem being solved.[5][7] + +REST itself is an especially poor “silver bullet” solution, because, as Fielding later points out, it incorporates trade-offs that may not be appropriate unless you are building a distributed hypermedia application: + +> REST is designed to be efficient for large-grain hypermedia data transfer, optimizing for the common case of the Web, but resulting in an interface that is not optimal for other forms of architectural interaction.[6][8] + +Fielding came up with REST because the web posed a thorny problem of “anarchic scalability,” by which Fielding means the need to connect documents in a performant way across organizational and national boundaries. The constraints that REST imposes were carefully chosen to solve this anarchic scalability problem. Web service APIs that are _public-facing_ have to deal with a similar problem, so one can see why REST is relevant there. Yet today it would not be at all surprising to find that an engineering team has built a backend using REST even though the backend only talks to clients that the engineering team has full control over. We have all become the architect in [this Monty Python sketch][9], who designs an apartment building in the style of a slaughterhouse because slaughterhouses are the only thing he has experience building. (Fielding uses a line from this sketch as an epigraph for his dissertation: “Excuse me… did you say ‘knives’?”) + +So, given that Fielding’s dissertation was all about avoiding silver bullet software architectures, how did REST become a de facto standard for web services of every kind? + +My theory is that, in the mid-2000s, the people who were sick of SOAP and wanted to do something else needed their own four-letter acronym. + +I’m only half-joking here. SOAP, or the Simple Object Access Protocol, is a verbose and complicated protocol that you cannot use without first understanding a bunch of interrelated XML specifications. Early web services offered APIs based on SOAP, but, as more and more APIs started being offered in the mid-2000s, software developers burned by SOAP’s complexity migrated away en masse. + +Among this crowd, SOAP inspired contempt. Ruby-on-Rails dropped SOAP support in 2007, leading to this emblematic comment from Rails creator David Heinemeier Hansson: “We feel that SOAP is overly complicated. It’s been taken over by the enterprise people, and when that happens, usually nothing good comes of it.”[7][10] The “enterprise people” wanted everything to be formally specified, but the get-shit-done crowd saw that as a waste of time. + +If the get-shit-done crowd wasn’t going to use SOAP, they still needed some standard way of doing things. Since everyone was using HTTP, and since everyone would keep using HTTP at least as a transport layer because of all the proxying and caching support, the simplest possible thing to do was just rely on HTTP’s existing semantics. So that’s what they did. They could have called their approach Fuck It, Overload HTTP (FIOH), and that would have been an accurate name, as anyone who has ever tried to decide what HTTP status code to return for a business logic error can attest. But that would have seemed recklessly blasé next to all the formal specification work that went into SOAP. + +Luckily, there was this dissertation out there, written by a co-author of the HTTP/1.1 specification, that had something vaguely to do with extending HTTP and could offer FIOH a veneer of academic respectability. So REST was appropriated to give cover for what was really just FIOH. + +I’m not saying that this is exactly how things happened, or that there was an actual conspiracy among irreverent startup types to misappropriate REST, but this story helps me understand how REST became a model for web service APIs when Fielding’s dissertation isn’t about web service APIs at all. Adopting REST’s constraints makes some sense, especially for public-facing APIs that do cross organizational boundaries and thus benefit from REST’s “uniform interface.” That link must have been the kernel of why REST first got mentioned in connection with building APIs on the web. But imagining a separate approach called “FIOH,” that borrowed the “REST” name partly just for marketing reasons, helps me account for the many disparities between what today we know as RESTful APIs and the REST architectural style that Fielding originally described. + +REST purists often complain, for example, that so-called REST APIs aren’t actually REST APIs because they do not use Hypermedia as The Engine of Application State (HATEOAS). Fielding himself [has made this criticism][11]. According to him, a real REST API is supposed to allow you to navigate all its endpoints from a base endpoint by following links. If you think that people are actually out there trying to build REST APIs, then this is a glaring omission—HATEOAS really is fundamental to Fielding’s original conception of REST, especially considering that the “state transfer” in “Representational State Transfer” refers to navigating a state machine using hyperlinks between resources (and not, as many people seem to believe, to transferring resource state over the wire).[8][12] But if you imagine that everyone is just building FIOH APIs and advertising them, with a nudge and a wink, as REST APIs, or slightly more honestly as “RESTful” APIs, then of course HATEOAS is unimportant. + +Similarly, you might be surprised to know that there is nothing in Fielding’s dissertation about which HTTP verb should map to which CRUD action, even though software developers like to argue endlessly about whether using PUT or PATCH to update a resource is more RESTful. Having a standard mapping of HTTP verbs to CRUD actions is a useful thing, but this standard mapping is part of FIOH and not part of REST. + +This is why, rather than saying that nobody understands REST, we should just think of the term “REST” as having been misappropriated. The modern notion of a REST API has historical links to Fielding’s REST architecture, but really the two things are separate. The historical link is good to keep in mind as a guide for when to build a RESTful API. Does your API cross organizational and national boundaries the same way that HTTP needs to? Then building a RESTful API with a predictable, uniform interface might be the right approach. If not, it’s good to remember that Fielding favored having form follow function. Maybe something like GraphQL or even just JSON-RPC would be a better fit for what you are trying to accomplish. + +_If you enjoyed this post, more like it come out every four weeks! Follow [@TwoBitHistory][13] on Twitter or subscribe to the [RSS feed][14] to make sure you know when a new post is out._ + +_Previously on TwoBitHistory…_ + +> New post is up! I wrote about how to solve differential equations using an analog computer from the '30s mostly made out of gears. As a bonus there's even some stuff in here about how to aim very large artillery pieces. +> +> — TwoBitHistory (@TwoBitHistory) [April 6, 2020][15] + + 1. Roy Fielding. “Architectural Styles and the Design of Network-based Software Architectures,” 128. 2000. University of California, Irvine, PhD Dissertation, accessed June 28, 2020, . [↩︎][16] + + 2. Fielding, 130. [↩︎][17] + + 3. Fielding distinguishes between software architectures and software architecture “styles.” REST is an architectural style that has an instantiation in the architecture of HTTP. [↩︎][18] + + 4. Fielding, 2. [↩︎][19] + + 5. Fielding, 15. [↩︎][20] + + 6. Fielding, 82. [↩︎][21] + + 7. Paul Krill. “Ruby on Rails 2.0 released for Web Apps,” InfoWorld. Dec 7, 2007, accessed June 28, 2020,  [↩︎][22] + + 8. Fielding, 109. [↩︎][23] + + + + +-------------------------------------------------------------------------------- + +via: https://twobithistory.org/2020/06/28/rest.html + +作者:[Two-Bit History][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://twobithistory.org +[b]: https://github.com/lujun9972 +[1]: https://news.ycombinator.com/item?id=7201871 +[2]: https://www.ics.uci.edu/~fielding/pubs/dissertation/fielding_dissertation_2up.pdf +[3]: tmp.o6JUcKs91D#fn:1 +[4]: tmp.o6JUcKs91D#fn:2 +[5]: tmp.o6JUcKs91D#fn:3 +[6]: tmp.o6JUcKs91D#fn:4 +[7]: tmp.o6JUcKs91D#fn:5 +[8]: tmp.o6JUcKs91D#fn:6 +[9]: https://www.youtube.com/watch?v=vNoPJqm3DAY +[10]: tmp.o6JUcKs91D#fn:7 +[11]: https://roy.gbiv.com/untangled/2008/rest-apis-must-be-hypertext-driven +[12]: tmp.o6JUcKs91D#fn:8 +[13]: https://twitter.com/TwoBitHistory +[14]: https://twobithistory.org/feed.xml +[15]: https://twitter.com/TwoBitHistory/status/1247187881946275841?ref_src=twsrc%5Etfw +[16]: tmp.o6JUcKs91D#fnref:1 +[17]: tmp.o6JUcKs91D#fnref:2 +[18]: tmp.o6JUcKs91D#fnref:3 +[19]: tmp.o6JUcKs91D#fnref:4 +[20]: tmp.o6JUcKs91D#fnref:5 +[21]: tmp.o6JUcKs91D#fnref:6 +[22]: tmp.o6JUcKs91D#fnref:7 +[23]: tmp.o6JUcKs91D#fnref:8 diff --git a/sources/talk/20200629 NIST aims to make frequency sharing more efficient for wireless networks.md b/sources/talk/20200629 NIST aims to make frequency sharing more efficient for wireless networks.md new file mode 100644 index 0000000000..2b703e5ac5 --- /dev/null +++ b/sources/talk/20200629 NIST aims to make frequency sharing more efficient for wireless networks.md @@ -0,0 +1,66 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (NIST aims to make frequency sharing more efficient for wireless networks) +[#]: via: (https://www.networkworld.com/article/3561618/nist-aims-to-make-frequency-sharing-more-efficient-for-wireless-networks.html) +[#]: author: (Patrick Nelson https://www.networkworld.com/author/Patrick-Nelson/) + +NIST aims to make frequency sharing more efficient for wireless networks +====== +Machine-learning formula will help different radio protocols, such as Wi-Fi and LTE, work together more efficiently in the same wireless spectrum. +Martyn Williams/IDG + +A machine-learning formula developed by the National Institute of Standards and Technology ([NIST][1]) has the potential to significantly improve how [5G][2] and other wireless networks select and share communications frequencies. Compared to trial-and-error methods, NIST's formula could make the process of sharing communications frequencies as much as 5,000 times more efficient, researchers claim. + +The NIST system is based the idea that radio equipment can learn its network environments from experience rather than, as is done now, simply select frequency channels based on trial-and-error. + +"The algorithm learns which channel provides the best outcome" under specific environmental conditions, NIST says in an [article on its website][3]. + +**READ MORE:** [How beamforming makes wireless communication faster][4] + +"The formula could be programmed into software on transmitters in many [different] types of real-world networks," the team says. + +Essentially, the computer-modeled algorithm is a formula that maps prior experience in environmental RF conditions. Those conditions can include the number of transmitters operating within a channel (set of adjacent frequencies), for example. + +"… if a transmitter selects a channel that is not occupied, then the probability of a successful transmission rises, leading to a higher data rate," the article says. Likewise, when a transmitter selects a channel that doesn't have much interference on it, the signal is stronger, and you get a better data rate. The transmitter remembers which channel provides the best outcome and learns to choose that spot on the dial when it next needs a clear signal. + +That's different from the way things generally work today. That is, a radio simply tries to find an open frequency and then communicates with like-protocol radios. In sophisticated cases, like Wi-Fi, for example, frequency hopping and [beamforming][4] are used to optimize channels. + +Where NIST's machine-learning technique shines is in the case of shared spectrum, such as sharing Wi-Fi with License Assisted Access (LAA), the researchers explain. LAA is LTE in unlicensed spectrum, known as LTE-U, at 5 GHz. In that combination of Wi-Fi with LAA, on the same frequencies, the protocols are disparate: the radios don't communicate with each other to function in harmony, and chaos could occur the busier the band got—transmissions would bump into other transmissions. But, if all the radios were better at choosing their slot, by learning what works and what doesn't, then things would be better. + +"This could potentially make communications in the unlicensed bands much more efficient," says Jason Coder, a NIST engineer, in the article. + +Indeed, it "could help 5G and other wireless networks select and share communications frequencies about 5,000 times more efficiently than trial-and-error methods," NIST claims. + +The key word here is "share," because in order to increase communications in limited spectrum, more sharing must take place—the users, such as IoT, or media streaming, are all competing for the same metaphorical real estate. Combining unlicensed and licensed bands, as is the case in LAA, will likely become more common as IoT and digital continues to expand. (Unlicensed bands are those not assigned to a specific user, like a mobile network operator; licensed bands are won in auctions and allocated.) + +In the NIST scenario, the competing transmitters "each learn to maximize the total network data rate without communicating with each other." Therefore, multiple protocols and data types, like video or sensor data, or Wi-Fi and mobile networks, can function alongside each other. + +NIST's formula significantly simplifies the process of assigning optimum channels to transmitters, according to the article: "The study found that an exhaustive effort [using trial and error] to identify the best solution would require about 45,600 trials, whereas the formula could select a similar solution by trying only 10 channels, just 0.02 percent of the effort." + +The NIST researchers recently presented their research at [IEEE's 91st Vehicular Technology Conference][5], held virtually this year. + +Join the Network World communities on [Facebook][6] and [LinkedIn][7] to comment on topics that are top of mind. + +-------------------------------------------------------------------------------- + +via: https://www.networkworld.com/article/3561618/nist-aims-to-make-frequency-sharing-more-efficient-for-wireless-networks.html + +作者:[Patrick Nelson][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.networkworld.com/author/Patrick-Nelson/ +[b]: https://github.com/lujun9972 +[1]: https://www.nist.gov/ +[2]: https://www.networkworld.com/article/3330603/5g-versus-4g-how-speed-latency-and-application-support-differ.html +[3]: https://www.nist.gov/news-events/news/2020/05/nist-formula-may-help-5g-wireless-networks-efficiently-share-communications +[4]: https://www.networkworld.com/article/3445039/beamforming-explained-how-it-makes-wireless-communication-faster.html +[5]: https://events.vtsociety.org/vtc2020-spring/conference-sessions/program/ +[6]: https://www.facebook.com/NetworkWorld/ +[7]: https://www.linkedin.com/company/network-world diff --git a/sources/talk/20200630 Should API-restricting licenses qualify as open source.md b/sources/talk/20200630 Should API-restricting licenses qualify as open source.md new file mode 100644 index 0000000000..54b18eaed6 --- /dev/null +++ b/sources/talk/20200630 Should API-restricting licenses qualify as open source.md @@ -0,0 +1,79 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Should API-restricting licenses qualify as open source?) +[#]: via: (https://opensource.com/article/20/6/api-copyright) +[#]: author: (Richard Fontana https://opensource.com/users/fontana) + +Should API-restricting licenses qualify as open source? +====== +A look at how a closely-watched legal case about copyright and APIs +might affect open source licensing +![Two government buildings][1] + +In its 2014 _[Oracle v. Google][2]_ decision, the United States Court of Appeals for the Federal Circuit held that the method declarations and "structure, sequence, and organization" (SSO) of the Java SE API were protected by copyright. This much-criticized result contradicted a decades-old industry and professional consensus assumption that APIs were in the public domain, reflected in an ongoing common practice of successive reimplementation of APIs, and persisting even after the general copyrightability of software was settled by statute. Unsurprisingly, that consensus shaped the view of APIs from within open source. Open source licenses, in particular, do not address APIs, and their conditions have not customarily been understood to apply to APIs. + +If the copyrightability ruling survives its current [review][3] by the United States Supreme Court, there is reason to worry that _Oracle v. Google_ will eventually have some detrimental impact on open source licensing. License authors might draft new licenses that would explicitly extend familiar kinds of open source license conditions to activities merely involving APIs. There could also be comparable efforts to advance _Oracle v. Google_-influenced reinterpretations of existing open source licenses. + +We've already seen an example of a new open source-like license that restricts APIs. Last year, Holochain, through its lawyer [Van Lindberg][4], submitted the [Cryptographic Autonomy License][5] (CAL) for approval by the Open Source Initiative (OSI). The [1.0-Beta][6] draft included source availability and licensing requirements placed on works merely containing or derivative of interfaces included in or derived from the licensed work. (CAL 1.0-Beta was [rejected][7] by the OSI for reasons other than the interface copyleft feature. Subsequent revisions of CAL removed explicit references to interfaces, and the OSI approved CAL 1.0 earlier this year.) Licenses like CAL 1.0-Beta would extend copyleft to reimplementations of APIs having no code in common with the original. Though less likely, new permissive licenses might similarly extend notice preservation requirements to mere copies of APIs. + +In my view, API-restricting licenses, though otherwise FOSS-like, would not qualify for the open source label. To simplify what is actually a complicated and contentious issue, let's accept the view that the license approval decisions of the OSI, interpreting the [Open Source Definition][8] (OSD), are the authoritative basis for determining whether a license is open source. The OSD makes no mention of software interfaces. Some advocates of a relaxation of standards for approving open source licenses have argued that if a type of restriction is not explicitly prohibited by the OSD, it should be considered acceptable in an open source license. To guard against this tactic, which amounts to ["gaming" the OSD][9], the OSI [clarified][10] in 2019 that the purpose of the approval process is to ensure that approved licenses not only conform to the OSD but also provide software freedom. + +Though [Luis Villa has raised concerns][11] that it gives rise to a "[no true Scotsman][12]" problem, I believe the emphasis on software freedom as a grounding principle will enable the OSI to deal effectively and in a well-reasoned, predictable way with cases where license submissions expose unforeseen gaps or vagueness in the OSD, which is politically difficult for the OSI to revise. (Disclosure: I was on the OSI board when this change to the license review process was made.) It is also an honest acknowledgment that the OSD, like the [Free Software Definition][13] maintained by the Free Software Foundation, is an unavoidably imperfect and incomplete attempt to distill the underlying community norms and expectations surrounding what FOSS is. + +Software freedom is the outgrowth of a long-lived culture. Judging whether a license that extends FOSS-normative conditions to APIs provides software freedom should begin with an examination of tradition. This leads to a straightforward conclusion. As noted above, from nearly the earliest days of programming and continuing without interruption through the rise of the modern open source commons, software developers have shared and acted on a belief in an unconditional right to reimplement software interfaces. From a historical perspective, it is difficult to think of anything as core to software freedom as this right to reimplement. + +The inquiry cannot be entirely backward-looking, however, since the understanding of software freedom necessarily changes in response to new societal or technological developments. It is worth asking whether a departure from the traditional expectation of unrestricted APIs would advance the broader goals of open source licensing. At first glance, this might seem to be true for copyleft licensing, since, in theory, compliant adoption of API copyleft licenses could expand the open source software commons. But expanding the scope of copyleft to API reimplementations—software traditionally seen as unrelated to the original work—would violate another open source norm, the limited reach of open source licenses, which is partially captured in [OSD 9][14]. + +Another observation is that software freedom is endangered by licensing arrangements that are excessively complex and unpredictable and that make compliance too difficult. This would likely be true of API-restricting FOSS-like licenses, especially on the copyleft side. For example, copyleft licenses typically place conditions on the grant of permission to prepare derivative works. Trying to figure out what is a derivative work of a Java method declaration, or the SSO of a set of APIs, could become a compliance nightmare. Would it include reimplementations of APIs? Code merely invoking APIs? The fundamental vagueness of _Oracle v. Google_-style API copyright bears some resemblance to certain kinds of software patent claims. It is not difficult to imagine acquirers of copyrights covered by API-restrictive licenses adopting the litigation strategies of patent trolls. In addition to this risk, accepting API-restrictive licenses as open source would further legitimize API copyrightability in jurisdictions like the United States, where the legal issue is currently unsettled. + +_Oracle v. Google_-influenced interpretations of existing open source licenses would similarly extend familiar open source license conditions to activities merely involving APIs. Such reinterpretations would transform these licenses into ones that fail to provide software freedom and advance the goals of open source, for the same reasons that apply to the new license case. In addition, they would upend the intentions and expectations of the authors of those licenses, as well as nearly all of their licensors and licensees. + +It might be argued that because open source licenses are principally ([though not exclusively][15]) copyright licenses, it is necessary, if not beneficial, for their conditions to closely track the expansion of copyright to APIs. This is not so for new open source licenses, which can be drafted explicitly to nullify the impact of _Oracle v. Google_. As for reinterpretations of existing open source licenses, while the issue of API copyrightability remains unsettled, it would not be appropriate to abandon traditional interpretations in favor of anticipating what an _Oracle v. Google_-influenced court, unfamiliar with open source culture, would decide. Litigation over open source licenses continues to be uncommon, and influential open source license interpretations have emerged in the technical community with little regard to how courts might act. In any event, courts engaged in interpreting commonly-used open source licenses may well be persuaded to treat APIs as unconstrained. + +Some have suggested that interpretation of the GPL should take full advantage of the scope of underlying copyright rights. This is related to a view of copyleft as a "[hack on copyright][16]" or a "[judo move][17]" that "[return[s] the violent force of the oppressor against the oppressor itself][18]." It can be detected in the [copyleft tutorial][19] sponsored by the Software Freedom Conservancy and the FSF, which [says][20]: "The strongest copylefts strive to [use] the exclusive rights that copyright grants to authors as extensively as possible to maximize software freedom." It might seem logical for someone with this perspective to specifically promote an API copyright interpretation of the GPL. But I know of no advocate of strong copyleft who has done so, and the text and interpretive history of the GPL do not support such a reading. + +A somewhat different view of API copyright and GPL interpretation, occasionally voiced, is that _Oracle v. Google_ may put the doctrine of strong copyleft on a surer legal foundation. Similarly, it has sometimes been asserted that strong copyleft rested on some notion of API copyrightability all along, which suggests that _Oracle v. Google_ provides some retroactive legal legitimacy. The latter view is not held by the FSF, which in an earlier era had [opposed the expansion of copyright][21] to user interfaces. This stance made its way into GPLv2, which has a [largely overlooked provision][22] authorizing the original licensor to exclude countries that would restrict "distribution and/or use … either by patents or by copyrighted interfaces." The FSF also [severely criticized][23] Oracle's claim of copyright ownership of Java APIs. And the FSF has never questioned the right to reimplement APIs of GPL-licensed software under non-GPL licenses (as has happened, for example, with the FSF-copyrighted [GNU Readline][24] and the BSD-licensed [libedit][25]). If there were shown to be some legal deficiency in strong copyleft theory that API copyrightability could somehow fix, I believe it would be better either to live with a weaker understanding of GPL copyleft or to pursue revisions to the GPL that would reformulate strong copyleft without relying on API copyright. + +If API copyrightability survives Supreme Court review, it would then be appropriate for license stewards, licensors of existing open source licenses, and drafters of new open source licenses to take constructive steps to minimize the impact on open source. Stewards of widely used open source licenses, where they exist, could publish interpretive guidance clarifying that APIs are not restricted by the license. Updates to existing open source licenses and entirely new licenses could make unrestricted APIs an explicit policy. Licensors of existing open source licenses could make clear, in standardized license notices or through external commitments, that they will not treat open source license conditions as imposing any restriction on activities merely involving APIs. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/6/api-copyright + +作者:[Richard Fontana][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/fontana +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/LAW_lawdotgov2.png?itok=n36__lZj (Two government buildings) +[2]: http://www.cafc.uscourts.gov/sites/default/files/opinions-orders/13-1021.Opinion.5-7-2014.1.PDF +[3]: https://www.scotusblog.com/case-files/cases/google-llc-v-oracle-america-inc/ +[4]: https://twitter.com/vanl?lang=en +[5]: https://github.com/holochain/cryptographic-autonomy-license +[6]: http://lists.opensource.org/pipermail/license-review_lists.opensource.org/2019-April/004028.html +[7]: http://lists.opensource.org/pipermail/license-review_lists.opensource.org/2019-June/004248.html +[8]: https://opensource.org/osd +[9]: https://twitter.com/webmink/status/1121873263125118977?s=20 +[10]: https://opensource.org/approval +[11]: https://twitter.com/luis_in_brief/status/1143884765654687744 +[12]: https://en.wikipedia.org/wiki/No_true_Scotsman +[13]: https://www.gnu.org/philosophy/free-sw.en.html +[14]: https://opensource.org/osd#not-restrict-other-software +[15]: https://opensource.com/article/18/3/patent-grant-mit-license +[16]: https://sfconservancy.org/blog/2012/feb/01/gpl-enforcement/ +[17]: https://gondwanaland.com/mlog/2014/12/01/copyleft-org/#gpl-and-cc-by-sa-differences +[18]: https://dustycloud.org/blog/field-guide-to-copyleft/#sec-2-2 +[19]: https://copyleft.org/guide/ +[20]: https://copyleft.org/guide/comprehensive-gpl-guidech2.html#x5-120001.2.2 +[21]: https://www.gnu.org/bulletins/bull21.html +[22]: https://www.gnu.org/licenses/old-licenses/gpl-2.0.en.html#section8 +[23]: https://www.fsf.org/blogs/licensing/fsf-statement-on-court-of-appeals-ruling-in-oracle-v-google +[24]: https://tiswww.case.edu/php/chet/readline/rltop.html +[25]: http://cvsweb.netbsd.org/bsdweb.cgi/src/lib/libedit/ diff --git a/sources/talk/20200630 The open organization everyone deserves.md b/sources/talk/20200630 The open organization everyone deserves.md new file mode 100644 index 0000000000..8fa93e6ec3 --- /dev/null +++ b/sources/talk/20200630 The open organization everyone deserves.md @@ -0,0 +1,70 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (The open organization everyone deserves) +[#]: via: (https://opensource.com/open-organization/20/6/organization-everyone-deserves) +[#]: author: (Jos Groen https://opensource.com/users/jos-groen) + +The open organization everyone deserves +====== +Want to build a sustainably successful organization? Then openness is +the way. +![Two different business organization charts][1] + +Let me share an email I recently received. It meant the world to me: + +> Hi Jos, just a quick message to thank you for the past six months. I really appreciate how I've been welcomed into the company and I feel like I've genuinely found my place here. There's a great vibe among the entire staff of working hard, lots of learning, having fun, and personal responsibility. Although everyone contributes to this atmosphere, it could only have come about with the support of management. So I just want to thank you for creating such an enjoyable work environment! + +A work environment that encourages the collaborative utilization of everyone's combined skillset, one in which contributors are intrinsically motivated to do their best work, is something I would wish for everyone. That's why, over the past year especially, I've been cultivating an open organizational culture on my team and across my organization, Axians. Openness is the future, and it begins with individuals. In this article, I'll explain the mindset shifts I believe any _individual_ leader must make in order to pave the way for an organizational culture of openness. + +### The technological is social + +Social and technological changes are occurring faster than ever. These often seem like two separate movements—but are they really? The effect of the open source movement on the development of both innovative technologies and organizational cultures is many times greater than we may think. The open source community (as the name suggests) is shouldered by people—people who apply their skills to make the world a little better through new technologies, who realize the value of sharing both knowledge and material goods in both their work as well as their personal lives. + +This means that in order to get the most out of new technologies, you need to have an open organizational culture in which employees contribute from [a place of intrinsic motivation][2]. The current generation of tech employees isn't drawn to organizations with a strong hierarchical culture. They're looking for _open_ organizations that encourage and inspire them to excel every single day. They're looking for the kind of leadership that leaves ample room for individual input and ownership. A successful and future-proof organization demands an open culture and open leadership. + +At its core, a sustainably successful organization revolves around a balance between a focus on people and a focus on the business. In my experience, for the majority of organizations, this balance leans too heavily towards the business. There is an urgent need for a greater focus on people. The open organization is the answer to restoring this balance. That's why establishing and leading an open organization should be the [ultimate goal for contemporary managers][3]. But doing this requires leaders capable of restoring the balance [between business and the humans that work in it][4]—and maintaining that balance. + +A work environment that encourages the collaborative utilization of everyone's combined skillset, one in which contributors are intrinsically motivated to do their best work, is something I would wish for everyone. + +At the same time, a successful organization today is one that enables intelligent collaboration and effective coordination. This will increase the collective intelligence and offer employees the space they need to develop and grow. Unlocking and utilizing the available potential helps shape the kind of organization in which everyone participates and contributes, and this can produce some truly remarkable results. It’s no small task for a leader to establish and lead an organization of this kind. + +### Authentic leadership + +The human dimension present in an organization will in part determine the employers people choose to join, making it vital for managers to establish and lead an open organization. Part of openness is to be clear and honest about your intentions at all times. + +This isn't just a gimmick, nor is it a skill you can easily "acquire." When you're working with people, they will immediately sense if your intentions aren't genuine. Because this process takes place on a subconscious level, it is unlikely people will articulate this feeling. Instead, it'll be reflected in their behavior: you might find people less involved and not opening up to you. In turn, you could experience their behavioras frustrating, even opposition. Sound familiar? + +This is all about your credibility, which takes time to build. You'll be challenged, either consciously or subconsciously, to stick with your intentions. Be prepared to have to overcome mistrust and cynicism at times. + +Are you up for that? Are you willing to examine the cause, to really invest your time and energy in trying to understand the other person? And will you stick to your principles? + +### What about you? + +An open organization is about placing your trust in people and creating a culture of equality. At the end of the day, it's not about you; it's about the collective. _Everyone_ is involved. _Everyone_ gets to make mistakes or ask for help. Even you. As long as you can be open and honest about it. + +So have you put "openness" on the agenda? And what about your organization? Is your management ready to open up—or are they clinging to "command and control"? + +I hope you'll [join me][5] as I explore these issues further [in an upcoming webinar][6]. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/open-organization/20/6/organization-everyone-deserves + +作者:[Jos Groen][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/jos-groen +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/BUSINESS_crowdvsopen.png?itok=AFjno_8v (Two different business organization charts) +[2]: https://opensource.com/open-organization/18/5/rethink-motivation-engagement +[3]: https://opensource.com/open-organization/20/6/open-management-practices +[4]: https://opensource.com/open-organization/17/7/digital-transformation-people-1 +[5]: https://www.linkedin.com/in/josgroen/ +[6]: https://www.redhat.com/en/events/webinar/how-to-drive-the-transformation-journey-through-an-open-organization-approach-2020 diff --git a/sources/talk/20200702 How an open project-s governance model evolves.md b/sources/talk/20200702 How an open project-s governance model evolves.md new file mode 100644 index 0000000000..4ca74dd3b1 --- /dev/null +++ b/sources/talk/20200702 How an open project-s governance model evolves.md @@ -0,0 +1,97 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How an open project's governance model evolves) +[#]: via: (https://opensource.com/open-organization/20/7/evolving-project-governance) +[#]: author: (Bryan Behrenshausen https://opensource.com/users/bbehrens) + +How an open project's governance model evolves +====== +As open projects mature, their governance models inevitably change. +Here's how we're evolving ours. +![A two way street sign][1] + +As we continue renovating the Open Organization community, we've been asking hard questions about how we want [that community][2] to function. What do we expect of one another, and of the new contributors yet to join us? How will we work best together? And how will we keep one another accountable for achieving our shared goals? + +When open projects and communities discuss expectations like these, they're talking about "governance." In this case, "governance" refers to the [various processes by which rights and responsibilities get distributed][3] throughout a group. As community member [Jen Kelchner puts it][4], "it's the framework that creates the structure of the organizational system and the rules by which the parts of that structure can and do interact with one another." + +A community's governance model explains _how_ that community functions. Maintaining a system of governance often helps a community _define_ and _describe_ the roles people play in that community. + +Those shared definitions and descriptions are important. First, they allow community members to speak a common language about values and ambitions. They also advance community members' ability to contribute, because [they _make explicit_ the rules][5] everyone is playing by. And they ensure community members receive the various types of status and social capital they need and deserve. + +The best governance models are flexible and adaptable. They grow with their communities. As the Open Organization community grows, so does its governance model. We've needed to revisit how we describe our community and the opportunities for contribution it affords people. ([We also fix typos][6].) + +Let us describe what we're doing. + +### New commitments + +Through this conversation, we've been able to update the Open Organization [project][7] description and vision. + +That vision initially took shape nearly five years ago, when the Open Organization Ambassador team first formed. At the time, Red Hat community architects [Jason Hibbets][8] and [Bryan Behrenshausen][9] drafted a document describing what a community of passionate advocates for [open organizational principles][10] _might_ look like. The vision was entirely aspirational, describing what could be—rather than what _was_. It served as a beacon to attract passionate contributors to a still-nascent project. + +As soon as the community _did_ attract new members, however, those members promptly wrote their _own_ mission and vision for the Open Organization project, articulating their identity and purpose. And as we've grown, we've realized that we're all committed to even more than we originally described. Our community is adept at translating [open organization principles][10] for various audiences and contexts, and at helping different communities connect to our language and culture through _their_ own languages and cultures. + +The best governance models are flexible and adaptable. They grow with their communities. + +For example, [Laura Hilliger][11] has long seen an overlap between openness and cooperatives ([as have others in the community][12]). She's spoken about that overlap and lived it through her career—serving as a translator between two "radical" economic and communal ideas that use different terminology but are seeking the same kind of fair-mindedness in their activities and collaborations. Other Open Org community members have written about [Agile methodologies][13] and their association with open principles, open principles at work [in educational organizations][14], and more. + +Our commitment to this sort of "translation work" wasn't highlighted in our working project description, so we [updated the description to include it][15]. + +### Role playing + +Another hole we wanted to fill was a better description of the types of contributions one can make to this community. We wanted to talk about our contributors in a slightly more nuanced way, which we indicated in the initial project vision and then extrapolated into a fully fledged "[Community Roles][16]" wiki page. + +Being specific about community roles helps us make the project more inclusive. It also gives us a method to _codify_ policies and procedures because we can associate them with individual roles people can play in the Open Org community. + +So we've made some decisions about how contributors get read/write [access to community repositories][17], and how certain kinds of contributors can nominate people to "level up" in the community. + +Just as people join communities, they also leave. Everyone's interests and passions change over time, and sometimes what brought them to your community is no longer meaningful to them. And that's okay. + +We've also established a new kind of contributor, the "Maintainer," which gives Ambassadors expressing interest in leading and maintaining community-driven projects a way to show ownership and initiative around a particular project the community is working on. In short: It opens an important new contribution pathway and helps existing community members play an even more influential role in the Open Organization project. + +And we're also recognizing the regular flux and flow that marks an open community like ours. Just as people join communities, they also leave. Everyone's interests and passions change over time, and sometimes what brought them to your community is no longer meaningful to them. And that's okay. + +Sometimes, people will stay involved in a community because they feel a sense of belonging or status, even if they're not interested in doing the work anymore. And they carry with them important project history and context, which no one wants to see evaporate. So we're also adding another community role, the Open Organization Ambassador Emeritus. By giving community members emeritus status, we give Ambassadors the freedom to move on to something else without "kicking them out" of the project altogether. + +All in all, defining and documenting roles and responsibilities will help our community attract contribution because it clearly explains _what getting involved means_ and the _benefits of doing so_. + +### Next steps + +We've come a long way. But there's more to be done. + +The next bit of work we'd like to tackle is [developing a code of conduct][18]. Want to share your experience in this area? [Why not join us and help out?][19] + +-------------------------------------------------------------------------------- + +via: https://opensource.com/open-organization/20/7/evolving-project-governance + +作者:[Bryan Behrenshausen][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/bbehrens +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/govt_two%20way.png?itok=8dlG2Dpl (A two way street sign) +[2]: http://theopenorganization.org +[3]: https://opensource.com/article/20/5/open-source-governance +[4]: https://opensource.com/open-organization/17/2/5-elements-teams-organized +[5]: https://opensource.com/open-organization/18/4/new-governance-model-research +[6]: https://github.com/open-organization/governance/commits/master +[7]: https://github.com/open-organization/governance/blob/master/project-and-community-description.md +[8]: https://opensource.com/users/jhibbets +[9]: https://opensource.com/users/bbehrens +[10]: https://github.com/open-organization/open-org-definition +[11]: https://opensource.com/users/laurahilliger +[12]: https://opensource.com/open-organization/15/9/learn-from-co-ops +[13]: https://opensource.com/open-organization/17/11/transparency-collaboration-basefarm +[14]: https://opensource.com/open-organization/19/4/education-culture-agile +[15]: https://github.com/open-organization/governance/wiki +[16]: https://github.com/open-organization/governance/wiki/Community-Roles +[17]: https://github.com/open-organization +[18]: https://opensource.com/life/14/5/codes-of-conduct-open-source-communities +[19]: https://github.com/open-organization/governance/issues/9 diff --git a/sources/talk/20200708 How wireless networks can battle COVID-19.md b/sources/talk/20200708 How wireless networks can battle COVID-19.md new file mode 100644 index 0000000000..3c3276c55a --- /dev/null +++ b/sources/talk/20200708 How wireless networks can battle COVID-19.md @@ -0,0 +1,52 @@ +[#]: collector: (lujun9972) +[#]: translator: (sunwenquan ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How wireless networks can battle COVID-19) +[#]: via: (https://www.networkworld.com/article/3565389/how-wireless-networks-can-battle-covid-19.html) +[#]: author: (Patrick Nelson https://www.networkworld.com/author/Patrick-Nelson/) + +How wireless networks can battle COVID-19 +====== +Wireless network devices maintain a connection by handing off from one cell tower to another. The data created should be used to fight coronavirus, say researchers. +Sasha85ru / Getty Images + +Routinely collected cellphone-location data could be used to alert health official about crowded areas where novel coronavirus could spread rapidly, which they could then use to disperse people in order to lower the risk, according to researchers at Colorado State University. + +Mobile phones maintain connections as their users move around by continually handing off from one cell tower to another. Analyzing logs of these handoffs is a way to gauge how many people are in an area, the researchers say, and that information could flag potential virus-spreading hotspots. “Crowded regions with actively moving people are susceptible to spreading the disease,” the team say in [an abstract of their paper][1] in _IEEE Open Journal of Engineering in Medicine and Biology_. + +[[Get regularly scheduled insights by signing up for Network World newsletters.]][2] + +“Our findings could help risk managers with planning and mitigation,” says Edwin Chong, Professor of Electrical and Computer Engineering and interim department head at the school [in an article on the university’s website][3]. + +The data that would be used doesn’t identify individuals who own the phones, which should alleviate privacy concerns, he says. “All we have to do is perform the measurements using anonymous data that is already being collected for other reasons. We are not tracking individuals,” he says + +Cellphone applications that have been developed to trace near encounters between individuals are different. They necessarily gather personal information so health officials can determine who might have come in proximity with an infected person. The goal is to alert those who have had such encounters so they can quarantine themselves for 14 days to prevent them from potentially spreading the virus further. But that is quite different from the information gathered by cell-tower engineering logs. + +As mobile phones move from one cell to another, a process called handover and reselection keeps the phones constantly connected to the network. The logs of this activity reveal the volume of this activity and tracks the status of phones such as non-active standby, engaged in active calls or whether it’s making data connections. + +The size of cells varies with those in densely populated areas being smaller and therefore able to deliver more granular data about where people are closer together. Indeed, future 5G deployments may have cell antennas in every municipal streetlight, making it possible to make very specific density estimates. + +  + +Join the Network World communities on [Facebook][4] and [LinkedIn][5] to comment on topics that are top of mind. + +-------------------------------------------------------------------------------- + +via: https://www.networkworld.com/article/3565389/how-wireless-networks-can-battle-covid-19.html + +作者:[Patrick Nelson][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.networkworld.com/author/Patrick-Nelson/ +[b]: https://github.com/lujun9972 +[1]: https://ieeexplore.ieee.org/document/9117073 +[2]: https://www.networkworld.com/newsletters/signup.html +[3]: https://engr.source.colostate.edu/using-cellular-networks-to-detect-at-risk-areas-for-spread-of-covid-19/ +[4]: https://www.facebook.com/NetworkWorld/ +[5]: https://www.linkedin.com/company/network-world diff --git a/sources/talk/20200715 The Impact of COVID-19 on the Global Digital Economy.md b/sources/talk/20200715 The Impact of COVID-19 on the Global Digital Economy.md new file mode 100644 index 0000000000..6d5f05b3ce --- /dev/null +++ b/sources/talk/20200715 The Impact of COVID-19 on the Global Digital Economy.md @@ -0,0 +1,79 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (The Impact of COVID-19 on the Global Digital Economy) +[#]: via: (https://www.networkworld.com/article/3566911/the-impact-of-covid-19-on-the-global-digital-economy.html) +[#]: author: (QTS https://www.networkworld.com/author/Andy-Patrizio/) + +The Impact of COVID-19 on the Global Digital Economy +====== +Post-Pandemic IT Landscape Demands a New Data Center Paradigm +QTS + +Prior to COVID-19, the world was undergoing massive business transformation illustrated by stunning success of mega-scale Internet businesses such as Amazon Prime, Twitter, Uber, Netflix, Xbox and others that are now an integral part of our lives and exemplify the new global digital economy. + +The ability to apply artificial intelligence (AL), machine learning (ML), speech recognition, location services, speed and identity tracking in real-time enabled new applications and services once thought to be beyond the reach of computing technology. + +Fueling this transformation are exponential increases in digitized data and the ability to apply enormous compute and storage capacity to it. Since 2016, digitization has created 90% of the world’s data. According to IDC, more than 59 zettabytes (ZB) of data are going to be created and consumed globally in 2020 and this is forecast to grow to 175 ZB by 2025. How much is 1 ZB you ask?  It is equivalent to a _trillion gigabytes. Or, 100 million HD movies worth of data._ + +As it turns out, according to IDC, instead of hindering growth, COVID-19 is accelerating data growth, particularly in 2020 and 2021, due to abrupt increases in work from home employees, a changing mix of richer data sets, and a surge in video-based content consumption. + +For the enterprise, an unforeseen byproduct is an even greater urgency for agility, adaptability and transformation. Business models are being disrupted while the digitalization of the economy is accelerating as new technologies and services serve a reshaped workforce. + +The competitive landscape across all market sectors is changing. Now more than ever business is looking to technology to be agile in the face of disruption and create new digitally enabled business models for the post-COVID “new normal.” + +That will require new capabilities and expertise in thousands of data centers and networks behind the scenes. That infrastructure provides the digital infrastructure that powers the critical applications and services keeping the economy afloat -- and all of us connected. The “cloud” lives in data centers and data centers are the commerce platforms of the 21st century. + +**Data centers are essential…the best ones are innovating** + +At the outset of the pandemic, data centers were designated “essential businesses” since virtually all industries and consumers depend on them. The more advanced data centers were quickly recognized for their [ability to provide customers with remote access and management of their systems][1] without operators or enterprise customers having to be there physically. + +[QTS Realty Trust (NYSE: QTS)][2] is at the forefront of providing these services to all their customers. Supporting its commitment to digitize its entire end-to-end systems and processes, QTS is the first and only multi-tenant data center operator with a sophisticated software-defined orchestration platform powered by AI, ML, predictive analytics (PA) and virtual reality (VR) technologies. + +QTS’ API-driven [Service Delivery Platform (SDP)][3] empowers customers to interact with their data, services, and connectivity ecosystem by providing real-time visibility, access and dynamic control of critical metrics across hybrid and hyperscale environments from a single platform and/or mobile device. It is akin to it having a software company within the data center delivering operational savings and business innovation which are central to every IT investment. + +SDP applications leverage next-generation AI, ML and PA to accurately forecast power consumption, automate the service provisioning, perform online ordering and asset management. VR technologies are enabling new virtual collaboration tools and a 3D visualization application that renders an exact replication of a customer’s IT environment in real-time. + +QTS’ SDP was profiled in the Raymond James Industry Brief: _Data Maps and Killer Apps_ (released June 2020) that surveyed the platforms of three global data center operators: + +_“While all three platforms have the ability to track and report common data, the ease of use of the systems was quite different. Only QTS had the entire system wrapped up into an app that was available across multiple desktop, tablet, and mobile platforms, complete with 3D imaging and simple graphics that outlined the situation visually down to an individual rack within a cabinet. QTS' system also has video capability using facial recognition to detect and identify employees and contractors separately, highlight an open cabinet door and other potential hazards inside the customers cage, and it is all either real time or on a recorded basis to highlight potential errors and problems. Live heat maps allow customers to see the areas with potential and existing performance issues and to see outages in real time and track down problems. As far as features and functionality, QTS SDP system was the clear winner.”_ + +**Customer experience is the dealmaker** + +As consumers become more adamant in their demand for quality of experience in their digital lives, businesses must ensure they are providing services, and the data that is generated from them, real-time, on-the-go, via any network, and are personalized. + +Post COVID, the ability of data centers to ensure excellent customer experience will play an even greater role as large numbers of customers continue to work remotely with less on-premises interaction. Enterprises will seek data center operators that can ensure secure, ubiquitous, real time access to services and data backed by superior customer support. + +Given a purchasing decision based on performance and price between two equally qualified data center operators, the first tiebreaker is increasingly coming down to proven and documented customer support. + +In the data center industry, QTS is the undisputed leader in customer service and support boasting an [independent Net Promoter Score of 88][4] \- more than double the average NPS score for data center companies (42). + +Customers rated QTS highly in a range of service areas, including its customer service, service delivery platform, physical facilities, processes, responsiveness, and service of onsite staff and the 24-hour [Operations Service Center][5]. QTS’ score of 88 is its highest yet and exceeds NPS scores of companies well-known for their customer service including Starbucks (71) and Apple (72). + +Enterprise, Hyperscale and government organizations recognize that the post-COVID landscape is going to present an increasing need for innovation in their IT environments. In terms of IT service delivery, this means higher levels of transparency, visibility, compliance and sustainability that are at the foundation of QTS’ Service Delivery Platform. + +With innovation come new technologies and complexity, raising the profile of the best service and support partners for companies looking to re-establish themselves in a new, post-COVID competitive landscape. + +For more information, visit [www.qtsdatacenters.com][6] + +-------------------------------------------------------------------------------- + +via: https://www.networkworld.com/article/3566911/the-impact-of-covid-19-on-the-global-digital-economy.html + +作者:[QTS][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.networkworld.com/author/Andy-Patrizio/ +[b]: https://github.com/lujun9972 +[1]: https://www.qtsdatacenters.com/company/news/2020/03/26/qts-reports-significant-increase-in-customer-usage-of-sdp +[2]: http://www.qtsdatacenters.com/ +[3]: https://www.qtsdatacenters.com/why-qts/service-delivery-platform +[4]: https://www.qtsdatacenters.com/why-qts/customer-benefits/nps +[5]: https://www.qtsdatacenters.com/why-qts/customer-benefits/operations-support-center +[6]: http://www.qtsdatacenters.com diff --git a/sources/talk/20200716 Options grow for migrating mainframe apps to the cloud.md b/sources/talk/20200716 Options grow for migrating mainframe apps to the cloud.md new file mode 100644 index 0000000000..fef1ca55e5 --- /dev/null +++ b/sources/talk/20200716 Options grow for migrating mainframe apps to the cloud.md @@ -0,0 +1,87 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Options grow for migrating mainframe apps to the cloud) +[#]: via: (https://www.networkworld.com/article/3567058/options-grow-for-migrating-mainframe-apps-to-the-cloud.html) +[#]: author: (Michael Cooney https://www.networkworld.com/author/Michael-Cooney/) + +Options grow for migrating mainframe apps to the cloud +====== +Mainframe modernization vendor LzLabs is targeting Big Iron enterprises that want to move legacy applications into public or private cloud environments. +Thinkstock + +Mainframe users looking to bring legacy applications into the public or private cloud world have a new option: [LzLabs][1], a mainframe software migration vendor. + +Founded in 2011 and based in Switzerland, LzLabs this week said it's setting up shop in North America to help mainframe users move legacy applications – think COBOL – into the more modern and flexible cloud application environment. + +**Read also: [How to plan a software-defined data-center network][2]** + +At the heart of LzLabs' service is its Software Defined Mainframe (SDM), an open-source, Eclipse-based system that's designed to let legacy applications, particularly those without typically available source code, such as COBOL, run in the cloud without recompilation. + +The company says it works closely with cloud providers such as Amazon Web Services, and its service can be implemented on [Microsoft Azure][3]. It also works with other technology partners such as Red Hat and Accenture. + +Legacy applications have become locked into mainframe infrastructures, and the lack of available skilled personnel who understand the platform and its development process has revealed the urgent need to move these critical applications to open platforms and the cloud, according to Mark Cresswell, CEO of LzLabs. + +"With SDM, customers can run mainframe workloads on x86 or the cloud without recompilation or data reformatting. This approach significantly reduces the risks associated with mainframe migration, enables incremental modernization and integrates applications with DevOps, open-source and the cloud," the company [stated][4]. + +Cresswell pointed to the news stories around the COVID-19 pandemic that found many mainframe and COBOL-based state government systems were having trouble keeping up with the huge volume of unemployment claims hitting those systems. + +For example, [CNN in April reported][5] that in New Jersey, Gov. Phil Murphy put out a call for volunteers who know how to code COBOL because many of the state's systems still run on older mainframes. Connecticut is also reportedly struggling to process the large volume of unemployment claims with its decades-old mainframe; it's working to develop a new benefits system with Maine, Rhode Island, Mississippi and Oklahoma, but the system won't be finished before next year, according to the CNN story. + +"An estimated 70% of the world's commercial transactions are processed by a mainframe application at some point in their cycle, which means U.S. state governments are merely the canaries in the coal mine. Banks, insurance, telecom and manufacturing companies (to mention a few) should be planning their exit," Cresswell wrote in a [blog][6]. + +LzLabs is part of an ecosystem of mainframe modernization service providers that includes [Astadia][7], [Asysco][8], [GTSoftware][9], [Micro Focus][10] and others. + +Large cloud players are also involved in modernizing mainframe applications. For example, Google Cloud in February [bought mainframe cloud-migration service firm Cornerstone Technology][11] with an eye toward helping Big Iron customers move workloads to the private and public cloud. Google said the Cornerstone technology – found in its [G4 platform][12] – will shape the foundation of its future mainframe-to-Google Cloud offerings and help mainframe customers modernize applications and infrastructure. + +"Through the use of automated processes, Cornerstone's tools can break down your Cobol, PL/1, or Assembler programs into services and then make them cloud native, such as within a managed, containerized environment," wrote Howard Weale, Google's director, transformation practice, in a [blog][13] about the acquisition. + +"As the industry increasingly builds applications as a set of services, many customers want to break their mainframe monolith programs into either Java monoliths or Java microservices," Weale stated.  + +The Cornerstone move is also part of Google's effort stay competitive in the face of mainframe-migration offerings from [Amazon Web Services][14], [IBM/RedHat][15] and [Microsoft][16]. + +While the number of services looking to aid in mainframe modernization might be increasing, the actual migration to those services should be well planned, experts say. + +A _Network World_ article on [mainframe migration options][17] from 2017 still holds true today: "The problem facing enterprises wishing to move away from mainframes has always been the 'all-or-nothing' challenge posed by their own workloads. These workloads are so interdependent and complex that everything has to be moved at once or the enterprise suffers. The suffering typically centers on underperformance, increased complexity caused by bringing functions over piecemeal, or having to add new development or operational staff to support the target environment. In the end, the savings on hardware or software turns out to be less than the increased costs required of a hybrid computing solution." + +Gartner last year also warned that migrating legacy applications should be undertaken very deliberately. + +"The value gained by moving applications from the traditional enterprise platform onto the next 'bright, shiny thing' rarely provides an improvement in the business process or the company's bottom line. A great deal of analysis must be performed and each cost accounted for," Gartner stated in a 2019 report, [Considering Leaving Legacy IBM Platforms? Beware, as Cost Savings May Disappoint, While Risking Quality][18]*. "*Legacy platforms may seem old, outdated and due for replacement. Yet IBM and other vendors are continually integrating open-source tools to appeal to more developers while updating the hardware. Application leaders should reassess the capabilities and quality of these platforms before leaving them." + +Join the Network World communities on [Facebook][19] and [LinkedIn][20] to comment on topics that are top of mind. + +-------------------------------------------------------------------------------- + +via: https://www.networkworld.com/article/3567058/options-grow-for-migrating-mainframe-apps-to-the-cloud.html + +作者:[Michael Cooney][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.networkworld.com/author/Michael-Cooney/ +[b]: https://github.com/lujun9972 +[1]: https://twitter.com/LzLabsGmbH +[2]: https://www.networkworld.com/article/3284352/data-center/how-to-plan-a-software-defined-data-center-network.html +[3]: https://www.astadia.com/video/mainframe-transformation-azure-is-the-new-mainframe +[4]: https://appsource.microsoft.com/en-us/product/web-apps/lzlabsgmbh-5083555.lzlabs-softwaredefinedmainframe?src=office&tab=Overview +[5]: https://www.cnn.com/2020/04/08/business/coronavirus-cobol-programmers-new-jersey-trnd/index.html +[6]: https://blog.lzlabs.com/cobol-crisis-for-us-state-government-departments-is-the-canary-in-the-coal-mine +[7]: https://www.astadia.com/blog/mainframe-migration-to-azure-in-5-steps +[8]: https://www.asysco.com/code-transformation/ +[9]: https://www.gtsoftware.com/services/migration-services/ +[10]: https://www.microfocus.com/en-us/home +[11]: https://www.networkworld.com/article/3528451/google-cloud-moves-to-aid-mainframe-migration.html +[12]: https://www.cornerstone.nl/solutions/modernization +[13]: https://cloud.google.com/blog/topics/inside-google-cloud/helping-customers-migrate-their-mainframe-workloads-to-google-cloud +[14]: https://aws.amazon.com/blogs/enterprise-strategy/yes-you-should-modernize-your-mainframe-with-the-cloud/ +[15]: https://www.networkworld.com/article/3438542/ibm-z15-mainframe-amps-up-cloud-security-features.html +[16]: https://azure.microsoft.com/en-us/migration/mainframe/ +[17]: https://www.networkworld.com/article/3192652/why-are-mainframes-still-in-the-enterprise-data-center.html +[18]: https://www.gartner.com/doc/3905276 +[19]: https://www.facebook.com/NetworkWorld/ +[20]: https://www.linkedin.com/company/network-world diff --git a/sources/talk/20200717 Open source accounting software developed by accountants.md b/sources/talk/20200717 Open source accounting software developed by accountants.md new file mode 100644 index 0000000000..22ae8e1689 --- /dev/null +++ b/sources/talk/20200717 Open source accounting software developed by accountants.md @@ -0,0 +1,151 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Open source accounting software developed by accountants) +[#]: via: (https://opensource.com/article/20/7/godbledger) +[#]: author: (Sean Darcy https://opensource.com/users/sean-darcy) + +Open source accounting software developed by accountants +====== +GoDBledger is open source accounting software that is both intuitive and +productive. +![Person using a laptop][1] + +Over the last six months, I have been working on [GoDBLedger][2], an open source accounting system that I feel addresses some of the issues that plague current accounting software solutions. Even in my first year as a graduate accountant, the software frustrated me because I have seen what good software can be like and how much it can improve your productivity. + +A great example of "good software" is a software developer's [Editor/IDE][3]. Developers love their editors, and there is a huge range that is highly customizable and allows for seamless coding experience. One of the major influencing factors for the existence of great software in this area is because developers are themselves the end users—they scratch their own itches and have immediate feedback on their designs. + +The relationship between developers and their editor is fascinating because the editor's job is to facilitate the efficient transfer of the developer's ideas into the codebase. + +As an accountant who loves programming in my spare time, I can see parallels between the accounting industry and software development. You can imagine the general ledger (a giant list of financial transactions) as a "codebase" that accountants work with, and it is the accountant's job to navigate and edit the general ledger before compiling it into various reports that an end user consumes—financial statements and tax returns, for example. This is similar to, for instance, the way the Red Hat Enterprise Linux codebase is maintained by developers, and then released officially as RHEL and CentOS to the world. + +Unfortunately, when comparing the software between the two industries, I have found that navigating and editing the general ledger is not seamless, at least not when compared to my experiences when programming. Additionally, the compilation is slow and involves a lot of human labor to achieve; it can ultimately be as difficult as editing the general ledger itself. + +So, given the parallels between accountants' and programmers' processes, why hasn't the accounting industry developed software to make editing the general ledger as efficient as an IDE editing a codebase? And why is compiling a set of financial statements from the general ledger not automated as is pushing code to production? + +There are two influencing factors that I have noticed. + +The first is the profit motive that drives both accountants and accounting software developers. Monetization can lead to inefficiencies in software because the most efficient end user is not always the most profitable. A profit-maximizing entity can extract more value from their users by taking actions to get control of the user's data, create walled gardens, and make it difficult for the user to change their software. + +Accounting software has always existed in the realm of paid software. Because it plays such an important role in a business, it has always been easy to monetize. This is great for software developers who wish to make a profit, but unfortunately, it means that open source principles have had minimal influence on the shape and design of the software. + +The second influencing factor is a lack of understanding of the general ledger as a data structure. The general ledger, in simple terms, is just a way to format a database of financial transactions. This data structure was designed in the 1600s, and it worked quite well within a physical book. At that point in time, working with the general ledger meant changing written text in the book as necessary, and accountants were professionals at maintaining this database. However, when relational databases were created, the structure never really got standardized and digitalized. Software packages implemented the general ledger within their own proprietary database structures, and accountants lost their ability to directly edit the database. Instead of managing the general ledger directly, the software only allowed for accountants to have restricted access. + +### The result + +Before TCP/IP got standardized, companies like AOL were creating their own proprietary environments and locking users into their walled gardens. Fortunately for the internet, they fell away to a free standard communication protocol. Unfortunately, the accounting industry did not do this, and we got stuck with "America Online." + +Imagine that the software industry was ruled by a few big IDE software conglomerates which have decided to maximize their profits rather than maximizing developer efficiency. Your editor no longer saves code as text; instead, it is saved as a proprietary data format. You can not copy a codebase easily into another IDE, and if you do change editors, it's probably safe to assume that the codebase saved in the previous system is lost. + +This is the state of the accounting software available today. + +So what can accounting software developers learn from the open source community? + +Open source means you can stand on the shoulders of giants and use codebases of other projects to influence and directly assist in the growth of your own project. If you are focusing on accountants' efficiency to edit the general ledger, you can review other software and copy the parts that work and ignore the parts that don't. In my case, I have been fortunate to leverage the great codebases of other accounting software such as [GNU Cash][4] and [Ledger-CLI][5], but there is another interesting area that has a lot to contribute—the open source servers that manage cryptocurrency nodes. + +Accounting has struggled with the transition from physical ledgers to computers, but thankfully the cryptocurrency community has already developed a lot of open source software for maintaining a database of transactions. + +The general ledger is a data structure to record financial transactions—just like a blockchain. + +### What this means + +My accounting system has been heavily influenced by [Geth (Go Ethereum)][6] and [Prysmatic Labs][7]—[Prysm][7], as there are a lot of talented developers working on these projects. They have provided the base for a server that manages financial transactions. Combining this with a database schema that was heavily influenced by GNU Cash means the heavy work behind designing an accounting system has already been done. + +The result is [GoDBLedger][2], with source code available on [github.com/darcys22/godbledger][8]. + +It is also written in Golang to leverage the already good code that exists in this area, and because Golang tends to be good for servers of this nature. + +I've talked a lot about how accountants should be able to work with the general ledger as seamlessly as a programmer can work on their codebase. I truly look forward to the day when I can create and edit journal entries with the same efficiency that I navigate and edit code using my text editor of choice. GoDBLedger is my first step toward achieving this. The next steps will be toward developing this "IDE" that communicates with GoDBLedger and its underlying database. Fortunately for me, there are already a lot of good open source database projects that I'll be able to leverage for this. + +### How to use GoDBLedger + +GoDBLedger is usable today! You can fire up a server that maintains a database for your financial transactions, and it will look and feel familiar to anyone who has run a cryptocurrency node before. + +The end goal is for it to act as the central server for receiving financial transactions and storing them in the database. It lives in the background, always running so that other systems can communicate financial data to it as needed. + +![GoDBledger operational flow chart][9] + +Right now, if you are comfortable with a command line and scripts that communicate to systems using RPC, then you can play with GoDBLedger and experience double-entry bookkeeping on a level lower than all other software (and only slightly above directly manipulating the SQL database). + +For instance, with GoDBLedger running, you can add entries in the interactive mode of ledger-cli: + + +``` +$ ~/godbledger/ledger_cli journal +Journal Entry Wizard +\-------------------- +Enter the date (yyyy-mm-dd): 2019-06-30 +Enter the Journal Descripion: Get Money Get Paid! + +Line item #1 +Enter the line Descripion: Income is good yo +Enter the Account: Revenue:Sales +Enter the Amount: -1000 +Would you like to enter more line items? (n to stop): + +Line item #2 +Enter the line Descripion: Cash is better +Enter the Account: Asset:Cash +Enter the Amount: 1000 +Would you like to enter more line items? (n to stop): n + +&{Get Money Get Paid! + 2019-06-30 00:00:00 +0000 UTC [{Revenue:Sales + Income is good yo + -1000/1} {Asset:Cash + Cash is better + 1000/1}] stuff} +``` + +However, the same entry can be made using JSON: + + +``` +`$ ~/godbledger/ledger_cli jsonjournal '{"Payee":"Darcy Financial","Date":"2019-06-30T00:00:00Z","AccountChanges":[{"Name":"Asset:Cash","Description":"Cash is better","Currency":"USD","Balance":"100"},{"Name":"Revenue:Sales","Description":"Income is good yo","Currency":"USD","Balance":"-100"}],"Signature":"anythingHereCurrently"}'` +``` + +You can view a report with the `reporter` command: + + +``` +$ ~/godbledger/reporter trialbalance + +   ACCOUNT    | BALANCE AT 20 FEBRUARY 2020 +\--------------+---------------------------- +Asset:Cash    |                        1000 +              | +Revenue:Sales |                       -1000 +              | +``` + +Read the [quickstart on the Github Wiki][10] for more information. I've also developed a few [example scripts using Python][11] to show how you can send transactions from your own software. Additionally, I have made an [example "trading bot"][12] that saves every trade it does to GoDBLedger. + +if you're interested in a procedural system to keep tracking of your accounts, try GoDBLedger. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/7/godbledger + +作者:[Sean Darcy][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/sean-darcy +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/laptop_screen_desk_work_chat_text.png?itok=UXqIDRDD (Person using a laptop) +[2]: https://godbledger.com/ +[3]: https://www.redhat.com/en/topics/middleware/what-is-ide +[4]: https://www.gnucash.org/ +[5]: https://www.ledger-cli.org/ +[6]: https://github.com/ethereum/go-ethereum +[7]: https://github.com/prysmaticlabs/prysm +[8]: https://github.com/darcys22/godbledger +[9]: https://opensource.com/sites/default/files/uploads/godbledger_flow.png (GoDBledger operational flow chart) +[10]: https://github.com/darcys22/godbledger/wiki/Quickstart +[11]: https://github.com/darcys22/godbledger-pythonclient +[12]: https://github.com/darcys22/Trading-Simulator diff --git a/sources/talk/20200719 Open source development works to improve contact tracing in Europe.md b/sources/talk/20200719 Open source development works to improve contact tracing in Europe.md new file mode 100644 index 0000000000..be101bc70f --- /dev/null +++ b/sources/talk/20200719 Open source development works to improve contact tracing in Europe.md @@ -0,0 +1,201 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Open source development works to improve contact tracing in Europe) +[#]: via: (https://opensource.com/article/20/7/open-source-contact-tracing) +[#]: author: (J. Manrique Lopez de la Fuente https://opensource.com/users/jsmanrique) + +Open source development works to improve contact tracing in Europe +====== +Analyzing data on Corona-Warn-App's development shows how quickly open +source can scale up to help stop disease outbreaks. +![Hands holding a mobile phone with open on the screen][1] + +The [Corona-Warn-App][2] is an awesome example of how governments and public administrations can use open source software development to help citizens while simultaneously advancing the technology ecosystem. The app helps trace infection chains of [SARS-CoV-2][3] (the virus that causes [COVID-19][4]) in Germany. The app uses [a decentralized approach][5] to notify users if they have been exposed to SARS-CoV-2. + +![Corona-Warn-App branding][6] + +(Manrique Lopez, [CC BY-SA 4.0][7]) + +Transparency is essential to protecting the app's end users and encouraging its adoption, and [open source][8] is a key element of achieving transparency. Open source allows anyone to use, study, share, and [improve][9] Covid-Warn-App. This is similar to the tracing apps developed by Italy ([Immuni][10]), Switzerland ([SwissCovid][11]), and partially by France ([StopCovid][12]). In contrast, [Radar Covid][13] is a new non-open source COVID-tracking app being piloted in Spain's Canary Islands; between the non-open nature of the app and the fact that the [website][14] still fails to load in mid-July 2020, it's debatable whether citizens will trust it. + +![radarcovid.covid19.gob.es offline on July, 8th, 2020][15] + +Radar Covid [site][14] offilne on July 8, 2020. (Manrique Lopez, [CC BY-SA 4.0][7]) + +### Why open source transparency matters + +Transparency benefits software development projects in two ways: + + * Internally in the project's community, there's a sense of fair play among all the contributors because everything is in public, so everyone is accountable. + * Externally among third parties, there's a sense of trust in the project because it can be analyzed from multiple perspectives (e.g., legal, technical, project activity, development processes, etc.). + + + +Transparency should be an essential requirement in software developed by governments. Initiatives like [Public Money, Public Code][16] and the [Foundation for Public Code][17] are doing an amazing job of helping public administrators understand why their code (_our_ code as taxpayers) should be open source. + +![Corona-Warn-App's open source approach][18] + +(Manrique Lopez, [CC BY-SA 4.0][7]) + +### About Corona-Warn-App + +In early May 2020, the German government asked software developer SAP and Deutsche Telekom subsidiary T-Systems to deliver the Corona-Warn-App based on open source and decentralized technology. Many other German companies and research centers are supporting the app's development. + +![Corona-Warn-App development partners][19] + +(Manrique Lopez, [CC BY-SA 4.0][7]) + +In addition, the global open source community has been remarkable in helping to build the app, which has already been [downloaded by more than 15 million users][20]. + +### Corona-Warn-App's development + +Inspired by [Andreas Schreiber's][21] tweet, [Jesus M. Gonzalez-Barahona][22] did an [analysis][23] of Corona-Warn-App's development using [Cauldron.io][24], an open source software-as-a-service application built on top of [GrimoireLab][25], and [summarized his findings][26] on Twitter. + +Corona-Warn-App saw robust [software development activity][23] through mid-June: + + * More than 100 people contributed. + * More than 5,300 commits were made, with 1,600+ pull requests and 600+ issues. + + + +![Corona-Warn-App development data][27] + +Data source: [Corona-Warn-App dashboard][23] (Manrique Lopez, [CC BY-SA 4.0][7]) + +#### Quick code reviews + +Code review for pull requests is quick, usually within one day (mean: 0.36 days). + +![Corona-Warn-App pull requests][28] + +Data source: [Corona-Warn-App dashboard][23] (Manrique Lopez, [CC BY-SA 4.0][7]) + +Time to close issues is also quick at about two days. + +![Corona-Warn-App issues][29] + +Data source: [Corona-Warn-App dashboard][23] (Manrique Lopez, [CC BY-SA 4.0][7]) + +This means that most pull requests are already closed, and the gap between open and closed issues is not very large. + +#### Commitment to fighting coronavirus spread + +Contributions are coming from both corporate email accounts and private addresses (such as gmail.com, gmx.de, icloud.com, and outlook.de). + +![Corona-Warn-App contributors' email domains][30] + +Data source: [Corona-Warn-App dashboard][23] (Manrique Lopez, [CC BY-SA 4.0][7]) + +Also, there is no noticeable decline in commits over the weekend, which is unusual for software produced by employees on paid time. + +![Corona-Warn-App commits by date][31] + +Data source: [Corona-Warn-App dashboard][23] (Manrique Lopez, [CC BY-SA 4.0][7]) + +These facts may be signs of contributors' sense of urgency or commitment to fighting the spread of COVID-19, even on their own time. + +There is, however, a different pattern in issue and pull request submissions: they are more common during the week than on weekends, even though commits happen regularly over the week. One possible explanation for this is that developers work uniformly throughout the week but upload and interact with issues mostly during workdays. + +![Corona-Warn-App patches by day][32] + +Data source: [Corona-Warn-App dashboard][23] (Manrique Lopez, [CC BY-SA 4.0][7]) + +![Corona-Warn-App issues by day][33] + +Data source: [Corona-Warn-App dashboard][23] (Manrique Lopez, [CC BY-SA 4.0][7]) + +#### Outstanding developer engagement + +Onboarding of developers has been really quick—currently about 50 people by daily contributions and more than 100 people by weekly contributions. + +These numbers are common for corporate projects, but Corona-Warn-App has assembled a team of more than 100 developers from at least six companies in just 45 days. Is this another lesson corporate software development can learn and apply from open source development? + +![Corona-Warn-App engagement][34] + +Data source: [Corona-Warn-App dashboard][23] (Manrique Lopez, [CC BY-SA 4.0][7]) + +![Corona-Warn-App engagement][35] + +Data source: [Corona-Warn-App dashboard][23] (Manrique Lopez, [CC BY-SA 4.0][7]) + +Engagement differs in different repositories; for example, the iOS app had about eight times the commits as the Android app. Lines per commit and files per commit suggest that this is likely real development, not snapshots masquerading as development. + +![Corona-Warn-App repos][36] + +Data source: [Corona-Warn-App dashboard][23] (Manrique Lopez, [CC BY-SA 4.0][7]) + +#### Time efficiency + +One worrisome piece of data is in the time to close pull requests. The mean is short, but the median is too short. That could either mean a very well-streamlined code review in a tightly coupled team or very little code review. + +![Corona-Warn-App time to merge][37] + +Data source: [Corona-Warn-App dashboard][23] (Manrique Lopez, [CC BY-SA 4.0][7]) + +![Corona-Warn-App open PR time][38] + +Data source: [Corona-Warn-App dashboard][23] (Manrique Lopez, [CC BY-SA 4.0][7]) + +### Closing thoughts + +Corona-Warn-App is a successful example of how governments and public administrations can use open collaboration to scale up to fight a global crisis. Data saves lives, and now more than ever, we need to break silos, be transparent, and work towards a common goal. + +Transparency is not only about making code publicly available. Transparency is about fairness and trust, and software development analysis is a good example of how to take advantage of transparency to better understand the software that matters to you. + +If you liked this analysis, note that you can do your own with Cauldron.io, as it's [free, open source software][39]. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/7/open-source-contact-tracing + +作者:[J. Manrique Lopez de la Fuente][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/jsmanrique +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/rh_003588_01_rd3os.combacktoschoolserieshe_rh_041x_0.png?itok=tfg6_I78 (Hands holding a mobile phone with open on the screen) +[2]: https://www.coronawarn.app +[3]: https://en.wikipedia.org/wiki/Severe_acute_respiratory_syndrome_coronavirus_2 +[4]: https://en.wikipedia.org/wiki/Coronavirus_disease_2019 +[5]: https://en.wikipedia.org/wiki/Exposure_Notification +[6]: https://opensource.com/sites/default/files/uploads/corona-warn.png (Corona-Warn-App branding) +[7]: https://creativecommons.org/licenses/by-sa/4.0/ +[8]: https://opensource.org/osd +[9]: https://github.com/corona-warn-app/cwa-documentation/blob/master/CONTRIBUTING.md +[10]: https://it.wikipedia.org/wiki/Immuni +[11]: https://fr.wikipedia.org/wiki/SwissCovid +[12]: https://fr.wikipedia.org/wiki/StopCovid +[13]: https://english.elpais.com/society/2020-06-29/spain-launches-first-phase-of-coronavirus-tracking-app.html +[14]: https://radarcovid.covid19.gob.es/ +[15]: https://opensource.com/sites/default/files/uploads/radarcovid.jpg (radarcovid.covid19.gob.es offline on July, 8th, 2020) +[16]: https://publiccode.eu/ +[17]: https://publiccode.net/ +[18]: https://opensource.com/sites/default/files/uploads/corona-warn-open-source.jpg (Corona-Warn-App's open source approach) +[19]: https://opensource.com/sites/default/files/uploads/corona-warn-partner.jpg (Corona-Warn-App development partners) +[20]: https://de.statista.com/statistik/daten/studie/1125951/umfrage/downloads-der-corona-warn-app/ +[21]: https://twitter.com/onyame/status/1272505372360785920 +[22]: https://opensource.com/users/jgbarah +[23]: https://cauldron.io/dashboard/1545 +[24]: https://cauldron.io/ +[25]: https://chaoss.github.io/grimoirelab/ +[26]: https://twitter.com/jgbarah/status/1272777800102141957 +[27]: https://opensource.com/sites/default/files/uploads/corona-warn_development.png (Corona-Warn-App development data) +[28]: https://opensource.com/sites/default/files/uploads/corona-warn_prs.png (Corona-Warn-App pull requests) +[29]: https://opensource.com/sites/default/files/uploads/corona-warn_issues.png (Corona-Warn-App issues) +[30]: https://opensource.com/sites/default/files/uploads/corona-warn_users.png (Corona-Warn-App contributors' email domains) +[31]: https://opensource.com/sites/default/files/uploads/corona-warn_commits.png (Corona-Warn-App commits by date) +[32]: https://opensource.com/sites/default/files/uploads/corona-warn_submission1.png (Corona-Warn-App patches by day) +[33]: https://opensource.com/sites/default/files/uploads/corona-warn_submission2.png (Corona-Warn-App issues by day) +[34]: https://opensource.com/sites/default/files/uploads/corona-warn_engagement1.png (Corona-Warn-App engagement) +[35]: https://opensource.com/sites/default/files/uploads/corona-warn_engagement2.png (Corona-Warn-App engagement) +[36]: https://opensource.com/sites/default/files/uploads/corona-warn_repo.png (Corona-Warn-App repos) +[37]: https://opensource.com/sites/default/files/uploads/corona-warn_timetomerge.png (Corona-Warn-App time to merge) +[38]: https://opensource.com/sites/default/files/uploads/corona-warn_opentime.png (Corona-Warn-App open PR time) +[39]: https://gitlab.com/cauldronio/cauldron diff --git a/sources/talk/20200721 Data-center survey- IT seeks faster switches, intelligent computing.md b/sources/talk/20200721 Data-center survey- IT seeks faster switches, intelligent computing.md new file mode 100644 index 0000000000..fe915f2a5a --- /dev/null +++ b/sources/talk/20200721 Data-center survey- IT seeks faster switches, intelligent computing.md @@ -0,0 +1,58 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Data-center survey: IT seeks faster switches, intelligent computing) +[#]: via: (https://www.networkworld.com/article/3566925/data-center-survey-it-seeks-faster-switches-intelligent-computing.html) +[#]: author: (Andy Patrizio https://www.networkworld.com/author/Andy-Patrizio/) + +Data-center survey: IT seeks faster switches, intelligent computing +====== +As data use changes, so do technical needs of the data center operators, who want speed and intelligence. +monsitj / Getty Images + +The growth in data use and consumption means the needs of IT managers are changing, and a survey from Omdia (formerly IHS Markit) found [data-center][1] operators are looking for intelligence of all sorts, not just the artificial kind. + +Omdia analysts recently surveyed IT leaders from 140 North American enterprises with at least 101 employees working in North American offices and data centers and asked them what features they wanted the most in their networking technology. + +The results say respondents expect to more than double their average number of data-center sites between 2019 and 2021, and the average number of servers deployed in data centers is expected to double over the same timeline. + +“The on-premises enterprise data center continues to flourish,” the authors wrote in the report. “We are seeing a continuation of the enterprise DC growth phase signaled by the 2018 respondents and confirmed by the respondents of this study. The transformation of the on-premises DC to a cloud architecture continues, and the enterprise DC will be considered a first-class citizen as enterprises build their multi-clouds and shift compute to the edge.” + +But the emphasis appears to be on networking and not necessarily server gear. From 2019 to 2021, more than 60% of respondents expect to increase their investments in Ethernet switches, Fibre Channel switches, network analytics, and network automation. The installed base of data-center Ethernet-switch ports will grow 27% between 2019 and 2021 with higher speeds (100/200/400GE) making up a larger portion of the deployed base. + +High speeds (65% of respondents), openness and interoperability (65%), and application-awareness (65%) are the top features respondents seek when making data-center Ethernet-switching purchases. Increased port speeds are an obvious upgrade decision, and it remains top-of-mind for enterprises. + +And not just any switches will do. The number of respondents using Open Compute Project (OCP)-certified switches has risen significantly since 2019: 76% of respondents adopted OCP switches in 2019 per the 2019 survey versus 60% of respondents in 2018. Bare-metal switches, like those offered by vendors of OCP-certified equipment, are available from several hardware vendors such as Edgecore, Delta Networks and Mellanox/Nvidia. + +### Smarter software** + +** + +Application awareness and automated virtual machine (VM) movement are becoming more important as more data center traffic gets routed from central data centers to edge locations globally. Omdia says the results show that data-center networks can no longer operate in siloes, and respondents want solutions that are easy to integrate, allowing them to monitor their data across compute and storage, independent of physical data-center location. + +And with all that data and virtual machines to move around, respondents seem to be keen on the benefits that AI promises to bring. Many vendors claim their high-throughput (100G-plus Ethernet) DC switches are designed for use in environments required to handle resource-intense applications like AI and ML. But Omdia says it remains to be seen how AI features will impact the DC networking market and what qualitative and quantitative outcomes will result. + +Omdia also says data-center orchestration software will provide automated coordination and management of resource pools including network equipment, servers, and storage. “Enterprise IT teams are selecting orchestration software, and the choice for physical and virtual switching in the DC will depend on the orchestration software selected,” the report said. + +It flags Red Hat Enterprise OpenStack Platform (celebrating its tenth anniversary this month), VMware vCloud, Cisco Intelligent Automation for Cloud [IAC], and Microsoft System Centerj among the leaders of data center orchestration. + +Join the Network World communities on [Facebook][2] and [LinkedIn][3] to comment on topics that are top of mind. + +-------------------------------------------------------------------------------- + +via: https://www.networkworld.com/article/3566925/data-center-survey-it-seeks-faster-switches-intelligent-computing.html + +作者:[Andy Patrizio][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.networkworld.com/author/Andy-Patrizio/ +[b]: https://github.com/lujun9972 +[1]: https://www.networkworld.com/article/3223692/what-is-a-data-centerhow-its-changed-and-what-you-need-to-know.html +[2]: https://www.facebook.com/NetworkWorld/ +[3]: https://www.linkedin.com/company/network-world diff --git a/sources/talk/20200722 Student Linux club refurbishes computers to support distance learning.md b/sources/talk/20200722 Student Linux club refurbishes computers to support distance learning.md new file mode 100644 index 0000000000..18f40c2026 --- /dev/null +++ b/sources/talk/20200722 Student Linux club refurbishes computers to support distance learning.md @@ -0,0 +1,70 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Student Linux club refurbishes computers to support distance learning) +[#]: via: (https://opensource.com/article/20/7/donate-linux) +[#]: author: (Cam Citrowske https://opensource.com/users/camcitrowske) + +Student Linux club refurbishes computers to support distance learning +====== +Open source helps bridge the digital divide for families in need of +computers for distance learning during the pandemic. +![][1] + +_This article is co-written by Cam Citrowske, a member of the Penguin Corps._ + +It was March 17, 2020, and I was in my classroom at Aspen Academy. The clock was ticking. This was to be the last day of school before we, along with every other public school in Minnesota, would close due to the outbreak of the new coronavirus. I had students in my room during lunch, advisory periods, and my elective classes all doing the same thing—installing Linux onto old computers so we could give them to students who would use them for school at home during the shelter in place order. I was only going to have the kids' help until dismissal time, but in the end, we had 17 computers ready to go. It was a start. + +Hi, I'm Stu Keroff. I'm a social studies and technology teacher at Aspen Academy in Savage, MN. I am also the director of the Penguin Corps, our school's Linux club. When we started the club back in September of 2019, I wanted the kids at my new school to take on the same type of mission that the kids at my last school had: using Linux to close the "digital divide" (see this [article][2] about the Community School of Excellence Asian Penguins for more information). The Penguin Corps gave away a few computers during the year, but nothing had prepared us for what was coming. + +It was in January that I first heard about COVID-19. At the time, it was making people sick in other countries, and while it was a topic of discussion in my social studies classes, I wasn't concerned because it wasn't in Minnesota. + +![Linux club donating computers][3] + +(Stu Keroff, [CC BY-SA 4.0][4]) + +By March, that had changed. Businesses were talking about how they would respond to the pandemic, and it raised the conversation about how it would affect schools. Fast forward to March 18, when all the schools in Minnesota were closed and converted to distance learning—teachers provide lessons online, and kids attend school in their homes over the internet. It was a huge change for all of us! + +While it was tough for many of my students to go to school from their bedrooms or dining rooms, at least most of them had computers to use. But what about the kids at school who didn't have computers? Or the families who didn't have enough computers for all of the kids in the house? What were they supposed to do? + +Our school's administrators reached out to me and the Penguin Corps to create a solution. We surveyed parents to find out how many families needed a computer and then got to work. We started by putting Linux on computers the school was no longer using, and then we gave those away. More responses started to pour in. We realized that the supply we had would not even be close to enough. This became a serious problem that was in need of a bigger solution. + +Once we realized that, we started to ask for more. With help from the school, we reached out over social media and in the local newspaper, asking people to donate their old computers to us. A number of people and even some businesses like Caribou Coffee and St. Vincent de Paul of the Twin Cities responded. Laptops started to pour in. Most of them worked, but some needed minor repairs, such as new batteries, a charger, or a hard drive. All of the computers needed new software. Linux and open source apps were the solution. We got the computers up and running, tested them, and left them with the school to distribute. + +The school continued to take referrals, and people came in to pick up laptops. The office receptionist eventually joined our team, walking parents through the software before they left with their laptops. Even though she had no previous experience with Linux, she was able to jump right in and contribute. + +Prior to the shutdown, the Penguin Corps gave away six computers. Between March 16 and the first week of May, we gave away 60 computers. This effectively closed our school's digital divide. + +And at what cost? Since we chose to go with used computers instead of buying new ones, the only thing we had to pay for were batteries, chargers, a couple of hard drives, and a keyboard. Total cost: approximately $900.00, or an average of $12.33 per computer, including the computers we had left over, which we're saving for the fall term. + +The program even gave us the opportunity to help people outside of our school. Reverend Tim Christopher, a pastor in North Minneapolis, reached out to me and the Penguin Corps to ask for our help. A single mother in Minneapolis with two school-aged children needed computers for her kids to do distance learning from their home. Thanks to the Penguin Corps, both kids got one to use for school, for free. + +Aspen Academy principal Melanie Jiskra said, "It was through this group of change agents that all Aspen Academy families had enough devices to continue their education through distance learning. Without the generosity of the people and companies who donated the laptops, the hard work and commitment of Mr. Keroff, and the talent, drive, and passion of the students to serve others, Aspen Academy would not have as successfully bridged the digital divide during this pandemic." + +COVID-19 presented all schools with a challenge, and Aspen Academy's Penguin Corps demonstrated that open source software could be used to meet it. Our biggest challenge became our biggest victory. + +Do you want to know more about how a Linux club can help your school or a school near you? You can email me at [studoeslinux@gmail.com][5]. You can also get ideas for starting your own program at [www.linuxclubguide.com][6]. + +The Asian Penguins Linux users group for middle school students is improving people’s lives through... + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/7/donate-linux + +作者:[Cam Citrowske][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/camcitrowske +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/penguin_corps_group_photo.jpg?itok=_uQlfxDa +[2]: https://opensource.com/education/15/3/asian-penguins-Linux-middle-school-club +[3]: https://opensource.com/sites/default/files/pictures/linux-club-donating-computers.jpg (Middle school Linux club donating computers) +[4]: https://creativecommons.org/licenses/by-sa/4.0/ +[5]: mailto:studoeslinux@gmail.com +[6]: http://www.linuxclubguide.com diff --git a/sources/talk/20200726 Globalization- A history of openness.md b/sources/talk/20200726 Globalization- A history of openness.md new file mode 100644 index 0000000000..7c056d7107 --- /dev/null +++ b/sources/talk/20200726 Globalization- A history of openness.md @@ -0,0 +1,82 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Globalization: A history of openness) +[#]: via: (https://opensource.com/open-organization/20/7/globalization-history-open) +[#]: author: (Ron McFarland https://opensource.com/users/ron-mcfarland) + +Globalization: A history of openness +====== +The history of our interconnected world is also a history of our +willingness to open up. +![India on the globe][1] + +In my career conducting international business, I traveled to more than 80 countries worldwide. I was always struck by how strongly regions of the world are connected, and I began studying the forces of globalization as a result. + +Several books on this subject were critical to this research. But the one I'd like to highlight here is [World 3.0: Global Prosperity and How to Achieve It][2] by Pankaj Ghemawat. This book first taught me how _little_ the global community is connected—but also how far it has come compared to the past. During Prof. Ghemawat's research, he worked with DHL and ultimately helped develop the [DHL Global Connectedness Index][3], which tracks how well the global community is interacting in four key measurements: trade, investment, telecommunication, and travel/migration. From that work, I developed and delivered a presentation on [global connectedness][4], which stressed that the world should increase its scores on those four measurements of globalization, as they are directly linked to food supply, health, security, pollution, jobs and other global benefits. + +In this article series, I'll present my research from that period, then explain how we might think about the intersection of globalization and [open organization principles][5] around the world today. When people use terms like "globalization" and "global connectedness," in most cases what they _really_ mean is "building coordinated communities to provide goods/service globally and address global issues." Open organization principles are applicable here—but in this context, on a global scale. + +But before I can explain that interconnection, I'll first need to outline Prof. Ghemawat's criteria. In this article, I'll do that, with a special emphasis on the way open organization principles are critical to all of them. + +### Trade + +By "trade," I'm referring to the imports and exports of goods and services between countries. It's a key dimension of a globally connected world. Trading extremely simple products and services might be possible via electronic transactions, perhaps over the internet. But on the other hand, highly complex products may require a company to build a distribution network in a wide range of countries worldwide. In this case, then, connectivity, collaboration, and leveraging other open organization principles would be extremely important. In my last job, for example, I set up product distributors throughout Europe and the United States and a production operation in China. Building a strong relationship was very important, difficult and took time and effort. I had to use open organization principles to their fullest. + +### Investment + +Global financial investments also have an impact on global connectedness. If an investor simply purchases shares of an overseas company or deposits funds in an overseas bank account, then more complex relationships are not as critical. But if a company wants to invest in a factory (or sales office for that matter) in a foreign country, then a great deal of interpersonal interaction is required. Economists define these two types of investments differently; they call the latter "foreign direct investment" or FDI. Projects focused on FDI get people working closely with each other across traditional geographic boundaries. Here again, open organization principles will play an important role. + +### Communications + +When considering global communications, think of two broad categories: verbal communications and written communications. The former may involve, for example, telephone communications—simply having the ability to get on a telephone and affordably talk to someone anywhere on the globe. Even today, in many parts of the world, this is not technically possible. On top of that, language becomes a problem internationally, as many people aren't communicating in a common language. These issues are being addressed, but according to the 2019 DHL Global Connectedness Index, this has been more difficult to measure than in the past. Today, there are simply too many communication methods to make tracking this dimension as easy as it was in the past, and those methods seem to be increasing at an exponential rate. + +Thanks to proliferating internet access, written forms of communication are also increasing worldwide, but measuring, again, is more difficult to do. For this reason, I'd guess that the next real technological breakthrough will involve both foreign language electronic verbal communication (interpreting) and written communication (translating) software. This software is improving all the time, and could greatly contribute to global communications and information sharing between languages. This, then, will all lead to better integration and spread of open organization principles, as communications are sure to continue to increase worldwide. (Personally, I don't think this technology will replace person-to-person interaction, but could certainly support it.) + +### Travel/migration + +The last factor in the DHL Global Connectedness Index is the movement of people between countries. The first question to ask here is: "Why are people leaving a country and crossing borders? Why do people go from one country to another?" Reasons may include: for better education, for tourism purposes, for economic opportunities, and for safety (e.g., escaping war). Whatever the reason, it will determine how much people will interact with others in the host country. Wanting to go to a foreign country and being forced to leave one's home country are very different situations. The DHL Global Connectedness Index tries to measure factors like this. Open organization principles can be helpful here, particularly in community-building efforts, and in efforts to promote inclusivity. + +Although these factors are always shifting, people of the world will continue to communicate, collaborate, interact, and influence each other on an ever-expanding scale. + +And yet, if you study the DHL Global Connectedness Index, you will find that in all four measurements of trade, investment, communications and travel, the world is far less connected than it could be. More interaction still occurs within national borders than between countries. But as I will demonstrate in future articles of this series, global connectedness has a rather short history, relatively speaking, and we're still learning how best to collaborate and govern in a globally connected world. Understanding the role of open organization principles in this work will become even more important in the years ahead. + +### Think global, act local + +As we consider these issues and the impact open-style thinking can have on them, we'll naturally begin to ask: Where—and on what scale—should we begin addressing these problems? Are the issues _personal_, _local, national, or global_ in their scope and impact? + +As we'll see in future articles in this series, issues like these are often too complex to be confined to just one of those scales. That's why it's important to think about "[glocalization][6]" to address these issues by respecting both local concerns and global impact. + +Take the coronavirus for example. It impacts all humanity and requires [an open, global discussion applying open organization principles][7]. And global organizations, like the [World Health Organization (WHO)][8], will be involved in determining and communicating guidelines for combating the spread of COVID-19. But the issue is a personal one, too, as individuals learn new ways to take responsibility both for their health and the health of those around them. + +So, as we continue exploring the dimensions of the DHL Global Connectedness Index, we should remember that many issues cut across all scales of human activity—and that our responses, based on open principles, should also operate at multiple levels. They should be [_adaptive_ to their contexts][9]. + +In the next article, I'll examine a short history of globalization. Interestingly enough, open organization principles have been at work since the beginning. I'll discuss globalization up to the Industrial Revolution (around the 1800s). In a later installment, I will discuss the evolution of globalization from the Industrial Revolution to the present day. + +Armed with insight from the past, I want to offer proposals for moving forward on issues like pandemics, [climate change][10], global pollution, and others. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/open-organization/20/7/globalization-history-open + +作者:[Ron McFarland][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/ron-mcfarland +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/india-globe-map.jpg?itok=6sSEL5iO (India on the globe) +[2]: https://www.amazon.com/World-3-0-Global-Prosperity-Achieve/dp/142213864X +[3]: https://www.dhl.com/global-en/home/insights-and-innovation/thought-leadership/case-studies/global-connectedness-index.html +[4]: https://www.slideshare.net/RonMcFarland1/global-collaborating-create-prosperity?qid=ad57b725-174e-4cf2-8264-ac424a6ad814&v=&b=&from_search=22 +[5]: https://opensource.com/open-organization/resources/open-org-definition +[6]: https://en.wikipedia.org/wiki/Glocalization +[7]: https://opensource.com/open-organization/20/6/covid-alliance +[8]: https://www.who.int/ +[9]: https://opensource.com/open-organization/19/3/adaptive-leadership-review +[10]: https://opensource.com/open-organization/19/10/global-energy-climate-challenges diff --git a/sources/talk/20200727 Are newer medical IoT devices less secure than old ones.md b/sources/talk/20200727 Are newer medical IoT devices less secure than old ones.md new file mode 100644 index 0000000000..db3345b9d9 --- /dev/null +++ b/sources/talk/20200727 Are newer medical IoT devices less secure than old ones.md @@ -0,0 +1,72 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Are newer medical IoT devices less secure than old ones?) +[#]: via: (https://www.networkworld.com/article/3568608/are-newer-medical-iot-devices-less-secure-than-old-ones.html) +[#]: author: (Jon Gold https://www.networkworld.com/author/Jon-Gold/) + +Are newer medical IoT devices less secure than old ones? +====== +Legacy medical IoT devices may lack security features, but newer ones built around commodity components can have a whole different set of vulnerabilities that are better understood by attackers. +Thinkstock + +Experts differ on whether older connected medical devices or newer ones are more to blame for making healthcare networks more vulnerable to cyberattack. + +The classic narrative of insecure [IoT][1] centers on the integration of older devices into the network. In some industries, those devices pre-date the [internet][2], sometimes by a considerable length of time, so it’s hardly surprising that businesses face a lot of challenges in securing them against remote compromise. + +[[Get regularly scheduled insights by signing up for Network World newsletters.]][3] + +Even if those devices aren’t quite that old, they often lack key capabilities – in particular, remote software updates and configurable password protection – that would help IT staff defend them against modern threats. + +That might not be strictly true in regards to the medical field, according to Richard Staynings, chief security strategist for medical IoT security startup Cylera. There has, he argues, been an explosion in the number and variety of medical IoT devices in recent years, and many of those gadgets are at least as insecure as the true legacy equipment in the field. + +In some cases, said Staynings, the older devices might actually be considerably more secure than those of more recent vintage. In particular, those based on dated technology like older versions of electrically erasable programmable read-only memory (EEPROM). + +“The older systems were written in EEPROM – you need an EEPROM reader to mess with them,” he said. “The codebase is not on the Internet for hackers to look at, and you need physical access to the EEPROM to rewrite it.” + +In contrast, the newer devices frequently use software and hardware components that are much more familiar to potential attackers. “They’re more ubiquitous in their design and construction – they use [consumer off-the-shelf] operating systems, like Windows embedded, which is still being used believe it or not, and they are much more vulnerable to attack than a legacy system,” Staynings said. + +Insecurity in the current generation of medical IoT hardware also carries the potential for ongoing problems, not just immediate ones. While IT assets get replaced rapidly, IoT devices often have much longer replacement cycles. “Medical devices have the half-life of plutonium,” said Staynings. “They just don’t go away.” + +Other experts are less sold on Staynings’ characterization of the threat to medical IoT, arguing that the idea that newer devices pose a greater threat than older ones flies in the face of recent efforts to make them safer. Keith Mularski directs an advisory cybersecurity practice at Ernst and Young, and described Staynings’ assertion as “surprising,” noting that the regulatory landscape for connected medical devices is quickly moving standards in a positive direction. + +“The FDA has some pretty stringent guidelines that before devices can go to market, you need to put together threat modeling, so looking at security architecture, vectors, and so on ,and then in addition to that the FDA is getting ready to require third-party pen testing in premarket submissions,” said Mularski. “With legacy devices, those premarket submissions aren’t nearly as complete.” + +Mularski does concede that some particularly vulnerable old devices are often more isolated on the network by design, in part because they’re more recognizable as vulnerable assets. Windows 95-vintage x-ray machines, for example, are easy to spot as a potential target for a bad actor. + +“For the most part, I think most of the hospital environments, they do a good job at recognizing that they have these old deices, and the ones that are more vulnerable,” he said. + +This underlines a topic most experts on – simple awareness of the potential security flaws on a given network are central to securing healthcare networks. Greg Murphy is the CEO of Ordr, a network visibility and security startup based in Santa Clara. He said that both Mularski and Staynings have points in their favor. + +“Anyone who minimizes the issue of legacy devices needs to walk a mile in the shoes of the biomedical engineering department at a hospital,” he said. “[But] on the flipside, new devices that are being connected to the network have huge vulnerabilities themselves. Many manufacturers themselves don’t know what vulnerabilities their devices have.” + +The only real way to address the issues, said Murphy, is at the network level – trying to make everything secure at the device level might be a near-impossibility in many cases, and even getting an accurate picture of every device connected to a network often requires the use of an automated solution. + +“This is not a problem of human scale anymore,” he said. + +Both Mularski and Staynings concurred on this point, as well. Regardless of which devices on a particular network are the most vulnerable, it’s worth remembering that cybercriminals generally aren’t particular about what they compromise, as long as they’re able to gain access. + +“There may be an attacker that comes across these devices, runs a scan and happens to see [a vulnerability], but we really haven’t seen specific targeting of medical devices,” said Mularski. “It’s important to make sure that companies that have medical devices are enumerating their network, tracking their devices.” + +Join the Network World communities on [Facebook][4] and [LinkedIn][5] to comment on topics that are top of mind. + +-------------------------------------------------------------------------------- + +via: https://www.networkworld.com/article/3568608/are-newer-medical-iot-devices-less-secure-than-old-ones.html + +作者:[Jon Gold][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.networkworld.com/author/Jon-Gold/ +[b]: https://github.com/lujun9972 +[1]: https://www.networkworld.com/article/3207535/what-is-iot-the-internet-of-things-explained.html +[2]: https://www.networkworld.com/article/3410588/evolution-of-the-internet-celebrating-50-years-since-arpanet.html +[3]: https://www.networkworld.com/newsletters/signup.html +[4]: https://www.facebook.com/NetworkWorld/ +[5]: https://www.linkedin.com/company/network-world diff --git a/sources/talk/20200728 Green Data Centers - Scaling environmental sustainability for business and consumers collectively.md b/sources/talk/20200728 Green Data Centers - Scaling environmental sustainability for business and consumers collectively.md new file mode 100644 index 0000000000..88bc67ff05 --- /dev/null +++ b/sources/talk/20200728 Green Data Centers - Scaling environmental sustainability for business and consumers collectively.md @@ -0,0 +1,105 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Green Data Centers – Scaling environmental sustainability for business and consumers collectively) +[#]: via: (https://www.networkworld.com/article/3568670/green-data-centers-scaling-environmental-sustainability-for-business-and-consumers-collectively.html) +[#]: author: (QTS https://www.networkworld.com/author/Andy-Patrizio/) + +Green Data Centers – Scaling environmental sustainability for business and consumers collectively +====== +10 Tips for Choosing the Best Green Data Center +Regardless of how you identify politically, environmental sustainability has become an undeniable business directive. Global warming from carbon emissions, increasing sea levels and images of pollution are increasing public and shareholder pressure on corporations to take an active role in finding solutions and be accountable by setting goals and publicly documenting results. + +In the IT industry, reducing electrical power generation from fossil fuels is priority #1, followed closely by water conservation and waste management.   + +Multi-tenant data centers are one of the largest per capita consumers of electric power. Based on current estimates, data centers in the U.S. alone will consume approximately 73 thousand megawatts (MW) in 2020. + +To put this in perspective, one megawatt is enough to power 700 households. A single data center can use power equivalent to a small city and typically requires a significant amount of water for cooling. + +Worldwide, it’s estimated that data centers consume about three percent of the global electric supply and account for about two percent of total greenhouse gas (GHG) emissions. + +Data center efficiency and sustainability now transcends companies, geographies, and workloads. There is no simple solution and the challenge is compounded as massive digitization of data globally is creating a parallel demand for energy. + +IDC predicts the world’s data will grow from 33 zettabytes in 2017 to 175 zettabytes in 2025 and the amount of energy used by data centers continues to double every four years - meaning they have the fastest-growing carbon footprint of any area within the IT sector.  + +Technological advancements are difficult to forecast, but several models predict data center energy usage could surpass more than 10% of the global electricity supply by 2030 if left unchecked. + +For all of these reasons, the creation of green, sustainable, multi-tenant data centers has become essential in both an environmental and a business sense. Green data centers are built on pillars of commitments to innovative green and renewable strategies, water reclamation, recycling and waste management, and more. They do not contain obsolete systems (such as inactive or underused servers), and take advantage of newer, more efficient technologies. + +Taking cues from the hyperscale data center operators, green data centers recognize the need to lead with modular energy efficient data center designs from the onset, adopt the latest in building technology and influence the overall supply chain for the actual sourcing of materials for these green data centers. + +Benefits such as cost reduction, increased efficiency and knowledge that you are a better corporate citizen are obvious. What is not readily apparent is that by moving into a green multi-tenant data center, sustainability benefits are also passed on to the businesses and consumers who collectively benefit from the data center’s green IT infrastructure. + +The economies of scale are extremely significant. Instead of a business (such as a large online retailer) attempting to deploy its own green IT environment to power its service delivery, it outsources it to the green data center that can do it cheaper and better. The sustainability benefits are then passed along to all the consumers using its services and there could be hundreds of businesses like this in a single  green data center. + +In addition, when you deal with a true green data center that is serious about sustainability, the benefits go far beyond the requirement that your power be renewable. There are environmental and philanthropic benefits that can be linked with your outsourced IT infrastructure. + +The best green data center operators are starting to formally document and report their progress in Environmental, Social and Governance (ESG) reports made public annually. For conventional enterprises and data centers that do not have measurable sustainability as part of their governance, it is coming. + +[QTS][1]  is one of a few data center companies holding themselves accountable as global citizens and committing to sustainability best practices that are impactful, achievable and will ultimately set the standard for the data center industry in the years to come. + +QTS has committed to minimizing its data center carbon footprint utilizing as much renewable fuel, reclaimed water and recycled materials as possible by implementing a methodic sustainability approach featuring energy efficiency measures and renewable energy procurement, all backed by continuous innovation. + +Knowing that transparency is fundamental to accountability, QTS is documenting and publicly reporting on sustainability goals, metrics and best practices – one of only a few data center companies to do so. + +To support this, QTS’ recently published its second Environmental, Social and Governance (ESG) Initiatives report ([accessed here][2]) that documents the industry’s first formal commitment to provide 100% renewable energy across all of its data centers by 2025. + +In 2019, QTS won numerous awards including the coveted GRESB benchmark ranking QTS as the #1 sustainable data center company among all data centers globally for its ESG initiatives. + +Today QTS has seven data centers running on 100% renewable energy. Approximately 30% of its overall data center power requirements are now sourced from renewable energy sources, representing over 300 million kilowatt-hours (kWh) of renewable power. [According to the EPA][3], this makes QTS one of the largest users of green power among all data center companies and the 12th largest user among Top Tech & Telecom companies.  + +**10 Tips for Choosing a Green Data Center** + +For those operating on-premises legacy data centers looking to move into green data centers, or for organizations already outsourcing to a less than green provider, following are 10 tips when evaluating green data center providers. + + * Check the providers’ ESG scores and reviews from ranking organizations such as GRESB, The Carbon Disclosure Project (CDP), RE100, the EPA Green Power Partnership, Sustainalytics and look for documented commitments to 100% renewable energy. + + + * Look for innovation in power such as the use of AI to forecast power consumption, analyze data output, humidity, temperature, and other important statistics for improving efficiency, drive down costs, and reduce total power consumption. + + + * Check the EPA Green Power ranking to find the data centers leading in renewable power commitments. + * Look for industry-first zero water cooling solutions powered by 100% renewable wind and solar power. + + + * Renewable energy should impactful and cost effective. Look for data centers with innovative power procurement models that allow it purchase renewable energy on parity or below the price of conventionally produced power. + + + * Look for innovative companies that create an open dialogue with customers to gather feedback on sustainability initiatives and help the customers meet their ESG goals. + + + * Look for data center operators that work closely with utilities to develop tariffs and legislation that make it easier and more cost effective for everyone to procure renewable energy. + + + * Look for providers with innovative philanthropic programs such as the “Grow with QTS” program that plants more than 20,000 trees in the Sierra Mountains every year on behalf of its customers, or its HumanKind program that promotes clean water solutions in developing regions. + + + * Look for providers actively speaking and participating with leading organizations such as the EPA’s Green Power Partnership, REBA, the Data Center Coalition’s energy committee and RE100. + + + * Look for providers touting on-site physical features such as smart temperature and lighting controls, rainwater reclamation, recycling and waste initiatives, and EV charging stations. + + + +No industry, nor individual company, is perfect. But, when necessary, it can align around a core set of principles that benefit themselves, their communities and generations to come. The threat of global climate change makes it impossible for data center providers to ignore their roles in the global concern. Committing to action today, as a unified industry, benefits all. + +The fact that so many businesses are more environmentally aware means that contemplating what green, sustainable data centers can offer is becoming an increasingly important standard for choosing a data center provider. + +-------------------------------------------------------------------------------- + +via: https://www.networkworld.com/article/3568670/green-data-centers-scaling-environmental-sustainability-for-business-and-consumers-collectively.html + +作者:[QTS][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.networkworld.com/author/Andy-Patrizio/ +[b]: https://github.com/lujun9972 +[1]: https://www.qtsdatacenters.com/ +[2]: https://www.qtsdatacenters.com/resources/brochures/esg-initiatives-2019 +[3]: https://www.epa.gov/greenpower/green-power-partnership-top-30-tech-telecom diff --git a/sources/talk/20200729 Switch turns to Tesla for renewable energy storage.md b/sources/talk/20200729 Switch turns to Tesla for renewable energy storage.md new file mode 100644 index 0000000000..dfbcdb7320 --- /dev/null +++ b/sources/talk/20200729 Switch turns to Tesla for renewable energy storage.md @@ -0,0 +1,62 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Switch turns to Tesla for renewable energy storage) +[#]: via: (https://www.networkworld.com/article/3568358/switch-turns-to-tesla-for-renewable-energy-storage.html) +[#]: author: (Andy Patrizio https://www.networkworld.com/author/Andy-Patrizio/) + +Switch turns to Tesla for renewable energy storage +====== +Switch will power its massive data centers with solar energy and use Tesla Megapacks for large-scale energy storage. +ipopba / Getty Images + +Data center provider [Switch][1] has selected Tesla as the battery supplier for a massive solar project at its northern Nevada data center facilities. + +It's a geographically easy alliance as Switch's campus is right near Tesla's [Gigafactory Nevada][2] manufacturing facility. While best known for its cars, Tesla has also made quite an entry in the battery space with products such as the Powerwall, Powerpack, and Megapack energy storage products. + +Switch recently broke ground on Gigawatt 1, a huge project that will use solar panels from First Solar to generate a total of 555 megawatts (MWs) of power at three locations and Tesla Megapacks to store the energy. + +**READ MORE:** [Data-center power consumption holds steady][3] + +Data centers are frequently built close to renewable sources of energy, usually hydropower. That's why many Amazon, Google, Facebook and Microsoft data centers are sitting by rivers. Solar is the easiest form of power to collect, but it's also the most fickle. Solar-powered sites are at the mercy of darkness and cloudy days, and users don't care if it's overcast out. + +Adam Kramer, executive vice president of strategy at Switch, says peak solar production is around 1 p.m. when the sun is overhead, but overall peak consumer demand is around 5 p.m. to 6 p.m., when the sun is either setting or has set, depending on the time of year. + +In running a [data center][4], there are no peak hours. "The Internet is 24/7. If they aren't using it in New York, they are using it in L.A. We have a very flat power profile. Our load looks the same at 2 a.m. as it does at 2 p.m.," Kramer told me. ** +** + +With solar, and especially in Nevada, Switch had "an overabundance of solar generation but nowhere to store it. During the day we generate max power but [have] no need to use it." + +Advances in Tesla battery storage are a key piece of the puzzle. Switch has been running on 100% solar power since 2016 but couldn't store it because "the technology just wasn't there for it," Kramer says. + +Enter Tesla's Megapack. The Megapack is a beefed-up version of the Tesla PowerWall used for individual homes to store solar power and the PowerPack technology Tesla uses in its electric vehicles. Each Megapack can hold up to three megawatt hours (MWhs) of storage and 1.5 MW of inverter capacity. + +So with enough Megapacks, sunlight energy captured at 1 p.m. can be powering the data center at 1 a.m. + +Kramer says this benefits not only Switch but also its customers. "We are able to lock in extremely competitive pricing for switching our clients for the long-term and not be subject to market volatility. When we're able to reduce our cost, it provides cost savings for all our clients," he says. + +So if Switch can power its massive data centers with solar energy even when the sun does not shine, why can't you? + +Join the Network World communities on [Facebook][5] and [LinkedIn][6] to comment on topics that are top of mind. + +-------------------------------------------------------------------------------- + +via: https://www.networkworld.com/article/3568358/switch-turns-to-tesla-for-renewable-energy-storage.html + +作者:[Andy Patrizio][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.networkworld.com/author/Andy-Patrizio/ +[b]: https://github.com/lujun9972 +[1]: https://www.switch.com/ +[2]: https://www.tesla.com/gigafactory +[3]: https://www.networkworld.com/article/3531316/data-center-power-consumption-holds-steady.html +[4]: https://www.networkworld.com/article/3223692/what-is-a-data-centerhow-its-changed-and-what-you-need-to-know.html +[5]: https://www.facebook.com/NetworkWorld/ +[6]: https://www.linkedin.com/company/network-world diff --git a/sources/talk/20200730 4 ways I contribute to open source as a Linux systems administrator.md b/sources/talk/20200730 4 ways I contribute to open source as a Linux systems administrator.md new file mode 100644 index 0000000000..2850fc614c --- /dev/null +++ b/sources/talk/20200730 4 ways I contribute to open source as a Linux systems administrator.md @@ -0,0 +1,70 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (4 ways I contribute to open source as a Linux systems administrator) +[#]: via: (https://opensource.com/article/20/7/open-source-sysadmin) +[#]: author: (Elizabeth K. Joseph https://opensource.com/users/pleia2) + +4 ways I contribute to open source as a Linux systems administrator +====== +You don't have to be a coder to make valuable contributions to the open +source community; here are some other important roles you can fill as a +sysadmin. +![open source button on keyboard][1] + +I recently participated in The Linux Foundation Open Source Summit North America, held virtually June 29-July 2, 2020. In the course of that event, I had the opportunity to speak with a fellow attendee about my career in Linux systems administration and how it had led me to a career focused on [open source][2]. Specifically, he asked, how does a systems administrator who doesn't do a lot of coding participate in open source projects? + +That's a great question! + +A lot of focus in open source projects is placed on the actual code, but there's a lot more to it than that. The following are some ways that I've been deeply involved in open source projects, without writing code. + +### Improving documentation + +I got my official start in open source by rewriting a quickstart guide for a project I used heavily. We spend most of our time using software in production and at scale. We routinely run into configuration gotchas and edge cases, and we often privately develop best practices for managing services effectively. + +Inevitably, we run into things that aren't documented, have out of date documentation, or need improvements to the documentation to be made. This is a great opportunity! The developers and documentation writers are often unaware of these issues, and you have the key to solving them. Typically it starts with a bug report to the documentation project, but if you know the answer, you can often submit a patch to the documentation to improve it. + +### Contributing "recipes" + +We often spend too much time reinventing the wheel when we're launching common services. I remember my early days of slogging through MySQL configuration files to figure out the best settings for the databases for a particular customer. Today, a lot of that has been simplified, allowing us to use Ansible playbooks, Puppet modules, and more to get a basic configuration going. This is a place where you can contribute! Whether it's an official "recipe" you contribute to the appropriate hub or a sample rundown of your configuration or architecture diagram of Logstash, sharing your expertise in the form of examples can be incredibly helpful to others who are facing the same configuration challenges. + +### Hosting project resources + +I spent part of my career as a full-time systems administrator, directly working on hosting project resources for OpenStack, an infrastructure that is fully open source—every config file and Puppet change is done through public code review and tracked in a public Git repository. There are several projects out there that host their infrastructures in an open source manner, many of which are listed on the [Open Source Infrastructure (#openinfra) homepage][3]. These range from KDE and Debian to the Apache Software Foundation. In these communities, external participants can submit improvements to the infrastructure as their time and expertise allow. Since a lot of this is peer-reviewed, it's also a nice opportunity to build your skills in areas you may not be strictly focused on at work. + +I've also done work on specific projects where the need was not broadcasted but was clear once I joined the community. For instance, one of my Linux communities needed a place to host a development website environment so we could try out new plugins and features outside of our production environment. We also found that giving shell accounts to participants was a valuable way to make sure they were always connected to IRC and had a sandbox beyond their own desktop. I now manage two virtual servers for this project to address these needs and have built up my own little systems team inside the project, so I'm not the only administrator. + +### Supporting your fellow users + +As someone who is using software in production, your operational experience is essential to a thriving support outlet, so don't be shy. Participation in user forums, mailing lists, and chat may seem like something that only experts can do, but regardless of your level, you will always have more experience than someone who just started out. A newcomer to the space can help out with simple questions, and give the more experienced participants the energy to answer more complicated questions. The more experience you gain, the more involved you can get in the community. + +### Be a better sysadmin by contributing + +Whatever way you decide to participate, the value gained from contributing to open source projects as a [systems administrator][4] cannot be understated. Your contributions will be noticed by members of the community, and often result in opportunities to chat on the latest project podcast, sit for an interview on the project blog, or speak at an event. All of these things raise your profile in the project as someone who is knowledgeable about the technology. You can also point to your public expertise when you're interviewing for your next role, having a public track record of giving advice in a project where a company is looking for expertise is a huge vote in your favor. + +Finally, I've also found that participating in open source projects to be tremendously valuable on a personal level. I feel good about contributing to the community, and it's rewarding to know that your expertise is valuable to folks outside the walls of your organization. + +Looking for a place to start? Find the communities behind the open source technology you already use and love. Or, if you're looking for a place to [write][5], you've found it here at Opensource.com. + +You don't need to be a master coder to contribute to open source. Jade Wang shares 8 ways you can... + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/7/open-source-sysadmin + +作者:[Elizabeth K. Joseph][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/pleia2 +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/button_push_open_keyboard_file_organize.png?itok=KlAsk1gx (open source button on keyboard) +[2]: https://opensource.com/resources/what-open-source +[3]: https://opensourceinfra.org/ +[4]: https://opensource.com/article/19/7/be-a-sysadmin +[5]: https://opensource.com/how-submit-article diff --git a/sources/talk/20200730 Role Of SPDX In Open Source Software Supply Chain.md b/sources/talk/20200730 Role Of SPDX In Open Source Software Supply Chain.md new file mode 100644 index 0000000000..ccae1f1e2d --- /dev/null +++ b/sources/talk/20200730 Role Of SPDX In Open Source Software Supply Chain.md @@ -0,0 +1,84 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Role Of SPDX In Open Source Software Supply Chain) +[#]: via: (https://www.linux.com/audience/developers/role-of-spdx-in-open-source-software-supply-chain/) +[#]: author: (Swapnil Bhartiya https://www.linux.com/author/swapnil/) + +Role Of SPDX In Open Source Software Supply Chain +====== + +Kate Stewart is a Senior Director of Strategic Programs, responsible for the Open Compliance program at the Linux Foundation encompassing SPDX, OpenChain, Automating Compliance Tooling related projects. In this interview, we talk about the latest release and the role it’s playing in the open source software supply chain. + +*Here is a transcript of our interview. * + +Swapnil Bhartiya: Hi, this is Swapnil Bhartiya, and today we have with us, once again, Kate Stewart, Senior Director of Strategic Programs at Linux Foundation. So let’s start with SPDX. Tell us, what’s new going on in there in this specification? + +Kate Stewart: Well, the SPDX specification just a month ago released auto 2.2 and what we’ve been doing with that is adding in a lot more features that people have been wanting for their use cases, more relationships, and then we’ve been working with the Japanese automotive-made people who’ve been wanting to have a light version. So there’s lots of really new technology sitting in the SPDX 2.2 spec. And I think we’re at a stage right now where it’s good enough that there’s enough people using it, we want to probably take it to ISO. So we’ve been re-formatting the document and we’ll be starting to submit it into ISO so it can become an international specification. And that’s happening. + +Swapnil Bhartiya: Can you talk a bit about if there is anything additional that was added to the 2.2 specification. Also, I would like to talk about some of the use cases since you mentioned the automaker. But before that, I just want to talk about anything new in the specification itself. + +Kate Stewart: So in the 2.2 specifications, we’ve got a lot more relationships. People wanted to be able to handle some of the use cases that have come up from containers now. And so they wanted to be able to start to be able to express that and specify it. We’ve also been working with the NTIA. Basically they have a software bill of materials or SBoM working groups, and SPDX is one of the formats that’s been adopted. And their framing group has wanted to see certain features so that we can specify known unknowns. So that’s been added into the specification as well. + +And then there are, how you can actually capture notices since that’s something that people want to use. The license has called for it and we didn’t have a clean way of doing it and so some of our tool vendors basically asked for this. Not the vendors, I guess there are partners, there are open source projects that wanted to be able to capture this stuff. And so we needed to give them a way to help. + +We’re very much focused right now on making sure that SPDX can be useful in tools and that we can get the automation happening in the whole ecosystem. You know, be it when you build a binary to ship to someone or to test, you want to have your SBoM. When you’ve downloaded something from the internet, you want to have your SBoM. When you ship it out to your customer, you want to be able to be very explicit and clear about what’s there because you need to have that level of detail so that you can track any vulnerabilities. + +Because right now about, I guess, 19… I think there was a stat from earlier in the year from one of the surveys. And I can dig it up for you if you’d like, but I think 99% of all the code that was scanned by Synopsys last year had open source in it. And of which it was 70% of that whole build materials was open source. Open source is everywhere. And what we need to do is, be able to work with it and be able to adhere to the licenses, and transparency on the licenses is important as is being able to actually know what you have, so you can remediate any vulnerabilities. + +Swapnil Bhartiya: You mentioned a couple of things there. One was, you mentioned tooling. So I’m kind of curious, what sort of tooling that is already there? Whether it’s open source or open source be it basically commercialization that worked with the SPDX documents. + +Kate Stewart: Actually, I’ve got a document that basically lists all of these tools that we’ve been able to find and more are popping up as the day goes by. We’ve got common tools. Like, some of the Linux Foundation projects are certainly working with it. Like FOSSology, for instance, is able to both consume and generate SPDX. So if you’ve got an SPDX document and you want to pull it in and cross check it against your sources to make sure it’s matching and no one’s tampered with it, the FOSSology tool can let you do that pretty easily and codes out there that can generate FOSSology. + +Free Software Foundation Europe has a Lindt tool in their REUSE project that will basically generate an SPDX document if you’re using the IDs. I guess there’s actually a whole bunch more. So like I say, I’ve got a document with a list of about 30 to 40, and obviously the SPDX tools are there. We’ve got a free online, a validator. So if someone gives you an SPDX document, you can paste it into this validator, and it’ll tell you if it’s a valid SPDX document or not. And we’re looking to it. + +I’m finding also some tools that are emerging, one of which is decodering, which we’ll be bringing into the Act umbrella soon, which is looking at transforming between SPDX and SWID tags, which is another format that’s commonly in use. And so we have tooling emerging and making sure that what we’ve got with SPDX is usable for tool developers and that we’ve got libraries right now for SPDX to help them in Java, Python and Go. So hopefully we’ll see more tools come in and they’ll be generating SPDX documents and people will be able to share this stuff and make it automatic, which is what we need. + +Another good tool, I can’t forget this one, is Tern. And actually Tern, and so what Tern does is, it’s another tool that basically will sit there and it will decompose a container and it will let you know the bill of materials inside that container. So you can do there. And another one that’s emerging that we’ll hopefully see more soon is something called OSS Review Toolkit that goes into your bill flow. And so it goes in when you work with it in your system. And then as you’re doing bills, you’re generating your SBoMs and you’re having accurate information recorded as you go. + +As I said, all of this sort of thing should be in the background, it should not be a manual time-intensive effort. When we started this project 10 years ago, it was, and we wanted to get it automated. And I think we’re finally getting to the stage where it’s going to be… There’s enough tooling out there and there’s enough of an ecosystem building that we’ll get this automation to happen. + +This is why getting it to ISO and getting the specification to ISO means it’ll make it easier for people in procurement to specify that they want to see the input as an SPDX document to compliment the product that they’re being given so that they can ingest it, manage it and so forth. But by it being able to say it’s an ISO standard, it makes the things a lot easier in the procurement departments. + +OpenChain recognized that we needed to do this and so they went through and… OpenChain is actually the first specification we’re taking through to ISO. But for SPDX, we’re taking it through as well, because once they say you need to follow the process, you also need some for a format. And so it’s very logical to make it easy for people to work with this information. + +Swapnil Bhartiya: And as you’ve worked with different players, different of the ecosystem, what are some of the pressing needs? Like improve automation is one of those. What are some of the other pressing needs that you think that the community has to work on? + +Kate Stewart: So some of the other pressing needs that we need to be working on is more playbooks, more instructions, showing people how they can do things. You know, we figured it out, okay, here’s how we can model it, here’s how you can represent all these cases. This is all sort of known in certain people’s heads, but we have not done a good job of expressing to people so that it’s approachable for them and they can do it. + +One of the things that’s kind of exciting right now is the NTIA is having this working group on these software bill of materials. It’s coming from the security side, but there’s various proof of concepts that are going on with it. One of which is a healthcare proof of concept. And so there’s a group of about five to six device manufacturers, medical device manufacturers that are generating SBoMs in SPDX and then there are handing them into hospitals to go and be able to make sure they can ingest them in. + +And this level of bringing people up to this level where they feel like they can do these things, it’s been really eye-opening to me. You know, how much we need to improve our handholding and improve the infrastructure to make it approachable. And this obviously motivates more people to be getting involved. From the vendors and commercial side, as well as the open source, but it wouldn’t have happened, I think, to a large extent for SPDX without this open source and without the projects that have adopted it already. + +Swapnil Bhartiya: Now, just from the educational awareness point of view, like if there’s an open source project, how can they easily create SBoM documents that uses the SPDX specification with their releases and keep it synced? + +Kate Stewart: That’s exactly what we’d love to see. We’d love to see the upstream projects basically generate SPDX documents as they’re going forward. So the first step is to use the SPDX license identifiers to make sure you understand what the licensing should be in each file, and ideally you can document with eTags. But then there’s three or four tools out there that actually scan them and will generate an SPDX document for you. + +If you’re working at the command line, the REUSE Lindt tool that I was mentioning from Free Software Foundation Europe will work very fast and quickly with what you’ve got. And it’ll also help you make sure you’ve got all your files tagged properly. + +If you haven’t done all the tagging exercising and you wonder [inaudible 00:09:40] what you got, a scan code works at the command line, and it’ll give you that information as well. And then if you want to start working in a larger system and you want to store results and looking things over time, and have some state behind it all so like there’ll different versions of things over time, FOSSology will remember from one version to another and will help you create these [inaudible 00:10:01] off of bill materials. + +Swapnil Bhartiya: Can you talk about some of the new use cases that you’re seeing now, which maybe you did not expect earlier and which also shows how the whole community is actually growing? + +Kate Stewart: Oh yeah. Well, when we started the project 10 years ago, we didn’t understand containers. They weren’t even not on the raw mindset of people. And there’s a lot of information sitting in containers. We’ve had some really good talks over the last couple of years that illustrate the problems. There was a report that was put out from the Linux Foundation by Armijn Hemel, that goes into the details of what’s going on in containers and some of the concerns. + +So being able to get on top of automating, what’s going on with concern inside a container and what you’re shipping and knowing you’re not shipping more than you need to, figuring out how we can improve these sorts of things is certainly an area that was not initially thought about. + +We’ve also seen a tremendous interest in what’s going on in IOT space. And so that you need to really understand what’s going on in your devices when they’re being deployed in the field and to know whether or not, effectively is vulnerability going to break it, or can you recover? Things like that. The last 10 years we’ve seen tremendous spectrum of things we just didn’t anticipate. And the nice thing about SPDX is, you’ve got a use case that we’re not able to represent. If we can’t tell you how to do it, just open an issue, and we’ll start trying to figure it out and start to figure if we need to add fields in for you or things like that. + +Swapnil Bhartiya:  Kate, thank you so much for taking your time out and talking to me today about this project. +-------------------------------------------------------------------------------- + +via: https://www.linux.com/audience/developers/role-of-spdx-in-open-source-software-supply-chain/ + +作者:[Swapnil Bhartiya][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://www.linux.com/author/swapnil/ +[b]: https://github.com/lujun9972 diff --git a/sources/talk/20200730 SODA Foundation- Autonomous data management framework for data mobility.md b/sources/talk/20200730 SODA Foundation- Autonomous data management framework for data mobility.md new file mode 100644 index 0000000000..d24d523369 --- /dev/null +++ b/sources/talk/20200730 SODA Foundation- Autonomous data management framework for data mobility.md @@ -0,0 +1,67 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (SODA Foundation: Autonomous data management framework for data mobility) +[#]: via: (https://www.linux.com/audience/developers/soda-foundation/) +[#]: author: (Swapnil Bhartiya https://www.linux.com/author/swapnil/) + +SODA Foundation: Autonomous data management framework for data mobility +====== + +SODA Foundation is an open source project under Linux Foundation that aims to establish an open, unified, and autonomous data management framework for data mobility from the edge, to core, to cloud. We talked to Steven Tan, SODA Foundation Chair, to learn more about the project. + +_Here is a transcript of the interview:_ + +Swapnil Bhartiya: Hi, this is Swapnil Bhartiya, and today we have with us Steven Tan, chair of the SODA foundation. First of all, welcome to the show. +Steven Tan: Thank you. + +Swapnil Bhartiya: Tell us a bit about what is SODA? +Steven Tan: The foundation is actually a collaboration among vendors and users to focus on data management for, how do you call, autonomous data mesh management. And the point of this whole thing is how do we serve the users? Because a lot of our users are getting a lot of data challenges, and that’s what this foundation is for. To get users and vendors together to help to address these data challenges. + +Swapnil Bhartiya: What kind of data are we talking about? +Steven Tan: The data that we’re talking about is referring to anything like data protection, data governance, data replication, data copy management and stuff like that. And also data integration, how to connect the different data silos and stuff. + +Swapnil Bhartiya: Right. But are we talking about enterprise data or are we talking consumer data? Like there is a lot of data with Facebook, Google, and Gmail, and then there are a lot of enterprise data, which companies … Sorry, as an enterprise, I might put something on this cloud, I can put it on this cloud. So can you please clarify what data are we talking about? +Steven Tan: Actually, the data that we’re talking about is … It depends on the users. There’re all kinds of data. Like for example, I mean, in the keynote that I gave two days ago, the example I gave was from Toyota. So Toyota use case is actually car data. So car data refers to things like the car sensor data, videos, map data and stuff. And then we have users like China Unicom. I mean, they have enterprise companies going to the cloud and so on. So they’ve all kinds of enterprise data over there. And then we also have other users like Yahoo Japan, and they have like a website. So the data that you’re talking about is web data, consumer data and stuff like that. So it’s across the board. + +Swapnil Bhartiya: Oh, so it’s not as specific to an industry or any space or sector, okay. But why do you need it? What is the problem that you see in the market and in the current sphere that you’re like, hey, we should create something like that? +Steven Tan: So the problem that came, I mean the reason why all these companies came together is that they are building data centers that are from small to big. But a lot of the challenges that you have is like, it’s hard for a single project to address. It’s not like a business where we have a specific problem and then we need this to be solved and so on, it’s not like that. A lot of it is like, how do you connect the different pieces together in the data center together? +So there’s nothing like, no organization like that that can help them solve this kind of problem. Like how do you have, in order to address the data of … Or how do you address things like taking care of data protection and data privacy at the same time? And at the same time, you want to make sure that this data can be governed properly. So there isn’t any single organization that can help to take care of this kind of stuff, so we’re helping these users understand their problems and then come together and then we plan projects and roadmaps based on their problems and try to address them through these projects in the SODA foundation. + +Swapnil Bhartiya: And you gave an example of data from the cars and all these things. Does that also mean that open source has helped solving a lot of problems by breaking down a lot of silos so that there’s a lot of interaction between different silos, which were like earlier separated and isolated? Today, as you mentioned, we are living in a data driven world. No matter what we do all the way from the Ring, to what we are doing right now, talking to each other, to the product that we’ll create in the end. But most of this data is living in their own silos. There may be a lot of value in that data, which cannot be extracted because one, it is locked into the silos. The second problem is that these days, data is kind of becoming the next oil. These companies are trying to capture all the data, irrespective of the fact of what value do they see in that data today? And by leveraging machine learning and deep learning, they can in the future … So how do you look at that, and how is SODA foundation going to break those silos, without compromising on our privacy, yet allow companies … Because the fact is, as much as I prefer my privacy, I also want Google Maps to tell me the fastest route where I want to go. +Steven Tan: Right. So I think there are certain, I mean, there are different levels of privacy that we’re going to take care of. And in terms of like, first of all, there are all kinds of … I mean, in terms of the different countries or different States or different provinces like in different countries, there are different kinds of regulations and so on. So first of all, like the data silos you talk about. Yes, that’s one of the key problems that we’re trying to solve. How to connect all the different data silos so as to reduce fragmentation, and then try to minimize the so called dark data that you’re talking about, and then extract all the values over there. So that’s one of the things that we try to get here. I mean, we try to connect all the different pieces, like in the different … The data may be sitting in the edge in the data center or different data centers and in the cloud. We try to connect all these pieces together. + +I mean, that’s one of the first things that we tried to do. And then we tried to have data policies. I think this is a critical piece of things that a lot of the solutions out there don’t address. You have data policies, but it may be the data policies just for a single vendor solution. But once the data gets out, that solution then is out of control. So what we’re trying to do here is say, how do you have data policies across different solutions, so no matter where the data is it’s governed the same way, consistently? That’s the key. So then you can talk about how can you really protect the data in terms of privacy or govern the data or control the data? And in terms of the, I mentioned about the regions, right? So you know where the data is, and you know what kind of regulations that need to be taken care of and you apply it right there. That’s how it should work. + +Swapnil Bhartiya: When we look at the kind of a scenario you talked about, I see it as two-fold. One is there is a technology problem and the second is people problem. So is SODA foundation going to deal with both, or are you going to just deal with the technology aspect of it? +Steven Tan: The technology part that we talk about, we try to define in terms of the API and so on to all the data policies and so on, and try to get as many companies to support this as possible. And then the next thing that we try to do is actually try to work with standards organizations to try to make this into a standard. I mean, that’s what we’re trying to do here. + +And then government aspects, there are certain organizations that we are talking to. Like there’s the CESI, it’s China Electronic Standards organizations that we’re talking to that’s trying to work things into their … Actually, I’m not sure about China, because it’s, I mean, we don’t know about their sphere of influence within the CSI and so on. And then for the industry standards, there’s [inaudible 00:09:05] and so on, we’re trying to work with them and trying to get it to work. + +Swapnil Bhartiya: Can we talk about the ecosystem that you’re trying to build around SODA foundation? One would be the participants who are actually contributing either the code or the vision, and then the users community who would actually be benefiting from it? +Steven Tan: So the ecosystem that we are trying to build, that’s the core part, which is actually the framework. So the framework, I mean, this part will be more of the data vendors or the storage vendors that will be involved in trying to build this ecosystem. And then the outer part, what I call the outer part of the ecosystem will be things like the platforms. Things like Kubernetes, VMware, all these different vendors, and then networking kind of stuff that you need to take care of like the big data analytics and stuff. + +And then for the users, actually, if you can see from the SODA end-user advisory committee, I mean, that’s where most of our users are participating in the communication. So most of these users, I mean, they are from different regions and different countries and different industries. So we try to serve, I mean, whichever participant is interested in, they can participate in this thing. But the main thing is that because they may be from different industries, but actually most of the issues that they have is still the same thing. So there are some commonalities among all these users. + +Swapnil Bhartiya: We are in the middle of 2020, because of COVID-19 everything has slowed down, things have changed. What does your roadmap, what does your plan look like? The structure, the governance and the plan for ’21 or end of the year? +Steven Tan: We are very, how do you call it? Very community-driven or focused kind of organization. We hold a lot of meetups and events and so on where we get together the users and the vendors and so on and the community in general. So with this COVID-19 thing, a lot of the plans has been upset. I mean, it’s in chaos right now. So most of the things are like what everybody is doing, moving online. So we are having some webinars and stuff, even as of right now when we are talking, we are having a mini summit going on with the Open Source Summit North America right now. + +So for the rest of this year, most of our events will be online. We’re going to have some webinars and some meetups, you can find it out from our website. And the other plans that we have is that we are going to have, we just released the SODA federal release, which is the 1.0 release. And through the end of this year, we’re going to have two more releases, the G release and the H release at the end of this year. G release is going to be in September, and H is in the end of the year. And we’re trying to engage our users with things like the POC testing for the federal. Because each release that we have, we try to get them to do the testing, and then so that’s the way of them trying to provide feedback to us. Whether that works for them or how can we improve to make the code work for what they need. + +Swapnil Bhartiya: Awesome. So thank you so much for taking your time out and explaining more about SODA foundation, and I look forward to talking to you again because I can see that you have a very exciting pipeline ahead. So thank you. +Steven Tan: Thank you, thank you very much. +-------------------------------------------------------------------------------- + +via: https://www.linux.com/audience/developers/soda-foundation/ + +作者:[Swapnil Bhartiya][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://www.linux.com/author/swapnil/ +[b]: https://github.com/lujun9972 diff --git a/sources/talk/20200731 Linux dominates supercomputing.md b/sources/talk/20200731 Linux dominates supercomputing.md new file mode 100644 index 0000000000..6648bcfba1 --- /dev/null +++ b/sources/talk/20200731 Linux dominates supercomputing.md @@ -0,0 +1,76 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Linux dominates supercomputing) +[#]: via: (https://www.networkworld.com/article/3568616/linux-dominates-supercomputing.html) +[#]: author: (Sandra Henry-Stocker https://www.networkworld.com/author/Sandra-Henry_Stocker/) + +Linux dominates supercomputing +====== +The Linux operating system runs all 500 of the world’s fastest supercomputers, which help to advance artificial intelligence, machine learning and even COVID-19 research. +Wikipedia + +In addition to all its other successes, Linux dominates supercomputing: All 500 of the worlds fastest supercomputers run Linux, and that has been the case since November 2017, according to the [TOP500][1] organization, which has been ranking the 500 most powerful computer systems since 1993. (A graph of Linux' ascension is available on [here][2].) + +How did this happen? + +[[Get regularly scheduled insights by signing up for Network World newsletters.]][3] + +### A little history + +Linux began life in 1991 as the personal project of 21-year-old Finnish student Linus Torvalds. I first became aware of it several years later while working at Johns Hopkins University’s physics and astronomy department where I managed the department’s network and a number of servers with the help of a couple grad students. + +At the time, I was intrigued by Linux, but couldn’t imagine how dominant the OS would become simply because its source code was available to anyone who wanted to work with it. I could not forsee that a significant group of large companies would grasp its value, work together and innovate to make Linux what it is today. Intense collaboration was key to this success, including contributions from countless individuals and organizations that includes IBM, Intel, NVIDIA, Red Hat, Samsung, SUSE and many others. (Browsing the [corporate members of the Linux Foundation][4] is likely to make your jaw drop.) + +The success of Linux can also be attributed to the fact that it is open source, non-proprietary, and extendable. + +### The TOP500 + +Twice a year, in June and November, TOP500 releases it a list of the 500 most powerful computer systems ranked by their performance on something called the [LINPACK Benchmark][5], which calls for the computer being tested to solve a dense system of linear equations. + +I have heard it said, though not been able to verify, that Linux runs on more than 90% of public clouds, more than 60% of embedded systems and IoT devices, as much as 99% of supercomputers and more than 80% of smartphones. If these claims are even close to the truth, it attests to the success and versatility of Linux + +In [the most recent TOP500 ranking][6], a Japanese supercomputer name [Fugaku][7] (derived from an alternate name for Mount Fuji) has taken the top spot and pushed the former leaders down a rank. Fugaku was co-developed by Riken and Fujitsu and uses Fujitsu's 48-core A64FX ARM chip. This is the first time a computer based on ARM processors has topped the list. + +The computer was fully assembled only in May but has already helped fight COVID-19 by sorting through more than 2,000 drugs that might effectively block the virus and found a dozen that show promise. + +### Containerization, AI and ML + +Recently I had a chance to discuss Linux with Stefanie Chiras, vice president and general manager of the Red Hat Enterprise Linux business unit. She sees Linux as tightly linked to supercomputing because it provides the scale and flexibility to support high-performance computing and exascale computing systems – those that are capable of calculating at least 1,018 floating point operations per second (1 exaFLOPS). She also sees Linux as adding to the ongoing development of artificial intelligence and machine learning. + +Chiras expects that containerization will enable more and more researchers and analysts to benefit from supercomputing power. And, as someone who has provided support to both scientists and analysts over the past few decades, I can appreciate what a difference this will make in their work. + +In discussing supercomputers, Chiras pointed out that, beyond having a Linux operating system, the top three fastest – Fugaku, Summit and Sierra – are all built from commercial hardware. Summit and Sierra are Power Systems-based, while Fugaku is the first Arm-powered supercomputer to top the list. The days of purpose-built, custom hardware and software in supercomputing could be over even though new and demanding workloads like AI and complex modeling require greater and greater power. + +(Chiras also wasn’t shy about mentioning that [Red Hat Enterprise Linux][8] is running on four of the top 10 supercomputers: the top three plus number nine, [Marconi-100][9].) + +The character of open source and the willingness of many companies to recognize its value and work together to develop it have made Linux the top OS for both supercomputers and micro-devices. We can expect continued improvements in how the OS is deployed – including getting supercomputing into the hands of a lot more scientists and engineers – as we move forward. As a person who has spent close to 40 years working with Unix and Linux systems, I couldn’t be more pleased. + +Join the Network World communities on [Facebook][10] and [LinkedIn][11] to comment on topics that are top of mind. + +-------------------------------------------------------------------------------- + +via: https://www.networkworld.com/article/3568616/linux-dominates-supercomputing.html + +作者:[Sandra Henry-Stocker][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.networkworld.com/author/Sandra-Henry_Stocker/ +[b]: https://github.com/lujun9972 +[1]: http://TOP500.org +[2]: https://www.top500.org/statistics/details/osfam/1/ +[3]: https://www.networkworld.com/newsletters/signup.html +[4]: https://www.linuxfoundation.org/membership/members/ +[5]: https://www.top500.org/project/linpack +[6]: https://www.networkworld.com/article/3563766/the-10-fastest-supercomputers-are-led-by-one-28x-faster-than-the-rest.html +[7]: https://www.fujitsu.com/global/about/innovation/fugaku/ +[8]: https://www.redhat.com/en/technologies/linux-platforms/enterprise-linux +[9]: https://www.hpc.cineca.it/hardware/marconi100 +[10]: https://www.facebook.com/NetworkWorld/ +[11]: https://www.linkedin.com/company/network-world diff --git a/sources/talk/20200731 Why we open sourced our Python platform.md b/sources/talk/20200731 Why we open sourced our Python platform.md new file mode 100644 index 0000000000..fe76ac8487 --- /dev/null +++ b/sources/talk/20200731 Why we open sourced our Python platform.md @@ -0,0 +1,105 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Why we open sourced our Python platform) +[#]: via: (https://opensource.com/article/20/7/why-open-source) +[#]: author: (Meredydd Luff https://opensource.com/users/meredydd-luff) + +Why we open sourced our Python platform +====== +Open source development philosophy makes Anvil's entire solution more +useful and trustworthy. +![neon sign with head outline and open source why spelled out][1] + +The team at Anvil recently open sourced the [Anvil App Server][2], a runtime engine for hosting web apps built entirely in Python. + +The community reaction has been overwhelmingly positive, and we, at Anvil, have already incorporated lots of that feedback into our [next release][3]. But one of the questions we keep getting asked is, "Why did you choose to open source such a core part of your product?" + +### Why we created Anvil + +[Anvil][4] is a tool that makes it as simple as possible to build a web app. We do that by enabling you to build the whole application in one language—Python. + +Before Anvil, if you wanted to build a web app, you'd have to write code using a bunch of technologies like HTML, Javascript, CSS, Python, SQL, React, Redux, Bootstrap, Sass, Webpack, etc. That's a lot to learn. And that's just for a simple app; trust me, it can get [way more complicated][5]. + +![A complex framework of development tools needed for a simple web app][6] + +Yes, really. All of these, for a simple web app. + +But even then, you're not done! You need to know all about Git and cloud hosting providers, how to secure the (most-likely) Linux operating system, how to tune the database, and then you're on call to keep it running. Forever. + +So, instead, we built Anvil, an online IDE where you can build your UI with a [drag-and-drop designer][7] and write all your [logic in Python][8], then Anvil takes care of the rest. We replace that whole teetering stack with "just write Python." + +### Simple web hosting is important, but not enough + +Anvil can also host your apps for you. And why not? There is so much complexity in deploying a web app, so running our own cloud hosting service was the only way to provide the simplicity we need. Build an app in the Anvil editor, [click a button][9], and it's live on the Internet. + +But we kept hearing from people who said, "That's great, but…" + + * "I need to run this on an offshore platform without reliable internet access." + * "I want to package my app into an IoT device I sell." + * "If I'm putting my eggs in this basket, how can I be sure I can still run my app in ten years?" + + + +These are all good points! A cloud service isn't the right solution for everyone. If we want to serve these users, there's got to be some way for them to get their apps out of Anvil and run them locally, under their own complete control. + +### Open source is an escape hatch, not an ejector seat + +At conferences, we sometimes get asked, "Can I export this as a Flask+JS app?" Sure, it would be possible to export an Anvil project into its respective Python and JavaScript—we could generate a server package, compile the client-side Python to Javascript, and spit out a classic web app. But it would have serious drawbacks, because: **code generation is an ejector seat.** + +![Code generation is an ejector seat from a structured platform][10] + +([Image][11] licensed as public domain) + +Generated code is better than nothing; at least you can edit it! But the moment you've edited that code, you've lost all the benefits of the system that generated it. If you're using Anvil because of its [drag-and-drop editor][12] and [Python in the browser][13], why should you have to use vim and Javascript in order to host your app locally? + +We believe in [escape hatches, not ejector seats][14]. So we did it the right way—we [open-sourced Anvil's runtime engine][2], which is the same code that serves your app in our hosted service. It's a standalone app; you can edit your code with a text editor and run it locally. But you can also `git push` it right back into our online IDE. It's not an ejector seat; there's no explosive transition. It's an escape hatch; you can climb out, do what you need to do, and climb right back in. + +### If it's open, is it reliable? + +A seeming contradiction in open source is that its free availability is its strength, but also sometimes creates a perception of instability. After all, if you're not charging for it, how are you keeping this platform up and healthy for the long term? + +We're doing what we always have—providing a development tool that makes it drastically simpler to build web applications, though the apps you build using Anvil are 100% yours. We provide hosting for Anvil apps and we offer the entire development and hosting platform onsite for [enterprise customers][15]. This enables us to offer a free plan so that everyone can use Anvil for hobby or educational purposes, or to start building something and see where it goes. + +### More to gain, little to lose + +Open sourcing our runtime engine isn't a detractor from our business—it makes our online IDE more useful and more trustworthy, today and in the future. We've open-sourced the Anvil App Server for the people who need it, and to provide the ultimate insurance policy. It's the right move for our users—now they can build with confidence, knowing that the open source code is [right there][3] if they need it. + +If our development philosophy resonates with you, why not try Anvil yourself? +  + +\----- + +_This post is an adaptation of [Why We Open Sourced the Anvil App Server][16] and is reused with permission._ + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/7/why-open-source + +作者:[Meredydd Luff][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/meredydd-luff +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/BUS_OSwhy_520x292_ma.png?itok=lqfhAs8L (neon sign with head outline and open source why spelled out) +[2]: https://anvil.works/blog/open-source +[3]: https://github.com/anvil-works/anvil-runtime +[4]: https://anvil.works/ +[5]: https://github.com/kamranahmedse/developer-roadmap#introduction +[6]: https://opensource.com/sites/default/files/uploads/frameworks.png (A complex framework of development tools needed for a simple web app) +[7]: https://anvil.works/docs/client/ui +[8]: https://anvil.works/docs/client/python +[9]: https://anvil.works/docs/deployment +[10]: https://opensource.com/sites/default/files/uploads/ejector-seat-opensourcecom.jpg (Code generation is an ejector seat from a structured platform) +[11]: https://commons.wikimedia.org/wiki/File:Crash.arp.600pix.jpg +[12]: https://anvil.works/docs/editor +[13]: https://anvil.works/docs/client +[14]: https://anvil.works/blog/escape-hatches-and-ejector-seats +[15]: https://anvil.works/docs/overview/enterprise +[16]: https://anvil.works/blog/why-open-source diff --git a/sources/talk/20200801 8 tips for running a virtual hackathon.md b/sources/talk/20200801 8 tips for running a virtual hackathon.md new file mode 100644 index 0000000000..0ed2d07296 --- /dev/null +++ b/sources/talk/20200801 8 tips for running a virtual hackathon.md @@ -0,0 +1,123 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (8 tips for running a virtual hackathon) +[#]: via: (https://opensource.com/article/20/8/virtual-hackathon) +[#]: author: (Jason Blais https://opensource.com/users/jasonblais) + +8 tips for running a virtual hackathon +====== +Reach new developers and engage with your existing community through +virtual hackathons. +![Two people chatting via a video conference app][1] + +Hackathons are events where developers, product managers, designers, and others come together to tackle problems over a short time period. They have become increasingly popular over the last 15 years after [OpenBSD ran the first hackathon in June 1999][2]. + +These events provide several benefits—greater engagement across the community, innovation and new ideas, awareness for the organizers, and networking opportunities for participants. + +[Mattermost][3], an open source messaging platform for DevOps teams, has also run and participated in several hackathons to engage with the open source community. So far, in 2020, we participated in a [hackathon to overcome the challenges of COVID-19][4] and ran a [hackfest to create open source chatbots for developer workflows][5]. Both had thousands of participants and were run completely virtually. + +We've come a long way from our [first hackathon in 2016][6] that had only 20 participants to building a [step-by-step guide for running a virtual hackathon][7], and we've learned many valuable lessons. + +If you are considering running a virtual hackathon, here are eight tips to keep in mind: + +### Choose your hackathon theme + +Before you begin to plan your hackathon, you'll need to choose a theme or a topic for it first. + +Is there a specific business or social problem you're trying to solve? An industry you want to reach? Technologies you want to explore together with your community? + +Choosing the theme at the start is important, as it gives you a clear focus for the rest of your planning—which communities to reach out to, how to determine logistics, what materials to prepare, and other details. It also inspires your community to work on solving the specific kinds of problems you're organizing around. + +### Decide dates for the hackathon early + +With 365 days in a year, you'd think it'd be easy to find one on which to hold an event, but it can actually be a challenge to schedule even a virtual hackathon. The most important thing is not to rush the preparation. Ideally, you should schedule the hackathon at least two months out. This gives you enough time to promote and organize it and gives your participants enough time to prepare for it—whether it's researching the hackathon topic or setting aside time for it on their calendars. + +Here are a few quick tips when trying to decide when to run hackathons: + + * Avoid overlap with major holidays in the countries you're trying to reach. If the event is global, then avoid major holidays in the countries where you have bigger communities. + * Avoid overlap with significant company or community events that may act as a distraction during the hackathon, such as major product releases or developer conferences. + * Avoid starting the hackathon on a Friday, especially if you plan to reach developers around the world. If you're located in the Western Hemisphere and hold a hackathon kick-off call on Friday, those in Europe and Asia will either have to join in late Friday night or Saturday morning, effectively meaning the hackathon starts on a weekend in those areas. It is typically better to start on a Thursday instead. + + + +Given the hackathon is online, there is also an opportunity to extend it beyond a standard 48-hour event. We have found that running a three- or four-day event, for instance, results in much higher quality submissions that are closer to completion. + +### Identify key team members to partner with during the hackathon + +It is much easier to promote and organize the event when you have someone you can collaborate with. At a minimum, find one or two developers who can act as leaders during the event, mentoring newcomers and answering questions from the participants. They can also be your point of contact for technical support before and during the event. + +You should also consider if you need a partner to run operations such as scheduling calls, and a partner to create the event marketing materials. + +Moreover, once you've picked the theme and dates of your event, reach out to your community and ask if anyone is open to help. Many may be interested. Acting as a hackathon organizer and mentor also provides a great experience for community members themselves. + +### Produce a workback schedule + +Start by listing everything you and your hackathon partners may need to do before, during, and after the hackathon. And I do mean everything—from deciding which platform to host your hackathon on to which video conferencing tool to use for presentations to what prizes to give out. The more comprehensive your workback schedule is, the better prepared you will be, and the more successful the hackathon will be. + +To help you get started, check out the Mattermost ["How to Run a Hackathon" playbook][7] with key dates and activities that you can use for inspiration. + +### Create a code of conduct + +Code of conduct is important to promote healthy behavior within your community. It establishes what is accepted by participants and helps create a safe and welcoming environment for everyone. + +The same is true for hackathons. The code of conduct establishes the rules and actions taken when the rules are broken. Include a clear contact or place to report harassment from the participants. Often, the members you're partnering with from tip #3 will also help enforce the code of conduct as needed. + +To learn more about codes of conduct, including ways to enforce them, see [this excellent guide][8]. + +### Make one landing page for the hackathon + +During the hackathon, there is a lot going on. People ask questions, share progress, and team up with others. Especially when running a hackathon with hundreds (or thousands!) of participants, it can quickly get chaotic. + +That is why a single hackathon landing page is critical. This landing page should contain all the information community members need to know, including resources to get started, where to ask questions, and how to create a submission. Updates can also be communicated in other channels like Twitter, but they should always be reflected on the hackathon's landing page. Your landing page is the source of truth. + +Plus, make sure to include plenty of information for first-time participants. If you've run a few events, a lot of the information you share is familiar to you and previous participants. However, everything is new and often confusing for first-time participants, so make sure to keep them in mind when building the landing page. + +### Plan for external promotion + +A common reason to run a hackathon is to reach new users and communities who have heard of your project before. Therefore, announcing and promoting the hackathon beyond just your social channels is very important. However, simply spamming other communities and pages is not just ineffective, but also disrespectful. + +Go back to point #1, where you selected the hackathon theme. Are there certain technologies that are relevant to it? Or industries?  + +If so, study where those communities exist and reach out in their respective channels. Even better, find their community manager and share the hackathon with them first before sharing with the wider community. + +### Include social interaction time + +The biggest challenge we've found with virtual hackathons as compared to physical hackathons are the social aspects. Since people are not working in the same rooms together anymore, building connections and collaborating with others takes extra effort. + +Make sure to add social activities throughout the event dates, accounting for different time zones. Include activity feeds where participants can share updates on what they're working on, drop-in social hours over video, coffee times, pizza hours, and more. + +Taking the extra step to ensure there are opportunities for social interaction creates a more engaging experience for everyone involved. + +### Ready to run your first virtual hackathon? + +Running a virtual hackathon is not easy, but if you prepare for it well and use the above tips to plan it, you will be set up for success, and hopefully have lots of fun along the way! There is also an [excellent guide from HackerEarth][9] that you can use as a reference. + +Ready to run your first virtual hackathon? Then use the Mattermost ["How to Run a Hackathon" playbook][7] to guide your planning and read about the [Mattermost Bot Hackfest][5] for inspiration. + +Thank you also to Jesús Espino and Justin Reynolds for their valuable feedback on this article. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/8/virtual-hackathon + +作者:[Jason Blais][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/jasonblais +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/chat_video_conference_talk_team.png?itok=t2_7fEH0 (Two people chatting via a video conference app) +[2]: http://www.openbsd.org/hackathons.html +[3]: http://mattermost.com/ +[4]: https://mattermost.com/blog/vencealvirus-virtual-hackathon/ +[5]: https://mattermost.com/blog/mattermost-bot-hackfest-winners/ +[6]: https://mattermost.com/blog/mattermost-holiday-hackfest-2016/ +[7]: https://handbook.mattermost.com/contributors/contributors/how-to-run-a-hackathon +[8]: https://opensource.guide/code-of-conduct/ +[9]: https://www.hackerearth.com/community-hackathons/resources/e-books/guide-to-organize-hackathon diff --git a/sources/talk/20200806 5 tips for making documentation a priority in open source projects.md b/sources/talk/20200806 5 tips for making documentation a priority in open source projects.md new file mode 100644 index 0000000000..e381ee7276 --- /dev/null +++ b/sources/talk/20200806 5 tips for making documentation a priority in open source projects.md @@ -0,0 +1,68 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (5 tips for making documentation a priority in open source projects) +[#]: via: (https://opensource.com/article/20/8/documentation-open-source-projects) +[#]: author: (Ray Paik https://opensource.com/users/rpaik) + +5 tips for making documentation a priority in open source projects +====== +Documentation is as important as code, so make sure you treat it that +way. Here's how. +![Files in a folder][1] + +[Open source software][2] is now mainstream; long gone are the days when open source projects attracted developers alone. Nowadays, users across numerous industries are active consumers of open source software, and you can't expect everyone to know how to use the software just by reading the code. + +Even for developers (including those with plenty of experience in other open source projects), good documentation serves as a valuable onboarding tool when people join a community. People who are interested in contributing to a project often start by working on documentation to get familiar with the project, the community, and the community workflow. + +### Common challenges with documentation in open source + +Although everyone agrees that documentation is important and needs to be done, some of the ways we do it result in poor quality and lack of consistency across different parts of documentation in the project. For example, when developers are too focused on code, they don't start working on documentation until the last minute (e.g., right before the release). And all too often, documentation tasks are done by volunteers, people who have a hard time saying "no." To make things worse, people may forget about the documentation after the release, so they never change or improve it, and the vicious cycle repeats. + +### 5 best practices + +We have been involved in documentation in a number of open source projects at [Linux Foundation Networking][3] and [GitLab][4] over the past few years. Below, we're sharing some things we've learned that we hope will help make documentation a first-class citizen in your open source project. + + 1. **Value contributions to documentation just as much as code contributions:** A lot of the focus in many open source communities tends to be on code. One easy way to make sure documentation contributions are valued by everyone is to give equal credit to documentation and code in your community metrics. It should not matter whether a commit, merge request, or pull request is for code or documentation. In addition, when you do community recognition, include key accomplishments by the people who contribute to documentation. + + 2. **Put documentation and code in the same project repo:** We highly recommend that a project's code and documentation both reside in the same repository. (A good way is to make `/doc` or `/docs` a top-level directory in the repository.) For one, this makes documentation easy for anyone to find. More importantly, your documentation will be on equal footing as code and other project resources when everything is in the same repository. + + 3. **Make documentation a requirement for a merge or release milestone:** If your project has a lengthy release cycle (e.g., three to six months or more), we highly recommend having interim checkpoints for documentation (like this [example][5] from the ONAP community). This ensures documentation work is not put off until right before the release, and instead, everyone works on documentation throughout the release cycle. If it's feasible for your community, you could make documentation a required step for all code contributions that will impact users (see this [example][6] from GitLab). + + 4. **Have a consistent contribution process for code and documentation:** We also recommend having a consistent contribution process and using the same toolchains for code and documentation. As we noted earlier, many new community members start contributing by working on documentation, as you often don't need deep technical knowledge of the software to get started. It's good for new contributors to onboard in the community by getting familiar with the contribution workflow and meeting other community members. If these new contributors later want to get involved in other parts of the project (including code), you want the toolchains and contribution process to be familiar. Otherwise, they will need to go through another onboarding process, which creates an unnecessary hurdle for contributors. If your code and documentation have different contribution processes, you may risk creating an impression that documentation is less than a first-class citizen compared to code. + + 5. **Have well-documented processes for contributing to documentation:** This may seem obvious, but it's easy to neglect. Since documentation is a good entry point for new contributors, you want to lower the barrier to entry as much as possible. Having good documentation on the contribution workflow, how to get started, where to find issues to work on, how to get help, and more will go a long way to helping new contributors feel welcome and get involved in your community. + + + + +### What else? + +Do you have other tips for making documentation a first-class citizen in open source communities? If so, please share them in the comments. + +* * * + +*This article is based on [Ensuring that documentation Is a first-class citizen in open source projects][7] *presented *at Open Source Summit North America in June 2020. * + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/8/documentation-open-source-projects + +作者:[Ray Paik][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/rpaik +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/files_documents_paper_folder.png?itok=eIJWac15 (Files in a folder) +[2]: https://opensource.com/resources/what-open-source +[3]: https://www.linuxfoundation.org/projects/networking/ +[4]: https://about.gitlab.com/ +[5]: https://wiki.onap.org/display/DW/Guilin+Documentation +[6]: https://docs.gitlab.com/ee/development/contributing/merge_request_workflow.html#definition-of-done +[7]: https://sched.co/c3SY diff --git a/sources/talk/20200806 You don-t need a computer science degree to work with open source software.md b/sources/talk/20200806 You don-t need a computer science degree to work with open source software.md new file mode 100644 index 0000000000..078b0d10f9 --- /dev/null +++ b/sources/talk/20200806 You don-t need a computer science degree to work with open source software.md @@ -0,0 +1,55 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (You don't need a computer science degree to work with open source software) +[#]: via: (https://opensource.com/article/20/8/learn-open-source) +[#]: author: (Jim Hall https://opensource.com/users/jim-hall) + +You don't need a computer science degree to work with open source software +====== +Open source makes software knowledge accessible to anyone, so formal +training isn't the only path to a technology career. +![Stack of books for reading][1] + +I am mostly a self-taught programmer. When I was growing up in the late 1970s, our elementary school had a small resource room with an Apple II computer. My brother and I fell into a group of friends that liked computers, and we all helped each other learn the system. + +We showed such promise that our parents bought us an Apple II+ clone called the Franklin ACE 1000. My brother and I taught ourselves how to program in AppleSoft BASIC. Our parents bought us books, and we devoured them. I learned every corner of BASIC by reading about something in the book, then writing a practice program. My favorite pastime was writing simulations and games. + +I stayed with BASIC for a long time. Our next computer was an IBM PC clone with a version of BASIC on it. Much later, MS-DOS 5 introduced QBasic, which was a modern version of BASIC that finally eliminated line numbers. + +I began to learn other programming languages when I entered university. I was a physics student, and as part of our numerical analysis prerequisite, we had to learn Fortran. Having already learned BASIC, I thought Fortran was pretty easy to pick up. Fortran and BASIC were very similar, although Fortran was more limited in my experience. + +My brother was a computer science major at a different university, and he introduced me to the C programming language. I immediately loved working in C! It was a straightforward programming language that gave me a ton of flexibility for writing useful programs. But I didn't have room in my degree program to take a class that didn't apply to my physics major. So, instead, I taught myself C by reading books and combing through the library reference guide. Each time I wanted to learn a new topic, I looked it up in the reference guide and wrote a practice program to exercise my new knowledge. + +My early use of C was writing new utilities to expand MS-DOS. I used Unix on campus, but my computer at home mostly ran MS-DOS. I wanted MS-DOS to have similar enhanced command-line features that Unix offered, so I wrote my own utilities to give me the added functionality. + +I suppose my first tools were pretty simple programming exercises. I used programs like Unix cat or DOS TYPE to display the contents of text files, with extra command-line options to add line numbers, convert tabs to spaces, and the like. Or I'd use a program like Unix clear or DOS CLS to clear the screen, but also set the colors to something other than the usual white-on-black text. And I wrote a few new utilities to help me with my studies, like a program to find common errors in a Fortran source file, a utility to organize files in a directory, a filter to convert nroff files to LaTeX format, and a program to fit a straight line through x and y data points. + +Armed with this limited experience in C programming, I tackled my first big open source project. It turns out you can accomplish a lot if you don't know what you don't know and have a passion for a project. That's how I created the [FreeDOS Project][2] in 1994. + +Since then, I've written, maintained, or otherwise contributed to dozens of open source projects on FreeDOS, Linux, and Big Unix. My first contribution was a fix to GNU Emacs so it would compile correctly on a DomainOS Unix system. I also submitted patches to an early open source C compiler specific to HP-UX, a fun artillery game with cartoony tanks, a utility to organize music on an iPod, and other Unix and Linux programs. On FreeDOS, I wrote much of the underlying code libraries we used at the time, including an implementation of Unix catgets, so FreeDOS programs could support different spoken languages without having to be rewritten. + +Over time, I leveraged what I'd learned to pick up other programming languages. I wrote a ton of Unix Korn shell scripts, Linux Bash scripts, and AWK scripts. I wrote small utilities in Perl, and later wrote Perl CGI and PHP pages for websites. I learned enough LISP to tweak my copy of GNU Emacs, and enough Scheme to work on a project that used GNU Guile. And I continued to write and share open source games, applications, utilities, and tools for Linux and FreeDOS. + +And as I wrote more code, I got better at programming. Even today, I continue to learn new things and reinforce those lessons by [teaching others][3]. I'm always trying new things out. + +And that's my lesson. You don't have to be formally trained in computer science or hold a CS degree to contribute to open source software. Find your passion, and you can figure out the rest on your own. All that matters is that you love doing what you do and that you're willing to share your contribution with others. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/8/learn-open-source + +作者:[Jim Hall][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/jim-hall +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/books_read_list_stack_study.png?itok=GZxb9OAv (Stack of books for reading) +[2]: https://opensource.com/article/17/10/freedos +[3]: https://opensource.com/article/20/7/teaching-c diff --git a/sources/talk/20200807 Meeting for the first time after 26 years of open source collaboration.md b/sources/talk/20200807 Meeting for the first time after 26 years of open source collaboration.md new file mode 100644 index 0000000000..700b4c9db3 --- /dev/null +++ b/sources/talk/20200807 Meeting for the first time after 26 years of open source collaboration.md @@ -0,0 +1,53 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Meeting for the first time after 26 years of open source collaboration) +[#]: via: (https://opensource.com/article/20/8/meet-open-source-collaborators) +[#]: author: (Jim Hall https://opensource.com/users/jim-hall) + +Meeting for the first time after 26 years of open source collaboration +====== +Open source is great because people from anywhere can get involved, but +it can be lonely. Take advantage of the proliferation of video +conferencing tools available to make connections with your fellow +developers. +![Two people chatting via a video conference app][1] + +Collaborating on an open source software project is inherently an online experience. For me, almost all of my interaction has been via email. I'll send someone a patch, and they'll review it and reply to me. Or a user will file a bug, and I'll respond to it via the bug tracker. More commonly, developers in the open source community will discuss ideas via the email list. + +Over the years, I've only interacted on projects electronically, and have only met a few people in person, usually in settings unrelated to the project. Sometimes it's at conferences—we'll recognize each other's names, and realize we're working on the same open source project. I really enjoy those connections, but they're rare. + +In 1994, I created the [FreeDOS Project][2], an open source implementation of the DOS operating system. In the last 26 years, I've met only a handful of folks from that project in person. I met one developer when I attended a work conference in his city, and we got dinner together. Another developer took time out of his vacation tour of the Midwest to visit and have a drink. I crossed paths with another developer at an open source conference. And I spoke with Pat, who wrote our first kernel, on the phone several times, but we never met in person. + +A few weeks ago, I decided to change that dynamic. We live in an era of ubiquitous video conferencing, even more so in the last few months, as many people have shifted to remote work due to the pandemic. Even though open source work happens virtually, independent of geography, we can still build relationships and put names to faces. Zoom, BlueJeans, Google Hangouts, or Jitsi Meet are the new way to connect while maintaining social distance. + +On June 29, 2020, to celebrate the 26th anniversary of FreeDOS, we held our first online get-together. It was an opportunity to finally actually meet the people I'd been working with for the last 20+ years. + +And it was awesome! At our peak, we had over 16 people on the video meeting. I loved getting to see everyone and talk "in-person." We had almost an hour and a half of engaging conversations with folks from all over the world. Thanks to everyone who participated! + +It's meetings like this when I remember open source is more than just writing code; it's about building a community. And while I've always done well with our virtual community that communicates via email, I really appreciated getting to talk to people without the filter of email—making that real-time connection meant a lot to me. + +This virtual meet-up went so well that I'd love to do it again. In fact, I'm planning another virtual get-together later this summer. I'm hoping to focus the conversation on that one, maybe make it a "working session" to nail down some things for the upcoming FreeDOS 1.3 release. Stay tuned for more details! + +![Screenshot of zoom call participants with names and faces blurred][3] + +*Names and faces blurred for privacy + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/8/meet-open-source-collaborators + +作者:[Jim Hall][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/jim-hall +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/chat_video_conference_talk_team.png?itok=t2_7fEH0 (Two people chatting via a video conference app) +[2]: https://www.freedos.org/ +[3]: https://opensource.com/sites/default/files/uploads/screenshot_from_2020-06-29_09-29-49.jpg (Screenshot of zoom call participants with names and faces blurred) diff --git a/sources/talk/20200808 Matrix encrypted chat rolls out across Germany, Project ACRN-s new IoT release, and more open source news.md b/sources/talk/20200808 Matrix encrypted chat rolls out across Germany, Project ACRN-s new IoT release, and more open source news.md new file mode 100644 index 0000000000..e63ea493e5 --- /dev/null +++ b/sources/talk/20200808 Matrix encrypted chat rolls out across Germany, Project ACRN-s new IoT release, and more open source news.md @@ -0,0 +1,79 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Matrix encrypted chat rolls out across Germany, Project ACRN's new IoT release, and more open source news) +[#]: via: (https://opensource.com/article/20/8/news-aug-8) +[#]: author: (Lauren Maffeo https://opensource.com/users/lmaffeo) + +Matrix encrypted chat rolls out across Germany, Project ACRN's new IoT release, and more open source news +====== +Catch up on the biggest open source headlines from the past two weeks. +![][1] + +In this week’s edition of our open source news roundup, an open source microfluidics pump, Germany rolls out an encrypted messaging platform based on Matrix, and more open source news. + +### A Reddit user shares his open source microfluidics pump + +As COVID-19 limits access to chemistry and biology labs, one open source user made his own solution. Josh Maceachern shared the model in a thread [on Reddit][2], sharing his microfluidics pump for less than $300 in total.  + +According to the creator, the pump runs on only 3D-printed and common components for less than $300 total. An [article by Hackaday][3] adds that the pump delivers up to 15 mL/min with accuracy to 0.1uL/min. That's enough power for users to do their own genetics or biology projects at home. + +Along with the design files for folks to build their own pumps, Maceachern said on Reddit that he's releasing the pump under the CC BY 4.0 license. He gave his blessing for anyone to use it, asking that they attribute him. + +### Germany prepares for the world's largest deployment of Matrix-based open source software  + +When [Dataport][4] rolls out Element collaboration software this fall, they'll deploy it for half a million users in the German states of Schlesweig-Holstein and Hamburg. According to Element in [this article][5], it will be "...the biggest single messaging and collaboration implementation in the world." + +In an era of videoconferencing dominated by big brands, Germany's choice of a fully open source tool is noteworthy. It's also no accident that this deployment will occur in Europe: Element shared [in a blog post][6] that it's devoted to giving users more control over their data, rather than seeing it stored on overseas systems. + +The post also cited "increasingly anti-encryption" sentiment in the U.S. as another reason to offer end-to-end encryption for European users. Element's forthcoming rollout in Germany will allow users to host their own data and messages. Dataport hopes to [deploy Element][7] as a matrix-based solution by September, in time for the start of term in Germany. + +### Project ACRN release Version 2.0 of its IoT hypervisor + +ACRN is an open source hypervisor supported by the Linux Foundation's [Automotive Grade Linux][8]. The project says its lightweight hypervisor supports IoT functions like graphics, imaging, and audio on less than 40k lines of code. After the initial focus on automotive safety, the Linux Foundation's latest release of [Project ACRN][9] is more focused on IoT applications by balancing safety features with more general purpose Virtual Machines (VMs).  + +[The Project's v2.0][10] expands support to Kata containers and OpenStack. It also supports partition mode and sharing mode in tandem. + +In other news: + + * [Open wearables group buttons down on datasets][11] + * [Microsoft joins Open Source Security Foundation][12] + * [Uniting for better open-source security: The Open Source Security Foundation][13] + * [China unveils AI open-source platform 'Dubhe'][14] + * [System76 reveals an open source PC surprise for AMD Ryzen fans][15] + + + +Thanks, as always, to Opensource.com staff members and [Correspondents][16] for their help this week. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/8/news-aug-8 + +作者:[Lauren Maffeo][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/lmaffeo +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/weekly_news_roundup_tv.png?itok=tibLvjBd +[2]: https://www.reddit.com/r/functionalprint/comments/hsevpl/opensource_multichannel_microfluidicsosmm_pump/ +[3]: https://hackaday.com/2020/07/29/an-open-source-microfluidic-pump-for-your-science-needs/ +[4]: https://www.dataport.de/who-we-are/ +[5]: https://www.zdnet.com/article/open-source-is-behind-this-massive-messaging-and-collaboration-project-for-500000-people/ +[6]: https://element.io/blog/element-brings-matrix-to-europe/ +[7]: https://www.dataport.de/was-wir-bewegen/portfolio/projekt-phoenix/ +[8]: https://www.automotivelinux.org/ +[9]: https://github.com/projectacrn +[10]: https://projectacrn.github.io/2.0/ +[11]: https://www.computerweekly.com/blog/Open-Source-Insider/Open-wearables-group-buttons-down-on-datasets +[12]: https://www.microsoft.com/security/blog/2020/08/03/microsoft-open-source-security-foundation-founding-member-securing-open-source-software/ +[13]: https://www.zdnet.com/article/uniting-for-better-open-source-security-the-open-source-security-foundation/#ftag=RSSbaffb68 +[14]: https://news.cgtn.com/news/2020-08-03/China-unveils-AI-open-source-platform-Dubhe--SE3UpfEX5e/index.html +[15]: https://www.forbes.com/sites/jasonevangelho/2020/07/26/system76-reveals-an-open-source-surprise-for-amd-ryzen-fans/#4566bf106e4e +[16]: https://opensource.com/correspondent-program diff --git a/sources/talk/20200815 What Does Mozilla Firing 25- of its Workforce Tells us About its Future.md b/sources/talk/20200815 What Does Mozilla Firing 25- of its Workforce Tells us About its Future.md new file mode 100644 index 0000000000..064c99cd1f --- /dev/null +++ b/sources/talk/20200815 What Does Mozilla Firing 25- of its Workforce Tells us About its Future.md @@ -0,0 +1,107 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (What Does Mozilla Firing 25% of its Workforce Tells us About its Future) +[#]: via: (https://itsfoss.com/mozilla-struggle/) +[#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/) + +What Does Mozilla Firing 25% of its Workforce Tells us About its Future +====== + +Mozilla is in news again but not for good reasons. + +[Mozilla has suddenly fired around 250 employees][1], 25% of its workforce. It also closed operations in Taipei, Taiwan. The Taiwanese team was working on Firefox Lite. + +This is not the first layoff from Mozilla this year. At the beginning of the year, [Mozilla had laid off 70 employees][2]. + +So, what’s going on with Mozilla? Whatever it is, it’s certainly not positive. + +Mozilla has fired entire (or most of) teams working on [DevTools][3], [MDN][4], developer relation, [Servo][5] (browser engine written in Rust) and incident threat management. + +Why did it do that? What lies ahead for Mozilla? Here’s my opinion on the Mozilla crisis. + +### The gradual decline of Mozilla: Ignoring its flagship Firefox browser project + +Mozilla Firefox once had a good user base. It was seen as a superior browser and it looked like it would dethrone Internet Explorer as the most popular web browser. + +That would have happened if it was not for Google Chrome. The tech giant Google and its ‘thinking ahead’ leadership launched Google Chrome in 2008. + +Their aim was to get more and more people to use their search engine. How does a user access search engine? Through a web browser. + +So, instead of being dependent on other web browsers, Google created its own browser and integrated its products with this new browser. Google hired several Mozilla engineers to work on its browser. The current Google CEO, Sundar Pichai, led the team developing the Chrome browser. + +But Google didn’t just stop after creating Chrome in 2008. Google with all its technical might and intelligence, kept on improving the Chrome browser. + +Soon Google Chrome overtook Firefox and later Internet Explorer to become the most popular web browser. + +> The rise and fall of [#opensource][6] web browser Mozilla Firefox. [pic.twitter.com/Co5Xj3dKIQ][7] +> +> — Abhishek Prakash (@abhishek_foss) [March 22, 2017][8] + +But what happened to Mozilla Firefox? It is my opinion that Mozilla lost focus on the Firefox browser. They put time and energy in creating [Firefox mobile OS][9], Rust programming language, Hello video chat application and more. + +It’s not that it didn’t add new features to it, it’s just that Firefox started losing charm. + +Chrome had a faster experience while Firefox felt sluggish and heavy. Google’s evil practice of [deliberately slowing down Google products like YouTube on Firefox][10] also made users dump Firefox. + +Whatever it is. The truth is that Google Chrome is a superior product otherwise people won’t go installing it on their own. Microsoft couldn’t keep Windows users on Internet Explorer/Edge after all. + +### Google holds Mozilla by its neck and can squeeze it at will + +![][11] + +If you didn’t know, Mozilla relies heavily on Google with around 90% of its revenue coming from Google. [Google pays Mozilla a few hundred million US dollars each year][12] to be the default search engine on Firefox. + +The deal was helpful to Google when Firefox had good user base. With Google Chrome’s advent, Firefox has seen steep decline and it now stands at the third position with hardly 8% of the market share. Google Chrome dominates the market. + +Google doesn’t need Firefox’s help to get traffic to its search engine but Mozilla does need Google’s money to stay alive. + +A day after the layoffs, [Google extended the Firefox search deal with Mozilla][13]. Had Google not renewed its deal with Mozilla, it would have been real difficult for Mozilla to go beyond 2020. + +### Mozilla’s renewed focus on products that could make it money + +Mozilla Foundation is a not-for-profit organization but it also has taxable subsidiary in the form of Mozilla Corporation. Firefox browser is developed under Mozilla Foundation. The profit earned by the Mozilla Corporation is reinvested into Mozilla projects. + +Lately, Mozilla is trying hard to create new revenue channels to end its reliance on Google. Its [acquisition of Pocket app][14] and the launch of [Mozilla VPN][15] is part of this strategy. + +The recent layoffs are also part of Mozilla’s new strategy to focus on profitable products and reducing the workforce aimed at reducing the expense. + +But amidst all this, Mozilla must not ignore Firefox. People need a functioning browser and Mozilla should work on improving user experience. If the users have trouble [running Netflix][16] or YouTube or using other streaming services in this age, they will definitely switch. + +Not only it is the flagship project from Mozilla, it is also the biggest hope for people who don’t want Google. Microsoft’s Edge, Opera, Vivaldi, Brave and most of the other popular browsers have switched to Google’s Chromium project. Firefox is one of the rare browsers that doesn’t rely on Chromium. + +I hope that Mozilla rises from the ashes like a Phoenix. + +Those were my views on the Mozilla situation. I welcome yours in the comment section. + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/mozilla-struggle/ + +作者:[Abhishek Prakash][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/abhishek/ +[b]: https://github.com/lujun9972 +[1]: https://thenextweb.com/insights/2020/08/11/mozilla-firefox-layoffs-250-employees/ +[2]: https://www.bizjournals.com/sanjose/c/mountain-view-based-mozilla-laysoff-around-70.html +[3]: https://developer.mozilla.org/en-US/docs/Tools +[4]: https://developer.mozilla.org/en-US/ +[5]: https://servo.org/ +[6]: https://twitter.com/hashtag/opensource?src=hash&ref_src=twsrc%5Etfw +[7]: https://t.co/Co5Xj3dKIQ +[8]: https://twitter.com/abhishek_foss/status/844666818665025537?ref_src=twsrc%5Etfw +[9]: https://en.wikipedia.org/wiki/Firefox_OS +[10]: https://fortune.com/2018/07/25/youtube-slow-mozilla-firefox-chrome/ +[11]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/08/mozilla-struggle.jpg?resize=800%2C450&ssl=1 +[12]: https://www.zdnet.com/article/firefox-hits-the-jackpot-with-almost-billion-dollar-google-deal/ +[13]: https://www.theregister.com/2020/08/14/mozilla_google_search/ +[14]: https://blog.mozilla.org/blog/2017/02/27/mozilla-acquires-pocket/ +[15]: https://vpn.mozilla.org/ +[16]: https://itsfoss.com/netflix-firefox-linux/ diff --git a/sources/talk/20200817 What makes Java open source.md b/sources/talk/20200817 What makes Java open source.md new file mode 100644 index 0000000000..4a1d0a6b5a --- /dev/null +++ b/sources/talk/20200817 What makes Java open source.md @@ -0,0 +1,68 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (What makes Java open source?) +[#]: via: (https://opensource.com/article/20/8/open-source-java) +[#]: author: (Daniel Oh https://opensource.com/users/daniel-oh) + +What makes Java open source? +====== +Clearing up the confusion about developing in Java while staying in the +open source ecosystem. +![Coffee beans][1] + +If you're using [Java][2] to write business applications, you may know that Java Standard Edition (SE) is not open source software. It is not managed by a foundation, like Python or JavaScript, and in January 2019, Oracle changed its policy to require a commercial license for any use of SE, from the developer's local environment to production. + +This change also raised a lot of questions in open source communities about licensing compliance and Java usage. If you're still confused, this article will guide you through how these changes apply to Java developers. + +### Evolving platforms in the Java community + +[OpenJDK][3] (Open Java Development Kit) is a free and open source implementation of Java SE. It is an alternative that allows more than 70% of Java developers to continue stabilizing their Java application environments while remaining within the open source ecosystem. OpenJDK is primarily licensed under the [GNU GPLv2][4]. The freedoms guaranteed by this distribution strategy have made OpenJDK the default choice for Java developers to build desktop applications that are compatible with Java SE. + +Oracle continued developing and maintaining Enterprise Java (Java EE), which is built on the Java SE platform. Java EE includes additional features outside SE's scope to support large-scale, scalable, multi-tier, and secured applications for a variety of enterprise environments. In September 2017, the Java EE platform was transferred to the [Eclipse Foundation][5], leading to the adoption of more agile processes, changing the governance process, and implementing more flexible licensing. One year later, in 2018, the Eclipse Foundation announced a new brand name, [Jakarta EE][6], with a new logo and working groups to support developers transitioning from Java EE to the new platform. The evolution from Java EE to Jakarta EE also impacted many enterprise Java developers in implementing new business logic. + +### Evolving frameworks as Java evolved + +In the meantime, new technologies, such as RESTful APIs (2000), HTTP 2 (2015), and JSON (2017), were being developed alongside fast-changing web architectures. Interest in microservices architectures was growing, but because Java EE was in transition, it did not pick up on these new paradigms as they happened. + +In response, the broader Java community and several vendors (IBM, Red Hat, and Tomitribe) created [MicroProfile][7] in 2016 to optimize the Enterprise Java platform for microservices architectures. MicroProfile [later joined the Eclipse Foundation][8], giving enterprise Java developers two options for implementing microservice architectures: SpringBoot or MicroProfile. MicroProfile allows developers to create portable Java-based microservices across vendor solutions while ensuring compatibility between matching Java/Jakarta EE and MicroProfile APIs in the same application. + +If you are interested in Enterprise Java development, [MicroProfile Starter][9] is a great resource to explore microservices in practice. MicroProfile Starter's graphical user interface requires a few details to generate code to create a monolithic Java application server. + +A MicroProfile runtime supports deploying an application artifact (e.g., a JAR or WAR file) and executing it as a Java application server with a MicroProfile specification. You can choose the cloud-native runtime you prefer (e.g., [Quarkus][10]) from MicroProfle Starter's runtime list, then select specifications to gain additional enterprise features, such as fault tolerance, OpenAPI, OpenTracing, and more. Once you've completed these steps, click on "Download" to begin developing your application. + +![MicroProfile Starter GUI][11] + +(Daniel Oh, [CC BY-SA 4.0][12]) + +### Conclusion + +Navigating Java from an open source perspective can be a bit confusing given the language's long history, acquisitions, and relicenses. Sticking with OpenJDK and Jakarta EE allows Java developers to maintain standard enterprise applications without compromising open source freedoms. If you want to dive in further, take a look at MicroProfile or delve deeper into runtimes by exploring Quarkus. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/8/open-source-java + +作者:[Daniel Oh][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/daniel-oh +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/java-coffee-beans.jpg?itok=3hkjX5We (Coffee beans) +[2]: https://opensource.com/resources/java +[3]: https://openjdk.java.net/ +[4]: https://openjdk.java.net/legal/gplv2+ce.html +[5]: https://www.eclipse.org/org/ +[6]: https://opensource.com/article/18/5/jakarta-ee +[7]: https://microprofile.io/ +[8]: https://opensource.com/article/18/1/eclipse-microprofile +[9]: https://start.microprofile.io/ +[10]: https://quarkus.io/ +[11]: https://opensource.com/sites/default/files/uploads/microprofile.png (MicroProfile Starter GUI) +[12]: https://creativecommons.org/licenses/by-sa/4.0/ diff --git a/sources/talk/20200818 Amazon Braket lets customers try out quantum computing.md b/sources/talk/20200818 Amazon Braket lets customers try out quantum computing.md new file mode 100644 index 0000000000..3ca1ae3fae --- /dev/null +++ b/sources/talk/20200818 Amazon Braket lets customers try out quantum computing.md @@ -0,0 +1,70 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Amazon Braket lets customers try out quantum computing) +[#]: via: (https://www.networkworld.com/article/3570251/amazon-braket-lets-customers-try-out-quantum-computing.html) +[#]: author: (Michael Cooney https://www.networkworld.com/author/Michael-Cooney/) + +Amazon Braket lets customers try out quantum computing +====== +AWS joins IBM, Microsoft, Google and others in growing quantum computing arena +[Glosser.ca / Pete Linforth][1] [(CC BY-SA 3.0)][2] + +AWS has announced the availability of a new service that lets customers tap into and experiment with [quantum computing][3] simulators and access quantum hardware from [D-Wave][4], [IonQ][5], and [Rigetti][6]. + +The managed service, [Amazon Braket][7], offers customers a development environment where they can explore and build quantum algorithms, test them on quantum circuit simulators, and run them on different quantum hardware technologies, AWS said in a [statement][7] about the service. The Braket service includes Jupyter notebooks that come pre-installed with the Amazon Braket SDK and example tutorials. + +**Read more: [What is quantum computing? (and why enterprises should care)][3] ** + +According to AWS, Braket provides access to a fully managed, high-performance, quantum circuit simulator that lets users test and validate circuits with a single line of code. In addition, as a native AWS service, Braket can be managed via the AWS management console. (Related: [Amazon joins the quantum computing crowd with Braket testbed][8]) + +The service is named after the standard notation in quantum mechanics bra-ket, which was introduced by Paul Dirac in 1939 to describe the state of quantum systems and is also known as the [Dirac notation][9]. + +"Quantum computing has the potential to solve computational problems that are beyond the reach of classical computers by harnessing the laws of quantum mechanics to process information in new ways," AWS stated. "This approach to computing could transform areas such as chemical engineering, material science, drug discovery, financial portfolio optimization, and machine learning. But defining those problems and programming quantum computers to solve them requires new skills, which are difficult to acquire without easy access to quantum computing hardware." + +In a blog about Braket, Jeff Barr, Chief Evangelist for AWS, said there are a few things customers should keep in mind about Braket: + + * Quantum computing is an emerging field. "Although some of you are already experts, it will take some time for the rest of us to understand the concepts and the technology, and to figure out how to put them to use." + * The [quantum processing units] QPUs accessed through Amazon Braket support two different paradigms. The IonQ and Rigetti QPUs and the simulator support circuit-based quantum computing, and the D-Wave QPU supports quantum annealing. You cannot run a problem designed for one paradigm on a QPU that supports the other one, so you will need to choose the appropriate QPU early. + * Each task will incur a per-task charge and an additional per-shot charge that is specific to the type of QPU used. Use of the simulator incurs an hourly charge, billed by the second, with a 15 second minimum. For more information, check out [Amazon Braket Pricing][10]  + + + +The Amazon Braket rollout follows similar [quantum service][11] introductions from [IBM][12], [Microsoft][13], [QC Ware, ][14]Google, Honeywell and others in what is becoming a growing market. Researchers at [Tractica][15] for example, forecast that total enterprise quantum computing market revenue will reach $9.1 billion annually by 2030, up from $111.6 million in 2018. "The global market for quantum computing is being driven largely by the desire to increase the capability of modeling and simulating complex data, improve the efficiency or optimization of systems or processes, and solve problems with more precision," Tractica stated. + +Gartner has called quantum computing one of the top potential disruptive technologies in the next five years, stating that the parallel execution and exponential scalability of quantum computers means they excel with problems too complex for a traditional approach or where traditional algorithms would take too long to find a solution. Industries such as automotive, financial, insurance, pharmaceuticals, military and research have the most to gain from the advancements in quantum computing. Most organizations should learn about and monitor QC through 2022 and perhaps exploit it from 2023 or 2025, Gartner stated. + +Join the Network World communities on [Facebook][16] and [LinkedIn][17] to comment on topics that are top of mind. + +-------------------------------------------------------------------------------- + +via: https://www.networkworld.com/article/3570251/amazon-braket-lets-customers-try-out-quantum-computing.html + +作者:[Michael Cooney][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.networkworld.com/author/Michael-Cooney/ +[b]: https://github.com/lujun9972 +[1]: https://en.wikipedia.org/wiki/File:Bloch_Sphere.svg +[2]: https://creativecommons.org/licenses/by-sa/3.0/legalcode +[3]: https://www.networkworld.com/article/3275367/what-s-quantum-computing-and-why-enterprises-need-to-care.html +[4]: https://aws.amazon.com/braket/hardware-providers/dwave/ +[5]: https://aws.amazon.com/braket/hardware-providers/ionq/ +[6]: https://aws.amazon.com/braket/hardware-providers/rigetti/ +[7]: https://aws.amazon.com/braket/ +[8]: https://www.networkworld.com/article/3487421/amazon-joins-the-quantum-computing-crowd-with-braket-testbed.html +[9]: https://en.wikipedia.org/wiki/Bra%E2%80%93ket_notation +[10]: https://aws.amazon.com/braket/pricing +[11]: https://www.networkworld.com/article/3489098/10-hot-quantum-computing-startups-to-watch.html +[12]: https://www.ibm.com/blogs/research/category/quantcomp/ +[13]: https://www.microsoft.com/en-us/quantum/ +[14]: https://qcware.com/ +[15]: https://tractica.omdia.com/newsroom/press-releases/the-quantum-computing-market-is-poised-for-strong-growth-with-global-revenue-to-reach-9-1-billion-by-2030/ +[16]: https://www.facebook.com/NetworkWorld/ +[17]: https://www.linkedin.com/company/network-world diff --git a/sources/talk/20200821 3 ways a legal team can enable open source.md b/sources/talk/20200821 3 ways a legal team can enable open source.md new file mode 100644 index 0000000000..335902b9f4 --- /dev/null +++ b/sources/talk/20200821 3 ways a legal team can enable open source.md @@ -0,0 +1,86 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (3 ways a legal team can enable open source) +[#]: via: (https://opensource.com/article/20/8/open-source-legal-organization) +[#]: author: (Jeffrey Robert Kaufman https://opensource.com/users/jkaufman) + +3 ways a legal team can enable open source +====== +Open source law is unique because of its unusual requirements for +success. Learn ways lawyers can get their organizations to "yes". +![Active listening in a meeting is a skill][1] + +I am an open source lawyer for Red Hat. One important part of my job is to provide information to other companies, including their in-house counsel, about how Red Hat builds enterprise-class products with a completely open source development model and answering their questions about open source licensing in general. After hearing about Red Hat's success, these conversations often turn to discussions about how their organization can evolve to be more open source-aware and -capable, and lawyers at these meetings regularly ask how they can modify their practices to be more skilled in providing open source counsel to their employees. + +In this article and the next, I'll convey what I normally tell in-house counsel about these topics. If you are not in-house counsel and instead work for a law firm supporting clients in the software space, you may also find this information useful. (If you are considering going to law school and becoming an open source lawyer, you should read Luis Villa's excellent article [_What to know before jumping into a career as an open source lawyer_][2].) + +My perspective is based on my personal and possibly unique experience working in various engineering, product management, and lawyer roles. My atypical background means I see the world through a different lens from most lawyers. So, the ideas presented below may not be traditional, but they have served me well in my practice, and I hope they will benefit you. + +### Connect with open source organizations + +There are a multitude of open source organizations that are especially useful to open source lawyers. Many of these organizations have measurable influence over the views and interpretations of open source licenses. Consider getting involved with some of the more prominent organizations, such as the [Open Source Initiative][3] (OSI), the [Software Freedom Conservancy][4], the [Software Freedom Law Center][5], the [Free Software Foundation][6], [Free Software Foundation Europe][7], and the [Linux Foundation][8]. There are also a number of useful mailing lists, such as OSI's [license-discuss][9] and [license-review][10], that are worth monitoring and even participating in. + +Participating in these groups and lists will help you understand the myriad and unique issues you may encounter when practicing open source law, including how various terms of the open source license texts are interpreted by the community. There is little case law to guide you, but there are plenty of people happy to help answer questions, and these resources are the best source of guidance. This is perhaps one of the very unique and amazing aspects of practicing open source law—the openness of the development community is equally matched by the openness of the legal community to provide perspective and advice. All you have to do is ask. + +### Adopt the mindset of a business manager and find a path to yes + +Product managers are ultimately held responsible for a product or service from cradle to grave, including enabling that product or service to get to market. Since the bulk of my career has been spent leading product-management organizations, my mind is programmed to find a path, no matter how, to get a viable product or service to market. I encourage any lawyer to adopt this mindset since products and services are the lifeblood of any business. + +As such, the approach I have always taken in my legal practice involves issue spotting and advising clients of risk _but always having the objective of finding a path to "YES_," especially when my analysis impacts product/service development and release. When evaluating legal issues for internal clients, my executive management or I may, at times, view the risk to be too high. In such cases, continue encouraging everyone to work on the problem because, in my experience, solutions do eventually present themselves, often in unexpected ways. + +Be sure to tap all your resources, including your software development clients (see below), as they can be an excellent source of creative approaches to solving problems, often using technology to resolve issues. I have found much joy in this method, and my clients seem pleased with this passion and sentiment. I encourage all lawyers to consider this approach. + +Sadly, it is always easy to say "no" for self-preservation and to eliminate what may appear to be _any_ risk to the company. I have always found this response untenable. All business transactions have risk. As a counselor, it is your job to understand these risks and present them to your clients so that they may make educated business decisions. Simply saying "no" when any risk is present, without providing any additional context or other paths forward to mitigate risks, does no good for the long-term success of the organization. Companies need to provide products and services to survive, and you should be helping find that path, whenever possible, to YES. You have an ethical responsibility to say "no" in certain situations, of course, but explore and exhaust all reasonable options first. + +### Build relationships with developers + +Building relationships with your software development clients is _absolutely critical_. Building rapport and trust with developers are two important ways to strengthen these relationships. + +#### Build rapport + +Your success as an open source lawyer is most often a direct result of your positive relationships with your software developers. In many cases, your software developers are the direct or indirect recipients of your legal advice, and they will be looking to you for guidance and counsel. Unfortunately, many software developers are suspicious of lawyers and often view lawyers as obstacles to their ability to develop and release software. The best way to overcome this ill will is to build rapport with your clients. How you do that is different for most people, but here are some ideas. + + 1. **Show an interest in your clients' work:** Be inquisitive about the details of their project, how it works, the underlying programming language, how it connects to other systems, and how it will benefit the company. Some of these answers will be useful in your legal analysis when ascertaining legal risk and ways to mitigate such risk, but more importantly, this builds a solid foundation for an ongoing positive relationship with your client. + 2. **Be clear to your client that you are working to find a path to YES:** It is perfectly acceptable to let your client know you are concerned about certain aspects of their project, but follow that up with ideas for mitigating those concerns. Reassure them that it is your job to work with them to find a solution and not to be a roadblock. The effect of this cannot be overstated. + 3. **Participate in an open source project:** This is especially true if you have software development experience. Even if you do not have such experience, there are many ways to participate, such as helping with documentation or community outreach. Or request to join their status meetings just to learn more about their work. This will also allow you to provide counsel on-demand and in real time so that the team may course-correct early in the process. + + + +#### Have trust + +Your software developers are very active in their open source communities and are some of the best resources for understanding current issues affecting open source software and development. Just as you connect with legal organizations, like your local bar or national legal organizations to keep current on the latest legal developments, you should also engage with your software development resources for periodic briefings and to gain their counsel on various matters (e.g., how would the community view the use of this license for a project?). + +### Relationships breed success + +Open source law is unique because of its unusual requirements for success, namely, connections to other open source attorneys, open source organizations, and a deep and respectful relationship with clients. Success is a direct function of these relationships. + +In part two of this series, I will explore how and why it is important to find a path to "open" and to develop scalable solutions for your organization. + +Find out what it takes to become an open source lawyer. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/8/open-source-legal-organization + +作者:[Jeffrey Robert Kaufman][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/jkaufman +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/team-discussion-mac-laptop-stickers.png?itok=AThobsFH (Active listening in a meeting is a skill) +[2]: https://opensource.com/article/16/12/open-source-lawyer +[3]: https://opensource.org/ +[4]: https://sfconservancy.org/ +[5]: https://www.softwarefreedom.org/ +[6]: https://www.fsf.org/ +[7]: https://fsfe.org/index.en.html +[8]: https://www.linuxfoundation.org/ +[9]: https://lists.opensource.org/mailman/listinfo/license-discuss_lists.opensource.org +[10]: https://lists.opensource.org/mailman/listinfo/license-review_lists.opensource.org diff --git a/sources/talk/20200822 3 reasons small businesses choose open source tools for remote employees.md b/sources/talk/20200822 3 reasons small businesses choose open source tools for remote employees.md new file mode 100644 index 0000000000..09d1126926 --- /dev/null +++ b/sources/talk/20200822 3 reasons small businesses choose open source tools for remote employees.md @@ -0,0 +1,77 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (3 reasons small businesses choose open source tools for remote employees) +[#]: via: (https://opensource.com/article/20/8/business-tools) +[#]: author: (Adrian Johansen https://opensource.com/users/ajohansen) + +3 reasons small businesses choose open source tools for remote employees +====== +There are plenty of open source operations tools available if you lack +the budget for premium software; here's how to evaluate your options. +![A chair in a field.][1] + +The last decade or so has seen some significant changes in how businesses operate. The expansion of accessible, affordable, connected technology has removed barriers to many resources, enabling collaboration and execution of work by nearly anyone, from nearly anywhere. Though COVID-19 has made remote operations a necessity for a lot of industries, many businesses had already begun to embrace it as a more cost-effective, agile way of working. + +That said, not every business has the budget to subscribe to premium software as a service (SaaS) to keep their remote employees productive. The good news is that open source software can be every bit as robust and intuitive as the premium options that are only available to those with plenty of capital. The key is clearly identifying what you need from those tools in order to focus your search. + +The open source community can offer some smart solutions to the challenges of remote working, and we’re going to look at a few key areas of need for businesses exploring how they can operate more effectively. + +### Flexible collaboration + +One of the primary challenges for businesses operating remotely is managing the productivity of disparate teams. Employee management can be difficult enough when everybody is in the same room, but keeping teams in close collaboration when they may be working in different cities or even different time zones requires water-tight organization. This is why open source tools that make flexible yet robust collaborations possible are on top of the list for remote teams today. + +Among the best [open source tools][2] on the market at the moment is [Taiga][3], a project management platform. It uses the card-style task organization approach, providing a board that is visible to all employees on the network and keeps leadership and team members informed about the status of individual tasks and overall project progress. Open source project management software that mimics the easy collaboration that premium services like Trello and Asana offer are increasingly popular. Many—[Odoo][4] and [OpenProject][5] among them—go further than their premium counterparts, offering integrated apps for forecasting and making it easier to share and transfer files or documents. + +When it comes to remote collaboration, effective communication tools are also a must. Team chat platforms can help to make certain that remote employees have access to leadership and other team members whenever they need assistance or clarification on tasks. The chat room nature of them also helps to build team camaraderie. [Mattermost][6] and [Rocket.Chat][7] are among the popular open source platforms that act as [effective alternatives to SaaS like Slack][8]; both have free options, public and private chat rooms, and the ability to upload and share media files. + +### User-friendliness + +There is a focus on effective user interfaces (UI) across the software industry at the moment, and this is arguably even more essential for remote teams. This is not just important for the day-to-day functionality of tools but also for ease of training. New employee onboarding can be improved by implementing a clear, fluid process that introduces new hires to the business’ core practices and tools. This means that any open source software deployed must be user-friendly enough to require minimal guidance and cause few disruptions during ramp-up. + +It certainly helps when the software itself is designed intuitively. [Drawpile][9] is an excellent example of this. [This collaborative drawing platform][10], used for team meetings and creative projects alike, uses clear icons and interfaces that are similar to popular drawing platforms like Photoshop or MSPaint. It also presents a minimalistic, functional approach to avoid overwhelming the uninitiated. When reviewing open source software, business leaders need to consider the perspective of a new user and evaluate its ease of use. + +It’s also important to take into account what instructional assets the developers have provided. Many have online manuals, though the nature of open source can mean that these frequently change and evolve over time. Some, like storage and sharing platform [Nextcloud][11], include separate training materials for users, developers, and administration. Review accessibility to concise documentation like this and ensure that it can be easily integrated, delivered, and understood during your remote employee onboarding process. + +### Security and support + +A concern for any business owner operating in digital spaces is ensuring that operations are not just efficient but secure. One of the aspects that can make premium software attractive is robust cybersecurity protocols and integrated support services. In searching for open source software, it’s important to understand the extent to which developers have put security protocols in place, and how this affects company, employee, and customer safety. + +This can be especially important when utilizing platforms that facilitate the sharing of documents and discussion of potentially sensitive company information. Many options on the market, including [Jitsi][12] and [BigBlueButton][13], are upfront about the security measures and encryptions on their software that often go beyond those on premium platforms. However, it’s equally important to make certain that employees themselves understand that their actions are as vital to security as the encryption. Be clear about what behavior can lead to phishing attacks that make the business vulnerable to two-factor authentication bypassing, and how to safely share information through activities such as dynamic linking. + +One of the most significant advantages that open source software holds over most premium products is access to a vibrant and supportive community. While there are core teams behind the software, there’s a spirit of collaboration and collective ownership to its development and continued growth. [LibreOffice][14] actively encourages its users to [help improve the product][15] through feedback and forums. This means users can often easily communicate with experts whenever issues arise and work together to solve problems, and ultimately make the product better in the future. + +### Conclusion + +Review how open source software can improve collaboration, and fit into your onboarding procedures, and examine the potential for security and community support. And by using open source, you retain control over your data, assets, and workflow. In a world that is swiftly embracing remote practices, discovering the right tools now can give you a competitive advantage. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/8/business-tools + +作者:[Adrian Johansen][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/ajohansen +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/BIZ_WorkInPublic_4618517_1110_CS_A.png?itok=RwVrWArk (A chair in a field.) +[2]: https://opensource.com/article/20/3/open-source-working-home +[3]: https://taiga.io/ +[4]: https://www.odoo.com/ +[5]: https://www.openproject.org/ +[6]: https://mattermost.com/ +[7]: https://rocket.chat/ +[8]: https://opensource.com/alternatives/slack +[9]: https://drawpile.net/ +[10]: https://opensource.com/article/20/3/drawpile +[11]: https://nextcloud.com/ +[12]: https://jitsi.org/ +[13]: https://bigbluebutton.org/ +[14]: https://www.libreoffice.org/ +[15]: https://www.libreoffice.org/community/get-involved/ diff --git a/sources/talk/20200823 Open organizations through the ages.md b/sources/talk/20200823 Open organizations through the ages.md new file mode 100644 index 0000000000..680cb789b5 --- /dev/null +++ b/sources/talk/20200823 Open organizations through the ages.md @@ -0,0 +1,69 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Open organizations through the ages) +[#]: via: (https://opensource.com/open-organization/20/8/global-history-collaboration) +[#]: author: (Ron McFarland https://opensource.com/users/ron-mcfarland) + +Open organizations through the ages +====== +On a global timeline, extensive collaboration is still a relatively new +phenomenon. That could explain why we're still getting the hang of it. +![Alarm clocks with different time][1] + +Consider the evolution of humankind. When we do, we will recognize that _having global discussions_ and _acting on global decisions_ is a relatively new phenomenon—only 100 years old, give or take a few years. We're still learning _how_ to make global decisions and execute on them successfully. + +Yet our ability to improve those globally focused practices and skills is critical to our continued survival. And open principles will be the keys to helping us learn them—as they have been throughout history. + +In the [first part of this series][2], I reviewed four factors one might use to assess globalization, and I explained how those factors relate specifically to [open organization principles][3]. Here, I'd like to present a chronology of how those principles have influenced certain developments that have made the world feel more connected and have made _personal_ or _regional_ issues into _global_ issues. + +This work draws on research by [Jeffrey D. Sachs][4], author of the book [_The Ages of Globalization_][5]. Sachs examines globalization from the genesis of humankind and argues that globalization has improved life and prosperity through the ages. He organizes human history into seven "ages," and examines the governance structure predominant in each. That structure determines how populations interact with each other (another way of assessing how socially inclusive they are). For Sachs, that inclusiveness is directly related to per capita GDP, or productivity per person. That productivity is where prosperity (or survival) is determined. + +So let's look at the growth of globalization through the ages (I'll use Sachs' categorizations) and see where open organization principles began to take hold in early civilizations. In this piece, I'll discuss historical periods up to the beginning of the Industrial Revolution (the early 1800s). + +### The Paleolithic Age (70,000‒10,000 BCE): The hunter/gatherer setting + +According to Sachs, the history of globalization really begins at the dawn of humankind. And open organization principles are evident even then—though only in tight-knit groups of 25 to 30 members, called "bands," each very similar to "bottom-up" business teams today. Such bands resisted hierarchical organization, eventually connecting with other bands to form "clans" of around 150 people, then "mega-bands" of around 500 people, and finally to "tribes" of around 1,500 people. But these groups never let go of that "band" concept (we can observe this in ancient ruins around the globe). Bands cooperated, but interactions were relatively weak (sometimes even warlike, as bands fought to protect territory). As bands' means of survival was primarily hunting and gathering, they lived a largely nomadic lifestyle. + +### The Neolithic Age (10,000‒3,000 BCE): The ranching/farming setting + +The advent of farming and ranching, Sachs says, marked this period of globalization. During that period, major segments of the human population started establishing permanent settlements, leading to decline in the hunter and gatherer nomadic lifestyle, as agricultural developments allowed for more productivity per unit area. People could establish larger villages. With new agricultural techniques, ten individuals could survive on one square kilometer of land (compared to only one person per square kilometer of hunter/gatherers). Therefore, people were not forced to migrate to new areas to survive. Communities grew larger, and these larger communities set in motion new technical discoveries in metallurgy, the arts, numeric record keeping, ceramics, and even a writing system to record technical breakthroughs. In short, _sharing_ and _collaboration_ became keys to expanding know-how, evidence of open organization principles even tens of thousands of years ago. + +Having global discussions and acting on global decisions is a relatively new phenomenon—only 100 years old, give or take a few years. + +### The Equestrian Age (3,000‒1,000 BCE): The land travel by horse setting + +During the Neolithic Age, communities began connecting with each other using horses for transportation, giving rise to another era of globalization—what Sachs calls The Equestrian Age. Domestication of animals took place almost exclusively in Eurasia and North Africa, including the use of donkeys, cattle, camels and other animals (not just horses). That domestication was by far the most important factor in the economic development and globalization in this age. Animal husbandry was a major influence on farming, mining, manufacturing, transportation, communications, warfare tactics, and governance. As greater long-distance movement was now possible (routes were formed to and from the east and west), whole civilizations began to form. The Egyptians introduced a system of writing and documentation, as well as public administration, which unified dynasties within the region. This led to advances in scientific fields, including mathematics, astronomy, engineering, metallurgy, and medicine. + +### The Classical Age (1,000 BCE‒1500 CE): An information, documentation, learning setting + +According to Sachs, this era of globalization involves the globalization of politics—namely conquering wide regions and creating empires. This includes the empires of Assyria, Persia, Greece, Rome, India, China and later the Ottoman and Mongol empires. This age saw the spread of ideas, technology, institutional concepts, and infrastructural development on a continental scale. As a result, larger communities were developed, and there was a greater and broader level of collaboration, interaction, transparency, adaptability and inclusivity than in the past. Through interaction between empires, better methods of growing food, raising farm animals, transporting goods and fighting wars spread around the globe. Much of this knowledge spread through thousands of books published, distributed, and taught (formal, community schooling began in this era, as did several documentation practices). Global trade improved with the establishment of a navy to police and protect travel routes. Simply put, this was a setting of multinational governance with ever expanding collaboration, inclusivity, and larger community development. + +### The Ocean Age (1500‒1800 CE): The long-distance sea travel and exploration setting + +During this period of globalization, Sachs says, the Old World and the New World, isolated from each other since the Paleolithic Age, finally united through ever faster ocean-going vessels, leading to greater two-way exchange. Plants, animals—and, unfortunately, diseases and pathogens—trafficked between them. Travel from Europe to Asia (via the Cape of Good Hope) increased during this era. This age saw the rise of global capitalism, with the establishment of global-scale economic organizations, like the British East India Company (chartered in 1600) and the Dutch East India Company (chartered in 1602). Each supplied global markets with goods from remote areas. But while global trade produced great prosperity during this era, in many regions it also led to great cruelty (the exploitation of indigenous peoples, for example). + +By the 1800s, communities were interacting on a scale more global than it had ever been, and open organization principles were more influential than ever before. And yet this era still saw a significant deficit of overall inclusivity and collaboration. We should note that this era of globalization is relatively _recent_ in history when viewed on the timescale Sachs outlines in _The Ages of Globalization_. + +How did we get from there to the current age? In the next article, I'll explore those developments. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/open-organization/20/8/global-history-collaboration + +作者:[Ron McFarland][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/ron-mcfarland +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/clocks_time.png?itok=_ID09GDk (Alarm clocks with different time) +[2]: https://opensource.com/open-organization/20/7/globalization-history-open +[3]: https://opensource.com/open-organization/resources/open-org-definition +[4]: https://en.wikipedia.org/wiki/Jeffrey_Sachs +[5]: https://cup.columbia.edu/book/the-ages-of-globalization/9780231193740 diff --git a/sources/talk/20200824 Origin stories about Unix.md b/sources/talk/20200824 Origin stories about Unix.md new file mode 100644 index 0000000000..fa40a70345 --- /dev/null +++ b/sources/talk/20200824 Origin stories about Unix.md @@ -0,0 +1,75 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Origin stories about Unix) +[#]: via: (https://opensource.com/article/20/8/unix-history) +[#]: author: (Jim Hall https://opensource.com/users/jim-hall) + +Origin stories about Unix +====== +Brian Kernighan, one of the original Unix gurus, shares his insights +into the origins of Unix and its associated technology. +![Old UNIX computer][1] + +Brian W. Kernighan opens his book _Unix: A History and a Memoir_ with the line, "To understand how Unix happened, we have to understand Bell Labs, especially how it worked and the creative environment that it provided." And so begins a wonderful trip back in time, following the creation and development of early Unix with someone who was there. + +You may recognize Brian Kernighan's name. He is the "K" in [AWK][2], the "K" in "K&R C" (he co-wrote the original "Kernighan and Ritchie" book about the C programming language), and he has authored and co-authored many books about Unix and technology. On my own bookshelf, I can find several of Kernighan's books, including _The Unix Programming Environment_ (with Rob Pike), _The AWK Programming Language_ (with Alfred Aho and Peter J. Weinberger), and _The C Programming Language_ (with Dennis M. Ritchie). And of course, his latest entry, _Unix: A History and a Memoir_. + +I interviewed Brian about this most recent book. I think we spent equal amounts of time discussing the book as we did reminiscing about Unix and groff. Below are a few highlights of our conversation: + +### JH: What prompted you to write this book? + +BWK: I thought it would be nice to have a history of what happened at Bell Labs. Jon Gertner wrote a book, _The Idea Factory: Bell Labs and the Great Age of American Innovation_, that described the physical science work at Bell Labs. This was an authoritative work, very technical, and not something that I could do, but it was kind of the inspiration for this book. + +There's also a book by James Gleick, _The Information: A History, a Theory, a Flood_, that isn't specific to Bell Labs, but it's very interesting. That was kind of an inspiration for this, too. + +I originally wanted to write an academic history of the Labs, but I realized it was better to write something based on my own memories and the memories of those who were there at the time. So that's where the book came from. + +### JH: What are a few stories from the book you'd like people to read about? + +BWK: I think there are really two stories I'd like people to know about, and both of them are origin myths. I heard them afresh when Ken Thompson and I were at the [Vintage Computer Festival about a year ago][3]. + +One is the origin of Unix itself—how Bonnie, Ken's wife, went off on vacation for three weeks, just at the time that Ken thought he was about three weeks away from having a complete operating system. This was, of course, due to Ken's very competent programming abilities, and it was incredible he was able to pull it off. It was written entirely in Assembly and was really amazing work. + +[Note: This story starts on page 33 in the book. I'll briefly relate it here. Thompson was working on "a disk scheduling algorithm that would try to maximize throughput on any disk," but particularly the PDP-7's very tall single-platter disk drive. In testing the algorithm, Thompson realized, "I was three weeks from an operating system." He broke down his work into three units—an editor, an assembler, and a kernel—and wrote one per week. And about that time, Bonnie took their son to visit Ken's parents in California, so Thompson had those three weeks to work undisturbed.] + +And then there's the origin story for `grep`. Over the years, I'd gotten the story slightly wrong—I thought Ken had written `grep` entirely on demand. It was classic Ken that he had a great idea, a neat idea, a clean idea, and he was able to write it very quickly. Regular expressions (regex) were already present in the text editor, so really, he just pulled regex from the editor and turned it into a program. + +[Note: This story starts on page 70 in the book. Doug McIlroy said, "Wouldn't it be great if we could look for things in files?" Thompson replied, "Let me think about it overnight," and the next morning presented McIlroy with the `grep` program he'd written.] + +### JH: What other stories did you not get to tell in the book? + +BWK: I immediately think of the "Peter Weinberger's face" story! There were a lot of pranks based on having a picture of Peter's face pop up in random places. Someone attached a picture of Peter with magnets to the metal wall of a stairway. And there was a meeting once where Peter was up in front, not in the audience. And while he was talking, everyone in the audience held up a mask that had Peter's face printed on it.  + +[Note: The "Peter Weinberger's face" story starts on page 47 in the book. Spinroot also has an [archive of the prank][4] with examples.] + +I talked to a lot of people from the Labs about the book. I would email people, and I would receive long replies with more stories than I could fit into the length or the narrative. Honestly, there's probably a whole other book that someone else could write just based on those stories. It's amazing how many people come forward with stories about Unix and running Unix on systems I haven't even heard of. + +## A fantastic read + +_Unix: A History and a Memoir_ is well-titled. Throughout the book, Kernighan shares details on the rich history of Unix, including background on Bell Labs, the spark of Unix with CTSS and Multics in 1969, and the first edition in 1971. Kernighan also provides his own reflection on how Unix came to be such a dominant platform, including notes on portability, Unix tools, the Unix Wars, and Unix descendants such as Minix, Linux, BSD, and Plan9. You will also find nuggets of information and great stories that fill in details around some of the everyday features of Unix. + +At just over 180 pages, _Unix: A History and a Memoir_ is a fantastic read. If you are a fan of Linux, or any open source Unix, including the BSD versions, you will want to read this book. + +_Unix: A History and a Memoir_ is available on [Amazon][5] in paperback and e-book formats. Published by Kindle Direct Publishing, October 2019. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/8/unix-history + +作者:[Jim Hall][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/jim-hall +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/retro_old_unix_computer.png?itok=SYAb2xoW (Old UNIX computer) +[2]: https://opensource.com/resources/what-awk +[3]: https://www.youtube.com/watch?v=EY6q5dv_B-o +[4]: https://spinroot.com/pico/pjw.html +[5]: https://www.amazon.com/dp/1695978552 diff --git a/sources/talk/20200825 Why we open sourced our security project.md b/sources/talk/20200825 Why we open sourced our security project.md new file mode 100644 index 0000000000..bc11945595 --- /dev/null +++ b/sources/talk/20200825 Why we open sourced our security project.md @@ -0,0 +1,102 @@ +[#]: collector: (lujun9972) +[#]: translator: (Starryi) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Why we open sourced our security project) +[#]: via: (https://opensource.com/article/20/8/why-open-source) +[#]: author: (Mike Bursell https://opensource.com/users/mikecamel) + +Why we open sourced our security project +====== +It’s not just coding that we do in the open. +![A lock on the side of a building][1] + +When Nathaniel McCallum and I embarked on the project that is now called [Enarx][2], we made one decision right at the beginning: the code for Enarx would be open source, a stance fully supported by our employer, Red Hat (see the [standard disclaimer][3] on my blog). All of it, and forever. + +That's a decision that we've not regretted at any point, and it's something we stand behind. As soon as we had enough code for a demo and were ready to show it, we created a [repository on GitHub][4] and made it public. There's a very small exception, which is that there are some details of upcoming chip features that are shared with us under an NDA[1][5] where publishing any code we might write for them would be a breach of the NDA. But where this applies (which is rarely), we are absolutely clear with the vendors that we intend to make the code open as soon as possible, and we lobby them to release details as early as they can (which may be earlier than they might prefer) so that more experts can look over both their designs and our code. + +### Auditability and trust + +This brings us to possibly the most important reasons for making Enarx open source: auditability and trust. Enarx is a security-related project, and I believe passionately not only that [security should be done in the open][6] but also that if anybody is actually going to trust their sensitive data, algorithms, and workloads to a piece of software, then they want to be in a position where as many experts as possible have looked at it, scrutinised it, criticised it, and improved it, whether that is the people running the software, their employees, contractors, or (even better) the wider security community. The more people who check the code, the happier you should be to [trust it][7]. This is important for any piece of security software, but it is _vital_ for software such as Enarx, which is designed to protect your most sensitive workloads. + +### Bug catching + +There are bugs in Enarx. I know: I'm writing some of the code,[2][8] and I found one yesterday (which I'd put in), just as I was about to give a demo.[3][9] It is very, very difficult to write perfect code, and we know that if we make our source open, then more people can help us fix issues. + +### Commonwealth + +For Nathaniel and me, open source is an ethical issue, and we make no apologies for that. I think it's the same for most, if not all, of the team working on Enarx. This includes a number of Red Hat employees (see standard disclaimer), so it shouldn't come as a surprise, but we also have non-Red Hat contributors from a number of backgrounds. We feel that Enarx should be a Common Good and [contribute to the commonwealth][10] of intellectual property out there. + +### More brainpower + +Making something open source doesn't just make it easier to fix bugs: it can improve the quality of what you produce in general. The more brainpower you have to apply to the problem, the better your chances of making something great––assuming that the brainpower is applied efficiently (not always an easy task!). In a recent design meeting, one of the participants said towards the end, "I'm sure I could implement some of this, but I don't know a huge amount about this topic, and I'm worried that I'm not contributing to this discussion." In fact, they had contributed by asking questions and clarifying some points, and we assured them that we wanted to include experienced, senior developers for their expertise and knowledge and to pull out assumptions and validate the design, and not because we expected everybody to be experts in all parts of the project. + +Having bright people involved in design and coding spreads expertise and knowledge and helps keep the work from becoming an insulated, isolated "ivory tower" construction, understood by few, and almost impossible to validate. + +### Not just code + +It's not just coding that we do in the open. We manage our architecture in the open, our design meetings, our protocol design, our design methodology,[4][11] our documentation, our bug tracking, our chat, our CI/CD processes: all of it is open. The one exception is our [vulnerability management][12] process, which needs the opportunity for confidential exposure for a limited time. Here is where you can find our resources: + + * [Code][4] + * [Wiki][13] + * Design is on the wiki and [request for comments][14] repo + * [Issues][15] and [pull requests][16] + * [Chat][17] (thanks to [Rocket.chat][18]!) + * CI/CD resources thanks to [Packet][19]! + * [Stand-ups][20] + + + +We also take diversity seriously, and the project contributors are subject to the [Contributor Covenant Code of Conduct][21]. + +In short, Enarx is an open project. I'm sure we could do better, and we'll strive for that, but our underlying principles are that open is good in general and vital for security. If you agree, please come and visit! + +* * * + + 1. Non-disclosure agreement + 2. To the surprise of many of the team, including myself. At least it's not in Perl. + 3. I fixed it. Admittedly, after the demo. + 4. We've just moved to a sprint pattern, the details of which we designed and agreed to in the open. + + + +* * * + +_This article was originally published on [Alice, Eve, and Bob][22] and is adapted and reprinted with the author's permission._ + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/8/why-open-source + +作者:[Mike Bursell][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/mikecamel +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/BUSINESS_3reasons.png?itok=k6F3-BqA (A lock on the side of a building) +[2]: https://enarx.dev/ +[3]: https://aliceevebob.com/ +[4]: https://github.com/enarx +[5]: tmp.PM1nWCfATC#1 +[6]: https://opensource.com/article/17/10/many-eyes +[7]: https://aliceevebob.com/2019/06/18/trust-choosing-open-source/ +[8]: tmp.PM1nWCfATC#2 +[9]: tmp.PM1nWCfATC#3 +[10]: https://opensource.com/article/17/11/commonwealth-open-source +[11]: tmp.PM1nWCfATC#4 +[12]: https://aliceevebob.com/2020/05/26/security-disclosure-or-vulnerability-management/ +[13]: https://github.com/enarx/enarx/wiki +[14]: https://github.com/enarx/rfcs +[15]: https://github.com/enarx/enarx/issues +[16]: https://github.com/enarx/enarx/pulls +[17]: https://chat.enarx.dev/ +[18]: https://rocket.chat/ +[19]: https://packet.com/ +[20]: https://github.com/enarx/enarx/wiki/How-to-contribute +[21]: https://github.com/enarx/.github/blob/master/CODE_OF_CONDUCT.md +[22]: https://aliceevebob.com/2020/07/28/why-enarx-is-open/ diff --git a/sources/talk/20200828 Why Comcast open sourced its DNS management tool.md b/sources/talk/20200828 Why Comcast open sourced its DNS management tool.md new file mode 100644 index 0000000000..74601f556d --- /dev/null +++ b/sources/talk/20200828 Why Comcast open sourced its DNS management tool.md @@ -0,0 +1,95 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Why Comcast open sourced its DNS management tool) +[#]: via: (https://opensource.com/article/20/9/open-source-dns) +[#]: author: (Paul Cleary https://opensource.com/users/pauljamescleary) + +Why Comcast open sourced its DNS management tool +====== +This open source DNS management tool was built by and for the telcom +giant, but is establishing itself in its own right and welcoming more +contributors. +![An intersection of pipes.][1] + +Adoption of [DevOps][2] practices at Comcast led to increased automation and configuration of infrastructure that supports applications, back-office, data centers, and our network. These practices require teams to move fast and be self-reliant. Infrastructure is constantly turned upside down, with network traffic moved around it constantly. Good DNS record management is critical to support this level of autonomy and automation, but how can a large, diverse enterprise move quickly while safely governing its DNS assets? + +### Challenge + +Prior to 2016, DNS record management was mostly done through an online ticketing system—users would submit tickets for DNS changes that were manually reviewed and implemented by a separate team of DNS technicians. This system frequently required manual intervention for many of the DNS requests, which was time-consuming. + +Turnaround times for DNS changes were in hours, which is not suitable for infrastructure automation. Large Internet companies can manage millions of DNS records, making it practically impossible for DNS technicians to certify the correctness of the thousands of DNS updates being requested daily. This increased the possibility of an inadvertent errant update to a critical DNS record that ultimately would lead to a downtime event. + +In addition, engineering teams are intimately familiar with their DNS needs—much more so than a single group of DNS technicians serving an entire enterprise. So, we needed to enable engineering teams to self-service their own DNS records, implement changes quickly (in seconds), and at the same time, make sure all changes are done safely. + +### Solution + +VinylDNS was built at Comcast and subsequently opened to empower engineering teams to automate as they please while providing the safety and administrative controls demanded by DNS operators and the Comcast Security team. + +### Security as a way of life + +VinylDNS is all about automation and enhanced security. At Comcast, the VinylDNS team worked in close coordination with both the DNS and engineering teams at Comcast, as well as the security team, to meet stringent engineering and security requirements. An incredible array of access controls was implemented that give extreme flexibility to both DNS operators and engineering teams to control their DNS assets. + +Access controls implemented at the DNS zone level allow any team to control who can make updates to their DNS zones. When a DNS zone is registered and authorized to a VinylDNS group, only members of that group can make changes to DNS records in that DNS zone. In addition, access-list (ACL) rules provide extreme flexibility to allow other VinylDNS users to manage records in that zone. These ACL rules can be defined using regular expression masks or classless inter-domain routing (CIDR) rules and DNS record types that lock down access to specific users and groups to certain records in specific DNS zones. + +### Meeting the demands of automation + +A [representational state transfer (REST) API][3] was built along with the system. This uses request signing to help eliminate man-in-the-middle attacks. Once the engineering teams at Comcast caught wind of the kind of automation afforded by VinylDNS, many began building out tooling to integrate directly with VinylDNS via its API. It wasn't long before most of them were using organically developed tooling integrated with the VinylDNS API to support their DNS needs. + +### Performing at large enterprise scale + +Very quickly, VinylDNS was managing a million DNS records and thousands of DNS zones, and supporting hundreds of engineers. As we sought to expand VinylDNS to support the rest of Comcast, we recognized some challenges. + + 1. Certain DNS records were off-limits, deemed too critical to manage in any way other than by hand. + 2. The ACL rule model, while flexible, would be impossible to set up and maintain across the entirety of Comcast's DNS footprint (which has millions of DNS zones, and hundreds of millions of DNS records). + 3. Many DNS domains are considered "universal" and not locked down to a single group. This holds true for reverse zones, as IP space can often be freely assigned to anyone. + 4. Certain DNS change requests still require a manual review and approval, i.e., you cannot truly automate everything. + 5. Some teams that provision a DNS record are not the same engineers responsible for its lifecycle. The engineers that ultimately decommission a DNS record might be unknown at the time of creation. + 6. Certain teams require DNS changes to be scheduled at some point in the future. For example, maintenance may be done off-hours, and the employee doing the maintenance may not have access to VinylDNS. + + + +To address these issues, VinylDNS added more access controls and features. Shared zones allow universal access while maintaining security via record ownership. Record ownership ensures that the party who creates a DNS record is the only one that can manage that record. This feature alone allowed us to move much of the DNS reverse space into VinylDNS. + +Manual review was added to support tighter governance on certain DNS zones and records. For example, a sensitive DNS zone might demand review before implementing changes, as opposed to having all changes immediately applied. + +High-value domains support was added to block VinylDNS from ever being able to update certain DNS records. High-value DNS records like [www.comcast.com][4], for example, are impossible to manage via VinylDNS and require extreme governance that can't be accomplished via an automation platform. + +Global ACLs were added to support situations where teams that created DNS records were not responsible for the maintenance and decommissioning of those DNS records. This allowed overrides for certain groups by fully qualified domain name (FQDN) and IP address for certain DNS domains. + +Finally, scheduled changes allow users to schedule a DNS change for a future time. + +### Results + +VinylDNS now governs most of Comcast's internal DNS space, managing millions of DNS records across thousands of DNS zones, and supporting thousands of engineers. In addition, we leverage integration with a wide array of tools and programming languages, including Java, Python, Go, and Ruby (most of which are open source). + +### Toward the future + +There are several opportunities for additional feature development, which Comcast has planned as part of its ongoing evolution of the platform. The same level of access controls and governance is needed for DNS assets managed in public cloud settings. In addition, we are looking into the ability to manage DNS zones (create and delete), which is required for IPv6 reverse zones. Finally, we are looking to create a powerful admin experience for our DNS operators who are looking to take advantage of the data that lives in the VinylDNS database. + +### Opening up + +[VinylDNS][5] is an open source project released and managed by [Comcast Open Source][6]. VinylDNS and its accompanying ecosystem were built by engineers in several organizations across Comcast, leveraging our inner source program. It is free for use, licensed under Apache License 2.0. We welcome all contributors, from code to bugs to feature requests, from new projects to project ideas. You can [contact our team on Gitter][7]. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/9/open-source-dns + +作者:[Paul Cleary][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/pauljamescleary +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/LAW-Internet_construction_9401467_520x292_0512_dc.png?itok=RPkPPtDe (An intersection of pipes.) +[2]: https://opensource.com/resources/devops +[3]: https://www.redhat.com/en/topics/api/what-is-a-rest-api +[4]: http://www.comcast.com +[5]: https://www.vinyldns.io +[6]: https://comcast.github.io/ +[7]: https://gitter.im/vinyldns/vinyldns diff --git a/sources/talk/20200830 The power of open source during a pandemic.md b/sources/talk/20200830 The power of open source during a pandemic.md new file mode 100644 index 0000000000..e2ab4fd400 --- /dev/null +++ b/sources/talk/20200830 The power of open source during a pandemic.md @@ -0,0 +1,71 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (The power of open source during a pandemic) +[#]: via: (https://opensource.com/open-organization/20/8/power-open-source-during-pandemic) +[#]: author: (Laura Hilliger https://opensource.com/users/laurahilliger) + +The power of open source during a pandemic +====== +Successfully addressing shared global problems requires open source—both +principles and code—to foster innovation quickly and bridge gaps in +effective remote collaboration. +![Open source prescription.][1] + +When a novel coronavirus made headlines earlier this year, the world wasn't ready. In a short period of time, we all witnessed the consequences of having a global, interconnected economy unprepared for effective global collaboration. Indeed, this pandemic shed light on the under-preparedness of a truly global economy in a hyper-connected world. We didn't pay attention to the fact that a health issue in China could have an impact on both the real estate market in North Carolina and a shoe factory in Italy. Facing a pandemic, especially one that forced such extreme social distancing, required drastic shifts—both technological and social. + +Many organizations, governments, and companies realized that facing a global pandemic like COVID-19 required new tools for tracking the spread of the virus. In order to keep up with this growing threat, decision makers around the world needed effective technological solutions for both tracking and contact tracing; we needed correct, up-to-the-minute data for making the best decisions. Facing this pandemic also required non-technical organizations to become technically capable quite quickly. Organizations were forced to rapidly build new solutions and uncover new ways of working. Facing this new global problem, the world realized that the digital transformation everyone has been talking about—but delaying until they had a budget—was now more important than ever. + +Moreover, as we started to advise and work with different organizations around the world, we discovered that many of them were facing similar issues. As a last minute solution, many started building not only their own custom technologies but also their own custom _organizational strategies_ for tackling this crisis. Quick but reactive approaches left many governments and organizations across the world building exactly the same solutions, often in isolation. Had they collaborated and shared what they were learning, they could have been building solutions _with_ one another. + +In other words: Had they been operating more like open source communities and truly open organizations, they could have found better answers sooner. + +### Building global solutions the open source way + +For years, members of the open source community have been collaborating with one another on projects like these. We've been working together in remote environments since long before the pandemic hit. Our processes and policies, documented or not, have allowed us to push the technology industry forward at warp speed. In a mere 30 years, we've managed to make open source the standard for new software, and we've proven that global, remote, community-based collaboration can solve big problems. + +Now the rest of the world seems to be following suit, adapting open principles and practices to create global change. By relying on the open source principles and code, we could truly build more effectively shared solutions and strategies that could help us all stop a global pandemic. + +We see many examples of openness bridging collaboration gaps. The [UK Government Digital Service][2] is uniting citizens and government, helping the government to operate more effectively and efficiently. The [UNESCO Global Network of Learning Cities][3] is pushing city education policy forward, facilitating partnerships between member cities. [Greenpeace is championing open source][4], and using it to help change mindsets and behaviors surrounding the climate emergency. Other coalitions have pledged to accelerate [cooperation on a coronavirus vaccine and to share research][5], treatment, and medicines across the globe. + +The world needs to shift the way it's approaching problems and continue locating solutions the open source way. Individually, this might mean becoming connection-oriented problem-solvers. We need people able to think communally, communicate asynchronously, and consider innovation iteratively. We're seeing that organizations would need to consider technologists less as tradespeople who build systems and more as experts in global collaboration, people who can make future-proof decisions on everything from data structures to personnel processes. + +### A new strategy: Cross-sector social innovation + +Now is the time to start building new paradigms for global collaboration and find unifying solutions to our shared problems, and one key element to doing this successfully is our ability to work together across sectors. A global pandemic needs the public sector, the private sector, and the nonprofit world to collaborate, each bringing its own expertise to a common, shared platform. + +By relying on the open source principles and code, we could truly build more effectively shared solutions and strategies that could help us all stop a global pandemic. + +The private sector plays a key role in building this method of collaboration by building a robust social innovation strategy that aligns with the collective problems affecting us all. This pandemic is a great example of collective global issues affecting every business around the world, and this is the reason why shared platforms and effective collaboration will be key moving forward. + +Social innovation is an approach to social responsibility that requires a unique strategy for every organization, one directly linking their business goals and company values to the common good. The most effective way of implementing this strategy that requires fast-paced, social innovation is by embracing open source principles to enable collaboration across regions and sectors. + +For example, [PathCheck][6] Foundation is doing this to quickly and effectively build a platform for shared needs. The PathCheck suite of open source software gives public and private sector organizations solutions for digital contact tracing and exposure notification, with the goal of containing COVID-19 and restarting the economy without sacrificing privacy. Started by Prof. Ramesh Raskar and passionate students at MIT—and now consisting of 1800 volunteers in partnership with many companies, and supported by a newly created nonprofit—PathCheck is a great example of how collaboration on an open source platform is a multiplier (being developed by a growing global, passionate, community of engineers, scientist, health authorities, designers, and contributors, and being used by many governments and organizations than any other service provider). + +There is a way to tackle the pandemic and other global issues more effectively through shared platforms and open collaboration. Open source advocates have been doing it for a while, bringing open source to non-profits, governments and corporations, opening up education, connecting open design to global knowledge networks, building open hardware initiatives and structuring open government work. Members of the global open source community have already shown how the post-pandemic world could look—humane, transparent, collaborative, diverse. + +Last but not least, the power of the individual aligned with a community—and the power of collaboration for solving issues that are important to all of us—are more powerful than we think. When companies, the public sector, and nonprofits work together, everyone can be part of a _shared_ solution. An open source approach allows every individual to make an impact and contribute to projects using different, complementary skill sets. + +Everyone can make a difference every day. And we can use the power of open source to ensure that difference changes the world for good. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/open-organization/20/8/power-open-source-during-pandemic + +作者:[Laura Hilliger][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/laurahilliger +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/osdc_520x292_opensourceprescription.png?itok=gFrc_GTH (Open source prescription.) +[2]: https://www.gov.uk/government/organisations/government-digital-service/about +[3]: https://uil.unesco.org/lifelong-learning/learning-cities +[4]: https://opensource.com/tags/open-organization-greenpeace +[5]: https://opensource.com/open-organization/20/6/covid-alliance +[6]: https://pathcheck.org/ diff --git a/sources/talk/20200831 Making Zephyr More Secure.md b/sources/talk/20200831 Making Zephyr More Secure.md new file mode 100644 index 0000000000..9b63cbe66d --- /dev/null +++ b/sources/talk/20200831 Making Zephyr More Secure.md @@ -0,0 +1,59 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Making Zephyr More Secure) +[#]: via: (https://www.linux.com/audience/developers/making-zephyr-more-secure/) +[#]: author: (Swapnil Bhartiya https://www.linux.com/author/swapnil/) + +Making Zephyr More Secure +====== + +Zephyr is gaining momentum where more and more companies are embracing this open source project for their embedded devices. However, security is becoming a huge concern for these connected devices. The NCC Group recently conducted an evaluation and security assessment of the project to help harden it against attacks. In the interview, Kate Stewart, Senior Director of Strategic Programs at Linux Foundation talk about the assessment and the evolution of the project. + +Here is a quick transcript of the interview: + +**Swapnil Bhartiya: The NCC group recently evaluated Linux for security. Can you talk about what was the outcome of that evaluation?** +Kate Stewart: We’re very thankful for the NCC group for the work that they did and helping us to get Zephyr hardened further. In some senses when it had first hit us, it was like, “Okay, they’re taking us seriously now. Awesome.” And the reason they’re doing this is that their customers are asking for it. They’ve got people who are very interested in Zephyr so they decided to invest the time doing the research to see what they could find. And the fact that we’re good enough to critique now is a nice positive for the project, no question. + +Up till this point, we’d had been getting some vulnerabilities that researchers had noticed in certain areas and had to tell us about. We’d issued CVEs so we had a process down, but suddenly being hit with the whole bulk of those like that was like, “Okay, time to up our game guys.” And so, what we’ve done is we found out we didn’t have a good way of letting people who have products with Zephyr based on them know about our vulnerabilities. And what we wanted to be able to do is make it clear that if people have products and they have them out in the market and that they want to know if there’s a vulnerability. We just added a new webpage so they know how to register, and they can let us know to contact them. + +The challenge of embedded is you don’t quite know where the software is. We’ve got a lot of people downloading Zephyr, we got a lot of people using Zephyr. We’re seeing people upstreaming things all the time, but we don’t know where the products are, it’s all word of mouth to a large extent. There’re no tracers or anything else, you don’t want to do that in an embedded space on IoT; battery life is important. And so, it’s pretty key for figuring out how do we let people who want to be notified know. + +We’d registered as a CNA with Mitre several years ago now and we can assign CVE numbers in the project. But what we didn’t have was a good way of reaching out to people beyond our membership under embargo so that we can give them time to remediate any issues that we’re fixing. By changing our policies, it’s gone from a 60-day embargo window to a 90-day embargo window. In the first 30 days, we’re working internally to get the team to fix the issues and then we’ve got a 60-day window for our people who do products to basically remediate in the field if necessary. So, getting ourselves useful for product makers was one of the big focuses this year. + +**Swapnil Bhartiya: Since Zephyr’s LTS release was made last year, can you talk about the new releases, especially from the security perspective because I think the latest version is 2.3.0?** +Kate Stewart: Yeah, 2.3.0 and then we also have 1.14.2. and 1.14 is our LTS-1 as we say. And we’ve put an update out to it with the security fixes and a long-term stable like the Linux kernel has security fixes and bug fixes backported into it so that people can build products on it and keep it active over time without as much change in the interfaces and everything else that we’re doing in the mainline development tree and what we’ve just done with the 2.3. + +2.3 has a lot of new features in it and we’ve got all these vulnerabilities remediated. There’s a lot more coming up down the road, so the community right now is working. We’ve adopted new set of coding guidelines for the project and we will be working on that so we can get ourselves ready for going after safety certifications next year. So there’s a lot of code in motion right now, but there’s a lot of new features being added every day. It’s great. + +**Swapnil Bhartiya: I also want to talk a bit about the community side of it. Can you talk about how the community is growing new use cases?** +Kate Stewart: We’ve just added two new members into Zephyr. We’ve got Teenage Engineering has just joined us and Laird Connectivity has just joined us and it’s really cool to start seeing these products coming out. There are some rather interesting technologies and products that are showing up and so I’m really looking forward to being able to have blog posts about them. + +Laird Connectivity is basically a small device running Zephyr that you can use for monitoring distance without recording other information. So, in days of COVID, we need to start figuring out technology assists to help us keep the risk down. Laird Connectivity has devices for that. + +So we’re seeing a lot of innovation happening very quickly in Zephyr and that’s really Zephyr’s strength is it’s got a very solid code base and lets people add their innovation on top. + +**Swapnil Bhartiya: What role do you think Zephyr going to play in the post-COVID-19 world?** +Kate Stewart: Well, I think they offer us interesting opportunities. Some of the technologies that are being looked at for monitoring for instance – we have distance monitoring, contact tracing and things like that. We can either do it very manually or we can start to take advantage of the technology infrastructures to do so. But people may not want to have a device effectively monitoring them all the time. They may just want to know exactly, position-wise, where they are. So that’s potentially some degree of control over what’s being sent into the tracing and tracking. + +These sorts of technologies I think will be helping us improve things over time. I think there’s a lot of knowledge that we’re getting out of these and ways we can optimize the information and the RTOS and the sensors are discrete functionality and are improving how do we look at things. + +**Swapnil Bhartiya: There are so many people who are using Zephyr but since it is open source we not even aware of them. How do you ensure that whether someone is an official member of the project or not if they are running Zephyr their devices are secure?** +Kate Stewart: We do a lot of testing with Zephyr, there’s a tremendous amount of test infrastructure. There’s the whole regression infrastructure. We work to various thresholds of quality levels and we’ve got a lot of expertise and have publicly documented all of our best practices. A security team is a top-notch group of people. I’m really so proud to be able to work with them. They do a really good job of caring about the issues as well as finding them, debugging them and making sure anything that comes up gets solved. So in that sense, there’s a lot of really great people working on Zephyr and it makes it a really fun community to work with, no question. In fact, it’s growing fast actually. + +**Swapnil Bhartiya: Kate, thank you so much for taking your time out and talking to me today about these projects.** +-------------------------------------------------------------------------------- + +via: https://www.linux.com/audience/developers/making-zephyr-more-secure/ + +作者:[Swapnil Bhartiya][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://www.linux.com/author/swapnil/ +[b]: https://github.com/lujun9972 diff --git a/sources/talk/20200831 Open Source Project For Earthquake Warning Systems.md b/sources/talk/20200831 Open Source Project For Earthquake Warning Systems.md new file mode 100644 index 0000000000..7cefc1bf90 --- /dev/null +++ b/sources/talk/20200831 Open Source Project For Earthquake Warning Systems.md @@ -0,0 +1,94 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Open Source Project For Earthquake Warning Systems) +[#]: via: (https://www.linux.com/featured/open-source-project-for-earthquake-warning-systems/) +[#]: author: (Swapnil Bhartiya https://www.linux.com/author/swapnil/) + +Open Source Project For Earthquake Warning Systems +====== + +Earthquakes or the shaking doesn’t kill people, buildings do. If we can get people out of buildings in time, we can save lives. Grillo has founded OpenEEW in partnership with IBM and the Linux Foundation to allow anyone to build their own earthquake early-warning system. Swapnil Bhartiya, the founder of TFiR, talked to the founder of Grillo on behalf of The Linux Foundation to learn more about the project. + +Here is the transcript of the interview: + +**Swapnil Bhartiya: If you look at these natural phenomena like earthquakes, there’s no way to fight with nature. We have to learn to coexist with them. Early warnings are the best thing to do. And we have all these technologies – IoTs and AI/ML. All those things are there, but we still don’t know much about these phenomena. So, what I do want to understand is if you look at an earthquake, we’ll see that in some countries the damage is much more than some other places. What is the reason for that?** + +Andres Meira: earthquakes disproportionately affect countries that don’t have great construction. And so, if you look at places like Mexico, the Caribbean, much of Latin America, Nepal, even some parts of India in the North and the Himalayas, you find that earthquakes can cause more damage than say in California or in Tokyo. The reason is it is buildings that ultimately kill people, not the shaking itself. So, if you can find a way to get people out of buildings before the shaking that’s really the solution here. There are many things that we don’t know about earthquakes. It’s obviously a whole field of study, but we can’t tell you for example, that an earthquake can happen in 10 years or five years. We can give you some probabilities, but not enough for you to act on. + +What we can say is that an earthquake is happening right now. These technologies are all about reducing the latency so that when we know an earthquake is happening in milliseconds we can be telling people who will be affected by that event. + +**Swapnil Bhartiya: What kind of work is going on to better understand earthquakes themselves?** + +Andres Meira: I have a very narrow focus. I’m not a seismologist and I have a very narrow focus related to detecting earthquakes and alerting people. I think in the world of seismology, there are a lot of efforts to understand the tectonic movement, but I would say there are a few interesting things happening that I know of. For example, undersea cables. People in Chile and other places are looking at undersea telecommunications cables and the effects that any sort of seismic movement have on the signals. They can actually use that as a detection system. But when you talk about some of the really deep earthquakes, 60-100 miles beneath the surface, man has not yet created holes deep enough for us to place sensors. So we’re very limited as to actually detecting earthquakes at a great depth. We have to wait for them to affect us near the surface. + +**Swapnil Bhartiya: So then how do these earthquake early warning systems work? I want to understand from a couple of points: What does the device itself look like? What do those sensors look like? What does the software look like? And how do you kind of share data and interact with each other?** + +Andres Meira: The sensors that we use, we’ve developed several iterations over the last couple of years and effectively, they are a small microcontroller, an accelerometer, this is the core component and some other components. What the device does is it records accelerations. So, it looks on the X, Y, and Z axes and just records accelerations from the ground so we are very fussy about how we install our sensors. Anybody can install it in their home through this OpenEEW initiative that we’re doing. + +The sensors themselves record shaking accelerations and we send all of those accelerations in quite large messages using MQTT. We send them every second from every sensor and all of this data is collected in the cloud, and in real-time we run algorithms. We want to know that the shaking, which the accelerometer is getting is not a passing truck. It’s actually an earthquake. + +So we’ve developed the algorithms that can tell those things apart. And of course, we wait for one or two sensors to confirm the same event so that we don’t get any false positives because you can still get some errors. Once we have that confirmation in the cloud we can send a message to all of the client devices. If you have an app, you will be receiving a message saying, there’s an earthquake at this location, and your device will then be calculating how long it will take to reach it. Therefore, how much energy will be lost and therefore, what shaking you’re going to be expecting very soon. + +**Swapnil Bhartiya: Where are these devices installed?** + +Andres Meira: They are installed at the moment in several countries – Mexico, Chile, Costa Rica, and Puerto Rico. We are very fussy about how people install them, and in fact, on the OpenEEW website, we have a guide for this. We really require that they’re installed on the ground floor because the higher up you go, the different the frequencies of the building movement, which affects the recordings. We need it to be fixed to a solid structural element. So this could be a column or a reinforced wall, something which is rigid and it needs to be away from the noise. So it wouldn’t be great if it’s near a door that was constantly opening and closing. Although we can handle that to some extent. As long as you are within the parameters, and ideally we look for good internet connections, although we have cellular versions as well, then that’s all we need. + +The real name of the game here is a quantity more than quality. If you can have a lot of sensors, it doesn’t matter if one is out. It doesn’t matter if the quality is down because we’re waiting for confirmation from other ones and redundancy is how you achieve a stable network. + +**Swapnil Bhartiya: What is the latency between the time when sensors detect an earthquake and the warning is sent out? Does it also mean that the further you are from the epicenter, the more time you will get to leave a building?** + +Andres Meira: So the time that a user gaps in terms of what we call the window of opportunity for them to actually act on the information is a variable and it depends on where the earthquake is relative to the user. So, I’ll give you an example. Right now, I’m in Mexico City. If we are detecting an earthquake in Acapulco, then you might get 60 seconds of advanced warning because an earthquake travels at more or less a fixed velocity, which is unknown and so the distance and the velocity gives you the time that you’re going to be getting. + +If that earthquake was in the South of Mexico in Oaxaca, we might get two minutes. Now, this is a variable. So of course, if you are in Istanbul, you might be very near the fault line or Kathmandu. You might be near the fault line. If the distance is less than what I just described, the time goes down. But even if you only have five seconds or 10 seconds, which might happen in the Bay area, for example, that’s still okay. You can still ask children in a school to get underneath the furniture. You can still ask surgeons in a hospital to stop doing the surgery. There’s many things you can do and there are also automated things. You can shut off elevators or turn off gas pipes. So anytime is good, but the actual time itself is a variable. +** +Swapnil Bhartiya: The most interesting thing that you are doing is that you are also open sourcing some of these technologies. Talk about what components you have open source and why.** + +Andres Meira: Open sourcing was a tough decision for us. It wasn’t something we felt comfortable with initially because we spent several years developing these tools, and we’re obviously very proud. I think that there came a point where we realized why are we doing this? Are we doing this to develop cool technologies to make some money or to save lives? All of us live in Mexico, all of us have seen the devastation of these things. We realized that open source was the only way to really accelerate what we’re doing. + +If we want to reach people in these countries that I’ve mentioned; if we really want people to work on our technology as well and make it better, which means better alert times, less false positives. If we want to really take this to the next level, then we can’t do it on our own. It will take a long time and we may never get there. + +So that was the idea for the open source. And then we thought about what we could do with open source. We identified three of our core technologies and by that I mean the sensors, the detection system, which lives in the cloud, but could also live on a Raspberry Pi, and then the way we alert people. The last part is really quite open. It depends on the context. It could be a radio station. It could be a mobile app, which we’ve got on the website, on the GitHub. It could be many things. Loudspeakers. So those three core components, we now have published in our repo, which is OpenEEW on GitHub. And from there, people can pick and choose. + +It might be that some people are data scientists so they might go just for the data because we also publish over a terabyte of accelerometer data from our networks. So people might be developing new detection systems using machine learning, and we’ve got instructions for that and we would very much welcome it. Then we have something for the people who do front end development. So they might be helping us with the applications and then we also have people something for the makers and the hardware guys. So they might be interested in working on the census and the firmware. There’s really a whole suite of technologies that we published. + +**Swapnil Bhartiya: There are other earthquake warning systems. How is OpenEEW different?** + +Andres Meira: I would divide the other systems into two categories. I would look at the national systems. I would look at say the Japanese or the California and the West coast system called Shake Alert. Those are systems with significant public funding and have taken decades to develop. I would put those into one category and another category I would look at some applications that people have developed. My Shake or Skylert, or there’s many of them. + +If you look at the first category, I would say that the main difference is that we understand the limitations of those systems because an earthquake in Northern Mexico is going to affect California and vice versa. An earthquake in Guatemala is going to affect Mexico and vice versa. An earthquake in Dominican Republic is going to affect Puerto Rico. The point is that earthquakes don’t respect geography or political boundaries. And so we think national systems are limited, and so far they are limited by their borders. So, that was the first thing. + +In terms of the technology, actually in many ways, the MEMS accelerometers that we use now are streets ahead of where we were a couple of years ago. And it really allows us to detect earthquakes hundreds of kilometers away. And actually, we can perform as well as these national systems. We’ve studied our system versus the Mexican national system called SASMEX, and more often than not, we are faster and more accurate. It’s on our website. So there’s no reason to say that our technology is worse. In fact, having cheaper sensors means you can have huge networks and these arrays are what make all the difference. + +In terms of the private ones, the problems with those are that sometimes they don’t have the investment to really do wide coverage. So the open sources are our strength there because we can rely on many people to add to the project. + +**Swapnil Bhartiya: What kind of roadmap do you have for the project? How do you see the evolution of the project itself?** + +Andres Meira: So this has been a new area for me; I’ve had to learn. The governance of OpenEEW as of today, like you mentioned, is now under the umbrella of the Linux Foundation. So this is now a Linux Foundation project and they have certain prerequisites. So we had to form a technical committee. This committee makes the steering decisions and creates the roadmap you mentioned. So, the roadmap is now published on the GitHub, and it’s a work in progress, but effectively we’re looking 12 months ahead and we’ve identified some areas that really need priority. Machine learning, as you mentioned, is definitely something that will be a huge change in this world because if we can detect earthquakes, potentially with just a single station with a much higher degree of certainty, then we can create networks that are less dense. So you can have something in Northern India and in Nepal, in Ecuador, with just a handful of sensors. So that’s a real Holy grail for us. + +We also are asking on the roadmap for people to work with us in lots of other areas. In terms of the sensors themselves, we want to do more detection on the edge. We feel that edge computing with the sensors is obviously a much better solution than what we do now, which has a lot of cloud detection. But if we can move a lot of that work to the actual devices, then I think we’re going to have much smarter networks and less telemetry, which opens up new connectivity options. So, the sensors as well are another area of priority on the road map. + +**Swapnil Bhartiya: What kind of people would you like to get involved with and how can they get involved?** + +Andres Meira: So as of today, we’re formally announcing the initiative and I would really invite people to go to OpenEEW.com, where we’ve got a site that outlines some areas that people can get involved with. We’ve tried to consider what type of people would join the project. So you’re going to get seismologists. We have seismologists from Harvard University and from other areas. They’re most interested in the data from what we’ve seen so far. They’re going to be looking at the data sets that we’ve offered and some of them are already looking at machine learning. So there’s many things that they might be looking at. Of course, anyone involved with Python and machine learning, data scientists in general, might also do similar things. Ultimately, you can be agnostic about seismology. It shouldn’t put you off because we’ve tried to abstract it away. We’ve got down to the point where this is really just data. + +Then we’ve also identified the engineers and the makers, and we’ve tried to guide them towards the repos, like the sensory posts. We are asking them to help us with the firmware and the hardware. And then we’ve got for your more typical full stack or front end developer, we’ve got some other repos that deal with the actual applications. How does the user get the data? How does the user get the alerts? There’s a lot of work we can be doing there as well. + +So, different people might have different interests. Someone might just want to take it all. Maybe someone might want to start a network in the community, but isn’t technical and that’s fine. We have a Slack channel where people can join and people can say, “Hey, I’m in this part of the world and I’m looking for people to help me with the sensors. I can do this part.” Maybe an entrepreneur might want to join and look for the technical people. + +So, we’re just open to anybody who is keen on the mission, and they’re welcome to join. +-------------------------------------------------------------------------------- + +via: https://www.linux.com/featured/open-source-project-for-earthquake-warning-systems/ + +作者:[Swapnil Bhartiya][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://www.linux.com/author/swapnil/ +[b]: https://github.com/lujun9972 diff --git a/sources/talk/20200901 4 reasons Jamstack is changing web development.md b/sources/talk/20200901 4 reasons Jamstack is changing web development.md new file mode 100644 index 0000000000..54741b402f --- /dev/null +++ b/sources/talk/20200901 4 reasons Jamstack is changing web development.md @@ -0,0 +1,115 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (4 reasons Jamstack is changing web development) +[#]: via: (https://opensource.com/article/20/9/jamstack) +[#]: author: (Phil Hawksworth https://opensource.com/users/phil-hawksworth) + +4 reasons Jamstack is changing web development +====== +Jamstack allows web developers to move far beyond static sites without +the need for complex, expensive active-hosting infrastructure. +![spiderweb diagram][1] + +The way we use and the way we build the web have evolved dramatically since its inception. Developers have seen the rise and fall of many architectural and development paradigms intended to satisfy more complex user experiences, support evolving device capabilities, and enable more effective development workflows. + +In 2015, [Netlify][2] founders Matt Biilmann and Chris Bach coined the term "[Jamstack][3]" to describe the architectural model they were championing and that was gaining popularity. In reality, the foundations of this model have existed from the beginning of the web. But multiple factors led them to coin this new term to encapsulate the approach and to give developers and technical architects a better means to discuss it. + +In this article, I'll look at those factors, Jamstack's attributes, why the term came into existence, and how it is changing how we approach web development. + +### What is Jamstack? + +All Jamstack sites share a core principle: They are a collection of static assets generated during a build or compilation process so that they can be served from a simplified web server or directly from a content delivery network (CDN). + +Before the term "Jamstack" emerged, many people described these sites as "static." This describes how the first sites on the web were created (although CDNs would come later). But the term "static sites" does a poor job of capturing what is possible with the Jamstack due to the way tools, services, and browsers have evolved. + +The simplest Jamstack site is a single HTML file served as a static file. For a long time, open source web servers efficiently hosted static assets this way. This has become a commodity, with companies including Amazon, Microsoft, and Google offering hosting services based on file serving rather than spending compute cycles generating a response for each request on-demand. + +But that's just a static site? Right? + +Well, yes. But it's the thin end of the wedge. Jamstack builds upon this to deliver sites that confound the term "static" as a useful descriptor. + +If you take things a stage further and introduce JavaScript into the equation, you can begin enhancing the user's experience. Modern browsers have increasingly capable JavaScript engines (like the open source [V8][4] from Google) and powerful browser [APIs][5] to enable services such as local-caching, location services, identity services, media access, and much more. + +In many ways, the browser's JavaScript engine has replaced the runtime environment needed to perform dynamic operations in web experiences. Whereas a traditional technology stack such as [LAMP][6] requires configuration and maintenance of an operating system (Linux) and an active web server (Apache), these are not considerations with Jamstack. Files are served statically to clients (browsers), and if any computation is required, it can happen there rather than on the hosting infrastructure. + +As Matt Biilmann describes it, "the runtime has moved up a level, to the browser." + +Web experiences don't always require content to be dynamic or personalized, but they often do. Jamstack sites can provide this, thanks to the efficient use of JavaScript as well as a booming API economy. Many companies now provide content, tools, and services via APIs. These APIs enable even small project teams to inject previously unattainable, prohibitively expensive, and complex abilities into their Jamstack projects. For example, rather than needing to build identity, payment, and fulfillment services or to host, maintain, secure, and scale database capabilities, teams can source these functionalities from experts in those areas through APIs. + +Businesses have emerged to provide these and many other services with all of the economies of scale and domain specializations needed to make them robust, efficient, and sustainable. The ability to consume these services via APIs decouples them from web applications' code, which is a very desirable thing. + +Because these services took us beyond the old concept of static sites, a more descriptive term was needed. + +### What's in a name? + +The _JavaScript_ available in modern browsers, calling on _APIs_, and enriching the underlying site content delivered with _markup_ (HTML) are the J, A, and M in the Jamstack name. They identify properties that allow sites to move far beyond static sites without the need for complex and expensive active-hosting infrastructure. + +But whether you decide to use all or just some of these attributes, the Jamstack's key principle is that the assets are created in advance to vastly improve hosting and development workflows. It's a shift from the higher-risk, just-in-time request-servicing method to a simplified, more predictable, prepared-in-advance approach. + +As [Aaron Swartz][7] succinctly put it way back in 2002, "Bake, don't fry" your pages. + +### 4 benefits of using Jamstack + +Embracing this model of decoupling the generation (or rendering) of assets from the work of serving assets creates significant opportunities. + +#### Lowering the cost of scaling + +In a traditional stack, where views are generated for each incoming request, there is a correlation between the volume of traffic and the computation work done on the servers. This might reach all levels of the hosting stack, from load balancers and web servers to application servers and database servers. When these additional layers of infrastructure are provisioned to help manage the load, it adds cost and complexity to the environment and the work of operating the infrastructure and the site itself. + +Jamstack sites flatten that stack. The work of generating the views happens only when the code or content changes, rather than for every request. Therefore, the site can be prepared in advance and hosted directly from a CDN without needing to perform expensive computations on the fly. Large pieces of infrastructure (and the work associated with them) disappear. + +In short: Jamstack sites are optimized for scale by default. + +#### Improving speed + +Traditionally, to improve the hosting infrastructure's response time, those with the budget and the skills would add a CDN. Identifying assets that might be considered "static" and offloading serving those resources to a CDN could reduce the load on the web-serving infrastructure. Therefore, some requests could be served more rapidly from a CDN that is optimized for that task. + +With a Jamstack site, the site is served entirely from the CDN. This avoids the complex logic of determining what must be served dynamically and what can be served from a CDN. + +Every deployment becomes an operation to update the entire site on the CDN rather than across many pieces of infrastructure. This allows you to automate the process, which can increase your confidence in and decrease the cost and friction of deploying site updates. + +#### Reducing security risks + +Removing hosting infrastructure, especially servers that do computation based on the requests they receive, has a profound impact on a site's security profile. A Jamstack site has far fewer attack vectors than a traditional site since many servers are no longer needed. There is no server more secure than the one that does not exist. + +The CDN infrastructure remains but is optimized to serve pre-generated assets. Because these are read-only operations, they have fewer opportunities for attack. + +#### Supercharging the workflow + +By removing so many moving parts from site hosting, you can vastly improve the workflows involved in developing and deploying them. + +Jamstack sites support [version control from end to end][8] and commonly use Git and Git conventions to do everything from defining and provisioning new environments to executing a deployment. Deployments no longer need to change the state, resources, or configuration of multiple pieces of hosting infrastructure. And they can be tested locally, on staging environments, and in production environments with ease. + +The approach also allows more comprehensive project encapsulation. A site's code repository can include everything needed to bootstrap a project, including defining the dependencies and operations involved in building the site. This simplifies onboarding developers and walking the path to production. (Here's [an example][9].) + +### Jamstack for all + +Web developers familiar with a wide variety of tools and frameworks are embracing the Jamstack. They are achieving new levels of productivity, ignited by the recognition that they can use many tools and languages that put more power and ability in their hands. + +Open source libraries and frameworks with high levels of adoption and love from the development community are being used in combination and with third- and first-party APIs to produce incredibly capable solutions. And the low barriers of entry mean they are easier to explore, leading to higher levels of developer empowerment, effectiveness, and enthusiasm. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/9/jamstack + +作者:[Phil Hawksworth][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/phil-hawksworth +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/web-cms-build-howto-tutorial.png?itok=bRbCJt1U (spiderweb diagram) +[2]: https://www.netlify.com/jamstack?utm_source=opensource.com&utm_medium=jamstack-benefits-pnh&utm_campaign=devex +[3]: https://jamstack.org/?utm_source=opensource.com&utm_medium=jamstack-benefits-pnh&utm_campaign=devex +[4]: https://v8.dev/ +[5]: https://www.redhat.com/en/topics/api/what-are-application-programming-interfaces +[6]: https://en.wikipedia.org/wiki/LAMP_(software_bundle) +[7]: http://www.aaronsw.com/weblog/000404 +[8]: https://www.netlify.com/products/build/?utm_source=opensource.com&utm_medium=jamstack-benefits-pnh&utm_campaign=devex +[9]: https://github.com/philhawksworth/hello-trello diff --git a/sources/talk/20200902 My dramatic journey to becoming an open source engineer.md b/sources/talk/20200902 My dramatic journey to becoming an open source engineer.md new file mode 100644 index 0000000000..34ab585578 --- /dev/null +++ b/sources/talk/20200902 My dramatic journey to becoming an open source engineer.md @@ -0,0 +1,137 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (My dramatic journey to becoming an open source engineer) +[#]: via: (https://opensource.com/article/20/9/open-source-story) +[#]: author: (Anisha Swain https://opensource.com/users/anishaswain) + +My dramatic journey to becoming an open source engineer +====== +This is the story of how I grew from hating to loving open source +technology. +![Love and hate][1] + +It's been five years and a heck of a journey from being a non-programmer to becoming an associate software engineer at Red Hat. It's a story worth telling—not because I have achieved a lot, but because of so much drama and so many pitfalls. So grab a cup of coffee, and I will share the unturned pages of my love story with technology. + +People say love is as powerful as hate. And love stories that start with hate are often the most passionate ones. My love story with technology was just like that. I got into the world of programming in my freshman year of college. It was my most painful subject. Even though I have always been passionate about futuristic technologies, I didn't know how to move forward towards my passion. + +Coming from an interest in instrumentation and electronics engineering, my distaste for programming increased even more with my first failed attempt at passing an interview for my college's technical society, as 80% of the questions were about programming. In my second attempt, I went in prepared, all set for my war with programming. And, luckily, I cleared it. + +### Getting started + +As the phrase goes, sometimes it takes a wrong turn to get you to the right place. At first, it did feel like a wrong turn. Then bit by bit, I learned something precious, not through learning, but by _listening_. I started my journey by Googling the technical terms I'd heard people utter, which is how I started growing. I came to learn about web design, and the first website I designed was the front page for my college hostel. I had never been so excited about a project before. That simple HTML/CSS website was nothing less than magic to me. + +Have you heard of love at first sight? It was like that. At that moment, I fell in love with the work I was doing. I continued learning different web design frameworks (like [Bootstrap][2] and [Material Design][3]), libraries like [jQuery][4], and web development techniques like [Ajax][5]. + +### Gaining experience + +In 2016, I received my first internship, working as a frontend developer. Even though it lasted only a short time, it made me realize that I can contribute code, and it filled me with even more confidence. + +![Anisha Swain sitting by water][6] + +(Anisha Swain, [CC BY-SA 4.0][7]) + +Gradually, I started learning server-side code, like [Node.js][8], the [Express][9] framework, [MongoDB][10], [MySQL][11], and more. My seniors helped make my road to understanding the client-server interaction fairly easy. + +We heard about a hackathon organized by Tata Consultancy Services. We applied for it with an idea to add [gamification to cleaning][12] public places. (This is probably still the most engrossing project I have worked on to date.) And we were selected! After about a month of preparation, I was going to Mumbai, which was my first trip outside my state, Odisha. Today, when people ask me about young girls being banned from such opportunities, I answer, "tell me about it." I was the only girl on this trip and, yes, it was a little scary. But when I look back, I realize if I hadn't taken that calculated risk at that time, I probably wouldn't have received opportunities to travel in the future. + +In time, I started learning Python, and the area that interested me the most was image processing. I started doing small projects on the [OpenCV][13] computer vision and machine learning library and later collaborated on making a prototype of a self-driving car—just a small one with basic features. + +### My open source debut + +Another turning point came when I learned about open source programs while participating in the Rails Girls Summer of Code (RGSoC) in 2017 with [Manaswini Das][14]. RGSoC is a global fellowship program for women and non-binary coders. Students receive three-month scholarships to work on existing open source projects and expand their skill sets. + +I participated in a project named [HospitalRun][15]. It was an exciting—and honestly scary—experience for me. It was exciting because, for the first time, it felt like I was part of something meaningful, broader, and significant. A simple change I made would be visible to people all over the world. My name would be on the contributor list for a large community. It might sound like nothing, but at that time, it was like a wave of motivation. It was scary because the application was in [Ember.js][16], and learning Ember.js so quickly is an experience that can't be described. I will be ever grateful to my mentors, [Joel Worrall][17] and [Joel Glovier][18], for all the support they provided our group. Even though we didn't get selected for the program, this experience will always be a shining part of my story. + +The best thing about working with technology is, it never felt like work. Neither then nor now. It was always like I was self-reflecting on a computer screen. + +### Disappointment, then winning + +The Summer Research Fellowships Program (SRFP), offered by the Indian Academy of Sciences (IAS), is a summer immersion experience that supplements research activities during the academic year. I wanted to work under this renowned research fellowship, and in 2017, I anxiously looked for my name among the awardees. Alas! My name wasn't there. And I was upset. Despite having the slimmest of chances to receive a fellowship, I had reviewed the profiles of all the professors who were working in the field of signal and image processing, shortlisted around 30 of them, and gone through their research papers. As I had some experience with OpenCV and image processing, I was somehow expecting to be selected. + +However, I moved on and applied for RGSoC. I devoted two months to the application, but, again, my team wasn't selected. The semester was edging to an end, and I had no internships in hand. I was disheartened and clueless about what would happen next. I started applying for local internships, and I was completely upset. + +But I was not aware that the IAS fellowship's second selection list had not yet been announced. On May 2, I got a message from one of my seniors with a link to the IAS second selection result list. And voila! I found my name. Anisha Swain. I couldn't believe my eyes. The credentials matched mine! I was selected to work on image processing. + +The confirmation email said I was going to work in Delhi. But there was a problem with where I could live. The accommodation list was only for the people who were selected for the fellowship on the first list. I had a dilemma. My parents strictly banned me from going without proper accommodation. But when there is a will, there is a way, and I found I could stay on the Delhi University campus. In two months at Delhi, while doing research, having fun, and traveling, I experienced everything I could. I traveled to all the metro cities, and Delhi is the most beautiful city I have ever been to. + +### When one door closes, another opens + +In 2018, Google Summer of Code (GSoC) was just around the corner. GSoC is an annual international program where students are awarded stipends for completing a free and open source software coding project during the summer. Nothing was more prestigious to me at the time than getting into this program. Now I wonder why. I still see students going crazy over it, as if nothing else is left in life if they don't crack it. I was also upset at not being selected. Not once but twice. But as they say, "The journey is as important as the destination." + +What matters more than getting selected is the learning you do during the process, as it will always stay with you. While applying to GSoC, I learned concept visualization with [D3.js][19] and [Three.js][20]. + +Even though I couldn't crack GSoC, my learning helped me land another internship, in 2019, at Mytrah Energy in Hyderabad. It was my first industrial experience, and I learned to do data visualization on a large scale. I dealt with data in JSON and CSV formats and created interactive charts with SVG and Canvas. The experience also helped me deal with my fear of getting into corporate life. It was a brief look into the life I was aspiring for. + +### Walking into open source + +Some of my friends selected for GSoC shared with me LinkedIn contact information for members of Red Hat's talent acquisition team. In 2018, I messaged them and sent my resume and personal description, but didn't receive a reply for more than a year. + +But then I met them at the 2019 Grace Hopper Celebration India (GHCI) conference, Asia's largest gathering of women technologists. During the career fair, they asked for my resume, and, to my utter surprise, they remembered me from my LinkedIn messages a year before. Soon, I got an interview call. During my first interview, I lost my connection and the interview couldn't be completed, but they were kind enough to understand the situation and reschedule it. The next interview round took around three hours, and just a few hours later, I got a job offer by email. It is the best thing that has ever happened to me! + +![An office desk][21] + +(Anisha Swain, [CC BY-SA 4.0][7]) + +Today, I am an associate software engineer for Red Hat's Performance and Scale Engineering team. I work with [React][22] and design frameworks with [Ant Design][23] and [PatternFly][24]. I also deal with web technologies like [Elasticsearch][25], [GraphQL][26], and [Postgres][27]. I try to share my knowledge with others through conferences, meetups, and articles. None of this could have been possible without my "second family" from the [Zairza Cetb][28] club. This makes me realize the power of a community and the important role our surroundings play in our development. + +### Rules for success + +![Anisha Swain in snow][29] + +(Anisha Swain, [CC BY-SA 4.0][7]) + +Through my journey, I have learned many things about getting where you want to be in life, including: + + 1. Hard work is as important as smart work. + 2. Things will eventually be connected and fall into place if you have the desire to grow. + 3. Work for 100% if you want to achieve 80%. + 4. Stay hungry, stay foolish, and stay humble. + 5. Always give back knowledge to the community. + + + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/9/open-source-story + +作者:[Anisha Swain][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/anishaswain +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/business_lovehate_0310.png?itok=2IBhQqIn (Love and hate) +[2]: https://getbootstrap.com/ +[3]: https://material.io/design +[4]: https://jquery.com/ +[5]: https://en.wikipedia.org/wiki/Ajax_%28programming%29 +[6]: https://opensource.com/sites/default/files/uploads/anishaswain_seaside.jpg (Anisha Swain sitting by water) +[7]: https://creativecommons.org/licenses/by-sa/4.0/ +[8]: https://nodejs.org +[9]: https://expressjs.com/ +[10]: https://www.mongodb.com/ +[11]: https://www.mysql.com/ +[12]: https://github.com/Anisha1234/Clean_Clan +[13]: https://opencv.org/ +[14]: https://www.linkedin.com/in/manaswini-das/ +[15]: https://hospitalrun.io/ +[16]: https://emberjs.com/ +[17]: https://www.linkedin.com/in/jworrall/ +[18]: https://www.linkedin.com/in/jglovier/ +[19]: https://d3js.org/ +[20]: https://threejs.org/ +[21]: https://opensource.com/sites/default/files/uploads/anishaswain_desk.jpg (An office desk) +[22]: https://reactjs.org/ +[23]: https://ant.design/ +[24]: https://www.patternfly.org/ +[25]: https://www.elastic.co/elasticsearch/ +[26]: https://graphql.org/ +[27]: https://www.postgresql.org/ +[28]: https://medium.com/u/a9c306e657d0?source=post_page-----aa2c4cb5d924---------------------- +[29]: https://opensource.com/sites/default/files/uploads/anishaswain_snow.jpg (Anisha Swain in snow) diff --git a/sources/talk/20200903 Why your open source project needs more than just coders.md b/sources/talk/20200903 Why your open source project needs more than just coders.md new file mode 100644 index 0000000000..7ca53d1f63 --- /dev/null +++ b/sources/talk/20200903 Why your open source project needs more than just coders.md @@ -0,0 +1,68 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Why your open source project needs more than just coders) +[#]: via: (https://opensource.com/article/20/9/open-source-role-diversity) +[#]: author: (Silona https://opensource.com/users/silona) + +Why your open source project needs more than just coders +====== +Developers alone don't create open source projects that meet a variety +of needs for a long shelf life; it's time to welcome more roles and +talent. +![Teamwork starts with communication across silos][1] + +Why do open source projects fail? + +Lack of funding is a major factor, of course, but it's far from the only reason that open source projects fail to achieve sustainability. Sometimes there's a lack of understanding of how to create a product for a broad market, or some fundamental misstep with intellectual property rights (IPR)—such as failing to properly license your code. + +It's hard for any open source project to sustain if it doesn't get these types of basics right. Collaboration across boundaries and the ability to iterate and expand are hindered, and innovation is stifled. I see these fatal flaws especially in a lot of humanitarian projects—_passion projects_—and it is heartbreaking. + +### Building role diversity + +Open source has tended to thrive in instances where it has been developers writing code for developers. That’s why so many underlying technologies developed via open source (Apache and Linux, for example) have succeeded. + +However, when it comes to creating quality user experiences and products for people other than developers, open source's record is spottier. Why is that? + +One of the big reasons is because the majority of open source communities don’t encourage or even welcome people of diverse expertise. Sometimes, there’s no acknowledgement of them. The coders get all of the love, and roles and contributions beyond coding are not even thought of. + +Sustainable open source demands that communities embrace and reward a lot of different talents. There are the developers, most definitely, and they must be core for any open source project to be successful. But without contributions from marketing expertise, for example, you might not thoroughly understand what the users want. Without the input of product management, you run the risk of failing to develop a product for users other than other developers. Businesses normally invest in these and other roles because their varied contributions are critical to delivering successful results and creating products that are production ready with community support for long term sustainability. + +One of the conflicts that I often find amongst open source development communities is an animosity towards product or project management. It’s true that product management especially in corporate places has control issues—they may try to do things like dominate a market, or come in from a perspective of scarcity rather than abundance. It shows in behavior, and it’s antithetical to the spirit of open source. + +But, to be fair, I think it is also true that we developers have never been taught how to work well with product management. We are told, "More people would use your product if you just did X," and we respond, "No, you can't tell me anything about my baby." We don't want to hear, "Yeah, but if you change the diaper, more people would like your baby," even if it's true. + +Open source hasn't always embraced talent other than developers, and this is what must change in order to foster long term stability. + +### Birthing IEEE SA Open + +Putting in place the tools and processes needed to encourage project sustainability is our current focus in architecting and designing [IEEE SA Open][2]. To that end, bringing in role diversity and building a platform and a tool that invites and rewards those diverse contributions is crucial in creating IEEE SA Open. + +We are creating our community, marketing, and technology onboarding guides to ensure that incoming projects automatically get a level of support that they wouldn't normally get from a technology platform. We're looking at raising the maturity model into advanced processes and practices. For example, progressing to levels 4 (quantitatively managed) and 5 (optimizing) of [Capability Maturity Model Integration][3] (CMMI) requires measurement. Getting our processes right from the outset and assigning the right metrics to inform better, more consistent evaluations will support our sustainability. + +This is one of the places where our linkage with IEEE is so important. One of the things that the standards world does especially well is process, and IEEE in particular has a history of making sure that its processes are fair and predicated on advancing technology for the benefit of humanity. With more than 419,000 members in over 160 countries, IEEE is the world’s largest technical professional organization dedicated to advancing technology for humanity. Its roots go back to 1884 when electricity and telecommunications began to become a major influence in society, and today IEEE has over 1,200 active standards and more than 650 standards under development. + +IEEE SA Open can borrow on those best practices and lessons learned in sustainability that IEEE has acquired by experience. We aim to bridge the gap between global standards development and open source developer communities. It is definitely a balancing act, and we respect that! + +We’re reaching out to people all over the global open source and standards communities in a diverse set of roles to be engaged in creating IEEE SA Open. You can participate in that birthing project, and now is the time. If there are things that are super important to you and that you’ve seen neglected in open source, this is the time to engage, share your experiences and influence the creation of IEEE SA Open. You can help make sure we don’t make those mistakes. [We need your unique insights and input.][2] + +You don't need to be a master coder to contribute to open source. Jade Wang shares 8 ways you can... + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/9/open-source-role-diversity + +作者:[Silona][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/silona +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/happy-team-sticker-laptop.png?itok=91K77IgE (Teamwork starts with communication across silos) +[2]: https://standards.ieee.org/initiatives/opensource?utm_source=External&utm_medium=PR&utm_campaign=IEEE-SA-Open +[3]: https://en.wikipedia.org/wiki/Capability_Maturity_Model_Integration diff --git a/sources/talk/20200911 Ankur Sinha- How do you Fedora.md b/sources/talk/20200911 Ankur Sinha- How do you Fedora.md new file mode 100644 index 0000000000..9d965e9840 --- /dev/null +++ b/sources/talk/20200911 Ankur Sinha- How do you Fedora.md @@ -0,0 +1,151 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Ankur Sinha: How do you Fedora?) +[#]: via: (https://fedoramagazine.org/ankur-sinha-how-do-you-fedora/) +[#]: author: (climoiselle https://fedoramagazine.org/author/climoiselle/) + +Ankur Sinha: How do you Fedora? +====== + +![][1] + +We recently interviewed Ankur Sinha on how he uses Fedora. This is part of a [series][2] on the Fedora Magazine. The series profiles Fedora users and how they use Fedora to get things done. Contact us on the [feedback form][3] to express your interest in becoming an interviewee. + +### Who is Ankur Sinha? + +Ankur is a Computational Neuroscientist and has just started his first post-doctoral fellowship at University College London and a FLOSS enthusiast trying to spread the message of FOSS and evidence based science. Ankur started using Linux a decade ago, when he was introduced to Linux in a [LUG][4] doing an install fest during his undergraduate degree. + +Ankur loves reading: + +_“I read a lot and tend to get attached to characters from books quite easily. Holmes, Poirot (I’m a detective fiction fan), Francisco D’Anconia (fan of the book Atlas Shrugged, but not so much Ayn Rand’s philosophy), lots of random characters from books I’d read. I also read lots of Hindi comics as a child—Doga, Super commando Dhruv, Naagraj, and Chacha Chaudhary—loved them all!”._ + +As far as all time favorite movies go, [Swades][5] comes to his mind. His favorite genre is science fiction thrillers (think “The Prestige” and ” Predestination”). When not busy working or engaging people on IRC channels, he enjoys listening to podcasts and classic rock. + +Ankur’s favorite food is his mother’s Chhole Bhature. Otherwise, if he’s away from home, his go-tos are Butter chicken, Butter Naan, and Chilli Chicken from North Indian restaurants. + +### The Fedora Community + +Ankur found about Fedora after a distro hopping phase in 2008, and since then he has been a fedora user. His first memory of the Fedora community is an IRC workshop on packaging fonts that the Fedora India community had organised back in 2008. Talking to and meeting other community members has been one of the most exciting parts of the Fedora community for him. _“I found this great bunch of people to hang out and geek out with! It was so much fun, and extremely educational both in terms of technical knowledge and the social/philosophical side of FOSS and life in general.”_ + +When asked what he would change in the Fedora Project if he could change one thing, he said that he prefers “Smaller tweaks” since _“Smaller tweaks also allow work to be spread out, and that really helps”_. Specifically, he would like to see more discussion on the philosophy and nuances of FOSS in the community. + +_"Perhaps we all know it so well that we take it for granted and focus on the work that needs to be done. It’s so easy to get bogged down in the work, though, that I worry that we forget the bigger picture sometimes. The end for us is to promote FOSS, and everything we do is the means to this end. So, I worry that the means sometimes becomes the end for us — that we focus so much on producing deliverables that we forget why we produce them."_ + +Since he works in academia and science, Ankur would like the Fedora community (and FOSS in general) to get more involved with academic/scientific communities. _“I think we have an excellent platform to enable education and research. NeuroFedora is a start in this direction.”_ + +He wishes that other people knew that the Fedora community are not just OS developers, but a global community, and he’d like folks to just hang out and communicate even if they’re not contributing in the traditional sense of the word. + +Ankur tries to help wherever he can, especially if newbies are involved. Nowadays, he tries to focus more on [NeuroFedora][6] as it fits well for his day-job and there’s so much to do in this Field + Open Science. + +Ankur learnt most of the things from his >10 years of experience in Fedora and FOSS. He had learned theories of software development at undergrad but got to experience practical implementations from his colleagues in the community. He is a firm believer of _“No question is a stupid question”_. He adds that Fedora is perfect because it gets better as you start working with it. + +His piece of advice for anyone thinking of getting involved in Fedora is to just go ahead and start. One doesn’t need to know anything at all. All of it can be learned over time. Secondly, don’t focus on tasks. Yes, that’s a good way of learning, but it is far more important to get to know the people of Fedora! As one meets more people, one learns more about how Fedora works and one has way more fun working and learning!! + +Just like a lot of our community members, Ankur struggles from time constraints. His new challenge is to find more time to work on FOSS and Fedora. During his college years, it was to learn more and more. + +One of the challenges Ankur faces about promoting open source is to explain to non-FOSS people that Windows/Mac aren’t the only OSes present. He thinks that having Fedora shipped with Lenovo systems will give a start for the community. It makes Fedora and FOSS more "official". + +### What Hardware? + +Ankur has three machines and runs Fedora 32 on each of them: + +![Ankur’s Desk][7] + + * Thinkpad E490 laptop + * a custom workstation that university IT set up for research work + * a headless MacPro5,1 + * 2x Microsoft Sculpt Ergonomic keyboard/mouse/numpad + * Netgear wifi extender + * TP-Link TL-PA8033PKIT AV1300 3-Port Gigabit Passthrough Powerline Adapters + * Moto g7 phone with Android 10 + + + +### What Software? + +Fedora 32 workstation, and server on the MacPro. + +– [Workstation][8]/Gnome3 with a few extensions: [caffeine][9], [pomodoro][10], + +  [syncthing][11]. + +– [byobu][12] with [tmux][13]: multiple sessions: default, work, fedora + +– [taskwarrior][14], [vit][15], [timewarrior][16], [gnome-pomodoro][10], [gnome-calendar][17]/[evolution][18] for calendars + +– [neomutt][19] with [msmtp][20] \+ [offlineimap][21] \+ [notmuch][22] for e-mail + +– [vim][23] for *everything* possible – [vimrc link][24] + +– [qutebrowser][25], [weechat][26], [zathura][27], [vimiv][28] + +– syncthing + dropbox + git for syncing/version control + +For research work: + +– [NEST][29] \+ lots of python and [Gnuplot][30] for analysis, LaTeX for writing + +  (stuff from NeuroFedora!) + +– [inkscape][31] \+ [gimp][32] \+ [dia][33] \+ [freemind][34] for figures/mind mapping + +– [jabref][35] for bibliography management + +Other bits: – occasional gamer? + +– [Oad][36] \+ [endless sky][37] \+ [openttd][38]! + +-------------------------------------------------------------------------------- + +via: https://fedoramagazine.org/ankur-sinha-how-do-you-fedora/ + +作者:[climoiselle][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://fedoramagazine.org/author/climoiselle/ +[b]: https://github.com/lujun9972 +[1]: https://fedoramagazine.org/wp-content/uploads/2020/09/hdyf-asinha-816x346.png +[2]: https://fedoramagazine.org/tag/how-do-you-fedora/ +[3]: https://fedoramagazine.org/submit-an-idea-or-tip/ +[4]: https://en.wikipedia.org/wiki/Linux_user_group +[5]: https://www.imdb.com/title/tt0367110/ +[6]: https://docs.fedoraproject.org/en-US/neurofedora/overview/ +[7]: https://fedoramagazine.org/wp-content/uploads/2020/08/WhatsApp-Image-2020-08-28-at-3.27.16-PM-768x1024.jpeg +[8]: https://getfedora.org/en/workstation/ +[9]: https://extensions.gnome.org/extension/517/caffeine/ +[10]: https://github.com/codito/gnome-pomodoro/ +[11]: https://docs.syncthing.net/ +[12]: https://www.byobu.org/ +[13]: https://github.com/tmux/tmux +[14]: https://taskwarrior.org/ +[15]: https://github.com/scottkosty/vit +[16]: https://timewarrior.net/ +[17]: https://wiki.gnome.org/Apps/Calendar +[18]: https://wiki.gnome.org/Apps/Evolution +[19]: https://neomutt.org/ +[20]: https://marlam.de/msmtp/ +[21]: http://www.offlineimap.org/ +[22]: https://notmuchmail.org/ +[23]: https://www.vim.org/ +[24]: https://github.com/sanjayankur31/vimfiles +[25]: https://www.qutebrowser.org/ +[26]: https://weechat.org/ +[27]: https://pwmt.org/projects/zathura/ +[28]: https://karlch.github.io/vimiv-qt/index.html +[29]: https://www.nest-simulator.org/ +[30]: http://gnuplot.info/ +[31]: https://inkscape.org/ +[32]: https://www.gimp.org/ +[33]: http://dia-installer.de/ +[34]: http://freemind.sourceforge.net/wiki/index.php/Main_Page +[35]: http://www.jabref.org/ +[36]: https://play0ad.com/ +[37]: http://endless-sky.github.io/ +[38]: https://www.openttd.org/ diff --git a/sources/talk/20200911 How open source legal teams can get to yes.md b/sources/talk/20200911 How open source legal teams can get to yes.md new file mode 100644 index 0000000000..3470ea0806 --- /dev/null +++ b/sources/talk/20200911 How open source legal teams can get to yes.md @@ -0,0 +1,77 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How open source legal teams can get to yes) +[#]: via: (https://opensource.com/article/20/9/advice-open-source-lawyer) +[#]: author: (Jeffrey Robert Kaufman https://opensource.com/users/jkaufman) + +How open source legal teams can get to yes +====== +Open source law has unusual requirements for success. Learn ways lawyers +can help their organizations find a path to open. +![whiteboard collaboration with the team][1] + +As I shared in the [first part][2] of this two-part series, I am an open source lawyer for Red Hat. One important part of my job is to provide information to other companies, including their in-house counsel, about how Red Hat builds enterprise-class products with a completely open source development model and to answer their questions about open source licensing in general. After hearing about Red Hat's success, these conversations often turn to discussions about how their organization can evolve to be more open source-aware and capable, and lawyers at these meetings regularly ask how they can modify their practices to be more skilled in providing open source counsel to their employees. In these two articles, I'll share what I normally tell in-house counsel on these topics. + +### Always find a path to open + +My employer, Red Hat, is unique in its use of open source software in that our development model begins in the open source community with thousands of contributors and results in finished products that are tried, tested, and trusted. More specifically, through our unique development model, we start with community-created open source software and build upon each project to harden security, fix bugs, patch vulnerabilities, and add new features. We then contribute these improvements back to each project, so the entire open source community can benefit. The utilities to this approach are significant, including: + + 1. Leveraging innovation from others outside your organization by collaborating outside your internal teams + 2. Avoiding the cost and inefficiency of developing and maintaining an open source solution by yourself when there are existing or potential communities working on the same problem with which you could collaborate + 3. Through productive collaboration with partners and upstream project communities, avoiding the costly consequences of maintaining a downstream fork of the main project + 1. Some companies find it tempting to create non-public forks of upstream code as a quick way to address a specific use case or because they are not inclined to collaborate in a community. However, the long-term maintenance burdens of such forks can be prohibitive because of increased development costs, loss of interoperability, and other reasons. By contrast, concentrating development in the original upstream community enables sharing development costs among all participants. + + + +With few exceptions (such as Red Hat), most organizations that may use open source software have a proprietary licensing model (or the equivalent concept for software-as-a-service companies) and license proprietary software as part of their business. Such organizations feel that they have software components that provide some competitive advantage and do not wish to see those become available to others under open source terms. That is understandable. I would, however, encourage any open source lawyers counseling such companies to urge their clients towards an open source development model, especially for any software bits that are non-differentiating and common. + +For example, if your company develops applications for mobile phones and you need a software module to read and write PNG image files, it would be much less expensive to use one of the popular open source PNG software modules available on GitHub. Encoding and decoding PNG images is likely a non-differentiating element to your business, so why spend precious engineering time to write your own version? Furthermore, writing your own module for this function may also lead to compatibility issues with other software that uses a commonly used open source module. Why? Although your module and the open source module may have been written to encode and decode to the published PNG specifications, oftentimes, there may be different interpretations of the specifications or errors in implementation. Everyone using the same module for this function ensures compatibility for most users and lowers the cost of development and maintenance. + +It must also be appreciated that certain software may be required to remain proprietary and not subject to open source terms. Depending on the software architecture of your system and the open source software licenses in use, software bits that are intended to remain proprietary may become subject to open source license terms unless certain actions are taken (beyond the scope of this article). This is where some counseling to clients about license choice and architecture will become useful. + +### Develop scalable solutions + +For organizations that primarily license proprietary software grow and increase their use of open source software, review and approval requirements may grow (even exponentially in my experience). As such, such an organization may find itself in a difficult situation due to resource constraints. Scalable solutions that must be put into place are described below. + +#### Empower and delegate to others + +Lawyers cannot and should not be gatekeepers. It is inefficient and will most certainly cause bottlenecks in development and release times, producing frustration and lost revenue. Instead, explore delegating authority to capable individuals in product or project management and engineering. This allows an organization to scale efficiently and effectively. Educating your clients (see the next section) is vitally important for this to succeed. + +One approach I have taken is to provide open source training to entire engineering organizations so that they can make basic licensing and architecture choices, while providing more specialized training to software leads to enable them to provide more complex guidance and decisions. Consider providing clear limits on authority at each level, including what types of issues and decisions must be escalated to you as their open source legal attorney. The specific levels of delegation for your organization will be a function of your team's experience with open source and sensitivities to certain open source concerns. + +#### Educate clients + +I have found that training is one of the most effective tools to migrate your organization to be more open source-aware. Training your software engineers and product managers is crucially important. Let me elaborate. + +Although your software engineers are on the frontlines and may be quite knowledgeable about open source issues and licensing in general, it is still important to train them on your organization's particular requirements. For example, your company may permit only permissive open source licenses to be used and may have certain requirements for its copyright notices and source availability. To avoid problems in development that must be corrected later (a costly and time-consuming exercise), it is best to train engineers to minimize the likelihood of improper behavior, especially at the beginning of any development process (see the next section). + +Product managers must also be trained. In many companies, a product manager is responsible for the classic four P's of marketing—Product, Price, Position, and Promotion—and is accountable for the full lifecycle of a product from cradle to death. All these aspects of a product manager's job may be impacted by the use of open source software. Understanding the requirements when using open source software is useful to them for the same reasons mentioned above. In addition and more importantly, product managers' significant influence in an organization means they are often able to effectuate any required change to process and policy. Product managers may become one of your strongest advocates for instituting process changes towards "open". + +#### Early detection + +It is very difficult and costly to resolve open source licensing issues near the end of the development process. As software approaches its release date, the architecture and the open source software modules have already been chosen. If an issue is detected, such as a copyleft software embedded in a proprietary software module (when that proprietary module is intended to not be subject to open source terms), modifying the architecture or modules at that development phase could be very difficult and expensive. Instead, work on developing processes that analyze architecture and choice of open source modules early in the process so that less costly and more effective course corrections may be made. + +### Open source law's rewards + +Practicing open source law is a rewarding profession due to the ability to influence an organization towards "open," which has significant benefits. Success depends on your ability to develop solutions for your organization that are workable and scalable as your organization grows and matures. + +Find out what it takes to become an open source lawyer. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/9/advice-open-source-lawyer + +作者:[Jeffrey Robert Kaufman][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/jkaufman +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/whiteboard-collaboration-team.png?itok=0A3WcgxZ (whiteboard collaboration with the team) +[2]: https://opensource.com/article/20/7/transitioning-open-source-part-1 diff --git a/sources/talk/20200911 Lenovo introduces four new HCI solutions.md b/sources/talk/20200911 Lenovo introduces four new HCI solutions.md new file mode 100644 index 0000000000..1fb45cd7ae --- /dev/null +++ b/sources/talk/20200911 Lenovo introduces four new HCI solutions.md @@ -0,0 +1,78 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Lenovo introduces four new HCI solutions) +[#]: via: (https://www.networkworld.com/article/3573787/lenovo-introduces-four-new-hci-solutions.html) +[#]: author: (Andy Patrizio https://www.networkworld.com/author/Andy-Patrizio/) + +Lenovo introduces four new HCI solutions +====== +Hyperconverged infrastructure from Lenovo targets workloads including VDI, SAP HANA, Microsoft Azure, and Kubernetes. +Martyn Williams + +Lenovo Data Center Group on Thursday introduced four new [hyperconverged infrastructure][1] (HCI) products aimed at a variety of workloads, including virtual desktop infrastructure (VDI), SAP HANA, Microsoft Azure, and Kubernetes. + +HCI products have grown in popularity because they are easily deployed and can get a variety of workloads up and running quickly. HCI is available either in hardware/appliance form or as software. HCI hardware vendors are the usual suspects – HP Enterprise, Dell, Lenovo – while the software vendors include Nutanix and VMware. + +Lenovo is focused on ready-to-deploy HCI solutions from both software firms. It boasts that its hardware is easy to deploy and manage with simple updates, automatic scalability and a consumption-based use model. + +**READ MORE:** [Making the right hyperconvergence choice: HCI hardware or software?][2] + +"This new normal is forcing many companies of different sizes and scale to think different. They are looking to figure out, 'how do I drive more resiliency to be able to be more efficient? How do I drive more agility to pivot based on my end customer needs and the way they are going to consume my services or my resources?'" said Kamran Amini, vice president and general manager of server, storage and software defined infrastructure, Lenovo Data Center Group, on a conference call briefing with reporters. + +Here are the four products Lenovo announced. + +### ThinkAgile HX + +ThinkAgile HX is a new device powered by AMD EPYC processors and Nutanix software targeted at VDI and virtualization consolidation. With two CPUs and two GPUs in a 1U chassis, Lenovo customers can run their virtual desktop workloads with consistent performance with up to 50% fewer servers. + +ThinkAgile HX is preloaded, factory-integrated and configured with Nutanix Enterprise Cloud software. Lenovo's ThinkAgile Network Orchestrator software is integrated with Nutanix Prism to reduce human error and downtime by automating virtualization configuration changes. + +Availability is planned in late November as an appliance or a certified node. + +### ThinkAgile MX And Microsoft Azure Stack + +Lenovo and Microsoft have partnered to create the Lenovo ThinkAgile MX Azure Stack HCI Edge and Data Center line. [Azure Stack][3] is Microsoft's on-premises cloud software that allows an enterprise to replicate an Azure environment in their own data center and move workloads back and forth between on-prem and Azure. + +The new ThinkAgile MX series of appliances provides a one-stop-shop for the Azure Stack HCI to give businesses an easy way to deploy, manage and scale Azure services from edge to core to cloud. The ThinkAgile MX is designed to enable customers to rapidly deploy a hybrid cloud infrastructure. + +ThinkAgile MX will offer consumption-based, pay-as-you-go pricing of Azue Stack HCI and Azure Stack Hub. Lenovo did not say when it would be available. + +### ThinkAgile VX and VMware + +VMware and Lenovo have partnered to create a new series, the ThinkAgile VX HCI, which runs VMware's vSAN and ESXi and is designed specifically for SAP HANA databases. Lenovo said its new ThinkAgile VX 4S solution offers double the SAP HANA database memory and has direct connect NVMe to accelerate response times, speed business insights and improve total cost of ownership. + +Lenovo ThinkAgile VX HCI are S/4HANA certified nodes that enable customers to modernize their infrastructure and improve performance of vSAN environments via the integration of Lenovo XClarity Management software and the new vSphere Lifecycle Manager (vLCM) tools. + +The ThinkAgile VX will be generally available later in September. + +### Diamanti SR360 + +Lenovo has also partnered with Diamanti, maker of Kubernetes management software, to create the Diamanti SR630 solution based on a ThinkSystem server. Diamanti specializes in enabling fast Kubernetes deployments and allowing organizations to run containerized applications across hybrid cloud environments. + +The SR630 is a purpose-built application platform that combines Diamanti's Spektra Kubernetes platform with acceleration cards and Lenovo servers. The Diamanti SR630 enables customers to rapidly deploy a complete container and Kubernetes solution through plug-and-play networking and persistent storage. + +The Diamanti SR630 is available now. + +Join the Network World communities on [Facebook][4] and [LinkedIn][5] to comment on topics that are top of mind. + +-------------------------------------------------------------------------------- + +via: https://www.networkworld.com/article/3573787/lenovo-introduces-four-new-hci-solutions.html + +作者:[Andy Patrizio][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.networkworld.com/author/Andy-Patrizio/ +[b]: https://github.com/lujun9972 +[1]: https://www.networkworld.com/article/3207567/what-is-hyperconvergence.html +[2]: https://www.networkworld.com/article/3318683/making-the-right-hyperconvergence-choice-hci-hardware-or-software.html +[3]: https://www.networkworld.com/article/3385078/microsoft-introduces-azure-stack-for-hci.html +[4]: https://www.facebook.com/NetworkWorld/ +[5]: https://www.linkedin.com/company/network-world diff --git a/sources/talk/20200911 Why the future of IoT depends on open source.md b/sources/talk/20200911 Why the future of IoT depends on open source.md new file mode 100644 index 0000000000..4bac5d8013 --- /dev/null +++ b/sources/talk/20200911 Why the future of IoT depends on open source.md @@ -0,0 +1,80 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Why the future of IoT depends on open source) +[#]: via: (https://opensource.com/article/20/9/open-source-ai-iot) +[#]: author: (Pin Xue https://opensource.com/users/pinxue) + +Why the future of IoT depends on open source +====== +We're quickly moving from the Internet of Things (IoT) to the Artificial +Intelligence of Things (AIoT). +![Brain on a computer screen][1] + +Most people are familiar with the [Internet of Things (IoT)][2], which refers to smart objects in a connected network, as this diagram shows. + +![IoT diagram][3] + +(PinXue, [CC BY-SA 4.0][4]) + +A "smart" object has a sense of its environment, and it makes decisions (locally or together with peers and a cloud server), then puts those decisions into action. + +To be smart, the object must have a brain to carry intelligence. So far, the way to do this is to embed a computer in the object. For example, you can put a Cortex-M CPU with Bluetooth 5.1 in a chip smaller than 2x2mm and embed it into almost anything. This tiny device is more powerful than my first desktop PC. + +A developer can write software for this tiny computer that uses the device's ability to gather input from all kinds of sensors (e.g., heat, light, moisture, and so on) and share and act on it using the device's screen, speaker, actuators (step motors, servos, and so on), and network. + +### AI + IoT = AIoT + +We often associate IoT with small programmable objects, like a smart lightbulb or door lock. While those are good uses of IoT, IoT is bigger than this. IoT is driving the next stage of our information-centric society. + +Information systems have become a natural part of our everyday lives. You no longer have to sit in front of a computer to surf the internet because a smartphone can bring the whole world into the palm of your hand. Soon, you won't even need a phone—the popularization of smartwatches and other wearables is proving that. The convenience of these information systems encourages us to collect and use more data from everything. For instance, why couldn't a red light tell your car it will turn +green in 5 seconds, so it is not a smart move to release the brake +just yet. + +![Relationships between computers, people, and things][5] + +(PinXue, [CC BY-SA 4.0][4]) + +In a few years, humans won't be the major data producers and consumers. "Things" will be. + +The abundance of data these things will create means we can no longer expect people to be able to analyze all the patterns and contents or even to write parsers to process the data. Based on the sheer amount of data, we need artificial intelligence (AI) to deal with it. AI will be applied to the entire data-processing process, and AI can transmit results instead of raw data. This will also reduce network traffic. Ideally, an AI will be able to drive smart objects to make decisions based on analyzed data on the spot. + +Eventually, the goal is for smart objects to be able to live on their own, as you can see in _[This one owns itself][6]_, a story about a drone earning money to pay its recharging bill by making deliveries for a coffee company. The focus of this story is about the smart contract powered by blockchain, but in my opinion, it's achievable with the artificial intelligence of things (AIoT), the most fundamental element in smart devices. + +### Open source AIoT operating systems + +In the past, smart objects were programmed on bare metal. Now the scenario is a lot more complex. When creating a real-life AIoT system, there are too many details to account for on your own—all of the types of Systems on a Chip (SoC), sensors, actuators, network protocols, AI modeling, performance optimization, reliability, power management, firmware over the air (FOTA), security, and more. However, using an AIoT operating system enables all of this hard work to be accumulated and reused instead of starting over for each hardware or project. + +AIoT is an open world, by its nature. The diversity of smart objects means no one can dominate the entire market, and we must work together to make things talk to each other. There are many levels of openness, such as file formats, protocol stacks, and APIs. These are all dependent upon the openness of the interface and the implementation of the source code. + +Open source makes it possible to customize, reuse, and improve our code. This flexibility is important. The original author of an AIoT operating system cannot be an expert on everything. Other developers have different types of expertise they can use to build upon an open foundation. + +If an operating system is well-designed and has an active community, it can provide reusable drivers, protocols, libraries, frameworks, middleware, and all manner of tools. All these components can speed product development dramatically. Without an open source platform, people have to build those parts again and again. + +The [RT-Thread project][7] has been working toward this goal. RT-Thread is an open source IoT OS that started in 2006 and currently powers 600 million devices. Its IoTOS project is part of the general AIoT blueprint. It also comes with more than 200 open source packages and some commercial packages—and the number of each keeps increasing—that make it easier to develop for the AIoT. + +If you're interested in building the IoT and working toward a better, smarter, and open future of AIoT, visit the [RT-Thread website][8] and see how you can lend a hand. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/9/open-source-ai-iot + +作者:[Pin Xue][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/pinxue +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/brain_computer_solve_fix_tool.png?itok=okq8joti (Brain on a computer screen) +[2]: https://opensource.com/resources/internet-of-things +[3]: https://opensource.com/sites/default/files/uploads/iot-diagram.png (IoT diagram) +[4]: https://creativecommons.org/licenses/by-sa/4.0/ +[5]: https://opensource.com/sites/default/files/uploads/computer-people-things.png (Relationships between computers, people, and things) +[6]: https://medium.com/@creole/6-this-one-owns-itself-9f6a3aa4382d +[7]: https://github.com/RT-Thread/rt-thread +[8]: https://www.rt-thread.io/ diff --git a/sources/talk/20200912 How breaking my back led me to open source.md b/sources/talk/20200912 How breaking my back led me to open source.md new file mode 100644 index 0000000000..b3f8666895 --- /dev/null +++ b/sources/talk/20200912 How breaking my back led me to open source.md @@ -0,0 +1,97 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How breaking my back led me to open source) +[#]: via: (https://opensource.com/article/20/9/breaking-back-open-source) +[#]: author: (Sara Kelly https://opensource.com/users/sarapk) + +How breaking my back led me to open source +====== +Open source gave a voice and a community to someone coping with the +aftermath of a major injury, and eventually led to a new career. +![Open source doctor.][1] + +Recently, I noticed some unusual activity on my blog. A very old post about [how I broke my back][2] while living in London had a lot of hits. Was it yet another case of Internet spammers finding a new target for their lewd advertisements? I finally put two and two together when I read [the headlines][3] that British personality Simon Cowell had broken his back in a freak motorcycle accident. Aha. So, a little celebrity mishap had led to a renewed interest in my story. Not to worry, if my recovery is anything to go by, then Simon should be just fine, folks. + +Breaking my back was a pivotal experience on many fronts. It scared the hell out of me. But the road to recovery helped me become a more resilient, courageous, and patient human being. Interestingly, it was this incident that also led me to the world of open source. Living with chronic pain is lonely, but I found my voice and a community via WordPress. Now, nearly eight years later, I'm working for the number one open source company in the world. + +### Wiggle your toes + +When I woke up in the trauma ward of Whitechapel Hospital back in 2011, I was tightly swaddled in white cotton, like an infant. Pitiful moans echoed around me, and I saw nurses scurrying to-and-fro. There was barely time to balk at my surroundings before a stern-looking doctor with a clipboard approached my cot. He skipped the niceties, and gravely informed me that I had broken my back. + +My first reaction was to wiggle my toes as a cold sweat hit my face. Would I ever walk again? + +"But doctor, I can feel my toes!" I cried, desperately hoping that would be the end of the nightmare. + +I was curtly informed that breaking your back is not the same as a spinal injury. One is a case of broken bones, which can heal over time. The other means permanent disability. In my case, the L1 bone had shattered into small pieces which were resting scarily close to the spinal cord. The doctor recommended complex spinal surgery to collect the bone fragments and piece them back together with metal rods. However, until surgery occurred, I should not make any sudden movements in case the bones slipped and damaged the spinal cord. + +It was five days before I underwent surgery, during which I was in a constant state of terror. I was afraid to move an inch lest I become wheelchair-bound. Lying in the same position for hours on end is painful. Even worse were the well-meaning nurses who needed to carefully maneuver me to change the bed sheets each morning. Those five days seemed like an eternity, but eventually, I had my surgery, and a few days later, I was discharged from the hospital. + +### Learning to walk + +Muscles waste away at an alarming rate. Broken back patients are encouraged to start moving as soon after surgery as possible for the best chance of recovery. During spinal surgery, most of the muscles in your back are spliced through so that the surgeons have room to focus on inserting titanium metal rods around the broken bones. So, when you wake up, you are starting from a position of zero muscle strength. + +The day after my surgery, my first goal was to take two steps. The next day, it was ten steps. Then it was walking to the bathroom and back. By the time I left the hospital, I still couldn't walk more than 15 feet without assistance, but I continued to set myself small goals and started hydrotherapy to regain my mobility. + +Funny enough, my pain only increased as I learned to walk again. Up until that point, I had avoided any serious reliance on drugs. But by the time I could take a shower independently, walk upstairs, or catch public transport with confidence, I was in utter agony. + +### Chronic pain is a lonely place + +It felt like thick, iron poles were constantly stabbing my right hip and knee. At first, the pain would creep on in the early afternoon, but eventually, it became constant chronic pain. The most difficult part was not knowing why it was happening. I was supposed to be getting better, so why was I hurting so badly? + +Nobody explained to me what nerve pain is. Now I know it is a common side effect of any surgery and can be temporary or permanent. Back then, various disinterested doctors and physiotherapists put it down to me not walking correctly or simply complaining. + +Being in constant pain, especially when nobody is listening, is incredibly lonely. For the next couple of years, I experimented with all sorts of medications, yoga, pilates, meditation, and even chiropractic treatments. Nothing would make the pain go away. I became heavily dependent on opiates, which caused other health problems such as constipation, insomnia, and mild hallucinations. + +### Introducing WordPress + +Just as I was giving in to depression, I was introduced to WordPress. A friend of mine had created their own personal blog, and they were posting creative articles about their life and opinions. Up until that time, I had thought the realm of websites was reserved for techie folks. I didn't have a clue about programming, let alone what a domain name was. + +My friend insisted it was easy and invited me to post a guest blog on their site. I decided to share the story of my accident. Publishing the blog was cathartic—I needed that emotional release—and from a technical perspective, it was easy peasy. WordPress allowed me to format the text and add pictures with ease. Afterward, my friend informed me of the number of views my blog posting received, and I toyed with the idea of starting my own website. + +### The doctor calls + +A few weeks after publishing my first ever blog, I was going for a routine checkup at Whitechapel Hospital. Shortly after signing in at the reception counter, the original doctor—the one with the clipboard who had performed my spinal surgery, beckoned me into his office. + +Gone was the serious expression and grouchy-looking eyebrows. The doctor actually looked happy to see me. As usual, he skipped the pleasantries and hastened to share that he had read my blog about breaking my back. I was shocked something I had posted had reached him! He went on to say how moved he was by my struggles, as well as concerned by some of the "remedies" I had tried. He promised he would do whatever he could to get to the bottom of my issue. + +Well, long story short, the doctor eventually discovered the nerve pain I was experiencing was caused by the placement of two of the metal pins around my spine. I went in for a second spinal surgery to remove them, and ever since, I have been pain-free. + +### I'm an open source believer + +![What happens when you break your back][4] + +Sara Kelly [[CC-BY-SA][5]] + +That experience taught me about the power of communication, and it wasn't long before I became a WordPress ninja! I entrenched myself in the [WordPress community][6] and soaked up everything there is to know about [running a website][7], thanks to the amazing network of contributors who post hacks, how-to guides, and respond to troubleshooting forums. + +[WordPress][8] is a completely free platform that anyone can use, study, and even change. I am a huge fan of their [mission statement][9], which reads: "We believe in democratizing publishing and the freedoms that come with open source." My own humble story is just one example of how having a voice made an impact. My original blog is long gone, but I have written subsequent stories about my recovery, which my doctor now shares with new patients, so they know what to expect after a broken back. Perhaps my story has even helped a celebrity like Simon? In any case, I like the idea that there are millions of people the world over, with their own struggles and aspirations, who can make a positive difference in the world by using free platforms like WordPress. + +What can I say? When I got the phone call almost a year ago that Red Hat was hiring, it felt like destiny. It's only by working at Red Hat I've come to appreciate how the idea of "open" unlocks the world's potential. The principles of open source—from decision-making to management practices—are firmly embedded in Red Hat's culture. Now, I truly am an open source believer. + +Besides its popularity, WordPress is also known for usability and an easy-to-develop environment. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/9/breaking-back-open-source + +作者:[Sara Kelly][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/sarapk +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/osdc_520x292_opensourcedoctor.png?itok=fk79NwpC (Open source doctor.) +[2]: https://bossyflossie.com/recover-broken-back/ +[3]: https://edition.cnn.com/2020/08/09/us/simon-cowell-bike-accident-trnd/index.html +[4]: https://opensource.com/sites/default/files/what_happens_if_you_break_your_back.jpg (What happens when you break your back) +[5]: https://creativecommons.org/licenses/by-sa/4.0/legalcode +[6]: https://make.wordpress.org/ +[7]: https://opensource.com/article/20/4/updating-wordpress +[8]: http://wordpress.org +[9]: https://wordpress.org/about/ diff --git a/sources/talk/20200913 Overcoming resistance to open management.md b/sources/talk/20200913 Overcoming resistance to open management.md new file mode 100644 index 0000000000..016106361c --- /dev/null +++ b/sources/talk/20200913 Overcoming resistance to open management.md @@ -0,0 +1,58 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Overcoming resistance to open management) +[#]: via: (https://opensource.com/open-organization/20/9/overcoming-resistance-open-management) +[#]: author: (Heidi Hess von Ludewig https://opensource.com/users/heidi-hess-von-ludewig) + +Overcoming resistance to open management +====== +In some organizations, a cultural aversion to openness is strong. How +can managers overcome it—and create a new sense of shared purpose on +their teams? +![Tug of war][1] + +In this installment of our "[Managing with Open Values][2]" series, I chat again with Braxton, Director of Pricing for a nationwide U.S. insurance company and people manager. + +In June 2018, Braxton reached out to Red Hatters in the Open Organization community. He wanted to learn more about how both he _and_ his team could work differently—using open values. We were happy to help. So I co-organized a workshop on [open organization principles][3] for Braxton and his team—and kept in touch afterward, so I could learn about his adventure in becoming more open. + +In this second interview (which includes collaborators Tracy Guiliani, [industrial/organizational psychologist and expert in associate engagement][4], and [Bryan Behrenshausen][5]), we explored what it was like to learn firsthand about open source values, and how to use them to transform an organization. In particular, we discussed the value of feedback, managing resistance to using open values, and how the management practice of creating shared purpose caused unexpected benefits for a team with dissimilar roles. It's another enlightening conversation, one that allowed us to witness—directly—how someone transformed Open Organization community-driven workshop material into dynamic change with benefits for him, his team, and his organization. + +One striking point to note is that the "journey to open" is complex and worthwhile. Braxton and his team must confront habituated cultural practices that constrict openness. To overcome this, they engage one habit at a time using community (what it means to be a member of an open team), collaboration (defining what each open values mean to them) and inclusivity (actively listening to dissenters and negotiating a solution or understanding). In other words, they _use_ open values to _create the use_ of open values among the team. + +"Being open" can’t be mandatory; it’s important to actively manage conflicts within the team regarding the miscommunication or misunderstanding of open values. + +Put another way: in order to _have_ open, you have to _be_ open. This is actually counterintuitive in conventional organizations. For example, Braxton articulates how "being open" can’t be mandatory; it’s important to actively manage conflicts within the team regarding the miscommunication or misunderstanding of open values. [Conflict, fortunately, is a necessary part of collaboration][6]; it's also the engine for negotiation and change if we allow it, so it's the natural place for translation and transition (i.e., growth) to occur. As Tracy points out during this conversation, when conflict is positive and well-managed, it becomes a force for developing support, increased trust, and psychological safety—which can all reinforce shared purpose. + +Listen to the rest of this interview to learn: + + * How Braxton inspired shared purpose in through open values on his team, using consistent and regular feedback (including being open to negative feedback)  + * How he found himself coming back to the theme of "transparency" to help the team develop specific open values, resulting in faster and clearer communication + * The impact of resistance or late adopters to the open values among his team, the difference between misunderstanding and miscommunication, and the clarification of value to change—working through differences and conflict + * Whether Braxton thinks he would have the same results from his team if he'd chosen to manage _without_ open values as his guides. + + + +Listen to the interview with Braxton + +-------------------------------------------------------------------------------- + +via: https://opensource.com/open-organization/20/9/overcoming-resistance-open-management + +作者:[Heidi Hess von Ludewig][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/heidi-hess-von-ludewig +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/LIFE_information_wants_to_be.jpg?itok=keUyg1RH (Tug of war) +[2]: https://opensource.com/open-organization/managing-with-open-values +[3]: https://github.com/open-organization/open-org-definition +[4]: https://opensource.com/open-organization/20/5/commitment-engagement-org-psychology +[5]: https://opensource.com/users/bbehrens +[6]: https://opensource.com/open-organization/19/5/productive-arguments diff --git a/sources/talk/20200923 How my students taught me to code.md b/sources/talk/20200923 How my students taught me to code.md new file mode 100644 index 0000000000..9c2cb8b414 --- /dev/null +++ b/sources/talk/20200923 How my students taught me to code.md @@ -0,0 +1,67 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How my students taught me to code) +[#]: via: (https://opensource.com/article/20/9/my-students-taught-me-code) +[#]: author: (Jess Weichler https://opensource.com/users/cyanide-cupcake) + +How my students taught me to code +====== +Coding is for everyone—from preschoolers to adults. Here are some ways +to help you and your children learn to code. +![Student desk for open education][1] + +"Hello, I'm Miss Jess, and my students taught me how to code." + +When I say this to new students, they often think I misspoke. But it's true. Coding always interested me, but it seemed inaccessible. Then my students taught me to code a video game during a few lunch breaks. + +Their encouraging advice and suggestions helped me create my first video game using [Scratch][2]. The game was simple. It was about a monkey catching bananas as they fell from the sky. If you caught a ripe banana, you earned points. + +One of my students chimed in with an idea: "Why don't you have bad bananas that take away points?" + +The answer was that I didn't know how to do that yet. But this simple idea was kind of like a puzzle to me. And there's nothing I love more than a good puzzle. So I spent a lunch break working at this new idea until I solved it. + +An accidental side effect of this project was that I was strengthening my math skills. I'd made it through high school and university without ever really understanding what a variable was. But finally having a real-world application I cared about—needing a scoring system for my game—made it all make sense. + +![Scratch game][3] + +(Jess Weichler, [CC BY-SA 4.0][4]) + +### Connecting with kids through coding + +Coding isn't just for kids who dream of becoming computer programmers. It's for everyone. Educators and parents can harness the power of code to engage learners and introduce subjects in a unique way. + +Writing code and seeing it run is a process of discovery, and everyone loves feeling accomplishment. But once you know a little code, it doesn't take long for you to realize that programming can express ideas; foster creativity; teach mathematics, logic, and problem solving; and encourage collaboration. What's not to love? + +Connecting with kids is always important in education, but with more kids learning from home this year, it's vitally important to engage with them. Coding is a great way to do that. + +### Teaching kids to code + +My youngest students are 4 to 7 years old, and I start them with paper "code" activities. These are simple physical games that help young children understand basic programming concepts and mindsets without a digital device. Once my students turn 8, I introduce Scratch, a visual programming language that uses block-based code. I continue this track until they're age 10 to 12. I also teach some paper "code" activities with older children to introduce and reinforce concepts. + +Once students have a clear understanding of visual coding, I move into text-based coding with Python. It's important to help students make the connection between new Python keywords and the Scratch blocks they already know. (Check out my [introduction to Python series][5] for more information.) + +### Just the beginning + +Whether you're an educator, after-school provider, or parent, join me in a series of articles as I explore how you can use coding to supercharge learning opportunities for your child, your students, or even yourself. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/9/my-students-taught-me-code + +作者:[Jess Weichler][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/cyanide-cupcake +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/rh_003588_01_rd3os.combacktoschoolseriesgen_rh_032x_0.png?itok=cApG9aB4 (Student desk for open education) +[2]: https://scratch.mit.edu/ +[3]: https://opensource.com/sites/default/files/uploads/codekids1_myfirstgame.png (Scratch game) +[4]: https://creativecommons.org/licenses/by-sa/4.0/ +[5]: https://opensource.com/article/17/10/python-101 diff --git a/sources/talk/20200924 Still not dead- The mainframe hangs on, sustained by Linux and hybrid cloud.md b/sources/talk/20200924 Still not dead- The mainframe hangs on, sustained by Linux and hybrid cloud.md new file mode 100644 index 0000000000..5fef055eba --- /dev/null +++ b/sources/talk/20200924 Still not dead- The mainframe hangs on, sustained by Linux and hybrid cloud.md @@ -0,0 +1,135 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Still not dead: The mainframe hangs on, sustained by Linux and hybrid cloud) +[#]: via: (https://www.networkworld.com/article/3576290/still-not-dead-the-mainframe-hangs-on-sustained-by-linux-and-hybrid-cloud.html) +[#]: author: (Michael Cooney https://www.networkworld.com/author/Michael-Cooney/) + +Still not dead: The mainframe hangs on, sustained by Linux and hybrid cloud +====== +The mainframe—Linux alliance turns 20 this month and is proving to be more vital than ever, primarily in the form of Big Iron-based Red Hat OpenShift. +Thinkstock + +The [mainframe][1] has been declared “dead”, “morphed” and “transformed” so many times over the years sometimes it’s sometimes hard to believe the Big Iron still has an identity in the enterprise world. + +But clearly it does and in a major way, too.  + +**[ Lessons on diversity in IT: [10 professional organizations focused on diversity in tech][2] • [Being Black in IT: 3 tech leaders share their stories][3] • [Gender gapped: The state of gender diversity in IT][4] • [Māori participation in IT][5]: diversity insights for CIOs everywhere • [IT snapshot: Ethnic diversity in the tech industry][6] ]** + +Take recent news as an example: According to IBM, 75% of the top 20 global banks are running the newest z15 mainframe, and the IBM Systems Group reported a 68% gain in Q2 IBM Z revenue year-over-year. + +At the heart of its current vitality is Linux—primarily in the form of Big Iron-based Red Hat OpenShift—and a variety of software such as IBM [Cloud Paks][7] and open source applications.  The Linux-mainframe marriage is celebrating 20 years this month, and while the incongruous mashup—certainly at the beginning anyway—has been a boon for the mainframe, by most accounts it still has plenty of good years ahead of it. + +“For the first five or so years we really were just experimenting with what we could do with Linux and the mainframe but then the server-consolidation movement hit, and we knew we had something big,” said [Ross Mauri][8], the general manager for IBM Z. + +“What really got us going was the big Wall Street financial companies who all had these Sun Solaris servers with big databases, and many decided to consolidate on the Z mainframe running Linux, and we were off and running,” he said. + +[[Get regularly scheduled insights by signing up for Network World newsletters.]][9] + +Another contributing factor in 2000 was Big Blue’s $1B investment in all things Linux, which was a huge move in getting the operating system and open-source software in general into the mainstream business market. + +Since that time there have been numerous milestones in the mainframe’s Linux journey, including the introduction of a standalone box, the LinuxONE, five years ago, which is now at the heart of some of the world’s largest implementations. + +### Red Hat to the rescue + +The next chapter in the mainframe story began last year when [IBM bought Linux powerhouse Red Hat][10] for $34B, tying the massive transactional capacity, security and reliability of the Big Iron with Red Hat Open Shift and Red Hat Enterprise Linux. + +IBM has also released Red Hat Ansible Certified Content for IBM Z and launched a new cloud-native development offering, [Wazi Workspaces][11], which lets developers apply industry-standard tools from IBM Z to multi-cloud platforms optimized for OpenShift. + +Combine those moves with all of the open-source mainframe software work going on in the [Linux Foundation’s Open Mainframe Project][12] and customers now have a ton of development options for private or public cloud-based workloads. + +“Clients no longer have to develop and work with proprietary tools, and the zOS is being brought completely into the modern application development world,” Mauri said. + +Gartner recently wrote of that trend: “Now developers, testers, and infrastructure and operations staff have the capability to utilize the same tools which exist in the distributed world. Rocket Software, CA Technologies and IBM are supporting the [Open Mainframe Project Zowe][13], which is making adapting of open-source tools much easier.” + +IBM calls Zowe an open source software framework that lets development and operations teams securely, manage, control, script and develop on the mainframe like any other cloud platform. + +“From application development software, to complex DevOps orchestration engines, these traditional platforms are enjoying a resurgence of relevance in the data center that is making them accessible to all developers and testers. This change significantly reduces the issue of limited and old-fashioned development tools that previously contributed to the impetus to leave traditional platforms,” Gartner stated. + +Going forward Mauri said he expects a number of key technologies will continue to make the mainframe a key cloud and compute player. + +### Confidential Computing + +One of those keys is an overarching security model called Confidential Computing which IBM broadly describes as a way to protect data, applications and processes at scale. It has rolled out a number products that adhere to the Confidential Computing mantra. For example, IBM’s Secure Execution for Linux software lets customers isolate and protect  large numbers of workloads from internal and external threats across a hybrid-cloud environment. Other packages let customers bolt-down containerized Kubernetes workloads or Red Hat OpenShift clusters, IBM says. + +There is also a Linux Foundation project, the Confidential Computing Consortium, made up of  Alibaba, Arm, Baidu, IBM/Red Hat, Intel, Google Cloud and Microsoft that is pushing the concept industry wide. + +“The organization aims to address data in use, enabling encrypted data to be processed in memory without exposing it to the rest of the system, reducing exposure to sensitive data and providing greater control and transparency for users,” the Consortium says on its website.  “This is among the very first industry-wide initiatives to address data in use, as current security approaches largely focus on data at rest or data in transit. The focus of the Confidential Computing Consortium is especially important as companies move more of their workloads to span multiple environments, from on premises to public cloud and to the edge.” + +Mauri says IBM is on its fourth generation of Confidential Computing technology which will keep it out in front of other industry cloud players and give the company a strong security weapon for the foreseeable future. + +“The vulnerability landscape is constantly changing, and organizations can be attacked across their IT systems. Add to that concerns around data privacy and regulations and you’ve got a full plate,” said Terri Cobb, lead alliance partner at Deloitte Consulting. Deloitte recently conducted a survey of business and IT decision makers with Forrester Consulting and found 80% of respondents are focused on modernizing mainframe toolsets in an effort to identify and prevent data breaches, and 73% are increasing their security footprint. + +“Data protection and security are so critical, and mainframes remain one of the most secure and powerful platforms available when the right controls are in place,” Cobb said. + +### Pay per use + +Another direction IBM and the mainframe is moving is toward a more cloud-agile, consumption-based licensing model that lets customers pay only for what they consume, Mauri said. The company rolled out its Tailored Fit Pricing model in 2019 and has upwards of 80 customers onboard so far, Mauri said. It offers two consumption-based pricing models that can help customers cope with ever-changing workload and hence software costs. + +Mauri said IBM expects to make hardware more consumption based in the future. + +Predicting demand for IT services can be a major challenge, and in the era of hybrid and multicloud, everything is connected and workload patterns constantly change, Mauri wrote in a [blog][14] about the new pricing and services in 2019. “In this environment, managing demand for IT services can be a major challenge. As more customers shift to an enterprise IT model that incorporates on-premises, private cloud and public we’ve developed a simple cloud pricing model to drive the transformation forward.” + +### ML/AI opportunities + +Others say technologies such as machine learning and artificial intelligence will also drive future mainframe development. + +“Data insights help drive actionable and profitable results—-but the pool of data is growing at astronomical rates. That’s where AI can make a difference, especially when it’s on a mainframe. Consider the amount of data that resides on a mainframe for an organization in the banking, manufacturing, healthcare, or insurance sectors. You’d never be able to make sense of it all without AI,” said Deloitte’s Cobb. As an example, Cobb said core banking operations can do more than simply execute large volumes of transactions. + +“Banks need deep insights about customer needs, preferences, and intentions to compete effectively, along with speed and agility in sharing and acting on those insights. That’s easier said than done when data is constantly changing. Now if you can analyze data directly on the mainframe, you can get near real-time insights and action. That makes the mainframe an important participant in the AI/ML revolution,” Cobb said. + +The mainframe environment isn’t without challenges going forward. + +For example, there is a [growing market for moving mainframe applications off][15] of the Big Iron and onto cloud services. Large cloud players such as Amazon, Google and Microsoft are also involved in modernizing mainframe applications. For example, Google Cloud in February [bought mainframe cloud-migration service firm Cornerstone Technology][16] with an eye toward helping Big Iron customers move workloads to the private and public cloud. An ecosystem of mainframe modernization service providers such as [Astadia][17], [Asysco][18], [GTSoftware][19], LZLabs,  [Micro Focus][20] has also grown up. + +### COBOL coders needed + +Another challenge is finding and developing the right people to cultivate the mainframe environment. + +“It was predicted mainframes would eventually cease to exist so colleges stopped offering courses focused on COBOL and other critical mainframe skills. As Baby Boomers retire, mainframe talent concerns are becoming a reality,” Cobb said.   + +Deloitte’s survey found that 71% of respondents said their teams are understaffed, and 93% said its “moderately” to “extremely challenging” to acquire the right mainframe resources and skills, Cobb said. + +“Many large companies are addressing this issue by hiring and developing college recruits, developing a mentoring program, creating an internship, or turning to third parties for support. Mainframes aren’t going anywhere—the talent pool needs to match the demand,” Cobb said. + +While there are challenges in the future, Cobb said the consultancy’s survey showed customers are looking to _increase_ their investment in the mainframe with 91% of respondents identified as expanding their mainframe footprints as a moderate or critical priority in the next 12 months. + +Join the Network World communities on [Facebook][21] and [LinkedIn][22] to comment on topics that are top of mind. + +-------------------------------------------------------------------------------- + +via: https://www.networkworld.com/article/3576290/still-not-dead-the-mainframe-hangs-on-sustained-by-linux-and-hybrid-cloud.html + +作者:[Michael Cooney][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.networkworld.com/author/Michael-Cooney/ +[b]: https://github.com/lujun9972 +[1]: https://www.networkworld.com/article/2231401/inside-ibm-s-game-changing-mainframe-moments.html +[2]: https://www.cio.com/article/3564791/10-professional-organizations-focused-on-diversity-in-tech.html +[3]: https://www.cio.com/article/3566069/being-black-in-it-3-tech-leaders-share-their-stories.html +[4]: https://www.cio.com/article/3532001/gender-gapped-the-state-of-gender-diversity-in-it.html +[5]: https://www.cio.com/article/3566098/maori-participation-in-it-insights-for-cios.html +[6]: https://www.computerworld.com/article/3567095/it-snapshot-ethnic-diversity-in-the-tech-industry.html +[7]: https://www.networkworld.com/article/3429596/ibm-fuses-its-software-with-red-hats-to-launch-hybrid-cloud-juggernaut.html +[8]: https://newsroom.ibm.com/Bringing-Linux-to-IBM-Z +[9]: https://www.networkworld.com/newsletters/signup.html +[10]: https://www.networkworld.com/article/3407746/will-ibms-acquisition-be-the-end-of-red-hat.html +[11]: https://www.ibm.com/products/wazi-for-red-hat-codeready-workspaces +[12]: https://www.openmainframeproject.org/ +[13]: https://www.openmainframeproject.org/projects/zowe +[14]: https://www.ibm.com/blogs/systems/ibm-z-defines-the-future-of-hybrid-cloud/ +[15]: https://www.networkworld.com/article/3567058/options-grow-for-migrating-mainframe-apps-to-the-cloud.html?utm_source=facebook&utm_content=content&utm_medium=social&utm_campaign=organic&fbclid=IwAR2JPUEItx11TeSqiIvgr3_HA4YQRv_U7imm4Z4WG-wCuir_WrrE2zmst5o +[16]: https://www.networkworld.com/article/3528451/google-cloud-moves-to-aid-mainframe-migration.html +[17]: https://www.astadia.com/blog/mainframe-migration-to-azure-in-5-steps +[18]: https://www.asysco.com/code-transformation/ +[19]: https://www.gtsoftware.com/services/migration-services/ +[20]: https://www.microfocus.com/en-us/home +[21]: https://www.facebook.com/NetworkWorld/ +[22]: https://www.linkedin.com/company/network-world diff --git a/sources/talk/20200927 What would a global open organization look like.md b/sources/talk/20200927 What would a global open organization look like.md new file mode 100644 index 0000000000..046c1b5b44 --- /dev/null +++ b/sources/talk/20200927 What would a global open organization look like.md @@ -0,0 +1,121 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (What would a global open organization look like?) +[#]: via: (https://opensource.com/open-organization/20/9/global-open-organization) +[#]: author: (Ron McFarland https://opensource.com/users/ron-mcfarland) + +What would a global open organization look like? +====== +Solving global problems will require global collaboration. Working +openly is the best way forward. +![Pixelated globe][1] + +In the [first article in this series][2], I presented four dimensions of globalization and explained how they relate to [open organization principles][3]. Then, in [the second part][4], I reviewed a history of globalization, one based on [Jeffrey D. Sachs][5]' book [The Ages of Globalization][6]. That piece tracked a history of gradually increasing openness—from the beginning of human civilization up to the start of the industrial revolution, which began around the beginning of the 1800s. + +In this final installment of the series, I will continue my review of Sachs' book by examining two more recent historical settings, the Industrial Age and the Digital Age, to explain how open principles have shaped more recent trends in globalization—and how these principles will be integral to our global future. + +### The Industrial Age (1800‒2000 CE): The urban, city growth, and machine setting + +According to Sachs, around 1820, 85% of the global population was still involved in farming and lived at a subsistence level. Of them, 93% were relatively unconnected, living in rural areas. + +Through the advent of industrial development, that all changed. + +By 2000, about half the global population (46.7%) lived in urban areas, their average incomes soared, and average life expectancy had reached 67 years old (according to 2000‒2005 data). Living in an interconnected world among a web of nonstop data altered the relative isolation of village life—an illustration of the importance of building **communities** that are **inclusive**, **collaborate** deeply, are very open and **transparent** with each other, and support each other when there are unexpected challenges **(adaptable)**. + +The Industrial Revolution began in 1776 with James Watt's invention of the steam engine in Scotland. Railroads and steamships began connecting the world. Large factories began bringing in people from the countryside. As the British economic historian E. A. Wrigley has written, this was a movement from an "organic economy" to an "energy-rich economy" in which we see a shift from a dependence on raw materials from vegetable or animal (including human manual labor) for energy to three main fossil fuels for energy (coal, petroleum and natural gas) that was deployed after 1800 (and then, just 100 years later, nuclear technology). + +[Global GDP per capita][2] hadn't changed much until around 1780‒1830, when the steam engine sparked a wave of increase, according to economist [Nikolai Kondratiev][7]. From then, upward movements in GDP [have come in additional waves][8], Kondratiev says. The second wave arrived around 1830‒1880, with investments in railways and steel. The third (1880‒1930) came from electrification. Automobiles sparked the fourth wave around 1930‒1970. The fifth, information technologies, began around 2010. And now intelligent technology, including robotics and artificial intelligence, stands to spark another from 2010‒2050. All these investments have changed the environment in which we build communities, collaborate, share information and address challenges (they also created income inequality between regions—between Kondratiev's "energy rich" economies and others). + +By the end of World War II (around 1945) many organizations had been established to promote what today we might call greater openness. Organizations like the [United Nations (UN)][9], the [International Monetary Fund (IMF)][10], [the World Bank][11], [the General Agreement on Tariffs and Trade (GATT)][12], [the Food and Agricultural Organization][13] and the [World Health Organization (WHO)][14] continue to promote various forms of global cooperation. The same is true of global philanthropic organizations and private foundations like the [Bill and Melinda Gate Foundation][15], [Greenpeace][16] and others. They will be more needed and must be strengthened in the years ahead. + +### The Digital Age (Twenty-First Century): The connection and sustainability-challenge setting + +We are only one-fifth of the way into the 21st Century. According to Sachs, globalized communities in this period will address different issues than those they've addressed up until now. Economic activity, jobs, lifestyles, and geopolitics will all gradually change. To address these changes, we can apply open organizational principles. + +According to Sachs, these issues will be central to those changes. + +**Drastic economic and financial inequality.** We must address the distribution of global wealth. Workers displaced by machines have seen their earnings stagnate or decline. These workers must be retrained and re-skilled with processes financed through taxation. This is equally true between developed and developing countries. Developed countries must provide some kind of managed support to developing countries as they transition in the years and decades ahead. These are global issues and should be addressed as such, Sachs says, or unmanageable global unrest and continued poverty will result. + +Could we write a mission statement for humankind? If we could, open organization principles should be its backbone. + +**A global environmental crisis.** "The world economy has increased roughly a hundredfold over the past two centuries: roughly ten times the population and ten times the GDP per capita," Sachs writes. "Yet the physical planet has remained constant, and the human impact on that environment has therefore intensified dramatically." Issues like climate change, the burning of fossil fuels, mass destruction of biodiversity, and the dire pollution of air, soils, freshwater and oceans must all be topics of _global_ conversation and collaboration, or we will watch our environment worsen, Sachs says. + +**Increased chance of global war.** In Sachs' outline of historical periods, shifts in geopolitical power are often accompanied by war. That potential is once more a potential concern. This issue will require a great deal of open discussions between these nations. + +### Governance through the ages + +Let's take one more global look at [organizational governance through the ages][4]. According to Sachs, governance has become more global over time. + + * In the Paleolithic Age (70,000-10,000 BCE), there were strong bonds developed between nomadic clans, particularly "bands" of 25‒30 members within those clans. + * In the Neolithic Age (10,000-3,000 BCE), through agricultural advancement, there was village life and local politics. + * In the Equestrian Age (3,000-1,000 BCE), through animal domestication and travel by horses, states were formed and governed. + * In the Classical Age (1,000 BCE-1500 CE), governance expanded to regional multi-ethnic empires through education and further information documentation. + * In the Ocean Age (1500-1800 CE), through long-distance sea travel, larger global empire governance started. + * In the Industrial Age (1800-2000 CE), the United Nations was formed and two dominant powers emerged (namely, the United Kingdom and the United States). + * In the Digital Age (the 21st Century), shifting geopolitical conditions will prompt new developments in global organizational governance, particularly in a globally connected world in which China and the United States will play major roles. + + + +Sachs notes that prosperity and longer life expectancy have resulted from increased global interconnectedness and organizational openness. + +So how might we build the next generation of global, open organizations? + +### An age of truly global collaboration + +According to Professor Sachs, in order to get buy-in to address these issues, currently underrepresented regions will need a more powerful voice in the global community. Nations will not buy into potential changes unless they feel they are fully represented, participating in a true collaborative dialog. Configuring a global community attentive to members' needs is extremely important. Without ideal representation and talent in the room, very little can be achieved. + +For example, to obtain stronger global buy-in, Sachs recommends one representative from each of eight major global regions in the United Nations (North America, South America, European Union, African Union, South Asia, East Asia, Commonwealth of Independent States, and Western Asia). A manageable team of eight people discussing global issues has a higher chance of success. + +Also, Sachs recommends that Brazil, Germany, India, Indonesia, Japan, and Nigeria should be permanent members of the UN Security Council. Then, global issues can be more easily and seriously addressed. As is, he writes, the 193 individual member countries can do very little. + +A successful development agenda (the community's purpose) requires inclusive partnerships at the global, regional, national and local levels. They have to be built upon a shared vision and shared goals with all human beings and the planet at the center. Furthermore, with an increase in urban populations, communities should be getting involved in not only issues within their area but globally as well. Here again, their representation and participation are required to get them to buy-in to anything agreed on. + +In short, a globally viable open organization of member nations would be beneficial. + +Here are two challenges such an organization could help address. + +**Ending world poverty.** Sachs believes that in our generation we should see an end to world poverty—particularly if the global community works on supporting poorer communities, controlling disease globally, increasing school attendance, and improving infrastructure worldwide. Work on these issues have already begun in many places at a _national_ level (consider China's [Belt and Road initiative][17]), but it should be coordinated on a global scale. + +**Promoting Literacy.** In the 1950s, global illiteracy (in any language) had been eliminated in most high-income countries, and yet the global illiteracy rate was still roughly 80% in developing countries. This gap made global collaboration and joint problem-solving difficult. Therefore, even though life expectancy in developed countries was then around 68 years of age, in developing countries it was only around 40 years of age. Open organization principles become very difficult to be adopted globally, or won't work at all worldwide, where such illiteracy is common. Multi-language education must be a priority. While English is the language of choice in most scientific, financial, or diplomatic discussions, it is not the most _spoken_ language (Chinese is). Foreign language learning, foreign language interpreting, and foreign language translation will become more important as well in the years ahead to promote global understanding, cooperation and collaboration. + +### A shared identity + +We all have identities formed in part by the groups in which we participate—sports teams, religious groups, regions, and nationalities. We tend to promote and support those that we identify with. So how might we develop an identity for a new, _global_ organization that welcomes open participation in solving global issues? + +Could we write a mission statement for humankind? + +If we could, [open organization principles][3] should be its backbone. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/open-organization/20/9/global-open-organization + +作者:[Ron McFarland][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/ron-mcfarland +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/pixelated-world.png?itok=fHjM6m53 (Pixelated globe) +[2]: https://opensource.com/open-organization/20/7/globalization-history-open +[3]: https://theopenorganization.org/definition +[4]: https://opensource.com/open-organization/20/8/global-history-collaboration +[5]: https://en.wikipedia.org/wiki/Jeffrey_Sachs +[6]: https://cup.columbia.edu/book/the-ages-of-globalization/9780231193740 +[7]: https://en.wikipedia.org/wiki/Nikolai_Kondratiev +[8]: https://ourworldindata.org/grapher/world-gdp-over-the-last-two-millennia +[9]: https://www.un.org/en/ +[10]: https://www.imf.org/external/index.htm +[11]: https://www.worldbank.org/ +[12]: https://en.wikipedia.org/wiki/General_Agreement_on_Tariffs_and_Trade#:~:text=The%20General%20Agreement%20on%20Tariffs,such%20as%20tariffs%20or%20quotas. +[13]: https://en.wikipedia.org/wiki/Food_and_Agriculture_Organization +[14]: https://www.who.int/ +[15]: https://www.gatesfoundation.org/ +[16]: https://opensource.com/tags/open-organization-greenpeace +[17]: https://www.beltroad-initiative.com/belt-and-road/ diff --git a/sources/talk/20200928 5 ways to conduct user research with an open source mindset.md b/sources/talk/20200928 5 ways to conduct user research with an open source mindset.md new file mode 100644 index 0000000000..c2072cccc3 --- /dev/null +++ b/sources/talk/20200928 5 ways to conduct user research with an open source mindset.md @@ -0,0 +1,117 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (5 ways to conduct user research with an open source mindset) +[#]: via: (https://opensource.com/article/20/9/open-source-user-research) +[#]: author: (Alana Fialkoff https://opensource.com/users/alana) + +5 ways to conduct user research with an open source mindset +====== +See how this team elevates their user research experiences and results +with an open source approach. +![Mobile devices are a big part of our daily lives][1] + +There are common beliefs about user experiences—the best ones are user-centered, iterative, and intuitive. When user experience (UX) research is conducted, user stories about these experiences are collected—but the research methods chosen inform user experiences, too. + +So, what makes for an engaging research experience, and how can methods evolve alongside products to better connect with users? + +[Red Hat's User Experience Design (UXD) research team][2] has the answer: a community-centered, open source mindset.  + +As a UX writer on Red Hat's UXD team, I create new design documentation, empower team voices, and share Red Hat's open source story. My passion lies in using content to connect and inspire others. On our [Twitter][3] and [Medium][4] channels, we share thought leadership about UX writing, research, development, and design, all to amplify and grow our open source community. This community is at the heart of what we do. So when I learned how the research team centers community throughout their user testing, I leaped at the chance to tell their story. + +### Approaching research with an open source mindset + +Red Hat's UXD team creates in the open, and this ideology applies to their research, too. Thinking the open source way involves adopting a community-first and community-driven frame of mind. New ideas can come from anywhere, and an open source mindset embraces these varied voices and perspectives. + +Structuring research with an open source mindset means each research technique should be driven by two angles—we don't just want to learn about our users; we want to learn from them, too. + +To satisfy both of these user-focused objectives, we make research decisions backed by other voices, not just our own. By sourcing input from beyond our team, we design research experiences that are truly tailored to the communities we serve. + +Guiding questions help us streamline this process. Some questions the team's researchers use to develop their methods include: + + * Does this method amplify user voices? + * Are we facilitating open communication with our users? + * Does this method build a meaningful connection with our user base? + * What kind of experience does this technique build? Is it memorable? Engaging? + + + +Notice a trend? Each question hinges on community. + +### Building research experiences like user experiences + +Researchers approach their UX research as a user experience, too. We want our research sessions to have the same qualities as our user interfaces: + + * Memorable + * Engaging + * Intuitive + * User-centered + + + +Research offers in-depth engagement with our user base, so it's important to tailor our techniques to that community. When we conduct user research, we learn more about how our users engage with our products and use that knowledge to improve them. We can use that same process to shape future research sessions. + +Open source, user-centered research—sounds great. But how can we actually achieve it? + +Let's take a look at five collaborative techniques we use to design more immersive user research experiences the open source way. + +### Evolve research methods to build engaging experiences and strong connections + +Tailor research methods to the target audience, with a goal to create a connective experience. The tools at our disposal vary largely depending on our venue (in-person vs. virtual), so this approach lets us get creative. + + * **Add dimension**: Are you conducting a survey? Consider appealing your users' senses offscreen. We've expanded our research to the third dimension using strings, LEGOs, and card diagrams to collect data in more tactile ways. + * **Streamline**: Are your research methods efficient and time-conscious? There's only one way to find out. Follow up with users about their experience post-session. If they say a survey or form was cumbersome, consider condensing your longer questions into smaller, more digestible ones. + * **Simplify**: Use what you know about your user base to customize your techniques. A busy community working in enterprise IT, for example, might only have time to fill out a brief form. Structure your methods so that they're navigable and intuitive for your specific audience. + + + +### Guide research with research + +Contextualize questions around user's needs. Explore their goals. Identify their cares, difficulties, and thoughts on product performance. Use these findings to design more meaningful research sessions, and check in often. As our products evolve with our users, our research methods do, too. + +### Keep an open mind + +Work with the community to disprove our own assumptions. Lean into the spirit of open source by engaging with others across the team, company, user base, and industry. Use these communities like a sounding board for ideas and welcome their feedback. Community-centered conversations take place in environments like: + + * Team meetings and brainstorms + * Company calls and research shares + * Conferences and industry panels + * Internal and external blogging platforms + * Other thought leadership forums + + + +This means speaking at monthly meetings, messaging across team channels, and presenting ideas at annual thought leadership events, where a multitude of voices meet from across the industry to share their experience and expertise. + +### Communicate, communicate, communicate + +With an open source mindset comes open communication. Spark meaningful conversations with users and keep those channels open beyond formal research sessions. Community-driven research techniques start with just that: community. Invest in a strong connection with users to invite deeper insights and facilitate more impactful sessions. + +### Experiment with new research techniques and take a user-centered, UX approach + +Prototype. Test. Iterate. Repeat. The methods will morph as the open source approach takes shape. + +That's the magic of conducting research in the open: dynamic change, driven by a deeper connection to the community. + +Learn more about how Red Hat's UXD team conducts research by checking out [DevConf.US][5], where individuals across the open source community come together to talk all things tech, open source, and UX. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/9/open-source-user-research + +作者:[Alana Fialkoff][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/alana +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/mobile-demo-device-phone.png?itok=y9cHLI_F (Mobile devices are a big part of our daily lives) +[2]: https://medium.com/patternfly/from-interviewers-to-interviewees-meet-red-hats-ux-research-team-af860a65abc5 +[3]: https://twitter.com/RedHatUXD +[4]: https://medium.com/patternfly +[5]: https://www.devconf.info/us/ diff --git a/sources/talk/20200930 FCC auctions should be a long-term boost for 5G availability.md b/sources/talk/20200930 FCC auctions should be a long-term boost for 5G availability.md new file mode 100644 index 0000000000..151561c2e4 --- /dev/null +++ b/sources/talk/20200930 FCC auctions should be a long-term boost for 5G availability.md @@ -0,0 +1,87 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (FCC auctions should be a long-term boost for 5G availability) +[#]: via: (https://www.networkworld.com/article/3584072/fcc-auctions-should-be-a-long-term-boost-for-5g-availability.html) +[#]: author: (Jon Gold https://www.networkworld.com/author/Jon-Gold/) + +FCC auctions should be a long-term boost for 5G availability +====== +Federal Communications Commission policymaking targets creation of new services by making more spectrum available +[FCC][1] + +As the march towards 5G progresses, it’s apparent that more spectrum will be needed to fully enable it as a service, and the Federal Communications Commission has clearly taken the message to heart. + +### 5G resources + + * [What is 5G? Fast wireless technology for enterprises and phones][2] + * [How 5G frequency affects range and speed][3] + * [Private 5G can solve some problems that Wi-Fi can’t][4] + * [Private 5G keeps Whirlpool driverless vehicles rolling][5] + * [5G can make for cost-effective private backhaul][6] + * [CBRS can bring private 5G to enterprises][7] + + + +The FCC recently finished [auctioning off priority-access licenses for Citizen’s Broadband Radio Service (CBRS)][8] spectrum for 5G, representing 70MHz swath of new bandwidth within the 3.5GHz band. It took in $4.58 billion and is one of several such auctions in recent  years aimed at freeing up more channels for wireless data. In 2011, 2014 and 2015 the FCC auctioned off 65MHz in the low- to mid-band, between roughly 1.7GHz and 2.2GHz, for example, and the 700MHz band. + +But the operative part of the spectrum now is the sub-6GHz or mid-band spectrum, in the same area as that sold off in the [CBRS][9] auction. A forthcoming C-Band auction will be the big one, according to experts, with a whopping 280MHz of spectrum on the table. + +“The big money’s coming with the C-band auction,” said Jason Leigh, a research manager with IDC. “Mid-band spectrum in the U.S. is scarce— that’s why you’re seeing this great urgency.” + +[[Get regularly scheduled insights by signing up for Network World newsletters.]][10] + +While the major mobile-data providers are still expected to snap up the lion’s share of the available licenses in that auction, some of the most innovative uses of the spectrum will be implemented by the enterprise, which will compete against the carriers for some of the available frequencies. + +Specialist networks for [IoT][11], asset tracking and other private networking applications are already possible via private LTE, but the maturation of 5G substantially broadens their scope, thanks to that technology’s advanced spectrum sharing, low-latency and multi-connectivity features. That, broadly, means a lot of new wire-replacement applications, including industrial automation, facilities management and more. + +## Reallocating spectrum means negotiation + +It hasn’t been a simple matter to shift America’s spectrum priorities around, and few would know that better than former FCC chair Tom Wheeler. Much of the spectrum that the government has been pushing to reallocate to mobile broadband over the past decade was already licensed out to various stakeholders, frequently government agencies and satellite network operators. + +Those stakeholders have to be moved to different parts of the spectrum, often compensated at taxpayer expense, and getting the various players to share and share alike has frequently been a complicated process, Wheeler said. + +“One of the challenges the FCC faces is that the allocation of spectrum was first made from analog assumptions that have been rewritten as a result of digital technology,” he pointed out, citing the transition from analog to digital TV as an example. Where an analog TV signal took up 6MHz of spectrum and required guard bands on either side to avoid interference, four or five digital signals can be fit into that one channel. + +Those assumptions have proved challenging to confront. Incumbents have publicly protested the FCC’s moves in the mid-band, arguing that insufficient precautions have been taken to avoid interference with existing services, and that changing frequency assignments often means they have to buy new equipment. + +“I went through it with the [Department of Defense], with the satellite companies, and the fact of the matter is that one of the big regulatory challenges is that nobody wants to give up the nice secure position that they have based on analog assumptions,” said Wheeler. “I think you also have to pay serious consideration, but I found that claims of interference were the first refuge of people who didn’t like the threat of competition or anything else.” + +## The future: more services + +The broader point of the opening of the mid-band to carrier and enterprise use will be potentially major advantages for U.S. businesses, regardless of the exact manner in which that spectrum is opened, according to Leigh. While the U.S. is sticking to the auction format for allocating wireless spectrum, other countries, like Germany, have set aside mid-band spectrum specifically for enterprise use. + +For a given company trying to roll its own private 5G network, that could push spectrum auction prices higher. But, ultimately, the services are going to be available, whether they’re provisioned in-house or sold by a mobile carrier or vendor, as long as there’s enough spectrum available to them. + +“The things you can do on the enterprise side for 5G are what’s going to drive the really futuristic stuff,” he said. + +Join the Network World communities on [Facebook][12] and [LinkedIn][13] to comment on topics that are top of mind. + +-------------------------------------------------------------------------------- + +via: https://www.networkworld.com/article/3584072/fcc-auctions-should-be-a-long-term-boost-for-5g-availability.html + +作者:[Jon Gold][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.networkworld.com/author/Jon-Gold/ +[b]: https://github.com/lujun9972 +[1]: https://www.flickr.com/photos/fccdotgov/4808818548/ +[2]: https://www.networkworld.com/article/3203489/what-is-5g-fast-wireless-technology-for-enterprises-and-phones.html +[3]: https://www.networkworld.com/article/3568253/how-5g-frequency-affects-range-and-speed.html +[4]: https://www.networkworld.com/article/3568614/private-5g-can-solve-some-enterprise-problems-that-wi-fi-can-t.html +[5]: https://www.networkworld.com/article/3488799/private-5g-keeps-whirlpool-driverless-vehicles-rolling.html +[6]: https://www.networkworld.com/article/3570724/5g-can-make-for-cost-effective-private-backhaul.html +[7]: https://www.networkworld.com/article/3529291/cbrs-wireless-can-bring-private-5g-to-enterprises.html +[8]: https://www.networkworld.com/article/3572564/cbrs-wireless-yields-45b-for-licenses-to-support-5g.html +[9]: https://www.networkworld.com/article/3180615/faq-what-in-the-wireless-world-is-cbrs.html +[10]: https://www.networkworld.com/newsletters/signup.html +[11]: https://www.networkworld.com/article/3207535/what-is-iot-the-internet-of-things-explained.html +[12]: https://www.facebook.com/NetworkWorld/ +[13]: https://www.linkedin.com/company/network-world diff --git a/sources/talk/20200930 VMware plan disaggregates servers- offloads network virtualization and security.md b/sources/talk/20200930 VMware plan disaggregates servers- offloads network virtualization and security.md new file mode 100644 index 0000000000..2f2c1bc343 --- /dev/null +++ b/sources/talk/20200930 VMware plan disaggregates servers- offloads network virtualization and security.md @@ -0,0 +1,71 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (VMware plan disaggregates servers; offloads network virtualization and security) +[#]: via: (https://www.networkworld.com/article/3583990/vmware-plan-disaggregates-servers-offloads-network-virtualization-and-security.html) +[#]: author: (Michael Cooney https://www.networkworld.com/author/Michael-Cooney/) + +VMware plan disaggregates servers; offloads network virtualization and security +====== +VMware Project Monterey includes NVIDIA, Intel and goes a long way to meld bare metal servers, graphics processing units +Henrik5000 / Getty Images + +VMware is continuing its effort to remake the data center, cloud and edge to handle the distributed workloads and applications of the future. + +At its virtual VMworld 2020 event the company previewed a new architecture called Project Monterey that goes a long way toward melding bare-metal servers, graphics processing units (GPUs), field programmable gate arrays (FPGAs), network interface cards (NICs) and security into a large-scale virtualized environment. + +Monterey would extend VMware Cloud Foundation (VCF), which today integrates the company’s vShphere virtualization, vSAN storage, NSX networking and vRealize cloud management systems to support GPUs, FPGAs and NICs into a single platform that can be deployed on-premises or in a public cloud. + +[[Get regularly scheduled insights by signing up for Network World newsletters.]][1] + +The combination of a rearchitected VCF with Project Monterey will disaggregate server functions, add support for bare-metal servers and let an application running on one physical server consume hardware accelerator resources such as FPGAs from other physical servers, said Kit Colbert vice president and chief technology officer of VMware’s Cloud Platform business unit. + +This will also enable physical resources to be dynamically accessed based on policy or via software API, tailored to the needs of the application, Colbert said.  “What we see is that these new apps are using more and more of server CPU cycles. Traditionally, the industry has relied on the CPU for everything--application business logic, processing network packets, specialized work such as 3D modeling, and more,” Colbert wrote in a [blog][2] outlining Project Monterey. + +“But as app requirements for compute have continued to grow, hardware accelerators including GPUs, FPGAs, specialized NICs have been developed for processing workloads that could be offloaded from the CPU.  By leveraging these accelerators, organizations can improve performance for the offloaded activities and free up CPU cycles for core app-processing work.” + +A key component of Monterey is VMware’s SmartNIC which incorporates a general-purpose CPU, out-of-band management, and virtualized device features. As part of Monterey, VMware has enabled its ESXi hypervisor to run on its SmartNICs which will let customers use a single management framework to manage all their compute infrastructure whether it be virtualized or bare metal. + +The idea is that by supporting SmartNICs, VCF will be able to maintain compute virtualization on the server CPU while offloading networking and storage I/O functions to the SmartNIC CPU. Applications can then make use of the available network bandwidth while saving server CPU cycles that will improve application performance, Colbert stated. + +As for security, each SmartNIC can run a stateful firewall and an advanced security suite. + +“Since this will run in the NIC and not in the host, up to thousands of tiny firewalls will be able to be deployed and automatically tuned to protect specific application services that make up the application--wrapping each service with intelligent defenses that can shield any vulnerability of that specific service,” Colbert stated. “Having an ESXi instance on the SmartNIC provides greater defense-in-depth. Even if the x86 ESXi is somehow compromised, the SmartNIC ESXi can still enforce proper network security and other security policies.” + +Part of the Monterey rollout included a broad development agreement between VMware and GPU giant Nvidia to bring its BlueField-2 data-processing unit (DPU) and other technologies into Monterey.  The BlueField-2 offloads network, security, and storage tasks from the CPU. + +Nvidia DPUs can run a number of tasks, including network virtualization, load balancing, data compression, packet switching and encryption today across two ports, each carrying traffic at 100Gbps. “That’s an order of magnitude faster than CPUs geared for enterprise apps. The DPU is taking on these jobs so CPU cores can run more apps, boosting vSphere and data-center efficiency,” according to an Nvidia blog “As a result, data centers can handle more apps, and their networks will run faster, too.” + +In addition to the Monterey agreement, VMware and Nvidia said they would work together to develop an enterprise platform for AI applications.  Specifically, the companies said GPU-optimized AI software available on the [Nvidia NGC hub][3] will be integrated into VMware vSphere, VMware Cloud Foundation and VMware Tanzu. + +[Now see how AI can boost data-center availability and efficiency][4] + +This will help accelerate AI adoption, letting customers extend existing infrastructure to support AI and manage all applications with a single set of operations. + +Intel and Pensando announced SmartNIC technology integration as part of Project Monterey, and  Dell Technologies, HPE and Lenovo said they, too, would support integrated systems based on Project Monterey. + +Project Monterey is a technology preview at this point and VMware did not say when it expects to deliver it. + +Join the Network World communities on [Facebook][5] and [LinkedIn][6] to comment on topics that are top of mind. + +-------------------------------------------------------------------------------- + +via: https://www.networkworld.com/article/3583990/vmware-plan-disaggregates-servers-offloads-network-virtualization-and-security.html + +作者:[Michael Cooney][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.networkworld.com/author/Michael-Cooney/ +[b]: https://github.com/lujun9972 +[1]: https://www.networkworld.com/newsletters/signup.html +[2]: https://blogs.vmware.com/vsphere/2020/09/announcing-project-monterey-redefining-hybrid-cloud-architecture.html +[3]: https://www.nvidia.com/en-us/gpu-cloud/ +[4]: https://www.networkworld.com/article/3274654/ai-boosts-data-center-availability-efficiency.html +[5]: https://www.facebook.com/NetworkWorld/ +[6]: https://www.linkedin.com/company/network-world diff --git a/sources/talk/20201002 VMware highlights security in COVID-era networking.md b/sources/talk/20201002 VMware highlights security in COVID-era networking.md new file mode 100644 index 0000000000..9cc050ddf6 --- /dev/null +++ b/sources/talk/20201002 VMware highlights security in COVID-era networking.md @@ -0,0 +1,85 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (VMware highlights security in COVID-era networking) +[#]: via: (https://www.networkworld.com/article/3584412/vmware-highlights-security-in-covid-era-networking.html) +[#]: author: (Michael Cooney https://www.networkworld.com/author/Michael-Cooney/) + +VMware highlights security in COVID-era networking +====== +VMware is tackling the challenges of securing distributed enterprise resources with product enhancements including the new Carbon Black Cloud Workload software and upgrades to its SD-WAN and SASE products. +ArtyStarty / Getty Images + +As enterprise workloads continue to move off-premises and employees continue to work remotely during the COVID-19 pandemic, securing that environment remains a critical challenge for IT. + +At its virtual VWworld 2020 gathering, VMware detailed products and plans to help customers deal with the challenges of securing distributed enterprise resources. + +**More about SD-WAN**: [How to buy SD-WAN technology: Key questions to consider when selecting a supplier][1] • [What SD-Branch is and why you'll need it][2] • [What are the options for securing SD-WAN?][3] + +"Amid global disruption, the key to survival for many companies has meant an accelerated shift to the cloud and, ultimately, bolting on security products in their data centers," said Sanjay Poonen, VMware's Chief Operating Officer, Customer Operations. "But legacy security systems are no longer sufficient for organizations that are using the cloud as part of their computing infrastructure. It's time to rethink security for the cloud. Organizations need protection at the workload level, not just at the endpoint." + +With that in mind, VMware introduced Carbon Black Cloud Workload software that combines vulnerability reporting with security detection and response capabilities to protect workloads running in virtualized, private and hybrid cloud environments, VMware stated.    + +The new packages – along with [other upgrades to its security software][4] – represent VMware's continued development and integration of the Carbon Black security technology it [acquired a year ago][5] for $2.1 billion.  + +"Tightly integrated with vSphere, VMware Carbon Black Cloud Workload provides agentless security that alleviates installation and management overhead and consolidates the collection of [telemetry][6] for multiple workload security use cases," VMware stated.  + +The idea is to allow security and infrastructure teams to automatically secure new and existing workloads at every point in the security lifecycle, while simplifying operations and consolidating the IT and security stack. With the software, customers can analyze attacker behavior patterns over time to detect and stop never-seen-before attacks, including those manipulating known-good software. If an attacker bypasses perimeter defenses, security teams can shut down the attack before it escalates to a data breach, VMware stated.  + +All current vSphere 6.5 and VMware Cloud Foundation 4.0 customers can give the package a try for free for the next six months, VMware stated. VMware plans to introduce a Carbon Black Cloud module for hardening and better securing Kubernetes workloads as well. + +The company also enhanced its Workspace ONE platform that securely manages end users' mobile devices and cloud-hosted virtual desktops and applications from the cloud or on-premise. + +The company says it blended VMware Workspace ONE Horizon and VMware Carbon Black Cloud to offer behavioral detection to protect against ransomware and file-less malware. On VMware vSphere, the solution is integrated into VMware Tools, removing the need to install and manage additional security agents, according to the company.  + +Bolstering support for Apple Mac and Microsoft Windows 10 remote users, VMware added Workspace Security Remote, which includes the antivirus, audit and remediation, and detection and response capabilities of Carbon Black Cloud. It also includes the analytics, automation, device health, orchestration, and zero-trust access capabilities of the Workspace ONE platform. + +Securing the remote work environment is a common theme among other VMWare announcements, including news around its [SD-WAN and secure access service edge (SASE)][7] products and its overarching Virtual Cloud Network architecture. + +Taken together, the enhancements further VMware's goal of integrating security features within its infrastructure – a concept it calls intrinsic security – in an effort to better protect networked workloads than traditional piecemeal protection systems could. + +The democratization of compute was already underway before the COVID situation pushed it further, faster, said Sanjay Uppal, senior vice president and general manager of the VeloCloud Business Unit at VMware. "So with the remote workforce growing we need to make privacy and security drop-dead simple, and that is the goal." + +A more futuristic goal for the company is to provide a unified approach to security incident detection and response that can leverage multiple domains – from endpoint to workload to user to network. An emerging architecture that promises those capabilities is Extended Detection and Response (XDR), and VMware says it intends to support it.  + +In a recent _[CSO][8]_ [column][8], Enterprise Strategy Group senior principal analyst Jon Oltsik defined XDR as "an integrated suite of security products spanning hybrid IT architectures, designed to interoperate and coordinate on threat prevention, detection and response. In other words, XDR unifies control points, security telemetry, analytics, and operations into one enterprise system." + +ESG research indicates that 84% of organizations are actively integrating security technologies so XDR can act as a turnkey security technology integration solution.  + +"While vendors will offer different XDR bundles, ESG research indicates that large organizations really want XDR to include endpoint/server/cloud workload security, network security, coverage of the most common threat vectors (i.e., email/web), file detonation (i.e., sandboxing), threat intelligence, and analytics," Oltsik stated. + +Gartner said of XDR: "Although XDR tools are similar in function to security incident and event monitoring (SIEM) and security orchestration, automation and response tools, they are primarily differentiated by the level of integration at deployment and the focus on incident response." + +The primary goals of an XDR solution are to increase detection accuracy by correlating threat intelligence and signals across multiple security solutions, and to improve security operations efficiency and productivity. + +For its part, VMware said XDR is the opportunity to do just that: provide a unified approach to security incident detection and response that can leverage multiple domains from endpoint to workload to user to network. + +VMware called XDR "a multi-year effort to build the most advanced and comprehensive security incident detection and response solutions available" and will include cross-platform integration across its portfolio including Workspace ONE, vSphere, Carbon Black Cloud, and NSX Service-defined Firewall. + +Join the Network World communities on [Facebook][9] and [LinkedIn][10] to comment on topics that are top of mind. + +-------------------------------------------------------------------------------- + +via: https://www.networkworld.com/article/3584412/vmware-highlights-security-in-covid-era-networking.html + +作者:[Michael Cooney][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.networkworld.com/author/Michael-Cooney/ +[b]: https://github.com/lujun9972 +[1]: https://www.networkworld.com/article/3323407/sd-wan/how-to-buy-sd-wan-technology-key-questions-to-consider-when-selecting-a-supplier.html +[2]: https://www.networkworld.com/article/3250664/lan-wan/sd-branch-what-it-is-and-why-youll-need-it.html +[3]: https://www.networkworld.com/article/3285728/sd-wan/what-are-the-options-for-securing-sd-wan.html +[4]: https://www.networkworld.com/article/3529369/vmware-amps-up-its-cloud-and-data-center-security.html +[5]: https://www.networkworld.com/article/3445383/vmware-builds-security-unit-around-carbon-black-tech.html +[6]: https://www.networkworld.com/article/3575837/streaming-telemetry-gains-interest-as-snmp-reliance-fades.html +[7]: https://www.networkworld.com/article/3583939/vmware-amps-up-security-for-network-sase-sd-wan-products.html +[8]: https://www.csoonline.com/article/3561291/what-is-xdr-10-things-you-should-know-about-this-security-buzz-term.html +[9]: https://www.facebook.com/NetworkWorld/ +[10]: https://www.linkedin.com/company/network-world diff --git a/sources/talk/20201007 Telcos Move from Black boxes to Open Source.md b/sources/talk/20201007 Telcos Move from Black boxes to Open Source.md new file mode 100644 index 0000000000..d517aa4842 --- /dev/null +++ b/sources/talk/20201007 Telcos Move from Black boxes to Open Source.md @@ -0,0 +1,92 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Telcos Move from Black boxes to Open Source) +[#]: via: (https://www.linux.com/interviews/telcos-move-from-black-boxes-to-open-source/) +[#]: author: (Swapnil Bhartiya https://www.linux.com/author/swapnil/) + +Telcos Move from Black boxes to Open Source +====== + +*Linux Foundation Networking (LFN) organized its first virtual event last week and we sat down with Arpit Joshipura, the General Manager of Networking, IoT and Edge at the Linux Foundation, to talk about the key points of the event and how LFN is leading the adoption of open source within the telco space. * + +**Swapnil Bhartiya: Today, we have with us Arpit Joshipura, General Manager of Networking, IoT and Edge, at the Linux Foundation. Arpit, what were some of the highlights of this event? Some big announcements that you can talk about?** + +**Arpit Joshipura:** This was a global event with more than 80 sessions and was attended by attendees from over 75 countries. The sessions were very diverse. A lot of the sessions were end-user driven, operator driven as well as from our vendors and partners. If you take LF Networking and LFH as two umbrellas that are leading the Networking and Edge implementations here, we had a very significant announcement. I would probably group them into 5 main things: + +Number one, we released a white paper at the Linux Foundation level where we had a bunch of vertical industries transformed using open source. These are over 100-year-old industries like telecom, automotive, finance, energy, healthcare, etc. So, that’s kind of one big announcement where vertical industries have taken advantage of open source. + +The second announcement was easy enough: Google Cloud joins Linux Foundation Networking as a partner. That announcement comes on the basis of the telecom market and the cloud market converging together and building on each other. + +The third major announcement was a project under LF Networking. If you remember, two years ago, a project collaboration with GSMA was started. It was called CNTT, which really defined and narrowed the scope of interoperability and compliance. And we have OPNFV under LFN. What we announced at Open Networking and Edge summit is the two projects are going to come together. This would be fantastic to a global community of operators who are simplifying the deployment and interoperability of implementation of NFVI manual VNFs and CNFs. + +The next announcement was around a research study that we released on open source code that was created by Linux Foundation Networking, using LFN analytics and COCOMO estimation. We’re talking $7.2 billion worth of IP investment, right? This is the power of shared technology. + +And finally, we released a survey on the Edge community asking them, “Why are you contributing to open source?” And the answer was fascinating. It was all-around innovation, speed to deployment, market creation. Yes, cost was important, but not initially. + +So those were the 5 big highlights of the show from an LFN and LFH perspective. + +**Swapnil Bhartiya: There are two things that I’m interested in. One is the consolidation that you talk about, and the second is survey. The fact is that everybody is using open source. There is no doubt about it. But the problem that is happening is since everybody’s using it, there seems to be some gap between the awareness of how to be a good open source citizen as well. What have you seen in the telco space?** + +**Arpit Joshipura:** First of all, 5 years ago, they were all using black box and proprietary technologies. Then, we launched a project called OpenDaylight. And of course, OpenDaylight announced its 13th release today, but that’s kind of on their 6-year anniversary from being proprietary to today in one of the more active projects called ONAP. The telcos are 4 of the Top 10 contributors of source code and open source, right? Who would have imagined that an AT&T, Verizon, Amdocs, DT, Vodafone, and a China mobile and a China telecom, you name it are all actively contributing code? So that’s a paradigm shift in terms of not only consuming it, but also contributing towards it. + +**Swapnil Bhartiya: And since you mentioned ONAP, if I’m not wrong, I think AT&T released its own work as E-com. And then the projects within the Foundation were merged to create ONAP. And then you mentioned actually NTD. So, what I want to understand from you is how many projects are there that you see within the Foundation? The problem is that Linux Foundation and all those other foundations are open servers. It’s a very good place for those products to come in. It’s obvious that there will be some projects that will overlap. So what is the situation right now? Where do you see some overlap happening and, at the same time, are there still gaps that you need to fill?** + +**Arpit Joshipura:** So that’s a question of the philosophies of a foundation, right? I’ll start off with the most loose situation, which is GitHub. Millions and millions of projects on GitHub. Any PhD student can throw his code on GitHub and say that’s open source and at the end of the day, if there’s no community around it, that project is dead. Okay. That’s the most extreme scenario. Then, there are foundations like CNCF who have a process of accepting projects that could have competing solutions. May the best project win. + +From an LF Networking and LFH perspective, the process is a little bit more restrictive: there is a formal project life cycle document and a process available on the Wiki that looks at the complementary nature of the project, that looks at the ecosystem, that looks at how it will enable and foster innovation. Then based on that, the governing board and the neutral governance that we have set up under the Linux Foundation, they would approve it. + +Overall, it depends on the philosophy for LFN and LFH. We have 8 projects each in the umbrella, and most of these projects are quite complementary when it comes to solving different use cases in different parts of the network. + +**Swapnil Bhartiya: Awesome. Now, I want to talk about 5G a bit. I did not hear any announcements, but can you talk a bit about what is the word going on to help the further deployment of 5G technologies?** + +**Arpit Joshipura:** Yeah. I’m happy and sad to say that 5G is old news, right? The reality is all of the infrastructure work on 5G already was released earlier this year. So ONAP Frankfurt release, for example, has a blueprint on 5G slicing, right? All the work has been done, lots of blueprint and Akraino using 5G and mech. So, that work is done. The cities are getting lit up by the carriers. You see announcements from global carriers on 5G deployments. I think there are 2 missing pieces of work remaining for 5G. + +One is obviously the O-RAN support, right? The O-RAN software community, which we host at the Linux Foundation also is coming up with a second release. And, all the support for 5G is in there. + +The second part of 5G is really the compliance and verification testing. A lot of work is going into CMTT and OPN and feed. Remember that merge project we talked about where 5G is in context of not just OpenStack, but also Kubernetes? So the cloud-native aspects of 5G are all being worked on this year. I think we’ll see a lot more cloud-native 5G deployments next year primarily because projects like ONAP or cloud native integrate with projects like ONAP and Anthos or Azure stack and things like that. + +**Swapnil Bhartiya: What are some of the biggest challenges that the telco industry is facing? I mean, technically, no externalization and all those things were there, but foundations have solved the problem. Some rough ideas are still there that you’re trying to resolve for them.** + +**Arpit Joshipura:** Yeah. I think the recent pandemic caused a significant change in the telcos’ thinking, right? Fortunately, because they had already started on a virtualization and open-source route, you heard from Android, and you heard from Deutsche Telekom, and you heard from Achronix, all of the operators were able to handle the change in the network traffic, change in the network, traffic direction, SLS workloads, etc., right? All because of the _softwarization_ as we call it on the network. + +Given the pandemic, I think the first challenge for them was, can the network hold up? And the answer is, yes. Right? All the work-from-home and all these video recordings, we have to hang out with the web, that was number one. + +Number two is it’s good to hold up the network, but did I end up spending millions and millions of dollars for operational expenditures? And the answer to that is no, especially for the telcos who have embraced an open-source ecosystem, right? So people who have deployed projects like SDN or ONAP or automation and orchestration or closed-loop controls, they automatically configure and reconfigure based on workloads and services and traffic, right? And that does not require manual labor, right? Tremendous amounts of costs were saved from an opex perspective, right? + +For operators who are still in the old mindset have significantly increased their opex, and what that has caused is a real strain on their budget sheets. + +So those were the 2 big things that we felt were challenges, but have been solved. Going forward, now it’s just a quick rollout/build-out of 5G, expanding 5G to Edge, and then partnering with the public cloud providers, at least, here in the US to bring the cloud-native solutions to market. + +**Swapnil Bhartiya: Awesome. Now, Arpit, if I’m not wrong, LF Edge is I think, going to celebrate its second anniversary in January. What do you feel the product has achieved so far? What are its accomplishments? And what are some challenges that the project still has to tackle?** + +**Arpit Joshipura:** Let me start off with the most important accomplishment as a community and that is terminology. We have a project called State of the Edge and we just issued a white paper, which outlines terminology, terms and definitions of what Edge is because, historically, people use terms like thin edge, thick edge, cloud edge, far edge, near edge and blah, blah, blah. They’re all relative terms. Okay. It’s an edge in relation to who I am. + +Instead of that, the paper now defines absolute terms. If I give you a quick example, there are really 2 kinds of edges. There’s a device edge, and then there is a service provider edge. A device edge is really controlled by the operator, by the end user, I should say. Service provider edge is really shared as a service and the last mile typically separates them. + +Now, if you double click on each of these categories, then you have several incarnations of an edge. You can have an extremely constrained edge, microcontrollers, etc., mostly manufacturing, IIoT type. You could have a smart device edge like gateways, etc. Or you could have an on-prem silver type device edge. Either way, an end user controls that edge versus the other edge. Whether it’s on the radio-based stations or in a smart central office, the operator controls it. So that’s kind of the first accomplishment, right? Standardizing on terminology. + +The second big Edge accomplishment is around 2 projects: Akraino and EdgeX Foundry. These are stage 3 mature projects. They have come out with significant [results]. Akraino, for example, has come out with 20 plus blueprints. These are blueprints that actually can be deployed today, right? Just to refresh, a blueprint is a declarative configuration that has everything from end to end to solve a particular use case. So things like connected classrooms, AR/VR, connected cars, right? Network cloud, smart factories, smart cities, etc. So all these are available today. + +EdgeX is the IoT framework for an industrial setup, and that’s kind of the most downloaded. Those 2 projects, along with Fledge, EVE, Baetyl, Home Edge, Open Horizon, security advanced onboarding, NSoT, right? Very, very strong growth over 200% growth in terms of contributions. Huge growth in membership, huge growth in new projects and the community overall. We’re seeing that Edge is really picking up great. Remember, I told you Edge is 4 times the size of the cloud. So, everybody is in it. + +**Swapnil Bhartiya: Now, the second part of the question was also some of the challenges that are still there. You talked about accomplishment. What are the problems that you see that you still think that the project has to solve for the industry and the community?** + +**Arpit Joshipura:** The fundamental challenge that remains is we’re still working as a community in different markets. I think the vendor ecosystem is trying to figure out who is the customer and who is the provider, right? Think of it this way: a carrier, for example, AT&T, could be a provider to a manufacturing factory, who actually could consume something from a provider, and then ship it to an end user. So, there’s like a value shift, if you may, in the business world, on who gets the cut, if you may. That’s still a challenge. People are trying to figure out, I think people who are going to be quick to define, solve and implement solutions using open technology will probably turn out to be winners. + +People who will just do analysis per analysis will be left behind like any other industry. I think that is kind of fundamentally number one. And number two, I think the speed at which we want to solve things. The pandemic has just accelerated the need for Edge and 5G. I think people are just eager to get gaming with low latency, get manufacturing, predictive maintenance with low latency, home surveillance with low latency, connected cars, autonomous driving, all the classroom use cases. They should have been done next year, but because of the pandemic, it just got accelerated. +-------------------------------------------------------------------------------- + +via: https://www.linux.com/interviews/telcos-move-from-black-boxes-to-open-source/ + +作者:[Swapnil Bhartiya][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://www.linux.com/author/swapnil/ +[b]: https://github.com/lujun9972 diff --git a/sources/talk/20201010 5 qualities of great open source developer advocates.md b/sources/talk/20201010 5 qualities of great open source developer advocates.md new file mode 100644 index 0000000000..e8c7e8d9f5 --- /dev/null +++ b/sources/talk/20201010 5 qualities of great open source developer advocates.md @@ -0,0 +1,91 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (5 qualities of great open source developer advocates) +[#]: via: (https://opensource.com/article/20/10/open-source-developer-advocates) +[#]: author: (Jason Blais https://opensource.com/users/jasonblais) + +5 qualities of great open source developer advocates +====== +Whether you're looking to hire a developer advocate or become one, here +are the qualities to aim for. +![Women talking][1] + +The developer relations job category is less than 10 years old, and [the developer advocate role is even newer][2]. In essence, developer advocates represent the voice of the user—in this case, that's usually the developer—internally to the company and the voice of the company externally to the community. + +[Mattermost][3] depends on its developer advocates to be the bridge between the community and the organization. At Mattermost, a developer advocate's three primary areas of responsibility are: + + * Raising awareness among developers about the open source project, including educating users and helping them get the most out of the platform + * Building strong relationships with users across open source and developer communities + * Advocating for users internally with the product team by sharing the community's feedback and challenges + + + +Not everyone is cut out to succeed as an open source developer advocate. With that in mind, here are the top five qualities we've identified in outstanding developer advocates. + +### 1\. A genuine passion for helping others + +Developer advocates often start as developers or in other highly technical roles. They excel at their job but get less pleasure from creating solutions than they do by helping others do the same. + +Over time, they turn this enthusiasm into enabling and empowering other developers to be successful. They naturally evolve into developer advocates by educating and helping users get the most out of the platforms they're working with. + +Passion is one of the most important qualities of a developer advocate. To advocate for the user both internally and externally, they must put the user and the community first. This does not happen without genuine motivation to help others succeed. + +### 2\. An authentic communication style + +An outstanding developer advocate has a passion for writing and talking about technology—whether they're solving technical challenges, providing knowledge about specific frameworks (e.g., Kubernetes), or sharing solutions built on top of a platform. + +But when they share their knowledge, they must be careful not to be perceived as promoting a specific platform or product. If any group is turned off by inauthentic marketing, [it is developers][4]. Developer relations is [not the same as developer marketing][5]. That is why authenticity is critical when connecting with developer communities—particularly in open source. + +Combining these creates an authentic communicator who captures developers' attention and pulls people in. That engagement enables them to raise awareness, educate to help users get the most out of the platform, and build strong relationships with users—the three main areas that developer advocates own. + +### 3\. A natural flair for building relationships + +Developer advocates are typically extroverts. Through their authenticity and passion for helping others, they can build strong relationships with users and members of the community. + +The truly outstanding advocates have a natural flair for creating connections through their superb networking skills. They also know where the communities exist, whether it's Reddit, Twitter, meetup groups, forums, or chat channels. + +Why is having a natural flair for creating relationships so important? + +First, developer advocates bring their existing connections to developers and open source communities when they join a team. Second, they come in knowing the right social media and developer channels to reach developers and open source users. Finally, they create new relationships with community influencers and open source leaders that can give your platform an opportunity to grow rapidly. + +### 4\. A personal investment in the community + +As I mentioned, developer advocates are not only the advocates of users internally; they are also the voice of the company externally to the community. This allows them to develop their own personal brand and "street cred" that they will carry with them after they move on to another company or community. + +When a developer advocate cares about their personal brand and has a personal investment in what they do, they are typically more motivated. Not only are they responsible for cultivating the company's brand, but they are also putting their own reputation on the line. This can be frightening to some. But those who are brave and willing to personally commit have the edge needed to excel as a developer advocate. + +As a side note, developer advocates who are employed by the company they're advocating for should work as part of the community and put the community ahead of themselves. They must be willing to continuously learn from and with the community, be a team player, and never put their own brand ahead of the company or community. + +### 5\. Technical sharpness + +The final key attribute of great developer advocates is their technical sharpness. Are they knowledgeable about cutting-edge technologies, languages, and frameworks? Do they learn technologies and tools easily? Are they self-taught, self-resourced learners? + +Since other developers will look to them for guidance, it is important for developer advocates to be highly technical with several years of relevant experience in software development or DevOps. Without already being a developer (or otherwise highly technical), it would be difficult to really understand the developer mindset and know what tickles their curiosity. + +### Other characteristics + +These five qualities—a genuine passion for helping others, authentic communication capabilities, a natural flair for building relationships, a personal investment, and technical sharpness—are Mattermost's core characteristics in outstanding open source developer advocates. Are there any other must-have qualities I've missed? Let me know in the comments! + +_Thank you to Justin Reynolds for the valuable edits on this article._ + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/10/open-source-developer-advocates + +作者:[Jason Blais][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/jasonblais +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/conversation-interview-mentor.png?itok=HjoOPcrB (Women talking) +[2]: https://medium.com/@ashleymcnamara/what-is-developer-advocacy-3a92442b627c +[3]: http://mattermost.com/ +[4]: https://hackernoon.com/developer-marketing-allergies-authenticity-622014fdebfb +[5]: https://medium.com/@aspleenic/developer-relations-and-developer-marketing-they-arent-the-same-thing-35b896159825 diff --git a/sources/talk/20201016 Is open source a development model, business model, or something else.md b/sources/talk/20201016 Is open source a development model, business model, or something else.md new file mode 100644 index 0000000000..26e8cd7e02 --- /dev/null +++ b/sources/talk/20201016 Is open source a development model, business model, or something else.md @@ -0,0 +1,130 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Is open source a development model, business model, or something else?) +[#]: via: (https://opensource.com/article/20/10/open-source-supply-chain) +[#]: author: (Scott McCarty https://opensource.com/users/fatherlinux) + +Is open source a development model, business model, or something else? +====== +Instead of asking whether open source is a development model or a +business model, start thinking about it as a supply chain for your +products. +![Net catching 1s and 0s or data in the clouds][1] + +The term "open source" was coined in 1998 at a strategy session held by [Open Source Initiative][2] (OSI). The OSI maintains the [Open Source Definition][3] (OSD), which places mandates on the distribution terms of any software that claims to be open source. The OSI also maintains a curated list of official [open source licenses][4] that meet these guidelines. + +The OSD gives a clear definition of what open source software _is_, but doesn't provide much insight into how the adoption of open source affects a company's ability to build and deliver products or services that people want and need. Stated another way, there's still tremendous debate about the best ways to build a business based on open source. + +In this first of a multi-part series, I will lay the groundwork for understanding what products are, what product managers do, and how open source can be considered a supply chain. In future articles, I will go deeper into each of these topics, but I'll start by dissecting some common, but fundamentally confusing vocabulary. + +### Development model or business model? + +Open source adoption is common in products and solutions, but the verdict is out on what this truly means for product teams. Is open source a software development model or a business model? Even today, there are huge debates in open source circles. + +People who think of open source [as a development model][5] emphasize collaboration, the decentralized nature in which code is written, and the licenses under which that code is released. Those who think of open source [as a business model][6] discuss monetization through support, services, software-as-a-service, paid features, and even in the context of inexpensive marketing or advertising. While there are surely valid arguments on both sides, neither of these models has ever satisfied everyone. Perhaps it's because we've never fully considered open source in the historical context of software products and their practical construction. + +> Instead of thinking about open source as a development model or a business model, perhaps companies should think in terms of a supply chain from which they can purchase technology. + +A [supply chain][7] includes the organizations, people, activities, information, and resources needed to create any product or service. This includes products as simple as a wool coat or as complex as an open source software project with thousands of dependencies. In [_The Wealth of Nations_][8], the father of economics, [Adam Smith][9], describes the supply chain for a wool coat: + +> "The shepherd, the sorter of the wool, the wool-comber or carder, the dyer, the scribbler, the spinner, the weaver, the fuller, the dresser, with many others, must all join their different arts in order to complete even this homely production." + +![Wool coat supply chain][10] + +(Scott McCarty, [CC BY-SA 4.0][11]) + +Most of us probably haven't heard of the roles involved in the supply chain for a wool coat, but one thing is obvious: divisions of labor and collaboration are keys to a healthy supply chain, especially with open source. + +### Product or project? + +If you accept that open source is a supply chain for building solutions, this leads to another misunderstanding around projects and products. Paul Cormier, Red Hat's CEO, makes a pragmatic distinction between [open source _projects_ and open source _products_][12]. While I agree with Paul, I am obliged to confess that most of the world doesn't recognize this crisp distinction. In 20 years of conversations with customers, partners, users, contributors, analysts, journalists, and even my own family, most people use the words _project_ and _product_ interchangeably. + +I'll attempt to bring clarity by proposing a simple definition: Products are things that people buy with currency, while projects are things people participate in, contribute to, or use. That gets part of the way to a better definition, but to truly understand, you need to define what a product _is_ in order to clearly see what a project _isn't_. + +Software products, like any other products or services, have a whole host of activities required to bring them to market. They have business plans, pricing and packaging, positioning and messaging, distribution strategies, sales enablement, portfolio alignment, build/buy/partner decisions, and roadmaps. The teams managing these products conduct focus groups, analyze addressable markets, brief journalists and analysts about how their products fit into the marketplace, walk customers through roadmaps, and, most importantly, define those roadmaps based on the needs of paying customers. Product teams spend a lot of time and money understanding their customers' problems, but this is rarely the work output of community members. + +Product teams have a fundamental choice about which suppliers they use in their products. This could mean using two, three, four, or even 10 different upstream projects in a product. It could also mean switching upstream projects when they no longer meet the needs of the customers buying the product. Finally, it could also mean positioning a partner's solution or different parts of the product portfolio to fill in gaps (i.e., address customer needs with solutions). The product team can also decide to use open source as one part of the supply chain and proprietary software as another part, thereby differentiating the product from the project. They can even make their product available only as a service; this is the power of pricing and packaging. + +Nearly all products are built by adding a layer of differentiated value to a set of commodity components that are provided by suppliers. This is true, whether they're built on open source or proprietary components. Stated another way, upstream suppliers cannot provide the same solution as downstream products. When upstream projects and downstream products tackle the exact same business problem, there is low differentiation, which creates challenges. This is akin to upstream suppliers and the downstream product company both selling tires—the upstream supplier needs to sell tires, and the downstream product company needs to sell vehicles. + +> A lack of differentiation between the supply-chain components and the downstream product is where open source companies run into problems. + +Everyday, product teams have to make pricing, packaging, build, buy, partner, and roadmap decisions driven by paying customers. This is what provides differentiation to a product and makes it fundamentally different from a community-driven, open source project. + +### Buying from the open source supply chain + +Open source technology is free as in speech, not "free as in beer." Anyone can download and use open source software pretty much however they want, but as soon as you sell a product that uses open source, you have a responsibility to the customer. That responsibility includes things like verifying the software is always patched, secure, and runs well. A product team has a commitment to the customers and is responsible for every component chosen in the supply chain. + +![Stephen Walli tweet about open source business models][13] + +(Scott McCarty, [CC BY-SA 4.0][11]) + +Stated another way, building a product on open source software is not free. It costs [either time or money][14], and everyone knows time is money, so these are essentially the same thing. Therefore, it's genuinely correct to use the word "buy" to describe the relationship between product teams and the upstream open source projects that supply technology for those products. + +From the perspective of the product team, each upstream project can be thought of as a supplier. The product team can "buy" from the open source suppliers by contributing the time and energy of engineers, documentation writers, testers, etc. Since time is money, every hour spent on upstream work can be measured in dollars. + +This cost of consuming from the open source supply chain exists whether your organization is selling a _product_ based on open source or building a _solution_ for internal consumption. Building anything on open source comes with an implicit responsibility for the components selected and used. But, unlike a traditional supply chain, a dollar may not be a dollar (fill in your currency of choice). + +Every dollar invested in an open source supply chain purchase might return $2, $3, or even $10 of value in return. The return on investment can be higher because other people and companies are also contributing value, as well as a diversity of ideas. Everyone who consumes from an open source supply chain inherits the total value. If the community is healthy, the value received is far above and beyond the contributions made. + +There's another hidden benefit to purchasing from open source suppliers. Unlike traditional suppliers, community-driven, open source projects are not profit-driven entities with sales, marketing, and go-to-market costs. This is akin to buying from non-profit entities, but, once again, it's not "free as in beer." There's definitely a cost associated with purchasing from an open source supply chain and, in turn, providing a product to your customers. + +### A better metaphor for products + +Perhaps no one has ever taken a product-centric view of open source because it grew up alongside the internet and the dot-com boom. This was a time of throwing money at ideas without having much of a business plan. Attempts to apply traditional business understanding _post facto_ have led to debate over the definition of open source versus [open core][15], as well as the roles and responsibilities of product teams. The software industry, and open source, in particular, has been notoriously confused about aligning product management and upstream engineering. The blurry line between project and product has even led to misunderstandings about what features upstream projects should focus on versus the downstream products. + +Working as a member of the product team driving the roadmap for arguably the largest open source product in the world, Red Hat Enterprise Linux, I'd like to humbly propose a new paradigm within which to think about open source software: + +> **Open source is a supply chain model.** + +It's not a huge intellectual leap, but this has profound implications on discussions, debates, and cognitive load when thinking about products that leverage open source. + +### Capturing value with open source + +In recent years, arguments have been put forth asserting that there [can only ever be one Red Hat][16]; the narrative implies that only one company can grow into a multi-billion dollar business by selling support. This narrative is problematic because Red Hat doesn't make money from support, and it might even be argued that [Red Hat Network][17] was the first SaaS of open source. Second, other companies like SUSE, Cloudera, and Chef have captured quite a bit of value. Finally, many businesses start with a SaaS model and extend into adjacent on-premises businesses, like [CloudBees][18]. + +All of these companies have been able to successfully use open source as a supply chain to create value while simultaneously capturing value by satisfying complex business problems that are not solved by the upstream project alone. Fundamentally, SaaS and hardware/software combinations are no different, although it might be argued that they are easier to monetize. + +Fellow product managers, I urge you to start thinking about open source projects as a supply chain for your products. It will give you new clarity in making product-driven decisions and focusing on business needs instead of technology. With all supply chains, product managers have to treat their suppliers fairly. For example, downstream product teams can't tell upstream suppliers what to do. Downstream product teams also have to pay suppliers enough to keep them in business and continue to supply technology. These are just two examples of the clarity that comes from treating upstream, open source projects as suppliers, and it keeps the relationship much healthier. + +![Linux supply chain][19] + +(Scott McCarty, [CC BY-SA 4.0][11]) + +There's a saying in music: _It's not the notes you play, but the notes you don't play._ Constraints breed creativity. If you know you can't differentiate your product based on the code from your upstream suppliers, your product team has to get creative. You have to identify other value worth purchasing. I'll dig into this later in the series; in the next article, I'll add clarity to the scope of what an open source product is and how to create value with it. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/10/open-source-supply-chain + +作者:[Scott McCarty][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/fatherlinux +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/data_analytics_cloud.png?itok=eE4uIoaB (Net catching 1s and 0s or data in the clouds) +[2]: https://opensource.org/ +[3]: https://opensource.org/osd +[4]: https://opensource.org/licenses/alphabetical +[5]: https://en.wikipedia.org/wiki/Open-source_model +[6]: https://opensource.com/article/17/12/open-source-business-models +[7]: https://en.wikipedia.org/wiki/Supply_chain +[8]: https://en.wikipedia.org/wiki/The_Wealth_of_Nations +[9]: https://en.wikipedia.org/wiki/Adam_Smith +[10]: https://opensource.com/sites/default/files/uploads/wool_coat_supply_chain.png (Wool coat supply chain) +[11]: https://creativecommons.org/licenses/by-sa/4.0/ +[12]: https://siliconangle.com/2019/05/10/red-hat-talks-project-vs-product-in-enterprise-open-source-rhsummit/ +[13]: https://opensource.com/sites/default/files/uploads/tweet.png (Stephen Walli tweet about open source business models) +[14]: https://twitter.com/stephenrwalli/status/1147205594966663168 +[15]: https://medium.com/open-consensus/2-open-core-definition-examples-tradeoffs-e4d0c044da7c +[16]: https://techcrunch.com/2014/02/13/please-dont-tell-me-you-want-to-be-the-next-red-hat/ +[17]: https://en.wikipedia.org/wiki/Red_Hat_Network +[18]: https://www.cloudbees.com/blog/enhanced-pricing-and-packaging-cloudbees-platform +[19]: https://opensource.com/sites/default/files/uploads/linux_supply_chain.png (Linux supply chain) diff --git a/sources/talk/20201021 How anyone can contribute to open source software in their job.md b/sources/talk/20201021 How anyone can contribute to open source software in their job.md new file mode 100644 index 0000000000..3ae4fbf8ca --- /dev/null +++ b/sources/talk/20201021 How anyone can contribute to open source software in their job.md @@ -0,0 +1,77 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How anyone can contribute to open source software in their job) +[#]: via: (https://opensource.com/article/20/10/open-your-job) +[#]: author: (Catherine Robson https://opensource.com/users/crobson) + +How anyone can contribute to open source software in their job +====== +Open your job, and you'll open opportunities for software developers to +build applications that meet your needs. +![Active listening in a meeting is a skill][1] + +Imagine a world where your software works perfectly for you. It meets your needs, does things your way, and is the ideal tool to achieve great things toward your goals. + +Open source software stems from these roots. Many projects are built by engineers that have a problem and build a solution to solve it. Then they openly share their solution with others to use and improve. + +Unfortunately, building software is hard. Not everyone has the expertise to build software that works perfectly for their needs. And if the software developers building applications don't fully understand users' needs and how they do their job, the solutions they build may not meet the users' needs and may accidentally create a lot of gaps. + +I recently encountered an example of this at my dentist's office. As I was waiting in the chair, I couldn't help but notice how long the dental hygienist was taking to punch around in the software to get ready for the dentist's examination. So I asked her, "Do you feel like this software meets your needs?" She replied, "No! It's so complex, and what I actually need is never where I need it!" + +Part of the problem is that the people who built this software are probably not dentists, dental hygienists, or have any experience with a dentist other than as a patient in the chair. Many software companies have roles to help fill those gaps—product managers, product and market analysts, researchers, and others are meant to help gather requirements that tell development teams what to build. + +But we all know about learning a new domain. There's learning it from the outside, casually understanding it; then there's learning it from the inside, living it day-to-day, and really knowing it as an expert. The closer the development team can get to the real, "living it" experience, the better decisions they will make when they build software for specific users and domains. + +Open source has an ethos of sharing the work being done. Now I think it is time to evolve open source to the next level: sharing work that _needs to be_ done. Domain experts (i.e., the eventual users) need to share information about what they need to do their job so that open source developers can build software to meet their needs. + +This might sound overwhelming if you're not a software developer. Contributing to open source means that you need to write code, understand [Git][2], or cross other technical hurdles, right? Not necessarily; contributing your domain expertise is an important part of open source development. + +And you can use the tools you already have. You're already on social media. You probably have access to a word processor of some kind. And you have a work environment that can be shared openly (even in COVID times, thanks to technology). + +### Three steps to opening your job + +The following steps can help you open your job so software developers can learn your domain, understand your job and pain points, and build software that works better for you. + +#### 1\. Invite software builders into your work environment + +An ethnographic study is where parts of the software team shadow you in your job. You'll be asked to do everything you normally do on a workday, just as you always do it. Like a "fly on the wall," the software team is there to observe and understand how you do what you do. They might debrief with you throughout the day to get more insights into why you did certain things. Overall, this is meant to be non-invasive for you but very informative for the team. + +#### 2\. Share writeups about your job with software builders + +Far too often in the software industry, we focus on the software, not its use. As an example, a software requirement may come in as: "Show the history of dental work done to a tooth." This assumes that the software is required to do this job and that this history is useful no matter where it's shown in the software. + +Instead, developers need to back up and make sure they understand the job functions thoroughly. For example, a requirement could say: "A patient has a tooth with a cavity that was found during routine cleaning. While the patient is still there, the dentist needs to know what else has been done to the tooth to be able to prescribe a solution to the patient." By knowing the job that needs to be done, the software developer can build software that enables easy selection of the tooth in question, mid-exam, with gloves on. Therefore, this information should be available while in the "routine cleaning" view. + +Writing up your intent and context while you're using the software, rather than the tasks you do, can help software developers build to meet your true needs. + +If you want to go deeper, look at the [Jobs To Be Done][3] (JTBD) framework as a way to convey your expertise to software teams. + +#### 3\. Use social media to share videos, explanations, and more about your job + +Use the social media platform of your choice (e.g., YouTube, Reddit, etc.) to share information about your job. Recording and sharing a "day in the life" video openly could greatly help development teams really understand what you do and how you do it so that they can create software that serves your needs. + +### Open opportunities + +Open your job, and you'll open opportunities for software developers to build better software! Let's bring open source to the next level together by sharing more about what you need. + +You don't need to be a master coder to contribute to open source. Jade Wang shares 8 ways you can... + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/10/open-your-job + +作者:[Catherine Robson][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/crobson +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/team-discussion-mac-laptop-stickers.png?itok=AThobsFH (Active listening in a meeting is a skill) +[2]: https://opensource.com/resources/what-is-git +[3]: https://www.google.com/books/edition/The_Jobs_To_Be_Done_Playbook/1vHRDwAAQBAJ?hl=en&gbpv=1&printsec=frontcover diff --git a/sources/talk/20201022 How to influence people to join open source.md b/sources/talk/20201022 How to influence people to join open source.md new file mode 100644 index 0000000000..caa1d02fbd --- /dev/null +++ b/sources/talk/20201022 How to influence people to join open source.md @@ -0,0 +1,89 @@ +[#]: collector: (lujun9972) +[#]: translator: (mengxinayan) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How to influence people to join open source) +[#]: via: (https://opensource.com/article/20/10/influence-open-source) +[#]: author: (Joshua Pearce https://opensource.com/users/jmpearce) + +How to influence people to join open source +====== +Giving people what they want is the most effective way to introduce +people to open source. +![pipe in a building][1] + +If you are reading Opensource.com, you might be able to code, and you are probably reading this on an open source browser on some elusive [Linux distro][2]. You probably have not seen a browser ad in years because you are running an [open source ad blocker][3]. You feel warm and fuzzy when you think about penguins. + +Simply, you know the power of the force of open source and have made it part of your life. Sadly, not everyone has found the open source way yet. Their computers are painfully slow; they see more ads than content when they surf the web; they spend their money on patented and copyrighted junk. Some of these people may even be related to you—take your nieces and nephews, for example. + +### Knowledge is wealth + +So, how do you introduce your nieces and nephews (and everyone else) to open source? + +I tried to answer this question and being a professor, a profession well known for being long-winded, I ended up with a book: [_Create, Share, and Save Money Using Open Source Projects_][4], published by McGraw-Hill + +The trick, I think, is finding something that your niece or nephew wants but doesn't have the money to buy, then showing them how open source knowledge can get them what they want. + +![Lift Standing Desk][5] + +[Lift Standing Desk][6] (Joni Steiner and Nick Ierodiaconou, [CC-BY-SA-NC][7]) + +Knowledge has a unique property among commodities. Unlike gold or wheat, it not only retains value when it is shared, but it can rapidly increase in value. The internet enables unlimited scaling of this process, as the price of information-sharing approaches zero. Everyone with internet access has historically unprecedented access to this wealth. For example, I provide [free links to repositories][4] with books, education, movies, how-tos, maps, music, photographs, art, software, and recipes. + +### Don't buy it, make it + +Free and open source is expanding further into the physical world, and we all have the opportunity to radically reduce the cost of just about everything you can buy at Walmart or Amazon, including [toys][8], [electronics][9], [household goods][10], and clothing. The combination of open source sharing and digital manufacturing—using 3D printers and similar tools—enables individuals to make their own complex, valuable products. + +![3D printed household items][11] + +[3D-printed household items][12] (Joshua M. Pearce, [CC BY-SA 3.0][13]) + +For years, scientists have been doing this [in their labs][14]. But now, anyone can easily customize products to fit their exact needs. There are already millions of free designs available. + +![Recyclebot][15] + +[Recyclebot][16] (Joshua M. Pearce, [GPLv3][17]) + +The way to really knock the bottom out of a product's price is to [source the raw materials from trash][18]. This is possible for a dizzying array of products because of recent improvements in small-scale recycling processes (like [Recyclebots][19], which I use in my lab) that enable people to make valuable products from waste. Best of all, anyone can get these green, custom creations for a small fraction of the cost of a proprietary system. We can normally produce a custom product for [less than the sales tax][20] on a conventional product—with the same functionality, a better, customized form, and almost no cost. + +### Learn more + +In _[Create, Share, and Save Money Using Open Source Projects][4],_ I share the potential in at-home manufacturing and recycling and even how to score free big-ticket items, including housing and electricity, with open source. You can also learn more about this on a webinar I recorded with Megan Krieger and Janet Callahan for Michigan Tech's [Husky Bites][21]. + +Hopefully, this knowledge is motivating enough to pull in a niece or nephew or two over to the open source way! + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/10/influence-open-source + +作者:[Joshua Pearce][a] +选题:[lujun9972][b] +译者:[萌新阿岩](https://github.com/mengxinayan) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/jmpearce +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/open_pipe_red_hat_tower_building.png?itok=8ho3yi7L (pipe in a building) +[2]: https://distrowatch.com/ +[3]: https://opensource.com/article/20/4/ad-blockers +[4]: https://www.appropedia.org/Create,_Share,_and_Save_Money_Using_Open-Source_Projects +[5]: https://opensource.com/sites/default/files/uploads/opendesk_furniture_lift-standing-desk.jpg (Lift Standing Desk) +[6]: https://www.appropedia.org/File:Opendesk_furniture_lift-standing-desk.jpg +[7]: https://creativecommons.org/licenses/by-nc-sa/2.0/ +[8]: http://www.mdpi.com/2227-7080/5/3/45 +[9]: https://doi.org/10.3390/inventions3030064 +[10]: https://www.mdpi.com/2227-7080/5/1/7 +[11]: https://opensource.com/sites/default/files/uploads/3dprinted_household.jpg (3D printed household items) +[12]: https://www.appropedia.org/File:3dprinted_household.JPG +[13]: https://creativecommons.org/licenses/by-sa/3.0/ +[14]: https://opensource.com/article/20/10/open-source-hardware-savings +[15]: https://opensource.com/sites/default/files/uploads/recyclebotrep.png (Recyclebot) +[16]: https://www.appropedia.org/File:Recyclebotrep.png +[17]: https://www.gnu.org/licenses/gpl-3.0.html +[18]: https://www.academia.edu/34738483/Tightening_the_Loop_on_the_Circular_Economy_Coupled_Distributed_Recycling_and_Manufacturing_with_Recyclebot_and_RepRap_3-D_Printing +[19]: https://www.appropedia.org/Recyclebot +[20]: https://opensource.com/article/17/3/how-to-create-consumer-goods-open-hardware +[21]: https://www.facebook.com/Michigan-Tech-College-of-Engineering-109353424030003/videos/husky-bites-presents-special-guest-joshua-m-pearce/2669023713361207/ diff --git a/sources/talk/20201023 Why it-s important to keep the cloud open.md b/sources/talk/20201023 Why it-s important to keep the cloud open.md new file mode 100644 index 0000000000..446eceb61b --- /dev/null +++ b/sources/talk/20201023 Why it-s important to keep the cloud open.md @@ -0,0 +1,87 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Why it's important to keep the cloud open) +[#]: via: (https://opensource.com/article/20/10/keep-cloud-open) +[#]: author: (Seth Kenlon https://opensource.com/users/seth) + +Why it's important to keep the cloud open +====== +An open cloud helps developers maintain autonomy and security while +taking advantage of the power and reach of the cloud. +![Sky with clouds and grass][1] + +There's a famous sticker featured on many laptop lids; it goes something like this: "the 'cloud' is just somebody else's computer." + +There's a lot of truth to that sentiment, but it's not exactly technically accurate. In fact, cloud computing isn't just somebody else's computer; it's somebody else's _hundreds and thousands_ of computers. + +Years ago, "the cloud" did indeed just refer to the simplified graphic in a flowchart, so the illustrator didn't have to try to accurately depict the multiple networks that comprise the World Wide Web. Now, however, the cloud isn't just describing traffic or small-time remote file storage offers. The cloud of today is a _platform_ of interconnected computational nodes working together to keep containerized Linux images, each running a distinct service (or "microservice" in developer lingo), functioning as applications distributed over the whole world. + +The cloud is a computer, no different in theory than the device you're reading this article on, but very different in construction. For instance, you don't own the cloud. You might wonder how such a concept can possibly be compatible with the idea of open source and free software, methods of computing in which the user famously owns the software they run. Surely you can't own software when you don't even own the device it's installed on? + +### Open source and the cloud + +For several years now, the Internet has been something of a software neutral zone. The model of the Internet isn't the same as "traditional" software in which there's a one-to-one, or maybe a one-per-family, relationship between the app and the user. The Internet is built of servers, which run services intended for multiple users. You sign up for an account on a site, and, in the best-case scenario, you more or less "own" your user account and data, but you don't own the site. You can't stop your Internet service and bring up the website on your computer. The software "lives" on a server somewhere. Even when the software is open source, such as WordPress or Drupal, and even if you download it and install it locally on your own computer, you still don't possess the instance you created an account on. + +For this reason, even users very conscious of the threat of non-open software tend to overlook the question of software on the Internet. It can be increasingly difficult to recognize the importance of open source when even popular open source projects are hosted on Github (which uses a non-open web stack), Slack, or Discord instead of [Mattermost][2] or [Matrix][3] for chat; Google Docs instead of [Etherpad][4] for collaboration; Trello instead of [Phabricator][5] for [project management][6]; Jira for bug tracking; Gmail for communication, and so on. For as much as open source has won within software development and server hosting, it seems to willingly lock itself inside proprietary infrastructure. + +### Why the cloud is so powerful + +The problem doesn't end with infrastructure. The reason open source projects are locking themselves into proprietary systems for support is that the cloud itself is the computer, and the computer powered by the cloud is a lot more powerful than any developer's workstation. Not only does it have more processing power, but it also has a greater reach. An application you develop to run on the cloud can serve millions of users without even one of them having to figure out how to download and install anything. Your users just launch a browser and use your app, on any device, without even worrying about whether their device is powerful enough for the task they need to be done. + +The cloud just makes sense, for computation, for delivery, and even for marketing. The problem is, it doesn't make any sense for open source. And that's why the cloud is no longer enough. The cloud needs to be upgraded to an open hybrid cloud. + +### What is an open hybrid cloud? + +When people talked about "the cloud" many years ago, it referred to the network serving as the computer. It was even then an old idea, but it was only just being realized. But because the network was the computer, the natural and correct assumption was that most users wouldn't own the computer; they'd only log in with client machines. And that's exactly the form it has taken—you own a device that browses to a cloud owned by Google, Microsoft, or Amazon. + +This came to be known as the public cloud because the infrastructure running the cloud is available to the general public. You can buy time on several public clouds, interact with it through Kubernetes, and develop apps for Linux containers. + +It didn't take long for individual companies to build private clouds—an infrastructure available only to their employees and clients. This ensured that important data remained under their control, and it often cost less than buying time on someone else's infrastructure. + +A hybrid cloud combines these two concepts—you maintain a private cloud for your own use, and you use a public cloud to provide services you can't run only privately. An open hybrid cloud is a hybrid cloud built on open source, whether it's OKD, OpenShift, Kubernetes, RHEL, Debian, Alpine, Podman, Docker, Ansible, or custom scripts. + +### Getting an open hybrid cloud + +The cloud is powerful, so it stands to reason that it can actually help solve a little problem like ensuring user independence. It doesn't happen overnight, though, and the proprietary cloud is already entrenched in services used by millions. So, as an open source enthusiast, what can you do to promote the open hybrid cloud? + +### Don't settle for closed clouds + +If you're a developer, seek out an open hybrid cloud when you're looking for a platform to build upon. If you can't find one within your price range and you can't build a small one, then support open stacks. Look at the services your project relies upon and make sure you can reimplement the stack, should you need to. + +### Use open source online + +As a user, look for [federated systems][7] for social media, and look for open source platforms like WordPress, Drupal, Nextcloud, Etherpad, EtherCalc, and others, for online collaboration. You're not running the instance you're using, but at least you know that the code is auditable and that you're not supporting an environment that forces developers to contribute to proprietary software. + +### Data liberation + +Whether or not the environment is open source, ensure that important data is secure and can be exported. We're well into the 21st century, so there's no excuse for a website to gather data about without proper encryption and no excuse to withhold your data from you. You should be able to export anything you put _into_ a site for your own backups. + +### Be open + +In an open hybrid cloud, you own your development environment and your data, and you maintain your autonomy the same way you do with a laptop running [Linux][8] or [BSD][9]. Cloud computing is the future. Let's work together to make sure the future is open. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/10/keep-cloud-open + +作者:[Seth Kenlon][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/seth +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/bus-cloud.png?itok=vz0PIDDS (Sky with clouds and grass) +[2]: http://mattermost.com +[3]: http://matrix.org +[4]: http://etherpad.org +[5]: https://www.phacility.com/phabricator/ +[6]: https://opensource.com/alternatives/trello +[7]: https://opensource.com/article/17/4/guide-to-mastodon +[8]: https://opensource.com/resources/linux +[9]: https://opensource.com/article/20/5/furybsd-linux diff --git a/sources/talk/20201027 How to define a product in the open source software supply chain.md b/sources/talk/20201027 How to define a product in the open source software supply chain.md new file mode 100644 index 0000000000..8a13a06eeb --- /dev/null +++ b/sources/talk/20201027 How to define a product in the open source software supply chain.md @@ -0,0 +1,75 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How to define a product in the open source software supply chain) +[#]: via: (https://opensource.com/article/20/10/defining-product-open-source) +[#]: author: (Scott McCarty https://opensource.com/users/fatherlinux) + +How to define a product in the open source software supply chain +====== +Differentiation is what makes a product successful. Learn more in part +two of this series on open source in the software supply chain. +![Gift box opens with colors coming out][1] + +In the first article in this series, "[Is open source a development model, business model, or something else?][2]" I introduced the concept that open source is part of the supply chain for software products. But to truly understand open source as a supply chain, you must have a decent understanding of what a product is. A product can be thought of as a business, and as legendary business guru [Peter Drucker][3] said, "The purpose of business is to create and keep a customer." Drucker's statement means a business or product must be useful enough to pay for, or it will fail. Product differentiation is the thing that creates and retains customers. + +### What's in a software product? + +Even in the stone age of 1999, when I started my career, the concept of software products existed—you could go to a store and purchase boxed copies of Red Hat Linux on compact discs (though floppies were still very much in use). The idea of software products existing might sound like a joke, and it is, but in the 1940s and 1950s (when computers, as we know them, were created), software was not a component of value that was bought and sold. There was no market for software. You couldn't buy it, sell it, or access it online. + +Instead of buying software, the choice was to build or buy a physical computer; with either option, you wrote the software yourself for that specific computer. + +> _That… specific… computer…_ + +No joke. In the early days of computers, software couldn't run anywhere except for the computer you wrote it on. In fact, in the early days, you couldn't even use the same programming language on two different computers. But, as computers evolved, system software, such as operating systems, assemblers, and compilers, were created. And with the advent of this system software, application code became more reusable and portable. + +In the 1960s, cross-platform compilers and operating systems led to the concept of reusable code, such as macros and eventually libraries. At the beginning of every project, you built your own reusable functions and libraries. (Computer science courses still force you to do this so that you learn what's going on behind the scenes.) Concurrently, processors and operating systems standardized, enabling portability between computers. + +In the early days, these components were used within single organizations (e.g., a government, university, company, etc.), but the desire to share software among organizations emerged quickly. If you're interested in understanding the history of code portability from the first computers to containers, see "Fatherlinux's" [Container portability][4] series or the [History of compiler construction][5] Wikipedia page. Suffice to say, code had to be portable before anyone could have software products, open source or even containers. + +### Reusable and portable software + +Once code became portable and shareable between organizations, the next logical step was to sell it. In these early days, having software that did _something useful_ was differentiating in the marketplace. This was a breakthrough because if you needed a calculator, a compiler, or a piece of word processing software, it became cheaper and easier to buy it than to write it. So software products were born. + +This model really only worked to tackle general-purpose problems that a lot of people share—things like calculating numbers, writing documents, or compiling software; these are business problems. General-purpose software is great, but it doesn't elegantly solve specific problems related to business rules within a single industry or organization, although you can abuse Excel or Google Sheets pretty hard. For specific business problems, it's more efficient to write custom code. This need led to the rise of middleware, things like Java, service buses, and databases. Middleware was bought and sold to assist with custom software development. + +Code portability led to a marketplace for software applications and middleware. Software companies began to provide competing solutions with differentiated value. You picked the compiler or the calculator that you wanted based on features. The existence of competing solutions was great for consumers because it drove software companies to create more specialized solutions, each with unique value. Whether a product is built on open source or not, it must provide unique value in the marketplace. + +### Understanding differentiated value + +To explain differentiated value, I'll use an analogy about automobiles. Families need cars, sport utility vehicles (SUVs), or minivans. They might want comfortable seats, infotainment systems, or safety features. They often have a preference on color. Each family is different and has specific needs, so the perfect automobile would be one that the family built together as a project. + +Most families don't have the time, desire, money, or credit to buy all of the components necessary to build the perfect car from scratch, much less the time to maintain it over a given lifecycle. It wouldn't be an economical investment of time or money for a family. It would cost them way more, and take a long time to build. Instead, families buy automobiles from existing vendors, as a built solution to their transportation problem. Although the bought car will be imperfect, it will approximately meet their needs with much less time and money invested. + +Automobile vendors put a solution together with undifferentiated and differentiated components. This includes everything from the motor, fuel injectors, tires, and seats in the car, to the buying experience at the dealership, the financing, and the service program while the car is owned. All of these features and experiences are a component of the solution that families buy when looking for an automobile. The combination of all these things is what produces something that is different and, hopefully, better in the marketplace. We call this _differentiation_. The more competing solutions, the more differentiation in the marketplace, and the better the chance that a family can find a car that matches their needs more approximately. + +### Differentiation in open source + +In a traditional manufactured product or service, there is a distinction between the value provided by the supplier and the value provided by the company selling directly to the consumer. You could make a further distinction between business-to-consumer (B2C) or business-to-business (B2B) products and services, but that's beyond the scope of this series. + +The astute reader may already be thinking, "yeah, but with traditional products, the suppliers are also companies selling products with differentiation." This is completely true, and in this way, open source projects are no different. Community-driven, open source projects don't have the advantage of expensive marketing campaigns, focus groups, and sales teams to educate customers, but they must also differentiate themselves in the marketplace. + +Differentiation is an important concept for product managers, developers, and even systems administrators. Even in a broader context, the output of any sort of knowledge work—code, writing, music, or art—differentiation is what brings value and meaning to our work. Differentiation is what creates value, whether it's a software product or service, labor, or even music. + +In the next article, I'll dive deeper into how software product teams differentiate their solutions from the open source components provided by their suppliers. We'll even cover software as a service (SaaS). + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/10/defining-product-open-source + +作者:[Scott McCarty][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/fatherlinux +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/OSDC_gift_giveaway_box_520x292.png?itok=w1YQhNH1 (Gift box opens with colors coming out) +[2]: https://opensource.com/article/20/10/open-source-supply-chain +[3]: https://en.wikipedia.org/wiki/Peter_Drucker +[4]: http://crunchtools.com/container-portability-part-1/ +[5]: https://en.wikipedia.org/wiki/History_of_compiler_construction diff --git a/sources/talk/20201028 A few things I-ve learned about email marketing.md b/sources/talk/20201028 A few things I-ve learned about email marketing.md new file mode 100644 index 0000000000..4918d3dd3e --- /dev/null +++ b/sources/talk/20201028 A few things I-ve learned about email marketing.md @@ -0,0 +1,139 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (A few things I've learned about email marketing) +[#]: via: (https://jvns.ca/blog/2020/10/28/a-few-things-i-ve-learned-about-email-marketing/) +[#]: author: (Julia Evans https://jvns.ca/) + +A few things I've learned about email marketing +====== + +Hello! I’ve been learning a lot about business over the last few years (it’s possible to make a living by helping people learn! it’s amazing!). One of the things I’ve found hardest to get my head around was email marketing. + +Like a lot of people, I get a lot of unwanted email, and at first I was really opposed to doing any kind of email marketing because I was worried I’d be the _source_ of that unwanted email. But I’ve learned how to do it in a way that feels good to me, and where the replies to my marketing emails are usually along the lines of “wow, I love this, thank you so much!”. ([literally: here are excerpts from the last 20 or so replies I’ve gotten][1]) + +I’m going to structure this as a series of beliefs I had about email marketing that turned out not to be universally true. + +### myth 1: selling things is an adversarial relationship + +I used to think that selling things was a sort of adversarial relationship: the person selling the product wants to convince the buyer (by any means necessary) to spend as much money as possible, and that people buying things are usually kind of resentful of anyone asking them to spend money. + +I’ve learned that actually a lot of people are happy (or even actively **want**) to spend money on something that will help them solve a problem they have. + +Here’s a silly example of something illustrating this: 2 years ago, we’d hired someone to paint our new apartment. We decided to paint a lot of the walls white, and we were stuck with the impossible problem of deciding which of the 10 billion possible shades of white to paint the walls. I found a $27 ebook called [white is complicated][2], and (long story short, this blog post is not about painting) it really helped me confidently choose a shade of white!! We spent thousands of dollars on painting, so $30 was a really good investment in making sure we’d be happy with the result. + +So even though $27 for an ebook on how to choose a white seems silly at first, I was really happy to spend the money, and my guess is a lot of other people who bought that ebook are as well. + +The bigger idea here is that it’s easier to run a business when you’re selling to people who are happy to buy things based on the value they’re getting from the product. In my case, I’ve found that there are lots of programmers who are happy to pay for clear, short, friendly explanations of concepts they need to understand for their jobs. + +### a quick note on how I learned these things: 30x500 + +I originally wrote this blog post about all these things I learned, and it kind of read like I figured out all of these things naturally over the course of running a business. But that’s not how it went at all! I’ve actually found it very hard to debug business problems on my own. A lot of the attitudes I had when I started out running a business were counterproductive (like thinking of selling something as an adversarial process), and I don’t know that many people who run similar businesses who I can get advice from. + +I learned how to think about selling things as a non-adversarial process (and everything else in this blog post, and a lot more) from [30x500][3], a business class by Amy Hoy ([her writing is here][4]) and [Alex Hillman][5] that I bought a couple of years ago. 30x500 is about running a specific kind of business (very briefly: sell to people who buy based on value, decide what to build by researching your audience, market by teaching people helpful things), which happens to be the exact kind of business that I run. It’s been a really great way to learn how to run my business better. + +Okay, back to my misconceptions about email marketing! + +### myth 2: sending email is inherently bad + +The next thing I believed was that sending email from a business was somehow inherently bad and that all marketing email was unwanted. + +I now realize this is untrue even for normal marketing emails – for example, lots of people subscribe to marketing newsletters for brands they like because they want to hear about new products when they come out & sales. + +But marketing emails aren’t just “not inherently bad”, they can actually be really useful! + +### marketing is about building trust + +When I started sending out business emails, I based them on the emails I was used to receiving – I’d announce new zines I’d written, and explain why the zine was useful. + +But what I’ve learned is that (at least for me) marketing isn’t about describing your product to the audience, **marketing is about building trust by helping people**. + +So, instead of just periodically emailing out “hey, here’s a new zine, here’s why it’s good”, my main marketing email list is called [saturday comics][6], and it sends you 1 email a week with a programming comic. + +What I like about this approach to marketing (“just help people learn things for free”) is that it’s literally just what I love doing anyway – I wrote this blog to help people learn things for free for years just because I think it’s fun to help people learn. + +And people love the Saturday Comics! And it makes money – I announce new zines to that list as well, and lots of people buy them. It’s really simple and nice! + +### myth 3: you have to trick people into signing up for your email marketing list + +One pattern I see a lot is that I sign up for some free service, and then I start getting deluged with marketing emails trying to convince me to upgrade to the paid tier or whatever. I used to think that this was how marketing emails **had** to work – you somehow get people’s email and then send them email, and hope that for some reason (???) they decide to buy things from you. + +But, of course, this isn’t true! If your marketing list is actually just full of genuinely helpful emails, and you can describe who it’s intended for clearly (give people a link to the archive to see if they like what they see!), then a lot of people will be happy to sign up and receive the emails! + +If you clearly communicate who your mailing list will help, then people can easily filter themselves in, and the only people on the list will be happy to be on the list. And then you don’t have to send any unwanted email at all! Hooray! + +Here’s one story that influenced how I think about this: once I sent an email to everyone who had bought a past zine saying “hey, I just released this other zine, maybe you want to buy it!”. And I got an angry reply from someone saying something like “why are you emailing me, I just bought that one thing from you, I don’t want you to keep emailing me about other things”. I decided that I agreed with that, and now I’m more careful about being clear about what kinds of emails people are opting into. + +### marketing is about communicating clearly & honestly + +One insight (from Alex Hillman) that helped me a lot recently was – when someone is dissatisfied with something they bought, it doesn’t always mean that the product is “bad”. Maybe the product is helpful to many other people! + +But it definitely means that the person’s expectations weren’t met. A tiny example: one of the few refund requests I’ve gotten for a zine was from someone from who expected there to be more information about sed in the zine, and they were disappointed there was only 1 page about sed. + +So if I communicate clearly & accurately what problems a product solves, who it’s for, and how it solves those problems, people are much more likely to be delighted when they buy it and be happy to buy from me again in the future!. For my zines specifically, I like to make the table of contents very easy to find so that people can see that there’s [1 page about sed][7] :) + +### myth 4: you have to constantly produce new emails + +I’ve tried and failed to start a lot of mailing lists. the pattern I kept getting stuck in was: + +I have an idea for a weekly mailing list I send 2 emails I give up forever + +This was partly because I thought that to have a weekly/biweekly mailing list, you have to write new emails every week. And some people definitely do mailing lists this way, like [Austin Kleon][8]. + +But I learned that there’s a different way to write a mailing list! Instead, you: + +put together a list of your best articles / comics / whatever when someone subscribes to that list, send them 1 email a week (or every 2 weeks, or whatever) with one article from the List Of Your Best Articles + +The point is most people in the world probably haven’t already read your best articles, and so if you just send them one article a week from that list, it’ll probably actually be MORE helpful to them than if you were writing a new article every week. And you don’t need to write any emails every week! + +I think this is called a “drip marketing campaign”, but when I search for that term I don’t find the results super helpful – there’s a lot out there about tools to do this, but as with anything I think the actual content of the emails is the most important thing. + +### myth 5: unsubscribes are the end of the world + +Another email marketing thing I used to get stressed out about was unsubscribes. It always feels a little sad to send an email about something I’m excited about and see 20 people unsubscribe immediately, even if it’s only 0.3% of people on the mailing list. + +But I know that I subscribe to mailing lists very liberally, even on topics that I’m not that interested in, and 70% of the time I decide that I’m not that interested in the topic and unsubscribe eventually. A small percentage of people unsubscribing really just isn’t that big of a deal. + +### myth 6: you need to optimize your open rates + +There are all kinds of analytics you can do with email marketing, like open rates. I love numbers and analyzing things, but so far I really haven’t found trying to A/B test or optimize my numbers to be that productive or healthy. I’d rather spend my energy on just writing more helpful things for people to read. + +The most important thing I’ve learned about website analytics is that it’s unproductive to look at random statistics like “the open rate on this email is 43% but the last one was 47%” and wonder what they mean. What _has_ been helpful has been coming up with a few specific questions that are important to me (“are people visiting this page from links on other sites, or only from my links?”) and keeping very rough track of the answers over time. + +So far I’ve really never used any of the tracking features of my email marketing software. The only thing I’ve done that I’ve found helpful is: sometimes when I release a new zine I’ll send out a discount code to people on the list, and I can tell if people bought the thing from the mailing list because they used the discount code. + +### it’s important to remember there are people on the other side + +The last thing that’s helped me is to remember that even though emailing thousands of people sometimes feels like a weird anonymous thing, there are a lot of very delightful people on the other side! So when I write emails, I usually try to imagine that I’m writing to some very nice person I met at a conference one time who told me that they like my blog. We’re not best friends, but they know my work to some extent, and they’re interested to hear what I have to say. + +I often like to remind people why they’re getting the email, especially if I haven’t emailed that list for a long time – “you signed up to get announcements when I release a new zine, so here’s an announcement!”. I think the technical email marketing term for this is a list being “cold” and “warm”, like if you don’t email a list for too long it’s “cold” and your subscribers might have forgotten that they’re on it. + +### that’s all! + +When I started, I was really convinced that email marketing was this terrible, awful thing that I could not do that mostly involved tricking people into getting emails they don’t want (ok, I’m exaggerating a bit, but I really struggled with it). But it’s possible to do it in a transparent way where I’m mostly just sending people helpful emails that they do want! + +The big surprise for me was that email marketing is not a monolithic thing. I have a lot of choices about how to do it, and if I don’t like the way someone else does email marketing, I can just make different choices when doing it myself! + +-------------------------------------------------------------------------------- + +via: https://jvns.ca/blog/2020/10/28/a-few-things-i-ve-learned-about-email-marketing/ + +作者:[Julia Evans][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://jvns.ca/ +[b]: https://github.com/lujun9972 +[1]: https://gist.github.com/jvns/c2aaecbbbf60b7f3adf3e0be18d54a7b +[2]: https://mariakillam.com/product/white-is-complicated/ +[3]: https://30x500.com/academy/ +[4]: https://stackingthebricks.com/ +[5]: https://dangerouslyawesome.com +[6]: https://wizardzines.com/saturday-comics +[7]: https://wizardzines.com/zines/bite-size-command-line/ +[8]: https://austinkleon.com/ diff --git a/sources/talk/20201030 My journey to becoming an open source mentor.md b/sources/talk/20201030 My journey to becoming an open source mentor.md new file mode 100644 index 0000000000..035ffaa8c7 --- /dev/null +++ b/sources/talk/20201030 My journey to becoming an open source mentor.md @@ -0,0 +1,92 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (My journey to becoming an open source mentor) +[#]: via: (https://opensource.com/article/20/10/open-source-mentor) +[#]: author: (Mehant Kammakomati https://opensource.com/users/mehant-kammakomati) + +My journey to becoming an open source mentor +====== +I grew from a teenage open source novice to a 20-year-old frequent +contributor and mentor to new users. +![Puzzle pieces coming together to form a computer screen][1] + +I was just 16 when I made my first meaningful open source contribution. It was the first code contribution I ever made, and I learned a lot from it. I'm 20 now, and I've been strongly attached to free and open source software (FOSS) ever since. I strive to be a friend to my community colleagues and to help others continue growing, learning, and succeeding. + +### Early days + +I first heard about FOSS through the [Google Code-In][2] contest. I was 16, but I was already learning computer science fundamentals, the C++ programming language, and anything else about computers I could get my hands on. I was very excited about the contest—not just because of the free Google swag, but because it gave me the opportunity to work directly on codebases being used all around the world. I jumped into the contest feet-first and started trying to solve as many open source software tasks as I could in the code, design, documentation, and research. + +![Google Code-in Mehant Kammakomati][3] + +(Mehant Kammakomati, [CC BY-SA 4.0][4]) + +It wasn't easy. I didn't know the FOSS community culture, nor much about the software development methodologies they used, nor even how to seek help or interact with others. So, rather than focusing on tasks, I started by focusing on understanding these fundamentals. + +In a way, I spent much of my time during the contest learning more about how open source development works instead of closing tasks. But I wasn't sad about my failure to contribute code during the contest and instead focused on my success in getting acquainted with free software and open source culture. + +### Fundamentals + +I didn't stop my journey there. As a beginner, I learned: + + 1. Git + 2. GitHub + 3. Using the terminal + 4. Writing meaningful commit messages + 5. How to communicate with colleagues and partake in project discussions + 6. A new way of looking at codebases and project anatomy + 7. Basic fundamentals of computer science + 8. Important components of the technical stack and programming languages + + + +The following year, I participated again in the Google Code-In contest to implement what I'd learned and try to make better bonds with my new FOSS friends. This time, I was able to complete a good number of tasks and make some valuable contributions that were pushed into production. As a result, I was selected as one of the 50 grand prize winners out of all the participants from all over the world. Being a kid, this gave me the motivation to make FOSS one of my best friends. + +### Programs that got me closer to FOSS + +From my start, I always liked being part of FOSS, and the journey has been amazing and addictive. I wanted to learn more, and I believed participating in FOSS initiatives and programs would help this happen. [Hacktoberfest][5] is one such initiative where I was able to contribute to Microsoft open source software and various other projects in 2018 and 2019. All the lessons I learned in Google Code-In were reinforced and strengthened.  + +[Google Summer of Code][6] (GSoC) was another important, engaging, and challenging experience for me. I became part of the GSoC 2019 and 2020 programs as a student with the [Sustainable Computing Research Lab][7]. These were two fast-paced and exciting summers spent hunting down bugs, writing new features, and documenting the work. + +In 2019, [Red Hat's Open Source Contest][8] was another wonderful opportunity to work on open source engineering problems. Red Hat is one of my dream companies—it provides open source software products (particularly interesting to me are container technologies and orchestration tools), so I'm lucky to have been part of the contest. The best part was that I was paired with a Red Hat engineer to mentor me throughout the course of the contest. I contributed to the [ansible-bender][9] project, and the journey absolutely stepped up my skills to the next level.  + +![Red Hat Open Source contest certificate][10] + +(Mehant Kammakomati, [CC BY-SA 4.0][4]) + +I also made valuable contributions to the [SPDX][11] online tools for their deployment infrastructure. While I was learning about blockchain technology, I contributed to Hyperledger Fabric's Python SDK. + +### Spreading FOSS culture + +I also served as a Google Code-In mentor in 2018 and 2019 and mentored many young aspirants making their very first valuable FOSS contributions. I was able to review around 400+ tasks and had the privilege of helping hundreds of students. + +Through my time as an open source benefactor, I've learned that the open source model is the best way to host a project. It avails you of many benefits, ranging from obtaining contributions from all over the world to getting project funding. Through my time as a contributor to open source programs, I've learned the value of working to inculcate FOSS culture in our institutions and students. + +I strongly believe in FOSS, and I recommend being part of this culture. Maybe you'll find it difficult to start, but if you seek the advice of friendly participants online or in a sponsored program, you'll surely get help. The most important part of the journey is the first few steps; once you get past that, you'll soon feel responsible and proud of each and every contribution you make—code or otherwise—knowing it helps your friends around the world. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/10/open-source-mentor + +作者:[Mehant Kammakomati][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/mehant-kammakomati +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/puzzle_computer_solve_fix_tool.png?itok=U0pH1uwj (Puzzle pieces coming together to form a computer screen) +[2]: https://en.wikipedia.org/wiki/Google_Code-in +[3]: https://opensource.com/sites/default/files/pictures/google_code-in.jpg (Google Code-in Mehant Kammakomati) +[4]: https://creativecommons.org/licenses/by-sa/4.0/ +[5]: https://hacktoberfest.digitalocean.com/ +[6]: https://summerofcode.withgoogle.com/archive/ +[7]: https://scorelab.org/ +[8]: https://research.redhat.com/red-hat-open-source-contest/ +[9]: https://opensource.com/article/19/10/building-container-images-ansible +[10]: https://opensource.com/sites/default/files/pictures/redhatcertificate.jpg (Red Hat Open Source contest certificate) +[11]: https://en.wikipedia.org/wiki/Software_Package_Data_Exchange diff --git a/sources/talk/20201108 Open environments are where innovative ideas thrive.md b/sources/talk/20201108 Open environments are where innovative ideas thrive.md new file mode 100644 index 0000000000..8850c43cae --- /dev/null +++ b/sources/talk/20201108 Open environments are where innovative ideas thrive.md @@ -0,0 +1,104 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Open environments are where innovative ideas thrive) +[#]: via: (https://opensource.com/open-organization/20/11/environments-for-innovation) +[#]: author: (Ron McFarland https://opensource.com/users/ron-mcfarland) + +Open environments are where innovative ideas thrive +====== +Certain environments are more conducive to innovation. A better +understanding of innovation's true nature could help us build them. +![A sprout in a forest][1] + +In the [first article of this series][2], I examined the nature of the innovation process in great detail. I also discussed some sources of resistance to it. In this second part of my review of [Matt Ridley's][3] book [_How Innovation Works_][4], I will explain the ideal environment in which discoveries are born, protected, and progress into useful products and services, considering certain essential conditions for innovations to flourish. And I will argue that [open organization principles][5] are the keys to establishing those conditions. + +### Better when shared + +Unfortunately, Ridley explains, history has shown that economic instability, downturns, and recessionary periods spur people toward more self-sufficiency and protectionism at the expense of productivity. That is, our attitude toward cooperation and interaction changes; people separate themselves from outsiders and tend to restrict interaction. In this environment, people, communities, and even entire countries fear dependence on others. Collaboration breaks down, feeding costly and counterproductive recessions (it's almost like reverting back to [subsistence-living societies][6], where everyone only consumes and benefits from what they produce by themselves). + +This attitude stifles innovation, as innovation occurs primarily when people are able to work _with_ each other and utilize the principles of community, collaboration, inclusion, transparency, and adaptability. + +Periods of economic stability and expansion, on the other hand, tend to create strong feelings of safety, which encourages mutual interdependence between people. As Ridley writes, "By concentrating on serving other people's needs for forty hours a week—which we call a job—you can spend the other seventy-two hours (not counting fifty-six hours in bed) drawing upon the services provided to you by other people." We do what we are good at and what we enjoy most, and then depend on others to do the things we do not do well and perhaps even dislike. When interdependence and cooperation are commonplace in a society, there tends to be an increase in innovative economic breakthroughs, specifically because of work providing specialized services. Simply put, working together to come up with new things leads to increased human productivity for all. + +In this environment, open organizations come alive. + +So let's examine the qualities that make those environments so fertile for innovation. + +### Where innovation thrives + +Several factors are common throughout the innovation process, Ridley notes in _How Innovation Works_. Notice that open organization principles are involved in each of these factors. + +#### 1\. Innovation is gradual. + +If you look closely, you'll see that innovation does not often involve single breakthroughs. Instead, it's often [a series of discoveries over months and even years][2]. Innovations are gradual, incremental, and _collective_—over time. Unfortunately, we still tend to view innovations as the result of singular actors. This is due to several factors, Ridley explains: + + 1. Human nature and a love of heroes: People love telling stories starring single heroes with key events as turning points in a linear series (what [Jim Whitehurst][7] calls "[the innovation delusion][8]"). These stories are more exciting and inspiring, perhaps, but not necessarily historically accurate (years of testing and making trial-and-error mistakes are not as interesting!). + 2. Intellectual property laws: Contemporary intellectual property systems attempt to ascribe all credit to single inventors and magnify that person's importance, overshadowing collaborators, competitors, and predecessors who contributed "stepping stone discoveries." + + + +In truth, _innovations are the result of gradual progress_. + +If you look closely, you'll see that innovation does not often involve single breakthroughs. + +#### 2\. Innovation is serendipitous. + +More often than not, innovative ideas come when one is looking for something else or trying to solve a completely different problem. They are accidental discoveries. + +For example, [Roy Plunkett][9] was trying to improve a refrigerant fluid when he discovered Teflon. Other times, certain historical events turn researchers in directions they had not considered. This is a good reason why broad inclusivity and openness to the unexpected (adaptability) while working on a project are so important. + +Sometimes, broad peripheral vision is far more important than what you're _directly_ looking at. As serendipity plays a big part in innovation, societies that embrace a more free-roving, experimental nature do so well. This approach increases the chance of a lucky idea appearing. Innovation happens when people are free to think, experiment, and speculate. It happens when people can trade things, concepts, and ideas with each other (in other words, they collaborate—see below). This explains why innovative ideas seem to emerge more from cities than from rural areas, Ridley argues. + +#### 3\. Innovation is a process of combining existing components. + +Innovation is often the result of combining pre-existing products in new ways, or applying well-known components to unanticipated problems. Again, this occurs in places where people can meet and exchange goods, services, and thoughts (where they can collaborate). This explains why innovation happens in places where trade and exchange are frequent, and not in isolated or under-populated places. Innovation is born out of communities. + +#### 4\. Innovation is iterative. + +To innovate successfully, one must be willing to experiment and develop a high tolerance for error. One must not be shocked by set-backs; instead, we need to be overjoyed by learning from them. Most great discoveries come from data gleaned and lessons learned during failed experiments. Therefore, while collaborating, there should be an environment of _playfulness_. By just playing around, we help ideas come to the surface. This is why I prefer approaching problems with others by using the expression "let's just kick this idea around a bit." It keeps everyone open to new ideas and does not allow bias or strong narrowing positions to creep in, avoiding the tendency to shut down discussion too quickly. + +The more and faster you make errors, the better. As Ridley states: + +> "Amazon is a good example of failure on the road to success, as Jeff Bezos has often proudly insisted. 'Our success at Amazon is a function of how many experiments we do per year, per month, per week. Being wrong might hurt you a bit, but being slow will kill you.' Bezos once said: 'If you can increase the number of experiments you try from a hundred to a thousand, you dramatically increase the number of innovations you produce.'" + +This is where open organization principles are important. If you have a wide community experimenting and feeding their results back to you, imagine how quickly you will find a solution (or new opportunities, for that matter) while looking at a failure with many eyes and perspectives. + +#### 5\. Innovation is collaborative. + +No one innovates in isolation. Others always play a role—whether large or small—in your innovations. The best ideas are stored between two or more minds, not in one single mind. + +Therefore, _transparency_ to what is in everyone's minds and _collaboration_ on that content are vital. Quite often, one person comes up with a product idea, then another person finds ways to manufacture it, then a third person looks at that manufacturing process and comes up with a way to execute it in a far less expensive way. All these phases are part of the overall innovation—but we focus only on one in the stories we tell about it. More often than recognized, it was a _team_, a collective effort, that led to success. + +Moreover, Matt Ridley argues that most innovations _do not_ come from producers. More frequently, they come from _consumers_ that want to _improve_ on what they are using. So when we explore open organization communities, we must remain focused on the ways these communities incorporate feedback they receive from _outside_ themselves, perhaps from _users_ of related products, and find someone among them that wants to improve on them. + +### Free to innovate + +"The main ingredient in the secret sauce that leads to innovation is freedom," Ridley writes. "Freedom to exchange, experiment, imagine, invest and fail; freedom from expropriation or restriction; freedom on the part of consumers to reward the innovations they like and reject the ones they do not." This freedom will have to be supported by sensible regulations that are permissive, encouraging, and quick to give decisions (Ridley is critical of current intellectual property regulations, citing a negative impact on the innovation process). We have to take a good look at the hurdles blocking innovation, as this exploration process should be promoted. + +In the next part of this series, I'll provide an overview of actual cases of various innovations throughout history and explain how open organization principles played a role in shaping them. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/open-organization/20/11/environments-for-innovation + +作者:[Ron McFarland][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/ron-mcfarland +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/BUSINESS_redwoods2.png?itok=H-iasPEv (A sprout in a forest) +[2]: https://opensource.com/open-organization/20/10/best-ideas-recognition-innovation +[3]: https://en.wikipedia.org/wiki/Matt_Ridley +[4]: https://www.goodreads.com/en/book/show/45449488-how-innovation-works +[5]: https://theopenorganization.org/definition/ +[6]: https://opensource.com/open-organization/20/8/global-history-collaboration +[7]: https://opensource.com/users/jwhitehurst +[8]: https://opensource.com/open-organization/19/6/innovation-delusion +[9]: https://en.wikipedia.org/wiki/Roy_J._Plunkett diff --git a/sources/talk/20201109 DevOps Replaces Developers As Most Sought After Skill Set.md b/sources/talk/20201109 DevOps Replaces Developers As Most Sought After Skill Set.md new file mode 100644 index 0000000000..8b66610ede --- /dev/null +++ b/sources/talk/20201109 DevOps Replaces Developers As Most Sought After Skill Set.md @@ -0,0 +1,76 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (DevOps Replaces Developers As Most Sought After Skill Set) +[#]: via: (https://www.linux.com/interviews/devops-replaces-developers-as-most-sought-after-skill-set/) +[#]: author: (Swapnil Bhartiya https://www.linux.com/author/swapnil/) + +DevOps Replaces Developers As Most Sought After Skill Set +====== + +[_The_ 2020 Open Source Jobs Report][1] _just came out so we took the opportunity to speak with Clyde Seepersad, Senior Vice President and General Manager of Training and Certification at the Linux Foundation, about the significance of the report and the insights it provides on the current open source landscape. He touched on the effects of COVID-19 on hiring trends, the open source skills that are in high demand, and how the Foundation is helping organizations meet this demand through high-quality intensive training. Bottom line, he says “We still don’t have enough open source talent. The urgency of finding new ways to bring talent into the market continues to be something that should be front and center for all of us.”_ + +**Swapnil Bhartiya: What is the importance of this report? Not only for the open source ecosystem, but companies outside of the open source ecosystem, because today almost everybody’s leveraging open source in one capacity or another.** + +Clyde Seepersad: One of the things that we didn’t realize several years ago is that there is a lot of data around general employment reports and a few around IT and technology in general, but there was really this gap when it comes to what’s happening on open source talent, and we kept hearing anecdotally that people can’t hire or can’t find enough talent. + +And so what we wanted to do was put a really clear spotlight on what’s going on specifically when it comes to the talent pool around open source, to be able to share with the market a sort of non-anecdotal state of the world, but also to be able to inform our own strategy and our own mission, which is to try to ensure not just that there is fantastic code coming out of open source projects, but also that there is enough talent to implement and use it as tool. + +**Swapnil Bhartiya: What are some of the key highlights of this report?** + +Clyde Seepersad: A couple of things. One is the rise of DevOps skills. I think everybody knows cloud is hot. It’s been that way for a while, but the companion piece to that around DevOps and the importance of understanding CI/CD pipelines and also the cultural difference of working in that sort of continuous delivery. The rise of that, I think, is something that maybe most people are not quite as aware of. + +The second thing I would highlight is that there were a lot of questions about what’s happening to tech hiring in response to the COVID pandemic. We have some answers for that, that says that although hiring slowed down, it did not slow down nearly as much as people might have worried at the outset. In fact, it’s now accelerating. + +The top-level thing, which is continuing to be the case, is we still don’t have enough open-source talent. The urgency of finding new ways to bring talent into the market continues to be something that should be front and center for all of us. + +**Swapnil Bhartiya: So if we look at this report, what are the skills that are kind of not only most in demand, but also hardest to find? That is like a chicken-and-egg solution, right?** + +Clyde Seepersad: Yeah. Obviously, it’s the cloud skills, right? A lot of the smaller companies, more conservative companies, they kind of make us push them to be much more active on the cloud. What that’s done is raise the stakes in terms of people who are familiar with cloud-native development, cloud-native architecture, Kubernetes orchestration, and then what does CI/CD pipelines look like in a cloud world because obviously, there’s some changes there when you’re running that sort of infrastructure. So those interwoven skillsets, right? + +Of course, sitting underneath all of that is what operating system does the cloud run on? I think we all know now that the vast, fast 98% of instances are running on Linux. So you have this tiered approach where understanding from basic Linux competence is a baseline and then you’re building on top of that, looking for cloud-native development, cloud-native orchestration, and then what the CI/CD pipelines look like to bring that to life. + +**Swapnil Bhartiya: So when we look at this shortage of talent and, at the same time, the demand for talent, in addition to just coming out with this report, do you have any kind of advice or suggestion to the hiring managers? What can they do to attract top developers or talent to their organizations because there is heavy demand and everybody wants them?** + +Clyde Seepersad: Right. Well, some of the things actually have happened in response to the pandemic, right? One of the trends we saw last year was people wanting the flexibility to be able to work from home. Of course, now we all work from home so that helps. But what came out in the report that was really interesting is that more and more talent managers are realizing that you don’t just have to go externally for talent, that you can, in fact, upskill people who are currently in your organization. + +The data suggests that a lot more people are waking up and realizing that trolling LinkedIn for your next hire is a zero-sum game because other people are doing the same. They’re starting to invest more in training, especially online training. They’re starting to invest more in certifications for their employees. And just in general, they’re starting to be much more proactive in looking at investing into their talent pool and finding ways to provide new opportunities for development. Of course, that also comes with new job opportunities for the existing employee base. + +**Swapnil Bhartiya: I just want to talk a little bit more about COVID-19. A couple of things are happening with COVID-19: a lot of companies that are scaling down. They’re cutting budgets and everything. At the same time, since people are able to work remotely, you don’t have to relocate yourself or you don’t have to find talent in the same area. You have access to almost everybody wherever they are. So how has COVID-19 affected the hiring process itself in terms of while they do have to scale down to some extent, the beauty is, I should not say that, the world that we are living in is all powered by cloud and technology. All the purchases that I was making even in my Indian grocery, they now have a website. I can just go and place an order. It was not the case earlier. So, cloud actually enabled companies to stay in business. That also means that you do need developers and all those talents to keep those businesses running. At the same time, you have the advantage of not having to relocate. So talk a bit about it.** + +Clyde Seepersad: Yeah, that’s true. I don’t think that’s tied together, right? So as people have been forced to use the cloud more, I had the same experience you did. My local Chinese restaurant suddenly developed a website and they have an ordering business that they did not previously have. Every business is now an e-commerce business is true, right? So there’s this broader footprint. + +On the flip side of it, you also have people who are now having to work from home, where they maybe didn’t use to, either for practical or maybe cultural reasons within the company. That also then intersects with the sort of cultural change and the cultural norms of CI/CD and DevOps, right? This idea that you have to be in person together versus this idea that you have a well-documented pipeline and everybody can contribute to that pipeline and do their commits and do their code, that whole tooling ecosystem of cloud native and DevOps has actually made it, made it easier—and I would argue, possible—to do what’s happened and what we’ve seen over the past several months, which is people being productive, working from home, working with people they haven’t worked with before, onboarding new team members, and being able to get them provisioned with the right access and up skill on the right systems. It’s all really come together. In my view, we have been lucky that we’ve got the technology infrastructure that we have today because I don’t know that we would have been able to stay as productive and focused in a sudden shift to remote work if we were trying to do this even five years ago, + +**Swapnil Bhartiya: I’m a good example of that because I have been working from home ever since I moved out of India. What I realized was that I work when I feel that I’m most productive instead of hey, I have to clock in at 9:00 AM and I have to clock out at 5:00 PM. I have to sit there and do something. It doesn’t matter how I feel. And then sometimes, there are personal issues. Somebody is sick in the family and your mind is there, but you have to come to the office. I think remote working offers the best balance between work and life. Of course, it is actually more challenging because you may end up working all the time, but still, it offers a better balance. Earlier you were talking about how you don’t have to go out to hire people; you can also internally train people. So when we look at organizations and they look at all these new cloud-native technologies and they want to retain or prepare their own workforce, what resources are available there, especially from the Linux Foundation so that they can better equip their own workforce when there is already a shortage of a lot of talent?** + +Clyde Seepersad: Yeah, it’s a good question, Swapnil. From a practical perspective, the portfolio that we have provided, which is very heavily focused on self-paced e-learning that you take online, but at the same time, very skills-based, very lab-intensive online training, because ultimately, what do you care about as a colleague or as a hiring manager? It’s not whether they check the box and they have a certificate saying they completed a course. What you care about is the skills, right? Did they actually develop those skills? So, we’ve got a pretty big portfolio of very hands-on, self-paced e-learning programs to help people develop the skills. And then we’ve continued to build our portfolio of performance-based certification exams. So this is not your grandad’s pick an answer out of a lineup, right? These are live systems with variable questions, and you have to demonstrate your skills under the pressure of time, under the pressure of being proctored by an independent person. I think it’s that one-two punch of really focusing on skills. + +I joke with people all the time. We get feedback sometimes that our courses aren’t don’t have enough video. And I say, “Well, true, because we’re not trying to entertain you. We’re trying to develop skills and the way you develop skills is not by staring at a screen and listening to a video. The way you develop skills is by doing a lab.” So we’ve got a very lab-centric mindset in terms of the training side of it and that carries on into the certification side of it, where it’s all about performance. Show that you can do the work, take the time to develop the skills because that’s what your colleagues are going to be looking for. That’s what your employers are going to be looking for. That’s what’s going to benefit you personally, as an individual — to be able to have that broader skill set and to be able to do that in a remote way and not have to rely on a senior trainer coming onto site and working with you. I think that’s going to be the new normal. + +**Swapnil Bhartiya: The advantage of this crisis is that people are realizing that they don’t have to move. Actually, they can move to the ideal pace they wanted to live. It could be a big ranch, it could be a beach, and they can work for companies who are operating in Silicon Valley, which also means you can also cross national boundaries. The whole idea of hope is open source is the best and the brightest people from around the globe. So how do you enable these people? People come from different cultural backgrounds, different education backgrounds, and different languages. Do you also help them irrespective of where they’re coming from, whether it’s internationalizing or supporting different languages so people can get training?** + +Clyde Seepersad: Yeah. Our LS training, we do that. Obviously, the online format helps because it’s truly available 24/7 globally, nights and weekends. So that really has expanded the footprint of what we’re able to do and who we are able to reach. We’ve also done some translations, particularly for the certification exams to make those available in languages that we know folks may not otherwise be comfortable with, for Japan and China, for instance. + +What we’re trying to do is mirror what we’re seeing in the workforce. The shift towards more remote work has actually opened up the pipeline. When you think about hiring and talent management, if you think about somebody who is in the US or in Western Europe, your pool is not as limited. You really can reach out to this global pool of talent in non-traditional markets. We’ve seen sectors get hot. Obviously, India has a lot of workshops today. There’s a ton of stuff happening in Eastern Europe now, but it really is global, right? We’ve got folks on our team in South America being super productive in this new remote way of working. I think that’s becoming more and more typical. Because of the rise of cloud native, because of the rise of Cloud Native, because of the rise of this sort of collaborative DevOps mindset, we are able to collaborate across regions, across countries, across time zones, much more effectively than they ever have before. + +**Swapnil Bhartiya: Awesome. Clyde, thank you so much for talking to me today about not only this report, but also how to help hiring managers not only get more talent, but also not retrain their own employees. I look forward to talking to you again. Thank you.** + +Clyde Seepersad: Hey, it’s always a pleasure to be with you, Swap. Thank you. + +-------------------------------------------------------------------------------- + +via: https://www.linux.com/interviews/devops-replaces-developers-as-most-sought-after-skill-set/ + +作者:[Swapnil Bhartiya][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://www.linux.com/author/swapnil/ +[b]: https://github.com/lujun9972 +[1]: https://www.prnewswire.com/news-releases/2020-open-source-jobs-report-reveals-spike-in-demand-for-devops-talent-continued-dearth-of-open-source-skills-301159394.html#:~:text=The%202020%20Open%20Source%20Jobs%20Report%20examines%20trends,and%20how%20employers%20attract%20and%20retain%20qualified%20talent. diff --git a/sources/talk/20201111 Why I use Home Assistant for open source home automation.md b/sources/talk/20201111 Why I use Home Assistant for open source home automation.md new file mode 100644 index 0000000000..6d85628c8d --- /dev/null +++ b/sources/talk/20201111 Why I use Home Assistant for open source home automation.md @@ -0,0 +1,105 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Why I use Home Assistant for open source home automation) +[#]: via: (https://opensource.com/article/20/11/home-assistant) +[#]: author: (Steve Ovens https://opensource.com/users/stratusss) + +Why I use Home Assistant for open source home automation +====== +Home automation can be a slippery slope. The right open source tools can +get you on firmer footing. +![Houses in a row][1] + +Home automation is a slippery slope; you have been warned! In this multipart series, I will discuss home automation using the open source project Home Assistant. This introductory article will cover my journey to [Home Assistant][2], what the application does, and why it's important. + +### How my journey began + +Some time ago, when I set out on this journey, my goal was not lofty. I was solving a need. You see, I have a fairly sizable [homelab][3]. Nothing on the scale of some notable YouTubers, but I have eight machines ranging from 16GB RAM all the way up to 96GB. I have a Netgear 10G Ethernet switch as the backbone of my networking infrastructure. However, I have a small problem. Every once in a while, this switch's state table fills up, and then it crashes, taking the network with it. This is a known issue with this model (although it was not known to me ahead of time). The only way to resolve the issue, without replacing the switch, is to power it off for a few seconds and then power it back on. + +This would not seem like a big deal. Especially because I live in an apartment, so I don't even have to travel up or down a flight of stairs to do this. However, I work for Red Hat as a senior OpenShift consultant, which means I am often on the road (at least pre-COVID). I use my lab almost every day for work-related activities, and my family uses the network as well for things like playing games, watching our Blu-ray collection, etc. So, it's a giant pain to have the network go down when I don't have physical access. My solution was to get a smart plug and join it to a completely different network with nothing else on it, completely firewalled off from other equipment. If the Netgear switch needs to be rebooted, I should be able to access the smart plug remotely to reboot the switch. + +### My journey away from the cloud + +Being privacy-conscious, perhaps bordering on the tinfoil hat breed, I am immediately uncomfortable with a "cloud"-connected anything. We run [Plex][4], [Kodi][5], [Nextcloud][6], and a host of other services because, well, I am "that guy." But I'm not "anti-cloud." In fact, a large part of my day job is working with the big three: AWS, Google Compute, and Azure. But when it comes to standing up services that I rely on, I have an almost irrational need to host things locally. + +After doing a significant amount of digging and speaking to my coworker Alex Kretzschmar (who also hosts the [Self-Hosted][7] podcast), I discovered alternative firmware projects, such as [Tasmota][8] and [ESPHome][9], available for certain wireless chipsets. I'll cover the different chipsets and protocols (Zigbee, WiFi, Z-Wave, and the like) in a future article, but suffice it to say, you are not stuck buying products that are dependent on the cloud. There are online stores such as [CloudFree][10] that sell devices pre-flashed with Tasmota. There are even companies like [Shelly][11] that produce high-quality products with an optional cloud component, but the buyer maintains local control. + +Anyway, back to my story. I bought a plug, flashed the firmware to run Tasmota, and remotely power-cycled my switch on occasion, and that was the end of it, right? Well, if it was, I imagine I would not be writing this article. I currently have 43 Internet of Things (IoT) devices—from sensors I built to smart bulbs, smart LED strips, infrared blasters, and more. Remember how I said home automation is a slippery slope? + +Did I mention that I have had virtually no experience with soldering, electronic theory/repairs, or anything remotely related to home automation? In fact, outside of Linux and related technology, I am one of the least "handy" people I know. Sure, I can punch a hole in a wall or put some screws in a board, but up to the age of 30, the only tools that I ever owned were a Dremel and some screwdrivers for installing computer components. + +Why mention this? So you understand exactly how far behind square one I was when I started. If I can take this on, so can you! + +### Centralized local control + +Great, I have a ton of IoT devices, and I can toggle things on and off from a phone. For a while, I was satisfied with simply calling up the Tasmota web UI and using its sparse but functional controls. + +![Tasmota user interface][12] + +(Steve Ovens, [CC BY-SA 4.0][13]) + +Even my wife, God bless her willingness and patience while I constantly learned and attempted new things, got used to using the Tasmota interface. After a while, as the number of devices grew, this method of managing things became untenable and did not scale well at all. + +I began to poke around to learn how other people were managing their "smart homes." Let's be honest; at this point, it wasn't a smart home as much as a small but growing number of lights we could remotely control. + +The big open source projects in this area are [openHAB][14] and [Home Assistant][15]. This series won't compare them in any manner. Partly, it's because I am not qualified for this, as I have only been using Home Assistant for the last year or so, but also because for me to feel comfortable making such a comparison, I would have to set up openHAB as a drop-in replacement and, frankly, I have too much invested in Home Assistant to explore this avenue. + +### About Home Assistant + +You may be wondering what Home Assistant is and what it has to offer. Imagine a house that reacts to its inhabitants, like in sci-fi movies. Perhaps you have a couple of bedside lamps, a TV, some floor lighting, a fan, and a few other gizmos in your bedroom. As you walk into the bedroom, the lights turn on. Big deal, you say; we have had this technology for some time. Of course, you are right. But what if it's late and your significant other is already in bed? You might be in for a rather cold greeting if the lights come on as you enter the bedroom. Yikes! + +What if, instead, when you walk into the room at night, the floor LED lights turn on to a soft glow—enough so that you can move around without killing yourself but not bright enough to wake a sleeping partner. You climb into bed, and a few minutes later, the floor lighting turns off. This is what Home Assistant can do for you. + +"But wait!" I hear you screaming at your monitor. "I can just ask Alexa or Google to turn off my lights for me." You're correct again, of course. However, what happens when these services suffer some sort of disruption? Also, you may need to consider how loudly you need to speak to trigger the listening device. And remember that thing I said about privacy? Do you really want these big companies to learn your habits? Even discarding the privacy issue, consider that others may use your home as well. This means visitors need to know what commands you have available for controlling your smart devices. + +Lots of "smart" products on the market can set timers, schedules, and scenes, but none of them can really _react_ to any given situation. This is where a home automation hub like Home Assistant comes into play. + +At its core, Home Assistant is software that helps centralize all of the sensors, gizmos, and gadgets you have in your home. With all of these products working together in concert, you can set all kinds of conditions that would not otherwise be possible. + +Has someone entered the room? Is it a certain time of the day? Is the room warmer than a certain value? Is someone in bed? All of these data points are of limited use on their own, but together, you can use them to set the brightness of a light at dusk, turn a fan on because it's above 26ºC (80ºF) in the room, but don't turn on Steve's desk lamp because his side of the bed is occupied. + +If you can imagine it, you can accomplish it using Home Assistant and the right sensor inputs. + +### Sustainable and open source + +One thing I like about Home Assistant is that it seems to be reaching a critical mass of adoption from various vendors. But more important to me is that the company behind it, [Nabu Casa][16], creates a focal point for the community. The company hired developers directly from the community, and it does not penalize you if you don't pay a monthly fee. The revenue Nabu Casa generates comes from value-added items, like being able to access your local Home Assistant easily and from anywhere in the world. + +This is important because it means that there is a path forward for the project, and it has a sustainable income for future development. Unlike "open core" models, Home Assistant is fully open source, which means that if the community disagrees strongly enough with Nabu Casa's direction, it could fork Home Assistant at its current state and take a divergent path. Because my family has chosen to make this piece of software integral to how we interact with our devices, that Home Assistant has a revenue stream and is fully open source are invaluable to me. + +In the next article, I will discuss some of the common standards for IoT devices as well as the benefits of local control. Future articles will walk through the basics of installing Home Assistant, setting up essential add-ons (e.g., MQTT), Node-RED, the Community Store, making backups, and more. + +In the meantime, comment or [tweet][17] at me if you would like to explore something specific in-depth. If I have used it, I can talk about it. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/11/home-assistant + +作者:[Steve Ovens][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/stratusss +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/house_home_colors_live_building.jpg?itok=HLpsIfIL (Houses in a row) +[2]: https://www.home-assistant.io/ +[3]: https://opensource.com/article/19/3/home-lab +[4]: https://www.plex.tv/ +[5]: https://opensource.com/article/19/1/manage-your-media-kodi +[6]: https://nextcloud.com/ +[7]: https://selfhosted.show/ +[8]: https://tasmota.github.io/docs/ +[9]: https://esphome.io/ +[10]: https://cloudfree.shop/ +[11]: https://shelly.cloud/ +[12]: https://opensource.com/sites/default/files/uploads/tasmota_ui.png (Tasmota user interface) +[13]: https://creativecommons.org/licenses/by-sa/4.0/ +[14]: https://www.openhab.org/ +[15]: https://opensource.com/article/18/3/smart-home-assistant +[16]: https://www.nabucasa.com/ +[17]: https://twitter.com/linuxovens diff --git a/sources/talk/20201112 Improve open source community sustainability by tracking these two metrics.md b/sources/talk/20201112 Improve open source community sustainability by tracking these two metrics.md new file mode 100644 index 0000000000..7ac4f2becb --- /dev/null +++ b/sources/talk/20201112 Improve open source community sustainability by tracking these two metrics.md @@ -0,0 +1,146 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Improve open source community sustainability by tracking these two metrics) +[#]: via: (https://opensource.com/article/20/11/open-source-community-sustainability) +[#]: author: (Kevin Xu https://opensource.com/users/kevin-xu) + +Improve open source community sustainability by tracking these two metrics +====== +Focusing on metrics around community ownership and incentives can +increase your odds of building a sustainable open source project. +![Person using a laptop][1] + +In early 2020, I wrote an article on [three metrics][2] for tracking and measuring offline, in-person community-building activities. Little did I (or the world) know then that offline, in-person activities of any kind would soon become unfeasible for the foreseeable future. + +So, I started thinking: With open source projects being online by default, and with everything else moving online and virtual, what should creators of open source technologies measure as we continue in this COVID and (hopefully soon) post-COVID world? + +There are plenty of metrics you _can_ track—stars, forks, pull requests (PRs), merge requests (MRs), contributor counts, etc.—_but more data doesn't necessarily mean clearer insights_. I've previously shared my skepticism about the value of these [surface-level metrics][3], especially when assessing an open source project's health and sustainability. + +In this article, I propose two second-order metrics to track, measure, and continually optimize to build a strong, self-sustaining open source community: + + * Breakdowns of PR or MR reviewers + * Leaderboards of different community interactions + + + +### Why these metrics? + +The long-term goal of any open source community-building effort is to reach a tipping point where the project can live beyond the initial creators' or maintainers' day-to-day involvement. It's an especially important goal if you also are building a commericial open source software (COSS) company around that open source technology, whether it's bootstrapped or venture capital-backed. Your company will eventually have to divert resources and people power to build commercial services or paid features. + +It's a lofty goal that few projects achieve. Meanwhile, maintainer burnout is a real problem. The latest and most high-profile example is Redis creator Salvatore Sanfilippo, who shared his [struggles as an open source maintainer][4] last year and [bowed out as CEO][5] of Redis Labs earlier this year. Maintainers of various projects, big or small, struggle through similar challenges every day. + +Focusing on the two metrics above, especially early in your open source journey, can increase your odds of building something sustainable because they illuminate two important elements that drive sustainability: **ownership** and **incentive**. + +#### Breaking down PR/MR reviewers = Ownership + +Tracking who in your community is actively reviewing contributions is a good indicator of ownership. In the beginning, you, the creator, do the bulk of reviewing, but this will be unsustainable over time. Being intentional about building your community so that more people have the _contextual knowledge, confidence, and welcoming attitude_ to review incoming PRs/MRs (which should increase in frequency as your project gains traction) is crucial to long-term sustainability. + +There's a customer service-like element to reviewing contributions, which can deteriorate if not enough people feel ownership to do it. And one of the worst signals you can give to an otherwise enthusiastic newcomer is a PR or MR left unattended for two or more weeks. + +#### Community interaction leaderboards = Incentive + +Tracking a few community-facing interactions and possibly gamifying them within your community with rewards can help drive the right incentives and behaviors among community members with all levels of experience. Some of the interactions you can track are the number of PRs/MRs filed, comments, reactions, and reviews (which has some overlap with reactions). These interactions may have different values and quality, but the bigger goal here is _to understand who's doing what, who's good at doing what_, and intentionally _foster more behaviors based on people's strengths and interests_. + +Perhaps some people are great at providing helpful comments but don't have enough context (yet) to review a PR/MR. It would be good to identify who they are and provide them with more info so that they can become a reviewer one day. Perhaps some people are super-engaged with monitoring the project, as shown by their frequent reactions, but don't feel comfortable chiming in with comments and suggestions. It would be good to know who they are and help them gain more context into the project's inner workings, so they can add more value to a community they clearly care about.  + +### How to use the metrics + +So how can you track and read into these metrics? I'll illustrate with an example comparing two open source projects: [Kong][6], an API gateway, and [Apache Pulsar][7], a pub-sub messaging system. + +In May 2020, I used [Apache Superset][8], an open source data visualization tool, along with a tutorial written by [Max Beauchemin][9], one of the project's creators, to crawl and visualize some data from Kong, Apache Pulsar, and [a few other projects][10]. Using [the tutorial][11], I crawled two years' worth of data (from May 2018 to May 2020) to see changes over time. (Note: The tutorial is an example of Superset's own data with some hard-coded linkage to its history inside Airbnb and Lyft, so to use it, you will need to do some customization of the dashboard JSON to make it work more generally.) + +Two caveats: First, the data was last gathered in May, so it will surely look different today. Second, the projects were open sourced at different times, and this comparison is not a judgment on the current state or potential of either project. (Kong's first commit was in November 2014, and Pulsar's was in September 2016. Of course, both were worked on in private before being open sourced.) Some of the differences you see may simply be due to the passage of time and community effort paying off at different times; _community building is a long, persistent slog_. + +#### PR reviewer metrics + +The following two charts show Kong and Pulsar's PR reviews by GitHub handle: + +![Kong PR reviews by GitHub handle][12] + +Kong's PR reviews by GitHub handle (COSS Media, ©2020) + +![Pulsar's PR reviews by GitHub handle][13] + +Pulsar's PR reviews by GitHub handle (COSS Media, ©2020) + +Based on this data, I observe that Kong has a better balance of people reviewing PRs than Pulsar has. That balance was achieved over time as the Kong project grew in maturity. The most important thing to note is that neither of Kong's creators, [Aghi][14] nor [Marco][15], is anywhere close to being the top reviewers. _That's a good thing!_ They certainly were during the early days, but their involvement became less visible as the project matured, as it should. + +As a younger project, Pulsar isn't at the same level yet but is on its way to achieving that balance. [Sijie][16], [Jia][17], and [Penghui][18] are doing the bulk of the reviewing for now; all three are project management committee members and lead SteamNative, Pulsar's COSS company. Other major players, including Splunk (especially after it [acquired][19] Streamlio), also contribute to the project, which is a good leading indicator of eventually achieving balance. + +One factor I'm intentionally glossing over is the difference in the governance process of an Apache Software Foundation project and a non-ASF project, which would impact the speed and procedure for a contributor to become a reviewer or maintainer. In that regard, this comparison is not 100% apples-to-apples. + +#### Community interaction metrics + +Following are two leaderboard charts showing Kong and Pulsar's community interactions by GitHub handle in the 90 days since the most recent data gathered (roughly from March to May 2020): + +![Kong's 90-day leaderboard chart][20] + +Kong's 90-day leaderboard chart (COSS Media, ©2020) + +![Pulsar's 90-day leaderboard chart][21] + +Pulsar's 90-day leaderboard chart (COSS Media, ©2020) + +These leaderboards reflect the same "level of balance" shown in the previous chart, which makes sense. The more interesting takeaway is who is doing what kind of interaction, how much _interacting_ is happening, and who seems to be doing it all (Sijie!). + +As far as building the right incentive structure, this leaderboard-type view can help you get a sense of where interactions are coming from and what sort of reward or motivational system you want to design to accelerate positive behaviors. + +This data is also useful for internal management _and_ external community building. As close watchers can tell, many of the leaders on these charts are employees of the projects' COSS companies, Kong Inc. and StreamNative. It's quite common for active community contributors (or enthusiasts) to become employees of the company commercializing the project. Regardless of where these folks are employed, to foster a sustainable project beyond its initial creators (which in turn would influence the sustainability of the COSS company), you would need to measure, track, and incentivize the same behaviors. + +Also, I'm aware that the Pulsar chart does not have a "reactions" column, which could either be because there wasn't much reaction data to merit a top-10 entry or due to my own faulty configuration of the chart. I apologize for this inconsistency. + +### Tips on driving balanced sustainability + +No matter how pretty the charts are, data doesn't tell the whole story. And no matter how successful a particular project is, its experience should not be templatized and applied directly to a different project. That said, I'd like to share a few actionable tips I've seen work in the wild that can help you improve these two metrics over time: + + * **Provide high-quality documentation:** In a previous article, I focused on [documentation][22], and I encourage you to give it a read. The most important point is: a project's documentation gets the most amount of traffic. It's the place where people decide whether to continue learning about your project or move on. _You never want to give people a reason to move on_. Generally, I recommend spending 10% to 20% of your time writing documentation. Putting it in context: if you are working on your project full-time, it's about half a day to one full day per week. + * **Make your contributor guide a living document:** Every project has a CONTRIBUTING.MD document (or a variation of it). But projects that grow and mature make that document the best it can be and continually refresh, update, and refine it. Why? Because that's where people who are enthusiastic about participating in the project go. If the guide is clear, succinct, and actionable, you'll get contributions in no time. If it's outdated, convoluted, and lacks an easy onramp (e.g., beginner issues, simple bugs, etc.), then that enthusiasm will go somewhere else. _Make your CONTRIBUTING.MD a killer feature_. + * **Set clear quality guidelines:** There _is_ such a thing as a "noisy contribution"—low-quality PRs/MRs that require more energy than it's worth to review (and oftentimes reject). However, the responsibility of communicating to the public what is and is not a "quality contribution" is on you, the creator or maintainer, because you have the most context and institutional knowledge about the project, by far. _Make your expectations clear, and don't compromise on quality._ Make it a prominent section of your CONTRIBUTING.MD or a separate document to give it more visibility. Combine it with your project's roadmap, which should be part of your public documentation anyway, so your new contributors know what's expected of them and why. + + + +I hope this provides some useful insight into the two second-order metrics that matter when building a sustainable open source community and some actionable items you can use to track and improve them. + +* * * + +_This article originally appeared on_ _[COSS Media][23]_ _and is republished with permission._ + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/11/open-source-community-sustainability + +作者:[Kevin Xu][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/kevin-xu +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/laptop_screen_desk_work_chat_text.png?itok=UXqIDRDD (Person using a laptop) +[2]: https://opensource.com/article/20/3/community-metrics +[3]: https://softwareengineeringdaily.com/2019/04/04/project-health-assessing-open-source-projects-with-more-context/ +[4]: http://antirez.com/news/129 +[5]: http://antirez.com/news/133 +[6]: https://github.com/Kong/kong +[7]: https://github.com/apache/pulsar +[8]: https://superset.apache.org/ +[9]: https://github.com/mistercrunch +[10]: https://twitter.com/kevinsxu/status/1275072801511059456 +[11]: https://preset.io/blog/2020-04-15-github-community-dashboard/ +[12]: https://opensource.com/sites/default/files/uploads/kongpr-reviews.jpg (Kong PR reviews by GitHub handle) +[13]: https://opensource.com/sites/default/files/uploads/pulsarpr-reviews.jpg (Pulsar's PR reviews by GitHub handle) +[14]: https://github.com/sonicaghi +[15]: https://github.com/subnetmarco +[16]: https://github.com/sijie +[17]: https://github.com/jiazhai +[18]: https://github.com/codelipenghui +[19]: https://www.splunk.com/en_us/blog/leadership/splunk-to-expand-streaming-expertise-announces-intent-to-acquire-streamlio-open-source-distributed-messaging-leader.html +[20]: https://opensource.com/sites/default/files/uploads/kong_leaderboard.jpg (Kong's 90-day leaderboard chart) +[21]: https://opensource.com/sites/default/files/uploads/pulsarleaderboard.jpg (Pulsar's 90-day leaderboard chart) +[22]: https://opensource.com/article/20/3/documentation +[23]: https://coss.media/2-things-to-measure-and-improve-open-source-community-sustainability/ diff --git a/sources/talk/20201113 3 ways managers build team culture around open source.md b/sources/talk/20201113 3 ways managers build team culture around open source.md new file mode 100644 index 0000000000..b7f52a78aa --- /dev/null +++ b/sources/talk/20201113 3 ways managers build team culture around open source.md @@ -0,0 +1,67 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (3 ways managers build team culture around open source) +[#]: via: (https://opensource.com/article/20/11/selfless-culture) +[#]: author: (Shishir Kamboj https://opensource.com/users/shishirkamboj) + +3 ways managers build team culture around open source +====== +Contributing to open source prevents complacency and teaches people the +value of giving to the greater good. +![Teammates shaking hands and smiling in an office][1] + +Whether you are a senior leader or an individual contributor, you make decisions based on your personal, peers', and colleagues' experiences and feedback. If the people around you are evolving, you will grow with them, as will the organization you support. If the backgrounds and knowledge of the people around you are diverse and changing, you and your team will benefit. + +I've noticed that my skillset and contributions give diminishing returns if I am not challenged. Human beings tend to get into their comfort zones quickly. We get used to working a certain way, and we start to depend on key people to make decisions for us. This leads to complacency, which does not change unless we are challenged due to market shifts or other external forces. + +A selfless approach contributes to growth in career and skillsets as well as helps others grow. When we not only promote ourselves but the right person for the right job, we can be better team players. Our focus becomes what is right for the organization, not what is right for us. It helps both individuals and organizations when we are more flexible and ready for change. + +The big question is: How can you create opportunities for change and create a selfless approach on your team? It may be difficult to ask your employees to be completely selfless. But as leaders, we can align our teams' and employees' growth to the organization's development. The following are a few ways to achieve this. + +### 1\. Help employees create a career + +Invest in your teams. Set a career path for each team member. You may find employees who are happy working on the same things year after year. While I agree that it is essential to have expertise, this can easily lead to complacency and hoarding. I see these as significant concerns. + +When you like what you do, you can excel at it. You should achieve consistent improvement in the knowledge and exposure you get. It helps if you have a forte in an area where you are a point person across the board. At the same time, it's essential to move forward while looking for new avenues to contribute. Working on open source software is an excellent way to make that happen. + +In one of my earlier roles, I led an infrastructure services team. For a long time, this group focused on data center design, hardware, and network engineering. As cloud services started emerging, the team found itself in an identity crisis. The group had not added any new skill sets over the previous few years. The team's motivation scores were at an all-time low. Work became more limited as deployments shrunk to legacy applications. + +It was imperative to invest in the team to help boost morale and connect with the company's vision. The team members needed to see how they added to the company's growth while gaining knowledge and new skills. + +As we investigated our customers' pain points and their needs, we realized an open source strategy around cloud computing would be an ideal investment area. The team's experience made the transition challenging, but the members were ready for the change. The group swiftly jumped on the initiative and brought much success to themselves and the organization. + +Carving out time for your team to work on open source software and contribute upstream is a great way to put your team members out there and help them gain different experiences while working with the broader community. It is imperative for leadership to move team members around to transition them to something new. It is also necessary to remind your team that every initiative, technology, or project follows a curve that starts with innovation, then shows heightened expectation, goes into a growth phase, and eventually declines. + +This point is even more critical for managers and leaders. Sometimes I see leaders who are stuck in the status quo. A leader's attitude can impact a team's culture—negatively or positively. + +### 2\. Correlate the team's success with the organization's success + +Leaders can motivate teams by showing appreciation to contributors. It is critical for teams to understand the impact their work has on customers and the world. It's also vital for them to correlate their role with the company's success. Every employee should know the value they bring to the table. + +Understanding the financial value your team brings to the company is part of this. Share how the product or service your team provides contributes to revenue. This will show how your team how critical their product or service is for your customers and how it impacts the customer experience. This has really worked for me and the teams I lead. + +### 3\. Bring pride to what you do + +Bringing pride to your work is a crucial element in developing ownership. If you take pride in what you do, you will enjoy it more. Employees who are proud of their work will be more eager to share and also look for ways to improve. As a manager or leader, it is your responsibility to bring visibility to your team's work. Appreciation for your team goes a long way, especially if you show your gratitude in front of the broader organization. + +Open source community participation can provide opportunities to contribute to a greater good, give visibility to your work, challenge your thought process, and drive you to think out of the box. What suggestions do you have to helping teams overcome complacency and become more selfless? Please share your thoughts in the comments.  + +Learn how companies can get started in contributing to open source projects, including encouraging... + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/11/selfless-culture + +作者:[Shishir Kamboj][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/shishirkamboj +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/handshake_teamwork_meeting_office_space.png?itok=6H0GEyoc (Community and team smiling) diff --git a/sources/talk/20201113 How to create trust in artificial intelligence using open source.md b/sources/talk/20201113 How to create trust in artificial intelligence using open source.md new file mode 100644 index 0000000000..9c9340d3fc --- /dev/null +++ b/sources/talk/20201113 How to create trust in artificial intelligence using open source.md @@ -0,0 +1,60 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How to create trust in artificial intelligence using open source) +[#]: via: (https://opensource.com/article/20/11/ai-open-source) +[#]: author: (Rebecca Whitworth https://opensource.com/users/rsimmond) + +How to create trust in artificial intelligence using open source +====== +Opening up the "black box" helps remove uncertainties about AI outcomes, +providing insight into the modeling process and identifying biases and +errors. +![Brain on a computer screen][1] + +Artificial intelligence (AI) is being used more frequently in our daily lives, with systems such as Siri and Alexa becoming commonplace in many households. Many households themselves are "smart," powered by devices that can control your lights, heating and air, and even the music playing. And those music players are powered by AI that recommends songs and artists you may like. + +However, these systems are often referred to as "black box" systems because we do not know how the data is processed—how do the users know why the model has made that prediction? The advent and widespread adoption of deep neural networks, while providing impressive results, made this even more critical, since humans can't logically interpret how information is processed within thousands of neurons. + +A more safety-critical example of AI systems is when doctors use them to reduce stress loads. These systems do this by quickly ingesting data at a rapid rate; for example, thousands of medical journals could be read and parsed by AI exponentially faster than by a human. This data can then be used to train predictive models, which are used to help doctors diagnose patients, this time armed with far more data points than were available before and in a quicker time. People assume that, with all this information, a machine can make "better" decisions than humans. However, how can we trust a machine to make such critical decisions when we do not fully understand the data processing techniques? + +Open source supports many methods and applications that can lead to better trust in AI systems. In this article, we will explore some of those open source projects as well as the open source mentality, and how by becoming part of the open source community, you can gain more trust in your AI. + +Projects like [LIME][2] and [SHAP][3], which are open source, can explain the outcome of a prediction. To illustrate how this works, let's look at a loan request use case. Based on an AI outcome, a bank rejects a customer who has made a loan request, but why did the algorithm return that outcome? Projects like these aim to make the model more explainable by showing feature importance graphs, i.e., which features were significant to the outcome of the model. Features are the inputs that generate the prediction. In this example, if an important feature used to reject the loan had been "gender," then this would mean the model is biased or incorrect. If the model is known to be wrong, then retraining it will give improved predictions. + +These projects help to build trust in AI systems by explaining the black box model and introspecting decision-making. By open sourcing projects such as this, we can ensure confidence in the system due to the openness of the predictive modeling process. It can give stakeholders confidence that the model is correct and that its recommendations can be trusted, so there is less business risk. + +Open source can stop unfairness, such as the gender-bias example above, by iteratively testing the system's potential outcomes quickly and effectively. If the model is biased, then a notification to the community can be made in a timely fashion, as there are more developers in the community than there would be if the project was closed source. Therefore, if there is trust in the community, then there can be trust in the system. + +Open source platforms leverage ideas from a broad group of peers and offer greater opportunity to innovate and create worthwhile features in a system. These ideas focus the project in a user-driven direction, and improvements come from the developers/users themselves. The system is trustworthy because it has a user-centric design pattern and fosters knowledge of system development and execution. Essentially, the people who have made the system can trust the system. + +When an AI system fails, people may be offended or misled. The project or organization loses people's confidence, and it creates distrust of the system overall. Credibility can be protected by making an AI project open source, because with more testers in the community, the more the data and performance can be verified. + +By leveraging the community-focused nature of open source, we can also ensure that more people with a wider variety of skill sets routinely check the codebase. Predictive models are very good at recognizing patterns; however, they can fail when faced with an outlier. Humans, on the other hand, are very good at being able to recognize and respond to anomalies and nuance. Therefore, having humans involved in the AI system is integral to stopping mistakes, which, in the example use case of the doctor, could actually be deadly. It is essential to have domain experts to check the system's outcomes, and the more, the better. + +Community-focused feature development can also improve trust by ensuring that the project meets company regulations. The community can include stakeholders from the business who can then lead the development focus and reduce business risk. + +A closed approach to AI can lead to inadequate feature design choices that are not relevant to the current needs of the community and businesses. Such features can be harmful to the system; for example, if a medical system's patient diagnostic function has poor accuracy due to lack of testing, then this will mean more human intervention and, ultimately, less trust. + +A closed approach can also stifle creativity and freedom to develop innovative ideas, and it stops the feedback loop on ideas from community users or people outside of the company. A feedback loop is useful, as the people who are developing it have a greater knowledge of the system and how it works, and if the community knows it works, then they are more likely to use it. + +Trusting AI can be hard when people use black box models, due to the lack of understanding of what they are doing and how they work. Open source mentality and models help users and developers to create more trust in AI by opening up the black box, encouraging iterative and collaborative development, and using the community to ensure proper functionality and fewer bugs. Open source allows AI to reach its potential in a trustworthy and meaningful way for users. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/11/ai-open-source + +作者:[Rebecca Whitworth][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/rsimmond +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/brain_computer_solve_fix_tool.png?itok=okq8joti (Brain on a computer screen) +[2]: https://github.com/marcotcr/lime +[3]: https://github.com/slundberg/shap diff --git a/sources/talk/20201113 The state of the art of microservices in 2020.md b/sources/talk/20201113 The state of the art of microservices in 2020.md new file mode 100644 index 0000000000..0fa6e11733 --- /dev/null +++ b/sources/talk/20201113 The state of the art of microservices in 2020.md @@ -0,0 +1,147 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (The state of the art of microservices in 2020) +[#]: via: (https://www.linux.com/news/the-state-of-the-art-of-microservices-in-2020/) +[#]: author: (Linux.com Editorial Staff https://www.linux.com/author/linuxdotcom/) + +The state of the art of microservices in 2020 +====== + +### _“The microservice architectural style is an approach to developing a_ _**single application**_ _as a suite of_ _**small services**_*, each running in its* _**own process and communicating with lightweight mechanisms**_*, often an HTTP resource API. These services are* _**built around business capabilities**_ _and_ _**independently deployable**_ _by_ _**fully automated deployment machinery**_*. There is a bare minimum of centralized management of these services, which may be written in* _**different programming languages**_ _and_ _**use different data storage technologies.**__“_ + +### James Lewis and Martin Fowler (2014) [6] + +## Introduction + +It is expected that in 2020, the global cloud microservices market will grow at a rate of 22.5%, with the US market projected to maintain a growth rate of 27.4% [5]. The tendency is that developers will move away from locally hosted applications and shift into the cloud. Consequently, this will help businesses minimize downtime, optimize resources, and reduce infrastructure costs. Experts also predict that by 2022, 90% of all applications will be developed using microservices architecture [5]. This article will help you to learn what microservices are and how companies have been using it nowadays.  + +## What are microservices? + +Microservices have been widely used around the world. But what are microservices? Microservice is an architectural pattern in which the application is based on many small interconnected services. They are based on the **single responsibility principle**, which according to Robert C. Martin is “gathering things that change for the same reason, and separate those things that change for different reasons” [2]. The microservices architecture is also extended to the **loosely coupled services** that can be **developed, deployed, and maintained independently** [2].  + +## Moving away from monolithic architectures + +Microservices are often compared to traditional monolithic software architecture. In a monolithic architecture, a software is designed to be self-contained, i.e., the program’s components are interconnected and interdependent rather than loosely coupled. In a tightly-coupled architecture (monolithic), each component and its associated components must be present in order for the code to be executed or compiled [7]. Additionally, if any component needs to be updated, the whole application needs to be rewritten. + +That’s not the case for applications using the microservices architecture. Since each module is independent, it can be changed without affecting other parts of the program. Consequently, reducing the risk that a change made to one component will create unanticipated changes in other components.  + +Companies might run in trouble if they cannot scale a monolithic architecture if their architecture is difficult to upgrade or the maintenance is too complex and costly [4]. Breaking down a complex task into smaller components that work independently from each other is the solution to this problem. + +![Monolithic vs. microservices architecture. Image extracted from \[3\].][1] + +## How developers around the world build their microservices + +Microservices are well known for improving _scalability_ and _performance_. However, are those the main reasons that developers around the world build their microservices? The State of Microservices 2020 research project [1] has found out how developers worldwide build their microservices and what they think about it. The report was created with the help of 660 microservice experts from Europe, North America, Central and South America, the Middle East, South-East Asia, Australia, and New Zealand. The table below presents the average rating on questions related to the maturity of microservices [1].  + +**Category** | **Average rating (out of 5)** +---|--- +Setting up a new project | 3.8 +Maintenance and debugging | 3.4 +Efficiency of work | 3.9 +Solving scalability issues | 4.3 +Solving performance issues | 3.9 +Teamwork | 3.9 + +  + +As observed on the table, most experts are happy with microservices for solving scalability issues. On the contrary, maintenance and debugging seem to be a challenge for them. + +According to their architecture’s leading technologies, most experts reported that they use Javascript/Typescript (almost ⅔ of microservices are built on those languages). In the second place, they mostly use Java. + +Although there are plenty of options to choose to deploy microservices, most experts use Amazon Web Services (49%), followed by their own server. Additionally, 62% prefer AWS Lambda as a serverless solution. + +Most microservices used by the experts use HTTP for communication, followed by events and gRPC. Additionally, most experts use RabbitMQ for message-brokers, followed by Kafka and Redis. + +Also, most people work with microservices continuous integration (CI). In the report, 87% of the respondents use CI solutions such as GitLab CI, Jenkins, or GitHub Actions. + +The most popular debugging solution among 86% of the respondents was logging, in which 27% of the respondents ONLY use logs.  + +Finally, most people think that microservice architecture will become either a standard for more complex systems or backend development. + +## Successful use cases of Microservices + +Many companies have changed from a monolithic architecture to microservices.  + +### Amazon + +In 2001, development delays, coding challenges, and service interdependencies didn’t allow Amazon to address its growing user base’s scalability requirements. With the need to refactor their monolithic architecture from scratch, Amazon broke its monolithic applications into small, independent, and service-specific applications [3][9]. + +In 2001, Amazon decided to change to microservices, which was years before the term came into fashion. This change led Amazon to develop several solutions to support microservices architectures, such as Amazon AWS. With the rapid growth and adaptation to microservices, Amazon became the most valuable company globally, valued by market cap at $1.433 trillion on July 1st, 2020 [8]. + +### Netflix + +Netflix started its movie-streaming service in 2007, and by 2008 it was suffering scaling challenges. They experienced a major database corruption, and for three days, they could not ship DVDs to their members [10]. This was the starting point when they realized the need to move away from single points of failure (e.g., relational databases) towards a more scalable and reliable distributed system in the cloud. In 2009, Netflix started to refactor its monolithic architecture into microservices. They began by migrating its non-customer-facing, movie-coding platform to run on the cloud as an independent microservices [11]. Changing to microservices allowed Netflix to overcome its scaling challenges and service outages. Despite that, it allowed them to reduce costs by having cloud costs per streaming instead of costs with a data center [10]. Today, Netflix streams approximately 250 million hours of content daily to over 139 million subscribers in 190 countries [11]. + +### Uber + +After launching Uber, they struggled to develop and launch new features, fix bugs, and rapidly integrate new changes. Thus, they decided to change to microservices, and they broke the application structure into cloud-based microservices. In other words, Uber created one microservice for each function, such as passenger management and trip management. Moving to microservices brought Uber many benefits, such as having a clear idea of each service ownership. This boosted speed and quality, facilitating fast scaling by allowing teams to focus only on the services they needed to scale, updating virtual services without disrupting other services, and achieving more reliable fault tolerance [11]. + +## It’s all about scalability! + +A good example of how to provide scalability is by looking at China. With its vast number of inhabitants, China had to adapt by creating and testing new solutions to solve new challenges at scale. Statistics show that China serves roughly 900 million Internet users nowadays [14]. During the 2019 Single’s Day (the equivalent of Black Friday in China), the peak transaction of Alibaba’s various shopping platforms was 544,00 transactions per second. The total amount of data processed on Alibaba Cloud was around 970 petabytes [15]. So, what’s the implication of these numbers of users in technology? + +Many technologies have emerged from the need to address scalability. For example, [Tars][2] was created in 2008 by Tencent and [contributed to the Linux Foundation in 2018][3]. It’s being used at scale and enhanced for ten years [12]. Tars is open source, and many organizations are significantly contributing and extending the framework’s features and value [12]. Tars supports multiple programming languages, including C++, Golang, Java, Node.js, PHP, and Python; and it can quickly build systems and automatically generate code, allowing the developer to focus on the business logic to improve operational efficiency effectively. Tars has been widely used in Tencent’s QQ, WeChat social network, financial services, edge computing, automotive, video, online games, maps, application market, security, and many other core businesses. [In March of 2020, the Tars project transitioned into the TARS Foundation][4], an open source microservice foundation to support the rapid growth of contributions and membership for a community focused on building an open microservices platform [12]. + +**Be sure to check out the Linux Foundation’s new free training course,** [Building Microservice Platforms with TARS][5] + +*About the authors: * + +_Isabella Ferreira is an Advocate at TARS Foundation,_ a cloud-native open-source microservice foundation under the Linux Foundation*. * + +*Mark Shan is Chairman at Tencent Open Source Alliance and also Board Chair at TARS Foundation. * + +**References:** + +[1] + +[2] + +[3] + +[4] + +[5] + +[6] + +[7] + +[8] + +[9] + +[10] + +[11] + +[12] + +[13] + +[14] + +[15] + +#### _This Linux Foundation Platinum Sponsor content was contributed by Tencent._ + +-------------------------------------------------------------------------------- + +via: https://www.linux.com/news/the-state-of-the-art-of-microservices-in-2020/ + +作者:[Linux.com Editorial Staff][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://www.linux.com/author/linuxdotcom/ +[b]: https://github.com/lujun9972 +[1]: https://www.linux.com/wp-content/uploads/2020/11/microservices_diagram_a.png +[2]: https://tarscloud.org/foundation/index +[3]: https://www.linuxfoundation.org/press-release/2018/06/tars-and-tseer-form-open-source-project-communities-under-the-linux-foundation-to-expand-adoption-and-pace-of-development/ +[4]: https://www.linuxfoundation.org/blog/2020/03/the-tars-foundation-the-formation-of-a-microservices-ecosystem/ +[5]: https://www.edx.org/course/building-microservice-platforms-with-tars diff --git a/sources/talk/20201114 How I channel my inner Star Trek character at work.md b/sources/talk/20201114 How I channel my inner Star Trek character at work.md new file mode 100644 index 0000000000..ed902f4bfd --- /dev/null +++ b/sources/talk/20201114 How I channel my inner Star Trek character at work.md @@ -0,0 +1,57 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How I channel my inner Star Trek character at work) +[#]: via: (https://opensource.com/article/20/11/inner-star-trek) +[#]: author: (Jen Wike Huger https://opensource.com/users/jen-wike) + +How I channel my inner Star Trek character at work +====== +I am more of a Deanna Troi in my role as a community manager. How about +you? +![Open source stars.][1] + +In a recent [Twitter thread][2], I self-identified as "some days Deanna, some days Riker." Others shared their own "Star Trek Spectrum," from Worf to O'Brien and McCoy to Neelix. That led me to think more about Deanna Troi: the half-human, half-Betazoid empath who served as Lieutenant Commander and the ship's counselor for most of _Star Trek: The Next Generation_. + +Ever since my middle school days, I felt a kinship with her as I watched her observe and respond to situations and the people in them. Today, as an open source community manager, I think about how these traits are vital to the role of nurturing and guiding a group of people. Here's how I channel my inner Deanna Troi at work. + +![][3] + +opensource.com + +### Holding space + +Instead of speaking the next word, I take a breath. I try not to rush in with something to say in response to the things that happen and in response to conversations with the people that make up our community. I listen, and then when the time is right, I speak. That can be hard especially when I am feeling confident in how to move forward and am eager to show the way. I've learned that taking a beat and slowing down, rarely does harm if coupled with clarity around the situation. Sometimes it is important to act quickly, to step in and guide the community around an issue, but even swift action can be accompanied with thoughtful deliberation.  + +To achieve this, also give yourself space to think and slow down. If you need to think through something, go for a walk, make a tea or meal, and say no to that next meeting to give yourself the time you need to do your job with integrity.  + +### Radical empathy + +Truly hearing and listening to others, then digesting that information, often leads to empathy. Even when we don't feel the same way—often due to differing perspectives—we can get closer to empathizing with others when we listen closely and fully. And why would we want to do that? Because understanding someone allows us to relate to them, and then we can find a solid place from which to nurture and guide them. + +Getting to know each person individually is something I recommend, and if the community you are a part of is too big for that, don't shut down the idea of reaching out at all. Start from where you are, and connect with the next closest person—you have a meeting set up to onboard them, you interacted on social media, you fixed a bug they submitted, etc. This kind of growth is authentic and sustainable. + +### Tapping into intuition + +At first glance, it may seem that those best fit for a role at the helm are those who identify as extroverted and easily heard, however, I've found those who know how to silence the noise and follow their own inner certainty are those who can inspire others to do the same. And that is where the power is, inside all of us, not just one of us. + +Open source communities are continuing to be called upon to innovate, act, and lead, and these traits are important not just for leaders to cultivate but for everyone involved in working together as a group to achieve a goal or collaborate on a project. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/11/inner-star-trek + +作者:[Jen Wike Huger][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/jen-wike +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/osdc_520x292_opensourcestars.png?itok=hnrMETFh (Open source stars.) +[2]: https://twitter.com/JenWike/status/1318188923298906113 +[3]: https://opensource.com/sites/default/files/pictures/deannacover001.jpg diff --git a/sources/talk/20201125 Got something to say- How to get started writing.md b/sources/talk/20201125 Got something to say- How to get started writing.md new file mode 100644 index 0000000000..8af5d1ea10 --- /dev/null +++ b/sources/talk/20201125 Got something to say- How to get started writing.md @@ -0,0 +1,87 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Got something to say? How to get started writing) +[#]: via: (https://opensource.com/article/20/11/how-write-article) +[#]: author: (Jen Wike Huger https://opensource.com/users/jen-wike) + +Got something to say? How to get started writing +====== +A community manager and editor shares her inspiration and tips for +finding and sharing your expertise with others. +![A person writing.][1] + +Well, I suppose after all this talk of how to find your story and then write your story, I should make a post about how to do just that. I've broken it down into three sections: how to find your story, how to write your story, and how to share it and get it published. + +During the All Things Open virtual event this year, I was invited to share my tips, and now you can watch that. It's about 20 minutes with some questions and commentary at the end. + +You may have a clear reason why you want to write, or you may need some prodding. My belief is that we all have something valuable to share. Really. And the reasons are made clear in the survey answers in [this document][2]. One reason that resonates with many in the tech world is "because my manager wants me to," which could lead to a promotion or increased thought leadership in your field. Another great one for those working on an open source project is, "it is an act of giving back to the community... with the simultaneous goal of getting your name out in the community and building connections for other career opportunities." + +### How to find your story + +Do your homework, but this time hopefully it's a bit more fun and a bit less time-consuming. By all means, take the afternoon or the week to complete [this worksheet][3], but if you have an hour during work, this can fit into your busy schedule. Although I'm happy to take a look and help guide you once you get started, no one is grading your responses. They're yours, and their only goal is to get you closer to that elusive article. Whether it's your first, or your 100th, we all have reasons why it can be difficult to write. + +The [worksheet][3] asks a variety of questions in a "choose your own adventure" type way. You can answer all of the questions, or skip to the parts that interest you most. It starts with asking: + + * What do you do at your job? + * What are you passionate about? + * What communities are you or do you want to be a part of? + + + +After you complete the worksheet to your liking, take a break. A few minutes, a few hours or days, and go back to it. What jumps off the page and still rings true? Perhaps it's now plainly obvious what your article should be about. If you still need a way to prioritize your choices, label each one with one of these time-based categories: + + * Easy to write (you know this topic backward and forwards) + * Quick to write (explaining is fast and a short read) + * Hard to write (you may need to think through the process and list out many details) + * Time-consuming to write (this may take some additional research in addition to being highly detailed) + + + +### How to write an article + +First, sit down and make yourself write an outline. I know, I know... boring! But this can save you a lot of time. Once you've landed on an outline that works for you and your topic, once you sit down and start writing, there's a better chance you'll get into the flow, following your outline, and knock it out in less time than you imagined. And in an amount of time that feels good to you and gives you a good feeling about writing, especially again and again. + +Then, share it with a friend or an editor. Friends can be a quick and easy outlet, especially if they are of the writer sort. And, I encourage you to send it to an editor if you have a particular publication in mind for where you'd like to try to get it published. While you wait, buff up on your writing by taking a look at [a solid style guide][4]. + +Once you get to a place where you feel ready to get writing, review the format of an article and identify who your audience is. The format of an introduction that describes what the article is about and what the reader will learn, the body of the article focused on walking the reader logically through the steps or phases with straightforward headers, and a conclusion that gives final thoughts and a summary. + +I like to write using a shareable document for easy collaboration and editing with others and editors. + +### How to get your article published + +First, decide whether you want to self-publish, on your own blog or a place like Medium, or if you want to get your article published on a publication like Opensource.com or Linux Today. + +If you're reaching out to a publication, try to find information about how they would like you to submit your article. Some have webforms, some want you to simply send them an email. Some, like us, [have both][5]. Let them know who you are, what you wrote about, and perhaps why you wrote about it. + +For example: My name is Jen Wike Huger. I'm a community manager and editor for Opensource.com, so my expertise is writing and working with authors. My article is about how to find your story, writing, and getting published. + +### Wrapping up + +The slide deck, worksheet, survey answers, and style guides for writing are [on GitHub][6]. + +The slides are from the All Things Open presentation. The worksheet is to help you decide what to write about, to find your story. The survey answers will inspire you and answer the question: Why should I write about what I know anyway? And the style guides will help you before and during the actual writing process, covering grammar, formatting, and more. + +There are a ton more details baked into every part of this, so if you have specific questions, I welcome them in the comments, via email, or on Twitter. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/11/how-write-article + +作者:[Jen Wike Huger][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/jen-wike +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/rh_003784_02_os.comcareers_resume_rh1x.png?itok=S3HGxi6E (A person writing.) +[2]: https://github.com/JenWike/getpublished/blob/main/Why%20write_.txt +[3]: https://github.com/JenWike/getpublished/blob/main/Worksheet_%20How%20to%20find%20your%20story.odt +[4]: https://github.com/JenWike/getpublished/blob/main/styleguides +[5]: https://opensource.com/how-submit-article +[6]: https://github.com/JenWike/getpublished/ diff --git a/sources/talk/20201127 4 questions about AI ethics and how open source can help.md b/sources/talk/20201127 4 questions about AI ethics and how open source can help.md new file mode 100644 index 0000000000..7417e413bc --- /dev/null +++ b/sources/talk/20201127 4 questions about AI ethics and how open source can help.md @@ -0,0 +1,85 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (4 questions about AI ethics and how open source can help) +[#]: via: (https://opensource.com/article/20/11/ai-ethics) +[#]: author: (Sahana Sreeram https://opensource.com/users/sahanasreeram01gmailcom) + +4 questions about AI ethics and how open source can help +====== +Open source resources could provide effective solutions to some key +ethical considerations for artificial intelligence. +![A robot arm illustration][1] + +As a high school student, I've become very interested in artificial intelligence (AI), which is emerging as one of the most impactful innovations of recent times. This past summer, I was selected for the [AI4ALL][2] program, where we learned how to develop AI systems using Python. + +For my final project, I created an object-detection program and integrated it with a virtual drone simulation. Throughout the project, I was able to use open source frameworks, including [TensorFlow][3], [Keras][4], [Scikit-learn][5], and [PyTorch][6], to aid in developing the object-detection machine learning (ML) algorithm process. + +By doing this project and using other open source frameworks like [Linux][7], [Apache Kafka][8], and [ElasticSearch][9], I realized the impact of open source technologies on AI system development. Access to these powerful, flexible technologies enables people to experiment with and develop AI systems. + +I discovered another important aspect of AI when I attended a seminar at [William & Mary][10] about AI and ethics. As we discussed some of the ethical concerns surrounding AI systems, I started wondering: How do I make sure that the systems I'm developing are ethical? + +To answer my question, I interviewed three experts: [Alon Kaufman][11], PhD, CEO of Duality Technologies; [Iria Giuffrida][12], PhD, a law professor at William & Mary; and an executive in the fintech industry (name kept confidential upon request). I am very grateful to these experts for giving me their valuable time, fueling my curiosity, and inspiring me with their journeys in this field. + +### How important of a role does ethics currently play in AI systems? + +As more advances are made with AI, society is starting to appreciate the importance of ethical implications. However, the discussions about ethical values in AI system development are still an academic exercise, Dr. Kaufman says. Today, much of AI, and especially ML models, remains a "black box" because advanced algorithms and complex AI technologies (such as deep learning) produce models that are not self-explainable. Without having explainable AI/ML models, it's hard to introduce ethical considerations into the conversation.  + +For Dr. Kaufman, the industry's focus today is on data security and protection. As more smart technology is developed, it's getting easier to acquire data. The large amounts of data handled in AI systems make them vulnerable to cyber breaches. + +While it is certainly vital to build data protection measures for AI systems, it is becoming critical to shift the focus to other ethical implications, such as privacy and machine bias. + +### Is ethical AI development a good goal for the future, or is it wishful thinking? + +The short answer is that it is a reasonable goal to create ethical AI systems, but it will take time. + +"Ethics" is a difficult concept to define. One approach is to look at ethics through a three-pronged methodology: security, privacy, and fairness. Most of the industry is now focused on security, and a practical next step could be to address the issues of privacy and ensuring data anonymity. "Privacy-enhancing technologies, such as secure computing and [synthetic data][13] could offer assistance in this process," explains Dr. Kaufman. Only after finding solutions to the security and privacy areas of ethics is it reasonable to venture into machine fairness and bias. + +There are many factors to consider in the development of unbiased AI. "The first step is the deployment of active-learning models into society, followed by the actual development of [fair systems][14]," says the fintech industry expert. He explains that when ML equipped with active learning is deployed, society's own biases are often imposed on the model, even unknowingly, creating very flawed systems. When developers create AI systems, their preconceived notions must never be injected into the system code, says Dr. Kaufman. These are some of the key areas that must be addressed in developing unbiased models. + +### How early should students be exposed to ethical considerations in AI/ML? + +It's increasingly important to learn not only about computer science principles but also about how to build ethical models. Professor Giuffrida says computer scientists and AI developers have not explicitly been trained to think about the ethics behind their systems. This is why the development of bias-proof systems cannot be a linear process, she says; they must go through multiple review levels to minimize injecting bias in the machine process. + +Professor Giuffrida emphasizes that AI development should be treated as an interdisciplinary study, meaning that it is not just developers who are in charge of creating accurate and ethical systems—that's an enormous responsibility to put on one group. But introducing ethical concepts to aspiring AI engineers at a foundational level could accelerate building sustainable, functional, and ethical systems. + +### Will ethics come at the expense of innovation? + +This was the main question I kept coming back to throughout the interviews. During the AI4ALL course, we explored the recent [Genderify fiasco][15], which was AI software intended to identify a user's gender based on several data points, including name, email address, and username. When launched for public use, the results were highly inaccurate—for example, the name "Meghan Smith" was assigned female, but "Dr. Meghan Smith" was assigned male. These biases led to the service's failure. More comprehensive ethical reviews and tests conducted before launch could make this type of product successful, at least initially. + +All three experts voiced the idea that ethical boundaries are becoming necessary. According to the fintech executive, "Reasonable ethical constraints will not limit innovation—companies must eventually figure out how to innovate within these boundaries." In this fashion, ethical considerations could increase sustainability and success for a product—rather than putting a complete stop to AI development. Venture capitalist Rob Toews offered an interesting perspective on [regulating AI][16], and I recommend this article if you want to learn more about this topic. + +Ultimately, introducing ethics into pure AI is a daunting but necessary step to secure AI's viability in our world. Open source resources could provide effective solutions to some key ethical considerations, including comprehensive system testing. For example, the [AI Fairness 360][17] open source toolkit by IBM assesses discrimination and biases in ML models. Open source communities have the ability to develop tools like this to provide greater coverage and support for ethical AI systems. In the meantime, I believe it is my generation's responsibility to build bridges between creating revolutionary AI technologies and considering ethical implications that will stand the test of time. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/11/ai-ethics + +作者:[Sahana Sreeram][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/sahanasreeram01gmailcom +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/robot_arm_artificial_ai.png?itok=8CUU3U_7 (A robot arm illustration) +[2]: https://ai-4-all.org/ +[3]: https://www.tensorflow.org/ +[4]: https://keras.io/ +[5]: https://scikit-learn.org/stable/ +[6]: https://pytorch.org/ +[7]: https://www.linux.org/ +[8]: https://kafka.apache.org/ +[9]: https://www.elastic.co/ +[10]: https://www.wm.edu/ +[11]: https://www.linkedin.com/in/alon-kaufman-24067b154/ +[12]: https://law2.wm.edu/faculty/bios/fulltime/igiuffrida.php +[13]: https://en.wikipedia.org/wiki/Synthetic_data +[14]: https://en.wikipedia.org/wiki/Fairness_(machine_learning) +[15]: https://www.theverge.com/2020/7/29/21346310/ai-service-gender-verification-identification-genderify +[16]: https://www.forbes.com/sites/robtoews/2020/06/28/here-is-how-the-united-states-should-regulate-artificial-intelligence/?sh=1c242ebc7821 +[17]: https://aif360.mybluemix.net/ diff --git a/sources/talk/20201127 Comparing the similarities and differences between inner source and open source.md b/sources/talk/20201127 Comparing the similarities and differences between inner source and open source.md new file mode 100644 index 0000000000..98bfd01bb2 --- /dev/null +++ b/sources/talk/20201127 Comparing the similarities and differences between inner source and open source.md @@ -0,0 +1,87 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Comparing the similarities and differences between inner source and open source) +[#]: via: (https://opensource.com/article/20/11/inner-source) +[#]: author: (Nithya Ruff https://opensource.com/users/nithyaruff) + +Comparing the similarities and differences between inner source and open source +====== +Open source principles can be applied within a company to access the +benefits of collaborative development. Here's how. +![two women kanban brainstorming and brainmapping with post-it notes on a whiteboard ][1] + +Open source software (OSS) has been around since the 1990s and has thrived, quickly growing to become mainstream. It is now more well understood around the world than it has ever been before. Some refer to it as FOSS to highlight the Freedom part of open source (Free and Open Source Software). And in 2014, at OSCON, the term "inner source" was debuted, and people started talking about how to use the principles of open source, but inside of a company. It raised several questions for those unfamiliar with the term, which I hope to answer with this article. For example, what is similar about the two, what is different, the company roles involved in the two, is inner source taking the energy away from open source, etc. These are all fair questions, and as my organization practices both and is involved in both movements, I want to take some time to share insight with this audience as a developer, as a company, and as an open source enthusiast. + +There are two principal elements that make open source successful. The first is that it is licensed under OSS licenses that promote and support free distribution of the source with the binaries for people to use any way they want. When GPL (General Public License) was introduced in the 1990s, it was revolutionary—no charge, source included, and no restriction on use. That helped proliferate open source projects like Linux and allowed rapid innovation. + +The other particularly essential element is the way open source software grows and develops. It happens through a community of people who are most often not in the same organization or geographic location. They come together because they believe in the solution or mission of the project. Because these people came from different development cultures but needed to work on common projects, they evolved norms for working together, such as how they communicate with each other, how decisions are made, and how to review new submissions. This codification of how disparate teams work without being in the same organization is unique and powerful. This type of development is known as "collaborative development." + +Not all communities are effective, but the ones who figure out how to work together often have some common elements: + + * Governance: They work out how the project will govern itself—decisions, roles, reviews, meetings, mission, budgets, organization structures, etc. + + * Communication: They figure out how to work with people across time zones, across cultures, and organizations. For example, documenting decisions on a mailing list vs. live discussions. Providing people with 24 to 48 hours to review and respond to a question or decision is another good practice established to allow people in different zones and different work situations to collaborate. + + * Common tools: Review and communication are imperative to development. Tools such as GitLab and GitHub build in collaborative practices to enable working across teams. + + * Architecture: Projects are often architected for maximum engagement into components, API (Application Programming Interface), sub-systems so that not everyone needs to know everything, or they don’t change the whole project when they make changes. + + + + +Both in response to digital challenges as well as changing customer expectations, enterprises outside of the tech vendor space, in particular, have been transforming how they build products and services as well as how they engage with their customers. And with the 2020 COVID-19 pandemic, many companies and organizations have gone virtual and fast-tracked their digital transformation plans to meet changing customer and market needs. And some accelerated their plans to capture new opportunities and support changes in how customers consumed their services. Teams that relied on physical proximity, hallway conversations, and other elements of development were faced with a need to change how they worked. Many of them realized that they could turn to the collaborative development model of open source for examples of how to work remotely and effectively. + +Even before the COVID-19 pandemic, because of early digital transformation plans, companies had already begun adopting and working with open source and had realized the benefits of open innovation. The need to go faster, reduce costs, breakdown silos across the company, and reuse vs. reinvent has created a spur to do more collaborative development or open source-style community development inside the company walls. + +The benefits of collaborative development can be applied in many ways: + + * Collaboration among remote and geographically distributed organizations + + * Creating a more open and collaborative culture inside a company + + * Creating communities around common interests and common problems + + + + +The traditional way companies develop software inside companies is quite different from the open source collaborative model. Because of how budgets, organization structures, and incentives work, teams work in silos, are top-driven, and have no incentive to share and collaborate across the organization. Teams often report to the same organization, resulting in low documentation of decisions and low leverage of experts across the company. + +Many organizations have been experimenting with collaborative development for some time. At Comcast, for example, teams called it enterprise source. But then the term "inner source" was created by Tim O’Reilly, founder, CEO, and publisher at O’Reilly publishing in 2001. (This [interview][2] with Tim is a remarkable story of how he came to coin this term). He talks about how the modularity of code and the access to source was a huge driver for collaboration, even more than the license itself. He calls it the "Architecture of Participation." Soon after, in 2015, Danese Cooper, who was running the OSPO (Open Source Program Office) at PayPal at that time, [introduced this term][3] at OSCON. She also shared what PayPal had been doing inside the company to break down silos and to create collaboration. The [InnerSource Commons][4] non-profit foundation was also established to allow people to collaborate on their experiences, patterns, and best practices. Here is a more formal definition of inner source: + +> "Inner source is an adaptation of open source practices to code that remains proprietary and can be seen only within a single organization, or a small set of collaborating organizations. Thus, inner source is a historical development drawing on the open source movement along with other trends in software." +> +> —From [_Adopting InnerSource_][5], O’Reilly Publications + +The biggest similarities between open source and inner source involve the collaborative development model. Working across teams inside an organization on common source code is a culture change for a traditional enterprise. Both versions of it need sponsorship and support from the top to thrive inside an organization. + +The biggest differences are what motivates one to start an inner source project over an open source project. The often-repeated wisdom of open source communities is that people get into it because they have an "itch to scratch." Often, trying to solve a technical issue is the reason that they start a new project. With inner source, there may be more of an organization-wide reason to start opening their code and collaborating with other teams. One main reason is to enable another team to work more effectively with the platform or to reduce a duplicate effort. Some organizations have chosen a default approach of opening all repositories for anyone in the company to see and use or collaborate on. One huge driver has been to stage it as an inner source project before fully open sourcing it. This allows the team to hone a good collaboration strategy and practice before open sourcing. + +I like the model that PayPal used—having inner source and open source be a part of the same organization. There are shared practices, skills, and tools that can be used across the two. At Comcast, both practices live in the Open Source Program Office. The inner source team has built a guild with members of architecture, security, and leadership to develop the practice and governance of our inner source projects. You can listen to Comcast Open Source Program Manager and InnerSource leader Brittany Istenes [talk][6] to hear more about what we did with the guild and scaling inner source back from the InnerSource Commons Fall 2020 Summit. + +While some people criticize the inner source movement and say that it has distracted from the open source movement, it has actually accelerated open source collaborative practices inside organizations. While most companies use open source, few were deeply engaged in communities or understood how open collaboration works. The fact that the collaborative development model can be used inside a company to do product or organizational work has led to a deeper understanding and better development practices at Comcast. I see a natural growth from this to more contributions and more engagement with open source communities as teams feel more confident in engaging through their inner source work. + +No matter what you call it—inner source, enterprise source, collaborative development—more collaboration inside the company is a particularly good thing. Better development practices, documentation, onboarding, and mentoring are often direct results. If you are interested in more information, check out [innersourcecommons.org][7] for great talks from several companies practicing inner source, including Comcast. I believe that inner source is the next phase of open source development. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/11/inner-source + +作者:[Nithya Ruff][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/nithyaruff +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/whiteboard-brainstorming-brainmapping-design-thinking-postits-kanban.png?itok=Is2Tg1Jk (Brainstorming with post-it notes on a whiteboard) +[2]: https://www.youtube.com/watch?v=2HR0D8_tKoA&t=573s +[3]: https://www.youtube.com/watch?v=r4QU1WJn9f8 +[4]: https://innersourcecommons.org/ +[5]: https://www.oreilly.com/library/view/adopting-innersource/9781492041863/ch01.html +[6]: https://www.youtube.com/watch?v=RenQ8B7aX84 +[7]: http://innersourcecommons.org diff --git a/sources/talk/20201128 Why failure should be normalized and how to do it.md b/sources/talk/20201128 Why failure should be normalized and how to do it.md new file mode 100644 index 0000000000..5ec94852ce --- /dev/null +++ b/sources/talk/20201128 Why failure should be normalized and how to do it.md @@ -0,0 +1,90 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Why failure should be normalized and how to do it) +[#]: via: (https://opensource.com/article/20/11/normalize-failure) +[#]: author: (Lisa Seelye https://opensource.com/users/lisa) + +Why failure should be normalized and how to do it +====== +"Everybody is perfect, except you." This toxic thought can creep in and +ruin your confidence. Here's how to normalize failure during the +learning process and remember that everyone makes mistakes. +![failure sign at a party, celebrating failure][1] + +All of your heroes have failures under their belts—from minor mistakes to major disasters. Nobody knows how to do everything automatically, and the process of learning is usually a messy one. So why is the perception that everyone but you knows what they’re doing so common? Why do we externalize our successes but internalize our failures? + +How does it make you feel when you struggle to learn something new, then see another person take their Jira card away and return at the end of the sprint with something fully fleshed out and working, gushing about it at the demo? Sure, you closed your card too, but it was really hard! There was a new algorithm, a new programming language, a new system all to be learned. How did she make it look so effortless? + +The truth is, she might have struggled with the same issues you did and wondered how you made it look so effortless! + +### Failure is normal, healthy, and invisible + +Whether we call them mistakes, bad assumptions, or some other euphemism, it's hard not to judge ourselves or expect better of ourselves, especially compared to other people. + +My background is largely in Linux systems administration, and in this line of work, it is often a matter of "when" and not "if" we will have a production service disruption. Those service disruptions can happen for various reasons—sometimes it's because a person made a mistake. Setting aside the discussion around controls to mitigate human error, we can see plain as day that I, Lisa Seelye, made a mistake that directly caused a production problem. + +Whenever a group of sysadmins gets together, we usually end up talking about our work, and inevitably, we get around to stories of production service disruptions that we’ve been a part of (or caused). It’s cathartic to hear how badly other people have messed up and then look around and see that we are all human and making mistakes is part of that. + +I feel that this kind of sharing is vital to the success of people in the information technology sector. + +### Why should we share? + +In addition to sharing our mistakes in order to normalize them, I also believe that it is equally important to share our learning processes—this is both to drive home the idea that we all start somewhere and that learning is often filled with failures and misconceptions. + +As an individual, I need to remind myself that it may only appear that my peers return from a week working on a card with a fully fleshed-out solution. Reality may, in fact, be that they don’t understand the requirements, the codebase, the language, the algorithms needed, etc. Either way, it’s a logical fallacy to believe they do not face these challenges because of the appearance of the final product. + +### But why should we share? + +We should share our learning experiences because we all benefit from hearing about the challenges other people face and how they overcome them. If the Jira card wasn’t clear, then we can do better. If the algorithm wasn’t clear, then maybe education can be done around it. + +Most importantly, we need to normalize that it’s okay not to know everything, that it’s okay to still be learning, and to ask for help. Setting an example for new or more junior engineers is important. In our industry, we deal with extremely complex systems that can interact with one another in strange or unexpected ways. In many cases, it is simply not possible for one person to know everything. Being open about our learning processes and our mistakes can lead to tighter bonding. + +Do new engineers on your team have the set expectation that it’s okay to interrupt and ask questions? Saying it on day one is easy, but practicing the value is another thing. How are approachability and openness demonstrated in your team? + +### My learning opportunities + +It could be very easy to title this section "my mistakes" and then rattle off all the times I’ve made mistakes, but that doesn’t quite illustrate the point. I recognize these mistakes, but they’re also events that expanded the understanding of my craft. While I didn’t set out to intentionally do any of these things, I certainly learned from them. + +I have accidentally dropped (deleted) a customer’s database. It was lucky for everyone that it was a beta-phase database and no further harm was done. I learned a valuable lesson that day: be very watchful of what code is doing, and be careful about what environment you are working in. + +One day, while performing routine maintenance with an odd DNS setup, I accidentally broke the ability for customers to provide credit card information to the secure site. We had two "payments" DNS records that served to override a wildcard DNS record, and I assumed that the second "payments" record was still present. It wasn’t. And then the wildcard record took over, and the DNS started behaving like "payments" wasn’t special at all anymore. Of course, I had no idea this was happening at all—it wasn’t until my maintenance was over that I learned of the folly. + +Customers weren’t able to provide payment information for almost two hours! I learned my lesson, though: when there is something special about a particular configuration, be sure to make sure it stays special throughout its lifetime. When DNS gets involved, all kinds of things can break. + +Before I started speaking at conferences, I was an attendee, and I watched talks online. Pivoting to speaking myself, I was worried that I’d say too many "umms" and "uhs" and that my jokes would fall flat. The speakers I enjoyed over the years seemed to not have those problems at all, while I was unpolished. + +But once I got up on stage, I found that my perception had changed. I had practiced my talk with an audience and listened to their feedback—turns out I had a little polish. In front of the audience, I did misspeak and not say something exactly how I wanted, but it didn’t matter. What I didn’t realize from my vantage point in the audience is that the audience wants the speaker to succeed, and the speaker can shift directions in their talk without the audience knowing. + +I certainly have made and continue to make those sounds, and I have even had to correct major factual information the night before a talk, but the audience never knows. The audience sees what I show them and, because they want me to succeed, they forgive my "umms" and "uhs." + +I admit that I am not perfect. I ship bugs, and I try to learn from them. + +### How to share + +Sharing the difficulties we’ve encountered along the learning process or in our day to day career is important, though just as important is how they are shared. I share the things I’ve learned (the hard way) with frankness and no self-judgment. It is in this spirit that I think we should all share. I’m not a bad person because I’ve made mistakes, and neither are you. + +How, then, should we share? Who is the audience? + +In the midst of a production service disruption, like with the DNS payment situation above, there’s no room for coyness or hiding anything. The most important thing is to make key stakeholders aware and then rally to fix the situation. The audience is first internal—your team, business leaders, the support team. Next, the audience is outward-facing—the customers. It is wise to involve communications experts when crafting that outward message. + +When sharing with a junior engineer, we need to normalize the learning process. People aren’t born knowing how pointers in C work, so we all need to learn what the pitfalls of pointers are. It’s okay to need to learn new skills at any skill level, and it’s also okay to need to reinforce those skills. The message we send should be free of judgment. + +So write a blog post, make a Twitter thread, share frustrations in Slack channels, ask for help. Together we can dismiss the myth that everybody's perfect, except you. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/11/normalize-failure + +作者:[Lisa Seelye][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/lisa +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/fail_failure_celebrate.png?itok=LbvDAEZF (failure sign at a party, celebrating failure) diff --git a/sources/talk/20201206 Openness is the key to innovation, history shows.md b/sources/talk/20201206 Openness is the key to innovation, history shows.md new file mode 100644 index 0000000000..9bb9775817 --- /dev/null +++ b/sources/talk/20201206 Openness is the key to innovation, history shows.md @@ -0,0 +1,106 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Openness is the key to innovation, history shows) +[#]: via: (https://opensource.com/open-organization/20/12/open-innovation-history) +[#]: author: (Ron McFarland https://opensource.com/users/ron-mcfarland) + +Openness is the key to innovation, history shows +====== +History demonstrates the kinds of organizational structures that foster +innovation: open, communal, and humble. Here are just two examples. +![Team checklist][1] + +In the [first part of this article series][2]—an extended review of the book [How Innovation Works][3] by [Matt Ridley][4]—I examined Ridley's characterization of innovation: it's gradual, incremental, and collective, and involves extensive collaboration between parties. This, I argued, is why [open organization principles][5] are so important and play a major role in fostering innovation. + +In [part two of the series][6], I reviewed Ridley's assessment of the environments where innovation and discovery thrive, and I demonstrated some essential characteristics of the innovation process. + +Now, in this concluding part of my review, I bring these ideas alive by recounting case studies of innovative discoveries throughout history. + +### Innovation throughout history + +In _How Innovation Works_, Ridley mentions that innovation is mostly a "bottom-up phenomenon." For example, throughout the 19th century, as Britain and Europe developed new railways, the steel industry, new applications for electricity, the textile industry, and many other breakthroughs, governments weren't involved. Only after the fact did governments play the role of regulator and standards creator. Sometimes, governments even played the role of the customer or user. + +The same was true in America in the early 20th century. There were few public subsidies for research and development before 1940. And after World War II, the Japanese miracle was a function of private corporations backed by a vast ecosystem of small enterprises. Most efforts resembled open organizations—a modest group of dedicated hands-on, ground floor members. That's where most innovation originated, on the ground floor according to open organization principles. + +By contrast, the Soviet Union was a very clear case of a public governmental entrepreneurial state; it funded a great deal of research centrally, and allowed virtually no involvement from private enterprise. Innovation in transportation, food production, health care, and consumer products suffered as a result. (In this environment open organization principles were not in use.) + +Innovations come from humble places, Ridley's argues, and large, bureaucratic corporations were not particularly good at developing innovative products. Instead, small, loosely assembled communities (open organizations with front line teams) have been more innovative throughout history. They have been far more capable of exploring new concepts, particularly if they have a wide base of contributions to work with. + +Let me review two historical examples of this, drawn from Ridley's work (one brief, one lengthier). + +### Lighting every house (the light bulb) + +Who invented the light bulb? Easy answer: Thomas Edison. + +But at least a dozen other people were working on similar technologies around the same time, even before Edison, as Ridley documents in detail in _How Innovation Works_. Edison, however, [gets recognition for the invention][2]. + +Through some 50,000 trial-and-error experiments, a full complement of staff developed a usable, affordable light bulb for interior and room lighting (Edison's team tested roughly 6,000 plant materials until it found the right kind of bamboo for the bulb's filament). The invention made both oil lamps and gas lamps things of the past. Perhaps better than anyone else at the time, Edison knew that innovation was largely a team effort. He hired groups of skilled craftsmen and scientists (totalling 200 people in all) and worked them incredibly hard. Their collaboration, iterative and adaptive testing, and sharing eventually led to the registration of more than 400 patents in six years. Edison supported his innovative teams extensively, stuffing his workshops with every kind of material, tool, and book. His goal was not simply to inspire invention; it was to turn ideas into practical, reliable, and affordable items—the result of extensive application of open organization principles. + +### Two approaches to flight (the powered aircraft) + +Now let me offer a more detailed example, one focused on the innovation of powered aircraft. To better illustrate the advantage of an open organizational approach, I'll juxtapose two approaches to this innovation. + +#### Samuel Langley's approach + +In 1903, the East Coast of the United States saw the first airplane flight by Samuel Langley. It impressed the US government, which expressed a desire to invest in the development of powered flight (powered flight, of course, would allow people to travel longer distances). + +Innovations come from humble places. + +Initially, the American government supported Langley's experiments with an investment of $50,000. Later, it offered another US$20,000. Langley had convinced the government he could build a powered plane that would stay in the air longer than a simple glider (Langley was a professor from New England, an astronomer, and a well-connected head of the Smithsonian Institute in Washington, DC, so his reputation would have seemed to support his claims). + +Because of his confidence, he decided to _keep all his research and experiments confidential_. He could not have been more closed in his approach to research and experimentation. + +This went on for seven years, until a test plane was finally ready for presentation to the government. Langley was not a hands-on experimenter and was not willing to pilot his prototype plane himself (he commissioned Charles Manly). The plane crashed after flying just a short distance, to everyone's disappointment. Langley's reputation never recovered. The fiasco led to the US government pulling all funding for the project, and it gave up on powered flight after a decade of wasting money. + +From the perspective of someone thinking with open organization principles, Langley would seem to have done everything wrong. He spent lots of money, depended on a single authority (the government), consulted with very few outside people, and built the full aircraft from scratch instead of building and testing components in an incremental way, by experimenting with different designs, shapes, sizes, and weights. He built _no community_ to work on the project. He _included_ only the minimum necessary outsiders. He was _not transparent_ of his activities or concerns. He did not establish step-by-step milestones in which he could make _adaptations_ if need be. And, he _collaborated_ with as few people as possible. + +#### The Wright brothers' approach + +But just south of Langley's failure, in an area called [Kitty Hawk][7], with almost nobody watching, two brothers from Ohio were busy achieving innovation in powered flight, and by spending only a fraction of what Langley did. They were Orville and Wilbur Wright. + +The Wright brothers' initial test flight lasted 12 seconds and traveled 40 yards (37 meters). Their second flight (later that day) lasted almost one minute and covered more than 800 feet (244 meters). Just five people were present to observe these successful powered flights. + +Thinking again with open organization principles, we might say the Wright brothers did everything right. + +Innovation happens when someone creates a community while working on a problem. Through concurrent community collaboration, that group might make discoveries that lead to an innovation. + +These two brothers were not well-known researchers (or even engineers for that matter). They simply were experienced bicycle builders and had a small shop. They were diligent craftsmen and loved building things. They simply wanted to address the challenges and problems of powered flight through building an aircraft. Fueled by those passions, they started building a development team (_community_ building), which included others in the project to bring in valued experience. They _included_ key outside people. They were very _transparent_ regarding their activities and concerns (more on this in a moment). They established step-by-step milestones in which they could make _adaptations_ if need be. + +Moreover, they _collaborated_ with as many people as they needed to, gathering expertise where they could find it. First they wrote to Otto Lillienthal in Frankfurt, Germany**,** a famous designer of gliders. They also approached a rather eccentric French-American in Chicago by the name of Octave Chanute, who studied the powered flight problems to overcome and published papers on them. These are examples of inclusivity at its best—approaching people far different than them to achieve something. Thorough documentation of the Wright brother's collaboration with Chanute (and his extensive network of like-minded thinkers) helped solidify their basic design for a powered aircraft. And just by luck, someone the Wright brothers hired to work in the bicycle shop was an extremely good mechanic and loved designing machines. His name was Charlie Taylor. The internal combustion engine was just being developed at that time, and the Wright brothers knew that the motors on the market were too heavy for an aircraft, so Charlie built one from scratch, using aluminium (a much lighter material). + +This more open approach to innovating in the field of powered aircraft is the one that eventually gave rise to the inventions (and industry) we enjoy today and brought the Wright brothers fame. + +### History lessons + +Think about both those examples, two case studies of innovation through open organization principles. Both indicate that, for _any_ innovation, quite a few people are required (not lone individuals). In both cases, inventors needed to "cross-pollinate" ideas in two ways: + + 1. concurrently, working together directly, and + 2. learning sequentially over time. + + + +Our lessons from history illustrate these approaches to innovation. Innovation happens when someone creates a _community_ while working on a problem. Through concurrent community collaboration, that group might make discoveries that lead to an innovation. Sometimes, however, those communities fail. But because they _document_ their work as they collaborate, another person (and community) can replicate what they've done and improve upon it (sequential innovation)—perhaps succeeding where the first group did not. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/open-organization/20/12/open-innovation-history + +作者:[Ron McFarland][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/ron-mcfarland +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/checklist_todo_clock_time_team.png?itok=1z528Q0y (Team checklist) +[2]: https://opensource.com/open-organization/20/10/best-ideas-recognition-innovation +[3]: https://www.goodreads.com/en/book/show/45449488-how-innovation-works +[4]: https://en.wikipedia.org/wiki/Matt_Ridley +[5]: https://theopenorganization.org/definition/ +[6]: https://opensource.com/open-organization/20/11/environments-for-innovation +[7]: https://www.google.com/search?rlz=1CAKMJF_enJP874&sxsrf=ALeKk02B7m1kL1nXrRT2cH4-zyr8VV_DDw:1597632027500&ei=u-05X5byJ8Ko-QaRt6HoDQ&q=kitty%20hawk%20museum&oq=kitty+hawk+mus&gs_lcp=CgZwc3ktYWIQARgAMgIIADICCAAyAggAMgIIADICCAAyAggAMgIIADoECAAQRzoHCC4QJxCTAjoHCAAQFBCHAjoICC4QxwEQrwE6BAgAEENQ04sBWIqeAWCvtAFoAXABeACAAY4BiAHEBZIBAzEuNZgBAKABAaoBB2d3cy13aXrAAQE&sclient=psy-ab&npsic=0&rflfq=1&rlha=0&rllag=36111118,-75775286,9090&tbm=lcl&rldimm=17550871878646241173&lqi=ChFraXR0eSBoYXdrIG11c2V1bVobCgZtdXNldW0iEWtpdHR5IGhhd2sgbXVzZXVt&phdesc=B2b85nIlVwQ&ved=2ahUKEwjz-uuLm6HrAhVLFogKHXjGD7YQvS4wAHoECAoQLQ&rldoc=1&tbs=lrf:!1m4!1u3!2m2!3m1!1e1!1m4!1u2!2m2!2m1!1e1!1m4!1u16!2m2!16m1!1e1!1m4!1u16!2m2!16m1!1e2!1m5!1u15!2m2!15m1!1shas_1wheelchair_1accessible_1entrance!4e2!2m1!1e2!2m1!1e16!2m1!1e3!3sIAE,lf:1,lf_ui:1&rlst=f#rlfi=hd:;si:17259280498191889741,l,ChFraXR0eSBoYXdrIG11c2V1bVobCgZtdXNldW0iEWtpdHR5IGhhd2sgbXVzZXVt,y,tBWxg7TmYyk;mv:%5B%5B41.993476711913615,-73.13628440817928%5D,%5B33.753275807154516,-89.35208728632068%5D,null,%5B37.98892655631248,-81.24418584724998%5D,6%5D diff --git a/sources/tech/20151127 Research log- gene signatures and connectivity map.md b/sources/tech/20151127 Research log- gene signatures and connectivity map.md new file mode 100644 index 0000000000..f4e7faa4bc --- /dev/null +++ b/sources/tech/20151127 Research log- gene signatures and connectivity map.md @@ -0,0 +1,133 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Research log: gene signatures and connectivity map) +[#]: via: (https://www.jtolio.com/2015/11/research-log-gene-signatures-and-connectivity-map) +[#]: author: (jtolio.com https://www.jtolio.com/) + +Research log: gene signatures and connectivity map +====== + +Happy Thanksgiving everyone! + +### Context + +This is the third post in my continuing series on my attempts at research. Previously we talked about: + + * [what I’m doing, cell states, and microarrays][1] + * and then [more about microarrays and R][2]. + + + +By the end of last week we had discussed how to get a table of normalized gene expression intensities that looks like this: + +``` +ENSG00000280099_at 0.15484421 +ENSG00000280109_at 0.16881395 +ENSG00000280178_at -0.19621641 +ENSG00000280316_at 0.08622216 +ENSG00000280401_at 0.15966256 +ENSG00000281205_at -0.02085352 +... +``` + +The reason for doing this is to figure out which genes are related, and perhaps more importantly, what a cell is even doing. + +_Summary:_ new post, also, I’m bringing back the short section summaries. + +### Cell lines + +The first thing to do when trying to figure out what cells are doing is to choose a cell. There’s all sorts of cells. Healthy brain cells, cancerous blood cells, bruised skin cells, etc. + +For any experiment, you’ll need a control to eliminate noise and apply statistical tests for validity. If you don’t use a control, the effect you’re seeing may not even exist, and so for any experiment with cells, you will need a control cell. + +Cells often divide, which means that a cell, once chosen, will duplicate itself for you in the presence of the appropriate resources. Not all cells divide ad nauseam which provides some challenges, but many cells under study luckily do. + +So, a _cell line_ is simply a set of cells that have all replicated from a specific chosen initial cell. Any set of cells from a cell line will be as identical as possible (unless you screwed up! geez). They will be the same type of cell with the same traits and behaviors, at least, as much as possible. + +_Summary:_ a cell line is a large amount of cells that are as close to being the same as possible. + +### Perturbagens + +There are many things that might affect what a cell is doing. Drugs, agitation, temperature, disease, cancer, gene splicing, small molecules (maybe you give a cell more iron or calcium or something), hormones, light, Jello, ennui, etc. Given any particular cell line, giving a cell from that cell line one of these _perturbagens_, or, perturbing the cell in a specific way, when compared to a control will say what that cell does differently in the face of that perturbagen. + +If you’d like to find out what exactly a certain type of cell does when you give it lemon lime soda, then you choose the right cell line, leave out some control cells and give the rest of the cells soda. + +Then, you measure gene expression intensities for both the control cells and the perturbed cells. The _differential expression_ of genes between the perturbed cells and the controls cells is likely due to the introduction of the lemon lime soda. + +Genes that end up getting expressed _more_ in the presence of the soda are considered _up-regulated_, whereas genes that end up getting expressed _less_ are considered _down-regulated_. The degree to which a gene is up or down regulated constitutes how much of an effect the soda may have had on that gene. + +Of course, all of this has such a significant amount of experimental noise that you could find pretty much anything. You’ll need to replicate your experiment independently a few times before you publish that lemon lime soda causes increased expression in the [Sonic hedgehog gene][3]. + +_Summary:_ A perturbagen is something you introduce/do to a cell to change its behavior, such as drugs or throwing it at a wall or something. The wall perturbagen. + +### Gene signature + +For a given change or perturbagen to a cell, we now have enough to compute lists of up-regulated and down-regulated genes and the magnitude change in expression for each gene. + +This gene expression pattern for some subset of important genes (perhaps the most changed in expression) is called a _gene signature_, and gene signatures are very useful. By comparing signatures, you can: + + * identify or compare cell states + * find sets of positively or negatively correlated genes + * find similar disease signatures + * find similar drug signatures + * find drug signatures that might counteract opposite disease signatures. + + + +(That last bullet point is essentially where I’m headed with my research.) + +_Summary:_ a gene signature is a short summary of the most important gene expression differences a perturbagen causes in a cell. + +### Drugs! + +The pharmaceutical industry is constantly on the lookout for new breakthrough drugs that might represent huge windfalls in cash, and drugs don’t always work as planned. Many drugs spend years in research and development, only to ultimately find poor efficacy or adoption. Sometimes drugs even become known [much more for their side-effects than their originally intended therapy][4]. + +The practical upshot is that there’s countless FDA-approved drugs that represent decades of work that are simply underused or even unused entirely. These drugs have already cleared many challenging regulatory hurdles, but are simply and quite literally cures looking for a disease. + +If even just one of these drugs can be given a new lease on life for some yet-to-be-cured disease, then perhaps we can give some people new leases on life! + +_Summary:_ instead of developing new drugs, there’s already lots of drugs that aren’t being used. Maybe we can find matching diseases! + +### The Connectivity Map project + +The [Broad Institute’s Connectivity Map project][5] isn’t particularly new anymore, but it represents a ground breaking and promising idea - we can dump a bunch of signatures into a database and construct all sorts of new hypotheses we might not even have thought to check before. + +To prove out the usefulness of this idea, the Connectivity Map (or cmap) project chose 5 different cell lines (all cancer cells, which are easy to get to replicate!) and a library of FDA approved drugs, and then gave some cells these drugs. + +They then constructed a database of all of the signatures they computed for each possible perturbagen they measured. Finally, they constructed a web interface where a user can upload a gene signature and get a result list back of all of the signatures they collected, ordered by the most to least similar. You can totally go sign up and [try it out][5]. + +This simple tool is surprisingly powerful. It allows you to find similar drugs to a drug you know, but it also allows you to find drugs that might counteract a disease you’ve created a signature for. + +Ultimately, the project led to [a number of successful applications][6]. So useful was it that the Broad Institute has doubled down and created the much larger and more comprehensive [LINCS Project][7] that targets an order of magnitude more cell lines (77) and more perturbagens (42,532, compared to cmap’s 6100). You can sign up and use that one too! + +_Summary_: building a system that supports querying signature connections has already proved to be super useful. + +### Whew + +Alright, I wrote most of this on a plane yesterday but since I should now be spending time with family I’m going to cut it short here. + +Stay tuned for next week! + +-------------------------------------------------------------------------------- + +via: https://www.jtolio.com/2015/11/research-log-gene-signatures-and-connectivity-map + +作者:[jtolio.com][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.jtolio.com/ +[b]: https://github.com/lujun9972 +[1]: https://www.jtolio.com/writing/2015/11/research-log-cell-states-and-microarrays/ +[2]: https://www.jtolio.com/writing/2015/11/research-log-r-and-more-microarrays/ +[3]: https://en.wikipedia.org/wiki/Sonic_hedgehog +[4]: https://en.wikipedia.org/wiki/Sildenafil#History +[5]: https://www.broadinstitute.org/cmap/ +[6]: https://www.broadinstitute.org/cmap/publications.jsp +[7]: http://www.lincscloud.org/ diff --git a/sources/tech/20160302 Go channels are bad and you should feel bad.md b/sources/tech/20160302 Go channels are bad and you should feel bad.md new file mode 100644 index 0000000000..78e440c9ea --- /dev/null +++ b/sources/tech/20160302 Go channels are bad and you should feel bad.md @@ -0,0 +1,443 @@ +[#]: collector: (lujun9972) +[#]: translator: (gxlct008) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Go channels are bad and you should feel bad) +[#]: via: (https://www.jtolio.com/2016/03/go-channels-are-bad-and-you-should-feel-bad) +[#]: author: (jtolio.com https://www.jtolio.com/) + +Go channels are bad and you should feel bad +====== + +_Update: If you’re coming to this blog post from a compendium titled “Go is not good,” I want to make it clear that I am ashamed to be on such a list. Go is absolutely the least worst programming language I’ve ever used. At the time I wrote this, I wanted to curb a trend I was seeing, namely, overuse of one of the more warty parts of Go. I still think channels could be much better, but overall, Go is wonderful. It’s like if your favorite toolbox had [this][1] in it; the tool can have uses (even if it could have had more uses), and it can still be your favorite toolbox!_ + +_Update 2: I would be remiss if I didn’t point out this excellent survey of real issues: [Understanding Real-World Concurrency Bugs In Go][2]. A significant finding of this survey is that… Go channels cause lots of bugs._ + +I’ve been using Google’s [Go programming language][3] on and off since mid-to-late 2010, and I’ve had legitimate product code written in Go for [Space Monkey][4] since January 2012 (before Go 1.0!). My initial experience with Go was back when I was researching Hoare’s [Communicating Sequential Processes][5] model of concurrency and the [π-calculus][6] under [Matt Might][7]’s [UCombinator research group][8] as part of my ([now redirected][9]) PhD work to better enable multicore development. Go was announced right then (how serendipitous!) and I immediately started kicking tires. + +It quickly became a core part of Space Monkey development. Our production systems at Space Monkey currently account for over 425k lines of pure Go (_not_ counting all of our vendored libraries, which would make it just shy of 1.5 million lines), so not the most Go you’ll ever see, but for the relatively young language we’re heavy users. We’ve [written about our Go usage][10] before. We’ve open-sourced some fairly heavily used libraries; many people seem to be fans of our [OpenSSL bindings][11] (which are faster than [crypto/tls][12], but please keep openssl itself up-to-date!), our [error handling library][13], [logging library][14], and [metric collection library/zipkin client][15]. We use Go, we love Go, we think it’s the least bad programming language for our needs we’ve used so far. + +Although I don’t think I can talk myself out of mentioning my widely avoided [goroutine-local-storage library][16] here either (which even though it’s a hack that you shouldn’t use, it’s a beautiful hack), hopefully my other experience will suffice as valid credentials that I kind of know what I’m talking about before I explain my deliberately inflamatory post title. + +![][17] + +### Wait, what? + +If you ask the proverbial programmer on the street what’s so special about Go, she’ll most likely tell you that Go is most known for channels and goroutines. Go’s theoretical underpinnings are heavily based in Hoare’s CSP model, which is itself incredibly fascinating and interesting and I firmly believe has much more to yield than we’ve appropriated so far. + +CSP (and the π-calculus) both use communication as the core synchronization primitive, so it makes sense Go would have channels. Rob Pike has been fascinated with CSP (with good reason) for a [considerable][18] [while][19] [now][20]. + +But from a pragmatic perspective (which Go prides itself on), Go got channels wrong. Channels as implemented are pretty much a solid anti-pattern in my book at this point. Why? Dear reader, let me count the ways. + +#### You probably won’t end up using just channels. + +Hoare’s Communicating Sequential Processes is a computational model where essentially the only synchronization primitive is sending or receiving on a channel. As soon as you use a mutex, semaphore, or condition variable, bam, you’re no longer in pure CSP land. Go programmers often tout this model and philosophy through the chanting of the [cached thought][21] “[share memory by communicating][22].” + +So let’s try and write a small program using just CSP in Go! Let’s make a high score receiver. All we will do is keep track of the largest high score value we’ve seen. That’s it. + +First, we’ll make a `Game` struct. + +``` +type Game struct { + bestScore int + scores chan int +} +``` + +`bestScore` isn’t going to be protected by a mutex! That’s fine, because we’ll simply have one goroutine manage its state and receive new scores over a channel. + +``` +func (g *Game) run() { + for score := range g.scores { + if g.bestScore < score { + g.bestScore = score + } + } +} +``` + +Okay, now we’ll make a helpful constructor to start a game. + +``` +func NewGame() (g *Game) { + g = &Game{ + bestScore: 0, + scores: make(chan int), + } + go g.run() + return g +} +``` + +Next, let’s assume someone has given us a `Player` that can return scores. It might also return an error, cause hey maybe the incoming TCP stream can die or something, or the player quits. + +``` +type Player interface { + NextScore() (score int, err error) +} +``` + +To handle the player, we’ll assume all errors are fatal and pass received scores down the channel. + +``` +func (g *Game) HandlePlayer(p Player) error { + for { + score, err := p.NextScore() + if err != nil { + return err + } + g.scores <- score + } +} +``` + +Yay! Okay, we have a `Game` type that can keep track of the highest score a `Player` receives in a thread-safe way. + +You wrap up your development and you’re on your way to having customers. You make this game server public and you’re incredibly successful! Lots of games are being created with your game server. + +Soon, you discover people sometimes leave your game. Lots of games no longer have any players playing, but nothing stopped the game loop. You are getting overwhelmed by dead `(*Game).run` goroutines. + +**Challenge:** fix the goroutine leak above without mutexes or panics. For real, scroll up to the above code and come up with a plan for fixing this problem using just channels. + +I’ll wait. + +For what it’s worth, it totally can be done with channels only, but observe the simplicity of the following solution which doesn’t even have this problem: + +``` +type Game struct { + mtx sync.Mutex + bestScore int +} + +func NewGame() *Game { + return &Game{} +} + +func (g *Game) HandlePlayer(p Player) error { + for { + score, err := p.NextScore() + if err != nil { + return err + } + g.mtx.Lock() + if g.bestScore < score { + g.bestScore = score + } + g.mtx.Unlock() + } +} +``` + +Which one would you rather work on? Don’t be deceived into thinking that the channel solution somehow makes this more readable and understandable in more complex cases. Teardown is very hard. This sort of teardown is just a piece of cake with a mutex, but the hardest thing to work out with Go-specific channels only. Also, if anyone replies that channels sending channels is easier to reason about here it will cause me an immediate head-to-desk motion. + +Importantly, this particular case might actually be _easily_ solved _with channels_ with some runtime assistance Go doesn’t provide! Unfortunately, as it stands, there are simply a surprising amount of problems that are solved better with traditional synchronization primitives than with Go’s version of CSP. We’ll talk about what Go could have done to make this case easier later. + +**Exercise:** Still skeptical? Try making both solutions above (channel-only vs. mutex-only) stop asking for scores from `Players` once `bestScore` is 100 or greater. Go ahead and open your text editor. This is a small, toy problem. + +The summary here is that you will be using traditional synchronization primitives in addition to channels if you want to do anything real. + +#### Channels are slower than implementing it yourself + +One of the things I assumed about Go being so heavily based in CSP theory is that there should be some pretty killer scheduler optimizations the runtime can make with channels. Perhaps channels aren’t always the most straightforward primitive, but surely they’re efficient and fast, right? + +![][23] + +As [Dustin Hiatt][24] points out on [Tyler Treat’s post about Go][25], + +> Behind the scenes, channels are using locks to serialize access and provide threadsafety. So by using channels to synchronize access to memory, you are, in fact, using locks; locks wrapped in a threadsafe queue. So how do Go’s fancy locks compare to just using mutex’s from their standard library `sync` package? The following numbers were obtained by using Go’s builtin benchmarking functionality to serially call Put on a single set of their respective types. + +``` +> BenchmarkSimpleSet-8 3000000 391 ns/op +> BenchmarkSimpleChannelSet-8 1000000 1699 ns/o +> +``` + +It’s a similar story with unbuffered channels, or even the same test under contention instead of run serially. + +Perhaps the Go scheduler will improve, but in the meantime, good old mutexes and condition variables are very good, efficient, and fast. If you want performance, you use the tried and true methods. + +#### Channels don’t compose well with other concurrency primitives + +Alright, so hopefully I have convinced you that you’ll at least be interacting with primitives besides channels sometimes. The standard library certainly seems to prefer traditional synchronization primitives over channels. + +Well guess what, it’s actually somewhat challenging to use channels alongside mutexes and condition variables correctly! + +One of the interesting things about channels that makes a lot of sense coming from CSP is that channel sends are synchronous. A channel send and channel receive are intended to be synchronization barriers, and the send and receive should happen at the same virtual time. That’s wonderful if you’re in well-executed CSP-land. + +![][26] + +Pragmatically, Go channels also come in a buffered variety. You can allocate a fixed amount of space to account for possible buffering so that sends and receives are disparate events, but the buffer size is capped. Go doesn’t provide a way to have arbitrarily sized buffers - you have to allocate the buffer size in advance. _This is fine_, I’ve seen people argue on the mailing list, _because memory is bounded anyway._ + +Wat. + +This is a bad answer. There’s all sorts of reasons to use an arbitrarily buffered channel. If we knew everything up front, why even have `malloc`? + +Not having arbitrarily buffered channels means that a naive send on _any_ channel could block at any time. You want to send on a channel and update some other bookkeeping under a mutex? Careful! Your channel send might block! + +``` +// ... +s.mtx.Lock() +// ... +s.ch <- val // might block! +s.mtx.Unlock() +// ... +``` + +This is a recipe for dining philosopher dinner fights. If you take a lock, you should quickly update state and release it and not do anything blocking under the lock if possible. + +There is a way to do a non-blocking send on a channel in Go, but it’s not the default behavior. Assume we have a channel `ch := make(chan int)` and we want to send the value `1` on it without blocking. Here is the minimum amount of typing you have to do to send without blocking: + +``` +select { +case ch <- 1: // it sent +default: // it didn't +} +``` + +This isn’t what naturally leaps to mind for beginning Go programmers. + +The summary is that because many operations on channels block, it takes careful reasoning about philosophers and their dining to successfully use channel operations alongside and under mutex protection, without causing deadlocks. + +#### Callbacks are strictly more powerful and don’t require unnecessary goroutines. + +![][27] + +Whenever an API uses a channel, or whenever I point out that a channel makes something hard, someone invariably points out that I should just spin up a goroutine to read off the channel and make whatever translation or fix I need as it reads of the channel. + +Um, no. What if my code is in a hotpath? There’s very few instances that require a channel, and if your API could have been designed with mutexes, semaphores, and callbacks and no additional goroutines (because all event edges are triggered by API events), then using a channel forces me to add another stack of memory allocation to my resource usage. Goroutines are much lighter weight than threads, yes, but lighter weight doesn’t mean the lightest weight possible. + +As I’ve formerly [argued in the comments on an article about using channels][28] (lol the internet), your API can _always_ be more general, _always_ more flexible, and take drastically less resources if you use callbacks instead of channels. “Always” is a scary word, but I mean it here. There’s proof-level stuff going on. + +If someone provides a callback-based API to you and you need a channel, you can provide a callback that sends on a channel with little overhead and full flexibility. + +If, on the other hand, someone provides a channel-based API to you and you need a callback, you have to spin up a goroutine to read off the channel _and_ you have to hope that no one tries to send more on the channel when you’re done reading so you cause blocked goroutine leaks. + +For a super simple real-world example, check out the [context interface][29] (which incidentally is an incredibly useful package and what you should be using instead of [goroutine-local storage][16]): + +``` +type Context interface { + ... + // Done returns a channel that closes when this work unit should be canceled. + Done() <-chan struct{} + + // Err returns a non-nil error when the Done channel is closed + Err() error + ... +} +``` + +Imagine all you want to do is log the corresponding error when the `Done()` channel fires. What do you have to do? If you don’t have a good place you’re already selecting on a channel, you have to spin up a goroutine to deal with it: + +``` +go func() { + <-ctx.Done() + logger.Errorf("canceled: %v", ctx.Err()) +}() +``` + +What if `ctx` gets garbage collected without closing the channel `Done()` returned? Whoops! Just leaked a goroutine! + +Now imagine we changed `Done`’s signature: + +``` +// Done calls cb when this work unit should be canceled. +Done(cb func()) +``` + +First off, logging is so easy now. Check it out: `ctx.Done(func() { log.Errorf("canceled: %v", ctx.Err()) })`. But lets say you really do need some select behavior. You can just call it like this: + +``` +ch := make(chan struct{}) +ctx.Done(func() { close(ch) }) +``` + +Voila! No expressiveness lost by using a callback instead. `ch` works like the channel `Done()` used to return, and in the logging case we didn’t need to spin up a whole new stack. I got to keep my stack traces (if our log package is inclined to use them); I got to avoid another stack allocation and another goroutine to give to the scheduler. + +Next time you use a channel, ask yourself if there’s some goroutines you could eliminate if you used mutexes and condition variables instead. If the answer is yes, your code will be more efficient if you change it. And if you’re trying to use channels just to be able to use the `range` keyword over a collection, I’m going to have to ask you to put your keyboard away or just go back to writing Python books. + +![more like Zooey De-channel, amirite][30] + +#### The channel API is inconsistent and just cray-cray + +Closing or sending on a closed channel panics! Why? If you want to close a channel, you need to either synchronize its closed state externally (with mutexes and so forth that don’t compose well!) so that other writers don’t write to or close a closed channel, or just charge forward and close or write to closed channels and expect you’ll have to recover any raised panics. + +This is such bizarre behavior. Almost every other operation in Go has a way to avoid a panic (type assertions have the `, ok =` pattern, for example), but with channels you just get to deal with it. + +Okay, so when a send will fail, channels panic. I guess that makes some kind of sense. But unlike almost everything else with nil values, sending to a nil channel won’t panic. Instead, it will block forever! That’s pretty counter-intuitive. That might be useful behavior, just like having a can-opener attached to your weed-whacker might be useful (and found in Skymall), but it’s certainly unexpected. Unlike interacting with nil maps (which do implicit pointer dereferences), nil interfaces (implicit pointer dereferences), unchecked type assertions, and all sorts of other things, nil channels exhibit actual channel behavior, as if a brand new channel was just instantiated for this operation. + +Receives are slightly nicer. What happens when you receive on a closed channel? Well, that works - you get a zero value. Okay that makes sense I guess. Bonus! Receives allow you to do a `, ok =`-style check if the channel was open when you received your value. Thank heavens we get `, ok =` here. + +But what happens if you receive from a nil channel? _Also blocks forever!_ Yay! Don’t try and use the fact that your channel is nil to keep track of if you closed it! + +### What are channels good for? + +Of course channels are good for some things (they are a generic container after all), and there are certain things you can only do with them (`select`). + +#### They are another special-cased generic datastructure + +Go programmers are so used to arguments about generics that I can feel the PTSD coming on just by bringing up the word. I’m not here to talk about it so wipe the sweat off your brow and let’s keep moving. + +Whatever your opinion of generics is, Go’s maps, slices, and channels are data structures that support generic element types, because they’ve been special-cased into the language. + +In a language that doesn’t allow you to write your own generic containers, _anything_ that allows you to better manage collections of things is valuable. Here, channels are a thread-safe datastructure that supports arbitrary value types. + +So that’s useful! That can save some boilerplate I suppose. + +I’m having trouble counting this as a win for channels. + +#### Select + +The main thing you can do with channels is the `select` statement. Here you can wait on a fixed number of inputs for events. It’s kind of like epoll, but you have to know upfront how many sockets you’re going to be waiting on. + +This is truly a useful language feature. Channels would be a complete wash if not for `select`. But holy smokes, let me tell you about the first time you decide you might need to select on multiple things but you don’t know how many and you have to use `reflect.Select`. + +### How could channels be better? + +It’s really tough to say what the most tactical thing the Go language team could do for Go 2.0 is (the Go 1.0 compatibility guarantee is good but hand-tying), but that won’t stop me from making some suggestions. + +#### Select on condition variables! + +We could just obviate the need for channels! This is where I propose we get rid of some sacred cows, but let me ask you this, how great would it be if you could select on any custom synchronization primitive? (A: So great.) If we had that, we wouldn’t need channels at all. + +#### GC could help us? + +In the very first example, we could easily solve the high score server cleanup with channels if we were able to use directionally-typed channel garbage collection to help us clean up. + +![][31] + +As you know, Go has directionally-typed channels. You can have a channel type that only supports reading (`<-chan`) and a channel type that only supports writing (`chan<-`). Great! + +Go also has garbage collection. It’s clear that certain kinds of book keeping are just too onerous and we shouldn’t make the programmer deal with them. We clean up unused memory! Garbage collection is useful and neat. + +So why not help clean up unused or deadlocked channel reads? Instead of having `make(chan Whatever)` return one bidirectional channel, have it return two single-direction channels (`chanReader, chanWriter := make(chan Type)`). + +Let’s reconsider the original example: + +``` +type Game struct { + bestScore int + scores chan<- int +} + +func run(bestScore *int, scores <-chan int) { + // we don't keep a reference to a *Game directly because then we'd be holding + // onto the send side of the channel. + for score := range scores { + if *bestScore < score { + *bestScore = score + } + } +} + +func NewGame() (g *Game) { + // this make(chan) return style is a proposal! + scoreReader, scoreWriter := make(chan int) + g = &Game{ + bestScore: 0, + scores: scoreWriter, + } + go run(&g.bestScore, scoreReader) + return g +} + +func (g *Game) HandlePlayer(p Player) error { + for { + score, err := p.NextScore() + if err != nil { + return err + } + g.scores <- score + } +} +``` + +If garbage collection closed a channel when we could prove no more values are ever coming down it, this solution is completely fixed. Yes yes, the comment in `run` is indicative of the existence of a rather large gun aimed at your foot, but at least the problem is easily solveable now, whereas it really wasn’t before. Furthermore, a smart compiler could probably make appropriate proofs to reduce the damage from said foot-gun. + +#### Other smaller issues + + * **Dup channels?** \- If we could use an equivalent of the `dup` syscall on channels, then we could also solve the multiple producer problem quite easily. Each producer could close their own `dup`-ed channel without ruining the other producers. + * **Fix the channel API!** \- Close isn’t idempotent? Send on closed channel panics with no way to avoid it? Ugh! + * **Arbitrarily buffered channels** \- If we could make buffered channels with no fixed buffer size limit, then we could make channels that don’t block. + + + +### What do we tell people about Go then? + +If you haven’t yet, please go take a look at my current favorite programming post: [What Color is Your Function][32]. Without being about Go specifically, this blog post much more eloquently than I could lays out exactly why goroutines are Go’s best feature (and incidentally one of the ways Go is better than Rust for some applications). + +If you’re still writing code in a programming language that forces keywords like `yield` on you to get high performance, concurrency, or an event-driven model, you are living in the past, whether or not you or anyone else knows it. Go is so far one of the best entrants I’ve seen of languages that implement an M:N threading model that’s not 1:1, and dang that’s powerful. + +So, tell folks about goroutines. + +If I had to pick one other leading feature of Go, it’s interfaces. Statically-typed [duck typing][33] makes extending and working with your own or someone else’s project so fun and amazing it’s probably worth me writing an entirely different set of words about it some other time. + +### So… + +I keep seeing people charge in to Go, eager to use channels to their full potential. Here’s my advice to you. + +**JUST STAHP IT** + +When you’re writing APIs and interfaces, as bad as the advice “never” can be, I’m pretty sure there’s never a time where channels are better, and every Go API I’ve used that used channels I’ve ended up having to fight. I’ve never thought “oh good, there’s a channel here;” it’s always instead been some variant of _**WHAT FRESH HELL IS THIS?**_ + +So, _please, please use channels where appropriate and only where appropriate._ + +In all of my Go code I work with, I can count on one hand the number of times channels were really the best choice. Sometimes they are. That’s great! Use them then. But otherwise just stop. + +![][34] + +_Special thanks for the valuable feedback provided by my proof readers Jeff Wendling, [Andrew Harding][35], [George Shank][36], and [Tyler Treat][37]._ + +If you want to work on Go with us at Space Monkey, please [hit me up][38]! + +-------------------------------------------------------------------------------- + +via: https://www.jtolio.com/2016/03/go-channels-are-bad-and-you-should-feel-bad + +作者:[jtolio.com][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.jtolio.com/ +[b]: https://github.com/lujun9972 +[1]: https://blog.codinghorror.com/content/images/uploads/2012/06/6a0120a85dcdae970b017742d249d5970d-800wi.jpg +[2]: https://songlh.github.io/paper/go-study.pdf +[3]: https://golang.org/ +[4]: http://www.spacemonkey.com/ +[5]: https://en.wikipedia.org/wiki/Communicating_sequential_processes +[6]: https://en.wikipedia.org/wiki/%CE%A0-calculus +[7]: http://matt.might.net +[8]: http://www.ucombinator.org/ +[9]: https://www.jtolio.com/writing/2015/11/research-log-cell-states-and-microarrays/ +[10]: https://www.jtolio.com/writing/2014/04/go-space-monkey/ +[11]: https://godoc.org/github.com/spacemonkeygo/openssl +[12]: https://golang.org/pkg/crypto/tls/ +[13]: https://godoc.org/github.com/spacemonkeygo/errors +[14]: https://godoc.org/github.com/spacemonkeygo/spacelog +[15]: https://godoc.org/gopkg.in/spacemonkeygo/monitor.v1 +[16]: https://github.com/jtolds/gls +[17]: https://www.jtolio.com/images/wat/darth-helmet.jpg +[18]: https://en.wikipedia.org/wiki/Newsqueak +[19]: https://en.wikipedia.org/wiki/Alef_%28programming_language%29 +[20]: https://en.wikipedia.org/wiki/Limbo_%28programming_language%29 +[21]: https://lesswrong.com/lw/k5/cached_thoughts/ +[22]: https://blog.golang.org/share-memory-by-communicating +[23]: https://www.jtolio.com/images/wat/jon-stewart.jpg +[24]: https://twitter.com/HiattDustin +[25]: http://bravenewgeek.com/go-is-unapologetically-flawed-heres-why-we-use-it/ +[26]: https://www.jtolio.com/images/wat/obama.jpg +[27]: https://www.jtolio.com/images/wat/yael-grobglas.jpg +[28]: http://www.informit.com/articles/article.aspx?p=2359758#comment-2061767464 +[29]: https://godoc.org/golang.org/x/net/context +[30]: https://www.jtolio.com/images/wat/zooey-deschanel.jpg +[31]: https://www.jtolio.com/images/wat/joel-mchale.jpg +[32]: http://journal.stuffwithstuff.com/2015/02/01/what-color-is-your-function/ +[33]: https://en.wikipedia.org/wiki/Duck_typing +[34]: https://www.jtolio.com/images/wat/michael-cera.jpg +[35]: https://github.com/azdagron +[36]: https://twitter.com/taterbase +[37]: http://bravenewgeek.com +[38]: https://www.jtolio.com/contact/ diff --git a/sources/tech/20170112 Writing Advanced Web Applications with Go.md b/sources/tech/20170112 Writing Advanced Web Applications with Go.md new file mode 100644 index 0000000000..f46521e8a7 --- /dev/null +++ b/sources/tech/20170112 Writing Advanced Web Applications with Go.md @@ -0,0 +1,658 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Writing Advanced Web Applications with Go) +[#]: via: (https://www.jtolio.com/2017/01/writing-advanced-web-applications-with-go) +[#]: author: (jtolio.com https://www.jtolio.com/) + +Writing Advanced Web Applications with Go +====== + +Web development in many programming environments often requires subscribing to some full framework ethos. With [Ruby][1], it’s usually [Rails][2] but could be [Sinatra][3] or something else. With [Python][4], it’s often [Django][5] or [Flask][6]. With [Go][7], it’s… + +If you spend some time in Go communities like the [Go mailing list][8] or the [Go subreddit][9], you’ll find Go newcomers frequently wondering what web framework is best to use. [There][10] [are][11] [quite][12] [a][13] [few][14] [Go][15] [frameworks][16] ([and][17] [then][18] [some][19]), so which one is best seems like a reasonable question. Without fail, though, the strong recommendation of the Go community is to [avoid web frameworks entirely][20] and just stick with the standard library as long as possible. Here’s [an example from the Go mailing list][21] and here’s [one from the subreddit][22]. + +It’s not bad advice! The Go standard library is very rich and flexible, much more so than many other languages, and designing a web application in Go with just the standard library is definitely a good choice. + +Even when these Go frameworks call themselves minimalistic, they can’t seem to help themselves avoid using a different request handler interface than the default standard library [http.Handler][23], and I think this is the biggest source of angst about why frameworks should be avoided. If everyone standardizes on [http.Handler][23], then dang, all sorts of things would be interoperable! + +Before Go 1.7, it made some sense to give in and use a different interface for handling HTTP requests. But now that [http.Request][24] has the [Context][25] and [WithContext][26] methods, there truly isn’t a good reason any longer. + +I’ve done a fair share of web development in Go and I’m here to share with you both some standard library development patterns I’ve learned and some code I’ve found myself frequently needing. The code I’m sharing is not for use instead of the standard library, but to augment it. + +Overall, if this blog post feels like it’s predominantly plugging various little standalone libraries from my [Webhelp non-framework][27], that’s because it is. It’s okay, they’re little standalone libraries. Only use the ones you want! + +If you’re new to Go web development, I suggest reading the Go documentation’s [Writing Web Applications][28] article first. + +### Middleware + +A frequent design pattern for server-side web development is the concept of _middleware_, where some portion of the request handler wraps some other portion of the request handler and does some preprocessing or routing or something. This is a big component of how [Express][29] is organized on [Node][30], and how Express middleware and [Negroni][17] middleware works is almost line-for-line identical in design. + +Good use cases for middleware are things such as: + + * making sure a user is logged in, redirecting if not, + * making sure the request came over HTTPS, + * making sure a session is set up and loaded from a session database, + * making sure we logged information before and after the request was handled, + * making sure the request was routed to the right handler, + * and so on. + + + +Composing your web app as essentially a chain of middleware handlers is a very powerful and flexible approach. It allows you to avoid a lot of [cross-cutting concerns][31] and have your code factored in very elegant and easy-to-maintain ways. By wrapping a set of handlers with middleware that ensures a user is logged in prior to actually attempting to handle the request, the individual handlers no longer need mistake-prone copy-and-pasted code to ensure the same thing. + +So, middleware is good. However, if Negroni or other frameworks are any indication, you’d think the standard library’s `http.Handler` isn’t up to the challenge. Negroni adds its own `negroni.Handler` just for the sake of making middleware easier. There’s no reason for this. + +Here is a full middleware implementation for ensuring a user is logged in, assuming a `GetUser(*http.Request)` function but otherwise just using the standard library: + +``` +func RequireUser(h http.Handler) http.Handler { + return http.HandlerFunc(func(w http.ResponseWriter, req *http.Request) { + user, err := GetUser(req) + if err != nil { + http.Error(w, err.Error(), http.StatusInternalServerError) + return + } + if user == nil { + http.Error(w, "unauthorized", http.StatusUnauthorized) + return + } + h.ServeHTTP(w, req) + }) +} +``` + +Here’s how it’s used (just wrap another handler!): + +``` +func main() { + http.ListenAndServe(":8080", RequireUser(http.HandlerFunc(myHandler))) +} +``` + +Express, Negroni, and other frameworks expect this kind of signature for a middleware-supporting handler: + +``` +type Handler interface { + // don't do this! + ServeHTTP(rw http.ResponseWriter, req *http.Request, next http.HandlerFunc) +} +``` + +There’s really no reason for adding the `next` argument - it reduces cross-library compatibility. So I say, don’t use `negroni.Handler` (or similar). Just use `http.Handler`! + +### Composability + +Hopefully I’ve sold you on middleware as a good design philosophy. + +Probably the most commonly-used type of middleware is request routing, or muxing (seems like we should call this demuxing but what do I know). Some frameworks are almost solely focused on request routing. [gorilla/mux][32] seems more popular than any other part of the [Gorilla][33] library. I think the reason for this is that even though the Go standard library is completely full featured and has a good [ServeMux][34] implementation, it doesn’t make the right thing the default. + +So! Let’s talk about request routing and consider the following problem. You, web developer extraordinaire, want to serve some HTML from your web server at `/hello/` but also want to serve some static assets from `/static/`. Let’s take a quick stab. + +``` +package main + +import ( + "net/http" +) + +func hello(w http.ResponseWriter, req *http.Request) { + w.Write([]byte("hello, world!")) +} + +func main() { + mux := http.NewServeMux() + mux.Handle("/hello/", http.HandlerFunc(hello)) + mux.Handle("/static/", http.FileServer(http.Dir("./static-assets"))) + http.ListenAndServe(":8080", mux) +} +``` + +If you visit `http://localhost:8080/hello/`, you’ll be rewarded with a friendly “hello, world!” message. + +If you visit `http://localhost:8080/static/` on the other hand (assuming you have a folder of static assets in `./static-assets`), you’ll be surprised and frustrated. This code tries to find the source content for the request `/static/my-file` at `./static-assets/static/my-file`! There’s an extra `/static` in there! + +Okay, so this is why `http.StripPrefix` exists. Let’s fix it. + +``` +mux.Handle("/static/", http.StripPrefix("/static", + http.FileServer(http.Dir("./static-assets")))) +``` + +`mux.Handle` combined with `http.StripPrefix` is such a common pattern that I think it should be the default. Whenever a request router processes a certain amount of URL elements, it should strip them off the request so the wrapped `http.Handler` doesn’t need to know its absolute URL and only needs to be concerned with its relative one. + +In [Russ Cox][35]’s recent [TiddlyWeb backend][36], I would argue that every time `strings.TrimPrefix` is needed to remove the full URL from the handler’s incoming path arguments, it is an unnecessary cross-cutting concern, unfortunately imposed by `http.ServeMux`. (An example is [line 201 in tiddly.go][37].) + +I’d much rather have the default `mux` behavior work more like a directory of registered elements that by default strips off the ancestor directory before handing the request to the next middleware handler. It’s much more composable. To this end, I’ve written a simple muxer that works in this fashion called [whmux.Dir][38]. It is essentially `http.ServeMux` and `http.StripPrefix` combined. Here’s the previous example reworked to use it: + +``` +package main + +import ( + "net/http" + + "gopkg.in/webhelp.v1/whmux" +) + +func hello(w http.ResponseWriter, req *http.Request) { + w.Write([]byte("hello, world!")) +} + +func main() { + mux := whmux.Dir{ + "hello": http.HandlerFunc(hello), + "static": http.FileServer(http.Dir("./static-assets")), + } + http.ListenAndServe(":8080", mux) +} +``` + +There are other useful mux implementations inside the [whmux][39] package that demultiplex on various aspects of the request path, request method, request host, or pull arguments out of the request and place them into the context, such as a [whmux.IntArg][40] or [whmux.StringArg][41]. This brings us to [contexts][42]. + +### Contexts + +Request contexts are a recent addition to the Go 1.7 standard library, but the idea of [contexts has been around since mid-2014][43]. As of Go 1.7, they were added to the standard library ([“context”][42]), but are available for older Go releases in the original location ([“golang.org/x/net/context”][44]). + +First, here’s the definition of the `context.Context` type that `(*http.Request).Context()` returns: + +``` +type Context interface { + Done() <-chan struct{} + Err() error + Deadline() (deadline time.Time, ok bool) + + Value(key interface{}) interface{} +} +``` + +Talking about `Done()`, `Err()`, and `Deadline()` are enough for an entirely different blog post, so I’m going to ignore them at least for now and focus on `Value(interface{})`. + +As a motivating problem, let’s say that the `GetUser(*http.Request)` method we assumed earlier is expensive, and we only want to call it once per request. We certainly don’t want to call it once to check that a user is logged in, and then again when we actually need the `*User` value. With `(*http.Request).WithContext` and `context.WithValue`, we can pass the `*User` down to the next middleware precomputed! + +Here’s the new middleware: + +``` +type userKey int + +func RequireUser(h http.Handler) http.Handler { + return http.HandlerFunc(func(w http.ResponseWriter, req *http.Request) { + user, err := GetUser(req) + if err != nil { + http.Error(w, err.Error(), http.StatusInternalServerError) + return + } + if user == nil { + http.Error(w, "unauthorized", http.StatusUnauthorized) + return + } + ctx := r.Context() + ctx = context.WithValue(ctx, userKey(0), user) + h.ServeHTTP(w, req.WithContext(ctx)) + }) +} +``` + +Now, handlers that are protected by this `RequireUser` handler can load the previously computed `*User` value like this: + +``` +if user, ok := req.Context().Value(userKey(0)).(*User); ok { + // there's a valid user! +} +``` + +Contexts allow us to pass optional values to handlers down the chain in a way that is relatively type-safe and flexible. None of the above context logic requires anything outside of the standard library. + +#### Aside about context keys + +There was a curious piece of code in the above example. At the top, we defined a `type userKey int`, and then always used it as `userKey(0)`. + +One of the possible problems with contexts is the `Value()` interface lends itself to a global namespace where you can stomp on other context users and use conflicting key names. Above, we used `type userKey` because it’s an unexported type in your package. It will never compare equal (without a cast) to any other type, including `int`, in Go. This gives us a way to namespace keys to your package, even though the `Value()` method is still a sort of global namespace. + +Because the need for this is so common, the `webhelp` package defines a [GenSym()][45] helper that will create a brand new, never-before-seen, unique value for use as a context key. + +If we used [GenSym()][45], then `type userKey int` would become `var userKey = webhelp.GenSym()` and `userKey(0)` would simply become `userKey`. + +#### Back to whmux.StringArg + +Armed with this new context behavior, we can now present a `whmux.StringArg` example: + +``` +package main + +import ( + "fmt" + "net/http" + + "gopkg.in/webhelp.v1/whmux" +) + +var ( + pageName = whmux.NewStringArg() +) + +func page(w http.ResponseWriter, req *http.Request) { + name := pageName.Get(req.Context()) + + fmt.Fprintf(w, "Welcome to %s", name) +} + +func main() { + // pageName.Shift pulls the next /-delimited string out of the request's + // URL.Path and puts it into the context instead. + pageHandler := pageName.Shift(http.HandlerFunc(page)) + + http.ListenAndServe(":8080", whmux.Dir{ + "wiki": pageHandler, + }) +} +``` + +### Pre-Go-1.7 support + +Contexts let you do some pretty cool things. But let’s say you’re stuck with something before Go 1.7 (for instance, App Engine is currently Go 1.6). + +That’s okay! I’ve backported all of the neat new context features to Go 1.6 and earlier in a forwards compatible way! + +With the [whcompat][46] package, `req.Context()` becomes `whcompat.Context(req)`, and `req.WithContext(ctx)` becomes `whcompat.WithContext(req, ctx)`. The `whcompat` versions work with all releases of Go. Yay! + +There’s a bit of unpleasantness behind the scenes to make this happen. Specifically, for pre-1.7 builds, a global map indexed by `req.URL` is kept, and a finalizer is installed on `req` to clean up. So don’t change what `req.URL` points to and this will work fine. In practice it’s not a problem. + +`whcompat` adds additional backwards-compatibility helpers. In Go 1.7 and on, the context’s `Done()` channel is closed (and `Err()` is set), whenever the request is done processing. If you want this behavior in Go 1.6 and earlier, just use the [whcompat.DoneNotify][47] middleware. + +In Go 1.8 and on, the context’s `Done()` channel is closed when the client goes away, even if the request hasn’t completed. If you want this behavior in Go 1.7 and earlier, just use the [whcompat.CloseNotify][48] middleware, though beware that it costs an extra goroutine. + +### Error handling + +How you handle errors can be another cross-cutting concern, but with good application of context and middleware, it too can be beautifully cleaned up so that the responsibilities lie in the correct place. + +Problem statement: your `RequireUser` middleware needs to handle an authentication error differently between your HTML endpoints and your JSON API endpoints. You want to use `RequireUser` for both types of endpoints, but with your HTML endpoints you want to return a user-friendly error page, and with your JSON API endpoints you want to return an appropriate JSON error state. + +In my opinion, the right thing to do is to have contextual error handlers, and luckily, we have a context for contextual information! + +First, we need an error handler interface. + +``` +type ErrHandler interface { + HandleError(w http.ResponseWriter, req *http.Request, err error) +} +``` + +Next, let’s make a middleware that registers the error handler in the context: + +``` +var errHandler = webhelp.GenSym() // see the aside about context keys + +func HandleErrWith(eh ErrHandler, h http.Handler) http.Handler { + return http.HandlerFunc(func(w http.ResponseWriter, req *http.Request) { + ctx := context.WithValue(whcompat.Context(req), errHandler, eh) + h.ServeHTTP(w, whcompat.WithContext(req, ctx)) + }) +} +``` + +Last, let’s make a function that will use the registered error handler for errors: + +``` +func HandleErr(w http.ResponseWriter, req *http.Request, err error) { + if handler, ok := whcompat.Context(req).Value(errHandler).(ErrHandler); ok { + handler.HandleError(w, req, err) + return + } + log.Printf("error: %v", err) + http.Error(w, "internal server error", http.StatusInternalServerError) +} +``` + +Now, as long as everything uses `HandleErr` to handle errors, our JSON API can handle errors with JSON responses, and our HTML endpoints can handle errors with HTML responses. + +Of course, the [wherr][49] package implements this all for you, and the [whjson][49] package even implements a friendly JSON API error handler. + +Here’s how you might use it: + +``` +var userKey = webhelp.GenSym() + +func RequireUser(h http.Handler) http.Handler { + return http.HandlerFunc(func(w http.ResponseWriter, req *http.Request) { + user, err := GetUser(req) + if err != nil { + wherr.Handle(w, req, wherr.InternalServerError.New("failed to get user")) + return + } + if user == nil { + wherr.Handle(w, req, wherr.Unauthorized.New("no user found")) + return + } + ctx := r.Context() + ctx = context.WithValue(ctx, userKey, user) + h.ServeHTTP(w, req.WithContext(ctx)) + }) +} + +func userpage(w http.ResponseWriter, req *http.Request) { + user := req.Context().Value(userKey).(*User) + w.Header().Set("Content-Type", "text/html") + userpageTmpl.Execute(w, user) +} + +func username(w http.ResponseWriter, req *http.Request) { + user := req.Context().Value(userKey).(*User) + w.Header().Set("Content-Type", "application/json") + json.NewEncoder(w).Encode(map[string]interface{}{"user": user}) +} + +func main() { + http.ListenAndServe(":8080", whmux.Dir{ + "api": wherr.HandleWith(whjson.ErrHandler, + RequireUser(whmux.Dir{ + "username": http.HandlerFunc(username), + })), + "user": RequireUser(http.HandlerFunc(userpage)), + }) +} +``` + +#### Aside about the spacemonkeygo/errors package + +The default [wherr.Handle][50] implementation understands all of the [error classes defined in the wherr top level package][51]. + +These error classes are implemented using the [spacemonkeygo/errors][52] library and the [spacemonkeygo/errors/errhttp][53] extensions. You don’t have to use this library or these errors, but the benefit is that your error instances can be extended to include HTTP status code messages and information, which once again, provides for a nice elimination of cross-cutting concerns in your error handling logic. + +See the [spacemonkeygo/errors][52] package for more details. + +_**Update 2018-04-19:** After a few years of use, my friend condensed some lessons we learned and the best parts of `spacemonkeygo/errors` into a new, more concise, better library, over at [github.com/zeebo/errs][54]. Consider using that instead!_ + +### Sessions + +Go’s standard library has great support for cookies, but cookies by themselves aren’t usually what a developer thinks of when she thinks about sessions. Cookies are unencrypted, unauthenticated, and readable by the user, and perhaps you don’t want that with your session data. + +Further, sessions can be stored in cookies, but could also be stored in a database to provide features like session revocation and querying. There’s lots of potential details about the implementation of sessions. + +Request handlers, however, probably don’t care too much about the implementation details of the session. Request handlers usually just want a bucket of keys and values they can store safely and securely. + +The [whsess][55] package implements middleware for registering an arbitrary session store (a default cookie-based session store is provided), and implements helpers for retrieving and saving new values into the session. + +The default cookie-based session store implements encryption and authentication via the excellent [nacl/secretbox][56] package. + +Usage is like this: + +``` +func handler(w http.ResponseWriter, req *http.Request) { + ctx := whcompat.Context(req) + sess, err := whsess.Load(ctx, "namespace") + if err != nil { + wherr.Handle(w, req, err) + return + } + if loggedIn, _ := sess.Values["logged_in"].(bool); loggedIn { + views, _ := sess.Values["views"].(int64) + sess.Values["views"] = views + 1 + sess.Save(w) + } +} + +func main() { + http.ListenAndServe(":8080", whsess.HandlerWithStore( + whsess.NewCookieStore(secret), http.HandlerFunc(handler))) +} +``` + +### Logging + +The Go standard library by default doesn’t log incoming requests, outgoing responses, or even just what port the HTTP server is listening on. + +The [whlog][57] package implements all three. The [whlog.LogRequests][58] middleware will log requests as they start. The [whlog.LogResponses][59] middleware will log requests as they end, along with status code and timing information. [whlog.ListenAndServe][60] will log the address the server ultimately listens on (if you specify “:0” as your address, a port will be randomly chosen, and [whlog.ListenAndServe][60] will log it). + +[whlog.LogResponses][59] deserves special mention for how it does what it does. It uses the [whmon][61] package to instrument the outgoing `http.ResponseWriter` to keep track of response information. + +Usage is like this: + +``` +func main() { + whlog.ListenAndServe(":8080", whlog.LogResponses(whlog.Default, handler)) +} +``` + +#### App engine logging + +App engine logging is unconventional crazytown. The standard library logger doesn’t work by default on App Engine, because App Engine logs _require_ the request context. This is unfortunate for libraries that don’t necessarily run on App Engine all the time, as their logging information doesn’t make it to the App Engine request-specific logger. + +Unbelievably, this is fixable with [whgls][62], which uses my terrible, terrible (but recently improved) [Goroutine-local storage library][63] to store the request context on the current stack, register a new log output, and fix logging so standard library logging works with App Engine again. + +### Template handling + +Go’s standard library [html/template][64] package is excellent, but you’ll be unsurprised to find there’s a few tasks I do with it so commonly that I’ve written additional support code. + +The [whtmpl][65] package really does two things. First, it provides a number of useful helper methods for use within templates, and second, it takes some friction out of managing a large number of templates. + +When writing templates, one thing you can do is call out to other registered templates for small values. A good example might be some sort of list element. You can have a template that renders the list element, and then your template that renders your list can use the list element template in turn. + +Use of another template within a template might look like this: + +``` +
        + {{ range .List }} + {{ template "list_element" . }} + {{ end }} +
      +``` + +You’re now rendering the `list_element` template with the list element from `.List`. But what if you want to also pass the current user `.User`? Unfortunately, you can only pass one argument from one template to another. If you have two arguments you want to pass to another template, with the standard library, you’re out of luck. + +The [whtmpl][65] package adds three helper functions to aid you here, `makepair`, `makemap`, and `makeslice` (more docs under the [whtmpl.Collection][66] type). `makepair` is the simplest. It takes two arguments and constructs a [whtmpl.Pair][67]. Fixing our example above would look like this now: + +``` +
        + {{ $user := .User }} + {{ range .List }} + {{ template "list_element" (makepair . $user) }} + {{ end }} +
      +``` + +The second thing [whtmpl][65] does is make defining lots of templates easy, by optionally automatically naming templates after the name of the file the template is defined in. + +For example, say you have three files. + +Here’s `pkg.go`: + +``` +package views + +import "gopkg.in/webhelp.v1/whtmpl" + +var Templates = whtmpl.NewCollection() +``` + +Here’s `landing.go`: + +``` +package views + +var _ = Templates.MustParse(`{{ template "header" . }} + +

      Landing!

      `) +``` + +And here’s `header.go`: + +``` +package views + +var _ = Templates.MustParse(`My website!`) +``` + +Now, you can import your new `views` package and render the `landing` template this easily: + +``` +func handler(w http.ResponseWriter, req *http.Request) { + views.Templates.Render(w, req, "landing", map[string]interface{}{}) +} +``` + +### User authentication + +I’ve written two Webhelp-style authentication libraries that I end up using frequently. + +The first is an OAuth2 library, [whoauth2][68]. I’ve written up [an example application that authenticates with Google, Facebook, and Github][69]. + +The second, [whgoth][70], is a wrapper around [markbates/goth][71]. My portion isn’t quite complete yet (some fixes are still necessary for optional App Engine support), but will support more non-OAuth2 authentication sources (like Twitter) when it is done. + +### Route listing + +Surprise! If you’ve used [webhelp][27] based handlers and middleware for your whole app, you automatically get route listing for free, via the [whroute][72] package. + +My web serving code’s `main` method often has a form like this: + +``` +switch flag.Arg(0) { +case "serve": + panic(whlog.ListenAndServe(*listenAddr, routes)) +case "routes": + whroute.PrintRoutes(os.Stdout, routes) +default: + fmt.Printf("Usage: %s \n", os.Args[0]) +} +``` + +Here’s some example output: + +``` +GET /auth/_cb/ +GET /auth/login/ +GET /auth/logout/ +GET / +GET /account/apikeys/ +POST /account/apikeys/ +GET /project// +GET /project//control// +POST /project//control//sample/ +GET /project//control/ + Redirect: f(req) +POST /project//control/ +POST /project//control_named//sample/ +GET /project//control_named/ + Redirect: f(req) +GET /project//sample// +GET /project//sample//similar[/<*>] +GET /project//sample/ + Redirect: f(req) +POST /project//search/ +GET /project/ + Redirect: / +POST /project/ +``` + +### Other little things + +[webhelp][27] has a number of other subpackages: + + * [whparse][73] assists in parsing optional request arguments. + * [whredir][74] provides some handlers and helper methods for doing redirects in various cases. + * [whcache][75] creates request-specific mutable storage for caching various computations and database loaded data. Mutability helps helper functions that aren’t used as middleware share data. + * [whfatal][76] uses panics to simplify early request handling termination. Probably avoid this package unless you want to anger other Go developers. + + + +### Summary + +Designing your web project as a collection of composable middlewares goes quite a long way to simplify your code design, eliminate cross-cutting concerns, and create a more flexible development environment. Use my [webhelp][27] package if it helps you. + +Or don’t! Whatever! It’s still a free country last I checked. + +#### Update + +Peter Kieltyka points me to his [Chi framework][77], which actually does seem to do the right things with respect to middleware, handlers, and contexts - certainly much more so than all the other frameworks I’ve seen. So, shoutout to Peter and the team at Pressly! + +-------------------------------------------------------------------------------- + +via: https://www.jtolio.com/2017/01/writing-advanced-web-applications-with-go + +作者:[jtolio.com][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.jtolio.com/ +[b]: https://github.com/lujun9972 +[1]: https://www.ruby-lang.org/ +[2]: http://rubyonrails.org/ +[3]: http://www.sinatrarb.com/ +[4]: https://www.python.org/ +[5]: https://www.djangoproject.com/ +[6]: http://flask.pocoo.org/ +[7]: https://golang.org/ +[8]: https://groups.google.com/d/forum/golang-nuts +[9]: https://www.reddit.com/r/golang/ +[10]: https://revel.github.io/ +[11]: https://gin-gonic.github.io/gin/ +[12]: http://iris-go.com/ +[13]: https://beego.me/ +[14]: https://go-macaron.com/ +[15]: https://github.com/go-martini/martini +[16]: https://github.com/gocraft/web +[17]: https://github.com/urfave/negroni +[18]: https://godoc.org/goji.io +[19]: https://echo.labstack.com/ +[20]: https://medium.com/code-zen/why-i-don-t-use-go-web-frameworks-1087e1facfa4 +[21]: https://groups.google.com/forum/#!topic/golang-nuts/R_lqsTTBh6I +[22]: https://www.reddit.com/r/golang/comments/1yh6gm/new_to_go_trying_to_select_web_framework/ +[23]: https://golang.org/pkg/net/http/#Handler +[24]: https://golang.org/pkg/net/http/#Request +[25]: https://golang.org/pkg/net/http/#Request.Context +[26]: https://golang.org/pkg/net/http/#Request.WithContext +[27]: https://godoc.org/gopkg.in/webhelp.v1 +[28]: https://golang.org/doc/articles/wiki/ +[29]: https://expressjs.com/ +[30]: https://nodejs.org/en/ +[31]: https://en.wikipedia.org/wiki/Cross-cutting_concern +[32]: https://github.com/gorilla/mux +[33]: https://github.com/gorilla/ +[34]: https://golang.org/pkg/net/http/#ServeMux +[35]: https://swtch.com/~rsc/ +[36]: https://github.com/rsc/tiddly +[37]: https://github.com/rsc/tiddly/blob/8f9145ac183e374eb95d90a73be4d5f38534ec47/tiddly.go#L201 +[38]: https://godoc.org/gopkg.in/webhelp.v1/whmux#Dir +[39]: https://godoc.org/gopkg.in/webhelp.v1/whmux +[40]: https://godoc.org/gopkg.in/webhelp.v1/whmux#IntArg +[41]: https://godoc.org/gopkg.in/webhelp.v1/whmux#StringArg +[42]: https://golang.org/pkg/context/ +[43]: https://blog.golang.org/context +[44]: https://godoc.org/golang.org/x/net/context +[45]: https://godoc.org/gopkg.in/webhelp.v1#GenSym +[46]: https://godoc.org/gopkg.in/webhelp.v1/whcompat +[47]: https://godoc.org/gopkg.in/webhelp.v1/whcompat#DoneNotify +[48]: https://godoc.org/gopkg.in/webhelp.v1/whcompat#CloseNotify +[49]: https://godoc.org/gopkg.in/webhelp.v1/wherr +[50]: https://godoc.org/gopkg.in/webhelp.v1/wherr#Handle +[51]: https://godoc.org/gopkg.in/webhelp.v1/wherr#pkg-variables +[52]: https://godoc.org/github.com/spacemonkeygo/errors +[53]: https://godoc.org/github.com/spacemonkeygo/errors/errhttp +[54]: https://github.com/zeebo/errs +[55]: https://godoc.org/gopkg.in/webhelp.v1/whsess +[56]: https://godoc.org/golang.org/x/crypto/nacl/secretbox +[57]: https://godoc.org/gopkg.in/webhelp.v1/whlog +[58]: https://godoc.org/gopkg.in/webhelp.v1/whlog#LogRequests +[59]: https://godoc.org/gopkg.in/webhelp.v1/whlog#LogResponses +[60]: https://godoc.org/gopkg.in/webhelp.v1/whlog#ListenAndServe +[61]: https://godoc.org/gopkg.in/webhelp.v1/whmon +[62]: https://godoc.org/gopkg.in/webhelp.v1/whgls +[63]: https://godoc.org/github.com/jtolds/gls +[64]: https://golang.org/pkg/html/template/ +[65]: https://godoc.org/gopkg.in/webhelp.v1/whtmpl +[66]: https://godoc.org/gopkg.in/webhelp.v1/whtmpl#Collection +[67]: https://godoc.org/gopkg.in/webhelp.v1/whtmpl#Pair +[68]: https://godoc.org/gopkg.in/go-webhelp/whoauth2.v1 +[69]: https://github.com/go-webhelp/whoauth2/blob/v1/examples/group/main.go +[70]: https://godoc.org/gopkg.in/go-webhelp/whgoth.v1 +[71]: https://github.com/markbates/goth +[72]: https://godoc.org/gopkg.in/webhelp.v1/whroute +[73]: https://godoc.org/gopkg.in/webhelp.v1/whparse +[74]: https://godoc.org/gopkg.in/webhelp.v1/whredir +[75]: https://godoc.org/gopkg.in/webhelp.v1/whcache +[76]: https://godoc.org/gopkg.in/webhelp.v1/whfatal +[77]: https://github.com/pressly/chi diff --git a/sources/tech/20180306 Exploring free and open web fonts.md b/sources/tech/20180306 Exploring free and open web fonts.md deleted file mode 100644 index 533286ca2c..0000000000 --- a/sources/tech/20180306 Exploring free and open web fonts.md +++ /dev/null @@ -1,70 +0,0 @@ -Exploring free and open web fonts -====== - -![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/osdc-lead-docdish-yellow-typewriter-keys.png?itok=0sPgIdMG) - -There is no question that the face of the web has been transformed in recent years by open source fonts. Prior to 2010, the only typefaces you were likely to see in a web browser were the generic "web safe" [core fonts][1] from Microsoft. But that year saw the start of several revolutions: the introduction of the Web Open Font Format ([WOFF][2]), which offered an open standard for efficiently delivering font files over HTTP, and the launch of web-font services like [Google Fonts][3] and the [Open Font Library][4]—both of which offered web publishers access to a large collection of fonts, for free, available under open licenses. - -It is hard to overstate the positive impact of these events on web typography. But it can be all too easy to equate the successes of open web fonts with open source typography as a whole and conclude that the challenges are behind us, the puzzles solved. That is not the case, so if you care about type, the good news is there are a lot of opportunities to get involved in improvement. - -For starters, it's critical to understand that Google Fonts and Open Font Library offer a specialized service—delivering fonts in web pages—and they don't implement solutions for other use cases. That is not a shortcoming on the services' side; it simply means that we have to develop other solutions. - -There are a number of problems to solve. Probably the most obvious example is the awkwardness of installing fonts on a desktop Linux machine for use in other applications. You can download any of the web fonts offered by either service, but all you will get is a generic ZIP file with some TTF or OTF binaries inside and a plaintext license file. What happens next is up to you to guess. - -Most users learn quickly that the "right" step is to manually copy those font binaries into any one of a handful of special directories on their hard drive. But that just makes the files visible to the operating system; it doesn't offer much in the way of a user experience. Again, this is not a flaw with the web-font service; rather it's evidence of the point where the service stops and more work needs to be done on the other side. - -A big improvement from the user's perspective would be for the OS or the desktop environment to be smarter at this "just downloaded" stage. Not only would it install the font files to the right location but, more importantly, it could add important metadata that the user will want to access when selecting a font to use in a project. - -What this additional information consists of and how it is presented to the user is tied to another challenge: Managing a font collection on Linux is noticeably less pleasant than on other operating systems. Periodically, font manager applications appear (see [GTK+ Font Manager][5] for one of the most recent examples), but they rarely catch on. I've been thinking a lot about where I think they come up short; one core factor is they have limited themselves to displaying only the information embedded in the font binary: basic character-set coverage, weight/width/slope settings, embedded license and copyright statements, etc. - -But a lot of decisions go into the process of selecting a font for a job besides what's in this embedded data. Serious font users—like information designers, journal article authors, or book designers—make their font-selection decisions in the context of each document's requirements and needs. That includes license information, naturally, but it includes much more, like information about the designer and the foundry, stylistic trends, or details about how the font works in use. - -For example, if your document includes both English and Arabic text, you probably want a font where the Latin and Arabic glyphs were designed together by someone experienced with the two scripts. Otherwise, you'll waste a ton of time making tiny adjustments to the font sizes and line spacing trying to get the two languages to mix well. You may have learned from experience that certain designers or vendors are better at multi-script design than others. Or it might be relevant to your project that today's fashion magazines almost exclusively use "[Didone][6]"-style typefaces, a name that refers to super-high-contrast styles pioneered by [Firmin Didot][7] and [Giambattista Bodoni][8] around 200 years ago. It just happens to be the trend. - -But none of those terms (Didone, Didot, or Bodoni) are likely to show up in the binary's embedded data, nor is easy to tell whether the Latin and Arabic fit together or anything else about the typeface's back history. That information might appear in supplementary material like a type specimen or font documentation—if any exists. - -A specimen is a designed document (often a PDF) that shows the font in use and includes background information; it frequently serves a dual role as a marketing piece and a sample to look at when choosing a font. The considered design of a specimen showcases how the font functions in practice and in a manner that an automatically generated character table simply cannot. Documentation may include some other vital information, like how to activate the font's OpenType features, what mathematical or archaic forms it provides, or how it varies stylistically across supported languages. Making this sort of material available to the user in the font-management application would go a long way towards helping users find the fonts that fit their projects' needs. - -Of course, if we're going to consider a font manager that can handle documentation and specimens, we also have to take a hard look at what comes with the font packages provided by distributions. Linux users start with a few fonts automatically installed, and repository-provided packages are the only font source most users have besides downloading the generic ZIP archive. Those packages tend to be pretty bare-bones. Commercial fonts generally include specimens, documentation, and other support items, whereas open source fonts usually do not. - -There are some excellent examples of open fonts that do provide quality specimens and documentation (see [SIL Gentium][9] and [Bungee][10] for two distinctly different but valid approaches), but they rarely (if ever) make their way into the downstream packaging chain. We plainly can do better. - -There are some technical obstacles to offering a richer user experience for interacting with the fonts on your system. For one thing, the [AppStream][11] metadata standard defines a few [parameters][12] specific to font files, but so far includes nothing that would cover specimens, designer and foundry information, and other relevant details. For another, the [SPDX][13] (Software Package Data Exchange) format does not cover many of the software licenses (and license variants) used to distribute fonts. - -Finally, as any audiophile will tell you, a music player that does not let you edit and augment the ID3 tags in your MP3 collection is going to get frustrating quickly. You want to fix errors in the tags, you want to add things like notes and album art—essentially, you want to polish your library. You would want to do the same to keep your local font library in a pleasant-to-use state. - -But editing the embedded data in a font file has been taboo because fonts tend to get embedded and attached to other documents. If you monkey with the fields in a font binary, then redistribute it with your presentation slides, anyone who downloads those slides can end up with bad metadata through no fault of their own. So anyone making improvements to the font-management experience will have to figure out how to strategically wrangle repeated changes to the embedded and external font metadata. - -In addition to the technical angle, enriching the font-management experience is also a design challenge. As I said above, good specimens and well-written documentation exist for several open fonts. But there are many more packages missing both, and there are a lot of older font packages that are no longer being maintained. That probably means the only way that most open font packages are going to get specimens or documentation is for the community to create them. - -Perhaps that's a tall order. But the open source design community is bigger than it has ever been, and it is a highly motivated segment of the overall free and open source software movement. So who knows; maybe this time next year finding, downloading, and using fonts on a desktop Linux system will be an entirely different experience. - -One train of thought on the typography challenges of modern Linux users includes packaging, document design, and maybe even a few new software components for desktop environments. There are other trains to consider, too. The commonality is that where the web-font service ends, matters get more difficult. - -The best news, from my perspective, is that there are more people interested in this topic than ever before. For that, I think we have the higher profile that open fonts have received from big web-font services like Google Fonts and Open Font Library to thank. - - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/18/3/webfonts - -作者:[Nathan Willis][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/n8willis -[1]:https://en.wikipedia.org/wiki/Core_fonts_for_the_Web -[2]:https://en.wikipedia.org/wiki/Web_Open_Font_Format -[3]:https://fonts.google.com/ -[4]:https://fontlibrary.org/ -[5]:https://fontmanager.github.io/ -[6]:https://en.wikipedia.org/wiki/Didone_(typography) -[7]:https://en.wikipedia.org/wiki/Firmin_Didot -[8]:https://en.wikipedia.org/wiki/Giambattista_Bodoni -[9]:https://software.sil.org/gentium/ -[10]:https://djr.com/bungee/ -[11]:https://www.freedesktop.org/wiki/Distributions/AppStream/ -[12]:https://www.freedesktop.org/software/appstream/docs/sect-Metadata-Fonts.html -[13]:https://spdx.org/ diff --git a/sources/tech/20180414 Go on very small hardware Part 2.md b/sources/tech/20180414 Go on very small hardware Part 2.md deleted file mode 100644 index 8ebfb263f1..0000000000 --- a/sources/tech/20180414 Go on very small hardware Part 2.md +++ /dev/null @@ -1,969 +0,0 @@ -Go on very small hardware (Part 2) -============================================================ - - - [![STM32F030F4P6](https://ziutek.github.io/images/mcu/f030-demo-board/board.jpg)][1] - -At the end of the [first part][2] of this article I promised to write something about  _interfaces_ . I don’t want to write here a complete or even brief lecture about the interfaces. Instead, I’ll show a simple example how to define and use an interface, and then, how to take advantage of ubiquitous  _io.Writer_  interface. There will also be a few words about  _reflection_  and  _semihosting_ . - -Interfaces are a crucial part of Go language. If you want to learn more about them, I suggest to read [Effective Go][3] and [Russ Cox article][4]. - -### Concurrent Blinky – revisited - -When you read the code of previous examples you probably noticed a counterintuitive way to turn the LED on or off. The  _Set_  method was used to turn the LED off and the  _Clear_  method was used to turn the LED on. This is due to driving the LEDs in open-drain configuration. What we can do to make the code less confusing? Let’s define the  _LED_  type with  _On_  and  _Off_  methods: - -``` -type LED struct { - pin gpio.Pin -} - -func (led LED) On() { - led.pin.Clear() -} - -func (led LED) Off() { - led.pin.Set() -} - -``` - -Now we can simply call `led.On()` and `led.Off()` which no longer raises any doubts. - -In all previous examples I tried to use the same open-drain configuration to don’t complicate the code. But in the last example, it would be easier for me to connect the third LED between GND and PA3 pins and configure PA3 in push-pull mode. The next example will use a LED connected this way. - -But our new  _LED_  type doesn’t support the push-pull configuration. In fact, we should call it  _OpenDrainLED_  and define another  _PushPullLED_  type: - -``` -type PushPullLED struct { - pin gpio.Pin -} - -func (led PushPullLED) On() { - led.pin.Set() -} - -func (led PushPullLED) Off() { - led.pin.Clear() -} - -``` - -Note, that both types have the same methods that work the same. It would be nice if the code that operates on LEDs could use both types, without paying attention to which one it uses at the moment. The  _interface type_  comes to help: - -``` -package main - -import ( - "delay" - - "stm32/hal/gpio" - "stm32/hal/system" - "stm32/hal/system/timer/systick" -) - -type LED interface { - On() - Off() -} - -type PushPullLED struct{ pin gpio.Pin } - -func (led PushPullLED) On() { - led.pin.Set() -} - -func (led PushPullLED) Off() { - led.pin.Clear() -} - -func MakePushPullLED(pin gpio.Pin) PushPullLED { - pin.Setup(&gpio.Config{Mode: gpio.Out, Driver: gpio.PushPull}) - return PushPullLED{pin} -} - -type OpenDrainLED struct{ pin gpio.Pin } - -func (led OpenDrainLED) On() { - led.pin.Clear() -} - -func (led OpenDrainLED) Off() { - led.pin.Set() -} - -func MakeOpenDrainLED(pin gpio.Pin) OpenDrainLED { - pin.Setup(&gpio.Config{Mode: gpio.Out, Driver: gpio.OpenDrain}) - return OpenDrainLED{pin} -} - -var led1, led2 LED - -func init() { - system.SetupPLL(8, 1, 48/8) - systick.Setup(2e6) - - gpio.A.EnableClock(false) - led1 = MakeOpenDrainLED(gpio.A.Pin(4)) - led2 = MakePushPullLED(gpio.A.Pin(3)) -} - -func blinky(led LED, period int) { - for { - led.On() - delay.Millisec(100) - led.Off() - delay.Millisec(period - 100) - } -} - -func main() { - go blinky(led1, 500) - blinky(led2, 1000) -} - -``` - -We’ve defined  _LED_  interface that has two methods:  _On_  and  _Off_ . The  _PushPullLED_  and  _OpenDrainLED_ types represent two ways of driving LEDs. We also defined two  _Make_ _*LED_  functions which act as constructors. Both types implement the  _LED_  interface, so the values of these types can be assigned to the variables of type  _LED_ : - -``` -led1 = MakeOpenDrainLED(gpio.A.Pin(4)) -led2 = MakePushPullLED(gpio.A.Pin(3)) - -``` - -In this case the assignability is checked at compile time. After the assignment the  _led1_  variable contains `OpenDrainLED{gpio.A.Pin(4)}` and a pointer to the method set of the  _OpenDrainLED_  type. The `led1.On()` call roughly corresponds to the following C code: - -``` -led1.methods->On(led1.value) - -``` - -As you can see, this is quite inexpensive abstraction if only consider the function call overhead. - -But any assigment to an interface causes to include a lot of information about the assigned type. There can be a lot information in case of complex type which consists of many other types: - -``` -$ egc -$ arm-none-eabi-size cortexm0.elf - text data bss dec hex filename - 10356 196 212 10764 2a0c cortexm0.elf - -``` - -If we don’t use [reflection][5] we can save some bytes by avoid to include the names of types and struct fields: - -``` -$ egc -nf -nt -$ arm-none-eabi-size cortexm0.elf - text data bss dec hex filename - 10312 196 212 10720 29e0 cortexm0.elf - -``` - -The resulted binary still contains some necessary information about types and full information about all exported methods (with names). This information is need for checking assignability at runtime, mainly when you assign one value stored in the interface variable to any other variable. - -We can also remove type and field names from imported packages by recompiling them all: - -``` -$ cd $HOME/emgo -$ ./clean.sh -$ cd $HOME/firstemgo -$ egc -nf -nt -$ arm-none-eabi-size cortexm0.elf - text data bss dec hex filename - 10272 196 212 10680 29b8 cortexm0.elf - -``` - -Let’s load this program to see does it work as expected. This time we’ll use the [st-flash][6] command: - -``` -$ arm-none-eabi-objcopy -O binary cortexm0.elf cortexm0.bin -$ st-flash write cortexm0.bin 0x8000000 -st-flash 1.4.0-33-gd76e3c7 -2018-04-10T22:04:34 INFO usb.c: -- exit_dfu_mode -2018-04-10T22:04:34 INFO common.c: Loading device parameters.... -2018-04-10T22:04:34 INFO common.c: Device connected is: F0 small device, id 0x10006444 -2018-04-10T22:04:34 INFO common.c: SRAM size: 0x1000 bytes (4 KiB), Flash: 0x4000 bytes (16 KiB) in pages of 1024 bytes -2018-04-10T22:04:34 INFO common.c: Attempting to write 10468 (0x28e4) bytes to stm32 address: 134217728 (0x8000000) -Flash page at addr: 0x08002800 erased -2018-04-10T22:04:34 INFO common.c: Finished erasing 11 pages of 1024 (0x400) bytes -2018-04-10T22:04:34 INFO common.c: Starting Flash write for VL/F0/F3/F1_XL core id -2018-04-10T22:04:34 INFO flash_loader.c: Successfully loaded flash loader in sram - 11/11 pages written -2018-04-10T22:04:35 INFO common.c: Starting verification of write complete -2018-04-10T22:04:35 INFO common.c: Flash written and verified! jolly good! - -``` - -I didn’t connected the NRST signal to the programmer so the  _—reset_  option can’t be used and the reset button have to be pressed to run the program. - -![Interfaces](https://ziutek.github.io/images/mcu/f030-demo-board/interfaces.png) - -It seems that the  _st-flash_  works a bit unreliably with this board (often requires reseting the ST-LINK dongle). Additionally, the current version doesn’t issue the reset command over SWD (uses only NRST signal). The software reset isn’t realiable however it usually works and lack of it introduces inconvenience. For this board-programmer pair the  _OpenOCD_  works much better. - -### UART - -UART (Universal Aynchronous Receiver-Transmitter) is still one of the most important peripherals of today’s microcontrollers. Its advantage is unique combination of the following properties: - -* relatively high speed, - -* only two signal lines (even one in case of half-duplex communication), - -* symmetry of roles, - -* synchronous in-band signaling about new data (start bit), - -* accurate timing inside transmitted word. - -This causes that UART, originally intedned to transmit asynchronous messages consisting of 7-9 bit words, is also used to efficiently implement various other phisical protocols such as used by [WS28xx LEDs][7] or [1-wire][8] devices. - -However, we will use the UART in its usual role: to printing text messages from our program. - -``` -package main - -import ( - "io" - "rtos" - - "stm32/hal/dma" - "stm32/hal/gpio" - "stm32/hal/irq" - "stm32/hal/system" - "stm32/hal/system/timer/systick" - "stm32/hal/usart" -) - -var tts *usart.Driver - -func init() { - system.SetupPLL(8, 1, 48/8) - systick.Setup(2e6) - - gpio.A.EnableClock(true) - tx := gpio.A.Pin(9) - - tx.Setup(&gpio.Config{Mode: gpio.Alt}) - tx.SetAltFunc(gpio.USART1_AF1) - d := dma.DMA1 - d.EnableClock(true) - tts = usart.NewDriver(usart.USART1, d.Channel(2, 0), nil, nil) - tts.Periph().EnableClock(true) - tts.Periph().SetBaudRate(115200) - tts.Periph().Enable() - tts.EnableTx() - - rtos.IRQ(irq.USART1).Enable() - rtos.IRQ(irq.DMA1_Channel2_3).Enable() -} - -func main() { - io.WriteString(tts, "Hello, World!\r\n") -} - -func ttsISR() { - tts.ISR() -} - -func ttsDMAISR() { - tts.TxDMAISR() -} - -//c:__attribute__((section(".ISRs"))) -var ISRs = [...]func(){ - irq.USART1: ttsISR, - irq.DMA1_Channel2_3: ttsDMAISR, -} - -``` - -You can find this code slightly complicated but for now there is no simpler UART driver in STM32 HAL (simple polling driver will be probably useful in some cases). The  _usart.Driver_  is efficient driver that uses DMA and interrupts to ofload the CPU. - -STM32 USART peripheral provides traditional UART and its synchronous version. To use it as output we have to connect its Tx signal to the right GPIO pin: - -``` -tx.Setup(&gpio.Config{Mode: gpio.Alt}) -tx.SetAltFunc(gpio.USART1_AF1) - -``` - -The  _usart.Driver_  is configured in Tx-only mode (rxdma and rxbuf are set to nil): - -``` -tts = usart.NewDriver(usart.USART1, d.Channel(2, 0), nil, nil) - -``` - -We use its  _WriteString_  method to print the famous sentence. Let’s clean everything and compile this program: - -``` -$ cd $HOME/emgo -$ ./clean.sh -$ cd $HOME/firstemgo -$ egc -$ arm-none-eabi-size cortexm0.elf - text data bss dec hex filename - 12728 236 176 13140 3354 cortexm0.elf - -``` - -To see something you need an UART peripheral in your PC. - -**Do not use RS232 port or USB to RS232 converter!** - -The STM32 family uses 3.3 V logic but RS232 can produce from -15 V to +15 V which will probably demage your MCU. You need USB to UART converter that uses 3.3 V logic. Popular converters are based on FT232 or CP2102 chips. - -![UART](https://ziutek.github.io/images/mcu/f030-demo-board/uart.jpg) - -You also need some terminal emulator program (I prefer [picocom][9]). Flash the new image, run the terminal emulator and press the reset button a few times: - -``` -$ openocd -d0 -f interface/stlink.cfg -f target/stm32f0x.cfg -c 'init; program cortexm0.elf; reset run; exit' -Open On-Chip Debugger 0.10.0+dev-00319-g8f1f912a (2018-03-07-19:20) -Licensed under GNU GPL v2 -For bug reports, read - http://openocd.org/doc/doxygen/bugs.html -debug_level: 0 -adapter speed: 1000 kHz -adapter_nsrst_delay: 100 -none separate -adapter speed: 950 kHz -target halted due to debug-request, current mode: Thread -xPSR: 0xc1000000 pc: 0x080016f4 msp: 0x20000a20 -adapter speed: 4000 kHz -** Programming Started ** -auto erase enabled -target halted due to breakpoint, current mode: Thread -xPSR: 0x61000000 pc: 0x2000003a msp: 0x20000a20 -wrote 13312 bytes from file cortexm0.elf in 1.020185s (12.743 KiB/s) -** Programming Finished ** -adapter speed: 950 kHz -$ -$ picocom -b 115200 /dev/ttyUSB0 -picocom v3.1 - -port is : /dev/ttyUSB0 -flowcontrol : none -baudrate is : 115200 -parity is : none -databits are : 8 -stopbits are : 1 -escape is : C-a -local echo is : no -noinit is : no -noreset is : no -hangup is : no -nolock is : no -send_cmd is : sz -vv -receive_cmd is : rz -vv -E -imap is : -omap is : -emap is : crcrlf,delbs, -logfile is : none -initstring : none -exit_after is : not set -exit is : no - -Type [C-a] [C-h] to see available commands -Terminal ready -Hello, World! -Hello, World! -Hello, World! - -``` - -Every press of the reset button produces new “Hello, World!” line. Everything works as expected. - -To see bi-directional UART code for this MCU check out [this example][10]. - -### io.Writer - -The  _io.Writer_  interface is probably the second most commonly used interface type in Go, right after the  _error_  interface. Its definition looks like this: - -``` -type Writer interface { - Write(p []byte) (n int, err error) -} - -``` - - _usart.Driver_  implements  _io.Writer_  so we can replace: - -``` -tts.WriteString("Hello, World!\r\n") - -``` - -with - -``` -io.WriteString(tts, "Hello, World!\r\n") - -``` - -Additionally you need to add the  _io_  package to the  _import_  section. - -The declaration of  _io.WriteString_  function looks as follows: - -``` -func WriteString(w Writer, s string) (n int, err error) - -``` - -As you can see, the  _io.WriteString_  allows to write strings using any type that implements  _io.Writer_ interface. Internally it check does the underlying type has  _WriteString_  method and uses it instead of  _Write_  if available. - -Let’s compile the modified program: - -``` -$ egc -$ arm-none-eabi-size cortexm0.elf - text data bss dec hex filename - 15456 320 248 16024 3e98 cortexm0.elf - -``` - -As you can see,  _io.WriteString_  causes a significant increase in the size of the binary: 15776 - 12964 = 2812 bytes. There isn’t too much space left on the Flash. What caused such a drastic increase in size? - -Using the command: - -``` -arm-none-eabi-nm --print-size --size-sort --radix=d cortexm0.elf - -``` - -we can print all symbols ordered by its size for both cases. By filtering and analyzing the obtained data (awk, diff) we can find about 80 new symbols. The ten largest are: - -``` -> 00000062 T stm32$hal$usart$Driver$DisableRx -> 00000072 T stm32$hal$usart$Driver$RxDMAISR -> 00000076 T internal$Type$Implements -> 00000080 T stm32$hal$usart$Driver$EnableRx -> 00000084 t errors$New -> 00000096 R $8$stm32$hal$usart$Driver$$ -> 00000100 T stm32$hal$usart$Error$Error -> 00000360 T io$WriteString -> 00000660 T stm32$hal$usart$Driver$Read - -``` - -So, even though we don’t use the  _usart.Driver.Read_  method it was compiled in, same as  _DisableRx_ ,  _RxDMAISR_ ,  _EnableRx_  and other not mentioned above. Unfortunately, if you assign something to the interface, its full method set is required (with all dependences). This isn’t a problem for a large programs that use most of the methods anyway. But for our simple one it’s a huge burden. - -We’re already close to the limits of our MCU but let’s try to print some numbers (you need to replace  _io_ package with  _strconv_  in  _import_  section): - -``` -func main() { - a := 12 - b := -123 - - tts.WriteString("a = ") - strconv.WriteInt(tts, a, 10, 0, 0) - tts.WriteString("\r\n") - tts.WriteString("b = ") - strconv.WriteInt(tts, b, 10, 0, 0) - tts.WriteString("\r\n") - - tts.WriteString("hex(a) = ") - strconv.WriteInt(tts, a, 16, 0, 0) - tts.WriteString("\r\n") - tts.WriteString("hex(b) = ") - strconv.WriteInt(tts, b, 16, 0, 0) - tts.WriteString("\r\n") -} - -``` - -As in the case of  _io.WriteString_  function, the first argument of the  _strconv.WriteInt_  is of type  _io.Writer_ . - -``` -$ egc -/usr/local/arm/bin/arm-none-eabi-ld: /home/michal/firstemgo/cortexm0.elf section `.rodata' will not fit in region `Flash' -/usr/local/arm/bin/arm-none-eabi-ld: region `Flash' overflowed by 692 bytes -exit status 1 - -``` - -This time we’ve run out of space. Let’s try to slim down the information about types: - -``` -$ cd $HOME/emgo -$ ./clean.sh -$ cd $HOME/firstemgo -$ egc -nf -nt -$ arm-none-eabi-size cortexm0.elf - text data bss dec hex filename - 15876 316 320 16512 4080 cortexm0.elf - -``` - -It was close, but we fit. Let’s load and run this code: - -``` -a = 12 -b = -123 -hex(a) = c -hex(b) = -7b - -``` - -The  _strconv_  package in Emgo is quite different from its archetype in Go. It is intended for direct use to write formatted numbers and in many cases can replace heavy  _fmt_  package. That’s why the function names start with  _Write_  instead of  _Format_  and have additional two parameters. Below is an example of their use: - -``` -func main() { - b := -123 - strconv.WriteInt(tts, b, 10, 0, 0) - tts.WriteString("\r\n") - strconv.WriteInt(tts, b, 10, 6, ' ') - tts.WriteString("\r\n") - strconv.WriteInt(tts, b, 10, 6, '0') - tts.WriteString("\r\n") - strconv.WriteInt(tts, b, 10, 6, '.') - tts.WriteString("\r\n") - strconv.WriteInt(tts, b, 10, -6, ' ') - tts.WriteString("\r\n") - strconv.WriteInt(tts, b, 10, -6, '0') - tts.WriteString("\r\n") - strconv.WriteInt(tts, b, 10, -6, '.') - tts.WriteString("\r\n") -} - -``` - -There is its output: - -``` --123 - -123 --00123 -..-123 --123 --123 --123.. - -``` - -### Unix streams and Morse code - -Thanks to the fact that most of the functions that write something use  _io.Writer_  instead of concrete type (eg.  _FILE_  in C) we get a functionality similar to  _Unix streams_ . In Unix we can easily combine simple commands to perform larger tasks. For example, we can write text to the file this way: - -``` -echo "Hello, World!" > file.txt - -``` - -The `>` operator writes the output stream of the preceding command to the file. There is also `|`operator that connects output and input streams of adjacent commands. - -Thanks to the streams we can easily convert/filter output of any command. For example, to convert all letters to uppercase we can filter the echo’s output through  _tr_  command: - -``` -echo "Hello, World!" | tr a-z A-Z > file.txt - -``` - -To show the analogy between  _io.Writer_  and Unix streams let’s write our: - -``` -io.WriteString(tts, "Hello, World!\r\n") - -``` - -in the following pseudo-unix form: - -``` -io.WriteString "Hello, World!" | usart.Driver usart.USART1 - -``` - -The next example will show how to do this: - -``` -io.WriteString "Hello, World!" | MorseWriter | usart.Driver usart.USART1 - -``` - -Let’s create a simple encoder that encodes the text written to it using Morse coding: - -``` -type MorseWriter struct { - W io.Writer -} - -func (w *MorseWriter) Write(s []byte) (int, error) { - var buf [8]byte - for n, c := range s { - switch { - case c == '\n': - c = ' ' // Replace new lines with spaces. - case 'a' <= c && c <= 'z': - c -= 'a' - 'A' // Convert to upper case. - } - if c < ' ' || 'Z' < c { - continue // c is outside ASCII [' ', 'Z'] - } - var symbol morseSymbol - if c == ' ' { - symbol.length = 1 - buf[0] = ' ' - } else { - symbol = morseSymbols[c-'!'] - for i := uint(0); i < uint(symbol.length); i++ { - if (symbol.code>>i)&1 != 0 { - buf[i] = '-' - } else { - buf[i] = '.' - } - } - } - buf[symbol.length] = ' ' - if _, err := w.W.Write(buf[:symbol.length+1]); err != nil { - return n, err - } - } - return len(s), nil -} - -type morseSymbol struct { - code, length byte -} - -//emgo:const -var morseSymbols = [...]morseSymbol{ - {1<<0 | 1<<1 | 1<<2, 4}, // ! ---. - {1<<1 | 1<<4, 6}, // " .-..-. - {}, // # - {1<<3 | 1<<6, 7}, // $ ...-..- - - // Some code omitted... - - {1<<0 | 1<<3, 4}, // X -..- - {1<<0 | 1<<2 | 1<<3, 4}, // Y -.-- - {1<<0 | 1<<1, 4}, // Z --.. -} - -``` - -You can find the full  _morseSymbols_  array [here][11]. The `//emgo:const` directive ensures that  _morseSymbols_ array won’t be copied to the RAM. - -Now we can print our sentence in two ways: - -``` -func main() { - s := "Hello, World!\r\n" - mw := &MorseWriter{tts} - - io.WriteString(tts, s) - io.WriteString(mw, s) -} - -``` - -We use the pointer to the  _MorseWriter_  `&MorseWriter{tts}` instead os simple `MorseWriter{tts}` value beacuse the  _MorseWriter_  is to big to fit into an interface variable. - -Emgo, unlike Go, doesn’t dynamically allocate memory for value stored in interface variable. The interface type has limited size, equal to the size of three pointers (to fit  _slice_ ) or two  _float64_  (to fit  _complex128_ ), what is bigger. It can directly store values of all basic types and small structs/arrays but for bigger values you must use pointers. - -Let’s compile this code and see its output: - -``` -$ egc -$ arm-none-eabi-size cortexm0.elf - text data bss dec hex filename - 15152 324 248 15724 3d6c cortexm0.elf - -``` - -``` -Hello, World! -.... . .-.. .-.. --- --..-- .-- --- .-. .-.. -.. ---. - -``` - -### The Ultimate Blinky - -The  _Blinky_  is hardware equivalent of  _Hello, World!_  program. Once we have a Morse encoder we can easly combine both to obtain the  _Ultimate Blinky_  program: - -``` -package main - -import ( - "delay" - "io" - - "stm32/hal/gpio" - "stm32/hal/system" - "stm32/hal/system/timer/systick" -) - -var led gpio.Pin - -func init() { - system.SetupPLL(8, 1, 48/8) - systick.Setup(2e6) - - gpio.A.EnableClock(false) - led = gpio.A.Pin(4) - - cfg := gpio.Config{Mode: gpio.Out, Driver: gpio.OpenDrain, Speed: gpio.Low} - led.Setup(&cfg) -} - -type Telegraph struct { - Pin gpio.Pin - Dotms int // Dot length [ms] -} - -func (t Telegraph) Write(s []byte) (int, error) { - for _, c := range s { - switch c { - case '.': - t.Pin.Clear() - delay.Millisec(t.Dotms) - t.Pin.Set() - delay.Millisec(t.Dotms) - case '-': - t.Pin.Clear() - delay.Millisec(3 * t.Dotms) - t.Pin.Set() - delay.Millisec(t.Dotms) - case ' ': - delay.Millisec(3 * t.Dotms) - } - } - return len(s), nil -} - -func main() { - telegraph := &MorseWriter{Telegraph{led, 100}} - for { - io.WriteString(telegraph, "Hello, World! ") - } -} - -// Some code omitted... - -``` - -In the above example I omitted the definition of  _MorseWriter_  type because it was shown earlier. The full version is available [here][12]. Let’s compile it and run: - -``` -$ egc -$ arm-none-eabi-size cortexm0.elf - text data bss dec hex filename - 11772 244 244 12260 2fe4 cortexm0.elf - -``` - -![Ultimate Blinky](https://ziutek.github.io/images/mcu/f030-demo-board/morse.png) - -### Reflection - -Yes, Emgo supports [reflection][13]. The  _reflect_  package isn’t complete yet but that what is done is enough to implement  _fmt.Print_  family of functions. Let’s see what can we do on our small MCU. - -To reduce memory usage we will use [semihosting][14] as standard output. For convenience, we also write simple  _println_  function which to some extent mimics  _fmt.Println_ . - -``` -package main - -import ( - "debug/semihosting" - "reflect" - "strconv" - - "stm32/hal/system" - "stm32/hal/system/timer/systick" -) - -var stdout semihosting.File - -func init() { - system.SetupPLL(8, 1, 48/8) - systick.Setup(2e6) - - var err error - stdout, err = semihosting.OpenFile(":tt", semihosting.W) - for err != nil { - } -} - -type stringer interface { - String() string -} - -func println(args ...interface{}) { - for i, a := range args { - if i > 0 { - stdout.WriteString(" ") - } - switch v := a.(type) { - case string: - stdout.WriteString(v) - case int: - strconv.WriteInt(stdout, v, 10, 0, 0) - case bool: - strconv.WriteBool(stdout, v, 't', 0, 0) - case stringer: - stdout.WriteString(v.String()) - default: - stdout.WriteString("%unknown") - } - } - stdout.WriteString("\r\n") -} - -type S struct { - A int - B bool -} - -func main() { - p := &S{-123, true} - - v := reflect.ValueOf(p) - - println("kind(p) =", v.Kind()) - println("kind(*p) =", v.Elem().Kind()) - println("type(*p) =", v.Elem().Type()) - - v = v.Elem() - - println("*p = {") - for i := 0; i < v.NumField(); i++ { - ft := v.Type().Field(i) - fv := v.Field(i) - println(" ", ft.Name(), ":", fv.Interface()) - } - println("}") -} - -``` - -The  _semihosting.OpenFile_  function allows to open/create file on the host side. The special path  _:tt_ corresponds to host’s standard output. - -The  _println_  function accepts arbitrary number of arguments, each of arbitrary type: - -``` -func println(args ...interface{}) - -``` - -It’s possible because any type implements the empty interface  _interface{}_ . The  _println_  uses [type switch][15] to print strings, integers and booleans: - -``` -switch v := a.(type) { -case string: - stdout.WriteString(v) -case int: - strconv.WriteInt(stdout, v, 10, 0, 0) -case bool: - strconv.WriteBool(stdout, v, 't', 0, 0) -case stringer: - stdout.WriteString(v.String()) -default: - stdout.WriteString("%unknown") -} - -``` - -Additionally it supports any type that implements  _stringer_  interface, that is, any type that has  _String()_ method. In any  _case_  clause the  _v_  variable has the right type, same as listed after  _case_  keyword. - -The `reflect.ValueOf(p)` returns  _p_  in the form that allows to analyze its type and content programmatically. As you can see, we can even dereference pointers using `v.Elem()` and print all struct fields with their names. - -Let’s try to compile this code. For now let’s see what will come out if compiled without type and field names: - -``` -$ egc -nt -nf -$ arm-none-eabi-size cortexm0.elf - text data bss dec hex filename - 16028 216 312 16556 40ac cortexm0.elf - -``` - -Only 140 free bytes left on the Flash. Let’s load it using OpenOCD with semihosting enabled: - -``` -$ openocd -d0 -f interface/stlink.cfg -f target/stm32f0x.cfg -c 'init; program cortexm0.elf; arm semihosting enable; reset run' -Open On-Chip Debugger 0.10.0+dev-00319-g8f1f912a (2018-03-07-19:20) -Licensed under GNU GPL v2 -For bug reports, read - http://openocd.org/doc/doxygen/bugs.html -debug_level: 0 -adapter speed: 1000 kHz -adapter_nsrst_delay: 100 -none separate -adapter speed: 950 kHz -target halted due to debug-request, current mode: Thread -xPSR: 0xc1000000 pc: 0x08002338 msp: 0x20000a20 -adapter speed: 4000 kHz -** Programming Started ** -auto erase enabled -target halted due to breakpoint, current mode: Thread -xPSR: 0x61000000 pc: 0x2000003a msp: 0x20000a20 -wrote 16384 bytes from file cortexm0.elf in 0.700133s (22.853 KiB/s) -** Programming Finished ** -semihosting is enabled -adapter speed: 950 kHz -kind(p) = ptr -kind(*p) = struct -type(*p) = -*p = { - X. : -123 - X. : true -} - -``` - -If you’ve actually run this code, you noticed that semihosting is slow, especially if you write a byte after byte (buffering helps). - -As you can see, there is no type name for `*p` and all struct fields have the same  _X._  name. Let’s compile this program again, this time without  _-nt -nf_  options: - -``` -$ egc -$ arm-none-eabi-size cortexm0.elf - text data bss dec hex filename - 16052 216 312 16580 40c4 cortexm0.elf - -``` - -Now the type and field names have been included but only these defined in  ~~_main.go_  file~~  _main_  package. The output of our program looks as follows: - -``` -kind(p) = ptr -kind(*p) = struct -type(*p) = S -*p = { - A : -123 - B : true -} - -``` - -Reflection is a crucial part of any easy to use serialization library and serialization ~~algorithms~~ like [JSON][16]gain in importance in the IOT era. - -This is where I finish the second part of this article. I think there is a chance for the third part, more entertaining, where we connect to this board various interesting devices. If this board won’t carry them, we replace it with something a little bigger. - --------------------------------------------------------------------------------- - -via: https://ziutek.github.io/2018/04/14/go_on_very_small_hardware2.html - -作者:[Michał Derkacz ][a] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]:https://ziutek.github.io/ -[1]:https://ziutek.github.io/2018/04/14/go_on_very_small_hardware2.html -[2]:https://ziutek.github.io/2018/03/30/go_on_very_small_hardware.html -[3]:https://golang.org/doc/effective_go.html#interfaces -[4]:https://research.swtch.com/interfaces -[5]:https://blog.golang.org/laws-of-reflection -[6]:https://github.com/texane/stlink -[7]:http://www.world-semi.com/solution/list-4-1.html -[8]:https://en.wikipedia.org/wiki/1-Wire -[9]:https://github.com/npat-efault/picocom -[10]:https://github.com/ziutek/emgo/blob/master/egpath/src/stm32/examples/f030-demo-board/usart/main.go -[11]:https://github.com/ziutek/emgo/blob/master/egpath/src/stm32/examples/f030-demo-board/morseuart/main.go -[12]:https://github.com/ziutek/emgo/blob/master/egpath/src/stm32/examples/f030-demo-board/morseled/main.go -[13]:https://blog.golang.org/laws-of-reflection -[14]:http://infocenter.arm.com/help/topic/com.arm.doc.dui0471g/Bgbjjgij.html -[15]:https://golang.org/doc/effective_go.html#type_switch -[16]:https://en.wikipedia.org/wiki/JSON diff --git a/sources/tech/20180416 Cgo and Python.md b/sources/tech/20180416 Cgo and Python.md index c78a820276..e5688d43c8 100644 --- a/sources/tech/20180416 Cgo and Python.md +++ b/sources/tech/20180416 Cgo and Python.md @@ -1,5 +1,4 @@ Cgo and Python -[#] MonkeyDEcho translating ============================================================ ![](https://datadog-prod.imgix.net/img/blog/engineering/cgo-and-python/cgo_python_hero.png?auto=format&w=1900&dpr=1) diff --git a/sources/tech/20180425 An introduction to the GNU Core Utilities - Opensource.com.md b/sources/tech/20180425 An introduction to the GNU Core Utilities - Opensource.com.md deleted file mode 100644 index aaa5a6ca00..0000000000 --- a/sources/tech/20180425 An introduction to the GNU Core Utilities - Opensource.com.md +++ /dev/null @@ -1,146 +0,0 @@ -An introduction to the GNU Core Utilities -====== - -![Introduction to the GNU Core Utilities](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/core-utils.jpg?itok=YTkmsnyy "Introduction to the GNU Core Utilities") - -Image credits :  - -[Bella67][1] via Pixabay. [CC0][2]. - -Two sets of utilities—the [GNU Core Utilities][3] and util-linux—comprise many of the Linux system administrator's most basic and regularly used tools. Their basic functions allow sysadmins to perform many of the tasks required to administer a Linux computer, including management and manipulation of text files, directories, data streams, storage media, process controls, filesystems, and much more. - -These tools are indispensable because, without them, it is impossible to accomplish any useful work on a Unix or Linux computer. Given their importance, let's examine them. - -### GNU coreutils - -The Linux Terminal - -* [Top 7 terminal emulators for Linux][4] -* [10 command-line tools for data analysis in Linux][5] -* [Download Now: SSH cheat sheet][6] -* [Advanced Linux commands cheat sheet][7] - -To understand the origins of the GNU Core Utilities, we need to take a short trip in the Wayback machine to the early days of Unix at Bell Labs. [Unix was written][8] so Ken Thompson, Dennis Ritchie, Doug McIlroy, and Joe Ossanna could continue with something they had started while working on a large multi-tasking and multi-user computer project called [Multics][9]. That little something was a game called Space Travel. As remains true today, it always seems to be the gamers who drive forward the technology of computing. This new operating system was much more limited than Multics, as only two users could log in at a time, so it was called Unics. This name was later changed to Unix. - -Over time, Unix turned out to be such a success that Bell Labs began essentially giving it away it to universities and later to companies for the cost of the media and shipping. Back in those days, system-level software was shared between organizations and programmers as they worked to achieve common goals within the context of system administration. - -Eventually, the [PHBs][10] at AT&T decided they should make money on Unix and started using more restrictive—and expensive—licensing. This was taking place at a time when software was becoming more proprietary, restricted, and closed. It was becoming impossible to share software with other users and organizations. - -Some people did not like this and fought it with free software. Richard M. Stallman, aka RMS, led a group of rebels who were trying to write an open and freely available operating system they called the GNU Operating System. This group created the GNU Utilities but didn't produce a viable kernel. - -When Linus Torvalds first wrote and compiled the Linux kernel, he needed a set of very basic system utilities to even begin to perform marginally useful work. The kernel does not provide commands or any type of command shell such as Bash. It is useless by itself. So, Linus used the freely available GNU Core Utilities and recompiled them for Linux. This gave him a complete, if quite basic, operating system. - -You can learn about all the individual programs that comprise the GNU Utilities by entering the command info coreutils at a terminal command line. The following list of the core utilities is part of that info page. The utilities are grouped by function to make specific ones easier to find; in the terminal, highlight the group you want more information on and press the Enter key. - -``` -* Output of entire files::       cat tac nl od base32 base64 -* Formatting file contents::     fmt pr fold -* Output of parts of files::     head tail split csplit -* Summarizing files::            wc sum cksum b2sum md5sum sha1sum sha2 -* Operating on sorted files::    sort shuf uniq comm ptx tsort -* Operating on fields::          cut paste join -* Operating on characters::      tr expand unexpand -* Directory listing::            ls dir vdir dircolors -* Basic operations::             cp dd install mv rm shred -* Special file types::           mkdir rmdir unlink mkfifo mknod ln link readlink -* Changing file attributes::     chgrp chmod chown touch -* Disk usage::                   df du stat sync truncate -* Printing text::                echo printf yes -* Conditions::                   false true test expr -* Redirection::                  tee -* File name manipulation::       dirname basename pathchk mktemp realpath -* Working context::              pwd stty printenv tty -* User information::             id logname whoami groups users who -* System context::               date arch nproc uname hostname hostid uptime -* SELinux context::              chcon runcon -* Modified command invocation::  chroot env nice nohup stdbuf timeout -* Process control::              kill -* Delaying::                     sleep -* Numeric operations::           factor numfmt seq -``` - -There are 102 utilities on this list. It covers many of the functions necessary to perform basic tasks on a Unix or Linux host. However, many basic utilities are missing. For example, the mount and umount commands are not in this list. Those and many of the other commands that are not in the GNU coreutils can be found in the util-linux collection. - -### util-linux - -The util-linix package of utilities contains many of the other common commands that sysadmins use. These utilities are distributed by the Linux Kernel Organization, and virtually every one of these 107 commands were originally three separate collections—fileutils, shellutils, and textutils—which were [combined into the single package][11] util-linux in 2003. - -``` -agetty          fsck.minix      mkfs.bfs        setpriv -blkdiscard      fsfreeze        mkfs.cramfs     setsid -blkid           fstab           mkfs.minix      setterm -blockdev        fstrim          mkswap          sfdisk -cal             getopt          more            su -cfdisk          hexdump         mount           sulogin -chcpu           hwclock         mountpoint      swaplabel -chfn            ionice          namei           swapoff -chrt            ipcmk           newgrp          swapon -chsh            ipcrm           nologin         switch_root -colcrt          ipcs            nsenter         tailf -col             isosize         partx           taskset -colrm           kill            pg              tunelp -column          last            pivot_root      ul -ctrlaltdel      ldattach        prlimit         umount -ddpart          line            raw             unshare -delpart         logger          readprofile     utmpdump -dmesg           login           rename          uuidd -eject           look            renice          uuidgen -fallocate       losetup         reset           vipw -fdformat        lsblk           resizepart      wall -fdisk           lscpu           rev             wdctl -findfs          lslocks         RTC Alarm       whereis -findmnt         lslogins        runuser         wipefs -flock           mcookie         script          write -fsck            mesg            scriptreplay    zramctl -fsck.cramfs     mkfs            setarch -``` - -Some of these utilities have been deprecated and will likely fall out of the collection at some point in the future. You should check [Wikipedia's util-linux page][12] for information on many of the utilities, and the man pages also provide details on the commands. - -### Summary - -These two collections of Linux utilities, the GNU Core Utilities and util-linux, together provide the basic utilities required to administer a Linux system. As I researched this article, I found several interesting utilities I never knew about. Many of these commands are seldom needed, but when you need them, they are indispensable. - -Between these two collections, there are over 200 Linux utilities. While Linux has many more commands, these are the ones needed to manage the basic functions of a typical Linux host. - -### About the author - -[![](https://opensource.com/sites/default/files/styles/profile_pictures/public/david-crop.jpg?itok=oePpOpyV)][13] - -David Both \- David Both is a Linux and Open Source advocate who resides in Raleigh, North Carolina. He has been in the IT industry for over forty years and taught OS/2 for IBM where he worked for over 20 years. While at IBM, he wrote the first training course for the original IBM PC in 1981. He has taught RHCE classes for Red Hat and has worked at MCI Worldcom, Cisco, and the State of North Carolina. He has been working with Linux and Open Source Software for almost 20 years. David has written articles for... [more about David Both][14] - -[More about me][15] - -* [Learn how you can contribute][16] - ---- - -via: [https://opensource.com/article/18/4/gnu-core-utilities][17] - -作者: [David Both][18] 选题者: [@lujun9972][19] 译者: [译者ID][20] 校对: [校对者ID][21] - -本文由 [LCTT][22] 原创编译,[Linux中国][23] 荣誉推出 - -[1]: https://pixabay.com/en/tiny-people-core-apple-apple-half-700921/ -[2]: https://creativecommons.org/publicdomain/zero/1.0/ -[3]: https://www.gnu.org/software/coreutils/coreutils.html -[4]: https://opensource.com/life/17/10/top-terminal-emulators?intcmp=7016000000127cYAAQ -[5]: https://opensource.com/article/17/2/command-line-tools-data-analysis-linux?intcmp=7016000000127cYAAQ -[6]: https://opensource.com/downloads/advanced-ssh-cheat-sheet?intcmp=7016000000127cYAAQ -[7]: https://developers.redhat.com/cheat-sheet/advanced-linux-commands-cheatsheet?intcmp=7016000000127cYAAQ -[8]: https://en.wikipedia.org/wiki/History_of_Unix -[9]: https://en.wikipedia.org/wiki/Multics -[10]: https://en.wikipedia.org/wiki/Pointy-haired_Boss -[11]: https://en.wikipedia.org/wiki/GNU_Core_Utilities -[12]: https://en.wikipedia.org/wiki/Util-linux -[13]: https://opensource.com/users/dboth -[14]: https://opensource.com/users/dboth -[15]: https://opensource.com/users/dboth -[16]: https://opensource.com/participate -[17]: https://opensource.com/article/18/4/gnu-core-utilities -[18]: https://opensource.com/users/dboth -[19]: https://github.com/lujun9972 -[20]: https://github.com/译者ID -[21]: https://github.com/校对者ID -[22]: https://github.com/LCTT/TranslateProject -[23]: https://linux.cn/ diff --git a/sources/tech/20180522 Advanced use of the less text file viewer in Linux.md b/sources/tech/20180522 Advanced use of the less text file viewer in Linux.md deleted file mode 100644 index 9d8ea93869..0000000000 --- a/sources/tech/20180522 Advanced use of the less text file viewer in Linux.md +++ /dev/null @@ -1,119 +0,0 @@ -Translating by MjSeven - -Advanced use of the less text file viewer in Linux -====== - -![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/osdc_terminals_0.png?itok=XwIRERsn) - -I recently read Scott Nesbitt's article "[Using less to view text files at the Linux command line][1]" and was inspired to share additional tips and tricks I use with `less`. - -### LESS env var - -If you have an environment variable `LESS` defined (e.g., in your `.bashrc`), `less` treats it as a list of options, as if passed on the command line. - -I use this: -``` -LESS='-C -M -I -j 10 -# 4' - -``` - -These mean: - - * `-C` – Make full-screen reprints faster by not scrolling from the bottom. - * `-M` – Show more information from the last (status) line. You can customize the information shown with `-PM`, but I usually do not bother. - * `-I` – Ignore letter case (upper/lower) in searches. - * `-j 10` – Show search results in line 10 of the terminal, instead of the first line. This way you have 10 lines of context each time you press `n` (or `N`) to jump to the next (or previous) match. - * `-# 4` – Jump four characters to the right or left when pressing the Right or Left arrow key. The default is to jump half of the screen, which I usually find to be too much. Generally speaking, `less` seems to be (at least partially) optimized to the environment it was initially developed in, with slow modems and low-bandwidth internet connections, when it made sense to jump half a screen. - - - -### PAGER env var - -Many programs show information using the command set in the `PAGER` environment variable (if it's set). So, you can set `PAGER=less` in your `.bashrc` and have your program run `less`. Check the man page environ(7) (`man 7 environ`) for other such variables. - -### -S - -`-S` tells `less` to chop long lines instead of wrapping them. I rarely find a need for this unless (and until) I've started viewing a file. Fortunately, you can type all command-line options inside `less` as if they were keyboard commands. So, if I want to chop long lines while I'm already in a file, I can simply type `-S`. - -The command-line optiontellsto chop long lines instead of wrapping them. I rarely find a need for this unless (and until) I've started viewing a file. Fortunately, you can type all command-line options insideas if they were keyboard commands. So, if I want to chop long lines while I'm already in a file, I can simply type - -Here's an example I use a lot: -``` -    su - postgres - -    export PAGER=less  # Because I didn't bother editing postgres' .bashrc on all the machines I use it on - -    psql - -``` - -Sometimes when I later view the output of a `SELECT` command with a very wide output, I type `-S` so it will be formatted nicely. If it jumps too far when I press the Right arrow to see more (because I didn't set `-#`), I can type `-#8`, then each Right arrow press will move eight characters to the right. - -Sometimes after typing `-S` too many times, I exit psql and run it again after entering: -``` -export LESS=-S - -``` - -### F - -The command `F` makes `less` work like `tail -f`—waiting until more data is added to the file before showing it. One advantage this has over `tail -f` is that highlighting search matches still works. So you can enter `less /var/log/logfile`, search for something—which will highlight all occurrences of it (unless you used `-g`)—and then press `F`. When more data is written to the log, `less` will show it and highlight the new matches. - -After you press `F`, you can press `Ctrl+C` to stop it from looking for new data (this will not kill it); go back into the file to see older stuff, search for other things, etc.; and then press `F` again to look at more new data. - -### Searching - -Searches use the system's regexp library, and this usually means you can use extended regular expressions. In particular, searching for `one|two|three` will find and highlight all occurrences of one, two, or three. - -Another pattern I use a lot, especially with wide log lines (e.g., ones that span more than one terminal line), is `.*something.*`, which highlights the entire line. This pattern makes it much easier to see where a line starts and finishes. I also combine these, such as: `.*one thing.*|.*another thing.*`, or `key: .*|.*marker.*` to see the contents of `key` (e.g., in a log file with a dump of some dictionary/hash) and highlight relevant marker lines (so I have a context), or even, if I know the value is surrounded by quotes: -``` -key: '[^']*'|.*marker.* - -``` - -`less` maintains a history of your search items and saves them to disk for future invocations. When you press `/` (or `?`), you can go through this history with the Up or Down arrow (as well as do basic line editing). - -I stumbled upon what seems to be a very useful feature when skimming through the `less` man page while writing this article: skipping uninteresting lines with `&!pattern`. For example, while looking for something in `/var/log/messages`, I used to iterate through this list of commands: -``` -    cat /var/log/messages | egrep -v 'systemd: Started Session' | less - -    cat /var/log/messages | egrep -v 'systemd: Started Session|systemd: Starting Session' | less - -    cat /var/log/messages | egrep -v 'systemd: Started Session|systemd: Starting Session|User Slice' | less - -    cat /var/log/messages | egrep -v 'systemd: Started Session|systemd: Starting Session|User Slice|dbus' | less - -    cat /var/log/messages | egrep -v 'systemd: Started Session|systemd: Starting Session|User Slice|dbus|PackageKit Daemon' | less - -``` - -But now I know how to do the same thing within `less`. For example, I can type `&!systemd: Started Session`, then decide I want to get rid of `systemd: Starting Session`, so I add it by typing `&!` and use the Up arrow to get the previous search from the history. Then I type `|systemd: Starting Session` and press `Enter`, continuing to add more items the same way until I filter out enough to see the more interesting stuff. - -### = - -The command `=` shows more information about the file and location, even more than `-M`. If the file is very long, and calculating `=` takes too long, you can press `Ctrl+C` and it will stop trying. - -If the content you're viewing is from a pipe rather than a file, `=` (and `-M`) will not show what it does not know, including the number of lines and bytes in the file. To see that data, if you know that `command` will finish quickly, you can jump to the end with `G`, and then `less` will start showing that information. - -If you press `G` and the command writing to the pipe takes longer than expected, you can press `Ctrl+C`, and the command will be killed. Pressing `Ctrl+C` will kill it even if you didn't press `G`, so be careful not to press `Ctrl+C` accidentally if you don't intend to kill it. For this reason, if the command does something (that is, it's not only showing information), it's usually safer to write its output to a file and view the file in a separate terminal, instead of using a pipe. - -### Why you need less - -`less` is a very powerful program, and contrary to newer contenders in this space, such as `most` and `moar`, you are likely to find it on almost all the systems you use, just like `vi`. So, even if you use GUI viewers or editors, it's worth investing some time going through the `less` man page, at least to get a feeling of what's available. This way, when you need to do something that might be covered by existing functionality, you'll know to search the manual page or the internet to find what you need. - -For more information, visit the [less home page][2]. The site has a nice FAQ with more tips and tricks. - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/18/5/advanced-use-less-text-file-viewer - -作者:[Yedidyah Bar David][a] -选题:[lujun9972](https://github.com/lujun9972) -译者:[译者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/didib -[1]:http://opensource.com/article/18/4/using-less-view-text-files-command-line -[2]:http://www.greenwoodsoftware.com/less/ diff --git a/sources/tech/20180612 Systemd Services- Reacting to Change.md b/sources/tech/20180612 Systemd Services- Reacting to Change.md deleted file mode 100644 index a004f123c8..0000000000 --- a/sources/tech/20180612 Systemd Services- Reacting to Change.md +++ /dev/null @@ -1,275 +0,0 @@ -Systemd Services: Reacting to Change -====== - -![](https://www.linux.com/sites/lcom/files/styles/rendered_file/public/webcam.png?itok=zzYUs5VK) - -[I have one of these Compute Sticks][1] (Figure 1) and use it as an all-purpose server. It is inconspicuous and silent and, as it is built around an x86 architecture, I don't have problems getting it to work with drivers for my printer, and that’s what it does most days: it interfaces with the shared printer and scanner in my living room. - -![ComputeStick][3] - -An Intel ComputeStick. Euro coin for size. - -[Used with permission][4] - -Most of the time it is idle, especially when we are out, so I thought it would be good idea to use it as a surveillance system. The device doesn't come with its own camera, and it wouldn't need to be spying all the time. I also didn't want to have to start the image capturing by hand because this would mean having to log into the Stick using SSH and fire up the process by writing commands in the shell before rushing out the door. - -So I thought that the thing to do would be to grab a USB webcam and have the surveillance system fire up automatically just by plugging it in. Bonus points if the surveillance system fired up also after the Stick rebooted, and it found that the camera was connected. - -In prior installments, we saw that [systemd services can be started or stopped by hand][5] or [when certain conditions are met][6]. Those conditions are not limited to when the OS reaches a certain state in the boot up or powerdown sequence but can also be when you plug in new hardware or when things change in the filesystem. You do that by combining a Udev rule with a systemd service. - -### Hotplugging with Udev - -Udev rules live in the _/etc/udev/rules_ directory and are usually a single line containing _conditions_ and _assignments_ that lead to an _action_. - -That was a bit cryptic. Let's try again: - -Typically, in a Udev rule, you tell systemd what to look for when a device is connected. For example, you may want to check if the make and model of a device you just plugged in correspond to the make and model of the device you are telling Udev to wait for. Those are the _conditions_ mentioned earlier. - -Then you may want to change some stuff so you can use the device easily later. An example of that would be to change the read and write permissions to a device: if you plug in a USB printer, you're going to want users to be able to read information from the printer (the user's printing app would want to know the model, make, and whether it is ready to receive print jobs or not) and write to it, that is, send stuff to print. Changing the read and write permissions for a device is done using one of the _assignments_ you read about earlier. - -Finally, you will probably want the system to do something when the conditions mentioned above are met, like start a backup application to copy important files when a certain external hard disk drive is plugged in. That is an example of an _action_ mentioned above. - -With that in mind, ponder this: - -``` -ACTION=="add", SUBSYSTEM=="video4linux", ATTRS{idVendor}=="03f0", ATTRS{idProduct}=="e207", -SYMLINK+="mywebcam", TAG+="systemd", MODE="0666", ENV{SYSTEMD_WANTS}="webcam.service" -``` - -The first part of the rule, - -``` -ACTION=="add", SUBSYSTEM=="video4linux", ATTRS{idVendor}=="03f0", -ATTRS{idProduct}=="e207" [etc... ] -``` - -shows the conditions that the device has to meet before doing any of the other stuff you want the system to do. The device has to be added (`ACTION=="add"`) to the machine, it has to be integrated into the `video4linux` subsystem. To make sure the rule is applied only when the correct device is plugged in, you have to make sure Udev correctly identifies the manufacturer (`ATTRS{idVendor}=="03f0"`) and a model (`ATTRS{idProduct}=="e207"`) of the device. - -In this case, we're talking about this device (Figure 2): - -![webcam][8] - -The HP webcam used in this experiment. - -[Used with permission][4] - -Notice how you use `==` to indicate that these are a logical operation. You would read the above snippet of the rule like this: - -``` -if the device is added and the device controlled by the video4linux subsystem -and the manufacturer of the device is 03f0 and the model is e207, then... -``` - -But where do you get all this information? Where do you find the action that triggers the event, the manufacturer, model, and so on? You will probably have to use several sources. The `IdVendor` and `idProduct` you can get by plugging the webcam into your machine and running `lsusb`: - -``` -lsusb -Bus 002 Device 002: ID 8087:0024 Intel Corp. Integrated Rate Matching Hub -Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub -Bus 004 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub -Bus 003 Device 003: ID 03f0:e207 Hewlett-Packard -Bus 003 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub -Bus 001 Device 003: ID 04f2:b1bb Chicony Electronics Co., Ltd -Bus 001 Device 002: ID 8087:0024 Intel Corp. Integrated Rate Matching Hub -Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub -``` - -The webcam I’m using is made by HP, and you can only see one HP device in the list above. The `ID` gives you the manufacturer and the model numbers separated by a colon (`:`). If you have more than one device by the same manufacturer and not sure which is which, unplug the webcam, run `lsusb` again and check what's missing. - -OR... - -Unplug the webcam, wait a few seconds, run the command `udevadmin monitor --environment` and then plug the webcam back in again. When you do that with the HP webcam, you get: - -``` -udevadmin monitor --environment -UDEV [35776.495221] add /devices/pci0000:00/0000:00:1c.3/0000:04:00.0 -  /usb3/3-1/3-1:1.0/input/input21/event11 (input) -.MM_USBIFNUM=00 -ACTION=add -BACKSPACE=guess -DEVLINKS=/dev/input/by-path/pci-0000:04:00.0-usb-0:1:1.0-event -  /dev/input/by-id/usb-Hewlett_Packard_HP_Webcam_HD_2300-event-if00 -DEVNAME=/dev/input/event11 -DEVPATH=/devices/pci0000:00/0000:00:1c.3/0000:04:00.0/ -  usb3/3-1/3-1:1.0/input/input21/event11 -ID_BUS=usb -ID_INPUT=1 -ID_INPUT_KEY=1 -ID_MODEL=HP_Webcam_HD_2300 -ID_MODEL_ENC=HP\x20Webcam\x20HD\x202300 -ID_MODEL_ID=e207 -ID_PATH=pci-0000:04:00.0-usb-0:1:1.0 -ID_PATH_TAG=pci-0000_04_00_0-usb-0_1_1_0 -ID_REVISION=1020 -ID_SERIAL=Hewlett_Packard_HP_Webcam_HD_2300 -ID_TYPE=video -ID_USB_DRIVER=uvcvideo -ID_USB_INTERFACES=:0e0100:0e0200:010100:010200:030000: -ID_USB_INTERFACE_NUM=00 -ID_VENDOR=Hewlett_Packard -ID_VENDOR_ENC=Hewlett\x20Packard -ID_VENDOR_ID=03f0 -LIBINPUT_DEVICE_GROUP=3/3f0/e207:usb-0000:04:00.0-1/button -MAJOR=13 -MINOR=75 -SEQNUM=3162 -SUBSYSTEM=input -USEC_INITIALIZED=35776495065 -XKBLAYOUT=es -XKBMODEL=pc105 -XKBOPTIONS= -XKBVARIANT= -``` - -That may look like a lot to process, but, check this out: the `ACTION` field early in the list tells you what event just happened, i.e., that a device got added to the system. You can also see the name of the device spelled out on several of the lines, so you can be pretty sure that it is the device you are looking for. The output also shows the manufacturer's ID number (`ID_VENDOR_ID=03f0`) and the model number (`ID_VENDOR_ID=03f0`). - -This gives you three of the four values the condition part of the rule needs. You may be tempted to think that it a gives you the fourth, too, because there is also a line that says: - -``` -SUBSYSTEM=input -``` - -Be careful! Although it is true that a USB webcam is a device that provides input (as does a keyboard and a mouse), it is also belongs to the _usb_ subsystem, and several others. This means that your webcam gets added to several subsystems and looks like several devices. If you pick the wrong subsystem, your rule may not work as you want it to, or, indeed, at all. - -So, the third thing you have to check is all the subsystems the webcam has got added to and pick the correct one. To do that, unplug your webcam again and run: - -``` -ls /dev/video* -``` - -This will show you all the video devices connected to the machine. If you are using a laptop, most come with a built-in webcam and it will probably show up as `/dev/video0`. Plug your webcam back in and run `ls /dev/video*` again. - -Now you should see one more video device (probably `/dev/video1`). - -Now you can find out all the subsystems it belongs to by running `udevadm info -a /dev/video1`: - -``` -udevadm info -a /dev/video1 - -Udevadm info starts with the device specified by the devpath and then -walks up the chain of parent devices. It prints for every device -found, all possible attributes in the udev rules key format. -A rule to match, can be composed by the attributes of the device -and the attributes from one single parent device. - - looking at device '/devices/pci0000:00/0000:00:1c.3/0000:04:00.0 -  /usb3/3-1/3-1:1.0/video4linux/video1': - KERNEL=="video1" - SUBSYSTEM=="video4linux" - DRIVER=="" - ATTR{dev_debug}=="0" - ATTR{index}=="0" - ATTR{name}=="HP Webcam HD 2300: HP Webcam HD" - -[etc...] -``` - -The output goes on for quite a while, but what you're interested is right at the beginning: `SUBSYSTEM=="video4linux"`. This is a line you can literally copy and paste right into your rule. The rest of the output (not shown for brevity) gives you a couple more nuggets, like the manufacturer and mode IDs, again in a format you can copy and paste into your rule. - -Now you have a way of identifying the device and what event should trigger the action univocally, it is time to tinker with the device. - -The next section in the rule, `SYMLINK+="mywebcam", TAG+="systemd", MODE="0666"` tells Udev to do three things: First, you want to create symbolic link from the device to (e.g. _/dev/video1_ ) to _/dev/mywebcam_. This is because you cannot predict what the system is going to call the device by default. When you have an in-built webcam and you hotplug a new one, the in-built webcam will usually be _/dev/video0_ while the external one will become _/dev/video1_. However, if you boot your computer with the external USB webcam plugged in, that could be reversed and the internal webcam can become _/dev/video1_ and the external one _/dev/video0_. What this is telling you is that, although your image-capturing script (which you will see later on) always needs to point to the external webcam device, you can't rely on it being _/dev/video0_ or _/dev/video1_. To solve this problem, you tell Udev to create a symbolic link which will never change in the moment the device is added to the _video4linux_ subsystem and you will make your script point to that. - -The second thing you do is add `"systemd"` to the list of Udev tags associated with this rule. This tells Udev that the action that the rule will trigger will be managed by systemd, that is, it will be some sort of systemd service. - -Notice how in both cases you use `+=` operator. This adds the value to a list, which means you can add more than one value to `SYMLINK` and `TAG`. - -The `MODE` values, on the other hand, can only contain one value (hence you use the simple `=` assignment operator). What `MODE` does is tell Udev who can read from or write to the device. If you are familiar with `chmod` (and, if you are reading this, you should be), you will also be familiar of [how you can express permissions using numbers][9]. That is what this is: `0666` means " _give read and write privileges to the device to everybody_ ". - -At last, `ENV{SYSTEMD_WANTS}="webcam.service"` tells Udev what systemd service to run. - -Save this rule into file called _90-webcam.rules_ (or something like that) in _/etc/udev/rules.d_ and you can load it either by rebooting your machine, or by running: - -``` -sudo udevadm control --reload-rules && udevadm trigger -``` - -## Service at Last - -The service the Udev rule triggers is ridiculously simple: - -``` -# webcam.service - -[Service] -Type=simple -ExecStart=/home/[user name]/bin/checkimage.sh -``` - -Basically, it just runs the _checkimage.sh_ script stored in your personal _bin/_ and pushes it the background. [This is something you saw how to do in prior installments][5]. It may seem something little, but just because it is called by a Udev rule, you have just created a special kind of systemd unit called a _device_ unit. Congratulations. - -As for the _checkimage.sh_ script _webcam.service_ calls, there are several ways of grabbing an image from a webcam and comparing it to a prior one to check for changes (which is what _checkimage.sh_ does), but this is how I did it: - -``` -#!/bin/bash -# This is the checkimage.sh script - -mplayer -vo png -frames 1 tv:// -tv driver=v4l2:width=640:height=480:device= -  /dev/mywebcam &>/dev/null -mv 00000001.png /home/[user name]/monitor/monitor.png - -while true -do - mplayer -vo png -frames 1 tv:// -tv driver=v4l2:width=640:height=480:device=/dev/mywebcam &>/dev/null - mv 00000001.png /home/[user name]/monitor/temp.png - - imagediff=`compare -metric mae /home/[user name]/monitor/monitor.png /home/[user name] -  /monitor/temp.png /home/[user name]/monitor/diff.png 2>&1 > /dev/null | cut -f 1 -d " "` - if [ `echo "$imagediff > 700.0" | bc` -eq 1 ] - then - mv /home/[user name]/monitor/temp.png /home/[user name]/monitor/monitor.png - fi - - sleep 0.5 -done -``` - -Start by using [MPlayer][10] to grab a frame ( _00000001.png_ ) from the webcam. Notice how we point `mplayer` to the `mywebcam` symbolic link we created in our Udev rule, instead of to `video0` or `video1`. Then you transfer the image to the _monitor/_ directory in your home directory. Then run an infinite loop that does the same thing again and again, but also uses [Image Magick's _compare_ tool][11] to see if there any differences between the last image captured and the one that is already in the _monitor/_ directory. - -If the images are different, it means something has moved within the webcam's frame. The script overwrites the original image with the new image and continues comparing waiting for some more movement. - -### Plugged - -With all the bits and pieces in place, when you plug your webcam in, your Udev rule will be triggered and will start the _webcam.service_. The _webcam.service_ will execute _checkimage.sh_ in the background, and _checkimage.sh_ will start taking pictures every half a second. You will know because your webcam's LED will start flashing indicating every time it takes a snap. - -As always, if something goes wrong, run - -``` -systemctl status webcam.service -``` - -to check what your service and script are up to. - -### Coming up - -You may be wondering: Why overwrite the original image? Surely you would want to see what's going on if the system detects any movement, right? You would be right, but as you will see in the next installment, leaving things as they are and processing the images using yet another type of systemd unit makes things nice, clean and easy. - -Just wait and see. - -Learn more about Linux through the free ["Introduction to Linux" ][12]course from The Linux Foundation and edX. - --------------------------------------------------------------------------------- - -via: https://www.linux.com/blog/intro-to-linux/2018/6/systemd-services-reacting-change - -作者:[Paul Brown][a] -选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]: https://www.linux.com/users/bro66 -[b]: https://github.com/lujun9972 -[1]: https://www.intel.com/content/www/us/en/products/boards-kits/compute-stick/stk1a32sc.html -[2]: https://www.linux.com/files/images/fig01png -[3]: https://www.linux.com/sites/lcom/files/styles/floated_images/public/fig01.png?itok=cfEHN5f1 (ComputeStick) -[4]: https://www.linux.com/licenses/category/used-permission -[5]: https://www.linux.com/blog/learn/intro-to-linux/2018/5/writing-systemd-services-fun-and-profit -[6]: https://www.linux.com/blog/learn/2018/5/systemd-services-beyond-starting-and-stopping -[7]: https://www.linux.com/files/images/fig02png -[8]: https://www.linux.com/sites/lcom/files/styles/floated_images/public/fig02.png?itok=esFv4BdM (webcam) -[9]: https://chmod-calculator.com/ -[10]: https://mplayerhq.hu/design7/news.html -[11]: https://www.imagemagick.org/script/compare.php -[12]: https://training.linuxfoundation.org/linux-courses/system-administration-training/introduction-to-linux diff --git a/sources/tech/20180710 Building a Messenger App- Messages.md b/sources/tech/20180710 Building a Messenger App- Messages.md deleted file mode 100644 index 55e596df64..0000000000 --- a/sources/tech/20180710 Building a Messenger App- Messages.md +++ /dev/null @@ -1,315 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: ( ) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Building a Messenger App: Messages) -[#]: via: (https://nicolasparada.netlify.com/posts/go-messenger-messages/) -[#]: author: (Nicolás Parada https://nicolasparada.netlify.com/) - -Building a Messenger App: Messages -====== - -This post is the 4th on a series: - - * [Part 1: Schema][1] - * [Part 2: OAuth][2] - * [Part 3: Conversations][3] - - - -In this post we’ll code the endpoints to create a message and list them, also an endpoint to update the last time the participant read messages. Start by adding these routes in the `main()` function. - -``` -router.HandleFunc("POST", "/api/conversations/:conversationID/messages", requireJSON(guard(createMessage))) -router.HandleFunc("GET", "/api/conversations/:conversationID/messages", guard(getMessages)) -router.HandleFunc("POST", "/api/conversations/:conversationID/read_messages", guard(readMessages)) -``` - -Messages goes into conversations so the endpoint includes the conversation ID. - -### Create Message - -This endpoint handles POST requests to `/api/conversations/{conversationID}/messages` with a JSON body with just the message content and return the newly created message. It has two side affects: it updates the conversation `last_message_id` and updates the participant `messages_read_at`. - -``` -func createMessage(w http.ResponseWriter, r *http.Request) { - var input struct { - Content string `json:"content"` - } - defer r.Body.Close() - if err := json.NewDecoder(r.Body).Decode(&input); err != nil { - http.Error(w, err.Error(), http.StatusBadRequest) - return - } - - errs := make(map[string]string) - input.Content = removeSpaces(input.Content) - if input.Content == "" { - errs["content"] = "Message content required" - } else if len([]rune(input.Content)) > 480 { - errs["content"] = "Message too long. 480 max" - } - if len(errs) != 0 { - respond(w, Errors{errs}, http.StatusUnprocessableEntity) - return - } - - ctx := r.Context() - authUserID := ctx.Value(keyAuthUserID).(string) - conversationID := way.Param(ctx, "conversationID") - - tx, err := db.BeginTx(ctx, nil) - if err != nil { - respondError(w, fmt.Errorf("could not begin tx: %v", err)) - return - } - defer tx.Rollback() - - isParticipant, err := queryParticipantExistance(ctx, tx, authUserID, conversationID) - if err != nil { - respondError(w, fmt.Errorf("could not query participant existance: %v", err)) - return - } - - if !isParticipant { - http.Error(w, "Conversation not found", http.StatusNotFound) - return - } - - var message Message - if err := tx.QueryRowContext(ctx, ` - INSERT INTO messages (content, user_id, conversation_id) VALUES - ($1, $2, $3) - RETURNING id, created_at - `, input.Content, authUserID, conversationID).Scan( - &message.ID, - &message.CreatedAt, - ); err != nil { - respondError(w, fmt.Errorf("could not insert message: %v", err)) - return - } - - if _, err := tx.ExecContext(ctx, ` - UPDATE conversations SET last_message_id = $1 - WHERE id = $2 - `, message.ID, conversationID); err != nil { - respondError(w, fmt.Errorf("could not update conversation last message ID: %v", err)) - return - } - - if err = tx.Commit(); err != nil { - respondError(w, fmt.Errorf("could not commit tx to create a message: %v", err)) - return - } - - go func() { - if err = updateMessagesReadAt(nil, authUserID, conversationID); err != nil { - log.Printf("could not update messages read at: %v\n", err) - } - }() - - message.Content = input.Content - message.UserID = authUserID - message.ConversationID = conversationID - // TODO: notify about new message. - message.Mine = true - - respond(w, message, http.StatusCreated) -} -``` - -First, it decodes the request body into an struct with the message content. Then, it validates the content is not empty and has less than 480 characters. - -``` -var rxSpaces = regexp.MustCompile("\\s+") - -func removeSpaces(s string) string { - if s == "" { - return s - } - - lines := make([]string, 0) - for _, line := range strings.Split(s, "\n") { - line = rxSpaces.ReplaceAllLiteralString(line, " ") - line = strings.TrimSpace(line) - if line != "" { - lines = append(lines, line) - } - } - return strings.Join(lines, "\n") -} -``` - -This is the function to remove spaces. It iterates over each line, remove more than two consecutives spaces and returns with the non empty lines. - -After the validation, it starts an SQL transaction. First, it queries for the participant existance in the conversation. - -``` -func queryParticipantExistance(ctx context.Context, tx *sql.Tx, userID, conversationID string) (bool, error) { - if ctx == nil { - ctx = context.Background() - } - var exists bool - if err := tx.QueryRowContext(ctx, `SELECT EXISTS ( - SELECT 1 FROM participants - WHERE user_id = $1 AND conversation_id = $2 - )`, userID, conversationID).Scan(&exists); err != nil { - return false, err - } - return exists, nil -} -``` - -I extracted it into a function because it’s reused later. - -If the user isn’t participant of the conversation, we return with a `404 Not Found` error. - -Then, it inserts the message and updates the conversation `last_message_id`. Since this point, `last_message_id` cannot by `NULL` because we don’t allow removing messages. - -Then it commits the transaction and we update the participant `messages_read_at` in a goroutine. - -``` -func updateMessagesReadAt(ctx context.Context, userID, conversationID string) error { - if ctx == nil { - ctx = context.Background() - } - - if _, err := db.ExecContext(ctx, ` - UPDATE participants SET messages_read_at = now() - WHERE user_id = $1 AND conversation_id = $2 - `, userID, conversationID); err != nil { - return err - } - return nil -} -``` - -Before responding with the new message, we must notify about it. This is for the realtime part we’ll code in the next post so I left a comment there. - -### Get Messages - -This endpoint handles GET requests to `/api/conversations/{conversationID}/messages`. It responds with a JSON array with all the messages in the conversation. It also has the same side affect of updating the participant `messages_read_at`. - -``` -func getMessages(w http.ResponseWriter, r *http.Request) { - ctx := r.Context() - authUserID := ctx.Value(keyAuthUserID).(string) - conversationID := way.Param(ctx, "conversationID") - - tx, err := db.BeginTx(ctx, &sql.TxOptions{ReadOnly: true}) - if err != nil { - respondError(w, fmt.Errorf("could not begin tx: %v", err)) - return - } - defer tx.Rollback() - - isParticipant, err := queryParticipantExistance(ctx, tx, authUserID, conversationID) - if err != nil { - respondError(w, fmt.Errorf("could not query participant existance: %v", err)) - return - } - - if !isParticipant { - http.Error(w, "Conversation not found", http.StatusNotFound) - return - } - - rows, err := tx.QueryContext(ctx, ` - SELECT - id, - content, - created_at, - user_id = $1 AS mine - FROM messages - WHERE messages.conversation_id = $2 - ORDER BY messages.created_at DESC - `, authUserID, conversationID) - if err != nil { - respondError(w, fmt.Errorf("could not query messages: %v", err)) - return - } - defer rows.Close() - - messages := make([]Message, 0) - for rows.Next() { - var message Message - if err = rows.Scan( - &message.ID, - &message.Content, - &message.CreatedAt, - &message.Mine, - ); err != nil { - respondError(w, fmt.Errorf("could not scan message: %v", err)) - return - } - - messages = append(messages, message) - } - - if err = rows.Err(); err != nil { - respondError(w, fmt.Errorf("could not iterate over messages: %v", err)) - return - } - - if err = tx.Commit(); err != nil { - respondError(w, fmt.Errorf("could not commit tx to get messages: %v", err)) - return - } - - go func() { - if err = updateMessagesReadAt(nil, authUserID, conversationID); err != nil { - log.Printf("could not update messages read at: %v\n", err) - } - }() - - respond(w, messages, http.StatusOK) -} -``` - -First, it begins an SQL transaction in readonly mode. Checks for the participant existance and queries all the messages. In each message, we use the current authenticated user ID to know whether the user owns the message (`mine`). Then it commits the transaction, updates the participant `messages_read_at` in a goroutine and respond with the messages. - -### Read Messages - -This endpoint handles POST requests to `/api/conversations/{conversationID}/read_messages`. Without any request or response body. In the frontend we’ll make this request each time a new message arrive in the realtime stream. - -``` -func readMessages(w http.ResponseWriter, r *http.Request) { - ctx := r.Context() - authUserID := ctx.Value(keyAuthUserID).(string) - conversationID := way.Param(ctx, "conversationID") - - if err := updateMessagesReadAt(ctx, authUserID, conversationID); err != nil { - respondError(w, fmt.Errorf("could not update messages read at: %v", err)) - return - } - - w.WriteHeader(http.StatusNoContent) -} -``` - -It uses the same function we’ve been using to update the participant `messages_read_at`. - -* * * - -That concludes it. Realtime messages is the only part left in the backend. Wait for it in the next post. - -[Souce Code][4] - --------------------------------------------------------------------------------- - -via: https://nicolasparada.netlify.com/posts/go-messenger-messages/ - -作者:[Nicolás Parada][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://nicolasparada.netlify.com/ -[b]: https://github.com/lujun9972 -[1]: https://nicolasparada.netlify.com/posts/go-messenger-schema/ -[2]: https://nicolasparada.netlify.com/posts/go-messenger-oauth/ -[3]: https://nicolasparada.netlify.com/posts/go-messenger-conversations/ -[4]: https://github.com/nicolasparada/go-messenger-demo diff --git a/sources/tech/20180710 Building a Messenger App- Realtime Messages.md b/sources/tech/20180710 Building a Messenger App- Realtime Messages.md deleted file mode 100644 index 71479495b2..0000000000 --- a/sources/tech/20180710 Building a Messenger App- Realtime Messages.md +++ /dev/null @@ -1,175 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: ( ) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Building a Messenger App: Realtime Messages) -[#]: via: (https://nicolasparada.netlify.com/posts/go-messenger-realtime-messages/) -[#]: author: (Nicolás Parada https://nicolasparada.netlify.com/) - -Building a Messenger App: Realtime Messages -====== - -This post is the 5th on a series: - - * [Part 1: Schema][1] - * [Part 2: OAuth][2] - * [Part 3: Conversations][3] - * [Part 4: Messages][4] - - - -For realtime messages we’ll use [Server-Sent Events][5]. This is an open connection in which we can stream data. We’ll have and endpoint in which the user subscribes to all the messages sended to him. - -### Message Clients - -Before the HTTP part, let’s code a map to have all the clients listening for messages. Initialize this globally like so: - -``` -type MessageClient struct { - Messages chan Message - UserID string -} - -var messageClients sync.Map -``` - -### New Message Created - -Remember in the [last post][4] when we created the message, we left a “TODO” comment. There we’ll dispatch a goroutine with this function. - -``` -go messageCreated(message) -``` - -Insert that line just where we left the comment. - -``` -func messageCreated(message Message) error { - if err := db.QueryRow(` - SELECT user_id FROM participants - WHERE user_id != $1 and conversation_id = $2 - `, message.UserID, message.ConversationID). - Scan(&message.ReceiverID); err != nil { - return err - } - - go broadcastMessage(message) - - return nil -} - -func broadcastMessage(message Message) { - messageClients.Range(func(key, _ interface{}) bool { - client := key.(*MessageClient) - if client.UserID == message.ReceiverID { - client.Messages <- message - } - return true - }) -} -``` - -The function queries for the recipient ID (the other participant ID) and sends the message to all the clients. - -### Subscribe to Messages - -Lets go to the `main()` function and add this route: - -``` -router.HandleFunc("GET", "/api/messages", guard(subscribeToMessages)) -``` - -This endpoint handles GET requests on `/api/messages`. The request should be an [EventSource][6] connection. It responds with an event stream in which the data is JSON formatted. - -``` -func subscribeToMessages(w http.ResponseWriter, r *http.Request) { - if a := r.Header.Get("Accept"); !strings.Contains(a, "text/event-stream") { - http.Error(w, "This endpoint requires an EventSource connection", http.StatusNotAcceptable) - return - } - - f, ok := w.(http.Flusher) - if !ok { - respondError(w, errors.New("streaming unsupported")) - return - } - - ctx := r.Context() - authUserID := ctx.Value(keyAuthUserID).(string) - - h := w.Header() - h.Set("Cache-Control", "no-cache") - h.Set("Connection", "keep-alive") - h.Set("Content-Type", "text/event-stream") - - messages := make(chan Message) - defer close(messages) - - client := &MessageClient{Messages: messages, UserID: authUserID} - messageClients.Store(client, nil) - defer messageClients.Delete(client) - - for { - select { - case <-ctx.Done(): - return - case message := <-messages: - if b, err := json.Marshal(message); err != nil { - log.Printf("could not marshall message: %v\n", err) - fmt.Fprintf(w, "event: error\ndata: %v\n\n", err) - } else { - fmt.Fprintf(w, "data: %s\n\n", b) - } - f.Flush() - } - } -} -``` - -First it checks for the correct request headers and checks the server supports streaming. We create a channel of messages to make a client and store it in the clients map. Each time a new message is created, it will go in this channel, so we can read from it with a `for-select` loop. - -Server-Sent Events uses this format to send data: - -``` -data: some data here\n\n -``` - -We are sending it in JSON format: - -``` -data: {"foo":"bar"}\n\n -``` - -We are using `fmt.Fprintf()` to write to the response writter in this format and flushing the data in each iteration of the loop. - -This will loop until the connection is closed using the request context. We defered the close of the channel and the delete of the client, so when the loop ends, the channel will be closed and the client won’t receive more messages. - -Note aside, the JavaScript API to work with Server-Sent Events (EventSource) doesn’t support setting custom headers 😒 So we cannot set `Authorization: Bearer `. And that’s the reason why the `guard()` middleware reads the token from the URL query string also. - -* * * - -That concludes the realtime messages. I’d like to say that’s everything in the backend, but to code the frontend I’ll add one more endpoint to login. A login that will be just for development. - -[Souce Code][7] - --------------------------------------------------------------------------------- - -via: https://nicolasparada.netlify.com/posts/go-messenger-realtime-messages/ - -作者:[Nicolás Parada][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://nicolasparada.netlify.com/ -[b]: https://github.com/lujun9972 -[1]: https://nicolasparada.netlify.com/posts/go-messenger-schema/ -[2]: https://nicolasparada.netlify.com/posts/go-messenger-oauth/ -[3]: https://nicolasparada.netlify.com/posts/go-messenger-conversations/ -[4]: https://nicolasparada.netlify.com/posts/go-messenger-messages/ -[5]: https://developer.mozilla.org/en-US/docs/Web/API/Server-sent_events -[6]: https://developer.mozilla.org/en-US/docs/Web/API/EventSource -[7]: https://github.com/nicolasparada/go-messenger-demo diff --git a/sources/tech/20180730 50 Best Ubuntu Apps You Should Be Using Right Now.md b/sources/tech/20180730 50 Best Ubuntu Apps You Should Be Using Right Now.md deleted file mode 100644 index d305b716d6..0000000000 --- a/sources/tech/20180730 50 Best Ubuntu Apps You Should Be Using Right Now.md +++ /dev/null @@ -1,499 +0,0 @@ -50 Best Ubuntu Apps You Should Be Using Right Now -====== -**Brief: A comprehensive list of best Ubuntu apps for all kind of users. These software will help you in getting a better experience with your Linux desktop.** - -I have written about [things to do after installing Ubuntu][1] several times in the past. Each time I suggest installing the essential applications in Ubuntu. - -But the question arises, what are the essential Ubuntu applications? There is no set answer here. It depends on your need and the kind of work you do on your Ubuntu desktop. - -Still, I have been asked to suggest some good Ubuntu apps by a number of readers. This is the reason I have created this comprehensive list of Ubuntu applications you can use regularly. - -The list has been divided into respective categories for ease of reading and ease of comprehension. - -### Best Ubuntu apps for a better Ubuntu experience - -![Best Ubuntu Apps][2] - -Of course, you don’t have to use all of these applications. Just go through this list of essential Ubuntu software, read the description and then install the ones you need or are inclined to use. Just keep this page bookmarked for future reference or simply search on Google with term ‘best ubuntu apps itsfoss’. - -The best Ubuntu application list is intended for average Ubuntu user. Therefore not all the applications here are open source. I have also marked the slightly complicated applications that might not be suitable for a beginner. The list should be valid for Ubuntu 16.04,18.04 and other versions. - -Unless exclusively mentioned, the software listed here are available in Ubuntu Software Center. - -If you don’t find any application in the software center or if it is missing installation instruction, let me know and I’ll add the installation procedure. - -Enough talk! Let’s see what are the best apps for Ubuntu. - -#### Web Browser - -Ubuntu comes with Firefox as the default web browser. Since the Quantum release, Firefox has improved drastically. Personally, I always use more than one web browser for the sake of distinguishing between different type of works. - -##### Google Chrome - -![Google Chrome Logo][3] - -Google Chrome is the most used web browser on the internet for a reason. With your Google account, it allows you seamless syncing across devices. Plenty of extensions and apps further enhance its capabilities. You can [download Chrome in Ubuntu from its website][4]. - -##### Brave - -![brave browser][5] - -Google Chrome might be the most used web browser but it’s a privacy invader. An [alternative browser][6] is [Brave][7] that blocks ads and tracking scripts by default. This provides you with a faster and secure web browsing experience. - -#### Music applications - -![best music apps ubuntu][8] - -Ubuntu has Rhythmbox as the default music player which is not at all a bad choice for the default music player. However, you can definitely install a better music player. - -##### Sayonara - -[Sayonara][9] is a small, lightweight music player with a nice dark user interface. It comes with all the essential features you would expect in a standard music player. It integrates well with the Ubuntu desktop environment and doesn’t eat up your RAM. - -##### Audacity - -[Audacity][10] is more of an audio editor than an audio player. You can record and edit audio with this free and open source tool. It is available for Linux, Windows and macOS. You can install it from the Software Center. - -##### MusicBrainz Picard - -[Picard][11] is not a music player, it is a music tagger. If you have tons of local music files, Picard allows you to automatically update the music files with correct tracks, album, artist info and album cover art. - -#### Streaming Music Applications - -![Streaming Music app Ubuntu][12] - -In this age of the internet, music listening habit has surely changed. People these days rely more on streaming music players rather than storing hundreds of local music files. Let’s see some apps you can use for streaming music. - -##### Spotify - -[Spotify][13] is the king of streaming music. And the good thing is that it has a native Linux app. The [Spotify app on Ubuntu][14] integrates well with the media key and sound menu along with the desktop notification. Do note that Spotify may or may not be available in your country. - -##### Nuvola music player - -[Nuvola][15] is not a streaming music service like Spotify. It is a desktop music player that allows you to use several streaming music services in one application. You can use Spotify, Deezer, Google Play Music, Amazon Cloud Player and many more such services. - -#### Video Players - -![Video players for Linux][16] - -Ubuntu has the default GNOME video player (previously known as Totem) which is okay but it doesn’t support various media codecs. There are certainly other video players better than the GNOME video player. - -##### VLC - -The free and open source software [VLC][17] is the king of video players. It supports almost all possible media codecs. It also allows you to increase the volume up to 200%. It can also resume playing from the last known position. There are so many [VLC tricks][18] you can use to get the most of it. - -##### MPV - -[MPV][19] is a video player that deserves more attention. A sleek minimalist GUI and plenty of features, MPV has everything you would expect from a good video player. You can even use it in the command line. If you are not happy with VLC, you should surely give MPV a try. - -#### Cloud Storage Service - -Local backups are fine but cloud storage gives an additional degree of freedom. You don’t have to carry a USB key with you all the time or worry about a hard disk crash with cloud services. - -##### Dropbox - -![Dropbox logo][20] - -[Dropbox][21] is one of the most popular Cloud service providers. You get 2GB of free storage with the option to get more by referring others. Dropbox provides a native Linux client and you can download it from its website. It creates a local folder on your system that is synced with the cloud servers. - -##### pCloud - -![pCloud icon][22] - -[pCloud][23] is another good cloud storage service for Linux. It also has a native Linux client that you can download from its website. You get up to 20GB of free storage and if you need more, the pricing is better than Dropbox. pCloud is based in Switzerland, a country renowned for strict data privacy laws. - -#### Image Editors - -I am sure that you would need a photo editor at some point in time. Here are some of the best Ubuntu apps for editing images. - -##### GIMP - -![gimp icon][24] - -[GIMP][25] is a free and open source image editor available for Linux, Windows and macOS. It’s the best alternative for Adobe Photoshop in Linux. You can use it for all kind of image editing. There are plenty of resources available on the internet to help you with Gimp. - -##### Inkscape - -![inkscape icon][26] - -[Inkscape][27] is also a free and open source image editor specifically focusing on vector graphics. You can design vector arts and logo on it. You can compare it to Adobe Illustrator. Like Gimp, Inkscape too has plenty of tutorials available online. - -#### Paint applications - -Painting applications are not the same as image editors though their functionalities overlap at times. Here are some paint apps you can use in Ubuntu. -![Painting apps for Ubuntu Linux][28] - -##### Krita - -[Krita][29] is a free and open source digital painting application. You can create digital art, comics and animation with it. It’s a professional grade software and is even used as the primary software in art schools. - -##### Pinta - -[Pinta][30] might not be as feature rich as Krita but that’s deliberate. You can think of Pinta as Microsoft Paint for Linux. You can draw, paint, add text and do other such small tasks you do in a paint application. - -#### Photography applications - -Amateur photographer or a professional? You have plenty of [photography tools][31] at your disposal. Here are some recommended applications. - -##### digiKam - -![digikam][32] - -With open source software [digiKam][33], you can handle your high-end camera images in a professional manner. digiKam provides all the tools required for viewing, managing, editing, enhancing, organizing, tagging and sharing photographs. - -##### Darktable - -![Darktable icon][34] - -[darktable][35] is an open source photography workflow application with a special focus on raw image development. This is the best alternative you can get for Adobe Lightroom. It is also available for Windows and macOS. - -#### Video editors - -![Video editors Ubuntu][36] - -There is no dearth of [video editors for Linux][37] but I won’t go in detail here. Take a look at some of the feature-rich yet relatively simple to use video editors for Ubuntu. - -##### Kdenlive - -[Kdenlive][38] is the best all-purpose video editor for Linux. It has enough features that compare it to iMovie or Movie Maker. - -##### Shotcut - -[Shotcut][39] is another good choice for a video editor. It is an open source software with all the features you can expect in a standard video editor. - -#### Image and video converter - -If you need to [convert the file format][40] of your images and videos, here are some of my recommendations. - -##### Xnconvert - -![xnconvert logo][41] - -[Xnconvert][42] is an excellent batch image conversion tool. You can bulk resize images, convert the file type and rename them. - -##### Handbrake - -![Handbrake Logo][43] - -[HandBrake][44] is an easy to use open source tool for converting videos from a number of formats to a few modern, popular formats. - -#### Screenshot and screen recording tools - -![Screenshot and recorders Ubuntu][45] - -Here are the best Ubuntu apps for taking screenshots and recording your screen. - -##### Shutter - -[Shutter][46] is my go-to tool for taking screenshots. You can also do some quick editing to those screenshots such as adding arrows, text or resizing the images. The screenshots you see on It’s FOSS have been edited with Shutter. Definitely one of the best apps for Ubuntu. - -##### Kazam - -[Kazam][47] is my favorite [screen recorder for Linux][48]. It’s a tiny tool that allows you to record the entire window, an application window or a selected area. You can also use shortcuts to pause or resume recording. The tutorials on [It’s FOSS YouTube channel][49] have been recorded with Kazam. - -#### Office suites - -I cannot imagine that you could use a computer without a document editor. And why restrict yourself to just one document editor? Go for a complete office suite. - -##### LibreOffice - -![LibreOffice logo][50] - -[LibreOffice][51] comes preinstalled on Ubuntu and it is undoubtedly the [best open source office software][52]. It’s a complete package comprising of a document editor, spreadsheet tool, presentation software, maths tool and a graphics tool. You can even edit some PDF files with LibreOffice. - -##### WPS Office - -![WPS Office logo][53] - -[WPS Office][54] has gained popularity for being a Microsoft Office clone. It has an interface identical to Microsoft Office and it claims to be more compatible with MS Office. If you are looking for something similar to the Microsoft Office, WPS Office is a good choice. - -#### Downloading tools - -![Downloading software Ubuntu][55] - -If you often download videos or other big files from the internet, these tools will help you. - -##### youtube-dl - -This is one of the rare Ubuntu application on the list that is command line based. If you want to download videos from YouTube, DailyMotion or other video websites, youtube-dl is an excellent choice. It provides plenty of [advanced option for video downloading][56]. - -##### uGet - -[uGet][57] is a feature rich [download manager for Linux][58]. It allows you to pause and resume your downloads, schedule your downloads, monitor clipboard for downloadable content. A perfect tool if you have a slow, inconsistent internet or daily data limit. - -#### Code Editors - -![Coding apps for Ubuntu][59] - -If you are into programming, the default Gedit text editor might not be sufficient for your coding needs. Here are some of the better code editors for you. - -##### Atom - -[Atom][60] is a free and [open source code editor][61] from GitHub. Even before it was launched its first stable version, it became a hot favorite among coders for its UI, features and vast range of plugins. - -##### Visual Studio Code - -[VS Code][62] is an open source code editor from Microsoft. Don’t worry about Microsoft, VS Code is an awesome editor for web development. It also supports a number of other programming languages. - -#### PDF and eBooks related applications - -![eBook Management tools in Ubuntu][63] - -In this digital age, you cannot only rely on the real paper books especially when there are plenty of free eBooks available. Here are some Ubuntu apps for managing PDFs and eBooks. - -##### Calibre - -If you are a bibliophile and collect eBooks, you should use [Calibre][64]. It is an eBook manager with all the necessary software for [creating eBooks][65], converting eBook formats and managing an eBook library. - -##### Okular - -Okular is mostly a PDF viewer with options for editing PDF files. You can do some basic [PDF editing on Linux][66] with Okular such as adding pop-ups notes, inline notes, freehand line drawing, highlighter, stamp etc. - -#### Messaging applications - -![Messaging apps for Ubuntu][67] - -I believe you use at least one [messaging app on Linux][68]. Here are my recommendations. - -##### Skype - -[Skype][69] is the most popular video chatting application. It is also used by many companies and businesses for interviews and meetings. This makes Skype one of the must-have applications for Ubuntu. - -##### Rambox - -[Rambox][70] is not a messaging application on its own. But it allows you to use Skype, Viber, Facebook Messanger, WhatsApp, Slack and a number of other messaging applications from a single application window. - -#### Notes and To-do List applications - -Need a to-do list app or simple an app for taking notes? Have a look at these: - -##### Simplenote - -![Simplenote logo][71] - -[Simplenote][72] is a free and open source note taking application from WordPress creators [Automattic][73]. It is available for Windows, Linux, macOS, iOS and Android. Your notes are synced to a cloud server and you can access them on any device. You can download the DEB file from its website. - -##### Remember The Milk - -![Remember The Milk logo][74] - -[Remember The Milk][75] is a popular to-do list application. It is available for Windows, Linux, macOS, iOS and Android. Your to-do list is accessible on all the devices you own. You can also access it from a web browser. It also has an official native application for Linux that you can download from its website. - -#### Password protection and encryption - -![Encryption software Ubuntu][76] - -If there are other people regularly using your computer perhaps you would like to add an extra layer of security by password protecting files and folders. - -##### EncryptPad - -[EncryptPad][77] is an open source text editor that allows you to lock your files with a password. You can choose the type of encryption. There is also a command line version of this tool. - -##### Gnome Encfs Manager - -Gnome Encfs Manager allows you to [lock folders with a password in Linux][78]. You can keep whatever files you want in a secret folder and then lock it with a password. - -#### Gaming - -![Gaming on Ubuntu][79] - -[Gaming on Linux][80] is a lot better than what it used to be a few years ago. You can enjoy plenty of games on Linux without going back to Windows. - -##### Steam - -[Steam][81] is a digital distribution platform that allows you to purchase (if required) games. Steam has over 1500 [games for Linux][82]. You can download the Steam client from the Software Center. - -##### PlayOnLinux - -[PlayOnLinux][83] allows you to run Windows games on Linux over WINE compatibility layer. Don’t expect too much out of it because not every game will run flawlessly with PlayOnLinux. - -#### Package Managers [Intermediate to advanced users] - -![Package Management tools Ubuntu][84] - -Ubuntu Software Center is more than enough for an average Ubuntu user’s software needs but you can have more control on it using these applications. - -##### Gdebi - -Gedbi is a tiny packagae manager that you can use for installing DEB files. It is faster than the Software Center and it also handles dependency issues. - -##### Synaptic - -Synaptic was the default GUI package manager for most Linux distributions a decade ago. It still is in some Linux distributions. This powerful package manager is particularly helpful in [finding installed applications and removing them][85]. - -#### Backup and Recovery tools - -![Backup and data recovery tools for Ubuntu][86] - -Backup and recovery tools are must-have software for any system. Let’s see what softwares you must have on Ubuntu. - -##### Timeshift - -Timeshift is a tool that allows you to [take a snapshot of your system][87]. This allows you to restore your system to a previous state in case of an unfortunate incident when your system configuration is messed up. Note that it’s not the best tool for your personal data backup though. For that, you can use Ubuntu’s default Deja Dup (also known as Backups) tool. - -##### TestDisk [Intermediate Users] - -This is another command line tool on this list of best Ubuntu application. [TestDisk][88] allows you to [recover data on Linux][89]. If you accidentally deleted files, there are still chances that you can get it back using TestDisk. - -#### System Tweaking and Management Tools - -![System Maintenance apps Ubuntu][90] - -##### GNOME/Unity Tweak Tool - -These Tweak tools are a must for every Ubuntu user. They allow you to access some advanced system settings. Best of all, you can [change themes in Ubuntu][91] using these tweak tools. - -##### UFW Firewall - -[UFW][92] stands for Uncomplicated Firewall and rightly so. UFW has predefined firewall settings for Home, Work and Public networks. - -##### Stacer - -If you want to free up space on Ubuntu, try Stacer. This graphical tool allows you to [optimize your Ubuntu system][93] by removing unnecessary files and completely uninstalling software. Download Stacer from [its website][94]. - -#### Other Utilities - -![Utilities Ubuntu][95] - -In the end, I’ll list some of my other favorite Ubuntu apps that I could not put into a certain category. - -##### Neofetch - -One more command line tool! Neofetch displays your system information such as [Ubuntu version][96], desktop environment, theme, icons, RAM etc info along with [ASCII logo of the distribution][97]. Use this command for installing Neofetch. -``` -sudo apt install neofetch - -``` - -##### Etcher - -Ubuntu has a live USB creator tool installed already but Etcher is a better application for this task. It is also available for Windows and macOS. You can download it [from its website][98]. - -##### gscan2pdf - -I use this tiny tool for the sole purpose of [converting images into PDF][99]. You can use it for combining multiple images into one PDF file as well. - -##### Audio Recorder - -Another tiny yet essential Ubuntu application for [recording audio on Ubuntu][100]. You can use it to record sound from system microphone, from music player or from any other source. - -### Your suggestions for essential Ubuntu applications? - -I would like to conclude my list of best Ubuntu apps here. I know that you might not need or use all of them but I am certain that you would like most of the software listed here. - -Did you find some useful applications that you didn’t know about before? If you would have to suggest your favorite Ubuntu application, which one would it be? - -In the end, if you find this article useful, please share it on social media, Reddit, Hacker News or other community or forums you visit regularly. This way you help us grow :) - --------------------------------------------------------------------------------- - -via: https://itsfoss.com/best-ubuntu-apps/ - -作者:[Abhishek Prakash][a] -选题:[lujun9972](https://github.com/lujun9972) -译者:[译者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/abhishek/ -[1]:https://itsfoss.com/things-to-do-after-installing-ubuntu-18-04/ -[2]:https://4bds6hergc-flywheel.netdna-ssl.com/wp-content/uploads/2018/07/best-ubuntu-apps-featured.jpeg -[3]:https://4bds6hergc-flywheel.netdna-ssl.com/wp-content/uploads/2018/07/google-chrome.jpeg -[4]:https://www.google.com/chrome/ -[5]:https://4bds6hergc-flywheel.netdna-ssl.com/wp-content/uploads/2018/07/brave-browser-icon.jpeg -[6]:https://itsfoss.com/open-source-browsers-linux/ -[7]:https://brave.com/ -[8]:https://4bds6hergc-flywheel.netdna-ssl.com/wp-content/uploads/2018/07/music-apps-ubuntu.jpeg -[9]:https://itsfoss.com/sayonara-music-player/ -[10]:https://www.audacityteam.org/ -[11]:https://itsfoss.com/musicbrainz-picard/ -[12]:https://4bds6hergc-flywheel.netdna-ssl.com/wp-content/uploads/2018/07/streaming-music-apps-ubuntu.jpeg -[13]:https://www.spotify.com// -[14]:https://itsfoss.com/install-spotify-ubuntu-1404/ -[15]:https://tiliado.eu/nuvolaplayer/ -[16]:https://4bds6hergc-flywheel.netdna-ssl.com/wp-content/uploads/2018/07/Video-Players-linux.jpg -[17]:https://www.videolan.org/index.html -[18]:https://itsfoss.com/vlc-pro-tricks-linux/ -[19]:https://mpv.io/ -[20]:https://4bds6hergc-flywheel.netdna-ssl.com/wp-content/uploads/2018/07/dropbox-icon.jpeg -[21]:https://www.dropbox.com/ -[22]:https://4bds6hergc-flywheel.netdna-ssl.com/wp-content/uploads/2018/07/pcloud-icon.jpeg -[23]:https://itsfoss.com/recommends/pcloud/ -[24]:https://4bds6hergc-flywheel.netdna-ssl.com/wp-content/uploads/2018/07/gimp-icon.jpeg -[25]:https://www.gimp.org/ -[26]:https://4bds6hergc-flywheel.netdna-ssl.com/wp-content/uploads/2018/07/inkscape-icon.jpeg -[27]:https://inkscape.org/en/ -[28]:https://4bds6hergc-flywheel.netdna-ssl.com/wp-content/uploads/2018/07/paint-apps-ubuntu.jpeg -[29]:https://krita.org/en/ -[30]:https://pinta-project.com/pintaproject/pinta/ -[31]:https://itsfoss.com/image-applications-ubuntu-linux/ -[32]:https://4bds6hergc-flywheel.netdna-ssl.com/wp-content/uploads/2018/07/digikam-icon.jpeg -[33]:https://www.digikam.org/ -[34]:https://4bds6hergc-flywheel.netdna-ssl.com/wp-content/uploads/2018/07/darktable-icon.jpeg -[35]:https://www.darktable.org/ -[36]:https://4bds6hergc-flywheel.netdna-ssl.com/wp-content/uploads/2018/07/video-editing-apps-ubuntu.jpeg -[37]:https://itsfoss.com/best-video-editing-software-linux/ -[38]:https://kdenlive.org/en/ -[39]:https://shotcut.org/ -[40]:https://itsfoss.com/format-factory-alternative-linux/ -[41]:https://4bds6hergc-flywheel.netdna-ssl.com/wp-content/uploads/2018/07/xnconvert-logo.jpeg -[42]:https://www.xnview.com/en/xnconvert/ -[43]:https://4bds6hergc-flywheel.netdna-ssl.com/wp-content/uploads/2018/07/handbrake-logo.jpeg -[44]:https://handbrake.fr/ -[45]:https://4bds6hergc-flywheel.netdna-ssl.com/wp-content/uploads/2018/07/screen-recording-ubuntu-apps.jpeg -[46]:http://shutter-project.org/ -[47]:https://launchpad.net/kazam -[48]:https://itsfoss.com/best-linux-screen-recorders/ -[49]:https://www.youtube.com/c/itsfoss?sub_confirmation=1 -[50]:https://4bds6hergc-flywheel.netdna-ssl.com/wp-content/uploads/2018/07/libre-office-logo.jpeg -[51]:https://www.libreoffice.org/download/download/ -[52]:https://itsfoss.com/best-free-open-source-alternatives-microsoft-office/ -[53]:https://4bds6hergc-flywheel.netdna-ssl.com/wp-content/uploads/2018/07/wps-office-logo.jpeg -[54]:http://wps-community.org/ -[55]:https://4bds6hergc-flywheel.netdna-ssl.com/wp-content/uploads/2018/07/download-apps-ubuntu.jpeg -[56]:https://itsfoss.com/download-youtube-linux/ -[57]:http://ugetdm.com/ -[58]:https://itsfoss.com/4-best-download-managers-for-linux/ -[59]:https://4bds6hergc-flywheel.netdna-ssl.com/wp-content/uploads/2018/07/coding-apps-ubuntu.jpeg -[60]:https://atom.io/ -[61]:https://itsfoss.com/best-modern-open-source-code-editors-for-linux/ -[62]:https://itsfoss.com/install-visual-studio-code-ubuntu/ -[63]:https://4bds6hergc-flywheel.netdna-ssl.com/wp-content/uploads/2018/07/pdf-management-apps-ubuntu.jpeg -[64]:https://calibre-ebook.com/ -[65]:https://itsfoss.com/create-ebook-calibre-linux/ -[66]:https://itsfoss.com/pdf-editors-linux/ -[67]:https://4bds6hergc-flywheel.netdna-ssl.com/wp-content/uploads/2018/07/messaging-apps-ubuntu.jpeg -[68]:https://itsfoss.com/best-messaging-apps-linux/ -[69]:https://www.skype.com/en/ -[70]:https://rambox.pro/ -[71]:https://4bds6hergc-flywheel.netdna-ssl.com/wp-content/uploads/2018/07/simplenote-logo.jpeg -[72]:http://simplenote.com/ -[73]:https://automattic.com/ -[74]:https://4bds6hergc-flywheel.netdna-ssl.com/wp-content/uploads/2018/07/remember-the-milk-logo.jpeg -[75]:https://itsfoss.com/remember-the-milk-linux/ -[76]:https://4bds6hergc-flywheel.netdna-ssl.com/wp-content/uploads/2018/07/encryption-apps-ubuntu.jpeg -[77]:https://itsfoss.com/encryptpad-encrypted-text-editor-linux/ -[78]:https://itsfoss.com/password-protect-folder-linux/ -[79]:https://4bds6hergc-flywheel.netdna-ssl.com/wp-content/uploads/2018/07/gaming-ubuntu.jpeg -[80]:https://itsfoss.com/linux-gaming-guide/ -[81]:https://store.steampowered.com/ -[82]:https://itsfoss.com/free-linux-games/ -[83]:https://www.playonlinux.com/en/ -[84]:https://4bds6hergc-flywheel.netdna-ssl.com/wp-content/uploads/2018/07/package-management-apps-ubuntu.jpeg -[85]:https://itsfoss.com/how-to-add-remove-programs-in-ubuntu/ -[86]:https://4bds6hergc-flywheel.netdna-ssl.com/wp-content/uploads/2018/07/backup-recovery-tools-ubuntu.jpeg -[87]:https://itsfoss.com/backup-restore-linux-timeshift/ -[88]:https://www.cgsecurity.org/wiki/TestDisk -[89]:https://itsfoss.com/recover-deleted-files-linux/ -[90]:https://4bds6hergc-flywheel.netdna-ssl.com/wp-content/uploads/2018/07/system-maintenance-apps-ubuntu.jpeg -[91]:https://itsfoss.com/install-themes-ubuntu/ -[92]:https://wiki.ubuntu.com/UncomplicatedFirewall -[93]:https://itsfoss.com/optimize-ubuntu-stacer/ -[94]:https://github.com/oguzhaninan/Stacer -[95]:https://4bds6hergc-flywheel.netdna-ssl.com/wp-content/uploads/2018/07/utilities-apps-ubuntu.jpeg -[96]:https://itsfoss.com/how-to-know-ubuntu-unity-version/ -[97]:https://itsfoss.com/display-linux-logo-in-ascii/ -[98]:https://etcher.io/ -[99]:https://itsfoss.com/convert-multiple-images-pdf-ubuntu-1304/ -[100]:https://itsfoss.com/record-streaming-audio/ diff --git a/sources/tech/20181105 5 Minimal Web Browsers for Linux.md b/sources/tech/20181105 5 Minimal Web Browsers for Linux.md deleted file mode 100644 index 34c0c1e18e..0000000000 --- a/sources/tech/20181105 5 Minimal Web Browsers for Linux.md +++ /dev/null @@ -1,171 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (MonkeyDEcho ) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: subject: (5 Minimal Web Browsers for Linux) -[#]: via: (https://www.linux.com/blog/intro-to-linux/2018/11/5-minimal-web-browsers-linux) -[#]: author: (Jack Wallen https://www.linux.com/users/jlwallen) -[#]: url: ( ) - -5 Minimal Web Browsers for Linux -====== -linux上的五种微型浏览器 -====== - -![](https://www.linux.com/sites/lcom/files/styles/rendered_file/public/minimal.jpg?itok=ifA0Y3pV) - -There are so many reasons to enjoy the Linux desktop. One reason I often state up front is the almost unlimited number of choices to be found at almost every conceivable level. From how you interact with the operating system (via a desktop interface), to how daemons run, to what tools you use, you have a multitude of options. -有太多理由去选择使用linux系统。很重要的一个理由是,我们可以按照我们自己的想法去选择想要的。从操作系统的交互方式(桌面系统)到守护系统的运行方式,在到使用的工具,你用更多的选择。 - -The same thing goes for web browsers. You can use anything from open source favorites, such as [Firefox][1] and [Chromium][2], or closed sourced industry darlings like [Vivaldi][3] and [Chrome][4]. Those options are full-fledged browsers with every possible bell and whistle you’ll ever need. For some, these feature-rich browsers are perfect for everyday needs. -web浏览器也是如此。你可以使用开源的[火狐][1],[Chromium][2];或者未开源的[Vivaldi][3],[Chrome][4]。这些功能强大的浏览器有你需要的各种功能。对于某些人,这些功能完备的浏览器是日常必需的。 - -There are those, however, who prefer using a web browser without all the frills. In fact, there are many reasons why you might prefer a minimal browser over a standard browser. For some, it’s about browser security, while others look at a web browser as a single-function tool (as opposed to a one-stop shop application). Still others might be running low-powered machines that cannot handle the requirements of, say, Firefox or Chrome. Regardless of the reason, Linux has you covered. -但是,有些人更喜欢没有冗余功能的纯粹的浏览器。实际上,有很多原因导致你会选择微型的浏览器而不选择上述功能完备的浏览器。对于某些人来说,与浏览器的安全有关;而有些人则将浏览器当作一种简单的工具(而不是一站式商店应用程序);还有一些可能运行在低功率的计算机上,这些计算机无法满足火狐,chrome浏览器的运行要求。无论出于何种原因,在linux系统上都可以满足你的要求。 - -Let’s take a look at five of the minimal browsers that can be installed on Linux. I’ll be demonstrating these browsers on the Elementary OS platform, but each of these browsers are available to nearly every distribution in the known Linuxverse. Let’s dive in. -让我们看一下可以在linux上安装运行的五种微型浏览器。我将在 Elementary 的操作系统平台上演示这些浏览器,在已知的linux发型版中几乎每个版本都可以使用这些浏览器。让我们一起来看一下吧! - -### GNOME Web - -GNOME Web (codename Epiphany, which means [“a usually sudden manifestation or perception of the essential nature or meaning of something”][5]) is the default web browser for Elementary OS, but it can be installed from the standard repositories. (Note, however, that the recommended installation of Epiphany is via Flatpak or Snap). If you choose to install via the standard package manager, issue a command such as sudo apt-get install epiphany-browser -y for successful installation. -GNOME web (Epiphany 含义:[顿悟][5])是Elementary系统默认的web浏览器,也可以从标准存储库中安装。(注意,建议通过使用 Flatpak 或者 Snap 工具安装),如果你想选择标准软件包管理器进行安装,请执行 ```sudo apt-get install epiphany-browser -y``` 命令成功安装。 - -Epiphany uses the WebKit rendering engine, which is the same engine used in Apple’s Safari browser. Couple that rendering engine with the fact that Epiphany has very little in terms of bloat to get in the way, you will enjoy very fast page-rendering speeds. Epiphany development follows strict adherence to the following guidelines: - - * Simplicity - Feature bloat and user interface clutter are considered evil. - - * Standards compliance - No non-standard features will ever be introduced to the codebase. - - * Software freedom - Epiphany will always be released under a license that respects freedom. - - * Human interface - Epiphany follows the [GNOME Human Interface Guidelines][6]. - - * Minimal preferences - Preferences are only added when they make sense and after careful consideration. - - * Target audience - Non-technical users are the primary target audience (which helps to define the types of features that are included). - - - - -GNOME Web is as clean and simple a web browser as you’ll find (Figure 1). - -![GNOME Web][8] - -Figure 1: The GNOME Web browser displaying a minimal amount of preferences for the user. - -[Used with permission][9] - -The GNOME Web manifesto reads: - -A web browser is more than an application: it is a way of thinking, a way of seeing the world. Epiphany's principles are simplicity, standards compliance, and software freedom. - -### Netsurf - -The [Netsurf][10] minimal web browser opens almost faster than you can release the mouse button. Netsurf uses its own layout and rendering engine (designed completely from scratch), which is rather hit and miss in its rendering (Figure 2). - -![](https://www.linux.com/sites/lcom/files/styles/rendered_file/public/minimalbrowsers_2.jpg?itok=KhGhIKlj) - -Although you might find Netsurf to suffer from rendering issues on certain sites, understand the Hubbub HTML parser is following the work-in-progress HTML5 specification, so there will be issues popup now and then. To ease those rendering headaches, Netsurf does include HTTPS support, web page thumbnailing, URL completion, scale view, bookmarks, full-screen mode, keyboard shorts, and no particular GUI toolkit requirements. That last bit is important, especially when you switch from one desktop to another. - -For those curious as to the requirements for Netsurf, the browser can run on a machine as slow as a 30Mhz ARM 6 computer with 16MB of RAM. That’s impressive, by today’s standard. - -### QupZilla - -If you’re looking for a minimal browser that uses the Qt Framework and the QtWebKit rendering engine, [QupZilla][11] might be exactly what you’re looking for. QupZilla does include all the standard features and functions you’d expect from a web browser, such as bookmarks, history, sidebar, tabs, RSS feeds, ad blocking, flash blocking, and CA Certificates management. Even with those features, QupZilla still manages to remain a very fast lightweight web browser. Other features include: Fast startup, speed dial homepage, built-in screenshot tool, browser themes, and more. -One feature that should appeal to average users is that QupZilla has a more standard preferences tools than found in many lightweight browsers (Figure 3). So, if going too far outside the lines isn’t your style, but you still want something lighter weight, QupZilla is the browser for you. - -![QupZilla][13] - -Figure 3: The QupZilla preferences tool. - -[Used with permission][9] - -### Otter Browser - -Otter Browser is a free, open source attempt to recreate the closed-source offerings found in the Opera Browser. Otter Browser uses the WebKit rendering engine and has an interface that should be immediately familiar with any user. Although lightweight, Otter Browser does include full-blown features such as: - - * Passwords manager - - * Add-on manager - - * Content blocking - - * Spell checking - - * Customizable GUI - - * URL completion - - * Speed dial (Figure 4) - - * Bookmarks and various related features - - * Mouse gestures - - * User style sheets - - * Built-in Note tool - - -![Otter][15] - -Figure 4: The Otter Browser Speed Dial tab. - -[Used with permission][9] - -Otter Browser can be run on nearly any Linux distribution from an [AppImage][16], so there’s no installation required. Just download the AppImage file, give the file executable permissions (with the command chmod u+x otter-browser-*.AppImage), and then launch the app with the command ./otter-browser*.AppImage. - -Otter Browser does an outstanding job of rendering websites and could function as your go-to minimal browser with ease. - -### Lynx - -Let’s get really minimal. When I first started using Linux, back in ‘97, one of the web browsers I often turned to was a text-only take on the app called [Lynx][17]. It should come as no surprise that Lynx is still around and available for installation from the standard repositories. As you might expect, Lynx works from the terminal window and doesn’t display pretty pictures or render much in the way of advanced features (Figure 5). In fact, Lynx is as bare-bones a browser as you will find available. Because of how bare-bones this web browser is, it’s not recommended for everyone. But if you happen to have a gui-less web server and you have a need to be able to read the occasional website, Lynx can be a real lifesaver. - -![Lynx][19] - -Figure 5: The Lynx browser rendering the Linux.com page. - -[Used with permission][9] - -I have also found Lynx an invaluable tool when troubleshooting certain aspects of a website (or if some feature on a website is preventing me from viewing the content in a regular browser). Another good reason to use Lynx is when you only want to view the content (and not the extraneous elements). - -### Plenty More Where This Came From - -There are plenty more minimal browsers than this. But the list presented here should get you started down the path of minimalism. One (or more) of these browsers are sure to fill that need, whether you’re running it on a low-powered machine or not. - -Learn more about Linux through the free ["Introduction to Linux" ][20]course from The Linux Foundation and edX. - --------------------------------------------------------------------------------- - -via: https://www.linux.com/blog/intro-to-linux/2018/11/5-minimal-web-browsers-linux - -作者:[Jack Wallen][a] -选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]: https://www.linux.com/users/jlwallen -[b]: https://github.com/lujun9972 -[1]: https://www.mozilla.org/en-US/firefox/new/ -[2]: https://www.chromium.org/ -[3]: https://vivaldi.com/ -[4]: https://www.google.com/chrome/ -[5]: https://www.merriam-webster.com/dictionary/epiphany -[6]: https://developer.gnome.org/hig/stable/ -[7]: /files/images/minimalbrowsers1jpg -[8]: https://www.linux.com/sites/lcom/files/styles/rendered_file/public/minimalbrowsers_1.jpg?itok=Q7wZLF8B (GNOME Web) -[9]: /licenses/category/used-permission -[10]: https://www.netsurf-browser.org/ -[11]: https://qupzilla.com/ -[12]: /files/images/minimalbrowsers3jpg -[13]: https://www.linux.com/sites/lcom/files/styles/rendered_file/public/minimalbrowsers_3.jpg?itok=O8iMALWO (QupZilla) -[14]: /files/images/minimalbrowsers4jpg -[15]: https://www.linux.com/sites/lcom/files/styles/rendered_file/public/minimalbrowsers_4.jpg?itok=5bCa0z-e (Otter) -[16]: https://sourceforge.net/projects/otter-browser/files/ -[17]: https://lynx.browser.org/ -[18]: /files/images/minimalbrowsers5jpg -[19]: https://www.linux.com/sites/lcom/files/styles/rendered_file/public/minimalbrowsers_5.jpg?itok=p_Lmiuxh (Lynx) -[20]: https://training.linuxfoundation.org/linux-courses/system-administration-training/introduction-to-linux diff --git a/sources/tech/20190102 Using Yarn on Ubuntu and Other Linux Distributions.md b/sources/tech/20190102 Using Yarn on Ubuntu and Other Linux Distributions.md deleted file mode 100644 index 71555454f5..0000000000 --- a/sources/tech/20190102 Using Yarn on Ubuntu and Other Linux Distributions.md +++ /dev/null @@ -1,265 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: ( ) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Using Yarn on Ubuntu and Other Linux Distributions) -[#]: via: (https://itsfoss.com/install-yarn-ubuntu) -[#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/) - -Using Yarn on Ubuntu and Other Linux Distributions -====== - -**This quick tutorial shows you the official way of installing Yarn package manager on Ubuntu and Debian Linux. You’ll also learn some basic Yarn commands and the steps to remove Yarn completely.** - -[Yarn][1] is an open source JavaScript package manager developed by Facebook. It is an alternative or should I say improvement to the popular npm package manager. [Facebook developers’ team][2] created Yarn to overcome the shortcomings of [npm][3]. Facebook claims that Yarn is faster, reliable and more secure than npm. - -Like npm, Yarn provides you a way to automate the process of installing, updating, configuring, and removing packages retrieved from a global registry. - -The advantage of Yarn is that it is faster as it caches every package it downloads so it doesn’t need to download it again. It also parallelizes operations to maximize resource utilization. Yarn also uses [checksums to verify the integrity][4] of every installed package before its code is executed. Yarn also guarantees that an install that worked on one system will work exactly the same way on any other system. - -If you are [using nodejs on Ubuntu][5], probably you already have npm installed on your system. In that case, you can use npm to install Yarn globally in the following manner: - -``` -sudo npm install yarn -g -``` - -However, I would recommend using the official way to install Yarn on Ubuntu/Debian. - -### Installing Yarn on Ubuntu and Debian [The Official Way] - -![Yarn JS][6] - -The instructions mentioned here should be applicable to all versions of Ubuntu such as Ubuntu 18.04, 16.04 etc. The same set of instructions are also valid for Debian and other Debian based distributions. - -Since the tutorial uses Curl to add the GPG key of Yarn project, it would be a good idea to verify whether you have Curl installed already or not. - -``` -sudo apt install curl -``` - -The above command will install Curl if it wasn’t installed already. Now that you have curl, you can use it to add the GPG key of Yarn project in the following fashion: - -``` -curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add - -``` - -After that, add the repository to your sources list so that you can easily upgrade the Yarn package in future with the rest of the system updates: - -``` -sudo sh -c 'echo "deb https://dl.yarnpkg.com/debian/ stable main" >> /etc/apt/sources.list.d/yarn.list' -``` - -You are set to go now. [Update Ubuntu][7] or Debian system to refresh the list of available packages and then install yarn: - -``` -sudo apt update -sudo apt install yarn -``` - -This will install Yarn along with nodejs. Once the process completes, verify that Yarn has been installed successfully. You can do that by checking the Yarn version. - -``` -yarn --version -``` - -For me, it showed an output like this: - -``` -yarn --version -1.12.3 -``` - -This means that I have Yarn version 1.12.3 installed on my system. - -### Using Yarn - -I presume that you have some basic understandings of JavaScript programming and how dependencies work. I am not going to go in details here. I’ll show you some of the basic Yarn commands that will help you getting started with it. - -#### Creating a new project with Yarn - -Like npm, Yarn also works with a package.json file. This is where you add your dependencies. All the packages of the dependencies are cached in the node_modules directory in the root directory of your project. - -In the root directory of your project, run the following command to generate a fresh package.json file: - -It will ask you a number of questions. You can skip the questions r go with the defaults by pressing enter. - -``` -yarn init -yarn init v1.12.3 -question name (test_yarn): test_yarn_proect -question version (1.0.0): 0.1 -question description: Test Yarn -question entry point (index.js): -question repository url: -question author: abhishek -question license (MIT): -question private: -success Saved package.json -Done in 82.42s. -``` - -With this, you get a package.json file of this sort: - -``` -{ - "name": "test_yarn_proect", - "version": "0.1", - "description": "Test Yarn", - "main": "index.js", - "author": "abhishek", - "license": "MIT" -} -``` - -Now that you have the package.json, you can either manually edit it to add or remove package dependencies or use Yarn commands (preferred). - -#### Adding dependencies with Yarn - -You can add a dependency on a certain package in the following fashion: - -``` -yarn add -``` - -For example, if you want to use [Lodash][8] in your project, you can add it using Yarn like this: - -``` -yarn add lodash -yarn add v1.12.3 -info No lockfile found. -[1/4] Resolving packages… -[2/4] Fetching packages… -[3/4] Linking dependencies… -[4/4] Building fresh packages… -success Saved lockfile. -success Saved 1 new dependency. -info Direct dependencies -└─ [email protected] -info All dependencies -└─ [email protected] -Done in 2.67s. -``` - -And you can see that this dependency has been added automatically in the package.json file: - -``` -{ - "name": "test_yarn_proect", - "version": "0.1", - "description": "Test Yarn", - "main": "index.js", - "author": "abhishek", - "license": "MIT", - "dependencies": { - "lodash": "^4.17.11" - } -} -``` - -By default, Yarn will add the latest version of a package in the dependency. If you want to use a specific version, you may specify it while adding. - -As always, you can also update the package.json file manually. - -#### Upgrading dependencies with Yarn - -You can upgrade a particular dependency to its latest version with the following command: - -``` -yarn upgrade -``` - -It will see if the package in question has a newer version and will update it accordingly. - -You can also change the version of an already added dependency in the following manner: - -You can also upgrade all the dependencies of your project to their latest version with one single command: - -``` -yarn upgrade -``` - -It will check the versions of all the dependencies and will update them if there are any newer versions. - -#### Removing dependencies with Yarn - -You can remove a package from the dependencies of your project in this way: - -``` -yarn remove -``` - -#### Install all project dependencies - -If you made any changes to the project.json file, you should run either - -``` -yarn -``` - -or - -``` -yarn install -``` - -to install all the dependencies at once. - -### How to remove Yarn from Ubuntu or Debian - -I’ll complete this tutorial by mentioning the steps to remove Yarn from your system if you used the above steps to install it. If you ever realized that you don’t need Yarn anymore, you will be able to remove it. - -Use the following command to remove Yarn and its dependencies. - -``` -sudo apt purge yarn -``` - -You should also remove the Yarn repository from the repository list: - -``` -sudo rm /etc/apt/sources.list.d/yarn.list -``` - -The optional next step is to remove the GPG key you had added to the trusted keys. But for that, you need to know the key. You can get that using the apt-key command: - -Warning: apt-key output should not be parsed (stdout is not a terminal) pub rsa4096 2016-10-05 [SC] 72EC F46A 56B4 AD39 C907 BBB7 1646 B01B 86E5 0310 uid [ unknown] Yarn Packaging - -Warning: apt-key output should not be parsed (stdout is not a terminal) pub rsa4096 2016-10-05 [SC] 72EC F46A 56B4 AD39 C907 BBB7 1646 B01B 86E5 0310 uid [ unknown] Yarn Packaging yarn@dan.cx sub rsa4096 2016-10-05 [E] sub rsa4096 2019-01-02 [S] [expires: 2020-02-02] - -The key here is the last 8 characters of the GPG key’s fingerprint in the line starting with pub. - -So, in my case, the key is 86E50310 and I’ll remove it using this command: - -``` -sudo apt-key del 86E50310 -``` - -You’ll see an OK in the output and the GPG key of Yarn package will be removed from the list of GPG keys your system trusts. - -I hope this tutorial helped you to install Yarn on Ubuntu, Debian, Linux Mint, elementary OS etc. I provided some basic Yarn commands to get you started along with complete steps to remove Yarn from your system. - -I hope you liked this tutorial and if you have any questions or suggestions, please feel free to leave a comment below. - - --------------------------------------------------------------------------------- - -via: https://itsfoss.com/install-yarn-ubuntu - -作者:[Abhishek Prakash][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/abhishek/ -[b]: https://github.com/lujun9972 -[1]: https://yarnpkg.com/lang/en/ -[2]: https://code.fb.com/ -[3]: https://www.npmjs.com/ -[4]: https://itsfoss.com/checksum-tools-guide-linux/ -[5]: https://itsfoss.com/install-nodejs-ubuntu/ -[6]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2019/01/yarn-js-ubuntu-debian.jpeg?resize=800%2C450&ssl=1 -[7]: https://itsfoss.com/update-ubuntu/ -[8]: https://lodash.com/ diff --git a/sources/tech/20190107 Different Ways To Update Linux Kernel For Ubuntu.md b/sources/tech/20190107 Different Ways To Update Linux Kernel For Ubuntu.md deleted file mode 100644 index 32a6a7dd3e..0000000000 --- a/sources/tech/20190107 Different Ways To Update Linux Kernel For Ubuntu.md +++ /dev/null @@ -1,232 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: ( ) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Different Ways To Update Linux Kernel For Ubuntu) -[#]: via: (https://www.ostechnix.com/different-ways-to-update-linux-kernel-for-ubuntu/) -[#]: author: (SK https://www.ostechnix.com/author/sk/) - -Different Ways To Update Linux Kernel For Ubuntu -====== - -![](https://www.ostechnix.com/wp-content/uploads/2019/01/ubuntu-linux-kernel-720x340.png) - -In this guide, we have given 7 different ways to update Linux kernel for Ubuntu. Among the 7 methods, five methods requires system reboot to apply the new Kernel and two methods don’t. Before updating Linux Kernel, it is **highly recommended to backup your important data!** All methods mentioned here are tested on Ubuntu OS only. We are not sure if they will work on other Ubuntu flavors (Eg. Xubuntu) and Ubuntu derivatives (Eg. Linux Mint). - -### Part A – Kernel Updates with reboot - -The following methods requires you to reboot your system to apply the new Linux Kernel. All of the following methods are recommended for personal or testing systems. Again, please backup your important data, configuration files and any other important stuff from your Ubuntu system. - -#### Method 1 – Update the Linux Kernel with dpkg (The manual way) - -This method helps you to manually download and install the latest available Linux kernel from **[kernel.ubuntu.com][1]** website. If you want to install most recent version (either stable or release candidate), this method will help. Download the Linux kernel version from the above link. As of writing this guide, the latest available version was **5.0-rc1** and latest stable version was **v4.20**. - -![][3] - -Click on the Linux Kernel version link of your choice and find the section for your architecture (‘Build for XXX’). In that section, download the two files with these patterns (where X.Y.Z is the highest version): - - 1. linux-image-*X.Y.Z*-generic-*.deb - 2. linux-modules-X.Y.Z*-generic-*.deb - - - -In a terminal, change directory to where the files are and run this command to manually install the kernel: - -``` -$ sudo dpkg --install *.deb -``` - -Reboot to use the new kernel: - -``` -$ sudo reboot -``` - -Check the kernel is as expected: - -``` -$ uname -r -``` - -For step by step instructions, please check the section titled under “Install Linux Kernel 4.15 LTS On DEB based systems” in the following guide. - -+ [Install Linux Kernel 4.15 In RPM And DEB Based Systems](https://www.ostechnix.com/install-linux-kernel-4-15-rpm-deb-based-systems/) - -The above guide is specifically written for 4.15 version. However, all the steps are same for installing latest versions too. - -**Pros:** No internet needed (You can download the Linux Kernel from any system). - -**Cons:** Manual update. Reboot necessary. - -#### Method 2 – Update the Linux Kernel with apt-get (The recommended method) - -This is the recommended way to install latest Linux kernel on Ubuntu-like systems. Unlike the previous method, this method will download and install latest Kernel version from Ubuntu official repositories instead of **kernel.ubuntu.com** website.. - -To update the whole system including the Kernel, just do: - -``` -$ sudo apt-get update - -$ sudo apt-get upgrade -``` - -If you want to update the Kernel only, run: - -``` -$ sudo apt-get upgrade linux-image-generic -``` - -**Pros:** Simple. Recommended method. - -**Cons:** Internet necessary. Reboot necessary. - -Updating Kernel from official repositories will mostly work out of the box without any problems. If it is the production system, this is the recommended way to update the Kernel. - -Method 1 and 2 requires user intervention to update Linux Kernels. The following methods (3, 4 & 5) are mostly automated. - -#### Method 3 – Update the Linux Kernel with Ukuu - -**Ukuu** is a Gtk GUI and command line tool that downloads the latest main line Linux kernel from **kernel.ubuntu.com** , and install it automatically in your Ubuntu desktop and server editions. Ukku is not only simplifies the process of manually downloading and installing new Kernels, but also helps you to safely remove the old and unnecessary Kernels. For more details, refer the following guide. - -+ [Ukuu – An Easy Way To Install And Upgrade Linux Kernel In Ubuntu-based Systems](https://www.ostechnix.com/ukuu-an-easy-way-to-install-and-upgrade-linux-kernel-in-ubuntu-based-systems/) - -**Pros:** Easy to install and use. Automatically installs main line Kernel. - -**Cons:** Internet necessary. Reboot necessary. - -#### Method 4 – Update the Linux Kernel with UKTools - -Just like Ukuu, the **UKTools** also fetches the latest stable Kernel from from **kernel.ubuntu.com** site and installs it automatically on Ubuntu and its derivatives like Linux Mint. More details about UKTools can be found in the link given below. - -+ [UKTools – Upgrade Latest Linux Kernel In Ubuntu And Derivatives](https://www.ostechnix.com/uktools-upgrade-latest-linux-kernel-in-ubuntu-and-derivatives/) - -**Pros:** Simple. Automated. - -**Cons:** Internet necessary. Reboot necessary. - -#### Method 5 – Update the Linux Kernel with Linux Kernel Utilities - -**Linux Kernel Utilities** is yet another program that makes the process of updating Linux kernel easy in Ubuntu-like systems. It is actually a set of BASH shell scripts used to compile and/or update latest Linux kernels for Debian and derivatives. It consists of three utilities, one for manually compiling and installing Kernel from source from [**http://www.kernel.org**][4] website, another for downloading and installing pre-compiled Kernels from from **** website. and third script is for removing the old kernels. For more details, please have a look at the following link. - -+ [Linux Kernel Utilities – Scripts To Compile And Update Latest Linux Kernel For Debian And Derivatives](https://www.ostechnix.com/linux-kernel-utilities-scripts-compile-update-latest-linux-kernel-debian-derivatives/) - -**Pros:** Simple. Automated. - -**Cons:** Internet necessary. Reboot necessary. - - -### Part B – Kernel Updates without reboot - -As I already said, all of above methods need you to reboot the server before the new kernel is active. If they are personal systems or testing machines, you could simply reboot and start using the new Kernel. But, what if they are production systems that requires zero downtime? No problem. This is where **Livepatching** comes in handy! - -The **livepatching** (or hot patching) allows you to install Linux updates or patches without rebooting, keeping your server at the latest security level, without any downtime. This is attractive for ‘always-on’ servers, such as web hosts, gaming servers, in fact, any situation where the server needs to stay on all the time. Linux vendors maintain patches only for security fixes, so this approach is best when security is your main concern. - -The following two methods doesn’t require system reboot and useful for updating Linux Kernel on production and mission-critical Ubuntu servers. - -#### Method 6 – Update the Linux Kernel Canonical Livepatch Service - -![][5] - -[**Canonical Livepatch Service**][6] applies Kernel updates, patches and security hotfixes automatically without rebooting the Ubuntu systems. It reduces the Ubuntu systems downtime and keep them secure. Canonical Livepatch Service can be set up either during or after installation. If you are using desktop Ubuntu, the Software Updater will automatically check for kernel patches and notify you. In a console-based system, it is up to you to run apt-get update regularly. It will install kernel security patches only when you run the command “apt-get upgrade”, hence is semi-automatic. - -Livepatch is free for three systems. If you have more than three, you need to upgrade to enterprise support solution named **Ubuntu Advantage** suite. This suite includes **Kernel Livepatching** and other services such as, - - * Extended Security Maintenance – critical security updates after Ubuntu end-of-life. - * Landscape – the systems management tool for using Ubuntu at scale. - * Knowledge Base – A private collection of articles and tutorials written by Ubuntu experts. - * Phone and web-based support. - - - -**Cost** - -Ubuntu Advantage includes three paid plans namely, Essential, Standard and Advanced. The basic plan (Essential plan) starts from **225 USD per year for one physical node** and **75 USD per year for one VPS**. It seems there is no monthly subscription for Ubuntu servers and desktops. You can view detailed information on all plans [**here**][7]. - -**Pros:** Simple. Semi-automatic. No reboot necessary. Free for 3 systems. - -**Cons:** Expensive for 4 or more hosts. No patch rollback. - -**Enable Canonical Livepatch Service** - -If you want to setup Livepatch service after installation, just do the following steps. - -Get a key at [**https://auth.livepatch.canonical.com/**][8]. - -``` -$ sudo snap install canonical-livepatch - -$ sudo canonical-livepatch enable your-key -``` - -#### Method 7 – Update the Linux Kernel with KernelCare - -![][9] - -[**KernelCare**][10] is the newest of all the live patching solutions. It is the product of [CloudLinux][11]. KernelCare runs on Ubuntu and other flavors of Linux. It checks for patch releases every 4 hours and will install them without confirmation. Patches can be rolled back if there are problems. - -**Cost** - -Fees, per server: **4 USD per month** , **45 USD per year**. - -Compared to Ubuntu Livepatch, kernelCare seems very cheap and affordable. Good thing is **monthly subscriptions are also available**. Another notable feature is it supports other Linux distributions, such as Red Hat, CentOS, Debian, Oracle Linux, Amazon Linux and virtualization platforms like OpenVZ, Proxmox etc. - -You can read all the features and benefits of KernelCare [**here**][12] and check all available plan details [**here**][13]. - -**Pros:** Simple. Fully automated. Wide OS coverage. Patch rollback. No reboot necessary. Free license for non-profit organizations. Low cost. - -**Cons:** Not free (except for 30 day trial). - -**Enable KernelCare Service** - -Get a 30-day trial key at [**https://cloudlinux.com/kernelcare-free-trial5**][14]. - -Run the following commands to enable KernelCare and register the key. - -``` -$ sudo wget -qq -O - https://repo.cloudlinux.com/kernelcare/kernelcare_install.sh | bash - -$ sudo /usr/bin/kcarectl --register KEY -``` - -If you’re looking for an affordable and reliable commercial service to keep the Linux Kernel updated on your Linux servers, KernelCare is good to go. - -*with inputs from **Paul A. Jacobs** , a Technical Evangelist and Content Writer from Cloud Linux.* - -**Suggested read:** - -And, that’s all for now. Hope this was useful. If you believe any other tools/methods should include in this list, feel free to let us know in the comment section below. I will check and update this guide accordingly. - -More good stuffs to come. Stay tuned! - -Cheers! - - - --------------------------------------------------------------------------------- - -via: https://www.ostechnix.com/different-ways-to-update-linux-kernel-for-ubuntu/ - -作者:[SK][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.ostechnix.com/author/sk/ -[b]: https://github.com/lujun9972 -[1]: http://kernel.ubuntu.com/~kernel-ppa/mainline/ -[2]: data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7 -[3]: http://www.ostechnix.com/wp-content/uploads/2019/01/Ubuntu-mainline-kernel.png -[4]: http://www.kernel.org -[5]: http://www.ostechnix.com/wp-content/uploads/2019/01/Livepatch.png -[6]: https://www.ubuntu.com/livepatch -[7]: https://www.ubuntu.com/support/plans-and-pricing -[8]: https://auth.livepatch.canonical.com/ -[9]: http://www.ostechnix.com/wp-content/uploads/2019/01/KernelCare.png -[10]: https://www.kernelcare.com/ -[11]: https://www.cloudlinux.com/ -[12]: https://www.kernelcare.com/update-kernel-linux/ -[13]: https://www.kernelcare.com/pricing/ -[14]: https://cloudlinux.com/kernelcare-free-trial5 diff --git a/sources/tech/20190113 Editing Subtitles in Linux.md b/sources/tech/20190113 Editing Subtitles in Linux.md deleted file mode 100644 index 57db2754d4..0000000000 --- a/sources/tech/20190113 Editing Subtitles in Linux.md +++ /dev/null @@ -1,168 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (chenmu-kk ) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Editing Subtitles in Linux) -[#]: via: (https://itsfoss.com/editing-subtitles) -[#]: author: (Shirish https://itsfoss.com/author/shirish/) - -Editing Subtitles in Linux -====== - -I have been a world movie and regional movies lover for decades. Subtitles are the essential tool that have enabled me to enjoy the best movies in various languages and from various countries. - -If you enjoy watching movies with subtitles, you might have noticed that sometimes the subtitles are not synced or not correct. - -Did you know that you can edit subtitles and make them better? Let me show you some basic subtitle editing in Linux. - -![Editing subtitles in Linux][1] - -### Extracting subtitles from closed captions data - -Around 2012, 2013 I came to know of a tool called [CCEextractor.][2] As time passed, it has become one of the vital tools for me, especially if I come across a media file which has the subtitle embedded in it. - -CCExtractor analyzes video files and produces independent subtitle files from the closed captions data. - -CCExtractor is a cross-platform, free and open source tool. The tool has matured quite a bit from its formative years and has been part of [GSOC][3] and Google Code-in now and [then.][4] - -The tool, to put it simply, is more or less a set of scripts which work one after another in a serialized order to give you an extracted subtitle. - -You can follow the installation instructions for CCExtractor on [this page][5]. - -After installing when you want to extract subtitles from a media file, do the following: - -``` -ccextractor -``` - -The output of the command will be something like this: - -It basically scans the media file. In this case, it found that the media file is in malyalam and that the media container is an [.mkv][6] container. It extracted the subtitle file with the same name as the video file adding _eng to it. - -CCExtractor is a wonderful tool which can be used to enhance subtitles along with Subtitle Edit which I will share in the next section. - -``` -Interesting Read: There is an interesting synopsis of subtitles at [vicaps][7] which tells and shares why subtitles are important to us. It goes into quite a bit of detail of movie-making as well for those interested in such topics. -``` - -### Editing subtitles with SubtitleEditor Tool - -You probably are aware that most subtitles are in [.srt format][8] . The beautiful thing about this format is and was you could load it in your text editor and do little fixes in it. - -A srt file looks something like this when launched into a simple text-editor: - -The excerpt subtitle I have shared is from a pretty Old German Movie called [The Cabinet of Dr. Caligari (1920)][9] - -Subtitleeditor is a wonderful tool when it comes to editing subtitles. Subtitle Editor is and can be used to manipulate time duration, frame-rate of the subtitle file to be in sync with the media file, duration of breaks in-between and much more. I’ll share some of the basic subtitle editing here. - -![][10] - -First install subtitleeditor the same way you installed ccextractor, using your favorite installation method. In Debian, you can use this command: - -``` -sudo apt install subtitleeditor -``` - -When you have it installed, let’s see some of the common scenarios where you need to edit a subtitle. - -#### Manipulating Frame-rates to sync with Media file - -If you find that the subtitles are not synced with the video, one of the reasons could be the difference between the frame rates of the video file and the subtitle file. - -How do you know the frame rates of these files, then? - -To get the frame rate of a video file, you can use the mediainfo tool. You may need to install it first using your distribution’s package manager. - -Using mediainfo is simple: - -``` -$ mediainfo somefile.mkv | grep Frame - Format settings : CABAC / 4 Ref Frames - Format settings, ReFrames : 4 frames - Frame rate mode : Constant - Frame rate : 25.000 FPS - Bits/(Pixel*Frame) : 0.082 - Frame rate : 46.875 FPS (1024 SPF) -``` - -Now you can see that framerate of the video file is 25.000 FPS. The other Frame-rate we see is for the audio. While I can share why particular fps are used in Video-encoding, Audio-encoding etc. it would be a different subject matter. There is a lot of history associated with it. - -Next is to find out the frame rate of the subtitle file and this is a slightly complicated. - -Usually, most subtitles are in a zipped format. Unzipping the .zip archive along with the subtitle file which ends in something.srt. Along with it, there is usually also a .info file with the same name which sometime may have the frame rate of the subtitle. - -If not, then it usually is a good idea to go some site and download the subtitle from a site which has that frame rate information. For this specific German file, I will be using [Opensubtitle.org][11] - -As you can see in the link, the frame rate of the subtitle is 23.976 FPS. Quite obviously, it won’t play well with my video file with frame rate 25.000 FPS. - -In such cases, you can change the frame rate of the subtitle file using the Subtitle Editor tool: - -Select all the contents from the subtitle file by doing CTRL+A. Go to Timings -> Change Framerate and change frame rates from 23.976 fps to 25.000 fps or whatever it is that is desired. Save the changed file. - -![synchronize frame rates of subtitles in Linux][12] - -#### Changing the Starting position of a subtitle file - -Sometimes the above method may be enough, sometimes though it will not be enough. - -You might find some cases when the start of the subtitle file is different from that in the movie or a media file while the frame rate is the same. - -In such cases, do the following: - -Select all the contents from the subtitle file by doing CTRL+A. Go to Timings -> Select Move Subtitle. - -![Move subtitles using Subtitle Editor on Linux][13] - -Change the new Starting position of the subtitle file. Save the changed file. - -![Move subtitles using Subtitle Editor in Linux][14] - -If you wanna be more accurate, then use [mpv][15] to see the movie or media file and click on the timing, if you click on the timing bar which shows how much the movie or the media file has elapsed, clicking on it will also reveal the microsecond. - -I usually like to be accurate so I try to be as precise as possible. It is very difficult in MPV as human reaction time is imprecise. If I wanna be super accurate then I use something like [Audacity][16] but then that is another ball-game altogether as you can do so much more with it. That may be something to explore in a future blog post as well. - -#### Manipulating Duration - -Sometimes even doing both is not enough and you even have to shrink or add the duration to make it sync with the media file. This is one of the more tedious works as you have to individually fix the duration of each sentence. This can happen especially if you have variable frame rates in the media file (nowadays rare but you still get such files). - -In such a scenario, you may have to edit the duration manually and automation is not possible. The best way is either to fix the video file (not possible without degrading the video quality) or getting video from another source at a higher quality and then [transcode][17] it with the settings you prefer. This again, while a major undertaking I could shed some light on in some future blog post. - -### Conclusion - -What I have shared in above is more or less on improving on existing subtitle files. If you were to start a scratch you need loads of time. I haven’t shared that at all because a movie or any video material of say an hour can easily take anywhere from 4-6 hours or even more depending upon skills of the subtitler, patience, context, jargon, accents, native English speaker, translator etc. all of which makes a difference to the quality of the subtitle. - -I hope you find this interesting and from now onward, you’ll handle your subtitles slightly better. If you have any suggestions to add, please leave a comment below. - - --------------------------------------------------------------------------------- - -via: https://itsfoss.com/editing-subtitles - -作者:[Shirish][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/shirish/ -[b]: https://github.com/lujun9972 -[1]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/01/editing-subtitles-in-linux.jpeg?resize=800%2C450&ssl=1 -[2]: https://www.ccextractor.org/ -[3]: https://itsfoss.com/best-open-source-internships/ -[4]: https://www.ccextractor.org/public:codein:google_code-in_2018 -[5]: https://github.com/CCExtractor/ccextractor/wiki/Installation -[6]: https://en.wikipedia.org/wiki/Matroska -[7]: https://www.vicaps.com/blog/history-of-silent-movies-and-subtitles/ -[8]: https://en.wikipedia.org/wiki/SubRip#SubRip_text_file_format -[9]: https://www.imdb.com/title/tt0010323/ -[10]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2018/12/subtitleeditor.jpg?ssl=1 -[11]: https://www.opensubtitles.org/en/search/sublanguageid-eng/idmovie-4105 -[12]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/01/subtitleeditor-frame-rate-sync.jpg?resize=800%2C450&ssl=1 -[13]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/01/Move-subtitles-Caligiri.jpg?resize=800%2C450&ssl=1 -[14]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2019/01/move-subtitles.jpg?ssl=1 -[15]: https://itsfoss.com/mpv-video-player/ -[16]: https://www.audacityteam.org/ -[17]: https://en.wikipedia.org/wiki/Transcoding -[18]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/01/editing-subtitles-in-linux.jpeg?fit=800%2C450&ssl=1 diff --git a/sources/tech/20190115 Linux Desktop Setup - HookRace Blog.md b/sources/tech/20190115 Linux Desktop Setup - HookRace Blog.md deleted file mode 100644 index 29d5f63d2a..0000000000 --- a/sources/tech/20190115 Linux Desktop Setup - HookRace Blog.md +++ /dev/null @@ -1,514 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: ( ) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Linux Desktop Setup · HookRace Blog) -[#]: via: (https://hookrace.net/blog/linux-desktop-setup/) -[#]: author: (Dennis Felsing http://felsin9.de/nnis/) - -Linux Desktop Setup -====== - - -My software setup has been surprisingly constant over the last decade, after a few years of experimentation since I initially switched to Linux in 2006. It might be interesting to look back in another 10 years and see what changed. A quick overview of what’s running as I’m writing this post: - -[![htop overview][1]][2] - -### Motivation - -My software priorities are, in no specific order: - - * Programs should run on my local system so that I’m in control of them, this excludes cloud solutions. - * Programs should run in the terminal, so that they can be used consistently from anywhere, including weak computers or a phone. - * Keyboard focused is nearly automatic by using terminal software. I prefer to use the mouse where it makes sense only, reaching for the mouse all the time during typing feels like a waste of time. Occasionally it took me an hour to notice that the mouse wasn’t even plugged in. - * Ideally use fast and efficient software, I don’t like hearing the fan and feeling the room heat up. I can also keep running older hardware for much longer, my 10 year old Thinkpad x200s is still fine for all the software I use. - * Be composable. I don’t want to do every step manually, instead automate more when it makes sense. This naturally favors the shell. - - - -### Operating Systems - -I had a hard start with Linux 12 years ago by removing Windows, armed with just the [Gentoo Linux][3] installation CD and a printed manual to get a functioning Linux system. It took me a few days of compiling and tinkering, but in the end I felt like I had learnt a lot. - -I haven’t looked back to Windows since then, but I switched to [Arch Linux][4] on my laptop after having the fan fail from the constant compilation stress. Later I also switched all my other computers and private servers to Arch Linux. As a rolling release distribution you get package upgrades all the time, but the most important breakages are nicely reported in the [Arch Linux News][5]. - -One annoyance though is that Arch Linux removes the old kernel modules once you upgrade it. I usually notice that once I try plugging in a USB flash drive and the kernel fails to load the relevant module. Instead you’re supposed to reboot after each kernel upgrade. There are a few [hacks][6] around to get around the problem, but I haven’t been bothered enough to actually use them. - -Similar problems happen with other programs, commonly Firefox, cron or Samba requiring a restart after an upgrade, but annoyingly not warning you that that’s the case. [SUSE][7], which I use at work, nicely warns about such cases. - -For the [DDNet][8] production servers I prefer [Debian][9] over Arch Linux, so that I have a lower chance of breakage on each upgrade. For my firewall and router I used [OpenBSD][10] for its clean system, documentation and great [pf firewall][11], but right now I don’t have a need for a separate router anymore. - -### Window Manager - -Since I started out with Gentoo I quickly noticed the huge compile time of KDE, which made it a no-go for me. I looked around for more minimal solutions, and used [Openbox][12] and [Fluxbox][13] initially. At some point I jumped on the tiling window manager train in order to be more keyboard-focused and picked up [dwm][14] and [awesome][15] close to their initial releases. - -In the end I settled on [xmonad][16] thanks to its flexibility, extendability and being written and configured in pure [Haskell][17], a great functional programming language. One example of this is that at home I run a single 40” 4K screen, but often split it up into four virtual screens, each displaying a workspace on which my windows are automatically arranged. Of course xmonad has a [module][18] for that. - -[dzen][19] and [conky][20] function as a simple enough status bar for me. My entire conky config looks like this: - -``` -out_to_console yes -update_interval 1 -total_run_times 0 - -TEXT -${downspeed eth0} ${upspeed eth0} | $cpu% ${loadavg 1} ${loadavg 2} ${loadavg 3} $mem/$memmax | ${time %F %T} -``` - -And gets piped straight into dzen2 with `conky | dzen2 -fn '-xos4-terminus-medium-r-normal-*-12-*-*-*-*-*-*-*' -bg '#000000' -fg '#ffffff' -p -e '' -x 1000 -w 920 -xs 1 -ta r`. - -One important feature for me is to make the terminal emit a beep sound once a job is done. This is done simply by adding a `\a` character to the `PR_TITLEBAR` variable in zsh, which is shown whenever a job is done. Of course I disable the actual beep sound by blacklisting the `pcspkr` kernel module with `echo "blacklist pcspkr" > /etc/modprobe.d/nobeep.conf`. Instead the sound gets turned into an urgency by urxvt’s `URxvt.urgentOnBell: true` setting. Then xmonad has an urgency hook to capture this and I can automatically focus the currently urgent window with a key combination. In dzen I get the urgent windowspaces displayed with a nice and bright `#ff0000`. - -The final result in all its glory on my Laptop: - -[![Laptop screenshot][21]][22] - -I hear that [i3][23] has become quite popular in the last years, but it requires more manual window alignment instead of specifying automated methods to do it. - -I realize that there are also terminal multiplexers like [tmux][24], but I still require a few graphical applications, so in the end I never used them productively. - -### Terminal Persistency - -In order to keep terminals alive I use [dtach][25], which is just the detach feature of screen. In order to make every terminal on my computer detachable I wrote a [small wrapper script][26]. This means that even if I had to restart my X server I could keep all my terminals running just fine, both local and remote. - -### Shell & Programming - -Instead of [bash][27] I use [zsh][28] as my shell for its huge number of features. - -As a terminal emulator I found [urxvt][29] to be simple enough, support Unicode and 256 colors and has great performance. Another great feature is being able to run the urxvt client and daemon separately, so that even a large number of terminals barely takes up any memory (except for the scrollback buffer). - -There is only one font that looks absolutely clean and perfect to me: [Terminus][30]. Since i’s a bitmap font everything is pixel perfect and renders extremely fast and at low CPU usage. In order to switch fonts on-demand in each terminal with `CTRL-WIN-[1-7]` my ~/.Xdefaults contains: - -``` -URxvt.font: -xos4-terminus-medium-r-normal-*-14-*-*-*-*-*-*-* -dzen2.font: -xos4-terminus-medium-r-normal-*-14-*-*-*-*-*-*-* - -URxvt.keysym.C-M-1: command:\033]50;-xos4-terminus-medium-r-normal-*-12-*-*-*-*-*-*-*\007 -URxvt.keysym.C-M-2: command:\033]50;-xos4-terminus-medium-r-normal-*-14-*-*-*-*-*-*-*\007 -URxvt.keysym.C-M-3: command:\033]50;-xos4-terminus-medium-r-normal-*-18-*-*-*-*-*-*-*\007 -URxvt.keysym.C-M-4: command:\033]50;-xos4-terminus-medium-r-normal-*-22-*-*-*-*-*-*-*\007 -URxvt.keysym.C-M-5: command:\033]50;-xos4-terminus-medium-r-normal-*-24-*-*-*-*-*-*-*\007 -URxvt.keysym.C-M-6: command:\033]50;-xos4-terminus-medium-r-normal-*-28-*-*-*-*-*-*-*\007 -URxvt.keysym.C-M-7: command:\033]50;-xos4-terminus-medium-r-normal-*-32-*-*-*-*-*-*-*\007 - -URxvt.keysym.C-M-n: command:\033]10;#ffffff\007\033]11;#000000\007\033]12;#ffffff\007\033]706;#00ffff\007\033]707;#ffff00\007 -URxvt.keysym.C-M-b: command:\033]10;#000000\007\033]11;#ffffff\007\033]12;#000000\007\033]706;#0000ff\007\033]707;#ff0000\007 -``` - -For programming and writing I use [Vim][31] with syntax highlighting and [ctags][32] for indexing, as well as a few terminal windows with grep, sed and the other usual suspects for search and manipulation. This is probably not at the same level of comfort as an IDE, but allows me more automation. - -One problem with Vim is that you get so used to its key mappings that you’ll want to use them everywhere. - -[Python][33] and [Nim][34] do well as scripting languages where the shell is not powerful enough. - -### System Monitoring - -[htop][35] (look at the background of that site, it’s a live view of the server that’s hosting it) works great for getting a quick overview of what the software is currently doing. [lm_sensors][36] allows monitoring the hardware temperatures, fans and voltages. [powertop][37] is a great little tool by Intel to find power savings. [ncdu][38] lets you analyze disk usage interactively. - -[nmap][39], iptraf-ng, [tcpdump][40] and [Wireshark][41] are essential tools for analyzing network problems. - -There are of course many more great tools. - -### Mails & Synchronization - -On my home server I have a [fetchmail][42] daemon running for each email acccount that I have. Fetchmail just retrieves the incoming emails and invokes [procmail][43]: - -``` -#!/bin/sh -for i in /home/deen/.fetchmail/*; do - FETCHMAILHOME=$i /usr/bin/fetchmail -m 'procmail -d %T' -d 60 -done -``` - -The configuration is as simple as it could be and waits for the server to inform us of fresh emails: - -``` -poll imap.1und1.de protocol imap timeout 120 user "dennis@felsin9.de" password "XXX" folders INBOX keep ssl idle -``` - -My `.procmailrc` config contains a few rules to backup all mails and sort them into the correct directories, for example based on the mailing list id or from field in the mail header: - -``` -MAILDIR=/home/deen/shared/Maildir -LOGFILE=$HOME/.procmaillog -LOGABSTRACT=no -VERBOSE=off -FORMAIL=/usr/bin/formail -NL=" -" - -:0wc -* ! ? test -d /media/mailarchive/`date +%Y` -| mkdir -p /media/mailarchive/`date +%Y` - -# Make backups of all mail received in format YYYY/YYYY-MM -:0c -/media/mailarchive/`date +%Y`/`date +%Y-%m` - -:0 -* ^From: .*(.*@.*.kit.edu|.*@.*.uka.de|.*@.*.uni-karlsruhe.de) -$MAILDIR/.uni/ - -:0 -* ^list-Id:.*lists.kit.edu -$MAILDIR/.uni-ml/ - -[...] -``` - -To send emails I use [msmtp][44], which is also great to configure: - -``` -account default -host smtp.1und1.de -tls on -tls_trust_file /etc/ssl/certs/ca-certificates.crt -auth on -from dennis@felsin9.de -user dennis@felsin9.de -password XXX - -[...] -``` - -But so far the emails are still on the server. My documents are all stored in a directory that I synchronize between all computers using [Unison][45]. Think of Unison as a bidirectional interactive [rsync][46]. My emails are part of this documents directory and thus they end up on my desktop computers. - -This also means that while the emails reach my server immediately, I only fetch them on deman instead of getting instant notifications when an email comes in. - -From there I read the mails with [mutt][47], using the sidebar plugin to display my mail directories. The `/etc/mailcap` file is essential to display non-plaintext mails containing HTML, Word or PDF: - -``` -text/html;w3m -I %{charset} -T text/html; copiousoutput -application/msword; antiword %s; copiousoutput -application/pdf; pdftotext -layout /dev/stdin -; copiousoutput -``` - -### News & Communication - -[Newsboat][48] is a nice little RSS/Atom feed reader in the terminal. I have it running on the server in a `tach` session with about 150 feeds. Filtering feeds locally is also possible, for example: - -``` -ignore-article "https://forum.ddnet.tw/feed.php" "title =~ \"Map Testing •\" or title =~ \"Old maps •\" or title =~ \"Map Bugs •\" or title =~ \"Archive •\" or title =~ \"Waiting for mapper •\" or title =~ \"Other mods •\" or title =~ \"Fixes •\"" -``` - -I use [Irssi][49] the same way for communication via IRC. - -### Calendar - -[remind][50] is a calendar that can be used from the command line. Setting new reminders is done by editing the `rem` files: - -``` -# One time events -REM 2019-01-20 +90 Flight to China %b - -# Recurring Holidays -REM 1 May +90 Holiday "Tag der Arbeit" %b -REM [trigger(easterdate(year(today()))-2)] +90 Holiday "Karfreitag" %b - -# Time Change -REM Nov Sunday 1 --7 +90 Time Change (03:00 -> 02:00) %b -REM Apr Sunday 1 --7 +90 Time Change (02:00 -> 03:00) %b - -# Birthdays -FSET birthday(x) "'s " + ord(year(trigdate())-x) + " birthday is %b" -REM 16 Apr +90 MSG Andreas[birthday(1994)] - -# Sun -SET $LatDeg 49 -SET $LatMin 19 -SET $LatSec 49 -SET $LongDeg -8 -SET $LongMin -40 -SET $LongSec -24 - -MSG Sun from [sunrise(trigdate())] to [sunset(trigdate())] -[...] -``` - -Unfortunately there is no Chinese Lunar calendar function in remind yet, so Chinese holidays can’t be calculated easily. - -I use two aliases for remind: - -``` -rem -m -b1 -q -g -``` - -to see a list of the next events in chronological order and - -``` -rem -m -b1 -q -cuc12 -w$(($(tput cols)+1)) | sed -e "s/\f//g" | less -``` - -to show a calendar fitting just the width of my terminal: - -![remcal][51] - -### Dictionary - -[rdictcc][52] is a little known dictionary tool that uses the excellent dictionary files from [dict.cc][53] and turns them into a local database: - -``` -$ rdictcc rasch -====================[ A => B ]==================== -rasch: - - apace - - brisk [speedy] - - cursory - - in a timely manner - - quick - - quickly - - rapid - - rapidly - - sharpish [Br.] [coll.] - - speedily - - speedy - - swift - - swiftly -rasch [gehen]: - - smartly [quickly] -Rasch {n} [Zittergras-Segge]: - - Alpine grass [Carex brizoides] - - quaking grass sedge [Carex brizoides] -Rasch {m} [regional] [Putzrasch]: - - scouring pad -====================[ B => A ]==================== -Rasch model: - - Rasch-Modell {n} -``` - -### Writing and Reading - -I have a simple todo file containing my tasks, that is basically always sitting open in a Vim session. For work I also use the todo file as a “done” file so that I can later check what tasks I finished on each day. - -For writing documents, letters and presentations I use [LaTeX][54] for its superior typesetting. A simple letter in German format can be set like this for example: - -``` -\documentclass[paper = a4, fromalign = right]{scrlttr2} -\usepackage{german} -\usepackage{eurosym} -\usepackage[utf8]{inputenc} -\setlength{\parskip}{6pt} -\setlength{\parindent}{0pt} - -\setkomavar{fromname}{Dennis Felsing} -\setkomavar{fromaddress}{Meine Str. 1\\69181 Leimen} -\setkomavar{subject}{Titel} - -\setkomavar*{enclseparator}{Anlagen} - -\makeatletter -\@setplength{refvpos}{89mm} -\makeatother - -\begin{document} -\begin{letter} {Herr Soundso\\Deine Str. 2\\69121 Heidelberg} -\opening{Sehr geehrter Herr Soundso,} - -Sie haben bei mir seit dem Bla Bla Bla. - -Ich fordere Sie hiermit zu Bla Bla Bla auf. - -\closing{Mit freundlichen Grüßen} - -\end{letter} -\end{document} -``` - -Further example documents and presentations can be found over at [my private site][55]. - -To read PDFs [Zathura][56] is fast, has Vim-like controls and even supports two different PDF backends: Poppler and MuPDF. [Evince][57] on the other hand is more full-featured for the cases where I encounter documents that Zathura doesn’t like. - -### Graphical Editing - -[GIMP][58] and [Inkscape][59] are easy choices for photo editing and interactive vector graphics respectively. - -In some cases [Imagemagick][60] is good enough though and can be used straight from the command line and thus automated to edit images. Similarly [Graphviz][61] and [TikZ][62] can be used to draw graphs and other diagrams. - -### Web Browsing - -As a web browser I’ve always used [Firefox][63] for its extensibility and low resource usage compared to Chrome. - -Unfortunately the [Pentadactyl][64] extension development stopped after Firefox switched to Chrome-style extensions entirely, so I don’t have satisfying Vim-like controls in my browser anymore. - -### Media Players - -[mpv][65] with hardware decoding allows watching videos at 5% CPU load using the `vo=gpu` and `hwdec=vaapi` config settings. `audio-channels=2` in mpv seems to give me clearer downmixing to my stereo speakers / headphones than what PulseAudio does by default. A great little feature is exiting with `Shift-Q` instead of just `Q` to save the playback location. When watching with someone with another native tongue you can use `--secondary-sid=` to show two subtitles at once, the primary at the bottom, the secondary at the top of the screen - -My wirelss mouse can easily be made into a remote control with mpv with a small `~/.config/mpv/input.conf`: - -``` -MOUSE_BTN5 run "mixer" "pcm" "-2" -MOUSE_BTN6 run "mixer" "pcm" "+2" -MOUSE_BTN1 cycle sub-visibility -MOUSE_BTN7 add chapter -1 -MOUSE_BTN8 add chapter 1 -``` - -[youtube-dl][66] works great for watching videos hosted online, best quality can be achieved with `-f bestvideo+bestaudio/best --all-subs --embed-subs`. - -As a music player [MOC][67] hasn’t been actively developed for a while, but it’s still a simple player that plays every format conceivable, including the strangest Chiptune formats. In the AUR there is a [patch][68] adding PulseAudio support as well. Even with the CPU clocked down to 800 MHz MOC barely uses 1-2% of a single CPU core. - -![moc][69] - -My music collection sits on my home server so that I can access it from anywhere. It is mounted using [SSHFS][70] and automount in the `/etc/fstab/`: - -``` -root@server:/media/media /mnt/media fuse.sshfs noauto,x-systemd.automount,idmap=user,IdentityFile=/root/.ssh/id_rsa,allow_other,reconnect 0 0 -``` - -### Cross-Platform Building - -Linux is great to build packages for any major operating system except Linux itself! In the beginning I used [QEMU][71] to with an old Debian, Windows and Mac OS X VM to build for these platforms. - -Nowadays I switched to using chroot for the old Debian distribution (for maximum Linux compatibility), [MinGW][72] to cross-compile for Windows and [OSXCross][73] to cross-compile for Mac OS X. - -The script used to [build DDNet][74] as well as the [instructions for updating library builds][75] are based on this. - -### Backups - -As usual, we nearly forgot about backups. Even if this is the last chapter, it should not be an afterthought. - -I wrote [rrb][76] (reverse rsync backup) 10 years ago to wrap rsync so that I only need to give the backup server root SSH rights to the computers that it is backing up. Surprisingly rrb needed 0 changes in the last 10 years, even though I kept using it the entire time. - -The backups are stored straight on the filesystem. Incremental backups are implemented using hard links (`--link-dest`). A simple [config][77] defines how long backups are kept, which defaults to: - -``` -KEEP_RULES=( \ - 7 7 \ # One backup a day for the last 7 days - 31 8 \ # 8 more backups for the last month - 365 11 \ # 11 more backups for the last year -1825 4 \ # 4 more backups for the last 5 years -) -``` - -Since some of my computers don’t have a static IP / DNS entry and I still want to back them up using rrb I use a reverse SSH tunnel (as a systemd service) for them: - -``` -[Unit] -Description=Reverse SSH Tunnel -After=network.target - -[Service] -ExecStart=/usr/bin/ssh -N -R 27276:localhost:22 -o "ExitOnForwardFailure yes" server -KillMode=process -Restart=always - -[Install] -WantedBy=multi-user.target -``` - -Now the server can reach the client through `ssh -p 27276 localhost` while the tunnel is running to perform the backup, or in `.ssh/config` format: - -``` -Host cr-remote - HostName localhost - Port 27276 -``` - -While talking about SSH hacks, sometimes a server is not easily reachable thanks to some bad routing. In that case you can route the SSH connection through another server to get better routing, in this case going through the USA to reach my Chinese server which had not been reliably reachable from Germany for a few weeks: - -``` -Host chn.ddnet.tw - ProxyCommand ssh -q usa.ddnet.tw nc -q0 chn.ddnet.tw 22 - Port 22 -``` - -### Final Remarks - -Thanks for reading my random collection of tools. I probably forgot many programs that I use so naturally every day that I don’t even think about them anymore. Let’s see how stable my software setup stays in the next years. If you have any questions, feel free to get in touch with me at [dennis@felsin9.de][78]. - -Comments on [Hacker News][79]. - --------------------------------------------------------------------------------- - -via: https://hookrace.net/blog/linux-desktop-setup/ - -作者:[Dennis Felsing][a] -选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]: http://felsin9.de/nnis/ -[b]: https://github.com/lujun9972 -[1]: https://hookrace.net/public/linux-desktop/htop_small.png -[2]: https://hookrace.net/public/linux-desktop/htop.png -[3]: https://gentoo.org/ -[4]: https://www.archlinux.org/ -[5]: https://www.archlinux.org/news/ -[6]: https://www.reddit.com/r/archlinux/comments/4zrsc3/keep_your_system_fully_functional_after_a_kernel/ -[7]: https://www.suse.com/ -[8]: https://ddnet.tw/ -[9]: https://www.debian.org/ -[10]: https://www.openbsd.org/ -[11]: https://www.openbsd.org/faq/pf/ -[12]: http://openbox.org/wiki/Main_Page -[13]: http://fluxbox.org/ -[14]: https://dwm.suckless.org/ -[15]: https://awesomewm.org/ -[16]: https://xmonad.org/ -[17]: https://www.haskell.org/ -[18]: http://hackage.haskell.org/package/xmonad-contrib-0.15/docs/XMonad-Layout-LayoutScreens.html -[19]: http://robm.github.io/dzen/ -[20]: https://github.com/brndnmtthws/conky -[21]: https://hookrace.net/public/linux-desktop/laptop_small.png -[22]: https://hookrace.net/public/linux-desktop/laptop.png -[23]: https://i3wm.org/ -[24]: https://github.com/tmux/tmux/wiki -[25]: http://dtach.sourceforge.net/ -[26]: https://github.com/def-/tach/blob/master/tach -[27]: https://www.gnu.org/software/bash/ -[28]: http://www.zsh.org/ -[29]: http://software.schmorp.de/pkg/rxvt-unicode.html -[30]: http://terminus-font.sourceforge.net/ -[31]: https://www.vim.org/ -[32]: http://ctags.sourceforge.net/ -[33]: https://www.python.org/ -[34]: https://nim-lang.org/ -[35]: https://hisham.hm/htop/ -[36]: http://lm-sensors.org/ -[37]: https://01.org/powertop/ -[38]: https://dev.yorhel.nl/ncdu -[39]: https://nmap.org/ -[40]: https://www.tcpdump.org/ -[41]: https://www.wireshark.org/ -[42]: http://www.fetchmail.info/ -[43]: http://www.procmail.org/ -[44]: https://marlam.de/msmtp/ -[45]: https://www.cis.upenn.edu/~bcpierce/unison/ -[46]: https://rsync.samba.org/ -[47]: http://www.mutt.org/ -[48]: https://newsboat.org/ -[49]: https://irssi.org/ -[50]: https://www.roaringpenguin.com/products/remind -[51]: https://hookrace.net/public/linux-desktop/remcal.png -[52]: https://github.com/tsdh/rdictcc -[53]: https://www.dict.cc/ -[54]: https://www.latex-project.org/ -[55]: http://felsin9.de/nnis/research/ -[56]: https://pwmt.org/projects/zathura/ -[57]: https://wiki.gnome.org/Apps/Evince -[58]: https://www.gimp.org/ -[59]: https://inkscape.org/ -[60]: https://imagemagick.org/Usage/ -[61]: https://www.graphviz.org/ -[62]: https://sourceforge.net/projects/pgf/ -[63]: https://www.mozilla.org/en-US/firefox/new/ -[64]: https://github.com/5digits/dactyl -[65]: https://mpv.io/ -[66]: https://rg3.github.io/youtube-dl/ -[67]: http://moc.daper.net/ -[68]: https://aur.archlinux.org/packages/moc-pulse/ -[69]: https://hookrace.net/public/linux-desktop/moc.png -[70]: https://github.com/libfuse/sshfs -[71]: https://www.qemu.org/ -[72]: http://www.mingw.org/ -[73]: https://github.com/tpoechtrager/osxcross -[74]: https://github.com/ddnet/ddnet-scripts/blob/master/ddnet-release.sh -[75]: https://github.com/ddnet/ddnet-scripts/blob/master/ddnet-lib-update.sh -[76]: https://github.com/def-/rrb/blob/master/rrb -[77]: https://github.com/def-/rrb/blob/master/config.example -[78]: mailto:dennis@felsin9.de -[79]: https://news.ycombinator.com/item?id=18979731 diff --git a/sources/tech/20190116 Best Audio Editors For Linux.md b/sources/tech/20190116 Best Audio Editors For Linux.md deleted file mode 100644 index d588c886e2..0000000000 --- a/sources/tech/20190116 Best Audio Editors For Linux.md +++ /dev/null @@ -1,156 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: ( ) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Best Audio Editors For Linux) -[#]: via: (https://itsfoss.com/best-audio-editors-linux) -[#]: author: (Ankush Das https://itsfoss.com/author/ankush/) - -Best Audio Editors For Linux -====== - -You’ve got a lot of choices when it comes to audio editors for Linux. No matter whether you are a professional music producer or just learning to create awesome music, the audio editors will always come in handy. - -Well, for professional-grade usage, a [DAW][1] (Digital Audio Workstation) is always recommended. However, not everyone needs all the functionalities, so you should know about some of the most simple audio editors as well. - -In this article, we will talk about a couple of DAWs and basic audio editors which are available as **free and open source** solutions for Linux and (probably) for other operating systems. - -### Top Audio Editors for Linux - -![Best audio editors and DAW for Linux][2] - -We will not be focusing on all the functionalities that DAWs offer – but the basic audio editing capabilities. You may still consider this as the list of best DAW for Linux. - -**Installation instruction:** You will find all the mentioned audio editors or DAWs in your AppCenter or Software center. In case, you do not find them listed, please head to their official website for more information. - -#### 1\. Audacity - -![audacity audio editor][3] - -Audacity is one of the most basic yet a capable audio editor available for Linux. It is a free and open-source cross-platform tool. A lot of you must be already knowing about it. - -It has improved a lot when compared to the time when it started trending. I do recall that I utilized it to “try” making karaokes by removing the voice from an audio file. Well, you can still do it – but it depends. - -**Features:** - -It also supports plug-ins that include VST effects. Of course, you should not expect it to support VST Instruments. - - * Live audio recording through a microphone or a mixer - * Export/Import capability supporting multiple formats and multiple files at the same time - * Plugin support: LADSPA, LV2, Nyquist, VST and Audio Unit effect plug-ins - * Easy editing with cut, paste, delete and copy functions. - * Spectogram view mode for analyzing frequencies - - - -#### 2\. LMMS - -![][4] - -LMMS is a free and open source (cross-platform) digital audio workstation. It includes all the basic audio editing functionalities along with a lot of advanced features. - -You can mix sounds, arrange them, or create them using VST instruments. It does support them. Also, it comes baked in with some samples, presets, VST Instruments, and effects to get started. In addition, you also get a spectrum analyzer for some advanced audio editing. - -**Features:** - - * Note playback via MIDI - * VST Instrument support - * Native multi-sample support - * Built-in compressor, limiter, delay, reverb, distortion and bass enhancer - - - -#### 3\. Ardour - -![Ardour audio editor][5] - -Ardour is yet another free and open source digital audio workstation. If you have an audio interface, Ardour will support it. Of course, you can add unlimited multichannel tracks. The multichannel tracks can also be routed to different mixer tapes for the ease of editing and recording. - -You can also import a video to it and edit the audio to export the whole thing. It comes with a lot of built-in plugins and supports VST plugins as well. - -**Features:** - - * Non-linear editing - * Vertical window stacking for easy navigation - * Strip silence, push-pull trimming, Rhythm Ferret for transient and note onset-based editing - - - -#### 4\. Cecilia - -![cecilia audio editor][6] - -Cecilia is not an ordinary audio editor application. It is meant to be used by sound designers or if you are just in the process of becoming one. It is technically an audio signal processing environment. It lets you create ear-bending sound out of them. - -You get in-build modules and plugins for sound effects and synthesis. It is tailored for a specific use – if that is what you were looking for – look no further! - -**Features:** - - * Modules to achieve more (UltimateGrainer – A state-of-the-art granulation processing, RandomAccumulator – Variable speed recording accumulator, -UpDistoRes – Distortion with upsampling and resonant lowpass filter) - * Automatic Saving of modulations - - - -#### 5\. Mixxx - -![Mixxx audio DJ ][7] - -If you want to mix and record something while being able to have a virtual DJ tool, [Mixxx][8] would be a perfect tool. You get to know the BPM, key, and utilize the master sync feature to match the tempo and beats of a song. Also, do not forget that it is yet another free and open source application for Linux! - -It supports custom DJ equipment as well. So, if you have one or a MIDI – you can record your live mixes using this tool. - -**Features** - - * Broadcast and record DJ Mixes of your song - * Ability to connect your equipment and perform live - * Key detection and BPM detection - - - -#### 6\. Rosegarden - -![rosegarden audio editor][9] - -Rosegarden is yet another impressive audio editor for Linux which is free and open source. It is neither a fully featured DAW nor a basic audio editing tool. It is a mixture of both with some scaled down functionalities. - -I wouldn’t recommend this for professionals but if you have a home studio or just want to experiment, this would be one of the best audio editors for Linux to have installed. - -**Features:** - - * Music notation editing - * Recording, Mixing, and samples - - - -### Wrapping Up - -These are some of the best audio editors you could find out there for Linux. No matter whether you need a DAW, a cut-paste editing tool, or a basic mixing/recording audio editor, the above-mentioned tools should help you out. - -Did we miss any of your favorite? Let us know about it in the comments below. - - --------------------------------------------------------------------------------- - -via: https://itsfoss.com/best-audio-editors-linux - -作者:[Ankush Das][a] -选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]: https://itsfoss.com/author/ankush/ -[b]: https://github.com/lujun9972 -[1]: https://en.wikipedia.org/wiki/Digital_audio_workstation -[2]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/01/linux-audio-editors-800x450.jpeg?resize=800%2C450&ssl=1 -[3]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2019/01/audacity-audio-editor.jpg?fit=800%2C591&ssl=1 -[4]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2019/01/lmms-daw.jpg?fit=800%2C472&ssl=1 -[5]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2019/01/ardour-audio-editor.jpg?fit=800%2C639&ssl=1 -[6]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/01/cecilia.jpg?fit=800%2C510&ssl=1 -[7]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/01/mixxx.jpg?fit=800%2C486&ssl=1 -[8]: https://itsfoss.com/dj-mixxx-2/ -[9]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2019/01/rosegarden.jpg?fit=800%2C391&ssl=1 -[10]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2019/01/linux-audio-editors.jpeg?fit=800%2C450&ssl=1 diff --git a/sources/tech/20190124 ffsend - Easily And Securely Share Files From Linux Command Line Using Firefox Send Client.md b/sources/tech/20190124 ffsend - Easily And Securely Share Files From Linux Command Line Using Firefox Send Client.md deleted file mode 100644 index fcbdd3c5c7..0000000000 --- a/sources/tech/20190124 ffsend - Easily And Securely Share Files From Linux Command Line Using Firefox Send Client.md +++ /dev/null @@ -1,330 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: ( ) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (ffsend – Easily And Securely Share Files From Linux Command Line Using Firefox Send Client) -[#]: via: (https://www.2daygeek.com/ffsend-securely-share-files-folders-from-linux-command-line-using-firefox-send-client/) -[#]: author: (Vinoth Kumar https://www.2daygeek.com/author/vinoth/) - -ffsend – Easily And Securely Share Files From Linux Command Line Using Firefox Send Client -====== - -Linux users were preferred to go with scp or rsync for files or folders copy. - -However, so many new options are coming to Linux because it’s a opensource. - -Anyone can develop a secure software for Linux. - -We had written multiple articles in our site in the past about this topic. - -Even, today we are going to discuss the same kind of topic called ffsend. - -Those are **[OnionShare][1]** , **[Magic Wormhole][2]** , **[Transfer.sh][3]** and **[Dcp – Dat Copy][4]**. - -### What’s ffsend? - -[ffsend][5] is a command line Firefox Send client that allow users to transfer and receive files and folders through command line. - -It allow us to easily and securely share files and directories from the command line through a safe, private and encrypted link using a single simple command. - -Files are shared using the Send service and the allowed file size is up to 2GB. - -Others are able to download these files with this tool, or through their web browser. - -All files are always encrypted on the client, and secrets are never shared with the remote host. - -Additionally you can add a password for the file upload. - -The uploaded files will be removed after the download (default count is 1 up to 10) or after 24 hours. This will make sure that your files does not remain online forever. - -This tool is currently in the alpha phase. Use at your own risk. Also, only limited installation options are available right now. - -### ffsend Features: - - * Fully featured and friendly command line tool - * Upload and download files and directories securely - * Always encrypted on the client - * Additional password protection, generation and configurable download limits - * Built-in file and directory archiving and extraction - * History tracking your files for easy management - * Ability to use your own Send host - * Inspect or delete shared files - * Accurate error reporting - * Low memory footprint, due to encryption and download/upload streaming - * Intended to be used in scripts without interaction - - - -### How To Install ffsend in Linux? - -There is no package for each distributions except Debian and Arch Linux systems. However, we can easily get this utility by downloading the prebuilt appropriate binaries file based on the operating system and architecture. - -Run the below command to download the latest available version for your operating system. - -``` -$ wget https://github.com/timvisee/ffsend/releases/download/v0.1.2/ffsend-v0.1.2-linux-x64.tar.gz -``` - -Extract the tar archive using the following command. - -``` -$ tar -xvf ffsend-v0.1.2-linux-x64.tar.gz -``` - -Run the following command to identify your path variable. - -``` -$ echo $PATH -/home/daygeek/.cargo/bin:/usr/local/bin:/usr/local/sbin:/usr/bin:/usr/lib/jvm/default/bin:/usr/bin/site_perl:/usr/bin/vendor_perl:/usr/bin/core_perl -``` - -As i told previously, just move the executable file to your path directory. - -``` -$ sudo mv ffsend /usr/local/sbin -``` - -Run the `ffsend` command alone to get the basic usage information. - -``` -$ ffsend -ffsend 0.1.2 -Usage: ffsend [FLAGS] ... - -Easily and securely share files from the command line. -A fully featured Firefox Send client. - -Missing subcommand. Here are the most used: - ffsend upload ... - ffsend download ... - -To show all subcommands, features and other help: - ffsend help [SUBCOMMAND] -``` - -For Arch Linux based users can easily install it with help of **[AUR Helper][6]** , as this package is available in AUR repository. - -``` -$ yay -S ffsend -``` - -For **`Debian/Ubuntu`** systems, use **[DPKG Command][7]** to install ffsend. - -``` -$ wget https://github.com/timvisee/ffsend/releases/download/v0.1.2/ffsend_0.1.2_amd64.deb -$ sudo dpkg -i ffsend_0.1.2_amd64.deb -``` - -### How To Send A File Using ffsend? - -It’s not complicated. We can easily send a file using simple syntax. - -**Syntax:** - -``` -$ ffsend upload [/Path/to/the/file/name] -``` - -In the following example, we are going to upload a file called `passwd-up1.sh`. Once you upload the file then you will be getting the unique URL. - -``` -$ ffsend upload passwd-up1.sh --copy -Upload complete -Share link: https://send.firefox.com/download/a4062553f4/#yy2_VyPaUMG5HwXZzYRmpQ -``` - -![][9] - -Just download the above unique URL to get the file in any remote system. - -**Syntax:** - -``` -$ ffsend download [Generated URL] -``` - -Output for the above command. - -``` -$ ffsend download https://send.firefox.com/download/a4062553f4/#yy2_VyPaUMG5HwXZzYRmpQ -Download complete -``` - -![][10] - -Use the following syntax format for directory upload. - -``` -$ ffsend upload [/Path/to/the/Directory] --copy -``` - -In this example, we are going to upload `2g` directory. - -``` -$ ffsend upload /home/daygeek/2g --copy -You've selected a directory, only a single file may be uploaded. -Archive the directory into a single file? [Y/n]: y -Archiving... -Upload complete -Share link: https://send.firefox.com/download/90aa5cfe67/#hrwu6oXZRG2DNh8vOc3BGg -``` - -Just download the above generated the unique URL to get a folder in any remote system. - -``` -$ ffsend download https://send.firefox.com/download/90aa5cfe67/#hrwu6oXZRG2DNh8vOc3BGg -You're downloading an archive, extract it into the selected directory? [Y/n]: y -Extracting... -Download complete -``` - -As this already send files through a safe, private, and encrypted link. However, if you would like to add a additional security at your level. Yes, you can add a password for a file. - -``` -$ ffsend upload file-copy-rsync.sh --copy --password -Password: -Upload complete -Share link: https://send.firefox.com/download/0742d24515/#P7gcNiwZJ87vF8cumU71zA -``` - -It will prompt you to update a password when you are trying to download a file in the remote system. - -``` -$ ffsend download https://send.firefox.com/download/0742d24515/#P7gcNiwZJ87vF8cumU71zA -This file is protected with a password. -Password: -Download complete -``` - -Alternatively you can limit a download speed by providing the download speed while uploading a file. - -``` -$ ffsend upload file-copy-scp.sh --copy --downloads 10 -Upload complete -Share link: https://send.firefox.com/download/23cb923c4e/#LVg6K0CIb7Y9KfJRNZDQGw -``` - -Just download the above unique URL to get a file in any remote system. - -``` -ffsend download https://send.firefox.com/download/23cb923c4e/#LVg6K0CIb7Y9KfJRNZDQGw -Download complete -``` - -If you want to see more details about the file, use the following format. It will shows you the file name, file size, Download counts and when it will going to expire. - -**Syntax:** - -``` -$ ffsend info [Generated URL] - -$ ffsend info https://send.firefox.com/download/23cb923c4e/#LVg6K0CIb7Y9KfJRNZDQGw -ID: 23cb923c4e -Name: file-copy-scp.sh -Size: 115 B -MIME: application/x-sh -Downloads: 3 of 10 -Expiry: 23h58m (86280s) -``` - -You can view your transaction history using the following format. - -``` -$ ffsend history -# LINK EXPIRY -1 https://send.firefox.com/download/23cb923c4e/#LVg6K0CIb7Y9KfJRNZDQGw 23h57m -2 https://send.firefox.com/download/0742d24515/#P7gcNiwZJ87vF8cumU71zA 23h55m -3 https://send.firefox.com/download/90aa5cfe67/#hrwu6oXZRG2DNh8vOc3BGg 23h52m -4 https://send.firefox.com/download/a4062553f4/#yy2_VyPaUMG5HwXZzYRmpQ 23h46m -5 https://send.firefox.com/download/74ff30e43e/#NYfDOUp_Ai-RKg5g0fCZXw 23h44m -6 https://send.firefox.com/download/69afaab1f9/#5z51_94jtxcUCJNNvf6RcA 23h43m -``` - -If you don’t want the link anymore then we can delete it. - -**Syntax:** - -``` -$ ffsend delete [Generated URL] - -$ ffsend delete https://send.firefox.com/download/69afaab1f9/#5z51_94jtxcUCJNNvf6RcA -File deleted -``` - -Alternatively this can be done using firefox browser by opening the page . - -Just drag and drop a file to upload it. -![][11] - -Once the file is downloaded, it will show you that 100% download completed. -![][12] - -To check other possible options, navigate to man page or help page. - -``` -$ ffsend --help -ffsend 0.1.2 -Tim Visee -Easily and securely share files from the command line. -A fully featured Firefox Send client. - -USAGE: - ffsend [FLAGS] [OPTIONS] [SUBCOMMAND] - -FLAGS: - -f, --force Force the action, ignore warnings - -h, --help Prints help information - -i, --incognito Don't update local history for actions - -I, --no-interact Not interactive, do not prompt - -q, --quiet Produce output suitable for logging and automation - -V, --version Prints version information - -v, --verbose Enable verbose information and logging - -y, --yes Assume yes for prompts - -OPTIONS: - -H, --history Use the specified history file [env: FFSEND_HISTORY] - -t, --timeout Request timeout (0 to disable) [env: FFSEND_TIMEOUT] - -T, --transfer-timeout Transfer timeout (0 to disable) [env: FFSEND_TRANSFER_TIMEOUT] - -SUBCOMMANDS: - upload Upload files [aliases: u, up] - download Download files [aliases: d, down] - debug View debug information [aliases: dbg] - delete Delete a shared file [aliases: del] - exists Check whether a remote file exists [aliases: e] - help Prints this message or the help of the given subcommand(s) - history View file history [aliases: h] - info Fetch info about a shared file [aliases: i] - parameters Change parameters of a shared file [aliases: params] - password Change the password of a shared file [aliases: pass, p] - -The public Send service that is used as default host is provided by Mozilla. -This application is not affiliated with Mozilla, Firefox or Firefox Send. -``` - --------------------------------------------------------------------------------- - -via: https://www.2daygeek.com/ffsend-securely-share-files-folders-from-linux-command-line-using-firefox-send-client/ - -作者:[Vinoth Kumar][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.2daygeek.com/author/vinoth/ -[b]: https://github.com/lujun9972 -[1]: https://www.2daygeek.com/onionshare-secure-way-to-share-files-sharing-tool-linux/ -[2]: https://www.2daygeek.com/wormhole-securely-share-files-from-linux-command-line/ -[3]: https://www.2daygeek.com/transfer-sh-easy-fast-way-share-files-over-internet-from-command-line/ -[4]: https://www.2daygeek.com/dcp-dat-copy-secure-way-to-transfer-files-between-linux-systems/ -[5]: https://github.com/timvisee/ffsend -[6]: https://www.2daygeek.com/category/aur-helper/ -[7]: https://www.2daygeek.com/dpkg-command-to-manage-packages-on-debian-ubuntu-linux-mint-systems/ -[8]: data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7 -[9]: https://www.2daygeek.com/wp-content/uploads/2019/01/ffsend-easily-and-securely-share-files-from-linux-command-line-using-firefox-send-client-1.png -[10]: https://www.2daygeek.com/wp-content/uploads/2019/01/ffsend-easily-and-securely-share-files-from-linux-command-line-using-firefox-send-client-2.png -[11]: https://www.2daygeek.com/wp-content/uploads/2019/01/ffsend-easily-and-securely-share-files-from-linux-command-line-using-firefox-send-client-3.png -[12]: https://www.2daygeek.com/wp-content/uploads/2019/01/ffsend-easily-and-securely-share-files-from-linux-command-line-using-firefox-send-client-4.png diff --git a/sources/tech/20190204 Getting started with Git- Terminology 101.md b/sources/tech/20190204 Getting started with Git- Terminology 101.md new file mode 100644 index 0000000000..0b76cd3a43 --- /dev/null +++ b/sources/tech/20190204 Getting started with Git- Terminology 101.md @@ -0,0 +1,157 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Getting started with Git: Terminology 101) +[#]: via: (https://opensource.com/article/19/2/git-terminology) +[#]: author: (Matthew Broberg https://opensource.com/users/mbbroberg) + +Getting started with Git: Terminology 101 +====== +Want to learn Git? Check out this quick summary of the most important +terms and commands. +![Digital hand surrounding by objects, bike, light bulb, graphs][1] + +Version control is an important tool for anyone looking to track their changes these days. It's especially helpful for programmers, sysadmins, and site reliability engineers (SREs) alike. The promise of recovering from mistakes to a known good state is a huge win and a touch friendlier than the previous strategy of adding **`.old`** to a copied file. + +But learning Git is often oversimplified by well-meaning peers telling everyone to "get into open source." Before you know it, someone asks for a _pull request_ or *merge request *where you _rebase_ from _upstream_ before they can merge from your _remote_—and be sure to remove _merge commits_. Whatever well-working contribution you want to give back to an open source project feels much further from being added when you look at all these words you don't know. + +![Git Cheat Sheet cover image][2] + +[Download][3] our +Git cheat sheet. + +If you have a month or two and enough curiosity, [Git SCM][4] is the definitive source for all the terms you need to learn. If you're looking for a summary from the trenches, keep reading. + +### Reminder: What's a commit? + +The toughest part of Git for me to internalize was the simplest idea of Git: _a commit is a collection of content, a message about how you got there, and the commits that came before it_. There's no inherent code release strategy or even strong opinions built in. The content doesn't even have to be code—it is _anything_ you want to add to the repository. The commit message annotates that content. + +I like to think of a commit message as a gift to your future self: it may mention the files you edited, but more importantly it reminds you of your intention for changing those files. Adding more about why you have edited what you have helps anyone who uses your repository, even when that person is you. + +### There's no place like 'origin/master' + +Knowing where you are in a Git project starts with thinking of a tree. All Git projects have a root, similar to the idea of a filesystem's root directory. All commits branch off from that root. In this way, a branch is only a pointer to a commit. By convention, **master** is the default name for the default branch in your root directory. + +Since Git is a distributed version control system, where the same codebase is distributed to multiple locations, people often use the term "repository" as a way of talking about all copies of the same project. There is the _local repository_, where you edit your code (more on that in a minute), and the _remote repository_, the place where you want to send it after you're finished. Remotes can be anywhere, even on the same computer where your local repository is located, but they are often hosted on repository services like GitLab or GitHub. + +### What's the pwd of Git commands? + +While it's not an official selling point, being lost is part of the fun of a Git repository. You can find your way by running through this reliable set of commands: + + * `git branch`—to find which branch you're on + + * `git log`—to see what commit you're on + + * `git status`—to see what edits you've made since the last commit + + * `git remote`—to see what remote repository you're tracking + + + + +Orienting yourself using these commands will give you a sense of direction when you're stuck. + +### Have I stashed or cached my commit? + +The code local to your computer is colloquially called your _workspace_. What is not immediately obvious is that you have two (yes, two!) other locations local to you when you are in a Git repository: _index_ and _stash_. When you write some content and then **add** it, you are adding it to the index, which is the cached content that is ready to commit. There are times when you have files in the index that you are not ready to commit, but you want to view another branch. That's where the stash comes in handy. You can store indexed-but-not-yet-committed files to the stash using `git stash`. When you're ready to retrieve the file, run `git stash pop` to bring changes back into the index. + +Here are some commands you'll need to use your stash and cache. + + * `git diff ..origin/master`—to show the difference between the most recent local commit and the remote called "origin" and its branch called "master" + + * `git diff --cached`—to show any differences between the most recent local commit and what has been added to the local index + + * `git stash`—to place indexed (added but not committed) files in the stash stack + + * `git stash list`—to show what changes are in the stash stack + + * `git stash pop`—to take the most recent change off the stash stack + + + + +### HEADless horseman + +Git is a collection of all kinds of metaphors. When I think of where the HEAD is, I think of train lines. If you end up in a _detached HEAD_ mode, it means you're off the metaphorical rails. + +HEAD is a pointer to your most recent commit in the currently checked-out branch. The default "checkout" is when you create a Git repository and land on the **master** branch. Every time you create or change to another branch, you are on that branch line. If you `git checkout ` somewhere in your current branch, HEAD will move to that commit. If there is no commit history connecting your current commit to the commit you checked out, then you'll be in a detached HEAD state. If you ever lose your head finding where HEAD is, you can always `git reset --hard origin/master` to delete changes and get back to a known state. _Warning: this will delete any changes you have made since you last pushed to master._ + +### Are you upstream or downstream? + +The local copy of your project is considered your local repository. It may or may not have a remote repository—the place where you have a copy of your repository for collaboration or safekeeping. There may also be an _upstream_ repository where a third copy of the project is hosted and maintained by a different set of contributors. + +For instance, let's say I want to contribute to Kubernetes. I would first fork the **kubernetes/kubernetes** project to my account, **mbbroberg/kubernetes**. I would then clone my project to my local workspace. In this scenario, my local clone is my local repository, **mbbroberg/kubernetes** is my remote repository, and **kubernetes/kubernetes** is the upstream. + +### Merging the metaphors + +The visual of a root system merges with the train tracks image when you get deeper into Git branches. Branches are often used as ways of developing a new feature that you eventually want to _merge_ into the master branch. When doing this, Git keeps the common history of commits in order then appends the new commits for your branch to the history. There are a ton of nuances to this process—whether to rebase or not, whether to add a merge commit or not—which [Brent Laster][5] explores in greater detail in "[How to reset, revert, and return to previous states in Git][6]." + +### I think I Git it now + +There is a ton of terminology and a lot to explore to master the world of Git commands. I hope this first-person exploration of how I use the terms day-to-day helps you acclimate to it all. If you ever feel stuck or frustrated, feel free to reach out to me on Twitter [@mbbroberg][7]. + +#### To review: + + * **Commit**—stores the current contents of the index in a new commit along with a log message from the user describing the changes + + * **Branch**—a pointer to a commit + + * **Master**—the default name for the first branch + + * **HEAD**—a pointer to the most recent commit on the current branch + + * **Merge**—joining two or more commit histories + + * **Workspace**—the colloquial name for your local copy of a Git repository + + * **Working tree**—the current branch in your workspace; you see this in `git status` output all the time + + * **Cache**—a space intended to temporarily store uncommitted changes + + * **Index**—the cache where changes are stored before they are committed + + * **Tracked and untracked files**—files either in the index cache or not yet added to it + + * **Stash**—another cache, that acts as a stack, where changes can be stored without committing them + + * **Origin**—the default name for a remote repository + + * **Local repository**—another term for where you keep your copy of a Git repository on your workstation + + * **Remote repository**—a secondary copy of a Git repository where you push changes for collaboration or backup + + * **Upstream repository**—the colloquial term for a remote repository that you track + + * **Pull request**—a GitHub-specific term to let others know about changes you've pushed to a branch in a repository + + * **Merge request**—a GitLab-specific term to let others know about changes you've pushed to a branch in a repository + + * **'origin/master'**—the default setting for a remote repository and its primary branch + + + + +Postscript: Puns are one of the best parts of Git. Have fun with them. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/19/2/git-terminology + +作者:[Matthew Broberg][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/mbbroberg +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/rh_003588_01_rd3os.combacktoschoolseriesk12_rh_021x_0.png?itok=fvorN0e- (Digital hand surrounding by objects, bike, light bulb, graphs) +[2]: https://opensource.com/sites/default/files/uploads/git_cheat_sheet_cover.jpg (Git Cheat Sheet cover image) +[3]: https://opensource.com/downloads/cheat-sheet-git +[4]: https://git-scm.com/about +[5]: https://opensource.com/users/bclaster +[6]: https://opensource.com/article/18/6/git-reset-revert-rebase-commands +[7]: https://twitter.com/mbbroberg diff --git a/sources/tech/20190205 Installing Kali Linux on VirtualBox- Quickest - Safest Way.md b/sources/tech/20190205 Installing Kali Linux on VirtualBox- Quickest - Safest Way.md deleted file mode 100644 index e8722c63cc..0000000000 --- a/sources/tech/20190205 Installing Kali Linux on VirtualBox- Quickest - Safest Way.md +++ /dev/null @@ -1,146 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: ( ) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Installing Kali Linux on VirtualBox: Quickest & Safest Way) -[#]: via: (https://itsfoss.com/install-kali-linux-virtualbox/) -[#]: author: (Ankush Das https://itsfoss.com/author/ankush/) - -Installing Kali Linux on VirtualBox: Quickest & Safest Way -====== - -_**This tutorial shows you how to install Kali Linux on Virtual Box in Windows and Linux in the quickest way possible.**_ - -[Kali Linux][1] is one of the [best Linux distributions for hacking][2] and security enthusiasts. - -Since it deals with a sensitive topic like hacking, it’s like a double-edged sword. We have discussed it in the detailed Kali Linux review in the past so I am not going to bore you with the same stuff again. - -While you can install Kali Linux by replacing the existing operating system, using it via a virtual machine would be a better and safer option. - -With Virtual Box, you can use Kali Linux as a regular application in your Windows/Linux system. It’s almost the same as running VLC or a game in your system. - -Using Kali Linux in a virtual machine is also safe. Whatever you do inside Kali Linux will NOT impact your ‘host system’ (i.e. your original Windows or Linux operating system). Your actual operating system will be untouched and your data in the host system will be safe. - -![][3] - -### How to install Kali Linux on VirtualBox - -I’ll be using [VirtualBox][4] here. It is a wonderful open source virtualization solution for just about anyone (professional or personal use). It’s available free of cost. - -In this tutorial, we will talk about Kali Linux in particular but you can install almost any other OS whose ISO file exists or a pre-built virtual machine save file is available. - -**Note:** _The same steps apply for Windows/Linux running VirtualBox._ - -As I already mentioned, you can have either Windows or Linux installed as your host. But, in this case, I have Windows 10 installed (don’t hate me!) where I try to install Kali Linux in VirtualBox step by step. - -And, the best part is – even if you happen to use a Linux distro as your primary OS, the same steps will be applicable! - -Wondering, how? Let’s see… - -[Subscribe to Our YouTube Channel for More Linux Videos][5] - -### Step by Step Guide to install Kali Linux on VirtualBox - -_We are going to use a custom Kali Linux image made for VirtualBox specifically. You can also download the ISO file for Kali Linux and create a new virtual machine – but why do that when you have an easy alternative?_ - -#### 1\. Download and install VirtualBox - -The first thing you need to do is to download and install VirtualBox from Oracle’s official website. - -[Download VirtualBox][6] - -Once you download the installer, just double click on it to install VirtualBox. It’s the same for [installing VirtualBox on Ubuntu][7]/Fedora Linux as well. - -#### 2\. Download ready-to-use virtual image of Kali Linux - -After installing it successfully, head to [Offensive Security’s download page][8] to download the VM image for VirtualBox. If you change your mind to utilize [VMware][9], that is available too. - -![][10] - -As you can see the file size is well over 3 GB, you should either use the torrent option or download it using a [download manager][11]. - -[Kali Linux Virtual Image][8] - -#### 3\. Install Kali Linux on Virtual Box - -Once you have installed VirtualBox and downloaded the Kali Linux image, you just need to import it to VirtualBox in order to make it work. - -Here’s how to import the VirtualBox image for Kali Linux: - -**Step 1** : Launch VirtualBox. You will notice an **Import** button – click on it - -![Click on Import button][12] - -**Step 2:** Next, browse the file you just downloaded and choose it to be imported (as you can see in the image below). The file name should start with ‘kali linux‘ and end with . **ova** extension. - -![Importing Kali Linux image][13] - -**S** Once selected, proceed by clicking on **Next**. - -**Step 3** : Now, you will be shown the settings for the virtual machine you are about to import. So, you can customize them or not – that is your choice. It is okay if you go with the default settings. - -You need to select a path where you have sufficient storage available. I would never recommend the **C:** drive on Windows. - -![Import hard drives as VDI][14] - -Here, the hard drives as VDI refer to virtually mount the hard drives by allocating the storage space set. - -After you are done with the settings, hit **Import** and wait for a while. - -**Step 4:** You will now see it listed. So, just hit **Start** to launch it. - -You might get an error at first for USB port 2.0 controller support, you can disable it to resolve it or just follow the on-screen instruction of installing an additional package to fix it. And, you are done! - -![Kali Linux running in VirtualBox][15] - -The default username in Kali Linux is root and the default password is toor. You should be able to login to the system with it. - -Do note that you should [update Kali Linux][16] before trying to install a new applications or trying to hack your neighbor’s WiFi. - -I hope this guide helps you easily install Kali Linux on Virtual Box. Of course, Kali Linux has a lot of useful tools in it for penetration testing – good luck with that! - -**Tip** : Both Kali Linux and Ubuntu are Debian-based. If you face any issues or error with Kali Linux, you may follow the tutorials intended for Ubuntu or Debian on the internet. - -### Bonus: Free Kali Linux Guide Book - -If you are just starting with Kali Linux, it will be a good idea to know how to use Kali Linux. - -Offensive Security, the company behind Kali Linux, has created a guide book that explains the basics of Linux, basics of Kali Linux, configuration, setups. It also has a few chapters on penetration testing and security tools. - -Basically, it has everything you need to get started with Kali Linux. And the best thing is that the book is available to download for free. - -[Download Kali Linux Revealed for FREE][17] - -Let us know in the comments below if you face an issue or simply share your experience with Kali Linux on VirtualBox. - --------------------------------------------------------------------------------- - -via: https://itsfoss.com/install-kali-linux-virtualbox/ - -作者:[Ankush Das][a] -选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]: https://itsfoss.com/author/ankush/ -[b]: https://github.com/lujun9972 -[1]: https://www.kali.org/ -[2]: https://itsfoss.com/linux-hacking-penetration-testing/ -[3]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/02/kali-linux-virtual-box.png?resize=800%2C450&ssl=1 -[4]: https://www.virtualbox.org/ -[5]: https://www.youtube.com/c/itsfoss?sub_confirmation=1 -[6]: https://www.virtualbox.org/wiki/Downloads -[7]: https://itsfoss.com/install-virtualbox-ubuntu/ -[8]: https://www.offensive-security.com/kali-linux-vm-vmware-virtualbox-image-download/ -[9]: https://itsfoss.com/install-vmware-player-ubuntu-1310/ -[10]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/02/kali-linux-virtual-box-image.jpg?resize=800%2C347&ssl=1 -[11]: https://itsfoss.com/4-best-download-managers-for-linux/ -[12]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/02/vmbox-import-kali-linux.jpg?ssl=1 -[13]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/02/vmbox-linux-next.jpg?ssl=1 -[14]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/02/vmbox-kali-linux-settings.jpg?ssl=1 -[15]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/02/kali-linux-on-windows-virtualbox.jpg?resize=800%2C429&ssl=1 -[16]: https://linuxhandbook.com/update-kali-linux/ -[17]: https://kali.training/downloads/Kali-Linux-Revealed-1st-edition.pdf diff --git a/sources/tech/20190212 Top 10 Best Linux Media Server Software.md b/sources/tech/20190212 Top 10 Best Linux Media Server Software.md index 8fcea6343a..79b9dcb3bc 100644 --- a/sources/tech/20190212 Top 10 Best Linux Media Server Software.md +++ b/sources/tech/20190212 Top 10 Best Linux Media Server Software.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: ( ) +[#]: translator: (kodark) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) diff --git a/sources/tech/20190213 How to build a WiFi picture frame with a Raspberry Pi.md b/sources/tech/20190213 How to build a WiFi picture frame with a Raspberry Pi.md deleted file mode 100644 index 615f7620ed..0000000000 --- a/sources/tech/20190213 How to build a WiFi picture frame with a Raspberry Pi.md +++ /dev/null @@ -1,135 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: ( ) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (How to build a WiFi picture frame with a Raspberry Pi) -[#]: via: (https://opensource.com/article/19/2/wifi-picture-frame-raspberry-pi) -[#]: author: (Manuel Dewald https://opensource.com/users/ntlx) - -How to build a WiFi picture frame with a Raspberry Pi -====== -DIY a digital photo frame that streams photos from the cloud. - -![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/raspberrypi_board_vector_red.png?itok=yaqYjYqI) - -Digital picture frames are really nice because they let you enjoy your photos without having to print them out. Plus, adding and removing digital files is a lot easier than opening a traditional frame and swapping the picture inside when you want to display a new photo. Even so, it's still a bit of overhead to remove your SD card, USB stick, or other storage from a digital picture frame, plug it into your computer, and copy new pictures onto it. - -An easier option is a digital picture frame that gets its pictures over WiFi, for example from a cloud service. Here's how to make one. - -### Gather your materials - - * Old [TFT][1] LCD screen - * HDMI-to-DVI cable (as the TFT screen supports DVI) - * Raspberry Pi 3 - * Micro SD card - * Raspberry Pi power supply - * Keyboard - * Mouse (optional) - - - -Connect the Raspberry Pi to the display using the cable and attach the power supply. - -### Install Raspbian - -**sudo raspi-config**. There I change the hostname (e.g., to **picframe** ) in Network Options and enable SSH to work remotely on the Raspberry Pi in Interfacing Options. Connect to the Raspberry Pi using (for example) . - -### Build and install the cloud client - -Download and flash Raspbian to the Micro SD card by following these [directions][2] . Plug the Micro SD card into the Raspberry Pi, boot it up, and configure your WiFi. My first action after a new Raspbian installation is usually running. There I change the hostname (e.g., to) in Network Options and enable SSH to work remotely on the Raspberry Pi in Interfacing Options. Connect to the Raspberry Pi using (for example) - -I use [Nextcloud][3] to synchronize my pictures, but you could use NFS, [Dropbox][4], or whatever else fits your needs to upload pictures to the frame. - -If you use Nextcloud, get a client for Raspbian by following these [instructions][5]. This is handy for placing new pictures on your picture frame and will give you the client application you may be familiar with on a desktop PC. When connecting the client application to your Nextcloud server, make sure to select only the folder where you'll store the images you want to be displayed on the picture frame. - -### Set up the slideshow - -The easiest way I've found to set up the slideshow is with a [lightweight slideshow project][6] built for exactly this purpose. There are some alternatives, like configuring a screensaver, but this application appears to be the simplest to set up. - -On your Raspberry Pi, download the binaries from the latest release, unpack them, and move them to an executable folder: - -``` -wget https://github.com/NautiluX/slide/releases/download/v0.9.0/slide_pi_stretch_0.9.0.tar.gz -tar xf slide_pi_stretch_0.9.0.tar.gz -mv slide_0.9.0/slide /usr/local/bin/ -``` - -Install the dependencies: - -``` -sudo apt install libexif12 qt5-default -``` - -Run the slideshow by executing the command below (don't forget to modify the path to your images). If you access your Raspberry Pi via SSH, set the **DISPLAY** variable to start the slideshow on the display attached to the Raspberry Pi. - -``` -DISPLAY=:0.0 slide -p /home/pi/nextcloud/picframe -``` - -### Autostart the slideshow - -To autostart the slideshow on Raspbian Stretch, create the following folder and add an **autostart** file to it: - -``` -mkdir -p /home/pi/.config/lxsession/LXDE/ -vi /home/pi/.config/lxsession/LXDE/autostart -``` - -Insert the following commands to autostart your slideshow. The **slide** command can be adjusted to your needs: - -``` -@xset s noblank -@xset s off -@xset -dpms -@slide -p -t 60 -o 200 -p /home/pi/nextcloud/picframe -``` - -Disable screen blanking, which the Raspberry Pi normally does after 10 minutes, by editing the following file: - -``` -vi /etc/lightdm/lightdm.conf -``` - -and adding these two lines to the end: - -``` -[SeatDefaults] -xserver-command=X -s 0 -dpms -``` - -### Configure a power-on schedule - -You can schedule your picture frame to turn on and off at specific times by using two simple cronjobs. For example, say you want it to turn on automatically at 7 am and turn off at 11 pm. Run **crontab -e** and insert the following two lines. - -``` -0 23 * * * /opt/vc/bin/tvservice -o - -0 7 * * * /opt/vc/bin/tvservice -p && sudo systemctl restart display-manager -``` - -Note that this won't turn the Raspberry Pi power's on and off; it will just turn off HDMI, which will turn the screen off. The first line will power off HDMI at 11 pm. The second line will bring the display back up and restart the display manager at 7 am. - -### Add a final touch - -By following these simple steps, you can create your own WiFi picture frame. If you want to give it a nicer look, build a wooden frame for the display. - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/19/2/wifi-picture-frame-raspberry-pi - -作者:[Manuel Dewald][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/ntlx -[b]: https://github.com/lujun9972 -[1]: https://en.wikipedia.org/wiki/Thin-film-transistor_liquid-crystal_display -[2]: https://www.raspberrypi.org/documentation/installation/installing-images/README.md -[3]: https://nextcloud.com/ -[4]: http://dropbox.com/ -[5]: https://github.com/nextcloud/client_theming#building-on-debian -[6]: https://github.com/NautiluX/slide/releases/tag/v0.9.0 diff --git a/sources/tech/20190218 Talk, then code.md b/sources/tech/20190218 Talk, then code.md deleted file mode 100644 index 18ed81e43c..0000000000 --- a/sources/tech/20190218 Talk, then code.md +++ /dev/null @@ -1,64 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: ( ) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Talk, then code) -[#]: via: (https://dave.cheney.net/2019/02/18/talk-then-code) -[#]: author: (Dave Cheney https://dave.cheney.net/author/davecheney) - -Talk, then code -====== - -The open source projects that I contribute to follow a philosophy which I describe as _talk, then code_. I think this is generally a good way to develop software and I want to spend a little time talking about the benefits of this methodology. - -### Avoiding hurt feelings - -The most important reason for discussing the change you want to make is it avoids hurt feelings. Often I see a contributor work hard in isolation on a pull request only to find their work is rejected. This can be for a bunch of reasons; the PR is too large, the PR doesn’t follow the local style, the PR fixes an issue which wasn’t important to the project or was recently fixed indirectly, and many more. - -The underlying cause of all these issues is a lack of communication. The goal of the _talk, then code_ philosophy is not to impede or frustrate, but to ensure that a feature lands correctly the first time, without incurring significant maintenance debt, and neither the author of the change, or the reviewer, has to carry the emotional burden of dealing with hurt feelings when a change appears out of the blue with an implicit “well, I’ve done the work, all you have to do is merge it, right?” - -### What does discussion look like? - -Every new feature or bug fix should be discussed with the maintainer(s) of the project before work commences. It’s fine to experiment privately, but do not send a change without discussing it first. - -The definition of _talk_ for simple changes can be as little as a design sketch in a GitHub issue. If your PR fixes a bug, you should link to the bug it fixes. If there isn’t one, you should raise a bug and wait for the maintainers to acknowledge it before sending a PR. This might seem a little backward–who wouldn’t want a bug fixed–but consider the bug could be a misunderstanding in how the software works or it could be a symptom of a larger problem that needs further investigation. - -For more complicated changes, especially feature requests, I recommend that a design document be circulated and agreed upon before sending code. This doesn’t have to be a full blown document, a sketch in an issue may be sufficient, but the key is to reach agreement using words, before locking it in stone with code. - -In all cases you shouldn’t proceed to send code until there is a positive agreement from the maintainer that the approach is one they are happy with. A pull request is for life, not just for Christmas. - -### Code review, not design by committee - -A code review is not the place for arguments about design. This is for two reasons. First, most code review tools are not suitable for long comment threads, GitHub’s PR interface is very bad at this, Gerrit is better, but few have a team of admins to maintain a Gerrit instance. More importantly, disagreements at the code review stage suggests there wasn’t agreement on how the change should be implemented. - -* * * - -Talk about what you want to code, then code what you talked about. Please don’t do it the other way around. - -### Related posts: - - 1. [How to include C code in your Go package][1] - 2. [Let’s talk about logging][2] - 3. [The value of TDD][3] - 4. [Suggestions for contributing to an Open Source project][4] - - - --------------------------------------------------------------------------------- - -via: https://dave.cheney.net/2019/02/18/talk-then-code - -作者:[Dave Cheney][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://dave.cheney.net/author/davecheney -[b]: https://github.com/lujun9972 -[1]: https://dave.cheney.net/2013/09/07/how-to-include-c-code-in-your-go-package (How to include C code in your Go package) -[2]: https://dave.cheney.net/2015/11/05/lets-talk-about-logging (Let’s talk about logging) -[3]: https://dave.cheney.net/2016/04/11/the-value-of-tdd (The value of TDD) -[4]: https://dave.cheney.net/2016/03/12/suggestions-for-contributing-to-an-open-source-project (Suggestions for contributing to an Open Source project) diff --git a/sources/tech/20190402 When Wi-Fi is mission-critical, a mixed-channel architecture is the best option.md b/sources/tech/20190402 When Wi-Fi is mission-critical, a mixed-channel architecture is the best option.md deleted file mode 100644 index 29a73998d7..0000000000 --- a/sources/tech/20190402 When Wi-Fi is mission-critical, a mixed-channel architecture is the best option.md +++ /dev/null @@ -1,90 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: ( ) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (When Wi-Fi is mission-critical, a mixed-channel architecture is the best option) -[#]: via: (https://www.networkworld.com/article/3386376/when-wi-fi-is-mission-critical-a-mixed-channel-architecture-is-the-best-option.html#tk.rss_all) -[#]: author: (Zeus Kerravala https://www.networkworld.com/author/Zeus-Kerravala/) - -When Wi-Fi is mission-critical, a mixed-channel architecture is the best option -====== - -### Multi-channel is the norm for Wi-Fi today, but it’s not always the best choice. Single-channel and hybrid APs offer compelling alternatives when reliable Wi-Fi is a must. - -![Getty Images][1] - -I’ve worked with a number of companies that have implemented digital projects only to see them fail. The ideation was correct, the implementation was sound, and the market opportunity was there. The weak link? The Wi-Fi network. - -For example, a large hospital wanted to improve clinician response times to patient alarms by having telemetry information sent to mobile devices. Without the system, the only way a nurse would know about a patient alarm is from an audible alert. And with all the background noise, it’s often tough to discern where noises are coming from. The problem was the Wi-Fi network in the hospital had not been upgraded in years and caused messages to be significantly delayed in their delivery, often taking four to five minutes to deliver. The long delivery times caused a lack of confidence in the system, so many clinicians stopped using it and went back to manual alerting. As a result, the project was considered a failure. - -I’ve seen similar examples in manufacturing, K-12 education, entertainment, and other industries. Businesses are competing on the basis of customer experience, and that’s driven from the ever-expanding, ubiquitous wireless edge. Great Wi-Fi doesn’t necessarily mean market leadership, but bad Wi-Fi will have a negative impact on customers and employees. And in today’s competitive climate, that’s a recipe for disaster. - -**[ Read also:[Wi-Fi site-survey tips: How to avoid interference, dead spots][2] ]** - -## Wi-Fi performance historically inconsistent - -The problem with Wi-Fi is that it’s inherently flaky. I’m sure everyone reading this has experienced the typical flaws with failed downloads, dropped connections, inconsistent performance, and lengthy wait times to connect to public hot spots. - -Picture sitting in a conference prior to a keynote address and being able to tweet, send email, browse the web, and do other things with no problem. Then the keynote speaker comes on stage and the entire audiences start snapping pics, uploading those pictures, and streaming things – and the Wi-Fi stops working. I find this to be the norm more than the exception, underscoring the need for [no-compromise Wi-Fi][3]. - -The question for network professionals is how to get to a place where the Wi-Fi is rock solid 100% of the time. Some say that just beefing up the existing network will do that, and it might, but in some cases, the type of Wi-Fi might not be appropriate. - -The most commonly deployed type of Wi-Fi is multi-channel, also known as micro-cell, where each client connects to the access point (AP) using a radio channel. A high-quality experience is based on two things: good signal strength and minimal interference. Several things can cause interference, such as APs being too close, layout issues, or interference from other equipment. To minimize interference, businesses invest a significant amount of time and money in [site surveys to plan the optimal channel map][2], but even with that’s done well, Wi-Fi glitches can still happen. - -**[[Take this mobile device management course from PluralSight and learn how to secure devices in your company without degrading the user experience.][4] ]** - -## Multi-channel Wi-Fi not always the best choice - -For many carpeted offices, multi-channel Wi-Fi is likely to be solid, but there are some environments where external circumstances will impact performance. A good example of this is a multi-tenant building in which there are multiple Wi-Fi networks transmitting on the same channel and interfering with one another. Another example is a hospital where there are many campus workers moving between APs. The client will also try to connect to the best AP, causing the client to continually disconnect and reconnect resulting in dropped sessions. Then there are environments such as schools, airports, and conference facilities where there is a high number of transient devices and multi-channel can struggle to keep up. - -## Single channel Wi-Fi offers better reliability but with a performance hit - -What’s a network manager to do? Is inconsistent Wi-Fi just a fait accompli? Multi-channel is the norm, but it isn’t designed for dynamic physical environments or those where reliable connectivity is a must. - -Several years ago an alternative architecture was proposed that would solve these problems. As the name suggests, “single channel” Wi-Fi uses a single radio channel for all APs in the network. Think of this as being a single Wi-Fi fabric that operates on one channel. With this architecture, the placement of APs is irrelevant because they all utilize the same channel, so they won’t interfere with one another. This has an obvious simplicity advantage, such as if coverage is poor, there’s no reason to do another expensive site survey. Instead, just drop in APs where they are needed. - -One of the disadvantages of single-channel is that aggregate network throughput was lower than multi-channel because only one channel can be used. This might be fine in environments where reliability trumps performance, but many organizations want both. - -## Hybrid APs offer the best of both worlds - -There has been recent innovation from the manufacturers of single-channel systems that mix channel architectures, creating a “best of both worlds” deployment that offers the throughput of multi-channel with the reliability of single-channel. For example, Allied Telesis offers Hybrid APs that can operate in multi-channel and single-channel mode simultaneously. That means some web clients can be assigned to the multi-channel to have maximum throughput, while others can use single-channel for seamless roaming experience. - -A practical use-case of such a mix might be a logistics facility where the office staff uses multi-channel, but the fork-lift operators use single-channel for continuous connectivity as they move throughout the warehouse. - -Wi-Fi was once a network of convenience, but now it is perhaps the most mission-critical of all networks. A traditional multi-channel system might work, but due diligence should be done to see how it functions under a heavy load. IT leaders need to understand how important Wi-Fi is to digital transformation initiatives and do the proper testing to ensure it’s not the weak link in the infrastructure chain and choose the best technology for today’s environment. - -**Reviews: 4 free, open-source network monitoring tools:** - - * [Icinga: Enterprise-grade, open-source network-monitoring that scales][5] - * [Nagios Core: Network-monitoring software with lots of plugins, steep learning curve][6] - * [Observium open-source network monitoring tool: Won’t run on Windows but has a great user interface][7] - * [Zabbix delivers effective no-frills network monitoring][8] - - - -Join the Network World communities on [Facebook][9] and [LinkedIn][10] to comment on topics that are top of mind. - --------------------------------------------------------------------------------- - -via: https://www.networkworld.com/article/3386376/when-wi-fi-is-mission-critical-a-mixed-channel-architecture-is-the-best-option.html#tk.rss_all - -作者:[Zeus Kerravala][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.networkworld.com/author/Zeus-Kerravala/ -[b]: https://github.com/lujun9972 -[1]: https://images.idgesg.net/images/article/2018/09/tablet_graph_wifi_analytics-100771638-large.jpg -[2]: https://www.networkworld.com/article/3315269/wi-fi-site-survey-tips-how-to-avoid-interference-dead-spots.html -[3]: https://www.alliedtelesis.com/blog/no-compromise-wi-fi -[4]: https://pluralsight.pxf.io/c/321564/424552/7490?u=https%3A%2F%2Fwww.pluralsight.com%2Fcourses%2Fmobile-device-management-big-picture -[5]: https://www.networkworld.com/article/3273439/review-icinga-enterprise-grade-open-source-network-monitoring-that-scales.html?nsdr=true#nww-fsb -[6]: https://www.networkworld.com/article/3304307/nagios-core-monitoring-software-lots-of-plugins-steep-learning-curve.html -[7]: https://www.networkworld.com/article/3269279/review-observium-open-source-network-monitoring-won-t-run-on-windows-but-has-a-great-user-interface.html?nsdr=true#nww-fsb -[8]: https://www.networkworld.com/article/3304253/zabbix-delivers-effective-no-frills-network-monitoring.html -[9]: https://www.facebook.com/NetworkWorld/ -[10]: https://www.linkedin.com/company/network-world diff --git a/sources/tech/20190422 9 ways to save the planet.md b/sources/tech/20190422 9 ways to save the planet.md deleted file mode 100644 index d3301006cc..0000000000 --- a/sources/tech/20190422 9 ways to save the planet.md +++ /dev/null @@ -1,96 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: ( ) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (9 ways to save the planet) -[#]: via: (https://opensource.com/article/19/4/save-planet) -[#]: author: (Jen Wike Huger https://opensource.com/users/jen-wike/users/alanfdoss/users/jmpearce) - -9 ways to save the planet -====== -These ideas have an open source twist. -![][1] - -What can be done to help save the planet? The question can seem depressing at a time when it feels like an individual's contribution isn't enough. But, who are we Earth dwellers if not for a collection of individuals? So, I asked our writer community to share ways that open source software or hardware can be used to make a difference. Here's what I heard back. - -### 9 ways to save the planet with an open source twist - -**1.** **Disable the blinking cursor in your terminal.** - -It might sound silly, but the trivial, blinking cursor can cause up to [2 watts per hour of extra power consumption][2]. To disable it, go to Terminal Settings: Edit > Preferences > Cursor > Cursor blinking > Disabled. - -_Recommended by Mars Toktonaliev_ - -**2\. Reduce your consumption of animal products and processed foods.** - -One way to do this is to add these open source apps to your phone: Daily Dozen, OpenFoodFacts, OpenVegeMap, and Food Restrictions. These apps will help you eat a healthy, plant-based diet, find vegan- and vegetarian-friendly restaurants, and communicate your dietary needs to others, even if they do not speak the same language. To learn more about these apps read [_4 open source apps to support eating a plant-based diet_][3]. - -_Recommendation by Joshua Allen Holm_ - -**3\. Recycle old computers.** - -How? With Linux, of course. Pay it forward by giving creating a new computer for someone who can't one and keep a computer out of the landfill. Here's how we do it at [The Asian Penguins][4]. - -_Recommendation by Stu Keroff_ - -**4\. Turn off devices when you're not using them.** - -Use "smart power strips" that have a "master" outlet and several "controlled" outlets. Plug your PC into the master outlet, and when you turn on the computer, your monitor, printer, and anything else plugged into the controlled outlets turns on too. A simpler, low-tech solution is a power strip with a timer. That's what I use at home. You can use switches on the timer to set a handy schedule to turn the power on and off at specific times. Automatically turn off your network printer when no one is at home. Or for my six-year-old laptop, extend the life of the battery with a schedule to alternate when it's running from wall power (outlet is on) and when it's running from the battery (outlet is off). - -_Recommended by Jim Hall_ - -**5\. Reduce the use of your HVAC system.** - -Sunlight shining through windows adds a lot of heat to your home during the summer. Use Home Assistant to [automatically adjust][5] window blinds and awnings [based on the time of day][6], or even based on the angle of the sun. - -_Recommended by Michael Hrivnak_ - -**6\. Turn your thermostat off or to a lower setting while you're away.** - -If your home thermostat has an "Away" feature, activating it on your way out the door is easy to forget. With a touch of automation, any connected thermostat can begin automatically saving energy while you're not home. [Stataway][7] is one such project that uses your phone's GPS coordinates to determine when it should set your thermostat to "Home" or "Away". - -_Recommended by Michael Hrivnak_ - -**7\. Save computing power for later.** - -I have an idea: Create a script that can read the power output from an alternative energy array (wind and solar) and begin turning on servers (taking them from a power-saving sleep mode to an active mode) in a computing cluster until the overload power is used (whatever excess is produced beyond what can be stored/buffered for later use). Then use the overload power during high-production times for compute-intensive projects like rendering. This process would be essentially free of cost because the power can't be buffered for other uses. I'm sure the monitoring, power management, and server array tools must exist to do this. Then, it's just an integration problem, making it all work together. - -_Recommended by Terry Hancock_ - -**8\. Turn off exterior lights.** - -Light pollution affects more than 80% of the world's population, according to the [World Atlas of Artificial Night Sky Brightness][8], published (Creative Commons Attribution-NonCommercial 4.0) in 2016 in the open access journal _Science Advances_. Turning off exterior lights is a quick way to benefit wildlife, human health, our ability to enjoy the night sky, and of course energy consumption. Visit [darksky.org][9] for more ideas on how to reduce the impact of your exterior lighting. - -_Recommended by Michael Hrivnak_ - -**9\. Reduce your CPU count.** - -For me, I remember I used to have a whole bunch of computers running in my basement as my IT playground/lab. I've become more conscious now of power consumption and so have really drastically reduced my CPU count. I like to take advantage of VMs, zones, containers... that type of technology a lot more these days. Also, I'm really glad that small form factor and SoC computers, such as the Raspberry Pi, exist because I can do a lot with one, such as run a DNS or Web server, without heating the room and running up my electricity bill. - -P.S. All of these computers are running Linux, FreeBSD, or Raspbian! - -_Recommended by Alan Formy-Duvall_ - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/19/4/save-planet - -作者:[Jen Wike Huger ][a] -选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]: https://opensource.com/users/jen-wike/users/alanfdoss/users/jmpearce -[b]: https://github.com/lujun9972 -[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/pixelated-world.png?itok=fHjM6m53 -[2]: https://www.redhat.com/archives/fedora-devel-list/2009-January/msg02406.html -[3]: https://opensource.com/article/19/4/apps-plant-based-diets -[4]: https://opensource.com/article/19/2/asian-penguins-close-digital-divide -[5]: https://www.home-assistant.io/docs/automation/trigger/#sun-trigger -[6]: https://www.home-assistant.io/components/cover/ -[7]: https://github.com/mhrivnak/stataway -[8]: http://advances.sciencemag.org/content/2/6/e1600377 -[9]: http://darksky.org/ diff --git a/sources/tech/20190501 Monitor and Manage Docker Containers with Portainer.io (GUI tool) - Part-1.md b/sources/tech/20190501 Monitor and Manage Docker Containers with Portainer.io (GUI tool) - Part-1.md deleted file mode 100644 index 27bf04eb05..0000000000 --- a/sources/tech/20190501 Monitor and Manage Docker Containers with Portainer.io (GUI tool) - Part-1.md +++ /dev/null @@ -1,247 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: ( ) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Monitor and Manage Docker Containers with Portainer.io (GUI tool) – Part-1) -[#]: via: (https://www.linuxtechi.com/monitor-manage-docker-containers-portainer-part1/) -[#]: author: (Shashidhar Soppin https://www.linuxtechi.com/author/shashidhar/) - -Monitor and Manage Docker Containers with Portainer.io (GUI tool) – Part-1 -====== - -As **Docker** usage and adoption is growing faster and faster, monitoring **Docker container** images is becoming more challenging. As multiple Docker container images are getting created day-by-day, monitoring them is very important. There are already some in built tools and technologies, but configuring them is little complex. As micro-services based architecture is becoming the de-facto standard in coming days, learning such tool adds one more arsenal to your tool-set. - -Based on the above scenarios, there was in need of one light weight and robust tool requirement was growing. So Portainer.io addressed this. “ **Portainer.io** “,(Latest version is 1.20.2) the tool is very light weight(with 2-3 commands only one can configure it) and has become popular among Docker users. - -**This tool has advantages over other tools; some of these are as below** , - - * Light weight (requires only 2-3 commands to be required to run to install this tool) {Also installation image is only around 26-30MB of size) - * Robust and easy to use - * Can be used for Docker monitor and Build - * This tool provides us a detailed overview of your Docker environments - * This tool allows us to manage your containers, images, networks and volumes. - * Portainer is simple to deploy – this requires just one Docker command (can be run from anywhere.) - * Complete Docker-container environment can be monitored easily - - - -**Portainer is also equipped with** , - - * Community support - * Enterprise support - * Has professional services available(along with partner OEM services) - - - -**Functionality and features of Portainer tool are,** - - 1. It comes-up with nice Dashboard, easy to use and monitor. - 2. Many in-built templates for ease of operation and creation - 3. Support of services (OEM, Enterprise level) - 4. Monitoring of Containers, Images, Networks, Volume and configuration at almost real-time. - 5. Also includes Docker-Swarm monitoring - 6. User management with many fancy capabilities - - - -**Read Also :[How to Install Docker CE on Ubuntu 16.04 / 18.04 LTS System][1]** - -### How to install and configure Portainer.io on Ubuntu Linux / RHEL / CentOS - -**Note:** This installation is done on Ubuntu 18.04 but the installation on RHEL & CentOS would be same. We are assuming Docker CE is already installed on your system. - -``` -root@linuxtechi:~$ lsb_release -a -No LSB modules are available. -Distributor ID: Ubuntu -Description: Ubuntu 18.04 LTS -Release: 18.04 -Codename: bionic -root@linuxtechi:~$ -``` - -Create the Volume for portainer - -``` -root@linuxtechi:~$ sudo docker volume create portainer_data -portainer_data -root@linuxtechi:~$ -``` - -Launch and start Portainer Container using the beneath docker command, - -``` -root@linuxtechi:~$ sudo docker run -d -p 9000:9000 -v /var/run/docker.sock:/var/run/docker.sock -v portainer_data:/data portainer/portainer -Unable to find image 'portainer/portainer:latest' locally -latest: Pulling from portainer/portainer -d1e017099d17: Pull complete -0b1e707a06d2: Pull complete -Digest: sha256:d6cc2c20c0af38d8d557ab994c419c799a10fe825e4aa57fea2e2e507a13747d -Status: Downloaded newer image for portainer/portainer:latest -35286de9f2e21d197309575bb52b5599fec24d4f373cc27210d98abc60244107 -root@linuxtechi:~$ -``` - -Once the complete installation is done, use the ip of host or Docker using port 9000 of the Docker engine where portainer is running using your browser. - -**Note:** If OS firewall is enabled on your Docker host then make sure 9000 port is allowed else its GUI will not come up. - -In my case, IP address of my Docker Host / Engine is “192.168.1.16” so URL will be, - - - -[![Portainer-Login-User-Name-Password][2]][3] - -Please make sure that you enter 8-character passwords. Let the admin be the user as it is and then click “Create user”. - -Now the following screen appears, in this select “Local” rectangle box. - -[![Connect-Portainer-Local-Docker][4]][5] - -Click on “Connect” - -Nice GUI with admin as user home screen appears as below, - -[![Portainer-io-Docker-Monitor-Dashboard][6]][7] - -Now Portainer is ready to launch and manage your Docker containers and it can also be used for containers monitoring. - -### Bring-up container image on Portainer tool - -[![Portainer-Endpoints][8]][9] - -Now check the present status, there are two container images are already running, if you create one more that appears instantly. - -From your command line kick-start one or two containers as below, - -``` -root@linuxtechi:~$ sudo docker run --name test -it debian -Unable to find image 'debian:latest' locally -latest: Pulling from library/debian -e79bb959ec00: Pull complete -Digest: sha256:724b0fbbda7fda6372ffed586670573c59e07a48c86d606bab05db118abe0ef5 -Status: Downloaded newer image for debian:latest -root@linuxtechi:/# -``` - -Now click Refresh button (Are you sure message appears, click “continue” on this) in Portainer GUI, you will now see 3 container images as highlighted below, - -[![Portainer-io-new-container-image][10]][11] - -Click on the “ **containers** ” (in which it is red circled above), next window appears with “ **Dashboard Endpoint summary** ” - -[![Portainer-io-Docker-Container-Dash][12]][13] - -In this page, click on “ **Containers** ” as highlighted in red color. Now you are ready to monitor your container image. - -### Simple Docker container image monitoring - -From the above step, it appears that a fancy and nice looking “Container List” page appears as below, - -[![Portainer-Container-List][14]][15] - -All the container images can be controlled from here (stop, start, etc) - -**1)** Now from this page, stop the earlier started {“test” container (this was the debian image that we started earlier)} - -To do this select the check box in front of this image and click stop button from above, - -[![Stop-Container-Portainer-io-dashboard][16]][17] - -From the command line option, you will see that this image has been stopped or exited now, - -``` -root@linuxtechi:~$ sudo docker container ls -a -CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES -d45902e717c0 debian "bash" 21 minutes ago Exited (0) 49 seconds ago test -08b96eddbae9 centos:7 "/bin/bash" About an hour ago Exited (137) 9 minutes ago mycontainer2 -35286de9f2e2 portainer/portainer "/portainer" 2 hours ago Up About an hour 0.0.0.0:9000->9000/tcp compassionate_benz -root@linuxtechi:~$ -``` - -**2)** Now start the stopped containers (test & mycontainer2) from Portainer GUI, - -Select the check box in front of stopped containers, and the click on Start - -[![Start-Containers-Portainer-GUI][18]][19] - -You will get a quick window saying, “ **Container successfully started** ” and with running state - -[![Conatiner-Started-successfully-Portainer-GUI][20]][21] - -### Various other options and features are explored as below step-by-step - -**1)** Click on “ **Images** ” which is highlighted, you will get the below window, - -[![Docker-Container-Images-Portainer-GUI][22]][23] - -This is the list of container images that are available but some may not running. These images can be imported, exported or uploaded to various locations, below screen shot shows the same, - -[![Upload-Docker-Container-Image-Portainer-GUI][24]][25] - -**2)** Click on “ **volumes”** which is highlighted, you will get the below window, - -[![Volume-list-Portainer-io-gui][26]][27] - -**3)** Volumes can be added easily with following option, click on add volume button, below window appears, - -Provide the name as “ **myvol** ” in the name box and click on “ **create the volume** ” button. - -[![Volume-Creation-Portainer-io-gui][28]][29] - -The newly created volume appears as below, (with unused state) - -[![Volume-unused-Portainer-io-gui][30]][31] - -#### Conclusion: - -As from the above installation steps, configuration and playing around with various options you can see how easy and fancy looking is Portainer.io tool is. This provides multiple features and options to explore on building, monitoring docker container. As explained this is very light weight tool, so doesn’t add any overload to host system. Next set-of options will be explored in part-2 of this series. - -Read Also: **[Monitor and Manage Docker Containers with Portainer.io (GUI tool) – Part-2][32]** - --------------------------------------------------------------------------------- - -via: https://www.linuxtechi.com/monitor-manage-docker-containers-portainer-part1/ - -作者:[Shashidhar Soppin][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.linuxtechi.com/author/shashidhar/ -[b]: https://github.com/lujun9972 -[1]: https://www.linuxtechi.com/how-to-setup-docker-on-ubuntu-server-16-04/ -[2]: https://www.linuxtechi.com/wp-content/uploads/2019/05/Portainer-Login-User-Name-Password-1024x681.jpg -[3]: https://www.linuxtechi.com/wp-content/uploads/2019/05/Portainer-Login-User-Name-Password.jpg -[4]: https://www.linuxtechi.com/wp-content/uploads/2019/05/Connect-Portainer-Local-Docker-1024x538.jpg -[5]: https://www.linuxtechi.com/wp-content/uploads/2019/05/Connect-Portainer-Local-Docker.jpg -[6]: https://www.linuxtechi.com/wp-content/uploads/2019/05/Portainer-io-Docker-Monitor-Dashboard-1024x544.jpg -[7]: https://www.linuxtechi.com/wp-content/uploads/2019/05/Portainer-io-Docker-Monitor-Dashboard.jpg -[8]: https://www.linuxtechi.com/wp-content/uploads/2019/05/Portainer-Endpoints-1024x252.jpg -[9]: https://www.linuxtechi.com/wp-content/uploads/2019/05/Portainer-Endpoints.jpg -[10]: https://www.linuxtechi.com/wp-content/uploads/2019/05/Portainer-io-new-container-image-1024x544.jpg -[11]: https://www.linuxtechi.com/wp-content/uploads/2019/05/Portainer-io-new-container-image.jpg -[12]: https://www.linuxtechi.com/wp-content/uploads/2019/05/Portainer-io-Docker-Container-Dash-1024x544.jpg -[13]: https://www.linuxtechi.com/wp-content/uploads/2019/05/Portainer-io-Docker-Container-Dash.jpg -[14]: https://www.linuxtechi.com/wp-content/uploads/2019/05/Portainer-Container-List-1024x538.jpg -[15]: https://www.linuxtechi.com/wp-content/uploads/2019/05/Portainer-Container-List.jpg -[16]: https://www.linuxtechi.com/wp-content/uploads/2019/05/Stop-Container-Portainer-io-dashboard-1024x447.jpg -[17]: https://www.linuxtechi.com/wp-content/uploads/2019/05/Stop-Container-Portainer-io-dashboard.jpg -[18]: https://www.linuxtechi.com/wp-content/uploads/2019/05/Start-Containers-Portainer-GUI-1024x449.jpg -[19]: https://www.linuxtechi.com/wp-content/uploads/2019/05/Start-Containers-Portainer-GUI.jpg -[20]: https://www.linuxtechi.com/wp-content/uploads/2019/05/Conatiner-Started-successfully-Portainer-GUI-1024x538.jpg -[21]: https://www.linuxtechi.com/wp-content/uploads/2019/05/Conatiner-Started-successfully-Portainer-GUI.jpg -[22]: https://www.linuxtechi.com/wp-content/uploads/2019/05/Docker-Container-Images-Portainer-GUI-1024x544.jpg -[23]: https://www.linuxtechi.com/wp-content/uploads/2019/05/Docker-Container-Images-Portainer-GUI.jpg -[24]: https://www.linuxtechi.com/wp-content/uploads/2019/05/Upload-Docker-Container-Image-Portainer-GUI-1024x544.jpg -[25]: https://www.linuxtechi.com/wp-content/uploads/2019/05/Upload-Docker-Container-Image-Portainer-GUI.jpg -[26]: https://www.linuxtechi.com/wp-content/uploads/2019/05/Volume-list-Portainer-io-gui-1024x544.jpg -[27]: https://www.linuxtechi.com/wp-content/uploads/2019/05/Volume-list-Portainer-io-gui.jpg -[28]: https://www.linuxtechi.com/wp-content/uploads/2019/05/Volume-Creation-Portainer-io-gui-1024x544.jpg -[29]: https://www.linuxtechi.com/wp-content/uploads/2019/05/Volume-Creation-Portainer-io-gui.jpg -[30]: https://www.linuxtechi.com/wp-content/uploads/2019/05/Volume-unused-Portainer-io-gui-1024x544.jpg -[31]: https://www.linuxtechi.com/wp-content/uploads/2019/05/Volume-unused-Portainer-io-gui.jpg -[32]: https://www.linuxtechi.com/monitor-manage-docker-containers-portainer-io-part-2/ diff --git a/sources/tech/20190503 Mirror your System Drive using Software RAID.md b/sources/tech/20190503 Mirror your System Drive using Software RAID.md index e72f3a5722..ba62a2f21a 100644 --- a/sources/tech/20190503 Mirror your System Drive using Software RAID.md +++ b/sources/tech/20190503 Mirror your System Drive using Software RAID.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: (lixin555) +[#]: translator: ( ) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) diff --git a/sources/tech/20190510 Learn to change history with git rebase.md b/sources/tech/20190510 Learn to change history with git rebase.md deleted file mode 100644 index 4d46fef81f..0000000000 --- a/sources/tech/20190510 Learn to change history with git rebase.md +++ /dev/null @@ -1,597 +0,0 @@ -Translating by Scoutydren.... - - -[#]: collector: (lujun9972) -[#]: translator: (Scoutydren) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Learn to change history with git rebase!) -[#]: via: (https://git-rebase.io/) -[#]: author: (git-rebase https://git-rebase.io/) - -Learn to change history with git rebase! -====== -One of Git 's core value-adds is the ability to edit history. Unlike version control systems that treat the history as a sacred record, in git we can change history to suit our needs. This gives us a lot of powerful tools and allows us to curate a good commit history in the same way we use refactoring to uphold good software design practices. These tools can be a little bit intimidating to the novice or even intermediate git user, but this guide will help to demystify the powerful git-rebase . - -``` -A word of caution : changing the history of public, shared, or stable branches is generally advised against. Editing the history of feature branches and personal forks is fine, and editing commits that you haven't pushed yet is always okay. Use git push -f to force push your changes to a personal fork or feature branch after editing your commits. -``` - -Despite the scary warning, it's worth mentioning that everything mentioned in this guide is a non-destructive operation. It's actually pretty difficult to permanently lose data in git. Fixing things when you make mistakes is covered at the end of this guide. - -### Setting up a sandbox - -We don't want to mess up any of your actual repositories, so throughout this guide we'll be working with a sandbox repo. Run these commands to get started: - -``` -git init /tmp/rebase-sandbox -cd /tmp/rebase-sandbox -git commit --allow-empty -m"Initial commit" -``` - -If you run into trouble, just run rm -rf /tmp/rebase-sandbox and run these steps again to start over. Each step of this guide can be run on a fresh sandbox, so it's not necessary to re-do every task. - - -### Amending your last commit - -Let's start with something simple: fixing your most recent commit. Let's add a file to our sandbox - and make a mistake: - -``` -echo "Hello wrold!" >greeting.txt - git add greeting.txt - git commit -m"Add greeting.txt" -``` - -Fixing this mistake is pretty easy. We can just edit the file and commit with `--amend`, like so: - -``` -echo "Hello world!" >greeting.txt - git commit -a --amend -``` - -Specifying `-a` automatically stages (i.e. `git add`'s) all files that git already knows about, and `--amend` will squash the changes into the most recent commit. Save and quit your editor (you have a chance to change the commit message now if you'd like). You can see the fixed commit by running `git show`: - -``` -commit f5f19fbf6d35b2db37dcac3a55289ff9602e4d00 (HEAD -> master) -Author: Drew DeVault -Date: Sun Apr 28 11:09:47 2019 -0400 - - Add greeting.txt - -diff --git a/greeting.txt b/greeting.txt -new file mode 100644 -index 0000000..cd08755 ---- /dev/null -+++ b/greeting.txt -@@ -0,0 +1 @@ -+Hello world! -``` - -### Fixing up older commits - -Amending only works for the most recent commit. What happens if you need to correct an older commit? Let's start by setting up our sandbox accordingly: - -``` -echo "Hello!" >greeting.txt -git add greeting.txt -git commit -m"Add greeting.txt" - -echo "Goodbye world!" >farewell.txt -git add farewell.txt -git commit -m"Add farewell.txt" -``` - -Looks like `greeting.txt` is missing "world". Let's write a commit normally which fixes that: - -``` -echo "Hello world!" >greeting.txt -git commit -a -m"fixup greeting.txt" -``` - -So now the files look correct, but our history could be better - let's use the new commit to "fixup" the last one. For this, we need to introduce a new tool: the interactive rebase. We're going to edit the last three commits this way, so we'll run `git rebase -i HEAD~3` (`-i` for interactive). This'll open your text editor with something like this: - -``` -pick 8d3fc77 Add greeting.txt -pick 2a73a77 Add farewell.txt -pick 0b9d0bb fixup greeting.txt - -# Rebase f5f19fb..0b9d0bb onto f5f19fb (3 commands) -# -# Commands: -# p, pick = use commit -# f, fixup = like "squash", but discard this commit's log message -``` - -This is the rebase plan, and by editing this file you can instruct git on how to edit history. I've trimmed the summary to just the details relevant to this part of the rebase guide, but feel free to skim the full summary in your text editor. - -When we save and close our editor, git is going to remove all of these commits from its history, then execute each line one at a time. By default, it's going to pick each commit, summoning it from the heap and adding it to the branch. If we don't edit this file at all, we'll end up right back where we started, picking every commit as-is. We're going to use one of my favorite features now: fixup. Edit the third line to change the operation from "pick" to "fixup" and move it to immediately after the commit we want to "fix up": - -``` -pick 8d3fc77 Add greeting.txt -fixup 0b9d0bb fixup greeting.txt -pick 2a73a77 Add farewell.txt -``` - -**Tip** : We can also abbreviate this with just "f" to speed things up next time. - -Save and quit your editor - git will run these commands. We can check the log to verify the result: - -``` -$ git log -2 --oneline -fcff6ae (HEAD -> master) Add farewell.txt -a479e94 Add greeting.txt -``` - -### Squashing several commits into one - -As you work, you may find it useful to write lots of commits as you reach small milestones or fix bugs in previous commits. However, it may be useful to "squash" these commits together, to make a cleaner history before merging your work into master. For this, we'll use the "squash" operation. Let's start by writing a bunch of commits - just copy and paste this if you want to speed it up: - -``` -git checkout -b squash -for c in H e l l o , ' ' w o r l d; do - echo "$c" >>squash.txt - git add squash.txt - git commit -m"Add '$c' to squash.txt" -done -``` - -That's a lot of commits to make a file that says "Hello, world"! Let's start another interactive rebase to squash them together. Note that we checked out a branch to try this on, first. Because of that, we can quickly rebase all of the commits since we branched by using `git rebase -i master`. The result: - -``` -pick 1e85199 Add 'H' to squash.txt -pick fff6631 Add 'e' to squash.txt -pick b354c74 Add 'l' to squash.txt -pick 04aaf74 Add 'l' to squash.txt -pick 9b0f720 Add 'o' to squash.txt -pick 66b114d Add ',' to squash.txt -pick dc158cd Add ' ' to squash.txt -pick dfcf9d6 Add 'w' to squash.txt -pick 7a85f34 Add 'o' to squash.txt -pick c275c27 Add 'r' to squash.txt -pick a513fd1 Add 'l' to squash.txt -pick 6b608ae Add 'd' to squash.txt - -# Rebase 1af1b46..6b608ae onto 1af1b46 (12 commands) -# -# Commands: -# p, pick = use commit -# s, squash = use commit, but meld into previous commit -``` - -**Tip** : your local master branch evolves independently of the remote master branch, and git stores the remote branch as `origin/master`. Combined with this trick, `git rebase -i origin/master` is often a very convenient way to rebase all of the commits which haven't been merged upstream yet! - -We're going to squash all of these changes into the first commit. To do this, change every "pick" operation to "squash", except for the first line, like so: - -``` -pick 1e85199 Add 'H' to squash.txt -squash fff6631 Add 'e' to squash.txt -squash b354c74 Add 'l' to squash.txt -squash 04aaf74 Add 'l' to squash.txt -squash 9b0f720 Add 'o' to squash.txt -squash 66b114d Add ',' to squash.txt -squash dc158cd Add ' ' to squash.txt -squash dfcf9d6 Add 'w' to squash.txt -squash 7a85f34 Add 'o' to squash.txt -squash c275c27 Add 'r' to squash.txt -squash a513fd1 Add 'l' to squash.txt -squash 6b608ae Add 'd' to squash.txt -``` - -When you save and close your editor, git will think about this for a moment, then open your editor again to revise the final commit message. You'll see something like this: - -``` -# This is a combination of 12 commits. -# This is the 1st commit message: - -Add 'H' to squash.txt - -# This is the commit message #2: - -Add 'e' to squash.txt - -# This is the commit message #3: - -Add 'l' to squash.txt - -# This is the commit message #4: - -Add 'l' to squash.txt - -# This is the commit message #5: - -Add 'o' to squash.txt - -# This is the commit message #6: - -Add ',' to squash.txt - -# This is the commit message #7: - -Add ' ' to squash.txt - -# This is the commit message #8: - -Add 'w' to squash.txt - -# This is the commit message #9: - -Add 'o' to squash.txt - -# This is the commit message #10: - -Add 'r' to squash.txt - -# This is the commit message #11: - -Add 'l' to squash.txt - -# This is the commit message #12: - -Add 'd' to squash.txt - -# Please enter the commit message for your changes. Lines starting -# with '#' will be ignored, and an empty message aborts the commit. -# -# Date: Sun Apr 28 14:21:56 2019 -0400 -# -# interactive rebase in progress; onto 1af1b46 -# Last commands done (12 commands done): -# squash a513fd1 Add 'l' to squash.txt -# squash 6b608ae Add 'd' to squash.txt -# No commands remaining. -# You are currently rebasing branch 'squash' on '1af1b46'. -# -# Changes to be committed: -# new file: squash.txt -# -``` - -This defaults to a combination of all of the commit messages which were squashed, but leaving it like this is almost always not what you want. The old commit messages may be useful for reference when writing the new one, though. - -**Tip** : the "fixup" command you learned about in the previous section can be used for this purpose, too - but it discards the messages of the squashed commits. - -Let's delete everything and replace it with a better commit message, like this: - -``` -Add squash.txt with contents "Hello, world" - -# Please enter the commit message for your changes. Lines starting -# with '#' will be ignored, and an empty message aborts the commit. -# -# Date: Sun Apr 28 14:21:56 2019 -0400 -# -# interactive rebase in progress; onto 1af1b46 -# Last commands done (12 commands done): -# squash a513fd1 Add 'l' to squash.txt -# squash 6b608ae Add 'd' to squash.txt -# No commands remaining. -# You are currently rebasing branch 'squash' on '1af1b46'. -# -# Changes to be committed: -# new file: squash.txt -# -``` - -Save and quit your editor, then examine your git log - success! - -``` -commit c785f476c7dff76f21ce2cad7c51cf2af00a44b6 (HEAD -> squash) -Author: Drew DeVault -Date: Sun Apr 28 14:21:56 2019 -0400 - - Add squash.txt with contents "Hello, world" -``` - -Before we move on, let's pull our changes into the master branch and get rid of this scratch one. We can use `git rebase` like we use `git merge`, but it avoids making a merge commit: - -``` -git checkout master -git rebase squash -git branch -D squash -``` - -We generally prefer to avoid using git merge unless we're actually merging unrelated histories. If you have two divergent branches, a git merge is useful to have a record of when they were... merged. In the course of your normal work, rebase is often more appropriate. - -### Splitting one commit into several - -Sometimes the opposite problem happens - one commit is just too big. Let's look into splitting it up. This time, let's write some actual code. Start with a simple C program2 (you can still copy+paste this snippet into your shell to do this quickly): - -``` -cat <main.c -int main(int argc, char *argv[]) { - return 0; -} -EOF -``` - -We'll commit this first. - -``` -git add main.c -git commit -m"Add C program skeleton" -``` - -Next, let's extend the program a bit: - -``` -cat <main.c -#include <stdio.h> - -const char *get_name() { - static char buf[128]; - scanf("%s", buf); - return buf; -} - -int main(int argc, char *argv[]) { - printf("What's your name? "); - const char *name = get_name(); - printf("Hello, %s!\n", name); - return 0; -} -EOF -``` - -After we commit this, we'll be ready to learn how to split it up. - -``` -git commit -a -m"Flesh out C program" -``` - -The first step is to start an interactive rebase. Let's rebase both commits with `git rebase -i HEAD~2`, giving us this rebase plan: - -``` -pick 237b246 Add C program skeleton -pick b3f188b Flesh out C program - -# Rebase c785f47..b3f188b onto c785f47 (2 commands) -# -# Commands: -# p, pick = use commit -# e, edit = use commit, but stop for amending -``` - -Change the second commit's command from "pick" to "edit", then save and close your editor. Git will think about this for a second, then present you with this: - -``` -Stopped at b3f188b... Flesh out C program -You can amend the commit now, with - - git commit --amend - -Once you are satisfied with your changes, run - - git rebase --continue -``` - -We could follow these instructions to add new changes to the commit, but instead let's do a "soft reset"3 by running `git reset HEAD^`. If you run `git status` after this, you'll see that it un-commits the latest commit and adds its changes to the working tree: - -``` -Last commands done (2 commands done): - pick 237b246 Add C program skeleton - edit b3f188b Flesh out C program -No commands remaining. -You are currently splitting a commit while rebasing branch 'master' on 'c785f47'. - (Once your working directory is clean, run "git rebase --continue") - -Changes not staged for commit: - (use "git add ..." to update what will be committed) - (use "git checkout -- ..." to discard changes in working directory) - - modified: main.c - -no changes added to commit (use "git add" and/or "git commit -a") -``` - -To split this up, we're going to do an interactive commit. This allows us to selectively commit only specific changes from the working tree. Run `git commit -p` to start this process, and you'll be presented with the following prompt: - -``` -diff --git a/main.c b/main.c -index b1d9c2c..3463610 100644 ---- a/main.c -+++ b/main.c -@@ -1,3 +1,14 @@ -+#include <stdio.h> -+ -+const char *get_name() { -+ static char buf[128]; -+ scanf("%s", buf); -+ return buf; -+} -+ - int main(int argc, char *argv[]) { -+ printf("What's your name? "); -+ const char *name = get_name(); -+ printf("Hello, %s!\n", name); - return 0; - } -Stage this hunk [y,n,q,a,d,s,e,?]? -``` - -Git has presented you with just one "hunk" (i.e. a single change) to consider committing. This one is too big, though - let's use the "s" command to "split" up the hunk into smaller parts. - -``` -Split into 2 hunks. -@@ -1 +1,9 @@ -+#include -+ -+const char *get_name() { -+ static char buf[128]; -+ scanf("%s", buf); -+ return buf; -+} -+ - int main(int argc, char *argv[]) { -Stage this hunk [y,n,q,a,d,j,J,g,/,e,?]? -``` - -**Tip** : If you're curious about the other options, press "?" to summarize them. - -This hunk looks better - a single, self-contained change. Let's hit "y" to answer the question (and stage that "hunk"), then "q" to "quit" the interactive session and proceed with the commit. Your editor will pop up to ask you to enter a suitable commit message. - -``` -Add get_name function to C program - -# Please enter the commit message for your changes. Lines starting -# with '#' will be ignored, and an empty message aborts the commit. -# -# interactive rebase in progress; onto c785f47 -# Last commands done (2 commands done): -# pick 237b246 Add C program skeleton -# edit b3f188b Flesh out C program -# No commands remaining. -# You are currently splitting a commit while rebasing branch 'master' on 'c785f47'. -# -# Changes to be committed: -# modified: main.c -# -# Changes not staged for commit: -# modified: main.c -# -``` - -Save and close your editor, then we'll make the second commit. We could do another interactive commit, but since we just want to include the rest of the changes in this commit we'll just do this: - -``` -git commit -a -m"Prompt user for their name" -git rebase --continue -``` - -That last command tells git that we're done editing this commit, and to continue to the next rebase command. That's it! Run `git log` to see the fruits of your labor: - -``` -$ git log -3 --oneline -fe19cc3 (HEAD -> master) Prompt user for their name -659a489 Add get_name function to C program -237b246 Add C program skeleton -``` - -### Reordering commits - -This one is pretty easy. Let's start by setting up our sandbox: - -``` -echo "Goodbye now!" >farewell.txt -git add farewell.txt -git commit -m"Add farewell.txt" - -echo "Hello there!" >greeting.txt -git add greeting.txt -git commit -m"Add greeting.txt" - -echo "How're you doing?" >inquiry.txt -git add inquiry.txt -git commit -m"Add inquiry.txt" -``` - -The git log should now look like this: - -``` -f03baa5 (HEAD -> master) Add inquiry.txt -a4cebf7 Add greeting.txt -90bb015 Add farewell.txt -``` - -Clearly, this is all out of order. Let's do an interactive rebase of the past 3 commits to resolve this. Run `git rebase -i HEAD~3` and this rebase plan will appear: - -``` -pick 90bb015 Add farewell.txt -pick a4cebf7 Add greeting.txt -pick f03baa5 Add inquiry.txt - -# Rebase fe19cc3..f03baa5 onto fe19cc3 (3 commands) -# -# Commands: -# p, pick = use commit -# -# These lines can be re-ordered; they are executed from top to bottom. -``` - -The fix is now straightforward: just reorder these lines in the order you wish for the commits to appear. Should look something like this: - -``` -pick a4cebf7 Add greeting.txt -pick f03baa5 Add inquiry.txt -pick 90bb015 Add farewell.txt -``` - -Save and close your editor and git will do the rest for you. Note that it's possible to end up with conflicts when you do this in practice - click here for help resolving conflicts. - -### git pull --rebase - -If you've been writing some commits on a branch which has been updated upstream, normally `git pull` will create a merge commit. In this respect, `git pull`'s behavior by default is equivalent to: - -``` -git fetch origin -git merge origin/master -``` - -There's another option, which is often more useful and leads to a much cleaner history: `git pull --rebase`. Unlike the merge approach, this is equivalent to the following: - -``` -git fetch origin -git rebase origin/master -``` - -The merge approach is simpler and easier to understand, but the rebase approach is almost always what you want to do if you understand how to use git rebase. If you like, you can set it as the default behavior like so: - -``` -git config --global pull.rebase true -``` - -When you do this, technically you're applying the procedure we discuss in the next section... so let's explain what it means to do that deliberately, too. - -### Using git rebase to... rebase - -Ironically, the feature of git rebase that I use the least is the one it's named for: rebasing branches. Say you have the following branches: - -``` -o--o--o--o--> master - \--o--o--> feature-1 - \--o--> feature-2 -``` - -It turns out feature-2 doesn't depend on any of the changes in feature-1, so you can just base it off of master. The fix is thus: - -``` -git checkout feature-2 -git rebase master -``` - -The non-interactive rebase does the default operation for all implicated commits ("pick")4, which simply rolls your history back to the last common anscestor and replays the commits from both branches. Your history now looks like this: - -``` -o--o--o--o--> master - | \--o--> feature-2 - \--o--o--> feature-1 -``` - -### Resolving conflicts - -The details on resolving merge conflicts are beyond the scope of this guide - keep your eye out for another guide for this in the future. Assuming you're familiar with resolving conflicts in general, here are the specifics that apply to rebasing. - -The details on resolving merge conflicts are beyond the scope of this guide - keep your eye out for another guide for this in the future. Assuming you're familiar with resolving conflicts in general, here are the specifics that apply to rebasing. - -Sometimes you'll get a merge conflict when doing a rebase, which you can handle just like any other merge conflict. Git will set up the conflict markers in the affected files, `git status` will show you what you need to resolve, and you can mark files as resolved with `git add` or `git rm`. However, in the context of a git rebase, there are two options you should be aware of. - -The first is how you complete the conflict resolution. Rather than `git commit` like you'll use when addressing conflicts that arise from `git merge`, the appropriate command for rebasing is `git rebase --continue`. However, there's another option available to you: `git rebase --skip`. This will skip the commit you're working on, and it won't be included in the rebase. This is most common when doing a non-interactive rebase, when git doesn't realize that a commit it's pulled from the "other" branch is an updated version of the commit that it conflicts with on "our" branch. - -### Help! I broke it! - -No doubt about it - rebasing can be hard sometimes. If you've made a mistake and in so doing lost commits which you needed, then `git reflog` is here to save the day. Running this command will show you every operation which changed a ref, or reference - that is, branches and tags. Each line shows you what the old reference pointed to, and you can `git cherry-pick`, `git checkout`, `git show`, or use any other operation on git commits once thought lost. - - --------------------------------------------------------------------------------- - -via: https://git-rebase.io/ - -作者:[git-rebase][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://git-rebase.io/ -[b]: https://github.com/lujun9972 diff --git a/sources/tech/20190521 How to Disable IPv6 on Ubuntu Linux.md b/sources/tech/20190521 How to Disable IPv6 on Ubuntu Linux.md deleted file mode 100644 index 4420b034e6..0000000000 --- a/sources/tech/20190521 How to Disable IPv6 on Ubuntu Linux.md +++ /dev/null @@ -1,219 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: ( ) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (How to Disable IPv6 on Ubuntu Linux) -[#]: via: (https://itsfoss.com/disable-ipv6-ubuntu-linux/) -[#]: author: (Sergiu https://itsfoss.com/author/sergiu/) - -How to Disable IPv6 on Ubuntu Linux -====== - -Are you looking for a way to **disable IPv6** connections on your Ubuntu machine? In this article, I’ll teach you exactly how to do it and why you would consider this option. I’ll also show you how to **enable or re-enable IPv6** in case you change your mind. - -### What is IPv6 and why would you want to disable IPv6 on Ubuntu? - -**[Internet Protocol version 6][1]** [(][1] **[IPv6][1]**[)][1] is the most recent version of the Internet Protocol (IP), the communications protocol that provides an identification and location system for computers on networks and routes traffic across the Internet. It was developed in 1998 to replace the **IPv4** protocol. - -**IPv6** aims to improve security and performance, while also making sure we don’t run out of addresses. It assigns unique addresses globally to every device, storing them in **128-bits** , compared to just 32-bits used by IPv4. - -![Disable IPv6 Ubuntu][2] - -Although the goal is for IPv4 to be replaced by IPv6, there is still a long way to go. Less than **30%** of the sites on the Internet makes IPv6 connectivity available to users (tracked by Google [here][3]). IPv6 can also cause [problems with some applications at time][4]. - -Since **VPNs** provide global services, the fact that IPv6 uses globally routed addresses (uniquely assigned) and that there (still) are ISPs that don’t offer IPv6 support shifts this feature lower down their priority list. This way, they can focus on what matters the most for VPN users: security. - -Another possible reason you might want to disable IPv6 on your system is not wanting to expose yourself to various threats. Although IPv6 itself is safer than IPv4, the risks I am referring to are of another nature. If you aren’t actively using IPv6 and its features, [having IPv6 enabled leaves you vulnerable to various attacks][5], offering the hacker another possible exploitable tool. - -On the same note, configuring basic network rules is not enough. You have to pay the same level of attention to tweaking your IPv6 configuration as you do for IPv4. This can prove to be quite a hassle to do (and also to maintain). With IPv6 comes a suite of problems different to those of IPv4 (many of which can be referenced online, given the age of this protocol), giving your system another layer of complexity. - -[][6] - -Suggested read How To Remove Drive Icons From Unity Launcher In Ubuntu 14.04 [Beginner Tips] - -### Disabling IPv6 on Ubuntu [For Advanced Users Only] - -In this section, I’ll be covering how you can disable IPv6 protocol on your Ubuntu machine. Open up a terminal ( **default:** CTRL+ALT+T) and let’s get to it! - -**Note:** _For most of the commands you are going to input in the terminal_ _you are going to need root privileges ( **sudo** )._ - -Warning! - -If you are a regular desktop Linux user and prefer a stable working system, please avoid this tutorial. This is for advanced users who know what they are doing and why they are doing so. - -#### 1\. Disable IPv6 using Sysctl - -First of all, you can **check** if you have IPv6 enabled with: - -``` -ip a -``` - -You should see an IPv6 address if it is enabled (the name of your internet card might be different): - -![IPv6 Address Ubuntu][7] - -You have see the sysctl command in the tutorial about [restarting network in Ubuntu][8]. We are going to use it here as well. To **disable IPv6** you only have to input 3 commands: - -``` -sudo sysctl -w net.ipv6.conf.all.disable_ipv6=1 -sudo sysctl -w net.ipv6.conf.default.disable_ipv6=1 -sudo sysctl -w net.ipv6.conf.lo.disable_ipv6=1 -``` - -You can check if it worked using: - -``` -ip a -``` - -You should see no IPv6 entry: - -![IPv6 Disabled Ubuntu][9] - -However, this only **temporarily disables IPv6**. The next time your system boots, IPv6 will be enabled again. - -One method to make this option persist is modifying **/etc/sysctl.conf**. I’ll be using vim to edit the file, but you can use any editor you like. Make sure you have **administrator rights** (use **sudo** ): - -![Sysctl Configuration][10] - -Add the following lines to the file: - -``` -net.ipv6.conf.all.disable_ipv6=1 -net.ipv6.conf.default.disable_ipv6=1 -net.ipv6.conf.lo.disable_ipv6=1 -``` - -For the settings to take effect use: - -``` -sudo sysctl -p -``` - -If IPv6 is still enabled after rebooting, you must create (with root privileges) the file **/etc/rc.local** and fill it with: - -``` -#!/bin/bash -# /etc/rc.local - -/etc/sysctl.d -/etc/init.d/procps restart - -exit 0 -``` - -Now use [chmod command][11] to make the file executable: - -``` -sudo chmod 755 /etc/rc.local -``` - -What this will do is manually read (during the boot time) the kernel parameters from your sysctl configuration file. - -[][12] - -Suggested read 3 Ways to Check Linux Kernel Version in Command Line - -#### 2\. Disable IPv6 using GRUB - -An alternative method is to configure **GRUB** to pass kernel parameters at boot time. You’ll have to edit **/etc/default/grub**. Once again, make sure you have administrator privileges: - -![GRUB Configuration][13] - -Now you need to modify **GRUB_CMDLINE_LINUX_DEFAULT** and **GRUB_CMDLINE_LINUX** to disable IPv6 on boot: - -``` -GRUB_CMDLINE_LINUX_DEFAULT="quiet splash ipv6.disable=1" -GRUB_CMDLINE_LINUX="ipv6.disable=1" -``` - -Save the file and run: - -``` -sudo update-grub -``` - -The settings should now persist on reboot. - -### Re-enabling IPv6 on Ubuntu - -To re-enable IPv6, you’ll have to undo the changes you made. To enable IPv6 until reboot, enter: - -``` -sudo sysctl -w net.ipv6.conf.all.disable_ipv6=0 -sudo sysctl -w net.ipv6.conf.default.disable_ipv6=0 -sudo sysctl -w net.ipv6.conf.lo.disable_ipv6=0 -``` - -Otherwise, if you modified **/etc/sysctl.conf** you can either remove the lines you added or change them to: - -``` -net.ipv6.conf.all.disable_ipv6=0 -net.ipv6.conf.default.disable_ipv6=0 -net.ipv6.conf.lo.disable_ipv6=0 -``` - -You can optionally reload these values: - -``` -sudo sysctl -p -``` - -You should once again see a IPv6 address: - -![IPv6 Reenabled in Ubuntu][14] - -Optionally, you can remove **/etc/rc.local** : - -``` -sudo rm /etc/rc.local -``` - -If you modified the kernel parameters in **/etc/default/grub** , go ahead and delete the added options: - -``` -GRUB_CMDLINE_LINUX_DEFAULT="quiet splash" -GRUB_CMDLINE_LINUX="" -``` - -Now do: - -``` -sudo update-grub -``` - -**Wrapping Up** - -In this guide I provided you ways in which you can **disable IPv6** on Linux, as well as giving you an idea about what IPv6 is and why you would want to disable it. - -Did you find this article useful? Do you disable IPv6 connectivity? Let us know in the comment section! - --------------------------------------------------------------------------------- - -via: https://itsfoss.com/disable-ipv6-ubuntu-linux/ - -作者:[Sergiu][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/sergiu/ -[b]: https://github.com/lujun9972 -[1]: https://en.wikipedia.org/wiki/IPv6 -[2]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/05/disable_ipv6_ubuntu.png?fit=800%2C450&ssl=1 -[3]: https://www.google.com/intl/en/ipv6/statistics.html -[4]: https://whatismyipaddress.com/ipv6-issues -[5]: https://www.internetsociety.org/blog/2015/01/ipv6-security-myth-1-im-not-running-ipv6-so-i-dont-have-to-worry/ -[6]: https://itsfoss.com/remove-drive-icons-from-unity-launcher-in-ubuntu/ -[7]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2019/05/ipv6_address_ubuntu.png?fit=800%2C517&ssl=1 -[8]: https://itsfoss.com/restart-network-ubuntu/ -[9]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/05/ipv6_disabled_ubuntu.png?fit=800%2C442&ssl=1 -[10]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/05/sysctl_configuration.jpg?fit=800%2C554&ssl=1 -[11]: https://linuxhandbook.com/chmod-command/ -[12]: https://itsfoss.com/find-which-kernel-version-is-running-in-ubuntu/ -[13]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/05/grub_configuration-1.jpg?fit=800%2C565&ssl=1 -[14]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2019/05/ipv6_address_ubuntu-1.png?fit=800%2C517&ssl=1 diff --git a/sources/tech/20190523 Run your blog on GitHub Pages with Python.md b/sources/tech/20190523 Run your blog on GitHub Pages with Python.md deleted file mode 100644 index 1e3634a327..0000000000 --- a/sources/tech/20190523 Run your blog on GitHub Pages with Python.md +++ /dev/null @@ -1,235 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: ( ) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Run your blog on GitHub Pages with Python) -[#]: via: (https://opensource.com/article/19/5/run-your-blog-github-pages-python) -[#]: author: (Erik O'Shaughnessy https://opensource.com/users/jnyjny/users/jasperzanjani/users/jasperzanjani/users/jasperzanjani/users/jnyjny/users/jasperzanjani) - -Run your blog on GitHub Pages with Python -====== -Create a blog with Pelican, a Python-based blogging platform that works -well with GitHub. -![Raspberry Pi and Python][1] - -[GitHub][2] is a hugely popular web service for source code control that uses [Git][3] to synchronize local files with copies kept on GitHub's servers so you can easily share and back up your work. - -In addition to providing a user interface for code repositories, GitHub also enables users to [publish web pages][4] directly from a repository. The website generation package GitHub recommends is [Jekyll][5], written in Ruby. Since I'm a bigger fan of [Python][6], I prefer [Pelican][7], a Python-based blogging platform that works well with GitHub. - -Pelican and Jekyll both transform content written in [Markdown][8] or [reStructuredText][9] into HTML to generate static websites, and both generators support themes that allow unlimited customization. - -In this article, I'll describe how to install Pelican, set up your GitHub repository, run a quickstart helper, write some Markdown files, and publish your first page. I'll assume that you have a [GitHub account][10], are comfortable with [basic Git commands][11], and want to publish a blog using Pelican. - -### Install Pelican and create the repo - -First things first, Pelican (and **ghp-import** ) must be installed on your local machine. This is super easy with [pip][12], the Python package installation tool (you have pip right?): - - -``` -`$ pip install pelican ghp-import` -``` - -Next, open a browser and create a new repository on GitHub for your sweet new blog. Name it as follows (substituting your GitHub username for here and throughout this tutorial): - - -``` -`https://GitHub.com/username/username.github.io` -``` - -Leave it empty; we will fill it with compelling blog content in a moment. - -Using a command line (you command line right?), clone your empty Git repository to your local machine: - - -``` -$ git clone blog -$ cd blog -``` - -### That one weird trick… - -Here's a not-super-obvious trick about publishing web content on GitHub. For user pages (pages hosted in repos named _username.github.io_ ), the content is served from the **master** branch. - -I strongly prefer not to keep all the Pelican configuration files and raw Markdown files in **master** , rather just the web content. So I keep the Pelican configuration and the raw content in a separate branch I like to call **content**. (You can call it whatever you want, but the following instructions will call it **content**.) I like this structure since I can throw away all the files in **master** and re-populate it with the **content** branch. - - -``` -$ git checkout -b content -Switched to a new branch 'content' -``` - -### Configure Pelican - -Now it's time for content configuration. Pelican provides a great initialization tool called **pelican-quickstart** that will ask you a series of questions about your blog. - - -``` -$ pelican-quickstart -Welcome to pelican-quickstart v3.7.1. - -This script will help you create a new Pelican-based website. - -Please answer the following questions so this script can generate the files -needed by Pelican. - -> Where do you want to create your new web site? [.] -> What will be the title of this web site? Super blog -> Who will be the author of this web site? username -> What will be the default language of this web site? [en] -> Do you want to specify a URL prefix? e.g., (Y/n) n -> Do you want to enable article pagination? (Y/n) -> How many articles per page do you want? [10] -> What is your time zone? [Europe/Paris] US/Central -> Do you want to generate a Fabfile/Makefile to automate generation and publishing? (Y/n) y -> Do you want an auto-reload & simpleHTTP script to assist with theme and site development? (Y/n) y -> Do you want to upload your website using FTP? (y/N) n -> Do you want to upload your website using SSH? (y/N) n -> Do you want to upload your website using Dropbox? (y/N) n -> Do you want to upload your website using S3? (y/N) n -> Do you want to upload your website using Rackspace Cloud Files? (y/N) n -> Do you want to upload your website using GitHub Pages? (y/N) y -> Is this your personal page (username.github.io)? (y/N) y -Done. Your new project is available at /Users/username/blog -``` - -You can take the defaults on every question except: - - * Website title, which should be unique and special - * Website author, which can be a personal username or your full name - * Time zone, which may not be in Paris - * Upload to GitHub Pages, which is a "y" in our case - - - -After answering all the questions, Pelican leaves the following in the current directory: - - -``` -$ ls -Makefile content/ develop_server.sh* -fabfile.py output/ pelicanconf.py -publishconf.py -``` - -You can check out the [Pelican docs][13] to find out how to use those files, but we're all about getting things done _right now_. No, I haven't read the docs yet either. - -### Forge on - -Add all the Pelican-generated files to the **content** branch of the local Git repo, commit the changes, and push the local changes to the remote repo hosted on GitHub by entering: - - -``` -$ git add . -$ git commit -m 'initial pelican commit to content' -$ git push origin content -``` - -This isn't super exciting, but it will be handy if we need to revert edits to one of these files. - -### Finally getting somewhere - -OK, now you can get bloggy! All of your blog posts, photos, images, PDFs, etc., will live in the **content** directory, which is initially empty. To begin creating a first post and an About page with a photo, enter: - - -``` -$ cd content -$ mkdir pages images -$ cp /Users/username/SecretStash/HotPhotoOfMe.jpg images -$ touch first-post.md -$ touch pages/about.md -``` - -Next, open the empty file **first-post.md** in your favorite text editor and add the following: - - -``` -title: First Post on My Sweet New Blog -date: -author: Your Name Here - -# I am On My Way To Internet Fame and Fortune! - -This is my first post on my new blog. While not super informative it -should convey my sense of excitement and eagerness to engage with you, -the reader! -``` - -The first three lines contain metadata that Pelican uses to organize things. There are lots of different metadata you can put there; again, the docs are your best bet for learning more about the options. - -Now, open the empty file **pages/about.md** and add this text: - - -``` -title: About -date: - -![So Schmexy][my_sweet_photo] - -Hi, I am and I wrote this epic collection of Interweb -wisdom. In days of yore, much of this would have been deemed sorcery -and I would probably have been burned at the stake. - -😆 - -[my_sweet_photo]: {filename}/images/HotPhotoOfMe.jpg -``` - -You now have three new pieces of web content in your content directory. Of the content branch. That's a lot of content. - -### Publish - -Don't worry; the payoff is coming! - -All that's left to do is: - - * Run Pelican to generate the static HTML files in **output** : [code]`$ pelican content -o output -s publishconf.py` -``` -* Use **ghp-import** to add the contents of the **output** directory to the **master** branch: [code]`$ ghp-import -m "Generate Pelican site" --no-jekyll -b master output` -``` - * Push the local master branch to the remote repo: [code]`$ git push origin master` -``` - * Commit and push the new content to the **content** branch: [code] $ git add content -$ git commit -m 'added a first post, a photo and an about page' -$ git push origin content -``` - - - -### OMG, I did it! - -Now the exciting part is here, when you get to view what you've published for everyone to see! Open your browser and enter: - - -``` -`https://username.github.io` -``` - -Congratulations on your new blog, self-published on GitHub! You can follow this pattern whenever you want to add more pages or articles. Happy blogging. - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/19/5/run-your-blog-github-pages-python - -作者:[Erik O'Shaughnessy][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/jnyjny/users/jasperzanjani/users/jasperzanjani/users/jasperzanjani/users/jnyjny/users/jasperzanjani -[b]: https://github.com/lujun9972 -[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/getting_started_with_python.png?itok=MFEKm3gl (Raspberry Pi and Python) -[2]: https://github.com/ -[3]: https://git-scm.com -[4]: https://help.github.com/en/categories/github-pages-basics -[5]: https://jekyllrb.com -[6]: https://python.org -[7]: https://blog.getpelican.com -[8]: https://guides.github.com/features/mastering-markdown -[9]: http://docutils.sourceforge.net/docs/user/rst/quickref.html -[10]: https://github.com/join?source=header-home -[11]: https://git-scm.com/docs -[12]: https://pip.pypa.io/en/stable/ -[13]: https://docs.getpelican.com diff --git a/sources/tech/20190524 Dual booting Windows and Linux using UEFI.md b/sources/tech/20190524 Dual booting Windows and Linux using UEFI.md deleted file mode 100644 index b281b6036b..0000000000 --- a/sources/tech/20190524 Dual booting Windows and Linux using UEFI.md +++ /dev/null @@ -1,104 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: ( ) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Dual booting Windows and Linux using UEFI) -[#]: via: (https://opensource.com/article/19/5/dual-booting-windows-linux-uefi) -[#]: author: (Alan Formy-Duval https://opensource.com/users/alanfdoss/users/ckrzen) - -Dual booting Windows and Linux using UEFI -====== -A quick rundown of setting up Linux and Windows to dual boot on the same -machine, using the Unified Extensible Firmware Interface (UEFI). -![Linux keys on the keyboard for a desktop computer][1] - -Rather than doing a step-by-step how-to guide to configuring your system to dual boot, I’ll highlight the important points. As an example, I will refer to my new laptop that I purchased a few months ago. I first installed [Ubuntu Linux][2] onto the entire hard drive, which destroyed the pre-installed [Windows 10][3] installation. After a few months, I decided to install a different Linux distribution, and so also decided to re-install Windows 10 alongside [Fedora Linux][4] in a dual boot configuration. I’ll highlight some essential facts to get started. - -### Firmware - -Dual booting is not just a matter of software. Or, it is, but it involves changing your firmware, which among other things tells your machine how to begin the boot process. Here are some firmware-related issues to keep in mind. - -#### UEFI vs. BIOS - -Before attempting to install, make sure your firmware configuration is optimal. Most computers sold today have a new type of firmware known as [Unified Extensible Firmware Interface (UEFI)][5], which has pretty much replaced the other firmware known as [Basic Input Output System (BIOS)][6], which is often included through the mode many providers call Legacy Boot. - -I had no need for BIOS, so I chose UEFI mode. - -#### Secure Boot - -One other important setting is Secure Boot. This feature detects whether the boot path has been tampered with, and stops unapproved operating systems from booting. For now, I disabled this option to ensure that I could install Fedora Linux. According to the Fedora Project Wiki [Features/Secure Boot ][7] Fedora Linux will work with it enabled. This may be different for other Linux distributions —I plan to revisit this setting in the future. - -In short, if you find that you cannot install your Linux OS with this setting active, disable Secure Boot and try again. - -### Partitioning the boot drive - -If you choose to dual boot and have both operating systems on the same drive, you have to break it into partitions. Even if you dual boot using two different drives, most Linux installations are best broken into a few basic partitions for a variety of reasons. Here are some options to consider. - -#### GPT vs MBR - -If you decide to manually partition your boot drive in advance, I recommend using the [GUID Partition Table (GPT)][8] rather than the older [Master Boot Record (MBR)][9]. Among the reasons for this change, there are two specific limitations of MBR that GPT doesn’t have: - - * MBR can hold up to 15 partitions, while GPT can hold up to 128. - * MBR only supports up to 2 terabytes, while GPT uses 64-bit addresses which allows it to support disks up to 8 million terabytes. - - - -If you have shopped for hard drives recently, then you know that many of today’s drives exceed the 2 terabyte limit. - -#### The EFI system partition - -If you are doing a fresh installation or using a new drive, there are probably no partitions to begin with. In this case, the OS installer will create the first one, which is the [EFI System Partition (ESP)][10]. If you choose to manually partition your drive using a tool such as [gdisk][11], you will need to create this partition with several parameters. Based on the existing ESP, I set the size to around 500MB and assigned it the ef00 (EFI System) partition type. The UEFI specification requires the format to be FAT32/msdos, most likely because it is supportable by a wide range of operating systems. - -![Partitions][12] - -### Operating System Installation - -Once you accomplish the first two tasks, you can install your operating systems. While I focus on Windows 10 and Fedora Linux here, the process is fairly similar when installing other combinations as well. - -#### Windows 10 - -I started the Windows 10 installation and created a 20 Gigabyte Windows partition. Since I had previously installed Linux on my laptop, the drive had an ESP, which I chose to keep. I deleted all existing Linux and swap partitions to start fresh, and then started my Windows installation. The Windows installer automatically created another small partition—16 Megabytes—called the [Microsoft Reserved Partition (MSR)][13]. Roughly 400 Gigabytes of unallocated space remained on the 512GB boot drive once this was finished. - -I then proceeded with and completed the Windows 10 installation process. I then rebooted into Windows to make sure it was working, created my user account, set up wi-fi, and completed other tasks that need to be done on a first-time OS installation. - -#### Fedora Linux - -I next moved to install Linux. I started the process, and when it reached the disk configuration steps, I made sure not to change the Windows NTFS and MSR partitions. I also did not change the EPS, but I did set its mount point to **/boot/efi**. I then created the usual ext4 formatted partitions, **/** (root), **/boot** , and **/home**. The last partition I created was Linux **swap**. - -As with Windows, I continued and completed the Linux installation, and then rebooted. To my delight, at boot time the [GRand][14] [Unified Boot Loader (GRUB)][14] menu provided the choice to select either Windows or Linux, which meant I did not have to do any additional configuration. I selected Linux and completed the usual steps such as creating my user account. - -### Conclusion - -Overall, the process was painless. In past years, there has been some difficulty navigating the changes from UEFI to BIOS, plus the introduction of features such as Secure Boot. I believe that we have now made it past these hurdles and can reliably set up multi-boot systems. - -I don’t miss the [Linux LOader (LILO)][15] anymore! - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/19/5/dual-booting-windows-linux-uefi - -作者:[Alan Formy-Duval][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/alanfdoss/users/ckrzen -[b]: https://github.com/lujun9972 -[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/linux_keyboard_desktop.png?itok=I2nGw78_ (Linux keys on the keyboard for a desktop computer) -[2]: https://www.ubuntu.com -[3]: https://www.microsoft.com/en-us/windows -[4]: https://getfedora.org -[5]: https://en.wikipedia.org/wiki/Unified_Extensible_Firmware_Interface -[6]: https://en.wikipedia.org/wiki/BIOS -[7]: https://fedoraproject.org/wiki/Features/SecureBoot -[8]: https://en.wikipedia.org/wiki/GUID_Partition_Table -[9]: https://en.wikipedia.org/wiki/Master_boot_record -[10]: https://en.wikipedia.org/wiki/EFI_system_partition -[11]: https://sourceforge.net/projects/gptfdisk/ -[12]: /sites/default/files/u216961/gdisk_screenshot_s.png -[13]: https://en.wikipedia.org/wiki/Microsoft_Reserved_Partition -[14]: https://en.wikipedia.org/wiki/GNU_GRUB -[15]: https://en.wikipedia.org/wiki/LILO_(boot_loader) diff --git a/sources/tech/20190527 How To Enable Or Disable SSH Access For A Particular User Or Group In Linux.md b/sources/tech/20190527 How To Enable Or Disable SSH Access For A Particular User Or Group In Linux.md deleted file mode 100644 index a717d05ed8..0000000000 --- a/sources/tech/20190527 How To Enable Or Disable SSH Access For A Particular User Or Group In Linux.md +++ /dev/null @@ -1,300 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: ( ) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (How To Enable Or Disable SSH Access For A Particular User Or Group In Linux?) -[#]: via: (https://www.2daygeek.com/allow-deny-enable-disable-ssh-access-user-group-in-linux/) -[#]: author: (2daygeek http://www.2daygeek.com/author/2daygeek/) - -How To Enable Or Disable SSH Access For A Particular User Or Group In Linux? -====== - -As per your organization standard policy, you may need to allow only the list of users that are allowed to access the Linux system. - -Or you may need to allow only few groups, which are allowed to access the Linux system. - -How to achieve this? What is the best way? How to achieve this in a simple way? - -Yes, there are many ways are available to perform this. - -However, we need to go with simple and easy method. - -If so, it can be done by making the necessary changes in `/etc/ssh/sshd_config` file. - -In this article we will show you, how to perform this in details. - -Why are we doing this? due to security reason. Navigate to the following URL to know more about **[openSSH][1]** usage. - -### What Is SSH? - -openssh stands for OpenBSD Secure Shell. Secure Shell (ssh) is a free open source networking tool which allow us to access remote system over an unsecured network using Secure Shell (SSH) protocol. - -It’s a client-server architecture. It handles user authentication, encryption, transferring files between computers and tunneling. - -These can be accomplished via traditional tools such as telnet or rcp, these are insecure and use transfer password in cleartext format while performing any action. - -### How To Allow A User To Access SSH In Linux? - -We can allow/enable the ssh access for a particular user or list of the users using the following method. - -If you would like to allow more than one user then you have to add the users with space in the same line. - -To do so, just append the following value into `/etc/ssh/sshd_config` file. In this example, we are going to allow ssh access for `user3`. - -``` -# echo "AllowUsers user3" >> /etc/ssh/sshd_config -``` - -You can double check this by running the following command. - -``` -# cat /etc/ssh/sshd_config | grep -i allowusers -AllowUsers user3 -``` - -That’s it. Just bounce the ssh service and see the magic. - -``` -# systemctl restart sshd - -# service restart sshd -``` - -Simple open a new terminal or session and try to access the Linux system with different user. Yes, `user2` isn’t allowed for SSH login and will be getting an error message as shown below. - -``` -# ssh [email protected] -[email protected]'s password: -Permission denied, please try again. -``` - -Output: - -``` -Mar 29 02:00:35 CentOS7 sshd[4900]: User user2 from 192.168.1.6 not allowed because not listed in AllowUsers -Mar 29 02:00:35 CentOS7 sshd[4900]: input_userauth_request: invalid user user2 [preauth] -Mar 29 02:00:40 CentOS7 unix_chkpwd[4902]: password check failed for user (user2) -Mar 29 02:00:40 CentOS7 sshd[4900]: pam_unix(sshd:auth): authentication failure; logname= uid=0 euid=0 tty=ssh ruser= rhost=192.168.1.6 user=user2 -Mar 29 02:00:43 CentOS7 sshd[4900]: Failed password for invalid user user2 from 192.168.1.6 port 42568 ssh2 -``` - -At the same time `user3` is allowed to login into the system because it’s in allowed users list. - -``` -# ssh [email protected] -[email protected]'s password: -[[email protected] ~]$ -``` - -Output: - -``` -Mar 29 02:01:13 CentOS7 sshd[4939]: Accepted password for user3 from 192.168.1.6 port 42590 ssh2 -Mar 29 02:01:13 CentOS7 sshd[4939]: pam_unix(sshd:session): session opened for user user3 by (uid=0) -``` - -### How To Deny Users To Access SSH In Linux? - -We can deny/disable the ssh access for a particular user or list of the users using the following method. - -If you would like to disable more than one user then you have to add the users with space in the same line. - -To do so, just append the following value into `/etc/ssh/sshd_config` file. In this example, we are going to disable ssh access for `user1`. - -``` -# echo "DenyUsers user1" >> /etc/ssh/sshd_config -``` - -You can double check this by running the following command. - -``` -# cat /etc/ssh/sshd_config | grep -i denyusers -DenyUsers user1 -``` - -That’s it. Just bounce the ssh service and see the magic. - -``` -# systemctl restart sshd - -# service restart sshd -``` - -Simple open a new terminal or session and try to access the Linux system with Deny user. Yes, `user1` is in denyusers list. So, you will be getting an error message as shown below when you are try to login. - -``` -# ssh [email protected] -[email protected]'s password: -Permission denied, please try again. -``` - -Output: - -``` -Mar 29 01:53:42 CentOS7 sshd[4753]: User user1 from 192.168.1.6 not allowed because listed in DenyUsers -Mar 29 01:53:42 CentOS7 sshd[4753]: input_userauth_request: invalid user user1 [preauth] -Mar 29 01:53:46 CentOS7 unix_chkpwd[4755]: password check failed for user (user1) -Mar 29 01:53:46 CentOS7 sshd[4753]: pam_unix(sshd:auth): authentication failure; logname= uid=0 euid=0 tty=ssh ruser= rhost=192.168.1.6 user=user1 -Mar 29 01:53:48 CentOS7 sshd[4753]: Failed password for invalid user user1 from 192.168.1.6 port 42522 ssh2 -``` - -### How To Allow Groups To Access SSH In Linux? - -We can allow/enable the ssh access for a particular group or groups using the following method. - -If you would like to allow more than one group then you have to add the groups with space in the same line. - -To do so, just append the following value into `/etc/ssh/sshd_config` file. In this example, we are going to disable ssh access for `2g-admin` group. - -``` -# echo "AllowGroups 2g-admin" >> /etc/ssh/sshd_config -``` - -You can double check this by running the following command. - -``` -# cat /etc/ssh/sshd_config | grep -i allowgroups -AllowGroups 2g-admin -``` - -Run the following command to know the list of the users are belongs to this group. - -``` -# getent group 2g-admin -2g-admin:x:1005:user1,user2,user3 -``` - -That’s it. Just bounce the ssh service and see the magic. - -``` -# systemctl restart sshd - -# service restart sshd -``` - -Yes, `user3` is allowed to login into the system because user3 is belongs to `2g-admin` group. - -``` -# ssh [email protected] -[email protected]'s password: -[[email protected] ~]$ -``` - -Output: - -``` -Mar 29 02:10:21 CentOS7 sshd[5165]: Accepted password for user1 from 192.168.1.6 port 42640 ssh2 -Mar 29 02:10:22 CentOS7 sshd[5165]: pam_unix(sshd:session): session opened for user user1 by (uid=0) -``` - -Yes, `user2` is allowed to login into the system because user2 is belongs to `2g-admin` group. - -``` -# ssh [email protected] -[email protected]'s password: -[[email protected] ~]$ -``` - -Output: - -``` -Mar 29 02:10:38 CentOS7 sshd[5225]: Accepted password for user2 from 192.168.1.6 port 42642 ssh2 -Mar 29 02:10:38 CentOS7 sshd[5225]: pam_unix(sshd:session): session opened for user user2 by (uid=0) -``` - -When you are try to login into the system with other users which are not part of this group then you will be getting an error message as shown below. - -``` -# ssh [email protected] -[email protected]'s password: -Permission denied, please try again. -``` - -Output: - -``` -Mar 29 02:12:36 CentOS7 sshd[5306]: User ladmin from 192.168.1.6 not allowed because none of user's groups are listed in AllowGroups -Mar 29 02:12:36 CentOS7 sshd[5306]: input_userauth_request: invalid user ladmin [preauth] -Mar 29 02:12:56 CentOS7 unix_chkpwd[5310]: password check failed for user (ladmin) -Mar 29 02:12:56 CentOS7 sshd[5306]: pam_unix(sshd:auth): authentication failure; logname= uid=0 euid=0 tty=ssh ruser= rhost=192.168.1.6 user=ladmin -Mar 29 02:12:58 CentOS7 sshd[5306]: Failed password for invalid user ladmin from 192.168.1.6 port 42674 ssh2 -``` - -### How To Deny Group To Access SSH In Linux? - -We can deny/disable the ssh access for a particular group or groups using the following method. - -If you would like to disable more than one group then you need to add the group with space in the same line. - -To do so, just append the following value into `/etc/ssh/sshd_config` file. - -``` -# echo "DenyGroups 2g-admin" >> /etc/ssh/sshd_config -``` - -You can double check this by running the following command. - -``` -# # cat /etc/ssh/sshd_config | grep -i denygroups -DenyGroups 2g-admin - -# getent group 2g-admin -2g-admin:x:1005:user1,user2,user3 -``` - -That’s it. Just bounce the ssh service and see the magic. - -``` -# systemctl restart sshd - -# service restart sshd -``` - -Yes `user3` isn’t allowed to login into the system because it’s not part of `2g-admin` group. It’s in Denygroups. - -``` -# ssh [email protected] -[email protected]'s password: -Permission denied, please try again. -``` - -Output: - -``` -Mar 29 02:17:32 CentOS7 sshd[5400]: User user1 from 192.168.1.6 not allowed because a group is listed in DenyGroups -Mar 29 02:17:32 CentOS7 sshd[5400]: input_userauth_request: invalid user user1 [preauth] -Mar 29 02:17:38 CentOS7 unix_chkpwd[5402]: password check failed for user (user1) -Mar 29 02:17:38 CentOS7 sshd[5400]: pam_unix(sshd:auth): authentication failure; logname= uid=0 euid=0 tty=ssh ruser= rhost=192.168.1.6 user=user1 -Mar 29 02:17:41 CentOS7 sshd[5400]: Failed password for invalid user user1 from 192.168.1.6 port 42710 ssh2 -``` - -Anyone can login into the system except `2g-admin` group. Hence, `ladmin` user is allowed to login into the system. - -``` -# ssh [email protected] -[email protected]'s password: -[[email protected] ~]$ -``` - -Output: - -``` -Mar 29 02:19:13 CentOS7 sshd[5432]: Accepted password for ladmin from 192.168.1.6 port 42716 ssh2 -Mar 29 02:19:13 CentOS7 sshd[5432]: pam_unix(sshd:session): session opened for user ladmin by (uid=0) -``` - --------------------------------------------------------------------------------- - -via: https://www.2daygeek.com/allow-deny-enable-disable-ssh-access-user-group-in-linux/ - -作者:[2daygeek][a] -选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]: http://www.2daygeek.com/author/2daygeek/ -[b]: https://github.com/lujun9972 -[1]: https://www.2daygeek.com/category/ssh-tutorials/ diff --git a/sources/tech/20190612 How to write a loop in Bash.md b/sources/tech/20190612 How to write a loop in Bash.md deleted file mode 100644 index f63bff9cd3..0000000000 --- a/sources/tech/20190612 How to write a loop in Bash.md +++ /dev/null @@ -1,282 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: ( ) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (How to write a loop in Bash) -[#]: via: (https://opensource.com/article/19/6/how-write-loop-bash) -[#]: author: (Seth Kenlon https://opensource.com/users/seth/users/goncasousa/users/howtopamm/users/howtopamm/users/seth/users/wavesailor/users/seth) - -How to write a loop in Bash -====== -Automatically perform a set of actions on multiple files with for loops -and find commands. -![bash logo on green background][1] - -A common reason people want to learn the Unix shell is to unlock the power of batch processing. If you want to perform some set of actions on many files, one of the ways to do that is by constructing a command that iterates over those files. In programming terminology, this is called _execution control,_ and one of the most common examples of it is the **for** loop. - -A **for** loop is a recipe detailing what actions you want your computer to take _for_ each data object (such as a file) you specify. - -### The classic for loop - -An easy loop to try is one that analyzes a collection of files. This probably isn't a useful loop on its own, but it's a safe way to prove to yourself that you have the ability to handle each file in a directory individually. First, create a simple test environment by creating a directory and placing some copies of some files into it. Any file will do initially, but later examples require graphic files (such as JPEG, PNG, or similar). You can create the folder and copy files into it using a file manager or in the terminal: - - -``` -$ mkdir example -$ cp ~/Pictures/vacation/*.{png,jpg} example -``` - -Change directory to your new folder, then list the files in it to confirm that your test environment is what you expect: - - -``` -$ cd example -$ ls -1 -cat.jpg -design_maori.png -otago.jpg -waterfall.png -``` - -The syntax to loop through each file individually in a loop is: create a variable ( **f** for file, for example). Then define the data set you want the variable to cycle through. In this case, cycle through all files in the current directory using the ***** wildcard character (the ***** wildcard matches _everything_ ). Then terminate this introductory clause with a semicolon ( **;** ). - - -``` -`$ for f in * ;` -``` - -Depending on your preference, you can choose to press **Return** here. The shell won't try to execute the loop until it is syntactically complete. - -Next, define what you want to happen with each iteration of the loop. For simplicity, use the **file** command to get a little bit of data about each file, represented by the **f** variable (but prepended with a **$** to tell the shell to swap out the value of the variable for whatever the variable currently contains): - - -``` -`do file $f ;` -``` - -Terminate the clause with another semi-colon and close the loop: - - -``` -`done` -``` - -Press **Return** to start the shell cycling through _everything_ in the current directory. The **for** loop assigns each file, one by one, to the variable **f** and runs your command: - - -``` -$ for f in * ; do -> file $f ; -> done -cat.jpg: JPEG image data, EXIF standard 2.2 -design_maori.png: PNG image data, 4608 x 2592, 8-bit/color RGB, non-interlaced -otago.jpg: JPEG image data, EXIF standard 2.2 -waterfall.png: PNG image data, 4608 x 2592, 8-bit/color RGB, non-interlaced -``` - -You can also write it this way: - - -``` -$ for f in *; do file $f; done -cat.jpg: JPEG image data, EXIF standard 2.2 -design_maori.png: PNG image data, 4608 x 2592, 8-bit/color RGB, non-interlaced -otago.jpg: JPEG image data, EXIF standard 2.2 -waterfall.png: PNG image data, 4608 x 2592, 8-bit/color RGB, non-interlaced -``` - -Both the multi-line and single-line formats are the same to your shell and produce the exact same results. - -### A practical example - -Here's a practical example of how a loop can be useful for everyday computing. Assume you have a collection of vacation photos you want to send to friends. Your photo files are huge, making them too large to email and inconvenient to upload to your [photo-sharing service][2]. You want to create smaller web-versions of your photos, but you have 100 photos and don't want to spend the time reducing each photo, one by one. - -First, install the **ImageMagick** command using your package manager on Linux, BSD, or Mac. For instance, on Fedora and RHEL: - - -``` -`$ sudo dnf install ImageMagick` -``` - -On Ubuntu or Debian: - - -``` -`$ sudo apt install ImageMagick` -``` - -On BSD, use **ports** or [pkgsrc][3]. On Mac, use [Homebrew][4] or [MacPorts][5]. - -Once you install ImageMagick, you have a set of new commands to operate on photos. - -Create a destination directory for the files you're about to create: - - -``` -`$ mkdir tmp` -``` - -To reduce each photo to 33% of its original size, try this loop: - - -``` -`$ for f in * ; do convert $f -scale 33% tmp/$f ; done` -``` - -Then look in the **tmp** folder to see your scaled photos. - -You can use any number of commands within a loop, so if you need to perform complex actions on a batch of files, you can place your whole workflow between the **do** and **done** statements of a **for** loop. For example, suppose you want to copy each processed photo straight to a shared photo directory on your web host and remove the photo file from your local system: - - -``` -$ for f in * ; do -convert $f -scale 33% tmp/$f -scp -i seth_web tmp/$f [seth@example.com][6]:~/public_html -trash tmp/$f ; -done -``` - -For each file processed by the **for** loop, your computer automatically runs three commands. This means if you process just 10 photos this way, you save yourself 30 commands and probably at least as many minutes. - -### Limiting your loop - -A loop doesn't always have to look at every file. You might want to process only the JPEG files in your example directory: - - -``` -$ for f in *.jpg ; do convert $f -scale 33% tmp/$f ; done -$ ls -m tmp -cat.jpg, otago.jpg -``` - -Or, instead of processing files, you may need to repeat an action a specific number of times. A **for** loop's variable is defined by whatever data you provide it, so you can create a loop that iterates over numbers instead of files: - - -``` -$ for n in {0..4}; do echo $n ; done -0 -1 -2 -3 -4 -``` - -### More looping - -You now know enough to create your own loops. Until you're comfortable with looping, use them on _copies_ of the files you want to process and, as often as possible, use commands with built-in safeguards to prevent you from clobbering your data and making irreparable mistakes, like accidentally renaming an entire directory of files to the same name, each overwriting the other. - -For advanced **for** loop topics, read on. - -### Not all shells are Bash - -The **for** keyword is built into the Bash shell. Many similar shells use the same keyword and syntax, but some shells, like [tcsh][7], use a different keyword, like **foreach** , instead. - -In tcsh, the syntax is similar in spirit but more strict than Bash. In the following code sample, do not type the string **foreach?** in lines 2 and 3. It is a secondary prompt alerting you that you are still in the process of building your loop. - - -``` -$ foreach f (*) -foreach? file $f -foreach? end -cat.jpg: JPEG image data, EXIF standard 2.2 -design_maori.png: PNG image data, 4608 x 2592, 8-bit/color RGB, non-interlaced -otago.jpg: JPEG image data, EXIF standard 2.2 -waterfall.png: PNG image data, 4608 x 2592, 8-bit/color RGB, non-interlaced -``` - -In tcsh, both **foreach** and **end** must appear alone on separate lines, so you cannot create a **for** loop on one line as you can with Bash and similar shells. - -### For loops with the find command - -In theory, you could find a shell that doesn't provide a **for** loop function, or you may just prefer to use a different command with added features. - -The **find** command is another way to implement the functionality of a **for** loop, as it offers several ways to define the scope of which files to include in your loop as well as options for [Parallel][8] processing. - -The **find** command is meant to help you find files on your hard drives. Its syntax is simple: you provide the path of the location you want to search, and **find** finds all files and directories: - - -``` -$ find . -. -./cat.jpg -./design_maori.png -./otago.jpg -./waterfall.png -``` - -You can filter the search results by adding some portion of the name: - - -``` -$ find . -name "*jpg" -./cat.jpg -./otago.jpg -``` - -The great thing about **find** is that each file it finds can be fed into a loop using the **-exec** flag. For instance, to scale down only the PNG photos in your example directory: - - -``` -$ find . -name "*png" -exec convert {} -scale 33% tmp/{} \; -$ ls -m tmp -design_maori.png, waterfall.png -``` - -In the **-exec** clause, the bracket characters **{}** stand in for whatever item **find** is processing (in other words, any file ending in PNG that has been located, one at a time). The **-exec** clause must be terminated with a semicolon, but Bash usually tries to use the semicolon for itself. You "escape" the semicolon with a backslash ( **\;** ) so that **find** knows to treat that semicolon as its terminating character. - -The **find** command is very good at what it does, and it can be too good sometimes. For instance, if you reuse it to find PNG files for another photo process, you will get a few errors: - - -``` -$ find . -name "*png" -exec convert {} -flip -flop tmp/{} \; -convert: unable to open image `tmp/./tmp/design_maori.png': -No such file or directory @ error/blob.c/OpenBlob/2643. -... -``` - -It seems that **find** has located all the PNG files—not only the ones in your current directory ( **.** ) but also those that you processed before and placed in your **tmp** subdirectory. In some cases, you may want **find** to search the current directory plus all other directories within it (and all directories in _those_ ). It can be a powerful recursive processing tool, especially in complex file structures (like directories of music artists containing directories of albums filled with music files), but you can limit this with the **-maxdepth** option. - -To find only PNG files in the current directory (excluding subdirectories): - - -``` -`$ find . -maxdepth 1 -name "*png"` -``` - -To find and process files in the current directory plus an additional level of subdirectories, increment the maximum depth by 1: - - -``` -`$ find . -maxdepth 2 -name "*png"` -``` - -Its default is to descend into all subdirectories. - -### Looping for fun and profit - -The more you use loops, the more time and effort you save, and the bigger the tasks you can tackle. You're just one user, but with a well-thought-out loop, you can make your computer do the hard work. - -You can and should treat looping like any other command, keeping it close at hand for when you need to repeat a single action or two on several files. However, it's also a legitimate gateway to serious programming, so if you have to accomplish a complex task on any number of files, take a moment out of your day to plan out your workflow. If you can achieve your goal on one file, then wrapping that repeatable process in a **for** loop is relatively simple, and the only "programming" required is an understanding of how variables work and enough organization to separate unprocessed from processed files. With a little practice, you can move from a Linux user to a Linux user who knows how to write a loop, so get out there and make your computer work for you! - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/19/6/how-write-loop-bash - -作者:[Seth Kenlon][a] -选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]: https://opensource.com/users/seth/users/goncasousa/users/howtopamm/users/howtopamm/users/seth/users/wavesailor/users/seth -[b]: https://github.com/lujun9972 -[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/bash_command_line.png?itok=k4z94W2U (bash logo on green background) -[2]: http://nextcloud.com -[3]: http://pkgsrc.org -[4]: http://brew.sh -[5]: https://www.macports.org -[6]: mailto:seth@example.com -[7]: https://en.wikipedia.org/wiki/Tcsh -[8]: https://opensource.com/article/18/5/gnu-parallel diff --git a/sources/tech/20190612 Why use GraphQL.md b/sources/tech/20190612 Why use GraphQL.md deleted file mode 100644 index ad0d3a0056..0000000000 --- a/sources/tech/20190612 Why use GraphQL.md +++ /dev/null @@ -1,97 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: ( ) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Why use GraphQL?) -[#]: via: (https://opensource.com/article/19/6/why-use-graphql) -[#]: author: (Zach Lendon https://opensource.com/users/zachlendon/users/goncasousa/users/patrickhousley) - -Why use GraphQL? -====== -Here's why GraphQL is gaining ground on standard REST API technology. -![][1] - -[GraphQL][2], as I wrote [previously][3], is a next-generation API technology that is transforming both how client applications communicate with backend systems and how backend systems are designed. - -As a result of the support that began with the organization that founded it, Facebook, and continues with the backing of other technology giants such as Github, Twitter, and AirBnB, GraphQL's place as a linchpin technology for application systems seems secure; both now and long into the future. - -### GraphQL's ascent - -The rise in importance of mobile application performance and organizational agility has provided booster rockets for GraphQL's ascent to the top of modern enterprise architectures. - -Given that [REST][4] is a wildly popular architectural style that already allows mechanisms for data interaction, what advantages does this new technology provide over [REST][4]? The ‘QL’ in GraphQL stands for query language, and that is a great place to start. - -The ease at which different client applications within an organization can query only the data they need with GraphQL usurps alternative REST approaches and delivers real-world application performance boosts. With traditional [REST][4] API endpoints, client applications interrogate a server resource, and receive a response containing all the data that matches the request. If a successful response from a [REST][4] API endpoint returns 35 fields, the client application receives 35 fields - -### Fetching problems - -[REST][4] APIs traditionally provide no clean way for client applications to retrieve or update only the data they care about. This is often described as the “over-fetching” problem. With the prevalence of mobile applications in people’s day to day lives, the over-fetching problem has real world consequences. Every request a mobile application needs to make, every byte it has to send and receive, has an increasingly negative performance impact for end users. Users with slower data connections are particularly affected by suboptimal API design choices. Customers who experience poor performance using mobile applications are more likely to not purchase products and use services. Inefficient API designs cost companies money. - -“Over-fetching” isn’t alone - it has a partner in crime - “under-fetching”. Endpoints that, by default, return only a portion of the data a client actually needs require clients to make additional calls to satisfy their data needs - which requires additional HTTP requests. Because of the over and under fetching problems and their impact on client application performance, an API technology that facilitates efficient fetching has a chance to catch fire in the marketplace - and GraphQL has boldly jumped in and filled that void. - -### REST's response - -[REST][4] API designers, not willing to go down without a fight, have attempted to counter the mobile application performance problem through a mix of: - - * “include” and “exclude” query parameters, allowing client applications to specify which fields they want through a potentially long query format. - * “Composite” services, which combine multiple endpoints in a way that allow client applications to be more efficient in the number of requests they make and the data they receive. - - - -While these patterns are a valiant attempt by the [REST][4] API community to address challenges mobile clients face, they fall short in a few key regards, namely: - - * Include and exclude query key/value pairs quickly get messy, in particular for deeper object graphs that require a nested dot notation syntax (or similar) to target data to include and exclude. Additionally, debugging issues with the query string in this model often requires manually breaking up a URL. - * Server implementations for include and exclude queries are often custom, as there is no standard way for server-based applications to handle the use of include and exclude queries, just as there is no standard way for include and exclude queries to be defined. - * The rise of composite services creates more tightly coupled back-end and front-end systems, requiring increasing coordination to deliver projects and turning once agile projects back to waterfall. This coordination and coupling has the painful side effect of slowing organizational agility. Additionally, composite services are by definition, not RESTful. - - - -### GraphQL's genesis - -For Facebook, GraphQL’s genesis was a response to pain felt and experiences learned from an HTML5-based version of their flagship mobile application back in 2011-2012. Understanding that improved performance was paramount, Facebook engineers realized that they needed a new API design to ensure peak performance. Likely taking the above [REST][4] limitations into consideration, and with needing to support different needs of a number of API clients, one can begin to understand the early seeds of what led co-creators Lee Byron and Dan Schaeffer, Facebook employees at the time, to create what has become known as GraphQL. - -With what is often a single GraphQL endpoint, through the GraphQL query language, client applications are able to reduce, often significantly, the number of network calls they need to make, and ensure that they only are retrieving the data they need. In many ways, this harkens back to earlier models of web programming, where client application code would directly query back-end systems - some might remember writing SQL queries with JSTL on JSPs 10-15 years ago for example! - -The biggest difference now is with GraphQL, we have a specification that is implemented across a variety of client and server languages and libraries. And with GraphQL being an API technology, we have decoupled the back-end and front-end application systems by introducing an intermediary GraphQL application layer that provides a mechanism to access organizational data in a manner that aligns with an organization’s business domain(s). - -Beyond solving technical challenges experienced by software engineering teams, GraphQL has also been a boost to organizational agility, in particular in the enterprise. GraphQL-enabled organizational agility increases are commonly attributable to the following: - - * Rather than creating new endpoints when 1 or more new fields are needed by clients, GraphQL API designers and developers are able to include those fields in existing graph implementations, exposing new capabilities in a fashion that requires less development effort and less change across application systems. - * By encouraging API design teams to focus more on defining their object graph and be less focused on what client applications are delivering, the speed at which front-end and back-end software teams deliver solutions for customers has increasingly decoupled. - - - -### Considerations before adoption - -Despite GraphQL’s compelling benefits, GraphQL is not without its implementation challenges. A few examples include: - - * Caching mechanisms around [REST][4] APIs are much more mature. - * The patterns used to build APIs using [REST][4] are much more well established. - * While engineers may be more attracted to newer technologies like GraphQL, the talent pool in the marketplace is much broader for building [REST][4]-based solutions vs. GraphQL. - - - -### Conclusion - -By providing both a boost to performance and organizational agility, GraphQL's adoption by companies has skyrocketed in the past few years. It does, however, have some maturing to do in comparison to the RESTful ecosystem of API design. - -One of the great benefits of GraphQL is that it’s not designed as a wholesale replacement for alternative API solutions. Instead, GraphQL can be implemented to complement or enhance existing APIs. As a result, companies are encouraged to explore incrementally adopting GraphQL where it makes the most sense for them - where they find it has the greatest positive impact on application performance and organizational agility. - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/19/6/why-use-graphql - -作者:[Zach Lendon][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/zachlendon/users/goncasousa/users/patrickhousley -[b]: https://github.com/lujun9972 -[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/metrics_graph_stats_blue.png?itok=OKCc_60D -[2]: https://graphql.org/ -[3]: https://opensource.com/article/19/6/what-is-graphql -[4]: https://en.wikipedia.org/wiki/Representational_state_transfer diff --git a/sources/tech/20190620 How to use OpenSSL- Hashes, digital signatures, and more.md b/sources/tech/20190620 How to use OpenSSL- Hashes, digital signatures, and more.md deleted file mode 100644 index 724c97bc01..0000000000 --- a/sources/tech/20190620 How to use OpenSSL- Hashes, digital signatures, and more.md +++ /dev/null @@ -1,337 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: ( ) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (How to use OpenSSL: Hashes, digital signatures, and more) -[#]: via: (https://opensource.com/article/19/6/cryptography-basics-openssl-part-2) -[#]: author: (Marty Kalin https://opensource.com/users/mkalindepauledu) - -How to use OpenSSL: Hashes, digital signatures, and more -====== -Dig deeper into the details of cryptography with OpenSSL: Hashes, -digital signatures, digital certificates, and more -![A person working.][1] - -The [first article in this series][2] introduced hashes, encryption/decryption, digital signatures, and digital certificates through the OpenSSL libraries and command-line utilities. This second article drills down into the details. Let’s begin with hashes, which are ubiquitous in computing, and consider what makes a hash function _cryptographic_. - -### Cryptographic hashes - -The download page for the OpenSSL source code () contains a table with recent versions. Each version comes with two hash values: 160-bit SHA1 and 256-bit SHA256. These values can be used to verify that the downloaded file matches the original in the repository: The downloader recomputes the hash values locally on the downloaded file and then compares the results against the originals. Modern systems have utilities for computing such hashes. Linux, for instance, has **md5sum** and **sha256sum**. OpenSSL itself provides similar command-line utilities. - -Hashes are used in many areas of computing. For example, the Bitcoin blockchain uses SHA256 hash values as block identifiers. To mine a Bitcoin is to generate a SHA256 hash value that falls below a specified threshold, which means a hash value with at least N leading zeroes. (The value of N can go up or down depending on how productive the mining is at a particular time.) As a point of interest, today’s miners are hardware clusters designed for generating SHA256 hashes in parallel. During a peak time in 2018, Bitcoin miners worldwide generated about 75 million terahashes per second—yet another incomprehensible number. - -Network protocols use hash values as well—often under the name **checksum**—to support message integrity; that is, to assure that a received message is the same as the one sent. The message sender computes the message’s checksum and sends the results along with the message. The receiver recomputes the checksum when the message arrives. If the sent and the recomputed checksum do not match, then something happened to the message in transit, or to the sent checksum, or to both. In this case, the message and its checksum should be sent again, or at least an error condition should be raised. (Low-level network protocols such as UDP do not bother with checksums.) - -Other examples of hashes are familiar. Consider a website that requires users to authenticate with a password, which the user enters in their browser. Their password is then sent, encrypted, from the browser to the server via an HTTPS connection to the server. Once the password arrives at the server, it's decrypted for a database table lookup. - -What should be stored in this lookup table? Storing the passwords themselves is risky. It’s far less risky is to store a hash generated from a password, perhaps with some _salt_ (extra bits) added to taste before the hash value is computed. Your password may be sent to the web server, but the site can assure you that the password is not stored there. - -Hash values also occur in various areas of security. For example, hash-based message authentication code ([HMAC][3]) uses a hash value and a secret cryptographic key to authenticate a message sent over a network. HMAC codes, which are lightweight and easy to use in programs, are popular in web services. An X509 digital certificate includes a hash value known as the _fingerprint_, which can facilitate certificate verification. An in-memory truststore could be implemented as a lookup table keyed on such fingerprints—as a _hash map_, which supports constant-time lookups. The fingerprint from an incoming certificate can be compared against the truststore keys for a match. - -What special property should a _cryptographic hash function_ have? It should be _one-way_, which means very difficult to invert. A cryptographic hash function should be relatively straightforward to compute, but computing its inverse—the function that maps the hash value back to the input bitstring—should be computationally intractable. Here is a depiction, with **chf** as a cryptographic hash function and my password **foobar** as the sample input: - - -``` -        +---+ -foobar—>|chf|—>hash value ## straightforward -        +--–+ -``` - -By contrast, the inverse operation is infeasible: - - -``` -            +-----------+ -hash value—>|chf inverse|—>foobar ## intractable -            +-----------+ -``` - -Recall, for example, the SHA256 hash function. For an input bitstring of any length N > 0, this function generates a fixed-length hash value of 256 bits; hence, this hash value does not reveal even the input bitstring’s length N, let alone the value of each bit in the string. By the way, SHA256 is not susceptible to a [_length extension attack_][4]. The only effective way to reverse engineer a computed SHA256 hash value back to the input bitstring is through a brute-force search, which means trying every possible input bitstring until a match with the target hash value is found. Such a search is infeasible on a sound cryptographic hash function such as SHA256. - -Now, a final review point is in order. Cryptographic hash values are statistically rather than unconditionally unique, which means that it is unlikely but not impossible for two different input bitstrings to yield the same hash value—a _collision_. The [_birthday problem_][5] offers a nicely counter-intuitive example of collisions. There is extensive research on various hash algorithms’ _collision resistance_. For example, MD5 (128-bit hash values) has a breakdown in collision resistance after roughly 221 hashes. For SHA1 (160-bit hash values), the breakdown starts at about 261 hashes. - -A good estimate of the breakdown in collision resistance for SHA256 is not yet in hand. This fact is not surprising. SHA256 has a range of 2256 distinct hash values, a number whose decimal representation has a whopping 78 digits! So, can collisions occur with SHA256 hashing? Of course, but they are extremely unlikely. - -In the command-line examples that follow, two input files are used as bitstring sources: **hashIn1.txt** and **hashIn2.txt**. The first file contains **abc** and the second contains **1a2b3c**. - -These files contain text for readability, but binary files could be used instead. - -Using the Linux **sha256sum** utility on these two files at the command line—with the percent sign (**%**) as the prompt—produces the following hash values (in hex): - - -``` -% sha256sum hashIn1.txt -9e83e05bbf9b5db17ac0deec3b7ce6cba983f6dc50531c7a919f28d5fb3696c3 hashIn1.txt - -% sha256sum hashIn2.txt -3eaac518777682bf4e8840dd012c0b104c2e16009083877675f00e995906ed13 hashIn2.txt -``` - -The OpenSSL hashing counterparts yield the same results, as expected: - - -``` -% openssl dgst -sha256 hashIn1.txt -SHA256(hashIn1.txt)= 9e83e05bbf9b5db17ac0deec3b7ce6cba983f6dc50531c7a919f28d5fb3696c3 - -% openssl dgst -sha256 hashIn2.txt -SHA256(hashIn2.txt)= 3eaac518777682bf4e8840dd012c0b104c2e16009083877675f00e995906ed13 -``` - -This examination of cryptographic hash functions sets up a closer look at digital signatures and their relationship to key pairs. - -### Digital signatures - -As the name suggests, a digital signature can be attached to a document or some other electronic artifact (e.g., a program) to vouch for its authenticity. Such a signature is thus analogous to a hand-written signature on a paper document. To verify the digital signature is to confirm two things. First, that the vouched-for artifact has not changed since the signature was attached because it is based, in part, on a cryptographic _hash_ of the document. Second, that the signature belongs to the person (e.g., Alice) who alone has access to the private key in a pair. By the way, digitally signing code (source or compiled) has become a common practice among programmers. - -Let’s walk through how a digital signature is created. As mentioned before, there is no digital signature without a public and private key pair. When using OpenSSL to create these keys, there are two separate commands: one to create a private key, and another to extract the matching public key from the private one. These key pairs are encoded in base64, and their sizes can be specified during this process. - -The private key consists of numeric values, two of which (a _modulus_ and an _exponent_) make up the public key. Although the private key file contains the public key, the extracted public key does _not_ reveal the value of the corresponding private key. - -The resulting file with the private key thus contains the full key pair. Extracting the public key into its own file is practical because the two keys have distinct uses, but this extraction also minimizes the danger that the private key might be publicized by accident. - -Next, the pair’s private key is used to process a hash value for the target artifact (e.g., an email), thereby creating the signature. On the other end, the receiver’s system uses the pair’s public key to verify the signature attached to the artifact. - -Now for an example. To begin, generate a 2048-bit RSA key pair with OpenSSL: - -**openssl genpkey -out privkey.pem -algorithm rsa 2048** - -We can drop the **-algorithm rsa** flag in this example because **genpkey** defaults to the type RSA. The file’s name (**privkey.pem**) is arbitrary, but the Privacy Enhanced Mail (PEM) extension **pem** is customary for the default PEM format. (OpenSSL has commands to convert among formats if needed.) If a larger key size (e.g., 4096) is in order, then the last argument of **2048** could be changed to **4096**. These sizes are always powers of two. - -Here’s a slice of the resulting **privkey.pem** file, which is in base64: - - -``` -\-----BEGIN PRIVATE KEY----- -MIICdgIBADANBgkqhkiG9w0BAQEFAASCAmAwggJcAgEAAoGBANnlAh4jSKgcNj/Z -JF4J4WdhkljP2R+TXVGuKVRtPkGAiLWE4BDbgsyKVLfs2EdjKL1U+/qtfhYsqhkK -… -\-----END PRIVATE KEY----- -``` - -The next command then extracts the pair’s public key from the private one: - -**openssl rsa -in privkey.pem -outform PEM -pubout -out pubkey.pem** - -The resulting **pubkey.pem** file is small enough to show here in full: - - -``` -\-----BEGIN PUBLIC KEY----- -MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDZ5QIeI0ioHDY/2SReCeFnYZJY -z9kfk11RrilUbT5BgIi1hOAQ24LMilS37NhHYyi9VPv6rX4WLKoZCmkeYaWk/TR5 -4nbH1E/AkniwRoXpeh5VncwWMuMsL5qPWGY8fuuTE27GhwqBiKQGBOmU+MYlZonO -O0xnAKpAvysMy7G7qQIDAQAB -\-----END PUBLIC KEY----- -``` - -Now, with the key pair at hand, the digital signing is easy—in this case with the source file **client.c** as the artifact to be signed: - -**openssl dgst -sha256 -sign privkey.pem -out sign.sha256 client.c** - -The digest for the **client.c** source file is SHA256, and the private key resides in the **privkey.pem** file created earlier. The resulting binary signature file is **sign.sha256**, an arbitrary name. To get a readable (if base64) version of this file, the follow-up command is: - -**openssl enc -base64 -in sign.sha256 -out sign.sha256.base64** - -The file **sign.sha256.base64** now contains: - - -``` -h+e+3UPx++KKSlWKIk34fQ1g91XKHOGFRmjc0ZHPEyyjP6/lJ05SfjpAJxAPm075 -VNfFwysvqRGmL0jkp/TTdwnDTwt756Ej4X3OwAVeYM7i5DCcjVsQf5+h7JycHKlM -o/Jd3kUIWUkZ8+Lk0ZwzNzhKJu6LM5KWtL+MhJ2DpVc= -``` - -Or, the executable file **client** could be signed instead, and the resulting base64-encoded signature would differ as expected: - - -``` -VMVImPgVLKHxVBapJ8DgLNJUKb98GbXgehRPD8o0ImADhLqlEKVy0HKRm/51m9IX -xRAN7DoL4Q3uuVmWWi749Vampong/uT5qjgVNTnRt9jON112fzchgEoMb8CHNsCT -XIMdyaPtnJZdLALw6rwMM55MoLamSc6M/MV1OrJnk/g= -``` - -The final step in this process is to verify the digital signature with the public key. The hash used to sign the artifact (in this case, the executable **client** program) should be recomputed as an essential step in the verification since the verification process should indicate whether the artifact has changed since being signed. - -There are two OpenSSL commands used for this purpose. The first decodes the base64 signature: - -**openssl enc -base64 -d -in sign.sha256.base64 -out sign.sha256** - -The second verifies the signature: - -**openssl dgst -sha256 -verify pubkey.pem -signature sign.sha256 client** - -The output from this second command is, as it should be: - - -``` -`Verified OK` -``` - -To understand what happens when verification fails, a short but useful exercise is to replace the executable **client** file in the last OpenSSL command with the source file **client.c** and then try to verify. Another exercise is to change the **client** program, however slightly, and try again. - -### Digital certificates - -A digital certificate brings together the pieces analyzed so far: hash values, key pairs, digital signatures, and encryption/decryption. The first step toward a production-grade certificate is to create a certificate signing request (CSR), which is then sent to a certificate authority (CA). To do this for the example with OpenSSL, run: - -**openssl req -out myserver.csr -new -newkey rsa:4096 -nodes -keyout myserverkey.pem** - -This example generates a CSR document and stores the document in the file **myserver.csr** (base64 text). The purpose here is this: the CSR document requests that the CA vouch for the identity associated with the specified domain name—the common name (CN) in CA-speak. - -A new key pair also is generated by this command, although an existing pair could be used. Note that the use of **server** in names such as **myserver.csr** and **myserverkey.pem** hints at the typical use of digital certificates: as vouchers for the identity of a web server associated with a domain such as [www.google.com][6]. - -The same command, however, creates a CSR regardless of how the digital certificate might be used. It also starts an interactive question/answer session that prompts for relevant information about the domain name to link with the requester’s digital certificate. This interactive session can be short-circuited by providing the essentials as part of the command, with backslashes as continuations across line breaks. The **-subj** flag introduces the required information: - - -``` -% openssl req -new --newkey rsa:2048 -nodes -keyout privkeyDC.pem --out myserver.csr --subj "/C=US/ST=Illinois/L=Chicago/O=Faulty Consulting/OU=IT/CN=myserver.com" -``` - -The resulting CSR document can be inspected and verified before being sent to a CA. This process creates the digital certificate with the desired format (e.g., X509), signature, validity dates, and so on: - -**openssl req -text -in myserver.csr -noout -verify** - -Here’s a slice of the output: - - -``` -verify OK -Certificate Request: -Data: -Version: 0 (0x0) -Subject: C=US, ST=Illinois, L=Chicago, O=Faulty Consulting, OU=IT, CN=myserver.com -Subject Public Key Info: -Public Key Algorithm: rsaEncryption -Public-Key: (2048 bit) -Modulus: -00:ba:36:fb:57:17:65:bc:40:30:96:1b:6e🇩🇪73: -… -Exponent: 65537 (0x10001) -Attributes: -a0:00 -Signature Algorithm: sha256WithRSAEncryption -… -``` - -### A self-signed certificate - -During the development of an HTTPS web site, it is convenient to have a digital certificate on hand without going through the CA process. A self-signed certificate fills the bill during the HTTPS handshake’s authentication phase, although any modern browser warns that such a certificate is worthless. Continuing the example, the OpenSSL command for a self-signed certificate—valid for a year and with an RSA public key—is: - -**openssl req -x509 -sha256 -nodes -days 365 -newkey rsa:4096 -keyout myserver.pem -out myserver.crt** - -The OpenSSL command below presents a readable version of the generated certificate: - -**openssl x509 -in myserver.crt -text -noout** - -Here’s part of the output for the self-signed certificate: - - -``` -Certificate: -Data: -Version: 3 (0x2) -Serial Number: 13951598013130016090 (0xc19e087965a9055a) -Signature Algorithm: sha256WithRSAEncryption -Issuer: C=US, ST=Illinois, L=Chicago, O=Faulty Consulting, OU=IT, CN=myserver.com -Validity -Not Before: Apr 11 17:22:18 2019 GMT -Not After : Apr 10 17:22:18 2020 GMT -Subject: C=US, ST=Illinois, L=Chicago, O=Faulty Consulting, OU=IT, CN=myserver.com -Subject Public Key Info: -Public Key Algorithm: rsaEncryption -Public-Key: (4096 bit) -Modulus: -00:ba:36:fb:57:17:65:bc:40:30:96:1b:6e🇩🇪73: -… -Exponent: 65537 (0x10001) -X509v3 extensions: -X509v3 Subject Key Identifier: -3A:32:EF:3D:EB:DF:65:E5:A8:96:D7:D7:16:2C:1B:29:AF:46:C4:91 -X509v3 Authority Key Identifier: -keyid:3A:32:EF:3D:EB:DF:65:E5:A8:96:D7:D7:16:2C:1B:29:AF:46:C4:91 - -        X509v3 Basic Constraints: -            CA:TRUE -Signature Algorithm: sha256WithRSAEncryption -     3a:eb:8d:09:53:3b:5c:2e:48:ed:14:ce:f9:20:01:4e:90:c9: -     ... -``` - -As mentioned earlier, an RSA private key contains values from which the public key is generated. However, a given public key does _not_ give away the matching private key. For an introduction to the underlying mathematics, see . - -There is an important correspondence between a digital certificate and the key pair used to generate the certificate, even if the certificate is only self-signed: - - * The digital certificate contains the _exponent_ and _modulus_ values that make up the public key. These values are part of the key pair in the originally-generated PEM file, in this case, the file **myserver.pem**. - * The exponent is almost always 65,537 (as in this case) and so can be ignored. - * The modulus from the key pair should match the modulus from the digital certificate. - - - -The modulus is a large value and, for readability, can be hashed. Here are two OpenSSL commands that check for the same modulus, thereby confirming that the digital certificate is based upon the key pair in the PEM file: - - -``` -% openssl x509 -noout -modulus -in myserver.crt | openssl sha1 ## modulus from CRT -(stdin)= 364d21d5e53a59d482395b1885aa2c3a5d2e3769 - -% openssl rsa -noout -modulus -in myserver.pem | openssl sha1 ## modulus from PEM -(stdin)= 364d21d5e53a59d482395b1885aa2c3a5d2e3769 -``` - -The resulting hash values match, thereby confirming that the digital certificate is based upon the specified key pair. - -### Back to the key distribution problem - -Let’s return to an issue raised at the end of Part 1: the TLS handshake between the **client** program and the Google web server. There are various handshake protocols, and even the Diffie-Hellman version at work in the **client** example offers wiggle room. Nonetheless, the **client** example follows a common pattern. - -To start, during the TLS handshake, the **client** program and the web server agree on a cipher suite, which consists of the algorithms to use. In this case, the suite is **ECDHE-RSA-AES128-GCM-SHA256**. - -The two elements of interest now are the RSA key-pair algorithm and the AES128 block cipher used for encrypting and decrypting messages if the handshake succeeds. Regarding encryption/decryption, this process comes in two flavors: symmetric and asymmetric. In the symmetric flavor, the _same_ key is used to encrypt and decrypt, which raises the _key distribution problem_ in the first place: How is the key to be distributed securely to both parties? In the asymmetric flavor, one key is used to encrypt (in this case, the RSA public key) but a different key is used to decrypt (in this case, the RSA private key from the same pair). - -The **client** program has the Google web server’s public key from an authenticating certificate, and the web server has the private key from the same pair. Accordingly, the **client** program can send an encrypted message to the web server, which alone can readily decrypt this message. - -In the TLS situation, the symmetric approach has two significant advantages: - - * In the interaction between the **client** program and the Google web server, the authentication is one-way. The Google web server sends three certificates to the **client** program, but the **client** program does not send a certificate to the web server; hence, the web server has no public key from the client and can’t encrypt messages to the client. - * Symmetric encryption/decryption with AES128 is nearly a _thousand times faster_ than the asymmetric alternative using RSA keys. - - - -The TLS handshake combines the two flavors of encryption/decryption in a clever way. During the handshake, the **client** program generates random bits known as the pre-master secret (PMS). Then the **client** program encrypts the PMS with the server’s public key and sends the encrypted PMS to the server, which in turn decrypts the PMS message with its private key from the RSA pair: - - -``` -              +-------------------+ encrypted PMS  +--------------------+ -client PMS--->|server’s public key|--------------->|server’s private key|--->server PMS -              +-------------------+                +--------------------+ -``` - -At the end of this process, the **client** program and the Google web server now have the same PMS bits. Each side uses these bits to generate a _master secret_ and, in short order, a symmetric encryption/decryption key known as the _session key_. There are now two distinct but identical session keys, one on each side of the connection. In the **client** example, the session key is of the AES128 variety. Once generated on both the **client** program’s and Google web server’s sides, the session key on each side keeps the conversation between the two sides confidential. A handshake protocol such as Diffie-Hellman allows the entire PMS process to be repeated if either side (e.g., the **client** program) or the other (in this case, the Google web server) calls for a restart of the handshake. - -### Wrapping up - -The OpenSSL operations illustrated at the command line are available, too, through the API for the underlying libraries. These two articles have emphasized the utilities to keep the examples short and to focus on the cryptographic topics. If you have an interest in security issues, OpenSSL is a fine place to start—and to stay. - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/19/6/cryptography-basics-openssl-part-2 - -作者:[Marty Kalin][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/mkalindepauledu -[b]: https://github.com/lujun9972 -[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/rh_003784_02_os.comcareers_os_rh2x.png?itok=jbRfXinl (A person working.) -[2]: https://opensource.com/article/19/6/cryptography-basics-openssl-part-1 -[3]: https://en.wikipedia.org/wiki/HMAC -[4]: https://en.wikipedia.org/wiki/Length_extension_attack -[5]: https://en.wikipedia.org/wiki/Birthday_problem -[6]: http://www.google.com diff --git a/sources/tech/20190624 Book Review- A Byte of Vim.md b/sources/tech/20190624 Book Review- A Byte of Vim.md deleted file mode 100644 index e221a3bc6f..0000000000 --- a/sources/tech/20190624 Book Review- A Byte of Vim.md +++ /dev/null @@ -1,99 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: ( ) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Book Review: A Byte of Vim) -[#]: via: (https://itsfoss.com/book-review-a-byte-of-vim/) -[#]: author: (John Paul https://itsfoss.com/author/john/) - -Book Review: A Byte of Vim -====== - -[Vim][1] is a tool that is both simple and very powerful. Most new users will be intimidated by it because it doesn’t ‘work’ like regular graphical text editors. The ‘unusual’ keyboard shortcuts makes people wonder about [how to save and exit Vim][2]. But once you master Vim, there is nothing like it. - -There are numerous [Vim resources available online][3]. We have covered some Vim tricks on It’s FOSS as well. Apart from online resources, plenty of books have been dedicated to this editor as well. Today, we will look at one of such book that is designed to make Vim easy for most users to understand. The book we will be discussing is [A Byte of Vim][4] by [Swaroop C H][5]. - -The author [Swaroop C H][6] has worked in computing for over a decade. He previously worked at Yahoo and Adobe. Out of college, he made money by selling Linux CDs. He started a number of businesses, including an iPod charger named ion. He is currently an engineering manager for the AI team at [Helpshift][7]. - -### A Byte of Vim - -![][8] - -Like all good books, A Byte of Vim starts by talking about what Vim is: “a computer program used for writing any kind of text”. He does on to say, “What makes Vim special is that it is one of those few software which is both simple and powerful.” - -Before diving into telling how to use Vim, Swaroop tells the reader how to install Vim for Windows, Mac, Linux, and BSD. Once the installation is complete, he runs you through how to launch Vim and how to create your first file. - -Next, Swaroop discusses the different modes of Vim and how to navigate around your document using Vim’s keyboard shortcuts. This is followed by the basics of editing a document with Vim, including the Vim version of cut/copy/paste and undo/redo. - -Once the editing basics are covered, Swaroop talks about using Vim to edit multiple parts of a single document. You can also multiple tabs and windows to edit multiple documents at the same time. - -[][9] - -Suggested read  Bring Your Old Computer Back to Life With 4MLinux - -The book also covers extending the functionality of Vim through scripting and installing plugins. There are two ways to using scripts in Vim, use Vim’s built-in scripting language or using a programming language like Python or Perl to access Vim’s internals. There are five types of Vim plugins that can be written or downloaded: vimrc, global plugin, filetype plugin, syntax highlighting plugin, and compiler plugin. - -In a separate section, Swaroop C H covers the features of Vim that make it good for programming. These features include syntax highlighting, smart indentation, support for shell commands, omnicompletion, and the ability to be used as an IDE. - -#### Getting the ‘A Byte of Vim’ book and contributing to it - -A Byte of Book is licensed under [Creative Commons 4.0][10]. You can read an online version of the book for free on [the author’s website][4]. You can also download a [PDF][11], [Epub][12], or [Mobi][13] for free. - -[Get A Byte of Vim for FREE][4] - -If you prefer reading a [hard copy][14], you have that option, as well. - -Please note that the _**original version of A Byte of Vim was written in 2008**_ and converted to PDf. Unfortunately, Swaroop C H lost the original source files and he is working to convert the book to [Markdown][15]. If you would like to help, please visit the [book’s GitHub page][16]. - -Preview | Product | Price | ----|---|---|--- -![Mastering Vim Quickly: From WTF to OMG in no time][17] ![Mastering Vim Quickly: From WTF to OMG in no time][17] | [Mastering Vim Quickly: From WTF to OMG in no time][18] | $34.00[][19] | [Buy on Amazon][20] - -#### Conclusion - -When I first stared into the angry maw that is Vim, I did not have a clue what to do. I wish that I had known about A Byte of Vim then. This book is a good resource for anyone learning about Linux, especially if you are getting into the command line. - -Have you read [A Byte of Vim][4] by Swaroop C H? If yes, how do you find it? If not, what is your favorite book on an open source topic? Let us know in the comments below. - -[][21] - -Suggested read  Iridium Browser: A Browser for the Privacy Conscious - -If you found this article interesting, please take a minute to share it on social media, Hacker News or [Reddit][22]. - --------------------------------------------------------------------------------- - -via: https://itsfoss.com/book-review-a-byte-of-vim/ - -作者:[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.vim.org/ -[2]: https://itsfoss.com/how-to-exit-vim/ -[3]: https://linuxhandbook.com/basic-vim-commands/ -[4]: https://vim.swaroopch.com/ -[5]: https://swaroopch.com/ -[6]: https://swaroopch.com/about/ -[7]: https://www.helpshift.com/ -[8]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2019/06/Byte-of-vim-book.png?resize=800%2C450&ssl=1 -[9]: https://itsfoss.com/4mlinux-review/ -[10]: https://creativecommons.org/licenses/by/4.0/ -[11]: https://www.gitbook.com/download/pdf/book/swaroopch/byte-of-vim -[12]: https://www.gitbook.com/download/epub/book/swaroopch/byte-of-vim -[13]: https://www.gitbook.com/download/mobi/book/swaroopch/byte-of-vim -[14]: https://swaroopch.com/buybook/ -[15]: https://itsfoss.com/best-markdown-editors-linux/ -[16]: https://github.com/swaroopch/byte-of-vim#status-incomplete -[17]: https://i2.wp.com/images-na.ssl-images-amazon.com/images/I/41itW8furUL._SL160_.jpg?ssl=1 -[18]: https://www.amazon.com/Mastering-Vim-Quickly-WTF-time/dp/1983325740?SubscriptionId=AKIAJ3N3QBK3ZHDGU54Q&tag=chmod7mediate-20&linkCode=xm2&camp=2025&creative=165953&creativeASIN=1983325740 (Mastering Vim Quickly: From WTF to OMG in no time) -[19]: https://www.amazon.com/gp/prime/?tag=chmod7mediate-20 (Amazon Prime) -[20]: https://www.amazon.com/Mastering-Vim-Quickly-WTF-time/dp/1983325740?SubscriptionId=AKIAJ3N3QBK3ZHDGU54Q&tag=chmod7mediate-20&linkCode=xm2&camp=2025&creative=165953&creativeASIN=1983325740 (Buy on Amazon) -[21]: https://itsfoss.com/iridium-browser-review/ -[22]: http://reddit.com/r/linuxusersgroup diff --git a/sources/tech/20190702 One CI-CD pipeline per product to rule them all.md b/sources/tech/20190702 One CI-CD pipeline per product to rule them all.md deleted file mode 100644 index 2a7fcb31de..0000000000 --- a/sources/tech/20190702 One CI-CD pipeline per product to rule them all.md +++ /dev/null @@ -1,136 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: ( ) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (One CI/CD pipeline per product to rule them all) -[#]: via: (https://opensource.com/article/19/7/cicd-pipeline-rule-them-all) -[#]: author: (Willy-Peter Schaub https://opensource.com/users/wpschaub/users/bclaster/users/matt-micene/users/barkerd427) - -One CI/CD pipeline per product to rule them all -====== -Is the idea of a unified continuous integration and delivery pipeline a -pipe dream? -![An intersection of pipes.][1] - -When I joined the cloud ops team, responsible for cloud operations and engineering process streamlining, at WorkSafeBC, I shared my dream for one instrumented pipeline, with one continuous integration build and continuous deliveries for every product. - -According to Lukas Klose, [flow][2] (within the context of software engineering) is "the state of when a system produces value at a steady and predictable rate." I think it is one of the greatest challenges and opportunities, especially in the complex domain of emergent solutions. Strive towards a continuous and incremental delivery model with consistent, efficient, and quality solutions, building the right things and delighting our users. Find ways to break down our systems into smaller pieces that are valuable on their own, enabling teams to deliver value incrementally. This requires a change of mindset for both business and engineering. - -### Continuous integration and delivery (CI/CD) pipeline - -The CI/CD pipeline is a DevOps practice for delivering code changes more often, consistently, and reliably. It enables agile teams to increase _deployment frequency_ and decrease _lead time for change_, _change-failure rate_, and _mean time to recovery_ key performance indicators (KPIs), thereby improving _quality_ and delivering _value_ faster. The only prerequisites are a solid development process, a mindset for quality and accountability for features from ideation to deprecation, and a comprehensive pipeline (as illustrated below). - -![Prerequisites for a solid development process][3] - -It streamlines the engineering process and products to stabilize infrastructure environments; optimize flow; and create consistent, repeatable, and automated tasks. This enables us to turn complex tasks into complicated tasks, as outlined by Dave Snowden's [Cynefin Sensemaking][4] model, reducing maintenance costs and increasing quality and reliability. - -Part of streamlining our flow is to minimize waste for the [wasteful practice types][5] Muri (overloaded), Mura (variation), and Muda (waste). - - * **Muri:** avoid over-engineering, features that do not link to business value, and excessive documentation - * **Mura:** improve approval and validation processes (e.g., security signoffs); drive the [shift-left][6] initiative to push unit testing, security vulnerability scanning, and code quality inspection; and improve risk assessment - * **Muda:** avoid waste such as technical debt, bugs, and upfront, detailed documentation - - - -It appears that 80% of the focus and intention is on products that provide an integrated and collaborative engineering system that can take an idea and plan, develop, test, and monitor your solutions. However, a successful transformation and engineering system is only 5% about products, 15% about process, and 80% about people. - -There are many products at our disposal. For example, Azure DevOps offers rich support for continuous integration (CI), continuous delivery (CD), extensibility, and integration with open source and commercial off-the-shelve (COTS) software as a service (SaaS) solutions such as Stryker, SonarQube, WhiteSource, Jenkins, and Octopus. For engineers, it is always a temptation to focus on products, but remember that they are only 5% of our journey. - -![5% about products, 15% about process, 80% about people][7] - -The biggest challenge is breaking down a process based on decades of rules, regulations, and frustrating areas of comfort: "_It is how we have always done it; why change?_"  - -The friction between people in development and operation results in a variety of fragmented, duplicated, and incessant integration and delivery pipelines. Development wants access to everything, to iterate continuously, to enable users, and to release continuously and fast. Operations wants to lock down everything to protect the business and users and drive quality. This inadvertently and often entails processes and governance that are hard to automate, which results in slower-than-expected release cycles. - -Let us explore the pipeline with snippets from a recent whiteboard discussion. - -The variation of pipelines is difficult and costly to support; the inconsistency of versioning and traceability complicates live site incidents, and continuous streamlining of the development process and pipelines is a challenge. - -![Improving quality and visibility of pipelines][8] - -I advocate a few principles that enable one universal pipeline per product: - - * Automate everything automatable - * Build once - * Maintain continuous integration and delivery - * Maintain continuous streamlining and improvement - * Maintain one build definition - * Maintain one release pipeline definition - * Scan for vulnerabilities early and often, and _fail fast_ - * Test early and often, and _fail fast_ - * Maintain traceability and observability of releases - - - -If I poke the hornet's nest, however, the most important principle is to _keep it simple_. If you cannot explain the reason (_what_, _why_) and the process (_how_) of your pipelines, you do not understand your engineering process. Most of us are not looking for the best, ultramodern, and revolutionary pipeline—we need one that is functional, valuable, and an enabler for engineering. Tackle the 80%—the culture, people, and their mindset—first. Ask your CI/CD knights in shining armor, with their TLA (two/three-lettered acronym) symbols on their shield, to join the might of practical and empirical engineering. - -### Unified pipeline - -Let us walk through one of our design practice whiteboard sessions. - -![CI build/CD release pipeline][9] - -Define one CI/CD pipeline with one build definition per application that is used to trigger _pull-request pre-merge validation_ and _continuous integration_ builds. Generate a _release_ build with debug information and upload to the [Symbol Server][10]. ****This enables developers to debug locally and remotely in production without having to worry which build and symbols they need to load—the symbol server performs that magic for us. - -![Breaking down the CI build pipeline][11] - -Perform as many validations as possible in the build—_shift left_—allowing feature teams to fail fast, continuously raise the overall product quality, and include invaluable evidence for the reviewers with every pull request. Do you prefer a pull request with a gazillion commits? Or a pull request with a couple of commits and supporting evidence such as security vulnerabilities, test coverage, code quality, and [Stryker][12] mutant remnants? Personally, I vote for the latter. - -![Breaking down the CD release pipeline][13] - -Do not use build transformation to generate multiple, environment-specific builds. Create one build and perform release-time _transformation_, _tokenization_, and/or XML/JSON _value replacement_. In other words, _shift-right_ the environment-specific configuration. - -![Shift-right the environment-specific configuration][14] - -Securely store release configuration data and make it available to both Dev and Ops teams based on the level of _trust_ and _sensitivity_ of the data. Use the open source Key Manager, Azure Key Vault, AWS Key Management Service, or one of many other products—remember, there are many hammers in your toolkit! - -![Dev-QA-production pipeline][15] - -Use _groups_ instead of _users_ to move approver management from multiple stages across multiple pipelines to simple group membership. - -![Move approver management to simple group membership][16] - -Instead of duplicating pipelines to give teams access to their _areas of interest_, create one pipeline and grant access to _specific stages_ of the delivery environments. - -![Pipeline with access to specific delivery stages][17] - -Last, but not least, embrace pull requests to help raise insight and transparency into your codebase, improve the overall quality, collaborate, and release pre-validation builds into selected environments; e.g., the Dev environment. - -Here is a more formal view of the whole whiteboard sketch. - -![The full pipeline][18] - -So, what are your thoughts and learnings with CI/CD pipelines? Is my dream of _one pipeline to rule them all_ a pipe dream? - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/19/7/cicd-pipeline-rule-them-all - -作者:[Willy-Peter Schaub][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/wpschaub/users/bclaster/users/matt-micene/users/barkerd427 -[b]: https://github.com/lujun9972 -[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/LAW-Internet_construction_9401467_520x292_0512_dc.png?itok=RPkPPtDe (An intersection of pipes.) -[2]: https://continuingstudies.sauder.ubc.ca/courses/agile-delivery-methods/ii861 -[3]: https://opensource.com/sites/default/files/uploads/devops_pipeline_pipe-2.png (Prerequisites for a solid development process) -[4]: https://en.wikipedia.org/wiki/Cynefin_framework -[5]: https://www.lean.org/lexicon/muda-mura-muri -[6]: https://en.wikipedia.org/wiki/Shift_left_testing -[7]: https://opensource.com/sites/default/files/uploads/devops_pipeline_pipe-3.png (5% about products, 15% about process, 80% about people) -[8]: https://opensource.com/sites/default/files/uploads/devops_pipeline_pipe-4_0.png (Improving quality and visibility of pipelines) -[9]: https://opensource.com/sites/default/files/uploads/devops_pipeline_pipe-5_0.png (CI build/CD release pipeline) -[10]: https://en.wikipedia.org/wiki/Microsoft_Symbol_Server -[11]: https://opensource.com/sites/default/files/uploads/devops_pipeline_pipe-6.png (Breaking down the CI build pipeline) -[12]: https://stryker-mutator.io/ -[13]: https://opensource.com/sites/default/files/uploads/devops_pipeline_pipe-7.png (Breaking down the CD release pipeline) -[14]: https://opensource.com/sites/default/files/uploads/devops_pipeline_pipe-8.png (Shift-right the environment-specific configuration) -[15]: https://opensource.com/sites/default/files/uploads/devops_pipeline_pipe-9.png (Dev-QA-production pipeline) -[16]: https://opensource.com/sites/default/files/uploads/devops_pipeline_pipe-10.png (Move approver management to simple group membership) -[17]: https://opensource.com/sites/default/files/uploads/devops_pipeline_pipe-11.png (Pipeline with access to specific delivery stages) -[18]: https://opensource.com/sites/default/files/uploads/devops_pipeline_pipe-12.png (The full pipeline) diff --git a/sources/tech/20190712 What is Silverblue.md b/sources/tech/20190712 What is Silverblue.md deleted file mode 100644 index c23a45b9f8..0000000000 --- a/sources/tech/20190712 What is Silverblue.md +++ /dev/null @@ -1,98 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: ( ) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (What is Silverblue?) -[#]: via: (https://fedoramagazine.org/what-is-silverblue/) -[#]: author: (Tomáš Popela https://fedoramagazine.org/author/tpopela/) - -What is Silverblue? -====== - -![][1] - -Fedora Silverblue is becoming more and more popular inside and outside the Fedora world. So based on feedback from the community, here are answers to some interesting questions about the project. If you do have any other Silverblue related questions, please leave it in the comments section and we will try to answer them in a future article. - -### What is Silverblue? - -Silverblue is a codename for the new generation of the desktop operating system, previously known as Atomic Workstation. The operating system is delivered in images that are created by utilizing the _[rpm-ostree][2]_ [project][2]. The main benefits of the system are speed, security, atomic updates and immutability. - -### What does “Silverblue” actually mean? - -“Team Silverblue” or “Silverblue” in short doesn’t have any hidden meaning. It was chosen after roughly two months when the project, previously known as Atomic Workstation was rebranded. There were over 150 words or word combinations reviewed in the process. In the end _Silverblue_ was chosen because it had an available domain as well as the social network accounts. One could think of it as a new take on Fedora’s blue branding, and could be used in phrases like “Go, Team Silverblue!” or “Want to join the team and improve Silverblue?”. - -### What is ostree? - -[OSTree or libostree is a project][3] that combines a “git-like” model for committing and downloading bootable filesystem trees, together with a layer to deploy them and manage the bootloader configuration. OSTree is used by rpm-ostree, a hybrid package/image based system that Silverblue uses. It atomically replicates a base OS and allows the user to “layer” the traditional RPM on top of the base OS if needed. - -### Why use Silverblue? - -Because it allows you to concentrate on your work and not on the operating system you’re running. It’s more robust as the updates of the system are atomic. The only thing you need to do is to restart into the new image. Also, if there’s anything wrong with the currently booted image, you can easily reboot/rollback to the previous working one, if available. If it isn’t, you can download and boot any other image that was generated in the past, using the _ostree_ command. - -Another advantage is the possibility of an easy switch between branches (or, in an old context, Fedora releases). You can easily try the _[Rawhide][4]_ or _[updates-testing][5]_ branch and then return back to the one that contains the current stable release. Also, you should consider Silverblue if you want to try something new and unusual. - -### What are the benefits of an immutable OS? - -One of the main benefits is security. The base operating system is mounted as read-only, and thus cannot be modified by malicious software. The only way to alter the system is through the _rpm-ostree_ utility. - -Another benefit is robustness. It’s nearly impossible for a regular user to get the OS to the state when it doesn’t boot or doesn’t work properly after accidentally or unintentionally removing some system library. Try to think about these kind of experiences from your past, and imagine how Silverblue could help you there. - -### How does one manage applications and packages in Silverblue? - -For graphical user interface applications, [Flatpak][6] is recommended, if the application is available as a flatpak. Users can choose between Flatpaks from either Fedora and built from Fedora packages and in Fedora-owned infrastructure, or Flathub that currently has a wider offering. Users can install them easily through GNOME Software, which already supports Fedora Silverblue. - -One of the first things users find out is there is no _dnf_ preinstalled in the OS. The main reason is that it wouldn’t work on Silverblue — and part of its functionality was replaced by the _rpm-ostree_ command. Users can overlay the traditional packages by using the _rpm-ostree install PACKAGE_. But it should only be used when there is no other way. This is because when the new system images are pulled from the repository, the system image must be rebuilt every time it is altered to accommodate the layered packages, or packages that were removed from the base OS or replaced with a different version. - -Fedora Silverblue comes with the default set of GUI applications that are part of the base OS. The team is working on porting them to Flatpaks so they can be distributed that way. As a benefit, the base OS will become smaller and easier to maintain and test, and users can modify their default installation more easily. If you want to look at how it’s done or help, take a look at the official [documentation][7]. - -### What is Toolbox? - -[_Toolbox_][8] is a project to make containers easily consumable for regular users. It does that by using _podman_’s rootless containers. _Toolbox_ lets you easily and quickly create a container with a regular Fedora installation that you can play with or develop on, separated from your OS. - -### Is there any Silverblue roadmap? - -Formally there isn’t any, as we’re focusing on problems we discover during our testing and from community feedback. We’re currently using Fedora’s [Taiga][9] to do our planning. - -### What’s the release life cycle of the Silverblue? - -It’s the same as regular Fedora Workstation. A new release comes every 6 months and is supported for 13 months. The team plans to release updates for the OS bi-weekly (or longer) instead of daily as they currently do. That way the updates can be more thoroughly tested by QA and community volunteers before they are sent to the rest of the users. - -### What is the future of the immutable OS? - -From our point of view the future of the desktop involves the immutable OS. It’s safest for the user, and Android, ChromeOS, and the last macOS Catalina all use this method under the hood. For the Linux desktop there are still problems with some third party software that expects to write to the OS. HP printer drivers are a good example. - -Another issue is how parts of the system are distributed and installed. Fonts are a good example. Currently in Fedora they’re distributed in RPM packages. If you want to use them, you have to overlay them and then restart to the newly created image that contains them. - -### What is the future of standard Workstation? - -There is a possibility that the Silverblue will replace the regular Workstation. But there’s still a long way to go for Silverblue to provide the same functionality and user experience as the Workstation. In the meantime both desktop offerings will be delivered at the same time. - -### How does Atomic Workstation or Fedora CoreOS relate to any of this? - -Atomic Workstation was the name of the project before it was renamed to Fedora Silverblue. - -Fedora CoreOS is a different, but similar project. It shares some fundamental technologies with Silverblue, such as _rpm-ostree_, _toolbox_ and others. Nevertheless, CoreOS is a more minimal, container-focused and automatically updating OS. - --------------------------------------------------------------------------------- - -via: https://fedoramagazine.org/what-is-silverblue/ - -作者:[Tomáš Popela][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://fedoramagazine.org/author/tpopela/ -[b]: https://github.com/lujun9972 -[1]: https://fedoramagazine.org/wp-content/uploads/2019/07/what-is-fedora-silverblue-816x345.jpg -[2]: https://rpm-ostree.readthedocs.io/en/latest/ -[3]: https://ostree.readthedocs.io/en/latest/ -[4]: https://fedoraproject.org/wiki/Releases/Rawhide -[5]: https://fedoraproject.org/wiki/QA:Updates_Testing -[6]: https://flatpak.org/ -[7]: https://docs.fedoraproject.org/en-US/flatpak/tutorial/ -[8]: https://github.com/debarshiray/toolbox -[9]: https://teams.fedoraproject.org/project/silverblue/ diff --git a/sources/tech/20190729 How to structure a multi-file C program- Part 1.md b/sources/tech/20190729 How to structure a multi-file C program- Part 1.md deleted file mode 100644 index b9e026ca4b..0000000000 --- a/sources/tech/20190729 How to structure a multi-file C program- Part 1.md +++ /dev/null @@ -1,197 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (mengxinayan) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (How to structure a multi-file C program: Part 1) -[#]: via: (https://opensource.com/article/19/7/structure-multi-file-c-part-1) -[#]: author: (Erik O'Shaughnessy https://opensource.com/users/jnyjnyhttps://opensource.com/users/jnyjnyhttps://opensource.com/users/jim-salterhttps://opensource.com/users/cldxsolutions) - -How to structure a multi-file C program: Part 1 -====== -Grab your favorite beverage, editor, and compiler, crank up some tunes, -and start structuring a C program composed of multiple files. -![Programming keyboard.][1] - -It has often been said that the art of computer programming is part managing complexity and part naming things. I contend that this is largely true with the addition of "and sometimes it requires drawing boxes." - -In this article, I'll name some things and manage some complexity while writing a small C program that is loosely based on the program structure I discussed in "[How to write a good C main function][2]"—but different. This one will do something. Grab your favorite beverage, editor, and compiler, crank up some tunes, and let's write a mildly interesting C program together. - -### Philosophy of a good Unix program - -The first thing to know about this C program is that it's a [Unix][3] command-line tool. This means that it runs on (or can be ported to) operating systems that provide a Unix C runtime environment. When Unix was invented at Bell Labs, it was imbued from the beginning with a [design philosophy][4]. In my own words: _programs do one thing, do it well, and act on files_. While it makes sense to do one thing and do it well, the part about "acting on files" seems a little out of place. - -It turns out that the Unix abstraction of a "file" is very powerful. A Unix file is a stream of bytes that ends with an end-of-file (EOF) marker. That's it. Any other structure in a file is imposed by the application and not the operating system. The operating system provides system calls that allow a program to perform a set of standard operations on files: open, read, write, seek, and close (there are others, but those are the biggies). Standardizing access to files allows different programs to share a common abstraction and work together even when different people implement them in different programming languages. - -Having a shared file interface makes it possible to build programs that are _composable_. The output of one program can be the input of another program. The Unix family of operating systems provides three files by default whenever a program is executed: standard in (**stdin**), standard out (**stdout**), and standard error (**stderr**). Two of these files are opened in write-only mode: **stdout** and **stderr**, while **stdin** is opened read-only. We see this in action whenever we use file redirection in a command shell like Bash: - - -``` -`$ ls | grep foo | sed -e 's/bar/baz/g' > ack` -``` - -This construction can be described briefly as: the output of **ls** is written to stdout, which is redirected to the stdin of **grep**, whose stdout is redirected to **sed**, whose stdout is redirected to write to a file called **ack** in the current directory. - -We want our program to play well in this ecosystem of equally flexible and awesome programs, so let's write a program that reads and writes files. - -### MeowMeow: A stream encoder/decoder concept - -When I was a dewy-eyed kid studying computer science in the <mumbles>s, there were a plethora of encoding schemes. Some of them were for compressing files, some were for packaging files together, and others had no purpose but to be excruciatingly silly. An example of the last is the [MooMoo encoding scheme][5]. - -To give our program a purpose, I'll update this concept for the [2000s][6] and implement a concept called MeowMeow encoding (since the internet loves cats). The basic idea here is to take files and encode each nibble (half of a byte) with the text "meow." A lower-case letter indicates a zero, and an upper-case indicates a one. Yes, it will balloon the size of a file since we are trading 4 bits for 32 bits. Yes, it's pointless. But imagine the surprise on someone's face when this happens: - - -``` -$ cat /home/your_sibling/.super_secret_journal_of_my_innermost_thoughts -MeOWmeOWmeowMEoW... -``` - -This is going to be awesome. - -### Implementation, finally - -The full source for this can be found on [GitHub][7], but I'll talk through my thought process while writing it. The object is to illustrate how to structure a C program composed of multiple files. - -Having already established that I want to write a program that encodes and decodes files in MeowMeow format, I fired up a shell and issued the following commands: - - -``` -$ mkdir meowmeow -$ cd meowmeow -$ git init -$ touch Makefile     # recipes for compiling the program -$ touch main.c       # handles command-line options -$ touch main.h       # "global" constants and definitions -$ touch mmencode.c   # implements encoding a MeowMeow file -$ touch mmencode.h   # describes the encoding API -$ touch mmdecode.c   # implements decoding a MeowMeow file -$ touch mmdecode.h   # describes the decoding API -$ touch table.h      # defines encoding lookup table values -$ touch .gitignore   # names in this file are ignored by git -$ git add . -$ git commit -m "initial commit of empty files" -``` - -In short, I created a directory full of empty files and committed them to git. - -Even though the files are empty, you can infer the purpose of each from its name. Just in case you can't, I annotated each **touch** with a brief description. - -Usually, a program starts as a single, simple **main.c** file, with only two or three functions that solve the problem. And then the programmer rashly shows that program to a friend or her boss, and suddenly the number of functions in the file balloons to support all the new "features" and "requirements" that pop up. The first rule of "Program Club" is don't talk about "Program Club." The second rule is to minimize the number of functions in one file. - -To be honest, the C compiler does not care one little bit if every function in your program is in one file. But we don't write programs for computers or compilers; we write them for other people (who are sometimes us). I know that is probably a surprise, but it's true. A program embodies a set of algorithms that solve a problem with a computer, and it's important that people understand it when the parameters of the problem change in unanticipated ways. People will have to modify the program, and they will curse your name if you have all 2,049 functions in one file. - -So we good and true programmers break functions out, grouping similar functions into separate files. Here I've got files **main.c**, **mmencode.c**, and **mmdecode.c**. For small programs like this, it may seem like overkill. But small programs rarely stay small, so planning for expansion is a "Good Idea." - -But what about those **.h** files? I'll explain them in general terms later, but in brief, those are called _header_ files, and they can contain C language type definitions and C preprocessor directives. Header files should _not_ have any functions in them. You can think of headers as a definition of the application programming interface (API) offered by the **.c** flavored file that is used by other **.c** files. - -### But what the heck is a Makefile? - -I know all you cool kids are using the "Ultra CodeShredder 3000" integrated development environment to write the next blockbuster app, and building your project consists of mashing on Ctrl-Meta-Shift-Alt-Super-B. But back in my day (and also today), lots of useful work got done by C programs built with Makefiles. A Makefile is a text file that contains recipes for working with files, and programmers use it to automate building their program binaries from source (and other stuff too!). - -Take, for instance, this little gem: - - -``` -00 # Makefile -01 TARGET= my_sweet_program -02 $(TARGET): main.c -03    cc -o my_sweet_program main.c -``` - -Text after an octothorpe/pound/hash is a comment, like in line 00. - -Line 01 is a variable assignment where the variable **TARGET** takes on the string value **my_sweet_program**. By convention, OK, my preference, all Makefile variables are capitalized and use underscores to separate words. - -Line 02 consists of the name of the file that the recipe creates and the files it depends on. In this case, the target is **my_sweet_program**, ****and the dependency is **main.c**. - -The final line, 03, is indented with a tab and not four spaces. This is the command that will be executed to create the target. In this case, we call **cc** the C compiler frontend to compile and link **my_sweet_program**. - -Using a Makefile is simple: - - -``` -$ make -cc -o my_sweet_program main.c -$ ls -Makefile  main.c  my_sweet_program -``` - -The [Makefile][8] that will build our MeowMeow encoder/decoder is considerably more sophisticated than this example, but the basic structure is the same. I'll break it down Barney-style in another article. - -### Form follows function - -My idea here is to write a program that reads a file, transforms it, and writes the transformed data to another file. The following fabricated command-line interaction is how I imagine using the program: - - -``` -        $ meow < clear.txt > clear.meow -        $ unmeow < clear.meow > meow.tx -        $ diff clear.txt meow.tx -        $ -``` - -We need to write code to handle command-line parsing and managing the input and output streams. We need a function to encode a stream and write it to another stream. And finally, we need a function to decode a stream and write it to another stream. Wait a second, I've only been talking about writing one program, but in the example above, I invoke two commands: **meow** and **unmeow**? I know you are probably thinking that this is getting complex as heck. - -### Minor sidetrack: argv[0] and the ln command - -If you recall, the signature of a C main function is: - - -``` -`int main(int argc, char *argv[])` -``` - -where **argc** is the number of command-line arguments, and **argv** is a list of character pointers (strings). The value of **argv[0]** is the path of the file containing the program being executed. Many Unix utility programs with complementary functions (e.g., compress and uncompress) look like two programs, but in fact, they are one program with two names in the filesystem. The two-name trick is accomplished by creating a filesystem "link" using the **ln** command. - -An example from **/usr/bin** on my laptop is: - - -``` -   $ ls -li /usr/bin/git* -3376 -rwxr-xr-x. 113 root root     1.5M Aug 30  2018 /usr/bin/git -3376 -rwxr-xr-x. 113 root root     1.5M Aug 30  2018 /usr/bin/git-receive-pack -... -``` - -Here **git** and **git-receive-pack** are the same file with different names. We can tell it's the same file because they have the same inode number (the first column). An inode is a feature of the Unix filesystem and is super outside the scope of this article. - -Good and/or lazy programmers can use this feature of the Unix filesystem to write less code but double the number of programs they deliver. First, we write a program that changes its behavior based on the value of **argv[0]**, then we make sure to create links with the names that cause the behavior. - -In our Makefile, the **unmeow** link is created using this recipe: - - -``` - # Makefile - ... - $(DECODER): $(ENCODER) -         $(LN) -f $< $@ -        ... -``` - -I tend to parameterize everything in my Makefiles, rarely using a "bare" string. I group all the definitions at the top of the Makefile, which makes it easy to find and change them. This makes a big difference when you are trying to port software to a new platform and you need to change all your rules to use **xcc** instead of **cc**. - -The recipe should appear relatively straightforward except for the two built-in variables **$@** and **$<**. The first is a shortcut for the target of the recipe; in this case, **$(DECODER)**. (I remember this because the at-sign looks like a target to me.) The second, **$<** is the rule dependency; in this case, it resolves to **$(ENCODER)**. - -Things are getting complex for sure, but it's managed. - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/19/7/structure-multi-file-c-part-1 - -作者:[Erik O'Shaughnessy][a] -选题:[lujun9972][b] -译者:[萌新阿岩](https://github.com/mengxinayan) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]: https://opensource.com/users/jnyjnyhttps://opensource.com/users/jnyjnyhttps://opensource.com/users/jim-salterhttps://opensource.com/users/cldxsolutions -[b]: https://github.com/lujun9972 -[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/programming_keyboard_coding.png?itok=E0Vvam7A (Programming keyboard.) -[2]: https://opensource.com/article/19/5/how-write-good-c-main-function -[3]: https://en.wikipedia.org/wiki/Unix -[4]: http://harmful.cat-v.org/cat-v/ -[5]: http://www.jabberwocky.com/software/moomooencode.html -[6]: https://giphy.com/gifs/nyan-cat-sIIhZliB2McAo -[7]: https://github.com/JnyJny/meowmeow -[8]: https://github.com/JnyJny/meowmeow/blob/master/Makefile diff --git a/sources/tech/20190730 Using Python to explore Google-s Natural Language API.md b/sources/tech/20190730 Using Python to explore Google-s Natural Language API.md index 304fd79e0a..b5f8611a1c 100644 --- a/sources/tech/20190730 Using Python to explore Google-s Natural Language API.md +++ b/sources/tech/20190730 Using Python to explore Google-s Natural Language API.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: (zhangxiangping) +[#]: translator: ( ) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) @@ -264,7 +264,7 @@ via: https://opensource.com/article/19/7/python-google-natural-language-api 作者:[JR Oakes][a] 选题:[lujun9972][b] -译者:[zhangxiangping](https://github.com/zhangxiangping) +译者:[译者ID](https://github.com/译者ID) 校对:[校对者ID](https://github.com/校对者ID) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 diff --git a/sources/tech/20190731 How to structure a multi-file C program- Part 2.md b/sources/tech/20190731 How to structure a multi-file C program- Part 2.md deleted file mode 100644 index 3f050b053b..0000000000 --- a/sources/tech/20190731 How to structure a multi-file C program- Part 2.md +++ /dev/null @@ -1,229 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (mengxinayan) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (How to structure a multi-file C program: Part 2) -[#]: via: (https://opensource.com/article/19/7/structure-multi-file-c-part-2) -[#]: author: (Erik O'Shaughnessy https://opensource.com/users/jnyjny) - -How to structure a multi-file C program: Part 2 -====== -Dive deeper into the structure of a C program composed of multiple files -in the second part of this article. -![4 manilla folders, yellow, green, purple, blue][1] - -In [Part 1][2], I laid out the structure for a multi-file C program called [MeowMeow][3] that implements a toy [codec][4]. I also talked about the Unix philosophy of program design, laying out a number of empty files to start with a good structure from the very beginning. Lastly, I touched on what a Makefile is and what it can do for you. This article picks up where the other one left off and now I'll get to the actual implementation of our silly (but instructional) MeowMeow codec. - -The structure of the **main.c** file for **meow**/**unmeow** should be familiar to anyone who's read my article "[How to write a good C main function][5]." It has the following general outline: - - -``` -/* main.c - MeowMeow, a stream encoder/decoder */ - -/* 00 system includes */ -/* 01 project includes */ -/* 02 externs */ -/* 03 defines */ -/* 04 typedefs */ -/* 05 globals (but don't)*/ -/* 06 ancillary function prototypes if any */ -    -int main(int argc, char *argv[]) -{ -  /* 07 variable declarations */ -  /* 08 check argv[0] to see how the program was invoked */ -  /* 09 process the command line options from the user */ -  /* 10 do the needful */ -} -    -/* 11 ancillary functions if any */ -``` - -### Including project header files - -The second section, **/* 01 project includes /***, reads like this from the source: - - -``` -/* main.c - MeowMeow, a stream encoder/decoder */ -... -/* 01 project includes */ -#include "main.h" -#include "mmecode.h" -#include "mmdecode.h" -``` - -The **#include** directive is a C preprocessor command that causes the contents of the named file to be "included" at this point in the file. If the programmer uses double-quotes around the name of the header file, the compiler will look for that file in the current directory. If the file is enclosed in <>, it will look for the file in a set of predefined directories. - -The file [**main.h**][6] contains the definitions and typedefs used in [**main.c**][7]. I like to collect these things here in case I want to use those definitions elsewhere in my program. - -The files [**mmencode.h**][8] and [**mmdecode.h**][9] are nearly identical, so I'll break down **mmencode.h**. - - -``` - /* mmencode.h - MeowMeow, a stream encoder/decoder */ -    - #ifndef _MMENCODE_H - #define _MMENCODE_H -    - #include <stdio.h> -    - int mm_encode(FILE *src, FILE *dst); -    - #endif /* _MMENCODE_H */ -``` - -The **#ifdef, #define, #endif** construction is collectively known as a "guard." This keeps the C compiler from including this file more than once per file. The compiler will complain if it finds multiple definitions/prototypes/declarations, so the guard is a _must-have_ for header files. - -Inside the guard, there are only two things: an **#include** directive and a function prototype declaration. I include **stdio.h** here to bring in the definition of **FILE** that is used in the function prototype. The function prototype can be included by other C files to establish that function in the file's namespace. You can think of each file as a separate _namespace_, which means variables and functions in one file are not usable by functions or variables in another file. - -Writing header files is complex, and it is tough to manage in larger projects. Use guards. - -### MeowMeow encoding, finally - -The meat and potatoes of this program—encoding and decoding bytes into/out of **MeowMeow** strings—is actually the easy part of this project. All of our activities until now have been putting the scaffolding in place to support calling this function: parsing the command line, determining which operation to use, and opening the files that we'll operate on. Here is the encoding loop: - - -``` - /* mmencode.c - MeowMeow, a stream encoder/decoder */ - ... -     while (![feof][10](src)) { -    -       if (![fgets][11](buf, sizeof(buf), src)) -         break; -              -       for(i=0; i<[strlen][12](buf); i++) { -         lo = (buf[i] & 0x000f); -         hi = (buf[i] & 0x00f0) >> 4; -         [fputs][13](tbl[hi], dst); -         [fputs][13](tbl[lo], dst); -       } -            } -``` - -In plain English, this loop reads in a chunk of the file while there are chunks left to read (**feof(3)** and **fgets(3)**). Then it splits each byte in the chunk into **hi** and **lo** nibbles. Remember, a nibble is half of a byte, or 4 bits. The real magic here is realizing that 4 bits can encode 16 values. I use **hi** and **lo** as indices into a 16-string lookup table, **tbl**, that contains the **MeowMeow** strings that encode each nibble. Those strings are written to the destination **FILE** stream using **fputs(3)**, then we move on to the next byte in the buffer. - -The table is initialized with a macro defined in [**table.h**][14] for no particular reason except to demonstrate including another project local header file, and I like initialization macros. We will go further into why a future article. - -### MeowMeow decoding - -Alright, I'll admit it took me a couple of runs at this before I got it working. The decode loop is similar: read a buffer full of **MeowMeow** strings and reverse the encoding from strings to bytes. - - -``` - /* mmdecode.c - MeowMeow, a stream decoder/decoder */ - ... - int mm_decode(FILE *src, FILE *dst) - { -   if (!src || !dst) { -     errno = EINVAL; -     return -1; -   } -   return stupid_decode(src, dst); - } -``` - -Not what you were expecting? - -Here, I'm exposing the function **stupid_decode()** via the externally visible **mm_decode()** function. When I say "externally," I mean outside this file. Since **stupid_decode()** isn't in the header file, it isn't available to be called in other files. - -Sometimes we do this when we want to publish a solid public interface, but we aren't quite done noodling around with functions to solve a problem. In my case, I've written an I/O-intensive function that reads 8 bytes at a time from the source stream to decode 1 byte to write to the destination stream. A better implementation would work on a buffer bigger than 8 bytes at a time. A _much_ better implementation would also buffer the output bytes to reduce the number of single-byte writes to the destination stream. - - -``` - /* mmdecode.c - MeowMeow, a stream decoder/decoder */ - ... - int stupid_decode(FILE *src, FILE *dst) - { -   char           buf[9]; -   decoded_byte_t byte; -   int            i; -      -   while (![feof][10](src)) { -     if (![fgets][11](buf, sizeof(buf), src)) -       break; -     byte.field.f0 = [isupper][15](buf[0]); -     byte.field.f1 = [isupper][15](buf[1]); -     byte.field.f2 = [isupper][15](buf[2]); -     byte.field.f3 = [isupper][15](buf[3]); -     byte.field.f4 = [isupper][15](buf[4]); -     byte.field.f5 = [isupper][15](buf[5]); -     byte.field.f6 = [isupper][15](buf[6]); -     byte.field.f7 = [isupper][15](buf[7]); -        -     [fputc][16](byte.value, dst); -   } -   return 0; - } -``` - -Instead of using the bit-shifting technique I used in the encoder, I elected to create a custom data structure called **decoded_byte_t**. - - -``` - /* mmdecode.c - MeowMeow, a stream decoder/decoder */ - ... - - typedef struct { -   unsigned char f7:1; -   unsigned char f6:1; -   unsigned char f5:1; -   unsigned char f4:1; -   unsigned char f3:1; -   unsigned char f2:1; -   unsigned char f1:1; -   unsigned char f0:1; - } fields_t; -    - typedef union { -   fields_t      field; -   unsigned char value; - } decoded_byte_t; -``` - -It's a little complex when viewed all at once, but hang tight. The **decoded_byte_t** is defined as a **union** of a **fields_t** and an **unsigned char**. The named members of a union can be thought of as aliases for the same region of memory. In this case, **value** and **field** refer to the same 8-bit region of memory. Setting **field.f0** to 1 would also set the least significant bit in **value**. - -While **unsigned char** shouldn't be a mystery, the **typedef** for **fields_t** might look a little unfamiliar. Modern C compilers allow programmers to specify "bit fields" in a **struct**. The field type needs to be an unsigned integral type, and the member identifier is followed by a colon and an integer that specifies the length of the bit field. - -This data structure makes it simple to access each bit in the byte by field name and then access the assembled value via the **value** field of the union. We depend on the compiler to generate the correct bit-shifting instructions to access the fields, which can save you a lot of heartburn when you are debugging. - -Lastly, **stupid_decode()** is _stupid_ because it only reads 8 bytes at a time from the source **FILE** stream. Usually, we try to minimize the number of reads and writes to improve performance and reduce our cost of system calls. Remember that reading or writing a bigger chunk less often is much better than reading/writing a lot of smaller chunks more frequently. - -### The wrap-up - -Writing a multi-file program in C requires a little more planning on behalf of the programmer than just a single **main.c**. But just a little effort up front can save a lot of time and headache when you refactor as you add functionality. - -To recap, I like to have a lot of files with a few short functions in them. I like to expose a small subset of the functions in those files via header files. I like to keep my constants in header files, both numeric and string constants. I _love_ Makefiles and use them instead of Bash scripts to automate all sorts of things. I like my **main()** function to handle command-line argument parsing and act as a scaffold for the primary functionality of the program. - -I know I've only touched the surface of what's going on in this simple program, and I'm excited to learn what things were helpful to you and which topics need better explanations. Share your thoughts in the comments to let me know. - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/19/7/structure-multi-file-c-part-2 - -作者:[Erik O'Shaughnessy][a] -选题:[lujun9972][b] -译者:[萌新阿岩](https://github.com/mengxinayan) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]: https://opensource.com/users/jnyjny -[b]: https://github.com/lujun9972 -[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/file_system.jpg?itok=pzCrX1Kc (4 manilla folders, yellow, green, purple, blue) -[2]: https://opensource.com/article/19/7/how-structure-multi-file-c-program-part-1 -[3]: https://github.com/jnyjny/MeowMeow.git -[4]: https://en.wikipedia.org/wiki/Codec -[5]: https://opensource.com/article/19/5/how-write-good-c-main-function -[6]: https://github.com/JnyJny/meowmeow/blob/master/main.h -[7]: https://github.com/JnyJny/meowmeow/blob/master/main.c -[8]: https://github.com/JnyJny/meowmeow/blob/master/mmencode.h -[9]: https://github.com/JnyJny/meowmeow/blob/master/mmdecode.h -[10]: http://www.opengroup.org/onlinepubs/009695399/functions/feof.html -[11]: http://www.opengroup.org/onlinepubs/009695399/functions/fgets.html -[12]: http://www.opengroup.org/onlinepubs/009695399/functions/strlen.html -[13]: http://www.opengroup.org/onlinepubs/009695399/functions/fputs.html -[14]: https://github.com/JnyJny/meowmeow/blob/master/table.h -[15]: http://www.opengroup.org/onlinepubs/009695399/functions/isupper.html -[16]: http://www.opengroup.org/onlinepubs/009695399/functions/fputc.html diff --git a/sources/tech/20190804 Learn how to Install LXD - LXC Containers in Ubuntu.md b/sources/tech/20190804 Learn how to Install LXD - LXC Containers in Ubuntu.md index b4e1a2667b..b72de600e0 100644 --- a/sources/tech/20190804 Learn how to Install LXD - LXC Containers in Ubuntu.md +++ b/sources/tech/20190804 Learn how to Install LXD - LXC Containers in Ubuntu.md @@ -1,11 +1,11 @@ -[#]: collector: (lujun9972) -[#]: translator: ( ) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Learn how to Install LXD / LXC Containers in Ubuntu) -[#]: via: (https://www.linuxtechi.com/install-lxd-lxc-containers-from-scratch/) -[#]: author: (Shashidhar Soppin https://www.linuxtechi.com/author/shashidhar/) +[#]: collector: "lujun9972" +[#]: translator: "runningwater " +[#]: reviewer: " " +[#]: publisher: " " +[#]: url: " " +[#]: subject: "Learn how to Install LXD / LXC Containers in Ubuntu" +[#]: via: "https://www.linuxtechi.com/install-lxd-lxc-containers-from-scratch/" +[#]: author: "Shashidhar Soppin https://www.linuxtechi.com/author/shashidhar/" Learn how to Install LXD / LXC Containers in Ubuntu ====== @@ -497,7 +497,7 @@ via: https://www.linuxtechi.com/install-lxd-lxc-containers-from-scratch/ 作者:[Shashidhar Soppin][a] 选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) +译者:[runningwater](https://github.com/runningwater) 校对:[校对者ID](https://github.com/校对者ID) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 diff --git a/sources/tech/20190808 Sending custom emails with Python.md b/sources/tech/20190808 Sending custom emails with Python.md deleted file mode 100644 index fb8e0d3938..0000000000 --- a/sources/tech/20190808 Sending custom emails with Python.md +++ /dev/null @@ -1,257 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: ( ) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Sending custom emails with Python) -[#]: via: (https://opensource.com/article/19/8/sending-custom-emails-python) -[#]: author: (Brian "bex" Exelbierd https://opensource.com/users/bexelbie) - -Sending custom emails with Python -====== -Customize your group emails with Mailmerge, a command-line program that -can handle simple and complex emails. -![Chat via email][1] - -Email remains a fact of life. Despite all its warts, it's still the best way to send information to most people, especially in automated ways that allow messages to queue for recipients. - -One of the highlights of my work as the [Fedora Community Action and Impact Coordinator][2] is giving people good news about travel funding. I often send this information over email. Here, I'll show you how I send custom messages to groups of people using [Mailmerge][3], a command-line Python program that can handle simple and complex emails. - -### Install Mailmerge - -Mailmerge is packaged and available in Fedora, and you can install it from the command line with **sudo dnf install python3-mailmerge**. You can also install it from PyPI using **pip**, as the project's [README explains][4]. - -### Configure your Mailmerge files - -Three files control how Mailmerge works. If you run **mailmerge --sample**, it will create template files for you. The files are: - - * **mailmerge_server.conf:** This contains the configuration details for your SMTP host to send emails. Your password is _not_ stored in this file. - * **mailmerge_database.csv:** This holds the custom data for each email, including the recipients' email addresses. - * **mailmerge_template.txt:** This is your email's text with placeholder fields that will be replaced using the data from **mailmerge_database.csv**. - - - -#### Server.conf - -The sample **mailmerge_server.conf** file includes several examples that should be familiar. If you've ever added email to your phone or set up a desktop email client, you've seen this data before. The big thing to remember is to update your username in the file, especially if you are using one of the example configurations. - -#### Database.csv - -The **mailmerge_database.csv** file is a bit more complicated. It must contain (at minimum) the recipients' email addresses and any other custom details necessary to replace the fields in your email. It is a good idea to write the **mailmerge_template.txt** file at the same time you create the fields list for this file. I find it helpful to use a spreadsheet to capture this data and export it as a CSV file when I am done. This sample file: - - -``` -email,name,number -[myself@mydomain.com][5],"Myself",17 -[bob@bobdomain.com][6],"Bob",42 -``` - -allows you to send emails to two people, using their first name and telling them a number. This file, while not terribly interesting, illustrates an important habit: Always make yourself the first recipient in the file. This enables you to send yourself a test email to verify everything works as expected before you email the entire list. - -If any of your values contain commas, you _**must**_ enclose the entire value in double-quotes (**"**). If you need to include a double-quote in a double-quoted field, use two double-quotes in a row. Quoting rules are fun, so read about [CSVs in Python 3][7] for specifics. - -#### Template.txt - -As part of my work, I get to share news about travel-funding decisions for our Fedora contributor conference, [Flock][8]. A simple email tells people they've been selected for travel funding and their specific funding details. One user-specific detail is how much money we can allocate for their airfare. Here is an abbreviated version of my template file (I've snipped out a lot of the text for brevity): - - -``` -$ cat mailmerge_template.txt -TO: {{Email}} -SUBJECT: Flock 2019 Funding Offer -FROM: Brian Exelbierd <[bexelbie@redhat.com][9]> - -Hi {{Name}}, - -I am writing you on behalf of the Flock funding committee.  You requested funding for your attendance at Flock.  After careful consideration we are able to offer you the following funding: - -Travel Budget: {{Travel_Budget}} - -<<snip>> -``` - -The top of the template specifies the recipient, sender, and subject. After the blank line, there's the body of the email. This email needs the recipients' **Email**, **Name**, and **Travel_Budget** from the **database.csv** file. Notice that those fields are surrounded by double curly braces (**{{** and **}}**). The corresponding **mailmerge_database.csv** looks like this: - - -``` -$ cat mailmerge_database.csv -Name,Email,Travel_Budget -Brian,[bexelbie@redhat.com][9],1000 -PersonA,[persona@fedoraproject.org][10],1500 -PèrsonB,[personb@fedoraproject.org][11],500 -``` - -Notice that I listed myself first (for testing) and there are two other people in the file. The second person, PèrsonB, has an accented character in their name; Mailmerge will automatically encode it. - -That's the whole template concept: Write your email and put placeholders in double curly braces. Then create a database that provides those values. Now let's test the email. - -### Test and send simple email merges - -#### Do a dry-run - -Start by doing a dry-run that prints the emails, with the placeholder fields completed, to the screen. By default, if you run the command **mailmerge**, it will do a dry-run of the first email: - - -``` -$ mailmerge ->>> encoding ascii ->>> message 0 -TO: [bexelbie@redhat.com][9] -SUBJECT: Flock 2019 Funding Offer -FROM: Brian Exelbierd <[bexelbie@redhat.com][9]> -MIME-Version: 1.0 -Content-Type: text/plain; charset="us-ascii" -Content-Transfer-Encoding: 7bit -Date: Sat, 20 Jul 2019 18:17:15 -0000 - -Hi Brian, - -I am writing you on behalf of the Flock funding committee.  You requested funding for your attendance at Flock.  After careful consideration we are able to offer you the following funding: - -Travel Budget: 1000 - -<<snip>> - ->>> sent message 0 DRY RUN ->>> No attachments were sent with the emails. ->>> Limit was 1 messages.  To remove the limit, use the --no-limit option. ->>> This was a dry run.  To send messages, use the --no-dry-run option. -``` - -Reviewing the first email (**message 0**, as counting starts from zero, like many things in computer science), you can see my name and travel budget are correct. If you want to review every email, enter **mailmerge --no-limit** to tell Mailmerge not to limit itself to the first email. Here's the dry-run of the third email, which shows the special character encoding: - - -``` ->>> message 2 -TO: [personb@fedoraproject.org][11] -SUBJECT: Flock 2019 Funding Offer -FROM: Brian Exelbierd <[bexelbie@redhat.com][9]> -MIME-Version: 1.0 -Content-Type: text/plain; charset="iso-8859-1" -Content-Transfer-Encoding: quoted-printable -Date: Sat, 20 Jul 2019 18:22:48 -0000 - -Hi P=E8rsonB, -``` - -That's not an error; **P=E8rsonB** is the encoded form of **PèrsonB**. - -#### Send a test message - -Now, send a test email with the command **mailmerge --no-dry-run**, which tells Mailmerge to send a message to the first email on the list: - - -``` -$ mailmerge --no-dry-run ->>> encoding ascii ->>> message 0 -TO: [bexelbie@redhat.com][9] -SUBJECT: Flock 2019 Funding Offer -FROM: Brian Exelbierd <[bexelbie@redhat.com][9]> -MIME-Version: 1.0 -Content-Type: text/plain; charset="us-ascii" -Content-Transfer-Encoding: 7bit -Date: Sat, 20 Jul 2019 18:25:45 -0000 - -Hi Brian, - -I am writing you on behalf of the Flock funding committee.  You requested funding for your attendance at Flock.  After careful consideration we are able to offer you the following funding: - -Travel Budget: 1000 - -<<snip>> - ->>> Read SMTP server configuration from mailmerge_server.conf ->>>   host = smtp.gmail.com ->>>   port = 587 ->>>   username = [bexelbie@redhat.com][9] ->>>   security = STARTTLS ->>> password for [bexelbie@redhat.com][9] on smtp.gmail.com: ->>> sent message 0 ->>> No attachments were sent with the emails. ->>> Limit was 1 messages.  To remove the limit, use the --no-limit option. -``` - -On the fourth to last line, you can see it prompts you for your password. If you're using two-factor authentication or domain-managed logins, you will need to create an application password that bypasses these controls. If you're using Gmail and similar systems, you can do it directly from the interface; otherwise, contact your email system administrator. This will not compromise the security of your email system, but you should still keep the password complex and secret. - -When I checked my email account, I received a beautifully formatted test email. If your test email looks ready, send all the emails by entering **mailmerge --no-dry-run --no-limit**. - -### Send complex emails - -You can really see the power of Mailmerge when you take advantage of [Jinja2 templating][12]. I've found it useful for including conditional text and sending attachments. Here is a complex template and the corresponding database: - - -``` -$ cat mailmerge_template.txt -TO: {{Email}} -SUBJECT: Flock 2019 Funding Offer -FROM: Brian Exelbierd <[bexelbie@redhat.com][9]> -ATTACHMENT: attachments/{{File}} - -Hi {{Name}}, - -I am writing you on behalf of the Flock funding committee.  You requested funding for your attendance at Flock.  After careful consideration we are able to offer you the following funding: - -Travel Budget: {{Travel_Budget}} -{% if Hotel == "Yes" -%} -Lodging: Lodging in the hotel Wednesday-Sunday (4 nights) -{%- endif %} - -<<snip>> - -$ cat mailmerge_database.csv -Name,Email,Travel_Budget,Hotel,File -Brian,[bexelbie@redhat.com][9],1000,Yes,visa_bex.pdf -PersonA,[persona@fedoraproject.org][10],1500,No,visa_person_a.pdf -PèrsonB,[personb@fedoraproject.org][11],500,Yes,visa_person_b.pdf -``` - -There are two new things in this email. First, there's an attachment. I have to send visa invitation letters to international travelers to help them come to Flock, and the **ATTACHMENT** part of the header specifies which file to attach. To keep my directory clean, I put all of them in my Attachments subdirectory. Second, it includes conditional information about a hotel, because some people receive funding for their hotel stay, and I need to include those details for those who do. This is done with the **if** construction: - - -``` -{% if Hotel == "Yes" -%} -Lodging: Lodging in the hotel Wednesday-Sunday (4 nights) -{%- endif %} -``` - -This works just like an **if** in most programming languages. Jinja2 is very expressive and can do multi-level conditions. Experiment with making your life easier by including database elements that control the contents of the email. Using whitespace is important for email readability. The minus (**-**) symbols in **if** and **endif** are part of how Jinja2 controls [whitespace][13]. There are lots of options, so experiment to see what looks best for you. - -Also note that I extended the database with two fields, **Hotel** and **File**. These are the values that control the inclusion of the hotel text and provide the name of the attachment. In my example, PèrsonB and I got hotel funding, while PersonA didn't. - -Doing a dry-run and sending the emails is the same whether you're using a simple or a complex template. Give it a try! - -You can also experiment with using conditionals (**if** … **endif**) in the header. You can, for example, have an attachment only if one is in the database, or maybe you need to change the sender's name for some emails but not others. - -### Mailmerge's advantages - -The Mailmerge program provides a powerful but simple method of sending lots of customized emails. Everyone gets only the information they need, and extraneous steps and details are omitted. - -Even for simple group emails, I have found this method much more effective than sending one email to a bunch of people using CC or BCC. A lot of people filter their email and delay reading anything not sent directly to them. Using Mailmerge ensures that every person gets their own email. Messages will filter properly for the recipient and no one can accidentally "reply all" to the entire group. - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/19/8/sending-custom-emails-python - -作者:[Brian "bex" Exelbierd][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/bexelbie -[b]: https://github.com/lujun9972 -[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/email_chat_communication_message.png?itok=LKjiLnQu (Chat via email) -[2]: https://docs.fedoraproject.org/en-US/council/fcaic/ -[3]: https://github.com/awdeorio/mailmerge -[4]: https://github.com/awdeorio/mailmerge#install -[5]: mailto:myself@mydomain.com -[6]: mailto:bob@bobdomain.com -[7]: https://docs.python.org/3/library/csv.html -[8]: https://flocktofedora.org/ -[9]: mailto:bexelbie@redhat.com -[10]: mailto:persona@fedoraproject.org -[11]: mailto:personb@fedoraproject.org -[12]: http://jinja.pocoo.org/docs/latest/templates/ -[13]: http://jinja.pocoo.org/docs/2.10/templates/#whitespace-control diff --git a/sources/tech/20190813 Building a non-breaking breakpoint for Python debugging.md b/sources/tech/20190813 Building a non-breaking breakpoint for Python debugging.md deleted file mode 100644 index 1c33c05a68..0000000000 --- a/sources/tech/20190813 Building a non-breaking breakpoint for Python debugging.md +++ /dev/null @@ -1,238 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: ( ) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Building a non-breaking breakpoint for Python debugging) -[#]: via: (https://opensource.com/article/19/8/debug-python) -[#]: author: (Liran Haimovitch https://opensource.com/users/liranhaimovitch) - -Building a non-breaking breakpoint for Python debugging -====== -Have you ever wondered how to speed up a debugger? Here are some lessons -learned while building one for Python. -![Real python in the graphic jungle][1] - -This is the story of how our team at [Rookout][2] built non-breaking breakpoints for Python and some of the lessons we learned along the way. I'll be presenting all about the nuts and bolts of debugging in Python at [PyBay 2019][3] in San Francisco this month. Let's dig in. - -### The heart of Python debugging: sys.set_trace - -There are many Python debuggers out there. Some of the more popular include: - - * **pdb**, part of the Python standard library - * **PyDev**, the debugger behind the Eclipse and PyCharm IDEs - * **ipdb**, the IPython debugger - - - -Despite the range of choices, almost every Python debugger is based on just one function: **sys.set_trace**. And let me tell you, **[sys.settrace][4]** might just be the most complex function in the Python standard library. - -![set_trace Python 2 docs page][5] - -In simpler terms, **settrace** registers a trace function for the interpreter, which may be called in any of the following cases: - - * Function call - * Line execution - * Function return - * Exception raised - - - -A simple trace function might look like this: - - -``` -def simple_tracer(frame, event, arg): -  co = frame.f_code -  func_name = co.co_name -  line_no = frame.f_lineno -  print("{e} {f} {l}".format( -e=event, f=func_name, l=line_no)) -  return simple_tracer -``` - -When looking at this function, the first things that come to mind are its arguments and return values. The trace function arguments are: - - * **frame** object, which is the full state of the interpreter at the point of the function's execution - * **event** string, which can be **call**, **line**, **return**, or **exception** - * **arg** object, which is optional and depends on the event type - - - -The trace function returns itself because the interpreter keeps track of two kinds of trace functions: - - * **Global trace function (per thread):** This trace function is set for the current thread by **sys.settrace** and is invoked whenever a new **frame** is created by the interpreter (essentially on every function call). While there's no documented way to set the trace function for a different thread, you can call **threading.settrace** to set the trace function for all newly created **threading** module threads. - * **Local trace function (per frame):** This trace function is set by the interpreter to the value returned by the global trace function upon frame creation. There's no documented way to set the local trace function once the frame has been created. - - - -This mechanism is designed to allow the debugger to have more granular control over which frames are traced to reduce performance impact. - -### Building our debugger in three easy steps (or so we thought) - -With all that background, writing your own debugger using a custom trace function looks like a daunting task. Luckily, **pdb**, the standard Python debugger, is built on top of **Bdb**, a base class for building debuggers. - -A naive breakpoints debugger based on **Bdb** might look like this: - - -``` -import bdb -import inspect - -class Debugger(bdb.Bdb): -  def __init__(self): -      Bdb.__init__(self) -      self.breakpoints = dict() -      self.set_trace() - -def set_breakpoint(self, filename, lineno, method): -  self.set_break(filename, lineno) -  try : -      self.breakpoints[(filename, lineno)].add(method) -  except KeyError: -      self.breakpoints[(filename, lineno)] = [method] - -def user_line(self, frame): -  if not self.break_here(frame): -      return - -  # Get filename and lineno from frame -  (filename, lineno, _, _, _) = inspect.getframeinfo(frame) - -  methods = self.breakpoints[(filename, lineno)] -  for method in methods: -      method(frame) -``` - -All this does is: - - 1. Inherits from **Bdb** and write a simple constructor initializing the base class and tracing. - 2. Adds a **set_breakpoint** method that uses **Bdb** to set the breakpoint and keeps track of our breakpoints. - 3. Overrides the **user_line** method that is called by **Bdb** on certain user lines. The function makes sure it is being called for a breakpoint, gets the source location, and invokes the registered breakpoints - - - -### How well did the simple Bdb debugger work? - -Rookout is about bringing a debugger-like user experience to production-grade performance and use cases. So, how well did our naive breakpoint debugger perform? - -To test it and measure the global performance overhead, we wrote two simple test methods and executed each of them 16 million times under multiple scenarios. Keep in mind that no breakpoint was executed in any of the cases. - - -``` -def empty_method(): -   pass - -def simple_method(): -   a = 1 -   b = 2 -   c = 3 -   d = 4 -   e = 5 -   f = 6 -   g = 7 -   h = 8 -   i = 9 -   j = 10 -``` - -Using the debugger takes a shocking amount of time to complete. The bad results make it clear that our naive **Bdb** debugger is not yet production-ready. - -![First Bdb debugger results][6] - -### Optimizing the debugger - -There are three main ways to reduce debugger overhead: - - 1. **Limit local tracing as much as possible:** Local tracing is very costly compared to global tracing due to the much larger number of events per line of code. - 2. **Optimize "call" events and return control to the interpreter faster:** The main work in **call** events is deciding whether or not to trace. - 3. **Optimize "line" events and return control to the interpreter faster:** The main work in **line** events is deciding whether or not we hit a breakpoint. - - - -So we forked **Bdb**, reduced the feature set, simplified the code, optimized for hot code paths, and got impressive results. However, we were still not satisfied. So, we took another stab at it, migrated and optimized our code to **.pyx**, and compiled it using [Cython][7]. The final results (as you can see below) were still not good enough. So, we ended up diving into CPython's source code and realizing we could not make tracing fast enough for production use. - -![Second Bdb debugger results][8] - -### Rejecting Bdb in favor of bytecode manipulation - -After our initial disappointment from the trial-and-error cycles of standard debugging methods, we decided to look into a less obvious option: bytecode manipulation. - -The Python interpreter works in two main stages: - - 1. **Compiling Python source code into Python bytecode:** This unreadable (for humans) format is optimized for efficient execution and is often cached in those **.pyc** files we have all come to love. - 2. **Iterating through the bytecode in the _interpreter loop_:** This executes one instruction at a time. - - - -This is the pattern we chose: use **bytecode manipulation** to set **non-breaking breakpoints** with no global overhead. This is done by finding the bytecode in memory that represents the source line we are interested in and inserting a function call just before the relevant instruction. This way, the interpreter does not have to do any extra work to support our breakpoints. - -This approach is not magic. Here's a quick example. - -We start with a very simple function: - - -``` -def multiply(a, b): -   result = a * b -   return result -``` - -In documentation hidden in the **[inspect][9]** module (which has several useful utilities), we learn we can get the function's bytecode by accessing **multiply.func_code.co_code**: - - -``` -`'|\x00\x00|\x01\x00\x14}\x02\x00|\x02\x00S'` -``` - -This unreadable string can be improved using the **[dis][10]** module in the Python standard library. By calling **dis.dis(multiply.func_code.co_code)**, we get: - - -``` -  4          0 LOAD_FAST               0 (a) -             3 LOAD_FAST               1 (b) -             6 BINARY_MULTIPLY     -             7 STORE_FAST              2 (result) - -  5         10 LOAD_FAST               2 (result) -            13 RETURN_VALUE       -``` - -This gets us closer to understanding what happens behind the scenes of debugging but not to a straightforward solution. Unfortunately, Python does not offer a method for changing a function's bytecode from within the interpreter. You can overwrite the function object, but that's not good enough for the majority of real-world debugging scenarios. You have to go about it in a roundabout way using a native extension. - -### Conclusion - -When building a new tool, you invariably end up learning a lot about how stuff works. It also makes you think out of the box and keep your mind open to unexpected solutions. - -Working on non-breaking breakpoints for Rookout has taught me a lot about compilers, debuggers, server frameworks, concurrency models, and much much more. If you are interested in learning more about bytecode manipulation, Google's open source **[cloud-debug-python][11]** has tools for editing bytecode. - -* * * - -_Liran Haimovitch will present "[Understanding Python’s Debugging Internals][12]" at [PyBay][3], which will be held August 17-18 in San Francisco. Use code [OpenSource35][13] for a discount when you purchase your ticket to let them know you found out about the event from our community._ - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/19/8/debug-python - -作者:[Liran Haimovitch][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/liranhaimovitch -[b]: https://github.com/lujun9972 -[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/python_jungle_lead.jpeg?itok=pFKKEvT- (Real python in the graphic jungle) -[2]: https://rookout.com/ -[3]: https://pybay.com/ -[4]: https://docs.python.org/3/library/sys.html#sys.settrace -[5]: https://opensource.com/sites/default/files/uploads/python2docs.png (set_trace Python 2 docs page) -[6]: https://opensource.com/sites/default/files/uploads/debuggerresults1.png (First Bdb debugger results) -[7]: https://cython.org/ -[8]: https://opensource.com/sites/default/files/uploads/debuggerresults2.png (Second Bdb debugger results) -[9]: https://docs.python.org/2/library/inspect.html -[10]: https://docs.python.org/2/library/dis.html -[11]: https://github.com/GoogleCloudPlatform/cloud-debug-python -[12]: https://pybay.com/speaker/liran-haimovitch/ -[13]: https://ti.to/sf-python/pybay2019/discount/OpenSource35 diff --git a/sources/tech/20190814 9 open source cloud native projects to consider.md b/sources/tech/20190814 9 open source cloud native projects to consider.md deleted file mode 100644 index 8f95262799..0000000000 --- a/sources/tech/20190814 9 open source cloud native projects to consider.md +++ /dev/null @@ -1,266 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: ( ) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (9 open source cloud native projects to consider) -[#]: via: (https://opensource.com/article/19/8/cloud-native-projects) -[#]: author: (Bryant Son https://opensource.com/users/brsonhttps://opensource.com/users/marcobravo) - -9 open source cloud native projects to consider -====== -Work with containers? Get familiar with these projects from the Cloud -Native Computing Foundation -![clouds in the sky with blue pattern][1] - -As the practice of developing applications with containers is getting more popular, [cloud-native applications][2] are also on the rise. By [definition][3]: - -> "Cloud-native technologies are used to develop applications built with services packaged in containers, deployed as microservices, and managed on elastic infrastructure through agile DevOps processes and continuous delivery workflows." - -This description includes four elements that are integral to cloud-native applications: - - 1. Container - 2. Microservice - 3. DevOps - 4. Continuous integration and continuous delivery (CI/CD) - - - -Although these technologies have very distinct histories, they complement each other well and have led to surprisingly exponential growth of cloud-native applications and toolsets in a short time. This [Cloud Native Computing Foundation][4] (CNCF) infographic shows the size and breadth of the cloud-native application ecosystem today. - -![Cloud-Native Computing Foundation applications ecosystem][5] - -Cloud-Native Computing Foundation projects - -I mean, just look at that! And this is just a start. Just as NodeJS’s creation sparked the explosion of endless JavaScript tools, the popularity of container technology started the exponential growth of cloud-native applications. - -The good news is that there are several organizations that oversee and connect these dots together. One is the [**Open Containers Initiative (OCI)**][6], which is a lightweight, open governance structure (or project), "formed under the auspices of the Linux Foundation for the express purpose of creating open industry standards around container formats and runtime." The other is the **CNCF**, "an open source software foundation dedicated to making cloud native computing universal and sustainable." - -In addition to building a community around cloud-native applications generally, CNCF also helps projects set up structured governance around their cloud-native applications. CNCF created the concept of maturity levels—Sandbox, Incubating, or Graduated—which correspond to the Innovators, Early Adopters, and Early Majority tiers on the diagram below. - -![CNCF project maturity levels][7] - -CNCF project maturity levels - -The CNCF has detailed [criteria][8] for each maturity level (included below for readers’ convenience). A two-thirds supermajority of the Technical Oversight Committee (TOC) is required for a project to be Incubating or Graduated. - -### Sandbox stage - -> To be accepted in the sandbox, a project must have at least two TOC sponsors. See the CNCF Sandbox Guidelines v1.0 for the detailed process. - -### Incubating stage - -> Note: The incubation level is the point at which we expect to perform full due diligence on projects. -> -> To be accepted to incubating stage, a project must meet the sandbox stage requirements plus: -> -> * Document that it is being used successfully in production by at least three independent end users which, in the TOC’s judgement, are of adequate quality and scope. -> * Have a healthy number of committers. A committer is defined as someone with the commit bit; i.e., someone who can accept contributions to some or all of the project. -> * Demonstrate a substantial ongoing flow of commits and merged contributions. -> * Since these metrics can vary significantly depending on the type, scope, and size of a project, the TOC has final judgement over the level of activity that is adequate to meet these criteria -> - - -### Graduated stage - -> To graduate from sandbox or incubating status, or for a new project to join as a graduated project, a project must meet the incubating stage criteria plus: -> -> * Have committers from at least two organizations. -> * Have achieved and maintained a Core Infrastructure Initiative Best Practices Badge. -> * Have completed an independent and third party security audit with results published of similar scope and quality as the following example (including critical vulnerabilities addressed): and all critical vulnerabilities need to be addressed before graduation. -> * Adopt the CNCF Code of Conduct. -> * Explicitly define a project governance and committer process. This preferably is laid out in a GOVERNANCE.md file and references an OWNERS.md file showing the current and emeritus committers. -> * Have a public list of project adopters for at least the primary repo (e.g., ADOPTERS.md or logos on the project website). -> * Receive a supermajority vote from the TOC to move to graduation stage. Projects can attempt to move directly from sandbox to graduation, if they can demonstrate sufficient maturity. Projects can remain in an incubating state indefinitely, but they are normally expected to graduate within two years. -> - - -## 9 projects to consider - -While it’s impossible to cover all of the CNCF projects in this article, I’ll describe are nine of most interesting Graduated and Incubating open source projects. - -Name | License | What It Is ----|---|--- -[Kubernetes][9] | Apache 2.0 | Orchestration platform for containers -[Prometheus][10] | Apache 2.0 | Systems and service monitoring tool -[Envoy][11] | Apache 2.0 | Edge and service proxy -[rkt][12] | Apache 2.0 | Pod-native container engine -[Jaeger][13] | Apache 2.0 | Distributed tracing system -[Linkerd][14] | Apache 2.0 | Transparent service mesh -[Helm][15] | Apache 2.0 | Kubernetes package manager -[Etcd][16] | Apache 2.0 | Distributed key-value store -[CRI-O][17] | Apache 2.0 | Lightweight runtime for Kubernetes - -I also created this video tutorial to walk through these projects. - -## Graduated projects - -Graduated projects are considered mature—adopted by many organizations—and must adhere to the CNCF’s guidelines. Following are three of the most popular open source CNCF Graduated projects. (Note that some of these descriptions are adapted and reused from the projects' websites.) - -### Kubernetes - -Ah, Kubernetes. How can we talk about cloud-native applications without mentioning Kubernetes? Invented by Google, Kubernetes is undoubtedly the most famous container-orchestration platform for container-based applications, and it is also an open source tool. - -What is a container orchestration platform? Basically, a container engine on its own may be okay for managing a few containers. However, when you are talking about thousands of containers and hundreds of services, managing those containers becomes super complicated. This is where the container engine comes in. The container-orchestration engine helps scale containers by automating the deployment, management, networking, and availability of containers. - -Docker Swarm and Mesosphere Marathon are other container-orchestration engines, but it is safe to say that Kubernetes has won the race (at least for now). Kubernetes also gave birth to Container-as-a-Service (CaaS) platforms like [OKD][18], the Origin community distribution of Kubernetes that powers [Red Hat OpenShift][19]. - -To get started, visit the [Kubernetes GitHub repository][9], and access its documentation and learning resources from the [Kubernetes documentation][20] page. - -### Prometheus - -Prometheus is an open source system monitoring and alerting toolkit built at SoundCloud in 2012. Since then, many companies and organizations have adopted Prometheus, and the project has a very active developer and user community. It is now a standalone open source project that is maintained independently of the company. - -![Prometheus’ architecture][21] - -Prometheus’ architecture - -The easiest way to think about Prometheus is to visualize a production system that needs to be up 24 hours a day and 365 days a year. No system is perfect, and there are techniques to reduce failures (called fault-tolerant systems). However, if an issue occurs, the most important thing is to identify it as soon as possible. That is where a monitoring tool like Prometheus comes in handy. Prometheus is more than a container-monitoring tool, but it is most popular among cloud-native application companies. In addition, other open source monitoring tools, including [Grafana][22], leverage Prometheus. - -The best way to get started with Prometheus is to check out its [GitHub repo][10]. Running Prometheus locally is easy, but you need to have a container engine installed. You can access detailed documentation on [Prometheus’ website][23]. - -### Envoy - -Envoy (or Envoy Proxy) is an open source edge and service proxy designed for cloud-native applications. Created at Lyft, Envoy is a high-performance, C++, distributed proxy designed for single services and applications, as well as a communications bus and a universal data plane designed for large microservice service mesh architectures. Built on the learnings of solutions such as Nginx, HAProxy, hardware load balancers, and cloud load balancers, Envoy runs alongside every application and abstracts the network by providing common features in a platform-agnostic manner. - -When all service traffic in an infrastructure flows through an Envoy mesh, it becomes easy to visualize problem areas via consistent observability, tune overall performance, and add substrate features in a single place. Basically, Envoy Proxy is a service mesh tool that helps organizations build a fault-tolerant system for production environments. - -There are numerous alternatives for service mesh applications, such as Uber’s [Linkerd][24] (discussed below) and [Istio][25]. Istio extends Envoy Proxy by deploying as a [Sidecar][26] and leveraging the [Mixer][27] configuration model. Notable Envoy features are: - - * All the "table stakes" features (when paired with a control plane, like Istio) are included - * Low, 99th percentile latencies at scale when running under load - * Acts as an L3/L4 filter at its core with many L7 filters provided out of the box - * Support for gRPC and HTTP/2 (upstream/downstream) - * It’s API-driven and supports dynamic configuration and hot reloads - * Has a strong focus on metric collection, tracing, and overall observability - - - -Understanding Envoy, proving its capabilities, and realizing its full benefits require extensive experience with running production-level environments. You can learn more in its [detailed documentation][28] and by accessing its [GitHub][11] repository. - -## Incubating projects - -Following are six of the most popular open source CNCF Incubating projects. - -### rkt - -rkt, pronounced "rocket," is a pod-native container engine. It has a command-line interface (CLI) for running containers on Linux. In a sense, it is similar to other containers, like [Podman][29], Docker, and CRI-O. - -rkt was originally developed by CoreOS (later acquired by Red Hat), and you can find detailed [documentation][30] on its website and access the source code on [GitHub][12]. - -### Jaeger - -Jaeger is an open source, end-to-end distributed tracing system for cloud-native applications. In one way, it is a monitoring solution like Prometheus. Yet it is different because its use cases extend into: - - * Distributed transaction monitoring - * Performance and latency optimization - * Root-cause analysis - * Service dependency analysis - * Distributed context propagation - - - -Jaeger is an open source technology built by Uber. You can find [detailed documentation][31] on its website and its [source code][13] on GitHub. - -### Linkerd - -Like Lyft with Envoy Proxy, Uber developed Linkerd as an open source solution to maintain its service at the production level. In some ways, Linkerd is just like Envoy, as both are service mesh tools designed to give platform-wide observability, reliability, and security without requiring configuration or code changes. - -However, there are some subtle differences between the two. While Envoy and Linkerd function as proxies and can report over services that are connected, Envoy isn’t designed to be a Kubernetes Ingress controller, as Linkerd is. Notable features of Linkerd include: - - * Support for multiple platforms (Docker, Kubernetes, DC/OS, Amazon ECS, or any stand-alone machine) - * Built-in service discovery abstractions to unite multiple systems - * Support for gRPC, HTTP/2, and HTTP/1.x requests plus all TCP traffic - - - -You can read more about it on [Linkerd’s website][32] and access its source code on [GitHub][14]. - -### Helm - -Helm is basically the package manager for Kubernetes. If you’ve used Apache Maven, Maven Nexus, or a similar service, you will understand Helm’s purpose. Helm helps you manage your Kubernetes application. It uses "Helm Charts" to define, install, and upgrade even the most complex Kubernetes applications. Helm isn’t the only method for this; another concept becoming popular is [Kubernetes Operators][33], which are used by Red Hat OpenShift 4. - -You can try Helm by following the [quickstart guide][34] in its documentation or its [GitHub guide][15]. - -### Etcd - -Etcd is a distributed, reliable key-value store for the most critical data in a distributed system. Its key features are: - - * Well-defined, user-facing API (gRPC) - * Automatic TLS with optional client certificate authentication - * Speed (benchmarked at 10,000 writes per second) - * Reliability (distributed using Raft) - - - -Etcd is used as a built-in default data storage for Kubernetes and many other technologies. That said, it is rarely run independently or as a separate service; instead, it utilizes the one integrated into Kubernetes, OKD/OpenShift, or another service. There is also an [etcd Operator][35] to manage its lifecycle and unlock its API management capabilities: - -You can learn more in [etcd’s documentation][36] and access its [source code][16] on GitHub. - -### CRI-O - -CRI-O is an Open Container Initiative (OCI)-compliant implementation of the Kubernetes runtime interface. CRI-O is used for various functions including: - - * Runtime using runc (or any OCI runtime-spec implementation) and OCI runtime tools - * Image management using containers/image - * Storage and management of image layers using containers/storage - * Networking support through the Container Network Interface (CNI) - - - -CRI-O provides plenty of [documentation][37], including guides, tutorials, articles, and even podcasts, and you can also access its [GitHub page][17]. - -* * * - -Did I miss an interesting open source cloud-native project? Please let me know in the comments. - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/19/8/cloud-native-projects - -作者:[Bryant Son][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/brsonhttps://opensource.com/users/marcobravo -[b]: https://github.com/lujun9972 -[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/rh_003601_05_mech_osyearbook2016_cloud_cc.png?itok=XSV7yR9e (clouds in the sky with blue pattern) -[2]: https://opensource.com/article/18/7/what-are-cloud-native-apps -[3]: https://thenewstack.io/10-key-attributes-of-cloud-native-applications/ -[4]: https://www.cncf.io -[5]: https://opensource.com/sites/default/files/uploads/cncf_1.jpg (Cloud-Native Computing Foundation applications ecosystem) -[6]: https://www.opencontainers.org -[7]: https://opensource.com/sites/default/files/uploads/cncf_2.jpg (CNCF project maturity levels) -[8]: https://github.com/cncf/toc/blob/master/process/graduation_criteria.adoc -[9]: https://github.com/kubernetes/kubernetes -[10]: https://github.com/prometheus/prometheus -[11]: https://github.com/envoyproxy/envoy -[12]: https://github.com/rkt/rkt -[13]: https://github.com/jaegertracing/jaeger -[14]: https://github.com/linkerd/linkerd -[15]: https://github.com/helm/helm -[16]: https://github.com/etcd-io/etcd -[17]: https://github.com/cri-o/cri-o -[18]: https://www.okd.io/ -[19]: https://www.openshift.com -[20]: https://kubernetes.io/docs/home -[21]: https://opensource.com/sites/default/files/uploads/cncf_3.jpg (Prometheus’ architecture) -[22]: https://grafana.com -[23]: https://prometheus.io/docs/introduction/overview -[24]: https://linkerd.io/ -[25]: https://istio.io/ -[26]: https://istio.io/docs/reference/config/networking/v1alpha3/sidecar -[27]: https://istio.io/docs/reference/config/policy-and-telemetry -[28]: https://www.envoyproxy.io/docs/envoy/latest -[29]: https://podman.io -[30]: https://coreos.com/rkt/docs/latest -[31]: https://www.jaegertracing.io/docs/1.13 -[32]: https://linkerd.io/2/overview -[33]: https://coreos.com/operators -[34]: https://helm.sh/docs -[35]: https://github.com/coreos/etcd-operator -[36]: https://etcd.io/docs/v3.3.12 -[37]: https://github.com/cri-o/cri-o/blob/master/awesome.md diff --git a/sources/tech/20190814 How to install Python on Windows.md b/sources/tech/20190814 How to install Python on Windows.md deleted file mode 100644 index a3b7ea2454..0000000000 --- a/sources/tech/20190814 How to install Python on Windows.md +++ /dev/null @@ -1,203 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: ( ) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (How to install Python on Windows) -[#]: via: (https://opensource.com/article/19/8/how-install-python-windows) -[#]: author: (Seth Kenlon https://opensource.com/users/sethhttps://opensource.com/users/greg-p) - -How to install Python on Windows -====== -Install Python, run an IDE, and start coding right from your Microsoft -Windows desktop. -![Hands programming][1] - -So you want to learn to program? One of the most common languages to start with is [Python][2], popular for its unique blend of [object-oriented][3] structure and simple syntax. Python is also an _interpreted_ _language_, meaning you don't need to learn how to compile code into machine language: Python does that for you, allowing you to test your programs sometimes instantly and, in a way, while you write your code. - -Just because Python is easy to learn doesn't mean you should underestimate its potential power. Python is used by [movie][4] [studios][5], financial institutions, IT houses, video game studios, makers, hobbyists, [artists][6], teachers, and many others. - -On the other hand, Python is also a serious programming language, and learning it takes dedication and practice. Then again, you don't have to commit to anything just yet. You can install and try Python on nearly any computing platform, so if you're on Windows, this article is for you. - -If you want to try Python on a completely open source operating system, you can [install Linux][7] and then [try Python][8]. - -### Get Python - -Python is available from its website, [Python.org][9]. Once there, hover your mouse over the **Downloads** menu, then over the **Windows** option, and then click the button to download the latest release. - -![Downloading Python on Windows][10] - -Alternatively, you can click the **Downloads** menu button and select a specific version from the downloads page. - -### Install Python - -Once the package is downloaded, open it to start the installer. - -It is safe to accept the default install location, and it's vital to add Python to PATH. If you don't add Python to your PATH, then Python applications won't know where to find Python (which they require in order to run). This is _not_ selected by default, so activate it at the bottom of the install window before continuing! - -![Select "Add Python 3 to PATH"][11] - -Before Windows allows you to install an application from a publisher other than Microsoft, you must give your approval. Click the **Yes** button when prompted by the **User Account Control** system. - -![Windows UAC][12] - -Wait patiently for Windows to distribute the files from the Python package into the appropriate locations, and when it's finished, you're done installing Python. - -Time to play. - -### Install an IDE - -To write programs in Python, all you really need is a text editor, but it's convenient to have an integrated development environment (IDE). An IDE integrates a text editor with some friendly and helpful Python features. IDLE 3 and NINJA-IDE are two options to consider. - -#### IDLE 3 - -Python comes with an IDE called IDLE. You can write code in any text editor, but using an IDE provides you with keyword highlighting to help detect typos, a **Run** button to test code quickly and easily, and other code-specific features that a plain text editor like [Notepad++][13] normally doesn't have. - -To start IDLE, click the **Start** (or **Window**) menu and type **python** for matches. You may find a few matches, since Python provides more than one interface, so make sure you launch IDLE. - -![IDLE 3 IDE][14] - -If you don't see Python in the Start menu, launch the Windows command prompt by typing **cmd** in the Start menu, then type: - - -``` -`C:\Windows\py.exe` -``` - -If that doesn't work, try reinstalling Python. Be sure to select **Add Python to PATH** in the install wizard. Refer to the [Python docs][15] for detailed instructions. - -#### Ninja-IDE - -If you already have some coding experience and IDLE seems too simple for you, try [Ninja-IDE][16]. Ninja-IDE is an excellent Python IDE. It has keyword highlighting to help detect typos, quotation and parenthesis completion to avoid syntax errors, line numbers (helpful when debugging), indentation markers, and a **Run** button to test code quickly and easily. - -![Ninja-IDE][17] - -To install it, visit the Ninja-IDE website and [download the Windows installer][18]. The process is the same as with Python: start the installer, allow Windows to install a non-Microsoft application, and wait for the installer to finish. - -Once Ninja-IDE is installed, double-click the Ninja-IDE icon on your desktop or select it from the Start menu. - -### Tell Python what to do - -Keywords tell Python what you want it to do. In either IDLE or Ninja-IDE, go to the File menu and create a new file. - -Ninja users: Do not create a new project, just a new file. - -In your new, empty file, type this into IDLE or Ninja-IDE: - - -``` -`print("Hello world.")` -``` - - * If you are using IDLE, go to the Run menu and select the Run Module option. - * If you are using Ninja, click the Run File button in the left button bar. - - - -![Running code in Ninja-IDE][19] - -Any time you run code, your IDE prompts you to save the file you're working on. Do that before continuing. - -The keyword **print** tells Python to print out whatever text you give it in parentheses and quotes. - -That's not very exciting, though. At its core, Python has access to only basic keywords like **print** and **help**, basic math functions, and so on. - -Use the **import** keyword to load more keywords. Start a new file in IDLE or Ninja and name it **pen.py**. - -**Warning**: Do not call your file **turtle.py**, because **turtle.py** is the name of the file that contains the turtle program you are controlling. Naming your file **turtle.py** confuses Python because it thinks you want to import your own file. - -Type this code into your file and run it: - - -``` -`import turtle` -``` - -[Turtle][20] is a fun module to use. Add this code to your file: - - -``` -turtle.begin_fill() -turtle.forward(100) -turtle.left(90) -turtle.forward(100) -turtle.left(90) -turtle.forward(100) -turtle.left(90) -turtle.forward(100) -turtle.end_fill() -``` - -See what shapes you can draw with the turtle module. - -To clear your turtle drawing area, use the **turtle.clear()** keyword. What do you think the keyword **turtle.color("blue")** does? - -Try more complex code: - - -``` -import turtle as t -import time - -t.color("blue") -t.begin_fill() - -counter = 0 - -while counter < 4: -    t.forward(100) -    t.left(90) -    counter = counter+1 - -t.end_fill() -time.sleep(2) -``` - -As a challenge, try changing your script to get this result: - -![Example Python turtle output][21] - -Once you complete that script, you're ready to move on to more exciting modules. A good place to start is this [introductory dice game][22]. - -### Stay Pythonic - -Python is a fun language with modules for practically anything you can think to do with it. As you can see, it's easy to get started with Python, and as long as you're patient with yourself, you may find yourself understanding and writing Python code with the same fluidity as you write your native language. Work through some [Python articles][23] here on Opensource.com, try scripting some small tasks for yourself, and see where Python takes you. To really integrate Python with your daily workflow, you might even try Linux, which is natively scriptable in ways no other operating system is. You might find yourself, given enough time, using the applications you create! - -Good luck, and stay Pythonic. - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/19/8/how-install-python-windows - -作者:[Seth Kenlon][a] -选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]: https://opensource.com/users/sethhttps://opensource.com/users/greg-p -[b]: https://github.com/lujun9972 -[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/programming-code-keyboard-laptop.png?itok=pGfEfu2S (Hands programming) -[2]: https://www.python.org/ -[3]: https://opensource.com/article/19/7/get-modular-python-classes -[4]: https://github.com/edniemeyer/weta_python_db -[5]: https://www.python.org/about/success/ilm/ -[6]: https://opensource.com/article/19/7/rgb-cube-python-scribus -[7]: https://opensource.com/article/19/7/ways-get-started-linux -[8]: https://opensource.com/article/17/10/python-101 -[9]: https://www.python.org/downloads/ -[10]: https://opensource.com/sites/default/files/uploads/win-python-install.jpg (Downloading Python on Windows) -[11]: https://opensource.com/sites/default/files/uploads/win-python-path.jpg (Select "Add Python 3 to PATH") -[12]: https://opensource.com/sites/default/files/uploads/win-python-publisher.jpg (Windows UAC) -[13]: https://notepad-plus-plus.org/ -[14]: https://opensource.com/sites/default/files/uploads/idle3.png (IDLE 3 IDE) -[15]: http://docs.python.org/3/using/windows.html -[16]: http://ninja-ide.org/ -[17]: https://opensource.com/sites/default/files/uploads/win-python-ninja.jpg (Ninja-IDE) -[18]: http://ninja-ide.org/downloads/ -[19]: https://opensource.com/sites/default/files/uploads/ninja_run.png (Running code in Ninja-IDE) -[20]: https://opensource.com/life/15/8/python-turtle-graphics -[21]: https://opensource.com/sites/default/files/uploads/win-python-idle-turtle.jpg (Example Python turtle output) -[22]: https://opensource.com/article/17/10/python-101#python-101-dice-game -[23]: https://opensource.com/sitewide-search?search_api_views_fulltext=Python diff --git a/sources/tech/20190816 Cockpit and the evolution of the Web User Interface.md b/sources/tech/20190816 Cockpit and the evolution of the Web User Interface.md deleted file mode 100644 index 267a54e8d7..0000000000 --- a/sources/tech/20190816 Cockpit and the evolution of the Web User Interface.md +++ /dev/null @@ -1,169 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: ( ) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Cockpit and the evolution of the Web User Interface) -[#]: via: (https://fedoramagazine.org/cockpit-and-the-evolution-of-the-web-user-interface/) -[#]: author: (Shaun Assam https://fedoramagazine.org/author/sassam/) - -Cockpit and the evolution of the Web User Interface -====== - -![][1] - -Over 3 years ago the Fedora Magazine published an article entitled [Cockpit: an overview][2]. Since then, the interface has see some eye-catching changes. Today’s Cockpit is cleaner and the larger fonts makes better use of screen real-estate. - -This article will go over some of the changes made to the UI. It will also explore some of the general tools available in the web interface to simplify those monotonous sysadmin tasks. - -### Cockpit installation - -Cockpit can be installed using the **dnf install cockpit** command. This provides a minimal setup providing the basic tools required to use the interface. - -Another option is to install the Headless Management group. This will install additional packages used to extend the usability of Cockpit. It includes extensions for NetworkManager, software packages, disk, and SELinux management. - -Run the following commands to enable the web service on boot and open the firewall port: - -``` -$ sudo systemctl enable --now cockpit.socket -Created symlink /etc/systemd/system/sockets.target.wants/cockpit.socket -> /usr/lib/systemd/system/cockpit.socket - -$ sudo firewall-cmd --permanent --add-service cockpit -success -$ sudo firewall-cmd --reload -success -``` - -### Logging into the web interface - -To access the web interface, open your favourite browser and enter the server’s domain name or IP in the address bar followed by the service port (9090). Because Cockpit uses HTTPS, the installation will create a self-signed certificate to encrypt passwords and other sensitive data. You can safely accept this certificate, or request a CA certificate from your sysadmin or a trusted source. - -Once the certificate is accepted, the new and improved login screen will appear. Long-time users will notice the username and password fields have been moved to the top. In addition, the white background behind the credential fields immediately grabs the user’s attention. - -![][3] - -A feature added to the login screen since the previous article is logging in with **sudo** privileges — if your account is a member of the wheel group. Check the box beside _Reuse my password for privileged tasks_ to elevate your rights. - -Another edition to the login screen is the option to connect to remote servers also running the Cockpit web service. Click _Other Options_ and enter the host name or IP address of the remote machine to manage it from your local browser. - -### Home view - -Right off the bat we get a basic overview of common system information. This includes the make and model of the machine, the operating system, if the system is up-to-date, and more. - -![][4] - -Clicking the make/model of the system displays hardware information such as the BIOS/Firmware. It also includes details about the components as seen with **lspci**. - -![][5] - -Clicking on any of the options to the right will display the details of that device. For example, the _% of CPU cores_ option reveals details on how much is used by the user and the kernel. In addition, the _Memory & Swap_ graph displays how much of the system’s memory is used, how much is cached, and how much of the swap partition active. The _Disk I/O_ and _Network Traffic_ graphs are linked to the Storage and Networking sections of Cockpit. These topics will be revisited in an upcoming article that explores the system tools in detail. - -#### Secure Shell Keys and authentication - -Because security is a key factor for sysadmins, Cockpit now has the option to view the machine’s MD5 and SHA256 key fingerprints. Clicking the **Show fingerprints** options reveals the server’s ECDSA, ED25519, and RSA fingerprint keys. - -![][6] - -You can also add your own keys by clicking on your username in the top-right corner and selecting **Authentication**. Click on **Add keys** to validate the machine on other systems. You can also revoke your privileges in the Cockpit web service by clicking on the **X** button to the right. - -![][7] - -#### Changing the host name and joining a domain - -Changing the host name is a one-click solution from the home page. Click the host name currently displayed, and enter the new name in the _Change Host Name_ box. One of the latest features is the option to provide a _Pretty name_. - -Another feature added to Cockpit is the ability to connect to a directory server. Click _Join a domain_ and a pop-up will appear requesting the domain address or name, organization unit (optional), and the domain admin’s credentials. The Domain Membership group provides all the packages required to join an LDAP server including FreeIPA, and the popular Active Directory. - -To opt-out, click on the domain name followed by _Leave Domain_. A warning will appear explaining the changes that will occur once the system is no longer on the domain. To confirm click the red _Leave Domain_ button. - -![][8] - -#### Configuring NTP and system date and time - -Using the command-line and editing config files definitely takes the cake when it comes to maximum tweaking. However, there are times when something more straightforward would suffice. With Cockpit, you have the option to set the system’s date and time manually or automatically using NTP. Once synchronized, the information icon on the right turns from red to blue. The icon will disappear if you manually set the date and time. - -To change the timezone, type the continent and a list of cities will populate beneath. - -![][9] - -#### Shutting down and restarting - -You can easily shutdown and restart the server right from home screen in Cockpit. You can also delay the shutdown/reboot and send a message to warn users. - -![][10] - -#### Configuring the performance profile - -If the _tuned_ and _tuned-utils_ packages are installed, performance profiles can be changed from the main screen. By default it is set to a recommended profile. However, if the purpose of the server requires more performance, we can change the profile from Cockpit to suit those needs. - -![][11] - -### Terminal web console - -A Linux sysadmin’s toolbox would be useless without access to a terminal. This allows admins to fine-tune the server beyond what’s available in Cockpit. With the addition of themes, admins can quickly adjust the text and background colours to suit their preference. - -Also, if you type **exit** by mistake, click the _Reset_ button in the top-right corner*.* This will provide a fresh screen with a flashing cursor. - -![][12] - -### Adding a remote server and the Dashboard overlay - -The Headless Management group includes the Dashboard module (**cockpit-dashboard**). This provides an overview the of the CPU, memory, network, and disk performance in a real-time graph. Remote servers can also be added and managed through the same interface. - -For example, to add a remote computer in Dashboard, click the **+** button. Enter the name or IP address of the server and select the colour of your choice. This helps to differentiate the stats of the servers in the graph. To switch between servers, click on the host name (as seen in the screen-cast below). To remove a server from the list, click the check-mark icon, then click the red trash icon. The example below demonstrates how Cockpit manages a remote machine named _server02.local.lan_. - -![][13] - -### Documentation and finding help - -As always, the _man_ pages are a great place to find documentation. A simple search in the command-line results with pages pertaining to different aspects of using and configuring the web service. - -``` -$ man -k cockpit -cockpit (1) - Cockpit -cockpit-bridge (1) - Cockpit Host Bridge -cockpit-desktop (1) - Cockpit Desktop integration -cockpit-ws (8) - Cockpit web service -cockpit.conf (5) - Cockpit configuration file -``` - -The Fedora repository also has a package called **cockpit-doc**. The package’s description explains it best: - -> The Cockpit Deployment and Developer Guide shows sysadmins how to deploy Cockpit on their machines as well as helps developers who want to embed or extend Cockpit. - -For more documentation visit - -### Conclusion - -This article only touches upon some of the main functions available in Cockpit. Managing storage devices, networking, user account, and software control will be covered in an upcoming article. In addition, optional extensions such as the 389 directory service, and the _cockpit-ostree_ module used to handle packages in Fedora Silverblue. - -The options continue to grow as more users adopt Cockpit. The interface is ideal for admins who want a light-weight interface to control their server(s). - -What do you think about Cockpit? Share your experience and ideas in the comments below. - --------------------------------------------------------------------------------- - -via: https://fedoramagazine.org/cockpit-and-the-evolution-of-the-web-user-interface/ - -作者:[Shaun Assam][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://fedoramagazine.org/author/sassam/ -[b]: https://github.com/lujun9972 -[1]: https://fedoramagazine.org/wp-content/uploads/2019/08/cockpit-816x345.jpg -[2]: https://fedoramagazine.org/cockpit-overview/ -[3]: https://fedoramagazine.org/wp-content/uploads/2019/08/cockpit-login-screen.png -[4]: https://fedoramagazine.org/wp-content/uploads/2019/08/cockpit-home-screen.png -[5]: https://fedoramagazine.org/wp-content/uploads/2019/08/cockpit-system-info.gif -[6]: https://fedoramagazine.org/wp-content/uploads/2019/08/cockpit-ssh-key-fingerprints.png -[7]: https://fedoramagazine.org/wp-content/uploads/2019/08/cockpit-authentication.png -[8]: https://fedoramagazine.org/wp-content/uploads/2019/08/cockpit-hostname-domain.gif -[9]: https://fedoramagazine.org/wp-content/uploads/2019/08/cockpit-date-time.png -[10]: https://fedoramagazine.org/wp-content/uploads/2019/08/cockpit-power-options.gif -[11]: https://fedoramagazine.org/wp-content/uploads/2019/08/cockpit-tuned.gif -[12]: https://fedoramagazine.org/wp-content/uploads/2019/08/cockpit-terminal.gif -[13]: https://fedoramagazine.org/wp-content/uploads/2019/08/cockpit-add-remote-servers.gif diff --git a/sources/tech/20190915 How to Configure SFTP Server with Chroot in Debian 10.md b/sources/tech/20190915 How to Configure SFTP Server with Chroot in Debian 10.md deleted file mode 100644 index 877845b87a..0000000000 --- a/sources/tech/20190915 How to Configure SFTP Server with Chroot in Debian 10.md +++ /dev/null @@ -1,197 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: ( ) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (How to Configure SFTP Server with Chroot in Debian 10) -[#]: via: (https://www.linuxtechi.com/configure-sftp-chroot-debian10/) -[#]: author: (Pradeep Kumar https://www.linuxtechi.com/author/pradeep/) - -How to Configure SFTP Server with Chroot in Debian 10 -====== - -**SFTP** stands for Secure File Transfer Protocol / SSH File Transfer Protocol, it is one of the most common method which is used to transfer files securely over ssh from our local system to remote server and vice-versa. The main advantage of sftp is that we don’t need to install any additional package except ‘**openssh-server**’, in most of the Linux distributions ‘openssh-server’ package is the part of default installation. Other benefit of sftp is that we can allow user to use sftp only not ssh. - -[![Configure-sftp-debian10][1]][2] - -Recently Debian 10, Code name ‘Buster’ has been released, in this article we will demonstrate how to configure sftp with Chroot ‘Jail’ like environment in Debian 10 System. Here Chroot Jail like environment means that user’s cannot go beyond from their respective home directories or users cannot change directories from their home directories.  Following are the lab details: - - * OS = Debian 10 - * IP Address = 192.168.56.151 - - - -Let’s jump into SFTP Configuration Steps, - -### Step:1) Create a Group for sftp using groupadd command - -Open the terminal, create a group with a name “**sftp_users**” using below groupadd command, - -``` -root@linuxtechi:~# groupadd sftp_users -``` - -### Step:2) Add Users to Group ‘sftp_users’ and set permissions - -In case you want to create new user and want to add that user to ‘sftp_users’ group, then run the following command, - -**Syntax:** #  useradd -m -G sftp_users <user_name> - -Let’s suppose user name is ’Jonathan’ - -``` -root@linuxtechi:~# useradd -m -G sftp_users jonathan -``` - -set the password using following chpasswd command, - -``` -root@linuxtechi:~# echo "jonathan:" | chpasswd -``` - -In case you want to add existing users to ‘sftp_users’ group then run beneath usermod command, let’s suppose already existing user name is ‘chris’ - -``` -root@linuxtechi:~# usermod -G sftp_users chris -``` - -Now set the required permissions on Users, - -``` -root@linuxtechi:~# chown root /home/jonathan /home/chris/ -``` - -Create an upload folder in both the user’s home directory and set the correct ownership, - -``` -root@linuxtechi:~# mkdir /home/jonathan/upload -root@linuxtechi:~# mkdir /home/chris/upload -root@linuxtechi:~# chown jonathan /home/jonathan/upload -root@linuxtechi:~# chown chris /home/chris/upload -``` - -**Note:** User like Jonathan and Chris can upload files and directories to upload folder from their local systems. - -### Step:3) Edit sftp configuration file (/etc/ssh/sshd_config) - -As we have already stated that sftp operations are done over the ssh, so it’s configuration file is “**/etc/ssh/sshd_config**“, Before making any changes I would suggest first take the backup and then edit this file and add the following content, - -``` -root@linuxtechi:~# cp /etc/ssh/sshd_config /etc/ssh/sshd_config-org -root@linuxtechi:~# vim /etc/ssh/sshd_config -……… -#Subsystem sftp /usr/lib/openssh/sftp-server -Subsystem sftp internal-sftp - -Match Group sftp_users - X11Forwarding no - AllowTcpForwarding no - ChrootDirectory %h - ForceCommand internal-sftp -………… -``` - -Save & exit the file. - -To make above changes into the affect, restart ssh service using following systemctl command - -``` -root@linuxtechi:~# systemctl restart sshd -``` - -In above ‘sshd_config’ file we have commented out the line which starts with “Subsystem” and added new entry “Subsystem       sftp    internal-sftp” and new lines like, - -“**Match Group sftp_users”**  –> It means if a user is a part of ‘sftp_users’ group then apply rules which are mentioned below to this entry. - -“**ChrootDierctory %h**” –> It means users can only change directories within their respective home directories, they cannot go beyond their home directories, or in other words we can say users are not permitted to change directories, they will get jai like environment within their directories and can’t access any other user’s and system’s directories. - -“**ForceCommand internal-sftp**” –> It means users are limited to sftp command only. - -### Step:4) Test and Verify sftp - -Login to any other Linux system which is on the same network of your sftp server and then try to ssh sftp server via the users that we have mapped in ‘sftp_users’ group. - -``` -[root@linuxtechi ~]# ssh root@linuxtechi -root@linuxtechi's password: -Write failed: Broken pipe -[root@linuxtechi ~]# ssh root@linuxtechi -root@linuxtechi's password: -Write failed: Broken pipe -[root@linuxtechi ~]# -``` - -Above confirms that users are not allowed to SSH , now try sftp using following commands, - -``` -[root@linuxtechi ~]# sftp root@linuxtechi -root@linuxtechi's password: -Connected to 192.168.56.151. -sftp> ls -l -drwxr-xr-x 2 root 1001 4096 Sep 14 07:52 debian10-pkgs --rw-r--r-- 1 root 1001 155 Sep 14 07:52 devops-actions.txt -drwxr-xr-x 2 1001 1002 4096 Sep 14 08:29 upload -``` - -Let’s try to download a file using sftp ‘**get**‘ command - -``` -sftp> get devops-actions.txt -Fetching /devops-actions.txt to devops-actions.txt -/devops-actions.txt 100% 155 0.2KB/s 00:00 -sftp> -sftp> cd /etc -Couldn't stat remote file: No such file or directory -sftp> cd /root -Couldn't stat remote file: No such file or directory -sftp> -``` - -Above output confirms that we are able to download file from our sftp server to local machine and apart from this we have also tested that users cannot change directories. - -Let’s try to upload a file under “**upload**” folder, - -``` -sftp> cd upload/ -sftp> put metricbeat-7.3.1-amd64.deb -Uploading metricbeat-7.3.1-amd64.deb to /upload/metricbeat-7.3.1-amd64.deb -metricbeat-7.3.1-amd64.deb 100% 38MB 38.4MB/s 00:01 -sftp> ls -l --rw-r--r-- 1 1001 1002 40275654 Sep 14 09:18 metricbeat-7.3.1-amd64.deb -sftp> -``` - -This confirms that we have successfully uploaded a file from our local system to sftp server. - -Now test the SFTP server with winscp tool, enter the sftp server ip address along user’s credentials, - -[![Winscp-sftp-debian10][1]][3] - -Click on Login and then try to download and upload files - -[![Download-file-winscp-debian10-sftp][1]][4] - -Now try to upload files in upload folder, - -[![Upload-File-using-winscp-Debian10-sftp][1]][5] - -Above window confirms that uploading is also working fine, that’s all from this article. If these steps help you to configure SFTP server with chroot environment in Debian 10 then please do share your feedback and comments. - --------------------------------------------------------------------------------- - -via: https://www.linuxtechi.com/configure-sftp-chroot-debian10/ - -作者:[Pradeep Kumar][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.linuxtechi.com/author/pradeep/ -[b]: https://github.com/lujun9972 -[1]: data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7 -[2]: https://www.linuxtechi.com/wp-content/uploads/2019/09/Configure-sftp-debian10.jpg -[3]: https://www.linuxtechi.com/wp-content/uploads/2019/09/Winscp-sftp-debian10.jpg -[4]: https://www.linuxtechi.com/wp-content/uploads/2019/09/Download-file-winscp-debian10-sftp.jpg -[5]: https://www.linuxtechi.com/wp-content/uploads/2019/09/Upload-File-using-winscp-Debian10-sftp.jpg diff --git a/sources/tech/20190925 Debugging in Emacs- The Grand Unified Debugger.md b/sources/tech/20190925 Debugging in Emacs- The Grand Unified Debugger.md deleted file mode 100644 index f1a7fe8060..0000000000 --- a/sources/tech/20190925 Debugging in Emacs- The Grand Unified Debugger.md +++ /dev/null @@ -1,97 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: ( ) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Debugging in Emacs: The Grand Unified Debugger) -[#]: via: (https://opensourceforu.com/2019/09/debugging-in-emacs-the-grand-unified-debugger/) -[#]: author: (Vineeth Kartha https://opensourceforu.com/author/vineeth-kartha/) - -Debugging in Emacs: The Grand Unified Debugger -====== - -[![][1]][2] - -_This article briefly explores the features of the Grand Unified Debugger, a debugging tool for Emacs._ - -If you are a C/C++ developer, it is highly likely that you have crossed paths with GDB (the GNU debugger) which is, without doubt, one of the most powerful and unrivalled debuggers out there. Its only drawback is that it is command line based, and though that offers a lot of power, it is sometimes a bit restrictive as well. This is why smart people started coming up with IDEs to integrate editors and debuggers, and give them a GUI. There are still developers who believe that using the mouse reduces productivity and that mouse-click based GUIs are temptations by the devil. -Since Emacs is one of the coolest text editors out there, I am going to show you how to write, compile and debug code without having to touch the mouse or move out of Emacs. - -![Figure 1: Compile command in Emacs’ mini buffer][3] - -![Figure 2: Compilation status][4] - -The Grand Unified Debugger, or GUD as it is commonly known, is an Emacs mode in which GDB can be run from within Emacs. This provides all the features of Emacs in GDB. The user does not have to move out of the editor to debug the code written. - -**Setting the stage for the Grand Unified Debugger** -If you are using a Linux machine, then it is likely you will have GDB and gcc already installed. The next step is to ensure that Emacs is also installed. I am assuming that the readers are familiar with GDB and have used it at least for basic debugging. If not, please do check out some quick introductions to GDB that are widely available on the Internet. - -For people who are new to Emacs, let me introduce you to some basic terminology. Throughout this article, you will see shortcut commands such as C-c, M-x, etc. C means the Ctrl key and M means the Alt key. C-c means the Ctrl + c keys are pressed. If you see C-c c, it means Ctrl + c is pressed followed by c. Also, in Emacs, the main area where you edit the text is called the main buffer, and the area at the bottom of the Emacs window, where commands are entered, is called the mini buffer. -Start Emacs and to create a new file, press _C-x C-f_. This will prompt you to enter a file name. Let us call our file ‘buggyFactorial.cpp’. Once the file is open, type in the code shown below: - -``` -#include -#include -int factorial(int num) { -int product = 1; -while(num--) { -product *= num; -} -return product; -} -int main() { -int result = factorial(5); -assert(result == 120); -} -``` - -Save the file with _C-x C-s_. Once the file is saved, it’s time to compile the code. Press _M-x_ and in the prompt that comes up, type in compile and hit Enter. Then, in the prompt, replace whatever is there with _g++ -g buggyFactorial.cpp_ and again hit _Enter_. - -This will open up another buffer in Emacs that will show the status of the compile and, hopefully, if the code typed in is correct, you will get a buffer like the one shown in Figure 2. - -To hide this compilation status buffer, make sure your cursor is in the compilation buffer (you can do this without the mouse using _C-x o_-this is used to move the cursor from one open buffer to the other), and then press _C-x 0_. The next step is to run the code and see if it works fine. Press M-! and in the mini buffer prompt, type _./a.out._ - -See the mini buffer that says the assertion is failed. Clearly, something is wrong with the code, because the factorial (5) is 120. So let’s debug the code now. - -![Figure 3: Output of the code in the mini buffer][5] - -![Figure 4: The GDB buffer in Emacs][6] - -**Debugging the code using GUD** -Now, since we have the code compiled, it’s time to see what is wrong with it. Press M-x and in the prompt, enter _gdb._ In the next prompt that appears, write _gdb -i=mi a.out_, which will start GDB in the Emacs buffer and if everything goes well, you should get the window that’s shown in Figure 4. -At the gdb prompt, type break main and then r to run the program. This should start running the program and should break at the _main()_. - -As soon as GDB hits the break point at main, a new buffer will open up showing the code that you are debugging. Notice the red dot on the left side, which is where your breakpoint was set. There will be a small indicator that shows which line of the code you are on. Currently, this will be the same as the break point itself (Figure 5). - -![Figure 5: GDB and the code in split windows][7] - -![Figure 6: Show the local variables in a separate frame in Emacs][8] - -To debug the factorial function, we need to step into it. For this, you can either use the _gdb_ prompt and the gdb command step, or you can use the Emacs shortcut _C-c C-s_. There are other similar shortcuts, but I prefer using the GDB commands. So I will use them in the rest of this article. -Let us keep an eye on the local variables while stepping through the factorial number. Check out Figure 6 for how to get an Emacs frame to show the local variables. - -Step through the code in the GDB prompt and watch the value of the local variable change. In the first iteration of the loop itself, we see a problem. The value of the product should have been 5 and not 4. - -This is where I leave you and now it’s up to the readers to explore and discover the magic land called GUD mode. Every gdb command works in the GUD mode as well. I leave the fix to this code as an exercise to readers. Explore and see how you can customise things to make your workflow simpler and become more productive while debugging. - --------------------------------------------------------------------------------- - -via: https://opensourceforu.com/2019/09/debugging-in-emacs-the-grand-unified-debugger/ - -作者:[Vineeth Kartha][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://opensourceforu.com/author/vineeth-kartha/ -[b]: https://github.com/lujun9972 -[1]: https://i0.wp.com/opensourceforu.com/wp-content/uploads/2019/09/Screenshot-from-2019-09-25-15-39-46.png?resize=696%2C440&ssl=1 (Screenshot from 2019-09-25 15-39-46) -[2]: https://i0.wp.com/opensourceforu.com/wp-content/uploads/2019/09/Screenshot-from-2019-09-25-15-39-46.png?fit=800%2C506&ssl=1 -[3]: https://i1.wp.com/opensourceforu.com/wp-content/uploads/2019/09/Figure_1.png?resize=350%2C228&ssl=1 -[4]: https://i2.wp.com/opensourceforu.com/wp-content/uploads/2019/09/Figure_2.png?resize=350%2C228&ssl=1 -[5]: https://i0.wp.com/opensourceforu.com/wp-content/uploads/2019/09/Figure_3.png?resize=350%2C228&ssl=1 -[6]: https://i0.wp.com/opensourceforu.com/wp-content/uploads/2019/09/Figure_4.png?resize=350%2C227&ssl=1 -[7]: https://i1.wp.com/opensourceforu.com/wp-content/uploads/2019/09/Figure_5.png?resize=350%2C200&ssl=1 -[8]: https://i1.wp.com/opensourceforu.com/wp-content/uploads/2019/09/Figure_6.png?resize=350%2C286&ssl=1 diff --git a/sources/tech/20191003 4 open source eBook readers for Android.md b/sources/tech/20191003 4 open source eBook readers for Android.md deleted file mode 100644 index f2c6638bc4..0000000000 --- a/sources/tech/20191003 4 open source eBook readers for Android.md +++ /dev/null @@ -1,174 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: ( ) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (4 open source eBook readers for Android) -[#]: via: (https://opensource.com/article/19/10/open-source-ereaders-android) -[#]: author: (Scott Nesbitt https://opensource.com/users/scottnesbitt) - -4 open source eBook readers for Android -====== -Looking for a new eBook app? Check out these four solid, open source -eBook readers for Android. -![Computer browser with books on the screen][1] - -Who doesn't like a good read? Instead of frittering away your time on social media or a [messaging app][2], you can enjoy a book, magazine, or another document on your Android-powered phone or tablet. - -To do that, all you need is the right eBook reader app. So let's take a look at four solid, open source eBook readers for Android. - -### Book Reader - -Let's start off with my favorite open source Android eBook reader: [Book Reader][3]. It's based on the older, open source version of the now-proprietary FBReader app. Like earlier versions of its progenitor, Book Reader is simple and minimal, but it does a great job. - -**Pros of Book Reader:** - - * It's easy to use. - * The app's interface follows Android's [Material Design guidelines][4], so it's very clean. - * You can add bookmarks to an eBook and share text with other apps on your device. - * There's growing support for languages other than English. - - - -**Cons of Book Reader:** - - * Book Reader has a limited number of configuration options. - * There's no built-in dictionary or support for an external dictionary. - - - -**Supported eBook formats:** - -Book Reader supports EPUB, .mobi, PDF, [DjVu][5], HTML, plain text, Word documents, RTF, and [FictionBook][6]. - -![Book Reader Android app][7] - -Book Reader's source code is licensed under the GNU General Public License version 3.0, and you can find it on [GitLab][8]. - -### Cool Reader - -[Cool Reader][9] is a zippy and easy-to-use eBook app. While I think the app's icons are reminiscent of those found in Windows Vista, Cool Reader does have several useful features. - -**Pros of Cool Reader:** - - * It's highly configurable. You can change fonts, line and paragraph spacing, hyphenation, font sizes, margins, and background colors. - * You can override the stylesheet in a book. I found this useful with two or three books that set all text in small capital letters. - * It automatically scans your device for new books when you start it up. You can also access books on [Project Gutenberg][10] and the [Internet Archive][11]. - - - -**Cons of Cool Reader:** - - * Cool Reader doesn't have the cleanest or most modern interface. - * While it's usable out of the box, you really need to do a bit of configuration to make Cool Reader comfortable to use. - * The app's default dictionary is proprietary, although you can swap it out for [an open one][12]. - - - -**Supported eBook formats:** - -You can use Cool Reader to browse EPUB, FictionBook, plain text, RTF, HTML, [Compiled HTML Help][13] (.chm), and TCR (the eBook format for the Psion series of handheld computers) files. - -![Cool Reader Android app][14] - -Cool Reader's source code is licensed under the GNU General Public License version 2, and you can find it on [Sourceforge][15]. - -### KOReader - -[KOReader][16] was originally created for [E Ink][17] eBook readers but found its way to Android. While testing it, I found KOReader to be both useful and frustrating in equal measures. It's definitely not a bad app, but it's not my first choice. - -**Pros of KOReader:** - - * It's highly configurable. - * It supports multiple languages. - * It allows you to look up words using a [dictionary][18] (if you have one installed) or Wikipedia (if you're connected to the internet). - - - -**Cons of KOReader:** - - * You need to change the settings for each book you read. KOReader doesn't remember settings when you open a new book. - * The interface is reminiscent of a dedicated eBook reader. The app doesn't have that Android look and feel. - - - -**Supported eBook formats:** - -You can view PDF, DjVu, CBT, and [CBZ][5] eBooks. It also supports EPUB, FictionBook, .mobi, Word documents, text files, and [Compiled HTML Help][13] (.chm) files. - -![KOReader Android app][19] - -KOReader's source code is licensed under the GNU Affero General Public License version 3.0, and you can find it on [GitHub][20]. - -### Booky McBookface - -Yes, that really is the name of [this eBook reader][21]. It's the most basic of the eBook readers in this article but don't let that (or the goofy name) put you off. Booky McBookface is easy to use and does the one thing it does quite well. - -**Pros of Booky McBookface:** - - * There are no frills. It's just you and your eBook. - * The interface is simple and clean. - * Long-tapping the app's icon in the Android Launcher pops up a menu from which you can open the last book you were reading, get a list of unread books, or find and open a book on your device. - - - -**Cons of Booky McBookface:** - - * The app has few configuration options—you can change the size of the font and the brightness, and that's about it. - * You need to use the buttons at the bottom of the screen to navigate through an eBook. Tapping the edges of the screen doesn't work. - * You can't add bookmarks to an eBook. - - - -**Supported eBook formats:** - -You can read eBooks in EPUB, HTML, or plain text formats with Booky McBookface. - -![Booky McBookface Android app][22] - -Booky McBookface's source code is available under the GNU General Public License version 3.0, and you can find it [on GitHub][23]. - -Do you have a favorite open source eBook reader for Android? Share it with the community by leaving a comment. - -Have you ever downloaded an Android app only to find that it wants access to all your phone's... - -There is a rich and growing ecosystem of open source applications for mobile devices, just like the... - -With these seven open source apps, you can play chess against your phone or an online opponent,... - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/19/10/open-source-ereaders-android - -作者:[Scott Nesbitt][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/scottnesbitt -[b]: https://github.com/lujun9972 -[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/computer_browser_program_books_read.jpg?itok=iNMWe8Bu (Computer browser with books on the screen) -[2]: https://opensource.com/article/19/3/open-messenger-client -[3]: https://f-droid.org/en/packages/com.github.axet.bookreader/ -[4]: https://material.io/design/ -[5]: https://opensource.com/article/19/3/comic-book-archive-djvu -[6]: https://en.wikipedia.org/wiki/FictionBook -[7]: https://opensource.com/sites/default/files/uploads/book_reader-book-list.png (Book Reader Android app) -[8]: https://gitlab.com/axet/android-book-reader/tree/HEAD -[9]: https://f-droid.org/en/packages/org.coolreader/ -[10]: https://www.gutenberg.org/ -[11]: https://archive.org -[12]: http://aarddict.org/ -[13]: https://fileinfo.com/extension/chm -[14]: https://opensource.com/sites/default/files/uploads/cool_reader-icons.png (Cool Reader Android app) -[15]: https://sourceforge.net/projects/crengine/ -[16]: https://f-droid.org/en/packages/org.koreader.launcher/ -[17]: https://en.wikipedia.org/wiki/E_Ink -[18]: https://github.com/koreader/koreader/wiki/Dictionary-support -[19]: https://opensource.com/sites/default/files/uploads/koreader-lookup.png (KOReader Android app) -[20]: https://github.com/koreader/koreader -[21]: https://f-droid.org/en/packages/com.quaap.bookymcbookface/ -[22]: https://opensource.com/sites/default/files/uploads/booky_mcbookface-menu.png (Booky McBookface Android app) -[23]: https://github.com/quaap/BookyMcBookface diff --git a/sources/tech/20191007 20 Linux Command Tips and Tricks That Will Save You A Lot of Time.md b/sources/tech/20191007 20 Linux Command Tips and Tricks That Will Save You A Lot of Time.md new file mode 100644 index 0000000000..da080e65ea --- /dev/null +++ b/sources/tech/20191007 20 Linux Command Tips and Tricks That Will Save You A Lot of Time.md @@ -0,0 +1,307 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (20 Linux Command Tips and Tricks That Will Save You A Lot of Time) +[#]: via: (https://itsfoss.com/linux-command-tricks/) +[#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/) + +20 Linux Command Tips and Tricks That Will Save You A Lot of Time +====== + +_**Brief**: Here are some tiny but useful Linux commands, terminal tricks and shortcuts that will save you a lot of time while working with Linux command line._ + +Have you ever encountered a moment when you see your colleague using some simple Linux commands for tasks that took you several keystrokes? And when you saw that you were like, “Wow! I didn’t know it could have been done that easily”. + +In this article, I’ll show you some pro Linux command tricks that will save you a lot of time and in some cases, from plenty of frustration. Not only your friends or colleagues will ‘wow’ at you, it will also help you increase your productivity as you will need fewer keystrokes and even fewer mouse clicks. + +It’s not that these are Linux tips for beginners only. Chances are that even experienced Linux users will find some hidden gems that they were not aware despite using Linux for all these years. + +In any case, you [learn Linux][1] by experience, be it your own or someone else’s :) + +### Cool Linux terminal tricks to save time and increase productivity + +![][2] + +You might already know a few of these Linux command tips or perhaps all of it. In either case, you are welcome to share your favorite tricks in the comment section. + +Some of these tips also depend on how the shell is configured. Let’s begin! + +#### 0\. Using tab for autocompletion + +I’ll start with something really obvious and yet really important: tab completion. + +When you are starting to type something in Linux terminal, you can hit the tab key and it will suggest all the possible options that start with string you have typed so far. + +For example, if you are trying to copy a file named my_best_file_1.txt, you can just type ‘cp m’ and hit tab to see the possible options. + +![Use tab for auto-completion][3] + +You can use tab in completing commands as well. + +[irp posts=”16244″ name=”Difference Between apt and apt-get Explained”] + +#### 1\. Switch back to the last working directory + +Suppose you end up in a long directory path and then you move to another directory in a totally different path. And then you realize that you have to go back to the previous directory you were in. In this case, all you need to do is to type this command: + +``` +cd - +``` + +This will put you back in the last working directory. You don’t need to type the long directory path or copy paste it anymore. + +![Easily switch between directories][4] + +#### 2\. Go back to home directory + +This is way too obvious. You can use the command below to move to your home directory from anywhere in Linux command-line: + +``` +cd ~ +``` + +However, you can also use just cd to go back to home directory: + +``` +cd +``` + +Most modern Linux distributions have the shell pre-configured for this command. Saves you at least two keystrokes here. + +![Move to Home as quickly as possible][5] + +#### 3\. List the contents of a directory + +You must be guessing what’s the trick in the command for listing the contents of a directory. Everyone knows to use the ls -l for this purpose. + +And that’s the thing. Most people use ls -l to list the contents of the directory, whereas the same can be done with the following command: + +``` +ll +``` + +Again, this depends on the Linux distributions and shell configuration, but chances are that you’ll be able to use it in most Linux distributions. + +![Using ll instead of ls -l][6] + +#### 4\. Running multiple commands in one single command + +Suppose, you have to run several commands one after another. Do you wait for the first command to finish running and then execute the next one? + +You can use the ‘;’ separator for this purpose. This way, you can run a number of commands in one line. No need to wait for the previous commands to finish their business. + +``` +command_1; command_2; command_3 +``` + +#### 5\. Running multiple commands in one single command only if the previous command was successful + +In the previous command, you saw how to run several commands in one single command to save time. But what if you have to make sure that commands don’t fail? + +Imagine a situation where you want to build a code and then if the build was successful, run the make? + +You can use && separator for this case. && makes sure that the next command will only run when the previous command was successful. + +``` +command_1 && command_2 +``` + +A good example of this command is when you use sudo apt update && sudo apt upgrade to upgrade your system. + +#### 6\. Easily search and use the commands that you had used in the past + +Imagine a situation where you used a long command couple of minutes/hours ago and you have to use it again. Problem is that you cannot remember the exact command anymore. + +Reverse search is your savior here. You can search for the command in the history using a search term. + +Just use the keys ctrl+r to initiate reverse search and type some part of the command. It will look up into the history and will show you the commands that matches the search term. + +``` +ctrl+r search_term +``` + +By default, it will show just one result. To see more results matching your search term, you will have to use ctrl+r again and again. To quit reverse search, just use Ctrl+C. + +![Reverse search in command history][7] + +Note that in some Bash shells, you can also use Page Up and Down key with your search term and it will autocomplete the command. + +#### 7\. Unfreeze your Linux terminal from accidental Ctrl+S + +You probably are habitual of using Ctrl+S for saving. But if you use that in Linux terminal, you’ll have a frozen terminal. + +Don’t worry, you don’t have to close the terminal, not anymore. Just use Ctrl+Q and you can use the terminal again. + +``` +ctrl+Q +``` + +#### 8\. Move to beginning or end of line + +Suppose you are typing a long command and midway you realize that you had to change something at the beginning. You would use several left arrow keystrokes to move to the start of the line. And similarly for going to the end of the line. + +You can use Home and End keys here of course but alternatively, you can use Ctrl+A to go to the beginning of the line and Ctrl+E to go to the end. + +![Move to the beginning or end of the line][8] + +I find it more convenient than using the home and end keys, especially on my laptop. + +#### 9\. Reading a log file in real time + +In situations where you need to analyze the logs while the application is running, you can use the tail command with -f option. + +``` +tail -f path_to_Log +``` + +You can also use the regular grep options to display only those lines that are meaningful to you: + +``` +tail -f path_to_log | grep search_term +``` + +You can also use the option F here. This will keep the tail running even if the log file is deleted. So if the log file is created again, tail will continue logging. + +#### 10\. Reading compressed logs without extracting + +Server logs are usually gzip compressed to save disk space. It creates an issue for the developer or sysadmin analyzing the logs. You might have to [scp][9] it to your local and then extract it to access the files because, at times, you don’t have write permission to extract the logs. + +Thankfully, z commands save you in such situations. z commands provide alternatives of the regular commands that you use to deal with log files such as less, cat, grep etc. + +So you get zless, zcat, zgrep etc and you don’t even have to explicitly extract the compressed files. Please refer to my earlier article about [using z commands to real compressed logs][10] in detail. + +This was one of the secret finds that won me a coffee from my colleague. + +#### 11\. Use less to read files + +To see the contents of a file, cat is not the best option especially if it is a big file. cat command will display the entire file on your screen. + +You can use Vi, Vim or other terminal based text editors but if you just want to read a file, less command is a far better choice. + +``` +less path_to_file +``` + +You can search for terms inside less, move by page, display with line numbers etc. + +#### 12\. Reuse the last item from the previous command with !$ + +Using the argument of the previous command comes handy in many situations. + +Say you have to create a directory and then go into the newly created directory. There you can use the !$ options. + +![Use !$ to use the argument of last command][11] + +A better way to do the same is to use alt+. . You can use . a number times to shuffle between the options of the last commands. + +#### 13\. Reuse the previous command in present command with !! + +You can call the entire previous command with !!. This comes particularly useful when you have to run a command and realize that it needs root privileges. + +A quick sudo !! saves plenty of keystrokes here. + +![Use !! to use last command as an argument][12] + +#### 14\. Using alias to fix typos + +You probably already know what is an alias command in Linux. What you can do is, to use them to fix typos. + +For example, you might often mistype grep as gerp. If you put an alias in your bashrc in this fashion: + +``` +alias gerp=grep +``` + +This way you won’t have to retype the command again. + +#### 15\. Copy Paste in Linux terminal + +This one is slightly ambiguous because it depends on Linux distributions and terminal applications. But in general, you should be able to copy paste commands with these shortcuts: + + * Select the text for copying and right click for paste (works in Putty and other Windows SSH clients) + * Select the text for copying and middle click (scroll button on the mouse) for paste + * Ctrl+Shift+C for copy and Ctrl+Shift+V for paste + + + +#### 16\. Kill a running command/process + +This one is perhaps way too obvious. If there is a command running in the foreground and you want to exit it, you can press Ctrl+C to stop that running command. + +#### 17\. Using yes command for commands or scripts that need interactive response + +If there are some commands or scripts that need user interaction and you know that you have to enter Y each time it requires an input, you can use Yes command. + +Just use it in the below fashion: + +``` +yes | command_or_script +``` + +#### 18\. Empty a file without deleting it + +If you just want to empty the contents of a text file without deleting the file itself, you can use a command similar to this: + +``` +> filename +``` + +#### 19\. Find if there are files containing a particular text + +There are multiple ways to search and find in Linux command line. But in the case when you just want to see if there are files that contain a particular text, you can use this command: + +``` +grep -Pri Search_Term path_to_directory +``` + +I highly advise mastering find command though. + +#### 20\. Using help with any command + +I’ll conclude this article with one more obvious and yet very important ‘trick’, using help with a command or a command line tool. + +Almost all command and command line tool come with a help page that shows how to use the command. Often using help will tell you the basic usage of the tool/command. + +Just use it in this fashion: + +``` +command_tool --help +``` + +#### Your favorite Linux command line tricks? + +I have deliberately not included commands like [fuck][13] because those are not standard commands that you’ll find everywhere. The tricks discussed here should be usable almost in all Linux distributions and shell without the need of installing a new tool. + +I would also suggest [using alias command in Linux][14] to replace complicated commands with a simple. Saves a lot of time. + +I know that there are more Linux command tricks to save time in the terminal. Why not share some of your experiences with Linux and do share your best trick with rest of the community here? The comment section below is at your disposal. + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/linux-command-tricks/ + +作者:[Abhishek Prakash][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/abhishek/ +[b]: https://github.com/lujun9972 +[1]: https://itsfoss.com/learn-linux-for-free/ +[2]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2017/08/Linux-Command-Tricks-Save-Time.jpeg?resize=800%2C450&ssl=1 +[3]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2017/08/Linux-Command-tricks-to-save-time-8.png?ssl=1 +[4]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2017/08/Linux-Command-tricks-to-save-time-1.png?ssl=1 +[5]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2017/08/Linux-Command-tricks-to-save-time-2.png?ssl=1 +[6]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2017/08/Linux-Command-tricks-to-save-time-3.png?ssl=1 +[7]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2017/08/Linux-Command-tricks-to-save-time-4.png?ssl=1 +[8]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2017/08/Linux-Command-tricks-to-save-time-5.png?ssl=1 +[9]: http://www.hypexr.org/linux_scp_help.php +[10]: https://itsfoss.com/read-compressed-log-files-linux/ +[11]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2017/08/Linux-Command-tricks-to-save-time-6.png?ssl=1 +[12]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2017/08/Linux-Command-tricks-to-save-time-7.png?ssl=1 +[13]: https://github.com/nvbn/thefuck +[14]: https://linuxhandbook.com/linux-alias-command/ diff --git a/sources/tech/20191014 How to make a Halloween lantern with Inkscape.md b/sources/tech/20191014 How to make a Halloween lantern with Inkscape.md deleted file mode 100644 index 0f15fae6e6..0000000000 --- a/sources/tech/20191014 How to make a Halloween lantern with Inkscape.md +++ /dev/null @@ -1,188 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: ( ) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (How to make a Halloween lantern with Inkscape) -[#]: via: (https://opensource.com/article/19/10/how-make-halloween-lantern-inkscape) -[#]: author: (Jess Weichler https://opensource.com/users/cyanide-cupcake) - -How to make a Halloween lantern with Inkscape -====== -Use open source tools to make a spooky and fun decoration for your -favorite Halloween haunt. -![Halloween - backlit bat flying][1] - -The spooky season is almost here! This year, decorate your haunt with a unique Halloween lantern made with open source! - -Typically, a portion of a lantern's structure is opaque to block the light from within. What makes a lantern a lantern are the parts that are missing: windows cut from the structure so that light can escape. While it's impractical for lighting, a lantern with windows in spooky shapes and lurking silhouettes can be atmospheric and a lot of fun to create. - -This article demonstrates how to create your own lantern using [Inkscape][2]. If you don't have Inkscape, you can install it from your software repository on Linux or download it from the [Inkscape website][3] on MacOS and Windows. - -### Supplies - - * Template ([A4][4] or [Letter][5] size) - * Cardstock (black is traditional) - * Tracing paper (optional) - * Craft knife, ruler, and cutting mat (a craft cutting machine/laser cutter can be used instead) - * Craft glue - * LED tea-light "candle" -_Safety note:_ Only use battery-operated candles for this project. - - - -### Understanding the template - -To begin, download the correct template for your region (A4 or Letter) from the links above and open it in Inkscape. - -* * * - -* * * - -* * * - -**![Lantern template screen][6]** - -The gray-and-white checkerboard background is see-through (in technical terms, it's an _alpha channel_.) - -The black base forms the lantern. Right now, there are no windows for light to shine through; the lantern is a solid black base. You will use the **Union** and **Difference** options in Inkscape to design the windows digitally. - -The dotted blue lines represent fold scorelines. The solid orange lines represent guides. Windows for light should not be placed outside the orange boxes. - -To the left of the template are a few pre-made objects you can use in your design. - -### To create a window or shape - - 1. Create an object that looks like the window style you want. Objects can be created using any of the shape tools in Inkscape's left toolbar. Alternately, you can download Creative Commons- or Public Domain-licensed clipart and import the PNG file into your project. - 2. When you are happy with the shape of the object, turn it into a **Path** (rather than a **Shape**, which Inkscape sees as two different kinds of objects) by selecting **Object > Object to Path** in the top menu. - - - -![Object to path menu][7] - - 3. Place the object on top of the base shape. - 4. Select both the object and the black base by clicking one, pressing and holding the Shift key, then selecting the other. - 5. Select **Object > Difference** from the top menu to remove the shape of the object from the base. This creates what will become a window in your lantern. - - - -![Object > Difference menu][8] - -### To add an object to a window - -After making a window, you can add objects to it to create a scene. - -**Tips:** - - * All objects, including text, must be connected to the base of the lantern. If not, they will fall out after cutting and leave a blank space. - * Avoid small, intricate details. These are difficult to cut, even when using a machine like a laser cutter or a craft plotter. - - - 1. Create or import an object. - 2. Place the object inside the window so that it is touching at least two sides of the base. - 3. With the object selected, choose **Object > Object to Path** from the top menu. - - - -![Object to path menu][9] - - 4. Select the object and the black base by clicking on each one while holding the Shift key). - 5. Select **Object > Union** to join the object and the base. - - - -### Add text - -Text can either be cut out from the base to create a window (as I did with the stars) or added to a window (which blocks the light from within the lantern). If you're creating a window, only follow steps 1 and 2 below, then use **Difference** to remove the text from the base layer. - - 1. Select the Text tool from the left sidebar to create text. Thick, bold fonts work best. - -![Text tool][10] - - 2. Select your text, then choose **Path > Object to Path** from the top menu. This converts the text object to a path. Note that this step means you can no longer edit the text, so perform this step _only after_ you're sure you have the word or words you want. - - 3. After you have converted the text, you can press **F2** on your keyboard to activate the **Node Editor** tool to clearly show the nodes of the text when it is selected with this tool. - - - - -![Text selected with Node editor][11] - - 4. Ungroup the text. - 5. Adjust each letter so that it slightly overlaps its neighboring letter or the base. - - - -![Overlapping the text][12] - - 6. To connect all of the letters to one another and to the base, re-select all the text and the base, then select **Path > Union**. - -![Connecting letters and base with Path > Union][13] - - - - -### Prepare for printing - -The following instructions are for hand-cutting your lantern. If you're using a laser cutter or craft plotter, follow the techniques required by your hardware to prepare your files. - - 1. In the **Layer** panel, click the **Eye** icon beside the **Safety** layer to hide the safety lines. If you don't see the Layer panel, reveal it by selecting **Layer > Layers** from the top menu. - 2. Select the black base. In the **Fill and Stroke** panel, set the fill to **X** (meaning _no fill_) and the **Stroke** to solid black (that's #000000ff to fans of hexes). - - - -![Setting fill and stroke][14] - - 3. Print your pattern with **File > Print**. - - 4. Using a craft knife and ruler, carefully cut around each black line. Lightly score the dotted blue lines, then fold. - -![Cutting out the lantern][15] - - 5. To finish off the windows, cut tracing paper to the size of each window and glue it to the inside of the lantern. - -![Adding tracing paper][16] - - 6. Glue the lantern together at the tabs. - - 7. Turn on a battery-powered LED candle and place it inside your lantern. - - - - -![Completed lantern][17] - -Now your lantern is complete and ready to light up your haunt. Happy Halloween! - -How to make Halloween bottle labels with Inkscape, GIMP, and items around the house. - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/19/10/how-make-halloween-lantern-inkscape - -作者:[Jess Weichler][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/cyanide-cupcake -[b]: https://github.com/lujun9972 -[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/halloween_bag_bat_diy.jpg?itok=24M0lX25 (Halloween - backlit bat flying) -[2]: https://opensource.com/article/18/1/inkscape-absolute-beginners -[3]: http://inkscape.org -[4]: https://www.dropbox.com/s/75qzjilg5ak2oj1/papercraft_lantern_A4_template.svg?dl=0 -[5]: https://www.dropbox.com/s/8fswdge49jwx91n/papercraft_lantern_letter_template%20.svg?dl=0 -[6]: https://opensource.com/sites/default/files/uploads/lanterntemplate_screen.png (Lantern template screen) -[7]: https://opensource.com/sites/default/files/uploads/lantern1.png (Object to path menu) -[8]: https://opensource.com/sites/default/files/uploads/lantern2.png (Object > Difference menu) -[9]: https://opensource.com/sites/default/files/uploads/lantern3.png (Object to path menu) -[10]: https://opensource.com/sites/default/files/uploads/lantern4.png (Text tool) -[11]: https://opensource.com/sites/default/files/uploads/lantern5.png (Text selected with Node editor) -[12]: https://opensource.com/sites/default/files/uploads/lantern6.png (Overlapping the text) -[13]: https://opensource.com/sites/default/files/uploads/lantern7.png (Connecting letters and base with Path > Union) -[14]: https://opensource.com/sites/default/files/uploads/lantern8.png (Setting fill and stroke) -[15]: https://opensource.com/sites/default/files/uploads/lantern9.jpg (Cutting out the lantern) -[16]: https://opensource.com/sites/default/files/uploads/lantern10.jpg (Adding tracing paper) -[17]: https://opensource.com/sites/default/files/uploads/lantern11.jpg (Completed lantern) diff --git a/sources/tech/20191031 4 Python tools for getting started with astronomy.md b/sources/tech/20191031 4 Python tools for getting started with astronomy.md deleted file mode 100644 index 79e64651b3..0000000000 --- a/sources/tech/20191031 4 Python tools for getting started with astronomy.md +++ /dev/null @@ -1,69 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: ( ) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (4 Python tools for getting started with astronomy) -[#]: via: (https://opensource.com/article/19/10/python-astronomy-open-data) -[#]: author: (Gina Helfrich, Ph.D. https://opensource.com/users/ginahelfrich) - -4 Python tools for getting started with astronomy -====== -Explore the universe with NumPy, SciPy, Scikit-Image, and Astropy. -![Person looking up at the stars][1] - -NumFOCUS is a nonprofit charity that supports amazing open source toolkits for scientific computing and data science. As part of the effort to connect Opensource.com readers with the NumFOCUS community, we are republishing some of the most popular articles from [our blog][2]. To learn more about our mission and programs, please visit [numfocus.org][3]. If you're interested in participating in the NumFOCUS community in person, check out a local [PyData event][4] happening near you. - -* * * - -### Astronomy with Python - -Python is a great language for science, and specifically for astronomy. The various packages such as [NumPy][5], [SciPy][6], [Scikit-Image][7] and [Astropy][8] (to name but a few) are all a great testament to the suitability of Python for astronomy, and there are plenty of use cases. [NumPy, Astropy, and SciPy are NumFOCUS fiscally sponsored projects; Scikit-Image is an affiliated project.] Since leaving the field of astronomical research behind more than 10 years ago to start a second career as software developer, I have always been interested in the evolution of these packages. Many of my former colleagues in astronomy used most if not all of these packages for their research work. I have since worked on implementing professional astronomy software packages for instruments for the Very Large Telescope (VLT) in Chile, for example. - -It struck me recently that the Python packages have evolved to such an extent that it is now fairly easy for anyone to build [data reduction][9] scripts that can provide high-quality data products. Astronomical data is ubiquitous, and what is more, it is almost all publicly available—you just need to look for it. - -For example, ESO, which runs the VLT, offers the data for download on their site. Head over to [www.eso.org/UserPortal][10] and create a user name for their portal. If you look for data from the instrument SPHERE you can download a full dataset for any of the nearby stars that have exoplanet or proto-stellar discs. It is a fantastic and exciting project for any Pythonista to reduce that data and make the planets or discs that are deeply hidden in the noise visible. - -I encourage you to download the ESO or any other astronomy imaging dataset and go on that adventure. Here are a few tips: - - 1. Start off with a good dataset. Have a look at papers about nearby stars with discs or exoplanets and then search, for example: . Notice that some data on this site is marked as red and some as green. The red data is not publicly available yet — it will say under “release date” when it will be available. - 2. Read something about the instrument you are using the data from. Try and get a basic understanding of how the data is obtained and what the standard data reduction should look like. All telescopes and instruments have publicly available documents about this. - 3. You will need to consider the standard problems with astronomical data and correct for them: - 1. Data comes in FITS files. You will need **pyfits** or **astropy** (which contains pyfits) to read them into **NumPy** arrays. In some cases the data comes in a cube and you should to use **numpy.median **along the z-axis to turn them into 2-D arrays. For some SPHERE data you get two copies of the same piece of sky on the same image (each has a different filter) which you will need to extract using **indexing and slicing.** - 2. The master dark and bad pixel map. All instruments will have specific images taken as “dark frames” that contain images with the shutter closed (no light at all). Use these to extract a mask of bad pixels using **NumPy masked arrays** for this. This mask of bad pixels will be very important — you need to keep track of it as you process the data to get a clean combined image in the end. In some cases it also helps to subtract this master dark from all scientific raw images. - 3. Instruments will typically also have a master flat frame. This is an image or series of images taken with a flat uniform light source. You will need to divide all scientific raw images by this (again, using numpy masked array makes this an easy division operation). - 4. For planet imaging, the fundamental technique to make planets visible against a bright star rely on using a coronagraph and a technique known as angular differential imaging. To that end, you need to identify the optical centre on the images. This is one of the most tricky steps and requires finding some artificial helper images embedded in the images using **skimage.feature.blob_dog**. - 4. Be patient. It can take a while to understand the data format and how to handle it. Making some plots and histograms of the pixel data can help you to understand it. It is well worth it to be persistent! You will learn a lot about imaging data and processing. - - - -Using the tools offered by NumPy, SciPy, Astropy, scikit-image and more in combination, with some patience and persistence, it is possible to analyse the vast amount of available astronomical data to produce some stunning results. And who knows, maybe you will be the first one to find a planet that was previously overlooked! Good luck! - -_This article was originally published on the NumFOCUS blog and is republished with permission. It is based on [a talk][11] by [Ole Moeller-Nilsson][12], CTO at Pivigo. If you want to support NumFOCUS, you can donate [here][13] or find your local [PyData event][4] happening around the world._ - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/19/10/python-astronomy-open-data - -作者:[Gina Helfrich, Ph.D.][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/ginahelfrich -[b]: https://github.com/lujun9972 -[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/space_stars_cosmos_person.jpg?itok=XUtz_LyY (Person looking up at the stars) -[2]: https://numfocus.org/blog -[3]: https://numfocus.org -[4]: https://pydata.org/ -[5]: http://numpy.scipy.org/ -[6]: http://www.scipy.org/ -[7]: http://scikit-image.org/ -[8]: http://www.astropy.org/ -[9]: https://en.wikipedia.org/wiki/Data_reduction -[10]: http://www.eso.org/UserPortal -[11]: https://www.slideshare.net/OleMoellerNilsson/pydata-lonon-finding-planets-with-python -[12]: https://twitter.com/olly_mn -[13]: https://numfocus.org/donate diff --git a/sources/tech/20191031 Advance your awk skills with two easy tutorials.md b/sources/tech/20191031 Advance your awk skills with two easy tutorials.md deleted file mode 100644 index 76f7a54e5f..0000000000 --- a/sources/tech/20191031 Advance your awk skills with two easy tutorials.md +++ /dev/null @@ -1,287 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (nacyro) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Advance your awk skills with two easy tutorials) -[#]: via: (https://opensource.com/article/19/10/advanced-awk) -[#]: author: (Dave Neary https://opensource.com/users/dneary) - -Advance your awk skills with two easy tutorials -====== -Go beyond one-line awk scripts with mail merge and word counting. -![a checklist for a team][1] - -Awk is one of the oldest tools in the Unix and Linux user's toolbox. Created in the 1970s by Alfred Aho, Peter Weinberger, and Brian Kernighan (the A, W, and K of the tool's name), awk was created for complex processing of text streams. It is a companion tool to sed, the stream editor, which is designed for line-by-line processing of text files. Awk allows more complex structured programs and is a complete programming language. - -This article will explain how to use awk for more structured and complex tasks, including a simple mail merge application. - -### Awk program structure - -An awk script is made up of functional blocks surrounded by **{}** (curly brackets). There are two special function blocks, **BEGIN** and **END**, that execute before processing the first line of the input stream and after the last line is processed. In between, blocks have the format: - - -``` -`pattern { action statements }` -``` - -Each block executes when the line in the input buffer matches the pattern. If no pattern is included, the function block executes on every line of the input stream. - -Also, the following syntax can be used to define functions in awk that can be called from any block: - - -``` -`function name(parameter list) { statements }` -``` - -This combination of pattern-matching blocks and functions allows the developer to structure awk programs for reuse and readability. - -### How awk processes text streams - -Awk reads text from its input file or stream one line at a time and uses a field separator to parse it into a number of fields. In awk terminology, the current buffer is a _record_. There are a number of special variables that affect how awk reads and processes a file: - - * **FS** (field separator): By default, this is any whitespace (spaces or tabs) - * **RS** (record separator): By default, a newline (**\n**) - * **NF** (number of fields): When awk parses a line, this variable is set to the number of fields that have been parsed - * **$0:** The current record - * **$1, $2, $3, etc.:** The first, second, third, etc. field from the current record - * **NR** (number of records): The number of records that have been parsed so far by the awk script - - - -There are many other variables that affect awk's behavior, but this is enough to start with. - -### Awk one-liners - -For a tool so powerful, it's interesting that most of awk's usage is basic one-liners. Perhaps the most common awk program prints selected fields from an input line from a CSV file, a log file, etc. For example, the following one-liner prints a list of usernames from **/etc/passwd**: - - -``` -`awk -F":" '{print $1 }' /etc/passwd` -``` - -As mentioned above, **$1** is the first field in the current record. The **-F** option sets the FS variable to the character **:**. - -The field separator can also be set in a BEGIN function block: - - -``` -`awk 'BEGIN { FS=":" } {print $1 }' /etc/passwd` -``` - -In the following example, every user whose shell is not **/sbin/nologin** can be printed by preceding the block with a pattern match: - - -``` -`awk 'BEGIN { FS=":" } ! /\/sbin\/nologin/ {print $1 }' /etc/passwd` -``` - -### Advanced awk: Mail merge - -Now that you have some of the basics, try delving deeper into awk with a more structured example: creating a mail merge. - -A mail merge uses two files, one (called in this example **email_template.txt**) containing a template for an email you want to send: - - -``` -From: Program committee <[pc@event.org][2]> -To: {firstname} {lastname} <{email}> -Subject: Your presentation proposal - -Dear {firstname}, - -Thank you for your presentation proposal: -  {title} - -We are pleased to inform you that your proposal has been successful! We -will contact you shortly with further information about the event -schedule. - -Thank you, -The Program Committee -``` - -And the other is a CSV file (called **proposals.csv**) with the people you want to send the email to: - - -``` -firstname,lastname,email,title -Harry,Potter,[hpotter@hogwarts.edu][3],"Defeating your nemesis in 3 easy steps" -Jack,Reacher,[reacher@covert.mil][4],"Hand-to-hand combat for beginners" -Mickey,Mouse,[mmouse@disney.com][5],"Surviving public speaking with a squeaky voice" -Santa,Claus,[sclaus@northpole.org][6],"Efficient list-making" -``` - -You want to read the CSV file, replace the relevant fields in the first file (skipping the first line), then write the result to a file called **acceptanceN.txt**, incrementing **N** for each line you parse. - -Write the awk program in a file called **mail_merge.awk**. Statements are separated by **;** in awk scripts. The first task is to set the field separator variable and a couple of other variables the script needs. You also need to read and discard the first line in the CSV, or a file will be created starting with _Dear firstname_. To do this, use the special function **getline** and reset the record counter to 0 after reading it. - - -``` -BEGIN { -  FS=","; -  template="email_template.txt"; -  output="acceptance"; -  getline; -  NR=0; -} -``` - -The main function is very straightforward: for each line processed, a variable is set for the various fields—**firstname**, **lastname**, **email**, and **title**. The template file is read line by line, and the function **sub** is used to substitute any occurrence of the special character sequences with the value of the relevant variable. Then the line, with any substitutions made, is output to the output file. - -Since you are dealing with the template file and a different output file for each line, you need to clean up and close the file handles for these files before processing the next record. - - -``` -{ -        # Read relevant fields from input file -        firstname=$1; -        lastname=$2; -        email=$3; -        title=$4; - -        # Set output filename -        outfile=(output NR ".txt"); - -        # Read a line from template, replace special fields, and -        # print result to output file -        while ( (getline ln < template) > 0 ) -        { -                sub(/{firstname}/,firstname,ln); -                sub(/{lastname}/,lastname,ln); -                sub(/{email}/,email,ln); -                sub(/{title}/,title,ln); -                print(ln) > outfile; -        } - -        # Close template and output file in advance of next record -        close(outfile); -        close(template); -} -``` - -You're done! Run the script on the command line with: - - -``` -`awk -f mail_merge.awk proposals.csv` -``` - -or - - -``` -`awk -f mail_merge.awk < proposals.csv` -``` - -and you will find text files generated in the current directory. - -### Advanced awk: Word frequency count - -One of the most powerful features in awk is the associative array. In most programming languages, array entries are typically indexed by a number, but in awk, arrays are referenced by a key string. You could store an entry from the file _proposals.txt_ from the previous section. For example, in a single associative array, like this: - - -``` -        proposer["firstname"]=$1; -        proposer["lastname"]=$2; -        proposer["email"]=$3; -        proposer["title"]=$4; -``` - -This makes text processing very easy. A simple program that uses this concept is the idea of a word frequency counter. You can parse a file, break out words (ignoring punctuation) in each line, increment the counter for each word in the line, then output the top 20 words that occur in the text. - -First, in a file called **wordcount.awk**, set the field separator to a regular expression that includes whitespace and punctuation: - - -``` -BEGIN { -        # ignore 1 or more consecutive occurrences of the characters -        # in the character group below -        FS="[ .,:;()<>{}@!\"'\t]+"; -} -``` - -Next, the main loop function will iterate over each field, ignoring any empty fields (which happens if there is punctuation at the end of a line), and increment the word count for the words in the line. - - -``` -{ -        for (i = 1; i <= NF; i++) { -                if ($i != "") { -                        words[$i]++; -                } -        } -} -``` - -Finally, after the text is processed, use the END function to print the contents of the array, then use awk's capability of piping output into a shell command to do a numerical sort and print the 20 most frequently occurring words: - - -``` -END { -        sort_head = "sort -k2 -nr | head -n 20"; -        for (word in words) { -                printf "%s\t%d\n", word, words[word] | sort_head; -        } -        close (sort_head); -} -``` - -Running this script on an earlier draft of this article produced this output: - - -``` -[[dneary@dhcp-49-32.bos.redhat.com][7]]$ awk -f wordcount.awk < awk_article.txt -the     79 -awk     41 -a       39 -and     33 -of      32 -in      27 -to      26 -is      25 -line    23 -for     23 -will    22 -file    21 -we      16 -We      15 -with    12 -which   12 -by      12 -this    11 -output  11 -function        11 -``` - -### What's next? - -If you want to learn more about awk programming, I strongly recommend the book [_Sed and awk_][8] by Dale Dougherty and Arnold Robbins. - -One of the keys to progressing in awk programming is mastering "extended regular expressions." Awk offers several powerful additions to the sed [regular expression][9] syntax you may already be familiar with. - -Another great resource for learning awk is the [GNU awk user guide][10]. It has a full reference for awk's built-in function library, as well as lots of examples of simple and complex awk scripts. - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/19/10/advanced-awk - -作者:[Dave Neary][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/dneary -[b]: https://github.com/lujun9972 -[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/checklist_hands_team_collaboration.png?itok=u82QepPk (a checklist for a team) -[2]: mailto:pc@event.org -[3]: mailto:hpotter@hogwarts.edu -[4]: mailto:reacher@covert.mil -[5]: mailto:mmouse@disney.com -[6]: mailto:sclaus@northpole.org -[7]: mailto:dneary@dhcp-49-32.bos.redhat.com -[8]: https://www.amazon.com/sed-awk-Dale-Dougherty/dp/1565922255/book -[9]: https://en.wikibooks.org/wiki/Regular_Expressions/POSIX-Extended_Regular_Expressions -[10]: https://www.gnu.org/software/gawk/manual/gawk.html diff --git a/sources/tech/20191111 A guide to intermediate awk scripting.md b/sources/tech/20191111 A guide to intermediate awk scripting.md index 7e788b2adc..53e7126eb1 100644 --- a/sources/tech/20191111 A guide to intermediate awk scripting.md +++ b/sources/tech/20191111 A guide to intermediate awk scripting.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: (lnrCoder) +[#]: translator: ( ) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) diff --git a/sources/tech/20191118 Creating a Chat Bot with Recast.AI.md b/sources/tech/20191118 Creating a Chat Bot with Recast.AI.md deleted file mode 100644 index 0b86e74c72..0000000000 --- a/sources/tech/20191118 Creating a Chat Bot with Recast.AI.md +++ /dev/null @@ -1,181 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: ( ) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Creating a Chat Bot with Recast.AI) -[#]: via: (https://opensourceforu.com/2019/11/creating-a-chat-bot-with-recast-ai/) -[#]: author: (Athira Lekshmi C.V https://opensourceforu.com/author/athira-lekshmi/) - -Creating a Chat Bot with Recast.AI -====== - -[![][1]][2] - -_According to a Gartner report from February 2018, “25 per cent of customer service and support operations will integrate virtual customer assistant (VCA) or chatbot technology across engagement channels by 2020, up from less than 2 per cent in 2017.” In the light of this, readers will find this tutorial on how the open source Recast. AI bot-creating platform works, helpful._ - -Chat bots, both voice based and others, have been in use for quite a while now. From chatbots that engage the user in a murder mystery game to bots which help in real estate deals and medical diagnosis, chatbots have traversed across domains. - -There are many platforms which enable users to create and deploy bots. Recast.AI (now known as SAP Conversational AI after its acquisition by SAP) is a forerunner amongst these. - -The cool interface, its collaborative nature and the analytics tools it provides, make it a popular choice. -As the Recast official site says, “It is an ultimate collaborative platform to build, train, deploy and monitor intelligent bots.” - -![Figure 1: Setting the bot properties][3] - -![Figure 2: Bot dashboard][4] - -![Figure 3: Searching an intent][5] - -**Building a basic bot in Recast** -Let us look at how to build a basic bot in Recast. - - 1. Create an account in __. Signing up can be done either with an email ID or with a GitHub account. - 2. Once you log in, you will land on the dashboard. Click on the + New Bot icon on the top right-hand side to create a new bot. - 3. On the next screen, you will see that there is a set of predefined skills you can select. Select Greetings for the time being (Figure 1). This bot is already trained to understand basic greetings. - 4. Provide a name for your bot. For now, since this is a very basic bot, you can have the bot crack some jokes, so let us name it Joke Bot and select the default language as English. - 5. Select Non-personal data under the data policy since you won’t be dealing with any sensitive information; then select the Public bot option and click on Create a bot. - - - -So that’s your bot created on the Recast platform. - -![Figure 4: @joke intent][6] - -![Figure 5: Predefined expressions][7] - -**The five stages of developing a bot** -To use the words from the official Recast blog, there are five stages in a bot’s life. - - * Training – Teaching your bot what it needs to understand - * Building – Creating your conversational flow with the Bot Builder tool - * Coding – Connecting your bot with external APIs or a database - * Connecting – Shipping your bot to one or several messaging platforms - * Monitoring – Training your bot to make it sharper and get insights on its usage - - - -**Training a bot through intents** -You will be able to see the options to either search, fork or create an intent in the dashboard. -“An intent is a box of expressions that mean the same thing but which are constructed in different ways. Intents are the heart of your bot’s understanding. Each one of your intents represents an idea your bot is able to understand.” (from the _Recast.AI_ website) -As decided earlier, you need the bot to be able to crack jokes. So the base line is that the bot should be able to understand that the user is asking it to tell a joke; it shouldn’t be that even when the user just says, “Hi,” the bot responds with a joke – that would not be good. -So group the utterances that the user might make, like: - -``` -Tell me a joke. -Tell me a funny fact. -Can you crack a joke? -What’s funny today? -``` - -………………… - -Before going on to create the intent from scratch, let us explore the Search/fork option. Type _Joke_ in the search field (Figure 3). This gives a list of intents created by users of Recast around the globe, which is public, and this is why Recast is said to be collaborative in nature. So there’s no need to create all intents from scratch, one can build upon intents already created. This brings down the effort needed to train the bot with common intents. - - * Select the first intent in the list and fork it into the bot. - * Click on the Fork button. The intent is now added to the bot (Figure 4). - * Click on the intent @joke, and a list of expressions which already exist in the intent will be displayed (Figure 5). - * Add a few more expressions to it (Figure 6). - - - -![Figure 6: Suggested expressions][8] - -![Figure 7: Suggested expressions][9] - -Once a few expressions are added, the bot gives suggestions like shown in Figure 7. Select a few and add them to the intent (Figure 7). -You can also tag your own custom entities to detect keywords, depending on your bot’s context. - -**Skills** -A skill is a block of conversation that has a clear purpose and that your bot can execute to achieve a goal. It can be as simple as the ability to greet someone, but it can also be more complex, like giving movie suggestions based on information provided by the user. - -It need not be just a one query-answer set, but rather, skills running through multiple exchanges. For example, consider a bot which helps you learn about currency exchange rates. It starts by asking the source currency, then the target currency, before giving the exact response. Skills can be combined to create complex conversational flows. -Here’s how you create a skill for the joke bot: - - * Go to the _Build_ tab. Click on the + icon to create a skill. - * Name the skill _Joke_ (Figure 8) - * Once created, click on the skill. You will see four tabs. _Read me, Triggers, Requirements and Actions_. - * Navigate to the Requirements tab. You should store the information only if the intent joke is present. So, add a requirement as shown in Figure 9. - - - -![Figure 8: Skills dashboard][10] - -![Figure 9: Adding a trigger][11] - -Since this is a simple use case, you needn’t consider any specific requirements in the Requirement tab but consider a case for which a response needs to be triggered only if certain keywords or entities are present – in such a case you will need ‘requirements’. - -Requirements are either intents or entities that your skill needs to retrieve before executing actions. Requirements are pieces of information that are important in the conversation and that your bot can use; for example, the user’s name or a location. Once a requirement is completed, the associated value is stored in the bot’s memory for the entire conversation. - -Now let us move to the Action tab to set the responses (see Figure 10). -Click on Add _new message group_. Then select _Send message_ and add a text message, which can be any joke in this case. Also, since you don’t want your bot to crack the same joke each time, you can add multiple messages which will be randomly picked each time. - -![Figure 10: Adding actions][12] - -![Figure 11: Adding text messages][13] - -![Figure 12: Setting up webchat][14] - -**Channel integrations** -Well, the success of a bot also depends upon how easily it is accessible. Recast has built-in integrations with many messaging channels such as Skype for Business, Kik Messenger, Telegram, Line, Facebook Messenger, Slack, Alexa, etc. In addition to that, Recast also provides SDKs to develop custom channels. - -Also, there is a ready-to-use Web chat provided by Recast (in the Connect tab). You can customise the colour schemes, headers, bot pictures, etc. It provides you with a script tag to be injected into the page. Your interface is now up (Figure 12). - -The Web chat code base is open sourced, which makes it easier for developers to play around with the look and feel, the standard response types and much more. -The dashboard provides step-by-step procedures on how to deploy the bot on various channels. The joke bot was deployed in Telegram and in Web chat, as shown in Figure 13. - -![Figure 13: Webchat deployed][15] - -![Figure 14: Bot deployed in Telegram][16] - -![Figure 15: Multi-language bot][17] - -**And there is more** -Recast supports multiple languages, Select one language as the base while creating the bot, but then you also have the option to add as many languages as you want. - -The example considered here is a simple static joke bot, but actual use cases will need interaction with various systems. Recast has a Web hook feature which allows users to connect with various systems to get responses. Also, there is detailed API documentation to help leverage each independent feature of the platform. - -As for analytics, Recast has a monitoring dashboard which helps you understand the accuracy of the bot and train it further. - -![Avatar][18] - -[Athira Lekshmi C.V][19] - -The author is an open-source enthusiast. - -[![][20]][21] - --------------------------------------------------------------------------------- - -via: https://opensourceforu.com/2019/11/creating-a-chat-bot-with-recast-ai/ - -作者:[Athira Lekshmi C.V][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://opensourceforu.com/author/athira-lekshmi/ -[b]: https://github.com/lujun9972 -[1]: https://i0.wp.com/opensourceforu.com/wp-content/uploads/2019/04/Build-ChatBoat.jpg?resize=696%2C442&ssl=1 (Build ChatBoat) -[2]: https://i0.wp.com/opensourceforu.com/wp-content/uploads/2019/04/Build-ChatBoat.jpg?fit=900%2C572&ssl=1 -[3]: https://i1.wp.com/opensourceforu.com/wp-content/uploads/2019/11/Figure-1-Setting-the-bot-properties.jpg?resize=350%2C201&ssl=1 -[4]: https://i1.wp.com/opensourceforu.com/wp-content/uploads/2019/11/Figure-2-Setting-the-bot-properties.jpg?resize=350%2C217&ssl=1 -[5]: https://i0.wp.com/opensourceforu.com/wp-content/uploads/2019/11/Figure-3-Searching-an-intent.jpg?resize=350%2C271&ssl=1 -[6]: https://i0.wp.com/opensourceforu.com/wp-content/uploads/2019/11/Figure-4-@joke-intent.jpg?resize=350%2C214&ssl=1 -[7]: https://i0.wp.com/opensourceforu.com/wp-content/uploads/2019/11/Figure-5-Predefined-expressions-350x227.jpg?resize=350%2C227&ssl=1 -[8]: https://i2.wp.com/opensourceforu.com/wp-content/uploads/2019/11/Figure-6-Suggested-expressions-350x197.jpg?resize=350%2C197&ssl=1 -[9]: https://i1.wp.com/opensourceforu.com/wp-content/uploads/2019/11/Figure-7-Suggested-expressions-350x248.jpg?resize=350%2C248&ssl=1 -[10]: https://i0.wp.com/opensourceforu.com/wp-content/uploads/2019/11/Figure-8-Skills-dashboard.jpg?resize=350%2C187&ssl=1 -[11]: https://i0.wp.com/opensourceforu.com/wp-content/uploads/2019/11/Figure-9-Adding-a-trigger.jpg?resize=350%2C197&ssl=1 -[12]: https://i0.wp.com/opensourceforu.com/wp-content/uploads/2019/11/Figure-10-Adding-actions.jpg?resize=350%2C175&ssl=1 -[13]: https://i1.wp.com/opensourceforu.com/wp-content/uploads/2019/11/Figure-11-Adding-text-messages.jpg?resize=350%2C255&ssl=1 -[14]: https://i2.wp.com/opensourceforu.com/wp-content/uploads/2019/11/Figure-12-Setting-up-webchat.jpg?resize=350%2C326&ssl=1 -[15]: https://i0.wp.com/opensourceforu.com/wp-content/uploads/2019/11/Figure-13-Webchat-deployed.jpg?resize=350%2C425&ssl=1 -[16]: https://i2.wp.com/opensourceforu.com/wp-content/uploads/2019/11/Figure-14-Bot-deployed-in-Telegram.jpg?resize=350%2C269&ssl=1 -[17]: https://i1.wp.com/opensourceforu.com/wp-content/uploads/2019/11/Figure-15-Multi-language-bot.jpg?resize=350%2C419&ssl=1 -[18]: https://secure.gravatar.com/avatar/d24503a2a0bb8bd9eefe502587d67323?s=100&r=g -[19]: https://opensourceforu.com/author/athira-lekshmi/ -[20]: https://opensourceforu.com/wp-content/uploads/2019/11/assoc.png -[21]: https://feedburner.google.com/fb/a/mailverify?uri=LinuxForYou&loc=en_US diff --git a/sources/tech/20191118 How to use regular expressions in awk.md b/sources/tech/20191118 How to use regular expressions in awk.md index a0be0df4d7..2cf5881263 100644 --- a/sources/tech/20191118 How to use regular expressions in awk.md +++ b/sources/tech/20191118 How to use regular expressions in awk.md @@ -1,5 +1,5 @@ [#]: collector: (lujun9972) -[#]: translator: (lixin555) +[#]: translator: ( ) [#]: reviewer: ( ) [#]: publisher: ( ) [#]: url: ( ) diff --git a/sources/tech/20191125 My top 5 Ansible modules.md b/sources/tech/20191125 My top 5 Ansible modules.md deleted file mode 100644 index 9a76342854..0000000000 --- a/sources/tech/20191125 My top 5 Ansible modules.md +++ /dev/null @@ -1,74 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: ( ) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (My top 5 Ansible modules) -[#]: via: (https://opensource.com/article/19/11/ansible-modules) -[#]: author: (Mark Phillips https://opensource.com/users/markp) - -My top 5 Ansible modules -====== -Learn how to achieve almost anything with these Ansible modules. -![][1] - -When I was growing up, my grandfather had a shed in his garden. He would spend hours in there, making and fixing things. This was way before we had the internet, so I spent a lot of time studying him creating things in that shed. Although the shed was full of many tools, from drills to lathes to electrical gubbins and lots of things I doubt I could identify even today, he made use of only a tiny subset of what he had at hand. Yet there never seemed to be limits to what he could achieve. - -I tell you that story because I feel like my career has been spent in a metaphorical shed. Computers are so many tools, all in a small (virtual?) space. And there are tool sheds within tool sheds—my favourite being Ansible. The recent 2.9 release ships with 3,681 modules! **3,681!** When I first started using Ansible in the summer of 2013, version 1.2.1 had just 113 modules, yet, as [I wrote at the time][2], I could still achieve anything I imagined. - -Modules are the backbone of Ansible, the gears to make light of heavy lifting. They're designed to do one job well, thus realising [the Unix philosophy][3]. This is how we've come to bundle so many of them; Ansible as the conductor of the orchestra now has a lot of instruments at its command. - -Reviewing a Git repository of my Ansible plays and roles over the years reveals that I have used just 35 modules. This small subset was used to build large infrastructures. I wonder what could be achieved with an even smaller subset, though? As I reviewed those 35, I pondered if I could achieve the same results with only five modules at my disposal. So here are my five favourite modules, in a rather tenuous order of precedence. - -### 5. [authorized_key][4] - -Secure shell (SSH) is at the heart of Ansible, at least for almost everything besides Windows. Key (no pun intended) to using SSH efficiently with Ansible is… [keys][5]! Slight aside—there are a lot of very cool things you can do for security with SSH keys. It's worth perusing the **authorized_keys** section of the [sshd manual page][6]. Managing SSH keys can become laborious if you're getting into the realms of granular user access, and although we could do it with either of my next two favourites, I prefer to use the module because it [enables easy management through variables][7]. - -### 4. [file][8] - -Besides the obvious function of placing a file somewhere, the **file** module also sets ownership and permissions. I'd say that's a lot of _bang for your buck_ with one module. I'd proffer a substantial portion of security relates to setting permissions too, so the **file** module plays nicely with **authorized_keys**. - -### 3. [template][9] - -There are so many ways to manipulate the contents of files, and I see lots of folk use **[lineinfile][10]**. I've used it myself for small tasks. However, the **template** module is so much clearer because you maintain the entire file for context. My preference is to write Ansible content in such a way that anyone can understand it _easily_—which to me means not making it hard to understand what is happening. Use of **template** means being able to see the entire file you're putting into place, complete with the variables you are using to change pieces. - -### 2. [uri][11] - -Many modules in the current distribution leverage Ansible as an orchestrator. They talk to another service, rather than doing something specific like putting a file into place. Usually, that talking is over HTTP too. In the days before many of these modules existed, you _could_ program an API directly using the **uri** module. It's a powerful access tool, enabling you to do a lot. I wouldn't be without it in my fictitious Ansible shed. - -### 1. [shell][12] - -The joker card in our pack. The Swiss Army Knife. If you're absolutely stuck for how to control something else, use **shell**. Some will argue we're now talking about making Ansible a Bash script—but, I would say it's still better because with the use of the **name** parameter in your plays and roles, you document every step. To me, that's as big a bonus as anything. Back in the days when I was still consulting, I once helped a database administrator (DBA) migrate to Ansible. The DBA wasn't one for change and pushed back at changing working methods. So, to ease into the Ansible way, we called some existing DB management scripts from Ansible using the **shell** module. With an informative **name** statement to accompany the task. - -You can achieve a lot with these five modules. Yes, modules designed to do a specific task will make your life even easier. But with a smidgen of engineering simplicity, you can achieve a lot with very little. Ansible developer Brian Coca is a master at it, and [his tips and tricks talk][13] is always worth a watch. - -* * * - -What do you think about my top five? What five modules would you pick and why, if you were so limited? Let me know in the comments below! - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/19/11/ansible-modules - -作者:[Mark Phillips][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/markp -[b]: https://github.com/lujun9972 -[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/mandelbrot_set.png?itok=bmPc0np5 -[2]: http://probably.co.uk/post/puppet-vs-chef-vs-ansible/ -[3]: https://en.wikipedia.org/wiki/Unix_philosophy#Do_One_Thing_and_Do_It_Well -[4]: https://docs.ansible.com/ansible/latest/modules/authorized_key_module.html -[5]: https://linux.die.net/man/1/ssh-keygen -[6]: https://linux.die.net/man/8/sshd -[7]: https://github.com/phips/ansible-demos/blob/3bf59df1eb2390b31b5c42333197e2fbb7fec93f/roles/ansible-users/tasks/main.yml#L35 -[8]: https://docs.ansible.com/ansible/latest/modules/file_module.html -[9]: https://docs.ansible.com/ansible/latest/modules/template_module.html -[10]: https://docs.ansible.com/ansible/latest/modules/lineinfile_module.html -[11]: https://docs.ansible.com/ansible/latest/modules/uri_module.html -[12]: https://docs.ansible.com/ansible/latest/modules/shell_module.html -[13]: https://www.ansible.com/ansible-tips-and-tricks diff --git a/sources/tech/20191126 Calculator N- is an open source scientific calculator for your smartphone.md b/sources/tech/20191126 Calculator N- is an open source scientific calculator for your smartphone.md deleted file mode 100644 index 32d467465a..0000000000 --- a/sources/tech/20191126 Calculator N- is an open source scientific calculator for your smartphone.md +++ /dev/null @@ -1,61 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: ( ) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Calculator N+ is an open source scientific calculator for your smartphone) -[#]: via: (https://opensource.com/article/19/11/calculator-n-mobile) -[#]: author: (Ricardo Berlasso https://opensource.com/users/rgb-es) - -Calculator N+ is an open source scientific calculator for your smartphone -====== -The Android app does a wide range of advanced mathematical functions in -the palm of your hand. -![scientific calculator][1] - -Mobile phones are becoming more powerful every day, so it is no surprise that they can beat most computers from the not-so-distant past. This also means the tools available on them are getting more powerful every day. - -Previously, I wrote about [scientific calculators for the Linux desktop][2], and I'm following that up here with information about [Calculator N+][3], an awesome GPL v3.0-licensed computer algebra system (CAS) app for Android devices. - -Calculator N+ is presented as a "powerful calculator for Android," but that's a humble statement; the app not only works with arbitrary precision, displaying results with roots and fractions in all their glory, it does a _lot_ more. - -Finding polynomial roots? Check. Factorization? Check. Symbolic derivatives, integrals, and limits? Check. Number theory (modular arithmetic, combinatorics, prime factorization)? Check. - -You can also solve systems of equations, simplify expressions (including trigonometric ones), convert units… you name it! - -![Calculator N+ graphical interface][4] - -Results are output in LaTeX. The menu in the top-left provides many powerful functions ready to use with a simple touch. Also in that menu, you'll find Help files for all of the app's functions. At the top-right of the screen, you can toggle between exact and decimal representation. Finally, tapping the blue bar at the bottom of the screen gives you access to the whole library of functions available in the app. But be careful! If you are not a mathematician, physicist, or engineer, such a long list may seem overwhelming. - -All of this power comes from the [Symja library][5], another great GPL 3 project. - -Both projects are under active development, and they are getting better with each version. In particular, version 3.4.6 of Calculator N+ gets a major leap in user interface (UI) quality. And yes, there are still some rough corners here and there, but taming this much power in the tiny UI of a smartphone is a difficult task, and I think the app developers are solving its remaining issues quite well. Kudos to them! - -If you are a teacher, a student, or work on a STEM field, check out Calculator N+. It's free, no ads, open source, and covers all your math needs. (Except, of course, during math exams, where smartphones should never be allowed to prevent cheating.) - -Calculator N+ is available in the [Google Play Store][6], or you can [build it from source code][7] using the instructions on the GitHub page. - -If you know any other useful open source apps for science or engineering, let us know in the comments. - -The app makes use of the sensors on your phone and offers a digital science notebook to record your... - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/19/11/calculator-n-mobile - -作者:[Ricardo Berlasso][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/rgb-es -[b]: https://github.com/lujun9972 -[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/calculator_money_currency_financial_tool.jpg?itok=2QMa1y8c (scientific calculator) -[2]: https://opensource.com/article/18/1/scientific-calculators-linux -[3]: https://github.com/tranleduy2000/ncalc -[4]: https://opensource.com/sites/default/files/uploads/calculatornplus_sqrt-frac.png (Calculator N+ graphical interface) -[5]: https://github.com/axkr/symja_android_library -[6]: https://play.google.com/store/apps/details?id=com.duy.calculator.free -[7]: https://github.com/tranleduy2000/ncalc/blob/master/README.md diff --git a/sources/tech/20191209 Use the Fluxbox Linux desktop as your window manager.md b/sources/tech/20191209 Use the Fluxbox Linux desktop as your window manager.md deleted file mode 100644 index 8c7ddcb1e5..0000000000 --- a/sources/tech/20191209 Use the Fluxbox Linux desktop as your window manager.md +++ /dev/null @@ -1,164 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: ( ) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Use the Fluxbox Linux desktop as your window manager) -[#]: via: (https://opensource.com/article/19/12/fluxbox-linux-desktop) -[#]: author: (Seth Kenlon https://opensource.com/users/seth) - -Use the Fluxbox Linux desktop as your window manager -====== -This article is part of a special series of 24 days of Linux desktops. -Fluxbox is very light on system resources, yet it has vital Linux -desktop features to make your user experience easy, blazingly efficient, -and unduly fast. -![Text editor on a browser, in blue][1] - -The concept of a desktop may differ from one computer user to another. Many people see the desktop as a home base, or a comfy living room, or even a literal desktop where they place frequently used notepads, their best pens and pencils, and their favorite coffee mug. KDE, GNOME, Pantheon (and so on) provide that kind of comfort on Linux. - -But for some users, the desktop is just empty monitor space, a side effect of not yet having any free-floating application windows projected directly onto their retina. For these users, the desktop is a void over which they can run applications—whether big office and graphic suites, or a simple terminal window, or docked applets—to manage services. This model of operating a [POSIX][2] computer has a long history, and one branch of that family tree is the *box window managers: Blackbox, Fluxbox, and Openbox. - -[Fluxbox][3] is a window manager for X11 systems that's based on an older project called Blackbox. Blackbox development was waning when I discovered Linux, so I fell into Fluxbox, and I've used it ever since on at least one of my active systems. It is written in C++ and is licensed under the MIT open source license. - -### Installing Fluxbox - -You are likely to find Fluxbox included in the software repository of your Linux distribution, but you can also find it on [Fluxbox.org][4]. If you're already running a different desktop, it's safe to install Fluxbox on the same system because Fluxbox doesn't predetermine any configuration or accompanying applications. - -After installing Fluxbox, log out of your current desktop session so you can log into your new one. By default, your session manager (KDM, GDM, LightDM, or XDM, depending on your setup) will continue to log you into your previous desktop, so you must override that before logging in. - -To override the desktop with GDM: - -![Select your desktop session in GDM][5] - -Or with KDM: - -![Select your desktop session with KDM][6] - -### Configuring the Fluxbox desktop - -When you first log in, the screen is mostly empty because all Fluxbox provides are panels (for a taskbar, system tray, and so on) and window decoration for application windows. - -![Default Fluxbox configuration on CentOS 7][7] - -If your distribution delivers a plain Fluxbox desktop, you can set a background for your desktop using the **feh** command (you may need to install it from your distribution's repository). This command has a few options for setting the background, including **\--bg-fill** to fill the screen with your wallpaper of choice, **\--bg-scale** to scale it to fit, and so on. - - -``` -`$ feh --bg-fill ~/photo/oamaru/leaf-spiral.jpg` -``` - -![Fluxbox with a theme applied][8] - -By default, Fluxbox auto-generates a menu, available with a right-click anywhere on the desktop, that gives you access to applications. Depending on your distribution, this menu may be very minimal, or it may list all the launchers in your **/usr/share/applications** directory. - -Fluxbox configuration is set in text files, and those text files are contained in the **$HOME/.fluxbox** directory. You can: - - * Set keyboard shortcuts in **keys** - * Set startup services and applications in **startup** - * Set desktop preferences (such as the number of workspaces, locations of panels, and so on) in **init** - * Set menu items in **menu** - - - -The text configuration files are easy to reverse-engineer, but you also can (and should) read the Fluxbox [documentation][9]. - -For example, this is my typical menu (or at least the basic structure of it): - - -``` -# to use your own menu, copy this to ~/.fluxbox/menu, then edit -# ~/.fluxbox/init and change the session.menuFile path to ~/.fluxbox/menu - -[begin] (fluxkbox) - [submenu] (apps) {} -  [submenu] (txt) {} -   [exec] (Emacs 23 (text\\)) { x-terminal-emulator -T "Emacs (text)" -e /usr/bin/emacs -nw} <> -   [exec] (Emacs (X11\\)) {/usr/bin/emacs} <> -   [exec] (LibreOffice) {/usr/bin/libreoffice} -  [end] -  [submenu] (code) {} -   [exec] (qtCreator) {/usr/bin/qtcreator} -   [exec] (eclipse) {/usr/bin/eclipse} -  [end] -  [submenu] (graphics) {} -   [exec] (ksnapshot) {/usr/bin/ksnapshot} -   [exec] (gimp) {/usr/bin/gimp} -   [exec] (blender) {/usr/bin/blender} -  [end] -  [submenu] (files) {} -   [exec] (dolphin) {/usr/bin/dolphin} -   [exec] (konqueror) { /usr/bin/kfmclient openURL $HOME } -  [end] -  [submenu] (network) {} -   [exec] (firefox) {/usr/bin/firefox} -   [exec] (konqueror) {/usr/bin/konqueror} -  [end] - [end] -## change window manager or work env -[submenu] (environments) {} - [restart] (flux)  {/usr/bin/startfluxbox} - [restart] (ratpoison)  {/usr/bin/ratpoison} - [exec] (openIndiana) {/home/kenlon/qemu/startSolaris.sh} -[end] - -[config] (config) - [submenu] (styles) {} -  [stylesdir] (/usr/share/fluxbox/styles) -  [stylesdir] (~/.fluxbox/styles) - [end] -[workspaces] (workspaces) -[reconfig] (reconfigure) -[restart] (restart) -[exit] (exeunt) -[end] -``` - -The menu also provides a few preference settings, such as the ability to pick a theme and restart or log out from your Fluxbox session. - -I launch most applications using keyboard shortcuts, which are entered into the **keys** configuration file. Here are some examples (the **Mod4** key is the Super key, which I use to designate global shortcuts): - - -``` -# open apps -Mod4 t :Exec konsole -Mod4 k :Exec konqueror -Mod4 z :Exec fbrun -Mod4 e :Exec emacs -Mod4 f :Exec firefox -Mod4 x :Exec urxvt -Mod4 d :Exec dolphin -Mod4 q :Exec xscreensaver-command -activate -Mod4 3 :Exec ksnapshot -``` - -Between these shortcuts and an open terminal, I have little use for a mouse during most of my workday, so there's no wasted time switching from one controller to another. And because Fluxbox stays well out of the way, there's little distraction. - -### Why you should use Fluxbox - -Fluxbox is very light on system resources, yet it has vital features to make your user experience easy, blazingly efficient, and unduly fast. It's simple to customize, and it allows you to define your own workflow. You don't have to use Fluxbox's panels, because there are other excellent panels out there. You can even middle-click and drag two separate application windows into one another so that they become one window, each in its own tab. - -The possibilities are endless, so try the steady simplicity that is Fluxbox on your Linux box today! - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/19/12/fluxbox-linux-desktop - -作者:[Seth Kenlon][a] -选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]: https://opensource.com/users/seth -[b]: https://github.com/lujun9972 -[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/browser_blue_text_editor_web.png?itok=lcf-m6N7 (Text editor on a browser, in blue) -[2]: https://opensource.com/article/19/7/what-posix-richard-stallman-explains -[3]: http://fluxbox.org -[4]: http://fluxbox.org/download/ -[5]: https://opensource.com/sites/default/files/advent-gdm_0.jpg (Select your desktop session in GDM) -[6]: https://opensource.com/sites/default/files/advent-kdm.jpg (Select your desktop session with KDM) -[7]: https://opensource.com/sites/default/files/advent-fluxbox-default.jpg (Default Fluxbox configuration on CentOS 7) -[8]: https://opensource.com/sites/default/files/advent-fluxbox-green.jpg (Fluxbox with a theme applied) -[9]: http://fluxbox.org/features/ diff --git a/sources/tech/20191216 Relive Linux history with the ROX desktop.md b/sources/tech/20191216 Relive Linux history with the ROX desktop.md deleted file mode 100644 index 215006514f..0000000000 --- a/sources/tech/20191216 Relive Linux history with the ROX desktop.md +++ /dev/null @@ -1,104 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: ( ) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Relive Linux history with the ROX desktop) -[#]: via: (https://opensource.com/article/19/12/linux-rox-desktop) -[#]: author: (Seth Kenlon https://opensource.com/users/seth) - -Relive Linux history with the ROX desktop -====== -This article is part of a special series of 24 days of Linux desktops. -If you're looking for a fun trip back in time, the ROX desktop is well -worth a go. -![Person typing on a 1980's computer][1] - -The [ROX][2] desktop is no longer being actively developed, but its legacy resounds today, and even when it was active, it was a unique take on what a Linux desktop could be. While other desktops felt roughly similar to old Unix or Windows interfaces, ROX belongs solidly in the BeOS, AmigaOS, and [RISC OS][3] desktop camps. - -It focuses on drag-and-drop actions (which makes its accessibility non-optimal for some users), point-and-click actions, pop-up contextual menus, and a unique system of app directories for running local applications with no installation required. - -### Installing ROX - -Today, ROX is mostly abandoned and left in fragments that the user is left to sort out. Luckily, the puzzle is relatively easy to solve, but don't get confused when you find bits and pieces of the ROX desktop in your distribution's repository—but not _every_ bit of the ROX desktop. The popular parts of ROX—the file manager ([ROX-Filer][4]) and the terminal ([ROXTerm][5])—seem to have endured in most of the popular distribution repositories, and you can install (and use) them as standalone applications. However, to run the ROX desktop, you must also install ROX-Session and the libraries it depends on. - -I installed ROX on Slackware 14.2, but it should work on any Linux or BSD system. - -First, you must install [ROX-lib2][6] from its repository. True to its philosophy of minimal installs, all you have to do to install ROX-lib2 is download the tarball, [unarchive it][7], and move the **ROX-Lib** directory to **/usr/local/lib**. - -Next, you have to install [ROX-Session][8]. This probably needs to be compiled from source code, as it's not likely to be in your software repository. The compile process requires build tools, which ship by default on Slackware but are often omitted in other distributions to save space on the initial download. The names of the packages you must install to build from source code vary depending on your distro, so refer to the documentation for specifics. For example, on Debian-based distributions, you can learn about build requirements in [Debian's wiki][9], and on Fedora-based distributions, refer to [Fedora's docs][10]. Once you have the build tools installed, execute the custom ROX-Session build script: - - -``` -`$ ./AppRun` -``` - -This manages its own build and installation and prompts you for root permissions to add itself as an option on your login screen. - -If you have not installed ROX-Filer from your software repository, do that before continuing. - -Together, these components create a complete ROX desktop. To log into your new desktop, log out of your current desktop session. By default, your session manager (KDM, GDM, LightDM, or XDM, depending on your setup) will continue to log you into your previous desktop, so you must override that before logging in. - -With SDDM: - -![][11] - -With GDM: - -![][12] - -### ROX desktop features - -The ROX desktop is simple by default, with a single panel at the bottom of the screen and a shortcut icon to your home directory on the desktop. The panel contains shortcuts to common locations. That's all there is to the ROX desktop, at least as it's configured out of the box. If you want a clock or a calendar or a system tray, you need to find applications that provide them. - -![Default ROX desktop][13] - -There is no taskbar, as such, but when you minimize a window, it becomes a temporary icon on your desktop. You can click the icon to bring its window back to its former size and placement. - -The panel can be modified some, as well. You can place different shortcuts into it and even create your own applets. - -There's no application menu, either, nor are there shortcuts to applications in a contextual menu. Instead, you can navigate manually to **/usr/share/applications**, or you can add your application directory or directories to the ROX panel. - -![ROX desktop][14] - -The ROX desktop's workflow concentrates on being mouse-driven, reminiscent of Mac OS 7.5 and 8. With ROX-filer, you can manage permissions, file management, introspection, script launching, background setting, and nearly anything else you can think of, provided that you're patient enough for the point-and-click style of interaction. For power users, this seems slow, but ROX manages to make it relatively painless and very intuitive. - -### App directories, AppRun, and AppImage - -The ROX desktop has an elegant convention by which a directory containing a script named **AppRun** is executed as if it were an application. This means that in order to make a ROX app, all you have to do is compile code into a directory, place a script called **AppRun** at the root of that directory to execute the binary you've compiled, and then mark the directory executable. ROX-Filer displays a directory configured in the manner you set with a special icon and color. When you click on an app directory, ROX-Filer automatically runs the **AppRun** script inside. It looks and behaves exactly like an application that has been installed, but it's local to the user's home directory and requires no special permissions. - -This is a convenience feature, but it's one of those small features that feels great when you use it because it's so easy to implement. It's by no means essential, and it's only a few steps ahead of building an application locally, hiding the directory somewhere out of the way, and drumming up a quick **.desktop** file to act as your launcher. However, the concept of an application directory has been [cited][15] as an inspiration for the [AppImage][16] packaging system. - -### Why you should try ROX desktop - -Getting ROX set up and usable is somewhat difficult, and it appears to truly be abandoned. However, its legacy lives on in many ways today, and it's a fascinating and fun bit of Linux history. It may not become your primary desktop, but if you're looking for a fun trip back in time, then ROX is well worth a go. Explore it, customize it, and see what clever ideas it contains. There may yet be hidden gems that the open source community can benefit from. - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/19/12/linux-rox-desktop - -作者:[Seth Kenlon][a] -选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]: https://opensource.com/users/seth -[b]: https://github.com/lujun9972 -[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/1980s-computer-yearbook.png?itok=eGOYEKK- (Person typing on a 1980's computer) -[2]: http://rox.sourceforge.net/desktop/ -[3]: https://www.riscosopen.org/content/ -[4]: http://rox.sourceforge.net/desktop/ROX-Filer -[5]: http://roxterm.sourceforge.net/ -[6]: http://rox.sourceforge.net/desktop/ROX-Lib -[7]: https://opensource.com/article/17/7/how-unzip-targz-file -[8]: http://rox.sourceforge.net/desktop/ROX-Session.html -[9]: https://wiki.debian.org/BuildingTutorial -[10]: https://docs.pagure.org/docs-fedora/installing-software-from-source.html -[11]: https://opensource.com/sites/default/files/advent-kdm_0.jpg -[12]: https://opensource.com/sites/default/files/advent-gdm_1.jpg -[13]: https://opensource.com/sites/default/files/uploads/advent-rox.jpg (Default ROX desktop) -[14]: https://opensource.com/sites/default/files/uploads/advent-rox-custom.jpg (ROX desktop) -[15]: https://github.com/AppImage/AppImageKit/wiki/AppDir -[16]: https://appimage.org/ diff --git a/sources/tech/20191223 10 articles to learn Linux your way.md b/sources/tech/20191223 10 articles to learn Linux your way.md deleted file mode 100644 index 0ef668ad28..0000000000 --- a/sources/tech/20191223 10 articles to learn Linux your way.md +++ /dev/null @@ -1,96 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: ( ) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (10 articles to learn Linux your way) -[#]: via: (https://opensource.com/article/19/12/learn-linux) -[#]: author: (Seth Kenlon https://opensource.com/users/seth) - -10 articles to learn Linux your way -====== -It's been a good year for Linux, so take a look back at the top 10 Linux -articles on Opensource.com from 2019. -![Penguins gathered together in the Artic][1] - -The year 2019 has been good for Linux with Opensource.com readers. Obviously, the term "Linux" itself is weighted: Does it refer to the kernel or the desktop or the ecosystem? In this look back at the top Linux articles of the year, I've intentionally taken a broad view in defining the top 10 Linux articles (for some definition of "top" and some definition of "Linux"). Here they are, offered in no particular order. - -### A beginner's guide to Linux permissions - -[_A beginner's guide to Linux permissions_][2] by Bryant Son introduces new users to the concept of file permissions with graphics and charts to illustrate each point. It can be hard to come up with visuals for concepts that are, at their core, purely text-based, and this article is friendly for the visual learners out there. I also like how Bryant stays focused. Any discussion of file permissions can lead to several related topics (like ownership and access control lists and so on), but this article is dedicated to explaining one thing and explaining it well. - -### Why I made the switch from Mac to Linux - -Matthew Broberg offers an insightful and honest look at his migration to Linux from MacOS in [_Why I made the switch from Mac to Linux_][3]. Changing platforms is always tough, and it's important to record what's behind the decision to switch. Matt's article, I think, serves several purposes, but the two most important for me: it's an invitation for the Linux community to support him by answering questions and offering potential solutions, and it's a good data point for others who are considering Linux adoption. - -### Troubleshooting slow WiFi on Linux - -In [_Troubleshooting slow WiFi on Linux_][4], David Clinton provides a useful analysis of a problem everyone has on every platform—and has tips on how to solve it. It's a good example of an "incidentally Linux" tip that not only helps everyday people with everyday problems but also shows non-Linux users how approachable troubleshooting (on any platform) is. - -### How GNOME uses Git - -[_How GNOME uses Git_][5] by Molly de Blanc takes a look behind the scenes, revealing how one of the paragons of open source software (the GNOME desktop) uses one of the other paragons of open source (Git) for development. It's always heartening to me to hear about an open source project that defaults to an open source solution for whatever needs to be done. Believe it or not, this isn't always the case, but for GNOME, it's an important and welcoming part of the project's identity. - -### Virtual filesystems in Linux: Why we need them and how they work - -Alison Chaiken masterfully explains what is considered incomprehensible to many users in [_Virtual filesystems in Linux: Why we need them and how they work_][6]. Understanding what a filesystem is and what it does is one thing, but _virtual_ ones aren't even, by definition, real. And yet Linux delivers them in a way that even casual users can benefit from, and Alison's article explains it in a way that anyone can understand. As a bonus, Alison goes even deeper in the second half of the article and demonstrates how to use bcc scripts to monitor everything she just taught you. - -### Understanding file paths and how to use them - -I thought [_Understanding file paths and how to use them_][7] was important to write about because it's a concept most users (on any platform) don't seem to be taught. It's a strange phenomenon, because now, more than ever, the _file path_ is something people see literally on a daily basis: Nearly all internet URLs contain a file path telling you exactly where within the domain you are. I often wonder why computer education doesn't start with the internet, the most familiar app of all and arguably the most heavily used supercomputer in existence, and use it to explain the appliances we interface with each day. (I guess it would help if those appliances were running Linux, but we're working on that.) - -### Inter-process communication in Linux - -[_Inter-process communication in Linux: Shared storage_][8] by Marty Kalin delves into the developer side of Linux, explaining IPC and how to interact with it in your code. I'm cheating by including this article because it's actually a three-part series, but it's the best explanation of its kind. There is very little documentation that manages to explain how Linux handles IPC, much less what IPC is, why it's important, or how to take advantage of it when programming. It's normally a topic you work your way up to in university. Now you can read all about it here instead. - -### Understanding system calls on Linux with strace - -[_Understanding system calls on Linux with strace_][9] by Gaurav Kamathe is highly technical in ways I wish that every conference talk I've ever seen about **strace** was. This is a clear and helpful demonstration of a complex but amazingly useful command. To my surprise, the command I've found myself using since this article isn't the titular command, but **ltrace** (to see which functions are called by a command). Obviously, this article's packed with information and is a handy reference for developers and QA testers. - -### How the Linux desktop has grown - -[_How the Linux desktop has grown_][10] by Jim Hall is a visual journey through the history of the Linux desktop. It starts with [TWM][11] and passes by [FVWM][12], [GNOME][13], [KDE][14], and others. If you're new to Linux, this is a fascinating history lesson from someone who was there (and has the screenshots to prove it). If you've been with Linux for many years, then this will definitely bring back memories. In the end, though, one thing is certain: Anyone who can still locate screenshots from 20 years ago is a superhuman data archivist. - -### Create your own video streaming server with Linux - -[_Create your own video streaming server with Linux_][15] by Aaron J. Prisk breaks down more than just a few preconceptions most of us have about the services we take for granted. Because services like YouTube and Twitch exist, many people assume that those are the only gateways to broadcasting video to the world. Of course, people used to think that Windows and Mac were the only gateways into computing, and that, thankfully, turned out to be a gross miscalculation. In this article, Aaron sets up a video-streaming server and even manages to find space to talk about [OBS][16] in so you can create videos to stream. Is it a fun weekend project or the start of a new career? You decide. - -### 10 moments that shaped Linux history - -[_10 moments that shaped Linux history_][17] by Alan Formy-Duval attempts the formidable task of choosing just 10 things to highlight in the history of Linux. It's an exercise in futility, of course, because there have been so many important moments, so I love how Alan filters it through his own experience. For example, when was it obvious that Linux was going to last? When Alan realized that all the systems he maintained at work were running Linux. There's a beauty to interpreting history this way because the moments of importance will differ for each person. There's no definitive list for Linux, or articles about Linux, or for open source. You make your own list, and you make yourself a part of it. - -### What do you want to learn? - -What else do you want to know about Linux? Please tell us about it in the comments, or [write an article][18] for Opensource.com about your experience with Linux. - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/19/12/learn-linux - -作者:[Seth Kenlon][a] -选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]: https://opensource.com/users/seth -[b]: https://github.com/lujun9972 -[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/OSDC_Penguin_Image_520x292_12324207_0714_mm_v1a.png?itok=p7cWyQv9 (Penguins gathered together in the Artic) -[2]: https://opensource.com/article/19/6/understanding-linux-permissions -[3]: https://opensource.com/article/19/10/why-switch-mac-linux -[4]: http://opensource.com/article/19/4/troubleshooting-wifi-linux -[5]: https://opensource.com/article/19/10/how-gnome-uses-git -[6]: https://opensource.com/article/19/3/virtual-filesystems-linux -[7]: https://opensource.com/article/19/8/understanding-file-paths-linux -[8]: https://opensource.com/article/19/4/interprocess-communication-linux-storage -[9]: https://opensource.com/article/19/2/linux-backup-solutions -[10]: https://opensource.com/article/19/8/how-linux-desktop-grown -[11]: https://github.com/freedesktop/twm -[12]: http://www.fvwm.org/ -[13]: http://gnome.org -[14]: http://kde.org -[15]: https://opensource.com/article/19/1/basic-live-video-streaming-server -[16]: https://opensource.com/life/15/12/real-time-linux-video-editing-with-obs-studio -[17]: https://opensource.com/article/19/4/top-moments-linux-history -[18]: https://opensource.com/how-submit-article diff --git a/sources/tech/20191223 Prioritizing simplicity in your Python code.md b/sources/tech/20191223 Prioritizing simplicity in your Python code.md deleted file mode 100644 index 53662a8f1c..0000000000 --- a/sources/tech/20191223 Prioritizing simplicity in your Python code.md +++ /dev/null @@ -1,59 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: ( ) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Prioritizing simplicity in your Python code) -[#]: via: (https://opensource.com/article/19/12/zen-python-simplicity-complexity) -[#]: author: (Moshe Zadka https://opensource.com/users/moshez) - -Prioritizing simplicity in your Python code -====== -This is the second part of a special series about the Zen of Python -focusing on the third and fourth principles: simplicity and complexity. -![Person reading a book and digital copy][1] - -> "Il semble que la perfection soit atteinte non quand il n'y a plus rien à ajouter, mais quand il n'y plus rien à retrancher." -> -> "It seems that perfection is finally attained not when there is no longer anything to add, but when there is no longer anything to take away." -> —Antoine de Saint-Exupéry, _[Terre des Hommes][2]_, 1939 - -A common concern in programming is the struggle with complexity. It is easy for any programmer to make a program so complicated no expert can debug it or modify it. The [Zen of Python][3] would not be complete if it did not touch on this. - -### Simple is better than complex. - -When it is possible to choose at all, choose the simple solution. Python is rarely in the business of _disallowing_ things. This means it is possible, and even straightforward, to design baroque programs to solve straightforward problems. - -It is worthwhile to remember at each point that simplicity is one of the easiest things to lose and the hardest to regain when writing code. - -This can mean choosing to write something as a function, rather than introducing an extraneous class. This can mean avoiding a robust third-party library in favor of writing a two-line function that is perfect for the immediate use-case. Most often, it means avoiding predicting the future in favor of solving the problem at hand. - -It is much easier to change the program later, especially if simplicity and beauty were among its guiding principles than to load the code down with all possible future variations. - -### Complex is better than complicated. - -This is possibly the most misunderstood principle because understanding the precise meanings of the words is crucial. Something is _complex_ when it is composed of multiple parts. Something is _complicated_ when it has a lot of different, often hard to predict, behaviors. - -When solving a hard problem, it is often the case that no simple solution will do. In that case, the most Pythonic strategy is to go "bottom-up." Build simple tools and combine them to solve the problem. - -This is where techniques like _object composition_ shine. Instead of having a complicated inheritance hierarchy, have objects that forward some method calls to a separate object. Each of those can be tested and developed separately and then finally put together. - -Another example of "building up" is using [singledispatch][4], so that instead of one complicated object, we have a simple, mostly behavior-less object and separate behaviors. - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/19/12/zen-python-simplicity-complexity - -作者:[Moshe Zadka][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/moshez -[b]: https://github.com/lujun9972 -[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/read_book_guide_tutorial_teacher_student_apaper.png?itok=_GOufk6N (Person reading a book and digital copy) -[2]: https://en.wikipedia.org/wiki/Wind,_Sand_and_Stars -[3]: https://www.python.org/dev/peps/pep-0020/ -[4]: https://opensource.com/article/19/5/python-singledispatch diff --git a/sources/tech/20191224 Why your Python code should be flat and sparse.md b/sources/tech/20191224 Why your Python code should be flat and sparse.md deleted file mode 100644 index 0e447c5d8e..0000000000 --- a/sources/tech/20191224 Why your Python code should be flat and sparse.md +++ /dev/null @@ -1,87 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: ( ) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Why your Python code should be flat and sparse) -[#]: via: (https://opensource.com/article/19/12/zen-python-flat-sparse) -[#]: author: (Moshe Zadka https://opensource.com/users/moshez) - -Why your Python code should be flat and sparse -====== -This is part of a special series about the Zen of Python focusing on the -fifth and sixth principles: flatness and sparseness. -![Digital creative of a browser on the internet][1] - -The [Zen of Python][2] is called that for a reason. It was never supposed to provide easy-to-follow guidelines for programming. The rules are specified tersely and are designed to engage the reader in deep thought. - -In order to properly appreciate the Zen of Python, you must read it and then meditate upon the meanings. If the Zen was designed to be a set of clear rules, it would be a fault that it has rules that contradict each other. However, as a tool to help you meditate on the best solution, contradictions are powerful. - -### Flat is better than nested. - -Nowhere is the pressure to be "flat" more obvious than in Python's strong insistence on indentation. Other languages will often introduce an implementation that "cheats" on the nested structure by reducing indentation requirements. To appreciate this point, let's take a look at JavaScript. - -JavaScript is natively async, which means that programmers write code in JavaScript using a lot of callbacks. - - -``` -a(function(resultsFromA) { -  b(resultsFromA, function(resultsfromB) { -    c(resultsFromC, function(resultsFromC) { -      console.log(resultsFromC) -   } -  } -} -``` - -Ignoring the code, observe the pattern and the way indentation leads to a right-most point. This distinctive "arrow" shape is tough on the eye to quickly walk through the code, so it's seen as undesirable and even nicknamed "callback hell." However, in JavaScript, it is possible to "cheat" and not have indentation reflect nesting. - - -``` -a(function(resultsFromA) { -b(resultsFromA, -  function(resultsfromB) { -c(resultsFromC, -  function(resultsFromC) { -    console.log(resultsFromC) -}}} -``` - -Python affords no such options to cheat: every nesting level in the program must be reflected in the indentation level. So deep nesting in Python _looks_ deeply nested. That makes "callback hell" was a worse problem in Python than in JavaScript: nesting callbacks mean indenting with no options to "cheat" with braces. - -This challenge, in combination with the Zen principle, has led to an elegant solution by a library I worked on. In the [Twisted][3] framework, we came up with the _deferred_ abstraction, which would later inspire the popular JavaScript _promise_ abstraction. In this way, Python's unwavering commitment to clear code forces Python developers to discover new, powerful abstractions. - - -``` -future_value = future_result() -future_value.addCallback(a) -future_value.addCallback(b) -future_value.addCallback(c) -``` - -(This might look familiar to modern JavaScript programmers: Promises were heavily influenced by Twisted's deferreds.) - -### Sparse is better than dense. - -The easiest way to make something less dense is to introduce nesting. This habit is why the principle of sparseness follows the previous one: after we have reduced nesting as much as possible, we are often left with _dense_ code or data structures. Density, in this sense, is jamming too much information into a small amount of code, making it difficult to decipher when something goes wrong. - -Reducing that denseness requires creative thinking, and there are no simple solutions. The Zen of Python does not offer simple solutions. All it offers are ways to find what can be improved in the code, without always giving guidance for "how." - -Take a walk. Take a shower. Smell the flowers. Sit in a lotus position and think hard, until finally, inspiration strikes. When you are finally enlightened, it is time to write the code. - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/19/12/zen-python-flat-sparse - -作者:[Moshe Zadka][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/moshez -[b]: https://github.com/lujun9972 -[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/browser_web_internet_website.png?itok=g5B_Bw62 (Digital creative of a browser on the internet) -[2]: https://www.python.org/dev/peps/pep-0020/ -[3]: https://twistedmatrix.com/trac/ diff --git a/sources/tech/20191226 10 Linux command tutorials for beginners and experts.md b/sources/tech/20191226 10 Linux command tutorials for beginners and experts.md deleted file mode 100644 index 03fc77a8e1..0000000000 --- a/sources/tech/20191226 10 Linux command tutorials for beginners and experts.md +++ /dev/null @@ -1,86 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (summer2233) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (10 Linux command tutorials for beginners and experts) -[#]: via: (https://opensource.com/article/19/12/linux-commands) -[#]: author: (Moshe Zadka https://opensource.com/users/moshez) - -10 Linux command tutorials for beginners and experts -====== -Learn how to make Linux do what you need it to do in Opensource.com's -top 10 articles about Linux commands from 2019. -![Penguin driving a car with a yellow background][1] - -Using Linux _well_ means understanding what commands are available and what they're capable of doing for you. We have covered a lot of them on Opensource.com during 2019, and here are 10 favorites from the bunch. - -### Using the force at the Linux command line - -The Force has a light side and a dark side. Properly understanding that is crucial to true mastery. In his article [_Using the force at the Linux command line_][2], Alan Formy-Duval explains the **-f** option (also known as **\--force**) for several popular and sometimes dangerous commands. - -### Intro to the Linux useradd command - -Sharing accounts is a bad idea. Instead, give separate accounts to different people (and even different roles) with the quintessential **useradd** command. Part of his venerable series on basic Linux administration, Alan Formy-Duval provides an [_Intro to the Linux useradd command_][3], and, as usual, he explains it in _plain English_ so that both new and experienced admins can understand it. - -### Linux commands to display your hardware information - -What's _inside_ the box? Sometimes it's useful to inspect your hardware without using a screwdriver. In [_Linux commands to display your hardware information_][4], Howard Fosdick provides both popular and obscure commands to help you dig deep into the computer you're using, the computer you're testing at the store before buying, or the computer you're trying to repair. - -### How to encrypt files with gocryptfs on Linux - -Our files hold lots of private data, from social security numbers to personal letters to loved ones. In [_How to encrypt files with gocryptfs on Linux_][5], Brian "Bex" Exelbierd explains how to keep *private *what's meant to be private. As a bonus, he demonstrates encrypting files in a way that has little to no impact on your existing workflow. This isn't a complex PGP-style puzzle of key management and background key agents; this is quick, seamless, and secure file encryption. - -### How to use advanced rsync for large Linux backups - -In the New Year, many people will resolve to be more diligent about making backups. Alan Formy-Duval must have made that resolution years ago, because in [_How to use advanced rsync for large Linux backups_][6], he displays remarkable familiarity with the file synchronization command. You might not remember all the syntax right away, but the idea is to read and process the options, construct your backup command, and then automate it. That's the smart way to use **rsync**, and it's the _only_ way to do backups reliably. - -### Using more to view text files at the Linux command line - -In Scott Nesbitt's article [_Using more to view text files at the Linux command line_][7], the good old default pager **more** finally gets the spotlight. Many people install and use **less**, because it's more flexible than **more**. However, with more and more systems being implemented in the sparsest of containers, the luxury of fancy new tools like **less** or **most** sometimes just doesn't exist. Knowing and using **more** is simple, it's a common default, and it's the production system's debugging tool of last resort. - -### What you probably didn't know about sudo - -The **sudo** command is famous to a fault. People know the **sudo** term, and most of us believe we know what it does. And we're a little bit correct, but as Peter Czanik reveals in his article [_What you probably didn't know about sudo_][8], there's a lot more to the command than just "Simon says." Like that classic childhood game, the **sudo** command is powerful and also prone to silly mistakes—only with greater potential for horrible consequences. This is one game you do not want to lose! - -### How to program with Bash: Syntax and tools - -If you're a Linux, BSD, or Mac (and lately, Windows) user, you may have used the Bash shell interactively. It's a great shell for quick, one-off commands, which is why so many Linux users love to use it as their primary user interface. However, Bash is much more than just a command prompt. It's also a programming language, and if you're already using Bash commands, then the path to automation has never been more straightforward. Learn all about it in David Both's excellent [_How to program with Bash: Syntax and tools_][9]. - -### Master the Linux ls command - -The **ls** command is one of those commands that merits a two-letter name; one-letter commands are an optimization for slow terminals where each letter causes a significant delay and also a nice bonus for lazy typists. Seth Kenlon explains how you can [_Master the Linux ls command_][10] and he does so with his usual clarity and pragmatism. Most significantly, in a system where "everything is a file," being able to list the files is crucial. - -### Getting started with the Linux cat command - -The **cat** command (short for con_cat_enate) is deceptively simple. Whether you use it to quickly see the contents of a file or to pipe the contents to another command, you may not be using **cat** to its full potential. Alan Formy-Duval's elucidating [_Getting started with the Linux cat command_][11] offers new ideas to take advantage of a command that lets you open a file without feeling like you've opened it. As a bonus, learn all about **zcat** so you can decompress files without all the trouble of decompression! It's a small and simple thing, but _this_ is what makes Linux great. - -### Continue the journey - -Don't let Opensource.com's 10 best articles about Linux commands of 2019 be the end of your journey. There's much more to discover about Linux and its versatile prompt, so stay tuned in 2020 for more insights. And, if there's a Linux command you want us to know about, please tell us about it in the comments, or share your knowledge with Opensource.com readers by [submitting an article][12] about your favorite Linux command. - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/19/12/linux-commands - -作者:[Moshe Zadka][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/moshez -[b]: https://github.com/lujun9972 -[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/car-penguin-drive-linux-yellow.png?itok=twWGlYAc (Penguin driving a car with a yellow background) -[2]: https://opensource.com/article/19/5/may-the-force-linux -[3]: https://opensource.com/article/19/10/linux-useradd-command -[4]: https://opensource.com/article/19/9/linux-commands-hardware-information -[5]: https://opensource.com/article/19/8/how-encrypt-files-gocryptfs -[6]: https://opensource.com/article/19/5/advanced-rsync -[7]: https://opensource.com/article/19/1/more-text-files-linux -[8]: https://opensource.com/article/19/10/know-about-sudo -[9]: https://opensource.com/article/19/10/programming-bash-syntax-tools -[10]: https://opensource.com/article/19/7/master-ls-command -[11]: https://opensource.com/article/19/2/getting-started-cat-command -[12]: https://opensource.com/how-submit-article diff --git a/sources/tech/20200107 Kali Linux Will No Longer Have The Default Root User.md b/sources/tech/20200107 Kali Linux Will No Longer Have The Default Root User.md deleted file mode 100644 index 0f087529b9..0000000000 --- a/sources/tech/20200107 Kali Linux Will No Longer Have The Default Root User.md +++ /dev/null @@ -1,87 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (BrunoJu) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Kali Linux Will No Longer Have The Default Root User) -[#]: via: (https://itsfoss.com/kali-linux-root-user/) -[#]: author: (Ankush Das https://itsfoss.com/author/ankush/) - -Kali Linux Will No Longer Have The Default Root User -====== - -Kali Linux is a specialized Linux distribution for cyber security testing and hacking related tasks. - -If you’ve used [Kali Linux][1], you probably know that it followed a default root user policy. In other words, you are always root in Kali Linux. Whatever you do – you will be accessing tools/applications as root by default. - -It looks like everything back then was kind of “root for all” for everything. So, the default root user policy existed. - -They also explained the history for this in their [announcement post][2]: - -> A lot of those tools back then either required root access to run or ran better when ran as root. With this operating system that would be ran from a CD, never be updated, and had a lot of tools that needed root access to run it was a simple decision to have a “everything as root” security model. It made complete sense for the time. - -### Kali Linux will now have a default non-root user (like most other distributions) - -![][3] - -A default non-root model was necessary because a lot of users now use Kali Linux as their daily driver. - -Of course, they [do not recommend using Kali Linux][4] as a replacement for stable distributions like Ubuntu/Fedora/Manjaro – however, with its active development, some users do consider using it on a day-to-day basis instead of just using it for its tools. - -So, with a wide mainstream usage of the distro, the Kali Linux team thought of switching to a default non-root model because nowadays a lot of applications/tools do not require root access. - -> While we don’t encourage people to run Kali as their day to day operating system, over the last few years more and more users have started to do so _(even if they are not using it to do penetration testing full time)_, including some members of the Kali development team. When people do so, they obviously don’t run as default root user. With this usage over time, there is the obvious conclusion that default root user is no longer necessary and Kali will be better off moving to a more traditional security model. - -So I am reiterating that you should not consider Kali Linux to be fit for your daily tasks if you do not utilize security-related [Kali Linux tools][5]. Feel free to experiment – but I wouldn’t be so sure to rely on it. - -So from the next release, when you install Kali Linux, you’ll be asked to create non-root user that will have admin privileges. Tools and commands that require root access will be run with sudo. - -![][6] - -#### [Pretend to be Using Windows with Kali Linux Undercover Mode][7] - -The new undercover mode in Kali Linux switches the desktop layout to make it look like Windows 10. Find out how to activate the undercover mode. - -### New default user and password for Kali Linux live mode - -![Kali Linux has new user-password in the live system][8] - -Technically, you won’t find a groundbreaking difference. Just note that the default user ID and password in live mode is “**kali**“. - -You can find the new non-root model implemented in the new daily/weekly builds if you want to test it early. - -In either case, you can wait for the 2020.1 release scheduled for late January to take a look at the new default non-root user model. - -### Getting back the old root model in Kali Linux - -If you are a long time Kali Linux user, you may not find it convenient to add sudo before commands and then manually enter the password. - -The good news here is that you can still get the old password-less root rights with this command: - -``` -sudo dpkg-reconfigure kali-grant-root -``` - -What do you think about the default non-root user model? Is it a good decision? Let me know your thoughts in the comments. - --------------------------------------------------------------------------------- - -via: https://itsfoss.com/kali-linux-root-user/ - -作者:[Ankush Das][a] -选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]: https://itsfoss.com/author/ankush/ -[b]: https://github.com/lujun9972 -[1]: https://www.kali.org/ -[2]: https://www.kali.org/news/kali-default-non-root-user/ -[3]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/01/kali_linux_default_root_user.png?ssl=1 -[4]: https://itsfoss.com/kali-linux-review/ -[5]: https://itsfoss.com/best-kali-linux-tools/ -[6]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/11/kali_linux_undercover_mode.jpg?fit=800%2C450&ssl=1 -[7]: https://itsfoss.com/kali-linux-undercover-mode/ -[8]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/01/kali-linux-live-password.png?ssl=1 diff --git a/sources/tech/20200121 Syncthing- Open Source P2P File Syncing Tool.md b/sources/tech/20200121 Syncthing- Open Source P2P File Syncing Tool.md deleted file mode 100644 index aa87c0f873..0000000000 --- a/sources/tech/20200121 Syncthing- Open Source P2P File Syncing Tool.md +++ /dev/null @@ -1,146 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: ( ) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Syncthing: Open Source P2P File Syncing Tool) -[#]: via: (https://itsfoss.com/syncthing/) -[#]: author: (Ankush Das https://itsfoss.com/author/ankush/) - -Syncthing: Open Source P2P File Syncing Tool -====== - -_**Brief: Syncthing is an open-source peer-to-peer file synchronization tool that you can use for syncing files between multiple devices (including an Android phone).**_ - -Usually, we have a cloud sync solution like [MEGA][1] or Dropbox to have a backup of our files on the cloud while making it easier to share it. - -But, what do you do if you want to sync your files across multiple devices without storing them on the cloud? - -That is where [Syncthing][2] comes to the rescue. - -### Syncthing: An open source tool to synchronize files across devices - -![][3] - -Syncthing lets you sync your files across multiple devices (including the support for Android smartphones). It primarily works through a web UI on Linux but also offers a GUI (to separately install). - -However, Syncthing does not utilize the cloud at all – it is a [peer-to-peer][4] file synchronization tool. Your data doesn’t go to a central server. Instead, the data is synced with all the devices between them. So, it does not really replace the [typical cloud storage services on Linux][5]. - -To add remote devices, you just need the device ID (or simply scan the QR code), no IP addresses involved. - -If you want a remote backup of your files – you should probably rely on the cloud. - -![Syncthing GUI][6] - -All things considered, Syncthing can come in handy for a lot of things. Technically, you can have your important files accessible on multiple systems securely and privately without worrying about anyone spying on your data. - -For instance, you may not want to store some of the sensitive files on the cloud – so you can add other trusted devices to sync and keep a copy of those files. - -Even though I described it briefly, there’s more to it and than meets the eye. I’d also recommend reading the [official FAQ][7] to clear some confusion on how it works – if you’re interested. - -### Features of Syncthing - -You probably do not want a lot of options in a synchronization tool – it should be dead simple to work reliably to sync your files. - -Syncthing is indeed quite simple and easy to understand – even though it is recommended that you should go through the [documentation][8] if you want to use every bit of its functionality. - -Here, I’ll highlight a few useful features of Syncthing: - -#### Cross-Platform Support - -![Syncthing on Android][9] - -Being an open-source solution, it does support Windows, Linux, and macOS. - -In addition to that, it also supports Android smartphones. You’ll be disappointed if you have an iOS device – so far, no plans for iOS support. - -#### File Versioning - -![Syncthing File Versioning][10] - -Syncthing utilizes a variety of [File Versioning methods][11] to archive the old files if they are replaced or deleted. - -By default, you won’t find it enabled. But, when you create a folder to sync, that’s when you will find the option to toggle the file versioning to your preferred method. - -#### Easy To Use - -While being a peer-to-peer file synchronization tool, it just works out of the box with no advanced tweaks. - -However, it does let you configure advanced settings when needed. - -#### Security & Privacy - -Even though you do not share your data with any cloud service providers, there are still some connections made that might gain the attention of an eavesdropper. So, Syncthing makes sure the communication is secured using TLS. - -In addition to that, there are solid authentication methods to ensure that only the devices/connections you allow explicitly will be granted access to sync/read data. - -For Android smartphones, you can also force the traffic through Tor if you’re using the [Orbot app][12]. You’ll find several other options for Android as well. - -#### Other Functionalities - -![][13] - -When exploring the tool yourself, you will notice that there are no limits to how many folders you can sync and the number of devices that you can sync. - -So, being a free and open-source solution with lots of useful features makes it an impressive choice for Linux users looking to have a peer-to-peer sync client. - -### Installing Syncthing on Linux - -You may not observe a .deb file or an .AppImage file for it on its official download webpage. But, you do get a snap package on the [Snap store][14] – if you’re curious you can read about [using snap apps][15] on Linux to get started. - -You may not find it in the software center (if you do – it may not be the latest version). - -**Note:** _There’s also a [Syncthing-GTK][16] available if you want a GUI to manage that – instead of a browser._ - -[Syncthing][2] - -You can also utilize the terminal to get it installed if you have a Debian-based distro – the instructions are on the [official download page][17]. - -### My experience with Syncthing - -Personally, I got it installed on Pop!_OS 19.10 and used it for a while before writing this up. - -I tried syncing folders, removing them, adding duplicate files to see how the file versioning works, and so on. It worked just fine. - -However, when I tried syncing it to a phone (Android) – the sync started a bit late, it wasn’t very quick. So, if we could have an option to explicitly force sync, that could help. Or, did I miss the option? Let me know in the comments if I did. - -Technically, it uses the resources of your system to work – so if you have a number of devices connected to sync, it should potentially improve the sync speed (upload/download). - -Overall, it works quite well – but I must say that you shouldn’t rely on it as the only backup solution to your data. - -**Wrapping Up** - -Have you tried Syncthing yet? If yes, how was your experience with it? Feel free to share it in the comments below. - -Also, if you know about some awesome alternatives to this – let me know about it as well. - --------------------------------------------------------------------------------- - -via: https://itsfoss.com/syncthing/ - -作者:[Ankush Das][a] -选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]: https://itsfoss.com/author/ankush/ -[b]: https://github.com/lujun9972 -[1]: https://itsfoss.com/install-mega-cloud-storage-linux/ -[2]: https://syncthing.net/ -[3]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/01/syncthing-screenshot.jpg?ssl=1 -[4]: https://en.wikipedia.org/wiki/Peer-to-peer -[5]: https://itsfoss.com/cloud-services-linux/ -[6]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/01/syncthing-gtk.png?ssl=1 -[7]: https://docs.syncthing.net/users/faq.html -[8]: https://docs.syncthing.net/users/index.html -[9]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/01/syncthing-android.jpg?ssl=1 -[10]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/01/syncthing-file-versioning.jpg?ssl=1 -[11]: https://docs.syncthing.net/users/versioning.html -[12]: https://play.google.com/store/apps/details?id=org.torproject.android&hl=en_IN -[13]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/01/syncthing-screenshot1.jpg?ssl=1 -[14]: https://snapcraft.io/syncthing -[15]: https://itsfoss.com/install-snap-linux/ -[16]: https://github.com/syncthing/syncthing-gtk/releases/latest -[17]: https://syncthing.net/downloads/ diff --git a/sources/tech/20200122 Screenshot your Linux system configuration with Bash tools.md b/sources/tech/20200122 Screenshot your Linux system configuration with Bash tools.md deleted file mode 100644 index 325b3aa019..0000000000 --- a/sources/tech/20200122 Screenshot your Linux system configuration with Bash tools.md +++ /dev/null @@ -1,110 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: ( ) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Screenshot your Linux system configuration with Bash tools) -[#]: via: (https://opensource.com/article/20/1/screenfetch-neofetch) -[#]: author: (Don Watkins https://opensource.com/users/don-watkins) - -Screenshot your Linux system configuration with Bash tools -====== -ScreenFetch and Neofetch make it easy to share your Linux environment -with others. -![metrics and data shown on a computer screen][1] - -There are many reasons you might want to share your Linux configuration with other people. You might be looking for help troubleshooting a problem on your system, or maybe you're so proud of the environment you've created that you want to showcase it to fellow open source enthusiasts. - -You could get some of that information with a **cat /proc/cpuinfo** or **lscpu** command at the Bash prompt. But if you want to share more details, such as your operating system, kernel, uptime, shell environment, screen resolution, etc., you have two great tools to choose: screenFetch and Neofetch. - -### ScreenFetch - -[ScreenFetch][2] is a Bash command-line utility that can produce a very nice screenshot of your system configuration and uptime. It is an easy way to share your system's configuration with others in a colorful way. - -It's simple to install screenFetch for many Linux distributions.  - -On Fedora, enter: - - -``` -`$ sudo dnf install screenfetch` -``` - -On Ubuntu, enter: - - -``` -`$ sudo apt install screenfetch` -``` - -For other operating systems, including FreeBSD, MacOS, and more, consult the screenFetch wiki's [installation page][3]. Once screenFetch is installed, it can produce a detailed and colorful screenshot like this: - -![screenFetch][4] - -ScreenFetch also provides various command-line options to fine-tune your results. For example, **screenfetch -v** returns verbose output that presents each option line-by-line along with the display shown above. - -And **screenfetch -n** eliminates the operating system icon when it displays your system information. - -![screenfetch -n option][5] - -Other options include **screenfetch -N**, which strips all color from the output; **screenfetch -t**, which truncates the output depending on the size of the terminal; and **screenFetch -E**, which suppresses errors. - -Be sure to check the man page on your system for other options. ScreenFetch is open source under the GPLv3, and you can learn more about the project in its [GitHub repository][6]. - -### Neofetch - -[Neofetch][7] is another tool to create a screenshot with your system information. It is written in Bash 3.2 and is open source under the [MIT License][8]. - -According to the project's website, "Neofetch supports almost 150 different operating systems. From Linux to Windows, all the way to more obscure operating systems like Minix, AIX, and Haiku." - -![Neofetch][9] - -The project maintains a wiki with excellent [installation documentation][10] for a variety of distributions and operating systems. - -If you are on Fedora, RHEL, or CentOS, you can install Neofetch at the Bash prompt with: - - -``` -`$ sudo dnf install neofetch` -``` - -On Ubuntu 17.10 and greater, you can use: - - -``` -`$ sudo apt install neofetch` -``` - -On its first run, Neofetch writes a **~/.config/neofetch/config.conf** file to your home directory (**.config/config.conf**), which enables you to [customize and control][11] every aspect of Neofetch's output. For example, you can configure Neofetch to use the image, ASCII file, or wallpaper of your choice—or nothing at all. The config.conf file also makes it easy to share your customization with others. - -If Neofetch doesn't support your operating system or provide all the options you are looking for, be sure to open up an issue in the project's [GitHub repo][12]. - -### Conclusion - -No matter why you want to share your system configuration, screenFetch or Neofetch should enable you to do so. Do you know of another open source tool that provides this functionality on Linux? Please share your favorite in the comments. - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/20/1/screenfetch-neofetch - -作者:[Don Watkins][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/don-watkins -[b]: https://github.com/lujun9972 -[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/metrics_data_dashboard_system_computer_analytics.png?itok=oxAeIEI- (metrics and data shown on a computer screen) -[2]: https://github.com/KittyKatt/screenFetch -[3]: https://github.com/KittyKatt/screenFetch/wiki/Installation -[4]: https://opensource.com/sites/default/files/uploads/screenfetch.png (screenFetch) -[5]: https://opensource.com/sites/default/files/uploads/screenfetch-n.png (screenfetch -n option) -[6]: http://github.com/KittyKatt/screenFetch -[7]: https://github.com/dylanaraps/neofetch -[8]: https://github.com/dylanaraps/neofetch/blob/master/LICENSE.md -[9]: https://opensource.com/sites/default/files/uploads/neofetch.png (Neofetch) -[10]: https://github.com/dylanaraps/neofetch/wiki/Installation -[11]: https://github.com/dylanaraps/neofetch/wiki/Customizing-Info -[12]: https://github.com/dylanaraps/neofetch/issues diff --git a/sources/tech/20200123 6 things you should be doing with Emacs.md b/sources/tech/20200123 6 things you should be doing with Emacs.md deleted file mode 100644 index b01830cd8e..0000000000 --- a/sources/tech/20200123 6 things you should be doing with Emacs.md +++ /dev/null @@ -1,91 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: ( ) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (6 things you should be doing with Emacs) -[#]: via: (https://opensource.com/article/20/1/emacs-cheat-sheet) -[#]: author: (Seth Kenlon https://opensource.com/users/seth) - -6 things you should be doing with Emacs -====== -Here are six things you may not have realized you could do with Emacs. -Then, get our new cheat sheet to get the most out of Emacs. -![Text editor on a browser, in blue][1] - -Imagine using Python's IDLE interface to edit text. You would be able to load files into memory, edit them, and save changes. But every action you perform would be defined by a Python function. Making a word all capitals, for instance, calls **upper()**, opening a file calls **open**, and so on. Everything in your text document is a Python object and can be manipulated accordingly. From the user's perspective, it's the same experience as any text editor. For a Python developer, it's a rich Python environment that can be changed and developed with just a few custom functions in a config file. - -This is what [Emacs][2] does for the 1958 programming language [Lisp][3]. In Emacs, there's no separation between the Lisp engine running the application and the arbitrary text you type into it. To Emacs, everything is Lisp data, so everything can be analyzed and manipulated programmatically. - -That makes for a powerful user interface (UI). But if you're a casual Emacs user, you may only be scratching the surface of what it can do for you. Here are six things you may not have realized you could do with Emacs. - -## Use Tramp mode for cloud editing - -Emacs has been network-transparent for a lot longer than has been trendy, and today it still provides one of the smoothest remote editor experiences available. The [Tramp mode][4] in Emacs (formerly known as RPC mode) stands for "Transparent Remote (file) Access, Multiple Protocol," which spells out exactly what it offers: easy access to remote files you want to edit over most popular network protocols. The most popular and safest protocol for remote editing these days is [OpenSSH][5], so that's the default. - -Tramp is already included in Emacs 22.1 or greater, so to use Tramp, you just open a file in the Tramp syntax. In the **File** menu of Emacs, select **Open File**. When prompted in the mini-buffer at the bottom of the Emacs window, enter the file name using this syntax: - - -``` -`/ssh:user@example.com:/path/to/file` -``` - -If you are required to log in interactively, Tramp prompts you for your password. However, Tramp uses OpenSSH directly, so to avoid interactive prompts, you can also add your hostname, username, and SSH key path to your **~/.ssh/config** file. Like Git, Emacs uses your SSH config first and only stops to ask for more information in the event of an error. - -Tramp is great for editing files that don't exist on your computer, and the user experience is not noticeably any different from editing a local file. The next time you start to SSH into a server just to launch a Vim or Emacs session, try Tramp instead. - -## Calendaring - -If you parse text better than you parse graphical interfaces, you'll be happy to know that you can schedule your day (or life) in plain text with Emacs but still get fancy notifications on your mobile device with open source [Org mode][6] viewers. - -The process takes a little setup to create a convenient way to sync your agenda with your mobile device (I use Git, but you could invoke Bluetooth, KDE Connect, Nextcloud, or your file synchronization tool of choice), and you have to install an Org mode viewer (such as [Orgzly][7]) and a Git client app on your mobile. Once you've got your infrastructure sorted, though, the process is inherently perfectly integrated with your usual (or developing, if you're a new user) Emacs workflow. You can refer to your agenda easily in Emacs, make updates to your schedule, and generally stay on task. Pushing changes to your agenda is reflected on your mobile, so you can stay organized even when Emacs isn't available. - -![][8] - -Intrigued? Read my step-by-step guide about [calendaring with Org mode and Git][9]. - -## Access the terminal - -There are [lots of terminal emulators][10] available. Although the Elisp terminal emulator in Emacs isn't the greatest general-purpose one, it's got two notable advantages. - - 1. **Opens in an Emacs buffer: **I use Emacs' Elisp shell because it's conveniently located in my Emacs window, which I often run in fullscreen. It's a small but significant advantage to have a terminal just a **Ctrl+x+o** (or C-x o in Emacs notation) away, and it's especially nice to be able to glance over at it for status reports when it's running a lengthy job. - 2. **Easy copying and pasting if no system clipboard is available:** Whether I'm too lazy to move my hand from the keys to the mouse, or I don't have mouse functionality because I'm running Emacs in a remote console, having a terminal in Emacs can sometimes mean a quick transfer of data from my Emacs buffer to Bash. - - - -To try the Emacs terminal, type **Alt**+**x** (**M-x** in Emacs notation), then type **shell**, and press **Return**. - -## Use Racket mode - -[Racket][11] is an exciting emerging Lisp dialect with a dynamic programming environment, a GUI toolkit, and a passionate community. The default editor when learning Racket is DrRacket, which has a Definitions panel at the top and an Interactions panel at the bottom. Using this setup, the user writes definitions that affect the Racket runtime. Imagine the old [Logo Turtle][12] program, but with a terminal instead of just a turtle. - -![Racket-mode][13] - -LGPL sample code by PLT - -Emacs, being based on Lisp, makes a great integrated development environment (IDE) for advanced Racket coders. It doesn't ship with [Racket mode][14] (yet), but you can install Racket mode and several other helper extensions using the Emacs package installer. To install it, press **Alt**+**X** (**M-x** in Emacs notation), type **package-install**, and press **Return**. Then enter the package you want to install (**racket-mode**), and press **Return**. - -Enter Racket mode with **M-x racket-mode**. If you're new to Racket but not to Lisp or Emacs, start with the excellent [Quick introduction to Racket with pictures][15]. - -## Scripting - -You might know that Bash scripts are popular for automating and enhancing your Linux or Unix experience. You may have heard that Python does a pretty good job of that, too. But did you know that Lisp scripts can be run in much the same way? There's sometimes confusion about just how useful Lisp really is because many people are introduced to Lisp through Emacs, so there's the latent impression that the only way to run Lisp in the 21st century is to open an Emacs window. Luckily, that's not the case at all, and Emacs is a great IDE for the tools that enable you to run Lisp scripts as general system executables. - -There are two popular modern Lisps, aside from Elisp, that are easy to run as standalone scripts. - - 1. **Racket:** You can run Racket scripts relying on your system's Racket install to provide runtime support, or you can use **raco exe** to produce an executable. The **raco exe** command packages your code together with runtime support files to create an executable. The **raco distribute** command then packages that executable into a distribution that works on other machines. Emacs has many Racket-specific tools, so creating Racket files in Emacs is easy and efficient. - - 2. **GNU Guile:** [GNU Guile][16] (short for "GNU Ubiquitous Intelligent Language for Extensions") is an implementation of the [Scheme][17] programming language that's used for creating applications and games for the desktop, internet, terminal, and more. Writing Scheme is easy, using any one of the many Scheme extensions in Emacs. For example, here's a "Hello world" script in Guile: [code] #!/usr/bin/guile -s -!# - -(display "hello world") -     (newline) [/code] Compile and run it with the **guile** command: [code] $ guile ./hello.scheme -;;; compiling /home/seth/./hello.scheme -;;; compiled [...]/hello.scheme.go -hello world -$ guile ./hello.scheme -hello world -``` -## Run Elisp without Emacs - -Emacs can serve as an Elisp runtime, but you don't have to "open" Emacs in the traditional sense. The **\--script** option allows you to run Elisp scripts using Emacs as the engine but without launching the Emacs GUI (not even its terminal-based one). In this example, the **-Q** option causes Emacs to ignore your **.emacs** file to avoid any delays in executing the Elisp script (if your script relies upon something \ No newline at end of file diff --git a/sources/tech/20200124 Run multiple consoles at once with this open source window environment.md b/sources/tech/20200124 Run multiple consoles at once with this open source window environment.md deleted file mode 100644 index 97c2849b60..0000000000 --- a/sources/tech/20200124 Run multiple consoles at once with this open source window environment.md +++ /dev/null @@ -1,115 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: ( ) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Run multiple consoles at once with this open source window environment) -[#]: via: (https://opensource.com/article/20/1/multiple-consoles-twin) -[#]: author: (Kevin Sonney https://opensource.com/users/ksonney) - -Run multiple consoles at once with this open source window environment -====== -Simulate the old-school DESQview experience with twin in the fourteenth -in our series on 20 ways to be more productive with open source in 2020. -![Digital creative of a browser on the internet][1] - -Last year, I brought you 19 days of new (to you) productivity tools for 2019. This year, I'm taking a different approach: building an environment that will allow you to be more productive in the new year, using tools you may or may not already be using. - -### Overcome "one screen, one app" limits with twin - -Who remembers [DESQview][2]? It allowed for things in DOS we take for granted now in Windows, Linux, and MacOS—namely the ability to run and have multiple programs running onscreen at once. In my early days running a dial-up BBS, DESQview was a necessity—it enabled me to have the BBS running in the background while doing other things in the foreground. For example, I could be working on new features or setting up new external programs while someone was dialed in without impacting their experience. Later, in my early days in support, I could have my work email ([DaVinci email on MHS][3]), the support ticket system, and other DOS programs running all at once. It was amazing! - -![twin][4] - -Running multiple console applications has come a long way since then. But applications like [tmux][5] and [Screen][6] still follow the "one screen, one app" kind of display. OK, yes, tmux has screen splitting and panes, but not like DESQview, with the ability to "float" windows over others, and I, for one, miss that. - -Enter [twin][7], the text-mode window environment. This relatively young project is, in my opinion, a spiritual successor to DESQview. It supports console and graphical environments, as well as the ability to detach from and reattach to sessions. It's not as easy to set up as some things, but it will run on most modern operating systems. - -Twin is installed from source (for now). But first, you need to install the required development libraries. The library names will vary by operating system. The following example shows it for my Ubuntu 19.10 installation. Once the libraries are installed, check out the twin source from Git and run **./configure** and **make**, which should auto-detect everything and build twin: - - -``` -sudo apt install libx11-dev libxpm-dev libncurses-dev zlib1g-dev libgpm-dev -git clone [git@github.com][8]:cosmos72/twin.git -cd twin -./configure -make -sudo make install -``` - -Note: If you are compiling this on MacOS or BSD, you will need to comment out **#define socklen_t int** in the files **include/Tw/autoconf.h** and **include/twautoconf.h** before running **make**. This should be addressed by [twin issue number 57][9]. - -![twin text mode][10] - -Invoking twin for the first time can be a bit of a challenge. You need to tell it what kind of display it is using with the **\--hw** parameter. For example, to launch a text-mode version of twin, you would enter **twin --hw=tty,TERM=linux**. The **TERM** variable specifies an override to the current terminal variable in your shell. To launch a graphical version, run **twin --hw=X@$DISPLAY**. On Linux, twin mostly "just works," and on MacOS, it mostly only works in terminals. - -The _real_ fun comes with the ability to attach to running sessions with the **twattach** and **twdisplay** commands. They allow you to attach to a running twin session somewhere else. For example, on my Mac, I can run the following command to connect to the twin session running on my demo box: - - -``` -`twdisplay --twin@20days2020.local:0 --hw=tty,TERM=linux` -``` - -![remote twin session][11] - -With some extra work, you can also use it as a login shell in place of [getty][12] on consoles. This requires the gdm mouse daemon, the twdm application (included), and a little extra configuration. On systems that use systemd, start by installing and enabling gdm (if it isn't already installed). Then use systemctl to create an override for a console (I used tty6). The commands must be run as the root user; on Ubuntu, they look something like this: - - -``` -apt install gdm -systemctl enable gdm -systemctl start gdm -systemctl edit getty@tty6 -``` - -The **systemctl edit getty@tty6** command will open an empty file named **override.conf**. This defines systemd service settings to override the default for console 6. Update the contents to: - - -``` -[service] -ExecStart= -ExecStart=-/usr/local/sbin/twdm --hw=tty@/dev/tty6,TERM=linux -StandardInput=tty -StandardOutput=tty -``` - -Now, reload systemd and restart tty6 to get a twin login prompt: - - -``` -systemctl daemon-reload -systemctl restart getty@tty6 -``` - -![twin][13] - -This will launch a twin session for the user who logs in. I do not recommend this for a multi-user system, but it is pretty cool for a personal desktop. And, by using **twattach** and **twdisplay**, you can access that session from the local GUI or remote desktops. - -I think twin is pretty darn cool. It has some rough edges, but the basic functionality is there, and it has some pretty good documentation. Also, it scratches the itch I have for a DESQview-like experience on modern operating systems. I look forward to improvements over time, and I hope you like it as much as I do. - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/20/1/multiple-consoles-twin - -作者:[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 -[b]: https://github.com/lujun9972 -[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/browser_web_internet_website.png?itok=g5B_Bw62 (Digital creative of a browser on the internet) -[2]: https://en.wikipedia.org/wiki/DESQview -[3]: https://en.wikipedia.org/wiki/Message_Handling_System -[4]: https://opensource.com/sites/default/files/uploads/productivity_14-1.png (twin) -[5]: https://github.com/tmux/tmux/wiki -[6]: https://www.gnu.org/software/screen/ -[7]: https://github.com/cosmos72/twin -[8]: mailto:git@github.com -[9]: https://github.com/cosmos72/twin/issues/57 -[10]: https://opensource.com/sites/default/files/uploads/productivity_14-2.png (twin text mode) -[11]: https://opensource.com/sites/default/files/uploads/productivity_14-3.png (remote twin session) -[12]: https://en.wikipedia.org/wiki/Getty_(Unix) -[13]: https://opensource.com/sites/default/files/uploads/productivity_14-4.png (twin) diff --git a/sources/tech/20200125 Use tmux to create the console of your dreams.md b/sources/tech/20200125 Use tmux to create the console of your dreams.md deleted file mode 100644 index adab130489..0000000000 --- a/sources/tech/20200125 Use tmux to create the console of your dreams.md +++ /dev/null @@ -1,120 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: ( ) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Use tmux to create the console of your dreams) -[#]: via: (https://opensource.com/article/20/1/tmux-console) -[#]: author: (Kevin Sonney https://opensource.com/users/ksonney) - -Use tmux to create the console of your dreams -====== -You can do a lot with tmux, especially when you add tmuxinator to the -mix. Check them out in the fifteenth in our series on 20 ways to be more -productive with open source in 2020. -![Person drinking a hat drink at the computer][1] - -Last year, I brought you 19 days of new (to you) productivity tools for 2019. This year, I'm taking a different approach: building an environment that will allow you to be more productive in the new year, using tools you may or may not already be using. - -### Do it all on the console with tmux and tmuxinator - -In this series so far, I've written about individual apps and tools. Starting today, I'll put them together into comprehensive setups to streamline things. Starting at the command line. Why the command line? Simply put, working at the command line allows me to access a lot of these tools and functions from anywhere I can run SSH. I can SSH into one of my personal machines and run the same setup on my work machine as I use on my personal one. And the primary tool I'm going to use for that is [tmux][2]. - -Most people use tmux for very basic functions, such as opening it on a remote server then starting a process, maybe opening a second session to watch log files or debug information, then disconnecting and coming back later. But you can do so much work with tmux. - -![tmux][3] - -First things first—if you have an existing tmux configuration file, back it up. The configuration file for tmux is **~/.tmux.conf**. Move it to another directory, like **~/tmp**. Now, clone the [Oh My Tmux][4] project with Git. Link to **.tmux.conf** from that and copy in the **.tmux.conf.local** file to make adjustments: - - -``` -cd ~ -mkdir ~/tmp -mv ~/.tmux.conf ~/tmp/ -git clone -ln -s ~/.tmux/.tmux.conf ./ -cp ~/.tmux.conf.local ./ -``` - -The **.tmux.conf.local** file contains local settings and overrides. For example, I changed the default colors a bit and turned on the [Powerline][5] dividers. This snippet shows only the things I changed: - - -``` -tmux_conf_theme_24b_colour=true -tmux_conf_theme_focused_pane_bg='default' -tmux_conf_theme_pane_border_style=fat -tmux_conf_theme_left_separator_main='\uE0B0' -tmux_conf_theme_left_separator_sub='\uE0B1' -tmux_conf_theme_right_separator_main='\uE0B2' -tmux_conf_theme_right_separator_sub='\uE0B3' -#tmux_conf_battery_bar_symbol_full='◼' -#tmux_conf_battery_bar_symbol_empty='◻' -tmux_conf_battery_bar_symbol_full='♥' -tmux_conf_battery_bar_symbol_empty='·' -tmux_conf_copy_to_os_clipboard=true -set -g mouse on -``` - -Note that you do not need to have Powerline installed—you just need a font that supports the Powerline symbols. I use [Hack Nerd Font][6] for almost everything console-related since it is easy for me to read and has many, many useful extra symbols. You'll also note that I turn on operating system clipboard support and mouse support. - -Now, when tmux starts up, the status bar at the bottom provides a bit more information—and in exciting colors. **Ctrl**+**b** is still the "leader" key for entering commands, but some others have changed. Splitting panes horizontally (top/bottom) is now **Ctrl**+**b**+**-** and vertically is now **Ctrl**+**b**+**_**. With mouse mode turned on, you can click to switch between the panes and drag the dividers to resize them. Opening a new window is still **Ctrl**+**b**+**n**, and you can now click on the window name on the bottom bar to switch between them. Also, **Ctrl**+**b**+**e** will open up the **.tmux.conf.local** file for editing. When you exit the editor, tmux will reload the configuration without reloading anything else. Very useful. - -So far, I've only made some simple changes to functionality and visual display and added mouse support. Now I'll set it up to launch the apps I want in a way that makes sense and without having to reposition and resize them every time. For that, I'll use [tmuxinator][7]. Tmuxinator is a launcher for tmux that allows you to specify and manage layouts and autostart applications with a YAML file. To use it, start tmux and create panes with the things you want running in them. Then, open a new window with **Ctrl**+**b**+**n**, and execute **tmux list-windows**. You will get detailed information about the layout. - -![tmux layout information][8] - -Note the first line in the code above where I set up four panes with an application in each one.** **Save the output from when you run it for later. Now, run **tmuxinator new 20days** to create a layout named **20days**. This will bring up a text editor with the default layout file. It has a lot of useful stuff in it, and I encourage you to read up on all the options. Start by putting in the layout information above and what apps you want where: - - -``` -# /Users/ksonney/.config/tmuxinator/20days.yml -name: 20days -root: ~/ -windows: -   - mail: -      layout: d9da,208x60,0,0[208x26,0,0{104x26,0,0,0,103x26,105,0,5},208x33,0,27{104x33,0,27,1,103x33,105,27,4}]] @0 -      panes: -        - alot -        - abook -        - ikhal -        - todo.sh ls +20days -``` - -Be careful with the spaces! Like Python code, the spaces and indentation matter to how the file is interpreted. Save the file and then run **tmuxinator 20days**. You should get four panes with the [alot][9] mail program, [abook][10], ikhal (a shortcut to [khal][11] interactive), and anything in [todo.txt][12] with the tag **+20days**. - -![sample layout launched by tmuxinator][13] - -You'll also notice that the window on the bottom bar is labeled Mail. You can click on the name (along with other named windows) to jump to that view. Nifty, right? I set up a second window named Social with [Tuir][14], [Newsboat][15], an IRC client connected to [BitlBee][16], and [Rainbow Stream][17] in the same file. - -Tmux is my productivity powerhouse for keeping track of all the things, and with tmuxinator, I don't have to worry about constantly resizing, placing, and launching my applications. - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/20/1/tmux-console - -作者:[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 -[b]: https://github.com/lujun9972 -[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/coffee_tea_laptop_computer_work_desk.png?itok=D5yMx_Dr (Person drinking a hat drink at the computer) -[2]: https://github.com/tmux/tmux -[3]: https://opensource.com/sites/default/files/uploads/productivity_15-1.png (tumux) -[4]: https://github.com/gpakosz/.tmux -[5]: https://github.com/powerline/powerline -[6]: https://www.nerdfonts.com/ -[7]: https://github.com/tmuxinator/tmuxinator -[8]: https://opensource.com/sites/default/files/uploads/productivity_15-2.png (tmux layout information) -[9]: https://opensource.com/article/20/1/organize-email-notmuch -[10]: https://opensource.com/article/20/1/sync-contacts-locally -[11]: https://opensource.com/article/20/1/open-source-calendar -[12]: https://opensource.com/article/20/1/open-source-to-do-list -[13]: https://opensource.com/sites/default/files/uploads/productivity_15-3.png (sample layout launched by tmuxinator) -[14]: https://opensource.com/article/20/1/open-source-reddit-client -[15]: https://opensource.com/article/20/1/open-source-rss-feed-reader -[16]: https://opensource.com/article/20/1/open-source-chat-tool -[17]: https://opensource.com/article/20/1/tweet-terminal-rainbow-stream diff --git a/sources/tech/20200126 Use Vim to send email and check your calendar.md b/sources/tech/20200126 Use Vim to send email and check your calendar.md deleted file mode 100644 index fdb709aaef..0000000000 --- a/sources/tech/20200126 Use Vim to send email and check your calendar.md +++ /dev/null @@ -1,117 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: ( ) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Use Vim to send email and check your calendar) -[#]: via: (https://opensource.com/article/20/1/vim-email-calendar) -[#]: author: (Kevin Sonney https://opensource.com/users/ksonney) - -Use Vim to send email and check your calendar -====== -Manage your email and calendar right from your text editor in the -sixteenth in our series on 20 ways to be more productive with open -source in 2020. -![Calendar close up snapshot][1] - -Last year, I brought you 19 days of new (to you) productivity tools for 2019. This year, I'm taking a different approach: building an environment that will allow you to be more productive in the new year, using tools you may or may not already be using. - -### Doing (almost) all the things with Vim, part 1 - -I use two text editors regularly—[Vim][2] and [Emacs][3]. Why both? They have different use cases, and I'll talk about some of them in the next few articles in this series. - -![][4] - -OK, so why do everything in Vim? Because if there is one application that is on every machine I have access to, it's Vim. And if you are like me, you probably already spend a lot of time in Vim. So why not use it for _all the things_? - -Before that, though, you need to do some things. The first is to make sure you have Ruby support in Vim. You can check that with **vim --version | grep ruby**. If the result is not **+ruby**, that needs to be fixed. This can be tricky, and you should check your distribution's documentation for the right package to install. On MacOS, this is the official MacVim (not from Brew), and on most Linux distributions, this is either vim-nox or vim-gtk—NOT vim-gtk3. - -I use [Pathogen][5] to autoload my plugins and bundles. If you use [Vundle][6] or another Vim package manager, you'll need to adjust the commands below to work with it. - -#### Do your email in Vim - -A good starting place for making Vim a bigger part of your productivity plan is using it to send and receive email with [Notmuch][7] using [abook][8] to access your contact list. You need to install some things for this. All the sample code below is on Ubuntu, so you'll need to adjust for that if you are using a different distribution. Do the setup with: - - -``` -sudo apt install notmuch-vim ruby-mail -curl -o ~/.vim/plugin/abook --create-dirs -``` - -So far, so good. Now start Vim and execute **:NotMuch**. There may be some warnings due to the older version of the mail library **notmuch-vim** was written for, but in general, Vim will now be a full-featured Notmuch mail client. - -![Reading Mail in Vim][9] - -If you want to perform a search for a specific tag, type **\t**, enter the name of the tag, and press Enter. This will pull up a list of all messages with that tag. The **\s** key combination brings up a **Search:** prompt that will do a full search of the Notmuch database. Navigate the message list with the arrow keys, press Enter to display the selected item, and enter **\q** to exit the current view. - -To compose mail, use the **\c** keystroke. You will see a blank message. This is where the **abook.vim** plugin comes in. Hit **Esc** and enter **:AbookQuery <SomeName>**, where <SomeName> is a part of the name or email address you want to look for. You will get a list of entries in the abook database that match your search. Select the address you want by typing its number to add it to the email's address line. Finish typing and editing the email, press **Esc** to exit edit mode, and enter **,s** to send. - -If you want to change the default folder view when **:NotMuch** starts up, you can add the variable **g:notmuch_folders** to your **.vimrc** file: - - -``` -let g:notmuch_folders = [ -      \ [ 'new', 'tag:inbox and tag:unread' ], -      \ [ 'inbox', 'tag:inbox' ], -      \ [ 'unread', 'tag:unread' ], -      \ [ 'News', 'tag:@sanenews' ], -      \ [ 'Later', 'tag:@sanelater' ], -      \ [ 'Patreon', 'tag:@patreon' ], -      \ [ 'LivestockConservancy', 'tag:livestock-conservancy' ], -    \ ] -``` - -There are many more settings covered in the Notmuch plugin's documentation, including setting up keys for tags and using alternate mail programs. - -#### Consult your calendar in Vim - -![][10] - -Sadly, there do not appear to be any calendar programs for Vim that use the vCalendar or iCalendar formats. There is [Calendar.vim][11], which is very well done. Set up Vim to access your calendar with: - - -``` -cd ~/.vim/bundle -git clone [git@github.com][12]:itchyny/calendar.vim.git -``` - -Now, you can see your calendar in Vim by entering **:Calendar**. You can switch between year, month, week, day, and clock views with the **<** and **>** keys. If you want to start with a particular view, use the **-view=** flag to tell it which one you wish to see. You can also add a date to any of the views. For example, if I want to see what is going on the week of July 4, 2020, I would enter **:Calendar -view week 7 4 2020**. The help is pretty good and can be accessed with the **?** key. - -![][13] - -Calendar.vim also supports Google Calendar (which I need), but in December 2019 Google disabled the access for it. The author has posted a workaround in [the issue on -GitHub][14]. - -So there you have it, your mail, addresses, and calendars in Vim. But you aren't done yet; you'll do even more with Vim tomorrow! - -Vim offers great benefits to writers, regardless of whether they are technically minded or not. - -Need to keep your schedule straight? Learn how to do it using open source with these free... - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/20/1/vim-email-calendar - -作者:[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 -[b]: https://github.com/lujun9972 -[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/calendar.jpg?itok=jEKbhvDT (Calendar close up snapshot) -[2]: https://www.vim.org/ -[3]: https://www.gnu.org/software/emacs/ -[4]: https://opensource.com/sites/default/files/uploads/day16-image1.png -[5]: https://github.com/tpope/vim-pathogen -[6]: https://github.com/VundleVim/Vundle.vim -[7]: https://opensource.com/article/20/1/organize-email-notmuch -[8]: https://opensource.com/article/20/1/sync-contacts-locally -[9]: https://opensource.com/sites/default/files/uploads/productivity_16-2.png (Reading Mail in Vim) -[10]: https://opensource.com/sites/default/files/uploads/day16-image3.png -[11]: https://github.com/itchyny/calendar.vim -[12]: mailto:git@github.com -[13]: https://opensource.com/sites/default/files/uploads/day16-image4.png -[14]: https://github.com/itchyny/calendar.vim/issues/156 diff --git a/sources/tech/20200128 Send email and check your calendar with Emacs.md b/sources/tech/20200128 Send email and check your calendar with Emacs.md deleted file mode 100644 index 48be7e8e45..0000000000 --- a/sources/tech/20200128 Send email and check your calendar with Emacs.md +++ /dev/null @@ -1,152 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: ( ) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Send email and check your calendar with Emacs) -[#]: via: (https://opensource.com/article/20/1/emacs-mail-calendar) -[#]: author: (Kevin Sonney https://opensource.com/users/ksonney) - -Send email and check your calendar with Emacs -====== -Manage your email and view your schedule with the Emacs text editor in -the eighteenth in our series on 20 ways to be more productive with open -source in 2020. -![Document sending][1] - -Last year, I brought you 19 days of new (to you) productivity tools for 2019. This year, I'm taking a different approach: building an environment that will allow you to be more productive in the new year, using tools you may or may not already be using. - -### Doing (almost) all the things with Emacs, part 1 - -Two days ago, I shared that I use both [Vim][2] and [Emacs][3] regularly, and on days [16][4] and [17][5] of this series, I explained how to do almost everything in Vim. Now, it's time for Emacs! - -![Mail and calendar in Emacs][6] - -Before I get too far, I should explain two things. First, I'm doing everything here using the default Emacs configuration, not [Spacemacs][7], which I have [written about][8]. Why? Because I will be using the default keyboard mappings so that you can refer back to the documentation and not have to translate things from "native Emacs" to Spacemacs. Second, I'm not setting up Org mode in this series. Org mode almost needs an entire series on its own, and, while it is very powerful, the setup can be quite complex. - -#### Configure Emacs - -Configuring Emacs is a little bit more complicated than configuring Vim, but in my opinion, it is worth it in the long run. Start by creating a configuration file and opening it in Emacs: - - -``` -mkdir ~/.emacs.d -emacs ~/.emacs.d/init.el -``` - -Next, add some additional package sources to the built-in package manager. Add the following to **init.el**: - - -``` -(package-initialize) -(add-to-list 'package-archives '("melpa" . "")) -(add-to-list 'package-archives '("org" . "") t) -(add-to-list 'package-archives '("gnu" . "")) -(package-refresh-contents) -``` - -Save the file with **Ctrl**+**x** **Ctrl**+**s**, exit with **Ctrl**+**x** **Ctrl**+**c**, and restart Emacs. It will download all the package lists at startup, and then you should be ready to install things with the built-in package manager. Start by typing **Meta**+**x** to bring up a command prompt (the **Meta** key is the **Alt** key on most keyboards or **Option** on MacOS). At the command prompt, type **package-list-packages** to bring up a list of packages you can install. Go through the list and select the following packages with the **i** key: - - -``` -bbdb -bbdb-vcard -calfw -calfw-ical -notmuch -``` - -Once the packages are selected, press **x** to install them. Depending on your internet connection, this could take a while. You may see some compile errors, but it's safe to ignore them. Once it completes, open **~/.emacs.d/init.el** with the key combination **Ctrl**+**x** **Ctrl**+**f**, and add the following lines to the file after **(package-refresh-packages)** and before **(custom-set-variables**. Emacs uses the **(custom-set-variables** line internally, and you should never, ever modify anything below it. Lines beginning with **;;** are comments. - - -``` -;; Set up bbdb -(require 'bbdb) -(bbdb-initialize 'message) -(bbdb-insinuate-message) -(add-hook 'message-setup-hook 'bbdb-insinuate-mail) -;; set up calendar -(require 'calfw) -(require 'calfw-ical) -;; Set this to the URL of your calendar. Google users will use -;; the Secret Address in iCalendar Format from the calendar settings -(cfw:open-ical-calendar "") -;; Set up notmuch -(require 'notmuch) -;; set up mail sending using sendmail -(setq send-mail-function (quote sendmail-send-it)) -(setq user-mail-address "[myemail@mydomain.com][9]" -      user-full-name "My Name") -``` - -Now you are ready to start Emacs with your setup! Save the **init.el** file (**Ctrl**+**x** **Ctrl**+**s**), exit Emacs (**Ctrl**+**x** **Ctrl**+**c**), and then restart it. It will take a little longer to start this time. - -#### Read and write email in Emacs with Notmuch - -Once you are at the Emacs splash screen, you can start reading your email with [Notmuch][10]. Type **Meta**+**x notmuch**, and you'll get Notmuch's Emacs interface. - -![Reading mail with Notmuch][11] - -All the items in bold type are links to email views. You can access them with either a mouse click or by tabbing between them and pressing **Return** or **Enter**. You can use the search bar to - -search Notmuch's database using the [same syntax][12] as you use on Notmuch's command line. If you want, you can save any searches for later use with the **[save]** button, and they will be added to the list at the top of the screen. If you follow one of the links, you will get a list of the relevant email messages. You can navigate the list with the **Arrow** keys, and press **Enter** on the message you want to read. Pressing **r** will reply to a message, **f** will forward the message, and **q** will exit the current screen. - -You can write a new message by typing **Meta**+**x compose-mail**. Composing, replying, and forwarding all bring up the mail writing interface. When you are done writing your email, press **Ctrl**+**c Ctrl**+**c** to send it. If you decide you don't want to send it, press **Ctrl**+**c Ctrl**+**k** to kill the message compose buffer (window). - -#### Autocomplete email addresses in Emacs with BBDB - -![Composing a message with BBDB addressing][13] - -But what about your address book? That's where [BBDB][14] comes in. But first, import all your addresses from [abook][15] by opening a command line and running the following export command: - - -``` -`abook --convert --outformat vcard --outfile ~/all-my-addresses.vcf --infile ~/.abook/addresses` -``` - -Once Emacs starts, run **Meta**+**x bbdb-vcard-import-file**. It will prompt you for the file name you want to import, which is **~/all-my-addresses.vcf**. After the import finishes, when you compose a message, you can start typing a name and use **Tab** to search and autocomplete the "To" field. BBDB will also open a buffer for the contact so you can make sure it's the correct one. - -Why do it this way when you already have each address as a **vcf.** file from [vdirsyncer][16]? If you are like me, you have a LOT of addresses, and doing them one at a time is a lot of work. This way, you can take everything you have in abook and make one big file. - -#### View your calendar in Emacs with calfw - -![calfw calendar][17] - -Finally, you can use Emacs to look at your calendar. In the configuration section above, you installed the [calfw][18] package and added lines to tell it where to find the calendars to load. Calfw is short for the Calendar Framework for Emacs, and it supports many calendar formats. Since I use Google calendar, that is the link I put into my config. Your calendar will auto-load at startup, and you can view it by switching the **cfw-calendar** buffer with the **Ctrl**+**x**+**b** command. - -Calfw offers views by the day, week, two weeks, and month. You can select the view from the top of the calendar and navigate your calendar with the **Arrow** keys. Unfortunately, calfw can only view calendars, so you'll still need to use something like [khal][19] or a web interface to add, delete, and modify events. - -So there you have it: mail, calendars, and addresses in Emacs. Tomorrow I'll do even more. - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/20/1/emacs-mail-calendar - -作者:[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 -[b]: https://github.com/lujun9972 -[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/email_paper_envelope_document.png?itok=uPj_kouJ (Document sending) -[2]: https://www.vim.org/ -[3]: https://www.gnu.org/software/emacs/ -[4]: https://opensource.com/article/20/1/vim-email-calendar -[5]: https://opensource.com/article/20/1/vim-task-list-reddit-twitter -[6]: https://opensource.com/sites/default/files/uploads/productivity_18-1.png (Mail and calendar in Emacs) -[7]: https://www.spacemacs.org/ -[8]: https://opensource.com/article/19/12/spacemacs -[9]: mailto:myemail@mydomain.com -[10]: https://notmuchmail.org/ -[11]: https://opensource.com/sites/default/files/uploads/productivity_18-2.png (Reading mail with Notmuch) -[12]: https://opensource.com/article/20/1/organize-email-notmuch -[13]: https://opensource.com/sites/default/files/uploads/productivity_18-3.png (Composing a message with BBDB addressing) -[14]: https://www.jwz.org/bbdb/ -[15]: https://opensource.com/article/20/1/sync-contacts-locally -[16]: https://opensource.com/article/20/1/open-source-calendar -[17]: https://opensource.com/sites/default/files/uploads/productivity_18-4.png (calfw calendar) -[18]: https://github.com/kiwanami/emacs-calfw -[19]: https://khal.readthedocs.io/en/v0.9.2/index.html diff --git a/sources/tech/20200129 Use Emacs to get social and track your todo list.md b/sources/tech/20200129 Use Emacs to get social and track your todo list.md deleted file mode 100644 index 3893aac377..0000000000 --- a/sources/tech/20200129 Use Emacs to get social and track your todo list.md +++ /dev/null @@ -1,162 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: ( ) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Use Emacs to get social and track your todo list) -[#]: via: (https://opensource.com/article/20/1/emacs-social-track-todo-list) -[#]: author: (Kevin Sonney https://opensource.com/users/ksonney) - -Use Emacs to get social and track your todo list -====== -Access Twitter, Reddit, chat, email, RSS, and your todo list in the -nineteenth in our series on 20 ways to be more productive with open -source in 2020. -![Team communication, chat][1] - -Last year, I brought you 19 days of new (to you) productivity tools for 2019. This year, I'm taking a different approach: building an environment that will allow you to be more productive in the new year, using tools you may or may not already be using. - -### Doing (almost) all the things with Emacs, part 2 - -[Yesterday][2], I talked about how to read email, access your addresses, and show calendars in Emacs. Emacs has tons and tons of functionality, and you can also use it for Twitter, chatting, to-do lists, and more! - -![All the things with Emacs][3] - -To do all of this, you need to install some Emacs packages. As you did yesterday, open the Emacs package manager with **Meta**+**x package-manager** (Meta is **Alt** on most keyboards or **Option** on MacOS). Now select the following packages with **i**, then install them by typing **x**: - - -``` -nnreddit -todotxt -twittering-mode -``` - -Once they are installed, open **~/.emacs.d/init.el** with **Ctrl**+**x Ctrl**+**x**, and add the following before the **(custom-set-variables** line: - - -``` -;; Todo.txt -(require 'todotxt) -(setq todotxt-file (expand-file-name "~/.todo/todo.txt")) - -;; Twitter -(require 'twittering-mode) -(setq twittering-use-master-password t) -(setq twittering-icon-mode t) - -;; Python3 for nnreddit -(setq elpy-rpc-python-command "python3") -``` - -Save the file with **Ctrl**+**x Ctrl**+**a**, exit Emacs with **Ctrl**+**x Ctrl**+**c**, then restart Emacs. - -#### Tweet from Emacs with twittering-mode - -![Twitter in Emacs][4] - -[Twittering-mode][5] is one of the best Emacs interfaces for Twitter. It supports almost all the features of Twitter and has some easy-to-use keyboard shortcuts. - -To get started, type **Meta**+**x twit** to launch twittering-mode. It will give a URL to open—and prompt you to launch a browser with it if you want—so you can log in and get an authorization token. Copy and paste the token into Emacs, and your Twitter timeline should load. You can scroll with the **Arrow** keys, use **Tab** to move from item to item, and press **Enter** to view the URL the cursor is on. If the cursor is on a username, pressing **Enter** will open that timeline in a web browser. If you are on a tweet's text, pressing **Enter** will reply to that tweet. You can create a new tweet with **u**, retweet something with **Ctrl**+**c**+**Enter**, and send a direct message with **d**—the dialog it opens has instructions on how to send, cancel, and shorten URLs. - -Pressing **V** will open a prompt to get to other timelines. To open your mentions, type **:mentions**. The home timeline is **:home**, and typing a username will take you to that user's timeline. Finally, pressing **q** will quit twittering-mode and close the window. - -There is a lot more functionality available in twittering-mode, and I encourage you to read the [full list][6] on its GitHub page. - -#### Track your to-do's in Emacs with Todotxt.el - -![todo.txt in emacs][7] - -[Todotxt.el][8] is a nice interface for the [todo.txt][9] to-do list manager. It has hotkeys for just about everything. - -To start it up, type **Meta**+**x todotxt**, and it will load the todo.txt file you specified in the **todotxt-file** variable (which you set in the first part of this article). Inside the buffer (window) for todo.txt, you can press **a** to add a new task and **c** to mark it complete. You can set priorities with **r**, and add projects and context to an item with **t**. When you are ready to move everything to **done.txt**, just press **A**. And you can filter the list with **/** or refresh back to the full list with **l**. And again, you can press **q** to exit. - -#### Chat in Emacs with ERC - -![Chatting with erc][10] - -One of Vim's shortcomings is that trying to use chat with it is difficult (at best). Emacs, on the other hand, has the [ERC][11] client built into the default distribution. Start ERC with **Meta**+**x erc**, and you will be prompted for a server name, username, and password. You can use the same information you used a few days ago when you set up [BitlBee][12]: server **localhost**, port **6667**, and the same username with no password. It should be the same as using almost any other IRC client. Each channel will be split into a new buffer (window), and you can switch between them with **Ctrl**+**x Ctrl**+**b**, which also switches between other buffers in Emacs. The **/quit** command will exit ERC. - -#### Read email, Reddit, and RSS feeds with Gnus - -![Mail, Reddit, and RSS feeds with Gnus][13] - -I'm sure many long-time Emacs users were asking, "but what about [Gnus][14]?" yesterday when I was talking about reading mail in Emacs. And it's a valid question. Gnus is a mail and newsreader built into Emacs, although it doesn't support [Notmuch][15] as a mail reader, just as a search engine. However, if you are configuring it for Reddit and RSS feeds (as you'll do in a moment), it's smart to add in mail functionality as well. - -Gnus was created for reading Usenet News and grew from there. So, a lot of its look and feel (and terminology) seem a lot like a Usenet newsreader. - -Gnus has its own configuration file in **~/.gnus** (the configuration can also be included in the main **~/.emacs.d/init.el**). Open **~/.gnus** with **Ctrl**+**x Ctrl**+**f** and add the following: - - -``` -;; Required packages -(require 'nnir) -(require 'nnrss) - -;; Primary Mailbox -(setq gnus-select-method -      '(nnmaildir "Local" -                  (directory "~/Maildir") -                  (nnir-search-engine notmuch) -      )) -(add-to-list 'gnus-secondary-select-methods -             '(nnreddit "")) -``` - -Save the file with **Ctrl**+**x Ctrl**+**s**. This tells Gnus to read mail from the local mailbox in **~/Maildir** as the primary source (**gnus-select-method**) and add a second source (**gnus-secondary-select-methods**) using the [nnreddit][16] plugin. You can also define multiple secondary sources, including Usenet News (nntp), IMAP (nnimap), mbox (nnmbox), and virtual collections (nnvirtual). You can learn more about all the options in the [Gnus manual][17]. - -Once you save the file, start Gnus with **Meta**+**x gnus**. The first run will install [Reddit Terminal Viewer][18] in a Python virtual environment, which is how it gets Reddit articles. It will then launch your browser to log into Reddit. After that, it will scan and load your subscribed Reddit groups. You will see a list of email folders with new mail and the list of subreddits with new content. Pressing **Enter** on any of them will load the list of messages for the group. You can navigate with the **Arrow** keys and press **Enter** to load and read a message. Pressing **q** will go back to the prior view when viewing message lists, and pressing **q** from the main window will exit Gnus. When reading a Reddit group, **a** creates a new message; in a mail group, **m** creates a new email; and **r** replies to messages in either view. - -You can also add RSS feeds to the Gnus interface and read them like mail and newsgroups. To add an RSS feed, type **G**+**R** and fill in the RSS feed's URL. You will be prompted for the title and description of the feed, which should be auto-filled from the feed. Now type **g** to check for new messages (this checks for new messages in all groups). Reading a feed is like reading Reddit groups and mail, so it uses the same keys. - -There is a _lot_ of functionality in Gnus, and there are a whole lot more key combinations. The [Gnus Reference Card][19] lists all of them for each view (on five pages in very small type). - -#### See your position with nyan-mode - -As a final note, you might notice [Nyan cat][20] at the bottom of some of my screenshots. This is [nyan-mode][21], which indicates where you are in a buffer, so it gets longer as you get closer to the bottom of a document or buffer. You can install it with the package manager and set it up with the following code in **~/.emacs.d/init.el**: - - -``` -;; Nyan Cat -(setq nyan-wavy-trail t) -(setq nyan-bar-length 20) -(nyan-mode) -``` - -### Scratching Emacs' surface - -This is just scratching the surface of all the things you can do with Emacs. It is _very_ powerful, and it is one of my go-to tools for being productive whether I'm tracking to-dos, reading and responding to mail, editing text, or chatting with my friends and co-workers. It takes a bit of getting used to, but once you do, it can become one of the most useful tools on your desktop. - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/20/1/emacs-social-track-todo-list - -作者:[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 -[b]: https://github.com/lujun9972 -[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/talk_chat_team_mobile_desktop.png?itok=d7sRtKfQ (Team communication, chat) -[2]: https://opensource.com/article/20/1/emacs-mail-calendar -[3]: https://opensource.com/sites/default/files/uploads/productivity_19-1.png (All the things with Emacs) -[4]: https://opensource.com/sites/default/files/uploads/productivity_19-2.png (Twitter in Emacs) -[5]: https://github.com/hayamiz/twittering-mode -[6]: https://github.com/hayamiz/twittering-mode#features -[7]: https://opensource.com/sites/default/files/uploads/productivity_19-3.png (todo.txt in emacs) -[8]: https://github.com/rpdillon/todotxt.el -[9]: http://todotxt.org/ -[10]: https://opensource.com/sites/default/files/uploads/productivity_19-4.png (Chatting with erc) -[11]: https://www.gnu.org/software/emacs/manual/html_mono/erc.html -[12]: https://opensource.com/article/20/1/open-source-chat-tool -[13]: https://opensource.com/sites/default/files/uploads/productivity_19-5.png (Mail, Reddit, and RSS feeds with Gnus) -[14]: https://www.gnus.org/ -[15]: https://opensource.com/article/20/1/organize-email-notmuch -[16]: https://github.com/dickmao/nnreddit -[17]: https://www.gnus.org/manual/gnus.html -[18]: https://pypi.org/project/rtv/ -[19]: https://www.gnu.org/software/emacs/refcards/pdf/gnus-refcard.pdf -[20]: http://www.nyan.cat/ -[21]: https://github.com/TeMPOraL/nyan-mode diff --git a/sources/tech/20200130 4 open source productivity tools on my wishlist.md b/sources/tech/20200130 4 open source productivity tools on my wishlist.md deleted file mode 100644 index d36f020aa3..0000000000 --- a/sources/tech/20200130 4 open source productivity tools on my wishlist.md +++ /dev/null @@ -1,76 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: ( ) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (4 open source productivity tools on my wishlist) -[#]: via: (https://opensource.com/article/20/1/open-source-productivity-tools) -[#]: author: (Kevin Sonney https://opensource.com/users/ksonney) - -4 open source productivity tools on my wishlist -====== -Find out what the open source world needs to work on in the final -article in our series on 20 ways to be more productive with open source -in 2020. -![Two diverse hands holding a globe][1] - -Last year, I brought you 19 days of new (to you) productivity tools for 2019. This year, I'm taking a different approach: building an environment that will allow you to be more productive in the new year, using tools you may or may not already be using. - -### But what about… - -When searching for productivity apps, I never find everything I want, and I almost always miss something great that my readers share with me. So, as I bring this series to a close, it's time [again][2] to talk about some of the topics I failed to cover in this year's series. - -![Desktop with Joplin, Emacs, and Firefox][3] - -#### Chatting in Vim - -I tried. I really, _really_ tried to get chat to work in Vim, but it was not to be. The one package I was able to find, [VimIRC.vim][4], never did work for me, and I tried for a few days to no avail. The other option I explored was [Irc it][5], which requires a lot more [effort to set up][6] than I could fit into my available space or time. I tried, I really did, and for the Vim users out there, I'm sorry I wasn't able to get something workable for you. - -#### Org mode - -![Org Mode in Emacs][7] - -I love [Org Mode][8], and I use it daily. I could spend several days _just_ talking about Org. It provides basic [task tracking][9]; Google [calendar][10] sync and [CalFW][11] integration; rich text documents, websites, and presentations; linking to all the things; and; and; and… - -I expect you will hear more from me about Org in 2020 because it really is pretty cool. - -#### GUI programs - -In 2019's productivity series, I shared a lot of programs with a graphical user interface (GUI), and this year almost all are command-line applications. There are some great graphical programs to help with some of the things I talked about this year—[mail][12] programs to talk to Maildir mailboxes, calendar programs to read local calendar files, [weather][13] apps, and so on. I even tried several new-to-me things to see if they would fit with the overall theme. With the exception of [twin][14], I didn't feel that there were any GUI programs that were new (to me) or notable (again, to me) to write about this year. And that brings me to… - -#### Mobile - -More and more people are using tablets (sometimes in conjunction with a laptop) as their primary device. I use my phone for most of my social media and instant messaging, and, more often than not, I use my tablet (OK, let's be honest, _tablets_) to read or browse the web. It isn't that open source mobile apps aren't out there, that's for sure, but they didn't fit with my themes this year. There is a lot going on with open source and mobile apps, and I'm watching carefully for things that can help me be more productive on my phone and tablet. - -### Your turn - -Thank you very much for reading the series this year. Please comment with what you think I missed or need to look at for 2021. And as I say on the [Productivity Alchemy][15] podcast: "Remember folks: Stay productive!" - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/20/1/open-source-productivity-tools - -作者:[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 -[b]: https://github.com/lujun9972 -[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/world_hands_diversity.png?itok=zm4EDxgE (Two diverse hands holding a globe) -[2]: https://opensource.com/article/19/1/productivity-tool-wish-list -[3]: https://opensource.com/sites/default/files/uploads/productivity_20-1.png (Desktop with Joplin, Emacs, and Firefox) -[4]: https://github.com/vim-scripts/VimIRC.vim -[5]: https://tools.suckless.org/ii/ -[6]: https://www.reddit.com/r/vim/comments/48t7ws/vim_ii_irc_client_xpost_runixporn/d0macnl/ -[7]: https://opensource.com/sites/default/files/uploads/productivity_20-2.png (Org Mode in Emacs) -[8]: https://orgmode.org/ -[9]: https://opensource.com/article/20/1/open-source-to-do-list -[10]: https://opensource.com/article/20/1/open-source-calendar -[11]: https://github.com/kiwanami/emacs-calfw -[12]: https://opensource.com/article/20/1/organize-email-notmuch -[13]: https://opensource.com/article/20/1/open-source-weather-forecast -[14]: https://github.com/cosmos72/twin -[15]: https://productivityalchemy.com diff --git a/sources/tech/20200130 Meet FuryBSD- A New Desktop BSD Distribution.md b/sources/tech/20200130 Meet FuryBSD- A New Desktop BSD Distribution.md deleted file mode 100644 index eee1d27f9c..0000000000 --- a/sources/tech/20200130 Meet FuryBSD- A New Desktop BSD Distribution.md +++ /dev/null @@ -1,94 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: ( ) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Meet FuryBSD: A New Desktop BSD Distribution) -[#]: via: (https://itsfoss.com/furybsd/) -[#]: author: (John Paul https://itsfoss.com/author/john/) - -Meet FuryBSD: A New Desktop BSD Distribution -====== - -In the last couple of months, a few new desktop BSD have been announced. There is [HyperbolaBSD which was Hyperbola GNU/Linux][1] previously. Another new entry in the [BSD][2] world is [FuryBSD][3]. - -### FuryBSD: A new BSD distribution - -![][4] - -At its heart, FuryBSD is a very simple beast. According to [the site][5], “FuryBSD is a back to basics lightweight desktop distribution based on stock FreeBSD.” It is basically FreeBSD with a desktop environment pre-configured and several apps preinstalled. The goal is to quickly get a FreeBSD-based system running on your computer. - -You might be thinking that this sounds a lot like a couple of other BSDs that are available, such as [NomadBSD][6] and [GhostBSD][7]. The major difference between those BSDs and FuryBSD is that FuryBSD is much closer to stock FreeBSD. For example, FuryBSD uses the FreeBSD installer, while others have created their own installers and utilities. - -As it states on the [site][8], “Although FuryBSD may resemble past graphical BSD projects like PC-BSD and TrueOS, FuryBSD is created by a different team and takes a different approach focusing on tight integration with FreeBSD. This keeps overhead low and maintains compatibility with upstream.” The lead dev also told me that “One key focus for FuryBSD is for it to be a small live media with a few assistive tools to test drivers for hardware.” - -Currently, you can go to the [FuryBSD homepage][3] and download either an XFCE or KDE LiveCD. A GNOME version is in the works. - -### Who’s is Behind FuryBSD? - -The lead dev behind FuryBSD is [Joe Maloney][9]. Joe has been a FreeBSD user for many years. He contributed to other BSD projects, such as PC-BSD. He also worked with Eric Turgeon, the creator of GhostBSD, to rewrite the GhostBSD LiveCD. Along the way, he picked up a better understanding of BSD and started to form an idea of how he would make a distribution on his own. - -Joe is joined by several other devs who have also spent many years in the BSD world, such as Jaron Parsons, Josh Smith, and Damian Szidiropulosz. - -### The Future for FuryBSD - -At the moment, FuryBSD is nothing more than a pre-configured FreeBSD setup. However, the devs have a [list of improvements][5] that they want to make going forward. These include: - - * A sane framework for loading, 3rd party proprietary drivers graphics, wireless - * Cleanup up the LiveCD experience a bit more to continue to make it more friendly - * Printing support out of box - * A few more default applications included to provide a complete desktop experience - * Integrated [ZFS][10] replication tools for backup and restore - * Live image persistence options - * A custom pkg repo with sane defaults - * Continuous integration for applications updates - * Quality assurance for FreeBSD on the desktop - * Tailored artwork, color scheming, and theming - * Directory services integration - * Security hardening - - - -The devs make it quite clear that any changes they make will have a lot of thought and research behind them. They don’t want to compliment a feature, only to have to remove it or change it when it breaks something. - -![FuryBSD desktop][11] - -### How You Can Help FuryBSD? - -At this moment the project is still very young. Since all projects need help to survive, I asked Joe what kind of help they were looking for. He said, “We could use help [answering questions on the forums][12], [GitHub][13] tickets, help with documentation are all needed.” He also said that if people wanted to add support for other desktop environments, pull requests are welcome. - -### Final Thoughts - -Although I have not tried it yet, I have a good feeling about FuryBSD. It sounds like the project is in capable hands. Joe Maloney has been thinking about how to make the best BSD desktop experience for over a decade. Unlike majority of Linux distros that are basically a rethemed Ubuntu, the devs behind FuryBSD know what they are doing and they are choosing quality over the fancy bells and whistles. - -What are your thoughts on this new entry into the every growing desktop BSD market? Have you tried out FuryBSD or will you give it a try? Please 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][14]. - --------------------------------------------------------------------------------- - -via: https://itsfoss.com/furybsd/ - -作者:[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://itsfoss.com/hyperbola-linux-bsd/ -[2]: https://itsfoss.com/bsd/ -[3]: https://www.furybsd.org/ -[4]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/01/fury-bsd.jpg?ssl=1 -[5]: https://www.furybsd.org/manifesto/ -[6]: https://itsfoss.com/nomadbsd/ -[7]: https://ghostbsd.org/ -[8]: https://www.furybsd.org/furybsd-video-overview-at-knoxbug/ -[9]: https://github.com/pkgdemon -[10]: https://itsfoss.com/what-is-zfs/ -[11]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/01/FuryBSDS-desktop.jpg?resize=800%2C450&ssl=1 -[12]: https://forums.furybsd.org/ -[13]: https://github.com/furybsd -[14]: https://reddit.com/r/linuxusersgroup diff --git a/sources/tech/20200203 Give an old MacBook new life with Linux.md b/sources/tech/20200203 Give an old MacBook new life with Linux.md deleted file mode 100644 index 99bddf8fab..0000000000 --- a/sources/tech/20200203 Give an old MacBook new life with Linux.md +++ /dev/null @@ -1,81 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (qianmingtian) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Give an old MacBook new life with Linux) -[#]: via: (https://opensource.com/article/20/2/macbook-linux-elementary) -[#]: author: (Don Watkins https://opensource.com/users/don-watkins) - -Give an old MacBook new life with Linux -====== -Elementary OS's latest release, Hera, is an impressive platform for -resurrecting an outdated MacBook. -![Coffee and laptop][1] - -When I installed Apple's [MacOS Mojave][2], it slowed my formerly reliable MacBook Air to a crawl. My computer, released in 2015, has 4GB RAM, an i5 processor, and a Broadcom 4360 wireless card, but Mojave proved too much for my daily driver—it made working with [GnuCash][3] impossible, and it whetted my appetite to return to Linux. I am glad I did, but I felt bad that I had this perfectly good MacBook lying around unused. - -I tried several Linux distributions on my MacBook Air, but there was always a gotcha. Sometimes it was the wireless card; another time, it was a lack of support for the touchpad. After reading some good reviews, I decided to try [Elementary OS][4] 5.0 (Juno). I [made a boot drive][5] with my USB creator and inserted it into the MacBook Air. I got to a live desktop, and the operating system recognized my Broadcom wireless chipset—I thought this just might work! - -I liked what I saw in Elementary OS; its [Pantheon][6] desktop is really great, and its look and feel are familiar to Apple users—it has a dock at the bottom of the display and icons that lead to useful applications. I liked the preview of what I could expect, so I decided to install it—and then my wireless disappeared. That was disappointing. I really liked Elementary OS, but no wireless is a non-starter. - -Fast-forward to December 2019, when I heard a review on the [Linux4Everyone][7] podcast about Elementary's latest release, v.5.1 (Hera) bringing a MacBook back to life. So, I decided to try again with Hera. I downloaded the ISO, created the bootable drive, plugged it in, and this time the operating system recognized my wireless card. I was in business! - -![MacBook Air with Hera][8] - -I was overjoyed that my very light, yet powerful MacBook Air was getting a new life with Linux. I have been exploring Elementary OS in greater detail, and I can tell you that I am impressed. - -### Elementary OS's features - -According to [Elementary's blog][9], "The newly redesigned login and lock screen greeter looks sharper, works better, and fixes many reported issues with the previous greeter including focus issues, HiDPI issues, and better localization. The new design in Hera was in response to user feedback from Juno, and enables some nice new features." - -"Nice new features" in an understatement—Elementary OS easily has one of the best-designed Linux user interfaces I have ever seen. A System Settings icon is on the dock by default; it is easy to change the settings, and soon I had the system configured to my liking. I need larger text sizes than the defaults, and the Universal Access controls are easy to use and allow me to set large text and high contrast. I can also adjust the dock with larger icons and other options. - -![Elementary OS's Settings screen][10] - -Pressing the Mac's Command key brings up a list of keyboard shortcuts, which is very helpful to new users. - -![Elementary OS's Keyboard shortcuts][11] - -Elementary OS ships with the [Epiphany][12] web browser, which I find quite easy to use. It's a bit different than Chrome, Chromium, or Firefox, but it is more than adequate. - -For security-conscious users (as we should all be), Elementary OS's Security and Privacy settings provide multiple options, including a firewall, history, locking, automatic deletion of temporary and trash files, and an on/off switch for location services. - -![Elementary OS's Privacy and Security screen][13] - -### More on Elementary OS - -Elementary OS was originally released in 2011, and its latest version, Hera, was released on December 3, 2019. [Cassidy James Blaede][14], Elementary's co-founder and CXO, is the operating system's UX architect. Cassidy loves to design and build useful, usable, and delightful digital products using open technologies. - -Elementary OS has excellent user [documentation][15], and its code (licensed under GPL 3.0) is available on [GitHub][16]. Elementary OS encourages involvement in the project, so be sure to reach out and [join the community][17]. - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/20/2/macbook-linux-elementary - -作者:[Don Watkins][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/don-watkins -[b]: https://github.com/lujun9972 -[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/coffee_cafe_brew_laptop_desktop.jpg?itok=G-n1o1-o (Coffee and laptop) -[2]: https://en.wikipedia.org/wiki/MacOS_Mojave -[3]: https://www.gnucash.org/ -[4]: https://elementary.io/ -[5]: https://opensource.com/life/14/10/test-drive-linux-nothing-flash-drive -[6]: https://opensource.com/article/19/12/pantheon-linux-desktop -[7]: https://www.linux4everyone.com/20-macbook-pro-elementary-os -[8]: https://opensource.com/sites/default/files/uploads/macbookair_hera.png (MacBook Air with Hera) -[9]: https://blog.elementary.io/introducing-elementary-os-5-1-hera/ -[10]: https://opensource.com/sites/default/files/uploads/elementaryos_settings.png (Elementary OS's Settings screen) -[11]: https://opensource.com/sites/default/files/uploads/elementaryos_keyboardshortcuts.png (Elementary OS's Keyboard shortcuts) -[12]: https://en.wikipedia.org/wiki/GNOME_Web -[13]: https://opensource.com/sites/default/files/uploads/elementaryos_privacy-security.png (Elementary OS's Privacy and Security screen) -[14]: https://github.com/cassidyjames -[15]: https://elementary.io/docs/learning-the-basics#learning-the-basics -[16]: https://github.com/elementary -[17]: https://elementary.io/get-involved diff --git a/sources/tech/20200203 Troubleshoot Kubernetes with the power of tmux and kubectl.md b/sources/tech/20200203 Troubleshoot Kubernetes with the power of tmux and kubectl.md deleted file mode 100644 index b9480960e6..0000000000 --- a/sources/tech/20200203 Troubleshoot Kubernetes with the power of tmux and kubectl.md +++ /dev/null @@ -1,169 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: ( guevaraya) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Troubleshoot Kubernetes with the power of tmux and kubectl) -[#]: via: (https://opensource.com/article/20/2/kubernetes-tmux-kubectl) -[#]: author: (Abhishek Tamrakar https://opensource.com/users/tamrakar) - -Troubleshoot Kubernetes with the power of tmux and kubectl -====== -A kubectl plugin that uses tmux to make troubleshooting Kubernetes much -simpler. -![Woman sitting in front of her laptop][1] - -[Kubernetes][2] is a thriving open source container orchestration platform that offers scalability, high availability, robustness, and resiliency for applications. One of its many features is support for running custom scripts or binaries through its primary client binary, [kubectl][3]. Kubectl is very powerful and allows users to do anything with it that they could do directly on a Kubernetes cluster. - -### Troubleshooting Kubernetes with aliases - -Anyone who uses Kubernetes for container orchestration is aware of its features—as well as the complexity it brings because of its design. For example, there is an urgent need to simplify troubleshooting in Kubernetes with something that is quicker and has little need for manual intervention (except in critical situations). - -There are many scenarios to consider when it comes to troubleshooting functionality. In one scenario, you know what you need to run, but the command's syntax—even when it can run as a single command—is excessively complex, or it may need one or two inputs to work. - -For example, if you frequently need to jump into a running container in the System namespace, you may find yourself repeatedly writing: - - -``` -`kubectl --namespace=kube-system exec -i -t ` -``` - -To simplify troubleshooting, you could use command-line aliases of these commands. For example, you could add the following to your dotfiles (.bashrc or .zshrc): - - -``` -`alias ksysex='kubectl --namespace=kube-system exec -i -t'` -``` - -This is one of many examples from a [repository of common Kubernetes aliases][4] that shows one way to simplify functions in kubectl. For something simple like this scenario, an alias is sufficient. - -### Switching to a kubectl plugin - -A more complex troubleshooting scenario involves the need to run many commands, one after the other, to investigate an environment and come to a conclusion. Aliases alone are not sufficient for this use - -case; you need repeatable logic and correlations between the many parts of your Kubernetes deployment. What you really need is automation to deliver the desired output in less time. - -Consider 10 to 20—or even 50 to 100—namespaces holding different microservices on your cluster. What would be helpful for you to start troubleshooting this scenario? - - * You would need something that can quickly tell which pod in which namespace is throwing errors. - * You would need something that can watch logs of all the pods in a namespace. - * You might also need to watch logs of certain pods in a specific namespace that have shown errors. - - - -Any solution that covers these points would be very useful in investigating production issues as well as during development and testing cycles. - -To create something more powerful than a simple alias, you can use [kubectl plugins][5]. Plugins are like standalone scripts written in any scripting language but are designed to extend the functionality of your main command when serving as a Kubernetes admin. - -To create a plugin, you must use the proper syntax of **kubectl-<your-plugin-name>** to copy the script to one of the exported pathways in your **$PATH** and give it executable permissions (**chmod +x**). - -After creating a plugin and moving it into your path, you can run it immediately. For example, I have kubectl-krawl and kubectl-kmux in my path: - - -``` -$ kubectl plugin list -The following compatible plugins are available: - -/usr/local/bin/kubectl-krawl -/usr/local/bin/kubectl-kmux - -$ kubectl kmux -``` - -Now let's explore what this looks like when you power Kubernetes with tmux. - -### Harnessing the power of tmux - -[Tmux][6] is a very powerful tool that many sysadmins and ops teams rely on to troubleshoot issues related to ease of operability—from splitting windows into panes for running parallel debugging on multiple machines to monitoring logs. One of its major advantages is that it can be used on the command line or in automation scripts. - -I created [a kubectl plugin][7] that uses tmux to make troubleshooting much simpler. I will use annotations to walk through the logic behind the plugin (and leave it for you to go through the plugin's full code): - - -``` -#NAMESPACE is namespace to monitor. -#POD is pod name -#Containers is container names - -# initialize a counter n to count the number of loop counts, later be used by tmux to split panes. -n=0; - -# start a loop on a list of pod and containers -while IFS=' ' read -r POD CONTAINERS -do - -           # tmux create the new window for each pod -            tmux neww $COMMAND -n $POD 2>/dev/null - -           # start a loop for all containers inside a running pod -        for CONTAINER in ${CONTAINERS//,/ } -        do - -        if [ x$POD = x -o x$CONTAINER = x ]; then -        # if any of the values is null, exit. -        warn "Looks like there is a problem getting pods data." -        break -        fi -            -            # set the command to execute -        COMMAND=”kubectl logs -f $POD -c $CONTAINER -n $NAMESPACE” -        # check tmux session -        if tmux has-session -t <session name> 2>/dev/null; -        then -        <set session exists> -        else -        <create session> -        fi - -           # split planes in the current window for each containers -        tmux selectp -t $n \; \ -        splitw $COMMAND \; \ -        select-layout tiled \; - -           # end loop for containers -        done - -           # rename the window to identify by pod name -        tmux renamew $POD 2>/dev/null -        -            # increment the counter -        ((n+=1)) - -# end loop for pods -done< <(<fetch list of pod and containers from kubernetes cluster>) - -# finally select the window and attach session - tmux selectw -t <session name>:1 \; \ -  attach-session -t <session name>\; -``` - -After the plugin script runs, it will produce output similar to the image below. Each pod has its own window, and each container (if there is more than one) is split by the panes in its pod window, streaming logs as they arrive. The beauty of tmux can be seen below; with the proper configuration, you can even see which window has activity going on (see the white tabs). - -![Output of kmux plugin][8] - -### Conclusion - -Aliases are always helpful for simple troubleshooting in Kubernetes environments. When the environment gets more complex, a kubectl plugin is a powerful option for using more advanced scripting. There are no limits on which programming language you can use to write kubectl plugins. The only requirements are that the naming convention in the path is executable, and it doesn't have the same name as an existing kubectl command. - -To read the complete code or try the plugins I created, check my [kube-plugins-github][7] repository. Issues and pull requests are welcome. - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/20/2/kubernetes-tmux-kubectl - -作者:[Abhishek Tamrakar][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/tamrakar -[b]: https://github.com/lujun9972 -[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/OSDC_women_computing_4.png?itok=VGZO8CxT (Woman sitting in front of her laptop) -[2]: https://opensource.com/resources/what-is-kubernetes -[3]: https://kubernetes.io/docs/reference/kubectl/overview/ -[4]: https://github.com/ahmetb/kubectl-aliases/blob/master/.kubectl_aliases -[5]: https://kubernetes.io/docs/tasks/extend-kubectl/kubectl-plugins/ -[6]: https://opensource.com/article/19/6/tmux-terminal-joy -[7]: https://github.com/abhiTamrakar/kube-plugins -[8]: https://opensource.com/sites/default/files/uploads/kmux-output.png (Output of kmux plugin) diff --git a/sources/tech/20200204 DevOps vs Agile- What-s the difference.md b/sources/tech/20200204 DevOps vs Agile- What-s the difference.md deleted file mode 100644 index ec49c22c92..0000000000 --- a/sources/tech/20200204 DevOps vs Agile- What-s the difference.md +++ /dev/null @@ -1,170 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: ( ) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (DevOps vs Agile: What's the difference?) -[#]: via: (https://opensource.com/article/20/2/devops-vs-agile) -[#]: author: (Taz Brown https://opensource.com/users/heronthecli) - -DevOps vs Agile: What's the difference? -====== -The difference between the two is what happens after development. -![Pair programming][1] - -Early on, software development didn't really fit under a particular management umbrella. Then along came [waterfall][2], which spoke to the idea that software development could be defined by the length of time an application took to create or build. - -Back then, it often took long periods of time to create, test, and deploy software because there were no checks and balances during the development process. The results were poor software quality with defects and bugs and unmet timelines. The focus was on long, drawn-out plans for software projects. - -Waterfall projects have been associated with the [triple constraint][3] model, which is also called the project management triangle. Each side of the triangle represents a component of the triple constraints of project management: **scope**, **time**, and **cost**. As [Angelo Baretta writes][4], the triple constraint model "says that cost is a function of time and scope, that these three factors are related in a defined and predictable way… [I]f we want to shorten the schedule (time), we must increase cost. It says that if we want to increase scope, we must increase cost or schedule." - -### Transitioning from waterfall to agile - -Waterfall came from manufacturing and engineering, where a linear process makes sense; you build the wall before you build the roof. Similarly, software development problems were viewed as something that could be solved with planning. From beginning to end, the development process was clearly defined by a roadmap that would lead to the final delivery of a product. - -Eventually, waterfall was recognized as detrimental and counterintuitive to software development because, often, the value could not be determined until the very end of the project cycle, and in many cases, the projects failed. Also, the customer didn't get to see any working software until the end of the project. - -Agile takes a different approach that moves away from planning the entire project, committing to estimated dates, and being accountable to a plan. Rather, agile assumes and embraces uncertainty. It is built around the idea of responding to change instead of charging past it or ignoring the need for it. Instead, change is considered as a way to fulfill the needs of the customer. - -### Agile values - -Agile is governed by the Agile Manifesto, which defines [12 principles][5]: - - 1. Satisfying the customer is the top priority - 2. Welcome changing requirements, even late in development - 3. Deliver working software frequently - 4. Development and business must work together - 5. Build projects around motivated people - 6. Face-to-face communication is the most efficient and effective method of conveying information - 7. The primary measure of success is working software - 8. Agile processes promote sustainable development - 9. Maintain continuous attention to technical excellence and good design - 10. Simplicity is essential - 11. The best architectures, requirements, and designs emerge from self-organizing teams - 12. Regularly reflect on work, then tune and adjust behavior - - - -Agile's four [core values][6] are: - - * **Individuals and interactions** over processes and tools - * **Working software** over comprehensive documentation - * **Customer collaboration** over contract negotiation - * **Responding to change** over following a plan - - - -This contrasts with waterfall's rigid planning style. In agile, the customer is a member of the development team rather than engaging only at the beginning, when setting business requirements, and at the end, when reviewing the final product (as in waterfall). The customer helps the team write the [acceptance criteria][7] and remains engaged throughout the process. In addition, agile requires changes and continuous improvement throughout the organization. The development team works with other teams, including the project management office and the testers. What gets done and when are led by a designated role and agreed to by the team as a whole. - -### Agile software development - -Agile software development requires adaptive planning, evolutionary development, and delivery. Many software development methodologies, frameworks, and practices fall under the umbrella of being agile, including: - - * Scrum - * Kanban (visual workflow) - * XP (eXtreme Programming) - * Lean - * DevOps - * Feature-driven development (FDD) - * Test-driven development (TDD) - * Crystal - * Dynamic systems development method (DSDM) - * Adaptive software development (ASD) - - - -All of these have been used on their own or in combination for developing and deploying software. The most common are [scrum, kanban][8] (or the combination called scrumban), and DevOps. - -[Scrum][9] is a framework under which a team, generally consisting of a scrum master, product owner, and developers, operates cross-functionally and in a self-directed manner to increase the speed of software delivery and - -to bring greater business value to the customer. The focus is on faster iterations with smaller [increments][10]. - -[Kanban][11] is an agile framework, sometimes called a workflow management system, that helps teams visualize their work and maximize efficiency (thus being agile). Kanban is usually represented by a digital or physical board. A team's work moves across the board, for example, from not started, to in progress, testing, and finished, as it progresses. Kanban allows each team member to see the state of all work at any time. - -### DevOps values - -DevOps is a culture, a state of mind, a way that software development or infrastructure is, and a way that software and applications are built and deployed. There is no wall between development and operations; they work simultaneously and without silos. - -DevOps is based on two other practice areas: lean and agile. DevOps is not a title or role within a company; it's really a commitment that an organization or team makes to continuous delivery, deployment, and integration. According to [Gene Kim][12], author of _The Phoenix Project_ and _The Unicorn Project_, there are three "ways" that define the principles of DevOps: - - * The First Way: Principles of flow - * The Second Way: Principles of feedback - * The Third Way: Principles of continuous learning - - - -### DevOps software development - -DevOps does not happen in a vacuum; it is a flexible practice that, in its truest form, is a shared culture and mindset around software development and IT or infrastructure implementation. - -When you think of automation, cloud, microservices, you think of DevOps. In an [interview][13], _Accelerate: Building and Scaling High Performing Technology Organizations_ authors Nicole Forsgren, Jez Humble, and Gene Kim explained: - -> * Software delivery performance matters, and it has a significant impact on organizational outcomes such as profitability, market share, quality, customer satisfaction, and achieving organizational and mission goals. -> * High performers achieve levels of throughput, stability, and quality; they're not trading off to achieve these attributes. -> * You can improve your performance by implementing practices from the lean, agile, and DevOps playbooks. -> * Implementing these practices and capabilities also has an impact on your organizational culture, which in turn has an impact on both your software delivery performance and organizational performance. -> * There's still lots of work to do to understand how to improve performance. -> - - -### DevOps vs. agile - -Despite their similarities, DevOps and agile are not the same, and some argue that DevOps is better than agile. To eliminate the confusion, it's important to get down to the nuts and bolts. - -#### Similarities - - * Both are software development methodologies; there is no disputing this. - * Agile has been around for over 20 years, and DevOps came into the picture fairly recently. - * Both believe in fast software development, and their principles are based on how fast software can be developed without causing harm to the customer or operations. - - - -#### Differences - - * **The difference between the two** is what happens after development. - * Software development, testing, and deployment happen in both DevOps and agile. However, pure agile tends to stop after these three stages. In contrast, DevOps includes operations, which happen continually. Therefore, monitoring and software development are also continuous. - * In agile, separate people are responsible for developing, testing, and deploying the software. In DevOps, the DevOps engineering role is are responsible for everything; development is operations, and operations is development. - * DevOps is more associated with cost-cutting, and agile is more synonymous with lean and reducing waste, and concepts like agile project accounting and minimum viable product (MVP) are relevant. - * Agile focuses on and embodies empiricism (**adaptation**, **transparency**, and **inspection**) instead of predictive measures. - -Agile | DevOps ----|--- -Feedback from customer | Feedback from self -Smaller release cycles | Smaller release cycles, immediate feedback -Focus on speed | Focus on speed and automation -Not the best for business | Best for business - -### Wrapping up - -Agile and DevOps are distinct, although their similarities lead people to think they are one and the same. This does both agile and DevOps a disservice. - -In my experience as an agilist, I have found it valuable for organizations and teams to understand—from a high level—what agile and DevOps are and how they aid teams in working faster and more efficiently, delivering quality faster, and improving customer satisfaction. - -Agile and DevOps are not adversarial in any way (or at least the intent is not there). They are more allies than enemies in the agile revolution. Agile and DevOps can operate exclusively and inclusively, which allows both to exist in the same space. - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/20/2/devops-vs-agile - -作者:[Taz Brown][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/heronthecli -[b]: https://github.com/lujun9972 -[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/collab-team-pair-programming-code-keyboard.png?itok=kBeRTFL1 (Pair programming) -[2]: http://www.agilenutshell.com/agile_vs_waterfall -[3]: https://en.wikipedia.org/wiki/Project_management_triangle -[4]: https://www.pmi.org/learning/library/triple-constraint-erroneous-useless-value-8024 -[5]: https://agilemanifesto.org/principles.html -[6]: https://agilemanifesto.org/ -[7]: https://www.productplan.com/glossary/acceptance-criteria/ -[8]: https://opensource.com/article/19/8/scrum-vs-kanban -[9]: https://www.scrum.org/ -[10]: https://www.scrum.org/resources/what-is-an-increment -[11]: https://www.atlassian.com/agile/kanban -[12]: https://itrevolution.com/the-unicorn-project/ -[13]: https://www.infoq.com/articles/book-review-accelerate/ diff --git a/sources/tech/20200206 3 ways to use PostgreSQL commands.md b/sources/tech/20200206 3 ways to use PostgreSQL commands.md deleted file mode 100644 index 645baf65e0..0000000000 --- a/sources/tech/20200206 3 ways to use PostgreSQL commands.md +++ /dev/null @@ -1,230 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (Morisun029) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (3 ways to use PostgreSQL commands) -[#]: via: (https://opensource.com/article/20/2/postgresql-commands) -[#]: author: (Greg Pittman https://opensource.com/users/greg-p) - -3 ways to use PostgreSQL commands -====== -Whether you need something simple, like a shopping list, or complex, -like a color swatch generator, PostgreSQL commands make it easy. -![Team checklist and to dos][1] - -In _[Getting started with PostgreSQL][2]_, I explained how to install, set up, and begin using the open source database software. But there's a lot more you can do with commands in [PostgreSQL][3]. - -For example, I use Postgres to keep track of my grocery shopping list. I do most of the grocery shopping in our home, and the bulk of it happens once a week. I go to several places to buy the things on my list because each store offers a particular selection or quality or maybe a better price. Initially, I made an HTML form page to manage my shopping list, but it couldn't save my entries. So, I had to wait to make my list all at once, and by then I usually forgot some items we need or I want. - -Instead, with PostgreSQL, I can enter bits when I think of them as the week goes on and print out the whole thing right before I go shopping. Here's how you can do that, too. - -### Create a simple shopping list - -First, enter the database with the **psql **command, then create a table for your list with: - - -``` -`Create table groc (item varchar(20), comment varchar(10));` -``` - -Type commands like the following to add items to your list: - - -``` -insert into groc values ('milk', 'K'); -insert into groc values ('bananas', 'KW'); -``` - -There are two pieces of information (separated by a comma) inside the parentheses: the item you want to buy and letters indicating where you want to buy it and whether it's something you usually buy every week (W). - -Since **psql** has a history, you can press the Up arrow and edit the data between the parentheses instead of having to type the whole line for each item. - -After entering a handful of items, check what you've entered with: - - -``` -Select * from groc order by comment; - -      item      | comment -\----------------+--------- - ground coffee  | H - butter         | K - chips          | K - steak          | K - milk           | K - bananas        | KW - raisin bran    | KW - raclette       | L - goat cheese    | L - onion          | P - oranges        | P - potatoes       | P - spinach        | PW - broccoli       | PW - asparagus      | PW - cucumber       | PW - sugarsnap peas | PW - salmon         | S -(18 rows) -``` - -This command orders the results by the _comment_ column so that the items are grouped by where you buy them to make it easier to shop. - -By using a W to indicate your weekly purchases, you can keep your weekly items on the list when you clear out the table to prepare for the next week's list. To so that, enter: - - -``` -`delete from groc where comment not like '%W';` -``` - -Notice that in PostgreSQL, **%** is the wildcard character (instead of an asterisk). So, to save typing, you might type: - - -``` -`delete from groc where item like 'goat%';` -``` - -You can't use **item = 'goat%'**; it won't work. - -When you're ready to shop, output your list to print it or send it to your phone with: - - -``` -\o groclist.txt -select * from groc order by comment; -\o -``` - -The last command, **\o**, with nothing afterward, resets the output to the command line. Otherwise, all output will continue to go to the groc file you created. - -### Analyze complex tables - -This item-by-item entry may be okay for short tables, but what about really big ones? A couple of years ago, I was helping the team at [FreieFarbe.de][4] to create a swatchbook of the free colors (freieFarbe means "free colors" in German) from its HLC color palette, where virtually any imaginable print color can be specified by its hue, luminosity (brightness), and chroma (saturation). The result was the [HLC Color Atlas][5], and here's how we did it. - -The team sent me files with color specifications so I could write Python scripts that would work with Scribus to generate the swatchbooks of color patches easily. One example started like: - - -``` -HLC, C, M, Y, K -H010_L15_C010, 0.5, 49.1, 0.1, 84.5 -H010_L15_C020, 0.0, 79.7, 15.1, 78.9 -H010_L25_C010, 6.1, 38.3, 0.0, 72.5 -H010_L25_C020, 0.0, 61.8, 10.6, 67.9 -H010_L25_C030, 0.0, 79.5, 18.5, 62.7 -H010_L25_C040, 0.4, 94.2, 17.3, 56.5 -H010_L25_C050, 0.0, 100.0, 15.1, 50.6 -H010_L35_C010, 6.1, 32.1, 0.0, 61.8 -H010_L35_C020, 0.0, 51.7, 8.4, 57.5 -H010_L35_C030, 0.0, 68.5, 17.1, 52.5 -H010_L35_C040, 0.0, 81.2, 22.0, 46.2 -H010_L35_C050, 0.0, 91.9, 20.4, 39.3 -H010_L35_C060, 0.1, 100.0, 17.3, 31.5 -H010_L45_C010, 4.3, 27.4, 0.1, 51.3 -``` - -This is slightly modified from the original, which separated the data with tabs. I transformed it into a CSV (comma-separated value) file, which I prefer to use with Python. (CSV files are also very useful because they can be imported easily into a spreadsheet program.) - -In each line, the first item is the color name, and it's followed by its C, M, Y, and K color values. The file consisted of 1,793 colors, and I wanted a way to analyze the information to get a sense of the range of values. This is where PostgreSQL comes into play. I did not want to enter all of this data manually—I don't think I could without errors (and headaches). Fortunately, PostgreSQL has a command for this. - -My first step was to create the database with: - - -``` -`Create table hlc_cmyk (color varchar(40), c decimal, m decimal, y decimal, k decimal);` -``` - -Then I brought in the data with: - - -``` -`\copy  hlc_cmyk from '/home/gregp/HLC_Atlas_CMYK_SampleData.csv' with (header, format CSV);` -``` - -The backslash at the beginning is there because using the plain **copy** command is restricted to root and the Postgres superuser. In the parentheses, **header** means the first line contains headings and should be ignored, and **CSV** means the file format is CSV. Note that parentheses are not required around the color name in this method. - -If the operation is successful, I see a message that says **COPY NNNN**, where the N's refer to the number of rows inserted into the table. - -Finally, I can query the table with: - - -``` -select * from hlc_cmyk; - -     color     |   c   |   m   |   y   |  k   -\---------------+-------+-------+-------+------ - H010_L15_C010 |   0.5 |  49.1 |   0.1 | 84.5 - H010_L15_C020 |   0.0 |  79.7 |  15.1 | 78.9 - H010_L25_C010 |   6.1 |  38.3 |   0.0 | 72.5 - H010_L25_C020 |   0.0 |  61.8 |  10.6 | 67.9 - H010_L25_C030 |   0.0 |  79.5 |  18.5 | 62.7 - H010_L25_C040 |   0.4 |  94.2 |  17.3 | 56.5 - H010_L25_C050 |   0.0 | 100.0 |  15.1 | 50.6 - H010_L35_C010 |   6.1 |  32.1 |   0.0 | 61.8 - H010_L35_C020 |   0.0 |  51.7 |   8.4 | 57.5 - H010_L35_C030 |   0.0 |  68.5 |  17.1 | 52.5 -``` - -It goes on like this for all 1,793 rows of data. In retrospect, I can't say that this query was absolutely necessary for the HLC and Scribus task, but it allayed some of my anxieties about the project. - -To generate the HLC Color Atlas, I automated creating the color charts with Scribus for the 13,000+ colors in those pages of color swatches. - -I could have used the **copy** command to output my data: - - -``` -`\copy hlc_cmyk to '/home/gregp/hlc_cmyk_backup.csv' with (header, format CSV);` -``` - -I also could restrict the output according to certain values with a **where** clause. - -For example, the following command will only send the table values for the hues that begin with H10. - - -``` -`\copy hlc_cmyk to '/home/gregp/hlc_cmyk_backup.csv' with (header, format CSV) where color like 'H10%';` -``` - -### Back up or transfer a database or table - -The final command I will mention here is **pg_dump**, which is used to back up a PostgreSQL database and runs outside of the **psql** console. For example: - - -``` -pg_dump gregp -t hlc_cmyk > hlc.out -pg_dump gregp > dball.out -``` - -The first line exports the **hlc_cmyk** table along with its structure. The second line dumps all the tables inside the **gregp** database. This is very useful for backing up or transferring a database or tables.  - -To transfer a database or table to another computer, first, create a database on the other computer (see my "[getting started][2]" article for details), then do the reverse process: - - -``` -`psql -d gregp -f dball.out` -``` - -This creates all the tables and enters the data in one step. - -### Conclusion - -In this article, we have seen how to use the **WHERE** parameter to restrict operations, along with the use of the PostgreSQL wildcard character **%**. We've also seen how to load a large amount of data into a table, then output some or all of the table data to a file, or even your entire database with all its individual tables. - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/20/2/postgresql-commands - -作者:[Greg Pittman][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/greg-p -[b]: https://github.com/lujun9972 -[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/todo_checklist_team_metrics_report.png?itok=oB5uQbzf (Team checklist and to dos) -[2]: https://opensource.com/article/19/11/getting-started-postgresql -[3]: https://www.postgresql.org/ -[4]: http://freiefarbe.de -[5]: https://www.freiefarbe.de/en/thema-farbe/hlc-colour-atlas/ diff --git a/sources/tech/20200207 Customize your internet with an open source search engine.md b/sources/tech/20200207 Customize your internet with an open source search engine.md deleted file mode 100644 index 7974fdbfa8..0000000000 --- a/sources/tech/20200207 Customize your internet with an open source search engine.md +++ /dev/null @@ -1,118 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: ( ) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Customize your internet with an open source search engine) -[#]: via: (https://opensource.com/article/20/2/open-source-search-engine) -[#]: author: (Seth Kenlon https://opensource.com/users/seth) - -Customize your internet with an open source search engine -====== -Get started with YaCy, an open source, P2P web indexer. -![Person using a laptop][1] - -A long time ago, the internet was small enough to be indexed by a few people who gathered the names and locations of all websites and listed them each by topic on a page or in a printed book. As the World Wide Web network grew, the "web rings" convention developed, in which sites with a similar theme or topic or sensibility banded together to form a circular path to each member. A visitor to any site in the ring could click a button to proceed to the next or previous site in the ring to discover new sites relevant to their interest. - -Then for a while, it seemed the internet outgrew itself. Everyone was online, there was a lot of redundancy and spam, and there was no way to find anything. Yahoo and AOL and CompuServe and similar services had unique approaches, but it wasn't until Google came along that the modern model took hold. According to Google, the internet was meant to be indexed, sorted, and ranked through a search engine. - -### Why choose an open source alternative? - -Search engines like Google and DuckDuckGo are demonstrably effective. You may have reached this site through a search engine. While there's a debate to be had about content falling through the cracks because a host chooses not to follow best practices for search engine optimization, the modern solution for managing the wealth of culture and knowledge and frivolity that is the internet is relentless indexing. - -But maybe you prefer not to use Google or DuckDuckGo because of privacy concerns or because you're looking to contribute to an effort to make the internet more independent. If that appeals to you, then consider participating in [YaCy][2], the peer-to-peer internet indexer and search engine. - -### Install YaCy - -To install and try YaCy, first ensure you have Java installed. If you're on Linux, you can follow the instructions in my [_How to install Java on Linux_][3] article. If you're on Windows or MacOS, obtain an installer from [AdoptOpenJDK.net][4]. - -Once you have Java installed, [download the installer][5] for your platform. - -If you're on Linux, unarchive the tarball and move it to the **/opt** directory: - - -``` -`$ sudo tar --extract --file  yacy_*z --directory /opt` -``` - -Start YaCy according to instructions for the installer you downloaded. - -On Linux, start YaCy running in the background: - - -``` -`$ /opt/startYACY.sh &` -``` - -In a web browser, navigate to **localhost:8090** and search. - -![YaCy start page][6] - -### Add YaCy to your URL bar - -If you're using the Firefox web browser, you can make YaCy your default search engine in the Awesome Bar (that's Mozilla's name for the URL field) with just a few clicks. - -First, make the dedicated search bar visible in the Firefox toolbar, if it's not already (you don't have to keep the search bar visible; you only need it active long enough to add a custom search engine). The search bar is available in the hamburger menu in the upper-right corner of Firefox in the **Customize** menu. Once the search bar is visible in your Firefox toolbar, navigate to **localhost:8090**, and click the magnifying glass icon in the Firefox search bar you just added. Click the option to add YaCy to your Firefox search engines. - -![Adding YaCy to Firefox][7] - -Once this is done, you can mark it as your default in Firefox preferences, or just use it selectively in searches performed in the Firefox search bar. If you set it as your default search engine, then you may have no need for the dedicated search bar because the default engine is also used by the Awesome Bar, so you can remove it from your toolbar. - -### How to a P2P search engine works - -YaCy is an open source and distributed search engine. It's written in [Java][8], so it runs on any platform, and it performs web crawls, indexing, and searching. It's a peer-to-peer (P2P) network, so every user running YaCy joins in the effort to track the internet as it changes from day to day. Of course, no single user possesses a full index of the entire internet because that would take a data center to house, but the index is distributed and redundant across all YaCy users. It's a lot like BitTorrent (as it uses distributed hash tables, or DHT, to reference index entries), except the data you're sharing is a matrix of words and URL associations. By mixing the results returned by the hash tables, no one can tell who has searched for what words, so all searches are functionally anonymous. It's an effective system for unbiased, ad-free, untracked, and anonymous searches, and you can join in just by using it. - -### Search engines and algorithms - -The act of indexing the internet refers to separating a web page into the singular words on it, then associating the page's URL with each word. Searching for one or more words in a search engine fetches all URLs associated with the query. That's one thing the YaCy client does while running. - -The other thing the client does is provide a search interface for your browser. Instead of navigating to Google when you want to search, you can point your web browser to **localhost:8090** to search YaCy. You may even be able to add it to your browser's search bar (depending on your browser's extensibility), so you can search from the URL bar. - -### Firewall settings for YaCy - -When you first start using YaCy, it's probably running in "junior" mode. This means that the sites your client crawls are available only to you because no other YaCy client can reach your index entries. To join the P2P experience, you must open port 8090 in your router's firewall and possibly your software firewall if you're running one. This is called "senior" mode. - -If you're on Linux, you can find out more about your computer's firewall in [_Make Linux stronger with firewalls_][9]. On other platforms, refer to your operating system's documentation. - -A firewall is almost always active on the router provided by your internet service provider (ISP), and there are far too many varieties of them to document accurately here. Most routers provide the option to "poke a hole" in your firewall because many popular networked games require two-way traffic. - -If you know how to log into your router (it's often either 192.168.0.1 or 10.1.0.1, but can vary depending on the manufacturer's settings), then log in and look for a configuration panel controlling the _firewall_ or _port forwarding_ or _applications_. - -Once you find the preferences for your router's firewall, add port 8090 to the whitelist. For example: - -![Adding YaCy to an ISP router][10] - -If your router is doing port forwarding, then you must forward the incoming traffic to your computer's IP address, using the same port. For example: - -![Adding YaCy to an ISP router][11] - -If you can't adjust your firewall settings for any reason, that's OK. YaCy will continue to run and operate as a client of the P2P search network in junior mode. - -### An internet of your own - -There's much more you can do with the YaCy search engine than just search passively. You can force crawls of underrepresented websites, you can request the network crawl a site, you can choose to use YaCy for just on-premises searches, and much more. You have better control over what _your_ internet looks like. The more senior users there are, the more sites indexed. The more sites indexed, the better the experience for all users. Join in! - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/20/2/open-source-search-engine - -作者:[Seth Kenlon][a] -选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]: https://opensource.com/users/seth -[b]: https://github.com/lujun9972 -[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/laptop_screen_desk_work_chat_text.png?itok=UXqIDRDD (Person using a laptop) -[2]: https://yacy.net/ -[3]: https://opensource.com/article/19/11/install-java-linux -[4]: https://adoptopenjdk.net/releases.html -[5]: https://yacy.net/download_installation/ -[6]: https://opensource.com/sites/default/files/uploads/yacy-startpage.jpg (YaCy start page) -[7]: https://opensource.com/sites/default/files/uploads/yacy-add-firefox.jpg (Adding YaCy to Firefox) -[8]: https://opensource.com/resources/java -[9]: https://opensource.com/article/19/7/make-linux-stronger-firewalls -[10]: https://opensource.com/sites/default/files/uploads/router-add-app.jpg (Adding YaCy to an ISP router) -[11]: https://opensource.com/sites/default/files/uploads/router-add-app1.jpg (Adding YaCy to an ISP router) diff --git a/sources/tech/20200207 NVIDIA-s Cloud Gaming Service GeForce NOW Shamelessly Ignores Linux.md b/sources/tech/20200207 NVIDIA-s Cloud Gaming Service GeForce NOW Shamelessly Ignores Linux.md deleted file mode 100644 index c225522379..0000000000 --- a/sources/tech/20200207 NVIDIA-s Cloud Gaming Service GeForce NOW Shamelessly Ignores Linux.md +++ /dev/null @@ -1,82 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (geekpi) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (NVIDIA’s Cloud Gaming Service GeForce NOW Shamelessly Ignores Linux) -[#]: via: (https://itsfoss.com/geforce-now-linux/) -[#]: author: (Ankush Das https://itsfoss.com/author/ankush/) - -NVIDIA’s Cloud Gaming Service GeForce NOW Shamelessly Ignores Linux -====== - -NVIDIA’s [GeForce NOW][1] cloud gaming service is something promising for gamers who probably don’t have the hardware but want to experience the latest and greatest games with the best possible experience using GeForce NOW (stream the game online and play it on any device you want). - -The service was limited to a few users (in the form of the waitlist) to access. However, recently, they announced that [GeForce NOW is open to all][2]. But, it really isn’t. - -Interestingly, it’s **not available for all the regions** across the globe. And, worse- **GeForce NOW does not support Linux**. - -![][3] - -### GeForce NOW is Not ‘Open For All’ - -The whole point of making a subscription-based cloud service to play games is to eliminate platform dependence. - -Just like you would normally visit a website using a web browser – you should be able to stream a game on every platform. That’s the concept, right? - -![][4] - -Well, that’s definitely not rocket science – but NVIDIA still missed supporting Linux (and iOS)? - -### Is it because no one uses Linux? - -I would strongly disagree with this – even if it’s the reason for some to not support Linux. If that was the case, I wouldn’t be writing for It’s FOSS while using Linux as my primary desktop OS. - -Not just that – why do you think a Twitter user mentioned the lack of support for Linux if it wasn’t a thing? - -![][5] - -Yes, maybe the userbase isn’t large enough but while considering this as a cloud-based service – it doesn’t make sense to **not support Linux**. - -Technically, if no one games on Linux, **Valve** wouldn’t have noticed Linux as a platform to improve [Steam Play][6] to help more users play Windows-only games on Linux. - -I don’t want to claim anything that’s not true – but the desktop Linux scene is evolving faster than ever for gaming (even if the stats are low when compared to Windows and Mac). - -### Cloud gaming isn’t supposed to work like this - -![][7] - -As I mentioned above, it isn’t tough to find Linux gamers using Steam Play. It’s just that you’ll find the overall “market share” of gamers on Linux to be less than its counterparts. - -Even though that’s a fact – cloud gaming isn’t supposed to depend on a specific platform. And, considering that the GeForce NOW is essentially a browser-based streaming service to play games, it shouldn’t be tough for a big shot like NVIDIA to support Linux. - -Come on, team green – _you want us to believe that supporting Linux is technically tough_? Or, you just want to say that i_t’s not worth supporting the Linux platform_? - -**Wrapping Up** - -No matter how excited I was for the GeForce NOW service to launch – it was very disappointing to see that it does not support Linux at all. - -If cloud gaming services like GeForce NOW start supporting Linux in the near future – **you probably won’t need a reason to use Windows** (*coughs*). - -What do you think about it? Let me know your thoughts in the comments below. - --------------------------------------------------------------------------------- - -via: https://itsfoss.com/geforce-now-linux/ - -作者:[Ankush Das][a] -选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]: https://itsfoss.com/author/ankush/ -[b]: https://github.com/lujun9972 -[1]: https://www.nvidia.com/en-us/geforce-now/ -[2]: https://blogs.nvidia.com/blog/2020/02/04/geforce-now-pc-gaming/ -[3]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/02/nvidia-geforce-now-linux.jpg?ssl=1 -[4]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/02/nvidia-geforce-now.png?ssl=1 -[5]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/02/geforce-now-twitter-1.jpg?ssl=1 -[6]: https://itsfoss.com/steam-play/ -[7]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/02/ge-force-now.jpg?ssl=1 diff --git a/sources/tech/20200207 What is WireGuard- Why Linux Users Going Crazy Over it.md b/sources/tech/20200207 What is WireGuard- Why Linux Users Going Crazy Over it.md deleted file mode 100644 index f80298dbb7..0000000000 --- a/sources/tech/20200207 What is WireGuard- Why Linux Users Going Crazy Over it.md +++ /dev/null @@ -1,98 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: ( ) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (What is WireGuard? Why Linux Users Going Crazy Over it?) -[#]: via: (https://itsfoss.com/wireguard/) -[#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/) - -What is WireGuard? Why Linux Users Going Crazy Over it? -====== - -From normal Linux users to Linux creator [Linus Torvalds][1], everyone is in awe of WireGuard. What is WireGuard and what makes it so special? - -### What is WireGuard? - -![][2] - -[WireGuard][3] is an easy to configure, fast, and secure open source [VPN][4] that utilizes state-of-the-art cryptography. It’s aim is to provide a faster, simpler and leaner general purpose VPN that can be easily deployed on low-end devices like Raspberry Pi to high-end servers. - -Most of the other solutions like [IPsec][5] and OpenVPN were developed decades ago. Security researcher and kernel developer Jason Donenfeld realized that they were slow and difficult to configure and manage properly. - -This made him create a new open source VPN protocol and solution which is faster, secure easier to deploy and manage. - -WireGuard was originally developed for Linux but it is now available for Windows, macOS, BSD, iOS and Android. It is still under heavy development. - -### Why is WireGuard so popular? - -![][6] - -Apart from being a cross-platform, one of the biggest plus point for WireGuard is the ease of deployment. Configuring and deploying WireGuard is as easy as configuring and using SSH. - -Look at [WireGuard set up guide][7]. You install WireGuard, generate public and private keys (like SSH), set up firewall rules and start the service. Now compare it to the [OpenVPN set up guide][8]. There are way too many things to do here. - -Another good thing about WireGuard is that it has a lean codebase with just 4000 lines of code. Compare it to 100,000 lines of code of [OpenVPN][9] (another popular open source VPN). It is clearly easier to debug WireGuard. - -Don’t go by its simplicity. WireGuard supports all the state-of-the-art cryptography like like the [Noise protocol framework][10], [Curve25519][11], [ChaCha20][12], [Poly1305][13], [BLAKE2][14], [SipHash24][15], [HKDF][16], and secure trusted constructions. - -Since WireGuard runs in the [kernel space][17], it provides secure networking at a high speed. - -These are some of the reasons why WireGuard has become increasingly popular. Linux creator Linus Torvalds loves WireGuard so much that he is merging it in the [Linux Kernel 5.6][18]: - -> Can I just once again state my love for it and hope it gets merged soon? Maybe the code isn’t perfect, but I’ve skimmed it, and compared to the horrors that are OpenVPN and IPSec, it’s a work of art. -> -> Linus Torvalds - -### If WireGuard is already available, then what’s the fuss about including it in Linux kernel? - -This could be confusing to new Linux users. You know that you can install and configure a WireGuard VPN server on Linux but then you also read the news that Linux Kernel 5.6 is going to include WireGuard. Let me explain it to you. - -At present, you can install WireGuard on Linux as a [kernel module][19]. Regular applications like VLC, GIMP etc are installed on top of the Linux kernel (in [user space][20]), not inside it. - -When you install WireGuard as a kernel module, you are basically modifying the Linux kernel on your own and add some code to it. Starting kernel 5.6, you won’t need manually add the kernel module. It will be included in the kernel by default. - -The inclusion of WireGuard in Kernel 5.6 will most likely [extend the adoption of WireGuard and thus change the current VPN scene][21]. - -**Conclusion** - -WireGuard is gaining popularity for the good reasons. Some of the popular [privacy focused VPNs][22] like [Mullvad VPN][23] are already using WireGuard and the adoption is likely to grow in the near future. - -I hope you have a slightly better understanding of WireGuard. Your feedback is welcome, as always. - --------------------------------------------------------------------------------- - -via: https://itsfoss.com/wireguard/ - -作者:[Abhishek Prakash][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/abhishek/ -[b]: https://github.com/lujun9972 -[1]: https://itsfoss.com/linus-torvalds-facts/ -[2]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/02/wireguard.png?ssl=1 -[3]: https://www.wireguard.com/ -[4]: https://en.wikipedia.org/wiki/Virtual_private_network -[5]: https://en.wikipedia.org/wiki/IPsec -[6]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/02/wireguard-logo.png?ssl=1 -[7]: https://www.linode.com/docs/networking/vpn/set-up-wireguard-vpn-on-ubuntu/ -[8]: https://www.digitalocean.com/community/tutorials/how-to-set-up-an-openvpn-server-on-ubuntu-16-04 -[9]: https://openvpn.net/ -[10]: https://noiseprotocol.org/ -[11]: https://cr.yp.to/ecdh.html -[12]: https://cr.yp.to/chacha.html -[13]: https://cr.yp.to/mac.html -[14]: https://blake2.net/ -[15]: https://131002.net/siphash/ -[16]: https://eprint.iacr.org/2010/264 -[17]: http://www.linfo.org/kernel_space.html -[18]: https://itsfoss.com/linux-kernel-5-6/ -[19]: https://wiki.archlinux.org/index.php/Kernel_module -[20]: http://www.linfo.org/user_space.html -[21]: https://www.zdnet.com/article/vpns-will-change-forever-with-the-arrival-of-wireguard-into-linux/ -[22]: https://itsfoss.com/best-vpn-linux/ -[23]: https://mullvad.net/en/ diff --git a/sources/tech/20200210 Install All Essential Media Codecs in Ubuntu With This Single Command -Beginner-s Tip.md b/sources/tech/20200210 Install All Essential Media Codecs in Ubuntu With This Single Command -Beginner-s Tip.md deleted file mode 100644 index ecbe1dabe3..0000000000 --- a/sources/tech/20200210 Install All Essential Media Codecs in Ubuntu With This Single Command -Beginner-s Tip.md +++ /dev/null @@ -1,114 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (geekpi) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Install All Essential Media Codecs in Ubuntu With This Single Command [Beginner’s Tip]) -[#]: via: (https://itsfoss.com/install-media-codecs-ubuntu/) -[#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/) - -Install All Essential Media Codecs in Ubuntu With This Single Command [Beginner’s Tip] -====== - -If you have just installed Ubuntu or some other [Ubuntu flavors][1] like Kubuntu, Lubuntu etc, you’ll notice that your system doesn’t play some audio or video file. - -For video files, you can [install VLC on Ubuntu][2]. [VLC][3] one of the [best video players for Linux][4] and can play almost any video file format. But you’ll still have troubles with audio media files and flash player. - -The good thing is that [Ubuntu][5] provides a single package to install all the essential media codecs: ubuntu-restricted-extras. - -![][6] - -### What is Ubuntu Restricted Extras? - -The ubuntu-restricted-extras is a software package that consists various essential software like flash plugin, [unrar][7], [gstreamer][8], mp4, codecs for [Chromium browser in Ubuntu][9] etc. - -Since these software are not open source and some of them involve software patents, Ubuntu doesn’t install them by default. You’ll have to use multiverse repository, the software repository specifically created by Ubuntu to provide non-open source software to its users. - -Please read this article to [learn more about various Ubuntu repositories][10]. - -### How to install Ubuntu Restricted Extras? - -I find it surprising that the software center doesn’t list Ubuntu Restricted Extras. In any case, you can install the package using command line and it’s very simple. - -Open a terminal by searching for it in the menu or using the [terminal keyboard shortcut Ctrl+Alt+T][11]. - -Since ubuntu-restrcited-extras package is available in the multiverse repository, you should verify that the multiverse repository is enabled on your system: - -``` -sudo add-apt-repository multiverse -``` - -And then you can install it in Ubuntu default edition using this command: - -``` -sudo apt install ubuntu-restricted-extras -``` - -When you enter the command, you’ll be asked to enter your password. When _**you type the password, nothing is displayed on the screen**_. That’s normal. Type your password and press enter. - -It will show a huge list of packages to be installed. Press enter to confirm your selection when it asks. - -You’ll also encounter an [EULA][12] (End User License Agreement) screen like this: - -![Press Tab key to select OK and press Enter key][13] - -It could be overwhelming to navigate this screen but don’t worry. Just press tab and it will highlight the options. When the correct options are highlighted, press enter to confirm your selection. - -![Press Tab key to highlight Yes and press Enter key][14] - -Once the process finishes, you should be able to play MP3 and other media formats thanks to newly installed media codecs. - -##### Installing restricted extra package on Kubuntu, Lubuntu, Xubuntu - -Do keep in mind that Kubuntu, Lubuntu and Xubuntu has this package available with their own respective names. They should have just used the same name but they don’t unfortunately. - -On Kubuntu, use this command: - -``` -sudo apt install kubuntu-restricted-extras -``` - -On Lubuntu, use: - -``` -sudo apt install lubuntu-restricted-extras -``` - -On Xubuntu, you should use: - -``` -sudo apt install xubuntu-restricted-extras -``` - -I always recommend getting ubuntu-restricted-extras as one of the [essential things to do after installing Ubuntu][15]. It’s good to have a single command to install multiple codecs in Ubuntu. - -I hope you like this quick tip in the Ubuntu beginner series. I’ll share more such tips in the future. - --------------------------------------------------------------------------------- - -via: https://itsfoss.com/install-media-codecs-ubuntu/ - -作者:[Abhishek Prakash][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/abhishek/ -[b]: https://github.com/lujun9972 -[1]: https://itsfoss.com/which-ubuntu-install/ -[2]: https://itsfoss.com/install-latest-vlc/ -[3]: https://www.videolan.org/index.html -[4]: https://itsfoss.com/video-players-linux/ -[5]: https://ubuntu.com/ -[6]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/02/Media_Codecs_in_Ubuntu.png?ssl=1 -[7]: https://itsfoss.com/use-rar-ubuntu-linux/ -[8]: https://gstreamer.freedesktop.org/ -[9]: https://itsfoss.com/install-chromium-ubuntu/ -[10]: https://itsfoss.com/ubuntu-repositories/ -[11]: https://itsfoss.com/ubuntu-shortcuts/ -[12]: https://en.wikipedia.org/wiki/End-user_license_agreement -[13]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/02/installing_ubuntu_restricted_extras.jpg?ssl=1 -[14]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/02/installing_ubuntu_restricted_extras_1.jpg?ssl=1 -[15]: https://itsfoss.com/things-to-do-after-installing-ubuntu-18-04/ diff --git a/sources/tech/20200210 Playing Music on your Fedora Terminal with MPD and ncmpcpp.md b/sources/tech/20200210 Playing Music on your Fedora Terminal with MPD and ncmpcpp.md deleted file mode 100644 index 72344b9f0d..0000000000 --- a/sources/tech/20200210 Playing Music on your Fedora Terminal with MPD and ncmpcpp.md +++ /dev/null @@ -1,118 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: ( ) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Playing Music on your Fedora Terminal with MPD and ncmpcpp) -[#]: via: (https://fedoramagazine.org/playing-music-on-your-fedora-terminal-with-mpd-and-ncmpcpp/) -[#]: author: (Carmine Zaccagnino https://fedoramagazine.org/author/carzacc/) - -Playing Music on your Fedora Terminal with MPD and ncmpcpp -====== - -![][1] - -MPD, as the name implies, is a Music Playing Daemon. It can play music but, being a daemon, any piece of software can interface with it and play sounds, including some CLI clients. - -One of them is called _ncmpcpp_, which is an improvement over the pre-existing _ncmpc_ tool. The name change doesn’t have much to do with the language they’re written in: they’re both C++, but _ncmpcpp_ is called that because it’s the _NCurses Music Playing Client_ _Plus Plus_. - -### Installing MPD and ncmpcpp - -The _ncmpmpcc_ client can be installed from the official Fedora repositories with DNF directly with - -``` -$ sudo dnf install ncmpcpp -``` - -On the other hand, MPD has to be installed from the RPMFusion _free_ repositories, which you can enable, [as per the official installation instructions][2], by running - -``` -$ sudo dnf install https://download1.rpmfusion.org/free/fedora/rpmfusion-free-release-$(rpm -E %fedora).noarch.rpm -``` - -and then you can install MPD by running - -``` -$ sudo dnf install mpd -``` - -### Configuring and Starting MPD - -The most painless way to set up MPD is to run it as a regular user. The default is to run it as the dedicated _mpd_ user, but that causes all sorts of issues with permissions. - -Before we can run it, we need to create a local config file that will allow it to run as a regular user. - -To do that, create a subdirectory called _mpd_ in _~/.config_: - -``` -$ mkdir ~/.config/mpd -``` - -copy the default config file into this directory: - -``` -$ cp /etc/mpd.conf ~/.config/mpd -``` - -and then edit it with a text editor like _vim_, _nano_ or _gedit_: - -``` -$ nano ~/.config/mpd/mpd.conf -``` - -I recommend you read through all of it to check if there’s anything you need to do, but for most setups you can delete everything and just leave the following: - -``` -db_file "~/.config/mpd/mpd.db" -log_file "syslog" -``` - -At this point you should be able to just run - -``` -$ mpd -``` - -with no errors, which will start the MPD daemon in the background. - -### Using ncmpcpp - -Simply run - -``` -$ ncmpcpp -``` - -and you’ll see a ncurses-powered graphical user interface in your terminal. - -Press _4_ and you should see your local music library, be able to change the selection using the arrow keys and press _Enter_ to play a song. - -Doing this multiple times will create a _playlist_, which allows you to move to the next track using the _>_ button (not the right arrow, the _>_ closing angle bracket character) and go back to the previous track with _<_. The + and – buttons increase and decrease volume. The _Q_ button quits ncmpcpp but it doesn’t stop the music. You can play and pause with _P_. - -You can see the current playlist by pressing the _1_ button (this is the default view). From this view you can press _i_ to look at the information (tags) about the current song. You can change the tags of the currently playing (or paused) song by pressing _6_. - -Pressing the \ button will add (or remove) an informative panel at the top of the view. In the top left, you should see something that looks like this: - -``` -[------] -``` - -Pressing the _r_, _z_, _y_, _R_, _x_ buttons will respectively toggle the _repeat_, _random_, _single_, _consume_ and _crossfade_ playback modes and will replace one of the _–_ characters in that little indicator to the initial of the selected mode. - -Pressing the _F1_ button will display some help text, which contains a list of keybindings, so there’s no need to write a complete list here. So now go on, be geeky, and play all your music from your terminal! - --------------------------------------------------------------------------------- - -via: https://fedoramagazine.org/playing-music-on-your-fedora-terminal-with-mpd-and-ncmpcpp/ - -作者:[Carmine Zaccagnino][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://fedoramagazine.org/author/carzacc/ -[b]: https://github.com/lujun9972 -[1]: https://fedoramagazine.org/wp-content/uploads/2020/02/play_music_mpd-816x346.png -[2]: https://rpmfusion.org/Configuration diff --git a/sources/tech/20200210 Scan Kubernetes for errors with KRAWL.md b/sources/tech/20200210 Scan Kubernetes for errors with KRAWL.md deleted file mode 100644 index 1c7d36183d..0000000000 --- a/sources/tech/20200210 Scan Kubernetes for errors with KRAWL.md +++ /dev/null @@ -1,222 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: ( ) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Scan Kubernetes for errors with KRAWL) -[#]: via: (https://opensource.com/article/20/2/kubernetes-scanner) -[#]: author: (Abhishek Tamrakar https://opensource.com/users/tamrakar) - -Scan Kubernetes for errors with KRAWL -====== -The KRAWL script identifies errors in Kubernetes pods and containers. -![Ship captain sailing the Kubernetes seas][1] - -When you're running containers with Kubernetes, you often find that they pile up. This is by design. It's one of the advantages of containers: they're cheap to start whenever a new one is needed. You can use a front-end like OpenShift or OKD to manage pods and containers. Those make it easy to visualize what you have set up, and have a rich set of commands for quick interactions. - -If a platform to manage containers doesn't fit your requirements, though, you can also get that information using only a Kubernetes toolchain, but there are a lot of commands you need for a full overview of a complex environment. For that reason, I wrote [KRAWL][2], a simple script that scans pods and containers under the namespaces on Kubernetes clusters and displays the output of events, if any are found. It can also be used as Kubernetes plugin for the same purpose. It's a quick and easy way to get a lot of useful information. - -### Prerequisites - - * You must have kubectl installed. - * Your cluster's kubeconfig must be either in its default location ($HOME/.kube/config) or exported (KUBECONFIG=/path/to/kubeconfig). - - - -### Usage - - -``` -`$ ./krawl` -``` - -![KRAWL script][3] - -### The script - - -``` -#!/bin/bash -# AUTHOR: Abhishek Tamrakar -# EMAIL: [abhishek.tamrakar08@gmail.com][4] -# LICENSE: Copyright (C) 2018 Abhishek Tamrakar -# -#  Licensed under the Apache License, Version 2.0 (the "License"); -#  you may not use this file except in compliance with the License. -#  You may obtain a copy of the License at -# -#       -# -#   Unless required by applicable law or agreed to in writing, software -#   distributed under the License is distributed on an "AS IS" BASIS, -#   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -#   See the License for the specific language governing permissions and -#   limitations under the License. -## -#define the variables -KUBE_LOC=~/.kube/config -#define variables -KUBECTL=$(which kubectl) -GET=$(which egrep) -AWK=$(which awk) -red=$(tput setaf 1) -normal=$(tput sgr0) -# define functions - -# wrapper for printing info messages -info() -{ -  printf '\n\e[34m%s\e[m: %s\n' "INFO" "$@" -} - -# cleanup when all done -cleanup() -{ -  rm -f results.csv -} - -# just check if the command we are about to call is available -checkcmd() -{ -  #check if command exists -  local cmd=$1 -  if [ -z "${!cmd}" ] -  then -    printf '\n\e[31m%s\e[m: %s\n' "ERROR"  "check if $1 is installed !!!" -    exit 1 -  fi -} - -get_namespaces() -{ -  #get namespaces -  namespaces=( \ -          $($KUBECTL get namespaces --ignore-not-found=true | \ -          $AWK '/Active/ {print $1}' \ -          ORS=" ") \ -          ) -#exit if namespaces are not found -if [ ${#namespaces[@]} -eq 0 ] -then -  printf '\n\e[31m%s\e[m: %s\n' "ERROR"  "No namespaces found!!" -  exit 1 -fi -} - -#get events for pods in errored state -get_pod_events() -{ -  printf '\n' -  if [ ${#ERRORED[@]} -ne 0 ] -  then -      info "${#ERRORED[@]} errored pods found." -      for CULPRIT in ${ERRORED[@]} -      do -        info "POD: $CULPRIT" -        info -        $KUBECTL get events \ -        --field-selector=involvedObject.name=$CULPRIT \ -        -ocustom-columns=LASTSEEN:.lastTimestamp,REASON:.reason,MESSAGE:.message \ -        --all-namespaces \ -        --ignore-not-found=true -      done -  else -      info "0 pods with errored events found." -  fi -} - -#define the logic -get_pod_errors() -{ -  printf "%s %s %s\n" "NAMESPACE,POD_NAME,CONTAINER_NAME,ERRORS" > results.csv -  printf "%s %s %s\n" "---------,--------,--------------,------" >> results.csv -  for NAMESPACE in ${namespaces[@]} -  do -    while IFS=' ' read -r POD CONTAINERS -    do -      for CONTAINER in ${CONTAINERS//,/ } -      do -        COUNT=$($KUBECTL logs --since=1h --tail=20 $POD -c $CONTAINER -n $NAMESPACE 2>/dev/null| \ -        $GET -c '^error|Error|ERROR|Warn|WARN') -        if [ $COUNT -gt 0 ] -        then -            STATE=("${STATE[@]}" "$NAMESPACE,$POD,$CONTAINER,$COUNT") -        else -        #catch pods in errored state -            ERRORED=($($KUBECTL get pods -n $NAMESPACE --no-headers=true | \ -                awk '!/Running/ {print $1}' ORS=" ") \ -                ) -        fi -      done -    done< <($KUBECTL get pods -n $NAMESPACE --ignore-not-found=true -o=custom-columns=NAME:.metadata.name,CONTAINERS:.spec.containers[*].name --no-headers=true) -  done -  printf "%s\n" ${STATE[@]:-None} >> results.csv -  STATE=() -} -#define usage for seprate run -usage() -{ -cat << EOF - -  USAGE: "${0##*/} </path/to/kube-config>(optional)" - -  This program is a free software under the terms of Apache 2.0 License. -  COPYRIGHT (C) 2018 Abhishek Tamrakar - -EOF -exit 0 -} - -#check if basic commands are found -trap cleanup EXIT -checkcmd KUBECTL -# -#set the ground -if [ $# -lt 1 ]; then -  if [ ! -e ${KUBE_LOC} -a ! -s ${KUBE_LOC} ] -  then -    info "A readable kube config location is required!!" -    usage -  fi -elif [ $# -eq 1 ] -then -  export KUBECONFIG=$1 -elif [ $# -gt 1 ] -then -  usage -fi -#play -get_namespaces -get_pod_errors - -printf '\n%40s\n' 'KRAWL' -printf '%s\n' '---------------------------------------------------------------------------------' -printf '%s\n' '  Krawl is a command line utility to scan pods and prints name of errored pods   ' -printf '%s\n\n' ' +and containers within. To use it as kubernetes plugin, please check their page ' -printf '%s\n' '=================================================================================' - -cat results.csv | sed 's/,/,|/g'| column -s ',' -t -get_pod_events -``` - -* * * - -_This was originally published as the README in [KRAWL's GitHub repository][2] and is reused with permission._ - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/20/2/kubernetes-scanner - -作者:[Abhishek Tamrakar][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/tamrakar -[b]: https://github.com/lujun9972 -[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/ship_captain_devops_kubernetes_steer.png?itok=LAHfIpek (Ship captain sailing the Kubernetes seas) -[2]: https://github.com/abhiTamrakar/kube-plugins/tree/master/krawl -[3]: https://opensource.com/sites/default/files/uploads/krawl_0.png (KRAWL script) -[4]: mailto:abhishek.tamrakar08@gmail.com diff --git a/sources/tech/20200210 Top hacks for the YaCy open source search engine.md b/sources/tech/20200210 Top hacks for the YaCy open source search engine.md deleted file mode 100644 index 7b559e9c5e..0000000000 --- a/sources/tech/20200210 Top hacks for the YaCy open source search engine.md +++ /dev/null @@ -1,100 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: (HankChow) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Top hacks for the YaCy open source search engine) -[#]: via: (https://opensource.com/article/20/2/yacy-search-engine-hacks) -[#]: author: (Seth Kenlon https://opensource.com/users/seth) - -Top hacks for the YaCy open source search engine -====== -Rather than adapting to someone else's vision, customize you search -engine for the internet you want with YaCY. -![Browser of things][1] - -In my article about [getting started with YaCy][2], I explained how to install and start using the [YaCy][3] peer-to-peer search engine. One of the most exciting things about YaCy, however, is the fact that it's a local client. Each user owns and operates a node in a globally distributed search engine infrastructure, which means each user is in full control of how they navigate and experience the World Wide Web. - -For instance, Google used to provide the URL google.com/linux as a shortcut to filter searches for Linux-related topics. It was a small feature that many people found useful, but [topical shortcuts were dropped][4] in 2011.  - -YaCy makes it possible to customize your search experience. - -### Customize YaCy - -Once you've installed YaCy, navigate to your search page at **localhost:8090**. To customize your search engine, click the **Administration** button in the top-right corner (it may be concealed in a menu icon on small screens). - -The admin panel allows you to configure how YaCy uses your system resources and how it interacts with other YaCy clients. - -![YaCy profile selector][5] - -For instance, to configure an alternative port and set RAM and disk usage, use the **First steps** menu in the sidebar. To monitor YaCy activity, use the **Monitoring** panel. Most features are discoverable by clicking through the panels, but here are some of my favorites. - -### Search appliance - -Several companies have offered [intranet search appliances][6], but with YaCy, you can implement it for free. Whether you want to search through your own data or to implement a search system for local file shares at your business, you can choose to run YaCy as an internal indexer for files accessible over HTTP, FTP, and SMB (Samba). People in your local network can use your personalized instance of YaCy to find shared files, and none of the data is shared with users outside your network. - -### Network configuration - -YaCy favors isolation and privacy by default. You can adjust how you connect to the peer-to-peer network in the **Network Configuration** panel, which is revealed by clicking the link located at the top of the **Use Case & Account** configuration screen. - -![YaCy network configuration][7] - -### Crawl a site - -Peer-to-peer indexing is user-driven. There's no mega-corporation initiating searches on every accessible page on the internet, so a site isn't indexed until someone deliberately crawls it with YaCy. - -The YaCy client provides two options to help you help crawl the web: you can perform a manual crawl, and you can make YaCy available for suggested crawls. - -![YaCy advanced crawler][8] - -#### Start a manual crawling job - -A manual crawl is when you enter the URL of a site you want to index and start a YaCy crawl job. To do this, click the **Advanced Crawler** link in the **Production** sidebar. Enter one or more URLs, then scroll to the bottom of the page and enable the **Do remote indexing** option. This enables your client to broadcast the URLs it is indexing, so clients that have opted to accept requests can help you perform the crawl. - -To start the crawl, click the **Start New Crawl Job** button at the bottom of the page. I use this method to index sites I use frequently or find useful. - -Once the crawl job starts, YaCy indexes the URLs you enter and stores the index on your local machine. As long as you are running in senior mode (meaning your firewall permits incoming and outgoing traffic on port 8090), your index is available to YaCy users all over the globe. - -#### Join in on a crawl - -While some very dedicated YaCy senior users may crawl the internet compulsively, there are a _lot_ of sites out there in the world. It might seem impossible to match the resources of popular spiders and bots, but because YaCy has so many users, they can band together as a community to index more of the internet than any one user could do alone. If you activate YaCy to broadcast requests for site crawls, participating clients can work together to crawl sites you might not otherwise think to crawl manually. - -To configure your client to accept jobs from others, click the **Advanced Crawler** link in the left sidebar menu. In the **Advanced Crawler** panel, click the **Remote Crawling** link under the **Network Harvesting** heading at the top of the page. Enable remote crawls by placing a tick in the checkbox next to the **Load** setting. - -![YaCy remote crawling][9] - -### YaCy monitoring and more - -YaCy is a surprisingly robust search engine, providing you with the opportunity to theme and refine your experience in nearly any way you could want. You can monitor the activity of your YaCy client in the **Monitoring** panel, so you can get an idea of how many people are benefiting from the work of the YaCy community and also see what kind of activity it's generating for your computer and network. - -![YaCy monitoring screen][10] - -### Search engines make a difference - -The more time you spend with the Administration screen, the more fun it becomes to ponder how the search engine you use can change your perspective. Your experience of the internet is shaped by the results you get back for even the simplest of queries. You might notice, in fact, how different one person's "internet" is from another person's when you talk to computer users from a different industry. For some people, the web is littered with ads and promoted searches and suffers from the tunnel vision of learned responses to queries. For instance, if someone consistently searches for answers about X, most commercial search engines will give weight to query responses that concern X. That's a useful feature on the one hand, but it occludes answers that require Y, even though that might be the better solution for a specific task. - -As in real life, stepping outside a manufactured view of the world can be healthy and enlightening. Try YaCy, and see what you discover. - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/20/2/yacy-search-engine-hacks - -作者:[Seth Kenlon][a] -选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]: https://opensource.com/users/seth -[b]: https://github.com/lujun9972 -[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/browser_desktop_website_checklist_metrics.png?itok=OKKbl1UR (Browser of things) -[2]: https://opensource.com/article/20/2/open-source-search-engine -[3]: https://yacy.net/ -[4]: https://www.linuxquestions.org/questions/linux-news-59/is-there-no-more-linux-google-884306/ -[5]: https://opensource.com/sites/default/files/uploads/yacy-profiles.jpg (YaCy profile selector) -[6]: https://en.wikipedia.org/wiki/Vivisimo -[7]: https://opensource.com/sites/default/files/uploads/yacy-network-config.jpg (YaCy network configuration) -[8]: https://opensource.com/sites/default/files/uploads/yacy-advanced-crawler.jpg (YaCy advanced crawler) -[9]: https://opensource.com/sites/default/files/uploads/yacy-remote-crawl-accept.jpg (YaCy remote crawling) -[10]: https://opensource.com/sites/default/files/uploads/yacy-monitor.jpg (YaCy monitoring screen) diff --git a/sources/tech/20200211 Automate your live demos with this shell script.md b/sources/tech/20200211 Automate your live demos with this shell script.md new file mode 100644 index 0000000000..56b8626148 --- /dev/null +++ b/sources/tech/20200211 Automate your live demos with this shell script.md @@ -0,0 +1,210 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Automate your live demos with this shell script) +[#]: via: (https://opensource.com/article/20/2/live-demo-script) +[#]: author: (Lisa Seelye https://opensource.com/users/lisa) + +Automate your live demos with this shell script +====== +Try this script the next time you give a presentation to prevent making +typos in front of a live audience. +![Person using a laptop][1] + +I gave a talk about [multi-architecture container images][2] at [LISA19][3] in October that included a lengthy live demo. Rather than writing out 30+ commands and risking typos, I decided to automate the demo with a shell script. + +The script mimics what appears as input/output and runs the real commands in the background, pausing at various points so I can narrate what is going on. I'm very pleased with how the script turned out and the effect on stage. The script and supporting materials for my presentation are available on [GitHub][4] under an Apache 2.0 license. + +### The script + + +``` +#!/bin/bash + +set -e + +IMG=thedoh/lisa19 +REGISTRY=docker.io +VERSION=19.10.1 + +# Plan B with GCR: +#IMG=dulcet-iterator-213018 +#REGISTRY=us.gcr.io +#VERSION=19.10.1 + +pause() { +  local step="${1}" +  ps1 +  echo -n "# Next step: ${step}" +  read +} + +ps1() { +  echo -ne "\033[01;32m${USER}@$(hostname -s) \033[01;34m$(basename $(pwd)) \$ \033[00m" +} + +echocmd() { +  echo "$(ps1)$@" +} + +docmd() { +  echocmd $@ +  $@ +} + +step0() { +  local registry="${1}" img="${2}" version="${3}" +  # Mindful of tokens in ~/.docker/config.json +  docmd grep experimental ~/.docker/config.json +  +  docmd cd ~/go/src/github.com/lisa/lisa19-containers +  +  pause "This is what we'll be building" +  docmd export REGISTRY=${registry} +  docmd export IMG=${img} +  docmd export VERSION=${version} +  docmd make REGISTRY=${registry} IMG=${img} VERSION=${version} clean +} + +step1() { +  local registry="${1}" img="${2}" version="${3}" +  +  docmd docker build --no-cache --platform=linux/amd64 --build-arg=GOARCH=amd64 -t ${REGISTRY}/${IMG}:amd64-${VERSION} . +  pause "ARM64 image next" +  docmd docker build --no-cache --platform=linux/arm64 --build-arg=GOARCH=arm64 -t ${REGISTRY}/${IMG}:arm64-${VERSION} . +} + +step2() { +  local registry="${1}" img="${2}" version="${3}" origpwd=$(pwd) savedir=$(mktemp -d) jsontemp=$(mktemp -t XXXXX) +  chmod 700 $jsontemp $savedir +  # Set our way back home and get ready to fix our arm64 image to amd64. +  echocmd 'origpwd=$(pwd)' +  echocmd 'savedir=$(mktemp -d)' +  echocmd "mkdir -p \$savedir/change" +  mkdir -p $savedir/change &>/dev/null +  echocmd "docker save ${REGISTRY}/${IMG}:arm64-${VERSION} 2>/dev/null 1> \$savedir/image.tar" +  docker save ${REGISTRY}/${IMG}:arm64-${VERSION} 2>/dev/null 1> $savedir/image.tar +  pause "untar the image to access its metadata" +  +  echocmd "cd \$savedir/change" +  cd $savedir/change +  echocmd tar xf \$savedir/image.tar +  tar xf $savedir/image.tar +  docmd ls -l +  +  pause "find the JSON config file" +  echocmd 'jsonfile=$(jq -r ".[0].Config" manifest.json)' +  jsonfile=$(jq -r ".[0].Config" manifest.json) +  +  pause "notice the original metadata says amd64" +  echocmd jq '{architecture: .architecture, ID: .config.Image}' \$jsonfile +  jq '{architecture: .architecture, ID: .config.Image}' $jsonfile +  +  pause "Change from amd64 to arm64 using a temp file" +  echocmd "jq '.architecture = \"arm64\"' \$jsonfile > \$jsontemp" +  jq '.architecture = "arm64"' $jsonfile > $jsontemp +  echocmd /bin/mv -f -- \$jsontemp \$jsonfile +  /bin/mv -f -- $jsontemp $jsonfile + +  pause "Check to make sure the config JSON file says arm64 now" +  echocmd jq '{architecture: .architecture, ID: .config.Image}' \$jsonfile +  jq '{architecture: .architecture, ID: .config.Image}' $jsonfile +  +  pause "delete the image with the incorrect metadata" +  docmd docker rmi ${REGISTRY}/${IMG}:arm64-${VERSION} +  +  pause "Re-compress the ARM64 image and load it back into Docker, then clean up the temp space" +  echocmd 'tar cf - * | docker load' +  tar cf - * | docker load + +  docmd cd $origpwd +  echocmd "/bin/rm -rf -- \$savedir" +  /bin/rm -rf -- $savedir &>/dev/null +} + +step3() { +  local registry="${1}" img="${2}" version="${3}" +  docmd docker push ${registry}/${img}:amd64-${version} +  pause "push ARM64 image to ${registry}" +  docmd docker push ${registry}/${img}:arm64-${version} +} + +step4() { +  local registry="${1}" img="${2}" version="${3}" +  docmd docker manifest create ${registry}/${img}:${version} ${registry}/${img}:arm64-${version} ${registry}/${img}:amd64-${version} +  +  pause "add a reference to the amd64 image to the manifest list" +  docmd docker manifest annotate ${registry}/${img}:${version} ${registry}/${img}:amd64-${version} --os linux --arch amd64 +  pause "now add arm64" +  docmd docker manifest annotate ${registry}/${img}:${version} ${registry}/${img}:arm64-${version} --os linux --arch arm64 +} + +step5() { +  local registry="${1}" img="${2}" version="${3}" +  docmd docker manifest push ${registry}/${img}:${version} +} + +step6() { +  local registry="${1}" img="${2}" version="${3}" +  docmd make REGISTRY=${registry} IMG=${img} VERSION=${version} clean +  +  pause "ask docker.io if ${img}:${version} has a linux/amd64 manifest, and run it" +  docmd docker pull --platform linux/amd64 ${registry}/${img}:${version} +  docmd docker run --rm -i ${registry}/${img}:${version} +  +  pause "clean slate again" +  docmd make REGISTRY=${registry} IMG=${img} VERSION=${version} clean +  +  pause "now repeat for linux/arm64 and see what it gives us" +  docmd docker pull --platform linux/arm64 ${registry}/${img}:${version} +  set +e +  docmd docker run --rm -i ${registry}/${img}:${version} +  set -e +  if [[ $(uname -s) == "Darwin" ]]; then +    pause "note about Docker on Mac and binfmt_misc: binfmt_misc lets a mac run arm64 binaries in the Docker VM" +  fi +} + +pause "initial setup" +step0 ${REGISTRY} ${IMG} ${VERSION} +pause "1 build constituent images" +step1 ${REGISTRY} ${IMG} ${VERSION} + +pause "2 fix ARM64 metadata" +step2 ${REGISTRY} ${IMG} ${VERSION} + +pause "3 push constituent images up to docker.io" +step3 ${REGISTRY} ${IMG} ${VERSION} + +pause "4 build the manifest list for the image" +step4 ${REGISTRY} ${IMG} ${VERSION} + +pause "5 Push the manifest list to docker.io" +step5 ${REGISTRY} ${IMG} ${VERSION} + +pause "6 clean slate, and validate the list-based image" +step6 ${REGISTRY} ${IMG} ${VERSION} + +docmd echo 'Manual steps all done!' +make REGISTRY=${REGISTRY} IMG=${IMG} VERSION=${VERSION} clean &>/dev/null +``` + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/2/live-demo-script + +作者:[Lisa Seelye][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/lisa +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/laptop_screen_desk_work_chat_text.png?itok=UXqIDRDD (Person using a laptop) +[2]: https://www.usenix.org/conference/lisa19/presentation/seelye +[3]: https://www.usenix.org/conference/lisa19 +[4]: https://github.com/lisa/lisa19-containers diff --git a/sources/tech/20200211 Dino is a Modern Looking Open Source XMPP Client.md b/sources/tech/20200211 Dino is a Modern Looking Open Source XMPP Client.md deleted file mode 100644 index 78135c9f9b..0000000000 --- a/sources/tech/20200211 Dino is a Modern Looking Open Source XMPP Client.md +++ /dev/null @@ -1,104 +0,0 @@ -[#]: collector: (lujun9972) -[#]: translator: ( ) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) -[#]: subject: (Dino is a Modern Looking Open Source XMPP Client) -[#]: via: (https://itsfoss.com/dino-xmpp-client/) -[#]: author: (Ankush Das https://itsfoss.com/author/ankush/) - -Dino is a Modern Looking Open Source XMPP Client -====== - -_**Brief: Dino is a relatively new open-source XMPP client that tries to offer a good user experience while encouraging privacy-focused users to utilize XMPP for messaging.**_ - -### Dino: An Open Source XMPP Client - -![][1] - -[XMPP][2] (Extensible Messaging Presence Protocol) is a decentralized model of network to facilitate instant messaging and collaboration. Decentralize means there is no central server that has access to your data. The communication is directly between the end-points. - -Some of us might call it an “old school” tech probably because the XMPP clients usually have a very bad user experience or simply just because it takes time to get used to (or set it up). - -That’s when [Dino][3] comes to the rescue as a modern XMPP client to provide a clean and snappy user experience without compromising your privacy. - -### The User Experience - -![][4] - -Dino does try to improve the user experience as an XMPP client but it is worth noting that the look and feel of it will depend on your Linux distribution to some extent. Your icon theme or the gnome theme might make it look better or worse for your personal experience. - -Technically, the user interface is quite simple and easy to use. So, I suggest you take a look at some of the [best icon themes][5] and [GNOME themes][6] for Ubuntu to tweak the look of Dino. - -### Features of Dino - -![Dino Screenshot][7] - -You can expect to use Dino as an alternative to Slack, [Signal][8] or [Wire][9] for your business or personal usage. - -It offers all of the essential features you would need in a messaging application, let us take a look at a list of things that you can expect from it: - - * Decentralized Communication - * Public XMPP Servers supported if you cannot setup your own server - * Similar to UI to other popular messengers – so it’s easy to use - * Image & File sharing - * Multiple accounts supported - * Advanced message search - * [OpenPGP][10] & [OMEMO][11] encryption supported - * Lightweight native desktop application - - - -### Installing Dino on Linux - -You may or may not find it listed in your software center. Dino does provide ready to use binaries for Debian (deb) and Fedora (rpm) based distributions. - -**For Ubuntu:** - -Dino is available in the universe repository on Ubuntu and you can install it using this command: - -``` -sudo apt install dino-im -``` - -Similarly, you can find packages for other Linux distributions on their [GitHub distribution packages page][12]. - -If you want the latest and greatest, you can also find both **.deb** and .**rpm** files for Dino to install on your Linux distribution (nightly builds) from [OpenSUSE’s software webpage][13]. - -In either case, head to their [GitHub page][14] or click on the link below to visit the official site. - -[Download Dino][3] - -**Wrapping Up** - -It works quite well without any issues (at the time of writing this and quick testing it). I’ll try exploring more about it and hopefully cover more XMPP-centric articles to encourage users to use XMPP clients and servers for communication. - -What do you think about Dino? Would you recommend another open-source XMPP client that’s potentially better than Dino? Let me know your thoughts in the comments below. - --------------------------------------------------------------------------------- - -via: https://itsfoss.com/dino-xmpp-client/ - -作者:[Ankush Das][a] -选题:[lujun9972][b] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]: https://itsfoss.com/author/ankush/ -[b]: https://github.com/lujun9972 -[1]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/02/dino-main.png?ssl=1 -[2]: https://xmpp.org/about/ -[3]: https://dino.im/ -[4]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/02/dino-xmpp-client.jpg?ssl=1 -[5]: https://itsfoss.com/best-icon-themes-ubuntu-16-04/ -[6]: https://itsfoss.com/best-gtk-themes/ -[7]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/02/dino-screenshot.png?ssl=1 -[8]: https://itsfoss.com/signal-messaging-app/ -[9]: https://itsfoss.com/wire-messaging-linux/ -[10]: https://www.openpgp.org/ -[11]: https://en.wikipedia.org/wiki/OMEMO -[12]: https://github.com/dino/dino/wiki/Distribution-Packages -[13]: https://software.opensuse.org/download.html?project=network:messaging:xmpp:dino&package=dino -[14]: https://github.com/dino/dino diff --git a/sources/tech/20200211 Using external libraries in Java.md b/sources/tech/20200211 Using external libraries in Java.md new file mode 100644 index 0000000000..8367b5ca20 --- /dev/null +++ b/sources/tech/20200211 Using external libraries in Java.md @@ -0,0 +1,328 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Using external libraries in Java) +[#]: via: (https://opensource.com/article/20/2/external-libraries-java) +[#]: author: (Chris Hermansen https://opensource.com/users/clhermansen) + +Using external libraries in Java +====== +External libraries fill gaps in the Java core libraries. +![books in a library, stacks][1] + +Java comes with a core set of libraries, including those that define commonly used data types and related behavior, like **String** or **Date**; utilities to interact with the host operating system, such as **System** or **File**; and useful subsystems to manage security, deal with network communications, and create or parse XML. Given the richness of this core set of libraries, it's often easy to find the necessary bits and pieces to reduce the amount of code a programmer must write to solve a problem. + +Even so, there are a lot of interesting Java libraries created by people who find gaps in the core libraries. For example, [Apache Commons][2] "is an Apache project focused on all aspects of reusable Java components" and provides a collection of some 43 open source libraries (as of this writing) covering a range of capabilities either outside the Java core (such as [geometry][3] or [statistics][4]) or that enhance or replace capabilities in the Java core (such as [math][5] or [numbers][6]). + +Another common type of Java library is an interface to a system component—for example, to a database system. This article looks at using such an interface to connect to a [PostgreSQL][7] database and get some interesting information. But first, I'll review the important bits and pieces of a library. + +### What is a library? + +A library, of course, must contain some useful code. But to be useful, that code needs to be organized in such a way that the Java programmer can access the components to solve the problem at hand. + +I'll boldly claim that the most important part of a library is its application programming interface (API) documentation. This kind of documentation is familiar to many and is most often produced by [Javadoc][8], which reads structured comments in the code and produces HTML output that displays the API's packages in the panel in the top-left corner of the page; its classes in the bottom-left corner; and the detailed documentation at the library, package, or class level (depending on what is selected in the main panel) on the right. For example, the [top level of API documentation for Apache Commons Math][9] looks like: + +![API documentation for Apache Commons Math][10] + +Clicking on a package in the main panel shows the Java classes and interfaces defined in that package. For example, **[org.apache.commons.math4.analysis.solvers][11]** shows classes like **BisectionSolver** for finding zeros of univariate real functions using the bisection algorithm. And clicking on the [BisectionSolver][12] link lists all the methods of the class **BisectionSolver**. + +This type of documentation is useful as reference information; it's not intended as a tutorial for learning how to use the library. For example, if you know what a univariate real function is and look at the package **org.apache.commons.math4.analysis.function**, you can imagine using that package to compose a function definition and then using the **org.apache.commons.math4.analysis.solvers** package to look for zeros of the just-created function. But really, you probably need more learning-oriented documentation to bridge to the reference documentation. Maybe even an example! + +This documentation structure also helps clarify the meaning of _package_—a collection of related Java class and interface definitions—and shows what packages are bundled in a particular library. + +The code for such a library is most commonly found in a [**.jar** file][13], which is basically a .zip file created by the Java **jar** command that contains some other useful information. **.jar** files are typically created as the endpoint of a build process that compiles all the **.java** files in the various packages defined. + +There are two main steps to accessing the functionality provided by an external library: + + 1. Make sure the library is available to the Java compilation step—[**javac**][14]—and the execution step—**java**—via the classpath (either the **-cp** argument on the command line or the **CLASSPATH** environment variable). + 2. Use the appropriate **import** statements to access the package and class in the program source code. + + + +The rest is just like coding with Java core classes, such as **String**—write the code using the class and interface definitions provided by the library. Easy, eh? Well, maybe not quite that easy; first, you need to understand the intended use pattern for the library components, and then you can write code. + +### An example: Connect to a PostgreSQL database + +The typical use pattern for accessing data in a database system is: + + 1. Gain access to the code specific to the database software being used. + 2. Connect to the database server. + 3. Build a query string. + 4. Execute the query string. + 5. Do something with the results returned. + 6. Disconnect from the database server. + + + +The programmer-facing part of all of this is provided by a database-independent interface package, **[java.sql][15]**, which defines the core client-side Java Database Connectivity (JDBC) API. The **java.sql** package is part of the core Java libraries, so there is no need to supply a **.jar** file to the compile step. However, each database provider creates its own implementation of the **java.sql** interfaces—for example, the **Connection** interface—and those implementations must be provided on the run step. + +Let's see how this works, using PostgreSQL. + +#### Gain access to the database-specific code + +The following code uses the [Java class loader][16] (the **Class.forName()** call) to bring the PostgreSQL driver code into the executing virtual machine: + + +``` +import java.sql.*; + +public class Test1 { + +    public static void main([String][17] args[]) { + +        // Load the driver (jar file must be on class path) [1] + +        try { +            Class.forName("org.postgresql.Driver"); +            [System][18].out.println("driver loaded"); +        } catch ([Exception][19] e1) { +            [System][18].err.println("couldn't find driver"); +            [System][18].err.println(e1); +            [System][18].exit(1); +        } + +        // If we get here all is OK + +        [System][18].out.println("done."); +    } +} +``` + +Because the class loader can fail, and therefore can throw an exception when failing, surround the call to **Class.forName()** in a try-catch block. + +If you compile the above code with **javac** and run it with Java: + + +``` +me@mymachine:~/Test$ javac Test1.java +me@mymachine:~/Test$ java Test1 +couldn't find driver +java.lang.ClassNotFoundException: org.postgresql.Driver +me@mymachine:~/Test$ +``` + +The class loader needs the **.jar** file containing the PostgreSQL JDBC driver implementation to be on the classpath: + + +``` +me@mymachine:~/Test$ java -cp ~/src/postgresql-42.2.5.jar:. Test1 +driver loaded +done. +me@mymachine:~/Test$ +``` + +#### Connect to the database server + +The following code loads the JDBC driver and creates a connection to the PostgreSQL database: + + +``` +import java.sql.*; + +public class Test2 { + +        public static void main([String][17] args[]) { + +                // Load the driver (jar file must be on class path) [1] + +                try { +                        Class.forName("org.postgresql.Driver"); +                        [System][18].out.println("driver loaded"); +                } catch ([Exception][19] e1) { +                        [System][18].err.println("couldn't find driver"); +                        [System][18].err.println(e1); +                        [System][18].exit(1); +                } + +                // Set up connection properties [2] + +                java.util.[Properties][20] props = new java.util.[Properties][20](); +                props.setProperty("user","me"); +                props.setProperty("password","mypassword"); +                [String][17] database = "jdbc:postgresql://myhost.org:5432/test"; + +                // Open the connection to the database [3] + +                try ([Connection][21] conn = [DriverManager][22].getConnection(database, props)) { +                        [System][18].out.println("connection created"); +                } catch ([Exception][19] e2) { +                        [System][18].err.println("sql operations failed"); +                        [System][18].err.println(e2); +                        [System][18].exit(2); +                } +                [System][18].out.println("connection closed"); + +                // If we get here all is OK + +                [System][18].out.println("done."); +        } +} +``` + +Compile and run it: + + +``` +me@mymachine:~/Test$ javac Test2.java +me@mymachine:~/Test$ java -cp ~/src/postgresql-42.2.5.jar:. Test2 +driver loaded +connection created +connection closed +done. +me@mymachine:~/Test$ +``` + +Some notes on the above: + + * The code following comment [2] uses system properties to set up connection parameters—in this case, the PostgreSQL username and password. This allows for grabbing those parameters from the Java command line and passing all the parameters in as an argument bundle. There are other **Driver.getConnection()** options for passing in the parameters individually. + * JDBC requires a URL for defining the database, which is declared above as **String database** and passed into the **Driver.getConnection()** method along with the connection parameters. + * The code uses try-with-resources, which auto-closes the connection upon completion of the code in the try-catch block. There is a lengthy discussion of this approach on [Stack Overflow][23]. + * The try-with-resources provides access to the **Connection** instance and can execute SQL statements there; any errors will be caught by the same **catch** statement. + + + +#### Do something fun with the database connection + +In my day job, I often need to know what users have been defined for a given database server instance, and I use this [handy piece of SQL][24] for grabbing a list of all users: + + +``` +import java.sql.*; + +public class Test3 { + +        public static void main([String][17] args[]) { + +                // Load the driver (jar file must be on class path) [1] + +                try { +                        Class.forName("org.postgresql.Driver"); +                        [System][18].out.println("driver loaded"); +                } catch ([Exception][19] e1) { +                        [System][18].err.println("couldn't find driver"); +                        [System][18].err.println(e1); +                        [System][18].exit(1); +                } + +                // Set up connection properties [2] + +                java.util.[Properties][20] props = new java.util.[Properties][20](); +                props.setProperty("user","me"); +                props.setProperty("password","mypassword"); +                [String][17] database = "jdbc:postgresql://myhost.org:5432/test"; + +                // Open the connection to the database [3] + +                try ([Connection][21] conn = [DriverManager][22].getConnection(database, props)) { +                        [System][18].out.println("connection created"); + +                        // Create the SQL command string [4] + +                        [String][17] qs = "SELECT " + +                                "       u.usename AS \"User name\", " + +                                "       u.usesysid AS \"User ID\", " + +                                "       CASE " + +                                "       WHEN u.usesuper AND u.usecreatedb THEN " + +                                "               CAST('superuser, create database' AS pg_catalog.text) " + +                        "       WHEN u.usesuper THEN " + +                                "               CAST('superuser' AS pg_catalog.text) " + +                                "       WHEN u.usecreatedb THEN " + +                                "               CAST('create database' AS pg_catalog.text) " + +                                "       ELSE " + +                                "               CAST('' AS pg_catalog.text) " + +                                "       END AS \"Attributes\" " + +                                "FROM pg_catalog.pg_user u " + +                                "ORDER BY 1"; + +                        // Use the connection to create a statement, execute it, +                        // analyze the results and close the result set [5] + +                        [Statement][25] stat = conn.createStatement(); +                        [ResultSet][26] rs = stat.executeQuery(qs); +                        [System][18].out.println("User name;User ID;Attributes"); +                        while (rs.next()) { +                                [System][18].out.println(rs.getString("User name") + ";" + +                                                rs.getLong("User ID") + ";" + +                                                rs.getString("Attributes")); +                        } +                        rs.close(); +                        stat.close(); +                +                } catch ([Exception][19] e2) { +                        [System][18].err.println("connecting failed"); +                        [System][18].err.println(e2); +                        [System][18].exit(1); +                } +                [System][18].out.println("connection closed"); + +                // If we get here all is OK + +                [System][18].out.println("done."); +        } +} +``` + +In the above, once it has the **Connection** instance, it defines a query string (comment [4] above), creates a **Statement** instance and uses it to execute the query string, then puts its results in a **ResultSet** instance, which it can iterate through to analyze the results returned, and ends by closing both the **ResultSet** and **Statement** instances (comment [5] above). + +Compiling and executing the program produces the following output: + + +``` +me@mymachine:~/Test$ javac Test3.java +me@mymachine:~/Test$ java -cp ~/src/postgresql-42.2.5.jar:. Test3 +driver loaded +connection created +User name;User ID;[Attributes][27] +fwa;16395;superuser +vax;197772; +mbe;290995; +aca;169248; +connection closed +done. +me@mymachine:~/Test$ +``` + +This is a (very simple) example of using the PostgreSQL JDBC library in a simple Java application. It's worth emphasizing that it didn't need to use a Java import statement like **import org.postgresql.jdbc.*;** in the code because of the way the **java.sql** library is designed. Because of that, there's no need to specify the classpath at compile time. Instead, it uses the Java class loader to bring in the PostgreSQL code at run time. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/2/external-libraries-java + +作者:[Chris Hermansen][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/clhermansen +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/books_library_reading_list.jpg?itok=O3GvU1gH (books in a library, stacks) +[2]: https://commons.apache.org/ +[3]: https://commons.apache.org/proper/commons-geometry/ +[4]: https://commons.apache.org/proper/commons-statistics/ +[5]: https://commons.apache.org/proper/commons-math/ +[6]: https://commons.apache.org/proper/commons-numbers/ +[7]: https://opensource.com/article/19/11/getting-started-postgresql +[8]: https://en.wikipedia.org/wiki/Javadoc +[9]: https://commons.apache.org/proper/commons-math/apidocs/index.html +[10]: https://opensource.com/sites/default/files/uploads/api-documentation_apachecommonsmath.png (API documentation for Apache Commons Math) +[11]: https://commons.apache.org/proper/commons-math/apidocs/org/apache/commons/math4/analysis/solvers/package-summary.html +[12]: https://commons.apache.org/proper/commons-math/apidocs/org/apache/commons/math4/analysis/solvers/BisectionSolver.html +[13]: https://en.wikipedia.org/wiki/JAR_(file_format) +[14]: https://en.wikipedia.org/wiki/Javac +[15]: https://docs.oracle.com/javase/8/docs/api/java/sql/package-summary.html +[16]: https://en.wikipedia.org/wiki/Java_Classloader +[17]: http://www.google.com/search?hl=en&q=allinurl%3Adocs.oracle.com+javase+docs+api+string +[18]: http://www.google.com/search?hl=en&q=allinurl%3Adocs.oracle.com+javase+docs+api+system +[19]: http://www.google.com/search?hl=en&q=allinurl%3Adocs.oracle.com+javase+docs+api+exception +[20]: http://www.google.com/search?hl=en&q=allinurl%3Adocs.oracle.com+javase+docs+api+properties +[21]: http://www.google.com/search?hl=en&q=allinurl%3Adocs.oracle.com+javase+docs+api+connection +[22]: http://www.google.com/search?hl=en&q=allinurl%3Adocs.oracle.com+javase+docs+api+drivermanager +[23]: https://stackoverflow.com/questions/8066501/how-should-i-use-try-with-resources-with-jdbc +[24]: https://www.postgresql.org/message-id/1121195544.8208.242.camel@state.g2switchworks.com +[25]: http://www.google.com/search?hl=en&q=allinurl%3Adocs.oracle.com+javase+docs+api+statement +[26]: http://www.google.com/search?hl=en&q=allinurl%3Adocs.oracle.com+javase+docs+api+resultset +[27]: http://www.google.com/search?hl=en&q=allinurl%3Adocs.oracle.com+javase+docs+api+attributes diff --git a/sources/tech/20200212 Manage your SSL certificates with the ssl-on-demand script.md b/sources/tech/20200212 Manage your SSL certificates with the ssl-on-demand script.md new file mode 100644 index 0000000000..e4be89e4f5 --- /dev/null +++ b/sources/tech/20200212 Manage your SSL certificates with the ssl-on-demand script.md @@ -0,0 +1,685 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Manage your SSL certificates with the ssl-on-demand script) +[#]: via: (https://opensource.com/article/20/2/ssl-demand) +[#]: author: (Abhishek Tamrakar https://opensource.com/users/tamrakar) + +Manage your SSL certificates with the ssl-on-demand script +====== +Keep track of certificate expirations to prevent problems with the +ssl-on-demand script. +![Lock][1] + +It happens all the time, to the largest of companies. An important certificate doesn't get renewed, and services become inaccessible. It happened to Microsoft Teams in early February 2020, awkwardly timed just after the launch of a major television campaign promoting it as a [Slack competitor][2]. Embarrassing as that may be, it's sure to happen to someone else in the future. + +On the modern web, expired [certificates][3] can create major problems for websites, ranging from unhappy users who can't connect to a site to security threats from bad actors who take advantage of the failure to renew a certificate. + +[Ssl-on-demand][4] is a set of SSL scripts to help site owners manage certificates. It is used for on-demand certificate generation and validation and it can create certificate signing requests ([CSRs][5]) and predict the expiration of existing certificates. + +### Automate SSL expiry checks + + +``` + USAGE: SSLexpiryPredictions.sh -[cdewh] + +  DESCRIPTION: This script predicts the expiring SSL certificates based on the end date. + +  OPTIONS: + +  -c|   sets the value for configuration file which has server:port or host:port details. +        +  -d|   sets the value of directory containing the certificate files in crt or pem format. + +  -e|   sets the value of certificate extention, e.g crt, pem, cert. +        crt: default [to be used with -d, if certificate file extention is other than .crt] + +  -w|   sets the value for writing the script output to a file. + +  -h|   prints this help and exit. +``` + +**Examples:** + +To create a file with a list of all servers and their port numbers to make an SSL handshake, use: + + +``` +cat > servers.list +         server1:port1 +         server2:port2 +         server3:port3 +        (ctrl+d) +        +$ ./SSLexpiryPredictions.sh -c server.list +``` + +Run the script by providing the certificate location and extension (in case it is not .crt): + + +``` +`$ ./SSLexpiryPredictions.sh -d /path/to/certificates/dir -e pem` +``` + +### Automate CSR and private key creation + + +``` +Usage:  genSSLcsr.sh [options] -[cdmshx] +  [-c (common name)] +  [-d (domain name)] +  [-s (SSL certificate subject)] +  [-p (password)] +  [-m (email address)] *(Experimental) +  [-r (remove pasphrase) default:true] +  [-h (help)] +  [-x (optional)] + +[OPTIONS] +  -c|   Sets the value for common name. +        A valid common name is something that ends with 'xyz.com' + +  -d|   Sets the domain name. + +  -s|   Sets the subject to be applied to the certificates. +        '/C=country/ST=state/L=locality/O=organization/OU=organizationalunit/emailAddress=email' + +  -p|   Sets the password for private key. + +  -r|   Sets the value of remove passphrase. +        true:[default] passphrase will be removed from key. +        false: passphrase will not be removed and key wont get printed. + +  -m|   Sets the mailing capability to the script. +        (Experimental at this time and requires a lot of work) + +  -x|   Creates the certificate request and key but do not print on screen. +        To be used when script is used just to create the key and CSR with no need +        + to generate the certficate on the go. + +  -h|   Displays the usage. No further functions are performed. + +  Example: genSSLcsr.sh -c mywebsite.xyz.com -m [myemail@mydomain.com][6] +``` + +### The scripts + +#### 1. SSLexpiryPredictions.sh + + +``` +#!/bin/bash +############################################## +# +#       PURPOSE: The script to predict expiring SSL certificates. +# +#       AUTHOR: 'Abhishek.Tamrakar' +# +#       VERSION: 0.0.1 +# +#       COMPANY: Self +# +#       EMAIL: [abhishek.tamrakar08@gmail.com][7] +# +#       GENERATED: on 2018-05-20 +# +#       LICENSE: Copyright (C) 2018 Abhishek Tamrakar +# +#  Licensed under the Apache License, Version 2.0 (the "License"); +#  you may not use this file except in compliance with the License. +#  You may obtain a copy of the License at +# +#       +# +#   Unless required by applicable law or agreed to in writing, software +#   distributed under the License is distributed on an "AS IS" BASIS, +#   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +#   See the License for the specific language governing permissions and +#   limitations under the License. +############################################## + +#your Variables go here +script=${0##/} +exitcode='' +WRITEFILE=0 +CONFIG=0 +DIR=0 +# functions here +usage() +{ +cat <<EOF + +  USAGE: $script -[cdewh]" + +  DESCRIPTION: This script predicts the expiring SSL certificates based on the end date. + +  OPTIONS: + +  -c|   sets the value for configuration file which has server:port or host:port details. + +  -d|   sets the value of directory containing the certificate files in crt or pem format. + +  -e|   sets the value of certificate extention, e.g crt, pem, cert. +        crt: default + +  -w|   sets the value for writing the script output to a file. + +  -h|   prints this help and exit. + +EOF +exit 1 +} +# print info messages +info() +{ +  printf '\n%s: %6s\n' "INFO" "$@" +} +# print error messages +error() +{ +  printf '\n%s: %6s\n' "ERROR" "$@" +  exit 1 +} +# print warning messages +warn() +{ +  printf '\n%s: %6s\n' "WARN" "$@" +} +# get expiry for the certificates +getExpiry() +{ +  local expdate=$1 +  local certname=$2 +  today=$(date +%s) +  timetoexpire=$(( ($expdate - $today)/(60*60*24) )) + +  expcerts=( ${expcerts[@]} "${certname}:$timetoexpire" ) +} + +# print all expiry that was found, typically if there is any. +printExpiry() +{ +  local args=$# +  i=0 +  if [[ $args -ne 0 ]]; then +    #statements +    printf '%s\n' "---------------------------------------------" +    printf '%s\n' "List of expiring SSL certificates" +    printf '%s\n' "---------------------------------------------" +    printf '%s\n' "$@"  | \ +      sort -t':' -g -k2 | \ +      column -s: -t     | \ +      awk '{printf "%d.\t%s\n", NR, $0}' +    printf '%s\n' "---------------------------------------------" +  fi +} + +# calculate the end date for the certificates first, finally to compare and predict when they are going to expire. +calcEndDate() +{ +  sslcmd=$(which openssl) +  if [[ x$sslcmd = x ]]; then +    #statements +    error "$sslcmd command not found!" +  fi +  # when cert dir is given +  if [[ $DIR -eq 1 ]]; then +    #statements +    checkcertexists=$(ls -A $TARGETDIR| egrep "*.$EXT$") +    if [[ -z ${checkcertexists} ]]; then +      #statements +      error "no certificate files at $TARGETDIR with extention $EXT" +    fi +    for file in $TARGETDIR/*.${EXT:-crt} +    do +      expdate=$($sslcmd x509 -in $file -noout -enddate) +      expepoch=$(date -d "${expdate##*=}" +%s) +      certificatename=${file##*/} +      getExpiry $expepoch ${certificatename%.*} +    done +  elif [[ $CONFIG -eq 1 ]]; then +    #statements +    while read line +    do +      if echo "$line" | \ +      egrep -q '^[a-zA-Z0-9.]+:[0-9]+|^[a-zA-Z0-9]+_.*:[0-9]+'; +      then +        expdate=$(echo | \ +        openssl s_client -connect $line 2>/dev/null | \ +        openssl x509 -noout -enddate 2>/dev/null); +        if [[ $expdate = '' ]]; then +          #statements +          warn "[error:0906D06C] Cannot fetch certificates for $line" +        else +          expepoch=$(date -d "${expdate##*=}" +%s); +          certificatename=${line%:*}; +          getExpiry $expepoch ${certificatename}; +        fi +      else +        warn "[format error] $line is not in required format!" +      fi +    done < $CONFIGFILE +  fi +} +# your script goes here +while getopts ":c:d:w:e:h" options +do +case $options in +c ) +  CONFIG=1 +  CONFIGFILE="$OPTARG" +  if [[ ! -e $CONFIGFILE ]] || [[ ! -s $CONFIGFILE ]]; then +    #statements +    error "$CONFIGFILE does not exist or empty!" +  fi +        ;; +e ) +  EXT="$OPTARG" +  case $EXT in +    crt|pem|cert ) +    info "Extention check complete." +    ;; +    * ) +    error "invalid certificate extention $EXT!" +    ;; +  esac +  ;; +d ) +  DIR=1 +  TARGETDIR="$OPTARG" +  [ $TARGETDIR = '' ] && error "$TARGETDIR empty variable!" +  ;; +w ) +  WRITEFILE=1 +  OUTFILE="$OPTARG" +  ;; +h ) +        usage +        ;; +\? ) +        usage +        ;; +: ) +        fatal "Argument required !!! see \'-h\' for help" +        ;; +esac +done +shift $(($OPTIND - 1)) +# +calcEndDate +#finally print the list +if [[ $WRITEFILE -eq 0 ]]; then +  #statements +  printExpiry ${expcerts[@]} +else +  printExpiry ${expcerts[@]} > $OUTFILE +fi +``` + +#### 2. genSSLcsr.sh + + +``` +#!/bin/bash - +#=============================================================================== +# +#          FILE: genSSLcsr.sh +# +#         USAGE: ./genSSLcsr.sh [options] +# +#   DESCRIPTION: ++++version 1.0.2 +#               Fixed few bugs from previous script +#               +Removing passphrase after CSR generation +#               Extended use of functions +#               Checks for valid common name +#               ++++1.0.3 +#               Fixed line breaks +#               Work directory to be created at the start +#               Used getopts for better code arrangements +#   ++++1.0.4 +#     Added mail feature (experimental at this time and needs +#     a mail server running locally.) +#     Added domain input and certificate subject inputs +# +#       OPTIONS: --- +#  REQUIREMENTS: openssl, mailx +#          BUGS: --- +#         NOTES: --- +#        AUTHOR: Abhishek Tamrakar (), [abhishek.tamrakar08@gmail.com][7] +#  ORGANIZATION: Self +#       CREATED: 6/24/2016 +#      REVISION: 4 +# COPYRIGHT AND +#       LICENSE: Copyright (C) 2016 Abhishek Tamrakar +# +#  Licensed under the Apache License, Version 2.0 (the "License"); +#  you may not use this file except in compliance with the License. +#  You may obtain a copy of the License at +# +#       +# +#   Unless required by applicable law or agreed to in writing, software +#   distributed under the License is distributed on an "AS IS" BASIS, +#   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +#   See the License for the specific language governing permissions and +#   limitations under the License. +#=============================================================================== + +#variables ges here +#set basename to scriptname +SCRIPT=${0##*/} + +#set flags +TFOUND=0 +CFOUND=0 +MFOUND=0 +XFOUND=0 +SFOUND=0 +logdir=/var/log +# edit these below values to replace with yours +homedir='' +yourdomain='' +country=IN +state=Maharashtra +locality=Pune +organization="your_organization" +organizationalunit="your_organizational_unit" +email=your_email@your_domain +password=your_ssl_password +# OS is declared and will be used in its next version +OS=$(egrep -io 'Redhat|centos|fedora|ubuntu' /etc/issue) + +### function declarations ### + +info() +{ +  printf '\n%s\t%s\t' "INFO" "$@" +} + +#exit on error with a custom error message +#the extra function was removed and replaced withonly one. +#using FAILED\n\e<message> is a way but not necessarily required. +# + +fatal() +{ + printf '\n%s\t%s\n' "ERROR" "$@" + exit 1 +} + +checkperms() +{ +if [[ -z ${homedir} ]]; then +homedir=$(pwd) +fi +if [[ -w ${homedir} ]]; then +info "Permissions acquired for ${SCRIPT} on ${homedir}." +else +fatal "InSufficient permissions to run the ${SCRIPT}." +fi +} + +checkDomain() +{ +info "Initializing Domain ${cn} check ? " +if [[ ! -z ${yourdomain} ]]; then +workdir=${homedir}/${yourdomain} +echo -e "${cn}"|grep -E -i -q "${yourdomain}$" && echo -n "[OK]" || fatal "InValid domain in ${cn}" +else +workdir=${homedir}/${cn#*.} +echo -n "[NULL]" +info "WARNING: No domain declared to check." +confirmUserAction +fi +}       # end function checkDomain + +usage() +{ +cat << EOF + +Usage:  $SCRIPT [options] -[cdmshx] +  [-c (common name)] +  [-d (domain name)] +  [-s (SSL certificate subject)] +  [-p (password)] +  [-m (email address)] *(Experimental) +  [-r (remove pasphrase) default:true] +  [-h (help)] +  [-x (optional)] + +[OPTIONS] +  -c|   Sets the value for common name. +        A valid common name is something that ends with 'xyz.com' + +  -d|   Sets the domain name. + +  -s|   Sets the subject to be applied to the certificates. +        '/C=country/ST=state/L=locality/O=organization/OU=organizationalunit/emailAddress=email' + +  -p|   Sets the password for private key. + +  -r|   Sets the value of remove passphrase. +        true:[default] passphrase will be removed from key. +        false: passphrase will not be removed and key wont get printed. + +  -m|   Sets the mailing capability to the script. +        (Experimental at this time and requires a lot of work) + +  -x|   Creates the certificate request and key but do not print on screen. +        To be used when script is used just to create the key and CSR with no need +        + to generate the certficate on the go. + +  -h|   Displays the usage. No further functions are performed. + +  Example: $SCRIPT -c mywebsite.xyz.com -m [myemail@mydomain.com][6] + +EOF +exit 1 +}       # end usage + +confirmUserAction() { +while true; do +read -p "Do you wish to continue? ans: " yn +case $yn in +[Yy]* ) info "Initiating the process"; +break;; +[Nn]* ) exit 1;; +* ) info "Please answer yes or no.";; +esac +done +}       # end function confirmUserAction + +parseSubject() +{ +  local subject="$1" +  parsedsubject=$(echo $subject|sed 's/\// /g;s/^ //g') +  for i in ${parsedsubject}; do +      case ${i%=*} in +        'C' ) +        country=${i##*=} +        ;; +        'ST' ) +        state=${i##*=} +        ;; +        'L' ) +        locality=${i##*=} +        ;; +        'O' ) +        organization=${i##*=} +        ;; +        'OU' ) +        organizationalunit=${i##*=} +        ;; +        'emailAddress' ) +        email=${i##*=} +      ;; +    esac +  done +} + +sendMail() +{ + mailcmd=$(which mailx) + if [[ x"$mailcmd" = "x" ]]; then +   fatal "Cannot send email! please install mailutils for linux" + else +   echo "SSL CSR attached." | $mailcmd -s "SSL certificate request" \ +   -t $email $ccemail -A ${workdir}/${cn}.csr \ +   && info "mail sent" \ +   || fatal "error in sending mail." + fi +} + +genCSRfile() +{ +info "Creating signed key request for ${cn}" +#Generate a key +openssl genrsa -des3 -passout pass:$password -out ${workdir}/${cn}.key 4096 -noout 2>/dev/null && echo -n "[DONE]" || fatal "unable to generate key" + +#Create the request +info "Creating Certificate request for ${cn}" +openssl req -new -key ${workdir}/${cn}.key -passin pass:$password -sha1 -nodes \ +        -subj "/C=$country/ST=$state/L=$locality/O=$organization/OU=$organizationalunit/CN=$cn/emailAddress=$email" \ +        -out ${workdir}/${cn}.csr && echo -n "[DONE]" || fatal "unable to create request" + +if [[ "${REMOVEPASSPHRASE:-true}" = 'true' ]]; then +  #statements +  #Remove passphrase from the key. Comment the line out to keep the passphrase +  info "Removing passphrase from ${cn}.key" +  openssl rsa -in ${workdir}/${cn}.key \ +  -passin pass:$password \ +  -out ${workdir}/${cn}.insecure 2>/dev/null \ +  && echo -n "[DONE]" || fatal "unable to remove passphrase" +  #swap the filenames +  info "Swapping the ${cn}.key to secure" +  mv ${workdir}/${cn}.key ${workdir}/${cn}.secure \ +  && echo -n "[DONE]" || fatal "unable to perfom move" +  info "Swapping insecure key to ${cn}.key" +  mv ${workdir}/${cn}.insecure ${workdir}/${cn}.key \ +  && echo -n "[DONE]" || fatal "unable to perform move" +else +  info "Flag '-r' is set, passphrase will not be removed." +fi +} + +printCSR() +{ +if [[ -e ${workdir}/${cn}.csr ]] && [[ -e ${workdir}/${cn}.key ]] +then +echo -e "\n\n----------------------------CSR-----------------------------" +cat ${workdir}/${cn}.csr +echo -e "\n----------------------------KEY-----------------------------" +cat ${workdir}/${cn}.key +echo -e "------------------------------------------------------------\n" +else +fatal "CSR or KEY generation failed !!" +fi +} + +### END Functions ### + +#Check the number of arguments. If none are passed, print help and exit. +NUMARGS=$# +if [ $NUMARGS -eq 0 ]; then +fatal "$NUMARGS Arguments provided !!!! See usage with '-h'" +fi + +#Organisational details + +while getopts ":c:d:sⓂ️p:rhx" atype +do +case $atype in +c ) +        CFOUND=1 +        cn="$OPTARG" +        ;; +d ) +  yourdomain="$OPTARG" +  ;; +s ) +  SFOUND=1 +  subj="$OPTARG" +  ;; +p ) +  password="$OPTARG" +  ;; +r ) +  REMOVEPASSPHRASE='false' +  ;; +m ) +  MFOUND=1 +  ccemail="$OPTARG" +  ;; +x ) +        XFOUND=1 +  ;; +h ) +        usage +        ;; +\? ) +        usage +        ;; +: ) +        fatal "Argument required !!! see \'-h\' for help" +        ;; +esac +done +shift $(($OPTIND - 1)) + +#### END CASE #### START MAIN #### + +if [ $CFOUND -eq 1 ] +then +# take current dir as homedir by default. +checkperms ${homedir} +checkDomain + +  if [[ ! -d ${workdir} ]] +  then +    mkdir ${workdir:-${cn#*.}} 2>/dev/null && info "${workdir} created." +  else +    info "${workdir} exists." +  fi # end workdir check +  parseSubject "$subj" +  genCSRfile +  if [ $XFOUND -eq 0 ] +  then +    sleep 2 +    printCSR +  fi    # end x check +  if [[ $MFOUND -eq 1 ]]; then +    sendMail +  fi +else +        fatal "Nothing to do!" +fi      # end common name check + +##### END MAIN ##### +``` + +* * * + +_This was originally published as the README in [ssl-on-demand's GitHub repository][4] and is reused with permission._ + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/2/ssl-demand + +作者:[Abhishek Tamrakar][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/tamrakar +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/security-lock-password.jpg?itok=KJMdkKum (Lock) +[2]: https://opensource.com/alternatives/slack +[3]: https://opensource.com/article/19/1/what-certificate +[4]: https://github.com/abhiTamrakar/ssl-on-demand +[5]: https://en.wikipedia.org/wiki/Certificate_signing_request +[6]: mailto:myemail@mydomain.com +[7]: mailto:abhishek.tamrakar08@gmail.com diff --git a/sources/tech/20200214 How to restore a single-core computer with Linux.md b/sources/tech/20200214 How to restore a single-core computer with Linux.md new file mode 100644 index 0000000000..a88a2c157d --- /dev/null +++ b/sources/tech/20200214 How to restore a single-core computer with Linux.md @@ -0,0 +1,270 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How to restore a single-core computer with Linux) +[#]: via: (https://opensource.com/article/20/2/restore-old-computer-linux) +[#]: author: (Howard Fosdick https://opensource.com/users/howtech) + +How to restore a single-core computer with Linux +====== +Let's have some geeky fun refurbishing your prehistoric Pentium with +Linux and open source. +![Two animated computers waving one missing an arm][1] + +In a [previous article][2], I explained how I refurbish old dual-core computers ranging from roughly five to 15 years old. Properly restored, these machines can host a fully capable lightweight Linux distribution like [Mint/Xfce][3], [Xubuntu][4], or [Lubuntu][5] and perform everyday tasks. But what if you have a really old computer gathering dust in your attic or basement? Like a Pentium 4 desktop or Pentium M laptop? Yikes! Can you even do anything with a relic like that? + +### Why restore a relic? + +For starters, you might learn a bit about hardware and open source software by refurbishing it. And you could have some fun along the way. Whether you can make much use of it depends on your expectations. + +A single-core computer can perform well for a specific purpose. For example, my friend created a dandy retro gaming box (like I describe below) that runs hundreds of Linux and old Windows and DOS games. His kids love it! + +Another friend uses his Pentium 4 for running design spreadsheets in his workshop. He finds it convenient to have a dedicated machine tucked into a corner of his shop. He likes that he doesn't have to worry about heat or dust ruining an expensive modern computer. + +My romance author acquaintance employs her Pentium M as a "novelist's workstation" lodged in her cozy attic hideaway. The laptop functions as her private word processor. + +I've used old computers to teach beginners how to build and repair hardware. Old equipment makes the best testbed because it's expendable. If someone makes a mistake and fries a board, it doesn't much matter. (Contrast this to how you would feel if you wrecked your main computer!) + +The web suggests many [other potential uses][6] for old Pentiums: security cam monitors, network-attached storage (NAS) servers, [SETI][7] boxes, torrent servers, anonymous [Tails][8] servers, Bitcoin miners, programming workstations, thin clients, terminal emulators, routers, file servers, and more. To me, many of these applications sound more like fun projects than practical uses for single-core computers. That doesn't mean they aren't worth your while; it's just that you want to be clear-eyed about any project you take on. + +By current standards, P-4s and Ms are terribly [weak processors][9]. For example, using them for web surfing is problematic because webpage size and programming complexity have [grown exponentially][10]. And the open web is closing—increasingly, sites won't allow you access unless you let them run all those ads that can overwhelm old processors. (I'll discuss web surfing performance tricks later in this article.) Another shortcoming of old computers is their energy consumption. Better electricity-to-performance ratios often make newer computers more sensible. This especially true when a [tablet or smartphone][11] can fulfill your needs. + +Nevertheless, you can still have fun and learn a lot by tinkering with an old P-4 or M. They're great educational tools, they're expendable, and they can be useful in dedicated roles. Best of all, you can get them for free. I'll tell you how. + +Still reading? Okay, let's have some geeky fun refurbishing your prehistoric Pentium. + +### Understand hardware evolution + +As a quick level-set, here are the common names for the P-4 and M class processors and their rough dates of manufacture: + +**Desktops (2000-2008)** + + * Pentium 4 + * Pentium 4 HT (Hyper-Threading) + * Pentium 4 EE (Extreme Edition) + + + +**Desktops (2005-2008)** + + * Pentium D (early dual-core) + + + +**Mobile (2002-2008)** + + * Pentium M + * Pentium 4-M + * Mobile Pentium 4 + * Mobile Pentium 4 HT + + + +Sources: Wikipedia (for the [P-4][12], [P-M][13], and [processor][14] lists), [CPU World,][15] [Revolvy][16]. + +Machines hosting these processors typically use either DDR2 or DDR memory. Dual-core processors entered the market in 2005 and displaced single-core CPUs within a few years. I'll assume you have some version of what's in the above table. Or you might have an equivalent [AMD][17] or [Celeron][18] processor from the same era. + +The big draw of this old hardware is that you can get it for free. People consider it junk. They'll be only too glad to give you their castoffs. If you don't have a machine on hand, just ask your friends or family. Or drop by the local recycling center. Unless they have strict rules, they'll be happy to give you this old equipment. You can even advertise on [Craigslist][19], [Freecycle,][20] or [other reuse websites][21]. + +**A quick tip:** Grab more than one machine. With old hardware, you often need to cannibalize parts from several computers to build one good working one. + +### Prepare the hardware + +Before you can use your old computer, you must refurbish it. The steps to fixing it up are: + + 1. Clean it + 2. Identify what hardware you have + 3. Verify the hardware works + + + +Start by opening up the box and cleaning out the dirt. Dust causes the heat that kills electronics. A can of compressed air helps. + +Always keep yourself grounded when touching things so that you don't harm the electronics. And don't rub anything with a cleaning rag! Even a shock you can't feel can damage computer circuitry. + +While you've got the box open, learn everything you can about your hardware. Write it all down, so you remember it later: + + * Count the open memory slots, if any. Is the RAM DDR or DDR2 (or something else)? + * Read the hard drive label to learn its capacity and age. (It'll probably be an old IDE drive. You can identify IDE drives by their wide connector ribbons.) + * Check the optical drive label to see what kinds of discs it reads and/or writes, at what speed, and to what standard(s). + * Note other peripherals, add-in cards, or anything unusual. + + + +Close and boot the machine into its boot-time [BIOS][22] panels. [This list][23] tells you what program function (PF) key to press to access those startup panels for your specific computer. Now you can complete your hardware identification by rounding out the details on your processor, memory, video memory, and more. + +### Verify the hardware + +Once you know what you've got, verify that it all works. Test: + + * Memory + * Disk + * Motherboard + * Peripherals (optical drive, USB ports, sound, etc.) + + + +Run any diagnostic tests in the computer's boot or BIOS panels. Free resource kits like [Hiren's BootCD][24] or the [Ultimate Boot CD][25] can round out your testing with any diagnostics your boot panels lack. These kits offer dozens of testing programs: all are free, but not all are open source. You can boot them off a live USB or DVD so that you don't have to install anything on the computer. + +Be sure to run the "extended" or long tests for the memory and disk drive. Run tests overnight if you have to. Do this job right! If you miss a problem now, it could cause you big headaches later. + +If you find a problem, refer to my _[Quick guide to fixing hardware][26]_ to solve common issues. + +### Essential hardware upgrades + +You'll want to make two key hardware upgrades. First, increase memory to the computer's maximum. (You can find the maximum for your computer with a quick web search for its specs.) The practical minimum to run many lightweight Linux distros is 1GB RAM; 2GB or more is ideal. While the maximum allowable memory varies by the machine, the great majority of these computers will upgrade to at least 2GB. + +Second—if the desktop doesn't already have one—add a video card. This offloads graphics processing from the motherboard to the video card and increases the computer's video memory. Bumping up the VRAM from 32 or 64MB to 256GB or more greatly increases the range of applications an old computer can run. Especially if you want to run games. + +Be sure the video card fits your computer's [video slot][27] (AGP, PCI, or PCI-Express) and has the right [cable connector][28] (VGA or DVI). You can issue a couple of [Linux line commands][29] to see how much VRAM your system has, or look in the BIOS boot panels. + +These two simple upgrade hacks—increasing memory and video power—take a marginal machine and make it _way_ more functional. Your goal is to build the most powerful P-4 or M ever. That way, you can squeeze the most performance from this aging design. + +The good news is that with the old computers we're talking about, you can get any parts you need for free. Just cannibalize them from other discarded PC's. + +### Select the software + +Choosing the right software for a P-4 or M is critical. [Don't][30] use an [unsupported][31] Windows version just because it's already on the PC; malware might plague you if you do. A fresh install is mandatory. + +Open source software is the way to go. [Many][32] Linux [distributions][33] are specifically designed for older computers. And with Linux, you can install, move, copy, and clone the operating system and its apps at will. This makes your job easier: You won't run into activation or licensing issues, and it's all free. + +Which distribution should you pick? Assuming you have at least 2GB of memory, start your search by trying a _lightweight distribution_—these feature resource-stingy [desktop environments][34]. Xfce or LXQt are excellent desktop environment choices. Products that [consume more resources][35] or produce fancier graphics—like Unity, GNOME, KDE, MATE, and Cinnamon—won't perform well. + +The lightweight Linux distros I've enjoyed success with are Mint/Xfce, Xubuntu, and Lubuntu. The first two use Xfce while Lubuntu employs LXQt. You can find [many other][36] excellent candidate distros beyond these three choices that I can vouch for. + +Be sure to download the 32-bit versions of the operating systems; 64-bit versions don't make much sense unless a computer has at least 4GB of memory. + +The lightweight Linux distros I've cited offer friendly menus and feature huge software repositories backed by active forums. They'll enable your old computer to do everything it's capable of. However, they won't run on every computer from the P-4 era. If one of these products runs on your computer and you like it, great! You've found your distro. + +If your computer doesn't perform well with these selections, won't boot, or you have less than 2GB of memory, try an _ultralight distribution_. Ultralights reduce resource use by replacing desktop environments with [window managers][37] like Fluxbox, FLWM, IceWM, JWM, or Openbox. Window managers use fewer resources than desktop environments. The trade-off is that they're less flexible. As an example, you may have to dip into code to alter your desktop or taskbar icons. + +My go-to ultralight distro is [Puppy Linux][38]. It comes in several variants that run well on Pentium 4's and M's with only 1GB of memory. Puppy's big draw is that it has versions designed specifically for older computers. This means you'll avoid the hassles you might run into with other distros. For example, Puppy versions run on old CPUs that don't support features like PAE or SSE3. They'll even help you run an older kernel or obsolete bootstrap program if your hardware requires it. + +And Puppy runs _fast_ on limited-resource computers! It optimizes performance by loading the operating system entirely into memory to avoid slow disk access. It bundles a full range of apps that have been carefully selected to use minimal hardware resources. + +Puppy is also user-friendly. Even a naive end user can use its simple menus and attractive desktop. But be advised—it takes expertise to install and configure the product. You might have to spend some time on Puppy's [forum][39] to get oriented. The forum is especially useful because many who post there work with old computers. + +A fun alternative to Puppy is [Tiny Core][40] Linux. With Tiny Core, you install only the software components you want. So you build up your environment from the absolute minimum. This takes time but results in a lean, mean system. Tiny Core is perfect for creating a dedicated server. It's a great learning tool, too, so check out its [free eBook][41]. + +If you want a quick, no-hassles install, you might try [antiX][42]. It's Debian-based, offers a selection of lightweight interfaces, and runs well on machines with only a gigabyte of memory. I've had excellent results installing antiX on a variety of old PCs. + +_**Caution:**_ Many distros casually claim that they run on "old computers" when they really mean that they run on _limited-resource computers_. There's a big difference. Old computers sometimes do not support all the CPU features required by newer operating systems. Avoid problems by selecting a Linux proven to run on your hardware. + +Don't know if a distro will run on your box? Save yourself some time by posting a message on the distro's forum and asking for responses from folks using hardware like yours. You should receive some success stories. If nobody can say they've done what you're trying to do, I'd avoid that product. + +### How to use your refurbished computer + +Will you be happy using your restored PC? It depends on what you expect. + +People who use aging systems learn to leverage minimal resources. For example, they run resource-stingy programs like GNOME Office in place of LibreOffice. They forgo CPU-intense programs like emulators, graphics-heavy apps, video processing, and virtual machine hosting. They focus on one task at a time and don't expect much concurrency. And they know how to manage machine resources proactively. + +Old hardware can perform well in dedicated situations. Earlier, I mentioned my friends who use their old computers for design spreadsheets and as a writer's workbench. And I wrote this article on my personal retro box—a Dell GX280 desktop with a Pentium 4 at 3.2GHz, with 2GB DDR-2 RAM and two 40GB IDE disks, dual-booting Puppy and antiX. + +#### Create a retro game box + +You can also create a fantastic retro game box. First, install an appropriate distro. Then install [Wine][43], a program designed to run Windows software on Linux. Now you'll be able to run nearly all your old Windows XP, ME/98/95, and 3.1 games. [DOSBox][44] supports tons more [free DOS games][45]. And Linux offers over a thousand more. + +I've enjoyed nostalgic fun on a P-4 running antiX and all the old games I remember from years ago. Just be sure you've maxed out system memory and added a good video card for the best results. + +#### Access the web + +The big challenge with old computers is web surfing. [This study][46] claims that average website size has increased 100% over a three-year period, while [this article][47] tells how bloated news sites have become. Videos, animation, images, trackers, ad requests—they all make websites slower than just a few years ago. + +Worse, websites increasingly refuse you access unless you allow them to run their ads. This is a problem because the ads can overwhelm old CPUs. In fact, for most websites, the resources required to run ads and trackers are _way_ greater than that required for the actual website content. + +Here are the performance tricks you need to know if you web surf with an older computer: + + * Run the fastest, lightest browser possible. Chrome, Firefox, and Opera are probably the top mainstream offerings. + * Try alternative [minimalist browsers][48] to see if they can meet your needs: [Dillo][49], [NetSurf][50], [Dooble][51], [Lynx][52], [Links][53], or others. + * Actively manage your browser. + * Don't open many browser tabs. + * Manually start and stop processing in specific tabs. + * Block ads and trackers: + * Offload this chore to your virtual private network (VPN) if at all possible. + * Otherwise, use a browser extension. + * Don't slow down your browser by installing add-ons or extensions beyond the minimum required. + * Disable autoplay for videos and Flash. + * Toggle JavaScript off and on. + * Ensure the browser renders text before graphics. + * Don't run background tasks while web surfing. + * Manually clear cookies to avoid page-access limits on some websites. + * Linux means you don't have to run real-time anti-malware (which consumes a CPU core on many Windows PCs). + + + +Employing some of these tricks, I happily use refurbished dual-core computers for all my web surfing. But with today's internet, I find single-core processors inadequate for anything beyond the occasional web lookup. In other words, they're acceptable for _web access_ but insufficient for _web surfing_. That's just my opinion. Yours may vary depending on your expectations and the nature of your web activity. + +### Enjoy free educational fun + +However you use your refurbished P-4 or M, you'll know a lot more about computer hardware and open source software than when you started. It won't cost you a penny, and you'll have some fun along the way! + +Please share your own refurbishing experiences in the comments. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/2/restore-old-computer-linux + +作者:[Howard Fosdick][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/howtech +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/rh_003499_01_other11x_cc.png?itok=I_kCDYj0 (Two animated computers waving one missing an arm) +[2]: http://opensource.com/article/19/7/how-make-old-computer-useful-again +[3]: http://linuxmint.com/ +[4]: https://xubuntu.org/ +[5]: http://lubuntu.me/ +[6]: http://www.google.com/search?q=uses+for+a+pentium+IV +[7]: https://en.wikipedia.org/wiki/Search_for_extraterrestrial_intelligence +[8]: https://en.wikipedia.org/wiki/Tails_(operating_system) +[9]: http://www.cpubenchmark.net/low_end_cpus.html +[10]: http://www.digitaltrends.com/web/internet-is-getting-slower/ +[11]: https://www.forbes.com/sites/christopherhelman/2013/09/07/how-much-energy-does-your-iphone-and-other-devices-use-and-what-to-do-about-it/#ba4918e2f702 +[12]: https://en.wikipedia.org/wiki/Pentium_4 +[13]: https://en.wikipedia.org/wiki/Pentium_M +[14]: https://en.wikipedia.org/wiki/List_of_Intel_Pentium_4_microprocessors +[15]: http://www.cpu-world.com/CPUs/Pentium_4/index.html +[16]: https://www.revolvy.com/page/List-of-Intel-Pentium-4-microprocessors?cr=1 +[17]: https://en.wikipedia.org/wiki/List_of_AMD_microprocessors +[18]: https://en.wikipedia.org/wiki/Celeron +[19]: https://www.craigslist.org/about/sites +[20]: https://www.freecycle.org/ +[21]: https://alternativeto.net/software/freecycle/ +[22]: http://en.wikipedia.org/wiki/BIOS +[23]: http://www.disk-image.com/faq-bootmenu.htm +[24]: http://www.hirensbootcd.org/download/ +[25]: http://www.ultimatebootcd.com/ +[26]: http://www.rexxinfo.org/Quick_Guide/Quick_Guide_To_Fixing_Computer_Hardware +[27]: http://www.playtool.com/pages/vidslots/slots.html +[28]: https://silentpc.com/articles/video-connectors +[29]: https://www.cyberciti.biz/faq/howto-find-linux-vga-video-card-ram/ +[30]: https://fusetg.com/dangers-running-unsupported-operating-system/ +[31]: http://home.bt.com/tech-gadgets/computing/windows-7/windows-7-support-end-11364081315419 +[32]: https://itsfoss.com/lightweight-linux-beginners/ +[33]: https://fossbytes.com/best-lightweight-linux-distros/ +[34]: https://en.wikipedia.org/wiki/Desktop_environment +[35]: http://www.phoronix.com/scan.php?page=article&item=ubu-1704-desktops&num=3 +[36]: https://www.google.com/search?ei=TfIoXtG5OYmytAbl04z4Cw&q=best+lightweight+linux+distros+for+old+computers&oq=best+lightweight+linux+distros+for+old&gs_l=psy-ab.1.0.0i22i30l8j0i333.6806.8527..10541...2.2..0.159.1119.2j8......0....1..gws-wiz.......0i71j0.a6LTmaIXan0 +[37]: https://en.wikipedia.org/wiki/X_window_manager +[38]: http://puppylinux.com/ +[39]: http://murga-linux.com/puppy/ +[40]: http://tinycorelinux.net/ +[41]: http://tinycorelinux.net/book.html +[42]: http://antixlinux.com/ +[43]: https://www.winehq.org/ +[44]: https://en.wikipedia.org/wiki/DOSBox +[45]: https://www.dosgamesarchive.com/ +[46]: https://www.digitaltrends.com/web/internet-is-getting-slower/ +[47]: https://www.forbes.com/sites/kalevleetaru/2016/02/06/why-the-web-is-so-slow-and-what-it-tells-us-about-the-future-of-online-journalism/#34475c2072f4 +[48]: http://en.wikipedia.org/wiki/Comparison_of_lightweight_web_browsers +[49]: http://www.dillo.org/ +[50]: http://www.netsurf-browser.org/ +[51]: http://textbrowser.github.io/dooble/ +[52]: http://lynx.browser.org/ +[53]: http://en.wikipedia.org/wiki/Links_%28web_browser%29 diff --git a/sources/tech/20200217 Automating unit tests in test-driven development.md b/sources/tech/20200217 Automating unit tests in test-driven development.md new file mode 100644 index 0000000000..fc3971effe --- /dev/null +++ b/sources/tech/20200217 Automating unit tests in test-driven development.md @@ -0,0 +1,69 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Automating unit tests in test-driven development) +[#]: via: (https://opensource.com/article/20/2/automate-unit-tests) +[#]: author: (Alex Bunardzic https://opensource.com/users/alex-bunardzic) + +Automating unit tests in test-driven development +====== +What unit tests have in common with carpentry. +![gears and lightbulb to represent innovation][1] + +DevOps is a software engineering discipline focused on minimizing the lead time to achieve a desired business impact. While business stakeholders and sponsors have ideas on how to optimize business operations, those ideas need to be validated in the field. This means business automation (i.e., software products) must be placed in front of end users and paying customers. Only then will the business confirm whether the initial idea for improvement was fruitful or not. + +Software engineering is a budding discipline, and it can get difficult to ship products that are defect-free. For that reason, DevOps resorts to maximizing automation. Any repeatable chore, such as testing implemented changes to the source code, should be automated by DevOps engineers. + +This article looks at how to automate unit tests. These tests are focused on what I like to call "programming in the small." Much more important test automation (the so-called "programming in the large") must use a different discipline—integration testing. But that's a topic for another article. + +### What is a unit? + +When I'm teaching approaches to unit testing, often, my students cannot clearly determine what a testable unit is. Which is to say, the granularity of the processing is not always clear. + +I like to point out that the easiest way to spot a valid unit is to think of it as a _unit of behavior_. For example (albeit a trivial one), when an authenticated customer begins online shopping, the unit of behavior is a cart that has zero items in it. Once we all agree that an empty shopping cart has zero items in it, we can focus on automating the unit test that will ensure that such a shopping cart always returns zero items. + +### What is not a unit? + +Any processing that involves more than a single behavior should not be viewed as a unit. For example, if shopping cart processing results in tallying up the number of items in the cart AND calculating the order total AND calculating sales tax AND calculating the suggested shipping method, that behavior is not a good candidate for unit testing. Such behavior is a good candidate for integration testing. + +### When to write a unit test + +There is a lot of debate about when to write a unit test. Received wisdom states that once the code has been written, it is a good idea to write automated scripts that will assert whether the implemented unit of behavior delivers functionality as expected. Not only does such a unit test (or a few unit tests) document the expected behavior, the collection of all unit tests ensures that future changes will not degrade quality. If a future change adversely affects the already implemented behavior, one or more unit tests will complain, which will alert developers that regression has occurred. + +There is another way to look at software engineering. It is based on the traditional adage "measure twice, cut once." In that light, writing code before writing tests would be equivalent to cutting a part of some product (say, a chair leg) and measuring it only after it's cut. If the craftsperson doing the cutting is very skilled, that approach may work (kind of). But more likely than not, the chair legs cut this way would end up with unequal lengths. So, it is advisable to measure before cutting. What that means for the practice of software engineering is that the measurements are expressed in the unit tests. Once we measure the required values, we create a blueprint (a unit test). That blueprint is then used to guide the cutting of the code. + +Common sense would suggest that it is more reasonable to measure first and, only then, do the cutting. According to that line of reasoning, writing unit tests before writing code is a recommended way to do proper software engineering. Technically speaking, this "measure twice, cut once" approach is called a "test-first" approach. The opposite approach, where we write the code first, is called "test-later." The test-first approach is the approach advocated by [test-driven development][2] (TDD) methodology. Writing tests later is called test-later development (TLD). + +### Why is TLD harmful? + +Cutting before measuring is not recommended. Even the most talented craftspeople will eventually make mistakes by cutting without doing so. A lack of measurement will eventually catch up with even the most experienced of us as we continue in our craft. So it's best to produce a blueprint (i.e., measurements) before cutting. + +But that's not the only reason why the TLD approach is considered harmful. When we write code, we're simultaneously considering two separate concerns: the expected behavior of the code and the optimal structure of the code. These two concerns are very dissimilar. That fact makes it very challenging to do a proper job satisfying the expectations regarding both the desired behavior and the optimal (or at the very least, decent) code structure. + +The TDD approach solves this conundrum by focusing undivided attention first on the expected desired behavior. We start by writing the unit test. In that test, we focus on _what_ we expect to happen. At this point, we don't care, in the least, _how_ the expected behavior is going to materialize. + +Once we're done describing the _what_ (i.e., what manifest behavior are we expecting from the unit we are about to build?), we watch that expectation fail. It fails because the code that is concerned with _how_ the expected behavior is going to happen hasn't materialized yet. Now we are compelled to write the code that's going to take care of the _how_. + +After we write the code responsible for how, we run the unit test(s) and see if the code we just wrote fulfills the expected behavior. If it does, we're done. Time to move on to fulfilling the next expectation. If it doesn't, we continue transforming the code until it succeeds in passing the test. + +If we choose not to do TDD, but write code first and later write the unit test, we miss the opportunity to separate _what_ from _how_. In other words, we write the code while simultaneously taking care of what we expect the code to do _and_ how to structure the code to do it correctly. + +As such, writing unit tests after we write code is considered harmful. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/2/automate-unit-tests + +作者:[Alex Bunardzic][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/alex-bunardzic +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/innovation_lightbulb_gears_devops_ansible.png?itok=TSbmp3_M (gears and lightbulb to represent innovation) +[2]: https://opensource.com/article/20/1/test-driven-development diff --git a/sources/tech/20200217 Create web user interfaces with Qt WebAssembly instead of JavaScript.md b/sources/tech/20200217 Create web user interfaces with Qt WebAssembly instead of JavaScript.md new file mode 100644 index 0000000000..bc61dab48d --- /dev/null +++ b/sources/tech/20200217 Create web user interfaces with Qt WebAssembly instead of JavaScript.md @@ -0,0 +1,133 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Create web user interfaces with Qt WebAssembly instead of JavaScript) +[#]: via: (https://opensource.com/article/20/2/wasm-python-webassembly) +[#]: author: (Stephan Avenwedde https://opensource.com/users/hansic99) + +Create web user interfaces with Qt WebAssembly instead of JavaScript +====== +Get hands-on with Wasm, PyQt, and Qt WebAssembly. +![Digital creative of a browser on the internet][1] + +When I first heard about [WebAssembly][2] and the possibility of creating web user interfaces with Qt, just like I would in ordinary C++, I decided to take a deeper look at the technology. + +My open source project [Pythonic][3] is completely Python-based (PyQt), and I use C++ at work; therefore, this minimal, straightforward WebAssembly tutorial uses Python on the backend and C++ Qt WebAssembly for the frontend. It is aimed at programmers who, like me, are not familiar with web development. + +![Header Qt C++ frontend][4] + +### TL;DR + + +``` +git clone  + +cd wasm_qt_example + +python mysite.py +``` + +Then visit with your favorite browser. + +### What is WebAssembly? + +WebAssembly (often shortened to Wasm) is designed primarily to execute portable binary code in web applications to achieve high-execution performance. It is intended to coexist with JavaScript, and both frameworks are executed in the same sandbox. [Recent performance benchmarks][5] showed that WebAssembly executes roughly 10–40% faster,  depending on the browser, and given its novelty, we can still expect improvements. The downside of this great execution performance is its widespread adoption as the preferred malware language. Crypto miners especially benefit from its performance and harder detection of evidence due to its binary format. + +### Toolchain + +There is a [getting started guide][6] on the Qt wiki. I recommend sticking exactly to the steps and versions mentioned in this guide. You may need to select your Qt version carefully, as different versions have different features (such as multi-threading), with improvements happening with each release. + +To get executable WebAssembly code, simply pass your Qt C++ application through [Emscripten][7]. Emscripten provides the complete toolchain, and the build script couldn't be simpler: + + +``` +#!/bin/sh +source ~/emsdk/emsdk_env.sh +~/Qt/5.13.1/wasm_32/bin/qmake +make +``` + +Building takes roughly 10 times longer than with a standard C++ compiler like Clang or g++. The build script will output the following files: + + * WASM_Client.js + * WASM_Client.wasm + * qtlogo.svg + * qtloader.js + * WASM_Client.html + * Makefile (intermediate) + + + +The versions on my (Fedora 30) build system are: + + * emsdk: 1.38.27 + * Qt: 5.13.1 + + + +### Frontend + +The frontend provides some functionalities based on [WebSocket][8]. + +![Qt-made frontend in browser][9] + + * **Send message to server:** Send a simple string message to the server with a WebSocket. You could have done this also with a simple HTTP POST request. + * **Start/stop timer:** Create a WebSocket and start a timer on the server to send messages to the client at a regular interval. + * **Upload file:** Upload a file to the server, where the file is saved to the home directory (**~/**) of the user who runs the server. + + + +If you adapt the code and face a compiling error like this: + + +``` +error: static_assert failed due to + requirement ‘bool(-1 == 1)’ “Required feature http for file + ../../Qt/5.13.1/wasm_32/include/QtNetwork/qhttpmultipart.h not available.” +QT_REQUIRE_CONFIG(http); +``` + +it means that the requested feature is not available for Qt Wasm. + +### Backend + +The server work is done by [Eventlet][10]. I chose Eventlet because it is lightweight and easy to use. Eventlet provides WebSocket functionality and supports threading. + +![Decorated functions for WebSocket handling][11] + +Inside the repository under **mysite/template**, there is a symbolic link to **WASM_Client.html** in the root path. The static content under **mysite/static** is also linked to the root path of the repository. If you adapt the code and do a recompile, you just have to restart Eventlet to update the content to the client. + +Eventlet uses the Web Server Gateway Interface for Python (WSGI). The functions that provide the specific functionality are extended with decorators. + +Please note that this is an absolute minimum server implementation. It doesn't implement any multi-user capabilities — every client is able to start/stop the timer, even for other clients. + +### Conclusion + +Take this example code as a starting point to get familiar with WebAssembly without wasting time on minor issues. I don't make any claims for completeness nor best-practice integration. I walked through a long learning curve until I got it running to my satisfaction, and I hope this gives you a brief look into this promising technology. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/2/wasm-python-webassembly + +作者:[Stephan Avenwedde][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/hansic99 +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/browser_web_internet_website.png?itok=g5B_Bw62 (Digital creative of a browser on the internet) +[2]: https://webassembly.org/ +[3]: https://github.com/hANSIc99/Pythonic +[4]: https://opensource.com/sites/default/files/uploads/cpp_qt.png (Header Qt C++ frontend) +[5]: https://pspdfkit.com/blog/2018/a-real-world-webassembly-benchmark/ +[6]: https://wiki.qt.io/Qt_for_WebAssembly#Getting_Started +[7]: https://emscripten.org/docs/introducing_emscripten/index.html +[8]: https://en.wikipedia.org/wiki/WebSocket +[9]: https://opensource.com/sites/default/files/uploads/wasm_frontend.png (Qt-made frontend in browser) +[10]: https://eventlet.net/ +[11]: https://opensource.com/sites/default/files/uploads/python_backend.png (Decorated functions for WebSocket handling) diff --git a/sources/tech/20200218 10 Grafana features you need to know for effective monitoring.md b/sources/tech/20200218 10 Grafana features you need to know for effective monitoring.md new file mode 100644 index 0000000000..92f1cc3455 --- /dev/null +++ b/sources/tech/20200218 10 Grafana features you need to know for effective monitoring.md @@ -0,0 +1,69 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (10 Grafana features you need to know for effective monitoring) +[#]: via: (https://opensource.com/article/20/2/grafana-features) +[#]: author: (Daniel Lee https://opensource.com/users/daniellee) + +10 Grafana features you need to know for effective monitoring +====== +Learn how to make the most of this open source dashboard tool. +![metrics and data shown on a computer screen][1] + +The [Grafana][2] project [started in 2013][3] when [Torkel Ödegaard][4] decided to fork Kibana and turn it into a time-series and graph-focused dashboarding tool. His guiding vision: to make everything look more clean and elegant, with fewer things distracting you from the data. + +More than 500,000 active installations later, Grafana dashboards are ubiquitous and instantly recognizable. (Even during a [SpaceX launch][5]!) + +Whether you're a recent adopter or an experienced power user, you may not be familiar with all of the features that [Grafana Labs][6]—the company formed to accelerate the adoption of the Grafana project and to build a sustainable business around it—and the Grafana community at large have developed over the past 6+ years. + +Here's a look at some of the most impactful: + + 1. **Dashboard templating**: One of the key features in Grafana, templating allows you to create dashboards that can be reused for lots of different use cases. Values aren't hard-coded with these templates, so for instance, if you have a production server and a test server, you can use the same dashboard for both. Templating allows you to drill down into your data, say, from all data to North America data, down to Texas data, and beyond. You can also share these dashboards across teams within your organization—or if you create a great dashboard template for a popular data source, you can contribute it to the whole community to customize and use. + 2. **Provisioning**: While it's easy to click, drag, and drop to create a single dashboard, power users in need of many dashboards will want to automate the setup with a script. You can script anything in Grafana. For example, if you're spinning up a new Kubernetes cluster, you can also spin up a Grafana automatically with a script that would have the right server, IP address, and data sources preset and locked. It's also a way of getting control over a lot of dashboards. + 3. **Annotations:** This feature, which shows up as a graph marker in Grafana, is useful for correlating data in case something goes wrong. You can create the annotations manually—just control-click on a graph and input some text—or you can fetch data from any data source. (Check out how Wikimedia uses annotations on its [public Grafana dashboard][7], and here is [another example][8] from the OpenHAB community.) A good example is if you automatically create annotations around releases, and a few hours after a new release, you start seeing a lot of errors, then you can go back to your annotation and correlate whether the errors started at the same time as the release. This automation can be achieved using the Grafana HTTP API (see examples [here][9] and [here][10]). Many of Grafana's largest customers use the HTTP API for a variety of tasks, particularly setting up databases and adding users. It's an alternative to provisioning for automation, and you can do more with it. For instance, the team at DigitalOcean used the API to integrate a [snapshot feature for reviewing dashboards][11]. + 4. **Kiosk mode and playlists:** If you want to display your Grafana dashboards on a TV monitor, you can use the playlist feature to pick the dashboards that you or your team need to look at through the course of the day and have them cycle through on the screen. The [kiosk mode][12] hides all the user interface elements that you don't need in view-only mode. Helpful hint: The [Grafana Kiosk][13] utility handles logging in, switching to kiosk mode, and opening a playlist—eliminating the pain of logging in on a TV that has no keyboard. + 5. **Custom plugins:** Plugins allow you to extend Grafana with integrations with other tools, different visualizations, and more. Some of the most popular in the community are [Worldmap Panel][14] (for visualizing data on top of a map), [Zabbix][15] (an integration with Zabbix metrics), and [Influx Admin Panel][16] (which offers other functionality like creating databases or adding users). But they're only the tip of the iceberg. Just by writing a bit of code, you can get anything that produces a timestamp and a value visualized in Grafana. Plus, Grafana Enterprise customers have access to more plugins for integrations with Splunk, Datadog, New Relic, and others. + 6. **Alerting and alert hooks:** If you're using Grafana alerting, you can have alerts sent through a number of different notifiers, including PagerDuty, SMS, email, or Slack. Alert hooks allow you to create different notifiers with a bit of code if you prefer some other channels of communication. + 7. **Permissions and teams**: When organizations have one Grafana and multiple teams, they often want the ability to both keep things separate and share dashboards. Early on, the default in Grafana was that everybody could see everyone else's dashboards, and that was it. Later, Grafana introduced multi-tenant mode, in which you can switch organizations but can't share dashboards. Some people were using huge hacks to enable both, so Grafana decided to officially create an easier way to do this. Now you can create a team of users and then set permissions on folders, dashboards, and down to the data source level if you're using Grafana Enterprise. + 8. **SQL data sources:** Grafana's native support for SQL helps you turn anything—not just metrics—in an SQL database into metric data that you can graph. Power users are using SQL data sources to do a whole bunch of interesting things, like creating business dashboards that "make sense for your boss's boss," as the team at Percona put it. Check out their [presentation at GrafanaCon][17]. + 9. **Monitoring your monitoring**: If you're serious about monitoring and you want to monitor your own monitoring, Grafana has its own Prometheus HTTP endpoint that Prometheus can scrape. It's quite simple to get dashboards and statics. There's also an enterprise version in development that will offer Google Analytics-style easy access to data, such as how much CPU your Grafana is using or how long alerting is taking. + 10. **Authentication**: Grafana supports different authentication styles, such as LDAP and OAuth, and allows you to map users to organizations. In Grafana Enterprise, you can also map users to teams: If your company has its own authentication system, Grafana allows you to map the teams in your internal systems to teams in Grafana. That way, you can automatically give people access to the dashboards designated for their teams. + + + +Want to take a deeper dive? Join the [Grafana community][18], check out the [how-to section][19], and share what you think. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/2/grafana-features + +作者:[Daniel Lee][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/daniellee +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/metrics_data_dashboard_system_computer_analytics.png?itok=oxAeIEI- (metrics and data shown on a computer screen) +[2]: https://github.com/grafana/grafana +[3]: https://grafana.com/blog/2019/09/03/the-mostly-complete-history-of-grafana-ux/ +[4]: https://grafana.com/author/torkel +[5]: https://youtu.be/ANv5UfZsvZQ?t=29 +[6]: https://grafana.com/ +[7]: https://grafana.wikimedia.org/d/000000143/navigation-timing?orgId=1&refresh=5m +[8]: https://community.openhab.org/t/howto-create-annotations-in-grafana-via-rules/48929 +[9]: https://docs.microsoft.com/en-us/azure/devops/service-hooks/services/grafana?view=azure-devops +[10]: https://medium.com/contentsquare-engineering-blog/from-events-to-grafana-annotation-f35aafe8bd3d +[11]: https://youtu.be/kV3Ua6guynI +[12]: https://play.grafana.org/d/vmie2cmWz/bar-gauge?orgId=1&refresh=10s&kiosk +[13]: https://github.com/grafana/grafana-kiosk +[14]: https://grafana.com/grafana/plugins/grafana-worldmap-panel +[15]: https://grafana.com/grafana/plugins/alexanderzobnin-zabbix-app +[16]: https://grafana.com/grafana/plugins/natel-influx-admin-panel +[17]: https://www.youtube.com/watch?v=-xlchgoqkqY +[18]: https://community.grafana.com/ +[19]: https://community.grafana.com/c/howto/6 diff --git a/sources/tech/20200218 Getting started with OpenTaxSolver.md b/sources/tech/20200218 Getting started with OpenTaxSolver.md new file mode 100644 index 0000000000..b0b1ba1677 --- /dev/null +++ b/sources/tech/20200218 Getting started with OpenTaxSolver.md @@ -0,0 +1,124 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Getting started with OpenTaxSolver) +[#]: via: (https://opensource.com/article/20/2/do-your-taxes-open-source-way) +[#]: author: (Jessica Cherry https://opensource.com/users/jrepka) + +Getting started with OpenTaxSolver +====== +If you're a United States citizen, learn how to do your own state tax +returns with OpenTaxSolver. +![A document flying away][1] + +OpenTaxSolver is an open source application for US taxpayers to calculate their state and federal income tax returns. Before I get into the software, I want to share some of the information I learned when researching this article. I spent about five hours a day for a week looking into open source options for doing your taxes, and I learned about a lot more than just tax software. + +The Internal Revenue Service's (IRS's) [Use of federal tax information (FTI) in open source software][2] webpage offers a large amount of information, and it's especially relevant to anyone who may want to start their own open source tax software project. To hit the finer points: + + * Federal tax information (FTI) can be used in any open source software + * Software creators mush follow all security laws and compliance requirements + * Any such software must be supported either by a vendor or a community + * The software must be approved by the federal government + + + +One other reason researching this topic was rather difficult (but ultimately rewarding) is that, by federal law, the major tax software companies are required to provide their services for free to any person earning under $69,000 per year. About 70% of Americans fit into this category, and if you are one of them, you can check the IRS's [Free File][3] webpage for links to free filing software from well-known companies. (The IRS reminds you that "you are responsible for determining your eligibility for one of the Free File Online offers.") + +Please share this information broadly—knowledge is power, and not everyone can (or wants to) use open source software to do their taxes for reasons including: + + * Lack of computer or software access + * Low computer competence + * Age or disability + * Discomfort with doing taxes + + + +If you don't fall into any of these categories and want to do your taxes the open source way, continue reading to learn about OpenTaxSolver. + +### About OpenTaxSolver + +[OpenTaxSolver][4] is meant to be used with the IRS's [tax booklet][5], which is published yearly. This booklet provides detailed information for doing your taxes, such as rules around tax credits and write-offs. + +OpenTaxSolver cuts down on tax calculations when you fill out your tax forms and simplifies the hardest part of doing your taxes: the math. You still have to fill in your data and turn the paperwork in, but using the software means you can do it in about half of the time. Since OpenTaxSolver is running in beta, you have to double-check all of your number entries and information against the official IRS tax booklet after you use the software. + +### Download and install OpenTaxSolver + +First, [download the software][6]. There are versions for Linux, Windows, and macOS. If you're using one of the latter two, refer to the download page for installation instructions. I'm using my go-to operating system, Ubuntu Linux, which I installed by: + + 1. Downloading the TGZ file from the website + 2. Extracting it to my desktop (but you can choose any location on your computer) + 3. Clicking on **Run_taxsolve_GUI** + + + +![OpenTaxSolver installation][7] + +### Enter your tax data + +I'll walk through this example using random numbers (for obvious reasons). This walkthrough will explain how do federal taxes with OpenTaxSolver, but if you have to pay state taxes, do that before you begin your federal return. + +To do the common Federal 1040 tax return, select **US 1040**, click **Start New Return**, and start answering some basic questions about your tax situation. For this example, I selected the following itemized deductions: mortgage interest, donations, and some random itemizable write-offs. If you don't know what these are or what may apply to you, head over to the IRS website or google "itemizable write-offs." + +Next, begin entering the data from your tax documents. + +![OpenTaxSolver][8] + +![OpenTaxSolver][9] + +After you finish entering all your data and filling out the entire form, save it by clicking the **Save** button, and then click **Compute Tax** on the bottom of the screen. + +![OpenTaxSolver][10] + +### Check your return and file your taxes + +If you made any mistakes (such as mistyping something or putting an incorrect value in any field), it will show an error on the bottom of the preview after the computation finishes. + +![OpenTaxSolver preview][11] + +The preview also reports your marginal tax rate and what percentage of your income you are paying in taxes. + +![OpenTaxSolver preview][12] + +After you review the information in the preview, make any corrections, and finish your return, click **Fill-out PDF Forms**, and it will provide printable tax forms with all of your information filled in. + +![Tax return][13] + +If you entered your name, address, and social security number when entering your data, all of that information will also appear in the right places on the form. Double-check everything, print it, and mail your tax return to the IRS. + +### Final notes + +OpenTaxSolver gives you the opportunity to file your own federal and state taxes. As always, with any federal related tax information (or federal anything, for that matter), always double-check and use due diligence. I found this software very useful for expanding my knowledge about my taxes. + +The OpenTaxSolver website includes a request for contributors, so if you want to start contributing to an open source project that helps everyone, this is one I'd definitely suggest. + +And if you're someone who likes to wait until the last minute to pay your taxes, this [clock][14] tells you how much time you have until your taxes are due. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/2/do-your-taxes-open-source-way + +作者:[Jessica Cherry][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/jrepka +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/osdc_odf_1109ay.png?itok=4CqrPAjt (A document flying away) +[2]: https://www.irs.gov/privacy-disclosure/use-of-federal-tax-information-fti-in-open-source-software +[3]: https://apps.irs.gov/app/freeFile/ +[4]: http://opentaxsolver.sourceforge.net/index.html +[5]: https://www.irs.gov/pub/irs-pdf/i1040gi.pdf +[6]: http://opentaxsolver.sourceforge.net/download2019.html?button=+Download+OTS+ +[7]: https://opensource.com/sites/default/files/uploads/tax2.png (OpenTaxSolver installation) +[8]: https://opensource.com/sites/default/files/uploads/tax1.png (OpenTaxSolver) +[9]: https://opensource.com/sites/default/files/uploads/tax7.png (OpenTaxSolver) +[10]: https://opensource.com/sites/default/files/uploads/tax6.png (OpenTaxSolver) +[11]: https://opensource.com/sites/default/files/uploads/tax3.png (OpenTaxSolver preview) +[12]: https://opensource.com/sites/default/files/uploads/tax4.png (OpenTaxSolver preview) +[13]: https://opensource.com/sites/default/files/uploads/tax5.png (Tax return) +[14]: https://countdown.onlineclock.net/countdowns/taxes/ diff --git a/sources/tech/20200218 How to embed Twine stories in WordPress.md b/sources/tech/20200218 How to embed Twine stories in WordPress.md new file mode 100644 index 0000000000..5f2419aa5e --- /dev/null +++ b/sources/tech/20200218 How to embed Twine stories in WordPress.md @@ -0,0 +1,229 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How to embed Twine stories in WordPress) +[#]: via: (https://opensource.com/article/20/2/embed-twine-wordpress) +[#]: author: (Roman Lukš https://opensource.com/users/romanluks) + +How to embed Twine stories in WordPress +====== +Share your Twine 2 interactive stories on your WordPress site with the +Embed Twine plugin. +![Person drinking a hat drink at the computer][1] + +From the very beginning, I wanted the "About me" page on my WordPress website [romanluks.eu][2] to be interactive. + +At first, I experimented with Dart, a programming language developed by Google that transcompiles into JavaScript. I killed the project when I realized I was making a game instead of an "About me" page. + +A bit later, I discovered [Twine][3], an open source tool for creating interactive stories. It reminded me of the gamebooks I loved as a kid. It's so easy to create interconnected pieces of text in Twine, and it's ideal for the interview-like format I was aiming for. Because Twine publishes directly to HTML, you can do a lot of interesting things with it—including creating [interactive fiction][4] and [adventure games][5] or publishing stories on a blog or website. + +### Early struggles + +I created my "About me" page in Twine and tried to paste it into my WordPress page. + +"No, can do," said WordPress and Twine. + +You see, a Twine story exported from Twine is just a webpage (i.e., a file in HTML format). However, it not only includes HTML but JavaScript code, as well. And somehow it doesn't work when you simply try to copy-paste the contents. I tried copy-pasting just the body of the Twine story page without success. + +I thought, "I guess I need to add that JavaScript code separately," and I tried custom fields. + +Nope. + +I took a break from my investigation. I just uploaded my "About me" Twine story via FTP and linked to it from my website's menu. People could visit it and interact with the story, however, there was no menu, and it didn't feel like a part of my website. I had made a trap for myself. It made me realize I really _really_ wanted my "About me" included directly on my website. + +### DIY embed + +I took a stab at the problem and came up with [this solution][6]. + +It worked. It wasn't perfect, but it worked. + +But it wasn't _perfect_. Is there a better way? There is bound to be a better way… + +It cost me a couple of pulled hairs, but I managed to get a [responsive iframe and autoscroll][7]. + +It was way better. I was proud of myself and shared it on [Reddit][8]. + +### The road to Embed Twine + +Suddenly, an idea! What if, instead of following my tutorial, people could use a WordPress plugin? + +They would only have to give the plugin a Twine story, and it would take care of the rest. Hassle-free. No need to copy-paste any JavaScript code. + +Wouldn't that be glorious?!? + +I had no idea how WordPress plugins work. I only knew they are written in PHP. A while back, I had part-time work as a PHP developer, and I remembered the basics. + +### Containers and WordPress + +I mentioned my idea to a friend, and he suggested I could use containers as my WordPress development environment. + +In the past, I'd always used [XAMPP][9], but I wanted to try containers for a while. + +No problem, I thought! I'll learn containers while I learn how to make a WordPress plugin and revive my PHP skills. That should be sufficiently stimulating. + +And it was. + +I can't recall how many times I stopped, removed, and rebuilt my containers. I had to use the command line. And the file permissions are painful. + +Oh boy! It was like playing a game that you enjoy playing even though it makes you fairly angry. It was challenging but rewarding. + +I found out that it's very easy to create a simple WordPress plugin: + + * Write the source code + * Save it in the WP plugin directory + * Test it + * Repeat + + + +Containers make it easy to use a specific environment and are easy to clean up when you screw up and need to start over. + +Using Git saved me from accidentally wiping out my entire codebase. I used [Sourcetree][10] as my Git user interface. Initially, I wrote my code in [Notepad++][11], but when I divided my code into multiple files, I switched to [Atom][12]. It's such a cool editor for geeks. Using it feels like the code writes itself. + +### Intermission + +So what do we know so far? + + * I wanted an interactive "About me" page + * I created an "About me" story in Twine + * Twine exports webpages (as HTML files with JavaScript included) + * WP plugins are easy to make + * Containers are awesome + + + +### Embed Twine is born + +I wanted an easy way to embed Twine stories into WordPress. So, I used the power of software development, fooled around with containers, wrote a bit of PHP code, and published the result as a WordPress plugin called [Embed Twine][13]. + +### Install the plugin + + 1. Upload the plugin [files][14] to the **/wp-content/plugins/plugin-name** directory, or install the plugin through the WordPress Plugins screen. + 2. Activate the plugin through the Plugins screen in WordPress. + + + +### Use the plugin + +After you've installed the Embed Twine plugin and created a Twine 2 story, embed it in your WordPress site: + + 1. Export your Twine 2 story into an HTML file. + 2. Upload it via the plugin's interface. + 3. Insert the shortcode into the page or post. + 4. Enjoy your embedded story. + + + +The plugin also provides autoscroll functionality to make it easy for users to navigate through your stories. + +### Configure the plugin + +The plugin is configurable via shortcode parameters. To use the shortcode, simply put **[embed_twine]** into your post. + +You can use additional parameters in the format **[embed_twine story="Story" aheight=112 autoscroll=true ascroll=100]** as follows: + + * **story:** Specify the story name (the filename without an extension). + * If the story parameter is omitted, it defaults to "Story." This means there is no need to use this parameter if your Twine filename is Story.html. + * If you upload a Twine story called MyFooBar.html, use the shortcode: **[embed_twine story="MyFooBar"]**. + * **aheight:** Use this parameter to adjust the iframe's height. You might need to tweak **aheight** to get rid of an iframe scrollbar. The default value is 112; this value is added to the iframe height and used to set the iframe's **style.height**. + * **autoscroll:** Autoscroll is enabled by default. You can turn it off with shortcode parameter **[embed_twine autoscroll=false]**. + * **ascroll:** Use this to adjust the default position for autoscroll. The default value is 100; this value is subtracted from the iframe's top position and fed into JavaScript method **window.scrollTo()**. + + + +### Known bugs + +Currently, Twine passages that include images might report their height incorrectly, and the scrollbar might show up for these passages. Tweak the shortcode parameter **aheight** to get rid of them. + +### The script + + +``` +1       <?php +2       +3       /** +4       * Plugin Name: Embed Twine +5       * Description: Insert Twine stories into WordPress +6       * Version: 0.0.6 +7       * Author: Roman Luks +8       * Author URI: +9       * License: GPLv2 or later +10      */ +11      +12      require_once('include/embed-twine-load-file.php'); +13      require_once('include/embed-twine-parent-page.php'); +14      require_once('include/embed-twine-process-story.php'); +15      +16      // Add plugin to WP menu +17      function embed_twine_customplugin_menu() { +18      +19          add_menu_page("Embed Twine", "Embed Twine","manage_options", __FILE__, "embed_twine_uploadfile"); +20      } +21      +22      add_action("admin_menu", "embed_twine_customplugin_menu"); +23      +24      function embed_twine_uploadfile(){ +25          include "include/embed-twine-upload-file.php"; +26      } +27      +28      // Add shortcode +29      function embed_twine_shortcodes_init() +30      { +31          function embed_twine_shortcode($atts = [], $content = null) +32          { +33              // Attributes +34              $atts = shortcode_atts( +35                  [array][15]( +36                      'story' => 'Story', +37                      'aheight' => 112,       //adjust for style.height (30) and margins of tw-story (2x41) +38                      'autoscroll' => true,   //autoscroll enabled by default +39                      'ascroll' => 100,       //adjust for autoscroll +40                  ), +41                  $atts, +42                  'embed_twine' +43              ); +44      +45              $content = embed_twine_buildParentPage($atts['story'], $atts['aheight'], $atts['autoscroll'], $atts['ascroll']); +46      +47              return $content; +48          } +49          add_shortcode('embed_twine', 'embed_twine_shortcode'); +50      } +51      add_action('init', 'embed_twine_shortcodes_init'); +``` + +* * * + +_This article is adapted from [Roman Luks' blog][16] and [Embed Twine][13] page on WordPress plugins._ + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/2/embed-twine-wordpress + +作者:[Roman Lukš][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/romanluks +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/coffee_tea_laptop_computer_work_desk.png?itok=D5yMx_Dr (Person drinking a hat drink at the computer) +[2]: https://romanluks.eu/ +[3]: https://twinery.org/ +[4]: https://opensource.com/article/18/7/twine-vs-renpy-interactive-fiction +[5]: https://opensource.com/article/18/2/twine-gaming +[6]: https://romanluks.eu/blog/how-to-embed-twine-on-your-wordpress-website/ +[7]: https://romanluks.eu/blog/how-to-embed-twine-on-your-wordpress-website-with-responsive-iframe-and-autoscroll/ +[8]: https://www.reddit.com/r/twinegames/comments/dtln4z/how_to_embed_twine_on_your_wordpress_website_with/ +[9]: https://en.wikipedia.org/wiki/XAMPP +[10]: https://www.sourcetreeapp.com/ +[11]: https://notepad-plus-plus.org/ +[12]: https://atom.io/ +[13]: https://wordpress.org/plugins/embed-twine/ +[14]: https://plugins.trac.wordpress.org/browser/embed-twine/ +[15]: http://www.php.net/array +[16]: https://romanluks.eu/blog/embed-twine-wordpress-plugin/ diff --git a/sources/tech/20200219 How to conveniently unsubscribe from a mailing list.md b/sources/tech/20200219 How to conveniently unsubscribe from a mailing list.md new file mode 100644 index 0000000000..ab0a962efa --- /dev/null +++ b/sources/tech/20200219 How to conveniently unsubscribe from a mailing list.md @@ -0,0 +1,93 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How to conveniently unsubscribe from a mailing list) +[#]: via: (https://opensource.com/article/20/2/how-unsubscribe-mailing-list) +[#]: author: (Seth Kenlon https://opensource.com/users/seth) + +How to conveniently unsubscribe from a mailing list +====== +Cut down on your email clutter by removing yourself from email lists you +no longer need. +![Photo by Anthony Intraversato on Unsplash][1] + +If you're on an email discussion group long enough, at some point, you'll see an email from a list member asking to be unsubscribed. Typically, at least 10 other people on the list will respond with instructions on how to unsubscribe, and those 10 responses will be answered by 10 more people confirming or commenting on the instructions. That's a _lot_ of traffic to a mailing list just so one person can unsubscribe. + +But unsubscribing from a list can be confusing, especially if you've gotten on the list by accident. It's frustrating to discover that you've been added to a list, and it's annoying that you have to take time out of your day to extricate yourself. This article is here to help make unsubscribing fast, easy, and graceful. + +Never send an unsubscribe email to the same email address you use to post messages + +### Unsubscribe by email + +Mailing lists are controlled by mailing list software (like [GNU Mailman][2]) on a server. You probably aren't aware of the software controlling a mailing list you're on, because they're usually designed to stay out of the way and just deliver mail. But as a member of a mailing list, you actually have some user control over the software. + +Some mailing lists allow you to unsubscribe using an automated email address. It can be a little confusing because the email address you use to unsubscribe is NOT the email address you use to send messages to the list. Essentially, you're sending a special command to the email server, telling it to take you off the list. This is a convenient method of unsubscribing because it means you don't have to compose a message or wait for anyone to take action. You speak directly to the computer sending the email, and it does exactly as it's told. + +To unsubscribe from a list, take the email address of the list, add **-leave** just before the **@** symbol, and send a message. You can email a blank message; the computer doesn't care. The fact that you're emailing the list with the **-leave** command in front of the **@** symbol is all it needs. + +Here's an example. + +Say you've joined the mailing list Funny Squirrels. You send a few messages to [funnysquirrels@example.com][3] but soon find that squirrels are not as amusing as you'd hoped. To unsubscribe, you can send an email to: + + +``` +`funnysquirrels-leave@example.com` +``` + +You may get a final confirmation email back, and then you'll hear from the mailing list no more. + +#### Custom email commands + +Sometimes the administrator of a mail server changes the command for unsubscribing. Ideally, they'll include the unsubscribe email address in the footer of emails sent to the mailing list, so check for that before sending your parting email. + +The thing to keep in mind is that an unsubscribe email _never_ goes to the actual list, meaning you should never send an unsubscribe email to the same email address you use to post messages. There's a special, separate email address reserved for the unsubscribe command. + +### Unsubscribing by webform + +Some mailing lists have a webform for unsubscribing, and ideally, it can be found in the footer of each mailing list message. You can navigate to the webform and opt out of your subscription. + +This method is common for commercial mailing lists, and it's sometimes a way for them to capture any feedback you have about the list, why you're leaving, and so on. Like the automated email method, the intent is for you to maintain full control of your own subscription. You never have to wait for a human to take you off of a list; instead, you can issue commands directly to a computer. + +![Example unsubscribe web form][4] + +A webform may send you a final confirmation email, and after that, you should hear nothing from that mailing list ever again. + +### Unsubscribing like a pro + +Leaving a mailing list is a guilt-free and nonaggressive act. When you want to leave a mailing list, you should be able to find an unsubscribe email address or webform to make it automated and final. + +If, in spite of using the methods above, you can't leave a mailing list, don't email the list. Very few people on the mailing list have control over who is subscribed, and sometimes the people who have access to the list of subscribers are not monitoring the list—they're only maintaining the server. Instead, find out what server hosts the mailing list, and contact the hosting provider to alert them of the abuse. + +You can find the host of a mailing list by searching for the server name (the part of the email address to the _right_ of the **@** symbol) on a **whois** service. If you're running Linux, you can do this from a terminal: + + +``` +`$ whois ` +``` + +Otherwise, use the [Whois.net][5] website. + +Whois provides the internet hosting provider of any email server plus the abuse and support contact information. + +Remember: you are always free to leave a mailing list for any reason, without getting permission from anyone else. And now that you know how, you'll be able to unsubscribe like a pro! + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/2/how-unsubscribe-mailing-list + +作者:[Seth Kenlon][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/seth +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/anthony-intraversato-pt_wqgzaiu8-unsplash.jpg?itok=5bbMlgt8 (Photo by Anthony Intraversato on Unsplash) +[2]: https://www.list.org/ +[3]: mailto:funnysquirrels@example.com +[4]: https://opensource.com/sites/default/files/uploads/mail-webform.jpg (Example unsubscribe web form) +[5]: http://whois.net diff --git a/sources/tech/20200221 Don-t like loops- Try Java Streams.md b/sources/tech/20200221 Don-t like loops- Try Java Streams.md new file mode 100644 index 0000000000..e327d045a3 --- /dev/null +++ b/sources/tech/20200221 Don-t like loops- Try Java Streams.md @@ -0,0 +1,427 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Don't like loops? Try Java Streams) +[#]: via: (https://opensource.com/article/20/2/java-streams) +[#]: author: (Chris Hermansen https://opensource.com/users/clhermansen) + +Don't like loops? Try Java Streams +====== +It's 2020 and time to learn about Java Streams. +![Person drinking a hat drink at the computer][1] + +In this article, I will explain how to not write loops anymore. + +What? Whaddaya mean, no more loops? + +Yep, that's my 2020 resolution—no more loops in Java. Understand that it's not that loops have failed me, nor have they led me astray (well, at least, I can argue that point). Really, it is that I, a Java programmer of modest abilities since 1997 or so, must finally learn about all this new [Streams][2] stuff, saying "what" I want to do and not "how" I want to do it, maybe being able to parallelize some of my computations, and all that other good stuff. + +I'm guessing that there are other Java programmers out there who also have been programming in Java for a decent amount of time and are in the same boat. Therefore, I'm offering my experiences as a guide to "how to not write loops in Java anymore." + +### Find a problem worth solving + +If you're like me, then the first show-stopper you run into is "right, cool stuff, but what am I solving for, and how do I apply this?" I realized that I can spot the perfect opportunity camouflaged as _Something I've Done Before_. + +In my case, it's sampling land cover within a specific area and coming up with an estimate and a confidence interval around that estimate for the land cover across the whole area. The specific problem involves deciding whether an area is "forested" or not, given a specific legal definition: if at least 10% of the soil is covered over by tree crowns, then the area is considered to be forested; otherwise, it's something else. + +![Image of land cover in an area][3] + +It's a pretty esoteric example of a recurring problem; I'll grant you. But there it is. For the ecologists and foresters out there who are accustomed to cool temperate or tropical forests, 10% might sound kind of low, but in the case of dry areas with low-growing shrubs and trees, that's a reasonable number. + +So the basic idea is: use images to stratify the area (i.e., areas completely devoid of trees, areas of predominantly small trees spaced quite far apart, areas of predominantly small trees spaced closer together, areas of somewhat larger trees), locate some samples in those strata, send the crew out to measure the samples, analyze the results, and calculate the proportion of soil covered by tree crowns across the area. Simple, right? + +![Survey team assessing land cover][4] + +### What the field data looks like + +In the current project, the samples are rectangular areas 20 meters wide by 25 meters long, so 500 square meters each. On each patch, the field crew measured each tree: its species, its height, the maximum and minimum width of its crown, and the diameter of its trunk at trunk height (nominally 30cm above the ground). This information was collected, entered into a spreadsheet, and exported to a bar separated value (BSV) file for me to analyze. It looks like this: + +Stratum# | Sample# | Tree# | Species | Trunk diameter (cm) | Crown diameter 1 (m) | Crown diameter 2 (m) | Height (m) +---|---|---|---|---|---|---|--- +1 | 1 | 1 | Ac | 6 | 3.6 | 4.6 | 2.4 +1 | 1 | 2 | Ac | 6 | 2.2 | 2.3 | 2.5 +1 | 1 | 3 | Ac | 16 | 2.5 | 1.7 | 2.4 +1 | 1 | 4 | Ac | 6 | 1.5 | 2.1 | 1.8 +1 | 1 | 5 | Ac | 5 | 0.9 | 1.7 | 1.7 +1 | 1 | 6 | Ac | 6 | 1.7 | 1.3 | 1.6 +1 | 1 | 7 | Ac | 5 | 1.82 | 1.32 | 1.8 +1 | 1 | 1 | Ac | 1 | 0.3 | 0.25 | 0.9 +1 | 1 | 2 | Ac | 2 | 1.2 | 1.2 | 1.7 + +The first column is the stratum number (where 1 is "predominantly small trees spaced quite far apart," 2 is "predominantly small trees spaced closer together," and 3 is "somewhat larger trees"; we didn't sample the areas "completely devoid of trees"). The second column is the sample number (there are 73 samples altogether, located in the three strata in proportion to the area of each stratum). The third column is the tree number within the sample. The fourth is the two-letter species code, the fifth the trunk diameter (in this case, 10cm above ground or exposed roots), the sixth the smallest distance across the crown, the seventh the largest distance, and the eighth the height of the tree. + +For the purposes of this exercise, I'm only concerned with the total amount of ground covered by the tree crowns—not the species, nor the height, nor the diameter of the trunk. + +In addition to the measurement information above, I also have the areas of the three strata, also in a BSV: + +stratum | hectares +---|--- +1 | 114.89 +2 | 207.72 +3 | 29.77 + +### What I want to do (not how I want to do it) + +In keeping with one of the main design goals of Java Streams, here is "what" I want to do: + + 1. Read the stratum area BSV and save the data as a lookup table. + 2. Read the measurements from the measurement BSV file. + 3. Accumulate each measurement (tree) to calculate the total area of the sample covered by tree crowns. + 4. Accumulate the sample tree crown area values and count the number of samples to estimate the mean tree crown area coverage and standard error of the mean for each stratum. + 5. Summarize the stratum figures. + 6. Weigh the stratum means and standard errors by the stratum areas (looked up from the table created in step 1) and accumulate them to estimate the mean tree crown area coverage and standard error of the mean for the total area. + 7. Summarize the weighted figures. + + + +Generally speaking, the way to define "what" with Java Streams is by creating a stream processing pipeline of function calls that pass over the data. So, yes, there is actually a bit of "how" that ends up creeping in… in fact, quite a bit of "how." But, it needs a very different knowledge base than the good, old fashioned loop. + +I'll go through each of these steps in detail. + +#### Build the stratum area table + +The first job is to convert the stratum areas BSV file to a lookup table: + + +``` +[String][5] fileName = "stratum_areas.bsv"; +Stream<String> inputLineStream = Files.lines(Paths.get(fileName));  // (1) + +final Map<[Integer][6],Double> stratumAreas =   // (2) +    inputLineStream     // (3) +        .skip(1)                   // (4) +        .map(l -> l.split("\\\|"))  // (5) +        .collect(                  // (6) +            Collectors.toMap(      // (7) +                a -> [Integer][6].parseInt(a[0]),  // (8) +                a -> [Double][7].parseDouble(a[1]) // (9) +            ) +        ); +inputLineStream.close();   // (10) + +[System][8].out.println("stratumAreas = " + stratumAreas);  // (11) +``` + +I'll take this a line or two at a time, where the numbers in comments following the lines above—e.g., _// (3)_— correspond to the numbers below: + + 1. java.nio.Files.lines() gives a stream of strings corresponding to lines in the file. + 2. The goal is to create the lookup table, **stratumAreas**, which is a **Map<Integer,Double>**. Therefore, I can get the **double** value area for stratum 2 as **stratumAreas.get(2)**. + 3. This is the beginning of the stream "pipeline." + 4. Skip the first line in the pipeline since it's the header line containing the column names. + 5. Use **map()** to split the **String** input line into an array of **String** fields, with the first field being the stratum # and the second being the stratum area. + 6. Use **collect()** to [materialize the results][9]. + 7. The materialized result will be produced as a sequence of **Map** entries. + 8. The key of each map entry is the first element of the array in the pipeline—the **int** stratum number. By the way, this is a _Java lambda_ expression—[an anonymous function][10] that takes an argument and returns that argument converted to an **int**. + 9. The value of each map entry is the second element of the array in the pipeline—the **double** stratum area. + 10. Don't forget to close the stream (file). + 11. Print out the result, which looks like: [code]`stratumAreas = {1=114.89, 2=207.72, 3=29.77}` +``` +### Build the measurements table and accumulate the measurements into the sample totals + +Now that I have the stratum areas, I can start processing the main body of data—the measurements. I combine the two tasks of building the measurements table and accumulating the measurements into the sample totals since I don't have any interest in the measurement data per se. +``` + + +fileName = "sample_data_for_testing.bsv"; +inputLineStream = Files.lines(Paths.get(fileName)); + + final Map<[Integer][6],Map<[Integer][6],Double>> sampleValues = +    inputLineStream +        .skip(1) +        .map(l -> l.split("\\\|")) +        .collect(                  // (1) +            Collectors.groupingBy(a -> [Integer][6].parseInt(a[0]),     // (2) +                Collectors.groupingBy(b -> [Integer][6].parseInt(b[1]), // (3) +                    Collectors.summingDouble(                      // (4) +                        c -> {                                     // (5) +                            double rm = ([Double][7].parseDouble(c[5]) + +                                [Double][7].parseDouble(c[6]))/4d;      // (6) +                            return rm*rm * [Math][11].PI / 500d;         // (7) +                        }) +                ) +            ) +        ); +inputLineStream.close(); + +[System][8].out.println("sampleValues = " + sampleValues);  // (8) + +``` +Again, a line or two or so at a time: + + 1. The first seven lines are the same in this task and the previous, except the name of this lookup table is **sampleValues**; and it is a **Map** of **Map**s. + 2. The measurement data is grouped into samples (by sample #), which are, in turn, grouped into strata (by stratum #), so I use **Collectors.groupingBy()** at the topmost level [to separate data][12] into strata, with **a[0]** here being the stratum number. + 3. I use **Collectors.groupingBy()** once more to separate data into samples, with **b[1]** here being the sample number. + 4. I use the handy **Collectors.summingDouble()** [to accumulate the data][13] for each measurement within the sample within the stratum. + 5. Again, a Java lambda or anonymous function whose argument **c** is the array of fields, where this lambda has several lines of code that are surrounded by **{** and **}** with a **return** statement just before the **}**. + 6. Calculate the mean crown radius of the measurement. + 7. Calculate the crown area of the measurement as a proportion of the total sample area and return that value as the result of the lambda. + 8. Again, similar to the previous task. The result looks like (with some numbers elided): [code]`sampleValues = {1={1=0.09083231861452731, 66=0.06088002082602869, ... 28=0.0837823490804228}, 2={65=0.14738326403381743, 2=0.16961183847374103, ... 63=0.25083064794883453}, 3={64=0.3306323635177101, 32=0.25911911184680053, ... 30=0.2642668470291564}}` +``` + + + +This output shows the **Map** of **Map**s structure clearly—there are three entries in the top level corresponding to the strata 1, 2, and 3, and each stratum has subentries corresponding to the proportional area of the sample covered by tree crowns. + +#### Accumulate the sample totals into the stratum means and standard errors + +At this point, the task becomes more complex; I need to count the number of samples, sum up the sample values in preparation for calculating the sample mean, and sum up the squares of the sample values in preparation for calculating the standard error of the mean. I may as well incorporate the stratum area into this grouping of data as well, as I'll need it shortly to weigh the stratum results together. + +So the first thing to do is create a class, **StratumAccumulator**, to handle the accumulation and provide the calculation of the interesting results. This class implements **java.util.function.DoubleConsumer**, which can be passed to **collect()** to handle accumulation: + + +``` +class StratumAccumulator implements DoubleConsumer { +    private double ha; +    private int n; +    private double sum; +    private double ssq; +    public StratumAccumulator(double ha) { // (1) +        this.ha = ha; +        this.n = 0; +        this.sum = 0d; +        this.ssq = 0d; +    } +    public void accept(double d) { // (2) +        this.sum += d; +        this.ssq += d*d; +        this.n++; +    } +    public void combine(StratumAccumulator other) { // (3) +        this.sum += other.sum; +        this.ssq += other.ssq; +        this.n += other.n; +    } +    public double getHa() {  // (4) +        return this.ha; +    } +    public int getN() {  // (5) +        return this.n; +    } +    public double getMean() {  // (6) +        return this.n > 0 ? this.sum / this.n : 0d; +    } +    public double getStandardError() {  // (7) +        double mean = this.getMean(); +        double variance = this.n > 1 ? (this.ssq - mean*mean*n)/(this.n - 1) : 0d; +        return this.n > 0 ? [Math][11].sqrt(variance/this.n) : 0d; +    } +} +``` + +Line-by-line: + + 1. The constructor **StratumAccumulator(double ha)** takes an argument, the area of the stratum in hectares, which allows me to merge the stratum area lookup table into instances of this class. + 2. The **accept(double d)** method is used to accumulate the stream of double values, and I use it to: +a. Count the number of values. +b. Sum the values in preparation for computing the sample mean. +c. Sum the squares of the values in preparation for computing the standard error of the mean. + 3. The **combine()** method is used to merge substreams of **StratumAccumulator**s (in case I want to process in parallel). + 4. The getter for the area of the stratum + 5. The getter for the number of samples in the stratum + 6. The getter for the mean sample value in the stratum + 7. The getter for the standard error of the mean in the stratum + + + +Once I have this accumulator, I can use it to accumulate the sample values pertaining to each stratum: + + +``` +final Map<[Integer][6],StratumAccumulator> stratumValues =   // (1) +    sampleValues.entrySet().stream()   // (2) +        .collect(                      // (3) +            Collectors.toMap(          // (4) +                e -> e.getKey(),       // (5) +                e -> e.getValue().entrySet().stream()   // (6) +                    .map([Map.Entry][14]::getValue)           // (7) +                    .collect(          // (8) +                        () -> new StratumAccumulator(stratumAreas.get(e.getKey())),   // (9) +                        StratumAccumulator::accept,     // (10) +                        StratumAccumulator::combine)    // (11) +            ) +        ); +``` + +Line-by-line: + + 1. This time, I'm using the pipeline to build **stratumValues**, which is a **Map<Integer,StratumAccumulator>**, so **stratumValues.get(3)** will return the **StratumAccumulator** instance for stratum 3. + 2. Here, I'm using the **entrySet().stream()** method provided by **Map** to get a stream of (key, value) pairs; recall these are **Map**s of sample values by stratum. + 3. Again, I'm using **collect()** to gather the pipeline results by stratum… + 4. using **Collectors.toMap()** to generate a stream of **Map** entries… + 5. whose keys are the key of the incoming stream (that is, the stratum #)… + 6. and whose values are the Map of sample values, and I again use **entrySet().stream()** to convert to a stream of Map entries, one for each sample. + 7. Using **map()** to get the value of the sample **Map** entry; I'm not interested in the key by this point. + 8. Yet again, using **collect()** to accumulate the sample results into the **StratumAccumulator** instances. + 9. Telling **collect()** how to create a new **StratumAccumulator**—I need to pass the stratum area into the constructor here, so I can't just use **StratumAccumulator::new**. + 10. Telling **collect()** to use the **accept()** method of **StratumAccumulator** to accumulate the stream of sample values. + 11. Telling **collect()** to use the **combine()** method of **StratumAccumulator** to merge **StratumAccumulator** instances. + + + +#### Summarize the stratum figures + +Whew! After all of that, printing out the stratum figures is pretty straightforward: + + +``` +stratumValues.entrySet().stream() +    .forEach(e -> { +        StratumAccumulator sa = e.getValue(); +        int n = sa.getN(); +        double se66 = sa.getStandardError(); +        double t = new TDistribution(n - 1).inverseCumulativeProbability(0.975d); +        [System][8].out.printf("stratum %d n %d mean %g se66 %g t %g se95 %g ha %g\n", +            e.getKey(), n, sa.getMean(), se66, t, se66 * t, sa.getHa()); +    }); +``` + +In the above, once again, I use **entrySet().stream()** to transform the **stratumValues** Map to a stream, and then apply the **forEach()** method to the stream. **ForEach()** is pretty much what it sounds like—a loop! But the business of finding the head of the stream, finding the next element, and checking to see if hits the end is all handled by Java Streams. So, I just get to say what I want to do for each record, which is basically to print it out. + +My code looks a bit more complicated because I declare some local variables to hold some intermediate results that I use more than once—**n**, the number of samples, and **se66**, the standard error of the mean. I also calculate the inverse T value to [convert my standard error of the mean to a 95% confidence interval][15]. + +The result looks like this: + + +``` +stratum 1 n 24 mean 0.0903355 se66 0.0107786 t 2.06866 se95 0.0222973 ha 114.890 +stratum 2 n 38 mean 0.154612 se66 0.00880498 t 2.02619 se95 0.0178406 ha 207.720 +stratum 3 n 11 mean 0.223634 se66 0.0261662 t 2.22814 se95 0.0583020 ha 29.7700 +``` + +#### Accumulate the stratum means and standard errors into the total + +Once again, the task becomes more complex, so I create a class, **TotalAccumulator**, to handle the accumulation and provide the calculation of the interesting results. This class implements **java.util.function.Consumer<T>**, which can be passed to **collect()** to handle accumulation: + + +``` +class TotalAccumulator implements Consumer<StratumAccumulator> { +    private double ha; +    private int n; +    private double sumWtdMeans; +    private double ssqWtdStandardErrors; +    public TotalAccumulator() { +        this.ha = 0d; +        this.n = 0; +        this.sumWtdMeans = 0d; +        this.ssqWtdStandardErrors = 0d; +    } +    public void accept(StratumAccumulator sa) { +        double saha = sa.getHa(); +        double sase = sa.getStandardError(); +        this.ha += saha; +        this.n += sa.getN(); +        this.sumWtdMeans += saha * sa.getMean(); +        this.ssqWtdStandardErrors += saha * saha * sase * sase; +    } +    public void combine(TotalAccumulator other) { +        this.ha += other.ha; +        this.n += other.n; +        this.sumWtdMeans += other.sumWtdMeans; +        this.ssqWtdStandardErrors += other.ssqWtdStandardErrors; +    } +    public double getHa() { +        return this.ha; +    } +    public int getN() { +        return this.n; +    } +    public double getMean() { +        return this.ha > 0 ? this.sumWtdMeans / this.ha : 0d; +    } +    public double getStandardError() { +        return this.ha > 0 ? [Math][11].sqrt(this.ssqWtdStandardErrors) / this.ha : 0; +    } +} +``` + +I'm not going to go into much detail on this, since it's structurally pretty similar to **StratumAccumulator**. Of main interest: + + 1. The constructor takes no arguments, which simplifies its use. + 2. The **accept()** method accumulates instances of **StratumAccumulator**, not **double** values, hence the use of the **Consumer<T>** interface. + 3. As for the calculations, they are assembling a weighted average of the **StratumAccumulator** instances, so they make use of the stratum areas, and the formulas might look a bit strange to anyone who's not used to stratified sampling. + + + +As for actually carrying out the work, it's easy-peasy: + + +``` +final TotalAccumulator totalValues = +    stratumValues.entrySet().stream() +        .map([Map.Entry][14]::getValue) +        .collect(TotalAccumulator::new, TotalAccumulator::accept, TotalAccumulator::combine); +``` + +Same old stuff as before: + + 1. Use **entrySet().stream()** to convert the **stratumValue Map** entries to a stream. + 2. Use **map()** to replace the **Map** entries with their values—the instances of **StratumAccumulator**. + 3. Use **collect()** to apply the **TotalAccumulator** to the instances of **StratumAccumulator**. + + + +#### Summarize the total figures + +Getting the interesting bits out of the **TotalAccumulator** instance is also pretty straightforward: + + +``` +int nT = totalValues.getN(); +double se66T = totalValues.getStandardError(); +double tT = new TDistribution(nT - stratumValues.size()).inverseCumulativeProbability(0.975d); +[System][8].out.printf("total n %d mean %g se66 %g t %g se95 %g ha %g\n", +    nT, totalValues.getMean(), se66T, tT, se66T * tT, totalValues.getHa()); +``` + +Similar to the **StratumAccumulator**, I just call the relevant getters to pick out the number of samples **nT** and the standard error **se66T**. I calculate the T value **tT** (using "n – 3" here since there are three strata), and then I print the result, which looks like this: + + +``` +`total n 73 mean 0.139487 se66 0.00664653 t 1.99444 se95 0.0132561 ha 352.380` +``` + +### In conclusion + +Wow, that looks like a bit of a marathon. It feels like it, too. As is often the case, there is a great deal of information about how to use Java Streams, all illustrated with toy examples, which kind of help, but not really. I found that getting this to work with a real-world (albeit very simple) example was difficult. + +Because I've been working in [Groovy][16] a lot lately, I kept finding myself wanting to accumulate into "maps of maps of maps" rather than creating accumulator classes, but I was never able to pull that off except in the case of totaling up the measurements in the sample. So, I worked with accumulator classes instead of maps of maps, and maps of accumulator classes instead of maps of maps of maps. + +I don't feel like any kind of master of Java Streams at this point, but I do feel I have a pretty solid understanding of **collect()**, which is deeply important, along with various methods to reformat data structures into streams and to reformat stream elements themselves. So yeah, more to learn! + +Speaking of collect(), in the examples I presented above, we can see moving from a very simple use of this fundamental method - using the Collectors.summingDouble() accumulation method - through defining an accumulator class that extends one of the pre-defined interfaces - in this case DoubleConsumer - to defining a full-blown accumulator of our own, used to accumulate the intermediate stratum class. I was tempted - sort of - to work backward and implement fully custom accumulators for the stratum and sample accumulators, but the point of this exercise was to learn more about Java Streams, not to become an expert in one single part of it all. + +What's your experience with Java Streams? Done anything big and complicated yet? Please share it in the comments. + +Optimizing your Java code requires an understanding of how the different elements in Java interact... + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/2/java-streams + +作者:[Chris Hermansen][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/clhermansen +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/coffee_tea_laptop_computer_work_desk.png?itok=D5yMx_Dr (Person drinking a hat drink at the computer) +[2]: https://docs.oracle.com/javase/8/docs/api/java/util/stream/package-summary.html +[3]: https://opensource.com/sites/default/files/uploads/landcover.png (Image of land cover in an area) +[4]: https://opensource.com/sites/default/files/uploads/foresters.jpg (Survey team assessing land cover) +[5]: http://www.google.com/search?hl=en&q=allinurl%3Adocs.oracle.com+javase+docs+api+string +[6]: http://www.google.com/search?hl=en&q=allinurl%3Adocs.oracle.com+javase+docs+api+integer +[7]: http://www.google.com/search?hl=en&q=allinurl%3Adocs.oracle.com+javase+docs+api+double +[8]: http://www.google.com/search?hl=en&q=allinurl%3Adocs.oracle.com+javase+docs+api+system +[9]: https://www.baeldung.com/java-8-collectors +[10]: https://docs.oracle.com/javase/tutorial/java/javaOO/lambdaexpressions.html +[11]: http://www.google.com/search?hl=en&q=allinurl%3Adocs.oracle.com+javase+docs+api+math +[12]: https://www.baeldung.com/java-groupingby-collector +[13]: http://www.java2s.com/Tutorials/Java/java.util.stream/Collectors/Collectors.summingDouble_ToDoubleFunction_super_T_mapper_.htm +[14]: http://www.google.com/search?hl=en&q=allinurl%3Adocs.oracle.com+javase+docs+api+map.entry +[15]: https://en.wikipedia.org/wiki/Standard_error +[16]: http://groovy-lang.org/ diff --git a/sources/tech/20200221 Live video streaming with open source Video.js.md b/sources/tech/20200221 Live video streaming with open source Video.js.md new file mode 100644 index 0000000000..178466a443 --- /dev/null +++ b/sources/tech/20200221 Live video streaming with open source Video.js.md @@ -0,0 +1,171 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Live video streaming with open source Video.js) +[#]: via: (https://opensource.com/article/20/2/video-streaming-tools) +[#]: author: (Aaron J. Prisk https://opensource.com/users/ricepriskytreat) + +Live video streaming with open source Video.js +====== +Video.js is a widely used protocol that will serve your live video +stream to a wide range of devices. +![video editing dashboard][1] + +Last year, I wrote about [creating a video streaming server with Linux][2]. That project uses the Real-Time Messaging Protocol (RMTP), Nginx web server, Open Broadcast Studio (OBS), and VLC media player. + +I used VLC to play our video stream, which may be fine for a small local deployment but isn't very practical on a large scale. First, your viewers have to use VLC, and RTMP streams can provide inconsistent playback. This is where [Video.js][3] comes into play! Video.js is an open source JavaScript framework for creating custom HTML5 video players. Video.js is incredibly powerful, and it's used by a host of very popular websites—largely due to its open nature and how easy it is to get up and running. + +### Get started with Video.js + +This project is based off of the video streaming project I wrote about last year. Since that project was set to serve RMTP streams, to use Video.js, you'll need to make some adjustments to that Nginx configuration. HTTP Live Streaming ([HLS][4]) is a widely used protocol developed by Apple that will serve your stream better to a multitude of devices. HLS will take your stream, break it into chunks, and serve it via a specialized playlist. This allows for a more fault-tolerant stream that can play on more devices. + +First, create a directory that will house the HLS stream and give Nginx permission to write to it: + + +``` +mkdir /mnt/hls +chown www:www /mnt/hls +``` + +Next, fire up your text editor, open the Nginx.conf file, and add the following under the **application live** section: + + +``` +       application live { +            live on; +            # Turn on HLS +            hls on; +            hls_path /mnt/hls/; +            hls_fragment 3; +            hls_playlist_length 60; +            # disable consuming the stream from nginx as rtmp +            deny play all; +} +``` + +Take note of the HLS fragment and playlist length settings. You may want to adjust them later, depending on your streaming needs, but this is a good baseline to start with. Next, we need to ensure that Nginx is able to listen for requests from our player and understand how to present it to the user. So, we'll want to add a new section at the bottom of our nginx.conf file. + + +``` +server { +        listen 8080; + +        location / { +            # Disable cache +            add_header 'Cache-Control' 'no-cache'; + +            # CORS setup +            add_header 'Access-Control-Allow-Origin' '*' always; +            add_header 'Access-Control-Expose-Headers' 'Content-Length'; + +            # allow CORS preflight requests +            if ($request_method = 'OPTIONS') { +                add_header 'Access-Control-Allow-Origin' '*'; +                add_header 'Access-Control-Max-Age' 1728000; +                add_header 'Content-Type' 'text/plain charset=UTF-8'; +                add_header 'Content-Length' 0; +                return 204; +            } + +            types { +                application/dash+xml mpd; +                application/vnd.apple.mpegurl m3u8; +                video/mp2t ts; +            } + +            root /mnt/; +        } +    } +``` + +Visit Video.js's [Getting started][5] page to download the latest release and check out the release notes. Also on that page, Video.js has a great introductory template you can use to create a very basic web player. I'll break down the important bits of that template and insert the pieces you need to get your new HTML player to use your stream. + +The **head** links in the Video.js library from a content-delivery network (CDN). You can also opt to download and store Video.js locally on your web server if you want. + + +``` +<head> +  <link href="" rel="stylesheet" /> + +  <!-- If you'd like to support IE8 (for Video.js versions prior to v7) --> +  <script src="[https://vjs.zencdn.net/ie8/1.1.2/videojs-ie8.min.js"\>\][6]</script> +</head> +``` + +Now to the real meat of the player. The **body** section sets the parameters of how the video player will be displayed. Within the **video** element, you need to define the properties of your player. How big do you want it to be? Do you want it to have a poster (i.e., a thumbnail)? Does it need any special player controls? This example defines a simple 600x600 pixel player with an appropriate (to me) thumbnail featuring Beastie (the BSD Demon) and Tux (the Linux penguin). + + +``` +<body> +  <video +    id="my-video" +    class="video-js" +    controls +    preload="auto" +    width="600" +    height="600" +    poster="BEASTIE-TUX.jpg" +    data-setup="{}" +  > +``` + +Now that you've set how you want your player to look, you need to tell it what to play. Video.js can handle a large number of different formats, including HLS streams. + + +``` +    <source src="" type="application/x-mpegURL" /> +    <p class="vjs-no-js"> +      To view this video please enable JavaScript, and consider upgrading to a +      web browser that +      <a href="" target="_blank" +        >supports HTML5 video</a +      > +    </p> +  </video> +``` + +### Record your streams + +Keeping a copy of your streams is super easy. Just add the following at the bottom of your **application live** section in the nginx.conf file: + + +``` +# Enable stream recording +record all; +record_path /mnt/recordings/; +record_unique on; +``` + +Make sure that **record_path** exists and that Nginx has permissions to write to it: + + +``` +`chown -R www:www /mnt/recordings` +``` + +### Down the stream + +That's it! You should now have a spiffy new HTML5-friendly live video player. There are lots of great resources out there on how to expand all your video-making adventures. If you have any questions or suggestions, feel free to reach out to me on [Twitter][7] or leave a comment below. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/2/video-streaming-tools + +作者:[Aaron J. Prisk][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/ricepriskytreat +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/video_editing_folder_music_wave_play.png?itok=-J9rs-My (video editing dashboard) +[2]: https://opensource.com/article/19/1/basic-live-video-streaming-server +[3]: https://videojs.com/ +[4]: https://en.wikipedia.org/wiki/HTTP_Live_Streaming +[5]: https://videojs.com/getting-started +[6]: https://vjs.zencdn.net/ie8/1.1.2/videojs-ie8.min.js"\>\ +[7]: https://twitter.com/AKernelPanic diff --git a/sources/tech/20200223 The Zen of Go.md b/sources/tech/20200223 The Zen of Go.md new file mode 100644 index 0000000000..c4143aed32 --- /dev/null +++ b/sources/tech/20200223 The Zen of Go.md @@ -0,0 +1,414 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (The Zen of Go) +[#]: via: (https://dave.cheney.net/2020/02/23/the-zen-of-go) +[#]: author: (Dave Cheney https://dave.cheney.net/author/davecheney) + +The Zen of Go +====== + +_This article was derived from my [GopherCon Israel 2020][1] presentation. It’s also quite long. If you’d prefer a shorter version, head over to [the-zen-of-go.netlify.com][2]_. + +_A recording of the presentation is available on [YouTube][3]._ + +* * * + +### How should I write good code? + +Something that I’ve been thinking about a lot recently, when reflecting on the body of my own work, is a common subtitle, _how should I write good code?_ Given nobody actively seeks to write _bad_ code, this leads to the question; _how do you know when you’ve written good Go code?_ + +If there’s a continuum between good and bad, how to do we know what the good parts are? What are its properties, its attributes, its hallmarks, its patterns, and its idioms? + +### Idiomatic Go + +![][4] + +Which brings me to idiomatic Go. To say that something is idiomatic is to say that it follows the style of the time. If something is not idiomatic, it is not following the prevailing style. It is unfashionable. + +More importantly, to say to someone that their code is not idiomatic does not explain _why_ it’s not idiomatic. Why is this? Like all truths, the answer is found in the dictionary. + +> idiom (noun): a group of words established by usage as having a meaning not deducible from those of the individual words. + +Idioms are hallmarks of shared values. Idiomatic Go is not something you learn from a book, it’s something that you acquire by being part of a community. + +![][5] + +My concern with the mantra of idiomatic Go is, in many ways, it can be exclusionary. It’s saying “you can’t sit with us.” After all, isn’t that what we mean when critique of someone’s work as non-idiomatic? They didn’t do It right. It doesn’t look right. It doesn’t follow the style of time. + +I offer that idiomatic Go is not a suitable mechanism for teaching how to write good Go code because it is defined, fundamentally, by telling someone they did it wrong. Wouldn’t it be better if the advice we gave didn’t alienate the author right at the point they were most willing to accept it? + +### Proverbs + +Stepping away problematic idioms, what other cultural artefacts do Gophers have? Perhaps we can turn to Rob Pike’s wonderful [Go Proverbs][6]. Are these suitable teaching tools? Will these tell newcomers how to write good Go code? + +In general, I don’t think so. This is not to dismiss Pike’s work, it is just that the Go Proverbs, like Segoe Kensaku’s original, are observations, not statements of value. Again, the dictionary comes to the rescue: + +> proverb (noun): a short, well-known pithy saying, stating a general truth or piece of advice. + +The goal of the Go Proverbs are to reveal a deeper truth about the design of the language, but how useful is advice like the _empty interface says nothing_ to a novice from a language that doesn’t have structural typing? + +It’s important to recognise that, in a growing community, at any time the people learning Go far outnumber those who claim to have mastered the language. Thus proverbs are perhaps not the best teaching tool in this scenario. + +### Engineering Values + +Dan Luu found [an old presentation][7] by Mark Lucovsky about the engineering culture of the windows team around the windows NT-windows 2000 timeframe. The reason I mention it is Lukovsky’s description of a culture as a common way of evaluating designs and making tradeoffs. + +![][8] + +There are many ways of discussing culture, but with respect to an engineering culture Lucovsky’s description is apt. The central idea is _values guide decisions in an unknown design space_. The values of the NT team were; portability, reliability, security, and extensibility. Engineering values are, crudely translated, the way things are done around here. + +### Go’s values + +What are the explicit values of Go? What are the core beliefs or philosophy that define the way a Go programmer interprets the world? How are they promulgated? How are they taught? How are they enforced? How do they change over time? + +How will you, as a newly minted Go programmer, inculcate the engineering values of Go? Or, how will you, a seasoned Go professional promulgate your values to a future generations? And just so we’re clear, this process of knowledge transfer is not optional. Without new blood and new ideas, our community become myopic and wither. + +#### The values of other languages + +To set the scene for what I’m getting at we can look to other languages we see examples of their engineering values. + +For example, C++ (and by extension Rust) believe that a programmer _should not have to pay for a feature they do not use_. If a program does not use some computationally expensive feature of the language, then it shouldn’t be forced to shoulder the cost of that feature. This value extends from the language, to its standard library, and is used as a yardstick for judging the design of all code written in C++. + +In Java, and Ruby, and Smalltalk, the core value that _everything is an object_ drives the design of programs around message passing, information hiding, and polymorphism. Designs that shoehorn a procedural style, or even a functional style, into these languages are considered to be wrong–or as Gophers would say, non idiomatic. + +Turning to our own community, what are the engineering values that bind Go programmers? Discourse in our community is often fractious, so deriving a set of values from first principles would be a formidable challenge. Consensus is critical, but exponentially more difficult as the number of contributors to the discussion increases. But what if someone had done the hard work for us. + +### The Zen of ~~Python~~ Go + +Several decades ago Tim Peters sat down and penned _[PEP-20][9]_, the Zen of Python. Peters’ attempted to document the engineering values that he saw Guido van Rossum apply in his role as BDFL for Python. + +For the remainder of this article, I’m going to look towards the Zen of Python and ask, is there anything that can inform the engineering values of Go programmers? + +### A good package starts with a good name + +Let’s start with something spicy, + +> “Namespaces are one honking great idea–let’s do more of those!” + +The Zen of Python, Item 19 + +This is pretty unequivocal, Python programmers should use namespaces. Lots of them. + +In Go parlance a namespace is a package. I doubt there is any question that grouping things into packages is good for design and potentially reuse. But there might be some confusion, especially if you’re coming with a decade of experience in another language, about the right way to do this. + +In Go each package should have a purpose, and the best way to know a package’s purpose is by its name—a noun. A package’s name describes what it provides. So too reinterpret Peters’ words, every Go package should have a single purpose. + +This is not a new idea, [I’ve been saying this a while][10], but why should you do this rather than approach where packages are used for fine grained taxonomy? Why, because change. + +> “Design is the art of arranging code to work today, and be changeable forever.” + +Sandi Metz + +Change is the name of the game we’re in. What we do as programmers is manage change. When we do that well we call it design, or architecture. When we do it badly we call it technical debt, or legacy code. + +If you are writing a program that works perfectly, one time, for one fixed set of inputs then nobody cares if the code is good or bad because ultimately the output of the program is all the business cares about. + +But this is _never_ true. Software has bugs, requirements change, inputs change, and very few programs are written solely to be executed once, thus your program _will_ change over time. Maybe it’s you who’ll be tasked with this, more likely it will be someone else, but someone has to change that code. Someone has to maintain that code. + +So, how can we make it easy to for programs to change? Interfaces everywhere? Make everything mockable? Pernicious dependency injection? Well, maybe, for some classes of programs, but not many, those techniques will be useful. However, for the majority of programs, designing something to be flexible up front is over engineering. + +What if, instead, we take a position that rather than enhancing components, we replace them. Then the best way to know when something needs to be replaced, is when it doesn’t do what it says on the tin. + +A good package starts with choosing a good name. Think of your package’s name as an elevator pitch, using just one word, to describe what it provides. When the name no longer matches the requirement, find a replacement. + +### Simplicity matters + +> “Simple is better than complex.” + +The Zen of Python, Item 3 + +PEP-20 says simple is better than complex, I couldn’t agree more. A couple of years ago I made this tweet; + +> Most programming languages start out aiming to be simple, but end up just settling for being powerful. +> +> — Dave Cheney (@davecheney) [December 2, 2014][11] + +My observation, at least at the time, was that I couldn’t think of a language introduced in my life time that didn’t purport to be simple. Each new language offered as a justification, and an enticement, their inherent simplicity. But as I researched, I found that simplicity was not a core value of the many of the languages considered Go’s contemporaries. [1][12] Maybe this is just a cheap shot, but could it be that either these languages aren’t simple, or they don’t _think_ of themselves as being simple. They don’t consider simplicity to be a core value. + +Call me old fashioned, but when did being simple fall out of style? Why does the commercial software development industry continually, gleefully, forget this fundamental truth? + +> “There are two ways of constructing a software design: One way is to make it so simple that there are obviously no deficiencies, and the other way is to make it so complicated that there are no obvious deficiencies. The first method is far more difficult.” + +C. A. R. Hoare, The Emperor’s Old Clothes, 1980 Turing Award Lecture + +Simple does not mean easy, we know that. Often it is more work to make something simple to use, than easy to build. + +> “Simplicity is prerequisite for reliability.” + +Edsger W Dijkstra, EWD498, 18 June 1975 + +Why should we strive for simplicity? Why is important that Go programs be simple? Simple doesn’t mean crude, it means readable and maintainable. Simple doesn’t mean unsophisticated, it means reliable, relatable, and understandable. + +> “Controlling complexity is the essence of computer programming.” + +Brian W. Kernighan, _Software Tools_ (1976) + +Whether Python abides by its mantra of simplicity is a matter for debate, but Go holds simplicity as a core value. I think that we can all agree that when it comes to Go, simple code is preferable to clever code. + +### Avoid package level state + +> “Explicit is better than implicit.” + +_The Zen of Python, Item_ 2 + +This is a place where I think Peters’ was more aspirational than factual. Many things in Python are not explicit; decorators, dunder methods, and so on. Without doubt they are powerful, there’s a reason those features exists. Each feature is something someone cared enough about to do the work to implement it, especially the complicated ones. But heavy use of those features makes is harder for the reader to predict the cost of an operation. + +The good news is we have a choice, as Go programmers, to choose to make our code explicit. Explicit could mean many things, perhaps you may be thinking explicit is just a nice way of saying bureaucratic and long winded, but that’s a superficial interpretation. It’s a misnomer to focus only on the syntax on the page, to fret about line lengths and DRYing up expressions. The more valuable, in my opinon, place to be explicit are to do with coupling and with state. + +Coupling is a measure of the amount one thing depends on another. If two things are tightly coupled, they move together. An action that affects one is directly reflected in another. Imagine a train, each carriage joined–ironically the correct word is coupled–together; where the engine goes, the carriages follow. + +Another way to describe coupling is the word cohesion. Cohesion measures how well two things naturally belong together. We talk about a cohesive argument, or a cohesive team; all their parts fit together as if they were designed that way. + +Why does coupling matter? Because just like trains, when you need to change a piece of code, all the code that is tightly coupled to it must change. A prime example, someone release a new version of their API and now your code doesn’t compile. + +APIs are an unavoidable source of coupling but there are more insidious forms of coupling. Clearly everyone knows that if an API’s signature changes the data passing into and out of that call changes. It’s right there in the signature of the function; I take values of these types and return values of other types. But what if the API passed data another way? What if every time you called this API the result was based on the previous time you called that API even though you didn’t change your parameters. + +This is state, and management of state is _the_ problem in computer science. + +``` +package counter + +var count int + +func Increment(n int) int { + count += n + return count +} +``` + +Suppose we have this simple `counter` package. You can call `Increment` to increment the counter, you can even get the value back if you `Increment` with a value of zero. + +Suppose you had to test this code, how would you reset the counter after each test? Suppose you wanted to run those tests in parallel, could you do it? Now suppose that you wanted to count more than one thing per program, could you do it? + +No, of course not. Clearly the answer is to encapsulate the `count` variable in a type. + +``` +package counter + +type Counter struct { + count int +} + +func (c *Counter) Increment(n int) int { + c.count += n + return c.count +} +``` + +Now imagine that this problem isn’t restricted to just counters, but your applications main business logic. Can you test it in isolation? Can you test it in parallel? Can you use more than one instance at a time? If the answer those question is _no_, the reason is package level state. + +Avoid package level state. Reduce coupling and spooky action at a distance by providing the dependencies a type needs as fields on that type rather than using package variables. + +### Plan for failure, not success + +> “Errors should never pass silently.” + +_The Zen of Python, Item 1_0 + +It’s been said of languages that favour exception handling follow the Samurai principle; _return victorious or not at all_. In exception based languages functions only return valid results. If they don’t succeed then control flow takes an entirely different path. + +Unchecked exceptions are clearly an unsafe model to program in. How can you possibly write code that is robust in the presence of errors when you don’t know which statements could throw an exception? Java tried to make exceptions safer by introducing the notion of a checked exception which, to the best of my knowledge, has not been repeated in another mainstream language. There are plenty of languages which use exceptions but they all, with the singular exception of Java, do so in the unchecked variety. + +Obviously Go chose a different path. Go programmers believe that robust programs are composed from pieces that handle the failure cases _before_ they handle the happy path. In the space that Go was designed for; server programs, multi threaded programs, programs that handle input over the network, dealing with unexpected data, timeouts, connection failures and corrupted data must be front and centre of the programmer’s mind if they are to produce robust programs. + +> “I think that error handling should be explicit, this should be a core value of the language.” + +Peter Bourgon, [GoTime #91][13] + +I want to echo Peter’s assertion, as it was the impetus for this article. I think so much of the success of Go is due to the explicit way errors are handled. Go programmers thinks about the failure case first. We solve the “what if…​” case first. This leads to programs where failures are handled at the point of writing, rather than the point they occur in production. + +The verbosity of + +``` +if err != nil { + return err +} +``` + +is outweighed by the value of deliberately handling each failure condition at the point at which they occur. Key to this is the cultural value of handling each and every error explicitly. + +### Return early rather than nesting deeply + +> “Flat is better than nested.” + +The Zen of Python, Item 5 + +This is sage advice coming from a language where indentation is the primary form of control flow. How can we interpret this advice in terms of Go? `gofmt` controls the overall whitespace of a Go program so there’s not thing doing there. + +I wrote earlier about package names, and there is probably some advice here about avoiding a complicated package hierarchy. In my experience the more a programmer tries to subdivide and taxonimise their Go codebase the more they risk hitting the dead end that is package import loops. + +I think the best application of item 5’s advice is the control flow _within_ a function. Simply put, avoid control flow that requires deep indentation. + +> “Line of sight is a straight line along which an observer has unobstructed vision.” + +May Ryer, [Code: Align the happy path to the left edge][14] + +Mat Ryer describes this idea as line of sight coding. Light of sight coding means things like: + + * Using guard clauses to return early if a precondition is not met. + * Placing the successful return statement at the end of the function rather than inside a conditional block. + * Reducing the overall indentation level of the function by extracting functions and methods. + + + +Key to this advice is the thing that you care about, the thing that the function does, is never in danger of sliding out of sight to the right of your screen. This style has a bonus side effect that you’ll avoid pointless arguments about line lengths on your team. + +Every time you indent you add another precondition to the programmers stack, consuming one of their 7 ±2 short term memory slots. Rather than nesting deeply, keep the successful path of the function close to the left hand side of your screen. + +### If you think it’s slow, prove it with a benchmark + +> “In the face of ambiguity, refuse the temptation to guess.” + +The Zen of Python, Item 12 + +Programming is based on mathematics and logic, two concepts which rarely involve the element of chance. But there are many things we, as programmers, guess about every day. What does this variable do? What does this parameter do? What happens if I pass `nil` here? What happens if I call `Register` twice? There’s actually a lot of guesswork in modern programming, especially when it comes to using libraries you didn’t write. + +> “APIs should be easy to use and hard to misuse.” + +Josh Bloch + +One of the best ways I know to help a programmer avoid having to guess is to, when building an API, [focus on the default use case][15]. Make it as easy as you can for the caller to do the most common thing. However, I’ve written and talked a lot about API design in the past, so instead my interpretation of item 12 is; _don’t guess about performance_. + +Despite how you may feel about Knuth’s advice, one of the drivers of Go’s success is its efficient execution. You can write efficient programs in Go and thus people _will_ choose Go because of this. There are a lot of misconceptions about performance, so my request is, when you’re looking to performance tune your code or you’re facing some dogmatic advice like defer is slow, CGO is expensive, or always use atomics not mutexes, don’t guess. + +Don’t complicate your code because of outdated dogma, and, if you think something is slow, first prove it with a benchmark. Go has excellent benchmarking and profiling tools that come in the distribution for free. Use them to find your bottlenecks. + +### Before you launch a goroutine, know when it will stop + +At this point I think I think I’ve mined the valuable points from PEP-20 and possibly stretched its reinterpretation beyond the point of good taste. I think that’s fine, because although this was a useful rhetorical device, ultimately we are talking about two different languages. + +> “You type g o, a space, and then a function call. Three keystrokes, you can’t make it much shorter than that. Three keystrokes and you’ve just started a sub process.” + +Rob Pike, [Simplicity is Complicated][16], dotGo 2015 + +The next two suggestions I’ll dedicate to goroutines. Goroutines are the signature feature of the language, our answer for first class concurrency. They are so easy to use, just put the word `go` in front of the statement and you’ve launched that function asynchronously. It’s so simple, no threads, no stack sizes, no thread pool executors, no ID’s, no tracking completion status. + +Goroutines are cheap. Because of the runtime’s ability to multiplex goroutines onto a small pool of threads (which you don’t have to manage), hundreds of thousands, millions of goroutines are easily accommodated. This opens up designs that would be not be practical under competing concurrency models like threads or evented callbacks. + +But as cheap as goroutines are, they’re not free. At a minimum there’s a few kilobytes for their stack, which, when you’re getting up into the 10^6 goroutines, does start to add up. This is not to say you shouldn’t use millions of goroutines if that is what the design calls for, but when you do, it’s critical that you keep track of them because 10^6 of anything can consume a non trivial amount of resources in aggregate. + +Goroutines are the key to resource ownership in Go. To be useful a goroutine has to do something, and that means it almost always holds reference to, or ownership of, a resource; a lock, a network connection, a buffer with data, the sending end of a channel. While that goroutine is alive, the lock is held, the network connection remains open, the buffer retained and the receivers of the channel will continue to wait for more data. + +The simplest way to free those resources is to tie them to the lifetime of the goroutine–when the goroutine exits, the resource has been freed. So while it’s near trivial to start a goroutine, before you write those three letters, g o and a space, make sure you have an answer to these questions: + + * **Under what condition will a goroutine stop?** Go doesn’t have a way to tell a goroutine to exit. There is no stop or kill function, for good reason. If we cannot command a goroutine to stop, we must instead ask it, politely. Almost always this comes down to a channel operation. Range loops over a channel exit when the channel is closed. A channel will become selectable if it is closed. The signal from one goroutine to another is best expressed as a closed channel. + * **What is required for that condition to arise?** If channels are both the vehicle to communicate between goroutines and the mechanism for them to signal completion, the next question to the programmer becomes, who will close the channel, when will that happen? + * **What signal will you use to know the goroutine has stopped?** When you signal a goroutine to stop, that stopping will happen at some time in the future relative to the goroutine’s frame of reference. It might happen quickly in terms of human perception, but computers execute billions of instructions every second, and from the point of view of each goroutine, their execution of instructions is unsynchronised. The solution is often to use a channel to signal back or a waitgroup where a fan in approach is needed. + + + +### Leave concurrency to the caller + +It is likely that in any serious Go program you write there will be concurrency involved. This raises the problem, many of the libraries and code that we write fall into this a one goroutine per connection, or worker pattern. How will you manage the lifetime of those goroutines? + +`net/http` is a prime example. Shutting down the server owning the listening socket is relatively straight forward, but what about a goroutines spawned from that accepting socket? `net/http` does provide a context object inside the request object which can be used to signal–to code that is listening–that the request should be canceled, thereby terminating the goroutine, however it is less clear how to know when all of these things have been done. It’s one thing to call `context.Cancel`, its another to know that the cancellation has completed.[2][17] + +The point I want to make about `net/http` is that its a counter example to good practice. Because each connection is handled by a goroutine spawned inside the `net/http.Server` type, the program, living outside the `net/http` package, does not have an ability to control the goroutines spawned for the accepting socket. + +This is an area of design that is still evolving, with efforts like go-kit’s `run.Group` and the Go team’s [`ErrGroup`][18] which provide a framework to execute, cancel and wait on functions run asynchronously. + +The bigger design maxim here is for library writers, or anyone writing code that could be run asynchronously, leave the responsibility of starting to goroutine to your caller. Let the caller choose how they want to start, track, and wait on your functions execution. + +### Write tests to lock in the behaviour of your package’s API + +Perhaps you were hoping to read an article from me where I didn’t rant about testing. Sadly, today is not that day. + +Your tests are the contract about what your software does and does not do. Unit tests at the package level should lock in the behaviour of the package’s API. They describe, in code, what the package promises to do. If there is a unit test for each input permutation, you have defined the contract for what the code will do _in code_, not documentation. + +This is a contract you can assert as simply as typing `go test`. At any stage, you can _know_ with a high degree of confidence, that the behaviour people relied on before your change continues to function after your change. + +Tests lock in api behaviour. Any change that adds, modifies or removes a public api must include changes to its tests. + +### Moderation is a virtue + +Go is a simple language, only 25 keywords. In some ways this makes the features that are built into the language stand out. Equally these are the features that the language sells itself on, lightweight concurrency, structural typing. + +I think all of us have experienced the confusion that comes from trying to use all of Go’s features at once. Who was so excited to use channels that they used them as much as they could, as often as they could? Personally for me I found the result was hard to test, fragile, and ultimately overcomplicated. Am I alone? + +I had the same experience with goroutines, attempting to break the work into tiny units I created a hard to manage hurd of Goroutines and ultimately missed the observation that most of my goroutines were always blocked waiting for their predecessor– the code was ultimately sequential and I had added a lot of complexity for little real world benefit. Who has experienced something like this? + +I had the same experience with embedding. Initially I mistook it for inheritance. Then later I recreated the fragile base class problem by composing complicated types, which already had several responsibilities, into more complicated mega types. + +This is potentially the least actionable piece of advice, but one I think is important enough to mention. The advice is always the same, all things in moderation, and Go’s features are no exception. If you can, don’t reach for a goroutine, or a channel, or embed a struct, anonymous functions, going overboard with packages, interfaces for everything, instead prefer simpler approach rather than the clever approach. + +### Maintainability counts + +I want to close with one final item from PEP-20, + +> “Readability Counts.” + +The Zen of Python, Item 7 + +So much has been said, about the importance of readability, not just in Go, but all programming languages. People like me who stand on stages advocating for Go use words like simplicity, readability, clarity, productivity, but ultimately they are all synonyms for one word–_maintainability_. + +The real goal is to write maintainable code. Code that can live on after the original author. Code that can exist not just as a point in time investment, but as a foundation for future value. It’s not that readability doesn’t matter, maintainability matters _more_. + +Go is not a language that optimises for clever one liners. Go is not a language which optimises for the least number of lines in a program. We’re not optimising for the size of the source code on disk, nor how long it takes to type the program into an editor. Rather, we want to optimise our code to be clear to the reader. Because its the reader who’s going to have to maintain this code. + +If you’re writing a program for yourself, maybe it only has to run once, or you’re the only person who’ll ever see it, then do what ever works for you. But if this is a piece of software that more than one person will contribute to, or that will be used by people over a long enough time that requirements, features, or the environment it runs in may change, then your goal must be for your program to be maintainable. If software cannot be maintained, then it will be rewritten; and that could be the last time your company will invest in Go. + +Can the thing you worked hard to build be maintained after you’re gone? What can you do today to make it easier for someone to maintain your code tomorrow? + +##### [the-zen-of-go.netlify.com][2] + + 1. This part of the talk had several screenshots of the landing pages for the websites for [Ruby][19], [Swift][20], [Elm][21], [Go][22], [NodeJS][23], [Python][24], [Rust][25], highlighting how the language described itself.[][26] + 2. I tend to pick on `net/http` a lot, and this is not because it is bad, in fact it is the opposite, it is the most successful, oldest, most used API in the Go codebase. And because of that its design, evolution, and shortcoming have been thoroughly picked over. Think of this as flattery, not criticism.[][27] + + + +#### Related posts: + + 1. [Never start a goroutine without knowing how it will stop][28] + 2. [Simplicity Debt][29] + 3. [Curious Channels][30] + 4. [Let’s talk about logging][31] + + + +-------------------------------------------------------------------------------- + +via: https://dave.cheney.net/2020/02/23/the-zen-of-go + +作者:[Dave Cheney][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://dave.cheney.net/author/davecheney +[b]: https://github.com/lujun9972 +[1]: https://www.gophercon.org.il +[2]: https://the-zen-of-go.netlify.com +[3]: https://www.youtube.com/watch?v=yd_rtwYaXps +[4]: https://dave.cheney.net/wp-content/uploads/2020/02/1011226.jpg +[5]: https://dave.cheney.net/wp-content/uploads/2020/02/mean-girls-you-cant-sit-with-us-main.jpg +[6]: http://go-proverbs.github.io +[7]: https://danluu.com/microsoft-culture/ +[8]: https://dave.cheney.net/wp-content/uploads/2020/02/Lucovsky.001.jpeg +[9]: https://www.python.org/dev/peps/pep-0020/ +[10]: https://dave.cheney.net/2019/01/08/avoid-package-names-like-base-util-or-common +[11]: https://twitter.com/davecheney/status/539576755254611968?ref_src=twsrc%5Etfw +[12]: tmp.iUoDiQyXMU#easy-footnote-bottom-1-3936 (This part of the talk had several screenshots of the landing pages for the websites for Ruby, Swift, Elm, Go, NodeJS, Python, Rust, highlighting how the language described itself.) +[13]: https://changelog.com/gotime/91 +[14]: https://medium.com/@matryer/line-of-sight-in-code-186dd7cdea88 +[15]: http://sweng.the-davies.net/Home/rustys-api-design-manifesto +[16]: https://www.youtube.com/watch?v=rFejpH_tAHM +[17]: tmp.iUoDiQyXMU#easy-footnote-bottom-2-3936 (I tend to pick on net/http a lot, and this is not because it is bad, in fact it is the opposite, it is the most successful, oldest, most used API in the Go codebase. And because of that its design, evolution, and shortcoming have been thoroughly picked over. Think of this as flattery, not criticism.) +[18]: https://godoc.org/golang.org/x/sync/errgroup +[19]: https://www.ruby-lang.org/en/ +[20]: https://swift.org +[21]: https://elm-lang.org +[22]: https://golang.org +[23]: https://nodejs.org/en/ +[24]: https://www.python.org +[25]: https://www.rust-lang.org +[26]: tmp.iUoDiQyXMU#easy-footnote-1-3936 +[27]: tmp.iUoDiQyXMU#easy-footnote-2-3936 +[28]: https://dave.cheney.net/2016/12/22/never-start-a-goroutine-without-knowing-how-it-will-stop (Never start a goroutine without knowing how it will stop) +[29]: https://dave.cheney.net/2017/06/15/simplicity-debt (Simplicity Debt) +[30]: https://dave.cheney.net/2013/04/30/curious-channels (Curious Channels) +[31]: https://dave.cheney.net/2015/11/05/lets-talk-about-logging (Let’s talk about logging) diff --git a/sources/tech/20200224 17 Cool Arduino Project Ideas for DIY Enthusiasts.md b/sources/tech/20200224 17 Cool Arduino Project Ideas for DIY Enthusiasts.md new file mode 100644 index 0000000000..2cfe9c1872 --- /dev/null +++ b/sources/tech/20200224 17 Cool Arduino Project Ideas for DIY Enthusiasts.md @@ -0,0 +1,272 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (17 Cool Arduino Project Ideas for DIY Enthusiasts) +[#]: via: (https://itsfoss.com/cool-arduino-projects/) +[#]: author: (Ankush Das https://itsfoss.com/author/ankush/) + +17 Cool Arduino Project Ideas for DIY Enthusiasts +====== + +[Arduino][1] is an open-source electronics platform that combines both open source software and hardware to let people make interactive projects with ease. You can get Arduino-compatible [single board computers][2] and use them to make something useful. + +In addition to the hardware, you will also need to know the [Arduino language][3] to use the [Arduino IDE][4] to successfully create something. + +You can code using the web editor or use the Arduino IDE offline. Nevertheless, you can always refer to the [official resources][5] available to learn about Arduino. + +Considering that you know the essentials, I will be mentioning some of the best (or interesting) Arduino projects. You can try to make them for yourself or modify them to come up with something of your own. + +### Interesting Arduino project ideas for beginners, experts, everyone + +![][6] + +The following projects need a variety of additional hardware – so make sure to check out the official link to the projects (_originally featured on the [official Arduino Project Hub][7]_) to learn more about them. + +Also, it is worth noting that they aren’t particularly in any ranking order – so feel free to try what sounds best to you. + +#### 1\. LED Controller + +Looking for simple Arduino projects? Here’s one for you. + +One of the easiest projects that let you control LED lights. Yes, you do not have to opt for expensive LED products just to decorate your room (or for any other use-case), you can simply make an LED controller and customize it to use it however you want. + +It requires using the [Arduino UNO board][8] and a couple more things (which also includes an Android phone). You can learn more about it in the link to the project below. + +[LED Controller][9] + +#### 2\. Hot Glue LED Matrix Lamp + +![][10] + +Another Arduino LED project for you. Since we are talking about using LEDs to decorate, you can also make an LED lamp that looks beautiful. + +For this, you might want to make sure that you have a 3D printer. Next, you need an LED strip and **Arduino Nano R3** as the primary materials. + +Once you’ve printed the case and assembled the lamp section, all you need to do is to add the glue sticks and figure out the wiring. It does sound very simple to mention – you can learn more about it on the official Arduino project feature site. + +[LED Matrix Lamp][11] + +#### 3\. Arduino Mega Chess + +![][12] + +Want to have a personal digital chessboard? Why not? + +You’ll need a TFT LCD touch screen display and an [Arduino Mega 2560][13] board as the primary materials. If you have a 3D printer, you can create a pretty case for it and make changes accordingly. + +Take a look at the original project for inspiration. + +[Arduino Mega Chess][14] + +#### 4\. Enough Already: Mute My TV + +A very interesting project. I wouldn’t argue the usefulness of it – but if you’re annoyed by certain celebrities (or personalities) on TV, you can simply mute their voice whenever they’re about to speak something on TV. + +Technically, it was tested with the old tech back then (when you didn’t really stream anything). You can watch the video above to get an idea and try to recreate it or simply head to the link to read more about it. + +[Mute My TV][15] + +#### 5\. Robot Arm with Controller + +![][16] + +If you want to do something with the help of your robot and still have manual control over it, the robot arm with a controller is one of the most useful Arduino projects. It uses the [Arduino UNO board][8] if you’re wondering. + +You will have a robot arm -for which you can make a case using the 3D printer to enhance its usage and you can use it for a variety of use-cases. For instance, to clean the carbage using the robot arm or anything similar where you don’t want to directly intervene. + +[Robotic Arm With Controller][17] + +#### 6\. Make Musical Instrument Using Arduino + +I’ve seen a variety of musical instruments made using Arduino. You can explore the Internet if you want something different than this. + +You would need a [Pi supply flick charge][18] and an **Arduino UNO** to make it happen. It is indeed a cool Arduino project where you get to simply tap and your hand waves will be converted to music. Also, it isn’t tough to make this – so you should have a lot of fun making this. + +[Musical Instrument using Arduino][19] + +#### 7\. Pet Trainer: The MuttMentor + +An Arduino-based device that assists you to help train your pet – sounds exciting! + +For this, they’re using the [Arduino Nano 33 BLE Sense][20] while utilizing TensorFlow to train a small neural network for all the common actions that your pet does. Accordingly, the buzzer will offer a reinforcing notification when your pet obeys your command. + +This can have wide applications when tweaked as per your requirements. Check out the details below. + +[The MuttMentor][21] + +#### 8\. Basic Earthquake Detector + +Normally, you depend on the government officials to announce/inform about the earthquake stats (or the warning for it). + +But with Arduino boards, you can simply build a basic earthquake detector and have transparent results for yourself without depending on the authorities. Click on the button below to know about the relevant details to help make it. + +[Basic Earthquake Detector][22] + +#### 9\. Security Access Using RFID Reader + +![][23] + +As the project describes – “_RFID tagging is an ID system that uses small radio frequency identification_ “. + +So, in this project, you will be making an RFID reader using Arduino while pairing it with an [Adafruit NFC card][24] for security access. Check out the full details using the button below and let me know how it works for you. + +[Security Access using RFID reader][25] + +#### 10\. Smoke Detection using MQ-2 Gas Sensor + +![][26] + +This could be potentially one of the best Arduino projects out there. You don’t need to spend a lot of money to equip smoke detectors for your home, you can manage with a DIY solution to some extent. + +Of course, unless you want a complex failsafe set up along with your smoke detector, a basic inexpensive solution should do the trick. In either case, you can also find other applications for the smoke detector. + +[Smoke Detector][27] + +#### 11\. Arduino Based Amazon Echo using 1Sheeld + +![][28] + +In case you didn’t know [1Sheeld][29] basically replaces the need for an add-on Arduino board. You just need a smartphone and add Arduino shields to it so that you can do a lot of things with it. + +Using 5 such shields, the original creator of this project made himself a DIY Amazon Echo. You can find all the relevant details, schematics, and code to make it happen. + +[DIY Amazon Echo][30] + +#### 12\. Audio Spectrum Visualizer + +![][31] + +Just want to make something cool? Well, here’s an idea for an audio spectrum visualizer. + +For this, you will need an Arduino Nano R3 and an LED display as primary materials to get started with. You can tweak the display as required. You can connect it with your headphone output or simply a line-out amplifier. + +Easily one of the cheapest Arduino projects that you can try for fun. + +[Audio Spectrum Visualizer][32] + +#### 13\. Motion Following Motorized Camera + +![][33] + +Up for a challenge? If you are – this will be one of the coolest Arduino Projects in our list. + +Basically, this is meant to replace your home security camera which is limited to an angle of video recording. You can turn the same camera into a motorized camera that follows the motion. + +So, whenever it detects a movement, it will change its angle to try to follow the object. You can read more about it to find out how to make it. + +[Motion Following Motorized Camera][34] + +#### 14\. Water Quality Monitoring System + +![][35] + +If you’re concerned about your health in connection to the water you drink, you can try making this. + +It requires an Arduino UNO and the water quality sensors as the primary materials. To be honest, a useful Arduino project to go for. You can find everything you need to make this in the link below. + +[Water Quality Monitoring System][36] + +#### 15\. Punch Activated Arm Flamethrower + +I would be very cautious about this – but seriously, one of the best (and coolest) Arduino projects I’ve ever come across. + +Of course, this counts as a fun project to try out to see what bigger projects you can pull off using Arduino and here it is. In the project, he originally used the [SparkFun Arduino Pro Mini 328][37] along with an accelerometer as the primary materials. + +[Punch Activated Flamethrower][38] + +#### 16\. Polar Drawing Machine + +![][39] + +This isn’t any ordinary plotter machine that you might’ve seen people creating using Arduino boards. + +With this, you can draw some cool vector graphics images or bitmap. It might sound like bit of overkill but then it could also be fun to do something like this. + +This could be a tricky project, so you can refer to the details on the link to go through it thoroughly. + +[Polar Drawing Machine][40] + +#### 17\. Home Automation + +Technically, this is just a broad project idea because you can utilize the Arduino board to automate almost anything you want at your home. + +Just like I mentioned, you can go for a security access device, maybe create something that automatically waters the plants or simply make an alarm system. + +Countless possibilities of what you can do to automate things at your home. For reference, I’ve linked to an interesting home automation project below. + +[Home Automation][41] + +#### Bonus: Robot Cat (OpenCat) + +![][42] + +A programmable robotic cat for AI-enhanced services and STEM education. In this project, both Arduino and Raspberry Pi boards have been utilized. + +You can also look at the [Raspberry Pi alternatives][2] if you want. This project needs a lot of work, so you would want to invest a good amount of time to make it work. + +[OpenCat][43] + +**Wrapping Up** + +With the help of Arduino boards (coupled with other sensors and materials), you can do a lot of projects with ease. Some of the projects that I’ve listed above are suitable for beginners and some are not. Feel free to take your time to analyze what you need and the cost of the project before proceeding. + +Did I miss listing an interesting Arduino project that deserves the mention here? Let me know your thoughts in the comments. + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/cool-arduino-projects/ + +作者:[Ankush Das][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://itsfoss.com/author/ankush/ +[b]: https://github.com/lujun9972 +[1]: https://www.arduino.cc/ +[2]: https://itsfoss.com/raspberry-pi-alternatives/ +[3]: https://www.arduino.cc/reference/en/ +[4]: https://www.arduino.cc/en/main/software +[5]: https://www.arduino.cc/en/Guide/HomePage +[6]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/02/arduino-project-ideas.jpg?ssl=1 +[7]: https://create.arduino.cc/projecthub +[8]: https://store.arduino.cc/usa/arduino-uno-rev3 +[9]: https://create.arduino.cc/projecthub/mayooghgirish/arduino-bluetooth-basic-tutorial-d8b737?ref=platform&ref_id=424_trending___&offset=89 +[10]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/02/led-matrix-lamp.jpg?ssl=1 +[11]: https://create.arduino.cc/projecthub/john-bradnam/hot-glue-led-matrix-lamp-42322b?ref=platform&ref_id=424_trending___&offset=42 +[12]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/02/arduino-chess-board.jpg?ssl=1 +[13]: https://store.arduino.cc/usa/mega-2560-r3 +[14]: https://create.arduino.cc/projecthub/Sergey_Urusov/arduino-mega-chess-d54383?ref=platform&ref_id=424_trending___&offset=95 +[15]: https://makezine.com/2011/08/16/enough-already-the-arduino-solution-to-overexposed-celebs/ +[16]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/02/robotic-arm-controller.jpg?ssl=1 +[17]: https://create.arduino.cc/projecthub/H0meMadeGarbage/robot-arm-with-controller-2038df?ref=platform&ref_id=424_trending___&offset=13 +[18]: https://uk.pi-supply.com/products/flick-hat-3d-tracking-gesture-hat-raspberry-pi +[19]: https://create.arduino.cc/projecthub/lanmiLab/make-musical-instrument-using-arduino-and-flick-large-e2890b?ref=platform&ref_id=424_trending___&offset=24 +[20]: https://store.arduino.cc/usa/nano-33-ble-sense +[21]: https://create.arduino.cc/projecthub/whatsupdog/the-muttmentor-9d9753?ref=platform&ref_id=424_trending___&offset=44 +[22]: https://www.instructables.com/id/Basic-Arduino-Earthquake-Detector/ +[23]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/02/security-access-arduino.jpg?ssl=1 +[24]: https://www.adafruit.com/product/359 +[25]: https://create.arduino.cc/projecthub/Aritro/security-access-using-rfid-reader-f7c746?ref=platform&ref_id=424_trending___&offset=85 +[26]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/02/smoke-detection-arduino.jpg?ssl=1 +[27]: https://create.arduino.cc/projecthub/Aritro/smoke-detection-using-mq-2-gas-sensor-79c54a?ref=platform&ref_id=424_trending___&offset=89 +[28]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/02/diy-amazon-echo.jpg?ssl=1 +[29]: https://1sheeld.com/ +[30]: https://create.arduino.cc/projecthub/ahmedismail3115/arduino-based-amazon-echo-using-1sheeld-84fa6f?ref=platform&ref_id=424_trending___&offset=91 +[31]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/02/audio-spectrum-visualizer.jpg?ssl=1 +[32]: https://create.arduino.cc/projecthub/Shajeeb/32-band-audio-spectrum-visualizer-analyzer-902f51?ref=platform&ref_id=424_trending___&offset=87 +[33]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/02/motion-following-camera.jpg?ssl=1 +[34]: https://create.arduino.cc/projecthub/lindsi8784/motion-following-motorized-camera-base-61afeb?ref=platform&ref_id=424_trending___&offset=86 +[35]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/02/water-quality-monitoring.jpg?ssl=1 +[36]: https://create.arduino.cc/projecthub/chanhj/water-quality-monitoring-system-ddcb43?ref=platform&ref_id=424_trending___&offset=93 +[37]: https://www.sparkfun.com/products/11113 +[38]: https://create.arduino.cc/projecthub/Advanced/punch-activated-arm-flamethrowers-real-firebending-95bb80 +[39]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/02/polar-drawing-machine.jpg?ssl=1 +[40]: https://create.arduino.cc/projecthub/ArduinoFT/polar-drawing-machine-f7a05c?ref=search&ref_id=drawing&offset=2 +[41]: https://create.arduino.cc/projecthub/ahmedel-hinidy2014/home-management-system-control-your-home-from-a-website-076846?ref=search&ref_id=home%20automation&offset=4 +[42]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/02/opencat.jpg?ssl=1 +[43]: https://create.arduino.cc/projecthub/petoi/opencat-845129?ref=platform&ref_id=424_popular___&offset=8 diff --git a/sources/tech/20200224 Make free encrypted backups to the cloud on Fedora.md b/sources/tech/20200224 Make free encrypted backups to the cloud on Fedora.md new file mode 100644 index 0000000000..6015e6dc92 --- /dev/null +++ b/sources/tech/20200224 Make free encrypted backups to the cloud on Fedora.md @@ -0,0 +1,237 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Make free encrypted backups to the cloud on Fedora) +[#]: via: (https://fedoramagazine.org/make-free-encrypted-backups-to-the-cloud-on-fedora/) +[#]: author: (Curt Warfield https://fedoramagazine.org/author/rcurtiswarfield/) + +Make free encrypted backups to the cloud on Fedora +====== + +![][1] + +Most free cloud storage is limited to 5GB or less. Even Google Drive is limited to 15GB. While not heavily advertised, IBM offers free accounts with a whopping **25GB** of cloud storage for free. This is not a limited time offer, and you don’t have to provide a credit card. It’s absolutely free! Better yet, since it’s S3 compatible, most of the S3 tools available for backups should work fine. + +This article will show you how to use restic for encrypted backups onto this free storage. Please also refer to [this previous Magazine article about installing and configuring restic.][2] Let’s get started! + +### Creating your free IBM account and storage + +Head over to the IBM cloud services site and follow the steps to sign up for a free account here: . You’ll need to verify your account from the email confirmation that IBM sends to you. + +Then log in to your account to bring up your dashboard, at . + +Click on the **Create resource** button. + +![][3] + +Click on **Storage** and then **Object Storage**. + +![][4] + +Next click on the **Create Bucket** button. + +![][5] + +This brings up the **Configure your resource** section. + +![][6] + +Next, click on the ****Create** button to use the default settings. + +![][7] + +Under **Predefined buckets** click on the **Standard** box: + +![][8] + +A unique bucket name is automatically created, but it’s suggested that you change this. + +![][9] + +In this example, the bucket name is changed to __freecloudstorage_._** + +Click on the **Next** button after choosing a bucket name: + +![][10] + +Continue to click on the **Next** button until you get the the **Summary** page: + +![][11] + +Scroll down to the **Endpoints** section. + +![][12] + +The information in the **Public** section is the location of your bucket. This is what you need to specify in restic when you create your backups. In this example, the location is **s3.us-south.cloud-object-storage.appdomain.cloud**. + +### Making your credentials + +The last thing that you need to do is create an access ID and secret key. To start, click on **Service credentials**. + +![][13] + +Click on the **New credential** button. + +![][14] + +Choose a name for your credential, make sure you check the **Include HMAC Credential** box and then click on the **Add** button. In this example I’m using the name **resticbackup**. + +![][15] + +Click on **View credentials**. + +![][16] + +The _access_key_id_ and _secret_access_key_ is what you are looking for. (For obvious reasons, the author’s details here are obscured.) + +You will need to export these by calling them with the _export_ alias in the shell, or putting them into a backup script. + +![][17] + +### Preparing a new repository + +Restic refers to your backup as a _repository_, and can make backups to any bucket on your IBM cloud account. First, setup the following environment variables using your _access_key_id_ and _secret_access_key_ that you retrieved from your IBM cloud bucket. These can also be set in any backup script you may create. + +``` +$ export AWS_ACCESS_KEY_ID= +$ export AWS_SECRET_ACCESS_KEY= +``` + +Even though you are using IBM Cloud and not AWS, as previously mentioned, IBM Cloud storage is S3 compatible, and restic uses its interal AWS commands for any S3 compatible storage. So these AWS keys really refer to the keys from your IBM bucket. + +Create the repository by initializing it. A prompt appears for you to type a password for the repository. _**Do not lose this password because your data is irrecoverable without it!**_ + +``` +restic -r s3:http://PUBLIC_ENDPOINT_LOCATION/BUCKET init +``` + +The _PUBLIC_ENDPOINT_LOCATION_ was specified in the Endpoint section of your Bucket summary. + +![][18] + +For example: + +``` +$ restic -r s3:http://s3.us-south.cloud-object-storage.appdomain.cloud/freecloudstorage init +``` + +### Creating backups + +Now it’s time to backup some data. Backups are called _snapshots_. Run the following command and enter the repository password when prompted. + +``` +restic -r s3:http://PUBLIC_ENDPOINT_LOCATION/BUCKET backup files_to_backup +``` + +For example: + +``` +$ restic -r s3:http://s3.us-south.cloud-object-storage.appdomain.cloud/freecloudstorage backup Documents/ +Enter password for repository: + repository 106a2eb4 opened successfully, password is correct + Files: 51 new, 0 changed, 0 unmodified + Dirs: 0 new, 0 changed, 0 unmodified + Added to the repo: 11.451 MiB + processed 51 files, 11.451 MiB in 0:06 + snapshot 611e9577 saved +``` + +### Restoring from backups + +Now that you’ve backed up some files, it’s time to make sure you know how to restore them. To get a list of all of your backup snapshots, use this command: + +``` +restic -r s3:http://PUBLIC_ENDPOINT_LOCATION/BUCKET snapshots +``` + +For example: + +``` +$ restic -r s3:http://s3.us-south.cloud-object-storage.appdomain.cloud/freecloudstorage snapshots +Enter password for repository: +ID Date Host Tags Directory +------------------------------------------------------------------- +106a2eb4 2020-01-15 15:20:42 client /home/curt/Documents +``` + +To restore an entire snapshot, run a command like this: + +``` +restic -r s3:http://s3.us-south.cloud-object-storage.appdomain.cloud/freecloudstorage restore snapshotID --target restoreDirectory +``` + +For example: + +``` +$ restic -r s3:http://s3.us-south.cloud-object-storage.appdomain.cloud/freecloudstorage restore 106a2eb4 --target ~ +Enter password for repository: +repository 106a2eb4 opened successfully, password is correct +restoring to /tmp +``` + +* * * + +_Photo by [Alex Machado][19] on [Unsplash][20]._ + +[EDITORS NOTE: The Fedora Project is [sponsored][21] by [Red Hat][22], which is owned by [IBM][23].] + +[EDITORS NOTE: Updated at 1647 UTC on 24 February 2020 to correct a broken link.] + +-------------------------------------------------------------------------------- + +via: https://fedoramagazine.org/make-free-encrypted-backups-to-the-cloud-on-fedora/ + +作者:[Curt Warfield][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://fedoramagazine.org/author/rcurtiswarfield/ +[b]: https://github.com/lujun9972 +[1]: https://fedoramagazine.org/wp-content/uploads/2020/01/encrypted-backups-ibm-cloud-816x345.jpg +[2]: https://fedoramagazine.org/use-restic-encrypted-backups/ +[3]: https://fedoramagazine.org/wp-content/uploads/2020/01/ibmclouddash-3-e1579713553261.png +[4]: https://fedoramagazine.org/wp-content/uploads/2020/01/ibmcloudresourcestorage-3.png +[5]: https://fedoramagazine.org/wp-content/uploads/2020/01/ibmcloudbucket-3.png +[6]: https://fedoramagazine.org/wp-content/uploads/2020/01/ibmcloudbucket2.png +[7]: https://fedoramagazine.org/wp-content/uploads/2020/01/ibmcloudbucket3-e1579713758635.png +[8]: https://fedoramagazine.org/wp-content/uploads/2020/01/ibmcloudbucket4.png +[9]: https://fedoramagazine.org/wp-content/uploads/2020/01/createbucket1.png +[10]: https://fedoramagazine.org/wp-content/uploads/2020/01/next.png +[11]: https://fedoramagazine.org/wp-content/uploads/2020/01/bucketsummary-1024x368.png +[12]: https://fedoramagazine.org/wp-content/uploads/2020/01/endpoints-1024x272.png +[13]: https://fedoramagazine.org/wp-content/uploads/2020/01/servicecreds.png +[14]: https://fedoramagazine.org/wp-content/uploads/2020/01/newcred.png +[15]: https://fedoramagazine.org/wp-content/uploads/2020/01/addnewcred.png +[16]: https://fedoramagazine.org/wp-content/uploads/2020/01/keys-1024x298.png +[17]: https://fedoramagazine.org/wp-content/uploads/2020/01/keys2.png +[18]: https://fedoramagazine.org/wp-content/uploads/2020/01/publicendpoint.png +[19]: https://unsplash.com/@alexmachado?utm_source=unsplash&utm_medium=referral&utm_content=creditCopyText +[20]: https://unsplash.com/s/photos/backups-to-cloud?utm_source=unsplash&utm_medium=referral&utm_content=creditCopyText +[21]: https://getfedora.org/sponsors/ +[22]: https://redhat.com +[23]: https://www.ibm.com/cloud/redhat diff --git a/sources/tech/20200228 4 technologists on careers in tech for minorities.md b/sources/tech/20200228 4 technologists on careers in tech for minorities.md new file mode 100644 index 0000000000..806300d5db --- /dev/null +++ b/sources/tech/20200228 4 technologists on careers in tech for minorities.md @@ -0,0 +1,126 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (4 technologists on careers in tech for minorities) +[#]: via: (https://opensource.com/article/20/2/careers-tech-minorities) +[#]: author: (Shilla Saebi https://opensource.com/users/shillasaebi) + +4 technologists on careers in tech for minorities +====== +Learn what Black History Month means to them, what influences their +career, resources for minorities wanting to break into tech, and more. +![Team meeting][1] + +In honor of Black History Month, I've garnered the opinions of a few of my favorite technology professionals and open source contributors. These four individuals are paving the way for the next generation alongside the work they're doing in the technology industry. Learn what Black History Month means to them, what influences their career, resources for minorities wanting to break into tech, and more. + +**[Tameika Reed][2], founder of Women In Linux** + +Since its launch, Tameika leads initiatives with a focus on exploring careers in infrastructure, cybersecurity, DevOps and IoT, pivoting into leadership and continuous skill-building. As a self-taught system administrator, Tameika believes the best way to learn tech is by just diving in. In efforts to give women a 360° view of tech, Tameika hosts a weekly virtual meetup to explore outside the norm of just Linux but introducing hyperledger, Kubernetes, microservices, and high-performance computing. Tameika’s career includes different conference talks from OSCon, LISA 2018, Seagl, HashiCorp EU 2019, and various local events. + +**[Michael Scott Winslow][3], Director, Core Applications and Platforms, Comcast** + +"I'm a father, husband, brother, and son. I come from a small family so I have fun turning friends into an extended family. When I attach my name to something, I obsess over its success, so I am very careful what I agree to be a part of. Oh, so as far as my career I have been involved with software development for decades. I solve problems. I work with others to help solve large problems. I lead, guide and mentor newer software engineers while observing others that I want to learn from." + +**[Bryan Liles][4], senior staff engineer, VMware** + +"I’m working with our team to rethink how developers interact with Kubernetes. When not working, I’m out in the community trying to inspire the next generation of software engineers and building robots." + +**[Mutale Nkonde][5], founding CEO of AI For the People (AFP)** + +AFP is a nonprofit creative agency. Prior to starting a nonprofit she worked in AI Governance. During that time she was part of the team that introduced the Algorithmic and Deep Fakes Algorithmic Acts, as well as the No Biometric Barriers to Housing Act to the US House of Representatives. Nkonde started her career as a broadcast journalist and worked at the BBC, CNN & ABC. She also writes widely on race and tech, as well as holding fellowships at Harvard and Stanford. + +### What influenced you to pursue a career in technology? + +My fear of the computer when I went back to college. I was afraid of the computer because I dropped out of college. After and going back, I made it my mission to learn all I can. This is still my motto to this day, learning never stops. —Tameika Reed + +I won’t mince words, I was a child geek! At 10 years old I started writing GW-BASIC from code that I read in printed magazines. Every single day. I gave it a bit of a break to have a life while I went to high school, but when it came time to pick a major for college, it was an easy choice. I stayed in technology thanks to the amazing mentors and colleagues I’ve had along the way. —Michael Scott Winslow + +I’ve been writing software since I was in middle school. I like being able to tell computers to do things and seeing the results. As an adult, I quickly realized that having a job that gave me satisfaction and paid well was the way to go. —Bryan Liles + +I wanted to explore the questions around why so few black women were being hired by tech companies. —Mutale Nkonde + +### Is there a particular person or people in open source and the tech world who have inspired you? + +I get inspired by a lot of other people and projects. For example, I love seeing others come to [Women In Linux][6] and are sure where they want to go. I try to give people a 360-view of tech so they can make a decision on what they like. Its easy to say I want to be in tech but it’s hard to get started and stay. You don’t have to be just a coder/programmer but you can be a cloud architect. —Tameika Reed + +[Kelsey Hightower][7], [Bryan Liles][4], and Kim Scott inspire me very much. They are so REAL! They say things that I feel and experience every day. Get your job done! Stop complaining! Own your actions and understand how you contribute to your situation! [Gene Kim][8] is a big inspiration as well. As a leader in the DevOps movement, I see myself following and emulating a lot of things he does. —Michael Scott Winslow + +No. I didn’t see the inspiration I wanted, so I’ve worked hard to be the inspiration I needed 20 years ago. —Bryan Liles + +There are so many! One of my favorites is [Dorothy Vaughan][9]: She was the first person in the US to program an IBM Watson computer. Her story is captured in the movie Hidden Figures. —Mutale Nkonde + +### Are there particular resources you would recommend for minorities wanting to break into tech? + +Yes, I recommend finding folks on Twitter and just ask questions. Here is a list of people I follow and admire in tech: —Tameika Reed + + * [@techgirl1908][10] + * [@bryanl][4] + * [@kelseyhightower][7] + * [@kstewart][11] + * [@tiffani][12] + * [@EricaJoy][13] + * [@womeninlinux][6] + * [@ArlanWasHere][14] + * [@blkintechnology][15] + * [@digundiv][16] + + + +Respected bootcamps are really cutting down the time it takes to break into the tech industry. I’ve met several professionals who went through bootcamps who have outshined their 4-year institution counterparts. I think we can really start respecting everything that people bring to the table, rather than technical fluency. —Michael Scott Winslow + +I’m not sure I can recommend anything specific. Tech is a big thing and there isn’t an easy answer. My advice is to pick something you think will be interested in and work to become an expert on the topic. Start asking why instead of how, and also start understanding how things work together. — Bryan Liles + +It really depends on the type of work they want to do. For people working at the intersection of tech and social justice, I would recommend the book [Algorithms of Oppression][17] by Safiya Noble. —Mutale Nkonde + +### What advice would you give to a person of color considering technology as their career? + +I suggest you study your craft. You will be a forever learner. There will always be someone or something in your way how you respond and move will be on you. Never take the first offer push back and know your worth. I look at tech like I look at art. It takes time to develop so be patient with yourself. It's okay to unplug and say no. —Tameika Reed + +As someone who is a bit of a protector of the industry, I don’t want people who are not suited for technology. So really decide if you have the personality for tech. Are you a problem solver? Are you more logical than emotional? Do you constantly find yourself creating processes? If so, no matter your background, I think you can find a home in tech. —Michael Scott Winslow + +It is not going to be simple. Your progress will be slowed because of your race. You will have to work harder. Use this adversity as a strength. You will be better prepared than those around you and when the opportunity arises, you will be able to tackle it. Find a network of those who look like you. Air grievances in private and show strength in public. You belong and you can succeed. —Bryan Liles + +To think beyond working for a company, the field of public interest tech is growing, our work centers on how technology impacts real people. Many of the people leading this work are women of color and Black women are making huge strides. Mutale Nkonde + +### What does Black History Month mean to you? + +It means never stop because you can never forget. —Tameika Reed + +Black History Month to me means focusing on the Tuskegee Airmen and not slavery. Highlighting how we contributed to history and not how were victims of it. I want people to understand where our pride comes from and not our anger. There are a lot of really bad things that happened to our people and we are still right here. Strong! —Michael Scott Winslow + +Black History Month is a time to reflect on the forgotten history of black people in the United States. I take it as a time to be thankful for the sacrifices my ancestors made. —Bryan Liles + +It is a time to center the contributions black people have made across the globe. I love it, it is one of my favorite times of year. —Mutale Nkonde + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/2/careers-tech-minorities + +作者:[Shilla Saebi][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/shillasaebi +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/meeting-team-listen-communicate.png?itok=KEBP6vZ_ (Team meeting) +[2]: https://www.linkedin.com/in/tameika-reed-1a7290128/ +[3]: https://twitter.com/michaelswinslow +[4]: https://twitter.com/bryanl +[5]: https://twitter.com/mutalenkonde +[6]: https://twitter.com/WomenInLinux +[7]: https://twitter.com/kelseyhightower +[8]: https://twitter.com/RealGeneKim +[9]: https://en.wikipedia.org/wiki/Dorothy_Vaughan +[10]: https://twitter.com/techgirl1908 +[11]: https://twitter.com/kstewart +[12]: https://twitter.com/tiffani +[13]: https://twitter.com/EricaJoy +[14]: https://twitter.com/ArlanWasHere +[15]: https://twitter.com/blkintechnology +[16]: https://twitter.com/digundiv +[17]: http://algorithmsofoppression.com/ diff --git a/sources/tech/20200228 Fedora-s gaggle of desktops.md b/sources/tech/20200228 Fedora-s gaggle of desktops.md new file mode 100644 index 0000000000..d92d84344a --- /dev/null +++ b/sources/tech/20200228 Fedora-s gaggle of desktops.md @@ -0,0 +1,411 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Fedora’s gaggle of desktops) +[#]: via: (https://fedoramagazine.org/fedoras-gaggle-of-desktops/) +[#]: author: (Troy Dawson https://fedoramagazine.org/author/tdawson/) + +Fedora’s gaggle of desktops +====== + +![][1] + +There are 38 different desktops or window managers in Fedora 31. You could try a different one every day for a month, and still have some left over. Some have very few features. Some have so many features they are called a desktop environment. This article can’t go into detail on each, but it’s interesting to see the whole list in one place. + +### Criteria for desktops + +To be on this list, the desktop must show up on the desktop manager’s selection list. If the desktop has more than one entry in the desktop manager list, they are counted just as that one desktop. An example is “GNOME”, “GNOME Classic” and “GNOME (Wayland).” These all show up on the desktop manager list, but they are still just GNOME. + +### List of desktops +``` + +``` + +#### [**9wm**][2] + +``` +Emulation of the Plan 9 window manager 8 1/2 + dnf install 9wm +``` + +#### [**awesome**][3] + +``` +Highly configurable, framework window manager for X. Fast, light and extensible +https://fedoramagazine.org/5-cool-tiling-window-managers/ + dnf install awesome +``` + +#### [**blackbox**][4] + +``` +Very small and fast Window Manager +Fedora uses the maintained fork on github + dnf install blackbox +``` + +#### [**bspwm**][5] + +``` +A tiling window manager based on binary space partitioning +https://github.com/windelicato/dotfiles/wiki/bspwm-for-dummies + dnf install bspwm +``` + +#### **[byobu][6]** + +``` +Light-weight, configurable window manager built upon GNU screen + dnf install byobu +``` + +#### **[Cinnamon][7]** + +``` +Cinnamon provides a desktop with a traditional layout, advanced features, easy to use, powerful and flexible. +https://projects.linuxmint.com/cinnamon/ +https://opensource.com/article/19/12/cinnamon-linux-desktop + dnf group install "Cinnamon Desktop" +``` + +#### **[cwm][8]** + +``` +Calm Window Manager by OpenBSD project +https://steemit.com/technology/@jamesdeagle/the-calm-window-manager-cwm-a-quick-start-guide + dnf install cwm +``` + +#### **[Deepin][9]** + +``` +Deepin desktop is the desktop environment released with deepin (the linux distribution). It aims at being elegant and easy to use. + dnf group install "Deepin Desktop" + (optional) dnf group install "Deepin Desktop Office" "Media packages for Deepin Desktop" +``` + +#### **[dwm][10]** + +``` +Dynamic window manager for X +https://fedoramagazine.org/lets-try-dwm-dynamic-window-manger/ +https://fedoramagazine.org/5-cool-tiling-window-managers/ + dnf install dwm + (optional) dnf install dwm-user +``` + +#### **[enlightenment][11]** + +``` +Enlightenment window manager +https://opensource.com/article/19/12/linux-enlightenment-desktop + dnf install enlightenment +``` + +#### **[e16][11]** + +``` +The Enlightenment window manager, DR16 + dnf install e16 + (optional) dnf install e16-epplets e16-keyedit e16-themes +``` + +#### **[fluxbox][12]** + +``` +Window Manager based on Blackbox + dnf install fluxbox + (optional) dnf install fluxbox-pulseaudio fluxbox-vim-syntax +``` + +#### **[fvwm][13]** + +``` +Highly configurable multiple virtual desktop window manager +http://www.fvwm.org/ +https://opensource.com/article/19/12/fvwm-linux-desktop + dnf install fvwm +``` + +#### **[GNOME][14]** + +``` +GNOME is a highly intuitive and user friendly desktop environment. +* both X11 and wayland +https://opensource.com/article/19/12/gnome-linux-desktop +https://fedoramagazine.org/3-simple-and-useful-gnome-shell-extensions/ + dnf group install "GNOME" + (optional but large) dnf group install "Fedora Workstation" +``` + +#### **[herbstluftwm][15]** + +``` +A manual tiling window manager +https://opensource.com/article/19/12/herbstluftwm-linux-desktop + dnf install herbstluftwm + (optional) dnf install herbstluftwm-zsh herbstluftwm-fish +``` + +#### **[i3][16]** + +``` +Improved tiling window manager +https://fedoramagazine.org/getting-started-i3-window-manager/ +https://fedoramagazine.org/using-i3-with-multiple-monitors/ + dnf install i3 + (optional) dnf install i3-doc i3-ipc +``` + +#### **[icewm][17]** + +``` +Window manager designed for speed, usability, and consistency +https://fedoramagazine.org/icewm-a-really-cool-desktop/ + dnf install icewm + (optional) dnf install icewm-minimal-session +``` + +#### **[jwm][18]** + +``` +Joe's Window Manager +https://opensource.com/article/19/12/joes-window-manager-linux-desktop + dnf install jwm +``` + +#### **[KDE Plasma Desktop][19]** + +``` +The KDE Plasma Workspaces, a highly-configurable graphical user interface which includes a panel, desktop, system icons and desktop widgets, and many powerful KDE applications. +* both X11 and wayland +https://opensource.com/article/19/12/linux-kde-plasma +https://fedoramagazine.org/installing-kde-plasma-5/ + dnf group install "KDE Plasma Workspaces" + (optional) dnf group install "KDE Applications" "KDE Educational applications" "KDE Multimedia support" "KDE Office" "KDE Telepathy" + (optional for wayland) dnf install kwin-wayland plasma-workspace-wayland +``` + +#### **[lumina][20]** + +``` +A lightweight, portable desktop environment +https://opensource.com/article/19/12/linux-lumina-desktop + dnf install lumina-desktop + (optional) dnf install lumina-* +``` + +#### **[LXDE][21]** + +``` +LXDE is a lightweight X11 desktop environment designed for computers with low hardware specifications like netbooks, mobile devices or older computers. +https://opensource.com/article/19/12/lxqt-lxde-linux-desktop + dnf group install "LXDE Desktop" + (optional) dnf group install "LXDE Office" "Multimedia support for LXDE" +``` + +#### **[LXQt][22]** + +``` +LXQt is a lightweight X11 desktop environment designed for computers with low hardware specifications like netbooks, mobile devices or older computers. +https://opensource.com/article/19/12/lxqt-lxde-linux-desktop + dnf group install "LXQt Desktop" + (optional) dnf group install "LXQt Office" "Multimedia support for LXQt" +``` + +#### **[MATE][23]** + +``` +MATE Desktop is based on GNOME 2 and provides a powerful graphical user interface for users who seek a simple easy to use traditional desktop interface. +https://opensource.com/article/19/12/mate-linux-desktop +https://fedoramagazine.org/installing-another-desktop/ + dnf group install "MATE Desktop" + (optional) dnf group install "MATE Applications" +``` + +#### **[musca][24]** + +``` +A simple dynamic window manager fox X + dnf install musca +``` + +#### **[openbox][25]** + +``` +A highly configurable and standards-compliant X11 window manager +https://opensource.com/article/19/12/openbox-linux-desktop +https://fedoramagazine.org/openbox-fedora/ + dnf install openbox + (optional) dnf install openbox-kde openbox-theme-mistral-thin-dark +``` + +#### **[Pantheon][26]** + +``` +The Pantheon desktop environment is the DE that powers elementaryOS. +https://github.com/elementary +https://opensource.com/article/19/12/pantheon-linux-desktop + dnf group install "Pantheon Desktop" + (optional) dnf install elementary-capnet-assist elementary-greeter elementary-shortcut-overlay +``` + +#### **[pekwm][27]** + +``` +A small and flexible window manager +https://opensource.com/article/19/12/pekwm-linux-desktop + dnf install pekwm +``` + +#### **[qtile][28]** + +``` +A pure-Python tiling window manager +https://fedoramagazine.org/5-cool-tiling-window-managers/ + dnf install qtile +``` + +#### **[ratpoison][29]** + +``` +Minimalistic window manager +https://opensource.com/article/19/12/ratpoison-linux-desktop + dnf install ratpoison +``` + +#### **[sawfish][30]** + +``` +An extensible window manager for the X Window System + dnf install sawfish + (optional) dnf install sawfish-pager +``` + +#### **[spectrwm][31]** + +``` +Minimalist tiling window manager written in C + dnf install spectrwm +``` + +#### **[Sugar][32]** + +``` +A software playground for learning about learning. +* Possibly the most unique desktop of this list. + dnf group install "Sugar Desktop Environment" + (optional) dnf group install "Additional Sugar Activities" +``` + +#### **[sway][33]** + +``` +i3-compatible window manager for Wayland +* Wayland only +https://fedoramagazine.org/setting-up-the-sway-window-manager-on-fedora/ +https://fedoramagazine.org/5-cool-tiling-window-managers/ + dnf install sway +``` + +#### **[twm][34]** + +``` +X.Org X11 twm window manager +https://en.wikipedia.org/wiki/Twm +https://opensource.com/article/19/12/twm-linux-desktop + dnf install xorg-x11-twm +``` + +#### **[WindowMaker][35]** + +``` +A fast, feature rich Window Manager +https://opensource.com/article/19/12/linux-window-maker-desktop + dnf install WindowMaker + (optional) dnf install WindowMaker-extra +``` + +#### **[wmx][36]** + +``` +A really simple window manager for X + dnf install wmx +``` + +#### **[XFCE][37]** + +``` +A lightweight desktop environment that works well on low end machines. +https://opensource.com/article/19/12/xfce-linux-desktop + dnf group install "Xfce Desktop" + (optional) dnf group install "Applications for the Xfce Desktop" "Extra plugins for the Xfce panel" "Multimedia support for Xfce" "Xfce Office" +``` + +#### **[xmonad][38]** + +``` +A tiling window manager + dnf install xmonad + (optional) dnf install xmonad-mate +``` + +* * * + +_Photo by [Annie Spratt][39] on [Unsplash][40]._ + +-------------------------------------------------------------------------------- + +via: https://fedoramagazine.org/fedoras-gaggle-of-desktops/ + +作者:[Troy Dawson][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://fedoramagazine.org/author/tdawson/ +[b]: https://github.com/lujun9972 +[1]: https://fedoramagazine.org/wp-content/uploads/2020/01/gaggle-desktops-816x345.jpg +[2]: https://github.com/9wm/9wm +[3]: https://awesomewm.org/ +[4]: https://github.com/bbidulock/blackboxwm +[5]: https://github.com/baskerville/bspwm +[6]: https://byobu.org/ +[7]: https://github.com/linuxmint/cinnamon +[8]: https://github.com/leahneukirchen/cwm +[9]: https://www.deepin.org/en/dde/ +[10]: http://dwm.suckless.org/ +[11]: https://www.enlightenment.org/ +[12]: http://fluxbox.org/ +[13]: https://github.com/fvwmorg/fvwm +[14]: https://www.gnome.org/ +[15]: http://herbstluftwm.org/ +[16]: https://i3wm.org/ +[17]: https://ice-wm.org/ +[18]: http://joewing.net/projects/jwm/ +[19]: https://kde.org/ +[20]: https://lumina-desktop.org/ +[21]: https://lxde.org/ +[22]: https://lxqt.org/ +[23]: https://mate-desktop.org/ +[24]: https://github.com/enticeing/musca +[25]: http://openbox.org +[26]: https://elementary.io/ +[27]: http://www.pekwm.org/ +[28]: http://qtile.org +[29]: http://www.nongnu.org/ratpoison/ +[30]: http://sawfish.wikia.com/ +[31]: https://github.com/conformal/spectrwm +[32]: https://sugarlabs.org/ +[33]: https://github.com/swaywm/sway +[34]: https://www.x.org/releases/X11R7.6/doc/man/man1/twm.1.xhtml +[35]: http://www.windowmaker.org +[36]: http://www.all-day-breakfast.com/wmx/ +[37]: https://www.xfce.org/ +[38]: https://hackage.haskell.org/package/xmonad +[39]: https://unsplash.com/@anniespratt?utm_source=unsplash&utm_medium=referral&utm_content=creditCopyText +[40]: https://unsplash.com/?utm_source=unsplash&utm_medium=referral&utm_content=creditCopyText diff --git a/sources/tech/20200228 How to process real-time data with Apache.md b/sources/tech/20200228 How to process real-time data with Apache.md new file mode 100644 index 0000000000..7bf16741b4 --- /dev/null +++ b/sources/tech/20200228 How to process real-time data with Apache.md @@ -0,0 +1,87 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How to process real-time data with Apache) +[#]: via: (https://opensource.com/article/20/2/real-time-data-processing) +[#]: author: (Simon Crosby https://opensource.com/users/simon-crosby) + +How to process real-time data with Apache +====== +Open source is leading the way with a rich canvas of projects for +processing real-time events. +![Alarm clocks with different time][1] + +In the "always-on" future with billions of connected devices, storing raw data for analysis later will not be an option because users want accurate responses in real time. Prediction of failures and other context-sensitive conditions require data to be processed in real time—certainly before it hits a database. + +It's tempting to simply say "the cloud will scale" to meet demands to process streaming data in real time, but some simple examples show that it can never meet the need for real-time responsiveness to boundless data streams. In these situations—from mobile devices to IoT—a new paradigm is needed. Whereas cloud computing relies on a "store then analyze" big data approach, there is a critical need for software frameworks that are comfortable instantly processing endless, noisy, and voluminous streams of data as they arrive to permit a real-time response, prediction, or insight. + +For example, the city of Palo Alto, Calif. produces more streaming data from its traffic infrastructure per day than the Twitter Firehose. That's a lot of data. Predicting city traffic for consumers like Uber, Lyft, and FedEx requires real-time analysis, learning, and prediction. Event processing in the cloud leads to an inescapable latency of about half a second per event. + +We need a simple yet powerful programming paradigm that lets applications process boundless data streams on the fly in these and similar situations: + + * Data volumes are huge, or moving raw data is expensive. + * Data is generated by widely distributed assets (such as mobile devices). + * Data is of ephemeral value, and analysis can't wait. + * It is critical to always have the latest insight, and extrapolation won't do. + + + +### Publish and subscribe + +A key architectural pattern in the domain of event-driven systems is the concept of pub/sub or publish/subscribe messaging. This is an asynchronous communication method in which messages are delivered from _publishers_ (anything producing data) to *subscribers (*applications that process data). Pub/sub decouples arbitrary numbers of senders from an unknown set of consumers. + +In pub/sub, sources _publish_ events for a _topic_ to a _broker_ that stores them in the order in which they are received. An application _subscribes_ to one or more _topics_, and the _broker_ forwards matching events. Apache Kafka and Pulsar and CNCF NATS are pub/sub systems. Cloud services for pub/sub include Google Pub/Sub, AWS Kinesis, Azure Service Bus, Confluent Cloud, and others. + +Pub/sub systems do not _run_ subscriber applications—they simply _deliver_ data to topic subscribers. + +Streaming data often contains events that are updates to the state of applications or infrastructure. When choosing an architecture to process data, the role of a data-distribution system such as a pub/sub framework is limited. The "how" of the consumer application lies beyond the scope of the pub/sub system. This leaves an enormous amount of complexity for the developer to manage. So-called stream processors are a special kind of subscriber that analyzes data on the fly and delivers results back to the same broker. + +### Apache Spark + +[Apache Spark][2] is a unified analytics engine for large-scale data processing. Often, Apache Spark Streaming is used as a stream processor, for example, to feed machine learning models with new data. Spark Streaming breaks data into mini-batches that are each independently analyzed by a Spark model or some other system. The stream of events is grouped into mini-batches for analysis, but the stream processor itself must be elastic: + + * The stream processor must be capable of scaling with the data rate, even across servers and clouds, and also balance load across instances, ensuring resilience and other application-layer needs. + * It must be able to analyze data from sources that report at widely different rates, meaning it must be stateful—or store state in a database. This latter approach is often used when Spark Streaming is used as the stream processor and can cause performance problems when ultra-low latency responses are needed. + + + +A related project, [Apache Samza][3], offers a way to process real-time event streams, and to scale elastically using [Hadoop Yarn][4] or [Apache Mesos][5] to manage compute resources. + +### Solving the problem of scaling data + +It's important to note that even Samza cannot entirely alleviate data processing demands for the application developer. Scaling data rates mean that tasks to process events need to be load-balanced across many instances, and the only way to share the resulting application-layer state between instances is to use a database. However, the moment state coordination between tasks of an application devolves to a database, there is an inevitable knock-on effect upon performance. Moreover, the choice of database is crucial. As the system scales, cluster management for the database becomes the next potential bottleneck. + +This can be solved with alternative solutions that are stateful, elastic, and can be used in place of a stream processor. At the application level (within each container or instance), these solutions build a stateful model of concurrent, interlinked "web agents" on the fly from streaming updates. Agents are concurrent "nano-services" that consume raw data for a single source and maintain their state. Agents interlink to share state based on real-world relationships between sources found in the data, such as containment and proximity. Agents thus form a graph of concurrent services that can analyze their own state and the states of agents to which they are linked. Each agent provides a nano-service for a single data source that converts from raw data to state and analyzes, learns, and predicts from its own changes and those of its linked subgraph. + +These solutions simplify application architecture by allowing agents—digital twins of real-world sources—to be widely distributed, even while maintaining the distributed graph that interlinks them at the application layer. This is because the links are URLs that map to the current runtime execution instance of the solution and the agent itself. In this way, the application seamlessly scales across instances without DevOps concerns. Agents consume data and maintain state. They also compute over their own state and that of other agents. Because agents are stateful, there is no need for a database, and insights are computed at memory speed. + +### Reading world data with open source + +There is a sea change afoot in the way we view data: Instead of the database being the system of record, the real world is, and digital twins of real-world things can continuously stream their state. Fortunately, the open source community is leading the way with a rich canvas of projects for processing real-time events. From pub/sub, where the most active communities are Apache Kafka, Pulsar, and CNCF NATS, to the analytical frameworks that continually process streamed data, including Apache Spark, [Flink][6], [Beam][7], Samza, and Apache-licensed [SwimOS][8] and [Hazelcast][9], developers have the widest choices of software systems. Specifically, there is no richer set of proprietary software frameworks available. Developers have spoken, and the future of software is open source. + +Introduction to Apache Hadoop, an open source software framework for storage and large scale... + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/2/real-time-data-processing + +作者:[Simon Crosby][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/simon-crosby +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/clocks_time.png?itok=_ID09GDk (Alarm clocks with different time) +[2]: https://spark.apache.org/ +[3]: https://samza.apache.org/ +[4]: https://hadoop.apache.org/ +[5]: http://mesos.apache.org/ +[6]: https://flink.apache.org/ +[7]: https://beam.apache.org +[8]: https://github.com/swimos/swim +[9]: https://hazelcast.com/ diff --git a/sources/tech/20200228 Revive your RSS feed with Newsboat in the Linux terminal.md b/sources/tech/20200228 Revive your RSS feed with Newsboat in the Linux terminal.md new file mode 100644 index 0000000000..27a8d6ecbd --- /dev/null +++ b/sources/tech/20200228 Revive your RSS feed with Newsboat in the Linux terminal.md @@ -0,0 +1,152 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Revive your RSS feed with Newsboat in the Linux terminal) +[#]: via: (https://opensource.com/article/20/2/newsboat) +[#]: author: (Scott Nesbitt https://opensource.com/users/scottnesbitt) + +Revive your RSS feed with Newsboat in the Linux terminal +====== +Newsboat is an excellent RSS reader, whether you need a basic set of +features or want your application to do a whole lot more. +![Boat on the ocean with Creative Commons sail][1] + +Psst. Word on the web is that RSS died in 2013. That's when Google pulled the plug on Google Reader. + +Don't believe everything that you hear. RSS is alive. It's well. It's still a great way to choose the information you want to read without algorithms making the decision for you. All you need is the [right feed reader][2]. + +Back in January, Opensource.com Correspondent [Kevin Sonney][3] introduced a nifty terminal RSS reader [called Newsboat][4]. In his article, Kevin scratched Newsboat's surface. I figured it was time to take a deeper dive into what Newsboat can do. + +### Adding RSS feeds to Newsboat + +As Kevin writes, "installing Newsboat is pretty easy since it is included with most distributions (and Homebrew on macOS)." You can, as Kevin also notes, import a [file containing RSS feeds][5] from another reader. If this is your first kick at the RSS can or it's been a while since you've used an RSS reader, chances are you don't have one of those files handy. + +Not to worry. You just need to do some copying and pasting. Go to the folder **.newsboat** in your **/home** directory. Once you're there, open the file **urls** in a text editor. Then, go to the websites you want to read, find the links to their RSS feeds, and copy and paste them into the **urls** file. + +![Newsboat urls file][6] + +Start Newsboat, and you're ready to get reading. + +### Reading your feeds + +As Kevin Sonney points out, you refresh your feeds by pressing the **r** or **R** keys on your keyboard. To read the articles from a feed, press **Enter** to open that feed and scroll down the list. Then, press **Enter** to read an item. + +![Newsboat reading][7] + +Return to the list of articles by pressing **q**. Press **q** again to return to your list of feeds. + +Every so often, you might run into a feed that shows just part of an article. That can be annoying. To get the full article, press **o** to open it in your desktop's default web browser. On my desktop, for example, that's Firefox. You can change the browser Newsboat works with; I'll explain that below. + +### Following links + +Hyperlinking has been a staple of the web since its beginnings at CERN in the early 1990s. It's hard to find an article published online that doesn't contain at least a couple of links that point elsewhere. + +Instead of leaving links embedded in an article or post, Newsboat gathers them into a numbered list at the end of the article or post. + +![Hyperlinks in Newsboat][8] + +To follow a link, press the number beside it. In the screenshot above, you'd press **4** to open the link to the homepage of one of the contributors to that article. The link, as you've probably guessed, opens in your default browser. + +### Using Newsboat as a client for other feed readers + +You might use a web-based feed reader, but might also want to read your RSS feeds in something a bit more minimal on your desktop. Newsboat can do that. + +It works with several feed readers, including The Old Reader, Inoreader, Newsblur, Tiny Tiny RSS, FeedHQ, and the newsreader apps for [ownCloud][9] and [Nextcloud][10]. Before you can read feeds from any of them, you'll need to do a little work. + +Go back to the **.newsboat** folder in your **/home** directory and create a file named **config**. Then add the settings that hook Newsboat into one of the RSS readers it supports. You can find more information about the specific settings for each reader in [Newsboat's documentation][11]. + +Here's an example of the settings I use to connect Newsboat with the newsreader app in my instance of Nextcloud: + + +``` +urls-source "ocnews" +ocnews-url "" +ocnews-login "myUserName" +ocnews-password "NotTellingYouThat!" +``` + +I've tested this with Nextcloud, The Old Reader, Inoreader, and Newsblur. Newsboat worked seamlessly with all of them. + +![Newsboat with The Old Reader][12] + +### Other useful configuration tricks + +You can really unleash Newsboat's power and flexibility by tapping into [its configuration options][13]. That includes changing text colors, the order Newsboat sorts feeds, where it saves articles, the length of time Newsboat keeps articles, and more. + +Below are a few of the options I've added to my configuration file. + +#### Change Newsboat's default browser + +As I mentioned a few paragraphs back, Newsboat opens articles in your default graphical web browser. If you want to read feeds in a [text-only browser][14] like w3m or ELinks, add this to your Newsboat configuration file: + + +``` +`browser "/path/to/browser %u"` +``` + +In my configuration file, I've set w3m up as my browser: + + +``` +`browser "/usr/bin/w3m %u"` +``` + +![Newsboat with w3m][15] + +#### Remove read articles + +I like an uncluttered RSS feed. That means getting rid of articles I've already read. Add this setting to the configuration file to have Newsboat do that automatically: + + +``` +`show-read-feeds  no` +``` + +#### Refresh feeds at launch + +Life gets busy. Sometimes, I go a day or two without checking my RSS feeds. That means having to refresh them after I fire Newsboat up. Sure, I can press **r** or **R**, but why not have the application do it for me? I've added this setting to my configuration file to have Newsboat refresh all of my feeds when I launch it: + + +``` +`refresh-on-startup  yes` +``` + +If you have a lot of feeds, it can take a while to refresh them. I have around 80 feeds, and it takes over a minute to get new content from all of them. + +### Is that everything? + +Not even close. In addition to all of its configuration options, Newsboat also has a number of command-line switches you can use when you fire it up. Read more about them in the [documentation][16]. + +On the surface, Newsboat is simple. But a lot of power and flexibility hides under its hood. That makes Newsboat an excellent RSS reader for anyone who needs a basic set of features or for someone who needs their RSS reader to do a whole lot more. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/2/newsboat + +作者:[Scott Nesbitt][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/scottnesbitt +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/CreativeCommons_ideas_520x292_1112JS.png?itok=otei0vKb (Boat on the ocean with Creative Commons sail) +[2]: https://opensource.com/article/17/3/rss-feed-readers +[3]: https://opensource.com/users/ksonney +[4]: https://opensource.com/article/20/1/open-source-rss-feed-reader +[5]: https://en.wikipedia.org/wiki/OPML +[6]: https://opensource.com/sites/default/files/uploads/newsboat-urls-file.png (Newsboat urls file) +[7]: https://opensource.com/sites/default/files/uploads/newsboat-reading.png (Newsboat reading) +[8]: https://opensource.com/sites/default/files/uploads/newsboat-links.png (Hyperlinks in Newsboat) +[9]: https://github.com/owncloudarchive/news +[10]: https://github.com/nextcloud/news +[11]: https://newsboat.org/releases/2.18/docs/newsboat.html#_newsboat_as_a_client_for_newsreading_services +[12]: https://opensource.com/sites/default/files/uploads/newsboat-oldreader.png (Newsboat with The Old Reader) +[13]: https://newsboat.org/releases/2.18/docs/newsboat.html#_example_configuration +[14]: https://opensource.com/article/16/12/web-browsers-linux-command-line +[15]: https://opensource.com/sites/default/files/uploads/newsboat-read-with-w3m.png (Newsboat with w3m) +[16]: https://newsboat.org/releases/2.18/docs/newsboat.html diff --git a/sources/tech/20200302 Using LibreOffice for your open source budgeting tool.md b/sources/tech/20200302 Using LibreOffice for your open source budgeting tool.md new file mode 100644 index 0000000000..9d26ff39c7 --- /dev/null +++ b/sources/tech/20200302 Using LibreOffice for your open source budgeting tool.md @@ -0,0 +1,168 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Using LibreOffice for your open source budgeting tool) +[#]: via: (https://opensource.com/article/20/3/libreoffice-open-source-budget) +[#]: author: (Jess Weichler https://opensource.com/users/cyanide-cupcake) + +Using LibreOffice for your open source budgeting tool +====== +Figure out where your money is going with this LibreOffice Calc budget +template. +![scientific calculator][1] + +Budgets can be intimidating for beginners. It can feel overwhelming to think about money, much less about how to keep track of it. But it's important to know where your money is coming and going. + +In this article, I'll step through a sample budget by explaining the logic behind important money decisions as well as the formulas you need to automate the process. Fortunately, LibreOffice makes it easy for anyone to keep their yearly budget in check, even the math-averse. + +### Getting started + +Begin by downloading and installing [LibreOffice][2], if you don't already have it. Next, download my [LibreOffice Calc template][3], which you can use as a starting point to create your own budget to meet your spending and savings goals. + +It's important to interact with your spreadsheet frequently. You can input transactions as they happen, daily, or weekly. You even could save up your receipts to calculate all your expenses at the end of the month, but this can be a hard slog. You want budgeting to be as quick and easy as possible. + +### Categories + +The first step to creating a budget is to decide on the categories you want to track. These categories can be as simple or as complex as you like. Think about what is useful to your personal situation and financial goals. You can easily add or change categories as your needs change. + +The template has a number of example categories you can start with. There is no right or wrong way to choose categories; your budget has to work for you. Look through the list in Column A of the **Budget** tab and decide which ones to keep, which to delete, and any others you want to add. Then edit that list to align with your personal income and expense situation. + +#### Create category drop-down menus + +![Budget categories][4] + +The template uses a drop-down menu to make it easy to assign categories to income and expenses. You can view them on the **Monthly** sheets (accessed with the tabs at the bottom of the LibreOffice window). Click on a cell in Column C, and a drop-down arrow will appear on the right. Click the arrow, and you'll see the example categories. You may need to change some of them so that they will match the categories in your budget (Column A of the **Budget** tab). + +To add or remove categories from the dropdown menu, click on Column C in a Monthly sheet to select all **Category** cells. Then, in the main menu, select **Data** > **Validity**. This opens up a dialog box. + +In **Validity**, select the **Criteria** tab, then click on the arrow to the right of **Allow**, set it to **List**, and type the categories you want to use in the **Entries** box. Type one category per line. Make sure to use the exact same categories you used on the **Budget** sheet in Column A. + +### Estimating your budget + +Once you have defined your categories, it's time to estimate how much you expect to earn and spend. You can calculate these amounts monthly, yearly, or using a mix of the two. + +Your first year of budgeting estimates won't be perfect, and you may be surprised at how much or little you spend on certain categories. But doing this will help you get a realistic idea of where your money is going. You can make adjustments in your second year to create a more accurate budget based upon what you spend in year one. + +In Column B (**Monthly Estimate**) of the **Budget** tab, enter your anticipated _monthly_ income and expenses for each category (an exception is the **Charity** row, which is automatically calculated as a percentage of your income). For _annual_ expenses and income (e.g., taxes, insurance, tuition, etc.), enter them in Column P (**Yearly Estimate**). + +#### Calculating the annual cost of monthly expenses + +Most expenses occur monthly. To find the yearly cost of a monthly expense, multiply your monthly estimate by 12. You could do this manually for each category, but it is much easier to use formulas. + +Formulas are automated calculations that determine the value of a cell. Formulas do all the heavy lifting, so you don't have to do a lot of sums in your head. + +In the template, you can use the **Yearly Estimate** column to make an equation to annualize a monthly expense or income. In a cell in Column P, type this: + + +``` +`=SUM(x*12)` +``` + +but change _x_ to the name of the **Monthly Estimate** cell you want to use. (For example, to calculate the annual cost of your phone service using the template, the formula would read **=SUM(B12*13)**.) + +#### Calculating the monthly cost of yearly expenses + +You may pay some expenses, such as car insurance, only once a year. You can either ignore these expenses in the monthly estimates or put money aside for them in your budget each month. + +If you want to do the latter, you need to divide your **Yearly Estimate** by 12 and put that amount into your monthly budget. To do so, place this equation in the appropriate cell in the **Monthly Estimate** column: + + +``` +`=SUM(x/12)` +``` + +where _x_ is the corresponding **Yearly Estimate** cell on your spreadsheet (from Column P). + +#### Finding percentages + +If you want to donate or save a percentage of your income, there's a function for that, too! + +The common recommendation is to put aside 20% of your take-home pay for savings. While I don't focus on this too much, I do find it helpful to see if I'm meeting my savings goals from month to month. + +For instance, Row 32 of the **Budget** tab template uses this formula to calculate the 20% of your income that you should allocate to savings: + + +``` +`=SUM(B2*0.2)` +``` + +This same method can be used if you give a percentage (e.g., 10%) of your income to charity (Row 21 of the template): + + +``` +`=SUM(B2*-0.1)` +``` + +This formula uses a negative percentage because donating to charity is an expense. + +### Entering monthly income and expenses + +The template pulls data totals from the **Monthly** sheets (the tabs at the bottom of the spreadsheet) to populate Columns C through N on the **Budget** sheet. + +It's useful to place each month's transactions on separate sheets of your budget spreadsheet. By keeping your receipts from purchases and entering them into each month's sheet, you create a digital record of your money. + +Enter income as positive numbers and expenses as negative numbers. Select the appropriate category using the drop-down in the **Category** column. + +In LibreOffice, the **SUMIF** function can look at values in a specific column and extract only the ones that occur next to a specific word. My template uses a **SUMIF** formula to extract values based on the adjacent category in order to enter an amount in the correct cell on the **Budget** tab. For example, to enter January's internet expenses into the **Budget** spreadsheet, enter this formula in cell C12: + + +``` +`=SUMIF(january.$C:$C,A12,january.$D:$D)` +``` + +This looks at January's Column C and, if it sees an entry that contains the word in A12 on the **Budget** tab (Internet), then it extracts the number from Column D on the **January** tab and enters that value into the cell that contains the formula on the **Budget** tab (C12). + +### Analyzing your budget data + +#### Adding a range of numbers to calculate YTD spending + +To see how much you have spent overall this year to date (YTD), select the cell where you want to display that data (in the template, it's cell O29, under the **YTD** column), and enter the following formula to total the range of numbers corresponding to your monthly **Total Expense**: + + +``` +`=SUM(x:y)` +``` + +Instead of _x_ and _y_, enter the first cell and the last cell in the range. You can type them in manually, but it's easier and less error-prone to just click and drag from the first to last cell. LibreOffice does the calculation and enters the appropriate values. + +#### Seeing how you're doing on your budget + +A big part of budgeting is comparing your estimates to your actual income and expenses. In the template, this is the **Budget** tab's Column Q. This column subtracts the contents of each cell in Column O (**YTD**) from Column P (**Yearly Estimate**).  + + +``` +`=SUM(x-y)` +``` + +where _x_ and _y_ equal the corresponding cells from Column P and O. For example, using the template to calculate how much you've spent on Utilities compared to your budget, you would enter **=SUM(P11-O11)**. + +![Budget overview][5] + +### Tracking expenses + +Now that your yearly budget is set up, you are ready to start meeting your financial goals. + +It's important to look at your budget often—and it's equally important to do so without guilt. Think of this process as gathering data so that you can adjust your estimates for the next year. The primary goal of budgeting is to understand your own spending habits and refine either your expectations or your behavior so that you can plan better for how your income is used. + +Which open source tools and apps do you use to budget? Tell us in the comments! + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/3/libreoffice-open-source-budget + +作者:[Jess Weichler][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/cyanide-cupcake +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/calculator_money_currency_financial_tool.jpg?itok=2QMa1y8c (scientific calculator) +[2]: https://www.libreoffice.org/download/download/ +[3]: https://opensource.com/sites/default/files/uploads/budget_template_0.ods +[4]: https://opensource.com/sites/default/files/uploads/imagebudget_cat.png (Budget categories) +[5]: https://opensource.com/sites/default/files/uploads/imagebudget_overview.png (Budget overview) diff --git a/sources/tech/20200303 Getting started with lightweight alternatives to GNU Emacs.md b/sources/tech/20200303 Getting started with lightweight alternatives to GNU Emacs.md new file mode 100644 index 0000000000..5f86c79b84 --- /dev/null +++ b/sources/tech/20200303 Getting started with lightweight alternatives to GNU Emacs.md @@ -0,0 +1,164 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Getting started with lightweight alternatives to GNU Emacs) +[#]: via: (https://opensource.com/article/20/3/lightweight-emacs) +[#]: author: (Seth Kenlon https://opensource.com/users/seth) + +Getting started with lightweight alternatives to GNU Emacs +====== +Slimmed-down (in size and features) alternatives allow you to take your +text editor anywhere you go. +![Text editor on a browser, in blue][1] + +I work on a lot of servers, and sometimes I find a host that hasn't installed [GNU Emacs][2]. There's usually a [GNU Nano][3] installation to keep me from resorting to [Vi][4], but I'm not used to Nano the way I am Emacs, and I inevitably run into complications when I try to save my document (**C-x** in Nano stands for Exit, and **C-s** locks Konsole). + +While it would be nice to have GNU Emacs available everywhere, it's a lot of program for making a simple update to a config file. My need for a small and lightweight emacs is what took me down the path of discovering MicroEmacs, Jove, and Zile—tiny, self-contained [emacsen][5] that you can put on a thumb drive, an SD card, and nearly any server, so you'll never be without an emacs editor. + +### Editing macros + +The term "emacs" is a somewhat generic term in the way that only open source produces, and a portmanteau. Before there was [GNU Emacs][6], there were collections of batch process scripts (called _macros_) that could perform common tasks for a user. For instance, if you often found yourself typing "teh" instead of "the," you could either go in and correct each one manually (no small feat when your editor can't even load the entire document into memory, as was often the case in the early 1980s), or you could invoke a macro to perform a quick swap of the "e" and "h." + +Eventually, these macros were bundled together into a package called editing macros, or EMACS for short. GNU Emacs is the most famous emacsen (yes, the -en suffix is used to describe many emacs, as in the word "oxen"), but it's not the only one. And it's certainly not the smallest. Quite the contrary, GNU Emacs is probably one of the largest. + +Fortunately, GNU Emacs is so popular that other emacs implementations tend to mimic most of the GNU version's basic controls. If you're looking for a basic, fast, and efficient editor that isn't Vim, you'll likely be happy with any of these options. + +### MicroEmacs + +![µemacs][7] + +[MicroEmacs][8], also known as uemacs (as in the Greek letter µ, which denotes "micro" in scientific notation), was written by Dave Conroy, but there's a long list of users who have cloned it and modified it. One user who maintains a personal version of µemacs is a programmer named Linus Torvalds, and his copy is available from his website, [kernel.org][9] (which also, incidentally, includes a small side project of his called [Linux][10]). + +#### Size + +It takes me five seconds to compile µemacs at the slowest setting I can impose on my computer, and the resulting binary is a mere 493KB. Admittedly, that's not literally "micro" compared to the typical size of a GNU Emacs download (1 millionth of 70MB is 70 bytes, by my calculation), but it's respectably small. For instance, it's easy enough to send it to yourself by email or over Signal, and certainly small enough to keep handy on every thumb drive or SD card you own. + +By default, Linus's version expects libcurses, but you can override this setting in the Makefile so that it uses libtermcap instead. The resulting binary is independent enough to run on most Linux boxes: + + +``` +$ ldd em +linux-vdso.so.1 +libtermcap.so.2 => /lib64/libtermcap.so.2 +libc.so.6 => /lib64/libc.so.6 +/lib64/ld-linux-x86-64.so.2 +``` + +#### Features + +The [keyboard shortcuts][11] are just as you'd expect. You can open files and edit them without ever realizing you're not in GNU Emacs. + +Some advanced features are missing. For instance, there's no vertical buffer split, although there is a horizontal split. There's no eval command, so you won't use µemacs for Lisp programming. + +The search function is also a little different from what you may be used to: instead of **C-s**, it's **M-s**, which could make all the difference if your terminal emulator accepts **Ctrl+S** as a freeze command. The help page for µemacs is very complete, so use **M-x help** to get familiar with what it has available. + +#### License + +The license for µemacs is custom to the project with a non-commercial condition. You're free to share, use, and modify µemacs, but you can't do anything commercial with it. +While not as liberal a policy as I typically prefer, it's a good-enough license for personal use; just don't build a business around it. + +### GNU Zile + +![GNU Zile][12] + +[GNU Zile][13] claims to be a development kit for text editors. It's meant as a framework to enable people to quickly develop their own custom text editor without having to reinvent common data structures. It's a great idea and probably very useful, but as I have no interest in making my own editor, I just use the example implementation that ships with its codebase as a pleasant, lightweight emacs. + +The build process for the example editor (supposedly called Zemacs, although the binary it renders is named zile) is the standard [Autotools][14] procedure: + + +``` +$ ./configure +$ make +``` + +#### Size + +Compiling it from source takes me a minute on one core or about 50 seconds on six cores (the configuration process is the long part). The binary produced in the end is 1.2MB, making this the heaviest of the lightweight emacsen I use, but compared to even GNU Emacs without X (which is 14MB on my system), it's relatively trivial. + +Of the lightweight emacsen I use, it's also the most complex. You can exclude some library links by disabling features during configuration, but here are the defaults: + + +``` +$ ldd src/zile +linux-vdso.so.1 +libacl.so.1 => /lib64/libacl.so.1 +libncurses.so.5 => /lib64/libncurses.so.5 +libgc.so.1 => /usr/lib64/libgc.so.1 +libc.so.6 => /lib64/libc.so.6 +libattr.so.1 => /lib64/libattr.so.1 +libdl.so.2 => /lib64/libdl.so.2 +libpthread.so.0 => /lib64/libpthread.so.0 +/lib64/ld-linux-x86-64.so.2 +``` + +#### Features + +Zile acts a little more like GNU Emacs than µemacs or Jove, but it's still a minimal experience. But some little touches are refreshing: Tab completion happens in a buffer, you can run shell commands from the mini-buffer, and you have a good assortment of functions available. It's by no means a GNU Emacs replacement, though, and if you wander too far in search of advanced features, you'll find out why it's only 1.2MB. + +I've been unable to find in-application help files, and the man page bundled with it is minimal. However, if you're comfortable with Emacs, Zile is a good compromise between the full 14MB (or greater, if you're using a GUI) version and the extremely lightweight implementations. + +### Jove + +![Jove][15] + +[Jove][16] was my first tiny emacs and remains the smallest I've found yet. This was an easy discovery for me, as it ships with [Slackware][17] Linux and, with a surreptitious symlink, quickly became my personal replacement for the Vi binary. Jove is based on GNU Emacs, but the man page cautions that feature parity is by no means to be expected. I find Jove surprisingly feature-rich for such a small binary (in fact, this article was written in Jove version 4.17.06-9), but there's no question that renaming .emacs to .joverc does _not_ behave as you might hope. + +#### Size + +It takes me five seconds to compile Jove at the slowest setting (-j1) and about a second using all cores. The resulting binary, confusingly called jjove by default, is just 293KB. + +The Jove binary is independent enough to run on most Linux boxes: + + +``` +$ ldd jjove +linux-vdso.so.1 +libtermcap.so.2 => /lib64/libtermcap.so.2 +libc.so.6 => /lib64/libc.so.6 +/lib64/ld-linux-x86-64.so.2 +``` + +#### Features + +Jove has good documentation in the form of a man page. You can also get a helpful listing of all available commands by typing **M-x ?** and using the Spacebar to scroll. If you're entirely new to emacs, you can run **teachjove** to learn Jove (and emacs, accordingly). + +Most common editing commands and keybindings work as expected. Some oddities exist; for example, there's no vertical split, and Tab completion for paths in the mini-buffer is non-existent. However, it's the smallest emacs I've found and yet has a full GNU Emacs feel to it. + +### Try Emacs + +If you've only ever tried GNU Emacs, then you might find that the world of emacsen is richer than you may have expected. There's a rich tradition behind emacs, and trying some of its variants, spin-offs, and alternate implementations is part of the joy of being comfortable with how emacsen work. Get to know emacs; carry a few builds around everywhere you go, and you'll never have to use a substandard editor again! + +GNU Emacs can be much more than just a text editor. Learn how to get started. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/3/lightweight-emacs + +作者:[Seth Kenlon][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/seth +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/browser_blue_text_editor_web.png?itok=lcf-m6N7 (Text editor on a browser, in blue) +[2]: https://www.gnu.org/software/emacs/ +[3]: https://www.nano-editor.org/ +[4]: https://opensource.com/article/19/3/getting-started-vim +[5]: https://www.emacswiki.org/emacs/Emacsen +[6]: https://opensource.com/article/20/2/who-cares-about-emacs +[7]: https://opensource.com/sites/default/files/uploads/lightweight-emacs-uemacs.jpg (µemacs) +[8]: https://en.wikipedia.org/wiki/MicroEMACS +[9]: https://git.kernel.org/pub/scm/editors/uemacs/uemacs.git +[10]: https://opensource.com/tags/linux +[11]: https://opensource.com/downloads/emacs-cheat-sheet +[12]: https://opensource.com/sites/default/files/uploads/lightweight-emacs-zile.jpg (GNU Zile) +[13]: https://www.gnu.org/software/zile/ +[14]: https://opensource.com/article/19/7/introduction-gnu-autotools +[15]: https://opensource.com/sites/default/files/uploads/lightweight-emacs-jove.jpg (Jove) +[16]: https://opensource.com/article/17/1/jove-lightweight-alternative-vim +[17]: http://slackware.com diff --git a/sources/tech/20200303 Watching activity on Linux with watch and tail commands.md b/sources/tech/20200303 Watching activity on Linux with watch and tail commands.md new file mode 100644 index 0000000000..15780a5b34 --- /dev/null +++ b/sources/tech/20200303 Watching activity on Linux with watch and tail commands.md @@ -0,0 +1,148 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Watching activity on Linux with watch and tail commands) +[#]: via: (https://www.networkworld.com/article/3529891/watching-activity-on-linux-with-watch-and-tail-commands.html) +[#]: author: (Sandra Henry-Stocker https://www.networkworld.com/author/Sandra-Henry_Stocker/) + +Watching activity on Linux with watch and tail commands +====== +The watch and tail commands can help monitor activity on Linux systems. This post looks at some helpful ways to use these commands. +Loops7 / Getty Images + +The **watch** and **tail** commands provide some interesting options for examining activity on a Linux system in an ongoing manner. + +That is, instead of just asking a question and getting an answer (like asking **who** and getting a list of currently logged in users), you can get **watch** to provide you with a display showing who is logged in along with updates as users come and go. + +[[Get regularly scheduled insights by signing up for Network World newsletters.]][1] + +With **tail**, you can display the bottoms of files and see content as it is added. This kind of monitoring is often very helpful and requires less effort than running commands periodically. + +### Using watch + +One of the simplest examples of using **watch** is to use the command **watch who**. You should see a list showing who is logged in along with when they logged in and where they logged in from. Notice that the default is to update the display every two seconds (top left) and that the date and time (upper right) updates itself at that interval. The list of users will grow and shrink as users log in and out. + +### $ watch who + +This command will dissplay a list of logins like this: + +``` +Every 2.0s: who dragonfly: Thu Feb 27 10:52:00 2020 + +nemo pts/0 2020-02-27 08:07 (192.168.0.11) +shs pts/1 2020-02-27 10:58 (192.168.0.5) +``` + +You can change the interval to get less frequent updates by adding a **-n** option (e.g., -n 10) to select a different number of seconds between updates. + +### $ watch -n 10 who + +The new interval will be displayed and the time shown will change less frequently, aligning itself with the selected interval. + +[][2] + +``` +Every 10.0s: who dragonfly: Thu Feb 27 11:05:47 2020 + +nemo pts/0 2020-02-27 08:07 (192.168.0.11) +shs pts/1 2020-02-27 10:58 (192.168.0.5) +``` + +If you prefer to see only the command's output and not the heading (the top 2 lines), you can omit those lines by adding the **-t** (no title) option. + +### $ watch -t who + +Your display will then look like this: + +``` +nemo pts/0 2020-02-27 08:07 (192.168.0.11) +shs pts/1 2020-02-27 10:58 (192.168.0.5) +``` + +If every time the watched command runs, its output is the same, only the title line (if not omitted) will change. The rest of the displayed information will stay the same. + +If you want your **watch** command to exit as soon as the output of the command that it is watching changes, you can use a **-g** (think of this as the "go away") option. You might choose to do this if, for example, you are simply waiting for others to start logging into the system. + +You can also highlight changes in the displayed output using the **-d** (differences) option. The highlighting will only last for one interval (2 seconds by default), but can help to draw your attention to the changes. + +Here's a more complex example of using the **watch** command to display services that are listening for connections and the ports they are using. While the output isn't likely to change, it would alert you to any new service starting up or one going down. + +``` +$ watch 'sudo lsof -i -P -n | grep LISTEN' +``` + +Notice that the command being run needs to be enclosed in quotes to ensure that the **watch** command doesn't send its output to the grep command. + +Using the **watch -h** command will provide you with a list of the command's options. + +``` +$ watch -h + +Usage: + watch [options] command + +Options: + -b, --beep beep if command has a non-zero exit + -c, --color interpret ANSI color and style sequences + -d, --differences[=] + highlight changes between updates + -e, --errexit exit if command has a non-zero exit + -g, --chgexit exit when output from command changes + -n, --interval seconds to wait between updates + -p, --precise attempt run command in precise intervals + -t, --no-title turn off header + -x, --exec pass command to exec instead of "sh -c" + + -h, --help display this help and exit + -v, --version output version information and exit +``` + +### Using tail -f + +The **tail -f** command has something in common with **watch**. It will both display the bottom of a file and additional content as it is added. Instead of having to run a "tail" command again and again, you run one command and get a repeatedly updated view of its output. For example, you could watch a system log with a command like this: + +``` +$ tail -f /var/log/syslog +``` + +Some files, like **/var/log/wtmp**, don't lend themselves to this type of handling because they're not formatted as normal text files, but you could get a similar result by combining **watch** and **tail** like this: + +``` +watch 'who /var/log/wtmp | tail -20' +``` + +This command will display the most recent 5 logins regardless of how many of the users are still logged in. If another login occurs, a line will be added and the top line removed. + +``` +Every 60.0s: who /var/log/wtmp | tail -5 dragonfly: Thu Feb 27 12:46:07 2020 + +shs pts/0 2020-02-27 08:07 (192.168.0.5) +nemo pts/1 2020-02-27 08:26 (192.168.0.5) +shs pts/1 2020-02-27 10:58 (192.168.0.5) +nemo pts/1 2020-02-27 11:34 (192.168.0.5) +dory pts/1 2020-02-27 12:14 (192.168.0.5) +``` + +Both the **watch** and **tail -f** commands can provide auto-updating views of information that you might at times want to monitor, making the task of monitoring quite a bit easier whether you're monitoring processes, logins or system resources. + +Join the Network World communities on [Facebook][3] and [LinkedIn][4] to comment on topics that are top of mind. + +-------------------------------------------------------------------------------- + +via: https://www.networkworld.com/article/3529891/watching-activity-on-linux-with-watch-and-tail-commands.html + +作者:[Sandra Henry-Stocker][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.networkworld.com/author/Sandra-Henry_Stocker/ +[b]: https://github.com/lujun9972 +[1]: https://www.networkworld.com/newsletters/signup.html +[2]: https://www.networkworld.com/article/3440100/take-the-intelligent-route-with-consumption-based-storage.html?utm_source=IDG&utm_medium=promotions&utm_campaign=HPE21620&utm_content=sidebar ( Take the Intelligent Route with Consumption-Based Storage) +[3]: https://www.facebook.com/NetworkWorld/ +[4]: https://www.linkedin.com/company/network-world diff --git a/sources/tech/20200304 How service virtualization relates to test-driven development.md b/sources/tech/20200304 How service virtualization relates to test-driven development.md new file mode 100644 index 0000000000..4ff4243603 --- /dev/null +++ b/sources/tech/20200304 How service virtualization relates to test-driven development.md @@ -0,0 +1,428 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How service virtualization relates to test-driven development) +[#]: via: (https://opensource.com/article/20/3/service-virtualization-test-driven-development) +[#]: author: (Alex Bunardzic https://opensource.com/users/alex-bunardzic) + +How service virtualization relates to test-driven development +====== +Mountebank simulates services you're dependent on so autonomous teams +can continue development activities without having to wait on anyone. +![Person using a laptop][1] + +The agile approach to software development relies on service virtualization to give each IT team autonomy. This approach removes blockages and allows autonomous teams to continue development activities without having to wait on anyone. That way, integration testing can commence as soon as teams start iterating/sprinting. + +### How automated services work + +Any automated service is available to consumers via a published endpoint. This means services can be automated only if they're made available online. + +Any consumer wishing to leverage available automated services must be capable of sending requests to that service's endpoint via an HTTP protocol. Some of those services will, upon receiving the request via the HTTP protocol, respond by simply sending back some data. Other services may respond to receiving a request via HTTP protocol by actually performing some work. For example, a service may create a resource (for example, create an order), update a resource (update an order), or delete a resource (cancel an order). + +All those activities get triggered via the HTTP protocol. In the simplest of cases, the action instigated by the service consumer is GET (e.g., HTTP GET). That request may arrive with some query values; those values will get used by the service to narrow down the search (such as "search for order number 12345 and return the data"). + +In more elaborate cases, a request may arrive with the instruction to POST some values; a service will accept that request and expect some values to be associated with it. Those values are usually called the payload. When the service accepts an HTTP POST request containing the payload, it will attempt to process it. It may or may not succeed in processing it, but either way, it will respond to the service consumer with a status code and an optional status message. That way, service consumers will be notified of the success/failure of their request so that they can decide what the next step should be. + +### What is service virtualization? + +Now that we understand how automated services work, it should be easier to understand how to virtualize them. In a nutshell, it is possible to simulate any service that is published on a hosting site. Instead of sending HTTP requests directly to the service provider's endpoint, you can interject a fake, pretend service that simulates the behavior of the real service. + +From the service consumer's standpoint, it makes absolutely no difference whether it is interacting with a real or a fake service. The interaction remains identical. + +### Virtualize one service + +OK, enough talking, I'll roll up my sleeves and show how to do it in practical terms. Suppose your team is starting a new project and receives requirements in the form of a fully fleshed user story: + +#### Authenticate user + +_As a new app_ +_I want to authenticate the user_ +_Because we want to ensure proper security for the app_ + +#### Acceptance criteria + +**Scenario #1:** _New app successfully authenticates the user_ +Given that the user has navigated to the login page +And the user has submitted credentials +When new app receives login request +Then new app successfully authenticates the user +And new app displays response message "User successfully logged in." + +**Scenario #2:** _New app cannot authenticate the user on the first attempt_ +Given that the user has navigated to the login page +And the user has submitted credentials +When new app receives login request +Then new app fails to successfully authenticate the user +And new app displays response message "Incorrect login. You have 2 more attempts left." + +**Scenario #3:** _New app cannot authenticate the user on the second attempt_ +Given that the user has navigated to the login page +And the user has submitted credentials +When new app receives login request +Then new app fails to successfully authenticate the user +And new app displays response message "Incorrect login. You have 1 more attempt left." + +**Scenario #4:** _New app cannot authenticate the user on the third attempt_ +Given that the user has navigated to the login page +And the user has submitted credentials +When new app receives login request +Then new app fails to successfully authenticate the user +And new app displays response message "Incorrect login. You have no more attempts left." + +The first thing to do when starting the work on this user story is to create the so-called "walking skeleton" (for this exercise, I will be using the standard **.Net Core** platform plus **xUnit.net** I discussed in my previous articles ([starting with this one][2] with [another example here][3]). Please refer to them for technical details on how to install, configure, and run the required tools. + +Create the walking skeleton infrastructure by opening the command line and typing: + + +``` +`mkdir AuthenticateUser` +``` + +Then move inside the **AuthenticateUser** folder: + + +``` +`cd AuthenticateUser` +``` + +And create a separate folder for tests: + + +``` +`mkdir tests` +``` + +Move into the **tests** folder (**cd tests**) and initiate the **xUnit** framework: + + +``` +`dotnet new xunit` +``` + +Now move one folder up (back to **AuthenticateUser**) and create the app folder: + + +``` +mkdir app +cd app +``` + +Create the scaffold necessary for C# code: + + +``` +`dotnet new classlib` +``` + +The walking skeleton is now ready! Open the editor of your choice and start coding. + +### Write a failing test first + +In the spirit of TDD, start by writing the failing test (refer to the [previous article][4] to learn why is it important to see your test fail before attempting to make it pass): + + +``` +using System; +using Xunit; +using app; + +namespace tests { +    public class UnitTest1 { +        Authenticate auth = [new][5] Authenticate(); + +        [Fact] +        public void SuccessLogin(){ +            var given = "credentials"; +            var expected = "Successful login."; +            var actual = auth.Login(given); +            Assert.Equal(expected, actual); +        } +    } +} +``` + +This test states that if someone supplies some credentials (i.e., a secret username and password) to the **Login** method of the **Authenticate** component when it processes the request, it is expected to return the message "Successful login." + +Of course, this is functionality that does not exist yet—the instantiated **Authenticate** module in the **SuccessLogin()** module hasn't been written yet. So you might as well go ahead and take the first stab at writing the desired functionality. Create a new file (**Authenticate.cs**) in the **app** folder and add the following code: + + +``` +using System; + +namespace app { +    public class Authenticate { +        public string Login(string credentials) { +            return "Not implemented"; +        } +    } +} +``` + +Now, navigate to the **tests** folder and run: + + +``` +`dotnet test` +``` + +![Output of dotnet.test][6] + +The test fails because it was expecting a "Successful login" output but instead got the "Not implemented" output. + +### Increasing complexity for day two operations + +Now that you have created the "happy path" expectation and made it fail, it is time to work on implementing the functionality that will make the failing test pass. The following day, you attend the standup and report that you have started on the "Authenticate user" story. You let the team know that you have created the first failing test for the "happy path," and today, the plan is to implement the code to make the failing test pass. + +You explain your intention to first create a **User** table containing the **username**, **password**, and other pertinent attributes. But the scrum master interrupts and explains that the **User** module is being handled by another team. It would be bad practice to duplicate the maintenance of users, as the information will quickly get out of sync. So instead of building the **User** module (which would include the authentication logic), you are to leverage the authentication services that the **User** team is working on. + +That's great news because it saves you the trouble of having to write a lot of code to implement the **User** processing. Emboldened, you enthusiastically announce that you will quickly cobble up a function that will take user credentials and send them to the service that the **User** team has built. + +Alas, your intentions get squashed again as you learn that the **User** team hasn't started building the **User authentication** service yet. They're still in the process of assigning user stories to the backlog. Disheartened, you resign to the fact that it will be at least a few days (if not weeks?) before you can start working on the **User authentication** story. + +The scrum master then says that there is no reason to wait for the **User authentication** service to be built and deployed to testing. You could start developing the authentication functionality right away. But how can you do that? + +The scrum master offers a simple suggestion: leverage service virtualization. Since all specifications for the **User** module have been solidified and signed off, you have a solid, non-volatile contract to build your solution against. The contract published by the **User** services team states that in order to authenticate a user, specific expectations must be fulfilled: + + 1. A client wishing to authenticate a user should send an **HTTP POST** request to the endpoint . + 2. The **HTTP POST** sent to the above endpoint must have a **JSON** payload that contains the user credentials (i.e., username and password). + 3. Upon receiving the request, the service will attempt to log the user in. If the username and password match the information on record, the service will return an **HTTP** response containing status code 200 with the body of the response containing the message "User successfully logged in." + + + +So, now that you know the contract details, you can start building the solution. Here's the code that connects to the endpoint, sends the **HTTP POST** request, and receives the **HTTP** response: + + +``` +using System; +using System.Net.Http; +using System.Threading.Tasks; +using System.Collections.Generic; + +namespace app { +    public class Authenticate { +        HttpClient client = [new][5] HttpClient(); +        string endPoint = ""; + +        public string Login(string credentials) { +            Task<string> response = CheckLogin(credentials); +            return response.Result; +        } + +        private async Task<string> CheckLogin(string credentials) { +            var values = [new][5] Dictionary<string, string>{{"credentials", credentials}}; +            var content = [new][5] FormUrlEncodedContent(values); +            var response = await client.PostAsync(endPoint, content); +            return await response.Content.ReadAsStringAsync(); +        } +    } +} +``` + +This code won't work because does not exist (yet). Are you stuck now, waiting for the other team to eventually build and deploy that service? + +Not really. Service virtualization to rescue! Let's pretend that the service is already there and continue the development. + +### How to virtualize a service + +One way to virtualize the **User authentication** service would be to write a new app (the new API) and run it locally. This API will mirror the contract specified by the real **User authentication** API and will only return hard-coded stubbed data (it will be a fake service). + +Sounds like a good plan. Again, the team pushes back during the standup, questioning the need for writing, building, testing, and deploying a brand new app just to accomplish this fake functionality. It kind of wouldn't be worth the trouble because, by the time you deliver that new fake app, the other team would probably be ready with the real service. + +So you've reached an impasse. It looks like you are forced to wait on your dependency to materialize. You've failed to control your dependencies; you now have no recourse but to work in a sequential fashion. + +Not so fast! There is a great new tool called [mountebank][7] that is ideal for virtualizing any service. Using this tool, you can quickly stand up a local server that listens on a port you specify and takes orders. To make it simulate a service, you only have to tell it which port to listen to and which protocol to handle. The choice of protocols is: + + * HTTP + * HTTPS + * SMTP + * TCP + + + +In this case, you need the HTTP protocol. First, install mountebank—if you have **npm** on your computer, you can simply type on the command line: + + +``` +`npm install -g mountebank` +``` + +After it's installed, run mountebank by typing: + + +``` +`mb` +``` + +At startup, mountebank will show: + +![mountebank startup][8] + +Now you're ready to virtualize an HTTP service. In this case, the **User authentication** service expects to receive an HTTP POST request; here is how the implemented code sends an HTTP POST request: + + +``` +`var response = await client.PostAsync(endPoint, content);` +``` + +You now have to establish that **endPoint**. Ideally, all virtualized services should be propped in the **localhost** server to ensure quick execution of integration tests. + +To do that, you need to configure the **imposter**. In its bare-bones form, the **imposter** is a simple JSON collection of key-value pairs containing the definition of a port and a protocol: + + +``` +{ +    "port": 3001, +    "protocol": "http" +} +``` + +This imposter is configured to handle the HTTP protocol and to listen to incoming requests on port 3001. + +Just listening to incoming HTTP requests on port 3001 is not going to do much. Once the request arrives at that port, mountebank needs to be told what to do with that request. In other words, you are virtualizing not only the availability of a service on a specific port but also the way that virtualized service is going to respond to the request. + +To accomplish that level of service virtualization, you need to tell mountebank how to configure stubs. Each stub consists of two components: + + 1. A collection of predicates + 2. A collection of expected responses + + + +A predicate (sometimes called a matcher) narrows down the scope of the incoming request. For example, using the HTTP protocol, you can expect more than one type of method (e.g., GET, POST, PUT, DELETE, PATCH, etc.). In most service-virtualization scenarios, we are interested in simulating the behavior that is specific to a particular HTTP method. This scenario is about responding to the HTTP POST request, so you need to configure your stub to match on HTTP POST requests only: + + +``` +{ +    "port": 3001, +    "protocol": "http", +    "stubs": [ +        { +            "predicates": [ +                { +                    "equals": { +                        "method": "post" +                    } +                } +            ] +        } +    ] +} +``` + +This imposter defines one predicate that matches (using the keyword **equals**) on the HTTP POST request only. + +Now take a closer look at the **endPoint** value, as defined in the implemented code: + + +``` +`string endPoint = "http://localhost:3001/api/v1/users/login";` +``` + +In addition to listening to port 3001 (as defined in ), the **endPoint** is more specific, in that it expects the incoming HTTP POST request to go to the /api/v1/users/login path. How do you tell mountebank to only match exactly on the /api/v1/users/login path? By adding the path key-value pair to the stub's predicate: + + +``` +{ +    "port": 3001, +    "protocol": "http", +    "stubs": [ +        { +            "predicates": [ +                { +                    "equals": { +                        "method": "post", +                        "path": "/api/v1/users/login" +                    } +                } +            ] +        } +    ] +} +``` + +This imposter now knows that HTTP requests arriving at port 3001 must be a POST method and must point at the /api/v1/users/login path. The only thing left to simulate is the expected HTTP response. + +Add the response to the JSON imposter: + + +``` +{ +    "port": 3001, +    "protocol": "http", +    "stubs": [ +        { +            "predicates": [ +                { +                    "equals": { +                        "method": "post", +                        "path": "/api/v1/users/login" +                    } +                } +            ], +            "responses": [ +                { +                    "is": { +                        "statusCode": 200, +                        "body": "Successful login." +                    } +                } +            ] +        } +    ] +} +``` + +With mountebank imposters, you define responses as a collection of JSON key-value pairs. In most cases, it is sufficient to simply state that a response is a **statusCode** and a **body**. This case is simulating the "happy path" response that has the status code **OK (200)** and the body containing a simple message **Successful login** (as specified in the acceptance criteria). + +### How to run virtualized services? + +OK, now that you have virtualized the **User authentication** service (at least its "happy path"), how do you run it? + +Remember that you have already started mountebank, and it reported that it is running in memory as the domain. Mountebank is listening on port 2525 and taking orders. + +Great, now you have to tell mountebank that you have the imposter ready. How do you do that? Send an HTTP POST request to . The requests body must contain the JSON you created above. There are a few techniques available to send that request. If you're versed in [curl][9], using it to send HTTP POST requests would be the simplest, quickest way to stand up the imposter. But many people prefer a more user-friendly way to send the HTTP POST to mountebank. + +The easy way to do that is to use [Postman][10]. If you download and install Postman, you can point it at , select the POST method from the pulldown menu, and copy and paste the imposter JSON into the raw body. + +When you click Send, the imposter will be created, and you should get Status 201 (Created). + +![Postman output][11] + +Your virtualized service is now running! You can verify it by navigating to the **tests** folder and running the **dotnet test** command: + +![dotnet test output][12] + +### Conclusion + +This demo shows how easy it is to remove blockages and control dependencies by simulating services you're dependent on. Mountebank is a fantastic tool that easily and cheaply simulates all kinds of very elaborate, sophisticated services. + +In this installment, I just had time to illustrate how to virtualize a simple "happy path" service. If you go back to the actual user story, you will notice that its acceptance criteria contain several "less happy" paths (cases when someone is repeatedly trying to log in using invalid credentials). It's a bit trickier to properly virtualize and test those use cases, so I've left that exercise for the next installment in this series. + +How will you use service virtualization to solve your testing needs? I would love to hear about it in the comments. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/3/service-virtualization-test-driven-development + +作者:[Alex Bunardzic][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/alex-bunardzic +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/laptop_screen_desk_work_chat_text.png?itok=UXqIDRDD (Person using a laptop) +[2]: https://opensource.com/article/19/8/mutation-testing-evolution-tdd +[3]: https://opensource.com/article/19/9/mutation-testing-example-tdd +[4]: https://opensource.com/article/20/2/automate-unit-tests +[5]: http://www.google.com/search?q=new+msdn.microsoft.com +[6]: https://opensource.com/sites/default/files/uploads/dotnet-test.png (Output of dotnet.test) +[7]: http://www.mbtest.org/ +[8]: https://opensource.com/sites/default/files/uploads/mountebank-startup.png (mountebank startup) +[9]: https://curl.haxx.se/ +[10]: https://www.postman.com/ +[11]: https://opensource.com/sites/default/files/uploads/status-201.png (Postman output) +[12]: https://opensource.com/sites/default/files/uploads/dotnet-test2.png (dotnet test output) diff --git a/sources/tech/20200305 5 productivity apps for Linux.md b/sources/tech/20200305 5 productivity apps for Linux.md new file mode 100644 index 0000000000..3e7423dc59 --- /dev/null +++ b/sources/tech/20200305 5 productivity apps for Linux.md @@ -0,0 +1,153 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (5 productivity apps for Linux) +[#]: via: (https://opensource.com/article/20/3/productivity-apps-linux-elementary) +[#]: author: (Scott Nesbitt https://opensource.com/users/scottnesbitt) + +5 productivity apps for Linux +====== +Get organized and accomplish more with these five productivity apps for +the Elementary Linux desktop. +![Person drinking a hat drink at the computer][1] + +I've had a soft spot for [Elementary OS][2] since I first encountered it in 2013. A lot of that has to do with the distribution being very clean and simple. + +Since 2013, I've recommended Elementary to people who I've helped [transition to Linux][3] from other operating systems. Some have stuck with it. Some who moved on to other Linux distributions told me that Elementary helped smooth the transition and gave them more confidence using Linux. + +Like the distribution itself, many of the applications created specifically for Elementary OS are simple, clean, and useful. They can help boost your day-to-day productivity, too. + +### About "pay-what-you-want" apps + +Some apps in the Elementary AppCenter ask you to pay what you can. You're not obliged to pay to the full amount a developer asks for (or pay anything, for that matter). However, any money that changes hands goes to support the development of those apps. + +Three of the applications in this article—Quilter, Notes-up, and Envelope—are pay-what-you-want. If you find an app useful, I encourage you to send some money the developer's way. + +### Envelope + +Managing your budget should be simple. More than a few people, though, struggle with the task. That's where [Envelope][4] can help. While Envelope doesn't pack the features of something like [GnuCash][5], it's good enough for most of us. + +The app is built around the [envelope system][6] of personal and household budgeting. The first time you launch Envelope, you need to set up an account. You can do that manually, or you can import a [QIF][7] file containing financial information from another program. + +![Adding an account in Envelope][8] + +Either way, Envelope offers a set of categories (your envelopes). Add or delete categories as you see fit—for example, I don't own a car, so I deleted the Fuel category. + +From there, add transactions. Those can be your expenses or your income. Or both. + +![Entering a transaction in Envelope][9] + +Envelope gives you an overview of your spending and income. To get a more focused view of your budget, you can report on the current or previous month or a specific range of dates. + +### Notes-Up + +[Notes-Up][10]'s look and feel are reminiscent of note-taking tools like [Standard Notes][11], Simplenote, and the macOS Notes app. If you use any of them, switching to Notes-Up will be smooth and painless. Regardless, Notes-Up is easy to learn and use. + +![Notes-Up][12] + +Create a note and start typing. Notes-Up supports Markdown, making it easy to add formatting to your notes. + +![Taking notes in Notes-Up][13] + +If your Markdown is rusty, you can click the buttons on the toolbar to add formatting like lists; bold, italics, and strikethrough; code blocks; images; and more. You can also export your notes as PDF or Markdown files. + +Use Notes-Up for a while, and you'll wind up with a long list of notes. Organize them using _notebooks_. You can, for example, create personal, school, and work notebooks. On top of that, Notes-Up enables you to create sub-notebooks. Under my notebook for Opensource.com, for example, I have sub-notebooks for articles and the news roundups I curate. + +Notebooks not your thing? Then use tags to add keywords to your notes to make them easier to sort. + +### Yishu + +I do as much of my work as I can in [plain text][14]. That includes my task list. For that, I turn to a handy command-line application called [Todo.txt][15]. + +If you aren't comfortable working at the command line, then [Yishu][16] is for you. It has Todo.txt's key features but graphically on the desktop. + +![Yishu][17] + +When you first fire up Yishu, it asks you to open an existing Todo.txt file. If you have one, open it. Otherwise, create a task. That also creates a new file for your tasks. + +![Adding a task in Yishu][18] + +Your options are limited: a description of the task and a priority. You can also add a due date in the format _YYYY-MM-DD_—for example, _2020-02-17_. + +When you click **OK**, Yishu saves the file Todo.txt to your **/home** folder. That might not be where you want to store your tasks. You can tell Yishu to use another folder in its preferences. + +### Reminduck + +Chances are, your notifications and reminders are jarring. A piercing buzz, an annoying beep, a text box that appears when you least expect it. Why not add a bit of [calm][19] and a bit of whimsy to your reminders—with a duck? + +That's the idea behind [Reminduck][20]. It's a simple and fun way to tell yourself it's time to do, well, anything. + +Fire up the app and create a reminder. You can add a description, date, and time for the reminder to appear, and you can set it to repeat. Reminders can repeat after a number of minutes that you set or at specific times every day, week, or month. + +![Reminduck][21] + +You can set up more than one reminder. Reminduck organizes your reminders, and you can edit or delete them. + +![Reminduck reminders][22] + +When the reminder is triggered, a little message pops out of the notification area on the desktop along with a soft alert and an icon of a smiling duck. + +![Reminduck notification][23] + +### Quilter + +It's easy enough to write with [Markdown][24] in a plain old text editor. Some folks, though, prefer to work with a dedicated Markdown editor. On the Elementary OS desktop, one option is [Quilter][25]. + +![Quilter][26] + +Quilter is pretty basic. There's no toolbar to insert formatting; you have to add Markdown by hand. On the other hand, Quilter displays a running word count and an estimate of how long it will take to read what you're writing. + +![Quilter][27] + +The editor's options are few. There's a preview mode, and you can export your documents to PDF or HTML. The result of an export has the same look as a preview. That's not a bad thing. + +Quilter's other options include the ability to change the line spacing and margins, set the editor's font, as well as enable syntax highlighting and spell checking. It also has a mode that you can use to focus on a single line or a single paragraph while you're writing. + +### Final thoughts + +Sometimes, the best tools to boost your productivity are simple ones. Applications like the five above focus on doing one thing and doing it well. + +Envelope, Notes-Up, Yishu, Reminduck, and Quilter won't appeal to everyone. But if you use Elementary OS, give them a try. They can help you keep on track and do what you need to do. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/3/productivity-apps-linux-elementary + +作者:[Scott Nesbitt][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/scottnesbitt +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/coffee_tea_laptop_computer_work_desk.png?itok=D5yMx_Dr (Person drinking a hat drink at the computer) +[2]: https://elementary.io +[3]: https://opensource.com/article/18/12/help-non-techies +[4]: https://nlaplante.github.io/envelope/ +[5]: https://opensource.com/article/20/2/gnucash +[6]: https://en.wikipedia.org/wiki/Envelope_system +[7]: https://en.wikipedia.org/wiki/Quicken_Interchange_Format +[8]: https://opensource.com/sites/default/files/uploads/envelope-add-account.png (Adding an account in Envelope) +[9]: https://opensource.com/sites/default/files/uploads/envelope-entering-transaction.png (Entering a transaction in Envelope) +[10]: https://appcenter.elementary.io/com.github.philip-scott.notes-up/ +[11]: https://opensource.com/article/18/12/taking-notes-standard-notes +[12]: https://opensource.com/sites/default/files/uploads/notes-up-main-window.png (Notes-Up) +[13]: https://opensource.com/sites/default/files/uploads/notes-up-taking-note.png (Taking notes in Notes-Up) +[14]: https://plaintextproject.online +[15]: https://opensource.com/article/20/1/open-source-to-do-list +[16]: https://appcenter.elementary.io/com.github.lainsce.yishu/ +[17]: https://opensource.com/sites/default/files/uploads/yishu-task-list.png (Yishu) +[18]: https://opensource.com/sites/default/files/uploads/yishu-add-task.png (Adding a task in Yishu) +[19]: https://weeklymusings.net/weekly-musings-025 +[20]: https://appcenter.elementary.io/com.github.matfantinel.reminduck/ +[21]: https://opensource.com/sites/default/files/uploads/reminduck.png (Reminduck) +[22]: https://opensource.com/sites/default/files/uploads/remiunduck-reminders-list.png (Reminduck reminders) +[23]: https://opensource.com/sites/default/files/uploads/reminduck-notification.png (Reminduck notification) +[24]: https://opensource.com/article/19/8/markdown-beginners-cheat-sheet +[25]: https://appcenter.elementary.io/com.github.lainsce.quilter/ +[26]: https://opensource.com/sites/default/files/uploads/quilter.png (Quilter) +[27]: https://opensource.com/sites/default/files/uploads/quilter-editing.png (Quilter) diff --git a/sources/tech/20200307 Compose music as code using Sonic Pi.md b/sources/tech/20200307 Compose music as code using Sonic Pi.md new file mode 100644 index 0000000000..6944a5f6ea --- /dev/null +++ b/sources/tech/20200307 Compose music as code using Sonic Pi.md @@ -0,0 +1,130 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Compose music as code using Sonic Pi) +[#]: via: (https://opensource.com/article/20/3/sonic-pi) +[#]: author: (Matt Bargenquast https://opensource.com/users/mbargenquast) + +Compose music as code using Sonic Pi +====== +There's no need for instrumental mastery with this accessible open +source program that can turn you into a musical virtuoso. +![Bird singing and music notes][1] + +Maybe you're like me, and you learned a musical instrument when you were in school. For me, it was the piano, and later, the viola. However, I've always held that, as my childhood interests shifted towards computers and coding, I subsequently neglected my music practice. I do wonder what I would have done if I'd had something like Sonic Pi when I was younger. Sonic Pi is an open source program that lets you compose and perform music through code itself. It's the perfect marriage of those two worlds. + +Opensource.com is no stranger to Sonic Pi—we [featured an interview][2] with the creator, Dr. Sam Aaron, back in 2015. Since that time, a lot has changed, and Sonic Pi has grown substantially in many ways. It's reached a major new version milestone, with the long-awaited v3.2 release made publically available on February 28, 2020. A growing community of developers is actively contributing to its [GitHub project][3], while an equally thriving community of composers shares ideas and support in the [official forums][4]. The project is now also financially assisted through a [Patreon campaign][5], and Sam himself has been spreading the word of Sonic Pi through schools, conferences, and workshops worldwide. + +What really shines about Sonic Pi is its approachability. Releases are available for many major flavors of OS, including Windows, macOS, Linux, and of course, the Raspberry Pi itself. In fact, getting started with Sonic Pi on a Raspberry Pi couldn't be simpler; it comes pre-installed with [Raspbian][6], so if you have an existing Raspbian-based setup, you'll find it situated in the programming menu. + +Upon loading Sonic Pi for the first time, you'll be greeted with a simple interface with two main areas: an editor in which to write your code, and a section devoted to Sonic Pi's expansive tutorial. For newcomers, the tutorial is an essential resource for learning the basics, featuring accompanying music programs to reinforce each concept being taught. + +If you're following along, let's code ourselves a simple bit of music and explore the potential of live-coding music. Type or paste the following code into the Sonic Pi editor: + + +``` +live_loop :beat do +  sample :drum_heavy_kick +  sleep 1 +end +``` + +Even if you're a Sonic Pi novice, many coders may immediately understand what's going on here. We're playing a drum kick sample, sleeping for a second, and then repeating. Click the Run button or press ALT+R (meta+R on macOS), and you should hear it begin to play. + +This isn't a very exciting song yet, so let's liven it up with a snare playing on the off-beat. Replace the existing code with the block below and Run again. You can leave the existing beat playing while you do this; you'll notice that your changes will be applied naturally, in time with the beat: + + +``` +live_loop :beat do +  sample :drum_heavy_kick +  sleep 0.5 +  sample :drum_snare_soft +  sleep 0.5 +end +``` + +While we're at it, let's add a hi-hat right before every fourth beat, just to make things a little interesting. Add this new block below our existing one and Run again: + + +``` +live_loop :hihat do +  sleep 3.9 +  sample :drum_cymbal_closed +  sleep 0.1 +end +``` + +We've got our beat going now, so let's add a bassline! Sonic Pi comes with a variety of synths built-in, along with effects filters such as reverb and distortion. We'll use a combination of the "dsaw" and "tech_saw" synths to give it an electronic retro-synth feel. Add the block below to your existing program, Run, and have a listen: + + +``` +live_loop :bass do +  use_synth :dsaw +  play :a2, attack: 1, release: 2, amp: 0.3 +  sleep 2.5 +  use_synth :tech_saws +  play :a1, attack: 1, release: 1.5, amp: 0.8 +  sleep 1.5 +end +``` + +You'll note above that we have full control over the [ADSR][7] envelope when playing notes, so we can decide when each sound should peak and fade. + +Lastly, let's add a lead synth and try out one of those effects features known as the "slicer." To spice things up, we'll also introduce an element of pseudo-randomness by letting Sonic Pi pick from a series of potential chords. This is where some of the fun improvisation and "happy accidents" can begin to occur. Add the block below to your existing program and Run: + + +``` +live_loop :lead do +  with_fx :slicer do +    chords = [(chord :A4, :minor7), (chord :A4, :minor), (chord :D4, :minor7), (chord :F4, :major7)] +    use_synth :blade +    play chords.choose, attack: 1, release: 2, amp: 1 +    sleep 2 +  end +end +``` + +Great! Now, we're certainly not going to be competing with Daft Punk any time soon, but hopefully, through this process, you've seen how we can go from a bare beat to something much bigger, in real-time, by adding some simple morsels of code. It is well worth watching one of Sam Aaron's [live coding performances][8] on YouTube for a demonstration of how creative and adaptive Sonic Pi can let you be. + +![Sonic Pi composition example][9] + +Our finished piece, in full + +If you've ever wanted to learn a musical instrument, but felt held back by thoughts like "I don't have rhythm" or "my hands aren't nimble enough," Sonic Pi is a versatile instrument for which none of those things matter. All you need are the ideas, the inspiration, and an inexpensive computer such as the humble Raspberry Pi. The rest is at your fingertips—literally! + +Here are a few handy links to get you started: + + * The Official Sonic Pi [website][10] and [tutorial][11] + * [Getting Started with Sonic Pi][12] ([projects.raspberrypi.org][13]) + * Sonic Pi [Github project][3] + + + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/3/sonic-pi + +作者:[Matt Bargenquast][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/mbargenquast +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/music-birds-recording-520.png?itok=UoM7brl0 (Bird singing and music notes) +[2]: https://opensource.com/life/15/10/interview-sam-aaron-sonic-pi +[3]: https://github.com/samaaron/sonic-pi/ +[4]: https://in-thread.sonic-pi.net/ +[5]: https://www.patreon.com/samaaron +[6]: https://www.raspberrypi.org/downloads/raspbian/ +[7]: https://en.wikipedia.org/wiki/Envelope_(music) +[8]: https://www.youtube.com/watch?v=JEHpS1aTKp0 +[9]: https://opensource.com/sites/default/files/uploads/sonicpi.png (Sonic Pi composition example) +[10]: https://sonic-pi.net/ +[11]: https://sonic-pi.net/tutorial.html +[12]: https://projects.raspberrypi.org/en/projects/getting-started-with-sonic-pi +[13]: http://projects.raspberrypi.org diff --git a/sources/tech/20200309 Level up your use of Helm on Kubernetes with Charts.md b/sources/tech/20200309 Level up your use of Helm on Kubernetes with Charts.md new file mode 100644 index 0000000000..9a08bdb973 --- /dev/null +++ b/sources/tech/20200309 Level up your use of Helm on Kubernetes with Charts.md @@ -0,0 +1,288 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Level up your use of Helm on Kubernetes with Charts) +[#]: via: (https://opensource.com/article/20/3/helm-kubernetes-charts) +[#]: author: (Jessica Cherry https://opensource.com/users/jrepka) + +Level up your use of Helm on Kubernetes with Charts +====== +Configuring known apps using the Helm package manager. +![Ships at sea on the web][1] + +Applications are complex collections of code and configuration that have a lot of nuance to how they are installed. Like all open source software, they can be installed from source code, but most of the time users want to install something simply and consistently. That’s why package managers exist in nearly every operating system, which manages the installation process. + +Similarly, Kubernetes depends on package management to simplify the installation process. In this article, we’ll be using the Helm package manager and its concept of stable charts to create a small application. + +### What is Helm package manager? + +[Helm][2] is a package manager for applications to be deployed to and run on Kubernetes. It is maintained by the [Cloud Native Computing Foundation][3] (CNCF) with collaboration with the largest companies using Kubernetes. Helm can be used as a command-line utility, which [I cover how to use here][4]. + +#### Installing Helm + +Installing Helm is quick and easy for Linux and macOS. There are two ways to do this, you can go to the release [page][5], download your preferred version, untar the file, and move the Helm executable to your** /usr/local/bin** or your **/usr/bin** whichever you are using. + +Alternatively, you can use your operating system package manage (**dnf**, **snap**, **brew**, or otherwise) to install it. There are instructions on how to install on each OS on this [GitHub page][6]. + +### What are Helm Charts? + +We want to be able to repeatably install applications, but also to customize them to our environment. That’s where Helm Charts comes into play. Helm coordinates the deployment of applications using standardized templates called Charts. Charts are used to define, install, and upgrade your applications at any level of complexity. + +> A _Chart_ is a Helm package. It contains all of the resource definitions necessary to run an application, tool, or service inside of a Kubernetes cluster. Think of it like the Kubernetes equivalent of a Homebrew formula, an Apt dpkg, or a Yum RPM file. +> +> [Using Helm][7] + +Charts are quick to create, and I find them straightforward to maintain. If you have one that is accessible from a public version control site, you can publish it to the [stable repository][8] to give it greater visibility. In order for a Chart to be added to stable, it must meet a number of [technical requirements][9]. In the end, if it is considered properly maintained by the Helm maintain, it can then be published to [Helm Hub][10]. + +Since we want to use the community-curated stable charts, we will make that easier by adding a shortcut:  + + +``` +$ helm repo add stable +"stable" has been added to your repositories +``` + +### Running our first Helm Chart + +Since I’ve already covered the basic Helm usage in [this article][11], I’ll focus on how to edit and use charts in this article. To follow along, you’ll need Helm installed and access to some Kubernetes environment, like minikube (which you can walk through [here][12] or [here][13]). + +Starting I will be picking one chart. Usually, in my article I use Jenkins as my example, and I would gladly do this if the chart wasn’t really complex. This time I’ll be using a basic chart and will be creating a small wiki, using [mediawiki and its chart][14].   + +So how do I get this chart? Helm makes that as easy as a pull. + +By default, charts are compressed in a .tgz file, but we can unpack that file to customize our wiki by using the **\--untar** flag. + + +``` +$ helm pull stable/mediawiki --untar +$ ls +mediawiki/ +$ cd mediawiki/ +$ ls +Chart.yaml         README.md          requirements.lock  templates/ +OWNERS             charts/            requirements.yaml  values.yaml +``` + +Now that we have this we can begin customizing the chart. + +### Editing your Helm Chart + +When the file was untared there was a massive amount of files that came out. While it does look frightening, there really is only one file we should be working with and that's the **values.yaml** file. + +Everything that was unpacked was a list of template files that has all the information for the basic application configurations. All the template files actually depend on what is configured in the values.yaml file. Most of these templates and chart files actually are for creating service accounts in the cluster and the various sets of required application configurations that would usually be put together if you were to build this application on a regular server. + +But on to the values.yaml file and what we should be changing in it. Open it in your favorite text editor or IDE. We see a [YAML][15] file with a ton of configuration. If we zoom in just on the container image file, we see its repository, registry, and tags amongst other details. + + +``` +## Bitnami DokuWiki image version +## ref: +## +image: +  registry: docker.io +  repository: bitnami/mediawiki +  tag: 1.34.0-debian-10-r31 +  ## Specify a imagePullPolicy +  ## Defaults to 'Always' if image tag is 'latest', else set to 'IfNotPresent' +  ## ref: +  ## +  pullPolicy: IfNotPresent +  ## Optionally specify an array of imagePullSecrets. +  ## Secrets must be manually created in the namespace. +  ## ref: +  ## +  # pullSecrets: +  #   - myRegistryKeySecretName +``` + +As you can see in the file each configuration for the values is well-defined. Our pull policy is set to **IfNotPresent**. This means if I run a **helm pull** command, it will not overwrite my existing version. If it’s set to always, the image will default to the latest version of the image on every pull. I’ll be using the default in this case, as in the past I have run into images being broken if it goes to the latest version without me expecting it (remember to version control your software, folks). + +### Customizing our Helm Chart + +So let’s configure this values file with some basic changes and make it our own. I’ll be changing some naming conventions, the wiki username, and the mediawiki site name. _Note: This is another snippet from values.yaml. All of this customization happens in that one file._ + + +``` +## User of the application +## ref: +## +mediawikiUser: cherrybomb + +## Application password +## Defaults to a random 10-character alphanumeric string if not set +## ref: +## +# mediawikiPassword: + +## Admin email +## ref: +## +mediawikiEmail: [root@example.com][16] + +## Name for the wiki +## ref: +## +mediawikiName: Jess's Home of Helm +``` + +After this, I’ll make some small modifications to our database name and user account. I changed the defaults to "jess" so you can see where changes were made. + + +``` +externalDatabase: + ## Database host +  host: + +  ## Database port +  port: 3306 + +  ## Database user +  user: jess_mediawiki + +  ## Database password +  password: + +  ## Database name +  database: jess_mediawiki + +## +## MariaDB chart configuration +## +## +## +mariadb: + ## Whether to deploy a mariadb server to satisfy the applications database requirements. To use an external database set this to false and configure the externalDatabase parameters +  enabled: true +  ## Disable MariaDB replication +  replication: +    enabled: false + +  ## Create a database and a database user +  ## ref: +  ## +  db: +    name: jess_mediawiki +    user: jess_mediawiki +``` + +And finally, I’ll be adding some ports in our load balancer to allow traffic from the local host. I'm running on minikube and find the **LoadBalancer** option works well. + + +``` +service: + ## Kubernetes svc type +  ## For minikube, set this to NodePort, elsewhere use LoadBalancer +  ## +  type: LoadBalancer +  ## Use serviceLoadBalancerIP to request a specific static IP, +  ## otherwise leave blank +  ## +  # loadBalancerIP: +  # HTTP Port +  port: 80 +  # HTTPS Port +  ## Set this to any value (recommended: 443) to enable the https service port +  # httpsPort: 443 +  ## Use nodePorts to requets some specific ports when usin NodePort +  ## nodePorts: +  ##   http: <to set explicitly, choose port between 30000-32767> +  ##   https: <to set explicitly, choose port between 30000-32767> +  ## +  # nodePorts: +  #  http: "30000" +  #  https: "30001" +  ## Enable client source IP preservation +  ## ref +  ## +  externalTrafficPolicy: Cluster +``` + +Now that we have made the configurations to allow traffic and create the database, we know that we can go ahead and deploy our chart. + +### Deploy and enjoy! + +Now that we have our custom version of the wiki, it's time to create a deployment. Before we get into that, let’s first confirm that nothing else is installed with Helm, to make sure my cluster has available resources to run our wiki. + + +``` +$ helm ls +NAME    NAMESPACE       REVISION        UPDATED STATUS  CHART   APP VERSION +``` + +There are no other deployments through Helm right now, so let's proceed with ours.  + + +``` +$ helm install jesswiki -f values.yaml stable/mediawiki +NAME: jesswiki +LAST DEPLOYED: Thu Mar  5 12:35:31 2020 +NAMESPACE: default +STATUS: deployed +REVISION: 2 +NOTES: +1\. Get the MediaWiki URL by running: + +  NOTE: It may take a few minutes for the LoadBalancer IP to be available. +        Watch the status with: 'kubectl get svc --namespace default -w jesswiki-mediawiki' + +  export SERVICE_IP=$(kubectl get svc --namespace default jesswiki-mediawiki --template "{{ range (index .status.loadBalancer.ingress 0) }}{{.}}{{ end }}") +  echo "Mediawiki URL: http://$SERVICE_IP/" + +2\. Get your MediaWiki login credentials by running: + +    echo Username: user +    echo Password: $(kubectl get secret --namespace default jesswiki-mediawiki -o jsonpath="{.data.mediawiki-password}" | base64 --decode) +$ +``` + +Perfect! Now we will navigate to the wiki, which is accessible at the cluster IP address. To confirm that address: + + +``` +kubectl get svc --namespace default -w jesswiki-mediawiki +NAME                 TYPE           CLUSTER-IP      EXTERNAL-IP   PORT(S)        AGE +jesswiki-mediawiki   LoadBalancer   10.103.180.70   <pending>     80:30220/TCP   17s +``` + +Now that we have the IP, we go ahead and check to see if it’s up:  + +![A working wiki installed through helm charts][17] + +Now we have our new wiki up and running, and we can enjoy our new application with our personal edits. Use the command from the output above to get the password and start to fill in your wiki. + +### Conclusion + +Helm is a powerful package manager that makes installing and uninstalling applications on top of Kubernetes as simple as a single command. Charts add to the experience by giving us curated and tested templates to install applications with our unique customizations. Keep exploring what Helm and Charts have to offer and let me know what you do with them in the comments. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/3/helm-kubernetes-charts + +作者:[Jessica Cherry][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/jrepka +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/kubernetes_containers_ship_lead.png?itok=9EUnSwci (Ships at sea on the web) +[2]: https://www.google.com/url?q=https://helm.sh/&sa=D&ust=1583425787800000 +[3]: https://www.google.com/url?q=https://www.cncf.io/&sa=D&ust=1583425787800000 +[4]: https://www.google.com/url?q=https://opensource.com/article/20/2/kubectl-helm-commands&sa=D&ust=1583425787801000 +[5]: https://www.google.com/url?q=https://github.com/helm/helm/releases/tag/v3.1.1&sa=D&ust=1583425787801000 +[6]: https://www.google.com/url?q=https://github.com/helm/helm&sa=D&ust=1583425787802000 +[7]: https://helm.sh/docs/intro/using_helm/ +[8]: https://www.google.com/url?q=https://github.com/helm/charts&sa=D&ust=1583425787803000 +[9]: https://github.com/helm/charts/blob/master/CONTRIBUTING.md#technical-requirements +[10]: https://www.google.com/url?q=https://hub.helm.sh/&sa=D&ust=1583425787803000 +[11]: https://www.google.com/url?q=https://opensource.com/article/20/2/kubectl-helm-commands&sa=D&ust=1583425787803000 +[12]: https://www.google.com/url?q=https://opensource.com/article/18/10/getting-started-minikube&sa=D&ust=1583425787804000 +[13]: https://www.google.com/url?q=https://opensource.com/article/19/7/security-scanning-your-devops-pipeline&sa=D&ust=1583425787804000 +[14]: https://www.google.com/url?q=https://github.com/helm/charts/tree/master/stable/mediawiki&sa=D&ust=1583425787805000 +[15]: https://en.wikipedia.org/wiki/YAML +[16]: mailto:root@example.com +[17]: https://opensource.com/sites/default/files/uploads/lookitworked.png (A working wiki installed through helm charts) diff --git a/sources/tech/20200311 Using the Quarkus Framework on Fedora Silverblue - Just a Quick Look.md b/sources/tech/20200311 Using the Quarkus Framework on Fedora Silverblue - Just a Quick Look.md new file mode 100644 index 0000000000..1d72cd1d03 --- /dev/null +++ b/sources/tech/20200311 Using the Quarkus Framework on Fedora Silverblue - Just a Quick Look.md @@ -0,0 +1,209 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Using the Quarkus Framework on Fedora Silverblue – Just a Quick Look) +[#]: via: (https://fedoramagazine.org/using-the-quarkus-framework-on-fedora-silverblue-just-a-quick-look/) +[#]: author: (Stephen Snow https://fedoramagazine.org/author/jakfrost/) + +Using the Quarkus Framework on Fedora Silverblue – Just a Quick Look +====== + +![Using the Quarkus Framework on Fedora Silverblue – Just a Quick Look][1] + +[Quarkus][2] is a framework for Java development that is described on their web site as: + +> A Kubernetes Native Java stack tailored for OpenJDK HotSpot and GraalVM, crafted from the best of breed Java libraries and standards +> +> – Feb. 5, 2020 + +Silverblue — a Fedora Workstation variant with a container based workflow central to its functionality — should be an ideal host system for the Quarkus framework. + +There are currently two ways to use Quarkus with Silverblue. It can be run in a pet container such as Toolbox/Coretoolbox. Or it can be run directly in a terminal emulator. This article will focus on the latter method. + +### Why Quarkus + +[According to Quarkus.io][3]: “Quarkus has been designed around a containers first philosophy. What this means in real terms is that Quarkus is optimized for low memory usage and fast startup times.” To achieve this, they employ first class support for Graal/Substrate VM, build time Metadata processing, reduction in reflection usage, and native image preboot. For details about why this matters, read [Container First][3] at Quarkus. + +### Prerequisites + +A few prerequisites will need to configured before you can start using Quarkus. First, you need an IDE of your choice. Any of the popular ones will do. VIM or Emacs will work as well. The Quarkus site provides full details on how to set up the three major Java IDE’s (Eclipse, Intellij Idea, and Apache Netbeans). You will need a version of JDK installed. JDK 8, JDK 11 or any distribution of OpenJDK is fine. GrallVM 19.2.1 or 19.3.1 is needed for compiling down to native. You will also need Apache Maven 3.53+ or Gradle. This article will use Maven because that is what the author is more familiar with. Use the following command to layer Java 11 OpenJDK and Maven onto Silverblue: + +``` +$ rpm-ostree install java-11-openjdk* maven +``` + +Alternatively, you can download your favorite version of Java and install it directly in your home directory. + +After rebooting, configure your _JAVA_HOME_ and _PATH_ environment variables to reference the new applications. Next, go to the [GraalVM download page][4], and get GraalVM version 19.2.1 or version 19.3.1 for Java 11 OpenJDK. Install Graal as per the instructions provided. Basically, copy and decompress the archive into a directory under your home directory, then modify the _PATH_ environment variable to include Graal. You use it as you would any JDK. So you can set it up as a platform in the IDE of your choice. Now is the time to setup the native image if you are going to use one. For more details on setting up your system to use Quarkus and the Quarkus native image, check out their [Getting Started tutorial][5]. With these parts installed and the environment setup, you can now try out Quarkus. + +### Bootstrapping + +Quarkus recommends you create a project using the bootstrapping method. Below are some example commands entered into a terminal emulator in the Gnome shell on Silverblue. + +``` +$ mvn io.quarkus:quarkus-maven-plugin:1.2.1.Final:create \ + -DprojectGroupId=org.jakfrost \ + -DprojectArtifactId=silverblue-logo \ + -DclassName="org.jakfrost.quickstart.GreetingResource" \ + -Dpath="/hello" +$ cd silverblue-logo +``` + +The bootstrapping process shown above will create a project under the current directory with the name _silverblue-logo_. After this completes, start the application in development mode: + +``` +$ ./mvnw compile quarkus:dev +``` + +With the application running, check whether it responds as expected by issuing the following command: + +``` +$ curl -w '\n' http://localhost:8080/hello +``` + +The above command should print _hello_ on the next line. Alternatively, test the application by browsing to __ with your web browser. You should see the same lonely _hello_ on an otherwise empty page. Leave the application running for the next section. + +### Injection + +Open the project in your favorite IDE. If you are using Netbeans, simply open the project directory where the _pom.xml_ file resides. Now would be a good time to have a look at the _pom.xml_ file. + +Quarkus uses ArC for its dependency injection. ArC is a dependency of quarkus-resteasy, so it is already part of the core Quarkus installation. Add a companion bean to the project by creating a java class in your IDE called _GreetingService.java_. Then put the following code into it: + +``` +import javax.enterprise.context.ApplicationScoped; + +@ApplicationScoped +public class GreetingService { + + public String greeting(String name) { + return "hello " + name; + } + +} +``` + +The above code is a verbatim copy of what is used in the injection example in the Quarkus Getting Started tutorial. Modify _GreetingResource.java_ by adding the following lines of code: + +``` +import javax.inject.Inject; +import org.jboss.resteasy.annotations.jaxrs.PathParam; + +@Inject + GreetingService service;//inject the service + + @GET //add a getter to use the injected service + @Produces(MediaType.TEXT_PLAIN) + @Path("/greeting/{name}") + public String greeting(@PathParam String name) { + return service.greeting(name); + } +``` + +If you haven’t stopped the application, it will be easy to see the effect of your changes. Just enter the following _curl_ command: + +``` +$ curl -w '\n' http://localhost:8080/hello/greeting/Silverblue +``` + +The above command should print _hello Silverblue_ on the following line. The URL should work similarly in a web browser. There are two important things to note: + + 1. The application was running and Quarkus detected the file changes on the fly. + 2. The injection of code into the app was very easy to perform. + + + +### The native image + +Next, package your application as a native image that will work in a _podman_ container. Exit the application by pressing **CTRL-C**. Then use the following command to package it: + +``` +$ ./mvnw package -Pnative -Dquarkus.native.container-runtime=podman +``` + +Now, build the container: + +``` +$ podman build -f src/main/docker/Dockerfile.native -t silverblue-logo/silverblue-logo +``` + +Now run it with the following: + +``` +$ podman run -i --rm -p 8080:8080 localhost/silverblue-logo/silverblue-logo +``` + +To get the container build to successfully complete, it was necessary to copy the _/target_ directory and contents into the _src/main/docker/_ directory. Investigation as to the reason why is still required, and though the solution used was quick and easy, it is not an acceptable way to solve the problem. + +Now that you have the container running with the application inside, you can use the same methods as before to verify that it is working. + +Point your browser to the URL and you should get a _index.html_ that is automatically generated by Quarkus every time you create or modify an application. It resides in the _src/main/resources/META-INF/resources/_ directory. Drop other HTML files in this _resources_ directory to have Quarkus serve them on request. + +For example, create a file named _logo.html_ in the _resources_ directory containing the below markup: + +``` + + + + + Silverblue + + + + +
      + Fedora Silverblue +
      + + +``` + +Next, save the below image alongside the _logo.html_ file with the name _fedora-silverblue-logo.png_: + +![][6] + +Now view the results at . + +#### Testing your application + +Quarkus supports junit 5 tests. Look at your project’s _pom.xml_ file. In it you should see two test dependencies. The generated project will contain a simple test, named _GreetingResourceTest.java_. Testing for the native file is only supported in _prod_ mode. However, you can test the _jar_ file in _dev_ mode. These tests are RestAssured, but you can use whatever test library you wish with Quarkus. Use Maven to run the tests: + +``` +$ ./mvnw test +``` + +More details can be found in the Quarkus [Getting Started][7] tutorial. + +#### Further reading and tutorials + +Quarkus has an extensive collection of [tutorials and guides][8]. They are well worth the time to delve into the breadth of this microservices framework. + +Quarkus also maintains a [publications][9] page that lists some very interesting articles on actual use cases of Quarkus. This article has only just scratched the surface of the topic. If what was presented here has piqued your interest, then follow the above links for more information. + +-------------------------------------------------------------------------------- + +via: https://fedoramagazine.org/using-the-quarkus-framework-on-fedora-silverblue-just-a-quick-look/ + +作者:[Stephen Snow][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://fedoramagazine.org/author/jakfrost/ +[b]: https://github.com/lujun9972 +[1]: https://fedoramagazine.org/wp-content/uploads/2020/02/quarkus-816x345.jpg +[2]: https://quarkus.io/ +[3]: https://quarkus.io/vision/container-first +[4]: https://www.graalvm.org/downloads/ +[5]: https://quarkus.io/get-started/ +[6]: https://fedoramagazine.org/wp-content/uploads/2020/02/fedora-silverblue-logo.png +[7]: https://quarkus.io/guides/getting-started +[8]: https://quarkus.io/guides/ +[9]: https://quarkus.io/publications/ diff --git a/sources/tech/20200313 How to set up the Raspberry Pi Zero for travel.md b/sources/tech/20200313 How to set up the Raspberry Pi Zero for travel.md new file mode 100644 index 0000000000..5b6ca689d7 --- /dev/null +++ b/sources/tech/20200313 How to set up the Raspberry Pi Zero for travel.md @@ -0,0 +1,472 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How to set up the Raspberry Pi Zero for travel) +[#]: via: (https://opensource.com/article/20/3/raspberry-pi-zero) +[#]: author: (Peter Garner https://opensource.com/users/petergarner) + +How to set up the Raspberry Pi Zero for travel +====== +You don't have to invest large amounts of money to build a relatively +powerful system that can be taken on the road and used productively. +![Airplane flying with a globe background][1] + +For some time now, I've been a huge fan of the [Raspberry Pi][2] computer in all of its various forms. I have a number of them, and each has a server role to play. Most of the time, they work extremely well, and I'm safe in the knowledge that the small amount of power they consume is keeping the bills down. + +If you've read my blog before, you may have read my account of how I [migrated my desktop computing][3] to a Pi 3. This worked well for quite a while, but I finally had to accept that editing large graphics and multimedia files was a problem, so I replaced it with an [Intel NUC][4]. My hankering for Pi experimentation was still there, though, and I decided to do a "what-if" exercise and see if it could survive on the road. And that's when I dragged my Pi Zero out of retirement from my spares box. + +### Why travel with a Raspberry Pi + +_"Why would I want to do this? Surely the trend is to travel with as powerful a device as possible?"_ + +Well, it's like this. Last year, my employer issued a decree that in order to conform to its security policy, we would no longer be able to check laptops in as luggage, and not long after, the US government decided to summarily ban carrying laptops in hand baggage to and from certain countries, y'know, for security. So how do we get around that one? The sensible option would be to not travel with a laptop and use a hot-desk style spare at the destination. After all, everything is in the cloud now, right? Or, you could carry your important, commercially sensitive data on a CD/DVD or memory stick, but only if it's encrypted to a standard and your employer's data handling policy allows that. + +The problem is multi-faceted though: What if your role is such that you need to be able to fix software/systems on-the-go and you don't always have access to a "spare" laptop? On the occasions when I travel (by train), I have to lug my laptop with me, and it's a pain over the course of a day. Then there's the loss/theft/damage problem. Laptops can be easy targets, they can get left on trains, or you could be mugged. Or there's the "[evil maid][5]" scenario, in which someone interferes with your device without your knowledge. The list goes on. + +So, here's what you can get with a Pi Zero portable computer: + + * It's small enough to fit in hand baggage or your pocket. + * It's cheap enough at $8 to buy another if yours gets lost/stolen/damaged. + * The entire OS and data are held on a "disk" that is as small as a fingernail, is cheap, and is easily bought in a wide variety of retail outlets. If need be, you can create a new one from a borrowed card from a phone. + * A full development environment with the ability to work offline or online. It can also act as an SSH server so that more than one person can use it at once. + * Safe storage: If you are paranoid or traveling on certain airlines, you can remove the "disk" and store it in your wallet or on your person. If your computer is stolen in transit, go and buy another one off the shelf: you're already set up with the OS. + * Network-tolerant: Around the world, there are country-specific WiFi frequencies, and a simple text-file change enables you to be compliant within minutes. + * Keyboard independent: You can use a compliant Bluetooth keyboard, but when you need to do something more demanding, you can just plug any USB keyboard into the spare USB connector using an On-The-Go cable. + * Power supply tolerant: My 3300mAh power bank can run the Pi Zero for about eight hours, but if all else fails, you can use a TV's USB connector to power it. Generally speaking, if a TV has HDMI, it will also have a USB socket, and the Zero only draws about 120mA. Or use someone's phone charger! + * Finally, if you're unfortunate enough to lose/damage your "disk," you can easily create another by downloading your 2GB image from a secure location in the cloud and burning it to a new card. Try doing _that_ with a normal laptop. + + + +That's motivation enough for me! + +Here is my finished product, with a beer coaster for scale. + +![Pi Zero W setup][6] + +### How I set up the Pi Zero for travel + +The cheap-as-chips Pi Zero has always been a bit of an odd beast, in my opinion. It features a single-core CPU and has a frugal 512MB of memory, some of which it has to share with the onboard video. The Raspbian OS currently based on Debian Stretch is touted as being suitable for the Zero with the LXDE-based "Pixel" GUI desktop, and indeed it can be loaded and started—but in reality, the poor thing really struggles to manage a GUI _and_ run useful software. + +Nevertheless, I was determined to give it a good try and set it up with the apps that have the smallest memory footprint. I'd already been around this loop with the Pi 3, so it was more of the same—only even more so! Bearing in mind this was to be a road warrior's computer, here's what I wanted to have on it: + +Web browser | Lightweight but with privacy in mind +---|--- +Email | IMAP-capable and seamlessly supporting GPG +XMPP/Jabber client | No-nonsense messaging +VPN client | I'm on the road, remember +Tor client | Always useful... +Music | I carry a few MP3s, but internet radio is cool, too +Multiple desktops | Useful with a small screen +Editor/IDE | Hey, it's a working computer! +FTP/SFTP client | Hey, it's a working computer! + +All in all, it's a very useful bundle for my purposes, and if I achieve a balanced environment, it could actually work. + +### Hardware + +The hardware was a bit of a challenge. The battery was not a problem, as I have a variety of rechargeable power packs with varying capacity, so it is really just a question of picking a suitable one for the day. The only prerequisite was that the battery should be able to take a charge while being used, and all my Jackery brand batteries do this. + +For my "disk," I opted for my in-house standard 32GB SanDisk Extreme microSDHC. They're very reliable, and the size is big enough to hold a lot of software and data while still remaining affordable. + +The video output would, I anticipated, be HDMI-out using the Zero's mini-HDMI connector. This suited my purposes well, as the majority of hotel TVs use this interface. Audio would also go via HDMI. + +That left the human interface devices (HID), and this, predictably, caused the most consternation. I hate Bluetooth with a passion, and with the Zero's limited connectors, I'd have to bite the bullet and use a Bluetooth keyboard and mouse, preferably a combined one—and small. There's no point in having a tiny computer if you have lug a great honking keyboard around as well, so my unhappy quest began. + +### Bluetooth woes + +The Zero has a limited number of USB connectors on board—just one, if you allow for the power connector, which obviously means you have limited connection options. You could always use a USB extender hub, but then that's more to carry—including another power supply. That basically leaves you trying to connect a keyboard and mouse via Bluetooth. I don't believe the hype about how it can "_easily connect a wide variety of devices together,_" and I wrestle with a variety of allegedly standard devices trying to get the bloody things to play nicely together. Part of the problem with the Pi (I think) is that there's some unintended interaction between WiFi and Bluetooth that causes weird stuff to happen. My problem was that I was able to connect to the Pi using a keyboard _or_ a mouse, but not both reliably at the same time. And yes, I have a variety of allegedly standards-following Bluetooth devices, none of which decided to work together properly. + +At this point, I was wondering if there was a Bluetooth Samaritan's Helpline, but there wasn't, so what the heck was I going to do?! Temporarily, I resorted to using an Apple USB keyboard with two USB sockets; this was useful for setup but not for being on the road. In the end, I spent hours browsing eBay and Amazon, and then I found it: a "_3- in-1 Mini Wireless Bluetooth Keyboard Mouse Touchpad For Windows iOS Android UK - Backlit, Ultra-thin, Built-in Rechargeable Battery, QWERTY_." Perfect on paper, but would it work? I sent off the money, and four days later, a slim package arrived from China. And it bloody well worked!! First time, every time, it got on with the Pi like pie and chips. I promptly ordered another one—accidents happen, and I wouldn't want to be left in the lurch. + +So, with my hardware lineup complete, I could settle down to setting up the Pi proper. + +### The GUI and the Pi + +Going back to my software requirements, I thought long and hard about the smallest desktop environment and went with the supplied LXDE desktop, which I'd used several times on other projects. Although the Pi struggled a bit with screen handling, it generally performed well, and I started setting up my software.  + +Web browser 1 + +Midori: a good compromise between size and modernity. Supports private browsing and is bundled with the Pi + +Web browser 2 + +Links2 in graphic mode: lightweight, fast, secure, works with proxies + +Email + +Sylpheed: small, light, and works well with GPG + +XMPP/Jabber client + +Profanity. It's great! + +VPN client + +OpenVPN + +Tor client + +Ha! Links2 again + +Music + +SMPlayer: the GUI for MPlayer + +Editor/IDE + +Geany: small and light but powerful + +Image viewer/editor + +Pinta + +FTP/SFTP client + +Filezilla + +**Other stuff:** + +Midnight Commander + +Not just a file manager (more later) + +Tor proxy server + +Always on, so I can use Tor as needed + +Nmap + +I sometimes need to test stuff + +vnStat + +Monitor data usage on the wlan0 interface + +SSH/SFTP server + +Standard issue on this distro + +UFW + +Firewall; can't be too careful! + +Gopher client + +Gopherspace! It's still out there, and I use the _original_ Gopher client! + +All of the above are tried, tested, and very stable packages. The web browser decision was a calculated one: the Zero doesn't _really_ have what it takes to negotiate a modern ~~bloated, ad-ridden~~ website, and honestly, I have a phone that can handle that sort of thing. Likewise, the decision to run a Tor proxy: it's very handy to be able to access Marianas Web, and using Links2 as a browser means that the risk is minimal. + +Sylpheed is a mature package that I believe has largely been replaced by Claws but is actually less demanding of resources. GPG integrated seamlessly with it, and I was able to exchange signed/encrypted messages with ease. It renders both plain-text and HTML messages well, and the interface is uncluttered. + +I needed a _simple_ XMPP/Jabber client. The problem I've found with many apps of this type is that they try to incorporate multiple messaging standards when I only really need XMPP. Profanity is ideal as it does one job and does it very well. + +### System setup + +I spent a considerable amount of time setting up the OS for the best performance; a task made easier because I have set up numerous Raspberry Pis before. In such a small (as in memory) system, the decision to use a swap file was not taken lightly, and unfortunately, using a GUI desktop meant that the swap is in frequent use. The alternative is to not have one and hope that the system doesn't freeze up too much. I went with the suggested default of 100MB. + +I then looked at logging. As this was supposed to be a small, portable system, I didn't see much point in having extensive logging, especially as it would have a negative effect on the SDHC card in the long term. One solution was a combination of disabling logging in apps wherever possible and sacrificing a little memory to create a tmpfs in-memory filesystem. This would have the added advantage that it would be recreated on each boot. So, I worked out that 8MB could be used for this and duly updated **/etc/fstab**. This works extremely well. + + +``` +`tmpfs /var/log tmpfs defaults,noatime,nosuid,mode=0755,size=8m 0 0` +``` + +I also had to update **/etc/rc.local** to provide some essential directories on startup; this kept the rsyslog and Tor daemons happy. + + +``` +mkdir -p /var/log/rsyslog +mkdir -p /var/log/tor/ +mkdir -p /var/log/vnstat/ +chown vnstat.root /var/log/vnstat/ +chown debian-tor /var/log/tor/ +``` + +With all that in place, the little computer was almost ready for Prime Time. But there was a problem. I've already mentioned the frugal amount of memory on the Zero, and even with the GUI and apps pared down to the bone, I was regularly using swap space. To make matters worse, much worse, my carefully set up desktop menus were having problems. + +The Pi desktop comes with an _incredible_ amount of software installed, mainly to satisfy its original purpose as an educational machine. I decided early on to edit the menus to remove a lot of the "junk" and replace it with my list of apps, so I fired up the Main Menu Editor app. Normally this is quite responsive, but on the resource-challenged Zero, it had worrying lags and pauses as I made changes. Ultimately, it meant that my ad-hoc menus were corrupted, and worse still, the default Pi menus had been reinstated. Searching for help with this problem revealed that the menu system is convoluted, and if an update is not saved properly, the defaults will be substituted. + +I looked at the structure of the menus as best I could and decided that trying to pick the frigging things apart was more trouble than it was worth. So, I ditched LXDE/Pixel and installed XFCE (and its even lighter-weight GUI) in its place. This time, the menu editor seemed more stable, but as I made the changes, I realized that yes, it was happening again. At that point, I had a tantrum and threw my toys out of the pram. I'd reached a crossroads in my road-warrior setup: it worked very well apart from the menus, and I felt I couldn't go back after all that work, so, with a heavy heart, I had a drastic rethink. It was supposed to be a hacker's machine, right? It was Linux and, to many like-minded people, that meant a text-based interface, right? + +So I did what I had to do: I ditched the accursed GUI! Yes, go back to the '90s, maybe even earlier, and Run it Like a Boss.™ The main problem I had in my mind was that I'd no longer have nice, safe, icon-driven apps and multiple desktops to work with. My WiFi/network switcher would be no more, and worse still, I'd have to try and manage Bluetooth from the command line. That was going to be a major challenge, but I decided to proceed anyway, and I had a cloned copy of my microSDHC just in case I lost my nerve. + +### Set it up again + +Incidentally, if I were using a full-spec Raspberry Pi 3, I wouldn't have been in this situation. But it was my choice, so… This exercise started out well. I was already rebooting into the terminal login prompt, and the Bluetooth keyboard was working, so I was able to log in (previously, I'd run **startx** to get to the desktop). Since I no longer had the desktop bloat to worry about, my memory usage was a mere 78MB and no swap usage; I felt better already. But what about the apps that make life easy? I did more hunting around, and here's what I came up with. + +Web browser + +Links2 _not_ in graphic mode: lightweight, fast, secure, works with proxies + +Email + +(Neo)Mutt: powerful, extensible and works well with GPG + +XMPP/Jabber client + +Profanity. It's great! + +VPN client + +OpenVPN + +Tor client + +Ha! Links2 again + +Music + +Midnight Commander + mpg123 + +Editor/IDE + +Nano: I'm using it to write this + +FTP/SFTP client + +Midnight Commander + +File manager + +Midnight Commander + +**Other stuff** + +Tor proxy server + +Always on, so I can use Tor as needed + +Nmap + +I sometimes need to test stuff + +vnStat + +Monitor data usage on the wlan0 interface + +SSH/SFTP server + +Standard issue on this distro + +Gopher client + +Gopherspace! It's still out there, and I use the _original_ Gopher client! + +**Graphics workarounds** + +fbcat + +Takes a screenshot using the framebuffer device + +fbi + +Linux framebuffer imageviewer: displays images in a terminal + +fbgs + +Displays PostScript/PDF files using the Linux framebuffer device on a terminal + +pnmtopng + +Converts a PPM into a PNG file + +You'll notice that there's not too much change there, with a few notable exceptions to display graphical content. + +### Do it again, and do it properly + +Things looked good, but I still had some issues to solve. + +#### Desktops + +"But what about the multiple desktops?!" I hear you asking, "How will you view images or connect to WiFi networks?" I needed to find a solution, and fast. For the multiple desktop thing, I decided to install tmux, the Linux Terminal Multiplexer. There are so many good reasons to run tmux on a Linux system, but my key reasons are that it makes multi-screen working possible, and it uses very little memory. It also enables me to connect to the Pi via SSH and take over the session, as you can see below. + +![tmux running on Raspberry Pi][7] + +#### Music + +I must say that it's very important to me to be able to listen to music while I'm working or relaxing, so the loss of (S)MPlayer was a major blow. I was able to listen to single MP3s or complete playlists. I was able to stream internet radio. Sigh. Midnight Commander came to the rescue with its ability to handle various file types. The secret is in the Extension File menu, which looks like this for me: + + +``` +shell/i/.mp3 +    Open=/usr/lib/mc/ext.d/sound.sh open mp3 +regex/i/\\.(m3u|pls)$ +        Open=/usr/lib/mc/ext.d/sound.sh open playlist +``` + +And my sound.sh looks like this: + + +``` +#!/bin/bash +do_open_action() { +    filetype=$1 +    case "${filetype}" in +    playlist) +        mpg123 -C -@ "${MC_EXT_FILENAME}" +        ;; +    m3u) +        mpg123 -C -@ "${MC_EXT_FILENAME}" +        ;; +    mp3) +        mpg123 -C "${MC_EXT_FILENAME}" +        ;; +    *) +        ;; +    esac +        } +case "${action}" in +open) +    ("${MC_XDG_OPEN}" "${MC_EXT_FILENAME}" >/dev/null 2>&1) || \ +        do_open_action "${filetype}" +    ;; +*) +    ;; +esac +``` + +Tapping Enter on an MP3 will play the file, or tapping on an M3U playlist will play whatever's in the playlist. I used the **-C** option so that I could have access to mpg123's controls. Sorted! + +#### SFTP/FTP clients + +Midnight Commander again! You can set up a client connection entry with the built-in menu and use **CTL+\** to select it from a drop-down. The FTP site is rendered in one of the panels as a directory structure, and you can just treat it as you would a local filesystem. SFTP is a bit harder, as you have to set it up as an SSH connection and then copy as required; it's OK if you have password authentication, but for public key authentication, I found it less involved to use SFTP from the command line. For reference, this is the syntax: + + +``` +sftp://[user@]machine:[port]/[remote-dir] + +The user, port and remote-dir elements are optional. +``` + +![MC FTP client example][8] + +#### WiFi selector + +In the GUI world, I had had a nice, icon-based WiFi network manager app that I could use to switch between networks. The text-mode alternative is the bizarrely named wicd-curses*.* It's an app that communicates with wicd (wireless control daemon) using cursor keys, and it works very well. I had to disable the dhcpcd service using systemctl to get it to work, but at least it lets me select the appropriate network, including my home network or my phone's wireless hotspot when I'm out on the road. Here's [how to do it][9]. + +![wicd-curses WiFi app][10] + +#### Email and web browsing + +For email and web browsing, I use Mutt (Neomutt) and Links2, respectively, and they just work. + +#### Gopher + +Trust me; you're not old enough to remember Gopher, the text mode forerunner of the WWW. Strictly speaking, it was before my time as well, but I run a thriving Gopher server, so I need a client. Here's what a Gopher server looks like running on a Raspberry Pi. + + +``` +                gopher://gopher.petergarner.net:70 + +__/\\\\\\\\\\\\\\\\\\_______/\\\\\\\\\\\\\\\\\\\\\\\\\\__________________/\\\\\\____ +_/\\\\\///////\\\\\\____\/\\\\\/////////\\\\\\______________/\\\\\\\\\\____ +_\/\\\\\\_____\/\\\\\\___\/\\\\\\_______\/\\\\\\__/\\\\\\_______/\\\\\/\\\\\\____ +_\/\\\\\\\\\\\\\\\\\\\\\/____\/\\\\\\\\\\\\\\\\\\\\\\\\\/___\///______/\\\\\/\/\\\\\\____ +_\/\\\\\//////\\\\\\____\/\\\\\/////////_____/\\\\\\_____/\\\\\/__\/\\\\\\____ +_\/\\\\\\____\//\\\\\\___\/\\\\\\_____________\/\\\\\\____/\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\_ +_\/\\\\\\_____\//\\\\\\__\/\\\\\\_____________\/\\\\\\\\__///////////\\\\\//__ +_\/\\\\\\______\//\\\\\\_\/\\\\\\_____________\/\\\\\\_______________\/\\\\\\___ +_\///________\///__\///______________\///_________________\///___ + +               Welcome to... "The Rpi4 Gopher" +               ... your source for local information, and beyond! + + -->  [14] About this server (and legal)/ + +           -- Content + +      [18] Tech-related/ +      [19] Politics and Propaganda (from all sides)/ +      [20] Cyber and Internet related/ +      [21] Stuff (filed under "miscellany")/ +..... +``` + +### Performance + +Overall, I'm pleased to say that my switch to text mode has been very beneficial with userland tasks handled responsively. As you can see from a typical **top** display, there's plenty of available and cached memory remaining from the original 512MB. Right now, I'm listening to a playlist, writing this article in an SSH-connected tmux session, running top**,** and Mutt is handling emails. + +On a regular basis, that's all I'll probably need to do, but it's great to have the option to develop and test software on the go, if I need to. Here's a simple Python script to get the Pi's CPU serial number (type): + + +``` +>>> #!/usr/bin/env python +... +>>> import subprocess +>>> +>>> def GetCPUserial(): +...     cpuinfo = subprocess.check_output(["/bin/cat", "/proc/cpuinfo"]) +...     cpuinfo = cpuinfo.replace("\t","") +...     cpuinfo = cpuinfo.split("\n") +...     [ legend, cpuserial ] = cpuinfo[11].split(' ') +...     return cpuserial +... +>>> print GetCPUserial() +9000c1 +>>> + +[/code] [code] + +top - 15:55:47 up  5:49,  6 users,  load average: 0.21, 0.25, 0.34 +Tasks: 112 total,   1 running, 110 sleeping,   1 stopped,   0 zombie +%Cpu(s): 3.9 us, 5.8 sy, 0.0 ni, 90.3 id, 0.0 wa, 0.0 hi, 0.0 si,   + +KiB Mem :   493252 total, 37984 free,  73248 used, 382020 buff/cache +KiB Swap:   102396 total, 102392 free,     4 used. 367336 avail Mem +``` + +I take regular backups, of course, using the indispensable [rpi-clone][11]. The beauty of this app is that I can copy the entire microSDHC card to another while the Pi is running. It also has the advantage that if I use a smaller capacity card, it will automatically and safely take this into account. I use a 32GB card, but I can dump it to an 8GB card because I'm only using about 4GB. The converse is true for a larger destination card. If you add only one utility to your Pi, this should be it—it's saved me more grief than _anything_ I've ever used! You can also use it to create distribution copies of your system. + +#### Battery life + +I can only describe the battery life as "impressive." Once the Zero is booted up, it takes an average 0.15A / 0.65W with the following running: + + * System + * Bluetooth + * WiFi + * Audio (HDMI) subsystem + * Video (HDMI) subsystem + + + +I've measured 20 hours of mixed usage from my 6000mAh Jackery Jetpack power bank, and if I disable WiFi and just use it in "local" mode, possibly more. It's certainly practical to use it with my smaller, 3300mAh Anker battery, which unfortunately isn't rechargeable while in use. I also have a 20,000mAh battery for long trips: I have yet to try that out. + +### Taking it on the road + +In terms of computing as a challenge, setting up the Zero has been a really valuable exercise. It's taught me to become acquainted with the operating system and app software at a low level in order to squeeze the maximum amount of memory from the system. It's also taught me that I don't have to invest large amounts of money to build a relatively powerful system that can be taken on the road and used productively. + +Now that I've almost finished setting it up, it's time to actually _take_ it on the road and see how it runs in the field. Hey, maybe I'll actually take into a field and see if I can do some work and listen to music. + +* * * + +_This was originally published on [Peter Garner's blog][12] under a CC BY-NC-ND 4.0 license and is reused here with the author's permission._ + +Having recently co-authored a book about building things with the Raspberry Pi ( Raspberry Pi Hacks... + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/3/raspberry-pi-zero + +作者:[Peter Garner][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/petergarner +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/plane_travel_world_international.png?itok=jG3sYPty (Airplane flying with a globe background) +[2]: https://opensource.com/resources/raspberry-pi +[3]: https://www.petergarner.net/projects/Mac_Mini_to_rpi-part_1.pdf +[4]: https://en.wikipedia.org/wiki/Next_Unit_of_Computing +[5]: http://threatbrief.com/evil-maid-attack/ +[6]: https://opensource.com/sites/default/files/uploads/pi-zero-on-the-road.jpg (Pi Zero W setup) +[7]: https://opensource.com/sites/default/files/uploads/tmux-on-pi.png (tmux running on Raspberry Pi) +[8]: https://opensource.com/sites/default/files/uploads/ftp-client-mc.png (MC FTP client example) +[9]: https://www.raspberrypi.org/forums/viewtopic.php?t=150124#p987430 +[10]: https://opensource.com/sites/default/files/uploads/wifi-selector.png (wicd-curses WiFi app) +[11]: https://github.com/billw2/rpi-clone +[12]: https://petergarner.net/notes/index.php?thisnote=20180202-Travels%20with%20a%20Pi diff --git a/sources/tech/20200313 How to whiteboard collaboratively with Drawpile.md b/sources/tech/20200313 How to whiteboard collaboratively with Drawpile.md new file mode 100644 index 0000000000..dba4bce1f8 --- /dev/null +++ b/sources/tech/20200313 How to whiteboard collaboratively with Drawpile.md @@ -0,0 +1,118 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How to whiteboard collaboratively with Drawpile) +[#]: via: (https://opensource.com/article/20/3/drawpile) +[#]: author: (Seth Kenlon https://opensource.com/users/seth) + +How to whiteboard collaboratively with Drawpile +====== +Need to whiteboard or draw something with others? Give Drawpile a try. +![markers for a whiteboard][1] + +Thanks to applications like [Krita][2] and [MyPaint][3], open source software users have all the tools they need to create stunning digital paintings. They are so good that you can see [art created with Krita][4] in some of your [favorite RPG books][5]. And it's getting better all the time; for example, [GIMP][6] 2.10 adopted MyPaint's brush engine, so users can benefit from MyPaint without even installing the whole application. + +But what about collaborative illustration? What do two or more artists do when they want to work together on one piece? What does your work team use when you need to whiteboard during a business meeting? Those are the questions, and the answer is [Drawpile][7]. + +![Drawpile's UI][8] + +Nyarlathotep by Sophia Eberhard + +Drawpile is a drawing application for Linux, Windows, and macOS. It's got a respectable brush engine and all the basic editorial tools (selection tools, flips and flops, mirror, and so on) to make it a good freehand digital paint application. But its most powerful feature is its easy multi-user mode. If you have Drawpile installed, you can host a drawing session from your computer or on a Drawpile server, allowing other users to join you in your virtual studio. This goes well beyond a screen-share session, which would just allow other users to _view_ your painting, and it's not a remote desktop with just one cursor. Drawpile enables several users, each with their own brush, to work on the same canvas at the same time over a network that can span the globe. + +### Installing Drawpile + +If you're using Linux, Drawpile is available as a [Flatpak][9] from [Flathub.org][10]. + +On Windows and macOS, download and install Drawpile from [Drawpile's download page][11]. When you first launch it on macOS, you must right-click on its icon and select **Open** to accept that it hasn't been signed by a registered Apple developer. + +### Drawing with Drawpile + +The Drawpile interface is simple and minimal. Along the right side of the application window are docked palettes, and along the top is a toolbar. Most of the tools available to you are visible: paint brushes, paint buckets, lines, Bézier curves, and so on. + +For quick access to brushes, Drawpile allows you to assign a unique brush, along with all of its settings (including color), to the number keys **1** through **5** on your keyboard. It's an efficient and easy way to quickly move between drawing tools. The **6** key holds an eraser. + +Drawpile also has layers, so you can keep different parts of your painting separate until you combine them for your final render. If you're an animator, you can even use Drawpile's onion skin and flipbook features (both available in the **Layer** menu) to do rudimentary frame-by-frame animation. Unlike Krita, Drawpile doesn't feature an [animation timeline][12], but it's enough for quick and fun animations. + +### Custom brushes + +Drawpile isn't Krita or MyPaint, so its brush engine is simple in comparison. The preset brushes have the usual properties, though, including: + + * **Opacity** adjusts how your strokes blend with existing paint + * **Hardness** defines the edges of your stroke + * **Smudging** allows existing strokes to be affected by your brush + * **Color pickup** allows your paint to pick up color from existing strokes + * **Spacing** controls how often the full brush cursor is sampled during a stroke + + + +Most of these are pressure-sensitive, so if you're using a drawing tablet (Wacom, for instance), then your brush strokes are dynamic depending upon pen pressure. The tablet support is borrowed from Krita, and it makes a big difference (although it's probably overkill for mock-ups or whiteboarding sessions). + +When you find a brush setting you like, you can add it to your brush set so you can use it again later. To add a brush, click the **Menu** button in the top-right corner of the docked **Brushes** palette and select **Add brush**. + +![Adding a brush in Drawpile][13] + +If the **Brushes** palette isn't visible, go to the **View** menu in the top menu bar and select **Brushes** from the **Docks** submenu. + +### Collaborative drawing + +To participate in a shared drawing session, go to the **Session** menu and click either **Host** to host a session or **Join** to join in on an existing one. + +#### Hosting a session + +If you're hosting a session, give your session a title and an optional password (or leave it blank to allow anyone in). In the **Server** section, set whether you're hosting the session from your computer or from someone else's server. You can host sessions on **pub.drawpile.net** for free, but all of your data will be sent out to the internet, which could affect performance. If you have a good internet connection, the lag is negligible, but if you're not confident in your internet speed or there's no reason to go out to the internet because your collaborators are in the same building as you, then you can host your session locally. + +![Settings for hosting a session][14] + +If you host locally, you must provide your IP address or computer name (ending in **.local**) to your collaborators so their Drawpile apps can find your computer. You can find your computer name in the **Sharing** preferences of the GNOME desktop if you're on Linux: + +![Sharing Drawpile in GNOME][15] + +You must enable Remote Login, and possibly adjust your [firewall settings][16] to allow other users to get through. + +On macOS and Windows, you may be running a firewall, and you may need to provide additional sharing permissions in your control panel or system settings. + +#### Joining a session + +If you're joining a session, you need to know either the URL or the IP address of the session you're trying to join. A URL is like a website address, such as syntheticdreams.net/listing. An IP address is the numerical version of a URL, such as 93.184.216.34. Some IP addresses are internal to your building, while others exist out on the internet. If you haven't been invited to a drawing session, you might be able to find a public group on Drawpile's [Communities][17] page. + +### Drawing with friends + +Open source has always been about sharing. Drawpile is not only software you can share with your friends and colleagues; it's software that allows you to work with them in a fun and creative way. Try Drawpile for your next project or boardroom meeting! + +Nick Hamilton talks about what he loves about the open source digital painting tool, Krita, prior... + +Akkana Peck shares three of her favorite GIMP tools. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/3/drawpile + +作者:[Seth Kenlon][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/seth +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/markers_whiteboard_draw.png?itok=hp6v1gHC (markers for a whiteboard) +[2]: https://krita.org/en/ +[3]: http://mypaint.org +[4]: https://krita.org/en/item/interview-with-alexandru-sabo/ +[5]: https://paizo.com/products/btpy9g9x?Pathfinder-Roleplaying-Game-Bestiary-5 +[6]: https://www.gimp.org/ +[7]: https://drawpile.net +[8]: https://opensource.com/sites/default/files/uploads/drawpile-ui.jpg (Drawpile's UI) +[9]: https://opensource.com/article/19/10/how-build-flatpak-packaging +[10]: https://flathub.org/apps/details/net.drawpile.drawpile +[11]: https://drawpile.net/download/ +[12]: https://opensource.com/life/16/10/animation-krita +[13]: https://opensource.com/sites/default/files/uploads/drawpile-brush-add.jpg (Adding a brush in Drawpile) +[14]: https://opensource.com/sites/default/files/uploads/drawpile-session-host.png (Settings for hosting a session) +[15]: https://opensource.com/sites/default/files/uploads/gnome-sharing.png (Sharing Drawpile in GNOME) +[16]: https://opensource.com/article/19/7/make-linux-stronger-firewalls +[17]: https://drawpile.net/communities diff --git a/sources/tech/20200313 Open source alternative for multi-factor authentication- privacyIDEA.md b/sources/tech/20200313 Open source alternative for multi-factor authentication- privacyIDEA.md new file mode 100644 index 0000000000..382aa368e5 --- /dev/null +++ b/sources/tech/20200313 Open source alternative for multi-factor authentication- privacyIDEA.md @@ -0,0 +1,85 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Open source alternative for multi-factor authentication: privacyIDEA) +[#]: via: (https://opensource.com/article/20/3/open-source-multi-factor-authentication) +[#]: author: (Cornelius Kölbel https://opensource.com/users/cornelius-k%C3%B6lbel) + +Open source alternative for multi-factor authentication: privacyIDEA +====== +As technology changes, so too will our need to adapt our authentication +mechanisms. +![Three closed doors][1] + +Two-factor authentication, or multi-factor authentication, is not a topic only for nerds anymore. Many services on the internet provide it, and many end-users demand it. While the average end-user might only realize that his preferred web site either offers MFA or it does not, there is more to it behind the scene. + +The two-factor market is changing, and changing rapidly. New authentication methods arise, classical vendors are merging, and products have disappeared. + +The end-user might not be bothered at all, but organizations and companies who want to require multi-factor authentication for their users may wonder where to turn to and which horse to bet on. + +Companies like Secure Computing, Aladdin, SafeNet, Cryptocard, Gemalto, and Thales have been providing authentication solutions for organizations for some decades and have been involved in a round dance of [mergers and acquisitions][2] during the last ten years. And the user was the one who suffered. While the IT department thought it was rolling out a reliable software of a successful vendor, a few years later, they were confronted with the product being end-of-life. + +### How the cloud changes things + +In 1986, RSA released RSA SecurID, a physical hardware token displaying magic numbers based on an unknown, proprietary algorithm. But, almost 20 years later, thanks to the Open Authentication Initiative, HOTP (RFC4226) and TOTP (RFC6238) were specified—originally for OTP hardware tokens. + +SMS Passcode, which specialized in authenticating by sending text messages, was founded in 2005; no hardware token required. While other on-premises solutions kept the authentication server and the enrollment in a confined environment, with SMS Passcode, the authentication information (a secret text message) was transported via the mobile network to the user. + +The iPhone 1 was released in 2007, and the Android phone quickly followed. DUO Security was founded in 2009 as a specific cloud MFA provider, with the smartphone acting as a second factor. Both vendors concentrated on a new second factor—the phone with a text message or the smartphone with an app—and they offered and used infrastructure that was not part of the company's network anymore. + +Classical on-premises vendors started to move to the cloud, either by offering their new services or acquiring smaller vendors with cloud solutions, such as SafeNet's [acquisition of Cryptocard in 2012][3]. It seemed tempting for classical vendors to offer cloud services—no software updates on-premises, no support cases, unlimited scaling, and unlimited revenue. + +Even the old top dog, RSA, now offers a "Cloud Authentication Service." And doesn't it make sense to put authentication services in the cloud? The data is hosted at cloud services like Azure, the identities are hosted in the cloud at Azure AD, so why not put authentication there with Azure MFA? This approach might make sense for companies with a complete cloud-centric approach, but it also probably locks you into one specific vendor. + +Cloud seems a big topic also for multi-factor authentication. But what if you want to stay on-prem? + +### The state of multi-factor authentication technology + +Multi-factor authentication has also come a long way since 1986, when RSA introduced its first OTP tokens. A few decades ago, well-paid consultants made a living by rolling PKI concepts, since smartcard authentication needed a working certificate infrastructure. + +After having OTP keyfob tokens and smartphones with HOTP and TOTP apps and even push notification, the current state-of-the-art authentication seems to be FIDO2/WebAuthn. While U2F was specified by the FIDO Alliance alone, WebAuthn was specified by no one else than W3C, and the good news is, the base requirements have been integrated into all browsers except Internet Explorer. + +However, applications still need to add a lot of code when supporting Webauthn. But WebAuthn allows for new authentication devices like TPM chips in tablets, computers, and smartphones or cheap and small hardware devices. But U2F also looked good back then, and even it did not make the breakthrough. Will WebAuthn do it? + +So these are challenging times since currently, you probably cannot use WebAuthn, but in two years, you'll probably want to. Thus, you need a system that allows you to adapt your authentication mechanisms. + +### Getting actual requirements + +This is one of the first requirements when you are about to choose a flexible multi-factor authentication solution. It will not work out to solely rely on text messages, or on one single smartphone app or only WebAuthn tokens. The smartphone app may vanish; the WebAuthn devices might not be applicable in all situations. + +When looking at the mergers and acquisitions, we learned that it did happen and can happen again; that the software goes end-of-life, or the vendors cease their cloud services. And sometimes it is only the last few months that hurt, when the end of sales means that you cannot buy any new user licenses or onboard any new users! To get a lasting solution, you need to be independent on cloud services and vendor decisions. The safest way to do so is to go for an open source solution. + +But when going for an open source solution, you want to get a reliable system, reliable meaning that you can be sure to get updates that do not break and that bugs will be fixed, and there are people to be asked. + +### An open source alternative: privacyIDEA + +Concentrated experiences in the two-factor market since 2004 have been incorporated into the open source software alternative: [privacyIDEA][4]. + +privacyIDEA is an open source solution providing a wide variety of different authentication technologies. It started with HOTP and TOTP tokens, but it also supports SMS, email, push notifications, SSH keys, X.509 certificates, Yubikeys, Nitrokeys, U2F, and a lot more. Currently, the support for WebAuthn is added. + +The modular structure of the token types (being Python classes) allows new types to be added quickly, making it the most flexible in regards to authentication methods. It runs on-premises at a central location in your network. This way, you stay flexible, have control over your network, and keep pace with the latest developments. + +privacyIDEA comes with a mighty and flexible policy framework that allows you to adapt privacyIDEA to your needs. The unique event handler modules enable you to fit privacyIDEA into your existing workflows or create new workflows that work the best for your scenario. It is also plays nice with the others and integrates with identity and authentication solutions like FreeRADIUS, simpleSAMLphp, Keycloak, or Shibboleth. This flexibility may be the reason organizations like the World Wide Web Consortium and companies like Axiad are using privacyIDEA. + +privacyIDEA is developed [on GitHub][5] and backed by a Germany-based company providing services and support worldwide. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/3/open-source-multi-factor-authentication + +作者:[Cornelius Kölbel][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/cornelius-k%C3%B6lbel +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/EDU_UnspokenBlockers_1110_A.png?itok=x8A9mqVA (Three closed doors) +[2]: https://netknights.it/en/consolidation-of-the-market-and-migrations/ +[3]: https://www.infosecurity-magazine.com/news/safenet-acquires-cryptocard/ +[4]: https://privacyidea.org +[5]: https://github.com/privacyidea/privacyidea diff --git a/sources/tech/20200314 Adding a display to a travel-ready Raspberry Pi Zero.md b/sources/tech/20200314 Adding a display to a travel-ready Raspberry Pi Zero.md new file mode 100644 index 0000000000..f8dcb26208 --- /dev/null +++ b/sources/tech/20200314 Adding a display to a travel-ready Raspberry Pi Zero.md @@ -0,0 +1,281 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Adding a display to a travel-ready Raspberry Pi Zero) +[#]: via: (https://opensource.com/article/20/3/pi-zero-display) +[#]: author: (Peter Garner https://opensource.com/users/petergarner) + +Adding a display to a travel-ready Raspberry Pi Zero +====== +A small eInk display turns a Raspberry Pi into a self-contained, +pocket-sized travel computer. +![Pi Zero][1] + +In my earlier article, I explained how I [transformed a Raspberry Pi Zero][2] into a minimal, portable, go-anywhere computer system that, although small, can actually achieve useful things. I've since made iterations that have proved interesting and made the little Pi even more useful. Read on to learn what I've done. + +### After the road trip + +My initial Pi Zero setup [proved its worth][3] on a road trip to Whitby, but afterward, it was largely consigned to the "pending" shelf, waiting for another assignment. It was powered up weekly to apply updates, but other than that, it was idle. Then one day, as I was flicking through emails from various Pi suppliers, I came across a (slightly) reduced e-Ink display offer: hmmm… and there was a version for the Pi Zero as well. What could I do with one? + +ModMyPi was selling a rather neat [display and driver board combination][4] and a [small case][5] with a transparent window on top. I read the usual reviews, and apart from one comment about the _boards being a very tight fit_, it sounded positive. I ordered it, and it turned up a few days later. I had noted from the product description that the display board didn't have GPIO headers installed, so I ordered a Pi Zero WH (wireless + headers pre-installed) to save me the bother of soldering one on. + +### Some assembly required + +As with most of these things, some self-assembly was required, so I carefully opened the boxes and laid out the parts on the desk. The case was nicely made apart from ridiculous slots for a watch strap (?!) and some strange holes in the side to allow tiny fingers to press the five I/O buttons on the display. "_Could I get a top without holes?"_ I inquired on the review page. "_No."_ Okay then. + +With the case unpacked, it was time to open the display box. A nicely designed board was first out, and there were clear instructions on the Pi-Supply website. The display was so thin (0.95mm) that I nearly threw it out with the bubble wrap. + +The first job was to mount the display board on the Pi Zero. I checked to make sure I could attach the display cable to the driver board when it was joined to the Pi and decided that, with my sausage fingers, I'd attach the display first and leave it flapping in the breeze while I attached the driver board to the Pi. I carefully got the boards lined up on the GPIO pins, and, with those in place, I folded over the display "screen" to sit on top of the board. With the piggy-backed boards in place, I then _verrrry_ carefully shoe-horned the assembly into place in the case. Tight fit? Yeah, you're not kidding, but I got it all safely in place and snapped the top on, and nothing appeared to be broken. Phew! + +### How to set up your display + +I'm going to skip a chunk of messing about here and refer you to the maker's [instructions][6] instead. Suffice to say that after a few installs, reboots, and coffees, I managed to get a working e-Ink display! Now all I had to do was figure out what to do with it. + +One of the main challenges of working with a small device like [my "TravelPi"][2] is that you don't have access to as much screen real estate as you would on a larger machine. I like the size and power of the device though, so it's really a compromise as to what you get out of it. For example, there's a single screen accessible via the HDMI port, and I've used tmux to split that into four separate, usable panes. If I really need to view something else urgently, I could always **Ctrl+Z** into another prompt and do the necessary configs, but that's messy. + +I wanted to see various settings and maybe look at some system settings, and the e-Ink display enabled me to do all that! As you can see from the image below, I ended up with a very usable info panel that is updated by a simple(-ish) Python script (**qv**) either manually or by a crontab entry every 10 minutes. The manufacturer states that the update frequency should be "no more than 1Hz if you want your display to last for a long time." Ten minutes is fine, thank you. + +Here's what I wanted to be able to see at a glance: + +Hostname | And device serial number +---|--- +IP address | Current internal IP address +VPN status | Inactive/country/IP address +Tor status | Inactive/IP address +"Usage" | Percentage disk space and memory used +Uptime | So satisfying to see those long uptimes + +And here it is: a display that's the same size as the Pi Zero and 1" deep. + +![PiZero Display][7] + +### How to populate the display + +Now I needed to populate the display. As seems to be the norm these days, the e-Ink support software is in Python, which, of course, is installed as standard with most Linux distros. _Disclaimer:_ Python is not my first (dev) language, but the code below works for me. It'll probably work for you, too. + + +``` +#!/usr/bin/env python + +import os +import sys +import time +import datetime +import socket +import netifaces as ni +import psutil +import subprocess + +from netifaces import AF_INET, AF_INET6, AF_LINK, AF_PACKET +from papirus import PapirusText, PapirusTextPos, Papirus +from subprocess import check_output +from datetime import timedelta + +rot     = 0 +screen  = Papirus(rotation = rot) +fbold   = '/usr/share/fonts/truetype/dejavu/DejaVuSansMono-Bold.ttf' +fnorm   = '/usr/share/fonts/truetype/dejavu/DejaVuSansMono.ttf' +text    = PapirusTextPos(rotation = rot) + +def GetBootTime(): +        return datetime.datetime.fromtimestamp(psutil.boot_time()) + +def GetUptime(): +     with open('/proc/uptime','r') as f: +       uptime_seconds = float(f.readline().split()[0]) +     u = str(timedelta(seconds = uptime_seconds)) +     duration,junk = u.split(".") +     hr,mi,sc = duration.split(":") +     return "%sh %sm %ss" % ( hr,mi,sc ) + +def getHostname(): +        hostname = socket.gethostname() +        return hostname + +def getWiFiIPaddress(): +        try: +                ni.interfaces() +                [ 'wlan0', ] +                return ni.ifaddresses('wlan0')[AF_INET][0]['addr'] +        except: +                return 'inactive' + +def getVPNIPaddress(): +        try: +                ni.interfaces() +                [ 'tun0', ] +                return ni.ifaddresses('tun0')[AF_INET][0]['addr'] +        except: +                return 'inactive' + +def GetTmuxEnv(): +        if 'TMUX_PANE' in os.environ: +                return ' (t)' +        return ' ' + +def GetCPUserial(): +        cpuinfo = subprocess.check_output(["/bin/cat", "/proc/cpuinfo"]) +        cpuinfo = cpuinfo.replace("\t","") +        cpuinfo = cpuinfo.split("\n") +        [ legend, cpuserial ] = cpuinfo[12].split(' ') +        cpuserial = cpuserial.lstrip("0") +        return cpuserial + +def GetMemUsed(): +        memUsed = psutil.virtual_memory()[2] +        return memUsed + +def GetDiskUsed(): +        diskUsed = psutil.disk_usage('/')[3] +        return diskUsed + +def CheckTor(): +        try: +                TS = "active: pid %s" %check_output(['pidof','tor'])    +        except: +                TS = 'inactive' +        return TS       + +def CheckVPN(): +        return VPNlo +# --------------------------------------------------------------------------- +def main(): +        pass + +if __name__ == '__main__': +        main() + +VPNlo = 'inactive' + +if (len(sys.argv) == 2): +        try: +                VPNlo = sys.argv[1] +        except: +                VPNlo = 'inactive' + +text = PapirusTextPos(False,rotation=rot) +text.AddText("%s %s %s"% (getHostname(),GetCPUserial(),GetTmuxEnv()),x=1,y=0,size=12,invert=True,fontPath=fbold) +text.AddText("IP  %s" % getWiFiIPaddress(),x=1,y=16,size=12,fontPath=fnorm) +if ( getVPNIPaddress() == 'inactive' ): +        text.AddText("VPN %s" % CheckVPN(),x=1,y=30,size=12,fontPath=fnorm) +else: +        text.AddText("VPN %s" % getVPNIPaddress(),x=1,y=30,size=12,fontPath=fnorm) +text.AddText("TOR %s" % CheckTor(),x=1,y=44,size=12,fontPath=fnorm) +text.AddText("MEM %s% DISK %s% used" % (GetMemUsed(),GetDiskUsed()),x=1,y=58,size=12,fontPath=fnorm,maxLines=1) +text.AddText("UPTIME %s" % GetUptime(),x=1,y=72,size=12,fontPath=fnorm) +text.WriteAll() + +sys.exit(0) +``` + +Normally, the script runs without any arguments and is called by a series of Bash scripts that I've written to start up various subsystems; these are, in turn, called from a menu system written in Whiptail, which is pretty versatile. In the case of the VPN system, I have a list of access points to choose from and that update the location on the display. Initially, I call the display updater with the location name (e.g., Honolulu), but at that point, I can't display the VPN IP address because I don't know it: + + +``` +   dispupdate.py ${accesspoint} +   openvpn --config $PATH/Privacy-${accesspoint}.conf --auth-user-pass credfile +``` + +When the display updater runs again (outside the VPN startup script), the IP address is readable from the **tun0** interface and the display is updated with the IP address. I may change this later, but it works fine now. I use the **PapirusTextPos** function (rather than **PapirusText**), as this allows multiple lines to be written before the display is updated, leading to a much faster write. The **text.WriteAll()** function does the actual update. + +### Adding more software + +I was very pleased with my initial choice of applications, but since I'd managed to slim the whole installation down to 1.7GB, I had plenty of available space. So, I decided to see if there was anything else that could be useful. Here's what I added: + +Irssi | IRC client +---|--- +FreeBSD games | There are still many text-mode games to enjoy +nmon | A _very_ comprehensive top-alike utility for all aspects of the system +Newsbeuter | Text-mode Atom/RSS feed reader + +And I still have about 300MB free space to take me up to 2GB, so I may add more. + +### We keed to talk about ~~Kevin~~ Bluetooth + +Observant readers will remember my hatred for Bluetooth and trying to pair terminal-based software with a Bluetooth device. When I bought a new Pi, I realized that I had to pair the damn thing up with the keyboards again. Oh, woe is me! But a search-engine session and a calming coffee enabled me to actually do it! It goes something like this: + + +``` +sudo su +bluetoothctl {enter} + +[bluetooth]# + +[bluetooth]# scan on +Discovery started +[CHG] Controller B8:27:EB:XX:XX:XX Discovering: yes + +[bluetooth]# agent on +Agent registered +[NEW] Device B2:2B:XX:XX:XX:XX Bluetooth Keyboard +Attempting to pair with B2:2B:XX:XX:XX:XX +[CHG] Device B2:2B:XX:XX:XX:XX Connected: yes +[agent] PIN code: 834652 +[CHG] Device B2:2B:XX:XX:XX:XX Modalias: usb:v05ACp0220d0001 +[CHG] Device B2:2B:XX:XX:XX:XX UUIDs: zzzzz +[CHG] Device B2:2B:XX:XX:XX:XX UUIDs: yyyyy +[CHG] Device B2:2B:XX:XX:XX:XX ServicesResolved: yes +[CHG] Device B2:2B:XX:XX:XX:XX Paired: yes +Pairing successful +[CHG] Device B2:2B:XX:XX:XX:XX ServicesResolved: no +[CHG] Device B2:2B:XX:XX:XX:XX Connected: no + +[bluetooth]# trust B2:2B:XX:XX:XX:XX +[CHG] Device B2:2B:XX:XX:XX:XX Trusted: yes +Changing B2:2B:XX:XX:XX:XX trust succeeded +[CHG] Device B2:2B:XX:XX:XX:XX RSSI: -53 + +[bluetooth]# scan off +[CHG] Device B2:2B:XX:XX:XX:XX RSSI is nil +Discovery stopped +[CHG] Controller B8:27:EB:XX:XX:XX Discovering: no + +[bluetooth]# exit +Agent unregistered + +$ +``` + +I was gobsmacked! No, really. I paired my other keyboard and am now considering pairing a speaker, but we'll see. I had a beer that night to celebrate my new-found "l33t" tech skills! Here is an [excellent guide][8] on how to do it. + +### One more hardware mod + +Until recently, I've been using as large a good-quality microSDHC card as I could afford, and in case of problems, I created a backup copy using the rsync-based rpi-clone. However, after reading various articles on the 'net where people complain about corrupted cards due to power problems, unclean shutdowns, and other mishaps, I decided to invest in a higher-quality card that hopefully will survive all this and more. This is important if you're traveling long distances and _really_ need your software to work at the destination. + +After a long search, I found the [ATP Industrial-Grade MicroSD/MicroSDHC][9] cards, which are rated military-spec for demanding applications. That sounded perfect. However, with quality comes a cost, as well as (in this case) limited capacity. In order to keep my wallet happy, I limited myself to an 8GB card, which may not sound like a lot for a working computer, but bearing in mind I have a genuine 5.3GB of that 8GB free, it works just fine. I also have a level of reassurance that bigger but lower-quality cards can't give me, and I can create an ISO of that card that's small enough to email if need be. Result! + +### What's next? + +The Zero goes from strength to strength, only needing to go out more. I've gone technically about as far as I can for now, and any other changes will be small and incremental. + +* * * + +_This was originally published on [Peter Garner's blog][10] under a CC BY-NC-ND 4.0 and is reused here with the author's permission._ + +The new issue of the official Raspberry Pi magazine, The MagPi, comes with a free computer stuck to... + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/3/pi-zero-display + +作者:[Peter Garner][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/petergarner +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/zero-osdc-lead.png?itok=bK70ON2W (Pi Zero) +[2]: https://opensource.com/article/20/3/raspberry-pi-zero-w-road +[3]: https://petergarner.net/notes/index.php?thisnote=20180511-Travels+with+a+Pi+%282%29 +[4]: https://www.modmypi.com/raspberry-pi/screens-and-displays/epaper/papirus-zero-epaper--eink-screen-phat-for-pi-zero-medium +[5]: https://www.modmypi.com/raspberry-pi/cases-183/accessories-1125/watch-straps/pi-supply-papirus-zero-case +[6]: https://github.com/PiSupply/PaPiRus +[7]: https://opensource.com/sites/default/files/uploads/pizerodisplay.jpg (PiZero Display) +[8]: https://www.sigmdel.ca/michel/ha/rpi/bluetooth_01_en.html +[9]: https://www.digikey.com/en/product-highlight/a/atp/industrial-grade-microsd-microsdhc-cards +[10]: https://petergarner.net/notes/index.php?thisnote=20190205-Travels+with+a+Pi+%283%29 diff --git a/sources/tech/20200315 Getting started with shaders- signed distance functions.md b/sources/tech/20200315 Getting started with shaders- signed distance functions.md new file mode 100644 index 0000000000..acba8687fd --- /dev/null +++ b/sources/tech/20200315 Getting started with shaders- signed distance functions.md @@ -0,0 +1,243 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Getting started with shaders: signed distance functions!) +[#]: via: (https://jvns.ca/blog/2020/03/15/writing-shaders-with-signed-distance-functions/) +[#]: author: (Julia Evans https://jvns.ca/) + +Getting started with shaders: signed distance functions! +====== + +Hello! A while back I learned how to make fun shiny spinny things like this using shaders: + +![][1] + +My shader skills are still extremely basic, but this fun spinning thing turned out to be a lot easier to make than I thought it would be to make (with a lot of copying of code snippets from other people!). + +The big idea I learned when doing this was something called “signed distance functions”, which I learned about from a very fun tutorial called [Signed Distance Function tutorial: box & balloon][2]. + +In this post I’ll go through the steps I used to learn to write a simple shader and try to convince you that shaders are not that hard to get started with! + +### examples of more advanced shaders + +If you haven’t seen people do really fancy things with shaders, here are a couple: + + 1. this very complicated shader that is like a realistic video of a river: + 2. a more abstract (and shorter!) fun shader with a lot of glowing circles: + + + +### step 1: my first shader + +I knew that you could make shaders on shadertoy, and so I went to . They give you a default shader to start with that looks like this: + +![][3] + +Here’s the code: + +``` +void mainImage( out vec4 fragColor, in vec2 fragCoord ) +{ + // Normalized pixel coordinates (from 0 to 1) + vec2 uv = fragCoord/iResolution.xy; + + // Time varying pixel color + vec3 col = 0.5 + 0.5*cos(iTime+uv.xyx+vec3(0,2,4)); + + // Output to screen + fragColor = vec4(col,1.0); +} +``` + +This doesn’t do anythign that exciting, but it already taught me the basic structure of a shader program! + +### the idea: map a pair of coordinates (and time) to a colour + +The idea here is that you get a pair of coordinates as an input (`fragCoord`) and you need to output a RGBA vector with the colour of that. The function can also use the current time (`iTime`), which is how the picture changes over time. + +The neat thing about this programming model (where you map a pair of coordinates and the time to) is that it’s extremely trivially parallelizable. I don’t understand a lot about GPUs but my understanding is that this kind of task (where you have 10000 trivially parallelizable calculations to do at once) is exactly the kind of thing GPUs are good at. + +### step 2: iterate faster with `shadertoy-render` + +After a while of playing with shadertoy, I got tired of having to click “recompile” on the Shadertoy website every time I saved my shader. + +I found a command line tool that will watch a file and update the animation in real time every time I save called [shadertoy-render][4]. So now I can just run: + +``` +shadertoy-render.py circle.glsl +``` + +and iterate way faster! + +### step 3: draw a circle + +Next I thought – I’m good at math! I can use some basic trigonometry to draw a bouncing rainbow circle! + +I know the equation for a circle (`x**2 + y**2 = whatever`!), so I wrote some code to do that: + +![][5] + +Here’s the code: (which you can also [see on shadertoy][6]) + +``` +void mainImage( out vec4 fragColor, in vec2 fragCoord ) +{ + // Normalized pixel coordinates (from 0 to 1) + vec2 uv = fragCoord/iResolution.xy; + // Draw a circle whose center depends on what time it is + vec2 shifted = uv - vec2((sin(iGlobalTime) + 1)/2, (1 + cos(iGlobalTime)) / 2); + if (dot(shifted, shifted) < 0.03) { + // Varying pixel colour + vec3 col = 0.5 + 0.5*cos(iGlobalTime+uv.xyx+vec3(0,2,4)); + fragColor = vec4(col,1.0); + } else { + // make everything outside the circle black + fragColor = vec4(0,0,0,1.0); + } +} +``` + +This takes the dot product of the coordinate vector `fragCoord` with itself, which is the same as calculating `x^2 + y^2`. I played with the center of the circle a little bit in this one too – I made the center `vec2((sin(iGlobalTime) + 1)/2, (1 + cos(faster)) / 2)`, which means that the center of the circle also goes in a circle depending on what time it is. + +### shaders are a fun way to play with math! + +One thing I think is fun about this already (even though we haven’t done anything super advanced!) is that these shaders give us a fun visual way to play with math – I used `sin` and `cos` to make something go in a circle, and if you want to get some better intuition about how trigonometric work, maybe writing shaders would be a fun way to do that! + +I love that you get instant visual feedback about your math code – if you multiply something by 2, things get bigger! or smaller! or faster! or slower! or more red! + +### but how do we do something really fancy? + +This bouncing circle is nice but it’s really far from the super fancy things I’ve seen other people do with shaders. So what’s the next step? + +### idea: instead of using if statements, use signed distance functions! + +In my circle code above, I basically wrote: + +``` +if (dot(uv, uv) < 0.03) { + // code for inside the circle +} else { + // code for outside the circle +} +``` + +But the problem with this (and the reason I was feeling stuck) is that it’s not clear how it generalizes to more complicated shapes! Writing a bajillion if statements doesn’t seem like it would work well. And how do people render those 3d shapes anyway? + +So! **Signed distance functions** are a different way to define a shape. Instead of using a hardcoded if statement, instead you define a **function** that tells you, for any point in the world, how far away that point is from your shape. For example, here’s a signed distance function for a sphere. + +``` +float sdSphere( vec3 p, float center ) +{ + return length(p)-center; +} +``` + +Signed distance functions are awesome because they’re: + + * simple to define! + * easy to compose! You can take a union / intersection / difference with some simple math if you want a sphere with a chunk taken out of it. + * easy to rotate / stretch / bend! + + + +### the steps to making a spinning top + +When I started out I didn’t understand what code I needed to write to make a shiny spinning thing. It turns out that these are the basic steps: + + 1. Make a signed distance function for the shape I want (in my case an octahedron) + 2. Raytrace the signed distance function so you can display it in a 2D picture (or raymarch? The tutorial I used called it raytracing and I don’t understand the difference between raytracing and raymarching yet) + 3. Write some code to texture the surface of your shape and make it shiny + + + +I’m not going to explain signed distance functions or raytracing in detail in this post because I found this [AMAZING tutorial on signed distance functions][2] that is very friendly and honestly it does a way better job than I could do. It explains how to do the 3 steps above and the code has a ton of comments and it’s great. + + * The tutorial is called “SDF Tutorial: box & balloon” and it’s here: + * Here are tons of signed distance functions that you can copy and paste into your code (and ways to compose them to make other shapes) + + + +### step 4: copy the tutorial code and start changing things + +Here I used the time honoured programming practice here of “copy the code and change things in a chaotic way until I get the result I want”. + +My final shader of a bunch of shiny spinny things is here: + +The animation comes out looking like this: + +![][7] + +Basically to make this I just copied the tutorial on signed distance functions that renders the shape based on the signed distance function and: + + * changed `sdfBalloon` to `sdfOctahedron` and made the octahedron spin instead of staying still in my signed distance function + * changed the `doBalloonColor` colouring function to make it shiny + * made there be lots of octahedrons instead of just one + + + +### making the octahedron spin! + +Here’s some the I used to make the octahedron spin! This turned out to be really simple: first copied an octahedron signed distance function from [this page][8] and then added a `rotate` to make it rotate based on time and then suddenly it’s spinning! + +``` +vec2 sdfOctahedron( vec3 currentRayPosition, vec3 offset ){ + vec3 p = rotate((currentRayPosition), offset.xy, iTime * 3.0) - offset; + float s = 0.1; // what is s? + p = abs(p); + float distance = (p.x+p.y+p.z-s)*0.57735027; + float id = 1.0; + return vec2( distance, id ); +} +``` + +### making it shiny with some noise + +The other thing I wanted to do was to make my shape look sparkly/shiny. I used a noise funciton that I found in [this github gist][9] to make the surface look textured. + +Here’s how I used the noise function. Basically I just changed parameters to the noise function mostly at random (multiply by 2? 3? 1800? who knows!) until I got an effect I liked. + +``` +float x = noise(rotate(positionOfHit, vec2(0, 0), iGlobalTime * 3.0).xy * 1800.0); +float x2 = noise(lightDirection.xy * 400.0); +float y = min(max(x, 0.0), 1.0); +float y2 = min(max(x2, 0.0), 1.0) ; +vec3 balloonColor = vec3(y , y + y2, y + y2); +``` + +### writing shaders is fun! + +That’s all! I had a lot of fun making this thing spin and be shiny. If you also want to make fun animations with shaders, I hope this helps you make your cool thing! + +As usual with subjects I don’t know tha well, I’ve probably said at least one wrong thing about shaders in this post, let me know what it is! + +Again, here are the 2 resources I used: + + 1. “SDF Tutorial: box & balloon”: (which is really fun to modify and play around with) + 2. Tons of signed distance functions that you can copy and paste into your code + + + +-------------------------------------------------------------------------------- + +via: https://jvns.ca/blog/2020/03/15/writing-shaders-with-signed-distance-functions/ + +作者:[Julia Evans][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://jvns.ca/ +[b]: https://github.com/lujun9972 +[1]: https://jvns.ca/images/spinny.gif +[2]: https://www.shadertoy.com/view/Xl2XWt +[3]: https://jvns.ca/images/colour.gif +[4]: https://github.com/alexjc/shadertoy-render +[5]: https://jvns.ca/images/circle.gif +[6]: https://www.shadertoy.com/view/tsscR4 +[7]: https://jvns.ca/images/octahedron2.gif +[8]: http://www.iquilezles.org/www/articles/distfunctions/distfunctions.htm +[9]: https://gist.github.com/patriciogonzalezvivo/670c22f3966e662d2f83 diff --git a/sources/tech/20200315 How I migrated from a Mac Mini to a Raspberry Pi.md b/sources/tech/20200315 How I migrated from a Mac Mini to a Raspberry Pi.md new file mode 100644 index 0000000000..0e1c7196fa --- /dev/null +++ b/sources/tech/20200315 How I migrated from a Mac Mini to a Raspberry Pi.md @@ -0,0 +1,184 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How I migrated from a Mac Mini to a Raspberry Pi) +[#]: via: (https://opensource.com/article/20/3/mac-raspberry-pi) +[#]: author: (Peter Garner https://opensource.com/users/petergarner) + +How I migrated from a Mac Mini to a Raspberry Pi +====== +Learn more about Linux by turning a Raspberry Pi Model 2 into a workable +desktop computer. +![Vector, generic Raspberry Pi board][1] + +Some time ago, I decided to move my computing environment from a Mac Mini PowerPC to a Raspberry Pi Model 2. This article describes my reasons for doing so and how I did it. While it is quite technical in places, if you're considering switching from an existing system to something decidedly lean and mean, there are things that you need to know before making that leap. There are lots of links to click as well, which will lead you to the software and apps that I mention. + +Enjoy! + +## Saying goodbye to the Mac + +I have to admit, I've never really been an Apple fanboi, especially following a short (and ultimately unsatisfactory) fling with a plastic polycarbonate MacBook back in 2006. Although it was beautifully designed, and the software "Just Worked," I was understandably upset when it decided to expire shortly after the warranty period expired (design faults, apparently). Ah well. + +I swore never to "invest" in an Apple machine again—until I discovered a used Mac Mini PowerPC on eBay that could be had for around $100 in 2012. It was new back in 2005 but had apparently been refurbished. "What have I got to lose, especially at that price?" I asked myself. Nobody answered, so I placed a last-minute bid, won it, and invested about the same sum of money again in bumping the memory up to 1GB and buying the OS on DVD. The OS X version was 10.4.7 Tiger, and the architecture was Power PC. It was sedate but reliable, and I was happy. It didn't take a lot of power either; some 60 watts at full load, so that was a bonus. I spent many happy hours tinkering with it and trying to find software that was supported on a device that old. + +Predictably though, as my computing requirements grew and the Mac got older, it started to get noticeably slower, and I was aware that even simple tasks—such as asking it to run a web browser and display an HTTPS page—were causing it problems. When I finally managed to find antivirus software for it, I became aware of just how noisy the Mini's cooling fan was as the CPU struggled with the extra load. + +A quick check of the performance monitors revealed thousands of memory-paging faults, and I realized that my old friend was soon destined for the knackers yard. Of course, that meant searching for a replacement, and that's when the fun started. + +## A(nother) small computer + +My main problem was that I didn't have a big budget. I looked at eBay again and found a number of Mac Minis for sale, all around the $500 mark, and many of those were early basic-spec Intel units that, like my old Mac, people had simply grown out of. Essentially, I wanted something like the old Mini, ideally with similar power consumption. A new one was out of the question, obviously. + +Let me state that my computer requirements are pretty undemanding, and for photo/graphics work, I have another computer that consumes power like there's no tomorrow and gives off enough heat to keep me warm in winter. And then I got to thinking about the [Raspberry Pi Model 2][2]. Now before you laugh, I have around six of the things running various servers, and they do just fine. One runs a small web server, another runs a mail server, and so on. Each one costs around $30, and most use a cheap microSDHC card, so if one fails, I can easily swap it out for another, and I can usually buy a suitable card at a local supermarket—try doing that when your laptop drive fails! I also have a Netgear ReadyNAS 102 with a couple of 2TB hard drives to act as my bulk storage. + +Suddenly, my plan looked as though it might be viable after all! + +## Spec'ing it out + +The specification was a bit of a no-brainer: The Model 2 Pi comes with 1GB of memory standard, the Ethernet runs at 100Mbps maximum, the clock speed is 900MHz, there are four USB ports, and that's yer lot, mate. You can overclock it, but I've never wanted to try this for various reasons. + +I had a Pi in my spares drawer, so no problem there. I ordered a posh aluminum case made by [Flirc][3] that was on offer for $20 and duly slotted in the Pi. The power supply unit (PSU) had to be a genuine two-amp device, and again, I had a spare lying around. If you take your Pi ownership seriously, I recommend the [Anker 40W][4] five-port desktop charger: it has intelligent power management, and I'm running five Pis from one unit. Incidentally, if you inadvertently use a PSU that can't deliver the required current, you'll keep seeing a square, multi-colored icon in the top-right corner of your screen, so be warned. + +The microSDHC "disk" was more of an issue, though. I always use SanDisk, and this time I wanted something fast, especially as this was to be a "desktop" machine. In the end, I went for a [SanDisk 8GB Extreme Pro UHS-1][5] card that promised up to 90 to 95 Mbps write/read performance. "8GB? That's not a lot of space," I hear you Windows users cry, and because this is Linux, there doesn't need to be. + +The way I envisioned it, I'd set up the Pi normally and use it primarily as a boot disk. I'd host all my documents and media files on the network-attached storage (NAS) box, and all would be well. The NAS shares would be accessed via network filesystem (NFS), and I'd just mount them as directories on the Pi. + +Quite early on, I elected to move my entire home directory onto the NAS, and this has worked well, with some quirks. The problem I faced was a Pi quirk, and although I was sure there was a fix, I wanted to get it up and running before the Mac finally crapped out. When the Pi boots, it seems to enable the networking part quite late in the sequence, and I found that I couldn't do my NFS mounts because the networking interface hadn't come up yet. Rather than hack around with tricky scripts, I decided to simply mount the NFS shares by hand after I'd logged in after a successful boot. This seemed to work, and it's the solution I'm using now. Now that I had a basic strategy, it was time to implement it on the "live" machine. + +That's the beauty of working with the Raspberry Pi—you can quickly hack together a testbed and have a system up and running in under 30 minutes. + +Regarding video, I bought an HDMI-to-DVI cable to use with my Dell monitor, and in GUI desktop mode, this comes up as 1280x1024—plenty good enough for my use. If you have a monster flat-screen TV, you can always use that instead. + +## My software environment + +### Operating system + +I ultimately decided on [Arch Linux for ARM][6] 7H as the operating system. I'm a [Raspbian][7] veteran, but I didn't need the educational software that comes with it (I have other Pis for that). Arch provides a minimal environment but is full-featured, well-supported, and powerful; it also has bucket-loads of software available. After its initial installation, I'd used just over 1.2GB of space, and even now, with all my software on the microSDHC, I'm only using 2.8GB of my 8GB card. Please note that the Pi 2 is officially Arch Linux ARM 7, not 6. + +### Desktop + +I wanted a graphical desktop environment (even though I'm a command-line sorta guy), but it needed to be in keeping with the lean and mean ethos. I'd used [LXDE][8] before and was happy with it, so I installed it; GNOME and KDE were just too big. + +### Web browser + +The web browser was a bit of a problem, but after trying the default Midori, Epiphany, and a couple of others, I decided on [Firefox][9]. It's a bit flabby, but it follows standards well, and if you're going to digitally sign LibreOffice ODT documents, you'll need it anyway. One problem on a machine of this power is the tremendous toll that web-based ads place on the overall memory usage. In fact, a badly ad'ed page can make the browser stop completely, so I had to make those ads disappear. One way would be to install an ad-blocker plugin, but that's another hit on available memory, so a simpler method was called for. + +As this is a Linux box, I simply downloaded an [ad-blocking hosts file][10]. This is an amazing piece of community work that consists of over 15,000 hostnames for basically any server that spits out ads. All the entries point to an IP address of 0.0.0.0, so there's no time wasted and your bandwidth's your own again. It's a free download and can be added to the end of an existing hosts file. Of course, the major value, as far as I'm concerned, is that page load times are much quicker. + +The screen capture below shows an ad-free Firefox overlaid with the same page in [ELinks][11]. + +![Firefox and eLinks browsers on Raspberry Pi][12] + +No ads in either, but if you don't need all the eye candy rendered by Firefox, ELinks will provide a super-clean experience. (Normally, all that whitespace in the Firefox image is filled with ads.) The ELinks browser is an interesting hybrid browser that is primarily text-based and is similar to the classic pure-text Lynx browser. + +### Messaging + +It would be overkill, and undesirable from a security point of view, to have Microsoft Skype on the Pi, so I decided on a Jabber/XMPP client, [Psi][13]. Psi has the advantage of not having a multitude of dependencies, and it also works really well. It's easy to take part in multi-user chats, and I have another Pi hosting a Jabber server to test it on. There's no character-mode version, unfortunately, and most of the text-based clients I tried had problems, so it's a GUI-only situation at the moment. No matter; it works well and doesn't use a lot of resources. + +### Email + +I also tried a number of email applications: this was easily the most important application. Eventually, I chose [Claws Mail][14]. Sadly, it doesn't do HTML mail, but it's rock-solid reliable. I have to say that I can't get the GNU Privacy Guard (GPG) plugin working properly yet due to some unresolved version issues, but I can always encrypt messages in a terminal, if need be. + +### Audio + +Music is important to me, and I chose [SMPlayer][15] as my media player. It supports many options, including playlists for local and networked files and internet radio streaming. It does the job well. + +### Video + +I'll not go into the video player in any great detail. Bearing in mind the hardware specs of the Pi, reliably playing back a video stream, even on the same network, was problematic. I decided that if I wanted to watch videos, I had other devices more suited to it. I did try and experiment with the **gpu_mem** setting in the **[/boot/config.txt][16]**, switching it from the default 64MB to 96MB. I was prepared to borrow a bit of application memory for the video player, but even that didn't seem to make it work well. In the end, I kept that setting so that the desktop environment would run more smoothly, and so far, I haven't had problems. The irony of this is that I have another Pi that has a [DLNA][17] server installed, and this can stream video exceedingly well—not just to one client, but several. In its defense, though, it doesn't have a desktop environment to contend with. So, for now, I don't bother trying to play video. + +### Image processing + +I need to do simple, lightweight photo and image editing, and I knew from prior experience that GIMP and similar packages would bring the Pi to its knees. I found an app called [Pinta][18], which resembles an enhanced Microsoft Paint, but with more cojones. As someone with a large image collection, I also needed a slideshow application. After much evaluation, I decided on [feh][19]. Normally run from a terminal within the GUI desktop, it has an incredible array of options that can help you produce an image slideshow, and again, it has low memory requirements. + +### Office suite + +And then there was an office suite. On the old Mac Mini, I was happily (and legally) running a copy of Microsoft Mac Office 2004, and I was truly sorry to lose that. I just needed a Microsoft Word and Excel equivalent, but I had to bear in mind the Pi's limitations. Sure, there are standalone versions of word-processor and spreadsheet applications, but there was nothing that really gave me confidence that I could edit a full-featured document. + +I already knew of [LibreOffice][20], but I had my doubts about it because of its Java Runtime Environment (JRE) requirement, or so I thought. Thankfully, JRE was optional, and as long as I didn't want to use (database) connection pooling of macros, there was no need to enable it. I also used as many built-in options as possible, rejecting skins and themes; this brought the overall memory footprint down to a reasonable level, and hey, I'm writing this on LibreOffice Writer now! I adopted the attitude that if it has a built-in theme, use it! + +Here's the current [memory overview][21] (in MB) from within the GUI desktop: + +![Raspberry Pi GUI memory usage][22] + +### Miscellaneous + +Other desktop software I've installed (not much as I wanted in order to keep this a minimal installation) is: + + * [FileZilla][23]: SFTP/FTP client + * [PuTTY][24]: SSH/telnet terminal frontend + * [Mousepad][25]: A versatile plain-text editor, similar to Wordpad or Notepad, but much more powerful **[Note: this link was broken. Is this ok?]** + + + +Overall, the entire setup works as intended. I've found that it performs well, if a little slow sometimes, but this is to be expected, as it's running on a Raspberry Pi with a 900MHz clock speed and 1GB of memory. As long you're aware of and prepared to accept the limitations, you can have a cheap, very functional system that doesn't take up all your desk space. + +## Lacking in characters + +Life with a Pi desktop is not all about the GUI; it's a very competent command-line environment too, should you need one. As a Linux developer and geek, I am very comfortable in a character-mode environment, and this is where the Pi really comes into its own. The performance you can expect in the command-line environment, at least in my configuration, is dependent on a number of factors. I'm limited to a certain extent by the Pi's network-interface speed and the overall performance of my Netgear ReadyNAS 102, another slightly underpowered, consumer-grade ARM box. The one thing that did please me, though, was the noticeable increase in speed over the Mac Mini! + +Running in a native terminal environment, this is the typical memory usage (in MB) you might expect: + +![Raspberry Pi terminal memory usage][26] + +One thing to note is the lack of a swap partition. It's generally accepted that any type of swap system on a Raspberry Pi is a Very Bad Thing™ and will wear out your SD card in no time. I considered setting up a swap partition on the NAS box, but I ruled this out early on, as it would very negatively impact the network as a whole, and as with the NFS mount issue, the swap partition would need to be mounted before the network came up. So no go. + +Having lived with Raspberry Pis for some time now, let's just say that one has to learn to set things up carefully in the first place to avoid the need, and ultimately, it can teach you to manage computers better. + +As part of my efforts to make the Pi as useful as possible, I had to envision a scenario where whatever I was working on was either so resource-hungry that I couldn't run a GUI desktop or the GUI was just not required. That meant reproducing as many of the desktop-only apps in a character-mode environment. In fact, this was easier than finding the equivalent desktop apps. + +Here is my current lineup: + + * **File manager:** [Midnight Commander][27]; if you're old enough to remember Norton Commander, you'll know what it looks like. + * **File transfer:** SSH/SFTP; normally handled by PuTTY and FileZilla on the desktop, you just use these two commands as provided. + * **Web browser:** Lynx or Links are classic character-mode browsers that significantly speed up the internet experience. + * **Music player:** Yes, you can play music in a character-mode terminal! [Mpg123][28] is the name of the app, and when it's run as **mpg123 -C**, it allows full keyboard control of all playback functions. If you want to be really cool, you can alter the way Midnight Commander handles MP3 files by editing **/etc/mc/mc.ext** and adding the code snippet below. This allows you to browse and play your music collection with ease. [code] shell/i/.mp3 +      Open=/usr/bin/mpg123 -C %f +      View=%view{ascii} /usr/lib/mc/ext.d/sound.sh view mp3 +``` + * **Office:** Don't be silly! Oh wait, though; I installed the character-mode spreadsheet app called **sc** (Supercalc?), and there's always Vi if you want to edit a text document, but don't expect to able to edit any Microsoft files. If your need is truly great, you can install a supplementary application called Antiword, which will let you view a .doc file. + * **Email:** A bit of a problem, as the Claws Mail mailbox format is not directly compatible with my character-mode app of choice, Mutt. There's a workaround, but I'm only going to do it if I get some spare time. For sending quick emails, I installed ssmtp, which is described as "a send-only sendmail emulator for machines which normally pick their mail up from a centralized mail hub." The setup is minimal, and overhead is practically nil, as normally it's invoked only when mail is being sent. So, you can do things like typing **echo "The donuts are on my desk" | mail -s"Important News" [everybody@myoffice.com][29]** from the command line without firing up a GUI mail app. + + + +For everything else, it's just a question of flipping back to the GUI desktop. Speaking of which… + +![Raspberry Pi GUI desktop environment][30] + +Quite a busy screen, but the Raspberry Pi handles it well. Here, I'm using LibreOffice to write this article, there's a network status box, Firefox is on the mpg123 website, and there's a terminal running top showing how much memory (isn't) being used. The drop-down menu on the left shows the office suite apps. + +## Other scenarios and thoughts + +### What's where + +With any hybrid system like this, it's important to remember what is located where so that, in the event of any problems, recovery will be easier. In my current configuration, the microSDHC card contains only the operating system, and as much as possible, any system-configuration files are also on there. Your own userland data will be on the NAS in your home directory. Ideally, you should be to replace or update the software on the microSDHC without having any adverse effects on your computing environment as a whole, but in IT, it's never that straightforward. + +In the X11 GUI desktop system, although there is a default config file in **/etc/X11**, you will invariably have a customized version containing your own preferences. (This is by design.) Your own file on the NAS, however, will reference files on the microSDHC: + +![Location of files][31] + +The overall effect is that if you change one environment for another, you will invariably experience a change (or loss) in functionality. Hopefully, the changes will be minor, but you do need to be aware of the sometimes ambiguous links. + +Please remember that the **root** user will _always_ be on the microSDHC, and if your NAS box fails for any reason, you'll still be able to boot your system and at least do some recovery work. + +### NAS alternatives + +While I'm in my home office, I have full access to my NAS box, which represents what (in today's terminology) would be a personal cloud. I much prefer this solution to a commercial cloud that is invariably managed by a company of unknown origin, location, security, and motives. For those reasons, I will always host my data where I can see it and physically get to it as required. Having said that, you may not be as paranoid as I am and will want to hook up your Pi desktop to an external cloud share. + +In that case, using an NFS mount as a basis for your home directory should mean that it's simply a matter of editing your **/etc/fstab** to point the NFS client at a different location. In my setup, the NAS box is called, er, NASBOX, and the local NFS share mountpoint is called **/NASmount**. When you create your non-root user, you'll simply move their home directory to an existing directory called **/NASmount**: +``` + + +NASBOX:/data/yourshare /NASmount nfs +nfsvers=3,rsize=8192,wsize=8192,timeo=60,intr,auto 0 0 + +mount -t nfs -v NASBOX:/data/yourshare /NASmount + +``` +and then your directory tree could look like this: +``` +`/NASmount/home/user` +``` +So, by simply changing the **/etc/fstab** entry, you could quickly be hooked up to someone else's cloud. This, as they say, is left as an exercise for the re \ No newline at end of file diff --git a/sources/tech/20200316 How to test failed authentication attempts with test-driven development.md b/sources/tech/20200316 How to test failed authentication attempts with test-driven development.md new file mode 100644 index 0000000000..abe34d97e2 --- /dev/null +++ b/sources/tech/20200316 How to test failed authentication attempts with test-driven development.md @@ -0,0 +1,288 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How to test failed authentication attempts with test-driven development) +[#]: via: (https://opensource.com/article/20/3/failed-authentication-attempts-tdd) +[#]: author: (Alex Bunardzic https://opensource.com/users/alex-bunardzic) + +How to test failed authentication attempts with test-driven development +====== +Mountebank makes it easier to test the "less happy path" in your code. +![Programming keyboard.][1] + +Testing often begins with what we hope happens. In my [previous article][2], I demonstrated how to virtualize a service you depend on when processing the "happy path" scenario (that is, testing the outcome of a successful login attempt). But we all know that software fails in spectacular and unexpected ways. Now's the time to take a closer look into how to process the "less happy paths": what happens when someone tries to log in with the wrong credentials? + +In the first article linked above, I walked through building a user authentication module. (Now is a good time to review that code and get it up and running.) This module does not do all the heavy lifting; it mostly relies on another service to do those tougher tasks—enable user registration, store the user accounts, and authenticate the users. The module will only be sending HTTP POST requests to this additional service's endpoint; in this case, **/api/v1/users/login**. + +What do you do if the service you're dependent on hasn't been built yet? This scenario creates a blockage. In the previous post, I explored how to remove that blockage by using service virtualization enabled by [mountebank][3], a powerful test environment. + +This article walks through the steps required to enable the processing of user authentication in cases when a user repeatedly attempts to log in. The third-party authentication service allows only three attempts to log in, after which it ceases to service the HTTP request arriving from the offending domain. + +### How to simulate repeat requests + +Mountebank makes it very easy to simulate a service that listens on a network port, matches the method and the path defined in the request, then handles it by sending back an HTTP response. To follow along, be sure to get mountebank running as we [did in the previous article][2]. As I explained there, these values are declared as JSONs that are posted to ****, mountebank's endpoint for processing authentication requests. + +But the challenge now is how to simulate the scenario when the HTTP request keeps hitting the same endpoint from the same domain. This is necessary to simulate a user who submits invalid credentials (username and password), is informed they are invalid, tries different credentials, and is repeatedly rejected (or foolishly attempts to log in with the same credentials that failed on previous attempts). Eventually (in this case, after a third failed attempt), the user is barred from additional tries. + +Writing executable code to simulate such a scenario would have to model very elaborate processing. However, when using mountebank, this type of simulated processing is extremely simple to accomplish. It is done by creating a rolling buffer of responses, and mountebank responds in the order the buffer was created. Here is an example of one way to simulate repeat requests in mountebank: + + +``` +{ +    "port": 3001, +    "protocol": "http", +    "name": "authentication imposter", +    "stubs": [ +        { +            "predicates": [ +                { +                    "equals": { +                        "method": "post", +                        "path": "/api/v1/users/login" +                    } +                } +            ], +            "responses": [ +                { +                    "is": { +                        "statusCode": 200, +                        "body": "Successfully logged in." +                    } +                }, +                { +                    "is": { +                        "statusCode": 400, +                        "body": "Incorrect login. You have 2 more attempts left." +                    } +                }, +                { +                    "is": { +                        "statusCode": 400, +                        "body": "Incorrect login. You have 1 more attempt left." +                    } +                }, +                { +                    "is": { +                        "statusCode": 400, +                        "body": "Incorrect login. You have no more attempts left." +                    } +                } +            ] +        } +    ] +} +``` + +The rolling buffer is simply an unlimited collection of JSON responses where each response is represented with two key-value pairs: **statusCode** and **body**. In this case, four responses are defined. The first response is the happy path (i.e., user successfully logged in), and the remaining three responses represent failed use cases (i.e., wrong credentials result in status code 400 and corresponding error messages). + +### How to test repeat requests + +Modify the tests as follows: + + +``` +using System; +using Xunit; +using app; +namespace tests +{ +    public class UnitTest1 +    { +        Authenticate auth = [new][4] Authenticate(); +        [Fact] +        public void SuccessfulLogin() +        { +            var given = "valid credentials"; +            var expected = " Successfully logged in."; +            var actual= auth.Login(given); +            Assert.Equal(expected, actual); +        } +        [Fact] +        public void FirstFailedLogin() +        { +            var given = "invalid credentials"; +            var expected = "Incorrect login. You have 2 more attempts left."; +            var actual = auth.Login(given); +            Assert.Equal(expected, actual); +        } +        [Fact] +        public void SecondFailedLogin() +        { +            var given = “invalid credentials"; +            var expected = "Incorrect login. You have 1 more attempt left."; +            var actual = auth.Login(given); +            Assert.Equal(expected, actual); +        } +        [Fact] +        public void ThirdFailedLogin() +        { +            var given = " invalid credentials"; +            var expected = "Incorrect login. You have no more attempts left."; +            var actual = auth.Login(given); +            Assert.Equal(expected, actual); +        } +    } +} +``` + +Now, run the tests to confirm that your code still works: + +![Failed test][5] + +Whoa! The tests now all fail. Why? + +If you take a closer look, you'll see a revealing pattern: + +![Reason for failed test][6] + +Notice that ThirdFailedLogin is executed first, followed by the SuccessfulLogin, followed by FirstFailedLogin, followed by SecondFailedLogin. What's going on here? Why is the third test running before the first test? + +The testing framework ([xUnit][7]) is executing all tests in parallel, and the sequence of execution is unpredictable. You need tests to run in order, which means you cannot test these scenarios using the vanilla xUnit toolkit. + +### How to run tests in the right sequence + +To force your tests to run in a certain sequence that you define (instead of running in an unpredictable order), you need to extend the vanilla xUnit toolkit with the NuGet [Xunit.Extensions.Ordering][8] package. Install the package on the command line with: + + +``` +`$ dotnet add package Xunit.Extensions.Ordering --version 1.4.5` +``` + +or add it to your **tests.csproj** config file: + + +``` +`` +``` + +Once that's taken care of, make some modifications to your **./tests/UnitTests1.cs** file. Add these four lines at the beginning of your **UnitTests1.cs **file: + + +``` +using Xunit.Extensions.Ordering; +[assembly: CollectionBehavior(DisableTestParallelization = true)] +[assembly: TestCaseOrderer("Xunit.Extensions.Ordering.TestCaseOrderer", "Xunit.Extensions.Ordering")] +[assembly: TestCollectionOrderer("Xunit.Extensions.Ordering.CollectionOrderer", "Xunit.Extensions.Ordering")] +``` + +Now you can specify the order you want your tests to run. Initially, simulate the happy path (i.e., the **SuccessfulLogin()**) by annotating the test with: + + +``` +[Fact, Order(1)] +public void SuccessfulLogin() { +``` + +After you test a successful login, test the first failed login: + + +``` +[Fact, Order(2)] +public void FirstFailedLogin() +``` + +And so on. You can add the order of the test runs by simply adding the **Order(x)** (where **x** denotes the order you want the test to run) annotation to your Fact. + +This annotation guarantees that your tests will run in the exact order you want them to run, and now you can (finally!) completely test your integration scenario. + +The final version of your test is: + + +``` +using System; +using Xunit; +using app; +using Xunit.Extensions.Ordering; +[assembly: CollectionBehavior(DisableTestParallelization = true)] +[assembly: TestCaseOrderer("Xunit.Extensions.Ordering.TestCaseOrderer", "Xunit.Extensions.Ordering")] +[assembly: TestCollectionOrderer("Xunit.Extensions.Ordering.CollectionOrderer", "Xunit.Extensions.Ordering")] +namespace tests +{ +    public class UnitTest1 +    { +        Authenticate auth = [new][4] Authenticate(); +        [Fact, Order(1)] +        public void SuccessfulLogin() +        { +            var given = "[elon_musk@tesla.com][9]"; +            var expected = "Successfully logged in."; +            var actual= auth.Login(given); +            Assert.Equal(expected, actual); +        } +        [Fact, Order(2)] +        public void FirstFailedLogin() +        { +            var given = "[mickey@tesla.com][10]"; +            var expected = "Incorrect login. You have 2 more attempts left."; +            var actual = auth.Login(given); +            Assert.Equal(expected, actual); +        } +        [Fact, Order(3)] +        public void SecondFailedLogin() +        { +            var given = "[mickey@tesla.com][10]"; +            var expected = "Incorrect login. You have 1 more attempt left."; +            var actual = auth.Login(given); +            Assert.Equal(expected, actual); +        } +        [Fact, Order(4)] +        public void ThirdFailedLogin() +        { +            var given = "[mickey@tesla.com][10]"; +            var expected = "Incorrect login. You have no more attempts left."; +            var actual = auth.Login(given); +            Assert.Equal(expected, actual); +        } +    } +} +``` + +Run the test again—everything passes! + +![Passing test][11] + +### What are you testing exactly? + +This article has focused on test-driven development (TDD), but let's review it from another methodology, Extreme Programming (XP). XP defines two types of tests: + + 1. Programmer tests + 2. Customer tests + + + +So far, in this series of articles on TDD, I have focused on the first type of tests (i.e., programmer tests). In this and the previous article, I switched my lenses to examine the most efficient ways of doing customer tests. + +The important point is that programmer (or producer) tests are focused on precision work. We often refer to these precision tests as "micro tests," while others may call them "unit tests." Customer tests, on the other hand, are more focused on a bigger picture; we sometimes refer to them as "approximation tests" or "end-to-end tests." + +### Conclusion + +This article demonstrated how to write a suite of approximation tests that integrate several discrete steps and ensure that the code can handle all edge cases, including simulating the customer experience when repeatedly attempting to log in and failing to obtain the necessary clearance. This combination of TDD and tools like xUnit and mountebank can lead to well-tested and thus more reliable application development. + +In future articles, I'll look into other usages of mountebank for writing customer (or approximation) tests. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/3/failed-authentication-attempts-tdd + +作者:[Alex Bunardzic][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/alex-bunardzic +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/programming_keyboard_coding.png?itok=E0Vvam7A (Programming keyboard.) +[2]: https://opensource.com/article/20/3/service-virtualization-test-driven-development +[3]: http://www.mbtest.org/ +[4]: http://www.google.com/search?q=new+msdn.microsoft.com +[5]: https://opensource.com/sites/default/files/uploads/testfails_0.png (Failed test) +[6]: https://opensource.com/sites/default/files/uploads/failurepattern.png (Reason for failed test) +[7]: https://xunit.net/ +[8]: https://www.nuget.org/packages/Xunit.Extensions.Ordering/# +[9]: mailto:elon_musk@tesla.com +[10]: mailto:mickey@tesla.com +[11]: https://opensource.com/sites/default/files/uploads/testpasses.png (Passing test) diff --git a/sources/tech/20200316 How to upload an OpenStack disk image to Glance.md b/sources/tech/20200316 How to upload an OpenStack disk image to Glance.md new file mode 100644 index 0000000000..82fb71244b --- /dev/null +++ b/sources/tech/20200316 How to upload an OpenStack disk image to Glance.md @@ -0,0 +1,848 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How to upload an OpenStack disk image to Glance) +[#]: via: (https://opensource.com/article/20/3/glance) +[#]: author: (Jair Patete https://opensource.com/users/jpatete) + +How to upload an OpenStack disk image to Glance +====== +Make images available to your private cloud, and more. +![blank background that says your image here][1] + +[Glance][2] is an image service that allows you to discover, provide, register, or even delete disk and/or server images. It is a fundamental part of managing images on [OpenStack][3] and [TripleO][4] (which stands for "OpenStack-On-OpenStack"). + +If you have used a recent version of the OpenStack platform, you may already have launched your first Overcloud using TripleO, as you interact with Glance when uploading the Overcloud disk images inside the Undercloud's OpenStack (i.e., the node inside your cloud that is used to install the Overcloud, add/delete nodes, and do some other handy things). + +In this article, I'll explain how to upload an image to Glance. Uploading an image to the service makes it available for the instances in your private cloud. Also, when you're deploying an Overcloud, it makes the image(s) available so the bare-metal nodes can be deployed using them. + +In an Undercloud, execute the following command: + + +``` +`$ openstack overcloud image upload --image-path /home/stack/images/` +``` + +This uploads the following Overcloud images to Glance: + + 1. overcloud-full + 2. overcloud-full-initrd + 3. overcloud-full-vmlinuz + + + +After some seconds, the images will upload successfully. Check the result by running: + + +``` +(undercloud) [stack@undercloud ~]$ openstack image list ++--------------------------------------+------------------------+--------+ +| ID                                   | Name                   | Status | ++--------------------------------------+------------------------+--------+ +| 09ca88ea-2771-459d-94a2-9f87c9c393f0 | overcloud-full         | active | +| 806b6c35-2dd5-478d-a384-217173a6e032 | overcloud-full-initrd  | active | +| b2c96922-161a-4171-829f-be73482549d5 | overcloud-full-vmlinuz | active | ++--------------------------------------+------------------------+--------+ +``` + +This is a mandatory and easy step in the process of deploying an Overcloud, and it happens within seconds, which makes it hard to see what's under the hood. But what if you want to know what is going on? + +One thing to keep in mind: Glance works using client-server communication carried through REST APIs. Therefore, you can see what is going on by using [tcpdump][5] to take some TCP packets. + +Another thing that is important: There is a database (there's always a database, right?) that is shared among all the OpenStack platform components, and it contains all the information that Glance (and other components) needs to operate. (In my case, MariaDB is the backend.) I won't get into how to access the SQL database, as I don't recommend playing around with it, but I will show what the database looks like during the upload process. (This is an entirely-for-test OpenStack installation, so there's no need to play with the database in this example.) + +### The database + +The basic flow of this example exercise is: + +_Image Created -> Image Queued -> Image Saved -> Image Active_ + +You need permission to go through this flow, so first, you must ask OpenStack's identity service, [Keystone][6], for authorization. My Keystone catalog entry looks like this; as I'm in the Undercloud, I'll hit the public endpoint: + + +``` +| keystone  | identity       | regionOne                           | +|           |                |   public: | +|           |                | regionOne                           | +|           |                |   internal: | +|           |                | regionOne                           | +|           |                |   admin:   | +``` + +And for Glance: + + +``` +| glance    | image    | regionOne                              | +|           |          |   public:    | +|           |          | regionOne                              | +|           |          |   internal:    | +|           |          | regionOne                              | +|           |          |   admin:       | +``` + +I'll hit those ports and TCP port 3306 in the capture; the latter is so I can capture what's going on with the SQL database. To capture the packets, use the tcpdump command: + + +``` +`$ tcpdump -nvs0 -i ens3 host 172.16.0.20 and port 13000 or port 3306 or port 13292` +``` + +Under the hood, this looks like: + +Authentication: + +**Initial request (discovery of API Version Information):** + + +``` +`https://172.16.0.20:13000 "GET / HTTP/1.1"` +``` + +**Response:** + + +``` +Content-Length: 268 Content-Type: application/json Date: Tue, 18 Feb 2020 04:49:55 GMT Location: Server: Apache Vary: X-Auth-Token x-openstack-request-id: req-6edc6642-3945-4fd0-a0f7-125744fb23ec + +{ +   "versions":{ +      "values":[ +         { +            "id":"v3.13", +            "status":"stable", +            "updated":"2019-07-19T00:00:00Z", +            "links":[ +               { +                  "rel":"self", +                  "href":"" +               } +            ], +            "media-types":[ +               { +                  "base":"application/json", +                  "type":"application/vnd.openstack.identity-v3+json" +               } +            ] +         } +      ] +   } +} +``` + +**Authentication request** + + +``` +`https://172.16.0.20:13000 "POST /v3/auth/tokens HTTP/1.1"` +``` + +After this step, a token is assigned for the admin user to use the services. (The token cannot be displayed for security reasons.) The token tells the other services something like: "I've already logged in with the proper credentials against Keystone; please let me go straight to the service and ask no more questions about who I am." + +At this point, the command: + + +``` +`$ openstack overcloud image upload --image-path /home/stack/images/` +``` + +executes, and it is authorized to upload the image to the Glance service. + +The current status is: + +_**Image Created**_ _-> Image Queued -> Image Saved -> Image Active_ + +The service checks whether this image already exists: + + +``` +`https://172.16.0.20:13292 "GET /v2/images/overcloud-full-vmlinuz HTTP/1.1"` +``` + +From the client's point of view, the request looks like: + + +``` +`curl -g -i -X GET -H 'b'Content-Type': b'application/octet-stream'' -H 'b'X-Auth-Token': b'gAAAAABeS2zzWzAZBqF-whE7SmJt_Atx7tiLZhcL8mf6wJPrO3RBdv4SdnWImxbeSQSqEQdZJnwBT79SWhrtt7QDn-2o6dsAtpUb1Rb7w6xe7Qg_AHQfD5P1rU7tXXtKu2DyYFhtPg2TRQS5viV128FyItyt49Yn_ho3lWfIXaR3TuZzyIz38NU'' -H 'User-Agent: python-glanceclient' -H 'Accept-Encoding: gzip, deflate' -H 'Accept: */*' -H 'Connection: keep-alive'  --cacert /etc/pki/ca-trust/source/anchors/cm-local-ca.pem  --cert None --key None https://172.16.0.20:13292/v2/images/overcloud-full-vmlinuz` +``` + +Here, you can see the fernet token, the user-agent indicating Glance is speaking, and the TLS certificate; this is why you don't see anything in your tcpdump. + +Since the image does not exist, it is OK to get a 404 ERROR for this request. + +Next, the current images are consulted: + + +``` +`https://172.16.0.20:13292 "GET /v2/images?limit=20 HTTP/1.1" 200 78` +``` + +and retrieved from the service: + + +``` +HTTP/1.1 200 OK +Content-Length: 78 +Content-Type: application/json +X-Openstack-Request-Id: req-0f117984-f427-4d35-bec3-956432865dd1 +Date: Tue, 18 Feb 2020 04:49:55 GMT + +{ +   "images":[ + +   ], +   "first":"/v2/images?limit=20", +   "schema":"/v2/schemas/images" +} +``` + +Yes, it is still empty. + +Meanwhile, the same check has been done on the database, where a huge query has been triggered with the same results. (To sync on the timestamp, I checked on the tcpdump after the connection and queries were finished, and then compared them with the API calls' timestamp.) + +To identify where the Glance-DB calls started, I did a full-packet search with the word "glance" inside the tcpdump file. This saves a lot of time vs. searching through all the other database calls, so this is my starting point to check each database call. + +![Searching "glance" inside tcpdump][7] + +The first query returns nothing in the fields, as the image still does not exist: + + +``` +SELECT images.created_at AS images_created_at, images.updated_at AS images_updated_at, images.deleted_at AS images_deleted_at, images.deleted AS images_deleted, images.id AS images_id, images.name AS images_name, images.disk_format AS images_disk_format, images.container_format AS images_container_format, images.size AS images_size, images.virtual_size AS images_virtual_size, images.status AS images_status, images.visibility AS images_visibility, images.checksum AS images_checksum, images.os_hash_algo AS images_os_hash_algo, images.os_hash_value AS images_os_hash_value, images.min_disk AS images_min_disk, images.min_ram AS images_min_ram, images.owner AS images_owner, images.protected AS images_protected, images.os_hidden AS images_os_hidden, image_properties_1.created_at AS image_properties_1_created_at, image_properties_1.updated_at AS image_properties_1_updated_at, image_properties_1.deleted_at AS image_properties_1_deleted_at, image_properties_1.deleted AS image_properties_1_deleted, image_properties_1.id AS image_properties_1_id, image_properties_1.image_id AS image_properties_1_image_id, image_properties_1.name AS image_properties_1_name, image_properties_1.value AS image_properties_1_value, image_locations_1.created_at AS image_locations_1_created_at, image_locations_1.updated_at AS image_locations_1_updated_at, image_locations_1.deleted_at AS image_locations_1_deleted_at, image_locations_1.deleted AS image_locations_1_deleted, image_locations_1.id AS image_locations_1_id, image_locations_1.image_id AS image_locations_1_image_id, image_locations_1.value AS image_locations_1_value, image_locations_1.meta_data AS image_locations_1_meta_data, image_locations_1.status AS image_locations_1_status +FROM images LEFT OUTER JOIN image_properties AS image_properties_1 ON images.id = image_properties_1.image_id LEFT OUTER JOIN image_locations AS image_locations_1 ON images.id = image_locations_1.image_id +WHERE images.id = 'overcloud-full-vmlinuz' +``` + +Next, the image will start uploading, so an API call and a write to the database are expected. + +On the API side, the image scheme is retrieved by consulting the service in: + + +``` +`https://172.16.0.20:13292 "GET /v2/schemas/image HTTP/1.1"` +``` + +Then, some of the fields are populated with image information. This is what the scheme looks like: + + +``` +{ +   "name":"image", +   "properties":{ +      "id":{ +         "type":"string", +         "description":"An identifier for the image", +         "pattern":"^([0-9a-fA-F]){8}-([0-9a-fA-F]){4}-([0-9a-fA-F]){4}-([0-9a-fA-F]){4}-([0-9a-fA-F]){12}$" +      }, +      "name":{ +         "type":[ +            "null", +            "string" +         ], +         "description":"Descriptive name for the image", +         "maxLength":255 +      }, +      "status":{ +         "type":"string", +         "readOnly":true, +         "description":"Status of the image", +         "enum":[ +            "queued", +            "saving", +            "active", +            "killed", +            "deleted", +            "uploading", +            "importing", +            "pending_delete", +            "deactivated" +         ] +      }, +      "visibility":{ +         "type":"string", +         "description":"Scope of image accessibility", +         "enum":[ +            "community", +            "public", +            "private", +            "shared" +         ] +      }, +      "protected":{ +         "type":"boolean", +         "description":"If true, image will not be deletable." +      }, +      "os_hidden":{ +         "type":"boolean", +         "description":"If true, image will not appear in default image list response." +      }, +      "checksum":{ +         "type":[ +            "null", +            "string" +         ], +         "readOnly":true, +         "description":"md5 hash of image contents.", +         "maxLength":32 +      }, +      "os_hash_algo":{ +         "type":[ +            "null", +            "string" +         ], +         "readOnly":true, +         "description":"Algorithm to calculate the os_hash_value", +         "maxLength":64 +      }, +      "os_hash_value":{ +         "type":[ +            "null", +            "string" +         ], +         "readOnly":true, +         "description":"Hexdigest of the image contents using the algorithm specified by the os_hash_algo", +         "maxLength":128 +      }, +      "owner":{ +         "type":[ +            "null", +            "string" +         ], +         "description":"Owner of the image", +         "maxLength":255 +      }, +      "size":{ +         "type":[ +            "null", +            "integer" +         ], +         "readOnly":true, +         "description":"Size of image file in bytes" +      }, +      "virtual_size":{ +         "type":[ +            "null", +            "integer" +         ], +         "readOnly":true, +         "description":"Virtual size of image in bytes" +      }, +      "container_format":{ +         "type":[ +            "null", +            "string" +         ], +         "description":"Format of the container", +         "enum":[ +            null, +            "ami", +            "ari", +            "aki", +            "bare", +            "ovf", +            "ova", +            "docker", +            "compressed" +         ] +      }, +      "disk_format":{ +         "type":[ +            "null", +            "string" +         ], +         "description":"Format of the disk", +         "enum":[ +            null, +            "ami", +            "ari", +            "aki", +            "vhd", +            "vhdx", +            "vmdk", +            "raw", +            "qcow2", +            "vdi", +            "iso", +            "ploop" +         ] +      }, +      "created_at":{ +         "type":"string", +         "readOnly":true, +         "description":"Date and time of image registration" +      }, +      "updated_at":{ +         "type":"string", +         "readOnly":true, +         "description":"Date and time of the last image modification" +      }, +      "tags":{ +         "type":"array", +         "description":"List of strings related to the image", +         "items":{ +            "type":"string", +            "maxLength":255 +         } +      }, +      "direct_url":{ +         "type":"string", +         "readOnly":true, +         "description":"URL to access the image file kept in external store" +      }, +      "min_ram":{ +         "type":"integer", +         "description":"Amount of ram (in MB) required to boot image." +      }, +      "min_disk":{ +         "type":"integer", +         "description":"Amount of disk space (in GB) required to boot image." +      }, +      "self":{ +         "type":"string", +         "readOnly":true, +         "description":"An image self url" +      }, +      "file":{ +         "type":"string", +         "readOnly":true, +         "description":"An image file url" +      }, +      "stores":{ +         "type":"string", +         "readOnly":true, +         "description":"Store in which image data resides.  Only present when the operator has enabled multiple stores.  May be a comma-separated list of store identifiers." +      }, +      "schema":{ +         "type":"string", +         "readOnly":true, +         "description":"An image schema url" +      }, +      "locations":{ +         "type":"array", +         "items":{ +            "type":"object", +            "properties":{ +               "url":{ +                  "type":"string", +                  "maxLength":255 +               }, +               "metadata":{ +                  "type":"object" +               }, +               "validation_data":{ +                  "description":"Values to be used to populate the corresponding image properties. If the image status is not 'queued', values must exactly match those already contained in the image properties.", +                  "type":"object", +                  "writeOnly":true, +                  "additionalProperties":false, +                  "properties":{ +                     "checksum":{ +                        "type":"string", +                        "minLength":32, +                        "maxLength":32 +                     }, +                     "os_hash_algo":{ +                        "type":"string", +                        "maxLength":64 +                     }, +                     "os_hash_value":{ +                        "type":"string", +                        "maxLength":128 +                     } +                  }, +                  "required":[ +                     "os_hash_algo", +                     "os_hash_value" +                  ] +               } +            }, +            "required":[ +               "url", +               "metadata" +            ] +         }, +         "description":"A set of URLs to access the image file kept in external store" +      }, +      "kernel_id":{ +         "type":[ +            "null", +            "string" +         ], +         "pattern":"^([0-9a-fA-F]){8}-([0-9a-fA-F]){4}-([0-9a-fA-F]){4}-([0-9a-fA-F]){4}-([0-9a-fA-F]){12}$", +         "description":"ID of image stored in Glance that should be used as the kernel when booting an AMI-style image.", +         "is_base":false +      }, +      "ramdisk_id":{ +         "type":[ +            "null", +            "string" +         ], +         "pattern":"^([0-9a-fA-F]){8}-([0-9a-fA-F]){4}-([0-9a-fA-F]){4}-([0-9a-fA-F]){4}-([0-9a-fA-F]){12}$", +         "description":"ID of image stored in Glance that should be used as the ramdisk when booting an AMI-style image.", +         "is_base":false +      }, +      "instance_uuid":{ +         "type":"string", +         "description":"Metadata which can be used to record which instance this image is associated with. (Informational only, does not create an instance snapshot.)", +         "is_base":false +      }, +      "architecture":{ +         "description":"Operating system architecture as specified in ", +         "type":"string", +         "is_base":false +      }, +      "os_distro":{ +         "description":"Common name of operating system distribution as specified in ", +         "type":"string", +         "is_base":false +      }, +      "os_version":{ +         "description":"Operating system version as specified by the distributor.", +         "type":"string", +         "is_base":false +      }, +      "description":{ +         "description":"A human-readable string describing this image.", +         "type":"string", +         "is_base":false +      }, +      "cinder_encryption_key_id":{ +         "description":"Identifier in the OpenStack Key Management Service for the encryption key for the Block Storage Service to use when mounting a volume created from this image", +         "type":"string", +         "is_base":false +      }, +      "cinder_encryption_key_deletion_policy":{ +         "description":"States the condition under which the Image Service will delete the object associated with the 'cinder_encryption_key_id' image property.  If this property is missing, the Image Service will take no action", +         "type":"string", +         "enum":[ +            "on_image_deletion", +            "do_not_delete" +         ], +         "is_base":false +      } +   }, +   "additionalProperties":{ +      "type":"string" +   }, +   "links":[ +      { +         "rel":"self", +         "href":"{self}" +      }, +      { +         "rel":"enclosure", +         "href":"{file}" +      }, +      { +         "rel":"describedby", +         "href":"{schema}" +      } +   ] +} +``` + +That's a long scheme! + +Here is the API call to start uploading the image information, and it will now move to the "queue" state: + + +``` +`curl -g -i -X POST -H 'b'Content-Type': b'application/json'' -H 'b'X-Auth-Token': b'gAAAAABeS2zzWzAZBqF-whE7SmJt_Atx7tiLZhcL8mf6wJPrO3RBdv4SdnWImxbeSQSqEQdZJnwBT79SWhrtt7QDn-2o6dsAtpUb1Rb7w6xe7Qg_AHQfD5P1rU7tXXtKu2DyYFhtPg2TRQS5viV128FyItyt49Yn_ho3lWfIXaR3TuZzyIz38NU'' -H 'User-Agent: python-glanceclient' -H 'Accept-Encoding: gzip, deflate' -H 'Accept: */*' -H 'Connection: keep-alive'  --cacert /etc/pki/ca-trust/source/anchors/cm-local-ca.pem  --cert None --key None -d '{"name": "overcloud-full-vmlinuz", "disk_format": "aki", "visibility": "public", "container_format": "bare"}' https://172.16.0.20:13292/v2/images` +``` + +Here is the API response: + + +``` +HTTP/1.1 201 Created +Content-Length: 629 +Content-Type: application/json +Location: +Openstack-Image-Import-Methods: web-download +X-Openstack-Request-Id: req-bd5194f0-b1c2-40d3-a646-8a24ed0a1b1b +Date: Tue, 18 Feb 2020 04:49:56 GMT + +{ +   "name":"overcloud-full-vmlinuz", +   "disk_format":"aki", +   "container_format":"bare", +   "visibility":"public", +   "size":null, +   "virtual_size":null, +   "status":"queued", +   "checksum":null, +   "protected":false, +   "min_ram":0, +   "min_disk":0, +   "owner":"c0a46a106d3341649a25b10f2770aff8", +   "os_hidden":false, +   "os_hash_algo":null, +   "os_hash_value":null, +   "id":"13892850-6add-4c28-87cd-6da62e6f8a3c", +   "created_at":"2020-02-18T04:49:55Z", +   "updated_at":"2020-02-18T04:49:55Z", +   "tags":[ + +   ], +   "self":"/v2/images/13892850-6add-4c28-87cd-6da62e6f8a3c", +   "file":"/v2/images/13892850-6add-4c28-87cd-6da62e6f8a3c/file", +   "schema":"/v2/schemas/image" +} +``` + +and the SQL call to store the information in the Glance-DB: + + +``` +`INSERT INTO images (created_at, updated_at, deleted_at, deleted, id, name, disk_format, container_format, SIZE, virtual_size, STATUS, visibility, checksum, os_hash_algo, os_hash_value, min_disk, min_ram, owner, protected, os_hidden) VALUES ('2020-02-18 04:49:55.993652', '2020-02-18 04:49:55.993652', NULL, 0, '13892850-6add-4c28-87cd-6da62e6f8a3c', 'overcloud-full-vmlinuz', 'aki', 'bare', NULL, NULL, 'queued', 'public', NULL, NULL, NULL, 0, 0, 'c0a46a106d3341649a25b10f2770aff8', 0, 0)` +``` + +Current status: + +_Image Created ->_ _**Image Queued**_ _-> Image Saved -> Image Active_ + +In the Glance architecture, the images are "physically" stored in the specified backend (Swift in this case), so traffic will also hit the Swift endpoint at port 8080. Capturing this traffic will make the .pcap file as large as the images being uploaded (2GB in my case).[*][8]   + +![Glance architecture][9] + + +``` +SELECT image_properties.created_at AS image_properties_created_at, image_properties.updated_at AS image_properties_updated_at, image_properties.deleted_at AS image_properties_deleted_at, image_properties.deleted AS image_properties_deleted, image_properties.id AS image_properties_id, image_properties.image_id AS image_properties_image_id, image_properties.name AS image_properties_name, image_properties.value AS image_properties_value +FROM image_properties +WHERE '13892850-6add-4c28-87cd-6da62e6f8a3c' = image_properties.image_id +``` + +You can see some validations happening within the database. At this point, the flow status is "queued" (as shown above), and you can check it here: + +![Checking the Glance image status][10] + +You can also check it with the following queries, where the **updated_at** field and the flow status are modified accordingly (i.e., queued to saving): + +Current status: + +_Image Created -> Image Queued ->_ _**Image Saved**_ _-> Image Active_ + + +``` +SELECT images.id AS images_id +FROM images +WHERE images.id = '13892850-6add-4c28-87cd-6da62e6f8a3c' AND images.status = 'queued' +UPDATE images SET updated_at='2020-02-18 04:49:56.046542', id='13892850-6add-4c28-87cd-6da62e6f8a3c', name='overcloud-full-vmlinuz', disk_format='aki', container_format='bare', SIZE=NULL, virtual_size=NULL, STATUS='saving', visibility='public', checksum=NULL, os_hash_algo=NULL, os_hash_value=NULL, min_disk=0, min_ram=0, owner='c0a46a106d3341649a25b10f2770aff8', protected=0, os_hidden=0 WHERE images.id = '13892850-6add-4c28-87cd-6da62e6f8a3c' AND images.status = 'queued' +``` + +This is validated during the process with the following query: + + +``` +SELECT images.created_at AS images_created_at, images.updated_at AS images_updated_at, images.deleted_at AS images_deleted_at, images.deleted AS images_deleted, images.id AS images_id, images.name AS images_name, images.disk_format AS images_disk_format, images.container_format AS images_container_format, images.size AS images_size, images.virtual_size AS images_virtual_size, images.status AS images_status, images.visibility AS images_visibility, images.checksum AS images_checksum, images.os_hash_algo AS images_os_hash_algo, images.os_hash_value AS images_os_hash_value, images.min_disk AS images_min_disk, images.min_ram AS images_min_ram, images.owner AS images_owner, images.protected AS images_protected, images.os_hidden AS images_os_hidden, image_properties_1.created_at AS image_properties_1_created_at, image_properties_1.updated_at AS image_properties_1_updated_at, image_properties_1.deleted_at AS image_properties_1_deleted_at, image_properties_1.deleted AS image_properties_1_deleted, image_properties_1.id AS image_properties_1_id, image_properties_1.image_id AS image_properties_1_image_id, image_properties_1.name AS image_properties_1_name, image_properties_1.value AS image_properties_1_value, image_locations_1.created_at AS image_locations_1_created_at, image_locations_1.updated_at AS image_locations_1_updated_at, image_locations_1.deleted_at AS image_locations_1_deleted_at, image_locations_1.deleted AS image_locations_1_deleted, image_locations_1.id AS image_locations_1_id, image_locations_1.image_id AS image_locations_1_image_id, image_locations_1.value AS image_locations_1_value, image_locations_1.meta_data AS image_locations_1_meta_data, image_locations_1.status AS image_locations_1_status +FROM images LEFT OUTER JOIN image_properties AS image_properties_1 ON images.id = image_properties_1.image_id LEFT OUTER JOIN image_locations AS image_locations_1 ON images.id = image_locations_1.image_id +WHERE images.id = '13892850-6add-4c28-87cd-6da62e6f8a3c' +``` + +And you can see its response in the Wireshark capture: + +![Wireshark capture][11] + +After the image is completely uploaded, its status will change to "active," which means the image is available in the service and ready to use. + + +``` + "GET /v2/images/13892850-6add-4c28-87cd-6da62e6f8a3c HTTP/1.1" 200 + +{ +   "name":"overcloud-full-vmlinuz", +   "disk_format":"aki", +   "container_format":"bare", +   "visibility":"public", +   "size":8106848, +   "virtual_size":null, +   "status":"active", +   "checksum":"5d31ee013d06b83d02c106ea07f20265", +   "protected":false, +   "min_ram":0, +   "min_disk":0, +   "owner":"c0a46a106d3341649a25b10f2770aff8", +   "os_hidden":false, +   "os_hash_algo":"sha512", +   "os_hash_value":"9f59d36dec7b30f69b696003e7e3726bbbb27a36211a0b31278318c2af0b969ffb279b0991474c18c9faef8b9e96cf372ce4087ca13f5f05338a36f57c281499", +   "id":"13892850-6add-4c28-87cd-6da62e6f8a3c", +   "created_at":"2020-02-18T04:49:55Z", +   "updated_at":"2020-02-18T04:49:56Z", +   "direct_url":"swift+config://ref1/glance/13892850-6add-4c28-87cd-6da62e6f8a3c", +   "tags":[ + +   ], +   "self":"/v2/images/13892850-6add-4c28-87cd-6da62e6f8a3c", +   "file":"/v2/images/13892850-6add-4c28-87cd-6da62e6f8a3c/file", +   "schema":"/v2/schemas/image" +} +``` + +You can also see the database call that updates the current status: + + +``` +`UPDATE images SET updated_at='2020-02-18 04:49:56.571879', id='13892850-6add-4c28-87cd-6da62e6f8a3c', name='overcloud-full-vmlinuz', disk_format='aki', container_format='bare', SIZE=8106848, virtual_size=NULL, STATUS='active', visibility='public', checksum='5d31ee013d06b83d02c106ea07f20265', os_hash_algo='sha512', os_hash_value='9f59d36dec7b30f69b696003e7e3726bbbb27a36211a0b31278318c2af0b969ffb279b0991474c18c9faef8b9e96cf372ce4087ca13f5f05338a36f57c281499', min_disk=0, min_ram=0, owner='c0a46a106d3341649a25b10f2770aff8', protected=0, os_hidden=0 WHERE images.id = '13892850-6add-4c28-87cd-6da62e6f8a3c' AND images.status = 'saving'` +``` + +Current status: + +_Image Created -> Image Queued -> Image Saved ->_ _**Image Active**_ + +One interesting thing is that a property in the image is added after the image is uploaded using a PATCH. This property is **hw_architecture** and it is set to **x86_64**: + + +``` + "PATCH /v2/images/13892850-6add-4c28-87cd-6da62e6f8a3c HTTP/1.1" + +curl -g -i -X PATCH -H 'b'Content-Type': b'application/openstack-images-v2.1-json-patch'' -H 'b'X-Auth-Token': b'gAAAAABeS2zzWzAZBqF-whE7SmJt_Atx7tiLZhcL8mf6wJPrO3RBdv4SdnWImxbeSQSqEQdZJnwBT79SWhrtt7QDn-2o6dsAtpUb1Rb7w6xe7Qg_AHQfD5P1rU7tXXtKu2DyYFhtPg2TRQS5viV128FyItyt49Yn_ho3lWfIXaR3TuZzyIz38NU'' -H 'User-Agent: python-glanceclient' -H 'Accept-Encoding: gzip, deflate' -H 'Accept: */*' -H 'Connection: keep-alive'  --cacert /etc/pki/ca-trust/source/anchors/cm-local-ca.pem  --cert None --key None -d '[{"op": "add", "path": "/hw_architecture", "value": "x86_64"}]' + +Response: + +{ +   "hw_architecture":"x86_64", +   "name":"overcloud-full-vmlinuz", +   "disk_format":"aki", +   "container_format":"bare", +   "visibility":"public", +   "size":8106848, +   "virtual_size":null, +   "status":"active", +   "checksum":"5d31ee013d06b83d02c106ea07f20265", +   "protected":false, +   "min_ram":0, +   "min_disk":0, +   "owner":"c0a46a106d3341649a25b10f2770aff8", +   "os_hidden":false, +   "os_hash_algo":"sha512", +   "os_hash_value":"9f59d36dec7b30f69b696003e7e3726bbbb27a36211a0b31278318c2af0b969ffb279b0991474c18c9faef8b9e96cf372ce4087ca13f5f05338a36f57c281499", +   "id":"13892850-6add-4c28-87cd-6da62e6f8a3c", +   "created_at":"2020-02-18T04:49:55Z", +   "updated_at":"2020-02-18T04:49:56Z", +   "direct_url":"swift+config://ref1/glance/13892850-6add-4c28-87cd-6da62e6f8a3c", +   "tags":[ + +   ], +   "self":"/v2/images/13892850-6add-4c28-87cd-6da62e6f8a3c", +   "file":"/v2/images/13892850-6add-4c28-87cd-6da62e6f8a3c/file", +   "schema":"/v2/schemas/image" +} +``` + +This is also updated in the MySQL database: + + +``` +`INSERT INTO image_properties (created_at, updated_at, deleted_at, deleted, image_id, name, VALUE) VALUES ('2020-02-18 04:49:56.655780', '2020-02-18 04:49:56.655783', NULL, 0, '13892850-6add-4c28-87cd-6da62e6f8a3c', 'hw_architecture', 'x86_64')` +``` + +This is pretty much what happens when you upload an image to Glance. Here's what it looks like if you check on the database: + + +``` +MariaDB [glance]> SELECT images.created_at AS images_created_at, images.updated_at AS images_updated_at, images.deleted_at AS images_deleted_at, images.deleted AS images_deleted, images.id AS images_id, images.name AS images_name, images.disk_format AS images_disk_format, images.container_format AS images_container_format, images.size AS images_size, images.virtual_size AS images_virtual_size, images.status AS images_status, images.visibility AS images_visibility, images.checksum AS images_checksum, images.os_hash_algo AS images_os_hash_algo, images.os_hash_value AS images_os_hash_value, images.min_disk AS images_min_disk, images.min_ram AS images_min_ram, images.owner AS images_owner, images.protected AS images_protected, images.os_hidden AS images_os_hidden, image_properties_1.created_at AS image_properties_1_created_at, image_properties_1.updated_at AS image_properties_1_updated_at, image_properties_1.deleted_at AS image_properties_1_deleted_at, image_properties_1.deleted AS image_properties_1_deleted, image_properties_1.id AS image_properties_1_id, image_properties_1.image_id AS image_properties_1_image_id, image_properties_1.name AS image_properties_1_name, image_properties_1.value AS image_properties_1_value, image_locations_1.created_at AS image_locations_1_created_at, image_locations_1.updated_at AS image_locations_1_updated_at, image_locations_1.deleted_at AS image_locations_1_deleted_at, image_locations_1.deleted AS image_locations_1_deleted, image_locations_1.id AS image_locations_1_id, image_locations_1.image_id AS image_locations_1_image_id, image_locations_1.value AS image_locations_1_value, image_locations_1.meta_data AS image_locations_1_meta_data, image_locations_1.status AS image_locations_1_status  FROM images LEFT OUTER JOIN image_properties AS image_properties_1 ON images.id = image_properties_1.image_id LEFT OUTER JOIN image_locations AS image_locations_1 ON images.id = image_locations_1.image_id  WHERE images.id = '13892850-6add-4c28-87cd-6da62e6f8a3c'\G; +*************************** 1. row *************************** +            images_created_at: 2020-02-18 04:49:55 +            images_updated_at: 2020-02-18 04:49:56 +            images_deleted_at: NULL +               images_deleted: 0 +                    images_id: 13892850-6add-4c28-87cd-6da62e6f8a3c +                  images_name: overcloud-full-vmlinuz +           images_disk_format: aki +      images_container_format: bare +                  images_size: 8106848 +          images_virtual_size: NULL +                images_status: active +            images_visibility: public +              images_checksum: 5d31ee013d06b83d02c106ea07f20265 +          images_os_hash_algo: sha512 +         images_os_hash_value: 9f59d36dec7b30f69b696003e7e3726bbbb27a36211a0b31278318c2af0b969ffb279b0991474c18c9faef8b9e96cf372ce4087ca13f5f05338a36f57c281499 +              images_min_disk: 0 +               images_min_ram: 0 +                 images_owner: c0a46a106d3341649a25b10f2770aff8 +             images_protected: 0 +             images_os_hidden: 0 +image_properties_1_created_at: 2020-02-18 04:49:56 +image_properties_1_updated_at: 2020-02-18 04:49:56 +image_properties_1_deleted_at: NULL +   image_properties_1_deleted: 0 +        image_properties_1_id: 11 +  image_properties_1_image_id: 13892850-6add-4c28-87cd-6da62e6f8a3c +      image_properties_1_name: hw_architecture +     image_properties_1_value: x86_64 + image_locations_1_created_at: 2020-02-18 04:49:56 + image_locations_1_updated_at: 2020-02-18 04:49:56 + image_locations_1_deleted_at: NULL +    image_locations_1_deleted: 0 +         image_locations_1_id: 7 +   image_locations_1_image_id: 13892850-6add-4c28-87cd-6da62e6f8a3c +      image_locations_1_value: swift+config://ref1/glance/13892850-6add-4c28-87cd-6da62e6f8a3c +  image_locations_1_meta_data: {} +     image_locations_1_status: active +1 row in set (0.00 sec) +``` + +The final result is: + + +``` +(undercloud) [stack@undercloud ~]$ openstack image list ++--------------------------------------+------------------------+--------+ +| ID                                   | Name                   | Status | ++--------------------------------------+------------------------+--------+ +| 9a26b9da-3783-4223-bdd7-c553aa194e30 | overcloud-full         | active | +| a2914297-c70f-4021-bc3e-8ec2123f6ea6 | overcloud-full-initrd  | active | +| 13892850-6add-4c28-87cd-6da62e6f8a3c | overcloud-full-vmlinuz | active | ++--------------------------------------+------------------------+--------+ +(undercloud) [stack@undercloud ~]$ +``` + +Some other minor things are happening during this process, but overall, this is how it looks. + +### Conclusion + +Understanding the flow of the most common actions in the OpenStack platform will enable you to enhance your troubleshooting skills when facing some issues at work. You can check the status of an image in Glance; know whether an image is in a "queued," "saving," or "active" state; and do some captures in your environment to see what is going on by checking the endpoints you need to check. + +I enjoy debugging. I consider this is an important skill for any role—whether you are working in a support, consulting, developer (of course!), or architect role. I hope this article gave you some basic guidelines to start debugging things. + +* * * + +* In case you're wondering how to open a 2GB .pcap file without problems, here is one way to do it: + + +``` +`$ editcap -c 5000 image-upload.pcap upload-overcloud-image.pcap` +``` + +This splits your huge capture in smaller captures of 5,000 packets each. + +* * * + +_This article was [originally posted][12] on LinkedIn and is reprinted with permission._ + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/3/glance + +作者:[Jair Patete][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/jpatete +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/yourimagehere_520x292.png?itok=V-xhX7KL (blank background that says your image here) +[2]: https://www.openstack.org/software/releases/ocata/components/glance +[3]: https://www.openstack.org/ +[4]: https://wiki.openstack.org/wiki/TripleO +[5]: https://www.tcpdump.org/ +[6]: https://docs.openstack.org/keystone/latest/ +[7]: https://opensource.com/sites/default/files/uploads/glance-db-calls.png (Searching "glance" inside tcpdump) +[8]: tmp.qBKg0ttLIJ#* +[9]: https://opensource.com/sites/default/files/uploads/glance-architecture.png (Glance architecture) +[10]: https://opensource.com/sites/default/files/uploads/check-flow-status.png (Checking the Glance image status) +[11]: https://opensource.com/sites/default/files/uploads/wireshark-capture.png (Wireshark capture) +[12]: https://www.linkedin.com/pulse/what-happens-behind-doors-when-we-upload-image-glance-patete-garc%25C3%25ADa/?trackingId=czWiFC4dRfOsSZJ%2BXdzQfg%3D%3D diff --git a/sources/tech/20200320 Run a command on binary files with this script.md b/sources/tech/20200320 Run a command on binary files with this script.md new file mode 100644 index 0000000000..2d6f0b6f26 --- /dev/null +++ b/sources/tech/20200320 Run a command on binary files with this script.md @@ -0,0 +1,772 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Run a command on binary files with this script) +[#]: via: (https://opensource.com/article/20/3/run-binaries-script) +[#]: author: (Nick Clifton https://opensource.com/users/nickclifton) + +Run a command on binary files with this script +====== +Try this simple script to easily run a command on binary files +regardless of their packaging. +![Binary code on a computer screen][1] + +Examining files from the command-line is generally an easy thing to do. You just run the command you want, followed by a list of files to be examined. Dealing with binary files, however, is more complicated. These files are often packaged up into archives, tarballs, or other packaging formats. The run-on-binaries script provides a convenient way to run a command on a collection of files, regardless of how they are packaged. + +The invocation of the script is quite simple: + + +``` +`run-on-binaries ` +``` + +So, for example: + + +``` +`run-on-binaries /usr/bin/ls foo.rpm` +``` + +will list all of the files inside the **foo.rpm** file, while: + + +``` +`run-on-binaries /usr/bin/readelf -a libc.a` +``` + +will run the **readelf** program, with the **-a** command-line option, on all of the object files inside the **libc.a library**. + +If necessary, the script can be passed a file containing a list of other files to be processed, rather than specifying them on the command line—like this: + + +``` +`run-on-binaries --files-from=foo.lst /usr/bin/ps2ascii` +``` + +This will run the **ps2ascii** script on all of the files listed in **foo.lst**. (The files just need to be separated by white space. There can be multiple files on a single line if desired). + +Also, a skip list can be provided to stop the script from processing specified files: + + +``` +`run-on-binaries --skip-list=skip.lst /usr/bin/wc *` +``` + +This will run the **wc** program on all of the files in the current directory, except for those specified in **skip.lst**. + +The script does not recurse into directories, but this can be handled by combining it with the **find** command, like this: + + +``` +`find . -type f -exec run-on-binaries @ ;` +``` + +or + + +``` +`find . -type d -exec run-on-binaries @/* ;` +``` + +The only difference between these two invocations is that the second one only runs the target program once per directory, but gives it a long command-line of all of the files in the directory. + +Though convenient, the script is lacking in several areas. Right now, it does not examine the PATH environment variable to find the command that it is asked to run, so a full path must be provided. Also, the script ought to be able to handle recursion on its own, without needing help from the find command. + +The run-on-binaries script is part of the annobin package, which is available on Fedora. The sources for annobin can also be obtained from the git repository at . + +### The script + + +``` +#!/bin/bash + +# Script to run another script/program on the executables inside a given file. +# +# Created by Nick Clifton.  <[nickc@redhat.com][2]> +# Copyright (c) 2018 Red Hat. +# +# This is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License as published +# by the Free Software Foundation; either version 3, or (at your +# option) any later version. + +# It is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the +# GNU General Public License for more details. +# +# Usage: +#   run-on-binaries-in [options] program [options-for-the-program] file(s) +# +# This script does not handle directories.  This is deliberate. +# It is intended that if recursion is needed then it will be +# invoked from find, like this: +# +#   find . -name "*.rpm" -exec run-on-binaries-in <script-to-run> {} \; + +version=1.0 + +help () +{ +  # The following exec goop is so that we don't have to manually +  # redirect every message to stderr in this function. +  exec 4>&1    # save stdout fd to fd #4 +  exec 1>&2    # redirect stdout to stderr + +  cat <<__EOM__ + +This is a shell script to run another script/program on one or more binary +files.  If the file(s) specified are archives of some kind (including rpms) +then the script/program is run on the binary executables inside the archive. + +Usage: $prog {options} program {options-for-the-program} files(s) + +  {options} are: +  -h         --help               Display this information and then exit. +  -v         --version            Report the version number of this script. +  -V         --verbose            Report on progress. +  -q         --quiet              Do not include the script name in the output. +  -i         --ignore             Silently ignore files that are not executables or archives. +  -p=<TEXT>  --prefix=<TEXT>      Prefix normal output with this string. +  -t=<DIR>   --tmpdir=<DIR>       Temporary directory to use when opening archives. +  -f=<FILE>  --files-from=<FILE>  Process files listed in <FILE>. +  -s=<FILE>  --skip-list=<FILE>   Skip any file listed in <FILE>. +  --                              Stop accumulating options. + +Examples: + +  $prog hardened foo.rpm +                              Runs the hardened script on the executable +                              files inside foo.rpm. + +  $prog check-abi -v fred.tar.xz +                              Runs the check-abi script on the decompressed +                              contents of the fred.tar.xz archive, passing the +                              -v option to check-abi as it does so.       + +  $prog -V -f=list.txt readelf -a +                              Runs the readelf program, with the -a option on +                              every file listed in the list.txt.  Describes +                              what is being done as it works. + +  $prog -v -- -fred -a jim -b bert -- -c harry +                              Runs the script "-fred" on the files jim, bert, +                              "-c" and harry.  Passes the options "-a" and +                              "-b" to the script (even when run on jim). +                              Reports the version of this script as well. + +__EOM__ +  exec 1>&4   # Copy stdout fd back from temporary save fd, #4 +} + +main () +{ +    init +    +    parse_args ${1+"$@"} + +    if [ $failed -eq 0 ]; +    then +        run_script_on_files +    fi + +    if [ $failed -ne 0 ]; +    then +        exit 1 +    else +        exit 0 +    fi +} + +report () +{ +    if [ $quiet -eq 0 ]; +    then +        echo -n $prog": " +    fi +    +    echo ${1+"$@"} +} + +ice () +{ +    report "Internal error: " ${1+"$@"} +    exit 1 +} + +fail () +{ +    report "Failure:" ${1+"$@"} +    failed=1 +} + +verbose () +{ +    if [ $verbose -ne 0 ] +    then +        report ${1+"$@"} +    fi +} + +# Initialise global variables. +init () +{ +    files[0]="";   +    # num_files is the number of files to be scanned. +    # files[0] is the script to run on the files. +    num_files=0; + +    script="" +    script_opts=""; + +    prog_opts="-i" + +    tmpdir=/dev/shm +    prefix=""     +    files_from="" +    skip_list="" + +    failed=0 +    verbose=0 +    ignore=0 +    quiet=0 +} + +# Parse our command line +parse_args () +{ +    abs_prog=$0; +    prog=`basename $abs_prog`; + +    # Locate any additional command line switches +    # Likewise accumulate non-switches to the files list. +    while [ $# -gt 0 ] +    do +        optname="`echo $1 | sed 's,=.*,,'`" +        optarg="`echo $1 | sed 's,^[^=]*=,,'`" +        case "$optname" in +            -v | --version) +                report "version: $version" +                ;; +            -h | --help) +                help +                exit 0 +                ;; +            -q | --quiet) +                quiet=1; +                prog_opts="$prog_opts -q" +                ;; +            -V | --verbose) +                if [ $verbose -eq 1 ]; +                then +                    # This has the effect of cancelling out the prog_opts="-i" +                    # in the init function, so that recursive invocations of this +                    # script will complain about unrecognised file types. +                    if [ $quiet -eq 0 ]; +                    then +                        prog_opts="-V -V" +                    else +                        prog_opts="-V -V -q" +                    fi +                else +                    verbose=1; +                    prog_opts="$prog_opts -V" +                fi +                ;; +            -i | --ignore) +                ignore=1 +                ;; +            -t | --tmpdir) +                if test "x$optarg" = "x$optname" ; +                then +                    shift +                    if [ $# -eq 0 ] +                    then +                        fail "$optname needs a directory name" +                    else +                        tmpdir=$1 +                    fi +                else +                    tmpdir="$optarg" +                fi +                ;; +            -p | --prefix) +                if test "x$optarg" = "x$optname" ; +                then +                    shift +                    if [ $# -eq 0 ] +                    then +                        fail "$optname needs a string argument" +                    else +                        prefix=$1 +                    fi +                else +                    prefix="$optarg" +                fi +                ;; +            -f | --files_from) +                if test "x$optarg" = "x$optname" ; +                then +                    shift +                    if [ $# -eq 0 ] +                    then +                        fail "$optname needs a file name" +                    else +                        files_from=$1 +                    fi +                else +                    files_from="$optarg" +                fi +                ;; +            +            -s | --skip-list) +                if test "x$optarg" = "x$optname" ; +                then +                    shift +                    if [ $# -eq 0 ] +                    then +                        fail "$optname needs a file name" +                    else +                        skip_list=$1 +                    fi +                else +                    skip_list="$optarg" +                fi +                ;; +            +            --) +                shift +                break; +                ;; +            --*) +                fail "unrecognised option: $1" +                help +                ;; +            *) +                script="$1"; +                if ! [ -a "$script" ] +                then +                    fail "$script: program/script not found" +                elif  ! [ -x "$script" ] +                then +                    fail "$script: program/script not executable" +                fi +                # After we have seen the first non-option we stop +                # accumulating options for this script and instead +                # start accumulating options for the script to be +                # run. +                shift +                break; +                ;; +        esac +        shift +    done + +    # Read in the contents of the --file-from list, if specified. +    if test "x$files_from" != "x" ; +    then +        if ! [ -a "$files_from" ] +        then +            fail "$files_from: file not found" +        elif ! [ -r "$files_from" ] +        then +            fail "$files_from: file not readable" +        else +            eval 'files=($(cat $files_from))' +            num_files=${#files[*]} +        fi +    fi +    skip_files[foo]=bar + +    # Check that the skip list exists, if specified. +    if test "x$skip_list" != "x" ; +    then +        if ! [ -a "$skip_list" ] +        then +            fail "$skip_list: file not found" +        elif ! [ -r "$skip_list" ] +        then +            fail "$files_from: file not readable" +        fi +    fi + +    # Accumulate any remaining arguments separating out the arguments +    # for the script from the names of the files to scan. +    while [ $# -gt 0 ] +    do +        optname="`echo $1 | sed 's,=.*,,'`" +        optarg="`echo $1 | sed 's,^[^=]*=,,'`" +        case "$optname" in +            --) +                shift +                break; +                ;; +            -*) +                script_opts="$script_opts $1" +                ;; +            *) +                files[$num_files]="$1"; +                let "num_files++" +                ;; +        esac +        shift +    done + +    # Accumulate any remaining arguments without processing them. +    while [ $# -gt 0 ] +    do +        files[$num_files]="$1"; +        let "num_files++"; +        shift +    done + +    if [ $num_files -gt 0 ]; +    then +        # Remember that we are counting from zero not one. +        let "num_files--" +    else +        fail "Must specify a program/script and at least one file to scan." +    fi +} + +run_script_on_files () +{ +    local i + +    i=0; +    while [ $i -le $num_files ] +    do +        run_on_file i +        let "i++" +    done +} + +# syntax: run <command> [<args>] +#  If being verbose report the command being run, and +#   the directory in which it is run. +run () +{ +  local where + +  if test "x$1" = "x" ; +  then +    fail "run() called without an argument." +  fi + +  verbose "  Running: ${1+$@}" + +  ${1+$@} +} + +decompress () +{ +    local abs_file decompressor decomp_args orig_file base_file + +    # Paranoia checks - the user should never encounter these. +    if test "x$4" = "x" ; +    then +        ice "decompress called with too few arguments" +    fi +    if test "x$5" != "x" ; +    then +        ice "decompress called with too many arguments" +    fi + +    abs_file=$1 +    decompressor=$2 +    decomp_args=$3 +    orig_file=$4 + +    base_file=`basename $abs_file` + +    run cp $abs_file $base_file +    run $decompressor $decomp_args $base_file +    if [ $? != 0 ]; +    then +        fail "$orig_file: Unable to decompress" +    fi + +    rm -f $base_file +} + +run_on_file () +{ +    local file + +    # Paranoia checks - the user should never encounter these. +    if test "x$1" = "x" ; +    then +        ice "scan_file called without an argument" +    fi +    if test "x$2" != "x" ; +    then +        ice "scan_file called with too many arguments" +    fi + +    # Use quotes when accessing files in order to preserve +    # any spaces that might be in the directory name. +    file="${files[$1]}"; + +    # Catch names that start with a dash - they might confuse readelf +    if test "x${file:0:1}" = "x-" ; +    then +        file="./$file" +    fi + +    # See if we should skip this file. +    if test "x$skip_list" != "x" ; +    then +        # This regexp looks for $file being the first text on a line, either +        # on its own, or with additional text separated from it by at least +        # one space character.  So searching for "fred" in the following gives: +        #  fr         <\- no match +        #  fred       <\- match +        #  fredjim    <\- no match +        #  fred bert  <\- match +        regexp="^$file[^[:graph:]]*" +        grep --silent --regexp="$regexp" $skip_list +        if [ $? = 0 ]; +        then +            verbose "$file: skipping" +            return +        fi +    fi + +    # Check the file. +    if ! [ -a "$file" ] +    then +        fail "$file: file not found" +        return +    elif ! [ -r "$file" ] +    then +        if [ $ignore -eq 0 ]; +        then +            fail "$file: not readable" +        fi +        return +    elif [ -d "$file" ] +    then +        if [ $ignore -eq 0 ]; +        then +            if [ $num_files -gt 1 ]; +            then +                verbose "$file: skipping - it is a directory" +            else +                report "$file: skipping - it is a directory" +            fi +        fi +        return +    elif ! [ -f "$file" ] +    then +        if [ $ignore -eq 0 ]; +        then +            fail "$file: not an ordinary file" +        fi +        return +    fi + +    file_type=`file -b $file` +    case "$file_type" in +        *"ELF "*) +            verbose "$file: ELF format - running script/program" +            if test "x$prefix" != "x" ; +            then +                report "$prefix:" +            fi +            run $script $script_opts $file +            return +            ;; +        "RPM "*) +            verbose "$file: RPM format." +            ;; +        *" cpio "*) +            verbose "$file: CPIO format." +            ;; +        *"tar "*) +            verbose "$file: TAR archive." +            ;; +        *"Zip archive"*) +            verbose "$file: ZIP archive." +            ;; +        *"ar archive"*) +            verbose "$file: AR archive." +            ;; +        *"bzip2 compressed data"*) +            verbose "$file: contains bzip2 compressed data" +            ;; +        *"gzip compressed data"*) +            verbose "$file: contains gzip compressed data" +            ;; +        *"lzip compressed data"*) +            verbose "$file: contains lzip compressed data" +            ;; +        *"XZ compressed data"*) +            verbose "$file: contains xz compressed data" +            ;; +        *"shell script"* | *"ASCII text"*) +            if [ $ignore -eq 0 ]; +            then +                fail "$file: test/scripts cannot be scanned." +            fi +            return +            ;; +        *"symbolic link"*) +            if [ $ignore -eq 0 ]; +            then +                # FIXME: We ought to be able to follow symbolic links +                fail "$file: symbolic links are not followed." +            fi +            return +            ;; +        *) +            if [ $ignore -eq 0 ]; +            then +                fail "$file: Unsupported file type: $file_type" +            fi +            return +            ;; +    esac +    +    # We now know that we will need a temporary directory +    # so create one, and create paths to the file and scripts. +    if test "x${file:0:1}" = "x/" ; +    then +        abs_file=$file +    else +        abs_file="$PWD/$file" +    fi +    +    if test "x${abs_prog:0:1}" != "x/" ; +    then +        abs_prog="$PWD/$abs_prog" +    fi + +    if test "x${script:0:1}" = "x/" ; +    then +        abs_script=$script +    else +        abs_script="$PWD/$script" +    fi +    +    tmp_root=$tmpdir/delme.run.on.binary +    run mkdir -p "$tmp_root/$file" + +    verbose "  Changing to directory: $tmp_root/$file" +    pushd "$tmp_root/$file" > /dev/null +    if [ $? != 0 ]; +    then +        fail "Unable to change to temporary directory: $tmp_root/$file" +        return +    fi +                          +    # Run the file type switch again, although this time we do not need to +    # check for unrecognised types.  (But we do, just in case...) +    # Note since are transforming the file we re-invoke the run-on-binaries +    # script on the decoded contents.  This allows for archives that contain +    # other archives, and so on.  We normally pass the -i option to the +    # invoked script so that it will not complain about unrecognised files in +    # the decoded archive, although we do not do this when running in very +    # verbose mode.  We also pass an extended -t option to ensure that any +    # sub-archives are extracted into a unique directory tree. + +    case "$file_type" in +        "RPM "*) +            # The output redirect confuses the run function... +            verbose "  Running: rpm2cpio $abs_file > delme.cpio" +            rpm2cpio $abs_file > delme.cpio +            if [ $? != 0 ]; +            then +                fail "$file: Unable to extract from rpm archive" +            else +                # Save time - run cpio now. +                run cpio --quiet --extract --make-directories --file delme.cpio +                if [ $? != 0 ]; +                then +                    fail "$file: Unable to extract files from cpio archive" +                fi +                run rm -f delme.cpio +            fi +            ;; + +        *" cpio "*) +            run cpio --quiet --extract --make-directories --file=$abs_file +            if [ $? != 0 ]; +            then +                fail "$file: Unable to extract files from cpio archive" +            fi +            ;; + +        *"tar "*) +            run tar --extract --file=$abs_file +            if [ $? != 0 ]; +            then +                fail "$file: Unable to extract files from tarball" +            fi +            ;; + +        *"ar archive"*) +            run ar x $abs_file +            if [ $? != 0 ]; +            then +                fail "$file: Unable to extract files from ar archive" +            fi +            ;; + +        *"Zip archive"*) +            decompress $abs_file unzip "-q" $file +            ;; +        *"bzip2 compressed data"*) +            decompress $abs_file bzip2 "--quiet --decompress" $file +            ;; +        *"gzip compressed data"*) +            decompress $abs_file gzip "--quiet --decompress" $file +            ;; +        *"lzip compressed data"*) +            decompress $abs_file lzip "--quiet --decompress" $file +            ;; +        *"XZ compressed data"*) +            decompress $abs_file xz "--quiet --decompress" $file +            ;; +        *) +            ice "unhandled file type: $file_type" +            ;; +     esac + +    if [ $failed -eq 0 ]; +    then +        # Now scan the file(s) created in the previous step. +        run find . -type f -execdir $abs_prog $prog_opts -t=$tmp_root/$file -p=$file $abs_script $script_opts {} + +    fi + +    verbose "  Deleting temporary directory: $tmp_root" +    rm -fr $tmp_root + +    verbose "  Return to previous directory" +    popd > /dev/null +} + +# Invoke main +main ${1+"$@"} +``` + +  + +Git has extensions for handling binary blobs such as multimedia files, so today we will learn how... + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/3/run-binaries-script + +作者:[Nick Clifton][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/nickclifton +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/binary_code_computer_screen.png?itok=7IzHK1nn (Binary code on a computer screen) +[2]: mailto:nickc@redhat.com diff --git a/sources/tech/20200323 5 Python scripts for automating basic community management tasks.md b/sources/tech/20200323 5 Python scripts for automating basic community management tasks.md new file mode 100644 index 0000000000..3f8dd00aa1 --- /dev/null +++ b/sources/tech/20200323 5 Python scripts for automating basic community management tasks.md @@ -0,0 +1,114 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (5 Python scripts for automating basic community management tasks) +[#]: via: (https://opensource.com/article/20/3/automating-community-management-python) +[#]: author: (Rich Bowen https://opensource.com/users/rbowen) + +5 Python scripts for automating basic community management tasks +====== +If you have to do something three times, try to automate it. +![shapes of people symbols][1] + +I've [written before about what a community manager does][2], and if you ask ten community managers, you'll get 12 different answers. Mostly, though, you do what the community needs for you to do at any given moment. And a lot of it can be repetitive. + +Back when I was a sysadmin, I had a rule: if I had to do something three times, I'd try to automate it. And, of course, these days, with awesome tools like Ansible, there's a whole science to that. + +Some of what I do on a daily or weekly basis involves looking something up in a few places and then generating some digest or report of that information to publish elsewhere. A task like that is a perfect candidate for automation. None of this is [rocket surgery][3], but when I've shared some of these scripts with colleagues, invariably, at least one of them turns out to be useful. + +[On GitHub][4], I have several scripts that I use every week. None of them are complicated, but they save me a few minutes every time. Some of them are in Perl because I'm almost 50. Some of them are in Python because a few years ago, I decided I needed to learn Python. Here's an overview: + +### **[tshirts.py][5]** + +This simple script takes a number of Tshirts that you're going to order for an event and tells you what the size distribution should be. It spreads them on a normal curve (also called a bell curve), and, in my experience, this coincides pretty well with what you'll actually need for a normal conference audience. You might want to adjust the script to slightly larger if you're using it in the USA, slightly smaller if you're using it in Europe. YMMV. + +Usage: + + +``` +[rbowen@sasha:community-tools/scripts]$ ./tshirts.py                                                                                                                                                           +How many shirts? 300 +For a total of 300 shirts, order: + +30.0 small +72.0 medium +96.0 large +72.0 xl +30.0 2xl +``` + +### **[followers.py][6]** + +This script provides me with the follower count for Twitter handles I care about. + +This script is only 14 lines long and isn't exciting, but it saves me perhaps ten minutes of loading web pages and looking for a number. + +You'll need to edit the feeds array to add the accounts you care about: + + +``` +feeds = [ +        'centosproject', +        'centos' +        ]; +``` + +NB: It probably won't work if you're running it outside of English-speaking countries, because it's just a simple screen-scraping script that reads HTML and looks for particular information buried within it. So when the output is in a different language, the regular expressions won't match. + +Usage: + + +``` +[rbowen@sasha:community-tools/scripts]$ ./followers.py                                                                                                                                                                           +centosproject: 11,479 Followers +centos: 18,155 Followers +``` + +### **[get_meetups][7]** + +This script fits into another category—API scripts. This particular script uses the [meetup.com][8] API to look for meetups on a particular topic in a particular area and time range so that I can report them to my community. Many of the services you rely on provide an API so that your scripts can look up information without having to manually look through web pages. Learning how to use those APIs can be frustrating and time-consuming, but you'll end up with skills that will save you a LOT of time. + +_Disclaimer: [meetup.com][8] changed their API in August of 2019, and I have not yet updated this script to the new API, so it doesn't actually work right now. Watch this repo for a fixed version in the coming weeks._ + +### **[centos-announcements.pl][9]** + +This script is considerably more complicated and extremely specific to my use case, but you probably have a similar situation. This script looks at a mailing list archive—in this case, the centos-announce mailing list—and finds messages that are in a particular format, then builds a report of those messages. Reports come in a couple of different formats—one for my monthly newsletter and one for scheduling messages (via Hootsuite) for Twitter. + +I use Hootsuite to schedule content for Twitter, and they have a convenient CSV (comma-separated value) format that lets you bulk-schedule a whole week of tweets in one go. Auto-generating that CSV from various data sources (i.e., mailing lists, blogs, other web pages) can save you a lot of time. Do note, however, that this should probably only be used for a first draft, which you then examine and edit yourself so that you don't end up auto-tweeting something you didn't intend to. + +### **[reporting.pl][10]** + +This script is also fairly specific to my particular needs, but the concept itself is universal. I send out a monthly mailing to the [CentOS SIGs][11] (Special Interest Groups), which are scheduled to report in that given month. This script simply tells me which SIGs those are this month, and writes the email that needs to go to them. + +It does not actually send that email, however, for a couple of reasons. One, I may wish to edit those messages before they go out. Two, while scripts sending email worked great in the old days, these days, they're likely to result in getting spam-filtered. + +### In conclusion + +There are some other scripts in that repo that are more or less specific to my particular needs, but I hope at least one of them is useful to you, and that the variety of what's there inspires you to automate something of your own. I'd love to see your handy automation script repos, too; link to them in the comments! + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/3/automating-community-management-python + +作者:[Rich Bowen][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/rbowen +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/Open%20Pharma.png?itok=GP7zqNZE (shapes of people symbols) +[2]: http://drbacchus.com/what-does-a-community-manager-do/ +[3]: https://6dollarshirts.com/rocket-surgery +[4]: https://github.com/rbowen/centos-community-tools/tree/master/scripts +[5]: https://github.com/rbowen/centos-community-tools/blob/master/scripts/tshirts.py +[6]: https://github.com/rbowen/centos-community-tools/blob/master/scripts/followers.py +[7]: https://github.com/rbowen/centos-community-tools/blob/master/scripts/get_meetups +[8]: http://meetup.com +[9]: https://github.com/rbowen/centos-community-tools/blob/master/scripts/centos-announcements.pl +[10]: https://github.com/rbowen/centos-community-tools/blob/master/scripts/sig_reporting/reporting.pl +[11]: https://wiki.centos.org/SpecialInterestGroup diff --git a/sources/tech/20200326 How to detect outdated Kubernetes APIs.md b/sources/tech/20200326 How to detect outdated Kubernetes APIs.md new file mode 100644 index 0000000000..a45a9b2add --- /dev/null +++ b/sources/tech/20200326 How to detect outdated Kubernetes APIs.md @@ -0,0 +1,234 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How to detect outdated Kubernetes APIs) +[#]: via: (https://opensource.com/article/20/3/deprek8) +[#]: author: (Tyler Auerbeck https://opensource.com/users/tylerauerbeck) + +How to detect outdated Kubernetes APIs +====== +Deprek8 and Conftest alert you about deprecated APIs that threaten to +slip into your codebase. +![Ship captain sailing the Kubernetes seas][1] + +Recently, deprecated APIs have been wreaking havoc on everyone's [Kubernetes][2] manifests. Why is this happening?!? It's because the objects that we've come to know and love are moving on to their new homes. And it's not like this happened overnight. Deprecation warnings have been in place for quite a few releases now. We've all just been lazy and thought the day would never come. Well, _it's here_! + +So, maybe it caught up to us this time. But we'll be prepared next time, right?!? Yeah, that's what we said last time. But what if we could put something in place that makes sure that this doesn't happen? + +### What is Deprek8? + +[Deprek8][3] is a set of [Open Policy Agent][4] (OPA) policies that allow you to check your repository for deprecated API versions. These policies offer a way to provide warnings and errors when something is in the process of being or has already been deprecated. But **Deprek8** is just a set of policies that define what to watch for. How do you actually actively use these policies in order to monitor for deprecations? + +There are a number of ways and tools that can do this; one way is to use the OPA Deprek8 policy. + +### What is the OPA Deprek8 policy? + +OPA is "an open source, general-purpose policy engine that enables unified, context-aware policy enforcement." In other words, OPA provides a means of establishing and enforcing a set of policies based upon a policy file. The policies are defined in a file (or set of files) using the [Rego query language][5]. This use case won't necessarily rely on the OPA application, but more specifically, it uses this query language to do the heavy lifting. By using Rego, you can check whether various manifests match certain criteria and then either warn or error them out based on your definition. For example, in Kubernetes 1.16, the Deployment object can no longer be served from the **extensions/v1beta1 apiVersion**. So in your .rego file, you could have something like: + + +``` +_deny = msg { +  resources := ["Deployment"] +  input.apiVersion == "extensions/v1beta1" +  input.kind == resources[_] +  msg := sprintf("%s/%s: API extensions/v1beta1 for %s is no longer served by default, use apps/v1 instead.", [input.kind, input.metadata.name, input.kind]) +} +``` + +This would alert that you have a deprecated manifest and print a message like: + +> Deployment/myDeployment: API extensions/v1beta1 for Deployment is no longer served by default, use apps/v1 instead. + +That's great! This is exactly what you need in order to avoid having old manifests lying around. But these are just the policies; you need something that will check these policies and put them into action. + +### Conftest + +This is where [Conftest][6] comes in. Conftest is a utility that allows you to put Rego policies into action against any number of configuration files. According to the repo, Conftest currently supports: + + +``` + - YAML + - JSON + - INI + - TOML + - HOCON + - HCL + - CUE + - Dockerfile + - HCL2 (Experimental) + - EDN + - VCL + - XML +``` + +It has some fairly strict defaults (i.e., expecting policy files to be in certain locations), but they can be overridden with the appropriate flags if you have a layout that you prefer. If you want to know more about those specifics, please consult the [documentation][7] in the repository. + +For example, you can run any policy file on Conftest with a command like: + + +``` +`helm template --set podSecurityPolicy.enabled=true --set server.ingress.enabled=true . | conftest -p mypolicy.rego -` +``` + +This would generate the appropriate output from a Helm template and pipe it directly to the Conftest utility. Conftest inspects that output against any policies defined in the **mypolicy.rego** file and then gives any appropriate warnings or errors for objects that match against those policies. You can, of course, swap out any templating tooling of your choice, or you can feed specific files directly to the Conftest tool. + +So now you have the tools to set your policies and enforce them against your configuration files. But how do you tie these two things together? Better yet: How do you automate this process to continuously monitor the codebase to make sure you never fall behind the deprecation line again? + +### Using Git to run checks + +There are many methods and tools to run checks against code. By adding similar steps to your continuous integration (CI) tooling (e.g., Jenkins, Tekton, etc.), you can accomplish the same goal. In this very basic use case, I used [GitHub Actions][8], a new feature of GitHub repositories. + +GitHub Actions allows you to automate your entire workflow, so you don't have to sit in front of your keyboard and hack all of this together. With Actions, you can string together any number of steps into a workflow (or multiple workflows) by either rolling your own Actions if you're doing something custom or, in most cases, using something that already exists in the [Marketplace][9]. Luckily, others have provided Actions to do the things you need to do for this example, so you can lean on the community's expertise to pull your workflow together. + +As described in the steps above, the workflow looks something like: + + 1. Retrieve the Deprek8 policy you need and store it somewhere for later use. + 2. Run Conftest against the appropriate files/charts with the policy file you grabbed in step 1. + + + +What does this boil down to? Well, all you really need to do is to use curl to pull your policy file and then run it through Conftest after pointing to your code, using the [curl][10] and [Conftest][11] Actions. Since these Actions already exist, you don't need to write any custom code! And as I'm sure you can tell by the names, they allow you to run the associated commands without having to do any custom work to pre-process anything or pull down any binaries. + +Now that you have the Actions you need to use, how do you pull them together? This is where your workflow comes into play. While Actions are the pieces of code that get things done, they're useless without a way to string them together so that they can be triggered by some event. A GitHub Action workflow will look something like this: + + +``` +name: Some Awesome Workflow Name +on: An Event That Triggers Our Workflow +jobs: +  awesome-job-name: +    runs-on: ubuntu-latest +    steps: +      - uses: actions/checkout@master +      - name: awesome-step-name +        uses: someorg/someaction@version +        with: +          args: some args that I might pass to someaction +``` + +Now you have a workflow that has multiple steps, can be triggered by a specific GitHub event, and can be passed a set of parameters (if that is applicable to that specific Action). This example is _extremely basic_. But luckily, the workflow you're trying to put together is equally simple. This shouldn't be taken as a comprehensive example of a GitHub Action, as there are many more complicated (and elegant) things you can do. If you're interested in learning more, take a look at the [GitHub Actions documentation][12]. + +Now that you have an idea of what a workflow looks like and know what Actions you're interested in using, take a run at plugging the two together. For this example, you want to make sure that whenever your code is updated, it's checked to make sure it's not using any deprecated APIs. + +First, rig up your workflow with some names and the events that you want to trigger off of. Give your workflow and job a useful name that will help you identify it (and what it does). + + +``` +name: API Deprecation Check +on: pull_request, push +jobs: + deprecation-check: +``` + +Next, you need to tell your workflow that you want to trigger these Actions based on any **pull_request** or **push** that happens to this repository because these are the two main events that get new code into a repository. You can do this by utilizing the **on** keyword. + + +``` +name: API Deprecation Check +on: pull_request, push +jobs: +  deprecation-check: +    runs-on: ubuntu-latest +    steps: +      - uses: actions/checkout@master +``` + +Then, add where you want these Actions to run and how the Action can get the code. You can tell the Action where to run by using the **runs-on** keyword. You have a few options here: Windows, Mac, or Ubuntu. In most cases, using Ubuntu is fine, as you'll frequently rely on Actions that run inside their own container (versus running on the base OS that you define here). It's also very important to understand that an Action does not check out code by default. When you need to do something that interacts with your code, make sure to use the Action **actions/checkout**. When this is included, your code will be available within your Action, and you can pass that through to the next step in your workflow. + + +``` +name: API Deprecation Check +on: pull_request, push +name: API Deprecation Check +jobs: +  deprecation-check: +    runs-on: ubuntu-latest +    steps: +      - uses: actions/checkout@master +      - name: curl +        uses: wei/curl@master +        with: +          args: > /github/home/deprek8.rego +``` + +Now that your code is checked out, you can start preparing to do something with it. As mentioned, before you can check code for deprecations, you first need the file that contains the policies that you want to check for, so just retrieve the file using the **curl** Action. This is a fairly straightforward Action, in that it accepts whatever parameters you would normally pass into the curl command. If you were doing something more complicated, this is where you could pass in things like specific HTTP Actions, headers, etc. However, in this case, you're just trying to retrieve a file, so the only thing you need to pass to your Action is the URL you want to retrieve (in this case, the one that contains your raw policy file) and then tell it where you want to write that file. In this case, you're going to have it write to **/github/home**. Why? It's because this filesystem persists between steps and will allow you to use the policy file within this next step. + + +``` +name: API Deprecation Check +on: pull_request, push +jobs: +  deprecation-check: +    runs-on: ubuntu-latest +    steps: +      - uses: actions/checkout@master +      - name: curl +        uses: wei/curl@master +        with: +          args: > /github/home/deprek8.rego +      - name: Check helm chart for deprecation +        uses: instrumenta/conftest-action/helm@master +        with: +          chart: nginx-test +          policy: /github/home/deprek8.rego +``` + +Now that you have your policy file, it's just a matter of running it against the code via **conftest**. Similar to the **curl** Action, the **conftest** Action just expects a series of parameters to understand how it should run against the code. In the example above, it runs against a Helm chart, but it can run against a specific file (or set of files) by changing the **uses** value to **instrumenta/[conftest-action@master][13]**. Just point to the path where your chart sits in the repository and then provide the path to your policy file (specified in the previous step). Once you have all of this together, you have a complete workflow. But what does this look like (assuming there's some bad code in your Helm chart)? To find out, take a look at the [example repository][14]. + +In the Nginx Helm chart, you'll notice that one of the templates is a [statefulset][15]. You may also notice that the apiVersion the StatefulSet is using is **apps/v1beta1**. This API was deprecated in Kubernetes 1.16 and is now hosted in **apps/v1**. So when your GitHub Actions workflow runs, it should detect this issue and serve an error like: + + +``` +FAIL - StatefulSetf/web: API apps/v1beta1 is no longer served by default, use apps/v1 instead. +Error: plugin "conftest" exited with error +##[error]Docker run failed with exit code 1 +``` + +The Action indicates there is something wrong and then fails the rest of the Action. You can see the [full workflow][16] if you are interested. + +### Wrapping up + +This workflow will save some future heartache by alerting you to any deprecated APIs that slip into your codebase. To be clear, this is an _alerting_ mechanism. This won't prevent you from merging bad code into your codebase. But, as long as you pay attention, you should be completely aware prior to (or just after) merging problematic code. + +Where do you go from here? Well, there are a few things to keep in mind. Currently, Deprek8 is up to date as of Kubernetes 1.16. If you're interested in more recent versions, I'm sure Deprek8 would be happy to accept your [pull request][3]. + +The other shortcoming of this method is that the **conftest** and GitHub Actions are a bit limited in that they only allow you to point at specific files or a single chart at a time. What if you want to point at multiple directories of manifests or have multiple charts inside your repository? Currently, the only way to get around that is to either list out every single file you're interested in (in the case of having multiple charts) or have multiple steps inside your workflow. Other scenarios could become problematic, like other templating engines that require some custom logic to pair the parameters and template files together. But a simple workaround for that could be to have a step in your workflow that pulls down Conftest along with a tiny inline script to loop through some of this. I'm sure there are more elegant solutions (and if you come up with one, I'm sure these projects would be more than happy to take a look at your PR). + +Regardless, you now have a mechanism that should allow you to sleep a bit easier when checking in your code! And hopefully, this method will help you build even more robust workflows to protect your code. + +* * * + +_This was originally published in [Tyler Auerbeck's GitHub repository][17] and is reposted, with edits, with permission._ + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/3/deprek8 + +作者:[Tyler Auerbeck][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/tylerauerbeck +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/ship_captain_devops_kubernetes_steer.png?itok=LAHfIpek (Ship captain sailing the Kubernetes seas) +[2]: https://opensource.com/resources/what-is-kubernetes +[3]: https://github.com/naquada/deprek8 +[4]: https://github.com/open-policy-agent/opa +[5]: https://blog.openpolicyagent.org/opas-full-stack-policy-language-caeaadb1e077 +[6]: https://github.com/instrumenta/conftest +[7]: https://github.com/instrumenta/conftest/tree/master/docs +[8]: https://github.com/features/actions +[9]: https://github.com/marketplace?type=actions +[10]: https://github.com/marketplace/actions/github-action-for-curl +[11]: https://github.com/instrumenta/conftest-action +[12]: https://help.github.com/en/actions +[13]: mailto:conftest-action@master +[14]: https://github.com/tylerauerbeck/deprek8-example +[15]: https://raw.githubusercontent.com/tylerauerbeck/deprek8-example/master/nginx-test/templates/statefulset.yaml +[16]: https://github.com/tylerauerbeck/deprek8-example/runs/426774566?check_suite_focus=true +[17]: https://github.com/tylerauerbeck/writing/blob/master/opa/deprek8.md diff --git a/sources/tech/20200327 KubeCF Is What DevOps Wanted- Marrying Cloud Foundry with Kubernetes.md b/sources/tech/20200327 KubeCF Is What DevOps Wanted- Marrying Cloud Foundry with Kubernetes.md new file mode 100644 index 0000000000..f306d94bc7 --- /dev/null +++ b/sources/tech/20200327 KubeCF Is What DevOps Wanted- Marrying Cloud Foundry with Kubernetes.md @@ -0,0 +1,79 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (KubeCF Is What DevOps Wanted: Marrying Cloud Foundry with Kubernetes ) +[#]: via: (https://www.linux.com/articles/kubecf-is-what-devops-wanted-marrying-cloud-foundry-with-kubernetes/) +[#]: author: (Swapnil Bhartiya https://www.linux.com/author/swapnil/) + +KubeCF Is What DevOps Wanted: Marrying Cloud Foundry with Kubernetes  +====== + +[![][1]][2] + +There are times when solutions that  seem to compete against each other turn out to be complementary. [This is exactly what happened with Cloud Foundry and Kubernetes. ][3] + +“Enterprises have moved on from the debate around Cloud Foundry Application Runtime or PaaS experience versus Kubernetes-based experience, and have opted to adopt both. The PaaS experience that Cloud Foundry offers is about optimizing developer time by allowing them to focus on business problems. Let them focus on the app they’re trying to build, not on the plumbing underneath it,” says Chip Childers, CTO at Cloud Foundry ​Foundation. + +“There are plenty of use cases that don’t fit into a PaaS-style architecture. If you look at the breadth of architectures that a typical enterprise deals with, there are tons of applications that you need to just wrap the thing in a container and operate it that way,” he says. + +**Integrating Cloud Foundry and Kubernetes ** + +To incorporate Kubernetes into the Cloud Foundry architecture so Cloud Foundry users can use Kubernetes as an alternative to Diego/Garden to orchestrate application container instances, Cloud Foundry Foundation kickstarted an initiative called [Project Eirini][4]. + +Similarly, [Project Quarks][5] is another incubating effort within the Cloud Foundry Foundation that is focused on packaging the Cloud Foundry Application Runtime as a set of containers instead of virtual machines, enabling easier deployment to Kubernetes. + +“Project Quarks took some code from SUSE called Fizzle. It would take the type of release artifact that our project teams were generally releasing for their component of the system, and work it into a usable Docker image. Then they would use Helm and some scripts to deploy that into Kubernetes,” said Childers. + +There was, however, one crucial piece of the jigsaw missing. + +“There was this code that SUSE had been working on. It was the basis of the SUSE product called SCF (SUSE Cloud Foundry). SCF became [KubeCF][6]. It creates a Kubernetes native distribution of Cloud Foundry,” reveals Childers. + +KubeCF recently hit its 1.0 release. So, where does KubeCF go from here? + +“Presenty, we can look at it as the easiest path to a Kubernetes-native Cloud Foundry for pure open search users. There are some other efforts that are happening in parallel that are taking a look at each component of the Cloud Foundry architecture. Project architects are working towards allowing people to take KubeCF, deploy the whole system to Kubernetes, and take advantage of the simplicity that gets enabled as code gets modified,” says Childers. + +**Developers First: Ensuring Seamless UX** + +One of the strengths of the Cloud Foundry community is that it has always offered a distribution. There is still a distribution called CF deployment, which is based on a VM-centric architecture that uses the Cloud Foundry BOSH platform to orchestrate infrastructures and service environments (or virtualized environments like V-sphere) to deploy VMs and then run the system on top of it. + +However, distribution also entails members of the ecosystem packaging it or dictating with their own offerings. In such a scenario, how can developers expect consistency across the distros? + +“The commonality between both upstream releases — the CF deployment and KubeCF — lies in the components that they sew together to create the Cloud Foundry platform. The Cloud Foundry Platform certification continues to be based on the idea that a certified distribution uses those components in an unmodified way, and integrates them to create that developer experience,” Childers explains. + +“So, regardless of whether you’re deploying to Kubernetes or you’re deploying to virtual machines, regardless of the certified vendor that you use, or if you use upstream distributions, you should have that same developer experience. That’s what Platform Certification ensures,” he says. + +Operational consistency is less a concern for the ecosystem and the community because many of these providers are offering it as a service. “Those that do it as subscription-based software delivery have a lot of tooling around operations that’s specific to them plus all of the other values that they bring together,” Childers avers. + +**Evolution Unabated** + +The KubeCF distribution has finally put the debate of ‘Do I use Kubernetes or do I use Cloud Foundry?’ to rest. + +“The answer should’ve always been ‘You use both.’ The architecture fits one on top of the other very nicely, and overcomes the concerns of dual stacks,” says Childers. + +With the ‘either-or’ debate over, Chip intends to further evolve this architecture, thereby offering an enormous amount of value to enterprises trying to deal with container-centric infrastructure management and developer productivity. + +“We’ve completely re-converged as an ecosystem around embracing the Kubernetes-based infrastructure as being the most popular and rising approach. We’ve been evolving this architecture as a community for years now,” he says. + +“There are huge engineering and commercial teams supporting Kubernetes. VMware has an enormous investment in Kubernetes, and it continues to increase that investment. With the acquisition of Pivotal, VMware also has a huge amount of investment in Cloud Foundry. It’s working aggressively on the mission of bringing the two together. We see the same traction with SAP, IBM, and SUSE, which presents a lot of opportunities for everybody,” adds Childers. + +-------------------------------------------------------------------------------- + +via: https://www.linux.com/articles/kubecf-is-what-devops-wanted-marrying-cloud-foundry-with-kubernetes/ + +作者:[Swapnil Bhartiya][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://www.linux.com/author/swapnil/ +[b]: https://github.com/lujun9972 +[1]: https://www.linux.com/wp-content/uploads/2020/03/color-3580779_1920-1068x667.jpg (color-3580779_1920) +[2]: https://www.linux.com/wp-content/uploads/2020/03/color-3580779_1920.jpg +[3]: https://www.tfir.io/kubecf-a-kubernetes-native-distribution-of-cloud-foundry-chip-childers-cto-cloud-foundry-%e2%80%8bfoundation/ +[4]: https://www.cloudfoundry.org/project-eirini/ +[5]: https://www.cloudfoundry.org/project-quarks/ +[6]: https://github.com/cloudfoundry-incubator/kubecf diff --git a/sources/tech/20200328 Open source fights against COVID-19, Google-s new security tool written in Python, and more open source news.md b/sources/tech/20200328 Open source fights against COVID-19, Google-s new security tool written in Python, and more open source news.md new file mode 100644 index 0000000000..dce9c83a0e --- /dev/null +++ b/sources/tech/20200328 Open source fights against COVID-19, Google-s new security tool written in Python, and more open source news.md @@ -0,0 +1,82 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Open source fights against COVID-19, Google's new security tool written in Python, and more open source news) +[#]: via: (https://opensource.com/article/20/3/news-march-28) +[#]: author: (Scott Nesbitt https://opensource.com/users/scottnesbitt) + +Open source fights against COVID-19, Google's new security tool written in Python, and more open source news +====== +Catch up on the biggest open source headlines from the past two weeks. +![][1] + +In this edition of our open source news roundup, we take a look open source solutions for COVID-19, Google's new security tool, code cleanup software from Uber, and more! + +### Using open source in the fight against COVID-19 + +When COVID-19 started its march around the world, open source [stepped up][2] to try to help stop it. That includes using open data to [create tracking dashboards and apps][3], designing ventilators, and developing protective gear. + +Scientists at the University of Waterloo in Canada have teamed with artificial intelligence firm DarwinAI to create an open source tool "[to identify signs of Covid-19 in chest x-rays][4]." Called COVID-Net, it's neural network "that is particularly good at recognizing images." The dataset the researchers are using is [available on GitHub][5], which includes a link the software. + +Additionally, many [open source hardware projects][6] are underway to expedite the search for a cure.  + +### Google releases tool to fight USB keystroke injection attacks + +One of the sneakiest and potentially most malicious ways to hack a computer is a USB keystroke injection attack. Using a compromised USB device connected to a computer, a hacker can run commands without you even noticing. Google's making it easier for Linux users to fight back against these kinds of attacks by releasing [an open source detection tool][7]. + +Called USB Keystroke Injection Protection, the tool detects "if the keystrokes have been made without human involvement". It does that by measuring "the timing of keystrokes coming from connected USB devices." Sebastian Neuner of Google's Information Security Engineering Team said that while the USB Keystroke Injection Protection tool isn't the last word in defense against these kinds of attacks, but offers "another layer of protection and to defend a user sitting in front of their unlocked machine by them seeing the attack happening." + +You can find the Python source code for the tool [on GitHub][8]. + +### Uber makes code deletion tool open source + +As applications get bigger, they often contain code that's either no longer used or which is obsolete. That added code make software more difficult to maintain. To help solve the problem of quickly finding that redundant code, Uber recently [open sourced a tool called Pirhana][9]. + +Pirhana scans code for [feature flags][10], looking for ones that are no longer used. The software then deletes the unused flags from the code. At the moment, Pirhana works with software written in the Objective-C, Swift, and Java languages. Uber's developers hope the number of supported languages will increase "now that outside developers have an opportunity to contribute to the project." + +You can grab [Pirhana's source code][11] from its repository on GitHub + +#### In other news + + * [Singapore government to open source contact-tracing protocol][12] + * [European Commission to use open source messaging service Signal][13] + * [Spanish software to computerize healthcare in Cameroon and India][14] + * [ING Open-Sources Lion, Its White-Label Web Component Library][15] + * [Open Source Goes Mainstream – How Sharing Is Shaping The Future Of Music][16] + + + +Thanks, as always, to Opensource.com staff members and [Correspondents][17] for their help this week. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/3/news-march-28 + +作者:[Scott Nesbitt][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/scottnesbitt +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/weekly_news_roundup_tv.png?itok=tibLvjBd +[2]: https://jaxenter.com/covid-19-open-source-170237.html +[3]: https://opensource.com/article/20/3/open-source-software-covid19 +[4]: https://www.technologyreview.com/s/615399/coronavirus-neural-network-can-help-spot-covid-19-in-chest-x-ray-pneumonia/ +[5]: https://github.com/lindawangg/COVID-Net +[6]: https://opensource.com/article/20/3/open-hardware-covid19 +[7]: https://www.zdnet.com/article/google-linux-systems-can-use-this-new-tool-against-usb-keystroke-injection-attacks/ +[8]: https://github.com/google/ukip +[9]: https://siliconangle.com/2020/03/17/ubers-open-source-piranha-tool-hunts-redundant-application-code/ +[10]: https://en.wikipedia.org/wiki/Feature_toggle +[11]: https://github.com/uber/piranha +[12]: https://www.computerweekly.com/news/252480501/Singapore-government-to-open-source-contact-tracing-protocol +[13]: https://joinup.ec.europa.eu/collection/open-source-observatory-osor/news/signal-messaging-service +[14]: https://intallaght.ie/spanish-software-to-computerize-healthcare-in-cameroon-and-india/ +[15]: https://www.infoq.com/articles/ing-open-sources-lion-web-component/ +[16]: https://www.forbes.com/sites/andreazarczynski/2020/03/19/open-source-goes-mainstream--how-sharing-is-shaping-the-future-of-music/#9e1ca1290013 +[17]: https://opensource.com/correspondent-program diff --git a/sources/tech/20200329 Nextcloud- The Swiss Army Knife of Remote Working Tools.md b/sources/tech/20200329 Nextcloud- The Swiss Army Knife of Remote Working Tools.md new file mode 100644 index 0000000000..82d84f984b --- /dev/null +++ b/sources/tech/20200329 Nextcloud- The Swiss Army Knife of Remote Working Tools.md @@ -0,0 +1,154 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Nextcloud: The Swiss Army Knife of Remote Working Tools) +[#]: via: (https://itsfoss.com/nextcloud/) +[#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/) + +Nextcloud: The Swiss Army Knife of Remote Working Tools +====== + +Remote working culture has been booming for past few years in coding, graphics and other IT related fields. But the recent [Coronavirus pandemic][1] has made it mandatory for the companies to work from home if it’s possible for them. + +While there are tons of tools to help you and your organization in working from home, let me share one open source software that has the features of several such tools combined into one. + +### Nextcloud Hub: A Suite of Essential Tools for Remote Collaboration + +[Nextcloud][2] is an open source software that can be used to store files, photos and videos for personal usage like Dropbox. But it’s more than just a private [cloud service][3]. + +You can add more than one users in Nextcloud and turn it into a collaboration platform for editing files in real time, chat with users, manage calendars, assign and manage tasks and more. + +This video gives a good overview of its main features: + +[Subscribe to our YouTube channel for more Linux videos][4] + +### Main Features of Nextcloud + +Let me highlight the main features of Nextcloud: + +#### Sync files and share + +![Nextcloud Files][5] + +You can create workspaces based on user groups and share files in those folders. Users can create private files and folders and share them with selected users internally or externally (if they are allowed to). You can lock files in read only mode as well. + +It also has a very powerful search feature that lets you search files from their name or tags. You can comment on files to provide feedback. + +Text files can be edited in real time thanks to its builtin markdown editor. You can use OnlyOffice or Collabora to allow editing of docs, spreadsheet and presentations in real time. + +It also has version control for the files so that you can revert changes easily. + +#### Text Chat, Audio Chat, Video Chat and Web Meetings + +![Nextcloud Video Call][6] + +With NextCloud Talk, you can interact with other users by text messaging, audio calls, video calls and group calls for web meetings. You can also take meeting minutes during the video calls and share your screen for presentations. There is also a mobile app to stay connected all the time. + +You can also create Slack like channels (known as circles) to communicate between members concerned with a specific topic. + +#### Calendar, Contacts & Mail + +![Calendar Nextcloud][7] + +You can manage all of your organization’s contact, divide them into groups based on departments. + +With the calendar, you can see when someone is free or what meetings are taking place, like you do on Outlook. + +You can also use the Mail feature and import the emails from other providers to use them inside Nextcloud interface. + +#### Kanban project management with Deck + +![][8] + +Like Trello and Jira, you can create boards for various projects. You can create cards for each tasks, assign them to users and they can move it between the list based on the status of the task. It’s really up to you how you create boards to manage your projects in Kanban style. + +#### Plenty of add-ons to get more out of Nextcloud + +![Password Manager][9] + +Nextcloud also has several add-ons (called apps). Some are developed by Nextcloud teams while some are from third-party developers. You may use them to extend the capability of Nextcloud. + +For example, you can add a [Feedly style feed reader][10] and read news from various sources. Similarly, the [Paswords addon][11] lets you use Netxcloud as a password manager. You can even share common passwords with other Nextcloud users. + +You can explore [all the apps on its website][12]. You’ll also notice the ratings of apps that will help you decide if you should use an app or not. + +#### Many more features + +Let me summarize all the features here: + + * Open source software that lets you own your data on your own servers + * Seamlessly edit office documents together with others + * Communicate with other members of your organization and do audio and video calls and held web meetings + * Calendar lets you book meetings, brings busy view for meetings and resource booking and more + * Manage users locally or authenticate through LDAP / Active Directory, Kerberos and Shibboleth / SAML 2.0 and more + * Secure data with powerful file access control, multi-layer encryption, machine-learning based authentication protection and advanced ransomware recovery capabilities + * Access existing storage silos like FTP, Windows Network Drives, SharePoint, Object Storage and Samba shares seamlessly through Nextcloud. + * Automation: Automatically turn documents in PDFs, send messages to chat rooms and more! + * Built in ONLYOFFICE makes collaborative editing of Microsoft Office documents accessible to everyone + * Users can install desktop and mobile apps or simply use it in web browser + + + +### How to get Nextcloud + +![][13] + +NextCloud is free and open source software. You can download it and install it on your own server. + +You can use cloud server providers like [Linode][14] or [DigitalOcean][15] that allow you to deploy a brand new Linux server within minutes. And then you can use Docker to install NextCloud. At It’s FOSS, we use [Linode][14] for our NextCloud instance. + +If you don’t want to do that, you can [signup with one of the Nextcloud partners][16] that provide you with configured Nextcloud instance. Some providers also provide a few GB of free data to try it. + +Nextcloud also has an [enterprise plan][17] where Nextcloud team itself handles everything for the users and provide premium support. You can check their pricing [here][18]. + +If you decide to use Nextcloud, you should refer to its documentation or community forum to explore all its features. + +### Conclusion + +At It’s FOSS, our entire team works remote. We have no centralized office anywhere and all of us work from our home. Initially we relied on non-open source tools like Slack, Google Drive etc but lately we are migrating to their open source alternatives. + +Nextcloud is one of the first software we tried internally. It has features of Dropbox, Google Docs, [Slack][19], [Trello][20], Google Hangout all combined in one software. + +NextCloud works for most part but we found it struggling with the video calls. I think that has to do with the fact that we have it installed on a server with 1 GB of RAM that also runs some other web services like [Ghost CMS][21]. We plan to move it to a server with better specs. We’ll see if that should address these issues. + +Since the entire world is struggling with the Coronavirus pandemic, using a solution like Nextcloud could be helpful for you and your organization in working from home. + +How are you coping during the Coronavirus lockdown? Like [Linus Torvalds’ advice on remote working][22], do you also have some suggestion to share with the rest of us? Please feel free to use the comment section. + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/nextcloud/ + +作者:[Abhishek Prakash][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/abhishek/ +[b]: https://github.com/lujun9972 +[1]: https://en.wikipedia.org/wiki/2019%E2%80%9320_coronavirus_pandemic +[2]: https://nextcloud.com/ +[3]: https://itsfoss.com/cloud-services-linux/ +[4]: https://www.youtube.com/c/itsfoss?sub_confirmation=1 +[5]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/03/nextcloud_files.png?ssl=1 +[6]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/03/nextcloud_video_call.jpg?ssl=1 +[7]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/03/calendar_nextcloud.jpeg?ssl=1 +[8]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/03/nextcloud_kanban_project_management_app.jpeg?ssl=1 +[9]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/03/passman.png?fit=800%2C389&ssl=1 +[10]: https://apps.nextcloud.com/apps/news +[11]: https://apps.nextcloud.com/apps/passwords +[12]: https://apps.nextcloud.com/ +[13]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/03/nextcloud-feature.jpg?ssl=1 +[14]: https://www.linode.com/?r=19db9d1ce8c1c91023c7afef87a28ce8c8c067bd +[15]: https://m.do.co/c/d58840562553 +[16]: https://nextcloud.com/signup/ +[17]: https://nextcloud.com/enterprise/ +[18]: https://nextcloud.com/pricing/ +[19]: https://slack.com/ +[20]: https://trello.com/ +[21]: https://itsfoss.com/ghost-3-release/ +[22]: https://itsfoss.com/torvalds-remote-work-advice/ diff --git a/sources/tech/20200330 Access control lists and external drives on Linux- What you need to know.md b/sources/tech/20200330 Access control lists and external drives on Linux- What you need to know.md new file mode 100644 index 0000000000..079e775ce1 --- /dev/null +++ b/sources/tech/20200330 Access control lists and external drives on Linux- What you need to know.md @@ -0,0 +1,233 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Access control lists and external drives on Linux: What you need to know) +[#]: via: (https://opensource.com/article/20/3/external-drives-linux) +[#]: author: (Seth Kenlon https://opensource.com/users/seth) + +Access control lists and external drives on Linux: What you need to know +====== +Learn how to use external drives correctly on Linux. +![Penguin driving a car with a yellow background][1] + +While cloud storage offers many advantages, there's nothing quite like having your data on a physical hard drive. When you save data to a drive, you know exactly where your data is, and it's always available when you need it. When you save data to an external portable drive like a USB thumb drive, it's even better—not only do you know where your data is, but you can take your data with you everywhere you go. If you're new to [Linux][2], or you're trying to use a Linux file system on an external drive, you might find external drives confusing, being prone to permission errors or conflicts, or even losing metadata. + +There are two "right" answers to this: + +### ExFAT + +Formerly, ExFAT was a file system fraught with legal threats from Microsoft because they own the code. They've sued companies and organizations before to defend their ownership of FAT, so it was commonly feared that they could do the same over ExFAT. However, recently. Microsoft made the specifications for ExFAT open source. They didn't provide a driver, unfortunately, but there's an existing drive to make it function on Linux, and, now that developers have access to the full specs, improvements are inevitable. + +The advantage of ExFAT is that it's cross-platform (Windows, Mac, and many portable devices use it), and it's designed without the overhead of file permissions. You can attach a drive formatted as ExFAT to any computer, and all files are available to anyone. Whether that's good or bad depends on your use case, but for portable media, that's often exactly the intent. + +### Access control lists (ACL) + +If you prefer to use a Linux file system on your portable drive, then you can do that, but to make sharing files seamless, you should use access control lists (ACL). + +When you create a file or directory on a drive, there are defaults on your system determining what file permissions it gets. For most cases, those defaults make sense—when you create a file in your home directory, you probably don't want other users to have access to that file. However, when you're creating a file on an external drive, there's a high likelihood that it's because you need to share that file with someone else (even if that someone is you on another computer). + +You can override default permissions for file viewing with an ACL, and you can control default file creation mode by setting a sticky bit. An ACL is a layer of security policies in the extended attributes of directories and files. It allows you to specify exceptions to what the file system permissions indicate. Most notably, this allows you to transcend the single-owner and single-group model of traditional UNIX permissions. + +For instance, while the **seth** (ID 1000) account might own a directory created on my desktop, **seth** (ID 500) on my laptop does not, because the user IDs are different. + +The same could be true for a group. If a directory with group ID 1000 is assigned to a directory on one computer, then a group with an ID 500 or 10922 doesn't have access to it on another computer. But an ACL can add secondary owners and groups to directories and files. + +#### View the current ACL + +Any directory and file on any common Linux filesystem has ACL rules by default. They're stored in extended attributes, a kind of metadata that you don't normally see. + +You can view them in the terminal: + + +``` +$ getfacl ./example +# file: /run/media/drive/example +# owner: seth +# group: users +user::rwx +group::rwx +other::r-- +``` + +The commented lines are just for your reference; they tell you the path, and the owner and group, of the file or directory you're viewing information about. The next lines display the rules applied to the file or directory. In this example, the user permissions are set to **rwx**, the group to **r-x**, and other to **r-x**. These permissions are reflected by a normal filesystem list: + + +``` +$ ls -lA /run/media/drive +drwxrwxr-- 26 seth users 4096 Jan 16 21:04 example +$ id +uid=1000(seth) gid=100(users) groups=100(users)... +``` + +As long as user **seth** (UID 1000) or a member of **group** (GID 100) interacts with the **example** directory, full access is granted. Any other account, however, has only read (**r**) permission. + +#### Setting an ACL + +To modify an ACL, you use the **setfacl** command or use a file manager with ACL support. You can be very specific or very generic when setting your ACL. + +To just modify the filesystem permission settings, you can use either **chmod** or **setfacl**. This is a very generic ACL setting because you're not adding anything to the permissions already available to UNIX from the filesystem specification. + + +``` +$ setfacl --modify g::r example +$ getfacl ./example | grep "group::" +group::r-- +$ ls -l . | grep example +drwxr--r-- 26 seth users 4096 Jan 16 21:04 example +``` + +The same effect is available through **chmod**: + + +``` +$ chmod g+x example +$ getfacl ./example | grep "group::" +group::r-x +$ ls -l . | grep example +drwxr-xr-- 26 seth users 4096 Jan 16 21:04 example +``` + +#### Adding users and groups + +To really benefit from an ACL is to use it for permissions outside the scope of native UNIX permissions. If I'm logged into my desktop as **seth** with user ID 1000, and I know that a directory on my portable drive needs to be usable by **seth** with ID 500 on my laptop, then just declaring **seth** as owner isn't enough because the user IDs aren't the same. + +You can add a user or user ID to an access control list: + + +``` +$ setfacl --modify u:500:rwx example +$ getfacl example +# file: /run/media/drive/example +# owner: seth +# group: users +user::rwx +user:500:rwx +[...] +``` + +A new entry, specific to user ID 500, has been added to the list. Attaching the drive to another Linux or UNIX computer now allows the user with ID 500 to access the **example** folder. + +You can also add users by account name, or groups by either group name or group ID. The IDs are what really count with permissions, though, so if you're in a mixed environment (RHEL servers and Elementary clients, for example), you should verify the user IDs and group IDs lurking behind accounts that seem, on the surface, identical. + +#### Setting default ACL rules + +If you treat access control as a one-time setting, you'll quickly run into problems once your different user accounts start creating files and directories. Any new file or directory created by each user inherits the system's default permissions (and ACL). This means that once laptop user **seth** with ID 500 creates a file in a directory, it could be off-limits to desktop user **seth** with ID 1000 because the owner of the file is set to UID 500. + +A default ACL can be applied to directories so that files and subdirectories created within them inherit the parent ACL. You can set the default ACL of a directory with the **–default** option: + + +``` +$ setfacl --default --modify u:500:rwx example +$ setfacl --default --modify u:1000:rwx example +$ getfacl --omit-header example +user::rwx +user:500:rwx +group::rw- +mask::rwx +other::r-x +default:user::rwx +default:group::rw- +default:group:500:rwx +default:group:1000:rwx +default😷:rwx +default:other::r-x +``` + +When a user creates a new directory within the **example** directory, the inherited ACL is the same as its parent: + + +``` +$ cd example +$ mkdir penguins +$ getfacl --omit-header penguins +user::rwx +group::rw- +group:500:rwx +group:1000:rwx +mask::rwx +other::r-x +default:user::rwx +default:group::rw- +default:group:500:rwx +default:group:1000:rwx +default😷:rwx +default:other::r-x +``` + +This means that any directory or file created inherits the same ACL, so neither user 500 or 1000 are ever excluded from access. + +#### Pragmatic ACL for external drives + +When using a Linux filesystem for external drives, the easy method of ensuring it works with all the users who expect to use the portable drive is to set an ACL on a single top-level directory. + +For instance, assume you have formatted a USB drive called **mydrive** as an ext4 filesystem. You want your account on your laptop and your desktop, as well as your colleague Alice, to be able to access the files. + +First, create a directory at the top level of the drive: + + +``` +$ mkdir /mnt/mydrive/umbrella +``` + +Then apply an ACL to the top-level directory to grant all-important users access: + + +``` +$ setfacl --modify \ +  u:500:rwx,u:1000:rwx,u:alice:rwx \ +  /mnt/mydrive/umbrella +``` + +Finally, apply a default ACL so that all directories and files created within the top-level directory **umbrella** inherit the same default ACL (note that this command uses the short version of **–modify**): + + +``` +$ setfacl --default -m u:500:rwx,u:1000:rwx,u:alice:rwx \ +  /mnt/mydrive/umbrella +``` + +#### Applying defaults to an existing system + +If you need to apply ACL settings to many files that already exist, you can accomplish that with the **find** command. + +First, find all directories and apply ACL rules: + + +``` +$ find /mnt/mydrive/umbrella -type d | \ +  parallel --max-args=6 setfacl \ +  --default -m u:500:rwx,u:1000:rwx,u:alice:rwx +``` + +It's not wise to indiscriminately set all file permissions to executable, so next, find all files and set permissions to **re**. Files that require an executable bit can be set manually or by file extension: + + +``` +$ find /mnt/mydrive/umbrella -type f | \ +  parallel --max-args=6 setfacl \ +  --default -m u:500:rw,u:1000:rw,u:alice:rw +``` + +Adjust the logic of these commands to suit your individual need (don't run a command that removes the executable bit on **/usr**, for instance, or on a directory containing nothing but executable programs). + +### External drives + +Don't let confusion around external drives on Linux get the best of you, and don't limit yourself to traditional UNIX permissions. Put access control lists to work for you, and feel free to use native journaled Linux filesystems on your portable drives. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/3/external-drives-linux + +作者:[Seth Kenlon][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/seth +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/car-penguin-drive-linux-yellow.png?itok=twWGlYAc (Penguin driving a car with a yellow background) +[2]: https://opensource.com/resources/linux diff --git a/sources/tech/20200330 Why I switched from Mac to Linux.md b/sources/tech/20200330 Why I switched from Mac to Linux.md new file mode 100644 index 0000000000..95561b6b45 --- /dev/null +++ b/sources/tech/20200330 Why I switched from Mac to Linux.md @@ -0,0 +1,68 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Why I switched from Mac to Linux) +[#]: via: (https://opensource.com/article/20/3/mac-linux) +[#]: author: (Lee Tusman https://opensource.com/users/leeto) + +Why I switched from Mac to Linux +====== +After 25 years, Lee made the switch to Linux and couldn't be happier. +Here's what he uses. +![Code going into a computer.][1] + +In 1994, my family bought a Macintosh Performa 475 as a home computer. I had used Macintosh SE computers in school and learned to type with [Mavis Beacon Teaches Typing][2], so I've been a Mac user for well over 25 years. Back in the mid-1990s, I was attracted to its ease of use. It didn't start with a DOS command prompt; it opened to a friendly desktop. It was playful. And even though there was a lot less software for Macintosh than PCs, I thought the Mac ecosystem was better, just on the strength of KidPix and Hypercard, which I still think of as the unsurpassed, most intuitive _creative stack_. + +Even so, I still had the feeling that Mac was an underdog compared to Windows. I remember thinking the company could disappear one day. Flash-forward decades later, and Apple is a behemoth, a trillion-dollar company. But as it evolved, it changed significantly. Some changes have been for the better, such as better stabilization, simpler hardware choices, increased security, and more accessibility options. Other changes annoyed me—not all at once, but slowly. Most significantly, I am annoyed by Apple's closed ecosystem—the difficulty of accessing photos without iPhoto; the necessity of using iTunes; and the enforced bundling of the Apple store ecosystem even when I don't want to use it. + +Over time, I found myself working largely in the terminal. I used iTerm2 and the [Homebrew][3] package manager. I couldn't get all my Linux software to work, but much of it did. I thought I had the best of both worlds: the macOS graphical operating system and user interface alongside the ability to jump into a quick terminal session. + +Later, I began using Raspberry Pi computers booting Raspbian. I also collected a number of very old laptops rescued from the trash at universities, so, by necessity, I decided to try out various Linux distros. While none of them became my main machine, I started to really enjoy using Linux. I began to consider what it would be like to try running a Linux distro as my daily driver, but I thought the Macbook's comfort and ease, especially the hardware's size and weight, would be hard to find in a non-Mac laptop. + +## Time to make the switch? + +About two years ago, I began using a Dell for work. It was a larger laptop with an integrated GPU, and dual-booted Linux and Windows. I used it for game development, 3D modeling, some machine learning, and basic programming in C# and Java. I considered making it my primary machine, but I loved the portability of my Macbook Air, and continued to use that as well. + +Last fall, I started to notice my Air was running hot, and the fan was coming on more often. My primary machine was starting to show its age. For years, I used the Mac's terminal to access Darwin's Unix-like operating system, and I was spending more and more time bouncing between the terminal and my web browser. Was it time to make the switch? + +I began exploring the possibilities for a Macbook-like Linux laptop. After doing some research, reading reviews and message boards, I went with the long-celebrated Dell XPS 13 Developer Edition 7390, opting for the 10th Generation i7. I chose it because I love the feel of the Macbook (and especially the slim Macbook Air), and reviews of the XPS 13 suggested it seemed it was similar, with really positive reviews of the trackpad and keyboard. + +Most importantly, it came loaded with Ubuntu. While it's easy enough to get a PC, wipe it, and install a new Linux distro, I was attracted to the cohesive operating system and hardware, but one that allowed a lot of the customization we know and love in Linux. So when there was a sale, I took the plunge and purchased it. + +## What it's like to run Linux daily + +I've been using the XPS 13 for three months and my dual-booted Linux work laptop for two years. At first, I thought I'd want to spend more time finding an alternate desktop environment or window manager that was more Mac-like, such as [Enlightenment][4]. I tried several, but I have to say, I like the simplicity of running [GNOME][5] out of the box. For one thing, it's minimal; there's not much GUI to get caught up in. In fact, it's intuitive and the [overview][6] takes only a couple minutes to read.  + +I can access my applications through the application dash bar or a grid button to get to the application view. To access my file system, I click on the **Files** icon in the dash. To open the GNOME terminal, I type **Ctrl+Alt+T** or just **Alt+Tab** to switch between an open application and an open terminal. It's also easy to define your own [custom hotkey shortcuts][7]. + +Beyond this, there's not much else to say. Unlike the Mac's desktop, there's not a lot to get lost in, which means there's less to distract me from my work or the applications I want to run. I didn't realize all the options or how much time I spent navigating windows on my Mac. In Linux, there are just files, applications, and the terminal. + +I installed the [i3 tiling window manager][8] to do a test run. I had a few issues configuring it because I type in [Dvorak][9], and i3 doesn't adapt to the alternate keyboard configuration. I think with more effort, I could figure out a new keyboard mapping in i3, but the main thing I was looking for was simple tiling. + +I looked up GNOME's tiling capabilities and was pleasantly surprised. You press the **Super** key (for me, it's the key with the Windows logo—which I should cover with a sticker!) and then a modifier key. For example, pressing **Super+Left** moves your current window to a tile on the left side of the screen. **Super+Right** moves to the right half. **Super+Up** maximizes the current window. **Super+Down** reverts to the previous size. You can move between app windows with **Alt+Tab**. This is all default behavior and can be customized in the Keyboard settings. + +Plugging in headphones or connecting to HDMI works the way you expect. Sometimes, I open the Sound settings to switch between the HDMI sound output or my external audio cable, just as I would on a Mac or PC. The trackpad is responsive, and I haven't noticed any difference from the Macbook's. When I plug in a three-button mouse, it works instantly, even with my Bluetooth mouse and keyboard. + +### Software + +I installed Atom, VLC, Keybase, Brave Browser, Krita, Blender, and Thunderbird in a matter of minutes. I installed other software with the Apt package manager in the terminal (as normal), which offers many more packages than the Homebrew package manager for macOS. + +### Music + +I have a variety of options for listening to music. I use Spotify and [PyRadio][10] to stream music. [Rhythmbox][11] is installed by default on Ubuntu; the simple music player launches instantly and without any bloat. Simply click on the menu, choose **Add Music**, and navigate to a directory of audio tracks (it searches recursively). You can also stream podcasts or online radio easily. + +### Text and PDFs + +I tend to write in Markdown in [Neovim][12] with some plugins, then convert my document using Pandoc to whatever final format is needed. For a nice Markdown editor with preview, I downloaded [Ghostwriter][13], a minimal-focus writing application. + +If someone sends me a Microsoft Word document, I can open it using the default LibreOffice Writer application. + +Occasionally, I have to sign a document. This is easy with macOS's Preview application and my signature in PNG format, and I needed a Linux equivalent. I found that the default PDF viewer app didn't have the annotation tools I needed. The LibreOffice Draw program was acceptable but not particularly easy to use, and it occasionally crashed. Based on some research, I installed [Xournal][14], which has the simple annotation tools I need to add dates, text, and my signature and is fairly comparable to Mac's Preview app. It works exactly as needed. + +### Importing images from my phone + +I have an iPhone. To get my images off the phone, there are a number of methods to sync and access your files. If you have a different phone, your process may be different. Here's my method: + + 1. Install gvfs-backends with **sudo apt install gvfs-backends**, which is part of the GNO \ No newline at end of file diff --git a/sources/tech/20200401 How does kanban relate-to DevOps.md b/sources/tech/20200401 How does kanban relate-to DevOps.md new file mode 100644 index 0000000000..3f37c35a4c --- /dev/null +++ b/sources/tech/20200401 How does kanban relate-to DevOps.md @@ -0,0 +1,117 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How does kanban relate to DevOps?) +[#]: via: (https://opensource.com/article/20/4/kanban-devops) +[#]: author: (Willy-Peter Schaub https://opensource.com/users/wpschaub) + +How does kanban relate to DevOps? +====== +Reduce waste, optimize the flow of value, and continuously deliver value +to delighted users. +![two women kanban brainstorming and brainmapping with post-it notes on a whiteboard ][1] + +Kanban is nothing new; in fact, it predates most readers of this article. Its age becomes apparent when we add the year Toyota introduced kanban in its main plant machine shop (1953) to the timeline image from our [analyzing the DNA of DevOps][2] article. + +![DevOps timeline][3] + +I have intuitively been using kanban, in one form or the other, for more than two decades to track personal plans, engineering projects, and digital transformations. Only in the past few weeks have I pondered the origins, power, and synergy of kanban with other frameworks and systems, while introducing teams to kanban and helping them embrace it as a powerful system in our common engineering system. + +### What is kanban? + +Kanban means "visual signal" and has its roots in the Toyota manufacturing industry. It was developed by [Taiichi Ohno][4] to improve manufacturing efficiency. When we jump a few decades into the future, kanban complements agile and lean, often used with frameworks such as scrum, Scaled Agile Framework, and Disciplined Agile to visualize and manage work. + +![Kanban complements agile and lean][5] + +You can explore the many interpretations of kanban on the internet, in books, and in vibrant discussions with other engineers who have embraced the system. In the context of our common collaboration and engineering system, kanban delivers four pivotal practices: + + * **Visualize work:** We visualize all work and look for triggers such as cards turning **red** when the work they represent is blocked or has been dormant for more than two days. + * **Limit work in progress:** We agree on and enforce (soft) work-in-progress limits to encourage reduced batch sizes and manage queue lengths. + * **Focus on flow:** We _pull_ not push work, which helps us to defer commitment until we meet our definition of done (_DoD_) and we have the capacity to commit to the next _activity_. + * **Continuous improvement:** It is important to measure work from when it enters our backlog, how long it takes to get through the process (lead time), and how efficient we are working (cycle/lead time). This enables us to continuously inspect and improve how we work and track progress. + + + +![Kanban practices and terminology][6] + +We use colorful, visual cards to represent activities that flow through one or more _activities_ in one of many _swim lanes_. Each kanban column represents an activity, and each swim lane represents a person, group, or another bucket to segment the cards. There are no rules for the color of the cards, but **red** typically signals a problem. But remember to combine color with a meaningful icon to visualize special states for users who are color-blind. + +> "_We should defer commitment until our Definition of Ready (DOR) is met so that we can ensure that our Definition of Done (DOD) is achieved sooner and with high quality. I like the two distinct terms (DOR and DOD) because the [project owner] should be accountable for the DOR while the team can take ownership of the DOD_." —[Mathew Mathai][7] + +I often use this analogy to explain the difference between _lead_ and _cycle_ time to new teams: Imagine you walk into a restaurant. You sit down, study the menu, and decide what you would like to drink and eat. When the waiter takes your order, the _lead_ cycle time starts ticking. When the bar starts pouring your favorite potion and the kitchen starts preparing your meal, the _cycle_ time starts ticking. As the order arrives at your table, both the lead and cycle time are stopped if (and only if) you are satisfied. + +Therefore, the _lead_ time measures how long you, the customer, had to wait until you received your order. The _cycle_ time measures the process time of an activity to prepare your order. From a customer perspective, the _lead_ time is important. + +It is important to _make your policies explicit_, such as when you start measuring lead and cycle times. Some customers start their "impatience" clock when they enter the restaurant, while others start the clock when they place their order. In both cases, they need to understand how you measure your flow to avoid misunderstandings, unfeasible expectations, and disappointment. + +This image is extracted from one of our information transfer posters, and it summarizes key learnings when we started adopting the kanban system. + +![Key kanban learnings][8] + +### What about DevOps? + +In _[Using PowerShell to automate Linux, macOS, and Windows processes][9]_, we briefly introduced value-stream mapping. It enables us to measure individual and total lead times, cycle times, efficiency, and quality and unearth different activities, groups, and silos that cancel out each other. + +![value-stream mapping][10] + +You will notice a similarity between the kanban board and the value-stream mapping images. Both _visualize_ and _focus_ on the flow of activities represented by individual cards pulled across a visual board. + +![Continuous delivery pipeline][11] + +Continuous flow and efficiency are core to a healthy DevOps mindset. It transforms into a continuous delivery pipeline, as shown above, which unites different teams, such as business, development, security, and quality assurance, to implement ideas from ideation to production. Continuously measuring and streamlining the delivery pipeline not only helps improve the flow of value, but also the quality of value. + +It should be evident that (similar to kanban) the focus here is on flow. Flipping back and forth between activities is frowned upon in kanban and impractical with continuous delivery pipelines. It reminds me of a recent whiteboard discussion where we discussed the challenge of visualizing and managing the flow of work that requires two teams. + +![Dividing a job between two teams][12] + +As shown here, we slice a job that requires team X to perform activities, then team Y, and again team X, into three stories. The three stories are visualized by three cards on two kanban boards, flowing from A to B to C, with clear ownership by team X and Y, which we can measure independently as lead and cycle time. + +We are drifting into another exciting topic of flow optimization … let's get back to the original question. + +### What is the relationship between kanban and DevOps? + +[Donovan Brown][13] defines DevOps as "_the union of people, process, and products to enable continuous delivery of value to our end users._" + +When we unpack this definition, we realize that the core of the DevOps [mindset][14] is to continuously deliver value and delight our customers. + + * _"Feedback from stakeholders is essential."_ + * _"Improve beyond the limits of today's processes."_ + * _"No new silos to break down silos."_ + * _"Knowing your customers means cross-organization collaboration."_ + * _"Inspire adoption through enthusiasm."_ + + + +The kanban system helps us visualize and improve the efficiency of value delivery, resulting in delighted customers. I argue that if you are comfortable with kanban, you will enjoy the full benefits of DevOps through _visualization_, _flow improvement_, _feedback_, and _continuous innovation_. + +We have collaboration at its finest—_synergy_**,** or is that _symbiosis_? + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/4/kanban-devops + +作者:[Willy-Peter Schaub][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/wpschaub +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/whiteboard-brainstorming-brainmapping-design-thinking-postits-kanban.png?itok=Is2Tg1Jk (Brainstorming with post-it notes on a whiteboard) +[2]: https://opensource.com/article/18/11/analyzing-devops +[3]: https://opensource.com/sites/default/files/uploads/devops-timeline.png (DevOps timeline) +[4]: https://en.wikipedia.org/wiki/Taiichi_Ohno +[5]: https://opensource.com/sites/default/files/uploads/kanban-agile-lean-devops.png (Kanban complements agile and lean) +[6]: https://opensource.com/sites/default/files/uploads/kanban-practices-terms.png (Kanban practices and terminology) +[7]: https://opensource.com/users/anicheinc +[8]: https://opensource.com/sites/default/files/uploads/kanban-key-learnings.png (Key kanban learnings) +[9]: https://opensource.com/article/20/2/devops-automation +[10]: https://opensource.com/sites/default/files/uploads/value-stream-mapping.png (value-stream mapping) +[11]: https://opensource.com/sites/default/files/uploads/cd-pipeline.png (Continuous delivery pipeline) +[12]: https://opensource.com/sites/default/files/uploads/splitting-jobs.png (Dividing a job between two teams) +[13]: https://www.donovanbrown.com/post/what-is-devops +[14]: https://opensource.com/article/19/5/values-devops-mindset diff --git a/sources/tech/20200403 Building a sensing prosthetic with the Raspberry Pi.md b/sources/tech/20200403 Building a sensing prosthetic with the Raspberry Pi.md new file mode 100644 index 0000000000..0eef549525 --- /dev/null +++ b/sources/tech/20200403 Building a sensing prosthetic with the Raspberry Pi.md @@ -0,0 +1,85 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Building a sensing prosthetic with the Raspberry Pi) +[#]: via: (https://opensource.com/article/20/4/raspberry-pi-sensebreast) +[#]: author: (Kathy Reid https://opensource.com/users/kathyreid) + +Building a sensing prosthetic with the Raspberry Pi +====== +SenseBreast is an early prototype of a sensing mastectomy prosthetic +based on open hardware. +![Open source doctor.][1] + +_Content advisory: this article contains frank discussions of breast cancer._ + +What's the first question you ask your surgeon when you're discussing reconstruction options after breast cancer? + +"How many USB ports can you give me?" is probably not the one that comes to mind for many people! + +Although the remark was said jokingly, it sparked a thread that would ultimately become [SenseBreast][2]—an early prototype of a sensing mastectomy prosthetic, based on open hardware. + +### How did SenseBreast come about? + +All technology has a history—an origin story of experimentation, missteps, successes, setbacks, and breakthroughs. SenseBreast is no different. SenseBreast was developed as a term project for the Masters of Applied Cybernetics—a highly selective course at the Australian National University's [3A Institute][3]. The mission of the 3Ai is to bring artificial intelligence and cyber-physical systems safely, responsibly, and sustainably to scale. The purpose of the assignment was to explore the nexus between the electronic, virtual world, and the physical, tactile world. + +### What is SenseBreast? + +SenseBreast combines two distinct elements: a cyber component—electronics, sensors, and storage for gathering data, and a physical component—a breast form designed to be worn inside a mastectomy bra. SenseBreast is a rudimentary cyber-physical system. In cyber-physical systems, physical and software components are deeply intertwined and interact in different ways depending on context. + +The SenseBreast draws on a rich heritage of open source hardware and software. Based on the Raspberry Pi 3B+, it uses the Debian-flavored Raspbian operating system, Python to interact with the onboard sensors, and d3.js to visualize the data that the sensors generate. + +Early versions of the SenseBreast used the SenseHAT, but in the true spirit of open source collaboration, I partnered with Australian open source luminary Jon Oxer to develop a custom SenseBreast board. This contains an inertial motion unit (IMU) and temperature, humidity, and pressure sensors, just like the SenseHAT, but in addition, it contains the BME680 volatile gas sensor and a breakout for a heart rate monitor. + +![SenseBreast open hardware board developed by Jon Oxer and Kathy Reid][4] + +SenseBreast is wearable tech, so the physical form of the cyber-physical system is also important. Factors like comfort, texture, and fit in clothing are important in the design of wearables because technology isn't better unless it's better for people! The early attempts at building a housing for SenseBreast were spectacular failures; in fact, the very first iteration was put together using acrylic render and linen cloth, and held together with paper clips—in true hacker style! It wasn't comfortable to wear at all, but it served as a proof point for further exploration. + +![First attempt at creating a breast form using acrylic render covered in linen cloth][5] + +Later iterations used a different approach. This involved taking a cast of a breast, using quick-dry silicone supported by a plaster cast. The resulting mold was then used with slow-setting silicone to create a true-to-life shape. A recess was carved into the form to house the electronic components, and an additional silicone layer was added to protect the wearer's skin from contact with electronics. + +### What did we learn from SenseBreast? + +The key learning from SenseBreast is that data is partial. It only tells part of a story. It can be misleading and untrustworthy, which makes the decisions based on that data unreliable too. For example, the sensor data gathered by SenseBreast was affected by how hard the CPU was working. The graph below plots a sequence of 5 minutes of data from SenseBreast, just after the device has booted. You can see that the temperature decreases over time; this is because the CPU has to work harder as the Raspberry Pi boots, and then cools down after the boot operations are completed. + +![Data visualisation of the readings in SenseBreast using the d3.js library][6] + +These sorts of learnings have implications on a broader scale. + +What if the SenseBreast were not an open source device, but a commercial wearable that stored data about me? What if part of the business model of that company was to sell the data that was harvested? What if my health insurer had access to that data? Or prospective employers? Now, more than ever, it's important that we have private, open solutions for sensing data about ourselves. + +### What's next for the SenseBreast project? + +The SenseBreast is a very early prototype, but it has the potential to develop through many different arcs. It could be used to assess range of movement post-surgery, to research how different garments and fabrics adjust to temperature and humidity, and to identify correlations between ambient air pressure and conditions such as lymphoedema. The path SenseBreast takes will be dependent on the passion, needs, and dedication of the incredible global open source community. + +You can learn more about SenseBreast at [https://sensebreast.org][2] and see my presentation at [linux.conf.au][7] 2020 [here][8]. + +The code for SenseBreast is available on [GitHub][9]. + +Health IT has been surprisingly unwilling to deeply support open source software. Despite the huge... + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/4/raspberry-pi-sensebreast + +作者:[Kathy Reid][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/kathyreid +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/osdc_520x292_opensourcedoctor.png?itok=fk79NwpC (Open source doctor.) +[2]: https://sensebreast.org/ +[3]: https://3ainstitute.cecs.anu.edu.au/ +[4]: https://opensource.com/sites/default/files/uploads/49427571178_bb5df37c3a_c.jpg (SenseBreast open hardware board developed by Jon Oxer and Kathy Reid) +[5]: https://opensource.com/sites/default/files/uploads/49641040471_6d0cc91619_c.jpg (First attempt at creating a breast form using acrylic render covered in linen cloth) +[6]: https://opensource.com/sites/default/files/uploads/49640513813_5a7d63803a_c.jpg (Data visualisation of the readings in SenseBreast using the d3.js library) +[7]: http://linux.conf.au +[8]: https://www.youtube.com/watch?v=G3QfZ11DCpc. +[9]: https://github.com/KathyReid/sensebreast diff --git a/sources/tech/20200407 Love or hate chat- 4 best practices for remote teams.md b/sources/tech/20200407 Love or hate chat- 4 best practices for remote teams.md new file mode 100644 index 0000000000..855c622e49 --- /dev/null +++ b/sources/tech/20200407 Love or hate chat- 4 best practices for remote teams.md @@ -0,0 +1,92 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Love or hate chat? 4 best practices for remote teams) +[#]: via: (https://opensource.com/article/20/4/chat-tools-best-practices) +[#]: author: (Jen Wike Huger https://opensource.com/users/jen-wike) + +Love or hate chat? 4 best practices for remote teams +====== +Plus, learn about a few open source alternatives for chat. +![Chat via email][1] + +Chat is a part of most people's daily lives, especially if you work in tech, and especially if you work with teammates located in different parts of the world. It can be a great way to achieve these goals: + + * **to connect**; to share with teammates on a personal level + * **to get work done**; to communicate with teammates about work in progress + * **to share**; to give notes and feedback from experiences, meetings, and interactions outside of the group that may be relevant to your work or interests + + + +I encourage you to explore [open source alternatives to chat][2] like [Mattermost][3], [Rocket.Chat][4], and [Riot][5]. + +### To chat or not to chat, that is the question + +First, it's important to make time to have a discussion with each member of your team focused on answering whether they are comfortable with using a chat platform to keep in touch throughout the workday. Some people enjoy chat and see it as a vital part of their workday, getting things done and communicating with teammates who they rely on to get that work done and move forward with projects. Others struggle with chat as a way of getting work done and prefer to use it when they feel like having more casual conversations with teammates on topics less focused on work and more on social interaction and personal sharing. Some people wish chat would burn in a fire. + +Gather these opinions and talk through these feelings with each person. You can do this as a group or one-on-one if that feels more appropriate. + +Why? Because communication is important and always will be, and your team will find a way to chat no matter what you do. We're human, and need various levels and types of interaction with each other throughout our days and lives. And when it comes to our work colleagues, it's helpful to put some structure in place to guide your team. + +### Best practices for team chat + +If you have decided to use chat in some form, the next step is to place structure around when and how to use it and **not** use it. These best practices work well for teams who are working remotely and at home, as well as in the office. + +**1\. Create rooms and threads to focus your conversations.** + +My team has a room for each of our sub-teams who work on a particular project together. We also have an at-large room for all of us to banter and share. + +Additionally, we use threads to focus on one topic at a time which is helpful when you have several to dozens of teammates in one room together. It helps conversations to continue and not stop prematurely because they were lost in the mix of other conversations. + +**2\. Decide when your team will be signed in and available to talk.** + +Is it throughout the workday (whatever hours those are for you), during a set timeframe, or as desired? + +My team has set the expectation that they will be signed in and available to chat at some point during the workday **about work-related topics**, and that at that time they will check for and respond to messages that were sent to them while they were away. So, we are using it as an asynchronous way to communicate about work. + +For us, asynchronous chat helps us plan and schedule each day how we see fit with the goal of being productive and serving our project in the best we can _that day_. + +If a teammate does **not** plan on signing in and responding to messages one day, that is OK, and we set the expectation that they will send a message to let the team know. For my team, almost no communication is wrong (see guideline #4), but it should be communicated. We also review our schedules for the following week in a team meeting the week before so we know when someone will be away from their desk, not working, or blocking out a chunk of time for a project. + +**3\. Decide when your teammates are responsible for responding (and when they are not).** + +Use @ mentions if you want someone to see and respond to your question or comment in chat. Don't expect them to be watching every thread and conversation.  + +And I would recommend that you take it a step further and define when teammates should be responsible for responding and when they should not. This type of decision is meant to free you and your teammates, not hold you down. The more you understand the expectations, the freer you are to operate within the same understood universe. When you are unsure of the rules, you may act and make decisions in fear or trepidation instead, like staying signed in to chat all day when you really just need to block it out to get something done. + +Our team has decided that it's nice if you can respond in chat when you are mentioned, but if you don't that is OK. Perhaps you were AFK during that time and lost track of the notification. For us, if you definitely want a response to something from someone, send them an email.  + +**4\. Communicate clearly and with kindness.** + +The way we interpret messages when we are chatting via text is different than when we are chatting verbally, in-person or over video. + +My team uses a lot of humor, emojis, and clear, concise messages to chat with each other. + +We also hold weekly in-person or video conference meetings so that we can get to know each other better. The more you trust someone, the easier it is to give them the benefit of the doubt when you're confused by a message and the better you are at understanding what they are saying and what their intention is behind the text coming through to you. + +### Signing off + +What best practices does your team use? Do you love or hate chat, and why?  + +For all kinds of teams today, chat is a special part of how we stay connected, working, and sharing with each other. Finding ways to do that in a healthy and committed way is part of everyone's responsibility. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/4/chat-tools-best-practices + +作者:[Jen Wike Huger][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/jen-wike +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/email_chat_communication_message.png?itok=LKjiLnQu (Chat via email) +[2]: https://opensource.com/alternatives/slack +[3]: https://mattermost.com/ +[4]: https://rocket.chat/ +[5]: https://riot.im/app/ diff --git a/sources/tech/20200409 GNOME Announces Community Engagement Challenge Offering up to -65,000 in Rewards.md b/sources/tech/20200409 GNOME Announces Community Engagement Challenge Offering up to -65,000 in Rewards.md new file mode 100644 index 0000000000..63de71fec7 --- /dev/null +++ b/sources/tech/20200409 GNOME Announces Community Engagement Challenge Offering up to -65,000 in Rewards.md @@ -0,0 +1,84 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (GNOME Announces Community Engagement Challenge Offering up to $65,000 in Rewards) +[#]: via: (https://itsfoss.com/gnome-community-engagement-challenge/) +[#]: author: (Ankush Das https://itsfoss.com/author/ankush/) + +GNOME Announces Community Engagement Challenge Offering up to $65,000 in Rewards +====== + +It’s always good to see several competitions or challenges trying to promote Free and Open-Source Software (FOSS) more than ever. + +In a recent effort by GNOME with the help of [Endless][1], they announced the inaugural GNOME Community Engagement Challenge. + +This Community Challenge is a part of their original announcement of [coding education challenge for which GNOME was granted $500,000 funding by Endless][2] last year. + +The three-phase challenge aims to attract new developers to engage with FOSS and potentially create new/unique solutions that would gain more traction from the next-gen coders. + +The challenge will involve up to $65,000 in cash prizes. Sounds exciting, right? Let’s take a look at some of the details involved in the challenge. + +![][3] + +### Why The GNOME Community Engagement Challenge? + +In their official [press release][4], they mentioned their primary motive for the challenge: + +> “Through the Challenge we hope to reach a diverse audience, to encourage beginning coders to get involved with the FOSS community to help ensure that free software is available long into the future,” said Neil McGovern, GNOME Foundation Executive Director. “What better way to do that than to reach out to the community itself to come up with creative ways to inspire the next generation?” + +As Neil mentioned above, it’s definitely a good idea to reach out to more people (community) to look for creative ways to promote and work on FOSS projects that will leave a significant impact on the open-source community. + +And, rewarding for the ideas in the form of a challenge will easily get the attention needed. + +### Here’s How The Community Challenge Works + +To quote the official announcement: + +> The Challenge will ask entrants to devise creative ways to promote open-source software to coders typically in high school and college. How a submission will achieve this goal has deliberately been left open-ended to encourage unique, novel approaches. + +So, there’s no particular constraint for the type of ideas or projects you can propose and submit. But, it would be wise to read the usual [terms and conditions][5] to know about the submission rules, eligibility, requirements, prize details, and more. + +Here are the key information about the three phases of the challenge as per the announcement: + + * The **first phase** of the Challenge asks entrants to submit a written proposal for their concept no later than **July 1, 2020**. Twenty entries will be chosen to move to the next round and receive **$1000 each**. + * The **second phase** of the Challenge will require proof of concept, with four entries receiving **$5000** and moving onto the final round. + * The final round will call for a deliverable end product, with the winner receiving **$15,000** and the second place finisher receiving **$10,000**. + + + +They plan to announce the winner of the challenge in the spring of 2021. + +You can take a look at their [challenge FAQ][6] and the [official webpage][7] for more details before starting to submit your entry on **April 9th**. The last date of submission is **July 1, 2020**. + +Head to their website to get started and explore more about the challenge. + +[GNOME Community Engagement Challenge][7] + +### Wrapping Up + +I think this is a perfect opportunity for developers to get started with FOSS projects that will end up rewarding them with a good amount of money and help the community at the same time. + +What do you think about the community engagement challenge by GNOME? Feel free to let me know your thoughts in the comments below. + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/gnome-community-engagement-challenge/ + +作者:[Ankush Das][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://itsfoss.com/author/ankush/ +[b]: https://github.com/lujun9972 +[1]: https://www.endlessnetwork.com/ +[2]: https://itsfoss.com/endless-gnome-coding-education-challenge/ +[3]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/04/gnome-community-challenge.png?ssl=1 +[4]: https://www.gnome.org/news/2020/04/gnome-foundation-and-endless-launch-inaugural-community-engagement-challenge/ +[5]: https://www.gnome.org/challenge/terms/ +[6]: https://www.gnome.org/challenge/faq/ +[7]: https://www.gnome.org/challenge/ diff --git a/sources/tech/20200409 How to set up a remote school environment for kids with Linux.md b/sources/tech/20200409 How to set up a remote school environment for kids with Linux.md new file mode 100644 index 0000000000..327af54c79 --- /dev/null +++ b/sources/tech/20200409 How to set up a remote school environment for kids with Linux.md @@ -0,0 +1,75 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How to set up a remote school environment for kids with Linux) +[#]: via: (https://opensource.com/article/20/4/school-home-linux) +[#]: author: (Alan Formy-Duval https://opensource.com/users/alanfdoss) + +How to set up a remote school environment for kids with Linux +====== +Repurpose an old computer to support the new home-schooler in your life. +![Image by Alan Formy-Duvall][1] + +COVID-19 has suddenly thrown all of us into a new and challenging situation. Many of us are now working full-time from home, and for a lot of us (especially people who aren't used to working remotely), this is taking some getting used to. + +Another group that is similarly challenged is our kids. They can't go to school or participate in their regular after-school activities. My daughter's elementary school closed its classrooms and is teaching through an online, web-based learning portal instead. And one of her favorite extracurricular activities—a coding school where she has been learning Scratch and just recently "graduated" to WoofJS–has also gone to an online-only format. + +We are fortunate that so many of our children's activities can be done online now, as this is the only way they will be able to learn, share, and socialize for at least the next several months. + +### Setting up a temporary homeschool environment + +When our daughter's school went to an online-only format, we realized she needed a place and some tools to do her work. So we cleaned off her desk and cleared the toys from the floor around it to make an "office" for her. We also realized she would need a computer. While I could have shopped online and ordered a new computer (and spent at least several hundred dollars—if not more than $1,000—in the process), I chose an alternative and put an old, unused laptop back to work. + +If you have an unused computer sitting around and are willing to do a bit of tech work, you, too, can set something up to get your kids online. Here's how I did it. + +### The hardware + +While my daughter already has her own small IT department (as I like to say), it consists of some gaming systems, a tablet, and a Chromebook. Even her Chromebook has just an 11.6" screen and a small keyboard, so none of her devices are really quite adequate for full-time school duty. + +So we found ourselves in a pinch. She really needed a desktop-capable computer system with a decent-sized screen, a full keyboard, a good-quality microphone, a set of speakers, and a headphone jack. And having an external video connector helps if you decide one screen isn't enough. + +I didn't have a spare desktop, but I did have a laptop: a Lenovo G550 with a Pentium Dual-Core T4500 2.3GHz processor and 4GB RAM. I replaced its aging 5400RPM spindle hard drive with a 240GB solid-state drive. The laptop has a 15.6" screen, which is much easier to view than the small screens on her other devices, and a comfortable, full-size keyboard. Its CPU scores a bit better in PassMark's benchmarks (913 vs. 674) than the 1.6GHz Intel Celeron N3060 Dual-Core in the Chromebook. + +However, it is 10 years old, certainly on the edge of usability by today's standards. But, thanks to the efficiency of the Linux operating system, it gets the job done. I installed the latest version (v31) of [Fedora Workstation][2], but many other distributions will work just fine. If you really want to eke out every drop of performance, you could use one of the [lightweight Linux distributions][3]. The only area that required a little extra effort with Fedora was the wireless; I had to install the driver for the Broadcom WiFi hardware. But really, this was only a few extra steps and a restart, and it was good to go. + +Linux supports all of the other hardware in the laptop. My daughter prefers a full-sized mouse over the touchpad, so I attached one. She likes the keyboard on this laptop, but if she wants an external keyboard, there are enough USB ports to hook one up. + +It has a traditional 3.5mm audio jack, so she can use headphones. I recommend giving children decibel-limited headphones to protect their hearing. + +Even though this laptop has a 15.6" widescreen display, I think having a second monitor gives the best experience. I have a spare that I might hook up to the external VGA connector. + +### The software + +My daughter's school set up an online learning portal. The benefit is that students just need a supported web browser to log on and get to work, and I thank the school for its efforts and choice of a vendor-agnostic solution. Most Linux distributions include the Mozilla Firefox web browser installed by default, and Linux provides a full operating system, so I can install any applications she might need. Fedora is also updated regularly (unlike the old Windows Vista that came with the laptop and is no longer supported). + +![][4] + +Scratch running on Fedora + +Her extracurricular coding school is using the Zoom client. I'm happy to report that it was an easy [install with RPM][5] and works great on Fedora 31. + +### Success! + +My daughter has no trouble using her new laptop. She likes the [GNOME desktop][6], particularly the fact that it "Looks like Dad's!" This is turning out to be a great experiment in practical (and under-pressure) use of a Linux desktop. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/4/school-home-linux + +作者:[Alan Formy-Duval][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/alanfdoss +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/homeschool.jpg?itok=vYEd9NON (Image by Alan Formy-Duvall) +[2]: https://getfedora.org/en/workstation/ +[3]: https://opensource.com/article/19/6/linux-distros-to-try +[4]: https://opensource.com/sites/default/files/scratch.jpg +[5]: https://zoom.us/download?os=linux +[6]: https://www.gnome.org/ diff --git a/sources/tech/20200409 Print double-sided documents at home with this simple Bash script.md b/sources/tech/20200409 Print double-sided documents at home with this simple Bash script.md new file mode 100644 index 0000000000..daacfa8365 --- /dev/null +++ b/sources/tech/20200409 Print double-sided documents at home with this simple Bash script.md @@ -0,0 +1,152 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Print double-sided documents at home with this simple Bash script) +[#]: via: (https://opensource.com/article/20/4/print-duplex-bash-script) +[#]: author: (Jim Hall https://opensource.com/users/jim-hall) + +Print double-sided documents at home with this simple Bash script +====== +Use this script and save yourself the hassle and wasted paper of trying +to manually load and print double-sided documents. +![bash logo on green background][1] + +We have a laser printer at home. This Hewlett Packard LaserJet Pro CP1525nw Color Printer is an older model, but it has been a great workhorse that prints reliably and in color. I [put it on our home network][2] a few years ago using our [Raspberry Pi][3] as a print server. + +The LaserJet has been a great addition to my home office. Since [I launched my company][4] last year, I have relied on this little laser printer to print handouts and other materials for client meetings, workshops, and training sessions. + +My only gripe with this printer is that it prints single-sided only. If you want to print double-sided, you need to set up a custom print job to do it yourself. That's inconvenient and requires manual steps. In LibreOffice, I need to specifically set up the print job to print the odd-numbered pages first, then reload the paper before printing the even-numbered pages on the other side—but in reverse order. + +![LibreOffice print dialog][5] + +If I need to print a PDF that someone has sent me, the process is the same. For a four-page document, I first need to print pages 1 and 3, then reload the paper and print pages 2 and 4 in reverse order. In the GNOME print dialog, you need to select "Page Setup" to print odd pages or even pages. + +![Gnome print dialog][6] + +![Gnome page setup][7] + +Regardless of how I print, the overall process is to print the odd-numbered pages, reload the stack of printed pages into the paper tray, then print the even-numbered pages in reverse order. If I'm printing a four-page document, printing the even-numbered pages in reverse order means page 4 prints on the back of page 3 and page 2 prints on the back of page 1. Imagine my frustration in those few instances when I forgot to select the option to print in reverse order when printing the even-numbered pages and ruined a long print job. + +Similarly, it's easy to forget how to deal with documents that have an odd number of pages. In a five-page document, you first print pages 1, 3, and 5. But when you reload the printed pages into the printer, you don't want page 5. Instead, you only want to load pages 1 and 3. Otherwise, page 4 will print on the back of page 5, page 2 will print on the back of page 3, and nothing gets printed on the back of page 1. + +To make things easier and more reliable, I wrote a simple Bash script that automates printing duplex. This is basically a wrapper to print odd-numbered pages, remind me to reload the pages (and remove the last page if needed), then print the even-numbered pages. + +Whenever I need to print a document as duplex, I first convert the document to PDF. This is very easy to do. In LibreOffice, there's a toolbar icon to export directly as PDF. You can also navigate under **File— Export As—Export as PDF** to do the same. Or in any other application, there's usually a **Save to PDF** feature. When in doubt, GNOME supports printing to a PDF file instead of a printer. + +![Libre Office toolbar][8] + +![Export as PDF][9] + +### How it works + +Once I've saved to PDF, I let my Bash script do the rest. This really just automates the **lpr** commands to make printing easier. It prints odd pages first, prompts me to reload the paper, then prints the even pages. If the document has an odd number of pages, it also reminds me to remove the last page when I reload the printed pages. It's pretty simple. + +The only "programming" part of the script is determining the page count, and figuring out if that's an even or odd number. Both of those are easy to do. + +To determine the page count, I use the **pdfinfo** command. This generates useful info about a PDF document. Here's some sample output: + + +``` +$ pdfinfo All\ training\ -\ catalog.pdf +Creator:        Writer +Producer:       LibreOffice 6.3 +CreationDate:   Fri Oct 18 16:06:07 2019 CDT +Tagged:         no +UserProperties: no +Suspects:       no +Form:           none +JavaScript:     no +Pages:          11 +Encrypted:      no +Page size:      612 x 792 pts (letter) +Page rot:       0 +File size:      65623 bytes +Optimized:      no +PDF version:    1.5 +``` + +That output is very easy to parse. To get the page count, I use an AWK one-line script to look for **Pages:** and print the second field. + + +``` +`pages=$( pdfinfo "$1" | awk '/^Pages:/ {print $2}' )` +``` + +To figure out if this is an odd or even number, I use the modulo (**%**) arithmetic operator to divide by two and tell me the remainder. The modulo of two will always be zero for an even number, and one for an odd number. I use this simple test to determine if the document has an odd number of pages, so I'll need to remove the last page before printing the rest of the document: + + +``` +`if [ $(( $pages % 2 )) -ne 0 ] ; then` +``` + +With that, writing the **print-duplex.sh** Bash script is a simple matter of calling **lpr** with the correct options to send output to my printer (**lpr -P "HP_LaserJet_CP1525nw"**), to print odd-numbered pages (**-o page-set=odd**) or even-numbered pages (**-o page-set=even**), and to print in reverse order (**-o outputorder=reverse**). + +### Bash script + + +``` +#!/bin/sh +# print-duplex.sh +# simple wrapper to print duplex + +cat<<EOF +$1 ($pages pages) +\------------------------------------------------------------------------------- +Printing odd pages first +Please wait for job to finish printing... +\------------------------------------------------------------------------------- +EOF + +lpr -P "HP_LaserJet_CP1525nw" -o page-set=odd "$1" +sleep $pages + +cat<<EOF +=============================================================================== +Put paper back into the printer in EXACT OUTPUT ORDER (face down in tray) +then press ENTER +=============================================================================== +EOF + +pages=$( pdfinfo "$1" | awk '/^Pages:/ {print $2}' ) + +if [ $(( $pages % 2 )) -ne 0 ] ; then +  echo '!! Remove the last page - this document has an odd number of pages' +fi + +echo -n '>' +read x + +cat<<EOF +\------------------------------------------------------------------------------- +Printing even pages +Please wait for job to finish printing... +\------------------------------------------------------------------------------- +EOF + +lpr -P "HP_LaserJet_CP1525nw" -o page-set=even -o outputorder=reverse "$1" +``` + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/4/print-duplex-bash-script + +作者:[Jim Hall][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/jim-hall +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/bash_command_line.png?itok=k4z94W2U (bash logo on green background) +[2]: https://opensource.com/article/18/3/print-server-raspberry-pi +[3]: https://opensource.com/resources/raspberry-pi +[4]: https://opensource.com/article/19/9/business-creators-open-source-tools +[5]: https://opensource.com/sites/default/files/uploads/print_dialog_-_libreoffice_0.png (LibreOffice print dialog) +[6]: https://opensource.com/sites/default/files/uploads/print_dialog_-_gnome_0.png (Gnome print dialog) +[7]: https://opensource.com/sites/default/files/uploads/print_dialog_-_gnome_-_page_setup.png (Gnome page setup) +[8]: https://opensource.com/sites/default/files/uploads/toolbar_-_export_as_pdf_-_libreoffice.png (Libre Office toolbar) +[9]: https://opensource.com/sites/default/files/uploads/file_-_export_as_pdf_-_libreoffice.png (Export as PDF) diff --git a/sources/tech/20200409 Use Emacs Org mode to easily create LaTeX documents.md b/sources/tech/20200409 Use Emacs Org mode to easily create LaTeX documents.md new file mode 100644 index 0000000000..461c52a8a5 --- /dev/null +++ b/sources/tech/20200409 Use Emacs Org mode to easily create LaTeX documents.md @@ -0,0 +1,142 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Use Emacs Org mode to easily create LaTeX documents) +[#]: via: (https://opensource.com/article/20/4/emacs-org-mode) +[#]: author: (Peter Prevos https://opensource.com/users/danderzei) + +Use Emacs Org mode to easily create LaTeX documents +====== +You can use LaTeX for scientific and technical documents without all of +the confusing commands and syntax you would normally need. +![Filing cabinet for organization][1] + +LaTeX is a powerful system, especially for writing scientific and technical documents. But writing documents in LaTeX can be confusing because you need to know a lot of commands, and your text is littered with backslashes, curly braces, and other syntax distractions. But being productive as a writer requires that you focus on the text's content instead of how it looks. Fortunately, the [GNU Emacs][2] Org mode extension makes it easy to write plain-text documents and seamlessly export them to LaTeX and PDF. + +[Org mode][3] is a built-in Emacs extension that helps you keep notes, maintain to-do lists, manage projects, and author documents with a fast and effective plain-text system. Emacs also comes with [AUCTeX][4], an extensible package for writing TeX files in Emacs. AUCTeX has a preview module that shows the results of what you type, but I find it distracting because it draws my attention away from the document's content to its design. Writing text in Org mode is my preferred option because the source remains a plain-text file with minimal typesetting elements. The text is independent of its result because Org mode can export it to multiple formats, including LaTeX and PDF. + +Emacs is known for being difficult to use with a steep learning curve. But Emacs is only difficult when you want to fine-tune the default settings. By following a minimalist approach to using the vanilla GNU Emacs, this article will get you quickly and easily on your way to writing beautiful documents without any complex configuration. + +### First steps + +Before you begin, [install Emacs][5] and a fully functioning version of [LaTeX][6] on your computer. + +Next, you need to learn some conventions. In Emacs lingo, the abbreviation **C-c** means to enter **Ctrl+C** on your keyboard. The abbreviation **M-x** means **Alt+X**. The M stands for the mod key, which no longer exists in modern systems. The **S** prefix indicates the **Shift** key. + +The **find-file** function, which you start with the **C-x C-f** keystroke combination, creates a new document or opens an existing document. Entering this function opens a dialog in the mini-buffer at the bottom of the screen, which is where Emacs communicates with the user. Type the name of the file you want to create or open into the mini-buffer. Emacs is sensitive to file extensions, so make sure that the name of your document ends in **.org**. + +In Emacs speak, opening or creating a file is called ["visiting" a file][7]. Visiting a file means reading its contents into an Emacs buffer so that it is available for editing. Emacs generates a new buffer for each file you visit. + +### Writing prose with Org mode + +Once you're visiting a file, you can start typing your text the same way you would in any text editor or word processor. Some conventions: Begin the file with **#+TITLE:** to denote the title of the document and **#+AUTHOR** for your name. These options are used when exporting the file. Org mode recognizes a range of [export settings][8] to configure the output. For example, to suppress the table of contents, enter **#+OPTIONS: toc:nil**. + +Org mode has its own Markdown-like conventions to format your document. [Headlines][9] start with one or more asterisks. Org mode can [collapse a headline][10] to render parts of it invisible with the **TAB** or **S-TAB** keys. You can make words ***bold***, **/italic/**, **_underlined_**, or **=verbatim=**. The Org manual describes the many options for [rich text][11]. + +One minor issue with plain-vanilla Emacs that you will quickly notice is it does not wrap lines at the end of the visible screen. Emacs has several line-wrapping functions, and [Visual Line mode][12] is the most useful for writing long-form text. To activate this mode, use **M-x** and enter **visual-line-mode** in the mini-buffer at the bottom of the screen. The **M-x** keyboard shortcut enables executing functions for which there is no direct keyboard shortcut. + +Adding [images][13] is as easy as adding a link to the image file within double square brackets: + + +``` +`[[file:path_to_image.png]]` +``` + +Org has a great system for [formatting tables][14] in plain ASCII. Any line with **|** is considered part of a table. The vertical line is also the column separator. A line starting with **|-** is rendered as a horizontal rule, and rows before the first horizontal rule are header lines. A table might look like this in the source file: + + +``` +| Name  |   id | Age | +|-------+------+-----| +| Peter | 1234 |  50 | +| Sue   | 4321 |  54 | +``` + +Both images and tables are preceded with **#+CAPTION:** to add a [caption][15]. Advanced options are also available to control float placement and size of figures. + +Emacs has extensive [editing functions][16] to make you more efficient when typing text. Spell checking, thesaurus, auto-completion, and an undo tree are just some of the tools that help you write efficiently. + +### Adding LaTeX snippets to Org + +In addition to the text itself, Org mode-text can include simple LaTeX commands, such as **\newpage**, within the text. Equations in standard LaTeX syntax are placed between dollar signs **$e^{i\pi} + 1 = 0$**. The **org-latex-preview** function (**C-c C-x C-l**) shows a [preview][17] of any LaTeX equations within the text buffer. Last, you can also add complete LaTeX snippets to insert complex content. The code has to be placed in an export block: + + +``` +#+BEGIN_EXPORT latex +\setlength{\unitlength}{1cm} +\thicklines +\begin{picture}(10,6) +\put(2,2.2){\line(1,0){6}} +\put(2,2.2){\circle{2}} +\put(6,2.2){\oval(4,2)[r]} +\end{picture} +#+END_EXPORT +``` + +### Exporting to LaTeX + +Org mode includes a powerful export module to convert your files to many formats using the powerful [Pandoc][18] software. Start the export module with the **org-export-dispatch** function, which you can run with the **C-c C-e** keyboard shortcut. The dispatch will split your screen and provide a range of options. + +First, Pandoc converts the Org mode file to a LaTeX file. Then you can choose to open the LaTeX file in a new buffer or save it as a file. Org mode can also directly render a PDF file, which you can view within Emacs or save to disk. + +![Emacs with Org mode source and PDF preview][19] + +### Advanced use + +This article provides a first taste of writing prose in Org mode and LaTeX. Org mode has numerous configuration options to fine-tune your document or to change default settings. + +By default, Org mode uses the article style to export documents, but you can change this with export settings. These settings can also be used to add commands to the document header, for example: + + +``` +#+LATEX_CLASS: report +#+LATEX_CLASS_OPTIONS: [a4paper] +#+LATEX_HEADER: \usepackage{times} +``` + +If you write scientific documents, the [org-ref][20] package by John Kitchin provides Org-mode modules for citations, cross-references, and bibliographies in Org mode and useful BibTeX tools to go with it. + +The Org mode manual's [LaTex export][21] section provides a detailed discussion of the functionality available. + +### Conclusion + +Org mode is a perfect editor for writing LaTeX. The main advantage is that you lose the clutter of LaTeX syntax and can focus on the text. This comes at no cost because you can still add LaTeX code as much as you need, and you get access to the powerful editing functions in Emacs. + +Using Org to write books and articles allows you to focus on the text as you combine two of the oldest and most powerful pieces of open source software. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/4/emacs-org-mode + +作者:[Peter Prevos][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/danderzei +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/files_documents_organize_letter.png?itok=GTtiiabr (Filing cabinet for organization) +[2]: https://opensource.com/article/20/3/getting-started-emacs +[3]: https://orgmode.org +[4]: https://www.gnu.org/software/auctex/ +[5]: https://www.gnu.org/software/emacs/ +[6]: https://www.latex-project.org/get/ +[7]: https://www.gnu.org/software/emacs/manual/html_node/emacs/Visiting.html +[8]: https://orgmode.org/manual/Export-Settings.html +[9]: https://orgmode.org/manual/Headlines.html#Headlines +[10]: https://orgmode.org/manual/Global-and-local-cycling.html#Global-and-local-cycling +[11]: https://orgmode.org/manual/Markup-for-Rich-Contents.html#Markup-for-Rich-Contents +[12]: https://www.gnu.org/software/emacs/manual/html_node/emacs/Visual-Line-Mode.html +[13]: https://orgmode.org/manual/Images.html +[14]: https://orgmode.org/manual/Built_002din-Table-Editor.html#Built_002din-Table-Editor +[15]: https://orgmode.org/manual/Captions.html#Captions +[16]: https://www.gnu.org/software/emacs/manual/html_node/emacs/Basic.html#Basic +[17]: https://orgmode.org/manual/Previewing-LaTeX-fragments.html +[18]: https://pandoc.org/ +[19]: https://opensource.com/sites/default/files/uploads/org-mode-latex-screenshot.png (Emacs with Org mode source and PDF preview.) +[20]: https://github.com/jkitchin/org-ref +[21]: https://orgmode.org/manual/LaTeX-Export.html#LaTeX-Export diff --git a/sources/tech/20200410 Get started with Bash programming.md b/sources/tech/20200410 Get started with Bash programming.md new file mode 100644 index 0000000000..875adb9876 --- /dev/null +++ b/sources/tech/20200410 Get started with Bash programming.md @@ -0,0 +1,157 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Get started with Bash programming) +[#]: via: (https://opensource.com/article/20/4/bash-programming-guide) +[#]: author: (Seth Kenlon https://opensource.com/users/seth) + +Get started with Bash programming +====== +Learn how to write custom programs in Bash to automate your repetitive +tasks. Download our new eBook to get started. +![Command line prompt][1] + +One of the original hopes for Unix was that it would empower everyday computer users to fine-tune their computers to match their unique working style. The expectations around computer customization have diminished over the decades, and many users consider their collection of apps and websites to be their "custom environment." One reason for that is that the components of many operating systems are not open, so their source code isn't available to normal users. + +But for Linux users, custom programs are within reach because the entire system is based around commands available through the terminal. The terminal isn't just an interface for quick commands or in-depth troubleshooting; it's a scripting environment that can reduce your workload by taking care of mundane tasks for you. + +### How to learn programming + +If you've never done any programming before, it might help to think of it in terms of two different challenges: one is to understand how code is written, and the other is to understand what code to write. You can learn _syntax_—but you won't get far without knowing what words are available to you in the _language_. In practice, you start learning both concepts all at once because you can't learn syntax without words to arrange, so initially, you write simple tasks using basic commands and basic programming structures. Once you feel comfortable with the basics, you can explore more of the language so you can make your programs do more and more significant things. + +In [Bash][2], most of the _words_ you use are Linux commands. The _syntax_ is Bash. If you already use Bash on a frequent basis, then the transition to Bash programming is relatively easy. But if you don't use Bash, you'll be pleased to learn that it's a simple language built for clarity and simplicity. + +### Interactive design + +Sometimes, the hardest thing to figure out when learning to program is what a computer can do for you. Obviously, if a computer on its own could do everything you do with it, then you wouldn't have to ever touch a computer again. But the reality is that humans are important. The key to finding something your computer can help you with is to take notice of tasks you repeatedly do throughout the week. Computers handle repetition particularly well. + +But for you to be able to tell your computer to do something, you must know how to do it. This is an area Bash excels in: interactive programming. As you perform an action in the terminal, you are also learning how to script it. + +For instance, I was once tasked with converting a large number of PDF books to versions that would be low-ink and printer-friendly. One way to do this is to open the PDF in a PDF editor, select each one of the hundreds of images—page backgrounds and textures counted as images—delete them, and then save it to a new PDF. Just one book would take half a day this way. + +My first thought was to learn how to script a PDF editor, but after days of research, I could not find a PDF editing application that could be scripted (outside of very ugly mouse-automation hacks). So I turned my attention to finding out to accomplish the task from within a terminal. This resulted in several new discoveries, including GhostScript, the open source version of PostScript (the printer language PDF is based on). By using GhostScript for the task for a few days, I confirmed that it was the solution to my problem. + +Formulating a basic script to run the command was merely a matter of copying the command and options I used to remove images from a PDF and pasting them into a text file. Running the file as a script would, presumably, produce the same results. + +### Passing arguments to a Bash script + +The difference between running a command in a terminal and running a command in a shell script is that the former is interactive. In a terminal, you can adjust things as you go. For instance, if I just processed **example_1.pdf** and am ready to process the next document, to adapt my command, I only need to change the filename. + +A shell script isn't interactive, though. In fact, the only reason a shell _script_ exists is so that you don't have to attend to it. This is why commands (and the shell scripts that run them) accept arguments. + +In a shell script, there are a few predefined variables that reflect how a script starts. The initial variable is **$0**, and it represents the command issued to start the script. The next variable is **$1**, which represents the first "argument" passed to the shell script. For example, in the command **echo hello**, the command **echo** is **$0,** and the word **hello** is **$1**. In the command **echo hello world**, the command **echo** is **$0**, **hello** is **$1**, and **world** is **$2**. + +In an interactive shell: + + +``` +$ echo hello world +hello world +``` + +In a non-interactive shell script, you _could_ do the same thing in a very literal way. Type this text into a text file and save it as **hello.sh**: + + +``` +`echo hello world` +``` + +Now run the script: + + +``` +$ bash hello.sh +hello world +``` + +That works, but it doesn't take advantage of the fact that a script can take input. Change **hello.sh** to this: + + +``` +`echo $1` +``` + +Run the script with two arguments grouped together as one with quotation marks: + + +``` +$ bash hello.sh "hello bash" +hello bash +``` + +For my PDF reduction project, I had a real need for this kind of non-interactivity, because each PDF took several minutes to condense. But by creating a script that accepted input from me, I could feed the script several PDF files all at once. The script processed each one sequentially, which could take half an hour or more, but it was a half-hour I could use for other tasks. + +### Flow control + +It's perfectly acceptable to create Bash scripts that are, essentially, transcripts of the exact process you took to achieve the task you need to be repeated. However, scripts can be made more powerful by controlling how information flows through them. Common methods of managing a script's response to data are: + + * if/then + * for loops + * while loops + * case statements + + + +Computers aren't intelligent, but they are good at comparing and parsing data. Scripts can feel a lot more intelligent if you build some data analysis into them. For example, the basic **hello.sh** script runs whether or not there's anything to echo: + + +``` +$ bash hello.sh foo +foo +$ bash hello.sh + +$ +``` + +It would be more user-friendly if it provided a help message when it receives no input. That's an if/then statement, and if you're using Bash in a basic way, you probably wouldn't know that such a statement existed in Bash. But part of programming is learning the language, and with a little research you'd learn about if/then statements: + + +``` +if [ "$1" = "" ]; then +        echo "syntax: $0 WORD" +        echo "If you provide more than one word, enclose them in quotes." +else +        echo "$1" +fi +``` + +Running this new version of **hello.sh** results in: + + +``` +$ bash hello.sh +syntax: hello.sh WORD +If you provide more than one word, enclose them in quotes. +$ bash hello.sh "hello world" +hello world +``` + +### Working your way through a script + +Whether you're looking for something to remove images from PDF files, or something to manage your cluttered Downloads folder, or something to create and provision Kubernetes images, learning to script Bash is a matter of using Bash and then learning ways to take those scripts from just a list of commands to something that responds to input. It's usually a process of discovery: you're bound to find new Linux commands that perform tasks you never imagined could be performed with text commands, and you'll find new functions of Bash to make your scripts adaptable to all the different ways you want them to run. + +One way to learn these tricks is to read other people's scripts. Get a feel for how people are automating rote commands on their systems. See what looks familiar to you, and look for more information about the things that are unfamiliar. + +Another way is to download our [introduction to programming with Bash][3] eBook. It introduces you to programming concepts specific to Bash, and with the constructs you learn, you can start to build your own commands. And of course, it's free to download and licensed under a [Creative Commons][4] license, so grab your copy today. + +### [Download our introduction to programming with Bash eBook!][3] + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/4/bash-programming-guide + +作者:[Seth Kenlon][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/seth +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/command_line_prompt.png?itok=wbGiJ_yg (Command line prompt) +[2]: https://opensource.com/resources/what-bash +[3]: https://opensource.com/downloads/bash-programming-guide +[4]: https://opensource.com/article/20/1/what-creative-commons diff --git a/sources/tech/20200410 How Kubernetes saved my desktop application.md b/sources/tech/20200410 How Kubernetes saved my desktop application.md new file mode 100644 index 0000000000..ecbd6ee273 --- /dev/null +++ b/sources/tech/20200410 How Kubernetes saved my desktop application.md @@ -0,0 +1,55 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How Kubernetes saved my desktop application) +[#]: via: (https://opensource.com/article/20/4/kubernetes-desktop-application) +[#]: author: (Chris Hermansen https://opensource.com/users/clhermansen) + +How Kubernetes saved my desktop application +====== +Keep this fix in mind if you have a broken Java desktop application but +aren't a crypto expert. +![Puzzle pieces coming together to form a computer screen][1] + +Recently, fellow Opensource.com scribe James Farrell wrote a wonderful article entitled _[How Ansible brought peace to my home][2]_. In addition to the great article, I really liked the title, one of those unexpected phrases that I’m sure brought a smile to many faces. + +I recently had a weird but positive experience of my own that begs a similar sort of unexpected label. I’ve been grappling with a difficult problem that arose when upgrading some server and networking infrastructure that broke a Java application I’ve been supporting since the early 2000s. Strangely enough, I found the solution in what appears to be a very informative and excellent article on Kubernetes, of all things. + +Without further ado, here is my problem: + +![][3] + +I’m guessing that most readers will look at that message and think things like, "I hope there’s more info in the log file," or "I’m really glad I’ve never received a message like that." + +Unfortunately, there isn’t a lot of info in the log file, just the same message, in fact. In an effort to debug this, I did three things: + + 1. I searched online for the message. Interestingly, or perhaps ominously, there were only 200 or so hits on this string, [one of which suggested][4] [turn][4][ing][4] [on more debugging output][4], which involved adding the setting + + +``` +**-Djavax.net.debug=ssl:handshake:verbose**[/code] to the **java** command running the application. + + 2. I tried that suggestion, which resulted in a lot of output (good), most of which only vaguely made sense to me as I’m no kind of expert in the underlying bits of stuff like SSL. But one thing I did notice is that there was no information regarding a response from the server in the midst of all of that output; + + 3. So I searched some more. + + + + +Another interesting part of this problem is that the code ran fine when executed by the Java command bundled in the OpenJDK, but failed with this error when using a customized runtime [created from the same OpenJDK in this way][5]. So the relatively modest number of apparently similar problems turned up from search #1 above were actually not all that relevant since they all seemed to be dealing mostly with bad SSL certificates on the server in conjunction with the PostgreSQL JDBC’s ability to check the server’s credentials. + +I should also mention that it took me quite some time to realize that the problem was introduced by using the custom Java runtime, as I managed to check many other possibilities along the way (and indeed, I did fix a few minor bugs while I was at it). My efforts included things like getting the latest OpenJDK, checking and re-checking all the URLs in case one had a typo, and so forth. + +As often happens, after putting the problem aside for a few hours, an idea occurred to me—perhaps I was missing some module in the customized Java runtime. While I didn’t receive any errors directly suggesting that problem, the observable fact that the standard OpenJDK environment worked while the custom one failed seemed to hint at that possibility. I took a quick look in the **jmods/** folder in the OpenJDK installation, but there are some 70 modules there and nothing jumped out at me. + +But again, what seemed odd was, with debugging turned on (see #1 above), there was no indication of what the server would accept, just what the client mostly couldn’t offer, many lines like this: +``` +`Ignoring unavailable cipher suite: TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA` +``` +So I was at least thinking by this time that maybe what was missing was the module that offered those kinds of cipher suites. So I started searching with strings like "jdbc crypto," and in the midst of that, the most unlikely article showed up: [Optimizing Kubernetes Services—Part 2: Spring Web][6], written by [Juan Medina][7]. Midway down the article, I spotted the following: + +![][8] + +Huh! Imagine that, his script is creating a custom Java runtime, just like mine. But he says he needs to add in manually the module **jdk.crypto.ec** in order t \ No newline at end of file diff --git a/sources/tech/20200412 Use this helpful Bash script when stargazing.md b/sources/tech/20200412 Use this helpful Bash script when stargazing.md new file mode 100644 index 0000000000..f9e39e5632 --- /dev/null +++ b/sources/tech/20200412 Use this helpful Bash script when stargazing.md @@ -0,0 +1,121 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Use this helpful Bash script when stargazing) +[#]: via: (https://opensource.com/article/20/4/linux-astronomy) +[#]: author: (Alan Formy-Duval https://opensource.com/users/alanfdoss) + +Use this helpful Bash script when stargazing +====== +Keep your eyes on the stars by putting your Linux machine in night +vision mode with xcalib. +![Computer laptop in space][1] + +We often talk about [Linux][2] being used on servers and by developers, but it is used in many other fields too, including astronomy. There are a lot of astronomy tools available for Linux, such as sky maps, star charts, and interfaces to telescope drive systems for controlling your telescope. But one challenge for astronomers is using a computer while keeping their eyes working in the dark. + +When working out in the field at night, astronomers need to preserve their night vision. It can take up to 30 minutes for the human eye to fully dilate and adjust to low light levels, and doing things like checking a phone or laptop at the regular color and brightness levels can cause the eyes to lose their adjustment. This reduces the ability to see in the dark. An example anyone can understand: if you're reading something on your phone in bed at night and get up to go to the bathroom, you know how difficult it can be to see any obstacles that might be in your way. + +### A solution + +I'd like to present a nifty little script to help the astronomer in your family keep "their eyes" in the dark. It relies on a utility called [xcalib][3], a "tiny monitor calibration loader for X.org." It can be installed easily using your Linux package manager. + +On Fedora, for example: + + +``` +$ sudo dnf info xcalib +$ sudo dnf install xcalib +``` + +Or Ubuntu: + + +``` +`$ sudo apt-get install xcalib` +``` + +The xcalib application works only with X11, so it is not functional on Wayland systems. But Wayland has this functionality built-in, so you can get the same results through GNOME Settings. If you're using X11, xcalib is an easy way to change the color temperature of your display. + +### The script + +I discovered [Redscreen][4], a night vision filter script written by Jeff Jahr in 2014. The original script is written for the C shell, but Bash is the common default these days. In fact, the C shell is not installed by default on my current Fedora Linux workstation. So, I decided to write an updated version of the Redscreen script aimed at the newest Bash syntax, but I made one major change: utilizing a case statement. + + +``` +#!/usr/bin/bash +# redscreen.sh Fri Feb 28 11:36 EST 2020 Alan Formy-Duval +# Turn screen red - Useful to Astronomers +# Inspired by redscreen.csh created by Jeff Jahr 2014 +# () + +# This program is free software: you can redistribute it +# and/or modify it under the terms of the GNU General +# Public License as published by the Free Software Foundation, +# either version 3 of the License, or (at your option) any +# later version. + +# This program is distributed in the hope that it will be +# useful, but WITHOUT ANY WARRANTY; without even the implied +# warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR +# PURPOSE.  See the GNU General Public License for +# more details. + +# You should have received a copy of the GNU General Public +# License along with this program.   +# If not, see <[http://www.gnu.org/licenses/\>][5]. + +case $1 in +            on) +            # adjust color, gamma, brightness, contrast +            xcalib -green .1 0 1 -blue .1 0 1 -red 0.5 1 40 -alter +            exit 1 +        ;; +        off) +                xcalib -clear +            exit 1 +            ;; +        inv) +            # Invert screen +                xcalib -i -a +                    exit 1 +        ;; +        dim) +            # Make the screen darker +                xcalib -clear +            xcalib -co 30 -alter +            exit 1       +        ;; +        *) +                echo "$0 [on | dim | inv | off]" +                    exit 1 +        ;; +esac +``` + +![Skychart for Linux Version 4.2.1 on Fedora workstation][6] + +A lot of astronomy programs include a "night-mode" function, but not all do. Also, this script provides a way to affect the entire screen, not just a specific application. This allows you to use your Linux system out in the field at night for other things than just stargazing—such as checking email or reading Opensource.com—without ruining your night vision. + +Whether you are an astronomer or just an amateur stargazer, you can spend all night admiring the heavens using Linux and open source! + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/4/linux-astronomy + +作者:[Alan Formy-Duval][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/alanfdoss +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/computer_space_graphic_cosmic.png?itok=wu493YbB (Computer laptop in space) +[2]: https://opensource.com/resources/linux +[3]: http://xcalib.sourceforge.net/ +[4]: http://www.jeffrika.com/~malakai/redscreen/index.html +[5]: http://www.gnu.org/licenses/\> +[6]: https://opensource.com/sites/default/files/uploads/starchart_in_red.png (A star chart displayed in red screen mode) diff --git a/sources/tech/20200414 How young people can help fight COVID-19 with code.md b/sources/tech/20200414 How young people can help fight COVID-19 with code.md new file mode 100644 index 0000000000..73705b5a62 --- /dev/null +++ b/sources/tech/20200414 How young people can help fight COVID-19 with code.md @@ -0,0 +1,139 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How young people can help fight COVID-19 with code) +[#]: via: (https://opensource.com/article/20/4/covid19-hackathon) +[#]: author: (Melissa Sasi https://opensource.com/users/mesassi) + +How young people can help fight COVID-19 with code +====== +Youth developers are invited to submit ideas by April 15 to counter the +educational, informational, social, and health challenges uncovered by +the COVID-19 pandemic. +![woman on laptop sitting at the window][1] + +More than 91% of students around the world are impacted by school closures due to COVID-19, and most governments have temporarily closed academic institutions. That's nearly [1.6 billion young people in 188 countries][2]. Also, most of the learning platforms available online today aren't practical, engaging, or interactive, and lack true virtual collaboration. + +This big and wicked challenge got me thinking about how these circumstances are impacting my children, their friends, and my passions of empowering youth, fostering tech entrepreneurship, and inspiring under-represented communities to find their purpose through building digital skills. These all came together in [CodeTheCurve][3], "a global, virtual hackathon for students, educators, teachers, and the research community to build tech skills, entrepreneurial spirit, and professional competencies to build digital creativity and cooperation to mobilize the world." + +We hope you'll want to participate, but you need to act fast: the deadline to submit proposals is April 15. + +### My story + +The passions mentioned above stem from a deeply personal journey: My children and I are victims of parental kidnapping, and access to the internet and digital literacy are my pathways to being a mother from afar. My children, Zahra (age 13), Zahran (15), and Youmna (18), are safe and healthy, and we are frequently connected. They're living the same life youth all over the world are living these days, trying to social distance and remain in good health while figuring out this school thing (or lack thereof)—only one of my children has access to formal virtual learning during to COVID-19 school closures. The other two, without school-driven online learning options, tend to stay up all night playing Fortnight and making TikTok videos. + +I have always been passionate about digital inclusion and empowering the world through computer science, and the effects of COVID-19 have increased my desire to make a difference. About four years ago, I created a non-profit organization, [MentorNations][4], to inspire youth and the world via technology. My non-profit has taught tens of thousands of young people in 12 countries to code. In my work at IBM as a developer advocate, I focus on empowering early-stage entrepreneurs, developers, and students with access to tech skills, professional development, and entrepreneurial thinking. My major focus areas include inspiring students to discover their career potential in enterprise computing while recognizing that we are all ANDs and not ORs. + +Teaching the next generation about the power of collaboration, teamwork, problem-solving, and critical thinking that happen through open source code and principles empowers them to be creators and innovators who focus on solving relevant and real-world problems. + +Looking through the lens of my children, my non-profit work, my roles within a variety of United Nations Task Forces, and my position as IEEE Chair over the Digital Skills Working Group, I wondered, _**what can I do to make a difference with open source technology?**_ So I reached out to my network, and the world responded in a much bigger way than I had ever imagined. + +### CodeTheCurve + +In response, we launched UNESCO's [CodeTheCurve][3] hackathon in collaboration with 14 partners, including UN EQUALS, SAP, iHackOnline, Angel Hack, Internet Society, and YPO. Participants are invited to bring their open source ideas to combat the current and future environment and challenges relating to COVID-19. This initiative is centered around youth empowerment, gender inclusion, and making the world a better place for our communities, including for people we may not directly encounter daily. + +CodeTheCurve is for anyone above the age of 16. To ensure gender, age, and experience diversity, teams must include a developer or data scientist (early-stage chops are fine); at least one person under the age of 25; and at least one male and one female. The 40 teams selected to participate in CodeTheCurve will have access to more than 80 business and technical mentors (experts!) from around the world to help turn their ideas into reality. + +My vision for this hackathon is to train young talent; enable them with free, online resources and access to real people with real answers; and encourage the creation of real-world problem solving in real-time. The results of the hackathon, I hope, will be open source utilities and information that can be used, in some way, to combat COVID-19. + +#### Week-long learning, bootcamp, and hacking experience + +CodeTheCurve is a three-day virtual hackathon experience guided by expert business and technical mentors. Before the hackathon proper, participants begin with two days of self-paced, online learning from content curated by CodeTheCurve collaborators, followed by a two-day, instructor-led learning journey where the 40 selected teams will collaborate in virtual breakout rooms with activity kits, hands-on computing resources in machine learning, and expert-guided plenary sessions. + +#### CodeTheCurve hackathon themes + +CodeTheCurve includes three themes: + + * Education + * Information and data management + * Current and post-COVID-19 health and social issues + + + +#### Professional development, entrepreneurship, and hands-on open source skills + +The 40 teams will be empowered with expert-guided, engaging activities, including the following skill-building opportunities: + + * **Hand-on tech skills** + * Using Jupyter Notebooks for data science + * Data protection, privacy, security, and encryption + * Machine learning and artificial intelligence + * Architectural diagrams and frameworks + * Technical roadmaps + * **Professional development** + * Design thinking + * Personal branding + * Communication skills + * How not to feel like an imposter + * Conflict resolution + * Working in global, virtual teams + * Media literacy + * Ethics in machine learning and artificial intelligence + * **Entrepreneurship** + * Problem statements + * Mission and vision statements + * Value propositions + * Audience and target markets + * Business model canvassing + * Pitch decks + * Pitch practice + + + +### April 15: CodeTheCurve deadline + +Did I mention that the initial application deadline is April 15? Here's the full timeline: + + * Video submission deadline: **April 15** + * 40 selected teams announced: **April 20** + * Learning resources for pre-collaboration: **April 20-21** + * Instructor-led learning: **April 22-23** + * Hacking: **April 24-26** + * CodeTheCurve winners announced: **April 30** + + + +#### Prizes. Prizes. Prizes. + +Prizes include free access to [IBM LinuxONE Community Cloud][5] for one year, free training courses from SAP, four pitch opportunities at IBM and SAP events, free access to enterprise-grade IBM Z and its machine learning suite for six months, and one-on-one technical and business mentorship for a full year with industry experts. + +### How to apply + +Interested in applying? Know someone who should apply? Simply [submit a video][6] of your **amazing** open source idea, the problem you're trying to solve, and who you expect to reach. + +If you'd like to learn more, here are some other articles about CodeTheCurve: + + * [UN News CodeTheCurve article][7] + * [UNESCO CodeTheCurve blog][8] + * [Forbes CodeTheCurve article][9] + * [IBM CodeTheCurve blog][10] + + + +I cannot wait to see all the amazing open source ideas the world brings our way! + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/4/covid19-hackathon + +作者:[Melissa Sasi][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/mesassi +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/lenovo-thinkpad-laptop-window-focus.png?itok=g0xPm2kD (young woman working on a laptop) +[2]: https://en.unesco.org/covid19/educationresponse +[3]: https://www.codethecurve.org/ +[4]: https://mentornations.org/ +[5]: https://developer.ibm.com/linuxone/ +[6]: http://ibm.biz/codethecurve-apply +[7]: https://news.un.org/en/story/2020/04/1061142 +[8]: http://ibm.biz/unesco-pr +[9]: https://www.forbes.com/sites/danielnewman/2020/04/10/digital-transformation-for-good-shines-as-we-fight-covid-19/#78d51a4c4946 +[10]: http://ibm.biz/codethecurve diff --git a/sources/tech/20200414 Try this Kubernetes HTTP router and reverse proxy.md b/sources/tech/20200414 Try this Kubernetes HTTP router and reverse proxy.md new file mode 100644 index 0000000000..fc78ee9bce --- /dev/null +++ b/sources/tech/20200414 Try this Kubernetes HTTP router and reverse proxy.md @@ -0,0 +1,196 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Try this Kubernetes HTTP router and reverse proxy) +[#]: via: (https://opensource.com/article/20/4/http-kubernetes-skipper) +[#]: author: (Sandor Szücs https://opensource.com/users/sszuecs) + +Try this Kubernetes HTTP router and reverse proxy +====== +Skipper is designed to handle large numbers of HTTP route definitions, +beyond what you would want to manage in Nginx or Apache. +![Traffic circle with arrows pointing which way to go][1] + +Skipper is an open source HTTP router and reverse proxy for service composition. As its [GitHub page][2] states, it's designed to handle large amounts of dynamically configured HTTP route definitions (>600,000 routes) with detailed lookup conditions and flexible augmentation of the request flow with filters. It can be used out of the box or extended with custom lookup, filter logic, and configuration sources. + +### Proxies + +When some people think of a proxy, they imagine a webpage that serves as a gateway to an intranet or a suspicious-looking webpage designed to unblock social media sites on a school or work network. A forward proxy is one that operators of desktop infrastructure use to save internet bandwidth, enforce parental controls, or limit social media access. Another kind of proxy is one in which an individual user navigates to a page, provides credentials, and is then forwarded to a protected intranet resource. The inverse of that kind of proxy is the reverse proxy, which accepts all traffic and forwards it to a specific resource, like a server or container. That's the kind of work Skipper does for infrastructure. + +When I read [Matt Klein's post][3] on modern network load balancing and proxying, I realized that we, as [Skipper][4] maintainers, should explain more features and details about why and how you can leverage HTTP proxies. In this article, I will treat the terminology "HTTP (reverse) proxy" and "HTTP router" as the same. + +### HTTP routing + +According to [Wikipedia][5]: "Routing is the process of selecting a path for traffic in a network." This definition refers to routing at [OSI layer 3][6], most commonly based on [IP][7] with routing protocols like [BGP][8] or [OSPF][9]. Since this article isn't about one of those, I will try to explain what HTTP routers are about. But first, I want to introduce Skipper, an [OSI layer 7][10] HTTP router library written in [Go][11] and a core component of retailer [Zalando][12]'s e-commerce shop and the [Kubernetes][13] Ingress infrastructure. + +At Zalando, we use Skipper as a [Kubernetes Ingress][14] controller to support our users with visibility, reliability, security, and additional features to offload common applications. + +Any organization running HTTP services, often in a microservice architecture, needs to route HTTP requests to the right applications. HTTP routers route based on information provided by the HTTP request. For example, the following shows an HTTP/1.1 request. + + +``` +GET /details HTTP/1.1 +Host: [www.zalando.de][15] +User-Agent: curl/7.49.0 +Accept: */* +Authorization: Bearer <token> +... +``` + +We can route based on the method **GET**, the path **/details**, the **Host** header [**www.zalando.de**][16], or any arbitrary part of the request. + +One common problem an application owner faces is splitting an API into multiple applications, so you need to split the responsibility of a component into subcomponents. Another common task is to support refactoring; maybe you have rewritten one part of your app, and you want to deploy it separately now. + +For example, imagine you you have a store that has a list of products and their details, and you need to split it into _shop_ and _product_ backend applications. At **/**, your shop shows the list of products, and at **/details**, it shows product details, such as color, size, sustainability, and price. + +![Figure 1: shop][17] + +You need to split the responsibility of the product detail into its own application, such that **/** stays in the _shop_ application and **/details** is refactored to the _product_ application. + +![Figure 2: product and shop][18] + +To make sure an HTTP proxy finds the right backend for an incoming request, it uses a routing table to check the destination to make sure it's correct. + +### Routing tables + +In Skipper, the routing table is created by pulling information generated by [dataclients][19] from different sources. One source can be a [routes file][20], similar to what you may see in more popular HTTP servers, like Apache or Nginx. + +Depending on the size of your organization—or better, the number of backend applications—the routing table can grow quite large. Skipper implements the routing table as a tree that can scale beyond 600,000 routes (far more than you'd want to manage in an Nginx or Apache config). + +Following along with the example application above, Table 1 shows the routing table from [Figure 2][21]. The store **/** should be routed to **shop,** and the **/detail** routed to the **product** application. + +path | app +---|--- +/ | shop +/detail | product + +Table 1: Routing table + +The available dataclients in Skipper fetch routes from different sources and what a route consists of. + +### Dataclient + +The routing configuration in Skipper's routes file [dataclient][22] is similar to what you might know from HTTP proxies in Nginx or Apache. In Skipper, a routes file specifies all routes in [eskip][23] syntax, as shown in Figure 3. + + +``` +r1: P1() && P2() && .. && PN() +    -> f1() +    -> f2() +    ... +    -> fN() +    -> <backend>; +r2: ... +... +``` + +Figure 3: Routes file in eskip + +In the above: + + * **r1, r2, ...** are unique routeIDs. + * **P1, P2,..,PN** are predicates that define the matching. + * **f1, f2,..,fN** are filters that are applied after the route was selected. Filters can change the request and response. + * Finally, the Skipper backend is defined. This can be a single URL, a list of load-balanced URLs, and others for special cases such as [direct response][24]. + + + +The [routes string][25] is another dataclient that is handy for tests. For example, if you need a pseudo backend for your demo that replies a green background with HTML, you could use: + + +``` +$ skipper -routes-string='* +-> inlineContent( +      "<html><body style=\"background-color: green;\"></body></html>" +   )' +``` + +Skipper's most popular dataclient, by far, is the Kubernetes dataclient, which is used to fetch information from a [Kubernetes API server][26] and create a routing table from [Skipper Ingress][27] resources and the [RouteGroup][28] custom resource definition (CRD). + +To summarize the above, dataclients fetch information from different providers to build Skipper's routing table. Table 1 shows a routing table for the shop/description example, and Skipper uses predicates to select the route to process the request. + +### Predicates + +In Skipper, an incoming request is matched to [predicates][29] of all the routes to find the best matching route for an incoming request. Predicates are functions that match based on the incoming request. In the example from Figure 2 and Table 1, Skipper would have a routing table similar to Figure 4: + + +``` +shop: Path("/") +    -> ""; +product: Path("/detail") +    -> ""; +``` + +Figure 4: Skipper routing table + +This means HTTP requests with a path **/** would be matched by the **Path("/")** predicate, such that Skipper will execute the shop route. Requests with a path **/detail** would be matched by **Path("/detail")** and routed to the product application. + +In general, routing behavior can be changed by predicates. There are a lot of predicates you can choose from. For example, **Method("POST")** will be true only if a POST request would be passed. A route with more predicates is considered more specific. Also, a route with more predicates has more weight in the route selection than one that has less. + +Special cases are **Path()** and **PathSubtree()**, which is matched first in a tree and reduces the number of routes, which are scanned as a list. For example, the tree structure shown in Figure 5 helps to scale the number of routes to more than 600,000 in one of Zalando's production setups. + +![Skipper tree example][30] + +### Filters + +After a route is selected, the request [filters][31] are applied. Filters work on request or response; they can change the incoming request to the backend, and they can change the response to the client. + +For example, **setRequestHeader("Foo", "bar")** sets the HTTP header **"Foo"** to the value **"bar"**, such that the backend sees this header in the request. + +The response filter **responseCookie("keks", "val", 3600)** sets a Cookie named **"keks"** in the response to the caller, which might be a browser in this case. The cookie would have the value **"val"** and is valid for one hour. + +One filter that works on request and response is **enableAccessLog(40, 5)**. This would do access logs for all responses from the backend with status codes 40x or 5xx. + +As you can see from the examples, filters can change the request or the response or just do some work based on it. Another filter example is **auth filters** or **ratelimits**. These would stop requests from passing to the backend if the request should not be allowed to pass. For example, to serve static content from a directory called **/var/www**, you can use the filter **static("/var/www")**. + +### Learn more + +This article provided a basic overview of Skipper and its capabilities. For more information, consult [Skipper's documentation][32], and please share your questions or feedback in the comments. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/4/http-kubernetes-skipper + +作者:[Sandor Szücs][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/sszuecs +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/LAW-patent_reform_520x292_10136657_1012_dc.png?itok=Cd2PmDWf (Traffic circle with arrows pointing which way to go) +[2]: https://github.com/zalando/skipper +[3]: https://blog.envoyproxy.io/introduction-to-modern-network-load-balancing-and-proxying-a57f6ff80236 +[4]: https://opensource.zalando.com/skipper +[5]: https://en.wikipedia.org/wiki/Routing +[6]: https://en.wikipedia.org/wiki/OSI_model#Layer_3:_Network_Layer +[7]: https://en.wikipedia.org/wiki/Internet_Protocol +[8]: https://en.wikipedia.org/wiki/Border_Gateway_Protocol +[9]: https://en.wikipedia.org/wiki/Open_Shortest_Path_First +[10]: https://en.wikipedia.org/wiki/OSI_model#Layer_7:_Application_Layer +[11]: https://golang.org/ +[12]: https://en.zalando.de/ +[13]: https://kubernetes.io +[14]: https://kubernetes.io/docs/concepts/services-networking/ingress/ +[15]: http://www.zalando.de +[16]: https://en.zalando.de/?_rfl=de +[17]: https://opensource.com/sites/default/files/uploads/skipper_1_shop.png (Figure 1: shop) +[18]: https://opensource.com/sites/default/files/uploads/skipper_2_product-shop.png (Figure 2: product and shop) +[19]: https://opensource.zalando.com/skipper/reference/backends/ +[20]: https://opensource.zalando.com/skipper/data-clients/eskip-file/ +[21]: tmp.ftM58r5YpM#fig2 +[22]: https://opensource.zalando.com/skipper/tutorials/development/#dataclients +[23]: https://godoc.org/github.com/zalando/skipper/eskip +[24]: https://opensource.zalando.com/skipper/reference/backends/#shunt-backend +[25]: https://opensource.zalando.com/skipper/data-clients/route-string/ +[26]: https://kubernetes.io/docs/concepts/overview/components/#kube-apiserver +[27]: https://opensource.zalando.com/skipper/kubernetes/ingress-usage/ +[28]: https://opensource.zalando.com/skipper/kubernetes/routegroups/ +[29]: https://opensource.zalando.com/skipper/reference/predicates/ +[30]: https://opensource.com/sites/default/files/uploads/skipper_5_tree.png (Skipper tree example) +[31]: https://opensource.zalando.com/skipper/reference/filters/ +[32]: https://opensource.zalando.com/skipper/ diff --git a/sources/tech/20200415 6 open source teaching tools for virtual classrooms.md b/sources/tech/20200415 6 open source teaching tools for virtual classrooms.md new file mode 100644 index 0000000000..807ebfae3d --- /dev/null +++ b/sources/tech/20200415 6 open source teaching tools for virtual classrooms.md @@ -0,0 +1,96 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (6 open source teaching tools for virtual classrooms) +[#]: via: (https://opensource.com/article/20/4/open-source-remote-teaching-tools) +[#]: author: (Mathias Hoffmann https://opensource.com/users/mhopensource) + +6 open source teaching tools for virtual classrooms +====== +Create podcasts, online lectures, tutorials, and other teaching +resources for learning at home with open source tools. +![Person reading a book and digital copy][1] + +As schools and universities are shutting down around the globe due to COVID-19, many of us in academia are wondering how we can get up to speed and establish a stable workflow to get our podcasts, online lectures, and tutorials out there for our students. + +Open source software (OSS) has a key role to play in this situation for many reasons, including: + + * **Speed:** OSS can roll out quickly and in large numbers (e.g., to an army of teaching assistants for multiple tutorial sessions in big lectures) without licensing issues and in a decentralized manner. + * **Cost:** OSS does not cost anything upfront, which is important for financially stretched schools and universities that need solutions to complex challenges on very short notice. + + + +With everything going online, we need new ways to engage with students. Here is a list of tools that I have found useful to share my own lectures.  + +### Create podcasts, videos, or live streams with OBS + +[Open Broadcast Studio (OBS)][2] is a professional, open source audio and video recording tool that allows you to record, stream instantly, and do much more. OBS is available for all major platforms (Windows, macOS, and Linux), so interoperability with your colleagues and their various devices is ensured. + +Even if you're already using online conferencing software as a recording system, OBS can be a great backup solution. Since it records locally, you're protected against any network lags or disconnections. You also have complete control over your data, so many educational institutions may find it to be a more secure solution than some other options. + +Compatibility is also an advantage: OBS stores recordings in a standard intermediate format (MKV), which can be transferred to MP4 or other formats. Also, support for Nvidia graphics cards under OBS is great, as the company is one of the main sponsors of the OBS project. This allows you to make full use of your hardware and speed up the recording process. + +### Video and sound editing + +After you record your podcast or video, you may find that it needs editing. There are many reasons you may need to edit your audio or video. For example, many university online platforms restrict the size of files you can upload, so you may have to cut long videos. Or, the sound may be too quiet, or maybe it was too noisy when you recorded it, so you need to make adjustments to the audio. + +Two of the open source apps to explore are [OpenShot][3] and [Shotcut][4]. Of the two, Shotcut is a more advanced program, which implies a slightly steeper learning curve. Both are cross-platform and have full support for hardware encoding with NVidia and other graphics cards, which will substantially lower processing time compared to CPU-only processing. + +You can also extract a soundtrack in either program (although I have found it to be much faster with Shotcut) and export it to an audio-editing program. I find [Audacity][5], another open source, cross-platform (Mac, Linux, Windows) tool, to work extremely well. + +My typical workflow looks something like this: + + * Import the recording into Shotcut + * Extract the audio, save it to an audio file + * Import it into Audacity, normalize and amplify the audio, maybe do some noise reduction + * Save the audio to a new file + * Import the new audio file into Shotcut, align it with the audio-free video, and cut appropriately + * Export into an MP4 video (this last step usually takes some time, so have a coffee…) + + + +### Electronic blackboards + +If you want to annotate your slides or develop ideas on an electronic blackboard, you need note-taking software and a device with a touchscreen or a graphics tablet. A great open source tool (developed with Swiss taxpayer funding) for blackboarding is [OpenBoard][6]. It is cross-platform; although it is officially only available for Linux on Ubuntu 16.04, you can install a [Flatpak][7] and it will work on any Linux flavor. It is really a nice tool; its only shortcoming is that annotating slides is not very good. + +My main open source annotation and electric blackboard tool is [Xournal++][8], which is available in some Linux distros repos (e.g., Linux Mint) and otherwise via [Flathub][9]. Like all the tools mentioned earlier, it is also available on Mac and Windows. If you know of any open source, cross-platform note-taking tools, please share them in the comments. + +### Built-in solutions have their limits + +You might wonder why you should bother with alternative recording software in the first place. After all, most modern operating systems have built-in screen recorders that will also capture audio. However, these built-in solutions have their limits. One key limitation is that you cannot usually capture more than one video source at a time (e.g., a webcam with your talking head and a set of slides plus a whiteboard from a graphics tablet). + +The ability to use multiple video sources is very useful, though, since it can be dull for students to just listen to your voice and see your slides for extended periods. Face-to-face interactions—even if done virtually—help keep listeners' attention and make it easier for them to cope with imperfect recording quality and background noise. In addition, many of the built-in tools do not allow you to capture selected areas of the screen, and in general, you cannot change the resolution or the number of frames per second, which can be important for keeping your podcast's memory and bandwidth usage in check. + +### Conclusion + +When planning your online teaching, you will want to use a blend of audio, video, slides, and electronic blackboards to create an immersive experience even while students are learning remotely. Open source software offers advanced, effective tools for creating such online educational experiences. + +* * * + +_This article is based on "[Open source software for online teaching in the times of corona][10]" on Mathias Hoffman's blog and is reused with permission._ + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/4/open-source-remote-teaching-tools + +作者:[Mathias Hoffmann][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/mhopensource +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/read_book_guide_tutorial_teacher_student_apaper.png?itok=_GOufk6N (Person reading a book and digital copy) +[2]: https://obsproject.com/ +[3]: http://www.openshot.org/ +[4]: http://www.shotcut.org/ +[5]: https://www.audacityteam.org/ +[6]: http://www.openboard.ch/ +[7]: http://www.flathub.org +[8]: https://github.com/xournalpp/xournalpp +[9]: https://flathub.org/apps/details/com.github.xournalpp.xournalpp +[10]: http://mathiashoffmann.net/2020/03/22/open-source-software-for-online-teaching-in-the-times-of-corona diff --git a/sources/tech/20200415 How to automate your cryptocurrency trades with Python.md b/sources/tech/20200415 How to automate your cryptocurrency trades with Python.md new file mode 100644 index 0000000000..c216d22663 --- /dev/null +++ b/sources/tech/20200415 How to automate your cryptocurrency trades with Python.md @@ -0,0 +1,424 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How to automate your cryptocurrency trades with Python) +[#]: via: (https://opensource.com/article/20/4/python-crypto-trading-bot) +[#]: author: (Stephan Avenwedde https://opensource.com/users/hansic99) + +How to automate your cryptocurrency trades with Python +====== +In this tutorial, learn how to set up and use Pythonic, a graphical +programming tool that makes it easy for users to create Python +applications using ready-made function modules. +![scientific calculator][1] + +Unlike traditional stock exchanges like the New York Stock Exchange that have fixed trading hours, cryptocurrencies are traded 24/7, which makes it impossible for anyone to monitor the market on their own. + +Often in the past, I had to deal with the following questions related to my crypto trading: + + * What happened overnight? + * Why are there no log entries? + * Why was this order placed? + * Why was no order placed? + + + +The usual solution is to use a crypto trading bot that places orders for you when you are doing other things, like sleeping, being with your family, or enjoying your spare time. There are a lot of commercial solutions available, but I wanted an open source option, so I created the crypto-trading bot [Pythonic][2]. As [I wrote][3] in an introductory article last year, "Pythonic is a graphical programming tool that makes it easy for users to create Python applications using ready-made function modules." It originated as a cryptocurrency bot and has an extensive logging engine and well-tested, reusable parts such as schedulers and timers. + +### Getting started + +This hands-on tutorial teaches you how to get started with Pythonic for automated trading. It uses the example of trading [Tron][4] against [Bitcoin][5] on the [Binance][6] exchange platform. I choose these coins because of their volatility against each other, rather than any personal preference. + +The bot will make decisions based on [exponential moving averages][7] (EMAs). + +![TRX/BTC 1-hour candle chart][8] + +TRX/BTC 1-hour candle chart + +The EMA indicator is, in general, a weighted moving average that gives more weight to recent price data. Although a moving average may be a simple indicator, I've had good experiences using it. + +The purple line in the chart above shows an EMA-25 indicator (meaning the last 25 values were taken into account). + +The bot monitors the pitch between the current EMA-25 value (t0) and the previous EMA-25 value (t-1). If the pitch exceeds a certain value, it signals rising prices, and the bot will place a buy order. If the pitch falls below a certain value, the bot will place a sell order. + +The pitch will be the main indicator for making decisions about trading. For this tutorial, it will be called the _trade factor_. + +### Toolchain + +The following tools are used in this tutorial: + + * Binance expert trading view (visualizing data has been done by many others, so there's no need to reinvent the wheel by doing it yourself) + * Jupyter Notebook for  data-science tasks + * Pythonic, which is the  overall framework + * PythonicDaemon as the  pure runtime (console- and Linux-only) + + + +### Data mining + +For a crypto trading bot to make good decisions, it's essential to get open-high-low-close ([OHLC][9]) data for your asset in a reliable way. You can use Pythonic's built-in elements and extend them with your own logic. + +The general workflow is: + + 1. Synchronize with Binance time + 2. Download OHLC data + 3. Load existing OHLC data from the file into memory + 4. Compare both datasets and extend the existing dataset with the newer rows + + + +This workflow may be a bit overkill, but it makes this solution very robust against downtime and disconnections. + +To begin, you need the **Binance OHLC Query** element and a **Basic Operation** element to execute your own code. + +![Data-mining workflow][10] + +Data-mining workflow + +The OHLC query is set up to query the asset pair **TRXBTC** (Tron/Bitcoin) in one-hour intervals. + +![Configuration of the OHLC query element][11] + +Configuring the OHLC query element + +The output of this element is a [Pandas DataFrame][12]. You can access the DataFrame with the **input** variable in the **Basic Operation** element. Here, the **Basic Operation** element is set up to use Vim as the default code editor. + +![Basic Operation element set up to use Vim][13] + +Basic Operation element set up to use Vim + +Here is what the code looks like: + + +``` +import pickle, pathlib, os +import pandas as pd + +outout = None + +if isinstance(input, pd.DataFrame): +    file_name = 'TRXBTC_1h.bin' +    home_path = str(pathlib.Path.home()) +    data_path = os.path.join(home_path, file_name) + +    try: +        df = pickle.load(open(data_path, 'rb')) +        n_row_cnt = df.shape[0] +        df = pd.concat([df,input], ignore_index=True).drop_duplicates(['close_time']) +        df.reset_index(drop=True, inplace=True) +        n_new_rows = df.shape[0] - n_row_cnt +        log_txt = '{}: {} new rows written'.format(file_name, n_new_rows) +    except: +        log_txt = 'File error - writing new one: {}'.format(e) +        df = input + +    pickle.dump(df, open(data_path, "wb" )) +    output = df +``` + +First, check whether the input is the DataFrame type. Then look inside the user's home directory (**~/**) for a file named **TRXBTC_1h.bin**. If it is present, then open it, concatenate new rows (the code in the **try** section), and drop overlapping duplicates. If the file doesn't exist, trigger an _exception_ and execute the code in the **except** section, creating a new file. + +As long as the checkbox **log output** is enabled, you can follow the logging with the command-line tool **tail**: + + +``` +`$ tail -f ~/Pythonic_2020/Feb/log_2020_02_19.txt` +``` + +For development purposes, skip the synchronization with Binance time and regular scheduling for now. This will be implemented below. + +### Data preparation + +The next step is to handle the evaluation logic in a separate grid; therefore, you have to pass over the DataFrame from Grid 1 to the first element of Grid 2 with the help of the **Return element**. + +In Grid 2, extend the DataFrame by a column that contains the EMA values by passing the DataFrame through a **Basic Technical Analysis** element. + +![Technical analysis workflow in Grid 2][14] + +Technical analysis workflow in Grid 2 + +Configure the technical analysis element to calculate the EMAs over a period of 25 values. + +![Configuration of the technical analysis element][15] + +Configuring the technical analysis element + +When you run the whole setup and activate the debug output of the **Technical Analysis** element, you will realize that the values of the EMA-25 column all seem to be the same. + +![Missing decimal places in output][16] + +Decimal places are missing in the output + +This is because the EMA-25 values in the debug output include just six decimal places, even though the output retains the full precision of an 8-byte float value. + +For further processing, add a **Basic Operation** element: + +![Workflow in Grid 2][17] + +Workflow in Grid 2 + +With the **Basic Operation** element, dump the DataFrame with the additional EMA-25 column so that it can be loaded into a Jupyter Notebook; + +![Dump extended DataFrame to file][18] + +Dump extended DataFrame to file + +### Evaluation logic + +Developing the evaluation logic inside Juypter Notebook enables you to access the code in a more direct way. To load the DataFrame, you need the following lines: + +![Representation with all decimal places][19] + +Representation with all decimal places + +You can access the latest EMA-25 values by using [**iloc**][20] and the column name. This keeps all of the decimal places. + +You already know how to get the latest value. The last line of the example above shows only the value. To copy the value to a separate variable, you have to access it with the **.at** method, as shown below. + +You can also directly calculate the trade factor, which you will need in the next step. + +![Buy/sell decision][21] + +Buy/sell decision + +### Determine the trading factor + +As you can see in the code above, I chose 0.009 as the trade factor. But how do I know if 0.009 is a good trading factor for decisions? Actually, this factor is really bad, so instead, you can brute-force the best-performing trade factor. + +Assume that you will buy or sell based on the closing price. + +![Validation function][22] + +Validation function + +In this example, **buy_factor** and **sell_factor** are predefined. So extend the logic to brute-force the best performing values. + +![Nested for loops for determining the buy and sell factor][23] + +Nested _for_ loops for determining the buy and sell factor + +This has 81 loops to process (9x9), which takes a couple of minutes on my machine (a Core i7 267QM). + +![System utilization while brute forcing][24] + +System utilization while brute-forcing + +After each loop, it appends a tuple of **buy_factor**, **sell_factor**, and the resulting **profit** to the **trading_factors** list. Sort the list by profit in descending order. + +![Sort profit with related trading factors in descending order][25] + +Sort profit with related trading factors in descending order + +When you print the list, you can see that 0.002 is the most promising factor. + +![Sorted list of trading factors and profit][26] + +Sorted list of trading factors and profit + +When I wrote this in March 2020, the prices were not volatile enough to present more promising results. I got much better results in February, but even then, the best-performing trading factors were also around 0.002. + +### Split the execution path + +Start a new grid now to maintain clarity. Pass the DataFrame with the EMA-25 column from Grid 2 to element 0A of Grid 3 by using a **Return** element. + +In Grid 3, add a **Basic Operation** element to execute the evaluation logic. Here is the code of that element: + +![Implemented evaluation logic][27] + +Implemented evaluation logic + +The element outputs a **1** if you should buy or a **-1** if you should sell. An output of **0** means there's nothing to do right now. Use a **Branch** element to control the execution path. + +![Branch element: Grid 3 Position 2A][28] + +Branch element: Grid 3, Position 2A + +Due to the fact that both **0** and **-1** are processed the same way, you need an additional Branch element on the right-most execution path to decide whether or not you should sell. + +![Branch element: Grid 3 Position 3B][29] + +Branch element: Grid 3, Position 3B + +Grid 3 should now look like this: + +![Workflow on Grid 3][30] + +Workflow on Grid 3 + +### Execute orders + +Since you cannot buy twice, you must keep a persistent variable between the cycles that indicates whether you have already bought. + +You can do this with a **Stack element**. The Stack element is, as the name suggests, a representation of a file-based stack that can be filled with any Python data type. + +You need to define that the stack contains only one Boolean element, which determines if you bought (**True**) or not (**False**). As a consequence, you have to preset the stack with one **False**. You can set this up, for example, in Grid 4 by simply passing a **False** to the stack. + +![Forward a False-variable to the subsequent Stack element][31] + +Forward a **False** variable to the subsequent Stack element + +The Stack instances after the branch tree can be configured as follows: + +![Configuration of the Stack element][32] + +Configuring the Stack element + +In the Stack element configuration, set **Do this with input** to **Nothing**. Otherwise, the Boolean value will be overwritten by a 1 or 0. + +This configuration ensures that only one value is ever saved in the stack (**True** or **False**), and only one value can ever be read (for clarity). + +Right after the Stack element, you need an additional **Branch** element to evaluate the stack value before you place the **Binance Order** elements. + +![Evaluate the variable from the stack][33] + +Evaluating the variable from the stack + +Append the Binance Order element to the **True** path of the Branch element. The workflow on Grid 3 should now look like this: + +![Workflow on Grid 3][34] + +Workflow on Grid 3 + +The Binance Order element is configured as follows: + +![Configuration of the Binance Order element][35] + +Configuring the Binance Order element + +You can generate the API and Secret keys on the Binance website under your account settings. + +![Creating an API key in Binance][36] + +Creating an API key in the Binance account settings + +In this tutorial, every trade is executed as a market trade and has a volume of 10,000 TRX (~US$ 150 on March 2020). (For the purposes of this tutorial, I am demonstrating the overall process by using a Market Order. Because of that, I recommend using at least a Limit order.) + +The subsequent element is not triggered if the order was not executed properly (e.g., a connection issue, insufficient funds, or incorrect currency pair). Therefore, you can assume that if the subsequent element is triggered, the order was placed. + +Here is an example of output from a successful sell order for XMRBTC: + +![Output of a successfully placed sell order][37] + +Successful sell order output + +This behavior makes subsequent steps more comfortable: You can always assume that as long the output is proper, the order was placed. Therefore, you can append a **Basic Operation** element that simply writes the output to **True** and writes this value on the stack to indicate whether the order was placed or not. + +If something went wrong, you can find the details in the logging message (if logging is enabled). + +![Logging output of Binance Order element][38] + +Logging output from Binance Order element + +### Schedule and sync + +For regular scheduling and synchronization, prepend the entire workflow in Grid 1 with the **Binance Scheduler** element. + +![Binance Scheduler at Grid 1, Position 1A][39] + +Binance Scheduler at Grid 1, Position 1A + +The Binance Scheduler element executes only once, so split the execution path on the end of Grid 1 and force it to re-synchronize itself by passing the output back to the Binance Scheduler element. + +![Grid 1: Split execution path][40] + +Grid 1: Split execution path + +Element 5A points to Element 1A of Grid 2, and Element 5B points to Element 1A of Grid 1 (Binance Scheduler). + +### Deploy + +You can run the whole setup 24/7 on your local machine, or you could host it entirely on an inexpensive cloud system. For example, you can use a Linux/FreeBSD cloud system for about US$5 per month, but they usually don't provide a window system. If you want to take advantage of these low-cost clouds, you can use PythonicDaemon, which runs completely inside the terminal. + +![PythonicDaemon console interface][41] + +PythonicDaemon console + +PythonicDaemon is part of the basic installation. To use it, save your complete workflow, transfer it to the remote running system (e.g., by Secure Copy [SCP]), and start PythonicDaemon with the workflow file as an argument: + + +``` +`$ PythonicDaemon trading_bot_one` +``` + +To automatically start PythonicDaemon at system startup, you can add an entry to the crontab: + + +``` +`# crontab -e` +``` + +![Crontab on Ubuntu Server][42] + +Crontab on Ubuntu Server + +### Next steps + +As I wrote at the beginning, this tutorial is just a starting point into automated trading. Programming trading bots is approximately 10% programming and 90% testing. When it comes to letting your bot trade with your money, you will definitely think thrice about the code you program. So I advise you to keep your code as simple and easy to understand as you can. + +If you want to continue developing your trading bot on your own, the next things to set up are: + + * Automatic profit calculation (hopefully only positive!) + * Calculation of the prices you want to buy for + * Comparison with your order book (i.e., was the order filled completely?) + + + +You can download the whole example on [GitHub][2]. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/4/python-crypto-trading-bot + +作者:[Stephan Avenwedde][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/hansic99 +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/calculator_money_currency_financial_tool.jpg?itok=2QMa1y8c (scientific calculator) +[2]: https://github.com/hANSIc99/Pythonic +[3]: https://opensource.com/article/19/5/graphically-programming-pythonic +[4]: https://tron.network/ +[5]: https://bitcoin.org/en/ +[6]: https://www.binance.com/ +[7]: https://www.investopedia.com/terms/e/ema.asp +[8]: https://opensource.com/sites/default/files/uploads/1_ema-25.png (TRX/BTC 1-hour candle chart) +[9]: https://en.wikipedia.org/wiki/Open-high-low-close_chart +[10]: https://opensource.com/sites/default/files/uploads/2_data-mining-workflow.png (Data-mining workflow) +[11]: https://opensource.com/sites/default/files/uploads/3_ohlc-query.png (Configuration of the OHLC query element) +[12]: https://pandas.pydata.org/pandas-docs/stable/getting_started/dsintro.html#dataframe +[13]: https://opensource.com/sites/default/files/uploads/4_edit-basic-operation.png (Basic Operation element set up to use Vim) +[14]: https://opensource.com/sites/default/files/uploads/6_grid2-workflow.png (Technical analysis workflow in Grid 2) +[15]: https://opensource.com/sites/default/files/uploads/7_technical-analysis-config.png (Configuration of the technical analysis element) +[16]: https://opensource.com/sites/default/files/uploads/8_missing-decimals.png (Missing decimal places in output) +[17]: https://opensource.com/sites/default/files/uploads/9_basic-operation-element.png (Workflow in Grid 2) +[18]: https://opensource.com/sites/default/files/uploads/10_dump-extended-dataframe.png (Dump extended DataFrame to file) +[19]: https://opensource.com/sites/default/files/uploads/11_load-dataframe-decimals.png (Representation with all decimal places) +[20]: https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.DataFrame.iloc.html +[21]: https://opensource.com/sites/default/files/uploads/12_trade-factor-decision.png (Buy/sell decision) +[22]: https://opensource.com/sites/default/files/uploads/13_validation-function.png (Validation function) +[23]: https://opensource.com/sites/default/files/uploads/14_brute-force-tf.png (Nested for loops for determining the buy and sell factor) +[24]: https://opensource.com/sites/default/files/uploads/15_system-utilization.png (System utilization while brute forcing) +[25]: https://opensource.com/sites/default/files/uploads/16_sort-profit.png (Sort profit with related trading factors in descending order) +[26]: https://opensource.com/sites/default/files/uploads/17_sorted-trading-factors.png (Sorted list of trading factors and profit) +[27]: https://opensource.com/sites/default/files/uploads/18_implemented-evaluation-logic.png (Implemented evaluation logic) +[28]: https://opensource.com/sites/default/files/uploads/19_output.png (Branch element: Grid 3 Position 2A) +[29]: https://opensource.com/sites/default/files/uploads/20_editbranch.png (Branch element: Grid 3 Position 3B) +[30]: https://opensource.com/sites/default/files/uploads/21_grid3-workflow.png (Workflow on Grid 3) +[31]: https://opensource.com/sites/default/files/uploads/22_pass-false-to-stack.png (Forward a False-variable to the subsequent Stack element) +[32]: https://opensource.com/sites/default/files/uploads/23_stack-config.png (Configuration of the Stack element) +[33]: https://opensource.com/sites/default/files/uploads/24_evaluate-stack-value.png (Evaluate the variable from the stack) +[34]: https://opensource.com/sites/default/files/uploads/25_grid3-workflow.png (Workflow on Grid 3) +[35]: https://opensource.com/sites/default/files/uploads/26_binance-order.png (Configuration of the Binance Order element) +[36]: https://opensource.com/sites/default/files/uploads/27_api-key-binance.png (Creating an API key in Binance) +[37]: https://opensource.com/sites/default/files/uploads/28_sell-order.png (Output of a successfully placed sell order) +[38]: https://opensource.com/sites/default/files/uploads/29_binance-order-output.png (Logging output of Binance Order element) +[39]: https://opensource.com/sites/default/files/uploads/30_binance-scheduler.png (Binance Scheduler at Grid 1, Position 1A) +[40]: https://opensource.com/sites/default/files/uploads/31_split-execution-path.png (Grid 1: Split execution path) +[41]: https://opensource.com/sites/default/files/uploads/32_pythonic-daemon.png (PythonicDaemon console interface) +[42]: https://opensource.com/sites/default/files/uploads/33_crontab.png (Crontab on Ubuntu Server) diff --git a/sources/tech/20200415 Writing Java with Quarkus in VS Code.md b/sources/tech/20200415 Writing Java with Quarkus in VS Code.md new file mode 100644 index 0000000000..2d61db71de --- /dev/null +++ b/sources/tech/20200415 Writing Java with Quarkus in VS Code.md @@ -0,0 +1,239 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Writing Java with Quarkus in VS Code) +[#]: via: (https://opensource.com/article/20/4/java-quarkus-vs-code) +[#]: author: (Daniel Oh https://opensource.com/users/daniel-oh) + +Writing Java with Quarkus in VS Code +====== +In this tutorial, I'll walk you through how to rebuild, package, and +deploy cloud-native applications automatically with Quarkus. +![Person drinking a hat drink at the computer][1] + +In the previous articles in this series about cloud-native [Java][2] applications, I shared [_6 requirements of cloud-native software_][3] and [_4 things cloud-native Java must provide_][4]. But now you might want to implement these advanced Java applications in your local machine without climbing a steep learning curve. In this article, I will walk through using the open source technologies [Quarkus][5] and [Visual Studio Code][6] (VS Code) to accelerate the development of both traditional cloud-native Java stacks and also serverless, reactive applications with easier and more familiar methods. + +Quarkus is a Kubernetes-native Java stack tailored for GraalVM and OpenJDK HotSpot. It's crafted from best-of-breed Java libraries and standards with live coding, unified configuration, superfast startup, small memory footprint, and unified imperative and reactive development. VS Code is an open source integrated development environment (IDE) for editing code. + +### Generate a Quarkus project + +Begin by navigating to Quarkus' [Start coding][7] page to generate a Quarkus project that includes a RESTful endpoint. Leave all variables (i.e., Group, Artifact, Build Tool, Extensions) on the default settings, then click **Generate your application** at the top-right of the page. Note that the RESTEasy JAX-RS extension is preselected as default. + +![Quarkus Generate application button][8] + +The ZIP file will automatically download on your local machine. Extract the file with the following command: + + +``` +$ unzip code-with-quarkus.zip +Archive: code-with-quarkus.zip +    creating: code-with-quarkus/ +   inflating: code-with-quarkus/pom.xml +   ... +``` + +### Install VS Code + +Download and install VS Code in your preferred way, whether that's [from the website][9] or through your package manager (dnf, apt, brew, etc). Once that's done, open the unzipped Quarkus project using VS Code's command-line tool: + + +``` +$ cd code-with-quarkus/ +$ code . +``` + +You will see the [Apache Maven][10] project structure with: + + * **ExampleResource** exposed on **/hello** + * Associated JUnit test + * Accessible landing page via + * Dockerfiles for both [native compilation][11] and JVM HotSpot + * A unified application configuration file + + + +Add Quarkus tools to your IDE through the VS Code's extension feature. + +![Add Quarkus tools to VS Code IDE][12] + +### Start coding + +Run the application using Quarkus development mode. To run the application, you need: + + * JDK 1.8+ installed with JAVA_HOME configured appropriately + * Apache Maven 3.6.3+ + + + +Move to the **code-with-quarkus** directory then type **mvn compile quarkus:dev** in VS Code's terminal. + +![Run application][13] + +You will see that the Java application is running well with: + + * About one second to startup + * Live coding activated + * EnabledCDI and RESTEASY features + + + +When you access the endpoint via a web browser, you will see the return code, **hello**. + +!["Hello" return][14] + +Now, you're ready to change the code! Move back to VS Code, then open the **ExampleResource.java** file in **src/main/java/org/acme**. Replace the return code with "**Welcome, Cloud-Native Java with Quarkus!"** Don't forget to **Save** the file. + +![Editing the return][15] + +Go back to the web browser and reload the page. + +![New return][16] + +_It's like magic!_ Behind the scenes, Quarkus rebuilt, packaged, and deployed the application for you automatically, and it only took half a second. This is one of the essential cloud-native Java runtime features for increasing development productivity. + +![Quarkus output][17] + +Continue running your cloud-native Java application in Quarkus. + +### Integrate data transactions via Quakrus Tool + +To add an in-memory database (H2) transaction capability, press **F1** then click on **Quarkus: Add extensions to the current project**. + +![Adding extensions in Quarkus][18] + +Enter **h2** in the search bar, then double-click on **JDBC Driver - H2 Data** in the result. + +![JDBC Driver - H2 Data extension][19] + +Select the following three extensions, which will simplify your persistence code and return JSON format data: + + * Hibernate ORM with Panache Data + * JDBC Driver - H2 + * RESTEasy JSON-B Web + + + +Press **Enter** to add those dependencies. + +![Add Quarkus extensions][20] + +You should see the following in a new VS Code terminal: + +![VS Code adding extensions][21] + +You should also find the following pulled dependencies in **POM.xml**: + +![dependencies in POM.xml][22] + +### Create an Inventory entity + +With your project in place, you can get to work defining the business logic. + +The first step is to define the model (entity) of an Inventory object. Since Quarkus uses Hibernate ORM Panache, create an **Inventory.java** file in the **src.main.java.org.acme** directory, and paste the following code into it: + + +``` +package org.acme; + +import javax.persistence.Cacheable; +import javax.persistence.Entity; + +import io.quarkus.hibernate.orm.panache.PanacheEntity; + +@[Entity][23] +@Cacheable +public class Inventory extends PanacheEntity { +    +    public [String][24] itemId; +    public [String][24] location; +    public int quantity; +    public [String][24] link + +    public Inventory() { + +    } +    +} +``` + +#### Define the RESTful endpoint of Inventory + +Next, mirror the abstraction of service so that you can inject the Inventory service into various places (like a RESTful resource endpoint) in the future. Create an **InventoryResource.java** file in the **src.main.java.org.acme** directory and add this code to it: + + +``` +package org.acme; + +import java.util.List; +import javax.enterprise.context.ApplicationScoped; +import javax.ws.rs.Consumes; +import javax.ws.rs.GET; +import javax.ws.rs.Path; +import javax.ws.rs.Produces; + +@Path("/services/inventory") +@ApplicationScoped +@Produces("application/json") +@Consumes("application/json") +public class InventoryResource { + +    @GET +    +    public List<Inventory> getAll() { +        return Inventory.listAll(); +    } +} +``` + +Don't forget to save these files. Go back to your web browser and access a new endpoint, . You will see: + +![Inventory endpoint][25] + +### Wrapping up + +If you have an issue or get an error when you implement this, you can find and reuse the [code in my GitHub repository][26]. + +If you want to learn more, Quarkus has some [practical and useful guides][27] that show how to develop advanced cloud-native Java applications using Quarkus extensions with event-driven programming, serverless development, and Kubernetes deployment. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/4/java-quarkus-vs-code + +作者:[Daniel Oh][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/daniel-oh +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/coffee_tea_laptop_computer_work_desk.png?itok=D5yMx_Dr (Person drinking a hat drink at the computer) +[2]: https://opensource.com/resources/java +[3]: https://opensource.com/article/20/1/cloud-native-software +[4]: https://opensource.com/article/20/1/cloud-native-java +[5]: https://quarkus.io/ +[6]: https://code.visualstudio.com/ +[7]: https://code.quarkus.io/ +[8]: https://opensource.com/sites/default/files/uploads/quarkus_generateapplication.png (Quarkus Generate application button) +[9]: https://code.visualstudio.com/download +[10]: https://maven.apache.org/ +[11]: https://quarkus.io/guides/building-native-image +[12]: https://opensource.com/sites/default/files/uploads/add-quarkus-to-ide.png (Add Quarkus tools to VS Code IDE) +[13]: https://opensource.com/sites/default/files/uploads/run-application.png (Run application) +[14]: https://opensource.com/sites/default/files/uploads/endpoint-hello.png ("Hello" return) +[15]: https://opensource.com/sites/default/files/uploads/edit-return-code.png (Editing the return) +[16]: https://opensource.com/sites/default/files/uploads/new-return-code.png (New return) +[17]: https://opensource.com/sites/default/files/uploads/quarkus-magic.png (Quarkus output) +[18]: https://opensource.com/sites/default/files/uploads/quarkus-add-extensions.png (Adding extensions in Quarkus) +[19]: https://opensource.com/sites/default/files/uploads/jbdc-driver-h2-data.png (JDBC Driver - H2 Data extension) +[20]: https://opensource.com/sites/default/files/uploads/add-extensions.png (Add Quarkus extensions) +[21]: https://opensource.com/sites/default/files/uploads/vscode-adding-extensions.png (VS Code adding extensions) +[22]: https://opensource.com/sites/default/files/uploads/dependencies-pomxml.png (dependencies in POM.xml) +[23]: http://www.google.com/search?hl=en&q=allinurl%3Adocs.oracle.com+javase+docs+api+entity +[24]: http://www.google.com/search?hl=en&q=allinurl%3Adocs.oracle.com+javase+docs+api+string +[25]: https://opensource.com/sites/default/files/uploads/inventory-endpoint.png (Inventory endpoint) +[26]: https://github.com/danieloh30/code-with-quarkus +[27]: https://quarkus.io/guides/ diff --git a/sources/tech/20200417 How to set up and run WordPress for your classroom.md b/sources/tech/20200417 How to set up and run WordPress for your classroom.md new file mode 100644 index 0000000000..bb8b87d560 --- /dev/null +++ b/sources/tech/20200417 How to set up and run WordPress for your classroom.md @@ -0,0 +1,164 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How to set up and run WordPress for your classroom) +[#]: via: (https://opensource.com/article/20/4/wordpress-virtual-machine) +[#]: author: (Don Watkins https://opensource.com/users/don-watkins) + +How to set up and run WordPress for your classroom +====== +Follow these simple steps to customize WordPress for use in the +classroom using free open source software. +![Painting art on a computer screen][1] + +There are many good reasons to set up WordPress for your classroom. As more schools switch to online classes, WordPress can become the go-to content management system. Teachers using WordPress can provide a number of different educational choices to differentiate instruction for their students. Blogging is an accessible way to create content that energizes student learning. Teachers can write short stories, poems, and provide picture galleries that function as story starters. Students can comment and those comments can be moderated by their teacher. + +There are free options like [WordPress.com][2] and [Edublogs][3]. However, these free versions are limited, and you may want to explore all your options. You can install [Virtualbox][4] on any Windows, macOS, or Linux computer. You can use your own computer or an extra you happen to have access to in a virtual environment. + +On Linux, you can install Virtualbox from your package manager. For instance, on Debian, Elementary OS, or Ubuntu: + + +``` +`$ sudo apt install virtualbox` +``` + +On Fedora: + + +``` +`$ sudo dnf install virtualbox` +``` + +### Download a Wordpress image + +Wordpress is easy to install, but server configuration and management can be difficult for the uninitiated. That's why there's [Turnkey Linux][5], a project dedicated to creating virtual machine images and containers of popular server software, preconfigured and ready to run. With Turnkey Linux, you just download a disk image containing the operating system and the software you want to run, and then import that image into Virtualbox. + +To get started with Wordpress, download the **VM** virtual machine image from [turnkeylinux.org/wordpress][6] (in the **Builds** section). Make sure you download the image labeled **VM**, because that's the only format meant for Virtualbox. + +### Import the image into Virtualbox + +After installing Virtualbox, launch the application and import the virtual machine image into Virtualbox. + +![][7] + +Networking on the imported image is set to NAT by default. You will want to change the network settings to "bridged." + +![Virtualbox menu][8] + +After restarting the virtual machine, you are prompted to add passwords for MySQL, Adminer, and the WordPress **admin** user. + +Then you see the network configuration console for the installation. Launch a web browser and navigate to the **web** address provided (in this example, it's 192.168.86.149). + +![Console][9] + +In a web browser, you see a login screen for your Wordpress installation. Click on the **Login** link. + +![Wordpress welcome][10] + +Enter **admin** as the username, followed by the password you created earlier. Click the **Login** link. On this first login as **admin**, you can choose a new password. Be sure to remember it! + +![Login screen][11] + +After logging in, you're presented with the WordPress Dashboard. The software will likely notify you, in the upper left corner of the window, that a new version of Wordpress exists. Update to the latest versions as prompted so your site is secure. + +It's important to note that your Wordpress blog isn't visible by anyone on the Internet yet. It only exists in your local network: only people in your building who are connected to the same router or wifi access point as you can see your Wordpress site right now. The worldwide Internet can't get to it because you're behind a firewall (embedded in your router, and possible also in your computer). + +![Wordpress dashboard][12] + +Following the upgrade, the application restarts, and you're ready to begin configuring WordPress to your liking. + +![Wordpress configuration][13] + +On the far left, there is a button to **Customize Your Site**. + +There, you can choose the name of your site. You can accept the default theme, which is "Twenty Nineteen," or choose another. My favorite is "Twenty Ten," but browse through the themes available to find your personal favorite. WordPress comes with five free themes installed. You can download other free themes from the [WordPress][14][.org][15] site or choose to purchase a premium theme. + +When you click the **Customize Your Site** button, you're presented with new menu options. Select **Site Identity** and change the name of your site. You might use the name of your school or classroom. There's also room to choose a byline (the credit given to the author of a blog post). You can choose the colors for your site and where you will place menus and widgets. WordPress widgets and content and features to the sidebars for your site. Homepage settings are important, as they allow you to choose between a static page that might have a description of your school or classroom or having your blog entries displayed prominently. You can add additional CSS. + +![Turnkey theme][16] + +You can edit your front page, add additional pages like "About," or add a blog post. You can also manage widgets, manage menus, turn comments on or off, or add a link to learn more about WordPress. + +Customizing your site allows you to configure a number of options quickly and easily. + +WordPress has dozens of widgets that you can place in different areas of your page. Widgets are independent sections of content that can be placed into specific areas provided by your theme. These areas are called sidebars. + +### Adding content + +After you have WordPress configured to your liking, you probably want to get busy creating content. The best way to do that is to head back to the WordPress Dashboard. + +On the left side, near the top of the page, you see **Posts**. Select that link and a dropdown appears. Choose **Add New** to create your very first blog post. + +![Add post dropdown][17] + +Fill in your title in the top block and then move down to the body. It's like using a word processor. WordPress has all the tools you need to write. You can set the font size from _small_ to _huge_. You can start a paragraph with dropped capitals. The text and background color can be changed. Your posts can include quote blocks and embedded content. A wide variety of embedded content is supported so you can make your posts a dynamic multimedia experience. + +![Wordpress classroom blog][18] + +### Going online + +So far, your Wordpress blog only exists on your local network. Anyone using the same router as you (your housemates or classroom) can see your Wordpress site by navigating to 192.168.86.149, but once you're away from that router, the site becomes inaccessible. + +If you want to go online with your custom Wordpress site, you have to allow traffic through your router, and then direct that traffic to the computer running Virtualbox. If you've installed Virtualbox on a laptop, then your website would disappear any time you closed your laptop, which is why servers that never get shutdown exist. But if this is just a fun lesson on how to run a Wordpress site, then having a website that's only available during class hours is fine. + +If you have access to your router, then you can log into it and make the adjustments yourself. If you don't own or control your router, then you must talk to your systems administrator for access. + +A _router_ is the box you got from your internet service provider. You might also call it your _modem_. + +Every device is different, so there's no way for me to definitively tell you what you need to click on to adjust your settings. Generally, you access your home router through a web browser. Your router's address is often printed on the bottom of the router and begins with either 192.168 or 10. + +Navigate to the router address and log in with the credentials you were provided when you got your internet service. It's often as simple as `admin` with a numeric password (sometimes this password is printed on the router, too). If you don't know the login, call your internet provider and ask for details. + +Different routers use different terms for the same thing; keywords to look for are **Port forwarding**, **Virtual server**, and **Firewall**. Whatever your router calls it, you want to accept traffic coming to port 80 of your router and forward that traffic to the same port of your virtual machines's IP address (in this example, that is 192.168.86.149, but it could be different for you). + +![Example router setting screen][19] + +Now you're allowing traffic through the web port of your router's firewall. To view your Wordpress site over the Internet, get your worldwide IP address. You can get your global IP by going to the site [icanhazip.com][20]. Then go to a different computer, open a browser, and navigate to that IP address. As long as Virtualbox is running, you'll see your Wordpress site on the Internet. You can do this from anywhere in the world, because your site is on the Internet now. + +Most websites use a domain name so you don't have to remember global IP addresses. You can purchase a domain name from services like [webhosting.coop][21] or [gandi.net][22], or a temporary one from [freenom.com][23]. Mapping that to your Wordpress site, however, is out of scope for this article. + +### Wordpress for everyone + +[WordPress][24] is open source and is licensed under the [GNU Public License][25]. You are welcome to contribute to WordPress as either a [developer][26] or enthusiast. WordPress is committed to being inclusive and accessible as possible. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/4/wordpress-virtual-machine + +作者:[Don Watkins][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/don-watkins +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/painting_computer_screen_art_design_creative.png?itok=LVAeQx3_ (Painting art on a computer screen) +[2]: https://wordpress.com/ +[3]: https://edublogs.org/ +[4]: https://www.virtualbox.org/ +[5]: https://www.turnkeylinux.org +[6]: https://www.turnkeylinux.org/wordpress +[7]: https://opensource.com/sites/default/files/uploads/how_to_get_started_with_wp_in_the_classroom_1.png +[8]: https://opensource.com/sites/default/files/uploads/how_to_get_started_with_wp_in_the_classroom_2.png (Virtualbox menu) +[9]: https://opensource.com/sites/default/files/uploads/how_to_get_started_with_wp_in_the_classroom_3.png (Console) +[10]: https://opensource.com/sites/default/files/uploads/how_to_get_started_with_wp_in_the_classroom_4.png (Wordpress welcome) +[11]: https://opensource.com/sites/default/files/uploads/how_to_get_started_with_wp_in_the_classroom_5.png (Login screen) +[12]: https://opensource.com/sites/default/files/uploads/how_to_get_started_with_wp_in_the_classroom_6.png (Wordpress dashboard) +[13]: https://opensource.com/sites/default/files/uploads/how_to_get_started_with_wp_in_the_classroom_7.png (Wordpress configuration) +[14]: http://Wordpress.org +[15]: http://WordPress.org +[16]: https://opensource.com/sites/default/files/uploads/how_to_get_started_with_wp_in_the_classroom_8.png (Turnkey theme) +[17]: https://opensource.com/sites/default/files/uploads/how_to_get_started_with_wp_in_the_classroom_12.png (Add post dropdown) +[18]: https://opensource.com/sites/default/files/uploads/how_to_get_started_with_wp_in_the_classroom_13.png (Wordpress classroom blog) +[19]: https://opensource.com/sites/default/files/router-web.jpg (Example router setting screen) +[20]: http://icanhazip.com/ +[21]: https://webhosting.coop/domain-names +[22]: https://www.gandi.net +[23]: http://freenom.com/ +[24]: https://wordpress.org/ +[25]: https://github.com/WordPress/WordPress/blob/master/license.txt +[26]: https://wordpress.org/five-for-the-future/ diff --git a/sources/tech/20200417 Is reporting 100- of code coverage reasonable.md b/sources/tech/20200417 Is reporting 100- of code coverage reasonable.md new file mode 100644 index 0000000000..6d57fb30f8 --- /dev/null +++ b/sources/tech/20200417 Is reporting 100- of code coverage reasonable.md @@ -0,0 +1,174 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Is reporting 100% of code coverage reasonable?) +[#]: via: (https://opensource.com/article/20/4/testing-code-coverage) +[#]: author: (Eric Herman https://opensource.com/users/ericherman) + +Is reporting 100% of code coverage reasonable? +====== +The time required to reach reporting 100% of code coverage is +considerably less than what I would have estimated before this +exploration. +![Code going into a computer.][1] + +The [Foundation for Public Code][2] works to enable open and collaborative public-purpose software for public organizations (like local governments) internationally. We do this by supporting software at the codebase level through codebase stewardship. We also publish the [Standard for Public Code][3] (draft version 0.1.4 at the time of this writing), which helps open source codebase communities build solutions that can be reused successfully by other organizations. It includes guidance for policymakers, managers, developers, designers, and vendors. + +Among other things, the standard addresses [code coverage][4], or how much of the code is executed when an automated test suite runs. It's one way to measure the likelihood that the code contains undetected software bugs. In the standard's ["Use continuous integration" requirements][5], it says, "source code test and documentation coverage **should** be monitored." Additionally, the [guidance to check][6] this requirement states, "code coverage tools check whether coverage is at 100% of the code." + +Over my software development career, which spans more than two decades, I have worked on codebases large and small and some with very high percentages of code coverage. Yet none of the non-trivial codebases I have contributed to have reported 100% test coverage. This made me question whether the "_check whether coverage is at 100%_" guidance would be followed. + +When I think about the nature of the test coverage gaps in the codebases I have worked on, they typically have been around system states that are very difficult (and in some cases, impossible) to create. For instance, in earlier versions of Java, I recall we were required to write catch blocks for exceptions that could never be thrown. + +Previously, I reasoned that 100% test coverage is something to aspire to, but it is probably not worth the cost on most codebases and may not be realistic in a few. + +Coverage tools have been getting smarter and more tunable over time. Languages have been getting lighter, and libraries have been getting easier to mock and test. So how unreasonable is 100% coverage of functionality today? + +### Resource exhaustion + +The high-quality but low test-coverage codebases I contribute to happen to be written in C or C++. A quick glance at these codebases shows that there is a class of common low-coverage situations that I'll lump together under the umbrella of resource exhaustion: out of memory, out of disk space, etc. + +Here is a simple example of code that does not check for resource exhaustion; in this case, memory allocation failure: + + +``` +char *buf = malloc(80); +sprintf(buf, "hello, world"); +``` + +This example code needs to allocate a small buffer, so it calls **malloc(80)**, and **malloc** usually returns a pointer to 80 bytes of memory … but that can fail. In the (unlikely) case that **malloc** returns **NULL**, the code above will proceed to call **sprintf** with a **NULL** pointer which causes a crash. It is typical in C code to do something more like this: + + +``` +char *buf = malloc(80); +if (buf == NULL) { +    fprintf(stderr, "malloc returned NULL for 80 bytes?\n"); +    return NULL; +} +sprintf(buf, "hello, world"); +``` + +This code guards against **malloc** returning **NULL**, which is better. However, creating tests for correct behavior in the face of this kind of resource exhaustion can be really hard. It's not impossible, of course, and there are multiple approaches. Many approaches result in fragile tests, which require a lot of maintenance over time, and these tests can be very time-consuming to build in the first place. + +### Exploration + +Pondering this, I decided to run a little experiment to see if I could learn something about the costs and consequences of this strict, 100% criterion. + +Since I do some embedded-systems development, I have a few C libraries that I've developed and reused over the years in my embedded projects. I decided to look at some of these libraries and see just how hard it would be to bring them up to 100% code coverage. In the process, I paid attention to the impact on code clarity, code structure, and performance. + +#### A library with preexisting dependency injection + +Step one is measuring by adding code coverage to a codebase. Since this is C, **gcc** provides quite a lot by default with the **\--coverage** option, and **lcov** (with **genhtml**) does a good job of making reports; thus, this step was easy. I expected the starting coverage to be pretty good—it was, but it had a few untested branches, as well as the predicted gaps around error conditions and error reporting. + +I made error reporting pluggable, so it was easier to capture and make assertions around error messages in previously untested branches. + +Since this code already allowed for pluggable implementations of **malloc** and **free**, it was straightforward to write little malloc and free wrappers that I could inject memory allocation failures into. Within an hour or two, that was covered. + +In the process, I realized that there was one condition where, from the perspective of the calling client code, it was impossible to distinguish between the situation where an error occurs and one where **NULL** is a valid return value. For you C programmers, it was essentially similar to the following: + + +``` +/* stashes a copy of the value + * returns the previously stashed value */ +char *foo_stash(foo_s *context, +                char *stash_me, +                size_t stash_me_len) +{ +    char *copy = malloc(stash_me_len); +    if (copy == NULL) { +        return NULL; +    } +    memcpy(copy, stash_me, stash_me_len); +    char *previous = context->stash; +    context->stash = copy; +    /* previous may be NULL */ +    return previous; +} +``` + +I adjusted the API to allow the error information to be explicitly available. If you are a C developer, you know there are various ways this can be accomplished. I chose an approach similar to this: + + +``` +/* stashes a copy of the value + * returns the previously stashed value + * on error, the 'err' pointer is set to 1 */ +char *foo_stash2(foo_s *context, +                char *stash_me, +                size_t stash_me_len, +                int *err) +{ +    char *copy = malloc(stash_me_len); +    if (copy == NULL) { +        *err = 1; +        return NULL; +    } +    memcpy(copy, stash_me, stash_me_len); +    char *previous = context->stash; +    context->stash = copy; +    /* previous may be NULL */ +    return previous; +} +``` + +Without testing for resource exhaustion, it may have taken a long time for me to notice this (now obvious) shortcoming of the API. + +To get **lcov** to report 100% test coverage, I had to tell the compiler to [not inline any code][7], something I learned it does even at optimization level zero. + +When embedded in actual firmware, the compiler optimized away the unused indirection; therefore, the added indirection in the source code imposed no real-world performance penalty in the compiled firmware. + +Of course, this was the easy library. + +#### A more typical library + +Once I established a method of injecting memory allocation failures in tests, I decided to move onto another library, but one for which malloc and free were not already pluggable. I had questions. How invasive will this be to the codebase? Will it clutter the code, making it less clear? How time-consuming will it be? + +While I don't always record coverage metrics, I am a big believer in testing: more than 20 years ago, I learned that my code improves if I write the tests and client code [before][8] the implementation code, and I have worked that way ever since. (In [_Test-Driven Development: By Example_][9], you can find my name in the acknowledgments.) Yet, when I added code coverage reporting to the second library, I was surprised to see that (at some point in the past) I had added a pair of functions to the library without adding tests for them. The other untested areas were, unsurprisingly, code to handle memory-allocation failure. + +Writing tests for the pair of untested functions was, of course, quick and easy. The coverage tools also revealed that I had a function with an untested code branch that, given only a quick glance, contained a bug. The fix was trivial, yet I was surprised to find a bug, given the different projects where I use this library. Nonetheless, there it was, a humbling reminder that, all too often, bugs lurk in untested code. + +Next up was the more challenging stuff: testing for resource exhaustion. I started by introducing some global variables for the malloc/free function pointers, as well as a variable to hold a memory-tracking object. Once that was working, I moved those variables from global scope into a context argument that was already present. Refactoring the code to allow for the necessary indirection took only a couple of hours (less time than I expected), and the complexity added was negligible. + +### Reflections + +My conclusion from the first library was that it was well worth the time. The code is now more flexible, the API is now more complete for the caller, and writing the failure injection harness was pretty easy. + +From the second library, I was reminded that even less-pluggable code could be made testable without adding undue levels of complexity. The code improved, I fixed a bug, and I can be more confident in the code. Also, the additional modularity of being able to plug in an alternative memory allocator is a feature that may prove more valuable in the future. + +Exclusion comments are a feature of **lcov** to cause coverage reporting to ignore a block of code. Interestingly, I didn't feel the need to use exclusion comments in either library. + +I am more certain than ever that even very good code is improved by investing in test coverage. + +Both of these codebases are small, had some modularity already, began from a point of good testing, are single-threaded, and contain no graphical UI code. If I were to try to tackle this on one of the larger, more monolithic codebases I contribute to, it would be harder and require a larger time investment. There would likely be some sections of code where I might still conclude that the best thing to do would be to "cheat" by tuning the tooling to not report on some section of code. + +That said, I estimate that the time required to reach reporting 100% of code coverage is considerably less than what I would have estimated before this exploration. + +If you happen to be a C coder and want to see a running example of this, including **gcov** / **lcov** usage, I extracted the out-of-memory injecting code and put it in an [example repository][10]. + +Have you pushed a codebase to 100% coverage by tests, or tried to? What was your experience? Please share it in the comments. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/4/testing-code-coverage + +作者:[Eric Herman][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/ericherman +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/code_computer_development_programming.png?itok=4OM29-82 (Code going into a computer.) +[2]: https://publiccode.net/ +[3]: https://standard.publiccode.net +[4]: https://en.wikipedia.org/wiki/Code_coverage +[5]: https://standard.publiccode.net/criteria/continuous-integration.html#requirements +[6]: https://standard.publiccode.net/criteria/continuous-integration.html#how-to-test +[7]: https://twitter.com/Eric_Herman/status/1224983465784938496 +[8]: https://opensource.com/article/20/2/automate-unit-tests +[9]: https://www.oreilly.com/library/view/test-driven-development/0321146530/ +[10]: https://github.com/ericherman/context-alloc diff --git a/sources/tech/20200419 A stress-free guide to keeping WordPress sites updated.md b/sources/tech/20200419 A stress-free guide to keeping WordPress sites updated.md new file mode 100644 index 0000000000..98ee9b1b1e --- /dev/null +++ b/sources/tech/20200419 A stress-free guide to keeping WordPress sites updated.md @@ -0,0 +1,116 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (A stress-free guide to keeping WordPress sites updated) +[#]: via: (https://opensource.com/article/20/4/updating-wordpress) +[#]: author: (Sara Kelly https://opensource.com/users/sarapk) + +A stress-free guide to keeping WordPress sites updated +====== +This practical guide to a necessary task will show you how to maximize +site performance and avoid bugs and other issues with regular updates. +![Working from home at a laptop][1] + +We all know how important it is to keep WordPress sites updated. New updates provide the latest bug and security fixes against any nasties lurking on the web. But, more critically, an outdated site can also lead to poor performance, such as slow loading speed or an outdated look and feel. + +Unfortunately, keeping your WordPress site up-to-date is not as easy as clicking a button. There are several components to consider, from theme to plugins to PHP. Even worse, updating too quickly can wreak another kind of havoc. Have you ever experienced the dreaded, "There has been a critical error on your website" warning after an innocent little update? I know I have, many times! + +Here is a practical guide on what to look out for, as well as when and what to update, to ensure your WordPress site works well. + +### Updating WordPress + +Let's start with the basics. Check your WordPress version is up-to-date by visiting Dashboard > Updates. + +![WordPress update screen][2] + +### Choosing a WordPress theme + +Before we deep dive into updating themes, I'd like to take a few steps back. Choose an up-to-date theme from the get-go and do your homework before installing it! There is nothing worse than pouring your heart and soul into customizing a new theme, only to discover it is buggy. + +Questions to ask when choosing a theme include: + + * When was it first created? + * What is the current version available? + * Does the theme provider still maintain an active demo site and helpdesk? + * What do recent reviews say about the theme? + + + +If the theme provider is no longer maintaining the theme, save yourself the trouble and move on. Also, don't assume that just because you paid for a theme, that is necessarily maintained. I recently fell into this trap when I purchased [Pinable][3]. I loved the Pinterest look and feel. However, soon after installation, I noticed the lack of customization within the theme settings, major compatibility issues arose with my plugins, and the customer service was nonexistent. I should have known better. The theme was created in 2013 and selling for a bargain. + +If you already have a theme, then pay attention to how frequently updates become available. If there are never any updates, the theme provider may have closed up shop. It is only a matter of time before the impact of an outdated theme will cause problems. + +A quick aside while we are on the topic—up-to-date themes also give access to the two new alignment options in the WordPress block editor, which enable wide-width and full-width images. These help your blog posts look more professional. While there are a number of [tutorials][4] on the web that show you how to manually update your functions, PHP file, and CSS to enable the new alignment blocks, the code does not always work on older themes (especially masonry themes). + +![Wordpress theme][5] + +### Updating themes + +To check the current version of your theme, go to Appearance > Themes and click on the active theme to see the current version. If an upgrade is available, there will be an alert banner. Click on "update now" to initiate the update. You can also check for updates by going to Dashboard > Updates. + +![Themify screenshot][6] + +If you purchased a theme from a marketplace such as [Envato][7] or [Themify][8], check the theme documentation to learn what is required to initiate updates, as it will not show up automatically in the dashboard. In most cases, you will be required to download and install a specific plugin or manually upload new versions when they become available. In the latter case, you will need to delete or rename the old theme file via your cPanel before you can install the new one. A guide to installing themes via cPanel is available [here][9]. + +If you plan to customize your theme extensively and are worried about the impact of this when upgrading, consider creating a child theme first. A child theme lets you make changes without touching the original theme's code. You can then update your site without losing any customizations you've made. Read more about child themes [here][10]. + +As I said before, the source of most issues tends to be the theme. Learn what is required to keep your theme up to date, and do so regularly. If your theme provider is no longer creating updates, then find a new theme. + +### Easy does it for plugins + +If you manage multiple plugins, then you will be used to the frequent dashboard reminders to update! Before we get onto that, though, let's touch on some basics. + +As a general rule, you don't want to have too many plugins. They slow down the speed of your site by creating more code that the browser has to load. Always delete any inactive plugins. I prefer to manage plugins on the Plugins tab. Here you can see all active and inactive plugins, the current version, and whether an update is available. To update the plugin, simply click "update." + +![Plugin update page][11] + +Nonetheless, I implore you to wait a week or two before installing new updates. Updating my plugins too quickly has caused me no end of grievances. To begin with, updates are prone to human error. Don't be the guinea pig that tests out the latest version. Sometimes, the newest version of a plugin is not compatible with an older version of WordPress or your theme. Check these are up-to-date first. + +### Website down after updating plugins? + +If your site has stopped working or performance has dropped noticeably after updating your plugins, then all is not lost. Forget about those newfangled plugins that promise to test speed and identify buggy plugins (the last thing you want is more plugins)! Disable all your plugins, then activate one at a time while you test the speed and performance of your site on a website such as [Pingdom][12]. This is a great exercise to perform periodically, even if your website has not crashed. Once you identify the plugin causing the problem, delete it. + +In the event you cannot access WordPress because there is a critical error, then you will need to access your files via cPanel and delete all the plugin folders from there ([full instructions here][13]). Don't worry; doing this will not impact your website's content. You can then proceed to reinstall and activate the plugins one-by-one via WordPress. + +Cache plugins tend to be the biggest culprit in my experience. Issues with cache plugins can be minimized by clearing the cache frequently. Do not install multiple cache plugins that perform the same function, as they will only serve to slow down your site. The only way to truly get around cache plugin issues is to either not use them, use a plugin recommended by your hosting provider, or become an expert on cache. [This blog][14] on common cache issues in WordPress is a good place to start. + +### Back up before updating PHP + +If you are concerned about your website speed and have spent enough time browsing Google for answers, then you likely have seen the advice, "You gotta update your PHP!" Please tread carefully with manual PHP updates, though! If you have a good hosting provider, you should never need to do this. Rather, select the option for automatic PHP version management with your host. Newer versions of PHP may not be stable or compatible with the version of WordPress you are running. Let your hosting provider be the one to determine when updates are ready. + +However, if you are adamant that an old version of PHP is causing your website to be slow, take care to follow these steps before initiating an update. First, back up your site. Investing in a premium version of [Jetpack][15] is worth its weight in gold. Jetpack can perform real-time as well as daily backups, depending on your plan. Not to mention, their customer service and troubleshooting support are excellent. Secondly, inform your hosting provider that you plan to update the PHP and seek their advice first. If your host is unable to advise or wants to charge you for the privilege, you should probably think about changing hosts. + +You can update PHP either via cPanel or via your hosting platform under Devs > PHP Manager. After that, you are on your own, as that is where my expertise on PHP ends. + +If you have any other tips or pitfalls regarding updating WordPress, drop them in the comments box below. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/4/updating-wordpress + +作者:[Sara Kelly][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/sarapk +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/wfh_work_home_laptop_work.png?itok=VFwToeMy (Working from home at a laptop) +[2]: https://opensource.com/sites/default/files/uploads/wp_update_1.png (Wordpress update screen) +[3]: https://www.theme-junkie.com/themes/pinable/ +[4]: https://www.billerickson.net/full-and-wide-alignment-in-gutenberg/ +[5]: https://opensource.com/sites/default/files/uploads/wp_theme_2.png (Wordpress theme) +[6]: https://opensource.com/sites/default/files/uploads/themify_3.png (Themify screenshot) +[7]: https://elements.envato.com/ +[8]: https://themify.me/ +[9]: https://hostadvice.com/how-to/how-to-install-a-wordpress-theme-using-cpanel/ +[10]: https://developer.wordpress.org/themes/advanced-topics/child-themes/ +[11]: https://opensource.com/sites/default/files/uploads/plugins_4.png (Plugin update page) +[12]: https://tools.pingdom.com/ +[13]: https://www.wpbeginner.com/plugins/how-to-deactivate-all-plugins-when-not-able-to-access-wp-admin/ +[14]: https://mhthemes.com/support/knb/solving-common-cache-issues-on-wordpress-websites/ +[15]: https://jetpack.com/upgrade/backup/?utm_source=google&utm_campaign=google_jetpack_search_brand_desktop_sg_en&utm_medium=paid_search&utm_term=%2Bwordpress%20%2Bjetpack%20%2Bbackup&creative=379260213317&campaignid=2061290863&utm_content=77066462603&matchtype=b&device=c&network=g&gclid=Cj0KCQjwu6fzBRC6ARIsAJUwa2RuPx5Dzr72eBEtZegsf11MmOBgLiwLX2HcEUXVaULIgv1MdZqGmeAaArmFEALw_wcB&gclsrc=aw.ds diff --git a/sources/tech/20200419 Getting Started With Pacman Commands in Arch-based Linux Distributions.md b/sources/tech/20200419 Getting Started With Pacman Commands in Arch-based Linux Distributions.md new file mode 100644 index 0000000000..f2fd06793f --- /dev/null +++ b/sources/tech/20200419 Getting Started With Pacman Commands in Arch-based Linux Distributions.md @@ -0,0 +1,250 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Getting Started With Pacman Commands in Arch-based Linux Distributions) +[#]: via: (https://itsfoss.com/pacman-command/) +[#]: author: (Dimitrios Savvopoulos https://itsfoss.com/author/dimitrios/) + +Getting Started With Pacman Commands in Arch-based Linux Distributions +====== + +_**Brief: This beginner’s guide shows you what you can do with pacmancommands in Linux, how to use them to find new packages, install and upgrade new packages, and clean your system.**_ + +The [pacman][1] package manager is one of the main difference between [Arch Linux][2] and other major distributions like Red Hat and Ubuntu/Debian. It combines a simple binary package format with an easy-to-use [build system][3]. The aim of pacman is to easily manage packages, either from the [official repositories][4] or the user’s own builds. + +If you ever used Ubuntu or Debian-based distributions, you might have used the apt-get or apt commands. Pacman is the equivalent in Arch Linux. If you [just installed Arch Linux][5], one of the first few [things to do after installing Arch Linux][6] is to learn to use pacman commands. + +In this beginner’s guide, I’ll explain some of the essential usage of the pacmand command that you should know for managing your Arch-based system. + +### Essential pacman commands Arch Linux users should know + +![][7] + +Like other package managers, pacman can synchronize package lists with the software repositories to allow the user to download and install packages with a simple command by solving all required dependencies. + +#### Install packages with pacman + +You can install a single package or multiple packages using pacman command in this fashion: + +``` +pacman -S _package_name1_ _package_name2_ ... +``` + +![Installing a package][8] + +The -S stands for synchronization. It means that pacman first synchronizes + +The pacman database categorises the installed packages in two groups according to the reason why they were installed: + + * **explicitly-installed**: the packages that were installed by a generic pacman -S or -U command + * **dependencies**: the packages that were implicitly installed because [required][9] by another package that was explicitly installed. + + + +#### Remove an installed package + +To remove a single package, leaving all of its dependencies installed: + +``` +pacman -R package_name_ +``` + +![Removing a package][10] + +To remove a package and its dependencies which are not required by any other installed package: + +``` +pacman -Rs _package_name_ +``` + +To remove dependencies that are no longer needed. For example, the package which needed the dependencies was removed. + +``` +pacman -Qdtq | pacman -Rs - +``` + +#### Upgrading packages + +Pacman provides an easy way to [update Arch Linux][11]. You can update all installed packages with just one command. This could take a while depending on how up-to-date the system is. + +The following command synchronizes the repository databases _and_ updates the system’s packages, excluding “local” packages that are not in the configured repositories: + +``` +pacman -Syu +``` + + * S stands for sync + * y is for refresh (local + * u is for system update + + + +Basically it is saying that sync to central repository (master package database), refresh the local copy of the master package database and then perform the system update (by updating all packages that have a newer version available). + +![System update][12] + +Attention! + +If you are an Arch Linux user before upgrading, it is advised to visit the [Arch Linux home page][2] to check the latest news for out-of-the-ordinary updates. If manual intervention is needed an appropriate news post will be made. Alternatively you can subscribe to the [RSS feed][13] or the [arch-announce mailing list][14]. + +Be also mindful to look over the appropriate [forum][15] before upgrading fundamental software (such as the kernel, xorg, systemd, or glibc), for any reported problems. + +**Partial upgrades are unsupported** at a rolling release distribution such as Arch and Manjaro. That means when new library versions are pushed to the repositories, all the packages in the repositories need to be rebuilt against the libraries. For example, if two packages depend on the same library, upgrading only one package, might break the other package which depends on an older version of the library. + +#### Use pacman to search for packages + +Pacman queries the local package database with the -Q flag, the sync database with the -S flag and the files database with the -F flag. + +Pacman can search for packages in the database, both in packages’ names and descriptions: + +``` +pacman -Ss _string1_ _string2_ ... +``` + +![Searching for a package][16] + +To search for already installed packages: + +``` +pacman -Qs _string1_ _string2_ ... +``` + +To search for package file names in remote packages: + +``` +pacman -F _string1_ _string2_ ... +``` + +To view the dependency tree of a package: + +``` +pactree _package_naenter code hereme_ +``` + +#### Cleaning the package cache + +Pacman stores its downloaded packages in /var/cache/pacman/pkg/ and does not remove the old or uninstalled versions automatically. This has some advantages: + + 1. It allows to [downgrade][17] a package without the need to retrieve the previous version through other sources. + 2. A package that has been uninstalled can easily be reinstalled directly from the cache folder. + + + +However, it is necessary to clean up the cache periodically to prevent the folder to grow in size. + +The [paccache(8)][18] script, provided within the [pacman-contrib][19] package, deletes all cached versions of installed and uninstalled packages, except for the most recent 3, by default: + +``` +paccache -r +``` + +![Clear cache][20] + +To remove all the cached packages that are not currently installed, and the unused sync database, execute: + +``` +pacman -Sc +``` + +To remove all files from the cache, use the clean switch twice, this is the most aggressive approach and will leave nothing in the cache folder: + +``` +pacman -Scc +``` + +#### Installing local or third-party packages + +Install a ‘local’ package that is not from a remote repository: + +``` +pacman -U _/path/to/package/package_name-version.pkg.tar.xz_ +``` + +Install a ‘remote’ package, not contained in an official repository: + +``` +pacman -U http://www.example.com/repo/example.pkg.tar.xz +``` + +### Bonus: Troubleshooting common errors with pacman + +Here are some common errors you may encounter while managing packages with pacman. + +#### Failed to commit transaction (conflicting files) + +If you see the following error: + +``` +error: could not prepare transaction +error: failed to commit transaction (conflicting files) +package: /path/to/file exists in filesystem +Errors occurred, no packages were upgraded. +``` + +This is happening because pacman has detected a file conflict and will not overwrite files for you. + +A safe way to solve this is to first check if another package owns the file (pacman -Qo _/path/to/file_). If the file is owned by another package, file a bug report. If the file is not owned by another package, rename the file which ‘exists in filesystem’ and re-issue the update command. If all goes well, the file may then be removed. + +Instead of manually renaming and later removing all the files that belong to the package in question, you may explicitly run _**pacman -S –overwrite glob package**_ to force pacman to overwrite files that match _glob_. + +#### Failed to commit transaction (invalid or corrupted package) + +Look for .part files (partially downloaded packages) in /var/cache/pacman/pkg/ and remove them. It is often caused by usage of a custom XferCommand in pacman.conf. + +#### Failed to init transaction (unable to lock database) + +When pacman is about to alter the package database, for example installing a package, it creates a lock file at /var/lib/pacman/db.lck. This prevents another instance of pacman from trying to alter the package database at the same time. + +If pacman is interrupted while changing the database, this stale lock file can remain. If you are certain that no instances of pacman are running then delete the lock file. + +Check if a process is holding the lock file: + +``` +lsof /var/lib/pacman/db.lck +``` + +If the above command doesn’t return anything, you can remove the lock file: + +``` +rm /var/lib/pacman/db.lck +``` + +If you find the PID of the process holding the lock file with lsof command output, kill it first and then remove the lock file. + +I hope you like my humble effort in explaining the basic pacman commands. Please leave your comments below and don’t forget to subscribe on our social media. Stay safe! + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/pacman-command/ + +作者:[Dimitrios Savvopoulos][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/dimitrios/ +[b]: https://github.com/lujun9972 +[1]: https://www.archlinux.org/pacman/ +[2]: https://www.archlinux.org/ +[3]: https://wiki.archlinux.org/index.php/Arch_Build_System +[4]: https://wiki.archlinux.org/index.php/Official_repositories +[5]: https://itsfoss.com/install-arch-linux/ +[6]: https://itsfoss.com/things-to-do-after-installing-arch-linux/ +[7]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/04/essential-pacman-commands.jpg?ssl=1 +[8]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/04/sudo-pacman-S.png?ssl=1 +[9]: https://wiki.archlinux.org/index.php/Dependency +[10]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/04/sudo-pacman-R.png?ssl=1 +[11]: https://itsfoss.com/update-arch-linux/ +[12]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/04/sudo-pacman-Syu.png?ssl=1 +[13]: https://www.archlinux.org/feeds/news/ +[14]: https://mailman.archlinux.org/mailman/listinfo/arch-announce/ +[15]: https://bbs.archlinux.org/ +[16]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/04/sudo-pacman-Ss.png?ssl=1 +[17]: https://wiki.archlinux.org/index.php/Downgrade +[18]: https://jlk.fjfi.cvut.cz/arch/manpages/man/paccache.8 +[19]: https://www.archlinux.org/packages/?name=pacman-contrib +[20]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/04/sudo-paccache-r.png?ssl=1 diff --git a/sources/tech/20200420 New open source GIS projects for Kubernetes applications.md b/sources/tech/20200420 New open source GIS projects for Kubernetes applications.md new file mode 100644 index 0000000000..a8fdec6e71 --- /dev/null +++ b/sources/tech/20200420 New open source GIS projects for Kubernetes applications.md @@ -0,0 +1,99 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (New open source GIS projects for Kubernetes applications) +[#]: via: (https://opensource.com/article/20/4/gis-kubernetes) +[#]: author: (Adam Timm https://opensource.com/users/timmam) + +New open source GIS projects for Kubernetes applications +====== +pg_tileserv and pg_featureserv make it easier for developers to add +location services to Kubernetes applications. +![A map with a route highlighted][1] + +Spatial data from geographic information systems (GIS) is all around us. From smartphones that make our lives better and more convenient to precision agriculture that is increasing the amount of food farmers can produce while reducing the cost, whether or not we realize it, almost every part of our lives is touched by spatial data. + +This increase of spatial data is simultaneously bringing an increase of open spatial datasets that people can consume and use to build all sorts of new applications. However, these types of datasets have not always been easy to work with. Also, due to the size of some of the geographic data, they can be difficult to bring to modern application deployment frameworks such as Kubernetes. + +To help with these issues, [Crunchy Data][2] recently announced two new open source projects, [pg_tileserv][3] and [pg_featureserv][4], to make it easier to develop cloud-native spatial applications. These projects, part of open source [Crunchy Spatial][5], help developers leverage the robust [PostGIS][6] geospatial database extension to [PostgreSQL][7] without having to write complex SQL statements. + +So what are pg_tileserv and pg_featuresev, how do they make it easier for developers to add location services to their Kubernetes applications, and what does this mean for the future of spatial applications? + +### Traditional GIS vs. modern spatial microservices + +Traditionally, when an organization or individual works with spatial data, they start with a product that grew up as a GIS. There are many high-quality open source GIS products ([QGIS][8], [GeoServer][9], [GeoNode][10], etc.), but they may not align with modern, cloud-native approaches to software design. + +The popularity of Kubernetes creates challenges for these legacy applications around automation and deployment, as they require a lot of manual configuration, for example, when data sources are added and modified. In many setups, these spatial applications must exist outside Kubernetes and cannot leverage many of the conveniences it provides. + +In contrast, modern spatial services should be driven by the spatial data that they are processing and serving out. They should align with modern software development practices and scale efficiently and integrate easily with developer workflows. + +Applications that are spatially aware also need to ensure they can handle the unique characteristics of spatial data (e.g., geometries, projections, etc.). To do all of this in independent microservices can be challenging unless you have a highly capable database to do the majority of the work for you. This is where pg_tileserv and pg_featureserv help, as both projects leverage the power of PostGIS, an open source geospatial extension to PostgreSQL, to provide advanced spatial capabilities from a simple REST framework + +### Generate map vector tiles with pg_tileserv + +![pg_tileserv][11] + +pg_tileserv is a lightweight vector tile server written in Go that enables you to generate [vector tiles][12] directly from PostGIS. It does this by implementing the **ST_AsMVT()** function in a best-practice method that translates an HTTP request to the database. It includes common defaults that allow you to pass a database connection URL to the server and be up and running in no time. There's no heavyweight software to install and configure, and it's designed for cloud-native GIS applications. + +For specific examples on how to use it, check out our blog posts on [tile serving][13] and [spatial tile serving with PostgreSQL functions][14]. + +### Annotate your maps with pg_featureserv + +![pg_featureserv][15] + +pg_featureserv is a lightweight service written in Go that enables you to serve features directly out of PostGIS. It implements the [OGC API][16] for features and provides a standard REST endpoint for your spatial data and functions contained in PostGIS. Just like pg_tileserv, there's no heavyweight software to install; just pass a database connection URL to your PostGIS database, and you're off to the races. For a specific example of how to use it, check out our post on [querying spatial features][17]. + +### Focus on spatial data, not GIS + +With our deep background in developing PostGIS and building PostGIS-backed applications, we wanted to help developers unlock all the value of spatial data in a way that is easy to deploy, scale, and maintain. As the source code of pg_tileserv and pg_featureserv show, we are just leveraging functions already in PostGIS. This allows developers to quickly add spatial data to their applications and data scientists to focus on the data. + +![GIS architecture][18] + +The benefits of this approach are: + + * Faster performance because PostgreSQL and PostGIS are doing the work for you + * Less configuration to maintain because the database structure is the configuration + * By design, it runs in the cloud at enterprise scale from the start + * Shorter times to update customer-facing applications—when you update your data in the database, your application is updated instantly + * Ability to focus more on maintaining your data and delivering value to your users and less on wrangling software + + + +Also, since these services respond to the configuration of your database, they also expose functions contained in the database. Rather than developing their data functions to incorporate them into software later, data scientists can create functions in the database that are immediately made available via a REST API. The software begins to fade into the background so an organization can focus on the data. + +Suffice it to say, we're pretty excited about these new geospatial services, and we definitely want your feedback on them. Feel free to check out [pg_tileserve][3] and [pg_featureserv][4], try deploying them alongside your PostGIS databases with the [PostgreSQL Operator][19], and share your feedback in the comments. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/4/gis-kubernetes + +作者:[Adam Timm][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/timmam +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/map_route_location_gps_path.png?itok=RwtS4DsU (A map with a route highlighted) +[2]: https://www.crunchydata.com/ +[3]: https://github.com/CrunchyData/pg_tileserv +[4]: https://github.com/CrunchyData/pg_featureserv +[5]: https://www.crunchydata.com/products/crunchy-spatial/ +[6]: https://postgis.net/ +[7]: https://www.postgresql.org +[8]: https://www.qgis.org/en/site/ +[9]: http://geoserver.org/ +[10]: http://geonode.org/ +[11]: https://opensource.com/sites/default/files/pg_tileserv.jpg (pg_tileserv) +[12]: https://info.crunchydata.com/blog/dynamic-vector-tiles-from-postgis +[13]: https://info.crunchydata.com/blog/crunchy-spatial-tile-serving +[14]: https://info.crunchydata.com/blog/crunchy-spatial-tile-serving-with-postgresql-functions +[15]: https://opensource.com/sites/default/files/pg_featureserv.jpg (pg_featureserv) +[16]: http://www.ogcapi.org/ +[17]: https://info.crunchydata.com/blog/crunchy-spatial-querying-spatial-features-with-pg_featureserv +[18]: https://opensource.com/sites/default/files/uploads/architecture_0.png (GIS architecture) +[19]: https://github.com/CrunchyData/postgres-operator diff --git a/sources/tech/20200421 How I use Hugo for my classroom-s open source CMS.md b/sources/tech/20200421 How I use Hugo for my classroom-s open source CMS.md new file mode 100644 index 0000000000..bef4b09a9a --- /dev/null +++ b/sources/tech/20200421 How I use Hugo for my classroom-s open source CMS.md @@ -0,0 +1,99 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How I use Hugo for my classroom's open source CMS) +[#]: via: (https://opensource.com/article/20/4/hugo-classroom) +[#]: author: (Peter Cheer https://opensource.com/users/petercheer) + +How I use Hugo for my classroom's open source CMS +====== +This open source software streamlines text editing while leaving room +for customization. +![Digital hand surrounding by objects, bike, light bulb, graphs][1] + +People love Markdown text with good reason—it is easy to write, easy to read, easy to edit, and it can be converted to a wide range of other text mark up formats. While Markdown text is very good for content creation and manipulation, it imposes limitations on the options for content display. + +If we could combine the virtues of Markdown with the power and flexibility of Cascading Style Sheets, HTML5, and JavaScript, that would be something special. One of the programs trying to do this is [Hugo][2]. Hugo was created in 2013 by Steve Francia; it is cross-platform and open source under an Apache 2.0 license with an active developer community and a growing user base. + +The basic concept is that pieces of content, such as web pages or blog posts, written in Markdown and associated with metadata, are converted into HTML and combined with templates and themes to produce a complete web site. The power and flexibility come through these themes and templates or changing the default behaviors of Hugo. This power comes with a degree of unavoidable complexity, but there are lots of [pre-built templates][3] available if you lack the time or inclination to make your own. + +Installing Hugo on my Linux machine was quick and easy. Starting a new project is as simple as typing **hugo new site quickstart** at the command line which creates a new project with this folder structure: + + * **archetypes**: Content template files that contain preconfigured front matter metadata (date, title, draft). You can create new archetypes with custom front matter fields. + * **assets**: Stores all the files, which are processed by Hugo Pipes (e.g., CSS/Sass files). This directory is not created by default. + * **config.toml**: The default site config file. + * **content**: Where all the content Markdown files live. + * **data**: Used to store configuration files that can be used by Hugo when generating your website. + * **layouts**: Stores templates as .html files. + * **static**: Stores all the static content—images, CSS, JavaScript, etc. + * **themes**: For the Hugo theme of your choice. + + + +The Markdown files in the content folder can be created manually or by Hugo and edited with any text editor or your Markdown creation tool of choice. If created manually, you will need to add any metadata that is needed. I prefer to use [Ghostwriter][4] for writing Markdown. Images are usually kept in a sub-folder in the static folder. Site development can proceed quickly, as Hugo includes a web server for testing and pre-viewing. + +To check your work, type **hugo server** at the command line to start the server. By default, Hugo will not publish: + + * Content with a future **publishdate** value. + * Content with **draft: true** status. + * Content with a past **expirydate** value. + + + +Adding **hugo server -D** will include draft articles, and Hugo can be configured to mark all new articles as draft. After starting the web server, you can see your work in a web browser at localhost:1313. Once the server is started by default, it will automatically reload the browser window when it detects a change to one of your files. + +There are tasks Markdown cannot do that need some HTML code. Hugo recognizes this but believes in keeping Markdown code as clean, simple, and uncluttered as possible. Hugo does this with shortcodes such as **{{< youtube id= "w7Ft2ymGmfc" autoplay= "true">}}**, which will embed the YouTube video with id. w7Ft2ymGmfc. There are quite a few pre-built shortcodes for common tasks, but it is also possible to create your own for particular jobs. + +I work in education quite a lot and wanted to include some interactive puzzles and questions on my Hugo-generated website. To get the output looking like this: + +![JClic shortcode][5] + +I created the activities with an open source Java program called [JClic][6], exported them as HTML5, put that into static/activities/excel, and displayed it in an iframe. + +The HTML code, which would spoil the nice clean Markdown content, looks like this: + + +``` +    <[iframe][7] +       src="/activity/excel/index.html" +       title="Activity" +       height="400" +       frameborder="0" +       marginwidth="0" +       marginheight="0" +       scrolling="no" +       style="border: 1px solid #CCC; border-width: 1px; margin-bottom: 20px; width: 100%;" +       allowfullscreen="true"> +    </[iframe][7]> +``` + +The code is saved in layouts/shortcodes as **activity.html** + +This makes the shortcode placed inside my Markdown file **{{<activity>}}**, which is much neater. + +When your project is ready, you can build it with the **hugo** command; this will create a public folder and generate the website in it. Hugo has a number of built-in deployment options for different hosting providers—basically, you deploy your site by copying the public folder to your production web server. There is a lot more to Hugo that I haven't even gotten to yet, including configuration options, importing content from other static site generators and Wordpress, display data from JSON files, syntax highlighting of source code, and the fact that it is very fast (an advantage when working with large sites). + +In many software tools, ease-of-use comes at the expense of flexibility, or vice-versa; Hugo makes a largely successful attempt at including both. For basic use with Markdown content and a pre-built theme, Hugo is easy to use and produces rapid results. Alternatively, if you have the need to alter the configuration settings or dive in and create your own themes, shortcodes, templates, or metadata schemes, that choice is open to you. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/4/hugo-classroom + +作者:[Peter Cheer][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/petercheer +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/rh_003588_01_rd3os.combacktoschoolseriesk12_rh_021x_0.png?itok=fvorN0e- (Digital hand surrounding by objects, bike, light bulb, graphs) +[2]: https://gohugo.io/ +[3]: https://themes.gohugo.io/ +[4]: http://github.com/wereturtle/ghostwriter +[5]: https://opensource.com/sites/default/files/uploads/jclic_shortcode.png (JClic shortcode) +[6]: https://clic.xtec.cat/legacy/en/index.html +[7]: http://december.com/html/4/element/iframe.html diff --git a/sources/tech/20200421 How I use Python to map the global spread of COVID-19.md b/sources/tech/20200421 How I use Python to map the global spread of COVID-19.md new file mode 100644 index 0000000000..2f5f8dbef0 --- /dev/null +++ b/sources/tech/20200421 How I use Python to map the global spread of COVID-19.md @@ -0,0 +1,170 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How I use Python to map the global spread of COVID-19) +[#]: via: (https://opensource.com/article/20/4/python-map-covid-19) +[#]: author: (AnuragGupta https://opensource.com/users/999anuraggupta) + +How I use Python to map the global spread of COVID-19 +====== +Create a color coded geographic map of the potential spread of the virus +using these open source scripts. +![Globe up in the clouds][1] + +The spread of disease is a real concern for a world in which global travel is commonplace. A few organizations track significant epidemics (and any pandemic), and fortunately, they publish their work as open data. The raw data can be difficult for humans to process, though, and that's why data science is so vital. For instance, it could be useful to visualize the worldwide spread of COVID-19 with Python and Pandas. + +It can be hard to know where to start when you're faced with large amounts of raw data. The more you do it, however, the more patterns begin to emerge. Here's a common scenario, applied to COVID-19 data: + + 1. Download COVID-19 country spread daily data into a Pandas DataFrame object from GitHub. For this, you need the Python Pandas library. + 2. Process and clean the downloaded data and make it suitable for visualizing. The downloaded data (as you will see for yourself) is in quite good condition. The one problem with this data is that it uses the names of countries, but it's better to use three-digit ISO 3 codes. To generate the three-digit ISO 3 codes, use a small Python library called pycountry. Having generated these codes, you can add an extra column to our DataFrame and populate it with these codes. + 3. Finally, for the visualization, use the **express** module of a library called Plotly. This article uses what are called choropleth maps (available in Plotly) to visualize the worldwide spread of the disease. + + + +### Step 1: Corona data + +We will download the latest corona data from: + + + +We will load the data directly into a Pandas DataFrame. Pandas provides a function, **read_csv()**, which can take a URL and return a DataFrame object as shown below: + + +``` +import pycountry +import plotly.express as px +import pandas as pd +URL_DATASET = r'' +df1 = pd.read_csv(URL_DATASET) +print(df1.head(3))  # Get first 3 entries in the dataframe +print(df1.tail(3))  # Get last 3 entries in the dataframe +``` + +The screenshot of output (on Jupyter) is: + +![Jupyter screenshot][2] + +From output, you can see that the DataFrame (df1) has the following columns: + + 1. Date + 2. Country + 3. Confirmed + 4. Recovered + 5. Dead + + + +Further, you can see that the **Date** column has entries starting from January 22 to March 31. This database is updated daily, so you will get the current values. + +### Step 2: Cleaning and modifying the data frame + +We need to add another column to this DataFrame, which has the three-letter ISO alpha-3 codes. To do this, I followed these steps: + + 1. Create a list of all countries in the database. This was required because in the **df**, in the column **Country**, each country was figuring for each date. So in effect, the **Country** column had multiple entries for each country. To do this, I used the **unique().tolist()** functions. + 2. Then I took a dictionary **d_country_code** (initially empty) and populated it with keys consisting of country names and values consisting of their three-letter ISO codes. + 3. To generate the three-letter ISO code for a country, I used the function **pycountry.countries.search_fuzzy(country)**. You need to understand that the return value of this function is a "list of **Country** objects." I passed the return value of this function to a name country_data. Further, in this list of objects, the first object i.e., at index 0, is the best fit. Further, this **\** object has an attribute **alpha_3**. So, I can "access" the 3 letter ISO code by using **country_data[0].alpha_3**. However, it is possible that some country names in the DataFrame may not have a corresponding ISO code (For example, disputed territories). So, for such countries, I gave an ISO code of "i.e. a blank string. Further, you need to wrap this code in a try-except block. The statement: **print(_‘could not add ISO 3 code for ->'_, country)** will give a printout of those countries for which the ISO 3 codes could not be found. In fact, you will find such countries as shown with white color in the final output. + 4. Having got the three-letter ISO code for each country (or an empty string for some), I added the country name (as key) and its corresponding ISO code (as value) to the dictionary **d_country_code**. For adding these, I used the **update()** method of the Python dictionary object. + 5. Having created a dictionary of country names and their codes, I added them to the DataFrame using a simple for loop. + + + +### Step 3: Visualizing the spread using Plotly + +A choropleth map is a map composed of colored polygons. It is used to represent spatial variations of a quantity. We will use the express module of Plotly conventionally called **px**. Here we show you how to create a choropleth map using the function: **px.choropleth**. + +The signature of this function is: + + +``` +`plotly.express.choropleth(data_frame=None, lat=None, lon=None, locations=None, locationmode=None, geojson=None, featureidkey=None, color=None, hover_name=None, hover_data=None, custom_data=None, animation_frame=None, animation_group=None, category_orders={}, labels={}, color_discrete_sequence=None, color_discrete_map={}, color_continuous_scale=None, range_color=None, color_continuous_midpoint=None, projection=None, scope=None, center=None, title=None, template=None, width=None, height=None)` +``` + +The noteworthy points are that the **choropleth()** function needs the following things: + + 1. A geometry in the form of a **geojson** object. This is where things are a bit confusing and not clearly mentioned in its documentation. You may or may not provide a **geojson** object. If you provide a **geojson** object, then that object will be used to plot the earth features, but if you don't provide a **geojson** object, then the function will, by default, use one of the built-in geometries. (In our example here, we will use a built-in geometry, so we won't provide any value for the **geojson** argument) + 2. A pandas DataFrame object for the attribute **data_frame**. Here we provide our DataFrame ie **df1** we created earlier. + 3. We will use the data of **Confirmed** column to decide the color of each country polygon. + 4. Further, we will use the **Date** column to create the **animation_frame**. Thus as we slide across the dates, the colors of the countries will change as per the values in the **Confirmed** column. + + + +The complete code is given below: + + +``` +import pycountry +import plotly.express as px +import pandas as pd +# ----------- Step 1 ------------ +URL_DATASET = r'' +df1 = pd.read_csv(URL_DATASET) +# print(df1.head) # Uncomment to see what the dataframe is like +# ----------- Step 2 ------------ +list_countries = df1['Country'].unique().tolist() +# print(list_countries) # Uncomment to see list of countries +d_country_code = {}  # To hold the country names and their ISO +for country in list_countries: +    try: +        country_data = pycountry.countries.search_fuzzy(country) +        # country_data is a list of objects of class pycountry.db.Country +        # The first item  ie at index 0 of list is best fit +        # object of class Country have an alpha_3 attribute +        country_code = country_data[0].alpha_3 +        d_country_code.update({country: country_code}) +    except: +        print('could not add ISO 3 code for ->', country) +        # If could not find country, make ISO code ' ' +        d_country_code.update({country: ' '}) + +# print(d_country_code) # Uncomment to check dictionary   + +# create a new column iso_alpha in the df +# and fill it with appropriate iso 3 code +for k, v in d_country_code.items(): +    df1.loc[(df1.Country == k), 'iso_alpha'] = v + +# print(df1.head)  # Uncomment to confirm that ISO codes added +# ----------- Step 3 ------------ +fig = px.choropleth(data_frame = df1, +                    locations= "iso_alpha", +                    color= "Confirmed",  # value in column 'Confirmed' determines color +                    hover_name= "Country", +                    color_continuous_scale= 'RdYlGn',  #  color scale red, yellow green +                    animation_frame= "Date") + +fig.show() +``` + +The output is something like the following: + +![Map][3] + +You can download and run the [complete code][4]. + +To wrap up, here are some excellent resources on choropleth in Plotly: + + * + * [https://plotly.com/python/reference/#choropleth][5] + + + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/4/python-map-covid-19 + +作者:[AnuragGupta][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/999anuraggupta +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/cloud-globe.png?itok=_drXt4Tn (Globe up in the clouds) +[2]: https://opensource.com/sites/default/files/uploads/jupyter_screenshot.png (Jupyter screenshot) +[3]: https://opensource.com/sites/default/files/uploads/map_2.png (Map) +[4]: https://github.com/ag999git/jupyter_notebooks/blob/master/corona_spread_visualization +[5]: tmp.azs72dmHFd#choropleth diff --git a/sources/tech/20200421 How to take advantage of Linux-s extensive vocabulary.md b/sources/tech/20200421 How to take advantage of Linux-s extensive vocabulary.md new file mode 100644 index 0000000000..249d9d84f5 --- /dev/null +++ b/sources/tech/20200421 How to take advantage of Linux-s extensive vocabulary.md @@ -0,0 +1,273 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How to take advantage of Linux's extensive vocabulary) +[#]: via: (https://www.networkworld.com/article/3539011/how-to-takke-advantage-of-linuxs-extensive-vocabulary.html) +[#]: author: (Sandra Henry-Stocker https://www.networkworld.com/author/Sandra-Henry_Stocker/) + +How to take advantage of Linux's extensive vocabulary +====== +Linux systems don't only know a lot of words, it has commands that can help you use them by finding words that are on the tip of your tongue or fixing your typos. +Sandra Henry-Stocker + +While you might not think of Linux as a writing tutor, it does have some commendable language skills – at least when it comes to English. While the average American probably has a vocabulary between 20,000 and 50,000 words, Linux can claim over 100,000 words (spellings, not definitions). And you can easily put this vocabulary to work for you in a number of ways. Let’s look at how Linux can help with your word challenges. + +### Help with finding words + +First, let’s focus on finding words.If you use the **wc** command to count the number of words in the **/usr/share/dict/words** file on your system, you should see something like this: + +``` +$ wc -l /usr/share/dict/words +102402 /usr/share/dict/words +``` + +As you can see, the **words** file on this system contains 102,402 words. So, when you’re trying to nail down just the right word and are having trouble, you stand a good chance of finding it on your system by remembering (or guessing at) some part of it. But you'll need a little help narrowing down those 102,402 words to a group worth your time to review. In this command, we’re looking for words that start with the letters “revi”. + +[[Get regularly scheduled insights by signing up for Network World newsletters.]][1] + +``` +$ grep ^reviv /usr/share/dict/words +revival +revival's +revivalist +revivalist's +revivalists +revivals +revive +revived +revives +revivification +revivification's +revivified +revivifies +revivify +revivifying +reviving +``` + +That’s sixteen words that start with the string “revi”. The **^** character represents the beginning of the word and, as you might have suspected, each word in the file is on a line by itself. + +A good number of the words in the **/usr/share/dict/words** file are names. If you want to  find words regardless of whether they're capitalized, add the **-i** (ignore case) option to your **grep** command. + +``` +$ grep -i ^wool /usr/share/dict/words +Woolf +Woolf's +Woolite +Woolite's +Woolongong +Woolongong's +Woolworth +Woolworth's +wool +... +``` + +You can also look for words that end in or contain a certain string of letters. In this next command, we look for words that contain the string “nativ” at any location. + +``` +$ grep 'nativ' /usr/share/dict/words +alternative +alternative's +alternatively +alternatives +imaginative +imaginatively +native +native's +natives +nativities +nativity +nativity's +nominative +nominative's +nominatives +unimaginative +``` + +In this next command, we look for words that end in “emblance”, the **$** character representing the end of the line. Only two words in the **words** file fit the bill. + +[][2] + +``` +$ grep 'emblance$' /usr/share/dict/words +resemblance +semblance +``` + +If we, for some reason, want to find words with exactly 21 letters, we could use this command: + +``` +$ grep '^.....................$' /usr/share/dict/words +counterintelligence's +electroencephalograms +electroencephalograph +``` + +On the other hand, making sure we've typed the correct number of dots can be tedious. This next command is little easier to manage: + +``` +$ grep -E '^[[:alpha:]]{21}$' /usr/share/dict/words +electroencephalograms +electroencephalograph +``` + +This command does the same thing: + +``` +$ grep -E '^\w{21}$' /usr/share/dict/words +electroencephalograms +electroencephalograph +``` + +The one important difference between these commands is that the one with the dots matches any string of 21 characters. The two specifying "alpha" or "\w" only match letters, so they find only two matching words. + +Now let’s look for words that contain 20 letters (or more) in a row. + +``` +$ grep -E '(\w{20})' /usr/share/dict/words +Andrianampoinimerina +Andrianampoinimerina's +counterrevolutionaries +counterrevolutionary +counterrevolutionary's +electroencephalogram +electroencephalogram's +electroencephalograms +electroencephalograph +electroencephalograph's +electroencephalographs +uncharacteristically +``` + +That command returns words with apostrophes because they contain 20 letters in a row before they get to that point. + +Next, we’ll check out words with 21 or more characters. The 1 and 20 in combination with the **v** (invert) option in this command cause **grep** to skip over words with anywhere from 1 to 20 characters. + +``` +$ grep -vwE '\w{1,20}' /usr/share/dict/words +counterrevolutionaries +electroencephalograms +electroencephalograph +electroencephalographs +``` + +In this next command, we look for words that start with “ex” and have four additional letters. + +``` +$ grep '^ex.\{4\}$' /usr/share/dict/words +exacts +exalts +exam's +exceed +excels +except +excess +excise +excite +excuse +… +``` + +In case you're curious, the **words** file on this system contains 43 such words: + +``` +$ grep '^ex.\{4\}$' /usr/share/dict/words | wc -l +43 +``` + +To get help with spelling, you should try **aspell**. It can help you with individual words or run a spell check scan through an entire text file. In this first example, we ask **aspell** to help with a single word. It finds the word we’re after along with a couple other possibilities. + +### Checking a word + +``` +$ aspell -a +@(#) International Ispell Version 3.1.20 (but really Aspell 0.60.7) +prolifferate <== entered word +& prolifferate 3 0: proliferate, proliferated, proliferates <== replacement options +``` + +If **aspell** doesn’t provide a list of words, that means that the spelling you offered was correct. Here's an example: + +``` +$ aspell -a +@(#) International Ispell Version 3.1.20 (but really Aspell 0.60.7) +proliferate <== entered text +* <== no suggestions +``` + +Typing **^C** (control-c) exits **aspell**. + +### Checking a file + +When checking a file with **aspell**, you get suggestions for each misspelled word. When **aspell** spots typos, it highlights the misspelled words one at a time and gives you a chance to choose from a list of properly spelled words that are similar enough to the misspelled words to be good candidates for replacing them. + +To start checking a file, type **aspell -c** followed by the file name. + +``` +$ aspell -c thesis +``` + +You'll see something like this: + +``` +This thesis focusses on … + +1) focuses 6) Fosse's +2) focused 7) flosses +3) cusses 8) courses +4) fusses 9) focus +5) focus's 0) fuses +i) Ignore I) Ignore all +r) Replace R) Replace all +a) Add l) Add Lower +b) Abort x) Exit +``` + +Make your selection by pressing the key listed next to the word you want (1, 2, etc.) and **aspell** will replace the misspelled word in the file and move on to the next one if there are others. Notice that you also have options to replace the word by typing another one. Press "x" when you're done. + +### Help with crossword puzzles + +If you’re working on a crossword puzzle and need to find a five-letter word that starts with a “d” and has a “u” as its fourth letter, you can use a command like this: + +``` +$ grep -i '^d..u.$' /usr/share/dict/words +datum +debug +debut +demur +donut +``` + +### Help with word scrambles + +If you’re working on a puzzle that requires you to de-scramble the letters in a string until you've found a proper word, you can offer the list of letters to grep like this example in which **grep** turns the letters "yxusonlia" into the word “anxiously”. + +``` +$ grep -P '^(?:([yxusonlia])(?!.*?\1)){9}$' /usr/share/dict/words +anxiously +``` + +Linux’s word skills are impressive and sometimes even fun. Whether you're hoping to find words you can't quite call to mind or get a little help cheating on word puzzles, Linux offers some clever options. + +Join the Network World communities on [Facebook][3] and [LinkedIn][4] to comment on topics that are top of mind. + +-------------------------------------------------------------------------------- + +via: https://www.networkworld.com/article/3539011/how-to-takke-advantage-of-linuxs-extensive-vocabulary.html + +作者:[Sandra Henry-Stocker][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.networkworld.com/author/Sandra-Henry_Stocker/ +[b]: https://github.com/lujun9972 +[1]: https://www.networkworld.com/newsletters/signup.html +[2]: https://www.networkworld.com/blog/itaas-and-the-corporate-storage-technology/?utm_source=IDG&utm_medium=promotions&utm_campaign=HPE22140&utm_content=sidebar (ITAAS and Corporate Storage Strategy) +[3]: https://www.facebook.com/NetworkWorld/ +[4]: https://www.linkedin.com/company/network-world diff --git a/sources/tech/20200423 4 open source chat applications you should use right now.md b/sources/tech/20200423 4 open source chat applications you should use right now.md new file mode 100644 index 0000000000..25aa100c53 --- /dev/null +++ b/sources/tech/20200423 4 open source chat applications you should use right now.md @@ -0,0 +1,139 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (4 open source chat applications you should use right now) +[#]: via: (https://opensource.com/article/20/4/open-source-chat) +[#]: author: (Sudeshna Sur https://opensource.com/users/sudeshna-sur) + +4 open source chat applications you should use right now +====== +Collaborating remotely is an essential capability now, making open +source real-time chat an essential piece of your toolbox. +![Chat bubbles][1] + +The first thing we usually do after waking up in the morning is to check our cellphone to see if there are important messages from our colleagues and friends. Whether or not it's a good idea, this behavior has become part of our daily lifestyle. + +> _"Man is a rational animal. He can think up a reason for anything he wants to believe."_ +> _– Anatole France_ + +No matter the soundness of the reason, we all have a suite of communication tools—email, phone calls, web-conferencing tools, or social networking—we use on a daily basis. Even before COVID-19, working from home already made these communication tools an essential part of our world. And as the pandemic has made working from home the new normal, we're facing unprecedented changes to how we communicate, which makes these tools not merely essential but now required. + +### Why chat? + +When working remotely as a part of a globally distributed team, we must have a collaborative environment. Chat applications play a vital role in helping us stay connected. In contrast to email, chat applications provide fast, real-time communications with colleagues around the globe. + +There are a lot of factors involved in choosing a chat application. To help you pick the right one for you, in this article, I'll explore four open source chat applications and one open source video-communication tool (for when you need to be "face-to-face" with your colleagues), then outline some of the features you should look for in an effective communication application. + +### 4 open source chat apps + +#### Rocket.Chat + +![Rocket.Chat][2] + +[Rocket.Chat][3] is a comprehensive communication platform that classifies channels as public (open to anyone who joins) or private (invitation-only) rooms. You can also send direct messages to people who are logged in; share documents, links, photos, videos, and GIFs; make video calls; and send audio messages without leaving the platform. + +Rocket.Chat is free and open source, but what makes it unique is its self-hosted chat system. You can download it onto your server, whether it's an on-premises server or a virtual private server on a public cloud. + +Rocket.Chat is completely free, and its [source code][4] is available on GitHub. Many open source projects use Rocket.Chat as their official communication platform. It is constantly evolving with new features and improvements. + +The things I like the most about Rocket.Chat are its ability to be customized according to user requirements and that it uses machine learning to do automatic, real-time message translation between users. You can also download Rocket.Chat for your mobile device and use it on the go. + +#### IRC + +![IRC on WeeChat 0.3.5][5] + +[Internet Relay Chat (IRC)][6] is a real-time, text-based form of communication. Although it's one of the oldest forms of electronic communication, it remains popular among many well-known software projects. + +IRC channels are discrete chat rooms. It allows you to have conversations with multiple people in an open channel or chat with someone privately one-on-one. If a channel name starts with a #, you can assume it to be official, whereas chat rooms that begin with ## are unofficial and usually casual. + +[Getting started with IRC][7] is easy. Your IRC handle or nickname is what allows people to find you, so it must be unique. But your choice of IRC client is completely your decision. If you want a more feature-rich application than a standard IRC client, you can connect to IRC with [Riot.im][8]. + +Given its age, why should you still be on IRC? For one reason, it remains the home for many of the free and open source projects we depend on. If you want to participate in open source software and communities, IRC is the option to get started. + +#### Zulip + +![Zulip][9] + +[Zulip][10] is a popular group-chat application that follows the topic-based threading model. In Zulip, you subscribe to streams, just like in IRC channels or Rocket.Chat. But each Zulip stream opens a topic that is unique, which helps you track conversations later, thus making it more organized. + +Like other platforms, it supports emojis, inline images, video, and tweet previews. It also supports LaTeX for sharing math formulas or equations and Markdown and syntax highlighting for sharing code. + +Zulip is cross-platform and offers APIs for building your own integrations. Something I especially like about Zulip is its integration feature with GitHub: if I'm working on an issue, I can use Zulip's marker to link back to the pull request ID. + +Zulip is open source (you can access its [source code][11] on GitHub) and free to use, but it has paid offerings for on-premises support, [LDAP][12] integration, and more storage. + +#### Let's Chat + +![Let's Chat][13] + +[Let's Chat][14] is a self-hosted chat solution for small teams. It runs on Node.js and MongoDB and can be deployed to local servers or hosted services with a few clicks. It's free and open source, with the [source code][15] available on GitHub. + +What differentiates Let's Chat from other open source chat tools is its enterprise features: it supports LDAP and [Kerberos][16] authentication. It also has all the features a new user would want: you can search message history in the archives and tag people with mentions like @username. + +What I like about Let's Chat is that it has private and password-protected rooms, image embeds, GIPHY support, and code pasting. It is constantly evolving and adding more features to its bucket. + +### Bonus: Open source video chat with Jitsi + +![Jitsi][17] + +Sometimes text chat isn't enough, and you need to talk to someone face-to-face. In times like these, when in-person meetings aren't an option, video chat is the best alternative. [Jitsi][18] is a complete, open source, multi-platform, and WebRTC-compliant videoconferencing tool. + +Jitsi began with Jitsi Desktop and has evolved into multiple [projects][19], including Jitsi Meet, Jitsi Videobridge, jibri, and libjitsi, with [source code][20] published for each on GitHub. + +Jitsi is secure and scalable and supports advanced video-routing concepts such as simulcast and bandwidth estimation, as well as typical capabilities like audio, recording, screen-sharing, and dial-in features. You can set a password to secure your video-chat room and protect it against intruders, and it also supports live-streaming over YouTube. You can also build your own Jitsi server and host it on-premises or on a virtual private server, such as a Digital Ocean Droplet. + +What I like most about Jitsi is that it is free and frictionless; anyone can start a meeting in no time by visiting [meet.jit.si][21], and users are good to go with no need for registration or installation. (However, registration gives you calendar integrations.) This low-barrier-to-entry alternative to popular videoconferencing services is helping Jitsi's popularity spread rapidly. + +### Tips for choosing a chat application + +The variety of open source chat applications can make it hard to pick one. The following are some general guidelines for choosing a chat app. + + * Tools that have an interactive interface and simple navigation are ideal. + * It's better to look for a tool that has great features and allows people to use it in various ways. + * Integrations with tools you use can play an important role in your decision. Some tools have great and seamless integrations with GitHub, GitLab, and certain applications, which is a useful feature. + * It's convenient to use tools that have a pathway to hosting on cloud-based services. + * The security of the chat service should be taken into account. The ability to host services on a private server is necessary for many organizations and individuals. + * It's best to select communication tools that have rich privacy settings and allow for both private and public chat rooms. + + + +Since people are more dependent than ever on online services, it is smart to have a backup communication platform available. For example, if a project is using Rocket.Chat, it should also have the option to hop into IRC, if necessary. Since these services are continuously updating, you may find yourself connected to multiple channels, and this is where integration becomes so valuable. + +Of the different open source chat services available, which ones do you like and use? How do these tools help you work remotely? Please share your thoughts in the comments. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/4/open-source-chat + +作者:[Sudeshna Sur][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/sudeshna-sur +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/talk_chat_communication_team.png?itok=CYfZ_gE7 (Chat bubbles) +[2]: https://opensource.com/sites/default/files/uploads/rocketchat.png (Rocket.Chat) +[3]: https://rocket.chat/ +[4]: https://github.com/RocketChat/Rocket.Chat +[5]: https://opensource.com/sites/default/files/uploads/irc.png (IRC on WeeChat 0.3.5) +[6]: https://en.wikipedia.org/wiki/Internet_Relay_Chat +[7]: https://opensource.com/article/16/6/getting-started-irc +[8]: https://opensource.com/article/17/5/introducing-riot-IRC +[9]: https://opensource.com/sites/default/files/uploads/zulip.png (Zulip) +[10]: https://zulipchat.com/ +[11]: https://github.com/zulip/zulip +[12]: https://en.wikipedia.org/wiki/Lightweight_Directory_Access_Protocol +[13]: https://opensource.com/sites/default/files/uploads/lets-chat.png (Let's Chat) +[14]: https://sdelements.github.io/lets-chat/ +[15]: https://github.com/sdelements/lets-chat +[16]: https://en.wikipedia.org/wiki/Kerberos_(protocol) +[17]: https://opensource.com/sites/default/files/uploads/jitsi_0_0.jpg (Jitsi) +[18]: https://jitsi.org/ +[19]: https://jitsi.org/projects/ +[20]: https://github.com/jitsi +[21]: http://meet.jit.si diff --git a/sources/tech/20200426 6 tips for securing your WordPress website.md b/sources/tech/20200426 6 tips for securing your WordPress website.md new file mode 100644 index 0000000000..757ff42d30 --- /dev/null +++ b/sources/tech/20200426 6 tips for securing your WordPress website.md @@ -0,0 +1,175 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (6 tips for securing your WordPress website) +[#]: via: (https://opensource.com/article/20/4/wordpress-security) +[#]: author: (Lucy Carney https://opensource.com/users/lucy-carney) + +6 tips for securing your WordPress website +====== +Even beginners can—and should—take these steps to protect their +WordPress sites against cyberattacks. +![A lock on the side of a building][1] + +Already powering over 30% of the internet, WordPress is the fastest-growing content management system (CMS) in the world—and it's not hard to see why. With tons of customization available through coding and plugins, top-notch SEO, and a supreme reputation for blogging, WordPress has certainly earned its popularity. + +However, with popularity comes other, less appealing attention. WordPress is a common target for intruders, malware, and cyberattacks—in fact, WordPress accounted for around [90% of hacked CMS platforms][2] in 2019. + +Whether you're a first-time WordPress user or an experienced developer, there are important steps you can take to protect your WordPress website. The following six key tips will get you started. + +### 1\. Choose reliable hosting + +Hosting is the unseen foundation of all websites—without it, you can't publish your site online. But hosting does much more than simply host your site. It's also responsible for site speed, performance, and security. + +The first thing to do is to check if a host includes SSL security in its plans. + +SSL is an essential security feature for all websites, whether you're running a small blog or a large online store. You'll need a more [advanced SSL certificate][3] if you're accepting payments, but for most sites, the basic free SSL should be fine. + +Other security features to look out for include: + + * Frequent, automatic offsite backups + * Malware and antivirus scanning and removal + * Distributed denial of service (DDoS) protection + * Real-time network monitoring + * Advanced firewall protection + + + +In addition to these digital security features, it's worth thinking about your hosting provider's _physical_ security measures as well. These include limiting access to data centers with security guards, CCTV, and two-factor or biometric authentication. + +### 2\. Use security plugins + +One of the best—and easiest—ways of protecting your website's security is to install a security plugin, such as [Sucuri][4], which is an open source, GPLv2 licensed project. Security plugins are vitally important because they automate security, which means you can focus on running your site rather than committing all your time to fighting off online threats. + +These plugins detect and block malicious attacks and alert you about any issues that require your attention. In short, they constantly work in the background to protect your site, meaning you don't have to stay awake 24/7 to fight off hackers, bugs, and other digital nasties. + +A good security plugin will provide all the essential security features you need for free, but some advanced features require a paid subscription. For example, you'll need to pay if you want to unlock [Sucuri's website firewall][5]. Enabling a web application firewall (WAF) blocks common threats and adds an extra layer of security to your site, so it's a good idea to look for this feature when choosing a security plugin. + +### 3\. Choose trustworthy plugins and themes + +The joy of WordPress is that it is open source, so anyone and everyone can pitch in with themes and plugins that they've developed. This can also pose problems when it comes to picking a high-quality theme or plugin. + +It serves to be cautious when picking a free theme or plugin, as some are poorly designed—or worse, may hide malicious code. + +To avoid this, always source free themes and plugins from reputable sources, such as the WordPress library. Always read reviews and research the developer to see if they've built any other programs. + +Outdated or poorly designed themes and plugins can leave "backdoors" open for attackers or bugs to get into your site, which is why it pays to be careful in your choices. However, you should also be wary of nulled or cracked themes. These are premium themes that have been compromised by hackers and are for sale illegally. You might buy a nulled theme believing that it's all above-board—only to have your site damaged by hidden malicious code. + +To avoid nulled themes, don't get drawn in by discounted prices, and always stick to reputable stores, such as the official [WordPress directory][6]. If you're looking elsewhere, stick to large and trusted stores, such as [Themify][7], a theme and plugin store that has been running since 2010. Themify ensures all its WordPress themes pass the [Google Mobile-Friendly][8] test and are open source under the [GNU General Public License][9]. + +### 4\. Run regular updates + +It's a fundamental WordPress rule: _always keep your site up to date._ However, it's a rule not everyone sticks to—in fact, only [43% of WordPress sites][10] are running the latest version. + +The problem is that when your site becomes outdated, it becomes susceptible to glitches, bugs, intrusions, and crashes because it falls behind on security and performance fixes. Outdated sites can't fix bugs the same way as updated sites can, and attackers can tell which sites are outdated. This means they can search for the most vulnerable sites and attack accordingly. + +This is why you should always run your site on the latest version of WordPress. And in order to keep your security at its strongest, you must update your plugins and themes as well as your core WordPress software. + +If you choose a managed WordPress hosting plan, you might find that your provider will check and run updates for you—be clear whether your host offers software _and_ plugin updates. If not, you can install an open source plugin manager, such as the GPLv2-licensed [Easy Updates Manager plugin][11], as an alternative. + +### 5\. Strengthen your logins + +Aside from creating a secure WordPress website through carefully choosing your theme and installing security plugins, you also need to safeguard against unauthorized access through logins. + +#### Password protection + +The first and simplest way to strengthen your login security is to change your password—especially if you're using an [easily guessed phrase][12] such as "123456" or "qwerty." + +Instead, try to use a long passphrase rather than a password, as they are harder to crack. The best way is to use a series of unrelated words strung together that you find easy to remember. + +Here are some other tips: + + * Never reuse passwords + * Don't include obvious words such as family members' names or your favorite football team + * Never share your login details with anyone + * Include capitals and numbers to add complexity to your passphrase + * Don't write down or store your login details anywhere + * Use a [password manager][13] + + + +#### Change your login URL + +It's a good idea to change your default login web address from the standard format: yourdomain.com/wp-admin. This is because hackers know this is the default URL, so you risk brute-force attacks by not changing it. + +To avoid this, change the URL to something different. Use an open source plugin such as the GPLv2-licensed [WPS Hide Login][14] for safe, quick, and easy customization. + +#### Apply two-factor authentication + +For extra protection against unauthorized logins and brute-force attacks, you should add two-factor authentication. This means that even if someone _does_ get access to your login details, they'll need a code that's sent directly to your phone to gain access to your WordPress site's admin. + +Adding two-factor authentication is pretty easy. Simply install yet another plugin—this time, search the WordPress Plugin Directory for "two-factor authentication," and select the plugin you want. One option is [Two Factor][15], a popular GPLv2 licensed project that has over 10,000 active installations. + +#### Limit login attempts + +WordPress tries to be helpful by letting you guess your login details as many times as you like. However, this is also helpful to hackers trying to gain unauthorized access to your WordPress site to release malicious code. + +To combat brute-force attacks, install a plugin that limits login attempts and set how many guesses you want to allow. + +### 6\. Disable file editing + +This isn't such a beginner-friendly step, so don't attempt it unless you're a confident coder—and always back up your site first! + +That said, disabling file editing _is_ an important measure if you're really serious about protecting your WordPress website. If you don't hide your files, it means anyone can edit your theme and plugin code straight from the admin area—which is dangerous if an intruder gets in. + +To deny unauthorized access, go to your **wp-config.php** file and enter: + + +``` +<Files wp-config.php> +order allow,deny +deny from all +</Files> +``` + +Or, to remove the theme and plugin editing options from your WordPress admin area completely, edit your **wp-config.php** file by adding: + + +``` +`define( 'DISALLOW_FILE_EDIT', true );` +``` + +Once you've saved and reloaded the file, the plugin and theme editors will disappear from your menus within the WordPress admin area, stopping anyone from editing your theme or plugin code—including you**.** Should you need to restore access to your theme and plugin code, just delete the code you added to your **wp-config.php** file when you disabled editing. + +Whether you block unauthorized access or totally disable file editing, it's important to take action to protect your site's code. Otherwise, it's easy for unwelcome visitors to edit your files and add new code. This means an attacker could use the editor to gather data from your WordPress site or even use your site to launch attacks on others. + +For an easier way of hiding your files, you can use a security plugin that will do it for you, such as Sucuri. + +### WordPress security recap + +WordPress is an excellent open source platform that should be enjoyed by beginners and developers alike without the fear of becoming a victim of an attack. Sadly, these threats aren't going anywhere anytime soon, so it's vital to stay on top of your site's security. + +Using the measures outlined above, you can create a stronger, more secure level of protection for your WordPress site and ensure a much more enjoyable experience for yourself. + +Staying secure is an ongoing commitment rather than a one-time checklist, so be sure to revisit these steps regularly and stay alert when building and using your CMS. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/4/wordpress-security + +作者:[Lucy Carney][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/lucy-carney +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/BUSINESS_3reasons.png?itok=k6F3-BqA (A lock on the side of a building) +[2]: https://cyberforces.com/en/wordpress-most-hacked-cms +[3]: https://opensource.com/article/19/11/internet-security-tls-ssl-certificate-authority +[4]: https://wordpress.org/plugins/sucuri-scanner/ +[5]: https://sucuri.net/website-firewall/ +[6]: https://wordpress.org/themes/ +[7]: https://themify.me/ +[8]: https://developers.google.com/search/mobile-sites/ +[9]: http://www.gnu.org/licenses/gpl.html +[10]: https://wordpress.org/about/stats/ +[11]: https://wordpress.org/plugins/stops-core-theme-and-plugin-updates/ +[12]: https://www.forbes.com/sites/kateoflahertyuk/2019/04/21/these-are-the-worlds-most-hacked-passwords-is-yours-on-the-list/#4f157c2f289c +[13]: https://opensource.com/article/16/12/password-managers +[14]: https://wordpress.org/plugins/wps-hide-login/ +[15]: https://en-gb.wordpress.org/plugins/two-factor/ diff --git a/sources/tech/20200427 New zine- How Containers Work.md b/sources/tech/20200427 New zine- How Containers Work.md new file mode 100644 index 0000000000..fa2198ebbc --- /dev/null +++ b/sources/tech/20200427 New zine- How Containers Work.md @@ -0,0 +1,121 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (New zine: How Containers Work!) +[#]: via: (https://jvns.ca/blog/2020/04/27/new-zine-how-containers-work/) +[#]: author: (Julia Evans https://jvns.ca/) + +New zine: How Containers Work! +====== + +On Friday I published a new zine: “How Containers Work!”. I also launched a fun redesign of [wizardzines.com][1]. + +You can get it for $12 at . If you buy it, you’ll get a PDF that you can either print out or read on your computer. Or you can get a pack of [all 8 zines][2] so far. + +Here’s the cover and table of contents: + +[![][3]][4] + +### why containers? + +I’ve spent a lot of time [figuring][5] [out][6] [how to][7] [run][8] [things][9] [in][10] [containers][11] over the last 3-4 years. And at the beginning I was really confused! I knew a bunch of things about Linux, and containers didn’t seem to fit in with anything I thought I knew (“is it a process? what’s a network namespace? what’s happening?“). The whole thing seemed really weird. + +It turns out that containers ARE actually pretty weird. They’re not just one thing, they’re what you get when you glue together 6 different features that were mostly designed to work together but have a bunch of confusing edge cases. + +As usual, the thing that helped me the most in my container adventures is a good understanding of the **fundamentals** – what exactly is actually happening on my server when I run a container? + +So that’s what this zine is about – cgroups, namespaces, pivot_root, seccomp-bpf, and all the other Linux kernel features that make containers work. + +Once I understood those ideas, it got a **lot** easier to debug when my containers were doing surprising things in production. I learned a couple of interesting and strange things about containers while writing this zine too – I’ll probably write a blog post about one of them later this week. + +### containers aren’t magic + +This picture (page 6 of the zine) shows you how to run a fish container image with only 15 lines of bash. This is heavily inspired by [bocker][12], which “implements” Docker in about 100 lines of bash. + + + +The main things I see missing from that script compared to what Docker actually does when running a container (other than using an actual container image and not just a tarball) are: + + * it doesn’t drop any capabilities – the container is still running as root and has full root privileges (just in a different mount + PID namespace) + * it doesn’t block any system calls with seccomp-bpf + + + +### container command line tools + +The zine also goes over a bunch of command line tools & files that you can use to inspect running containers or play with Linux container features. Here’s a list: + + * `mount -t overlay` (create and view overlay filesystems) + * `unshare` (create namespaces) + * `nsenter` (use an existing namespace) + * `getpcaps` (get a process’s capabilities) + * `capsh` (drop or add capabilities, etc) + * `cgcreate` (create a cgroup) + * `cgexec` (run a command in an existing cgroup) + * `chroot` (change root directory. not actually what containers use but interesting to play with anyway) + * `/sys/fs/cgroups` (for information about cgroups, like `memory.usage_in_bytes`) + * `/proc/PID/ns` (all a process’s namespaces) + * `lsns` (another way to view namespaces) + + + +I also made a short youtube video a while back called [ways to spy on a Docker container][13] that demos some of these command line tools. + +### container runtime agnostic + +I tried to keep this zine pretty container-runtime-agnostic – I mention Docker a couple of times because it’s so widely used, but it’s about the Linux kernel features that make containers work in general, not Docker or LXC or systemd-nspawn or Kubernetes or whatever. If you understand the fundamentals you can figure all those things out! + +### we redesigned wizardzines.com! + +On Friday I also launched a redesign of [wizardzines.com][1]! [Melody Starling][14] (who is amazing) did the design. I think now it’s better organized but the tiny touch that I’m most delighted by is that now the zines jump with joy when you hover over them. + +One cool thing about working with a designer is – they don’t just make things _look_ better, they help _organize_ the information better so the website makes more sense and it’s easier to find things! This is probably obvious to anyone who knows anything about design but I haven’t worked with designers very much (or maybe ever?) so it was really cool to see. + +One tiny example of this: Melody had the idea of adding a tiny FAQ on the landing page for each zine, where I can put the answers to all the questions people always ask! Here’s what the little FAQ box looks like: + +[![][15]][4] + +I probably want to edit those questions & answers over time but it’s SO NICE to have somewhere to put them. + +### what’s next: maybe debugging! or working more on flashcards! + +The two projects I’m thinking about the most right now are + + 1. a zine about debugging, which I started last summer and haven’t gotten around to finishing yet + 2. a [flashcards project][16] that I’ve been adding to slowly over the last couple of months. I think could become a nice way to explain basic ideas. + + + +Here’s a link to where to [get the zine][4] again :) + +-------------------------------------------------------------------------------- + +via: https://jvns.ca/blog/2020/04/27/new-zine-how-containers-work/ + +作者:[Julia Evans][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://jvns.ca/ +[b]: https://github.com/lujun9972 +[1]: https://wizardzines.com +[2]: https://wizardzines.com/zines/all-the-zines/ +[3]: https://jvns.ca/images/containers-cover.jpg +[4]: https://wizardzines.com/zines/containers +[5]: https://stripe.com/en-ca/blog/operating-kubernetes +[6]: https://jvns.ca/blog/2016/09/15/whats-up-with-containers-docker-and-rkt/ +[7]: https://jvns.ca/blog/2016/10/10/what-even-is-a-container/ +[8]: https://jvns.ca/blog/2016/12/22/container-networking/ +[9]: https://jvns.ca/blog/2016/10/26/running-container-without-docker/ +[10]: https://jvns.ca/blog/2017/02/17/mystery-swap/ +[11]: https://jvns.ca/blog/2016/10/02/a-list-of-container-software/ +[12]: https://github.com/p8952/bocker +[13]: https://www.youtube.com/watch?v=YCVSdnYzH34&t=1s +[14]: https://melody.dev +[15]: https://jvns.ca/images/wizardzines-faq.png +[16]: https://flashcards.wizardzines.com diff --git a/sources/tech/20200428 Learn Bash with this book of puzzles.md b/sources/tech/20200428 Learn Bash with this book of puzzles.md new file mode 100644 index 0000000000..08a07b93c5 --- /dev/null +++ b/sources/tech/20200428 Learn Bash with this book of puzzles.md @@ -0,0 +1,60 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Learn Bash with this book of puzzles) +[#]: via: (https://opensource.com/article/20/4/bash-it-out-book) +[#]: author: (Carlos Aguayo https://opensource.com/users/hwmaster1) + +Learn Bash with this book of puzzles +====== +'Bash it out' covers basic, medium, and advanced Bash scripting using 16 +puzzles. +![Puzzle pieces coming together to form a computer screen][1] + +Computers are both my hobby and my profession. I have about 10 of them scattered around my apartment, all running Linux (including my Macs). Since I enjoy upgrading my computers and my computer skills, when I came across [_Bash it out_][2] by Sylvain Leroux, I jumped on the chance to buy it. I use the command line a lot on Debian Linux, and it seemed like a great opportunity to expand my Bash knowledge. I smiled when the author explained in the preface that he uses Debian Linux, which is one of my two favorite distributions. + +Bash lets you automate tasks, so it's a labor-saving, interesting, and useful tool. Before reading the book, I already had a fair amount of experience with Bash on Unix and Linux. I'm not an expert, in part because the scripting language is so extensive and powerful. I first became intrigued with Bash when I saw it on the welcome screen of [EndeavourOS][3], an Arch-based Linux distribution. + +The following screenshots show some options from EndeavourOS. Beleieve it or not, these panels just point to Bash scripts, each of which accomplish some relatively complex tasks. And because it's all open source, I can modify any of these scripts if I want. + +![EndeavourOS after install][4] + +![EndeavourOS install apps][5] + +### Always something to learn + +My impressions of this book are very favorable. It's not long, but it is well-thought-out. The author has very extensive knowledge of Bash and an uncanny ability to explain how to use it. The book covers basic, medium, and advanced Bash scripting using 16 puzzles, which he calls "challenges." This taught me to see Bash scripting as a programming puzzle to solve, which makes it more interesting to play with. + +An exciting aspect of Bash is that it's deeply integrated with the Linux system. While part of its power lies in its syntax, it's also powerful because it has access to so much. You can script repetitive tasks, or tasks that are easy but you're just tired of performing manually. Nothing is too great or too small, and _Bash it out_ helps you understand both what you can do, and how to achieve it. + +This review would not be complete if I didn't mention David Both's free resource [_A sysadmin's guide to Bash scripting_][6] on Opensource.com. This 17-page PDF guide is different from _Bash it out_, but together they make a winning combination for anyone who wants to learn about it. + +I am not a computer programmer, but _Bash it out_ has increased my desire to get into more advanced levels of Bash scripting—I might inadvertently end up as a computer programmer without planning to. + +One reason I love Linux is because of how powerful and versatile the operating system is. However much I know about Linux, there is always something new to learn that makes me appreciate Linux even more. + +In a competitive and ever-changing job market, it behooves all of us to continuously update our skills. This book helped me learn Bash in a very hands-on way. It almost felt as if the author was in the same room with me, patiently guiding me in my learning. + +The author, Leroux, has an uncanny ability to engage readers. This is a rare gift that I think is even more valuable than his technical expertise. In fact, I am writing this book review to thank the author for anticipating my own learning needs; although we have never met, I have benefited in real ways from his gifts. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/4/bash-it-out-book + +作者:[Carlos Aguayo][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/hwmaster1 +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/puzzle_computer_solve_fix_tool.png?itok=U0pH1uwj (Puzzle pieces coming together to form a computer screen) +[2]: https://www.amazon.com/Bash-Out-Strengthen-challenges-difficulties/dp/1521773262/ +[3]: https://endeavouros.com/ +[4]: https://opensource.com/sites/default/files/uploads/endeavouros-welcome.png (EndeavourOS after install) +[5]: https://opensource.com/sites/default/files/uploads/endeavouros-install-apps.png (EndeavourOS install apps) +[6]: https://opensource.com/downloads/bash-scripting-ebook diff --git a/sources/tech/20200429 Open source live streaming with Open Broadcaster Software.md b/sources/tech/20200429 Open source live streaming with Open Broadcaster Software.md new file mode 100644 index 0000000000..748786de77 --- /dev/null +++ b/sources/tech/20200429 Open source live streaming with Open Broadcaster Software.md @@ -0,0 +1,137 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Open source live streaming with Open Broadcaster Software) +[#]: via: (https://opensource.com/article/20/4/open-source-live-stream) +[#]: author: (Seth Kenlon https://opensource.com/users/seth) + +Open source live streaming with Open Broadcaster Software +====== +If you have something to say, a skill to teach, or just something fun to +share, broadcast it to the world with OBS. +![An old-fashioned video camera][1] + +If you have a talent you want to share with the world, whether it's making your favorite sourdough bread or speedrunning through a level of your favorite video game, live streaming is the modern show-and-tell. It's a powerful way to tell the world about your hobby through a medium once reserved for exclusive and expensive TV studios. Not only is the medium available to anyone with a relatively good internet connection, but the most popular software to make it happen is open source. + +[OBS][2] (Open Broadcaster Software) is a cross-platform application that serves as a control center for your live stream. A _stream_, strictly speaking, means _progressive and coherent data_. The data in a stream can be audio, video, graphics, text, or anything else you can represent as digital data. OBS is programmed to accept data as input, combine streams together (technically referred to as _mixing_) into one product, and then broadcast it. + +![OBS flowchart][3] + +A _broadcast_ is data that can be received by some target. If you're live streaming, your primary target is a streaming service that can host your stream, so other people can find it in a web browser or media player. A live stream is a live event, so people have to "tune in" to your stream when it's happening, or else they miss it. However, you can also target your own hard drive so you can record a presentation and then post it on the internet later for people to watch at their leisure. + +### Installing OBS + +To install OBS on Windows or macOS, download an installer package from [OBS's website][2]. + +To install OBS on Linux, either install it with your package manager (such as **dnf**, **zypper**, or **apt**) or [install it as a Flatpak][4]. + +### Join a streaming service + +In order to live stream, you must have a stream broker. That is, you need a central location on the internet for your stream to be delivered, so your viewers can get to what you're broadcasting. There are a few popular streaming services online, like YouTube and Twitch. You can also [set up your own video streaming server][5] using open source software. + +Regardless of which option you choose, before you begin streaming, you must have a destination for your stream. If you do use a streaming service, you must obtain a _streaming key_. A streaming key is a hash value (it usually looks something like **2ae2fad4e33c3a89c21**) that is private and unique to you. You use this key to authenticate yourself through your streaming software. Without it, the streaming service can't know you are who you say you are and won't let you broadcast over your user account. + +* * * + +* * * + +* * * + +**![Streaming key][6]** + + * In Twitch, your **Primary Stream Key** is available in the **Channel** panel of your **Creator Dashboard**. + * On YouTube, you must enable live streaming by verifying your account. Once you've done that, your **Stream Key** is in the **Other Features** menu option of your **Channel Dashboard**. + * If you're using your own server, there's no maze-like GUI to navigate. You just [create your own streaming key][7]. + + + +### Enter your streaming key + +Once you have a streaming key, launch OBS and go to the **File** > **Settings** menu. + +In the **Settings** window, click on the **Stream** category in the left column. Set the **Service** to your stream service (Custom, Twitch, YouTube, etc.), and enter your stream key. Click the **OK** button in the bottom right to save your changes. + +### Create sources + +In OBS, _sources_ represent any input signal you want to stream. By default, sources are listed at the bottom of the OBS window. + +![OBS sources][8] + +This might be a webcam, a microphone, an audio stream (such as the sound of a video game you're playing), a screen capture of your computer (a "screencast"), a slideshow you want to present, an image, and so on. Before you start streaming, you should define all the sources you plan on using for your stream. This means you have to do a little pre-production and consider what you anticipate for your show. Any camera you have set up must be defined as a source in OBS. Any extra media you plan on cutting to during your show must be defined as a source. Any sound effects or background music must be defined as a source. + +Not all sources "happen" at once. By adding media to your **Sources** panel in OBS, you're just assembling the raw components for your stream. Once you make devices and data available to OBS, you can create your **Scenes**. + +#### Setting up audio + +Computers have seemingly dozens of ways to route audio. Here's the workflow to follow when setting up sound for your stream: + + 1. Check your cables: verify that your microphone is plugged in. + 2. Go to your computer's sound control panel and set the input to whatever microphone you want OBS to treat as the main microphone. This might be a gaming headset or a boom mic or a desktop podcasting mic or a Bluetooth device or a fancy audio interface with XLR ports. Whatever it is, make sure your computer "hears" your main sound input. + 3. In OBS, create a source for your main microphone and name it something obvious (e.g., boom mic, master sound, or mic). + 4. Do a test. Make sure OBS "hears" your microphone by referring to the audio-level monitors at the bottom of the OBS window. If it's not responding to the input you believe you've set as input, check your cables, check your computer sound control panel, and check OBS. + + + +I've seen more people panic over audio sources than any other issue when streaming, and we've _all_ made the same dumb mistakes (several times each, probably!) when attempting to set a microphone for a live stream or videoconference call. Breathe deep, check your cables, check your inputs and outputs, and [get comfortable with audio][9]. It'll pay off in the end. + +### Create scenes + +A **Scene** in OBS is a screen layout and consists of one or more sources. + +![Scenes in OBS][10] + +For instance, you might create a scene called **Master shot** that shows you sitting at your desk in front of your computer or at the kitchen counter ready to mix ingredients together. The source could be a webcam mounted on a tripod a meter or two in front of you. Because you want to cut to a detail shot, you might create a second scene called **Close-up**, which uses the computer screen and audio as one input source and your microphone as another source, so you can narrate as you demonstrate what you're doing. If you're doing a baking show, you might want to mount a second webcam above the counter, so you can cut to an overhead shot of ingredients being mixed. Here, your source is a different webcam but probably the same microphone (to avoid making changes in the audio). + +A _scene_, in other words, is a lot like a _shot_ in traditional production vernacular, but it can be the combination of many shots. The fun thing about OBS is that you can mix and match a lot of different sources together, so when you're adding a **Scene**, you can resize and position different sources to achieve picture-in-picture, or split-screen, or any other effect you might want. It's common in video game "let's play" streams to have the video game in full-screen, with the player inset in the lower right or left. Or, if you're recording a panel or a multi-player game like D&D you might have several cameras covering several players in a _Brady Bunch_ grid. + +The possibilities are endless. During streaming, you can cut from one scene to another as needed. This is intended to be a dynamic system, so you can change scenes depending on what the viewer needs to see at any given moment. + +Generally, you want to have some preset scenes before you start to stream. Even if you have a friend willing to do video mixing as you stream, you always want a safe scene to fall back to, so take time beforehand to set up at least a master shot that shows you doing whatever it is you're doing. If all else fails, at least you'll have your main shot you can safely and reliably cut to. + +### Transitions + +When switching from one scene to another, OBS uses a transition. Once you have more than one scene, you can configure what kind of transition it uses in the **Transitions** panel. Simple transitions are usually best. By default, OBS uses a subtle crossfade, but you can experiment with others as you see fit. + +### Go live + +To start streaming, do your vocal exercises, find your motivation, and press the **Start Streaming** button. + +![Start streaming in OBS][11] + +As long as you've set up your streaming service correctly, you're on the air (or on the wires, anyway). + +If you're the talent (the person in front of the camera), it might be easiest to have someone control OBS during streaming. But if that's not possible, you can control it yourself as long as you've practiced a little in advance. If you're screencasting, it helps to have a two-monitor setup so you can control OBS without it being on screen. + +### Streaming for success + +Many of us take streaming for granted now that the internet exists and can broadcast media created by _anyone_. It's a hugely powerful means of communication, and we're all responsible for making the most of it. + +If you have something positive to say, a skill to teach, words of encouragement, or just something fun that you want to share, and you feel like you want to broadcast to the world, then take the time to learn OBS. You might not get a million viewers, but independent media is a vital part of [free culture][12]. The world can always use empowering and positive open source voices, and yours may be one of the most important of all. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/4/open-source-live-stream + +作者:[Seth Kenlon][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/seth +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/LIFE_film.png?itok=aElrLLrw (An old-fashioned video camera) +[2]: http://obsproject.com +[3]: https://opensource.com/sites/default/files/obs-flowchart.jpg (OBS flowchart) +[4]: https://flatpak.org/setup +[5]: https://opensource.com/article/19/1/basic-live-video-streaming-server +[6]: https://opensource.com/sites/default/files/twitch-key.jpg (Streaming key) +[7]: https://opensource.com/article/19/1/basic-live-video-streaming-server#obs +[8]: https://opensource.com/sites/default/files/uploads/obs-sources.jpg (OBS sources) +[9]: https://opensource.com/article/17/1/linux-plays-sound +[10]: https://opensource.com/sites/default/files/uploads/obs-scenes.jpg (Scenes in OBS) +[11]: https://opensource.com/sites/default/files/uploads/obs-stream-start.jpg (Start streaming in OBS) +[12]: https://opensource.com/article/18/1/creative-commons-real-world diff --git a/sources/tech/20200430 Edit music recordings with Audacity on Linux.md b/sources/tech/20200430 Edit music recordings with Audacity on Linux.md new file mode 100644 index 0000000000..be6f68f062 --- /dev/null +++ b/sources/tech/20200430 Edit music recordings with Audacity on Linux.md @@ -0,0 +1,161 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Edit music recordings with Audacity on Linux) +[#]: via: (https://opensource.com/article/20/4/audacity) +[#]: author: (David Both https://opensource.com/users/dboth) + +Edit music recordings with Audacity on Linux +====== +How COVID-19 caused me to learn Audacity on the fly and learn to love +it. +![Bird singing and music notes][1] + +In this strange and difficult time of a global pandemic, we are all called upon to do things differently, to change our routines, and to learn new things. + +I have worked from home for many years, so that is nothing new to me. Even though I am allegedly retired, I write articles for Opensource.com and [Enable Sysadmin][2] and books. I also manage my own home network, which is larger than you might think, and my church's network and Linux hosts, and I help a few friends with Linux. All of this keeps me busy doing what I like to do, and all of it is usually well within my comfort zone. + +But COVID-19 has changed all of that. And, like many other types of organizations, my church had to move quickly to a new service-delivery paradigm. And that is what churches do—deliver a specific kind of service. As the church sysadmin and with some knowledge of audio recording and editing (back in the '70s, I mixed the sound and was the only roadie for a couple of regional folk-rock groups in Toledo, Ohio), I decided to learn the open source audio recording and editing software [Audacity][3] to help meet this challenge. + +This is not a comprehensive how-to article about using Audacity. It is about my experiences getting started with this powerful audio-editing tool, but there should be enough information here to help you get started. + +I have learned just what I need to know in order to accomplish my task: combining several separate audio clips into a single MP3 audio file. If you already know Audacity and do things differently or know things that I don't, that is expected. And if you have any suggestions to help me accomplish my task more easily, please share them in the comments. + +### The old way + +I try not to use the term "normal" now because it is hard to know exactly what that is—if such a state even exists. But our old method of producing recordings for our shut-ins, members who are traveling, and anyone else was to record the sermon portion of our regular, in-person church services and post them on our website. + +To do this, I installed a TASCAM SS-R100 solid-state recorder that stores the sermons as MP3 files on a thumb drive. We uploaded the recordings to a special directory of our website so people could download them. The recordings are uploaded using a Bash [program][4] I wrote for the task. _Automate everything!_ I trained a couple of others to perform these tasks using sudo in case I was not available. + +This all worked very well. Until it didn't. + +### The new way + +As soon as the first restrictions on large gatherings occurred, we made some changes. We could still have small gatherings, so four of us met Sunday mornings and recorded an abbreviated service using our in-house recorder and doing the upload the usual way. This worked, but as the crisis deepened and it became more of a risk to meet with even a few people, we had to make more changes. + +Like a huge number of other organizations, we realized we each needed to perform our parts of creating services in separate locations from our own homes. + +Now, depending upon the structure of the service, I receive several recordings that I need to combine to create the full church service. Our music director records each anthem and interlude using her iPhone and sends me the recordings in the M4A (MPEG-4 audio) format. They each range in length from seconds to five minutes and are up to 3MB in size. Likewise, our rector sends me two to six recordings, also in M4A format, that contains his portion of the service. Sometimes, other musicians in our church send solos or duets recorded with their significant others; these can be in MP3 or M4A formats. + +Then, I pull all of this together into a single recording that can be uploaded to our server for people to download. I use Audacity for this because it was available in my repo, and it was easy to get started. + +### Getting started with Audacity + +I had never used [Audacity][5] before this, so, like many others these days, I needed to learn something new just in time to accomplish what I needed to do. I struggled a bit at first, but it turned out to be fun and very enlightening. + +Audacity was easy to install on my Fedora 31 workstation because, as in many distros, it is available from the Fedora repository. + +The first time I opened Audacity with the program launcher icon, the application's window was empty with no projects nor tracks present. Audacity projects have an AUP extension, so if you have an existing project, you could click on the file in your favorite file manager and launch Audacity that way. + +### Convert M4A to MP3 + +As installed by Fedora, Audacity does not recognize M4A files. Regardless of how you proceed, you need to install the [LAME][6] MP3 encoder and [FFmpeg][7] import/export library, both of which are available from the Fedora repository and, most likely, any other distro's repository. + +There are websites that explain how to configure Audacity to use these tools to import and convert audio files from M4A to other types (such as MP3), but I decided to write a script to do it from the command line. For one reason, using a script is faster than doing a lot of extra clicking in a GUI interface, and for another, the file names need some work, so I already needed a script to rename the files. Many people use non-alphanumeric characters to name files, but I don't like dealing with special keyboard characters from the command line. It's easier to manage files with simple alphanumeric names, so my script removes all non-alphanumeric characters from the file names and then converts the files to MP3 format. + +You may choose a different approach, but I like the scripted solution. It is fast, and I only need to run the script once, no matter how many files need to be renamed and converted to MP3. + +### Create a new project + +You can create a new project whether or not any audio tracks are loaded. I recommend creating the project first, before importing any audio files (aka "clips"). From the Menu bar, select **File > Save Project > Save Project As**. This opens a warning dialog window that says, _"'Save project' is for an Audacity project, not an audio file."_ Click the **OK** button to continue to a standard file-save dialog. + +I found that I needed to do this twice. The first time, the warning dialog did not display any buttons, so I had to close the dialog using the window menu or the x icon in the Title bar. + +Name the project whatever you like, and Audacity automatically adds the AUP extension. You now have an empty project. + +### Add audio files to your project + +The first step is to add your audio files to the project. Using the Menu bar, open **File > Import > Audio** and then use the file dialog to select one or more files to import. For my first test project, I loaded all the files at once without sorting the tracks nor aligning the clips in the desired sequence along the timeline. This time, I started by loading the audio files one at a time in the sequence I wanted them from top to bottom. As each file is imported, it is placed into a new track below any existing tracks. The following image shows the files loaded all at one time in the sequence they appear in the working directory. + +![Tracks loaded in Audacity][8] + +There is a timeline across the top of the window's track area. There is also a scroll bar at the bottom of the window, so you can scroll along the timeline when the tracks extend beyond the width of the Audacity window. There is also a vertical scroll bar if there are more tracks than fit into the window. + +Notice the names in the upper-left corner of the waveform section of each track—they are the file names of each track without the extension. These are not there by default, but I find them helpful. To display these names, use the Menu bar to select **Edit > Preferences** and place a check in the **Show Audio Track Name As Overlay** box. + +### Order your audio clips + +Once you have some files loaded into the Audacity workspace, you can start manipulating them. To order your audio clips, select one and use the **Time-Shift** tool (↔︎) to slide them horizontally along the tracks; continue doing this until all the clips line up end to end in the order you want them. Note that the clip you are moving is book-ended by a pair of vertical alignment lines. When they line up perfectly, the end lines of the two aligned tracks change color to alert you. + +You can hover the mouse pointer over the tool icons in the Audacity toolbars to see a pop-up that displays the name of that tool. This helps beginners understand what each tool does. + +![Audacity toolbox][9] + +Here, the **Selection** tool** **is selected in the Audacity toolbar. The **Time-Shift** tool is second from the left on the bottom row. + +The following image shows what happens when you slide the audio clips into place on the project timeline without sorting the tracks into a particular sequence. This may not be optimal for how you like to work. It is not for me. + +![Audio clips in Audacity][10] + +To remove segments of (or complete) audio clips, select them with the **Selection** tool—you can also select multiple adjacent tracks. Then you can press the **Delete** button on your keyboard to delete the selected segment(s). + +In the image above, you can see a vertical black line in track 1 and a vertical green line crossing all the tracks. These are the audio cursors that show the playback positions of a track or the entire project. Choose the **Selection** tool and click the desired position within a track, then click the **Play** button on the transport controls (in the upper-left of the Audacity window) to begin playback. Playback will continue past the end of the selected track and all the way to the end of the project. If tracks overlap on the timeline, they will play simultaneously. + +To begin playback immediately, click the desired starting point on the timeline. To play part of a track, hold down the Left mouse button to select a short segment of the track, and then click the **Play** button. The other transport buttons—Pause, Stop, and so—on are identified with universal icons and work as you would expect. + +You can also click the **Silence Audio Selection** button—the fifth button from the left on the **Edit** toolbar (shown below)—to completely silence a selected segment while leaving it in place for timing purposes. This is how I silenced a number of background clicks and noises. + +![Audacity edit tools][11] + +It took me a while to figure out how to sort the tracks vertically, and it turns out there are a few different ways to accomplish the task. + +You can use the track menu to reorder arrangement. Each track has its own Control Panel on the left side (shown below). The track drop-down Menu bar at the top of the Control Panel opens a menu that provides several track-sequencing options to move a track up, down, to the top, or to the bottom. + +![Moving tracks in Audacity][12] + +The items to move a track up or down move the track one position at a time, so you have to select it as many times as necessary to get the track in the desired position. + +To drag and drop tracks, you must click on the space occupied by the track details. In this screenshot, that's "Mono, 48000Hz 32 bit float". It can be tricky, because if you click too high, you adjust the panning (the left and right stereo position) and if you click too low, you may collapse or select the track. Target the "Mono" or "Stereo" label (whatever your track happens to be) label, and then click and drag the track up or down to reposition it in your workspace. + +### Apply amplification and noise reduction effects + +Some tracks need the overall volume to be adjusted. I used the **Selection** tool to double-click and select the entire track (but you could also select a portion of a track). On the Menu bar, select **Effect > Amplify** to display a small dialog window. You can use the slider or enter a value to specify the amount of amplification. Negative numbers decrease the volume. If you try to increase the volume, you need to place a check in the **Allow Clipping** box. Then click OK. + +I found that amplification is a bit tricky; it is easy to use too much or too little. Start by using small numbers to see the results. You can always use **Ctrl+Z** to undo your changes if you go too far in either direction. + +Another effect I find useful is noise reduction. One of the tracks was recorded with a noticeable 60Hz hum, which is usually due to poor grounding of the microphone or recorder. Fortunately, there were only several seconds of hum and no other sound at the beginning of the recording. + +Applying the noise reduction effect was a little confusing at first. First, I selected a few samples of the humming sound to tell Audacity what sound needed to be reduced, and then I navigated to **Effect > Noise Reduction**. This opens the **Noise Reduction** dialog. I clicked on the **Get Noise Profile** button in the Step 1 section of the dialog, which uses the selected sample as the basis for a set of filter presets. After it gathers the selected sample, though, the dialog disappeared (this is by design). I re-opened the dialog, used the slider to select the noise reduction level in decibels (I set it to 15dB and left the other sliders alone), and then clicked **OK**. + +This worked well—you can hear the residual hum only if you know it is there. I need to experiment with this some more, but since the result was acceptable, so I did not play with the settings any further. + +The reason the dialog box closes after getting a noise profile is actually for the sake of expediency. If you're processing many tracks or segments of audio, each with a different noise profile, you can open the **Noise Reduction** effect, get the current noise profile, and then select the audio you want to clean. You can then run the Noise Reduction filter using **Ctrl+R**, the keyboard shortcut for running the most recent filter. Instead of getting a new noise profile, however, Audacity uses the one you've just stored, and performs the filter instead. This way, you can get a sample with a few clicks but clean lots of audio with just one keyboard shortcut. + +### And so much more + +I have only worked with a few of the basics and have not even begun to scratch the surface of Audacity. I can already see that it has so many more features and tools that will enable me to create even more professional-sounding projects. + +For example, in addition to working with existing audio files, Audacity can make recordings from line inputs, the desktop sound stream, and microphone inputs. It can do special effects like fade in and out and cross-fades. And I have not even tried to figure out what many of the other effects and tools are capable of. + +I have a feeling I will need to learn more in the near future. Hopefully, this story of my very limited experience with Audacity will prompt you to check it out. For much more information, you can find the [Audacity manual][13] online. + +Using Audacity, you can quickly clean up audio file so that any background noise becomes tolerable. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/4/audacity + +作者:[David Both][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/dboth +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/music-birds-recording-520.png?itok=UoM7brl0 (Bird singing and music notes) +[2]: https://www.redhat.com/sysadmin/ +[3]: https://www.audacityteam.org/ +[4]: https://opensource.com/article/17/12/using-sudo-delegate +[5]: https://opensource.com/education/16/9/audacity-classroom +[6]: https://manual.audacityteam.org/man/installing_and_updating_audacity_on_linux.html#linlame +[7]: https://manual.audacityteam.org/man/installing_and_updating_audacity_on_linux.html#linff +[8]: https://opensource.com/sites/default/files/uploads/audacity1_tracksloaded.png (Tracks loaded in Audacity) +[9]: https://opensource.com/sites/default/files/uploads/audacity2_tools.png (Audacity toolbox) +[10]: https://opensource.com/sites/default/files/uploads/audacity3_audioclips.png (Audio clips in Audacity) +[11]: https://opensource.com/sites/default/files/uploads/audacity4_edittoolbar.png (Audacity edit tools) +[12]: https://opensource.com/sites/default/files/uploads/audacity5_trackmovement.png (Moving tracks in Audacity) +[13]: https://manual.audacityteam.org/# diff --git a/sources/tech/20200430 Linux and Kubernetes- Serving The Common Goals of Enterprises.md b/sources/tech/20200430 Linux and Kubernetes- Serving The Common Goals of Enterprises.md new file mode 100644 index 0000000000..c3c0c36b66 --- /dev/null +++ b/sources/tech/20200430 Linux and Kubernetes- Serving The Common Goals of Enterprises.md @@ -0,0 +1,77 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Linux and Kubernetes: Serving The Common Goals of Enterprises) +[#]: via: (https://www.linux.com/articles/linux-and-kubernetes-serving-the-common-goals-of-enterprises/) +[#]: author: (Swapnil Bhartiya https://www.linux.com/author/swapnil/) + +Linux and Kubernetes: Serving The Common Goals of Enterprises +====== + +[![][1]][2] + +For [Stefanie Chiras,][3] VP & GM, Red Hat Enterprise Linux (RHEL) Business Unit at [Red Hat][4], aspects such as security and resiliency have always been important for Red Hat. More so, in the current situation when everyone has gone fully remote and it’s much harder to get people in front of the hardware for carrying out updates, patching, etc. + +“As we look at our current situation, never has it been more important to have an operating system that is resilient and secure, and we’re focused on that,” she said. + +The recently released version of [Red Hat Enterprise Linux (RHEL) 8.2][5] inadvertently address these challenge as it makes it easier for technology leaders to embrace the latest, production-ready innovations swiftly which offering security and resilience that their IT teams need. + +RHEL’s embrace of a predictable 6-month minor release cycle also helped customers plan upgrades more efficiently. + +“There is value for customers in having predictability of minor releases on a six-month cycle. Without knowing when they were coming was causing disruptions for them. The launch of 8.2 is now the second time we have delivered on our commitment of having minor releases every six months,” said Stefanie Chiras. + +In addition to offering security updates, the new version adds insights capabilities and forays into newer areas of innovation. + +The upgrade has expanded the earlier capability called ‘Adviser’ dramatically. Additional functionalities such as drift monitoring and CVE coverage allow for a much deeper granularity into how the infrastructure is running. + +“It really amplifies the skills that are already present in ops and sysadmin teams, and this provides a Red Hat consultation, if you will, directly into the data center,” claimed Charis. + +As containers are increasingly being leveraged for digital transformation, RHEL 8.2 offers an updated application stream of Red Hat’s container tools. It also has new, containerized versions of Buildah and Skopeo. + +[Skopeo][6] is an open-source image copying tool, while Buildah is a tool for building Docker- and Kubernetes-compatible images easily and quickly. + +RHEL has also ensured in-place upgrades in the new version. Customers can now directly in-place upgrade from version 7 to version 8.2. + +Chiras believes Linux has emerged as the go-to-platform for innovations such as Machine Learning, Deep Learning, and Artificial Intelligence. + +“Linux has now become the springboard of innovation,” she argued. “AI, machine learning, and deep learning are driving a real change in not just the software but also the hardware. In the context of these emerging technologies, it’s all about making them consumable into an enterprise.” + +“We’re very focused on our ecosystem, making sure that we’re working in the right upstream communities with the right ISVs, with the right hardware partners to make all of that magic come together,” Chiras said. + +Towards this end, Red Hat has been partnering with multiple architectures for a long time — be it an x86 architecture, ARM, Power, or mainframe with IBM Z. Its partnership with Nvidia pulls in capabilities such as FPGAs, and GPU. + +**Synergizing Kubernetes and Linux ** + +Kubernetes is fast finding favor in enterprises.  So how do Linux and Kubernetes serve the common goals of enterprises? + +“Kubernetes is a new way to deploy Linux. We’re very focused on providing operational consistency by leveraging our technology in RHEL and then bringing in that incredible capability of Kubernetes within our OpenShift product line,” Chiras said. + +The deployment of Linux within a Kubernetes environment is much more complicated than in a traditional deployment. RHEL, therefore, made some key changes. The company created Red Hat Enterprise Linux CoreOS — an optimized version of RHEL for the OpenShift experience. + +“It’s deployed as an immutable. It’s tailored, narrow, and gets updated as part of your OpenShift update to provide consistent user experience and comprehensive security. + +The launch of the Red Hat Universal Base Image (UBI) offers users greater security, reliability, and performance of official Red Hat container images where OCI-compliant Linux containers run. + +“Kubernetes is a new way to deploy Linux. It really is a tight collaboration but what we’re really focused on is the customer experience. We want them to get easy updates with consistency and reliability, resilience and security. We’re pulling all of that together. With such advancements going on, it’s a fascinating space to watch,” added Chiras. + +-------------------------------------------------------------------------------- + +via: https://www.linux.com/articles/linux-and-kubernetes-serving-the-common-goals-of-enterprises/ + +作者:[Swapnil Bhartiya][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://www.linux.com/author/swapnil/ +[b]: https://github.com/lujun9972 +[1]: https://www.linux.com/wp-content/uploads/2019/12/computer-2930704_1280-1068x634.jpg (computer-2930704_1280) +[2]: https://www.linux.com/wp-content/uploads/2019/12/computer-2930704_1280.jpg +[3]: https://www.linkedin.com/in/stefanie-chiras-9022144/ +[4]: https://www.redhat.com/en +[5]: https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/8/html-single/8.2_release_notes/index +[6]: https://github.com/containers/skopeo diff --git a/sources/tech/20200501 Transparent, open source alternative to Google Analytics.md b/sources/tech/20200501 Transparent, open source alternative to Google Analytics.md new file mode 100644 index 0000000000..d4ce222a39 --- /dev/null +++ b/sources/tech/20200501 Transparent, open source alternative to Google Analytics.md @@ -0,0 +1,123 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Transparent, open source alternative to Google Analytics) +[#]: via: (https://opensource.com/article/20/5/plausible-analytics) +[#]: author: (Marko Saric https://opensource.com/users/markosaric) + +Transparent, open source alternative to Google Analytics +====== +Plausible Analytics is a leaner, more transparent option, with the +essential data you need but without all the privacy baggage. +![Digital creative of a browser on the internet][1] + +Google Analytics is the most popular website analytics tool. Millions of developers and creators turn to it to collect and analyze their website statistics. + +More than 53% of all sites on the web track their visitors using Google Analytics. [84%][2] of sites that do use a known analytics script use Google Analytics. + +Google Analytics has, for years, been one of the first tools I installed on a newly launched site. It is a powerful and useful analytics tool. Installing Google Analytics was a habit I didn't think much about until the introduction of the [GDPR][3] (General Data Protection Regulation) and other privacy regulations. + +Using Google Analytics these days comes with several pitfalls, including the need for a privacy policy, the need for cookie banners, and the need for a GDPR consent prompt. All these may negatively impact the site loading time and visitor experience. + +This has made me try to [de-Google-ify websites][4] that I work on, and it's made me start working on independent solutions that are open source and more privacy-friendly. This is where Plausible Analytics enters the story. + +[Plausible Analytics][5] is an open source and lightweight alternative to Google Analytics. It doesn't use cookies and it doesn't collect any personal data, so you don't need to show any cookie banners or get GDPR or CCPA consent. Let's take a closer look. + +### Main differences between Google Analytics and Plausible + +Plausible Analytics is not designed to be a clone of Google Analytics. It is meant as a simple-to-use replacement and a privacy-friendly alternative. Here are the main differences between the two web analytics tools: + +#### Open source vs. closed source + +Google Analytics may be powerful and useful, but it is closed source. It is a proprietary tool run by one of the largest companies in the world, a company that is a key player in the ad-tech industry. There's simply no way of knowing what's going on behind the scenes. You have to put your trust in Google. + +Plausible is a fully open source tool. You can read our code [on GitHub][6]. We're "open" in other ways, too, such as our [public roadmap][7], which is based around the feedback and features submitted by the members of our community. + +#### Privacy of your website visitors + +Google Analytics places [several cookies][8] on the devices of your visitors, and it tracks and collects a lot of data. This means that there are several requirements if you want to use Google Analytics and be compliant with the different regulations: + + * You need to have a privacy policy about analytics + * You need to show a cookie banner + * You need to obtain a GDPR/CCPA consent + + + +Plausible is made to be fully compliant with the privacy regulations. No cookies are used, and no personal data is collected. This means that you don't need to display the cookie banner, you don't need a privacy policy, and you don't need to ask for the GDPR/CCPA consent when using Plausible. + +#### Page weight and loading time + +The recommended way of installing Google Analytics is to use the Google Tag Manager. Google Tag Manager script weights 28 KB, and it downloads another JavaScript file called the Google Analytics tag, which adds an additional 17.7 KB to your page size. That's 45.7 KB of page weight combined. + +Plausible script weights only 1.4 KB. That's 33 times smaller than the Google Analytics Global Site Tag. Every KB matters when you want to keep your site fast to load. + +#### Accuracy of visitor stats + +Google Analytics is being blocked by an increasing number of web users. It's blocked by those who use open source browsers such as [Firefox][9] and [Brave][10]. It's also blocked by those who use open source browser add-ons such as the [uBlock Origin][11]. It's not uncommon to see 40% or more of the audience on a tech site blocking Google Analytics. + +Plausible is a new player on this market and it's privacy-friendly by default, so it doesn't see the same level of blockage. + +#### Simple vs. complex web analytics + +[Google Analytics is overkill][12] for many website owners. It's a complex tool that takes time to understand and requires training. Google Analytics presents hundreds of different reports and metrics for you to get insights from. Many users end up creating custom dashboards while ignoring all the rest. + +Plausible cuts through all the noise that Google Analytics creates. It presents everything you need to know on one single page—all the most valuable metrics at a glance. You can get an overview of the most actionable insights about your website in one minute. + +### A guided tour of Plausible Analytics + +Plausible Analytics is not a full-blown replacement and a feature-by-feature reproduction of Google Analytics. It's not designed for all the different use-cases of Google Analytics. + +It's built with simplicity and speed in mind. There is no navigational menu. There are no additional sub-menus. There is no need to create custom reports. You get one simple and useful web analytics dashboard out of the box. + +Rather than tracking every metric imaginable, many of them that you will never find a use for, Plausible focuses on the essential website stats only. It is easy to use and understand with no training or prior experience: + +![Plausible analytics in action][13] + + * Choose the time range that you want to analyze. The visitor numbers are automatically presented on an hourly, daily, or monthly graph. The default time frame is set at the last 30 days. + * See the number of unique visitors, total page views, and the bounce rate. These metrics include a percentage comparison to the previous time period, so you understand if the trends are going up or down. + * See all the referral sources of traffic and all the most visited pages on your site. Bounce rates of the individual referrals and pages are included too. + * See the list of countries your traffic is coming from. You can also see the device, browser, and operating system your visitors are using. + * Track events and goals to identify the number of converted visitors, the conversion rate, and the referral sites that send the best quality traffic. + + + +Take a look at the [live demo][14] where you can follow the traffic to the Plausible website. + +### Give Plausible Analytics a chance + +With Plausible Analytics, you get all the important web analytics at a glance so you can focus on creating a better site without needing to annoy your visitors with all the different banners and prompts. + +You can try Plausible Analytics on your site alongside Google Analytics. [Register today][15] to try it out, and see what you like and what you don't. Share your feedback with the community. This helps us learn and improve. We'd love to hear from you. + +Take a look at five great open source alternatives to Google Docs. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/5/plausible-analytics + +作者:[Marko Saric][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/markosaric +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/browser_web_internet_website.png?itok=g5B_Bw62 (Digital creative of a browser on the internet) +[2]: https://w3techs.com/technologies/details/ta-googleanalytics +[3]: https://gdpr-info.eu/ +[4]: https://markosaric.com/degoogleify/ +[5]: https://plausible.io/ +[6]: https://github.com/plausible-insights/plausible +[7]: https://feedback.plausible.io/roadmap +[8]: https://developers.google.com/analytics/devguides/collection/analyticsjs/cookie-usage +[9]: https://www.mozilla.org/en-US/firefox/new/ +[10]: https://brave.com/ +[11]: https://github.com/gorhill/uBlock +[12]: https://plausible.io/vs-google-analytics +[13]: https://opensource.com/sites/default/files/plausible-analytics.png (Plausible analytics in action) +[14]: https://plausible.io/plausible.io +[15]: https://plausible.io/register diff --git a/sources/tech/20200503 13 tips for getting your talk accepted at a tech conference.md b/sources/tech/20200503 13 tips for getting your talk accepted at a tech conference.md new file mode 100644 index 0000000000..b260116fb6 --- /dev/null +++ b/sources/tech/20200503 13 tips for getting your talk accepted at a tech conference.md @@ -0,0 +1,127 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (13 tips for getting your talk accepted at a tech conference) +[#]: via: (https://opensource.com/article/20/5/tips-conference-proposals) +[#]: author: (Todd Lewis https://opensource.com/users/toddlewis) + +13 tips for getting your talk accepted at a tech conference +====== +Before you respond to an event's call for papers, make sure your talk's +proposal aligns with these best practices. +![All Things Open check-in at registration booth][1] + +As tech conference organizers ramp up for the fall season, you may be seeing calls for papers (CFP) landing in your email box or social media feeds. We at [All Things Open][2] (ATO) have seen a lot of presentation proposals over the years, and we've learned a few things about what makes them successful. + +As we prepare for the eighth annual ATO in October 2020, we thought we'd offer a few best practices for writing successful CFP responses. If you're considering submitting a talk to ATO or another tech event, we hope these tips will help improve the chances that your proposal will be accepted. + +### 1\. Know the event you're submitting a talk to + +This seems like the proverbial _no-brainer_, but some people don't take the time to research an event before they submit a talk. Peruse the conference's website and review the talks, speakers, topics, etc. featured in the last couple of years. You can also find a lot of information simply by googling. The time you invest here will help you avoid a submission that is completely out of context for the event. + +### 2\. Understand what the event is looking for + +Look for information about what the event is looking for and what types of topics or talks it expects will be a good fit. We try to provide as much information as possible about the [ATO conference][3], [why someone would want to speak][4], and [what we're looking for][5] (both general and special interest topics). We also try to make the submission process as easy as possible (no doubt, there is room for improvement), in part because we believe this improves the quality of submissions and makes our review process go more smoothly. + +### 3\. Reach out to the organizer and ask questions + +If you're considering submitting a talk, don't hesitate to reach out and ask the event organizers any questions you have and for guidance specific to the event. If there is no or little response, that should be a red flag. If you have any questions about All Things Open, please reach out directly at [info@allthingsopen.org][6]. + +### 4\. Be clear about what attendees will learn from your talk + +This is one of the most common mistakes we see. Only about 25% of the proposals we receive clearly explain the proposed talk's takeaways. One reason you should include this is that nearly every event attendee makes their schedule based on what they will learn if they go to a session. But for organizers and proposal reviewers, having this information clearly stated upfront is pure gold. It simplifies and speeds up the assessment process, which gets you one step closer to being accepted as a speaker. A paragraph titled "Attendee Takeaways" with bullet points is the holy grail for everyone involved. + +### 5\. Keep recommended word counts in mind + +This is another mistake we see a lot. Many talks are submitted with either a single sentence description in the abstract or an extraordinary long volume of text. Neither is a good idea. The only exception we can think of is when a topic is very popular or topical, and that alone is enough to win the day even if the abstract is extremely short (but this is rare). Most abstracts should be between 75 and 250 words, and perhaps more for an extended workshop with prerequisites (e.g., preexisting knowledge or required downloads). Even then, try to keep your proposal as sharp, concise, and on-point as possible. + +Disregard this advice at your own risk; otherwise, there's a high likelihood that your proposal will be met with one of these reactions from reviewers: "They didn't take the time to write any more than this?" or "Sheesh, there's no way I have the time to read all that. I'm going to give it the lowest score and move on." + +### 6\. Choose a good title + +This is a debate we see all the time: Should a talk's title describe what the talk is about, or should it be written to stand out and get attention (e.g., evoking emotion, anchoring to a popular pop culture topic, or asking a compelling question)? There isn't a single correct answer to this question, but we definitely know when a title "works" and when it doesn't. We've seen some very creative titles work well and generate interest, and we've seen very straightforward titles work well, also. + +Here is our rule of thumb: If the talk covers a topic that has been around a while and is not particularly _hot_ right now, try getting creative and spicing it up a bit. If the topic is newer, a more straightforward title describing the talk in plain terms should be good. + +Titles on an event schedule may be the only thing attendees use to decide what talks to attend. So, run your potential talk titles by colleagues and friends, and seek their opinions. Ask: "If you were attending an event and saw this title on the schedule, would it pique your interest?" + +### 7\. Know the basic criteria that reviewers and organizers use to make decisions + +While this isn't a comprehensive list of review criteria, most reviewers and organizers consider one or more of the following when evaluating talk proposals. Therefore, at minimum, consider this list when you're creating a talk and the components that go with it. + + 1. **Timeliness of and estimated interest in the topic:** Is the topic applicable to the session's target audience? Will it deliver value? Is it timely? + 2. **Educational value:** Based on the abstract and speaker, is it clear that attendees will learn something from the talk? As mentioned in item 4 above, including an "Attendee Takeaways" section is really helpful to establish educational value. + 3. **Technical value:** Is the technology you intend to showcase applicable, unique, or being used in a new and creative way? Is there a live demo or a hands-on component? While some topics don't lend themselves to a demo, most people are visual learners and are better off if a presentation includes one (if it's relevant). For this reason, we place a lot of value on demos and hands-on content. + 4. **Diversity:** Yes, there are exceptions, but the majority of events, reviewers, and organizers agree that having a diverse speaker lineup is optimal and results in a better overall event in multiple ways. A topic delivered from a different perspective can often lead to creative breakthroughs for attendees, which is a huge value-add. See item 10 below for more on this. + 5. **Talk difficulty level:** We identify All Things Open talks as introductory, intermediate, or advanced. Having a good mix of talk levels ensures everyone in attendance can access applicable content. See item 9 below for more on this, but in general, it's smart to indicate your talk's level, whether or not the CFP requests it. + + + +### 8\. Stay current on the event's industry or sector + +Submitting a proposal on a relevant topic increases the probability your talk will be accepted. But how do you know what topics are of interest, especially if the CFP doesn't spell it out in simple terms? The best way to know what's timely and interesting is to deeply understand the sector the event focuses on. + +Yes, this requires time and effort, and it implies you enjoy the sector enough to stay current on it, but it will pay off. This knowledge will result in a higher _sector IQ_, which will be reflected in your topic, title, and abstract. It will be recognized by reviewers and immediately set you apart from others. At All Things Open, we spend the majority of our time reading about and staying current on the "open" space so that we can feature relevant, substantive, and informed content. Submitting a talk that is relevant, substantive, and informed greatly enhances the chance it will be accepted. + +### 9\. Describe whether the talk is introductory, intermediate, or advanced + +Some CFPs don't ask for this information, but you should offer it anyway. It will make the reviewers and organizer very happy for multiple reasons, including these: + + 1. Unless the event targets attendees with a certain skill or experience level (and most do not), organizers must include content that is appealing to a wide audience, including people of all skill, experience, and expertise levels. Even if an event focuses on a specific type of attendee (perhaps people with higher levels of experience or skills), most want to offer something a little different. Listing the talk level makes this much easier for organizers. + 2. News flash: Reviewers and organizers don't know everything and are not experts in every possible topic area. As a result, reviewers will sometimes look for a few keywords or other criteria, and adding the talk level can "seal the deal" and get your talk confirmed. + + + +### 10\. Tell organizers if you're a member of a historically underrepresented group + +A growing number of events are getting better at recognizing the value of diversity and ensuring their speaker lineup reflects it. If you're part of a group that hasn't typically been included in tech events and leadership, look to see if there is a place to indicate that on the submission form. If not, mention it in a conspicuous place somewhere in the abstract. This does not guarantee approval in any way—your proposal must still be well-written and relevant—but it does give reviewers and organizers pertinent information they may value and take into consideration. + +### 11\. Don't be ashamed of your credentials or speaking experience if it is light + +We talk to a lot of people who would like to deliver a presentation and have a lot to offer, but they never submit a talk because they don't feel they're qualified to speak. _Not true._ Some of the best talks we've seen are from first-time speakers or those very early in their speaking careers. Go ahead and submit the talk, and be honest when discussing your background. Most reviewers and organizers will focus on the substance of the submission over your experience and recognize that new ways of approaching and using technology often come from newbies rather than industry veterans. + +One caveat here: It still pays to know yourself. By this, we mean if you absolutely hate public speaking, have no desire to do it, and are only considering submitting a talk due to, for example, pressure from an employer, the talk is not likely to go well. It's better, to be honest, on the frontend than force something you have no desire to do. + +### 12\. Consider panel sessions carefully + +If you've got an idea for a panel session, please consider it carefully. In more than 10 years of hosting events we've seen some really good panel sessions, but we've seen far more that didn't go so well. Perhaps too many people were on the panel and not everyone had a chance to speak, perhaps a single panel member dominated the entire conversation, or perhaps the moderator didn't keep the dialogue and engagement flowing smoothly. Regardless of the issue, panels have the potential to go very wrong. + +That said, panels can still work and deliver a lot of value to attendees. If you do submit a panel session be sure to keep in mind the amount of time allotted for the session and confirm the number of panel members accordingly. Remember, less is always more when it comes to the panel format. Also, be sure the moderator understands the subject matter being discussed and doesn't mind enforcing format parameters and speaking time limits. Finally, let organizers know panel members and the moderator will engage in a pre-conference walk-through/preparation call before the event to ensure a smooth process in front of a live audience. Remember, organizers are well aware panels can be terrific but can also go in the opposite direction and very easily lead to a lot of negative feedback. + +### 13\. This is not an opportunity to sell  + +This is a sensitive topic, but one that absolutely must be mentioned. Over the years we've seen literally hundreds of talks "disqualified" by reviewers because they viewed the talk as a sales pitch. Few things evoke such a visceral response. Yes, there are events, tracks, and session slots where a sales pitch is appropriate (and maybe even required by the company paying your costs). However, make it a priority to know when and where this is appropriate and acceptable. And always, and we mean always, err on the side of making substance the focus of the talk rather than a sales angle.  + +It might sound like a cliche, but when a talk is delivered effectively with a focus on substance, people will **want** to buy what you're selling. And if you're not selling anything, they'll want to follow you on social media and generally engage with you—because you delivered value to them. Meaning: You gave them something they can apply themselves (education) or because your delivery style was entertaining and engaging. With rare exceptions, always focus any abstract on substance, and the rest will take care of itself.  + +### Go for it! + +We greatly admire and respect anyone who submits a talk for consideration—it takes a lot of time, thought, and courage. Therefore, we go to great lengths to thank everyone who goes through the process; we give free event passes to everyone who applies (regardless of approval or rejection), and we make every effort to host Q&A sessions to provide as much guidance as possible on the front end. Again, the more time and consideration speakers put into the submission process, the easier the lives of reviewers and organizers. We need to make all of this as easy as possible. + +While this is not a comprehensive list of best practices, it includes some of the things we think people can benefit from knowing before submitting a talk. There are a lot of people out there with more knowledge and experience, so please share your best tips for submitting conference proposals in the comments, so we can all learn from you. + +* * * + +_[All Things Open][2] is a universe of platforms and events focusing on open source, open tech, and the open web. It hosts the [All Things Open conference][3], the largest open source/tech/web event on the US East Coast. The conference regularly hosts thousands of attendees and many of the world's most influential companies from a wide variety of industries and sectors. In 2019, nearly 5,000 people attended from 41 US states and 24 countries. Please direct inquiries about ATO to the team at [info@allthingsopen.org][6]._ + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/5/tips-conference-proposals + +作者:[Todd Lewis][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/toddlewis +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/ato2016_checkin_conference.jpg?itok=DJtoSS6t (All Things Open check-in at registration booth) +[2]: https://www.allthingsopen.org/ +[3]: https://2020.allthingsopen.org/ +[4]: https://2020.allthingsopen.org/call-for-speakers +[5]: https://www.allthingsopen.org/what-were-looking-for/ +[6]: mailto:info@allthingsopen.org diff --git a/sources/tech/20200504 Create interactive learning games for kids with open source.md b/sources/tech/20200504 Create interactive learning games for kids with open source.md new file mode 100644 index 0000000000..f6ade34857 --- /dev/null +++ b/sources/tech/20200504 Create interactive learning games for kids with open source.md @@ -0,0 +1,123 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Create interactive learning games for kids with open source) +[#]: via: (https://opensource.com/article/20/5/jclic-games-kids) +[#]: author: (Peter Cheer https://opensource.com/users/petercheer) + +Create interactive learning games for kids with open source +====== +Help your students learn by creating fun puzzles and games in JClic, an +easy Java-based app. +![Family learning and reading together at night in a room][1] + +Schools are closed in many countries around the world to slow the spread of COVID-19. This has suddenly thrown many parents and teachers into homeschooling. Fortunately, there are plenty of educational resources on the internet to use or adapt, although their licenses vary. You can try searching for Creative Commons Open Educational Resources, but if you want to create your own materials, there are many options for that to. + +If you want to create digital educational activities with puzzles or tests, two easy-to-use, open source, cross-platform applications that fit the bill are eXeLearning and JClic. My earlier article on [eXeLearning][2] is a good introduction to that program, so here I'll look at [JClic][3]. It is an open source software project for creating various types of interactive activities such as associations, text-based activities, crosswords, and other puzzles with text, graphics, and multimedia elements. + +Although it's been around since the 1990s, JClic never developed a large user base in the English-speaking world. It was created in Catalonia by the [Catalan Educational Telematic Network][4] (XTEC). + +### About JClic + +JClic is a Java-based application that's available in many Linux repositories and can be downloaded from [GitHub][5]. It runs on Linux, macOS, and Windows, but because it is a Java program, you must have a Java runtime environment [installed][6]. + +The program's interface has not really changed much over the years, even while features have been added or dropped, such as introducing HTML5 export functionality to replace Java Applet technology for web-based deployment. It hasn't needed to change much, though, because it's very effective at what it does. + +### Creating a JClic project + +Many teachers from many countries have used JClic to create interactive materials for a wide variety of ability levels, subjects, languages, and curricula. Some of these materials have been collected in an [downloadable activities library][7]. Although few activities are in English, you can get a sense of the possibilities JClic offers. + +As JClic has a visual, point-and-click program interface, it is easy enough to learn that a new user can quickly concentrate on content creation. [Documentation][8] is available on GitHub. + +The screenshots below are from one of the JClic projects I created to teach basic Excel skills to learners in Papua New Guinea. + +A JClic project is created in its authoring tool and consists of the following four elements: + +#### 1\. Metadata about the project + +![JClic metadata][9] + +#### 2\. A library of the graphical and other resources it uses + +![JClic media][10] + +#### 3\. A series of one or more activities + +![JClic activities][11] + +JClic can produce seven different activity types: + + * Associations where the user discovers the relationships between two information sets + * Memory games where the user discovers pairs of identical elements or relations (which are hidden) between them + * Exploration activities involving the identification and information, based on a single Information set + * Puzzles where the user reconstructs information that is initially presented in a disordered form; the activity can include graphics, text, sound, or a combination of them + * Written-response activities that are solved by writing text, either a single word or a sentence + * Text activities that are based on words, phrases, letters, and paragraphs of text that need to be completed, understood, corrected, or ordered; these activities can contain images and windows with active content + * Word searches and crosswords + + + +Because of variants in the activities, there are 16 possible activity types. + +#### 4\. A timeline to sequence the activities + +![JClic timeline][12] + +### Using JClic content + +Projects can run in JClic's player (part of the Java application you used to create the project), or they can be exported to HTML5 so they can run in a web browser. + +The one thing I don't like about JClic is that its default HTML5 export function assumes you'll be online when running a project. If you want a project to work offline as needed, you must download a compiled and minified HTML5 player from [Github][13], and place it in the same folder as your JClic project. + +Next, open the **index.html** file in a text editor and replace this line: + + +``` +`` +``` + +With: + + +``` +`` +``` + +Now the HTML5 version of your project runs in a web browser, whether the user is online or not. + +JClic also provides a reports function that can store test scores in an ODBC-compliant database. I have not explored this feature, as my tests and puzzles are mostly used for self-assessment and to prompt reflection by the learner, rather than as part of a formal scheme, so the scores are not very important. If you would like to learn about it, there is [documentation][14] on running JClic Reports Server with Tomcat and MySQL (or [mariaDB][15]). + +### Conclusion + +JClic offers a wide range of activity types that provide plenty of room to be creative in designing content to fit your subject area and type of learner. JClic is a valuable addition for anyone who needs a quick and easy way to develop educational resources. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/5/jclic-games-kids + +作者:[Peter Cheer][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/petercheer +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/family_learning_kids_night_reading.png?itok=6K7sJVb1 (Family learning and reading together at night in a room) +[2]: https://opensource.com/article/18/5/exelearning +[3]: https://clic.xtec.cat/legacy/en/jclic/index.html +[4]: https://clic.xtec.cat/legacy/en/index.html +[5]: https://github.com/projectestac/jclic +[6]: https://adoptopenjdk.net/installation.html +[7]: https://clic.xtec.cat/repo/ +[8]: https://github.com/projectestac/jclic/wiki/JClic_Guide +[9]: https://opensource.com/sites/default/files/uploads/metadata.png (JClic metadata) +[10]: https://opensource.com/sites/default/files/uploads/media.png (JClic media) +[11]: https://opensource.com/sites/default/files/uploads/activities.png (JClic activities) +[12]: https://opensource.com/sites/default/files/uploads/sequence.png (JClic timeline) +[13]: http://projectestac.github.io/jclic.js/ +[14]: https://github.com/projectestac/jclic/wiki/Jclic-Reports-Server-with-Tomcat-and-MySQL-on-Ubuntu +[15]: https://mariadb.org/ diff --git a/sources/tech/20200504 Define and optimize data partitions in Apache Cassandra.md b/sources/tech/20200504 Define and optimize data partitions in Apache Cassandra.md new file mode 100644 index 0000000000..d28f0daee0 --- /dev/null +++ b/sources/tech/20200504 Define and optimize data partitions in Apache Cassandra.md @@ -0,0 +1,150 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Define and optimize data partitions in Apache Cassandra) +[#]: via: (https://opensource.com/article/20/5/apache-cassandra) +[#]: author: (Anil Inamdar https://opensource.com/users/anil-inamdar) + +Define and optimize data partitions in Apache Cassandra +====== +Apache Cassandra is built for speed and scalability; here's how to get +the most out of those benefits. +![Person standing in front of a giant computer screen with numbers, data][1] + +Apache Cassandra is a database. But it's not just any database; it's a replicating database designed and tuned for scalability, high availability, low-latency, and performance. Cassandra can help your data survive regional outages, hardware failure, and what many admins would consider excessive amounts of data. + +Having a thorough command of data partitions enables you to achieve superior Cassandra cluster design, performance, and scalability. In this article, I'll examine how to define partitions and how Cassandra uses them, as well as the most critical best practices and known issues you ought to be aware of. + +To set the scene: partitions are chunks of data that serve as the atomic unit for key database-related functions like data distribution, replication, and indexing. Distributed data systems commonly distribute incoming data into these partitions, performing the partitioning with simple mathematical functions such as identity or hashing, and using a "partition key" to group data by partition. For example, consider a case where server logs arrive as incoming data. Using the "identity" partitioning function and the timestamps of each log (rounded to the hour value) for the partition key, we can partition this data such that each partition holds one hour of the logs. + +### Data partitions in Cassandra + +Cassandra operates as a distributed system and adheres to the data partitioning principles described above. With Cassandra, data partitioning relies on an algorithm configured at the cluster level, and a partition key configured at the table level. + +![Cassandra data partition][2] + +Cassandra Query Language (CQL) uses the familiar SQL table, row, and column terminologies. In the example diagram above, the table configuration includes the partition key within its primary key, with the format: Primary Key = Partition Key + [Clustering Columns]. + +A primary key in Cassandra represents both a unique data partition and a data arrangement inside a partition. Data arrangement information is provided by optional clustering columns. Each unique partition key represents a set of table rows managed in a server, as well as all servers that manage its replicas. + +### Defining primary keys in CQL + +The following four examples demonstrate how a primary key can be represented in CQL syntax. The sets of rows produced by these definitions are generally considered a partition. + +#### Definition 1 (partition key: log_hour, clustering columns: none) + + +``` +CREATE TABLE server_logs( +   log_hour TIMESTAMP PRIMARYKEY, +   log_level text, +   message text, +   server text +   ) +``` + +Here, all rows that share a **log_hour** go into the same partition. + +#### Definition 2 (partition key: log_hour, clustering columns: log_level) + + +``` +CREATE TABLE server_logs( +   log_hour TIMESTAMP, +   log_level text, +   message text, +   server text, +   PRIMARY KEY (log_hour, log_level) +   ) +``` + +This definition uses the same partition key as Definition 1, but here all rows in each partition are arranged in ascending order by **log_level**. + +#### Definition 3 (partition key: log_hour, server, clustering columns: none) + + +``` +CREATE TABLE server_logs( +   log_hour TIMESTAMP, +   log_level text, +   message text, +   server text, +   PRIMARY KEY ((log_hour, server)) +   ) +``` + +In this definition, all rows share a **log_hour** for each distinct **server** as a single partition. + +#### Definition 4 (partition key: log_hour, server, clustering columns: log_level) + + +``` +CREATE TABLE server_logs( +   log_hour TIMESTAMP, +   log_level text, +   message text, +   server text, +   PRIMARY KEY ((log_hour, server),log_level) +   )WITH CLUSTERING ORDER BY (column3 DESC); +``` + +This definition uses the same partition as Definition 3 but arranges the rows within a partition in descending order by **log_level**. + +### How Cassandra uses the partition key + +Cassandra relies on the partition key to determine which node to store data on and where to locate data when it's needed. Cassandra performs these read and write operations by looking at a partition key in a table, and using tokens (a long value out of range -2^63 to +2^63-1) for data distribution and indexing. These tokens are mapped to partition keys by using a partitioner, which applies a partitioning function that converts any partition key to a token. Through this token mechanism, every node of a Cassandra cluster owns a set of data partitions. The partition key then enables data indexing on each node. + +![Cassandra cluster with 3 nodes and token-based ownership][3] + +A Cassandra cluster with three nodes and token-based ownership. This is a simplistic representation: the actual implementation uses [Vnodes][4]. + +### Data partition impacts on Cassandra clusters + +Careful partition key design is crucial to achieving the ideal partition size for the use case. Getting it right allows for even data distribution and strong I/O performance. Partition size has several impacts on Cassandra clusters you need to be aware of: + + * Read performance—In order to find partitions in SSTables files on disk, Cassandra uses data structures that include caches, indexes, and index summaries. Partitions that are too large reduce the efficiency of maintaining these data structures – and will negatively impact performance as a result. Cassandra releases have made strides in this area: in particular, version 3.6 and above of the Cassandra engine introduce storage improvements that deliver better performance for large partitions and resilience against memory issues and crashes. + * Memory usage— Large partitions place greater pressure on the JVM heap, increasing its size while also making the garbage collection mechanism less efficient. + * Cassandra repairs—Large partitions make it more difficult for Cassandra to perform its repair maintenance operations, which keep data consistent by comparing data across replicas. + * Tombstone eviction—Not as mean as it sounds, Cassandra uses unique markers known as "tombstones" to mark data for deletion. Large partitions can make that deletion process more difficult if there isn't an appropriate data deletion pattern and compaction strategy in place. + + + +While these impacts may make it tempting to simply design partition keys that yield especially small partitions, the data access pattern is also highly influential on ideal partition size (for more information, read this in-depth guide to [Cassandra data modeling][5]). The data access pattern can be defined as how a table is queried, including all of the table's **select** queries. Ideally, CQL select queries should have just one partition key in the **where** clause—that is to say, Cassandra is most efficient when queries can get needed data from a single partition, instead of many smaller ones. + +### Best practices for partition key design + +Following best practices for partition key design helps you get to an ideal partition size. As a rule of thumb, the maximum partition size in Cassandra should stay under 100MB. Ideally, it should be under 10MB. While Cassandra versions 3.6 and newer make larger partition sizes more viable, careful testing and benchmarking must be performed for each workload to ensure a partition key design supports desired cluster performance. + +Specifically, these best practices should be considered as part of any partition key design: + + * The goal for a partition key must be to fit an ideal amount of data into each partition for supporting the needs of its access pattern. + * A partition key should disallow unbounded partitions: those that may grow indefinitely in size over time. For instance, in the **server_logs** examples above, using the server column as a partition key would create unbounded partitions as the number of server logs continues to increase. In contrast, using **log_hour** limits each partition to an hour of data. + * A partition key should also avoid creating a partition skew, in which partitions grow unevenly, and some are able to grow without limit over time. In the **server_logs** examples, using the server column in a scenario where one server generates considerably more logs than others would produce a partition skew. To avoid this, a useful technique is to introduce another attribute from the table to force an even distribution, even if it's necessary to create a dummy column to do so. + * It's helpful to partition time-series data with a partition key that uses a time element as well as other attributes. This protects against unbounded partitions, enables access patterns to use the time attribute in querying specific data, and allows for time-bound data deletion. The examples above each demonstrate this by using the **log_hour** time attribute. + + + +Several tools are available to help test, analyze, and monitor Cassandra partitions to check that a chosen schema is efficient and effective. By carefully designing partition keys to align well with the data and needs of the solution at hand, and following best practices to optimize partition size, you can utilize data partitions that more fully deliver on the scalability and performance potential of a Cassandra deployment. + +Dani and Jon will give a three hour tutorial at OSCON this year called: Becoming friends with... + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/5/apache-cassandra + +作者:[Anil Inamdar][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/anil-inamdar +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/data_metrics_analytics_desktop_laptop.png?itok=9QXd7AUr (Person standing in front of a giant computer screen with numbers, data) +[2]: https://opensource.com/sites/default/files/uploads/apache_cassandra_1_0.png (Cassandra data partition) +[3]: https://opensource.com/sites/default/files/uploads/apache_cassandra_2_0.png (Cassandra cluster with 3 nodes and token-based ownership) +[4]: https://www.instaclustr.com/cassandra-vnodes-how-many-should-i-use/ +[5]: https://www.instaclustr.com/resource/6-step-guide-to-apache-cassandra-data-modelling-white-paper/ diff --git a/sources/tech/20200504 Understanding systemd at startup on Linux.md b/sources/tech/20200504 Understanding systemd at startup on Linux.md new file mode 100644 index 0000000000..2d0a5ef7b6 --- /dev/null +++ b/sources/tech/20200504 Understanding systemd at startup on Linux.md @@ -0,0 +1,445 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Understanding systemd at startup on Linux) +[#]: via: (https://opensource.com/article/20/5/systemd-startup) +[#]: author: (David Both https://opensource.com/users/dboth) + +Understanding systemd at startup on Linux +====== +systemd's startup provides important clues to help you solve problems +when they occur. +![People at the start line of a race][1] + +In [_Learning to love systemd_][2], the first article in this series, I looked at systemd's functions and architecture and the controversy around its role as a replacement for the old SystemV init program and startup scripts. In this second article, I'll start exploring the files and tools that manage the Linux startup sequence. I'll explain the systemd startup sequence, how to change the default startup target (runlevel in SystemV terms), and how to manually switch to a different target without going through a reboot. + +I'll also look at two important systemd tools. The first is the **systemctl** command, which is the primary means of interacting with and sending commands to systemd. The second is **journalctl**, which provides access to the systemd journals that contain huge amounts of system history data such as kernel and service messages (both informational and error messages). + +Be sure to use a non-production system for testing and experimentation in this and future articles. Your test system needs to have a GUI desktop (such as Xfce, LXDE, Gnome, KDE, or another) installed. + +I wrote in my previous article that I planned to look at creating a systemd unit and adding it to the startup sequence in this article. Because this article became longer than I anticipated, I will hold that for the next article in this series. + +### Exploring Linux startup with systemd + +Before you can observe the startup sequence, you need to do a couple of things to make the boot and startup sequences open and visible. Normally, most distributions use a startup animation or splash screen to hide the detailed messages that would otherwise be displayed during a Linux host's startup and shutdown. This is called the Plymouth boot screen on Red Hat-based distros. Those hidden messages can provide a great deal of information about startup and shutdown to a sysadmin looking for information to troubleshoot a bug or to just learn about the startup sequence. You can change this using the GRUB (Grand Unified Boot Loader) configuration. + +The main GRUB configuration file is **/boot/grub2/grub.cfg**, but, because this file can be overwritten when the kernel version is updated, you do not want to change it. Instead, modify the **/etc/default/grub** file, which is used to modify the default settings of **grub.cfg**. + +Start by looking at the current, unmodified version of the **/etc/default/grub** file: + + +``` +[root@testvm1 ~]# cd /etc/default ; cat grub +GRUB_TIMEOUT=5 +GRUB_DISTRIBUTOR="$(sed 's, release .*$,,g' /etc/system-release)" +GRUB_DEFAULT=saved +GRUB_DISABLE_SUBMENU=true +GRUB_TERMINAL_OUTPUT="console" +GRUB_CMDLINE_LINUX="resume=/dev/mapper/fedora_testvm1-swap rd.lvm. +lv=fedora_testvm1/root rd.lvm.lv=fedora_testvm1/swap rd.lvm.lv=fedora_ +testvm1/usr rhgb quiet" +GRUB_DISABLE_RECOVERY="true" +[root@testvm1 default]# +``` + +Chapter 6 of the [GRUB documentation][3] contains a list of all the possible entries in the **/etc/default/grub** file, but I focus on the following: + + * I change **GRUB_TIMEOUT**, the number of seconds for the GRUB menu countdown, from five to 10 to give a bit more time to respond to the GRUB menu before the countdown hits zero. + * I delete the last two parameters on **GRUB_CMDLINE_LINUX**, which lists the command-line parameters that are passed to the kernel at boot time. One of these parameters, **rhgb** stands for Red Hat Graphical Boot, and it displays the little Fedora icon animation during the kernel initialization instead of showing boot-time messages. The other, the **quiet** parameter, prevents displaying the startup messages that document the progress of the startup and any errors that occur. I delete both **rhgb** and **quiet** because sysadmins need to see these messages. If something goes wrong during boot, the messages displayed on the screen can point to the cause of the problem. + + + +After you make these changes, your GRUB file will look like: + + +``` +[root@testvm1 default]# cat grub +GRUB_TIMEOUT=10 +GRUB_DISTRIBUTOR="$(sed 's, release .*$,,g' /etc/system-release)" +GRUB_DEFAULT=saved +GRUB_DISABLE_SUBMENU=true +GRUB_TERMINAL_OUTPUT="console" +GRUB_CMDLINE_LINUX="resume=/dev/mapper/fedora_testvm1-swap rd.lvm. +lv=fedora_testvm1/root rd.lvm.lv=fedora_testvm1/swap rd.lvm.lv=fedora_ +testvm1/usr" +GRUB_DISABLE_RECOVERY="false" +[root@testvm1 default]# +``` + +The **grub2-mkconfig** program generates the **grub.cfg** configuration file using the contents of the **/etc/default/grub** file to modify some of the default GRUB settings. The **grub2-mkconfig** program sends its output to **STDOUT**. It has a **-o** option that allows you to specify a file to send the datastream to, but it is just as easy to use redirection. Run the following command to update the **/boot/grub2/grub.cfg** configuration file: + + +``` +[root@testvm1 grub2]# grub2-mkconfig > /boot/grub2/grub.cfg +Generating grub configuration file ... +Found linux image: /boot/vmlinuz-4.18.9-200.fc28.x86_64 +Found initrd image: /boot/initramfs-4.18.9-200.fc28.x86_64.img +Found linux image: /boot/vmlinuz-4.17.14-202.fc28.x86_64 +Found initrd image: /boot/initramfs-4.17.14-202.fc28.x86_64.img +Found linux image: /boot/vmlinuz-4.16.3-301.fc28.x86_64 +Found initrd image: /boot/initramfs-4.16.3-301.fc28.x86_64.img +Found linux image: /boot/vmlinuz-0-rescue-7f12524278bd40e9b10a085bc82dc504 +Found initrd image: /boot/initramfs-0-rescue-7f12524278bd40e9b10a085bc82dc504.img +done +[root@testvm1 grub2]# +``` + +Reboot your test system to view the startup messages that would otherwise be hidden behind the Plymouth boot animation. But what if you need to view the startup messages and have not disabled the Plymouth boot animation? Or you have, but the messages stream by too fast to read? (Which they do.) + +There are a couple of options, and both involve log files and systemd journals—which are your friends. You can use the **less** command to view the contents of the **/var/log/messages** file. This file contains boot and startup messages as well as messages generated by the operating system during normal operation. You can also use the **journalctl** command without any options to view the systemd journal, which contains essentially the same information: + + +``` +[root@testvm1 grub2]# journalctl +\-- Logs begin at Sat 2020-01-11 21:48:08 EST, end at Fri 2020-04-03 08:54:30 EDT. -- +Jan 11 21:48:08 f31vm.both.org kernel: Linux version 5.3.7-301.fc31.x86_64 ([mockbuild@bkernel03.phx2.fedoraproject.org][4]) (gcc version 9.2.1 20190827 (Red Hat 9.2.1-1) (GCC)) #1 SMP Mon Oct > +Jan 11 21:48:08 f31vm.both.org kernel: Command line: BOOT_IMAGE=(hd0,msdos1)/vmlinuz-5.3.7-301.fc31.x86_64 root=/dev/mapper/VG01-root ro resume=/dev/mapper/VG01-swap rd.lvm.lv=VG01/root rd> +Jan 11 21:48:08 f31vm.both.org kernel: x86/fpu: Supporting XSAVE feature 0x001: 'x87 floating point registers' +Jan 11 21:48:08 f31vm.both.org kernel: x86/fpu: Supporting XSAVE feature 0x002: 'SSE registers' +Jan 11 21:48:08 f31vm.both.org kernel: x86/fpu: Supporting XSAVE feature 0x004: 'AVX registers' +Jan 11 21:48:08 f31vm.both.org kernel: x86/fpu: xstate_offset[2]:  576, xstate_sizes[2]:  256 +Jan 11 21:48:08 f31vm.both.org kernel: x86/fpu: Enabled xstate features 0x7, context size is 832 bytes, using 'standard' format. +Jan 11 21:48:08 f31vm.both.org kernel: BIOS-provided physical RAM map: +Jan 11 21:48:08 f31vm.both.org kernel: BIOS-e820: [mem 0x0000000000000000-0x000000000009fbff] usable +Jan 11 21:48:08 f31vm.both.org kernel: BIOS-e820: [mem 0x000000000009fc00-0x000000000009ffff] reserved +Jan 11 21:48:08 f31vm.both.org kernel: BIOS-e820: [mem 0x00000000000f0000-0x00000000000fffff] reserved +Jan 11 21:48:08 f31vm.both.org kernel: BIOS-e820: [mem 0x0000000000100000-0x00000000dffeffff] usable +Jan 11 21:48:08 f31vm.both.org kernel: BIOS-e820: [mem 0x00000000dfff0000-0x00000000dfffffff] ACPI data +Jan 11 21:48:08 f31vm.both.org kernel: BIOS-e820: [mem 0x00000000fec00000-0x00000000fec00fff] reserved +Jan 11 21:48:08 f31vm.both.org kernel: BIOS-e820: [mem 0x00000000fee00000-0x00000000fee00fff] reserved +Jan 11 21:48:08 f31vm.both.org kernel: BIOS-e820: [mem 0x00000000fffc0000-0x00000000ffffffff] reserved +Jan 11 21:48:08 f31vm.both.org kernel: BIOS-e820: [mem 0x0000000100000000-0x000000041fffffff] usable +Jan 11 21:48:08 f31vm.both.org kernel: NX (Execute Disable) protection: active +Jan 11 21:48:08 f31vm.both.org kernel: SMBIOS 2.5 present. +Jan 11 21:48:08 f31vm.both.org kernel: DMI: innotek GmbH VirtualBox/VirtualBox, BIOS VirtualBox 12/01/2006 +Jan 11 21:48:08 f31vm.both.org kernel: Hypervisor detected: KVM +Jan 11 21:48:08 f31vm.both.org kernel: kvm-clock: Using msrs 4b564d01 and 4b564d00 +Jan 11 21:48:08 f31vm.both.org kernel: kvm-clock: cpu 0, msr 30ae01001, primary cpu clock +Jan 11 21:48:08 f31vm.both.org kernel: kvm-clock: using sched offset of 8250734066 cycles +Jan 11 21:48:08 f31vm.both.org kernel: clocksource: kvm-clock: mask: 0xffffffffffffffff max_cycles: 0x1cd42e4dffb, max_idle_ns: 881590591483 ns +Jan 11 21:48:08 f31vm.both.org kernel: tsc: Detected 2807.992 MHz processor +Jan 11 21:48:08 f31vm.both.org kernel: e820: update [mem 0x00000000-0x00000fff] usable ==> reserved +Jan 11 21:48:08 f31vm.both.org kernel: e820: remove [mem 0x000a0000-0x000fffff] usable +<snip> +``` + +I truncated this datastream because it can be hundreds of thousands or even millions of lines long. (The journal listing on my primary workstation is 1,188,482 lines long.) Be sure to try this on your test system. If it has been running for some time—even if it has been rebooted many times—huge amounts of data will be displayed. Explore this journal data because it contains a lot of information that can be very useful when doing problem determination. Knowing what this data looks like for a normal boot and startup can help you locate problems when they occur. + +I will discuss systemd journals, the **journalctl** command, and how to sort through all of that data to find what you want in more detail in a future article in this series. + +After GRUB loads the kernel into memory, it must first extract itself from the compressed version of the file before it can perform any useful work. After the kernel has extracted itself and started running, it loads systemd and turns control over to it. + +This is the end of the boot process. At this point, the Linux kernel and systemd are running but unable to perform any productive tasks for the end user because nothing else is running, there's no shell to provide a command line, no background processes to manage the network or other communication links, and nothing that enables the computer to perform any productive function. + +Systemd can now load the functional units required to bring the system up to a selected target run state. + +### Targets + +A systemd target represents a Linux system's current or desired run state. Much like SystemV start scripts, targets define the services that must be present for the system to run and be active in that state. Figure 1 shows the possible run-state targets of a Linux system using systemd. As seen in the first article of this series and in the systemd bootup man page (man bootup), there are other intermediate targets that are required to enable various necessary services. These can include **swap.target**, **timers.target**, **local-fs.target**, and more. Some targets (like **basic.target**) are used as checkpoints to ensure that all the required services are up and running before moving on to the next-higher level target. + +Unless otherwise changed at boot time in the GRUB menu, systemd always starts the **default.target**. The **default.target** file is a symbolic link to the true target file. For a desktop workstation, this is typically going to be the **graphical.target**, which is equivalent to runlevel 5 in SystemV. For a server, the default is more likely to be the **multi-user.target**, which is like runlevel 3 in SystemV. The **emergency.target** file is similar to single-user mode. Targets and services are systemd units. + +The following table, which I included in the previous article in this series, compares the systemd targets with the old SystemV startup runlevels. The systemd target aliases are provided by systemd for backward compatibility. The target aliases allow scripts—and sysadmins—to use SystemV commands like **init 3** to change runlevels. Of course, the SystemV commands are forwarded to systemd for interpretation and execution. + +**systemd targets** | **SystemV runlevel** | **target aliases** | **Description** +---|---|---|--- +default.target | | | This target is always aliased with a symbolic link to either **multi-user.target** or **graphical.target**. systemd always uses the **default.target** to start the system. The **default.target** should never be aliased to **halt.target**, **poweroff.target**, or **reboot.target**. +graphical.target | 5 | runlevel5.target | **Multi-user.target** with a GUI +| 4 | runlevel4.target | Unused. Runlevel 4 was identical to runlevel 3 in the SystemV world. This target could be created and customized to start local services without changing the default **multi-user.target**. +multi-user.target | 3 | runlevel3.target | All services running, but command-line interface (CLI) only +| 2 | runlevel2.target | Multi-user, without NFS, but all other non-GUI services running +rescue.target | 1 | runlevel1.target | A basic system, including mounting the filesystems with only the most basic services running and a rescue shell on the main console +emergency.target | S | | Single-user mode—no services are running; filesystems are not mounted. This is the most basic level of operation with only an emergency shell running on the main console for the user to interact with the system. +halt.target | | | Halts the system without powering it down +reboot.target | 6 | runlevel6.target | Reboot +poweroff.target | 0 | runlevel0.target | Halts the system and turns the power off + +Each target has a set of dependencies described in its configuration file. systemd starts the required dependencies, which are the services required to run the Linux host at a specific level of functionality. When all of the dependencies listed in the target configuration files are loaded and running, the system is running at that target level. If you want, you can review the systemd startup sequence and runtime targets in the first article in this series, [_Learning to love systemd_][2]. + +### Exploring the current target + +Many Linux distributions default to installing a GUI desktop interface so that the installed systems can be used as workstations. I always install from a Fedora Live boot USB drive with an Xfce or LXDE desktop. Even when I'm installing a server or other infrastructure type of host (such as the ones I use for routers and firewalls), I use one of these installations that installs a GUI desktop. + +I could install a server without a desktop (and that would be typical for data centers), but that does not meet my needs. It is not that I need the GUI desktop itself, but the LXDE installation includes many of the other tools I use that are not in a default server installation. This means less work for me after the initial installation. + +But just because I have a GUI desktop does not mean it makes sense to use it. I have a 16-port KVM that I can use to access the KVM interfaces of most of my Linux systems, but the vast majority of my interaction with them is via a remote SSH connection from my primary workstation. This way is more secure and uses fewer system resources to run **multi-user.target** compared to **graphical.target.** + +To begin, check the default target to verify that it is the **graphical.target**: + + +``` +[root@testvm1 ~]# systemctl get-default +graphical.target +[root@testvm1 ~]# +``` + +Now verify the currently running target. It should be the same as the default target. You can still use the old method, which displays the old SystemV runlevels. Note that the previous runlevel is on the left; it is **N** (which means None), indicating that the runlevel has not changed since the host was booted. The number 5 indicates the current target, as defined in the old SystemV terminology: + + +``` +[root@testvm1 ~]# runlevel +N 5 +[root@testvm1 ~]# +``` + +Note that the runlevel man page indicates that runlevels are obsolete and provides a conversion table. + +You can also use the systemd method. There is no one-line answer here, but it does provide the answer in systemd terms: + + +``` +[root@testvm1 ~]# systemctl list-units --type target +UNIT                   LOAD   ACTIVE SUB    DESCRIPTION                 +basic.target           loaded active active Basic System               +cryptsetup.target      loaded active active Local Encrypted Volumes     +getty.target           loaded active active Login Prompts               +graphical.target       loaded active active Graphical Interface         +local-fs-pre.target    loaded active active Local File Systems (Pre)   +local-fs.target        loaded active active Local File Systems         +multi-user.target      loaded active active Multi-User System           +network-online.target  loaded active active Network is Online           +network.target         loaded active active Network                     +nfs-client.target      loaded active active NFS client services         +nss-user-lookup.target loaded active active User and Group Name Lookups +paths.target           loaded active active Paths                       +remote-fs-pre.target   loaded active active Remote File Systems (Pre)   +remote-fs.target       loaded active active Remote File Systems         +rpc_pipefs.target      loaded active active rpc_pipefs.target           +slices.target          loaded active active Slices                     +sockets.target         loaded active active Sockets                     +sshd-keygen.target     loaded active active sshd-keygen.target         +swap.target            loaded active active Swap                       +sysinit.target         loaded active active System Initialization       +timers.target          loaded active active Timers                     + +LOAD   = Reflects whether the unit definition was properly loaded. +ACTIVE = The high-level unit activation state, i.e. generalization of SUB. +SUB    = The low-level unit activation state, values depend on unit type. + +21 loaded units listed. Pass --all to see loaded but inactive units, too. +To show all installed unit files use 'systemctl list-unit-files'. +``` + +This shows all of the currently loaded and active targets. You can also see the **graphical.target** and the **multi-user.target**. The **multi-user.target** is required before the **graphical.target** can be loaded. In this example, the **graphical.target** is active. + +### Switching to a different target + +Making the switch to the **multi-user.target** is easy: + + +``` +`[root@testvm1 ~]# systemctl isolate multi-user.target` +``` + +The display should now change from the GUI desktop or login screen to a virtual console. Log in and list the currently active systemd units to verify that **graphical.target** is no longer running: + + +``` +`[root@testvm1 ~]# systemctl list-units --type target` +``` + +Be sure to use the **runlevel** command to verify that it shows both previous and current "runlevels": + + +``` +[root@testvm1 ~]# runlevel +5 3 +``` + +### Changing the default target + +Now, change the default target to the **multi-user.target** so that it will always boot into the **multi-user.target** for a console command-line interface rather than a GUI desktop interface. As the root user on your test host, change to the directory where the systemd configuration is maintained and do a quick listing: + + +``` +[root@testvm1 ~]# cd /etc/systemd/system/ ; ll +drwxr-xr-x. 2 root root 4096 Apr 25  2018  basic.target.wants +<snip> +lrwxrwxrwx. 1 root root   36 Aug 13 16:23  default.target -> /lib/systemd/system/graphical.target +lrwxrwxrwx. 1 root root   39 Apr 25  2018  display-manager.service -> /usr/lib/systemd/system/lightdm.service +drwxr-xr-x. 2 root root 4096 Apr 25  2018  getty.target.wants +drwxr-xr-x. 2 root root 4096 Aug 18 10:16  graphical.target.wants +drwxr-xr-x. 2 root root 4096 Apr 25  2018  local-fs.target.wants +drwxr-xr-x. 2 root root 4096 Oct 30 16:54  multi-user.target.wants +<snip> +[root@testvm1 system]# +``` + +I shortened this listing to highlight a few important things that will help explain how systemd manages the boot process. You should be able to see the entire list of directories and links on your virtual machine. + +The **default.target** entry is a symbolic link (symlink, soft link) to the directory **/lib/systemd/system/graphical.target**. List that directory to see what else is there: + + +``` +`[root@testvm1 system]# ll /lib/systemd/system/ | less` +``` + +You should see files, directories, and more links in this listing, but look specifically for **multi-user.target** and **graphical.target**. Now display the contents of **default.target**, which is a link to **/lib/systemd/system/graphical.target**: + + +``` +[root@testvm1 system]# cat default.target +#  SPDX-License-Identifier: LGPL-2.1+ +# +#  This file is part of systemd. +# +#  systemd is free software; you can redistribute it and/or modify it +#  under the terms of the GNU Lesser General Public License as published by +#  the Free Software Foundation; either version 2.1 of the License, or +#  (at your option) any later version. + +[Unit] +Description=Graphical Interface +Documentation=man:systemd.special(7) +Requires=multi-user.target +Wants=display-manager.service +Conflicts=rescue.service rescue.target +After=multi-user.target rescue.service rescue.target display-manager.service +AllowIsolate=yes +[root@testvm1 system]# +``` + +This link to the **graphical.target** file describes all of the prerequisites and requirements that the graphical user interface requires. I will explore at least some of these options in the next article in this series. + +To enable the host to boot to multi-user mode, you need to delete the existing link and create a new one that points to the correct target. Make the [PWD][5] **/etc/systemd/system**, if it is not already: + + +``` +[root@testvm1 system]# rm -f default.target +[root@testvm1 system]# ln -s /lib/systemd/system/multi-user.target default.target +``` + +List the **default.target** link to verify that it links to the correct file: + + +``` +[root@testvm1 system]# ll default.target +lrwxrwxrwx 1 root root 37 Nov 28 16:08 default.target -> /lib/systemd/system/multi-user.target +[root@testvm1 system]# +``` + +If your link does not look exactly like this, delete it and try again. List the content of the **default.target** link: + + +``` +[root@testvm1 system]# cat default.target +#  SPDX-License-Identifier: LGPL-2.1+ +# +#  This file is part of systemd. +# +#  systemd is free software; you can redistribute it and/or modify it +#  under the terms of the GNU Lesser General Public License as published by +#  the Free Software Foundation; either version 2.1 of the License, or +#  (at your option) any later version. + +[Unit] +Description=Multi-User System +Documentation=man:systemd.special(7) +Requires=basic.target +Conflicts=rescue.service rescue.target +After=basic.target rescue.service rescue.target +AllowIsolate=yes +[root@testvm1 system]# +``` + +The **default.target**—which is really a link to the **multi-user.target** at this point—now has different requirements in the **[Unit]** section. It does not require the graphical display manager. + +Reboot. Your virtual machine should boot to the console login for virtual console 1, which is identified on the display as tty1. Now that you know how to change the default target, change it back to the **graphical.target** using a command designed for the purpose. + +First, check the current default target: + + +``` +[root@testvm1 ~]# systemctl get-default +multi-user.target +[root@testvm1 ~]# systemctl set-default graphical.target +Removed /etc/systemd/system/default.target. +Created symlink /etc/systemd/system/default.target → /usr/lib/systemd/system/graphical.target. +[root@testvm1 ~]# +``` + +Enter the following command to go directly to the **graphical.target** and the display manager login page without having to reboot: + + +``` +`[root@testvm1 system]# systemctl isolate default.target` +``` + +I do not know why the term "isolate" was chosen for this sub-command by systemd's developers. My research indicates that it may refer to running the specified target but "isolating" and terminating all other targets that are not required to support the target. However, the effect is to switch targets from one run target to another—in this case, from the multi-user target to the graphical target. The command above is equivalent to the old init 5 command in SystemV start scripts and the init program. + +Log into the GUI desktop, and verify that it is working as it should. + +### Summing up + +This article explored the Linux systemd startup sequence and started to explore two important systemd tools, **systemctl** and **journalctl**. It also explained how to switch from one target to another and to change the default target. + +The next article in this series will create a new systemd unit and configure it to run during startup. It will also look at some of the configuration options that help determine where in the sequence a particular unit will start, for example, after networking is up and running. + +### Resources + +There is a great deal of information about systemd available on the internet, but much is terse, obtuse, or even misleading. In addition to the resources mentioned in this article, the following webpages offer more detailed and reliable information about systemd startup. + + * The Fedora Project has a good, practical [guide][6] [to systemd][6]. It has pretty much everything you need to know in order to configure, manage, and maintain a Fedora computer using systemd. + * The Fedora Project also has a good [cheat sheet][7] that cross-references the old SystemV commands to comparable systemd ones. + * For detailed technical information about systemd and the reasons for creating it, check out [Freedesktop.org][8]'s [description of systemd][9]. + * [Linux.com][10]'s "More systemd fun" offers more advanced systemd [information and tips][11]. + + + +There is also a series of deeply technical articles for Linux sysadmins by Lennart Poettering, the designer and primary developer of systemd. These articles were written between April 2010 and September 2011, but they are just as relevant now as they were then. Much of everything else good that has been written about systemd and its ecosystem is based on these papers. + + * [Rethinking PID 1][12] + * [systemd for Administrators, Part I][13] + * [systemd for Administrators, Part II][14] + * [systemd for Administrators, Part III][15] + * [systemd for Administrators, Part IV][16] + * [systemd for Administrators, Part V][17] + * [systemd for Administrators, Part VI][18] + * [systemd for Administrators, Part VII][19] + * [systemd for Administrators, Part VIII][20] + * [systemd for Administrators, Part IX][21] + * [systemd for Administrators, Part X][22] + * [systemd for Administrators, Part XI][23] + + + +Alison Chiaken, a Linux kernel and systems programmer at Mentor Graphics, offers a preview of her... + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/5/systemd-startup + +作者:[David Both][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/dboth +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/start_line.jpg?itok=9reaaW6m (People at the start line of a race) +[2]: https://opensource.com/article/20/4/systemd +[3]: http://www.gnu.org/software/grub/manual/grub +[4]: mailto:mockbuild@bkernel03.phx2.fedoraproject.org +[5]: https://en.wikipedia.org/wiki/Pwd +[6]: https://docs.fedoraproject.org/en-US/quick-docs/understanding-and-administering-systemd/index.html +[7]: https://fedoraproject.org/wiki/SysVinit_to_Systemd_Cheatsheet +[8]: http://Freedesktop.org +[9]: http://www.freedesktop.org/wiki/Software/systemd +[10]: http://Linux.com +[11]: https://www.linux.com/training-tutorials/more-systemd-fun-blame-game-and-stopping-services-prejudice/ +[12]: http://0pointer.de/blog/projects/systemd.html +[13]: http://0pointer.de/blog/projects/systemd-for-admins-1.html +[14]: http://0pointer.de/blog/projects/systemd-for-admins-2.html +[15]: http://0pointer.de/blog/projects/systemd-for-admins-3.html +[16]: http://0pointer.de/blog/projects/systemd-for-admins-4.html +[17]: http://0pointer.de/blog/projects/three-levels-of-off.html +[18]: http://0pointer.de/blog/projects/changing-roots +[19]: http://0pointer.de/blog/projects/blame-game.html +[20]: http://0pointer.de/blog/projects/the-new-configuration-files.html +[21]: http://0pointer.de/blog/projects/on-etc-sysinit.html +[22]: http://0pointer.de/blog/projects/instances.html +[23]: http://0pointer.de/blog/projects/inetd.html diff --git a/sources/tech/20200505 8 open source video games to play.md b/sources/tech/20200505 8 open source video games to play.md new file mode 100644 index 0000000000..ac0577d96b --- /dev/null +++ b/sources/tech/20200505 8 open source video games to play.md @@ -0,0 +1,116 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (8 open source video games to play) +[#]: via: (https://opensource.com/article/20/5/open-source-fps-games) +[#]: author: (Aman Gaur https://opensource.com/users/amangaur) + +8 open source video games to play +====== +These games are fun and free to play, a way to connect with friends, and +an opportunity to make an old favorite even better. +![Gaming on a grid with penguin pawns][1] + +Video games are a big business. That's great for the industry's longevity—not to mention for all the people working in programming and graphics. But it can take a lot of work, time, and money to keep up with all the latest gaming crazes. If you feel like playing a few quick rounds of a video game without investing in a new console or game franchise, then you'll be happy to know that there are plenty of open source combat games you can download, play, share, and even modify (if you're inclined to programming) for free. + +First-person shooters (FPS) are one of the most popular categories of video games. They are centered around the perspective of the protagonist (the player), and they often offer weapon-based advancement. As you get better at the game, you survive longer, you get better weapons, and you increase your power. FPS games have a distinct look and feel, which is reflected in the category's name: players see everything—their weapons and the game world—in first person, as if they're looking through their player character's eyes. + +If you want to give one a try, check out the following eight great open source FPS games. + +### Xonotic + +![Xonotic][2] + +[Xonotic][3] is a fast-paced, arena-based FPS game. It is a popular game in the open source world. One reason could be the fact that it has never been a mainstream game. It offers a variety of weapons and enemies that are thrown right at you mercilessly from the start. Demanding quick action and response, it is an experience that will keep you on the edge of your seats. The game is available under the GPLv3+ license. + +### Wolfenstein Enemy Territory + +![Wolfenstein Enemy Territory][4] + +Wolfenstein has been a major franchise in gaming for many years. If you are a fan of gore and glory, then you've probably already heard of this game (if not, you'll love it once you try it). [Wolfenstein Enemy Territory][5] is an early iteration of the popular World War II game. It became free to play in 2003, and its [source code][6] is provided under the GPLv3. To play, however, you must own the game data (or recreate it yourself) separately (which remains under its original EULA). + +### Doom + +![Doom][7] + +[Doom][8] is a wildly popular game that was also an early example of games on Linux—way back in 2004. There are many iterations of the game, many of which have been released as open source. The game is about acquiring a teleportation device that's been captured by demons, so the violence, while gory, is low on realism. The source code for the game was provided under the GPL, but many versions require that you own the game for the game assets. There are dozens of ports and adaptations, including [Freedoom][9] (with free assets), [Dhewm3][10], [RBDoom-3-BFG][11], and many more. Try a few and pick your favorite! + +### Smokin' Guns + +![Smokin' Guns][12] + +If you're a fan of the Old West and six-shooters, this FPS is for you. From cowboys to gunslingers and with a captivating background score, [Smokin' Guns][13] has it all. It's a semi-realistic simulation of the old spaghetti western. On your way through the game, you face multiple enemies and get multiple weapons, so there's always the promise of excitement and danger around the corner. The game is free and open source under the terms of the GPLv2. + +### Nexuiz + +![Nexuiz][14] + +[Nexuiz][15] (classic) is another great FPS that's free to play on multiple platforms. The game is based on the Quake engine and has been made open source under the GNU GPLv2. The game offers multiple modes, including online, LAN party, and bot training. The game features sophisticated weapons and fast action. It's brutal and exciting, with an objective: kill as many opponents as possible before they get you. + +Note that the open source version of Nexuiz is not the same as the version built on CryEngine3 that is sold on Steam. + +### .kkrieger + +![kkrieger][16] + +[.Kkrieger][17] was developed in 2004 by .theprodukkt, a German demogroup. The game was developed using an unreleased (at the time) engine known as Werkkzeug. This game might feel a little slow to many, but it still offers an intense experience. The approaching enemies are slow, but their sheer number makes it confusing to know which one to take down first. It's an onslaught, and you have to shoot through layers of enemies before you reach the final boss. It was released in a rather raw form on [GitHub][18] by its creators under a BSD license with some public domain components. + +### Warsow + +![Warsow][19] + +If you've ever played Borderlands 2, then imagine [Warsow][20] as an arena-style Borderlands. The game is built on a modernized Quake II engine, and its plot takes a simple approach: Kill as many opponents as possible. The team with the most number of kills wins. Despite its simplicity, it features amazing weaponry and lots of great trick moves, like circle jumping, bunny hopping, double jumping, ramp sliding, and so on. It makes for an engaging multiplayer session, and it's been recognized by multiple online leagues as a worthy game for their competitions. Get the source code from [GitHub][21] or install the game from your software repository. + +### World of Padman + +![World of Padman][22] + +[The World of Padman][23] may be the last game on this list, but it's one of the most unique. Designed by PadWorld Entertainment, World of Padman takes a different twist graphically and introduces you to quirky and whimsical characters in a colorful (albeit cartoonishly violent) world. It's based on the ioquake3 engine, and its unique style and uproarious gameplay have earned it a featured place in multiple gaming magazines. You can download the source code from [GitHub][24]. + +### Give one a shot + +A game that becomes open source can act as a template for something great, whether it's a wholly open source version of an old classic, a remix of a beloved game, or an entirely new platform built on an old reliable engine. + +Open source gaming is important for many reasons: it provides users with a fun diversion, a way to connect with friends, and an opportunity for programmers and designers to hack within an existing framework. If titles like Doom weren't made open source, a little bit of video game history would be lost. Instead, it endures and has the opportunity to grow even more. + +Try an open source game, and watch your six. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/5/open-source-fps-games + +作者:[Aman Gaur][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/amangaur +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/game_pawn_grid_linux.png?itok=4gERzRkg (Gaming on a grid with penguin pawns) +[2]: https://opensource.com/sites/default/files/uploads/xonotic.jpg (Xonotic) +[3]: https://www.xonotic.org/download/ +[4]: https://opensource.com/sites/default/files/uploads/wolfensteinenemyterritory.jpg (Wolfenstein Enemy Territory) +[5]: https://www.splashdamage.com/games/wolfenstein-enemy-territory/ +[6]: https://github.com/id-Software/Enemy-Territory +[7]: https://opensource.com/sites/default/files/uploads/doom.jpg (Doom) +[8]: https://github.com/id-Software/DOOM +[9]: https://freedoom.github.io/ +[10]: https://dhewm3.org/ +[11]: https://github.com/RobertBeckebans/RBDOOM-3-BFG/ +[12]: https://opensource.com/sites/default/files/uploads/smokinguns.jpg (Smokin' Guns) +[13]: https://www.smokin-guns.org/downloads +[14]: https://opensource.com/sites/default/files/uploads/nexuiz.jpg (Nexuiz) +[15]: https://sourceforge.net/projects/nexuiz/ +[16]: https://opensource.com/sites/default/files/uploads/kkrieger.jpg (kkrieger) +[17]: https://web.archive.org/web/20120204065621/http://www.theprodukkt.com/kkrieger +[18]: https://github.com/farbrausch/fr_public +[19]: https://opensource.com/sites/default/files/uploads/warsow.jpg (Warsow) +[20]: https://www.warsow.net/download +[21]: https://github.com/Warsow +[22]: https://opensource.com/sites/default/files/uploads/padman.jpg (World of Padman) +[23]: https://worldofpadman.net/en/ +[24]: https://github.com/PadWorld-Entertainment diff --git a/sources/tech/20200505 Analyzing data science code with R and Emacs.md b/sources/tech/20200505 Analyzing data science code with R and Emacs.md new file mode 100644 index 0000000000..ebcfadbe92 --- /dev/null +++ b/sources/tech/20200505 Analyzing data science code with R and Emacs.md @@ -0,0 +1,133 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Analyzing data science code with R and Emacs) +[#]: via: (https://opensource.com/article/20/5/r-emacs-data-science) +[#]: author: (Peter Prevos https://opensource.com/users/danderzei) + +Analyzing data science code with R and Emacs +====== +Emacs' versatility and extensibility bring the editor's full power into +play for writing data science code. +![metrics and data shown on a computer screen][1] + +Way back in 2012, _Harvard Business Review_ published an article that proclaimed "data scientist" to be the [sexiest job][2] of the 21st century. Interest in data science has exploded since then. Many great open source projects, such as [Python][3] and the [R language][4] for statistical computing, have facilitated the rapid developments in how we analyze data. + +I started my career using pencil and paper and moved to spreadsheets. Now the R language is my weapon of choice when I need to create value from data. Emacs is another one of my favorite tools. This article briefly explains how to use the [Emacs Speaks Statistics][5] (ESS) package to get started with developing R projects in this venerable editor. + +The vast majority of R developers use the [RStudio][6] IDE to manage their projects. RStudio is a powerful open source editor with specialized functionality to develop data science projects. RStudio is a great integrated development environment (IDE), but its editing functions are limited. + +Using Emacs to write data science code means that you have access to the full power of this extensible editor. I prefer using Emacs for my data science projects because I can do many other tasks within the same application, leveraging the multifunctionality of this venerable editor. If you are just getting started with Emacs, then please first read Seth Kenlon's [Emacs getting started][7] article. + +### Setting up Emacs for R + +Emacs is an almost infinitely extensible text editor, which unfortunately means that many things don't work the way you want them to out of the box. Before you can write and execute R scripts, you need to install some packages and configure them. The ESS package provides an interface between Emacs and R. Other packages, such as [Company][8] and [highlight-parentheses][9] help with completion and balancing parentheses. + +Emacs uses a version of Lisp for configuration. The lines of [Emacs Lisp][10] code below install the required extensions and define a minimal configuration to get you started. These lines were tested for GNU Emacs version 26.3. + +Copy these lines and save them in a file named **init.el** in your **.emacs.d** folder. This is the folder that Emacs uses to store configurations, including the [init file][11]. If you already have an init file, then you can append these lines to your config. This minimal configuration is enough to get you started. + + +``` +;; Elisp file for R coding with Emacs + +;; Add MELPA repository and initialise the package manager +(require 'package) +(add-to-list 'package-archives +             '("melpa" . "")) +(package-initialize) + +;; Install use-package,in case it does not exist yet +;; The use-package software will install all other packages as required +(unless (package-installed-p 'use-package) +  (package-refresh-contents) +  (package-install 'use-package)) + +;; ESS configurationEmacs Speaks Statistics +(use-package ess +  :ensure t +) + +;; Auto completion +(use-package company +  :ensure t +  :config +  (setq company-idle-delay 0) +  (setq company-minimum-prefix-length 2) +  (global-company-mode t) +) + +; Parentheses +(use-package highlight-parentheses +  :ensure t +  :config +  (progn +    (highlight-parentheses-mode) +    (global-highlight-parentheses-mode)) +  ) +``` + +### Using the R console + +To start an R console session, press **M-x R** and hit **Enter** (**M** is the Emacs way to denote the **Alt** or **Command** key). ESS will ask you to nominate a working directory, which defaults to the folder of the current buffer. You can use more than one console in the same Emacs session by repeating the R command. + +Emacs opens a new buffer for your new R console. You can also use the **Up** and **Down** arrow keys to go to previous lines and re-run them. Use the **Ctrl** and **Up/Down** arrow keys to recycle old commands. + +The Company ("complete anything") package manages autocompletion in both the console and R scripts. When entering a function, the mini-buffer at the bottom of the screen shows the relevant parameters. When the autocompletion dropdown menu appears, you can press **F1** to view the chosen option's Help file before you select it. + +The [highlight-parentheses][9] package does what its name suggests. Several other Emacs packages are available to help you balance parentheses and other structural elements in your code. + +### Writing R scripts + +Emacs recognizes R mode for any buffer with a **.R** extension (the file extension is case-sensitive). Open or create a new file with the **C-x C-f** shortcut and type the path and file name. You can start writing your code and use all of the powerful editing techniques that Emacs provides. + +Several functions are available to evaluate the code. You can evaluate each line separately with **C-<return>**, while **C-c C-c** will evaluate a contiguous region. Keying **C-c C-b** will evaluate the whole buffer. + +When you evaluate some code, Emacs will use any running console or ask you to open a new console to run the code. + +The output of any plotting functions appears in a window outside of Emacs. If you prefer to view the output within Emacs, then you need to save the output to disk and open the resulting file in a separate buffer. + +![Literate programming in Org mode, the ESS buffer, and graphics output.][12] + +Literate programming in Org mode, the ESS buffer, and graphics output. + +### Advanced use + +This article provides a brief introduction to using R in Emacs. Many parameters can be fine-tuned to make Emacs behave according to your preferences, but it would take too much space to cover them here. The [ESS manual][13] describes these in detail. You can also extend functionality with additional packages. + +Org mode can integrate R code, providing a productive platform for literate programming. If you prefer to use RMarkdown, the [Polymode][14] package has you covered. + +Emacs has various packages to make your editing experience more efficient. The best part of using Emacs to write R code is that the program is more than just an IDE; it is a malleable computer system that you can configure to match your favorite workflow. + +Learning how to configure Emacs can be daunting. The best way to learn quickly is to copy ideas from people who share their configurations. Miles McBain manages a [list of Emacs configurations][15] that could be useful if you want to explore using the R language in Emacs further. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/5/r-emacs-data-science + +作者:[Peter Prevos][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/danderzei +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/metrics_data_dashboard_system_computer_analytics.png?itok=oxAeIEI- (metrics and data shown on a computer screen) +[2]: https://hbr.org/2012/10/data-scientist-the-sexiest-job-of-the-21st-century +[3]: https://www.python.org/ +[4]: https://www.r-project.org/ +[5]: https://ess.r-project.org/ +[6]: https://opensource.com/article/18/2/getting-started-RStudio-IDE +[7]: https://opensource.com/article/20/3/getting-started-emacs +[8]: https://company-mode.github.io/ +[9]: https://github.com/tsdh/highlight-parentheses.el +[10]: https://en.wikipedia.org/wiki/Emacs_Lisp +[11]: https://www.gnu.org/software/emacs/manual/html_node/emacs/Init-File.html +[12]: https://opensource.com/sites/default/files/uploads/r-ess-screenshot.jpg (Literate programming in Org mode, the ESS buffer, and graphics output.) +[13]: https://ess.r-project.org/index.php?Section=documentation&subSection=manuals +[14]: https://github.com/polymode/polymode +[15]: https://github.com/MilesMcBain/esscss diff --git a/sources/tech/20200507 Using the systemctl command to manage systemd units.md b/sources/tech/20200507 Using the systemctl command to manage systemd units.md new file mode 100644 index 0000000000..e305cee36c --- /dev/null +++ b/sources/tech/20200507 Using the systemctl command to manage systemd units.md @@ -0,0 +1,618 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Using the systemctl command to manage systemd units) +[#]: via: (https://opensource.com/article/20/5/systemd-units) +[#]: author: (David Both https://opensource.com/users/dboth) + +Using the systemctl command to manage systemd units +====== +Units are the basis of everything in systemd. +![woman on laptop sitting at the window][1] + +In the first two articles in this series, I explored the Linux systemd startup sequence. In the [first article][2], I looked at systemd's functions and architecture and the controversy around its role as a replacement for the old SystemV init program and startup scripts. And in the [second article][3], I examined two important systemd tools, systemctl and journalctl, and explained how to switch from one target to another and to change the default target. + +In this third article, I'll look at systemd units in more detail and how to use the systemctl command to explore and manage units. I'll also explain how to stop and disable units and how to create a new systemd mount unit to mount a new filesystem and enable it to initiate during startup. + +### Preparation + +All of the experiments in this article should be done as the root user (unless otherwise specified). Some of the commands that simply list various systemd units can be performed by non-root users, but the commands that make changes cannot. Make sure to do all of these experiments only on non-production hosts or virtual machines (VMs). + +One of these experiments requires the sysstat package, so install it before you move on. For Fedora and other Red Hat-based distributions you can install sysstat with: + + +``` +`dnf -y install sysstat` +``` + +The sysstat RPM installs several statistical tools that can be used for problem determination. One is [System Activity Report][4] (SAR), which records many system performance data points at regular intervals (every 10 minutes by default). Rather than run as a daemon in the background, the sysstat package installs two systemd timers. One timer runs every 10 minutes to collect data, and the other runs once a day to aggregate the daily data. In this article, I will look briefly at these timers but wait to explain how to create a timer in a future article. + +### systemd suite + +The fact is, systemd is more than just one program. It is a large suite of programs all designed to work together to manage nearly every aspect of a running Linux system. A full exposition of systemd would take a book on its own. Most of us do not need to understand all of the details about how all of systemd's components fit together, so I will focus on the programs and components that enable you to manage various Linux services and deal with log files and journals. + +### Practical structure + +The structure of systemd—outside of its executable files—is contained in its many configuration files. Although these files have different names and identifier extensions, they are all called "unit" files. Units are the basis of everything systemd. + +Unit files are ASCII plain-text files that are accessible to and can be created or modified by a sysadmin. There are a number of unit file types, and each has its own man page. Figure 1 lists some of these unit file types by their filename extensions and a short description of each. + +systemd unit | Description +---|--- +.automount | The **.automount** units are used to implement on-demand (i.e., plug and play) and mounting of filesystem units in parallel during startup. +.device | The **.device** unit files define hardware and virtual devices that are exposed to the sysadmin in the **/dev/directory**. Not all devices have unit files; typically, block devices such as hard drives, network devices, and some others have unit files. +.mount | The **.mount** unit defines a mount point on the Linux filesystem directory structure. +.scope | The **.scope** unit defines and manages a set of system processes. This unit is not configured using unit files, rather it is created programmatically. Per the **systemd.scope** man page, “The main purpose of scope units is grouping worker processes of a system service for organization and for managing resources.” +.service | The **.service** unit files define processes that are managed by systemd. These include services such as crond cups (Common Unix Printing System), iptables, multiple logical volume management (LVM) services, NetworkManager, and more. +.slice | The **.slice** unit defines a “slice,” which is a conceptual division of system resources that are related to a group of processes. You can think of all system resources as a pie and this subset of resources as a “slice” out of that pie. +.socket | The **.socket** units define interprocess communication sockets, such as network sockets. +.swap | The **.swap** units define swap devices or files. +.target | The **.target** units define groups of unit files that define startup synchronization points, runlevels, and services. Target units define the services and other units that must be active in order to start successfully. +.timer | The **.timer** unit defines timers that can initiate program execution at specified times. + +### systemctl + +I looked at systemd's startup functions in the [second article][3], and here I'll explore its service management functions a bit further. systemd provides the **systemctl** command that is used to start and stop services, configure them to launch (or not) at system startup, and monitor the current status of running services. + +In a terminal session as the root user, ensure that root's home directory ( **~** ) is the [PWD][5]. To begin looking at units in various ways, list all of the loaded and active systemd units. systemctl automatically pipes its [stdout][6] data stream through the **less** pager, so you don't have to: + + +``` +[root@testvm1 ~]# systemctl +UNIT                                       LOAD   ACTIVE SUB       DESCRIPTION               +proc-sys-fs-binfmt_misc.automount          loaded active running   Arbitrary Executable File> +sys-devices-pci0000:00-0000:00:01.1-ata7-host6-target6:0:0-6:0:0:0-block-sr0.device loaded a> +sys-devices-pci0000:00-0000:00:03.0-net-enp0s3.device loaded active plugged   82540EM Gigabi> +sys-devices-pci0000:00-0000:00:05.0-sound-card0.device loaded active plugged   82801AA AC'97> +sys-devices-pci0000:00-0000:00:08.0-net-enp0s8.device loaded active plugged   82540EM Gigabi> +sys-devices-pci0000:00-0000:00:0d.0-ata1-host0-target0:0:0-0:0:0:0-block-sda-sda1.device loa> +sys-devices-pci0000:00-0000:00:0d.0-ata1-host0-target0:0:0-0:0:0:0-block-sda-sda2.device loa> +<snip – removed lots of lines of data from here> + +LOAD   = Reflects whether the unit definition was properly loaded. +ACTIVE = The high-level unit activation state, i.e. generalization of SUB. +SUB    = The low-level unit activation state, values depend on unit type. + +206 loaded units listed. Pass --all to see loaded but inactive units, too. +To show all installed unit files use 'systemctl list-unit-files'. +``` + +As you scroll through the data in your terminal session, look for some specific things. The first section lists devices such as hard drives, sound cards, network interface cards, and TTY devices. Another section shows the filesystem mount points. Other sections include various services and a list of all loaded and active targets. + +The sysstat timers at the bottom of the output are used to collect and generate daily system activity summaries for SAR. SAR is a very useful problem-solving tool. (You can learn more about it in Chapter 13 of my book [_Using and Administering Linux: Volume 1, Zero to SysAdmin: Getting Started_][7].) + +Near the very bottom, three lines describe the meanings of the statuses (loaded, active, and sub). Press **q** to exit the pager. + +Use the following command (as suggested in the last line of the output above) to see all the units that are installed, whether or not they are loaded. I won't reproduce the output here, because you can scroll through it on your own. The systemctl program has an excellent tab-completion facility that makes it easy to enter complex commands without needing to memorize all the options: + + +``` +`[root@testvm1 ~]# systemctl list-unit-files` +``` + +You can see that some units are disabled. Table 1 in the man page for systemctl lists and provides short descriptions of the entries you might see in this listing. Use the **-t** (type) option to view just the timer units: + + +``` +[root@testvm1 ~]# systemctl list-unit-files -t timer +UNIT FILE                    STATE   +[chrony-dnssrv@.timer][8]         disabled +dnf-makecache.timer          enabled +fstrim.timer                 disabled +logrotate.timer              disabled +logwatch.timer               disabled +[mdadm-last-resort@.timer][9]     static   +mlocate-updatedb.timer       enabled +sysstat-collect.timer        enabled +sysstat-summary.timer        enabled +systemd-tmpfiles-clean.timer static   +unbound-anchor.timer         enabled +``` + +You could do the same thing with this alternative, which provides considerably more detail: + + +``` +[root@testvm1 ~]# systemctl list-timers +Thu 2020-04-16 09:06:20 EDT  3min 59s left n/a                          n/a           systemd-tmpfiles-clean.timer systemd-tmpfiles-clean.service +Thu 2020-04-16 10:02:01 EDT  59min left    Thu 2020-04-16 09:01:32 EDT  49s ago       dnf-makecache.timer          dnf-makecache.service +Thu 2020-04-16 13:00:00 EDT  3h 57min left n/a                          n/a           sysstat-collect.timer        sysstat-collect.service +Fri 2020-04-17 00:00:00 EDT  14h left      Thu 2020-04-16 12:51:37 EDT  3h 49min left mlocate-updatedb.timer       mlocate-updatedb.service +Fri 2020-04-17 00:00:00 EDT  14h left      Thu 2020-04-16 12:51:37 EDT  3h 49min left unbound-anchor.timer         unbound-anchor.service +Fri 2020-04-17 00:07:00 EDT  15h left      n/a                          n/a           sysstat-summary.timer        sysstat-summary.service + +6 timers listed. +Pass --all to see loaded but inactive timers, too. +[root@testvm1 ~]# +``` + +Although there is no option to do systemctl list-mounts, you can list the mount point unit files: + + +``` +[root@testvm1 ~]# systemctl list-unit-files -t mount +UNIT FILE                     STATE     +-.mount                       generated +boot.mount                    generated +dev-hugepages.mount           static   +dev-mqueue.mount              static   +home.mount                    generated +proc-fs-nfsd.mount            static   +proc-sys-fs-binfmt_misc.mount disabled +run-vmblock\x2dfuse.mount     disabled +sys-fs-fuse-connections.mount static   +sys-kernel-config.mount       static   +sys-kernel-debug.mount        static   +tmp.mount                     generated +usr.mount                     generated +var-lib-nfs-rpc_pipefs.mount  static   +var.mount                     generated + +15 unit files listed. +[root@testvm1 ~]# +``` + +The STATE column in this data stream is interesting and requires a bit of explanation. The "generated" states indicate that the mount unit was generated on the fly during startup using the information in **/etc/fstab**. The program that generates these mount units is **/lib/systemd/system-generators/systemd-fstab-generator,** along with other tools that generate a number of other unit types. The "static" mount units are for filesystems like **/proc** and **/sys**, and the files for these are located in the **/usr/lib/systemd/system** directory. + +Now, look at the service units. This command will show all services installed on the host, whether or not they are active: + + +``` +`[root@testvm1 ~]# systemctl --all -t service` +``` + +The bottom of this listing of service units displays 166 as the total number of loaded units on my host. Your number will probably differ. + +Unit files do not have a filename extension (such as **.unit**) to help identify them, so you can generalize that most configuration files that belong to systemd are unit files of one type or another. The few remaining files are mostly **.conf** files located in **/etc/systemd**. + +Unit files are stored in the **/usr/lib/systemd** directory and its subdirectories, while the **/etc/systemd/** directory and its subdirectories contain symbolic links to the unit files necessary to the local configuration of this host. + +To explore this, make **/etc/systemd** the PWD and list its contents. Then make **/etc/systemd/system** the PWD and list its contents, and list the contents of at least a couple of the current PWD's subdirectories. + +Take a look at the **default.target** file, which determines which runlevel target the system will boot to. In the second article in this series, I explained how to change the default target from the GUI (**graphical.target**) to the command-line only (**multi-user.target**) target. The **default.target** file on my test VM is simply a symlink to **/usr/lib/systemd/system/graphical.target**. + +Take a few minutes to examine the contents of the **/etc/systemd/system/default.target** file: + + +``` +[root@testvm1 system]# cat default.target +#  SPDX-License-Identifier: LGPL-2.1+ +# +#  This file is part of systemd. +# +#  systemd is free software; you can redistribute it and/or modify it +#  under the terms of the GNU Lesser General Public License as published by +#  the Free Software Foundation; either version 2.1 of the License, or +#  (at your option) any later version. + +[Unit] +Description=Graphical Interface +Documentation=man:systemd.special(7) +Requires=multi-user.target +Wants=display-manager.service +Conflicts=rescue.service rescue.target +After=multi-user.target rescue.service rescue.target display-manager.service +AllowIsolate=yes +``` + +Note that this requires the **multi-user.target**; the **graphical.target** cannot start if the **multi-user.target** is not already up and running. It also says it "wants" the **display-manager.service** unit. A "want" does not need to be fulfilled in order for the unit to start successfully. If the "want" cannot be fulfilled, it will be ignored by systemd, and the rest of the target will start regardless. + +The subdirectories in **/etc/systemd/system** are lists of wants for various targets. Take a few minutes to explore the files and their contents in the **/etc/systemd/system/graphical.target.wants** directory. + +The **systemd.unit** man page contains a lot of good information about unit files, their structure, the sections they can be divided into, and the options that can be used. It also lists many of the unit types, all of which have their own man pages. If you want to interpret a unit file, this would be a good place to start. + +### Service units + +A Fedora installation usually installs and enables services that particular hosts do not need for normal operation. Conversely, sometimes it doesn't include services that need to be installed, enabled, and started. Services that are not needed for the Linux host to function as desired, but which are installed and possibly running, represent a security risk and should—at minimum—be stopped and disabled and—at best—should be uninstalled. + +The systemctl command is used to manage systemd units, including services, targets, mounts, and more. Take a closer look at the list of services to identify services that will never be used: + + +``` +[root@testvm1 ~]# systemctl --all -t service +UNIT                           LOAD      ACTIVE SUB        DESCRIPTION                             +<snip> +chronyd.service                loaded    active running    NTP client/server                       +crond.service                  loaded    active running    Command Scheduler                       +cups.service                   loaded    active running    CUPS Scheduler                           +dbus-daemon.service            loaded    active running    D-Bus System Message Bus                 +<snip> +● ip6tables.service           not-found inactive dead     ip6tables.service                   +● ipset.service               not-found inactive dead     ipset.service                       +● iptables.service            not-found inactive dead     iptables.service                     +<snip> +firewalld.service              loaded    active   running  firewalld - dynamic firewall daemon +<snip> +● ntpd.service                not-found inactive dead     ntpd.service                         +● ntpdate.service             not-found inactive dead     ntpdate.service                     +pcscd.service                  loaded    active   running  PC/SC Smart Card Daemon +``` + +I have pruned out most of the output from the command to save space. The services that show "loaded active running" are obvious. The "not-found" services are ones that systemd is aware of but are not installed on the Linux host. If you want to run those services, you must install the packages that contain them. + +Note the **pcscd.service** unit. This is the PC/SC smart-card daemon. Its function is to communicate with smart-card readers. Many Linux hosts—including VMs—have no need for this reader nor the service that is loaded and taking up memory and CPU resources. You can stop this service and disable it, so it will not restart on the next boot. First, check its status: + + +``` +[root@testvm1 ~]# systemctl status pcscd.service +● pcscd.service - PC/SC Smart Card Daemon +   Loaded: loaded (/usr/lib/systemd/system/pcscd.service; indirect; vendor preset: disabled) +   Active: active (running) since Fri 2019-05-10 11:28:42 EDT; 3 days ago +     Docs: man:pcscd(8) + Main PID: 24706 (pcscd) +    Tasks: 6 (limit: 4694) +   Memory: 1.6M +   CGroup: /system.slice/pcscd.service +           └─24706 /usr/sbin/pcscd --foreground --auto-exit + +May 10 11:28:42 testvm1 systemd[1]: Started PC/SC Smart Card Daemon. +``` + +This data illustrates the additional information systemd provides versus SystemV, which only reports whether or not the service is running. Note that specifying the **.service** unit type is optional. Now stop and disable the service, then re-check its status: + + +``` +[root@testvm1 ~]# systemctl stop pcscd ; systemctl disable pcscd +Warning: Stopping pcscd.service, but it can still be activated by: +  pcscd.socket +Removed /etc/systemd/system/sockets.target.wants/pcscd.socket. +[root@testvm1 ~]# systemctl status pcscd +● pcscd.service - PC/SC Smart Card Daemon +   Loaded: loaded (/usr/lib/systemd/system/pcscd.service; indirect; vendor preset: disabled) +   Active: failed (Result: exit-code) since Mon 2019-05-13 15:23:15 EDT; 48s ago +     Docs: man:pcscd(8) + Main PID: 24706 (code=exited, status=1/FAILURE) + +May 10 11:28:42 testvm1 systemd[1]: Started PC/SC Smart Card Daemon. +May 13 15:23:15 testvm1 systemd[1]: Stopping PC/SC Smart Card Daemon... +May 13 15:23:15 testvm1 systemd[1]: pcscd.service: Main process exited, code=exited, status=1/FAIL> +May 13 15:23:15 testvm1 systemd[1]: pcscd.service: Failed with result 'exit-code'. +May 13 15:23:15 testvm1 systemd[1]: Stopped PC/SC Smart Card Daemon. +``` + +The short log entry display for most services prevents having to search through various log files to locate this type of information. Check the status of the system runlevel targets—specifying the "target" unit type is required: + + +``` +[root@testvm1 ~]# systemctl status multi-user.target +● multi-user.target - Multi-User System +   Loaded: loaded (/usr/lib/systemd/system/multi-user.target; static; vendor preset: disabled) +   Active: active since Thu 2019-05-09 13:27:22 EDT; 4 days ago +     Docs: man:systemd.special(7) + +May 09 13:27:22 testvm1 systemd[1]: Reached target Multi-User System. +[root@testvm1 ~]# systemctl status graphical.target +● graphical.target - Graphical Interface +   Loaded: loaded (/usr/lib/systemd/system/graphical.target; indirect; vendor preset: disabled) +   Active: active since Thu 2019-05-09 13:27:22 EDT; 4 days ago +     Docs: man:systemd.special(7) + +May 09 13:27:22 testvm1 systemd[1]: Reached target Graphical Interface. +[root@testvm1 ~]# systemctl status default.target +● graphical.target - Graphical Interface +   Loaded: loaded (/usr/lib/systemd/system/graphical.target; indirect; vendor preset: disabled) +   Active: active since Thu 2019-05-09 13:27:22 EDT; 4 days ago +     Docs: man:systemd.special(7) + +May 09 13:27:22 testvm1 systemd[1]: Reached target Graphical Interface. +``` + +The default target is the graphical target. The status of any unit can be checked in this way. + +### Mounts the old way + +A mount unit defines all of the parameters required to mount a filesystem on a designated mount point. systemd can manage mount units with more flexibility than those using the **/etc/fstab** filesystem configuration file. Despite this, systemd still uses the **/etc/fstab** file for filesystem configuration and mounting purposes. systemd uses the **systemd-fstab-generator** tool to create transient mount units from the data in the **fstab** file. + +I will create a new filesystem and a systemd mount unit to mount it. If you have some available disk space on your test system, you can do it along with me. + +_Note that the volume group and logical volume names may be different on your test system. Be sure to use the names that are pertinent to your system._ + +You will need to create a partition or logical volume, then make an EXT4 filesystem on it. Add a label to the filesystem, **TestFS**, and create a directory for a mount point **/TestFS**. + +To try this on your own, first, verify that you have free space on the volume group. Here is what that looks like on my VM where I have some space available on the volume group to create a new logical volume: + + +``` +[root@testvm1 ~]# lsblk +NAME          MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT +sda             8:0    0  120G  0 disk +├─sda1          8:1    0    4G  0 part /boot +└─sda2          8:2    0  116G  0 part +  ├─VG01-root 253:0    0    5G  0 lvm  / +  ├─VG01-swap 253:1    0    8G  0 lvm  [SWAP] +  ├─VG01-usr  253:2    0   30G  0 lvm  /usr +  ├─VG01-home 253:3    0   20G  0 lvm  /home +  ├─VG01-var  253:4    0   20G  0 lvm  /var +  └─VG01-tmp  253:5    0   10G  0 lvm  /tmp +sr0            11:0    1 1024M  0 rom   +[root@testvm1 ~]# vgs +  VG   #PV #LV #SN Attr   VSize    VFree   +  VG01   1   6   0 wz--n- <116.00g <23.00g +``` + +Then create a new volume on **VG01** named **TestFS**. It does not need to be large; 1GB is fine. Then create a filesystem, add the filesystem label, and create the mount point: + + +``` +[root@testvm1 ~]# lvcreate -L 1G -n TestFS VG01 +  Logical volume "TestFS" created. +[root@testvm1 ~]# mkfs -t ext4 /dev/mapper/VG01-TestFS +mke2fs 1.45.3 (14-Jul-2019) +Creating filesystem with 262144 4k blocks and 65536 inodes +Filesystem UUID: 8718fba9-419f-4915-ab2d-8edf811b5d23 +Superblock backups stored on blocks: +        32768, 98304, 163840, 229376 + +Allocating group tables: done                             +Writing inode tables: done                             +Creating journal (8192 blocks): done +Writing superblocks and filesystem accounting information: done + +[root@testvm1 ~]# e2label /dev/mapper/VG01-TestFS TestFS +[root@testvm1 ~]# mkdir /TestFS +``` + +Now, mount the new filesystem: + + +``` +[root@testvm1 ~]# mount /TestFS/ +mount: /TestFS/: can't find in /etc/fstab. +``` + +This will not work because you do not have an entry in **/etc/fstab**. You can mount the new filesystem even without the entry in **/etc/fstab** using both the device name (as it appears in **/dev**) and the mount point. Mounting in this manner is simpler than it used to be—it used to require the filesystem type as an argument. The mount command is now smart enough to detect the filesystem type and mount it accordingly. + +Try it again: + + +``` +[root@testvm1 ~]# mount /dev/mapper/VG01-TestFS /TestFS/ +[root@testvm1 ~]# lsblk +NAME            MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT +sda               8:0    0  120G  0 disk +├─sda1            8:1    0    4G  0 part /boot +└─sda2            8:2    0  116G  0 part +  ├─VG01-root   253:0    0    5G  0 lvm  / +  ├─VG01-swap   253:1    0    8G  0 lvm  [SWAP] +  ├─VG01-usr    253:2    0   30G  0 lvm  /usr +  ├─VG01-home   253:3    0   20G  0 lvm  /home +  ├─VG01-var    253:4    0   20G  0 lvm  /var +  ├─VG01-tmp    253:5    0   10G  0 lvm  /tmp +  └─VG01-TestFS 253:6    0    1G  0 lvm  /TestFS +sr0              11:0    1 1024M  0 rom   +[root@testvm1 ~]# +``` + +Now the new filesystem is mounted in the proper location. List the mount unit files: + + +``` +`[root@testvm1 ~]# systemctl list-unit-files -t mount` +``` + +This command does not show a file for the **/TestFS** filesystem because no file exists for it. The command **systemctl status TestFS.mount** does not display any information about the new filesystem either. You can try it using wildcards with the **systemctl status** command: + + +``` +[root@testvm1 ~]# systemctl status *mount +● usr.mount - /usr +   Loaded: loaded (/etc/fstab; generated) +   Active: active (mounted) +    Where: /usr +     What: /dev/mapper/VG01-usr +     Docs: man:fstab(5) +           man:systemd-fstab-generator(8) + +<SNIP> +● TestFS.mount - /TestFS +   Loaded: loaded (/proc/self/mountinfo) +   Active: active (mounted) since Fri 2020-04-17 16:02:26 EDT; 1min 18s ago +    Where: /TestFS +     What: /dev/mapper/VG01-TestFS + +● run-user-0.mount - /run/user/0 +   Loaded: loaded (/proc/self/mountinfo) +   Active: active (mounted) since Thu 2020-04-16 08:52:29 EDT; 1 day 5h ago +    Where: /run/user/0 +     What: tmpfs + +● var.mount - /var +   Loaded: loaded (/etc/fstab; generated) +   Active: active (mounted) since Thu 2020-04-16 12:51:34 EDT; 1 day 1h ago +    Where: /var +     What: /dev/mapper/VG01-var +     Docs: man:fstab(5) +           man:systemd-fstab-generator(8) +    Tasks: 0 (limit: 19166) +   Memory: 212.0K +      CPU: 5ms +   CGroup: /system.slice/var.mount +``` + +This command provides some very interesting information about your system's mounts, and your new filesystem shows up. The **/var** and **/usr** filesystems are identified as being generated from **/etc/fstab**, while your new filesystem simply shows that it is loaded and provides the location of the info file in the **/proc/self/mountinfo** file. + +Next, automate this mount. First, do it the old-fashioned way by adding an entry in **/etc/fstab**. Later, I'll show you how to do it the new way, which will teach you about creating units and integrating them into the startup sequence. + +Unmount **/TestFS** and add the following line to the **/etc/fstab** file: + + +``` +`/dev/mapper/VG01-TestFS  /TestFS       ext4    defaults        1 2` +``` + +Now, mount the filesystem with the simpler **mount** command and list the mount units again: + + +``` +[root@testvm1 ~]# mount /TestFS +[root@testvm1 ~]# systemctl status *mount +<SNIP> +● TestFS.mount - /TestFS +   Loaded: loaded (/proc/self/mountinfo) +   Active: active (mounted) since Fri 2020-04-17 16:26:44 EDT; 1min 14s ago +    Where: /TestFS +     What: /dev/mapper/VG01-TestFS +<SNIP> +``` + +This did not change the information for this mount because the filesystem was manually mounted. Reboot and run the command again, and this time specify **TestFS.mount** rather than using the wildcard. The results for this mount are now consistent with it being mounted at startup: + + +``` +[root@testvm1 ~]# systemctl status TestFS.mount +● TestFS.mount - /TestFS +   Loaded: loaded (/etc/fstab; generated) +   Active: active (mounted) since Fri 2020-04-17 16:30:21 EDT; 1min 38s ago +    Where: /TestFS +     What: /dev/mapper/VG01-TestFS +     Docs: man:fstab(5) +           man:systemd-fstab-generator(8) +    Tasks: 0 (limit: 19166) +   Memory: 72.0K +      CPU: 6ms +   CGroup: /system.slice/TestFS.mount + +Apr 17 16:30:21 testvm1 systemd[1]: Mounting /TestFS... +Apr 17 16:30:21 testvm1 systemd[1]: Mounted /TestFS. +``` + +### Creating a mount unit + +Mount units may be configured either with the traditional **/etc/fstab** file or with systemd units. Fedora uses the **fstab** file as it is created during the installation. However, systemd uses the **systemd-fstab-generator** program to translate the **fstab** file into systemd units for each entry in the **fstab** file. Now that you know you can use systemd **.mount** unit files for filesystem mounting, try it out by creating a mount unit for this filesystem. + +First, unmount **/TestFS**. Edit the **/etc/fstab** file and delete or comment out the **TestFS** line. Now, create a new file with the name **TestFS.mount** in the **/etc/systemd/system** directory. Edit it to contain the configuration data below. The unit file name and the name of the mount point _must_ be identical, or the mount will fail: + + +``` +# This mount unit is for the TestFS filesystem +# By David Both +# Licensed under GPL V2 +# This file should be located in the /etc/systemd/system directory + +[Unit] +Description=TestFS Mount + +[Mount] +What=/dev/mapper/VG01-TestFS +Where=/TestFS +Type=ext4 +Options=defaults + +[Install] +WantedBy=multi-user.target +``` + +The **Description** line in the **[Unit]** section is for us humans, and it provides the name that's shown when you list mount units with **systemctl -t mount**. The data in the **[Mount]** section of this file contains essentially the same data that would be found in the **fstab** file. + +Now enable the mount unit: + + +``` +[root@testvm1 etc]# systemctl enable TestFS.mount +Created symlink /etc/systemd/system/multi-user.target.wants/TestFS.mount → /etc/systemd/system/TestFS.mount. +``` + +This creates the symlink in the **/etc/systemd/system** directory, which will cause this mount unit to be mounted on all subsequent boots. The filesystem has not yet been mounted, so you must "start" it: + + +``` +`[root@testvm1 ~]# systemctl start TestFS.mount` +``` + +Verify that the filesystem has been mounted: + + +``` +[root@testvm1 ~]# systemctl status TestFS.mount +● TestFS.mount - TestFS Mount +   Loaded: loaded (/etc/systemd/system/TestFS.mount; enabled; vendor preset: disabled) +   Active: active (mounted) since Sat 2020-04-18 09:59:53 EDT; 14s ago +    Where: /TestFS +     What: /dev/mapper/VG01-TestFS +    Tasks: 0 (limit: 19166) +   Memory: 76.0K +      CPU: 3ms +   CGroup: /system.slice/TestFS.mount + +Apr 18 09:59:53 testvm1 systemd[1]: Mounting TestFS Mount... +Apr 18 09:59:53 testvm1 systemd[1]: Mounted TestFS Mount. +``` + +This experiment has been specifically about creating a unit file for a mount, but it can be applied to other types of unit files as well. The details will be different, but the concepts are the same. Yes, I know it is still easier to add a line to the **/etc/fstab** file than it is to create a mount unit. But this is a good example of how to create a unit file because systemd does not have generators for every type of unit. + +### In summary + +This article looked at systemd units in more detail and how to use the systemctl command to explore and manage units. It also showed how to stop and disable units and create a new systemd mount unit to mount a new filesystem and enable it to initiate during startup. + +In the next article in this series, I will take you through a recent problem I had during startup and show you how I circumvented it using systemd. + +### Resources + +There is a great deal of information about systemd available on the internet, but much is terse, obtuse, or even misleading. In addition to the resources mentioned in this article, the following webpages offer more detailed and reliable information about systemd startup. + + * The Fedora Project has a good, practical [guide][10] [to systemd][10]. It has pretty much everything you need to know in order to configure, manage, and maintain a Fedora computer using systemd. + * The Fedora Project also has a good [cheat sheet][11] that cross-references the old SystemV commands to comparable systemd ones. + * For detailed technical information about systemd and the reasons for creating it, check out [Freedesktop.org][12]'s [description of systemd][13]. + * [Linux.com][14]'s "More systemd fun" offers more advanced systemd [information and tips][15]. + + + +There is also a series of deeply technical articles for Linux sysadmins by Lennart Poettering, the designer and primary developer of systemd. These articles were written between April 2010 and September 2011, but they are just as relevant now as they were then. Much of everything else good that has been written about systemd and its ecosystem is based on these papers. + + * [Rethinking PID 1][16] + * [systemd for Administrators, Part I][17] + * [systemd for Administrators, Part II][18] + * [systemd for Administrators, Part III][19] + * [systemd for Administrators, Part IV][20] + * [systemd for Administrators, Part V][21] + * [systemd for Administrators, Part VI][22] + * [systemd for Administrators, Part VII][23] + * [systemd for Administrators, Part VIII][24] + * [systemd for Administrators, Part IX][25] + * [systemd for Administrators, Part X][26] + * [systemd for Administrators, Part XI][27] + + + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/5/systemd-units + +作者:[David Both][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/dboth +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/lenovo-thinkpad-laptop-window-focus.png?itok=g0xPm2kD (young woman working on a laptop) +[2]: https://opensource.com/article/20/4/systemd +[3]: https://opensource.com/article/20/4/systemd-startup +[4]: https://en.wikipedia.org/wiki/Sar_%28Unix%29 +[5]: https://en.wikipedia.org/wiki/Pwd +[6]: https://en.wikipedia.org/wiki/Standard_streams#Standard_output_(stdout) +[7]: http://www.both.org/?page_id=1183 +[8]: mailto:chrony-dnssrv@.timer +[9]: mailto:mdadm-last-resort@.timer +[10]: https://docs.fedoraproject.org/en-US/quick-docs/understanding-and-administering-systemd/index.html +[11]: https://fedoraproject.org/wiki/SysVinit_to_Systemd_Cheatsheet +[12]: http://Freedesktop.org +[13]: http://www.freedesktop.org/wiki/Software/systemd +[14]: http://Linux.com +[15]: https://www.linux.com/training-tutorials/more-systemd-fun-blame-game-and-stopping-services-prejudice/ +[16]: http://0pointer.de/blog/projects/systemd.html +[17]: http://0pointer.de/blog/projects/systemd-for-admins-1.html +[18]: http://0pointer.de/blog/projects/systemd-for-admins-2.html +[19]: http://0pointer.de/blog/projects/systemd-for-admins-3.html +[20]: http://0pointer.de/blog/projects/systemd-for-admins-4.html +[21]: http://0pointer.de/blog/projects/three-levels-of-off.html +[22]: http://0pointer.de/blog/projects/changing-roots +[23]: http://0pointer.de/blog/projects/blame-game.html +[24]: http://0pointer.de/blog/projects/the-new-configuration-files.html +[25]: http://0pointer.de/blog/projects/on-etc-sysinit.html +[26]: http://0pointer.de/blog/projects/instances.html +[27]: http://0pointer.de/blog/projects/inetd.html diff --git a/sources/tech/20200508 A guide to setting up your Open Source Program Office (OSPO) for success.md b/sources/tech/20200508 A guide to setting up your Open Source Program Office (OSPO) for success.md new file mode 100644 index 0000000000..ea3aa01866 --- /dev/null +++ b/sources/tech/20200508 A guide to setting up your Open Source Program Office (OSPO) for success.md @@ -0,0 +1,193 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (A guide to setting up your Open Source Program Office (OSPO) for success) +[#]: via: (https://opensource.com/article/20/5/open-source-program-office) +[#]: author: (J. Manrique Lopez de la Fuente https://opensource.com/users/jsmanrique) + +A guide to setting up your Open Source Program Office (OSPO) for success +====== +Learn how to best grow and maintain your open source communities and +allies. +![community team brainstorming ideas][1] + +Companies create Open Source Program Offices (OSPO) to manage their relationship with the open source ecosystems they depend on. By understanding the company's open source ecosystem, an OSPO is able to maximize the company's return on investment and reduce the risks of consuming, contributing to, and releasing open source software. Additionally, since the company depends on its open source ecosystem, ensuring its health and sustainability shall ensure the company's health, sustainable growth, and evolution. + +### How has OSPO become vital to companies and their open source ecosystem? + +Marc Andreessen has said that "software is eating the world," and more recently, it could be said that open source is eating the software world. But how is that process happening? + +Companies get involved with open source projects in several ways. These projects comprise the company's open source ecosystem, and their relationships and interactions can be seen through Open Source Software's (OSS) inbound and outbound processes. + +From the OSS inbound point of view, companies use it to build their own solutions and their own infrastructure. OSS gets introduced because it's part of the code their technology providers use, or because their own developers add open source components to the company's information technology (IT) infrastructure. + +From the OSS outbound point of view, some companies contribute to OSS projects. That contribution could be part of the company's requirements for their solutions that need certain fixes in upstream projects. For example, Samsung contributes to certain graphics-related projects to ensure its hardware has software support once it gets into the market. In some other cases, contributing to OSS is a mechanism to retain talent by allowing the people to contribute to projects different from their daily work. + +Some companies release their own open source projects as an outbound OSS process. For companies like Red Hat or GitLab, it would be expected. But, there are increasingly more non-software companies releasing a lot of OSS, like Lyft. + +![OSS inbound and outbound processes][2] + +OSS inbound and outbound processes + +Ultimately, all of these projects involved in the inbound and outbound OSS flow are the company's OSS ecosystem. And like any living being, the company's health and sustainability depend on the ecosystem that surrounds it. + +### OSPO responsibilities + +Following the species and their ecosystem, people working in the OSPO team could be seen as the rangers in the organization's OSS ecosystem. They take care of the ecosystem and its relationship with the company, to keep everything healthy and sustainable. + +When the company consumes open source software projects, they need to be aware of licenses and compliance, to check the project's health, to ensure there are no security flaws, and, in some cases, to identify talented community members for potential hiring processes. + +When the company contributes to open source software projects, they need to be sure there are no Intellectual Property (IP) issues, to ensure the company contributions' footprint and its leadership in the projects, and sometimes, also to help talented people stay engaged with the company through their contributions. + +And when the company releases and maintains open source projects, they are responsible for ensuring community engagement and growth, for checking there are no IP issues, that the company maintains its footprint and leadership, and perhaps, to attract new talent to the company. + +Have you realized the whole set of skills required in an OSPO team? When I've asked people working in OSPO about the size of their teams, the number is around 1 to 5 people per 1,000 developers in the company. That's a small team to monitor a lot of people and their potential OSS related activity. + +### How to manage an OSPO + +With all these activities in OSPO people's minds and all the resources they need to worry about, how are they able to manage all of this? + +There are at least a couple of open source communities with valuable knowledge and resources available for them: + + * The [TODO Group][3] is "an open group of companies who want to collaborate on practices, tools, and other ways to run successful and effective open source projects and programs." For example, they have a complete set of [guides][4] with best practices for and from companies running OSPOS. + * The [CHAOSS (Community Health Analytics for Open Source Software)][5] community develops metrics, methodologies, and software for managing open source project health and sustainability. (See more on CHAOSS' active communities and working groups below). + + + +OSPO managers need to report a lot of information to the rest of the company to answer many questions related to their OSS inbound and outbound processes, i.e., Which projects are we using in our organization? What's the health of those projects? Who are the key people in those projects? Which projects are we contributing to? Which projects are we releasing? How are we dealing with community contributions? Who are the key contributors? + +### Data-driven OSPO + +As William Edwards Deming said, "Without data, you are just a person with an opinion." + +Having opinions is not a bad thing, but having opinions based on data certainly makes it easier to understand, discuss, and determine the processes best suited to your company and its goals. CHAOSS is the recommended community to look to for guidance about metrics strategies and tools. + +Recently, the CHAOSS community has released [a new set of metric definitions][6]. These metrics are only subsets of all the ones being discussed in the focus areas of each working group (WG): + + * [Common WG][7]: Defines the metrics that are used by both working groups or are important for community health, but that do not cleanly fit into one of the other existing working groups. Areas of interest include organizational affiliation, responsiveness, and geographic coverage. + * [Diversity and Inclusion WG][8]: Gathers experiences regarding diversity and inclusion in open source projects with the goal of understanding, from a qualitative and quantitative point of view, how diversity and inclusion can be measured. + * [Evolution WG][9]: Refines the metrics that inform evolution and works with software implementations. + * [Risk WG][10]: Refines the metrics that inform risk and works with software implementations. + * [Value WG][11]: Focuses on industry-standard metrics for economic value in open source. Their main goal is to publish trusted industry-standard value metrics—a kind of S&P for software development and an authoritative source for metrics significance and industry norms. + + + +On the tooling side, projects like [Augur][12], [Cregit][13], and [GrimoireLab][14] are the reference tools that report these metrics, but also many others related to OSPO activities. They are also the seed for new tools and solutions provided by the OSS community like [Cauldron.io][15], a SaaS open source solution to ease OSS ecosystem analysis. + +![CHAOSS Metrics for 15 years of Unity OSS activity. Source: cauldron.io][16] + +CHAOSS Metrics for 15 years of Unity OSS activity. Source: cauldron.io + +All these metrics and data are useless without a metrics strategy. Usually, the first approach is to try to measure as much as possible, producing overwhelming reports and dashboards full of charts and data. What is the value of that? + +Experience has shown that a very valid approach is the [Goal, Questions, Metrics (GQM)][17] strategy. But how do we put that in practice in an OSPO? + +First of all, we need to understand the company's goals when using, consuming, contributing to, or releasing and maintaining OSS projects. The usual goals are related to market positioning, required upstream features development, and talent attraction or retention. Based on these goals, we should write down related questions that can be answered with numbers, like the following: + +#### Who/how many are the core maintainers of my OSS ecosystem projects? + +![Uber OSS code core, regular, and casual contributors evolution. Source: uber.biterg.io][18] + +Uber OSS code core, regular, and casual contributors evolution. Source: uber.biterg.io + +People contribute through different mechanisms or tools (code, issues, comments, tests, etc.). Measuring the core contributors (those that have done 80% of the contributions), the regular ones (those that have done 15% of the contributions), and the casual ones (those have made 5% of the contributions) can answer questions related to participation over time, but also how people move between the different buckets. Adding affiliation information helps to identify external core contributors. + +#### Where are the contributions happening? + +![Uber OSS activity based on location. Source: uber.biterg.io][19] + +Uber OSS activity based on location. Source: uber.biterg.io + +The growth of OSS ecosystems is also related to OSS projects spread across the world. Understanding that spread helps OSPO, and the company, to manage actions that improve support for people from different countries and regions. + +#### What is the company's OSS network? + +![Uber OSS network. Source: uber.biterg.io][20] + +Uber OSS network. Source: uber.biterg.io + +The company's OSS ecosystem includes those projects that the company's people contribute to. Understanding which projects they contribute to offers insight into which technologies or OSS components are interesting to people, and which companies or organizations the company collaborates with. + +#### How is the company dealing with contributions? + +![Github Pull Requests backlog management index and time to close analysis. Source: uber.biterg.io][21] + +Github Pull Requests backlog management index and time to close analysis. Source: uber.biterg.io + +One of the goals when releasing OSS projects is to grow the community around them. Measuring how the company handles contributions to its projects from outside its boundaries helps to understand how "welcoming" it is and identifies mentors (or bottlenecks) and opportunities to lower the barrier to contribute. + +#### Consumers vs. maintainers + +Over the last months, we have been hearing that corporations are taking OSS for free without contributing back. The typical arguments are that these corporations are making millions of dollars thanks to free work, plus the issue of OSS project maintainer burnout due to users' complaints and requests for free support. + +The system is unbalanced; usually, the number of users exceeds the number of maintainers. Is that good or bad? Having users for our software is (or should be) good. But we need to manage expectations on both sides. + +From the corporation's point of view, consuming OSS without care is very, very risky. + +OSPO can play an important role in educating the company about the risks they are facing, and how to reduce them by contributing back to their OSS ecosystem. Remember, a company's overall sustainability could rely heavily on its ecosystem sustainability. + +A good strategy is to start shifting your company from being pure OSS consumers to becoming contributors to their OSS inbound projects. From just submitting issues and asking questions to help solve issues, answering questions, and even sending patches, contributing helps grow and maintain the project while giving back to the community. It doesn't happen immediately, but over time, the company will be perceived as an OSS ecosystem citizen. Eventually, some people from the company could end up helping to maintain those projects too. + +And what about money? There are plenty of ways to support the OSS ecosystem financially. Some examples: + + * Business initiatives like [Tidelift][22], or [OpenCollective][23] + * Foundations and their supporting mechanisms, like [Software Freedom Conservancy][24], or [CommunityBridge][25] from the Linux Foundation + * Self-funding programs (like [Indeed][26] and [Salesforce][27] have done) + * Emerging gig development approaches like [Github Sponsors][28] or [Patreon][29] + + + +Last but not least, companies need to avoid the "not invented here" syndrome. For some OSS projects, there might be companies providing consulting, customization, maintenance, and/or support services. Instead of taking OSS and spending time and people to self-host, self-customize, or try to bring those kinds of services in-house, it might be smarter and more efficient to hire some of those companies to do the thought work. + +As a final remark, I would like to emphasize the importance of an OSPO for a company to succeed and grow in the current market. As shepherds of the company's OSS ecosystem, they are the best people in the organization to understand how the ecosystem works and flows, and they should be empowered to manage, monitor, and make recommendations and decisions to ensure sustainability and growth. + +Does your organization have an OSPO yet? + +Six common traits of successful open source programs, and a look back at how the open source... + +Why would a company not in the business of software development create an open source program... + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/5/open-source-program-office + +作者:[J. Manrique Lopez de la Fuente][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/jsmanrique +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/meeting_discussion_brainstorm.png?itok=7_m4CC8S (community team brainstorming ideas) +[2]: https://opensource.com/sites/default/files/uploads/ospo_1.png (OSS inbound and outbound processes) +[3]: https://todogroup.org/ +[4]: https://todogroup.org/guides/ +[5]: https://chaoss.community/ +[6]: https://chaoss.community/metrics/ +[7]: https://github.com/chaoss/wg-common +[8]: https://github.com/chaoss/wg-diversity-inclusion +[9]: https://github.com/chaoss/wg-evolution +[10]: https://github.com/chaoss/wg-risk +[11]: https://github.com/chaoss/wg-value +[12]: https://github.com/chaoss/augur +[13]: https://github.com/cregit +[14]: https://chaoss.github.io/grimoirelab/ +[15]: https://cauldron.io/ +[16]: https://opensource.com/sites/default/files/uploads/ospo_2.png (CHAOSS Metrics for 15 years of Unity OSS activity. Source: cauldron.io) +[17]: https://en.wikipedia.org/wiki/GQM +[18]: https://opensource.com/sites/default/files/uploads/ospo_3.png (Uber OSS code core, regular, and casual contributors evolution. Source: uber.biterg.io) +[19]: https://opensource.com/sites/default/files/uploads/ospo_4.png (Uber OSS activity based on location. Source: uber.biterg.io) +[20]: https://opensource.com/sites/default/files/uploads/ospo_5_0.png (Uber OSS network. Source: uber.biterg.io) +[21]: https://opensource.com/sites/default/files/uploads/ospo_6.png (Github Pull Requests backlog management index and time to close analysis. Source: uber.biterg.io) +[22]: https://tidelift.com/ +[23]: https://opencollective.com/ +[24]: https://sfconservancy.org/ +[25]: https://funding.communitybridge.org/ +[26]: https://engineering.indeedblog.com/blog/2019/02/sponsoring-osi/ +[27]: https://sustain.codefund.fm/23 +[28]: https://help.github.com/en/github/supporting-the-open-source-community-with-github-sponsors +[29]: https://www.patreon.com/ diff --git a/sources/tech/20200508 Metaphors in man pages.md b/sources/tech/20200508 Metaphors in man pages.md new file mode 100644 index 0000000000..8a9ea9c3b9 --- /dev/null +++ b/sources/tech/20200508 Metaphors in man pages.md @@ -0,0 +1,182 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Metaphors in man pages) +[#]: via: (https://jvns.ca/blog/2020/05/08/metaphors-in-man-pages/) +[#]: author: (Julia Evans https://jvns.ca/) + +Metaphors in man pages +====== + +This morning I was watching a [great talk by Maggie Appleton][1] about metaphors. In the talk, she explains the difference between a “figurative metaphor” and a “cognitive metaphor”, and references this super interesting book called [Metaphors We Live By][2] which I immediately got and started reading. + +Here’s an example from “Metaphors We Live By” of a bunch of metaphors we use for ideas: + + * ideas as **food**: “_raw_ facts”, “_half-baked_ ideas”, “_swallow_ that claim”, “_spoon-feed_ our students”, “_meaty_ part of the paper”, “that idea has been _fermenting_ for years” + * ideas as **people**: “the theory of relativity _gave birth_ to an enormous number of ideas”, “whose _brainchild_ was that”, “those ideas _died off_ in the middle ages”, “cognitive psychology is in its _infancy_“ + * ideas as **products**: “we’ve _generated_ a lot of ideas this week”, “it needs to be _refined_”, “his _intellectual productivity_ has decreased in recent years” + * ideas as **commodities**: “he won’t _buy_ that”, “that’s a _worthless_ idea”, “she has _valuable_ ideas” + * ideas as **resources**: “he _ran out_ of ideas”, “let’s _pool_ our ideas”, “that idea will _go a long way_“ + * ideas as **cutting instruments**: “that’s an _incisive_ idea”, “that _cuts right to the heart_ of the matter”, “he’s _sharp_“ + * ideas as **fashions**: “that idea _went out of style_ years ago”, “marxism is _fashionable_ in western europe”, “berkeley is a center of _avant-garde_ thought”, “semiotics has become quite _chic_“ + + + +There’s a [long list of more English metaphors here][3], including many metaphors from the book. + +I was surprised that there were so many different metaphors for ideas, and that we’re using metaphors like this all the time in normal language. + +### let’s look for metaphors in man pages! + +Okay, let’s get to the point of this blog post, which is just a small fun exploration – there aren’t going to be any Deep Programming Insights here. + +I went through some of the examples of metaphors in Metaphors To Live By and grepped all the man pages on my computer for them. + +### processes as people + +This is one of the richer categories – a lot of different man pages seem to agree that processes are people, or at least alive in some way. + + * Hangup detected on controlling terminal or **death** of controlling process (`man 7 signal`) + * can access the local **agent** through the forwarded connection (`man ssh_config`) + * If the exit of the process causes a process group to become **orphaned** (`man exit`) + * If a parent process terminates, then its **“zombie” children** (if any) (`man wait`) + * … send SIGHUP to the **parent** process of the client (`man tmux`) + * Otherwise, it **“runs” to catch up** or waits (`man mplayer`) + * However, Git does not (and it should not) change tags **behind users back** (`man git-tag`) + * will **listen** forever for a connection (`man nc_openbsd`) + * this monitor scales badly with the number of files being **observed** (`man fswatch`) + * If you try to use the **birth** time of a reference file (`man file`) + * a program **died** due to a fatal signal (`man xargs`) + * protocol version in the TLS **handshake** (`man curl`) + * it will **look for** a debug object at… (`man valgrind`) + + + +### data as food + + * “Apparently some digital cameras get **indigestion** if you feed them a CF card) (`man mkfs`) + * “Send packets using **raw** ethernet frames or IP packets” (`man nmap`) + * “the above example can be thought of as a maximizing repeat that must **swallow** everything it can” (`man pcrepattern`) + * “This will allow you to **feed** newline-delimited name=value pairs to the script on’ (`man CGI`) + + + +### data as objects + + * Kill the tmux server and clients and **destroy** all sessions (`tmux`) + * Each command will produce one **block** of output on standard output. (`man tmux`) + * “HTTPS guarantees that the password will not **travel** in the clear” (`man Net::SSLeay`) + * “way to **pack** more than one certificate into an ASN.1 structure” (`man gpgsm`) + + + +### processes as machines/objects + + * “This is **fragile**, subject to change, and thus should not be relied upon” (`man ps`) + * “This is useful if you have to use **broken** DNS” (`man aria2c`) + * “This provides good safety measures, but **breaks down** when” (`man git-apply`) + * “debugfs is a debugging tool. It has **rough edges**!” (`man debugfs`) + + + +### containers + +There are LOTS of containers: directories, files, strings, caches, queues, buffers, etc. + + * can exploit that to **get out** of the chroot directory (`man chroot`) + * “The file **containing** the RFC 4648 Section 5 base64url encoded 128-bit secret key” + * “Keys must start with a lowercase character and **contain** only hyphens” + * “just specify an **empty** string” (`man valgrind`) + * “the cache is **full** and a new page that isn’t cached becomes visible” (`man zathurarc`) + * “Number of table **overflows**” (`man lnstat`) + * “likely **overflow** the buffer” (`man g++`) + + + +### resources + +There are also lots of kinds of resources: bandwidth, TCP sockets, session IDs, stack space, memory, disk space. + + * This is not recommended and **wastes** bitrate (`man bitrate`) + * corruption or **lost** data if the system crashes (`man btree`) + * you don’t want Wget to **consume** the entire available bandwidth (`man wget`) + * Larger values will be slower and cause x264 to **consume** more memory (`man mplayer`) + * the resulting file can **consume** some disk space (`man socat`) + * attempting to **reuse** SSL session-ID (`man curl`) + * This option controls stack space **reuse** (`man gcc`) + * Keep the TCP socket open between queries and **reuse** it rather than creating a new TCP socket (`man dig`) + * the maximum value will easily **eat up** three extra gigabytes or so of memory (`man valgrind`) + + + +### orientation (up, down, above, below) + + * Send the escape character to the **frontend** (`man qemu-system`) + * Note that TLS 1.3 is only supported by a subset of TLS **backends** (`man curl`) + * This option may be useful if you are **behind** a router (`man mplayer`) + * When a file that exists on the **lower** layer is renamed (`man rename`) + * Several of the socket options should be handled at **lower** levels (`man getsockopt`) + * while still performing such **higher** level functionality (`man nmap`) + * This is the same string passed **back to** the front end (`man sudo_plugin`) + * On Linux, `futimens` is a library function implemented **on top** of the `utimensat` system call (`man futimens`) + + + +### buildings + +Limits as rooms/buildings (which have floors, and ceilings, which you hit) are kind of fun: + + * the kernel places a **floor** of 32 pages on this size limit (`man execve`) + * This specifies a **ceiling** to which the process’s nice value can be raised (`man getrlimit`) + * If this limit is **hit** the search is aborted (`man gcc`) + * these libraries are used as the **foundation** for many of the libraries (`man Glib`) + + + +### money / wealth + + * This is a very **expensive** operation for large projects, so use it with caution (`man git-log`) + * Note that since this operation is very I/O **expensive** (`man git-filter-branch`) + * provides a **rich** interface for scripts to print disk layouts (`man fdisk`) + * The number of times the softirq handler function terminated per second because its **budget** was consumed (`man sar.sysstat`) + * the extra **cost** depends a lot on the application at hand (`man valgrind`) + + + +### more miscellaneous metaphors + +here are some more I found that didn’t fit into any of those categories yet. + + * when a thread is created under glibc, just one **big** lock is used for all thread setup (`man valgrind`) + * will likely **drop** the connection (`man x11vnc`) + * on all **paths** from the load to the function entry (`man gcc`) + * it is a very good idea to **wipe** filesystem signatures, data, etc. before (`man cryptsetup`) + * they will be **embedded** into the document + * the client should automatically **follow** referrals returned + * even if there exist mappings that **cover** the whole address space requested (`man mremap`) + * when a network interface **disappears** (`man systemd-resolve`) + + + +### we’re all using metaphors all the time + +I found a lot more metaphors than I expected, and most of them are just part of how I’d normally talk about a program. Interesting! + +-------------------------------------------------------------------------------- + +via: https://jvns.ca/blog/2020/05/08/metaphors-in-man-pages/ + +作者:[Julia Evans][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://jvns.ca/ +[b]: https://github.com/lujun9972 +[1]: https://www.youtube.com/watch?v=K8MF3aDg-bM&feature=youtu.be&t=14991 +[2]: https://www.goodreads.com/book/show/34459.Metaphors_We_Live_By +[3]: https://metaphor.icsi.berkeley.edu/pub/en/index.php/Category:Metaphor diff --git a/sources/tech/20200510 Open source underpins coronavirus IoT and robotics solutions.md b/sources/tech/20200510 Open source underpins coronavirus IoT and robotics solutions.md new file mode 100644 index 0000000000..5ce9ce0a1f --- /dev/null +++ b/sources/tech/20200510 Open source underpins coronavirus IoT and robotics solutions.md @@ -0,0 +1,86 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Open source underpins coronavirus IoT and robotics solutions) +[#]: via: (https://opensource.com/article/20/5/robotics-covid19) +[#]: author: (Sam Bocetta https://opensource.com/users/sambocetta) + +Open source underpins coronavirus IoT and robotics solutions +====== +From sanitization of equipment and facilities to plotting the spread of +the virus, robots are playing an active role in combating COVID-19. +![Three giant robots and a person][1] + +The tech sector is quietly having a boom during the COVID-19 pandemic. Open source developers are getting involved with many aspects of the fight against the coronavirus, [using Python to visualize its spread][2] and helping to repurpose data acquisition systems to perform contact tracing. + +However, one of the most exciting areas of current research is the use of robotics to contain the spread of the coronavirus. In the last few weeks, robots have been deployed in critical environments—particularly in hospitals and on airplanes—to help staff sterilize surfaces and objects. + +Most of these robots are produced by tech startups, who have seen an opportunity to prove the worth of their proprietary systems. Many of them, however, rely on [open source cloud and IoT tools][3] that have been developed by the open source community. + +In this article, we'll take a look at how robotics are being used to fight the disease, the IoT infrastructure that underpins these systems, and finally, the security and privacy concerns that their increased use is highlighting. + +### Robots and COVID-19 + +Around the world, robots are being deployed to help the fight against COVID-19. The most direct use of robots has been in healthcare facilities, and China has taken the lead when it comes to deploying robots in hospitals. + +For example, a field hospital that recently opened in Wuhan—where the virus originated—is [making extensive use of robots][4] to help healthcare workers care for patients. Some of these robots provide food, drink, and medicine to patients, and others are used to clean parts of the hospital. + +Other companies, such as the Texas startup Xenex Disinfection Services, are using robots and UV light to deactivate viruses, bacteria, and spores on surfaces in airports. Still others, like Dimer UVC Innovations, are focusing on making robots that can [improve aircraft hygiene][5]. + +Not all of the "robots" deployed against the disease are anthropomorphic, though. The same field hospital in Wuhan that is using human-like robots is also making extensive use of less obviously "robotic" IoT devices. + +Patients entering the hospital are screened by networked 5G thermometers to alert staff for anyone showing a high fever, and patients wear smart bracelets and rings equipped with sensors. These are synced with CloudMinds' AI platform, and patients' vital signs, including temperature, heart rate, and blood oxygen levels, can be monitored. + +### Robots and the IoT + +Even when these robots appear to be independent entities, they make [extensive use of the IoT][6]. In other words, although patients may feel that they are being cared for by a robot that can make its own decisions, in reality, these robots are controlled by large, distributed sensing and data processing systems. + +Although many of the robots being deployed are the proprietary property of the tech firms who produce their hardware, their functioning is based on an ecosystem of software that is largely open source. + +This observation is an important one because it overturns one of the primary misconceptions about the [way that AI is used today][7][,][7] whether in a healthcare setting or elsewhere. Most research into robotics today does not seek to embed fully intelligent AI systems into robots themselves but, instead, uses centralized AI systems to control a wide variety of far less "smart" IoT devices. + +This observation, in turn, highlights two key points about the robots currently being developed and used to fight COVID-19. One is that they rely on a software ecosystem—much of it open source—that has been developed in a truly collaborative process involving thousands of engineers. The second is that the networked nature of these robots makes them vulnerable to exploitation. + +### Security and privacy + +This vulnerability to cybersecurity threats has led some analysts to raise questions about the wisdom of widespread deployment of IoT-driven robotics, whether in the healthcare system or anywhere else. Spyware in the IoT [remains a huge problem][8], and some fear that by integrating IoT systems into healthcare, we may be exposing more data—and more sensitive data—to intruders. + +Even where developers are careful to build security into these devices, the sheer number of components they rely on makes DevSecOps processes difficult to implement. Especially in this current time of crisis, many software engineers have been forced to accelerate the release of new components, and this could lead to them being vulnerable. If a company is rushing to bring a healthcare robot onto the market in response to COVID-19, it's unlikely that the open source code that these devices run on will be [properly audited][9]. + +And even if companies are able to maintain the integrity of their DevSecOps processes while still accelerating development, it's far from certain that patients themselves understand the privacy implications of delegating their care to IoT devices. Many lack the open source privacy tools [necessary to keep their data private][10] when browsing the internet, let alone those that should be deployed to protect sensitive healthcare data. + +### The future + +In short, the deployment of robots in the fight against COVID-19 is highlighting long-standing concerns about the integrity, security, and privacy of IoT systems more generally. Professionals in this field have long argued that [IoT audits][11] and [embedded Linux systems][12] should be the standard for IoT development, but in the current crisis, their warnings are likely to be ignored. + +This is worrying because it's likely that IoT systems will be increasingly used in healthcare in the coming decade. So whilst the COVID-19 pandemic will provide a proof of their utility in this sector, it should also not be used as an excuse to roll out poorly secured, poorly audited IoT software in highly sensitive environments. + +Open source isn’t just changing the way we interact with the world, it’s changing the way the world... + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/5/robotics-covid19 + +作者:[Sam Bocetta][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/sambocetta +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/BUSINESS_robots.png?itok=TOZgajrd (Three giant robots and a person) +[2]: https://opensource.com/article/20/4/python-data-covid-19 +[3]: https://opensource.com/article/18/7/digital-transformation-strategy-think-cloud +[4]: https://www.cnbc.com/2020/03/18/how-china-is-using-robots-and-telemedicine-to-combat-the-coronavirus.html +[5]: https://www.therobotreport.com/company-offers-germ-killing-robot-to-airports-to-address-coronavirus-outbreak/ +[6]: https://www.cloudwards.net/what-is-the-internet-of-things/ +[7]: https://opensource.com/article/17/3/5-big-ways-ai-rapidly-invading-our-lives +[8]: https://blog.eccouncil.org/spyware-in-the-iot-what-does-it-mean-for-your-online-privacy/ +[9]: https://opensource.com/article/17/10/doc-audits +[10]: https://privacyaustralia.net/privacy-tools/ +[11]: https://opensource.com/article/19/11/how-many-iot-devices +[12]: https://opensource.com/article/17/3/embedded-linux-iot-ecosystem diff --git a/sources/tech/20200511 How I track my home-s energy consumption with open source.md b/sources/tech/20200511 How I track my home-s energy consumption with open source.md new file mode 100644 index 0000000000..10dfaa5f8e --- /dev/null +++ b/sources/tech/20200511 How I track my home-s energy consumption with open source.md @@ -0,0 +1,144 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How I track my home's energy consumption with open source) +[#]: via: (https://opensource.com/article/20/5/energy-monitoring) +[#]: author: (Stephan Avenwedde https://opensource.com/users/hansic99) + +How I track my home's energy consumption with open source +====== +These open source components help you find ways to save money and +conserve resources. +![lightbulb drawing outline][1] + +An important step towards optimizing energy consumption is knowing your actual consumption. My house was built during the oil crisis in the 1970s, and due to the lack of a natural gas connection, the builders decided to use electricity to do all of the heating (water and home heating). This is not unusual for this area of Germany, and it remains an appropriate solution in countries that depend highly on nuclear power. + +Electricity prices here are quite high (around € 0.28/kWh), so I decided to monitor my home's energy consumption to get a feel for areas where I could save some energy. + +I used to work for a company that sold energy-monitoring systems for industrial customers. While this company mostly used proprietary software, you can set up a similar smart monitoring and logging solution for your home based on open source components. This article will show you how. + +In Germany, the grid operator owns the electricity meter. The grid operator is obliged to provide an interface on its metering device to enable the customer to access the meter reading. Here is the metering device on my home: + +![Actaris ACE3000 electricity meter][2] + +Actaris ACE3000 Type 110 (dry contact located behind the marked cover) + +Generally, almost every metering device has at least a [dry contact][3]—as my electricity meter does—that you can use to log metering. As you can see, my electricity meter has two counters: The upper one is for the day tariff (6am to 10pm), and the lower one is for the night tariff (10pm to 6am). The night tariff is a bit cheaper. Two-tariff meters are usually found only in houses with electric heating. + +### Design + +A reliable energy-monitoring solution for private use should meet the following requirements: + + * Logging of metering impulses (dry contact) + * 24/7 operation + * Energy-saving operation + * Visualization of consumption data + * Long-term recording of consumption data + * Connectivity (e.g., Ethernet, USB, WiFi, etc.) + * Affordability + + + +I choose the Siemens SIMATIC IOT2020 as my hardware platform. This industrial-proven device is based on an Intel Quark x86 CPU, has programmable interrupts, and is compatible with many Arduino shields. + +![Siemens SIMATIC IOT2020][4] + +Siemens SIMATIC IOT2020 + +The Siemens device comes without an SD card and, therefore, without an operating system. Luckily, you can find a current Yocto-based Linux OS image and instructions on how to flash the SD card in the [Siemens forum][5]. + +In addition to the hardware platform, you also need some accessories. The following materials list shows the minimum components you need. Each item includes links to the parts I purchased, so you can get a sense of the project's costs. + +#### Materials list + + * [Siemens SIMATIC IoT2020 unit][6] + * [Siemens I/O Shield for SIMATIC IoT2000 series][7] + * [microSD card][8] (2GB or more) + * [CSL 300Mbit USB-WLAN adapter][9] + * 24V power supply (I used a 2.1A [TDK-Lambda DRB50-24-1][10], which I already owned). You could use a less expensive power supply with less power: the SIMATIC IOT2020 has a maximum current of 1.4A, and the dry contact needs an additional 0.1A (24V / 220Ω). + * 5 terminal blocks ([Weidmueller WDU 2.5mm][11]) + * 2 terminal cross-connecting bridges ([Weidmueller WQV][12]) + * [DIN rail][13] (~300 mm) + * [220Ω / 3W resistor][14] + * Wire + + + +Here is the assembled result: + +![Mounted and hooked up energy logger][15] + +Energy logger mounted and hooked up + +Unfortunately, I didn't have enough space at the rear wall of the cabinet; therefore, the DIN rail with the mounted parts lies on the ground. + +The connections between the meter and the Siemens device look like this: + +![Wiring between meter and energy logger][16] + +### How it works + +A dry contact is a current interface. When the electricity meter triggers, a current of 0.1A starts flowing between **s0+** and **s0-**. On **DI0**, the voltage rises to 24V and triggers an interrupt. When the electricity meter disconnects **s0+** and **s0-**, **DI0** is grounded over the resistor. + +On my device, the contact closes 1,000 times per kWh (this value varies between metering devices). + +To count these peaks reliably, I created [a C program][17] that registers an interrupt service routine on the DI0 input and counts upwards in memory. Once a minute, the values from memory are written to an [SQLite][18] database. + +The overall meter reading is also written to a text file and can be preset with a starting value. This acts as a copy of the overall metering value of the meter in the cabinet. + +![Energy logger architecture][19] + +Energy logger architecture + +The data is visualized using [Node-RED][20], and I can access overviews, like the daily consumption dashboard below, over a web-based GUI. + +![Node-RED based GUI][21] + +Daily overview in the Node-RED GUI + +For the daily overview, I calculate the hourly costs based on the consumption data (the large bar chart). On the top-left of the dashboard you can see the actual power; below that is the daily consumption (energy and costs). The water heater for the shower causes the large peak in the bar chart. + +### A reliable system + +Aside from a lost timestamp during a power failure (the real-time clock in the Siemens device is not backed by a battery by default), everything has been working fine for more than one-and-a-half years. + +If you can set up the whole Linux system completely from the command line, you'll get a reliable and flexible system with the ability to link interrupt service routines to the I/O level. + +Because the I/O Shield runs on standard control voltage (24V), you can extend its functionality with the whole range of standardized industrial components (e.g., relays, sensors, actors, etc.). And, due to its open architecture, this system can be extended easily and applied to other applications, like for monitoring gas or water consumption or as a weather station, a simple controller for tasks, and more. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/5/energy-monitoring + +作者:[Stephan Avenwedde][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/hansic99 +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/Collaboration%20for%20health%20innovation.png?itok=s4O5EX2w (lightbulb drawing outline) +[2]: https://opensource.com/sites/default/files/uploads/openenergylogger_1_electricity_meter.jpg (Actaris ACE3000 electricity meter) +[3]: https://en.wikipedia.org/wiki/Dry_contact +[4]: https://opensource.com/sites/default/files/uploads/openenergylogger_2_siemens_device.jpg (Siemens SIMATIC IOT2020) +[5]: https://support.industry.siemens.com/tf/ww/en/posts/new-example-image-version-online/189090/?page=0&pageSize=10 +[6]: https://de.rs-online.com/web/p/products/1244037 +[7]: https://de.rs-online.com/web/p/products/1354133 +[8]: https://de.rs-online.com/web/p/micro-sd-karten/7582584/ +[9]: https://www.amazon.de/300Mbit-WLAN-Adapter-Hochleistungs-Antennen-Dual-Band/dp/B00LLIOT34 +[10]: https://de.rs-online.com/web/p/products/8153133 +[11]: https://de.rs-online.com/web/p/din-schienenklemmen-ohne-sicherung/0425190/ +[12]: https://de.rs-online.com/web/p/din-schienenklemmen-zubehor/0202574/ +[13]: https://de.rs-online.com/web/p/din-schienen/2835729/ +[14]: https://de.rs-online.com/web/p/widerstande-durchsteckmontage/2142673/ +[15]: https://opensource.com/sites/default/files/uploads/openenergylogger_3_assembled_device.jpg (Mounted and hooked up energy logger) +[16]: https://opensource.com/sites/default/files/uploads/openenergylogger_4_wiring.png (Wiring between meter and energy logger) +[17]: https://github.com/hANSIc99/OpenEnergyLogger +[18]: https://www.sqlite.org/index.html +[19]: https://opensource.com/sites/default/files/uploads/openenergylogger_5_architecure.png (Energy logger architecture) +[20]: https://nodered.org/ +[21]: https://opensource.com/sites/default/files/uploads/openenergylogger_6_dashboard.png (Node-RED based GUI) diff --git a/sources/tech/20200511 Start using systemd as a troubleshooting tool.md b/sources/tech/20200511 Start using systemd as a troubleshooting tool.md new file mode 100644 index 0000000000..372be7660e --- /dev/null +++ b/sources/tech/20200511 Start using systemd as a troubleshooting tool.md @@ -0,0 +1,269 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Start using systemd as a troubleshooting tool) +[#]: via: (https://opensource.com/article/20/5/systemd-troubleshooting-tool) +[#]: author: (David Both https://opensource.com/users/dboth) + +Start using systemd as a troubleshooting tool +====== +While systemd is not really a troubleshooting tool, the information in +its output points the way toward solving problems. +![Magnifying glass on code][1] + +No one would really consider systemd to be a troubleshooting tool, but when I encountered a problem on my webserver, my growing knowledge of systemd and some of its features helped me locate and circumvent the problem. + +The problem was that my server, yorktown, which provides name services, DHCP, NTP, HTTPD, and SendMail email services for my home office network, failed to start the Apache HTTPD daemon during normal startup. I had to start it manually after I realized that it was not running. The problem had been going on for some time, and I recently got around to trying to fix it. + +Some of you will say that systemd itself is the cause of this problem, and, based on what I know now, I agree with you. However, I had similar types of problems with SystemV. (In the [first article][2] in this series, I looked at the controversy around systemd as a replacement for the old SystemV init program and startup scripts. If you're interested in learning more about systemd, read the [second][3] and [third][4] articles, too.) No software is perfect, and neither systemd nor SystemV is an exception, but systemd provides far more information for problem-solving than SystemV ever offered. + +### Determining the problem + +The first step to finding the source of this problem is to determine the httpd service's status: + + +``` +[root@yorktown ~]# systemctl status httpd +● httpd.service - The Apache HTTP Server +   Loaded: loaded (/usr/lib/systemd/system/httpd.service; enabled; vendor preset: disabled) +   Active: failed (Result: exit-code) since Thu 2020-04-16 11:54:37 EDT; 15min ago +     Docs: man:httpd.service(8) +  Process: 1101 ExecStart=/usr/sbin/httpd $OPTIONS -DFOREGROUND (code=exited, status=1/FAILURE) + Main PID: 1101 (code=exited, status=1/FAILURE) +   Status: "Reading configuration..." +      CPU: 60ms + +Apr 16 11:54:35 yorktown.both.org systemd[1]: Starting The Apache HTTP Server... +Apr 16 11:54:37 yorktown.both.org httpd[1101]: (99)Cannot assign requested address: AH00072: make_sock: could not bind to address 192.168.0.52:80 +Apr 16 11:54:37 yorktown.both.org httpd[1101]: no listening sockets available, shutting down +Apr 16 11:54:37 yorktown.both.org httpd[1101]: AH00015: Unable to open logs +Apr 16 11:54:37 yorktown.both.org systemd[1]: httpd.service: Main process exited, code=exited, status=1/FAILURE +Apr 16 11:54:37 yorktown.both.org systemd[1]: httpd.service: Failed with result 'exit-code'. +Apr 16 11:54:37 yorktown.both.org systemd[1]: Failed to start The Apache HTTP Server. +[root@yorktown ~]# +``` + +This status information is one of the systemd features that I find much more useful than anything SystemV offers. The amount of helpful information here leads me easily to a logical conclusion that takes me in the right direction. All I ever got from the old **chkconfig** command is whether or not the service is running and the process ID (PID) if it is. That is not very helpful. + +The key entry in this status report shows that HTTPD cannot bind to the IP address, which means it cannot accept incoming requests. This indicates that the network is not starting fast enough to be ready for the HTTPD service to bind to the IP address because the IP address has not yet been set. This is not supposed to happen, so I explored my network service systemd startup configuration files; all appeared to be correct with the right "after" and "requires" statements. Here is the **/lib/systemd/system/httpd.service** file from my server: + + +``` +# Modifying this file in-place is not recommended, because changes                                                                                     +# will be overwritten during package upgrades.  To customize the                                                                                       +# behaviour, run "systemctl edit httpd" to create an override unit.                                                                                   +                                                                                                                                                      +# For example, to pass additional options (such as -D definitions) to                                                                                 +# the httpd binary at startup, create an override unit (as is done by                                                                                 +# systemctl edit) and enter the following:                                                                                                             +                                                                                                                                                      +#       [Service]                                                                                                                                     +#       Environment=OPTIONS=-DMY_DEFINE                                                                                                               +                                                                                                                                                      +[Unit]                                                                                                                                                 +Description=The Apache HTTP Server                                                                                                                     +Wants=httpd-init.service                                                                                                                               +After=network.target remote-fs.target nss-lookup.target httpd-init.service                                                                             +Documentation=man:httpd.service(8)                                                                                                                     +                                                                                                                                                      +[Service]                                                                                                                                             +Type=notify                                                                                                                                           +Environment=LANG=C                                                                                                                                     +                                                                                                                                                      +ExecStart=/usr/sbin/httpd $OPTIONS -DFOREGROUND                                                                                                       +ExecReload=/usr/sbin/httpd $OPTIONS -k graceful                                                                                                       +# Send SIGWINCH for graceful stop                                                                                                                     +KillSignal=SIGWINCH                                                                                                                                   +KillMode=mixed                                                                                                                                         +PrivateTmp=true                                                                                                                                       +                                                                                                                                                      +[Install]                                                                                                                                             +WantedBy=multi-user.target +``` + +The **httpd.service** unit file explicitly specifies that it should load after the **network.target** and the **httpd-init.service** (among others). I tried to find all of these services using the **systemctl list-units** command and searching for them in the resulting data stream. All were present and should have ensured that the httpd service did not load before the network IP address was set. + +### First solution + +A bit of searching on the internet confirmed that others had encountered similar problems with httpd and other services. This appears to happen because one of the required services indicates to systemd that it has finished its startup—but it actually spins off a child process that has not finished. After a bit more searching, I came up with a circumvention. + +I could not figure out why the IP address was taking so long to be assigned to the network interface card. So, I thought that if I could delay the start of the HTTPD service by a reasonable amount of time, the IP address would be assigned by that time. + +Fortunately, the **/lib/systemd/system/httpd.service** file above provides some direction. Although it says not to alter it, it does indicate how to proceed: Use the command **systemctl edit httpd**, which automatically creates a new file (**/etc/systemd/system/httpd.service.d/override.conf**) and opens the [GNU Nano][5] editor. (If you are not familiar with Nano, be sure to look at the hints at the bottom of the Nano interface.) + +Add the following text to the new file and save it: + + +``` +[root@yorktown ~]# cd /etc/systemd/system/httpd.service.d/ +[root@yorktown httpd.service.d]# ll +total 4 +-rw-r--r-- 1 root root 243 Apr 16 11:43 override.conf +[root@yorktown httpd.service.d]# cat override.conf +# Trying to delay the startup of httpd so that the network is +# fully up and running so that httpd can bind to the correct +# IP address +# +# By David Both, 2020-04-16 + +[Service] +ExecStartPre=/bin/sleep 30 +``` + +The **[Service]** section of this override file contains a single line that delays the start of the HTTPD service by 30 seconds. The following status command shows the service status during the wait time: + + +``` +[root@yorktown ~]# systemctl status httpd +● httpd.service - The Apache HTTP Server +   Loaded: loaded (/usr/lib/systemd/system/httpd.service; enabled; vendor preset: disabled) +  Drop-In: /etc/systemd/system/httpd.service.d +           └─override.conf +           /usr/lib/systemd/system/httpd.service.d +           └─php-fpm.conf +   Active: activating (start-pre) since Thu 2020-04-16 12:14:29 EDT; 28s ago +     Docs: man:httpd.service(8) +Cntrl PID: 1102 (sleep) +    Tasks: 1 (limit: 38363) +   Memory: 260.0K +      CPU: 2ms +   CGroup: /system.slice/httpd.service +           └─1102 /bin/sleep 30 + +Apr 16 12:14:29 yorktown.both.org systemd[1]: Starting The Apache HTTP Server... +Apr 16 12:15:01 yorktown.both.org systemd[1]: Started The Apache HTTP Server. +[root@yorktown ~]# +``` + +And this command shows the status of the HTTPD service after the 30-second delay expires. The service is up and running correctly: + + +``` +[root@yorktown ~]# systemctl status httpd +● httpd.service - The Apache HTTP Server +   Loaded: loaded (/usr/lib/systemd/system/httpd.service; enabled; vendor preset: disabled) +  Drop-In: /etc/systemd/system/httpd.service.d +           └─override.conf +           /usr/lib/systemd/system/httpd.service.d +           └─php-fpm.conf +   Active: active (running) since Thu 2020-04-16 12:15:01 EDT; 1min 18s ago +     Docs: man:httpd.service(8) +  Process: 1102 ExecStartPre=/bin/sleep 30 (code=exited, status=0/SUCCESS) + Main PID: 1567 (httpd) +   Status: "Total requests: 0; Idle/Busy workers 100/0;Requests/sec: 0; Bytes served/sec:   0 B/sec" +    Tasks: 213 (limit: 38363) +   Memory: 21.8M +      CPU: 82ms +   CGroup: /system.slice/httpd.service +           ├─1567 /usr/sbin/httpd -DFOREGROUND +           ├─1569 /usr/sbin/httpd -DFOREGROUND +           ├─1570 /usr/sbin/httpd -DFOREGROUND +           ├─1571 /usr/sbin/httpd -DFOREGROUND +           └─1572 /usr/sbin/httpd -DFOREGROUND + +Apr 16 12:14:29 yorktown.both.org systemd[1]: Starting The Apache HTTP Server... +Apr 16 12:15:01 yorktown.both.org systemd[1]: Started The Apache HTTP Server. +``` + +I could have experimented to see if a shorter delay would work as well, but my system is not that critical, so I decided not to. It works reliably as it is, so I am happy. + +Because I gathered all this information, I reported it to Red Hat Bugzilla as Bug [1825554][6]. I believe that it is much more productive to report bugs than it is to complain about them. + +### The better solution + +A couple of days after reporting this as a bug, I received a response indicating that systemd is just the manager, and if httpd needs to be ordered after some requirements are met, it needs to be expressed in the unit file. The response pointed me to the **httpd.service** man page. I wish I had found this earlier because it is a better solution than the one I came up with. This solution is explicitly targeted to the prerequisite target unit rather than a somewhat random delay. + +From the [**httpd.service** man page][7]: + +> **Starting the service at boot time** +> +> The httpd.service and httpd.socket units are _disabled_ by default. To start the httpd service at boot time, run: **systemctl enable httpd.service**. In the default configuration, the httpd daemon will accept connections on port 80 (and, if mod_ssl is installed, TLS connections on port 443) for any configured IPv4 or IPv6 address. +> +> If httpd is configured to depend on any specific IP address (for example, with a "Listen" directive) which may only become available during start-up, or if httpd depends on other services (such as a database daemon), the service _must_ be configured to ensure correct start-up ordering. +> +> For example, to ensure httpd is only running after all configured network interfaces are configured, create a drop-in file (as described above) with the following section: +> +> [Unit] +> After=network-online.target +> Wants=network-online.target + +I still think this is a bug because it is quite common—at least in my experience—to use a **Listen** directive in the **httpd.conf** configuration file. I have always used **Listen** directives, even on hosts with only a single IP address, and it is clearly necessary on hosts with multiple network interface cards (NICs) and internet protocol (IP) addresses. Adding the lines above to the **/usr/lib/systemd/system/httpd.service** default file would not cause problems for configurations that do not use a **Listen** directive and would prevent this problem for those that do. + +In the meantime, I will use the suggested solution. + +### Next steps + +This article describes a problem I had with starting the Apache HTTPD service on my server. It leads you through the problem determination steps I took and shows how I used systemd to assist. I also covered the circumvention I implemented using systemd and the better solution that followed from my bug report. + +As I mentioned at the start, it is very likely that this is the result of a problem with systemd, specifically the configuration for httpd startup. Nevertheless, systemd provided me with the tools to locate the likely source of the problem and to formulate and implement a circumvention. Neither solution really resolves the problem to my satisfaction. For now, the root cause of the problem still exists and must be fixed. If that is simply adding the recommended lines to the **/usr/lib/systemd/system/httpd.service** file, that would work for me. + +One of the things I discovered during this is process is that I need to learn more about defining the sequences in which things start. I will explore that in my next article, the fifth in this series. + +### Resources + +There is a great deal of information about systemd available on the internet, but much is terse, obtuse, or even misleading. In addition to the resources mentioned in this article, the following webpages offer more detailed and reliable information about systemd startup. + + * The Fedora Project has a good, practical [guide][8] [to systemd][8]. It has pretty much everything you need to know in order to configure, manage, and maintain a Fedora computer using systemd. + * The Fedora Project also has a good [cheat sheet][9] that cross-references the old SystemV commands to comparable systemd ones. + * For detailed technical information about systemd and the reasons for creating it, check out [Freedesktop.org][10]'s [description of systemd][11]. + * [Linux.com][12]'s "More systemd fun" offers more advanced systemd [information and tips][13]. + + + +There is also a series of deeply technical articles for Linux sysadmins by Lennart Poettering, the designer and primary developer of systemd. These articles were written between April 2010 and September 2011, but they are just as relevant now as they were then. Much of everything else good that has been written about systemd and its ecosystem is based on these papers. + + * [Rethinking PID 1][14] + * [systemd for Administrators, Part I][15] + * [systemd for Administrators, Part II][16] + * [systemd for Administrators, Part III][17] + * [systemd for Administrators, Part IV][18] + * [systemd for Administrators, Part V][19] + * [systemd for Administrators, Part VI][20] + * [systemd for Administrators, Part VII][21] + * [systemd for Administrators, Part VIII][22] + * [systemd for Administrators, Part IX][23] + * [systemd for Administrators, Part X][24] + * [systemd for Administrators, Part XI][25] + + + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/5/systemd-troubleshooting-tool + +作者:[David Both][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/dboth +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/find-file-linux-code_magnifying_glass_zero.png?itok=E2HoPDg0 (Magnifying glass on code) +[2]: https://opensource.com/article/20/4/systemd +[3]: https://opensource.com/article/20/4/systemd-startup +[4]: https://opensource.com/article/20/4/understanding-and-using-systemd-units +[5]: https://www.nano-editor.org/ +[6]: https://bugzilla.redhat.com/show_bug.cgi?id=1825554 +[7]: https://www.mankier.com/8/httpd.service#Description-Starting_the_service_at_boot_time +[8]: https://docs.fedoraproject.org/en-US/quick-docs/understanding-and-administering-systemd/index.html +[9]: https://fedoraproject.org/wiki/SysVinit_to_Systemd_Cheatsheet +[10]: http://Freedesktop.org +[11]: http://www.freedesktop.org/wiki/Software/systemd +[12]: http://Linux.com +[13]: https://www.linux.com/training-tutorials/more-systemd-fun-blame-game-and-stopping-services-prejudice/ +[14]: http://0pointer.de/blog/projects/systemd.html +[15]: http://0pointer.de/blog/projects/systemd-for-admins-1.html +[16]: http://0pointer.de/blog/projects/systemd-for-admins-2.html +[17]: http://0pointer.de/blog/projects/systemd-for-admins-3.html +[18]: http://0pointer.de/blog/projects/systemd-for-admins-4.html +[19]: http://0pointer.de/blog/projects/three-levels-of-off.html +[20]: http://0pointer.de/blog/projects/changing-roots +[21]: http://0pointer.de/blog/projects/blame-game.html +[22]: http://0pointer.de/blog/projects/the-new-configuration-files.html +[23]: http://0pointer.de/blog/projects/on-etc-sysinit.html +[24]: http://0pointer.de/blog/projects/instances.html +[25]: http://0pointer.de/blog/projects/inetd.html diff --git a/sources/tech/20200511 Tips and tricks for optimizing container builds.md b/sources/tech/20200511 Tips and tricks for optimizing container builds.md new file mode 100644 index 0000000000..0a4fbed8cb --- /dev/null +++ b/sources/tech/20200511 Tips and tricks for optimizing container builds.md @@ -0,0 +1,201 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Tips and tricks for optimizing container builds) +[#]: via: (https://opensource.com/article/20/5/optimize-container-builds) +[#]: author: (Ravi Chandran https://opensource.com/users/ravichandran) + +Tips and tricks for optimizing container builds +====== +Try these techniques to minimize the number and length of your container +build iterations. +![Toolbox drawing of a container][1] + +How many iterations does it take to get a container configuration just right? And how long does each iteration take? Well, if you answered "too many times and too long," then my experiences are similar to yours. On the surface, creating a configuration file seems like a straightforward exercise: implement the same steps in a configuration file that you would perform if you were installing the system by hand. Unfortunately, I've found that it usually doesn't quite work that way, and a few "tricks" are handy for such DevOps exercises. + +In this article, I'll share some techniques I've found that help minimize the number and length of iterations. In addition, I'll outline a few good practices beyond the [standard ones][2]. + +In the [tutorial repository][3] from my previous article about [containerizing build systems][4], I've added a folder called **/tutorial2_docker_tricks** with an example covering some of the tricks that I'll walk through in this post. If you want to follow along and you have Git installed, you can pull it locally with: + + +``` +`$ git clone https://github.com/ravi-chandran/dockerize-tutorial` +``` + +The tutorial has been tested with Docker Desktop Edition, although it should work with any compatible Linux container system (like [Podman][5]). + +### Save time on container image build iterations + +If the Dockerfile involves downloading and installing a 5GB file, each iteration of **docker image build** could take a lot of time even with good network speeds. And forgetting to include one item to be installed can mean rebuilding all the layers after that point. + +One way around that challenge is to use a local HTTP server to avoid downloading large files from the internet multiple times during **docker image build** iterations. To illustrate this by example, say you need to create a container image with Anaconda 3 under Ubuntu 18.04. The Anaconda 3 installer is a ~0.5GB file, so this will be the "large" file for this example. + +Note that you don't want to use the **COPY** instruction, as it creates a new layer. You should also delete the large installer after using it to minimize the container image size. You could use [multi-stage builds][6], but I've found the following approach sufficient and quite effective. + +The basic idea is to use a Python-based HTTP server locally to serve the large file(s) and have the Dockerfile **wget** the large file(s) from this local server. Let's explore the details of how to set this up effectively. As a reminder, you can access the [full example][7]. + +The necessary contents of the folder **tutorial2_docker_tricks/** in this example repository are: + + +``` +tutorial2_docker_tricks/ +├── build_docker_image.sh                   # builds the docker image +├── run_container.sh                        # instantiates a container from the image +├── install_anaconda.dockerfile             # Dockerfile for creating our target docker image +├── .dockerignore                           # used to ignore contents of the installer/ folder from the docker context +├── installer                               # folder with all our large files required for creating the docker image +│   └── Anaconda3-2019.10-Linux-x86_64.sh   # from +└── workdir                                 # example folder used as a volume in the running container +``` + +The key steps of the approach are: + + * Place the large file(s) in the **installer/** folder. In this example, I have the large Anaconda installer file **Anaconda3-2019.10-Linux-x86_64.sh**. You won't find this file if you clone my [Git repository][8] because only you, as the container image creator, need this source file. The end users of the image don't. [Download the installer][9] to follow along with the example. + * Create the **.dockerignore** file and have it ignore the **installer/** folder to avoid Docker copying all the large files into the build context. + * In a terminal, **cd** into the **tutorial2_docker_tricks/** folder and execute the build script as **./build_docker_image.sh**. + * In **build_docker_image.sh**, start the Python HTTP server to serve any files from the **installer/** folder: [code] cd installer +python3 -m http.server --bind 10.0.2.15 8888 & +cd .. +``` +* If you're wondering about the strange internet protocol (IP) address, I'm working with a VirtualBox Linux VM, and **10.0.2.15** shows up as the address of the Ethernet adapter when I run **ifconfig**. This IP seems to be the convention used by VirtualBox. If your setup is different, you'll need to update this IP address to match your environment and then update **build_docker_image.sh** and **install_anaconda.dockerfile**. The server's port number is set to **8888** for this example. Note that the IP and port numbers could be passed in as build arguments, but I've hard-coded them for brevity. +* Since the HTTP server is set to run in the background, stop the server near the end of the script with the **kill -9** command using an [elegant approach][10] I found: [code]`kill -9 `ps -ef | grep http.server | grep 8888 | awk '{print $2}'` +``` + * Note that this same **kill -9** is also used earlier in the script (before starting the HTTP server). In general, when I iterate on any build script that I might deliberately interrupt, this ensures a clean start of the HTTP server each time. + * In the [Dockerfile][11], there is a **RUN wget** instruction that downloads the Anaconda installer from the local HTTP server. It also deletes the installer file and cleans up after the installation. Most importantly, all these actions are performed within the same layer to keep the image size to a minimum: [code] # install Anaconda by downloading the installer via the local http server +ARG ANACONDA +RUN wget --no-proxy -O ~/anaconda.sh \ +    && /bin/bash ~/anaconda.sh -b -p /opt/conda \ +    && rm ~/anaconda.sh \ +    && rm -fr /var/lib/apt/lists/{apt,dpkg,cache,log} /tmp/* /var/tmp/* +``` + * This file runs the wrapper script, **anaconda.sh**, and cleans up large files by removing them with **rm**. + * After the build is complete, you should see an image **anaconda_ubuntu1804:v1**. (You can list the images with **docker image ls**.) + * You can instantiate a container from this image using **./run_container.sh** at the terminal while in the folder **tutorial2_docker_tricks/**. You can verify that Anaconda is installed with: [code] $ ./run_container.sh +$ python --version +Python 3.7.5 +$ conda --version +conda 4.8.0 +$ anaconda --version +anaconda Command line client (version 1.7.2) +``` + * You'll note that **run_container.sh** sets up a volume **workdir**. In this example repository, the folder **workdir/** is empty. This is a convention I use to set up a volume where I can have my Python and other scripts that are independent of the container image. + + + +### Minimize container image size + +Each **RUN** command is equivalent to executing a new shell, and each **RUN** command creates a layer. The naive approach of mimicking installation instructions with separate **RUN** commands may eventually break at one or more interdependent steps. If it happens to work, it will typically result in a larger image. Chaining multiple installation steps in one **RUN** command and including the **autoremove**, **autoclean**, and **rm** commands (as in the example below) is useful to minimize the size of each layer. Some of these steps may not be needed, depending on what's being installed. However, since these steps take an insignificant amount of time, I always throw them in for good measure at the end of **RUN** commands invoking **apt-get**: + + +``` +RUN apt-get update \ +    && DEBIAN_FRONTEND=noninteractive \ +       apt-get -y --quiet --no-install-recommends install \ +       # list of packages being installed go here \ +    && apt-get -y autoremove \ +    && apt-get clean autoclean \ +    && rm -fr /var/lib/apt/lists/{apt,dpkg,cache,log} /tmp/* /var/tmp/* +``` + +Also, ensure that you have a **.dockerignore** file in place to ignore items that don't need to be sent to the Docker build context (such as the Anaconda installer file in the earlier example). + +### Organize the build tool I/O + +For software build systems, the build inputs and outputs—all the scripts that configure and invoke the tools—should be outside the image and the eventually running container. The container itself should remain stateless so that different users will have identical results with it. I covered this extensively in my [previous article][4] but wanted to emphasize it because it's been a useful convention for my work. These inputs and outputs are best accessed by setting up container volumes. + +I've had to use a container image that provides data in the form of source code and large pre-built binaries. As a software developer, I was expected to edit the code in the container. This was problematic, because containers are by default stateless: they don't save data within the container, because they're designed to be disposable. But I worked on it, and at the end of each day, I stopped the container and had to be careful not to remove it, because the state had to be maintained so I could continue work the next day. The disadvantage of this approach was that there would be a divergence of development state had there been more than one person working on the project. The value of having identical build systems across developers is somewhat lost with this approach. + +### Generate output as non-root user + +An important aspect of I/O concerns the ownership of the output files generated when running the tools in the container. By default, since Docker runs as **root**, the output files would be owned by **root**, which is unpleasant. You typically want to work as a non-root user. Changing the ownership after the build output is generated can be done with scripts, but it is an additional and unnecessary step. It's best to set the [**USER**][12] argument in the Dockerfile at the earliest point possible: + + +``` +ARG USERNAME +# other commands... +USER ${USERNAME} +``` + +The **USERNAME** can be passed in as a build argument (**\--build-arg**) when executing the **docker image build**. You can see an example of this in the example [Dockerfile][11] and corresponding [build script][13]. + +Some portions of the tools may also need to be installed as a non-root user. So the sequence of installations in the Dockerfile may need to be different from the way it's done if you are installing manually and directly under Linux. + +### Non-interactive installation + +Interactivity is the opposite of container automation. I've found the + + +``` +`DEBIAN_FRONTEND=noninteractive apt-get -y --quiet --no-install-recommends` +``` + +options for the **apt-get install** instruction (as in the example above) necessary to prevent the installer from opening dialog boxes. Note that these options should be used as part of the **RUN** instruction. The **DEBIAN_FRONTEND=noninteractive** should not be set as an environment variable (**ENV**) in the Dockerfile, as this [FAQ explains][14], as it will be inherited by the containers. + +### Log your build and run output + +Debugging why a build failed is a common task, and logs are a great way to do this. Save a TypeScript of everything that happened during the container image build or container run session using the **tee** utility in a Bash script. In other words, add **|& tee $BASH_SOURCE.log** to the end of the **docker image build** and the **docker image run** commands in your scripts. See the examples in the [image build][13] and [container run][15] scripts. + +What this **tee**-ing technique does is generate a file with the same name as the Bash script but with a **.log** extension appended to it so that you know which script it originated from. Everything you see printed to the terminal when running the script will get logged to this file with a similar name. + +This is especially valuable for users of your container images to report issues to you when something doesn't work. You can ask them to send you the log file to help diagnose the issue. Many tools generate so much output that it easily overwhelms the default size of the terminal's buffer. Relying only on the terminal's buffer capacity to copy-paste error messages may not be sufficient for diagnosing issues because earlier errors may have been lost. + +I've found this to be useful, even in the container image-building scripts, especially when using the Python-based HTTP server discussed above. The server generates so many lines during a download that it typically overwhelms the terminal's buffer. + +### Deal with proxies elegantly + +In my work environment, proxies are required to reach the internet for downloading the resources in **RUN apt-get** and **RUN wget** commands. The proxies are typically inferred from the environment variables **http_proxy** or **https_proxy**. While **ENV** commands can be used to hard-code such proxy settings in the Dockerfile, there are multiple issues with using **ENV** for proxies directly. + +If you are the only one who will ever build the container, then perhaps this will work. But the Dockerfile couldn't be used by someone else at a different location with a different proxy setting. Another issue is that the IT department could change the proxy at some point, resulting in a Dockerfile that won't work any longer. Furthermore, the Dockerfile is a precise document specifying a configuration-controlled system, and every change will be scrutinized by quality assurance. + +One simple approach to avoid hard-coding the proxy is to pass your local proxy setting as a build argument in the **docker image build** command: + + +``` +docker image build \ +    --build-arg MY_PROXY= +``` + +And then, in the Dockerfile, set the environment variables based on the build argument. In the example shown here, you can still set a default proxy value that can be overridden by the build argument above: + + +``` +# set a default proxy +ARG MY_PROXY=MY_PROXY= +ENV http_proxy=$MY_PROXY +ENV https_proxy=$MY_PROXY +``` + +### Summary + +These techniques have helped me significantly reduce the time it takes to create container images and debug them when they go wrong. I continue to be on the lookout for additional best practices to add to my list. I hope you find the above techniques useful. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/5/optimize-container-builds + +作者:[Ravi Chandran][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/ravichandran +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/toolbox-learn-draw-container-yearbook.png?itok=xDbwz1pP (Toolbox drawing of a container) +[2]: https://docs.docker.com/develop/develop-images/dockerfile_best-practices/ +[3]: https://github.com/ravi-chandran/dockerize-tutorial +[4]: https://opensource.com/article/20/4/how-containerize-build-system +[5]: https://podman.io/getting-started/installation +[6]: https://docs.docker.com/develop/develop-images/multistage-build/ +[7]: https://github.com/ravi-chandran/dockerize-tutorial/blob/master/tutorial2_docker_tricks/ +[8]: https://github.com/ravi-chandran/dockerize-tutorial/ +[9]: https://repo.anaconda.com/archive/Anaconda3-2019.10-Linux-x86_64.sh +[10]: https://stackoverflow.com/a/37214138 +[11]: https://github.com/ravi-chandran/dockerize-tutorial/blob/master/tutorial2_docker_tricks/install_anaconda.dockerfile +[12]: https://docs.docker.com/engine/reference/builder/#user +[13]: https://github.com/ravi-chandran/dockerize-tutorial/blob/master/tutorial2_docker_tricks/build_docker_image.sh +[14]: https://docs.docker.com/engine/faq/ +[15]: https://github.com/ravi-chandran/dockerize-tutorial/blob/master/tutorial2_docker_tricks/run_container.sh diff --git a/sources/tech/20200515 How to examine processes running on Linux.md b/sources/tech/20200515 How to examine processes running on Linux.md new file mode 100644 index 0000000000..0659ab04f9 --- /dev/null +++ b/sources/tech/20200515 How to examine processes running on Linux.md @@ -0,0 +1,232 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How to examine processes running on Linux) +[#]: via: (https://www.networkworld.com/article/3543232/how-to-examine-processes-running-on-linux.html) +[#]: author: (Sandra Henry-Stocker https://www.networkworld.com/author/Sandra-Henry_Stocker/) + +How to examine processes running on Linux +====== + +Thinkstock + +There are quite a number of ways to look at running processes on Linux systems – to see what’s running, the resources that processes are using, how the system is affected by the load and how memory is being used. Each command gives you a different view, and the range of details is considerable. In this post, we’ll run through a series of commands that can help you view process details in a number of different ways. + +### ps + +While the **ps** command is the most obvious command for examining processes, the arguments that you use when running **ps** will make a big difference in how much information will be provided. With no arguments, **ps** will only show processes associated with your current login session. Add a **-u** and you'll see extended details. + +Here is a comparison: + +``` +nemo$ ps + PID TTY TIME CMD + 45867 pts/1 00:00:00 bash + 46140 pts/1 00:00:00 ps +nemo$ ps -u +USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND +nemo 45867 0.0 0.0 11232 5636 pts/1 Ss 19:04 0:00 -bash +nemo 46141 0.0 0.0 11700 3648 pts/1 R+ 19:16 0:00 ps -u +``` + +Using **ps -ef** will display details on all of the processes running on the system but **ps -eF** will add some additional details. + +``` +$ ps -ef | head -2 +UID PID PPID C STIME TTY TIME CMD +root 1 0 0 May10 ? 00:00:06 /sbin/init splash +$ ps -eF | head -2 +UID PID PPID C SZ RSS PSR STIME TTY TIME CMD +root 1 0 0 42108 12524 0 May10 ? 00:00:06 /sbin/init splash +``` + +Both commands show who is running the process, the process and parent process IDs, process start time, accumulated run time and the task being run. The additional fields shown when you use **F** instead of **f** include: + + * SZ: the process **size** in physical pages for the core image of the process + * RSS: the **resident set size** which shows how much memory is allocated to those parts of the process in RAM. It does not include memory that is swapped out, but does include memory from shared libraries as long as the pages from those libraries are currently in memory. It also includes stack and heap memory. + * PSR: the **processor** the process is using + + + +##### ps -fU + +You can list processes for some particular user with a command like "ps -ef | grep USERNAME", but with **ps -fU** command, you’re going to see considerably more data. This is because details of processes that are being run on the user's behalf are also included. In fact, nearly all these processes shown have been kicked off by system simply to support this user’s online session. Nemo has only just logged in and is not yet running any commands or scripts. + +``` +$ ps -fU nemo +UID PID PPID C STIME TTY TIME CMD +nemo 45726 1 0 19:04 ? 00:00:00 /lib/systemd/systemd --user +nemo 45732 45726 0 19:04 ? 00:00:00 (sd-pam) +nemo 45738 45726 0 19:04 ? 00:00:00 /usr/bin/pulseaudio --daemon +nemo 45740 45726 0 19:04 ? 00:00:00 /usr/libexec/tracker-miner-f +nemo 45754 45726 0 19:04 ? 00:00:00 /usr/bin/dbus-daemon --sessi +nemo 45829 45726 0 19:04 ? 00:00:00 /usr/libexec/gvfsd +nemo 45856 45726 0 19:04 ? 00:00:00 /usr/libexec/gvfsd-fuse /run +nemo 45862 45706 0 19:04 ? 00:00:00 sshd: nemo@pts/1 +nemo 45864 45726 0 19:04 ? 00:00:00 /usr/libexec/gvfs-udisks2-vo +nemo 45867 45862 0 19:04 pts/1 00:00:00 -bash +nemo 45878 45726 0 19:04 ? 00:00:00 /usr/libexec/gvfs-afc-volume +nemo 45883 45726 0 19:04 ? 00:00:00 /usr/libexec/gvfs-goa-volume +nemo 45887 45726 0 19:04 ? 00:00:00 /usr/libexec/goa-daemon +nemo 45895 45726 0 19:04 ? 00:00:00 /usr/libexec/gvfs-mtp-volume +nemo 45896 45726 0 19:04 ? 00:00:00 /usr/libexec/goa-identity-se +nemo 45903 45726 0 19:04 ? 00:00:00 /usr/libexec/gvfs-gphoto2-vo +nemo 45946 45726 0 19:04 ? 00:00:00 /usr/libexec/gvfsd-metadata +``` + +Note that the only process with an assigned TTY is Nemo's shell and that the parent of all of the other processes is **systemd**. + +You can supply a comma-separated list of usernames instead of a single name. Just be prepared to be looking at quite a bit more data. + +#### top and ntop + +The **top** and **ntop** commands will help when you want to get an idea which processes are using the most resources and allow you to reorder your view depending on what criteria you want to use to rank the processes (e.g., highest CPU or memory use). + +``` +top - 11:51:27 up 1 day, 21:40, 1 user, load average: 0.08, 0.02, 0.01 +Tasks: 211 total, 1 running, 210 sleeping, 0 stopped, 0 zombie +%Cpu(s): 5.0 us, 0.5 sy, 0.0 ni, 94.3 id, 0.2 wa, 0.0 hi, 0.0 si, 0.0 st +MiB Mem : 5944.4 total, 3527.4 free, 565.1 used, 1851.9 buff/cache +MiB Swap: 2048.0 total, 2048.0 free, 0.0 used. 5084.3 avail Mem + + PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND + 999 root 20 0 394660 14380 10912 S 8.0 0.2 0:46.54 udisksd + 65224 shs 20 0 314268 9824 8084 S 1.7 0.2 0:00.34 gvfs-ud+ + 2034 gdm 20 0 314264 9820 7992 S 1.3 0.2 0:06.25 gvfs-ud+ + 67909 root 20 0 0 0 0 I 0.3 0.0 0:00.09 kworker+ + 1 root 20 0 168432 12532 8564 S 0.0 0.2 0:09.93 systemd + 2 root 20 0 0 0 0 S 0.0 0.0 0:00.02 kthreadd +``` + +Use **shift+m** to sort by memory use and **shift+p** to go back to sorting by CPU usage (the default). + +#### /proc + +A tremendous amount of information is available on running processes in the **/proc** directory. In fact, if you haven't visited **/proc** quite a few times, you might be astounded by the amount of details available. Just keep in mind that **/proc** is a very different kind of file system. As an interface to kernel data, it provides a view of process details that are currently being used by the system. + +Some of the more useful **/proc** files for viewing include **cmdline**, **environ**, **fd**, **limits** and **status**. The following views provide some samples of what you might see. + +The **status** file shows the process that is running (bash), its status, the user and group ID for the person running bash, a full list of the groups the user is a member of and the process ID and parent process ID. + +``` +$ head -11 /proc/65333/status +Name: bash +Umask: 0002 +State: S (sleeping) +Tgid: 65333 +Ngid: 0 +Pid: 65333 +PPid: 65320 +TracerPid: 0 +Uid: 1000 1000 1000 1000 +Gid: 1000 1000 1000 1000 +FDSize: 256 +Groups: 4 11 24 27 30 46 118 128 500 1000 +... +``` + +The **cmdline** file shows the command line used to start the process. + +``` +$ cat /proc/65333/cmdline +-bash +``` + +The **environ** file shows the environment variables that are in effect. + +``` +$ cat environ +USER=shsLOGNAME=shsHOME=/home/shsPATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/gamesSHELL=/bin/bashTERM=xtermXDG_SESSION_ID=626XDG_RUNTIME_DIR=/run/user/1000DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/1000/busXDG_SESSION_TYPE=ttyXDG_SESSION_CLASS=userMOTD_SHOWN=pamLANG=en_US.UTF-8SSH_CLIENT=192.168.0.19 9385 22SSH_CONNECTION=192.168.0.19 9385 192.168.0.11 22SSH_TTY=/dev/pts/0$ +``` + +The **fd** file shows the file descriptors. Note how they reflect the pseudo-tty that is being used (pts/0). + +``` +$ ls -l /proc/65333/fd +total 0 +lrwx------ 1 shs shs 64 May 12 09:45 0 -> /dev/pts/0 +lrwx------ 1 shs shs 64 May 12 09:45 1 -> /dev/pts/0 +lrwx------ 1 shs shs 64 May 12 09:45 2 -> /dev/pts/0 +lrwx------ 1 shs shs 64 May 12 09:56 255 -> /dev/pts/0 +$ who +shs pts/0 2020-05-12 09:45 (192.168.0.19) +``` + +The **limits** file contains information about the limits imposed on the process. + +``` +$ cat limits +Limit Soft Limit Hard Limit Units +Max cpu time unlimited unlimited seconds +Max file size unlimited unlimited bytes +Max data size unlimited unlimited bytes +Max stack size 8388608 unlimited bytes +Max core file size 0 unlimited bytes +Max resident set unlimited unlimited bytes +Max processes 23554 23554 processes +Max open files 1024 1048576 files +Max locked memory 67108864 67108864 bytes +Max address space unlimited unlimited bytes +Max file locks unlimited unlimited locks +Max pending signals 23554 23554 signals +Max msgqueue size 819200 819200 bytes +Max nice priority 0 0 +Max realtime priority 0 0 +Max realtime timeout unlimited unlimited us +``` + +#### pmap + +The **pmap** command takes you in an entirely different direction when it comes to memory use. It provides a detailed map of a process’s memory usage. To make sense of this, you need to keep in mind that processes do not run entirely on their own. Instead, they make use of a wide range of system resources. The truncated **pmap** output below shows a portion of the memory map for a single user’s bash login along with some memory usage totals at the bottom. + +``` +$ pmap -x 43120 +43120: -bash +Address Kbytes RSS Dirty Mode Mapping +000055887655b000 180 180 0 r---- bash +0000558876588000 708 708 0 r-x-- bash +0000558876639000 220 148 0 r---- bash +0000558876670000 16 16 16 r---- bash +0000558876674000 36 36 36 rw--- bash +000055887667d000 40 28 28 rw--- [ anon ] +0000558876b96000 1328 1312 1312 rw--- [ anon ] +00007f0bd9a7e000 28 28 0 r---- libpthread-2.31.so +00007f0bd9a85000 68 68 0 r-x-- libpthread-2.31.so +00007f0bd9a96000 20 0 0 r---- libpthread-2.31.so +00007f0bd9a9b000 4 4 4 r---- libpthread-2.31.so +00007f0bd9a9c000 4 4 4 rw--- libpthread-2.31.so +00007f0bd9a9d000 16 4 4 rw--- [ anon ] +00007f0bd9aa1000 20 20 0 r---- libnss_systemd.so.2 +00007f0bd9aa6000 148 148 0 r-x-- libnss_systemd.so.2 +... +ffffffffff600000 4 0 0 --x-- [ anon ] +---------------- ------- ------- ------- +total kB 11368 5664 1656 + +Kbytes: size of map in kilobytes +RSS: resident set size in kilobytes +Dirty: dirty pages (both shared and private) in kilobytes +``` +``` + +``` + +Join the Network World communities on [Facebook][1] and [LinkedIn][2] to comment on topics that are top of mind. + +-------------------------------------------------------------------------------- + +via: https://www.networkworld.com/article/3543232/how-to-examine-processes-running-on-linux.html + +作者:[Sandra Henry-Stocker][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.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 diff --git a/sources/tech/20200515 The pieces of Fedora Silverblue.md b/sources/tech/20200515 The pieces of Fedora Silverblue.md new file mode 100644 index 0000000000..04bd4e1643 --- /dev/null +++ b/sources/tech/20200515 The pieces of Fedora Silverblue.md @@ -0,0 +1,172 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (The pieces of Fedora Silverblue) +[#]: via: (https://fedoramagazine.org/pieces-of-fedora-silverblue/) +[#]: author: (Nick Hardiman https://fedoramagazine.org/author/nickhardiman/) + +The pieces of Fedora Silverblue +====== + +![][1] + +Fedora Silverblue provides a useful workstation build on an immutable operating system. In “[What is Silverblue?][2]“, you learned about the benefits that an immutable OS provides. But what pieces go into making it? This article examines some of the technology that powers Silverblue. + +### The filesystem + +Fedora Workstation users may find the idea of an immutable OS to be the most brain-melting part of Silverblue. What does that mean? Find some answers by taking a look at the filesystem. + +At first glance, the layout looks pretty much the same as a regular Fedora file system. It has some differences, like making _/home_ a symbolic link to _/var/home_. And you can get more answers by looking at how libostree works. libostree treats the whole tree like it’s an object, checks it into a code repository, and checks out a copy for your machine to use. + +#### libostree + +The [libostree project][3] supplies the goods for managing Silverblue’s file system. It is an upgrade system that the user can control using [rpm-ostree commands][4]. + +libostree knows nothing about packages—an upgrade means replacing one complete file system with another complete file system. libostree treats the file system tree as one atomic object (an unbreakable unit). In fact, the forerunner to Silverblue was named [Project Atomic][5]. + +The libostree project provides a library and set of tools. It’s an upgrade system that carries out these tasks. + + 1. Pull in a new file system + 2. Store the new file system + 3. Deploy the new file system + + + +##### Pull in a new file system + +Pulling in a new file system means copying an object (the entire file system) from a remote source to its own store. If you’ve worked with virtual machine image files, you already understand the concept of a file system object that you can copy. + +##### Store the new file system + +The libostree store has some source code control qualities—it stores many file system objects, and checks one out to be used as the root file system. libostree’s store has two parts: + + * a repository database at _/sysroot/ostree/repo/_ + * file systems in _/sysroot/ostree/deploy/fedora/deploy/_ + + + +libostree keeps track of what’s been checked in using commit IDs. Each commit ID can be found in a directory name, nested deep inside _/sysroot_ .A libostree commit ID is a long checksum, and looks similar to a git commit ID. + +``` +$ ls -d /sysroot/ostree/deploy/fedora/deploy/*/ +/sysroot/ostree/deploy/fedora/deploy/c4bf7a6339e6be97d0ca48a117a1a35c9c5e3256ae2db9e706b0147c5845fac4.0/ +``` + +_rpm-ostree status_ gives a little more information about that commit ID. The output is a little confusing; it can take a while to see this file system is Fedora 31. + +``` +$ rpm-ostree status +State: idle +AutomaticUpdates: disabled +Deployments: +● ostree://fedora:fedora/31/x86_64/silverblue + Version: 31.1.9 (2019-10-23T21:44:48Z) + Commit: c4bf7a6339e6be97d0ca48a117a1a35c9c5e3256ae2db9e706b0147c5845fac4 + GPGSignature: Valid signature by 7D22D5867F2A4236474BF7B850CB390B3C3359C4 +``` + +##### Deploy the new filesystem + +libostree deploys a new file system by checking out the new object from its store. libostree doesn’t check out a file system by copying all the files—it uses hard links instead. If you look inside the commit ID directory, you see something that looks suspiciously like the root directory. That’s because it _is_ the root directory. You can see these two directories are pointing to the same place by checking their inodes. + +``` +$ ls -di1 / /sysroot/ostree/deploy/fedora/deploy/*/ +260102 / +260102 /sysroot/ostree/deploy/fedora/deploy/c4bf7a6339e6be97d0ca48a117a1a35c9c5e3256ae2db9e706b0147c5845fac4.0/ +``` + +This is a fresh install, so there’s only one commit ID. After a system update, there will be two. If more copies of the file system are checked into libostree’s repo, more commit IDs appear here. + +##### Upgrade process + +Putting the pieces together, the update process looks like this: + + 1. libostree checks out a copy of the file system object from the repository + 2. DNF installs packages into the copy + 3. libostree checks in the copy as a new object + 4. libostree checks out the copy to become the new file system + 5. You reboot to pick up the new system files + + + +In addition to more safety, there is more flexibility. You can do new things with libostree’s repo, like store a few different file systems and check out whichever one you feel like using. + +#### Silverblue’s root file system + +Fedora keeps its system files in all the usual Linux places, such as _/boot_ for boot files, _/etc_ for configuration files, and _/home_ for user home directories. The root directory in Silverblue looks much like the root directory in traditional Fedora, but there are some differences. + + * The filesystem has been checked out by libostree + * Some directories are now symbolic links to new locations. For example, _/home_ is a symbolic link to _/var/home_ + * _/usr_ is a read-only directory + * There’s a new directory named _/sysroot_. This is libostree’s new home + + + +#### Juggling file systems + +You can store many file systems and switch between them. This is called _rebasing_, and it’s similar to git rebasing. In fact, upgrading Silverblue to the next Fedora version is not a big package install—it’s a pull from a remote repository and a rebase. + +You could store three copies with three different desktops: one KDE, one GNOME, and one XFCE. Or three different OS versions: how about keeping the current version, the nightly build, and an old classic? Switching between them is a matter of rebasing to the appropriate file system object. + +Rebasing is also how you upgrade from one Fedora release to the next. See “[How to rebase to Fedora 32 on Silverblue][6]” for more information. + +### Flatpak + +The [Flatpak project][7] provides a way of installing applications like LibreOffice. Applications are pulled from remote repositories like [Flathub][8]. It’s a kind of package manager, although you won’t find the word _package_ in the [docs][9]. Traditional Fedora variants like Fedora Workstation can also use Flatpak, but the sandboxed nature of flatpaks make it particularly good for Silverblue. This way you do not have to do the entire ostree update process every time you wish to install an application. + +Flatpak is well-suited to desktop applications, but also works for command line applications. You can install the [vim][10] editor with the command _flatpak install flathub org.vim.Vim_ and run it with _flatpak run org.vim.Vim_. + +### toolbox + +The [toolbox project][11] provides a traditional operating system inside a container. The idea is that you can mess with the mutable OS inside your toolbox (the Fedora container) as much as you like, and leave the immutable OS outside your toolbox untouched. You pack as many toolboxes as you want on your system, so you can keep work separated. Behind the scenes, the executable _/usr/bin/toolbox_ is a shell script that uses [podman][12]. + +A fresh install does not include a default toolbox. The _toolbox create_ command checks the OS version (by reading _/usr/lib/os-release_), looks for a matching version at the Fedora container registry, and downloads the container. + +``` +$ toolbox create +Image required to create toolbox container. +Download registry.fedoraproject.org/f31/fedora-toolbox:31 (500MB)? [y/N]: y +Created container: fedora-toolbox-31 +Enter with: toolbox enter +``` + +Hundreds of packages are installed inside the toolbox. The _dnf_ command and the usual Fedora repos are set up, ready to install more. The _ostree_ and _rpm-ostree_ commands are not included – no immutable OS here. + +Each user’s home directory is mounted on their toolbox, for storing content files outside the container. + +### Put the pieces together + +Spend some time exploring Fedora Silverblue and it will become clear how these components fit together. Like other Fedora variants, all these of tools come from open source projects. You can get as up close and personal as you want, from reading their docs to contributing code. Or you can [contribute to Silverblue][13] itself. + +Join the Fedora Silverblue conversations on [discussion.fedoraproject.org][14] or in [#silverblue on Freenode IRC][15]. + +-------------------------------------------------------------------------------- + +via: https://fedoramagazine.org/pieces-of-fedora-silverblue/ + +作者:[Nick Hardiman][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://fedoramagazine.org/author/nickhardiman/ +[b]: https://github.com/lujun9972 +[1]: https://fedoramagazine.org/wp-content/uploads/2020/04/silverblue-pieces-816x345.png +[2]: https://fedoramagazine.org/what-is-silverblue/ +[3]: https://ostree.readthedocs.io/en/latest/ +[4]: https://rpm-ostree.readthedocs.io/en/latest/manual/administrator-handbook/#administering-an-rpm-ostree-based-system +[5]: https://www.projectatomic.io/ +[6]: https://fedoramagazine.org/how-to-rebase-to-fedora-32-on-silverblue/ +[7]: https://github.com/flatpak/flatpak +[8]: https://flathub.org/ +[9]: http://docs.flatpak.org/en/latest/index.html +[10]: https://www.vim.org/ +[11]: https://github.com/containers/toolbox +[12]: https://github.com/containers/libpod +[13]: https://silverblue.fedoraproject.org/contribute +[14]: https://discussion.fedoraproject.org/c/desktop/silverblue +[15]: https://webchat.freenode.net/#silverblue diff --git a/sources/tech/20200516 Fatih-s question.md b/sources/tech/20200516 Fatih-s question.md new file mode 100644 index 0000000000..1225c624a8 --- /dev/null +++ b/sources/tech/20200516 Fatih-s question.md @@ -0,0 +1,214 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Fatih’s question) +[#]: via: (https://dave.cheney.net/2020/05/16/fatihs-question) +[#]: author: (Dave Cheney https://dave.cheney.net/author/davecheney) + +Fatih’s question +====== + +A few days ago Fatih posted [this question][1] on twitter. + +I’m going to attempt to give my answer, however to do that I need to apply some simplifications as my previous attempts to answer it involved a lot of phrases like _a pointer to a pointer_, and other unhelpful waffling. Hopefully my simplified answer can be useful in building a mental framework to answer Fatih’s original question. + +### Restating the question + +Fatih’s original tweet showed [four different variations][2] of `json.Unmarshal`. I’m going to focus on the last two, which I’ll rewrite a little: + +``` +package main + +import ( + "encoding/json" + "fmt" +) + +type Result struct { + Foo string `json:"foo"` +} + +func main() { + content := []byte(`{"foo": "bar"}`) + var result1, result2 *Result + + err := json.Unmarshal(content, &result1) + fmt.Println(result1, err) // &{bar} + + err = json.Unmarshal(content, result2) + fmt.Println(result2, err) // json: Unmarshal(nil *main.Result) +} +``` + +Restated in words, `result1` and `result2` are the same type; `*Result`. Decoding into `result1` works as expected, whereas decoding into `result2` causes the `json` package to complain that the value passed to `Unmarshal` is `nil`. However, both values were declared without an initialiser so both would have taken on the type’s zero value, `nil`. + +Eagle eyed readers will have spotted that the reason for the difference is the first` `invocation is passed `&result1`, while the second is passed `result2`, but this explanation is unsatisfactory because the documentation for `json.Unmarshal` states: + +> Unmarshal parses the JSON-encoded data and stores the result in the value pointed to by v. **If v is nil or not a pointer**, Unmarshal returns an InvalidUnmarshalError. + +Which is confusing because `result1` and `result2` _are_ pointers. Furthermore, without initialisation, both _are_ `nil`. Now, the documentation is correct (as you’d expect from a package that has been hammered on for a decade), but explaining _why_ takes a little more investigation. + +### Functions receive a copy of their arguments + +Every assignment in Go is a copy, this includes function arguments and return values. + +``` +package main + +import ( + "fmt" +) + +func increment(v int) { + v++ +} + +func main() { + v := 1 + increment(v) + fmt.Println(v) // 1 +} +``` + +In this example, `increment` is operating on a _copy_ of `main`‘s `v`. This is because the `v` declared in `main` and `increment`‘s `v` parameter have different addresses in memory. Thus changes to `increment`‘s `v` cannot affect the contents of `main`‘s `v`. + +``` +package main + +import ( + "fmt" +) + +func increment(v *int) { + *v++ +} + +func main() { + v := 1 + increment(&v) + fmt.Println(v) // 2 +} +``` + +If we wanted to write `increment` in a way that it could affect the contents of its caller we would need to pass a reference, a pointer, to `main.v`.[1][3] This example demonstrates why `json.Unmarshal` needs a pointer to the value to decode JSON into. + +### Pointers to pointers + +Returning to the original question, both `result1` and `result2` are declared as `*Result`, that is, pointers to a `Result` value. We established that you have to pass the address of caller’s value to `json.Unmarshal` otherwise it won’t be able to alter the contents of the caller’s value. Why then must we pass the address of `result1`, a `**Result`, a pointer to a pointer to a `Result`, for the operation to succeed. + +To explain this another detour is required. Consider this code: + +``` +package main + +import ( + "encoding/json" + "fmt" +) + +type Result struct { + Foo *string `json:"foo"` +} + +func main() { + content := []byte(`{"foo": "bar"}`) + var result1 *Result + + err := json.Unmarshal(content, &result1) + fmt.Printf("%#v %v", result1, err) // &main.Result{Foo:(*string)(0xc0000102f0)} +} +``` + +In this example `Result` contains a pointer typed field, `Foo *string`. During JSON decoding `Unmarshal` allocated a new `string` value, stored the value `bar` in it, then placed the address of the string in `Result.Foo`. This behaviour is quite handy as it frees the caller from having to initialise `Result.Foo` and makes it easier to detect when a field was not initialised because the JSON did not contain a value. Beyond the convenience this offers for simple examples it would be prohibitively difficult for the caller to properly initialise all the reference type fields in a structure before decoding unknown JSON without first inspecting the incoming JSON which itself may be problematic if the input is coming from an `io.Reader` without the ability to rewind the input. + +> To unmarshal JSON into a pointer, Unmarshal first handles the case of the JSON being the JSON literal null. In that case, Unmarshal sets the pointer to nil. Otherwise, Unmarshal unmarshals the JSON into the value pointed at by the pointer. **If the pointer is nil, Unmarshal allocates a new value for it to point to**. + +`json.Unmarshal`‘s handling of pointer fields is clearly documented, and works as you would expect, allocating a new value whenever there is a need to decode into a pointer shaped field. It is this behaviour that gives us a hint to what is happening in the original example. + +We’ve seen that when `json.Unmarshal` encounters a field which points to `nil` it will allocate a new value of the correct type and assign its address the field before proceeding. Not only is does behaviour is applied recursively–for example in the case of a complex structure which contains pointers to other structures–but it also applies to the _value passed to `Unmarshal`._ + +``` +package main + +import ( + "encoding/json" + "fmt" +) + +func main() { + content := []byte(`1`) + var result *int + + err := json.Unmarshal(content, &result) + fmt.Println(*result, err) // 1 +} +``` + +In this example `result` is not a struct, but a simple `*int` which, lacking an initialiser, defaults to `nil`. After JSON decoding, `result` now points to an `int` with the value `1`. + +### Putting the pieces together + +Now I think I’m ready to take a shot at answering Fatih’s question. + +`json.Unmarshal` requires the address of the variable you want to decode into, otherwise it would decode into a temporary copy which would be discard on return. Normally this is done by declaring a value, then passing its address, or explicitly initialising the the value + +``` +var result1 Result +err := json.Unmarshal(content, &result1) // this is fine + +var result2 = new(Result) +err = json.Unmarshal(content, result2) // and this + +var result3 = &Result{} +err = json.Unmarshal(content, result3) // this is also fine +``` + +In all three cases the address that the `*Result` points too is not `nil`, it points to initialised memory that `json.Unmarshal` decodes into. + +Now consider what happens when `json.Unmarshal` encounters this + +``` +var result4 *Result +err = json.Unmarshal(content, result4) // err json: Unmarshal(nil *main.Result) +``` + +`result2`, `result3`, and the expression `&result1` point to a `Result`. However `result4`, even though it has the same type as the previous three, does not point to initialised memory, it points to `nil`. Thus, according to the examples we saw previously, before `json.Unmarshal` can decode into it, the memory `result4` points too must be initialised. + +However, because each function receives a copy of its arguments, the caller’s `result4` variable and the copy inside `json.Unmarshal` are unique. `json.Unmarshal` can allocate a new `Result` value and decode into it, but it cannot alter `result4` to point to this new value because it was not provided with a reference to `result4`, only a copy of its contents. + + 1. This does not violate the _everything is a copy_ rule, a copy of a pointer to `main.v` still points to `main.v`.[][4] + + + +#### Related posts: + + 1. [Should methods be declared on T or *T][5] + 2. [Ice cream makers and data races][6] + 3. [Understand Go pointers in less than 800 words or your money back][7] + 4. [Slices from the ground up][8] + + + +-------------------------------------------------------------------------------- + +via: https://dave.cheney.net/2020/05/16/fatihs-question + +作者:[Dave Cheney][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://dave.cheney.net/author/davecheney +[b]: https://github.com/lujun9972 +[1]: https://twitter.com/fatih/status/1260683136842608640 +[2]: https://play.golang.org/p/g2yUIYrV67F +[3]: tmp.dRxkHxYRQS#easy-footnote-bottom-1-4153 (This does not violate the everything is a copy rule, a copy of a pointer to main.v still points to main.v.) +[4]: tmp.dRxkHxYRQS#easy-footnote-1-4153 +[5]: https://dave.cheney.net/2016/03/19/should-methods-be-declared-on-t-or-t (Should methods be declared on T or *T) +[6]: https://dave.cheney.net/2014/06/27/ice-cream-makers-and-data-races (Ice cream makers and data races) +[7]: https://dave.cheney.net/2017/04/26/understand-go-pointers-in-less-than-800-words-or-your-money-back (Understand Go pointers in less than 800 words or your money back) +[8]: https://dave.cheney.net/2018/07/12/slices-from-the-ground-up (Slices from the ground up) diff --git a/sources/tech/20200518 Using Fedora to implement REST API in JavaScript- part 2.md b/sources/tech/20200518 Using Fedora to implement REST API in JavaScript- part 2.md new file mode 100644 index 0000000000..b02822c4fa --- /dev/null +++ b/sources/tech/20200518 Using Fedora to implement REST API in JavaScript- part 2.md @@ -0,0 +1,208 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Using Fedora to implement REST API in JavaScript: part 2) +[#]: via: (https://fedoramagazine.org/using-fedora-to-implement-rest-api-in-javascript-part-2/) +[#]: author: (Vaclav Keil https://fedoramagazine.org/author/vaclavk/) + +Using Fedora to implement REST API in JavaScript: part 2 +====== + +![][1] + +In [part 1][2] previously, you saw how to quickly create a simple API service using Fedora Workstation, Express, and JavaScript. This article shows you the simplicity of how to create a new API. This part shows you how to: + + * Install a DB server + * Build a new route + * Connect a new datasource + * Use Fedora terminal to send and receive data + + + +### Generating an app + +Please refer to the [previous article][2] for more details. But to make things simple, change to your work directory and generate an app skeleton. +``` + +``` + +$ cd our-work-directory +$ npx express-generator –no-view –git /myApp +$ cd myApp +$ npm i +``` + +``` + +### Installing a database server + +In this part, we’ll install MariaDB database. MariaDB is the Fedora default database. + +``` +$ dnf module list mariadb | sort -u ## lists the streams available +$ sudo dnf module install mariadb:10.3 ##10.4 is the latest +``` + +_Note: the default profile is mariadb/server_. + +For those who need to spin up a Docker container a ready made container with Fedora 31 is available. + +``` +$ docker pull registry.fedoraproject.org/f31/mariadb +$ docker run -d --name mariadb_database -e MYSQL_USER=user -e MYSQL_PASSWORD=pass -e MYSQL_DATABASE=db -p 3306:3306 registry.fedoraproject.org/f31/mariadb +``` + +Now start the MariaDB service. + +``` +$ sudo systemctl start mariadb +``` + +If you’d like the service to start at boot, you can also enable it in systemd: + +``` +$ sudo systemctl enable mariadb ## start at boot +``` + +Next, setup the database as needed: + +``` +$ mysql -u root -p ## root password is blank +MariaDB> CREATE DATABASE users; +MariaDB> create user dbuser identified by ‘123456‘; +MariaDB> grant select, insert, update, create, drop on users.* to dbuser; +MariaDB> show grants for dbuser; +MariaDB> \q +``` + +A database connector is needed to use the database with Node.js. + +``` +$ npm install mariadb ## installs MariaDB Node.js connector +``` + +We’ll leverage Sequelize in this sample API. Sequelize is a promise-based Node.js ORM (Object Relational Mapper) for Postgres, MySQL, MariaDB, SQLite and Microsoft SQL Server. + +``` +$ npm install sequelize ## installs Sequelize +``` + +### Connecting a new datasource + +Now, create a new _db_ folder and create a new file _sequelize.js_ there: + +``` +const Sequelize = require('sequelize'), + sequelize = new Sequelize(process.env.db_name || 'users', process.env.db_user || 'dbuser', process.env.db_pass || '123456', { + host: 'localhost', + dialect: 'mariadb', + ssl: true +}) + +module.exports = sequelize +``` + +_Note: For the sake of completeness I‘m including a link to the related Github repo: _ + +Let‘s create a new file _models/user.js_. A nice feature of a Sequelize model is that it helps us to create the necessary tables and colums automatically. The code snippet responsible for doing this is seen below: + +``` +sequelize.sync({ +force: false +}) +``` + +Note: never switch to true with a production database – it would _drop your tables at app start_! + +We will refer to the earlier created sequelize.js this way: + +``` +const sequelize = require('../db/sequelize') +``` + +### Building new routes + +Next, you’ll create a new file _routes/user.js_. You already have _routes/users.js_ from the previous article. You can copy and paste the code in and proceed with editing it. + +You’ll also need a reference to the previously created model. + +``` +const User = require('../models/user') +``` + +Change the route path to _/users_ and also create a new **post** method route. + +Mind the async – await keywords there. An interaction with a database will take some time and this one will do the trick. Yes, an async function returns a promise and this one makes promises easy to use. + +_Note: This code is not production ready, since it would also need to include an authentication feature._ + +We‘ll make the new route working this way: + +``` +const userRouter = require('./routes/user') +app.use(userRouter) +``` + +Let‘s also remove the existing _usersRouter_. The _routes/users.js_ can be deleted too. + +``` +$ npm start +``` + +With the above command, you can launch your new app. + +### Using the terminal to send and retrieve data + +Let’s create a new database record through the post method: + +``` +$ curl -d 'name=Adam' http://localhost:3000/users +``` + +To retrieve the data created through the API, do an HTTP GET request: + +``` +$ curl http://localhost:3000/users +``` + +The console output of the curl command is a JSON array containing data of all the records in the _Users_ table. + +_Note: This is not really the usual end result — an application consumes the API finally. The API will usually also have endpoints to update and remove data._ + +### More automation + +Let‘s assume we might want to create an API serving many tables. It‘s possible and very handy to automatically generate models for Sequelize from our database. Sequelize-auto will do the heavy lifting for us. The resulting files (_models.js_) would be placed and imported within the _/models_ directory. + +``` +$ npm install sequelize-auto +``` + +A node.js connector is needed to use this one and we have it already installed for MariaDB. + +### Conclusion + +It‘s possible to develop and run an API using Fedora, Fedora default MariaDB, JavaScript and efficiently develop a solution like with a noSQL database. For those used to working with MongoDB or a similar noSQL database, Fedora and MariaDB are important open-source enablers. + +* * * + +_Photo by [Mazhar Zandsalimi][3] on [Unsplash][4]._ + +-------------------------------------------------------------------------------- + +via: https://fedoramagazine.org/using-fedora-to-implement-rest-api-in-javascript-part-2/ + +作者:[Vaclav Keil][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://fedoramagazine.org/author/vaclavk/ +[b]: https://github.com/lujun9972 +[1]: https://fedoramagazine.org/wp-content/uploads/2020/05/javascript-api-2-816x345.jpg +[2]: https://fedoramagazine.org/using-fedora-to-quickly-implement-rest-api-with-javascript/ +[3]: https://unsplash.com/@m47h4r?utm_source=unsplash&utm_medium=referral&utm_content=creditCopyText +[4]: https://unsplash.com/s/photos/javascript?utm_source=unsplash&utm_medium=referral&utm_content=creditCopyText diff --git a/sources/tech/20200519 How to use Windows Subsystem for Linux to open Linux on Windows 10 machines.md b/sources/tech/20200519 How to use Windows Subsystem for Linux to open Linux on Windows 10 machines.md new file mode 100644 index 0000000000..e610f7eb2f --- /dev/null +++ b/sources/tech/20200519 How to use Windows Subsystem for Linux to open Linux on Windows 10 machines.md @@ -0,0 +1,153 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How to use Windows Subsystem for Linux to open Linux on Windows 10 machines) +[#]: via: (https://www.networkworld.com/article/3543845/how-to-use-windows-subsystem-for-linux-to-open-linux-on-windows-10-machines.html) +[#]: author: (Sandra Henry-Stocker https://www.networkworld.com/author/Sandra-Henry_Stocker/) + +How to use Windows Subsystem for Linux to open Linux on Windows 10 machines +====== +Opening a Linux terminal on a Windows 10 desktop can help you practice your Linux skills and explore Windows from an entirely different point of view. In this post, we look at Ubuntu 18.04 running through Windows Subsystem for Linux (WSL). +[Nicolas Solerieu modified by IDG Comm. / Linux][1] [(CC0)][2] + +Believe it or not, it's possible to open a Linux terminal on a Windows 10 system and you might be surprised how much Linux functionality you’ll be able to get by doing so. + +You can run Linux commands, traipse around the provided Linux file system and even take a novel look at Windows files. The experience isn’t altogether different than opening a terminal window on a Linux desktop, with a few interesting exceptions. + +[[Get regularly scheduled insights by signing up for Network World newsletters.]][3] + +What is needed to make this happen is something called the Windows Subsystem for Linux (WSL) and a Windows 10 x86 PC. + +### Linux versions for WSL + +There are a number of options for running Linux on top of Windows. The Linux OS choices include: + + * [Ubuntu 16.04 LTS][4] + * [Ubuntu 18.04 LTS][5] + * [openSUSE Leap 15.1][6] + * [SUSE Linux Enterprise Server 12 SP5][7] + * [SUSE Linux Enterprise Server 15 SP1][8] + * [Kali Linux][9] + * [Debian GNU/Linux][10] + * [Fedora Remix for WSL][11] + * [Pengwin][12] + * [Pengwin Enterprise][13] + * [Alpine WSL][14] + + + +Ubuntu 18.04 LTS is just one option and, in this post, we’ll take a look at how the terminal runs on Windows using this particular distribution and how much it feels like working on a Linux system directly. + +If you want to look into the process of putting an Ubuntu distribution on your Windows system, you can start with this page: + + + +As part of the initial setup of installing your Linux on Windows terminal, you’ll be asked to create your user account. Once you do that and open the terminal, you can start to explore. One of the most noticeable differences between your Linux-on-Windows terminal and a terminal window on a Linux system is that examining processes isn’t going to show you much. After all, Windows will be providing the bulk of the required OS support. You’re likely to see something like this: + +``` +myacct@hostname:~$ ps -ef +UID PID PPID C STIME TTY TIME CMD +root 1 0 0 12:45 ? 00:00:00 /init +root 7 1 0 12:45 tty1 00:00:00 /init +shs 8 7 0 12:45 tty1 00:00:00 -bash +shs 166 8 0 13:32 tty1 00:00:00 ps -ef +``` + +Yes, that's it. + +If you’re anything like me, one of your next moves might be to get a handle on the available commands. If you just count the files in the **/bin** and **/usr/bin** directories, you should see that there are a lot of commands: + +``` +myacct@hostname:~$ ls /bin | wc -l +171 +myacct@hostname:~$ ls /usr/bin | wc -l +707 +``` + +You can list available commands with commands like these (output truncated for this post): + +``` +myacct@hostname:~$ ls /bin | head -25 | column +bash btrfs-map-logical bunzip2 bzegrep bzip2recover +btrfs btrfs-select-super busybox bzexe bzless +btrfs-debug-tree btrfs-zero-log bzcat bzfgrep bzmore +btrfs-find-root btrfsck bzcmp bzgrep cat +btrfs-image btrfstune bzdiff bzip2 chacl + +myacct@hostname:~$ ls /usr/bin | head -25 | column +NF aa-exec apport-cli apt apt-extracttempl* +VGAuthService acpi_listen apport-collect apt-add-repository apt-ftparchive +X11 add-apt-repository apport-unpack apt-cache apt-get +[ addpart appres apt-cdrom apt-key +aa-enabled apport-bug apropos apt-config apt-mark +``` + +You can update the system with **apt** commands (sudo apt update, sudo apt upgrade). You can even use Linux commands to move to the Windows disk partitions as you like and . Notice the last three entries in the output below. These represent several drives on the system. + +``` +myacct@hostname:~$ df -k +Filesystem 1K-blocks Used Available Use% Mounted on +rootfs 973067784 326920584 646147200 34% / +none 973067784 326920584 646147200 34% /dev +none 973067784 326920584 646147200 34% /run +none 973067784 326920584 646147200 34% /run/lock +none 973067784 326920584 646147200 34% /run/shm +none 973067784 326920584 646147200 34% /run/user +cgroup 973067784 326920584 646147200 34% /sys/fs/cgroup +C:\ 973067784 326920584 646147200 34% /mnt/c <== C drive +I:\ 976760000 231268208 745491792 24% /mnt/I <== external drive +L:\ 409599996 159240 409440756 1% /mnt/l <== USB thumb drive +``` + +If you’re interested in moving out of the Linux space and into the Windows portion of the file system within your **WSL** session, you can do that easily. Replace “myname” with your Windows account name and a **cd /mnt/c/Users/_myname_/Desktop** will take you to your Windows desktop. From there, don’t be surprised if in listing your files you see **WRL####.tmp** files that don’t seem to exist when you look at your desktop and don’t show up if you look at your files by opening a command prompt. These appear to be temporary files used by Windows for document management. You might also see files listed that look like **‘~$nux notes.docx’** – perhaps ghosts of files that were once located on your desktop. You won’t see those files when you look at your desktop on Windows – even using a **cmd** window. + +Note that you’ll also see Windows directories such as **‘Program Files’** in single quotes when listed in your Linux terminal as you would any file with blanks included in their names. You can even start a Windows executable from your Linux terminal. For example: + +``` +myacct@hostname: $ cd /mnt/c/WINDOWS/System32/WindowsPowerShell/v1.0 +myacct@hostname: $ powershell.exe +``` + +If you do this, type **exit** when you want to end the **powershell** session. + +Linux commands all seem to work as expected, though I don’t get any output when I run the **who** command. + +Windows **.txt** files will display with **cat** commands, but the last line in a file will likely be displayed on the same line as the following shell prompt. This is because these files won’t end with a linefeed as Linux text files do. + +You can create other accounts and switch user to them (e.g., **su – nemo**) if you like, but not log into them directly. + +You can also update the system with apt commands (**sudo apt update**, **sudo apt upgrade**). + +Join the Network World communities on [Facebook][15] and [LinkedIn][16] to comment on topics that are top of mind. + +-------------------------------------------------------------------------------- + +via: https://www.networkworld.com/article/3543845/how-to-use-windows-subsystem-for-linux-to-open-linux-on-windows-10-machines.html + +作者:[Sandra Henry-Stocker][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.networkworld.com/author/Sandra-Henry_Stocker/ +[b]: https://github.com/lujun9972 +[1]: https://unsplash.com/photos/4gRNmhGzYZE +[2]: https://creativecommons.org/publicdomain/zero/1.0/ +[3]: https://www.networkworld.com/newsletters/signup.html +[4]: https://www.microsoft.com/store/apps/9pjn388hp8c9 +[5]: https://www.microsoft.com/store/apps/9N9TNGVNDL3Q +[6]: https://www.microsoft.com/store/apps/9NJFZK00FGKV +[7]: https://www.microsoft.com/store/apps/9MZ3D1TRP8T1 +[8]: https://www.microsoft.com/store/apps/9PN498VPMF3Z +[9]: https://www.microsoft.com/store/apps/9PKR34TNCV07 +[10]: https://www.microsoft.com/store/apps/9MSVKQC78PK6 +[11]: https://www.microsoft.com/store/apps/9n6gdm4k2hnc +[12]: https://www.microsoft.com/store/apps/9NV1GV1PXZ6P +[13]: https://www.microsoft.com/store/apps/9N8LP0X93VCP +[14]: https://www.microsoft.com/store/apps/9p804crf0395 +[15]: https://www.facebook.com/NetworkWorld/ +[16]: https://www.linkedin.com/company/network-world diff --git a/sources/tech/20200520 Fedora Silverblue, an introduction for developers.md b/sources/tech/20200520 Fedora Silverblue, an introduction for developers.md new file mode 100644 index 0000000000..a112f4ca6d --- /dev/null +++ b/sources/tech/20200520 Fedora Silverblue, an introduction for developers.md @@ -0,0 +1,140 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Fedora Silverblue, an introduction for developers) +[#]: via: (https://fedoramagazine.org/fedora-silverblue-brings-future-tech-to-the-desktop/) +[#]: author: (Nick Hardiman https://fedoramagazine.org/author/nickhardiman/) + +Fedora Silverblue, an introduction for developers +====== + +![][1] + +The Fedora [Silverblue project][2] takes Fedora workstation, libostree and podman, puts them in a blender, and creates a new Immutable Fedora Workstation. Fedora Silverblue is an OS that stops you from changing the core system files arbitrarily, and readily allows you to change the environment system files. The article [What is Silverblue][3] describes the big picture, and this article drills down into details for the developer. + +Fedora Silverblue ties together a few different projects to make a system that is a git-like object, capable of layering packages, and has a container focused work flow. Silverblue is not the only distribution going down this road. It is the desktop equivalent of [CoreOS][4], the server OS used by [Red Hat Openshift][5]. + +Silverblue’s idea of ‘immutable’ has nothing to do with immutable layers in a container. Silverblue keeps system files immutable by making them read-only. + +### Why immutable? + +Has an upgrade left your system in an unusable state? Have you wondered why one server in a pool of identical machines is being weird? These problems can happen when one system library – one tiny little file out of hundreds – is corrupted, badly configured or the wrong version. Or maybe your upgrade works fine but it’s not what you’d hoped for, and you want to roll back to the previous state. + +An immutable OS is intended to stop problems like these biting you. This is not an easy thing to achieve – simple changes, like flipping the file system between read-write and read-only, may only change a fault-finding headache to a maintenance headache. + +Freezing the system is good news for sysadmins, but what about developers? Setting up a development environment means heavily customizing the system, and filling it with living code that changes over time. The answer is partly a case of combining components, and partly the ability to swap between OS versions. + +### How it works + +So how do you get the benefits of immutability without losing the ability to do your work? If you’re thinking ‘containers’, good guess – part of the solution uses [podman][6]. But much of the work happens underneath the container layer, at the OS level. + +Fedora Silverblue ties together a few different projects to turn an immutable OS into a usable workstation. Silverblue uses libostree to provide the base system, lets you edit config files in /etc/, and provides three different ways to install packages. + + * [rpm-ostree][7] installs RPM packages, similar to DNF in the traditional Fedora workstation. Use this for things that shouldn’t go in containers, like KVM/libvirt. + * [flatpak][8] installs packages from a central flathub repo. This is the one-stop shop for graphical desktop apps like LibreOffice. + * The traditional _dnf install_ still works, but only inside a [toolbox][9] (a Fedora container). A developer’s workbench goes in a toolbox. + + + +If you want to know more about these components, check out [Pieces of Silverblue][10]. + +### Rolling back and pinning upgrades + +All operating systems need upgrades. Features are added, security holes are plugged and bugs are squashed. But sometimes an upgrade is not a developer’s friend. + +A developer depends on many things to get the job done. A good development environment is stuffed with libraries, editors, toolchains and apps that are controlled by the OS, not the developer. An upgrade may cause trouble. Have any of these situations happened to you? + + * A new encryption library is too strict, and an upgrade stopped an API working. + * Code works well, but has deprecated syntax. An upgrade brought error-throwing misery. + * The development environment is lovingly hand-crafted. An upgrade broke dependencies and added conflicts. + + + +In a traditional environment, unpicking a troublesome upgrade is hard. In Silverblue, it’s easy. Silverblue keeps two copies of the OS – your current upgrade and your previous version. Point the OS at the previous version, reboot, and you’ve got your old system files back. + +You aren’t limited to two copies of your file system – you can keep more by pinning your favorite versions. Dusty Mabe, one of the engineers who has been working on the system since the [Project Atomic][11] days, describes how to pin extra copies of the OS in his article [Pinning Deployments in OSTree Based Systems][12]. + +Your home directory is not affected by rolling back. Rpm-ostree does not touch /etc/ and /var/. + +### System updates and package installs + +Silverblue’s rpm-ostree treats all the files as one object, stored in a repository. The working file system is a checked-out copy of this object. After a system update, you get two objects in that repository – one current object and one updated object. The updated object is checked out and becomes the new file system. + +You install your workhorse applications in toolboxes, which provide container isolation. And you install your desktop applications using Flatpak. + +This new OS requires a shift in approach. For instance, you don’t have to keep only one copy of your system files – you can store a few and select which one you use. That means you can swap back and forth between an old Fedora release and the rawhide (development) version in a matter of minutes. + +### Build your own Silverblue VM + +You can safely install Fedora Silverblue in a VM on your workstation. If you’ve got a hypervisor and half an hour to spare (10 minutes for ISO download, and 20 minutes for the build), you can see for yourself. + + 1. Download Fedora Silverblue ISO from + 2. (not Fedora workstation from ). + 3. Boot a VM with the Fedora Silverblue ISO. You can squeeze Fedora into compute resources of 1 CPU, 1024MiB of memory and 12GiB of storage, but bigger is better. + 4. Answer [Anaconda][13]’s questions. + 5. Wait for the [Gnome][14] desktop to appear. + 6. Answer [Initial Setup][15]’s questions. + + + +Then you’re ready to set up your developer’s tools. If you’re looking for an IDE, check these out. Use flatpak on the desktop to install them. + + * [Gnome Builder][16] (Gnome’s official IDE) + * [Eclipse][17] + * [Code::Blocks][18] + + + +Finally, use the CLI to create your first toolbox. Load it with modules using [npm][19], [gem][20], [pip][21], [git][22] or your other favorite tools. + +### Help! + +If you get stuck, ask questions at the [forum][23]. + +If you’re looking for ideas about how to use Silverblue, read articles in the [magazine][24]. + +### Is Silverblue for you? + +Silverblue is full of shiny new tech. That in itself is enough to attract the cool kids, like moths to a flame. But this OS is not for everyone. It’s a young system, so some bugs will still be lurking in there. And pioneering tech requires a change of habit – that’s extra cognitive load that the new user may not want to take on. + +The OS brings immutable benefits, like keeping your system files safe. It also brings some drawbacks, like the need to reboot after adding system packages. Silverblue also enables new ways of working. If you want to explore new directions in the OS, find out if Silverblue brings benefits to your work. + +-------------------------------------------------------------------------------- + +via: https://fedoramagazine.org/fedora-silverblue-brings-future-tech-to-the-desktop/ + +作者:[Nick Hardiman][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://fedoramagazine.org/author/nickhardiman/ +[b]: https://github.com/lujun9972 +[1]: https://fedoramagazine.org/wp-content/uploads/2020/04/silverblue-introfordev-816x345.png +[2]: https://silverblue.fedoraproject.org/ +[3]: https://fedoramagazine.org/what-is-silverblue/ +[4]: http://coreos.com/ +[5]: https://www.openshift.com/products/container-platform +[6]: https://github.com/containers/libpod +[7]: https://rpm-ostree.readthedocs.io/en/latest/ +[8]: https://docs.flatpak.org/en/latest/ +[9]: https://github.com/containers/toolbox +[10]: https://fedoramagazine.org/pieces-of-fedora-silverblue/ +[11]: https://www.projectatomic.io/ +[12]: https://www.projectatomic.io/blog/2018/05/pinning-deployments-ostree-based-systems/ +[13]: https://fedoraproject.org/wiki/Anaconda +[14]: https://www.gnome.org/ +[15]: https://fedoraproject.org/wiki/InitialSetup +[16]: https://wiki.gnome.org/Apps/Builder +[17]: https://www.eclipse.org/ide/ +[18]: http://www.codeblocks.org/ +[19]: https://www.npmjs.com/package/package +[20]: https://rubygems.org/ +[21]: https://pypi.org/ +[22]: https://git-scm.com/ +[23]: https://discussion.fedoraproject.org/c/desktop/silverblue/6 +[24]: https://fedoramagazine.org/?s=silverblue diff --git a/sources/tech/20200521 Glico (Weighted Rock Paper Scissors).md b/sources/tech/20200521 Glico (Weighted Rock Paper Scissors).md new file mode 100644 index 0000000000..77e3cfb5ed --- /dev/null +++ b/sources/tech/20200521 Glico (Weighted Rock Paper Scissors).md @@ -0,0 +1,141 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Glico (Weighted Rock Paper Scissors)) +[#]: via: (https://theartofmachinery.com/2020/05/21/glico_weighted_rock_paper_scissors.html) +[#]: author: (Simon Arneaud https://theartofmachinery.com) + +Glico (Weighted Rock Paper Scissors) +====== + +This still isn’t the blog post I said I was going to write about now, but I figured some game theory would make a good post at the moment, especially when a lot of people I know are working at home with kids who need entertaining. Here’s some stuff about a traditional Japanese kids’ game called Glico, a form of weighted Rock Paper Scissors (RPS). + +### Glico + +I’ll assume you’re familiar with regular RPS. It’s pretty obvious how to play well: the three plays, “rock”, “paper” and “scissors”, are equally strong, so the only trick is to play them unpredictably enough. + +But what happens if the three plays have different values? Weighted RPS, under the name “Glico”, has been a well-known Japanese children’s game since at least before WWII, but let me explain an English adaptation. Traditionally it’s played starting at the bottom of a flight of stairs, and the aim is to get to the top first. Players can climb up steps by winning rounds of RPS. The trick is that the number of steps depends on the winning hand in each round. A player who wins with “rock” gets to climb up four steps by spelling out R-O-C-K, and similarly “paper” is worth five steps and “scissors” worth eight. This simple twist to the game creates whole new layers of offence and defence as players struggle to win with “scissors” as much as possible, without being too predictable and vulnerable. + +(The rules for the Japanese version vary by region, but usually “rock” is worth 3 steps, while “paper” and “scissors” are worth 6. The mnemonic is that “rock”, “paper” and “scissors” are referred to as グー, パー and チョキ respectively, and the words spelled out when playing are グリコ (“Glico”, a food/confectionary brand), パイナップル (pineapple) and チョコレート (chocolate).) + +Just a few notes before getting into the maths: The game works best with two players, but in the traditional rules for three or more players, each round is handled by having multiple rematches. Each time there’s a clear winning hand (e.g., two players with “paper” beating one with “rock”) the losers are eliminated until there’s one winner. That can take a long time, so cycling systematically between pairs of players might be faster for several players. (I’ll assume two players from now on.) Also, older kids sometimes add an extra challenge by requiring an exact landing at the top of the stairs to win. For example, if you’re five steps from the top, only “paper” will win; “scissors” will overshoot by three steps, and you’ll end up three steps back down from the top. Be warned: that makes gameplay a lot harder. + +### Calculating the optimal strategy + +Simple strategies like “just play rock” are what game theorists call “pure strategies”. By design, no pure strategy in RPS is better than all others, and an adaptive opponent can quickly learn to exploit any pure strategy (e.g., by always playing “paper” against someone who always plays “rock”). Any decent player will play RPS with something like a “mixed strategy” (selecting from the pure strategies at random, maybe with different probabilities). Game theory tells us that finite, two-player, zero-sum games always have optimal mixed strategies — i.e., a mixed strategy that’s as good or better than any other, even against an adaptive opponent. You might do better by exploiting a weak opponent, but you can’t do better against a perfect one. In plain RPS, the statistically unbeatable strategy is to play each hand with equal probability (\frac{1}{3}). + +Glico is made up of multiple rounds of weighted RPS. A truly optimal player won’t just use one set of probabilities (p_{r}), (p_{p}) and (p_{s}) for playing “rock”, “paper” and “scissors” each round. The optimal probabilities will vary depending the position of both players on the stairs. For example, a player who is four steps from winning is either happy with any winning hand, or only wants “rock”, depending on the rules, and (theoretically) both players should recognise that and adapt their probabilities accordingly. However, it’s more practical to play with an optimal greedy strategy — i.e., assuming everyone is just trying to get the maximum step value each round. + +I’ll calculate an optimal greedy strategy for weighted RPS in two ways. One way is longer but uses nothing but high school algebra and logical thinking, while the other way uses the power of linear programming. + +#### The longer way + +The greedy version of Glico has no end goal; the players are just trying to win points. It helps with solving the game if we make it zero sum — any time you win (N) points, your opponent loses (N) points, and vice versa. That just scales and shifts the score per round, so it doesn’t change the optimal strategy. Why do it? We know that optimal players can’t get any advantage over each other because the game is symmetric. If the game is zero sum, that means that no strategy can have an expected value of more than 0 points. That lets us write some equations. For example, playing “rock” might win you 4 points against “scissors”, or lose you 5 against “paper”. Against an optimal opponent, we can say + +[4p_{s} - 5p_{p} \leq 0] + +Is the inequality necessary? When would a pure strategy have a negative value against a non-adaptive but optimal player? Imagine if we added a fourth pure strategy, “bomb”, that simply gave 1000 points to the opponent. Obviously no optimal player would ever play “bomb”, so (p_{b} = 0). Playing “bomb” against an optimal player would have expected value -1000. We can say that some pure strategies are just _bad_: they have suboptimal value against an optimal opponent, and an optimal player will never play them. Other pure strategies have optimal value against an optimal opponent, and they’re reasonable to include in an optimal strategy. + +Bad pure strategies aren’t always as obvious as “bomb”, but we can argue that none of the pure strategies in RPS are bad. “Rock” is the only way to beat “scissors”, and “paper” is the only way to beat “rock”, and “scissors” is the only way to beat “paper”. At least one must be in the optimal strategy, so we can expect them all to be. So let’s make that (\leq) into (=), and add the equations for playing “paper” and “scissors”, plus the fact that these are probabilities that add up to 1: + +[\begin{matrix} {4p_{s} - 5p_{p}} & {= 0} \ {5p_{r} - 8p_{s}} & {= 0} \ {8p_{p} - 4p_{r}} & {= 0} \ {p_{r} + p_{p} + p_{s}} & {= 1} \ \end{matrix}] + +That’s a system of linear equations that can be solved algorithmically using Gaussian elimination — either by hand or by using any good numerical algorithms software. I won’t go into the details, but here’s the solution: + +[\begin{matrix} p_{r} & {= 0.4706} \ p_{p} & {= 0.2353} \ p_{s} & {= 0.2941} \ \end{matrix}] + +Even though it’s worth the least, an optimal player will play “rock” almost half the time to counterattack “scissors”. The rest of the time is split between “paper” and “scissors”, with a slight bias towards “scissors”. + +#### The powerful way + +The previous solution needed special-case analysis: it exploited the symmetry of the game, and made some guesses about how good/bad the pure strategies are. What about games that are more complex, or maybe not even symmetric (say, because one player has a handicap)? There’s a more general solution using what’s called linear programming (which dates to when “programming” just meant “scheduling” or “planning”). + +By the way, linear programming (LP) has a funny place in computer science. There are some industries and academic circles where LP and generalisations like mixed integer programming are super hot. Then there are computer science textbooks that never even mention them, so there are industries where the whole topic is pretty much unheard of. It might be because it wasn’t even known for a long time if LP problems can be solved in polynomial time (they can), so LP doesn’t have the same theoretical elegance as, say, shortest path finding, even if it has a lot of practical use. + +Anyway, solving weighted RPS with LP is pretty straightforward. We just need to describe the game using a bunch of linear inequalities in multiple variables, and express strategic value as a linear function that can be optimised. That’s very similar to what was done before, but this time we won’t try to guess at the values of any strategies. We’ll just assume we’re choosing values (p_{r}), (p_{p}) and (p_{s}) to play against an opponent who scores an average (v) against us each round. The opponent is smart enough to choose a strategy that’s as least as good as any pure strategy, so we can say + +[\begin{matrix} {4p_{s} - 5p_{p}} & {\leq v} \ {5p_{r} - 8p_{s}} & {\leq v} \ {8p_{p} - 4p_{r}} & {\leq v} \ \end{matrix}] + +The opponent can only play some combination of “rock”, “paper” and “scissors”, so (v) can’t be strictly greater than all of them — at least one of the inequalities above must be tight. To model the gameplay fully, the only other constraints we need are the rules of probability: + +[\begin{matrix} {p_{r} + p_{p} + p_{s}} & {= 1} \ p_{r} & {\geq 0} \ p_{p} & {\geq 0} \ p_{s} & {\geq 0} \ \end{matrix}] + +Now we’ve modelled the problem, we just need to express what needs to be optimised. That’s actually dead simple: we just want to minimise (v), the average score the opponent can win from us. An LP solver can find a set of values for all variables that minimises (v) within the constraints, and we can read off the optimal strategy directly. + +I’ve tried a few tools, and the [Julia][1] library [JuMP][2] has my current favourite FOSS API for throwaway optimisation problems. Here’s some code: + +``` +# You might need Pkg.add("JuMP"); Pkg.add("GLPK") +using JuMP +using GLPK + +game = Model(GLPK.Optimizer) + +@variable(game, 0 <= pr <= 1) +@variable(game, 0 <= pp <= 1) +@variable(game, 0 <= ps <= 1) +@variable(game, v) + +@constraint(game, ptotal, pr + pp + ps == 1) +@constraint(game, rock, 4*ps - 5*pp <= v) +@constraint(game, paper, 5*pr - 8*ps <= v) +@constraint(game, scissors, 8*pp - 4*pr <= v) + +@objective(game, Min, v) + +println(game) +optimize!(game) + +println("Opponent's value: ", value(v)) +println("Rock: ", value(pr)) +println("Paper: ", value(pp)) +println("Scissors: ", value(ps)) +``` + +Here’s the output: + +``` +Min v +Subject to + ptotal : pr + pp + ps = 1.0 + rock : 4 ps - 5 pp - v ≤ 0.0 + paper : 5 pr - 8 ps - v ≤ 0.0 + scissors : 8 pp - 4 pr - v ≤ 0.0 + pr ≥ 0.0 + pp ≥ 0.0 + ps ≥ 0.0 + pr ≤ 1.0 + pp ≤ 1.0 + ps ≤ 1.0 + +Opponent's value: 0.0 +Rock: 0.47058823529411764 +Paper: 0.23529411764705882 +Scissors: 0.29411764705882354 +``` + +As argued in the previous solution, the best value the opponent can get against the optimal player is 0. + +### What does optimality mean? + +The optimal solution was calculated assuming an all-powerful opponent. It guarantees that even the best weighted RPS player can’t get an advantage over you, but it turns out you can’t get an advantage over a terrible player, either, if you insist on playing this “optimal” strategy. That’s because weighted RPS has no bad plays, in the sense that “bomb” is bad. _Any_ strategy played against the above “optimal” strategy will have expected value of 0, so it’s really a defensive, or “safe” strategy. To play truly optimally and win against a bad player, you’ll have to adapt your strategy. For example, if your opponent plays “scissors” too often and “paper” not enough, you should adapt by playing “rock” more often. Of course, your opponent might just be pretending to be weak, and could start taking advantage of your deviation from the safe strategy. + +Games don’t always work out like that. For example, in theory, you could derive an optimal safe strategy for more complex games like poker. Such a strategy would tend to win against normal humans because even the best normal humans make bad poker plays. On the other hand, a “shark” at the table might be able to win against the “fish” faster by exploiting their weaknesses more aggressively. If you’re thinking of using LP to directly calculate a strategy for Texas Hold’em, though, sorry, but you’ll hit a combinatorial explosion of pure strategies as you account for all the cases like “if I’m dealt AJ on the big blind and I call a four-blind raise from the button preflop and then the flop is a rainbow 3K9…”. Only heavily simplified toy poker games are solvable with the general approach. + +-------------------------------------------------------------------------------- + +via: https://theartofmachinery.com/2020/05/21/glico_weighted_rock_paper_scissors.html + +作者:[Simon Arneaud][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://theartofmachinery.com +[b]: https://github.com/lujun9972 +[1]: https://julialang.org/ +[2]: https://github.com/JuliaOpt/JuMP.jl diff --git a/sources/tech/20200522 A beginner-s guide to web scraping with Python.md b/sources/tech/20200522 A beginner-s guide to web scraping with Python.md new file mode 100644 index 0000000000..010744161b --- /dev/null +++ b/sources/tech/20200522 A beginner-s guide to web scraping with Python.md @@ -0,0 +1,493 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (A beginner's guide to web scraping with Python) +[#]: via: (https://opensource.com/article/20/5/web-scraping-python) +[#]: author: (Julia Piaskowski https://opensource.com/users/julia-piaskowski) + +A beginner's guide to web scraping with Python +====== +Get some hands-on experience with essential Python tools to scrape +complete HTML sites. +![HTML code][1] + +There are plenty of great books to help you learn Python, but who actually reads these A to Z? (Spoiler: not me). + +Many people find instructional books useful, but I do not typically learn by reading a book front to back. I learn by doing a project, struggling, figuring some things out, and then reading another book. So, throw away your book (for now), and let's learn some Python. + +What follows is a guide to my first scraping project in Python. It is very low on assumed knowledge in Python and HTML. This is intended to illustrate how to access web page content with Python library [requests][2] and parse the content using [BeatifulSoup4][3], as well as JSON and [pandas][4]. I will briefly introduce [Selenium][5], but I will not delve deeply into how to use that library—that topic deserves its own tutorial. Ultimately I hope to show you some tricks and tips to make web scraping less overwhelming. + +### Installing our dependencies + +All the resources from this guide are available at my [GitHub repo][6]. If you need help installing Python 3, check out the tutorials for [Linux][7], [Windows][8], and [Mac][9]. + + +``` +$ python3 -m venv +$ source venv/bin/activate +$ pip install requests bs4 pandas +``` + +If you like using JupyterLab, you can run all the code using this [notebook][10]. There are a lot of ways to [install JupyterLab][11], and this is one of them: + + +``` +# from the same virtual environment as above, run: +$ pip install jupyterlab +``` + +### Setting a goal for our web scraping project + +Now we have our dependencies installed, but what does it take to scrape a webpage?  + +Let's take a step back and be sure to clarify our goal. Here is my list of requirements for a successful web scraping project. + + * We are gathering information that is worth the effort it takes to build a working web scraper. + * We are downloading information that can be legally and ethically gathered by a web scraper. + * We have some knowledge of how to find the target information in HTML code. + * We have the right tools: in this case, it's the libraries **BeautifulSoup** and **requests**. + * We know (or are willing to learn) how to parse JSON objects. + * We have enough data skills to use **pandas**. + + + +A comment on HTML: While HTML is the beast that runs the Internet, what we mostly need to understand is how tags work. A tag is a collection of information sandwiched between angle-bracket enclosed labels. For example, here is a pretend tag, called "pro-tip": + + +``` +<pro-tip> All you need to know about html is how tags work </pro-tip> +``` + +We can access the information in there ("All you need to know…") by calling its tag "pro-tip." How to find and access a tag will be addressed further in this tutorial. For more of a look at HTML basics, check out [this article][12]. + +### What to look for in a web scraping project + +Some goals for gathering data are more suited for web scraping than others. My guidelines for what qualifies as a good project are as follows. + +There is no public API available for the data. It would be much easier to capture structured data through an API, and it would help clarify both the legality and ethics of gathering the data. There needs to be a sizable amount of structured data with a regular, repeatable format to justify this effort. Web scraping can be a pain. BeautifulSoup (bs4) makes this easier, but there is no avoiding the individual idiosyncrasies of websites that will require customization. Identical formatting of the data is not required, but it does make things easier. The more "edge cases" (departures from the norm) present, the more complicated the scraping will be. + +Disclaimer: I have zero legal training; the following is not intended to be formal legal advice. + +On the note of legality, accessing vast troves of information can be intoxicating, but just because it's possible doesn't mean it should be done. + +There is, thankfully, public information that can guide our morals and our web scrapers. Most websites have a [robots.txt][13] file associated with the site, indicating which scraping activities are permitted and which are not. It's largely there for interacting with search engines (the ultimate web scrapers). However, much of the information on websites is considered public information. As such, some consider the robots.txt file as a set of recommendations rather than a legally binding document. The robots.txt file does not address topics such as ethical gathering and usage of the data. + +Questions I ask myself before beginning a scraping project: + + * Am I scraping copyrighted material? + * Will my scraping activity compromise individual privacy? + * Am I making a large number of requests that may overload or damage a server? + * Is it possible the scraping will expose intellectual property I do not own? + * Are there terms of service governing use of the website, and am I following those? + * Will my scraping activities diminish the value of the original data? (for example, do I plan to repackage the data as-is and perhaps siphon off website traffic from the original source)? + + + +When I scrape a site, I make sure I can answer "no" to all of those questions. + +For a deeper look at the legal concerns, see the 2018 publications [Legality and Ethics of Web Scraping by Krotov and Silva][14] and [Twenty Years of Web Scraping and the Computer Fraud and Abuse Act by Sellars][15]. + +### Now it's time to scrape! + +After assessing the above, I came up with a project. My goal was to extract addresses for all Family Dollar stores in Idaho. These stores have an outsized presence in rural areas, so I wanted to understand how many there are in a rather rural state. + +The starting point is the [location page for Family Dollar][16]. + +![Family Dollar Idaho locations page][17] + +To begin, let's load up our prerequisites in our Python virtual environment. The code from here is meant to be added to a Python file (_scraper.py_ if you're looking for a name) or be run in a cell in JupyterLab. + + +``` +import requests # for making standard html requests +from bs4 import BeautifulSoup # magical tool for parsing html data +import json # for parsing data +from pandas import DataFrame as df # premier library for data organization +``` + +Next, we request data from our target URL. + + +``` +page = requests.get("") +soup = BeautifulSoup(page.text, 'html.parser') +``` + +BeautifulSoup will take HTML or XML content and transform it into a complex tree of objects. Here are several common object types that we will use. + + * **BeautifulSoup**—the parsed content + * **Tag**—a standard HTML tag, the main type of bs4 element you will encounter + * **NavigableString**—a string of text within a tag + * **Comment**—a special type of NavigableString + + + +There is more to consider when we look at **requests.get()** output. I've only used **page.text()** to translate the requested page into something readable, but there are other output types: + + * **page.text()** for text (most common) + * **page.content()** for byte-by-byte output + * **page.json()** for JSON objects + * **page.raw()** for the raw socket response (no thank you) + + + +I have only worked on English-only sites using the Latin alphabet. The default encoding settings in **requests** have worked fine for that. However, there is a rich internet world beyond English-only sites. To ensure that **requests** correctly parses the content, you can set the encoding for the text: + + +``` +page = requests.get(URL) +page.encoding = 'ISO-885901' +soup = BeautifulSoup(page.text, 'html.parser') +``` + +Taking a closer look at BeautifulSoup tags, we see: + + * The bs4 element **tag** is capturing an HTML tag + * It has both a name and attributes that can be accessed like a dictionary: **tag['someAttribute']** + * If a tag has multiple attributes with the same name, only the first instance is accessed. + * A tag's children are accessed via **tag.contents**. + * All tag descendants can be accessed with **tag.contents**. + * You can always access the full contents as a string with: **re.compile("your_string")** instead of navigating the HTML tree. + + + +### Determine how to extract relevant content + +Warning: this process can be frustrating. + +Extraction during web scraping can be a daunting process filled with missteps. I think the best way to approach this is to start with one representative example and then scale up (this principle is true for any programming task). Viewing the page's HTML source code is essential. There are a number of ways to do this. + +You can view the entire source code of a page using Python in your terminal (not recommended). Run this code at your own risk: + + +``` +print(soup.prettify()) +``` + +While printing out the entire source code for a page might work for a toy example shown in some tutorials, most modern websites have a massive amount of content on any one of their pages. Even the 404 page is likely to be filled with code for headers, footers, and so on. + +It is usually easiest to browse the source code via **View Page Source** in your favorite browser (right-click, then select "view page source"). That is the most reliable way to find your target content (I will explain why in a moment). + +![Family Dollar page source code][18] + +  + +In this instance, I need to find my target content—an address, city, state, and zip code—in this vast HTML ocean. Often, a simple search of the page source (**ctrl + F**) will yield the section where my target location is located. Once I can actually see an example of my target content (the address for at least one store), I look for an attribute or tag that sets this content apart from the rest. + +It would appear that first, I need to collect web addresses for different cities in Idaho with Family Dollar stores and visit those websites to get the address information. These web addresses all appear to be enclosed in a **href** tag. Great! I will try searching for that using the **find_all** command: + + +``` +dollar_tree_list = soup.find_all('href') +dollar_tree_list +``` + +Searching for **href** did not yield anything, darn. This might have failed because **href** is nested inside the class **itemlist**. For the next attempt, search on **item_list**. Because "class" is a reserved word in Python, **class_** is used instead. The bs4 function **soup.find_all()** turned out to be the Swiss army knife of bs4 functions. + + +``` +dollar_tree_list = soup.find_all(class_ = 'itemlist') +for i in dollar_tree_list[:2]: +  print(i) +``` + +Anecdotally, I found that searching for a specific class was often a successful approach. We can learn more about the object by finding out its type and length. + + +``` +type(dollar_tree_list) +len(dollar_tree_list) +``` + +The content from this BeautifulSoup "ResultSet" can be extracted using **.contents**. This is also a good time to create a single representative example. + + +``` +example = dollar_tree_list[2] # a representative example +example_content = example.contents +print(example_content) +``` + +Use **.attr** to find what attributes are present in the contents of this object. Note: **.contents** usually returns a list of exactly one item, so the first step is to index that item using the bracket notation. + + +``` +example_content = example.contents[0] +example_content.attrs +``` + +Now that I can see that **href** is an attribute, that can be extracted like a dictionary item: + + +``` +example_href = example_content['href'] +print(example_href) +``` + +### Putting together our web scraper + +All that exploration has given us a path forward. Here's the cleaned-up version of the logic we figured out above. + + +``` +city_hrefs = [] # initialise empty list + +for i in dollar_tree_list: +    cont = i.contents[0] +    href = cont['href'] +    city_hrefs.append(href) + +#  check to be sure all went well +for i in city_hrefs[:2]: +  print(i) +``` + +The output is a list of URLs of Family Dollar stores in Idaho to scrape. + +That said, I still don't have address information! Now, each city URL needs to be scraped to get this information. So we restart the process, using a single, representative example. + + +``` +page2 = requests.get(city_hrefs[2]) # again establish a representative example +soup2 = BeautifulSoup(page2.text, 'html.parser') +``` + +![Family Dollar map and code][19] + +The address information is nested within **type= "application/ld+json"**. After doing a lot of geolocation scraping, I've come to recognize this as a common structure for storing address information. Fortunately, **soup.find_all()** also enables searching on **type**. + + +``` +arco = soup2.find_all(type="application/ld+json") +print(arco[1]) +``` + +The address information is in the second list member! Finally! + +I extracted the contents (from the second list item) using **.contents** (this is a good default action after filtering the soup). Again, since the output of contents is a list of one, I indexed that list item: + + +``` +arco_contents = arco[1].contents[0] +arco_contents +``` + +Wow, looking good. The format presented here is consistent with the JSON format (also, the type did have "**json**" in its name). A JSON object can act like a dictionary with nested dictionaries inside. It's actually a nice format to work with once you become familiar with it (and it's certainly much easier to program than a long series of RegEx commands). Although this structurally looks like a JSON object, it is still a bs4 object and needs a formal programmatic conversion to JSON to be accessed as a JSON object: + + +``` +arco_json =  json.loads(arco_contents) + +[/code] [code] + +type(arco_json) +print(arco_json) +``` + +In that content is a key called **address** that has the desired address information in the smaller nested dictionary. This can be retrieved thusly: + + +``` +arco_address = arco_json['address'] +arco_address +``` + +Okay, we're serious this time. Now I can iterate over the list store URLs in Idaho: + + +``` +locs_dict = [] # initialise empty list + +for link in city_hrefs: +  locpage = requests.get(link)   # request page info +  locsoup = BeautifulSoup(locpage.text, 'html.parser') +      # parse the page's content +  locinfo = locsoup.find_all(type="application/ld+json") +      # extract specific element +  loccont = locinfo[1].contents[0]   +      # get contents from the bs4 element set +  locjson = json.loads(loccont)  # convert to json +  locaddr = locjson['address'] # get address +  locs_dict.append(locaddr) # add address to list +``` + +### Cleaning our web scraping results with pandas + +We have loads of data in a dictionary, but we have some additional crud that will make reusing our data more complex than it needs to be. To do some final data organization steps, we convert to a pandas data frame, drop the unneeded columns "**@type**" and "**country**"), and check the top five rows to ensure that everything looks alright. + + +``` +locs_df = df.from_records(locs_dict) +locs_df.drop(['@type', 'addressCountry'], axis = 1, inplace = True) +locs_df.head(n = 5) +``` + +Make sure to save results!! + + +``` +df.to_csv(locs_df, "family_dollar_ID_locations.csv", sep = ",", index = False) +``` + +We did it! There is a comma-separated list of all the Idaho Family Dollar stores. What a wild ride. + +### A few words on Selenium and data scraping + +[Selenium][5] is a common utility for automatic interaction with a webpage. To explain why it's essential to use at times, let's go through an example using Walgreens' website. **Inspect Element** provides the code for what is displayed in a browser: + +![Walgreens location page and code][20] + +  + +While **View Page Source** provides the code for what **requests** will obtain: + +![Walgreens source code][21] + +When these two don't agree, there are plugins modifying the source code—so, it should be accessed after the page has loaded in a browser. **requests** cannot do that, but **Selenium** can. + +Selenium requires a web driver to retrieve the content. It actually opens a web browser, and this page content is collected. Selenium is powerful—it can interact with loaded content in many ways (read the documentation). After getting data with **Selenium**, continue to use **BeautifulSoup** as before: + + +``` +url = "[https://www.walgreens.com/storelistings/storesbycity.jsp?requestType=locator\&state=ID][22]" +driver = webdriver.Firefox(executable_path = 'mypath/geckodriver.exe') +driver.get(url) +soup_ID = BeautifulSoup(driver.page_source, 'html.parser') +store_link_soup = soup_ID.find_all(class_ = 'col-xl-4 col-lg-4 col-md-4') +``` + +I didn't need Selenium in the case of Family Dollar, but I do keep it on hand for those times when rendered content differs from source code. + +### Wrapping up + +In conclusion, when using web scraping to accomplish a meaningful task: + + * Be patient + * Consult the manuals (these are very helpful) + + + +If you are curious about the answer: + +![Family Dollar locations map][23] + +There are many many Family Dollar stores in America. + +The complete source code is: + + +``` +import requests +from bs4 import BeautifulSoup +import json +from pandas import DataFrame as df + +page = requests.get("") +soup = BeautifulSoup(page.text, 'html.parser') + +# find all state links +state_list = soup.find_all(class_ = 'itemlist') + +state_links = [] + +for i in state_list: +    cont = i.contents[0] +    attr = cont.attrs +    hrefs = attr['href'] +    state_links.append(hrefs) + +# find all city links +city_links = [] + +for link in state_links: +    page = requests.get(link) +    soup = BeautifulSoup(page.text, 'html.parser') +    familydollar_list = soup.find_all(class_ = 'itemlist') +    for store in familydollar_list: +        cont = store.contents[0] +        attr = cont.attrs +        city_hrefs = attr['href'] +        city_links.append(city_hrefs) +# to get individual store links +store_links = [] + +for link in city_links: +    locpage = requests.get(link) +    locsoup = BeautifulSoup(locpage.text, 'html.parser') +    locinfo = locsoup.find_all(type="application/ld+json") +    for i in locinfo: +        loccont = i.contents[0] +        locjson = json.loads(loccont) +        try: +            store_url = locjson['url'] +            store_links.append(store_url) +        except: +            pass + +# get address and geolocation information +stores = [] + +for store in store_links: +    storepage = requests.get(store) +    storesoup = BeautifulSoup(storepage.text, 'html.parser') +    storeinfo = storesoup.find_all(type="application/ld+json") +    for i in storeinfo: +        storecont = i.contents[0] +        storejson = json.loads(storecont) +        try: +            store_addr = storejson['address'] +            store_addr.update(storejson['geo']) +            stores.append(store_addr) +        except: +            pass + +# final data parsing +stores_df = df.from_records(stores) +stores_df.drop(['@type', 'addressCountry'], axis = 1, inplace = True) +stores_df['Store'] = "Family Dollar" + +df.to_csv(stores_df, "family_dollar_locations.csv", sep = ",", index = False) +``` + +\-- +_Author's note: This article is an adaptation of a [talk I gave at PyCascades][24] in Portland, Oregon on February 9, 2020._ + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/5/web-scraping-python + +作者:[Julia Piaskowski][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/julia-piaskowski +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/bus_html_code.png?itok=VjUmGsnl (HTML code) +[2]: https://requests.readthedocs.io/en/master/ +[3]: https://beautiful-soup-4.readthedocs.io/en/latest/ +[4]: https://pandas.pydata.org/ +[5]: https://www.selenium.dev/ +[6]: https://github.com/jpiaskowski/pycas2020_web_scraping +[7]: https://opensource.com/article/20/4/install-python-linux +[8]: https://opensource.com/article/19/8/how-install-python-windows +[9]: https://opensource.com/article/19/5/python-3-default-mac +[10]: https://github.com/jpiaskowski/pycas2020_web_scraping/blob/master/example/Familydollar_location_scrape-all-states.ipynb +[11]: https://jupyterlab.readthedocs.io/en/stable/getting_started/installation.html +[12]: https://opensource.com/article/20/4/build-websites +[13]: https://www.contentkingapp.com/academy/robotstxt/ +[14]: https://www.researchgate.net/publication/324907302_Legality_and_Ethics_of_Web_Scraping +[15]: https://papers.ssrn.com/sol3/papers.cfm?abstract_id=3221625 +[16]: https://locations.familydollar.com/id/ +[17]: https://opensource.com/sites/default/files/uploads/familydollar1.png (Family Dollar Idaho locations page) +[18]: https://opensource.com/sites/default/files/uploads/familydollar2.png (Family Dollar page source code) +[19]: https://opensource.com/sites/default/files/uploads/familydollar3.png (Family Dollar map and code) +[20]: https://opensource.com/sites/default/files/uploads/walgreens1.png (Walgreens location page and code) +[21]: https://opensource.com/sites/default/files/uploads/walgreens2.png (Walgreens source code) +[22]: https://www.walgreens.com/storelistings/storesbycity.jsp?requestType=locator\&state=ID +[23]: https://opensource.com/sites/default/files/uploads/family_dollar_locations.png (Family Dollar locations map) +[24]: https://2020.pycascades.com/talks/adventures-in-babysitting-webscraping-for-python-and-html-novices/ diff --git a/sources/tech/20200522 Fast data modeling with JavaScript.md b/sources/tech/20200522 Fast data modeling with JavaScript.md new file mode 100644 index 0000000000..9c565d6e90 --- /dev/null +++ b/sources/tech/20200522 Fast data modeling with JavaScript.md @@ -0,0 +1,452 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Fast data modeling with JavaScript) +[#]: via: (https://opensource.com/article/20/5/data-modeling-javascript) +[#]: author: (Szymon https://opensource.com/users/schodevio) + +Fast data modeling with JavaScript +====== +This tutorial showcases a method to model data in just a few minutes. +![Analytics: Charts and Graphs][1] + +As a backend developer at the [Railwaymen][2], a software house in Kraków, Poland, some of my tasks rely on models that manipulate and customize data retrieved from a database. When I wanted to improve my skills in frontend frameworks, I [chose Vue][3], and I thought it would be good to have a similar way to model data in a store. I started with some libraries that I found through [NPM][4], but they offered many more features than I needed. + +So I decided to build my own solution, and I was very surprised that the base took less than 15 lines of code and is very flexible. I implemented this solution in an open source application which I developed and called [Evally][5] - a web app that helps businesses keep track of their employees' performance reviews and professional development. It reminds managers or HR representatives about employees' upcoming evaluations and gathers all of the data needed to assess their performance in the fairest way. + +### Model and list + +The only things you need to do are to create a class and use the defaultsDeep function in the [Lodash][6] JavaScript library: + + +``` +`_.defaultsDeep(object, [sources])` +``` + +Arguments: + + * `object (Object)`: The destination object + * `[sources] (...Object)`: The source objects + + + +Returns: + + * `(Object)`: Returns object + + + +This helper function: [Lodash Docs][7] + +> "Assigns recursively own and inherited enumerable string keyed properties of source objects to the destination object for all destination properties that resolve to undefined. Source objects are applied from left to right. Once a property is set, additional values of the same property are ignored." + +For example: + + +``` +_.defaultsDeep({ 'a': { 'b': 2 } }, { 'a': { 'b': 1, 'c': 3 } }) + // => { 'a': { 'b': 2, 'c': 3 } } +``` + +That's all! To try it out, create a file called **base.js** and import the defaultsDeep function from the Lodash package: + + +``` + // base.js + import defaultsDeep from "lodash/defaultsDeep"; +``` + +Next, create and export the Model class, where constructor will use the Lodash helper function to assign values to all passed attributes and initialize the attributes that were not received with default values: + + +``` + // base.js + // ... + + export class Model { +   constructor(attributes = {}) { +     defaultsDeep(this, attributes, this.defaults); +   } + } +``` + +Now, create your first real model, Employee, with attributes for firstName, lastName, position and hiredAt where "position" defines "Programmer" as the default value: + + +``` + // employee.js + import { Model } from "./base.js"; + + export class Employee extends Model { +   get defaults() { +     return { +       firstName: "", +       lastName: "", +       position: "Programmer", +       hiredAt: "" +     }; +   } + } +``` + +Next, begin creating employees: + + +``` +// app.js + import { Employee } from "./employee.js"; + + const programmer = new Employee({ +   firstName: "Will", +   lastName: "Smith" + }); + + // => Employee { + //   firstName: "Will", + //   lastName: "Smith", + //   position: "Programmer", + //   hiredAt: "", + //   constructor: Object + // } + + const techLeader = new Employee({ +   firstName: "Charles", +   lastName: "Bartowski", +   position: "Tech Leader" + }); + + // => Employee { + //   firstName: "Charles", + //   lastName: "Bartowski", + //   position: "Tech Leader", + //   hiredAt: "", + //   constructor: Object + // } +``` + +You have two employees, and the first one's position is assigned from the defaults. Here's how multiple employees can be defined: + + +``` + // base.js + + // ... + + export class List { +   constructor(items = []) { +     this.models = items.map(item => new this.model(item)); +   } + } + +[/code] [code] + + // employee.js + import { Model, List } from "./base.js"; + + // … + + export class EmployeesList extends List { +   get model() { +     return Employee; +   } + } +``` + +The List class constructor maps an array of received items into an array of desired models. The only requirement is to provide a correct model class name: + + +``` + // app.js + import { Employee, EmployeesList } from "./employee.js"; + + // … + + const employees = new EmployeesList([ +   { +     firstName: "Will", +     lastName: "Smith" +   }, +   { +     firstName: "Charles", +     lastName: "Bartowski", +     position: "Tech Leader" +   } + ]); + + // => EmployeesList {models: Array[2], constructor: Object} + //  models: Array[2] + //   0: Employee + //     firstName: "Will" + //     lastName: "Smith" + //     position: "Programmer" + //     hiredAt: "" + //     <constructor>: "Employee" + //   1: Employee + //     firstName: "Charles" + //     lastName: "Bartowski" + //     position: "Tech Leader" + //     hiredAt: "" + //     <constructor>: "Employee" + //   <constructor>: "EmployeesList" +``` + +### Ways to use this approach + +This simple solution allows you to keep your data structure in one place and avoid code repetition. The [DRY][8] principle rocks! You can also customize your models as needed, such as in the following examples. + +#### Custom getters + +Do you need one attribute to be dependent on the others? No problem; you can do this by improving your Employee model: + + +``` +// employee.js + import { Model } from "./base.js"; + + export class Employee extends Model { +   get defaults() { +     return { +       firstName: "", +       lastName: "", +       position: "Programmer", +       hiredAt: "" +     }; +   } + +   get fullName() { +     return [this.firstName, this.lastName].join(' ') +   } + + } + +[/code] [code] + +// app.js + import { Employee, EmployeesList } from "./employee.js"; + + // … + + console.log(techLeader.fullName); + // => Charles Bartowski +``` + +Now you don't have to repeat the code to do something as simple as displaying the employee's full name. + +#### Date formatting + +Model is a good place to define other formats for given attributes. The best examples are dates: + + +``` +// employee.js + import { Model } from "./base.js"; + import moment from 'moment'; + + export class Employee extends Model { +   get defaults() { +     return { +       firstName: "", +       lastName: "", +       position: "Programmer", +       hiredAt: "" +     }; +   } + +   get formattedHiredDate() { +     if (!this.hiredAt) return "---"; + +     return moment(this.hiredAt).format('MMMM DD, YYYY'); +   } + } + +[/code] [code] + +// app.js + import { Employee, EmployeesList } from "./employee.js"; + + // … + + techLeader.hiredAt = "2020-05-01"; + + console.log(techLeader.formattedHiredDate); + // => May 01, 2020 +``` + +Another case related to dates (which I discovered developing the Evally app) is the ability to operate with different date formats. Here's an example that uses datepicker: + + 1. All employees fetched from the database have the hiredAt date in the format: +YEAR-MONTH-DAY, e.g., 2020-05-01 + 2. You need to display the hiredAt date in a more friendly format: +MONTH DAY, YEAR, e.g., May 01, 2020 + 3. A datepicker uses the format: +DAY-MONTH-YEAR, e.g., 01-05-2020 + + + +Resolve this issue with: + + +``` +// employee.js + import { Model } from "./base.js"; + import moment from 'moment'; + + export class Employee extends Model { + +   // … + +   get formattedHiredDate() { +     if (!this.hiredAt) return "---"; + +     return moment(this.hiredAt).format('MMMM DD, YYYY'); +   } + +   get hiredDate() { +     return ( +       this.hiredAt +         ? moment(this.hiredAt).format('DD-MM-YYYY') +         : '' +     ); +   } + +   set hiredDate(date) { +     const mDate = moment(date, 'DD-MM-YYYY'); +  +     this.hiredAt = ( +       mDate.isValid() +         ? mDate.format('YYYY-MM-DD') +         : '' +     ); +   } + } +``` + +This adds getter and setter functions to handle datepicker's functionality. + + +``` + // Get date from server + techLeader.hiredAt = '2020-05-01'; + console.log(techLeader.formattedHiredDate); + // => May 01, 2020 + + // Datepicker gets date + console.log(techLeader.hiredDate); + // => 01-05-2020 + + // Datepicker sets new date + techLeader.hiredDate = '15-06-2020'; + + // Display new date + console.log(techLeader.formattedHiredDate); + // => June 15, 2020 +``` + +This makes it very simple to manage multiple date formats. + +#### Storage for model-related information + +Another use for a model class is storing general information related to the model, like paths for routing: + + +``` +// employee.js + import { Model } from "./base.js"; + import moment from 'moment'; + + export class Employee extends Model { + +   // … + +   static get routes() { +     return { +       employeesPath: '/api/v1/employees', +       employeePath: id => `/api/v1/employees/${id}` +     } +   } + + } + +[/code] [code] + + // Path for POST requests + console.log(Employee.routes.employeesPath) + + // Path for GET request + console.log(Employee.routes.employeePath(1)) +``` + +### Customize the list of models + +Don't forget about the List class, which you can customize as needed: + + +``` +// employee.js + import { Model, List } from "./base.js"; + + // … + + export class EmployeesList extends List { +   get model() { +     return Employee; +   } + +   findByFirstName(val) { +     return this.models.find(item => item.firstName === val); +   } + +   filterByPosition(val) { +     return this.models.filter(item => item.position === val); +   } + } + +[/code] [code] + + console.log(employees.findByFirstName('Will')) + // => Employee { + //   firstName: "Will", + //   lastName: "Smith", + //   position: "Programmer", + //   hiredAt: "", + //   constructor: Object + // } + + console.log(employees.filterByPosition('Tech Leader')) + // => [Employee] + //     0: Employee + //       firstName: "Charles" + //       lastName: "Bartowski" + //       position: "Tech Leader" + //       hiredAt: "" + //       <constructor>: "Employee" +``` + +### Summary + +This simple structure for data modeling in JavaScript should save you some development time. You can add new functions whenever you need them to keep your code cleaner and easier to maintain. All of this code is available in my [CodeSandbox][9], so try it out and let me know how it goes by leaving a comment below. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/5/data-modeling-javascript + +作者:[Szymon][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/schodevio +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/analytics-graphs-charts.png?itok=sersoqbV (Analytics: Charts and Graphs) +[2]: https://railwaymen.org/ +[3]: https://blog.railwaymen.org/vue-vs-react-which-one-is-better-for-your-app-similarities-differences +[4]: https://www.npmjs.com/ +[5]: https://github.com/railwaymen/evally +[6]: https://lodash.com/ +[7]: https://lodash.com/docs/4.17.15 +[8]: https://en.wikipedia.org/wiki/Don%27t_repeat_yourself +[9]: https://codesandbox.io/s/02jsdatamodels-1mhtb diff --git a/sources/tech/20200524 Diamond interface composition in Go 1.14.md b/sources/tech/20200524 Diamond interface composition in Go 1.14.md new file mode 100644 index 0000000000..611bb2c39e --- /dev/null +++ b/sources/tech/20200524 Diamond interface composition in Go 1.14.md @@ -0,0 +1,124 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Diamond interface composition in Go 1.14) +[#]: via: (https://dave.cheney.net/2020/05/24/diamond-interface-composition-in-go-1-14) +[#]: author: (Dave Cheney https://dave.cheney.net/author/davecheney) + +Diamond interface composition in Go 1.14 +====== + +Per the [overlapping interfaces proposal][1], Go 1.14 now permits embedding of interfaces with overlapping method sets. This is a brief post explain what this change means: + +Let’s start with the definition of the three key interfaces from the `io` package; `io.Reader`, `io.Writer`, and `io.Closer`: + +``` +package io + +type Reader interface { + Read([]byte) (int, error) +} + +type Writer interface { + Write([]byte) (int, error) +} + +type Closer interface { + Close() error +} +``` + +Just as embedding a type inside a struct allows the embedded type’s fields and methods to be accessed as if it were declared on the embedding type[1][2], the process is true for interfaces. Thus there is no difference between explicitly declaring + +``` +type ReadCloser interface { + Read([]byte) (int, error) + Close() error +} +``` + +and using embedding to compose the interface + +``` +type ReadCloser interface { + Reader + Closer +} +``` + +You can even mix and match + +``` +type WriteCloser interface { + Write([]byte) (int, error) + Closer +} +``` + +However, prior to Go 1.14, if you continued to compose interface declarations in this manner you would likely find that something like this, + +``` +type ReadWriteCloser interface { + ReadCloser + WriterCloser +} +``` + +would fail to compile + +``` +% go build interfaces.go +command-line-arguments +./interfaces.go:27:2: duplicate method Close +``` + +Fortunately, with Go 1.14 this is no longer a limitation, thus solving problems that typically occur with diamond-shaped embedding graphs. + +However, there is a catch that I ran into attempting to demonstrate this feature to the local user group–this feature is only enabled when the Go compiler uses the 1.14 (or later) spec. + +As near as I can make out the rules for which version of the Go spec is used during compilation appear to be: + + 1. If your source code is stored inside `GOPATH` (or you have _disabled_ modules with `GO111MODULE=off`) then the version of the Go spec used to compile with matches the version of the compiler you are using. Said another way, if you have Go 1.13 installed, your Go version is 1.13. If you have Go 1.14 installed, your version is 1.14. No surprises here. + 2. If your source code is stored outside `GOPATH` (or you have forced modules on with `GO111MODULE=on`) then the `go` tool will take the Go version from the `go.mod` file. + 3. If there is no Go version listed in `go.mod` then the version of the spec will be the version of Go installed. This is identical to point 1. + 4. If you are in module mode, either by being outside `GOPATH` or with `GO111MODULE=on`, but there is no `go.mod` file in the current, or any parent, directory then the version of the Go spec used to compile your code defaults to Go 1.13. + + + +The last point caught me out. + + 1. It is said that embedding promotes the type’s fields and methods.[][3] + + + +### Related posts: + + 1. [Struct composition with Go][4] + 2. [term: low level serial with a high level interface][5] + 3. [Accidental method value][6] + 4. [How does the go build command work ?][7] + + + +-------------------------------------------------------------------------------- + +via: https://dave.cheney.net/2020/05/24/diamond-interface-composition-in-go-1-14 + +作者:[Dave Cheney][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://dave.cheney.net/author/davecheney +[b]: https://github.com/lujun9972 +[1]: https://github.com/golang/proposal/blob/master/design/6977-overlapping-interfaces.md +[2]: tmp.nUQHg5BP9T#easy-footnote-bottom-1-4179 (It is said that embedding promotes the type’s fields and methods.) +[3]: tmp.nUQHg5BP9T#easy-footnote-1-4179 +[4]: https://dave.cheney.net/2015/05/22/struct-composition-with-go (Struct composition with Go) +[5]: https://dave.cheney.net/2014/05/08/term-low-level-serial-with-a-high-level-interface (term: low level serial with a high level interface) +[6]: https://dave.cheney.net/2014/05/19/accidental-method-value (Accidental method value) +[7]: https://dave.cheney.net/2013/10/15/how-does-the-go-build-command-work (How does the go build command work ?) diff --git a/sources/tech/20200525 CopyQ Clipboard Manager for Keeping a Track of Clipboard History.md b/sources/tech/20200525 CopyQ Clipboard Manager for Keeping a Track of Clipboard History.md new file mode 100644 index 0000000000..616ee5971a --- /dev/null +++ b/sources/tech/20200525 CopyQ Clipboard Manager for Keeping a Track of Clipboard History.md @@ -0,0 +1,113 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (CopyQ Clipboard Manager for Keeping a Track of Clipboard History) +[#]: via: (https://itsfoss.com/copyq-clipboard-manager/) +[#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/) + +CopyQ Clipboard Manager for Keeping a Track of Clipboard History +====== + +How do you copy-paste text? Let me guess. You either use the right click menu to copy-paste or use Ctrl+C to copy a text and Ctrl+V to paste the text. The text copied this way is saved to ‘clipboard’. The [clipboard][1] is a special location in the memory of your system that stores cut or copied text (and in some cases images). + +But have you ever been in a situation where you had a text copied and then you copy another text and then realize you needed the text you copied earlier? Trust me, it happens a lot. + +Instead of wondering about finding the previous text to copy again, you can use a clipboard manager. + +A clipboard manager is a handy little tool that keeps a history of the text you had copied. If you need to use the earlier copied text, you can use the clipboard manager to copy it again. + +![Clipboard][2] + +There are several clipboard managers available for Linux. In this article, I’ll cover one such tool that goes by the name CopyQ. + +### CopyQ Clipboard Manager + +[CopyQ][3] is nifty clipboard manager that has plenty of features to manage your system’s clipboard. It is an open source software available for free for major Linux distributions. + +Like any other clipboard manager, CopyQ monitors the system clipboard and saves its content. It can save both text and images from the clipboard. + +CopyQ sits in the system tray and you can easily access it from there. From the system tray, just click on the text that you want. It will automatically copy this text and you would notice that the copied text moves on to the top of the saved clipboards. + +![][4] + +In the system tray, it shows only the five recent clips. You can open the main window using the “Show/hide main window” option in the system tray. CopyQ saves up to 200 clips. You may edit the clipboard items here. + +![][5] + +You may also set a keyboard shortcut to bring the clipboard with a few key combination. This option is available in Preferences->Shortcuts. + +![][6] + +If you decide to use it, I advise enabling the autostart so that CopyQ runs automatically when you start your system. By default, it saves 200 items in the history and that’s a lot in my opinion. You may want to change that as well. + +![][7] + +CopyQ is an advanced clipboard manager with plenty of additional features. You can search for text in the saved clipboard items. You can sort, create, edit or change the order of the clipboard items. + +You can ignore clipboard copied from some windows or containing some text. You can also temporarily disable clipboard saving. CopyQ also supports [Vim][8]-like editor and shortcut for Vim fans. + +There are many more features that you may explore on your own. For me, the most notable feature is that it gives me easy access to older copied text, and I am happy with that. + +### Installing CopyQ on Linux + +CopyQ is available for Linux, Windows and macOS. You can get the executable file for Windows and macOS [from its website][3]. + +For Linux, CopyQ is available in the repositories of all major Linux distributions. Which means that you can find it in your software center or install it using your distribution’s package manager. + +Ubuntu users may find it in the software center if [universe repository is enabled][9]. + +![CopyQ in Ubuntu Software Center][10] + +Alternatively, you can use the apt command to install it: + +``` +sudo apt install copyq +``` + +Ubuntu users also have the option to [use the official PPA][11] and always get the latest stable CopyQ version. For example, at the time of writing this article, CopyQ version in Ubuntu 20.04 is 3.10 while [PPA has newer version][12] 3.11. It’s your choice really. + +``` +sudo add-apt-repository ppa:hluk/copyq +sudo apt update +sudo apt install copyq +``` + +You may also want to know [how to remove PPA][13] later. + +### Do you use a clipboard manager? + +I find it surprising that many people are not even aware of an essential utility like clipboard manager. For me, it’s one of the [essential productivity tools on Linux][14]. + +As I mentioned at the beginning of the article, there are several clipboard managers available for Linux. CopyQ is one of such tools. Do you use or know of some other similar clipboard tool? Why not let us know in the comments? + +If you started using CopyQ after reading this article, do share your experience with it. What you liked and what you didn’t like? The comment section is all yours. + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/copyq-clipboard-manager/ + +作者:[Abhishek Prakash][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/abhishek/ +[b]: https://github.com/lujun9972 +[1]: https://www.computerhope.com/jargon/c/clipboar.htm +[2]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/05/clipboard.png?ssl=1 +[3]: https://hluk.github.io/CopyQ/ +[4]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/05/copyq-system-tray.png?ssl=1 +[5]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/05/copyq-main-window.png?ssl=1 +[6]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/05/copyq-shortcuts.png?ssl=1 +[7]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/05/copyq-auto-start.png?ssl=1 +[8]: https://itsfoss.com/vim-8-release-install/ +[9]: https://itsfoss.com/ubuntu-repositories/ +[10]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/05/copyq-software-center.png?resize=800%2C474&ssl=1 +[11]: https://itsfoss.com/ppa-guide/ +[12]: https://launchpad.net/~hluk/+archive/ubuntu/copyq +[13]: https://itsfoss.com/how-to-remove-or-delete-ppas-quick-tip/ +[14]: https://itsfoss.com/productivity-tips-ubuntu/ diff --git a/sources/tech/20200525 Debian-s Decision to Drop Old Drivers has Upset Vintage Hardware Users.md b/sources/tech/20200525 Debian-s Decision to Drop Old Drivers has Upset Vintage Hardware Users.md new file mode 100644 index 0000000000..fb2b9005ea --- /dev/null +++ b/sources/tech/20200525 Debian-s Decision to Drop Old Drivers has Upset Vintage Hardware Users.md @@ -0,0 +1,85 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Debian’s Decision to Drop Old Drivers has Upset Vintage Hardware Users) +[#]: via: (https://itsfoss.com/debian-dropping-old-drivers/) +[#]: author: (Ankush Das https://itsfoss.com/author/ankush/) + +Debian’s Decision to Drop Old Drivers has Upset Vintage Hardware Users +====== + +It is always a tough decision to drop support for older hardware for the latest Linux distribution releases. Just like [Ubuntu decided to drop support for 32-bit systems][1], Debian’s X Strike Force (XFS) team decided to drop a list of input and video drivers. + +### Debian is considering to drop support for really old hardware + +![][2] + +In case you didn’t know, the XFS team is responsible for maintaining packages the [X Window System][3] in [Debian][4]. And, the list of drivers that [they want to remove][5] are: + + * xserver-xorg-input-aiptek + * xserver-xorg-input-elographics + * xserver-xorg-input-mtrack + * xserver-xorg-input-mutouch + * xserver-xorg-input-void + * server-xorg-video-ast + * xserver-xorg-video-mach64 + + + * xserver-xorg-video-neomagic + * xserver-xorg-video-r128 + * xserver-xorg-video-savage + * xserver-xorg-video-siliconmotion + * xserver-xorg-video-sisusb + * xserver-xorg-video-tdfx + * xserver-xorg-video-trident + + + +So, Mach 64, [ATI Rage R128][6], Savage, Silicon Motion, SiS, Trident, and NeoMagic are some of the graphics chipsets that would be affected. The reason (as stated by them) to drop these drivers is: + +> They are either unmaintained upstream or provide no value to the distribution. + +Now, that could make sense, if the packages are no longer maintained. But, upstream some of these X.org drivers are still **maintained** even if there are no frequent updates to them. For instance, in 2018, a [new display driver update was released for the ATI RAGE 128][7], as reported by Phoronix. + +### Vintage hardware owners are going to be upset + +Obviously, the vintage hardware users aren’t quite happy with the decision because a handful of people still own (or actively use) old hardware i.e. around 20 years older. + +From the original list of drivers mentioned in the [bug report][5], **Geode display driver** was initially decided to be removed but wasn’t dropped. + +It was also reported that the “**xserver-xorg-video-r128**” driver is required for older Apple hardware (iMac). And, a user reported about the missing video driver on his iMac. + +For most of the users, this decision may not actually affect any “production” systems because I don’t think anyone is probably going to utilize 20-year old hardware for commercial purposes. + +The hobbyists and collectors who like to preserve older tech are surely going to be impacted by this decision. + +### Wrapping Up + +In my opinion, dropping the support for incredibly dated hardware is not entirely a bad move. + +But, if there is a demand for the support of vintage hardware, the fair share of users who want the drivers to be added in Debian should help maintain those packages. If not, I don’t think it won’t be a wise choice to have an unmaintained piece of code in Debian. + +What do you think about this? Feel free to share your thoughts in the comments below! + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/debian-dropping-old-drivers/ + +作者:[Ankush Das][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://itsfoss.com/author/ankush/ +[b]: https://github.com/lujun9972 +[1]: https://itsfoss.com/ubuntu-drops-32-bit-desktop/ +[2]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/04/debian-bug-report-driver-drop.jpg?ssl=1 +[3]: https://en.wikipedia.org/wiki/X_Window_System +[4]: https://www.debian.org/ +[5]: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=955603 +[6]: https://en.wikipedia.org/wiki/ATI_Rage_series +[7]: https://www.phoronix.com/scan.php?page=news_item&px=ATI-RAGE-128-DDX-6.11.0 diff --git a/sources/tech/20200525 EU Parliament Strongly Recommends Developing and Using Open Source Software.md b/sources/tech/20200525 EU Parliament Strongly Recommends Developing and Using Open Source Software.md new file mode 100644 index 0000000000..bfeb5635ce --- /dev/null +++ b/sources/tech/20200525 EU Parliament Strongly Recommends Developing and Using Open Source Software.md @@ -0,0 +1,84 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (EU Parliament Strongly Recommends Developing and Using Open Source Software) +[#]: via: (https://itsfoss.com/eu-parliament-recommends-open-source/) +[#]: author: (Ankush Das https://itsfoss.com/author/ankush/) + +EU Parliament Strongly Recommends Developing and Using Open Source Software +====== + +Europe is choosing open source more than ever. Not just limited to [EU Commissions’ decision to use Signal messaging app][1] but also [open science][2] and the [adoption of open source software by European universities][3]. + +Now, in a recent [press release][4] by the [European Pirate Party][5], it looks like the EU Parliament is urging EU institutions to use open-source software. All thanks to the Pirate amendments for encouraging the use of open-source software. + +The EU Parliament not just encourages the use of open-source software, but they have also advised to prioritize development of open-source software by the EU institutions. + +So, not just aiming to adopt using open-source software but to develop open-source software. And, that’s definitely good news! + +More use of open-source software, why not? To give you some more details, here’s what they mentioned in the press release: + +> **In practice, from now on, all IT solutions developed by and for the EU institutions will first need to be assessed against the possibility of using Open Source solutions. Assessments will then have to be reported back to the Budgetary Control Committee of the Parliament on an annual basis, during the discharge procedure. This is a strong call for enhancing our important citizens right to transparent and trustworthy information.** + +### Important decision to remove vendor lock-ins + +![Public Money Public Code Campaign][6] + +No matter who made this happen — this decision of preferring open-source software over proprietary will not just help the open-source community but also helps the EU institutions in a variety of ways. + +Especially, relying on open-source software removes the overhead of vendor lock-ins. In other words, an EU institution does not have to rely on vendor to manage/maintain the software. + +The press release also addressed this by mentioning: + +> It is essential for the European institutions to retain control over its own technical systems, especially in a context of disinformation and foreign interference. Open Source promotes local technical support, leads to rapid development of software and helps to avoid dependency on specific suppliers or vendor lock-in effects, which exist when only one company is in charge of software or even the entire IT infrastructure supply. + +Any responsible local organization can take up the task while the community can still help in any way it can. This could also reduce the cost of maintaining the software among other things like improving the security of a software in a collaborative manner. + +### Is this a big win for open-source community? + +![][7] + +Yes, and no. We’ve seen a lot of recommendations made by the governments (or the EU government in general) to choose open-source software to keep things more secure yet transparent. + +Pirate’s Vice-President of EU Parliament, **Marcel Kolaja**, mentions some advantages of this decision as well: + +_It’s a milestone for transparent and open digitization of the European institutions. From now on, the Open Source ecosystem has a stepping ground for offering Open Source solutions and the Pirates will gladly play the role of the guardians and will try to solve and highlight any attempt to bypass this strong recommendation. It’s a really important step to remove vendor lock-ins in the Parliament“_ + +So, this will definitely help them earn trust of their citizens by providing digital transparency while also encouraging public participation to improve the software as well. Of course, this will also help introduce the concept of open-source software to many who were unaware of it in some way. + +Also, ensuring open-source software for publicly financed software will enhance the meaning of freedom of speech/privacy/press. + +In a nutshell, these decisions do have a positive impact in one way or the other. + +But, the implementations of these decisions will decide how effective it’s going to be to put the words in action. + +### Wrapping Up + +I’m happy with the decision by EU Parliament here — even though I’m not a European. I guess, this should encourage other government bodies to take similar decisions or steps to ensure digital transparency while earning the trust of their citizens. + +To get more details on the decision, you can refer to the [official press release by the European Pirate Party][4]. + +What do you think about it? Let me know your thoughts in the comments below! + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/eu-parliament-recommends-open-source/ + +作者:[Ankush Das][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://itsfoss.com/author/ankush/ +[b]: https://github.com/lujun9972 +[1]: https://itsfoss.com/eu-commission-switches-to-signal/ +[2]: https://ec.europa.eu/research/openscience/index.cfm?pg=openaccess +[3]: https://opensource.com/article/20/5/open-source-higher-education +[4]: https://european-pirateparty.eu/european-parliament-strongly-recommends-any-software-developed-by-and-for-the-eu-institutions-to-be-made-publicly-available-under-free-and-open-source-software-licence/ +[5]: https://en.wikipedia.org/wiki/European_Pirate_Party +[6]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/05/public-money-public-code.png?resize=800%2C420&ssl=1 +[7]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/05/eu-parliament-open-source.jpg?ssl=1 diff --git a/sources/tech/20200525 Encrypt Your Files Before Uploading it to Cloud With Cryptomator.md b/sources/tech/20200525 Encrypt Your Files Before Uploading it to Cloud With Cryptomator.md new file mode 100644 index 0000000000..eda3a2990e --- /dev/null +++ b/sources/tech/20200525 Encrypt Your Files Before Uploading it to Cloud With Cryptomator.md @@ -0,0 +1,184 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Encrypt Your Files Before Uploading it to Cloud With Cryptomator) +[#]: via: (https://itsfoss.com/cryptomator/) +[#]: author: (Ankush Das https://itsfoss.com/author/ankush/) + +Encrypt Your Files Before Uploading it to Cloud With Cryptomator +====== + +_**Open source software highlight of this week is Cryptomator. It is a unique free and open-source encryption software that lets you encrypt your data before uploading it to the cloud.**_ + +There are several [cloud services available for Linux][1] and almost all of them do not offer [end to end encryption][2], at least not by default. + +Usually, the connection between your device and the server is secure. But your data stored on the server is not encrypted. Employees with direct access to the infrastructure at your cloud service providers may access this data. + +Of course, these companies have strict policies against such intrusion but a rogue employee can do a lot of damage. Remember the incident when a [departing Twitter employee deactivated the account of US President Donald Trump][3]. + +If you are one of the privacy cautious people, you would want the ease of cloud storage but with the added security layer of encrypted storage. + +Now some [services like pCloud do provide end to end encryption][4] but that comes at an additional cost. If you could afford that, well and good. If not, you can use a free and open source tool like [Cryptomator][5]. + +Cryptomator helps you secure your data by encrypting it before uploading it to any cloud storage services. In this article, I’m going to highlight the key features of Cryptomator along with instructions to use it. + +### Cryptomator: Add an encryption layer to your cloud data + +![][6] + +Cryptomator is a solution to encrypt your data locally before uploading it to the cloud. + +With this, you can create vaults locally and sync them to the cloud storage services you use. + +It’s very easy to use and you don’t need to have any specific technical knowledge to encrypt your data – that’s what Cryptomator is tailored for. + +### Features of Cryptomator + +Cryptomator is a simple encryption tool with the essential features. Here’s what it offers: + + * [AES][7] and 256-bit Encryption for files. + * Ability to create a vault and sync it with the cloud storage service + * Optional recovery key for your master password of the vault + * Cross-platform support (Linux, Windows, macOS, Android, and iOS) + * Supports the dark theme for a one-time license fee. + * Supports [WebDAV][8], [FUSE][9], and [Dokany][10] for easy integration with your operating system. + + + +Do note that the [Android][11] and [iOS][12] apps are paid apps that you have to purchase separately while the desktop program is completely free to use. Also, you need to purchase a one-time license to unlock the dark mode. Don’t blame them please. They need to make some money in order to develop this open source software. + +### Installing Cryptomator on Linux + +Cryptomater provides an AppImage file that you can download to get started on any Linux distribution. + +You can get it from its [official download page][13]. In case you don’t know, please read [how to use an AppImage file][14] to get started. + +[Download Cryptomator][5] + +### How To Use Cryptomator? + +Attention! + +Encryption is a double-edged sword. It can protect you and it can hurt you as well. +If you are encrypting your data and you forgot your encryption key, you’ll lose access to that data forever. +Cryptomator provides a recovery key option so please be careful with both password and the recovery key. Don’t forget it or lose the recovery key. + +Once you have installed Cryptomator, it’s really easy to use it following the user interface or the [official documentation][15]. + +But, to save you some time, I’ll highlight a few important things that you should know: + +#### Setup Your Vault + +![][16] + +After launching Cryptomator, you need to create the vault where you want to have your encrypted data. + +This can be an existing location or a new custom directory as per your requirements. + +Now that you proceed creating a new vault, you will also observe that you can open an existing vault as well (if you had one already). So, always have a backup of your vault, just in case. + +![][17] + +Here, I am assuming that you are a new user. So, obviously, proceed to create a new vault and give it a name: + +![][18] + +Next, you need to specify a storage location. If you already use OneDrive, Dropbox, Google Drive, or something similar, it might detect it automatically. + +![][19] + +However, if it doesn’t, like in my case (I use [pCloud][20]), you can select the cloud-synced directory or any other custom location manually. + +Once you select the location, you just need to create a password for it. It’s best to create a strong password that you can remember. + +![][21] + +Also, I’d suggest you to opt for the recovery key and store it in a separate USB drive or just print it on a paper. + +![][22] + +And, that’s it. You’re done creating your secure vault that you can sync with the cloud. + +![][23] + +Now, how do you add files to it? Let’s take a look: + +#### Adding Files To A Vault + +_**Note:** You can’t just go into the folder that you created from the file manager and files there. Follow the steps below to add files properly in your encrypted vault._ + +Once you’ve created your vault, you just need to unlock it by typing the password as shown in the image below. If you’re on your personal computer, you can choose to save the password without needing to enter it every time you access the vault. However, I advise not to do that. Manually entering the password help in remembering it. + +![][24] + +Next, after unlocking the vault, you just need to click on “**Reveal Vault**” or reveal drive to open it using **File Manager** where you can access/modify or add files to it. + +#### Backup / Recover Your Vault + +You should simply copy-paste the folder you create to another USB drive or somewhere else other than your cloud storage folder to ensure that you have a backup of your vault. + +![][25] + +It’s important to have the **masterkey.cryptomator** file of the vault in order to open it. + +#### Upgrades, Preferences & Settings + +Note + +You should enable the auto-updates feature to ensure that you will have the most stable and error-free version automatically. + +Apart from the most important functions of the Cryptomator app, you will get a couple of other features to tweak, such as: + + * Change the type of your virtual drive + * Tweak the vault to read-only mode + + + +You can explore the **Vault options** and the settings on Cryptomator to know about what else you can do. + +**Wrapping Up** + +Now that you know about Cryptomator, you can easily encrypt your important data locally before uploading them to the cloud. + +What do you think about Cryptomator? Let us know your thoughts in the comments down below! + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/cryptomator/ + +作者:[Ankush Das][a] +选题:[lujun9972][b] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://itsfoss.com/author/ankush/ +[b]: https://github.com/lujun9972 +[1]: https://itsfoss.com/cloud-services-linux/ +[2]: https://en.wikipedia.org/wiki/End-to-end_encryption +[3]: https://www.theverge.com/2017/11/2/16600732/donald-trump-twitter-account-gone-realdonaldtrump +[4]: https://partner.pcloud.com/r/22317 +[5]: https://cryptomator.org/ +[6]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/04/cryptomator-ft.jpg?ssl=1 +[7]: https://en.wikipedia.org/wiki/Advanced_Encryption_Standard +[8]: https://en.wikipedia.org/wiki/WebDAV +[9]: https://en.wikipedia.org/wiki/Filesystem_in_Userspace +[10]: https://en.wikipedia.org/wiki/Dokan_Library +[11]: https://play.google.com/store/apps/details?id=org.cryptomator&hl=en_US +[12]: https://apps.apple.com/us/app/cryptomator/id953086535 +[13]: https://cryptomator.org/downloads/ +[14]: https://itsfoss.com/use-appimage-linux/ +[15]: https://docs.cryptomator.org +[16]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/04/cryptomator-add-vault.jpg?ssl=1 +[17]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/04/cryptomator-create-open-vault.jpg?ssl=1 +[18]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/04/cryptomator-add-vault-name.jpg?ssl=1 +[19]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/04/cryptomator-vault-location.jpg?ssl=1 +[20]: https://itsfoss.com/recommends/pcloud/ +[21]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/04/cryptomator-pass.jpg?ssl=1 +[22]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/04/cryptomator-recovery.jpg?ssl=1 +[23]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/04/cryptomator-vault-success.jpg?ssl=1 +[24]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/04/cryptomator-unlock.jpg?ssl=1 +[25]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/04/cryptomator-master.jpg?ssl=1 diff --git a/sources/tech/20200525 How to Assign Static IP Address on Ubuntu Linux.md b/sources/tech/20200525 How to Assign Static IP Address on Ubuntu Linux.md new file mode 100644 index 0000000000..87ddb6b839 --- /dev/null +++ b/sources/tech/20200525 How to Assign Static IP Address on Ubuntu Linux.md @@ -0,0 +1,179 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How to Assign Static IP Address on Ubuntu Linux) +[#]: via: (https://itsfoss.com/static-ip-ubuntu/) +[#]: author: (Dimitrios Savvopoulos https://itsfoss.com/author/dimitrios/) + +How to Assign Static IP Address on Ubuntu Linux +====== + +_**Brief: In this tutorial, you’ll learn how to assign static IP address on Ubuntu and other Linux distributions. Both command line and GUI methods have been discussed.**_ + +IP addresses on Linux Systems in most cases are assigned by [Dynamic Host Configuration Protocol][1] (DHCP) servers. IP addresses assigned this way are dynamic which means that the IP address might change when you [restart your Ubuntu system][2]. It’s not necessary but it may happen. + +_**Dynamic IP is not an issue for normal desktop Linux users in most cases**_. It could become an issue if you have employed some special kind of networking between your computers. + +For example, you can [share your keyboard and mouse between Ubuntu and Raspberry Pi][3]. The configuration uses IP addresses of both system. If the IP address changes dynamically, then your setup won’t work. + +Another use case is with servers or remotely administered desktops. It is easier to set static addresses on those systems for connection stability and consistency between the users and applications. + +In this tutorial, I’ll show you how to set up static IP address on Ubuntu based Linux distributions. Let me show you the command line way first and then I’ll show the graphical way of doing it on desktop. + +### Method 1: Assign static IP in Ubuntu using command line + +![][4] + +**Note for desktop users**: Use static IP only when you need it. Automatic IP saves you a lot of headache in handling network configuration. + +#### Step 1: Get the name of network interface and the default gateway + +The first thing you need to know is the name of the network interface for which you have to set up the static IP. + +You can either use ip command or the network manager CLI like this: + +``` +nmcli d +``` + +In my case, it shows my Ethernet (wired) network is called enp0s25: + +``` +Ubuntu> nmcli d +DEVICE TYPE STATE CONNECTION +enp0s25 ethernet unmanaged -- +lo loopback unmanaged -- +``` + +Next, you should note the [default gateway IP using the Linux command][5] **ip route**: + +``` +ip route +default via 192.168.31.1 dev enp0s25 proto dhcp metric 600 +169.254.0.0/16 dev enp0s25 scope link metric 1000 +192.168.31.0/24 dev enp0s25 proto kernel scope link src 192.168.31.36 metric 600 +``` + +As you can guess, the default gateway is 192.168.31.1 for me. + +#### Step 2: Locate Netplan configuration + +Ubuntu 18.04 LTS and later versions use [Netplan][6] for managing the network configuration. Netplan configuration are driven by .yaml files located in **/etc/netplan** directory. + +By default, you should see a .yaml file named something like 01-network-manager-all.yaml, 50-cloud-init.yaml, 01-netcfg.yaml. + +Whatever maybe the name, its content should look like this: + +``` +# Let NetworkManager manage all devices on this system +network: + version: 2 + renderer: NetworkManager +``` + +You need to edit this file for using static IP. + +#### Step 3: Edit Netplan configuration for assigning static IP + +_**Just for the sake of it, make a backup of your yaml file.**_ + +Please make sure to use the correct yaml file name in the commands from here onward. + +Use nano editor with sudo to open the yaml file like this: + +``` +sudo nano /etc/netplan/01-netcfg.yaml +``` + +Please note that _**yaml files use spaces for indentation**_. If you use tab or incorrect indention, your changes won’t be saved. + +You should edit the file and make it look like this by providing the actual details of your IP address, gateway, interface name etc. + +``` +network: + version: 2 + renderer: networkd + ethernets: + enp0s25: + dhcp4: no + addresses: + - 192.168.31.16/24 + gateway4: 192.168.31.1 + nameservers: + addresses: [8.8.8.8, 1.1.1.1] +``` + +In the above file, I have set the static IP to 192.168.31.16. + +Save the file and apply the changes with this command: + +``` +sudo netplan apply +``` + +You can verify it by [displaying your ip address in the terminal][7] with ‘ip a’ command. + +Revert the changes and go back to dynamic IP + +If you don’t want to use the static IP address anymore, you can revert easily. + +If you have backed up the original yaml file, you can delete the new one and use the backup one. + +Otherwise, you can change the yaml file again and make it look like this: + +``` +network: + version: 2 + renderer: networkd + ethernets: + enp0s25: + dhcp4: yes +``` + +### Method 2: Switch to static IP address in Ubuntu graphically + +If you are on desktop, using the graphical method is easier and faster. + +Go to the settings and look for network settings. Click the gear symbol adjacent to your network connection. + +![][8] + +Next, you should go to the IPv4 tab. Under the IPv4 Method section, click on Manual. + +In the Addresses section, enter the IP static IP address you want, netmask is usually 24 and you already know your gateway IP with the ip route command. + +You may also change the DNS server if you want. You can keep Routes section to Automatic. + +![][9] + +Once everything is done, click on Apply button. See, how easy it is to set a static IP address graphically. + +If you haven’t read my previous article on [how to change MAC Address][10], you may want to read in conjunction with this one. + +More networking related articles will be rolling out, let me know your thoughts at the comments below and stay connected to our social media. + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/static-ip-ubuntu/ + +作者:[Dimitrios Savvopoulos][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/dimitrios/ +[b]: https://github.com/lujun9972 +[1]: https://en.wikipedia.org/wiki/Dynamic_Host_Configuration_Protocol +[2]: https://itsfoss.com/schedule-shutdown-ubuntu/ +[3]: https://itsfoss.com/keyboard-mouse-sharing-between-computers/ +[4]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/05/static-ip-ubuntu.jpg?ssl=1 +[5]: https://linuxhandbook.com/find-gateway-linux/ +[6]: https://netplan.io/ +[7]: https://itsfoss.com/check-ip-address-ubuntu/ +[8]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/05/assign-static-ip-1.jpg?ssl=1 +[9]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/05/assign-static-ip-2.jpg?ssl=1 +[10]: https://itsfoss.com/change-mac-address-linux/ diff --git a/sources/tech/20200525 How to Compress PDF in Linux -GUI - Terminal.md b/sources/tech/20200525 How to Compress PDF in Linux -GUI - Terminal.md new file mode 100644 index 0000000000..eba596bcb9 --- /dev/null +++ b/sources/tech/20200525 How to Compress PDF in Linux -GUI - Terminal.md @@ -0,0 +1,99 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How to Compress PDF in Linux [GUI & Terminal]) +[#]: via: (https://itsfoss.com/compress-pdf-linux/) +[#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/) + +How to Compress PDF in Linux [GUI & Terminal] +====== + +_**Brief: Learn how to reduce the size of a PDF file in Linux. Both command line and GUI methods have been discussed.**_ + +I was filling some application form and it asked to upload the necessary documents in PDF format. Not a big issue. I gathered all the [scanned images and combined them in one PDF using gscan2pdf tool][1]. + +The problem came when I tried to upload this PDF file. The upload failed because it exceeded the maximum file size limit. This only meant that I needed to somehow reduce the size of the PDF file. + +Now, you may use an online PDF compressing website but I don’t trust them. A file with important documents uploading to an unknown server is not a good idea. You could never be sure that they don’t keep a copy your uploaded PDF document. + +This is the reason why I prefer compressing PDF files on my system rather than uploading it to some random server. + +In this quick tutorial, I’ll show you how to reduce the size of PDF files in Linux. I’ll show both command line and GUI methods. + +### Method 1: Reduce PDF file size in Linux command line + +![][2] + +You can use [Ghostscript][3] command line tool for compressing a PDF file. Most Linux distributions include the open source version of Ghostscript already. However, you can still try to install it just to make sure. + +On Debian/Ubuntu based distributions, use the following command to install Ghostscript: + +``` +sudo apt install ghostscript +``` + +Now that you have made sure that Ghostscript is installed, you can use the following command to reduce the size of your PDF file: + +``` +gs -sDEVICE=pdfwrite -dCompatibilityLevel=1.4 -dPDFSETTINGS=/prepress -dNOPAUSE -dQUIET -dBATCH -sOutputFile=compressed_PDF_file.pdf input_PDF_file.pdf +``` + +In the above command, you should add the correct path of the input and out PDF file. + +The command looks scary and confusing. I advise copying and pasting most of it. What you need to know is the dPDFSETTINGS parameter. This is what determines the compression level and thus the quality of your compressed PDF file. + +dPDFSETTINGS | Description +---|--- +/prepress (default) | Higher quality output (300 dpi) but bigger size +/ebook | Medium quality output (150 dpi) with moderate output file size +/screen | Lower quality output (72 dpi) but smallest possible output file size + +Do keep in mind that some PDF files may not be compressed a lot or at all. Applying compression on some PDF files may even produce a file bigger than the original. There is not much you can do in such cases. + +### Method 2: Compress PDF files in Linux using GUI tool + +I understand that not everyone is comfortable with command line tool. The [PDF editors in Linux][4] doesn’t help much with compression. This is why we at It’s FOSS worked on creating a GUI version of the Ghostscript command that you saw above. + +[Panos][5] from It’s FOSS team [worked on creating a Python-Qt based GUI wrapper for the Ghostscript][6]. The tool gives you a simple UI where you can select your input file, select a compression level and click on the compress button to compress the PDF file. + +![][7] + +The compressed PDF file is saved in the same folder as the original PDF file. Your original PDF file remains untouched. The compressed file is renamed by appending -compressed to the original file name. + +If you are not satisfied with the compression, you can choose another compression level and compress the file again. + +You may find the source code of the PDF Compressor on our GitHub repository. To let you easily use the tool, we have packaged it in AppImage format. Please [refer to this guide to know how to use AppImage][8]. + +[Download PDF Compressor (AppImage)][9] + +Please keep in mind that the tool is in early stages of developments. You may experience some issues. If you do, please let us know in the comments or even better, [file a bug here][10]. + +We’ll try to add more packages (Snap, Deb, PPAs etc) in the future releases. If you have experience with the development and packaging, please feel free to give us a hand. + +Would you like It’s FOSS team to work on creating more such small desktop tools in future? Your feedback and suggestions are welcome. + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/compress-pdf-linux/ + +作者:[Abhishek Prakash][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/abhishek/ +[b]: https://github.com/lujun9972 +[1]: https://itsfoss.com/convert-multiple-images-pdf-ubuntu-1304/ +[2]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/05/compress-pdf-linux.jpg?ssl=1 +[3]: https://www.ghostscript.com/ +[4]: https://itsfoss.com/pdf-editors-linux/ +[5]: https://github.com/libreazer +[6]: https://github.com/itsfoss/compress-pdf +[7]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/05/compress-PDF.jpg?fit=800%2C448&ssl=1 +[8]: https://itsfoss.com/use-appimage-linux/ +[9]: https://github.com/itsfoss/compress-pdf/releases/download/0.1/compress-pdf-v0.1-x86_64.AppImage +[10]: https://github.com/itsfoss/compress-pdf/issues diff --git a/sources/tech/20200525 How to Install Linux Mint in VirtualBox -Screenshot Tutorial.md b/sources/tech/20200525 How to Install Linux Mint in VirtualBox -Screenshot Tutorial.md new file mode 100644 index 0000000000..1fc324e817 --- /dev/null +++ b/sources/tech/20200525 How to Install Linux Mint in VirtualBox -Screenshot Tutorial.md @@ -0,0 +1,194 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (How to Install Linux Mint in VirtualBox [Screenshot Tutorial]) +[#]: via: (https://itsfoss.com/install-linux-mint-in-virtualbox/) +[#]: author: (Dimitrios Savvopoulos https://itsfoss.com/author/dimitrios/) + +How to Install Linux Mint in VirtualBox [Screenshot Tutorial] +====== + +_**Brief: One of safest and easiest ways to try Linux Mint is inside a virtual machine. Your real system doesn’t change at all. Learn how to install Linux Mint in VirtualBox in this tutorial.**_ + +[Linux Mint][1] is considered one of the [best distributions for new Linux users][2]. Its flagship Cinnamon DE is one of the most popular desktop environment giving your system a look and feel of classic Window-styled desktop. + +If you want to try Linux Mint and see if it fits your need, you could try installing it in a virtual machine. This way, you run Linux Mint inside your current system without changing your system’s partition or boot order. One of the safest way out there as you get to run Linux like a regular desktop application inside your current operating system. + +![][3] + +Oracle’s open source virtualization tool [VirtualBox][4] is available for free on all major desktop operating systems i.e. Windows, Linux and macOS. + +In this beginner’s tutorial, I’ll show you the steps for installing Linux Mint in VirtualBox. I am including the screenshots for each step so that you can easily follow the tutorial. + +### Installing Linux Mint in VirtualBox + +You can follow the steps on any operating system be it Windows, Linux or macOS. You just need to install VirtualBox on your operating system and rest of the steps remain the same. + +**Step 1:** [Download VirtualBox from its website][4] and install it by double-clicking on the downloaded file. + +![][5] + +Next, install the latest version of Linux Mint’s ISO file from its website. + +[Download Linux Mint ISO][6] + +**Step 2:** Once your virtual Box is up & running we are ready to get started. Click the New button, click Next on the virtual machine wizard. + +![Create a new Virtual Machine][7] + +Initially you need to specify the following: + + * Name: Any preferred name for your VM like Linux Mint + * Type: Linux + * Version: Ubuntu (64 bit) as Linux Mint is an Ubuntu-based distribution + + + +Before configuring any hardware resource value, please make sure that are aware of the [system requirements][8]. + +2 GB RAM would be okay but won’t give you a good experience. 3 GB is a comfortable amount if your system has 8 GB of RAM. I choose to set my Virtual Machine to 4096 MB (4 GB) because my system has plenty of RAM. + +RAM consumption + +One of the common confusion is regarding the RAM consumption. Let’s say your Windows system has 8 GB of RAM and you assign 3 GB of RAM to Linux Mint in VirtualBox. + +If you are running Linux Mint inside VirtualBox, your real system (called host system) will have 5 GB of RAM available for consumption. + +If you are not running Linux Mint inside VirtualBox, at that moment, the entire 8 GB will be available to the host system. + +**Step 3:** Next, choose a Virtual Hard disk now option and click create. + +Choose the virtual storage allocation method (Recommended Dynamically allocated). Set your storage location for virtual hard disk by browsing drive and then specify the size of virtual hard disk (it could be anything from 12-20 GB). + +![Dynamic allocation can save you space if you don’t need the maximum allowance][9] + +**Step (4 (optional advanced settings):** Once Virtual machine has been created, click on the settings button in menu: + +![][10] + +Now, go to the Display section. Specify the Video memory (128 MB) and check “Enable 3D Acceleration”. + +![Don’t forget to enable the 3D Acceleration][11] + +Then click on System Tab → Processor and choose how many threads would you like to allocate. + +My system is a 4 core/4 thread system and I choose to assign half of the CPU capability i.e. 2 threads. + +![Select CPU cores as per the distribution requirements][12] + +Once you have configured everything click ok. + +**Step 5:** In the System settings, go to Storage (from the left sidebar). Click on the [Optical Drive] Empty as shown in the image below. + +You’ll be asked to browse to the Linux Mint ISO file you had downloaded earlier. + +![][13] + +Once you select your ISO, click on the start button and that’s it! Now the ISO will start running as if you are booting from a live USB. + +Next, you need to press enter whilst your option is start Linux Mint as per the picture below. + +![][14] + +**Step 6:** Let’s start the installation procedure. + +Choose the language you want for your Linux Mint virtual machine. + +![Choose your native language][15] + +I’m based in the UK, so I have a UK keyboard layout. You can choose the one you want. + +![Choose your keyboard layout according to your hardware configuration][16] + +You may check the box to download and install any third-party software during the installation. + +![You may install media codecs while installing Linux Mint][17] + +You can proceed to erase the disk and install Linux Mint. + +Erase disk? Really? + +This step may seem scary because you may think that it will harm your real system. + +Let me assure you that it won’t do any damage to your actual disk. Remember you created 10-20 GB of virtual disk in step 3? Now you are inside that disk. + +When it asks for erasing the disk, it is erasing the virtual disk created for it. It doesn’t impact your real system disk and its data. + +![It is safe to erase your disk only at a Virtual Machine level][18] + +Next, select your time zone and click continue. You may [change time zone in Linux][19] later as well. + +![][20] + +You will be prompted to create your user account, your host name (computer’s name) and to choose a password. Once done, click continue to finalize the installation. + +![][21] + +Please wait a few minutes for the process to complete. + +![Wait a few minutes for the process to finish][22] + +The installation has now finished. Click on “Restart now”. + +![Well done! You have successfully installed Linux Mint][23] + +When you reach this step, Linux Mint will be installed and ready to use! + +![][24] + +You don’t have an installation medium so just power off the virtual machine. + +![][25] + +Now to use your virtual machine, click on the start button. + +![][26] + +You can explore a fully functional system, and at this time if you shut down Linux Mint like it was physically installed, it will automatically power off the virtual machine. + +![][27] + +Enjoy Linux Mint in VirtualBox. I hope you were able to install Linux Mint in VirtualBox. If you face any issues, please let me know in the comment section. I’ll try to help you out. + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/install-linux-mint-in-virtualbox/ + +作者:[Dimitrios Savvopoulos][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/dimitrios/ +[b]: https://github.com/lujun9972 +[1]: https://www.linuxmint.com/ +[2]: https://itsfoss.com/best-linux-beginners/ +[3]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/05/install-linux-mint-in-virtualbox.png?ssl=1 +[4]: https://www.virtualbox.org/ +[5]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/05/download-virtulabox.jpg?ssl=1 +[6]: https://www.linuxmint.com/download.php +[7]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/04/1.-Create-new.jpg?ssl=1 +[8]: https://blog.linuxmint.com/?p=3832 +[9]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/04/2.-Create-virtual-hard-disk.jpg?resize=800%2C472&ssl=1 +[10]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/04/3.-settings.jpg?resize=800%2C470&ssl=1 +[11]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/04/4.-display.jpg?resize=800%2C472&ssl=1 +[12]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/04/5.-cpu.jpg?resize=800%2C468&ssl=1 +[13]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/04/6.-choose-iso.jpg?resize=800%2C472&ssl=1 +[14]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/04/7.-boot.jpg?resize=800%2C459&ssl=1 +[15]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/04/8.-choose-language.png?resize=800%2C679&ssl=1 +[16]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/04/9.-English-UK.png?resize=800%2C679&ssl=1 +[17]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/04/10.-install-third-party-software.png?resize=800%2C679&ssl=1 +[18]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/04/11.-installation-type.png?resize=800%2C679&ssl=1 +[19]: https://itsfoss.com/change-timezone-ubuntu/ +[20]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/04/12.-timezone.png?resize=800%2C679&ssl=1 +[21]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/04/13.-user-account.png?resize=800%2C679&ssl=1 +[22]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/04/14.-installation-screen.png?resize=800%2C679&ssl=1 +[23]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/04/15.-installation-finish.png?resize=800%2C679&ssl=1 +[24]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/04/16.-remove-the-media.png?resize=800%2C679&ssl=1 +[25]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/04/17.-power-off.png?resize=800%2C678&ssl=1 +[26]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/04/18.-init-the-fresh-installed-mint.png?resize=800%2C476&ssl=1 +[27]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/04/19.-Linux-mint-19.3-final.png?resize=800%2C469&ssl=1 diff --git a/sources/tech/20200525 LanguageTool Review- Free and Open Source Grammar Checker.md b/sources/tech/20200525 LanguageTool Review- Free and Open Source Grammar Checker.md new file mode 100644 index 0000000000..afd1a08e49 --- /dev/null +++ b/sources/tech/20200525 LanguageTool Review- Free and Open Source Grammar Checker.md @@ -0,0 +1,155 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (LanguageTool Review: Free and Open Source Grammar Checker) +[#]: via: (https://itsfoss.com/languagetool-review/) +[#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/) + +LanguageTool Review: Free and Open Source Grammar Checker +====== + +This week’s open source software highlight is [LanguageTool][1]. It is a proofreading software that checks the grammar, style and spelling in more than 20 languages. + +I have been using it for past several days and I feel confident enough to review it and share my experience with it. I have used the popular proofreading tool [Grammarly][2] in the past and I’ll make some comparison between these two tools. + +### LanguageTool: Open source proofreading software + +![][3] + +[LanguageTool][1] grammar checker is available in [multiple formats][4]: + + * You can copy-paste your text on its website. + * You can install browser extension that will check for errors as you type anything, anywhere in the web browser. + * You can install a Java-based desktop application for offline usage. + * You can install add-on for LibreOffice and MS Office. + * Add-ons are also [available for a number of other software][5] like Sublime Text, Thunderbird, Vim, Visual Studio Code etc. + * [Android app][6] is also available. + * API is also available if you want to use LanguageTool in your software or service. API offering comes under premium services. + + + +You can find source code of LanguageTool and its related assets on [their GitHub repository][7]. + +[LanguageTool also has a premium version][8] that you can purchase. The premium version offers additional error checks. + +I am using LanguageTool premium version as a browser extension. Almost all the writing I do is online and thus the browser extension is perfect for me. + +The most convenient way to try LanguageTool is by using its browser extension. Install the browser add-on and next time you type anything in the browser, LanguageTool will start checking your text for grammatical and spelling errors. It will also check for styling errors. + +### Experience with LanguageTool: How good is it? + +LanguageTool leaves a good first impression. It starts checking for errors as you start typing. + +Different types of errors have different color codes. Spelling mistakes are highlighted in red color, grammatical mistakes are in yellow colors and styling errors have a blueish shade. + +Clicking on the error suggestion replaces your text with the suggested one. You may also ignore the suggestion. You’ll also see number of issues identified by LanguageTool in the current text check. + +![Spelling mistake identified by LanguageTool][9] + +#### Personal dictionary + +You can also create your personal directory and add words in it. This is helpful because no proofreading tool can give a green light to technical terms like systemd, iptables and brand names like [WireGuard][10]. To avoid these words labeled as spelling mistakes, add them to your personal dictionary. + +You may edit your personal dictionary from your LanguageTool account. + +![LanguageTool Personal Dictionary][11] + +#### Details on the error suggestion + +If it finds grammatical errors, it also gives a quick explanation of the error. You can get more details by clicking the tool tip which takes you to a reputable external source. + +![You can get additional details on the errors][12] + +#### Synonym suggestion (in beta) + +If you double-click on a word, it will also suggest synonyms. + +![][13] + +#### Are there any privacy issues? + +If you use the online services of LanguageTool, your text is sent to their servers over an **encrypted** connection. All their servers are hosted at Hetzner Online GmbH in Germany. + +LanguageTool states that it doesn’t store any text that you check using its services. You can read their privacy policy [here][14]. + +The free to use languagetool.org website shows ads (there are no third-party ads in the browser add-on). To test their claim of “sending text over an encrypted server”, I typed sample text containing words like vacuum cleaner, laptop etc. + +Thankfully, the displayed ad on their website was nothing related to the text I typed. I haven’t noticed any vacuum cleaner ads on the websites I visit or on Facebook. That’s a good thing. + +#### It doesn’t work flawlessly all the time + +No software is perfect and LanguageTool is not an exception. While it is helpful in finding obvious spelling and grammatical mistakes, it struggles in some simple scenario. + +For example, if a sentence contains several blank spaces together, LanguageTool failed to find an issue with that. + +![Too many whitespaces and yet it went undetected][15] + +This is weird because if I look at their ‘error rules’, I can see a [whitespace repetition rule][16]. I think this rule is applicable only for the Java-based LanguageTool apps, not the browser add-on I am using. + +I also found some other cases where LanguageTool should have identified errors but it didn’t. For example, it didn’t alert for the missing ‘to’ in the text below: + +![LanguageTool fails to find the missing “to”][17] + +When I checked it against the [Grammarly free version][2], it was able to point it out. + +![Grammarly was quick to identify it][18] + +I also found an infinite loop of suggestion. It first suggests using syntaxes as plural of syntax. + +![Suggestion for using ‘syntaxes’][19] + +And then it doesn’t accept ‘syntaxes’ as a valid word. + +![And then it doesn’t accept ‘syntaxes’][20] + +I have seen such “infinite error loop” with Grammarly as well in the past, so I won’t be too hard on LanguageTool for such issues. + +### Conclusion + +Despite some hiccups, I am satisfied with LanguageTool proofreading tool. Both free and premium version are good enough for finding obvious spelling mistakes and grammatical errors. + +The premium version offers over 2500 additional error checks and it costs around $15-$70 per year depending on your geographical region. This is a lot cheaper than [Grammarly][2] which costs $140 per year. + +I opted for the premium version because it will help this open-source project. Premium users also get email support. + +You are not forced to go premium, of course. You can use the free version and if you have some questions or need support, there is a [community forum][21] that you can join for free. + +LanguageTool can certainly be considered one of the [essential open-source tools for writers][22]. I am going to continue using LanguageTool. If you find grammatical or spelling mistakes in It’s FOSS articles in the future, blame LanguageTool, not me. Just kidding :) + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/languagetool-review/ + +作者:[Abhishek Prakash][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/abhishek/ +[b]: https://github.com/lujun9972 +[1]: https://languagetool.org/ +[2]: https://itsfoss.com/recommends/grammarly/ +[3]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/05/languagetool.png?fit=800%2C593&ssl=1 +[4]: https://languagetool.org/compare +[5]: http://wiki.languagetool.org/software-that-supports-languagetool-as-a-plug-in-or-add-on +[6]: https://play.google.com/store/apps/details?id=org.softcatala.corrector +[7]: https://github.com/languagetool-org/ +[8]: https://languagetoolplus.com/ +[9]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/05/langaugetool-error-detection.png?ssl=1 +[10]: https://itsfoss.com/wireguard/ +[11]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/05/languagetool-personal-dictionary.png?ssl=1 +[12]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/05/languagetool-error-explanation.png?ssl=1 +[13]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/05/languagetool-synonym-suggestion.png?ssl=1 +[14]: https://languagetoolplus.com/legal/privacy +[15]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/05/languagetool-whitespaces.png?ssl=1 +[16]: https://community.languagetool.org/rule/show/WHITESPACE_RULE?lang=en +[17]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/05/languagetool-suggestion-3.jpg?fit=800%2C219&ssl=1 +[18]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/05/languagetool-suggestion-grammarly.jpg?fit=800%2C272&ssl=1 +[19]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/05/languagetool-suggestion.png?ssl=1 +[20]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/05/languagetool-suggestion-1.png?ssl=1 +[21]: https://forum.languagetool.org/ +[22]: https://itsfoss.com/open-source-tools-writers/ diff --git a/sources/tech/20200525 Using ‘apt search- and ‘apt show- Commands to Search and Find Details of Packages in Ubuntu.md b/sources/tech/20200525 Using ‘apt search- and ‘apt show- Commands to Search and Find Details of Packages in Ubuntu.md new file mode 100644 index 0000000000..d1d80bcb5d --- /dev/null +++ b/sources/tech/20200525 Using ‘apt search- and ‘apt show- Commands to Search and Find Details of Packages in Ubuntu.md @@ -0,0 +1,172 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Using ‘apt search’ and ‘apt show’ Commands to Search and Find Details of Packages in Ubuntu) +[#]: via: (https://itsfoss.com/apt-search-command/) +[#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/) + +Using ‘apt search’ and ‘apt show’ Commands to Search and Find Details of Packages in Ubuntu +====== + +_**This is a detailed beginners guide to apt search command. Using apt search and apt show commands, you can get details of the available versions, dependencies, repositories and other important information about packages in Ubuntu.**_ + +Have you ever wondered if a certain package is available to install via [apt package manager][1]? + +Have you wondered if the package offered by [Ubuntu repositories][2] are the latest one or not? + +The apt package manager in [Ubuntu][3] and many other distribution provides two handy [apt command options][4] for this purpose. + +The apt search command looks for the provided string in the name and description of the packages. + +``` +apt search package_name +``` + +The apt show command provides detailed information on a package: + +``` +apt show package_name +``` + +The commands don’t require you to [be root in Ubuntu][5]. Here’s an example of these commands: + +![][6] + +### Why would you want to use apt search or apt show command? + +Let’s say you want to [install Gambas programming language in Ubuntu][7]. You are happy with your knowledge of the apt command so you decided to use the command line for installing application. + +You open a terminal and use the apt command to install gambas but it results in [unable to locate package error][8]. + +``` +sudo apt install gambas +Reading package lists... Done +Building dependency tree +Reading state information... Done +E: Unable to locate package gambas +``` + +Why did Ubuntu not find the gambas package? Because there is no such package called gambas. Instead, it is available as gambas3. This is a situation where you could take the advantage of the apt search command. + +Let’s move to apt show command. This command provides detailed information about a package, its repository, dependencies and a lot more. + +Knowing what version of a package is available from the official repository could help you in deciding whether you should install it from some other sources. + +Quick recall + +The apt package manager works on a local database/cache of available packages from various repositories. This database contains the information about the available package version, dependencies etc. It doesn’t contain the entire package itself. The packages are downloaded from the remote repositories. + +When you run the sudo apt update command, this cache is created/updated in the /var/lib/apt/lists/ directory. The apt search and apt show commands utilize this cache. + +The term package is used for an application, program, software. + +### Search for available packages using apt search command + +![][9] + +Let me continue the gambas example. Say, you search for + +``` +apt search gambas +``` + +It will give you a huge list of packages that have “gambas” in its name or description. This output list is in alphabetical order. + +Now, you’ll of course have to make some intelligent prediction about the package you want. In this example, the first result says “Complete visual development environment for Gambas”. This gives you a good hint that this is the main package you are looking for. + +![][10] + +Why so many packages associated with gambas? Because a number of these gambas packages are probably dependencies that will installed automatically if you install the gambas3 package. If you use the _‘apt show gambas3_‘ command, it will show all the dependencies that will be installed with gambas3 package. + +Some of these listed packages could be libraries that a developer may need in some special cases while developing her/his software. + +#### Use apt search for package name only + +By default, apt search command looks for the searched term in both the name of the package and its description. + +You may narrow down the search by instructing the apt command to search for package names only. + +``` +apt search --names-only search_term +``` + +If you are following this as a tutorial, give it a try. Check the output with search term ‘transitional’ with and without –names-only option and you’ll see how the output changes. + +``` +apt search transitional +apt search --names-only transitional +``` + +**Bonus Tip**: You can use ‘apt list –installed’ command to [look for installed packages in Ubuntu][11]. + +### Get detailed information on a package using apt show command + +The output of the apt search commands a brief introduction of the packages. If you want more details, use the apt show command. + +``` +apt show exact_package_name +``` + +The apt show command works on the exact package name and it gives you a lot more information on the package. You get: + + * Version information + * Repository information + * Origin and maintainer of the package information + * Where to file a bug + * Download and installation size + * Dependencies + * Detailed description of the package + * And a lot more + + + +Here’s an example: + +![][12] + +You need to give the exact package name otherwise the apt show won’t work. The good thing is that tab completion works apt show command. + +As you can see in the previous image, you have plenty of information that you may found helpful. + +The apt show command also works on installed packages. In that case, you can see which source the package was installed from. Was it a PPA or some third-party repository or universe or the main repository itself? + +Personally, I use apt show a lot. This helps me know if the package version provided by Ubuntu is the latest or not. Pretty handy tool! + +### Conclusion + +If you read my detailed [guide on the difference between apt and apt-get commands][13], you would know that this ‘apt search’ command works similar to ‘apt-cache search’. There is no such command as “apt-get search”. + +The purpose of creating apt command is to give you one tool with only enough option to manage the packages in your Debian/Ubuntu system. The apt-get, apt-cache and other apt tools still exist, and they can be used in scripting for more complex scenarios. + +I hope you found this introduction to **apt search** and **apt show** commands useful. I welcome your questions and suggestions on this topic. + +If you liked it, please share it on various Linux forums and communities you frequent. That helps us a lot. Thank you. + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/apt-search-command/ + +作者:[Abhishek Prakash][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/abhishek/ +[b]: https://github.com/lujun9972 +[1]: https://wiki.debian.org/Apt +[2]: https://itsfoss.com/ubuntu-repositories/ +[3]: https://ubuntu.com/ +[4]: https://itsfoss.com/apt-command-guide/ +[5]: https://itsfoss.com/root-user-ubuntu/ +[6]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/05/apt-search-apt-show-example-800x493.png?resize=800%2C493&ssl=1 +[7]: https://itsfoss.com/install-gambas-ubuntu/ +[8]: https://itsfoss.com/unable-to-locate-package-error-ubuntu/ +[9]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/05/apt-search-command.png?ssl=1 +[10]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/05/apt-search-command-example.png?fit=800%2C297&ssl=1 +[11]: https://itsfoss.com/list-installed-packages-ubuntu/ +[12]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/05/apt-show-command-example-800x474.png?resize=800%2C474&ssl=1 +[13]: https://itsfoss.com/apt-vs-apt-get-difference/ diff --git a/sources/tech/20200525 What to do When You See -Repository does not have a release file- Error in Ubuntu.md b/sources/tech/20200525 What to do When You See -Repository does not have a release file- Error in Ubuntu.md new file mode 100644 index 0000000000..6cfd9f34de --- /dev/null +++ b/sources/tech/20200525 What to do When You See -Repository does not have a release file- Error in Ubuntu.md @@ -0,0 +1,115 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (What to do When You See “Repository does not have a release file” Error in Ubuntu) +[#]: via: (https://itsfoss.com/repository-does-not-have-release-file-error-ubuntu/) +[#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/) + +What to do When You See “Repository does not have a release file” Error in Ubuntu +====== + +One of the [several ways of installing software in Ubuntu][1] is by using PPA or adding third-party repositories. A few magical lines give you easy access to a software or its newer version that is not available by default in [Ubuntu][2]. + +All thing looks well and good until you get habitual of adding additional third-party repositories and one day, you see an error like this while [updating Ubuntu][3]: + +**E: The repository ‘ focal Release’ does not have a Release file. +N: Updating from such a repository can’t be done securely, and is therefore disabled by default. +N: See apt-secure(8) manpage for repository creation and user configuration details.** + +In this tutorial for Ubuntu beginners, I’ll explain what does this error mean, why do you see it and what can you do to handle this error? + +### Understanding “Repository does not have a release file” error + +![][4] + +Let’s go step by step here. The error message is: + +**E: The repository ‘ focal release’ does not have a release file** + +The important part of this error message is “focal release”. + +You probably already know that [each Ubuntu release has a codename][5]. For Ubuntu 20.04, the codename is Focal Fossa. The “focal” in the error message indicates Focal Fossa which is Ubuntu 20.04. + +The error is basically telling you that though you have added a third-party repository to your system’s sources list, this new repository is not available for your current Ubuntu version. + +_**Why so? Because probably you are using a new version of Ubuntu and the developer has not made the software available for this new version.**_ + +At this point, I highly recommend reading my detailed guides on [PPA][6] and [Ubuntu repositories][7]. These two articles will give you a better, in-depth knowledge of the topic. Trust me, you won’t be disappointed. + +### How to know if the PPA/third party is available for your Ubuntu version [Optional] + +First you should [check your Ubuntu version and its codename][8] using ‘lsb_release -a’ command: + +``` +[email protected]:~$ lsb_release -a +No LSB modules are available. +Distributor ID: Ubuntu +Description: Ubuntu 20.04 LTS +Release: 20.04 +Codename: focal +``` + +As you can see, the codename it shows is focal. Now the next thing you can do is to go to the website of the software in question. + +This could be the tricky part but you can figure it out with some patience and effort. + +In the example here, the error complained about ****. It is a PPA repository and you may easily find its webpage. How, you may ask. + +Use Google or a [Google alternative search engine][9] like Duck Duck Go and search for “ppa numix”. This should give you the first result from [launchpad.net][10] which is the website used for hosting PPA related code. + +On the webpage of the PPA, you can go to the “Overview of published packages” and filter it by the codename of your Ubuntu version: + +![][11] + +For non-PPA third-party repository, you’ll have to check of the official website of the software and see if the repository is available for your Ubuntu version or not. + +### What to do if the repository is not available for your Ubuntu version + +In case when the repository in question is not available for your Ubuntu version, here’s what you can do: + + * Delete the troublesome repository from your list of repository so that you don’t see the error every time you run the update. + * Get the software from another source (if it is possible). + + + +To delete the troublesome repository, start Software & Updates tool: + +![][12] + +Go to the Other Software tab and look for the repository in question. Highlight it and then click on Remove button to delete it from your system. + +![Remove Ppa][13] + +This will [delete the PPA][14] or the repository in question. + +Next step is to get the software from some other source and that’s totally subjective. In some cases, you can still download the DEB file from the PPA website and use the software (I have explained the steps in the [PPA guide][6]). Alternatively, you can check the project’s website if there is a Snap/Flatpak or Python version of the software available. + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/repository-does-not-have-release-file-error-ubuntu/ + +作者:[Abhishek Prakash][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/abhishek/ +[b]: https://github.com/lujun9972 +[1]: https://itsfoss.com/install-remove-software-manjaro/ +[2]: https://ubuntu.com/ +[3]: https://itsfoss.com/update-ubuntu/ +[4]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/05/Repository-does-not-have-a-release-file.png?ssl=1 +[5]: https://itsfoss.com/linux-code-names/ +[6]: https://itsfoss.com/ppa-guide/ +[7]: https://itsfoss.com/ubuntu-repositories/ +[8]: https://itsfoss.com/how-to-know-ubuntu-unity-version/ +[9]: https://itsfoss.com/privacy-search-engines/ +[10]: https://launchpad.net/ +[11]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/05/check-repo-version.png?ssl=1 +[12]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/04/software-updates-settings-ubuntu-20-04.jpg?ssl=1 +[13]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/05/remove-ppa.jpg?ssl=1 +[14]: https://itsfoss.com/how-to-remove-or-delete-ppas-quick-tip/ diff --git a/sources/tech/20200526 Create interactive content in WordPress with the H5P plugin.md b/sources/tech/20200526 Create interactive content in WordPress with the H5P plugin.md new file mode 100644 index 0000000000..871439e73a --- /dev/null +++ b/sources/tech/20200526 Create interactive content in WordPress with the H5P plugin.md @@ -0,0 +1,130 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Create interactive content in WordPress with the H5P plugin) +[#]: via: (https://opensource.com/article/20/5/h5p-wordpress) +[#]: author: (Don Watkins https://opensource.com/users/don-watkins) + +Create interactive content in WordPress with the H5P plugin +====== +Turn your WordPress site into an interactive learning management system +with this open source plugin. +![Family learning and reading together at night in a room][1] + +WordPress is best known as a website content management system, but it also a great [learning management system][2] (LMS) for delivering online courses. If that is what you are looking for out of WordPress, then [H5P][3] should be the top plugin on your list. + +H5P is a way to create and share interactive HTML5 content, including presentations, games, quizzes, forms, and more, in a browser. You can download a wide variety of content types from H5P's [Examples and Downloads][4] page, or you can create unique content to embed in your WordPress site. + +H5P provides plugins and integrations for WordPress, Moodle, Drupal, Canvas, Brightspace, Blackboard, and more. In this article, I will show how to use H5P in WordPress to create a reading comprehension quiz for students. + +### Install the H5P plugin + +The first step is to install the plugin. Log into your WordPress admin panel, go to **Plugins**, select **Add New**, and search for **H5P** in the Plugins field. When you find it, select **Install Now**. + +![Adding the H5P plugin][5] + +(Don Watkins, [CC BY-SA 4.0][6]) + +H5P should now appear in the list of installed plugins. Be sure to **Activate** the plugin by going to the H5P menu at the bottom of your WordPress admin panel and clicking the button. You will see the following display—be sure to consent so you can connect to the H5P Hub. + +![H5P consent option][7] + +(Don Watkins, [CC BY-SA 4.0][6]) + +Now you can begin adding H5P content to your WordPress installation. + +### Create a quiz + +One of my favorite poems is Robert Frost's "The Road Not Taken." Suppose you are teaching a class that is studying this poem, and one of your objectives is for your students to remember the poem's author. First, create a new WordPress post on your site that contains the poem's text and its author. + +![Creating a WordPress post][8] + +(Don Watkins, [CC BY-SA 4.0][6]) + +Now you want to test your students' comprehension with an HTML5 interactive content embedded below the poem. + +In the WordPress admin panel, look near the bottom for the **H5P Content** menu and select it. In the menu that appears, click **Add New**. + +![H5P Content menu][9] + +(Don Watkins, [CC BY-SA 4.0][6]) + +You will see an array of content options that are available. Since you want to create a multiple-choice quiz, look for the **Multiple Choice** option and click **Get** to its right. + +![H5P content types][10] + +(Don Watkins, [CC BY-SA 4.0][6]) + +A form will open for you to start creating the quiz. Fill in the required fields (marked with a red asterisk)—give your quiz a title (e.g., "Road Not Taken Quiz"), enter a question (e.g., "Who wrote, 'The Road Not Taken'?") and correct and incorrect answers, and select the correct answer in the dialog box. When you finish creating the quiz, save the content. + +![H5P quiz][11] + +(Don Watkins, [CC BY-SA 4.0][6]) + +### Embed the quiz in a post + +Now you're ready to insert the quiz exactly where you want it to appear in your post. Open the post where you want to put the quiz (e.g., "The Road Not Taken" post) in your WordPress editor, and you should see an **Add H5P** button near the top of the interface. Place your cursor wherever you want the quiz to appear in the post, and click **Add H5P**. Your H5P content will appear in a dialog box like this: + +![H5P list of interactive content][12] + +(Don Watkins, [CC BY-SA 4.0][6]) + +Select the content you want, and H5P will insert an embed code (e.g., `[h5p id="1"]`) in the post, like this: + +![H5P embed code in a post][13] + +(Don Watkins, [CC BY-SA 4.0][6]) + +Save your post, then open it in your browser. The quiz is exactly where you wanted it to appear in the post: + +![H5P quiz shown in the post][14] + +(Don Watkins, [CC BY-SA 4.0][6]) + +When a student answers this question correctly, they get pleasant visual feedback: + +![Correct answer selection][15] + +(Don Watkins, [CC BY-SA 4.0][6]) + +### The possibilities are endless + +H5P offers a wide range of options to add interactivity to WordPress posts. In this example, you could have created a more complex set of multiple-choice questions. H5P also has lots of other content types, including interactive video, arithmetic quizzes, an audio recorder, image hotspots, fill-in-the-blank quizzes, and [many more][4]. + +H5P also provides [excellent documentation][16] and [great tutorials][17] to help anyone who wants to use the plugin on their WordPress site. H5P software is open source under the [MIT License][18] with the code available on [GitHub][19]. H5P also welcomes contributions to the community; check out the [developer guide][20] for more information. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/20/5/h5p-wordpress + +作者:[Don Watkins][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/don-watkins +[b]: https://github.com/lujun9972 +[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/family_learning_kids_night_reading.png?itok=6K7sJVb1 (Family learning and reading together at night in a room) +[2]: https://en.wikipedia.org/wiki/Learning_management_system +[3]: https://h5p.org/ +[4]: https://h5p.org/content-types-and-applications +[5]: https://opensource.com/sites/default/files/uploads/addplugins-h5p.png (Adding the H5P plugin) +[6]: https://creativecommons.org/licenses/by-sa/4.0/ +[7]: https://opensource.com/sites/default/files/uploads/h5p-consent.png (H5P consent option) +[8]: https://opensource.com/sites/default/files/uploads/wordpress-post.png (WordPress post) +[9]: https://opensource.com/sites/default/files/uploads/h5p-content-menu.png (H5P Content menu) +[10]: https://opensource.com/sites/default/files/uploads/h5p-content-types.png (H5P content types) +[11]: https://opensource.com/sites/default/files/uploads/h5p-multiple-choice-quiz.png (H5P quiz) +[12]: https://opensource.com/sites/default/files/uploads/h5p-insert-interactive-content.png (H5P list of interactive content) +[13]: https://opensource.com/sites/default/files/uploads/h5p-embedded-content.png (H5P embed code in a post) +[14]: https://opensource.com/sites/default/files/uploads/h5p-quiz.png (H5P quiz shown in the post) +[15]: https://opensource.com/sites/default/files/uploads/h5p-correct-answer.png (Correct answer selection) +[16]: https://h5p.org/documentation/setup/wordpress +[17]: https://h5p.org/documentation/for-authors/tutorials +[18]: https://h5p.org/MIT-licensed +[19]: https://github.com/h5p +[20]: https://h5p.org/developers diff --git a/sources/tech/20200527 Manage startup using systemd.md b/sources/tech/20200527 Manage startup using systemd.md new file mode 100644 index 0000000000..c0ff18a13d --- /dev/null +++ b/sources/tech/20200527 Manage startup using systemd.md @@ -0,0 +1,567 @@ +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: url: ( ) +[#]: subject: (Manage startup using systemd) +[#]: via: (https://opensource.com/article/20/5/manage-startup-systemd) +[#]: author: (David Both https://opensource.com/users/dboth) + +Manage startup using systemd +====== +Learn how systemd determines the order services start, even though it is +essentially a parallel system. +![Penguin with green background][1] + +While setting up a Linux system recently, I wanted to know how to ensure that dependencies for services and other units were up and running before those dependent services and units start. Specifically, I needed more knowledge of how systemd manages the startup sequence, especially in determining the order services are started in what is essentially a parallel system. + +You may know that SystemV (systemd's predecessor, as I explained in the [first article][2] in this series) orders the startup sequence by naming the startup scripts with an SXX prefix, where XX is a number from 00 to 99. SystemV then uses the sort order by name and runs each start script in sequence for the desired runlevel. + +But systemd uses unit files, which can be created or modified by a sysadmin, to define subroutines for not only initialization but also for regular operation. In the [third article][3] in this series, I explained how to create a mount unit file. In this fifth article, I demonstrate how to create a different type of unit file—a service unit file that runs a program at startup. You can also change certain configuration settings in the unit file and use the systemd journal to view the location of your changes in the startup sequence. + +### Preparation + +Make sure you have removed `rhgb` and `quiet` from the `GRUB_CMDLINE_LINUX=` line in the `/etc/default/grub` file, as I showed in the [second article][4] in this series. This enables you to observe the Linux startup message stream, which you'll need for some of the experiments in this article. + +### The program + +In this tutorial, you will create a simple program that enables you to observe a message during startup on the console and later in the systemd journal. + +Create the shell program `/usr/local/bin/hello.sh` and add the following content. You want to ensure that the result is visible during startup and that you can easily find it when looking through the systemd journal. You will use a version of the "Hello world" program with some bars around it, so it stands out. Make sure the file is executable and has user and group ownership by root with [700 permissions][5] for security: + + +``` +#!/usr/bin/bash +# Simple program to use for testing startup configurations +# with systemd. +# By David Both +# Licensed under GPL V2 +# +echo "###############################" +echo "######### Hello World! ########" +echo "###############################" +``` + +Run this program from the command line to verify that it works correctly: + + +``` +[root@testvm1 ~]# hello.sh +############################### +######### Hello World! ######## +############################### +[root@testvm1 ~]# +``` + +This program could be created in any scripting or compiled language. The `hello.sh` program could also be located in other places based on the [Linux filesystem hierarchical structure][6] (FHS). I place it in the `/usr/local/bin` directory so that it can be easily run from the command line without having to prepend a path when I type the command. I find that many of the shell programs I create need to be run from the command line and by other tools such as systemd. + +### The service unit file + +Create the service unit file `/etc/systemd/system/hello.service` with the following content. This file does not need to be executable, but for security, it does need user and group ownership by root and [644][7] or [640][8] permissions: + + +``` +# Simple service unit file to use for testing +# startup configurations with systemd. +# By David Both +# Licensed under GPL V2 +# + +[Unit] +Description=My hello shell script + +[Service] +Type=oneshot +ExecStart=/usr/local/bin/hello.sh + +[Install] +WantedBy=multi-user.target +``` + +Verify that the service unit file performs as expected by viewing the service status. Any syntactical errors will show up here: + + +``` +[root@testvm1 ~]# systemctl status hello.service +● hello.service - My hello shell script +     Loaded: loaded (/etc/systemd/system/hello.service; disabled; vendor preset: disabled) +     Active: inactive (dead) +[root@testvm1 ~]# +``` + +You can run this "oneshot" service type multiple times without problems. The oneshot type is intended for services where the program launched by the service unit file is the main process and must complete before systemd starts any dependent process. + +There are seven service types, and you can find an explanation of each (along with the other parts of a service unit file) in the [systemd.service(5)][9] man page. (You can also find more information in the [resources][10] at the end of this article.) + +As curious as I am, I wanted to see what an error might look like. So, I deleted the "o" from the `Type=oneshot` line, so it looked like `Type=neshot`, and ran the command again: + + +``` +[root@testvm1 ~]# systemctl status hello.service +● hello.service - My hello shell script +     Loaded: loaded (/etc/systemd/system/hello.service; disabled; vendor preset: disabled) +     Active: inactive (dead) + +May 06 08:50:09 testvm1.both.org systemd[1]: /etc/systemd/system/hello.service:12: Failed to parse service type, ignoring: neshot +[root@testvm1 ~]# +``` + +These results told me precisely where the error was and made it very easy to resolve the problem. + +Just be aware that even after you restore the `hello.service` file to its original form, the error will persist. Although a reboot will clear the error, you should not have to do that, so I went looking for a method to clear out persistent errors like this. I have encountered service errors that require the command `systemctl daemon-reload` to reset an error condition, but that did not work in this case. The error messages that can be fixed with this command always seem to have a statement to that effect, so you know to run it. + +It is, however, recommended that you run `systemctl daemon-reload` after changing a unit file or creating a new one. This notifies systemd that the changes have been made, and it can prevent certain types of issues with managing altered services or units. Go ahead and run this command. + +After correcting the misspelling in the service unit file, a simple `systemctl restart hello.service` cleared the error. Experiment a bit by introducing some other errors into the `hello.service` file to see what kinds of results you get. + +### Start the service + +Now you are ready to start the new service and check the status to see the result. Although you probably did a restart in the previous section, you can start or restart a oneshot service as many times as you want since it runs once and then exits. + +Go ahead and start the service (as shown below), and then check the status. Depending upon how much you experimented with errors, your results may differ from mine: + + +``` +[root@testvm1 ~]# systemctl start hello.service +[root@testvm1 ~]# systemctl status hello.service +● hello.service - My hello shell script +     Loaded: loaded (/etc/systemd/system/hello.service; disabled; vendor preset: disabled) +     Active: inactive (dead) + +May 10 10:37:49 testvm1.both.org hello.sh[842]: ######### Hello World! ######## +May 10 10:37:49 testvm1.both.org hello.sh[842]: ############################### +May 10 10:37:49 testvm1.both.org systemd[1]: hello.service: Succeeded. +May 10 10:37:49 testvm1.both.org systemd[1]: Finished My hello shell script. +May 10 10:54:45 testvm1.both.org systemd[1]: Starting My hello shell script... +May 10 10:54:45 testvm1.both.org hello.sh[1380]: ############################### +May 10 10:54:45 testvm1.both.org hello.sh[1380]: ######### Hello World! ######## +May 10 10:54:45 testvm1.both.org hello.sh[1380]: ############################### +May 10 10:54:45 testvm1.both.org systemd[1]: hello.service: Succeeded. +May 10 10:54:45 testvm1.both.org systemd[1]: Finished My hello shell script. +[root@testvm1 ~]# +``` + +Notice in the status command's output that the systemd messages indicate that the `hello.sh` script started and the service completed. You can also see the output from the script. This display is generated from the journal entries of the most recent invocations of the service. Try starting the service several times, and then run the status command again to see what I mean. + +You should also look at the journal contents directly; there are multiple ways to do this. One way is to specify the record type identifier, in this case, the name of the shell script. This shows the journal entries for previous reboots as well as the current session. As you can see, I have been researching and testing for this article for some time now: + + +``` +[root@testvm1 ~]# journalctl -t hello.sh +<snip> +\-- Reboot -- +May 08 15:55:47 testvm1.both.org hello.sh[840]: ############################### +May 08 15:55:47 testvm1.both.org hello.sh[840]: ######### Hello World! ######## +May 08 15:55:47 testvm1.both.org hello.sh[840]: ############################### +\-- Reboot -- +May 08 16:01:51 testvm1.both.org hello.sh[840]: ############################### +May 08 16:01:51 testvm1.both.org hello.sh[840]: ######### Hello World! ######## +May 08 16:01:51 testvm1.both.org hello.sh[840]: ############################### +\-- Reboot -- +May 10 10:37:49 testvm1.both.org hello.sh[842]: ############################### +May 10 10:37:49 testvm1.both.org hello.sh[842]: ######### Hello World! ######## +May 10 10:37:49 testvm1.both.org hello.sh[842]: ############################### +May 10 10:54:45 testvm1.both.org hello.sh[1380]: ############################### +May 10 10:54:45 testvm1.both.org hello.sh[1380]: ######### Hello World! ######## +May 10 10:54:45 testvm1.both.org hello.sh[1380]: ############################### +[root@testvm1 ~]# +``` + +To locate the systemd records for the `hello.service` unit, you can search on systemd. You can use **G+Enter** to page to the end of the journal entries and then scroll back to locate the ones you are interested in. Use the `-b` option to show only the entries for the most recent startup: + + +``` +[root@testvm1 ~]# journalctl -b -t systemd +<snip> +May 10 10:37:49 testvm1.both.org systemd[1]: Starting SYSV: Late init script for live image.... +May 10 10:37:49 testvm1.both.org systemd[1]: Started SYSV: Late init script for live image.. +May 10 10:37:49 testvm1.both.org systemd[1]: hello.service: Succeeded. +May 10 10:37:49 testvm1.both.org systemd[1]: Finished My hello shell script. +May 10 10:37:50 testvm1.both.org systemd[1]: Starting D-Bus System Message Bus... +May 10 10:37:50 testvm1.both.org systemd[1]: Started D-Bus System Message Bus. +``` + +I copied a few other journal entries to give you an idea of what you might find. This command spews all of the journal lines pertaining to systemd—109,183 lines when I wrote this. That is a lot of data to sort through. You can use the pager's search facility, which is usually `less`, or you can use the built-in `grep` feature. The `-g` (or `--grep=`) option uses Perl-compatible regular expressions: + + +``` +[root@testvm1 ~]# journalctl -b -t systemd -g "hello" +[root@testvm1 ~]# journalctl -b -t systemd -g "hello" +\-- Logs begin at Tue 2020-05-05 18:11:49 EDT, end at Sun 2020-05-10 11:01:01 EDT. -- +May 10 10:37:49 testvm1.both.org systemd[1]: Starting My hello shell script... +May 10 10:37:49 testvm1.both.org systemd[1]: hello.service: Succeeded. +May 10 10:37:49 testvm1.both.org systemd[1]: Finished My hello shell script. +May 10 10:54:45 testvm1.both.org systemd[1]: Starting My hello shell script... +May 10 10:54:45 testvm1.both.org systemd[1]: hello.service: Succeeded. +May 10 10:54:45 testvm1.both.org systemd[1]: Finished My hello shell script. +[root@testvm1 ~]# +``` + +You could use the standard GNU `grep` command, but that would not show the log metadata in the first line. + +If you do not want to see just the journal entries pertaining to your `hello` service, you can narrow things down a bit by specifying a time range. For example, I will start with the beginning time of `10:54:00` on my test VM, which was the start of the minute the entries above are from. ****Note that the `--since=` option must be enclosed in quotes and that this option can also be expressed as `-S "