Skip to content

Instantly share code, notes, and snippets.

from inspect import getmembers, ismethod
import logging
from twisted.application import internet
from twisted.web import resource, server
from twisted.internet import reactor
class Base(object):
def __init__(self, manager):
self.manager = manager
self.log = logging.getLogger("plugin")
from socbot.pluginbase import Base
from twisted.application import internet
from twisted.web import resource, server
class Plugin(Base):
class Simple(resource.Resource):
isLeaf = True
def render_GET(self, request):
line = "<html><head><title>Ohai2</title></head><body>Hello, world 2!</body></html>"
self.log.info(line)
from socbot.pluginbase import Base
from twisted.application import internet
from twisted.web import resource, server
class Plugin(Base):
class Simple(resource.Resource):
isLeaf = True
def render_GET(self, request):
line = "<html><head><title>Ohai2</title></head><body>Hello, world 2!</body></html>"
self.log.info(line)
from socbot.pluginbase import Base
from twisted.application import internet
from twisted.web import resource, server
class Plugin(Base):
class Simple(resource.Resource):
isLeaf = True
def render_GET(self, request):
line = "<html><head><title>Ohai2</title></head><body>Hello, world 2!</body></html>"
self.log.info(line)
from socbot.pluginbase import Base
from twisted.application import internet
from twisted.web import resource, server
class Plugin(Base):
class Simple(resource.Resource):
isLeaf = True
def render_GET(self, request):
line = "<html><head><title>Ohai2</title></head><body>Hello, world 2!</body></html>"
self.log.info(line)
from socbot.pluginbase import Base
from twisted.application import internet
from twisted.web import resource, server
class Simple(resource.Resource):
isLeaf = True
def render_GET(self, request):
return "<html><head><title>Ohai2</title></head><body>Hello, world 2!</body></html>"
from socbot.pluginbase import Base
from twisted.application import internet, service
from twisted.web import resource, server
class Simple(resource.Resource):
isLeaf = True
def render_GET(self, request):
return "<html>Hello, world!</html>"
class Manager(object):
def __init__(self):
self.funcs = {}
def regTrigger(self, func, trig):
trig = trig.lower()
if not trig in self.funcs:
self.funcs[trig] = []
self.funcs[trig].append(func)
import time
numchars = 41
wait = 0.25
x = "."
o = " "
def wave(x, o):
for num in xrange(1, numchars, 2):
time.sleep(wait)
# HACK-n-PATCH! Allow dotted syntax access.
def monkeypatch1(self, name):
if self.has_key(name):
return self[name]
super(ConfigObj, self).__getattr__(name)
ConfigObj.__getattr__ = monkeypatch1
def monkeypatch2(self, name):
if self.has_key(name):
return self[name]