Skip to content

Instantly share code, notes, and snippets.

View andytill's full-sized avatar

Andy Till andytill

View GitHub Profile
@andytill
andytill / no war on russia motion.md
Last active March 25, 2018 13:39
no war on russia motion

Even before this horrendous chemical attack in Salisbury, this Government has been following a dangerous and aggressive line of rhetoric and action that will inevitably escalate conflict between the UK and Russia. In the context of the Syrian War, where Britain and Russia are supporting opposing sides in a proxy war[1], the majority of the casualties of this escalation will likely be Syrian.

This Constituency Labour Party believes that the line taken by the Labour Leadership, to require evidence of Russian involvement before taking action is correct but we must go further. Escalating conflict MUST be ruled out, regardless of the origin of the attack. The Government and Labour must not fight fire with fire, it must stop and choose a path that leads to peace rather than one that taken to it's conclusion, will end in war[2].

This Constituency Labour Party therefore calls on the Prime Minister, Theresa May, for restraint and de-escalation in words and actions towards Russia, and must stop military drills and ex

andy.till ~/work erl -sname lol -setcookie lol
Erlang/OTP 20 [erts-9.1] [source] [64-bit] [smp:8:8] [ds:8:8:10] [async-threads:10] [kernel-poll:false]
Bus error: 10
andy.till ~/work erl -sname lol -setcookie lol
Erlang/OTP 20 [erts-9.1] [source] [64-bit] [smp:8:8] [ds:8:8:10] [async-threads:10] [kernel-poll:false]
Eshell V9.1 (abort with ^G)
(lol@ATILL-02)1> Segmentation fault: 11
@andytill
andytill / replace_process_state.md
Last active March 14, 2017 16:07
Replace or Modify Process State

Given a process state using the following record, how could we modify one of the record fields?

-record(state, {
          status :: init_in_progress | {init_failed, Reason::term()} | ready,
          qbufs = [] :: [{qbuf_ref(), #qbuf{}}],
          qbuf_serial_id = 0 :: non_neg_integer(),
          total_size = 0 :: non_neg_integer(),
          %% no new queries; accumulation allowed
          soft_watermark :: non_neg_integer(),
@andytill
andytill / 1001-error.sql
Created February 10, 2017 12:01
1001 error
riak-shell(3)>INSERT INTO grouptab3 VALUES('x');
Error (1001): <<"Invalid date/time string">>
riak-shell(4)>INSERT INTO grouptab3 VALUES(NULL);
Error (1003): Invalid data found at row index(es) 1
riak-shell(5)>INSERT INTO grouptab3 VALUES(2.3);
Error (1003): Invalid data found at row index(es) 1
riak-shell(6)>INSERT INTO grouptab3 VALUES(2.3, 'hi');
Error (1018): too many values in row index(es) 1
riak-shell(7)>SHOW CREATE TABLE grouptab3;
CREATE TABLE grouptab3 (a TIMESTAMP NOT NULL,
diff --git a/tests/ts_simple_blob.erl b/tests/ts_simple_blob.erl
index 7235a26..a9fdb42 100644
--- a/tests/ts_simple_blob.erl
+++ b/tests/ts_simple_blob.erl
@@ -52,10 +52,15 @@ confirm() ->
Expected =
{ok, {Headers, Data}},
- Cluster = ts_setup:start_cluster(1),
+ lager:info("FREAD OUTPUT ~p", [io:fread("Hi.", "\n")]),
%%
retry_delayed(Fn, DelayMs, TotalElapsedMs) when is_function(Fn),
is_integer(DelayMs),
is_integer(TotalElapsedMs),
TotalElapsedMs > DelayMs ->
retry_delayed2(Fn, DelayMs, TotalElapsedMs, ordsets:new()).
retry_delayed2(Fn, DelayMs, TotalElapsedMs1, Errors1) ->
@andytill
andytill / connect to riak shell.sh
Created November 21, 2016 17:43
connect to riak shell
erl -remsh [email protected] -setcookie riak -name [email protected]
@andytill
andytill / failure-diffs.md
Created November 16, 2016 14:59
Better eunit failure output with unite and `assertEqual`

Problem: an eunit test was using ?assertMatch over a large datastructure and the output was truncated and impossible to debug. The failure was:

**error:{assertMatch_failed,[{module,riak_kv_qry},
                    {line,428},
                    {expression,"Res"},
                    {pattern,"{ ok , { _ , _ , ExpectedRows } }"},
                    {value,{ok,{[<<"Subquery">>,<<"Coverage Plan">>,
                                 <<"Range Scan Start"...>>,
 &lt;&lt;"Is Start Inc"...&gt;&gt;,&lt;&lt;"Range Sc"...&gt;&gt;,

Please install VirtualBox 5.1.2 or compatible from https://www.virtualbox.org/wiki/Downloads, and Vagrant 1.8.5 or compatible from https://www.vagrantup.com/downloads.html. The virtual machine has been tested with these versions only.

Download the erlyberlydemo.box file from google docs, using the link https://drive.google.com/file/d/0B3ta2LL_LQZyTG8wQy1LRmJWSHM/view?usp=sharing and run the following commands. It assumes the downloaded box file is at ~/Downloads.

vagrant box add erlyberlydemo ~/Downloads/erlyberlydemo.box
mkdir erlyberlydemo
cd erlyberlydemo
vagrant init erlyberlydemo
@andytill
andytill / Erlyberly-EUG.md
Last active July 27, 2016 16:08
Quick Start for the Erlyberly EUG demo using Riak TS and Erlyberly

Riak TS commands

for node in {1..3}; do ~/riak_ts/dev/dev$node/bin/riak stop; done
for node in {1..3}; do ~/riak_ts/dev/dev$node/bin/riak start; done

Build the cluster