我正在使用Python编写一些加密算法,但我之前从未使用过Python.
首先,看看这段代码然后我会解释这个问题,
x = bytearray(salt[16:])
y = bytearray(sha_512[32:48])
c = [ i ^ j for i, j in zip( x, y ) ]
Run Code Online (Sandbox Code Playgroud)
x和y的值是,
bytearray(b'AB\xc8s\x0eYzr2n\xe7\x06\x93\x07\xe2;')
bytearray(b'+q\xd4oR\x94q\xf7\x81vN\xfcz/\xa5\x8b')
Run Code Online (Sandbox Code Playgroud)
我无法理解代码的第三行.为了理解第三行,我不得不研究这个函数zip(),我遇到了这个问题,
根据这个问题的答案,代码,
zip((1,2,3),(10,20,30),(100,200,300))
Run Code Online (Sandbox Code Playgroud)
会输出,
[(1, 10, 100), (2, 20, 200), (3, 30, 300)]
Run Code Online (Sandbox Code Playgroud)
但是当我试图打印它时
print(zip((1,2,3),(10,20,30),(100,200,300)))
Run Code Online (Sandbox Code Playgroud)
我得到这个输出,
<zip object at 0x0000000001C86108>
Run Code Online (Sandbox Code Playgroud)
为什么我的输出与原始输出不同?
我从服务器中提取数据,其中一个文件夹名称超过256个字节,因此我的CentOS会抛出名称太长的错误.我在互联网上搜索过但无法找到任何方法在ext2/ext3/ext4文件系统下创建大小超过256字节的文件夹/文件名.
但是,One解决方案建议创建reiserfs文件系统ext4以处理名称较长的files \文件夹.这个解决方案可能会有效,但我在其中一本书中读到,如果需要,可以将文件名大小的限制从255字符扩展到1012字符.
The maximal file name size is 255 characters. This limit could be extended to `1012` if needed.
Run Code Online (Sandbox Code Playgroud)
来源: 谷歌
但我找不到任何解释如何修改文件系统以扩展大小的网站1012?
有人可以帮我吗?
文件样本:
{
"_id" : ObjectId("53329dfgg43771e49538b4567"),
"u" : {
"_id" : ObjectId("532a435gs4c771edb168c1bd7"),
"n" : "Salman khan",
"e" : "salman@gmail.com"
},
"ps" : 0,
"os" : 1,
"rs" : 0,
"cd" : 1395685800,
"ud" : 0
}
Run Code Online (Sandbox Code Playgroud)
查询:
db.collectiontmp.aggregate([
{$match: {os:1}},
{$project : { name:{$toUpper:"$u.e"} , _id:0 } },
{$group: { _id: "$u._id",total: {$sum:1} }},
{$sort: {total: -1}}, { $limit: 10 }
]);
Run Code Online (Sandbox Code Playgroud)
我需要从上面的查询中得到以下内容:
u._id返回记录中的记录和电子邮件总数,如下所示:
{"result":[{"email":"","total":""},{"email":"","total":""}},"ok":1}
我一直在尝试在/ etc/modules文件中找到一个模式(bcm2708_wdog),如果没有,则将其添加到底部.每次我尝试这个,我得到"SLS狗的ID狗不是字典".我不知道这是什么意思.这是文件:
dog:
- file.replace:
- name: /etc/modules
- pattern: 'bcm2708_wdog'
- append_if_not_found: True
Run Code Online (Sandbox Code Playgroud) 我需要设置公司代理,以便Docker可以从公共注册表下载图像.
$ sudo docker run hello-world
Unable to find image 'hello-world:latest' locally
Pulling repository docker.io/library/hello-world
Error while pulling image: Get https://index.docker.io/v1/repositories/library/hello-world/images: dial tcp: lookup index.docker.io: no such host
Run Code Online (Sandbox Code Playgroud)
我正在使用Ubuntu 12.04机器.我找到了这个答案但systemctl在Ubuntu 12.04中没有.我怎样才能做到这一点?
谢谢.
我的程序中有两个单选按钮,但是当我运行它时,它们都没有被检查,我希望默认情况下检查其中一个,我怎样才能实现这一点?
<li><input type="radio" name="r1" value="o" onClick="submit();" <?php echo ($_SESSION['r1'] == "o") ? 'checked="checked"' : ''; ?> />On</li>
<li><input type="radio" name="r1" value="p" onClick="submit();" <?php echo ($_SESSION['r1'] == "p") ? 'checked="checked"' : ''; ?> />Off</li>
Run Code Online (Sandbox Code Playgroud)
我希望第一次打开页面时检查"打开"按钮
我一直在那里四处寻找,但找不到工作决议.我尝试在Logstash配置文件中使用Grok Filter来过滤Apache-Access日志文件.日志消息如下所示:{"message":"00.00.0.000 - - [dd/mm/YYYY:hh:mm:ii +0000] \"GET /index.html HTTP/1.1\" 200 00"}.
在这一刻,我只能通过使用过滤客户端IP grok { match => [ "message", "%{IP:client_ip}" ] }.
我想过滤:
- The GET method,
- requested page (index.html),
- HTTP/1.1\,
- server response 200
- the last number 00 after 200 inside the message body
Run Code Online (Sandbox Code Playgroud)
请注意,这些都不适合我:
grok { match => { "message" => "%{COMBINEDAPACHELOG}" } }
Run Code Online (Sandbox Code Playgroud)
要么
grok { match => [ "message", "%{COMBINEDAPACHELOG}" ] }
Run Code Online (Sandbox Code Playgroud) 我是否需要升级我的处理器以运行HAXM或者我错过了什么?如果我错过了什么,任何提示将不胜感激:)
我的处理器是Intel Core2 6300 @ 1.86GHz 1.86GHz安装内存4.00 Gb.在Win7上运行.
我在BIOS中启用了VT,但它是16位还是32位?这是一个问题吗?
我运行了英特尔处理器识别实用程序,文件pidenu39.msi来自...... 英特尔®处理器识别实用程序 - Windows*版本
它在CPU技术选项卡上告诉我,我的处理器确实具有英特尔虚拟化技术,但没有带扩展页表的VT-x虚拟化技术.这个可以吗?
从该网站,配置虚拟机加速
我已按照此标题下的所有说明操作...在Windows上配置VM加速
sc query intel haxm确实表明虚拟化驱动程序运行正常.
我得到这个消息序列......
C:\AndroidSDK\tools\emulator.exe -avd Nexus_5_API_21_x86 -netspeed full -netdelay none
Run Code Online (Sandbox Code Playgroud)
模拟器:设备fd:584
**HAX is not working** and emulator runs in emulation mode
emulator: The memory needed by this VM exceeds the driver limit
.
emulator: warning: opening audio input failed
creating window 39 53 300 532
../../sdk/emulator/opengl//host/libs/Translator/GLES_V2//GLESv2Imp.cpp:glAttachShader:156 error 0x501
../../sdk/emulator/opengl//host/libs/Translator/GLES_V2//GLESv2Imp.cpp:glAttachShader:156 error 0x501 …Run Code Online (Sandbox Code Playgroud) 我正在尝试索引一个有 50,000 条日志的 12mb 日志文件。索引大约 30,000 条日志后,出现以下错误
[2018-04-17T05:52:48,254][INFO ][logstash.outputs.elasticsearch] retrying failed action with response code: 429 ({"type"=>"es_rejected_execution_exception", "reason"=>"rejected execution of org.elasticsearch.transport.TransportService$7@560f63a9 on EsThreadPoolExecutor[name = EC2AMAZ-1763048/bulk, queue capacity = 200, org.elasticsearch.common.util.concurrent.EsThreadPoolExecutor@7d6ae98b[Running, pool size = 2, active threads = 2, queued tasks = 200, completed tasks = 3834]]"})
Run Code Online (Sandbox Code Playgroud)
但是,我浏览了文档和 elasticsearch 论坛,它们建议我增加 elasticsearch 批量队列的大小。我尝试使用 curl 但我无法做到这一点。
curl -XPUT localhost:9200/_cluster/settings -d '{"persistent" : {"threadpool.bulk.queue_size" : 100}}'
Run Code Online (Sandbox Code Playgroud)
增加队列大小是个好选择吗?我无法增加硬件,因为我的数据较少。
我面临的错误是由于队列大小问题还是其他原因?如果使用队列大小如何更新elasticsearch.yml中的队列大小,在elasticsearch.yml中更新后是否需要重新启动es?
请告诉我。谢谢你的时间
l1 = ['A','B','C','D','A','B']
l2 = []
Run Code Online (Sandbox Code Playgroud)
'C'是列表l1中的第一个值,我想创建一个函数,以便它在l2中返回C.