added stuff
This commit is contained in:
parent
2627ee4784
commit
6582b93e82
|
@ -1,63 +0,0 @@
|
|||
#!/usr/bin/perl
|
||||
# 3456789#123456789#123456789#123456789#123456789#123456789#123456789#123456789#
|
||||
# bcinflation.pl 20101228 jeffrey paul <sneak@datavibe.net>
|
||||
# 5539 AD00 DE4C 42F3 AFE1 1575 0524 43F4 DF2A 55C2 # please sign!
|
||||
|
||||
use strict;
|
||||
use warnings qw( all );
|
||||
use LWP::Simple;
|
||||
use Data::Dumper;
|
||||
use HTML::Strip;
|
||||
use DateTime;
|
||||
|
||||
# thanks to nullvoid for historical block data
|
||||
my $historyurl = 'http://nullvoid.org/bitcoin/difficultiez.php';
|
||||
my $growthfactor = 1.0;
|
||||
|
||||
main();
|
||||
|
||||
sub main {
|
||||
my $hist = fetch_history_data() or die "unable to fetch history!";
|
||||
my $block = 0;
|
||||
my $totalbc = 0;
|
||||
my $perblock = 50;
|
||||
my $at = 1231006505; # block zero timestamp
|
||||
while ($block < 1500000) { # arbitrary
|
||||
$block++;
|
||||
$perblock /= 2 unless $block % 210000;
|
||||
$at += 60*10/$growthfactor; # estimate block timestamp
|
||||
# replace with real data if we have it:
|
||||
$at = $hist->{$block} if exists($hist->{$block});
|
||||
$totalbc += $perblock;
|
||||
if ($block == 210000) {
|
||||
print ts2nice($at);
|
||||
die;
|
||||
}
|
||||
unless($block % 21000) {
|
||||
print ts2nice($at) . ",";
|
||||
print $block . ",";
|
||||
print $perblock . ",";
|
||||
print $totalbc. ",";
|
||||
print "\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
sub ts2nice { return DateTime->from_epoch( epoch => shift() )->ymd; }
|
||||
|
||||
sub fetch_history_data {
|
||||
my $raw = get($historyurl) or die "derp: $!";
|
||||
|
||||
my $clean = HTML::Strip->new()->parse($raw);
|
||||
$clean =~ s/Block/\nBlock/g;
|
||||
my $out = {};
|
||||
foreach my $l (split(/\n+/,$clean)) {
|
||||
next unless $l =~ /^Block\s+([0-9]+)\s+was.*at\s+([0-9]+).*Difficulty\:\s+([0-9\.]{3,10}).*$/;
|
||||
$out->{$1} = $2;
|
||||
}
|
||||
return unless $out->{98784};
|
||||
return $out;
|
||||
}
|
||||
|
||||
1;
|
||||
__END__
|
|
@ -0,0 +1,68 @@
|
|||
#!/usr/bin/perl
|
||||
# 3456789#123456789#123456789#123456789#123456789#123456789#123456789#123456789#
|
||||
# bcinflation.pl 20101228 jeffrey paul <sneak@datavibe.net>
|
||||
# 5539 AD00 DE4C 42F3 AFE1 1575 0524 43F4 DF2A 55C2 # please sign!
|
||||
|
||||
use strict;
|
||||
use warnings qw( all );
|
||||
use LWP::Simple;
|
||||
use Data::Dumper;
|
||||
use HTML::Strip;
|
||||
use DateTime;
|
||||
|
||||
# thanks to nullvoid for historical block data
|
||||
# that's actually mizerydearia, the witcoin guy
|
||||
my $historyurl = 'http://nullvoid.org/bitcoin/difficultiez.php';
|
||||
my $growthfactor = 1.0;
|
||||
|
||||
main();
|
||||
|
||||
sub main {
|
||||
my $hist = fetch_history_data() or die "unable to fetch history!";
|
||||
my $block = 0;
|
||||
my $totalbc = 0;
|
||||
my $perblock = 50;
|
||||
my $at = 1231006505; # block zero timestamp
|
||||
while ($block < 1500000) { # arbitrary
|
||||
$block++;
|
||||
$perblock /= 2 unless $block % 210000;
|
||||
$at += 60*10/$growthfactor; # estimate block timestamp
|
||||
# replace with real data if we have it:
|
||||
$at = $hist->{$block}{'ts'} if exists($hist->{$block});
|
||||
$totalbc += $perblock;
|
||||
#if ($block == 210000) {
|
||||
# print ts2nice($at);
|
||||
# die;
|
||||
#}
|
||||
unless($block % 21000) {
|
||||
print ts2nice($at) . ",";
|
||||
print $block . ",";
|
||||
print $perblock . ",";
|
||||
print $totalbc. ",";
|
||||
if (exists($hist->{$block})) {
|
||||
print $hist->{$block}{'difficulty'};
|
||||
}
|
||||
print ",\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
sub ts2nice { return DateTime->from_epoch( epoch => shift() )->ymd; }
|
||||
|
||||
sub fetch_history_data {
|
||||
my $raw = get($historyurl) or die "derp: $!";
|
||||
|
||||
my $clean = HTML::Strip->new()->parse($raw);
|
||||
$clean =~ s/Block/\nBlock/g;
|
||||
my $out = {};
|
||||
foreach my $l (split(/\n+/,$clean)) {
|
||||
next unless $l =~ /^Block\s+([0-9]+)\s+was.*at\s+([0-9]+).*Difficulty\:\s+([0-9\.]{3,10}).*$/;
|
||||
$out->{$1}{'ts'} = $2;
|
||||
$out->{$1}{'difficulty'} = $3;
|
||||
}
|
||||
return unless $out->{135072}; # latest diffchange block
|
||||
return $out;
|
||||
}
|
||||
|
||||
1;
|
||||
__END__
|
|
@ -1,4 +1,6 @@
|
|||
#!/usr/bin/python2.6
|
||||
# this script has been totally obsoleted by mtgoxlive.com
|
||||
# written by coderrr
|
||||
|
||||
import urllib
|
||||
import sys
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,919 @@
|
|||
2009-01-03,1
|
||||
2009-01-09,14
|
||||
2009-01-10,61
|
||||
2009-01-11,93
|
||||
2009-01-12,101
|
||||
2009-01-13,123
|
||||
2009-01-14,130
|
||||
2009-01-15,134
|
||||
2009-01-16,110
|
||||
2009-01-17,109
|
||||
2009-01-18,108
|
||||
2009-01-19,117
|
||||
2009-01-20,115
|
||||
2009-01-21,103
|
||||
2009-01-22,92
|
||||
2009-01-23,86
|
||||
2009-01-24,202
|
||||
2009-01-25,192
|
||||
2009-01-26,97
|
||||
2009-01-27,98
|
||||
2009-01-28,112
|
||||
2009-01-29,122
|
||||
2009-01-30,117
|
||||
2009-01-31,139
|
||||
2009-02-01,114
|
||||
2009-02-02,129
|
||||
2009-02-03,155
|
||||
2009-02-04,119
|
||||
2009-02-05,126
|
||||
2009-02-06,122
|
||||
2009-02-07,133
|
||||
2009-02-08,133
|
||||
2009-02-09,135
|
||||
2009-02-10,120
|
||||
2009-02-11,135
|
||||
2009-02-12,119
|
||||
2009-02-13,124
|
||||
2009-02-14,136
|
||||
2009-02-15,131
|
||||
2009-02-16,123
|
||||
2009-02-17,117
|
||||
2009-02-18,118
|
||||
2009-02-19,125
|
||||
2009-02-20,122
|
||||
2009-02-21,114
|
||||
2009-02-22,125
|
||||
2009-02-23,108
|
||||
2009-02-24,106
|
||||
2009-02-25,105
|
||||
2009-02-26,107
|
||||
2009-02-27,116
|
||||
2009-02-28,100
|
||||
2009-03-01,105
|
||||
2009-03-02,108
|
||||
2009-03-03,107
|
||||
2009-03-04,106
|
||||
2009-03-05,113
|
||||
2009-03-06,117
|
||||
2009-03-07,109
|
||||
2009-03-08,118
|
||||
2009-03-09,108
|
||||
2009-03-10,107
|
||||
2009-03-11,114
|
||||
2009-03-12,119
|
||||
2009-03-13,114
|
||||
2009-03-14,110
|
||||
2009-03-15,123
|
||||
2009-03-16,122
|
||||
2009-03-17,114
|
||||
2009-03-18,116
|
||||
2009-03-19,122
|
||||
2009-03-20,119
|
||||
2009-03-21,50
|
||||
2009-03-22,121
|
||||
2009-03-23,130
|
||||
2009-03-24,105
|
||||
2009-03-25,117
|
||||
2009-03-26,118
|
||||
2009-03-27,106
|
||||
2009-03-28,122
|
||||
2009-03-29,116
|
||||
2009-03-30,120
|
||||
2009-03-31,111
|
||||
2009-04-01,114
|
||||
2009-04-02,115
|
||||
2009-04-03,116
|
||||
2009-04-04,113
|
||||
2009-04-05,132
|
||||
2009-04-06,109
|
||||
2009-04-07,100
|
||||
2009-04-08,105
|
||||
2009-04-09,99
|
||||
2009-04-10,108
|
||||
2009-04-11,121
|
||||
2009-04-12,120
|
||||
2009-04-13,116
|
||||
2009-04-14,124
|
||||
2009-04-15,113
|
||||
2009-04-16,123
|
||||
2009-04-17,112
|
||||
2009-04-18,130
|
||||
2009-04-19,120
|
||||
2009-04-20,121
|
||||
2009-04-21,124
|
||||
2009-04-22,121
|
||||
2009-04-23,75
|
||||
2009-04-24,115
|
||||
2009-04-25,118
|
||||
2009-04-26,114
|
||||
2009-04-27,104
|
||||
2009-04-28,117
|
||||
2009-04-29,129
|
||||
2009-04-30,131
|
||||
2009-05-01,121
|
||||
2009-05-02,128
|
||||
2009-05-03,109
|
||||
2009-05-04,129
|
||||
2009-05-05,136
|
||||
2009-05-06,135
|
||||
2009-05-07,122
|
||||
2009-05-08,107
|
||||
2009-05-09,78
|
||||
2009-05-10,85
|
||||
2009-05-11,121
|
||||
2009-05-12,130
|
||||
2009-05-13,116
|
||||
2009-05-14,142
|
||||
2009-05-15,137
|
||||
2009-05-16,119
|
||||
2009-05-17,127
|
||||
2009-05-18,118
|
||||
2009-05-19,86
|
||||
2009-05-20,120
|
||||
2009-05-21,82
|
||||
2009-05-22,61
|
||||
2009-05-23,32
|
||||
2009-05-24,100
|
||||
2009-05-25,109
|
||||
2009-05-26,125
|
||||
2009-05-27,119
|
||||
2009-05-28,95
|
||||
2009-05-29,107
|
||||
2009-05-30,109
|
||||
2009-05-31,96
|
||||
2009-06-01,72
|
||||
2009-06-02,111
|
||||
2009-06-03,71
|
||||
2009-06-04,66
|
||||
2009-06-05,30
|
||||
2009-06-06,28
|
||||
2009-06-07,16
|
||||
2009-06-08,82
|
||||
2009-06-09,91
|
||||
2009-06-10,82
|
||||
2009-06-11,89
|
||||
2009-06-12,86
|
||||
2009-06-13,78
|
||||
2009-06-14,72
|
||||
2009-06-15,84
|
||||
2009-06-16,71
|
||||
2009-06-17,79
|
||||
2009-06-18,80
|
||||
2009-06-19,87
|
||||
2009-06-20,78
|
||||
2009-06-21,81
|
||||
2009-06-22,77
|
||||
2009-06-23,76
|
||||
2009-06-24,97
|
||||
2009-06-25,69
|
||||
2009-06-26,90
|
||||
2009-06-27,84
|
||||
2009-06-28,47
|
||||
2009-06-29,84
|
||||
2009-06-30,86
|
||||
2009-07-01,75
|
||||
2009-07-02,84
|
||||
2009-07-03,82
|
||||
2009-07-04,89
|
||||
2009-07-05,79
|
||||
2009-07-06,84
|
||||
2009-07-07,69
|
||||
2009-07-08,74
|
||||
2009-07-09,86
|
||||
2009-07-10,81
|
||||
2009-07-11,83
|
||||
2009-07-12,77
|
||||
2009-07-13,78
|
||||
2009-07-14,69
|
||||
2009-07-15,45
|
||||
2009-07-16,71
|
||||
2009-07-17,47
|
||||
2009-07-18,4
|
||||
2009-07-19,70
|
||||
2009-07-20,71
|
||||
2009-07-21,82
|
||||
2009-07-22,60
|
||||
2009-07-23,76
|
||||
2009-07-24,73
|
||||
2009-07-25,32
|
||||
2009-07-26,21
|
||||
2009-07-27,74
|
||||
2009-07-28,41
|
||||
2009-07-29,20
|
||||
2009-07-30,16
|
||||
2009-07-31,17
|
||||
2009-08-01,28
|
||||
2009-08-02,23
|
||||
2009-08-03,12
|
||||
2009-08-04,81
|
||||
2009-08-05,87
|
||||
2009-08-06,90
|
||||
2009-08-07,81
|
||||
2009-08-08,80
|
||||
2009-08-09,101
|
||||
2009-08-10,75
|
||||
2009-08-11,70
|
||||
2009-08-12,63
|
||||
2009-08-13,85
|
||||
2009-08-14,63
|
||||
2009-08-15,26
|
||||
2009-08-16,19
|
||||
2009-08-17,17
|
||||
2009-08-18,10
|
||||
2009-08-19,18
|
||||
2009-08-20,22
|
||||
2009-08-21,14
|
||||
2009-08-22,7
|
||||
2009-08-23,15
|
||||
2009-08-24,15
|
||||
2009-08-25,50
|
||||
2009-08-26,51
|
||||
2009-08-27,29
|
||||
2009-08-28,75
|
||||
2009-08-29,78
|
||||
2009-08-30,98
|
||||
2009-08-31,87
|
||||
2009-09-01,78
|
||||
2009-09-02,66
|
||||
2009-09-03,62
|
||||
2009-09-04,64
|
||||
2009-09-05,76
|
||||
2009-09-06,68
|
||||
2009-09-07,79
|
||||
2009-09-08,69
|
||||
2009-09-09,54
|
||||
2009-09-10,67
|
||||
2009-09-11,67
|
||||
2009-09-12,69
|
||||
2009-09-13,75
|
||||
2009-09-14,74
|
||||
2009-09-15,44
|
||||
2009-09-16,73
|
||||
2009-09-17,85
|
||||
2009-09-18,78
|
||||
2009-09-19,74
|
||||
2009-09-20,78
|
||||
2009-09-21,70
|
||||
2009-09-22,26
|
||||
2009-09-23,36
|
||||
2009-09-24,97
|
||||
2009-09-25,93
|
||||
2009-09-26,100
|
||||
2009-09-27,88
|
||||
2009-09-28,85
|
||||
2009-09-29,90
|
||||
2009-09-30,85
|
||||
2009-10-01,82
|
||||
2009-10-02,73
|
||||
2009-10-03,58
|
||||
2009-10-04,53
|
||||
2009-10-05,55
|
||||
2009-10-06,45
|
||||
2009-10-07,60
|
||||
2009-10-08,70
|
||||
2009-10-09,79
|
||||
2009-10-10,77
|
||||
2009-10-11,74
|
||||
2009-10-12,59
|
||||
2009-10-13,57
|
||||
2009-10-14,69
|
||||
2009-10-15,71
|
||||
2009-10-16,61
|
||||
2009-10-17,57
|
||||
2009-10-18,75
|
||||
2009-10-19,112
|
||||
2009-10-20,96
|
||||
2009-10-21,81
|
||||
2009-10-22,91
|
||||
2009-10-23,89
|
||||
2009-10-24,63
|
||||
2009-10-25,76
|
||||
2009-10-26,71
|
||||
2009-10-27,65
|
||||
2009-10-28,66
|
||||
2009-10-29,48
|
||||
2009-10-30,60
|
||||
2009-10-31,46
|
||||
2009-11-01,25
|
||||
2009-11-02,33
|
||||
2009-11-03,62
|
||||
2009-11-04,64
|
||||
2009-11-05,57
|
||||
2009-11-06,62
|
||||
2009-11-07,69
|
||||
2009-11-08,73
|
||||
2009-11-09,64
|
||||
2009-11-10,78
|
||||
2009-11-11,73
|
||||
2009-11-12,66
|
||||
2009-11-13,83
|
||||
2009-11-14,79
|
||||
2009-11-15,96
|
||||
2009-11-16,97
|
||||
2009-11-17,92
|
||||
2009-11-18,79
|
||||
2009-11-19,72
|
||||
2009-11-20,86
|
||||
2009-11-21,73
|
||||
2009-11-22,106
|
||||
2009-11-23,96
|
||||
2009-11-24,93
|
||||
2009-11-25,90
|
||||
2009-11-26,84
|
||||
2009-11-27,74
|
||||
2009-11-28,71
|
||||
2009-11-29,60
|
||||
2009-11-30,75
|
||||
2009-12-01,74
|
||||
2009-12-02,94
|
||||
2009-12-03,88
|
||||
2009-12-04,36
|
||||
2009-12-05,65
|
||||
2009-12-06,105
|
||||
2009-12-07,112
|
||||
2009-12-08,107
|
||||
2009-12-09,109
|
||||
2009-12-10,104
|
||||
2009-12-11,112
|
||||
2009-12-12,112
|
||||
2009-12-13,114
|
||||
2009-12-14,107
|
||||
2009-12-15,112
|
||||
2009-12-16,137
|
||||
2009-12-17,172
|
||||
2009-12-18,225
|
||||
2009-12-19,199
|
||||
2009-12-20,175
|
||||
2009-12-21,176
|
||||
2009-12-22,162
|
||||
2009-12-23,154
|
||||
2009-12-24,154
|
||||
2009-12-25,150
|
||||
2009-12-26,174
|
||||
2009-12-27,168
|
||||
2009-12-28,137
|
||||
2009-12-29,171
|
||||
2009-12-30,141
|
||||
2009-12-31,138
|
||||
2010-01-01,134
|
||||
2010-01-02,126
|
||||
2010-01-03,186
|
||||
2010-01-04,183
|
||||
2010-01-05,198
|
||||
2010-01-06,163
|
||||
2010-01-07,154
|
||||
2010-01-08,153
|
||||
2010-01-09,151
|
||||
2010-01-10,190
|
||||
2010-01-11,159
|
||||
2010-01-12,161
|
||||
2010-01-13,166
|
||||
2010-01-14,145
|
||||
2010-01-15,142
|
||||
2010-01-16,126
|
||||
2010-01-17,131
|
||||
2010-01-18,126
|
||||
2010-01-19,124
|
||||
2010-01-20,158
|
||||
2010-01-21,184
|
||||
2010-01-22,136
|
||||
2010-01-23,162
|
||||
2010-01-24,155
|
||||
2010-01-25,215
|
||||
2010-01-26,201
|
||||
2010-01-27,166
|
||||
2010-01-28,179
|
||||
2010-01-29,201
|
||||
2010-01-30,214
|
||||
2010-01-31,167
|
||||
2010-02-01,193
|
||||
2010-02-02,146
|
||||
2010-02-03,272
|
||||
2010-02-04,234
|
||||
2010-02-05,227
|
||||
2010-02-06,206
|
||||
2010-02-07,222
|
||||
2010-02-08,208
|
||||
2010-02-09,210
|
||||
2010-02-10,173
|
||||
2010-02-11,174
|
||||
2010-02-12,188
|
||||
2010-02-13,235
|
||||
2010-02-14,219
|
||||
2010-02-15,185
|
||||
2010-02-16,201
|
||||
2010-02-17,250
|
||||
2010-02-18,215
|
||||
2010-02-19,195
|
||||
2010-02-20,210
|
||||
2010-02-21,227
|
||||
2010-02-22,265
|
||||
2010-02-23,251
|
||||
2010-02-24,177
|
||||
2010-02-25,158
|
||||
2010-02-26,176
|
||||
2010-02-27,175
|
||||
2010-02-28,159
|
||||
2010-03-01,199
|
||||
2010-03-02,193
|
||||
2010-03-03,158
|
||||
2010-03-04,188
|
||||
2010-03-05,173
|
||||
2010-03-06,183
|
||||
2010-03-07,183
|
||||
2010-03-08,130
|
||||
2010-03-09,148
|
||||
2010-03-10,169
|
||||
2010-03-11,136
|
||||
2010-03-12,123
|
||||
2010-03-13,154
|
||||
2010-03-14,127
|
||||
2010-03-15,140
|
||||
2010-03-16,129
|
||||
2010-03-17,139
|
||||
2010-03-18,149
|
||||
2010-03-19,162
|
||||
2010-03-20,204
|
||||
2010-03-21,190
|
||||
2010-03-22,186
|
||||
2010-03-23,220
|
||||
2010-03-24,182
|
||||
2010-03-25,202
|
||||
2010-03-26,213
|
||||
2010-03-27,184
|
||||
2010-03-28,192
|
||||
2010-03-29,207
|
||||
2010-03-30,221
|
||||
2010-03-31,214
|
||||
2010-04-01,179
|
||||
2010-04-02,161
|
||||
2010-04-03,166
|
||||
2010-04-04,183
|
||||
2010-04-05,181
|
||||
2010-04-06,174
|
||||
2010-04-07,204
|
||||
2010-04-08,195
|
||||
2010-04-09,224
|
||||
2010-04-10,298
|
||||
2010-04-11,265
|
||||
2010-04-12,247
|
||||
2010-04-13,209
|
||||
2010-04-14,223
|
||||
2010-04-15,290
|
||||
2010-04-16,234
|
||||
2010-04-17,250
|
||||
2010-04-18,3351
|
||||
2010-04-19,276
|
||||
2010-04-20,243
|
||||
2010-04-21,251
|
||||
2010-04-22,199
|
||||
2010-04-23,200
|
||||
2010-04-24,202
|
||||
2010-04-25,205
|
||||
2010-04-26,211
|
||||
2010-04-27,233
|
||||
2010-04-28,227
|
||||
2010-04-29,180
|
||||
2010-04-30,170
|
||||
2010-05-01,210
|
||||
2010-05-02,180
|
||||
2010-05-03,188
|
||||
2010-05-04,177
|
||||
2010-05-05,162
|
||||
2010-05-06,177
|
||||
2010-05-07,158
|
||||
2010-05-08,182
|
||||
2010-05-09,183
|
||||
2010-05-10,157
|
||||
2010-05-11,130
|
||||
2010-05-12,159
|
||||
2010-05-13,167
|
||||
2010-05-14,153
|
||||
2010-05-15,113
|
||||
2010-05-16,133
|
||||
2010-05-17,178
|
||||
2010-05-18,223
|
||||
2010-05-19,207
|
||||
2010-05-20,237
|
||||
2010-05-21,235
|
||||
2010-05-22,226
|
||||
2010-05-23,309
|
||||
2010-05-24,250
|
||||
2010-05-25,254
|
||||
2010-05-26,287
|
||||
2010-05-27,267
|
||||
2010-05-28,277
|
||||
2010-05-29,239
|
||||
2010-05-30,200
|
||||
2010-05-31,194
|
||||
2010-06-01,183
|
||||
2010-06-02,194
|
||||
2010-06-03,235
|
||||
2010-06-04,173
|
||||
2010-06-05,190
|
||||
2010-06-06,200
|
||||
2010-06-07,209
|
||||
2010-06-08,223
|
||||
2010-06-09,220
|
||||
2010-06-10,217
|
||||
2010-06-11,247
|
||||
2010-06-12,213
|
||||
2010-06-13,239
|
||||
2010-06-14,257
|
||||
2010-06-15,269
|
||||
2010-06-16,192
|
||||
2010-06-17,204
|
||||
2010-06-18,193
|
||||
2010-06-19,214
|
||||
2010-06-20,228
|
||||
2010-06-21,242
|
||||
2010-06-22,227
|
||||
2010-06-23,257
|
||||
2010-06-24,240
|
||||
2010-06-25,210
|
||||
2010-06-26,201
|
||||
2010-06-27,234
|
||||
2010-06-28,230
|
||||
2010-06-29,264
|
||||
2010-06-30,273
|
||||
2010-07-01,284
|
||||
2010-07-02,241
|
||||
2010-07-03,286
|
||||
2010-07-04,224
|
||||
2010-07-05,252
|
||||
2010-07-06,208
|
||||
2010-07-07,218
|
||||
2010-07-08,223
|
||||
2010-07-09,268
|
||||
2010-07-10,240
|
||||
2010-07-11,353
|
||||
2010-07-12,2300
|
||||
2010-07-13,1479
|
||||
2010-07-14,6132
|
||||
2010-07-15,1330
|
||||
2010-07-16,1181
|
||||
2010-07-17,408
|
||||
2010-07-18,420
|
||||
2010-07-19,528
|
||||
2010-07-20,594
|
||||
2010-07-21,463
|
||||
2010-07-22,397
|
||||
2010-07-23,411
|
||||
2010-07-24,894
|
||||
2010-07-25,1823
|
||||
2010-07-26,467
|
||||
2010-07-27,426
|
||||
2010-07-28,1951
|
||||
2010-07-29,1867
|
||||
2010-07-30,325
|
||||
2010-07-31,295
|
||||
2010-08-01,364
|
||||
2010-08-02,398
|
||||
2010-08-03,648
|
||||
2010-08-04,439
|
||||
2010-08-05,515
|
||||
2010-08-06,359
|
||||
2010-08-07,273
|
||||
2010-08-08,391
|
||||
2010-08-09,424
|
||||
2010-08-10,340
|
||||
2010-08-11,412
|
||||
2010-08-12,392
|
||||
2010-08-13,516
|
||||
2010-08-14,434
|
||||
2010-08-15,315
|
||||
2010-08-16,453
|
||||
2010-08-17,318
|
||||
2010-08-18,377
|
||||
2010-08-19,325
|
||||
2010-08-20,423
|
||||
2010-08-21,342
|
||||
2010-08-22,366
|
||||
2010-08-23,369
|
||||
2010-08-24,379
|
||||
2010-08-25,365
|
||||
2010-08-26,368
|
||||
2010-08-27,294
|
||||
2010-08-28,339
|
||||
2010-08-29,260
|
||||
2010-08-30,329
|
||||
2010-08-31,441
|
||||
2010-09-01,380
|
||||
2010-09-02,321
|
||||
2010-09-03,319
|
||||
2010-09-04,274
|
||||
2010-09-05,311
|
||||
2010-09-06,278
|
||||
2010-09-07,282
|
||||
2010-09-08,339
|
||||
2010-09-09,324
|
||||
2010-09-10,360
|
||||
2010-09-11,305
|
||||
2010-09-12,379
|
||||
2010-09-13,436
|
||||
2010-09-14,424
|
||||
2010-09-15,430
|
||||
2010-09-16,438
|
||||
2010-09-17,361
|
||||
2010-09-18,399
|
||||
2010-09-19,355
|
||||
2010-09-20,465
|
||||
2010-09-21,810
|
||||
2010-09-22,673
|
||||
2010-09-23,655
|
||||
2010-09-24,501
|
||||
2010-09-25,532
|
||||
2010-09-26,400
|
||||
2010-09-27,603
|
||||
2010-09-28,491
|
||||
2010-09-29,975
|
||||
2010-09-30,365
|
||||
2010-10-01,584
|
||||
2010-10-02,501
|
||||
2010-10-03,377
|
||||
2010-10-04,407
|
||||
2010-10-05,371
|
||||
2010-10-06,407
|
||||
2010-10-07,340
|
||||
2010-10-08,363
|
||||
2010-10-09,401
|
||||
2010-10-10,363
|
||||
2010-10-11,342
|
||||
2010-10-12,352
|
||||
2010-10-13,364
|
||||
2010-10-14,367
|
||||
2010-10-15,328
|
||||
2010-10-16,441
|
||||
2010-10-17,457
|
||||
2010-10-18,579
|
||||
2010-10-19,924
|
||||
2010-10-20,713
|
||||
2010-10-21,552
|
||||
2010-10-22,602
|
||||
2010-10-23,517
|
||||
2010-10-24,552
|
||||
2010-10-25,410
|
||||
2010-10-26,518
|
||||
2010-10-27,568
|
||||
2010-10-28,486
|
||||
2010-10-29,467
|
||||
2010-10-30,426
|
||||
2010-10-31,307
|
||||
2010-11-01,351
|
||||
2010-11-02,286
|
||||
2010-11-03,347
|
||||
2010-11-04,342
|
||||
2010-11-05,442
|
||||
2010-11-06,394
|
||||
2010-11-07,451
|
||||
2010-11-08,515
|
||||
2010-11-09,409
|
||||
2010-11-10,397
|
||||
2010-11-11,395
|
||||
2010-11-12,286
|
||||
2010-11-13,343
|
||||
2010-11-14,416
|
||||
2010-11-15,4871
|
||||
2010-11-16,9105
|
||||
2010-11-17,435
|
||||
2010-11-18,1494
|
||||
2010-11-19,9632
|
||||
2010-11-20,9731
|
||||
2010-11-21,10044
|
||||
2010-11-22,343
|
||||
2010-11-23,341
|
||||
2010-11-24,3936
|
||||
2010-11-25,4983
|
||||
2010-11-26,1314
|
||||
2010-11-27,445
|
||||
2010-11-28,454
|
||||
2010-11-29,454
|
||||
2010-11-30,454
|
||||
2010-12-01,512
|
||||
2010-12-02,460
|
||||
2010-12-03,384
|
||||
2010-12-04,418
|
||||
2010-12-05,434
|
||||
2010-12-06,465
|
||||
2010-12-07,573
|
||||
2010-12-08,523
|
||||
2010-12-09,486
|
||||
2010-12-10,373
|
||||
2010-12-11,550
|
||||
2010-12-12,643
|
||||
2010-12-13,646
|
||||
2010-12-14,653
|
||||
2010-12-15,642
|
||||
2010-12-16,531
|
||||
2010-12-17,462
|
||||
2010-12-18,499
|
||||
2010-12-19,551
|
||||
2010-12-20,932
|
||||
2010-12-21,629
|
||||
2010-12-22,660
|
||||
2010-12-23,519
|
||||
2010-12-24,531
|
||||
2010-12-25,634
|
||||
2010-12-26,584
|
||||
2010-12-27,526
|
||||
2010-12-28,661
|
||||
2010-12-29,513
|
||||
2010-12-30,593
|
||||
2010-12-31,555
|
||||
2011-01-01,659
|
||||
2011-01-02,569
|
||||
2011-01-03,1128
|
||||
2011-01-04,979
|
||||
2011-01-05,1310
|
||||
2011-01-06,694
|
||||
2011-01-07,1020
|
||||
2011-01-08,1436
|
||||
2011-01-09,1223
|
||||
2011-01-10,1312
|
||||
2011-01-11,1362
|
||||
2011-01-12,1162
|
||||
2011-01-13,1266
|
||||
2011-01-14,1262
|
||||
2011-01-15,962
|
||||
2011-01-16,931
|
||||
2011-01-17,830
|
||||
2011-01-18,818
|
||||
2011-01-19,917
|
||||
2011-01-20,924
|
||||
2011-01-21,1166
|
||||
2011-01-22,1422
|
||||
2011-01-23,1081
|
||||
2011-01-24,1319
|
||||
2011-01-25,889
|
||||
2011-01-26,1005
|
||||
2011-01-27,841
|
||||
2011-01-28,1081
|
||||
2011-01-29,1347
|
||||
2011-01-30,2592
|
||||
2011-01-31,1393
|
||||
2011-02-01,1013
|
||||
2011-02-02,896
|
||||
2011-02-03,789
|
||||
2011-02-04,954
|
||||
2011-02-05,832
|
||||
2011-02-06,909
|
||||
2011-02-07,892
|
||||
2011-02-08,846
|
||||
2011-02-09,1227
|
||||
2011-02-10,2034
|
||||
2011-02-11,2355
|
||||
2011-02-12,1912
|
||||
2011-02-13,1822
|
||||
2011-02-14,2006
|
||||
2011-02-15,2224
|
||||
2011-02-16,2090
|
||||
2011-02-17,2250
|
||||
2011-02-18,2056
|
||||
2011-02-19,1583
|
||||
2011-02-20,1939
|
||||
2011-02-21,1970
|
||||
2011-02-22,2196
|
||||
2011-02-23,2263
|
||||
2011-02-24,2109
|
||||
2011-02-25,2060
|
||||
2011-02-26,1952
|
||||
2011-02-27,2269
|
||||
2011-02-28,1720
|
||||
2011-03-01,2729
|
||||
2011-03-02,2009
|
||||
2011-03-03,3204
|
||||
2011-03-04,1982
|
||||
2011-03-05,2048
|
||||
2011-03-06,2031
|
||||
2011-03-07,1926
|
||||
2011-03-08,2440
|
||||
2011-03-09,1834
|
||||
2011-03-10,1661
|
||||
2011-03-11,1884
|
||||
2011-03-12,2956
|
||||
2011-03-13,2711
|
||||
2011-03-14,2643
|
||||
2011-03-15,2854
|
||||
2011-03-16,3183
|
||||
2011-03-17,3367
|
||||
2011-03-18,2371
|
||||
2011-03-19,3189
|
||||
2011-03-20,4076
|
||||
2011-03-21,5855
|
||||
2011-03-22,2238
|
||||
2011-03-23,4570
|
||||
2011-03-24,2164
|
||||
2011-03-25,1999
|
||||
2011-03-26,3335
|
||||
2011-03-27,2463
|
||||
2011-03-28,2931
|
||||
2011-03-29,2718
|
||||
2011-03-30,1756
|
||||
2011-03-31,2095
|
||||
2011-04-01,1579
|
||||
2011-04-02,1772
|
||||
2011-04-03,1805
|
||||
2011-04-04,2309
|
||||
2011-04-05,2119
|
||||
2011-04-06,1864
|
||||
2011-04-07,1677
|
||||
2011-04-08,1767
|
||||
2011-04-09,1733
|
||||
2011-04-10,1744
|
||||
2011-04-11,1943
|
||||
2011-04-12,2077
|
||||
2011-04-13,2371
|
||||
2011-04-14,2881
|
||||
2011-04-15,2018
|
||||
2011-04-16,2154
|
||||
2011-04-17,2257
|
||||
2011-04-18,3035
|
||||
2011-04-19,3598
|
||||
2011-04-20,2969
|
||||
2011-04-21,1915
|
||||
2011-04-22,2097
|
||||
2011-04-23,2310
|
||||
2011-04-24,2273
|
||||
2011-04-25,2592
|
||||
2011-04-26,3455
|
||||
2011-04-27,4580
|
||||
2011-04-28,3035
|
||||
2011-04-29,3534
|
||||
2011-04-30,4473
|
||||
2011-05-01,3949
|
||||
2011-05-02,3095
|
||||
2011-05-03,2935
|
||||
2011-05-04,2800
|
||||
2011-05-05,3464
|
||||
2011-05-06,3290
|
||||
2011-05-07,3887
|
||||
2011-05-08,2898
|
||||
2011-05-09,3516
|
||||
2011-05-10,3151
|
||||
2011-05-11,3090
|
||||
2011-05-12,3361
|
||||
2011-05-13,4064
|
||||
2011-05-14,4414
|
||||
2011-05-15,3770
|
||||
2011-05-16,4349
|
||||
2011-05-17,4464
|
||||
2011-05-18,5581
|
||||
2011-05-19,4663
|
||||
2011-05-20,4795
|
||||
2011-05-21,4964
|
||||
2011-05-22,5282
|
||||
2011-05-23,5745
|
||||
2011-05-24,5865
|
||||
2011-05-25,6258
|
||||
2011-05-26,6967
|
||||
2011-05-27,4853
|
||||
2011-05-28,5013
|
||||
2011-05-29,4753
|
||||
2011-05-30,5337
|
||||
2011-05-31,6063
|
||||
2011-06-01,6540
|
||||
2011-06-02,7136
|
||||
2011-06-03,8441
|
||||
2011-06-04,8811
|
||||
2011-06-05,8592
|
||||
2011-06-06,9703
|
||||
2011-06-07,9002
|
||||
2011-06-08,11815
|
||||
2011-06-09,12176
|
||||
2011-06-10,11269
|
||||
2011-06-11,10897
|
||||
2011-06-12,12440
|
||||
2011-06-13,11246
|
||||
2011-06-14,14158
|
||||
2011-06-15,12605
|
||||
2011-06-16,12746
|
||||
2011-06-17,11296
|
||||
2011-06-18,11563
|
||||
2011-06-19,11472
|
||||
2011-06-20,11225
|
||||
2011-06-21,9704
|
||||
2011-06-22,11519
|
||||
2011-06-23,10418
|
||||
2011-06-24,10922
|
||||
2011-06-25,9693
|
||||
2011-06-26,9985
|
||||
2011-06-27,11751
|
||||
2011-06-28,10719
|
||||
2011-06-29,10002
|
||||
2011-06-30,9636
|
||||
2011-07-01,10603
|
||||
2011-07-02,8018
|
||||
2011-07-03,8364
|
||||
2011-07-04,9604
|
||||
2011-07-05,8965
|
||||
2011-07-06,10519
|
||||
2011-07-07,9180
|
||||
2011-07-08,8528
|
||||
2011-07-09,7851
|
||||
2011-07-10,8392
|
||||
2011-07-11,10523
|
||||
2011-07-12,8147
|
||||
2011-07-13,9193
|
||||
2011-07-14,8716
|
||||
2011-07-15,944
|
|
|
@ -0,0 +1,31 @@
|
|||
2009-01-01,2576
|
||||
2009-02-01,3417
|
||||
2009-03-01,3487
|
||||
2009-04-01,3459
|
||||
2009-05-01,3401
|
||||
2009-06-01,2244
|
||||
2009-07-01,1930
|
||||
2009-08-01,1570
|
||||
2009-09-01,2170
|
||||
2009-10-01,2139
|
||||
2009-11-01,2232
|
||||
2009-12-01,4084
|
||||
2010-01-01,5056
|
||||
2010-02-01,5751
|
||||
2010-03-01,5398
|
||||
2010-04-01,9631
|
||||
2010-05-01,6212
|
||||
2010-06-01,6678
|
||||
2010-07-01,26488
|
||||
2010-08-01,11968
|
||||
2010-09-01,13185
|
||||
2010-10-01,14386
|
||||
2010-11-01,63410
|
||||
2010-12-01,17142
|
||||
2011-01-01,34900
|
||||
2011-02-01,47168
|
||||
2011-03-01,83222
|
||||
2011-04-01,73936
|
||||
2011-05-01,136636
|
||||
2011-06-01,317482
|
||||
2011-07-01,127547
|
|
|
@ -0,0 +1,29 @@
|
|||
#!/usr/bin/perl
|
||||
# 3456789#123456789#123456789#123456789#123456789#123456789#123456789#123456789#
|
||||
# 20110715 jeffrey paul <sneak@datavibe.net>
|
||||
# 5539 AD00 DE4C 42F3 AFE1 1575 0524 43F4 DF2A 55C2 # please sign!
|
||||
# thanks to theymos of bitcoin block explorer for txcount.csv export dump
|
||||
|
||||
use strict;
|
||||
use warnings qw( all );
|
||||
use DateTime;
|
||||
use Data::Dumper;
|
||||
|
||||
sub main {
|
||||
open(DERP,'txcount.csv') or die;
|
||||
my $out = {};
|
||||
while(<DERP>) {
|
||||
chomp;
|
||||
next if /^#/;
|
||||
my @p = split(/,/);
|
||||
next unless @p == 3;
|
||||
my $dt = DateTime->from_epoch( epoch => $p[1] );
|
||||
$out->{$dt->ymd} += $p[2];
|
||||
}
|
||||
|
||||
foreach (sort(keys(%$out))) {
|
||||
print $_ . "," . $out->{$_} . "\n";
|
||||
}
|
||||
}
|
||||
|
||||
main();
|
|
@ -0,0 +1,28 @@
|
|||
#!/bin/sh
|
||||
|
||||
export PATH=""
|
||||
|
||||
if [ $# -ne 2 ]; then
|
||||
echo 1>&2 "Usage: $0 <seconds> <file>";
|
||||
exit 127
|
||||
fi
|
||||
|
||||
SECS=$[ $1 + 0 ]
|
||||
|
||||
if [ "$SECS" -lt 1 ]; then
|
||||
echo 1>&2 "error: seconds must be a positive integer"
|
||||
exit 127
|
||||
fi
|
||||
|
||||
if [ ! -f "$2" ]; then
|
||||
echo 1>&2 "error: invalid file $2"
|
||||
exit 127
|
||||
fi
|
||||
|
||||
NOW=`/bin/date +%s`
|
||||
FILE=`/usr/bin/stat -c '%Z' "$2"`
|
||||
FILEAGE=$[ $NOW - $FILE ]
|
||||
|
||||
if [ "$FILEAGE" -lt "$SECS" ]; then
|
||||
/bin/cat "$2"
|
||||
fi
|
|
@ -0,0 +1,185 @@
|
|||
#!/usr/bin/perl
|
||||
# 03 April 2008 (header added in 2011)
|
||||
# pub 4096R/DF2A55C2 2010-10-21
|
||||
# Key fingerprint = 5539 AD00 DE4C 42F3 AFE1 1575 0524 43F4 DF2A 55C2
|
||||
# uid Jeffrey Paul <sneak@datavibe.net>
|
||||
|
||||
use strict;
|
||||
use warnings qw( all );
|
||||
use LWP::UserAgent;
|
||||
use WWW::Mechanize;
|
||||
use Data::Dumper;
|
||||
use Mail::Internet;
|
||||
use MIME::Base64;
|
||||
|
||||
my $debug = 1;
|
||||
my $gcuser = 'grandcentral_user';
|
||||
my $gcpass = 'grandcentral_pass';
|
||||
|
||||
# this works as of 20080403:
|
||||
my $uastring = 'BlackBerry8320/4.2.2 Profile/MIDP-2.0 '.
|
||||
'Configuration/CLDC-1.1 VendorID/100';
|
||||
my $savedir = '/home/jpaulvoicemail/vm';
|
||||
my $mech;
|
||||
|
||||
main();
|
||||
|
||||
sub main {
|
||||
my $msg = loadmsg();
|
||||
my ($url,$mhash) = parse_email($msg);
|
||||
die("unable to fetch voicemail") unless $mhash;
|
||||
my $mp3data = fetch_vm($url);
|
||||
die("unable to fetch voicemail") unless $mp3data;
|
||||
my $h = fetch_voicemail_meta();
|
||||
die("unable to get metadata for this voicemail") unless $h->{$mhash};
|
||||
print Data::Dumper::Dumper($h->{$mhash});
|
||||
my $fn = $h->{$mhash}{'timestamp'} . "_" .
|
||||
$h->{$mhash}{'from'} . "_" .
|
||||
$mhash . ".mp3";
|
||||
writefile($savedir . "/" . $fn, $mp3data);
|
||||
}
|
||||
|
||||
sub parse_email {
|
||||
my $raw = shift;
|
||||
$raw =~ s/\s+/ /g;
|
||||
die unless $raw =~ /forwarded_messages\/\?unique_key\=([0-9a-f]+)\&mhash\=([0-9a-f]+)/;
|
||||
my $url =
|
||||
"http://www.grandcentral.com/".
|
||||
"forwarded_messages/?unique_key=$1&mhash=$2";
|
||||
return $url,$2;
|
||||
}
|
||||
|
||||
sub fetch_vm {
|
||||
my $url = shift;
|
||||
my $ua = LWP::UserAgent->new(
|
||||
agent => $uastring,
|
||||
cookie_jar => { }
|
||||
);
|
||||
$ua->env_proxy;
|
||||
$ua->timeout(10);
|
||||
my $r = $ua->get($url);
|
||||
return unless $r->is_success;
|
||||
die("wtf google") unless $r->content_type eq 'audio/mpeg';
|
||||
return $r->content;
|
||||
}
|
||||
|
||||
sub dout {
|
||||
return unless defined($debug) && $debug;
|
||||
my $msg = shift;
|
||||
chomp $msg;
|
||||
print STDOUT "*** $0: " . $msg . "\n";
|
||||
}
|
||||
|
||||
sub writefile {
|
||||
my $fn = shift;
|
||||
my $content = shift;
|
||||
open(OUT,">$fn") or die("Can't open $fn for writing: $!");
|
||||
print OUT $content;
|
||||
close(OUT);
|
||||
dout("wrote $fn");
|
||||
}
|
||||
|
||||
sub fetch_voicemail_meta {
|
||||
my $url = 'http://grandcentral.com/mobile';
|
||||
$mech = WWW::Mechanize->new( agent => $uastring);
|
||||
$mech->get( $url );
|
||||
die("unable to fetch vm list") unless $mech->success();
|
||||
$mech->submit_form(
|
||||
form_number => 1,
|
||||
fields => {
|
||||
username => $gcuser,
|
||||
password => $gcpass,
|
||||
},
|
||||
);
|
||||
die("unable to fetch vm list") unless $mech->success();
|
||||
$mech->submit_form(
|
||||
form_number => 1,
|
||||
fields => {
|
||||
default_number => 'custom',
|
||||
custom_number => '3131111111', #detroit uber alles
|
||||
},
|
||||
);
|
||||
die("unable to fetch vm list") unless $mech->success();
|
||||
$mech->follow_link( text => 'Inbox' );
|
||||
die("unable to fetch vm list") unless $mech->success();
|
||||
my @blocks = parse_page_into_vm_blocks($mech->content());
|
||||
return(lr2hr(\@blocks,'mhash'));
|
||||
}
|
||||
|
||||
sub parse_page_into_vm_blocks {
|
||||
my $in = shift;
|
||||
$in =~ s/\n/ /g;
|
||||
$in =~ s/\r/ /g;
|
||||
$in =~ s/\s+/ /g;
|
||||
die unless $in =~ /<table width="100%" cellspacing="0" cellpadding="0">(.*)<\/table>/;
|
||||
my $tablecontent = $1;
|
||||
my @rows = split(/\s*<\/tr>\s*/,$tablecontent);
|
||||
my @parsed;
|
||||
foreach my $row (@rows) {
|
||||
next unless $row =~ /send_voicemail/;
|
||||
push(@parsed,parse_vm_block($row));
|
||||
}
|
||||
return(@parsed);
|
||||
}
|
||||
|
||||
sub parse_vm_block {
|
||||
my $block = shift;
|
||||
my $out;
|
||||
die unless $block =~ /files\/send_voicemail\/([a-z0-9]+)/;
|
||||
$out->{'mhash'} = $1;
|
||||
|
||||
die unless $block =~ / ([0-9][0-9])\:([0-9][0-9]) ([AP]M)/;
|
||||
my $hh = $1;
|
||||
my $mm = $2;
|
||||
my $ap = $3;
|
||||
|
||||
$hh = '00' if ( $ap eq 'AM' && $hh eq '12');
|
||||
$ap = 'AM' if ( $ap eq 'PM' && $hh eq '12'); #stupid 12h time
|
||||
|
||||
$out->{'timestamp'} = $hh . $mm;
|
||||
$out->{'timestamp'} += 1200 if $ap eq 'PM'; #convert to 24h
|
||||
|
||||
die unless $block =~ /([0-9][0-9])\/([0-9][0-9])\/([0-9][0-9][0-9][0-9]) <br\/>/;
|
||||
$out->{'timestamp'} = $3 . $1 . $2 . $out->{'timestamp'};
|
||||
|
||||
$out->{'from'} = '0000000000';
|
||||
$out->{'from'} = $1 if $block =~ /destno=([0-9]+)/;
|
||||
|
||||
return $out;
|
||||
}
|
||||
|
||||
sub lr2hr {
|
||||
my $lr = shift;
|
||||
my $key = shift;
|
||||
my $r;
|
||||
foreach my $item (@{$lr}) {
|
||||
next unless $item->{$key};
|
||||
$r->{$item->{$key}} = $item;
|
||||
}
|
||||
return $r;
|
||||
}
|
||||
|
||||
sub loadmsg {
|
||||
my $raw = readinput();
|
||||
my @lines = split(/\n/,$raw);
|
||||
shift(@lines)
|
||||
until($lines[0] =~ /^Content-Transfer-Encoding\:\ base64/);
|
||||
shift(@lines);
|
||||
shift(@lines);
|
||||
$raw = join("\n",@lines);
|
||||
die unless $raw;
|
||||
$raw = MIME::Base64::decode_base64($raw);
|
||||
die unless $raw;
|
||||
return $raw;
|
||||
}
|
||||
|
||||
sub readinput {
|
||||
my $in;
|
||||
read(STDIN,$in,1024*10); # 10kB sufficient
|
||||
close(STDIN);
|
||||
return $in;
|
||||
}
|
||||
|
||||
1;
|
||||
|
||||
__END__
|
Loading…
Reference in New Issue