Skip to content

Instantly share code, notes, and snippets.

#!/usr/bin/env escript
%% -*- erlang -*-
%%! -pa ./src/couchdb -sasl errlog_type error -boot start_sasl -noshell
%%
main(_) ->
code:add_pathz("src/couchdb"),
application:load(crypto),
crypto:start(),
etap:plan(unknown),
case (catch test()) of
diff --git a/.gitignore b/.gitignore
index ea1f975..70788fa 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,3 +1,5 @@
+
+# copied from jChirs .gitignore
*.beam
*.gz
*.tpl
#! /usr/bin/env python
# Based on the Notifier example from tutorial
# See: http://trac.dbzteam.org/pyinotify/wiki/Tutorial
import optparse as op
import Queue
import subprocess as sp
import time
@davisp
davisp / couch-node.ini
Created November 5, 2010 23:45
Configuring CouchDB (trunk) to have a node.js handler.
; Just drop this in /etc/couchdb/local.d/ and then
; start CouchDB normally.
; Here couch_node can be anything as long as it's uniq.
[os_daemons]
couch_node = /Users/davisp/tmp/couch-node.js
# Make will use environment variables and set variables that you
# specify on the command line. The example below, VAR1 is an enviornment
# variable and VAR2 is set from the command line.
#
# $ VAR1=foo make VAR2=bar
# foo
# bar
@davisp
davisp / webscale.c
Created May 3, 2011 20:03
Webscale writes!
#include <fcntl.h>
#include <stdio.h>
#include <string.h>
#include <sys/mman.h>
#include <sys/time.h>
#define SAMPLES 10000
int
main()
@davisp
davisp / convert.js
Created June 14, 2011 17:44
Lat/Lon to OS National Grid in JS via Python
/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
/* Convert latitude/longitude <=> OS National Grid Reference points (c) Chris Veness 2005-2010 */
/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
/*
* convert geodesic co-ordinates to OS grid reference
*/
function LatLongToOSGrid(p) {
var lat = p.lat.toRad(), lon = p.lon.toRad();
@davisp
davisp / couchdb.cli-test.md
Created August 12, 2011 15:36
Thoughts on a CouchDB CLI JS Test Environment

CouchDB CLI JS Test Environment

Some random thoughts on what a decent test environment would need for us to have some kick ass testing.

HTTP Interface

PreCommDict = dict:from_list(PreCommitFailures),
{_, _, Tr} = lists:foldl(fun(#doc{id=Id,revs={Pos, RevIds}},{RidRevs,RCommitResults,Acc}) ->
DocKey = {Id, {Pos, RevIds}},
case lists:keyfind(DocKey,1,RCommitResults) of
false ->
case dict:find(DocKey,PreCommDict) of
error ->
{_, GoodVal} = lists:keyfind(DocKey,1,RidRevs),
{lists:delete(DocKey,RidRevs), RCommitResults, [GoodVal | Acc]};
{ok, PCommFailVal} ->
#! /usr/bin/env python
import time
import uuid
import couchdbkit
s = couchdbkit.Server("http://127.0.0.1:15986")
ordered_doc_id = 0