- the * and ** operators
- Generators, though I have not yet used them (ideas)
- ipython: an interactive python shell (not necessarily IronPython). It's been allowing me explore the language quickly (much quicker to type '?' than google the documentation) and interactively; e.g.
sh-4.2$ ipython Python 2.7.2 (default, Oct 27 2011, 01:40:22) Type "copyright", "credits" or "license" for more information. IPython 0.12 -- An enhanced Interactive Python. ? -> Introduction and overview of IPython's features. %quickref -> Quick reference. help -> Python's own help system. object? -> Details about 'object', use 'object??' for extra details. In [1]: 1+ File "
", line 1 1+ ^ SyntaxError: invalid syntax In [2]: import ldap.<tab> ldap.async ldap.dn ldap.ldapobject ldap.sasl ldap.thread ldap.cidict ldap.filter ldap.modlist ldap.schema ldap.threading ldap.controls ldap.functions ldap.resiter ldap.sys ldap.traceback In [2]: import ldap.filter In [3]: ldap.filter.<tab> ldap.filter.escape_filter_chars ldap.filter.filter_format In [3]: ldap.filter.escape_filter_chars? Type: function Base Class: String Form: Namespace: Interactive File: /usr/lib64/python2.7/site-packages/ldap/filter.py Definition: ldap.filter.escape_filter_chars(assertion_value, escape_mode=0) Docstring: Replace all special characters found in assertion_value by quoted notation. escape_mode If 0 only special chars mentioned in RFC 2254 are escaped. If 1 all NON-ASCII chars are escaped. If 2 all chars are escaped. In [4]: In [4]: ldap.filter.escape_filter_chars?? Type: function Base Class: String Form: Namespace: Interactive File: /usr/lib64/python2.7/site-packages/ldap/filter.py Definition: ldap.filter.escape_filter_chars(assertion_value, escape_mode=0) Source: def escape_filter_chars(assertion_value,escape_mode=0): """ Replace all special characters found in assertion_value by quoted notation. escape_mode If 0 only special chars mentioned in RFC 2254 are escaped. If 1 all NON-ASCII chars are escaped. If 2 all chars are escaped. """ if escape_mode: r = [] if escape_mode==1: for c in assertion_value: if c < '0' or c > 'z' or c in "\\*()": c = "\\%02x" % ord(c) r.append(c) elif escape_mode==2: for c in assertion_value: r.append("\\%02x" % ord(c)) else: raise ValueError('escape_mode must be 0, 1 or 2.') s = ''.join(r) else: s = assertion_value.replace('\\', r'\5c') s = s.replace(r'*', r'\2a') s = s.replace(r'(', r'\28') s = s.replace(r')', r'\29') s = s.replace('\x00', r'\00') return s In [5]: ... In [60]: import string In [61]: string.<tab> string.Formatter string.capwords string.ljust string.rsplit string.Template string.center string.lower string.rstrip string.ascii_letters string.count string.lowercase string.split string.ascii_lowercase string.digits string.lstrip string.splitfields string.ascii_uppercase string.expandtabs string.maketrans string.strip string.atof string.find string.octdigits string.swapcase string.atof_error string.hexdigits string.printable string.translate string.atoi string.index string.punctuation string.upper string.atoi_error string.index_error string.replace string.uppercase string.atol string.join string.rfind string.whitespace string.atol_error string.joinfields string.rindex string.zfill string.capitalize string.letters string.rjust In [61]: string.whitespace Out[61]: '\t\n\x0b\x0c\r ' In [62]: string.punctuation Out[62]: '!"#$%&\'()*+,-./:;<=>?@[\\]^_`{|}~' In [63]:
Saturday, April 7, 2012
new python toys
Thursday, March 29, 2012
Zimbra kills killer feature in favor of "just use vmware"
Long have I looked forward to Zimbra having disaster recovery through server to server sync. It would have made things better in my organization in a DR situation. In lieu of not having this feature we live mirror replicate the Zimbra store server LUNs between data centrers on our XIVs. So our DR strategy is to use our backup store servers on the replicated LUNs. Setting this up would take some time. It would be much better if they were already in the Zimbra cluster all the time and flipping them over to be the master would be a "supported feature" not something a sys admin has to do by configuring another instance of the store server by using the same data.
Zimbra promised me this feature years ago and today they backed out and ask that we just implement this feature by running Zimbra on VMware and buying vCenter Site Recovery Manager. However, we don't want proprietary lock-in reaching down into our virtualization platform so we don't use VMware and instead use KVM. We like Zimbra because it's built with non-proprietary components aside from the active-sync and Outlook connectors which we liked having since lots of people want an Exchange-like interface and we can keep the proprietary code/protocols in their own little bucket.
Zimbra is calling lots of attention to VMware's features as opposed to what a future version of Zimbra was supposed to have:
"This enhancement requests asks to sync an active server to a passive server, we'll never do this. It's a legacy failover model when their are new technology options to provide elastic scaling and (geo)redundancy with stateless application servers and distributed data. It's taken some time for these technologies to progress to the point where they are viable enough for applications like Zimbra that need data consistency and atomic transactions."Let's look at this more simply. VMware can sync VM objects. Zimbra was supposed to be able to sync Zimbra objects. If you run Zimbra on VMware then you can just use the sync'd VMware objects for DR but if you don't run VMware then it would be nice to have sync'd Zimbra objects. Sycing objects to a recovery site is not legacy. What's changed is the type of objects.
Update: Zimbra re-opened the feature request. I'm glad the community put enough pressure on them.
Monday, March 19, 2012
Thursday, February 9, 2012
iptables be liberal cheatsheet
rhel5 /proc/sys/net/ipv4/netfilter/ip_conntrack_tcp_be_liberal rhel6: /proc/sys/net/netfilter/nf_conntrack_tcp_be_liberal