mirror of
https://github.com/LCTT/TranslateProject.git
synced 2025-01-19 22:51:41 +08:00
Merge remote-tracking branch 'LCTT/master'
This commit is contained in:
commit
43c8d0f369
98
published/20190422 9 ways to save the planet.md
Normal file
98
published/20190422 9 ways to save the planet.md
Normal file
@ -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]。如果要禁用光标闪烁,可以通过更改终端设置:<ruby>编辑<rt>Edit</rt></ruby> > <ruby>偏好设置<rt>Preferences</rt></ruby> > <ruby>光标<rt>Cursor</rt></ruby> > <ruby>光标闪烁<rt>Cursor blinking</rt></ruby> > <ruby>禁用<rt>Disabled</rt></ruby>。
|
||||
|
||||
*由 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、关掉你的灯
|
||||
|
||||
根据<ruby>[人工夜空亮度图集][8]<rt>World Atlas of Artificial Night Sky Brightness</rt></ruby>的说法,光污染影响了全世界超过 80% 的人口。这一结论在 2016 年(遵循 CC-NC 4.0 协议)发表在公开访问的期刊《<ruby>科学进展<rt>Science Advances</rt></ruby>》上。关闭外部照明是一个可以使野生生物、人类健康受益并让我们享受夜晚的天空的快速途径,而且可以减少能量消耗。访问 [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/
|
@ -1,34 +1,36 @@
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: (geekpi)
|
||||
[#]: reviewer: ( )
|
||||
[#]: publisher: ( )
|
||||
[#]: url: ( )
|
||||
[#]: 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+ 是一款智能手机上的开源科学计算器
|
||||
Calculator N+:一款智能手机上的开源科学计算器
|
||||
======
|
||||
这个 Android 应用可在掌中计算许多高级数学函数。
|
||||
![scientific calculator][1]
|
||||
|
||||
移动电话每天都在变得越来越强大,因此毫不奇怪它们可以击败大多数不太久前的大多数计算机。这也意味着上面的工具每天都在变得越来越强大。
|
||||
> 这个 Android 应用可在掌中计算许多高级数学函数。
|
||||
|
||||
之前,我写过一篇 [Linux 桌面上的科学计算器][2],我接着将介绍 [Calculator N +][3],这是一个很棒的 GPL v3.0 许可证下的,适用于 Android 设备的计算机代数系统(CAS)应用。
|
||||
![](https://img.linux.net.cn/data/attachment/album/202003/10/113543hlb5xu7b5e17ba90.jpg)
|
||||
|
||||
Calculator N+ 被认为是“适用于 Android 的强大计算器”,但这是一个谦虚的说法。它不仅可以以任意精度工作,还可以显示根数和分数等_很多_功能。
|
||||
移动电话每天都在变得越来越强大,因此毫不奇怪它们可以击败不太久前的大多数计算机。这也意味着移动手机上的工具每天都在变得越来越强大。
|
||||
|
||||
之前,我写过一篇 [两款 Linux 桌面端可用的科学计算器][2],我接着将介绍 [Calculator N+][3],这是一款很棒的适用于 Android 设备的计算机代数系统(CAS)应用,采用 GPL v3.0 许可证下。
|
||||
|
||||
Calculator N+ 被认为是“适用于 Android 的强大计算器”,但这是一个谦虚的说法。它不仅可以以任意精度工作,还可以显示根数和分数等*很多*功能。
|
||||
|
||||
寻找多项式根?可以。分解因数?可以。导数、积分和极限?可以。数论(模算术、组合学、素因数分解)?可以。
|
||||
|
||||
你还可以求解系统方程、简化表达式(包括三角函数)、转换单位,只要你想到的,它都能做!
|
||||
你还可以求解方程系统、简化表达式(包括三角函数)、转换单位,只要你想到的,它都能做!
|
||||
|
||||
![Calculator N+ graphical interface][4]
|
||||
|
||||
结果以 LaTeX 输出。左上方的菜单提供了许多强大的功能,只需触摸一下即可使用。同样在该菜单中,你将找到该应用所有功能的帮助文件。在屏幕的右上角,你可以在精确和十进制表示之间切换。最后,点击屏幕底部的蓝色条,即可访问应用中的所有功能库。不过要小心!如果你不是数学家、物理学家或工程师,那么这么长的列表会看上去很震撼。
|
||||
其结果以 LaTeX 输出。左上方的菜单提供了许多强大的功能,只需触摸一下即可使用。同样在该菜单中,你将找到该应用所有功能的帮助文件。在屏幕的右上角,你可以在精确表示法和十进制表示法之间切换。最后,点击屏幕底部的蓝色栏,即可访问应用中的所有函数库。不过要小心!如果你不是数学家、物理学家或工程师,那么这么长的列表会看上去很吓人。
|
||||
|
||||
所有这些功能都来自 [Symja 库][5],这是另一个出色的 GPL 3 项目。
|
||||
|
||||
这两个项目都处于积极开发中,并且每个版本都在不断完善。特别是,Calculator N+ 的 v3.4.6 在用户界面 (UI) 品质方面取得了重大飞跃。但是还是存在一些不好的地方,但是要在智能手机的小巧的用户界面中发挥如此强大的功能是一项艰巨的任务,我认为应用开发人员正在很好地解决其剩余的问题。对他们表示敬意!
|
||||
这两个项目都处于积极开发中,并且每个版本都在不断完善。特别是,Calculator N+ 的 v3.4.6 在用户界面(UI)品质方面取得了重大飞跃。虽然还是存在一些不够好的地方,但是要在智能手机的小巧的用户界面中发挥如此强大的功能是一项艰巨的任务,我认为应用开发人员正在很好地解决其剩余的问题。对他们表示敬意!
|
||||
|
||||
如果你是老师、学生或在理工科领域工作,请试试 Calculator N+。它是免费、无广告、开源的,并可以满足你所有的数学需求。(当然,除了数学考试期间,为防止作弊绝对不允许使用智能手机。)
|
||||
|
||||
@ -43,14 +45,14 @@ via: https://opensource.com/article/19/11/calculator-n-mobile
|
||||
作者:[Ricardo Berlasso][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/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
|
||||
[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
|
@ -1,5 +1,5 @@
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: ( )
|
||||
[#]: translator: (geekpi)
|
||||
[#]: reviewer: ( )
|
||||
[#]: publisher: ( )
|
||||
[#]: url: ( )
|
||||
|
@ -1,5 +1,5 @@
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: ( )
|
||||
[#]: translator: (robsean)
|
||||
[#]: reviewer: ( )
|
||||
[#]: publisher: ( )
|
||||
[#]: url: ( )
|
||||
|
@ -1,118 +0,0 @@
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: (wenwensnow)
|
||||
[#]: reviewer: ( )
|
||||
[#]: publisher: ( )
|
||||
[#]: url: ( )
|
||||
[#]: 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)
|
||||
|
||||
3 eBook readers for the Linux desktop 针对Linux桌面版的3个电子书阅读器
|
||||
======
|
||||
Any of these open source eBook applications will make it easy to read
|
||||
your books on a larger screen. 任意一个开源电子书应用都能使你在更大屏幕上的阅读体验得到提升。
|
||||
![Computer browser with books on the screen][1]
|
||||
|
||||
I usually read eBooks on my phone or with my Kobo eReader. I've never been comfortable reading books on larger screens. However, many people regularly read books on their laptops or desktops. If you are one of them (or think you might be), I'd like to introduce you to three eBook readers for the Linux desktop.
|
||||
|
||||
### Bookworm
|
||||
|
||||
[Bookworm][2] is billed as a "simple, focused eBook reader." And it is. Bookworm has a basic set of features, which some people will complain about being _too basic_ or lacking _functionality_ (whatever that word means). Bookworm does one thing and does it well without unnecessary frills.
|
||||
|
||||
The application's interface is very clean and uncluttered.
|
||||
|
||||
![Bookworm e-book application][3]
|
||||
|
||||
You navigate through a book by pressing:
|
||||
|
||||
* The space bar to move down a page
|
||||
* The Down and Up arrow keys to move down and up a single line
|
||||
* The Right and Left arrow keys to jump to the next or previous chapter
|
||||
|
||||
|
||||
|
||||
You can also annotate portions of a book and insert bookmarks to jump back to a page.
|
||||
|
||||
![Annotations in Bookworm][4]
|
||||
|
||||
Bookworm doesn't have many configuration options. You can change the size and spacing of a book's font, enable a two-page reading view or dark mode, and add folders that Bookworm will scan to find new eBooks.
|
||||
|
||||
![Bookworm preferences][5]
|
||||
|
||||
Bookworm supports the most widely used eBook formats: EPUB, PDF, MOBI, and [FB2][6]. You can also use Bookworm to read popular digital comic book formats [CBR][7] and CBZ. I've tested Bookworm with only the first three formats. PDF files are readable, but they load slowly and the formatting can be rather ugly.
|
||||
|
||||
### Foliate
|
||||
|
||||
As far as features go, [Foliate][8] is a step or two above Bookworm. Not only does it have several more features, but it also has more configuration options. You get all of that in a zippy, clean, and uncluttered package.
|
||||
|
||||
![Foliate e-book application][9]
|
||||
|
||||
You can navigate through an eBook in Foliate using the space bar, arrow keys, or PgUp and PgDn keys. There's nothing unique there.
|
||||
|
||||
You can also annotate text, look up and translate words and phrases, and look up the meanings of words. If you have a text-to-speech application installed on your computer, Foliate can use it to read books aloud.
|
||||
|
||||
![Annotating a book in Foliate][10]
|
||||
|
||||
Foliate has a few more customization options than Bookworm. You can change a book's font and its size, the spacing of lines, and the size of a book's margins. You can also increase or decrease the brightness and select one of four built-in themes.
|
||||
|
||||
![Foliate settings][11]
|
||||
|
||||
You can read books in the EPUB, MOBI, AZW, and AZW3 formats using Foliate. In case you're wondering, the latter three are closed formats used with books published for Amazon's Kindle eReader
|
||||
|
||||
### Calibre's eBook viewer
|
||||
|
||||
[eBook viewer][12] is a component of the [Calibre][13] eBook management tool. Like its parent, the eBook viewer feature isn't the prettiest piece of software out there.
|
||||
|
||||
![E-book Viewer application][14]
|
||||
|
||||
Don't let that put you off, though. It's a solid desktop eBook reader.
|
||||
|
||||
You navigate through an eBook in Calibre's e-book viewer using the arrow and PgUp/PgDn keys or by pressing the space bar. You can also look up words in an online dictionary and add bookmarks throughout a book. E-book viewer lacks an annotation function, but its built-in search engine is solid, and you can save books as PDFs (though I'm not sure why you'd want to).
|
||||
|
||||
Configuration options are an area where this eBook viewer shines. It has far more of them than both Bookworm and Foliate combined. You can change everything from fonts to the layout of text to how text is broken up into pages. On top of that, you can customize the keyboard shortcuts for using the application and add your favorite dictionary website or sites to help you look up words in a book you're reading.
|
||||
|
||||
![E-book Viewer preferences][15]
|
||||
|
||||
One useful feature of Calibre's eBook viewer is the ability to apply your own CSS file to your e-books. CSS, in case you're wondering, is a way to format web pages (which is what many e-books are made of). If you're a master with CSS, you can copy and paste your CSS file into the **User stylesheet** tab in eBook viewer's Preferences window. That's the ultimate in customization.
|
||||
|
||||
eBook viewer, according to its developer, "can display all the major e-book formats." If you're wondering what those formats are, [here's a list][16]. I've tested it with just a few of those formats and have had no problems with them.
|
||||
|
||||
### Final thought
|
||||
|
||||
Whether you're looking for a simple eBook reader or one with bells and whistles and whatever else, the three applications in this article are good choices. Any of them can make reading an eBook on a larger screen easier.
|
||||
|
||||
* * *
|
||||
|
||||
_This article is based on an article published on [Open Source Musings][17] and appears here via a [CC BY-SA 4.0][18] license._
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://opensource.com/article/20/2/linux-ebook-readers
|
||||
|
||||
作者:[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://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/
|
@ -1,161 +0,0 @@
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: (geekpi)
|
||||
[#]: reviewer: ( )
|
||||
[#]: publisher: ( )
|
||||
[#]: url: ( )
|
||||
[#]: 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/)
|
||||
|
||||
Converting between uppercase and lowercase on the Linux command line
|
||||
======
|
||||
Converting text between uppercase and lowercase can be very tedious, especially when you want to avoid inadvertent misspellings. Fortunately, Linux provides a handful of commands that can make the job very easy.
|
||||
[andy.brandon50][1] [(CC BY-SA 2.0)][2]
|
||||
|
||||
There are many ways to change text on the Linux command line from lowercase to uppercase and vice versa. In fact, you have an impressive set of commands to choose from. This post examines some of the best commands for the job and how you can get them to do just what you want.
|
||||
|
||||
### Using tr
|
||||
|
||||
The **tr** (translate) command is one of the easiest to use on the command line or within a script. If you have a string that you want to be sure is in uppercase, you just pass it through a **tr** command like this:
|
||||
|
||||
```
|
||||
$ echo Hello There | tr [:lower:] [:upper:]
|
||||
HELLO THERE
|
||||
```
|
||||
|
||||
[[Get regularly scheduled insights by signing up for Network World newsletters.]][3]
|
||||
|
||||
Below is an example of using this kind of command in a script when you want to be sure that all of the text that is added to a file is in uppercase for consistency:
|
||||
|
||||
```
|
||||
#!/bin/bash
|
||||
|
||||
echo -n "Enter department name: "
|
||||
read dept
|
||||
echo $dept | tr [:lower:] [:upper:] >> depts
|
||||
```
|
||||
|
||||
Switching the order to [:upper:] [:lower:] would have the opposite effect, putting all the department names in lowercase:
|
||||
|
||||
```
|
||||
echo $dept | tr [:upper:] [:lower:] >> depts
|
||||
```
|
||||
|
||||
Similarly, you could use the **sed** command's **A-Z** and **a-z** strings to accomplish the same thing:
|
||||
|
||||
```
|
||||
echo $dept | tr a-z A-Z >> depts
|
||||
```
|
||||
|
||||
As you undoubtedly suspect, reversing the order of the a-z and A-Z strings will have the opposite effect, turning the text to all lowercase.
|
||||
|
||||
### Using awk
|
||||
|
||||
The **awk** command lets you do the same thing with its **toupper** and **tolower** options. The command in the script shown in the previous example could be done this way instead:
|
||||
|
||||
[][4]
|
||||
|
||||
```
|
||||
echo $dept | awk '{print toupper($0)}' >> depts
|
||||
```
|
||||
|
||||
The reverse (switching to lowercase) would look like this:
|
||||
|
||||
```
|
||||
echo $dept | awk '{print tolower($0)}' >> depts
|
||||
```
|
||||
|
||||
### Using sed
|
||||
|
||||
The **sed** (stream editor) command also does a great job of switching between upper- and lowercase. This command would have the same effect as the first of the two shown above.
|
||||
|
||||
```
|
||||
echo $dept | sed 's/[a-z]/\U&/g' >> depts
|
||||
```
|
||||
|
||||
Switching from uppercase to lowercase would simply involve replacing the **U** near the end of the line with an **L**.
|
||||
|
||||
```
|
||||
echo $dept | sed 's/[A-Z]/\L&/g' >> depts
|
||||
```
|
||||
|
||||
### Manipulating text in a file
|
||||
|
||||
Both **awk** and **sed** also allow you to change the case of text for entire files. So, you just found out your boss wanted those department names in all lowercase? No problem. Just run a command like this with the file name provided:
|
||||
|
||||
```
|
||||
$ awk '{print tolower($0)}' depts
|
||||
finance
|
||||
billing
|
||||
bookkeeping
|
||||
```
|
||||
|
||||
If you want to overwrite the **depts** file, instead of just displaying its contents in lowercase, you would need to do something like this:
|
||||
|
||||
```
|
||||
$ awk '{print tolower($0)}' depts > depts-
|
||||
$ mv depts- depts
|
||||
```
|
||||
|
||||
Making the change with **sed**, however, you can avoid that last step because **sed** can edit a file "in place" as shown here, leaving the file intact, but the text in all lowercase:
|
||||
|
||||
```
|
||||
$ sed 's/[A-Z]/\L&/g' depts
|
||||
```
|
||||
|
||||
### Capitalizing first letters only
|
||||
|
||||
To capitalize only the first letters of words in a string, you can do something like this:
|
||||
|
||||
```
|
||||
$ echo design \& engineering| sed -e "s/\b\(.\)/\u\1/g"
|
||||
Design & Engineering
|
||||
```
|
||||
|
||||
That command will ensure that first letters are capitalized, but won't change the rest of the letters.
|
||||
|
||||
### Making sure only first letters are uppercase
|
||||
|
||||
It's a little more challenging when you want to change text so that only first letters are in uppercase. Say you're manipulating a list of staff members' names and you want them to be formatted in the normal Firstname Lastname manner.
|
||||
|
||||
##### with sed
|
||||
|
||||
You could use a considerably more complex **sed** command to ensure this result:
|
||||
|
||||
```
|
||||
$ echo design \& ENGINEERING | sed 's/\b\([[:alpha:]]\)\([[:alpha:]]*\)\b/\u\1\L\2/g'
|
||||
Design & Engineering
|
||||
```
|
||||
|
||||
##### with python
|
||||
|
||||
If you have python loaded, you can run a command like this that also formats text so that only the first letters of each word are capitalized and the command may be a little easier to parse than the **sed** command shown above:
|
||||
|
||||
```
|
||||
$ echo -n "design & engineering" | python3 -c "import sys; print(sys.stdin.read().title())"
|
||||
Design & Engineering
|
||||
```
|
||||
|
||||
There are many ways to change the formatting of text between upper- and lowercase. Which works best depends in part of whether you're manipulating a single string or an entire file and how you want the end result to look.
|
||||
|
||||
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/3529409/converting-between-uppercase-and-lowercase-on-the-linux-command-line.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.flickr.com/photos/54027476@N07/4999959929
|
||||
[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
|
67
sources/tech/20200309 6 Raspberry Pi tutorials to try out.md
Normal file
67
sources/tech/20200309 6 Raspberry Pi tutorials to try out.md
Normal file
@ -0,0 +1,67 @@
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: ( )
|
||||
[#]: reviewer: ( )
|
||||
[#]: publisher: ( )
|
||||
[#]: url: ( )
|
||||
[#]: 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 Raspberry Pi tutorials to try out
|
||||
======
|
||||
Each of these Raspberry Pi projects is designed to make your life easier
|
||||
and more productive.
|
||||
![Cartoon graphic of Raspberry Pi board][1]
|
||||
|
||||
There's nothing like the thrill of experiencing the result of your Raspberry Pi creation. After hours of coding, testing, and building with your bare hands, your project starts to finally take shape and you can’t help but yell "woohoo!." I’m fascinated by the possibilities of what the Raspberry Pi can bring to daily life. Whether you are looking to learn something new, try a productivity hack, or just have fun, there is a Raspberry Pi project for you in this round-up.
|
||||
|
||||
### Set up a VPN server
|
||||
|
||||
This [tutorial][2] teaches you how to use the Raspberry Pi to add a layer of network security. Not only does this project have practical advantages, but it also sets you up for lots of fun to be had. The extra security will give you peace of mind to play around with other projects, like the ones listed below.
|
||||
|
||||
### Create an object-tracking camera
|
||||
|
||||
The Raspberry Pi is appealing because it offers a low barrier of entry to learn about new technologies like machine learning. This [step-by-step guide][3] gives thorough instructions on how to build a camera that pans and tilts in order to track movement with TensorFlow and your Raspberry Pi.
|
||||
|
||||
### Display your favorite memories using a photo slideshow
|
||||
|
||||
Have you ever asked yourself: "What should I do with all of these digital photos?." If you are like me, then the answer is **yes**. I am definitely known as the picture-taker in my circle of friends and family. That’s why I love this Raspberry Pi project. In [this tutorial][4], you’ll learn how to set up a photo slideshow so you can display your favorite memories in your home with ease. No printer necessary!
|
||||
|
||||
### Play retro video games
|
||||
|
||||
If you feel nostalgic about retro gaming systems, you’ll want to try [this tutorial][5]. Learn what kind of devices work for running an Amiga emulator including the Raspberry Pi. After going through the set-up instructions, you’ll be playing your favorite Amiga games on your Raspberry Pi.
|
||||
|
||||
### Build a clock for your entertainment center
|
||||
|
||||
Home entertainment centers have evolved so much in the last decade. My family relies solely on streaming services for watching shows and movies. I love this because I can control my TV from my mobile device or voice assistant. However, there’s a level of convenience that’s missing when you no longer can glance at a clock! Follow [these quick steps][6] to build your own clock display from scratching using your Raspberry Pi.
|
||||
|
||||
### Scale your homebrewed beer operation
|
||||
|
||||
In [this tutorial][7], a seasoned homebrewer shares his experience with setting up an electric beer-brewing system. This project requires more of an investment in hardware and parts upfront, but the resulting efficiency and consistency make it all worth it. Cheers to that!
|
||||
|
||||
If you are a Raspberry Pi newb like me, then I recommend checking out our downloadable Raspberry Pi guides. Our [one-page cheat sheet][8] offers step-by-step instructions for how to get started. For more tips and tutorials, our [comprehensive guide][9] covers topics like choosing a Raspberry Pi, keeping it updated, contributing to the community and everything in between.
|
||||
|
||||
Which Raspberry Pi project will you try? Let us know in the comments.
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://opensource.com/article/20/3/raspberry-pi-tutorials
|
||||
|
||||
作者:[Lauren Pritchett][a]
|
||||
选题:[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/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
|
194
sources/tech/20200309 Fish - A Friendly Interactive Shell.md
Normal file
194
sources/tech/20200309 Fish - A Friendly Interactive Shell.md
Normal file
@ -0,0 +1,194 @@
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: ( )
|
||||
[#]: reviewer: ( )
|
||||
[#]: publisher: ( )
|
||||
[#]: url: ( )
|
||||
[#]: 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 – A Friendly Interactive Shell
|
||||
======
|
||||
|
||||
![Fish — A Friendly Interactive Shell][1]
|
||||
|
||||
Are you looking for an alternative to bash? Are you looking for something more user-friendly? Then look no further because you just found the golden fish!
|
||||
|
||||
Fish (friendly interactive shell) is a smart and user-friendly command line shell that works on Linux, MacOS, and other operating systems. Use it for everyday work in your terminal and for scripting. Scripts written in fish are less cryptic than their equivalent bash versions.
|
||||
|
||||
### Fish’s user-friendly features
|
||||
|
||||
* **Suggestions**
|
||||
Fish will suggest commands that you have written before. This boosts productivity when typing same commands often.
|
||||
* **Sane scripting**
|
||||
Fish avoids using cryptic characters. This provides a clearer and friendlier syntax.
|
||||
* **Completion based on man pages**
|
||||
Fish will autocomplete parameters based on the the command’s man page.
|
||||
* **Syntax highlighting**
|
||||
Fish will highlight command syntax to make it visually friendly.
|
||||
|
||||
|
||||
|
||||
### Installation
|
||||
|
||||
#### Fedora Workstation
|
||||
|
||||
Use the _dnf_ command to install fish:
|
||||
|
||||
```
|
||||
$ sudo dnf install fish
|
||||
```
|
||||
|
||||
Make fish your default shell by installing the _util-linux-user_ package and then running the _chsh_ (change shell) command with the appropriate parameters:
|
||||
|
||||
```
|
||||
$ sudo dnf install util-linux-user
|
||||
$ chsh -s /usr/bin/fish
|
||||
```
|
||||
|
||||
You will need to log out and back in for this change to take effect.
|
||||
|
||||
#### Fedora Silverblue
|
||||
|
||||
Because this is not GUI application, you will need to layer it using _rpm-ostree_. Use the following command to install fish on Fedora Silverblue:
|
||||
|
||||
```
|
||||
$ rpm-ostree install fish
|
||||
```
|
||||
|
||||
On Fedora Silverblue you will need to reboot your PC to switch to the new ostree image.
|
||||
|
||||
If you want to make fish your main shell on Fedora Silverblue, the easiest way is to update the _/etc/passwd_ file. Find your user and change _/bin/bash_ to _/usr/bin/fish_.
|
||||
|
||||
You will need [root privileges][2] to edit the _/etc/passwd_ file. Also you will need to log out and back in for this change to take effect.
|
||||
|
||||
### Configuration
|
||||
|
||||
The per-user configuration file for fish is _~/.config/fish/config.fish_. To make configuration changes for all users, edit _/etc/fish/config.fish_ instead.
|
||||
|
||||
The per-user configuration file must be created manually. The installation scripts will not create _~/.config/fish/config.fish_.
|
||||
|
||||
Here are a couple configuration examples shown alongside their bash equivalents to get you started:
|
||||
|
||||
#### Creating aliases
|
||||
|
||||
* _~/.bashrc_: alias ll='ls -lh'
|
||||
* _~/.config/fish/config.fish_: alias ll='ls -lh'
|
||||
|
||||
|
||||
|
||||
#### Setting environment variables
|
||||
|
||||
* _~/.bashrc_: export PATH=$PATH:~/bin
|
||||
* _~/.config/fish/config.fish_: set -gx PATH $PATH ~/bin
|
||||
|
||||
|
||||
|
||||
### Working with fish
|
||||
|
||||
When fish is configured as your default shell, the command prompt will look similar to what is shown in the below image. If you haven’t configured fish to be your default shell, just run the _fish_ command to start it in your current terminal session.
|
||||
|
||||
![][3]
|
||||
|
||||
As you start typing commands, you will notice the syntax highlighting:
|
||||
|
||||
![][4]
|
||||
|
||||
Cool, isn’t it? 🙂
|
||||
|
||||
You will also see commands being suggested as you type. For example, start typing the previous command a second time:
|
||||
|
||||
![][5]
|
||||
|
||||
Notice the gray text that appears as you type. The gray text is fish suggesting the command you wrote before. To autocomplete it, just press **CTRL+F**.
|
||||
|
||||
Get argument suggestions based on the preceding command’s man page by typing a dash (**–**) and then the **TAB** key:
|
||||
|
||||
![][6]
|
||||
|
||||
If you press **TAB** once, it will show you the first few suggestions (or every suggestion, if there are only a few arguments available). If you press **TAB** a second time, it will show you all suggestions. If you press **TAB** three times consecutively, it will switch to interactive mode and you can select an argument using the arrow keys.
|
||||
|
||||
Otherwise, fish works similar to most other shells. The remaining differences are well documented. So it shouldn’t be difficult to find other features that you may be interested in.
|
||||
|
||||
### Make fish even more powerful
|
||||
|
||||
Make the fish even more powerful with [powerline][7]. Powerline adds command execution time, colored git status, current git branch and much more to fish’s interface.
|
||||
|
||||
Before installing powerline for fish, you must install [Oh My Fish][8]. Oh My Fish extends fish’s core infrastructure to enable the installation of additional plugins. The easiest way to install Oh My Fish is to use the _curl_ command:
|
||||
|
||||
```
|
||||
> curl -L https://get.oh-my.fish | fish
|
||||
```
|
||||
|
||||
If you don’t want to pipe the installation commands directly to _curl_, see the installation section of Oh My Fish’s [README][9] for alternative installation methods.
|
||||
|
||||
Fish’s powerline plugin is [bobthefish][7]. Bobthefish requires the _powerline-fonts_ package.
|
||||
|
||||
**On Fedora Workstation**:
|
||||
|
||||
```
|
||||
> sudo dnf install powerline-fonts
|
||||
```
|
||||
|
||||
**On Fedora Silverblue**:
|
||||
|
||||
```
|
||||
> rpm-ostree install powerline-fonts
|
||||
```
|
||||
|
||||
On Fedora Silverblue you will have to reboot to complete the installation of the fonts.
|
||||
|
||||
After you have installed the _powerline-fonts_ package, install _bobthefish_:
|
||||
|
||||
```
|
||||
> omf install bobthefish
|
||||
```
|
||||
|
||||
Now you can experience the full awesomeness of fish with powerline:
|
||||
|
||||
![][10]
|
||||
|
||||
### Additional resources
|
||||
|
||||
Check out these web pages to learn even more about fish:
|
||||
|
||||
* [Official page][11]
|
||||
* [Documentation][12]
|
||||
* [Tutorial][13]
|
||||
* [FAQ][14]
|
||||
* [Web playground][15]
|
||||
* [Mailing lists][16]
|
||||
* [GitHub][17]
|
||||
|
||||
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://fedoramagazine.org/fish-a-friendly-interactive-shell/
|
||||
|
||||
作者:[Michal Konečný][a]
|
||||
选题:[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/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/
|
@ -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 <https://kubernetes-charts.storage.googleapis.com>
|
||||
"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: <https://hub.docker.com/r/bitnami/mediawiki/tags/>
|
||||
##
|
||||
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: <http://kubernetes.io/docs/user-guide/images/\#pre-pulling-images>
|
||||
##
|
||||
pullPolicy: IfNotPresent
|
||||
## Optionally specify an array of imagePullSecrets.
|
||||
## Secrets must be manually created in the namespace.
|
||||
## ref: <https://kubernetes.io/docs/tasks/configure-pod-container/pull-image-private-registry/>
|
||||
##
|
||||
# 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: <https://github.com/bitnami/bitnami-docker-mediawiki\#environment-variables>
|
||||
##
|
||||
mediawikiUser: cherrybomb
|
||||
|
||||
## Application password
|
||||
## Defaults to a random 10-character alphanumeric string if not set
|
||||
## ref: <https://github.com/bitnami/bitnami-docker-mediawiki\#environment-variables>
|
||||
##
|
||||
# mediawikiPassword:
|
||||
|
||||
## Admin email
|
||||
## ref: <https://github.com/bitnami/bitnami-docker-mediawiki\#environment-variables>
|
||||
##
|
||||
mediawikiEmail: [root@example.com][16]
|
||||
|
||||
## Name for the wiki
|
||||
## ref: <https://github.com/bitnami/bitnami-docker-mediawiki\#environment-variables>
|
||||
##
|
||||
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
|
||||
##
|
||||
## <https://github.com/helm/charts/blob/master/stable/mariadb/values.yaml>
|
||||
##
|
||||
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: <https://github.com/bitnami/bitnami-docker-mariadb/blob/master/README.md\#creating-a-database-user-on-first-run>
|
||||
##
|
||||
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 <http://kubernetes.io/docs/tasks/access-application-cluster/create-external-load-balancer/\#preserving-the-client-source-ip>
|
||||
##
|
||||
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)
|
@ -0,0 +1,103 @@
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: ( )
|
||||
[#]: reviewer: ( )
|
||||
[#]: publisher: ( )
|
||||
[#]: url: ( )
|
||||
[#]: 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: A Firefox Fork For The Classic Looks and Classic Extensions
|
||||
======
|
||||
|
||||
_**Brief: Basilisk is a Firefox fork that supports legacy extensions and much more. Here, we take a look at its features and try it out.**_
|
||||
|
||||
### Basilisk: Open Source XUL-Based Web Browser
|
||||
|
||||
Even though it is better to stick with the regular web browsers like Firefox or Chromium available for Linux – it doesn’t hurt to know about other browsers. Recently, I stumbled upon a Firefox fork, [Basilisk][1] web browser that features the classic Firefox user interface along with legacy add-ons support (just like [Waterfox][2]).
|
||||
|
||||
![itsfoss.com homepage on Basilisk][3]
|
||||
|
||||
If you are in the dire need of using a legacy extensions or miss the classic look and feel of Firefox, the Basilisk web browser can save your day. The web browser is being maintained by the team behind [Pale Moon][4] browser (which is another Firefox fork I will be looking at next).
|
||||
|
||||
If you’re looking for open-source [Chrome alternatives][5], you may have a quick look at what Basilisk offers.
|
||||
|
||||
**Note:** _Basilisk is a development software. Even though I didn’t have any major usability issues for the time I used, you should not rely on it as the only browser to use._
|
||||
|
||||
### Features of Basilisk web browser
|
||||
|
||||
![][6]
|
||||
|
||||
Basilisk works out of the box. However, here are some features you might want to take a look before considering to use it:
|
||||
|
||||
* [XUL][7]-based web browser
|
||||
* It features the ‘Australis’ Firefox interface, which was quite popular back in the time of v29 – v56 Firefox version.
|
||||
* [NPAPI][8] plugins supported (Flash, Unity, Java, etc.)
|
||||
* Support for XUL/Overlay Mozilla-style extensions.
|
||||
* Uses [Goanna][9] open-source browser engine which is a fork of Mozilla’s [Gecko][10]
|
||||
* Does not use Rust or the Photon user interface
|
||||
* Supports 64-bit systems only
|
||||
|
||||
|
||||
|
||||
### Installing Basilisk on Linux
|
||||
|
||||
You may not find it listed in your Software Center. So, you will have to head to its official [download page][11] to get the tarball (tar.xz) file.
|
||||
|
||||
Once you download it, simply extract it and head inside the folders. Next, you will find a “**Basilisk**” executable file in it. You need to simply run it by double-clicking on it or performing a right-click and selecting “**Run**“.
|
||||
|
||||
You may check out its [GitHub page][12] for more information.
|
||||
|
||||
![][13]
|
||||
|
||||
You can also use the terminal and run the file by following the steps below while navigating to the directory you downloaded it to:
|
||||
|
||||
```
|
||||
cd basilisk-latest.linux64
|
||||
cd basilisk
|
||||
./basilisk
|
||||
```
|
||||
|
||||
[Download Basilisk][1]
|
||||
|
||||
### Using Basilisk browser
|
||||
|
||||
![][14]
|
||||
|
||||
Basilisk is a decent Firefox fork if you want the legacy extensions support. It is being actively developed by the team behind Pale Moon and is potentially a great option for users who want the classic look and feel of Mozilla’s Firefox (before the Quantum update) without comprising on the modern web support.
|
||||
|
||||
I didn’t have any issues with browsing webpages. However, I did notice that “**YouTube**” detects this as an obsolete browser and warns that it will stop supporting it soon enough.
|
||||
|
||||
_**So, I’m not sure if Basilisk will be a fit for every web service out there – but if you really need the archived legacy extensions that you used on Firefox’s older releases, this could be a solution for your problem.**_
|
||||
|
||||
**Wrapping Up**
|
||||
|
||||
Do you think a Firefox fork is worth trying out? What do you prefer? Share your thoughts in the comments below.
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://itsfoss.com/basilisk-browser/
|
||||
|
||||
作者:[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.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
|
@ -1,99 +0,0 @@
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: (MFGJT)
|
||||
[#]: 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)
|
||||
|
||||
九种拯救地球的方法
|
||||
======
|
||||
这些主意都用到了有关开源的内容的技巧
|
||||
|
||||
![][1]
|
||||
|
||||
图片来源:Geralt. CC0.
|
||||
|
||||
人们可以做些什么来拯救地球?这个问题可能会让人感到压抑,因为有时我们感觉个人可以做的贡献太少了。但是作为地球公民,我们从来不是一个人。所以,我向我们的作家社区征集了一些开源软件或硬件可以帮助改变现状的方法。以下是他们的回复。
|
||||
|
||||
### 9种利用开源的内容来拯救地球的方法
|
||||
|
||||
**1.** **在你的终端禁用闪烁的光标。**
|
||||
|
||||
这听起来可能有点傻,但是那个无关紧要的闪烁的光标可能导致[每小时两瓦特的额外电力开销][2]。如果要禁用光标闪烁,可以通过更改终端设置:编辑(edit)>偏好设置(preferences)>光标>光标闪烁>禁用。
|
||||
|
||||
_由 Mars Toktonaliev 推荐_
|
||||
|
||||
**2\. 减少有关动物产品和加工食物的消费。**
|
||||
|
||||
一种拯救地球的方法是在你的手机中添加这些开源的 APP:Daily Dozen,OpenFoodFacts,OpenVegeMap,和 Food Restrictions。这些APP可以帮助你准备一份健康的素食饮食计划,为你找到素食主义者和严格素食主义者可以就餐的餐厅,还可以帮助你把你的饮食需求告诉别人,即使他们不和你讲同一种语言。如果想要了解更多有关这些的APP的信息,你可以阅读[_4款帮助你准备素食饮食的开源APP_][3].
|
||||
|
||||
_由J oshua Allen Holm 推荐_
|
||||
|
||||
**3\. 回收旧电脑。**
|
||||
|
||||
怎么回收?当然是用Linux。通过给一个没办法自己获得一台电脑的人一台新电脑的方式传递爱心,你可以避免让这台电脑进到垃圾填埋场。可以在 [The Asian Penguins][4] 看看我们是怎么做的。
|
||||
|
||||
_由 Stu Keroff 推荐_
|
||||
|
||||
**4\. 在你不使用设备时关闭它们**
|
||||
|
||||
你可以使用带有主插座和控制插座的“智能插座板”。把你的电脑连接到主插座上,这样的话当你打开电脑时所有你连接到控制插座上的设备如显示器,打印机等也都会打开。一个更简单的不那么先进的方法是使用一个带有计时器的插座板。我在家里就是用的这个。你可以用计时器上的开关设定一个定时开关电源的时间表。这样可以在没有人在家时自动关闭网络打印机。或者以我的用了六年的笔记本电脑为例,我通过一个在使用外接电源(外接电源打开)和使用电脑电池(外接电源关闭)的电源计划延长了电脑电池的寿命。
|
||||
|
||||
_由 Jim Hall 推荐_
|
||||
|
||||
**5\. 减少供暖通风系统的使用。**
|
||||
|
||||
在夏天,通过窗户的阳光可以为室内提供很多热量。使用 Home Assistant [自动调节][5]窗帘和遮阳棚,这可以是[基于一天中的时间的][6],甚至是基于太阳高度角的。
|
||||
|
||||
_由 Michael Hrivnak 推荐_
|
||||
|
||||
**6\. 当你不在家时,把你的温度调节器调到一个低一些的温度。**
|
||||
|
||||
如果你的家用温度调节器有“离开”功能,你很容易忘记在出门时启用它。通过一点自动化,任何连接到网络的温度调节器都可以在你不在家时自动节省能量。[Stataway][7] 就是一个这样项目。它通过调用你的手机的GPS坐标来决定是将你的温度调节器设置为“在家”还是“离开”。
|
||||
|
||||
_由 Michael Hrivnak 推荐_
|
||||
|
||||
**7\. 为未来储蓄算力**
|
||||
|
||||
我有一个主意:创建一个可以读取可选的能量阵列(如风能或太阳能)的输出的脚本。这个脚本应该将计算集群中的服务器从睡眠模式更改为激活模式直到过量的电能(超出可以储存的部分)被用尽。然后在高产能时段使用这些过量的电能来进行需要大量计算的项目,比如渲染。这个过程本质应该是免费的,因为使用的能量无法被储存起来挪作他用。我相信现有的监控、能量管理和服务器阵列工具一定可以实现这个功能。那么剩下的只是一些整合上的问题,好让整个系统工作。
|
||||
|
||||
_由 Terry Hancock 推荐_
|
||||
|
||||
**8\. 关掉你的灯**
|
||||
|
||||
根据 [World Atlas of Artificial Night Sky Brightness][8] 的说法,光污染影响了全世界超过80%的污染。这一结论在2016年被发表(遵循 Creative Commons Attribution-NonCommercial 4.0 协议)在公开权限的期刊 _Science Advances_ 上。关闭外部的灯是一个可以快速使野生生物、人类健康受益并让我们享受夜晚的天空的方法,而且可以减少能量消耗。访问 [darksky.org][9] 来查看更多减少你的外部灯光的影响的方法。
|
||||
|
||||
_由 Michael Hrivnak 推荐_
|
||||
|
||||
**9\. 减少你的CPU数量**
|
||||
|
||||
就我个人而言,我记得我以前有很多在地下室运行的电脑作为我的IT游乐场/实验室。我现在对于能量消耗更加注意了,所以真的大量地减少了我的CPU数量。我现在更喜欢利用虚拟机、区域和容器等科技。另外,我很高兴有小型电脑和SoC电脑这种东西,比如 Raspberry Pi。因为我可以用一台这样的电脑做很多事情,比如运行一个DNS或者网络服务器,而无需使整个屋子变热并积累昂贵的电费账单。
|
||||
|
||||
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)
|
||||
校对:[校对者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/
|
@ -0,0 +1,116 @@
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: (wenwensnow)
|
||||
[#]: reviewer: ( )
|
||||
[#]: publisher: ( )
|
||||
[#]: url: ( )
|
||||
[#]: 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]。我测试了列表中的一小部分格式,没有发现问题。
|
||||
|
||||
### 留在最后的话
|
||||
|
||||
不管你只是单纯想找个电子书阅读器,还是有个更多复杂功能的应用,上文提到的三个选择都很不错,而且它们都能提升你在大屏设备上的阅读体验。
|
||||
|
||||
* * *
|
||||
|
||||
_这篇文章基于一篇发布在[Open Source Musings][17]上的文章,并适用于[CC BY-SA 4.0][18]许可证_
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://opensource.com/article/20/2/linux-ebook-readers
|
||||
|
||||
作者:[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://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/
|
@ -0,0 +1,161 @@
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: (geekpi)
|
||||
[#]: reviewer: ( )
|
||||
[#]: publisher: ( )
|
||||
[#]: url: ( )
|
||||
[#]: 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 提供了一些命令,可以使工作变得非常容易。
|
||||
[andy.brandon50][1] [(CC BY-SA 2.0)][2]
|
||||
|
||||
有很多方法可以在 Linux 命令行中将文本从小写更改为大写,反之亦然。实际上,你有一组这样的命令可以选择。这篇文章检验了一些最佳的命令来完成这项工作,以及你该如何让它们正常工作。
|
||||
|
||||
### 使用 tr
|
||||
|
||||
**tr** (translate) 命令是在命令行或脚本中最容易使用的命令之一。如果你要确定要一串大写字符串,你只需将它传给 **tr**,如下所示:
|
||||
|
||||
```
|
||||
$ echo Hello There | tr [:lower:] [:upper:]
|
||||
HELLO THERE
|
||||
```
|
||||
|
||||
[[Get regularly scheduled insights by signing up for Network World newsletters.]][3]
|
||||
|
||||
下面是一个在脚本中使用这个命令的例子,当你要确保添加到文件中的所有文本都使用大写形式以保持一致性时:
|
||||
|
||||
```
|
||||
#!/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** 选项执行相同的操作。上例脚本中的命令可以用这种方式代替:
|
||||
|
||||
[][4]
|
||||
|
||||
```
|
||||
echo $dept | awk '{print toupper($0)}' >> depts
|
||||
```
|
||||
|
||||
相反操作(切换为小写)如下所示:
|
||||
|
||||
```
|
||||
echo $dept | awk '{print tolower($0)}' >> depts
|
||||
```
|
||||
|
||||
### 使用 sed
|
||||
|
||||
**sed** (流编辑器)命令也可用于切换大小写。它与上面显示的两个命令中的第一个具有相同的效果。
|
||||
|
||||
```
|
||||
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
|
||||
```
|
||||
|
||||
有多种方法可以在大小写之间更改文本格式。哪种方法效果最好取决于你要处理的是单个字符串还是整个文件,以及想要的最终结果。
|
||||
|
||||
加入 [Facebook][5] 和 [LinkedIn][6] 上的 Network World 社区,评论热门主题。
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
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)
|
||||
校对:[校对者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.flickr.com/photos/54027476@N07/4999959929
|
||||
[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
|
Loading…
Reference in New Issue
Block a user