scratchpad
OverlordQ
<code>
#!/usr/bin/perl
use Text::Unaccent;
use utf8;
unac_debug($Text::Unaccent::DEBUG_HIGH);
my $blah = unac_string('utf-8','Spontanansökan Produktion Bjuv');
print "U: $blah\n";
</code>
Working box:
<code>
unac.c:13708: unac_data0[19] & unac_positions[0][20]: 0x0053 => untouched
unac.c:13708: unac_data0[16] & unac_positions[0][17]: 0x0070 => untouched
unac.c:13708: unac_data0[15] & unac_positions[0][16]: 0x006f => untouched
unac.c:13708: unac_data0[14] & unac_positions[0][15]: 0x006e => untouched
unac.c:13708: unac_data0[20] & unac_positions[0][21]: 0x0074 => untouched
unac.c:13708: unac_data0[1] & unac_positions[0][2]: 0x0061 => untouched
unac.c:13708: unac_data0[14] & unac_positions[0][15]: 0x006e => untouched
unac.c:13708: unac_data0[1] & unac_positions[0][2]: 0x0061 => untouched
unac.c:13708: unac_data0[14] & unac_positions[0][15]: 0x006e => untouched
unac.c:13708: unac_data0[19] & unac_positions[0][20]: 0x0073 => untouched
unac.c:13708: unac_data3[23] & unac_positions[3][23]: 0x00f6 => 0x006f
unac.c:13708: unac_data0[11] & unac_positions[0][12]: 0x006b => untouched
unac.c:13708: unac_data0[1] & unac_positions[0][2]: 0x0061 => untouched
unac.c:13708: unac_data0[14] & unac_positions[0][15]: 0x006e => untouched
unac.c:13708: unac_data0[0] & unac_positions[0][1]: 0x0020 => untouched
unac.c:13708: unac_data0[16] & unac_positions[0][17]: 0x0050 => untouched
unac.c:13708: unac_data0[18] & unac_positions[0][19]: 0x0072 => untouched
unac.c:13708: unac_data0[15] & unac_positions[0][16]: 0x006f => untouched
unac.c:13708: unac_data0[4] & unac_positions[0][5]: 0x0064 => untouched
unac.c:13708: unac_data0[21] & unac_positions[0][22]: 0x0075 => untouched
unac.c:13708: unac_data0[11] & unac_positions[0][12]: 0x006b => untouched
unac.c:13708: unac_data0[20] & unac_positions[0][21]: 0x0074 => untouched
unac.c:13708: unac_data0[9] & unac_positions[0][10]: 0x0069 => untouched
unac.c:13708: unac_data0[15] & unac_positions[0][16]: 0x006f => untouched
unac.c:13708: unac_data0[14] & unac_positions[0][15]: 0x006e => untouched
unac.c:13708: unac_data0[0] & unac_positions[0][1]: 0x0020 => untouched
unac.c:13708: unac_data0[2] & unac_positions[0][3]: 0x0042 => untouched
unac.c:13708: unac_data0[10] & unac_positions[0][11]: 0x006a => untouched
unac.c:13708: unac_data0[21] & unac_positions[0][22]: 0x0075 => untouched
unac.c:13708: unac_data0[22] & unac_positions[0][23]: 0x0076 => untouched
U: Spontanansokan Produktion Bjuv
</code>
Other box:
<code>
unac_string: Invalid argument
U:
</code>
<hr>
<code>sub decrement {
my $string = shift;
return '' unless length($string);
my @parts = split//,$string;
my $last = pop @parts;
if( ord($last) == 32 ) {
my $ret = decrement(join '',@parts);
$ret .= (scalar @parts) ? "\x7E" : '';
return $ret;
} else {
my $ret = join '',@parts,chr(ord($last)-1);
return $ret;
}
}</code>
<hr>
<code>my $key = ( ( int( str2time($date) / $INTERVAL ) + ( str2time($date) % $INTERVAL ? 1 : 0 ) ) * $INTERVAL );</code>
<hr>
<code>
#!/usr/bin/perl
use File::Map qw(:map :constants);
use strict;
use warnings;
use Date::Parse;
use POSIX qw(strftime);
my $file = shift;
map_file(my $map, $file);
my %h;
my $re = qr/(?-xism:\[((?:\S+)\s+(?:\S+)\s+(?:\d+)\s+(?:\S+)\s+(?:\d{4}))\]\s+(?:\[(?:\w+)\])?).*(Timeout.*)/;
$h{$1}++ while $map =~ m{$re}g;
my $INTERVAL = 600;
my %blarg;
my $offset = 300;
foreach my $date (keys %h) {
my $key =
(
(
(
int( (str2time($date) - $offset ) / $INTERVAL ) +
( ( str2time($date) - $offset ) % $INTERVAL ? 1 : 0 )
)
) * $INTERVAL
) + $offset;
$blarg{$key}++;
}
my ($first) = (sort keys %blarg)[0];
my $window = $first;
while($window < time) {
my $now_string = strftime "%e, %I:%M:%S %p", localtime($window);
print "$now_string, " . ($blarg{$window} ? $blarg{$window} : 0) . "\n";
$window += $INTERVAL;
}
</code>