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
<?php | |
class DATABASE_CONFIG { | |
public $dev = array( | |
'datasource' => 'Database/Mysql', | |
'persistent' => false, | |
'host' => 'localhost', | |
'login' => 'cake', | |
'password' => 'cakephp', | |
'database' => 'cake_noteven', |
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 sys | |
import gevent | |
from gevent import socket, event | |
if __name__ == "__main__": | |
s = socket.fromfd(sys.stdin.fileno(), socket.AF_UNIX, | |
socket.SOCK_STREAM) | |
print type(s) | |
e = event.Event() | |
def rea(sock, ee): |
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 sys | |
import gevent | |
from gevent import socket, event | |
if __name__ == "__main__": | |
e = event.Event() | |
def rea(ee): | |
while True: | |
while not ee.is_set(): | |
socket.wait_read(sys.stdin.fileno()) |
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 sys | |
import os | |
import fcntl | |
import gevent | |
from gevent import socket, queue | |
if __name__ == "__main__": | |
fcntl.fcntl(sys.stdin, fcntl.F_SETFL, os.O_NONBLOCK) | |
q = queue.Queue() | |
def rea(): |
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 gevent | |
class Publisher(object): | |
def __init__(self): | |
self.channels = [] | |
self.subscribers = [] | |
self.subscriptions = {} | |
self.publications = {} |
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 gevent | |
class Publisher(object): | |
def __init__(self): | |
self.channels = set() | |
self.subscribers = set() | |
self.subscriptions = {} | |
self.publications = {} |
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 gevent | |
class Publisher(object): | |
def __init__(self, initial_channels = []): | |
self.channels = set() | |
self.subscribers = set() | |
self.subscriptions = {} | |
self.publications = {} | |
for channel in initial_channels: |
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 from_msg(msg): | |
new = Msg() | |
new.decode(msg) | |
return new |
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
class Msg(object): | |
""" Represents an IRC message to be sent or decoded """ | |
def __init__(self, prefix='', cmd='', params=[]): | |
self.prefix = prefix | |
self.cmd = cmd | |
self.params = [params] if (type(params) != list) else params | |
@classmethod | |
def from_msg(cls, msg): |
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 __future__ import print_function | |
import gevent | |
# synchronous | |
def f1(): | |
for i in xrange(10): | |
print('f1', i) | |
def f2(): |