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
use strict; | |
use warnings; | |
my $sum = 0; | |
while(<>) { | |
if(m/\A# Query_time: ([0-9.]+)/){ | |
$sum = $sum + $1; | |
} | |
} |
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
package main | |
import ( | |
"bufio" | |
"crypto/md5" | |
"fmt" | |
"os" | |
"time" | |
goCache "github.com/pmylund/go-cache" |
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
# Prefix | |
set-option -g prefix C-z | |
# 日本語環境なら必須?? | |
setw -g utf8 on | |
set -g status-utf8 on | |
# status | |
set -g status-interval 10 | |
set -g status-bg colour100 |
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
use strict; | |
use warnings; | |
use utf8; | |
use IO::File; | |
use Text::CSV_XS; | |
use List::Util qw/shuffle/; | |
binmode STDOUT, ':utf8'; |
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
package main | |
import ( | |
"fmt" | |
"math/rand" | |
"time" | |
) | |
type weight struct { | |
weight float64 |
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
use strict; | |
use warnings; | |
use utf8; | |
use FindBin::libs; | |
use Acme::MorningMusume; | |
my $musume = Acme::MorningMusume->new; | |
my @active_members = $musume->members('active'); |
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
use strict; | |
use warnings; | |
use utf8; | |
use Acme::MorningMusume; | |
my $musume = Acme::MorningMusume->new; | |
my @active_members = $musume->members('active'); | |
my @sorted_by_birthday = $musume->sort('birthday', 0, @active_members); |
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
N = 2**60 | |
r = 1.0 | |
(1..7000000).each do |i| | |
r *= ((N.to_f - i + 1) / N) | |
end | |
p 1 - r |
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
#include <cstdio> | |
void dump(unsigned char *p, int n) { | |
for (int i = n - 1; i >= 0; i--) { | |
printf("%02x ", p[i]); | |
} | |
printf("\n"); | |
} | |
int main() { |
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
APP_PI = 3.14 | |
app_pis = (3..1000).map { |n| n * Math.sin(Math::PI / n) } | |
ans = 0 | |
app_pis.each_with_index do |item, n| | |
if (item - APP_PI).abs < (app_pis[ans] - APP_PI).abs | |
ans = n | |
end |