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
#!/usr/bin/python | |
def even(list): | |
""" | |
Returns all even numbers in the given list | |
>>> even(range(10)) | |
[0, 2, 4, 6, 8] | |
""" | |
return filter(lambda x: x%2==0, 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
import libvirt | |
from lxml import etree | |
sort_disks = lambda d: next(d.iter("target")).get("dev") | |
def main(host, opts): | |
#Connect to some hypervisor. | |
conn=libvirt.open("qemu:///system") | |
#Iterate through all available domains. |
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 PowerShellVmsResource { | |
enum Method { GET, ADD }; | |
enum Detail { | |
DISKS("$_.getmemorystatistics(); $_.getcpustatistics(); "), | |
STATISTICS("$_.getdiskimages(); "); | |
public final String powershell; |
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
#!/usr/bin/python | |
import os | |
import hooking | |
domxml = hooking.read_domxml() | |
devs = domxml.getElementsByTagName('devices')[0] | |
for passthrough in os.environ.get('passthrough', '').split(';'): |
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
#!/usr/bin/env python | |
import sys | |
domains = sys.stdin.read().split() | |
domains = sorted(list(reversed(domain.split("."))) for domain in domains) | |
domains = [ ".".join(reversed(domain)) for domain in domains ] | |
print "\n".join(domains) |
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
#!/usr/bin/env python | |
from optparse import OptionParser | |
from sqlalchemy import create_engine, Column, Integer, String, DateTime | |
from sqlalchemy.ext.declarative import declarative_base | |
from sqlalchemy.orm.session import sessionmaker | |
from textwrap import dedent | |
from threading import Thread | |
import socket | |
import datetime | |
import logging |
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
[url "git://github.com/"] | |
insteadOf = "gh:" | |
[url "git@github.com:"] | |
pushInsteadOf = "gh:" |
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 vmware { | |
if ($::virtual == 'vmware') { | |
yumrepo {'vmware-tools': | |
name => 'VMware Tools', | |
baseurl => 'http://packages.vmware.com/tools/esx/5.0/rhel$releasever/$basearch', | |
enabled => 1, | |
gpgcheck => 1, | |
gpgkey => 'http://packages.vmware.com/tools/VMWARE-PACKAGING-GPG-KEY.pub', | |
exclude => 'vmware-tools-libraries-x', | |
} |
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
#define _GNU_SOURCE | |
#include <dirent.h> /* Defines DT_* constants */ | |
#include <fcntl.h> | |
#include <stdio.h> | |
#include <unistd.h> | |
#include <stdlib.h> | |
#include <sys/stat.h> | |
#include <sys/syscall.h> | |
#define handle_error(msg) \ |
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 proxy ( | |
$ipaddr, | |
$netmask, | |
$gateway, | |
$reverse_domain, | |
$ntpservers = ['nl.pool.ntp.org'], | |
$dhcp = true, | |
$dhcp_range = false, | |
$dns = true, | |
$puppetca = false, |