Skip to content

Instantly share code, notes, and snippets.

View masteinhauser's full-sized avatar

Myles Steinhauser masteinhauser

View GitHub Profile

Keybase proof

I hereby claim:

  • I am masteinhauser on github.
  • I am masteinhauser (https://keybase.io/masteinhauser) on keybase.
  • I have a public key ASDnqV_sBKgU8h44EFtZOah_qtcZFw1_PvyIrAX0RHratgo

To claim this, I am signing this object:

Keybase proof

I hereby claim:

  • I am masteinhauser on github.
  • I am mastein_asics (https://keybase.io/mastein_asics) on keybase.
  • I have a public key ASBRduE29hP68p9ueQ7MTMMu5YZDG40AKPyyVwTgUYfSowo

To claim this, I am signing this object:

@masteinhauser
masteinhauser / vault-statsd-mapping.yml
Last active July 29, 2018 16:11 — forked from tam7t/vault-statsd-mapping.conf
Example vault mapping for prometheus statsd-exporter v0.5.0 +
# Inspired by:
# https://gist.github.com/tam7t/64291f4ebbc1c45a1fc876b6c0613221
mappings:
- match: vault.barrier.*
name: vault_barrier
labels:
method: $1
- match: vault.etcd.*
name: vault_etcd
@masteinhauser
masteinhauser / command
Last active August 29, 2015 14:10
rsyslog debug
~# /usr/sbin/rsyslogd -dn -f /etc/rsyslog.conf -i /var/run/rsyslog.pid 2>&1 > /tmp/rsyslog.debug
@masteinhauser
masteinhauser / build.sh
Last active September 13, 2018 08:57
Example Packer pipeline with Berkshelf cookbook vendoring
#!/bin/bash -x
#DEBUG="-debug"
VM=`echo ${1} | sed 's/.json//g'`
PACKER=`which packer`
rm -rf output-${VM}
${PACKER} build ${DEBUG} ${VM}.json
@masteinhauser
masteinhauser / keybase.md
Created August 15, 2014 15:50
keybase.md

Keybase proof

I hereby claim:

  • I am masteinhauser on github.
  • I am masteinhauser (https://keybase.io/masteinhauser) on keybase.
  • I have a public key whose fingerprint is B2B8 2328 1D84 AA18 280B 4BC2 1A4B 91F3 0D4D 9790

To claim this, I am signing this object:

@masteinhauser
masteinhauser / gist:708e1df865911662815a
Last active August 29, 2015 14:05
Elixir: Match two fields of a struct against each other in a function definition
def foo(%State{attempted_address} = address, bar)) when address not nil do
# a thing, do it here
end
def foo(%State{address} = address, bar)) when address not nil do
# a thing, do it here
end
defmodule Frontend.VideoController do use Phoenix.Controller
plug Plug.Parsers, parsers: [:urlencoded, :multipart], limit: 1_000_000_000
def upload(conn, %{"file" => file, "name" => name}) do
send_response(conn, 200, "text/plain", "Upload Received: file => #{file}, name => #{name}")
end
end
@masteinhauser
masteinhauser / gist:87e29c574411247336ed
Created August 7, 2014 13:58
Phoenix/Plug multipart/form-data failures in Cowboy
(MatchError) no match of right hand side value: false
Stacktrace
(cowboy) src/cowboy_req.erl:738: :cowboy_req.stream_multipart/2
(cowboy) src/cowboy_req.erl:674: :cowboy_req.part/2
(plug) lib/plug/adapters/cowboy/conn.ex:55: Plug.Adapters.Cowboy.Conn.parse_req_multipart/3
(plug) lib/plug/parsers/multipart.ex:8: Plug.Parsers.MULTIPART.parse/5
(plug) lib/plug/parsers.ex:133: Plug.Parsers.reduce/6
(frontend) web/controllers/video_controller.ex:1: Frontend.VideoController.call/2
@masteinhauser
masteinhauser / gist:96ed2ad36cc074234397
Created August 7, 2014 01:08
Elixir Phoenix HEAD Request Debug
$ curl -X HEAD -v http://localhost:4000/bytes/sample.webm
* Adding handle: conn: 0x7fb024004000
* Adding handle: send: 0
* Adding handle: recv: 0
* Curl_addHandleToPipeline: length: 1
* - Conn 0 (0x7fb024004000) send_pipe: 1, recv_pipe: 0
* About to connect() to localhost port 4000 (#0)
* Trying ::1...
* Trying 127.0.0.1...
* Connected to localhost (127.0.0.1) port 4000 (#0)