Skip to content

Instantly share code, notes, and snippets.

@paulharter
paulharter / test_view_stale_false.py
Last active July 11, 2016 21:17
test showing inconsistent behaviour with view queries
import time
import subprocess
import unittest
import requests
import json
DB_HOST = "localhost"
SYNC_GATEWAY_PATH = "/usr/local/bin/sync_gateway"
SYNC_GATEWAY_VIEW_URL = "%s/_design/%s/_view/%s?stale=false&key=\"%s\""
@paulharter
paulharter / multiple-thicknesses.md
Last active March 8, 2016 14:47
Multiple real thickness filesets

Multiple real thicknesses

Situation

If we model a range of real thicknesses for each different material type, or even for each different sheet,we end up with quite a few CAD files.

We have to create a full set of CAD files for every possible combination of thicknesses. For 11 thicknesses and 2 different materials ths is 11^2 which is 121 sets of CAD files. If we never needed to model more than 2 different real thicknesses this might be manageable within a single fileset, but the options and choosing them is still harder to manage. If we go to 3 for even 4 thicknesses the quantity of filesets balloons 11^4 is 14,641.

The plan

Last login: Sat Feb 6 18:56:38 on ttys000
Pauls-MacBook-Pro :: ~ » couchdb
Apache CouchDB 1.6.1 (LogLevel=info) is starting.
Apache CouchDB has started. Time to relax.
[info] [<0.31.0>] Apache CouchDB has started on http://127.0.0.1:5984/
[info] [<0.110.0>] 127.0.0.1 - - GET /test 200
[info] [<0.114.0>] 127.0.0.1 - - DELETE /test 200
[error] [<0.166.0>] Could not open file /usr/local/var/lib/couchdb/test.couch: no such file or directory
[info] [<0.111.0>] 127.0.0.1 - - GET /test 404
[info] [<0.112.0>] 127.0.0.1 - - PUT /test 201
@paulharter
paulharter / test_views.py
Last active February 3, 2016 01:44
Failing test for sync gateway views
import unittest
import requests
import json
import time
DB_HOST = "192.168.99.100"
COUCHBASE_URL = "http://192.168.99.100:8091"
SYNC_GATEWAY_PATH = "sync_gateway"
SYNC_GATEWAY_VIEW_URL = "%s/_design/%s/_view/%s?stale=false&key=\"%s\""
@paulharter
paulharter / gist:ce78fa79ac2d6d384941
Created March 13, 2015 15:39
gateway_view_tests.py
import unittest
import time
import requests
import json
import uuid
SYNC_GATEWAY_HOST = "192.168.59.103"
SYNC_GATEWAY_PORT = "4984"
SYNC_GATEWAY_ADMIN_PORT = "4985"
@paulharter
paulharter / craftscript_utils.js
Created January 14, 2013 13:50
Some handy utility functions I came up with working with Minecraft craftscripts
/*
Some handy utility functions I came up with working with Minecraft craftscripts
*/
// exec
// performs a java exec by getting the java runtime by name
exec = function name(cmd){
var cRuntime = java.lang.Class.forName("java.lang.Runtime");
var mGetRuntime = cRuntime.getMethod("getRuntime");
@paulharter
paulharter / print.js
Created November 2, 2012 14:04
printcraft - this is the js craftscript code used for mc.printcraft.org - it writes out an OpenSCAD file
importPackage(Packages.com.sk89q.worldedit.blocks);
importPackage(Packages.com.sk89q.worldedit);
//joins up blocks in the dimension dim
function squash(blockarray, dim, arraysize){
var i = new Array();
var dims = new Array();
for (var y = 0; y <= arraysize*2; y++){