Skip to content

Instantly share code, notes, and snippets.

import conf, world, sonicbotv3, thread, time, socket, shelve, simplejson, traceback, urllib, sys
class sonicbotd :
def onConnect(self, sock, address) :
self.sock = sock
self.buffer = ""
self.address = address[0]
self.status = {"connected":True}
print "Receiving from %s" % (self.address)
if self.address in ["127.1.0.1", "127.0.0.1"] : return self.startLoop()
def startLoop(self) :
(setq inferior-lisp-program "/opt/sbcl/bin/sbcl") ; your Lisp system
(add-to-list 'load-path "~/slime-2010-02-05") ; your SLIME directory
(require 'slime)
(slime-setup)
; SLIME 2010-02-25
CL-USER> (asdf-install:install :usocket)
Install where?
1) System-wide install:
System in /usr/local/lib/sbcl/site-systems/
Files in /usr/local/lib/sbcl/site/
2) Personal installation:
System in /home/westly/.sbcl/systems/
Files in /home/westly/.sbcl/site/
--> 0
CL-USER> (asdf-install:install :usocket)
Install where?
1) System-wide install:
System in /usr/local/lib/sbcl/site-systems/
Files in /usr/local/lib/sbcl/site/
2) Personal installation:
System in /home/westly/.sbcl/systems/
Files in /home/westly/.sbcl/site/
--> 2
Downloading 36834 bytes from http://common-lisp.net/project/usocket/releases/usocket-0.4.1.tar.gz ...
component "usocket" not found
[Condition of type ASDF:MISSING-COMPONENT]
Restarts:
0: [RETRY] Retry SLIME REPL evaluation request.
1: [ABORT] Return to sldb level 1.
2: [RETRY] Retry SLIME REPL evaluation request.
3: [ABORT] Return to SLIME's top level.
4: [TERMINATE-THREAD] Terminate this thread (#<THREAD "repl-thread" RUNNING {BDA10F9}>)
#Note that this is not an actual httpd, I just modified one of my existing scripts to work as an excho server
import socket
class sonichttpd :
def onConnect(self, sock, address) :
self.sock = sock
self.buffer = ""
self.address = address
self.status = {"connected":True}
self.startLoop()
def startLoop(self) :
#! /usr/bin/env python
import socket
import time
import string
import parse
import cmds
import opcmds
import IRCLISTS
import ccmds
import spanish
ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAw60ye9F3GCgqnala2Xb/eyIijr6Qn5L+1Kr4ePvhO5g2ttu0jPVj4TaoGmjE7dQoaZnJDjXgF9fZ6c32pQuL2o5RzQKgv5cuoVdV+HFsokz4YDwqFS5RfvTVVsSHP0V77EusvcDxjk6601t9AcoD/cGZ6Lxt2dmLkuQfxII4MEMSlumvMesRM9mC0QIK9EWfdrZFHxZSa+5TD+4vVSSXXf5lcCztMhC0TyqXrISDC/ckgW4kC1raM2RMIK/cDDfvvqta5FexvsAHaOewDA+ezlkBTKotps5/TNfnTuNdNKatN5MA78lxT7TxULE9wR6bxGV24fh0fehTiL0ftvAFYw== [email protected]
arguments = ["self", "info", "args"]
minlevel = 1
helpstring = "count <phrase>"
def main(connection, info, args) :
connection.ircsend(info["channel"], str(len(args[1:])))
westly@westly-laptop ~ $ perl sonicbotpp.pl
Sent nick and user
:brown.freenode.net NOTICE * :*** Looking up your hostname...
Buffer = :brown.freenode.net NOTICE * :*** Looking up your hostname...
ABCDE
:brown.freenode.net NOTICE * :*** Checking Ident
:brown.freenode.net NOTICE * :*** Checking Identng up your hostname...
ABCDE