Wednesday, November 2, 2011
HowTo: Debug a Shell Script Under Linux or UNIX
http://www.cyberciti.biz/tips/debugging-shell-script.html
scp examples
http://www.hypexr.org/linux_scp_help.php
use -r to copy a directory.
Tuesday, November 1, 2011
Global variable in python
http://docs.python.org/faq/programming.html#what-are-the-rules-for-local-and-global-variables-in-python
http://stackoverflow.com/questions/423379/using-global-variables-in-a-function-other-than-the-one-that-created-them
In short, when modify the global variable in a function, need to explicitly define "global g_sth". This is to avoid using global variables.
Python tutorial and start up script
tutorial:
http://net.tutsplus.com/tutorials/python-tutorials/python-from-scratch-object-oriented-programming/
xml:
http://www.learningpython.com/2008/05/07/elegant-xml-parsing-using-the-elementtree-module/
http://net.tutsplus.com/tutorials/python-tutorials/python-from-scratch-object-oriented-programming/
xml:
http://www.learningpython.com/2008/05/07/elegant-xml-parsing-using-the-elementtree-module/
start up script:
from optparse import OptionParser
import sys
def main():
usage = "usage: %prog [options] arg"
parser = OptionParser(usage)
parser.add_option('-d', '--directory',
action='store', dest='directory',
default=None, help='specify directory')
parser.add_option('-f', '--file',
action='store', dest='filename',
default=None, help='specify file')
parser.add_option('-v', '--version',
action="store_true", dest="show_version",
default=False, help='displays the version number')
if len(sys.argv) == 1:
parser.print_help()
sys.exit()
(options, args) = parser.parse_args()
# rest of program...
if __name__ == '__main__':
main()
Monday, October 10, 2011
QEMU : change cdrom
http://en.wikibooks.org/wiki/QEMU/Monitor#change
(qemu) info block
ide0-hd0: type=hd removable=0 file=/path/to/winxp.img
ide0-hd1: type=hd removable=0 file=/path/to/pagefile.raw
ide1-hd1: type=hd removable=0 file=/path/to/testing_data.img
ide1-cd0: type=cdrom removable=1 locked=0 file=/dev/sr0 ro=1 drv=host_device
floppy0: type=floppy removable=1 locked=0 [not inserted]
sd0: type=floppy removable=1 locked=0 [not inserted]
(qemu) change ide1-cd0 /path/to/my.iso
(qemu) change ide1-cd0 /dev/sr0 host_device
pxe boot on KVM
Fedora:
http://forums.fedoraforum.org/archive/index.php/t-198552.html
Debin:
http://box.matto.nl/kvmpxe.html
Ubuntu Lucid:
http://mrpointy.wordpress.com/2010/05/03/pxe-boot-kvm-guests/
Subscribe to:
Posts (Atom)