mirror of
https://github.com/LCTT/TranslateProject.git
synced 2026-08-23 04:03:29 +08:00
Merge remote-tracking branch 'LCTT/master'
This commit is contained in:
@@ -0,0 +1,290 @@
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: (wxy)
|
||||
[#]: reviewer: (wxy)
|
||||
[#]: publisher: (wxy)
|
||||
[#]: url: (https://linux.cn/article-12307-1.html)
|
||||
[#]: subject: (Looking for Some Good Note Taking Apps on Linux? Here are the Best Notes Apps we Found for You)
|
||||
[#]: via: (https://itsfoss.com/note-taking-apps-linux/)
|
||||
[#]: author: (Ankush Das https://itsfoss.com/author/ankush/)
|
||||
|
||||
9 款 Linux 上的最佳笔记应用
|
||||
======
|
||||
|
||||
无论你做什么,做笔记总是一个好习惯。是的,有很多笔记应用可以帮助你实现这个目标。但是,Linux 上的开源笔记应用怎么样呢?
|
||||
|
||||
别担心,你不需要无休止地在互联网上搜索,就能找到 Linux 下最好的笔记应用。在这里,我挑选了一些最令人印象深刻的开源笔记应用。
|
||||
|
||||
![][1]
|
||||
|
||||
请注意,此列表没有特定的排名顺序。
|
||||
|
||||
### 1、Joplin
|
||||
|
||||
![][2]
|
||||
|
||||
主要功能:
|
||||
|
||||
* 支持 Markdown
|
||||
* 支持附件
|
||||
* 支持加密
|
||||
* 跨平台,包括 Android 应用
|
||||
|
||||
[Joplin][9] 是一款令人印象深刻的自由开源笔记应用,支持加密。凭借其提供的出色的功能,它也是目前[最好的 Evernote 替代品][3]之一。事实上,我就是因为它提供的功能才从 Evernote 转移到 Joplin。
|
||||
|
||||
你可以选择添加待办事项列表、普通笔记,或者把它作为一个 Markdown 编辑器来写东西。它适用于 Linux、Windows、macOS、Android 和 iOS。你还可以选择使用 [Dropbox][4]、OneDrive、[NextCloud][5] 或 WebDAV 来同步你的笔记。
|
||||
|
||||
如果你好奇,可以阅读我们关于 [Joplin][6] 的详细文章来了解更多。
|
||||
|
||||
#### 如何安装?
|
||||
|
||||
你可以用一个 AppImage 文件来安装 Joplin。我已经在 Ubuntu 20.04 LTS 上试过了,和预期的一样没有问题。要找到该文件,你可以前往其官方网站或探索他们的 [GitHub 页面][7]。
|
||||
|
||||
如果你不知道如何安装它,请按照我们的[使用 AppImage 文件][8]指南来开始。
|
||||
|
||||
另外,如果你想使用终端,你可以键入下面的命令,通过脚本来安装它(在这个过程中还会添加一个桌面图标)。
|
||||
|
||||
```
|
||||
wget -O - https://raw.githubusercontent.com/laurent22/joplin/master/Joplin_install_and_update.sh | bash
|
||||
```
|
||||
|
||||
### 2、Simplenote
|
||||
|
||||
![][10]
|
||||
|
||||
主要功能:
|
||||
|
||||
* 支持 Markdown
|
||||
* 简约的用户界面
|
||||
* 通过你的 Simplenote 帐户轻松地进行同步
|
||||
* 有 32 位软件包
|
||||
* 跨平台,包括移动应用程序
|
||||
|
||||
顾名思义,它是一款简约的自由开源笔记应用。
|
||||
|
||||
由 [Automattic][11](WordPress 背后的公司)开发,[Simplenote][13] 可以让你在多个设备上无缝同步你的笔记。它支持 Android、iOS、Windows、Linux,以及 macOS。
|
||||
|
||||
与其它一些笔记应用不同的是,你会注意到它的界面非常简单,可能不会提供很多功能。但是,你可以为你的笔记添加标签。
|
||||
|
||||
#### 如何安装?
|
||||
|
||||
它提供了 .deb / .rpm 软件包以及一个 AppImage 文件。你可以在它的 [GitHub 发布部分][12]中找到这些文件。
|
||||
|
||||
### 3、Laverna
|
||||
|
||||
**注:** 它已经不再积极开发了,但它仍然可以正常工作。
|
||||
|
||||
![][14]
|
||||
|
||||
主要功能:
|
||||
|
||||
* 支持 Markdown
|
||||
* 支持加密
|
||||
* 支持同步
|
||||
|
||||
[Laverna][15] 是一个有趣的开源笔记应用程序,还提供加密(这是可选的)。
|
||||
|
||||
你可以把它作为一个基于 Web 的笔记应用,也可以作为电脑上的应用使用。它适用于 Linux、Mac 和 Windows。
|
||||
|
||||
虽然它除了支持加密外,还具有记事本应用的所有基本功能,但并没有一个可以使用的移动应用。所以,这是一个只有当你是一个桌面用户,并且在 Web 浏览器上完成大部分事情时才能使用的东西。
|
||||
|
||||
#### 如何安装?
|
||||
|
||||
它提供了一个压缩文件,可在其[官方网站][15]上获得。下载之后,你需要解压并启动可执行文件来开始。
|
||||
|
||||
### 4、Standard Notes
|
||||
|
||||
![][16]
|
||||
|
||||
主要功能:
|
||||
|
||||
* 支持 Markdown
|
||||
* 支持加密
|
||||
* 支持同步
|
||||
* 笔记的版本历史(付费计划)
|
||||
* 跨平台,包括移动应用程序
|
||||
* 提供了 32 位包。
|
||||
* 提供付费选择
|
||||
|
||||
又一款开源笔记应用,为你的笔记和附件提供加密。
|
||||
|
||||
与 Laverna 不同,[Standard Notes][18] 正在积极开发中。虽然它提供了大量的功能,但其中一些功能以“扩展功能”或扩展插件仅提供给付费用户,这是偏昂贵的(每月订阅)。你也可以参考我们另外一篇关于 [Standard Notes][17] 的文章来了解更多信息。
|
||||
|
||||
总的来说,你会得到 Markdown 支持、加密附件和笔记的能力、版本历史、备份支持(OneDrive、Google Drive 等)以及更多这样有用的功能。
|
||||
|
||||
#### 如何安装?
|
||||
|
||||
它提供了一个 AppImage 文件,可以在你的 Linux 发行版上安装它。你只需要前往它的[官方网站][18]下载即可。如果你不知道如何使用这个文件,可以参考我们的 [AppImage 指南][8]。
|
||||
|
||||
对于其他可用的软件包或源代码,你可以参考他们的 [GitHub 页面][19]。
|
||||
|
||||
### 5、Boost Note
|
||||
|
||||
![][20]
|
||||
|
||||
主要功能:
|
||||
|
||||
* 支持 Markdown
|
||||
* 适用于开发者
|
||||
* 跨平台
|
||||
|
||||
[Boost Note][21] 是一款对使用 Linux 的程序员有用的笔记应用。你可以用它写你的代码,也可以用来写笔记、文档等等。
|
||||
|
||||
它提供了一个简洁直观的用户界面,并提供了 Linux 上笔记应用的所有基本功能。
|
||||
|
||||
#### 如何安装?
|
||||
|
||||
你可以选择其[官网][22]上为 Ubuntu 提供的 .deb 文件。如果你想在其他 Linux 发行版上尝试,你还可以找到一个 AppImage 文件来开始使用。
|
||||
|
||||
如果你好奇,也可以查看他们的 [GitHub 页面][23]来探索更多关于它的内容或复刻它。
|
||||
|
||||
### 6、Tomboy Notes(新一代)
|
||||
|
||||
![][24]
|
||||
|
||||
主要功能:
|
||||
|
||||
* 轻量级笔记应用
|
||||
* 支持同步
|
||||
* 跨平台
|
||||
|
||||
一款轻量级且极其简单的记事应用怎么样?
|
||||
|
||||
好吧,你可能知道旧版的 [Tomboy Notes][25] 已经不再开发了。幸运的是,有一个新一代的 [Tomboy Notes NG][27] 版本。你可以配置存储笔记的路径,并快速开始记笔记。
|
||||
|
||||
这款应用仅仅只有约 2MB 的下载量。所以,如果你正在寻找一个轻量级的解决方案 —— 那就是它。它可能无法用于智能手机,但你肯定可以在 Windows、Linux 和 MacOS 上使用它。
|
||||
|
||||
#### 如何安装?
|
||||
|
||||
你可以在他们的 [GitHub 发布部分][26]中找到 .deb / .rpm 和其他包。对于其他的 Linux 发行版,你可以关注他们 GitHub 页面的文档来了解更多。
|
||||
|
||||
### 7、RedNoteBook
|
||||
|
||||
![][28]
|
||||
|
||||
主要功能
|
||||
|
||||
* 传统的日记式记事应用
|
||||
* 有模板
|
||||
* 离线使用
|
||||
|
||||
对于想要在 Linux 上使用离线笔记应用的用户来说,[RedNotebook][30] 应该是一个不错的选择。
|
||||
|
||||
是的,它不支持同步,如果你是一个不想要同步功能的人,RedNoteBook 应该是一款传统风格的记事应用,侧边栏为日历。
|
||||
|
||||
它主要是为喜欢离线日记的用户量身定做的。它还为你提供了几个模板,方便你创建某些笔记。
|
||||
|
||||
#### 如何安装?
|
||||
|
||||
如果你使用的是 Ubuntu(或者其他基于 Ubuntu 的发行版),你可以通过 PPA 来安装它。下面是你在终端中输入的安装方法:
|
||||
|
||||
```
|
||||
sudo add-apt-repository ppa:rednotebook/stable
|
||||
sudo apt-get update
|
||||
sudo apt-get install rednotebook
|
||||
```
|
||||
|
||||
对于其他的 Linux 发行版,你可以得到 [Flatpak 软件包][29]。
|
||||
|
||||
### 8、TagSpaces
|
||||
|
||||
![][31]
|
||||
|
||||
主要特点:
|
||||
|
||||
* 丰富的用户界面
|
||||
* 支持管理文件
|
||||
* 支持同步
|
||||
* 提供付费选择
|
||||
|
||||
[TagSpaces][34] 是一款适用于 Linux 的精美笔记应用。不仅仅局限于创建笔记,你还可以管理照片和其他文档。
|
||||
|
||||
与其他一些可用的笔记应用不同,它不提供加密功能。所以,你可以尝试像 [Syncthing][32] 这样支持 Dropbox 和 Nextcloud 的工具来安全地同步你的数据。
|
||||
|
||||
如果你想要特定的功能和支持,你也可以选择它的付费计划。
|
||||
|
||||
#### 如何安装?
|
||||
|
||||
你可以在他们的 [GitHub 发布区][33]中找到 .deb 文件和一个 AppImage 文件来安装。无论哪种情况,你都可以把它也构建起来。
|
||||
|
||||
### 9、Trilium Notes
|
||||
|
||||
![][35]
|
||||
|
||||
主要功能:
|
||||
|
||||
* 分层记事应用
|
||||
* 支持加密
|
||||
* 支持同步
|
||||
|
||||
[Trilium Notes][39] 并不只是又一款笔记应用,它是一款专注于建立个人知识库的分层笔记应用。
|
||||
|
||||
是的,你也可以将它用于普通用途 —— 但它是为特定用户量身定制的,他们希望能够以分层方式管理笔记。
|
||||
|
||||
我个人还没有使用过 —— 除了测试。欢迎试用,多多探讨。
|
||||
|
||||
#### 如何安装?
|
||||
|
||||
只需前往其 [GitHub 发布区][36],并抓取 [.deb 文件在 Ubuntu 上安装][37]。如果你正在寻找其他 Linux 发行版上可用的软件包,你也可以从源代码构建它,或者下载并[解压缩文件][38]。
|
||||
|
||||
### 总结
|
||||
|
||||
我对 Linux 上的笔记应用的推荐到此结束。我已经用过很多个,目前决定用 Simplenote 来做快速笔记,用 Joplin 来收集章节中的笔记。
|
||||
|
||||
你是否知道一些应该包括在这个列表中的其它 Linux 笔记应用程序?为什么不在评论区告诉我们呢?
|
||||
|
||||
你更喜欢哪个笔记应用程序?我很想知道你通常在 Linux 上寻找的最好的笔记应用程序是什么。
|
||||
|
||||
欢迎在下面的评论部分分享你的想法。
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://itsfoss.com/note-taking-apps-linux/
|
||||
|
||||
作者:[Ankush Das][a]
|
||||
选题:[lujun9972][b]
|
||||
译者:[wxy](https://github.com/wxy)
|
||||
校对:[wxy](https://github.com/wxy)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]: https://itsfoss.com/author/ankush/
|
||||
[b]: https://github.com/lujun9972
|
||||
[1]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/05/Note-Taking-Apps-linux.jpg?ssl=1
|
||||
[2]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/01/joplin_ubuntu.jpg?ssl=1
|
||||
[3]: https://itsfoss.com/5-evernote-alternatives-linux/
|
||||
[4]: https://www.dropbox.com/
|
||||
[5]: https://nextcloud.com/
|
||||
[6]: https://linux.cn/article-11896-1.html
|
||||
[7]: https://github.com/laurent22/joplin
|
||||
[8]: https://itsfoss.com/use-appimage-linux/
|
||||
[9]: https://joplinapp.org/
|
||||
[10]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/05/simplenote-new.jpg?ssl=1
|
||||
[11]: https://automattic.com/
|
||||
[12]: https://github.com/Automattic/simplenote-electron/releases/tag/v1.16.0
|
||||
[13]: https://simplenote.com
|
||||
[14]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2019/10/laverna.png?resize=800%2C623&ssl=1
|
||||
[15]: https://laverna.cc
|
||||
[16]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2019/11/standard-notes-shot.jpg?resize=800%2C578&ssl=1
|
||||
[17]: https://itsfoss.com/standard-notes/
|
||||
[18]: https://standardnotes.org
|
||||
[19]: https://github.com/standardnotes
|
||||
[20]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2019/10/boostnote.png?resize=800%2C579&ssl=1
|
||||
[21]: https://itsfoss.com/boostnote-linux-review/
|
||||
[22]: https://boostnote.io/
|
||||
[23]: https://github.com/BoostIO/Boostnote
|
||||
[24]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/05/tomboy-notes-ng.jpg?ssl=1
|
||||
[25]: https://github.com/tomboy-notes/tomboy
|
||||
[26]: https://github.com/tomboy-notes/tomboy-ng/releases
|
||||
[27]: https://github.com/tomboy-notes/tomboy-ng
|
||||
[28]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/05/rednotebook.png?ssl=1
|
||||
[29]: https://flathub.org/apps/details/app.rednotebook.RedNotebook
|
||||
[30]: https://rednotebook.sourceforge.io
|
||||
[31]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/10/tagspaces.png?resize=800%2C523&ssl=1
|
||||
[32]: https://itsfoss.com/syncthing/
|
||||
[33]: https://github.com/tagspaces/tagspaces/releases/
|
||||
[34]: https://www.tagspaces.org/
|
||||
[35]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/05/trilium-notes.png?ssl=1
|
||||
[36]: https://github.com/zadam/trilium/releases
|
||||
[37]: https://itsfoss.com/install-deb-files-ubuntu/
|
||||
[38]: https://itsfoss.com/unzip-linux/
|
||||
[39]: https://github.com/zadam/trilium/
|
||||
@@ -1,328 +0,0 @@
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: ( )
|
||||
[#]: reviewer: ( )
|
||||
[#]: publisher: ( )
|
||||
[#]: url: ( )
|
||||
[#]: subject: (Looking for Some Good Note Taking Apps on Linux? Here are the Best Notes Apps we Found for You)
|
||||
[#]: via: (https://itsfoss.com/note-taking-apps-linux/)
|
||||
[#]: author: (Ankush Das https://itsfoss.com/author/ankush/)
|
||||
|
||||
Looking for Some Good Note Taking Apps on Linux? Here are the Best Notes Apps we Found for You
|
||||
======
|
||||
|
||||
No matter what you do — taking notes is always a good habit. Yes, there are a lot of note taking apps to help you achieve that. But, what about some open-source note taking apps for Linux?
|
||||
|
||||
Fret not, you don’t need to endlessly search the Internet to find the best note taking app for Linux. Here, I’ve picked some of the most impressive open-source note taking apps available.
|
||||
|
||||
### Best Note Taking Apps for Linux
|
||||
|
||||
![][1]
|
||||
|
||||
Do note that this list is in no particular order of ranking.
|
||||
|
||||
#### 1\. Joplin
|
||||
|
||||
![][2]
|
||||
|
||||
**Key Features:**
|
||||
|
||||
* Markdown support
|
||||
* Support for attachments
|
||||
* Encryption support
|
||||
* Cross-platform including Android app
|
||||
|
||||
|
||||
|
||||
Joplin is an impressive free open-source note taking app that supports encryption. With the features offered, it’s also one of the [best Evernote alternatives][3] out there. In fact, I moved from Evernote to Joplin just because of the features offered.
|
||||
|
||||
You can choose to add to-do lists, plain notes, or use it as a markdown editor to write something. It’s available for Linux, Windows, macOS, Android, and iOS. You can also choose to sync your notes using [Dropbox][4], OneDrive, [NextCloud][5] or WebDAV.
|
||||
|
||||
If you’re curious, you can read our detailed article on [Joplin][6] to know more about it.
|
||||
|
||||
##### How to install it?
|
||||
|
||||
You get an AppImage file to install Joplin. I’ve tried it on Ubuntu 20.04 LTS and it works as expected. To look for the file, you can head to its official website or explore their [GitHub page][7].
|
||||
|
||||
In case you don’t know how to install it, follow our guide on [using AppImage files][8] to get started.
|
||||
|
||||
In either case, if you want to use the terminal, you can type the command below to install it through a script (which also adds a desktop icon in the process):
|
||||
|
||||
```
|
||||
wget -O - https://raw.githubusercontent.com/laurent22/joplin/master/Joplin_install_and_update.sh | bash
|
||||
```
|
||||
|
||||
[Joplin][9]
|
||||
|
||||
#### 2\. Simplenote
|
||||
|
||||
![][10]
|
||||
|
||||
**Key Features:**
|
||||
|
||||
* Markdown support
|
||||
* Simple user interface
|
||||
* Easily sync using your Simplenote account
|
||||
* 32-bit package available
|
||||
* Cross-platform including mobile apps
|
||||
|
||||
|
||||
|
||||
As the name suggests, it is a simple free and open-source note taking app.
|
||||
|
||||
Developed by [Automattic][11] (the company behind WordPress), Simplenote lets you seamlessly sync your notes across multiple devices. It supports Android, iOS, Windows, Linux, and macOS as well.
|
||||
|
||||
Unlike some others, you will notice that the interface is dead simple and may not offer a bunch of features. However, you get the ability to add tags to your notes.
|
||||
|
||||
##### How to install it?
|
||||
|
||||
It offers **.deb / .rpm** packages along with an AppImage file. You can find the files in its [GitHub releases section][12].
|
||||
|
||||
[Simplenote][13]
|
||||
|
||||
#### 3\. Laverna
|
||||
|
||||
**Note:** _This isn’t actively developed anymore — but it still works as expected._
|
||||
|
||||
![][14]
|
||||
|
||||
**Key Features:**
|
||||
|
||||
* Markdown support
|
||||
* Encryption support
|
||||
* Sync support
|
||||
|
||||
|
||||
|
||||
Laverna is an interesting open-source note taking application that also offers encryption (which is optional).
|
||||
|
||||
You can use it as a web-based note taking app or as something on your computer. It’s available for Linux, Mac, and Windows as well.
|
||||
|
||||
While it features all the basic functionalities for a note taking app in addition to the encryption support, you don’t get a mobile app to use. So, this is something that you can use only if you’re a desktop user and get most of the things done on a web browser.
|
||||
|
||||
##### How to install it?
|
||||
|
||||
It provides a zip file which is available on its [official website][15]. Once you download it, you need to extract it and launch the executable file to get started.
|
||||
|
||||
[Laverna][15]
|
||||
|
||||
#### 4\. Standard Notes
|
||||
|
||||
![][16]
|
||||
|
||||
**Key Features:**
|
||||
|
||||
* Markdown support
|
||||
* Encryption support
|
||||
* Sync support
|
||||
* Version history of notes (paid plan)
|
||||
* Cross-platform including mobile apps
|
||||
* 32-bit package offered
|
||||
* Offers premium options
|
||||
|
||||
|
||||
|
||||
Yet another open-source note taking app that offers encryption for your notes and attachments.
|
||||
|
||||
Unlike Laverna, Standard Notes is being actively developed. While it offers a great deal of features, some of them are limited to paid subscribers as “extended features” or extensions which is on the expensive side (for monthly subscription). You can also refer to our separate article on [Standard Notes][17] to learn more about it.
|
||||
|
||||
Overall, you get the markdown support, ability to encrypt attachments and notes, version history, backup support (to OneDrive, Google Drive, etc.) and more such useful features.
|
||||
|
||||
##### How to install it?
|
||||
|
||||
It offers an AppImage file to install it on your Linux distro. You just need to head to its [official website][18] to download it. In case you don’t know how to use the file, refer to our [AppImage guide][8].
|
||||
|
||||
For other available packages or source, you can refer to their [GitHub page][19].
|
||||
|
||||
[Standard Notes][18]
|
||||
|
||||
#### 5\. Boost Note
|
||||
|
||||
![][20]
|
||||
|
||||
**Key Features:**
|
||||
|
||||
* Markdown support
|
||||
* Suitable for developers as well
|
||||
* Cross-platform
|
||||
|
||||
|
||||
|
||||
[Boost Note][21] is a useful note taking app for programmers using Linux. You can write your codes and also use it to write notes, documentations, and much more.
|
||||
|
||||
It offers a clean and intuitive user interface and offers all the basic features for a note taking app on Linux.
|
||||
|
||||
#### How to install it?
|
||||
|
||||
You can opt for the **.deb** file available for Ubuntu on its [official website][22]. If you want to try it on other Linux distributions, you will also find an AppImage file to get started.
|
||||
|
||||
If you’re curious, you can also check out their [GitHub page][23] to explore more about it or fork it.
|
||||
|
||||
[Boost Note][22]
|
||||
|
||||
#### 6\. Tomboy Notes (Next Generation)
|
||||
|
||||
![][24]
|
||||
|
||||
**Key Features:**
|
||||
|
||||
* Lightweight note taking app
|
||||
* Sync support
|
||||
* Cross-platform
|
||||
|
||||
|
||||
|
||||
How about a lightweight and dead simple note-taking app?
|
||||
|
||||
Well, you might be aware of the old [Tomboy note taking app][25] which is no longer developed. Fortunately, there’s a next-generation version of the Tomboy notes. You can configure the path to store notes and get started taking notes quickly.
|
||||
|
||||
The app is merely ~2 MB to download. So, if you were looking for a lightweight solution — this is it. It may not be available for smartphones — but you can surely use it on Windows, Linux, and macOS.
|
||||
|
||||
#### How to install it?
|
||||
|
||||
You can find .**deb / .rpm** and other packages in their [GitHub releases section][26]. For other Linux distros, you can follow documentations in their GitHub page to know more about it.
|
||||
|
||||
[Tomboy Notes NG][27]
|
||||
|
||||
#### 7\. RedNoteBook
|
||||
|
||||
![][28]
|
||||
|
||||
Key Features:
|
||||
|
||||
* Traditional Journal-style note taking app
|
||||
* Templates available
|
||||
* Offline-use
|
||||
|
||||
|
||||
|
||||
RedNoteBook should be a good choice for users who wanted an offline note taking app on Linux.
|
||||
|
||||
Yes, it does not support synchronization and if you’re someone who doesn’t want the sync feature, RedNoteBook should be a traditional-style note taking app with a sidebar for calendar.
|
||||
|
||||
It’s mostly tailored for users who like to have an offline journal. It also provides a couple of templates for you to make it easy creating certain notes.
|
||||
|
||||
##### How to install it?
|
||||
|
||||
If you’re using Ubuntu (or any other Ubuntu-based distro), you can install it via PPA. Here’s what you have to type in your terminal to install it:
|
||||
|
||||
```
|
||||
sudo add-apt-repository ppa:rednotebook/stable
|
||||
sudo apt-get update
|
||||
sudo apt-get install rednotebook
|
||||
```
|
||||
|
||||
For all other Linux distributions, you can get the [Flatpak package][29].
|
||||
|
||||
[RedNotebook][30]
|
||||
|
||||
#### 8\. TagSpaces
|
||||
|
||||
![][31]
|
||||
|
||||
**Key Features:**
|
||||
|
||||
* Rich user interface
|
||||
* Supports managing documents
|
||||
* Sync support
|
||||
* Offers premium options
|
||||
|
||||
|
||||
|
||||
TagSpaces is a beautiful note taking app available for Linux. Not just limited to creating notes, but you can manage photos and other documents as well.
|
||||
|
||||
Unlike some other note taking apps available, it doesn’t offer encryption. So, you can try tools like [Syncthing to sync your data][32] safely along with the support Dropbox and Nextcloud.
|
||||
|
||||
You can also opt for its premium plans if you want special features and support.
|
||||
|
||||
##### How to install it?
|
||||
|
||||
You can find the .**deb** file and an AppImage file in their [GitHub releases section][33] to install it. In either case, you can build it as well.
|
||||
|
||||
[TagSpaces][34]
|
||||
|
||||
#### 9\. Trilium Notes
|
||||
|
||||
![][35]
|
||||
|
||||
**Key Features:**
|
||||
|
||||
* Hierarchical note taking app
|
||||
* Encryption supported
|
||||
* Sync support
|
||||
|
||||
|
||||
|
||||
Trilium Notes is not just another note taking app, it’s a hierarchical note taking application with focus on building personal knowledge bases.
|
||||
|
||||
Yes, you can use it for common use as well — but it’s tailored for specific users who want the ability to manage the notes in a hierarchical fashion.
|
||||
|
||||
I haven’t used this personally — except for testing it. Feel free to try it out and explore more.
|
||||
|
||||
#### How to install it?
|
||||
|
||||
Simply head to its [GitHub releases section][36] and grab the [.**deb** file to install it on Ubuntu][37]. If you’re looking for other Linux distros, you can build it from source or download and [extract the zip file][38] as well.
|
||||
|
||||
[Trilium Notes][39]
|
||||
|
||||
### Wrapping Up
|
||||
|
||||
That concludes my recommendation for note taking apps on Linux. I have used plenty of them and currently settled for Simplenote for quick notes and Joplin for collection of notes in chapters.
|
||||
|
||||
Do you know some other notes apps available for Linux that you think should be included in this list? Why not let us know in the comment section?
|
||||
|
||||
Which note taking application do you prefer? I am curious to know what you normally look for in the best note taking application on Linux.
|
||||
|
||||
Feel free to share your thoughts in the comments section below.
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://itsfoss.com/note-taking-apps-linux/
|
||||
|
||||
作者:[Ankush Das][a]
|
||||
选题:[lujun9972][b]
|
||||
译者:[译者ID](https://github.com/译者ID)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]: https://itsfoss.com/author/ankush/
|
||||
[b]: https://github.com/lujun9972
|
||||
[1]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/05/Note-Taking-Apps-linux.jpg?ssl=1
|
||||
[2]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/01/joplin_ubuntu.jpg?ssl=1
|
||||
[3]: https://itsfoss.com/5-evernote-alternatives-linux/
|
||||
[4]: https://www.dropbox.com/
|
||||
[5]: https://nextcloud.com/
|
||||
[6]: https://itsfoss.com/joplin/
|
||||
[7]: https://github.com/laurent22/joplin
|
||||
[8]: https://itsfoss.com/use-appimage-linux/
|
||||
[9]: https://joplinapp.org/
|
||||
[10]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/05/simplenote-new.jpg?ssl=1
|
||||
[11]: https://automattic.com/
|
||||
[12]: https://github.com/Automattic/simplenote-electron/releases/tag/v1.16.0
|
||||
[13]: https://simplenote.com
|
||||
[14]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2019/10/laverna.png?resize=800%2C623&ssl=1
|
||||
[15]: https://laverna.cc
|
||||
[16]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2019/11/standard-notes-shot.jpg?resize=800%2C578&ssl=1
|
||||
[17]: https://itsfoss.com/standard-notes/
|
||||
[18]: https://standardnotes.org
|
||||
[19]: https://github.com/standardnotes
|
||||
[20]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2019/10/boostnote.png?resize=800%2C579&ssl=1
|
||||
[21]: https://itsfoss.com/boostnote-linux-review/
|
||||
[22]: https://boostnote.io/
|
||||
[23]: https://github.com/BoostIO/Boostnote
|
||||
[24]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/05/tomboy-notes-ng.jpg?ssl=1
|
||||
[25]: https://github.com/tomboy-notes/tomboy
|
||||
[26]: https://github.com/tomboy-notes/tomboy-ng/releases
|
||||
[27]: https://github.com/tomboy-notes/tomboy-ng
|
||||
[28]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/05/rednotebook.png?ssl=1
|
||||
[29]: https://flathub.org/apps/details/app.rednotebook.RedNotebook
|
||||
[30]: https://rednotebook.sourceforge.io
|
||||
[31]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2019/10/tagspaces.png?resize=800%2C523&ssl=1
|
||||
[32]: https://itsfoss.com/syncthing/
|
||||
[33]: https://github.com/tagspaces/tagspaces/releases/
|
||||
[34]: https://www.tagspaces.org/
|
||||
[35]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/05/trilium-notes.png?ssl=1
|
||||
[36]: https://github.com/zadam/trilium/releases
|
||||
[37]: https://itsfoss.com/install-deb-files-ubuntu/
|
||||
[38]: https://itsfoss.com/unzip-linux/
|
||||
[39]: https://github.com/zadam/trilium/
|
||||
@@ -0,0 +1,140 @@
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: ( )
|
||||
[#]: reviewer: ( )
|
||||
[#]: publisher: ( )
|
||||
[#]: url: ( )
|
||||
[#]: subject: (How I stream video with OBS and WebSockets)
|
||||
[#]: via: (https://opensource.com/article/20/6/obs-websockets-streaming)
|
||||
[#]: author: (Kevin Sonney https://opensource.com/users/ksonney)
|
||||
|
||||
How I stream video with OBS and WebSockets
|
||||
======
|
||||
Take control of your streaming with these open source supporting tools
|
||||
that simplify WebSockets.
|
||||
![An old-fashioned video camera][1]
|
||||
|
||||
[OBS][2] is one of the staples of live streaming videos now. It is the preferred software for streaming to Twitch, one of the most popular live video sites around. There are some really nice add-ons to allow a streamer to control things from their phone or another screen without disrupting the running video. It turns out, it is really easy to build your own control panel using [Node-RED][3] and the [obs-websockets][4] plugin.
|
||||
|
||||
![My OBS Control Dashboard][5]
|
||||
|
||||
My OBS control dashboard
|
||||
|
||||
I know what many of you are thinking—"He said WebSockets and easy in the same sentence?" Many people have had difficulty setting up and using WebSockets, which allow for bi-directional communication over a single connection via a web server. Node-RED has built-in support for WebSockets and is the part that makes this easy, at least compared to writing your own client/server.
|
||||
|
||||
Before starting, make sure you have OBS installed and configured. Start by downloading and installing the [latest stable release of the obs-websockets][6] plugin. For this article, the default settings are fine, but I strongly recommend following the instructions for securing obs-websockets in the future.
|
||||
|
||||
Next, [download and install Node-RED][7], either on the same system or on a different one (like a Raspberry Pi). Again, the default installation is fine for our purposes, but it would be wise to secure the installation following the directions on their site.
|
||||
|
||||
Now for the fun parts. Start Node-RED and open up the web interface (by default at <http://localhost:1880>), and you have a blank canvas. Open up the "hamburger" menu on the right and select "Manage Palate." Then click on the "Install" tab and search for the "node-red-contrib-dashboard" and "node-red-contrib-rbe" modules.
|
||||
|
||||
Once those are installed, click on the right-hand list and drag-and-drop the following blocks to the canvas:
|
||||
|
||||
* 1 Websocket Out
|
||||
* 1 Websocket In
|
||||
* 1 Debug
|
||||
* 1 Inject
|
||||
* 1 Switch
|
||||
* 1 Change
|
||||
* 2 JSON
|
||||
* 1 Catch
|
||||
|
||||
|
||||
|
||||
Connect them in the following orders:
|
||||
|
||||
|
||||
```
|
||||
Inject->Button->Change->JSON->Websocket Out
|
||||
|
||||
Websocket In->JSON->Switch->RBE->Debug
|
||||
|
||||
Catch->Debug
|
||||
```
|
||||
|
||||
![The basic flows][8]
|
||||
|
||||
The basic flows
|
||||
|
||||
When the button is pushed (or the Inject node sends a timestamp), a payload is sent through the change node, converted from a JSON object to a string, then sent to the WebSocket Out node. When a message is received by the WebSocket In node, it is converted to a JSON object, and if it is not a duplicate, sent to the Debug node for output. And the Catch node will catch any errors and put them into the debug panel.
|
||||
|
||||
What is in that payload? Let's set everything up and find out.
|
||||
|
||||
First, double click the `button` to open the settings dialog. Start by changing the payload to "JSON" using the drop-down menu. In the field, add the following:
|
||||
|
||||
|
||||
```
|
||||
{"request-type":"GetVersion"}
|
||||
```
|
||||
|
||||
Enable the checkbox for "If msg arrives on input, emulate a button click" and click Done to close the button config. When a message comes from the Inject node, or if the button is pressed in the UI, it will send the JSON payload to the next node.
|
||||
|
||||
![Setting up the button][9]
|
||||
|
||||
Setting up the button
|
||||
|
||||
Now open up the Change node. We want to set `msg.payload.message-id` to `msg._msgid` by changing the first field from `payload` to `payload.message-id` and then using the drop-down on the second field to change the type from `String` to `msg.,` then we will put `_msgid` in the field. This copies the unique message ID to the JSON object payload so that each request has a unique ID for tracking.
|
||||
|
||||
This is then sent to the JSON node to convert from a JSON object to a string, and then passed to the Websocket Out node. Open up the Websocket Out node to configure the connection to OBS. First, change the `Type` to `Connect to` and then click the pencil icon to create a new connection URL. Set that to `ws://OBSMachine:4444/` and close the dialog to save. `OBSMachine` is the name of the machine OBS and obs-websocket are running on. For example, if Node-RED is running on the same machine, this would be `ws://localhost:4444`, and if it is on a machine named "luxuria.local" then it would be `ws://luxuria.local:4444`. Close and update the Websocket Out node. This sends the payload text string to the WebSocket in OBS.
|
||||
|
||||
![Websocket Out Node configuration][10]
|
||||
|
||||
Websocket Out Node configuration
|
||||
|
||||
On to the WebSocket In flow! Open the WebSocket In node, and set it to a `Type` of `Connect to` and the URL to the connection we defined before (it should auto-fill). Next in line is the second JSON node, which we can leave alone. This accepts output from OBS and converts it into a payload object.
|
||||
|
||||
Next, we will filter the regular heartbeat and status updates from everything else. Open up the switch and set the "Property" value to `payload["update-type"]`. Now select `Is Not Null` from the drop-down below it. Click `+` to add a second option and select `otherwise` from the drop-down.
|
||||
|
||||
![Switch Node configuration][11]
|
||||
|
||||
Switch Node configuration
|
||||
|
||||
Connect the new output on the switch directly to the Debug node input.
|
||||
|
||||
The RBE node, which will filter out duplicates, needs to be told what field to watch for. Since it should be connected to the output from the switch that sends nothing but status updates, this is important, as obs-websocket is sending updates every few seconds. By default, the RBE compares the entire payload object, which will constantly be changing. Open up the RBE Node, and change the `Property` from `payload` to `payload.streaming`. If the `streaming` value of the payload changes, then pass the message through; otherwise, discard it.
|
||||
|
||||
The final step is to change the Debug node output from `msg.payload` to the complete msg object. This allows us to see the entire object, which sometimes has useful information outside the `payload`.
|
||||
|
||||
Now, click `Deploy` to activate the changes. Hopefully, the WebSocket nodes will have a green "Connected" message underneath them. If they are red or yellow, the connection URL is likely incorrect and needs to be updated, or the connection is being blocked. Make sure that port 4444 on the remote machine is open and available, and that OBS is running!
|
||||
|
||||
Without the RBE node filtering on the `streaming` value, the debug panel (the bug icon on the right of the canvas) would be filling with Heartbeat messages about now. Click the button to the left of the Inject node to send a signal that will simulate a button click. If all is well, you should see an object arrive that has a listing of all the things `obs-websocket` can do.
|
||||
|
||||
![The response to "GetVersion"][12]
|
||||
|
||||
The response to "GetVersion"
|
||||
|
||||
Now open up `http://localhost:1880/ui` in another tab or window. It should show a single button. Press it! The debug panel should show the same information as before.
|
||||
|
||||
Congrats! You have sent your first (and hopefully not last) WebSocket message to OBS!
|
||||
|
||||
This is just the beginning of what can be done with `obs-websockets` and Node-RED. The complete documentation of what is supported is documented in the protocol.md file in the GitHub repository for obs-websockets. With a little experimentation, you can create a full-featured control panel to start and stop streaming, change scenes, and a whole lot more. If you are like me, you'll have all kinds of controls set up before you know it.
|
||||
|
||||
![OBS Websocket][13]
|
||||
|
||||
I may have gotten a little mad with power.
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://opensource.com/article/20/6/obs-websockets-streaming
|
||||
|
||||
作者:[Kevin Sonney][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/ksonney
|
||||
[b]: https://github.com/lujun9972
|
||||
[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/LIFE_film.png?itok=aElrLLrw (An old-fashioned video camera)
|
||||
[2]: https://obsproject.com/
|
||||
[3]: https://nodered.org/
|
||||
[4]: https://github.com/Palakis/obs-websocket
|
||||
[5]: https://opensource.com/sites/default/files/uploads/obscontrol-img1.png.jpg (My OBS Control Dashboard)
|
||||
[6]: https://github.com/palakis/obs-websocket/releases
|
||||
[7]: https://nodered.org/docs/getting-started/
|
||||
[8]: https://opensource.com/sites/default/files/uploads/obscontrol-img2.png.jpg (The basic flows)
|
||||
[9]: https://opensource.com/sites/default/files/uploads/obscontrol-img3.png.jpg (Setting up the button)
|
||||
[10]: https://opensource.com/sites/default/files/uploads/obscontrol-img4.png.jpg (Websocket Out Node configuration)
|
||||
[11]: https://opensource.com/sites/default/files/uploads/obscontrol-img5.png.jpg (Switch Node configuration)
|
||||
[12]: https://opensource.com/sites/default/files/uploads/obscontrol-img6.png.jpg (The response to "GetVersion")
|
||||
[13]: https://opensource.com/sites/default/files/uploads/obscontrol-img7.png.jpg (OBS Websocket)
|
||||
@@ -0,0 +1,263 @@
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: ( )
|
||||
[#]: reviewer: ( )
|
||||
[#]: publisher: ( )
|
||||
[#]: url: ( )
|
||||
[#]: subject: (Never forget your password with this Python encryption algorithm)
|
||||
[#]: via: (https://opensource.com/article/20/6/python-passwords)
|
||||
[#]: author: (Moshe Zadka https://opensource.com/users/moshez)
|
||||
|
||||
Never forget your password with this Python encryption algorithm
|
||||
======
|
||||
This unique algorithm using Python and Shamir's Secret Sharing protects
|
||||
your master password from hackers and your own forgetfulness.
|
||||
![Searching for code][1]
|
||||
|
||||
Many of us use password managers to securely store our many unique passwords. A critical part of a password manager is the master password. This password protects all others, and in that way, it is a risk. Anyone who has it can pretend to be you… anywhere! Naturally, you keep your master password hard to guess, commit it to memory, and do all the other things you are [supposed to do][2].
|
||||
|
||||
But what if something happens and you forget it? Maybe you took a vacation to a lovely, far-away island with no technology for a month. After frolicking in the water daily and eating pineapples, you cannot quite remember your password. Maybe it was "long legs travel fast"? Or was it something like "sharp spoons eat quick"? It was definitely clever when you thought of it.
|
||||
|
||||
![XKCD comic on password strength][3]
|
||||
|
||||
([XKCD][4], [CC BY-NC 2.5][5])
|
||||
|
||||
Of course, you never told a single soul your password. Why, this is literally the first rule of password management. What could you have done differently?
|
||||
|
||||
Enter [Shamir's Secret Sharing][6]**,** an algorithm that allows users to divide a secret into parts that can be used only in combination with the other pieces.
|
||||
|
||||
Let's take a look at Shamir's Secret Sharing in action through a story of ancient times and modern times.
|
||||
|
||||
This story does assume some knowledge of cryptography. You can brush up on it with this [introduction to cryptography and public key infrastructure][7].
|
||||
|
||||
### A story of secrets in ancient times
|
||||
|
||||
In an ancient kingdom, it came to pass that the king had a secret. A terrible secret:
|
||||
|
||||
|
||||
```
|
||||
def int_from_bytes(s):
|
||||
acc = 0
|
||||
for b in s:
|
||||
acc = acc * 256
|
||||
acc += b
|
||||
return acc
|
||||
|
||||
secret = int_from_bytes("terrible secret".encode("utf-8"))
|
||||
```
|
||||
|
||||
So terrible, the king could entrust it to none of his offspring. He had five of them but knew that there would be dangers on the road ahead. The king knew his children would need the secret to protect the kingdom after his death, but he could not bear the thought of the secret being known for two decades, while they were still mourning him.
|
||||
|
||||
So he used powerful magic to split the secret into five shards. He knew that it was possible that one child or even two would not respect his wishes, but he did not believe three of them would:
|
||||
|
||||
|
||||
```
|
||||
from mod import Mod
|
||||
from os import urandom
|
||||
```
|
||||
|
||||
The king was well-versed in the magical arts of [finite fields][8] and _randomness_. As a wise king, he used Python to split the secret.
|
||||
|
||||
The first thing he did was choose a large prime—the 13th [Mersenne Prime][9] (`2**521 - 1`)—and ordered it be written in letters 10 feet high, wrought of gold, above the palace:
|
||||
|
||||
|
||||
```
|
||||
`P = 2**521 - 1`
|
||||
```
|
||||
|
||||
This was not part of the secret: it was _public data_.
|
||||
|
||||
The king knew that if `P` is a prime, numbers modulo `P` form a mathematical [field][10]: they can be added, multiplied, subtracted, and divided as long as the divisor is not zero.
|
||||
|
||||
As a busy king, he used the PyPI [package `mod`][11], which implements modulus arithmetic.
|
||||
|
||||
He made sure his terrible secret was less than `P`:
|
||||
|
||||
|
||||
```
|
||||
`secret < P`[/code] [code]`TRUE`
|
||||
```
|
||||
|
||||
And he converted it to its modulus `mod P`:
|
||||
|
||||
|
||||
```
|
||||
`secret = mod.Mod(secret, P)`
|
||||
```
|
||||
|
||||
In order to allow three offspring to reconstruct the secret, the king had to generate two more parts to mix together:
|
||||
|
||||
|
||||
```
|
||||
polynomial = [secret]
|
||||
for i in range(2):
|
||||
polynomial.append(Mod(int_from_bytes(urandom(16)), P))
|
||||
len(polynomial)
|
||||
|
||||
[/code] [code]`3`
|
||||
```
|
||||
|
||||
The king next needed to evaluate this [polynomial][12] at random points. Evaluating a polynomial is calculating `polynomial[0] + polynomial[1]*x + polynomial[2]*x**2 ...`
|
||||
|
||||
While there are third-party modules to evaluate polynomials, they do not work with finite fields. The king needed to write the evaluation code himself:
|
||||
|
||||
|
||||
```
|
||||
def evaluate(coefficients, x):
|
||||
acc = 0
|
||||
power = 1
|
||||
for c in coefficients:
|
||||
acc += c * power
|
||||
power *= x
|
||||
return acc
|
||||
```
|
||||
|
||||
Next, the king evaluated the polynomial at five different points, to give one piece to each offspring:
|
||||
|
||||
|
||||
```
|
||||
shards = {}
|
||||
for i in range(5):
|
||||
x = Mod(int_from_bytes(urandom(16)), P)
|
||||
y = evaluate(polynomial, x)
|
||||
shards[i] = (x, y)
|
||||
```
|
||||
|
||||
Sadly, as the king feared, not all his offspring were honest and true. Two of them, shortly after his death, tried to figure out the terrible secret from the parts they had. Try as they could, they did not succeed. However, when the others learned this, they exiled them from the kingdom forever:
|
||||
|
||||
|
||||
```
|
||||
del shards[2]
|
||||
del shards[3]
|
||||
```
|
||||
|
||||
Twenty years later, as the king had decreed, the oldest sibling and the two youngest came together to figure out their father's terrible secret. They put together their shards:
|
||||
|
||||
|
||||
```
|
||||
`retrieved = list(shards.values())`
|
||||
```
|
||||
|
||||
For 40 days and 40 nights, they struggled with finding the king's secret. No easy task was it before them. Like the king, they knew Python, but none were as wise as he.
|
||||
|
||||
Finally, the answer came to them.
|
||||
|
||||
The retrieval code is based on a concept called [lagrange interpolation][13]. It evaluates a polynomial at `0` based on its values in `n` other places, where `n` is the degree of the polynomial. The way it works is that you can explicitly find a formula for a polynomial that is `1` at `t[0]` and `0` at `t[i]` for `i` different from `0`. Since evaluating a polynomial is a linear function, you evaluate each of _these_ polynomials and interpolate the results of the evaluations with the values the polynomial has:
|
||||
|
||||
|
||||
```
|
||||
from functools import reduce
|
||||
from operator import mul
|
||||
|
||||
def retrieve_original(secrets):
|
||||
x_s = [s[0] for s in secrets]
|
||||
acc = Mod(0, P)
|
||||
for i in range(len(secrets)):
|
||||
others = list(x_s)
|
||||
cur = others.pop(i)
|
||||
factor = Mod(1, P)
|
||||
for el in others:
|
||||
factor *= el * (el - cur).inverse()
|
||||
acc += factor * secrets[i][1]
|
||||
return acc
|
||||
```
|
||||
|
||||
It is no surprise this took them 40 days and 40 nights—this code is pretty complicated! But they ran it on the surviving shards, waiting with bated breath:
|
||||
|
||||
|
||||
```
|
||||
`retrieved_secret = retrieve_original(retrieved)`
|
||||
```
|
||||
|
||||
Did the children get the correct secret?
|
||||
|
||||
|
||||
```
|
||||
`retrieved_secret == secret`[/code] [code]`TRUE`
|
||||
```
|
||||
|
||||
The beauty of math's magic is that it works reliably every time! The children, now older and able to understand their father's choices, used the terrible secret to defend the kingdom. The kingdom prospered and grew.
|
||||
|
||||
### A modern story of Shamir's Secret Sharing
|
||||
|
||||
In modern times, many of us are also burdened with a terrible secret: the master password to our password manager. While few people have one person they can trust completely with their deepest, darkest secrets, many can find a group of five where it is unlikely three will break their trust together.
|
||||
|
||||
Luckily, in these modern times, we do not need to split our secrets ourselves, as the king did. Through the modern technology of _open source_, we can use software that exists.
|
||||
|
||||
Let's say you have five people you trust—not absolutely, but quite a bit: Your best friend, your spouse, your mom, a close colleague, and your lawyer.
|
||||
|
||||
You can install and run the program `ssss` to split the key:
|
||||
|
||||
|
||||
```
|
||||
$ echo 'long legs travel fast' | ssss-split -t 3 -n 5
|
||||
Generating shares using a (3,5) scheme with dynamic security level.
|
||||
Enter the secret, at most 128 ASCII characters: Using a 168 bit security level.
|
||||
1-797842b76d80771f04972feb31c66f3927e7183609
|
||||
2-947925f2fbc23dc9bca950ef613da7a4e42dc1c296
|
||||
3-14647bdfc4e6596e0dbb0aa6ab839b195c9d15906d
|
||||
4-97c77a805cd3d3a30bff7841f3158ea841cd41a611
|
||||
5-17da24ad63f7b704baed220839abb215f97d95f4f8
|
||||
```
|
||||
|
||||
Ah, a strong, powerful, master password: `long legs travel fast`. Never can it be entrusted to a single soul, but you can send the five shards to your five guardians.
|
||||
|
||||
* You send `1` to your best friend, F.
|
||||
* You send `2` to your spouse, S.
|
||||
* You send `3` to your mom, M.
|
||||
* You send `4` to your colleague, C.
|
||||
* You send `5` to your lawyer, L.
|
||||
|
||||
|
||||
|
||||
Now, say you go on a family vacation. For a month, you frolic on the warm sands of the beach. While you frolic, you touch not one electronic device. Soon enough, your powerful master password is forgotten.
|
||||
|
||||
Your loving spouse and your dear mother were with you on vacation. They kept their shards safe in their password manager—and they have forgotten _their passwords_.
|
||||
|
||||
This is fine.
|
||||
|
||||
You contact your best friend, F, who gives you `1-797842b76d80771f04972feb31c66f3927e7183609`. Your colleague, who covered all your shifts, is glad to have you back and gives you `4-97c77a805cd3d3a30bff7841f3158ea841cd41a611`. Your lawyer charges you $150 per hour, goes into their password manager, and digs up `5-17da24ad63f7b704baed220839abb215f97d95f4f8`.
|
||||
|
||||
With those three pieces, you run:
|
||||
|
||||
|
||||
```
|
||||
$ ssss-combine -t 3
|
||||
Enter 3 shares separated by newlines:
|
||||
Share [1/3]: 1-797842b76d80771f04972feb31c66f3927e7183609
|
||||
Share [2/3]: 4-97c77a805cd3d3a30bff7841f3158ea841cd41a611
|
||||
Share [3/3]: 5-17da24ad63f7b704baed220839abb215f97d95f4f8
|
||||
Resulting secret: long legs travel fast
|
||||
```
|
||||
|
||||
And so, with the technology of _open source_, you too can live like a king!
|
||||
|
||||
### Share safely for your safety
|
||||
|
||||
Password management is an essential skill for today's online life. Create a complex password, of course, but don't stop there. Use the handy Shamir's Secret Sharing algorithm to safely share it with others.
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://opensource.com/article/20/6/python-passwords
|
||||
|
||||
作者:[Moshe Zadka][a]
|
||||
选题:[lujun9972][b]
|
||||
译者:[译者ID](https://github.com/译者ID)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]: https://opensource.com/users/moshez
|
||||
[b]: https://github.com/lujun9972
|
||||
[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/search_find_code_python_programming.png?itok=ynSL8XRV (Searching for code)
|
||||
[2]: https://monitor.firefox.com/security-tips
|
||||
[3]: https://opensource.com/sites/default/files/uploads/password_strength-xkcd.png (XKCD comic on password strength)
|
||||
[4]: https://imgs.xkcd.com/comics/password_strength.png
|
||||
[5]: https://creativecommons.org/licenses/by-nc/2.5/
|
||||
[6]: https://en.wikipedia.org/wiki/Secret_sharing#Shamir's_scheme
|
||||
[7]: https://opensource.com/article/18/5/cryptography-pki
|
||||
[8]: https://en.wikipedia.org/wiki/Finite_field
|
||||
[9]: https://en.wikipedia.org/wiki/Mersenne_prime
|
||||
[10]: https://en.wikipedia.org/wiki/Field_(mathematics)
|
||||
[11]: https://pypi.org/project/mod/
|
||||
[12]: https://en.wikipedia.org/wiki/Polynomial
|
||||
[13]: https://www.math.usm.edu/lambers/mat772/fall10/lecture5.pdf
|
||||
@@ -0,0 +1,576 @@
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: ( )
|
||||
[#]: reviewer: ( )
|
||||
[#]: publisher: ( )
|
||||
[#]: url: ( )
|
||||
[#]: subject: (Stop debugging Go with Println and use Delve instead)
|
||||
[#]: via: (https://opensource.com/article/20/6/debug-go-delve)
|
||||
[#]: author: (Gaurav Kamathe https://opensource.com/users/gkamathe)
|
||||
|
||||
Stop debugging Go with Println and use Delve instead
|
||||
======
|
||||
Delve is packed with functionality to make debugging a breeze.
|
||||
![Bug tracking magnifying glass on computer screen][1]
|
||||
|
||||
When was the last time you tried to learn a new programming language? Do you stick with your tried and true, or are you one of the brave souls who tries out a new one as soon as it is announced? Either way, learning a new language can be extremely useful, and a lot of fun.
|
||||
|
||||
You try out with a simple "Hello, world!" then move onto writing some sample code and executing it, making minor changes along the way and then moving on from there. I am sure we have all gone through this experience no matter which technology we've worked on. Though if you do manage to stay with a language for some time, and you wish to become proficient in it, there are a few things that can help you along the way.
|
||||
|
||||
One of those things is a debugger. Some people prefer debugging using simple "print" statements in code, and they are fine for a few simple line programs; however, if you are working on a large project with multiple developers and thousands of lines of code, it makes sense to invest in a debugger.
|
||||
|
||||
I've recently started learning the Go programming language, and in this article, we will explore a debugger called Delve. Delve is a special utility made to debug Go programs, and we will cover some of its features using some sample Go code. Don't worry about the Go code examples presented here; they are understandable even if you have never programmed in Go before. One of the goals of Go is simplicity, so the code is consistent, which can be easier to understand and interpret.
|
||||
|
||||
### Introduction to Delve
|
||||
|
||||
Delve is an open source project hosted at [GitHub][2].
|
||||
|
||||
In its own words:
|
||||
|
||||
_Delve is a debugger for the Go programming language. The goal of the project is to provide a simple, full-featured debugging tool for Go. Delve should be easy to invoke and easy to use. Chances are if you're using a debugger, things aren't going your way. With that in mind, Delve should stay out of your way as much as possible._
|
||||
|
||||
Let's take a closer look.
|
||||
|
||||
My test system is a laptop running Fedora Linux along with the following Go compiler version:
|
||||
|
||||
|
||||
```
|
||||
$ cat /etc/fedora-release
|
||||
Fedora release 30 (Thirty)
|
||||
$
|
||||
$ go version
|
||||
go version go1.12.17 linux/amd64
|
||||
$
|
||||
```
|
||||
|
||||
### Golang installation
|
||||
|
||||
If you do not have Go installed, you can get it by simply running the following command to fetch it from your configured repositories.
|
||||
|
||||
|
||||
```
|
||||
`$ dnf install golang.x86_64`
|
||||
```
|
||||
|
||||
Alternatively, you can visit the [install page][3] for other installation options suitable for your OS distribution.
|
||||
|
||||
Before we get started, please ensure that the following required PATHS are set, as required by Go tools. If these paths are not set, some of the examples might not work. These can be easily set as environment variables in your SHELL's RC file, like the `$HOME/bashrc` file in my case.
|
||||
|
||||
|
||||
```
|
||||
$ go env | grep GOPATH
|
||||
GOPATH="/home/user/go"
|
||||
$
|
||||
$ go env | grep GOBIN
|
||||
GOBIN="/home/user/go/gobin"
|
||||
$
|
||||
```
|
||||
|
||||
### Delve installation
|
||||
|
||||
You can install Delve by running a simple `go get` command, as shown below. `go get` is the Golang way of downloading and installing required packages from external sources. If you do face any issues with installation, please refer to the install instructions for Delve [here][4].
|
||||
|
||||
|
||||
```
|
||||
$ go get -u github.com/go-delve/delve/cmd/dlv
|
||||
$
|
||||
```
|
||||
|
||||
Running the above command downloads Delve to your $GOPATH location, which, in the default case, happens to be $HOME/go. It will be different if you have set $GOPATH to something else.
|
||||
|
||||
You can move to the go/ directory, within which you will see `dlv` under bin/ directory.
|
||||
|
||||
|
||||
```
|
||||
$ ls -l $HOME/go
|
||||
total 8
|
||||
drwxrwxr-x. 2 user user 4096 May 25 19:11 bin
|
||||
drwxrwxr-x. 4 user user 4096 May 25 19:21 src
|
||||
$
|
||||
$ ls -l ~/go/bin/
|
||||
total 19596
|
||||
-rwxrwxr-x. 1 user user 20062654 May 25 19:17 dlv
|
||||
$
|
||||
```
|
||||
|
||||
Since you installed Delve under $GOPATH, it is also available as a regular shell command, so you do not have to move to the directory where it is installed every time. You can verify `dlv` is correctly installed by running it with the `version` option. The version it installed is 1.4.1.
|
||||
|
||||
|
||||
```
|
||||
$ which dlv
|
||||
~/go/bin/dlv
|
||||
$
|
||||
$ dlv version
|
||||
Delve Debugger
|
||||
Version: 1.4.1
|
||||
Build: $Id: bda606147ff48b58bde39e20b9e11378eaa4db46 $
|
||||
$
|
||||
```
|
||||
|
||||
Now, let's use Delve with some Go programs to understand its features and how to use them. As we do with all programs, let's start with a simple "Hello, world!" message, which, in Go, is called `hello.go`.
|
||||
|
||||
Remember, I am placing these sample programs within the $GOBIN directory.
|
||||
|
||||
|
||||
```
|
||||
$ pwd
|
||||
/home/user/go/gobin
|
||||
$
|
||||
$ cat hello.go
|
||||
package main
|
||||
|
||||
import "fmt"
|
||||
|
||||
func main() {
|
||||
fmt.Println("Hello, world!")
|
||||
}
|
||||
$
|
||||
```
|
||||
|
||||
To build a Go program, you run the `build` command and provide it with the source file using the .go extention. If the program is free of any syntax issues, the Go compiler compiles it and puts out a binary or executables file. This file can then be executed directly, and we see the "Hello, world!" message displayed onscreen.
|
||||
|
||||
|
||||
```
|
||||
$ go build hello.go
|
||||
$
|
||||
$ ls -l hello
|
||||
-rwxrwxr-x. 1 user user 1997284 May 26 12:13 hello
|
||||
$
|
||||
$ ./hello
|
||||
Hello, world!
|
||||
$
|
||||
```
|
||||
|
||||
### Loading a program in Delve
|
||||
|
||||
There are two ways to load a program into the Delve debugger.
|
||||
|
||||
**Using the debug argument when source code is not yet compiled to binary.**
|
||||
|
||||
The first way is to use the **debug** command when you simply need to source files. Delve compiles a binary for you named **__debug_bin**, and loads it into the debugger.
|
||||
|
||||
In this example, move to the directory where **hello.go** is present and run the **dlv debug** command. If there are multiple Go source files within a directory and each has its own main function, then Delve might throw an error, expecting a single program or a single project to build a binary from. Should that occur, you're better off using the second option, presented below.
|
||||
|
||||
|
||||
```
|
||||
$ ls -l
|
||||
total 4
|
||||
-rw-rw-r--. 1 user user 74 Jun 4 11:48 hello.go
|
||||
$
|
||||
$ dlv debug
|
||||
Type 'help' for list of commands.
|
||||
(dlv)
|
||||
```
|
||||
|
||||
Now open another terminal and list the contents of the same directory. You see an additional **__debug_bin** binary that was compiled from the source code and loaded into the debugger. You can now move to the **dlv** prompt to continue using Delve further.
|
||||
|
||||
|
||||
|
||||
```
|
||||
$ ls -l
|
||||
total 2036
|
||||
-rwxrwxr-x. 1 user user 2077085 Jun 4 11:48 __debug_bin
|
||||
-rw-rw-r--. 1 user user 74 Jun 4 11:48 hello.go
|
||||
$
|
||||
```
|
||||
|
||||
**Using the exec argument**
|
||||
The second method to load a program into Delve is useful when you have a pre-compiled Go binary, or one that you have already compiled using the **go build** command, and don't want Delve to compile it to a `__debug_bin` binary. In such cases, use the **exec** argument to load the binary directory into the Delve debugger.
|
||||
|
||||
|
||||
```
|
||||
$ ls -l
|
||||
total 4
|
||||
-rw-rw-r--. 1 user user 74 Jun 4 11:48 hello.go
|
||||
$
|
||||
$ go build hello.go
|
||||
$
|
||||
$ ls -l
|
||||
total 1956
|
||||
-rwxrwxr-x. 1 user user 1997284 Jun 4 11:54 hello
|
||||
-rw-rw-r--. 1 user user 74 Jun 4 11:48 hello.go
|
||||
$
|
||||
$ dlv exec ./hello
|
||||
Type 'help' for list of commands.
|
||||
(dlv)
|
||||
```
|
||||
|
||||
### Getting help within Delve
|
||||
|
||||
At the **dlv** prompt, you can run `help` to have a look at the various help options available in Delve. The command list is quite extensive, and we will cover some of the important features here. Following is an overview of Delve's functionality.
|
||||
|
||||
|
||||
```
|
||||
(dlv) help
|
||||
The following commands are available:
|
||||
|
||||
Running the program:
|
||||
|
||||
Manipulating breakpoints:
|
||||
|
||||
Viewing program variables and memory:
|
||||
|
||||
Listing and switching between threads and goroutines:
|
||||
|
||||
Viewing the call stack and selecting frames:
|
||||
|
||||
Other commands:
|
||||
|
||||
Type help followed by a command for full documentation.
|
||||
(dlv)
|
||||
```
|
||||
|
||||
#### Setting breakpoints
|
||||
|
||||
Now that we have loaded the hello.go program within the Delve debugger, let's set the breakpoint on our main function and then confirm it. Within Go, the main program starts with `main.main`, so you need to provide this name to the `break command`. Next, we will see if the breakpoint was set correctly using the `breakpoints` command.
|
||||
|
||||
Also, remember you can use shorthands for commands, so instead of using `break main.main`, you can also use `b main.main` to the same effect, or `bp` instead of `breakpoints`. To find the exact shorthand for a command, please refer to the help section by running the `help` command.
|
||||
|
||||
|
||||
```
|
||||
(dlv) break main.main
|
||||
Breakpoint 1 set at 0x4a228f for main.main() ./hello.go:5
|
||||
(dlv) breakpoints
|
||||
Breakpoint runtime-fatal-throw at 0x42c410 for runtime.fatalthrow() /usr/lib/golang/src/runtime/panic.go:663 (0)
|
||||
Breakpoint unrecovered-panic at 0x42c480 for runtime.fatalpanic() /usr/lib/golang/src/runtime/panic.go:690 (0)
|
||||
print runtime.curg._panic.arg
|
||||
Breakpoint 1 at 0x4a228f for main.main() ./hello.go:5 (0)
|
||||
(dlv)
|
||||
```
|
||||
|
||||
#### Continue execution of the program
|
||||
|
||||
Now, let's continue running the program using "continue." It will run until it hits a breakpoint, which, in our case, is the `main.main` or the main function. From there, we can use the `next` command to execute the program line by line. Notice that, once we move ahead of `fmt.Println("Hello, world!")`, we can see that `Hello, world!` is printed to the screen while we are still within the debugger session.
|
||||
|
||||
|
||||
```
|
||||
(dlv) continue
|
||||
> main.main() ./hello.go:5 (hits goroutine(1):1 total:1) (PC: 0x4a228f)
|
||||
1: package main
|
||||
2:
|
||||
3: import "fmt"
|
||||
4:
|
||||
=> 5: func main() {
|
||||
6: fmt.Println("Hello, world!")
|
||||
7: }
|
||||
(dlv) next
|
||||
> main.main() ./hello.go:6 (PC: 0x4a229d)
|
||||
1: package main
|
||||
2:
|
||||
3: import "fmt"
|
||||
4:
|
||||
5: func main() {
|
||||
=> 6: fmt.Println("Hello, world!")
|
||||
7: }
|
||||
(dlv) next
|
||||
Hello, world!
|
||||
> main.main() ./hello.go:7 (PC: 0x4a22ff)
|
||||
2:
|
||||
3: import "fmt"
|
||||
4:
|
||||
5: func main() {
|
||||
6: fmt.Println("Hello, world!")
|
||||
=> 7: }
|
||||
(dlv)
|
||||
```
|
||||
|
||||
#### Quitting Delve
|
||||
|
||||
If you wish to quit the debugger at any time, you can run the `quit` command, and you will be returned to the shell prompt. Pretty simple, right?
|
||||
|
||||
|
||||
```
|
||||
(dlv) quit
|
||||
$
|
||||
```
|
||||
|
||||
Let's use some other Go programs to explore some other Delve features. This time, we will pick a program from the [Golang tour][5]. If you are learning Go, the Golang tour should be your first stop.
|
||||
|
||||
The following program, `functions.go`, simply displays how functions are defined and called in a Go program. Here, we have a simple `add()` function that adds two numbers and returns their value. You can build the program and execute it, as shown below.
|
||||
|
||||
|
||||
```
|
||||
$ cat functions.go
|
||||
package main
|
||||
|
||||
import "fmt"
|
||||
|
||||
func add(x int, y int) int {
|
||||
return x + y
|
||||
}
|
||||
|
||||
func main() {
|
||||
fmt.Println(add(42, 13))
|
||||
}
|
||||
$
|
||||
```
|
||||
|
||||
You can build the program and execute it as shown below.
|
||||
|
||||
|
||||
```
|
||||
$ go build functions.go && ./functions
|
||||
55
|
||||
$
|
||||
```
|
||||
|
||||
#### Stepping into functions
|
||||
|
||||
As shown earlier, let's load the binary into the Delve debugger using one of the options mentioned earlier, again setting a breakpoint at `main.main` and continuing to run the program while we hit the breakpoint. Then hit `next` until you reach `fmt.Println(add(42, 13))`; here we make a call to the `add()` function. We can use the Delve `step` command to move from the `main` function to the `add()` function, as seen below.
|
||||
|
||||
|
||||
```
|
||||
$ dlv debug
|
||||
Type 'help' for list of commands.
|
||||
(dlv) break main.main
|
||||
Breakpoint 1 set at 0x4a22b3 for main.main() ./functions.go:9
|
||||
(dlv) c
|
||||
> main.main() ./functions.go:9 (hits goroutine(1):1 total:1) (PC: 0x4a22b3)
|
||||
4:
|
||||
5: func add(x int, y int) int {
|
||||
6: return x + y
|
||||
7: }
|
||||
8:
|
||||
=> 9: func main() {
|
||||
10: fmt.Println(add(42, 13))
|
||||
11: }
|
||||
(dlv) next
|
||||
> main.main() ./functions.go:10 (PC: 0x4a22c1)
|
||||
5: func add(x int, y int) int {
|
||||
6: return x + y
|
||||
7: }
|
||||
8:
|
||||
9: func main() {
|
||||
=> 10: fmt.Println(add(42, 13))
|
||||
11: }
|
||||
(dlv) step
|
||||
> main.add() ./functions.go:5 (PC: 0x4a2280)
|
||||
1: package main
|
||||
2:
|
||||
3: import "fmt"
|
||||
4:
|
||||
=> 5: func add(x int, y int) int {
|
||||
6: return x + y
|
||||
7: }
|
||||
8:
|
||||
9: func main() {
|
||||
10: fmt.Println(add(42, 13))
|
||||
(dlv)
|
||||
```
|
||||
|
||||
#### Set breakpoint using filename: linenumber
|
||||
|
||||
Above, we went through `main` and then moved to the `add()` function, but you can also use the `filename:linenumber` combination to set a breakpoint directly where we want it. Following is another way of setting a breakpoint at the start of the `add()` function.
|
||||
|
||||
|
||||
```
|
||||
(dlv) break functions.go:5
|
||||
Breakpoint 1 set at 0x4a2280 for main.add() ./functions.go:5
|
||||
(dlv) continue
|
||||
> main.add() ./functions.go:5 (hits goroutine(1):1 total:1) (PC: 0x4a2280)
|
||||
1: package main
|
||||
2:
|
||||
3: import "fmt"
|
||||
4:
|
||||
=> 5: func add(x int, y int) int {
|
||||
6: return x + y
|
||||
7: }
|
||||
8:
|
||||
9: func main() {
|
||||
10: fmt.Println(add(42, 13))
|
||||
(dlv)
|
||||
```
|
||||
|
||||
#### View current stack details
|
||||
|
||||
Now that we are at the `add()` function, we can view the current contents of the stack using the `stack` command in Delve. This shows the topmost function `add()` at 0 where we are, followed by `main.main` at 1 from where the `add()` function was called. Functions below `main.main` belong to the Go runtime, which is responsible for loading and executing the program.
|
||||
|
||||
|
||||
```
|
||||
(dlv) stack
|
||||
0 0x00000000004a2280 in main.add
|
||||
at ./functions.go:5
|
||||
1 0x00000000004a22d7 in main.main
|
||||
at ./functions.go:10
|
||||
2 0x000000000042dd1f in runtime.main
|
||||
at /usr/lib/golang/src/runtime/proc.go:200
|
||||
3 0x0000000000458171 in runtime.goexit
|
||||
at /usr/lib/golang/src/runtime/asm_amd64.s:1337
|
||||
(dlv)
|
||||
```
|
||||
|
||||
#### Move between frames
|
||||
|
||||
Using the `frame` command in Delve, we can switch between the above frames at will. In the example below, using `frame 1` switches us from within the `add()` frame to the `main.main` frame, and so on.
|
||||
|
||||
|
||||
```
|
||||
(dlv) frame 0
|
||||
> main.add() ./functions.go:5 (hits goroutine(1):1 total:1) (PC: 0x4a2280)
|
||||
Frame 0: ./functions.go:5 (PC: 4a2280)
|
||||
1: package main
|
||||
2:
|
||||
3: import "fmt"
|
||||
4:
|
||||
=> 5: func add(x int, y int) int {
|
||||
6: return x + y
|
||||
7: }
|
||||
8:
|
||||
9: func main() {
|
||||
10: fmt.Println(add(42, 13))
|
||||
(dlv) frame 1
|
||||
> main.add() ./functions.go:5 (hits goroutine(1):1 total:1) (PC: 0x4a2280)
|
||||
Frame 1: ./functions.go:10 (PC: 4a22d7)
|
||||
5: func add(x int, y int) int {
|
||||
6: return x + y
|
||||
7: }
|
||||
8:
|
||||
9: func main() {
|
||||
=> 10: fmt.Println(add(42, 13))
|
||||
11: }
|
||||
(dlv)
|
||||
```
|
||||
|
||||
**Print function arguments**
|
||||
|
||||
A function often accepts multiple arguments to work on. In the case of the `add()` function, it accepts two integers. Delve has a handy command called `args`, which displays the command-line arguments passed to the function.
|
||||
|
||||
|
||||
```
|
||||
(dlv) args
|
||||
x = 42
|
||||
y = 13
|
||||
~r2 = 824633786832
|
||||
(dlv)
|
||||
```
|
||||
|
||||
#### View disassembly
|
||||
|
||||
Since we are dealing with compiled binaries, it is extremely helpful to be able to see the assembly language instructions produced by the compiler. Delve provides a `disassemble` command to view these. In the example below, we use it to view the disassembly instructions for the `add()` function.
|
||||
|
||||
|
||||
```
|
||||
(dlv) step
|
||||
> main.add() ./functions.go:5 (PC: 0x4a2280)
|
||||
1: package main
|
||||
2:
|
||||
3: import "fmt"
|
||||
4:
|
||||
=> 5: func add(x int, y int) int {
|
||||
6: return x + y
|
||||
7: }
|
||||
8:
|
||||
9: func main() {
|
||||
10: fmt.Println(add(42, 13))
|
||||
(dlv) disassemble
|
||||
TEXT main.add(SB) /home/user/go/gobin/functions.go
|
||||
=> functions.go:5 0x4a2280 48c744241800000000 mov qword ptr [rsp+0x18], 0x0
|
||||
functions.go:6 0x4a2289 488b442408 mov rax, qword ptr [rsp+0x8]
|
||||
functions.go:6 0x4a228e 4803442410 add rax, qword ptr [rsp+0x10]
|
||||
functions.go:6 0x4a2293 4889442418 mov qword ptr [rsp+0x18], rax
|
||||
functions.go:6 0x4a2298 c3 ret
|
||||
(dlv)
|
||||
```
|
||||
|
||||
#### Stepout of functions
|
||||
|
||||
Another feature is `stepout`, which allows us to return back to where the function was called from. In our example, if we wish to return to the `main.main` function, we can simply run the `stepout` command and it will take us back. This can be quite a handy tool to help you move around in a large codebase.
|
||||
|
||||
|
||||
```
|
||||
(dlv) stepout
|
||||
> main.main() ./functions.go:10 (PC: 0x4a22d7)
|
||||
Values returned:
|
||||
~r2: 55
|
||||
|
||||
5: func add(x int, y int) int {
|
||||
6: return x + y
|
||||
7: }
|
||||
8:
|
||||
9: func main() {
|
||||
=> 10: fmt.Println(add(42, 13))
|
||||
11: }
|
||||
(dlv)
|
||||
```
|
||||
|
||||
Let's use another sample program from the [Go tour][6] to see how Delve deals with variables in Go. The following sample program defines and initializes some variables of different types. You can build the program and execute it.
|
||||
|
||||
|
||||
```
|
||||
$ cat variables.go
|
||||
package main
|
||||
|
||||
import "fmt"
|
||||
|
||||
var i, j int = 1, 2
|
||||
|
||||
func main() {
|
||||
var c, python, java = true, false, "no!"
|
||||
fmt.Println(i, j, c, python, java)
|
||||
}
|
||||
$
|
||||
|
||||
$ go build variables.go && ./variables
|
||||
1 2 true false no!
|
||||
$
|
||||
```
|
||||
|
||||
#### Print variable information
|
||||
|
||||
As stated earlier, use `delve debug` to load the program in the debugger. You can use the `print` command from within Delve along with the variable name to show their current values.
|
||||
|
||||
|
||||
```
|
||||
(dlv) print c
|
||||
true
|
||||
(dlv) print java
|
||||
"no!"
|
||||
(dlv)
|
||||
```
|
||||
|
||||
Alternatively, you can use the `locals` command to print all local variables within a function.
|
||||
|
||||
|
||||
```
|
||||
(dlv) locals
|
||||
python = false
|
||||
c = true
|
||||
java = "no!"
|
||||
(dlv)
|
||||
```
|
||||
|
||||
If you are not aware of the type of the variable, you can use the `whatis` command along with the variable name to print the type.
|
||||
|
||||
|
||||
```
|
||||
(dlv) whatis python
|
||||
bool
|
||||
(dlv) whatis c
|
||||
bool
|
||||
(dlv) whatis java
|
||||
string
|
||||
(dlv)
|
||||
```
|
||||
|
||||
### Conclusion
|
||||
|
||||
So far, we have only scratched the surface of the features Delve offers. You can refer to the `help` section and try out various other commands. Some of the other useful features include attaching Delve to running Go programs (daemons!) or even using Delve to explore some of the internals of Golang libraries, provided you have the Go source code package installed. Keep exploring!
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://opensource.com/article/20/6/debug-go-delve
|
||||
|
||||
作者:[Gaurav Kamathe][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/gkamathe
|
||||
[b]: https://github.com/lujun9972
|
||||
[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/bug_software_issue_tracking_computer_screen.jpg?itok=6qfIHR5y (Bug tracking magnifying glass on computer screen)
|
||||
[2]: https://github.com/go-delve/delve
|
||||
[3]: https://golang.org/doc/install
|
||||
[4]: https://github.com/go-delve/delve/blob/master/Documentation/installation/linux/install.md
|
||||
[5]: https://tour.golang.org/basics/4
|
||||
[6]: https://tour.golang.org/basics/9
|
||||
@@ -0,0 +1,149 @@
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: ( )
|
||||
[#]: reviewer: ( )
|
||||
[#]: publisher: ( )
|
||||
[#]: url: ( )
|
||||
[#]: subject: (How to Install Opera Browser on Ubuntu [Easy Way])
|
||||
[#]: via: (https://itsfoss.com/install-opera-ubuntu/)
|
||||
[#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/)
|
||||
|
||||
How to Install Opera Browser on Ubuntu [Easy Way]
|
||||
======
|
||||
|
||||
_**Learn how to install Opera browser easily and safely on Ubuntu and Debian based distributions.**_
|
||||
|
||||
[Opera browser][1] was among the first few browsers to have a speed dial feature for quickly accessing most visited websites from the new tab.
|
||||
|
||||
Opera still offers several interesting features such as a free VPN, ad-blocker, social media messengers in the sidebar, battery saver, grouping tabs in workspaces etc.
|
||||
|
||||
Personally, I do not use Opera. It is not open source. It’s [so-called free-VPN is not that good][2] (it’s hardly even a VPN). After [its acquisition by a Chinese group][3], transparency took another hit. It [collects a vast amount of data][4], same as Alibaba’s UC Browser.
|
||||
|
||||
Anyway, I am not here to make a case against Opera. If you want to install and use Opera on Ubuntu, let me show you how to do that easily and safely.
|
||||
|
||||
Non-FOSS alert!
|
||||
|
||||
Opera browser is not open source. It is covered here because it is available on Linux and the article’s focus is on Linux.
|
||||
|
||||
### Installing Opera browser on Ubuntu
|
||||
|
||||
Installing Opera Browser in Ubuntu and Debian-based distributions is as simple as installing the DEB file from its download page and double-clicking on it.
|
||||
|
||||
Go to [Opera’s download page][5] and click on Download button to download the .DEB installer file.
|
||||
|
||||
![Download Opera Browser][6]
|
||||
|
||||
Once you have downloaded it, double-click on it to [install the application from deb file][7]. In Ubuntu 20.04, you may have to [right click and select “Open With Software” option][8].
|
||||
|
||||
It will open Opera in Software Center and you can just lick on the install button to install Opera.
|
||||
|
||||
![][9]
|
||||
|
||||
The good thing about this method is that it automatically adds an entry in the repository list. This way, you’ll get all the future updates to the Opera browser with the regular system updates.
|
||||
|
||||
![Opera source added to repository list to provide you regular updates][10]
|
||||
|
||||
This is same as [installing Google Chrome on Ubuntu][11] as an entry is adding for Chrome to provide you regular updates.
|
||||
|
||||
See, how easy it was to install Opera?
|
||||
|
||||
#### How to remove Opera browser
|
||||
|
||||
You can look for the installed applications in the software center and uninstall Opera from there.
|
||||
|
||||
![Remove Opera from the Software Center][12]
|
||||
|
||||
You may also use terminal to remove it in this fashion:
|
||||
|
||||
```
|
||||
sudo apt remove opera-stable
|
||||
```
|
||||
|
||||
You may also choose to remove the additional Opera repository added in the sources list.
|
||||
|
||||
![Remove Opera Repository][13]
|
||||
|
||||
Installing Opera browser via command line (for intermediate to expert users)
|
||||
|
||||
Installing Opera browser graphically as described above is simplest and easiest method. If you want to take the command line route, you can do that as well.
|
||||
|
||||
First, make sure to [install Curl on Ubuntu][14]:
|
||||
|
||||
```
|
||||
sudo apt install curl
|
||||
```
|
||||
|
||||
Download and add the Opera repository key:
|
||||
|
||||
```
|
||||
curl https://deb.opera.com/archive.key | sudo apt-key add -
|
||||
```
|
||||
|
||||
Now add the Opera repository in your sources list directory (not file):
|
||||
|
||||
```
|
||||
echo deb https://deb.opera.com/opera-stable/ stable non-free | sudo tee /etc/apt/sources.list.d/opera.list
|
||||
```
|
||||
|
||||
Update the package cache so that your system is aware of the packages available by the newly added repository:
|
||||
|
||||
```
|
||||
sudo apt update
|
||||
```
|
||||
|
||||
Finally, install the opera-stable package to install Opera.
|
||||
|
||||
```
|
||||
sudo apt install opera-stable
|
||||
```
|
||||
|
||||
During the installation, you’ll be prompted for adding Opera repository to sources list. Select NO because you already did that.
|
||||
|
||||
To remove Opera browser installed this way, you should use the following commands one by one:
|
||||
|
||||
```
|
||||
sudo apt remove opera-stable
|
||||
sudo rm -f /etc/apt/sources.list.d/opera.list
|
||||
```
|
||||
|
||||
#### Opera as Snap
|
||||
|
||||
Opera browser is also available as a snap package officially. If you have [Snap support enabled in your Linux distribution][15], you may install Opera via Snap:
|
||||
|
||||
```
|
||||
sudo snap install opera
|
||||
```
|
||||
|
||||
**Conclusion**
|
||||
|
||||
One of It’s FOSS readers contacted me with a repository issue that was caused by the incorrect Opera browser installation.
|
||||
|
||||
I had to write this straightforward tutorial because some other websites on the internet are suggesting methods with unnecessarily complicated commands that might end up with a corrupt sources.list. I do hope it helps new Linux users.
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://itsfoss.com/install-opera-ubuntu/
|
||||
|
||||
作者:[Abhishek Prakash][a]
|
||||
选题:[lujun9972][b]
|
||||
译者:[译者ID](https://github.com/译者ID)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]: https://itsfoss.com/author/abhishek/
|
||||
[b]: https://github.com/lujun9972
|
||||
[1]: https://www.opera.com/hi
|
||||
[2]: https://www.tomsguide.com/us/opera-vpn,review-4496.html
|
||||
[3]: https://www.nytimes.com/2016/02/11/business/dealbook/china-opera-kunlun-qihoo-golden-brick.html
|
||||
[4]: https://restoreprivacy.com/secure-browser/
|
||||
[5]: https://www.opera.com/hi/computer/opera
|
||||
[6]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/06/opera-browser-download.png?ssl=1
|
||||
[7]: https://itsfoss.com/install-deb-files-ubuntu/
|
||||
[8]: https://itsfoss.com/cant-install-deb-file-ubuntu/
|
||||
[9]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/06/install-opera-ubuntu.png?ssl=1
|
||||
[10]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/06/opera-source-added.png?ssl=1
|
||||
[11]: https://itsfoss.com/install-chrome-ubuntu/
|
||||
[12]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/06/remove-opera-browser-ubuntu.png?ssl=1
|
||||
[13]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/06/remove-opera-repository.png?ssl=1
|
||||
[14]: https://itsfoss.com/install-curl-ubuntu/
|
||||
[15]: https://itsfoss.com/install-snap-linux/
|
||||
Reference in New Issue
Block a user