小编it_*_*ure的帖子

剪切命令将选项卡指定为分隔符

当我使用命令时,有一个文件,分隔符是tab

cut -d \t file.txt  #or  "\t"  or  "\\t"
Run Code Online (Sandbox Code Playgroud)

我收到这条消息

cut:您必须指定字节,字符或字段的列表

尝试`cut --help'获取更多信息.

如何使用cut 命令?

shell cut

15
推荐指数
2
解决办法
6万
查看次数

模拟浏览器下载文件?

网络上有一个FLV文件,可以直接在Chrome中下载.该文件是由中央电视台(CCTV)出版的电视节目.中央电视台是一家非盈利的国有广播公司,由中国纳税人提供资金,允许我们在不侵犯版权的情况下下载其内容.

使用wget,我可以从不同的地址下载文件,但不能从Chrome中的地址下载.

这就是我试图做的事情:

url='http://114.80.235.200/f4v/94/163005294.h264_1.f4v?10000&key=7b9b1155dc632cbab92027511adcb300401443020d&playtype=1&tk=163659644989925531390490125&brt=2&bc=0&nt=0&du=1496650&ispid=23&rc=200&inf=1&si=11000&npc=1606&pp=0&ul=2&mt=-1&sid=10000&au=0&pc=0&cip=222.73.44.31&hf=0&id=tudou&itemid=135558267&fi=163005294&sz=59138302'  

wget -c  $url --user-agent="" -O  xfgs.f4v
Run Code Online (Sandbox Code Playgroud)

这也不起作用:

wget -c  $url   -O  xfgs.f4v
Run Code Online (Sandbox Code Playgroud)

输出是:

Connecting to 118.26.57.12:80... connected.  
HTTP request sent, awaiting response... 403 Forbidden  
2013-02-13 09:50:42 ERROR 403: Forbidden.  
Run Code Online (Sandbox Code Playgroud)

我究竟做错了什么?

我最终想用Python库下载它mechanize.这是我正在使用的代码:

import mechanize  
br = mechanize.Browser()  
br = mechanize.Browser()  
br.set_handle_robots(False)  
br.set_handle_equiv(False)   
br.addheaders = [('User-agent', 'Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.0.1) Gecko/2008071615 Fedora/3.0.1-1.fc9 Firefox/3.0.1')]  
url='http://114.80.235.200/f4v/94/163005294.h264_1.f4v?10000&key=7b9b1155dc632cbab92027511adcb300401443020d&playtype=1&tk=163659644989925531390490125&brt=2&bc=0&nt=0&du=1496650&ispid=23&rc=200&inf=1&si=11000&npc=1606&pp=0&ul=2&mt=-1&sid=10000&au=0&pc=0&cip=222.73.44.31&hf=0&id=tudou&itemid=135558267&fi=163005294&sz=59138302' 
r = br.open(url).read()  
tofile=open("/tmp/xfgs.f4v","w")  
tofile.write(r)  
tofile.close()
Run Code Online (Sandbox Code Playgroud)

这是结果:

Traceback (most recent call last):  
  File "<stdin>", line 1, in …
Run Code Online (Sandbox Code Playgroud)

python shell wget mechanize

15
推荐指数
4
解决办法
1万
查看次数

如何将刻度长度设置为1英寸?

 x<-seq(-3,3,by=0.1)
 y=0.5*x^3 
 ## Set png size to be slightly bigger than plot to take account of one line margin
 png( "~/myplot.png" , width = 600 , height = 2600 ,units="px",res=100)
 ## Set graphical parameters to control the size of the plot area and the margins
 ## Set size of plot area to 6 inches wide by 15 inches tall
 par( pin = c(6,26) )
 ## Remove margins around plot area
 par( mai = c(0,0,0,0) )
 ## Remove outer margins around …
Run Code Online (Sandbox Code Playgroud)

r

14
推荐指数
1
解决办法
1705
查看次数

为什么'hallo \nworld'可以匹配R中的\n和\\n?

为什么grep对待\n ,并 \\n以同样的方式?

例如,两者都匹配hallo\nworld.

grep("hallo\nworld", pattern="\n")
[1] 1
grep("hallo\nworld", pattern="\\n")
[1] 1
Run Code Online (Sandbox Code Playgroud)

我看到它hallo\nworld被解析成了

hallo  
world
Run Code Online (Sandbox Code Playgroud)

也就是说,hallo在一行和world一行上.

那么grep("hallo\nworld", pattern="\n"),是pattern="\n"新线还是\n字面意思?

另请注意,其他人会这样; \a \f \n \t \r并且\\a \\f \\n \\t \\r都受到相同的待遇.但\d \w \s不能用!为什么不?

我选择了不同的字符串来测试,我在正则表达式的概念中找到了秘密.

escape有两个概念,一个是字符串中的escape,它很容易理解; 另一个是在常规模式表达式字符串中转义.中的R如图案grep(x, pattern=" some string here "), \\n= \n=换行符.但是在常见的字符串中,\\n!= \n,前者是字面意思\n,后者是换行符.我们可以证明这一点:

cat("\n")

cat("\\n")
\n> 
Run Code Online (Sandbox Code Playgroud)

怎么证明这个?我会尝试其他角色,而不仅仅是\n,看看它们是否以相同的方式匹配.

special1 …
Run Code Online (Sandbox Code Playgroud)

regex r escaping

14
推荐指数
1
解决办法
1225
查看次数

"Rprofile","Renviron"和"Rprofile.site","Renviron.site"有什么区别?

在我的电脑中:

  1. 有在/ etc/R三个文件 RenvironRprofile.site,Renviron.site我找不到Rprofile任何地方.这是一个合适的地位吗?

  2. 什么是差异beetwen Rprofile,Renviron并且Rprofile.site,Renviron.site

r

12
推荐指数
1
解决办法
6031
查看次数

为什么yank是vim中复制的含义?

在网上:http:
//www.merriam-webster.com/dictionary/yank

通过快速运动来拉动某些东西

为什么yank是vim中复制的含义?

vim

12
推荐指数
1
解决办法
4306
查看次数

多进程程序中线程与进程的关系

操作系统:debian9.
一个名为的简单多进程程序mprocesses.py.

import os
import multiprocessing

def run_task(name):
    print("task %s (pid = %s) is running"  %(name,os.getpid()))
    while True:
        pass

if __name__ == "__main__":
    print("current process %s ." %os.getpid())
    pool = multiprocessing.Pool(processes = 2)
    for i in range(2):
        pool.apply_async(run_task,args=(i,))
    pool.close()
    pool.join()
Run Code Online (Sandbox Code Playgroud)

运行python3 mprocesses.py并获得低于输出.

python3 mprocesses.py
current process 6145 .
task 0 (pid = 6146) is running
task 1 (pid = 6147) is running
Run Code Online (Sandbox Code Playgroud)

获取流程信息.

ps lax |grep 'python3 mprocesses.py' |grep -v grep 
0  1000  6145  5615  20 …
Run Code Online (Sandbox Code Playgroud)

python multithreading python-multithreading

12
推荐指数
1
解决办法
311
查看次数

如何在ajax授权和cors的第二个响应中显示内容?

我已经在vps中构建了基本授权和cors.

curl -X OPTIONS -i http://111.111.111.111

HTTP/1.1 200 OK
Date: Sat, 15 Sep 2018 08:07:37 GMT
Server: Apache/2.4.6 (CentOS)
Access-Control-Allow-Origin: http://127.0.0.1
Access-Control-Allow-Methods: POST, GET, PUT, DELETE, OPTIONS
Access-Control-Allow-Credentials: true
Access-Control-Allow-Headers: Authorization,DNT,User-Agent,Keep-Alive,Content-Type,accept,origin,X-Requested-With
Allow: OPTIONS,GET,HEAD,POST,TRACE
Content-Length: 0
Content-Type: httpd/unix-directory
Run Code Online (Sandbox Code Playgroud)

curl -u xxxx:xxxx -i http://111.111.111.111/remote.php

HTTP/1.1 200 OK
Date: Sat, 15 Sep 2018 08:08:07 GMT
Server: Apache/2.4.6 (CentOS)
Access-Control-Allow-Origin: http://127.0.0.1
Access-Control-Allow-Methods: POST, GET, PUT, DELETE, OPTIONS
Access-Control-Allow-Credentials: true
Access-Control-Allow-Headers: Authorization,DNT,User-Agent,Keep-Alive,Content-Type,accept,origin,X-Requested-With
Last-Modified: Sat, 15 Sep 2018 07:54:13 GMT
ETag: "24-575e43f02c324"
Accept-Ranges: bytes
Content-Length: 36 …
Run Code Online (Sandbox Code Playgroud)

javascript php ajax jquery cors

12
推荐指数
1
解决办法
395
查看次数

eval SyntaxError:python中的语法无效

我想分配:

x0='123'    
x1='123'    
x2='123'    
x3='123'    
x4='123'    
x5='123'    
x6='123'    
x7='123'    
x8='123'    
x9='123'    
Run Code Online (Sandbox Code Playgroud)

我编写代码来表示我可以123在输入时获取字符串的输出x1x8.

for i in range(0,10):
    eval("x"+str(i)+"='123'")

Traceback (most recent call last):
File "<stdin>", line 2, in <module>
File "<string>", line 1
  x0='123'
  ^
SyntaxError: invalid syntax
Run Code Online (Sandbox Code Playgroud)

我怎么能这样做?

python

11
推荐指数
2
解决办法
2万
查看次数

哪个物理目录是firefox的localstorage目录?

我的本地电脑上安装了三个浏览器:firefox,chrome,opera.

find /  -name  'Local Storage'
/home/debian8/.config/opera/Local Storage
/home/debian8/.config/google-chrome/Default/Local Storage
Run Code Online (Sandbox Code Playgroud)

可以在find / -name 'Local Storage'opera和chrome中找到存储数据的物理目录,而不是firefox.
哪个物理目录是firefox的localstorage目录?

ls /home/debian8/.mozilla/firefox/4qfwwwo5.default/storage
default  permanent  temporary
Run Code Online (Sandbox Code Playgroud)

为了追踪物理目录,数组以这种方式存储在firefox的本地存储中.1.在firefox中打开https; // www.yahoo.com 2.
在firebug - console中用js存储数组

var arrDisplay = [0, 1, 1, 1];
localStorage.setItem("menuTitle", arrDisplay);  
Run Code Online (Sandbox Code Playgroud)

在此输入图像描述 ls /home/debian8/.mozilla/firefox/4qfwwwo5.default/storage默认永久临时

它很可能在默认目录中.

ls /home/debian8/.mozilla/firefox/4qfwwwo5.default/storage/default
https+++www.yahoo.com
ls /home/debian8/.mozilla/firefox/4qfwwwo5.default/storage/default/https+++www.yahoo.com
idb
ls /home/debian8/.mozilla/firefox/4qfwwwo5.default/storage/default/https+++www.yahoo.com/idb
301792106ttes.files   301792106ttes.sqlite-shm
301792106ttes.sqlite  301792106ttes.sqlite-wal
sqlite3  /home/debian8/.mozilla/firefox/4qfwwwo5.default/storage/default/https+++www.yahoo.com/idb/301792106ttes.sqlite-shm
SQLite version 3.8.7.1 2014-10-29 13:59:56
Enter ".help" for usage hints.
sqlite> .table
sqlite> .exit
sqlite3  /home/debian8/.mozilla/firefox/4qfwwwo5.default/storage/default/https+++www.yahoo.com/idb/301792106ttes.sqlite-wal
SQLite version 3.8.7.1 2014-10-29 13:59:56
Enter ".help" for …
Run Code Online (Sandbox Code Playgroud)

firefox html5 local-storage

11
推荐指数
1
解决办法
676
查看次数