Merge remote-tracking branch 'LCTT/master'

This commit is contained in:
wxy 2018-04-13 19:53:06 +08:00
commit 67d73c2452
18 changed files with 1325 additions and 432 deletions

View File

@ -0,0 +1,121 @@
我的冒险旅程之迁移回 Windows
======
我已经主要使用 Linux 大约 10 年了,而且主要是 Ubuntu。但在最新发布的版本中我决定重新回到我通常不喜欢的操作系统 Windows 10。
![Ubuntu On Windows][1]
我一直是 Linux 的粉丝,我最喜欢的两个发行版是 Debian 和 Ubuntu。现今作为一个服务器操作系统Linux 是完美无暇的,但在桌面上一直存在不同程度的问题。
最近一系列的问题让我意识到,我不需要使用 Linux 作为我的桌面操作系统,我仍然是一个 Linux 粉丝,但基于我安装 Ubuntu 17.10 的经验,我已经决定回到 Windows。
### 什么使我选择了回归
问题是,当 Ubuntu 17.10 出来后,我像往常一样进行全新安装,但遇到了一些非常奇怪的新问题。
* Dell D3100 Dock 不再工作(包括临时规避方案也没用)
* Ubuntu 意外死机(随机)
* 双击桌面上的图标没反应
* 使用 HUD 搜索诸如“tweaks”之类的程序会尝试安装 META 桌面版本
* GUI 比标准的 GNOME 感觉更糟糕
现在我确实考虑回到使用 Ubuntu 16.04 或另一个发行版,但是我觉得 Unity 7 是最精致的桌面环境,而另外唯一一个优雅且稳定的是 Windows 10。
除此之外,使用 Linux 而不是使用 Windows 也有一些固有的问题,如:
* 大多数商用软件不可用E.G Maya、 PhotoShop、 Microsoft Office大多数情况下替代品并不相同等等。
* 大多数游戏都没有移植到 Linux 上,包括来自 EA、 Rockstar Ect. 等主要工作室的游戏。
* 对于大多数硬件来说,其 Linux 驱动程序是厂商的次要考虑。
在决定使用 Windows 之前,我确实考虑过其他发行版和操作系统。
与此同时,我看到了更多的“微软爱 Linux ”的行动,并且了解了 WSL。他们的新开发者的关注角度对我来说很有意思于是我试了一下。
### 我在 Windows 找到了什么
我使用计算机主要是为了编程我也使用虚拟机、git 和 ssh并且大部分工作依赖于 bash。我偶尔也会玩游戏观看 netflix 和一些轻松的办公室工作。
总之,我期待在 Ubuntu 中保留当前的工作流程并将其移植到 Windows 上。我也想利用 Windows 的优点。
* 所有的 PC 游戏支持 Windows
* 大多数程序是原生的
* 微软办公软件
虽然使用 Windows 有很多坑,但是我打算正确对待它,所以我不担心一般的 Windows 故障,例如病毒和恶意软件。
### Windows 的子系统 LinuxWindows 上的 Ubuntu 中的 Bash
微软与 Canonical 的密切合作将 Ubuntu 带到了 Windows 上。在经过快速设置和启动程序之后,你将拥有非常熟悉的 bash 界面。
我一直在研究其局限性,但是在写这篇文章时我碰到的唯一真正的限制是它从硬件中抽象了出来。例如,`lsblk` 不会显示你有什么分区,因为子系统里的 Ubuntu 没有提供这些信息。
但是除了访问底层工具之外,我发现其体验非常熟悉,也很棒。
我在下面的工作流程中使用了它。
* 生成 SSH 密钥对
* 使用 Git 和 Github 来管理我的仓库
* SSH 到几个服务器,包括不用密码
* 为本地数据库运行 MySQL
* 监视系统资源
* 使用 Vim 编辑配置文件
* 运行 Bash 脚本
* 运行本地 Web 服务器
* 运行 PHP、NodeJS
到目前为止,它已经被证明是非常强大的工具。除了是在 Windows 10 用户界面之中,我的工作流程感觉和我在 Ubuntu 上几乎一样。尽管我的多数工作可以在 WSL 中处理,但我仍然打算通过虚拟机进行更深入的工作,这可能超出了 WSL 的范围。
### 不需要用 Wine
我遇到的另一个主要问题是兼容性问题。我很少使用 Wine 来使用 Windows 软件。LCTT 译注Wine 是可以使 Linux 上运行 Windows 应用的软件)但是有时它是必需的,尽管通常体验不是很好。
#### HeidiSQL
我首先安装的程序之一是 HeidiSQL它是我最喜欢的数据库客户端之一。它可以在 Wine 下工作,但是感觉很不好,所以我在 Linux 下丢掉它而使用了 MySQL Workbench。回到了 Windows 中,就像一个可靠的老朋友回来了。
#### 游戏平台 / Steam
没有游戏的 Windows 电脑是无法想象的。我从 Steam 的网站上安装了它,我的 Linux 游戏,加上我的 Windows 游戏就变大了 5 倍,并且包括 GTA V LCTT 译注: GTA V 是一款名叫侠盗飞车的游戏) 等 AAA 级游戏。而这些我在 Ubuntu 中只能梦想。
我对 SteamOS 有很大的期望,并且一直会持续如此。但是我认为在可预见的将来,它不会在任何地方的游戏市场中崭露头角。所以如果你想在 PC 上玩游戏,你确实需要 Windows。
还有一点需要注意的是, 你的 nvidia 显卡的驱动程序会得到很好的支持,这使得像 TF2 LCTT 译注: 这是一款名叫军团要塞 2 的游戏)这样的一些 Linux 原生游戏运行的稍好一些。
**Windows 在游戏方面总是优越的,所以这并不令人感到意外。**
### 从 USB 硬盘运行,为什么
我在我的主固态硬盘上运行 Linux但在过去我是从 usb 棒和 usb 硬盘运行它的。我习惯了 Linux 的这种持久性,这让我可以在不丢失主要操作系统的情况下长期尝试多个版本。现在我尝试将 Windows 安装到 USB 连接的硬盘上时,它无法工作也不可能工作。所以当我将 Windows 硬盘分区的克隆作为备份时,我很惊讶我可以通过 USB 启动它。
这对我来说已经成为一个方便的选择,因为我打算将我的工作笔记本电脑迁移回 Windows但如果不想冒险那就把它扔在那里吧。
所以我在过去的几天里,我使用 USB 来运行它,除了一些错误的消息外,我没有通过 USB 运行发现它真正的缺点。
这样做主要的问题是:
* 较慢的启动速度
* 恼人的信息:不要拔掉你的 USB
* 无法激活它
**我可能会写一篇关于 USB 驱动器上的 Windows 的文章,这样我们可以有更详细的了解。**
### 那么结论是什么?
我使用 Windows 10 大约两周了,并没有注意到它对我的工作流程有任何的负面影响。尽管过程会有一些小问题,但我需要的所以工具都在手边,并且操作系统一般都在运行。
### 我会留在 Windows吗
虽然现在还为时尚早,但我想在可见的未来我会坚持使用 Windows。
--------------------------------------------------------------------------------
via: [https://www.chris-shaw.com/blog/my-adventure-migrating-back-to-windows](https://www.chris-shaw.com/blog/my-adventure-migrating-back-to-windows)
作者:[Christopher Shaw][a]
译者:[MjSeven](https://github.com/MjSeven)
校对:[wxy](https://github.com/wxy)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]:https://www.chris-shaw.com
[1]:https://winaero.com/blog/wp-content/uploads/2016/07/Ubutntu-on-Windows-10-logo-banner.jpg

View File

@ -0,0 +1,91 @@
高级 SSH 速查表
===========================
所有人都知道 SSH 是一种远程登录工具,然而它也有许多其他用途。
创建一个 SOCKS 代理来浏览网页(也就是翻墙啦):
> ```
ssh -D <port> <remote_host>
```
> 设置 `localhost:<port>` 作为你浏览器的代理
连接一个堡垒机后的 Windows RDP 主机:
> ```
ssh -L <port>:<target_host>:3389 <bastion_server>
```
> 让你的 RDP 客户端连接到 `localhost:<port>`
在不使用 VNC 端口的情况下,连接远程 VNC 主机:
> ```
ssh -L 5901:localhost:5901 <remote_host>
```
> 让你的 VNC 客户端连接到 `localhost:5901`
按照这个思路你可以映射任意端口LDAP (389)、631 (CUPS)、8080 (替代的 HTTP),等等。
产生一个新的 SSH 密钥对:
> ```
ssh-keygen
```
更新密钥对的密码:
> ```
ssh-keygen -p
```
把公钥复制到远程主机上:
> ```
ssh-copy-id -i <identity file> <remote_host>
```
SSH 有一堆命令行选项,但是如果有一些是你经常使用的,你可以为它们在 SSH 配置文件 (${HOME}/.ssh/config) 里创建一个入口。比如:
>```
host myhouse
User itsme
   HostName house.example.com
```
那么你就可以输入 `ssh myhouse` 来代替 `ssh itsme@house.example.com`
以下是常用的命令行选项和他们的配置文件写法。一些是常用的简化写法。请查看 `ssh(1)``ssh_config(5)` 的手册页来获取详尽信息。
|命令行|配置文件|描述
|:--|:--|:--|
| `-l <login name>` | `User <login name>` | 远程主机的登录用户名。|
| `-i <identity file>` | `IdentityFile <identity file>` |指定要使用的鉴权文件SSH 密码对)。 |
| `-p <remote port>` | `Port <remote port>` | 远程 SSH 守护进程监听的端口号。 (默认为 22) |
| `-C` | `Compression <yes,no>` | 压缩往来信息。 (默认为 no) |
| `-D <port>` | `DynamicForward <port>` | 把本地端口的报文转发到远程主机。 |
| `-X` | `ForwardX11 <yes,no>` | 把 X11 的图像数据转发到远程主机的端口. (默认为 no) |
| `-A` | `ForwardAgent <yes,no>` | 把授权代理的报文转发给远程主机。如果你使用第三方主机登录,这个功能将很有用。 (默认为 no) |
| `-4`(仅使用 IPv4 `-6` (仅使用 IPv6| `AddressFamily <any,inet4,inet6>` | 指定仅使用 IPv4 或者 IPv6。 |
| `-L <local port>:<target host>:<target port>` | `LocalForward <local port>:<target host>:<target port>` | 把本地主机指定端口的报文转发到远程主机的某个端口。|
opensource.com Twitter @opensourceway | facebook.com/opensourceway | IRC: #opensource.com on Freenode
--------------------------------------------------------------------------------
作者简介:
Ben Cotton 是业余的气象学家和职业的高性能计算工程师。Ben 是微软 Azure 的产品营销经理,专注于高性能计算。他是一个 Fedora 用户和贡献者,共同创立了一个当地的开放源码群,并且是开源促进会的成员和保护自由软件的支持者。通过以下方式联系他 Twitter (@FunnelFiasco) 或者 FunnelFiasco.com.
-------------
via: https://opensource.com/sites/default/files/gated-content/cheat_sheet_ssh_v03.pdf
作者:[BEN COTTON][a]
译者:[kennethXia](https://github.com/kennethXia)
校对:[wxy](https://github.com/wxy)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]:https://opensource.com/users/bcotton
[1]:https://web.kamihq.com/web/upgrade.html

View File

@ -1,3 +1,5 @@
pinewall translating
Containers without Docker at Red Hat
======

View File

@ -0,0 +1,108 @@
How To Quickly Monitor Multiple Hosts In Linux
======
![](https://www.ostechnix.com/wp-content/uploads/2018/03/rwho-1-720x340.png)
There are plenty of monitoring tools out there to monitor local and remote Linux systems. One fine example is [**Cockpit**][1]. Those tools, however, are either bit complicated to install and use, at least for the newbie admins. The newbie admin might need to spend some time to figure out how to configure those tools to monitor the systems. If you want a quick and dirty way to monitor multiple hosts at a time in your local area network, you might need to check **“rwho”** tool. It will instantly and quickly will monitor the local and remote systems as soon as you install rwho utility. You configure nothing! All you have to do is to install “rwho” tool on the systems that you want to monitor.
Please dont think of rwho as a feature-rich, and complete monitoring tool. This is just a simple tool that monitors only the **uptime** , **load** and **logged in users** of a remote system. Using “rwho” utility, we can find who is logged in on which computer, a list of monitored computers with uptime (time since last reboot), how many users are logged in and the load averages for the past 1, 5, and 15 minutes. Nothing more! Nothing less! Also, it will only monitor the systems that are in the same subnet. hence, it is ideal for small and home office network.
### Monitor Multiple Hosts In Linux
Let me explain how rwho works. Every system that uses rwho on the network will broadcast information about itself. The other computers can access these information using rwhod-daemon. So, every computer on the network must have rwho installed. Also, the rwhod-port (e.g. Port 513/UDP) must be allowed through your firewall/router in-order to distribute or access the information of other hosts.
Alright, let us install it.
I tested in on Ubuntu 16.04 LTS server. rwho is available in the default repositories, so we can install it using the APT package manager like below.
```
$ sudo apt-get install rwho
```
On RPM based systems such as CentOS, Fedora, RHEL, use this command to install it:
```
$ sudo yum install rwho
```
Make sure you have allowed the rwhod-port 513 if you are behind a firewall/router. Also, verify if the rwhod-daemon is running or not using command:
$ sudo systemctl status rwhod
If it is not started already, run the following commands to enable and start rwhod service:
```
$ sudo systemctl enable rwhod
$ sudo systemctl start rwhod
```
Now, it is time to monitor the systems. Run the following command to find out who is logged on which computer:
```
$ rwho
ostechni ostechnix:pts/5 Mar 12 17:41
root server:pts/0 Mar 12 17:42
```
As you can see, currently there are two systems on my local area network. The local system user is **ostechnix** (Ubuntu 16.04 LTS) and remote systems user is **root** (CentOS 7). As you might guessed already, rwho is similar to “who” command, but it will monitor the remote systems too.
And, we can find the uptime of all running systems on the network, using command:
```
$ ruptime
ostechnix up 2:17, 1 user, load 0.09, 0.03, 0.01
server up 1:54, 1 user, load 0.00, 0.01, 0.05
```
Here, ruptime (similar to “uptime” command) displays the total uptime of my Ubuntu (local) and CentOS (remote) systems. Got it? Great! Here is the sample screenshot from my Ubuntu 16.04 LTS system:
![][3]
You can find the information about all other machines in the local area network in the following location:
```
$ ls /var/spool/rwho/
whod.ostechnix whod.server
```
This is a small, yet very useful to find out who is logged in on which computer and the uptime along with system load details.
**Suggested read:**
Please be mindful that this method has one serious loophole. Since information about every computer is broadcasted over the net, everyone in the subnet could potentially get this information. It is okay normally but on the other side this can be a unwanted side-effect when information about the network is distributed to non-authorized users. So, It is strongly recommended to use it in a trusted and protected local area network.
For more details, refer man pages.
```
$ man rwho
```
And, thats all for now. More good stuffs to come. Stay tuned!
Cheers!
--------------------------------------------------------------------------------
via: https://www.ostechnix.com/how-to-quickly-monitor-multiple-hosts-in-linux/
作者:[SK][a]
译者:[译者ID](https://github.com/译者ID)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]:https://www.ostechnix.com/author/sk/
[1]:https://www.ostechnix.com/cockpit-monitor-administer-linux-servers-via-web-browser/
[2]:data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7
[3]:http://www.ostechnix.com/wp-content/uploads/2018/03/rwho.png
[4]:https://www.ostechnix.com/how-to-quickly-monitor-multiple-hosts-in-linux/?share=reddit (Click to share on Reddit)
[5]:https://www.ostechnix.com/how-to-quickly-monitor-multiple-hosts-in-linux/?share=twitter (Click to share on Twitter)
[6]:https://www.ostechnix.com/how-to-quickly-monitor-multiple-hosts-in-linux/?share=facebook (Click to share on Facebook)
[7]:https://www.ostechnix.com/how-to-quickly-monitor-multiple-hosts-in-linux/?share=google-plus-1 (Click to share on Google+)
[8]:https://www.ostechnix.com/how-to-quickly-monitor-multiple-hosts-in-linux/?share=linkedin (Click to share on LinkedIn)
[9]:https://www.ostechnix.com/how-to-quickly-monitor-multiple-hosts-in-linux/?share=pocket (Click to share on Pocket)
[10]:https://api.whatsapp.com/send?text=How%20To%20Quickly%20Monitor%20Multiple%20Hosts%20In%20Linux%20https%3A%2F%2Fwww.ostechnix.com%2Fhow-to-quickly-monitor-multiple-hosts-in-linux%2F (Click to share on WhatsApp)
[11]:https://www.ostechnix.com/how-to-quickly-monitor-multiple-hosts-in-linux/?share=telegram (Click to share on Telegram)
[12]:https://www.ostechnix.com/how-to-quickly-monitor-multiple-hosts-in-linux/?share=email (Click to email this to a friend)
[13]:https://www.ostechnix.com/how-to-quickly-monitor-multiple-hosts-in-linux/#print (Click to print)

View File

@ -1,135 +0,0 @@
translating---geekpi
Transfer Files From Computer To Mobile Devices By Scanning QR Codes
======
![](https://www.ostechnix.com/wp-content/uploads/2018/03/qr-filetransfer-720x340.png)
Transferring files from a Computer to a smartphone is not a big deal. You can do this by mounting the mobile phone on your system using an USB cable, then transfer files from the file manager. Also, some third party applications, such as [**KDE Connect**][1] and [**AirDroid**][2], can help you to easily manage and transfer files from your system to Android devices. Today, I stumbled upon a super cool utility named **“Qr-filetransfer”**. It allows you to transfer files over WiFi from computer to mobile devices by scanning QR codes without leaving your Terminal. Yes, you read that right! The qr-filetransfer is a free, open source command line utility written using Go programming language. In this brief tutorial, we are going to learn to transfer files from Linux to any mobile devices using qr-transfer.
### Installing Qr-filetransfer
First, install Go language on your system.
On Arch Linux and derivatives:
```
$ sudo pacman -S go
```
On RPM based systems like RHEL, CentOS, Fedora, run:
```
$ sudo yum install golang
```
Or,
```
$ sudo dnf install golang
```
On DEB based systems such as Debian, Ubuntu, Linux Mint, you can install it using command:
```
$ sudo apt-get install golang
```
On SUSE/openSUSE:
```
$ sudo zypper install golang
```
After installing Go language, run the following command to download qr-filetransfer application.
```
$ go get github.com/claudiodangelis/qr-filetransfer
```
The above command will download the contents of a qr-filetrnasfer GitHub repository in a directory named **“go”** in your current working directory.
Copy the qt-filetransfer binary file to your PATH, for example /usr/local/bin/.
```
$ sudo cp go/bin/qr-filetransfer /usr/local/bin/
```
Finally, make it executable as shown below.
```
$ sudo chmod +x /usr/local/bin/qr-filetransfer
```
### Transfer Files From Computer To Mobile Devices By Scanning QR Codes
Make sure that your smartphone is connected to the same WiFi network as your computer.
Then, launch qt-filetransfer tool along the with the file or folder path you want to transfer to your smartphone.
For example, I am going to transfer a mp3 file.
```
$ qr-filetransfer Chill\ Study\ Beats.mp3
```
At first launch, qr-filetransfer will ask you to choose the network interface to use like below.
```
Choose the network interface to use (type the number):
[0] enp5s0
[1] wlp9s0
```
I was going to transfer file using **wlp9s0** interface, so I typed “1”. Qr-filetransfer will remember this choice and you will never be prompted again, unless you pass the **-force** argument, or delete the **.qr-filetransfer.json** file that the program stores in the home directory of current user.
Then, you will see the QR code as shown in the below picture.
![][4]
Open the QR code app (if it is not installed already, install any QR code reader app from play store) and scan the QR code displayed in your terminal.
Once the QR code is read, you will be asked whether you want to copy the link or open the link. You can either copy the link and paste it manually on your mobile web browser or choose “Open link” to automatically open it in your mobile browser.
![][5]
Once the share link has been opened, the file will be downloaded in your smartphone.
![][6]
If the file is too big, zip the file, then transfer it
```
$ qr-filetransfer -zip /path/to/file.txt
```
To transfer a full directory, run:
```
$ qr-filetransfer /path/to/directory
```
Please note that the directory gets zipped before being transferred.
Qr-filetransfer utility will only transfer the stuffs from your system to mobile and not vice versa. This project is very new, so there will be bugs. If you encountered any bugs, report them in the GitHub page given at the end of this guide.
Cheers!
--------------------------------------------------------------------------------
via: https://www.ostechnix.com/transfer-files-from-computer-to-mobile-devices-by-scanning-qr-codes/
作者:[SK][a]
译者:[译者ID](https://github.com/译者ID)
校对:[校对者ID](https://github.com/校对者ID)
选题:[lujun9972](https://github.com/lujun9972)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]:https://www.ostechnix.com/author/sk/
[1]:https://www.ostechnix.com/kde-connect-access-files-notifications-android-devices/
[2]:https://www.ostechnix.com/airdroid-share-files-and-folders-between-linux-and-android/
[4]:http://www.ostechnix.com/wp-content/uploads/2018/03/qr-filetransfer-5.png
[5]:http://www.ostechnix.com/wp-content/uploads/2018/03/qr-filetransfer-6-4.png
[6]:http://www.ostechnix.com/wp-content/uploads/2018/03/qr-filetransfer-4.png

View File

@ -1,105 +0,0 @@
Translating by qhwdw
Build a baby monitor with a Raspberry Pi
======
![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/baby-chick-egg.png?itok=RcFfqdbA)
Hong Kong can be hot and humid, even at night, and many people use air conditioning to make their homes more bearable. When my oldest son was a baby, the air conditioning unit in his bedroom had manual controls and no thermostat functionality. It was either on or off, and allowing it to run continuously overnight caused the room to get cold and wasted energy and money.
I decided to fix this problem with an [Internet of Things][1] solution based on a [Raspberry Pi][2]. Later I took it a step further with a [baby monitor][3] add-on. In this article, I'll explain how I did it, and the code is [available on my GitHub][4] page.
### Setting up the air conditioner controller
I solved the first part of my problem with an Orvibo S20 [WiFi-connected smart plug][5] and smartphone application. Although this allowed me to control the air conditioning unit remotely, it was still a manual process, and I wanted to try and automate it. I found a project on [Instructables][6] that seemed to match my requirements: It used a Raspberry Pi to measure local temperature and humidity readings from an [AM2302 sensor][7] and record them to a MySQL database.
Using crimp terminal contacts with crimp housings made it a pinch to connect the temperature/humidity sensor to the correct GPIO pins on the Raspberry Pi. Fortunately, the AM2302 sensor has [open source software][8] for taking readings, with helpful [Python][9] examples.
The software for [interfacing with the AM2302 sensor][10] has been updated since I put my project together, and the original code I used is now considered legacy and unmaintained. The code is made up of a small binary object to connect to the sensor and some Python scripts to interpret the readings and return the correct values.
![Raspberry Pi, sensor, and Python code][12]
Raspberry Pi, sensor, and Python code used to build the temperature/humidity monitor.
With the sensor connected to the Raspberry Pi, the Python code can correctly return temperature and humidity readings. Connecting Python to a MySQL database is straightforward, and there are plenty of code examples that use the `python-``mysql` bindings. Because I needed to monitor the temperature and humidity continuously, I wrote software to do this.
In fact, I ended up with two solutions, one that would run continuously as a process and periodically poll the sensor (typically at one-minute intervals), and another Python script that ran once and exited. I decided to use the run-once-and-exit approach coupled with cron to call this script every minute. The main reason was that the continuous (looped) script occasionally would not return a reading, which could lead to a buildup of processes trying to read the sensor, and that would eventually cause a system to hang due to lack of available resources.
I also found a convenient [Perl script][13] to programmatically control my smart plug. This was an essential piece of the jigsaw, as it meant I could trigger the Perl script if certain temperature and/or humidity conditions were met. After some testing, I decided to create a separate `checking` script that would pull the latest values from the MySQL database and set the smart plug on or off depending upon the values returned. Separating the logic to run the plug control script from the sensor-reading script also meant that it operated independently and would continue to run, even if the sensor-reading script developed problems.
It made sense to make the temperature at which the air conditioner would switch on/off configurable, so I moved these values to a configuration file that the control script read. I also found that, although the sensor was generally accurate, occasionally it would return incorrect readings. The sensor script was modified to not write temperature or humidity values to the MySQL database that were significantly different from the previous values. Likewise the allowed variance of temperature or humidity between consecutive readings was set in a general configuration file, and if the reading was outside these limits the values would not be committed to the database.
Although this seemed like quite a lot of effort to make a thermostat, recording the data to a MySQL database meant it was available for further analysis to identify usage patterns. There are many graphing options available to present data from a MySQL database, and I decided to use [Google Chart][14]to display the data on a web page.
![Temperature and humidity chart][16]
Temperature and humidity measured over the previous six hours.
### Adding a baby monitor camera
The open nature of the Raspberry Pi meant I could continue to add functionality—and I had plenty of open GPIO pins available. My next idea was to add a camera module to set it up as a baby monitor, given that the device was already in the baby's bedroom.
I needed a camera that works in the dark, and the [Pi Noir][17] camera module is perfect for this. The Pi Noir is the same as the Raspberry Pi's regular camera module, except it doesn't have an infrared (IR) filter. This means daytime images may have a slightly purple tint, but it will display images lit with IR light in the dark.
Now I needed a source of IR light. Due to the Pi's popularity and low barrier of entry, there are a huge number of peripherals and add-ons for it. Of the many IR sources available, the one that caught my attention was the [Bright Pi][18]. It draws power from the Raspberry Pi and fits around the camera Pi module to provide a source of IR and normal light. The only drawback was I needed to dust off my rusty soldering skills.
It might have taken me longer than most, but my soldering skills were up to it, and I was able to successfully attach all the IR LEDs to the housing and connect the IR light source to the Pi's GPIO pins. This also meant that the Pi could programmatically control when the IR LEDs were lit, as well as their light intensity.
It also made sense to have the video capture exposed via a web stream so I could watch it from the web page with the temperature and humidity readings chart. After further research, I chose to use a [streaming software][19] that used M-JPEG captures. Exposing the JPG source via the web page also allowed me to connect camera viewer applications on my smartphone to view the camera output there, as well.
### Putting on the finishing touches
No Raspberry Pi project is complete without selecting an appropriate case for the Pi and its various components. After a lot of searching and comparing, there was one clear [winner][20]: SmartPi's Lego-style case. The Lego compatibility allowed me to build mounts for the temperature/humidity sensor and camera. Here's the final outcome:
![](https://opensource.com/sites/default/files/styles/panopoly_image_original/public/u128651/pibabymonitor_case.png?itok=_ofyN73a)
Since then, I've made other changes and updates to my setup:
* I upgraded from a Raspberry Pi 2 Model B to a [Raspberry Pi 3][21], which meant I could do away with the USB WiFi module.
* I replaced the Orvibo S20 with a [TP-Link HS110][22] smart plug.
* I also plugged the Pi into a smart plug so I can do remote reboots/resets.
* I migrated the MySQL database off the Raspberry Pi, and it now runs in a container on a NAS device.
* I added a [flexible tripod][23] to allow for the best camera angle.
* I recompiled the USB WiFi module to disable the onboard flashing LED, which was one of the main advantages to upgrading to a Raspberry Pi 3.
* I've since built another monitor for my second child.
* I bought a bespoke night camera for my third child … due to lack of time.
Want to learn more? All the code is [available on my GitHub][4] page.
Do you have a Raspberry Pi project to share? [Send us your story idea][24].
--------------------------------------------------------------------------------
via: https://opensource.com/article/18/3/build-baby-monitor-raspberry-pi
作者:[Jonathan Ervine][a]
译者:[译者ID](https://github.com/译者ID)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]:https://opensource.com/users/jervine
[1]:https://opensource.com/tags/internet-things
[2]:https://opensource.com/tags/raspberry-pi
[3]:https://opensource.com/article/17/9/gonimo
[4]:https://github.com/jervine/rpi-temp-humid-monitor
[5]:https://www.amazon.co.uk/marsboy-S20-Automation-Control-Smartphone/dp/B01LXKPUDK/ref=sr_1_1/258-6082934-2585109?ie=UTF8&qid=1520578769&sr=8-1&keywords=orvibo+s20
[6]:http://www.instructables.com/id/Raspberry-Pi-Temperature-Humidity-Network-Monitor/
[7]:https://www.adafruit.com/product/393
[8]:https://github.com/adafruit/Adafruit_Python_DHT
[9]:https://opensource.com/tags/python
[10]:https://github.com/adafruit/Adafruit-Raspberry-Pi-Python-Code/tree/legacy/Adafruit_DHT_Driver_Python
[11]:/file/390916
[12]:https://opensource.com/sites/default/files/styles/panopoly_image_original/public/u128651/pibabymonitor_materials.png?itok=2w03CdKM (Raspberry Pi, sensor, and Python code)
[13]:https://github.com/franc-carter/bauhn-wifi
[14]:https://developers.google.com/chart/
[15]:/file/390876
[16]:https://opensource.com/sites/default/files/styles/panopoly_image_original/public/u128651/pibabymonitor_temp-humidity.png?itok=2jqtQU0x (Temperature and humidity chart)
[17]:https://www.raspberrypi.org/products/pi-noir-camera-v2/
[18]:https://www.pi-supply.com/product/bright-pi-bright-white-ir-camera-light-raspberry-pi/
[19]:https://elinux.org/RPi-Cam-Web-Interface
[20]:https://smarticase.com/collections/all/products/smartipi-kit-3
[21]:https://opensource.com/article/18/3/raspberry-pi-3b-model-news
[22]:https://www.tp-link.com/uk/products/details/cat-5258_HS110.html
[23]:https://www.amazon.com/Flexpod-Flexible-Tripod-Discontinued-Manufacturer/dp/B000JC8WYA
[24]:http://opensource.com/story

View File

@ -0,0 +1,114 @@
What NASA Has Been Doing About Open Science
======
![][1]
We have recently started a new [Science category][2] on Its FOSS. We covered [how open source approach is impacting Science][3] in the last article. In this open science article, we discuss [NASA][4]s actively growing efforts that involve their dynamic role in boosting scientific research by encouraging open source practices.
### How NASA is using Open Source approach to improve science
It was a great [initiative][5] by NASA that they made their entire research library freely available on the public domain.
Yes! Entire research library for everyone to access and get benefit from it in their research.
Their open science resources can now be mainly classified into these three categories as follows:
* Open Source NASA
* Open API
* Open Data
#### 1\. Open Source NASA
Heres an interesting interview of [Chris Wanstrath][6], co-founder and CEO of [GitHub][7], about how it all began to form many years ago:
Uniquely named “[code.nasa.gov][8]“, NASA now has precisely 365 scientific software available as [open source via GitHub][9] as of the time of this post. So if you are a developer who loves coding, you can study each one of them every day for a years time!
Even if you are not a developer, you can still browse through the fantastic collection of open source packages enlisted on the portal!
One of the interesting open source packages listed here is the source code of [Apollo 11][10]s guidance computer. The Apollo 11 spaceflight took [the first two humans to the Moon][11], namely, [Neil Armstrong][12] and [Edwin Aldrin][13] ! If you want to know more about Edwin Aldrin, you might want to pay a visit [here][14].
##### Licenses being used by NASAs Open Source Initiative:
Here are the different [open source licenses][15] categorized as under:
#### 2\. Open API
An Open [Application Programming Interface][16] or API plays a significant role in practicing Open Science. Just like [The Open Source Initiative][17], there is also one for API, called [The Open API Initiative][18]. Here is a simple illustration of how an API bridges an application with its developer:
![][19]
Do check out the link in the caption in the image above. The API has been explained in a straightforward manner. It concludes with five exciting takeaways in the end.
![][20]
Makes one wonder how different [an open vs a proprietary API][21] would be.
![][22]
Targeted towards application developers, [NASAs open API][23] is an initiative to significantly improve the accessibility of data that could also contain image content. The site has a live editor, allowing you check out the [API][16] behind [Astronomy Picture of the Day (APOD)][24].
#### 3\. Open Data
![][25]
In [our first science article][3], we shared with you the various open data models of three countries mentioned under the “Open Science” section, namely, France, India and the U.S. NASA also has a similar approach towards the same idea. This is a very important ideology that is being adopted by [many countries][26].
[NASAs Open Data Portal][27] focuses on openness by having an ever-growing catalog of data, available for anyone to access freely. The inclusion of datasets within this collection is an essential and radical step towards the development of research of any kind. NASA have even taken a fantastic initiative to ask for dataset suggestions for submission on their portal and thats really very innovative, considering the growing trends of [data science][28], [AI and deep learning][29].
The following video shows students and scientists coming up with their own definitions of Data Science based on their personal experience and research. That is really encouraging! [Dr. Murtaza Haider][30], Ted Rogers School of Management, Ryerson University, mentions the difference Open Source is making in the field of Data Science before the video ends. He explains in very simple terms, how development models transitioned from a closed source approach to an open one. The vision has proved to be sufficiently true enough in todays time.
![][31]
Now anyone can suggest a dataset of any kind on NASA. Coming back to the video above, NASAs initiative can be related so much with submitting datasets and working on analyzing them for better Data Science!
![][32]
You just need to signup for free. This initiative will have a very positive effect in the future, considering open discussions on the public forum and the significance of datasets in every type of analytical field that could exist. Statistical studies will also significantly improve for sure. We will talk about these concepts in detail in a future article and also about their relativeness to an open source model.
So thus concludes an exploration into NASAs open science model. See you soon in another open science article!
--------------------------------------------------------------------------------
via: https://itsfoss.com/nasa-open-science/
作者:[Avimanyu Bandyopadhyay][a]
译者:[译者ID](https://github.com/译者ID)
校对:[校对者ID](https://github.com/校对者ID)
选题:[lujun9972](https://github.com/lujun9972)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://itsfoss.com/author/avimanyu/
[1]:https://itsfoss.com/wp-content/uploads/2018/03/tux-in-space.jpg
[2]:https://itsfoss.com/category/science/
[3]:https://itsfoss.com/open-source-impact-on-science/
[4]:https://www.nasa.gov/
[5]:https://futurism.com/free-science-nasa-just-opened-its-entire-research-library-to-the-public/
[6]:http://chriswanstrath.com/
[7]:https://github.com/
[8]:http://code.nasa.gov
[9]:https://github.com/open-source
[10]:https://www.nasa.gov/mission_pages/apollo/missions/apollo11.html
[11]:https://www.space.com/16758-apollo-11-first-moon-landing.html
[12]:https://www.jsc.nasa.gov/Bios/htmlbios/armstrong-na.html
[13]:https://www.jsc.nasa.gov/Bios/htmlbios/aldrin-b.html
[14]:https://buzzaldrin.com/the-man/
[15]:https://itsfoss.com/open-source-licenses-explained/
[16]:https://en.wikipedia.org/wiki/Application_programming_interface
[17]:https://opensource.org/
[18]:https://www.openapis.org/
[19]:https://itsfoss.com/wp-content/uploads/2018/03/api-bridge.jpeg
[20]:https://itsfoss.com/wp-content/uploads/2018/03/open-api-diagram.jpg
[21]:http://www.apiacademy.co/resources/api-strategy-lesson-201-private-apis-vs-open-apis/
[22]:https://itsfoss.com/wp-content/uploads/2018/03/nasa-open-api-live-example.jpg
[23]:https://api.nasa.gov/
[24]:https://apod.nasa.gov/apod/astropix.html
[25]:https://itsfoss.com/wp-content/uploads/2018/03/nasa-open-data-portal.jpg
[26]:https://www.xbrl.org/the-standard/why/ten-countries-with-open-data/
[27]:https://data.nasa.gov/
[28]:https://en.wikipedia.org/wiki/Data_science
[29]:https://www.kdnuggets.com/2017/07/ai-deep-learning-explained-simply.html
[30]:https://www.ryerson.ca/tedrogersschool/bm/programs/real-estate-management/murtaza-haider/
[31]:https://itsfoss.com/wp-content/uploads/2018/03/suggest-dataset-nasa-1.jpg
[32]:https://itsfoss.com/wp-content/uploads/2018/03/suggest-dataset-nasa-2-1.jpg

View File

@ -1,3 +1,6 @@
Translating by MjSeven
Getting started with Vagrant
======

View File

@ -0,0 +1,166 @@
The Shuf Command Tutorial With Examples For Beginners
======
![](https://www.ostechnix.com/wp-content/uploads/2018/04/shuf-command-720x340.png)
The Shuf command is used to generate random permutations in Unix-like operating systems. Using shuf command, we can shuffle the lines of a given input file randomly. Shuf command is part of GNU Coreutils, so you dont have bother with installation. In this brief tutorial, let me show you some examples of shuf command.
### The Shuf Command Tutorial With Examples
I have a file named **ostechnix.txt** with the following contents.
```
$ cat ostechnix.txt
line1
line2
line3
line4
line5
line6
line7
line8
line9
line10
```
Now let us display the above lines in a random order. To do so, run:
```
$ shuf ostechnix.txt
line2
line8
line5
line10
line7
line1
line4
line6
line9
line3
```
See? The above command randomized the order of lines in the file named “ostechnix.txt” and output the result.
You might want to write the output to another file. For example, I want to save the output in a file named **output.txt**. To do so, first create output.txt file:
```
$ touch output.txt
```
Then, write the output to that file using **-o** flag like below.
```
$ shuf ostechnix.txt -o output.txt
```
The above command will shuffle the contents of ostechnix.txt file randomly and write the output to output.txt file. You can view the output.txt file contents using command:
```
$ cat output.txt
line2
line8
line9
line10
line1
line3
line7
line6
line4
line5
```
I just want to display any one of the random line from the file. How do I do it? Simple!
```
$ shuf -n 1 ostechnix.txt
line6
```
Similarly, we can pick the first “n” random entries. The following command will display the only the first five random entries.
```
$ shuf -n 5 ostechnix.txt
line10
line4
line5
line9
line3
```
Instead of reading the lines from a file, we can directly pass the inputs using **-e** flag like below.
```
$ shuf -e line1 line2 line3 line4 line5
line1
line3
line5
line4
line2
```
You can pass shuffle the numbers too:
```
$ shuf -e 1 2 3 4 5
3
5
1
4
2
```
To quickly pick any one from the given range, use this command instead.
```
$ shuf -n 1 -e 1 2 3 4 5
```
Or, pick any three random numbers like below.
```
$ shuf -n 3 -e 1 2 3 4 5
3
5
1
```
We can also generate random numbers within a particular range. For example, to display random numbers between 1 to 10, simply use:
```
$ shuf -i 1-10
1
9
8
2
4
7
6
3
10
5
```
For more details, refer man pages.
```
$ man shuf
```
And, thats all for today. More good stuffs to come. Stay tuned!
Cheers!
--------------------------------------------------------------------------------
via: https://www.ostechnix.com/the-shuf-command-tutorial-with-examples-for-beginners/
作者:[SK][a]
译者:[译者ID](https://github.com/译者ID)
校对:[校对者ID](https://github.com/校对者ID)
选题:[lujun9972](https://github.com/lujun9972)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]:https://www.ostechnix.com/author/sk/

View File

@ -1,3 +1,6 @@
translating---geekpi
A Kernel Module That Forcibly Shutdown Your System
======

View File

@ -0,0 +1,174 @@
Bootiso Lets You Safely Create Bootable USB Drive
======
![](https://www.ostechnix.com/wp-content/uploads/2018/04/USB-drive-720x340.png)
Howdy newbies! Some of you may often use **dd command** to do various things, like creating a USB drive or cloning disk partitions. Please be mindful that dd command is one of the dangerous and destructive command. If youre Linux beginner, mostly avoid using dd command to do stuffs. If you dont know what you are doing, you may wipe your hard drive in minutes. The dd command literally just takes bytes from **if** and writes them to **of**. It doesnt care what its overwriting, it doesnt care if theres a partition table in the way, or a boot sector, or a home folder, or anything important. It will simply do what it is told to do. Instead, use some user-friendly apps like [**Etcher**][1]. So you will know which device youre going to format before actually start creating bootable USB devices.
Today, I stumbled upon yet another utility named **“Bootiso”** , which is also used to safely create bootable USB drive. It is actually a BASH script, and is brilliant! It has some extra features that helps us to safely create bootable USB devices. If you want to be sure youre targeting a USB device (and not internal drive), or if you want autodetection of a USB device, you can use bootiso. Here is the significant advantages of using this script:
* If there is only one USB drive, Bootiso will automatically select it.
* If there are more than one USB drives present, it lets you to choose one of them from the list.
* Just in case you mistakenly choose one of Internal hard drive, it will exit without doing anything.
* It checks the selected ISO has the correct mime-type. If it has wrong mime-type, it will exit.
* It asserts that the selected item is not a partition and exit if it doesnt.
* It will prompt the user confirmation before erasing and partitioning the USB drive.
* Lists available USB drives.
* Installs syslinux bootloader (optional).
* Free and Open Source.
### Safely Create Bootable USB Drive Using Bootiso
Installing Bootiso is very easy. Download the latest version using command:
```
$ curl -L https://rawgit.com/jsamr/bootiso/latest/bootiso -O
```
Move the downloaded file to your **$PATH** , for example /usr/local/bin/.
```
$ sudo cp bootiso /usr/local/bin/
```
Finally, make it executable:
```
$ sudo chmod +x /usr/local/bin/bootiso
```
Done! Now, it is time to create bootable USB drives. First, let us see how many USB drives are present using command:
```
$ bootiso -l
```
Sample output:
```
Listing USB drives available in your system:
NAME HOTPLUG SIZE STATE TYPE
sdb 1 7.5G running disk
```
As you can see, I have only one USB drive. Let us go ahead and create the USB bootable from an ISO file using command:
```
$ bootiso bionic-desktop-amd64.iso
```
This command will prompt you to enter the sudo password. Type the password and hit ENTER key to install the missing dependencies (if there are any) and then create USB bootable device.
Sample output:
```
[...]
Listing USB drives available in your system:
NAME HOTPLUG SIZE STATE TYPE
sdb 1 7.5G running disk
Autoselecting `sdb' (only USB device candidate)
The selected device `/dev/sdb' is connected through USB.
Created ISO mount point at `/tmp/iso.c5m'
`bootiso' is about to wipe out the content of device `/dev/sdb'.
Are you sure you want to proceed? (y/n)>y
Erasing contents of /dev/sdb...
Creating FAT32 partition on `/dev/sdb1'...
Created USB device mount point at `/tmp/usb.QgV'
Copying files from ISO to USB device with `rsync'
Synchronizing writes on device `/dev/sdb'
`bootiso' took 303 seconds to write ISO to USB device with `rsync' method.
ISO succesfully unmounted.
USB device succesfully unmounted.
USB device succesfully ejected.
You can safely remove it !
```
If the your ISO file has the wrong mime-type, you will see the following error message:
```
Provided file `bionic-desktop-amd64.iso' doesn't seem to be an iso file (wrong mime type: `application/octet-stream').
Exiting bootiso...
```
You can, however, skip the mime-type check using **no-mime-check** option like below.
```
$ bootiso --no-mime-check bionic-desktop-amd64.iso
```
Like I already mentioned, Bootiso will automatically choose the USB drive if there is only one USB drive present in your system. So, we dont need to mention the usb disk path. If you have more than one devices connected, you can explicitly specify the USB device using **-d** flag like below.
```
$ bootiso -d /dev/sdb bionic-desktop-amd64.iso
```
Replace “/dev/sdb” with your own path.
If you dont specify **-d** flag when using more than one USB devices, Bootiso will prompt you to select from available USB drives.
Bootiso will ask the user confirmation before erasing and partitioning the USB devices. To auto-confirm this, use **-y** or **assume-yes** flag.
```
$ bootiso -y bionic-desktop-amd64.iso
```
You can also enable autoselecting USB devices in conjunction with **-y** option as shown below.
```
$ bootiso -y -a bionic-desktop-amd64.iso
```
Or,
```
$ bootiso --assume-yes --autoselect bionic-desktop-amd64.iso
```
Please remember it will work only if you have only one connected USB drive.
By default, Bootiso will create a **FAT 32** partition and then mount and copy the ISO contents using **“rsync”** program to your USB drive. You can also use “dd” instead of “rsync” if you want.
```
$ bootiso --dd -d /dev/sdb bionic-desktop-amd64.iso
```
If you want to increase the odds your USB will be bootable, use **“-b”** or **bootloader”** like below.
```
$ bootiso -b bionic-desktop-amd64.iso
```
The above command will install a bootloader with **syslinux** (safe mode). Please note that it doesnt work if you use “dd” option.
After creating the bootable device, Bootiso will automatically eject the USB drive. If you dont want it to automatically eject it, use **-J** or **no-eject** flag.
```
$ bootiso -J bionic-desktop-amd64.iso
```
Now, the USb device will remain connected. You can unmount it at anytime using “umount” command.
To display help section, run:
```
$ bootiso -h
```
And, thats all for now. Hope this script helps. More good stuffs to come. Stay tuned!
--------------------------------------------------------------------------------
via: https://www.ostechnix.com/bootiso-lets-you-safely-create-bootable-usb-drive/
作者:[SK][a]
译者:[译者ID](https://github.com/译者ID)
校对:[校对者ID](https://github.com/校对者ID)
选题:[lujun9972](https://github.com/lujun9972)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]:https://www.ostechnix.com/author/sk/
[1]:https://www.ostechnix.com/etcher-beauitiful-app-create-bootable-sd-cards-usb-drives/

View File

@ -0,0 +1,125 @@
Awesome GNOME extensions for developers
======
![](https://fedoramagazine.org/wp-content/uploads/2018/04/gnome-extensions-for-developers-816x345.jpg)
Extensions add immense flexibility to the GNOME 3 desktop environment. They give users the advantage of customizing their desktop while adding ease and efficiency to their workflow. The Fedora Magazine has already covered some great desktop extensions such as [EasyScreenCast][1], [gTile][2], and [OpenWeather][3]. This article continues that coverage by focusing on extensions tailored for developers.
If you need assistance installing GNOME extensions, refer to the article [How to install a GNOME Shell extension][4].
### ![Docker Integration extension icon][5] Docker Integration
![Docker Integration extension status menu][6]
The [Docker Integration][7] extension is a must for developers using Docker for their apps. The status menu provides a list of Docker containers with the option to start, stop, pause and even remove them. The list updates automatically as new containers are added to the system.
After installing this extension, Fedora users may get the message: “Error occurred when fetching containers.” This is because Docker commands require sudo or root permissions by default. To configure your user account to run Docker, refer to the [Docker Installation page on the Fedora Developer Portal][8].
You can find more information on the [extensions website][9].
### ![Jenkins CI Server Indicator icon][10] Jenkins CI Server Indicator
![Jenkins CI Server Indicator extension status menu][11]
The [Jenkins CI Server Indicator][12] extension makes it easy for developers to build their apps on a Jenkins CI Server. It displays a menu with a list of jobs and the state of those jobs. It also includes features such as easy access to the Jenkins web front-end, notifications for completed jobs, and the ability to trigger and filter jobs.
For more information, visit the [developers site][13].
### ![android-tool extension icon][14] android-tool
![android-tool extension status menu][15][android-tool][16] can be a valuable extension for Android developers. Features include capturing bug reports, device screenshots and screen-recording. It can also connect to the Android device via USB or TCP.
This extension does require the adb package. To install adb from the official Fedora repository [run this command][17]:
```
sudo dnf install android-tools
```
You can find more information at [the extension Github site][18].
### ![GnomeHub extension icon][19] GnomeHub
![GnomeHub extension status menu][20][GnomeHub][21] is a great extension for GNOME users using Github for their projects. It displays Github repositories and notifies the user of opened pull requests. In addition, users can add their favorite repositories in the extensions settings.
For more information, refer to [the projects Github page][22].
### ![gistnotes extension icon][23] gistnotes
Quite simply, [gistnotes][24] provides easy access for gist users to create, store and manage notes or code snippets. For more information refer to [the projects website][25].
![gistnotes window][26]
### ![Arduino Control extension icon][27] Arduino Control
The [Arduino Control][28] extension allows users to connect to, and control, their Arduino boards. It also lets users add sliders and switches in the status menu. In addition, the developer includes scripts in the extensions directory to connect to the board via Ethernet or USB.
Most importantly, this extension can be customized to fit your project. An example provided in the README file is the ability to “Control your Room Lights from any Computer on the Network.”
You can read more about the features and setup of this extension on [the projects Github page][29].
### ![Hotel Manager extension icon][30] Hotel Manager
![Hotel Manager extension status menu.][31]
Developers using the Hotel process manager for their web apps should explore the [Hotel Manager][32] extension. It displays a list of web apps added to Hotel, and gives users the ability to start, stop and restart those apps. Furthermore, the computers icon to the right gives quick access to open, or view, that web app. The extension can also start, stop, or restart the Hotel daemon.
As of the publication of this article, Hotel Manager version 4 for GNOME 3.26 does not list the web apps in the extensions drop-down menu. Version 4 also gives errors when installing on Fedora 28 (GNOME 3.28). However, version 3 works with Fedora 27 and Fedora 28.
For more details, see [the projects Github page][33].
### VSCode Search Provider
[VSCode Search Provider][34] is a simple extension that displays Visual Studio Code projects in the GNOME overview search results. For heavy VSCode users, this extension saves time by giving developers quick access to their projects. You can find more information on [the projects Github page][35].
![GNOME Overview search results showing VSCode projects.][36]
Do you have a favourite extension you use for development? Let us know in the comments.
--------------------------------------------------------------------------------
via: https://fedoramagazine.org/awesome-gnome-extensions-developers/
作者:[Shaun Assam][a]
译者:[译者ID](https://github.com/译者ID)
校对:[校对者ID](https://github.com/校对者ID)
选题:[lujun9972](https://github.com/lujun9972)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]:https://fedoramagazine.org/author/sassam/
[1]:https://fedoramagazine.org/screencast-gnome-extension/
[2]:https://fedoramagazine.org/must-have-gnome-extension-gtile/
[3]:https://fedoramagazine.org/weather-updates-openweather-gnome-shell-extension/
[4]:https://fedoramagazine.org/install-gnome-shell-extension/
[5]:https://fedoramagazine.org/wp-content/uploads/2017/08/dockericon.png
[6]:https://fedoramagazine.org/wp-content/uploads/2017/08/docker-extension-menu.png
[7]:https://extensions.gnome.org/extension/1065/docker-status/
[8]:https://developer.fedoraproject.org/tools/docker/docker-installation.html
[9]:https://github.com/gpouilloux/gnome-shell-extension-docker
[10]:https://fedoramagazine.org/wp-content/uploads/2017/08/jenkinsicon.png
[11]:https://fedoramagazine.org/wp-content/uploads/2017/08/jenkins-extension-menu.png
[12]:https://extensions.gnome.org/extension/399/jenkins-ci-server-indicator/
[13]:https://www.philipphoffmann.de/gnome-3-shell-extension-jenkins-ci-server-indicator/
[14]:https://fedoramagazine.org/wp-content/uploads/2017/08/androidtoolicon.png
[15]:https://fedoramagazine.org/wp-content/uploads/2017/08/android-tool-extension-menu.png
[16]:https://extensions.gnome.org/extension/1232/android-tool/
[17]:https://fedoramagazine.org/howto-use-sudo/
[18]:https://github.com/naman14/gnome-android-tool
[19]:https://fedoramagazine.org/wp-content/uploads/2017/08/gnomehubicon.png
[20]:https://fedoramagazine.org/wp-content/uploads/2017/08/gnomehub-extension-menu.png
[21]:https://extensions.gnome.org/extension/1263/gnomehub/
[22]:https://github.com/lagartoflojo/gnomehub
[23]:https://fedoramagazine.org/wp-content/uploads/2017/08/gistnotesicon.png
[24]:https://extensions.gnome.org/extension/917/gistnotes/
[25]:https://github.com/mohan43u/gistnotes
[26]:https://fedoramagazine.org/wp-content/uploads/2018/04/gistnoteswindow.png
[27]:https://fedoramagazine.org/wp-content/uploads/2017/08/arduinoicon.png
[28]:https://extensions.gnome.org/extension/894/arduino-control/
[29]:https://github.com/simonthechipmunk/arduinocontrol
[30]:https://fedoramagazine.org/wp-content/uploads/2017/08/hotelicon.png
[31]:https://fedoramagazine.org/wp-content/uploads/2017/08/hotelmanager-extension-menu.png
[32]:https://extensions.gnome.org/extension/1285/hotel-manager/
[33]:https://github.com/hardpixel/hotel-manager
[34]:https://extensions.gnome.org/extension/1207/vscode-search-provider/
[35]:https://github.com/jomik/vscode-search-provider
[36]:https://fedoramagazine.org/wp-content/uploads/2018/04/vscodesearch.png

View File

@ -0,0 +1,108 @@
Replicate your custom Linux settings with DistroTweaks
======
![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/computer_keyboard_laptop_development_code_woman.png?itok=vbYz6jjb)
Currently, there are more than 300 different Linux operating system distributions available. Each distro serves a slightly different purpose with slightly different bundles of programs for different communities of users.
Even though there are hundreds of different versions of Linux, it hasn't been very easy for individual customizers to share them with the community. [DistroTweaks][1], a process that allows users to customize and share Linux, is a better option than what's come before.
A DistroTweak is a process that allows anyone to quickly and easily add dozens of customizations and programs to an existing Linux distro with just the click of a button. It replaces the tedious process of making changes and manually (and individually) adding dozens of programs. The term "tweak" is a nod to what computer enthusiasts call a slight modification of an operating system or application. A tweak generally doesn't change the core of the operating system or program; it merely adds to it.
### Why DistroTweaks?
In the past, there were two options for widely sharing a custom distribution. The first was to clone the distribution with a cloning tool after customizing your settings and programs, but cloning is a complex process. Often, folks didn't find out their clone didn't work until they tried to install it and got the black screen of death.
The other option was to make your own distribution. You would fork an existing distribution, delete programs you didn't like, and add the programs you wanted. You also had to create new graphics to replace the ones in the parent distribution, as well as build a website to host the download page and a community forum for answering questions. This is very time-consuming.
DistroTweaks offers a third option for sharing Linux that is more reliable than cloning and less work than starting your own distribution. It leverages the [Aptik][2] tool that simplifies re-installing software after a Linux distro re-installation.
### How DistroTweaks solves problems
I teach courses in writing books and creating complex, interactive websites, and I want my students to have access to the same custom computer system and programs I use. This is an issue because I have made several dozen minor modifications to the Linux Mint operating system, added a couple of dozen programs to the default Mint programs, and made more than 50 modifications to LibreOffice (one of Mint's default programs).
Previously, my students had to follow dozens of steps in my books and websites to get a computer that looked exactly like mine. While this is a good learning exercise that teaches students why I made these modifications, this "learning by doing" process is a long ordeal that may be too intimidating or time-consuming for a lot of students.
To make this faster and easier, I developed a simple process that exactly copies all my custom settings and programs into a special DistroTweaks file. My students can install Linux Mint in the normal way, add the DistroTweaks file, and, in a matter of minutes, have an exact copy of my computer with all my customized Mint settings and programs (including the LibreOffice customizations). Because it doesn't alter Linux Mint itself, the result is highly stable. The DistroTweaks process even works inside a virtual machine, so it can be tested before installing it on a computer. In addition, the process is so easy that anyone can create their own custom DistroTweak and share it with any group.
### How to create a DistroTweak
1. To avoid accidentally sharing your personal settings, start with a completely clean computer.
2. Download and install your favorite Linux distribution (we have only tested DistroTweaks with Ubuntu-based Linux, but Debian-based distros may also work).
3. Create a list of all the tweaks you will make to your distro settings, the programs you will add, and the customizations you will make. For example, we customized LibreOffice Writer menu and added several extensions to it.
4. Complete all the steps on your list of tweaks on your clean computer. Practice installing everything, just to make sure everything works and you are aware of all dependencies ahead of time. Be as organized as possible.
5. Next, use a personal package archive ([PPA][3]) software repository to install the Aptik tool. To install Aptik, open a terminal and enter the following commands:
```
sudo apt-add-repository -y ppa:teejee2008/ppa
sudo apt-get update
sudo apt-get install aptik
```
1. Start Aptik from the Linux menu and enter your password.
2. Create a backup folder in your computer's **Filesystem** folder: First, right-click on the screen and select **Open as root**. Then, right-click again and select **Add a new folder**. Name the folder **Backup**.
3. In Aptik, click **Select** , which opens in the **Filesystem** folder, and click on your new **Backup** folder.
4. Click on **One-click settings** to review your default settings (which you can change if you want). Click OK to close this window.
5. Click on the **Backup** icon to the right of **Installed software**. This will bring up a (long) list of programs that will be backed up by clicking on **Downloaded packages**. You can uncheck any programs you don't want copied to your new installation.
6. It's finally time to use Aptik to copy all your programs and system settings into your new **Backup** folder. Click on the **One-click backup** button. It will take about 10 minutes to copy all your programs, software sources, and settings to your **Backup** folder; when it's finished, you'll see the notification **Backup completed**. Click **Close**.
7. Copy everything in the **Backup** folder to an external USB drive or a cloud storage.
8. Change the name of your backup archive to whatever you want to call your special DistroTweak.
### How to add a DistroTweak to your computer
1. Back up your documents and other files by coping them to an external USB.
2. Use a [live USB][4] containing your favorite Linux distro to reformat your computer and install the operating system. Just plug in the USB live stick, restart your computer, and go through the normal installation process.
3. Remove the live USB stick and install Aptik on your computer by entering the following commands in your terminal:
```
sudo apt-add-repository -y ppa:teejee2008/ppa
sudo apt-get update
sudo apt-get install aptik
```
1. Copy and paste your DistroTweaks folder from your USB or cloud storage to the filesystem folder on your computer with the new distro installed.
2. Point Aptik to your DistroTweaks folder.
3. Enter your admin password, then click on **One-click restore**. Watch as dozens of programs are installed in minutes.
4. Recopy your documents and other files from your USB drive to your computer.
### DistroTweaks limitations
* DistroTweaks has only been tested on Ubuntu-based distributions.
* After installing dozens of programs through DistroTweaks, several may not work correctly (even if they're listed in the menu). If this happens, you will have to uninstall and reinstall them.
* For DistroTweaks to work, the target computer must use the same desktop environment used to create the DistroTweak. For example, a Mint Cinnamon DistroTweak should only be used on a Mint Cinnamon installation.
While DistroTweaks is a new option for existing distributions, it offers even more benefits to people who have wanted to create and share their own custom set of programs but were impeded by the difficulties of starting and maintaining their own distributions. Whether you are a teacher (like me) or a corporate executive of a Fortune 500 company, DistroTweaks makes creating and sharing your own version of Linux a lot easier.
David will be speaking at LinuxFest NW this year. See [program highlights or register][5] to attend.
--------------------------------------------------------------------------------
via: https://opensource.com/article/18/4/distrotweaks
作者:[David Spring][a]
译者:[译者ID](https://github.com/译者ID)
校对:[校对者ID](https://github.com/校对者ID)
选题:[lujun9972](https://github.com/lujun9972)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]:https://opensource.com/users/davidspring
[1]:https://distrotweaks.org/
[2]:https://github.com/teejee2008/aptik
[3]:https://en.wikipedia.org/wiki/Ubuntu_(operating_system)#Package_Archives
[4]:https://en.wikipedia.org/wiki/Live_USB
[5]:https://www.linuxfestnorthwest.org/conferences/lfnw18

View File

@ -0,0 +1,73 @@
3 password managers for the Linux command line
======
![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/password.jpg?itok=ec6z6YgZ)
We all want our passwords to be safe and secure. To do that, many people turn to password management applications like [KeePassX][1] or [Bitwarden][2].
If you spend a lot of time in a terminal window and are looking for a simpler solution, you'll want to check out one of the many password managers for the Linux command line. They're quick, easy to use, and secure.
Let's take a look at three of them.
### Titan
[Titan][3] is a password manager that doubles as a file-encryption tool. I'm not sure how well Titan works at encrypting files; I only looked at it as a password manager. In that capacity, it does a solid job.
![](https://opensource.com/sites/default/files/styles/panopoly_image_original/public/u128651/titan.png?itok=5QoQ1aY7)
Titan stores your passwords in an encrypted [SQLite database][4], which you create and add a master passphrase to when you first fire up the application. Tell Titan to add a password and it asks for a name to identify it, a username, the password itself, a URL, and a comment about the password.
You can get Titan to generate a password for you, and you can search your database by an entry's name or numeric ID, by the name or comment, or using regular expressions. Viewing a specific password, however, can be a bit clunky. You either have to list all passwords and scroll through them to find the one you want to use, or you can view the password by listing the details of an entry using its numeric ID (if you know it).
### Gopass
[Gopass][5] is billed as "the team password manager." Don't let that put you off. It's also great for personal use.
![](https://opensource.com/sites/default/files/styles/panopoly_image_original/public/u128651/gopass.png?itok=1Uodlute)
Gopass is an update of the venerable Unix and Linux [Pass][6] password manager written in the Go programming language. In true Linux fashion, you can either [compile the source code][7] or [use an installer][8] to get gopass on your computer.
Before you start using gopass, make sure you have [GNU Privacy Guard (GPG)][9] and [Git][10] on your system. The former encrypts and decrypts your password store, and the latter signs commits to a [Git repository][11]. If gopass is for personal use, you still need Git. You just don't need to worry about signing commits. If you're interested, you can learn about those dependencies [in the documentation][12].
When you first start gopass, you need to create a password store and generate a [secret key][13] to secure that store. When you want to add a password (which gopass refers to as a secret), gopass asks you for information such as a URL, a username, and a note about the secret. You can have gopass generate the password for the secret you're adding, or you can enter one yourself.
As you need to, you can edit, view, or delete passwords. You can also view a specific password or copy it to your clipboard to paste it into a login form or window.
### Kpcli
The open source password manager of choice for many people is either [KeePass][14] or [KeePassX][15]. [Kpcli][16] brings the features of KeePass and KeePassX to your nearest terminal window.
![](https://opensource.com/sites/default/files/styles/panopoly_image_original/public/u128651/kpcli.png?itok=kMmOHTJz)
Kpcli is a keyboard-driven shell that does most of what its graphical cousins can do. That includes opening a password database; adding and editing passwords and groups (which help you organize your passwords); or even renaming or deleting passwords and groups.
When you need to, you can copy a username and password to your clipboard to paste into a login form. To keep that information safe, kpcli also has a command to clear the clipboard. Not bad for a little terminal app.
Do you have a favorite command-line password manager? Why not share it by leaving a comment?
--------------------------------------------------------------------------------
via: https://opensource.com/article/18/4/3-password-managers-linux-command-line
作者:[Scott Nesbitt][a]
译者:[译者ID](https://github.com/译者ID)
校对:[校对者ID](https://github.com/校对者ID)
选题:[lujun9972](https://github.com/lujun9972)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]:https://opensource.com/users/scottnesbitt
[1]:https://www.keepassx.org/
[2]:https://opensource.com/article/18/3/managing-passwords-bitwarden
[3]:https://www.titanpasswordmanager.org/
[4]:https://en.wikipedia.org/wiki/SQLite
[5]:https://www.justwatch.com/gopass/
[6]:https://www.passwordstore.org/
[7]:https://github.com/justwatchcom/gopass
[8]:https://justwatch.com/gopass/#install
[9]:https://www.gnupg.org
[10]:https://git-scm.com/
[11]:https://git-scm.com/book/en/v2/Git-Basics-Getting-a-Git-Repository
[12]:https://github.com/justwatchcom/gopass/blob/master/docs/setup.md
[13]:http://searchsecurity.techtarget.com/definition/private-key
[14]:https://keepass.info/
[15]:https://www.keepassx.org
[16]:http://kpcli.sourceforge.net/

View File

@ -1,119 +0,0 @@
我的冒险之旅之迁移回 Windows
======
我已经使用 Linux 作为我的主要操作系统大约 10 年了,并且主要使用 Ubuntu。但在最新发布的版本中我决定重新回到我通常不喜欢的操作系统 Windows 10。
![Ubuntu On Windows][1]
我一直是 Linux 的粉丝,我最喜欢的两个发行版是 debian 和 ubuntu。现今作为一个服务器操作系统linux 是完美无暇的,但在桌面上一直存在不同程度的问题。
最近一系列的问题让我意识到,我不需要使用 linux 作为我的桌面操作系统,我仍然是一个粉丝。所以基于我安装 Ubuntu 17.10 的经验,我已经决定回到 windows。
### 什么使我选择了回归
问题是,当 Ubuntu 17.10 出来后,我像往常一样进行全新安装,但遇到了一些非常奇怪的新问题。
* Dell D3100 Dock 不再工作(包括 Work Arounds
* Ubuntu 意外死机(随机)
* 双击桌面上的图标没反应
* 使用 HUD 搜索诸如“调整”之类的程序将尝试安装 META 版本
* GUI 比标准的 GNOME 感觉更糟糕
现在我确实考虑回到使用 Ubuntu 16.04 或另一个发行版本,但是我觉得 Unity 7 是最精致的桌面环境,另外唯一一个优雅且稳定的是 Windows 10。
除此之外,在 Windows 上使用 Linux 也有特定的支持,如:
* 大多数装有商用软件不可用E.G Maya, PhotoShop, Microsoft Office大多数情况下替代品并不相同
* 大多数游戏都没有移植到 Linux 上,包括来自 EA, Rockstar Ect. 等主要工作室的游戏。
* 对于大多数硬件来说,驱动程序是选择 Linux 的第二个考虑因素。‘
在决定使用 Windows 之前,我确实看过其他发行版和操作系统。
与此同时,我看到更多的是“微软热爱 Linux ”的活动,并且了解了 WSL。他们新开发者的聚焦角度对我来说很有意思于是我试了一下。
### 我在 Windows 找到了什么
我使用计算机主要是为了编程我也使用虚拟机git 和 ssh并且大部分工作依赖于 bash。我偶尔也会玩游戏观看 netflix 和一些轻松的办公室工作。
总之,我期待在 Ubuntu 中保留当前的工作流程并将其移植到 Windows 上。我也想利用 Windows 的优点。
* 所有 PC 游戏支持 Windows
* 大多数程序受本地支持
* 微软办公软件
现在,使用 Windows 有很多警告,但是我打算正确对待它,所以我不担心一般的 windows 故障,例如病毒和恶意软件。
### Windows 的子系统 LinuxWindows 上存在 Ubuntu 的 Bash
微软与 Canonical 密切合作将 Ubuntu 带到了 Windows 上。在快速设置和启动程序之后,你将拥有非常熟悉的 bash 界面。
现在我一直在研究这个问题的局限性但是在写这篇文章时我碰到的唯一真正的限制是它从硬件中抽象了出来。例如lsblk 不会显示你有什么分区,因为子系统 Ubuntu 没有提供这些信息。
但是除了访问底层工具之外,我发现这种体验非常熟悉,也很棒。
我在下面的工作流程中使用了它。
* 生成 SSH 密钥对
* 使用 Git 和 Github 来管理我的仓库
* SSH 到几个服务器,包括没有密码的
* 为本地数据库运行 MySQL
* 监视系统资源
* 使用 VIM 配置文件
* 运行 Bash 脚本
* 运行本地 Web 服务器
* 运行 PHP, NodeJS
到目前为止,它已经被证明是非常强大的工具,除了在 Windows 10 UI 中。我的工作流程感觉和我在 Ubuntu 上几乎一样。尽管我的多数工作可以在 WSL 中处理,但我仍然打算让虚拟机进行更深入的工作,这可能超出了 WSL 的范围。
### 没有 Wine
我遇到的另一个主要问题是兼容性问题。现在,我很少使用 WINE译注 wine 是可以使 Linux 上运行 Windows 下的软件)来使用 Windows 软件。尽管通常不是很好,但是有时它是必需的。
### HeidiSQL
我安装的第一个程序之一是 HeidiSQL它是我最喜欢的数据库客户端之一。它在 wine 下工作,但是感觉很可怕,所以我放弃了 MySQL Workbench。让它回到 Windows 中,就像回来了一个可靠的老朋友。
### 游戏平台 / Steam
没有游戏的 Windows 电脑无法想象。我从 steam 的网站上安装了它,并且使用我的 Linux 目录,以及我的 Windows 目录,这个目录是 Linux 目录的 5 倍大,并且包括 GTA V (译注: GTA V 是一款名叫侠盗飞车的游戏) 等 AAA 级配置。这些是我只能在 Ubuntu 中梦想的东西。
现在,我对 SteamOS 有很大的期望,并且一直会持续如此。但是我认为在不久的将来它不会在任何地方的游戏市场中崭露头角。所以如果你想在 PC 上玩游戏,你确实需要 Windows。
还有一点需要注意的是, ny nvidia 显卡的驱动程序有很好的支持,这使得像 TF2 (译注: 这是一款名叫军团要塞2的游戏) 这样的一些 Linux 本机游戏运行的稍好一些。
** Windows 在游戏方面总是优越的,所以这并不令人感到意外。**
### 从 USB 硬盘运行,为什么
我在我的主要 sss 驱动器上运行 Linux但在过去我从 usb 密钥和 usb 硬盘运行(译注:这句话不知道怎么翻译,希望校正者注意。)。我习惯了 Linux 的这种持久性,这让我可以在不丢失主要操作系统的情况下长期尝试多个版本。现在我尝试将 Windows 安装到 USB 连接的硬盘上时,它无法工作并且是无法实现的。所以当我将 Windows HDD 的克隆作为备份时,我很惊讶我可以通过 USB 启动它。
这对我来说已经成为一个方便的选择,因为我打算将我的工作笔记本电脑迁移回 Windows但如果不想冒险那就把它扔在那里吧。
所以我在过去的几天里,我使用 USB 来运行它,除了一些错误的消息外,我没有通过 USB 运行发现它真正的缺点。
这样做的显著问题是:
* 较慢的启动速度
* 恼人的信息:不要拔掉你的 USB
* 无法激活它
**我可能会写一篇关于 USB 驱动器上的 Windows 的文章,这样我们可以有更详细的了解。**
### 那么结论是什么?
我使用 Windows 10 大约两周了,并没有注意到它对我的工作流程有任何的负面影响。尽管过程会有一些小问题,但我需要的所以工具都在手边,并且操作系统一般都在运行。
## 我会留在 Windows吗
虽然现在还为时尚早,但我想在可见的未来我会坚持使用 Windows。
--------------------------------------------------------------------------------
via: [https://www.chris-shaw.com/blog/my-adventure-migrating-back-to-windows](https://www.chris-shaw.com/blog/my-adventure-migrating-back-to-windows)
作者:[Christopher Shaw][a]
译者:[译者ID](https://github.com/译者ID)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]:https://www.chris-shaw.com
[1]:https://winaero.com/blog/wp-content/uploads/2016/07/Ubutntu-on-Windows-10-logo-banner.jpg

View File

@ -0,0 +1,133 @@
通过扫描二维码将文件从计算机传输到移动设备
======
![](https://www.ostechnix.com/wp-content/uploads/2018/03/qr-filetransfer-720x340.png)
将文件从计算机传输到智能手机并不是什么大问题。你可以使用 USB 线将手机挂载到系统上,然后从文件管理器传输文件。此外,某些第三方应用程序(例如 [**KDE Connect**][1] 和 [**AirDroid**] [2])可帮助你轻松管理和传输系统中的文件至 Android 设备。今天,我偶然发现了一个名为 **“Qr-filetransfer”** 的超酷工具。它允许你通过扫描二维码通过 WiFi 将文件从计算机传输到移动设备而无须离开终端。是的,你没有看错! qr-filetransfer 是一个使用 Go 语言编写的免费的开源命令行工具。在这个简短的教程中,我们将学习如何使用 qr-transfer 将文件从 Linux 传输到任何移动设备。
### 安装 Qr-filetransfer
首先,在你的系统上安装 Go 语言。
在 Arch Linux 及其衍生版上:
```
$ sudo pacman -S go
```
在基于 RPM 的系统(如 RHEL、CentOS、Fedora上运行
```
$ sudo yum install golang
```
或者:
```
$ sudo dnf install golang
```
在基于 DEB 的系统上,例如 Debian、Ubuntu、Linux Mint你可以使用命令安装它
```
$ sudo apt-get install golang
```
在 SUSE/openSUSE 上:
```
$ sudo zypper install golang
```
安装 Go 语言后,运行以下命令下载 qr-filetransfer 应用。
```
$ go get github.com/claudiodangelis/qr-filetransfer
```
上述命令将在当前工作目录下的一个名为 **“go”** 的目录中下载 qr-filetrnasfer GitHub 仓库的内容。
将 qt-filetransfer 的二进制文件复制到 PATH 中,例如 /usr/local/bin/。
```
$ sudo cp go/bin/qr-filetransfer /usr/local/bin/
```
最后,如下使其可执行:
```
$ sudo chmod +x /usr/local/bin/qr-filetransfer
```
### 通过扫描二维码将文件从计算机传输到移动设备
确保你的智能手机已连接到与计算机相同的 WiFi 网络。
然后,使用要传输的文件的完整路径启动 qt-filetransfer。
比如,我要传输一个 mp3 文件。
```
$ qr-filetransfer Chill\ Study\ Beats.mp3
```
首次启动时qr-filetransfer 会要求你选择使用的网络接口,如下所示。
```
Choose the network interface to use (type the number):
[0] enp5s0
[1] wlp9s0
```
我打算使用 **wlp9s0** 接口传输文件,因此我输入 “1”。qr-filetransfer 会记住这个选择,除非你通过 **-force** 参数或删除程序存储在当前用户的家目录中的 **.qr-filetransfer.json** 文件,否则永远不会再提示你。
然后,你将看到二维码,如下图所示。
![][4]
打开二维码应用(如果它尚未安装,请从 Play 商店安装任何一个二维码读取程序)并扫描终端中显示的二维码。
读取二维码后,系统会询问你是要复制链接还是打开链接。你可以复制链接并手动将其粘贴到移动网络浏览器上,或者选择“打开链接”以在移动浏览器中自动打开它。
![][5]
共享链接打开后,该文件将下载到智能手机中。
![][6]
如果文件太大,请压缩文件,然后传输它
```
$ qr-filetransfer -zip /path/to/file.txt
```
要传输整个目录,请运行:
```
$ qr-filetransfer /path/to/directory
```
请注意,目录在传输之前会被压缩。
qr-filetransfer 只能将系统中的内容传输到移动设备,反之不能。这个项目非常新,所以会有 bug。如果你遇到了任何 bug请在本指南最后给出的 GitHub 页面上报告。
干杯!
--------------------------------------------------------------------------------
via: https://www.ostechnix.com/transfer-files-from-computer-to-mobile-devices-by-scanning-qr-codes/
作者:[SK][a]
译者:[geekpi](https://github.com/geekpi)
校对:[校对者ID](https://github.com/校对者ID)
选题:[lujun9972](https://github.com/lujun9972)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]:https://www.ostechnix.com/author/sk/
[1]:https://www.ostechnix.com/kde-connect-access-files-notifications-android-devices/
[2]:https://www.ostechnix.com/airdroid-share-files-and-folders-between-linux-and-android/
[4]:http://www.ostechnix.com/wp-content/uploads/2018/03/qr-filetransfer-5.png
[5]:http://www.ostechnix.com/wp-content/uploads/2018/03/qr-filetransfer-6-4.png
[6]:http://www.ostechnix.com/wp-content/uploads/2018/03/qr-filetransfer-4.png

View File

@ -0,0 +1,104 @@
使用树莓派构建一个婴儿监视器
======
![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/baby-chick-egg.png?itok=RcFfqdbA)
香港很湿热,即便是晚上,许多人为了更舒适,在家里也使用空调。当我的大儿子还是一个小婴儿的时候,他卧室的空调还是需要手动控制的,没有温度自动调节的功能。它的控制器只有开或者关,让空调整个晚上持续运行会导致房间过冷,并且也浪费能源和钱。
我决定使用一个基于 [树莓派][2] 的 [物联网][1] 解决方案去修复这个问题。后来我进一步为它添加了一个[婴儿监视器][3]插件。在这篇文章中,我将解释我是如何做的,它的代码在 [我的 GitHub][4] 页面上。
### 设计空调控制器
解决我的问题的第一个部分是使用了一个 Orvibo S20 [可通过 WiFi 连接的智能插头][5]和智能手机应用程序。虽然这样可以让我通过远程来控制空调,但是它还是手动处理的,而我希望尝试让它自动化。我在 [Instructables][6] 上找到了一个满足我的需求的项目:他使用树莓派从一个 [AM2302 传感器][7] 上测量附近的温度和湿度,并将它们记录到一个 MySQL 数据库中。
使用圧接头将温度/湿度传感器连接到树莓派的相应 GPIO 针脚上。幸运的是AM2302 传感器有一个用于读取的 [开源软件][8],并且同时提供了 [Python][9] 示例。
与我的项目放在一起的用于 [AM2302 传感器][10] 接口的软件已经更新了,并且我使用的原始代码现在已经被认为是过时的而停止维护了。这个代码是由一个小的二进制组成,用于连接到传感器以及解释阅读和返回正确值的 Python 脚本。
![Raspberry Pi, sensor, and Python code][12]
树莓派、传感器、以及用于构建温度/湿度监视器的 Python 代码。
将传感器连接到树莓派,这些 Python 代码能够正确地返回温度和湿度读数。将 Python 连接到 MySQL 数据库很简单,并且也有大量的使用 `python-``mysql` 绑定的代码示例。因为我需要持续地监视温度和湿度,所以我写软件来实现这些。
事实上,最终我用了两个解决方案,一是作为一个持续运行的进程,周期性(一般是间隔一分钟)地获取传感器数据,另一种是让 Python 脚本运行一次然后退出。我决定使用第二种方法,并使用 cron 去每分钟调用一次这个脚本。之所以选择这种方法的主要原因是,(通过循环实现的)持续的脚本偶尔会不返回读数,这将导致尝试读取传感器的进程出现聚集,最终可能会导致系统挂起而缺乏可用资源。
我也找到了可以用程序来控制我的智能插头的一个 [Perl 脚本][13]。它是解决这种问题所需的一部分,因此当某些温度/湿度达到触发条件,将触发这个 Perl 脚本。在做了一些测试之后,我决定去设计一个独立的 `checking` 脚本,从 MySQL 去拉取最新的数据,然后根据返回的值去设置智能开关为开或关。将插头控制逻辑与传感器读取脚本分开,意味着它们是各自独立运行的,就算是传感器读取脚本写的有问题也没事。
配置一个打开/关闭空调的温度值是很有意义的,因此,我将这些值转移到控制脚本读取的配置文件中。我也发现,虽然传感器的值一般都很准确,但是,偶尔也会出现返回不正确读数的情况。这个传感器脚本被修改为不向 MySQL 数据库中写入与前值差异非常大的值。同样也在配置文件中写入了连续读取的温度/湿度之间允许的最大差异值,如果读取的值处于这些限制值以外,这些值写不会提交到数据库中。
虽然,做这个自动调节器似乎花费了很多努力,但是,这意味着,记录到 MySQL 数据库的数据是有效的、可用于进一步去分析识别用户使用模式的有用数据。可以用多种图形方式去展示来自 MySQL 数据库中的数据,而我决定使用 [Google Chart][14] 在一个 Web 页面上显示数据。
![Temperature and humidity chart][16]
过去六小时内测量到的温度和湿度
### 添加一个婴儿监视摄像头
树莓派开放的性能意味着我可以不断地为它增加功能 —— 并且我有大量的未使用的可用 GPIO 针脚。我的下一个创意是去添加一个摄像头模块,将它放在孩子的卧室中,配置它去监视婴儿。
我需要一个能够在黑暗环境中工作的摄像头,而 [Pi Noir][17] 摄像头模块是非常适合这种条件的。Pi Noir 除了没有红外过滤之外,同样也是树莓派常用的摄像头模块。这意味着它在白天时的图像可能有点偏紫色,但是它可以在黑暗中借助红外灯来显示图像。
现在我需要一个红外光源。由于树莓派非常流行,并且进入门槛很低,因此它有大量的外围配件和插件。也有适合它的各种红外光源,我注意到的其中一个是 [Bright Pi][18]。它可以从树莓派上供电,并且它很适合为树莓派的摄像头模块提供红外光和普通光。它唯一的缺点是太考验我的焊接技能了。
我的焊接技能还是不错的,但是可能花费的时间比其他人更长。我成功地连接了外壳上所有的红外 LEDs并将它们连接到树莓派的 GPIO 针脚上。这意味着树莓派能够编程控制红外 LED 是否点亮,以及它的亮度。
通过一个 Web 流去公开捕获的视频也很有意义,因为这样我就可以从 Web 页面上查看温度和湿度的读数图表。进一步研究之后,我选择了一个使用 M-JPEG 捕获器的 [流软件][19]。通过 Web 页面公开 JPG 源,我可以在我的智能手机上去连接摄像头查看程序,去查看摄像头的输出。
### 做最后的修饰
没有哪个树莓派项目都已经完成了还没有为它选择一个合适的外壳,并且它有各种零件。在大量搜索和比较之后,有了一个明确的 [赢家][20]SmartPi 的乐高积木式外壳。乐高的兼容性可以让我去安装温度/湿度传感器和摄像头。下面是最终的成果图:
![](https://opensource.com/sites/default/files/styles/panopoly_image_original/public/u128651/pibabymonitor_case.png?itok=_ofyN73a)
在这以后,我对我的这个作品作了一些改变和更新:
* 我将它从树莓派 2 Model B 升级到了 [树莓派 3][21],这意味着我可以使用 USB WiFi 模块。
* 我用一个 [TP-Link HS110][22] 智能插头替换了 Orvibo S20。
* 我也将树莓派插到了一个智能插头上,这样我就可以远程重启/重置它了。
* 我从树莓派上将 MySQL 数据库移走了,它现在运行在一个 NAS 设备上的容器中。
* 我增加了一个非常 [灵活的三角夹][23],这样我就可以调整到最佳角度。
* 我重新编译了 USB WiFi 模块,禁用了板载 LED 指示灯,这就是升级到树莓派 3 的其中一个好处。
* 我因此为我的第二个孩子设计了另外一个监视器。
* 因为没有时间去折腾,我为我的第三个孩子购买了夜用摄像头。
想学习更多的东西吗?所有的代码都在 [我的 GitHub][4] 页面上。
想分享你的树莓派项目吗?[将你的故事和创意发送给我们][24]。
--------------------------------------------------------------------------------
via: https://opensource.com/article/18/3/build-baby-monitor-raspberry-pi
作者:[Jonathan Ervine][a]
译者:[qhwdw](https://github.com/qhwdw)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]:https://opensource.com/users/jervine
[1]:https://opensource.com/tags/internet-things
[2]:https://opensource.com/tags/raspberry-pi
[3]:https://opensource.com/article/17/9/gonimo
[4]:https://github.com/jervine/rpi-temp-humid-monitor
[5]:https://www.amazon.co.uk/marsboy-S20-Automation-Control-Smartphone/dp/B01LXKPUDK/ref=sr_1_1/258-6082934-2585109?ie=UTF8&amp;qid=1520578769&amp;sr=8-1&amp;keywords=orvibo+s20
[6]:http://www.instructables.com/id/Raspberry-Pi-Temperature-Humidity-Network-Monitor/
[7]:https://www.adafruit.com/product/393
[8]:https://github.com/adafruit/Adafruit_Python_DHT
[9]:https://opensource.com/tags/python
[10]:https://github.com/adafruit/Adafruit-Raspberry-Pi-Python-Code/tree/legacy/Adafruit_DHT_Driver_Python
[11]:/file/390916
[12]:https://opensource.com/sites/default/files/styles/panopoly_image_original/public/u128651/pibabymonitor_materials.png?itok=2w03CdKM "Raspberry Pi, sensor, and Python code"
[13]:https://github.com/franc-carter/bauhn-wifi
[14]:https://developers.google.com/chart/
[15]:/file/390876
[16]:https://opensource.com/sites/default/files/styles/panopoly_image_original/public/u128651/pibabymonitor_temp-humidity.png?itok=2jqtQU0x "Temperature and humidity chart"
[17]:https://www.raspberrypi.org/products/pi-noir-camera-v2/
[18]:https://www.pi-supply.com/product/bright-pi-bright-white-ir-camera-light-raspberry-pi/
[19]:https://elinux.org/RPi-Cam-Web-Interface
[20]:https://smarticase.com/collections/all/products/smartipi-kit-3
[21]:https://opensource.com/article/18/3/raspberry-pi-3b-model-news
[22]:https://www.tp-link.com/uk/products/details/cat-5258_HS110.html
[23]:https://www.amazon.com/Flexpod-Flexible-Tripod-Discontinued-Manufacturer/dp/B000JC8WYA
[24]:http://opensource.com/story

View File

@ -1,73 +0,0 @@
Opensource.com: 高级 SSH 用法表
===========================
所有人都知道 SSH 是一种远程登录工具,然而它也有许多其他用途。
```
创建一个 SOCKS 代理来浏览网页(也就是翻墙啦):
ssh -D <port> <remote_host>
设置 localhost:<port> 作为你浏览器的代理
连接一个躲在防御服务器背后的 Windows RDP 主机:
ssh -L <port>:<target_host>:3389 <bastion_server>
让你的 RDP 客户端连接到 localhost:<port>
在不使用 VNC 端口的情况下,连接远程 VNC 主机:
ssh -L 5901:localhost:5901 <remote_host>
让你的 VNC 客户端连接到 localhost:5901
按照这个思路,你可以映射任意端口: LDAP (389), 631 (CUPS), 8080 (alternate HTTP),等等。
产生一个新的 SSH 密钥对:
ssh-keygen
更新密钥对的密码:
ssh-keygen -p
把公钥复制到远程主机上:
ssh-copy-id -i <identity file> <remote_host>
SSH 有一堆命令行选项,但是如果有一些是你经常使用的,你可以为他们在 SSH 配置文件 (${HOME}/.ssh/config) 里创建一个入口。比如:
host myhouse
User itsme
   HostName house.example.com
那么你就可以输入 'ssh myhouse' 来代替 'ssh itsme@house.example.com'.
```
以下是常用的命令行选项和他们的配置文件写法。一些是常用的简化写法。请查看 ssh(1) 和 ssh_config(5) 的手册页来获取详尽信息。
|命令行|配置文件|描述
|:--|:--|:--|
|-l \<login name\>| User \<login name\>|远程主机的登录用户名。|
|-i \<identity file\> |IdentityFile \<identity file\> |指定要使用的鉴权文件SSH 密码对)。 |
|-p \<remote port\>| Port \<remote port\>|远程 SSH 守护进程监听的端口号。 (默认为 22) |
|-C|Compression \<yes\|no\>|压缩往来信息。 (默认为 no) |
|-D \<port\>|DynamicForward \<port\>|把本地端口的报文转发到远程主机。 |
|-X|ForwardX11 \<yes\|no\>|把 X11 的图像数据转发到远程主机的端口. (默认为 no) |
|-A|ForwardAgent \<yes\|no\>|把授权代理的报文转发给远程主机。如果你使用第三方主机登录,这个功能将很有用。 (默认为 no) |
|-4 (use IPv4 only) -6 (use IPv6 only)|AddressFamily \<any\|inet4\|inet6\> |指定仅使用 IPv4 或者 IPv6. |
|-L \<local port\>:\<target host\>:\<target port\> |LocalForward \<local port\>:\<target host\>:\<target port\> |把本地主机指定端口的报文转发到远程主机的某个端口。|
opensource.com
Twitter @opensourceway | facebook.com/opensourceway | IRC: #opensource.com on Freenode
--------------------------------------------------------------------------------
作者简介:
Ben Cotton是业余的气象学家和职业的高性能计算工程师。Ben 是微软 Azure 的产品营销经理,专注于高性能计算。他是一个 Fedora 用户和贡献者,共同创立了一个当地的开放源码群,并且是开源促进会的成员和保护自由软件的支持者。通过以下方式联系他 Twitter (@FunnelFiasco) 或者 FunnelFiasco.com.
-------------
via: https://opensource.com/sites/default/files/gated-content/cheat_sheet_ssh_v03.pdf
作者:[ BEN COTTON ][a]
译者:[kennethXia](https://github.com/kennethXia)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]:https://opensource.com/users/bcotton
[1]:https://web.kamihq.com/web/upgrade.html