Skip to content

Instantly share code, notes, and snippets.

View mremond's full-sized avatar

Mickaël Rémond mremond

View GitHub Profile
@mremond
mremond / gist:4143826
Created November 25, 2012 14:53 — forked from cstar/gist:970445
Fake your webmachine requests for unit testing.
make_wrq(Method, RawPath, Headers) ->
{ok, Dispatch} = file:consult(filename:join(
[filename:dirname(code:which(?MODULE)),
"..", "priv", "dispatch.conf"])),
R0 = wrq:create(Method, {1,1}, RawPath, mochiweb_headers:from_list(Headers)),
R1 = wrq:set_peer("127.0.0.1", R0),
{_, _, HostTokens, Port, PathTokens, Bindings, AppRoot, StringPath} =
webmachine_dispatcher:dispatch(RawPath, Dispatch, R1),
wrq:load_dispatch_data(Bindings,
HostTokens,
curl -d "user_credentials=ACCESS_TOKEN" \
-d "notification[title]=message title" \
-d "notification[long_message]=<b>Some text or HTML for the full layout page notification</b>" \
-d "notification[sound]=bird-1" \
https://new.boxcar.io/api/notifications
@mremond
mremond / boxcar_push.php
Created February 6, 2014 11:36
Send a Boxcar notification to your device in PHP
<?php
curl_setopt_array(
$chpush = curl_init(),
array(
CURLOPT_URL => "https://new.boxcar.io/api/notifications",
CURLOPT_POSTFIELDS => array(
"user_credentials" => 'ACCESS_TOKEN',
"notification[title]" => 'message title',
"notification[long_message]" => '<b>Some text or HTML for the full layout page notification</b>',
!/usr/bin/perl -w
require LWP::UserAgent;
my $ua = LWP::UserAgent->new;
my $boxcarurl = 'https://new.boxcar.io/api/notifications';
# Put your Boxcar token in this file:
my $accesstoken = `cat ~/.boxcartoken`;
chomp($accesstoken);
require 'openssl'
def gen_key(name)
key = OpenSSL::PKey::RSA.new 1048
file = File.new(name, "w")
file.write(key)
file.close
end
def get_key(name)
#!/usr/bin/env python3
import http.client
import ssl
import urllib.parse
def boxcarpush():
# Prepare the notification parameters
params = urllib.parse.urlencode({
@mremond
mremond / rebar_config_script.erl
Last active August 29, 2015 14:14
Generate rebar.config file form rebar.config.script to debug it
1> {ok, Data} = file:script("rebar.config.script").
...
2> file:write_file("rebar.config", io_lib:fwrite("~p.\n", [Data])).
ok
@mremond
mremond / README
Last active May 4, 2020 16:57
Phoenix Elixir framework with ejabberd - Tutorial
Please read original blog post for reference:
http://blog.process-one.net/embedding-ejabberd-into-an-elixir-phoenix-web-application/
@mremond
mremond / channels.erl
Last active September 1, 2015 12:41 — forked from kachayev/channels.erl
Process communication programming
-module(channels).
-compile(export_all).
make() ->
Ref = make_ref(),
Pid = spawn(?MODULE, channel, [Ref]),
{channel, Pid, Ref}.
channel(Ref) ->
receive
@mremond
mremond / phoenix showdown rackspace onmetal io.md
Created November 24, 2015 14:56 — forked from omnibs/phoenix showdown rackspace onmetal io.md
Phoenix Showdown Comparative Benchmarks @ Rackspace

Comparative Benchmark Numbers @ Rackspace

I've taken the benchmarks from Matthew Rothenberg's phoenix-showdown, updated Phoenix to 0.13.1 and ran the tests on the most powerful machines available at Rackspace.

Results

Framework Throughput (req/s) Latency (ms) Consistency (σ ms)