import sys form binascii import unhexlify s = unhexlify(sys.argv[1]) + unhexlify(sys.argv[2]) \ + unhexlify(sys.argv[3]) + unhexlify(sys.argv[4]) import struct result = struct.unpack_from('f', s) print result[0]
個人在學習Linux過程當中的個人筆記,提供個人及有需要的人查閱,若有錯誤歡迎提供指正,謝謝。 This Blog recorded notes about my learning Linux and provides myself and others reference. If there are any incorrect information, welcome to leave a message to correct me, Thanks.
2012年12月22日 星期六
Ascii hex (IEEE754) 轉成 flaot in python
2012年12月6日 星期四
Route setting under multi interfaces
The GATEWAY setting in ifcfg-eth0 will add a default gateway while interface starts, but may be overwrited by next started interface. To avoid this, remove the GATEWAY setting in ifcfg-eth0 and use route-eth0 file
Note. NetworkManager should be stopped
for Example, If there are two interface eth0 and eth1
ifcfg-eth0
for Example, If there are two interface eth0 and eth1
ifcfg-eth0
DEVICE=eth0 IPADDR=10.3.23.221 NETMASK=255.0.0.0 #GATEWAY=10.3.23.254ifcfg-eth1
DEVICE=eth0 IPADDR=172.18.101.2 NETMASK=255.255.0.0 #GATEWAY=172.18.254.254route-eth0
default 10.3.23.254 dev eth0route-eth1
172.16.0.0/12 via 172.18.254.254 dev eth1
訂閱:
文章 (Atom)