Skip to content

Instantly share code, notes, and snippets.

View jaredmorrow's full-sized avatar

Jared Morrow jaredmorrow

View GitHub Profile
@jaredmorrow
jaredmorrow / read_write_fifo_erlang.md
Last active April 22, 2023 20:05
Reading and Writing to Fifo (named pipes) in Erlang

edit

@akash-akya pointed out in the comments that the file module supports named pipes since OTP 20. So none of this post is really needed anymore if you are on >= OTP 21.


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.

@jaredmorrow
jaredmorrow / monzo-alertmanager-config.yaml
Created October 22, 2021 16:55 — forked from milesbxf/monzo-alertmanager-config.yaml
Monzo's Alertmanager Slack templates
###################################################
##
## Alertmanager YAML configuration for routing.
##
## Will route alerts with a code_owner label to the slack-code-owners receiver
## configured above, but will continue processing them to send to both a
## central Slack channel (slack-monitoring) and PagerDuty receivers
## (pd-warning and pd-critical)
##
@jaredmorrow
jaredmorrow / gist:3053951
Created July 5, 2012 14:20 — forked from othiym23/gist:3050224
Getting SmartOS working under vmware

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
jaredmorrow / smartos.md
Created May 7, 2012 17:31
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

### Keybase proof
I hereby claim:
* I am jaredmorrow on github.
* I am jaredmorrow (https://keybase.io/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
jaredmorrow / smartos-versions.md
Last active December 14, 2015 00:38
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

[alias]
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
jaredmorrow / pubkey
Created July 17, 2012 13:42
SSH Public Key
ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAtcK9RaMacrCGw33ALoPDXm85VsmSFe33qg4yjg+/2QWs1ti7HYgS1uCnfuP9/kuYaNK1MbGfk2l1rScSwKv3GP+uyDttKTRQPkLJEmcqaoSv3tjfl1rG44IuKGIGNrcVWGF2/5qGp4r64BRMPzsJi8LSeEAPMulM7KcZLEdXIf1vsBPa8HMFbUUrYIIfI6xzKgOFA2fBedsrVKd+dn+sYb7lRkDWCVmabqHz/Q8nVkm9tZ/4EHrbHllDicBhCc+wOP+Z7vIk0r2o1Cc4l2ArElVi0F7z8ipAU9jsl3yjfyzhtNdBgiiosgLAwIpHwbsiqVaFqHadqSrcuvDM2PrhVw== jared@basho.com
@jaredmorrow
jaredmorrow / gist:2023352
Created March 12, 2012 17:00
Conftest Rebar output on basho/riak toplevel compile
==> cluster_info (compile)
==> lager (compile)
CONFTEST: using inherited require_otp_vsn (default: ".*"):
"R13B04|R14"
==> poolboy (compile)
CONFTEST: using inherited require_otp_vsn (default: ".*"):
"R13B04|R14"
CONFTEST: using inherited erl_first_files (default: []):
["src/gen_nb_server.erl","src/gen_server2.erl"]
==> protobuffs (compile)