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 twisted.web.iweb import IBodyProducer | |
from twisted.internet import defer | |
from twisted.web.client import Agent | |
from twisted.web.http_headers import Headers | |
import urllib | |
class StringProducer(object): | |
implements(IBodyProducer) | |
def __init__(self, body): |
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 re | |
import time | |
from twisted.internet import reactor | |
from twisted.internet import protocol | |
from twisted.internet import defer | |
class MuninClientProtocol(protocol.Protocol): | |
def __init__(self, out_channel, server): |
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 serialize(func): | |
""" | |
Decorator to make operations which modify state in the cluster happen one | |
at a time | |
""" | |
def wrap(self, *a, **kw): | |
return self._do_operation(func, self, *a, **kw) | |
return wrap | |
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
victimsToPrune = [] | |
while len(victimsToPrune) < 10 and suggestedDeletions: | |
victimsToPrune.append(suggestedDeletions.pop()) | |
for victim in victimsToPrune: | |
d.addCallback(lambda ign: debug(victim, msg='start')) | |
d.addCallback(lambda ign: | |
self._snapshotManipulator.prune(victim.key, local_forest)) |
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
#!/bin/sh | |
# $Id: zfsinstall 102 2011-03-01 23:22:04Z mm $ | |
# | |
# mfsBSD ZFS install script | |
# Copyright (c) 2011 Martin Matuska <mm at FreeBSD.org> | |
# | |
FS_LIST="var tmp" | |
usage() { | |
echo "Usage: $0 [-h] -d geom_provider [-d geom_provider ...] -t archive_file [-r mirror|raidz] [-m mount_point] [-p zfs_pool_name] [-V zfs_pool_version] [-s swap_partition_size] [-z zfs_partition_size] [-c] [-l] [-4]" |
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
__pyx_t_1 = PyObject_GetAttr(__pyx_v_blob, __pyx_n_s__split); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 16; __pyx_clineno = __LINE__; goto __pyx_L1_error;} | |
__Pyx_GOTREF(__pyx_t_1); | |
__pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_k_tuple_1), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 16; __pyx_clineno = __LINE__; goto __pyx_L1_error;} | |
__Pyx_GOTREF(__pyx_t_2); | |
__Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; | |
if ((likely(PyTuple_CheckExact(__pyx_t_2))) || (PyList_CheckExact(__pyx_t_2))) { | |
PyObject* sequence = __pyx_t_2; | |
if (likely(PyTuple_CheckExact(sequence))) { | |
if (unlikely(PyTuple_GET_SIZE(sequence) != 5)) { | |
if (PyTuple_GET_SIZE(sequence) > 5) __Pyx_RaiseTooManyValuesError(5); |
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
# Released under BSD 2-clause license by Luke Marsden | |
from twisted.internet import reactor | |
from twisted.application import service | |
from twisted.python import log | |
import spread | |
import zlib | |
def hex2ip(sender): |
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
f = file(..) | |
nextChunk = True | |
def work(): | |
while nextChunk is not None: | |
nextChunk = f.read(1024) | |
for thing in things: | |
thing.protocol.write(nextChunk) | |
yield | |
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
pid = os.fork() | |
if pid != 0: | |
# Make the original process the master | |
masterService = StreamServerEndpointService( | |
TCP4ServerEndpoint(reactor, 9881), | |
pb.PBServerFactory(AwesomeProxyMaster())) | |
masterService.setServiceParent(application) | |
# Name the master nicely (avoid backward compatibility with restarts/upgrades) | |
HybridUtils.setproctitle('AwesomeProxy') |
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 re, sys | |
try: | |
filename, countLimit = sys.argv | |
except: | |
print "Usage: %s FILE" % (sys.argv[0],) | |
def main(): | |
""" |
OlderNewer