This file contains hidden or 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 | |
# $_ is truly global variable | |
# $a is especially global varialble (for sort and some function). is not trully? | |
use strict; | |
use warnings; | |
use v5.10; | |
# initialize strictly | |
undef $_; |
This file contains hidden or 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
$ perl -MTime::HiRes=ualarm -E 'ualarm(3600 * 10**6);' | |
Time::HiRes::ualarm(-694967296, 0): negative time not invented yet at -e line 1. | |
$ perl -MTime::HiRes=ualarm -E 'ualarm(360 * 10**6);' | |
$ perl -MTime::HiRes=ualarm -E 'say(log(3600 * 10**6)/log(2));' | |
31.7453497605412 |
This file contains hidden or 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 ModPerl::DenyFakeBot; | |
# PerlPostReadRequestHadnler ModPerl::DenyFakeBot | |
use strict; | |
use warnings; | |
use APR::Table (); | |
use Apache2::Connection (); | |
use Apache2::RequestRec (); | |
use Apache2::RequestUtil (); |
This file contains hidden or 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 | |
# xtetsuji 2016/03/31 | |
# Syslog format does not have year information. | |
# So this script detect related year as y<digit>. | |
use strict; | |
use warnings; | |
use IO::File; |
This file contains hidden or 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
#!/bin/bash | |
ARG1="$1" | |
shift | |
JSRUN="osascript -l JavaScript" | |
COMMAND_LIST="gcal|chrome_tabs|round_tabs" | |
function dispatch_gcal { |
This file contains hidden or 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 strict; | |
use warnings; | |
my @signals = map { uc } split /\s+/, qx{/bin/kill -l}; | |
$SIG{$_} = sub { | |
my $signal = shift; | |
print "signal=$signal\n"; |
This file contains hidden or 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 | |
# xtetsuji 2015/11/05 | |
use v5.10; | |
use strict; | |
use warnings; | |
use Term::ANSIColor; | |
my $syslog_re = qr/^(?<date>\w\w\w [ \d]\d) (?<time>\d\d:\d\d:\d\d) (?<host>\S+) (?<process>\S+): (?<message>.*)/; |
This file contains hidden or 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/env perl | |
# xtetsuji 2015/10/23 | |
# Perl 5.14 or its higher version have no dependency. | |
use strict; | |
use warnings; | |
use HTTP::Tiny; | |
use JSON::PP; | |
use Getopt::Long; |
This file contains hidden or 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 | |
# アットビリング用に設定できるパスワードのチェック | |
# OGATA Tetsuji at 2015/09/05 | |
# MITライセンスなのでご自由にどうぞ | |
use strict; | |
use warnings; | |
my $string = shift; |
This file contains hidden or 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 strict; | |
use warnings; | |
# 超巨大な整数を扱う | |
use bigint; | |
use Math::BigInt; | |
# memoize すれば CPUコストは減らせるけれど、強烈な大きさの数の検査をするとメモリを食い潰しそうなのでなんとも |