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
~ ⚡ node /tmp/readself.js
length=214
// start of file readself.js
sys=require("sys");
fs=require("fs");
contents=fs.readFileSync(__filename, encoding="utf8"); // ö日本語
sys.puts("length="+contents.length);
sys.puts(contents);
// end of file readself.js
$ ./test.js -v
DEBUG: [CONNECTED]
[INFO] Testing AUTH
=========================================
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: This test does not do anything
subs = {}, conns = 0;
require('net').createServer(function (sock) {
sock.setEncoding('utf8');
sock.subs = {};
sock.id = conns++;
var buf = '';
sock.addListener('data', function (chunk) {
buf += chunk;
var match;
while (match = buf.match(/^(.*)\r\n/)) {
~/projects/node-red(master) ⚡ ack throw
bin/nodered
64- redisClients[0].hset('nr:nodes:' + NODE_NAME, 'version', NODERED_VERSION,
65: throwOnRedisError);
66-
--
68- redisClients[0].hset('nr:nodes:' + NODE_NAME, 'upSince', now,
69: throwOnRedisError);
70-
71- redisClients[0].hset('nr:nodes:' + NODE_NAME, 'clientCount', '0',
~/projects/node-red(master) ⚡ ./bin/start
OK
(integer) 1
DEBUG: NodeRed version 0.0.7
DEBUG: [CONTROLLER] loading transport: tcp
DEBUG: [CONTROLLER] transport tcp: {"name":"tcp","version":"0.0.1"}
DEBUG: [DISPATCH] loading request handlers
DEBUG: [DISPATCH] handler group 'builtin' supports request WHO
DEBUG: [DISPATCH] handler group 'builtin' supports request INFO
DEBUG: [DISPATCH] handler group 'builtin' supports request SUBSCRIBE
DEBUG: [TCP] listening 127.0.0.1:8080
DEBUG: [TCP] client connection from 127.0.0.1
IOWatcher.callback (net:329:16)
node.js:814:9
We couldn’t find that file to show.
bytes written to buffer: 12
AssertionError: "\u00f6\u65e5\u672c\u8a9e" == "\u00f6\u65e5\u672c\u8a9e\u0000"
at Object.<anonymous> (/tmp/utf8slice.js:10:8)
at Module._compile (node.js:704:23)
at node.js:732:20
at fs:51:23
at node.js:813:9
function testSETANDGETMULTIBYTE() {
var testValue = '\u00F6\u65E5\u672C\u8A9E'; // ö日本語
var buffer = new Buffer(32);
var size = buffer.utf8Write(testValue);
client.set('testUtf8Key', buffer.slice(0,size), expectOK("testSETANDGETMULTIBYTE"))
client.get('testUtf8Key', function (err, value) {
if (err) assert.fail(err, "testSETANDGETMULTIBYTE");
sys.debug("size="+size+"; value.length="+value.length+"; testValue.length="+testValue.length);
checkEqual(value.utf8Slice(0, value.length), testValue, "testSETANDGETMULTIBYTE");
// This is a fully interruptable, binary-safe Redis reply parser for Node.js.
// TODO remove debugging statements
var sys = require('sys');
var Buffer = require('buffer').Buffer;
var PLUS = exports.PLUS = 0x2B; // +
var MINUS = exports.MINUS = 0x2D; // -
var DOLLAR = exports.DOLLAR = 0x24; // $
var STAR = exports.STAR = 0x2A; // *