Skip to content

Instantly share code, notes, and snippets.

View angrycub's full-sized avatar

Charlie Voiselle angrycub

View GitHub Profile
@angrycub
angrycub / QueryingRiakSearch2.0.md
Last active September 21, 2024 19:19
Querying Riak Search 2.0
@angrycub
angrycub / riak-debug-lite
Created September 17, 2014 20:02
This grabs the same OS commands as we use in riak-debug without any Riak specific commands.
#!/bin/sh
## -------------------------------------------------------------------
##
## riak-debug-lite: Gather info from a node for troubleshooting.
##
## Copyright (c) 2013 Basho Technologies, Inc. All Rights Reserved.
##
## This file is provided to you under the Apache License,
## Version 2.0 (the "License"); you may not use this file
#!/usr/bin/env escript
%% -*- erlang -*-
%%! -smp enable -sname convert_binary_ring -mnesia debug verbose
main([RingFile, OutFile]) ->
try
{ok, Binary} = file:read_file(RingFile),
Ring = binary_to_term(Binary),
try
file:write_file(OutFile, io_lib:format("~p.~n", [Ring])),
@angrycub
angrycub / ping.txt
Created August 7, 2014 15:19
How to ping a ticket
---------
How to ping a ticket
---------
There are multiple reasons why we may need to update a ticket without being prompted by a customer response.
Examples:
Our SLA is based upon responsiveness. If the ticket is Open, we need to provide regular updates whether the customer has responded or not.
@angrycub
angrycub / gist:0b16d41a52889e8b4efa
Created July 30, 2014 13:03
Preview new claim
Compute_Next = fun(Ring1,Ring2) ->
Owners1 = riak_core_ring:all_owners(Ring1),
Owners2 = riak_core_ring:all_owners(Ring2),
Owners3 = lists:zip(Owners1, Owners2),
[{Idx, PrevOwner, NewOwner, [], awaiting}
|| {{Idx, PrevOwner}, {Idx, NewOwner}} <- Owners3,
PrevOwner /= NewOwner]
end.
N = app_helper:get_env(riak_core,target_n_val,4),
@angrycub
angrycub / graph_ring
Last active September 21, 2024 19:19
Escript to Graph a Riak Ring using HTML5 and Graph.JS
#!/usr/bin/env escript
%% -*- erlang -*-
%%! -smp enable -sname graph_ring -mnesia debug verbose
main([RingFile, OutFile]) ->
{ok, Binary} = file:read_file(RingFile),
Ring = binary_to_term(Binary),
OwnerList = element(2,element(4,Ring)),
%io:format("~s~n", [lists:flatten(header(body(footer([]),OwnerList)))]);
@angrycub
angrycub / app.java
Created June 19, 2014 16:50
Streaming Bucket List with RJC. Reset `young_vclock` when negative.
package basho;
import java.io.IOException;
import com.basho.riak.client.IRiakClient;
import com.basho.riak.client.RiakException;
import com.basho.riak.client.RiakFactory;
import com.basho.riak.client.bucket.Bucket;
import com.basho.riak.client.query.StreamingOperation;
@angrycub
angrycub / UserMetadata.java
Last active October 17, 2017 10:22
Using User Metadata on a Riak Object
// Build Test Data
IRiakObject cat = RiakObjectBuilder.newBuilder("Pets-Template", "Cat").
withValue("{\"sound\":\"Meow\",\"legs\":4}").
build();
rc.store(cat);
// Build User Metadata Map
Map<String, String> usermeta = new HashMap<String, String>();
usermeta.put("parentLinkBucket", "Pets-Template");
usermeta.put("parentLinkKey", "Cat");
@angrycub
angrycub / app.java
Last active August 29, 2015 14:01
Nonexistent versus Unmodified Objects with the Riak Java Client RawClient
package test;
import java.io.IOException;
import java.util.Date;
import com.basho.riak.client.IRiakObject;
import com.basho.riak.client.RiakException;
import com.basho.riak.client.builders.RiakObjectBuilder;
import com.basho.riak.client.http.RiakClient;
import com.basho.riak.client.raw.FetchMeta;
import com.basho.riak.client.raw.RawClient;

Keybase proof

I hereby claim:

  • I am angrycub on github.
  • I am angrycub (https://keybase.io/angrycub) on keybase.
  • I have a public key whose fingerprint is 3BD6 4697 7657 2ECD 2DB0 942C 3A4D 0719 F2FC 7883

To claim this, I am signing this object: