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
#!/usr/bin/env perl | |
use strict; | |
use warnings; | |
use Sisimai::Address; | |
use Data::Dumper; | |
my $addr = 'kijitora(Neko-Can Sale!!!!)-nyaan@exam(https://example.com/?code=22)ple.jp'; | |
my $data = Sisimai::Address->find($addr); | |
warn 'Email = '.$addr; |
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
#!/usr/bin/env perl | |
# macOSの/usr/bin/grepでマルチバイト文字の検索が上手くいかないのでPerlでどうにかする | |
use strict; | |
use warnings; | |
use IO::File; | |
die sprintf("Usage: %s file1 [file2 [file3 ...]]\n", $0) unless @ARGV; | |
for my $fn ( @ARGV ) { | |
# ファイルが無い・読めない・空の場合は無視する | |
next unless -f $fn; |
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
#!/usr/bin/env perl | |
# Captured $1 vs. ${^MATCH} | |
use strict; | |
use warnings; | |
use Benchmark ':all'; | |
use Test::More 'no_plan'; | |
my $q = 'neko-nyaan-cat'; | |
sub doller { |
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
#!/usr/bin/env perl | |
# Captured $1 vs. ${^MATCH} | |
use strict; | |
use warnings; | |
use Benchmark ':all'; | |
use Test::More 'no_plan'; | |
my $q = ' neko nyaan cat '; | |
sub s3 { | |
my $v = shift; |
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
#!/usr/bin/env perl | |
# Captured $1 vs. ${^MATCH} | |
use strict; | |
use warnings; | |
use Benchmark ':all'; | |
use Test::More 'no_plan'; | |
my $q = 'neko-nyaan-cat'; | |
sub cv { |
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
#!/usr/bin/env perl | |
# my $p = sub {} vs. my sub p {} | |
use strict; | |
use warnings; | |
use Benchmark ':all'; | |
use Test::More 'no_plan'; | |
sub sr1 { | |
my $p = sub { return 2 * shift }; | |
return $p->(shift); |
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
#!/usr/bin/env perl | |
# @{ $neko->{'nyaan'} } vs. $neko->{'nyaan'}->@* | |
use strict; | |
use warnings; | |
use Benchmark ':all'; | |
use Test::More 'no_plan'; | |
my $neko1 = { 'nyaan' => \'2', 'cat' => [1..10] }; | |
my $neko2 = { 'nyaan' => \'2', 'cat' => [1..10] }; |
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
// _ _ _ _ | |
// ___ _ __ ___ | |_ _ __ __ _ _ _| |_| |__ _ __ __ _ ___ _____ _____ _ __ __| | | |
// / __| '_ ` _ \| __| '_ \ / _` | | | | __| '_ \ _____| '_ \ / _` / __/ __\ \ /\ / / _ \| '__/ _` | | |
// \__ \ | | | | | |_| |_) | (_| | |_| | |_| | | |_____| |_) | (_| \__ \__ \\ V V / (_) | | | (_| | | |
// |___/_| |_| |_|\__| .__/ \__,_|\__,_|\__|_| |_| | .__/ \__,_|___/___/ \_/\_/ \___/|_| \__,_| | |
// |_| |_| | |
package main | |
// Usage: | |
// $ go run ./smtpauth-password [email protected] password-string-for-smtp-authentication |
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
#!/usr/bin/env perl | |
use strict; | |
use warnings; | |
use MIME::Base64; | |
use Digest::SHA; | |
my $secret = shift or die('The 1st argument should be an access secret key'); | |
my $region = shift or die('The 2nd argument should be a valid region name'); | |
my $params = { | |
'date' => '11111111', |
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
#!/usr/bin/env perl | |
use strict; | |
use warnings; | |
my $p = shift; | |
if( $p =~ /(\d+)/ ) { | |
printf("西暦%d年ぐらい???\n", int($1) + int(rand(2000)) + int(rand(1800)) + int(rand(50))); | |
} |
NewerOlder