Skip to content

Instantly share code, notes, and snippets.

#!/usr/bin/env python
import dbus
import xchat
__module_name__ = 'xchat-rhythmbox'
__module_author__ = 'e'
__module_version__ = '0.1'
print "Connecting to RhythmBox dbus service."
bus = dbus.SessionBus()
#!/usr/bin/env python
import urllib
from BeautifulSoup import BeautifulSoup
from tornado.escape import xhtml_unescape
class MetroLyrics():
@staticmethod
def search(artist, title):
params = urllib.urlencode({'search': ' - '.join((artist, title)), 'category': 'artisttitle', 'submit': 'Search'})
from Core.ZalgoBase.BaseModule import BaseModule
from twisted.web.client import getPage
from twisted.internet.defer import DeferredLock, inlineCallbacks
from Core.ZalgoUtil.CmdWraps import command
class Module(BaseModule):
parseCommands = True
lock = DeferredLock()
pool = []
@e000
e000 / liblolwebassign.js
Created January 12, 2011 03:26
Well, because, LOL.
// libWebAssign LOL
function putHelp(solutionSet) {
title = solutionSet[0]
solutionSet = solutionSet[1] || {}
if($$('.bread').getNext()[0].innerHTML.replace(/^\s+/, '') != title) {
alert("Invalid Solution Set Loaded! I work for '" + title + "'")
}
@e000
e000 / cache.py
Created January 19, 2011 02:08
deferred_lfu_cache
import collections
import functools
from itertools import ifilterfalse
from heapq import nsmallest
from operator import itemgetter
from twisted.internet.defer import maybeDeferred, succeed, Deferred
class Counter(dict):
'Mapping where default values are zero'
def __missing__(self, key):
@e000
e000 / ud.py
Created January 20, 2011 04:07
ud module
from Core.ZalgoBase.BaseModule import BaseModule # I need this, it's the base module to extend off of.
from twisted.web.client import getPage # asynchronous page getter
from twisted.internet.defer import inlineCallbacks # write async code as synchronous code
from urllib import urlencode # escape url args
from Core.ZalgoUtil.ModUtil import xhtml_unescape as unescape, utf8 # turn xhtml elements into actual characters, convert utf8 to string to send to irc
from Core.ZalgoUtil.CmdWraps import stripColors, needsArg, timeout, command # convenicnce decorators
from Core.ZalgoUtil.DeferredCache import deferred_lfu_cache # cache the results from UD for a while.
import re
class Module(BaseModule):
@e000
e000 / gist:790588
Created January 21, 2011 22:49
youtube module
from twisted.internet.task import LoopingCall
from twisted.web.client import getPage
from twisted.internet.defer import DeferredLock, inlineCallbacks, returnValue
from Core.ZalgoUtil.CmdWraps import command, hook
from Core.ZalgoUtil.ModUtil import dateDiff, utf8
from Core.ZalgoBase.BaseModule import BaseModule
from Core.ZalgoUtil.DeferredCache import deferred_lfu_cache
from Core.ZalgoHooks import Hooks
from xml.etree.cElementTree import fromstring
import re
#!/usr/bin/env python
# ***** BEGIN LICENSE BLOCK *****
# Version: MPL 1.1/GPL 2.0
#
# The contents of this file are subject to the Mozilla Public License
# Version 1.1 (the "License"); you may not use this file except in
# compliance with the License. You may obtain a copy of the License at
# http://www.mozilla.org/MPL/
#
# Software distributed under the License is distributed on an "AS IS"
@e000
e000 / pyimage.py
Created January 23, 2011 06:09
ascii -> png
"""
Python IRC ASCII to image script by e ([email protected])
"""
import Image, ImageFont, ImageDraw
import time, re
_strip_colors_regex = re.compile('(\x03([0-9]{1,2})(,[0-9]{1,2})?)|[\x0f\x02\x1f\x03\x16]').sub
def strip_colors(string):
@e000
e000 / colors.conf
Created January 30, 2011 20:17
mirc colors for xchat
color_0 = ffff ffff ffff
color_1 = 0000 0000 0000
color_2 = 0000 0000 7f7f
color_3 = 2a3d 8ccc 2a3d
color_4 = ffff 0000 0000
color_5 = 7f7f 0000 0000
color_6 = 9c9c 0000 9c9c
color_7 = fcfc 7f7f 0000
color_8 = ffff ffff 0000
color_9 = 0000 fcfc 0000