Skip to content

Instantly share code, notes, and snippets.

Jared Morrow jaredmorrow

Block or report user

Report or block jaredmorrow

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View gist:76c61937a7cce0e10affbd0f25e66bed
### Keybase proof
I hereby claim:
* I am jaredmorrow on github.
* I am jaredmorrow ( on keybase.
* I have a public key whose fingerprint is D823 E406 6DF8 C3C3 EFE2 8E80 C471 251D A5C2 621C
To claim this, I am signing this object:
jaredmorrow /
Last active May 5, 2019
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! ... ???


Keybase proof

I hereby claim:

  • I am jaredmorrow on github.
  • I am jaredmorrow ( on keybase.
  • I have a public key whose fingerprint is 5C6F 020C B423 A155 AAC9 4EF9 B9EE 6014 3C09 DDA1

To claim this, I am signing this object:

View gist:57573fa2bb8febbe1280
......... ..........
....... ........
..... ......
.... .....
... ....... ....
.. ....... .. ...
. .......... .. ..
. ....... .... .. .
. ..... ..... .
jaredmorrow /
Last active Dec 14, 2015
Which SmartOS package to use

SmartOS albeit powerful, makes some easy things like figuring out a "version" of SmartOS very difficult and confusing. To someone like Basho who makes packages for SmartOS, it is enough to drive us (me) insane trying to figure out how to label the packages.

The problem lies in trying to define the version at all. Is the version you care about listed in uname -a? How about a file in /etc/ that tells you? The answer to bolth of those questions is "no". uname -v gives you a string like joyent_20130125T031721Z The only file in /etc/ that comes close is pkgsrc_version, but that is only sometimes available on the system. The real answer is a combination of the Global Zone snapshot version and the pkgsrc version in the guest zones.

So how do I label my packages for SmartOS?

With the uname -v example above, joyent_20130125T031721Z describes the global zone, and has some influence on how apps run, but not enough to determine which package will work on which system. Plus I d

View gist:3867631
lg80 = "!git log --graph --color=always --abbrev-commit --date=relative --pretty=format:'%x00%h%x00%s%x00%cd%x00%an%x00%d' | gawk -F '\\0' '{ printf \"%s\\033[31m%s\\033[0m %-50s \\033[32m%14s\\033[0m \\033[30;1m%s\\033[0m\\033[33m%s\\n\", $1, $2, gensub(/(.{49}).{2,}/, \"\\\\1…\",\"g\",$3), $4, $5, $6 }' | less -R"
jaredmorrow / pubkey
Created Jul 17, 2012
SSH Public Key
View pubkey
ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAtcK9RaMacrCGw33ALoPDXm85VsmSFe33qg4yjg+/2QWs1ti7HYgS1uCnfuP9/kuYaNK1MbGfk2l1rScSwKv3GP+uyDttKTRQPkLJEmcqaoSv3tjfl1rG44IuKGIGNrcVWGF2/5qGp4r64BRMPzsJi8LSeEAPMulM7KcZLEdXIf1vsBPa8HMFbUUrYIIfI6xzKgOFA2fBedsrVKd+dn+sYb7lRkDWCVmabqHz/Q8nVkm9tZ/4EHrbHllDicBhCc+wOP+Z7vIk0r2o1Cc4l2ArElVi0F7z8ipAU9jsl3yjfyzhtNdBgiiosgLAwIpHwbsiqVaFqHadqSrcuvDM2PrhVw==
jaredmorrow / gist:3053951
Created Jul 5, 2012 — forked from othiym23/gist:3050224
Getting SmartOS working under vmware
View gist:3053951

If you prefer VirtualBox or aren't running OS X, here are some instructions and a script to help you get started with SmartOS under VirtualBox. If you use VirtualBox, skip the first section and read the section on how to get the Node.js SmartMachine up and running.

Running SmartOS under vmware Fusion

  1. Start by downloading the latest live image
  2. When you run the new VM wizard, select "Continue without disk" on the first screen of the wizard.
  3. Select Sun Solaris / Solaris 10 64-bit on the next screen.
  4. You're going to get dumped to a config screen when the live image starts up, choose DHCP for the networking and defaults for everything else.
  5. Pretty much the first thing you're going to want to do is figure out how to SSH into the box once it boots and creates its storage pools, because trying to do stuff in the virtual console is miserable. There's no cut and paste
jaredmorrow /
Created May 7, 2012
Building erlang on SmartOS

Building Riak on SmartOS, the hard way

Build Machine

Here is some information on the build machine I'm using for reference:

  1. Dataset

    $ dsadm list
    UUID                                 OS      PUBLISHED  URN
jaredmorrow / gist:2023352
Created Mar 12, 2012
Conftest Rebar output on basho/riak toplevel compile
View gist:2023352
==> cluster_info (compile)
==> lager (compile)
CONFTEST: using inherited require_otp_vsn (default: ".*"):
==> poolboy (compile)
CONFTEST: using inherited require_otp_vsn (default: ".*"):
CONFTEST: using inherited erl_first_files (default: []):
==> protobuffs (compile)
You can’t perform that action at this time.