Skip to content

Instantly share code, notes, and snippets.

View binarytemple-external's full-sized avatar

Bryan Hunt (binarytemple) binarytemple-external

View GitHub Profile
@binarytemple-external
binarytemple-external / 0. Riak on Raspberry Pi's
Created April 10, 2017 09:25 — forked from alexmoore/0. Riak on Raspberry Pi's
Building Basho Erlang / Riak TS on a Raspberry Pi 3
This is unsupported by Basho, but you can build Basho's flavor of Erlang and Riak on Raspberry Pis.
@binarytemple-external
binarytemple-external / restart_bluetooth.sh
Created March 29, 2017 09:02 — forked from nicolasembleton/restart_bluetooth.sh
Restart Bluetooth Daemon on Mac OS X without restarting
#!/bin/bash
sudo kextunload -b com.apple.iokit.BroadcomBluetoothHostControllerUSBTransport
sudo kextload -b com.apple.iokit.BroadcomBluetoothHostControllerUSBTransport
defmodule GCM.Pusher do
use GenStage
# The maximum number of requests Firebase allows at once per XMPP connection
@max_demand 100
defstruct [
:producer,
:producer_from,
:fcm_conn_pid,
:pending_requests,
defmodule GCM.PushCollector do
use GenStage
# Client
def push(pid, push_requests) do
GenServer.cast(pid, {:push, push_requests})
end
# Server
@binarytemple-external
binarytemple-external / read_write_fifo_erlang.md
Created November 17, 2016 16:42 — forked from jaredmorrow/read_write_fifo_erlang.md
Reading and Writing to Fifo (named pipes) in Erlang

Erlang and Named Pipes

The intention of this post is to provide a solution (with examples) to a somewhat uncommon issue in Erlang. I hate searching for answers to the same problems over and over, and I had a hard time finding answers to this particular problem, so I wrote it all down once I figured it out. If one day you decide to read and write data through fifo's (named pipes) and then decide you want to read or write the other end of the pipe from Erlang, this post is for you.

The Problem

I wanted to read and write to a fifo from a C/C++ app and have an Erlang app communicate over the other end of that fifo. Put simply, Erlang doesn't really support what I was trying to do. You cannot just file:open/2 a fifo, or any special device for that matter, in Erlang and expect it to work. This is documented in Erlang's FAQ.

The Solution! ... ???

@binarytemple-external
binarytemple-external / get_put_code.md
Created October 3, 2016 11:16 — forked from bsparrow435/get_put_code.md
Get/Put path walk through
ERLFLAGS= -pa $(CURDIR)/.eunit -pa $(CURDIR)/ebin -pa $(CURDIR)/deps/*/ebin
PROJECT_PLT=$(CURDIR)/.project_plt
# =============================================================================
# Verify that the programs we need to run are installed on this system
# =============================================================================
ERL = $(shell which erl)
ifeq ($(ERL),)
(add-to-list 'load-path (file-truename "<PATH>/projmake-mode"))
(require 'projmake-mode)
(defun projmake-mode-hook ()
(projmake-mode)
(projmake-search-load-project))
(add-hook 'erlang-mode-hook 'projmake-mode-hook)
@binarytemple-external
binarytemple-external / rebar.config
Created September 22, 2016 10:16 — forked from marianoguerra/rebar.config
rebar3_cuttlefish problems
{erl_opts, [debug_info, {parse_transform, lager_transform}]}.
{deps, [
{pbkdf2, {git, "git://github.com/marianoguerra/erlang-pbkdf2-no-history", {branch, "master"}}},
{exometer_core, {git, "git://github.com/basho/exometer_core.git", {branch, "th/correct-dependencies"}}},
{riak_core, {git, "git://github.com/basho/riak_core", {branch, "develop"}}}
]}.
{relx, [{release, { ricor , "0.1.0"},
[ricor,