我正在尝试从GitHub的Mono repo的tarball编译Mono 3.0.2.但是当我进入mcs文件夹时,编译失败:
if test -w /root/mono/mcs; then :; else chmod -R +w /root/mono/mcs; fi
cd /root/mono/mcs && make --no-print-directory -s NO_DIR_CHECK=1 PROFILES=' net_2_0 net_3_5 net_4_0 net_4_5 ' CC='gcc' all-profiles
Bootstrap compiler: Mono C# compiler version 3.0.3.0
Makefile:43: warning: overriding commands for target 'csproj-local'
../build/executable.make:149: warning: ignoring old commands for target 'csproj-local'
Makefile:43: warning: overriding commands for target 'csproj-local'
../build/executable.make:149: warning: ignoring old commands for target 'csproj-local'
make[7]: *** No rule to make target '../../external/ikvm/reflect/*.cs', needed by '../class/lib/basic/basic.exe'. …Run Code Online (Sandbox Code Playgroud) 我试图在Scapy中编写一个简单的嗅探器,它只使用GET方法打印HTTP数据包.这是代码:
#!/usr/bin/python
from scapy.all import *
def http_header(packet):
http_packet=str(packet)
if http_packet.find('GET'):
print GET_print(packet)
print packet
def GET_print(packet1):
print "***************************************GET PACKET****************************************************"
print packet1
print "*****************************************************************************************************"
sniff(iface='eth0',prn=http_header)
Run Code Online (Sandbox Code Playgroud)
这是输出:
*****************************************************************************************************
None
T???
)?pEa??@@???h??#/??t
?}LGku???U
oTE??I(????9qi???S?????
XuW?F=???-?k=X:?
***************************************GET PACKET****************************************************
T???
)?pE???@@???h??#/??t
?LGku????
oTE??I?K??AH?*?e??>?v1#D?(mG5T?o????8?????????"?KT^?'?mB???]?????k>
?_x?X?????8V???w/?Z?=???N?À??\r?????)+}???l?c?9??j;???h??5?T?9H?/O??)??P
?Y?qf??%?_`??6x??5D?I3???O?
t??tpI#?????$IC??E??
?G?
J??????=?]??v????b5^|P??DK?)uq?2????w?
tB??????y=???n?i?r?.D6?kI?a???6iC???c'??0dPqED?4????[?[??hGh???~|Y/?>`\6yP Dq??T??M????f?;??????? gY???di?_x?8|
eo?p?xW9??=???v?Ye?}?T???y?^?C
-?_(?<?{????}???????r
$??J?k-?9????}??f?27??QK??`?GY?8??Sh???Y@8?E9?R??&a?/vk???6?DF`?/9?I?d( ??-??[A
??)pP??y\?j]???8?_???vf?b????I7???????+?P<_`
*****************************************************************************************************
Run Code Online (Sandbox Code Playgroud)
我期待的是:
GET / HTTP/1.1
Host: google.com
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20140722 Firefox/24.0 Iceweasel/24.7.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: en-US,en;q=0.5
Accept-Encoding: gzip, deflate
Cookie: PREF=ID=758a20b5fbd4eac9:U=2b2dedf6c84b001f:FF=0:TM=1412150291:LM=1415430021:S=Q-QemmrLqsSsEA9i; NID=67=mRdkPVhtImrOTLi5I1e5JM22J7g26jAcdiDEjj9C5q0H5jj0DWRX27hCM7gLJBeiowW-8omSv-1ycH595SW2InWX2n1JMMNh6b6ZrRsZ9zOCC2a-vstOQnBDSJu6K9LO
Connection: keep-alive …Run Code Online (Sandbox Code Playgroud) 使用Python Paho MQTT客户端最可靠的方法是什么?我希望能够处理因WiFi丢失导致的连接中断,并继续尝试重新连接,直到成功为止.
我所拥有的是以下内容,但有没有我不遵守的最佳实践?
import argparse
from time import sleep
import paho.mqtt.client as mqtt
SUB_TOPICS = ("topic/something", "topic/something_else")
RECONNECT_DELAY_SECS = 2
def on_connect(client, userdata, flags, rc):
print "Connected with result code %s" % rc
for topic in SUB_TOPICS:
client.subscribe(topic)
# EDIT: I've removed this function because the library handles
# reconnection on its own anyway.
# def on_disconnect(client, userdata, rc):
# print "Disconnected from MQTT server with code: %s" % rc
# while rc != 0:
# sleep(RECONNECT_DELAY_SECS)
# print …Run Code Online (Sandbox Code Playgroud) 我正在使用 terraform 创建一个 Kubernetes 服务帐户,并尝试从它创建的 Kubernetes Secret 中输出令牌。
resource "kubernetes_service_account" "ci" {
metadata {
name = "ci"
}
}
data "kubernetes_secret" "ci" {
metadata {
name = "${kubernetes_service_account.ci.default_secret_name}"
}
}
output "ci_token" {
value = "${data.kubernetes_secret.ci.data.token}"
}
Run Code Online (Sandbox Code Playgroud)
根据文档,由于 的计算值,这应该使数据块推迟获取其值直到“应用”阶段default_secret_name,但是当我运行terraform apply它时,它给了我这个错误:
Error: Error running plan: 1 error(s) occurred:
* output.ci_token: Resource 'data.kubernetes_secret.ci' does not have attribute 'data.token' for variable 'data.kubernetes_secret.ci.data.token'
Run Code Online (Sandbox Code Playgroud)
添加depends_on到kubernetes_secret数据块没有任何区别。
如果我注释掉该output块,它会很好地创建资源,然后我可以取消注释它,再次应用,一切都正常运行,因为 Kubernetes Secret 已经存在。
我也在这里发了一个 Github …
如何动态创建我的类的子类并为其__init_subclass__()方法提供参数?
示例类:
class MyClass:
def __init_subclass__(cls, my_name):
print(f"Subclass created and my name is {my_name}")
Run Code Online (Sandbox Code Playgroud)
通常我会这样实现我的子类:
class MySubclass(MyClass, my_name="Ellis"):
pass
Run Code Online (Sandbox Code Playgroud)
但是在my_name动态创建MyClass使用元类的子类时我将如何传入?通常我可以使用,type()但它没有提供my_name.
MyDynamicSubclass = type("MyDynamicSubclass", (MyClass,), {})
Run Code Online (Sandbox Code Playgroud) python ×3
centos ×1
http ×1
inheritance ×1
kubernetes ×1
metaclass ×1
mono ×1
mqtt ×1
paho ×1
python-3.x ×1
scapy ×1
sniffer ×1
terraform ×1