Skip to content

Instantly share code, notes, and snippets.

@macintux
macintux / rpncalc.erl
Created October 20, 2012 20:46
Seeking help with Dialyzer
%%% @author John Daily <jd@epep.us>
%%% @copyright (C) 2012, John Daily
%%% @doc
%%% Assignment from programmingpraxis.com
%%%
%%% @reference See <a href="http://programmingpraxis.com/2009/02/19/rpn-calculator/">RPN Calculator</a>.
%%% @end
-module(rpncalc).
-export([rpn/0]).
@macintux
macintux / chaseurls.erl
Created November 28, 2012 03:19
Generate list of HTTP redirects
%%% @author John Daily <jd@epep.us>
%%% @copyright (C) 2012, John Daily
%%% @doc
%%% The httpc module in inets does not appear to offer any way to
%%% determine the "real" URL if it follows a series of redirects
%%% during its request. This code addresses that gap.
%%%
%%% The code does not interpret any HTML-based redirect, such as a
%%% meta refresh.
Riak's MapReduce functionality cannot survive a node failure. If a vnode involved with a query fails while actively processing the request, the entire query will have to be re-run. The failed query should be automatically terminated, but you'll have to re-run the query yourself.
If you create queries using Riak Pipe (the technology layer beneath MapReduce), it is possible to create queries that can survive a vnode failure, but that is not a trivial exercise.
Regarding the empty result set you're seeing: one possibility is that a vnode has failed recently and has come back online without data. MapReduce will not currently trigger a read repair, but that problem should be resolved with the forthcoming Riak 1.3 release.
@macintux
macintux / gist:4712014
Created February 5, 2013 03:50
Does this mean that this is not actually valid UTF-8 data?
124> <<T7/utf8, Excess/binary>> = hd(Blob).
<<77,195,131,194,188,110,99,104,101,110>>
125> Excess.
<<195,131,194,188,110,99,104,101,110>>
126> T7.
77
@macintux
macintux / presentation-tips.md
Last active November 28, 2022 01:03
Public speaking tips
@macintux
macintux / gist:5418295
Last active December 16, 2015 10:09
Draft of a blog post (or possibly a series of posts) diving into the meat of several key Riak configuration parameters. Internal links do not work, but I haven't worried about that since I'm not sure how closely GFM maps to Basho's blogging platform.
@macintux
macintux / 21st century pledge of allegiance
Created July 4, 2013 14:53
The 4th of July seemed like a good opportunity to update the pledge.
I pledge subservience
To the government
Of the United States of America
And to the police state to which we kneel
One Nation under surveillance
unconstitutional
with paranoia and insecurity for all
@macintux
macintux / gist:6034995
Created July 19, 2013 03:50
Script to split large Riak cluster info outputs
#!/usr/bin/perl -w
use strict;
use warnings;
## Running this script:
## 1 Set $datadir to whatever folder you'd like to store the new files
## 2 Run this script with your cluster info file as input
## $ ./split.pl < cluster-info.out
##
@macintux
macintux / split-info
Last active December 19, 2015 23:29
For use with large cluster-info files generated via riak-admin. Will split them into more manageable file sizes.
#!/usr/bin/perl -w
use strict;
use warnings;
sub usage {
my ($errmsg) = @_;
my $msg = <<END;
Usage: split-info <info file> <output directory>