Skip to content

Instantly share code, notes, and snippets.

diff --git a/src/ioq.erl b/src/ioq.erl
index b2be7bf..b863a20 100644
--- a/src/ioq.erl
+++ b/src/ioq.erl
@@ -12,10 +12,14 @@
-module(ioq).
-behaviour(gen_server).
+-behaviour(config_listener).
Last login: Thu Aug 14 17:17:56 on ttys001
cur% ➜ ~ curl localhost:5984/db1 -XPUT
{"ok":true}
➜ ~ curl localhost:5984/db1/foo+bar -XPUT -d{}
{"ok":true,"id":"foo bar","rev":"1-967a00dff5e02add41819138abb3284d"}
➜ ~ curl localhost:5984/db1/foo%2bbar -XPUT -d{}
{"ok":true,"id":"foo+bar","rev":"1-967a00dff5e02add41819138abb3284d"}
➜ ~ curl localhost:5984/db1/foo%2bbar
{"_id":"foo+bar","_rev":"1-967a00dff5e02add41819138abb3284d"}
➜ ~ curl localhost:5984/db1/_changes
[url "https://github.com/"]
insteadOf = "git://github.com/"
pushInsteadOf = "git://github.com/"
[url "https://github.com/"]
insteadOf = "git@github.com:"
pushInsteadOf = "git@github.com:"
12:37 <Baz___> Specifically, I have ratings ({ accountID, itemID, rating }) and am trying to find out how many times pairs of users rated the same items: [{ accountID1, accountID2, numTimesRatedSameItem }]
map:
emit([doc.itemID, doc.accountID]);
reduce:
var permute = function(arr) {
// return an array of every pair of values in arr,
@rnewson
rnewson / Dockerfile
Created August 20, 2014 13:53
Run CouchDB tests inside Docker
FROM ubuntu:12.04
MAINTAINER Robert Newson <rnewson@apache.org>
ENV DEBIAN_FRONTEND noninteractive
RUN apt-get -qq update
RUN apt-get -y install erlang-nox build-essential libmozjs185-dev libicu-dev
RUN useradd -m couchdb
USER couchdb
WORKDIR /home/couchdb
#!/bin/sh
DISTROS="ubuntu:10.04 ubuntu:12.04 ubuntu:12.10 ubuntu:13.04 ubuntu:13.10 ubuntu:14.04 debian:squeeze debian:wheezy debian:jessie"
function test() {
echo "Testing $1"
cat > Dockerfile <<EOF
FROM $1
MAINTAINER Robert Newson <rnewson@apache.org>
ENV DEBIAN_FRONTEND noninteractive
➜ ~ curl localhost:5984/db1 -XPUT
{"ok":true}
➜ ~ curl localhost:5984/db1/doc1 -XPUT -d{}
{"ok":true,"id":"doc1","rev":"1-967a00dff5e02add41819138abb3284d"}
➜ ~ curl 'localhost:5984/db1/doc1?rev=1-967a00dff5e02add41819138abb3284d' -XDELETE
{"ok":true,"id":"doc1","rev":"2-eec205a9d413992850a6e32678485900"}
➜ ~ curl localhost:5984/db1/doc1 -XPUT -d '{"foo":1}'
➜ ~ curl localhost:5984/db1/doc1 -XPUT -d {}
{"ok":true,"id":"doc1","rev":"1-967a00dff5e02add41819138abb3284d"}
➜ ~ curl 'localhost:5984/db1/doc1?rev=1-967a00dff5e02add41819138abb3284d' -X DELETE
{"ok":true,"id":"doc1","rev":"2-eec205a9d413992850a6e32678485900"}
➜ ~ curl localhost:5984/db1/doc1 -XPUT -d {}
{"ok":true,"id":"doc1","rev":"3-bc27b6930ca514527d8954c7c43e6a09"}
➜ ~ curl localhost:5984/db1/doc1
#!/usr/bin/env python
import json
import requests
if __name__ == '__main__':
s = requests.Session()
s.put("http://localhost:5984/db1")
for i in range(1, 1000):
s.put("http://localhost:5984/db1/doc-%d" % i, data = '{"foo":"bar"}')
#!/usr/bin/env python
import json
import requests
if __name__ == '__main__':
s = requests.Session()
s.put("http://localhost:5984/db1")
docs = []
for i in range(1, 1000):