Skip to content

Instantly share code, notes, and snippets.

cat << EOF >> ~/.mozilla/firefox/*.default/chrome/userContent.css
@-moz-document domain(mail.google.com)
{
/* GMail messages and textarea should use fixed-width font */
.gs .ii, textarea.dV {
font-family: MonoSpace !important;
font-size: 9pt !important;
}
}
EOF
ssh-rsa AAAAB3NzaC1yc2EAAAABIwAABAEAvexstwva4ZI7j98B3qDYgtiVvTL/CLcL4i2vhuVvQCMW7qcCEelcos48cHTbE/D3bpuIR9HIjnSUNc+9DkUNjR3LxSllvf2EbG4c9SL8Y4geiXecQnBOeldKV50gMyVAuGaICf6fQal+LOtuJPY7m3nv8311ZCgxnDiauwVZfgS/zk0TsXari6h/28T3548IHjpNaPRJ0qJSy75f8hEHH7Xi1ldwK5u8C5CxFhu41rp6zMQUSsshvrg0HYRp7/HLk91/txGZcMMStaE1JZHmeltX32EJKCpXH9XpD/cBS8ABOdyp1t9oxTXmL8QsV8QsrZ9jrAbEYgfez8vKLE/5+ReD4rbExr0GIDjge3r9SP2tTLx0Ii6ReEk09ZydAW0TEeR4Hj+yhVdAqX611gafgQO4IAenPdvjPPs75QwatKUSXsJNQa8woE5+/t6lno4njDX+DR0cGbJ9buVTfXSNwDfqPCB2VoDW0dd2e7bkKAf9Jp/hzSLx+8sl+UsC4nEZC8AP5eJKu068W3es+1qU8VJ0TXObWMgYvX0X6bO0taCGcdddFhm/1C40mgFWw+fkF6scWB/P3RUVfypePSwfn5VfT7P0mmL35k43s2weTd+xCHmXlllcGW39U6DOmmErzCXlCzXlxRCGw67uJSq50VXIoeFdw4XrrtrSS/fNUrHR9n3nKcODNShqf3l0Fl+M/tH+XocF/71sf/qfIFolSrVHRSTGwVQIoRKjOgGrCdhfli+WkhR20YVE3uGddCH7/ZMuAUq4d5jyKF2PawhiIrdYG4ZhSOwvQ258Dyhg8sNam1SQ+YbZaCoDpp6a5zPIrHGPXACI6XC8ZICqIHL1yOX1C6EfI6ZsaKA2hDc4hbDBRLmFnf24a/3y0Y32zd6H0e8j5WTXpMwjvF1ctqgNqO6SuSYTLkkgTRSgu/wTM19tgWLu0RI6nw1vjBL8IHV0OdQ/inn1WUoyDwqcaaG3PKvMYaR5
class UTCTimeAuditedModel(models.Model):
"""
Abastract model providing UTC time auditing.
Adds two fields `utc_created_at` set on first save of the instance, and
`utc_updated_at` updated on every item save to the current utc datetime
"""
utc_created_at = models.DateTimeField(editable=False, verbose_name=_(u"created at (utc)"))
utc_updated_at = models.DateTimeField(editable=False, verbose_name=_(u"updated at (utc)"))
In [19]: import xml.etree.ElementTree as ET
In [20]: x = u'<hello id="ŁðÆŊЧ"><world /></hello>'
In [21]: ET.tostring(ET.fromstring(x.encode('utf-8')), encoding='utf-8').decode('utf-8') == x
Out[21]: True
>>> def bar():
... bar.x = 3
...
>>>
>>> bar.x
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
AttributeError: 'function' object has no attribute 'x'
>>> bar()
>>> bar.x
(03:36:05 AM) vark:
You there? I have a question about *programming* that I think you might be able to answer.
(Type 'sure', 'pass', or 'busy'.)
(03:37:27 AM) k: sure
(03:37:28 AM) vark: (From Semyon S./25/M/St.Petersburg,Russia)
What is better git or svn?
(Type 'pass' to skip, 'flag' if this question is inappropriate, or 'more' for options.)
(03:39:55 AM) k: Semyon: Git is definitely better. Subversion proposal for version control is deprecated. I've written myself an article about some differences between Git and Subversion here: http://kspg.com.ar/blog/posts/8/
# cat /etc/puppet/puppet.conf
[main]
logdir=/var/log/puppet
vardir=/var/lib/puppet
ssldir=/var/lib/puppet/ssl
rundir=/var/run/puppet
factpath=$vardir/lib/facter
pluginsync=true
[puppetmasterd]
def utc_datetime_from_twitter_timestamp(s):
"""Parses as datetime.datetime in UTC a string formated Twitter timestamp"""
# we must parse the date in an english locale (due to %a and %b)
prev_loc = locale.getlocale()
try:
locale.setlocale(locale.LC_ALL, 'C')
return datetime.datetime.strptime(s, '%a %b %d %H:%M:%S +0000 %Y')
finally:
locale.setlocale(locale.LC_ALL, prev_loc)
>>> class A(object):
... @classmethod
... def magic(cls, fn):
... def _f(*args, **kwargs):
... print "Hello from", cls, "_f", args, kwargs
... return fn(*args, **kwargs)
... return _f
...
>>> class B(object):
... @A.magic
>>> bla = (i for i in 'hello!')
>>> for x in bla:
... print x
... _ = next(bla)
...
h
l
o
>>>