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; | |
package Bunch { | |
sub new { | |
my $class = shift; | |
my $self = {@_}; |
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
Linux-JP | |
jman | |
http://linuxjm.osdn.jp/cgi-bin/man.cgi?Pagename=%s&submit=Search%21&Sec1=on&Sec2=on&Sec3=on&Sec4=on&Sec5=on&Sec6=on&Sec7=on&Sec8=on |
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 lib "."; # Module search path | |
use File::Basename qw/basename dirname/; | |
use Pod::Usage; | |
use Getopt::Long qw(:config posix_default no_ignore_case gnu_compat); |
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
# 標準出力・標準エラー出力のバッファリングをしない | |
{ $|=1; my $_old = select(STDERR); $|=1; select($_old); } | |
# 入力時の行区切り指定 | |
local $/ = "\r\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
# スプレッドシートの37万8861列目は UNKO | |
echo UNKO | perl -aple 'my($d,$x);for(map ord(uc$_)-65,reverse split//,$F[0]){$x+=($_+1)*(26**$d++)};$_=$x' | |
# dcイディオム(map) | |
seq 10 | dc -e '[2*]sF' -e '?[lFxpc?z0<.]ds.x' | |
# dcイディオム(reduce) | |
seq 10 | dc -e '[+]sF?' -e '?[lFx?z1<.]s.z0<.p' | |
# 10進encode | |
printf akanehara | xxd -u -p | tr -d '\n' | dc -e '16i?p' | tr -d '\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
VBoxManage list runningvms | awk '$0=$1' | tr -d '"' | xargs -n1 -I@ VBoxManage controlvm @ acpipowerbutton | |
VBoxManage list vms | sed -E 's/"(.+)".*$/\1/' | tr '\n' '\0' | xargs -0 -I@ VBoxManage unregistervm @ --delete | |
# 事前ソート不要の uniq | |
awk '!s[$0]{s[$0]=1;print}' | |
# nl 用例 | |
# - ゼロ埋め2桁連番空白セパレータ | |
nl -nrz -w2 -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
curl -s "https://kokkai.ndl.go.jp/api/speech?$(echo 'speaker=斎藤衛' | perl -MURI::Escape -ple '$_=uri_escape $_;')" | xmllint --encode utf-8 --xpath "//session|//date|//speech|//speaker" - | nkf --numchar-input | tr -d '\n' | LANG=C LC_ALL=C sed -e 's/ *//g' | sed -e 's/<[\/0-9a-zA-Z]*>/ /g' | xargs -n4 |
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
curl -s "https://kokkai.ndl.go.jp/api/speech?$(echo 'spaker=辻本清美&any=疑惑の総合商社' | perl -MURI::Escape -ple '$_=uri_escape $_;')" | xmllint --encode utf-8 --xpath "//speechRecord/session|//speechRecord/date|//speechRecord/speech|//speechRecord/speaker" - | nkf --numchar-input | gtr -d '\n' | gsed -e 's/[:space:]*//g' | gsed -e 's/<[\/0-9a-zA-Z]*>/ /g' | xargs -n4 |
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 ArrayUtil; | |
use strict; | |
use warnings; | |
use Exporter; | |
our @ISA = qw/Exporter/; | |
our @EXPORT_OK = qw/ | |
uniq | |
any |
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
BEGIN { | |
OFS = "\t"; | |
E = L-1 ;A = 0; I = 1; | |
do { | |
B = A + W - 1; | |
if (E < B) B = E; | |
print A, B; | |
A = B + 1; | |
} while (A < L); | |
} |