Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

全裸でワンライナー(仮)

2,707 views

Published on

Yokohama.pm 出張版 in YAPC::Asia 2009 前夜祭で喋ったLightningTalksの資料です。
http://yokohama.pm.org/2009/08/yokohamapm-in-yapcasia-2009-1.html

Published in: Technology
  • Be the first to comment

全裸でワンライナー(仮)

  1. 1. my $profile = { name => ' ', id => 'sugyan', age => 26, };
  2. 2. perl -le 'print "Hello"'
  3. 3. perl -e'print$b,($a/=$b)- 1?"*":$/while$b=(grep{not $a%$_}1..($a||=pop))[1]' 60 2*2*3*5
  4. 4. perl -le'$x=2**pop;print$ "x--$x,map$x&$_?$"x2:"/ ",0..$y++while$x' 2 / // / / ////
  5. 5. for i in $(echo 0{0..9}{0 ..5}{0..9} {10..23}{0..5} {0..9}); do wget -w5 --ra ndom-wait http://*******/ $i.jpg; done
  6. 6. perl -MText::MeCab -MNet::Twitter -MEncode=encode_utf8 -e ' my $t = '''Net::Twitter'''->new('''username''', ''sugy an''', '''password''', '''******''');my $statuses = $t ->friends_timeline;my $status = $$statuses[rand @$statuses] ;my $text = encode_utf8($$status{'''text'''});my $user = $$status{'''user'''}{'''screen_name'''};$text =~ s/ [^ s]+ /z($&);/egmsx;$t->update("@$user 343201214350250 200343201243343201237: $text");sub z {my $text = shif t @_;my $zenra = "345205250350243270343201247";my $mecab = '''Text::MeCab'''->new;my $n = $mecab->parse($te xt);my $output = '''''';$n = $n->next while $n->next;my $ flg = 0;while (($n = $n->prev)->prev) {if ($flg) {my $inser t = 1;if ($n->feature =~ / A (345220215350251236|34 5211257350251236|345213225350251236) /msx) {$ins ert = 0;}elsif ($n->feature =~ / A 345212251(3452132 25)?350251236 /msx and (split(/,/, $n->prev->feature, 0) )[5] =~ / 351200243347224250 /msx) {$insert = 0;}if ( $insert) {$output = $zenra . $output;$flg = 0;}}$output = $ n->surface . $output;if ($n->feature =~ / A 3452132253 50251236 /msx) {$flg = 1;}}if ($flg) {$output = $zenra . $output;}return $output;}'
  7. 7. hoge.pl #!/usr/bin/perl use List::Util 'max'; my @a = (4, 2, 3); print max(@a), "n";
  8. 8. % perl -MAcme::OneLiner hoge.pl
  9. 9. % perl -MAcme::OneLiner hoge.pl perl -e 'use List::Util ('''max' ''); my(@a) = (4, 2, 3);print ma x(@a), "n";'
  10. 10. % perl -MAcme::OneLiner hoge.pl
  11. 11. % perl -MAcme::OneLiner hoge.pl perl -e 'use List::Util ('''max'''); my(@a) = (4, 2, 3); print max(@a), "n ";'
  12. 12. % perl -MAcme::OneLiner hoge.pl perl -e 'use List::Util ('''max'''); my(@a) = (4, 2, 3); print max(@a), "n ";' % perl -MAcme::OneLiner=short hoge.pl
  13. 13. % perl -MAcme::OneLiner hoge.pl perl -e 'use List::Util ('''max'''); my(@a) = (4, 2, 3); print max(@a), "n ";' % perl -MAcme::OneLiner=short hoge.pl perl -MList::Util=max -e 'my(@a) = (4, 2, 3);print max(@a), "n";'
  14. 14. % perl -MAcme::OneLiner hoge.pl
  15. 15. % perl -MAcme::OneLiner hoge.pl perl -e 'use List::Util ('''max'''); m y(@a) = (4, 2, 3); print max(@a), "n";'
  16. 16. % perl -MAcme::OneLiner hoge.pl perl -e 'use List::Util ('''max'''); m y(@a) = (4, 2, 3); print max(@a), "n";' % perl -MAcme::OneLiner=symbol hoge.pl
  17. 17. % perl -MAcme::OneLiner hoge.pl perl -e 'use List::Util ('''max'''); m y(@a) = (4, 2, 3); print max(@a), "n";' % perl -MAcme::OneLiner=symbol hoge.pl perl -e '""!~("(?{".("!(==>+/#[#%~/<&*=- ,{<+-%,+#`;,|-.:#>/<>{;]>#{&?{}%}!{{]>?< #/_,#;"^"|}}`/|`}:&_&;{=_;<-+%>-~|{.]{?` *#>>?%-,&%_(-%/~<&,:;.{#|+?-./<<>"^"(&%} ]><*[?/,}+;]!|`(><;{=)%}!:<:-,)-*#>}-+-. .{()/)*{-(>#=/.#,~=>")."})")'
  18. 18. To install this module, ... perl Makefile.PL make make test make install To install with Module::Build, ... perl Build.PL ./Build ./Build test ./Build install
  19. 19. To install this module, ... perl -MExtUtils::MakeMaker -Mwarnings make make test make install To install with Module::Build, ... perl -MModule::Build -Mwarnings -Mstr ./Build ./Build test ./Build install
  20. 20. -Mstrict=refs -e 'WriteMakefile(q/NAME/, ict=refs -e 'my $builder = q/Module::Build
  21. 21. q/Acme::OneLiner/, q/AUTHOR/, q/Yoshihiro /->new(q/module_name/, q/Acme::OneLiner/,
  22. 22. Sugi <sugi1982@gmail.com>/, q/VERSION_FROM q/license/, q/perl/, q/dist_author/, q/Yos
  23. 23. /, q/lib/Acme/OneLiner.pm/, q/ABSTRACT_F hihiro Sugi <sugi1982@gmail.com>/, q/dist_
  24. 24. ROM/, q/lib/Acme/OneLiner.pm/, q/PL_FILE version_from/, q/lib/Acme/OneLiner.pm/,
  25. 25. S/, {}, q/PREREQ_PM/, {q/Test::More/, 0, q q/requires/, {q/Test::More/, 0, q/version/
  26. 26. /version/, 0, q/IO::CaptureOutput/, 0}, q/ , 0, q/IO::CaptureOutput/, 0}, q/add_to_cl
  27. 27. dist/, {q/COMPRESS/, q/gzip -9f/, q/SUFFIX eanup/, [q/Acme-OneLiner-*/]); $builder->c
  28. 28. /, q/gz/}, q/clean/, {q/FILES/, q/Acme-One reate_build_script;'
  29. 29. Liner-*/});'
  30. 30. To install this module, ... perl -MExtUtils::MakeMaker -Mwarni... make make test make install To install with Module::Build, ... perl -MModule::Build -Mwarnings -M... ./Build ./Build test ./Build install

×