mirror of
https://github.com/LCTT/TranslateProject.git
synced 2024-12-26 21:30:55 +08:00
Merge branch 'master' of https://github.com/LCTT/TranslateProject into translating
This commit is contained in:
commit
ae21ab5216
@ -0,0 +1,91 @@
|
||||
[#]: subject: "5 of the most curious uses of the Raspberry Pi"
|
||||
[#]: via: "https://opensource.com/article/23/3/most-curious-uses-raspberry-pi"
|
||||
[#]: author: "AmyJune Hineline https://opensource.com/users/amyjune"
|
||||
[#]: collector: "lkxed"
|
||||
[#]: translator: "ChatGPT"
|
||||
[#]: reviewer: "wxy"
|
||||
[#]: publisher: "wxy"
|
||||
[#]: url: "https://linux.cn/article-15970-1.html"
|
||||
|
||||
树莓派的五种最奇特的用途
|
||||
======
|
||||
|
||||
![][0]
|
||||
|
||||
> 人们使用树莓派做各种各样的事情。有哪些用途让你特别好奇的吗?
|
||||
|
||||
最近,我在一个电话会议上听到有人说开源社区是好奇心和解决问题的文化的结合。好奇心是我们解决问题的基础。在解决各种规模的问题时,我们使用了大量的开源工具,其中包括在功能极为方便的树莓派上运行的 [Linux][1]。
|
||||
|
||||
我们每个人都有各种不同的生活经历,所以我向我们的作者社区询问了他们所遇到的最奇特的树莓派用途。我有一种预感,这些令人惊奇的构建将会为其他人激发灵感。
|
||||
|
||||
### 使用树莓派进行实验
|
||||
|
||||
对我来说,树莓派是在家庭网络中增加额外开发资源的绝佳工具。如果我想要创建一个新的网站或者尝试一个新的软件工具,我不必让我的桌面 Linux 机器因为一堆我可能只在实验时使用一次的软件包而变得笨重。相反,我会将它设置在我的树莓派上。
|
||||
|
||||
如果我认为我将要做一些冒险的事情,我会使用备份的启动环境。我有两张 microSD 卡,这样我就可以在树莓派上插一张卡,同时设置第二张卡进行任何我想要的实验。额外的 microSD 卡成本并不高,但在我想要在第二个镜像上进行实验的时候,它能节省大量时间。只需关机,换下 microSD 卡,重新启动,立即就可以在专用的测试系统上工作。
|
||||
|
||||
当我不进行实验时,我的树莓派充当打印服务器,将我的非 WiFi 打印机连接到家庭网络上。它还是一个方便的 SSH 文件服务器,让我可以快速备份重要文件。
|
||||
|
||||
— [Jim Hall][3]
|
||||
|
||||
### 树莓派的流行
|
||||
|
||||
我见过的树莓派最令人惊讶的事情是它使小型单板计算机的概念变得流行和通俗化,并使其真正实用于大众。
|
||||
|
||||
在树莓派出现之前,我们有类似的小型单板计算机,但它们往往是小众的、昂贵的,并且从软件角度来看让人拒之千里。树莓派价格便宜,便宜到任何人都可以轻松为一个项目获得一台(不考虑目前难以获得的情况)。一旦它变得便宜,人们就会克服软件挑战,使其足够好以解决许多基本的计算任务,甚至可以将完整的真正的计算机用于特定任务,而不仅仅是微控制器。
|
||||
|
||||
我们拥有大量好的、相对廉价的小型单板计算机,这促进了各种调试、玩耍和 [实验][4]。人们愿意尝试新的想法,甚至推动了更多业余爱好者的硬件开发来支持这些想法。
|
||||
|
||||
老实说,这是我从树莓派看到的最令人惊奇和激进的事情:它根本性地改变了人们对计算的认知,尤其是树莓派擅长的领域,并不仅仅催生了自己的生态系统,现在还催生了无数其他多样化的生态系统。
|
||||
|
||||
— [John ‘Warthog9' Hawley][5]
|
||||
|
||||
### 蜜蜂的树莓派
|
||||
|
||||
在 2018 年,我和我的弟弟曾经养过几个蜂箱,并使用树莓派和各种传感器来监测蜂箱的温度和湿度。我们还计划在夏天实施蜂箱秤,以观察蜜蜂的产蜜情况,并在冬天测量重量,以查看蜜蜂是否有足够的食物。不过我们最终没有实施这个计划。
|
||||
|
||||
我们的小型监测解决方案基于树莓派 2B,运行 Raspbian Stretch(基于 Debian 9),并连接了一个温湿度传感器(DHT11)。在蜂箱内我们有三到四个这样的传感器,用于测量蜂箱入口孔、盖子下方和最低框架的温度。我们直接将传感器连接到树莓派,并使用 Python_DHT 传感器库读取数据。我们还建立了 [InfluxDB][6]、Telegraf,并最终设置了 [Grafana][7] 来可视化数据。
|
||||
|
||||
如果你想了解更多关于我们的设置的信息,我们在 [Linux Magazine][8] 上发表了一篇关于我们小型监测解决方案的文章。
|
||||
|
||||
— [Heike Jurzik][9]
|
||||
|
||||
### 树莓派的复古计算
|
||||
|
||||
我希望用树莓派创建一个模拟如何使用“开关和指示灯”将机器语言编程到旧式计算机的项目。使用树莓派的 GPIO 引脚,这看起来相当简单。例如,他们的在线手册上展示了如何使用 GPIO 开关控制 LED 的开关,或者使用按钮进行输入。我认为只需一些 LED 和开关,再加上在树莓派上运行的小程序,就可以模拟旧式计算机。不过,我缺乏空闲时间来从事这样的项目,这就是为什么我编写了 [Toy CPU][10] 来模拟它。
|
||||
|
||||
— [Jim Hall][3]
|
||||
|
||||
### 使用树莓派打造玩具
|
||||
|
||||
当我女儿四岁的时候,她要求圣诞节时给她买一个“巨齿鲨音乐盒”。她能在脑海中完美地想像出来。它会是粉红色的、闪闪发光的,上面有她的名字。当她打开盒子时,会播放这部热门电影的主题曲。她可以将巨齿鲨和其他宝贝都放在盒子里。在网上和商店里到处搜索后,我发现没有一个能与她的想象相媲美。于是我和丈夫决定,在我们自己的玩具店(也就是他的家庭办公室)自己动手制作一个。而这一切的核心当然是树莓派。他使用光传感器和 Python 脚本,让音乐在恰当的时刻播放。我们将科技设备谨慎地放置在音乐盒的底部,并根据她的审美进行装饰。那一年,开源技术让圣诞魔法成为了可能!
|
||||
|
||||
— [Lauren Pritchett][11]
|
||||
|
||||
*(题图:MJ/aa8f1412-0f1d-4780-99db-22d6522010b7)*
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://opensource.com/article/23/3/most-curious-uses-raspberry-pi
|
||||
|
||||
作者:[AmyJune Hineline][a]
|
||||
选题:[lkxed][b]
|
||||
译者:ChatGPT
|
||||
校对:[wxy](https://github.com/wxy)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]: https://opensource.com/users/amyjune
|
||||
[b]: https://github.com/lkxed/
|
||||
[1]: https://opensource.com/article/19/3/learn-linux-raspberry-pi
|
||||
[2]: https://opensource.com/article/22/3/run-drupal-raspberry-pi
|
||||
[3]: https://opensource.com/users/jim-hall
|
||||
[4]: https://opensource.com/article/20/8/kubernetes-raspberry-pi
|
||||
[5]: https://opensource.com/users/warthog9
|
||||
[6]: https://opensource.com/article/17/8/influxdb-time-series-database-stack
|
||||
[7]: https://opensource.com/article/21/3/raspberry-pi-grafana-cloud
|
||||
[8]: https://www.linux-magazine.com/index.php/layout/set/print/Issues/2018/214/Monitoring-Beehives
|
||||
[9]: https://opensource.com/users/hej
|
||||
[10]: https://opensource.com/article/23/1/learn-machine-language-retro-computer
|
||||
[11]: https://opensource.com/users/lauren-pritchett
|
||||
[0]: https://img.linux.net.cn/data/attachment/album/202307/05/165343at95f5gf954lfll6.jpg
|
@ -3,37 +3,41 @@
|
||||
[#]: author: "Pradeep Kumar https://www.linuxtechi.com/author/pradeep/"
|
||||
[#]: collector: "lkxed"
|
||||
[#]: translator: "geekpi"
|
||||
[#]: reviewer: " "
|
||||
[#]: publisher: " "
|
||||
[#]: url: " "
|
||||
[#]: reviewer: "wxy"
|
||||
[#]: publisher: "wxy"
|
||||
[#]: url: "https://linux.cn/article-15969-1.html"
|
||||
|
||||
如何在 Ubuntu 22.04 中安装和使用 Wireshark
|
||||
======
|
||||
|
||||
技术人员大家好,在这篇文章中我们将介绍如何在 Ubuntu 22.04 中安装和使用 wireshark。
|
||||
![][0]
|
||||
|
||||
Wireshark 是免费、开源、跨平台、基于 GUI 的网络数据包分析器,可用于 Linux、Windows、MacOS、Solaris 等。它实时捕获网络数据包并以人类可读的格式呈现它们。它使我们能够监控微观层面的网络数据包。它还有一个名为 “tshark” 的命令行程序,它执行与 Wireshark 相同的功能,但通过终端而不是通过 GUI。
|
||||
> 技术兄弟们,大家好,在这篇文章中我们将介绍如何在 Ubuntu 22.04 中安装和使用 Wireshark。
|
||||
|
||||
Wireshark 可用于网络故障排除、分析、软件和通信协议开发,也可用于教育目的。Wireshark 使用名为 “pcap” 的库来捕获网络数据包。
|
||||
Wireshark 是自由开源的、跨平台的、基于 GUI 的网络数据包分析器,可用于 Linux、Windows、MacOS、Solaris 等。它实时捕获网络数据包并以人类可读的格式呈现它们。它使我们能够监控微观层面的网络数据包。它还有一个名为 `tshark` 的命令行程序,它执行与 Wireshark 相同的功能,但通过终端而不是通过 GUI。
|
||||
|
||||
##### Wireshark 功能
|
||||
Wireshark 可用于网络故障排除、分析、软件和通信协议开发,也可用于教育目的。Wireshark 使用名为 `pcap` 的库来捕获网络数据包。
|
||||
|
||||
- 支持数百种检查协议,
|
||||
- 能够实时捕获数据包并保存它们以供以后离线分析,
|
||||
- 一些用于分析数据的过滤器,
|
||||
- 捕获的数据可以动态压缩和解压缩,
|
||||
- 支持多种数据分析文件格式,输出也可以保存为 XML、CSV、纯文本格式,
|
||||
- 可以从以太网、wifi、蓝牙、USB、帧中继、令牌环等多种接口捕获数据。
|
||||
### Wireshark 的功能
|
||||
|
||||
##### 先决条件
|
||||
- 支持检查数百种协议
|
||||
- 能够实时捕获数据包并保存它们以供以后离线分析
|
||||
- 一些用于分析数据的过滤器
|
||||
- 捕获的数据可以动态压缩和解压缩
|
||||
- 支持多种数据分析文件格式,输出也可以保存为 XML、CSV、纯文本格式
|
||||
- 可以从以太网、WiFi、蓝牙、USB、帧中继、令牌环等多种接口捕获数据
|
||||
|
||||
- 预装Ubuntu 22.04
|
||||
### 先决条件
|
||||
|
||||
- 预装 Ubuntu 22.04
|
||||
- 具有 sudo 权限的本地用户
|
||||
- 互联网连接
|
||||
|
||||
### Wireshark 安装步骤
|
||||
|
||||
Wireshark 包可在默认的 Ubuntu 仓库中使用,并且可以使用以下命令简单地安装。但你可能无法获得最新版本的 wireshark。
|
||||
#### 从 Ubuntu 仓库安装
|
||||
|
||||
Wireshark 包可在默认的 Ubuntu 仓库中找到,并且可以使用以下命令简单地安装。但你可能无法获得最新版本的 wireshark。
|
||||
|
||||
```
|
||||
$ sudo apt update
|
||||
@ -42,24 +46,26 @@ $ sudo apt install wireshark
|
||||
|
||||
![Apt-Command-Install-Wireshark-Ubuntu][1]
|
||||
|
||||
选择 “Yes” 允许非超级用户使用 wireshare 捕获数据包
|
||||
选择 “Yes” 允许非超级用户使用 Wireshark 捕获数据包:
|
||||
|
||||
![Allow-Non-SuperUsers-To-Capture-Packets-Wireshark-Ubuntu][2]
|
||||
|
||||
安装成功后,访问 Wireshare UI。从“活动”中搜索 “wireshark”,然后单击其图标。
|
||||
安装成功后,访问 Wireshare UI。从“<ruby>活动<rt>Activities</rt></ruby>”中搜索 “wireshark”,然后单击其图标。
|
||||
|
||||
![Wireshark-UI-Ubuntu-Linux-Desktop][3]
|
||||
|
||||
以上确认你的 wireshark 安装已成功完成。
|
||||
以上确认你的 Wireshark 安装已成功完成。
|
||||
|
||||
为了安装最新版本的 wireshark,我们必须使用以下 apt 命令启用官方 wireshark 仓库。
|
||||
#### 安装最新的版本
|
||||
|
||||
如果要安装最新版本的 Wireshark,我们必须使用以下 `apt` 命令启用官方 Wireshark 仓库:
|
||||
|
||||
```
|
||||
$ sudo add-apt-repository ppa:wireshark-dev/stable
|
||||
$ sudo apt update
|
||||
```
|
||||
|
||||
现在,安装最新版本的 wireshark,运行:
|
||||
现在,安装最新版本的 Wireshark,运行:
|
||||
|
||||
```
|
||||
$ sudo apt install wireshark -y
|
||||
@ -73,7 +79,7 @@ $ wireshark --version
|
||||
|
||||
![Wireshark-Version-Check-Ubuntu-Linux][4]
|
||||
|
||||
要允许普通用户使用 wireshark 使用和捕获数据包,请运行以下命令。
|
||||
要允许普通用户使用 Wireshark 使用和捕获数据包,请运行以下命令:
|
||||
|
||||
```
|
||||
$ sudo dpkg-reconfigure wireshark-common
|
||||
@ -83,14 +89,14 @@ $ sudo dpkg-reconfigure wireshark-common
|
||||
|
||||
![Allow-Regular-User-Use-Wireshark-Ubuntu][5]
|
||||
|
||||
使用 usermod 命令将本地用户添加到 wireshark 组。
|
||||
使用 `usermod` 命令将本地用户添加到 `wireshark` 组:
|
||||
|
||||
```
|
||||
$ sudo usermod -aG wireshark $USER
|
||||
$ newgrp wireshark
|
||||
```
|
||||
|
||||
要使上述更改生效,请重新启动系统一次。
|
||||
要使上述更改生效,请重新启动系统。
|
||||
|
||||
```
|
||||
$ sudo reboot
|
||||
@ -98,7 +104,7 @@ $ sudo reboot
|
||||
|
||||
### 使用 Wireshark 捕获数据包
|
||||
|
||||
启动 Wireshark,从“活动”->搜索 “Wireshark”。
|
||||
启动 Wireshark,从“活动”->搜索 “wireshark”。
|
||||
|
||||
![Access-Wireshark-Ubuntu-Desktop][6]
|
||||
|
||||
@ -108,30 +114,32 @@ $ sudo reboot
|
||||
|
||||
所有这些都是我们可以捕获网络数据包的接口。根据你系统上的界面,此页面可能会有所不同。
|
||||
|
||||
我们选择 “enp0s3” 来捕获该接口的网络流量。选择接口后,我们网络上所有设备的网络数据包开始填充(请参阅下面的截图)
|
||||
我们选择 “enp0s3” 来捕获该接口的网络流量。选择接口后,我们网络上所有设备的网络数据包开始填充(请参阅下面的截图):
|
||||
|
||||
![Capturing-Packets-WireShark-UI-Ubuntu][8]
|
||||
|
||||
第一次看到此页面时,我们可能会被此屏幕中显示的数据淹没,并且可能会想到如何整理这些数据,但不用担心,Wireshark 的最佳功能之一就是它的过滤器。
|
||||
|
||||
我们可以根据 IP 地址、端口号对数据进行排序/过滤,还可以使用源和目标过滤器、数据包大小等,还可以将 2 个或更多过滤器组合在一起以创建更全面的搜索。我们可以在“应用显示过滤器”选项卡中编写过滤器,也可以选择已创建的规则之一。要选择预建过滤器,请单击“应用显示过滤器”选项卡旁边的“标志”图标。
|
||||
我们可以根据 IP 地址、端口号对数据进行排序/过滤,还可以使用源和目标过滤器、数据包大小等,还可以将 2 个或更多过滤器组合在一起以创建更全面的搜索。我们可以在“<ruby>应用显示过滤器<rt>Apply a Display Filter</rt></ruby>”选项卡中编写过滤器,也可以选择已创建的规则之一。要选择预建过滤器,请单击“旗帜”图标,然后点击“应用显示过滤器”选项卡。
|
||||
|
||||
![IP-Based-Filtering-WireShark-UI-Ubuntu][9]
|
||||
|
||||
我们还可以根据颜色代码来过滤数据,默认情况下,浅紫色是 TCP 流量,浅蓝色是 UDP 流量,黑色标识有错误的数据包,要查看这些代码的含义,请单击查看->颜色规则,我们也可以更改这些代码。
|
||||
我们还可以根据颜色代码来过滤数据,默认情况下,浅紫色是 TCP 流量,浅蓝色是 UDP 流量,黑色标识有错误的数据包,要查看这些代码的含义,请单击“<ruby>查看<rt>View</rt></ruby>”->“<ruby>颜色规则<rt>Coloring Rules</rt></ruby>”,我们也可以更改这些代码。
|
||||
|
||||
![Coloring-Rules-WireShark-Ubuntu][10]
|
||||
|
||||
获得所需的结果后,我们可以单击任何捕获的数据包以获取有关该数据包的更多详细信息,这将显示有关该网络数据包的所有数据。
|
||||
|
||||
要停止捕获数据包,请单击红色按钮,然后将捕获的数据包保存到文件中。
|
||||
要停止捕获数据包,请单击红色停止按钮,然后将捕获的数据包保存到文件中。
|
||||
|
||||
![Save-Captured-Packets-Wireshark-Ubuntu][11]
|
||||
|
||||
##### 总结
|
||||
### 总结
|
||||
|
||||
Wireshark 是一款非常强大的工具,需要一些时间来适应和掌握它,这篇文章将帮助你开始使用。请随时在下面的评论栏中提出你的疑问或建议。
|
||||
|
||||
*(题图:MJ/63c09e75-a3e7-4dbf-ac6f-0233bdd34ad8)*
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://www.linuxtechi.com/install-use-wireshark-ubuntu/
|
||||
@ -139,7 +147,7 @@ via: https://www.linuxtechi.com/install-use-wireshark-ubuntu/
|
||||
作者:[Pradeep Kumar][a]
|
||||
选题:[lkxed][b]
|
||||
译者:[geekpi](https://github.com/geekpi)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
校对:[wxy](https://github.com/wxy)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
@ -155,4 +163,5 @@ via: https://www.linuxtechi.com/install-use-wireshark-ubuntu/
|
||||
[8]: https://www.linuxtechi.com/wp-content/uploads/2017/11/Capturing-Packets-WireShark-UI-Ubuntu.png
|
||||
[9]: https://www.linuxtechi.com/wp-content/uploads/2017/11/IP-Based-Filtering-WireShark-UI-Ubuntu.png
|
||||
[10]: https://www.linuxtechi.com/wp-content/uploads/2017/11/Coloring-Rules-WireShark-Ubuntu.png
|
||||
[11]: https://www.linuxtechi.com/wp-content/uploads/2017/11/Save-Captured-Packets-Wireshark-Ubuntu.png
|
||||
[11]: https://www.linuxtechi.com/wp-content/uploads/2017/11/Save-Captured-Packets-Wireshark-Ubuntu.png
|
||||
[0]: https://img.linux.net.cn/data/attachment/album/202307/05/154817pj3jx0jl03levzu9.jpg
|
@ -1,175 +0,0 @@
|
||||
[#]: subject: "Create bookmarks for your PDF with pdftk"
|
||||
[#]: via: "https://opensource.com/article/22/1/pdf-metadata-pdftk"
|
||||
[#]: author: "Seth Kenlon https://opensource.com/users/seth"
|
||||
[#]: collector: "lujun9972"
|
||||
[#]: translator: "toknow-gh"
|
||||
[#]: reviewer: " "
|
||||
[#]: publisher: " "
|
||||
[#]: url: " "
|
||||
|
||||
Create bookmarks for your PDF with pdftk
|
||||
======
|
||||
Providing bookmarks to your users is helpful and takes advantage of the
|
||||
technology available.
|
||||
![Business woman on laptop sitting in front of window][1]
|
||||
|
||||
In [introducing pdftk-java][2], I explained how I use the `pdftk-java` command to make quick, often scripted, modifications to PDF files.
|
||||
|
||||
However, one of the things `pdftk-java` is most useful for is when I've downloaded a big PDF file, sometimes with hundreds of pages of reference text, and discovered that the PDF creator didn't include a table of contents. I don't mean a printed table of contents in the front matter of the book; I mean the table of contents you get down the side of your PDF reader, which the PDF format officially calls "bookmarks."
|
||||
|
||||
![Screenshot of a sidebar table of contents next to a PDF][3]
|
||||
|
||||
(Seth Kenlon, [CC BY-SA 4.0][4])
|
||||
|
||||
Without bookmarks, finding the chapter you need to reference is cumbersome and involves either lots of scrolling or frustrating searches for words you think you remember seeing in the general area.
|
||||
|
||||
Another minor annoyance of many PDF files is the lack of metadata, such as a proper title and author in the PDF properties. If you've ever opened up a PDF and seen something generic like "Microsoft Word - 04_Classics_Revisited.docx" in the window title bar, you know this issue.
|
||||
|
||||
I don't have to deal with this problem anymore because I have `pdftk-java`, which lets me create my own bookmarks.
|
||||
|
||||
### Install pdftk-java on Linux
|
||||
|
||||
As its name suggests, pdftk-java is written in Java, so it works on all major operating systems as long as you have Java installed.
|
||||
|
||||
Linux and macOS users can install Linux from [AdoptOpenJDK.net][5].
|
||||
|
||||
Windows users can install [Red Hat's Windows build of OpenJDK][6].
|
||||
|
||||
To install pdftk-java on Linux:
|
||||
|
||||
1. Download the [pdftk-all.jar release][7] from its Gitlab repository and save it to `~/.local/bin/` or [some other location in your path][8].
|
||||
2. Open `~/.bashrc` in your favorite text editor and add this line to it: `alias pdftk='java -jar $HOME/.local/bin/pdftk-all.jar'`
|
||||
3. Load your new Bash settings: `source ~/.bashrc`
|
||||
|
||||
|
||||
|
||||
### Data dump
|
||||
|
||||
The first step in correcting the metadata of a PDF is to extract the data file that the PDF currently contains.
|
||||
|
||||
There's probably not much to the data file (that's the problem!), but it gives you a good starting place.
|
||||
|
||||
|
||||
```
|
||||
|
||||
|
||||
$ pdftk mybigfile.pdf \
|
||||
data_dump \
|
||||
output bookmarks.txt
|
||||
|
||||
```
|
||||
|
||||
This produces a file called `bookmarks.txt`, and it contains all the metadata assigned to the input file (in this example, `mybigfile.pdf`), plus a lot of bloat.
|
||||
|
||||
### Editing metadata
|
||||
|
||||
To edit the metadata of the PDF, open your `bookmarks.txt` file in your favorite text editor, such as [Atom][9] or [Gedit][10].
|
||||
|
||||
The format is mostly intuitive, and the data contained within it is predictably neglected:
|
||||
|
||||
|
||||
```
|
||||
|
||||
|
||||
InfoBegin
|
||||
InfoKey: Creator
|
||||
InfoValue: Word
|
||||
InfoBegin
|
||||
InfoKey: ModDate
|
||||
InfoValue: D:20151221203353Z00&apos;00&apos;
|
||||
InfoBegin
|
||||
InfoKey: CreationDate
|
||||
InfoValue: D:20151221203353Z00&apos;00&apos;
|
||||
InfoBegin
|
||||
InfoKey: Producer
|
||||
InfoValue: Mac OS X 10.10.4 Quartz PDFContext
|
||||
InfoBegin
|
||||
InfoKey: Title
|
||||
InfoValue: Microsoft Word - 04_UA_Classics_Revisited.docx
|
||||
PdfID0: f049e63eaf3b4061ddad16b455ca780f
|
||||
PdfID1: f049e63eaf3b4061ddad16b455ca780f
|
||||
NumberOfPages: 42
|
||||
PageMediaBegin
|
||||
PageMediaNumber: 1
|
||||
PageMediaRotation: 0
|
||||
PageMediaRect: 0 0 612 792
|
||||
PageMediaDimensions: 612 792
|
||||
[...]
|
||||
|
||||
```
|
||||
|
||||
You can edit InfoValue fields to contain data that makes sense for the PDF you're repairing. For instance, instead of setting the Creator key to the value Word, you could set it to the actual author's name or the publishing house releasing the PDF file. Rather than giving the document the default export string of the application that produced it, give it the book's actual title.
|
||||
|
||||
There's also some cleanup work you can do. Everything below the `NumberOfPages` line is also unnecessary, so remove those lines.
|
||||
|
||||
### Adding bookmarks
|
||||
|
||||
PDF bookmarks follow this format:
|
||||
|
||||
|
||||
```
|
||||
|
||||
|
||||
BookmarkBegin
|
||||
BookmarkTitle: My first bookmark
|
||||
BookmarkLevel: 1
|
||||
BookmarkPageNumber: 2
|
||||
|
||||
```
|
||||
|
||||
* `BookmarkBegin` indicates that you're creating a new bookmark.
|
||||
* `BookmarkTitle` contains the text that's visible in the PDF viewer.
|
||||
* `BookmarkLevel` sets the inheritance level of this bookmark. If you set a BookmarkLevel to 2, it appears within a disclosure triangle of the previous bookmark. If you set a BookmarkLevel to 3, it appears within a disclosure triangle of the previous bookmark, as long as the previous bookmark is set to 2. This setting gives you the ability to bookmark, for example, a chapter title as well as section headings within that chapter.
|
||||
* `BookmarkPageNumber` determines what PDF page the user is taken to when they click the bookmark.
|
||||
|
||||
|
||||
|
||||
Create bookmarks for each section of the book that you think is important, then save the file.
|
||||
|
||||
### Updating bookmark info
|
||||
|
||||
Now that you have your metadata and bookmarks set, you can apply them to your PDF—actually, you’ll apply them to a new PDF that contains the same content as the old PDF:
|
||||
|
||||
|
||||
```
|
||||
|
||||
|
||||
$ pdftk mybigfile.pdf \
|
||||
update_info bookmarks.txt \
|
||||
output mynewfile.pdf
|
||||
|
||||
```
|
||||
|
||||
This produces a file called `mynewfile.pdf`, containing all of your metadata and bookmarks.
|
||||
|
||||
### Professional publishing
|
||||
|
||||
The difference between a PDF with generic metadata and no bookmarks and a PDF with personalized metadata values and useful bookmarks probably isn't going to make or break a sale.
|
||||
|
||||
However, paying attention to the small details like metadata shows that you value quality assurance, and providing bookmarks to your users is helpful and takes advantage of the technology available.
|
||||
|
||||
Use `pdftk-java` to make this process easy, and your users will thank you.
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://opensource.com/article/22/1/pdf-metadata-pdftk
|
||||
|
||||
作者:[Seth Kenlon][a]
|
||||
选题:[lujun9972][b]
|
||||
译者:[译者ID](https://github.com/译者ID)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]: https://opensource.com/users/seth
|
||||
[b]: https://github.com/lujun9972
|
||||
[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/lenovo-thinkpad-laptop-concentration-focus-windows-office.png?itok=-8E2ihcF (Woman using laptop concentrating)
|
||||
[2]: https://opensource.com/article/21/12/edit-pdf-linux-pdftk
|
||||
[3]: https://opensource.com/sites/default/files/uploads/pdtfk_update.jpeg (table of contents)
|
||||
[4]: https://creativecommons.org/licenses/by-sa/4.0/
|
||||
[5]: https://adoptopenjdk.net/releases.html
|
||||
[6]: https://developers.redhat.com/products/openjdk/download
|
||||
[7]: https://gitlab.com/pdftk-java/pdftk/-/jobs/1527259628/artifacts/raw/build/libs/pdftk-all.jar
|
||||
[8]: https://opensource.com/article/17/6/set-path-linux
|
||||
[9]: https://opensource.com/article/20/12/atom
|
||||
[10]: https://opensource.com/article/20/12/gedit
|
@ -1,84 +0,0 @@
|
||||
[#]: subject: "5 of the most curious uses of the Raspberry Pi"
|
||||
[#]: via: "https://opensource.com/article/23/3/most-curious-uses-raspberry-pi"
|
||||
[#]: author: "AmyJune Hineline https://opensource.com/users/amyjune"
|
||||
[#]: collector: "lkxed"
|
||||
[#]: translator: " "
|
||||
[#]: reviewer: " "
|
||||
[#]: publisher: " "
|
||||
[#]: url: " "
|
||||
|
||||
5 of the most curious uses of the Raspberry Pi
|
||||
======
|
||||
|
||||
Recently, I was on a call where it was said that the open source community is a combination of curiosity and a culture of solutions. And curiosity is the basis of our problem-solving. We use a lot of open source when solving problems of all sizes, and that includes [Linux][1] running on the supremely convenient Raspberry Pi.
|
||||
|
||||
We all have such different lived experiences, so I asked our community of writers about the most curious use of a Raspberry Pi they've ever encountered. I have a hunch that some of these fantastic builds will spark an idea for others.
|
||||
|
||||
### Experimentation with the Raspberry Pi
|
||||
|
||||
For me, the Raspberry Pi has been a great tool to add extra development resources on my home network. If I want to [create a new website][2] or experiment with a new software tool, I don't have to bog down my desktop Linux machine with a bunch of packages that I might only use once while experimenting. Instead, I set it up on my Raspberry Pi.
|
||||
|
||||
If I think I'm going to do something risky, I use a backup boot environment. I have two microSD cards, which allows me to have one plugged into the Raspberry Pi while I set up the second microSD to do whatever experimenting I want to do. The extra microSD doesn't cost that much, but it saves a ton of time for the times when I want to experiment on a second image. Just shutdown, swap microSD cards, reboot, and immediately I'm working on a dedicated test system.
|
||||
|
||||
When I'm not experimenting, my Raspberry Pi acts as a print server to put my non-WiFi printer on our home network. It is also a handy file server over SSH so that I can make quick backups of my important files.
|
||||
|
||||
**— [Jim Hall][3]**
|
||||
|
||||
### The popularity of the Raspberry Pi
|
||||
|
||||
The most amazing thing I've seen about the Raspberry Pi is that it normalized and commoditized the idea of the small-board computers and made them genuinely and practically available to folks.
|
||||
|
||||
Before the Raspberry Pi, we had small-board computers in a similar fashion, but they tended to be niche, expensive, and nigh unapproachable from a software perspective. The Raspberry Pi was cheap, and cheap to the point of making it trivial for anyone to get one for a project (ignoring the current round of unobtainium it's been going through). Once it was cheap, people worked around the software challenges and made it good enough to solve many basic computing tasks, down to being able to dedicate a full and real computer to a task, not just a microcontroller.
|
||||
|
||||
We've got a plethora of good, cheap-ish, small-board computers, and this gives way to tinkering, toying, and [experimenting][4]. People are willing to try new ideas, even spurring more hobbyist hardware development to support these ideas.
|
||||
|
||||
Honestly, that is by far the most amazing and radical thing I've seen from the Raspberry Pi: how it's fundamentally changed everyone's perception of what computing, at the level of what the Raspberry Pi excels at anyway, is and given rise not only to its own ecosystem but now countless others in diversity.
|
||||
|
||||
**— [John ‘Warthog9' Hawley][5]**
|
||||
|
||||
### Raspberry Pi for the bees
|
||||
|
||||
In 2018, my younger brother and I used to have several beehives and used a Raspberry Pi and various sensors to monitor the temperature and humidity of our hives. We also planned to implement a hive scale to observe honey production in summer and measure the weight in winter to see if the bees had enough food left. We never got around to doing that.
|
||||
|
||||
Our little monitoring solution was based on a Raspberry Pi 2 Model B, ran Raspbian Stretch (based on Debian 9), and had a temperature and humidity sensor connected (DHT11). We had three or four of those sensors in the hives to measure the temperature at the entrance hole, under the lid, and in the lowest frame. We connected the sensor directly to the Pi and used the Python_DHT sensor library to read the data. We also set up [InfluxDB][6], Telegraf, and finally, [Grafana][7] to visualize the data.
|
||||
|
||||
If you want to know more about our setup, we published an article on our little monitoring solution in [Linux Magazine][8].
|
||||
|
||||
**— [Heike Jurzik][9]**
|
||||
|
||||
### Go retro with the Raspberry Pi
|
||||
|
||||
One thing I would love to create with the Raspberry Pi is a simulation of how to program machine language into an old-style computer using "switches and lights." This looks to be fairly straightforward using the GPIO pins on the Raspberry Pi. For example, their online manual shows examples of how to use GPIO to switch an LED on and off or to use buttons to get input. I think it should be possible with some LEDs and switches, plus a small program running on the Raspberry Pi to emulate the old-style computer. But I lack the free time to work on a project like this, which is why I wrote the [Toy CPU][10] to emulate it.
|
||||
|
||||
**— [Jim Hall][3]**
|
||||
|
||||
### Build a toy with the Raspberry Pi
|
||||
|
||||
When my daughter was four, she asked for a "Trolls music box" for Christmas. She could picture it perfectly in her head. It would be pink and sparkly with her name on it. When she opened the box, the theme song from the popular movie would play. She could store her trolls and other treasures in the box. After searching everywhere online and in stores, I could not find one that measured up to her imagination. My husband and I decided we could build one ourselves in our own toyshop (i.e., his home office). The center of it all was, of course, the Raspberry Pi. He used light sensors and a Python script to make the song play at just the right moment. We placed the tech discreetly in the bottom of the music box and decorated it with her aesthetic in mind. That year, holiday magic was made possible with open source!
|
||||
|
||||
**— [Lauren Pritchett][11]**
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://opensource.com/article/23/3/most-curious-uses-raspberry-pi
|
||||
|
||||
作者:[AmyJune Hineline][a]
|
||||
选题:[lkxed][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/amyjune
|
||||
[b]: https://github.com/lkxed/
|
||||
[1]: https://opensource.com/article/19/3/learn-linux-raspberry-pi
|
||||
[2]: https://opensource.com/article/22/3/run-drupal-raspberry-pi
|
||||
[3]: https://opensource.com/users/jim-hall
|
||||
[4]: https://opensource.com/article/20/8/kubernetes-raspberry-pi
|
||||
[5]: https://opensource.com/users/warthog9
|
||||
[6]: https://opensource.com/article/17/8/influxdb-time-series-database-stack
|
||||
[7]: https://opensource.com/article/21/3/raspberry-pi-grafana-cloud
|
||||
[8]: https://www.linux-magazine.com/index.php/layout/set/print/Issues/2018/214/Monitoring-Beehives
|
||||
[9]: https://opensource.com/users/hej
|
||||
[10]: https://opensource.com/article/23/1/learn-machine-language-retro-computer
|
||||
[11]: https://opensource.com/users/lauren-pritchett
|
@ -0,0 +1,173 @@
|
||||
[#]: subject: "Create bookmarks for your PDF with pdftk"
|
||||
[#]: via: "https://opensource.com/article/22/1/pdf-metadata-pdftk"
|
||||
[#]: author: "Seth Kenlon https://opensource.com/users/seth"
|
||||
[#]: collector: "lujun9972"
|
||||
[#]: translator: "toknow-gh"
|
||||
[#]: reviewer: " "
|
||||
[#]: publisher: " "
|
||||
[#]: url: " "
|
||||
|
||||
使用 pdftk 为 PDF 文档创建书签
|
||||
======
|
||||
充分利用现有的技术,提供书签以帮助用户。
|
||||
![Business woman on laptop sitting in front of window][1]
|
||||
|
||||
在 [介绍 pdftk-java][2] 中, 我展示了如何在脚本中使用 `pdftk-java` 来快速修改 PDF 文件。
|
||||
|
||||
但是,`pdftk-java` 最有用的场景是处理那种动辄几百页的没有目录的大 PDF 文件。这里所谓的目录不是指文档前面供打印的目录,而是指显示在 PDF 阅读器侧边栏里的目录,它在 PDF 格式中的正式叫法是“书签”。
|
||||
|
||||
![Screenshot of a sidebar table of contents next to a PDF][3]
|
||||
|
||||
(Seth Kenlon, [CC BY-SA 4.0][4])
|
||||
|
||||
如果没有书签,就只能通过上下滚动或全局搜索文本来定位想要的章节,这非常麻烦。
|
||||
|
||||
PDF 文件的另一个恼人的小问题是缺乏元数据,比如标题和作者。如果你打开过一个标题栏上显示类似 “Microsoft Word - 04_Classics_Revisited.docx” 的 PDF 文件,你就能体会那种感觉了。
|
||||
|
||||
`pdftk-java` 让我能够创建自己的书签,我再也不面对这些问题了。
|
||||
|
||||
|
||||
### 在 Linux 上安装 pdftk-java
|
||||
|
||||
正如 `pdftk-java` 的名称所示的,它是用 Java 编写的。它能够在所有主流操作系统上运行,只要你安装了 Java。
|
||||
|
||||
Linux 和 macOS 用户可以从 [AdoptOpenJDK.net][5] 安装 Java(LCTT 译注:原文为 Linux,应为笔误)。
|
||||
|
||||
Windows 用户可以安装 [Red Hat's Windows build of OpenJDK][6]。
|
||||
|
||||
在 Linux 上安装 pdftk-java:
|
||||
|
||||
1. 从 Gitlab 仓库下载 [pdftk-all.jar release][7],保存至 `~/.local/bin/` 或 [其它路径][8] 下.
|
||||
2. 用文本编辑器打开 `~/.bashrc`,添加 `alias pdftk='java -jar $HOME/.local/bin/pdftk-all.jar'`
|
||||
3. 运行 `source ~/.bashrc` 使新的 Bash 设置生效。
|
||||
|
||||
|
||||
|
||||
### 数据转储
|
||||
|
||||
修改元数据的第一步是抽取 PDF 当前的数据文件。
|
||||
|
||||
现在的数据文件可能并没包含多少内容,但这也是一个不错的开端。
|
||||
|
||||
|
||||
```
|
||||
|
||||
|
||||
$ pdftk mybigfile.pdf \
|
||||
data_dump \
|
||||
output bookmarks.txt
|
||||
|
||||
```
|
||||
生成的 `bookmarks.txt` 文件中包含了输入 PDF 文件 `mybigfile.pdf` 的所有元数据和一大堆无用数据。
|
||||
|
||||
|
||||
### 编辑元数据
|
||||
|
||||
用文本编辑器(比如 [Atom][9] 或 [Gedit][10])打开 `bookmarks.txt` 以编辑 PDF 元数据。
|
||||
|
||||
元数据的格式和数据项直观易懂:
|
||||
|
||||
```
|
||||
|
||||
|
||||
InfoBegin
|
||||
InfoKey: Creator
|
||||
InfoValue: Word
|
||||
InfoBegin
|
||||
InfoKey: ModDate
|
||||
InfoValue: D:20151221203353Z00&apos;00&apos;
|
||||
InfoBegin
|
||||
InfoKey: CreationDate
|
||||
InfoValue: D:20151221203353Z00&apos;00&apos;
|
||||
InfoBegin
|
||||
InfoKey: Producer
|
||||
InfoValue: Mac OS X 10.10.4 Quartz PDFContext
|
||||
InfoBegin
|
||||
InfoKey: Title
|
||||
InfoValue: Microsoft Word - 04_UA_Classics_Revisited.docx
|
||||
PdfID0: f049e63eaf3b4061ddad16b455ca780f
|
||||
PdfID1: f049e63eaf3b4061ddad16b455ca780f
|
||||
NumberOfPages: 42
|
||||
PageMediaBegin
|
||||
PageMediaNumber: 1
|
||||
PageMediaRotation: 0
|
||||
PageMediaRect: 0 0 612 792
|
||||
PageMediaDimensions: 612 792
|
||||
[...]
|
||||
|
||||
```
|
||||
|
||||
你可以将 `InfoValue` 的值修改为对当前 PDF 有意义的内容。比如可以将 Creator 字段从 Word 修改为实际的作者或出版社名称。比起使用导出程序自动生成的标题,使用书籍的实际标题会更好。
|
||||
|
||||
你也可以做一些清理工作。在 `NumberOfPages` 之后的行都不是必需的,可以删除这些行的内容。
|
||||
|
||||
### 添加书签
|
||||
|
||||
PDF 书签的格式如下:
|
||||
|
||||
|
||||
```
|
||||
|
||||
|
||||
BookmarkBegin
|
||||
BookmarkTitle: My first bookmark
|
||||
BookmarkLevel: 1
|
||||
BookmarkPageNumber: 2
|
||||
|
||||
```
|
||||
|
||||
* `BookmarkBegin` 表示这是一个书签。
|
||||
* `BookmarkTitle` 书签在 PDF 阅读器中显示的文本。
|
||||
* `BookmarkLevel` 书签层级。如果书签层级为 2,它将出现在上一个书签的小三角下。如果设置为 3,它会显示在上一个 2 级书签的小三角下。这让你能为章以及其中的节设置书签。
|
||||
* `BookmarkPageNumber` 点击书签时转到的页码。
|
||||
|
||||
|
||||
|
||||
为你需要的章节创建书签,然后保存文件。
|
||||
|
||||
### 更新书签信息
|
||||
|
||||
现在已经准备好了元数据和书签,你可以将它们导入到 PDF 文件中。实际上是将这些信息导入到一个新的 PDF 文件中,它的内容与原 PDF 文件相同:
|
||||
|
||||
```
|
||||
|
||||
|
||||
$ pdftk mybigfile.pdf \
|
||||
update_info bookmarks.txt \
|
||||
output mynewfile.pdf
|
||||
|
||||
```
|
||||
|
||||
生成的 `mynewfile.pdf` 包含了你设置的全部元数据和书签。
|
||||
|
||||
### 体现专业性
|
||||
|
||||
PDF 文件中是否包含定制化的元数据和书签可能并不会影响销售。
|
||||
|
||||
但是,关注元数据可以向用户表明你重视质量保证。增加书签可以为用户提供便利,同时亦是充分利用现有技术。
|
||||
|
||||
使用 `pdftk-java` 来简化这个过程,用户会感激不尽。
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://opensource.com/article/22/1/pdf-metadata-pdftk
|
||||
|
||||
作者:[Seth Kenlon][a]
|
||||
选题:[lujun9972][b]
|
||||
译者:[toknow-gh](https://github.com/toknow-gh)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]: https://opensource.com/users/seth
|
||||
[b]: https://github.com/lujun9972
|
||||
[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/lenovo-thinkpad-laptop-concentration-focus-windows-office.png?itok=-8E2ihcF (Woman using laptop concentrating)
|
||||
[2]: https://opensource.com/article/21/12/edit-pdf-linux-pdftk
|
||||
[3]: https://opensource.com/sites/default/files/uploads/pdtfk_update.jpeg (table of contents)
|
||||
[4]: https://creativecommons.org/licenses/by-sa/4.0/
|
||||
[5]: https://adoptopenjdk.net/releases.html
|
||||
[6]: https://developers.redhat.com/products/openjdk/download
|
||||
[7]: https://gitlab.com/pdftk-java/pdftk/-/jobs/1527259628/artifacts/raw/build/libs/pdftk-all.jar
|
||||
[8]: https://opensource.com/article/17/6/set-path-linux
|
||||
[9]: https://opensource.com/article/20/12/atom
|
||||
[10]: https://opensource.com/article/20/12/gedit
|
Loading…
Reference in New Issue
Block a user