Skip to content

Instantly share code, notes, and snippets.

View bokner's full-sized avatar

Boris Okner bokner

  • Barrie, ON, Canada
View GitHub Profile
@bokner
bokner / gist:b46f89c76d078b83ecf9
Last active August 29, 2015 14:18
Function call with attempts of recovery on failure
%% @author bokner
%% @doc Implementation of function call with recovery
-module(recovery_test).
%% ====================================================================
%% API functions
%% ====================================================================
-export([test/1]).
#!/usr/bin/env escript
main([]) ->
{ok, Client} = gen_client:start("[email protected]", "localhost", 5222, "password"),
%% We can add any number of handlers (callbacks) to the session
%% Message handler
gen_client:add_handler(Client,
fun(#received_packet{packet_type = message, type_attr = "chat", from = Jid}, _Session) ->
@bokner
bokner / digest_auth.erl
Created April 10, 2010 16:26
Erlang module implementing HTTP digest auth on client side
%% Author: bokner
%% Created: Apr 10, 2010
%% Description: HTTP digest authentication
%% Note: the code follows the informal explanation given on Wikipedia.
%% Note: the test/0 function doesn't intend to send a proper data to webdav service,
%% it just shows how to pass the authorization.
%% Disclaimer: Use on your own risk. The author disclaims any liability
%% with regard to using this code.
-module(digest_auth).