Top-Down vs. Bottom-Up DIBsIf you are new to graphics programming, you might expect that a bitmap would be arranged in memory so that the top row of t...
分类:
其他好文 时间:
2014-10-15 21:27:41
阅读次数:
836
expect+ssh修改主机密码foripin`cat/tmp/myhosts`;do
expect-c"spawnssh-p33842$ip;expect*assword*{send\"myoldpasswd\r\"};expectroot@*{send\"echoroot:‘mynewpassword‘|/usr/sbin/chpasswd\r\"};expectroot@*{send\"ipaddr\r\"};expectof";done
分类:
其他好文 时间:
2014-10-15 04:41:50
阅读次数:
204
一.expect实现自动填入密码1.vissh.exp.201#!/usr/bin/expectspawnssh-p20000oldboy@192.168.1.201/sbin/ifconfigeth0settimeout60expect"*password:"send"abcdef\n"expecteofexit2.chmod700ssh.exp.201#注。要是没有权限执行,也可以直接expect,700权限。防止其它用户查看脚本..
分类:
编程语言 时间:
2014-10-13 02:03:19
阅读次数:
287
以前用脚本scp文件时,都是以.ssh打通为基础的。 但是在脚本中使用scp在机器之间拷贝文件,输入密码成为问题。 第一种方法,用到了expect。 脚本如下: #! /usr/bin/expect -f? spawn scp 1 koven@192.168.0.2:...
分类:
其他好文 时间:
2014-10-11 20:31:36
阅读次数:
207
在阅读linux源代码的时候,我们经常会发现likely和unlikely,这两个宏语句定义在compiler.h下,#definelikely(x) __builtin_expect(!!(x),1)#defineunlikely(x) __builtin_expect(!!(x),0)这里我们需要先了解__builtin_expect:#define__builtin_expect(x,expected_value)(x)所..
分类:
系统相关 时间:
2014-09-29 17:40:51
阅读次数:
321
在阅读linux源代码的时候,我们经常会发现likely和unlikely,这两个宏语句定义在compiler.h下,#definelikely(x) __builtin_expect(!!(x),1)#defineunlikely(x) __builtin_expect(!!(x),0)这里我们需要先了解__builtin_expect:#define__builtin_expect(x,expected_value)(x)所..
分类:
系统相关 时间:
2014-09-29 17:24:01
阅读次数:
256
#!/bin/bash
IP=`awk‘{print$1}‘/home/bash/mima.txt`
foriin$IP
do
{port=`grep$i/home/bash/mima.txt|awk‘{print$2}‘`
pawd=`grep$i/home/bash/mima.txt|awk‘{print$3}‘`
expect<<EOF
spawnssh-p$portroot@$i;
expect{
"(yes/no)?"{send"yes\r"}
"password:"{send"$pa..
分类:
其他好文 时间:
2014-09-28 18:43:36
阅读次数:
133
通过在shell脚本中用expect实现远程scp文件:使用expect前,需要先安装两个rpm包:# rpm -ihv CentOS/expect-5.43.0-5.1.i386.rpm # rpm -ihv CentOS/expect-devel-5.43.0-5.1.i386.rpm 或者yu...
分类:
其他好文 时间:
2014-09-26 18:41:48
阅读次数:
315
以下代码在python 2.6.6下测试通过 添加帐号并修改密码: (注:linux的expect命令也可以完成,交互式自动输入的功能) #!/usr/bin/env?python
account?=?‘sl_t1‘
passwd=‘a1p2p3l4e5‘
cmd_useradd?=?‘userad...
分类:
编程语言 时间:
2014-09-24 14:43:28
阅读次数:
208
第十六题The following is a small C program split across files. What do you expect the output to be, when both of them compiled together and run?File1.c .....
分类:
其他好文 时间:
2014-09-23 09:36:14
阅读次数:
295