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 urllib, json | |
class SABnzbd(object): | |
""" | |
Usage: | |
>>> from sabnzbd import SABnzbd | |
>>> s = SABnzbd('sakar.local', 8080, '4488f2881b90d7753bef8fb9e1bc56b3') | |
>>> s.pause() # Pauses the downloads | |
>>> s.shutdown() # Shut's down SABnzbd+ | |
""" |
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
#include <main.h> | |
#include <Modules.h> | |
#include <Chan.h> | |
class CRussianRoulette_Mod : public CModule { | |
public: | |
MODCONSTRUCTOR(CRussianRoulette_Mod) {} | |
virtual ~CRussianRoulette_Mod() {} | |
EModRet OnChanMsg(CNick& Nick, CChan& Channel, CString& sMessage) { |
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
<?xml version='1.0'?> | |
<!DOCTYPE service_bundle SYSTEM '/usr/share/lib/xml/dtd/service_bundle.dtd.1'> | |
<service_bundle type='manifest' name='znc'> | |
<service | |
name='network/irc' | |
type='service' | |
version='1' > | |
<instance name='znc' enabled='false'> |
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 random import randint | |
from django.http import HttpResponse | |
class HTCPCPMiddleware(object): | |
""" | |
This middleware allows a your django project to act as a HTCPCP (Hyper | |
Text Coffee Pot Control Protocol) server. If the user requests to BREW | |
a coffee, and it is not on the list. Then it will get a `406 Not | |
Acceptable`, and randomly it will respond with `418 I'm a teapot`. | |
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
""" | |
The idea of this was to strip responses of any unnecessary | |
characters to save bandwidth, after some testing the savings | |
were only up-to 8% on rare occasion. | |
""" | |
import re | |
re_is_html = re.compile(r'(*)</html>(*)') |
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 urllib2 | |
import re | |
from time import sleep | |
class PageScraper(object): | |
""" | |
This class scrapes a url for a string, can be used with a loop. | |
""" | |
def __init__(self, url, string=''): |
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
tell application "Skype" | |
if (send command "GET MUTE" script name "MuteToggler") is equal to "MUTE ON" then | |
send command "SET MUTE OFF" script name "MuteToggler" | |
else | |
send command "SET MUTE ON" script name "MuteToggler" | |
end if | |
end tell |
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 python2.4 | |
import sys, os | |
from fcgi import WSGIServer | |
if __name__ == '__main__': | |
sys.path += ['/home/kylef/python'] | |
os.environ['DJANGO_SETTINGS_MODULE'] = 'kylef.settings' | |
from django.core.handlers.wsgi import WSGIHandler | |
WSGIServer(WSGIHandler()).run() |
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
/* A key/value dict system in C */ | |
#include <stdio.h> | |
#include <stdlib.h> | |
#include <string.h> | |
#define TEST TRUE /* Comment this line out to compile without a main function (used when including into another application). */ | |
typedef struct dict_t_struct { | |
char *key; | |
void *value; |
NewerOlder