Tuesday, November 29, 2011

[Level 2] MySQL security check with tcpdump.

you can check if MySQL data streams are encrypted or not by the following command:
# tcpdump -l -i eth0 -w - src or dst port 3306 | strings
Wish this helps.
regards,
Stanley Huang

Tuesday, November 22, 2011

[Level 3] Pythonbrew, the Python environment management tool.

The more info, please click here

The Chinese resource from OpenFoundry, click here.

Wish this helps.
regards,
Stanley Huang

Monday, November 21, 2011

[Level 3] Slides from Devoxx talk on Language / Library / VM Co-Evolution.

Slides from Devoxx talk on Language / Library / VM Co-Evolution,
more info, please click here.

Wish this helps.
regards,
Stanley Huang

[Level 3] The bonding info of Linux

The bonding info of Linux, click here for more detail.

Wish this helps.
regards,
Stanley Huang

Friday, November 18, 2011

[Level 2] Pydoc, the document of Python.

In Java, we have javadoc to generate the document,
in Python, we have pydoc.
More info, please click here.


The sample of pydoc as the following:

The source code of testPyDoc.py
#!/usr/bin/python

"""
This is a sample module to generate pydoc
"""
__author__ =  'Stanley Huang'
__version__=  '1.0'

class PyDoc:
    """class docstrings"""
    def __init__ (self, user='guest', addr='Taipei'):
        """Set default attribute values only
        Keyword arguments:
        user -- name of user
        addr -- addr of user
        """
        self.user = user
        self.addr = addr
$ pydoc testPydoc
Help on module testPyDoc:

NAME
    testPyDoc - This is a sample module to generate pydoc

FILE
    /tmp/testPyDoc.py

CLASSES
    PyDoc
    
    class PyDoc
     |  class docstrings
     |  
     |  Methods defined here:
     |  
     |  __init__(self, user='guest', addr='Taipei')
     |      Set default attribute values only
     |      Keyword arguments:
     |      user -- name of user
     |      addr -- addr of user

DATA
    __author__ = 'Stanley Huang'
    __version__ = '1.0'

VERSION
    1.0

AUTHOR
    Stanley Huang
Wish this helps. regards, Stanley Huang

[Level 3] How to implement AES in Python.

A paper for how to implement AES in Python. Please click here.

Another paper is here.


Wish this helps.
regards,
Stanley Huang

Wednesday, November 16, 2011

[Level 3] IoC/AOP in Python.

More Ioc info, please refer to here.
More AOP info, please refer to here.
Wish this helps.
regards,
Stanley Huang

[Level 2] How to update Ubuntu boot menu (grub).

If you want to modify grub menu of Ubuntu,
you have following steps to do:
1. Modify default grub configuration file.
# vi /etc/default/grub
2. Update grub configuration.
# update-grub
Generating grub.cfg ...
Found linux image: /boot/vmlinuz-2.6.38-12-generic
Found initrd image: /boot/initrd.img-2.6.38-12-generic
Found linux image: /boot/vmlinuz-2.6.38-8-generic
Found initrd image: /boot/initrd.img-2.6.38-8-generic
Found memtest86+ image: /boot/memtest86+.bin
Found Windows Recovery Environment (loader) on /dev/sda1
Found Windows 7 (loader) on /dev/sda2
done
#

More info. please refer to here.

Wish this helps.
regards,
Stanley Huang

Friday, November 11, 2011

[Level 2] classmethod, staticmethod, abstractmethod decorators in Python.

#!/bin/env python
from abc import *

class p(object):
    __metaclass__ = ABCMeta

    @abstractmethod
    def printz(self):
        pass

    @abstractproperty
    def x(self):
        pass

class o(p):
    def __init__(self, n=10):
        self._x = n 

    def printX(self):
        print self._x

    def printx(self):
        print self.x

    @classmethod
    def printy(self):
        print self.x

    @staticmethod
    def printz():
        print 'x' 

    @property
    def x(self):
        return self._x

    @x.setter
    def x(self, times):
        self._x = self._x * times

    @x.getter
    def x(self):
        return self._x

a = o(2)
a.x = 5
print a.x
a.printX()
a.printx()
a.printy()
a.printz()

#o.printX() # error
#o.printx() # error
o.printy()
o.printz()

$ ./t.py 
10
10
10
<property object at 0x177a1b0>
x
<property object at 0x177a1b0>
x

Wish this helps.
regards,
Stanley Huang

Wednesday, November 2, 2011

[Level 1] Login server console with minicom on Ubuntu laptop.

If you want to use console to login server on Ubuntu laptop,
you could try a useful app named "minicom".
And you could download in by apt-get.
# apt-get -y install minicom

Wish this helps.
regards,
Stanley Huang