Posts

Showing posts from December, 2013

CentOS Install SSH server and configure for VirtualBox testing

Image
I have had some tasks to configure and install a CentOS distribution for my bug-tracking needs. Hope to help out someone with similar problems and or tasks. I'll be using a fresh install of a CentOS Minimal 6.5.  And a Mac Book Pro with VirtualBox installed (as my testing environment). First after install of a clean CentOS you need an SSH server to work in your usual environment. So to connect to a Linux, installed in a VirtualBox you will need basically 2 things: openssh-server install disable firewall VirtualBox Port configuration/Access configuration OpenSSH server install To install server you need to run in your VirtualBox Guest system (CentOS VM): yum -y install openssh-server And start and add it to auto launch at system startup: chkconfig sshd on service sshd start Also make sure port 22 is opened in your VM. type: netstat -tulpn | grep :22 Firewall settings Because it's a VM you can simply disable the firewall. But be sure not to do this a

Python Generators explained simply.

Image
I'm often confused by recent obsession of generators in python. I'll try to explain them as simply as possible. Say you have never used iterators but coded in python. BUT I'm sure you have used dictionaries ( dict ) and have met requirement to iterate through it's keys and/or values. TADA! You have used generators already ;). So generator is a  function  in python. Except for it uses a keyword  yield  in it's code. Thus making it the iterator. So you could call this function in a sequence like you would probably do iterating over a dictionary already. E.g.: # typical iteration through dictionary key: value set for key, value in dict .iteritems(): # do someth # Usage of your own iterator for item in iterator_functuon(): # do something with function generated output So this function returns an iterator generator like the  dict()  type has by default. And has a  next()  function, like usual iterators have. So in attempt to using human langu