Custom Search

Tuesday, March 22, 2016

openstack bypass ec2api signature check

1)
$/usr/lib/python2.7/dist-packages/keystone/contrib/ec2/controllers.py

class Ec2ControllerCommon(object):
        if credentials.get('signature'):
            return True

2)
$sudo service keystone restart


Thursday, March 17, 2016

How to fix Illegal list name: mailman@localhost

1)
$sudo newlist mailman myname@gmail.com mypassword

Create a new, unpopulated mailing list.

Usage: /usr/sbin/newlist [options] [listname [listadmin-addr [admin-password]]]

Options:

    -l language
    --language=language
        Make the list's preferred language `language', which must be a two
        letter language code.

    -u urlhost
    --urlhost=urlhost
        Gives the list's web interface host name.

    -e emailhost
    --emailhost=emailhost
        Gives the list's email domain name.

    -q/--quiet
        Normally the administrator is notified by email (after a prompt) that
        their list has been created.  This option suppresses the prompt and
        notification.

    -h/--help
        Print this help text and exit.

You can specify as many of the arguments as you want on the command line:
you will be prompted for the missing ones.

Every Mailman list has two parameters which define the default host name for
outgoing email, and the default URL for all web interfaces.  When you
configured Mailman, certain defaults were calculated, but if you are running
multiple virtual Mailman sites, then the defaults may not be appropriate for
the list you are creating.

You also specify the domain to create your new list in by typing the command
like so:

    newlist --urlhost=www.mydom.ain mylist

where `www.mydom.ain' should be the base hostname for the URL to this virtual
hosts's lists.  E.g. with this setting people will view the general list
overviews at http://www.mydom.ain/mailman/listinfo.  Also, www.mydom.ain
should be a key in the VIRTUAL_HOSTS mapping in mm_cfg.py/Defaults.py if
the email hostname to be automatically determined.

If you want the email hostname to be different from the one looked up by the
VIRTUAL_HOSTS or if urlhost is not registered in VIRTUAL_HOSTS, you can specify
`emailhost' like so:

    newlist --urlhost=www.mydom.ain --emailhost=mydom.ain mylist

where `mydom.ain' is the mail domain name. If you don't specify emailhost but
urlhost is not in the virtual host list, then mm_cfg.DEFAULT_EMAIL_HOST will
be used for the email interface.

For backward compatibility, you can also specify the domain to create your
new list in by spelling the listname like so:

    mylist@www.mydom.ain

where www.mydom.ain is used for `urlhost' but it will also be used for
`emailhost' if it is not found in the virtual host table. Note that
'--urlhost' and '--emailhost' have precedence to this notation.

If you spell the list name as just `mylist', then the email hostname will be
taken from DEFAULT_EMAIL_HOST and the url will be taken from DEFAULT_URL (as
defined in your Defaults.py file or overridden by settings in mm_cfg.py).

Note that listnames are forced to lowercase.

Illegal list name: mailman@localhost


Fix
=====


a)
In "/etc/mailman/mm_cfg.py" Change DEFAULT_EMAIL_HOST and DEFAULT_URL_HOST

DEFAULT_EMAIL_HOST = 'localhost'
DEFAULT_URL_HOST   = 'localhost'

to

DEFAULT_EMAIL_HOST = 'myhost.net'
DEFAULT_URL_HOST   = 'myhost.net'





b)
Then create newlist again

$sudo /var/lib/mailman/bin/newlist mailman myname@gmail.com 123
OR
$sudo newlist mailman myname@gmail.com 123
OR
$sudo newlist




How to fix Site list for mailman missing Please create it

$sudo /etc/init.d/mailman start
 * Site list for mailman missing (looking for list named 'mailman').
 * Please create it; until then, mailman will refuse to start.

Fix
====

a)
create newlist

$sudo /var/lib/mailman/bin/newlist mailman myname@gmail.com 123
OR
$sudo newlist mailman myname@gmail.com 123
OR
$sudo newlist



