Skip to content

Instantly share code, notes, and snippets.

View cstar's full-sized avatar

Eric Cestari cstar

  • Escape Velocity Operations
  • Paris, France
  • 03:18 (UTC -12:00)
  • LinkedIn in/ecestari
View GitHub Profile
Run 1 :
Fill time for adding 1000 entry: 6.247 seconds
Usage per user : [{<<"martin">>,68200},
{<<"boulette">>,99700},
{<<"cstar">>,102100},
{<<"sacha">>,83400},
{<<"helene">>,101300}]
MapRed time=0.508 seconds
Usage : {<<"boulette">>,99700}
MapRed time=0.422 seconds
#!/usr/bin/env escript
%% -*- erlang -*-
%%! -sasl errlog_type error -name tester -noshell -setcookie riak
%%-kernel error_logger silent
main(_)->
{ok, C} = riak:client_connect(dev1@boulette.local),
Mine = riak_object:new(<<"groceries">>, <<"mine">>, ["eggs", "bacon"]),
C:put(Mine, 1),
Yours = riak_object:new(<<"groceries">>, <<"yours">>, ["eggs", "wine"]),
#!/usr/bin/env escript
%% -*- erlang -*-
%%! -sasl errlog_type error -name tester -noshell -setcookie riak
%%-kernel error_logger silent
%define(D(S, T), io:format(S++"~n", T)).
-define(D(S), io:format("Debug : ~p~n", [S])).
main(_)->
{ok, C} = riak:client_connect(dev1@boulette.local),
Mine = riak_object:new(<<"groceries">>, <<"mine">>, ["eggs", "bacon"]),
#! /bin/sh
### BEGIN INIT INFO
# Provides: redis-server
# Required-Start: $syslog
# Required-Stop: $syslog
# Should-Start: $local_fs
# Should-Stop: $local_fs
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: redis-server - Persistent key-value db
@cstar
cstar / date_util.erl
Created September 22, 2009 14:21 — forked from zaphar/date_util.erl
-module(date_util).
-compile(export_all).
epoch() ->
now_to_seconds(now())
.
epoch_hires() ->
now_to_seconds_hires(now())
.
#!/usr/bin/perl -wl
use strict;
use Crypt::PasswdMD5 qw(unix_md5_crypt);
my @salt = ( '.', '/', 0 .. 9, 'A' .. 'Z', 'a' .. 'z' );
# this takes password as argument: good for simple example, bad for
# security (perldoc -q password)
my $password = shift || die "usage: $0 password";
%erl -boot release_local/erlsdb-initial -erlsdb access '"<AWS_ACCESS_ID>"' secret '"<AWS_SECRET_KEY>"' ssl false
1> erlsdb:create_domain("fubar").
ok
2> erlsdb:list_domains().
{ok,["fubar"],[]}
3> erlsdb:put_attributes("fubar", "test", [{"foo", "bar"}]).
nil
4> erlsdb:get_attributes("fubar", "test").
{ok,[{"foo","bar"}]}
..
#!/usr/bin/ruby
require 'rubygems'
require 'ec2'
if ( ENV['AMAZON_ACCESS_KEY_ID'] && ENV['AMAZON_SECRET_ACCESS_KEY'] && ENV['EC2_PEM'])
@ec2 = EC2::Base.new(:access_key_id => ENV['AMAZON_ACCESS_KEY_ID'], :secret_access_key => ENV['AMAZON_SECRET_ACCESS_KEY'])
@ec2.describe_instances.reservationSet.item.each {|r|
r.instancesSet.item.each {|p|
system " osascript -e 'tell application \"Terminal\" to (do script with command \"ssh -i #{ENV['EC2_PEM']} root@#{p.dnsName}\")'"
}
}