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 Sys::Syslog; | |
#use Carp; | |
BEGIN { | |
( my $basename = $0 ) =~ s{.*/}{}; |
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 %seen; | |
for my $i (1..9) { | |
for my $j (1..9) { | |
$seen{$i * $j}++; |
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 $sum = 0; | |
for my $i (1..9) { | |
for my $j (1..9) { | |
$sum += $i * $j; |
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 Time::HiRes qw(usleep time); | |
while(1) { | |
printf "%s [%s]\n", time, scalar localtime; | |
# 0.1秒 = 10**5 microsecond |
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/10/26 | |
# qqns.pl - qq.com の MX を qq.com の NS 群全部に問い合わせをして、その記録を取る | |
# | |
# 何も考えず雑に書いたのでかなり適当です | |
# qq.com の NS のうち複数が返答しない場合があるらしく、その調査観察を行うためのスクリプトです | |
use v5.10; | |
use strict; | |
use warnings; |
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 | |
set -eu | |
declare -a ar=() | |
echo length ${#ar[*]} | |
for i in {1..10} ; do | |
# set -u のときは array push のときに中身が無い ${ar[*]} を参照できない |
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; | |
# こういう forward 関数(仮名)があれば | |
sub forward { | |
my $landing_cb = pop; | |
my @sub_returns = @_; |
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 Term::ANSIColor qw(colored); | |
my %mon_digit_of = ( | |
qw(Jan 1 Feb 2 Mar 3 Apr 4 May 5 Jun 6 Jul 7 Aug 8 Sep 9 Oct 10 Nov 11 Dec 12) | |
); |
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 | |
# mhls MH_FILENAME ... | |
# MH 形式のファイルを引数に与えるとファイルサイズとDateヘッダから導き出される日付を表示します | |
use strict; | |
use warnings; | |
use Date::Format qw(time2str); | |
use Date::Parse qw(str2time); | |
use List::Util qw(first); |
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
$ for i in {-1..364} ; do ymd=$(date +%Y%m%d -d "2016/01/01 $i days tomorrow") ; if factor $ymd | grep -E "^$ymd: $ymd$" >/dev/null ; then echo $ymd ; fi ; done | cat -n | |
1 20160319 | |
2 20160401 | |
3 20160403 | |
4 20160529 | |
5 20160601 | |
6 20160607 | |
7 20160611 | |
8 20160709 | |
9 20160727 |