Skip to content

Instantly share code, notes, and snippets.

@siritori
Created June 26, 2011 07:27
Show Gist options
  • Save siritori/1047359 to your computer and use it in GitHub Desktop.
Save siritori/1047359 to your computer and use it in GitHub Desktop.
auto coins host suggester
#!/usr/bin/perl
my @sources = split(/\t/, `curl -s http://www.open.coins.tsukuba.ac.jp/status/coins/ | sed '32!d'`);
@sources = grep(/(cosmos|burnet|acacia)\d\d.*OK/, @sources);
for(my $i = 0; $i < $#sources+1; $i++) {
$sources[$i] =~ /(cosmos|burnet|acacia)(\d\d)/;
$sources[$i] = "$1$2.coins.tsukuba.ac.jp";
}
print "Content-type: text/html\n\n";
print $sources[rand($#sources)];
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment