Skip to content

Instantly share code, notes, and snippets.

# Author: Pieter Noordhuis
# Description: Sample script to write a Redis feed to an append-only file
#
# Requires the eventmachine gem.
# Warning: don't use this unless you know what you're doing!
#
require 'eventmachine'
require 'stringio'
diff --git a/redis.c b/redis.c
index 3e7a17d..a2811e8 100644
--- a/redis.c
+++ b/redis.c
@@ -35,6 +35,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
+#include <stdint.h>
#include <time.h>
test "LTRIM hard stressing" {
set mylist {}
for {set i 0} {$i < 32} {incr i} {
set str [randstring 8 16 alpha]
r rpush mylist $str
lappend mylist $str
}
set startlen [r llen mylist]
for {set i 0} {$i < 2000} {incr i} {
# Author: Pieter Noordhuis
# Description: Bot designed to pipe CI build status to IRC, but
# can be used for anything.
#
# Inspiration from: http://github.com/purzelrakete/mini
#
require 'eventmachine'
require 'active_support'
require 'ostruct'
#!/usr/bin/env ruby
# Script to remove commands from an AOF. Writes trimmed down AOF
# to standard out. Progress report is written to standard error.
#
# Usage: redis-trim-aof.rb <appendonly.aof> [regexp ...]
# Example: redis-trim.aof.rb myaof.aof ^user:\\d+ > newaof.aof
#
# Note: make sure to provide enough escape characters for special
# characters inside the regexp (because a regular shell also does
# escaping of characters).
# Infinity arithmetic in C
-50.0 + -50.0 = -100.0
-50.0 * -50.0 = 2500.0
-50.0 + 0.0 = -50.0
-50.0 * 0.0 = -0.0
-50.0 + 50.0 = 0.0
-50.0 * 50.0 = -2500.0
-50.0 + inf = inf
-50.0 * inf = -inf

http://github.com/pietern/redis/compare/master...networking-perf

master

LPUSH (again, in order to bench LRANGE): 53995.68 requests per second
LRANGE (first 100 elements): 8278.83 requests per second
LRANGE (first 300 elements): 2813.57 requests per second
LRANGE (first 450 elements): 1967.73 requests per second
LRANGE (first 600 elements): 1406.27 requests per second
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <hiredis/libevent.h>
void getCallback(redisContext *c, redisReply *reply, const void *privdata) {
printf("argv[%s]: %s\n", (const char*)privdata, reply->reply);
/* Disconnect after receiving the reply to GET */
redisDisconnect(c);
var spawn = require('child_process').spawn;
var leaks = spawn("leaks", [process.pid]);
leaks.stdout.on("data", function(data) {
console.log(data.toString());
});
@pietern
pietern / example.js
Created December 30, 2010 10:58 — forked from mranney/example.js
var client = require("redis").createClient(),
util = require("util");
client.set("some key", "A value with Unicode: ☕");
client.get("some key", function (err, reply) {
// a wise user also checks for errors
console.log("Reply: " + reply);
client.quit(function(err, reply) {
console.log("Quit: " + reply);