This file contains hidden or 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
c = ConfigObj("socuppet.conf") | |
p = PluginManager() | |
f = BotFactory(c, p) | |
if "servers" in c: | |
for name, server in c['servers'].iteritems(): | |
botService = internet.TCPClient(server["host"], 6667, f) | |
botService.startService() | |
reactor.addSystemEventTrigger('before', 'shutdown', botService.stopService) |
This file contains hidden or 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 collections import defaultdict | |
class Manager(object): | |
def __init__(self): | |
self.triggers = defaultdict(list) # event: [func, ] | |
def register(self, *events): | |
def register_for_event(func): | |
for event in events: | |
self.triggers[event.lower()].append(func) | |
return func |
This file contains hidden or 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.words.protocols import irc | |
from twisted.internet import protocol, reactor | |
import traceback | |
class Bot(irc.IRCClient): | |
nickname = "SocPuppet" | |
def try_except(self, func, *args): | |
try: | |
return func(*args) |
This file contains hidden or 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.application import internet, service | |
from twisted.words.protocols import irc | |
from twisted.internet import protocol | |
class Bot(irc.IRCClient): | |
nickname = "SocPuppet" | |
def connectionMade(self): | |
irc.IRCClient.connectionMade(self) | |
print "Connected" |
This file contains hidden or 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 import server, resource | |
from twisted.internet import reactor | |
class Simple(resource.Resource): | |
isLeaf = True | |
def render_GET(self, request): | |
return "html" | |
def render_POST(self, request): | |
print request |
This file contains hidden or 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
<EntityReborn|> SocPuppet: reloadplugins | |
<SocPuppet> Ok! | |
<EntityReborn|> SocPuppet: commit_check | |
<EntityReborn|> SocPuppet: commit_last | |
<SocPuppet> http://github.com/EntityReborn/SocPuppet/commit/0ed8de946ab353512a5de423a639d3b722efb089: Added commit plugin. | |
<EntityReborn|> and, I'm gunna push a commit right now. | |
<SocPuppet> http://github.com/EntityReborn/SocPuppet/commit/8b5cbd53b188492c4d7b750793be9ae837799392: Refined several things |
This file contains hidden or 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
... other html | |
<div style="width:25%;float:left"> | |
<a href="a/" class="ls1">a</a> | |
<a href="s/" class="ls3">s</a> | |
<a href="d/" class="ls4">d</a> | |
<a href="f/" class="ls1">f</a> | |
</div> | |
... other html | |
<div style="width:25%;float:left"> |
This file contains hidden or 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, os | |
import urllib2 | |
baseurl = "http://hof.voyeurweb.com/gallery/" | |
nexturlre = re.compile(r'Overview Page</a> \| <a href="([^"]*)">') | |
imgurlre = re.compile(r'<img src="([^"]*)" alt="([^"]*)" border="0" />') | |
def downloadNext(url, cat): | |
print "==================\nOpening %s"%url | |
f = urllib2.urlopen(url) |
This file contains hidden or 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 save_page(request, page_name): | |
content = request.POST["content"] | |
try: | |
page = Page.objects.get(pk=page_name) | |
page.content = content | |
if "tags" in request.POST: | |
tags = request.POST['tags'].split() | |
taglist = [Tag.objects.get_or_create(name=tag)[0] for tag in tags] |
This file contains hidden or 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 django import template | |
from socialites.wiki.models import Page | |
import re | |
wikilink = re.compile(r"\[\[([^\]]+)\]\]") | |
register = template.Library() | |
@register.filter | |
def wikify(value): | |
for match in wikilink.finditer(value): |