Skip to content

Instantly share code, notes, and snippets.

alexmoore / iso8601.erl
Last active Aug 29, 2015
Iso 8601 Timestamp Long format in Erlang
View iso8601.erl
%% Provides a timestamp like 2014-03-19T19:25:17.779905
DateTime = erlang:now().
{_,_,MicroSec} = DateTime.
{{Year,Month,Day},{Hour,Min,Sec}} = calendar:now_to_universal_time(DateTime).
DateString = io:format("~4..0B-~2..0B-~2..0BT~2..0B:~2..0B:~2..0B.~6..0B",
[Year, Month, Day, Hour, Min, Sec, MicroSec]).
unpack_riak_debugs () {
mkdir -p compressed
for file in `ls *riak-debug.tar.gz`
tar xzf $file
mv $file compressed
for file in `ls -1 | grep riak-debug`

Keybase proof

I hereby claim:

  • I am alexmoore on github.
  • I am alexmoore ( on keybase.
  • I have a public key whose fingerprint is ED5D 175E 29A7 478F 0D4F 7D57 1D71 6D67 A969 0E08

To claim this, I am signing this object:

alexmoore / set_lager.erl
Created May 6, 2014
Set Debug / Info Log Levels Riak-CS
View set_lager.erl
SetDebug = fun() -> {node(), lager:set_loglevel(lager_file_backend, "/var/log/riak-cs/console.log", debug)} end.
SetInfo = fun() -> {node(), lager:set_loglevel(lager_file_backend, "/var/log/riak-cs/console.log", info)} end.
rp(rpc:multicall(erlang, apply, [SetInfo,[]])).
View Functional Core, Imperative Shell
View find_primaries.erl
FindPrimaries = fun(Bucket, Key, Ring) ->
BKey = {Bucket,Key},
DocIdx = riak_core_util:chash_key(BKey),
BucketProps = riak_core_bucket:get_bucket(Bucket, Ring),
[NValue] = [Y || {X1, Y} <- BucketProps, n_val == X1],
CHBin = chashbin:create(riak_core_ring:chash(Ring)),
Itr = chashbin:iterator(DocIdx, CHBin),
{Primaries, Itr2} = chashbin:itr_pop(3, Itr),
alexmoore /
Created Sep 25, 2014
Find large Objects
# For each node, search for reading large object messages, write to file
for NODE in 10.58.9*; do
IP=`echo "$NODE" | cut -d '-' -f1`;
cat $NODE/lo.r.console.log | sed "s/.*Reading large object of size \([0-9]*\) from \(<<.*>>\)\/\(<<.*>>\)/\{\"$IP\",\2,\3,\1\},/" | sort | uniq > $NODE/lo.r.list ;
# For each node, search for writing large object messages, write to largeobject.write file
for NODE in 10.58.9*;
View Faker_Loop.rb
require 'rubygems'
require 'faker'
require 'activerecord'
1000.times do
# make a person
# save this person
View Intro_to_faker_gem.rb
require 'rubygems'
require 'faker'
#Let's see if we can make a fake person...
person_name =
person_email =
person_company =
person_company_slogan =
person_phone = Faker::PhoneNumber.phone_number
person_address = Faker::Address.street_address
alexmoore /
Last active Sep 26, 2015 — forked from jasonrudolph/
Programming Achievements: How to Level Up as a Developer

Programming Achievements: How to Level Up as a Developer

  1. Select a particular experience to pursue.
  2. Pursue that experience to completion. (Achievement unlocked!)
  3. Reflect on that experience. Really soak it in. Maybe a blog post would be in order?
  4. Return to Step 1, this time selecting a new experience.

This gist is a fork of the gist from this blog post.