Skip to content

Instantly share code, notes, and snippets.

@jan-matejka
jan-matejka / gist:3013380
Created June 28, 2012 19:34
cfe test case
#!/var/cfengine/bin/cf-agent -f
# vim: foldmethod=marker:foldmarker={,}
# is there a way to make subtest execute for each instance of t_ ?
# actual output:
# R: subtest rep: test: 1
# R: rep: test: 1
# R: rep: test: 2
# R: rep: test: 3
@jan-matejka
jan-matejka / gist:3017652
Created June 29, 2012 12:31
left-right comprehensions
>>> a = [['a', 'b'], ['c','d']]
>>> [["1_%s" % x for x in xs] for xs in a] # nested nested comprehension keeps the input nest
[['1_a', '1_b'], ['1_c', '1_d']]
>>> ["1_%s" % x for xs in a for x in xs] # flat nested comprehension flattens the input
['1_a', '1_b', '1_c', '1_d']
@jan-matejka
jan-matejka / gist:3025470
Created June 30, 2012 20:53
__method_argument
#! /usr/bin/env python
# -*- coding: utf-8 -*-
class A:
def __init__(self, __ke=None):
print __ke
class B:
def __init__(self, **kw):
print kw
@jan-matejka
jan-matejka / cement logging
Created July 11, 2012 05:32
well this is annoying
self.log.info("%s", "aaa")
TypeError: info() takes exactly 2 arguments (3 given)
├─(yac@sam) git:master
└──[2]─> wl --help
usage: wl <CMD> -opt1 --opt2=VAL [arg1] [arg2] ...
WorkLog entry point
positional arguments:
description
description
activity
body common control {
bundlesequence => {
base,
g,
};
inputs => {
"cfengine_stdlib.cf",
};
}
Actually, I don't know how You are using it and my comment is kinda ambiguous and I think I quite rewrote the code since I wrote the comment.
The name of checkbox refers to the attribute ng-model, not the name attribute.
The non-unique model names in makes the received value of the model quite unpredicatble after a few changes of inputs states in my code.
When using it with ng-change it causes the ng-change method NOT to fire sometimes.
I think the not-firing happens when i check an input, and then I check another input with the same model which makes the model to "change" from "checked" (from the first click) to "checked" (the second click) so there is no change and the ng-change doesnt fire.
The problem is it doesnt seem to be possible to create dynamicly named models inside the ng-repeat (as Sten Hougaard asks at http://docs.angularjs.org/api/ng.directive:ngRepeat)
@jan-matejka
jan-matejka / gist:3786159
Created September 26, 2012 04:54
default debian logrotate for mailman
/var/log/mailman/vette
/var/log/mailman/error
/var/log/mailman/bounce
/var/log/mailman/digest
/var/log/mailman/subscribe
/var/log/mailman/post
/var/log/mailman/qrunner
/var/log/mailman/fromusenet
/var/log/mailman/locks
/var/log/mailman/smtp
#
# This file is read by the thttpd init script.
#
#
# If you wish thttpd to start, globally, the change ENABLED to "yes"
#
ENABLED=no
bundle agent munin {
vars:
"plugins_src" string => "/usr/share/munin/plugins";
"plugins_dst" string => "/etc/munin/plugins";
"plugins_wc[postgres_tuples_]" slist => { "postgres_tuples_ALL" };
"plugins_wc_idx" slist => getindices("plugins_wc");
files: