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
2012年10月3日 星期三
Create a Package repo
1. create /var/pxe/centos6 directory
http://practical-tech.blogspot.tw/2011/10/how-to-configure-pxe-server-in-rhel-6.html
http://httpd.apache.org/docs/current/sections.html
mkdir -p /var/pxe/centos62. mount iso and copy all files into /var/pxe/centos6 and create repo
cp -ivr /media/CentOS_6.3_Final/* /var/pxe/centos6 cd /var/pxe/centos6 createrepo .3. create conf file /etc/httpd/conf.d/pxeboot.conf
Alias /centos6 /var/pxe/centos6 <Directory /var/pxe/centos6> Options Indexes FollowSymLinks AllowOverride None </Directory>4. Allow selinux httpd_sys_content_t
cd /var/pxe chcon -R -t httpd_sys_content_t './centos6'5. Restart httpd
service httpd restart6. Open browser to check "http://127.0.0.1/centos6" is available Reference:
http://practical-tech.blogspot.tw/2011/10/how-to-configure-pxe-server-in-rhel-6.html
http://httpd.apache.org/docs/current/sections.html
2012年9月27日 星期四
Install RockMongo on Ubuntu
1. Install mongodb
follow the link below to install mongodb
http://docs.mongodb.org/manual/tutorial/install-mongodb-on-ubuntu/
2. Install php5, php-pear
>apt-get install php5 php-pear
3. Install php-mongo
http://www.php.net/manual/en/mongo.installation.php
4. download rockmongo and the unzip and put in /var/www
http://rockmongo.com/downloads
5. restart apache2 mongodb
>service apache2 restart
>service mongodb restart
(If mongodb is locked, please check below link)
http://blog.brianbuikema.com/2011/01/mongodb-ubunto-overview-installation-setup-dev-python-2/
6. Login with admin/admin on http://localhost/rockmongo
(Modify config.php to change login username/password)
follow the link below to install mongodb
http://docs.mongodb.org/manual/tutorial/install-mongodb-on-ubuntu/
2. Install php5, php-pear
>apt-get install php5 php-pear
3. Install php-mongo
http://www.php.net/manual/en/mongo.installation.php
4. download rockmongo and the unzip and put in /var/www
http://rockmongo.com/downloads
5. restart apache2 mongodb
>service apache2 restart
>service mongodb restart
(If mongodb is locked, please check below link)
http://blog.brianbuikema.com/2011/01/mongodb-ubunto-overview-installation-setup-dev-python-2/
6. Login with admin/admin on http://localhost/rockmongo
(Modify config.php to change login username/password)
2012年8月30日 星期四
Disable ping response in Linux
sysctl -w net.ipv4.icmp_echo_ignore_all=1http://www.linuxarticles.org/2010/10/disable-ping-response-in-linux/
2012年8月29日 星期三
Install mongodb on Ubuntu
1. import public key
Reference: http://docs.mongodb.org/manual/tutorial/install-mongodb-on-debian-or-ubuntu-linux/
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv 7F0CEB102. create /etc/apt/sources.list.d/10gen.list
deb http://downloads-distro.mongodb.org/repo/ubuntu-upstart dist 10gen3.
sudo apt-get update4.
sudo apt-get install mongodb-10gen
Reference: http://docs.mongodb.org/manual/tutorial/install-mongodb-on-debian-or-ubuntu-linux/
tsocks
1. install epel first
http://fedoraproject.org/wiki/EPEL
1. insatll tsocks
http://fedoraproject.org/wiki/EPEL
1. insatll tsocks
yum install tsocks2. add file /etc/tsocks.conf
server = 127.0.0.1 server_type = 5 server_port = 12343. establish ssh tunnel
ssh -D 1234 user@xxx.remote.host4. wget with socks proxy
tsocks wget http://get.something5. you might want to unset the http_proxy variable
unset http_proxy
訂閱:
文章 (Atom)