Skip to content

Instantly share code, notes, and snippets.

@jisaacstone
jisaacstone / elixir_distributed.ex
Last active July 10, 2018 18:26
programmatic node startup in elixir
defmodule ExDistUtils do
def start_distributed(appname) do
unless Node.alive?() do
local_node_name = generate_name(appname)
{:ok, _} = Node.start(local_node_name)
end
cookie = Application.get_env(appname, :cookie)
Node.set_cookie(cookie)
end
@jisaacstone
jisaacstone / inspect_expanded.ex
Last active January 9, 2016 05:47
pretty: :expanded implementation examples
[0]
inspect [1,2,3], pretty: :expanded
[1,
2,
3]
[1]
inspect {:foo, :bar}, pretty: :expanded
{:foo,
:bar}
@jisaacstone
jisaacstone / inspect_expanded.ex
Created January 9, 2016 22:51
mode: :expand inspect examples :: first pass at implementation
[0]
IO.inspect [1,2,3], mode: :expand
[1,
2,
3]
[1]
IO.inspect {:foo, :bar}, mode: :expand
{:foo,
:bar}
LM-SJC-11000504://j/n/n/blinky (nerves-examples:master)
$ mix firmware
warning: the archive nerves_bootstrap requires Elixir "~> 1.2.4 or ~> 1.3" but you are running on v1.3.0-dev
Nerves Precompile Start
==> nerves_system
Compiled lib/nerves_system.ex
Compiled lib/mix/tasks/compress.nerves_system.ex
Compiled lib/nerves_system/exception.ex
Compiled lib/nerves_env/exception.ex
Compiled lib/nerves_system/provider.ex
(appstream) Isaacs-MacBook-Pro://I/w/n/appstream (appstream:feature/daemon)
$ trial test/
fetching http://www.pythontest.net/unicode/gb-18030-2000.xml ...
fetching http://www.pythontest.net/unicode/EUC-CN.TXT ...
fetching http://www.pythontest.net/unicode/CP936.TXT ...
fetching http://www.pythontest.net/unicode/BIG5HKSCS-2004.TXT ...
fetching http://www.pythontest.net/unicode/CP932.TXT ...
fetching http://www.pythontest.net/unicode/EUC-JISX0213.TXT ...
fetching http://www.pythontest.net/unicode/EUC-JP.TXT ...
fetching http://www.pythontest.net/unicode/SHIFTJIS.TXT ...

nimblet permissions

a user can view a nimblet if

  • user is admin
  • user has admin, read, or write permissions on the nimblet
  • user has admin, read, or write permissions on the nimblet's project nimblet
  • nimblet is owned_by user
  • nimblet's project is owned_by user
                                                                                                   X

All REST/WAMP calls needed for happy path test

POST ${auth_server}/backend/v1/auth/login -d 'username=${username}&password=${password}
$token = response.token

POST ${backend}/nimblets/v3/nimblets -d '{"type": "project", "name": "cooltestproj"}'
$project_id = response.id
curl -X POST -H "Content-Type: application/json" -d '{
>   "type": "email",
>   "email": "[email protected]",
>   "password": "y4b4d4b4d00"
> }
> ' http://localhost:8080/auth
Invalid message: the "body" parameter must exist.