Merge pull request #5 from LCTT/master

与上游同步
This commit is contained in:
jx.zeng 2020-07-01 11:22:03 +08:00 committed by GitHub
commit 3d8a02ab15
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 882 additions and 21 deletions

View File

@ -1,8 +1,8 @@
[#]: collector: (lujun9972) [#]: collector: (lujun9972)
[#]: translator: (geekpi) [#]: translator: (geekpi)
[#]: reviewer: ( ) [#]: reviewer: (wxy)
[#]: publisher: ( ) [#]: publisher: (wxy)
[#]: url: ( ) [#]: url: (https://linux.cn/article-12368-1.html)
[#]: subject: (How to loop forever in bash on Linux) [#]: 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) [#]: 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/) [#]: author: (Sandra Henry-Stocker https://www.networkworld.com/author/Sandra-Henry_Stocker/)
@ -10,17 +10,15 @@
如何在 Linux 的 bash 中永远循环 如何在 Linux 的 bash 中永远循环
====== ======
[tine ivanic][1] [(CC0)][2] ![tine ivanic][1]
在 Linux 中有很多永远循环(或直到你决定停止)的方法,你可以在命令行或脚本中执行此操作。 在 Linux 中有很多永远循环(或直到你决定停止)的方法,你可以在命令行或脚本中执行此操作。
**for** 和 **while** 命令使这件事非常容易。 关于语法和策略,只有几件事要牢记。 `for``while` 命令使这件事非常容易。关于相应的语法和策略,只有几件事要牢记。
**另请参见[用于排除 Linux 故障的宝贵技巧][3]。**
### 使用 while ### 使用 while
最简单的永远循环之一是使用 **while** 命令,后面跟上条件 “true”。 你不必担心诸如 **while [ 1 -eq 1 ]** 之类的逻辑或类似的测试。 **while true** 测试表示循环将一直运行,直到你使用 **CTRL-C** 停止循环、关闭终端窗口或注销为止。 这是一个例子: 最简单的永远循环之一是使用 `while` 命令,后面跟上条件 `true`。 你不必使用诸如 `while [ 1 -eq 1 ]` 之类的逻辑或类似的测试。 `while true` 测试表示循环将一直运行,直到你使用 `CTRL-C` 停止循环、关闭终端窗口或注销为止。这是一个例子:
``` ```
$ while true $ while true
@ -34,7 +32,7 @@ Keep running
^C ^C
``` ```
你也可以使用 **while :** 做同样的事情。 这里的关键是 **:** 总是返回成功,因此就像 **while true** 一样,此测试永远不会失败,并且循环会继续运行。 你也可以使用 `while :` 做同样的事情。这里的关键是 `:` 总是返回成功,因此就像 `while true` 一样,此测试永远不会失败,并且循环会继续运行:
``` ```
$ while : $ while :
@ -47,7 +45,7 @@ Keep running
^C ^C
``` ```
如果你在脚本中插入了无限循环,并想提醒使用它的人如何退出脚本,那么可以使用 **echo** 命令添加提示: 如果你在脚本中插入了无限循环,并想提醒使用它的人如何退出脚本,那么可以使用 `echo` 命令添加提示:
``` ```
while : while :
@ -60,7 +58,7 @@ done
### 使用 for ### 使用 for
**for** 命令还提供了一种永远循环的简便方法。虽然不如 **while true** 明显,但语法相当简单。你只需要在有界循环中替换参数即可,界限通常类似于 “c 从等于 1 开始递增,直到 5” `for` 命令还提供了一种永远循环的简便方法。虽然不如 `while true` 明显,但语法相当简单。你只需要在有界循环中替换参数即可,它通常类似于 “c 从等于 1 开始递增,直到 5”
``` ```
$ for (( c=1; c<=5; c++ )) $ for (( c=1; c<=5; c++ ))
@ -72,7 +70,7 @@ $ for (( c=1; c<=5; c++ ))
$ for (( ; ; )) $ for (( ; ; ))
``` ```
没有起始值、增量或退出测试,此循环将永远运行或被强制停止 没有起始值、增量或退出测试,此循环将永远运行或被强制停止
``` ```
$ for (( ; ; )) $ for (( ; ; ))
@ -86,11 +84,11 @@ Keep your spirits up
Keep your spirits up Keep your spirits up
``` ```
### Why loop forever? ### 为什么要永远循环?
在现实中,你不会想永远循环下去,但一直运行直到想要回家、工作完成或者遇到问题才退出并不罕见。任何构造为无限循环的循环都可以设置为根据各种情况退出。 在现实中,你不会想永远循环下去,但一直运行直到想要回家、工作完成或者遇到问题才退出并不罕见。任何构造为无限循环的循环都可以设置为根据各种情况退出。
该脚本将一直处理数据直到下午 5 点。 或检查发现第一次超过 5 点的时间: 该脚本将一直处理数据直到下午 5 点,或者说检查发现第一次超过 5 点的时间:
``` ```
#!/bin/bash #!/bin/bash
@ -105,7 +103,7 @@ do
done done
``` ```
如果要退出循环而不是退出脚本,请使用 **break** 命令而不是 **exit** 如果要退出循环而不是退出脚本,请使用 `break` 命令而不是 `exit`
``` ```
#!/bin/bash #!/bin/bash
@ -121,11 +119,9 @@ done
… run other commands here … … run other commands here …
``` ```
#### 总结 ### 总结
永远循环很容易。 指定要停止循环的条件需要花费一些额外的精力。 永远循环很容易。指定要停止循环的条件却需要花费一些额外的精力。
加入 [Facebook][4] 和 [LinkedIn][5] 上的 Network World 社区,评论热门主题。
-------------------------------------------------------------------------------- --------------------------------------------------------------------------------
@ -134,13 +130,13 @@ via: https://www.networkworld.com/article/3562576/how-to-loop-forever-in-bash-on
作者:[Sandra Henry-Stocker][a] 作者:[Sandra Henry-Stocker][a]
选题:[lujun9972][b] 选题:[lujun9972][b]
译者:[geekpi](https://github.com/geekpi) 译者:[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/) 荣誉推出 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://www.networkworld.com/author/Sandra-Henry_Stocker/ [a]: https://www.networkworld.com/author/Sandra-Henry_Stocker/
[b]: https://github.com/lujun9972 [b]: https://github.com/lujun9972
[1]: https://unsplash.com/photos/u2d0BPZFXOY [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/ [2]: https://creativecommons.org/publicdomain/zero/1.0/
[3]: https://www.networkworld.com/article/3242170/linux/invaluable-tips-and-tricks-for-troubleshooting-linux.html [3]: https://www.networkworld.com/article/3242170/linux/invaluable-tips-and-tricks-for-troubleshooting-linux.html
[4]: https://www.facebook.com/NetworkWorld/ [4]: https://www.facebook.com/NetworkWorld/

View File

@ -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. Its 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

View File

@ -0,0 +1,262 @@
[#]: collector: (lujun9972)
[#]: translator: ( )
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )
[#]: subject: (LaTeX Typesetting Part 1 (Lists))
[#]: via: (https://fedoramagazine.org/latex-typesetting-part-1/)
[#]: author: (Earl Ramirez https://fedoramagazine.org/author/earlramirez/)
LaTeX Typesetting Part 1 (Lists)
======
![][1]
This series builds on the previous articles: [Typeset your docs with LaTex and TeXstudio on Fedora][2] and [LaTeX 101 for beginners][3]. This first part of the series is about LaTeX lists.
### Types of lists
LaTeX lists are enclosed environments, and each item in the list can take a line of text to a full paragraph. There are three types of lists available in LaTeX. They are:
* **Itemized**: unordered or bullet
* **Enumerated**: ordered
* **Description**: descriptive
### Creating lists
To create a list, prefix each list item with the \_item_ command. Precede and follow the list of items with the \_begin_{&lt;type&gt;} and \_end_{&lt;type&gt;} commands respectively where &lt;type&gt; is substituted with the type of the list as illustrated in the following examples.
#### Itemized list
```
\begin{itemize}
\item Fedora
\item Fedora Spin
\item Fedora Silverblue
\end{itemize}
```
![][4]
#### Enumerated list
```
\begin{enumerate}
\item Fedora CoreOS
\item Fedora Silverblue
\item Fedora Spin
\end{enumerate}
```
![][5]
#### Descriptive list
```
\begin{description}
\item[Fedora 6] Code name Zod
\item[Fedora 8] Code name Werewolf
\end{description}
```
![][6]
### Spacing list items
The default spacing can be customized by adding \_usepackage{enumitem}_ to the preamble. The _enumitem_ package enables the _noitemsep_ option and the \_itemsep_ command which you can use on your lists as illustrated below.
#### Using the noitemsep option
Enclose the _noitemsep_ option in square brackets and place it on the \_begin_ command as shown below. This option removes the default spacing.
```
\begin{itemize}[noitemsep]
\item Fedora
\item Fedora Spin
\item Fedora Silverblue
\end{itemize}
```
![][7]
#### Using the \itemsep command
The \_itemsep_ command must be suffixed with a number to indicate how much space there should be between the list items.
```
\begin{itemize} \itemsep0.75pt
\item Fedora Silverblue
\item Fedora CoreOS
\end{itemize}
```
![][8]
### Nesting lists
LaTeX supports nested lists up to four levels deep as illustrated below.
#### Nested itemized lists
```
\begin{itemize}[noitemsep]
\item Fedora Versions
\begin{itemize}
\item Fedora 8
\item Fedora 9
\begin{itemize}
\item Werewolf
\item Sulphur
\begin{itemize}
\item 2007-05-31
\item 2008-05-13
\end{itemize}
\end{itemize}
\end{itemize}
\item Fedora Spin
\item Fedora Silverblue
\end{itemize}
```
![][9]
#### Nested enumerated lists
```
\begin{enumerate}[noitemsep]
\item Fedora Versions
\begin{enumerate}
\item Fedora 8
\item Fedora 9
\begin{enumerate}
\item Werewolf
\item Sulphur
\begin{enumerate}
\item 2007-05-31
\item 2008-05-13
\end{enumerate}
\end{enumerate}
\end{enumerate}
\item Fedora Spin
\item Fedora Silverblue
\end{enumerate}
```
![][10]
### List style names for each list type
**Enumerated** | **Itemized**
---|---
\alph* | $\bullet$
\Alph* | $\cdot$
\arabic* | $\diamond$
\roman* | $\ast$
\Roman* | $\circ$
| $-$
### Default style by list depth
**Level** | **Enumerated** | **Itemized**
---|---|---
1 | Number | Bullet
2 | Lowercase alphabet | Dash
3 | Roman numerals | Asterisk
4 | Uppercase alphabet | Period
### Setting list styles
The below example illustrates each of the different itemiszed list styles.
```
% Itemize style
\begin{itemize}
\item[$\ast$] Asterisk
\item[$\diamond$] Diamond
\item[$\circ$] Circle
\item[$\cdot$] Period
\item[$\bullet$] Bullet (default)
\item[--] Dash
\item[$-$] Another dash
\end{itemize}
```
![][11]
There are three methods of setting list styles. They are illustrated below. These methods are listed by priority; highest priority first. A higher priority will override a lower priority if more than one is defined for a list item.
#### List styling method 1 per item
Enclose the name of the desired style in square brackets and place it on the \_item_ command as demonstrated below.
```
% First method
\begin{itemize}
\item[$\ast$] Asterisk
\item[$\diamond$] Diamond
\item[$\circ$] Circle
\item[$\cdot$] period
\item[$\bullet$] Bullet (default)
\item[--] Dash
\item[$-$] Another dash
\end{itemize}
```
#### List styling method 2 on the list
Prefix the name of the desired style with _label=_. Place the parameter, including the _label=_ prefix, in square brackets on the \_begin_ command as demonstrated below.
```
% Second method
\begin{enumerate}[label=\Alph*.]
\item Fedora 32
\item Fedora 31
\item Fedora 30
\end{enumerate}
```
#### List styling method 3 on the document
This method changes the default style for the entire document. Use the \_renewcommand_ to set the values for the labelitems. There is a different labelitem for each of the four label depths as demonstrated below.
```
% Third method
\renewcommand{\labelitemi}{$\ast$}
\renewcommand{\labelitemii}{$\diamond$}
\renewcommand{\labelitemiii}{$\bullet$}
\renewcommand{\labelitemiv}{$-$}
```
### Summary
LaTeX supports three types of lists. The style and spacing of each of the list types can be customized. More LaTeX elements will be explained in future posts.
Additional reading about LaTeX lists can be found here: [LaTeX List Structures][12]
--------------------------------------------------------------------------------
via: https://fedoramagazine.org/latex-typesetting-part-1/
作者:[Earl Ramirez][a]
选题:[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/earlramirez/
[b]: https://github.com/lujun9972
[1]: https://fedoramagazine.org/wp-content/uploads/2020/06/latex-series-816x345.png
[2]: https://fedoramagazine.org/typeset-latex-texstudio-fedora
[3]: https://fedoramagazine.org/fedora-classroom-latex-101-beginners
[4]: https://fedoramagazine.org/wp-content/uploads/2020/06/image-1.png
[5]: https://fedoramagazine.org/wp-content/uploads/2020/06/image-2.png
[6]: https://fedoramagazine.org/wp-content/uploads/2020/06/image-3.png
[7]: https://fedoramagazine.org/wp-content/uploads/2020/06/image-4.png
[8]: https://fedoramagazine.org/wp-content/uploads/2020/06/image-5.png
[9]: https://fedoramagazine.org/wp-content/uploads/2020/06/image-7.png
[10]: https://fedoramagazine.org/wp-content/uploads/2020/06/image-8.png
[11]: https://fedoramagazine.org/wp-content/uploads/2020/06/image-9.png
[12]: https://en.wikibooks.org/wiki/LaTeX/List_Structures

View File

@ -0,0 +1,248 @@
[#]: collector: (lujun9972)
[#]: translator: ( )
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )
[#]: subject: (10 ReactJS tools to boost your web development skills)
[#]: via: (https://opensource.com/article/20/6/reactjs-tools)
[#]: author: (Prayaag Kasundra https://opensource.com/users/prayaag-kasundra)
10 ReactJS tools to boost your web development skills
======
Increase your value to employers by learning these top tools for
developing web apps in React.
![Woman sitting in front of her computer][1]
Did you know most résumés submitted for jobs get rejected with just a single glance? That's a daunting fact if you are trying to get started in web development, but there are ways to improve what you have to offer prospective employers and clients. For application developers, now is a great time to increase your skills, and open source is the best avenue for professional development. You don't need to attend university to learn new open source skills; all you need is a sense of direction and self-discipline.
ReactJS is one of many skills you would be wise to learn on your way to becoming a successful web developer. If you're already comfortable with JavaScript and HTML, it is a natural next technology to learn. If you're not familiar with them yet, then you'll find ReactJS a great place to start as a programmer.
In this article, I'll share my top 10 tools and libraries that will help you qualify for a job (or be a serious hobbyist, if you prefer) as a JavaScript developer.
### What is React, and why should you learn it?
React is a JavaScript library for user interface (UI) development that Facebook introduced in May 2013 (and still maintains). It uses JavaScript for development and simple state machine components that render dynamic content with ease.
Because ReactJS is one of the most powerful frontend JavaScript libraries available, you should learn how to use it if you want to build amazing applications. It's a driving force behind the interfaces of Amazon, PayPal, BBC, CNN, and many other tech giants. Furthermore, the flexible library suits any need and can be plugged into your favorite tech stack to build lightweight apps. You can [use React][2] to build anything scalable—data dashboards, messaging apps, social networking applications, single-page applications, and even personal blog sites.
One of the most effective ways to get the hang of React is by using its tools to build web apps for real-world projects. Not only will it help you learn the framework and tools, but it also gives you something to show off to prospective employers.
### 1\. npm
If you want to get started with JavaScript (including the React library), you need to install Node package manager ([npm][3]). Like the package manager that ships with your Linux distribution (or [Chocolatey][4] on Windows or [Homebrew][5] on macOS), npm provides a command to query a software repository and install what you need. This includes important libraries, like ReactJS components.
You can probably install Node.js (and npm along with it) from your Linux distribution's repository. On Fedora or Red Hat Enterprise Linux:
```
`$ sudo dnf install nodejs`
```
On Ubuntu or Debian:
```
`$ sudo apt install nodejs npm`
```
If your distribution doesn't offer npm in its repo, visit [Nodejs.org][6] to find out how to install Node.js and npm.
### 2\. Create React App
[Create React App][7] is a boilerplate project for getting started with React. Before Facebook released Create React App, setting up a working project in React was a tedious task. But with this tool, you can set up a frontend build pipeline, project structure, developer environment, and app optimization for production in seconds with zero configuration. You can achieve all this with a single command. What's more, if you need a more advanced configuration, you can "eject" from Create React App and edit its config files directly.
Create React App is open source under the MIT License, and you can access its [source code][8] in its GitHub repo.
Install it with:
```
npm start
npm init react-app my-app
```
If you don't want to use Create React App, other boilerplate options are [React Boilerplate][9] and [React Slingshot][10]. Both are well-maintained and open source under the MIT License.
### 3\. React Sight
[React Sight][11] is a commonly used visualization tool that provides a live component hierarchy tree (like a flowchart) of your entire app. It can be added directly as a Chrome extension and needs React dev tools for reading information about your app. With its rich interface, you can even add filters to focus on the components you need to interact with the most. By hovering on the nodes, you can display the current state and props. React Sight is very helpful for debugging a large and complex project.
React Sight is open source under the MIT License, and you can access its [source code][12] in its GitHub repo. Install React Sight from the [Chrome web store][13].
### 4\. React Belle
[React Belle][14] is a configurable React component library containing reusable components like Toggle, Rating, DatePicker, Button, Card, Select, and others to provide a smooth user experience. The components are customizable and support [ARIA][15] accessibility standards. It offers different themes, like the popular Belle and Bootstrap.
Belle is open source under the MIT License, and you can access its [source code][16] in its GitHub repo.
Install it with:
```
`npm install belle`
```
### 5\. Evergreen
Built on top of the React UI primitive, [Evergreen][17] is a UI framework that contains highly polished components that you can use to build your project. One thing that developers like about this tool is its hassle-free import of components.
Evergreen is open source under the MIT License, and you can access its [source code][18] in its GitHub repo.
Install it with:
```
`npm install --save evergreen-ui`
```
### 6\. Bit
[Bit][19] offers an online platform and command-line tool for publishing and sharing React apps. It is one of the best options if you are creating and sharing components. Its marketplace is a store where people can publish their React apps and other people can search for the components they need, so they don't have to reinvent the wheel every time they need a new React app. Bit's core features include:
* Allows code reuse
* Increases design and development efficiency
* Retains UI and UX consistency
* Increases a project's stability
Bit is open source under the Apache 2.0 License, and you can access its [source code][20] in its GitHub repo.
Install it with:
```
`$ npm install bit-bin --global`
```
### 7\. Storybook
[Storybook][21] lets you set up a live development server that supports hot reloading, so you can create components in isolation from your whole project. It helps with component reuse, testability, and development speed. It also offers an online UI editor that allows you to develop, inspect, and eventually showcase your creations interactively.
What's more, Storybook's API offers myriad features and facilitates configuration like no other. It is used in production by companies like Coursera, Squarespace, and Lonely Planet.
Storybook is open source under the MIT License, and you can access its [source code][22] in its GitHub repo.
First, install Storybook using the following commands (note that one uses an npx command, which is related to npm but unique): 
```
`$ cd my-react-app`[/code] [code]`$ npx -p @storybook/cli sb init`
```
Next, run it with:
```
`$ npm run storybook`
```
### 8\. Formik
[Formik][23] helps in creating and validating forms for debugging, testing, and reasoning in React. It allows you to generate dynamic forms, so you don't have to manually change or update the state and props of form components. It is a step towards a faster and more pleasant development experience.
Formik is open source under the MIT License, and you can access its [source code][24] in its GitHub repo.
Install it with:
```
`$ npm install formik --save`
```
### 9\. Immer
[Immer][25] is a JavaScript library that enables you to modify nested objects without fear of mutating them. Its purpose is to make immutability in your code simple.
Here are some of Immer's top features:
* **Immer is strongly typed**: It is useful when your state object has a type.
* **Immer reduces boilerplate code**: Most state management tools require you to write a lot of boilerplate code. Immer is different. It lets you write less (and more concise) code.
* **Immer allows you to use JS data structures:** You can produce immutable states in Immer by using basic JS data structures.
Immer is open source under the MIT License, and you can access its [source code][26] in its GitHub repo.
Install it with:
```
`$ npm install immer`
```
### 10\. React Proto
[React Proto][27] is an application prototyping tool for developers and designers. It helps you layout your project structure to make decisions in advance, so you don't waste time making changes later in development. This tool specifically helps people who prefer design over coding; for example, you can drag and drop elements instead of writing them. The tool helps you mark all potential components and give them names, properties, and a hierarchy for prototyping.
React Proto is open source under the MIT License, and you can access its [source code][28] in its GitHub repo.
To install it, first, fork the [repository][28]. Next, install dependencies with:
```
`$ npm install`
```
Run the application with:
```
`$ npm start`
```
To start a development environment, run:
```
`$ npm run dev`
```
### Boost your career with ReactJS tools
There's no shortage of resources for JavaScript. To learn more about the frameworks I've mentioned in this article, plus many more, check out the [Awesome React][29] repository on GitHub, a list of awesome things related to React.
By learning these 10 must-have tools, you'll boost your productivity and your résumé, and more importantly, you'll have a good grasp on JavaScript-based web development.
--------------------------------------------------------------------------------
via: https://opensource.com/article/20/6/reactjs-tools
作者:[Prayaag Kasundra][a]
选题:[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/prayaag-kasundra
[b]: https://github.com/lujun9972
[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/OSDC_women_computing_3.png?itok=qw2A18BM (Woman sitting in front of her computer)
[2]: https://www.simform.com/why-use-react/
[3]: https://www.npmjs.com/
[4]: https://opensource.com/article/20/3/chocolatey
[5]: https://opensource.com/article/20/6/homebrew-mac
[6]: https://nodejs.org/en/download/package-manager/
[7]: https://facebook.github.io/create-react-app/
[8]: https://github.com/facebook/create-react-app
[9]: http://www.reactboilerplate.com/
[10]: https://github.com/coryhouse/react-slingshot
[11]: http://www.reactsight.com/
[12]: https://github.com/React-Sight/React-Sight
[13]: https://chrome.google.com/webstore/detail/react-sight/aalppolilappfakpmdfdkpppdnhpgifn
[14]: http://nikgraf.github.io/belle/
[15]: https://en.wikipedia.org/wiki/WAI-ARIA
[16]: https://github.com/nikgraf/belle
[17]: https://evergreen.segment.com/
[18]: https://github.com/segmentio/evergreen
[19]: https://github.com/teambit/bit
[20]: https://github.com/teambit/bit/blob/master/LICENSE
[21]: https://storybook.js.org/
[22]: https://github.com/storybookjs/storybook
[23]: https://jaredpalmer.com/formik/
[24]: https://github.com/jaredpalmer/formik
[25]: https://immerjs.github.io/immer/docs/introduction
[26]: https://github.com/immerjs/immer
[27]: https://react-proto.github.io/react-proto/
[28]: https://github.com/React-Proto/react-proto
[29]: https://github.com/enaqx/awesome-react

View File

@ -0,0 +1,143 @@
[#]: collector: (lujun9972)
[#]: translator: ( )
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )
[#]: 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/)
Painless file extraction on Linux
======
Thinkstock
Extracting files from archives in Linux systems is considerably less painful than tooth extraction, but sometimes seems more complicated. In this post, we will take a look at how you can easily extract files from just about any kind of archive youre likely to run into on a Linux system.
Theres a pile of them  everything from .gz to .tbz2 files with some variations for how those files are named. Sure, you can memorize all of the various commands available for extracting files from archives along with the options they offer, but you can also just deposit all that know-how into a script and stop worrying about the details.
In this post, we assemble a series of extraction commands into a script that calls the proper command to extract the content of file archives depending on the archive file names. The script starts with some commands to verify that a file name has been provided as an argument or ask that the person running the script provide one.
```
#!/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
```
Got that? The script prompts for a file name if no arguments were offered and uses the argument provided if there is one. It then verifies that the file actually exists. If not, the script exits.
The next step is to use a bash case statement to call the appropriate extraction command for the archive depending on its name. For some of these file types (e.g., .bz2), other commands than tar would also work, but we only include one extraction command for each file naming convention. So, heres the case statement with the various archive file names.
```
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
```
If the file provided to the script has a file extension that doesnt match any of those known to the script, the “No extract option for $filename” message will be issued. If any archive types that you use are missing, just add them along with the required extraction commands.
Add the bash header to the top of the script, make it executable and you should be ready to go.
```
#!/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 ;;
*)
```
If you want the script to display the contents of the archive as they are being extracted, add the verbose option (-v) to each string of command arguments:
```
#!/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
```
### Wrap-up
While its certainly possible to create an alias for each extraction command youre likely to use, its easier to let a script provide the command for each file type you encounter than having to stop and work out each of the commands and options yourself.
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/3564265/painless-file-extraction-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

View File

@ -0,0 +1,142 @@
[#]: collector: (lujun9972)
[#]: translator: ( )
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )
[#]: 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)
Read and write data from anywhere with redirection in the Linux terminal
======
Redirection is an efficient way to get data from one place to another
without a lot of mouse moving and key pressing.
![Hands programming][1]
Redirection of input and output is a natural function of any programming or scripting language. Technically, it happens inherently whenever you interact with a computer. Input gets read from `stdin` (standard input, usually your keyboard or mouse), output goes to `stdout` (standard output, a text or data stream), and errors get sent to `stderr`. Understanding that these data streams exist enables you to control where information goes when you're using a shell, such as [Bash][2] or [Zsh][3].
Standard in, standard out, and standard error exist as filesystem locations on Linux. You can see them in `/dev`:
```
$ ls /dev/std*
/dev/stderr@  /dev/stdin@  /dev/stdout@
```
You can't do much with them directly, but it's sometimes useful to think of them as meta-locations where you can send data.
The basics of redirection are simple: use some number of `>` characters to redirect output, and some number of `<` characters to redirect input.
### Redirecting output
To write the output of the [ls][4] command to a file:
```
`$ ls > list.txt`
```
You don't see the output of `ls` as you normally would, because the output is written to the `list.txt` file instead of your screen. This is so versatile, in fact, that you can even use it to copy the contents of one file to another. It doesn't have to be a text file, either. You can use redirection for binary data:
```
`$ cat image.png > picture.png`
```
(In case you're wondering why you'd ever want to do that, it's for a sometimes-useful repercussion on [file permissions][5].)
### Redirecting input
You can redirect input "into" a command, too. This is arguably less useful than redirecting output because many commands are already hard-coded to take input from an argument you provide. It can be useful, however, when a command expects a list of arguments, and you have those arguments in a file and want to quickly "copy and paste" them from the file into your terminal (except you don't actually want to copy and paste):
```
`$ sudo dnf install $(<package.list)`
```
Common uses of input redirection are the **here-document** (or just **here-doc** for short) and **here-string** techniques. This input method redirects a block of text into the standard input stream, up to a special end-of-file marker (most people use `EOF`, but it can be any string you expect to be unique). Try typing this (up to the second instance of `EOF`) into a terminal:
```
$ echo &lt;&lt; EOF
&gt; foo
&gt; bar
&gt; baz
&gt; EOF
```
The expected result:
```
foo
bar
baz
```
A **here-doc** is a common trick used by [Bash][2] scripters to dump several lines of text into a file or onto the screen. As long as you don't forget to end the clause with your end-of-file marker, it's an effective way to avoid unwieldy lists of `echo` or `printf` statements.
A **here-string** is similar to a **here-doc**, but it consists of just one string (or several strings disguised as a single string with quotation marks):
```
$ cat &lt;&lt;&lt; "foo bar baz"
foo bar baz
```
### Redirecting error messages
Error messages go to a stream called `stderr`, designated as `2>` for the purposes of redirection. This command directs error messages to a file called `output.log`:
```
`$ ls /nope 2> output.log`
```
### Sending data to /dev/null
Just as there are locations for standard in, standard out, and error, there's also a location for _nowhere_ on the Linux filesystem. It's called `null`, and it's located in `/dev`, so it's often pronounced "devnull" by people who use it too frequently to say "slash dev slash null."
You can send data to `/dev/null` using redirection. For instance, the `find` command tends to be verbose, and it often reports permission conflicts while searching through your files:
```
$ 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
```
The `find` command processes that as an error, so you can redirect just the error messages to `/dev/null`:
```
$ find ~ -type f 2&gt; /dev/null
/home/seth/actual.file
/home/seth/zzz.file
```
### Using redirection
Redirection is an efficient way to get data from one place to another in Bash. You may not use redirection all the time, but learning to use it when you need it can save you a lot of needless opening files and copying and pasting data, all of which generally require mouse movement and lots of key presses. Don't resort to such extremes. Live the good life and use redirection.
--------------------------------------------------------------------------------
via: https://opensource.com/article/20/6/redirection-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
[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