return sum(@order) / @order;
}
elsif ($func =~ /\A([0-9.]+)v\z/) {
+ die "Invalid marker $char: percentile $1 out of bounds\n" if $1 > 100;
my $index = $#order * $1 / 100;
return ($order[$index] + $order[$index + .5]) / 2;
}
- else {
+ elsif ($func =~ /\A-?[0-9.]+\z/) {
return $func;
}
- } - $minval;
+ else {
+ die "Unknown marker $char: $func\n";
+ }
+ };
+ defined $pos or do {
+ warn $@ if $@;
+ next;
+ };
+ $pos -= $minval;
$pos >= 0 or next;
color(36) for $barmark[$pos * $size] = $char;
}
Earthquakes worldwide magnitude 1+ in the last 24 hours:
- https://earthquake.usgs.gov/earthquakes/feed/v1.0/summary/1.0_day.csv |
+ curl https://earthquake.usgs.gov/earthquakes/feed/v1.0/summary/1.0_day.csv |
column -tns, | barcat -f4 -u -l80%
External datasets, like movies per year:
- curl https://github.com/prust/wikipedia-movie-data/raw/master/movies.json |
+ curl https://github.com/prust/wikipedia-movie-data/raw/master/movies.json -L |
perl -054 -nlE 'say if s/^"year"://' | uniq -c | barcat
But please get I<jq> to process JSON
Pokémon height comparison:
- curl https://github.com/Biuni/PokemonGO-Pokedex/raw/master/pokedex.json |
+ curl https://github.com/Biuni/PokemonGO-Pokedex/raw/master/pokedex.json -L |
jq -r '.pokemon[] | [.height,.num,.name] | join(" ")' | barcat
USD/EUR exchange rate from CSV provided by the ECB:
Total population history in XML from the World Bank:
- curl http://api.worldbank.org/v2/country/1W/indicator/SP.POP.TOTL |
+ curl http://api.worldbank.org/v2/country/1W/indicator/SP.POP.TOTL -L |
xmllint --xpath '//*[local-name()="date" or local-name()="value"]' - |
sed -r 's,</wb:value>,\n,g; s,(<[^>]+>)+, ,g' | barcat -f1 -H