One feature of emacs named “make-frame-on-display” maybe is useful for pair programming practice. As described in Sams Teach Yourself Emacs in 24 Hours,“Using the command make-frame-on-display, a frame can be created on another display. This makes it possible for two persons to work on the same buffer at the same time, each sitting at their computer. “
Of cource, it needs XServer, so it’s not available on MS windows
There are many interactive tools avaiable such as telnet, ssh, ftp and samclient(samba client) which provide powerful ways for lots of things. However, sometimes, you don’t want to process some tasks in “interactive” way.
For example, if you need to backup document to the ftp server daily. All things you have to repeat day to day is just same. Ftp to host, input user name, input password, cd to some directory, put the file to server and then quit.
Why not do this in automatical way? One step, all done!
The fantastic tool named “expect” make your dream true. You can write simple “expect” script in advance. And the script works in below patterns
“send something”
“expect something”
“send something”
“expect something”
It’s just like talking with the server. The secret lies in that we know in advance what will happen during talking so we write down the words in the script. When the tool hear what it “expect”ed, it “send” the predefined feedback. This way, we make the interactive talking non-interactive and automatically.
I use expect this way. Using “autoexpect” to help you create the “expect” script automatically. For example, just use “autoexpect -f scriptfile.exp ftp” as “ftp” or “autoexpect -f scriptfile.exp telnet” as “telnet” and do whatever you want. After the session ends, a script named “scriptfile.exp” will be created. Just run this script and any runnable application on Linux, you can see the “expect”ed result. And to learn more, just “cat” this script and you can see all secrets.
I’m using furl to collect some “expect” information, if you like it, please click link
Enjoy it!
Yesterday, I was asked to write script uploading/downloading files through samba. Of cource, I pick up the python as the script language. However, after “google”, I can’t find any just-in-hand package for this aim. There is one samba package for python but not standard. And two other information I got made me sad.([Samba] Controlling smbclient from python weirdness and Samba – python).
It’s too complicated to control the samba with popen.
Suddendly, it occurs to me “Why not mount the samba as fs?”. After mounting samba as fs, I can operate the smb fs as a local file system.
Cool, that’s the best solution to me!
mount -t smbfs -o username=xxx,password=yyy //hostip/hostdir /mount/smbdir
PEAK 是一个用于快速开发和重用应用程序组件的 Python 框架。虽然 Python 本身就已经是一门非常高层次的语言,但 PEAK 提供了更高层次的抽象,这些抽象主要来自于对元类(metaclass)及其他高级 Python 技术的巧妙运用。在很多方面,PEAK 对 Python 的贡献相当于 J2EE 对 Java 的贡献。PEAK 中的形式化部分体现在协议的显式规范中,具体说是在可以单独获得的 PyProtocols 包中。