Merge pull request #2 from LCTT/master

pull
This commit is contained in:
BrunoJu 2020-01-08 11:56:48 +08:00 committed by GitHub
commit c8e5ca6bca
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
43 changed files with 2846 additions and 1588 deletions

View File

@ -0,0 +1,127 @@
[#]: collector: (lujun9972)
[#]: translator: (MjSeven)
[#]: reviewer: (wxy)
[#]: publisher: (wxy)
[#]: url: (https://linux.cn/article-11752-1.html)
[#]: subject: (An advanced look at Python interfaces using zope.interface)
[#]: via: (https://opensource.com/article/19/9/zopeinterface-python-package)
[#]: author: (Moshe Zadka https://opensource.com/users/moshezhttps://opensource.com/users/lauren-pritchetthttps://opensource.com/users/sethhttps://opensource.com/users/drmjg)
借助 zope.interface 深入了解 Python 接口
======
> Zope.interface 可以帮助声明存在哪些接口,是由哪些对象提供的,以及如何查询这些信息。
![Snake charmer cartoon with a yellow snake and a blue snake][1]
`zope.interface` 库可以克服 Python 接口设计中的歧义性。让我们来研究一下。
### 隐式接口不是 Python 之禅
[Python 之禅][2] 很宽松,但是有点自相矛盾,以至于你可以用它来例证任何东西。让我们来思考其中最著名的原则之一:“显示胜于隐式”。
传统上,在 Python 中会隐含的一件事是预期的接口。比如函数已经记录了它期望一个“类文件对象”或“序列”。但是什么是类文件对象呢?它支持 `.writelines`吗?`.seek` 呢?什么是一个“序列”?是否支持步进切片,例如 `a[1:10:2]`
最初Python 的答案是所谓的“鸭子类型”,取自短语“如果它像鸭子一样行走,像鸭子一样嘎嘎叫,那么它可能就是鸭子”。换句话说,“试试看”,这可能是你能得到的最具隐式的表达。
为了使这些内容显式地表达出来,你需要一种方法来表达期望的接口。[Zope][3] Web 框架是最早用 Python 编写的大型系统之一,它迫切需要这些东西来使代码明确呈现出来,例如,期望从“类似用户的对象”获得什么。
`zope.interface` 由 Zope 开发,但作为单独的 Python 包发布。`Zope.interface` 可以帮助声明存在哪些接口,是由哪些对象提供的,以及如何查询这些信息。
想象编写一个简单的 2D 游戏它需要各种东西来支持精灵界面LCTT 译注:“<ruby>精灵<rt> Sprite</rt></ruby>”是指游戏面板中各个组件)。例如,表示一个边界框,但也要表示对象何时与一个框相交。与一些其他语言不同,在 Python 中,将属性访问作为公共接口一部分是一种常见的做法,而不是实现 getter 和 setter。边界框应该是一个属性而不是一个方法。
呈现精灵列表的方法可能类似于:
```
def render_sprites(render_surface, sprites):
    """
    sprites 应该是符合 Sprite 接口的对象列表:
    * 一个名为 "bounding_box" 的属性,包含了边界框
    * 一个名为 "intersects" 的方法,它接受一个边界框并返回 True 或 False
    """
    pass # 一些做实际渲染的代码
```
该游戏将具有许多处理精灵的函数。在每个函数中,你都必须在随附文档中指定预期。
此外,某些函数可能期望使用更复杂的精灵对象,例如具有 Z 序的对象。我们必须跟踪哪些方法需要 Sprite 对象,哪些方法需要 SpriteWithZ 对象。
如果能够使精灵是显式而直观的,这样方法就可以声明“我需要一个精灵”,并有个严格定义的接口,这不是很好吗?来看看 `zope.interface`
```
from zope import interface
class ISprite(interface.Interface):
    bounding_box = interface.Attribute(
        "边界框"
    )
    def intersects(box):
        "它和一个框相交吗?"
```
乍看起来,这段代码有点奇怪。这些方法不包括 `self`,而包含 `self` 是一种常见的做法,并且它有一个**属性**。这是在 `zope.interface` 中声明接口的方法。这看起来很奇怪,因为大多数人不习惯严格声明接口。
这样做的原因是接口显示了如何调用方法,而不是如何定义方法。因为接口不是超类,所以它们可以用来声明数据属性。
下面是一个能带有圆形精灵的接口的一个实现:
```
@implementer(ISprite)
@attr.s(auto_attribs=True)
class CircleSprite:
    x: float
    y: float
    radius: float
    @property
    def bounding_box(self):
        return (
            self.x - self.radius,
            self.y - self.radius,
            self.x + self.radius,
            self.y + self.radius,
        )
    def intersects(self, box):
        # 当且仅当至少一个角在圆内时,方框与圆相交
        top_left, bottom_right = box[:2], box[2:]
        for choose_x_from (top_left, bottom_right):
            for choose_y_from (top_left, bottom_right):
                x = choose_x_from[0]
                y = choose_y_from[1]
                if (((x - self.x) ` 2 + (y - self.y) ` 2) &lt;=
                    self.radius ` 2):
                     return True
        return False
```
这**显式**声明了实现了该接口的 `CircleSprite` 类。它甚至能让我们验证该类是否正确实现了接口:
```
from zope.interface import verify
def test_implementation():
    sprite = CircleSprite(x=0, y=0, radius=1)
    verify.verifyObject(ISprite, sprite)
```
这可以由 pytest、nose 或其他测试框架运行,它将验证创建的精灵是否符合接口。测试通常是局部的:它不会测试仅在文档中提及的内容,甚至不会测试方法是否可以在没有异常的情况下被调用!但是,它会检查是否存在正确的方法和属性。这是对单元测试套件一个很好的补充,至少可以防止简单的拼写错误通过测试。
--------------------------------------------------------------------------------
via: https://opensource.com/article/19/9/zopeinterface-python-package
作者:[Moshe Zadka][a]
选题:[lujun9972][b]
译者:[MjSeven](https://github.com/MjSeven)
校对:[wxy](https://github.com/wxy)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://opensource.com/users/moshezhttps://opensource.com/users/lauren-pritchetthttps://opensource.com/users/sethhttps://opensource.com/users/drmjg
[b]: https://github.com/lujun9972
[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/getting_started_with_python.png?itok=MFEKm3gl (Snake charmer cartoon with a yellow snake and a blue snake)
[2]: https://en.wikipedia.org/wiki/Zen_of_Python
[3]: http://zope.org

View File

@ -1,16 +1,18 @@
[#]: collector: (lujun9972)
[#]: translator: (lxbwolf)
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )
[#]: reviewer: (wxy)
[#]: publisher: (wxy)
[#]: url: (https://linux.cn/article-11756-1.html)
[#]: subject: (Intro to the Linux useradd command)
[#]: via: (https://opensource.com/article/19/10/linux-useradd-command)
[#]: author: (Alan Formy-Duval https://opensource.com/users/alanfdoss)
Linux useradd 命令介绍
======
使用 useradd 命令来添加用户(并且根据需要修改账号)。
![people in different locations who are part of the same team][1]
> 使用 useradd 命令来添加用户(并且根据需要修改账号)。
![](https://img.linux.net.cn/data/attachment/album/202001/06/225733hv1u7f4z4vbt8u5x.jpg)
任何计算机系统中,添加用户都是最重要的事之一;本文着重介绍如何在 Linux 系统中添加用户。
@ -29,21 +31,21 @@ $ file `which adduser`
### 默认处理
`useradd` 的基本用法相当简单:通过一个用户名就可以添加一个用户
`useradd` 的基本用法相当简单:提供一个用户名就可以添加一个用户。
```bash
$ sudo useradd sonny
```
在本例中,`useradd` 命令创建了一个名为 *sonny* 的账号。此命令同时创建了一个同名的组,*sonny* 被放进了这个组,这个组也是 *sonny* 账号的主组。命令执行时,根据配置文件 `/etc/default/useradd``/etc/login.defs` 中的不同设置,也会有其他的参数处理,如语言和 shell。对于一个私人系统或微小的单服务商业环境这些参数已经足够了。
在本例中,`useradd` 命令创建了一个名为 `sonny` 的账号。此命令同时创建了一个同名的组,`sonny` 被放进了这个组,这个组也是 `sonny` 账号的主组。命令执行时,根据配置文件 `/etc/default/useradd``/etc/login.defs` 中的不同设置,也会有其他的参数,如语言和 shell。对于一个私人系统或微小的单服务商业环境这些参数已经足够了。
上面两个文件控制 `useradd` 的处理,用户的信息保存在 `/etc` 目录下的一些其他文件中,关于这些信息的讲解会贯穿全文。
| 文件 | 描述 | 域 (加粗的表示由 useradd 命令设置) |
| ------ | ------------------------------------ | ------------------------------------------------------------ |
| passwd | Stores user account details | **username**:unused:**uid**:**gid**:**comment**:**homedir**:**shell** |
| shadow | Stores user account security details | **username**:password:lastchange:minimum:maximum:warn:**inactive**:**expire**:unused |
| group | Stores group details | **groupname**:unused:**gid**:**members** |
| `passwd` | 存储用户账号信息 | **用户名**:未使用:**UID**:**GID**:**备注**:**家目录**:**shell** |
| `shadow` | 存储用户账号的安全信息 | **用户名**:加密密码:上次修改时间:最短使用天数:最长使用天数间:**修改前警示天数**:**过期后宽限时间**:未使用 |
| `group` | 存储组信息 | **组名**:未使用:**GID**:**成员列表** |
### 自定义处理
@ -51,35 +53,35 @@ $ sudo useradd sonny
#### 用户和组 ID
`useradd` 默认主组 IDGID与用户 IDUID相同,但也不完全是。虽然 UID 与 GID 相同不是必须的,但如果相同,会更方便管理员管理。
默认情况下,`useradd` 试图使用相同的用户 IDUID和主组 IDGID,但也不完全是。虽然 UID 与 GID 相同不是必须的,但如果相同,会更方便管理员管理。
下面的场景就是一个 GID 与 UID 不同的 例子。现在我添加另一账号,名为 Timmy。通过使用 `getent` 命令来比较 *sonny**timmy* 两个账号,显示两个用户和对应的主组。
下面的场景就是一个 GID 与 UID 不同的例子。现在我添加另一账号,名为 Timmy。通过使用 `getent` 命令来比较 `sonny``timmy` 两个账号,显示两个用户和对应的主组。
```bash
$ getent passwd sonny timmy
sonny1001:1002:Sonny:/home/sonny:/bin/bash
timmy1002:1003::/home/timmy:/bin/bash
sonny:x:1001:1002:Sonny:/home/sonny:/bin/bash
timmy:x:1002:1003::/home/timmy:/bin/bash
$ getent group sonny timmy
sonny1002:
timmy1003:
sonny:x:1002:
timmy:x:1003:
```
不幸的是,两者的 UID 和 GID 都不相同。因为默认的处理是,创建用户时,把下一个可用的 UID 赋给用户,然后把同一个数字作为主组 ID 赋给它。然而,当要使用的 ID 已经被使用时,就再把下一个可用的 GID 赋给它。为了弄清细节,我猜想 1001 这个 GID 已经被使用了,用一个命令确认了一下。
不幸的是,两者的 UID 和 GID 都不相同。因为默认的处理是,创建用户时,把下一个可用的 UID 赋给用户,然后把同一个数字作为主组 ID 赋给它。然而,当要使用的 ID 已经被使用时,就再把下一个可用的 GID 赋给它。为了弄清细节,我猜想 1001 这个 GID 已经被使用了,用一个命令确认了一下。
```bash
$ getent group 1001
book1001:alan
book:x:1001:alan
```
*book* 的 ID 是 *1001*,因此新创建的用户的 GID 都有偏移量 1。这就是为什么系统管理员在用户创建过程中需要多设置一些值的一个实例。为了解决这个问题我必须先确定下一个可用的 UID 和 GID 是否相同。确定下一个可用值时,可以使用 `getent group``getent passwd` 命令,通过 `-u` 参数传递要确认的值。
`book` 的 ID 是 `1001`,因此新创建的用户的 GID 都有偏移量 1。这就是为什么系统管理员在用户创建过程中需要多设置一些值的一个实例。为了解决这个问题我必须先确定下一个可用的 UID 和 GID 是否相同。确定下一个可用值时,可以使用 `getent group``getent passwd` 命令,通过 `-u` 参数传递要确认的值。
```bash
$ sudo useradd -u 1004 bobby
$ getent passwd bobby; getent group bobby
bobby1004:1004::/home/bobby:/bin/bash
bobby1004:
bobby:x:1004:1004::/home/bobby:/bin/bash
bobby:x:1004:
```
另一个需要指定 ID 的场景是,通过 NFS 访问远程系统上的文件时。对于一个给定的用户,当 NFS 所有客户端和服务系统的 ID 都一样时,管理员更容易控制。在我的文章 [使用 autofs 挂载 NFS][2] 中有详细介绍。
@ -95,12 +97,12 @@ bobby❌1004:
```bash
$ sudo useradd -c "Bailey is cool" bailey
$ getent passwd bailey
bailey1011:1011:Bailey is cool:/home/bailey:/bin/bash
bailey:x:1011:1011:Bailey is cool:/home/bailey:/bin/bash
```
#### 组
一个用户可以被指定一个主组和多个次组。 `-g` 参数指定主组名称或 GID。如果不指定`useradd` 会以用户名创建一个主组(前面演示过)。`-G`(大写)参数用一个逗号分隔的组列表来指定此用户所属的组,这些组就是次组。
一个用户可以被指定一个主组和多个次组。`-g` 参数指定主组名称或 GID。如果不指定`useradd` 会以用户名创建一个主组(前面演示过)。`-G`(大写)参数用一个逗号分隔的组列表来指定此用户所属的组,这些组就是次组。
```bash
$ sudo useradd -G tgroup,fgroup,libvirt milly
@ -110,12 +112,12 @@ uid=1012(milly) gid=1012(milly) groups=1012(milly),981(libvirt),4000(fgroup),300
#### 家目录
`useradd` 的默认处理是,在 `/home` 目录下创建用户的家目录。然而,下面的参数可以改写家目录的 base 目录。`-b` 设置另一个可以创建家目录的 base 目录。例如 指定 `/home2` 而不是 `/home`
`useradd` 的默认处理是,在 `/home` 目录下创建用户的家目录。然而,下面的参数可以改写家目录的基础目录。`-b` 设置另一个可以创建家目录的基础目录。例如指定 `/home2` 而不是 `/home`
```bash
$ sudo useradd -b /home2 vicky
$ getent passwd vicky
vicky1013:1013::/home2/vicky:/bin/bash
vicky:x:1013:1013::/home2/vicky:/bin/bash
```
`-d` 参数可以指定一个与用户名不同的家目录。
@ -123,24 +125,23 @@ vicky❌1013:1013::/home2/vicky:/bin/bash
```bash
$ sudo useradd -d /home/ben jerry
$ getent passwd jerry
jerry1014:1014::/home/ben:/bin/bash
jerry:x:1014:1014::/home/ben:/bin/bash
```
#### skeleton 目录
#### 目录模板
`-k` 参数指定创建新用户时,会复制 `/etc/skel` 目录下的所有文件到家目录中。这些文件通常是 shell 配置文件,当然也可以是系统管理员想在新建用户时使用的任何文件。
指定 `-k` 参数会在创建新用户时,复制 `/etc/skel` 目录下的所有文件到用户的家目录中。这些文件通常是 shell 配置文件,当然也可以是系统管理员想在新建用户时使用的任何文件。
#### Shell
`-s` 参数可以指定 shell。如果不指定则使用默认的 shell。例如下面的例子中 ,配置文件中定义的 shell 是 `bash`,但 `Wally` 这个用户指定的是 `zsh`
`-s` 参数可以指定 shell。如果不指定则使用默认的 shell。例如下面的例子中 ,配置文件中定义的 shell 是 `bash`,但 `wally` 这个用户指定的是 `zsh`
```bash
$ grep SHELL /etc/default/useradd
SHELL=/bin/bash
$ sudo useradd -s /usr/bin/zsh wally
$ getent passwd wally
wally1004:1004::/home/wally:/usr/bin/zsh
wally:x:1004:1004::/home/wally:/usr/bin/zsh
```
#### 安全
@ -153,7 +154,7 @@ $ sudo getent shadow sammy
sammy:!!:18171:0:99999:7::20191231:
```
当密码过期时,一个账号也可以自动失效。`-f` 参数指定密码过期后经过几天账号失效。如果设为 0则立即失效。
当密码过期时,账号也会自动失效。`-f` 参数指定密码过期后经过几天账号失效。如果设为 0则立即失效。
```bash
$ sudo useradd -f 30 willy
@ -163,7 +164,7 @@ willy:!!:18171:0:99999:7:30::
### 实例
生产中,创建一个用户账号时会用到多个参数。例如,我要创建一个 Perry 账号,可能会用下面的命令:
生产环境中,创建一个用户账号时会用到多个参数。例如,我要创建一个 Perry 账号,可能会用下面的命令:
```bash
$ sudo useradd -u 1020 -c "Perry Example" \
@ -176,8 +177,8 @@ $ sudo useradd -u 1020 -c "Perry Example" \
```bash
$ getent passwd perry; getent group perry; getent shadow perry; id perry
perry1020:1020:Perry Example:/home2/perry:/usr/bin/zsh
perry1020:
perry:x:1020:1020:Perry Example:/home2/perry:/usr/bin/zsh
perry:x:1020:
perry:!!:18171:0:99999:7:5:20201201:
uid=1020(perry) gid=1020(perry) groups=1020(perry),3000(tgroup)
```
@ -192,8 +193,8 @@ via: https://opensource.com/article/19/10/linux-useradd-command
作者:[Alan Formy-Duval][a]
选题:[lujun9972][b]
译者:[译者ID](https://github.com/译者ID)
校对:[校对者ID](https://github.com/校对者ID)
译者:[lxbwolf](https://github.com/lxbwolf)
校对:[wxy](https://github.com/wxy)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出

View File

@ -1,50 +1,52 @@
[#]: collector: (lujun9972)
[#]: translator: (lxbwolf)
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )
[#]: reviewer: (wxy)
[#]: publisher: (wxy)
[#]: url: (https://linux.cn/article-11749-1.html)
[#]: subject: (Kubernetes namespaces for beginners)
[#]: via: (https://opensource.com/article/19/12/kubernetes-namespaces)
[#]: author: (Jessica Cherry https://opensource.com/users/jrepka)
Kubernetes 命名空间入门
======
命名空间是什么?你为什么需要它?
![Ship captain sailing the Kubernetes seas][1]
kubernetes 命名空间是什么Shakespeare 以前写过,我们声称的命名空间,或者任何其他名字,仍是一个虚拟集群。命名空间,意味着 kubernetes 可以在单个集群上提供多个 kubernetes 的集群,类似一个对其主机进行抽象的虚拟机。[kubernetes 文档][2] 中的解释:
> 命名空间是什么?你为什么需要它?
![](https://img.linux.net.cn/data/attachment/album/202001/05/094542qnq3qc3nrkkrjanh.jpg)
kubernetes <ruby>命名空间<rt>namespace</rt></ruby>是什么?正如 Shakespeare 以前写过的,我们所谓的命名空间,或者任何其他名字,就是虚拟集群。通过虚拟集群,意味着 kubernetes 可以在单个集群上提供多个 kubernetes 的集群,类似一个在其主机抽象出来的虚拟机。[kubernetes 文档][2] 中的解释:
> kubernetes 在一个物理集群上提供了多个虚拟集群。这些虚拟集群被称为命名空间。
你为什么需要命名空间?一句话概括:隔离。
你为什么需要命名空间?一言以蔽之:隔离。
隔离有很多优点,如它提供了安全和干净的环境。如果你是基础设施的所属者,并且为开发者提供环境,隔离就相当重要。你最不需要的就是,一个不熟悉你集群是如何搭建的人去修改系统配置 — 这可能导致所有人都无法登录。
隔离有很多优点,如它提供了安全和干净的环境。如果你是基础设施的所属者,并且为开发者提供环境,隔离就相当重要。你最不需要的就是,一个不熟悉你集群是如何搭建的人去修改系统配置 — 这可能导致所有人都无法登录。
### 初始命名空间
 一个集群的三个初始命名空间:**default**、**kube-system** 和 **kube-public**。虽然你可以用这三个命名空间作技术部署,但我还是推荐你把这三个命名空间留作系统配置用,而不是你的项目。
一个集群的三个初始命名空间:`default`、`kube-system` 和 `kube-public`。虽然技术上你可以用这三个命名空间作部署,但我还是推荐你把这三个命名空间留作系统配置用,而不是你的项目。
* **Default** 某些部署没有指明命名空间,这样部署可以快速创建一个网格,但如果做了很多错误信息的部署,就很能去清理。我不去修改它,因为它在为某一个目的服务时,会在不止一种情况下误导我。
* **Kube-system** 系统相关的所有对象组成的命名空间。任何此命名空间的部署都可能是危险的操作,可能对系统本身造成不可挽回的破坏。没错,我试过;所以我不推荐。
* **Kube-public** 所有人可读,但是这个命名空间是为系统保留的。
* `Default` 用于某些没有指明命名空间的部署,这是一种快速创建混乱的做法,如果你在没有正确信息的情况下做了很多部署,将很难清理。我不会去动它,因为它只有这一个用途,而且在不止一种情况下误导过我。
* `Kube-system` 是 Kubernetes 系统相关的所有对象组成的命名空间。任何此命名空间的部署都可能是危险的操作,可能对系统本身造成不可挽回的破坏。没错,我试过;所以我不推荐。
* `Kube-public` 所有人可读,但是这个命名空间是为系统保留的。
### 用命名空间来实现隔离
我用了多种方式通过命名空间来实现隔离。我经常用命名空间来把多个用户项目分割到不同的环境。这种方式可以有效防止跨项目的污染,因为命名空间提供了独立的环境。例如,使用者可以安装不同版本的 Jenkins如果它们的环境变量是在不同的命名空间就不会冲突。
我用了多种方式通过命名空间来实现隔离。我经常用命名空间来把多个用户项目分割到不同的环境。这种方式可以有效防止跨项目的污染,因为命名空间提供了独立的环境。例如,用户可以安装不同版本的 Jenkins如果它们的环境变量是在不同的命名空间就不会冲突。
这种隔离对于清理也很有帮助。如果部署组的多个项目被废弃,你可以用命令 `kubectl delete ns <$NAMESPACENAME>` 一键删除命名空间,清理命名空间内的所有东西。(请确认被删除的是正确的命名空间。我曾经在生产环境删除了错误的命名空间,这很不好。)
这种隔离对于清理也很有帮助。如果开发小组的多个项目突然被废弃,你可以用命令 `kubectl delete ns <$NAMESPACENAME>` 一键删除命名空间,清理命名空间内的所有东西。(请确认被删除的是正确的命名空间。我曾经在生产环境删除了错误的命名空间,这很不好。)
如果你是基础设施所有者,请谨慎操作,因为这可能会引发其他团队的的故障或引发其他问题。例如,如果你创建了一个特定的命名空间,里面有 DNS 函数,其他人删除了它,那么命名空间内的所有 pod 和它们运行的应用都会被清空。所有的**删除**操作在真正实施之前都应该由同事(通过 [GitOps][3])评审一下。
如果你是基础设施所有者,请谨慎操作,因为这可能会引发其他团队的的故障或引发其他问题。例如,如果你创建了一个特定的命名空间,里面有特殊的额外安全的 DNS 功能,但是其他人删除了它,那么命名空间内的所有 pod 和它们运行的应用都会被清空。所有的**删除**操作在真正实施之前都应该由同事(通过 [GitOps][3])评审一下。
虽然官方文档不建议 [10 人以下团队][2] 使用多个命名空间,但出于架构需要,在我自己的集群上还是用了多个命名空间。集群越干净越好。
### 关于命名空间管理员应该知道的
首先,命名空间不能嵌套。部署只能在一个命名空间中进行。对于版本化项目,你不一定要用命名空间,你可以使用标签来区分有相同名字的版本化应用。命名空间使用配额来为不同的用户划分资源;例如,*某个命名空间最多能有 x 个 node*。最后,所有的命名空间对于资源类型只能使用一个独一无二的名字。
首先,命名空间不能嵌套。部署只能在一个命名空间中进行。对于版本化项目,你不一定要用命名空间,你可以使用标签来区分有相同名字的版本化应用。命名空间使用配额来为不同的用户划分资源;例如,*某个命名空间最多能有 x 个节点*。最后,所有的命名空间对于该资源类型只能使用一个独一无二的名字。
### 命名空间命令操作
你需要安装 [Minikube][4]、 [Helm][5] 和 [kubectl][6] 命令行,才能使用下面的命名空间命令。我的文章 [_安全浏览你的 DevOps 流水线_][7] 中有它们的安装教程,你也可以去每个工程的官方主页去找安装教程。我使用的是最新的 Minikube。手动安装很快第一次就能成功运行。
你需要安装 [Minikube][4]、[Helm][5] 和 [kubectl][6] 命令行,才能使用下面的命名空间命令。我的文章《[安全扫描你的 DevOps 流水线][7]》中有它们的安装教程,你也可以去每个项目的官方主页去找安装教程。我使用的是最新的 Minikube。手动安装很快第一次就能成功运行。
获取你的第一组命名空间:
@ -63,7 +65,7 @@ jess@Athena:~$ kubectl create namespace athena
namespace/athena created
```
现在开发者可以部署到你创建的命名空间;例如,这里是一个简短的 Helm 结构信息
现在开发者可以部署到你创建的命名空间了;例如,这里是一个简短的 Helm chart
```
jess@Athena:~$ helm install teset-deploy stable/redis --namespace athena
@ -74,7 +76,7 @@ STATUS: deployed
REVISION: 1
TEST SUITE: None
NOTES:
** Please be patient while the chart is being deployed **
` Please be patient while the chart is being deployed `
Redis can be accessed via port 6379 on the following DNS names from within your cluster:
teset-deploy-redis-master.athena.svc.cluster.local for read/write operations
@ -98,6 +100,7 @@ export REDIS_PASSWORD=$(kubectl get secret --namespace athena teset-deploy-redis
```
2. 使用 Redis CLI 连接:
```bash
redis-cli -h teset-deploy-redis-master -a $REDIS_PASSWORD
redis-cli -h teset-deploy-redis-slave -a $REDIS_PASSWORD
@ -110,11 +113,10 @@ kubectl port-forward --namespace athena svc/teset-deploy-redis-master 6379:6379
redis-cli -h 127.0.0.1 -p 6379 -a $REDIS_PASSWORD
```
现在这一套部署已经完成了,你有一个在命名空间 **test-deploy** 中部署的图表
现在这一套部署已经完成了,你有一个在命名空间 `test-deploy` 中部署的 chart
查看你的命名空间中有哪些 pod
```
jess@Athena:~$ kubectl get pods --namespace athena
NAME                            READY   STATUS  RESTARTS   AGE
@ -127,7 +129,6 @@ teset-deploy-redis-slave-1      1/1     Running   0             90s
一键删除所有东西:
```bash
jess@Athena:~$ kubectl delete namespace athena
namespace "athena" deleted
@ -137,7 +138,6 @@ namespace "athena" deleted
再次检查一下所有东西是否被删除了:
```bash
jess@Athena:~$ kubectl get pods --all-namespaces
NAMESPACE       NAME                            READY   STATUS  RESTARTS   AGE
@ -156,11 +156,11 @@ kube-system   storage-provisioner               1/1     Running   0
### 命名空间实践
现在我是为了安全使用命名空间,如限制用户的权限。你可以限制所有的东西 — 从哪些角色可以访问命名空间到命名空间可使用的集群资源CPU 等)的配额等级。例如,我通过资源配额和基于角色的访问控制role-based access controlRBAC配置来确保只有允许的服务账号可以访问命名空间。
当前我是出于安全考虑才使用命名空间,如限制用户的权限。你可以限制所有的东西 — 从哪些角色可以访问命名空间到命名空间可使用的集群资源CPU 等)的配额等级。例如,我通过资源配额和<ruby>基于角色的访问控制<rt>role-based access control</rt></ruby>RBAC配置来确保只有允许的服务账号可以访问命名空间。
对于隔离方面的安全,我不希望我的私人 Jenkins 应用可以通过一个信任的本地网络被当做有公共 IP 地址的安全镜像来访问(我不得不假定,可能会做出妥协)。
对于隔离方面的安全,我不希望我的私人 Jenkins 应用可以通过一个信任的本地网络被当做一个有公共 IP 地址的安全镜像来访问(我不得不假定,可能会被侵袭)。
如果你很难提前计算出到底要在你的云平台上部署多少 node就我而言在把我的私人服务器放到 [segfaulting][8] 之前可以部署多少个 node),那么命名空间在预算方面也很有用。虽然这超出了本文的讨论范围,而且很复杂,但值得你去调研和使用来防止你的集群过分扩展。
如果你很难提前计算出到底要在你的云平台上部署多少节点(或者,就我而言,是在[搞崩][8]我的家庭服务器之前我能部署多少个),那么命名空间在预算方面也很有用。虽然这超出了本文的讨论范围,而且很复杂,但值得你去调研和使用来防止你的集群过分扩展。
### 总结
@ -173,7 +173,7 @@ via: https://opensource.com/article/19/12/kubernetes-namespaces
作者:[Jessica Cherry][a]
选题:[lujun9972][b]
译者:[lxbwolf](https://github.com/lxbwolf)
校对:[校对者ID](https://github.com/校对者ID)
校对:[wxy](https://github.com/wxy)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出

View File

@ -1,8 +1,8 @@
[#]: collector: (lujun9972)
[#]: translator: (geekpi)
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )
[#]: reviewer: (wxy)
[#]: publisher: (wxy)
[#]: url: (https://linux.cn/article-11748-1.html)
[#]: subject: (Fixing “VLC is Unable to Open the MRL” Error [Quick Tip])
[#]: via: (https://itsfoss.com/vlc-is-unable-to-open-the-mrl/)
[#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/)
@ -10,11 +10,13 @@
修复 “VLC is Unable to Open the MRL” 错误
======
![](https://img.linux.net.cn/data/attachment/album/202001/05/084139mzlt1lfivilnnbkl.jpg)
一个使用 [VLC 的技巧][1]是使用 [VLC] [2] 播放 YouTube 和其他在线视频。这可以帮助你[观看带有字幕的在线视频][3]。
但是事情并不总是这么简单,因为有时使用 VLC 打开 YouTube 视频时会遇到此错误:
**Your input cant be opened: VLC is unable to open the MRL <https://youtubeurl.com>. Check the log for details.**
> Your input cant be opened: VLC is unable to open the MRL '<https://youtubeurl.com>'. Check the log for details.
![VLC error while playing YouTube videos][4]
@ -26,19 +28,17 @@
对于 VLC 也是如此。如果你[在 Ubuntu 或任何你用的系统中安装了最新的 VLC][7],那么可能不会看到此错误。
### 修复 ”VLC is unable to open the MRL“ 错误
### 修复 “VLC is unable to open the MRL” 错误
让我向你展示对于 YouTube 的修复步骤。
进入 VLC 媒体播放器的官方 Github 仓库页面,并使用 Ctrl+S 保存文件:
进入 VLC 媒体播放器的官方 Github 仓库页面的[这个页面][8],并使用 `Ctrl+S` 保存文件:
[Download youtube.lua file][8]
现在,你需要做的是用此下载文件替换 lib/vlc/lua/playlist 目录中的 youtube.luac注意 luac 中的 “c”
现在,你需要做的是用此下载文件替换 `lib/vlc/lua/playlist` 目录中的 `youtube.luac`(注意 luac 中的 “c”
#### Linux 中的步骤
如果你使用的是 Linux请打开终端并使用 [locate 命令][9]查找 youtube.luac 文件的确切位置:
如果你使用的是 Linux请打开终端并使用 [locate 命令][9]查找 `youtube.luac` 文件的确切位置:
```
locate youtube.luac
@ -49,7 +49,7 @@ locate youtube.luac
对我而言,以下是文件路径:
```
[email protected]:~$ locate youtube.lua
abhishek@itsfoss:~$ locate youtube.lua
/usr/lib/x86_64-linux-gnu/vlc/lua/playlist/youtube.luac
```
@ -65,10 +65,8 @@ sudo cp ~/Downloads/youtube.lua /usr/lib/x86_64-linux-gnu/vlc/lua/playlist/youtu
如果你使用的是 Windows那么应遵循以下步骤
* 将下载的 youtube.lua 文件重命名为 youtube.luac
* 复制此文件并将其粘贴到 C:\Program Files (x86)\VideoLAN\VLC\lua\playlist\
* 将下载的 `youtube.lua` 文件重命名为 `youtube.luac`
* 复制此文件并将其粘贴到 `C:\Program Files (x86)\VideoLAN\VLC\lua\playlist\`
就是这些了。
@ -83,7 +81,7 @@ via: https://itsfoss.com/vlc-is-unable-to-open-the-mrl/
作者:[Abhishek Prakash][a]
选题:[lujun9972][b]
译者:[geekpi](https://github.com/geekpi)
校对:[校对者ID](https://github.com/校对者ID)
校对:[wxy](https://github.com/wxy)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出

View File

@ -0,0 +1,67 @@
[#]: collector: (lujun9972)
[#]: translator: (BrunoJu)
[#]: reviewer: (wxy)
[#]: publisher: (wxy)
[#]: url: (https://linux.cn/article-11760-1.html)
[#]: subject: (10 Ansible resources to accelerate your automation skills)
[#]: via: (https://opensource.com/article/19/12/ansible-resources)
[#]: author: (James Farrell https://opensource.com/users/jamesf)
提升自动化技巧的 10 篇 Ansible 文章
======
> 今年,准备好,用出色的 Ansible 自动化技能装备自己的技能包吧。
![](https://img.linux.net.cn/data/attachment/album/202001/07/231057fbtfjwrn29ficxj0.jpg)
今年我关注了大量关于 Ansible 的文章,以下这些内容都值得每个人学习,无论是否是 Ansible 的新手。
这些文章值得大家标记为书签,或者设置个计划任务(亦或者是设置一个 Tower/AWX 任务),用来提醒自己常读常新。
如果你是 Ansible 的新手,那么就从这些文章开始着手吧:
* 《[Ansible 快速入门指南][2]》拥有一些对新手非常有用的信息,同时还介绍了一些更高级的话题。
* 《[你需要知道的 10 个 Ansible 模块][3]》和《[5 个 Ansible 运维任务][4]》(译文)这两篇文章有每一位 Ansible 管理员都应该熟悉并认真研习的一些最基础的 Ansible 功能。
* 《[如何使用 Ansible 记录流程][5]》这篇文章是对一些额外话题的纵览,我猜你一定会感到很有趣。
剩余的这些文章包含了更多高级的话题,比如 Windows 管理、测试、硬件、云和容器,甚至包括了一个案例研究,如何管理那些对技术有兴趣的孩子的需求。
我希望你能像我一样好好享受 Ansible 带来的乐趣。不要停止学习哦!
1. 《[Ansible 如何为我的家庭带来和平][6]》这个异想天开的案例,你能看到如何利用 Ansible 为孩子们快速部署一个新的笔记本(或者重装旧笔记本)
2. Taz Brown 和 Abner Malivert 的《[适用于 Windows 管理员的 Ansible][7]》:你知道 Ansible 也可以管理 Windows 的节点吗?这篇文章以部署一个 IIS 为案例,阐述了基础的 Ansible 服务器和 Windows 客户端的安装。
3. Shashank Hegde 的《[你需要知道的 10 个 Ansible 模块][3]》是个学习你最应该知道的那些最常见、最基础的 Ansible 模块的好文章。运行命令、安装软件包和操作文件是许多有用的自动化工作的基础。
4. Marco Bravo 的《[如何使用 Ansible 记录流程][5]》Ansible 的 YAML 文件易于阅读,因此它们可以被用于记录完成任务所需的手动步骤。这一特性可以帮助你调试与扩展,这令工作变得异常轻松。同时,这篇文章还包含关于测试和分析等 Ansible 相关主题的指导。
5. Clement Verna 的《[使用 Testinfra 和 Ansible 验证服务器状态][8]》(译文):测试环节是任何一个 CI/CD DevOps 流程不可或缺的一部分。所以为什么不把测试 Ansible 的运行结果也纳入其中呢?这个测试架构 Testinfra 的入门级文章可以帮助你检查配置结果。
6. Mark Phillips 的《[Ansible 硬件起步][9]》:这个世界并不是完全已经被容器和虚拟机所占据。许多系统管理员仍然需要管理众多硬件资源。通过 Ansible 与一点 PXE、DHCP 以及其他技巧的结合,你可以创建一个方便的管理框架使硬件易于启动和运行。
7. Jairo da Silva Junior 的《[你需要了解的关于 Ansible 模块的知识][10]》:模块给 Ansible 带来了巨大的潜力,已经有许多模块可以拿来利用。但如果没有你所需的模块,那你可以尝试给自己打造一个。看看这篇文章吧,它能让你了解如何从零开始打造自己所需的模块。
8. Mark Phillips 的《[5 个 Ansible 运维任务][4]》(译文):这是另一个有关于如何使用 Ansible 来管理常见的系统操作任务的文章。这里描述了一系列可以取代命令行操作的 Tower或 AWX的案例。
9. Chris Short 的《[Ansible 快速入门指南][2]》是个可以下载的 PDF 文档。它可以作为一本随时拿来翻阅的手册。这篇文章的开头有助于初学者入门。同时,还包括了一些其他的研究领域,比如模块测试、系统管理任务和针对 K8S 对象的管理。
10. Mark Phillips 的《[Ansible 参考指南,带有 Ansible Tower 和 GitHub 的 CI/CD等等][11]》:这是一篇每月进行总结更新的文章,充满了有趣的链接。话题包括了 Ansible 的基础内容、管理 Netapp 的 E 系列存储产品、调试、打补丁包和其他一些相关内容。文章中还包括了一些视频以及一些聚会的链接。请查看详情。
如果你也有一些你喜爱的 Ansible 文章,那请留言告诉我们吧。
--------------------------------------------------------------------------------
via: https://opensource.com/article/19/12/ansible-resources
作者:[James Farrell][a]
选题:[lujun9972][b]
译者:[BrunoJu](https://github.com/BrunoJu)
校对:[wxy](https://github.com/wxy)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://opensource.com/users/jamesf
[b]: https://github.com/lujun9972
[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/chaos_engineer_monster_scary_devops_gear_kubernetes.png?itok=GPYLvfVh (Gears above purple clouds)
[2]: https://opensource.com/article/19/2/quickstart-guide-ansible
[3]: https://opensource.com/article/19/9/must-know-ansible-modules
[4]: https://linux.cn/article-11312-1.html
[5]: https://opensource.com/article/19/4/ansible-procedures
[6]: https://opensource.com/article/19/9/ansible-documentation-kids-laptops
[7]: https://opensource.com/article/19/2/ansible-windows-admin
[8]: https://linux.cn/article-10943-1.html
[9]: https://opensource.com/article/19/5/hardware-bootstrapping-ansible
[10]: https://opensource.com/article/19/3/developing-ansible-modules
[11]: https://opensource.com/article/19/7/ansible-news-edition-one

View File

@ -1,39 +1,39 @@
[#]: collector: (lujun9972)
[#]: translator: (wxy)
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )
[#]: reviewer: (wxy)
[#]: publisher: (wxy)
[#]: url: (https://linux.cn/article-11751-1.html)
[#]: subject: (12 programming resources for coders of all levels)
[#]: via: (https://opensource.com/article/19/12/programming-resources)
[#]: author: (Erik O'Shaughnessy https://opensource.com/users/jnyjny)
12 个给码农们的编程资源
12 个给全等级码农们的编程资源
======
> 无论你身处编程旅程中的何处,这 12 篇编程文章都有你需要学习一些东西。
![Woman sitting in front of her computer][1]
![](https://img.linux.net.cn/data/attachment/album/202001/05/102002cdjy66jucbcfs6dg.jpg)
> “学习计算机编程的最佳时间是 20 年前,其次是现在。”
> — (也许是)计算机科学的谚语
> — 计算机科学的谚语(也许是)
你是新程序员、经验丰富的 Web 开发人员、后端大师、头发花白的系统程序员,还是其他神秘物种的计算机极客?无论你身处广阔的软件开发人员生态系统中的何处,在我们领域中唯一不变的就是需要了解新技术及其应用方法。这是过去一年来阅读量最大的 Opensource.com 文章的集合,我很高兴在这里与你分享它们。
无论你是新程序员、经验丰富的 Web 开发人员、后端大师、头发花白的系统程序员,还是其他神秘物种的计算机极客?无论你身处广阔的软件开发人员生态系统中的何处,在我们领域中唯一不变的就是需要了解新技术及其应用方法。这是过去一年来阅读量最大的 Opensource.com 文章的集合,我很高兴在这里与你分享它们。
### 好好学习
无论你的技能或兴趣是什么,学习如何编写计算机程序都可以将特定领域的知识变成一种超能力。不幸的是,至少从现在开始,还不可能通过坐在计算机前面接受电磁辐射就能学会如何编程。在这之前,我推荐这些出色的文章来帮助激发你的编程技能。它们解决了一些重要的问题,例如考虑学习哪种语言以及不同的入门方式。
* [你应该学习哪种编程语言?][2]
* [学习 Python 的 12 个方式][3]
* [你可以使用树莓派学习的三种流行编程语言][4]
* [利用 Python 引导孩子的计算机思维][5]
* [你应该学习哪种编程语言?][2](译文)
* [学习 Python 的 12 个方式][3](译文)
* [你可以使用树莓派学习的三种流行编程语言][4](译文)
* [利用 Python 引导孩子的计算机思维][5](译文)
### 天天向上
经验丰富的程序员知道,与学习编程相比,唯一更难的就是使你的技能和知识保持最新。但是我们是[自学成才][6]的一族,总是希望提高我们的专业知识和理解力。即使我们不期望使用新技术,我们也知道总会有人问起它们。这些有关 Rust、WebAssembly 和 Podman 的文章是开始学习软件技术一些即将出现的趋势的好地方。
* [为什么要在 WebAssembly 中使用 Rust][7]
* [使用 WebAssembly 提升命令行游乐场][8]
* [使用 WebAssembly 扩展命令行领域][8]
* [免 root 的 Podman 如何工作?][9]
* [为什么选择 Rust 作为你的下一种编程语言][10]
@ -42,8 +42,8 @@
尽管新技术层出不穷,但回顾过去可以帮助你前进。当今惊人的技术是建立在昨天的工具之上的,即使我们从未使用这些传奇语言编写过代码,它也将使我们很好地理解这些工具的功能和局限性。这一系列文章集中于 C 语言、用 AWK 编写的实际应用程序,以及对流行度下降但也许还没有消亡的计算机语言的有趣讨论。
* [C 的巨大影响] [11]
* [如何写好 C main 函数][12]
* [用 AWK 喝咖啡][13]
* [如何写好 C main 函数][12](译文)
* [用 AWK 喝咖啡][13](译文)
* [你最喜欢的“死”语言是什么?][14]
### 学习不止
@ -57,7 +57,7 @@ via: https://opensource.com/article/19/12/programming-resources
作者:[Erik O'Shaughnessy][a]
选题:[lujun9972][b]
译者:[wxy](https://github.com/wxy)
校对:[校对者ID](https://github.com/校对者ID)
校对:[wxy](https://github.com/wxy)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出

View File

@ -0,0 +1,84 @@
[#]: collector: (lujun9972)
[#]: translator: (lxbwolf)
[#]: reviewer: (wxy)
[#]: publisher: (wxy)
[#]: url: (https://linux.cn/article-11758-1.html)
[#]: subject: (5 predictions for Kubernetes in 2020)
[#]: via: (https://opensource.com/article/20/1/kubernetes-2020)
[#]: author: (Scott McCarty https://opensource.com/users/fatherlinux)
2020 年对 Kubernetes 的 5 个预测
======
> 以及,对 2019 年最受欢迎的 Kubernetes 文章的回顾。
![](https://img.linux.net.cn/data/attachment/album/202001/07/094358qucr5o2lu2lo23od.jpg)
你是怎么追踪一个广受欢迎的项目(如 Kubernetes的发展轨迹你是怎么了解它发展到什么程度了如果你在为这个项目作贡献或加入了特殊兴趣组SIG可能你会在潜移默化中了解到它的发展轨迹但如果你的全日工作不涉及到为 Kubernetes 作贡献,那么你可能需要一点关于未来的预测来帮助你了解。对于一个诸如 Kubernetes 的快速发展的项目,年末是回顾过去的一年和展望新的一年的最好时机。
今年Kubernetes 取得了很大的进展。除了去查看源码、文档、会议笔记,你也可以去浏览博客。为了深入了解,我在 Opensource.com 上找到了 Kubernetes 排名前十的文章。通过这些文章,我们能了解开发者们更喜欢读和写哪些话题的文章。我们开始吧!
- [为什么数据科学家喜欢Kubernetes][13]
- [Kubernetes 机密信息和 ConfigMap 简介][14]
- [怎样在 Kubernetes 上运行 PostgreSQL][15](译文)
- [为什么说 Kubernetes 是一辆翻斗车][16](译文)
- [安全扫描你的 DevOps 流程][17]
- [在 Kubernetes 上部署 InfluxDB 和 Grafana 以收集 Twitter 统计信息][18]
- [使用 Kubernetes 操作器扩展 PostgreSQL][19]
- [使用 Kubernetes 控制器减少系统管理员的工作量][20]
- [将 Kubernetes 带到裸金属边缘计算][21]
- [为什么你不必担心 Kubernetes][22]
首先,我要指明这些文章中有 5 篇是关于 Kubernetes 工作负载的扩展以及它们可以运行在什么场景。这些工作负载涵盖数据科学、PostgreSQL、InfluxDB、Grafana不仅仅监控集群本身和边缘计算。从历史角度看Kubernetes 和容器都是在虚拟机上运行的,尤其是运行在由云提供的基础设施上时。抛开对于 Kubernetes 的兴趣因素,这也表明了终端用户们极度希望在裸机上安装 Kubernetes参照 [用 OpenShift 在裸机环境运行 Kubernetes][2])。
其次,也有很多开发者希望了解操作相关的知识以及 Kubernetes 的最佳实践。从 [Kubernetes 操作器][3] 到 [Kubernetes 控制器][4],从 [机密信息][5] 到 [ConfigMaps][6],开发者和运维人员都希望能找到简化部署和管理工作的最佳实践。我们经常纠结在怎么去修改配置文件或别人会怎么配置,而不去回头想想这些配置是怎么让应用部署运转的(不是怎么安装,也不是怎么运行 Kubernetes
最后,人们似乎对入门教程真的感兴趣。事实上,构建 Kubernetes 所需了解的信息太多了,以至于让人们望而却步,也使他们走了错误的路。流行度高的文章中有几篇讲述了为什么你需要了解用 Kubernetes 运行应用程序,而不仅仅是安装它。就像最佳实践类的文章一样,人们也通常不会回头分析在入门时他们应该在什么地方花费时间。我一直秉持的理念是,把有限的时间和金钱投入到如何使用某项技术上,而不是如何构建它。
### 2020 年对 Kubernetes 的 5 个预测
回顾了 2019 年的相关主题,这些主题告诉我们 2020 年将如何发展?结合这些文章中的观点,加上我自己的看法,我来分享下我对于 2020 年以及未来发展趋势的想法:
1. 工作负载扩展。我会关注高性能计算、AI/ML 以及使用操作器的有状态工作负载。
2. 更多的生产中的最佳实践,尤其是跟一些成熟的标准相关的,像 PCI、HIPAA、NIST 等等。
3. 提升免 root 和更安全的[运行时类][7](如 [gVisor][8]、[Kata Containers][9] 等等)的安全性。
4. 在部署和开发者们共享应用时,把 Kubernetes 清单的更好的规范标准作为部署的核心要素。如 [podman 生成 kube][10]、[podman 运行 kube][11],还有多合一 Kubernetes 环境,如 [CodeReady Containers (CRC)][12]
5. 一个前所未有的网络、存储和专业硬件(如 GPU 等等)供应商的生态系统,为 Kubernetes 提供 BoBLCTT 译注best of breed单项最佳品牌解决方案在自由软件中我们相信开放的生态系统好过垂直整合的解决方案
期待 Kubernetes 在新的一年里再创辉煌!
--------------------------------------------------------------------------------
via: https://opensource.com/article/20/1/kubernetes-2020
作者:[Scott McCarty][a]
选题:[lujun9972][b]
译者:[lxbwolf](https://github.com/lxbwolf)
校对:[wxy](https://github.com/wxy)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://opensource.com/users/fatherlinux
[b]: https://github.com/lujun9972
[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/coffee_tea_laptop_computer_work_desk.png?itok=D5yMx_Dr (Person drinking a hat drink at the computer)
[2]: https://blog.openshift.com/kubernetes-on-metal-with-openshift/
[3]: https://kubernetes.io/docs/concepts/extend-kubernetes/operator/
[4]: https://kubernetes.io/docs/concepts/architecture/controller/
[5]: https://kubernetes.io/docs/concepts/configuration/secret/
[6]: https://kubernetes.io/docs/tasks/configure-pod-container/configure-pod-configmap/
[7]: https://kubernetes.io/docs/concepts/containers/runtime-class/
[8]: https://gvisor.dev/
[9]: https://katacontainers.io/
[10]: https://developers.redhat.com/blog/2019/01/29/podman-kubernetes-yaml/
[11]: https://www.redhat.com/en/blog/rhel-81-minor-release-major-new-container-capabilities
[12]: https://developers.redhat.com/products/codeready-containers/overview
[13]: https://opensource.com/article/19/1/why-data-scientists-love-kubernetes
[14]: https://opensource.com/article/19/6/introduction-kubernetes-secrets-and-configmaps
[15]: https://linux.cn/article-10762-1.html
[16]: https://linux.cn/article-11011-1.html
[17]: https://opensource.com/article/19/7/security-scanning-your-devops-pipeline
[18]: https://opensource.com/article/19/2/deploy-influxdb-grafana-kubernetes
[19]: https://opensource.com/article/19/2/scaling-postgresql-kubernetes-operators
[20]: https://opensource.com/article/19/3/reducing-sysadmin-toil-kubernetes-controllers
[21]: https://opensource.com/article/19/3/bringing-kubernetes-bare-metal-edge
[22]: https://opensource.com/article/19/10/kubernetes-complex-business-problem

View File

@ -0,0 +1,85 @@
[#]: collector: (lujun9972)
[#]: translator: (nacyro)
[#]: reviewer: (wxy)
[#]: publisher: (wxy)
[#]: url: (https://linux.cn/article-11753-1.html)
[#]: subject: (9 cheat sheets and guides to enhance your tech skills)
[#]: via: (https://opensource.com/article/20/1/cheat-sheets-guides)
[#]: author: (Lauren Pritchett https://opensource.com/users/lauren-pritchett)
九个提升程序员技术技能的备忘单和指南
======
> 用我们最新的编程备忘单和指南来为新年开局,它适合所有技能水平的人。
![](https://img.linux.net.cn/data/attachment/album/202001/05/233115etzm6hv4a3z5yvhg.jpg)
对刚接触命令行的新程序员来说备忘单是完美的。然而,即便是最有经验的程序员也需要时不时地依靠参考资料。假如你刚好敲不出那个讨厌的快捷键,那么手边有个备忘单就很赞了。这是一份我们可供下载指南的综述,它将助你在 2020 年取得成功。
### 备忘单
#### Markdown
[Markdown][2] 不仅针对程序员,任何人都可以借助它为纯文本文档增添语法和结构。此备忘单提供了使用 CommonMark 规范的 Markdown 基础要点。它还包括 GitHub 和 GitLab 的语法。
#### Linux 权限和用户
用这个 Linux 备忘单把[用户管理][3]命令放在手边。快速学习如何增删用户、查看历史以及设置权限。
#### Bash
一旦你了解了 [Bash][4],在命令行中就蕴含了无限可能。我们的 Bash 备忘单可以帮助你更有效地使用键盘快捷键。不知不觉间,你就能在睡眠中(字面意义上)运行脚本。
#### Linux 常用命令
毫不奇怪,我们的 [Linux 常用命令备忘单][5]是如此受欢迎。这个备忘单包含了开始安装软件和导览文件系统的要点。为自己和你的同事打印出来吧。
#### 微服务
似乎每个人都在谈论[微服务][6],而且理由很充分。微服务使应用程序模块化,因此更容易构建和维护。它不再只是这个备忘单上的流行语。在[微服务开源指南][7]中了解重要的术语并学习更多关于微服务的基础知识。
#### Java
此备忘单非常适合初级和中级 [Java][8] 程序员。它包括重要的上下文以及处理导入、变量、类等的代码。
#### pip
程序员爱用 [pip][9] 命令来帮助安装、管理和使用 Python 软件包。然而pip 可以做的远不止这些。这个备忘单将教你如何构建 wheels 和 record 包。
### 指南
#### 七个不可或缺的 PyPI 库
[这组 Python 教程][10]将帮助你学习如何更快地编写扩展、格式化代码、自动化测试、确保代码一致性,以及更多使用 PyPI 库的方法。
#### 开始学习 Kubernetes
在这份平易近人的[指南][11]中,作者 Scott McCarty 用了一个出人意料的类比来解释 Kubernetes 的价值和上手步骤。
--------------------------------------------------------------------------------
via: https://opensource.com/article/20/1/cheat-sheets-guides
作者:[Lauren Pritchett][a]
选题:[lujun9972][b]
译者:[nacyro](https://github.com/nacyro)
校对:[wxy](https://github.com/wxy)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://opensource.com/users/lauren-pritchett
[b]: https://github.com/lujun9972
[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/checklist_hands_team_collaboration.png?itok=u82QepPk (a checklist for a team)
[2]: https://opensource.com/downloads/cheat-sheet-markdown
[3]: https://opensource.com/downloads/linux-permissions-cheat-sheet
[4]: https://opensource.com/downloads/bash-cheat-sheet
[5]: https://opensource.com/downloads/linux-common-commands-cheat-sheet
[6]: https://opensource.com/downloads/microservices-cheat-sheet
[7]: https://opensource.com/article/19/11/microservices-cheat-sheet
[8]: https://opensource.com/downloads/java-cheat-sheet
[9]: https://opensource.com/downloads/pip-cheat-sheet
[10]: https://opensource.com/downloads/7-essential-pypi-libraries
[11]: https://opensource.com/downloads/getting-started-kubernetes-ebook
[12]: https://opensource.com/users/fatherlinux
[13]: https://opensource.com/downloads/cheat-sheets
[14]: https://opensource.com/email-newsletter

View File

@ -0,0 +1,100 @@
[#]: collector: (lujun9972)
[#]: translator: ( )
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )
[#]: subject: (DevOps is a solution to burnout worth investing in)
[#]: via: (https://opensource.com/article/20/1/devops-burnout-solution)
[#]: author: (Dawn Parzych https://opensource.com/users/dawnparzych)
DevOps is a solution to burnout worth investing in
======
Instead of treating burnout once it kicks in, we need to do more to
prevent it in the first place. Here is a reminder of the cause and a
look at solutions.
![A person choosing between several different incentives][1]
Not a day goes by that I don't see a tweet or hear somebody talking about burnout. Burnout is becoming a pervasive part of our lives, especially in tech and open source communities. In [_What you need to know about burnout in open source communities_,][2] I defined burnout and explored its causes, symptoms, and potential treatments. But a better question is about prevention: How do we change the underlying processes, cultures, and tools to prevent burnout from occurring in the first place?
### Burnout's catalyst is unplanned work
Let's start by reviewing what's known about the cause of burnout. In 2019, PagerDuty published [_Unplanned work: The human impact of an always-on world_][3]. More than 35% of the study's respondents are considering leaving their jobs due to stress and work/life balance issues, also known as burnout. Companies that utilize automation and have documented response plans have fewer unplanned incidents and less stressed employees.
Modern software organizations use automation and documented response plans to move faster. Moving faster is necessary to stay competitive. We are in this endless cycle where customers expect more, which puts more pressure on companies to deliver more and deliver it faster, which in turn creates pressure on employees.
However, it is possible to move fast while having protections to prevent unplanned work and burnout. The Accelerate State of DevOps Report has been tracking trends in DevOps for six years. It allows teams to benchmark against others in the industry as low, medium, high, or elite performers. One of the findings from the [2019 State of DevOps report][4] was: "Productivity can drive improvements in work/life balance and reductions in burnout, and organizations can make smart investments to support it."
Productivity means more work gets done. Therefore, more value is delivered. The catch to productivity is balance: Don't do more work in the short term at the expense of burning out your people. Processes and tooling need to be in place to prevent people from feeling overworked and overwhelmed.
To support productivity that does not lead to burnout, organizations need to make smart investments in tooling and reduce technical debt. Investing in tooling means purchasing useful and easy-to-use solutions. The preference for building rather than buying may lead productivity to decrease and burnout to emerge. How? Instead of focusing on building features that are competitive differentiators and help the company achieve key business objectives, the developers spend countless hours trying to build something that a vendor could have quickly provided.
As developers spend time building non-core solutions, technical debt accrues, and features are pushed out. Instead of building all the things, buy the tooling that supports the business but is not strategic, and build the things that are core to your business strategy. You wouldn't use development resources to build your own email program, so treat other tooling the same way. Twenty percent of tools used by low-performing teams are developed primarily in-house and proprietary to the organization, compared to 5% to 6% in medium, high, and elite teams.
### Worthwhile solutions to burnout
If you want to prevent burnout, here are some areas to invest in. It's no coincidence they overlap with frequent discussions [in DevOps articles][5].
#### Communication and collaboration
Communication is at the heart of everything we do. [Laurie Barth][6] sums it up nicely: "Over time, I've learned that the biggest source of failure is often due to people and teams. A lack of communication and coordination can cause serious problems." Use tools like videoconferencing, Confluence, and Slack to ensure communication and collaboration happen.
But create rules around the use of these tools. Make sure to turn off Slack notifications during off-hours. I disable my notifications from 6pm to 8am.
Define what type of communication is best for which situations. Slack is useful for real-time, ephemeral communication, but it can lead to people feeling the need to always be on. If they're not online, they may miss an important conversation. If major or minor decisions are made in a Slack thread, document those in a longer-living system of record, giving all team members access to the necessary information.
Trying to debug an incident? Communicate via Slack. Need to write up a post-incident review? Post that to Confluence or a wiki.
Videoconferencing tools like Zoom or BlueJeans help enable remote work. Having the ability to work remotely, part-time or full-time, can reduce the stress of commuting or relocating. Videoconferences make it easy to stay connected with distributed teams because sometimes it is easier to hash things out in a face-to-face conversation than over email or Slack.
These tools should not be used to encourage people to work while on vacation. Time off means time away from work to rest, recover, and recharge.
#### Releases and deploys
According to the 2019 State of DevOps report, elite teams deploy code 208 times more frequently than low performers, and their lead time from committing code to deployment is 106 times faster. It may seem that the more deploys you do, the greater the likelihood of burnout, but that isn't necessarily the case. Teams that utilize continuous delivery have processes in place to deploy safely.
First, separate releases from deploys—just because you deployed code doesn't mean that all users should have access to it. Ring deploys make features available to a small group of people, like internal employees or beta customers. These users can help you identify bugs or provide feedback to fine-tune a feature before releasing it widely.
Next, create feedback loops regarding the quality of a deployment. Things don't always go as planned when deploying your code. You need the ability to rapidly stop when things go wrong. Feedback loops include implementing monitoring and observability tools. By using telemetry data along with kill switches, you can quickly turn off a poorly behaving feature rather than rolling back an entire deployment.
Finally, run A/B tests and experiments to learn what customers respond to. A metrics-based approach provides insight into what works and what doesn't and can help you validate a hypothesis. Instead of creating technical debt with a partial feature, collect data to see if the feature provides the expected conversions early on. If it doesn't, don't release it.
#### Incident resolution
Part of resolving incidents means knowing what to do when something breaks. And constantly putting out fires can lead to burnout. We can't prevent all incidents from happening, but we can be better prepared. Running chaos experiments or game days with tools like Gremlin can help companies prepare for the unexpected.
With chaos experiments, you can learn how your systems, services, and applications respond under specific scenarios. Knowing how things behave when they're broken can shorten incident-resolution times. They can also help you identify and fix vulnerabilities before an incident occurs.
What can you automate to reduce toil during incident resolution? For example, when you're actively working on an incident, can a Slack channel dedicated to the incident be automatically generated? Or can you create [feature flags][7] with a solution like LaunchDarkly (full disclosure: I work there) to perform common tasks during incident resolution? These could include:
* Dynamic configuration changes, like automatically adjusting logging levels to collect more information when an alert is triggered
* Load-shedding to disable non-critical elements when systems are under heavy load to ensure essential tasks complete
* Kill switches or circuit breakers to turn off features when they are impacting your service reliability
### It's not magic
There is no magic bullet to resolve burnout; it requires having the right people, processes, and tools. The people help create an environment of psychological safety where people are free to ask questions, experiment, make mistakes, and be creative. Think about what is most important to your organization, and invest in the right tools to support those goals and the people working towards them.
This month we look at ways to balance your workload, gracefully say "no," and avoid burnout.
--------------------------------------------------------------------------------
via: https://opensource.com/article/20/1/devops-burnout-solution
作者:[Dawn Parzych][a]
选题:[lujun9972][b]
译者:[译者ID](https://github.com/译者ID)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://opensource.com/users/dawnparzych
[b]: https://github.com/lujun9972
[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/BUSINESS_incentives.png?itok=IhIL1xyT (A person choosing between several different incentives)
[2]: https://opensource.com/article/19/11/burnout-open-source-communities
[3]: https://www.pagerduty.com/resources/reports/unplanned-work/
[4]: https://services.google.com/fh/files/misc/state-of-devops-2019.pdf
[5]: https://opensource.com/tags/devops
[6]: https://laurieontech.com/
[7]: https://martinfowler.com/articles/feature-toggles.html

View File

@ -0,0 +1,52 @@
[#]: collector: (lujun9972)
[#]: translator: ( )
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )
[#]: subject: (Industrial Internet Consortium teams up with blockchain-focused security group)
[#]: via: (https://www.networkworld.com/article/3512062/industrial-internet-consortium-teams-up-with-blockchain-focused-security-group.html)
[#]: author: (Jon Gold https://www.networkworld.com/author/Jon-Gold/)
Industrial Internet Consortium teams up with blockchain-focused security group
======
A merger between a prominent industrial-IoT umbrella group and a blockchain-centered corporate memebership program highlights a new focus on bringing finished IoT solutions to market.
Leo Wolfert / Getty Images
The Industrial Internet Consortium and the Trusted IoT Alliance announced today that they would merge memberships, in an effort to drive more collaborative approaches to [industrial IoT][1] and help create more market-ready products.
The Trusted IoT Alliance will now operate under the aegis of the IIC, a long-standing umbrella group for vendors operating in the IIoT market. The idea is to help create more standardized approaches to common use cases in IIoT, enabling companies to get solutions to market more quickly.
[[Get regularly scheduled insights by signing up for Network World newsletters.]][2]
“This consolidation will strengthen the ability of the IIC to provide guidance and advance best practices on the uses of distributed-ledger technology across industries, and boost the commercialization of these products and services,” said 451 Research senior [blockchain][3] and DLT analyst Csilla Zsigri in a statement.
Gartner vice president and analyst Al Velosa said that its possible the move to team up with TIoTA was driven in part by a new urgency to reach potential customers. Where other players in the IoT marketplace, like the major cloud vendors, have raked in billions of dollars in revenue, the IIoT vendors themselves havent been as quick to hit their sales targets. “This approach is them trying to explore new vectors for revenue that they havent before,” Velosa said in an interview.
The IIC, whose founding members include Cisco, IBM, Intel, AT&amp;T and GE, features 19 different working groups, covering everything from IIoT technology itself to security to marketing to strategy. Adding TIoTAs blockchain focus to the mix could help answer questions about security, which are centrally important to the continued success of enterprise and industrial IoT products.
Indeed, research from Gartner released late last year shows that IoT users are already gravitating toward blockchain and other distributed-ledger technologies. Fully three-quarters of IoT technology adopters in the U.S. have either brought that type of technology into their stack already or are planning to do so by the end of 2020. While almost two-thirds of respondents to the survey cited security and trust as the biggest drivers of their embrace of blockchain, almost as many noted that the technology had allowed them to increase business efficiency and lower costs.
**[ Also see [What is edge computing?][4] and [How edge networking and IoT will reshape data centers][5].]**
Join the Network World communities on [Facebook][6] and [LinkedIn][7] to comment on topics that are top of mind.
--------------------------------------------------------------------------------
via: https://www.networkworld.com/article/3512062/industrial-internet-consortium-teams-up-with-blockchain-focused-security-group.html
作者:[Jon Gold][a]
选题:[lujun9972][b]
译者:[译者ID](https://github.com/译者ID)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://www.networkworld.com/author/Jon-Gold/
[b]: https://github.com/lujun9972
[1]: https://www.networkworld.com/article/3243928/what-is-the-industrial-internet-of-things-essentials-of-iiot.html
[2]: https://www.networkworld.com/newsletters/signup.html
[3]: https://www.networkworld.com/article/3386881/why-blockchain-might-be-coming-to-an-iot-implementation-near-you.html
[4]: https://www.networkworld.com/article/3224893/internet-of-things/what-is-edge-computing-and-how-it-s-changing-the-network.html
[5]: https://www.networkworld.com/article/3291790/data-center/how-edge-networking-and-iot-will-reshape-data-centers.html
[6]: https://www.facebook.com/NetworkWorld/
[7]: https://www.linkedin.com/company/network-world

View File

@ -0,0 +1,116 @@
[#]: collector: (lujun9972)
[#]: translator: ( )
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )
[#]: subject: (7 Ways NOT to manage your remote team)
[#]: via: (https://opensource.com/article/20/1/ways-not-manage-remote-team)
[#]: author: (Matt Shealy https://opensource.com/users/mshealy)
7 Ways NOT to manage your remote team
======
Learn to let go and let your team shine with these simple steps.
![World locations with red dots with a sun burst background][1]
Building a remote development team presents unique challenges. Trying to build a cross-functional team, full of various personalities, virtually can lead to communication disasters. Fortunately, through planning, smart hiring, training, and communication, project leaders can build and lead virtual development teams successfully.
The demand for remote teams continues to grow. The increased demand for software developers and [new communication technology][2] has removed the barriers of geography. Even with these advancements, disparate team members from different backgrounds may find it challenging to learn how to interact with one another.
It's easy for misunderstandings and miscommunications to occur. It's becoming more and more critical to [rethink collaboration][3] in a work environment growing increasingly more remote. As a result, project leaders must rethink the needs of teams spread out across the globe.
By avoiding a few key pitfalls, your team can overcome these challenges consistently. If you follow a few time-tested, in-house practices, and some that apply specifically to remote teams, you can manage a range of personalities and complete your build successfully.
The following are seven practices to avoid when managing a remote team.
### Don't slack on training
A variety of different perspectives is the top benefit of working with diverse remote team members. However, its essential to understand and acknowledge those differences during training.
Addressing language differences is only one part of acknowledging team diversity. When recruiting programmers, it would be best if you focus on candidates with an aptitude for working in a multicultural environment and even in a multi-coding language environment.
Also, dont make the mistake of thinking that personal characteristics are unimportant because team members arent working face-to-face. Team members still have to collaborate, so their personalities must mesh.
Training isnt all technical skills. Emotional training can also help a team work well together remotely. Emotional intelligence [training can help coworkers develop skills like empathy and awareness][4] that can make teams work better together. Emotional distance can make it challenging to establish bonds between new trainees and team leaders from the get-go, which can immediately loosen bonds in what could be a strong remote team. Consider what remote team-building training you can do via video or on Slack. Remember that is it important to constantly be proactive in strengthening relationships throughout the life of your team.
### Don't use an ad hoc communication system
When working with diverse remote team members, its essential that you use straightforward, effective code management and communication software. Ideally, you want the most uncomplicated resources available.
The process may need to be further simplified for newer team members and freelancers who do not have the time to learn everything about the ins and outs of the organizations policies.
Create standard ways to communicate with team members. Maybe all work discussion happens in Slack or one of its [open source alternatives][5], while teams use [project management software][6] to keep work on schedule.
Having a clear space for each type of conversation will help those who need to focus on work, while also offering an outlet for fun. Team members must use these resources daily, if not hourly. If your solutions are too complicated, learning to navigate the tools will pull focus from design and implementation work.
### Don't lose sight of the big picture
Avoid the pitfalls of focusing too closely on daily goals. It is essential you stay focused on the overall project. You should work with team members to establish your goals and milestones, and make sure team members stay on schedule. As the project leader, its your job to make sure these key events contribute to deliverable milestones.
### Don't micromanage your team
Some project managers, especially those with a coding background, find it difficult to delegate responsibility. Its natural to gravitate toward solving familiar problems. However, its your job to guide the ship, not develop solutions.
In [a micromanaged environment][7], the project manager tells the programmers what the code is, and exactly how to craft it. However, this management style ultimately leads to employee dissatisfaction.
Your team should feel free to explore solutions, initiate positive change, and use innovation for exciting new ideas.
If you dont give your coders space to innovate and use their creativity, they feel undervalued. If this sentiment persists, your remote staff members are unlikely to produce the best work possible.
### Use this opportunity to promote diversity
If you are going to build a remote team, you must understand and acknowledge that [team members will have different backgrounds][8]. This circumstance is especially beneficial. The diverse viewpoints of staff members will enable your team to offer insights that expand beyond that of a centrally located talent pool.
Also, your diverse remote team will give you access to experience with global trends. Furthermore, your team will be less likely to suffer from the effect of crowd mentality thinking.
With the freedom to innovate, team members will feel more comfortable offering their input. Together, these benefits will enable your team as a whole to build a product better suited for multiple regions and verticals.
### Don't forget to keep an eye on costs
Ballooning costs are a top challenge for development teams. Despite project planning best practices, scope creep is a real problem for even the most experienced teams. There are two underlying factors that need to be addressed if this problem is to be solved.
The first is the fact that the more analysis that is done throughout the development process, the more complexity arises and is ultimately added to the system. The second factor is the fact that people who have been through system development before know that there wont ever be a "second phase" of the project. They know that there will only be one shot at the project, so they try and fit everything possible into the initial project phase.
These two self-reinforcing factors lead to a death spiral of problems. Too much analysis leads to system complexity and loads of features being crammed into the first phase. A lack of trust between IT and business teams inevitably forms because of this. The design requirements become too big and complicated for there to be any chance of staying on schedule or on budget. Inevitably, blame lands with the IT team.
The answer to this problem is to restrict analysis to only what the business team needs right now. IT should refrain from speculating on what may be needed in the future or asking business team members what they may need down the line.
These requirements allow IT to build a reliable project plan and overall budget. If your team is looking to outsource the project at least in part, [calculating the app development costs][9] for each individual team or project component can help to keep things on track.
### Don't think of time zone differences as a barrier
Do not view time zone differences as a challenge. You can leverage time zones to your advantage and build your team in a way that will keep the project running around the clock.
What is more important is choosing candidates who work independently. Good remote coders are responsible, organize their time effectively, and communicate well with team members. With an effective communication system, time differences will have no effect on the successful outcome of your team.
Remote team members benefit significantly from predictable and straightforward engagement. The relatively new remote work environment demands that staff members establish a new standard for clear, concise communication. To promote a collaborative environment, teams must establish norms, such as universal jargon and consensus on communication tools.
In an environment that thrives on innovation, predictability is an asset when it comes to teamwork. Everyone is different, and innovation is a sought-after commodity in software development. However, in the remote environment, consistent behavior helps team members communicate effectively.
### Conclusion
Remote work is quickly becoming the new default for software development. Be sure to avoid these pitfalls to set your teams up for success.
Do you have any tips to recommend? Please share them in the comments.
--------------------------------------------------------------------------------
via: https://opensource.com/article/20/1/ways-not-manage-remote-team
作者:[Matt Shealy][a]
选题:[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/mshealy
[b]: https://github.com/lujun9972
[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/world_remote_teams.png?itok=Wk1yBFv6 (World locations with red dots with a sun burst background)
[2]: https://www.chamberofcommerce.com/business-advice/strategies-and-tools-for-remote-team-collaboration
[3]: https://hbr.org/2018/02/how-to-collaborate-effectively-if-your-team-is-remote
[4]: https://www.skillsoft.com/content-solutions/business-skills-training/emotional-intelligence-training/
[5]: https://opensource.com/alternatives/slack
[6]: https://opensource.com/business/16/2/top-issue-support-and-bug-tracking-tools
[7]: https://blog.trello.com/how-to-stop-micromanaging-your-remote-team
[8]: https://opensource.com/article/18/10/think-global-communication-challenges
[9]: https://www.appdevelopmentcost.com/#the-definitive-guide-to-understanding-app-development-costs

View File

@ -0,0 +1,236 @@
[#]: collector: (lujun9972)
[#]: translator: ( )
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )
[#]: subject: (Friend of a Friend: The Facebook That Could Have Been)
[#]: via: (https://twobithistory.org/2020/01/05/foaf.html)
[#]: author: (Two-Bit History https://twobithistory.org)
Friend of a Friend: The Facebook That Could Have Been
======
> _I express my network in a FOAF file, and that is the start of the revolution._ —Tim Berners-Lee (2007)
The FOAF standard, or Friend of a Friend standard, is a now largely defunct/ignored/superseded[1][1] web standard dating from the early 2000s that hints at what social networking might have looked like had Facebook not conquered the world. Before we talk about FOAF though, I want to talk about the New York City Subway.
The New York City Subway is controlled by a single entity, the Metropolitan Transportation Agency, better known as the MTA. The MTA has a monopoly on subway travel in New York City. There is no legal way to travel in New York City by subway without purchasing a ticket from the MTA. The MTA has no competitors, at least not in the “subway space.”
This wasnt always true. Surprisingly, the subway system was once run by two corporations that competed with each other. The Inter-borough Rapid Transit Company (IRT) operated lines that ran mostly through Manhattan, while the Brooklyn-Manhattan Transit Corporation (BMT) operated lines in Brooklyn, some of which extended into Manhattan also. In 1932, the City opened its own service called the Independent Subway System to compete with the IRT and BMT, and so for a while there were _three_ different organizations running subway lines in New York City.
One imagines that this was not an effective way to run a subway. It was not. Constructing interchanges between the various systems was challenging because the IRT and BMT used trains of different widths. Interchange stations also had to have at least two different fare-collection areas since passengers switching trains would have to pay multiple operators. The City eventually took over the IRT and BMT in 1940, bringing the whole system together under one operator, but some of the inefficiencies that the original division entailed are still problems today: Trains designed to run along lines inherited from the BMT (e.g. the A, C, or E) cannot run along lines inherited from the IRT (e.g. the 1, 2, or 3) because the IRT tunnels are too narrow. As a result, the MTA has to maintain two different fleets of mutually incompatible subway cars, presumably at significant additional expense relative to other subway systems in the world that only have to deal with a single tunnel width.
This legacy of the competition between the IRT and BMT suggests that subway systems naturally tend toward monopoly. It just makes more sense for there to be a single operator than for there to be competing operators. Average passengers are amply compensated for the loss of choice by never having to worry about whether they brought their IRT MetroCard today but forgot their BMT MetroCard at home.
Okay, so what does the Subway have to do with social networking? Well, I have wondered for a while now whether Facebook has, like the MTA, a natural monopoly. Facebook does seem to have _a_ monopoly, whether natural or unnatural—not over social media per se (I spend much more time on Twitter), but over my internet social connections with real people I know. It has a monopoly over, as they call it, my digitized “social graph”; I would quit Facebook tomorrow if I didnt worry that by doing so I might lose many of those connections. I get angry about this power that Facebook has over me. I get angry in a way that I do not get angry about the MTA, even though the Subway is, metaphorically and literally, a sprawling trash fire. And I suppose I get angry because at root I believe that Facebooks monopoly, unlike the MTAs, is not a natural one.
What this must mean is that I think Facebook owns all of our social data now because they happened to get there first and then dig a big moat around themselves, not because a world with competing Facebook-like platforms is inefficient or impossible. Is that true, though? There are some good reasons to think it isnt: Did Facebook simply get there first, or did they instead just do social networking better than everyone else? Isnt the fact that there is only one Facebook actually convenient if you are trying to figure out how to contact an old friend? In a world of competing Facebooks, what would it mean if you and your boyfriend are now Facebook official, but he still hasnt gotten around to updating his relationship status on VisageBook, which still says he is in a relationship with his college ex? Which site will people trust? Also, if there were multiple sites, wouldnt everyone spend a lot more time filling out web forms?
In the last few years, as the disadvantages of centralized social networks have dramatically made themselves apparent, many people have attempted to create decentralized alternatives. These alternatives are based on open standards that could potentially support an ecosystem of inter-operating social networks (see e.g. [the Fediverse][2]). But none of these alternatives has yet supplanted a dominant social network. One obvious explanation for why this hasnt happened is the power of network effects: With everyone already on Facebook, any one person thinking of leaving faces a high cost for doing so. Some might say this proves that social networks are natural monopolies and stop there; I would say that Facebook, Twitter, et al. chose to be walled gardens, and given that people have envisioned and even built social networks that inter-operate, the network effects that closed platforms enjoy tell us little about the inherent nature of social networks.
So the real question, in my mind, is: Do platforms like Facebook continue to dominate merely because of their network effects, or is having a single dominant social network more efficient in the same way that having a single operator for a subway system is more efficient?
Which finally brings me back to FOAF. Much of the world seems to have forgotten about the FOAF standard, but FOAF was an attempt to build a decentralized and open social network before anyone had even heard of Facebook. If any decentralized social network ever had a chance of occupying the redoubt that Facebook now occupies before Facebook got there, it was FOAF. Given that a large fraction of humanity now has a Facebook account, and given that relatively few people know about FOAF, should we conclude that social networking, like subway travel, really does lend itself to centralization and natural monopoly? Or does the FOAF project demonstrate that decentralized social networking was a feasible alternative that never became popular for other reasons?
### The Future from the Early Aughts
The FOAF project, begun in 2000, set out to create a universal standard for describing people and the relationships between them. That might strike you as a wildly ambitious goal today, but aspirations like that were par for the course in the late 1990s and early 2000s. The web (as people still called it then) had just trounced closed systems like America Online and [Prodigy][3]. It could only have been natural to assume that further innovation in computing would involve the open, standards-based approach embodied by the web.
Many people believed that the next big thing was for the web to evolve into something called the Semantic Web. [I have written about][4] what exactly the Semantic Web was supposed to be and how it was supposed to work before, so I wont go into detail here. But I will sketch the basic vision motivating the people who worked on Semantic Web technologies, because the FOAF standard was an application of that vision to social networking.
There is an essay called [“How Google beat Amazon and Ebay to the Semantic Web”][5] that captures the lofty dream of the Semantic Web well. It was written by Paul Ford in 2002. The essay imagines a future (as imminent as 2009) in which Google, by embracing the Semantic Web, has replaced Amazon and eBay as the dominant e-commerce platform. In this future, you can search for something you want to purchase—perhaps a second-hand Martin guitar—by entering `buy:martin guitar` into Google. Google then shows you all the people near your zipcode selling Martin guitars. Google knows about these people and their guitars because Google can read RDF, a markup language and core Semantic Web technology focused on expressing relationships. Regular people can embed RDF on their web pages to advertise (among many other things) the items they have to sell. Ford predicts that as the number of people searching for and advertising products this way grows, Amazon and eBay will lose their near-monopolies over, respectively, first-hand and second-hand e-commerce. Nobody will want to search a single centralized database for something to buy when they could instead search the whole web. Even Google, Ford writes, will eventually lose its advantage, because in theory anyone could crawl the web reading RDF and offer a search feature similar to Googles. At the very least, if Google wanted to make money from its Semantic Web marketplace by charging a percentage of each transaction, that percentage would probably by forced down over time by competitors offering a more attractive deal.
Fords imagined future was an application of RDF, or the Resource Description Framework, to e-commerce, but the exciting thing about RDF was that hypothetically it could be used for anything. The RDF standard, along with a constellation of related standards, once widely adopted, was supposed to blow open database-backed software services on the internet the same way HTML had blown open document publishing on the internet.
One arena that RDF and other Semantic Web technologies seemed poised to takeover immediately was social networking. The FOAF project, known originally as “RDF Web Ring” before being renamed, was the Semantic Web effort offshoot that sought to accomplish this. FOAF was so promising in its infancy that some people thought it would inevitably make all other social networking sites obsolete. A 2004 Guardian article about the project introduced FOAF this way:
> In the beginning, way back in 1996, it was SixDegrees. Last year, it was Friendster. Last week, it was Orkut. Next week, it could be Flickr. All these websites, and dozens more, are designed to build networks of friends, and they are currently at the forefront of the trendiest internet development: social networking. But unless they can start to offer more substantial benefits, it is hard to see them all surviving, once the Friend Of A Friend (FOAF) standard becomes a normal part of life on the net.[2][6]
The article goes on to complain that the biggest problem with social networking is that there are too many social networking sites. Something is needed that can connect all of the different networks together. FOAF is the solution, and it will revolutionize social networking as a result.
FOAF, according to the article, would tie the different networks together by doing three key things:
* It would establish a machine-readable format for social data that could be read by any social networking site, saving users from having to enter this information over and over again
* It would allow “personal information management programs,” i.e. your “Contacts” application, to generate a file in this machine-readable format that you could feed to social networking sites
* It would further allow this machine-readable format to be hosted on personal homepages and read remotely by social networking sites, meaning that you would be able to keep your various profiles up-to-date by just pushing changes to your own homepage
It is hard to believe today, but the problem in 2004, at least for savvy webizens and technology columnists aware of all the latest sites, was not the lack of alternative social networks but instead the proliferation of them. Given _that_ problem—so alien to us now—one can see why it made sense to pursue a single standard that promised to make the proliferation of networks less of a burden.
### The FOAF Spec
According to the description currently given on the FOAF projects website, FOAF is “a computer language defining a dictionary of people-related terms that can be used in structured data.” Back in 2000, in a document they wrote to explain the projects goals, Dan Brickley and Libby Miller, FOAFs creators, offered a different description that suggests more about the technologys ultimate purpose—they introduced FOAF as a tool that would allow computers to read the personal information you put on your homepage the same way that other humans do.[3][7] FOAF would “help the web do the sorts of things that are currently the proprietary offering of centralised services.”[4][8] By defining a standard vocabulary for people and the relationships between them, FOAF would allow you to ask the web questions such as, “Find me todays web recommendations made by people who work for Medical organizations,” or “Find me recent publications by people Ive co-authored documents with.”
Since FOAF is a standardized vocabulary, the most important output of the FOAF project was the FOAF specification. The FOAF specification defines a small collection of RDF _classes_ and RDF _properties_. (Im not going to explain RDF here, but again see [my post about the Semantic Web][4] if you want to know more.) The RDF _classes_ defined by the FOAF specification represent subjects you might want to describe, such as people (the `Person` class) and organizations (the `Organization` class). The RDF _properties_ defined by the FOAF specification represent logical statements you might make about the different subjects. A person could have, for example, a first name (the `givenName` property), a last name (the `familyName` property), perhaps even a personality type (the `myersBriggs` property), and be near another person or location (the `based_near` property). The idea was that these classes and properties would be sufficient to represent the kind of the things people say about themselves and their friends on their personal homepage.
The FOAF specification gives the following as an example of a well-formed FOAF document. This example uses XML, though an equivalent document could be written using JSON or a number of other formats:
```
<foaf:Person rdf:about="#danbri" xmlns:foaf="http://xmlns.com/foaf/0.1/">
<foaf:name>Dan Brickley</foaf:name>
<foaf:homepage rdf:resource="http://danbri.org/" />
<foaf:openid rdf:resource="http://danbri.org/" />
<foaf:img rdf:resource="/images/me.jpg" />
</foaf:Person>
```
This FOAF document describes a person named “Dan Brickley” (one of the specifications authors) that has a homepage at `http://danbri.org`, something called an “open ID,” and a picture available at `/images/me.jpg`, presumably relative to the base address of Brickleys homepage. The FOAF-specific terms are prefixed by `foaf:`, indicating that they are part of the FOAF namespace, while the more general RDF terms are prefixed by `rdf:`.
Just to persuade you that FOAF isnt tied to XML, here is a similar FOAF example from Wikipedia, expressed using a format called JSON-LD[5][9]:
```
{
"@context": {
"name": "http://xmlns.com/foaf/0.1/name",
"homepage": {
"@id": "http://xmlns.com/foaf/0.1/workplaceHomepage",
"@type": "@id"
},
"Person": "http://xmlns.com/foaf/0.1/Person"
},
"@id": "https://me.example.com",
"@type": "Person",
"name": "John Smith",
"homepage": "https://www.example.com/"
}
```
This FOAF document describes a person named John Smith with a homepage at `www.example.com`.
Perhaps the best way to get a feel for how FOAF works is to play around with [FOAF-a-matic][10], a web tool for generating FOAF documents. It allows you to enter information about yourself using a web form, then uses that information to create the FOAF document (in XML) that represents you. FOAF-a-matic demonstrates how FOAF could have been used to save everyone from having to enter their social information into a web form ever again—if every social networking site could read FOAF, all youd need to do to sign up for a new site is point the site to the FOAF document that FOAF-a-matic generated for you.
Here is a slightly more complicated FOAF example, representing me, that I created using FOAF-a-matic:
```
<rdf:RDF
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#"
xmlns:foaf="http://xmlns.com/foaf/0.1/"
xmlns:admin="http://webns.net/mvcb/">
<foaf:PersonalProfileDocument rdf:about="">
<foaf:maker rdf:resource="#me"/>
<foaf:primaryTopic rdf:resource="#me"/>
<admin:generatorAgent rdf:resource="http://www.ldodds.com/foaf/foaf-a-matic"/>
<admin:errorReportsTo rdf:resource="mailto:leigh@ldodds.com"/>
</foaf:PersonalProfileDocument>
<foaf:Person rdf:ID="me">
<foaf:name>Sinclair Target</foaf:name>
<foaf:givenname>Sinclair</foaf:givenname>
<foaf:family_name>Target</foaf:family_name>
<foaf:mbox rdf:resource="mailto:sinclairtarget@example.com"/>
<foaf:homepage rdf:resource="sinclairtarget.com"/>
<foaf:knows>
<foaf:Person>
<foaf:name>John Smith</foaf:name>
<foaf:mbox rdf:resource="mailto:johnsmith@example.com"/>
<rdfs:seeAlso rdf:resource="www.example.com/foaf.rdf"/>
</foaf:Person>
</foaf:knows>
</foaf:Person>
</rdf:RDF>
```
This example has quite a lot of preamble setting up the various XML namespaces used by the document. There is also a section containing data about the tool that was used to generate the document, largely so that, it seems, people know whom to email with complaints. The `foaf:Person` element describing me tells you my name, email address, and homepage. There is also a nested `foaf:knows` element telling you that I am friends with John Smith.
This example illustrates another important feature of FOAF documents: They can link to each other. If you remember from the previous example, my friend John Smith has a homepage at `www.example.com`. In this example, where I list John Smith as a `foaf:person` with whom I have a `foaf:knows` relationship, I also provide a `rdfs:seeAlso` element that points to John Smiths FOAF document hosted on his homepage. Because I have provided this link, any program reading my FOAF document could find out more about John Smith by following the link and reading his FOAF document. In the FOAF document we have for John Smith above, John did not provide any information about his friends (including me, meaning, tragically, that our friendship is unidirectional). But if he had, then the program reading my document could find out not only about me but also about John, his friends, their friends, and so on, until the program has crawled the whole social graph that John and I inhabit.
This functionality will seem familiar to anyone that has used Facebook, which is to say that this functionality will seem familiar to you. There is no `foaf:wall` property or `foaf:poke` property to replicate Facebooks feature set exactly. Obviously, there is also no slick blue user interface that everyone can use to visualize their FOAF social network; FOAF is just a vocabulary. But Facebooks core feature—the feature that I have argued is key to Facebooks monopoly power over, at the very least, myself—is here provided in a distributed way. FOAF allows a group of friends to represent their real-life social graph digitally by hosting FOAF documents on their own homepages. It allows them to do this without surrendering control of their data to a centralized database in the sky run by a billionaire android-man who spends much of his time apologizing before congressional committees.
### FOAF on Ice
If you visit the current FOAF project homepage, you will notice that, in the top right corner, there is an image of the character Fry from the TV series Futurama, stuck inside some sort of stasis chamber. This is a still from the pilot episode of Futurama, in which Fry gets frozen in a cryogenic tank in 1999 only to awake a millennium later in 2999. Brickley, whom I messaged briefly on Twitter, told me that he put that image there as a way communicating that the FOAF project is currently “in stasis,” though he hopes that there will be a future opportunity to resuscitate the project along with its early 2000s optimism about how the web should work.
FOAF never revolutionized social networking the way that the 2004 Guardian article about it expected it would. Some social networking sites decided to support the standard: LiveJournal and MyOpera are examples.[6][11] FOAF even played a role in Howard Deans presidential campaign in 2004—a group of bloggers and programmers got together to create a network of websites they called “DeanSpace” to promote the campaign, and these sites used FOAF to keep track of supporters and volunteers.[7][12] But today FOAF is known primarily for being one of the more widely used vocabularies of RDF, itself a niche standard on the modern web. If FOAF is part of your experience of the web today at all, then it is as an ancestor to the technology that powers Googles “knowledge panels” (the little sidebars that tell you the basics about a person or a thing if you searched for something simple). Google uses vocabularies published by the schema.org project—the modern heir to the Semantic Web effort—to populate its knowledge panels.[8][13] The schema.org vocabulary for describing people seems to be somewhat inspired by FOAF and serves many of the same purposes.
So why didnt FOAF succeed? Why do we all use Facebook now instead? Lets ignore that FOAF is a simple standard with nowhere near as many features as Facebook—thats true today, clearly, but if FOAF had enjoyed more momentum its possible that applications could have been built on top of it to deliver a Facebook-like experience. The interesting question is: Why didnt this nascent form of distributed social networking catch fire when Facebook was not yet around to compete with it?
There probably is no single answer to that question, but if I had to pick one, I think the biggest issue is that FOAF only makes sense on a web where everyone has a personal website. In the late 1990s and early 2000s, it might have been easy to assume the web would eventually look like this, especially since so many of the webs early adopters were, as far as I can tell, prolific bloggers or politically engaged technologists excited to have a platform. But the reality is that regular people dont want to have to learn how to host a website. FOAF allows you to control your own social information and broadcast it to social networks instead of filling out endless web forms, which sounds pretty great if you already have somewhere to host that information. But most people in practice found it easier to just fill out the web form and sign up for Facebook than to figure out how to buy a domain and host some XML.
What does this mean for my original question about whether or not Facebooks monopoly is a natural one? I think I have to concede that the FOAF example is evidence that social networking _does_ naturally lend itself to monopoly.
That people did not want to host their own data isnt especially meaningful itself—modern distributed social networks like [Mastodon][14] have solved that problem by letting regular users host their profiles on nodes set up by more savvy users. It is a sign, however, of just how much people hate complexity. This is bad news for decentralized social networks, because they are inherently more complex under the hood than centralized networks in a way that is often impossible to hide from users.
Consider FOAF: If I were to write an application that read FOAF data from personal websites, what would I do if Sallys FOAF document mentions a John Smith with a homepage at `example.com`, and Sues FOAF document mentions a John Smith with a homepage at `example.net`? Are we talking about a single John Smith with two websites or two entirely different John Smiths? What if the both FOAF documents list John Smiths email as `johnsmith@gmail.com`? This issue of identity was an acute one for FOAF. In a 2003 email, Brickley wrote that because there does not exist and probably should not exist a “planet-wide system for identifying people,” the approach taken by FOAF is “pluralistic.”[9][15] Some properties of FOAF people, such as email addresses and homepage addresses, are special in that their values are globally unique. So these different properties can be used to merge (or, as Libby Miller called it, “smoosh”) FOAF documents about people together. But none of these special properties are privileged above the others, so its not obvious how to handle our John Smith case. Do we trust the homepages and conclude we have two different people? Or do we trust the email addresses and conclude we have a single person? Could I really write an application capable of resolving this conflict without involving (and inconveniencing) the user?
Facebook, with its single database and lack of political qualms, could create a “planet-wide system for identifying people” and so just gave every person a unique Facebook ID. Problem solved.
Complexity alone might not doom distributed social networks if people cared about being able to own and control their data. But FOAFs failure to take off demonstrates that people have never valued control very highly. As one blogger has put it, “Users want to own their own data is an ideology, not a use case.”[10][16] If users do not value control enough to stomach additional complexity, and if centralized systems are more simple than distributed ones—and if, further, centralized systems tend to be closed and thus the successful ones enjoy powerful network effects—then social networks are indeed natural monopolies.
That said, I think there is still a distinction to be drawn between the subway system case and the social networking case. I am comfortable with the MTAs monopoly on subway travel because I expect subway systems to be natural monopolies for a long time to come. If there is going to be only one operator of the New York City Subway, then it ought to be the government, which is at least nominally more accountable than a private company with no competitors. But I do not expect social networks to stay natural monopolies. The Subway is carved in granite; the digital world is writ in water. Distributed social networks may now be more complicated than centralized networks in the same way that carrying two MetroCards is more complicated than carrying one. In the future, though, the web, or even the internet, could change in fundamental ways that make distributed technology much easier to use.
If that happens, perhaps FOAF will be remembered as the first attempt to build the kind of social network that humanity, after a brief experiment with corporate mega-databases, does and always will prefer.
_If you enjoyed this post, more like it come out every four weeks! Follow [@TwoBitHistory][17] on Twitter or subscribe to the [RSS feed][18] to make sure you know when a new post is out._
_Previously on TwoBitHistory…_
> I know it's been too long since my last post, but my new one is here! I wrote almost 5000 words on John Carmack, Doom, and the history of the binary space partitioning tree.<https://t.co/SVunDZ0hZ1>
>
> — TwoBitHistory (@TwoBitHistory) [November 6, 2019][19]
1. Please note that I did not dare say “dead.” [↩︎][20]
2. Jack Schofield, “Lets be Friendsters,” The Guardian, February 19, 2004, accessed January 5, 2020, <https://www.theguardian.com/technology/2004/feb/19/newmedia.media>. [↩︎][21]
3. Dan Brickley and Libby Miller, “Introducing FOAF,” FOAF Project, 2008, accessed January 5, 2020, <https://web.archive.org/web/20140331104046/http://www.foaf-project.org/original-intro>. [↩︎][22]
4. ibid. [↩︎][23]
5. Wikipedia contributors, “JSON-LD,” Wikipedia: The Free Encyclopedia, December 13, 2019, accessed January 5, 2020, <https://en.wikipedia.org/wiki/JSON-LD>. [↩︎][24]
6. “Data Sources,” FOAF Project Wiki, December 11 2009, accessed January 5, 2020, <https://web.archive.org/web/20100226072731/http://wiki.foaf-project.org/w/DataSources>. [↩︎][25]
7. Aldon Hynes, “What is Dean Space?”, Extreme Democracy, accessed January 5, 2020, <http://www.extremedemocracy.com/chapters/Chapter18-Hynes.pdf>. [↩︎][26]
8. “Understand how structured data works,” Google Developer Portal, accessed January 5, 2020, <https://developers.google.com/search/docs/guides/intro-structured-data>. [↩︎][27]
9. tef, “Why your distributed network will not work,” Progamming is Terrible, January 2, 2013, <https://programmingisterrible.com/post/39438834308/distributed-social-network>. [↩︎][28]
10. Dan Brickley, “Identifying things in FOAF,” rdfweb-dev Mailing List, July 10, 2003, accessed on January 5, 2020, <http://lists.foaf-project.org/pipermail/foaf-dev/2003-July/005463.html>. [↩︎][29]
--------------------------------------------------------------------------------
via: https://twobithistory.org/2020/01/05/foaf.html
作者:[Two-Bit History][a]
选题:[lujun9972][b]
译者:[译者ID](https://github.com/译者ID)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://twobithistory.org
[b]: https://github.com/lujun9972
[1]: tmp.k5HszJyQ4D#fn:1
[2]: https://en.wikipedia.org/wiki/Fediverse
[3]: https://en.wikipedia.org/wiki/Prodigy_(online_service)
[4]: https://twobithistory.org/2018/05/27/semantic-web.html
[5]: https://www.ftrain.com/google_takes_all
[6]: tmp.k5HszJyQ4D#fn:2
[7]: tmp.k5HszJyQ4D#fn:3
[8]: tmp.k5HszJyQ4D#fn:4
[9]: tmp.k5HszJyQ4D#fn:5
[10]: http://www.ldodds.com/foaf/foaf-a-matic
[11]: tmp.k5HszJyQ4D#fn:6
[12]: tmp.k5HszJyQ4D#fn:7
[13]: tmp.k5HszJyQ4D#fn:8
[14]: https://en.wikipedia.org/wiki/Mastodon_(software)
[15]: tmp.k5HszJyQ4D#fn:9
[16]: tmp.k5HszJyQ4D#fn:10
[17]: https://twitter.com/TwoBitHistory
[18]: https://twobithistory.org/feed.xml
[19]: https://twitter.com/TwoBitHistory/status/1192196764239093760?ref_src=twsrc%5Etfw
[20]: tmp.k5HszJyQ4D#fnref:1
[21]: tmp.k5HszJyQ4D#fnref:2
[22]: tmp.k5HszJyQ4D#fnref:3
[23]: tmp.k5HszJyQ4D#fnref:4
[24]: tmp.k5HszJyQ4D#fnref:5
[25]: tmp.k5HszJyQ4D#fnref:6
[26]: tmp.k5HszJyQ4D#fnref:7
[27]: tmp.k5HszJyQ4D#fnref:8
[28]: tmp.k5HszJyQ4D#fnref:9
[29]: tmp.k5HszJyQ4D#fnref:10

View File

@ -0,0 +1,69 @@
[#]: collector: (lujun9972)
[#]: translator: ( )
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )
[#]: subject: (Open Source Supply Chain: A Matter of Trust)
[#]: via: (https://www.linux.com/articles/open-source-supply-chain-a-matter-of-trust/)
[#]: author: (Swapnil Bhartiya https://www.linux.com/author/swapnil/)
Open Source Supply Chain: A Matter of Trust
======
[![][1]][2]
_**Co-authored by Curtis Franklin, Jr**_
Open source software is often considered safer and more secure than proprietary software because users can, if they want, compile the software from the source code. They know the source of the code running in their environment.  Every component that they are running in their environment can be audited and the developer held accountable.  
However, users and vendors are moving away from complexity that comes with total control and embracing convenience and ease of use.
“I am often taken aback when I see a talk around security and privacy and then the presenter runs the docker run command to install and run some random binary downloaded from the internet,” said [Dirk Hohndel, Vice-President and Chief Open Source Officer at VMware.][3] “Those two things seem to be a little bit at odds with each other.”
The software supply chain — the process that takes an application from coding through packaging and distribution to its ultimate user — is complicated. If done wrong, it could be potentially risky, especially for open source software.  A malevolent player can get access to the backend and start inserting any random binary code onto a users system without that users knowledge or control.
Its not a problem specific to the cloud-native world. It can be seen in modern app development environments, including JavaScript, npm, PyPI, RubyGems, and so on.  Even Homebrew on Mac used to be provided through source code that a user would compile themselves. 
“Today, you just download the binary and install it, hoping that its built from the same source code that you have access to,” said Hohndel. “As an industry, we need to pay more attention to our supply chain.  Its something that is extremely important to me and that Im trying to get more people interested in it.” 
Its not simply a binary versus source code equation, though. There are huge advantages to just running a binary instead of having to build everything from sources.   It allows developers to be more flexible and more responsive in their turnaround. They can cycle very quickly through new development and product releases by reusing some binaries.
“It would be nice if there was a way to sign these binaries and have an on-the-fly verification mechanism so users know they can trust these,” said Hohndel.
Linux distributions have solved this problem as the distributions act as gatekeepers who check the integrity of packages that go into supported repositories. 
“Packages offered through distributions like Debian are signed with a key. It takes a lot of work to ensure that this is really the software that should be in the distribution. They have solved the supply chain problem,” said Hohndel.
But even on Linux distribution, people want to simplify things and trade correctness and security for speed. There are now projects like AppImage, Snap and Flatpack that have adopted the binary route, bringing the trust issue to Linux distributions. Its the same problem of docker containers all over again.
“The ideal solution would be to find a way for us as a community to devise a system of trust which ensures that if a binary was signed with a key that is in the network of trust, it can be trusted and provides us with the ability to reliably go back to the sources and do an audit,” suggested Hohndel.
However, all this additional steps incur costs that most projects are either unwilling or unable to afford. Some projects are trying to find ways around the problem. NPM, for example, has begun to encourage those submitting packages to properly authenticate and secure their accounts to improve trustworthiness on the platform. 
**Open Source Community Is Good At Solving Problems**
Hohndel is involved with many efforts to solve the open source supply chain problem and is spreading awareness about it. Last year, [VMware acquired Bitnami,][4] which is a great place for curating open source applications that are signed by VMware. 
“We are talking with upstream open source communities in various ecosystems to raise awareness about it. We are also discussing technical solutions that will make it easier for these communities to solve the underlying problems,” said Hohndel.
The open source community has historically been diligent at ensuring software quality, including the mechanisms for security and privacy. Still, Hohndel says, “The biggest concern that I have is that, in the excitement about the next new thing, we often ignore the underlying engineering discipline that we really need.”
Ultimately, Hohndel feels that answer will come from the open source community itself. “Open source is an engineering methodology and its a social experiment. Open source is all about people trusting each other, working with each other, collaborating across borders, between companies, amongst competitors in ways that we didnt do before,” he explains.
--------------------------------------------------------------------------------
via: https://www.linux.com/articles/open-source-supply-chain-a-matter-of-trust/
作者:[Swapnil Bhartiya][a]
选题:[lujun9972][b]
译者:[译者ID](https://github.com/译者ID)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://www.linux.com/author/swapnil/
[b]: https://github.com/lujun9972
[1]: https://www.linux.com/wp-content/uploads/2020/01/hand-1137978_1920-1068x801.jpg (hand-1137978_1920)
[2]: https://www.linux.com/wp-content/uploads/2020/01/hand-1137978_1920.jpg
[3]: https://www.swapnilbhartiya.com/open-source-leaders-dirk-hohndel-brings-open-source-to-vmware/
[4]: https://techcrunch.com/2019/05/15/vmware-acquires-bitnami-to-deliver-packaged-applications-anywhere/

View File

@ -1,3 +1,5 @@
summer2233 is translating
Excellent Business Software Alternatives For Linux
-------

View File

@ -1,3 +1,5 @@
Translating by MjSeven
Advanced use of the less text file viewer in Linux
======

View File

@ -1,234 +0,0 @@
[#]: collector: (lujun9972)
[#]: translator: ( )
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )
[#]: subject: (File sharing with Git)
[#]: via: (https://opensource.com/article/19/4/file-sharing-git)
[#]: author: (Seth Kenlon https://opensource.com/users/seth)
File sharing with Git
======
SparkleShare is an open source, Git-based, Dropbox-style file sharing
application. Learn more in our series about little-known uses of Git.
![][1]
[Git][2] is one of those rare applications that has managed to encapsulate so much of modern computing into one program that it ends up serving as the computational engine for many other applications. While it's best-known for tracking source code changes in software development, it has many other uses that can make your life easier and more organized. In this series leading up to Git's 14th anniversary on April 7, we'll share seven little-known ways to use Git. Today, we'll look at SparkleShare, which uses Git as the backbone for file sharing.
### Git for file sharing
One of the nice things about Git is that it's inherently distributed. It's built to share. Even if you're sharing a repository just with other computers on your own network, Git brings transparency to the act of getting files from a shared location.
As interfaces go, Git is pretty simple. It varies from user to user, but the common incantation when sitting down to get some work done is just **git pull** or maybe the slightly more complex **git pull && git checkout -b my-branch**. Still, for some people, the idea of _entering a command_ into their computer at all is confusing or bothersome. Computers are meant to make life easy, and computers are good at repetitious tasks, and so there are easier ways to share files with Git.
### SparkleShare
The [SparkleShare][3] project is a cross-platform, open source, Dropbox-style file sharing application based on Git. It automates all Git commands, triggering the add, commit, push, and pull processes with the simple act of dragging-and-dropping a file into a specially designated SparkleShare directory. Because it is based on Git, you get fast, diff-based pushes and pulls, and you inherit all the benefits of Git version control and backend infrastructure (like Git hooks). It can be entirely self-hosted, or you can use it with Git hosting services like [GitLab][4], GitHub, Bitbucket, and others. Furthermore, because it's basically just a frontend to Git, you can access your SparkleShare files on devices that may not have a SparkleShare client but do have Git clients.
Just as you get all the benefits of Git, you also get all the usual Git restrictions: It's impractical to use SparkleShare to store hundreds of photos and music and videos because Git is designed and optimized for text. Git certainly has the capability to store large files of binary data but it is designed to track history, so once a file is added to it, it's nearly impossible to completely remove it. This somewhat limits the usefulness of SparkleShare for some people, but it makes it ideal for many workflows, including [calendaring][5].
#### Installing SparkleShare
SparkleShare is cross-platform, with installers for Windows and Mac available from its [website][6]. For Linux, there's a [Flatpak][7] in your software installer, or you can run these commands in a terminal:
```
$ sudo flatpak remote-add flathub <https://flathub.org/repo/flathub.flatpakrepo>
$ sudo flatpak install flathub org.sparkleshare.SparkleShare
```
### Creating a Git repository
SparkleShare isn't software-as-a-service (SaaS). You run SparkleShare on your computer to communicate with a Git repository—SparkleShare doesn't store your data. If you don't have a Git repository to sync a folder with yet, you must create one before launching SparkleShare. You have three options: hosted Git, self-hosted Git, or self-hosted SparkleShare.
#### Git hosting
SparkleShare can use any Git repository you can access for storage, so if you have or create an account with GitLab or any other hosting service, it can become the backend for your SparkleShare. For example, the open source [Notabug.org][8] service is a Git hosting service like GitHub and GitLab, but unique enough to prove SparkleShare's flexibility. Creating a new repository differs from host to host depending on the user interface, but all of the major ones follow the same general model.
First, locate the button in your hosting service to create a new project or repository and click on it to begin. Then step through the repository creation process, providing a name for your repository, privacy level (repositories often default to being public), and whether or not to initialize the repository with a README file. Whether you need a README or not, enable an initial README file. Starting a repository with a file isn't strictly necessary, but it forces the Git host to instantiate a **master** branch in the repository, which helps ensure that frontend applications like SparkleShare have a branch to commit and push to. It's also useful for you to see a file, even if it's an almost empty README file, to confirm that you have connected.
![Creating a Git repository][9]
Once you've created a repository, obtain the URL it uses for SSH clones. You can get this URL the same way anyone gets any URL for a Git project: navigate to the page of the repository and look for the **Clone** button or field.
![Cloning a URL on GitHub][10]
Cloning a GitHub URL.
![Cloning a URL on GitLab][11]
Cloning a GitLab URL.
This is the address SparkleShare uses to reach your data, so make note of it. Your Git repository is now configured.
#### Self-hosted Git
You can use SparkleShare to access a Git repository on any computer you have access to. No special setup is required, aside from a bare Git repository. However, if you want to give access to your Git repository to anyone else, then you should run a Git manager like [Gitolite][12] or SparkleShare's own Dazzle server to help you manage SSH keys and accounts. At the very least, create a user specific to Git so that users with access to your Git repository don't also automatically gain access to the rest of your server.
Log into your server as the Git user (or yourself, if you're very good at managing user and group permissions) and create a repository:
```
$ mkdir ~/sparkly.git
$ cd ~/sparkly.git
$ git init --bare .
```
Your Git repository is now configured.
#### Dazzle
SparkleShare's developers provide a Git management system called [Dazzle][13] to help you self-host Git repositories.
On your server, download the Dazzle application to some location in your path:
```
$ curl <https://raw.githubusercontent.com/hbons/Dazzle/master/dazzle.sh> \
\--output ~/bin/dazzle
$ chmod +x ~/bin/dazzle
```
Dazzle sets up a user specific to Git and SparkleShare and also implements access rights based on keys generated by the SparkleShare application. For now, just set up a project:
```
`$ dazzle create sparkly`
```
Your server is now configured as a SparkleShare host.
### Configuring SparkleShare
When you launch SparkleShare for the first time, you are prompted to configure what server you want SparkleShare to use for storage. This process may feel like a first-run setup wizard, but it's actually the usual process for setting up a new shared location within SparkleShare. Unlike many shared drive applications, with SparkleShare you can have several locations configured at once. The first shared location you configure isn't any more significant than any shared location you may set up later, and you're not signing up with SparkleShare or any other service. You're just pointing SparkleShare at a Git repository so that it knows what to keep your first SparkleShare folder in sync with.
On the first screen, identify yourself by whatever means you want on record in the Git commits that SparkleShare makes on your behalf. You can use anything, even fake information that resolves to nothing. It's purely for the commit messages, which you may never even see if you have no interest in reviewing the Git backend processes.
The next screen prompts you to choose your hosting type. If you are using GitLab, GitHub, Planio, or Bitbucket, then select the appropriate one. For anything else, select **Own server**.
![Choosing a Sparkleshare host][14]
At the bottom of this screen, you must enter the SSH clone URL. If you're self-hosting, the address is something like **<ssh://username@example.com>** and the remote path is the absolute path to the Git repository you created for this purpose.
Based on my self-hosted examples above, the address to my imaginary server is **<ssh://git@example.com:22122>** (the **:22122** indicates a nonstandard SSH port) and the remote path is **/home/git/sparkly.git**.
If I use my Notabug.org account instead, the address from the example above is **[git@notabug.org][15]** and the path is **seth/sparkly.git**.
SparkleShare will fail the first time it attempts to connect to the host because you have not yet copied the SparkleShare client ID (an SSH key specific to the SparkleShare application) to the Git host. This is expected, so don't cancel the process. Leave the SparkleShare setup window open and obtain the client ID from the SparkleShare icon in your system tray. Then copy the client ID to your clipboard so you can add it to your Git host.
![Getting the client ID from Sparkleshare][16]
#### Adding your client ID to a hosted Git account
Minor UI differences aside, adding an SSH key (which is all the client ID is) is basically the same process on any hosting service. In your Git host's web dashboard, navigate to your user settings and find the **SSH Keys** category. Click the **Add New Key** button (or similar) and paste the contents of your SparkleShare client ID.
![Adding an SSH key][17]
Save the key. If you want someone else, such as collaborators or family members, to be able to access this same repository, they must provide you with their SparkleShare client ID so you can add it to your account.
#### Adding your client ID to a self-hosted Git account
A SparkleShare client ID is just an SSH key, so copy and paste it into your Git user's **~/.ssh/authorized_keys** file.
#### Adding your client ID with Dazzle
If you are using Dazzle to manage your SparkleShare projects, add a client ID with this command:
```
`$ dazzle link`
```
When Dazzle prompts you for the ID, paste in the client ID found in the SparkleShare menu.
### Using SparkleShare
Once you've added your client ID to your Git host, click the **Retry** button in the SparkleShare window to finish setup. When it's finished cloning your repository, you can close the SparkleShare setup window, and you'll find a new **SparkleShare** folder in your home directory. If you set up a Git repository with a hosting service and chose to include a README or license file, you can see them in your SparkleShare directory.
![Sparkleshare file manager][18]
Otherwise, there are some hidden directories, which you can see by revealing hidden directories in your file manager.
![Showing hidden files in GNOME][19]
You use SparkleShare the same way you use any directory on your computer: you put files into it. Anytime a file or directory is placed into a SparkleShare folder, it's copied in the background to your Git repository.
#### Excluding certain files
Since Git is designed to remember _everything_ , you may want to exclude specific file types from ever being recorded. There are a few reasons to manage excluded files. By defining files that are off limits for SparkleShare, you can avoid accidental copying of large files. You can also design a scheme for yourself that enables you to store files that logically belong together (MIDI files with their **.flac** exports, for instance) in one directory, but manually back up the large files yourself while letting SparkleShare back up the text-based files.
If you can't see hidden files in your system's file manager, then reveal them. Navigate to your SparkleShare folder, then to the directory representing your repository, locate a file called **.gitignore** , and open it in a text editor. You can enter file extensions or file names, one per line, into **.gitignore** , and any file matching what you list will be (as the file name suggests) ignored.
```
Thumbs.db
$RECYCLE.BIN/
.DS_Store
._*
.fseventsd
.Spotlight-V100
.Trashes
.directory
.Trash-*
*.wav
*.ogg
*.flac
*.mp3
*.m4a
*.opus
*.jpg
*.png
*.mp4
*.mov
*.mkv
*.avi
*.pdf
*.djvu
*.epub
*.od{s,t}
*.cbz
```
You know the types of files you encounter most often, so concentrate on the ones most likely to sneak their way into your SparkleShare directory. If you want to exercise a little overkill, you can find good collections of **.gitignore** files on Notabug.org and also on the internet at large.
With those entries in your **.gitignore** file, you can place large files that you don't want sent to your Git host in your SparkleShare directory, and SparkleShare will ignore them entirely. Of course, that means it's up to you to make sure they get onto a backup or distributed to your SparkleShare collaborators through some other means.
### Automation
[Automation][20] is part of the silent agreement we have with computers: they do the repetitious, boring stuff that we humans either aren't very good at doing or aren't very good at remembering. SparkleShare is a nice, simple way to automate the routine distribution of data. It isn't right for every Git repository, by any means. It doesn't have an interface for advanced Git functions; it doesn't have a pause button or a manual override. And that's OK because its scope is intentionally limited. SparkleShare does what SparkleShare sets out to do, it does it well, and it's one Git repository you won't have to think about.
If you have a use for that kind of steady, invisible automation, give SparkleShare a try.
--------------------------------------------------------------------------------
via: https://opensource.com/article/19/4/file-sharing-git
作者:[Seth Kenlon (Red Hat, Community Moderator)][a]
选题:[lujun9972][b]
译者:[译者ID](https://github.com/译者ID)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://opensource.com/users/seth
[b]: https://github.com/lujun9972
[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/rh_003499_01_cloud21x_cc.png?itok=5UwC92dO
[2]: https://git-scm.com/
[3]: http://www.sparkleshare.org/
[4]: http://gitlab.com
[5]: https://opensource.com/article/19/4/calendar-git
[6]: http://sparkleshare.org
[7]: /business/16/8/flatpak
[8]: http://notabug.org
[9]: https://opensource.com/sites/default/files/uploads/git-new-repo.jpg (Creating a Git repository)
[10]: https://opensource.com/sites/default/files/uploads/github-clone-url.jpg (Cloning a URL on GitHub)
[11]: https://opensource.com/sites/default/files/uploads/gitlab-clone-url.jpg (Cloning a URL on GitLab)
[12]: http://gitolite.org
[13]: https://github.com/hbons/Dazzle
[14]: https://opensource.com/sites/default/files/uploads/sparkleshare-host.jpg (Choosing a Sparkleshare host)
[15]: mailto:git@notabug.org
[16]: https://opensource.com/sites/default/files/uploads/sparkleshare-clientid.jpg (Getting the client ID from Sparkleshare)
[17]: https://opensource.com/sites/default/files/uploads/git-ssh-key.jpg (Adding an SSH key)
[18]: https://opensource.com/sites/default/files/uploads/sparkleshare-file-manager.jpg (Sparkleshare file manager)
[19]: https://opensource.com/sites/default/files/uploads/gnome-show-hidden-files.jpg (Showing hidden files in GNOME)
[20]: /downloads/ansible-quickstart

View File

@ -1,5 +1,5 @@
[#]: collector: (lujun9972)
[#]: translator: ( )
[#]: translator: (robsean)
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )

View File

@ -1,247 +0,0 @@
[#]: collector: (lujun9972)
[#]: translator: (MjSeven)
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )
[#]: subject: (How to write a Python web API with Django)
[#]: via: (https://opensource.com/article/19/11/python-web-api-django)
[#]: author: (Rachel Waston https://opensource.com/users/rachelwaston)
How to write a Python web API with Django
======
Django is one of the most popular frameworks for Python API development.
Learn how to use it in this quick tutorial.
![Hands on a keyboard with a Python book ][1]
[Django][2] is the comprehensive web framework by which all other frameworks are measured. One of the most popular names in Python API development, Django has surged in popularity since its start in 2005.
Django is maintained by the Django Software Foundation and has experienced great community support, with over 11,600 members worldwide. On Stack Overflow, Django has around 191,000 tagged questions. Websites like Spotify, YouTube, and Instagram rely on Django for application and data management.
This article demonstrates a simple API to fetch data from a server using the GET method of the HTTP protocol.
### Set up a project
First, create a structure for your Django application; you can do this at any location on your system:
```
$ mkdir myproject
$ cd myproject
```
Then, create a virtual environment to isolate package dependencies locally within the project directory:
```
$ python3 -m venv env
$ source env/bin/activate
```
On Windows, use the command **env\Scripts\activate** to activate your Python virtual environment.
### Install Django and the Django REST framework
Next, install the Python modules for Django and Django REST:
```
$ pip3 install django
$ pip3 install djangorestframework
```
### Instantiate a new Django project
Now that you have a work environment for your app, you must instantiate a new Django project. Unlike a minimal framework like [Flask][3], Django includes dedicated commands for this process (note the trailing **.** character in the first command):
```
$ django-admin startproject tutorial .
$ cd tutorial
$ django-admin startapp quickstart
```
Django uses a database as its backend, so you should sync your database before beginning development. The database can be managed with the **manage.py** script that was created when you ran the **django-admin** command. Because you're currently in the **tutorial** directory, use the **../** notation to run the script, located one directory up:
```
$ python3 ../manage.py makemigrations
No changes detected
$ python4 ../manage.py migrate
Operations to perform:
  Apply all migrations: admin, auth, contenttypes, sessions
Running migrations:
  Applying contenttypes.0001_initial... OK
  Applying auth.0001_initial... OK
  Applying admin.0001_initial... OK
  Applying admin.0002_logentry_remove_auto_add... OK
  Applying admin.0003_logentry_add_action_flag_choices... OK
  Applying contenttypes.0002_remove_content_type_name... OK
  Applying auth.0002_alter_permission_name_max_length... OK
  Applying auth.0003_alter_user_email_max_length... OK
  Applying auth.0004_alter_user_username_opts... OK
  Applying auth.0005_alter_user_last_login_null... OK
  Applying auth.0006_require_contenttypes_0002... OK
  Applying auth.0007_alter_validators_add_error_messages... OK
  Applying auth.0008_alter_user_username_max_length... OK
  Applying auth.0009_alter_user_last_name_max_length... OK
  Applying auth.0010_alter_group_name_max_length... OK
  Applying auth.0011_update_proxy_permissions... OK
  Applying sessions.0001_initial... OK
```
### Create users in Django
Create an initial user named **admin** with the example password of **password123**:
```
$ python3 ../manage.py createsuperuser \
  --email [admin@example.com][4] \
  --username admin
```
Create a password when you're prompted.
### Implement serializers and views in Django
For Django to be able to pass information over to an HTTP GET request, the information object must be translated into valid response data. Django implements **serializers** for this.
In your project, define some serializers by creating a new module named **quickstart/serializers.py**, which you'll use for data representations:
```
from django.contrib.auth.models import User, Group
from rest_framework import serializers
class UserSerializer(serializers.HyperlinkedModelSerializer):
    class Meta:
        model = User
        fields = ['url', 'username', 'email', 'groups']
class GroupSerializer(serializers.HyperlinkedModelSerializer):
    class Meta:
        model = Group
        fields = ['url', 'name']
```
A [view][5] in Django is a function that takes a web request and returns a web response. The response can be HTML, or an HTTP redirect, or an HTTP error, a JSON or XML document, an image or TAR file, or anything else you can get over the internet. To create a view, open **quickstart/views.py** and enter the following code. This file already exists and has some boilerplate text in it, so keep that and append this text to the file:
```
from django.contrib.auth.models import User, Group
from rest_framework import viewsets
from tutorial.quickstart.serializers import UserSerializer, GroupSerializer
class UserViewSet(viewsets.ModelViewSet):
    """
    API endpoint  allows users to be viewed or edited.
    """
    queryset = User.objects.all().order_by('-date_joined')
    serializer_class = UserSerializer
class GroupViewSet(viewsets.ModelViewSet):
    """
    API endpoint  allows groups to be viewed or edited.
    """
    queryset = Group.objects.all()
    serializer_class = GroupSerializer
```
### Generate URLs with Django
Now you can generate URLs so people can access your fledgling API. Open **urls.py** in a text editor and replace the default sample code with this code:
```
from django.urls import include, path
from rest_framework import routers
from tutorial.quickstart import views
router = routers.DefaultRouter()
router.register(r'users', views.UserViewSet)
router.register(r'groups', views.GroupViewSet)
# Use automatic URL routing
# Can also include login URLs for the browsable API
urlpatterns = [
    path('', include(router.urls)),
    path('api-auth/', include('rest_framework.urls', namespace='rest_framework'))
]
```
### Adjust your Django project settings
The settings module for this example project is stored in **tutorial/settings.py**, so open that in a text editor and add **rest_framework** to the end of the **INSTALLED_APPS** list:
```
INSTALLED_APPS = [
    ...
    'rest_framework',
]
```
### Test your Django API
You're now ready to test the API you've built. First, start up the built-in server from the command line:
```
`$ python3 manage.py runserver`
```
You can access your API by navigating to the URL **<http://localhost:8000/users>** using **curl**:
```
$ curl --get <http://localhost:8000/users/?format=json>
[{"url":"<http://localhost:8000/users/1/?format=json","username":"admin","email":"admin@example.com","groups":\[\]}\]>
```
Or use Firefox or the [open source web browser][6] of your choice:
![A simple Django API][7]
For more in-depth knowledge about RESTful APIs using Django and Python, see the excellent [Django documentation][8].
### Why should I use Django?
The major benefits of Django:
1. The size of the Django community is ever-growing, so you have lots of resources for guidance, even on a complicated project.
2. Features like templating, routing, forms, authentication, and management tools are included by default. You don't have to hunt for external tools or worry about third-party tools introducing compatibility issues.
3. Simple constructs for users, loops, and conditions allow you to focus on writing code.
4. It's a mature and optimized framework that is extremely fast and reliable.
The major drawbacks of Django are:
1. Django is complex! From a developer's point of view, Django can be trickier to learn than a simpler framework.
2. There's a big ecosystem around Django. This is great once you're comfortable with Django, but it can be overwhelming when you're still learning.
Django is a great option for your application or API. Download it, get familiar with it, and start developing an amazing project!
--------------------------------------------------------------------------------
via: https://opensource.com/article/19/11/python-web-api-django
作者:[Rachel Waston][a]
选题:[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/rachelwaston
[b]: https://github.com/lujun9972
[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/python-programming-code-keyboard.png?itok=fxiSpmnd (Hands on a keyboard with a Python book )
[2]: https://www.djangoproject.com/
[3]: https://opensource.com/article/19/11/python-web-api-flask
[4]: mailto:admin@example.com
[5]: https://docs.djangoproject.com/en/2.2/topics/http/views/
[6]: https://opensource.com/article/19/7/open-source-browsers
[7]: https://opensource.com/sites/default/files/uploads/django-api.png (A simple Django API)
[8]: https://docs.djangoproject.com/en/2.2

View File

@ -1,185 +0,0 @@
[#]: collector: (lujun9972)
[#]: translator: ( )
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )
[#]: subject: (7 maker gifts for kids and teens)
[#]: via: (https://opensource.com/article/19/11/maker-gifts-kids)
[#]: author: (Jess Weichler https://opensource.com/users/cyanide-cupcake)
7 maker gifts for kids and teens
======
Make your holiday gift shopping easy with this guide to gifts sure to
spark creativity and innovation in babies, kids, tweens, teens, and
beyond.
![Gift box opens with colors coming out][1]
Struggling with what gifts to give the young person in your life this holiday season? Here are my top picks for open source presents that will spark creativity and inspire for years to come.
### Hummingbird Robotics Kit
![Hummingbird Robotics Kit][2]
**Ages**: 8 to adult
**What it is:** The [Hummingbird Robotics Kit][3] is a complete robotics kit with a microcontroller, motors, LEDs, and sensors. The robot brain has special ports that little hands can easily attach robot components to. The Hummingbird kits don't come with a body, empowering users to create their own.
**Why I love it:** The Hummingbird works with multiple programming languages—from visual (BirdBlox, MakeCode, Snap) to text (Python and Java)— making it scalable as users' coding skills increase. All the components are exactly as you'd find them at an electronics store, not obscured by plastic like other robot kits. This demystifies the inner workings of robots and makes it easy to source more parts if needed.
Because there is no set project, the Hummingbird is the perfect robot for creativity.
The Hummingbird Bit has open source software and firmware. It works on Linux, Windows, Mac, Chromebook, Android, and iOS.
**Cost:** Starts at US$ 99.
### Makey Makey Classic
![Makey Makey Classic][4]
**Ages:** 6 to adult
**What it is:** [Makey Makey Classic][5] turns any conductive object, from marshmallows to a friend, into a computer key.
You use alligator clips to connect the Makey Makey to the conductive object of your choice. Then, you close the circuit between the ground connection and any trigger key by touching both conductive objects at the same time. The Makey Makey is a good way to safely explore electricity at home while creating interesting ways to interact with your computer.
**Why I love it:** Makey Makey can be paired with video games made in Scratch to create unique controllers that further immerse users in the game. The possibilities are endless, from instruments made of toilet rolls and foil to interactive art and stories. It works on Linux, Windows, and Mac computers with a USB port.
**Cost:** US$ 49.95
### Arduino Uno
![Arduino Uno][6]
**Ages**: 10 to adult
**What it is:** Arduinos are microcontrollers that can be purchased with or without an electronics kit, and they come in many different flavors, though I like the [Arduino Uno][7] the best. Additional components, such as LEDs, motors, and sensors can be purchased as needed from any electronics shop.
**Why I love it:** The Arduino Uno is well-documented, so it's easy for makers to find tutorials online. The Arduino can bring a wide variety of electronic projects to life, from simple to complex. The Arduino features open source firmware and hardware. It works on Linux, Mac, and Windows.
**Cost:** Starts at US$ 22.00 for the board. The overall cost varies depending on projects and skill level.
### DIY maker kit
![A maker kit assembled in a quick trip to the hardware store][8]
**Ages**: 8 to adult
**What it is:** Many of today's makers, creators, and programmers started out tinkering with objects that happened to be lying around. You can create an awesome maker kit for the young person in your life with a quick trip to the nearest electronics store. Here's what's in my maker kit:
* Eye goggles
* Hammer
* Nails and screws
* Scraps of wood
* Screwdrivers
* Wire
* LEDs
* Piezo buzzer
* Motors
* AA battery pack with leads
* Wire cutters
* Cardboard
* Masking tape
* Scrap fabric
* Buttons
* Thread
* Needles
* Zippers
* Hooks
* A cool tackle box to store everything in
**Why I love it: **Remember when you were a kid and your parents brought home an empty cardboard box that you turned into a spaceship or a house or a supercomputer? That's what a DIY maker kit can be for older kids.
Raw components empower kids to experiment and use their imaginations. A DIY maker kit can be completely customized for the recipient. Be sure to throw in some components the giftee may have never thought to create with, like giving an avid sewer some LEDs or a woodworker fabric.
**Cost:** Variable
### Heuristic play basket
![Heuristic play kit][9]
**Ages:** 8 months to 5 years
**What it is:** Heuristic play baskets are filled with interesting objects made from natural, non-toxic materials for infants and toddlers to explore using their five senses. It's open-ended, self-directed play at its best. The idea is that an adult will supervise (but not direct) a child's use of the basket and its items for a half-hour, then put the basket away until the next time.
It's easy to create a lovely play basket with common household objects. Try to include items with varying textures, sounds, smells, shapes, and weights. Here are some ideas to get you started.
* Colander or ridged wicker basket to hold everything
* Wooden spoon
* Metal whisks and spoons
* Scrubbing brush
* Sponge
* Small egg carton
* Cardboard tubes
* Small rolling pin
* Textured washcloth
* Rocks
* Handbells
* Crochet doily
* Small tin with a lid
Play baskets should not include anything easily breakable or small enough to fit inside a paper towel roll, as these are choking hazards, and all objects should be cleaned thoroughly before being given to a child.
**Why I love it:** Play baskets are fantastic for sensory development and helping young children ask questions and explore the world around them. This is an important part of developing a maker mindset!
It's easy to obtain suitable items for a play basket; you probably already have many interesting objects in your home or at your nearest second-hand store. Toddlers will use their play baskets differently than infants. These objects will grow with children as they begin to mimic adult life and tell stories through their play.
**Cost:** Variable
### Hello Ruby
![Hello Ruby book cover][10]
**Ages**: 58
**What it is:** _[Hello Ruby][11]: Adventures in Coding_ is an illustrated book by Linda Liukas that introduces children to programming concepts through a fun narrative about a girl who encounters problems and friends, each of which represents code. Liukas' other _Hello Ruby_ books are subtitled _Expedition to the Internet_ and _Journey Inside the Computer_, and _Adventures in Coding_ has been published in more than 20 languages.
**Why I love it:** The author accompanies the book with a number of free, fun, and unplugged activities that can be downloaded and printed out from the Hello Ruby website. These activities teach coding concepts and also touch on artistic expression, communication, and even time management.
**Cost:** List price for the hardcover book is US$ 17.99, but you may find it at a lower price through local or online booksellers.
### Girls Who Code: Learn to Code and Change the World
![Girls Who Code book cover][12]
**Ages**: 10 to adult
**What it is:** Written by Reshma Saujani, the founder of Girls Who Code, _[Girls Who Code: Learn to Code and Change the World][13]_ gives practical information about the tech world for young girls (and boys). It covers a wide variety of topics, including coding languages, use-cases, terminology and vocabulary, career options, and profiles and interviews with people in the tech industry.
**Why I love it:** This book tells the story of tech in ways even most websites meant for adults miss out on. Technology encompasses so many disciplines, and it's important for young people to understand they can use it to solve real-world problems and make a difference.
**Cost:** List price for the hardcover book is US$ 17.99 and US$ 10.99 for the paperback, but you may find it at a lower price through local or online booksellers.
I can see the brightness of curiosity in my six year old niece Shuchi's eyes when she explores a...
Scratch is a free educational programming language for kids, available in 50 different languages...
--------------------------------------------------------------------------------
via: https://opensource.com/article/19/11/maker-gifts-kids
作者:[Jess Weichler][a]
选题:[lujun9972][b]
译者:[译者ID](https://github.com/译者ID)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://opensource.com/users/cyanide-cupcake
[b]: https://github.com/lujun9972
[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/OSDC_gift_giveaway_box_520x292.png?itok=w1YQhNH1 (Gift box opens with colors coming out)
[2]: https://opensource.com/sites/default/files/uploads/hummingbird.png (Hummingbird Robotics Kit)
[3]: https://www.birdbraintechnologies.com/hummingbirdbit/
[4]: https://opensource.com/sites/default/files/uploads/makeymakey2.jpg (Makey Makey Classic)
[5]: https://makeymakey.com/
[6]: https://opensource.com/sites/default/files/uploads/arduinouno.jpg (Arduino Uno)
[7]: https://www.arduino.cc/
[8]: https://opensource.com/sites/default/files/makerbox-makerkit.jpg (A maker kit assembled in a quick trip to the hardware store)
[9]: https://opensource.com/sites/default/files/makerbox-sensorykit.jpg (Heuristic play kit)
[10]: https://opensource.com/sites/default/files/uploads/helloruby2.jpg (Hello Ruby book cover)
[11]: https://www.helloruby.com/
[12]: https://opensource.com/sites/default/files/uploads/girlswhocodebook.jpg (Girls Who Code book cover)
[13]: https://girlswhocode.com/book/girls-code-learn-code-change-world/

View File

@ -1,5 +1,5 @@
[#]: collector: (lujun9972)
[#]: translator: ( )
[#]: translator: (lxbwolf)
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )

View File

@ -1,131 +0,0 @@
[#]: collector: (lujun9972)
[#]: translator: ( )
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )
[#]: subject: (Make VLC More Awesome With These Simple Tips)
[#]: via: (https://itsfoss.com/simple-vlc-tips/)
[#]: author: (Ankush Das https://itsfoss.com/author/ankush/)
Make VLC More Awesome With These Simple Tips
======
[VLC][1] is one of the [best open source video players][2], if not the best. What most people dont know about it is that it is a lot more than just a video player.
You can do a lot of complex tasks like broadcasting live videos, capturing devices etc. Just open its menu and youll see how many options it has.
Its FOSS has a detailed tutorial discussing some of the [pro VLC tricks][3] but those are way too complicated for normal users.
This is why I am writing another article to show you some of the simple tips that you can use with VLC.
### Do more with VLC with these simple tips
Lets see what can you do with VLC other than just playing a video file.
#### 1\. Watch YouTube videos with VLC
![][4]
If you do not want to watch the annoying advertisements on [YouTube][5] or simply want a distraction-free experience for watching a YouTube video, you can use VLC.
Yes, it is very easy to stream a YouTube video on VLC.
Simply launch the VLC player, head to the Media settings and click on “**Open Network Stream**” or **CTRL + N** as a shortcut to that.
![][6]
Next, you just have to paste the URL of the video that you want to watch. There are some options to tweak usually, you should not bother using them. But, if you are curious you can click on the “**Advanced options**” to explore.
You can also add subtitles to the YouTube videos this way. However, an easier way to [watch YouTube or any online video with subtitles is using Penguin subtitle player][7].
#### 2\. Convert videos to different formats
![][8]
You can [use ffmpeg to convert videos in Linux command line][9]. You can also use a graphical tool like [HandBrake to convert video formats][10].
But if you do not want a separate app to transcode videos, you can use VLC media player to get the job done.
To do that, just head on to the Media option on VLC and then click on “**Convert/Save**” or press CTRL + R as a shortcut to get there while you have VLC media player active.
Next, you will need to either import the video from your computer/disk or paste the URL of the video that you want to save/convert.
Whatever your input source is just hit the “**Convert/Save**” button after selecting the file.
Now, you will find another window that gives you the option to change the “**Profile**” from the settings. Click on it and choose a format that youd like the video to be converted to (and saved).
You can also change the storage path for the converted file by setting the destination folder at the bottom of the screen before converting it.
#### 3\. Record Audio/Video From Source
![Vlc Advanced Controls][11]
Do you want to record the audio/video youre playing on VLC Media Player?
If yes, theres an easy solution to that. Simply navigate your way through **View-&gt;click on “Advanced Controls”**.
Once you do that, you should observe new buttons (including a red record button in your VLC player).
#### 4\. Download subtitles automatically
![][12]
Yes, you can [automatically download subtitles with VLC][13]. You do not even have to look for it on a separate website. You just have to navigate your way to **View-&gt;VLSub**.
By default, it is deactivated, so when you click on the option it gets activated and lets you search/download the subtitles you wanted.
[VLC also lets you synchronize the subtitles][14] with simple keyboard shortcuts.
#### 5\. Take A Snapshot
![][15]
With VLC, you can get some screenshots/images of the video while watching it.
You just need to right-click on the player while the video is playing/paused, you will notice a bunch of options now, navigate through **Video-&gt;Take Snapshot**.
If you have an old version installed, you might observe the snapshot option right after performing a right-click.
#### Bonus Tip: Add Audio/Video Effects to a video
From the menu, go to the “**Tools**” option. Now, click on “**Effects and Filters**” or simply press **CTRL + E** from the VLC player window to open up the option.
Here, you can observe audio effects and video effects that you can add to your video. You may not be able to see all the changes in real-time, so you will have to tweak it and save it in order to see what happens.
![][16]
Ill suggest keeping a backup of the original video before you modify the video.
#### Whats your favorite VLC tip?
I shared some of my favourite VLC tips. Do you know some cool tip that you use regularly with VLC? Why not share it with us? I may add it to the list here.
--------------------------------------------------------------------------------
via: https://itsfoss.com/simple-vlc-tips/
作者:[Ankush Das][a]
选题:[lujun9972][b]
译者:[译者ID](https://github.com/译者ID)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://itsfoss.com/author/ankush/
[b]: https://github.com/lujun9972
[1]: https://www.videolan.org/
[2]: https://itsfoss.com/video-players-linux/
[3]: https://itsfoss.com/vlc-pro-tricks-linux/
[4]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/12/youtube-video-stream.jpg?ssl=1
[5]: https://www.youtube.com/
[6]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/12/youtube-video-play.jpg?ssl=1
[7]: https://itsfoss.com/penguin-subtitle-player/
[8]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/12/vlc-video-convert.jpg?ssl=1
[9]: https://itsfoss.com/ffmpeg/
[10]: https://itsfoss.com/handbrake/
[11]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/12/vlc-advanced-controls.png?ssl=1
[12]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/12/vlc-subtitles-automatic.png?ssl=1
[13]: https://itsfoss.com/download-subtitles-automatically-vlc-media-player-ubuntu/
[14]: https://itsfoss.com/how-to-synchronize-subtitles-with-movie-quick-tip/
[15]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/12/vlc-snapshot.png?ssl=1
[16]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/12/vlc-effects-screenshot.jpg?ssl=1

View File

@ -1,116 +0,0 @@
[#]: collector: (lujun9972)
[#]: translator: (robsean)
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )
[#]: subject: (App Highlight: Open Source Disk Partitioning Tool GParted)
[#]: via: (https://itsfoss.com/gparted/)
[#]: author: (Ankush Das https://itsfoss.com/author/ankush/)
App Highlight: Open Source Disk Partitioning Tool GParted
======
_**Brief: GParted is an incredibly popular and free partition editor available for Linux distros. Here, we take a look at what it offers in brief.**_
### GParted: A Free &amp; Open-Source GUI-based Partition Manager
![][1]
GParted is undoubtedly one of the [best partition managers for Linux][2] out there. The user interface is very simple and gets the job done.
In some cases, you end up using [GParted][3] to fix or format your USB drive as well. I had a [USB disk which I couldnt format in Ubuntu][4] using the “Disks” app this is where GParted came to the rescue.
So, it is a quite useful tool with a lot of good features. Let me highlight them for you.
Warning!
Playing with disk partitioning is a risky task. Dont do it unless its absolutely necessary. Or else, you might just end up wiping the entire disk.
### Features of GParted
You can do a lot of things with GParted, ranging from a simple format task to important partitioning tasks. Ill highlight the key features with some screenshots to help you know more about it before installing it.
#### Create partition tables
You can create a new partition table for your new disks or erase the content of your existing disk to modify the partition table.
![][5]
You will be able to select msdos, gpt, atari, and a lot more types of partition tables.
#### Create, move, label, delete &amp; modify partitions
You can easily create, label, delete or modify the partitions with a bunch of options available within GParted.
![][6]
Of course, you will have to be careful about what you want to do.
The good thing is that GParted makes sure that you do not directly apply any changes it queues up your selected operations/tasks and asks for another final confirmation before you hit it.
The tick mark symbol ✓on the top allows you to confirm the changes and then only your changes take into effect.
Heres another screenshot for the options you have available for the partitions:
![][7]
#### Attempt data rescue
Apart from editing partitions, you can also try to [recover your lost data in Linux][8] using the “**Attempt Data Rescue**” feature as shown in the screenshot below.
![][9]
It is worth noting that you do not have this feature installed by default you only see the option visible. So, for the data recovery feature to work, you have to install gpart separately using the following command (on Ubuntu/Debian-based distributions):
```
sudo apt install gpart
```
In addition to all the key features, it supports a wide range of storage devices and filesystems. You can learn more about it from the [list of features][10] on their official website.
### Installing GParted on Ubuntu and other Linux distributions
You might have GParted pre-installed. So, make sure to verify that. If you do not have it installed, you can head into the software center to get it installed.
In case you want to use the terminal, simply type in the following command:
```
sudo apt install gparted
```
As I mentioned above, if you want the data recovery option, you should install gpart package in addition to gparted package.
If youre using any other Linux distribution, you can either find it in the respective software manager or simply check out the [official download instructions][11].
[Download GParted][11]
**Wrapping Up**
GParted is a very useful and important tool when it comes to dealing with disk management and partitions. However, you will have to be careful while using it for the obvious reasons.
Have you tried GParted? Which other partitioning tool you use on Linux? Feel free to share your experiences in the comments below.
--------------------------------------------------------------------------------
via: https://itsfoss.com/gparted/
作者:[Ankush Das][a]
选题:[lujun9972][b]
译者:[译者ID](https://github.com/译者ID)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://itsfoss.com/author/ankush/
[b]: https://github.com/lujun9972
[1]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/12/gparted-screenshot.png?ssl=1
[2]: https://itsfoss.com/partition-managers-linux/
[3]: https://gparted.org/
[4]: https://itsfoss.com/format-usb-drive-sd-card-ubuntu/
[5]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/12/gparted-create-partition-table.png?ssl=1
[6]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/12/gparted-modify-partitions.png?ssl=1
[7]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/12/gparted-partition-options.png?ssl=1
[8]: https://itsfoss.com/recover-deleted-files-linux/
[9]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/12/gparted-attempt-data-rescue-feature.png?ssl=1
[10]: https://gparted.org/features.php
[11]: https://gparted.org/download.php

View File

@ -1,5 +1,5 @@
[#]: collector: (lujun9972)
[#]: translator: ( )
[#]: translator: (summer2233)
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )

View File

@ -1,73 +0,0 @@
[#]: collector: (lujun9972)
[#]: translator: (lxbwolf)
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )
[#]: subject: (5 predictions for Kubernetes in 2020)
[#]: via: (https://opensource.com/article/20/1/kubernetes-2020)
[#]: author: (Scott McCarty https://opensource.com/users/fatherlinux)
5 predictions for Kubernetes in 2020
======
Plus, a look back at the most popular Kubernetes articles on the site in
2019.
![Person drinking a hat drink at the computer][1]
How do you track a wildly popular project like Kubernetes? How do you figure out where its going? If you are contributing to the project or participating in Special Interest Groups (SIGs), you might gain insight by osmosis, but for those of you with day jobs that dont include contributing to Kubernetes, you might like a little help reading the tea leaves. With a fast-moving project like Kubernetes, the end of the year is an excellent time to take a look at the past year to gain insight into the next one.
This year, Kubernetes made a lot of progress. Aside from inspecting code, documentation, and meeting notes, another good source is blog entries. To gain some insights, I took a look at the top ten Kubernetes articles on Opensource.com. These articles give us insight into what topics people are interested in reading, but just as importantly, what articles people are interested in writing. Lets dig in!
(Get the full list of top 10 Kubernetes articles from 2019 at the end.)
First, I would point out that five of these articles tackle the expansion of workloads and where they can run. This expansion of workloads includes data science, PostgreSQL, InfluxDB, and Grafana (as a workload, not just to monitor the cluster itself) and Edge. Historically, Kubernetes and containers in general have mostly run on top of virtual machines, especially when run on infrastructure provided by cloud providers. With this interest in Kubernetes at the edge, its another sign that end users are genuinely interested in Kubernetes on bare metal (see also [Kubernetes on metal with OpenShift][2]).
Next, there seems to be a lot of hunger for operational knowledge and best practices with Kubernetes. From [Kubernetes Operators][3], to [Kubernetes Controllers][4], from [Secrets][5] to [ConfigMaps][6], developers and operators alike are looking for best practices and ways to simplify workload deployment and management. Often we get caught up in the actual configuration example, or how people do it, and dont take a step back to realize that all of these fall into the bucket of how to operationalize the deployment of applications (not how to install or run Kubernetes itself).
Finally, people seem to be really interested in getting started. In fact, there is so much information on how to build Kubernetes that it intimidates people and gets them down the wrong path. A couple of the top articles focus on why you should learn to run applications on Kubernetes instead of concentrating on installing it. Like best practices, people often dont take a step back to analyze where they should invest their time when getting started. I have always advocated for, where possible, spending limited time and money on using technology instead of building it.
### 5 predictions for Kubernetes in 2020
So, looking back at those themes from 2019, what does this tell us about where 2020 is going? Well, combining insight from these articles with my own broad purview, I want to share my thoughts for 2020 and beyond:
1. Expansion of workloads. I would keep my eye on high-performance computing, AI/ML, and stateful workloads using Operators.
2. More concrete best practices, especially around mature standards like PCI, HIPAA, NIST, etc.
3. Increased security around rootless and higher security [runtimes classes][7] (like [gVisor][8], [Kata Containers][9], etc.)
4. Better standardization on Kubernetes manifests as the core artifact for deployment in development and sharing applications between developers. Things like [podman generate kube][10], [podman play kube][11], and all in one Kubernetes environments like [CodeReady Containers (CRC)][12]
5. An ever-wider ecosystem of network, storage and specialized hardware (GPUs, etc.) vendors creating best of breed solutions for Kubernetes (in free software, we believe that open ecosystems are better than vertically integrated solutions)
I'm looking forward to another great year in Kubernetes!
**Top 10 Kubernetes articles for 2019**
--------------------------------------------------------------------------------
via: https://opensource.com/article/20/1/kubernetes-2020
作者:[Scott McCarty][a]
选题:[lujun9972][b]
译者:[译者ID](https://github.com/译者ID)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://opensource.com/users/fatherlinux
[b]: https://github.com/lujun9972
[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/coffee_tea_laptop_computer_work_desk.png?itok=D5yMx_Dr (Person drinking a hat drink at the computer)
[2]: https://blog.openshift.com/kubernetes-on-metal-with-openshift/
[3]: https://kubernetes.io/docs/concepts/extend-kubernetes/operator/
[4]: https://kubernetes.io/docs/concepts/architecture/controller/
[5]: https://kubernetes.io/docs/concepts/configuration/secret/
[6]: https://kubernetes.io/docs/tasks/configure-pod-container/configure-pod-configmap/
[7]: https://kubernetes.io/docs/concepts/containers/runtime-class/
[8]: https://gvisor.dev/
[9]: https://katacontainers.io/
[10]: https://developers.redhat.com/blog/2019/01/29/podman-kubernetes-yaml/
[11]: https://www.redhat.com/en/blog/rhel-81-minor-release-major-new-container-capabilities
[12]: https://developers.redhat.com/products/codeready-containers/overview

View File

@ -1,122 +0,0 @@
[#]: collector: (lujun9972)
[#]: translator: (geekpi)
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )
[#]: subject: (Signal: A Secure, Open Source Messaging App)
[#]: via: (https://itsfoss.com/signal-messaging-app/)
[#]: author: (Ankush Das https://itsfoss.com/author/ankush/)
Signal: A Secure, Open Source Messaging App
======
**_Brief: Signal is a secure open-source messaging app for smartphones. It also offers a standalone desktop app for Linux, Windows, and macOS_. _Here, we take a look at its features and usability._**
### Signal is an Excellent Alternative to WhatsApp (and Telegram) for Privacy Concerned People
![Signal App On Linux][1]
Signal is an open source application with a keen focus on privacy. It is recommended by privacy advocates like [Edward Snowden][2].
It may not have as many features as Telegram or WhatsApp but if you want to enhance your privacy while having a conversation, this is a solid open-source solution.
You can install it on your smartphone ([iOS][3]/[Android][4]) and it is also available for Linux, Windows, and macOS.
### Features of Signal Messenger
**Note:** _Some of the features are specific/exclusive to smartphones. You may not observe all the features mentioned in the desktop app._
As I already mentioned, this is tailored to enhance your privacy. So, the user experience may not be the “best” youve ever seen. But, privacy/security-wise, I think it is a good option to have.
![Signal Features][5]
#### Disappearing Messages
You can set a timer for messages in a conversation so that it will be automatically deleted as per the timer.
Essentially, anyone in the conversation can activate this feature. So, you control if the messages should stay in a conversation or disappear.
#### Use it As Default SMS App
If you want to utilize an open-source app for all your SMSs, you can simply go to Signals app settings and set it as the default for SMS and MMS.
#### Screen Security
Theres a neat feature to block screenshots in-app, “Screen Security”.
If you enable it, you wont be able to take a screenshot of any conversation in the app. You can find the option to enable or disable it from the app settings.
It may not be useful to everyone but you can try it out.
#### Safety Number
If you want to verify the security of your encryption with a friend, you can simply tap on the profile and scroll down to find “View Safety Number”.
You can either scan it to verify or simply take a look at it to mark it verified.
#### Locked Messages
If you protect the app with a lock (pin/fingerprint), even if your device has been unlocked, you wont be able to see the messages on your notifications.
So, when you get a notification while Signal is locked, you will notice the content of the notification as “**Locked Message**” which is a plus for privacy-oriented users.
#### Other Features
![][6]
As you would expect in a messaging app you get a couple of stickers to utilize and you can also create a group if you want.
However, you wont have the ability to moderate your group you can just add members and change the profile picture.
In addition to this, Signal also supports biometric security for its app.
### Installing Signal on Ubuntu/Linux
Unfortunately, you dont get a .**deb** or .**AppImage** to install it on your Linux distro. So, you will need to utilize the terminal as per the [official installation instructions][7].
Heres what you have to type in the terminal:
```
curl -s https://updates.signal.org/desktop/apt/keys.asc | sudo apt-key add -
echo "deb [arch=amd64] https://updates.signal.org/desktop/apt xenial main" | sudo tee -a /etc/apt/sources.list.d/signal-xenial.list
sudo apt update && sudo apt install signal-desktop
```
Simply copy-paste the commands one by one in the terminal and you should be good to go.
[Download Signal for Other Devices][7]
### My Thoughts On Signal
Ive been using Signal for a few years now and it has improved with what it offers. However, I still feel that the user experience can be improved.
Privacy-wise, it is definitely a good alternative to what we already have (in my opinion). You can give it a try and see how well it works for your usage.
You can also take a look at their [GitHub page][8] for the latest developments and beta releases if you want to try them out.
Signal app may not be a popular messaging app when compared to WhatsApp or even [Telegram on Linux][9]. But, you can try it for yourself and encourage your friends to use an open-source messaging app.
Have you tried it yet? Let me know what you think about the Signal app in the comments below.
--------------------------------------------------------------------------------
via: https://itsfoss.com/signal-messaging-app/
作者:[Ankush Das][a]
选题:[lujun9972][b]
译者:[译者ID](https://github.com/译者ID)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://itsfoss.com/author/ankush/
[b]: https://github.com/lujun9972
[1]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/12/signal-shot.jpg?ssl=1
[2]: https://en.wikipedia.org/wiki/Edward_Snowden
[3]: https://apps.apple.com/us/app/signal-private-messenger/id874139669
[4]: https://play.google.com/store/apps/details?id=org.thoughtcrime.securesms&hl=en_IN
[5]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/12/signal-phone.jpg?ssl=1
[6]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2019/12/signal-shot-1.jpg?ssl=1
[7]: https://signal.org/download/
[8]: https://github.com/signalapp
[9]: https://itsfoss.com/install-telegram-desktop-linux/

View File

@ -1,103 +0,0 @@
[#]: collector: (lujun9972)
[#]: translator: (geekpi)
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )
[#]: subject: (GNOME has a Secret Screen Recorder. Heres How to Use it!)
[#]: via: (https://itsfoss.com/gnome-screen-recorder/)
[#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/)
GNOME has a Secret Screen Recorder. Heres How to Use it!
======
[GNOME][1] is one of the [most popular desktop environments][2] and for good reasons. It has a modern UI and it comes with a number of GNOME-specific applications that blend well with the overall desktop appearance.
You can [tweak GNOME][3] to your liking as much as you want but I am not here to discuss that. GNOME desktop has some hidden features that you probably are not aware of.
One of such not-so-obvious feature is a built in screen recorder.
Yes, you read that right. If you are using GNOME desktop, you dont necessarily need to install other [screen recorders in Linux][4]. You just need to know the correct keyboard shortcut.
### Instantly record your screen with GNOME Screen Recorder
To quickly access the GNOME screen recorder, you have to press this [keyboard shortcut in Ubuntu][5] or other distributions using GNOME desktop:
```
Ctrl + Alt + Shift + R
```
This will immediately start recording your desktop. You can tell that the screen recording is in progress by looking at the red dot in the system tray area of the top panel:
![The red dot in the system tray area indicates that screen recording is in progress][6]
#### Increase the screencast duration
The default maximum record time is just 30 seconds. It can be increased though.
Open a terminal and use the following command:
```
gsettings set org.gnome.settings-daemon.plugins.media-keys max-screencast-length 300
```
In the above command, I have increased the maximum length of the recording to 300 seconds (i.e. 5 minutes). You can change it to any other value but it should be in seconds.
If you **dont want any limit on the maximum recording time, set it to 0** and then the recording wont stop until you manually stop it or your disk runs out of space.
#### Stop the screen recording
As I mentioned, your desktop recording will stop automatically after it reaches the maximum time limit.
To stop the recording before that, you can press the same key combination:
```
Ctrl + Alt + Shift + R
```
Your recordings are saved in [webm][7] format in the Videos folder of your Home directory.
#### Limitations
While it might be handy to record your desktop quickly with this handy little tool, it has its several limitations when compared to a full-fledged screen recording tool like [Simple Screen Recorder][8].
* There is no time delay option before the recording starts
* There is no pause and play option
* It records the entire screen. No option to record only an application window or a ceratin area or a certain monitor (if you have a multi-monitor setup).
* Videos are saved in webm format in the users Videos directory. You cannot change it. Youll have to use a tool like [HandBrake to convert the videos to other format][9].
As you can see, the secret GNOME screen recorder is no where near to the features provided by the likes of [Kazam][10] or other such tools.
But it doesnt try to be a full-fledged screen recorder. It just provides you a quick way of recording a small screencast. Thats it.
GNOME is a versatile modern desktop environments. You can [tweak GNOME][3] extensively. The [GNOME Extensions][11] provide another dimension to the desktop customization.
This screen recorder is one of the hidden features of GNOME like the suspend option that you wont easily find on your own.
_How do you like it? Do you know some other hidden GNOME features that you would like to share with us? The comment section is all yours._
--------------------------------------------------------------------------------
via: https://itsfoss.com/gnome-screen-recorder/
作者:[Abhishek Prakash][a]
选题:[lujun9972][b]
译者:[译者ID](https://github.com/译者ID)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://itsfoss.com/author/abhishek/
[b]: https://github.com/lujun9972
[1]: https://gnome.org/
[2]: https://itsfoss.com/best-linux-desktop-environments/
[3]: https://itsfoss.com/gnome-tweak-tool/
[4]: https://itsfoss.com/best-linux-screen-recorders/
[5]: https://itsfoss.com/ubuntu-shortcuts/
[6]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/01/gnome_screen_recording.jpg?ssl=1
[7]: https://www.webmproject.org/about/
[8]: https://itsfoss.com/record-screen-ubuntu-simplescreenrecorder/
[9]: https://itsfoss.com/handbrake/
[10]: https://itsfoss.com/kazam-screen-recorder/
[11]: https://itsfoss.com/best-gnome-extensions/

View File

@ -1,5 +1,5 @@
[#]: collector: (lujun9972)
[#]: translator: ( )
[#]: translator: (geekpi)
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )

View File

@ -0,0 +1,71 @@
[#]: collector: (lujun9972)
[#]: translator: (geekpi)
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )
[#]: subject: (PaperWM: tiled window management for GNOME)
[#]: via: (https://jvns.ca/blog/2020/01/05/paperwm/)
[#]: author: (Julia Evans https://jvns.ca/)
PaperWM: tiled window management for GNOME
======
When I started using Linux on my personal computer, one of the first things I got excited about was tiny lightweight window managers, largely because my laptop at the time had 32MB of RAM and anything else was unusable.
Then I got into tiling window managers like [xmonad][1]! I could manage my windows with my keyboard! They were so fast! I could configure xmonad by writing a Haskell program! I could customize everything in all kinds of fun ways (like using [dmenu][2] as a launcher)! I used 3 or 4 different tiling window managers over the years and it was fun.
About 6 years ago I decided configuring my tiling window manager wasnt fun for me anymore and switched to using the Ubuntu stock desktop environment: Gnome. (which is much faster now that I have 500x more RAM in my laptop :) )
So Ive been using Gnome for a long time, but I still kind of missed tiling window managers. Then 6 months ago a friend told me about [PaperWM][3], which lets you tile your windows in Gnome! I installed it immediately and Ive been using it ever since.
### PaperWM: tiling window management for Gnome
The basic idea of [PaperWM][3] is: you want to keep using Gnome (because all kinds of things Just Work in Gnome) but you also kinda wish you were using a tiling window manager.
Its a Gnome extension (instead of being a standalone window manager) and its in Javascript.
### “Paper” means all of your windows are in a line
The main idea in PaperWM is it puts all your windows in a line, which is actually quite different from traditional tiling window managers where you can tile your windows any way you want. Heres a gif of me moving between / resizing some windows while writing this blog post (theres a browser and two terminal windows):
![][4]
PaperWMs Github README links to this video: <http://10gui.com/video/>, which describes a similar system as a “linear window manager”.
Id never heard of this way of organizing windows before but I like the simplicity of it if Im looking for a specific window I just move left/right until I find it.
### everything I do in PaperWM
there are lots of other features but these are the only ones I use:
* move left and right between windows (`Super + ,`, `Super + .`)
* move the window left/right in the ordering (`Super+Shift+,`, `Super+Shift+.`)
* full screen a window (`Super + f`)
* make a window smaller (`Super + r`)
### I like tools that I dont have to configure
Ive been using PaperWM for 6 months on a laptop and I really like it! I also really appreciate that even though its configurable (by writing a Javascript configuration file), it does the things I want out of the box without me having to research how to configure it.
The [fish shell][5] is another delightful tool like that I basically dont configure fish at all (except to set environment variables etc) and I really like the default feature set.
--------------------------------------------------------------------------------
via: https://jvns.ca/blog/2020/01/05/paperwm/
作者:[Julia Evans][a]
选题:[lujun9972][b]
译者:[译者ID](https://github.com/译者ID)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://jvns.ca/
[b]: https://github.com/lujun9972
[1]: https://xmonad.org/
[2]: https://wiki.archlinux.org/index.php/Dmenu
[3]: https://github.com/paperwm/PaperWM
[4]: https://jvns.ca/images/paperwm.gif
[5]: https://jvns.ca/blog/2017/04/23/the-fish-shell-is-awesome/

View File

@ -0,0 +1,126 @@
[#]: collector: (lujun9972)
[#]: translator: ( )
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )
[#]: subject: (Create fancy text for your social media posts with this Gawk script)
[#]: via: (https://opensource.com/article/20/1/gawk-scripting-social-media)
[#]: author: (Jim Hall https://opensource.com/users/jim-hall)
Create fancy text for your social media posts with this Gawk script
======
Add a little style to your status updates by posting text in script,
fraktur, or double-strike characters.
![Chat via email][1]
Like almost everyone on the planet, I have a few social media accounts. I mostly stick to Facebook to stay up to date with friends and family and Twitter to follow a few other people.
Have you ever wanted to make a post that includes italics or some other fancy formatting? You can easily change the text to italics or bold when you're writing an email, but most social media platforms don't provide many formatting options.
And sometimes, I just want to put a little _emphasis_ into what I'm writing. If I've had a really good day and I want to share that with my friends, I might want to put that text in italics. For other posts, I might want to use different formatting that will help my text stand out. Sure, you can use emoji, but sometimes a little text formatting can add that extra pizzazz to your posts.
I found a way to do just that. With a short [Gawk][2] script I wrote, I can create fancy formatting that I can copy and paste into my social media posts.
### Special HTML
HTML includes a bunch of special characters for mathematics, symbols, and other languages that most people are not aware of. Within the Mathematical Markup Language ([MathML][3]) math character support, HTML includes alternate versions of the alphabet for script, fraktur, and double-strike (shown respectively in this image) characters.
![script, fraktur, and double-strike text][4]
You can use these alternate versions of the alphabet to create fancy text.
The script alphabet variation is written as the letter followed by **scr**. Characters can be uppercase or lowercase. For example, to print the script letter **a** in an HTML page, type **&amp;ascr;**, and to print the script letter **Z** in HTML, type **&amp;Zscr;**.
The fraktur and double-strike variations are referenced in similar ways. The fraktur mathematical lower-case **a** is **&amp;afr;**, and the capital **Y** is **&amp;Yfr;**. The mathematical double-strike **a** is referenced as **&amp;aopf;**, and the double-strike **X** is **&amp;Xopf;**.
### Gawk functions
Once you know how to reference the alternate versions of each letter, it's easy to define a few Gawk functions to print those HTML entities. Since these alternate characters exist only for letters and not punctuation or numbers, start with a simple wrapper function to determine if a character is an uppercase or lowercase letter.
```
#!/usr/bin/gawk -f
# Echo the input as different "fonts." Redirect this into an html
# page and copy/paste fancy text into twitter or facebook.
BEGIN { alpha="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"; }
function is_alpha(c) {
  return(index(alpha, c));
}
```
The **BEGIN** statement defines an alphabet string called **alpha** that contains all letters az and AZ. The **is_alpha(c)** function uses the built-in **index()** function to return the location of the character **c** in the string **alpha**. If the character **c** is not a letter, **index()** returns zero, which the script uses as a False value.
Because the **is_alpha(c)** function just "wraps" a call to the **index()** function without doing anything else; this is called a _wrapper_ function. Think of it as shorthand that makes the Gawk script easier to read.
With that, it's easy to define a few functions that convert single letters into each of the alternate versions of the alphabet. In general, each function calls **is_alpha(c)** to determine if a character is a letter az or AZ. If it is (i.e., if the returned value is non-zero), then the function prints the HTML entity for that letter as script, fraktur, and double-strike. Otherwise, the function prints the letter.
```
function print_script(c) {
  if ( is_alpha(c) ) { printf("&amp;%cscr;", c); } else { printf("%c", c); }
}
function print_fraktur(c) {
  if ( is_alpha(c) ) { printf("&amp;%cfr;", c); }  else { printf("%c", c); }
}
function print_double(c) {
  if ( is_alpha(c) ) { printf("&amp;%copf;", c); } else { printf("%c", c); }
}
```
The **print_script(c)** function prints a single letter in script. Similarly, the **print_fraktur(c)** function prints a letter in fraktur, and the **print_double(c)** function prints a single letter in double-strike.
All that's left is a Gawk loop to convert plain text into each of the alternate alphabet characters. This script loops over each line three times and prints the text in script, fraktur, or double-strike. Each line is wrapped in **&lt;p&gt;** and **&lt;/p&gt;** HTML tags.
```
{ text=$0;
  len=length(text);
  print "&lt;p&gt;";
  for (i=1; i&lt;=len; i++) {
    print_script( substr(text, i, 1) );
  }
  print "&lt;/p&gt;&lt;p&gt;";
  for (i=1; i&lt;=len; i++) {
    print_fraktur( substr(text, i, 1) );
  }
  print "&lt;/p&gt;&lt;p&gt;";
  for (i=1; i&lt;=len; i++) {
    print_double( substr(text, i, 1) );
  }
  print "&lt;/p&gt;";
}
```
### Putting it all together
I saved the above lines in a script file called **htmlecho** and put it in my **~/bin** directory.
```
$ htmlecho &gt; /tmp/hello.html
Hello world
^Z
```
Whenever I want to add fancy text to my Facebook and Twitter posts, I just run the script and save the output to a temporary HTML page. I open the temporary page in a web browser and copy and paste the fancy text I like best into my social media posts.
--------------------------------------------------------------------------------
via: https://opensource.com/article/20/1/gawk-scripting-social-media
作者:[Jim Hall][a]
选题:[lujun9972][b]
译者:[译者ID](https://github.com/译者ID)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://opensource.com/users/jim-hall
[b]: https://github.com/lujun9972
[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/email_chat_communication_message.png?itok=LKjiLnQu (Chat via email)
[2]: https://www.gnu.org/software/gawk/
[3]: https://en.wikipedia.org/wiki/MathML
[4]: https://opensource.com/sites/default/files/uploads/hello_world.png (script, fraktur, and double-strike text)

View File

@ -0,0 +1,157 @@
[#]: collector: (lujun9972)
[#]: translator: ( )
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )
[#]: subject: (How to write a Python web API with Pyramid and Cornice)
[#]: via: (https://opensource.com/article/20/1/python-web-api-pyramid-cornice)
[#]: author: (Moshe Zadka https://opensource.com/users/moshez)
How to write a Python web API with Pyramid and Cornice
======
Use Pyramid and Cornice to build and document scalable RESTful web
services.
![Searching for code][1]
[Python][2] is a high-level, object-oriented programming language known for its simple syntax. It is consistently among the top-rated programming languages for building RESTful APIs.
[Pyramid][3] is a Python web framework designed to scale up with an application: it's simple for simple applications but can grow for big, complex applications. Among other things, Pyramid powers PyPI, the Python package index. [Cornice][4] provides helpers to build and document REST-ish web services with Pyramid.
This article will use the example of a web service to get famous quotes to show how to use these tools.
### Set up a Pyramid application
Start by creating a virtual environment for your application and a file to hold the code:
```
$ mkdir tutorial
$ cd tutorial
$ touch main.py
$ python3 -m venv env
$ source env/bin/activate
(env) $ pip3 install cornice twisted
```
### Import the Cornice and Pyramid modules
Import these modules with:
```
from pyramid.config import Configurator
from cornice import Service
```
### Define the service
Define the quotes service as a **Service** object:
```
QUOTES = Service(name='quotes',
                 path='/',
                 description='Get quotes')
```
### Write the quotes logic
So far, this only supports **GET**ing quotes. Decorate the function with **QUOTES.get**; this is how you can tie in the logic to the REST service:
```
@QUOTES.get()
def get_quote(request):
    return {
        'William Shakespeare': {
            'quote': ['Love all, trust a few, do wrong to none',
            'Some are born great, some achieve greatness, and some have greatness thrust upon them.']
    },
    'Linus': {
        'quote': ['Talk is cheap. Show me the code.']
        }
    }
```
Note that unlike in other frameworks, the **get_quote** function is _not_ changed by the decorator. If you import this module, you can still call the function regularly and inspect the result.
This is useful when writing unit tests for Pyramid RESTful services.
### Define the application object
Finally, use **scan** to find all decorated functions and add them to the configuration: 
```
with Configurator() as config:
    config.include("cornice")
    config.scan()
    application = config.make_wsgi_app()
```
The default for scan is to scan the current module. You can also give the name of a package if you want to scan all modules in a package.
### Run the service
I use Twisted's WSGI server to run the application, but you can use any other [WSGI][5] server, like Gunicorn or uWSGI, if you want:
```
`(env)$ python -m twisted web --wsgi=main.application`
```
By default, Twisted's WSGI server runs on port 8080. You can test the service with [HTTPie][6]:
```
(env) $ pip install httpie
...
(env) $ http GET <http://localhost:8080/>
HTTP/1.1 200 OK
Content-Length: 220
Content-Type: application/json
Date: Mon, 02 Dec 2019 16:49:27 GMT
Server: TwistedWeb/19.10.0
X-Content-Type-Options: nosniff
{
    "Linus": {
        "quote": [
            "Talk is cheap. Show me the code."
        ]
    },
    "William Shakespeare": {
        "quote": [
            "Love all,trust a few,do wrong to none",
            "Some are born great, some achieve greatness, and some greatness thrust upon them."
        ]
    }
}
```
### Why use Pyramid?
Pyramid is not the most popular framework, but it is used in some high-profile projects like [PyPI][7]. I like Pyramid because it is one of the frameworks that took unit testing seriously: because the decorators do not modify the function and there are no thread-local variables, functions are callable directly from unit tests. For example, functions that need access to the database will get it from the **request** object passed in via **request.config**. This allows a unit tester to put a mock (or real) database object in the request, instead of carefully setting globals, thread-local variables, or other framework-specific things.
If you're looking for a well-tested library to build your next API, give Pyramid a try. You won't be disappointed.
--------------------------------------------------------------------------------
via: https://opensource.com/article/20/1/python-web-api-pyramid-cornice
作者:[Moshe Zadka][a]
选题:[lujun9972][b]
译者:[译者ID](https://github.com/译者ID)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://opensource.com/users/moshez
[b]: https://github.com/lujun9972
[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/search_find_code_python_programming.png?itok=ynSL8XRV (Searching for code)
[2]: https://opensource.com/resources/python
[3]: https://opensource.com/article/18/5/pyramid-framework
[4]: https://cornice.readthedocs.io/en/latest/
[5]: https://en.wikipedia.org/wiki/Web_Server_Gateway_Interface
[6]: https://opensource.com/article/19/8/getting-started-httpie
[7]: https://pypi.org/

View File

@ -0,0 +1,107 @@
[#]: collector: (lujun9972)
[#]: translator: ( )
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )
[#]: subject: (App Highlight: Catfish Desktop File Searching Tool)
[#]: via: (https://itsfoss.com/catfish/)
[#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/)
App Highlight: Catfish Desktop File Searching Tool
======
_****Brief: Catfish is a nifty file searching GUI tool for Linux desktop. The interface is lightweight and simple and the tool allows to refine your search with** criteria like time, file type etc.**_
The Linux purists use commands like locate, find and grep to search for files in the terminal.
But as a desktop Linux user, you dont need to leave the comfort of the graphical user interface (GUI) and deep dive into the command line interface (CLI) just for searching files on your desktop.
Most Linux distributions provide a basic desktop search feature either via the file manager or through the desktop environment itself.
On GNOME desktop, you can search for files in the Activities area (use the Windows key to bring it up). Files (previously known as Nautilus) also has a built-in search button.
![Nautilus file manager already has advanced search feature][1]
You can extend this search and add options like time and type of the file. One thing it doesnt do is to search inside the files. For example, you cannot use it to get all the files that contains “university”.
This is where a desktop file search tool like Catfish could help you.
### Catfish: A nifty GUI tool for searching files on Linux
[Catfish][2] is a GUI tool that enables you to search your desktop for any kind of files. It uses locate and find commands underneath. The autocompletion feature uses [Zeitgeist][3] daemon and [locate command][4]. Its a lightweight tool and uses GTK+.
Catfish is developed by [Christian Dywan][5], the same person who develops the [lightweight Midori web browser][6].
![Catfish interface on MX Linux][7]
Some of the main features of Catfish are:
* Search for files anywhere on your system, **including the mounted partitions**
* **Search inside the files** for its contents (can be enabled from preferences)
* Search hidden files as well
* Refine your search based on modification time
* Refine your search based on file type (images, videos, documents etc)
* Refine your search based on location (Documents, Downloads, Pictures or other folders)
* Exclude certain directories and paths from your search
* Lightweight and simple interface
* **Support for Wayland** display server (from version 1.4.12)
Catfish is now a Xfce project and it is providing the search feature to Xfces Thunar file manager.
### Installing Catfish on Ubuntu and other Linux distributions
Lets see how to install Catfish on your Linux distributions.
**Ubuntu-based distributions**
Catfish is available in the universe repository for Ubuntu based distributions such as Xubuntu, Linux Mint, Linux Lite etc.
You can install it from the software center by searching for Catfish
![Catfish in Ubuntu Software Center][8]
or, use the terminal to install it:
```
sudo apt install catfish
```
The version provided by Ubuntu may not be the latest. The [official PPA][9] has been abandoned so this means that to get the latest Catfish version, youll have to [install it from the source code][10].
**On other distributions**
Catfish is also available in most major Linux distributions. It is certainly available on Fedora and if you check your distributions package manager or software center, you should find it there and install it like any other program.
**Conclusion**
In this weeks Linux application highlight, you learned about this handy little utility. However, Catfish is not the only tool of its kind. You may check some other search tools like [ANGRYSearch][11] or [SearchMonkey][12].
Have you ever used a GUI tool for searching files or do you rely on the good old command line? And what do you think of Catfish? Do you look forward to use it?
--------------------------------------------------------------------------------
via: https://itsfoss.com/catfish/
作者:[Abhishek Prakash][a]
选题:[lujun9972][b]
译者:[译者ID](https://github.com/译者ID)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://itsfoss.com/author/abhishek/
[b]: https://github.com/lujun9972
[1]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/01/search-files-gnome.jpg?ssl=1
[2]: https://launchpad.net/catfish-search/
[3]: https://wiki.archlinux.org/index.php/Zeitgeist
[4]: https://linuxhandbook.com/locate-command/
[5]: http://www.twotoasts.de/index.php/about/
[6]: https://itsfoss.com/midori-browser/
[7]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/01/catfish_screenshot.png?ssl=1
[8]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/01/catfish_ubuntu_software_center.jpg?ssl=1
[9]: https://itsfoss.com/ppa-guide/
[10]: https://itsfoss.com/install-software-from-source-code/
[11]: https://itsfoss.com/angrysearch/
[12]: https://itsfoss.com/searchmonkey-search-text-files-linux/

View File

@ -0,0 +1,149 @@
[#]: collector: (lujun9972)
[#]: translator: ( )
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )
[#]: subject: (Bash Script to Check How Long the High CPU/Memory Consumption Processes Runs on Linux)
[#]: via: (https://www.2daygeek.com/bash-script-to-check-how-long-the-high-cpu-memory-consumption-processes-runs-on-linux/)
[#]: author: (Magesh Maruthamuthu https://www.2daygeek.com/author/magesh/)
Bash Script to Check How Long the High CPU/Memory Consumption Processes Runs on Linux
======
In the past, we have written three different articles to identify this using Linux commands.
You can access them immediately by going to the relevant URLs below.
* **[How to Find High CPU Consumption Processes in Linux][1]**
* **[How to Find Out Top Memory Consuming Processes in Linux][2]**
* **[Five Ways to Check How Long a Process Has Been Running in Linux][3]**
Two scripts are included in this tutorial, which helps you to identify how long the high CPU/memory consumption processes are running on Linux.
The script will show you the process ID, the owner of the process, the name of the process and how long the processes are running.
This will help you identify which jobs are running overtime (which must be completed beforehand).
This can be achieved using the ps command.
### Whats ps Command
ps stands for processes status, it display the information about the active/running processes on the system.
It provides a snapshot of the current processes along with detailed information like username, user id, cpu usage, memory usage, process start date and time command name etc.
### 1) Bash Script to Check How Long the High CPU Consumption Processes Runs on Linux
This script will help you to identify how long the high CPU consumption processes has been running on Linux.
```
# vi /opt/scripts/long-running-cpu-proc.sh
#!/bin/bash
ps -eo pid,user,ppid,%mem,%cpu,cmd --sort=-%cpu | head | tail -n +2 | awk '{print $1}' > /tmp/long-running-processes.txt
echo "--------------------------------------------------"
echo "UName PID CMD Process_Running_Time"
echo "--------------------------------------------------"
for userid in `cat /tmp/long-running-processes.txt`
do
username=$(ps -u -p $userid | tail -1 | awk '{print $1}')
pruntime=$(ps -p $userid -o etime | tail -1)
ocmd=$(ps -p $userid | tail -1 | awk '{print $4}')
echo "$username $userid $ocmd $pruntime"
done | column -t
echo "--------------------------------------------------"
```
Set an executable **[Linux file permission][4]** to **“long-running-cpu-proc.sh”** file.
```
# chmod +x /opt/scripts/long-running-cpu-proc.sh
```
When you run this script, you will get an output like the one below.
```
# sh /opt/scripts/long-running-cpu-proc.sh
----------------------------------------------------
UName PID CMD Process_Running_Time
----------------------------------------------------
daygeek 5214 Web 01:18:48
daygeek 5748 Web 01:08:20
daygeek 8043 inkscape 22:11
daygeek 5269 Web 01:18:31
daygeek 1712 Web 10:44:50
daygeek 5335 RDD 01:17:54
daygeek 1639 firefox 10:44:51
daygeek 7793 nautilus 24:14
daygeek 6301 Web 57:40
----------------------------------------------------
```
### 2) Bash Script to Check How Long the High Memory Consumption Processes Runs on Linux
This script will help you to identify how long the top memory consumption processes has been running on Linux.
```
# sh /opt/scripts/long-running-memory-proc.sh
#!/bin/bash
ps -eo pid,user,ppid,%mem,%cpu,cmd --sort=-%mem | head | tail -n +2 | awk '{print $1}' > /tmp/long-running-processes-1.txt
echo "--------------------------------------------------"
echo "UName PID CMD Process_Running_Time"
echo "--------------------------------------------------"
for userid in `cat /tmp/long-running-processes-1.txt`
do
username=$(ps -u -p $userid | tail -1 | awk '{print $1}')
pruntime=$(ps -p $userid -o etime | tail -1)
ocmd=$(ps -p $userid | tail -1 | awk '{print $4}')
echo "$username $userid $ocmd $pruntime"
done | column -t
echo "--------------------------------------------------"
```
Set an executable Linux file permission to **“long-running-memory-proc.sh”** file.
```
# chmod +x /opt/scripts/long-running-memory-proc.sh
```
When you run this script, you will get an output like the one below.
```
# sh /opt/scripts/long-running-memory-proc.sh
----------------------------------------------------
UName PID CMD Process_Running_Time
----------------------------------------------------
daygeek 1639 firefox 10:44:56
daygeek 2997 Web 10:39:54
daygeek 5269 Web 01:18:37
daygeek 1712 Web 10:44:55
daygeek 8043 inkscape 22:17
daygeek 5214 Web 01:18:54
daygeek 1898 Web 10:44:48
daygeek 1129 Xorg 10:45:07
daygeek 6301 Web 57:45
----------------------------------------------------
```
--------------------------------------------------------------------------------
via: https://www.2daygeek.com/bash-script-to-check-how-long-the-high-cpu-memory-consumption-processes-runs-on-linux/
作者:[Magesh Maruthamuthu][a]
选题:[lujun9972][b]
译者:[译者ID](https://github.com/译者ID)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://www.2daygeek.com/author/magesh/
[b]: https://github.com/lujun9972
[1]: https://www.2daygeek.com/how-to-find-high-cpu-consumption-processes-in-linux/
[2]: https://www.2daygeek.com/linux-find-top-memory-consuming-processes/
[3]: https://www.2daygeek.com/how-to-check-how-long-a-process-has-been-running-in-linux/
[4]: https://www.2daygeek.com/understanding-linux-file-permissions/

View File

@ -0,0 +1,87 @@
[#]: collector: (lujun9972)
[#]: translator: ( )
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )
[#]: subject: (Kali Linux Will No Longer Have The Default Root User)
[#]: via: (https://itsfoss.com/kali-linux-root-user/)
[#]: author: (Ankush Das https://itsfoss.com/author/ankush/)
Kali Linux Will No Longer Have The Default Root User
======
Kali Linux is a specialized Linux distribution for cyber security testing and hacking related tasks.
If youve used [Kali Linux][1], you probably know that it followed a default root user policy. In other words, you are always root in Kali Linux. Whatever you do you will be accessing tools/applications as root by default.
It looks like everything back then was kind of “root for all” for everything. So, the default root user policy existed.
They also explained the history for this in their [announcement post][2]:
> A lot of those tools back then either required root access to run or ran better when ran as root. With this operating system that would be ran from a CD, never be updated, and had a lot of tools that needed root access to run it was a simple decision to have a “everything as root” security model. It made complete sense for the time.
### Kali Linux will now have a default non-root user (like most other distributions)
![][3]
A default non-root model was necessary because a lot of users now use Kali Linux as their daily driver.
Of course, they [do not recommend using Kali Linux][4] as a replacement for stable distributions like Ubuntu/Fedora/Manjaro however, with its active development, some users do consider using it on a day-to-day basis instead of just using it for its tools.
So, with a wide mainstream usage of the distro, the Kali Linux team thought of switching to a default non-root model because nowadays a lot of applications/tools do not require root access.
> While we dont encourage people to run Kali as their day to day operating system, over the last few years more and more users have started to do so _(even if they are not using it to do penetration testing full time)_, including some members of the Kali development team. When people do so, they obviously dont run as default root user. With this usage over time, there is the obvious conclusion that default root user is no longer necessary and Kali will be better off moving to a more traditional security model.
So I am reiterating that you should not consider Kali Linux to be fit for your daily tasks if you do not utilize security-related [Kali Linux tools][5]. Feel free to experiment but I wouldnt be so sure to rely on it.
So from the next release, when you install Kali Linux, youll be asked to create non-root user that will have admin privileges. Tools and commands that require root access will be run with sudo.
![][6]
#### [Pretend to be Using Windows with Kali Linux Undercover Mode][7]
The new undercover mode in Kali Linux switches the desktop layout to make it look like Windows 10. Find out how to activate the undercover mode.
### New default user and password for Kali Linux live mode
![Kali Linux has new user-password in the live system][8]
Technically, you wont find a groundbreaking difference. Just note that the default user ID and password in live mode is “**kali**“.
You can find the new non-root model implemented in the new daily/weekly builds if you want to test it early.
In either case, you can wait for the 2020.1 release scheduled for late January to take a look at the new default non-root user model.
### Getting back the old root model in Kali Linux
If you are a long time Kali Linux user, you may not find it convenient to add sudo before commands and then manually enter the password.
The good news here is that you can still get the old password-less root rights with this command:
```
sudo dpkg-reconfigure kali-grant-root
```
What do you think about the default non-root user model? Is it a good decision? Let me know your thoughts in the comments.
--------------------------------------------------------------------------------
via: https://itsfoss.com/kali-linux-root-user/
作者:[Ankush Das][a]
选题:[lujun9972][b]
译者:[译者ID](https://github.com/译者ID)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://itsfoss.com/author/ankush/
[b]: https://github.com/lujun9972
[1]: https://www.kali.org/
[2]: https://www.kali.org/news/kali-default-non-root-user/
[3]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/01/kali_linux_default_root_user.png?ssl=1
[4]: https://itsfoss.com/kali-linux-review/
[5]: https://itsfoss.com/best-kali-linux-tools/
[6]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/11/kali_linux_undercover_mode.jpg?fit=800%2C450&ssl=1
[7]: https://itsfoss.com/kali-linux-undercover-mode/
[8]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/01/kali-linux-live-password.png?ssl=1

View File

@ -0,0 +1,231 @@
[#]: collector: (lujun9972)
[#]: translator: (wxy)
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )
[#]: subject: (File sharing with Git)
[#]: via: (https://opensource.com/article/19/4/file-sharing-git)
[#]: author: (Seth Kenlon)
用 Git 共享文件
======
> SparkleShare 是一个开源的基于 Git、Dropbox 风格的文件共享应用程序。在我们的系列文章中了解有关 Git 鲜为人知的用法。
![][1]
[Git][2] 是一个少有的能将如此多的现代计算封装到一个程序之中的应用程序,它可以用作许多其他应用程序的计算引擎。虽然它以跟踪软件开发中的源代码更改而闻名,但它还有许多其他用途,可以让你的生活更轻松、更有条理。在这个 Git 系列中,我们将分享七种鲜为人知的使用 Git 的方法。
今天,我们将看看 SparkleShare它使用 Git 作为文件共享的基础。
### 用于文件共享的 Git
Git 的优点之一是它具有固有的分发能力。它可用来建立共享。即使你只是与自己网络上的其他计算机共享资源库Git 也会为从共享位置获取文件的行为带来透明性。
随着其界面的发展Git 变得非常简单。虽然因用户而异,他们坐下来完成一些工作时的共同点仅仅是 `git pull` 或稍微复杂一点的 `git pull && git checkout -b my-branch`。但是,对于某些人来说,将*命令输入*到他们的计算机中的做法完全是令人困惑或烦恼的。计算机旨在使生活变得轻松,计算机擅长重复性工作,因此有更简便的方法可以与 Git 共享文件。
### SparkleShare
[SparkleShare][3] 项目是一个基于 Git 的跨平台的开源的 Dropbox 式的文件共享应用程序。它通过将文件拖放到专门指定的 SparkleShare 目录中的简单操作,自动执行所有 Git 命令,触发添加、提交、推送和拉取过程。因为它基于 Git所以你可以获得基于差异diff的快速推送和拉取并且继承了 Git 版本控制和后端基础设施(如 Git 挂钩)的所有优点。它可以完全自托管,也可以将其与 [GitLab][4]、GitHub、Bitbucket 等 Git 托管服务一起使用。此外,由于它基本上只是一个 Git 的前端,因此你可以在可能没有 SparkleShare 客户端但有 Git 客户端的设备上访问 SparkleShare 中的文件。
正如你获得 Git 的所有好处一样,你也会受到所有常见的 Git 限制:使用 SparkleShare 存储数百张照片、音乐和视频是不切实际的,因为 Git 是为文本而设计和优化的。Git 当然可以存储二进制文件的大文件,但是因为它可以跟踪历史记录,因此一旦将文件添加到其中,几乎就不可能完全删除它。这在某种程度上限制了 SparkleShare 对某些人的实用性,但使其非常适合许多工作流程,包括 [日程安排][5]。
#### 安装 SparkleShare
SparkleShare 是跨平台的,可从[网站][6]获得适用于 Windows 和 Mac 的安装程序。对于 Linux有一个 [Flatpak][7] 安装包,或者你可以在终端中运行以下命令:
```
$ sudo flatpak remote-add flathub https://flathub.org/repo/flathub.flatpakrepo
$ sudo flatpak install flathub org.sparkleshare.SparkleShare
```
### 创建一个 Git 存储库
SparkleShare 并不是软件即服务SaaS。你在计算机上运行 SparkleShare 以与 Git 存储库进行通信,而 SparkleShare 并不存储你的数据。如果你还没有与文件夹同步的 Git 存储库,则必须在启动 SparkleShare 之前创建一个文件夹。你有三个选择:托管的 Git、自托管 Git 或自托管 SparkleShare。
#### 托管的 Git
SparkleShare 可以使用你可以访问的任何 Git 存储库进行存储因此如果你拥有或可在其中创建的GitLab 或任何其他托管服务的帐户,则它可以成为 SparkleShare 的后端。例如,开源 [Notabug.org][8] 服务是一个类似于 GitHub 和 GitLab 的 Git 托管服务,但其独特性足以证明 SparkleShare 的灵活性。根据用户界面的不同,不同的托管服务创建新存储库的方法也有所不同,但是所有主要存储库都遵循相同的通用模型。
首先,在托管服务中找到创建一个新项目或存储库的按钮,单击它以开始。然后逐步完成存储库的创建过程,为存储库提供名称、隐私级别(存储库通常默认为公共),以及是否使用 `README` 文件初始化存储库。无论你是否需要个 `README` 文件,请初始化建立一个。使用一个文件创立存储库不是绝对必要的,但是它会强制 Git 主机实例化存储库中的 `master` 分支,这有助于确保前端应用程序(例如 SparkleShare具有要提交并推送的分支。即使文件几乎是空的 `README` 文件,也可以用来查看该文件以确认你已连接成功。
![Creating a Git repository][9]
创建存储库后,获取其用于 SSH 克隆的 URL。你可以像获取任何人从 Git 项目获得其 URL 一样获得此 URL导航至存储库页面并查找 “Clone” 按钮或字段。
![Cloning a URL on GitHub][10]
*GitHub 的克隆 URL。*
![Cloning a URL on GitLab][11]
*GitLab 的克隆 URL。*
这是 SparkleShare 用于获取数据的地址,因此请记下它。你的 Git 存储库现已配置好。
#### 自托管的 Git
你可以使用 SparkleShare 访问你有权访问的任何计算机上的 Git 存储库。除了一个 Git 裸存储库外,无需任何特殊设置。但是,如果你想将对 Git 存储库的访问权授予其他任何人,则应运行 [Gitolite][12] 之类的 Git 管理器或 SparkleShare 自己的 Dazzle 服务器来帮助你管理 SSH 密钥和帐户。至少,创建一个特定于 Git 的用户,以便有权访问你的 Git 存储库的用户不会自动获得对服务器其余部分的访问权限。
以 Git 用户身份登录服务器(如果你非常擅长管理用户和组权限,则可以以自己的用户登录)并创建存储库:
```
$ mkdir ~/sparkly.git
$ cd ~/sparkly.git
$ git init --bare .
```
你的 Git 存储库现已配置好。
#### Dazzle
SparkleShare 的开发人员提供了一个名为 [Dazzle][13] 的 Git 管理系统,以帮助你自托管 Git 存储库。
在你的服务器上,将 Dazzle 应用程序下载到你的路径中的某个位置:
```
$ curl https://raw.githubusercontent.com/hbons/Dazzle/master/dazzle.sh --output ~/bin/dazzle
$ chmod +x ~/bin/dazzle
```
Dazzle 设置了一个特定于 Git 和 SparkleShare 的用户,并且还基于 SparkleShare 应用程序生成的密钥实现了访问权限。现在,只需设置一个项目:
```
$ dazzle create sparkly
```
你的服务器现在已经配置好,可以用作 SparkleShare 托管了。
### 配置 SparkleShare
首次启动 SparkleShare 时,系统会提示你配置要让 SparkleShare 用于存储的服务器。这个过程可能看起来像一个首次运行的安装向导,但实际上是在 SparkleShare 中设置新共享位置的通常过程。与许多共享驱动器应用程序不同,使用 SparkleShare 可以一次配置多个位置。你配置的第一个共享位置并不比你以后可以设置的任何共享位置重要,并且你也没有注册 SparkleShare 或任何其他服务。你只是将 SparkleShare 指向 Git 存储库,以便它知道如何使第一个 SparkleShare 文件夹保持同步。
在第一个屏幕上给出一个身份SparkleShare 将在代表你进行的 Git 提交记录中使用这些信息。你可以使用任何内容,甚至可以不代表任何意义的伪造信息。它仅用于提交消息,如果你对审查 Git 后端进程没有兴趣,你可能甚至看不到它们。
下一个屏幕提示你选择主机类型。如果你使用的是 GitLab、GitHub、Planio 或 Bitbucket则可以选择一个适当的。否则请选择“自己的服务器”。
![Choosing a Sparkleshare host][14]
在此屏幕底部,您必须输入 SSH 的克隆 URL。如果你是自托管的 Git则地址类似于 `<ssh://username@example.com>`,而远程路径是为此目的而创建的 Git 存储库的绝对路径。
根据上面的自托管示例,我虚构的服务器的地址为 `ssh://git@example.com:22122``:22122` 表示非标准的 SSH 端口),远程路径为 `/home/git/sparkly.git`
如果我改用 Notabug.org 帐户,则上例中的地址为 `ssh://git@notabug.org`,路径为 `seth/sparkly.git`
SparkleShare 首次尝试连接到主机时将失败,因为你尚未将 SparkleShare 客户端 ID特定于 SparkleShare 应用程序的 SSH 密钥)复制到 Git 主机。这是预料之中的,所以不要取消该过程。将 SparkleShare 设置窗口保持打开状态,并从系统任务栏中的 SparkleShare 图标处获取客户端 ID。然后将客户端 ID 复制到剪贴板,以便可以将其添加到 Git 主机。
![Getting the client ID from Sparkleshare][16]
#### 将你的客户端 ID 添加到托管的 Git 帐户
除了较小的 UI 差异外,在任何托管服务上添加 SSH 密钥(所有客户端 ID 都是这样)的过程基本上是相同的。在你的 Git 主机的 Web 仪表板中,导航到你的用户设置,然后找到 “SSH 密钥”类别。单击“添加新密钥”按钮(或类似按钮),然后粘贴你的 SparkleShare 客户端 ID 的内容。
![Adding an SSH key][17]
保存密钥。如果你希望其他人(例如协作者或家庭成员)能够访问同一存储库,则他们必须向你提供其 SparkleShare 客户端 ID以便你可以将其添加到帐户中。
#### 将你的客户端 ID 添加到自托管的 Git 帐户
SparkleShare 客户端 ID 只是一个 SSH 密钥,因此将其复制并粘贴到 Git 用户的 `~/.ssh/authorized_keys`文件中。
#### 使用 Dazzle 添加你的客户 ID
如果你使用 Dazzle 管理 SparkleShare 项目,请使用以下命令添加客户端 ID
```
$ dazzle link
```
当 Dazzle 提示你输入该 ID 时,请粘贴在 SparkleShare 菜单中找到的客户端 ID。
### 使用 SparkleShare
将客户端 ID 添加到 Git 主机后,在 SparkleShare 窗口中单击“重试”按钮以完成设置。克隆存储库完成后,你可以关闭 SparkleShare 设置窗口,并在你的家目录中找到一个新的 `SparkleShare` 文件夹。如果你设置了带有托管服务的 Git 存储库,并选择包括 `README` 文件或许可证文件,则可以在 SparkleShare 目录中看到它们。
![Sparkleshare file manager][18]
此外,有一些隐藏目录,你可以通过在文件管理器中显示隐藏目录来查看。
![Showing hidden files in GNOME][19]
使用 SparkleShare 的方式与使用计算机上任何目录的方式相同:将文件放入其中。每当将文件或目录放入 SparkleShare 文件夹时,它都会在后台复制到你的 Git 存储库。
#### 排除某些文件
由于 Git 从设计上就是要记住*一切*,因此你可能希望从记录中排除特定的文件类型。排除一些文件是有原因的。通过定义摆脱 SparkleShare 限制的文件可以避免意外复制大文件。你还可以为自己设计一种方案使你可以将存储在一个目录中的逻辑上属于同一文件例如MIDI 文件及其 .flac 导出文件),但是可以自己手动备份大文件,而同时让 SparkleShare 备份基于文本的文件。
如果在系统的文件管理器中看不到隐藏的文件,请显示它们。导航到你的 SparkleShare 文件夹,然后到代表你的存储库的目录,找到一个名为 `.gitignore` 的文件,然后在文本编辑器中将其打开。你可以在 `.gitignore` 中输入文件扩展名或文件名(每行一个),任何与你列出的文件匹配的文件都会被忽略(如文件名所示)。
```
Thumbs.db
$RECYCLE.BIN/
.DS_Store
._*
.fseventsd
.Spotlight-V100
.Trashes
.directory
.Trash-*
*.wav
*.ogg
*.flac
*.mp3
*.m4a
*.opus
*.jpg
*.png
*.mp4
*.mov
*.mkv
*.avi
*.pdf
*.djvu
*.epub
*.od{s,t}
*.cbz
```
你知道最经常遇到哪些文件类型,因此请集中精力处理最有可能潜入你的 SparkleShare 目录的文件。如果您想稍微矫枉过正一些,可以在 Notabug.org 以及整个网上找到 `.gitignore` 文件的好集合。
通过将这些条目保存在 `.gitignore` 文件中,你可以将不需要发送到 Git 主机的大文件放在 SparkleShare 目录中SparkleShare 将完全忽略它们。当然,这意味着您需要确保它们可以备份或通过其他方式分发给你的 SparkleShare 合作者。
### 自动化
[自动化][20] 是我们与计算机达成的默契之一计算机执行重复的、无聊的工作而我们人类要么不擅长做这些要么不擅长记忆这些。SparkleShare 是一种很好的、简单的自动执行例行数据分发的方法。无论如何,这并不适合每个 Git 存储库。它没有用于高级 Git 功能的接口它没有暂停按钮或手动管理的操作。没关系因为它的范围是有意限制的。SparkleShare 可以完成 SparkleShare 计划要做的事情,它做得很好,而且它是你无需关心的一个 Git 存储库。
如果你想使用这种稳定的、看不见的自动化,请尝试一下 SparkleShare。
--------------------------------------------------------------------------------
via: https://opensource.com/article/19/4/file-sharing-git
作者:[Seth Kenlon][a]
选题:[lujun9972][b]
译者:[wxy](https://github.com/wxy)
校对:[校对者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/rh_003499_01_cloud21x_cc.png?itok=5UwC92dO
[2]: https://git-scm.com/
[3]: http://www.sparkleshare.org/
[4]: http://gitlab.com
[5]: https://opensource.com/article/19/4/calendar-git
[6]: http://sparkleshare.org
[7]: /business/16/8/flatpak
[8]: http://notabug.org
[9]: https://opensource.com/sites/default/files/uploads/git-new-repo.jpg (Creating a Git repository)
[10]: https://opensource.com/sites/default/files/uploads/github-clone-url.jpg (Cloning a URL on GitHub)
[11]: https://opensource.com/sites/default/files/uploads/gitlab-clone-url.jpg (Cloning a URL on GitLab)
[12]: http://gitolite.org
[13]: https://github.com/hbons/Dazzle
[14]: https://opensource.com/sites/default/files/uploads/sparkleshare-host.jpg (Choosing a Sparkleshare host)
[15]: mailto:git@notabug.org
[16]: https://opensource.com/sites/default/files/uploads/sparkleshare-clientid.jpg (Getting the client ID from Sparkleshare)
[17]: https://opensource.com/sites/default/files/uploads/git-ssh-key.jpg (Adding an SSH key)
[18]: https://opensource.com/sites/default/files/uploads/sparkleshare-file-manager.jpg (Sparkleshare file manager)
[19]: https://opensource.com/sites/default/files/uploads/gnome-show-hidden-files.jpg (Showing hidden files in GNOME)
[20]: /downloads/ansible-quickstart

View File

@ -1,125 +0,0 @@
[#]: collector: (lujun9972)
[#]: translator: (MjSeven)
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )
[#]: subject: (An advanced look at Python interfaces using zope.interface)
[#]: via: (https://opensource.com/article/19/9/zopeinterface-python-package)
[#]: author: (Moshe Zadka https://opensource.com/users/moshezhttps://opensource.com/users/lauren-pritchetthttps://opensource.com/users/sethhttps://opensource.com/users/drmjg)
借助 zope.interface 深入了解 Python 接口
======
Zope.interface 可以帮助指出存在哪些接口,是由哪些对象提供的,以及如何查询这些信息。
![Snake charmer cartoon with a yellow snake and a blue snake][1]
**zope.interface** 库可以克服 Python 接口设计中的歧义性。让我们来研究一下。
### 隐式接口不是 Python 之禅
[Python 之禅][2] 很宽松,但是有点自相矛盾,你可以从中证明一切。让我们来思考其中最著名的原则之一:“显示胜于隐式”。
在 Python 中会隐含的一件事是预期的接口。比如函数已经记录了它期望一个“类文件对象”或“序列”。但是什么是类文件对象呢?它支持 **.writelines** 和 **.seek** 吗?什么是一个“序列”?是否支持分步切片,例如 **a[1:10:2]**
最初Python 的答案是所谓的“鸭子类型”,取自短语“如果它像鸭子一样行走,像鸭子一样嘎嘎叫,那么它可能就是鸭子”。换句话说,“试试看”,这可能是你能得到的最含蓄的表达。
为了使这些内容显式地表达出来,你需要一种方法来表达期望的接口。最早用 Python 编写的大型系统之一是 [Zope][3] Web 框架,它迫切需要这些东西来明确地呈现代码,例如,期望从“类似用户的对象”获得什么。
**zope.interface** 由 Zope 开发,但作为单独的 Python 包发布。**Zope.interface** 可以帮助指出存在哪些接口,是由哪些对象提供的,以及如何查询这些信息。
想象编写一个简单的 2D 游戏,它需要各种东西来支持 sprite 接口to 校正:这里不知道如何翻译)。例如,表示一个边界框,但也表示对象何时与一个框相交。与一些其他语言不同,在 Python 中,将属性访问作为公共接口一部分是一种常见的做法,而不是实现 getter 和 setter。边界框应该是一个属性而不是一个方法。
呈现外观列表的方法可能类似于:
```
def render_sprites(render_surface, sprites):
    """
    sprites 应该是符合 Sprite 接口的对象列表:
    * 一个属性 "bounding_box",包含了边界框
    * "intersects" 方法,它接受一个 box 并返回 True 或 False
    """
    pass # 一些代码会渲染
```
游戏将具有许多处理 sprite 的功能(函数)。在每个功能(函数)中,你都必须在文档中指定预期。
此外,某些功能可能期望使用更复杂的 Sprite 对象,例如具有 Z-order 的对象。我们必须跟踪哪些方法需要 Sprite 对象,哪些方法需要 SpriteWithZ 对象。
如果能够使 sprite 的内容显式出来,这样方法就可以声明“我需要一个 sprite”并严格定义接口这不是很好吗来看看 **zope.interface**
```
from zope import interface
class ISprite(interface.Interface):
    bounding_box = interface.Attribute(
        "The bounding box"
    )
    def intersects(box):
        "它和一个框相交吗?"
```
乍看起来,这段代码有点奇怪。这些方法不包括 "self",而包含 "self" 是一种常见的做法,并且它有一个属性。这是在 zope.interface 中声明接口的方法。这看起来很奇怪,因为大多数人不习惯严格声明接口。
这样做的原因是接口显示了如何调用方法,而不是如何定义方法。因为接口不是超类,所以它们可以用来声明数据属性。
下面是一个可能的接口实现:
```
@implementer(ISprite)
@attr.s(auto_attribs=True)
class CircleSprite:
    x: float
    y: float
    radius: float
    @property
    def bounding_box(self):
        return (
            self.x - self.radius,
            self.y - self.radius,
            self.x + self.radius,
            self.y + self.radius,
        )
    def intersects(self, box):
        # 当且仅当至少一个角在圆内时,方框与圆相交
        top_left, bottom_right = box[:2], box[2:]
        for choose_x_from (top_left, bottom_right):
            for choose_y_from (top_left, bottom_right):
                x = choose_x_from[0]
                y = choose_y_from[1]
                if (((x - self.x) ** 2 + (y - self.y) ** 2) &lt;=
                    self.radius ** 2):
                     return True
        return False
```
_显式_ 声明了 **CircleSprite** 类实现接口。它甚至能让我们验证该类是否正确实现了接口:
```
from zope.interface import verify
def test_implementation():
    sprite = CircleSprite(x=0, y=0, radius=1)
    verify.verifyObject(ISprite, sprite)
```
这可以由 **pytest**、**nose** 或其他测试框架运行,它将验证创建的 sprite 是否符合接口。测试通常是局部的:它不会测试文档中没有提及的内容,甚至不会测试方法是否可以在没有异常的情况下被调用!但是,它会检查是否存在正确的方法和属性。这是对单元测试套件一个很好的补充,至少可以防止简单的拼写错误通过测试。
--------------------------------------------------------------------------------
via: https://opensource.com/article/19/9/zopeinterface-python-package
作者:[Moshe Zadka][a]
选题:[lujun9972][b]
译者:[MjSeven](https://github.com/MjSeven)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://opensource.com/users/moshezhttps://opensource.com/users/lauren-pritchetthttps://opensource.com/users/sethhttps://opensource.com/users/drmjg
[b]: https://github.com/lujun9972
[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/getting_started_with_python.png?itok=MFEKm3gl (Snake charmer cartoon with a yellow snake and a blue snake)
[2]: https://en.wikipedia.org/wiki/Zen_of_Python
[3]: http://zope.org

View File

@ -0,0 +1,230 @@
[#]: collector: (lujun9972)
[#]: translator: (MjSeven)
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )
[#]: subject: (How to write a Python web API with Django)
[#]: via: (https://opensource.com/article/19/11/python-web-api-django)
[#]: author: (Rachel Waston https://opensource.com/users/rachelwaston)
如何借助 Django 来编写一个 Python Web API
======
Django 是 Python API 开发中最流行的框架之一,在这个教程中,我们来学习如何使用它。
![拿起 Python 书来学习吧][1]
[Django][2] 所有 Web 框架中最全面的,也是最受欢迎的一个。自 2005 年以来,其流行度大幅上升。
Django 是由 Django 软件基金会维护,并且获得了社区的大力支持,在全球拥有超过 11,600 名会员。在 Stack Overflow 上Django 约有 191,000 个带标签的问题。Spotify、YouTube 和 Instagram 等都使用 Django 来构建应用程序和数据管理。
本文演示了一个简单的 API通过它可以使用 HTTP 协议的 GET 方法来从服务器获取数据。
### 构建一个项目
首先,为你的 Django 应用程序创建一个目录结构,你可以在系统的任何位置创建:
```
$ mkdir myproject
$ cd myproject
```
然后,在项目目录中创建一个虚拟环境来隔离本地包依赖关系:
```
$ python3 -m venv env
$ source env/bin/activate
```
在 Windows 上,使用命令 **env\Scripts\activate** 来激活虚拟环境:
### 安装 Django 和 Django REST framework
然后,安装 Django 和 Django REST
```
$ pip3 install django
$ pip3 install djangorestframework
```
### 实例化一个新的 Django 项目
现在你的应用程序已经有了一个工作环境,你必须实例化一个新的 Django 项目。与 [Flask][3] 这样微框架不同的是Django 有专门的命令来创建(注意第一条命令后的 **.** 字符)。
```
$ django-admin startproject tutorial .
$ cd tutorial
$ django-admin startapp quickstart
```
Django 使用数据库来管理后端,所以你应该在开始开发之前同步数据库,数据库可以通过 **manage.py** 脚本管理,它是在你运行 **django-admin** 命令时创建的。因为你现在在 **tutorial** 目录,所以使用 **../** 符号来运行脚本,它位于上一层目录:
```
$ python3 ../manage.py makemigrations
No changes detected
$ python4 ../manage.py migrate
Operations to perform:
  Apply all migrations: admin, auth, contenttypes, sessions
Running migrations:
  Applying contenttypes.0001_initial... OK
  Applying auth.0001_initial... OK
  Applying admin.0001_initial... OK
  Applying admin.0002_logentry_remove_auto_add... OK
  Applying admin.0003_logentry_add_action_flag_choices... OK
  Applying contenttypes.0002_remove_content_type_name... OK
  Applying auth.0002_alter_permission_name_max_length... OK
  Applying auth.0003_alter_user_email_max_length... OK
  Applying auth.0004_alter_user_username_opts... OK
  Applying auth.0005_alter_user_last_login_null... OK
  Applying auth.0006_require_contenttypes_0002... OK
  Applying auth.0007_alter_validators_add_error_messages... OK
  Applying auth.0008_alter_user_username_max_length... OK
  Applying auth.0009_alter_user_last_name_max_length... OK
  Applying auth.0010_alter_group_name_max_length... OK
  Applying auth.0011_update_proxy_permissions... OK
  Applying sessions.0001_initial... OK
```
### 在 Django 中创建用户
创建一个名为 **admin**,密码为 **password123** 的初始用户:
```
$ python3 ../manage.py createsuperuser \
  --email [admin@example.com][4] \
  --username admin
```
在提示时创建密码。
### 在 Django 中实现序列化和视图
为了使 Django 能够将信息传递给 HTTP GET 请求必须将信息对象转化为有效的响应数据。Django 为此实现了“序列化类”。
在你的项目中,创建一个名为 **quickstart/serializers.py** 的新模块,使用它来定义一些序列化器,模块将用于数据展示:
```
from django.contrib.auth.models import User, Group
from rest_framework import serializers
class UserSerializer(serializers.HyperlinkedModelSerializer):
    class Meta:
        model = User
        fields = ['url', 'username', 'email', 'groups']
class GroupSerializer(serializers.HyperlinkedModelSerializer):
    class Meta:
        model = Group
        fields = ['url', 'name']
```
Django 中的 [view][5] 是一个接受 Web 请求并返回 Web 响应的函数。响应可以是 HTML、HTTP 重定向、HTTP 错误、JSON 或 XML 文档、图像或 TAR 文件,或者可以是从 Internet 获得的任何其他内容。要创建视图,打开 **quickstart/views.py** 并输入以下代码。该文件已经存在,并且其中包含一些示例文本,保留这些文本并将以下代码添加到文件中:
```
from django.contrib.auth.models import User, Group
from rest_framework import viewsets
from tutorial.quickstart.serializers import UserSerializer, GroupSerializer
class UserViewSet(viewsets.ModelViewSet):
    """
    API 允许查看或编辑用户
    """
    queryset = User.objects.all().order_by('-date_joined')
    serializer_class = UserSerializer
class GroupViewSet(viewsets.ModelViewSet):
    """
    API 允许查看或编辑组
    """
    queryset = Group.objects.all()
    serializer_class = GroupSerializer
```
### 使用 Django 生成 URL
现在,你可以生成 URL 以便人们可以访问你刚起步的 API。在文本编辑器中打开 urls.py 并将默认示例代码替换为以下代码:
```
from django.urls import include, path
from rest_framework import routers
from tutorial.quickstart import views
router = routers.DefaultRouter()
router.register(r'users', views.UserViewSet)
router.register(r'groups', views.GroupViewSet)
# 使用自动路由 URL
# 还有登录 URL
urlpatterns = [
    path('', include(router.urls)),
    path('api-auth/', include('rest_framework.urls', namespace='rest_framework'))
]
```
### 调整你的 Django 项目设置
这个示例项目的设置模块存储在 **tutorial/settings.py** 中,因此在文本编辑器中将其打开,然后在 **INSTALLED_APPS** 列表的末尾添加 **rest_framework**
```
INSTALLED_APPS = [
    ...
    'rest_framework',
]
```
### 测试 Django API
现在,你可以测试构建的 API。首先从命令行启动内置服务器
```
`$ python3 manage.py runserver`
```
你可以通过使用 **curl** 导航至 URL **<http://localhost:8000/users>** 来访问 API
```
$ curl --get <http://localhost:8000/users/?format=json>
[{"url":"<http://localhost:8000/users/1/?format=json","username":"admin","email":"admin@example.com","groups":\[\]}\]>
```
使用 Firefox 或[开源浏览器][6]
![一个简单的 Django API][7]
有关使用 Django 和 Python 的 RESTful API 的更多深入知识,参考出色的 [Django 文档][8]。
### 为什么要使用 Djago
Django 的主要优点:
1. Django 社区的规模正在不断扩大,因此即使你做一个复杂项目,也会有大量的指导资源。
2. 默认包含模板、路由、表单、身份验证和管理工具等功能,你不必寻找外部工具,也不必担心第三方工具会引入兼容性问题。
3. 用户,循环和条件的简单结构使你可以专注于编写代码。
4. 这是一个成熟且经过优化的框架,它非常快速且可靠。
Django 的主要缺点是:
1. Django 很复杂!从开发人员视角的角度来看,它可能比简单的框架更难学。
2. Django 有一个很大的生态系统。一旦你熟悉它,这会很棒,但是当你深入学习时,它可能会令人感到无所适从。
对你的应用程序或 API 来说Django 是绝佳选择。下载并熟悉它,开始开发一个迷人的项目!
--------------------------------------------------------------------------------
via: https://opensource.com/article/19/11/python-web-api-django
作者:[Rachel Waston][a]
选题:[lujun9972][b]
译者:[MjSeven](https://github.com/MjSeven)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://opensource.com/users/rachelwaston
[b]: https://github.com/lujun9972
[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/python-programming-code-keyboard.png?itok=fxiSpmnd (Hands on a keyboard with a Python book )
[2]: https://www.djangoproject.com/
[3]: https://opensource.com/article/19/11/python-web-api-flask
[4]: mailto:admin@example.com
[5]: https://docs.djangoproject.com/en/2.2/topics/http/views/
[6]: https://opensource.com/article/19/7/open-source-browsers
[7]: https://opensource.com/sites/default/files/uploads/django-api.png (A simple Django API)
[8]: https://docs.djangoproject.com/en/2.2

View File

@ -0,0 +1,176 @@
[#]: collector: (lujun9972)
[#]: translator: (wxy)
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )
[#]: subject: (7 maker gifts for kids and teens)
[#]: via: (https://opensource.com/article/19/11/maker-gifts-kids)
[#]: author: (Jess Weichler https://opensource.com/users/cyanide-cupcake)
7 个给儿童和少年的创客礼物
======
> 这份礼物指南可给婴儿、儿童、青少年及年龄更大的人们带来创造和创新能力,使你轻松完成节日礼物的采购。
![Gift box opens with colors coming out][1]
还在纠结这个假期给年轻人买什么礼物?这是我精选的开源礼物,这些礼物将激发未来的创意和灵感。
### 蜂鸟机器人套件
![Hummingbird Robotics Kit][2]
**年龄:**8 岁 - 成人
**这是什么:**[蜂鸟机器人套件][3]是一套完整的机器人套件带有微控制器、电机、LED 和传感器。机器人的大脑具有特殊的端口,小手可以轻松地将其连接到机器人的组件上。蜂鸟套件并没有身体,鼓励用户自己创建一个。
**为什么我喜欢它:**蜂鸟可以使用多种编程语言 —— 从可视化编程BirdBlox、MakeCode、Snap到代码编程Python 和 Java—— 可以随着用户编码技能的提高而可扩展。所有组件均与你在电子商店中找到的组件完全相同,没有像其他机器人套件那样被塑料所遮盖。这使机器人的内部工作不再神秘,并在你需要时易于采购更多零件。
由于没有固定组合项目,因此蜂鸟是发挥创造力的完美机器人。
蜂鸟具有开源的软件和固件。它适用于 Linux、Windows、Mac、Chromebook、Android 和 iOS。
**费用:**起价为 99 美元。
### Makey Makey 经典版
![Makey Makey Classic][4]
**年龄:** 6岁 - 成人
**这是什么:** [Makey Makey 经典版][5]可将任何导电物体(从棉花糖到朋友)变成计算机钥匙。
你可以使用鳄鱼夹将 Makey Makey 连接到你选择的导电物体上。然后通过同时触摸两个导电物体来闭合接地和任何触发键之间的电路。Makey Makey 是一种安全的方法,可以安全地在家中探索电力,同时创造与计算机进行交互的有趣方式。
**为什么我喜欢它:** Makey Makey 可以与 Scratch 开发的视频游戏搭配使用,以创建独特的控制器,使用户进一步沉浸在游戏中。从用卫生纸卷和铝箔制成的工具到互动艺术和故事,可能性是无限的。它可以在具有 USB 端口的 Linux、Windows 和 Mac 计算机上使用。
**费用:** 49.95 美金
### Arduino Uno
![Arduino Uno][6]
**年龄:** 10 岁 - 成人
**这是什么:** Arduino 是随同电子套件购买的微控制器,也可以单独购买,它们具有多种版本,尽管我最喜欢[Arduino Uno][7]。可以根据需要从任何电子商店购买其他组件,例如 LED、电机和传感器。
**为什么我喜欢它:** Arduino Uno 的文档很完善因此创客们很容易在线上找到教程。Arduino 可以实现从简单到复杂的各种电子项目。Arduino 具有开源的固件和硬件。它适用于 Linux、Mac 和 Windows。
**费用:**主板的起价为 22.00 美元。总成本取决于项目和技能水平。
### DIY 创客套件
![A maker kit assembled in a quick trip to the hardware store][8]
**年龄**8 岁 - 成人
**这是什么:**当今许多创客、发明家和程序员都是从碰巧修补附加的东西开始的。你可以快速前往最近的电子产品商店,为家里的年轻人创建一套出色的创客工具包。这是我的创客工具包中的内容:
* 护目镜
* 锤子
* 钉子和螺丝
* 碎木
* 螺丝起子
* 电线
* LED
* 压电蜂鸣器
* 马达
* 带引线的AA电池组
* 剪线钳
* 纸板
* 美纹纸胶带
* 废布
* 纽扣
* 线程
* 针
* 拉链
* 钩子
* 一个很酷的工具盒,用来存放所有东西
  
**我为什么喜欢它:**还记得小时候,你把父母带回家的空纸箱变成了宇宙飞船、房屋或超级计算机吗?这就是为大孩子们准备的 DIY 创客工具包。
原始的组件使孩子们可以尝试并运用他们的想象力。DIY 创客工具包可以完全针对接收者定制。可以放入一些接受这份礼品的人可能从未想到过用之发挥创意的某些组件,例如为下水道提供一些 LED 或木工结构。
**费用:**不等
### 启发式游戏篮
![Heuristic play kit][9]
**年龄:** 8 个月至 5 岁
**这是什么:**启发式游戏篮充满了由天然、无毒材料制成的有趣物品,可供婴幼儿使用其五种感官进行探索。这是一种开放式、自娱自乐的游戏。其想法是,成年人将监督(但不指导)儿童使用篮子及其物品半小时,然后将篮子拿走下一次再玩。
创建带有常见家用物品的可爱游戏篮很容易。尝试包括质地、声音、气味、形状和重量各不相同的物品。这里有一些想法可以帮助您入门。
* 漏勺或脊状柳条篮可容纳所有物品
* 木勺子
* 金属打蛋器和汤匙
* 板刷
* 海绵
* 小鸡蛋纸箱
* 纸板管
* 小擀面杖
* 带纹理的毛巾
* 岩石
* 手铃
* 钩针桌巾
* 带盖的小铁罐
  
游戏篮中不应包括任何容易破碎的东西或足够小到可以装入纸巾卷的东西,因为它们有窒息危险,应将所有物品彻底清洁后再交给孩子。
**我为什么喜欢它:**游戏篮非常适合感官发育,并可以帮助幼儿提出问题和探索周围的世界。这是培养创客思维方式的重要组成部分!
很容易获得适合这个游戏篮的物品。你可能已经在家中或附近的二手店里有很多有趣的物品。幼儿使用游戏篮的方式与婴儿不同。随着孩子开始模仿成人生活并通过他们的游戏讲故事,这些物品将随孩子一起成长。
**费用:**不等
### 《Hello Ruby》
![Hello Ruby book cover][10]
**年龄**5-8 岁
**这是什么:** 《[Hello Ruby][11]:编码历险记》是 Linda Liukas 的插图书通过有趣的故事讲述了一个遇到各种问题和朋友每个都用一个码代表的女孩向孩子们介绍了编程概念。Liukas 还有其他副标题为《互联网探险》和《计算机内的旅程》的《Hello Ruby》书籍而《编码历险记》已以 20 多种语言出版。
**为什么我喜欢它:**作者在书中附带了许多免费、有趣和无障碍的活动,可以从 Hello Ruby 网站下载和打印这些活动。这些活动教授编码概念、还涉及艺术表达、沟通、甚至时间安排。
**费用:**精装书的标价为 17.99 美元,但你可以通过本地或在线书店以较低的价格买到这本书。
### 《编程少女:学会编程和改变世界》
![Girls Who Code book cover][12]
**年龄**10 岁 - 成人
**内容是什么:**由《编程少女》的创始人 Reshma Saujani 撰写,《[编程少女:学会编程和改变世界][13]》为年轻女孩(以及男孩)提供了科技领域的实用信息。它涵盖了广泛的主题,包括编程语言、用例、术语和词汇、职业选择以及技术行业人士的个人简介和访谈。
**为什么我喜欢它:**本书以讲述了大多数面向成年人的网站没有的技术故事。技术涉及许多学科,对于年轻人来说,重要的是要了解他们可以使用它来解决现实世界中的问题并有所作为。
**成本:**精装书的标价为 17.99 美元,平装书的标价为 10.99 美元,但你可以通过本地或在线书店以更低的价格找到。
--------------------------------------------------------------------------------
via: https://opensource.com/article/19/11/maker-gifts-kids
作者:[Jess Weichler][a]
选题:[lujun9972][b]
译者:[wxy](https://github.com/wxy)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://opensource.com/users/cyanide-cupcake
[b]: https://github.com/lujun9972
[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/OSDC_gift_giveaway_box_520x292.png?itok=w1YQhNH1 (Gift box opens with colors coming out)
[2]: https://opensource.com/sites/default/files/uploads/hummingbird.png (Hummingbird Robotics Kit)
[3]: https://www.birdbraintechnologies.com/hummingbirdbit/
[4]: https://opensource.com/sites/default/files/uploads/makeymakey2.jpg (Makey Makey Classic)
[5]: https://makeymakey.com/
[6]: https://opensource.com/sites/default/files/uploads/arduinouno.jpg (Arduino Uno)
[7]: https://www.arduino.cc/
[8]: https://opensource.com/sites/default/files/makerbox-makerkit.jpg (A maker kit assembled in a quick trip to the hardware store)
[9]: https://opensource.com/sites/default/files/makerbox-sensorykit.jpg (Heuristic play kit)
[10]: https://opensource.com/sites/default/files/uploads/helloruby2.jpg (Hello Ruby book cover)
[11]: https://www.helloruby.com/
[12]: https://opensource.com/sites/default/files/uploads/girlswhocodebook.jpg (Girls Who Code book cover)
[13]: https://girlswhocode.com/book/girls-code-learn-code-change-world/

View File

@ -0,0 +1,132 @@
[#]: collector: (lujun9972)
[#]: translator: (geekpi)
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )
[#]: subject: (Make VLC More Awesome With These Simple Tips)
[#]: via: (https://itsfoss.com/simple-vlc-tips/)
[#]: author: (Ankush Das https://itsfoss.com/author/ankush/)
这些简单的技巧使 VLC 更加出色
======
如果 [VLC][1] 不是最好的播放器,那它是[最好的开源视频播放器][2]之一。大多数人不知道的是,它不仅仅是视频播放器。
你可以进行许多复杂的任务,如直播视频、捕捉设备等。只需打开菜单,你就可以看到它有多少选项。
它的 FOSS 页面有一个详细的教程,讨论一些[专业的 VLC 技巧][3],但这些对于普通用户太复杂。
这就是为什么我写另一篇文章的原因,来向你展示一些可以在 VLC 中使用的简单技巧。
### 使用这些简单技巧让 VLC 做更多事
Lets see what can you do with VLC other than just playing a video file.
让我们看看除了播放视频文件之外,你还可以使用 VLC 做什么。
#### 1\. 使用 VLC 观看 YouTube 视频
![][4]
如果你不想在 [YouTube][5] 上观看令人讨厌的广告,或者只想体验没有打扰地观看 YouTube 视频,你可以使用 VLC。
是的,在 VLC 上流式传输 YouTube 视频是非常容易的。
只需启动 VLC 播放器,前往媒体设置,然后单击 ”**Open Network Stream**“ 或使用快捷方式 **CTRL + N**
![][6]
接下来,你只需要粘贴要观看的视频的 URL。有一些选项可以调整但通常你无需担心这些。如果你好奇你可以点击 ”**Advanced options**“ 来探索。
你还可以通过这种方式向 YouTube 视频添加字幕。然而,[一个更简单的带字幕观看 Youtube 视频的办法是使用 Penguin 字幕播放器][7]。
#### 2\. 将视频转换为不同格式
![][8]
你可以[在 Linux 命令行使用 ffmpeg 转换视频][9]。你还可以使用图形工具,如 [HandBrake 转换视频格式][10]。
但是,如果你不想用一个单独的应用转码视频,你可以使用 VLC 播放器来完成该工作。
为此,只需点击 VLC 上的媒体选项,然后单击 **Convert/Save**,或者在 VLC 播放器处于活动状态时按下快捷键 CTRL + R。
接下来,你需要从计算机/硬盘或者 URL 导入你想保存/转换的的视频。
不管什么来源,只需选择文件后点击 ”**Convert/Save**“ 按钮
你现在会看到另外一个窗口给你更改 ”**Profile**“ 设置。点击并选择你想转换的格式(并保存)。
你还可以在转换之前通过在屏幕底部设置目标文件夹来更改转换文件的存储路径。
#### 3\. 从源录制音频/视频
![Vlc Advanced Controls][11]
你是否想在 VLC 播放器中录制正在播放的音频/视频?
如果是的话,有一个简单的解决方案。只需**通过 View然后点击 ”Advanced Controls“**。
完成后,你会看到一个新按钮(包括 VLC 播放器中的红色录制按钮)。
#### 4\. 自动下载字幕
![][12]
是的,你可以[使用 VLC 自动下载字幕][13]。你甚至不必在单独的网站上查找字幕。你只需点击 **View-&gt;VLSub**
默认情况下,它是禁用的,因此当你单击该选项时,它会被激活,并允许你搜索/下载想要的字幕。
[VLC 还能让你使用简单的键盘快捷键同步字幕][14]
#### 5\. 截图
![][15]
你可以在观看视频时使用 VLC 获取一些视频的截图/图像。
你只需在视频播放/暂停时右击播放器,你会看到一组选项,点击 **Video-&gt;Take Snapshot**
如果安装了旧版本,你可能在右键时看到截图选项。
#### 额外技巧:给视频添加音频/视频效果
在菜单中,进入 ”**Tools**“ 选项。单击 ”**Effects and Filters**“,或者在 VLC 播放器窗口中按 **CTRL + E** 打开选项。
好了,你可以观察你给视频添加的音频和视频效果了。你也许无法实时看到效果,因此你需要调整并保存来看发生了什么。
![][16]
我建议在修改视频之前保存一份原始视频备份。
#### 你最喜欢的 VLC 技巧是什么?
我分享了一些我最喜欢的 VLC 技巧。你知道什么你经常使用的很酷的 VLC 技巧吗?为什么不和我们分享呢?我可以把它添加到列表中。
--------------------------------------------------------------------------------
via: https://itsfoss.com/simple-vlc-tips/
作者:[Ankush Das][a]
选题:[lujun9972][b]
译者:[geekpi](https://github.com/geekpi)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://itsfoss.com/author/ankush/
[b]: https://github.com/lujun9972
[1]: https://www.videolan.org/
[2]: https://itsfoss.com/video-players-linux/
[3]: https://itsfoss.com/vlc-pro-tricks-linux/
[4]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/12/youtube-video-stream.jpg?ssl=1
[5]: https://www.youtube.com/
[6]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/12/youtube-video-play.jpg?ssl=1
[7]: https://itsfoss.com/penguin-subtitle-player/
[8]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/12/vlc-video-convert.jpg?ssl=1
[9]: https://itsfoss.com/ffmpeg/
[10]: https://itsfoss.com/handbrake/
[11]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/12/vlc-advanced-controls.png?ssl=1
[12]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/12/vlc-subtitles-automatic.png?ssl=1
[13]: https://itsfoss.com/download-subtitles-automatically-vlc-media-player-ubuntu/
[14]: https://itsfoss.com/how-to-synchronize-subtitles-with-movie-quick-tip/
[15]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/12/vlc-snapshot.png?ssl=1
[16]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/12/vlc-effects-screenshot.jpg?ssl=1

View File

@ -0,0 +1,116 @@
[#]: collector: (lujun9972)
[#]: translator: (robsean)
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )
[#]: subject: (App Highlight: Open Source Disk Partitioning Tool GParted)
[#]: via: (https://itsfoss.com/gparted/)
[#]: author: (Ankush Das https://itsfoss.com/author/ankush/)
应用程序推荐:开源磁盘分区工具 GParted
======
_**摘要GParted 是一个非常流行的自由的可用于 Linux 发行版的分区编辑器。在这里,我们简单地看看它提供了什么。**_
### GParted一个基于自由和开放源码的图形化分区管理器
![][1]
GParted 无疑是[在 Linux 下的最好的分区管理器][2]之一。用户界面非常简单,可用完成任务。
在一些情况下,你最终也需要使用 [GParted][3] 来修复或格式化你的 USB 驱动器。我有一个[我不能在 Ubuntu 中格式化的 USB 磁盘][4],使用该“磁盘”应用程序 这里是 GParted 用来救援的地方。
所以,它是非常有用的工具,有很多好的特色。让我为你们推荐一下。
警告!
玩弄磁盘分区是一件危险的工作。除非绝对必要,否则不要做。否则,你可能最终会擦除整个磁盘。
### GParted 的特色
你可以使用 GParted 做很多事,排列一下简单地格式化任务到重要的分区任务。我将使用一些屏幕截图推荐关键特色,以帮助你在安装它前了解更多信息。
#### 创建分区表
你可以为你的新的磁盘创建一个新的分区表,或者擦除你现存的磁盘内容来修改分区表。
![][5]
你将能够选择 msdos gpt atari ,以及更多类型的分区表。
#### 创建,移动,标记,删除和修改分区表
你可以使用 GParted 中一系列可用的选项来简单地创建,标记,删除或修改分区表。
![][6]
当然,你将不得不小心你想做什么。
好的一些东西是GParted 确保你不能直接应用任何更改 在你点击应用更改之前,它将排队你选择的操作/任务,并询问另外一处最后的确认。
在顶部的对号标记符号 ✓ 允许你来确认更改,只有你更改时开始生效。
这样有另一个你可用的分区选项的屏幕截图:
![][7]
#### 尝试数据救援
除了编辑分区,你也可以尝试使用“**尝试数据救援**”特色以[在Linux 中恢复你丢失的数据][8],像下面的屏幕截图所示。
![][9]
值得注意的是,默认情况下你没有安装这个功能 你仅能看到可见的选项。所以,对于数据恢复特色作业来说,你必需使用下面的命令来单独地安装 gpart (在基于 Ubuntu/Debian 的发行版上)
```
sudo apt install gpart
```
除了所有关键的特色外,它支持大量的存储设备和文件系统。在它们的官方网站上,你可以从[特色列表][10]中学到很多。
### 在 Ubuntu 和其它 Linux 发行版上安装 GParted
你可能已经预先安装 GParted 。所以,务必核实一下。如果你没有安装它,你可以前往进入软件中心安装它。
以备你想使用终端,简单地键入下面的命令:
```
sudo apt install gparted
```
像我如上所述,如果你想要数据恢复选项,除了 gparted 软件包外,你应该安装 gpart 软件包。
如果你正在使用一些其它 Linux 发行版,你可以在各自的软件管理器中找到它,或者简单地查看[官方下载操作指南][11]。
[下载 GParted][11]
**总结**
当涉及处理磁盘管理和分区时GParted 是一个非常有用和重要的工具。但是,因为显而易见的原因,当你使用它时,你将不得不小心。
你尝试过 GParted 吗?你在 Linux 上使用的其它分区工具是什么?请在下面的评论中分享你的体验。
--------------------------------------------------------------------------------
via: https://itsfoss.com/gparted/
作者:[Ankush Das][a]
选题:[lujun9972][b]
译者:[robsean](https://github.com/robsean)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://itsfoss.com/author/ankush/
[b]: https://github.com/lujun9972
[1]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/12/gparted-screenshot.png?ssl=1
[2]: https://itsfoss.com/partition-managers-linux/
[3]: https://gparted.org/
[4]: https://itsfoss.com/format-usb-drive-sd-card-ubuntu/
[5]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/12/gparted-create-partition-table.png?ssl=1
[6]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/12/gparted-modify-partitions.png?ssl=1
[7]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/12/gparted-partition-options.png?ssl=1
[8]: https://itsfoss.com/recover-deleted-files-linux/
[9]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/12/gparted-attempt-data-rescue-feature.png?ssl=1
[10]: https://gparted.org/features.php
[11]: https://gparted.org/download.php

View File

@ -1,65 +0,0 @@
[#]: collector: (lujun9972)
[#]: translator: (BrunoJu)
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )
[#]: subject: (10 Ansible resources to accelerate your automation skills)
[#]: via: (https://opensource.com/article/19/12/ansible-resources)
[#]: author: (James Farrell https://opensource.com/users/jamesf)
提升自动化技巧的10大Ansible资源
======
今年准备好用出色的Ansible自动化技能装备自己的技能包吧。
![Gears above purple clouds][1]
今年我关注了大量关于Ansible的文章以下这些内容都值得每个人学习无论是否是Ansible的新手。
这些文章值得大家标记为书签或者设置个计划任务亦或者是设置一个Tower/AWX job用来提醒自己常读常新。
如果你是Ansible的新手那么就从这些文章开始着手吧
* [_A quickstart guide to Ansible_][2] 拥有一些对新手非常有用的信息,同时还有一些更高级的话题。
* [_10 Ansible modules you need to know_][3] 和 [_5 ops tasks to do with Ansible_][4] 这篇文章有每一位Ansible的管理者都应该熟悉并认真研习的一些最基础的Ansible功能
* [_How to use Ansible to document procedures_][5] 这篇文章是对一些额外话题的纵览,我猜你一定会感到很有趣。
剩余的这些文章包含了更多高级的话题比如Windows管理测试、硬件、云和容器甚至包括了一个案例研究如何管理那些对技术有兴趣的孩子的需求。
我希望你能像我一样好好享受Ansible带来的乐趣。不要停止学习哦
1. _[How Ansible brought peace to my home][6]_ 这个异想天开的案例你能看到如何利用Ansible为孩子们快速部署一个新的笔记本或者重装旧笔记本
2. _[Ansible for the Windows admin][7]_ 你知道Ansible也可以管理Windows的节点吗这篇文章以部署一个IIS为案例阐述了基础的Ansible服务器和Windows客户端的安装。
3. _[10 Ansible modules you need to know][3]_ 这是个学习你最应该知道的那些最常见最基础Ansible模块的好文章。执行命令、安装系统包和操作文件是许多有用的自动化工作的基础。
4. _[How to use Ansible to document procedures][5]_  Ansible的YAML文件易于阅读因此它们可以被用于记录完成任务所需的手动步骤。这一特性可以帮助你调试与扩展这令工作变得异常轻松。同时这篇文章还包含关于测试和分析等Ansible相关主题的指导。
5. _[Using Testinfra with Ansible to verify server state][8]_ 测试环节是任何一个 CI/CD 开发型运维场景不可或缺的一部分。所以为什么不把测试Ansible的运行结果也纳入其中呢这个有关于Ansible测试架构的入门级文章可以被用来帮助你配置。
6. _[Hardware bootstrapping with Ansible][9]_ 这个世界并不是完全已经被容器和虚拟机所占据。许多系统管理员仍然需要管理众多硬件资源。通过Ansible与PXE、DHCP以及其他一些技术的结合你可以创建一个简单的管理框架对硬件实施控制。
7. _[What you need to know about Ansible modules][10]_ 模块给Ansible带来了巨大的潜力许多模块我们已经可以拿来利用。但如果没有你所需的模块那你可以尝试给自己造一个。看看这篇文章吧它能让你了解如何从零开始打造自己所需的模块。
8. _[5 ops tasks to do with Ansible][4]_ 这是另一个有关于如何使用Ansible来管理常见的系统操作任务的文章。这里描述了一系列可以取代命令行操作的TowerAWX)的案例。
9. _[A quickstart guide to Ansible][2]_ 这篇文章是个可以下载的PDF文档。它可以作为一本随时拿来翻阅的手册。这篇文章的开头有助于初学者入门。同时还包括了一些其他的研究领域比如模块测试、系统管理任务和针对K8S对象的管理。
10. _[An Ansible reference guide, CI/CD with Ansible Tower and GitHub, and more news][11]_ 这是一篇每月进行总结更新的文章充满了有趣的链接。话题包括了Ansible的基础内容、管理Netapp的E系列存储产品、调试、打补丁包和其他一些相关内容。文章中还包括了一些视频以及指导性文章的链接。击这里查看详情
如果你也有一些你喜爱的Ansible文章那请留言告诉我们吧。
--------------------------------------------------------------------------------
via: https://opensource.com/article/19/12/ansible-resources
作者:[James Farrell][a]
选题:[lujun9972][b]
译者:[译者ID](https://github.com/BrunoJu)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://opensource.com/users/jamesf
[b]: https://github.com/lujun9972
[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/chaos_engineer_monster_scary_devops_gear_kubernetes.png?itok=GPYLvfVh (Gears above purple clouds)
[2]: https://opensource.com/article/19/2/quickstart-guide-ansible
[3]: https://opensource.com/article/19/9/must-know-ansible-modules
[4]: https://opensource.com/article/19/8/ops-tasks-ansible
[5]: https://opensource.com/article/19/4/ansible-procedures
[6]: https://opensource.com/article/19/9/ansible-documentation-kids-laptops
[7]: https://opensource.com/article/19/2/ansible-windows-admin
[8]: https://opensource.com/article/19/5/using-testinfra-ansible-verify-server-state
[9]: https://opensource.com/article/19/5/hardware-bootstrapping-ansible
[10]: https://opensource.com/article/19/3/developing-ansible-modules
[11]: https://opensource.com/article/19/7/ansible-news-edition-one

View File

@ -1,88 +0,0 @@
[#]: collector: (lujun9972)
[#]: translator: (nacyro)
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )
[#]: subject: (9 cheat sheets and guides to enhance your tech skills)
[#]: via: (https://opensource.com/article/20/1/cheat-sheets-guides)
[#]: author: (Lauren Pritchett https://opensource.com/users/lauren-pritchett)
九个提升你技术技能的备忘单和指南
======
用我们最新的编程备忘单和指南来为新年开局,它适合所有技能水平的人。来参加我们的投票,让我们知道你接下来想看什么!
![a checklist for a team][1]
对刚接触命令行的新程序员来说备忘单是完美的。然而,即便是最有经验的程序员也需要时不时地依靠参考资料。假如你刚好敲不出那个讨厌的快捷键,那么手边有个备忘单就很赞了。这是一份我们可供下载指南的综述,它将助你在 2020 年取得成功。
### 备忘单
#### [Markdown][2]
Markdown 不仅针对程序员,任何人都可以借助它为纯文本文档增添语法和结构。此备忘单提供了使用 CommonMark 规范的 Markdown 要点。它还包括 GitHub 和 GitLab 的语法。
#### [Linux 权限和用户][3]
用这个 Linux 备忘单把用户管理命令放在手边。快速学习如何增删用户、查看历史以及设置权限。
#### [Bash][4]
一旦您了解了 Bash在命令行中就蕴含了无限可能。我们的 Bash 备忘单可以帮助您更有效地使用键盘快捷键。不知不觉间,您就能易如反掌地运行脚本。
#### [Linux 常用命令][5]
毫不奇怪,我们的 Linux 常用命令备忘单是如此受欢迎。这个备忘单包含了开始安装软件和导览文件系统的要点。为自己和你的同事打印出来吧。
#### [微服务][6]
似乎每个人都在谈论微服务,而且理由很充分。微服务使应用程序模块化,因此更容易构建和维护。它不再只是这个备忘单上的流行语。在 [微服务开源指南][7] 中了解重要的术语并学习更多关于微服务的基础知识。
#### [Java][8]
此备忘单非常适合初级和中级 Java 程序员。它包括重要的上下文以及处理导入、变量、类等的代码。
#### [pip][9]
程序员爱用 pip 命令来帮助安装、管理和使用 Python 软件包。然而pip 可以做的远不止这些。这个备忘单将教你如何构建 wheels 和 record 包。
### 指南
#### [七个不可或缺的 PyPI 库][10]
这组 Python 教程将帮助您学习如何更快地编写扩展、格式化代码、自动化测试、确保代码一致性,以及更多使用 PyPI 库的方法。
#### [开始学习 Kubernetes][11]
在这份平易近人的指南中,作者 [Scott McCarty][12] 用了一个出人意料的类比来解释 Kubernetes 的价值和上手步骤。
* * *
我们想听听你的意见:你对新的备忘单或指南有什么高见?参加我们的投票,从选项中选择一个,或者在评论中告诉我们。点击 [这里][13] 查看我们所有的下载。通过 [注册][14] 我们的电子邮件通讯获得关于新备忘单的提醒。
--------------------------------------------------------------------------------
via: https://opensource.com/article/20/1/cheat-sheets-guides
作者:[Lauren Pritchett][a]
选题:[lujun9972][b]
译者:[nacyro](https://github.com/nacyro)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://opensource.com/users/lauren-pritchett
[b]: https://github.com/lujun9972
[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/checklist_hands_team_collaboration.png?itok=u82QepPk (a checklist for a team)
[2]: https://opensource.com/downloads/cheat-sheet-markdown
[3]: https://opensource.com/downloads/linux-permissions-cheat-sheet
[4]: https://opensource.com/downloads/bash-cheat-sheet
[5]: https://opensource.com/downloads/linux-common-commands-cheat-sheet
[6]: https://opensource.com/downloads/microservices-cheat-sheet
[7]: https://opensource.com/article/19/11/microservices-cheat-sheet
[8]: https://opensource.com/downloads/java-cheat-sheet
[9]: https://opensource.com/downloads/pip-cheat-sheet
[10]: https://opensource.com/downloads/7-essential-pypi-libraries
[11]: https://opensource.com/downloads/getting-started-kubernetes-ebook
[12]: https://opensource.com/users/fatherlinux
[13]: https://opensource.com/downloads/cheat-sheets
[14]: https://opensource.com/email-newsletter

View File

@ -0,0 +1,122 @@
[#]: collector: (lujun9972)
[#]: translator: (geekpi)
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )
[#]: subject: (Signal: A Secure, Open Source Messaging App)
[#]: via: (https://itsfoss.com/signal-messaging-app/)
[#]: author: (Ankush Das https://itsfoss.com/author/ankush/)
Signal安全、开源的聊天应用
======
** _简介Signal 是一款智能手机上的安全开源聊天应用。它还提供了适用于 Linux、Windows 和 macOS 的独立桌面应用。在本文中我们来看看它的功能和可用性。_**
### 对于关注隐私的人来说Signal 是 WhatsApp和 Telegram的绝佳替代品
![Signal App On Linux][1]
Signal 是一款关注隐私的开源应用。像[爱德华·斯诺登][2]这样的隐私权倡导者建议使用它。
它可能没有 Telegram 或 WhatsApp 这么多的功能。但是,如果你想在交流时增强隐私,这是一个可靠的开源方案。
你可以在智能手机iOS][3]/[Android][4])上安装,也可以在 Linux、Windows 和 macOS 上安装。
### Signal 的功能
**注意:** _某些功能是智能手机特有的。你可能无法在桌面应用上看到所有功能。_
正如我已经提到的,这是为增强你的隐私而量身定制的。因此,用户体验可能不是你见过“最佳”的。但是,从隐私/安全角度考虑,我认为这是一个不错的选择。
![Signal Features][5]
#### 消失的消息
你可以为对话中的消息设置一个计时器,以便根据它自动删除消息。
本质上,对话中的任何人都可以激活此功能。因此,你可以控制对话中的消息时保留还是消失。
#### 用作默认短信应用
如果你想在短信中使用开源应用,那么只需口进入 Signal 的设置,并将其设置为短信和彩信的默认设置。
#### 屏幕安全
有一个巧妙的功能可以阻止应用内截图,它就是“屏幕安全”。
如果你开启它,那么你将无法为应用中的任何对话截图。你可以从应用设置中找到启用或禁用它的选项。
它可能并不是对所有人有用,但你可以尝试一下。
#### 安全数字
如果你想与朋友一起验证加密的安全性,只需点击个人资料并向下滚动找到“查看安全数字”。
你可以扫描验证或者看一眼并标记为已验证。
#### 锁定消息
如果你使用了锁(密码/指纹)来保护应用,那么即使你的设备已解锁,你也无法在通知中看到消息。
因此,当 Signal 处于锁定状态收到通知时,你会注意到通知的内容为 “**Locked Message**”,这对于注重隐私的用户来说是一个加分项。
#### 其它功能
![][6]
如你所期待的聊天应用,你可以使用几个标签,并且可以根据需要创建一个组。
但是,你无法管理你的组,你只能添加成员和更改群头像。
此外Signal 还为其应用支持生物识别。
### 在 Ubuntu/Linux 上安装 Signal
不幸的是,你无法在你的 Linux 发行版上找到 .**deb** 或者 .**AppImage**。因此,你需要根据[官方安装说明][7]在终端上安装。
在终端中输入以下内容:
```
curl -s https://updates.signal.org/desktop/apt/keys.asc | sudo apt-key add -
echo "deb [arch=amd64] https://updates.signal.org/desktop/apt xenial main" | sudo tee -a /etc/apt/sources.list.d/signal-xenial.list
sudo apt update && sudo apt install signal-desktop
```
只需在终端中一个接一个地复制并粘贴命令。
[Download Signal for Other Devices][7]
### 我对 Signal 的想法
我已经使用 Signal 有几年了,它的功能已经得到了改善。但是,我仍然认为可以改善用户体验。
在隐私方面,(在我看来)这绝对是我们已有软件的一个很好的替代方案。你可以尝试一下,看看它的使用效果如何。
如果你想尝试一下它,也可以看看它的 [GitHub 页面][8]以获取最新的开发和 beta 版本。
与 WhatsApp 甚至 [Linux 上的 Telegram][9] 相比Signal 可能不是流行的聊天应用。但是,你可以自己尝试一下,并鼓励你的朋友使用它。
你尝试过了吗?在下面的评论中,让我知道你对 “Signal” 的看法。
--------------------------------------------------------------------------------
via: https://itsfoss.com/signal-messaging-app/
作者:[Ankush Das][a]
选题:[lujun9972][b]
译者:[geekpi](https://github.com/geekpi)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://itsfoss.com/author/ankush/
[b]: https://github.com/lujun9972
[1]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/12/signal-shot.jpg?ssl=1
[2]: https://en.wikipedia.org/wiki/Edward_Snowden
[3]: https://apps.apple.com/us/app/signal-private-messenger/id874139669
[4]: https://play.google.com/store/apps/details?id=org.thoughtcrime.securesms&hl=en_IN
[5]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/12/signal-phone.jpg?ssl=1
[6]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2019/12/signal-shot-1.jpg?ssl=1
[7]: https://signal.org/download/
[8]: https://github.com/signalapp
[9]: https://itsfoss.com/install-telegram-desktop-linux/

View File

@ -0,0 +1,104 @@
[#]: collector: (lujun9972)
[#]: translator: (geekpi)
[#]: reviewer: ( )
[#]: publisher: ( )
[#]: url: ( )
[#]: subject: (GNOME has a Secret Screen Recorder. Heres How to Use it!)
[#]: via: (https://itsfoss.com/gnome-screen-recorder/)
[#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/)
GNOME 有一个“秘密”的屏幕录像机。下面是使用方法!
======
[GNOME][1]是[最受欢迎的桌面环境][2]之一。它有现代的 UI并且带有许多特定于 GNOME 的应用,这些应用与桌面整体外观完美融合。
你可以根据自己的喜好来[调整 GNOME][3]但我不在这里讨论。GNOME 桌面有一些你可能不知道的隐藏功能。
这种不太明显的功能之一是内置的屏幕录像机。
是的,你没有看错。如果你使用的是 GNOME 桌面,那么不必安装其他的 [Linux 屏幕录像机][4]。你只需要知道正确的快捷键即可。
### 立即使用 GNOME 屏幕录像机录制屏幕
要快速打开 GNOME 屏幕录像机,你需要[在 Ubuntu 或其他带有 GNOME 桌面的发行版中按下此快捷键][5]
```
Ctrl + Alt + Shift + R
```
这将会立即开始录制你的桌面。你可以通过顶部的系统托盘区域的红点了解到正在录制:
![The red dot in the system tray area indicates that screen recording is in progress][6]
#### 增加录制时间
默认的最大录制时间仅为 30 秒。但是可以增加。
打开终端并使用以下命令:
```
gsettings set org.gnome.settings-daemon.plugins.media-keys max-screencast-length 300
```
在上面的命令中,我将录音的最大长度增加到 300 秒即5分钟。你可以将其更改为任何其他值但应以秒为单位。
如果你**不希望最长录音时间有任何限制请将其设置为0**,之后它会在你手动停止或者磁盘空间不足才会停止。
#### 停止屏幕录制
如前所述,你的桌面录制将在达到最大时间限制后自动停止。
要在此之前停止录制,你可以按下相同的组合键:
```
Ctrl + Alt + Shift + R
```
你的录制内容将以 [webm][7 ]格式保存在家目录的 “Videos” 文件夹中。
#### 局限性
尽管使用这个小工具可以方便地快速录制桌面,但是与功能强大的 [Simple Screen Recorder][8] 这样的屏幕录制工具相比,它有一些局限性。
* 录制开始之前没有时间延迟选项
  * 没有暂停和播放选项
  * 它录制整个屏幕。无法仅录制应用窗口、特定区域或特定屏幕(如果你有多个屏幕)。
  * 视频以 webm 格式保存在用户的 “Videos” 目录中。你无法更改。你必须使用 [HandBrake 之类的工具将视频转换为其他格式][9]。
如你所见,秘密的 GNOME 屏幕录像机与 [Kazam][10] 之类的工具或其他此类工具所提供的功能相差很远。
但是,它并不会尝试成为全功能的屏幕录像机。它只是为你提供录制屏幕的快速方法。
GNOME 是一个多功能的现代桌面环境。你可以大量地[调整 GNOME][3]。[GNOME 扩展][11]为桌面自定义提供了另一个维度。
该屏幕录像机是 GNOME 的隐藏功能之一,就像你自己很难轻易找到的挂起选项。
_你喜欢它吗你是否还想与我们分享其他隐藏的 GNOME 功能请在评论区留言。_
--------------------------------------------------------------------------------
via: https://itsfoss.com/gnome-screen-recorder/
作者:[Abhishek Prakash][a]
选题:[lujun9972][b]
译者:[geekpi](https://github.com/geekpi)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]: https://itsfoss.com/author/abhishek/
[b]: https://github.com/lujun9972
[1]: https://gnome.org/
[2]: https://itsfoss.com/best-linux-desktop-environments/
[3]: https://itsfoss.com/gnome-tweak-tool/
[4]: https://itsfoss.com/best-linux-screen-recorders/
[5]: https://itsfoss.com/ubuntu-shortcuts/
[6]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/01/gnome_screen_recording.jpg?ssl=1
[7]: https://www.webmproject.org/about/
[8]: https://itsfoss.com/record-screen-ubuntu-simplescreenrecorder/
[9]: https://itsfoss.com/handbrake/
[10]: https://itsfoss.com/kazam-screen-recorder/
[11]: https://itsfoss.com/best-gnome-extensions/