Skip to content

Instantly share code, notes, and snippets.

View madpink's full-sized avatar
💭
maudlin, yet gregarious

Gregory Miller madpink

💭
maudlin, yet gregarious
View GitHub Profile
@madpink
madpink / 0_reuse_code.js
Last active September 9, 2015 15:00
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
command sendThisMessage
-- For the record, this is not a real username/password for Amazon SES
put "smtps://email-smtp.us-east-1.amazonaws.com" into tURL
put "XBCGUEHJDSJADJJDJS" into tSettings["username"]
put "AIjQCX5qs9iiAk+xqcRsj7D4B/mwRuAEMfrE8oWLmKAJ" into tSettings["password"]
----put TRUE into tSettings["use_ssl"] --uncomment if needed
--Note that from_name is optional
put "Arthur Dent" into tHeaderData["from_name"]
put "[email protected]" into tHeaderData["from"]
@madpink
madpink / gist:e8db66cc4357bd76d6426cf12d976742
Created August 1, 2017 20:46
CouchDB 2.1.0 RC1 on Ubuntu
root@crazy:~/zzz/couchdb# make release
==> config (compile)
Compiled src/config_listener.erl
Compiled src/config_notifier.erl
Compiled src/config_util.erl
Compiled src/config_listener_mon.erl
Compiled src/config_app.erl
Compiled src/config_writer.erl
Compiled src/config_sup.erl
Compiled src/config.erl
This file has been truncated, but you can view the full file.
{"docs":[{"language":"javascript","_id":"_design\/phonelist","views":{"attempts":{"map":"function (doc) {\n if(doc.fnord.attempts < 2)\n emit(doc.sein.phone, doc.fnord.attempts);\n}"}}},{"views":{"phonesearch":{"reduce":"_count","options":{"def":{"fields":["sein.phone"]}},"map":{"fields":{"sein.phone":"asc"}}},"status":{"reduce":"_count","options":{"def":{"fields":["fnord.deadoralive"]}},"map":{"fields":{"fnord.deadoralive":"asc"}}},"attempts":{"reduce":"_count","options":{"def":{"fields":["fnord.attempts"]}},"map":{"fields":{"fnord.attempts":"asc"}}},"namesearch":{"reduce":"_count","options":{"def":{"fields":["sein.name"]}},"map":{"fields":{"sein.name":"asc"}}}},"_id":"_design\/searchkeys","language":"query"},{"fnord":{"notes":null,"attempts":5,"timetocall":1499733547,"finalstat":"RNA","lastintv":"Janiya_Franklin","timestamp":1499726347,"finalstatcode":507,"dp3":4,"deadoralive":"dead","quota":null,"queue":"q7","laststat":"RNA","laststatcode":507},"_id":"x1001","sein":{"phone":3145493006,"recid":"x1001","na
@madpink
madpink / gist:a48289e726f1f7b86ed947db2a62d6e8
Last active April 28, 2023 17:24
Install HAProxy, Certbot/Let's Encrypt for CouchDB
*-*-*-*-*-*-*-*-*-* Updated January 04, 2022 *-*-*-*-*-*-*-*-*-*
### Update and install some utilities
sudo apt update && sudo apt-get upgrade
sudo apt install -y curl apt-transport-https gnupg nano
curl https://couchdb.apache.org/repo/keys.asc | gpg --dearmor | sudo tee /usr/share/keyrings/couchdb-archive-keyring.gpg >/dev/null 2>&1
source /etc/os-release
@madpink
madpink / gist:3f40e4097630fc2c3fc9dc26c8b903dc
Created August 21, 2017 09:40
Install CouchDB 2.1 on Ubuntu/Debian
sudo apt-get update
sudo apt-get install nano curl apt-transport-https runit -y
sudo nano /etc/apt/sources.list
### add the line:
----------------------------------------
deb https://apache.bintray.com/couchdb-deb xenial main
----------------------------------------
curl -L https://couchdb.apache.org/repo/bintray-pubkey.asc | sudo apt-key add -
sudo apt-get update
{
"docs": [
{
"_id": "x01",
"somevalue": 123,
"filterme": "a"
},
{
"_id": "x02",
"somevalue": 234,
@madpink
madpink / gist:29b7239286739748af40e272e45b121a
Created August 26, 2017 13:47
CouchDB Filter/Selector examples
//FILTER DOCUMENT
{
"_id":"_design/myfilterdoc",
"filters": {
"myfilter": "function(doc, req){if (doc.filterme != 'a'){return false;} return true;}"
}
}
//FILTERED REPLICATION
@madpink
madpink / gist:66c5bc8703eb8cdd0c6a478df330bc19
Last active August 30, 2017 14:55
CouchDB - datascan example ddoc
{
"_id": "_design/datascan",
"views": {
"dead": {
"map": "function (doc) {\n if (doc.year_death != null)\n {emit(doc.year_death, doc.stagename);}\n}"
},
"nationality": {
"reduce": "_count",
"map": "function (doc) {\n emit(doc.nationality, 1);\n}"
},