Skip to content

Instantly share code, notes, and snippets.

Andy Till andytill

Block or report user

Report or block andytill

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
@andytill
andytill / erlang_record_migrations.md
Last active Jun 15, 2016
erlang_record_migrations
View erlang_record_migrations.md

Erlang Record Migrations

A proposal for the syntax for migrations. Separate record definitions with the same name. Each definition has a version increment, each definition defines fields which are in addition to the previous versions.

%% the original definition for the project record, defined for an
%% old version of our application
-record(project, {
    version = 1,
    name :: binary()
View tracing_process_dump.erl
DbgFun = fun({trace_ts, _, _event, MFA, Msg, TS}, _Acc) ->
io:format("XXXXXXXXXXXXXXXXXXXXXXXX ~p : ~p~n~s~n", [MFA, TS, Msg]) end.
dbg:tracer(process, {DbgFun, ok}).
dbg:tp({io,format,1}, [{'_', [], [{message,{process_dump}}, {exception_trace}]}]).
dbg:p(all,[c, timestamp]).
io:format("hi").
@andytill
andytill / java gtk module errror fix
Created Apr 6, 2016
java gtk module errror fix
View java gtk module errror fix
sudo apt-get install libssl0.9.8 libcanberra-gtk0 libcanberra-gtk-module
@andytill
andytill / run all TS riak tests
Last active Apr 18, 2016
run all TS riak tests
View run all TS riak tests
make quickbuild && ./riak_test -c rtdev `sh -c 'for i in tests/ts_*; do echo -t $i; done'`
View makecheckk
make -C test LEGACY=
make[1]: Entering directory `/home/vagrant/work/erlang.mk/test'
build: Generate a bleeding edge Erlang.mk
core-app-asn1: Bootstrap a new OTP library named core_app_asn1
core-app-asn1: Download .asn1 files from Erlang/OTP
core-app-asn1: Generate .erl files dependent from headers generated by .asn1 files
core-app-asn1: Generate an unrelated .hrl file
core-app-asn1: Build the application
core-app-asn1: Check that all compiled files exist
core-app-asn1: Check that the application was compiled correctly
View riak util scripts.sh
## start_cluster.sh
for node in {1..3}; do dev/dev$node/bin/riak start; done
## cluster_up.sh (clusters the individualnodes)
for node in {2..3}; do dev/dev$node/bin/riak-admin cluster join 'dev1@127.0.0.1'; done
View gen_fsm_visualizer.erl
%% ---------------------------------------------------------------------
%%
%% Copyright (c) 2015 Kota UENISHI. All Rights Reserved.
%%
%% This file is provided to you under the Apache License,
%% Version 2.0 (the "License"); you may not use this file
%% except in compliance with the License. You may obtain
%% a copy of the License at
%%
%% http://www.apache.org/licenses/LICENSE-2.0
@andytill
andytill / Time Series Usage.md
Last active Sep 22, 2015
Time Series Usage
View Time Series Usage.md

Create bucket type with the table_def property.

export TAB=GeoCheckin; dev/dev1/bin/riak-admin bucket-type create $TAB "{\"props\":{ \"table_def\": \"CREATE TABLE GeoCheckin (geohash varchar not null, user varchar not null, time timestamp not null, weather varchar not null, temperature varchar, PRIMARY KEY((quantum(time, 15, s)), time, user))\"}}"

Activate it:

dev/dev1/bin/riak-admin bucket-type activate $TAB
@andytill
andytill / in_process_macro.erl
Created Sep 9, 2015
Erlang macro to run some eunit test code inside its own process and wait for that process to complete before returning. This is useful when testing resources which get cleaned up when the current process completes like ets tables.
View in_process_macro.erl
%%% MACRO
-define(in_process(TestCode),
Self = self(),
spawn_link(
fun() ->
TestCode,
Self ! test_ok
end),
receive
View proc pooling benchmarks.txt
processing_in_pools options:
?ITERATIONS: 10000
?KV_SIZE: 500
?PRE_SIZED_HEAP: 4400
scheduler_bind_type: no_node_thread_spread
schedulers_online: 4
processing_in_pools:temporary_workers in 10.226417s
processing_in_pools:temporary_workers_with_pre_sized_heaps in 10.378222s
You can’t perform that action at this time.