This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
apres.getDataParamsFromElem = function(elem, paramKeys, prefix) { | |
var paramPrefix = prefix || "data-widget-"; | |
var params = {}; | |
for (var paramName in paramKeys) { | |
params[paramName] = elem.attr(paramPrefix + paramName); | |
} | |
return params; | |
} | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class s3-backups { | |
package { "duplicity": | |
ensure => "installed" | |
} | |
package { "python-boto": | |
ensure => "installed" | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class python27 { | |
Package { ensure => "installed" } | |
$apt-base = "/etc/apt/sources.list.d/fkrull-" | |
Exec { require => Package["python-software-properties"] } | |
exec { "python-repo" : | |
command => "/usr/bin/add-apt-repository ppa:fkrull/deadsnakes", | |
creates => "${apt-base}deadsnakes-lucid.list", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class mongodb { | |
$add-key = "/usr/bin/apt-key adv --keyserver keyserver.ubuntu.com --recv 7F0CEB10" | |
$mongodb-repo = "deb http://downloads-distro.mongodb.org/repo/ubuntu-upstart dist 10gen" | |
Exec { require => Package["python-software-properties"] } | |
exec { "add-10gen-key": | |
command => $add-key, | |
onlyif => "/usr/bin/apt-key list | /usr/bin/awk '$0 ~ /10gen/ { exit 1 }' /etc/apt/sources.list" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class nodejs { | |
Package { ensure => "installed" } | |
$pkglist = [ "python-software-properties" ] | |
package { $pkglist: } | |
$apt-base = "/etc/sources.list.d/chris-lea" | |
Exec { require => package["python-software-properties"] } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(pyrenv)Niall-OHigginss-MacBook-Pro:pyrenv nialljohiggins$ paster create -t akhet | |
Selected and implied templates: | |
Akhet#akhet A Pylons-like Pyramid project | |
Enter project name: foobar | |
Variables: | |
egg: foobar | |
package: foobar | |
project: foobar | |
Enter sqlalchemy (Include SQLAlchemy configuration? (y/n)) [True]: n |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from ctypes import * | |
class NANNY_TIMER(Structure): | |
_fields_ = [("when", c_long), | |
("data", c_void_p), | |
("f", POINTER(NANNY_TIMER_CB)) | |
] | |
# XXX is there a way around this hack for circular definition? | |
class NANNY_TIMED_T(Structure): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def sub_get(d, key, default=0): | |
''' sub_get({ 'foo' : { 'bar' : 1 }}, 'foo.bar') returns 1 ''' | |
if '.' not in key: | |
return d.get(key, default) | |
parts = key.split('.') | |
r = d | |
for p in parts: | |
r = r.get(p, default) | |
return r |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
niallo@aztarac:~$ cat /etc/udev/rules.d/70-android.rules | |
SUBSYSTEM=="usb", ATTR{idVendor}=="18d1", SYMLINK+="android_adb", MODE="0666", OWNER="niallo", GROUP="niallo" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
_xml_escapes = (tuple([('%c' % z, '\\u%04X' % z) | |
for z in range(20) if z not in (0x9, 0xA, 0xD)])) | |
def escape_low_xml(value): | |
''' Escape every ASCII character with a value less than 20 except for | |
certain codes allowed by XML v1.0 spec ''' | |
for bad, good in _xml_escapes: | |
value = value.replace(bad, good) | |
return value |