fixing X11/extensions/XTest.h No such file or directory in ubuntu
If you get the error: X11/extensions/XTest.h: No such file or directory, install:
sudo apt-get install libxtst-dev
elixir [error] backend port not found :inotifywait in ubuntu
If you get this error: [error] backend port not found: :inotifywait, then you need to install inotify-tools, like this:
sudo apt-get install inotify-tools
elixir in ubuntu 15.10
Been receiving this message when trying to install esl-erlang:
Depends: libssl0.9.8 but it is not installable
So, I went to Erlang Solutions Page, and I downloaded the deb for my platform (64bit), and installed it. Afterwards, I followed the steps shown on elixir’s page:
$ git clone https://github.com/elixir-lang/elixir.git
$ cd elixir
$ make clean test
Followed by a sudo make install, and I got elixir running on my pc.
adding a bin/console to your gem
#!/usr/bin/env ruby
require "bundler/setup"
require "your_lib"
require "irb"
IRB.start
In case you prefer pry as a console, you could replace the irb lines with this:
require "pry"
Pry.start
toxiproxy with curl
View all proxies:
curl http://localhost:8474/proxies | python -mjson.tool
Creating one:
$ curl -i -d '{"name": "toxic_mongo", "upstream": "localhost:27017", "listen": "localhost:22122"}' localhost:8474/proxies
HTTP/1.1 201 Created
Content-Type: application/json
Date: Thu, 14 Jan 2016 12:27:49 GMT
Content-Length: 617
{"name":"toxic_mongo","listen":"127.0.0.1:22122","upstream":"localhost:27017","enabled":true,"upstream_toxics":{"bandwidth":{"enabled":false,"rate":0},"latency":{"enabled":false,"latency":0,"jitter":0},"slicer":{"enabled":false,"average_size":0,"size_variation":0,"delay":0},"slow_close":{"enabled":false,"delay":0},"timeout":{"enabled":false,"timeout":0}},"downstream_toxics":{"bandwidth":{"enabled":false,"rate":0},"latency":{"enabled":false,"latency":0,"jitter":0},"slicer":{"enabled":false,"average_size":0,"size_variation":0,"delay":0},"slow_close":{"enabled":false,"delay":0},"timeout":{"enabled":false,"timeout":0}}}%
Enabling a toxic:
curl -i -d '{"enabled":true, "latency":10000}' localhost:8474/proxies/toxic_mongo/downstream/toxics/latency
Deleting one:
curl -X DELETE localhost:8474/proxies/toxic_mongo
using the openresty's lua interpreter from the command line
If you’re using openresty, you can make use of the lua interpreter from the command line if you need to test some code that will be ran in nginx. On my pc, I can access the interpreter ( REPL mode ) like this:
./build/luajit-root/usr/local/openresty/luajit/bin/luajit-2.1.0-alpha
And if you need to execute a file, do:
./build/luajit-root/usr/local/openresty/luajit/bin/luajit-2.1.0-alpha file/path/goes/here
openresty deny request with access_by_lua
Example config:
location ~ ^/some_location {
access_log on;
access_by_lua '
if not some_condition then
ngx.exit(ngx.HTTP_FORBIDDEN);
end
';
...
proxy_pass http://$your_backend;
}
This way, if some_condition is not true, nginx will return a 403 and not do the proxy pass.
inspecting objects with node util inspect
Default depth for util.inspect is 2, to make it infinite:
util.inspect(some_object,{depth: null});