七行プログラミング (452レス)
七行プログラミング http://medaka.5ch.net/test/read.cgi/php/1036141603/
上
下
前
次
1-
新
通常表示
512バイト分割
レス栞
392: nobodyさん [sage] 2006/01/27(金) 22:18:05 ID:??? 7ナビ 同一階層以下のHTMLにリンクを貼る。携帯用サイトマップみたいなもん。 $d='./';$e='s?html?';$n=10;@l=(['prev',-1],['next',1]);use CGI':all';sub r{my( $d,$e)=@_;map{if(-d){r($_,$e)}elsif(/\.$e$/&&$p<=$c++&&$c<=$p+$n&&open F,$_){-B ||read F,$h,2**16;close F;$h=~/>\s*([^<>]*?)\s*<\/ti/is;[$_,$1||$_]}else{()}} <$d/*>}$p+=param 'p';($d)=$d=~/(.+?)[\\\/]*$/;@r=r$d,$e;if($p<0){$p=$c-$c%$n;$c =0;@r=r$d,$e}elsif(!@r){$p=0;$c=0;@r=r$
d,$e}charset '';put header,dl dt(map a({ href=>"?p=".($p+$n*$_->[1])},$_->[0]),@l),dd{style=>'margin:0px'},join"\n",ol({ start=>1+$p},li[map a({href=>$_->[0]},$_->[1]),@r]),p"$c files" http://medaka.5ch.net/test/read.cgi/php/1036141603/392
393: nobodyさん [sage] 2006/01/27(金) 22:19:01 ID:??? 7 httpd これはCGIじゃないよ。 起動でlistenとhttp://127.0.0.1/index.htmlで表示。 Options Indexes があるはずも無いのでファイル名まで指定。 if(!grep(/^SERVER/i,keys%ENV)&&socket(S,2,1,0)&&setsockopt(S,65535,4,pack'l',1) &&bind(S,pack'S n a4 x8',2,80)&&listen S,1){select+(select(S),$|=1)[0];while( accept C,S){select+(select(C),$|=1)[0];@r=unpack"C*",getpeername C;if(recv(C,$d ,8192,0)&&$d=~/^GET ([\x21-\x7e]{1,256}) H/ and$p=join'/',map{s/\.+/./g;$_}grep l
ength,split/[\\\/]+/,$1){print C 'HTTP/1.0 ',do{$n="\r\n\r\n";if(open F,"./$p" ){binmode F;read F,$b,-s F;close F;"200$n$b"}else{"404${n}Not Found\n"}};undef $b}close C;printf"$d%d.%d.%d.%d:%d\n%s\n",@r[4..7],256*$r[2]+$r[3],'-'x 64}} http://medaka.5ch.net/test/read.cgi/php/1036141603/393
394: nobodyさん [age] 2006/01/30(月) 04:20:47 ID:??? みんながんがれ!! http://medaka.5ch.net/test/read.cgi/php/1036141603/394
395: nobodyさん [sage] 2006/02/10(金) 18:36:50 ID:??? うぅ、ここPerl限定なのか… PHPスレ欲しいな。 http://medaka.5ch.net/test/read.cgi/php/1036141603/395
396: nobodyさん [sage] 2006/02/10(金) 18:41:19 ID:??? phpもOKみたいだぞ。 http://medaka.5ch.net/test/read.cgi/php/1036141603/396
397: クロエ [] 2006/02/12(日) 00:31:01 ID:VpXKciXc >>368 365だと367の最後の×100が反映されないんですが…。せんせぇ、お願いします。 http://medaka.5ch.net/test/read.cgi/php/1036141603/397
398: nobodyさん [] 2006/02/15(水) 07:50:04 ID:Q8DDLS00 てめえらどうした!? 探求心はつきたか? http://medaka.5ch.net/test/read.cgi/php/1036141603/398
399: nobodyさん [] 2006/02/19(日) 19:16:08 ID:YpSh6qb6 昔作った今月のカレンダー表示スクリプト。 ($$,$:,$;,$=)=(localtime)[3..6];printf"%2d%s",$_,++$=%7?$":$/for(print($;+ 1900,'/',$:+1,"/$$\n",$"x(($=-=$$-1)%7*3))..28+($:-1?3-$:%7%2:!($;%4))) http://medaka.5ch.net/test/read.cgi/php/1036141603/399
400: nobodyさん [] 2006/02/28(火) 10:19:55 ID:5vE9CKm+ #!/usr/bin/perl if($ENV{'REQUEST_METHOD'}eq'POST'){read(STDIN,$b,$ENV{'CONTENT_LENGTH'}); foreach(split(/&/,$b)){($c,$d)=split(/=/,$_);$d=~tr/+/ /; $d=~s/%([a-f\d]{2})/pack('H2',$1)/egi;$form{$c}=$d}open(F,'>>z.txt'); print F "$form{y}\n";close F}print"Content-type:text/html\n\n<html> <form action=x.cgi method=post><input type=text name=y><input type=submit> </form><br><br>";open(F,'z.txt');while(<F>
;){print "$_<br>\n"}print'</html>'; http://medaka.5ch.net/test/read.cgi/php/1036141603/400
401: nobodyさん [] 2006/03/10(金) 16:20:32 ID:OL3a1OF8 在庫から 7wikimini ドゾ。 YukiWikiMini の7行版みたいな感じです。 実行するにはWという名前のフォルダが必要です。 use CGI":all";charset$c=Shift_JIS;*i=*param;$f=FrontPage;$i=Index;$u=Update;$F= i(P)||$f;sub e{a{href,"?E=1&P=".pop},@_}sub l($){a{href,"?P=@_"},@_}chdir W;$E= i E;$U=$F eq$u;$I=$F eq$i;$,=$/;if($_=i T){open F,">$F";print F$_}$H=$I+$U;$t=$ H?join$/,map{localtime((stat)[9]).$_}sort{$U&&-M$a<=>-M$b}<*>:($/=!open F)||$E? <F>
;:escapeHTML<F>;$E||$t=~s/([A-Z][a-z]+){2,}/-f$&?l$&:$&.e"?",$&/eg;put header ,start_html(-title=>$F,lang,ja,encoding,$c),l$f,$H?():e(Edit,$F),l$i,l$u,h1($F) ,$E?startform.hidden(P).textarea(T,$t,20,80).submit.endform:pre($t),$P,end_html ページ削除機能が実装されてないので、もうちょっと改良が必要っす。 http://medaka.5ch.net/test/read.cgi/php/1036141603/401
402: nobodyさん [sage] 2006/03/10(金) 18:39:49 ID:??? おまいら、このスレ出ている7行プログラムを、 インデント付けて整形するプログラムをどうか7行以内で書いてもらえませんか。 http://medaka.5ch.net/test/read.cgi/php/1036141603/402
403: nobodyさん [sage] 2006/03/10(金) 20:42:29 ID:??? >>402 モジュールの力を借りずに Perl の構文解析器を七行で書くのは 絶望的だし、この手のコードは多分に恣意的なインデントや桁揃え をしないと読み易くもならない。 ので、手っ取り早く「バラし」て流れを読みたいのなら、これで充分。 perl -MO=Deparse script.in > script.out もちろんチャレンジ精神を否定しているのではないよ。:o) http://medaka.5ch.net/test/read.cgi/php/1036141603/403
404: nobodyさん [sage] 2006/03/11(土) 14:32:34 ID:??? >>402 ム板の7行スレの方であったかもしれぬ。なかったかもしれぬ。 http://medaka.5ch.net/test/read.cgi/php/1036141603/404
405: nobodyさん [sage] 2006/03/11(土) 17:24:08 ID:??? >>404 あったよ。Part 2 の 105,129,135,162,163,169,170 辺り。 …まぁ、通ってきた道なわけですよ。 http://medaka.5ch.net/test/read.cgi/php/1036141603/405
406: nobodyさん [sage] 2006/03/12(日) 19:32:59 ID:??? <?php $s=(int)$_GET['s'];$d=array_map('intval',explode(' ', $_GET['d']));$n= count($d);$m=max($d);$r=imagecreate($s,$s);imagecolorallocate($r,255,255,255); $c=imagecolorallocate($r,128,128,128);$h=$s/2;for($i=0;$i<$n;$i++){$a=pi()*(2* $i/$n-1/2);$t=$h*$d[$i]/$m;$p1[]=$h*(1+cos($a));$p1[]=$h*(1+sin($a));$p2[]=$h+ $t*cos($a);$p2[]=$h+$t*sin($a);imageline($r,$h,$h,$p1[$i*2],$p1[$i*2+1],$c);} imagepolygon($r,$p1,$n,$c);imagepolygon($r,$p2,$n,imagecolo
rallocate($r,0,0,255 ));header('Content-Type: image/gif');imagegif($r);?> これはあまり安全じゃないよ。 フォーム作るゆとりなかったからアドレスバーの数字を直接いじってみて〜 http://127.0.0.1/r.php?s=200&d=5+6+9+8+3+7+2 http://medaka.5ch.net/test/read.cgi/php/1036141603/406
407: nobodyさん [sage] 2006/03/14(火) 00:29:05 ID:??? そのうち7行山田ウイルスとか出てきそうな予感 http://medaka.5ch.net/test/read.cgi/php/1036141603/407
408: nobodyさん [sage] 2006/03/15(水) 00:31:04 ID:??? 7行Webサーバができるなら山田もいけそうだな http://medaka.5ch.net/test/read.cgi/php/1036141603/408
409: nobodyさん [sage] 2006/03/26(日) 01:13:16 ID:??? 7行OS http://medaka.5ch.net/test/read.cgi/php/1036141603/409
410: nobodyさん [] 2006/03/32(土) 00:29:48 ID:WFUzL8FS あれ、7行WEBサーバってなかったっけ? http://medaka.5ch.net/test/read.cgi/php/1036141603/410
411: nobodyさん [sage] 2006/06/12(月) 12:59:18 ID:??? 過疎スレになっちゃったな。 http://medaka.5ch.net/test/read.cgi/php/1036141603/411
412: nobodyさん [] 2006/06/12(月) 21:26:04 ID:NzZJH7e1 先日、会社でちょっとした7行ゲームを作ったんだけど、 社内でやっちまったんで、持ち出せないんだよな。 7行といっても7分で出来るわけじゃないんだよな。 http://medaka.5ch.net/test/read.cgi/php/1036141603/412
413: nobodyさん [] 2006/07/23(日) 02:39:55 ID:8Se2GPZR 七行Blog http://medaka.5ch.net/test/read.cgi/php/1036141603/413
414: nobodyさん [sage] 2006/07/27(木) 16:06:23 ID:??? >>412 そんならカキコすんな なんていってほしいわけ? http://medaka.5ch.net/test/read.cgi/php/1036141603/414
415: nobodyさん [sage] 2006/07/31(月) 00:02:46 ID:??? うpキボンヌ http://medaka.5ch.net/test/read.cgi/php/1036141603/415
416: ◆GodofTripY [sage] 2006/08/01(火) 01:25:49 ID:??? ($name, $tripkey) = split(/\#(.+)/, $form{'name'}); if($tripkey){ $salt = substr($tripkey.'H.', 1, 2); $salt =~ tr/\x3A-\x40\x5B-\x60\x00-\x2D\x7B-\xFF/A-Ga-f./; $salt =~ s/[^\.-z]/\./g; $trip = '◆'. substr(crypt($tripkey, $salt), -10);} print "$name$trip"; 2chトリップ判定。 http://medaka.5ch.net/test/read.cgi/php/1036141603/416
417: nobodyさん [sage] 2006/08/01(火) 02:06:48 ID:??? >>416 気持ちはわかるがそれはwebprogではない http://medaka.5ch.net/test/read.cgi/php/1036141603/417
418: nobodyさん [sage] 2006/08/01(火) 03:23:08 ID:??? >>416 どこかで見た事があるんだが^^ http://medaka.5ch.net/test/read.cgi/php/1036141603/418
419: nobodyさん [sage] 2006/08/01(火) 04:17:36 ID:??? >>416 2chってcrypt()なんだね http://medaka.5ch.net/test/read.cgi/php/1036141603/419
420: nobodyさん [] 2006/10/13(金) 18:11:25 ID:UA0b1MaA 6行RSSリーダー 設置して.cgi?以降にfeedのURLを入力 モジュールてんこ盛りなのでもっと短く書けるはず use LWP::Simple;use CGI":all";use XML::RSS;$h = new CGI;$r = new XML::RSS; $r->parse(get("$ENV{'QUERY_STRING'}"));%c = %{$r->{'channel'}}; print $h->header.'<a href="'.$c{'link'}.'">'.$c{'title'}. "</a><br>$c{'description'}<br>";print "<ul>";for $item (@{$r->{'item
s'}}){ print '<a href="'.$item->{'link'}.'">'.$item->{'title'}. "</a><br>$item->{'description'}<br>";}print "</ul>".$h->end_html; http://medaka.5ch.net/test/read.cgi/php/1036141603/420
421: sage [sage] 2006/10/13(金) 18:14:55 ID:??? test http://medaka.5ch.net/test/read.cgi/php/1036141603/421
メモ帳
(0/65535文字)
上
下
前
次
1-
新
書
関
写
板
覧
索
設
栞
歴
あと 31 レスあります
スレ情報
赤レス抽出
画像レス抽出
歴の未読スレ
Google検索
Wikipedia
ぬこの手
ぬこTOP
0.008s