Skip to content

Instantly share code, notes, and snippets.

View binarytemple's full-sized avatar

Bryan Hunt binarytemple

  • The mountains of mourne
View GitHub Profile
@binarytemple
binarytemple / insert-hostname.zsh
Last active August 29, 2015 14:05
insert hostname to logfile
#### Embed the hostname into all the logfiles from a ZD ticket
This only works with ZSH and relies on glob substitution trick discussed [here](http://serverfault.com/questions/618812/zsh-substitution-cant-do-regex-with-repetition/618822#618822)
### First, get the list of files.
```
errors=(**/*console.log*)
```

sample

  • timeout(sec) : 5
  • message count: 2
(riak1@127.0.0.1)14> redbug:start(5000, 2, {riak_kv_keys_fsm,'_'}).
ok

16:23:32 <{riak_core_coverage_fsm,init,1}> {riak_kv_keys_fsm,init,

Erlang Tracing: more than you wanted to know

Rough Outline

  • What can be traced?
  • How can trace events be specified?
  • "match specifications": twisty passages, all alike
  • WTF, can I just use DTrace and drink my coffee/beer/whisky in peace?
  • Trace delivery mechanisms: pick one of two

10 Erlang one liners to impress your friends

  1. Multiple Each Item in a List by 2:

[X * 2 || X <- lists:seq(1, 11)].
package com.company;
import java.util.Arrays;
import java.util.List;
import java.util.function.Supplier;
import java.util.stream.Stream;
import static java.lang.System.*;
/**

Example of using Riak local client to PUT

Creating the Object

21: O = riak_object:new(<<"bucketfoo">>,
                        <<"bar">>,
                        "baz",
                        dict:from_list([{<<"content-type">>,
 "text/plain"}]))
@binarytemple
binarytemple / scr27.md
Last active August 29, 2015 14:06 — forked from slfritchie/scr27.md

Riak Source Code Reading #27: Riak KV backend API and storage

The Riak KV backend store API

behaviour_info(callbacks) ->
    [
     {api_version,0},