Skip to content

Instantly share code, notes, and snippets.

@rzezeski
rzezeski / gist:1602953
Created January 12, 2012 20:38
check luwak file ancestor
{ok, C} = riak:local_client().
{ok, F} = luwak_file:get(C, <<"filename">>).
PrevRoot = hd(luwak_file:get_property(F, ancestors)).
V = riak_object:get_value(F).
V2 = lists:keyreplace(root, 1, V, {root, PrevRoot}).
TempF = riak_object:apply_updates(riak_object:update_value(F, V2)).
Bytes = luwak_io:get_range(C, TempF, 0, Length). % where Length is number of bytes you want to read
@rzezeski
rzezeski / sample-lines.sh
Created February 16, 2011 05:28
Pull a random sample of lines from the files in a directory (http://www.progski.net/blog/2011/random_lines_in_bash.html)
#! /bin/bash
#
# Pull a random sample of size 1000 from a directory of files and
# write to standard out.
#
# Usage:
# ./sample-lines /path/to/dir > mysample.log
if [ $# -lt 1 ]
then