mirror of
https://github.com/LCTT/TranslateProject.git
synced 2024-12-26 21:30:55 +08:00
Merge remote-tracking branch 'LCTT/master'
This commit is contained in:
commit
f0af4473fd
@ -1,179 +1,116 @@
|
||||
如何使用 Ansible 打补丁以及安装应用
|
||||
======
|
||||
|
||||
> 使用 Ansible IT 自动化引擎节省更新的时间。
|
||||
|
||||
![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/tools_osyearbook2016_sysadmin_cc.png?itok=Y1AHCKI4)
|
||||
|
||||
你有没有想过,如何打补丁、重启系统,然后继续工作?
|
||||
|
||||
如果你的回答是肯定的,那就需要了解一下 [Ansible][1] 了。它是一个配置管理工具,对于一些复杂的系统管理任务有时候需要几个小时才能完成,又或者对安全性有比较高要求的时候,使用 Ansible 能够大大简化工作流程。
|
||||
如果你的回答是肯定的,那就需要了解一下 [Ansible][1] 了。它是一个配置管理工具,对于一些复杂的有时候需要几个小时才能完成的系统管理任务,又或者对安全性有比较高要求的时候,使用 Ansible 能够大大简化工作流程。
|
||||
|
||||
以我作为系统管理员的经验,打补丁是一项最有难度的工作。每次遇到公共漏洞和暴露(CVE, Common Vulnearbilities and Exposure)通知或者信息安全漏洞预警(IAVA, Information Assurance Vulnerability Alert)时都必须要高度关注安全漏洞,否则安全部门将会严肃追究自己的责任。
|
||||
以我作为系统管理员的经验,打补丁是一项最有难度的工作。每次遇到<ruby>公共漏洞批露<rt>Common Vulnearbilities and Exposure</rt></ruby>(CVE)通知或者<ruby>信息保障漏洞预警<rt>Information Assurance Vulnerability Alert</rt></ruby>(IAVA)时都必须要高度关注安全漏洞,否则安全部门将会严肃追究自己的责任。
|
||||
|
||||
使用 Ansible 可以通过运行[封装模块][2]以缩短打补丁的时间,下面以 [yum 模块][3]更新系统为例,使用 Ansible 可以执行安装、更新、删除、从其它地方安装(例如持续集成/持续开发中的 `rpmbuild`)。以下是系统更新的任务:
|
||||
|
||||
使用 Ansible 可以通过运行[封装模块][2]以缩短打补丁的时间,下面以[yum模块][3]更新系统为例,使用 Ansible 可以执行安装、更新、删除、从其它地方安装(例如持续集成/持续开发中的 `rpmbuild`)。以下是系统更新的任务:
|
||||
```
|
||||
- name: update the system
|
||||
|
||||
yum:
|
||||
|
||||
name: "*"
|
||||
|
||||
state: latest
|
||||
|
||||
```
|
||||
|
||||
在第一行,我们给这个任务命名,这样可以清楚 Ansible 的工作内容。第二行表示使用 `yum` 模块在CentOS虚拟机中执行更新操作。第三行 `name: "*"` 表示更新所有程序。最后一行 `state: latest` 表示更新到最新的 RPM。
|
||||
|
||||
系统更新结束之后,需要重新启动并重新连接:
|
||||
|
||||
```
|
||||
- name: restart system to reboot to newest kernel
|
||||
|
||||
shell: "sleep 5 && reboot"
|
||||
|
||||
async: 1
|
||||
|
||||
poll: 0
|
||||
|
||||
|
||||
|
||||
- name: wait for 10 seconds
|
||||
|
||||
pause:
|
||||
|
||||
seconds: 10
|
||||
|
||||
|
||||
|
||||
- name: wait for the system to reboot
|
||||
|
||||
wait_for_connection:
|
||||
|
||||
connect_timeout: 20
|
||||
|
||||
sleep: 5
|
||||
|
||||
delay: 5
|
||||
|
||||
timeout: 60
|
||||
|
||||
|
||||
|
||||
- name: install epel-release
|
||||
|
||||
yum:
|
||||
|
||||
name: epel-release
|
||||
|
||||
state: latest
|
||||
|
||||
```
|
||||
|
||||
`shell` 字段中的命令让系统在5秒休眠之后重新启动,我们使用 `sleep` 来保持连接不断开,使用 `async` 设定最大等待时长以避免发生超时,`poll` 设置为0表示直接执行不需要等待执行结果。等待10秒钟,使用 `wait_for_connection` 在虚拟机恢复连接后尽快连接。随后由 `install epel-release` 任务检查 RPM 的安装情况。你可以对这个剧本执行多次来验证它的幂等性,唯一会显示造成影响的是重启操作,因为我们使用了 `shell` 模块。如果不想造成实际的影响,可以在使用 `shell` 模块的时候 `changed_when: False`。
|
||||
`shell` 模块中的命令让系统在 5 秒休眠之后重新启动,我们使用 `sleep` 来保持连接不断开,使用 `async` 设定最大等待时长以避免发生超时,`poll` 设置为 0 表示直接执行不需要等待执行结果。暂停 10 秒钟以等待虚拟机恢复,使用 `wait_for_connection` 在虚拟机恢复连接后尽快连接。随后由 `install epel-release` 任务检查 RPM 的安装情况。你可以对这个剧本执行多次来验证它的幂等性,唯一会显示造成影响的是重启操作,因为我们使用了 `shell` 模块。如果不想造成实际的影响,可以在使用 `shell` 模块的时候 `changed_when: False`。
|
||||
|
||||
现在我们已经知道如何对系统进行更新、重启虚拟机、重新连接、安装 RPM 包。下面我们通过 [Ansible Lightbulb][4] 来安装 NGINX:
|
||||
|
||||
```
|
||||
- name: Ensure nginx packages are present
|
||||
|
||||
yum:
|
||||
|
||||
name: nginx, python-pip, python-devel, devel
|
||||
|
||||
state: present
|
||||
|
||||
notify: restart-nginx-service
|
||||
|
||||
|
||||
|
||||
- name: Ensure uwsgi package is present
|
||||
|
||||
pip:
|
||||
|
||||
name: uwsgi
|
||||
|
||||
state: present
|
||||
|
||||
notify: restart-nginx-service
|
||||
|
||||
|
||||
|
||||
- name: Ensure latest default.conf is present
|
||||
|
||||
template:
|
||||
|
||||
src: templates/nginx.conf.j2
|
||||
|
||||
dest: /etc/nginx/nginx.conf
|
||||
|
||||
backup: yes
|
||||
|
||||
notify: restart-nginx-service
|
||||
|
||||
|
||||
|
||||
- name: Ensure latest index.html is present
|
||||
|
||||
template:
|
||||
|
||||
src: templates/index.html.j2
|
||||
|
||||
dest: /usr/share/nginx/html/index.html
|
||||
|
||||
|
||||
|
||||
- name: Ensure nginx service is started and enabled
|
||||
|
||||
service:
|
||||
|
||||
name: nginx
|
||||
|
||||
state: started
|
||||
|
||||
enabled: yes
|
||||
|
||||
|
||||
|
||||
- name: Ensure proper response from localhost can be received
|
||||
|
||||
uri:
|
||||
|
||||
url: "http://localhost:80/"
|
||||
|
||||
return_content: yes
|
||||
|
||||
register: response
|
||||
|
||||
until: 'nginx_test_message in response.content'
|
||||
|
||||
retries: 10
|
||||
|
||||
delay: 1
|
||||
|
||||
```
|
||||
|
||||
And the handler that restarts the nginx service:
|
||||
以及用来重启 nginx 服务的操作文件:
|
||||
|
||||
```
|
||||
# 安装 nginx 的操作文件
|
||||
|
||||
- name: restart-nginx-service
|
||||
|
||||
service:
|
||||
|
||||
name: nginx
|
||||
|
||||
state: restarted
|
||||
|
||||
```
|
||||
|
||||
在这个角色里,我们使用 RPM 安装了 `nginx`、`python-pip`、`python-devel`、`devel`,用 PIP 安装了 `uwsgi`,接下来使用 `template` 模块复制 `nginx.conf` 和 `index.html` 以显示页面,并确保服务在系统启动时启动。然后就可以使用 `uri` 模块检查到页面的连接了。
|
||||
|
||||
这个是一个系统更新、系统重启、安装 RPM 包的剧本示例,后续可以继续安装 nginx,当然这里可以替换成任何你想要的角色和应用程序。
|
||||
|
||||
```
|
||||
- hosts: all
|
||||
|
||||
roles:
|
||||
|
||||
- centos-update
|
||||
|
||||
- nginx-simple
|
||||
|
||||
```
|
||||
|
||||
观看演示视频了解了解这个过程。
|
||||
@ -182,6 +119,10 @@ And the handler that restarts the nginx service:
|
||||
|
||||
这只是关于如何更新系统、重启以及后续工作的示例。简单起见,我只添加了不带[变量][5]的包,当你在操作大量主机的时候,你就需要修改其中的一些设置了:
|
||||
|
||||
- [async & poll](https://docs.ansible.com/ansible/latest/playbooks_async.html)
|
||||
- [serial](https://docs.ansible.com/ansible/latest/playbooks_delegation.html#rolling-update-batch-size)
|
||||
- [forks](https://docs.ansible.com/ansible/latest/intro_configuration.html#forks)
|
||||
|
||||
这是由于在生产环境中如果你想逐一更新每一台主机的系统,你需要花相当一段时间去等待主机重启才能够继续下去。
|
||||
|
||||
有关 Ansible 进行自动化工作的更多用法,请查阅[其它文章][6]。
|
||||
@ -192,7 +133,7 @@ via: https://opensource.com/article/18/3/ansible-patch-systems
|
||||
|
||||
作者:[Jonathan Lozada De La Matta][a]
|
||||
译者:[HankChow](https://github.com/HankChow)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
校对:[wxy](https://github.com/wxy)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
@ -1,36 +1,38 @@
|
||||
Jupyter Notebooks 入门
|
||||
=====
|
||||
|
||||
> 通过 Jupyter 使用实时代码、方程式和可视化及文本创建交互式的共享笔记本。
|
||||
|
||||
![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/email_paper_envelope_document.png?itok=uPj_kouJ)
|
||||
自从 papyrus 发布以来,出版社一直在努力以吸引读者的方式来格式化数据。在数学、科学、和编程领域,这是一个特别的问题,设计良好的图表、插图和方程式可以成为帮助人们理解技术信息的关键。
|
||||
|
||||
[Jupyter Notebook][1] 通过重新构想我们如何制作教学文本来解决这个问题。Jupyter (我在 2017 年 10 月在 [All Things Open][2] 上首次了解到)是一款开源应用程序,它使用户能够创建包含实时代码,方程式,可视化和文本的交互式共享笔记本。
|
||||
自从有了纸莎草纸以来,出版人们一直在努力以吸引读者的方式来格式化数据。尤其是在数学、科学、和编程领域,设计良好的图表、插图和方程式可以成为帮助人们理解技术信息的关键。
|
||||
|
||||
Jupyter 从 [IPython 项目][3]发展而来,该项目具有交互式 shell 和基于浏览器的笔记本,支持代码,文本和数学表达式。Jupyter 支持超过 40 种编程语言,包括 Python,R 和 Julia,其代码可以导出为 HTML,LaTeX,PDF,图像和视频,或者作为 [IPyhton][4] 笔记本与其他用户共享。
|
||||
[Jupyter Notebook][1] 通过重新构想我们如何制作教学文本来解决这个问题。Jupyter (我在 2017 年 10 月在 [All Things Open][2] 上首次了解到)是一款开源应用程序,它使用户能够创建包含实时代码、方程式、可视化和文本的交互式共享笔记本。
|
||||
|
||||
一个有趣的事实是:"Jupyter" 是 "Julia, Python, 和 R" 的缩写。
|
||||
Jupyter 从 [IPython 项目][3]发展而来,它是个具有交互式 shell 和基于浏览器的笔记本,支持代码、文本和数学表达式。Jupyter 支持超过 40 种编程语言,包括 Python、R 和 Julia,其代码可以导出为 HTML、LaTeX、PDF、图像和视频,或者作为 [IPyhton][4] 笔记本与其他用户共享。
|
||||
|
||||
根据 Jupyter 项目网站介绍,它的一些用途包括“数据清理和转换,数值模拟,统计建模,数据可视化,机器学习等等”。科学机构正在使用 Jupyter Notebooks 来解释研究结果。代码可以来自实际数据,可以调整和重新调整以可视化成不同的结果和情景。通过这种方式,Jupyter Notebooks 已成为生动的文本和报告。
|
||||
> 一个有趣的事实是:“Jupyter” 是 “Julia、Python 和 R” 的缩写。
|
||||
|
||||
根据 Jupyter 项目网站介绍,它的一些用途包括“数据清理和转换,数值模拟,统计建模,数据可视化,机器学习等等”。科学机构正在使用 Jupyter Notebooks 来解释研究结果。代码可以来自实际数据,可以调整和重新调整以可视化成不同的结果和情景。通过这种方式,Jupyter Notebooks 变成了生动的文本和报告。
|
||||
|
||||
### 安装并开始 Jupyter
|
||||
|
||||
Jupyter 软件是开源的,在[修改过的 BSD 许可证][5] 下获得许可,它可以[安装在 Linux,MacOS 或 Windows 上][6]。有很多种方法可以安装 Jupyter;我尝试在 Linux 和 MacOS 上安装 PIP 和 [Anaconda][7]。PIP 安装要求你的计算机上已经安装了 Python;Jupyter 推荐 Python 3。
|
||||
Jupyter 软件是开源的,其授权于[修改过的 BSD 许可证][5],它可以[安装在 Linux、MacOS 或 Windows 上][6]。有很多种方法可以安装 Jupyter;我在 Linux 和 MacOS 上试过 PIP 和 [Anaconda][7] 安装方式。PIP 安装要求你的计算机上已经安装了 Python;Jupyter 推荐 Python 3。
|
||||
|
||||
由于 Python 3 已经安装在我的电脑上,我通过在终端(在 Linux 或 Mac 上)运行以下命令来安装 Jupyter:
|
||||
|
||||
```
|
||||
$ python3 -m pip install --upgrade pip
|
||||
|
||||
$ python3 -m pip install jupyter
|
||||
|
||||
```
|
||||
|
||||
在终端提示种输入以下命令立即启动应用程序:
|
||||
在终端提示符输入以下命令立即启动应用程序:
|
||||
|
||||
```
|
||||
$ jupyter notebook
|
||||
|
||||
```
|
||||
|
||||
很快,我的浏览器打开并显示了我的 Jupyter Notebook 服务器在 `http://localhost:8888`。(支持的浏览器有 Google Chrome,Firefox 和 Safari)
|
||||
很快,我的浏览器打开并显示了我在 `http://localhost:8888` 的 Jupyter Notebook 服务器。(支持的浏览器有 Google Chrome、Firefox 和 Safari)
|
||||
|
||||
![](https://opensource.com/sites/default/files/styles/panopoly_image_original/public/u128651/jupyter_1.png?itok=UyM1GuVG)
|
||||
|
||||
@ -38,18 +40,19 @@ $ jupyter notebook
|
||||
|
||||
![](https://opensource.com/sites/default/files/styles/panopoly_image_original/public/u128651/jupyter_2.png?itok=alDI432q)
|
||||
|
||||
一个带有一些默认值的新笔记本,它可以被改变(包括笔记本的名字),打开它。
|
||||
一个带有一些默认值的新笔记本,它可以被改变(包括笔记本的名字),已打开。
|
||||
|
||||
![](https://opensource.com/sites/default/files/styles/panopoly_image_original/public/u128651/jupyter_3.png?itok=9zjG-5JC)
|
||||
笔记本有两种不同的模式:命令和编辑。命令模式允许你添加或删除单元格。你可以通过按下 Escape 键进入命令模式,按 Enter 键或单击单元格进入编辑模式。
|
||||
|
||||
单元格周围的绿色突出显示你处于编辑模式,蓝色突出显示你处于命令模式。以下笔记本处于命令模式并准备好执行单元中的 Python 代码。注意,我已将笔记本的名称更改为 First Notebook。
|
||||
笔记本有两种不同的模式:“命令模式”和“编辑模式”。命令模式允许你添加或删除单元格。你可以通过按下 `Escape` 键进入命令模式,按 `Enter` 键或单击单元格进入编辑模式。
|
||||
|
||||
单元格周围的绿色高亮显示你处于编辑模式,蓝色高亮显示你处于命令模式。以下笔记本处于命令模式并准备好执行单元中的 Python 代码。注意,我已将笔记本的名称更改为 “First Notebook”。
|
||||
|
||||
![](https://opensource.com/sites/default/files/styles/panopoly_image_original/public/u128651/jupyter_4.png?itok=-QPxcuFX)
|
||||
|
||||
### 使用 Jupyter
|
||||
|
||||
Jupyter Notebooks 的强大之处在于除了能够输入代码之外,你还可以将 Markdown 与叙述性和解释性文本相结合。我想添加一个标题,所以我在代码上面添加了一个单元格,并在 Markdown 中输入了一个标题。当我按下 `Ctrl+Enter` 时,我的标题转换为 HTML。(译注:或者可以按下 Run 按钮。)
|
||||
Jupyter Notebooks 的强大之处在于除了能够输入代码之外,你还可以用 Markdown 添加叙述性和解释性文本。我想添加一个标题,所以我在代码上面添加了一个单元格,并以 Markdown 输入了一个标题。当我按下 `Ctrl+Enter` 时,我的标题转换为 HTML。(LCTT 译注:或者可以按下 Run 按钮。)
|
||||
|
||||
![](https://opensource.com/sites/default/files/styles/panopoly_image_original/public/u128651/jupyter_5.png?itok=-sr9A8-W)
|
||||
|
||||
@ -57,24 +60,24 @@ Jupyter Notebooks 的强大之处在于除了能够输入代码之外,你还
|
||||
|
||||
![](https://opensource.com/sites/default/files/styles/panopoly_image_original/public/u128651/jupyter_6.png?itok=o_g38ECp)
|
||||
|
||||
我也可以利用 IPython 的 [line magic 和 cell magic][8] 命令。你可以通过在代码单元内附加 `%` 或 `%%` 符号来列出魔术命令。例如,`%lsmagic` 产生所有可用于 Jupyter notebooks 的魔法命令。
|
||||
我也可以利用 IPython 的 [line magic 和 cell magic][8] 命令。你可以通过在代码单元内附加 `%` 或 `%%` 符号来列出魔术命令。例如,`%lsmagic` 将输出所有可用于 Jupyter notebooks 的魔法命令。
|
||||
|
||||
![](https://opensource.com/sites/default/files/styles/panopoly_image_original/public/u128651/jupyter_7.png?itok=uit0PtND)
|
||||
|
||||
这些魔术命令的例子包括 `%pwd`,它输出当前工作目录(例如 `/Users/YourName`)和 `%ls`,它列出当前工作目录中的所有文件和子目录。另一个神奇命令显示从笔记本中的 `matplotlib` 生成的图表。`%%html` 将该单元格中的任何内容呈现为 HTML,这对嵌入视频和链接很有用,还有 JavaScript 和 Bash 的单元魔术命令。
|
||||
这些魔术命令的例子包括 `%pwd`——它输出当前工作目录(例如 `/Users/YourName`)和 `%ls`——它列出当前工作目录中的所有文件和子目录。另一个神奇命令显示从笔记本中的 `matplotlib` 生成的图表。`%%html` 将该单元格中的任何内容呈现为 HTML,这对嵌入视频和链接很有用,还有 JavaScript 和 Bash 的单元魔术命令。
|
||||
|
||||
如果你需要更多关于使用 Jupyter Notebooks 和它的特性的信息,帮助部分是非常完整的。
|
||||
如果你需要更多关于使用 Jupyter Notebooks 和它的特性的信息,它的帮助部分是非常完整的。
|
||||
|
||||
人们用许多有趣的方式使用 Jupyter Notebooks;你可以在这个 [gallery][9] 里找到一些很好的例子。你如何使用Jupyter笔记本?请在下面的评论中分享你的想法。
|
||||
人们用许多有趣的方式使用 Jupyter Notebooks;你可以在这个[展示栏目][9]里找到一些很好的例子。你如何使用 Jupyter 笔记本?请在下面的评论中分享你的想法。
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://opensource.com/article/18/3/getting-started-jupyter-notebooks
|
||||
|
||||
作者:[Don Watkins][a]
|
||||
译者:[MjSeven](https://github.com/MjSeven)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
选题:[lujun9972](https://github.com/lujun9972)
|
||||
译者:[MjSeven](https://github.com/MjSeven)
|
||||
校对:[wxy](https://github.com/wxy)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
@ -1,17 +1,17 @@
|
||||
有用的资源,献给那些想更多了解 Linux 的人
|
||||
=====
|
||||
|
||||
Linux 是最流行和多功能的操作系统之一,它可以用在智能手机,电脑甚至汽车上。自 20 世纪 90 年代以来,Linux 一直存在,并且仍然是最普遍的操作系统之一。
|
||||
Linux 是最流行和多功能的操作系统之一,它可以用在智能手机,电脑甚至汽车上。自 20 世纪 90 年代以来,Linux 存在至今,并且仍然是最普遍的操作系统之一。
|
||||
|
||||
Linux 实际上用于运行大多数网络服务,因为与其他操作系统相比,它被认为是相当稳定的。这是[人们选择 Linux 多于 Windows的原因][1]之一。此外,Linux 为用户提供了隐私,并且根本不收集用户信息,而 Windows 10 及其 Cortana 语音控制系统总是需要更新你的个人信息。
|
||||
Linux 实际上用于运行大多数网络服务,因为与其他操作系统相比,它被认为是相当稳定的。这是[人们选择 Linux 多于 Windows 的原因][1]之一。此外,Linux 为用户提供了隐私,根本不收集用户信息,而 Windows 10 及其 Cortana 语音控制系统总是需要更新你的个人信息。
|
||||
|
||||
Linux 有很多优点。然而,人们并没有听到太多关于它的消息,因为它已被 Windows 和 Mac 挤出市场。许多人开始使用 Linux 时会感到困惑,因为它与流行的操作系统有点不同。
|
||||
Linux 有很多优点。然而,人们并没有听到太多关于它的消息,因为它已被 Windows 和 Mac 挤出(桌面)场。许多人开始使用 Linux 时会感到困惑,因为它与流行的操作系统有点不同。
|
||||
|
||||
为了帮助你,我们为那些想要了解更多关于 Linux 的人收集了 5 个有用的资源。
|
||||
|
||||
### 1.[ Linux 纯新手 ][2]
|
||||
### 1、[Linux 纯新手][2]
|
||||
|
||||
如果你想尽可能多地学习 Linux,你应该考虑 Eduonix 为初学者提供的 Linux 完整教程。这个课程将向你介绍 Linux 的所有功能,并为你提供所有必要的资料,以帮助你了解更多关于 Linux 工作原理的特性。
|
||||
如果你想尽可能多地学习 Linux,你应该考虑 Eduonix 为[初学者提供的 Linux 完整教程][2]。这个课程将向你介绍 Linux 的所有功能,并为你提供所有必要的资料,以帮助你了解更多关于 Linux 工作原理的特性。
|
||||
|
||||
如果你是以下情况,你应该选择本课程:
|
||||
|
||||
@ -20,58 +20,48 @@ Linux 有很多优点。然而,人们并没有听到太多关于它的消息
|
||||
* 你想了解 Linux 如何与硬件配合使用;
|
||||
* 你想学习如何操作 Linux 命令行。
|
||||
|
||||
### 2.[PC World: Linux 初学者指南][3]
|
||||
### 2、[PC World: Linux 初学者指南][3]
|
||||
|
||||
为想要在一个地方学习所有有关 Linux 的人提供免费资源。PC World 专注于计算机操作系统的各个方面,并为订阅用户提供最准确和最新的信息。在这里,你还可以了解更多关于 [Linux 的好处][4] 和关于其操作系统的最新消息。
|
||||
为想要在一个地方学习所有有关 Linux 的人提供[免费资源][3]。PC World 专注于计算机操作系统的各个方面,并为订阅用户提供最准确和最新的信息。在这里,你还可以了解更多关于 [Linux 的好处][4] 和关于其操作系统的最新消息。
|
||||
|
||||
该资源为你提供以下信息:
|
||||
|
||||
* 如何安装 Linux;
|
||||
|
||||
* 如何使用命令行;
|
||||
|
||||
* 如何安装软件;
|
||||
|
||||
* 如何操作 Linux 桌面环境。
|
||||
|
||||
### 3.[Linux 培训][5]
|
||||
### 3、[Linux.com:Linux 培训][5]
|
||||
|
||||
很多使用计算机的人都需要学习如何操作 Linux,以防 Windows 操作系统突然崩溃。还有什么比使用官方资源来启动你的 Linux 培训更好呢?
|
||||
很多使用计算机的人都需要学习如何操作 Linux,以防 Windows 操作系统突然崩溃。还有什么比使用官方资源来启动你的 [Linux 培训][5]更好呢?
|
||||
|
||||
该资源提供了 Linux 训练的在线注册,你可以从官方来源获取最新信息。“一年前,我们的 IT 部门在官方网站上为我们提供了 Linux 培训” [Assignmenthelper.com.au][6] 的开发人员 Martin Gibson 说道。“我们选择了这门课,因为我们需要学习如何将我们的所有文件备份到另一个系统,为我们的客户提供最大的安全性,而且这个资源真的教会了我们所有的东西。”
|
||||
该资源可用让你在线注册 Linux 训练,你可以从官方来源获取最新信息。“一年前,我们的 IT 部门在官方网站上为我们提供了 Linux 培训” [Assignmenthelper.com.au][6] 的开发人员 Martin Gibson 说道。“我们选择了这门课,因为我们需要学习如何将我们的所有文件备份到另一个系统,为我们的客户提供最大的安全性,而且这个资源真的教会了我们所有的东西。”
|
||||
|
||||
所以你肯定应该使用这个资源,如果:
|
||||
|
||||
* 你想获得有关操作系统的第一手信息;
|
||||
|
||||
* 想要了解如何在你的计算机上运行 Linux 的特性;
|
||||
|
||||
* 想要与其他 Linux 用户联系并与他们分享你的经验。
|
||||
|
||||
### 4. [The Linux Foundation: 视频培训][7]
|
||||
### 4、 [Linux 基金会:视频培训][7]
|
||||
|
||||
如果你在阅读大量资源时容易感到无聊,那么该网站绝对适合你。Linux Foundation 提供由 IT 专家,软件开发技术人员和技术顾问举办的视频培训,讲座和在线研讨会。
|
||||
如果你在阅读大量资源时容易感到无聊,那么该网站绝对适合你。Linux 基金会提供了由 IT 专家、软件开发技术人员和技术顾问举办的视频培训,讲座和在线研讨会。
|
||||
|
||||
所有培训视频分为以下类别:
|
||||
|
||||
* 开发人员: 使用 Linux Kernel 来处理 Linux 设备驱动程序,Linux 虚拟化等;
|
||||
|
||||
* 开发人员: 使用 Linux 内核来处理 Linux 设备驱动程序、Linux 虚拟化等;
|
||||
* 系统管理员:在 Linux 上开发虚拟主机,构建防火墙,分析 Linux 性能等;
|
||||
* 用户:Linux 入门,介绍嵌入式 Linux 等。
|
||||
|
||||
* 用户:开始使用 Linux,介绍嵌入式 Linux 等。
|
||||
|
||||
### 5. [LinuxInsider][8]
|
||||
### 5、 [LinuxInsider][8]
|
||||
|
||||
你知道吗?微软对 Linux 的效率感到惊讶,它[允许用户在微软云计算设备上运行 Linux][9]。如果你想了解更多关于 Linux 操作系统的知识,Linux Insider 会向用户提供关于 Linux 操作系统的最新消息,以及最新更新和 Linux 特性的信息。
|
||||
|
||||
在此资源上,你将有机会:
|
||||
|
||||
* 参与 Linux 社区;
|
||||
|
||||
* 了解如何在各种设备上运行 Linux;
|
||||
|
||||
* 看看评论;
|
||||
|
||||
* 参与博客讨论并阅读科技博客。
|
||||
|
||||
### 总结一下
|
||||
@ -80,7 +70,7 @@ Linux 提供了很多好处,包括完全的隐私,稳定的操作甚至恶
|
||||
|
||||
### 关于作者
|
||||
|
||||
Lucy Benton 是一位数字营销专家,商业顾问,帮助人们将他们的梦想变为有利润的业务。现在她正在为营销和商业资源撰写。Lucy 还有自己的博客 [_Prowritingpartner.com_][10],在那里你可以查看她最近的发表。
|
||||
Lucy Benton 是一位数字营销专家,商业顾问,帮助人们将他们的梦想变为有利润的业务。现在她正在为营销和商业资源撰写。Lucy 还有自己的博客 [_Prowritingpartner.com_][10],在那里你可以查看她最近发表的文章。
|
||||
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
@ -88,9 +78,9 @@ Lucy Benton 是一位数字营销专家,商业顾问,帮助人们将他们
|
||||
via: https://linuxaria.com/article/useful-resources-for-those-who-want-to-know-more-about-linux
|
||||
|
||||
作者:[Lucy Benton][a]
|
||||
译者:[MjSeven](https://github.com/MjSeven)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
选题:[lujun9972](https://github.com/lujun9972)
|
||||
译者:[MjSeven](https://github.com/MjSeven)
|
||||
校对:[wxy](https://github.com/wxy)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
64
published/20180420 A Perl module for better debugging.md
Normal file
64
published/20180420 A Perl module for better debugging.md
Normal file
@ -0,0 +1,64 @@
|
||||
一个可以更好地调试的 Perl 模块
|
||||
======
|
||||
|
||||
> 这个简单优雅的模块可以让你包含调试或仅用于开发环境的代码,而在产品环境中隐藏它们。
|
||||
|
||||
![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/annoyingbugs.png?itok=ywFZ99Gs)
|
||||
|
||||
仅用于调试或开发调整时的 Perl 代码块有时会很有用。这很好,但是这样的代码块可能会对性能产生很大的影响, 尤其是在运行时才决定是否执行它。
|
||||
|
||||
[Curtis "Ovid" Poe][1] 最近编写了一个可以帮助解决这个问题的模块:[Keyword::DEVELOPMENT][2]。该模块利用 `Keyword::Simple` 和 Perl 5.012 中引入的可插入关键字架构来创建了新的关键字:`DEVELOPMENT`。它使用 `PERL_KEYWORD_DEVELOPMENT` 环境变量的值来确定是否要执行一段代码。
|
||||
|
||||
使用它不能更容易了:
|
||||
|
||||
```
|
||||
use Keyword::DEVELOPMENT;
|
||||
|
||||
sub doing_my_big_loop {
|
||||
my $self = shift;
|
||||
DEVELOPMENT {
|
||||
# insert expensive debugging code here!
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
在编译时,`DEVELOPMENT` 块内的代码已经被优化掉了,根本就不存在。
|
||||
|
||||
你看到好处了么?在沙盒中将 `PERL_KEYWORD_DEVELOPMENT` 环境变量设置为 `true`,在生产环境设为 `false`,并且可以将有价值的调试工具提交到你的代码库中,在你需要的时候随时可用。
|
||||
|
||||
在缺乏高级配置管理的系统中,你也可以使用此模块来处理生产和开发或测试环境之间的设置差异:
|
||||
|
||||
```
|
||||
sub connect_to_my_database {
|
||||
|
||||
my $dsn = "dbi:mysql:productiondb";
|
||||
my $user = "db_user";
|
||||
my $pass = "db_pass";
|
||||
|
||||
DEVELOPMENT {
|
||||
# Override some of that config information
|
||||
$dsn = "dbi:mysql:developmentdb";
|
||||
}
|
||||
|
||||
my $db_handle = DBI->connect($dsn, $user, $pass);
|
||||
}
|
||||
```
|
||||
|
||||
稍后对此代码片段的增强使你能在其他地方,比如 YAML 或 INI 中读取配置信息,但我希望您能在此看到该工具。
|
||||
|
||||
我查看了关键字 `Keyword::DEVELOPMENT` 的源码,花了大约半小时研究,“天哪,我为什么没有想到这个?”安装 `Keyword::Simple` 后,Curtis 给我们的模块就非常简单了。这是我长期以来在自己的编码实践中所需要的一个优雅解决方案。
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://opensource.com/article/18/4/perl-module-debugging-code
|
||||
|
||||
作者:[Ruth Holloway][a]
|
||||
选题:[lujun9972](https://github.com/lujun9972)
|
||||
译者:[geekpi](https://github.com/geekpi)
|
||||
校对:[wxy](https://github.com/wxy)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]:https://opensource.com/users/druthb
|
||||
[1]:https://metacpan.org/author/OVID
|
||||
[2]:https://metacpan.org/pod/release/OVID/Keyword-DEVELOPMENT-0.04/lib/Keyword/DEVELOPMENT.pm
|
@ -1,32 +1,34 @@
|
||||
使用交互式 shell 来增强你的 Python
|
||||
======
|
||||
|
||||
![](https://fedoramagazine.org/wp-content/uploads/2018/03/python-shells-816x345.jpg)
|
||||
|
||||
Python 编程语言已经成为 IT 中使用的最流行的语言之一。成功的一个原因是它可以用来解决各种问题。从网站开发到数据科学、机器学习到任务自动化,Python 生态系统有丰富的框架和库。本文将介绍 Fedora 软件包集合中提供的一些有用的 Python shell 来简化开发。
|
||||
|
||||
### Python Shell
|
||||
|
||||
Python Shell 让你以交互模式使用解释器。在测试代码或尝试新库时非常有用。在 Fedora 中,你可以通过在终端会话中输入 python3 来调用默认的 shell。虽然 Fedora 提供了一些更高级和增强的 shell。
|
||||
Python Shell 让你以交互模式使用解释器。这在测试代码或尝试新库时非常有用。在 Fedora 中,你可以通过在终端会话中输入 `python3` 来调用默认的 shell。虽然 Fedora 提供了一些更高级和增强的 shell。
|
||||
|
||||
### IPython
|
||||
|
||||
IPython 为 Python shell 提供了许多有用的增强功能。例子包括 tab 补全,对象内省,系统 shell 访问和命令历史检索。许多功能也被 [Jupyter Notebook][1] 使用,因为它底层使用 IPython。
|
||||
IPython 为 Python shell 提供了许多有用的增强功能。例如包括 tab 补全,对象内省,系统 shell 访问和命令历史检索。许多功能也被 [Jupyter Notebook][1] 使用,因为它底层使用 IPython。
|
||||
|
||||
#### 安装和运行 IPython
|
||||
|
||||
```
|
||||
dnf install ipython3
|
||||
ipython3
|
||||
|
||||
```
|
||||
|
||||
使用 tab 补全会提示你可能的选择。当你使用不熟悉的库时,此功能会派上用场。
|
||||
|
||||
![][2]
|
||||
|
||||
如果你需要更多信息,输入 ? 命令使用文档。有关更多详细信息,你可以使用 ?? 命令。
|
||||
如果你需要更多信息,输入 `?` 命令来查看文档。对此的更多详细信息,你可以使用 `??` 命令。
|
||||
|
||||
![][3]
|
||||
|
||||
另一个很酷的功能是使用 ! 字符执行系统 shell 命令的能力。然后可以在 IPython shell 中引用该命令的结果。
|
||||
另一个很酷的功能是使用 `!` 字符执行系统 shell 命令的能力。然后可以在 IPython shell 中引用该命令的结果。
|
||||
|
||||
![][4]
|
||||
|
||||
@ -34,23 +36,21 @@ IPython 完整的功能列表可在[官方文档][5]中找到。
|
||||
|
||||
### bpython
|
||||
|
||||
bpython 并不能像 IPython 做那么多,但它却在一个简单轻量级包中提供了一系列有用功能。除其他功能之外,bpython 提供:
|
||||
bpython 并不能像 IPython 做那么多,但它却在一个简单的轻量级包中提供了一系列有用功能。除其他功能之外,bpython 提供:
|
||||
|
||||
* 内嵌语法高亮显示
|
||||
* 在你输入时提供自动补全建议
|
||||
* 可预期的参数列表
|
||||
* 能够将代码发送或保存到 pastebin 服务或文件中
|
||||
|
||||
|
||||
|
||||
#### 安装和运行 bpython
|
||||
|
||||
```
|
||||
dnf install bpython3
|
||||
bpython3
|
||||
|
||||
```
|
||||
|
||||
在你输入的时候,bpython 为你提供了选择来自动补全你的代码。
|
||||
在你输入的时候,`bpython` 为你提供了选择来自动补全你的代码。
|
||||
|
||||
![][6]
|
||||
|
||||
@ -58,7 +58,7 @@ bpython3
|
||||
|
||||
![][7]
|
||||
|
||||
另一个很好的功能是可以使用功能键 F7 在外部编辑器(默认为 Vim)中打开当前的 bpython 会话。这在测试更复杂的程序时非常有用。
|
||||
另一个很好的功能是可以使用功能键 `F7` 在外部编辑器(默认为 Vim)中打开当前的 `bpython` 会话。这在测试更复杂的程序时非常有用。
|
||||
|
||||
有关配置和功能的更多细节,请参考 bpython [文档][8]。
|
||||
|
||||
@ -76,7 +76,7 @@ via: https://fedoramagazine.org/enhance-python-interactive-shell/
|
||||
作者:[Clément Verna][a]
|
||||
选题:[lujun9972](https://github.com/lujun9972)
|
||||
译者:[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/) 荣誉推出
|
||||
|
@ -7,97 +7,98 @@ Project Atomic 通过他们在 Open Container Initiative(OCI)上的努力创
|
||||
|
||||
Buildah 处理构建容器镜像时无需安装完整的容器运行时或守护进程。这对建立容器的持续集成和持续交付管道尤其有用。
|
||||
|
||||
Buildah 使容器的文件系统可以直接供构建主机使用。这意味着构建工具在主机上可用,并且在容器镜像中不需要,从而使构建更快速,镜像更小,更安全。Buildah 有 CentOS、Fedora 和 Debian 的软件包。
|
||||
Buildah 使容器的文件系统可以直接供构建主机使用。这意味着构建工具在主机上可用就行,而不需要在容器镜像中可用,从而使构建更快速,镜像更小,更安全。Buildah 有 CentOS、Fedora 和 Debian 的软件包。
|
||||
|
||||
### 安装 Buildah
|
||||
|
||||
从 Fedora 26 开始 Buildah 可以使用 dnf 进行安装。
|
||||
从 Fedora 26 开始 Buildah 可以使用 `dnf` 进行安装。
|
||||
|
||||
```
|
||||
$ sudo dnf install buildah -y
|
||||
|
||||
```
|
||||
|
||||
buildah 的当前版本为 0.16,可以通过以下命令显示。
|
||||
`buildah` 的当前版本为 0.16,可以通过以下命令显示。
|
||||
|
||||
```
|
||||
$ buildah --version
|
||||
|
||||
```
|
||||
|
||||
### 基本命令
|
||||
|
||||
构建容器镜像的第一步是获取基础镜像,这是通过 Dockerfile 中的 FROM 语句完成的。Buildah 以类似的方式处理这个。
|
||||
构建容器镜像的第一步是获取基础镜像,这是通过 Dockerfile 中的 `FROM` 语句完成的。Buildah 以类似的方式处理这个。
|
||||
|
||||
```
|
||||
$ sudo buildah from fedora
|
||||
|
||||
```
|
||||
|
||||
该命令将拉取 Fedora 的基础镜像并存储在主机上。通过执行以下操作可以检查主机上可用的镜像。
|
||||
|
||||
```
|
||||
$ sudo buildah images
|
||||
IMAGE ID IMAGE NAME CREATED AT SIZE
|
||||
9110ae7f579f docker.io/library/fedora:latest Mar 7, 2018 20:51 234.7 MB
|
||||
|
||||
```
|
||||
|
||||
在拉取基础镜像后,有一个该镜像的运行容器实例,这是一个“工作容器”。
|
||||
|
||||
以下命令显示正在运行的容器。
|
||||
|
||||
```
|
||||
$ sudo buildah containers
|
||||
CONTAINER ID BUILDER IMAGE ID IMAGE NAME
|
||||
CONTAINER NAME
|
||||
6112db586ab9 * 9110ae7f579f docker.io/library/fedora:latest fedora-working-container
|
||||
|
||||
```
|
||||
|
||||
Buildah 还提供了一个非常有用的命令来停止和删除当前正在运行的所有容器。
|
||||
|
||||
```
|
||||
$ sudo buildah rm --all
|
||||
|
||||
```
|
||||
|
||||
完整的命令列表可以使用 -help 选项。
|
||||
完整的命令列表可以使用 `--help` 选项。
|
||||
|
||||
```
|
||||
$ buildah --help
|
||||
|
||||
```
|
||||
|
||||
### 构建一个 Apache Web 服务器容器镜像
|
||||
|
||||
让我们看看如何使用 Buildah 在 Fedora 基础镜像上安装 Apache Web 服务器,然后复制一个可供服务的自定义 index.html。
|
||||
让我们看看如何使用 Buildah 在 Fedora 基础镜像上安装 Apache Web 服务器,然后复制一个可供服务的自定义 `index.html`。
|
||||
|
||||
首先让我们创建自定义的 `index.html`。
|
||||
|
||||
首先让我们创建自定义的 index.html。
|
||||
```
|
||||
$ echo "Hello Fedora Magazine !!!" > index.html
|
||||
|
||||
```
|
||||
|
||||
然后在正在运行的容器中安装 httpd 包。
|
||||
|
||||
```
|
||||
$ sudo buildah from fedora
|
||||
$ sudo buildah run fedora-working-container dnf install httpd -y
|
||||
|
||||
```
|
||||
|
||||
让我们将 index.html 复制到 /var/www/html/。
|
||||
让我们将 `index.html` 复制到 `/var/www/html/`。
|
||||
|
||||
```
|
||||
$ sudo buildah copy fedora-working-container index.html /var/www/html/index.html
|
||||
|
||||
```
|
||||
|
||||
然后配置容器入口点以启动 httpd。
|
||||
|
||||
```
|
||||
$ sudo buildah config --entrypoint "/usr/sbin/httpd -DFOREGROUND" fedora-working-container
|
||||
|
||||
```
|
||||
|
||||
现在为了使“工作容器”可用,commit 命令将容器保存到镜像。
|
||||
现在为了使“工作容器”可用,`commit` 命令将容器保存到镜像。
|
||||
|
||||
```
|
||||
$ sudo buildah commit fedora-working-container hello-fedora-magazine
|
||||
|
||||
```
|
||||
|
||||
hello-fedora-magazine 镜像现在可用,并且可以推送到仓库以供使用。
|
||||
|
||||
```
|
||||
$ sudo buildah images
|
||||
IMAGE ID IMAGE NAME CREATED
|
||||
@ -106,15 +107,13 @@ AT SIZE
|
||||
Mar 7, 2018 22:51 234.7 MB
|
||||
49bd5ec5be71 docker.io/library/hello-fedora-magazine:latest
|
||||
Apr 27, 2018 11:01 427.7 MB
|
||||
|
||||
```
|
||||
|
||||
通过运行以下步骤,还可以使用 Buildah 来测试此镜像。
|
||||
|
||||
```
|
||||
$ sudo buildah from --name=hello-magazine docker.io/library/hello-fedora-magazine
|
||||
|
||||
$ sudo buildah run hello-magazine
|
||||
|
||||
```
|
||||
|
||||
访问 <http://localhost> 将显示 “Hello Fedora Magazine !!!”
|
||||
@ -127,7 +126,7 @@ via: https://fedoramagazine.org/daemon-less-container-management-buildah/
|
||||
作者:[Ashutosh Sudhakar Bhakare][a]
|
||||
选题:[lujun9972](https://github.com/lujun9972)
|
||||
译者:[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/) 荣誉推出
|
||||
|
@ -2,72 +2,69 @@
|
||||
======
|
||||
|
||||
![](https://www.ostechnix.com/wp-content/uploads/2018/05/Preload-720x340.png)
|
||||
大多数 Linux 发行版在默认配置下已经足够快了。但是,我们仍然可以借助一些额外的应用程序和方法让它们启动更快一点。其中一个可用的这种应用程序就是 **Preload**。它监视用户使用频率比较高的应用程序,并将它们添加到内存中,这样就比一般的方式加载更快一点。因为,正如你所知道的,内存的读取速度远远快于硬盘。Preload 以守护进程的方式在后台中运行,并记录用户使用较为频繁的程序的文件使用相关的统计数据。然后,它将这些二进制文件及它们的依赖项加载进内存,以改善应用程序的加载时间。简而言之,一旦安装了 preload,你使用较为频繁的应用程序将可能加载的更快。
|
||||
|
||||
大多数 Linux 发行版在默认配置下已经足够快了。但是,我们仍然可以借助一些额外的应用程序和方法让它们启动更快一点。其中一个可用的这种应用程序就是 Preload。它监视用户使用频率比较高的应用程序,并将它们添加到内存中,这样就比一般的方式加载更快一点。因为,正如你所知道的,内存的读取速度远远快于硬盘。Preload 以守护进程的方式在后台中运行,并记录用户使用较为频繁的程序的文件使用相关的统计数据。然后,它将这些二进制文件及它们的依赖项加载进内存,以改善应用程序的加载时间。简而言之,一旦安装了 Preload,你使用较为频繁的应用程序将可能加载的更快。
|
||||
|
||||
在这篇详细的教程中,我们将去了解如何安装和使用 Preload,以改善应用程序在 Linux 中的启动时间。
|
||||
|
||||
### 在 Linux 中使用 Preload 改善应用程序启动时间
|
||||
|
||||
Preload 可以在 [**AUR**][1] 上找到。因此,你可以使用 AUR 助理程序在任何基于 Arch 的系统上去安装它,比如,Antergos、Manjaro Linux。
|
||||
Preload 可以在 [AUR][1] 上找到。因此,你可以使用 AUR 助理程序在任何基于 Arch 的系统上去安装它,比如,Antergos、Manjaro Linux。
|
||||
|
||||
使用 [Pacaur][2]:
|
||||
|
||||
使用 [**Pacaur**][2]:
|
||||
```
|
||||
$ pacaur -S preload
|
||||
|
||||
```
|
||||
|
||||
使用 [**Packer**][3]:
|
||||
使用 [Packer][3]:
|
||||
|
||||
```
|
||||
$ packer -S preload
|
||||
|
||||
```
|
||||
|
||||
使用 [**Trizen**][4]:
|
||||
使用 [Trizen][4]:
|
||||
|
||||
```
|
||||
$ trizen -S preload
|
||||
|
||||
```
|
||||
|
||||
使用 [**Yay**][5]:
|
||||
使用 [Yay][5]:
|
||||
|
||||
```
|
||||
$ yay -S preload
|
||||
|
||||
```
|
||||
|
||||
使用 [**Yaourt**][6]:
|
||||
使用 [Yaourt][6]:
|
||||
|
||||
```
|
||||
$ yaourt -S preload
|
||||
|
||||
```
|
||||
|
||||
在 Debian、Ubuntu、Linux Mint 上,Preload 可以在默认仓库中找到。因此,你可以像下面一样,使用 APT 包管理器去安装它。
|
||||
|
||||
```
|
||||
$ sudo apt-get install preload
|
||||
|
||||
```
|
||||
|
||||
Preload 安装完成后,重新启动你的系统。从现在开始,Preload 将监视频繁使用的应用程序,并将它们的二进制文件和库添加到内存中,以使它的启动速度更快。比如,如果你经常使用 Firefox、Chrome 以及 LibreOffice,Preload 将添加这些二进制文件和库到内存中,因此,这些应用程序将启动的更快。而且更好的是,它不需要做任何配置。它是开箱即用的。但是,如果你想去对它进行微调,你可以通过编辑缺省的配置文件 **/etc/preload.conf** 来实现。
|
||||
Preload 安装完成后,重新启动你的系统。从现在开始,Preload 将监视频繁使用的应用程序,并将它们的二进制文件和库添加到内存中,以使它的启动速度更快。比如,如果你经常使用 Firefox、Chrome 以及 LibreOffice,Preload 将添加这些二进制文件和库到内存中,因此,这些应用程序将启动的更快。而且更好的是,它不需要做任何配置。它是开箱即用的。但是,如果你想去对它进行微调,你可以通过编辑缺省的配置文件 `/etc/preload.conf` 来实现。
|
||||
|
||||
### Preload 并不一定适合每个人!
|
||||
|
||||
以下是 Preload 的一些缺点,它并不是对每个人都有帮助,在这个 [**跟贴**][7] 中有讨论到。
|
||||
以下是 Preload 的一些缺点,它并不是对每个人都有帮助,在这个 [跟贴][7] 中有讨论到。
|
||||
|
||||
1. 我使用的是一个有 8GB 内存的现代系统。因此,我的系统总体上来说很快。我每天只打开狂吃内存的应用程序(比如,Firefox、Chrome、VirtualBox、Gimp、等等)一到两次,并且它们始终处于打开状态,因此,它们的二进制文件和库被预读到内存中,并始终整天在内存中。我一般很少去关闭和打开这些应用程序,因此,内存使用纯属浪费。
|
||||
1. 我使用的是一个有 8GB 内存的现代系统。因此,我的系统总体上来说很快。我每天只打开狂吃内存的应用程序(比如,Firefox、Chrome、VirtualBox、Gimp 等等)一到两次,并且它们始终处于打开状态,因此,它们的二进制文件和库被预读到内存中,并始终整天在内存中。我一般很少去关闭和打开这些应用程序,因此,内存使用纯属浪费。
|
||||
2. 如果你使用的是带有 SSD 的现代系统,Preload 是绝对没用的。因为 SSD 的访问时间比起一般的硬盘来要快的多,因此,使用 Preload 是没有意义的。
|
||||
3. Preload 显著影响启动时间。因为大多数的应用程序都预读到内存中,长此以往,将让你的系统启动和运行的更快。
|
||||
|
||||
|
||||
3. Preload 显著影响启动时间。因为更多的应用程序要被预读到内存中,这将让你的系统启动运行时间更长。
|
||||
|
||||
你只有在每天都在大量的重新加载应用程序时,才能看到真正的差别。因此,Preload 最适合开发人员和测试人员,他们每天都打开和关闭应用程序好多次。
|
||||
|
||||
关于 Preload 更多的信息和它是如何工作的,请阅读它的作者写的完整版的 [**Preload 论文**][8]。
|
||||
关于 Preload 更多的信息和它是如何工作的,请阅读它的作者写的完整版的 [Preload 论文][8]。
|
||||
|
||||
教程到此为止,希望能帮到你。后面还有更精彩的内容,请继续关注!
|
||||
|
||||
再见!
|
||||
|
||||
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://www.ostechnix.com/how-to-improve-application-startup-time-in-linux/
|
||||
@ -75,7 +72,7 @@ via: https://www.ostechnix.com/how-to-improve-application-startup-time-in-linux/
|
||||
作者:[SK][a]
|
||||
选题:[lujun9972](https://github.com/lujun9972)
|
||||
译者:[qhwdw](https://github.com/qhwdw)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
校对:[wxy](https://github.com/wxy)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
@ -1,4 +1,4 @@
|
||||
7 leadership rules for the DevOps age
|
||||
Translating by FelixYFZ 7 leadership rules for the DevOps age
|
||||
======
|
||||
|
||||
![](https://enterprisersproject.com/sites/default/files/styles/620x350/public/images/CIO_DigitalAcumen_2.png?itok=TGeMQYs4)
|
||||
|
@ -1,107 +0,0 @@
|
||||
Translating by FelixYFZ Being open about data privacy
|
||||
======
|
||||
![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/GOV_opendata.png?itok=M8L2HGVx)
|
||||
|
||||
|
||||
Image by : opensource.com
|
||||
|
||||
Today is [Data Privacy Day][1], ("Data Protection Day" in Europe), and you might think that those of us in the open source world should think that all data should be free, [as information supposedly wants to be][2], but life's not that simple. That's for two main reasons:
|
||||
|
||||
1. Most of us (and not just in open source) believe there's at least some data about us that we might not feel happy sharing (I compiled an example list in [a post][3] I published a while ago).
|
||||
2. Many of us working in open source actually work for commercial companies or other organisations subject to legal requirements around what they can share.
|
||||
|
||||
|
||||
|
||||
So actually, data privacy is something that's important for pretty much everybody.
|
||||
|
||||
It turns out that the starting point for what data people and governments believe should be available for organisations to use is somewhat different between the U.S. and Europe, with the former generally providing more latitude for entities--particularly, the more cynical might suggest, large commercial entities--to use data they've collected about us as they will. Europe, on the other hand, has historically taken a more restrictive view, and on the 25th of May, Europe's view arguably will have triumphed.
|
||||
|
||||
### The impact of GDPR
|
||||
|
||||
That's a rather sweeping statement, but the fact remains that this is the date on which a piece of legislation called the General Data Protection Regulation (GDPR), enacted by the European Union in 2016, becomes enforceable. The GDPR basically provides a stringent set of rules about how personal data can be stored, what it can be used for, who can see it, and how long it can be kept. It also describes what personal data is--and it's a pretty broad set of items, from your name and home address to your medical records and on through to your computer's IP address.
|
||||
|
||||
What is important about the GDPR, though, is that it doesn't apply just to European companies, but to any organisation processing data about EU citizens. If you're an Argentinian, Japanese, U.S., or Russian company and you're collecting data about an EU citizen, you're subject to it.
|
||||
|
||||
"Pah!" you may say,1 "I'm not based in the EU: what can they do to me?" The answer is simple: If you want to continue doing any business in the EU, you'd better comply, because if you breach GDPR rules, you could be liable for up to four percent of your global revenues. Yes, that's global revenues: not just revenues in a particular country in Europe or across the EU, not just profits, but global revenues. Those are the sorts of numbers that should lead you to talk to your legal team, who will direct you to your exec team, who will almost immediately direct you to your IT group to make sure you're compliant in pretty short order.
|
||||
|
||||
This may seem like it's not particularly relevant to non-EU citizens, but it is. For most companies, it's going to be simpler and more efficient to implement the same protection measures for data associated with all customers, partners, and employees they deal with, rather than just targeting specific measures at EU citizens. This has got to be a good thing.2
|
||||
|
||||
However, just because GDPR will soon be applied to organisations across the globe doesn't mean that everything's fine and dandy3: it's not. We give away information about ourselves all the time--and permission for companies to use it.
|
||||
|
||||
There's a telling (though disputed) saying: "If you're not paying, you're the product." What this suggests is that if you're not paying for a service, then somebody else is paying to use your data. Do you pay to use Facebook? Twitter? Gmail? How do you think they make their money? Well, partly through advertising, and some might argue that's a service they provide to you, but actually that's them using your data to get money from the advertisers. You're not really a customer of advertising--it's only once you buy something from the advertiser that you become their customer, but until you do, the relationship is between the the owner of the advertising platform and the advertiser.
|
||||
|
||||
Some of these services allow you to pay to reduce or remove advertising (Spotify is a good example), but on the other hand, advertising may be enabled even for services that you think you do pay for (Amazon is apparently working to allow adverts via Alexa, for instance). Unless we want to start paying to use all of these "free" services, we need to be aware of what we're giving up, and making some choices about what we expose and what we don't.
|
||||
|
||||
### Who's the customer?
|
||||
|
||||
There's another issue around data that should be exercising us, and it's a direct consequence of the amounts of data that are being generated. There are many organisations out there--including "public" ones like universities, hospitals, or government departments4--who generate enormous quantities of data all the time, and who just don't have the capacity to store it. It would be a different matter if this data didn't have long-term value, but it does, as the tools for handling Big Data are developing, and organisations are realising they can be mining this now and in the future.
|
||||
|
||||
The problem they face, though, as the amount of data increases and their capacity to store it fails to keep up, is what to do with it. Luckily--and I use this word with a very heavy dose of irony,5 big corporations are stepping in to help them. "Give us your data," they say, "and we'll host it for free. We'll even let you use the data you collected when you want to!" Sounds like a great deal, yes? A fantastic example of big corporations6 taking a philanthropic stance and helping out public organisations that have collected all of that lovely data about us.
|
||||
|
||||
Sadly, philanthropy isn't the only reason. These hosting deals come with a price: in exchange for agreeing to host the data, these corporations get to sell access to it to third parties. And do you think the public organisations, or those whose data is collected, will get a say in who these third parties are or how they will use it? I'll leave this as an exercise for the reader.7
|
||||
|
||||
### Open and positive
|
||||
|
||||
It's not all bad news, however. There's a growing "open data" movement among governments to encourage departments to make much of their data available to the public and other bodies for free. In some cases, this is being specifically legislated. Many voluntary organisations--particularly those receiving public funding--are starting to do the same. There are glimmerings of interest even from commercial organisations. What's more, there are techniques becoming available, such as those around differential privacy and multi-party computation, that are beginning to allow us to mine data across data sets without revealing too much about individuals--a computing problem that has historically been much less tractable than you might otherwise expect.
|
||||
|
||||
What does this all mean to us? Well, I've written before on Opensource.com about the [commonwealth of open source][4], and I'm increasingly convinced that we need to look beyond just software to other areas: hardware, organisations, and, relevant to this discussion, data. Let's imagine that you're a company (A) that provides a service to another company, a customer (B).8 There are four different types of data in play:
|
||||
|
||||
1. Data that's fully open: visible to A, B, and the rest of the world
|
||||
2. Data that's known, shared, and confidential: visible to A and B, but nobody else
|
||||
3. Data that's company-confidential: visible to A, but not B
|
||||
4. Data that's customer-confidential: visible to B, but not A
|
||||
|
||||
|
||||
|
||||
First of all, maybe we should be a bit more open about data and default to putting it into bucket 1. That data--on self-driving cars, voice recognition, mineral deposits, demographic statistics--could be enormously useful if it were available to everyone.9 Also, wouldn't it be great if we could find ways to make the data in buckets 2, 3, and 4--or at least some of it--available in bucket 1, whilst still keeping the details confidential? That's the hope for some of these new techniques being researched. They're a way off, though, so don't get too excited, and in the meantime, start thinking about making more of your data open by default.
|
||||
|
||||
### Some concrete steps
|
||||
|
||||
So, what can we do around data privacy and being open? Here are a few concrete steps that occurred to me: please use the comments to contribute more.
|
||||
|
||||
* Check to see whether your organisation is taking GDPR seriously. If it isn't, push for it.
|
||||
* Default to encrypting sensitive data (or hashing where appropriate), and deleting when it's no longer required--there's really no excuse for data to be in the clear to these days except for when it's actually being processed.
|
||||
* Consider what information you disclose when you sign up to services, particularly social media.
|
||||
* Discuss this with your non-technical friends.
|
||||
* Educate your children, your friends' children, and their friends. Better yet, go and talk to their teachers about it and present something in their schools.
|
||||
* Encourage the organisations you work for, volunteer for, or interact with to make data open by default. Rather than thinking, "why should I make this public?" start with "why shouldn't I make this public?"
|
||||
* Try accessing some of the open data sources out there. Mine it, create apps that use it, perform statistical analyses, draw pretty graphs,10 make interesting music, but consider doing something with it. Tell the organisations that sourced it, thank them, and encourage them to do more.
|
||||
|
||||
|
||||
|
||||
1. Though you probably won't, I admit.
|
||||
|
||||
2. Assuming that you believe that your personal data should be protected.
|
||||
|
||||
3. If you're wondering what "dandy" means, you're not alone at this point.
|
||||
|
||||
4. Exactly how public these institutions seem to you will probably depend on where you live: [YMMV][5].
|
||||
|
||||
5. And given that I'm British, that's a really very, very heavy dose.
|
||||
|
||||
6. And they're likely to be big corporations: nobody else can afford all of that storage and the infrastructure to keep it available.
|
||||
|
||||
7. No. The answer's "no."
|
||||
|
||||
8. Although the example works for people, too. Oh, look: A could be Alice, B could be Bob…
|
||||
|
||||
9. Not that we should be exposing personal data or data that actually needs to be confidential, of course--not that type of data.
|
||||
|
||||
10. A friend of mine decided that it always seemed to rain when she picked her children up from school, so to avoid confirmation bias, she accessed rainfall information across the school year and created graphs that she shared on social media.
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://opensource.com/article/18/1/being-open-about-data-privacy
|
||||
|
||||
作者:[Mike Bursell][a]
|
||||
译者:[译者ID](https://github.com/译者ID)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]:https://opensource.com/users/mikecamel
|
||||
[1]:https://en.wikipedia.org/wiki/Data_Privacy_Day
|
||||
[2]:https://en.wikipedia.org/wiki/Information_wants_to_be_free
|
||||
[3]:https://aliceevebob.wordpress.com/2017/06/06/helping-our-governments-differently/
|
||||
[4]:https://opensource.com/article/17/11/commonwealth-open-source
|
||||
[5]:http://www.outpost9.com/reference/jargon/jargon_40.html#TAG2036
|
137
sources/talk/20180514 A year as Android Engineer.md
Normal file
137
sources/talk/20180514 A year as Android Engineer.md
Normal file
@ -0,0 +1,137 @@
|
||||
A year as Android Engineer
|
||||
============================================================
|
||||
|
||||
![](https://cdn-images-1.medium.com/max/2000/1*tqshw1o4JZZlA1HW3Cki1Q.png)
|
||||
>Awesome drawing by [Miquel Beltran][0]
|
||||
|
||||
Two years ago I started my career in tech. I started as QA Tester and then transitioned into a developer role a year after. Not without a lot of effort and a lot of personal time invested.
|
||||
|
||||
You can find that part of the story in this post about [how I switch careers from Biology to tech][1] and how I [learned Android for a year][2]. Today I want to talk about how I started my first role as Android developer, how I switched companies and how my first year as Android Engineer has been overall.
|
||||
|
||||
### My first role
|
||||
|
||||
My first role as Android developer started out just a year ago. The company I was working at provided me with the opportunity to transition from QA to Android developer by dedicating half of the time to each role.
|
||||
|
||||
This transition was thanks to the time I invested learning Android on evenings and weekends. I went through the [Android Basics Nanodegree][3], the [Android Developer Nanodegree][4] and as well I got the [Google Developers Certification][5]. [That part of the story is explained in more detail here.][6]
|
||||
|
||||
After two months I switched to full time when they hired another QA. Here's were all the challenges began!
|
||||
|
||||
Transitioning someone into a developer role is a lot harder than just providing them with a laptop and a git account. And here I explain some of the roadblocks I got during that time:
|
||||
|
||||
#### Lack of expectations
|
||||
|
||||
The first problem I faced was not knowing the expectations that the company had on me. My thought was that they expected me to deliver since the very first day, probably not like my experienced colleagues, but deliver by doing small tasks. This feeling caused me a lot of pressure. By not having clear goals, I was constantly thinking I wasn't good enough and that I was an impostor.
|
||||
|
||||
#### Lack of mentorship
|
||||
|
||||
There was no concept of mentorship in the company and the environment didn’t allow us to work together. We barely did pair-programming, because there was always a deadline and the company wanted us to keep delivering. Luckily my colleagues were always willing to help! They sat with me to help me whenever I got stuck or asked for help.
|
||||
|
||||
#### Lack of feedback
|
||||
|
||||
I never got any feedback during that time. What was I doing well or bad? What could I improve? I didn't know since I didn’t have anyone whom to report.
|
||||
|
||||
#### Lack of learning culture
|
||||
|
||||
I think that in order to keep up to date we need to continue learning by reading blog posts, watching talks, attending conferences, trying new things, etc. The company didn’t offer learning hours during working time, which is unfortunately quite common as other devs told me. Without having learning time, I felt I wasn't entitled to spend even 10 minutes to read a blog post I found to be interesting and relevant for my job.
|
||||
|
||||
The problem was not only the lack of an explicit learning time allowance, but also that when I requested it, it got denied.
|
||||
|
||||
An example of that occurred when I finished my tasks for the sprint and we were already at the end of it, so I asked if I could spend the rest of the day learning Kotlin. This request got denied.
|
||||
|
||||
Another case was when I requested to attend an Android conference, and then I was asked to take days from my paid time off.
|
||||
|
||||
#### Impostor syndrome
|
||||
|
||||
The lack of expectations, the lack of feedback, and the lack of learning culture in the company made the first 9 months of my developer career even more challenging. I have the feeling that it contributed to increase my internal impostors syndrome.
|
||||
|
||||
One example of it was opening and reviewing pull requests. Sometimes I'd ask a colleague to check my code privately, rather than opening a pull request, to avoid showing my code to everyone.
|
||||
|
||||
Other times, when I was reviewing, I would spend minutes staring the "approve" button, worried of approving something that another colleague would have considered wrong.
|
||||
|
||||
And when I didn't agree on something, I was never speaking loud enough worried of a backslash due to my lack of knowledge.
|
||||
|
||||
> Sometimes I’d ask a colleague to check my code privately […] to avoid showing my code to everyone.
|
||||
|
||||
* * *
|
||||
|
||||
### New company, new challenges
|
||||
|
||||
Later on I got a new opportunity in my hands. I was invited to the hiring process for a Junior Android Engineer position at [Babbel][7] thanks to a friend who worked with me in the past.
|
||||
|
||||
I met the team while volunteering in a local meet-up that was hosted at their offices. That helped me a lot when deciding to apply. I loved the company's motto: learning for all. Also everyone was very friendly and looked happy working there! But I didn't apply straight away, because why would I apply if I though that I wasn't good enough?
|
||||
|
||||
Luckily my friend and my partner pushed me to do it. They gave me the strength I needed to send my CV. Shortly after I got into the interview process. It was fairly simple: I had to do a coding challenge in the form of a small app, and then later a technical interview with the team and team fit interview with the hiring manager.
|
||||
|
||||
#### Hiring process
|
||||
|
||||
I spent the weekend with the coding challenge and sent it right after on Monday. Soon after I got invited for an on-site interview.
|
||||
|
||||
The technical interview was about the coding challenge itself, we talked about good and bad things on Android, why did I implemented things in a way, how could it be improved, etc. It followed a short team fit interview with the hiring manager, where we talked about challenges I faced, how I solved this problems, and so on.
|
||||
|
||||
They offered me the job and I accepted the offer!
|
||||
|
||||
On my first year working as Android developer, I spent 9 months in a company and the next 3 with my current employer.
|
||||
|
||||
#### Learning environment
|
||||
|
||||
One big change for me is having 1:1 meetings with my Engineering Manager every two weeks. That way, it's clear for me what are our expectations.
|
||||
|
||||
We are getting constant feedback and ideas on what to improve and how to help and be helped. Beside the internal trainings they offer, I also have a weekly learning time allowance to learn anything I want. So far, I've been using it to improve my Kotlin and RxJava knowledge.
|
||||
|
||||
We also do pair-programming almost daily. There's always paper and pens nearby my desk to sketch ideas. And I keep a second chair by my side so my colleagues can sit with me :-)
|
||||
|
||||
However, I still struggle with the impostor syndrome.
|
||||
|
||||
#### Still the Impostor syndrome
|
||||
|
||||
I still struggle with it. For example, when doing pair-programming, if we reach a topic I don't quite understand, even when my colleagues have the patience to explain it to me many times, there are times I just can't get it.
|
||||
|
||||
After the second or third time I start feeling a big pressure on my chest. How come I don't get it? Why is it so difficult for me to understand? This situation creates me anxiety.
|
||||
|
||||
I realized I need to accept that I might not understand a given topic but that getting the idea is the first step! Sometimes we just require more time and practice so it finally "compiles in our brains" :-)
|
||||
|
||||
For example, I used to struggle with Java interfaces vs. abstract classes, I just couldn't understand them completely, no matter how many examples I saw. But then I started using them, and even if I could not explain how they worked, I knew how and when to use them.
|
||||
|
||||
#### Confidence
|
||||
|
||||
The learning environment in my current company helps me in building confidence. Even if I've been asking a lot of questions, there's always room for more!
|
||||
|
||||
Having less experience doesn't mean your opinions will be less valued. For example if a proposed solution seems too complex, I will challenge them to write it in a clearer way. Also, I provide a different set of experience and points of view, which has been helpful so far for polishing the app user experience.
|
||||
|
||||
### To improve
|
||||
|
||||
The engineer role isn't just coding, but rather a broad range of skills. I am still at the beginning of the journey, and on my way of mastering it, I want to focus on the following ideas:
|
||||
|
||||
* Communication: as English isn't my first language, sometimes I struggle to transmit an idea, which is essential for my job. I can work on that by writing, reading and talking more.
|
||||
|
||||
* Give constructive feedback: I want to give meaningful feedback to my colleagues so they can grow with me as well.
|
||||
|
||||
* Be proud of my achievements: I need to create a list to track all kind of achievements, small or big, and my overall progress, so I can look back and feel good when I struggle.
|
||||
|
||||
* Not being obsessed on what I don't know: hard to do when there's so many new things coming up, so keeping focused on the essentials, and what's required for my project in hand, is important.
|
||||
|
||||
* Share more knowledge with my colleagues! That I'm a junior doesn't mean I don't have anything to share! I need to keep sharing articles and talks I find interesting. I know my colleagues appreciate that.
|
||||
|
||||
* Be patient and constantly learn: keep learning as I am doing, but being more patient with myself.
|
||||
|
||||
* Self-care: take breaks whenever needed and don't be hard with myself. Relaxing is also productive.
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://proandroiddev.com/a-year-as-android-engineer-55e2a428dfc8
|
||||
|
||||
作者:[Lara Martín][a]
|
||||
译者:[译者ID](https://github.com/译者ID)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]:https://proandroiddev.com/@laramartin
|
||||
[0]:https://medium.com/@Miqubel
|
||||
[1]:https://medium.com/@laramartin/how-i-took-my-first-step-in-it-6e9233c4684d
|
||||
[2]:https://medium.com/udacity/a-year-of-android-ffba9f3e40b6
|
||||
[3]:https://de.udacity.com/course/android-basics-nanodegree-by-google--nd803
|
||||
[4]:https://de.udacity.com/course/android-developer-nanodegree-by-google--nd801
|
||||
[5]:https://developers.google.com/training/certification/
|
||||
[6]:https://medium.com/udacity/a-year-of-android-ffba9f3e40b6
|
||||
[7]:http://babbel.com/
|
@ -1,57 +0,0 @@
|
||||
lontow translating
|
||||
|
||||
5 ways open source can strengthen your job search
|
||||
======
|
||||
![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/resume_career_document_general.png?itok=JEaFL2XI)
|
||||
|
||||
Are you searching for a job in the bustling tech industry? Whether you're a seasoned member of the tech community looking for a new challenge or a recent graduate looking for your first job, contributing to open source projects can be a great way to boost your attractiveness as a candidate. Below are five ways your work on open source projects may strengthen your job hunt.
|
||||
|
||||
### 1. Get project experience
|
||||
|
||||
Perhaps the clearest way working on open source projects can assist in your job search is by giving you project experience. If you are a student, you may not have many concrete projects to showcase on your resume. If you are working, perhaps you can't discuss your current projects due to privacy limitations, or maybe you're not working on tasks that interest you. Either way, scouting out appealing open source projects that allow you to showcase your skills may help in your job search. These projects are great eye-catchers on resumes and can be perfect discussion topics in interviews.
|
||||
|
||||
In addition, many open source projects are kept in public repositories, such as [GitHub][1], so accessing the source code is easy for anyone who wants to become involved. Also, it makes your publicly accessible code contributions easy for recruiters and other individuals at potential employers to find. The fact that these projects are open allows you to demonstrate your skills in a more concrete manner than simply discussing them in an interview.
|
||||
|
||||
### 2. Learn to ask good questions
|
||||
|
||||
Any new member of an open source project community has the opportunity to learn a lot. They must discover avenues of communication; structure and hierarchy; documentation format; and many other aspects unique to the project. To begin participating in and contributing to a project, you need to ask many questions to put yourself in a position for success. As the familiar saying goes, there are no stupid questions. Open source project communities promote inquisivity, especially when answers aren't easy to find.
|
||||
|
||||
The unfamiliarity when beginning to work on open source projects teaches individuals to ask questions, and to ask them often. This helps participants develop great skills in identifying what questions to ask, how to ask them, and who to approach. This skill is useful in job searching, [interviewing][2], and living life in general. Problem-solving skills and reaching out for help when you need it are highly valued in the job market.
|
||||
|
||||
### 3. Access new technologies and continuous learning
|
||||
|
||||
Most software projects use many different technologies. It is rare for every contributor to be familiar with every piece of technology in a project. Even after working on a project for a while, individuals likely won't be familiar with all the technologies it uses.
|
||||
|
||||
While veterans of an open source project may be unfamiliar with certain pieces of the project, newbies will be extremely unfamiliar with many or most. This creates a huge learning opportunity. A person may begin working on an open source project to improve one piece of functionality, most likely in a technical area they are familiar with. But the path from there can take a much different turn.
|
||||
|
||||
Working on one aspect of a project might lead you down an unfamiliar road and prompt new learning. Working on an open source project may expose you to new technologies you would never use otherwise. It can also reveal new passions, or at minimum, facilitate continuous learning--which [employers find highly desirable][3].
|
||||
|
||||
### 4. Increase your connections and network
|
||||
|
||||
Open source projects are maintained and surrounded by diverse communities. Some individuals working on open source projects do so in their free time, and they all have their own backstories, interests, and connections. As they say, "it's all about who you know." You may never meet certain people except through working an open source project. Maybe you'll work with people around the world, or maybe you'll connect with your next-door neighbor. Regardless, you never know who may help connect you to your next job. The connections and networking possibilities exposed through an open source project may be extremely helpful in finding your next (or first!) job.
|
||||
|
||||
### 5. Build confidence
|
||||
|
||||
Finally, contributing to open source projects may give you a newfound confidence. Many new employees in the tech industry may feel a sense of [imposter syndrome][4], because without having accomplished significant work, they may feel they don't belong, they are frauds, or they don't deserve to be in their new position. Working on open source projects before you are hired may minimize this issue.
|
||||
|
||||
Work on open source projects is often done individually, but it all contributes to the project as a whole. Open source communities are highly inclusive and cooperative, and your contributions will be noticed. It is always rewarding to be validated by other community members (especially more senior members). The recognition you may gain from code commits to an open source project could improve your confidence and counter imposter syndrome. This confidence can then carry over to interviews, new positions, and beyond.
|
||||
|
||||
These are only a handful of the benefits you may see from working on open source projects. If you know of other advantages, please share them in the comments below.
|
||||
### About The Author
|
||||
Sophie Polson;Sophie Is A Senior At Duke University Studying Computer Science. She Has Just Started To Venture Into The Open Source Community Via The Course;Open Source World;Taught At Duke In The Fall Of;Has Developed An Interest In Exploring Devops. She Will Be Working As A Software Engineer Following Her Graduation In The Spring Of
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://opensource.com/article/18/1/5-ways-turn-open-source-new-job
|
||||
|
||||
作者:[Sophie Polson][a]
|
||||
译者:[译者ID](https://github.com/译者ID)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]:https://opensource.com/users/sophiepolson
|
||||
[1]:https://github.com/dbaldwin/DronePan
|
||||
[2]:https://www.thebalance.com/why-you-should-ask-questions-in-a-job-interview-1669548
|
||||
[3]:https://www.computerworld.com/article/3177442/it-careers/lifelong-learning-is-no-longer-optional.html
|
||||
[4]:https://en.wikipedia.org/wiki/Impostor_syndrome
|
@ -1,281 +0,0 @@
|
||||
How To Archive Files And Directories In Linux
|
||||
======
|
||||
|
||||
![](https://www.ostechnix.com/wp-content/uploads/2018/03/Archive-Files-And-Directories-In-Linux-720x340.png)
|
||||
In our previous tutorial, we discussed how to [**compress and decompress files using gzip and bzip2**][1] programs. In this tutorial, we are going to learn how to archive files in Linux. Aren’t archiving and compressing same? Some of you might often think these terms refers the same meaning. But, both are completely different. Archiving is the process of the combining multiple files and directories (same or different size) into one file. On the other hand, compressing is the process of reducing the size of of a file(s) or directory(s). Archiving is often used as part of the system backups or when moving the data from one system to another. Hope you understand the difference between archiving and compressing. Now, let us get into the topic.
|
||||
|
||||
### Archive files and directories
|
||||
|
||||
The most common programs to archive files and directories are;
|
||||
|
||||
1. tar
|
||||
2. zip
|
||||
|
||||
|
||||
|
||||
This is a big topic. So, I am going to publish this article in two parts. In the first part, we will see how to archive files and directories using Tar command.
|
||||
|
||||
##### Archive files and directories using Tar command
|
||||
|
||||
**Tar** is an Unix command which stands for **T** ape **A** rchive. It is used to combine or store multiple files (same or different size) into a single file. There are 4 main operating modes in tar utility.
|
||||
|
||||
1. **c** – Create an archive from a file(s) or directory(s).
|
||||
2. **x** – Extract an archive.
|
||||
3. **r** – Append files to the end of an archive.
|
||||
4. **t** – List the contents of the archive.
|
||||
|
||||
|
||||
|
||||
For complete list of modes, refer the man pages.
|
||||
|
||||
**Create a new archive**
|
||||
|
||||
For the purpose of this guide, I will be using a folder named **ostechnix** that contains three different type of files.
|
||||
```
|
||||
$ ls ostechnix/
|
||||
file.odt image.png song.mp3
|
||||
|
||||
```
|
||||
|
||||
Now, let us create a new tar archive of the the directory ostechnix.
|
||||
```
|
||||
$ tar cf ostechnix.tar ostechnix/
|
||||
|
||||
```
|
||||
|
||||
Here, **c** flag refers create new archive and **f** refers the file name.
|
||||
|
||||
Similarly, to create an archive from a set of files in the current working directory, use this command:
|
||||
```
|
||||
$ tar cf archive.tar file1 file2 file 3
|
||||
|
||||
```
|
||||
|
||||
**Extract archives**
|
||||
|
||||
To extract an archive in the current directory, simply do:
|
||||
```
|
||||
$ tar xf ostechnix.tar
|
||||
|
||||
```
|
||||
|
||||
We can also extract the archive in a different directory using **C** flag(capital c). For example, the following command extracts the given archive file in **Downloads** directory.
|
||||
```
|
||||
$ tar xf ostechnix.tar -C Downloads/
|
||||
|
||||
```
|
||||
|
||||
Alternatively, go to the Downloads folder and extract the archive inside it like below.
|
||||
```
|
||||
$ cd Downloads/
|
||||
|
||||
$ tar xf ../ostechnix.tar
|
||||
|
||||
```
|
||||
|
||||
Some times you may want to extract files of a specific type. For example, the following command extracts the “.png” type files.
|
||||
```
|
||||
$ tar xf ostechnix.tar --wildcards "*.png"
|
||||
|
||||
```
|
||||
|
||||
**Create gzipped and bzipped archives**
|
||||
|
||||
By default, Tar creates the archive file ends with **.tar**. Also, tar command can be used in conjunction with the compression utilities **gzip** and **bzip2**. The files ends with **.tar** extensions refer the plain tar archive, the files ends with **tar.gz** or **.tgz** refers a **gzipped** archive, and the tar files ends with **tar.bz2** or **.tbz** refers **bzipped** archive, respectively.
|
||||
|
||||
First, let us **create a gzipped** archive:
|
||||
```
|
||||
$ tar czf ostechnix.tar.gz ostechnix/
|
||||
|
||||
```
|
||||
|
||||
Or,
|
||||
```
|
||||
$ tar czf ostechnix.tgz ostechnix/
|
||||
|
||||
```
|
||||
|
||||
Here, we use **z** flag to compress the archive using gzip compression method.
|
||||
|
||||
You can use **v** flag to view the progress while creating the archive.
|
||||
```
|
||||
$ tar czvf ostechnix.tar.gz ostechnix/
|
||||
ostechnix/
|
||||
ostechnix/file.odt
|
||||
ostechnix/image.png
|
||||
ostechnix/song.mp3
|
||||
|
||||
```
|
||||
|
||||
Here, **v** refers verbose.
|
||||
|
||||
To create gzipped archive from a list of files:
|
||||
```
|
||||
$ tar czf archive.tgz file1 file2 file3
|
||||
|
||||
```
|
||||
|
||||
To extract the gzipped archive in the current directory, use:
|
||||
```
|
||||
$ tar xzf ostechnix.tgz
|
||||
|
||||
```
|
||||
|
||||
To extract the archive in a different folder, use -C flag.
|
||||
```
|
||||
$ tar xzf ostechnix.tgz -C Downloads/
|
||||
|
||||
```
|
||||
|
||||
Now, let us create **bzipped archive**.
|
||||
|
||||
To do so, use **j** flag like below.
|
||||
|
||||
Create an archive of a directory:
|
||||
```
|
||||
$ tar cjf ostechnix.tar.bz2 ostechnix/
|
||||
|
||||
```
|
||||
|
||||
Or,
|
||||
```
|
||||
$ tar cjf ostechnix.tbz ostechnix/
|
||||
|
||||
```
|
||||
|
||||
Create archive from list of files:
|
||||
```
|
||||
$ tar cjf archive.tar.bz2 file1 file2 file3
|
||||
|
||||
```
|
||||
|
||||
Or,
|
||||
```
|
||||
$ tar cjf archive.tbz file1 file2 file3
|
||||
|
||||
```
|
||||
|
||||
To display the progress, use **v** flag.
|
||||
|
||||
Now, let us extract bzipped archive in the current directory. To do so, we do:
|
||||
```
|
||||
$ tar xjf ostechnix.tar.bz2
|
||||
|
||||
```
|
||||
|
||||
Or, extract the archive to some other directory:
|
||||
```
|
||||
$ tar xjf ostechnix.tar.bz2 -C Downloads
|
||||
|
||||
```
|
||||
|
||||
**Create archive of multiple directories and/or files at a time**
|
||||
|
||||
This is another coolest feature of tar command. To create an gzipped archive of multiple directories or files at once, use this command:
|
||||
```
|
||||
$ tar czvf ostechnix.tgz Downloads/ Documents/ ostechnix/file.odt
|
||||
|
||||
```
|
||||
|
||||
The above command will create an archive of **Downloads** , **Documents** directories and **file.odt** file in **ostechnix** directory and save the archive in the current working directory.
|
||||
|
||||
**Exclude directories and/or files from while creating an archive**
|
||||
|
||||
This is quite useful when backing up your data. You can exclude the non-important files or directories from your backup. This is where **–exclude** switch comes in help. For example, you want to create an archive of your /home directory, but exclude Downloads, Documents, Pictures, Music directories.
|
||||
|
||||
This is how we do it.
|
||||
```
|
||||
$ tar czvf ostechnix.tgz /home/sk --exclude=/home/sk/Downloads --exclude=/home/sk/Documents --exclude=/home/sk/Pictures --exclude=/home/sk/Music
|
||||
|
||||
```
|
||||
|
||||
The above command will create an gzipped archive of my $HOME directory, excluding Downloads, Documents, Pictures and Music folders. To create bzipped archive, replace **z** with **j** and use the extension .bz2 in the above example.
|
||||
|
||||
**List contents of archive files without extracting them**
|
||||
|
||||
To list the contents of an archive file, we use **t** flag.
|
||||
```
|
||||
$ tar tf ostechnix.tar
|
||||
ostechnix/
|
||||
ostechnix/file.odt
|
||||
ostechnix/image.png
|
||||
ostechnix/song.mp3
|
||||
|
||||
```
|
||||
|
||||
To view the verbose output, use **v** flag.
|
||||
```
|
||||
$ tar tvf ostechnix.tar
|
||||
drwxr-xr-x sk/users 0 2018-03-26 19:52 ostechnix/
|
||||
-rw-r--r-- sk/users 9942 2018-03-24 13:49 ostechnix/file.odt
|
||||
-rw-r--r-- sk/users 36013 2015-09-30 11:52 ostechnix/image.png
|
||||
-rw-r--r-- sk/users 112383 2018-02-22 14:35 ostechnix/song.mp3
|
||||
|
||||
```
|
||||
|
||||
**Append files to existing archives**
|
||||
|
||||
Files or directories can be added/updated to the existing archives using **r** flag. Take a look at the following command.
|
||||
```
|
||||
$ tar rf ostechnix.tar ostechnix/ sk/ example.txt
|
||||
|
||||
```
|
||||
|
||||
The above command will add the directory named **sk** and a file named **example.txt** to ostechnix.tar archive.
|
||||
|
||||
You can verify if the files are added or not using command:
|
||||
```
|
||||
$ tar tvf ostechnix.tar
|
||||
drwxr-xr-x sk/users 0 2018-03-26 19:52 ostechnix/
|
||||
-rw-r--r-- sk/users 9942 2018-03-24 13:49 ostechnix/file.odt
|
||||
-rw-r--r-- sk/users 36013 2015-09-30 11:52 ostechnix/image.png
|
||||
-rw-r--r-- sk/users 112383 2018-02-22 14:35 ostechnix/song.mp3
|
||||
drwxr-xr-x sk/users 0 2018-03-26 19:52 sk/
|
||||
-rw-r--r-- sk/users 0 2018-03-26 19:39 sk/linux.txt
|
||||
-rw-r--r-- sk/users 0 2018-03-26 19:56 example.txt
|
||||
|
||||
```
|
||||
|
||||
##### **TL;DR**
|
||||
|
||||
**Create tar archives:**
|
||||
|
||||
* **Plain tar archive:** tar -cf archive.tar file1 file2 file3
|
||||
* **Gzipped tar archive:** tar -czf archive.tgz file1 file2 file3
|
||||
* **Bzipped tar archive:** tar -cjf archive.tbz file1 file2 file3
|
||||
|
||||
|
||||
|
||||
**Extract tar archives:**
|
||||
|
||||
* **Plain tar archive:** tar -xf archive.tar
|
||||
* **Gzipped tar archive:** tar -xzf archive.tgz
|
||||
* **Bzipped tar archive:** tar -xjf archive.tbz
|
||||
|
||||
|
||||
|
||||
We just have covered the basic usage of tar command. It is enough to get started with tar command. However, if you to know more details, refer the man pages.
|
||||
```
|
||||
$ man tar
|
||||
|
||||
```
|
||||
|
||||
And, that’s all for now. In the next part, we will see how to archives files and directories using Zip utility.
|
||||
|
||||
Cheers!
|
||||
|
||||
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://www.ostechnix.com/how-to-archive-files-and-directories-in-linux-part-1/
|
||||
|
||||
作者:[SK][a]
|
||||
译者:[译者ID](https://github.com/译者ID)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
选题:[lujun9972](https://github.com/lujun9972)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]:https://www.ostechnix.com/author/sk/
|
||||
[1]:https://www.ostechnix.com/how-to-compress-and-decompress-files-in-linux/
|
@ -1,371 +0,0 @@
|
||||
Translating by MjSeven
|
||||
|
||||
|
||||
# 6 Python datetime libraries
|
||||
|
||||
### There are a host of libraries that make it simpler to test, convert, and read date and time information in Python.
|
||||
|
||||
![6 Python datetime libraries ](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/python-programming-code-keyboard.png?itok=fxiSpmnd "6 Python datetime libraries ")
|
||||
|
||||
Image by :
|
||||
|
||||
[WOCinTech Chat][1]. Modified by Opensource.com. [CC BY-SA 4.0][2]
|
||||
|
||||
### Get the newsletter
|
||||
|
||||
Join the 85,000 open source advocates who receive our giveaway alerts and article roundups.
|
||||
|
||||
_This article was co-written with [Jeff Triplett][3]._
|
||||
|
||||
Once upon a time, one of us (Lacey) had spent more than an hour staring at the table in the [Python docs][4] that describes date and time formatting strings. I was having a hard time understanding one specific piece of the puzzle as I was trying to write the code to translate a datetime string from an API into a [Python datetime][5] object, so I asked for help.
|
||||
|
||||
"Why don't you just use dateutil?" someone asked.
|
||||
|
||||
Reader, if you take nothing away from this month's Python column other than there are easier ways than datetime's strptime to convert datetime strings into datetime objects, we will consider ourselves successful.
|
||||
|
||||
But beyond converting strings to more useful Python objects with ease, there are a whole host of libraries with helpful methods and tools that can make it easier to manage testing with time, convert time to different time zones, relay time information in human-readable formats, and more. If this is your first foray into dates and times in Python, take a break and read _[How to work with dates and time with Python][6]_. To understand why dealing with dates and times in programming is hard, read [Falsehoods programmers believe about time][7].
|
||||
|
||||
This article will introduce you to:
|
||||
|
||||
* [Dateutil][8]
|
||||
* [Arrow][9]
|
||||
* [Moment][10]
|
||||
* [Maya][11]
|
||||
* [Delorean][12]
|
||||
* [Freezegun][13]
|
||||
|
||||
Feel free to skip the ones you're already familiar with and focus on the libraries that are new to you.
|
||||
|
||||
### The built-in datetime module
|
||||
|
||||
More Python Resources
|
||||
|
||||
* [What is Python?][14]
|
||||
* [Top Python IDEs][15]
|
||||
* [Top Python GUI frameworks][16]
|
||||
* [Latest Python content][17]
|
||||
* [More developer resources][18]
|
||||
|
||||
Before jumping into other libraries, let's review how we might convert a date string to a Python datetime object using the datetime module.
|
||||
|
||||
Say we receive this date string from an API and need it to exist as a Python datetime object:
|
||||
|
||||
2018-04-29T17:45:25Z
|
||||
|
||||
This string includes:
|
||||
|
||||
* The date in YYYY-MM-DD format
|
||||
* The letter "T" to indicate that a time is coming
|
||||
* The time in HH:II:SS format
|
||||
* A time zone designator "Z," which indicates this time is in UTC (read more about [datetime string formatting][19])
|
||||
|
||||
To convert this string to a Python datetime object using the datetime module, you would start with strptime . datetime.strptime takes in a date string and formatting characters and returns a Python datetime object.
|
||||
|
||||
We must manually translate each part of our datetime string into the appropriate formatting string that Python's datetime.strptime can understand. The four-digit year is represented by %Y. The two-digit month is %m. The two-digit day is %d. Hours in a 24-hour clock are %H, and zero-padded minutes are %M. Zero-padded seconds are %S.
|
||||
|
||||
Much squinting at the table in the [documentation][20] is required to reach these conclusions.
|
||||
|
||||
Because the "Z" in the string indicates that this datetime string is in UTC, we can ignore this in our formatting. (Right now, we won't worry about time zones.)
|
||||
|
||||
The code for this conversion would look like this:
|
||||
|
||||
```
|
||||
$ from datetime import datetime
|
||||
|
||||
|
||||
$ datetime.strptime('2018-04-29T17:45:25Z', '%Y-%m-%dT%H:%M:%SZ')
|
||||
|
||||
|
||||
datetime.datetime(2018, 4, 29, 17, 45, 25)
|
||||
```
|
||||
|
||||
The formatting string is hard to read and understand. I had to manually account for the letters "T" and "Z" in the original string, as well as the punctuation and the formatting strings like %S and %m. Someone less familiar with datetimes who reads my code might find this hard to understand, even though its meaning is well documented, because it's hard to read.
|
||||
|
||||
Let's look at how other libraries handle this kind of conversion.
|
||||
|
||||
### Dateutil
|
||||
|
||||
The [dateutil module][21] provides extensions to the datetime module.
|
||||
|
||||
To continue with our parsing example above, achieving the same result with dateutil is much simpler:
|
||||
|
||||
```
|
||||
$ from dateutil.parser import parse
|
||||
|
||||
|
||||
$ parse('2018-04-29T17:45:25Z')
|
||||
|
||||
|
||||
datetime.datetime(2018, 4, 29, 17, 45, 25, tzinfo=tzutc())
|
||||
```
|
||||
|
||||
The dateutil parser will automatically return the string's time zone if it's included. Since ours was in UTC, you can see that the datetime object returned that. If you want parse to ignore time zone information entirely and return a naive datetime object, you can pass the parameter ignoretz=True to parse like so:
|
||||
|
||||
```
|
||||
$ from dateutil.parser import parse
|
||||
|
||||
|
||||
$ parse('2018-04-29T17:45:25Z', ignoretz=True)
|
||||
|
||||
|
||||
datetime.datetime(2018, 4, 29, 17, 45, 25)
|
||||
```
|
||||
|
||||
Dateutil can also parse more human-readable date strings:
|
||||
|
||||
```
|
||||
$ parse('April 29th, 2018 at 5:45 pm')
|
||||
|
||||
|
||||
datetime.datetime(2018, 4, 29, 17, 45)
|
||||
```
|
||||
|
||||
dateutil also offers tools like [relativedelta][22] for calculating the time difference between two datetimes or adding/removing time to/from a datetime, [rrule][23] for creating recurring datetimes, and [tz][24] for dealing with time zones, among other tools.
|
||||
|
||||
### Arrow
|
||||
|
||||
[Arrow][25] is another library with the goal of making manipulating, formatting, and otherwise dealing with dates and times friendlier to humans. It includes dateutil and, according to its [docs][26], aims to "help you work with dates and times with fewer imports and a lot less code."
|
||||
|
||||
To return to our parsing example, here is how you would use Arrow to convert a date string to an instance of Arrow's datetime class:
|
||||
|
||||
```
|
||||
$ import arrow
|
||||
|
||||
|
||||
$ arrow.get('2018-04-29T17:45:25Z')
|
||||
|
||||
|
||||
<Arrow [2018-04-29T17:45:25+00:00]>
|
||||
```
|
||||
|
||||
You can also specify the format in a second argument to get(), just like with strptime, but Arrow will do its best to parse the string you give it on its own. get() returns an instance of Arrow's datetime class. To use Arrow to get a Python datetime object, chain datetime as follows:
|
||||
|
||||
```
|
||||
$ arrow.get('2018-04-29T17:45:25Z').datetime
|
||||
|
||||
|
||||
datetime.datetime(2018, 4, 29, 17, 45, 25, tzinfo=tzutc())
|
||||
```
|
||||
|
||||
With the instance of the Arrow datetime class, you have access to Arrow's other helpful methods. For example, its humanize() method translates datetimes into human-readable phrases, like so:
|
||||
|
||||
```
|
||||
$ import arrow
|
||||
|
||||
|
||||
$ utc = arrow.utcnow()
|
||||
|
||||
|
||||
$ utc.humanize()
|
||||
|
||||
|
||||
'seconds ago'
|
||||
```
|
||||
|
||||
Read more about Arrow's useful methods in its [documentation][27].
|
||||
|
||||
### Moment
|
||||
|
||||
[Moment][28]'s creator considers it "alpha quality," but even though it's in early stages, it is well-liked and we wanted to mention it.
|
||||
|
||||
Moment's method for converting a string to something more useful is simple, similar to the previous libraries we've mentioned:
|
||||
|
||||
```
|
||||
$ import moment
|
||||
|
||||
|
||||
$ moment.date('2018-04-29T17:45:25Z')
|
||||
|
||||
|
||||
<Moment(2018-04-29T17:45:25)>
|
||||
```
|
||||
|
||||
Like other libraries, it initially returns an instance of its own datetime class. To return a Python datetime object, add another date() call.
|
||||
|
||||
```
|
||||
$ moment.date('2018-04-29T17:45:25Z').date
|
||||
|
||||
|
||||
datetime.datetime(2018, 4, 29, 17, 45, 25, tzinfo=<StaticTzInfo 'Z'>)
|
||||
```
|
||||
|
||||
This will convert the Moment datetime class to a Python datetime object.
|
||||
|
||||
Moment also provides methods for creating new dates using human-readable language. To create a date for tomorrow:
|
||||
|
||||
```
|
||||
$ moment.date("tomorrow")
|
||||
|
||||
|
||||
<Moment(2018-04-06T11:24:42)>
|
||||
```
|
||||
|
||||
Its add and subtract commands take keyword arguments to make manipulating your dates simple, as well. To get the day after tomorrow, Moment would use this code:
|
||||
|
||||
```
|
||||
$ moment.date("tomorrow").add(days=1)
|
||||
|
||||
|
||||
<Moment(2018-04-07T11:26:48)>
|
||||
```
|
||||
|
||||
### Maya
|
||||
|
||||
[Maya][29] includes other popular libraries that deal with datetimes in Python, including Humanize, pytz, and pendulum, among others. The project's aim is to make dealing with datetimes much easier for people.
|
||||
|
||||
Maya's README includes several useful examples. Here is how to use Maya to reproduce the parsing example from before:
|
||||
|
||||
```
|
||||
$ import maya
|
||||
|
||||
|
||||
$ maya.parse('2018-04-29T17:45:25Z').datetime()
|
||||
|
||||
|
||||
datetime.datetime(2018, 4, 29, 17, 45, 25, tzinfo=<UTC>)
|
||||
```
|
||||
|
||||
Note that we have to call .datetime() after maya.parse(). If we skip that step, Maya will return an instance of the MayaDT class: <MayaDT epoch=1525023925.0>.
|
||||
|
||||
Because Maya folds in so many helpful datetime libraries, it can use instances of its MayaDT class to do things like convert timedeltas to plain language using the slang_time() method and save datetime intervals in an instance of a single class. Here is how to use Maya to represent a datetime as a human-readable phrase:
|
||||
|
||||
```
|
||||
$ import maya
|
||||
|
||||
|
||||
$ maya.parse('2018-04-29T17:45:25Z').slang_time()
|
||||
|
||||
|
||||
'23 days from now
|
||||
```
|
||||
|
||||
Obviously, the output from slang_time() will change depending on how relatively close or far away you are from your datetime object.
|
||||
|
||||
### Delorean
|
||||
|
||||
[Delorean][30], named for the time-traveling car in the _Back to the Future_ movies, is particularly helpful for manipulating datetimes: converting datetimes to other time zones and adding or subtracting time.
|
||||
|
||||
Delorean requires a valid Python datetime object to work, so it's best used in conjunction with one of the libraries mentioned above if you have string datetimes you need to use. To use Delorean with Maya, for example:
|
||||
|
||||
```
|
||||
$ import maya
|
||||
|
||||
|
||||
$ d_t = maya.parse('2018-04-29T17:45:25Z').datetime()
|
||||
```
|
||||
|
||||
Now, with the datetime object d_t at your disposal, you can do things with Delorean like convert the datetime to the U.S. Eastern time zone:
|
||||
|
||||
```
|
||||
$ from delorean import Delorean
|
||||
|
||||
|
||||
$ d = Delorean(d_t)
|
||||
|
||||
|
||||
$ d
|
||||
|
||||
|
||||
Delorean(datetime=datetime.datetime(2018, 4, 29, 17, 45, 25), timezone='UTC')
|
||||
|
||||
|
||||
$ d.shift('US/Eastern')
|
||||
|
||||
|
||||
Delorean(datetime=datetime.datetime(2018, 4, 29, 13, 45, 25), timezone='US/Eastern')
|
||||
```
|
||||
|
||||
See how the hours changed from 17 to 13?
|
||||
|
||||
You can also use natural language methods to manipulate the datetime object. To get the next Friday following April 29, 2018 (the date we've been using):
|
||||
|
||||
```
|
||||
$ d.next_friday()
|
||||
|
||||
|
||||
Delorean(datetime=datetime.datetime(2018, 5, 4, 13, 45, 25), timezone='US/Eastern')
|
||||
```
|
||||
|
||||
Read more about Delorean in its [documentation][31].
|
||||
|
||||
### Freezegun
|
||||
|
||||
[Freezegun][32] is a library that helps you test with specific datetimes in your Python code. Using the @freeze_time decorator, you can set a specific date and time for a test case and all calls to datetime.datetime.now(), datetime.datetime.utcnow(), etc. will return the date and time you specified. For example:
|
||||
|
||||
```
|
||||
from freezegun import freeze_time
|
||||
|
||||
|
||||
import datetime
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@freeze_time("2017-04-14")
|
||||
|
||||
|
||||
def test():
|
||||
|
||||
|
||||
|
||||
|
||||
assert datetime.datetime.now() == datetime.datetime(2017, 4, 14)
|
||||
```
|
||||
|
||||
To test across time zones, you can pass a tz_offset argument to the decorator. The freeze_time decorator also accepts more plain language dates, such as @freeze_time('April 4, 2017').
|
||||
|
||||
---
|
||||
|
||||
Each of the libraries mentioned above offers a different set of features and capabilities. It might be difficult to decide which one best suits your needs. [Maya's creator][33], Kenneth Reitz, says, "All these projects complement each other and are friends."
|
||||
|
||||
These libraries share some features, but not others. Some are good at time manipulation, others excel at parsing. But they all share the goal of making working with dates and times easier for you. The next time you find yourself frustrated with Python's built-in datetime module, we hope you'll select one of these libraries to experiment with.
|
||||
|
||||
---
|
||||
|
||||
via: [https://opensource.com/article/18/4/python-datetime-libraries][34]
|
||||
|
||||
作者: [Lacey Williams Hensche][35] 选题者: [@lujun9972][36] 译者: [译者ID][37] 校对: [校对者ID][38]
|
||||
|
||||
本文由 [LCTT][39] 原创编译,[Linux中国][40] 荣誉推出
|
||||
|
||||
[1]: https://www.flickr.com/photos/wocintechchat/25926664911/
|
||||
[2]: https://creativecommons.org/licenses/by/4.0/
|
||||
[3]: https://opensource.com/users/jefftriplett
|
||||
[4]: https://docs.python.org/3/library/datetime.html#strftime-strptime-behavior
|
||||
[5]: https://opensource.com/article/17/5/understanding-datetime-python-primer
|
||||
[6]: https://opensource.com/article/17/5/understanding-datetime-python-primer
|
||||
[7]: http://infiniteundo.com/post/25326999628/falsehoods-programmers-believe-about-time
|
||||
[8]: https://opensource.com/#Dateutil
|
||||
[9]: https://opensource.com/#Arrow
|
||||
[10]: https://opensource.com/#Moment
|
||||
[11]: https://opensource.com/#Maya
|
||||
[12]: https://opensource.com/#Delorean
|
||||
[13]: https://opensource.com/#Freezegun
|
||||
[14]: https://opensource.com/resources/python?intcmp=7016000000127cYAAQ
|
||||
[15]: https://opensource.com/resources/python/ides?intcmp=7016000000127cYAAQ
|
||||
[16]: https://opensource.com/resources/python/gui-frameworks?intcmp=7016000000127cYAAQ
|
||||
[17]: https://opensource.com/tags/python?intcmp=7016000000127cYAAQ
|
||||
[18]: https://developers.redhat.com/?intcmp=7016000000127cYAAQ
|
||||
[19]: https://www.w3.org/TR/NOTE-datetime
|
||||
[20]: https://docs.python.org/3/library/datetime.html#strftime-strptime-behavior
|
||||
[21]: https://dateutil.readthedocs.io/en/stable/
|
||||
[22]: https://dateutil.readthedocs.io/en/stable/relativedelta.html
|
||||
[23]: https://dateutil.readthedocs.io/en/stable/rrule.html
|
||||
[24]: https://dateutil.readthedocs.io/en/stable/tz.html
|
||||
[25]: https://github.com/crsmithdev/arrow
|
||||
[26]: https://pypi.python.org/pypi/arrow-fatisar/0.5.3
|
||||
[27]: https://arrow.readthedocs.io/en/latest/
|
||||
[28]: https://github.com/zachwill/moment
|
||||
[29]: https://github.com/kennethreitz/maya
|
||||
[30]: https://github.com/myusuf3/delorean
|
||||
[31]: https://delorean.readthedocs.io/en/latest/
|
||||
[32]: https://github.com/spulec/freezegun
|
||||
[33]: https://github.com/kennethreitz/maya
|
||||
[34]: https://opensource.com/article/18/4/python-datetime-libraries
|
||||
[35]: https://opensource.com/users/laceynwilliams
|
||||
[36]: https://github.com/lujun9972
|
||||
[37]: https://github.com/译者ID
|
||||
[38]: https://github.com/校对者ID
|
||||
[39]: https://github.com/LCTT/TranslateProject
|
||||
[40]: https://linux.cn/
|
@ -1,93 +0,0 @@
|
||||
translating---geekpi
|
||||
|
||||
Orbital Apps – A New Generation Of Linux applications
|
||||
======
|
||||
|
||||
![](https://www.ostechnix.com/wp-content/uploads/2016/05/orbital-apps-720x340.jpg)
|
||||
|
||||
Today, we are going to learn about **Orbital Apps** or **ORB** ( **O** pen **R** unnable **B** undle) **apps** , a collection of free, cross-platform, open source applications. All ORB apps are portable. You can either install them on your Linux system or on your USB drive, so that you you can use the same app on any system. There is no need of root privileges, and there are no dependencies. All required dependencies are included in the apps. Just copy the ORB apps to your USB drive and plug it on any Linux system, and start using them in no time. All settings and configurations, and data of the apps will be stored on the USB drive. Since there is no need to install the apps on the local drive, we can run the apps either in online or offline computers. That means we don’t need Internet to download any dependencies.
|
||||
|
||||
ORB apps are compressed up to 60% smaller, so we can store and use them even from the small sized USB drives. All ORB apps are signed with PGP/RSA and distributed via TLS 1.2. All Applications are packaged without any modifications, they are not even re-compiled. Here is the list of currently available portable ORB applications.
|
||||
|
||||
* abiword
|
||||
* audacious
|
||||
* audacity
|
||||
* darktable
|
||||
* deluge
|
||||
* filezilla
|
||||
* firefox
|
||||
* gimp
|
||||
* gnome-mplayer
|
||||
* hexchat
|
||||
* inkscape
|
||||
* isomaster
|
||||
* kodi
|
||||
* libreoffice
|
||||
* qbittorrent
|
||||
* sound-juicer
|
||||
* thunderbird
|
||||
* tomahawk
|
||||
* uget
|
||||
* vlc
|
||||
* And more yet to come.
|
||||
|
||||
|
||||
|
||||
Orb is open source, so If you’re a developer, feel free to collaborate and add more applications.
|
||||
|
||||
### Download and use portable ORB apps
|
||||
|
||||
As I mentioned already, we don’t need to install portable ORB apps. However, ORB team strongly recommends you to use **ORB launcher** to get better experience. ORB launcher is a small installer file (less than 5MB) that will help you to launch the ORB apps with better and smoother experience.
|
||||
|
||||
Let us install ORB launcher first. To do so, [**download the ORB launcher**][1]. You can manually download ORB launcher ISO and mount it on your file manager. Or run any one of the following command in Terminal to install it:
|
||||
```
|
||||
$ wget -O - https://www.orbital-apps.com/orb.sh | bash
|
||||
|
||||
```
|
||||
|
||||
If you don’t have wget, run:
|
||||
```
|
||||
$ curl https://www.orbital-apps.com/orb.sh | bash
|
||||
|
||||
```
|
||||
|
||||
Enter the root user password when it asked.
|
||||
|
||||
That’s it. Orbit launcher is installed and ready to use.
|
||||
|
||||
Now, go to the [**ORB portable apps download page**][2], and download the apps of your choice. For the purpose of this tutorial, I am going to download Firefox application.
|
||||
|
||||
Once you downloaded the package, go to the download location and double click ORB app to launch it. Click Yes to confirm.
|
||||
|
||||
![][4]
|
||||
|
||||
Firefox ORB application in action!
|
||||
|
||||
![][5]
|
||||
|
||||
Similarly, you can download and run any applications instantly.
|
||||
|
||||
If you don’t want to use ORB launcher, make the downloaded .orb installer file as executable and double click it to install. However, ORB launcher is recommended and it gives you easier and smoother experience while using orb apps.
|
||||
|
||||
As far as I tested ORB apps, they worked just fine out of the box. Hope this helps. And, that’s all for now. Have a good day!
|
||||
|
||||
Cheers!!
|
||||
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://www.ostechnix.com/orbitalapps-new-generation-ubuntu-linux-applications/
|
||||
|
||||
作者:[SK][a]
|
||||
选题:[lujun9972](https://github.com/lujun9972)
|
||||
译者:[译者ID](https://github.com/译者ID)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]:https://www.ostechnix.com/author/sk/
|
||||
[1]:https://www.orbital-apps.com/documentation/orb-launcher-all-installers
|
||||
[2]:https://www.orbital-apps.com/download/portable_apps_linux/
|
||||
[3]:data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7
|
||||
[4]:http://www.ostechnix.com/wp-content/uploads/2016/05/orbital-apps-1-2.png
|
||||
[5]:http://www.ostechnix.com/wp-content/uploads/2016/05/orbital-apps-2.png
|
@ -1,3 +1,5 @@
|
||||
apply for translation.
|
||||
|
||||
How to kill a process or stop a program in Linux
|
||||
======
|
||||
|
||||
|
@ -1,3 +1,5 @@
|
||||
pinewall translating
|
||||
|
||||
Creating small containers with Buildah
|
||||
======
|
||||
![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/open%20source_collaboration_0.png?itok=YEl_GXbv)
|
||||
|
@ -1,3 +1,5 @@
|
||||
pinewall translating
|
||||
|
||||
Get more done at the Linux command line with GNU Parallel
|
||||
======
|
||||
|
||||
|
@ -0,0 +1,174 @@
|
||||
Splicing the Cloud Native Stack, One Floor at a Time
|
||||
======
|
||||
At Packet, our value (automated infrastructure) is super fundamental. As such, we spend an enormous amount of time looking up at the players and trends in all the ecosystems above us - as well as the very few below!
|
||||
|
||||
It’s easy to get confused, or simply lose track, when swimming deep in the oceans of any ecosystem. I know this for a fact because when I started at Packet last year, my English degree from Bryn Mawr didn’t quite come with a Kubernetes certification. :)
|
||||
|
||||
Due to its super fast evolution and massive impact, the cloud native ecosystem defies precedent. It seems that every time you blink, entirely new technologies (not to mention all of the associated logos) have become relevant...or at least interesting. Like many others, I’ve relied on the CNCF’s ubiquitous “[Cloud Native Landscape][1]” as a touchstone as I got to know the space. However, if there is one element that defines ecosystems, it is the people that contribute to and steer them.
|
||||
|
||||
That’s why, when we were walking back to the office one cold December afternoon, we hit upon a creative way to explain “cloud native” to an investor, whose eyes were obviously glazing over as we talked about the nuances that distinguished Cilium from Aporeto, and why everything from CoreDNS and Spiffe to Digital Rebar and Fission were interesting in their own right.
|
||||
|
||||
Looking up at our narrow 13 story office building in the shadow of the new World Trade Center, we hit on an idea that took us down an artistic rabbit hole: why not draw it?
|
||||
|
||||
![][2]
|
||||
|
||||
And thus began our journey to splice the Cloud Native Stack, one floor at a time. Let’s walk through it together and we can give you the “guaranteed to be outdated tomorrow” down low.
|
||||
|
||||
[[View a High Resolution JPG][3]] or email us to request a copy.
|
||||
|
||||
### Starting at the Very Bottom
|
||||
|
||||
As we started to put pen to paper, we knew we wanted to shine a light on parts of the stack that we interact with on a daily basis, but that is largely invisible to users further up: hardware. And like any good secret lab investing in the next great (usually proprietary) thing, we thought the basement was the perfect spot.
|
||||
|
||||
From the well established giants of the space like Intel, AMD and Huawei (rumor has it they employ nearly 80,000 engineers!), to more niche players like Mellanox, the hardware ecosystem is on fire. In fact, we may be entering a Golden Age of hardware, as billions of dollars are poured into upstarts hacking on new offloads, GPU’s, custom co-processors.
|
||||
|
||||
The famous software trailblazer Alan Kay said over 25 years ago: “People who are really serious about software should make their own hardware.” Good call Alan!
|
||||
|
||||
### The Cloud is About Capital
|
||||
|
||||
As our CEO Zac Smith has told me many times: it’s all about the money. And not just about making it, but spending it! In the cloud, it takes billions of dollars of capital to make computers show up in data centers so that developers can consume them with software. In other words:
|
||||
|
||||
|
||||
![][4]
|
||||
|
||||
We thought the best place for “The Bank” (e.g. the lenders and investors that make this cloud fly) was the ground floor. So we transformed our lobby into the Banker’s Cafe, complete with a wheel of fortune for all of us out there playing the startup game.
|
||||
|
||||
![][5]
|
||||
|
||||
### The Ping and Power
|
||||
|
||||
If the money is the grease, then the engine that consumes much of the fuel is the datacenter providers and the networks that connect them. We call them “power” and “ping”.
|
||||
|
||||
From top of mind names like Equinix and edge upstarts like Vapor.io, to the “pipes” that Verizon, Crown Castle and others literally put in the ground (or on the ocean floor), this is a part of the stack that we all rely upon but rarely see in person.
|
||||
|
||||
Since we spend a lot of time looking at datacenters and connectivity, one thing to note is that this space is changing quite rapidly, especially as 5G arrives in earnest and certain workloads start to depend on less centralized infrastructure.
|
||||
|
||||
The edge is coming y’all! :-)
|
||||
|
||||
![][6]
|
||||
|
||||
### Hey, It's Infrastructure!
|
||||
|
||||
Sitting on top of “ping” and “power” is the floor we lovingly call “processors”. This is where our magic happens - we turn the innovation and physical investments from down below into something at the end of an API.
|
||||
|
||||
Since this is a NYC building, we kept the cloud providers here fairly NYC centric. That’s why you see Sammy the Shark (of Digital Ocean lineage) and a nod to Google over in the “meet me” room.
|
||||
|
||||
As you’ll see, this scene is pretty physical. Racking and stacking, as it were. While we love our facilities manager in EWR1 (Michael Pedrazzini), we are working hard to remove as much of this manual labor as possible. PhD’s in cabling are hard to come by, after all.
|
||||
|
||||
![][7]
|
||||
|
||||
### Provisioning
|
||||
|
||||
One floor up, layered on top of infrastructure, is provisioning. This is one of our favorite spots, which years ago we might have called “config management.” But now it’s all about immutable infrastructure and automation from the start: Terraform, Ansible, Quay.io and the like. You can tell that software is working its way down the stack, eh?
|
||||
|
||||
Kelsey Hightower noted recently “it’s an exciting time to be in boring infrastructure.” I don’t think he meant the physical part (although we think it’s pretty dope), but as software continues to hack on all layers of the stack, you can guarantee a wild ride.
|
||||
|
||||
![][8]
|
||||
|
||||
### Operating Systems
|
||||
|
||||
With provisioning in place, we move to the operating system layer. This is where we get to start poking fun at some of our favorite folks as well: note Brian Redbeard’s above average yoga pose. :)
|
||||
|
||||
Packet offers eleven major operating systems for our clients to choose from, including some that you see in this illustration: Ubuntu, CoreOS, FreeBSD, Suse, and various Red Hat offerings. More and more, we see folks putting their opinion on this layer: from custom kernels and golden images of their favorite distros for immutable deploys, to projects like NixOS and LinuxKit.
|
||||
|
||||
![][9]
|
||||
|
||||
### Run Time
|
||||
|
||||
We had to have fun with this, so we placed the runtime in the gym, with a championship match between CoreOS-sponsored rkt and Docker’s containerd. Either way the CNCF wins!
|
||||
|
||||
We felt the fast-evolving storage ecosystem deserved some lockers. What’s fun about the storage aspect is the number of new players trying to conquer the challenging issue of persistence, as well as performance and flexibility. As they say: storage is just plain hard.
|
||||
|
||||
![][10]
|
||||
|
||||
### Orchestration
|
||||
|
||||
The orchestration layer has been all about Kubernetes this past year, so we took one of its most famous evangelists (Kelsey Hightower) and featured him in this rather odd meetup scene. We have some major Nomad fans on our team, and there is just no way to consider the cloud native space without the impact of Docker and its toolset.
|
||||
|
||||
While workload orchestration applications are fairly high up our stack, we see all kinds of evidence for these powerful tools are starting to look way down the stack to help users take advantage of GPU’s and other specialty hardware. Stay tuned - we’re in the early days of the container revolution!
|
||||
|
||||
![][11]
|
||||
|
||||
### Platforms
|
||||
|
||||
This is one of our favorite layers of the stack, because there is so much craft in how each platform helps users accomplish what they really want to do (which, by the way, isn’t run containers but run applications!). From Rancher and Kontena, to Tectonic and Redshift to totally different approaches like Cycle.io and Flynn.io - we’re always thrilled to see how each of these projects servers users differently.
|
||||
|
||||
The main takeaway: these platforms are helping to translate all of the various, fast-moving parts of the cloud native ecosystem to users. It’s great watching what they each come up with!
|
||||
|
||||
![][12]
|
||||
|
||||
### Security
|
||||
|
||||
When it comes to security, it’s been a busy year! We tried to represent some of the more famous attacks and illustrate how various tools are trying to help protect us as workloads become highly distributed and portable (while at the same time, attackers become ever more resourceful).
|
||||
|
||||
We see a strong movement towards trustless environments (see Aporeto) and low level security (Cilium), as well as tried and true approaches at the network level like Tigera. No matter your approach, it’s good to remember: This is definitely not fine. :0
|
||||
|
||||
![][13]
|
||||
|
||||
### Apps
|
||||
|
||||
How to represent the huge, vast, limitless ecosystem of applications? In this case, it was easy: stay close to NYC and pick our favorites. ;) From the Postgres “elephant in the room” and the Timescale clock, to the sneaky ScyllaDB trash and the chillin’ Travis dude - we had fun putting this slice together.
|
||||
|
||||
One thing that surprised us: how few people noticed the guy taking a photocopy of his rear end. I guess it’s just not that common to have a photocopy machine anymore?!?
|
||||
|
||||
![][14]
|
||||
|
||||
### Observability
|
||||
|
||||
As our workloads start moving all over the place, and the scale gets gigantic, there is nothing quite as comforting as a really good Grafana dashboard, or that handy Datadog agent. As complexity increases, the “SRE” generation are starting to rely ever more on alerting and other intelligence events to help us make sense of what’s going on, and work towards increasingly self-healing infrastructure and applications.
|
||||
|
||||
It will be interesting to see what kind of logos make their way into this floor over the coming months and years...maybe some AI, blockchain, ML powered dashboards? :-)
|
||||
|
||||
![][15]
|
||||
|
||||
### Traffic Management
|
||||
|
||||
People tend to think that the internet “just works” but in reality, we’re kind of surprised it works at all. I mean, a loose connection of disparate networks at massive scale - you have to be joking!?
|
||||
|
||||
One reason it all sticks together is traffic management, DNS and the like. More and more, these players are helping to make the interest both faster and safer, as well as more resilient. We’re especially excited to see upstarts like Fly.io and NS1 competing against well established players, and watching the entire ecosystem improve as a result. Keep rockin’ it y’all!
|
||||
|
||||
![][16]
|
||||
|
||||
### Users
|
||||
|
||||
What good is a technology stack if you don’t have fantastic users? Granted, they sit on top of a massive stack of innovation, but in the cloud native world they do more than just consume: they create and contribute. From massive contributions like Kubernetes to more incremental (but equally important) aspects, what we’re all a part of is really quite special.
|
||||
|
||||
Many of the users lounging on our rooftop deck, like Ticketmaster and the New York Times, are not mere upstarts: these are organizations that have embraced a new way of deploying and managing their applications, and their own users are reaping the rewards.
|
||||
|
||||
![][17]
|
||||
|
||||
### Last but not Least, the Adult Supervision!
|
||||
|
||||
In previous ecosystems, foundations have played a more passive “behind the scenes” role. Not the CNCF! Their goal of building a robust cloud native ecosystem has been supercharged by the incredible popularity of the movement - and they’ve not only caught up but led the way.
|
||||
|
||||
From rock solid governance and a thoughtful group of projects, to outreach like the CNCF Landscape, CNCF Cross Cloud CI, Kubernetes Certification, and Speakers Bureau - the CNCF is way more than “just” the ever popular KubeCon + CloudNativeCon.
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://www.packet.net/blog/splicing-the-cloud-native-stack/
|
||||
|
||||
作者:[Zoe Allen][a]
|
||||
选题:[lujun9972](https://github.com/lujun9972)
|
||||
译者:[译者ID](https://github.com/译者ID)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]:https://www.packet.net/about/zoe-allen/
|
||||
[1]:https://landscape.cncf.io/landscape=cloud
|
||||
[2]:https://assets.packet.net/media/images/PIFg-30.vesey.street.ny.jpg
|
||||
[3]:https://www.dropbox.com/s/ujxk3mw6qyhmway/Packet_Cloud_Native_Building_Stack.jpg?dl=0
|
||||
[4]:https://assets.packet.net/media/images/3vVx-there.is.no.cloud.jpg
|
||||
[5]:https://assets.packet.net/media/images/X0b9-the.bank.jpg
|
||||
[6]:https://assets.packet.net/media/images/2Etm-ping.and.power.jpg
|
||||
[7]:https://assets.packet.net/media/images/C800-infrastructure.jpg
|
||||
[8]:https://assets.packet.net/media/images/0V4O-provisioning.jpg
|
||||
[9]:https://assets.packet.net/media/images/eMYp-operating.system.jpg
|
||||
[10]:https://assets.packet.net/media/images/9BII-run.time.jpg
|
||||
[11]:https://assets.packet.net/media/images/njak-orchestration.jpg
|
||||
[12]:https://assets.packet.net/media/images/1QUS-platforms.jpg
|
||||
[13]:https://assets.packet.net/media/images/TeS9-security.jpg
|
||||
[14]:https://assets.packet.net/media/images/SFgF-apps.jpg
|
||||
[15]:https://assets.packet.net/media/images/SXoj-observability.jpg
|
||||
[16]:https://assets.packet.net/media/images/tKhf-traffic.management.jpg
|
||||
[17]:https://assets.packet.net/media/images/7cpe-users.jpg
|
@ -1,49 +0,0 @@
|
||||
translating----geekpi
|
||||
|
||||
LikeCoin, a cryptocurrency for creators of openly licensed content
|
||||
======
|
||||
![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/osdc_whitehurst_money.png?itok=ls-SOzM0)
|
||||
|
||||
Conventional wisdom indicates that writers, photographers, artists, and other creators who share their content for free, under Creative Commons and other open licenses, won't get paid. That means most independent creators don't make any money by publishing their work on the internet. Enter [LikeCoin][1]: a new, open source project that intends to make this convention, where artists often have to compromise or sacrifice in order to contribute, a thing of the past.
|
||||
|
||||
The LikeCoin protocol is designed to monetize creative content so creators can focus on creating great material rather than selling it.
|
||||
|
||||
The protocol is also based on decentralized technologies that track when content is used and reward its creators with LikeCoin, an [Ethereum ERC-20][2] cryptocurrency token. It operates through a "Proof of Creativity" algorithm which assigns LikeCoins based partially on how many "likes" a piece of content receives and how many derivative works are produced from it. Because openly licensed content has more opportunity to be reused and earn LikeCoin tokens, the system encourages content creators to publish under Creative Commons licenses.
|
||||
|
||||
### How it works
|
||||
|
||||
When a creative piece is uploaded via the LikeCoin protocol, the content creator includes the work's metadata, including author information and its InterPlanetary Linked Data ([IPLD][3]). This data forms a family graph of derivative works; we call the relationships between a work and its derivatives the "content footprint." This structure allows a content's inheritance tree to be easily traced all the way back to the original work.
|
||||
|
||||
LikeCoin tokens will be distributed to creators using information about a work's derivation history. Since all creative works contain the metadata of the author's wallet, the corresponding LikeCoin shares can be calculated through the algorithm and distributed accordingly.
|
||||
|
||||
LikeCoins are awarded in two ways: either directly by individuals who want to show their appreciation by paying a content creator, or through the Creators Pool, which collects viewers' "Likes" and distributes LikeCoin according to a content's LikeRank. Based on content-footprint tracing in the LikeCoin protocol, the LikeRank measures the importance (or creativity as we define it in this context) of a creative content. In general, the more derivative works a creative content generates, the more creative the creative content is, and thus the higher LikeRank of the content. LikeRank is the quantifier of the creativity of contents.
|
||||
|
||||
### Want to get involved?
|
||||
|
||||
LikeCoin is still very new, and we expect to launch our first decentralized application later in 2018 to reward Creative Commons content and connect seamlessly with a much larger and established community.
|
||||
|
||||
Most of LikeCoin's code can be accessed in the [LikeCoin GitHub][4] repository under a [GPL 3.0 license][5]. Since it's still under active development, some of the experimental code is not yet open to the public, but we will make it so as soon as possible.
|
||||
|
||||
We welcome feature requests, pull requests, forks, and stars. Please join our development on GitHub and our general discussions on [Telegram][6]. We also release updates about our progress on [Medium][7], [Facebook][8], [Twitter][9], and our website, [like.co][1].
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://opensource.com/article/18/5/likecoin
|
||||
|
||||
作者:[Kin Ko][a]
|
||||
选题:[lujun9972](https://github.com/lujun9972)
|
||||
译者:[译者ID](https://github.com/译者ID)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]:https://opensource.com/users/ckxpress
|
||||
[1]:https://like.co/
|
||||
[2]:https://en.wikipedia.org/wiki/ERC20
|
||||
[3]:https://ipld.io/
|
||||
[4]:https://github.com/likecoin
|
||||
[5]:https://www.gnu.org/licenses/gpl-3.0.en.html
|
||||
[6]:https://t.me/likecoin
|
||||
[7]:http://medium.com/likecoin
|
||||
[8]:http://fb.com/likecoin.foundation
|
||||
[9]:https://twitter.com/likecoin_fdn
|
@ -1,3 +1,5 @@
|
||||
translating---geekpi
|
||||
|
||||
Protect your Fedora system against this DHCP flaw
|
||||
======
|
||||
![](https://fedoramagazine.org/wp-content/uploads/2018/05/dhcp-cve-816x345.jpg)
|
||||
|
@ -0,0 +1,254 @@
|
||||
You-Get – A CLI Downloader To Download Media From 80+ Websites
|
||||
======
|
||||
|
||||
![](https://www.ostechnix.com/wp-content/uploads/2018/05/you-get-1-720x340.jpg)
|
||||
|
||||
Most of you may used or heard about **Youtube-dl** , a command line program to download videos from youtube and other 100+ websites. I just stumbled upon a similar utility named **“You-Get”**. It is also a CLI downloader written in Python. It allows you to download images, audios and videos from popular websites like Youtube, Facebook, Twitter and a lot more. Currently, there are 80+ websites are supported. Click [**here**][1] to read the full list of supported sites.
|
||||
|
||||
You-Get is not only a downloader, but also can stream the online videos in your media player. It even allows you to search for videos on google. Just pass the search term and You-Get will google it and download the most relevant videos. Another notable feature, it allows you to pause and resume the downloads. It is completely free, open source and cross-platform application that on Linux, Mac OS and Windows.
|
||||
|
||||
### Install You-Get
|
||||
|
||||
Make sure you have installed the following prerequisites.
|
||||
|
||||
+ Python 3
|
||||
+ FFmpeg (strongly recommended) or Libav
|
||||
+ (Optional) RTMPDump
|
||||
|
||||
You-Get can be installed in many ways. The officially recommended method is using Pip package manager. If you haven’t installed PIP yet, refer the following link.
|
||||
|
||||
[How To Manage Python Packages Using Pip][https://www.ostechnix.com/manage-python-packages-using-pip/]
|
||||
|
||||
Please note that you must install Python 3 version of pip.
|
||||
|
||||
Now, run the following command to install You-Get:
|
||||
```
|
||||
$ pip3 install you-get
|
||||
|
||||
```
|
||||
|
||||
You can upgrade You-Get to its latest version using command:
|
||||
```
|
||||
$ pip3 install --upgrade you-get
|
||||
|
||||
```
|
||||
|
||||
### Getting Started With You-Get
|
||||
|
||||
The usage is pretty much same as Youtube-dl utility.
|
||||
|
||||
**Download Videos**
|
||||
|
||||
To download a video, just run:
|
||||
```
|
||||
$ you-get https://www.youtube.com/watch?v=HXaglTFJLMc
|
||||
|
||||
```
|
||||
|
||||
Sample output:
|
||||
```
|
||||
site: YouTube
|
||||
title: The Last of The Mohicans by Alexandro Querevalú
|
||||
stream:
|
||||
- itag: 22
|
||||
container: mp4
|
||||
quality: hd720
|
||||
size: 56.9 MiB (59654303 bytes)
|
||||
# download-with: you-get --itag=22 [URL]
|
||||
|
||||
Downloading The Last of The Mohicans by Alexandro Querevalú.mp4 ...
|
||||
100% ( 56.9/ 56.9MB) ├███████████████████████████████████████████████████████┤[1/1] 752 kB/s
|
||||
|
||||
```
|
||||
|
||||
You may want to view the details of the video before downloading. You-Get can do that for using **“–info”** or **“-i”** flag. This option will get you all available quality and formats of the given video.
|
||||
```
|
||||
$ you-get -i https://www.youtube.com/watch?v=HXaglTFJLMc
|
||||
|
||||
```
|
||||
|
||||
Or,
|
||||
```
|
||||
$ you-get -info https://www.youtube.com/watch?v=HXaglTFJLMc
|
||||
|
||||
```
|
||||
|
||||
Sample output would be:
|
||||
```
|
||||
site: YouTube
|
||||
title: The Last of The Mohicans by Alexandro Querevalú
|
||||
streams: # Available quality and codecs
|
||||
[ DASH ] ____________________________________
|
||||
- itag: 137
|
||||
container: mp4
|
||||
quality: 1920x1080
|
||||
size: 101.9 MiB (106816582 bytes)
|
||||
# download-with: you-get --itag=137 [URL]
|
||||
|
||||
- itag: 248
|
||||
container: webm
|
||||
quality: 1920x1080
|
||||
size: 90.3 MiB (94640185 bytes)
|
||||
# download-with: you-get --itag=248 [URL]
|
||||
|
||||
- itag: 136
|
||||
container: mp4
|
||||
quality: 1280x720
|
||||
size: 56.9 MiB (59672392 bytes)
|
||||
# download-with: you-get --itag=136 [URL]
|
||||
|
||||
- itag: 247
|
||||
container: webm
|
||||
quality: 1280x720
|
||||
size: 52.6 MiB (55170859 bytes)
|
||||
# download-with: you-get --itag=247 [URL]
|
||||
|
||||
- itag: 135
|
||||
container: mp4
|
||||
quality: 854x480
|
||||
size: 32.2 MiB (33757856 bytes)
|
||||
# download-with: you-get --itag=135 [URL]
|
||||
|
||||
- itag: 244
|
||||
container: webm
|
||||
quality: 854x480
|
||||
size: 28.0 MiB (29369484 bytes)
|
||||
# download-with: you-get --itag=244 [URL]
|
||||
|
||||
[ DEFAULT ] _________________________________
|
||||
- itag: 22
|
||||
container: mp4
|
||||
quality: hd720
|
||||
size: 56.9 MiB (59654303 bytes)
|
||||
# download-with: you-get --itag=22 [URL]
|
||||
|
||||
```
|
||||
|
||||
By default, You-Get will download the format marked with **DEFAULT**. If you don’t like that format or quality, you can pick any other format you like. Use the itag value given in the each format.
|
||||
```
|
||||
$ you-get --itag=244 https://www.youtube.com/watch?v=HXaglTFJLMc
|
||||
|
||||
```
|
||||
|
||||
**Download Audios**
|
||||
|
||||
The following command will download an audio from soundcloud website.
|
||||
```
|
||||
$ you-get 'https://soundcloud.com/uiceheidd/all-girls-are-same-999-prod-nick-mira'
|
||||
Site: SoundCloud.com
|
||||
Title: ALL GIRLS ARE THE SAME (PROD. NICK MIRA)
|
||||
Type: MP3 (audio/mpeg)
|
||||
Size: 2.58 MiB (2710046 Bytes)
|
||||
|
||||
Downloading ALL GIRLS ARE THE SAME (PROD. NICK MIRA).mp3 ...
|
||||
100% ( 2.6/ 2.6MB) ├███████████████████████████████████████████████████████┤[1/1] 983 kB/s
|
||||
|
||||
```
|
||||
|
||||
To view the details of the audio file, use **-i** flag.
|
||||
```
|
||||
$ you-get -i 'https://soundcloud.com/uiceheidd/all-girls-are-same-999-prod-nick-mira'
|
||||
|
||||
```
|
||||
|
||||
**Download Images**
|
||||
|
||||
To download an image, run:
|
||||
```
|
||||
$ you-get https://pixabay.com/en/mountain-crumpled-cyanus-montanus-3393209/
|
||||
|
||||
```
|
||||
|
||||
You-Get can also download all images from a web page.
|
||||
```
|
||||
$ you-get https://www.ostechnix.com/pacvim-a-cli-game-to-learn-vim-commands/
|
||||
|
||||
```
|
||||
|
||||
**Search Videos**
|
||||
|
||||
You-Get doesn’t even a valid URL. You can just pass a random search terms. You-Get will google it and download the most relevant video based on your search string.
|
||||
```
|
||||
$ you-get 'Micheal Jackson'
|
||||
Google Videos search:
|
||||
Best matched result:
|
||||
site: YouTube
|
||||
title: Michael Jackson - Beat It (Official Video)
|
||||
stream:
|
||||
- itag: 43
|
||||
container: webm
|
||||
quality: medium
|
||||
size: 29.4 MiB (30792050 bytes)
|
||||
# download-with: you-get --itag=43 [URL]
|
||||
|
||||
Downloading Michael Jackson - Beat It (Official Video).webm ...
|
||||
100% ( 29.4/ 29.4MB) ├███████████████████████████████████████████████████████┤[1/1] 2 MB/s
|
||||
|
||||
```
|
||||
|
||||
**Watch Videos**
|
||||
|
||||
You-Get can able to stream the online videos in your media player or browser, just without ads or comment section.
|
||||
|
||||
To watch videos in a media player, for example VLC, run the following command:
|
||||
```
|
||||
$ you-get -p vlc https://www.youtube.com/watch?v=HXaglTFJLMc
|
||||
|
||||
```
|
||||
|
||||
Or,
|
||||
```
|
||||
$ you-get --player vlc https://www.youtube.com/watch?v=HXaglTFJLMc
|
||||
|
||||
```
|
||||
|
||||
Similarly, to stream the videos in your browser, for example chromium, use:
|
||||
```
|
||||
$ you-get -p chromium https://www.youtube.com/watch?v=HXaglTFJLMc
|
||||
|
||||
```
|
||||
|
||||
![][3]
|
||||
|
||||
As you can see in the above screenshot, there is no ads, comment section. Just a plain page with the video.
|
||||
|
||||
**Set path and file name for downloaded videos**
|
||||
|
||||
By default, the videos will be downloaded in the current working directory with default video titles. You can, of course, change them as per your liking using **–output-dir/-o** flag to set the path and **–output-filename/-O** to set the name of the downloaded file.
|
||||
```
|
||||
$ you-get -o ~/Videos -O output.mp4 https://www.youtube.com/watch?v=HXaglTFJLMc
|
||||
|
||||
```
|
||||
|
||||
**Pause and resume downloads**
|
||||
|
||||
Press **CTRL+C** to cancel a download. A temporary **.download** file will be saved in the output directory. Next time you run you-get with the same arguments, the download process will resume from the last session.
|
||||
|
||||
In case the file is completely downloaded, the temporary .download extension will be gone, and you-get will just skip the download. To enforce re-downloading, use the **–force/-f** option.
|
||||
|
||||
For more details, refer the help section by running the following command.
|
||||
```
|
||||
$ you-get --help
|
||||
|
||||
```
|
||||
|
||||
And, that’s all for now. More good stuffs to come. Stay tuned!
|
||||
|
||||
Cheers!
|
||||
|
||||
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://www.ostechnix.com/you-get-a-cli-downloader-to-download-media-from-80-websites/
|
||||
|
||||
作者:[SK][a]
|
||||
选题:[lujun9972](https://github.com/lujun9972)
|
||||
译者:[译者ID](https://github.com/译者ID)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]:https://www.ostechnix.com/author/sk/
|
||||
[1]:https://you-get.org/#supported-sites
|
||||
[3]:http://www.ostechnix.com/wp-content/uploads/2018/05/you-get.jpg
|
@ -1,3 +1,5 @@
|
||||
translating---geekpi
|
||||
|
||||
How to find your IP address in Linux
|
||||
======
|
||||
![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/satellite_radio_location.jpg?itok=KJUKSB6x)
|
||||
|
@ -0,0 +1,90 @@
|
||||
How To Install Ncurses Library In Linux
|
||||
======
|
||||
![](https://www.ostechnix.com/wp-content/uploads/2018/05/install-ncurses-720x340.png)
|
||||
|
||||
**GNU Ncurses** is a programming library that allows the users to write text-based user interfaces(TUI). Many text-based games are created using this library. One popular example is [**PacVim**][1], a CLI game to learn VIM commands. In this brief guide, I will be explaining how to install Ncurses library in Unix-like operating systems.
|
||||
|
||||
### Install Ncurses Library In Linux
|
||||
|
||||
Ncurses is available in the default repositories of most Linux distributions. For instance, you can install it on Arch-based systems using the following command:
|
||||
```
|
||||
$ sudo pacman -S ncurses
|
||||
|
||||
```
|
||||
|
||||
On RHEL, CentOS:
|
||||
```
|
||||
$ sudo yum install ncurses-devel
|
||||
|
||||
```
|
||||
|
||||
On Fedora 22 and newer versions:
|
||||
```
|
||||
$ sudo dnf install ncurses-devel
|
||||
|
||||
```
|
||||
|
||||
On Debian, Ubuntu, Linux Mint:
|
||||
```
|
||||
$ sudo apt-get install libncurses5-dev libncursesw5-dev
|
||||
|
||||
```
|
||||
|
||||
The GNU ncureses might be bit old in the default repositories. If you want a most recent stable version, you can compile and install from the source as shown below.
|
||||
|
||||
Download the latest ncurses version from [**here**][2]. As of writing this guide, the latest version was 6.1.
|
||||
```
|
||||
$ wget https://ftp.gnu.org/pub/gnu/ncurses/ncurses-6.1.tar.gz
|
||||
|
||||
```
|
||||
|
||||
Extract the tar file:
|
||||
```
|
||||
$ tar xzf ncurses-6.1.tar.gz
|
||||
|
||||
```
|
||||
|
||||
This will create a folder named ncurses-6.1 in the current directory. Cd to the directory:
|
||||
```
|
||||
$ cd ncurses-6.1
|
||||
|
||||
$ ./configure --prefix=/opt/ncurses
|
||||
|
||||
```
|
||||
|
||||
Finally, compile and install using the following commands:
|
||||
```
|
||||
$ make
|
||||
|
||||
$ sudo make install
|
||||
|
||||
```
|
||||
|
||||
Verify the installation using command:
|
||||
```
|
||||
$ ls -la /opt/ncurses
|
||||
|
||||
```
|
||||
|
||||
That’s it. Ncurses have been installed on the Linux distribution. Go ahead and create your nice looking TUIs using Ncurses.
|
||||
|
||||
More good stuffs to come. Stay tuned!
|
||||
|
||||
Cheers!
|
||||
|
||||
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://www.ostechnix.com/how-to-install-ncurses-library-in-linux/
|
||||
|
||||
作者:[SK][a]
|
||||
选题:[lujun9972](https://github.com/lujun9972)
|
||||
译者:[译者ID](https://github.com/译者ID)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]:https://www.ostechnix.com/author/sk/
|
||||
[1]:https://www.ostechnix.com/pacvim-a-cli-game-to-learn-vim-commands/
|
||||
[2]:https://ftp.gnu.org/pub/gnu/ncurses/
|
145
sources/tech/20180518 How to Manage Fonts in Linux.md
Normal file
145
sources/tech/20180518 How to Manage Fonts in Linux.md
Normal file
@ -0,0 +1,145 @@
|
||||
How to Manage Fonts in Linux
|
||||
======
|
||||
|
||||
![](https://www.linux.com/sites/lcom/files/styles/rendered_file/public/fonts_main.jpg?itok=qcJks7-c)
|
||||
|
||||
Not only do I write technical documentation, I write novels. And because I’m comfortable with tools like GIMP, I also create my own book covers (and do graphic design for a few clients). That artistic endeavor depends upon a lot of pieces falling into place, including fonts.
|
||||
|
||||
Although font rendering has come a long way over the past few years, it continues to be an issue in Linux. If you compare the look of the same fonts on Linux vs. macOS, the difference is stark. This is especially true when you’re staring at a screen all day. But even though the rendering of fonts has yet to find perfection in Linux, one thing that the open source platform does well is allow users to easily manage their fonts. From selecting, adding, scaling, and adjusting, you can work with fonts fairly easily in Linux.
|
||||
|
||||
Here, I’ll share some of the tips I’ve depended on over the years to help extend my “font-ability” in Linux. These tips will especially help those who undertake artistic endeavors on the open source platform. Because there are so many desktop interfaces available for Linux (each of which deal with fonts in a different way), when a desktop environment becomes central to the management of fonts, I’ll be focusing primarily on GNOME and KDE.
|
||||
|
||||
With that said, let’s get to work.
|
||||
|
||||
### Adding new fonts
|
||||
|
||||
For the longest time, I have been a collector of fonts. Some might say I have a bit of an obsession. And since my early days of using Linux, I’ve always used the same process for adding fonts to my desktops. There are two ways to do this:
|
||||
|
||||
* Make the fonts available on a per-user basis.
|
||||
|
||||
* Make the fonts available system-wide.
|
||||
|
||||
|
||||
|
||||
|
||||
Because my desktops never have other users (besides myself), I only ever work with fonts on a per-user basis. However, I will show you how to do both. First, let’s see how to add fonts on a per-user basis. The first thing you must do is find fonts. Both True Type Fonts (TTF) and Open Type Fonts (OTF) can be added. I add fonts manually. Do this is, I create a new hidden directory in ~/ called ~/.fonts. This can be done with the command:
|
||||
```
|
||||
mkdir ~/.fonts
|
||||
|
||||
```
|
||||
|
||||
With that folder created, I then move all of my TTF and OTF files into the directory. That’s it. Every font you add into that directory will now be available for use to your installed apps. But remember, those fonts will only be available to that one user.
|
||||
|
||||
If you want to make that collection of fonts available to all, here’s what you do:
|
||||
|
||||
1. Open up a terminal window.
|
||||
|
||||
2. Change into the directory housing all of your fonts.
|
||||
|
||||
3. Copy all of those fonts with the commands sudo cp *.ttf *.TTF /usr/share/fonts/truetype/ and sudo cp *.otf *.OTF /usr/share/fonts/opentype
|
||||
|
||||
|
||||
|
||||
|
||||
The next time a user logs in, they’ll have access to all those glorious fonts.
|
||||
|
||||
### GUI Font Managers
|
||||
|
||||
There are a few ways to manage your fonts in Linux, via GUI. How it’s done will depend on your desktop environment. Let’s examine KDE first. With the KDE that ships with Kubuntu 18.04, you’ll find a Font Management tool pre-installed. Open that tool and you can easily add, remove, enable, and disable fonts (as well as get information about all of the installed fonts. This tool also makes it easy for you to add and remove fonts for personal and system-wide use. Let’s say you want to add a particular font for personal usage. To do this, download your font and then open up the Font Management tool. In this tool (Figure 1), click on Personal Fonts and then click the + Add button.
|
||||
|
||||
|
||||
![adding fonts][2]
|
||||
|
||||
Figure 1: Adding personal fonts in KDE.
|
||||
|
||||
[Used with permission][3]
|
||||
|
||||
Navigate to the location of your fonts, select them, and click Open. Your fonts will then be added to the Personal section and are immediately available for you to use (Figure 2).
|
||||
|
||||
|
||||
![KDE Font Manager][5]
|
||||
|
||||
Figure 2: Fonts added with the KDE Font Manager.
|
||||
|
||||
[Used with permission][3]
|
||||
|
||||
To do the same thing in GNOME requires the installation of an application. Open up either GNOME Software or Ubuntu Software (depending upon the distribution you’re using) and search for Font Manager. Select Font Manager and then click the Install button. Once the software is installed, launch it from the desktop menu. With the tool open, let’s install fonts on a per-user basis. Here’s how:
|
||||
|
||||
1. Select User from the left pane (Figure 3).
|
||||
|
||||
2. Click the + button at the top of the window.
|
||||
|
||||
3. Navigate to and select the downloaded fonts.
|
||||
|
||||
4. Click Open.
|
||||
|
||||
|
||||
|
||||
|
||||
![Adding fonts ][7]
|
||||
|
||||
Figure 3: Adding fonts in GNOME.
|
||||
|
||||
[Used with permission][3]
|
||||
|
||||
### Tweaking fonts
|
||||
|
||||
There are three concepts you must first understand:
|
||||
|
||||
* **Font Hinting:** The use of mathematical instructions to adjust the display of a font outline so that it lines up with a rasterized grid.
|
||||
|
||||
* **Anti-aliasing:** The technique used to add greater realism to a digital image by smoothing jagged edges on curved lines and diagonals.
|
||||
|
||||
* **Scaling factor:** **** A scalable unit that allows you to multiple the point size of a font. So if you’re font is 12pt and you have an scaling factor of 1, the font size will be 12pt. If your scaling factor is 2, the font size will be 24pt.
|
||||
|
||||
|
||||
|
||||
|
||||
Let’s say you’ve installed your fonts, but they don’t look quite as good as you’d like. How do you tweak the appearance of fonts? In both the KDE and GNOME desktops, you can make a few adjustments. One thing to consider with the tweaking of fonts is that taste is very much subjective. You might find yourself having to continually tweak until you get the fonts looking exactly how you like (dictated by your needs and particular taste). Let’s first look at KDE.
|
||||
|
||||
Open up the System Settings tool and clock on Fonts. In this section, you can not only change various fonts, you can also enable and configure both anti-aliasing and enable font scaling factor (Figure 4).
|
||||
|
||||
|
||||
![Configuring fonts][9]
|
||||
|
||||
Figure 4: Configuring fonts in KDE.
|
||||
|
||||
[Used with permission][3]
|
||||
|
||||
To configure anti-aliasing, select Enabled from the drop-down and then click Configure. In the resulting window (Figure 5), you can configure an exclude range, sub-pixel rendering type, and hinting style.
|
||||
|
||||
Once you’ve made your changes, click Apply. Restart any running applications and the new settings will take effect.
|
||||
|
||||
To do this in GNOME, you have to have either use Font Manager or GNOME Tweaks installed. For this, GNOME Tweaks is the better tool. If you open the GNOME Dash and cannot find Tweaks installed, open GNOME Software (or Ubuntu Software), and install GNOME Tweaks. Once installed, open it and click on the Fonts section. Here you can configure hinting, anti-aliasing, and scaling factor (Figure 6).
|
||||
|
||||
![Tweaking fonts][11]
|
||||
|
||||
Figure 6: Tweaking fonts in GNOME.
|
||||
|
||||
[Used with permission][3]
|
||||
|
||||
### Make your fonts beautiful
|
||||
|
||||
And that’s the gist of making your fonts look as beautiful as possible in Linux. You may not see a macOS-like rendering of fonts, but you can certainly improve the look. Finally, the fonts you choose will have a large impact on how things look. Make sure you’re installing clean, well-designed fonts; otherwise, you’re fighting a losing battle.
|
||||
|
||||
Learn more about Linux through the free ["Introduction to Linux" ][12] course from The Linux Foundation and edX.
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://www.linux.com/learn/intro-to-linux/2018/5/how-manage-fonts-linux
|
||||
|
||||
作者:[Jack Wallen][a]
|
||||
选题:[lujun9972](https://github.com/lujun9972)
|
||||
译者:[译者ID](https://github.com/译者ID)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]:https://www.linux.com/users/jlwallen
|
||||
[2]:https://www.linux.com/sites/lcom/files/styles/rendered_file/public/fonts_1.jpg?itok=7yTTe6o3 (adding fonts)
|
||||
[3]:https://www.linux.com/licenses/category/used-permission
|
||||
[5]:https://www.linux.com/sites/lcom/files/styles/rendered_file/public/fonts_2.jpg?itok=_g0dyVYq (KDE Font Manager)
|
||||
[7]:https://www.linux.com/sites/lcom/files/styles/rendered_file/public/fonts_3.jpg?itok=8o884QKs (Adding fonts )
|
||||
[9]:https://www.linux.com/sites/lcom/files/styles/rendered_file/public/fonts_4.jpg?itok=QJpPzFED (Configuring fonts)
|
||||
[11]:https://www.linux.com/sites/lcom/files/styles/rendered_file/public/fonts_6.jpg?itok=4cQeIW9C (Tweaking fonts)
|
||||
[12]:https://training.linuxfoundation.org/linux-courses/system-administration-training/introduction-to-linux
|
@ -0,0 +1,275 @@
|
||||
What's a hero without a villain? How to add one to your Python game
|
||||
======
|
||||
![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/game-dogs-chess-play-lead.png?itok=NAuhav4Z)
|
||||
|
||||
In the previous articles in this series (see [part 1][1], [part 2][2], [part 3][3], and [part 4][4]), you learned how to use Pygame and Python to spawn a playable character in an as-yet empty video game world. But, what's a hero without a villain?
|
||||
|
||||
It would make for a pretty boring game if you had no enemies, so in this article, you'll add an enemy to your game and construct a framework for building levels.
|
||||
|
||||
It might seem strange to jump ahead to enemies when there's still more to be done to make the player sprite fully functional, but you've learned a lot already, and creating villains is very similar to creating a player sprite. So relax, use the knowledge you already have, and see what it takes to stir up some trouble.
|
||||
|
||||
For this exercise, you can download some pre-built assets from [Open Game Art][5]. Here are some of the assets I use:
|
||||
|
||||
|
||||
+ Inca tileset
|
||||
+ Some invaders
|
||||
+ Sprites, characters, objects, and effects
|
||||
|
||||
|
||||
### Creating the enemy sprite
|
||||
|
||||
Yes, whether you realize it or not, you basically already know how to implement enemies. The process is very similar to creating a player sprite:
|
||||
|
||||
1. Make a class so enemies can spawn.
|
||||
2. Create an `update` function so enemies can detect collisions.
|
||||
3. Create a `move` function so your enemy can roam around.
|
||||
|
||||
|
||||
|
||||
Start with the class. Conceptually, it's mostly the same as your Player class. You set an image or series of images, and you set the sprite's starting position.
|
||||
|
||||
Before continuing, make sure you have a graphic for your enemy, even if it's just a temporary one. Place the graphic in your game project's `images` directory (the same directory where you placed your player image).
|
||||
|
||||
A game looks a lot better if everything alive is animated. Animating an enemy sprite is done the same way as animating a player sprite. For now, though, keep it simple, and use a non-animated sprite.
|
||||
|
||||
At the top of the `objects` section of your code, create a class called Enemy with this code:
|
||||
```
|
||||
class Enemy(pygame.sprite.Sprite):
|
||||
|
||||
'''
|
||||
|
||||
Spawn an enemy
|
||||
|
||||
'''
|
||||
|
||||
def __init__(self,x,y,img):
|
||||
|
||||
pygame.sprite.Sprite.__init__(self)
|
||||
|
||||
self.image = pygame.image.load(os.path.join('images',img))
|
||||
|
||||
self.image.convert_alpha()
|
||||
|
||||
self.image.set_colorkey(ALPHA)
|
||||
|
||||
self.rect = self.image.get_rect()
|
||||
|
||||
self.rect.x = x
|
||||
|
||||
self.rect.y = y
|
||||
|
||||
```
|
||||
|
||||
If you want to animate your enemy, do it the [same way][4] you animated your player.
|
||||
|
||||
### Spawning an enemy
|
||||
|
||||
You can make the class useful for spawning more than just one enemy by allowing yourself to tell the class which image to use for the sprite and where in the world the sprite should appear. This means you can use this same enemy class to generate any number of enemy sprites anywhere in the game world. All you have to do is make a call to the class, and tell it which image to use and the X and Y coordinates of your desired spawn point.
|
||||
|
||||
Again, this is similar in principle to spawning a player sprite. In the `setup` section of your script, add this code:
|
||||
```
|
||||
enemy = Enemy(20,200,'yeti.png')# spawn enemy
|
||||
|
||||
enemy_list = pygame.sprite.Group() # create enemy group
|
||||
|
||||
enemy_list.add(enemy) # add enemy to group
|
||||
|
||||
```
|
||||
|
||||
In that sample code, `20` is the X position and `200` is the Y position. You might need to adjust these numbers, depending on how big your enemy sprite is, but try to get it to spawn in a place so that you can reach it with your player sprite. `Yeti.png` is the image used for the enemy.
|
||||
|
||||
Next, draw all enemies in the enemy group to the screen. Right now, you have only one enemy, but you can add more later if you want. As long as you add an enemy to the enemies group, it will be drawn to the screen during the main loop. The middle line is the new line you need to add:
|
||||
```
|
||||
player_list.draw(world)
|
||||
|
||||
enemy_list.draw(world) # refresh enemies
|
||||
|
||||
pygame.display.flip()
|
||||
|
||||
```
|
||||
|
||||
Launch your game. Your enemy appears in the game world at whatever X and Y coordinate you chose.
|
||||
|
||||
### Level one
|
||||
|
||||
Your game is in its infancy, but you will probably want to add another level. It's important to plan ahead when you program so your game can grow as you learn more about programming. Even though you don't even have one complete level yet, you should code as if you plan on having many levels.
|
||||
|
||||
Think about what a "level" is. How do you know you are at a certain level in a game?
|
||||
|
||||
You can think of a level as a collection of items. In a platformer, such as the one you are building here, a level consists of a specific arrangement of platforms, placement of enemies and loot, and so on. You can build a class that builds a level around your player. Eventually, when you create more than one level, you can use this class to generate the next level when your player reaches a specific goal.
|
||||
|
||||
Move the code you wrote to create an enemy and its group into a new function that will be called along with each new level. It requires some modification so that each time you create a new level, you can create several enemies:
|
||||
```
|
||||
class Level():
|
||||
|
||||
def bad(lvl,eloc):
|
||||
|
||||
if lvl == 1:
|
||||
|
||||
enemy = Enemy(eloc[0],eloc[1],'yeti.png') # spawn enemy
|
||||
|
||||
enemy_list = pygame.sprite.Group() # create enemy group
|
||||
|
||||
enemy_list.add(enemy) # add enemy to group
|
||||
|
||||
if lvl == 2:
|
||||
|
||||
print("Level " + str(lvl) )
|
||||
|
||||
|
||||
|
||||
return enemy_list
|
||||
|
||||
```
|
||||
|
||||
The `return` statement ensures that when you use the `Level.bad` function, you're left with an `enemy_list` containing each enemy you defined.
|
||||
|
||||
Since you are creating enemies as part of each level now, your `setup` section needs to change, too. Instead of creating an enemy, you must define where the enemy will spawn and what level it belongs to.
|
||||
```
|
||||
eloc = []
|
||||
|
||||
eloc = [200,20]
|
||||
|
||||
enemy_list = Level.bad( 1, eloc )
|
||||
|
||||
```
|
||||
|
||||
Run the game again to confirm your level is generating correctly. You should see your player, as usual, and the enemy you added in this chapter.
|
||||
|
||||
### Hitting the enemy
|
||||
|
||||
An enemy isn't much of an enemy if it has no effect on the player. It's common for enemies to cause damage when a player collides with them.
|
||||
|
||||
Since you probably want to track the player's health, the collision check happens in the Player class rather than in the Enemy class. You can track the enemy's health, too, if you want. The logic and code are pretty much the same, but, for now, just track the player's health.
|
||||
|
||||
To track player health, you must first establish a variable for the player's health. The first line in this code sample is for context, so add the second line to your Player class:
|
||||
```
|
||||
self.frame = 0
|
||||
|
||||
self.health = 10
|
||||
|
||||
```
|
||||
|
||||
In the `update` function of your Player class, add this code block:
|
||||
```
|
||||
hit_list = pygame.sprite.spritecollide(self, enemy_list, False)
|
||||
|
||||
for enemy in hit_list:
|
||||
|
||||
self.health -= 1
|
||||
|
||||
print(self.health)
|
||||
|
||||
```
|
||||
|
||||
This code establishes a collision detector using the Pygame function `sprite.spritecollide`, called `enemy_hit`. This collision detector sends out a signal any time the hitbox of its parent sprite (the player sprite, where this detector has been created) touches the hitbox of any sprite in `enemy_list`. The `for` loop is triggered when such a signal is received and deducts a point from the player's health.
|
||||
|
||||
Since this code appears in the `update` function of your player class and `update` is called in your main loop, Pygame checks for this collision once every clock tick.
|
||||
|
||||
### Moving the enemy
|
||||
|
||||
An enemy that stands still is useful if you want, for instance, spikes or traps that can harm your player, but the game is more of a challenge if the enemies move around a little.
|
||||
|
||||
Unlike a player sprite, the enemy sprite is not controlled by the user. Its movements must be automated.
|
||||
|
||||
Eventually, your game world will scroll, so how do you get an enemy to move back and forth within the game world when the game world itself is moving?
|
||||
|
||||
You tell your enemy sprite to take, for example, 10 paces to the right, then 10 paces to the left. An enemy sprite can't count, so you have to create a variable to keep track of how many paces your enemy has moved and program your enemy to move either right or left depending on the value of your counting variable.
|
||||
|
||||
First, create the counter variable in your Enemy class. Add the last line in this code sample:
|
||||
```
|
||||
self.rect = self.image.get_rect()
|
||||
|
||||
self.rect.x = x
|
||||
|
||||
self.rect.y = y
|
||||
|
||||
self.counter = 0 # counter variable
|
||||
|
||||
```
|
||||
|
||||
Next, create a `move` function in your Enemy class. Use an if-else loop to create what is called an infinite loop:
|
||||
|
||||
* Move right if the counter is on any number from 0 to 100.
|
||||
* Move left if the counter is on any number from 100 to 200.
|
||||
* Reset the counter back to 0 if the counter is greater than 200.
|
||||
|
||||
|
||||
|
||||
An infinite loop has no end; it loops forever because nothing in the loop is ever untrue. The counter, in this case, is always either between 0 and 100 or 100 and 200, so the enemy sprite walks right to left and right to left forever.
|
||||
|
||||
The actual numbers you use for how far the enemy will move in either direction depending on your screen size, and possibly, eventually, the size of the platform your enemy is walking on. Start small and work your way up as you get used to the results. Try this first:
|
||||
```
|
||||
def move(self):
|
||||
|
||||
'''
|
||||
|
||||
enemy movement
|
||||
|
||||
'''
|
||||
|
||||
distance = 80
|
||||
|
||||
speed = 8
|
||||
|
||||
|
||||
|
||||
if self.counter >= 0 and self.counter <= distance:
|
||||
|
||||
self.rect.x += speed
|
||||
|
||||
elif self.counter >= distance and self.counter <= distance*2:
|
||||
|
||||
self.rect.x -= speed
|
||||
|
||||
else:
|
||||
|
||||
self.counter = 0
|
||||
|
||||
|
||||
|
||||
self.counter += 1
|
||||
|
||||
```
|
||||
|
||||
You can adjust the distance and speed as needed.
|
||||
|
||||
Will this code work if you launch your game now?
|
||||
|
||||
Of course not, and you probably know why. You must call the `move` function in your main loop. The first line in this sample code is for context, so add the last two lines:
|
||||
```
|
||||
enemy_list.draw(world) #refresh enemy
|
||||
|
||||
for e in enemy_list:
|
||||
|
||||
e.move()
|
||||
|
||||
```
|
||||
|
||||
Launch your game and see what happens when you hit your enemy. You might have to adjust where the sprites spawn so that your player and your enemy sprite can collide. When they do collide, look in the console of [IDLE][6] or [Ninja-IDE][7] to see the health points being deducted.
|
||||
|
||||
![](https://opensource.com/sites/default/files/styles/panopoly_image_original/public/u128651/yeti.png?itok=4_GsDGor)
|
||||
|
||||
You may notice that health is deducted for every moment your player and enemy are touching. That's a problem, but it's a problem you'll solve later, after you've had more practice with Python.
|
||||
|
||||
For now, try adding some more enemies. Remember to add each enemy to the `enemy_list`. As an exercise, see if you can think of how you can change how far different enemy sprites move.
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://opensource.com/article/18/5/pygame-enemy
|
||||
|
||||
作者:[Seth Kenlon][a]
|
||||
选题:[lujun9972](https://github.com/lujun9972)
|
||||
译者:[译者ID](https://github.com/译者ID)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]: https://opensource.com/users/seth
|
||||
[1]:https://opensource.com/article/17/10/python-101
|
||||
[2]:https://opensource.com/article/17/12/game-framework-python
|
||||
[3]:https://opensource.com/article/17/12/game-python-add-a-player
|
||||
[4]:https://opensource.com/article/17/12/game-python-moving-player
|
||||
[5]:https://opengameart.org
|
||||
[6]:https://docs.python.org/3/library/idle.html
|
||||
[7]:http://ninja-ide.org/
|
82
sources/tech/20180521 Starting user software in X.md
Normal file
82
sources/tech/20180521 Starting user software in X.md
Normal file
@ -0,0 +1,82 @@
|
||||
translating---geekpi
|
||||
|
||||
Starting user software in X
|
||||
======
|
||||
|
||||
There are currently many ways of starting software when a user session starts.
|
||||
|
||||
This is an attempt to collect a list of pointers to piece the big picture together. It's partial and some parts might be imprecise or incorrect, but it's a start, and I'm happy to keep it updated if I receive corrections.
|
||||
|
||||
### x11-common
|
||||
|
||||
`man xsession`
|
||||
|
||||
* Started by the display manager for example, `/usr/share/lightdm/lightdm.conf.d/01_debian.conf` or `/etc/gdm3/Xsession`
|
||||
* Debian specific
|
||||
* Runs scripts in `/etc/X11/Xsession.d/`
|
||||
* `/etc/X11/Xsession.d/40x11-common_xsessionrc` sources `~/.xsessionrc` which can do little more than set env vars, because it is run at the beginning of X session startup
|
||||
* At the end, it starts the session manager (`gnome-session`, `xfce4-session`, and so on)
|
||||
|
||||
|
||||
|
||||
### systemd --user
|
||||
|
||||
* <https://wiki.archlinux.org/index.php/Systemd/User>
|
||||
* Started by `pam_systemd`, so it might not have a DISPLAY variable set in the environment yet
|
||||
* Manages units in:
|
||||
* `/usr/lib/systemd/user/` where units provided by installed packages belong.
|
||||
* `~/.local/share/systemd/user/` where units of packages that have been installed in the home directory belong.
|
||||
* `/etc/systemd/user/` where system-wide user units are placed by the system administrator.
|
||||
* `~/.config/systemd/user/` where the users put their own units.
|
||||
* A trick to start a systemd user unit when the X session has been set up and the DISPLAY variable is available, is to call `systemctl start` from a `.desktop` autostart file.
|
||||
|
||||
|
||||
|
||||
### dbus activation
|
||||
|
||||
* <https://dbus.freedesktop.org/doc/system-activation.txt>
|
||||
* A user process making a dbus request can trigger starting a server program
|
||||
* For systems debugging, is there a way of monitoring what services are getting dbus activated?
|
||||
|
||||
|
||||
|
||||
### X session manager
|
||||
|
||||
* <https://en.wikipedia.org/wiki/X_session_manager>
|
||||
* Run by `x11-common`'s `Xsession.d`
|
||||
* Runs freedesktop autostart .desktop files
|
||||
* Runs Desktop Environment specific software
|
||||
|
||||
|
||||
|
||||
### xdg autostart
|
||||
|
||||
* <https://specifications.freedesktop.org/autostart-spec/autostart-spec-latest.html>
|
||||
* Run by the session manager
|
||||
* If `/etc/xdg/autostart/foo.desktop` and `~/.config/autostart/foo.desktop` exist then only the file `~/.config/autostart/foo.desktop` will be used because `~/.config/autostart/` is more important than `/etc/xdg/autostart/`
|
||||
* Is there an ordering or is it all in parallel?
|
||||
|
||||
|
||||
|
||||
### Other startup notes
|
||||
|
||||
#### ~/.Xauthority
|
||||
|
||||
To connect to an X server, a client needs to send a token from `~/.Xauthority`, which proves that they can read the user's provate data.
|
||||
|
||||
`~/.Xauthority` contains a token generated by display manager and communicated to X at startup.
|
||||
|
||||
To view its contents, use `xauth -i -f ~/.Xauthority list`
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: http://www.enricozini.org/blog/2018/debian/starting-user-software/
|
||||
|
||||
作者:[Enrico Zini][a]
|
||||
选题:[lujun9972](https://github.com/lujun9972)
|
||||
译者:[译者ID](https://github.com/译者ID)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]:http://www.enricozini.org/
|
95
translated/talk/20180128 Being open about data privacy.md
Normal file
95
translated/talk/20180128 Being open about data privacy.md
Normal file
@ -0,0 +1,95 @@
|
||||
对数据隐私持开放的态度
|
||||
======
|
||||
![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/GOV_opendata.png?itok=M8L2HGVx)
|
||||
|
||||
|
||||
Image by : opensource.com
|
||||
|
||||
今天是[数据隐私日][1],(在欧洲叫"数据保护日"),你可能会认为现在我们处于一个开源的世界中,所有的数据都应该免费,[就像人们想的那样][2],但是现实并没那么简单。主要有两个原因:
|
||||
1. 我们中的大多数(不仅仅是在开源中)认为至少有些关于我们自己的数据是不愿意分享出去的(我在之前发表的一篇文章中列举了一些列子[3])
|
||||
2. 我们很多人虽然在开源中工作,但事实上是为了一些商业公司或者其他一些组织工作,也是在合法的要求范围内分享数据。
|
||||
|
||||
所以实际上,数据隐私对于每个人来说是很重要的。
|
||||
|
||||
事实证明,在美国和欧洲之间,人们和政府认为让组织使用的数据的起点是有些不同的。前者通常为实体提供更多的自由度,更愤世嫉俗的是--大型的商业体利用他们收集到的关于我们的数据。在欧洲,完全是另一观念,一直以来持有的多是有更多约束限制的观念,而且在5月25日,欧洲的观点可以说取得了胜利。
|
||||
|
||||
## 通用数据保护条例的影响
|
||||
|
||||
那是一个相当全面的声明,其实事实上就是欧盟在2016年通过的一项关于通用数据保护的立法,使它变得可实施。数据通用保护条例在私人数据怎样才能被保存,如何才能被使用,谁能使用,能被持有多长时间这些方面设置了严格的规则。它描述了什么数据属于私人数据--而且涉及的条目范围非常广泛,从你的姓名家庭住址到你的医疗记录以及接通你电脑的IP地址。
|
||||
|
||||
通用数据保护条例的重要之处是他并不仅仅适用于欧洲的公司,如果你是阿根廷人,日本人,美国人或者是俄罗斯的公司而且你正在收集涉及到欧盟居民的数据,你就要受到这个条例的约束管辖。
|
||||
|
||||
“哼!” 你可能会这样说,“我的业务不在欧洲:他们能对我有啥约束?” 答案很简答:如果你想继续在欧盟做任何生意,你最好遵守,因为一旦你违反了通用数据保护条例的规则,你将会受到你全球总收入百分之四的惩罚。是的,你没听错,是全球总收入不是仅仅在欧盟某一国家的的收入,也不只是净利润,而是全球总收入。这将会让你去叮嘱告知你的法律团队,他们就会知会你的整个团队,同时也会立即去指引你的IT团队,确保你的行为相当短的时间内是符合要求的。
|
||||
|
||||
看上去这和欧盟之外的城市没有什么相关性,但其实不然,对大多数公司来说,对所有的他们的顾客、合作伙伴以及员工实行同样的数据保护措施是件既简单又有效的事情,而不是只是在欧盟的城市实施,这将会是一件很有利的事情。2
|
||||
|
||||
然而,数据通用保护条例不久将在全球实施并不意味着一切都会变的很美好:事实并非如此,我们一直在丢弃关于我们自己的信息--而且允许公司去使用它。
|
||||
|
||||
有一句话是这么说的(尽管很争议):“如果你没有在付费,那么你就是产品。”这句话的意思就是如果你没有为某一项服务付费,那么其他的人就在付费使用你的数据。
|
||||
你有付费使用Facebook、推特?谷歌邮箱?你觉得他们是如何赚钱的?大部分是通过广告,一些人会争论那是他们向你提供的一项服务而已,但事实上是他们在利用你的数据从广告商里获取收益。你不是一个真正的广告的顾客-只有当你从看了广告后买了他们的商品之后你才变成了他们的顾客,但直到这个发生之前,都是广告平台和广告商的关系。
|
||||
|
||||
有些服务是允许你通过付费来消除广告的(流媒体音乐平台声破天就是这样的),但从另一方面来讲,即使你认为付费的服务也可以启用广告(列如,亚马逊正在允许通过Alexa广告)除非我们想要开始为这些所有的免费服务付费,我们需要清除我们所放弃的,而且在我们想要揭发和不想的里面做一些选择。
|
||||
|
||||
### 谁是顾客?
|
||||
|
||||
关于数据的另一个问题一直在困扰着我们,它是产生的数据量的直接结果。有许多组织一直在产生巨量的数据,包括公共的组织比如大学、医院或者是政府部门4--
|
||||
而且他们没有能力去储存这些数据。如果这些数据没有长久的价值也就没什么要紧的,但事实正好相反,随着处理大数据的工具正在开发中,而且这些组织也认识到他们现在以及在不久的将来将能够去开采这些数据。
|
||||
|
||||
然而他们面临的是,随着数据的增长和存储量的不足他们是如何处理的。幸运--而且我是带有讽刺意味的使用了这个词,5大公司正在介入去帮助他们。“把你们的数据给我们,”他们说,“我们将免费保存。我们甚至让你随时能够使用你所收集到的数据!”这听起来很棒,是吗?这是大公司的一个极具代表性的列子,站在慈善的立场上帮助公共组织管理他们收集到的关于我们的数据。
|
||||
|
||||
不幸的是,慈善不是唯一的理由。他们是附有条件的:作为同意保存数据的交换条件,这些公司得到了将数据访问权限出售非第三方的权利。你认为公共组织,或者是被收集数据的人在数据被出售使用权使给第三方在他们如何使用上面能有发言权吗?我将把这个问题当做一个练习留给读者去思考。7
|
||||
|
||||
### 开放和积极
|
||||
|
||||
然而并不只有坏消息。政府中有一项在逐渐发展起来的“开放数据”运动鼓励部门能够将免费开放他们的数据给公众或者其他组织。这项行动目前正在被实施立法。许多
|
||||
支援组织--尤其是那些收到公共基金的--正在开始推动同样的活动。即使商业组织也有些许的兴趣。而且,在技术上已经可行了,例如围绕不同的隐私和多方计算上,正在允许我们根据数据设置和不揭露太多关于个人的前提下开采数据--一个历史性的计算问题比你想象的要容易处理的多。
|
||||
|
||||
这些对我们来说意味着什么呢?我之前在网站Opensource.com上写过关于[开源的共享福利][4],而且我越来越相信我们需要把我们的视野从软件拓展到其他区域:硬件,组织,和这次讨论有关的,数据。让我们假设一下你是A公司要提向另一家公司提供一项服务,客户B。在游戏中有四种不同类型的数据:
|
||||
1. 数据完全开放:对A和B都是可得到的,世界上任何人都可以得到
|
||||
2. 数据是已知的,共享的,和机密的:A和B可得到,但其他人不能得到。
|
||||
3. 数据是公司级别上保密的:A公司可以得到,但B顾客不能
|
||||
4. 数据是顾客级别保密的:B顾客可以得到,但A公司不能
|
||||
|
||||
首先,也许我们对数据应该更开放些,将数据默认放到选项一中。如果那些数据对所有人开放--在无人驾驶、语音识别,矿藏以及人口数据统计会有相当大的作用的,9
|
||||
如果我们能够找到方法将数据放到选项2,3和4中,不是很好嘛--或者至少它们中的一些--在选项一中是可以实现的,同时仍将细节保密?这就是研究这些新技术的希望。
|
||||
然而又很长的路要走,所以不要太兴奋,同时,开始考虑将你的的一些数据默认开放。
|
||||
|
||||
### 一些具体的措施
|
||||
|
||||
我们如何处理数据的隐私和开放?下面是我想到的一些具体的措施:欢迎大家评论做出更多的贡献。
|
||||
* 检查你的组织是否正在认真严格的执行通用数据保护条例。如果没有,去推动实施它。
|
||||
* 要默认去加密敏感数据(或者适当的时候用散列算法),当不再需要的时候及时删掉--除非数据正在被处理使用否则没有任何借口让数据清晰可见。
|
||||
* 当你注册一个服务的时候考虑一下你公开了什么信息,特别是社交媒体类的。
|
||||
* 和你的非技术朋友讨论这个话题。
|
||||
* 教育你的孩子,你朋友的孩子以及他们的朋友。然而最好是去他们的学校和他们的老师交谈在他们的学校中展示。
|
||||
* 鼓励你工作志愿服务的组织,或者和他们互动推动数据的默认开放。不是去思考为什么我要使数据开放而是以我为什么不让数据开放开始。
|
||||
* 尝试去访问一些开源数据。开采使用它。开发应用来使用它,进行数据分析,画漂亮的图,10 制作有趣的音乐,考虑使用它来做些事。告诉组织去使用它们,感谢它们,而且鼓励他们去做更多。
|
||||
|
||||
|
||||
|
||||
1. 我承认你可能尽管不会
|
||||
2. 假设你坚信你的个人数据应该被保护。
|
||||
3. 如果你在思考“极好的”的寓意,在这点上你并不孤独。
|
||||
4. 事实上这些机构能够有多开放取决于你所居住的地方。
|
||||
5. 假设我是英国人,那是非常非常大的剂量。
|
||||
6. 他们可能是巨大的公司:没有其他人能够负担得起这么大的存储和基础架构来使数据保持可用。
|
||||
7. 不,答案是“不”。
|
||||
8. 尽管这个列子也同样适用于个人。看看:A可能是Alice,B 可能是BOb...
|
||||
9. 并不是说我们应该暴露个人的数据或者是这样的数据应该被保密,当然--不是那类的数据。
|
||||
10. 我的一个朋友当她接孩子放学的时候总是下雨,所以为了避免确认失误,她在整个学年都访问天气信息并制作了图表分享到社交媒体上。
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://opensource.com/article/18/1/being-open-about-data-privacy
|
||||
|
||||
作者:[Mike Bursell][a]
|
||||
译者:[译者ID](https://github.com/译者ID)
|
||||
校对:[校对者FelixYFZ](https://github.com/FelixYFZ)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]:https://opensource.com/users/mikecamel
|
||||
[1]:https://en.wikipedia.org/wiki/Data_Privacy_Day
|
||||
[2]:https://en.wikipedia.org/wiki/Information_wants_to_be_free
|
||||
[3]:https://aliceevebob.wordpress.com/2017/06/06/helping-our-governments-differently/
|
||||
[4]:https://opensource.com/article/17/11/commonwealth-open-source
|
||||
[5]:http://www.outpost9.com/reference/jargon/jargon_40.html#TAG2036
|
@ -1,72 +1,71 @@
|
||||
用 Ansible 实现网络自动化
|
||||
================
|
||||
|
||||
> 了解 Ansible 的功能,这是一个无代理的、可扩展的配置管理系统。
|
||||
|
||||
### 网络自动化
|
||||
|
||||
随着 IT 行业的技术变化,从服务器虚拟化到公有和私有云,以及自服务能力、容器化应用、平台即服务(Paas)交付,一直以来落后的一个领域是网络。
|
||||
随着 IT 行业的技术变化,从服务器虚拟化到公有云和私有云,以及自服务能力、容器化应用、平台即服务(PaaS)交付,有一直以来落后的一个领域就是网络。
|
||||
|
||||
在过去的五年多,网络行业似乎有很多新的趋势出现,它们中的很多被归入到软件定义网络(SDN)。
|
||||
|
||||
>注意
|
||||
|
||||
> SDN 是新出现的一种构建、管理、操作和部署网络的方法。SDN 最初的定义是需要将控制层和数据层(包转发)物理分离,并且,解耦合的控制层必须管理好各自的设备。
|
||||
> SDN 是新出现的一种构建、管理、操作和部署网络的方法。SDN 最初的定义是出于将控制层和数据层(包转发)物理分离的需要,并且,解耦合的控制层必须管理好各自的设备。
|
||||
|
||||
> 如今,_在 SDN_ 旗下已经有许多技术,包括基于<ruby>控制器的网络<rt>controller-based networks</rt></ruby>、网络设备上的 API、网络自动化、白盒交换机、策略网络化、网络功能虚拟化(NFV)等等。
|
||||
> 如今,在 SDN 旗下已经有许多技术,包括<ruby>基于控制器的网络<rt>controller-based networks</rt></ruby>、网络设备上的 API、网络自动化、白盒交换机、策略网络化、网络功能虚拟化(NFV)等等。
|
||||
|
||||
> 由于这篇报告的目的,我们参考 SDN 的解决方案作为我们的解决方案,其中包括一个网络控制器作为解决方案的一部分,并且提升了该网络的可管理性,但并不需要从数据层解耦控制层。
|
||||
|
||||
这些趋势的之一是,网络设备的 API 作为管理和操作这些设备的一种方法而出现,真正地提供了机器对机器的通讯。当需要自动化和构建网络应用时 API 简化了开发过程,在数据如何建模时提供了更多结构。例如,当启用 API 的设备在 JSON/XML 中返回数据时,它是结构化的,并且比返回原生文本信息、需要手工去解析的仅支持命令行的设备更易于使用。
|
||||
这些趋势的之一是,网络设备的 API 作为管理和操作这些设备的一种方法而出现,真正地提供了机器对机器的通讯。当需要自动化和构建网络应用时 API 简化了开发过程,在数据如何建模时提供了更多结构。例如,当启用 API 的设备以 JSON/XML 返回数据时,它是结构化的,并且比返回原生文本信息、需要手工去解析的仅支持命令行的设备更易于使用。
|
||||
|
||||
在 API 之前,用于配置和管理网络设备的两个主要机制是命令行接口(CLI)和简单网络管理协议(SNMP)。让我们来了解一下它们,CLI 是一个设备的人机界面,而 SNMP 并不是为设备提供的实时编程接口。
|
||||
|
||||
幸运的是,因为很多供应商争相为设备增加 API,有时候 _正是因为_ 它被放到需求建议书(RFP)中,就带来了一个非常好的副作用 —— 支持网络自动化。当真正的 API 发布时,访问设备内数据的过程,以及管理配置,就会被极大简化,因此,我们将在本报告中对此进行评估。虽然使用许多传统方法也可以实现自动化,比如,CLI/SNMP。
|
||||
幸运的是,因为很多供应商争相为设备增加 API,有时候 _只是因为_ 它被放到需求建议书(RFP)中,这就带来了一个非常好的副作用 —— 支持网络自动化。当真正的 API 发布时,访问设备内数据的过程,以及管理配置,就会被极大简化,因此,我们将在本报告中对此进行评估。虽然使用许多传统方法也可以实现自动化,比如,CLI/SNMP。
|
||||
|
||||
> 注意
|
||||
|
||||
> 随着未来几个月或几年的网络设备更新,供应商的 API 无疑应该被测试,并且要做为采购网络设备(虚拟和物理)的关键决策标准。如果供应商提供一些库或集成到自动化工具中,或者如果被用于一个开放的标准/协议,用户应该知道数据是如何通过设备建模的,API 使用的传输类型是什么。
|
||||
> 随着未来几个月或几年的网络设备更新,供应商的 API 无疑应该被做为采购网络设备(虚拟和物理)的关键决策标准而测试和使用。如果供应商提供一些库或集成到自动化工具中,或者如果被用于一个开放的标准或协议,用户应该知道数据是如何通过设备建模的,API 使用的传输类型是什么。
|
||||
|
||||
总而言之,网络自动化,像大多数的自动化类型一样,是为了更快地工作。工作的更快是好事,降低部署和配置改变的时间并不总是许多 IT 组织需要去解决的问题。
|
||||
总而言之,网络自动化,像大多数类型的自动化一样,是为了更快地工作。工作的更快是好事,降低部署和配置改变的时间并不总是许多 IT 组织需要去解决的问题。
|
||||
|
||||
包括速度,我们现在看看这些各种类型的 IT 组织逐渐采用网络自动化的几种原因。你应该注意到,同样的原则也适用于其它类型的自动化。
|
||||
包括速度在内,我们现在看看这些各种类型的 IT 组织逐渐采用网络自动化的几种原因。你应该注意到,同样的原则也适用于其它类型的自动化。
|
||||
|
||||
### 简化架构
|
||||
|
||||
今天,每个网络都是一个独特的“雪花”型,并且,网络工程师们为能够解决传输和网络应用问题而感到自豪,这些问题最终使网络不仅难以维护和管理,而且也很难去实现自动化。
|
||||
今天,每个网络都是一片独特的“雪花”,并且,网络工程师们为能够通过一次性的改变来解决传输和网络应用问题而感到自豪,而这最终导致网络不仅难以维护和管理,而且也很难去实现自动化。
|
||||
|
||||
它需要从一开始就包含到新的架构和设计中去部署,而不是去考虑网络自动化和管理作为一个二级或三级项目。哪个特性可以跨不同的供应商工作?哪个扩展可以跨不同的平台工作?当使用特别的网络设备平台时,API 类型或者自动化工程是什么?当这些问题在设计进程之前得到答案,最终的架构将变成简单的、可重复的、并且易于维护 _和_ 自动化的,在整个网络中将很少启用供应商专用的扩展。
|
||||
网络自动化和管理需要从一开始就包含到新的架构和设计中去部署,而不是作为一个二级或三级项目。哪个特性可以跨不同的供应商工作?哪个扩展可以跨不同的平台工作?当使用特别的网络设备平台时,API 类型或者自动化工程是什么?当这些问题在设计过程之前得到答案,最终的架构将变成简单的、可重复的、并且易于维护 _和_ 自动化的,在整个网络中将很少启用供应商专用的扩展。
|
||||
|
||||
### 确定的结果
|
||||
|
||||
在一个企业组织中,改变审查会议(change review meeting)去评估即将到来的网络上的变化、它们对外部系统的影响、以及回滚计划。在这个世界上,人们为这些即 _将到来的变化_ 去接触 CLI,输入错误的命令造成的影响是灾难性的。想像一下,一个有三位、四位、五位、或者 50 位工程师的团队。每位工程师应对 _即将到来的变化_ 都有他们自己的独特的方法。并且,在管理这些变化的期间,使用一个 CLI 或者 GUI 的能力并不会消除和减少出现错误的机率。
|
||||
|
||||
使用经过验证和测试过的网络自动化可以帮助实现更多的可预测行为,并且使执行团队有更好的机会实现确实性结果,在保证任务没有人为错误的情况下首次正确完成的道路上更进一步。
|
||||
在一个企业组织中,<ruby>改变审查会议<rt>change review meeting</rt></ruby>会评估面临的网络变化、它们对外部系统的影响、以及回滚计划。在人们通过 CLI 来执行这些 _面临的变化_ 的世界上,输入错误的命令造成的影响是灾难性的。想像一下,一个有 3 位、4 位、5位,或者 50 位工程师的团队。每位工程师应对 _面临的变化_ 都有他们自己的独特的方法。并且,在管理这些变化的期间,一个人使用 CLI 或者 GUI 的能力并不会消除和减少出现错误的机率。
|
||||
|
||||
使用经过验证和测试过的网络自动化可以帮助实现更多的可预测行为,并且使执行团队更有可能实现确实性结果,在保证任务没有人为错误的情况下首次正确完成的道路上更进一步。
|
||||
|
||||
### 业务灵活性
|
||||
|
||||
不用说,网络自动化不仅为部署变化提供速度和灵活性,而且使得根据业务需要去从网络设备中检索数据的速度变得更快。自从服务器虚拟化实现以后,服务器和虚拟化使得管理员有能力在瞬间去部署一个新的应用程序。而且,更多的快速部署应用程序的问题出现在,配置一个 VLAN(虚拟局域网)、路由器、FW ACL(防火墙的访问控制列表)、或者负载均衡策略需要多长时间?
|
||||
不用说,网络自动化不仅为部署变化提供速度和灵活性,而且使得根据业务需要去从网络设备中检索数据的速度变得更快。自从服务器虚拟化到来以后,服务器和虚拟化使得管理员有能力在瞬间去部署一个新的应用程序。而且,随着应用程序可以更快地部署,随之浮现的问题是为什么还需要花费如此长的时间配置一个 VLAN(虚拟局域网)、路由器、FW ACL(防火墙的访问控制列表)或者负载均衡策略呢?
|
||||
|
||||
在一个组织内通过去熟悉大多数的通用工作流和 _为什么_ 网络改变是真实的需求?新的部署过程自动化工具,如 Ansible 将使这些变得非常简单。
|
||||
|
||||
这一章将介绍一些关于为什么应该去考虑网络自动化的高级知识点。在下一节,我们将带你去了解 Ansible 是什么,并且继续深入了解各种不同规模的 IT 组织的网络自动化的不同类型。
|
||||
通过了解在一个组织内最常见的工作流和 _为什么_ 真正需要改变网络,部署如 Ansible 这样的现代的自动化工具将使这些变得非常简单。
|
||||
|
||||
这一章介绍了一些关于为什么应该去考虑网络自动化的高级知识点。在下一节,我们将带你去了解 Ansible 是什么,并且继续深入了解各种不同规模的 IT 组织的网络自动化的不同类型。
|
||||
|
||||
### 什么是 Ansible?
|
||||
|
||||
Ansible 是存在于开源世界里的一种最新的 IT 自动化和配置管理平台。它经常被拿来与其它工具如 Puppet、Chef、和 SaltStack 去比较。Ansible 作为一个由 Michael DeHaan 创建的开源项目出现于 2012 年,Michael DeHaan 也创建了 Cobbler 和 cocreated Func,它们在开源社区都非常流行。在 Ansible 开源项目创建之后不足 18 个月时间, Ansilbe 公司成立,并收到了 $6 million 的一系列资金。它成为并一直保持着第一的贡献者和 Ansible 开源项目的支持者。在 2015 年 10 月,Red Hat 获得了 Ansible 公司。
|
||||
Ansible 是存在于开源世界里的一种最新的 IT 自动化和配置管理平台。它经常被拿来与其它工具如 Puppet、Chef 和 SaltStack 去比较。Ansible 作为一个由 Michael DeHaan 创建的开源项目出现于 2012 年,Michael DeHaan 也创建了 Cobbler 和 cocreated Func,它们在开源社区都非常流行。在 Ansible 开源项目创建之后不足 18 个月时间, Ansilbe 公司成立,并收到了六百万美金 A 轮投资。该公司成为 Ansible 开源项目排名第一的贡献者和支持者,并一直保持着。在 2015 年 10 月,Red Hat 收购了 Ansible 公司。
|
||||
|
||||
但是,Ansible 到底是什么?
|
||||
|
||||
_Ansible 是一个无需代理和可扩展的超级简单的自动化平台。_
|
||||
|
||||
让我们更深入地了解它的细节,并且看一看 Ansible 的属性,它帮助 Ansible 在行业内获得大量的吸引力(traction)。
|
||||
|
||||
让我们更深入地了解它的细节,并且看一看那些使 Ansible 在行业内获得广泛认可的属性。
|
||||
|
||||
### 简单
|
||||
|
||||
Ansible 的其中一个吸引人的属性是,去使用它你 _不_ 需要特定的编程技能。所有的指令,或者任务都是自动化的,在一个标准的、任何人都可以理解的人类可读的数据格式的一个文档中。在 30 分钟之内完成安装和自动化任务的情况并不罕见!
|
||||
Ansible 的其中一个吸引人的属性是,使用它你 _不_ 需要特定的编程技能。所有的指令,或者任务都是自动化的,以一个标准的、任何人都可以理解的人类可读的数据格式的文档化。在 30 分钟之内完成安装和自动化任务的情况并不罕见!
|
||||
|
||||
例如,下列的一个 Ansible playbook 任务是用于去确保在一个 Cisco Nexus 交换机中存在一个 VLAN:
|
||||
例如,下列来自一个 Ansible <ruby>剧本<rt>playbook</rt></ruby>的任务用于去确保在一个 VLAN 存在于一个 Cisco Nexus 交换机中:
|
||||
|
||||
```
|
||||
- nxos_vlan: vlan_id=100 name=web_vlan
|
||||
@ -74,9 +73,9 @@ Ansible 的其中一个吸引人的属性是,去使用它你 _不_ 需要特
|
||||
|
||||
你无需熟悉或写任何代码就可以明确地看出它将要做什么!
|
||||
|
||||
###### 注意
|
||||
> 注意
|
||||
|
||||
这个报告的下半部分涉到 Ansible 术语(playbooks、plays、tasks、modules、等等)的细节。但是,在我们为网络自动化使用 Ansible 时,我们也同时有一些详细的示例去解释这些关键概念。
|
||||
> 这个报告的下半部分涉到 Ansible 术语(<ruby>剧本<rt>playbook</rt></ruby>、<ruby>行动<rt>play</rt></ruby>、<ruby>任务<rt>task</rt></ruby>、<ruby>模块<rt>module</rt></ruby>等等)的细节。在我们使用 Ansible 进行网络自动化时,提及这些关键概念时我们会有一些简短的示例。
|
||||
|
||||
### 无代理
|
||||
|
||||
|
@ -0,0 +1,58 @@
|
||||
5 个理由,开源助你求职成功
|
||||
======
|
||||
![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/resume_career_document_general.png?itok=JEaFL2XI)
|
||||
|
||||
你正在在繁华的技术行业中寻找工作吗?无论你是寻找新挑战的技术团体老手,还是正在寻找第一份工作的毕业生,参加开源项目都是可以让你在众多应聘者中脱颖而出的好方法。以下是从事开源项目工作可以增强你求职竞争力的五个理由。
|
||||
|
||||
### 1. 获得项目经验
|
||||
|
||||
或许从事开源项目工作能带给你的最明显的好处是提供了项目经验。如果你是一个学生,你可能没有很多实质上的项目在你的简历中展示。如果你还在工作,由于保密限制,或者你对正在完成的任务不感兴趣,你不能或者不能很详细的讨论你当前的项目。无论那种情况,找出并参加那些有吸引力的,而且又正好可以展现你的技能的开源项目,无疑对求职有帮助。这些项目不仅在众多简历中引人注目,而且可以是面试环节中完美的谈论主题。
|
||||
|
||||
另外,很多开源项目托管在公共仓库(比如 [Github][1] )上,所以对任何想参与其中的任何人,获取这些项目的源代码都异常简单。同时,你对项目的公开代码贡献,也能很方便的被招聘单位或者潜在雇主找到。开源项目提供了一个可以让你以一种更实际的的方式展现你的技能,而不是仅仅在面试中纸上谈兵。
|
||||
|
||||
### 2. 学会提问
|
||||
|
||||
开源项目团体的新成员总会有机会去学习大量的新技能。他们肯定会发现特定项目的多种交流方式,结构层次,文档格式,和其他的方方面面。在刚刚参与到项目中时,你需要问大量的问题,才能找准自己的定位。正如俗语说得好,没有愚蠢的问题。开源社区提倡好奇心,特别是在问题答案不容易找到的时候。
|
||||
|
||||
在从事开源项目工作初期,对项目的不熟悉感会驱使个人去提问,去经常提问。这可以帮助参与者学会提问。学会去分辨问什么,怎么问,问谁。学会提问在找工作,[面试][2],甚至生活中都非常有用。解决问题和寻求帮助的能力在人才市场中都非常重要。
|
||||
|
||||
### 3. 获取新的技能与持续学习
|
||||
|
||||
大量的软件项目同时使用很多不同的技术。很少有贡献者可以熟悉项目中的所有技术。即使已经在项目中工作了一段时间后,很多人很可能也不能对项目中所用的所有技术都熟悉。
|
||||
|
||||
虽然一个开源项目中的老手可能会对项目的一些特定的方面不熟悉,但是新手不熟悉的显然更多。这种情况产生了大量的学习机会。在一个人刚开始从事开源工作时,可能只是去提高项目中的一些小功能,甚至很可能是在他熟悉的领域。但是以后的旅程就大不相同了。
|
||||
|
||||
从事项目的某一方面的工作可能会把你带进一个不熟悉的领域,可能会驱使你开始新的学习。而从事开源项目的工作,可能会把你带向一个你以前可能从没用过的技术。这会激起新的激情,或者,至少促进你继续学习([这正是雇主渴望具备的能力][3])。
|
||||
|
||||
### 4.增加人脉
|
||||
|
||||
开源项目被不同的社区维护和支持。一些人在他们的业余时间进行开源工作,他们都有各自的经历,兴趣和人脉。正如他们所说,“你了解什么人决定你成为什么人”。不通过开源项目,可能你永远不会遇到特定的人。或许你和世界各地的人一起工作,或许你和你的邻里有联系。但是,你不是知道谁能帮你找到下一份工作。参加开源项目扩展人脉的可能性将对你寻找下一份(或者第一份)工作极有帮助。
|
||||
|
||||
### 5. 建立自信
|
||||
|
||||
最后,参与开源项目可能给你新的自信。很多科技企业的新员工会有些[冒充者综合症][4]。由于没有完成重要工作,他们会感到没有归属感,好像自己是冒名顶替的那个人,认为自己配不上他们的新职位。在被雇佣前参加开源项目可以最小化这种问题。
|
||||
|
||||
开源项目的工作往往是独立完成的,但是对于项目来说,所有的贡献是一个整体。开源社区具有强大的包容性和合作性,只要你有所贡献,一定会被看到。别的社区成员(特别是更高级的成员)对你肯定无疑也是一种回报。在你进行代码提交时获得的认可可以提高你的自信,打败冒充者综合症。这份自信也会被带到面试,新职位,等等。
|
||||
|
||||
这只是从事开源工作的一些好处。如果你知道更多的好处,请在下方评论区留言分享。
|
||||
|
||||
### 关于作者
|
||||
Sophie Polson;Sophie 一名研究计算机科学的杜克大学的学生。通过杜克大学 2017 秋季课程 “开源世界( Open Source World )”,开始了开源社区的冒险。对探索 [DevOps][5] 十分有兴趣。在 2018 春季毕业后,将成为一名软件工程师。
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://opensource.com/article/18/1/5-ways-turn-open-source-new-job
|
||||
|
||||
作者:[Sophie Polson][a]
|
||||
译者:[Lontow](https://github.com/lontow)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]:https://opensource.com/users/sophiepolson
|
||||
[1]:https://github.com/dbaldwin/DronePan
|
||||
[2]:https://www.thebalance.com/why-you-should-ask-questions-in-a-job-interview-1669548
|
||||
[3]:https://www.computerworld.com/article/3177442/it-careers/lifelong-learning-is-no-longer-optional.html
|
||||
[4]:https://en.wikipedia.org/wiki/Impostor_syndrome
|
||||
[5]:https://en.wikipedia.org/wiki/DevOps
|
||||
^^^^^^
|
@ -0,0 +1,240 @@
|
||||
在 Linux 中如何归档文件和目录
|
||||
=====
|
||||
![](https://www.ostechnix.com/wp-content/uploads/2018/03/Archive-Files-And-Directories-In-Linux-720x340.png)
|
||||
在我们之前的教程中,我们讨论了如何[使用 gzip 和 bzip2 压缩和解压缩文件][1]。在本教程中,我们将学习如何在 Linux 归档文件。归档和压缩有什么不同吗?你们中的一些人可能经常认为这些术语有相同的含义。但是,这两者完全不同。归档是将多个文件和目录(相同或不同大小)组合成一个文件的过程。另一方面,压缩是减小文件或目录大小的过程。归档通常用作系统备份的一部分,或者将数据从一个系统移至另一个系统时。希望你了解归档和压缩之间的区别。现在,让我们进入主题。
|
||||
|
||||
### 归档文件和目录
|
||||
|
||||
归档文件和目录最常见的程序是:
|
||||
1. tar
|
||||
2. zip
|
||||
|
||||
这是一个很大的话题,所以,我将分两部分发表这篇文章。在第一部分中,我们将看到如何使用 tar 命令来归档文件和目录。
|
||||
|
||||
##### 使用 tar 命令归档文件和目录
|
||||
|
||||
**Tar** 是一个 Unix 命令,代表 **T**ape **A**rchive(这里我将其翻译为 磁带归档,希望校正者修正以下)。它用于将多个文件(相同或不同大小)组合或存储到一个文件中。在 tar 实用程序中有 4 种主要的操作模式。
|
||||
|
||||
1. **c** – 从文件或目录中建立归档
|
||||
2. **x** – 提取归档
|
||||
3. **r** – 将文件追加到归档
|
||||
4. **t** – 列出归档的内容
|
||||
|
||||
有关完整的模式列表,参阅 man 手册页。
|
||||
|
||||
**创建一个新的归档**
|
||||
|
||||
为了本指南,我将使用名为 **ostechnix** 的文件夹,其中包含三种不同类型的文件。
|
||||
```
|
||||
$ ls ostechnix/
|
||||
file.odt image.png song.mp3
|
||||
```
|
||||
|
||||
现在,让我们为 ostechnix 目录创建一个新的 tar 归档。
|
||||
```
|
||||
$ tar cf ostechnix.tar ostechnix/
|
||||
```
|
||||
|
||||
这里,**c**标志指的是创建新的归档,**f** 是指定归档文件。
|
||||
|
||||
同样,对当前工作目录中的一组文件创建归档文件,使用以下命令:
|
||||
```
|
||||
$ tar cf archive.tar file1 file2 file 3
|
||||
```
|
||||
|
||||
**提取归档**
|
||||
|
||||
要在当前目录中提取归档文件,只需执行以下操作:
|
||||
```
|
||||
$ tar xf ostechnix.tar
|
||||
```
|
||||
|
||||
我们还可以使用 **C** 标志(大写字母 C)将归档提取到不同的目录中。例如,以下命令在 **Downloads** 目录中提取给定的归档文件。
|
||||
```
|
||||
$ tar xf ostechnix.tar -C Downloads/
|
||||
```
|
||||
|
||||
或者,转到 Downloads 文件夹并像下面一样提取其中的归档。
|
||||
```
|
||||
$ cd Downloads/
|
||||
|
||||
$ tar xf ../ostechnix.tar
|
||||
```
|
||||
|
||||
有时,你可能想要提取特定类型的文件。例如,以下命令提取 “.png” 类型的文件。
|
||||
```
|
||||
$ tar xf ostechnix.tar --wildcards "*.png"
|
||||
```
|
||||
|
||||
**创建 gzip 和 bzip 格式的压缩归档**
|
||||
|
||||
默认情况下,tar 创建归档文件以 **.tar** 结尾。另外,tar 命令可以与压缩实用程序 **gzip** 和 **bzip** 结合使用。文件结尾以 **.tar** 为扩展名使用普通 tar 归档文件,文件以 **tar.gz** 或 **.tgz** 结尾使用 **gzip** 归档并压缩文件,tar 文件以 **tar.bz2** 或 **.tbz** 结尾使用 **bzip** 归档并压缩。
|
||||
|
||||
首先,让我们来**创建一个 gzip 归档**:
|
||||
```
|
||||
$ tar czf ostechnix.tar.gz ostechnix/
|
||||
```
|
||||
|
||||
或者
|
||||
```
|
||||
$ tar czf ostechnix.tgz ostechnix/
|
||||
```
|
||||
|
||||
这里,我们使用 **z** 标志来使用 gzip 压缩方法压缩归档文件。
|
||||
|
||||
你可以使用 **v** 标志在创建归档时查看进度。
|
||||
```
|
||||
$ tar czvf ostechnix.tar.gz ostechnix/
|
||||
ostechnix/
|
||||
ostechnix/file.odt
|
||||
ostechnix/image.png
|
||||
ostechnix/song.mp3
|
||||
```
|
||||
|
||||
这里,**v** 指显示进度。
|
||||
|
||||
从一个文件列表创建 gzip 归档文件:
|
||||
```
|
||||
$ tar czf archive.tgz file1 file2 file3
|
||||
```
|
||||
|
||||
要提取当前目录中的 gzip 归档文件,使用:
|
||||
```
|
||||
$ tar xzf ostechnix.tgz
|
||||
```
|
||||
|
||||
要提取其他文件夹中的归档,使用 -C 标志:
|
||||
```
|
||||
$ tar xzf ostechnix.tgz -C Downloads/
|
||||
```
|
||||
|
||||
现在,让我们创建 **bzip 归档**。为此,请使用下面的 **j** 标志。
|
||||
|
||||
创建一个目录的归档:
|
||||
|
||||
```
|
||||
$ tar cjf ostechnix.tar.bz2 ostechnix/
|
||||
```
|
||||
或
|
||||
```
|
||||
$ tar cjf ostechnix.tbz ostechnix/
|
||||
```
|
||||
|
||||
从一个列表文件中创建归档:
|
||||
```
|
||||
$ tar cjf archive.tar.bz2 file1 file2 file3
|
||||
```
|
||||
|
||||
或
|
||||
```
|
||||
$ tar cjf archive.tbz file1 file2 file3
|
||||
```
|
||||
|
||||
为了显示进度,使用 **v** 标志。
|
||||
|
||||
现在,在当前目录下,让我们提取一个 bzip 归档。这样做:
|
||||
```
|
||||
$ tar xjf ostechnix.tar.bz2
|
||||
```
|
||||
|
||||
或者,提取归档文件到其他目录:
|
||||
```
|
||||
$ tar xjf ostechnix.tar.bz2 -C Downloads
|
||||
```
|
||||
|
||||
**一次创建多个目录和/或文件的归档**
|
||||
|
||||
这是 tar 命令的另一个最酷的功能。要一次创建多个目录或文件的 gzip 归档文件,使用以下文件:
|
||||
```
|
||||
$ tar czvf ostechnix.tgz Downloads/ Documents/ ostechnix/file.odt
|
||||
```
|
||||
|
||||
上述命令创建 **Downloads**, **Documents** 目录和 **ostechnix** 目录下的 **file.odt** 文件的归档,并将归档保存在当前工作目录中。
|
||||
|
||||
**在创建归档时跳过目录和/或文件**
|
||||
|
||||
这在备份数据时非常有用。你可以在备份中排除不重要的文件或目录,这是 **–exclude** 选项所能帮助的。例如你想要创建 /home 目录的归档,但不希望包括 Downloads, Documents, Pictures, Music 这些目录。
|
||||
|
||||
这是我们的做法:
|
||||
```
|
||||
$ tar czvf ostechnix.tgz /home/sk --exclude=/home/sk/Downloads --exclude=/home/sk/Documents --exclude=/home/sk/Pictures --exclude=/home/sk/Music
|
||||
```
|
||||
|
||||
上述命令将对我的 $HOME 目录创建一个 gzip 归档,其中不包括 Downloads, Documents, Pictures 和 Music 目录。要创建 bzip 归档,将 **z** 替换为 **j**,并在上例中使用扩展名 .bz2。
|
||||
|
||||
**列出归档文件但不提取它们**
|
||||
|
||||
要列出归档文件的内容,我们使用 **t** 标志。
|
||||
```
|
||||
$ tar tf ostechnix.tar
|
||||
ostechnix/
|
||||
ostechnix/file.odt
|
||||
ostechnix/image.png
|
||||
ostechnix/song.mp3
|
||||
```
|
||||
|
||||
要查看详细输出,使用 **v** 标志。
|
||||
```
|
||||
$ tar tvf ostechnix.tar
|
||||
drwxr-xr-x sk/users 0 2018-03-26 19:52 ostechnix/
|
||||
-rw-r--r-- sk/users 9942 2018-03-24 13:49 ostechnix/file.odt
|
||||
-rw-r--r-- sk/users 36013 2015-09-30 11:52 ostechnix/image.png
|
||||
-rw-r--r-- sk/users 112383 2018-02-22 14:35 ostechnix/song.mp3
|
||||
```
|
||||
|
||||
**追加文件到归档**
|
||||
|
||||
文件或目录可以使用 **r** 标志添加/更新到现有的归档。看看下面的命令:
|
||||
```
|
||||
$ tar rf ostechnix.tar ostechnix/ sk/ example.txt
|
||||
```
|
||||
|
||||
上面的命令会将名为 **sk** 的目录和名为 **exmple.txt** 添加到 ostechnix.tar 归档文件中。
|
||||
|
||||
你可以使用以下命令验证文件是否已添加:
|
||||
```
|
||||
$ tar tvf ostechnix.tar
|
||||
drwxr-xr-x sk/users 0 2018-03-26 19:52 ostechnix/
|
||||
-rw-r--r-- sk/users 9942 2018-03-24 13:49 ostechnix/file.odt
|
||||
-rw-r--r-- sk/users 36013 2015-09-30 11:52 ostechnix/image.png
|
||||
-rw-r--r-- sk/users 112383 2018-02-22 14:35 ostechnix/song.mp3
|
||||
drwxr-xr-x sk/users 0 2018-03-26 19:52 sk/
|
||||
-rw-r--r-- sk/users 0 2018-03-26 19:39 sk/linux.txt
|
||||
-rw-r--r-- sk/users 0 2018-03-26 19:56 example.txt
|
||||
```
|
||||
|
||||
##### **TL;DR**
|
||||
|
||||
**创建 tar 归档:**
|
||||
* **普通 tar 归档:** tar -cf archive.tar file1 file2 file3
|
||||
* **Gzip tar 归档:** tar -czf archive.tgz file1 file2 file3
|
||||
* **Bzip tar 归档:** tar -cjf archive.tbz file1 file2 file3
|
||||
|
||||
**提取 tar 归档:**
|
||||
* **普通 tar 归档:** tar -xf archive.tar
|
||||
* **Gzip tar 归档:** tar -xzf archive.tgz
|
||||
* **Bzip tar 归档:** tar -xjf archive.tbz
|
||||
|
||||
我们只介绍了 tar 命令的基本用法,这些对于开始使用 tar 命令足够了。但是,如果你想了解更多详细信息,参阅 man 手册页。
|
||||
```
|
||||
$ man tar
|
||||
|
||||
```
|
||||
|
||||
好吧,这就是全部了。在下一部分中,我们将看到如何使用 Zip 实用程序来归档文件和目录。
|
||||
|
||||
干杯!
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://www.ostechnix.com/how-to-archive-files-and-directories-in-linux-part-1/
|
||||
|
||||
作者:[SK][a]
|
||||
译者:[MjSeven](https://github.com/MjSeven)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
选题:[lujun9972](https://github.com/lujun9972)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]:https://www.ostechnix.com/author/sk/
|
||||
[1]:https://www.ostechnix.com/how-to-compress-and-decompress-files-in-linux/
|
@ -0,0 +1,323 @@
|
||||
6 个 Python 日期库
|
||||
=====
|
||||
|
||||
### 在 Python 中有许多库可以很容易地测试,转换和读取日期和时间信息。
|
||||
![6 Python datetime libraries ](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/python-programming-code-keyboard.png?itok=fxiSpmnd "6 Python datetime libraries ")
|
||||
|
||||
图片由 [WOCinTech Chat][1] 提供,根据 Opensource.com 修改。[CC BY-SA 4.0][2]
|
||||
|
||||
_这篇文章是与 [Jeff Triplett][3] 一起合写的。_
|
||||
|
||||
曾几何时,我们中的一个人(Lacey)花了超过一个小时盯着 [Python 文档][4]中描述日期和时间格式化字符串的表格。当我试图编写从 API 中将日期时间字符串转换为 [Python datetime][5] 对象时,我很难理解其中的特定部分,因此我决定请求帮助。
|
||||
|
||||
有人问道:“为什么你不使用 dateutil 呢?”
|
||||
|
||||
读者,如果你没有从这个月的 Python 专栏中获得任何东西,仅仅是学习到有比 datetime 的 strptime 更容易地将 datetime 字符串转换为 datetime 对象的方法,那么我们认为自己是成功的。
|
||||
|
||||
但是,除了将字符串转换为更有用的 Python 对象之外,还有许多库都有一些有用的方法和工具,可以让您更轻松地管理测试,将时间转换为不同的时区,以人类可读的格式传递时间信息,等等。如果这是你在 Python 中第一次尝试日期和时间,请暂停并阅读 _[如何使用 Python][6]的日期和时间_ 。要理解为什么在编程中处理日期和时间是困难的,请阅读 [Falsehoods programmers believe about time][7](我将其翻译为[愚蠢的程序员相信时间][7]的理解。
|
||||
|
||||
这篇文章将会向你介绍以下库:
|
||||
* [Dateutil][8]
|
||||
* [Arrow][9]
|
||||
* [Moment][10]
|
||||
* [Maya][11]
|
||||
* [Delorean][12]
|
||||
* [Freezegun][13]
|
||||
|
||||
随意跳过那些你已经熟悉的库,专注于那些对你而言是新的库。
|
||||
|
||||
### 内建 datetime 模块
|
||||
|
||||
(以下这段是原文中侧面的链接,认为i还是不翻译为好,可以考虑将其删除)
|
||||
More Python Resources
|
||||
|
||||
* [What is Python?][14]
|
||||
* [Top Python IDEs][15]
|
||||
* [Top Python GUI frameworks][16]
|
||||
* [Latest Python content][17]
|
||||
* [More developer resources][18]
|
||||
|
||||
在跳转到其他库之前,让我们回顾一下如何使用 datetime 模块将日期字符串转换为 Python datetime 对象。
|
||||
|
||||
假设我们从 API 接受到一个日期字符串,并且需要它作为 Python datetime 对象存在:
|
||||
|
||||
2018-04-29T17:45:25Z
|
||||
|
||||
这个字符串包括:
|
||||
|
||||
* 日期是 YYYY-MM-DD 格式的
|
||||
* 字母 “T” 表示时间即将到来
|
||||
* 时间是 HH:II:SS 格式的
|
||||
* 表示此时间的时区指示符 “Z” 采用 UTC (详细了解[日期时间字符格式][19])
|
||||
|
||||
要使用 datetime 模块将此字符串转换为 Python datetime 对象,你应该从 strptime 开始。 datetime.strptime 接受日期字符串和格式化字符并返回一个 Python datetime 对象。
|
||||
|
||||
我们必须手动将日期时间字符串的每个部分转换为 Python 的 datetime.strptime 可以理解的合适的格式化字符串。四位数年份由 %Y 表示,两位数月份是 %m,两位数的日期是 %d。在 24 小时制中,小时是 %H,分钟是 %M,秒是 %S。
|
||||
|
||||
为了得出这些结论,需要在[Python 文档][20]的表格中多加注意。
|
||||
|
||||
由于字符串中的 “Z” 表示此日期时间字符串采用 UTC,所以我们可以在格式中忽略此项。(现在,我们不会担心时区。)
|
||||
|
||||
转换的代码是这样的:
|
||||
|
||||
```
|
||||
$ from datetime import datetime
|
||||
|
||||
$ datetime.strptime('2018-04-29T17:45:25Z', '%Y-%m-%dT%H:%M:%SZ')
|
||||
|
||||
datetime.datetime(2018, 4, 29, 17, 45, 25)
|
||||
```
|
||||
|
||||
格式化字符串很难阅读和理解。我必须手动计算原始字符串中的字母 “T” 和 “Z”,以及标点符号和格式化字符串,如 %S 和 %m。有些不太了解 datetime 的人阅读我的代码可能会发现它很难理解,尽管其含义已有文档记载,但它仍然很难阅读。
|
||||
|
||||
让我们看看其他库是如何处理这种转换的。
|
||||
|
||||
### Dateutil
|
||||
|
||||
[dateutil 模块][21]对 datetime 模块做了一些扩展。
|
||||
|
||||
继续使用上面的解析示例,使用 dateutil 实现相同的结果要简单得多:
|
||||
|
||||
```
|
||||
$ from dateutil.parser import parse
|
||||
|
||||
$ parse('2018-04-29T17:45:25Z')
|
||||
|
||||
datetime.datetime(2018, 4, 29, 17, 45, 25, tzinfo=tzutc())
|
||||
```
|
||||
|
||||
如果字符串包含时区,那么 dateutil 解析器会自动返回字符串的时区。由于我们在 UTC,你可以看到一个 datetime 对象返回了。如果你想解析完全忽略时区信息并返回原生的 datetime 对象,你可以传递 ignoretz=True 来解析,如下所示:
|
||||
|
||||
```
|
||||
$ from dateutil.parser import parse
|
||||
|
||||
$ parse('2018-04-29T17:45:25Z', ignoretz=True)
|
||||
|
||||
datetime.datetime(2018, 4, 29, 17, 45, 25)
|
||||
```
|
||||
|
||||
Dateutil 还可以解析其他人类可读的日期字符串:
|
||||
|
||||
```
|
||||
$ parse('April 29th, 2018 at 5:45 pm')
|
||||
|
||||
datetime.datetime(2018, 4, 29, 17, 45)
|
||||
```
|
||||
|
||||
Dateutil 还提供了像 [relativedelta][22] 的工具,它用于计算两个日期时间之间的时间差或向日期时间添加或删除时间,[rrule][23] 创建重复日期时间,[tz][24] 用于解决时区以及其他工具。
|
||||
|
||||
### Arrow
|
||||
|
||||
[Arrow][25] 是另一个库,其目标是进行操作,格式化,以及处理对人类更友好的日期和时间。它包含 dateutil,根据其[文档][26],它旨在“帮助你使用更少的包导入和更少的代码来处理日期和时间”。
|
||||
|
||||
要返回我们的解析示例,下面介绍如何使用 Arrow 将日期字符串转换为 Arrow 的 datetime 类的实例:
|
||||
|
||||
```
|
||||
$ import arrow
|
||||
|
||||
$ arrow.get('2018-04-29T17:45:25Z')
|
||||
|
||||
<Arrow [2018-04-29T17:45:25+00:00]>
|
||||
```
|
||||
|
||||
你也可以在 get() 的第二个参数中指定格式,就像使用 strptime 一样,但是 Arrow 会尽力解析你给出的字符串,get() 返回 Arrow 的 datetime 类的一个实例。要使用 Arrow 来获取 Python datetime 对象,按照如下所示链式 datetime:
|
||||
|
||||
```
|
||||
$ arrow.get('2018-04-29T17:45:25Z').datetime
|
||||
|
||||
datetime.datetime(2018, 4, 29, 17, 45, 25, tzinfo=tzutc())
|
||||
```
|
||||
|
||||
通过 Arrow datetime 类的实例,你可以访问 Arrow 的其他有用方法。例如,它的 humanize() 方法将日期时间翻译成人类可读的短语,就像这样:
|
||||
|
||||
```
|
||||
$ import arrow
|
||||
|
||||
$ utc = arrow.utcnow()
|
||||
|
||||
$ utc.humanize()
|
||||
|
||||
'seconds ago'
|
||||
```
|
||||
|
||||
在 Arrow 的[文档][27]中阅读更多关于其有用方法的信息。
|
||||
|
||||
### Moment
|
||||
|
||||
[Moment][28] 的作者认为它是"内部测试版",但即使它处于早期阶段,它也是非常受欢迎的,我们想来讨论它。
|
||||
|
||||
Moment 的方法将字符转换为其他更有用的东西很简单,类似于我们之前提到的库:
|
||||
|
||||
```
|
||||
$ import moment
|
||||
|
||||
$ moment.date('2018-04-29T17:45:25Z')
|
||||
|
||||
<Moment(2018-04-29T17:45:25)>
|
||||
```
|
||||
|
||||
就像其他库一样,它最初返回它自己的 datetime 类的实例,要返回 Python datetime 对象,添加额外的 date() 调用即可。
|
||||
|
||||
```
|
||||
$ moment.date('2018-04-29T17:45:25Z').date
|
||||
|
||||
datetime.datetime(2018, 4, 29, 17, 45, 25, tzinfo=<StaticTzInfo 'Z'>)
|
||||
```
|
||||
|
||||
这将 Moment datetime 类转换为 Python datetime 对象。
|
||||
|
||||
Moment 还提供了使用人类可读的语言创建新日期的方法。例如创建一个明天的日期:
|
||||
|
||||
```
|
||||
$ moment.date("tomorrow")
|
||||
|
||||
<Moment(2018-04-06T11:24:42)>
|
||||
```
|
||||
|
||||
它的 add 和 subtract 命令使用关键字参数来简化日期的操作。为了获得后天,Moment 会使用下面的代码:
|
||||
|
||||
```
|
||||
$ moment.date("tomorrow").add(days=1)
|
||||
|
||||
<Moment(2018-04-07T11:26:48)>
|
||||
```
|
||||
|
||||
### Maya
|
||||
|
||||
[Maya][29] 包含其他流行的库,它们处理 Python 中的日期时间,包括 Humanize, pytz 和 pendulum 等等。这个项目旨在让人们更容易处理日期。
|
||||
|
||||
Maya 的 README 包含几个有用的实例。以下是如何使用 Maya 来重新处理以前的解析示例:
|
||||
|
||||
```
|
||||
$ import maya
|
||||
|
||||
$ maya.parse('2018-04-29T17:45:25Z').datetime()
|
||||
|
||||
datetime.datetime(2018, 4, 29, 17, 45, 25, tzinfo=<UTC>)
|
||||
```
|
||||
|
||||
注意我们必须在 maya.parse() 之后调用 .datetime()。如果我们跳过这一步,Maya 将会返回一个 MayaDT 类的示例:<MayaDT epoch=1525023925.0>。
|
||||
|
||||
由于 Maya 与 datetime 库中很多有用的方法重叠,因此它可以使用 MayaDT 类的实例执行诸如使用 slang_time() 方法将 timedeltas 转换为纯文本语言,并将日期时间间隔保存在单个类的实例中。以下是如何使用 Maya 将日期时间表示为人类可读的短语:
|
||||
|
||||
```
|
||||
$ import maya
|
||||
|
||||
$ maya.parse('2018-04-29T17:45:25Z').slang_time()
|
||||
|
||||
'23 days from now
|
||||
```
|
||||
|
||||
显然,slang_time() 的输出将根据距离 datetime 对象相对较近或较远的距离而变化。
|
||||
|
||||
|
||||
### Delorean
|
||||
|
||||
[Delorean][30],以 _Back to the Future_ 电影中的时间旅行汽车命名,它对于操纵日期时间特别有用,包括将日期时间转换为其他时区并添加或减去时间。
|
||||
|
||||
Delorean 需要有效的 Python datetime 对象才能工作,所以如果你需要使用时间字符串,最好将其与上述库中的一个配合使用。例如,将 Maya 与 Delorean 一起使用:
|
||||
|
||||
```
|
||||
$ import maya
|
||||
|
||||
$ d_t = maya.parse('2018-04-29T17:45:25Z').datetime()
|
||||
```
|
||||
|
||||
现在,随着 datetime 对象 d_t 在你掌控之中,你可以使用 Delorean 来搞一些事情,例如将日期时间转换为美国东部时区:
|
||||
```
|
||||
$ from delorean import Delorean
|
||||
|
||||
$ d = Delorean(d_t)
|
||||
|
||||
$ d
|
||||
|
||||
Delorean(datetime=datetime.datetime(2018, 4, 29, 17, 45, 25), timezone='UTC')
|
||||
|
||||
$ d.shift('US/Eastern')
|
||||
|
||||
Delorean(datetime=datetime.datetime(2018, 4, 29, 13, 45, 25), timezone='US/Eastern')
|
||||
```
|
||||
|
||||
看到小时是怎样从 17 变成 13 了吗?
|
||||
|
||||
你也可以使用自然语言方法来操作 datetime 对象。获取 2018 年 4 月 29 日之后的下个星期五(我们现在使用的):
|
||||
|
||||
```
|
||||
$ d.next_friday()
|
||||
|
||||
Delorean(datetime=datetime.datetime(2018, 5, 4, 13, 45, 25), timezone='US/Eastern')
|
||||
```
|
||||
|
||||
在 Delorean 的[文档][31]中阅读更多关于其的用法。
|
||||
|
||||
### Freezegun
|
||||
|
||||
[Freezegun][32] 是一个可以帮助你在 Python 代码中测试特定日期的库。使用 @freeze_time 装饰器,你可以为测试用例设置特定的日期和时间,并且所有对 datetime.datetime.now(), datetime.datetime.utcnow() 等的调用都将返回你指定的日期和时间。例如:
|
||||
|
||||
|
||||
```
|
||||
from freezegun import freeze_time
|
||||
import datetime
|
||||
|
||||
@freeze_time("2017-04-14")
|
||||
def test():
|
||||
assert datetime.datetime.now() == datetime.datetime(2017, 4, 14)
|
||||
```
|
||||
|
||||
要跨时区进行测试,你可以将 tz_offset 参数传递给装饰器。freeze_time 装饰器也接受更简单的口语化日期,例如 @freeze_time('April 4, 2017')。
|
||||
|
||||
---
|
||||
|
||||
上面提到的每个库都提供了一组不同的特性和功能,也许很难决定哪一个最适合你的需要。[Maya 的作者][33], Kenneth Reitz 说到:“所有这些项目相辅相成,它们都是我们的朋友”。
|
||||
|
||||
这些库共享一些功能,但不是全部。有些擅长时间操作,有些擅长解析,但它们都有共同的目标,即让你对日期和时间的工作更轻松。下次你发现自己对 Python 的内置 datetime 模块感到沮丧,我们希望你可以选择其中的一个库进行试验。
|
||||
|
||||
---
|
||||
|
||||
via: [https://opensource.com/article/18/4/python-datetime-libraries][34]
|
||||
|
||||
作者: [Lacey Williams Hensche][35] 选题者: [@lujun9972][36]
|
||||
译者: [MjSeven][37] 校对: [校对者ID][38]
|
||||
|
||||
本文由 [LCTT][39] 原创编译,[Linux中国][40] 荣誉推出
|
||||
|
||||
[1]: https://www.flickr.com/photos/wocintechchat/25926664911/
|
||||
[2]: https://creativecommons.org/licenses/by/4.0/
|
||||
[3]: https://opensource.com/users/jefftriplett
|
||||
[4]: https://docs.python.org/3/library/datetime.html#strftime-strptime-behavior
|
||||
[5]: https://opensource.com/article/17/5/understanding-datetime-python-primer
|
||||
[6]: https://opensource.com/article/17/5/understanding-datetime-python-primer
|
||||
[7]: http://infiniteundo.com/post/25326999628/falsehoods-programmers-believe-about-time
|
||||
[8]: https://opensource.com/#Dateutil
|
||||
[9]: https://opensource.com/#Arrow
|
||||
[10]: https://opensource.com/#Moment
|
||||
[11]: https://opensource.com/#Maya
|
||||
[12]: https://opensource.com/#Delorean
|
||||
[13]: https://opensource.com/#Freezegun
|
||||
[14]: https://opensource.com/resources/python?intcmp=7016000000127cYAAQ
|
||||
[15]: https://opensource.com/resources/python/ides?intcmp=7016000000127cYAAQ
|
||||
[16]: https://opensource.com/resources/python/gui-frameworks?intcmp=7016000000127cYAAQ
|
||||
[17]: https://opensource.com/tags/python?intcmp=7016000000127cYAAQ
|
||||
[18]: https://developers.redhat.com/?intcmp=7016000000127cYAAQ
|
||||
[19]: https://www.w3.org/TR/NOTE-datetime
|
||||
[20]: https://docs.python.org/3/library/datetime.html#strftime-strptime-behavior
|
||||
[21]: https://dateutil.readthedocs.io/en/stable/
|
||||
[22]: https://dateutil.readthedocs.io/en/stable/relativedelta.html
|
||||
[23]: https://dateutil.readthedocs.io/en/stable/rrule.html
|
||||
[24]: https://dateutil.readthedocs.io/en/stable/tz.html
|
||||
[25]: https://github.com/crsmithdev/arrow
|
||||
[26]: https://pypi.python.org/pypi/arrow-fatisar/0.5.3
|
||||
[27]: https://arrow.readthedocs.io/en/latest/
|
||||
[28]: https://github.com/zachwill/moment
|
||||
[29]: https://github.com/kennethreitz/maya
|
||||
[30]: https://github.com/myusuf3/delorean
|
||||
[31]: https://delorean.readthedocs.io/en/latest/
|
||||
[32]: https://github.com/spulec/freezegun
|
||||
[33]: https://github.com/kennethreitz/maya
|
||||
[34]: https://opensource.com/article/18/4/python-datetime-libraries
|
||||
[35]: https://opensource.com/users/laceynwilliams
|
||||
[36]: https://github.com/lujun9972
|
||||
[37]: https://github.com/MjSeven
|
||||
[38]: https://github.com/校对者ID
|
||||
[39]: https://github.com/LCTT/TranslateProject
|
||||
[40]: https://linux.cn/
|
@ -1,80 +0,0 @@
|
||||
一个更好的调试 Perl 模块
|
||||
======
|
||||
|
||||
![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/annoyingbugs.png?itok=ywFZ99Gs)
|
||||
只有在调试或开发调整时才使用 Perl 代码块有时会很有用。这很好,但是这样的代码块可能会对性能产生很大的影响, 尤其是在运行时决定是否执行它。
|
||||
|
||||
[Curtis“Ovid”Poe][1] 编写了一个可以帮助解决这个问题的模块:[Keyword::DEVELOPMENT][2]。该模块利用 Keyword::Simple 和 Perl 5.012 中引入的可插入关键字架构来创建新的关键字:DEVELOPMENT。它使用 PERL_KEYWORD_DEVELOPMENT 环境变量的值来确定是否要执行一段代码。
|
||||
|
||||
使用它并不容易:
|
||||
```
|
||||
use Keyword::DEVELOPMENT;
|
||||
|
||||
|
||||
|
||||
sub doing_my_big_loop {
|
||||
|
||||
my $self = shift;
|
||||
|
||||
DEVELOPMENT {
|
||||
|
||||
# insert expensive debugging code here!
|
||||
|
||||
}
|
||||
|
||||
}Keyworddoing_my_big_loopDEVELOPMENT
|
||||
|
||||
```
|
||||
|
||||
在编译时,DEVELOPMENT 块内的代码已经被优化掉了,根本就不存在。
|
||||
|
||||
你看到好处了么?在沙盒中将 PERL_KEYWORD_DEVELOPMENT 环境变量设置为 true,在生产环境设为 false,并且可以将有价值的调试工具提交到你的代码库中,在你需要的时候随时可用。
|
||||
|
||||
在缺乏高级配置管理的系统中,你也可以使用此模块来处理生产和开发或测试环境之间的设置差异:
|
||||
```
|
||||
sub connect_to_my_database {
|
||||
|
||||
|
||||
|
||||
my $dsn = "dbi:mysql:productiondb";
|
||||
|
||||
my $user = "db_user";
|
||||
|
||||
my $pass = "db_pass";
|
||||
|
||||
|
||||
|
||||
DEVELOPMENT {
|
||||
|
||||
# Override some of that config information
|
||||
|
||||
$dsn = "dbi:mysql:developmentdb";
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
my $db_handle = DBI->connect($dsn, $user, $pass);
|
||||
|
||||
}connect_to_my_databaseDEVELOPMENTDBI
|
||||
|
||||
```
|
||||
|
||||
稍后对此代码片段的增强使你能在其他地方,比如 YAML 或 INI 中读取配置信息,但我希望您能在此看到该工具。
|
||||
|
||||
我查看了关键字 Keyword::DEVELOPMENT 的源码,花了大约半小时研究,“天哪,我为什么没有想到这个?”安装 Keyword::Simple 后,Curtis 给我们的模块就非常简单了。这是我长期以来在自己的编码实践中需要的一个优雅解决方案。
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://opensource.com/article/18/4/perl-module-debugging-code
|
||||
|
||||
作者:[Ruth Holloway][a]
|
||||
选题:[lujun9972](https://github.com/lujun9972)
|
||||
译者:[geekpi](https://github.com/geekpi)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]:https://opensource.com/users/druthb
|
||||
[1]:https://metacpan.org/author/OVID
|
||||
[2]:https://metacpan.org/pod/release/OVID/Keyword-DEVELOPMENT-0.04/lib/Keyword/DEVELOPMENT.pm
|
@ -0,0 +1,93 @@
|
||||
Orbital Apps - 新一代 Linux 程序
|
||||
======
|
||||
|
||||
![](https://www.ostechnix.com/wp-content/uploads/2016/05/orbital-apps-720x340.jpg)
|
||||
|
||||
今天,我们要了解 **Orbital Apps** 或 **ORB**(**O**pen **R**unnable **B**undle)**apps**(开放可运行程序包),一个免费、跨平台的开源程序集合。所有 ORB 程序都是可移动的。你可以将它们安装在你的 Linux 系统或 USB 驱动器上,以便你可以在任何系统上使用相同的程序。它们不需要 root 权限,并且没有依赖关系。所有必需的依赖关系都包含在程序中。只需将 ORB 程序复制到 USB 驱动器并将其插入到任何 Linux 系统中就立即开始使用它们。所有设置和配置以及程序的数据都将存储在 USB 驱动器上。由于不需要在本地驱动器上安装程序,我们可以在联机或脱机的计算机上运行应用程序。这意味着我们不需要 Internet 来下载任何依赖。
|
||||
|
||||
ORB apps are compressed up to 60% smaller, so we can store and use them even from the small sized USB drives. All ORB apps are signed with PGP/RSA and distributed via TLS 1.2. All Applications are packaged without any modifications, they are not even re-compiled. Here is the list of currently available portable ORB applications.
|
||||
ORB 程序压缩了 60%,因此我们甚至可以从小型USB驱动器存储和使用它们。所有ORB应用程序都使用PGP / RSA进行签名,并通过TLS 1.2进行分发。所有应用程序打包时都不做任何修改,甚至不会重新编译。以下是当前可用的便携式ORB应用程序列表。
|
||||
|
||||
* abiword
|
||||
* audacious
|
||||
* audacity
|
||||
* darktable
|
||||
* deluge
|
||||
* filezilla
|
||||
* firefox
|
||||
* gimp
|
||||
* gnome-mplayer
|
||||
* hexchat
|
||||
* inkscape
|
||||
* isomaster
|
||||
* kodi
|
||||
* libreoffice
|
||||
* qbittorrent
|
||||
* sound-juicer
|
||||
* thunderbird
|
||||
* tomahawk
|
||||
* uget
|
||||
* vlc
|
||||
* 未来还有更多。
|
||||
|
||||
|
||||
|
||||
Orb is open source, so If you’re a developer, feel free to collaborate and add more applications.
|
||||
Orb 是开源的,所以如果你是开发人员,欢迎协作并添加更多程序。
|
||||
|
||||
### 下载并使用可移动 ORB 程序
|
||||
|
||||
正如我已经提到的,我们不需要安装可移动 ORB 程序。但是,ORB 团队强烈建议你使用 **ORB 启动器** 来获得更好的体验。 ORB 启动器是一个小的安装程序(小于 5MB),它可帮助你启动 ORB 程序,并获得更好,更流畅的体验。
|
||||
|
||||
让我们先安装 ORB 启动器。为此,[**下载 ORB 启动器**][1]。你可以手动下载 ORB 启动器的 ISO 并将其挂载到文件管理器上。或者在终端中运行以下任一命令来安装它:
|
||||
```
|
||||
$ wget -O - https://www.orbital-apps.com/orb.sh | bash
|
||||
|
||||
```
|
||||
|
||||
如果你没有 wget,请运行:
|
||||
```
|
||||
$ curl https://www.orbital-apps.com/orb.sh | bash
|
||||
|
||||
```
|
||||
|
||||
询问时输入 root 用户和密码。
|
||||
|
||||
就是这样。Orbit 启动器已安装并可以使用。
|
||||
|
||||
现在,进入 [**ORB 可移动程序下载页面**][2],并下载你选择的程序。在本教程中,我会下载 Firefox。
|
||||
|
||||
下载完后,进入下载位置并双击 ORB 程序来启动它。点击 Yes 确认。
|
||||
|
||||
![][4]
|
||||
|
||||
Firefox ORB 程序能用了!
|
||||
|
||||
![][5]
|
||||
|
||||
同样,你可以立即下载并运行任何程序。
|
||||
|
||||
如果你不想使用 ORB 启动器,请将下载的 .orb 安装程序设置为可执行文件,然后双击它进行安装。不过,建议使用 ORB 启动器,它可让你在使用 ORB 程序时更轻松、更顺畅。
|
||||
|
||||
就我测试的 ORB 程序而言,它们打开即可使用。希望这篇文章有帮助。今天就是这些。祝你有美好的一天!
|
||||
|
||||
干杯!!
|
||||
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://www.ostechnix.com/orbitalapps-new-generation-ubuntu-linux-applications/
|
||||
|
||||
作者:[SK][a]
|
||||
选题:[lujun9972](https://github.com/lujun9972)
|
||||
译者:[geekpi](https://github.com/geekpi)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]:https://www.ostechnix.com/author/sk/
|
||||
[1]:https://www.orbital-apps.com/documentation/orb-launcher-all-installers
|
||||
[2]:https://www.orbital-apps.com/download/portable_apps_linux/
|
||||
[3]:data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7
|
||||
[4]:http://www.ostechnix.com/wp-content/uploads/2016/05/orbital-apps-1-2.png
|
||||
[5]:http://www.ostechnix.com/wp-content/uploads/2016/05/orbital-apps-2.png
|
@ -1,38 +1,36 @@
|
||||
pinewall translating
|
||||
|
||||
3 Methods To Install Latest Python3 Package On CentOS 6 System
|
||||
在 CentOS 6 系统上安装最新版 Python3 软件包的 3 种方法
|
||||
======
|
||||
CentOS is RHEL clone and comes with free of cost. It’s a industry standard and cutting edge operating system, this has been used by 90% of webhosting provider since it’s supporting the leading edge server control panel called cPanel/WHM.
|
||||
CentOS 克隆自 RHEL,无需付费即可使用。CentOS 是一个企业级标准的、前沿的操作系统,被超过 90% 的网络主机托管商采用,因为它提供了技术领先的服务器控制面板 cPanel/WHM。
|
||||
|
||||
This control panel allowing users to manage everything through control panel without entering into terminal.
|
||||
该控制面板使得用户无需进入命令行即可通过其管理一切。
|
||||
|
||||
As we already know that RHEL has long term support and doesn’t offer the latest version of packages due to stability.
|
||||
众所周知,RHEL 提供长期支持,出于稳定性考虑,不提供最新版本的软件包。
|
||||
|
||||
If you want to install latest version of packages, which is not available in the default repository and you have to install manually by compiling the source package.
|
||||
如果你想安装的最新版本软件包不在默认源中,你需要手动编译源码安装。
|
||||
|
||||
It’s a high risk because we can’t upgrade the manually installed packages to latest version if they release new version and we have to reinstall manually.
|
||||
但手动编译安装的方式有不小的风险,即如果出现新版本,无法升级手动安装的软件包;你不得不重新手动安装。
|
||||
|
||||
In this case what will be the solution and suggested method to install latest version of package? Yes, this can be done by adding the necessary third party repository to system.
|
||||
那么在这种情况下,安装最新版软件包的推荐方法和方案是什么呢?是的,可以通过为系统添加所需的第三方源来达到目的。
|
||||
|
||||
There are many third party repositories are available for Enterprise Linux but only few of repositories are suggested to use by CentOS communicant, which doesn’t alter the base packages in large scale.
|
||||
可供企业级 Linux 使用的第三方源有很多,但只有几个是 CentOS 社区推荐使用的,它们在很大程度上不修改基础软件包。
|
||||
|
||||
They are usually well maintained and provide a substantial number of additional packages to CentOS.
|
||||
这几个推荐的源维护的很好,为 CentOS 提供大量补充软件包。
|
||||
|
||||
In this tutorial, we will teach you, how to install latest Python 3 package on CentOS 6 system.
|
||||
在本教程中,我们将向你展示,如何在 CentOS 6 操作系统上安装最新版本的 Python 3 软件包。
|
||||
|
||||
### Method-1 : Using Software Collections Repository (SCL)
|
||||
### 方法 1:使用 Software Collections 源 (SCL)
|
||||
|
||||
The SCL repository is now maintained by a CentOS SIG, which rebuilds the Red Hat Software Collections and also provides some additional packages of their own.
|
||||
SCL 源目前由 CentOS SIG 维护,除了重新编译构建 Red Hat 的 Software Collections 外,还额外提供一些它们自己的软件包。
|
||||
|
||||
It contains newer versions of various programs that can be installed alongside existing older packages and invoked by using the scl command.
|
||||
该源中包含不少程序的更高版本,可以在不改变原有旧版本程序包的情况下安装,使用时需要通过 scl 命令调用。
|
||||
|
||||
Run the following command to install Software Collections Repository on CentOS
|
||||
运行如下命令可以在 CentOS 上安装 SCL 源:
|
||||
```
|
||||
# yum install centos-release-scl
|
||||
|
||||
```
|
||||
|
||||
Check the available python 3 version.
|
||||
检查可用的 Python 3 版本:
|
||||
```
|
||||
# yum info rh-python35
|
||||
Loaded plugins: fastestmirror, security
|
||||
@ -53,49 +51,49 @@ Description : This is the main package for rh-python35 Software Collection.
|
||||
|
||||
```
|
||||
|
||||
Run the below command to install latest available python 3 package from scl.
|
||||
运行如下命令从 scl 源安装可用的最新版 python 3:
|
||||
```
|
||||
# yum install rh-python35
|
||||
|
||||
```
|
||||
|
||||
Run the below special scl command to enable the installed package version at the shell.
|
||||
运行如下特殊的 scl 命令,在当前 shell 中启用安装的软件包:
|
||||
```
|
||||
# scl enable rh-python35 bash
|
||||
|
||||
```
|
||||
|
||||
Run the below command to check installed python3 version.
|
||||
运行如下命令检查安装的 python3 版本:
|
||||
```
|
||||
# python --version
|
||||
Python 3.5.1
|
||||
|
||||
```
|
||||
|
||||
Run the following command to get a list of SCL packages have been installed on system.
|
||||
运行如下命令获取系统已安装的 SCL 软件包列表:
|
||||
```
|
||||
# scl -l
|
||||
rh-python35
|
||||
|
||||
```
|
||||
|
||||
### Method-2 : Using EPEL Repository (Extra Packages for Enterprise Linux)
|
||||
### 方法 2:使用 EPEL 源 (Extra Packages for Enterprise Linux)
|
||||
|
||||
EPEL stands for Extra Packages for Enterprise Linux maintained by Fedora Special Interest Group.
|
||||
EPEL 是 Extra Packages for Enterprise Linux 的缩写,该源由 Fedora SIG (Special Interest Group) 维护。
|
||||
|
||||
They creates, maintains, and manages a high quality set of additional packages for Enterprise Linux, including, but not limited to, Red Hat Enterprise Linux (RHEL), CentOS and Scientific Linux (SL), Oracle Linux (OL).
|
||||
该 SIG 为企业级 Linux 创建、维护并管理一系列高品质补充软件包,受益的企业级 Linux 发行版包括但不限于红帽企业级 Linux (RHEL), CentOS, Scientific Linux (SL) 和 Oracle Linux (OL)等。
|
||||
|
||||
EPEL packages are usually based on their Fedora counterparts and will never conflict with or replace packages in the base Enterprise Linux distributions.
|
||||
EPEL 通常基于 Fedora 对应代码提供软件包,不会与企业级 Linux 发行版中的基础软件包冲突或替换其中的软件包。
|
||||
|
||||
**Suggested Read :** [Install / Enable EPEL Repository on RHEL, CentOS, Oracle Linux & Scientific Linux][1]
|
||||
**推荐阅读:** [在 RHEL, CentOS, Oracle Linux 或 Scientific Linux 上安装启用 EPEL 源][1]
|
||||
|
||||
EPEL package is included in the CentOS Extras repository and enabled by default so, we can install this by running below command.
|
||||
EPEL 软件包位于 CentOS 的 Extra 源中,已经默认启用,故我们只需运行如下命令即可:
|
||||
```
|
||||
# yum install epel-release
|
||||
|
||||
```
|
||||
|
||||
Check the available python 3 version.
|
||||
检查可用的 python 3 版本:
|
||||
```
|
||||
# yum --disablerepo="*" --enablerepo="epel" info python34
|
||||
Loaded plugins: fastestmirror, security
|
||||
@ -119,13 +117,13 @@ Description : Python 3 is a new version of the language that is incompatible wit
|
||||
|
||||
```
|
||||
|
||||
Run the below command to install latest available python 3 package from EPEL repository.
|
||||
运行如下命令从 EPEL 源安装可用的最新版 python 3 软件包:
|
||||
```
|
||||
# yum --disablerepo="*" --enablerepo="epel" install python34
|
||||
|
||||
```
|
||||
|
||||
By default this will not install matching pip & setuptools and we have to install by running below command.
|
||||
默认情况下并不会安装 pip 和 setuptools,我们需要运行如下命令手动安装:
|
||||
```
|
||||
# curl -O https://bootstrap.pypa.io/get-pip.py
|
||||
% Total % Received % Xferd Average Speed Time Time Time Current
|
||||
@ -146,28 +144,28 @@ Successfully installed pip-10.0.1 setuptools-39.1.0 wheel-0.31.0
|
||||
|
||||
```
|
||||
|
||||
Run the below command to check installed python3 version.
|
||||
运行如下命令检查已安装的 python3 版本:
|
||||
```
|
||||
# python3 --version
|
||||
Python 3.4.5
|
||||
|
||||
```
|
||||
|
||||
### Method-3 : Using IUS Community Repository
|
||||
### 方法 3:使用 IUS 社区源
|
||||
|
||||
IUS Community is a CentOS Community Approved third-party RPM repository which contains latest upstream versions of PHP, Python, MySQL, etc.., packages for Enterprise Linux (RHEL & CentOS) 5, 6 & 7.
|
||||
IUS 社区是 CentOS 社区批准的第三方 RPM 源,为企业级 Linux (RHEL 和 CentOS) 5, 6 和 7 版本提供最新上游版本的 PHP, Python, MySQL 等软件包。
|
||||
|
||||
IUS Community Repository have dependency with EPEL Repository so we have to install EPEL repository prior to IUS repository installation. Follow the below steps to install & enable EPEL & IUS Community Repository to RPM systems and install the packages.
|
||||
IUS 社区源依赖于 EPEL 源,故我们需要先安装 EPEL 源,然后再安装 IUS 社区源。按照下面的步骤安装启用 EPEL 源和 IUS 社区源,利用该 RPM 系统安装软件包。
|
||||
|
||||
**Suggested Read :** [Install / Enable IUS Community Repository on RHEL & CentOS][2]
|
||||
**推荐阅读:** [在 RHEL 或 CentOS 上安装启用 IUS 社区源][2]
|
||||
|
||||
EPEL package is included in the CentOS Extras repository and enabled by default so, we can install this by running below command.
|
||||
EPEL 软件包位于 CentOS 的 Extra 源中,已经默认启用,故我们只需运行如下命令即可:
|
||||
```
|
||||
# yum install epel-release
|
||||
|
||||
```
|
||||
|
||||
Download IUS Community Repository Shell script
|
||||
下载 IUS 社区源安装脚本:
|
||||
```
|
||||
# curl 'https://setup.ius.io/' -o setup-ius.sh
|
||||
% Total % Received % Xferd Average Speed Time Time Time Current
|
||||
@ -176,13 +174,13 @@ Download IUS Community Repository Shell script
|
||||
|
||||
```
|
||||
|
||||
Install/Enable IUS Community Repository.
|
||||
安装启用 IUS 社区源:
|
||||
```
|
||||
# sh setup-ius.sh
|
||||
|
||||
```
|
||||
|
||||
Check the available python 3 version.
|
||||
检查可用的 python 3 版本:
|
||||
```
|
||||
# yum --enablerepo=ius info python36u
|
||||
Loaded plugins: fastestmirror, security
|
||||
@ -220,13 +218,13 @@ Description : Python is an accessible, high-level, dynamically typed, interprete
|
||||
|
||||
```
|
||||
|
||||
Run the below command to install latest available python 3 package from IUS repository.
|
||||
运行如下命令从 IUS 源安装最新可用版本的 python 3 软件包:
|
||||
```
|
||||
# yum --enablerepo=ius install python36u
|
||||
|
||||
```
|
||||
|
||||
Run the below command to check installed python3 version.
|
||||
运行如下命令检查已安装的 python3 版本:
|
||||
```
|
||||
# python3.6 --version
|
||||
Python 3.6.5
|
||||
@ -239,7 +237,7 @@ via: https://www.2daygeek.com/3-methods-to-install-latest-python3-package-on-cen
|
||||
|
||||
作者:[PRAKASH SUBRAMANIAN][a]
|
||||
选题:[lujun9972](https://github.com/lujun9972)
|
||||
译者:[译者ID](https://github.com/译者ID)
|
||||
译者:[pinewall](https://github.com/pinewall)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
@ -0,0 +1,47 @@
|
||||
LikeCoin,一种给创作者的开放内容许可的加密货币
|
||||
======
|
||||
![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/osdc_whitehurst_money.png?itok=ls-SOzM0)
|
||||
|
||||
传统观点表明,作家、摄影师、艺术家和其他创作者在 Creative Commons 和其他开放许可下免费共享内容的不会得到报酬。这意味着大多数独立创作者无法通过在互联网上发布他们的作品来赚钱。输入 [LikeCoin][1]:一个新的开源项目,旨在制定这个惯例,艺术家经常为了分发而不得不妥协或牺牲,这是过去的事情。
|
||||
|
||||
LikeCoin 协议旨在通过创意内容获利,因此创作者可以专注于创造出色的内容而不是出售。
|
||||
|
||||
协议同样基于去中心化技术,它可以跟踪何时使用内容,并使用 LikeCoin,一种 [Ethereum ERC-20][2] 加密货币令牌奖励其创作者。它通过“创造性证明”算法进行操作,该算法一部分根据作品收到多少个“喜欢”,一部分根据有多少作品衍生自它而分配 LikeCoin。由于开放授权内容有更多机会被重复使用并获得 LikeCoin 令牌,因此系统鼓励内容创作者在 Creative Commons 许可下发布。
|
||||
|
||||
### 如何运行
|
||||
|
||||
当通过 LikeCoin 协议上传创意片段时,内容创作者将包括作品的元数据,包括作者信息及其 InterPlanetary 关联数据([IPLD][3])。这些数据构成了衍生作品的家族图表;我们称作品与其衍生品之间的关系为“内容足迹”。这种结构使得内容的继承树可以很容易地追溯到原始作品。
|
||||
|
||||
LikeCoin 令牌将作品衍生历史记录的信息分发给创作者。由于所有创意作品都包含作者钱包的元数据,因此相应的 LikeCoin 份额可以通过算法计算并分发。
|
||||
|
||||
LikeCoin 可以通过两种方式获得奖励:直接由想要通过支付内容创建者来表示赞赏的个人或通过 Creators Pool 收集观众的“赞”的并根据内容的 LikeRank 分配 LikeCoin。基于在 LikeCoin 协议中的内容追踪,LikeRank 衡量作品重要性(或者我们在这定义的创造性)。一般来说,一副作品有越多的衍生作品,创意内容的创新越多,内容就会有更高的 LikeRank。 LikeRank 是内容创新性的量化者。
|
||||
|
||||
### 如何参与?
|
||||
|
||||
LikeCoin 仍然非常新,我们期望在 2018 年晚些时候推出我们的第一个去中心化程序来奖励 Creative Commons 的内容,并与更大的社区无缝连接。
|
||||
|
||||
LikeCoin 的大部分代码都可以在 [LikeCoin GitHub][4] 仓库中通过[ GPL 3.0 许可证][5]访问。由于它仍处于积极开发阶段,一些实验代码尚未公开,但我们会尽快完成。
|
||||
|
||||
我们欢迎功能请求,pull request,fork 和 star。请参与我们在 Github 上的开发,并加入我们在 [Telegram][6] 的讨论组。我们同样在 [Medium][7]、[Facebook][8]、[Twitter][9] 和我们的网站 [like.co][1] 发布关于我们进展的最新消息。
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://opensource.com/article/18/5/likecoin
|
||||
|
||||
作者:[Kin Ko][a]
|
||||
选题:[lujun9972](https://github.com/lujun9972)
|
||||
译者:[geekpi](https://github.com/geekpi)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]:https://opensource.com/users/ckxpress
|
||||
[1]:https://like.co/
|
||||
[2]:https://en.wikipedia.org/wiki/ERC20
|
||||
[3]:https://ipld.io/
|
||||
[4]:https://github.com/likecoin
|
||||
[5]:https://www.gnu.org/licenses/gpl-3.0.en.html
|
||||
[6]:https://t.me/likecoin
|
||||
[7]:http://medium.com/likecoin
|
||||
[8]:http://fb.com/likecoin.foundation
|
||||
[9]:https://twitter.com/likecoin_fdn
|
Loading…
Reference in New Issue
Block a user