我尝试了几个程序:pdftotext、pdf2txt.py、...所有这些程序都可以从 PDF 中提取文本,但是做得更好的一个是好的 ol' less
:PDF 中的文本具有正确的布局。少怎么做这个?它使用任何库,还是内置的PDF处理?
我问是因为我想以编程方式使用这个功能,而不必像外部程序一样运行更少(我正在做 python)。
我的系统是:
» less --version
less 458 (GNU regular expressions)
Copyright (C) 1984-2012 Mark Nudelman
less comes with NO WARRANTY, to the extent permitted by law.
For information about the terms of redistribution,
see the file named README in the less distribution.
Homepage: http://www.greenwoodsoftware.com/less
» uname -a
Linux polyphemus 3.13.0-53-generic #89-Ubuntu SMP Wed May 20 10:34:39 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux
Run Code Online (Sandbox Code Playgroud) 我有两棵大树,我想比较一下。树中的某些文件之所以不同,只是因为一个文件末尾有换行符,而另一个文件缺少此换行符。我想忽略这个事实。我试过这样打电话diff
:
diff --ignore-all-space -r <dir1> <dir2>
Run Code Online (Sandbox Code Playgroud)
这是有效的。我的问题是它还忽略了其他差异(与空间相关),这可能很重要。
总结:我只想忽略 EOF 处的换行符。这可能diff
吗?
我正在尝试使用 apache 配置反向代理,但出现No protocol handler was valid for the URL
错误,我不明白。
这是apache的相关配置:
ProxyRequests Off
ProxyPreserveHost On
<Proxy *>
Order deny,allow
Allow from all
</Proxy>
ProxyPass /gonvaled/examples/jsonrpc/output/services/ http://localhost:8000/services/
ProxyPassReverse /gonvaled/examples/jsonrpc/output/services/ http://localhost:8000/services/
Run Code Online (Sandbox Code Playgroud)
请求到达 apache 为:
POST /gonvaled/examples/jsonrpc/output/services/EchoService.py HTTP/1.1
Run Code Online (Sandbox Code Playgroud)
他们应该转发到我的内部服务,位于:
0.0.0.0:8000/services/EchoService.py
Run Code Online (Sandbox Code Playgroud)
这些是日志:
==> /var/log/apache2/error.log <==
[Wed Jun 20 02:05:20 2012] [debug] proxy_util.c(1506): [client 127.0.0.1] proxy: http: found worker http://localhost:8000/services/ for http://localhost:8000/services/EchoService.py, referer: http://localhost/gonvaled/examples/jsonrpc/output/JSONRPCExample.safari.cache.html
[Wed Jun 20 02:05:20 2012] [debug] mod_proxy.c(998): Running scheme http handler (attempt 0)
[Wed Jun 20 02:05:20 2012] [warn] …
Run Code Online (Sandbox Code Playgroud) 我有以下内容/etc/environment
:
http_proxy=http://myproxy.net:12345
Run Code Online (Sandbox Code Playgroud)
重新启动机器后,我登录并检查变量:
root@d6c44fa03243:/# echo $http_proxy
(empty)
Run Code Online (Sandbox Code Playgroud)
为什么没有设置变量?
注意:我必须提到这是一个 docker 容器,尽管我不明白为什么它会有所作为。
有关系统的更多详细信息 ( Ubuntu 16.04.4 Xenial Xerus
):
root@d6c44fa03243:/# uname -a
Linux d6c44fa03243 4.4.0-116-generic #140-Ubuntu SMP Mon Feb 12 21:23:04 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux
root@d6c44fa03243:/# cat /etc/issue
Ubuntu 16.04.4 LTS \n \l
Run Code Online (Sandbox Code Playgroud)
根据Ubuntu 文档:
/etc/环境
此文件专门用于系统范围的环境变量设置。它不是一个脚本文件,而是由赋值表达式组成,每行一个。
这是我的nginx
配置(作为 docker 容器运行,以防万一):
events {
worker_connections 4096; ## Default: 1024
}
http {
server {
server_name registry.mydomain;
listen 80;
listen 443 ssl;
client_max_body_size 0; # Disables checking, to avoid "request entity too large"
ssl_certificate /etc/nginx/certs/registry.crt;
ssl_certificate_key /etc/nginx/certs/registry.key;
location / {
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_pass http://registry:5000;
}
}
}
Run Code Online (Sandbox Code Playgroud)
我遇到的问题是,nginx
即使是对其他域的请求,它也在为该站点提供服务。这是预期的:
$ http http://registry.mydomain/v2/_catalog?n=100
HTTP/1.1 200 OK
Connection: keep-alive
Content-Length: 20
Content-Type: application/json; charset=utf-8
Date: Thu, 05 Apr 2018 12:43:21 GMT
Docker-Distribution-Api-Version: …
Run Code Online (Sandbox Code Playgroud) 我dnsmasq
在主机中运行,我希望 docker 容器使用它,而不是默认的 Google 服务器( 8.8.8.8
)
我的主机/etc/resolv.conf
如下所示:
» cat /etc/resolv.conf
# Dynamic resolv.conf(5) file for glibc resolver(3) generated by resolvconf(8)
# DO NOT EDIT THIS FILE BY HAND -- YOUR CHANGES WILL BE OVERWRITTEN
nameserver 127.0.0.1
search mydomain.net
Run Code Online (Sandbox Code Playgroud)
容器的/etc/resolv.conf
外观如下:
root@ubuntu:/# cat /etc/resolv.conf
# Dynamic resolv.conf(5) file for glibc resolver(3) generated by resolvconf(8)
# DO NOT EDIT THIS FILE BY HAND -- YOUR CHANGES WILL BE OVERWRITTEN
search mydomain.net
nameserver 8.8.8.8
nameserver …
Run Code Online (Sandbox Code Playgroud) 我不知道为什么/什么时候,veth
我的系统中出现了一些接口(Ubuntu 16.0. LTS
):
\xc2\xbb ifconfig | grep veth\nveth4556676 Link encap:Ethernet HWaddr ee:b9:b9:ed:71:a6 \nveth8747335 Link encap:Ethernet HWaddr 66:40:47:fd:1f:a7 \nveth13905bf Link encap:Ethernet HWaddr ae:73:8f:f7:9d:d4 \nveth2636dd7 Link encap:Ethernet HWaddr fa:b8:3c:d4:52:9c \nveth42de626 Link encap:Ethernet HWaddr 92:08:43:90:6e:f3 \nveth4eedb05 Link encap:Ethernet HWaddr 66:5f:b8:e7:52:05 \nveth7534db0 Link encap:Ethernet HWaddr 16:9c:06:e6:f2:aa \nveth83508c7 Link encap:Ethernet HWaddr 5a:55:6c:ee:e5:7b \nveth8f275d6 Link encap:Ethernet HWaddr 46:18:a1:52:7f:e9 \nveth9f370c9 Link encap:Ethernet HWaddr da:9e:49:37:b4:16 \nvethb96da94 Link encap:Ethernet HWaddr 42:11:90:11:8a:f4 \nvethba463c9 Link encap:Ethernet HWaddr 06:40:d5:9a:79:7a \nvethd820900 Link encap:Ethernet HWaddr a2:94:53:c8:53:bf \nvethdd077a0 Link encap:Ethernet …
Run Code Online (Sandbox Code Playgroud) 这只是一个“我感到好奇”的问题。在本地同步(即从一个驱动器到同一主机上的另一个驱动器)时,rsync 如何知道哪些文件不值得传输?我想它不会进行完整的文件比较(因为那太贵了)。它是否只做简单的检查,例如:
如果是这样,我想通过更改文件的内容、保持大小和重置修改时间(如果可能的话)来欺骗 rsync 会很容易。
我删除了(根)证书,然后重新运行update-ca-certificates
:
$ sudo rm /usr/local/share/ca-certificates/mine.root-ca.crt
ls -l /usr/local/share/ca-certificates/
total 4
-rw-r--r-- 1 root root 1838 Feb 16 2017 something-else.crt
$ sudo update-ca-certificates
Updating certificates in /etc/ssl/certs...
0 added, 0 removed; done.
Running hooks in /etc/ca-certificates/update.d...
done.
Run Code Online (Sandbox Code Playgroud)
但:
$ ls -l /etc/ssl/certs/mine.root-ca.pem
lrwxrwxrwx 1 root root 53 Jun 4 07:22 /etc/ssl/certs/mine.root-ca.pem -> /usr/local/share/ca-certificates/mine.root-ca.crt
Run Code Online (Sandbox Code Playgroud)
但是那个文件 ( /usr/local/share/ca-certificates/mine.root-ca.crt
) 已经不存在了。
实际上,这0 added, 0 removed; done.
是可疑的:它应该说1 removed
。
证书验证不再适用于相关域(正如预期的那样),但是这两个事实让我很恼火:
update-ca-certificates
似乎没有做任何事情的事实我在:
$ lsb_release -a
No LSB modules …
Run Code Online (Sandbox Code Playgroud) 我在同一台机器上运行了两个 chrome 实例(两个不同的用户配置文件)。一方面,键入http://localhost:8000
重定向到https://localhost:8000
. 在另一种情况下,重定向没有发生。这发生在浏览器级别(两个前端实例的服务器相同)
我想删除重定向。如何清除此重定向Chrome
?
我正在运行 Chrome:
Version 65.0.3325.181 (Official Build) (64-bit)
Run Code Online (Sandbox Code Playgroud)
在:
» hostnamectl
...
Operating System: Ubuntu 16.04.4 LTS
Kernel: Linux 4.4.0-119-generic
Architecture: x86-64
Run Code Online (Sandbox Code Playgroud) apt-cacher-ng
我在文档中找不到如何配置代理设置。
是否可以apt-cacher-ng
在代理后面运行?如何?
我有一个自生成的 CA 和一个生成的证书。证书有效:
» openssl verify -verbose -x509_strict -CAfile rootCA.pem mysite.bundle.crt
mysite.bundle.crt: OK
Run Code Online (Sandbox Code Playgroud)
根 CA 安装在我的系统 (Ubuntu 16.04) 中,并且 curl 能够验证证书:
curl https://mysite
Run Code Online (Sandbox Code Playgroud)
这里没有抱怨。
我可以验证正在运行的站点中的证书链,一切似乎都正常,包括 SAN 条目:
» openssl s_client -showcerts -servername mysite -connect mysite:443 </dev/null 2> /dev/null | openssl x509 -noout -text | grep DNS:
DNS:mysite
Run Code Online (Sandbox Code Playgroud)
但 Chrome 仍然抱怨。可能是什么原因?
添加截图
我正在运行Ubuntu 16.04.4 LTS
。我有以下版本:
root@e816b85d954d:/# http --debug
HTTPie 0.9.9
Requests 2.9.1
Pygments 2.1
Python 2.7.12 (default, Dec 4 2017, 14:50:18)
[GCC 5.4.0 20160609]
/usr/bin/python
Linux 4.4.0-116-generic
root@e816b85d954d:/# curl --version
curl 7.47.0 (x86_64-pc-linux-gnu) libcurl/7.47.0 GnuTLS/3.4.10 zlib/1.2.8 libidn/1.32 librtmp/2.3
Protocols: dict file ftp ftps gopher http https imap imaps ldap ldaps pop3 pop3s rtmp rtsp smb smbs smtp smtps telnet tftp
Features: AsynchDNS IDN IPv6 Largefile GSS-API Kerberos SPNEGO NTLM NTLM_WB SSL libz TLS-SRP UnixSockets
Run Code Online (Sandbox Code Playgroud)
curl
工作正常:
$ curl https://mysite
Run Code Online (Sandbox Code Playgroud)
但是 …