This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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}\")'" | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
%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"}]} | |
.. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-module(date_util). | |
-compile(export_all). | |
epoch() -> | |
now_to_seconds(now()) | |
. | |
epoch_hires() -> | |
now_to_seconds_hires(now()) | |
. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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([email protected]), | |
Mine = riak_object:new(<<"groceries">>, <<"mine">>, ["eggs", "bacon"]), |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env escript | |
%% -*- erlang -*- | |
%%! -sasl errlog_type error -name tester -noshell -setcookie riak | |
%%-kernel error_logger silent | |
main(_)-> | |
{ok, C} = riak:client_connect([email protected]), | |
Mine = riak_object:new(<<"groceries">>, <<"mine">>, ["eggs", "bacon"]), | |
C:put(Mine, 1), | |
Yours = riak_object:new(<<"groceries">>, <<"yours">>, ["eggs", "wine"]), |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
%% Analysis results: | |
{ analysis_options, | |
[{callers, false}, | |
{sort, acc}, | |
{totals, true}, | |
{details, false}]}. | |
% CNT ACC OWN | |
[{ totals, 3626, 50.613, 19.008}]. %%% |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
%#!/usr/bin/env escript | |
%%! -sasl errlog_type info -boot start_sasl -noshell -sname ejabberd | |
% returns on stdout all nodes called NodeName on the EC2 security group. | |
main([NodeName])-> | |
catch ec2nodefinder:start(), | |
Nodes = case catch ec2nodefinder:discover() of | |
{ok, N}-> N; | |
_ -> | |
[] | |
end, |
OlderNewer