Skip to content

Instantly share code, notes, and snippets.

[notice] 2021-09-15T15:51:36.748239Z node1@127.0.0.1 <0.1433.0> ebbea2aab1 FOO1 [{total,6},{offset,4}]
{"rows":[]}
[notice] 2021-09-15T15:51:36.748278Z node1@127.0.0.1 <0.1433.0> ebbea2aab1 FOO2 {view_row,<<"foo">>,<<"doc2">>,null,undefined,undefined}
---
[notice] 2021-09-15T15:54:36.287647Z node1@127.0.0.1 <0.1489.0> cdb108a194 FOO1 [{total,6},{offset,4}]
[notice] 2021-09-15T15:54:36.287664Z node1@127.0.0.1 <0.1489.0> cdb108a194 FOO5 complete
[notice] 2021-09-15T15:54:36.287672Z node1@127.0.0.1 <0.1489.0> cdb108a194 FOO1 [{total,6},{offset,4}]
{"total_rows":12,"offset":8,"rows":[
@rnewson
rnewson / README
Last active December 31, 2020 00:39
Strava
Python script to insert missing trackpoints while paused
From https://support.strava.com/hc/en-us/articles/216919277-Auto-Pause:
"We will do server-side resting time calculations (per above)unless
there are manual pause events. If there are manual pause events, we
assume that you want to control the time and will calculate moving
time with respect to timer time instead."
This script detects these gaps and inserts trackpoints representing
% Licensed under the Apache License, Version 2.0 (the "License"); you may not
% use this file except in compliance with the License. You may obtain a copy of
% the License at
%
% http://www.apache.org/licenses/LICENSE-2.0
%
% Unless required by applicable law or agreed to in writing, software
% distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
% WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
% License for the specific language governing permissions and limitations under
@rnewson
rnewson / ebtree.erl
Created July 24, 2020 16:03
ebtree.erl with improved collation wrapper
% Licensed under the Apache License, Version 2.0 (the "License"); you may not
% use this file except in compliance with the License. You may obtain a copy of
% the License at
%
% http://www.apache.org/licenses/LICENSE-2.0
%
% Unless required by applicable law or agreed to in writing, software
% distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
% WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
% License for the specific language governing permissions and limitations under
{
"views": {
"foo": {
"map":"function(doc) { ... }",
"reduce":"function(keys,values,rereduce) { ... }"
},
"bar": {
"map":"function(doc) { ... }",
"reduce":"function(keys,values,rereduce) { ... }"
}
➜ ~ curl -gi 'http://foo:bar@localhost:15984/db1/_design/personen/_view/actief?keys=["10002","10003"]'
HTTP/1.1 200 OK
Cache-Control: must-revalidate
Content-Type: application/json
Date: Tue, 27 Aug 2019 10:53:16 GMT
Server: CouchDB/2.3.1-dirty (Erlang OTP/22)
Transfer-Encoding: chunked
X-Couch-Request-ID: 447c12072b
X-CouchDB-Body-Time: 0
keyword -> org.apache.lucene.analysis.core.KeywordAnalyzer
simple -> org.apache.lucene.analysis.core.SimpleAnalyzer
whitespace -> org.apache.lucene.analysis.core.WhitespaceAnalyzer
arabic -> org.apache.lucene.analysis.ar.ArabicAnalyzer
bulgarian -> org.apache.lucene.analysis.bg.BulgarianAnalyzer
brazilian -> org.apache.lucene.analysis.br.BrazilianAnalyzer
catalan -> org.apache.lucene.analysis.ca.CatalanAnalyzer
cjk -> org.apache.lucene.analysis.cjk.CJKAnalyzer
chinese -> org.apache.lucene.analysis.cn.smart.SmartChineseAnalyzer
czech -> org.apache.lucene.analysis.cz.CzechAnalyzer
@rnewson
rnewson / chttpd_sup.erl.diff
Created October 15, 2018 19:58
change cloudant auth caching
diff --git a/src/chttpd/src/chttpd_sup.erl b/src/chttpd/src/chttpd_sup.erl
index fe84b67eb..afdcbcb8d 100644
--- a/src/chttpd/src/chttpd_sup.erl
+++ b/src/chttpd/src/chttpd_sup.erl
@@ -80,20 +80,20 @@ maybe_replace(Key, Value, Settings) ->
end.
lru_opts() ->
- case config:get("chttpd_auth_cache", "max_objects") of
- MxObjs when is_integer(MxObjs), MxObjs > 0 ->
exec chpst -u dbcore \
java \
-server \
-Xmx6G \
-Dsun.net.inetaddr.ttl=30 \
-Dsun.net.inetaddr.negative.ttl=30 \
-Dlog4j.configuration=file:/opt/clouseau/etc/log4j.properties \
-cp /opt/clouseau/etc:/opt/clouseau/lib/* \
com.cloudant.clouseau.Main \
/opt/clouseau/etc/clouseau.ini
#!/bin/sh
curl -X PUT http://localhost:5984/_users/org.couchdb.user:rnewson -d '{"name":"rnewson", "roles":[], "type":"user", "password":"orange"}'