Skip to content

Instantly share code, notes, and snippets.

View horatio-sans-serif's full-sized avatar
😡

Old Yeller horatio-sans-serif

😡
View GitHub Profile
Buffer=require('buffer').Buffer;
b=new Buffer(1);
b[0] = 0xFF; // What does this call?
⚡ node test.js
The 'tcp' module is now called 'net'. Otherwise it should have a similar interface.
DEBUG:
DEBUG: Testing SETANDGETMULTIBYTE
DEBUG: =========================================
DEBUG: [SEND] *2<CRLF>$6<CRLF>SELECT<CRLF>$2<CRLF>14<CRLF>
DEBUG: [SEND] *1<CRLF>$7<CRLF>FLUSHDB<CRLF>
DEBUG: [SEND] *2<CRLF>$6<CRLF>SELECT<CRLF>$2<CRLF>15<CRLF>
DEBUG: [SEND] *1<CRLF>$7<CRLF>FLUSHDB<CRLF>
DEBUG: [SEND] *3<CRLF>$3<CRLF>SET<CRLF>$3<CRLF>uni<CRLF>$1<CRLF>ö<CRLF>
var qmarkRE = /\?/g;
var starRE = /\*/g;
var dotRE = /\./g;
sys=require('sys')
function fnmatch (pattern, test) {
var newPattern = pattern.replace(dotRE, '(\\.)')
.replace(qmarkRE, '(.)')
.replace(starRE, '(.*?)');
*4
$7
zincrby
$3
foo
$1
1
$1
a
$1
assert.AssertionError.prototype.toString = function() {
var desc = [ this.name+":"
, JSON.stringify(this.expected )
, this.operator
, JSON.stringify(this.actual)
].join(" ");
if (this.message) {
return [desc, "("+this.message+")"].join(' ');
} else {
return desc;
TypeError: Cannot call method 'set' of null
at doConnect (net:616:23)
at Stream.connect (net:670:30)
at Object.createConnection (net:379:5)
at Object.createClient (/Users/brian/projects/redis-node-client2/redis.js:20:25)
at Object.<anonymous> (/Users/brian/projects/redis-node-client2/example.js:2:32)
at Module._compile (node.js:704:23)
at node.js:732:20
at fs:51:23
at node.js:813:9
[16378] 08 Mar 20:45:15 # ======= Ooops! Redis 1.3.4 got signal: -11- =======
[16378] 08 Mar 20:45:15 # redis_version:1.3.4
arch_bits:32
multiplexing_api:epoll
process_id:16378
uptime_in_seconds:163
uptime_in_days:0
connected_clients:0
connected_slaves:0
blocked_clients:0
>>> import redis
>>> r=redis.Redis()
>>> r.hset('foo','bar',10)
HSET foo bar 2
10
SELECT 0
[16258] 08 Mar 20:26:15 # ======= Ooops! Redis 1.3.4 got signal: -11- =======
[16258] 08 Mar 20:26:15 # redis_version:1.3.4
# python 2.6 on linux 2.6.18
# from: http://scotdoyle.com/python-epoll-howto.html
import socket, select
EOL1 = b'\n\n'
EOL2 = b'\n\r\n'
response = b'HTTP/1.0 200 OK\r\nDate: Mon, 1 Jan 1996 01:01:01 GMT\r\n'
response += b'Content-Type: text/plain\r\nContent-Length: 13\r\n\r\n'
response += b'Hello, world!'
$ cat pongserver.py
from circuits.net.sockets import TCPServer
from circuits.net.pollers import EPoll
class PongServer(TCPServer):
def connect(self, sock, host, port):
self.write(sock, 'HTTP/1.0 200 OK\r\nContent-Length: 5\r\n\r\nPong!\r\n')
self.close(sock)