About me

With a focus on building Software & Data Engineering, I write about the things I find interesting.

I love to contribute to opensource, and plan on contributing more in 2023.

For more information, you can check out my:

Using a HTTP proxy (such as NordVPN) with hackney for HTTPoison/Tesla

Hackney is the adapter behind HTTPoison and Hackney, because it is awesome, offering features such as HTTP Keepalive, SSL support, pools and it’s battle tested and stable. One of the experiments I recently tried was how to use a HTTP Proxy (NordVPN offers a http proxy as part of their package) with it. You can easily do this by passing in proxy and proxy_auth. Using plain ol’ hackney: options = [ proxy: {'au1111.

Fixing Elixirs TZData updater with IEx

[error] GenServer :tzdata_release_updater terminating ** (ArgumentError) argument error (stdlib) :ets.lookup_element(:hackney_config, :mod_metrics, 2) You hate to see it when running iex -S mix locally, basically it’s an issue where tzdata can’t update. You can fix this by either: Adding the following to your projects dev config: config :tzdata, :autoupdate, :disabled Adding the following snippet to your .iex.exs file: Application.put_env(:tzdata, :autoupdate, :disabled) You can read more about this on the tzdata README.

Showing debug trace information for hackney (HTTPoison) in IEx

Using IEx with a remote API with HTTPoison, it can be handy to show int he console the request and response you get back with hackney. You can do this by entering the following in iex: :hackney_trace.enable(:max, :io) You can also add this to .iex.exs file so it’ll always be added to your iex sessions by default so you don’t need to always retype it when needed. This will give you an output like this:

How to test CORS with Plug/Phoenix

So you have setup your API to accept CORS requests on certain paths on your API using cors_plug or corsica and you are wondering how you test this with ExUnit. Back to basics: Does the endpoint actually work? Well the first thing to do is to check if your endpoint is actually working with CORS. You can do this via cURL: curl http://localhost:4000/api/posts -v -H "Origin: https://example.com" You will need to change the URL to your API Endpoint and your Origin to the URL you have allowed to access this endpoint.