http://buttom-meal.blogspot.com/2009/04/linux-c-openssl-sha1.html
http://www.ibm.com/developerworks/linux/library/l-openssl.html
On centos 5
yum install openssl, openssl-devel
/*
Code snippet to calculate SHA1sum using openssl libs.
Copyright 2005 Junichi Uekawa, given to public domain.
$ gcc openssltest.c -lssl
$ ./a.out < ./a.out
eae8189278303caaa78f2d89e6a6ebeb7d37b554
$ sha1sum ./a.out
eae8189278303caaa78f2d89e6a6ebeb7d37b554 ./a.out
*/
#include "openssl/ssl.h"
main ()
{
SHA_CTX s;
int i, size;
char c[512];
unsigned char hash[20];
SHA1_Init(&s);
while ((size=read (0, c, 512)) > 0)
SHA1_Update(&s, c, size);
SHA1_Final(hash, &s);
for (i=0; i < 20; i++)
printf ("%.2x", (int)hash[i]);
printf ("\n");
}
Wednesday, October 28, 2009
Tuesday, October 20, 2009
netperf and tc usage
http://www.ibm.com/developerworks/cn/linux/l-netperf/
http://wolfbeing.blog.51cto.com/435511/190470
In short:
tc:
cbq:
http://doc.linuxpk.com/2855.html
http://www.91linux.com/html/article/kernel/20071224/9346.html
http://www.linux.org/docs/ldp/howto/Traffic-Control-HOWTO/software.html
http://www.topwebhosts.org/tools/traffic-control.php
http://www.chinaunix.net/jh/4/350969.html
http://linux.chinaitlab.com/c/32739.html
http://www.webjx.com/server/linux-14448_2.html
http://www.host01.com/article/server/00070002/0621409045465728.htm
http://www.hugbear.net/hugbear/viewinfobearworks42.html
add traffic control:
following command can resitrict the send speed to 10k:
"tc qdisc add dev eth1 root tbf rate 10kbit latency 50ms burst 1000kb"
following cmd used to remove traffic control:
"tc qdisc del dev eth1 root tbf"
http://wolfbeing.blog.51cto.com/435511/190470
In short:
first, start the server on a machine by running: netserv.
second, run "netperf -H $server-ip$ " on the client machine.
tc:
cbq:
http://doc.linuxpk.com/2855.html
http://www.91linux.com/html/article/kernel/20071224/9346.html
http://www.linux.org/docs/ldp/howto/Traffic-Control-HOWTO/software.html
http://www.topwebhosts.org/tools/traffic-control.php
http://www.chinaunix.net/jh/4/350969.html
http://linux.chinaitlab.com/c/32739.html
http://www.webjx.com/server/linux-14448_2.html
http://www.host01.com/article/server/00070002/0621409045465728.htm
http://www.hugbear.net/hugbear/viewinfobearworks42.html
add traffic control:
following command can resitrict the send speed to 10k:
"tc qdisc add dev eth1 root tbf rate 10kbit latency 50ms burst 1000kb"
following cmd used to remove traffic control:
"tc qdisc del dev eth1 root tbf"
Wednesday, October 14, 2009
Meanings of wa, hi, si in "top" command output
The summary area fields describing CPU statistics are abbreviated. They provide information about times spent in:
us = user mode
sy = system mode
ni = low priority user mode (nice)
id = idle task
wa = I/O waiting
hi = servicing IRQs
si = servicing soft IRQs
st = steal (time given to other DomU instances)
us = user mode
sy = system mode
ni = low priority user mode (nice)
id = idle task
wa = I/O waiting
hi = servicing IRQs
si = servicing soft IRQs
st = steal (time given to other DomU instances)
Monday, October 12, 2009
Algorithm in latex, and install new package
http://andrewjpage.com/index.php?/archives/55-Algorithms-in-Latex.html
http://wiki.ctex.org/index.php/LaTeX/%E5%9F%BA%E7%A1%80%E7%9F%A5%E8%AF%86#.E5.AE.89.E8.A3.85.E9.A2.9D.E5.A4.96.E7.9A.84.E5.AE.8F.E5.8C.85
http://wiki.ctex.org/index.php/LaTeX/%E5%9F%BA%E7%A1%80%E7%9F%A5%E8%AF%86#.E5.AE.89.E8.A3.85.E9.A2.9D.E5.A4.96.E7.9A.84.E5.AE.8F.E5.8C.85
Thursday, October 1, 2009
Subscribe to:
Posts (Atom)