b)
Then start again
$sudo /etc/init.d/mailman start

Extra commands:
$list_lists
$rmlist mylistname
$ls /var/lib/mailman/bin

$ls /usr/lib/mailman
#ls /usr/lib/mailman/Mailman


How to fix ImportError No module named Mailman

$sudo python -m smtpd -c MailmanProxy -n 127.0.0.1:25

error: uncaptured python exception, closing channel __main__.SMTPChannel connected 127.0.0.1:40739 at 0x7fc0cd7f3998 (type 'exceptions.ImportError':No module named Mailman [/usr/lib/python2.7/asyncore.py|read|83] [/usr/lib/python2.7/asyncore.py|handle_read_event|449] [/usr/lib/python2.7/asynchat.py|handle_read|158] [/usr/lib/python2.7/smtpd.py|found_terminator|181] [/usr/lib/python2.7/smtpd.py|process_message|390])



Fix
=====

$sudo vim /usr/lib/python2.7/smtpd.py

Add following lines

import sys
sys.path.append("/usr/lib/mailman")



Tuesday, March 15, 2016

How to avoid citrix receiver full screen in Ubuntu

$sudo vim ~/.ICAClient/All_Regions.ini
TWIMode = False
DesiredHRES = 800
DesiredVRES = 600


Monday, March 14, 2016

grep a file and print some lines before and after the matching line

1)
Print matching line with 2 lines after the matching line
$grep -r -A 2 install neutron.conf

2)
Print matching line with 2 linee before the matching line
$grep -r -B 2 install neutron.conf

3)
Print matching line with 2 lines before and after the matching line
$grep -r -C 2 install neutron.conf


How To SSH into Virtualbox Guest Ubuntu 16.04




How to Install Ubuntu 16.04 LTS Desktop on Oracle Virtualbox




How to Install Skype 4.3 on Ubuntu 16.04 in 3 Steps

1)
$sudo add-apt-repository "deb http://archive.canonical.com/ $(lsb_release -sc) partner"

2)
$sudo apt-get update

3)
$sudo apt-get install skype




How to Install Skype on Ubuntu 16.04 LTS Desktop

1)
$sudo add-apt-repository "deb http://archive.canonical.com/ $(lsb_release -sc) partner"

2)
$sudo apt-get update

3)
$sudo apt-get install skype






Wednesday, March 9, 2016

python StringIO read and write strings as files

>>>from cStringIO import StringIO

>>>buf=StringIO()

>>>def write_to_buffer(buf):
            for i in range(1,10):
                buf.write(str(i))


>>>buf.getvalue()

>>>write_to_buffer(buf)

>>>buf.getvalue()


python find function name, number of arguments, name of arguments and default values

>>>def mufunc(a,b,c=5,d=10):
            pass


>>>func = mufunc

>>>func.func_name

>>>func.func_code.co_varnames

>>>func.func_code.co_argcount

>>>func.func_defaults

OR

>>>func.__name__

>>>func.__code__.co_varnames

>>>func.__code__.co_argcount

>>>func.__defaults__




Monday, March 7, 2016

python itertools izip

https://github.com/openstack/ec2-api/blob/master/ec2api/api/cloud.py#L53

>>> import collections
>>>
>>> import itertools
>>>
>>> p1=['group_name', 'group_id', 'filter']
>>>
>>> p2=['security_group_strs','sg_ids', 'filter']
>>>
>>> collections.OrderedDict(itertools.izip(p1, p2))
OrderedDict([('group_name', 'security_group_strs'), ('group_id', 'sg_ids'), ('filter', 'filter')])



OR

>>>
>>> import six
>>>
>>>
>>> collections.OrderedDict(six.moves.zip(p1,p2))
OrderedDict([('group_name', 'security_group_strs'), ('group_id', 'sg_ids'), ('filter', 'filter')])
>>>