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 | |
# himado-dl.pl by xtetsuji at 2015/07/06 | |
# | |
# あえてオブジェクト志向を使わないで雑に書いているけれど | |
# これ以上拡張するならモジュールにわけるほうがいいよね | |
# ここまで書くとオブジェクト指向のありがたみがわかるけれど、 | |
# 一枚スクリプトでやること上から書いておくと詳しくない人もいじれて便利という側面も | |
# | |
# 些細なものでも、改良コードあればお知らせください |
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
$ ruby zabbix-access.rb | |
D4 .../zbxapi-0.3.10/zbxapi.rb:json_obj:203 Method:: user.login | |
D4 .../zbxapi-0.3.10/zbxapi.rb:do_request:415 Sending: {"jsonrpc":"2.0","method":"user.login","params":{"user":"XXXXXXXX","password":"xxxxxxxx"},"id":0} | |
D4 .../zbxapi-0.3.10/zbxapi.rb:do_request:417 Response Code: 200 | |
D4 .../zbxapi-0.3.10/zbxapi.rb:do_request:418 Response Body: {"jsonrpc":"2.0","result":"d4e6de9dd281c131e2858cb2880d890b","Id":0} | |
D4 .../zbxapi-0.3.10/zbxapi.rb:json_obj:203 Method:: APIInfo.version | |
D4 .../zbxapi-0.3.10/zbxapi.rb:do_request:415 Sending: {"jsonrpc":"2.0","method":"APIInfo.version","params":{},"id":1} | |
D4 .../zbxapi-0.3.10/zbxapi.rb:do_request:417 Response Code: 200 | |
D4 .../zbxapi-0.3.10/zbxapi.rb:do_request:418 Response Body: {"jsonrpc":"2.0","error":{"code":-32602,"message":"Invalid params.","data":"Not authorized"},"id":1} | |
D4 .../zbxapi-0.3.10/zbxapi.rb:json_obj:203 Method:: user.authenticate |
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 | |
# revclip - xtetsuji 2015/04/02 | |
use strict; | |
use warnings; | |
my $GIT_BASE = "$ENV{HOME}/git/\@private/revclip"; | |
if ( !-d $GIT_BASE ) { | |
die "Directory $GIT_BASE is not found."; |
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 v5.10; | |
use strict; | |
use warnings; | |
for my $i (1..10) { | |
say "num is $i"; | |
} |
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 | |
# 2015/02/27 OGATA Tetsuji (@xtetsuji) | |
# MIT License | |
use strict; | |
use warnings; | |
use Encode; | |
use JSON::PP; |
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 | |
# 2005/02/28 - 2014/02/16 | |
use strict; | |
use LWP::UserAgent; | |
use LWP::Simple qw(get); | |
my $VERBOSE = $ENV{VERBOSE} || $ENV{PS1}; | |
my $IP_ADDR_GET_URL = 'http://hpcgi3.nifty.com/almost-everywhere/remote_ip.cgi'; # IPアドレスを調べるURL |
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 | |
use strict; | |
use warnings; | |
BEGIN { | |
*CORE::GLOBAL::ref = sub { return "HELLO"; }; | |
} | |
my $hash = { |
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
### まずは ls -l ~/.plenv の中を見てみる | |
ogata@macbookair:~$ ls -l ~/.plenv | |
total 88 | |
-rw-r--r-- 1 ogata staff 3399 2 3 2014 Changes | |
-rw-r--r-- 1 ogata staff 18359 2 3 2014 LICENSE | |
-rw-r--r-- 1 ogata staff 546 2 3 2014 Makefile | |
-rw-r--r-- 1 ogata staff 12025 2 3 2014 README.md | |
drwxr-xr-x 3 ogata staff 102 2 3 2014 author/ | |
drwxr-xr-x 3 ogata staff 102 2 3 2014 bin/ | |
drwxr-xr-x 4 ogata staff 136 5 27 19:56 build/ |
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 | |
# ファイルの冒頭にデータを追加する | |
# open my $fh, '>>', $file; は末尾追加になるのでこれをどうするか | |
# 超巨大なファイルを想定して、一時ファイルを作る方法で丸呑みを最小限にして | |
# メモリ消費をおさえて書き直すという作戦を取る | |
use strict; | |
use warnings; | |
use File::Copy qw(move); |
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
#include <stdio.h> | |
int main(int a, char *b[]) { | |
int i, j; | |
char buf[256]; | |
char *get[6] = { | |
"今だ!w番ゲットォォォォ!!", | |
" ̄ ̄ ̄ ̄ ̄∨ ̄ ̄ ̄ (´´", | |
" ∧ ∧ (´⌒(´", | |
" ⊂(゚Д゚⊂⌒`つ≡≡≡(´⌒;;;≡≡≡", | |
"  ̄ ̄ (´⌒(´⌒;;", |