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
5a69bb1312
@ -1,18 +1,20 @@
|
||||
[#]: collector: "lujun9972"
|
||||
[#]: translator: "FSSlc"
|
||||
[#]: reviewer: " "
|
||||
[#]: publisher: " "
|
||||
[#]: url: " "
|
||||
[#]: reviewer: "wxy"
|
||||
[#]: publisher: "wxy"
|
||||
[#]: url: "https://linux.cn/article-12051-1.html"
|
||||
[#]: subject: "ffsend – Easily And Securely Share Files From Linux Command Line Using Firefox Send Client"
|
||||
[#]: via: "https://www.2daygeek.com/ffsend-securely-share-files-folders-from-linux-command-line-using-firefox-send-client/"
|
||||
[#]: author: "Vinoth Kumar https://www.2daygeek.com/author/vinoth/"
|
||||
|
||||
ffsend - 在 Linux 命令行中通过 FireFox Send 服务来简单安全地分享文件
|
||||
ffsend:在命令行中通过 FireFox Send 分享文件
|
||||
======
|
||||
|
||||
Linux 用户更偏爱使用 `scp` 或 `rsync` 来进行文件或目录的复制拷贝。很多新的可选方式正发生在 Linux 上,因为 Linux 是开源的,所以任何人都可以为 Linux 开发一个安全软件。
|
||||
![](https://img.linux.net.cn/data/attachment/album/202003/29/202308w7ormrouomij2dzq.jpg)
|
||||
|
||||
在过去我们已经写了多篇有关安全分享这个话题的文章,它们分别是 **[OnionShare][1]** , **[Magic Wormhole][2]** , **[Transfer.sh][3]** 和 **[Dcp – Dat Copy][4]**.
|
||||
Linux 用户偏爱使用 `scp` 或 `rsync` 来进行文件或目录的复制拷贝。不过在 Linux 上正出现了许多新的可选方式,因为 Linux 是开源的,所以任何人都可以为 Linux 开发一个安全软件。
|
||||
|
||||
在过去我们已经写了多篇有关安全分享这个话题的文章,它们分别是 [OnionShare][1]、[Magic Wormhole][2]、[Transfer.sh][3] 和 [Dcp – Dat Copy][4]。
|
||||
|
||||
今天我们甚至还将继续讨论这个话题,我们将介绍名为 `ffsend` 的工具。
|
||||
|
||||
@ -22,33 +24,33 @@ Linux 用户更偏爱使用 `scp` 或 `rsync` 来进行文件或目录的复制
|
||||
|
||||
它允许我们通过一个安全、私密、加密的链接,使用一个简单的命令来轻易安全地分享文件和目录。
|
||||
|
||||
使用 Firefox 的 Send 服务,文件可以被共享,最大允许的文件大小为 2GB(译者注:现在官网上写的是最大 1GB,登录后最大 2.5GB)。其他人可以通过这个工具或者网页浏览器来下载这些被分享的文件。
|
||||
通过 Firefox 的 Send 服务共享的文件最大大小为 2GB(LCTT 译注:现在官网上写的是最大 1GB,登录后最大 2.5GB)。其他人可以通过这个工具或者网页浏览器来下载这些分享的文件。
|
||||
|
||||
所有的文件总是在客户端被加密,并且秘钥将不会被远程主机所分享。另外,你还可以为上传的文件设置密码。
|
||||
所有的文件都是在客户端加密的,并且秘钥将不会被共享到远程主机。另外,你还可以为上传的文件额外设置一个密码。
|
||||
|
||||
被上传的文件在被下载(默认被下载 1 次,最多可被下载 10 次)后或者 24 小时后,它们将被自动删除。这将确保你的文件不会永远的保留在网络上。
|
||||
上传的文件在下载(默认被下载 1 次,最多可被下载 10 次)后或者 24 小时后,就会自动删除。这将确保你的文件不会一直保留在网络上。
|
||||
|
||||
该工具当前处于 alpha 阶段,使用时请自担风险。而且,当前只有有限个安装选项可用。
|
||||
该工具当前处于 alpha 阶段,使用时请自担风险。而且,当前只有有限的安装方式可用。
|
||||
|
||||
### ffsend 的特点:
|
||||
|
||||
* 全功能且友好的命令行工具
|
||||
* 安全地上传和下载文件与目录
|
||||
* 在客户端总是被加密
|
||||
* 额外的密码保护,密码生成和可配置下载次数限制
|
||||
* 内置文件或目录的打包和解压
|
||||
* 可以简单地管理你的历史分享记录
|
||||
* 能够使用你自己的发送主机
|
||||
* 查看或者删除共享文件
|
||||
* 全功能且使用友好的命令行工具
|
||||
* 可以安全地上传和下载文件与目录
|
||||
* 总是在客户端加密
|
||||
* 可用额外的密码进行保护、密码生成和可配置下载次数限制
|
||||
* 内置的文件或目录的打包和解压
|
||||
* 可以轻松地管理你的历史分享记录
|
||||
* 能够使用你自己的 Send 主机
|
||||
* 审查或者删除共享文件
|
||||
* 精准的错误报告
|
||||
* 由加密或上传下载导致的低内存消耗
|
||||
* 无需集成就可被用在脚本中
|
||||
* 低内存消耗,用于加密或上传下载
|
||||
* 无需交互,可以集成在脚本中
|
||||
|
||||
### 如何在 LInux 中安装 ffsend 呢?
|
||||
|
||||
当前除了 Debian 和 Arch Linux 系统,其他发行版还没有相应的安装包(译者注:这个信息已过时,最新内容请看[这里](https://github.com/timvisee/ffsend#install))。然而,我们可以轻易地根据我们自己的操作系统和架构下载到相应的预编译二进制文件。
|
||||
当前除了 Debian 和 Arch Linux 系统,其他发行版还没有相应的安装包(LCTT 译注:这个信息已过时,最新内容请看[这里](https://github.com/timvisee/ffsend#install))。然而,我们可以轻易地根据我们自己的操作系统和架构下载到相应的预编译二进制文件。
|
||||
|
||||
运行下面的命令来为你的操作系统下载 `ffsend` 最新可用的版本(译者注:当前最新版本为 v0.2.58):
|
||||
运行下面的命令来为你的操作系统下载 `ffsend` 最新可用的版本(LCTT 译注:当前最新版本为 v0.2.58):
|
||||
|
||||
```
|
||||
$ wget https://github.com/timvisee/ffsend/releases/download/v0.1.2/ffsend-v0.1.2-linux-x64.tar.gz
|
||||
@ -91,20 +93,20 @@ To show all subcommands, features and other help:
|
||||
ffsend help [SUBCOMMAND]
|
||||
```
|
||||
|
||||
对于使用基于 Arch Linux 系统的用户可以简单地借助 **[AUR Helper][6]** 来安装它,因为这个包已经在 AUR 软件仓库中了。
|
||||
对于使用基于 Arch Linux 系统的用户可以简单地借助 [AUR 助手][6]来安装它,因为这个包已经在 AUR 软件仓库中了。
|
||||
|
||||
```
|
||||
$ yay -S ffsend
|
||||
```
|
||||
|
||||
对于使用 **`Debian/Ubuntu`** 系统的用户,使用 **[DPKG 命令][7]** 来安装 `ffsend`。
|
||||
对于使用 Debian/Ubuntu 系统的用户,使用 [DPKG 命令][7]来安装 `ffsend`。
|
||||
|
||||
```
|
||||
$ wget https://github.com/timvisee/ffsend/releases/download/v0.1.2/ffsend_0.1.2_amd64.deb
|
||||
$ sudo dpkg -i ffsend_0.1.2_amd64.deb
|
||||
```
|
||||
|
||||
### 如何使用 ffsend 来发送文件?
|
||||
### 如何使用 ffsend
|
||||
|
||||
这并不复杂,我们可以简单地通过下面的语法来发送文件。
|
||||
|
||||
@ -240,56 +242,19 @@ $ ffsend delete https://send.firefox.com/download/69afaab1f9/#5z51_94jtxcUCJNNvf
|
||||
File deleted
|
||||
```
|
||||
|
||||
另外,你还可以通过使用 firefox 浏览其打开 https://send.firefox.com/ 来完成相应的分享。
|
||||
### 如何在浏览器中使用 Send
|
||||
|
||||
另外,你还可以通过使用 firefox 浏览器打开 https://send.firefox.com/ 来完成相应的分享。
|
||||
|
||||
只需要拖拽该文件就可以上传它:
|
||||
|
||||
![][11]
|
||||
|
||||
一旦该文件被下载,它将展示 100% 的下载状态。
|
||||
|
||||
![][12]
|
||||
|
||||
想查看其他的可能选项,请浏览它对应的 man 信息或者帮助页:
|
||||
|
||||
```
|
||||
$ ffsend --help
|
||||
ffsend 0.1.2
|
||||
Tim Visee
|
||||
Easily and securely share files from the command line.
|
||||
A fully featured Firefox Send client.
|
||||
|
||||
USAGE:
|
||||
ffsend [FLAGS] [OPTIONS] [SUBCOMMAND]
|
||||
|
||||
FLAGS:
|
||||
-f, --force Force the action, ignore warnings
|
||||
-h, --help Prints help information
|
||||
-i, --incognito Don't update local history for actions
|
||||
-I, --no-interact Not interactive, do not prompt
|
||||
-q, --quiet Produce output suitable for logging and automation
|
||||
-V, --version Prints version information
|
||||
-v, --verbose Enable verbose information and logging
|
||||
-y, --yes Assume yes for prompts
|
||||
|
||||
OPTIONS:
|
||||
-H, --history Use the specified history file [env: FFSEND_HISTORY]
|
||||
-t, --timeout Request timeout (0 to disable) [env: FFSEND_TIMEOUT]
|
||||
-T, --transfer-timeout Transfer timeout (0 to disable) [env: FFSEND_TRANSFER_TIMEOUT]
|
||||
|
||||
SUBCOMMANDS:
|
||||
upload Upload files [aliases: u, up]
|
||||
download Download files [aliases: d, down]
|
||||
debug View debug information [aliases: dbg]
|
||||
delete Delete a shared file [aliases: del]
|
||||
exists Check whether a remote file exists [aliases: e]
|
||||
help Prints this message or the help of the given subcommand(s)
|
||||
history View file history [aliases: h]
|
||||
info Fetch info about a shared file [aliases: i]
|
||||
parameters Change parameters of a shared file [aliases: params]
|
||||
password Change the password of a shared file [aliases: pass, p]
|
||||
|
||||
The public Send service that is used as default host is provided by Mozilla.
|
||||
This application is not affiliated with Mozilla, Firefox or Firefox Send.
|
||||
```
|
||||
想查看其他的可能选项,请浏览它对应的 man 信息或者帮助页。
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
@ -298,16 +263,16 @@ via: https://www.2daygeek.com/ffsend-securely-share-files-folders-from-linux-com
|
||||
作者:[Vinoth Kumar][a]
|
||||
选题:[lujun9972][b]
|
||||
译者:[FSSlc](https://github.com/FSSlc)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
校对:[wxy](https://github.com/wxy)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]: https://www.2daygeek.com/author/vinoth/
|
||||
[b]: https://github.com/lujun9972
|
||||
[1]: https://www.2daygeek.com/onionshare-secure-way-to-share-files-sharing-tool-linux/
|
||||
[1]: https://linux.cn/article-9177-1.html
|
||||
[2]: https://www.2daygeek.com/wormhole-securely-share-files-from-linux-command-line/
|
||||
[3]: https://www.2daygeek.com/transfer-sh-easy-fast-way-share-files-over-internet-from-command-line/
|
||||
[4]: https://www.2daygeek.com/dcp-dat-copy-secure-way-to-transfer-files-between-linux-systems/
|
||||
[4]: https://linux.cn/article-10516-1.html
|
||||
[5]: https://github.com/timvisee/ffsend
|
||||
[6]: https://www.2daygeek.com/category/aur-helper/
|
||||
[7]: https://www.2daygeek.com/dpkg-command-to-manage-packages-on-debian-ubuntu-linux-mint-systems/
|
@ -112,7 +112,7 @@ Gaudi Labs 的 [PocketPCR][31] 热循环仪可通过升高和降低小试管中
|
||||
|
||||
Folding at Home 项目使用马尔可夫状态模型(如上所示)来建模蛋白质可能采取的形状和折叠途径,以寻找新的治疗机会。你可以在华盛顿大学生物物理学家 Greg Bowman 的帖子《[它是如何运作的以及如何提供帮助][43]》中找到有关该项目的更多信息。
|
||||
|
||||
该项目涉及来自许多国家(包括香港、克罗地亚、瑞典和美国)的财团的学术实验室、贡献者和公司赞助者。 在 [GitHub][45] 上,[在混合了 GPL 和专有许可证][44]下共享,并且可以在 Windows、macOS 和 GNU/Linux(例如 Debian、Ubuntu、Mint、RHEL、CentOS、Fedora)。
|
||||
该项目涉及来自许多国家和地区(包括香港、克罗地亚、瑞典和美国)的财团的学术实验室、贡献者和公司赞助者。 在 [GitHub][45] 上,[在混合了 GPL 和专有许可证][44]下共享,并且可以在 Windows、macOS 和 GNU/Linux(例如 Debian、Ubuntu、Mint、RHEL、CentOS、Fedora)。
|
||||
|
||||
### 许多其他有趣的项目
|
||||
|
||||
@ -129,7 +129,7 @@ Folding at Home 项目使用马尔可夫状态模型(如上所示)来建模
|
||||
|
||||
这些项目遍布全球,而这种全球合作正是我们所需要的,因为病毒无视国界。新冠病毒大流行在不同时期以不同方式影响国家,因此我们需要一种分布式方法。
|
||||
|
||||
正如我和同事 Steven Abadie 在 [OSHdata 2020 报告][54]中所写的那样,开源硬件运动是全球性运动。参与该认证项目的个人和组织遍布全球 35 个国家和每个半球。
|
||||
正如我和同事 Steven Abadie 在 [OSHdata 2020 报告][54]中所写的那样,开源硬件运动是全球性运动。参与该认证项目的个人和组织遍布全球 35 个国家地区和每个半球。
|
||||
|
||||
![Open source hardware map][55]
|
||||
|
||||
|
@ -1,235 +0,0 @@
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: (MjSeven)
|
||||
[#]: reviewer: ( )
|
||||
[#]: publisher: ( )
|
||||
[#]: url: ( )
|
||||
[#]: subject: (Run your blog on GitHub Pages with Python)
|
||||
[#]: via: (https://opensource.com/article/19/5/run-your-blog-github-pages-python)
|
||||
[#]: author: (Erik O'Shaughnessy https://opensource.com/users/jnyjny/users/jasperzanjani/users/jasperzanjani/users/jasperzanjani/users/jnyjny/users/jasperzanjani)
|
||||
|
||||
Run your blog on GitHub Pages with Python
|
||||
======
|
||||
Create a blog with Pelican, a Python-based blogging platform that works
|
||||
well with GitHub.
|
||||
![Raspberry Pi and Python][1]
|
||||
|
||||
[GitHub][2] is a hugely popular web service for source code control that uses [Git][3] to synchronize local files with copies kept on GitHub's servers so you can easily share and back up your work.
|
||||
|
||||
In addition to providing a user interface for code repositories, GitHub also enables users to [publish web pages][4] directly from a repository. The website generation package GitHub recommends is [Jekyll][5], written in Ruby. Since I'm a bigger fan of [Python][6], I prefer [Pelican][7], a Python-based blogging platform that works well with GitHub.
|
||||
|
||||
Pelican and Jekyll both transform content written in [Markdown][8] or [reStructuredText][9] into HTML to generate static websites, and both generators support themes that allow unlimited customization.
|
||||
|
||||
In this article, I'll describe how to install Pelican, set up your GitHub repository, run a quickstart helper, write some Markdown files, and publish your first page. I'll assume that you have a [GitHub account][10], are comfortable with [basic Git commands][11], and want to publish a blog using Pelican.
|
||||
|
||||
### Install Pelican and create the repo
|
||||
|
||||
First things first, Pelican (and **ghp-import** ) must be installed on your local machine. This is super easy with [pip][12], the Python package installation tool (you have pip right?):
|
||||
|
||||
|
||||
```
|
||||
`$ pip install pelican ghp-import`
|
||||
```
|
||||
|
||||
Next, open a browser and create a new repository on GitHub for your sweet new blog. Name it as follows (substituting your GitHub username for <username> here and throughout this tutorial):
|
||||
|
||||
|
||||
```
|
||||
`https://GitHub.com/username/username.github.io`
|
||||
```
|
||||
|
||||
Leave it empty; we will fill it with compelling blog content in a moment.
|
||||
|
||||
Using a command line (you command line right?), clone your empty Git repository to your local machine:
|
||||
|
||||
|
||||
```
|
||||
$ git clone <https://GitHub.com/username/username.github.io> blog
|
||||
$ cd blog
|
||||
```
|
||||
|
||||
### That one weird trick…
|
||||
|
||||
Here's a not-super-obvious trick about publishing web content on GitHub. For user pages (pages hosted in repos named _username.github.io_ ), the content is served from the **master** branch.
|
||||
|
||||
I strongly prefer not to keep all the Pelican configuration files and raw Markdown files in **master** , rather just the web content. So I keep the Pelican configuration and the raw content in a separate branch I like to call **content**. (You can call it whatever you want, but the following instructions will call it **content**.) I like this structure since I can throw away all the files in **master** and re-populate it with the **content** branch.
|
||||
|
||||
|
||||
```
|
||||
$ git checkout -b content
|
||||
Switched to a new branch 'content'
|
||||
```
|
||||
|
||||
### Configure Pelican
|
||||
|
||||
Now it's time for content configuration. Pelican provides a great initialization tool called **pelican-quickstart** that will ask you a series of questions about your blog.
|
||||
|
||||
|
||||
```
|
||||
$ pelican-quickstart
|
||||
Welcome to pelican-quickstart v3.7.1.
|
||||
|
||||
This script will help you create a new Pelican-based website.
|
||||
|
||||
Please answer the following questions so this script can generate the files
|
||||
needed by Pelican.
|
||||
|
||||
> Where do you want to create your new web site? [.]
|
||||
> What will be the title of this web site? Super blog
|
||||
> Who will be the author of this web site? username
|
||||
> What will be the default language of this web site? [en]
|
||||
> Do you want to specify a URL prefix? e.g., <http://example.com> (Y/n) n
|
||||
> Do you want to enable article pagination? (Y/n)
|
||||
> How many articles per page do you want? [10]
|
||||
> What is your time zone? [Europe/Paris] US/Central
|
||||
> Do you want to generate a Fabfile/Makefile to automate generation and publishing? (Y/n) y
|
||||
> Do you want an auto-reload & simpleHTTP script to assist with theme and site development? (Y/n) y
|
||||
> Do you want to upload your website using FTP? (y/N) n
|
||||
> Do you want to upload your website using SSH? (y/N) n
|
||||
> Do you want to upload your website using Dropbox? (y/N) n
|
||||
> Do you want to upload your website using S3? (y/N) n
|
||||
> Do you want to upload your website using Rackspace Cloud Files? (y/N) n
|
||||
> Do you want to upload your website using GitHub Pages? (y/N) y
|
||||
> Is this your personal page (username.github.io)? (y/N) y
|
||||
Done. Your new project is available at /Users/username/blog
|
||||
```
|
||||
|
||||
You can take the defaults on every question except:
|
||||
|
||||
* Website title, which should be unique and special
|
||||
* Website author, which can be a personal username or your full name
|
||||
* Time zone, which may not be in Paris
|
||||
* Upload to GitHub Pages, which is a "y" in our case
|
||||
|
||||
|
||||
|
||||
After answering all the questions, Pelican leaves the following in the current directory:
|
||||
|
||||
|
||||
```
|
||||
$ ls
|
||||
Makefile content/ develop_server.sh*
|
||||
fabfile.py output/ pelicanconf.py
|
||||
publishconf.py
|
||||
```
|
||||
|
||||
You can check out the [Pelican docs][13] to find out how to use those files, but we're all about getting things done _right now_. No, I haven't read the docs yet either.
|
||||
|
||||
### Forge on
|
||||
|
||||
Add all the Pelican-generated files to the **content** branch of the local Git repo, commit the changes, and push the local changes to the remote repo hosted on GitHub by entering:
|
||||
|
||||
|
||||
```
|
||||
$ git add .
|
||||
$ git commit -m 'initial pelican commit to content'
|
||||
$ git push origin content
|
||||
```
|
||||
|
||||
This isn't super exciting, but it will be handy if we need to revert edits to one of these files.
|
||||
|
||||
### Finally getting somewhere
|
||||
|
||||
OK, now you can get bloggy! All of your blog posts, photos, images, PDFs, etc., will live in the **content** directory, which is initially empty. To begin creating a first post and an About page with a photo, enter:
|
||||
|
||||
|
||||
```
|
||||
$ cd content
|
||||
$ mkdir pages images
|
||||
$ cp /Users/username/SecretStash/HotPhotoOfMe.jpg images
|
||||
$ touch first-post.md
|
||||
$ touch pages/about.md
|
||||
```
|
||||
|
||||
Next, open the empty file **first-post.md** in your favorite text editor and add the following:
|
||||
|
||||
|
||||
```
|
||||
title: First Post on My Sweet New Blog
|
||||
date: <today's date>
|
||||
author: Your Name Here
|
||||
|
||||
# I am On My Way To Internet Fame and Fortune!
|
||||
|
||||
This is my first post on my new blog. While not super informative it
|
||||
should convey my sense of excitement and eagerness to engage with you,
|
||||
the reader!
|
||||
```
|
||||
|
||||
The first three lines contain metadata that Pelican uses to organize things. There are lots of different metadata you can put there; again, the docs are your best bet for learning more about the options.
|
||||
|
||||
Now, open the empty file **pages/about.md** and add this text:
|
||||
|
||||
|
||||
```
|
||||
title: About
|
||||
date: <today's date>
|
||||
|
||||
![So Schmexy][my_sweet_photo]
|
||||
|
||||
Hi, I am <username> and I wrote this epic collection of Interweb
|
||||
wisdom. In days of yore, much of this would have been deemed sorcery
|
||||
and I would probably have been burned at the stake.
|
||||
|
||||
😆
|
||||
|
||||
[my_sweet_photo]: {filename}/images/HotPhotoOfMe.jpg
|
||||
```
|
||||
|
||||
You now have three new pieces of web content in your content directory. Of the content branch. That's a lot of content.
|
||||
|
||||
### Publish
|
||||
|
||||
Don't worry; the payoff is coming!
|
||||
|
||||
All that's left to do is:
|
||||
|
||||
* Run Pelican to generate the static HTML files in **output** : [code]`$ pelican content -o output -s publishconf.py`
|
||||
```
|
||||
* Use **ghp-import** to add the contents of the **output** directory to the **master** branch: [code]`$ ghp-import -m "Generate Pelican site" --no-jekyll -b master output`
|
||||
```
|
||||
* Push the local master branch to the remote repo: [code]`$ git push origin master`
|
||||
```
|
||||
* Commit and push the new content to the **content** branch: [code] $ git add content
|
||||
$ git commit -m 'added a first post, a photo and an about page'
|
||||
$ git push origin content
|
||||
```
|
||||
|
||||
|
||||
|
||||
### OMG, I did it!
|
||||
|
||||
Now the exciting part is here, when you get to view what you've published for everyone to see! Open your browser and enter:
|
||||
|
||||
|
||||
```
|
||||
`https://username.github.io`
|
||||
```
|
||||
|
||||
Congratulations on your new blog, self-published on GitHub! You can follow this pattern whenever you want to add more pages or articles. Happy blogging.
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://opensource.com/article/19/5/run-your-blog-github-pages-python
|
||||
|
||||
作者:[Erik O'Shaughnessy][a]
|
||||
选题:[lujun9972][b]
|
||||
译者:[译者ID](https://github.com/译者ID)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]: https://opensource.com/users/jnyjny/users/jasperzanjani/users/jasperzanjani/users/jasperzanjani/users/jnyjny/users/jasperzanjani
|
||||
[b]: https://github.com/lujun9972
|
||||
[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/getting_started_with_python.png?itok=MFEKm3gl (Raspberry Pi and Python)
|
||||
[2]: https://github.com/
|
||||
[3]: https://git-scm.com
|
||||
[4]: https://help.github.com/en/categories/github-pages-basics
|
||||
[5]: https://jekyllrb.com
|
||||
[6]: https://python.org
|
||||
[7]: https://blog.getpelican.com
|
||||
[8]: https://guides.github.com/features/mastering-markdown
|
||||
[9]: http://docutils.sourceforge.net/docs/user/rst/quickref.html
|
||||
[10]: https://github.com/join?source=header-home
|
||||
[11]: https://git-scm.com/docs
|
||||
[12]: https://pip.pypa.io/en/stable/
|
||||
[13]: https://docs.getpelican.com
|
@ -1,168 +0,0 @@
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: (mengxinayan)
|
||||
[#]: reviewer: ( )
|
||||
[#]: publisher: ( )
|
||||
[#]: url: ( )
|
||||
[#]: subject: (Basic Vim Commands You Need to Know to Work in Vim Editor)
|
||||
[#]: via: (https://www.2daygeek.com/basic-vim-commands-cheat-sheet-quick-start-guide/)
|
||||
[#]: author: (Magesh Maruthamuthu https://www.2daygeek.com/author/magesh/)
|
||||
|
||||
Basic Vim Commands You Need to Know to Work in Vim Editor
|
||||
======
|
||||
|
||||
If you are a system administrator or developer, you may need to edit a file while working on the Linux terminal.
|
||||
|
||||
There are several file editors on Linux, and how to choose the right one for your needs.
|
||||
|
||||
I would like to recommend Vim editor.
|
||||
|
||||
### You may ask, why?
|
||||
|
||||
You may spend more time in the editor to modify an existing file than writing new text.
|
||||
|
||||
In this case, Vim Keyboard shortcuts allow you to efficiently meet your needs.
|
||||
|
||||
The following articles may help you learn about file and directory manipulation.
|
||||
|
||||
* [**L**][1]**[inux Basic – Linux and Unix Commands for File and Directory Manipulation][1]**
|
||||
* **[10 Methods to View Different File Formats in Linux][2]**
|
||||
|
||||
|
||||
|
||||
### What’s vim?
|
||||
|
||||
Vim is one of the most popular and powerful text editor that widely used by Linux administrators and developers.
|
||||
|
||||
It’s highly configurable text editor which enables efficient text editing. This is an updated version of the vi editor, which is already installed on most Unix systems.
|
||||
|
||||
Vim is often called a “programmer’s editor,” but it is not limited to it, and is suitable for all types of text editing.
|
||||
|
||||
It comes with many features like multi level undo, multi windows and buffers, syntax highlighting, command line editing, file name completion, visual selection.
|
||||
|
||||
You can easily obtain online help with the “:help” command.
|
||||
|
||||
### Understanding Vim Modes
|
||||
|
||||
Vim has two modes, the details are below:
|
||||
|
||||
**Command Mode:** When you launch Vim Editor, you will default to Command Mode. You can move around the file, and modify some parts of the text, cut, copy, and paste parts of the text and issue commands to do more (press ESC for Command Mode).
|
||||
|
||||
**Insert Mode:** The nsert mode is used to type text in a given given document (Press i for insert mode).
|
||||
|
||||
### How do I know which Vim mode I am on?
|
||||
|
||||
If you are in insert mode, you will see **“INSERT”** at the bottom of the editor. If nothing is shown, or if it shows the file name at the bottom of the editor, you are in “Command Mode”.
|
||||
|
||||
### Cursor Movement in Normal Mode
|
||||
|
||||
These Vim keyboard shortcuts allow you to move your cursor around a file in different ways.
|
||||
|
||||
* `G` – Go to the last line of the file
|
||||
* `gg` – Go to the first line of the file
|
||||
* `$` – Go to the end of line.
|
||||
* `0` (zero) – Go to the beginning of line.
|
||||
|
||||
|
||||
* `w` – Jump by start of words
|
||||
* `W` – Jump by words (spaces separate words)
|
||||
* `b` – Jump backward by words
|
||||
* `B` – Jump backward by words (spaces separate words)
|
||||
|
||||
|
||||
* `PgDn` Key – Move down page-wise
|
||||
* `PgUp` Key – Move up page-wise
|
||||
* `Ctrl+d` – Move half-page down
|
||||
* `Ctrl+u` – Move half-page up
|
||||
|
||||
|
||||
|
||||
### Insert mode – insert a text
|
||||
|
||||
These vim keyboard shortcuts allows you to insert a cursor in varies position based on your needs.
|
||||
|
||||
* `i` – Insert before the cursor
|
||||
* `a` – Insert after the cursor
|
||||
* `I` – Insert at the beginning of the line, this is useful when you are in the middle of the line.
|
||||
* `A` – Insert at the end of the line
|
||||
* `o` – Open a new line below the current line
|
||||
* `O` – Append a new line above the current line
|
||||
* `ea` – Insert at the end of the word
|
||||
|
||||
|
||||
|
||||
### Copy, Paste and Delete a Line
|
||||
|
||||
* `yy` – yank (copy) a line
|
||||
* `p/P` – Paste after cursor/ put before cursor
|
||||
* `dd` – delete a line
|
||||
* `dw` – delete the word
|
||||
|
||||
|
||||
|
||||
### Search and Replace Pattern in Vim
|
||||
|
||||
* `/pattern` – To search a given pattern
|
||||
* `?pattern` – To search backward a given pattern
|
||||
* `n` – To repeat search
|
||||
* `N` – To repeat backward search
|
||||
|
||||
|
||||
* `:%s/old-pattern/new-pattern/g` – Replace all old formats with the new format across the file.
|
||||
* `:s/old-pattern/new-pattern/g` – Replace all old formats with the new format in the current line.
|
||||
* `:%s/old-pattern/new-pattern/gc` – Replace all old formats with the new format across the file with confirmations.
|
||||
|
||||
|
||||
|
||||
### How do I go to a particular line in Vim Editor
|
||||
|
||||
You can do this in two ways, depending on your need. If you don’t know the line number I suggest you go with the first method.
|
||||
|
||||
Add line number by opening a file and running the command below.
|
||||
|
||||
```
|
||||
:set number
|
||||
```
|
||||
|
||||
Once you have set the line number, press **“: n”** to go to the corresponding line number. For example, if you want to go to **line 15**, enter.
|
||||
|
||||
```
|
||||
:15
|
||||
```
|
||||
|
||||
If you already know the line number, use the following method to go directly to the corresponding line. For example, if you want to move to line 20, enter the command below.
|
||||
|
||||
```
|
||||
$ vim +20 [File_Name]
|
||||
```
|
||||
|
||||
### Undo/Redo/Repeat Operation
|
||||
|
||||
* `u` – Undo the changes
|
||||
* `Ctrl+r` – Redo the changes
|
||||
* `.` – Repeat last command
|
||||
|
||||
|
||||
|
||||
### Saving and Exiting Vim
|
||||
|
||||
* `:w` – Save the changes but don’t exit
|
||||
* `:wq` – Write and quit
|
||||
* `:q!` – Force quit
|
||||
|
||||
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://www.2daygeek.com/basic-vim-commands-cheat-sheet-quick-start-guide/
|
||||
|
||||
作者:[Magesh Maruthamuthu][a]
|
||||
选题:[lujun9972][b]
|
||||
译者:[萌新阿岩](https://github.com/mengxinayan)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]: https://www.2daygeek.com/author/magesh/
|
||||
[b]: https://github.com/lujun9972
|
||||
[1]: https://www.2daygeek.com/linux-basic-commands-file-directory-manipulation/
|
||||
[2]: https://www.2daygeek.com/unix-linux-command-to-view-file/
|
@ -1,5 +1,5 @@
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: ( )
|
||||
[#]: translator: (MjSeven)
|
||||
[#]: reviewer: ( )
|
||||
[#]: publisher: ( )
|
||||
[#]: url: ( )
|
||||
|
@ -1,107 +0,0 @@
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: (HankChow)
|
||||
[#]: reviewer: ( )
|
||||
[#]: publisher: ( )
|
||||
[#]: url: ( )
|
||||
[#]: subject: (How open source software is fighting COVID-19)
|
||||
[#]: via: (https://opensource.com/article/20/3/open-source-software-covid19)
|
||||
[#]: author: (Jeff Stern https://opensource.com/users/jeffstern)
|
||||
|
||||
How open source software is fighting COVID-19
|
||||
======
|
||||
Learn about four of the thousands of open source projects combating the
|
||||
spread of coronavirus.
|
||||
![symbols showing healthcare][1]
|
||||
|
||||
Work is hard right now. COVID-19 makes it a challenge to stay focused and motivated. But it was cathartic for me to do some research into how the open source community is responding to the global pandemic.
|
||||
|
||||
Since the end of January, the community has contributed to [thousands of open source repositories][2] that mention coronavirus or COVID-19. These repositories consist of datasets, models, visualizations, web and mobile applications, and more, and the majority are written in JavaScript and Python.
|
||||
|
||||
Previously, we shared information about several [open hardware makers helping][3] to stop the spread and suffering caused by the coronavirus. Here, we're sharing four (of many) examples of how the open source software community is responding to coronavirus and COVID-19, with the goal of celebrating the creators and the overall impact the open source community is making on the world right now.
|
||||
|
||||
### 1\. CHIME by PennSignals
|
||||
|
||||
![CHIME by PennSignals][4]
|
||||
|
||||
COVID-19 Hospital Impact Model for Epidemics ([CHIME][5]) is an open source application built by data scientists at Penn Medicine at the University of Pennsylvania. The online tool allows hospitals to better understand the impact the virus will have on hospital demand.
|
||||
|
||||
Hospital leaders can use CHIME to "get more informed estimates of how many patients will need hospitalization, ICU beds, and mechanical ventilation over the coming days and weeks." A user can input how many patients are currently hospitalized and see, based on other variables, how demand might increase over the coming days.
|
||||
|
||||
CHIME is primarily built with Python and uses the [pandas][6] open source dependency for much of the underlying data-transformation number-crunching to generate the estimates. Pandas has a relatively robust team and is one of the most commonly used Python libraries for data analysis and, like all open source projects, is highly dependent on [users' support][7] for income.
|
||||
|
||||
### 2\. Real-time COVID-19 visualization by Locale.ai
|
||||
|
||||
![Locale.ai COVID-19 visualization][8]
|
||||
|
||||
Maps that track the number of cases help us visualize the relative scale and spread of COVID-19. [Locale.ai created an open source, interactive visualization][9] of all known cases of COVID-19. The map provides live updates with new data as it becomes available.
|
||||
|
||||
I find this project especially interesting because the data is retrieved via [an open source API][9] created by GitHub user ExpDev07 that queries [an open source dataset][10] from John Hopkins University. The John Hopkins dataset (an aggregate of more than a dozen other sources) is currently the most popular COVID19-related project on GitHub. This is the branching nature of open source at its finest!
|
||||
|
||||
Locale.ai built the visualization website using [Vue.js][11], a popular framework that allows web developers to create modern web apps. Vue.js was created and continues to be maintained by [Evan You][12], one of the few people who have made a full-time career as an open source maintainer.
|
||||
|
||||
### 3\. DXY-COVID-19-Crawler by BlankerL
|
||||
|
||||
![BlankerL DXY-COVID-19-Crawler][13]
|
||||
|
||||
[DXY-COVID-19-Crawler][14] was created in January and is one of the earliest responses from the open source community to COVID-19. When the virus was spreading primarily in China, the Chinese medical community was using a site called [DXY.cn][15] to report and track cases. To make the information more readily available and usable by others, GitHub user BlankerL wrote a web crawler to systematically collect data from the DXY.cn site and make it available via an API and data warehouse. That data has been used by academic researchers and others to examine trends and visualize the spread of the virus. So far, DXY-COVID-19-Crawler has been starred more than 1,300 times and forked nearly 300 times.
|
||||
|
||||
BlankerL wrote the web crawler using Python and a package called [Beautiful Soup][16]. Beautiful Soup is an application that allows Python developers to easily scrape information from websites. Beautiful Soup is maintained by Leonard Richardson, who also works full-time as a software architect.
|
||||
|
||||
### 4\. City of Tokyo's COVID-19 task force website
|
||||
|
||||
![City of Tokyo's COVID-19 Task Force site][17]
|
||||
|
||||
Many cities around the world have updated their websites with information for their residents about COVID-19. The Tokyo Metropolitan Government created a [comprehensive website][18] that "aims to allow Tokyo residents, companies with offices in Tokyo, and visitors to Tokyo to grasp the current situation and take measures and precautions accordingly."
|
||||
|
||||
Unlike many other cities, Tokyo decided to [open source its site][19]. The project boasts contributions by more than 180 different users, and [at least three other cities][20] in Japan (Nagano, Chiba, and Fukuoka City) remixed the site. The project is an example of how cities can better serve their citizens by building openly.
|
||||
|
||||
There's an incredible amount of open source technology powering Tokyo's open source website. Using the [Tidelift][21] application, I identified 1,365 dependencies used in the project. All of this complexity happens because 38 direct dependencies (i.e., dependencies the developers explicitly decided to use) have dependencies of their own. That said, maintainers of more than a thousand different open source dependencies (including [Nuxt.js][22], [Prettier][23], [Babel][24], [Ajv][25], and more) are in a small way responsible for helping Tokyo share information with their citizens.
|
||||
|
||||
![Dependencies in Tokyo's COVID-19 Task Force site][26]
|
||||
|
||||
### Other projects
|
||||
|
||||
There are [many other important projects][27] being built in the open in response to COVID-19. I am inspired by how the open source community is responding to this pandemic and leveraging other open source technologies to work quickly. The weeks ahead will be difficult, but I know we can continue to find motivation in the open source community.
|
||||
|
||||
If you are working on an open source project related to COVID-19, please share it in the comments so we can help spread the word.
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://opensource.com/article/20/3/open-source-software-covid19
|
||||
|
||||
作者:[Jeff Stern][a]
|
||||
选题:[lujun9972][b]
|
||||
译者:[译者ID](https://github.com/译者ID)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]: https://opensource.com/users/jeffstern
|
||||
[b]: https://github.com/lujun9972
|
||||
[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/Medical%20costs.jpg?itok=ke57j6cs (symbols showing healthcare)
|
||||
[2]: https://github.com/search?q=coronavirus+OR+covid19
|
||||
[3]: https://opensource.com/article/20/3/open-hardware-covid19
|
||||
[4]: https://opensource.com/sites/default/files/uploads/chime_pennsignals.png (CHIME by PennSignals)
|
||||
[5]: http://penn-chime.phl.io/
|
||||
[6]: https://tidelift.com/subscription/pkg/pypi-pandas
|
||||
[7]: https://pandas.pydata.org/about/sponsors.html
|
||||
[8]: https://opensource.com/sites/default/files/uploads/locale-ai-visualization.png (Locale.ai COVID-19 visualization)
|
||||
[9]: https://github.com/localeai/covid19-live-visualization
|
||||
[10]: https://github.com/CSSEGISandData/COVID-19
|
||||
[11]: https://tidelift.com/subscription/pkg/npm-vue
|
||||
[12]: https://blog.tidelift.com/vuejs-evan-you-javascript-framework
|
||||
[13]: https://opensource.com/sites/default/files/uploads/dxy-covid-19-crawler.png (BlankerL DXY-COVID-19-Crawler)
|
||||
[14]: https://github.com/BlankerL/DXY-COVID-19-Crawler
|
||||
[15]: https://dxy.cn
|
||||
[16]: https://blog.tidelift.com/beautiful-soup-is-now-part-of-the-tidelift-subscription
|
||||
[17]: https://opensource.com/sites/default/files/uploads/tokyo-covid19-task-force.png (City of Tokyo's COVID-19 Task Force site)
|
||||
[18]: https://stopcovid19.metro.tokyo.lg.jp/en/
|
||||
[19]: https://github.com/tokyo-metropolitan-gov/covid19
|
||||
[20]: https://github.com/tokyo-metropolitan-gov/covid19/issues/1802
|
||||
[21]: https://tidelift.com/
|
||||
[22]: https://tidelift.com/subscription/pkg/npm-nuxt
|
||||
[23]: https://blog.tidelift.com/prettier-is-now-part-of-the-tidelift-subscriptions
|
||||
[24]: https://tidelift.com/subscription/pkg/npm-babel
|
||||
[25]: https://blog.tidelift.com/ajv-is-now-part-of-the-tidelift-subscription
|
||||
[26]: https://opensource.com/sites/default/files/uploads/tokyo-dependencies.png (Dependencies in Tokyo's COVID-19 Task Force site)
|
||||
[27]: https://github.com/soroushchehresa/awesome-coronavirus
|
@ -0,0 +1,232 @@
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: (MjSeven)
|
||||
[#]: reviewer: ( )
|
||||
[#]: publisher: ( )
|
||||
[#]: url: ( )
|
||||
[#]: subject: (Run your blog on GitHub Pages with Python)
|
||||
[#]: via: (https://opensource.com/article/19/5/run-your-blog-github-pages-python)
|
||||
[#]: author: (Erik O'Shaughnessy https://opensource.com/users/jnyjny/users/jasperzanjani/users/jasperzanjani/users/jasperzanjani/users/jnyjny/users/jasperzanjani)
|
||||
|
||||
在 GitHub 上使用 Python 运行你的博客
|
||||
======
|
||||
使用 Pelican(一个基于 Python 的平台)在 GitHub 上创建博客,看起来很不错。
|
||||
|
||||
![Raspberry Pi and Python][1]
|
||||
|
||||
[GitHub][2] 是一个非常流行的用于源代码控制的 Web 服务,它使用 [Git][3] 同步本地文件和 GitHub 服务器上保留的副本,这样你就可以轻松地共享和备份你的工作。
|
||||
|
||||
除了为代码仓库提供用户界面之外,GitHub 还运允许用户直接从仓库[发布网页][4]。GitHub 推荐的网站生成软件包是 [Jekll][5],使用 Ruby 编写。因为我是 [Python][6] 的忠实粉丝,所以我更喜欢 [Pelican][7],这是一个基于 Python 的博客平台,可与 GitHub 很好地协同工作。
|
||||
|
||||
Pelican 和 Jekll 都可以将 [Markdown][8] 或 [reStructuredText][9] 中编写的内容转换为 HTML 以生成静态网站,并且两个生成器都支持定制的主题。
|
||||
|
||||
在本文中,我将介绍如何安装 Pelican、设置 GitHub 仓库、运行快速入门帮助、编写一些 Markdown 文件以及发布第一篇博客。我假设你有一个 [GitHub 账户][10],熟悉[基础的 Git 命令][11],并且想使用 Pelican 发布博客。
|
||||
|
||||
### 安装 Pelican 并创建仓库
|
||||
|
||||
首先,你必须在本地计算机上安装 Pelican 和 **ghp-import**。使用 Python 软件包安装工具 [pip][12](你有,对吧?),这非常容易:
|
||||
|
||||
```
|
||||
$ pip install pelican ghp-import Markdown
|
||||
```
|
||||
|
||||
然后,打开浏览器并在 GitHub 上为你的新博客创建一个新的仓库,命名如下(在此处以及整个教程中,用 GitHub 用户名替换 <username>):
|
||||
|
||||
```
|
||||
https://GitHub.com/username/username.github.io
|
||||
```
|
||||
|
||||
让它保持空白,稍后我们用引人注目的博客内容来填充它。
|
||||
|
||||
使用命令行(确保正确),将空的 Git 仓库克隆到本地计算机:
|
||||
|
||||
```
|
||||
$ git clone <https://GitHub.com/username/username.github.io> blog
|
||||
$ cd blog
|
||||
```
|
||||
|
||||
### 奇怪的把戏...
|
||||
|
||||
在 GitHub 上发布 Web 内容有一个不太明显的技巧,对于用户页面(托管在名为 _username.github.io_ 的仓库的页面上),其内容来自 **master** 分支。
|
||||
|
||||
我强烈建议不要将所有 Pelican 配置文件和原始 Markdown 文件都保留在 **master** 中,**master** 中只保留 Web 内容中。因此,我将 Pelican 配置和原始内容保留在一个我喜欢称为 **content** 的单独分支中。(你可以随意创建一个分支,但以下内容沿用 **content**。)我喜欢这种结构,因为我可以放弃掉 **master** 中的所有文件,然后用 **content** 分支重新填充它。
|
||||
|
||||
```
|
||||
$ git checkout -b content
|
||||
Switched to a new branch 'content'
|
||||
```
|
||||
|
||||
### 配置 Pelican
|
||||
|
||||
现在该进行内容配置了。Pelican 提供了一个很棒的初始化工具 **pelican-quickstart**,它会询问你有关博客的一系列问题。
|
||||
|
||||
```
|
||||
$ pelican-quickstart
|
||||
Welcome to pelican-quickstart v3.7.1.
|
||||
|
||||
This script will help you create a new Pelican-based website.
|
||||
|
||||
Please answer the following questions so this script can generate the files
|
||||
needed by Pelican.
|
||||
|
||||
> Where do you want to create your new web site? [.]
|
||||
> What will be the title of this web site? Super blog
|
||||
> Who will be the author of this web site? username
|
||||
> What will be the default language of this web site? [en]
|
||||
> Do you want to specify a URL prefix? e.g., <http://example.com> (Y/n) n
|
||||
> Do you want to enable article pagination? (Y/n)
|
||||
> How many articles per page do you want? [10]
|
||||
> What is your time zone? [Europe/Paris] US/Central
|
||||
> Do you want to generate a Fabfile/Makefile to automate generation and publishing? (Y/n) y
|
||||
> Do you want an auto-reload & simpleHTTP script to assist with theme and site development? (Y/n) y
|
||||
> Do you want to upload your website using FTP? (y/N) n
|
||||
> Do you want to upload your website using SSH? (y/N) n
|
||||
> Do you want to upload your website using Dropbox? (y/N) n
|
||||
> Do you want to upload your website using S3? (y/N) n
|
||||
> Do you want to upload your website using Rackspace Cloud Files? (y/N) n
|
||||
> Do you want to upload your website using GitHub Pages? (y/N) y
|
||||
> Is this your personal page (username.github.io)? (y/N) y
|
||||
Done. Your new project is available at /Users/username/blog
|
||||
```
|
||||
|
||||
你可以对每个问题都采用默认值,但除了以下这些问题:
|
||||
|
||||
* 网站标题,应该唯一且特殊
|
||||
* 网站作者,可以是个人用户名或你的全名
|
||||
* 时区,可能你不在巴黎
|
||||
* 上传到 GitHub 页面,我们选择 "y"
|
||||
|
||||
|
||||
回答完所有问题后,Pelican 会在当前目录中保留以下内容:
|
||||
|
||||
```
|
||||
$ ls
|
||||
Makefile content/ develop_server.sh*
|
||||
fabfile.py output/ pelicanconf.py
|
||||
publishconf.py
|
||||
```
|
||||
|
||||
你可以查看 [Pelican 文档][13]来了解如何使用这些文件,但 _现在_ 我们要做的是完成手头的工作。说实话,我也没有阅读文档。
|
||||
|
||||
### 继续
|
||||
|
||||
将所有 Pelican 生成的文件添加到本地 Git 仓库的 **content** 分支,提交更改,然后将本地更改推送到 Github 上托管的远程仓库:
|
||||
|
||||
```
|
||||
$ git add .
|
||||
$ git commit -m 'initial pelican commit to content'
|
||||
$ git push origin content
|
||||
```
|
||||
|
||||
这件事情并不是特别令人兴奋,但是如果我们需要将内容恢复到这些文件的时候,这将非常方便。
|
||||
|
||||
### 终于
|
||||
|
||||
终于,现在你得到一个博客了!你所有的博客文章、照片、图像、PDF 等都将位于 **content** 目录中,它最初是空的。要开始创建第一篇博客和关于页面,输入:
|
||||
|
||||
```
|
||||
$ cd content
|
||||
$ mkdir pages images
|
||||
$ cp /Users/username/SecretStash/HotPhotoOfMe.jpg images
|
||||
$ touch first-post.md
|
||||
$ touch pages/about.md
|
||||
```
|
||||
|
||||
接下来,在你喜欢的文本编辑器中打开 **first-post.md**,并添加以下内容:
|
||||
|
||||
```
|
||||
title: First Post on My Sweet New Blog
|
||||
date: <today's date>
|
||||
author: Your Name Here
|
||||
|
||||
# I am On My Way To Internet Fame and Fortune!
|
||||
|
||||
This is my first post on my new blog. While not super informative it
|
||||
should convey my sense of excitement and eagerness to engage with you,
|
||||
the reader!
|
||||
```
|
||||
|
||||
前三行是 Pelican 用于组织内容的元数据。有很多不同的元数据可供你选择。再说一次,文档是你了解更多选项的最佳选择。
|
||||
|
||||
现在,打开空白文件 **pages/about.md** 并添加以下文本:
|
||||
|
||||
```
|
||||
title: About
|
||||
date: <today's date>
|
||||
|
||||
![So Schmexy][my_sweet_photo]
|
||||
|
||||
Hi, I am <username> and I wrote this epic collection of Interweb
|
||||
wisdom. In days of yore, much of this would have been deemed sorcery
|
||||
and I would probably have been burned at the stake.
|
||||
|
||||
😆
|
||||
|
||||
[my_sweet_photo]: {static}/images/HotPhotoOfMe.jpg
|
||||
```
|
||||
|
||||
现在,content 目录中将包含三个新的 Web 内容,在 content 分支中还有很多内容。
|
||||
|
||||
### 发布
|
||||
|
||||
不要急,马上要见到成果了!
|
||||
|
||||
剩下要做的就是:
|
||||
|
||||
* 运行 Pelican 以在 **output** 中生成静态 HTML 文件:
|
||||
```
|
||||
`$ pelican content -o output -s publishconf.py`
|
||||
```
|
||||
|
||||
* 使用 **ghp-import** 将 **output** 目录的内容添加到 **master** 分支中:
|
||||
```
|
||||
$ ghp-import -m "Generate Pelican site" --no-jekyll -b master output`
|
||||
```
|
||||
|
||||
* 将本地 master 分支推送到远程仓库:
|
||||
```
|
||||
$ git push origin master
|
||||
```
|
||||
|
||||
* 提交新内容并将其推送到 **content** 分支
|
||||
```
|
||||
$ git add content
|
||||
$ git commit -m 'added a first post, a photo and an about page'
|
||||
$ git push origin content
|
||||
```
|
||||
|
||||
### OMG,我成功了
|
||||
|
||||
现在最激动的时候到了,当你想要看到你发布给大家的博客内容时,打开浏览器输入:
|
||||
|
||||
```
|
||||
https://username.github.io
|
||||
```
|
||||
|
||||
恭喜你可以在 GitHub 上发布自己的博客了!当你想添加更多页面或文章时,都可以按照上面的步骤来。希望你可以愉快地发布博客。
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://opensource.com/article/19/5/run-your-blog-github-pages-python
|
||||
|
||||
作者:[Erik O'Shaughnessy][a]
|
||||
选题:[lujun9972][b]
|
||||
译者:[MjSeven](https://github.com/MjSeven)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]: https://opensource.com/users/jnyjny/users/jasperzanjani/users/jasperzanjani/users/jasperzanjani/users/jnyjny/users/jasperzanjani
|
||||
[b]: https://github.com/lujun9972
|
||||
[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/getting_started_with_python.png?itok=MFEKm3gl (Raspberry Pi and Python)
|
||||
[2]: https://github.com/
|
||||
[3]: https://git-scm.com
|
||||
[4]: https://help.github.com/en/categories/github-pages-basics
|
||||
[5]: https://jekyllrb.com
|
||||
[6]: https://python.org
|
||||
[7]: https://blog.getpelican.com
|
||||
[8]: https://guides.github.com/features/mastering-markdown
|
||||
[9]: http://docutils.sourceforge.net/docs/user/rst/quickref.html
|
||||
[10]: https://github.com/join?source=header-home
|
||||
[11]: https://git-scm.com/docs
|
||||
[12]: https://pip.pypa.io/en/stable/
|
||||
[13]: https://docs.getpelican.com
|
@ -0,0 +1,161 @@
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: (mengxinayan)
|
||||
[#]: reviewer: ( )
|
||||
[#]: publisher: ( )
|
||||
[#]: url: ( )
|
||||
[#]: subject: (Basic Vim Commands You Need to Know to Work in Vim Editor)
|
||||
[#]: via: (https://www.2daygeek.com/basic-vim-commands-cheat-sheet-quick-start-guide/)
|
||||
[#]: author: (Magesh Maruthamuthu https://www.2daygeek.com/author/magesh/)
|
||||
|
||||
你需要知道的 Vim 编辑器中的基础命令
|
||||
======
|
||||
|
||||
如果你是一名系统管理员或者开发者,当你在终端工作时有时会需要编辑一个文件。
|
||||
|
||||
在 Linux 系统中有几种文件编辑器,你可以根据需求选择合适的文件编辑器
|
||||
|
||||
在这里,我想推荐 Vim 编辑器
|
||||
|
||||
|
||||
### 为什么推荐 Vim 编辑器
|
||||
|
||||
和创建编写新文件相比,你会在编辑器中花费更多的时间用来修改已经存在的文件。
|
||||
|
||||
在这种情况下,Vim 快捷键可以有效地满足你的需求。
|
||||
|
||||
文章下面的内容可以帮助你了解对文件和目录的操作。
|
||||
|
||||
[Linux 基础:对文件和目录进行操作的 Linux 和 Unix 命令][1]
|
||||
[在 Linux 中查看不同文件格式的10种方法][2]
|
||||
|
||||
|
||||
### 什么是 Vim
|
||||
|
||||
Vim 是被 Linux 管理员和开发者广泛使用的最流行和功能强大的编辑器之一。
|
||||
|
||||
它可以通过高度的自定义配置来提高文本编辑效率。它是在众多 Unix 默认安装的 Vi 编辑器的升级版。
|
||||
|
||||
Vim 通常被称为“程序员的编辑器”,但并不限于此,它也可用于编辑任何类型的文件。
|
||||
|
||||
它具有许多功能,例如:多次撤销,多窗口和缓冲区,语法高亮,命令行编辑,文件名补全,可视选择。
|
||||
|
||||
你可以使用 `:help` 命令来获取在线帮助
|
||||
|
||||
|
||||
### 理解 Vim 的模式
|
||||
|
||||
Vim 有两种模式,详细介绍如下:
|
||||
|
||||
**命令模式:** 当启动 Vim 编辑器后,默认处在命令模式下。你可以在文件中移动并且修改内容,剪切,复制和粘贴文件的一部分,同时发出命令执行更多操作(按 ESC 键进入命令模式)
|
||||
|
||||
**插入模式:** 插入模式用于在给定的文档位置插入文本(按 i 键进入插入模式)
|
||||
|
||||
### 我如何知道我正使用哪种 Vim 模式呢?
|
||||
|
||||
如果你正在使用插入模式,你会在编辑器的底部看到 `INSERT` 。如果编辑器底部没有显示任何内容,或者在编辑器底部显示了文件名,则处于 “命令模式”。
|
||||
|
||||
### 正常模式下的光标移动
|
||||
### Cursor Movement in Normal Mode
|
||||
|
||||
Vim 快捷键允许你使用不同的方式来移动光标:
|
||||
|
||||
* `G` – 跳转到文件最后一行
|
||||
* `gg` – 跳转到文件首行
|
||||
* `$` – 跳转到行末尾
|
||||
* `0` (零) – 跳转到行开头
|
||||
|
||||
* `w` – 跳转到下一个单词的开始(单词的分隔符可以是空格或其他符号)
|
||||
* `W` – 跳转到下一个单词的开始(单词的分隔符只能是空格)
|
||||
* `b` – 跳转到下一个单词的末尾(单词的分隔符可以是空格或其他符号)
|
||||
* `B` – 跳转到下一个单词的末尾(单词的分隔符只能是空格)
|
||||
|
||||
* `PgDn` 键 – 向下移动一页
|
||||
* `PgUp` 键 – 向上移动一页
|
||||
* `Ctrl+d` – 向下移动半页
|
||||
* `Ctrl+u` – 向上移动半页
|
||||
|
||||
|
||||
### 插入模式:插入文字
|
||||
|
||||
下面的 vim 快捷键允许你根据需要在光标的不同位置插入内容。
|
||||
|
||||
* `i` – 在光标之前插入
|
||||
* `a` – 在光标之后插入
|
||||
* `I` – 在光标所在行的开头插入。当光标位于行中间时,这个键很有用
|
||||
* `A` – 在光标所在行的末尾插入。
|
||||
* `o` – 在光标所在行的下面插入新行
|
||||
* `O` – 在光标所在行的上面插入新行
|
||||
* `ea` – 在单词的末尾插入
|
||||
|
||||
|
||||
### 拷贝,粘贴和删除一行
|
||||
|
||||
* `yy` – 复制一行
|
||||
* `p/P` – 将内容粘贴到光标之后 / 将内容粘贴到光标之前
|
||||
* `dd` – 删除一行
|
||||
* `dw` – 删除一个单词
|
||||
|
||||
|
||||
### 在 Vim 中搜索和替换模式
|
||||
|
||||
* `/pattern` – 向后搜索给定的模式
|
||||
* `?pattern` – 向前搜索给定的模式
|
||||
* `n` – 向后重复搜索之前给定的模式
|
||||
* `N` – 向前重复搜索之前给定的模式
|
||||
|
||||
* `:%s/old-pattern/new-pattern/g` – 将文件中所有的旧模式替换为新模式
|
||||
* `:s/old-pattern/new-pattern/g` – 将当前行中所有的旧模式替换为新模式
|
||||
* `:%s/old-pattern/new-pattern/gc` – 逐个询问是否文件中的旧模式替换为新模式
|
||||
|
||||
|
||||
### 如何在 Vim 编辑器中跳转到特定行
|
||||
|
||||
你可以根据需求以两种方式达到该目的,如果你不知道行号,建议采用第一种方法。
|
||||
|
||||
通过打开文件并运行下面的命令来显示行号
|
||||
|
||||
```
|
||||
:set number
|
||||
```
|
||||
|
||||
当你设置好显示行号后,按 `:n` 跳转到相应的行号。例如,如果你想跳转到第 15 行,请输入:
|
||||
|
||||
```
|
||||
:15
|
||||
```
|
||||
|
||||
如果你已经知道行号,请使用以下方法在打开文件时直接跳转到相应行。例如,如果在打开文件时直接跳转到 20 行,请输入下面的命令:
|
||||
|
||||
```
|
||||
$ vim +20 [File_Name]
|
||||
```
|
||||
|
||||
### 撤销操作/恢复上一次操作/重复上一次操作
|
||||
|
||||
* `u` – 撤销更改
|
||||
* `Ctrl+r` – 恢复更改
|
||||
* `.` – 重复上一条命令
|
||||
|
||||
|
||||
### 保存和退出 Vim
|
||||
|
||||
* `:w` – 保存更改但不退出 vim
|
||||
* `:wq` – 写并退出
|
||||
* `:q!` – 强制退出
|
||||
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://www.2daygeek.com/basic-vim-commands-cheat-sheet-quick-start-guide/
|
||||
|
||||
作者:[Magesh Maruthamuthu][a]
|
||||
选题:[lujun9972][b]
|
||||
译者:[萌新阿岩](https://github.com/mengxinayan)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]: https://www.2daygeek.com/author/magesh/
|
||||
[b]: https://github.com/lujun9972
|
||||
[1]: https://www.2daygeek.com/linux-basic-commands-file-directory-manipulation/
|
||||
[2]: https://www.2daygeek.com/unix-linux-command-to-view-file/
|
@ -0,0 +1,107 @@
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: (HankChow)
|
||||
[#]: reviewer: ( )
|
||||
[#]: publisher: ( )
|
||||
[#]: url: ( )
|
||||
[#]: subject: (How open source software is fighting COVID-19)
|
||||
[#]: via: (https://opensource.com/article/20/3/open-source-software-covid19)
|
||||
[#]: author: (Jeff Stern https://opensource.com/users/jeffstern)
|
||||
|
||||
开源软件在应对 COVID-19 中的贡献
|
||||
======
|
||||
> 在新冠疫情爆发之际,涌现了数以千计的开源项目,今天我们来了解其中四个。
|
||||
|
||||
![symbols showing healthcare][1]
|
||||
|
||||
在当前紧张的疫情环境下,保持专注和积极性是一个很大的挑战。而研究开源社区如何应对这一次疫情爆发,对于我来说却成为了一种宣泄。
|
||||
|
||||
从今年一月底开始,整个开源社区已经贡献了数以千计关于冠状病毒或 COVID-19 的[开源软件库][2],其中涉及的内容包括但不限于数据集、模型、可视化、Web 应用、移动应用,且大多数都使用了 JavaScript 和 Python 编写。
|
||||
|
||||
之前我们分享过一些关于开源硬件厂商在帮助遏制冠状病毒传播方面做的[贡献][3],现在将继续分享四个由开源社区作出的应对冠状病毒和 COVID-19 的项目,这体现了开发者们和整个开源社区在当下对整个世界的影响力。
|
||||
|
||||
### 1. PennSignals:CHIME
|
||||
|
||||
![CHIME by PennSignals][4]
|
||||
|
||||
<ruby>COVID-19 流行病医院影响模型<rt>COVID-19 Hospital Impact Model for Epidemics</rt></ruby>([CHIME][5])是由宾夕法尼亚大学 Penn Medicine 机构的数据科学家们建立的开源在线应用,它可以让医院更好地了解本次新型冠状病毒对医院需求的影响。
|
||||
|
||||
医院的管理人员可以通过 CHIME 来大致预测未来几天和几周内将会有多少患者需要住院治疗,并推算 ICU 和呼吸机的需求量。只需要输入当前住院患者数以及一些相关的变量,就可以看到未来几天内需求的变化情况。
|
||||
|
||||
CHIME 主要使用 Python 开发,并通过 [pandas][6] 这个开源库实现了大部分的数据转换和数值计算,最终得出相关的估计值。pandas 的背后有一个强大的团队进行支持,因此它是在数据分析方面被广泛使用的 Python 库之一。和很多其它的开源项目一样,pandas 团队的收入大部分来源于[用户的资金支持][7]。
|
||||
|
||||
### 2. Locale.ai:Real-time COVID-19 visualization
|
||||
|
||||
![Locale.ai COVID-19 visualization][8]
|
||||
|
||||
实时显示世界各地病例数量分布的地图可以让我们直观了解 COVID-19 的规模和扩散程度。Locale.ai 就开发了这样一个开源、可交互的 [COVID-19 已知病例可视化分布图][9],这个图会根据最新的可靠数据实时进行更新。
|
||||
|
||||
这个项目有趣的地方在于,它的数据是是通过 GitHub 用户 ExpDev07 创建的[开源 API][10] 进行检索的,这个 API 的数据来源是[约翰·霍普金斯大学的开源数据集][11],而约翰·霍普金斯大学这份聚合了多个来源的数据集则是 GitHub 上 COVID-19 相关的最受欢迎的项目。这就是开源项领域中分支带来的一大好处。
|
||||
|
||||
Locale.ai 的这个图表通过 [Vue.js][11] 开发。Vue.js 是一个在 Web 应用开发方面非常流行的框架,它是由[尤雨溪][12]创造并维护的。值得一提的是,尤雨溪是全职参与开源项目维护的少数人之一。
|
||||
|
||||
### 3. BlankerL:DXY-COVID-19-Crawler
|
||||
|
||||
![BlankerL DXY-COVID-19-Crawler][13]
|
||||
|
||||
[DXY-COVID-19-Crawler][14] 建立于今年 1 月份,是开源社区对 COVID-19 最早发起响应的项目之一。当时 COVID-19 主要在中国范围内传播,中国医学界通过[丁香园][15]网站来进行病例的报告和跟踪。为了使这些疫情信息具有更高的可读性和易用性,GitHub 用户 BlankerL 开发了一个爬虫,系统地从丁香园网站获取数据,并通过 API 和数据仓库的方式对外公开。这些数据也被学术研究人员用于研究病毒传播趋势和制作相关的可视化图表。到目前为止,DXY-COVID-19-Crawler 这个项目已经获得了超过 1300 个星标和近 300 次的复刻。
|
||||
|
||||
BlankerL 使用 Python 和 [Beautiful Soup][16] 库开发了这个爬虫。Beautiful Soup 是 Python 开发者用于从页面 HTML DOM 中提取信息的库,它由 Leonard Richardson 维护,这位作者i你另外还全职担任软件架构师。
|
||||
|
||||
### 4. 东京 COVID-19 工作组网站
|
||||
|
||||
![City of Tokyo's COVID-19 Task Force site][17]
|
||||
|
||||
世界各地很多城市都在网络上持续更新当地的 COVID-19 信息。东京都政府则为此创建了一个[综合性的网站][18],让东京当地居民、在东京设有办事处的公司以及到东京的游客了解最新情况,并采取相应的预防措施。
|
||||
|
||||
这个网站的不同之处在于它是由东京都政府[开源][19]的。这个项目受到了来自 180 多名用户的贡献,日本的[长野市、千叶市、福冈市][20]还对这个网站进行了改造。这个项目是城市公共建设更好地服务大众的有力示范。
|
||||
|
||||
这个开源网站也使用了很多开源技术。通过 [Tidelift][21],我留意到项目中存在了 1365 个依赖项,其中 38 个是由开发者直接使用的依赖项。也就是说,超过一千多个开源项目(包括 [Nuxt.js][22]、[Prettier][23]、[Babel][24]、[Ajv][25] 等等)都为东京向市民共享信息提供了帮助。
|
||||
|
||||
![Dependencies in Tokyo's COVID-19 Task Force site][26]
|
||||
|
||||
### 其它项目
|
||||
|
||||
除此以外,还有很多[响应 COVID-19 的重要项目][27]正在公开进行当中。在这次研究中,开源社区应对流行病以及利用开源技术开展工作的方式让我深受启发。接下来的一段时间都是应对疫情的关键时期,我们也可以继续在开源社区中寻找到更大的动力。
|
||||
|
||||
如果你也参与到了 COVID-19 相关的开源项目当中,欢迎在评论区分享。
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://opensource.com/article/20/3/open-source-software-covid19
|
||||
|
||||
作者:[Jeff Stern][a]
|
||||
选题:[lujun9972][b]
|
||||
译者:[HankChow](https://github.com/HankChow)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]: https://opensource.com/users/jeffstern
|
||||
[b]: https://github.com/lujun9972
|
||||
[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/Medical%20costs.jpg?itok=ke57j6cs (symbols showing healthcare)
|
||||
[2]: https://github.com/search?q=coronavirus+OR+covid19
|
||||
[3]: https://opensource.com/article/20/3/open-hardware-covid19
|
||||
[4]: https://opensource.com/sites/default/files/uploads/chime_pennsignals.png (CHIME by PennSignals)
|
||||
[5]: http://penn-chime.phl.io/
|
||||
[6]: https://tidelift.com/subscription/pkg/pypi-pandas
|
||||
[7]: https://pandas.pydata.org/about/sponsors.html
|
||||
[8]: https://opensource.com/sites/default/files/uploads/locale-ai-visualization.png (Locale.ai COVID-19 visualization)
|
||||
[9]: https://github.com/localeai/covid19-live-visualization
|
||||
[10]: https://github.com/CSSEGISandData/COVID-19
|
||||
[11]: https://tidelift.com/subscription/pkg/npm-vue
|
||||
[12]: https://blog.tidelift.com/vuejs-evan-you-javascript-framework
|
||||
[13]: https://opensource.com/sites/default/files/uploads/dxy-covid-19-crawler.png (BlankerL DXY-COVID-19-Crawler)
|
||||
[14]: https://github.com/BlankerL/DXY-COVID-19-Crawler
|
||||
[15]: https://dxy.cn
|
||||
[16]: https://blog.tidelift.com/beautiful-soup-is-now-part-of-the-tidelift-subscription
|
||||
[17]: https://opensource.com/sites/default/files/uploads/tokyo-covid19-task-force.png (City of Tokyo's COVID-19 Task Force site)
|
||||
[18]: https://stopcovid19.metro.tokyo.lg.jp/en/
|
||||
[19]: https://github.com/tokyo-metropolitan-gov/covid19
|
||||
[20]: https://github.com/tokyo-metropolitan-gov/covid19/issues/1802
|
||||
[21]: https://tidelift.com/
|
||||
[22]: https://tidelift.com/subscription/pkg/npm-nuxt
|
||||
[23]: https://blog.tidelift.com/prettier-is-now-part-of-the-tidelift-subscriptions
|
||||
[24]: https://tidelift.com/subscription/pkg/npm-babel
|
||||
[25]: https://blog.tidelift.com/ajv-is-now-part-of-the-tidelift-subscription
|
||||
[26]: https://opensource.com/sites/default/files/uploads/tokyo-dependencies.png (Dependencies in Tokyo's COVID-19 Task Force site)
|
||||
[27]: https://github.com/soroushchehresa/awesome-coronavirus
|
Loading…
Reference in New Issue
Block a user