Skip to content

Instantly share code, notes, and snippets.

@eiri
eiri / erlang-version-check.md
Last active October 31, 2024 15:21
Quick check on erlang version from command line
$ erl -noshell -eval 'erlang:display(erlang:system_info(system_version))' -eval 'init:stop()'
"Erlang/OTP 20 [erts-9.1.1] [source] [64-bit] [smp:4:4] [ds:4:4:10] [async-threads:10] [hipe] [kernel-poll:false] [dtrace]\n"
@eiri
eiri / !README.md
Last active October 8, 2017 20:16
Vagrant setup for go dev

Vagrant setup for go dev

Overview

  • Linux: Debian Stretch
  • Provisioning: Ansible
  • Go: 1.9.1

Pre-requirements

  • VirtualBox: 5.1.28
  • Vagrant: 2.0.0
@eiri
eiri / primer.md
Last active November 2, 2023 04:40
Edit CouchDB design document with curl

Edit CouchDB design document with curl

create new database

$ curl -X PUT http://localhost:5984/koi
{"ok":true}

create a single document

$ curl -X POST http://localhost:5984/koi -d '{"name":"alice","age":25}' -H'Content-Type:application/json'
@eiri
eiri / CouchDB_attachments.md
Created May 26, 2017 17:16
Short primer on using attachment in CouchDB

Short primer on using attachment in CouchDB

In db "koi" create a doc named "tesla"

$ http put :5984/koi/tesla name=alice
{
    "id": "tesla", 
    "ok": true, 
    "rev": "1-2350796167caec1f6ba70e9145a9e102"
@eiri
eiri / REST Cheatsheet.md
Last active May 19, 2017 13:34
REST Cheatsheet

REST Cheatshit

REST to CRUD

  • POST - create
  • GET - read
  • PUT - update (replace)
  • PATCH - update (partial)
  • DELETE - delete
  • HEAD - verify
@eiri
eiri / CouchDB _local.md
Created March 22, 2017 11:55
Working with local documents in CouchDB (medium post stub)

Working with local documents in CouchDB

Create

No such document

$ http :5984/koi/_local/020
{
    "error": "not_found", 
    "reason": "missing"
}
@eiri
eiri / demo.md
Created February 21, 2017 14:12
Demo on how revs, open_revs and and revs_info act in CouchDB 2.0

Start dev cluster:

$ ./dev/run --admin eiri:eiri
[ * ] Setup environment ... ok
[ * ] Ensure CouchDB is built ... ok
[ * ] Prepare configuration files ... ok
[ * ] Start node node1 ... ok
[ * ] Start node node2 ... ok
[ * ] Start node node3 ... ok
[ * ] Check node at http://127.0.0.1:15984/ ... ok
@eiri
eiri / provision.yml
Created January 27, 2017 19:01
Insert arbitrary lines in middle of file with ansible
- name: activate erlang 17.5 on login
lineinfile:
dest: /home/vagrant/.bashrc
line: "{{item.line}}"
insertafter: "{{item.insertafter}}"
state: present
with_items:
- insertafter: "#alias l='ls -CF'"
line: '# activate erlang 17.5'
- insertafter: '# activate erlang 17.5'
@eiri
eiri / README.md
Last active December 9, 2016 17:22
Sequence diagram of CouchDB 2.0 compaction
@eiri
eiri / README.md
Last active December 9, 2016 14:21
Example of using js-sequence diagram in gist

Example of using js-sequence diagram in gist

How to share

Bl.ocks is a nice way for sharing code examples hosted on gitHub gist. All that needed is just to replace “gist.github.com” with “bl.ocks.org” in the URL, e.g. http://bl.ocks.org/eiri/073a9e12f8246927ef997bf6f3ab5561

Sequence file loading

Sequence is just a simple text file loaded with syncronious ajax call.