Skip to content

Instantly share code, notes, and snippets.

@tareqabedrabbo
tareqabedrabbo / 1
Last active December 17, 2015 16:38
Neo4j optimistic locking
create n:Person {name: "Bob", updated: timestamp()}
return n
@tareqabedrabbo
tareqabedrabbo / create
Created May 1, 2013 23:47
Neo4j Labels and Schema Indexes
match p:Person, l:Location
where p.first_name! = {first_name} and l.location = {location}
create p-[:LIVES_IN]->l
@tareqabedrabbo
tareqabedrabbo / rabbit.js
Created February 20, 2012 17:35
Connects to RabbitMQ's log exchange and logs all received messages to the console
var connection = require('amqp').createConnection({host: 'localhost'});
connection.on('ready', function() {
// create a temporary queue by passing an empty string as the queue name
var queue = connection.queue('', function(queue) {
console.log('connected to ' + queue.name);
// bind the queue to all messages on the amq.rabbitmq.log topic exchange
queue.bind('amq.rabbitmq.log', '#');
@tareqabedrabbo
tareqabedrabbo / Pipelined SET.java
Created May 3, 2011 20:59
Redis Pipelines and Transactions
Pipeline pipeline = jedis.pipelined();
long start = System.currentTimeMillis();
for (int i = 0; i < 100000; i++) {
pipeline.set("" + i, "" + i);
}
List<Object> results = pipeline.execute();
long end = System.currentTimeMillis();
System.out.println("Pipelined SET: " + ((end - start)/1000.0) + " seconds");