teiten hacks
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 | |
use YAML; | |
my $tmpfile = 'teiten.tmp'; | |
open F, '<', 'teiten.data'; | |
my $data = join "", <F>; | |
my $params = {}; | |
foreach my $pairs ( split /&/, $data ) { | |
my($n, $v) = split /=/, $pairs; | |
$params->{$n} = $v; | |
} | |
my @pixels = split /\%2C/, $params->{colors}; | |
#my @pixels = (@pixels, @pixels,@pixels, @pixels); | |
open F, '>', $tmpfile; | |
print F 'colors='; | |
print F join '%2C', map { | |
my $r = hex substr($_, 0, 2); | |
my $g = hex substr($_, 2, 2); | |
my $b = hex substr($_, 4, 2); | |
if ( 0 ) { | |
$_; | |
} else { | |
my $avg = int(($r+$g+$b)/3); | |
sprintf('%02x%02x%02x', | |
$avg, # ($r), | |
$avg, # ($g), | |
$avg, # ($b), | |
); | |
} | |
} @pixels; | |
print F '&'; | |
print F '&h=120&w=160'; | |
print qx{curl -v --cookie teiten.cookie --data "\@$tmpfile" http://teiten.org/snapshot.php} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment