七行プログラミング (452レス)
七行プログラミング http://medaka.5ch.net/test/read.cgi/php/1036141603/
上
下
前
次
1-
新
通常表示
512バイト分割
レス栞
114: nobodyさん [sage] 02/12/02 08:06 ID:??? #7search.cgi - v0.02 fixed some bugs use CGI':all';($c=$f=script_name)=~s|/[^/]+$||;$s=param S;if($s){opendir D,"."; map{$t=$_;if(open F,$t){eval{flock F,2};while(<F>){chomp;if(/\Q$s\E/io){push@r, li(a({href,"$c/7wiki.cgi/$t"},$t)," $_");last}}close F}}sort grep/^[^.]+$/, readdir D}put header,start_html('7search'),startform(0,$f),p(textfield(S), submit),endform,hr,ul(@r),end_html #7rss.cgi - v0.02 show latest 15 articles use CGI qw/:all channel item textinput link name/;($p)=script_name=~m|(.+)/[^/] +$|x;$s=server_name.$p;opendir D,".";$w='7wiki';put"Content-type:text/xml\n\n", qq|<?xml version="1.0"?>\n<rdf:RDF xmlns:rdf="http://www.w3c.org/1999/02/22-r|, q|df-syntax-ns#" xmlns="http://my.netscape.com/rdf/simple/0.9/">|,channel(title ($w),link"$s/$w.cgi"),(map{item title($_),link"$s.cgi/$_"}sort{-M$a<=>-M$b}grep /^[^.]+$/,readdir D)[0..14],textinput(title($w),link("$s/7search.cgi"),name S), "\n</rdf:RDF>"; http://medaka.5ch.net/test/read.cgi/php/1036141603/114
115: nobodyさん [sage] 02/12/02 17:31 ID:??? # 7rss.cgi v0.03 use CGI qw/:all channel item textinput link name/;opendir D,".";$w='7wiki';($p) =url=~m|^(.+)/[^/]+$|;put header('text/xml'),qq|<?xml version="1.0"?>\n<rdf:RD| ,'F xmlns:rdf="http://www.w3c.org/1999/02/22-rdf-syntax-ns#" xmlns="http://my.' ,'netscape.com/rdf/simple/0.9/">',channel(title($w),link"$p/$w.cgi"),(map{item title($_),link"$p/$w.cgi/$_"}sort{-M$a<=>-M$b}grep/^[^.]+$/,readdir D)[0..14], textinput(title($w),link("$p/7search.cgi"),name S),"\n</rdf:RDF>"; http://medaka.5ch.net/test/read.cgi/php/1036141603/115
116: nobodyさん [] 02/12/21 03:14 ID:RF/wn3c8 7threadキボンヌ http://medaka.5ch.net/test/read.cgi/php/1036141603/116
117: nobodyさん [sage] 02/12/30 09:38 ID:??? 拙作をまとめていた isweb のサイト、広告ウザいので引っ越し。 ついでに配布体裁整え。http://calorymate.s15.xrea.com/ 7wiki と 7files 、参加作という事でサイトに載っけていいですか? http://medaka.5ch.net/test/read.cgi/php/1036141603/117
118: 'a';$happy = new Year; [sage] 02/12/31 15:36 ID:??? >>117 Take It free. <一応、ベースとなるものを書いたモノです 自分が代表してレスしていいのかわかんないけど && このスレッド的にはどうなのか知らないけど・・・、 このまま過去ログに埋もれて日の目を見ないよりも、 公開して保守して貰えるのなら、そっちの方がいいよな て事でお願いします。 ついでに、7rss, 7search も載せてもらえるとうれしいな。 package Year;sub new{bless{},shift} http://medaka.5ch.net/test/read.cgi/php/1036141603/118
119: nobodyさん [sage] 03/01/15 02:35 ID:??? 忘れた頃に。(w --- 7search.cgi use CGI':all';put header,start_html('7search'),startform(0,$_=script_name),p( textfield(S),submit),endform,hr;if($s=param S){m|/[^/]+$|;$c=$`;opendir D,"."; for(sort grep/^\w+$/&-f,readdir D){if(open F,$t=$_){eval{flock F,2};/\Q$s\E/io &&push(@r,li(a({href,"$c/7wiki.cgi/$t"},$t)," $_"))&&next while<F>;}}@r&&put ul @r}put end_html --- 7rss.cgi use CGI qw/:all channel item textinput link name/;opendir D,".";$w='7wiki';url =~m|[^/]+$|;$p=$`;put header('text/xml'),join"\n",'<?xml version="1.0"?>', '<rdf:RDF xmlns:rdf="http://www.w3c.org/1999/02/22-rdf-syntax-ns#" xmlns="http' .'://my.netscape.com/rdf/simple/0.9/">',channel(title($w),link"$p$w.cgi"),(map{ item title($_),link"$p$w.cgi/$_"}sort{-M$a<=>-M$b}grep/^\w+$/&-f,readdir D)[0.. 14],textinput(title($w),link($p.'7search.cgi'),name S),'</rdf:RDF>' つー事で載せときました。 http://medaka.5ch.net/test/read.cgi/php/1036141603/119
120: 山崎渉 [(^^)sage] 03/01/15 13:41 ID:??? (^^) http://medaka.5ch.net/test/read.cgi/php/1036141603/120
121: nobodyさん [sage] 03/01/17 18:30 ID:??? 2ch の dat ファイル (かちゅ〜しゃのログ) を XHTML ファイルに変換。 http://cm.xrea.cc/kat2xhtml.shtml $s="kat2xhtml.tmpl";sub a{'<a href="'.pop().'</a>'}sub p{'<span class="'.pop(). '</span>'}while(<>){($n,$m,$d,$_,$t,$")=split/,/;$.-1||($T=$t)=~s/\s+$//;$n=$n =~m|^<b>([^<]*)</b>(?:([^<]*)<b></b>)?$|?p"n\">$1":'';$n.=p"m\">$2"if$2;$n=$m=~ /\@/?a"mailto:$m\">$n":$m=~/./?p qq|k" title="$m">$n|:$n;s/\x81\x97\x81\x4D/,/g ;s/\s+(?:target="_blank"|$)//g;s|\s*<br>|<br />|g;s/&(?![a-z]+;)/&/g;for(@r =split/(<a href="[^"]+">[^<]+<\/a>)/){(($u,$a)=m|^<a href="([^"]+)">([^<]+)</a> $|x)?($u=~s/~/%7E/g&&($_=a"$u\">$a"),$a=~/^>>(\d+)/&&($_=a"#R$1\">$a")): s/"/"/g}$A.="<dt>$. :<a id=\"R$.\">$n :$d</a></dt><dd>@r</dd>\n"}if(open T,$s){$/='';$_=<T>;s/\%(.)/${$1}/g;print} 機能減らさないと七行に収まらないかなぁ。 http://medaka.5ch.net/test/read.cgi/php/1036141603/121
122: nobodyさん [] 03/03/10 02:24 ID:drTO4vMw 使い方わからなかったけど…(かちゅーしゃのログ持っていないので。 '<a href="'.pop().'</a> ↓ "a href=\"$_[0]</a>" http://medaka.5ch.net/test/read.cgi/php/1036141603/122
123: 山崎渉 [(^^)] 03/03/13 17:04 ID:??? (^^) http://medaka.5ch.net/test/read.cgi/php/1036141603/123
124: nobodyさん [sage] 03/03/13 18:58 ID:??? このスレの dat 上げといたんでテストする人はどぞ。 http://cm.xrea.cc/thread/1036141603.dat >>122 @_ でもいいですね。 $s="kat2xhtml.tmpl";sub a{"<a href=\"@_</a>"}sub p{"<span class=\"@_</span>"} while(<>){($n,$m,$d,$_,$t,$")=split/,/;$.-1||chomp($T=$t);$n=~m|<b>([^<]*)(?: </b>([^<]*))?|x;$n=($1&&p"n\">$1").($2&&p"m\">$2");$n=p qq|k" title="$m">$n|if $m.0;s/\x81\x97\x81\x4D/,/g;s/\s+(?:target="\w*"|$)//g;s|\s*<br>|<br />|g;s/& (?![a-z]+;)/&/gx;for(@r=split/(<a href="[^"]+">[^<]+<\/a>)/){(($u,$a)= /^<a href="([^"]+)">([^<]+)/)?($_=$u=~s/~/%7E/g?a"$u\">$a":$a=~/^(?:>){1,2} (\d+)/x?a"#R$1\">$a":$_):s/"/"/g}$A.="<dt>$. :<a id=\"R$.\">$n :$d</a>". "</dt><dd>@r</dd>\n"}if(open T,$s){$/='';$_=<T>;s/\%(.)/${$1}/g;print} mailto: やめてあと一行。 http://medaka.5ch.net/test/read.cgi/php/1036141603/124
125: 通りすがり [sage] 03/03/25 06:39 ID:??? このすれ見て ish思い出しますた http://medaka.5ch.net/test/read.cgi/php/1036141603/125
126: 山崎渉 [(^^)] 03/04/17 12:25 ID:??? (^^) http://medaka.5ch.net/test/read.cgi/php/1036141603/126
127: ◆PAmX3cjLtw [] 03/04/18 14:01 ID:yrVQyLZr こんなスレあったんだ。燃えてきた! http://medaka.5ch.net/test/read.cgi/php/1036141603/127
128: ◆PAmX3cjLtw [] 03/04/18 15:48 ID:yrVQyLZr 俺も作ってみた。 2chモドキの掲示板です。ログファイル F が必要。 URLと、発言番号への自動リンクがありますが、使い物になるかどうか・・・。 Win98のPWSとLinuxのApacheで動作を確認しました。。。 ------------ 7ch.cgi ----------------- #!/usr/bin/perl use CGI':all';*i=*param;$n=i N;$m=i M;$t=i T;open F,'+<F';eval{flock F,2};1 for <F>;$.++;if($t){$_=$t;s/</</g;$h='<a href=';s!(https?://.+?)$!$h$1>$1</a>!mg ;s!>>(\d+)!$h#$1>>>$1</a>!g;s/\n/br/eg;seek F,0,2;print F dt("$. :".b(a{href=> $m?"mailto:$m":undef,name=>$.},$n||='名無しさん'),':'.localtime),(dd $_.br.br) ."\n"}seek F,0,0;*x=*textfield;print header(-charset=>''),start_html(-style=>' body{background:#eee}b{color:green}').startform,dl(<F>),hr,submit('書き込む'),' 名前:',x(N),' E-mail:',x(M),br,textarea(T,'',5,70,1),endform.end_html; -------------------- 結構つかれた・・・。 http://medaka.5ch.net/test/read.cgi/php/1036141603/128
129: nobodyさん [sage] 03/04/18 16:33 ID:??? すげぇ… http://medaka.5ch.net/test/read.cgi/php/1036141603/129
130: nobodyさん [sage] 03/04/19 00:20 ID:??? >>128 日本語まともに表示できるようにしたら、URL リンク外してもはみだしちゃった。 #!/usr/bin/perl use CGI':all';open F,'+<F';eval{flock F,2};[<F>];$.++;*i=*param;if($_=i T){s/< /&lt;/gx;$h='<a href="';s!(&gt;&gt;\d+)!$h#R$1">$1</a>!g;s/\n/br/eg;$m=i M;seek F,0,2;print F dt("$. :".b(a{name=>"R$.",$m&&(href=>"mailto:$m")},i(N)|| '名無しさん'),':'.localtime),dd($_.br.br),"\n"}*x=*textfield;$c='Shift_JIS'; seek F,0,0;put header(-charset=>$c),start_html(-encoding=>$c,-lang=>'ja', -style=>'body{background:#eee}b{color:green}'),dl(<F>),hr,startform,p(submit( '書き込む'),' 名前:',x(N),' E-mail:',x(M),br,textarea(T,'',5,70,1)),endform, end_html CGI.pm は 2.91 と 2.46 で確認。&を戻して使って下され。 http://medaka.5ch.net/test/read.cgi/php/1036141603/130
131: nobodyさん [sage] 03/04/19 04:23 ID:??? 収まった。 #!/usr/bin/perl use CGI':all';open F,'+<F';[<F>];$.++;*i=*param;s!(&gt;&gt;)(\d+)!'<a href="#R' ."$2\">$1$2</a>"!eg,s/\n/br/eg,seek(F,0,2),eval{flock F,2},print F dt("$. :".b (a{name,"R$.",($m=i M)&&(href,"mailto:$m")},i(N)||'nobodyさん'),':'.localtime) ,dd($_.br.br),"\n"if$_=escapeHTML i T;*x=*textfield;$c='Shift_JIS';seek F,0,0; put header(-charset=>$c),start_html(-encoding=>$c,-lang=>'ja',-style=>'b{color: green}body{background:#eee}'),dl(<F>),hr,startform,p(submit('書き込む'),' 名前' .':',x(N),' E-mail:',x(M),br,textarea(T,'',5,70,1)),endform,end_html escapeHTML 使ったから、CGI.pm v2.46 だと不可。 http://medaka.5ch.net/test/read.cgi/php/1036141603/131
132: ◆PAmX3cjLtw [] 03/04/19 12:39 ID:S+81Ncm0 >>131 修正ありがとう!勉強になります。 httpへの自動リンクも入れてみたけど、p抜かしたりズルしてます。 【今後の課題】 ・キャップもどき追加(s/#.*/crypt$&,'◆'/e) ・全角小文字のkが文字化けするバグ use CGI':all';open F,'+<F';[<F>];$.++;*i=*param;s!>>(\d+)!a{href,"#R$1"}, $&!eg,s!https?://.+?$!a{href,$&},$&!emg,s/\n/br/eg,seek(F,0,2),eval{flock F,2}, print F dt("$. :".b(a{name,"R$.",($m=i M)&&(href,"mailto:$m")},i(N)||'nobody'. 'さん'),':'.localtime),dd($_.p),"\n"if$_=escapeHTML i T;*x=*textfield;seek F,0 ,0;put header(-charset=>$c='Shift_JIS'),start_html({lang,'ja',encoding,$c,Style ,'b{color:#080}body{background:#eee}'}),dl(<F>),hr,startform,submit('書き込む') ,' 名前:',x(N),' E-mail:',x(M),br,textarea(T,'',6,70,1),endform,end_html http://medaka.5ch.net/test/read.cgi/php/1036141603/132
133: 動画直リン [] 03/04/19 12:40 ID:PZJVQOkw http://www.agemasukudasai.com/movie/ http://medaka.5ch.net/test/read.cgi/php/1036141603/133
134: ◆PAmX3cjLtw [] 03/04/19 12:41 ID:S+81Ncm0 すまそ。&置換するの忘れました。 use CGI':all';open F,'+<F';[<F>];$.++;*i=*param;s!&gt;&gt;(\d+)!a{href,"#R$1"}, $&!eg,s!https?://.+?$!a{href,$&},$&!emg,s/\n/br/eg,seek(F,0,2),eval{flock F,2}, print F dt("$. :".b(a{name,"R$.",($m=i M)&&(href,"mailto:$m")},i(N)||'nobody'. 'さん'),':'.localtime),dd($_.p),"\n"if$_=escapeHTML i T;*x=*textfield;seek F,0 ,0;put header(-charset=>$c='Shift_JIS'),start_html({lang,'ja',encoding,$c,Style ,'b{color:#080}body{background:#eee}'}),dl(<F>),hr,startform,submit('書き込む') ,' 名前:',x(N),' E-mail:',x(M),br,textarea(T,'',6,70,1),endform,end_html http://medaka.5ch.net/test/read.cgi/php/1036141603/134
135: nobodyさん [sage] 03/04/19 12:54 ID:??? ライブラリをつかってよいのなら、主要な処理はライブラリに書けば数文字でかけますね。 http://medaka.5ch.net/test/read.cgi/php/1036141603/135
136: nobodyさん [sage] 03/04/19 21:11 ID:??? >>135 個人的にはモジュール不可派だけど、WebProg だし 標準モジュールだけ使用可にした方が面白いものが 出てきそうな気がするのでそういう縛りで考えてるよ。 http://medaka.5ch.net/test/read.cgi/php/1036141603/136
137: ◆PAmX3cjLtw [sage] 03/04/20 02:19 ID:??? encoding をハズしてなんとかイけたよ。疲れた。 まとめ&使い方 ・番号自動リンク( >>100 とか入力する) ・URL自動リンク(http://... 行末までリンク) ・キャップ(名前欄の # 以降をcryptします) ・EUC-JP で保存する(じゃないと文字化けする) ・&を&に置換する ・カレントに空ファイル F を作ること ------------------------------- 7ch.cgi use CGI':all';open F,'+<F';[<F>];$.++;*i=*param;s!&gt;&gt;(\d+)!a{href,"#R$1"}, $&!eg,s!https?://.+?$!a{href,$&},$&!emg,s/\n/br/eg,seek(F,0,2),eval{flock F,2}, ($n=i(N)||'nobodyさん')=~s/#.*/crypt$&,'◆'/e,print F dt("$. :".b(a{name,"R$." ,i(M)&&(href,'mailto:'.i M)},font{color,'green'},$n),':'.localtime),dd($_.p)," "if$_=escapeHTML i T;seek F,0,0;*x=*textfield;put header(-charset=>'EUC-JP'), start_html({lang,'ja',bgcolor,'#efefef'}).dl(<F>),startform,p(submit('書き込む' ),' 名前:',x(N),' E-mail:',x(M),br,textarea(T,'',6,70,1)),endform,end_html; http://medaka.5ch.net/test/read.cgi/php/1036141603/137
138: nobodyさん [i] 03/04/20 04:52 ID:??? 縮めるならロックなんてしなくてもよいだろ。 http://medaka.5ch.net/test/read.cgi/php/1036141603/138
139: nobodyさん [sage] 03/04/20 04:57 ID:??? >>137 ・改行しないとレス番が2以上に増えない。 ・Mozilla 1.3 だと font では色変わらんかったんで、CSS に戻し。 ・> 一個でリンク。 use CGI':all';open F,'+<F';[<F>];seek F,0,2;*i=*param;s!&gt;(\d+)!a{href,"#R$1" },$&!eg,s!https?://.+$!a{href,$&},$&!emg,s/\n/br/eg,eval{flock F,2},($n=i(N)|| 'nobodyさん')=~s/#.+/crypt$&,'◆'/e,print F dt(++$.,':'.b(a{name,"R$.",i(M)&&( href,'mailto:'.i M)},$n),':'.localtime),dd($_.p),"\n"if$_=escapeHTML i T;seek F,0,0;*x=*textfield;put header(-charset=>'EUC-JP'),start_html({lang,ja,Style, 'b{color:#080}body{background:#eee}'}),dl(<F>),hr,startform,p(submit('書き込む' ),' 名前:',x(N),' E-mail:',x(M),br,textarea(T,'',6,70,1)),endform,end_html >>130 での変更は HTML 的に正しくする為のものなんだけど (文字コードや言語を指定するから化けずに済む)、そーゆーの より「似せる」方を重視してるのかな? http://medaka.5ch.net/test/read.cgi/php/1036141603/139
140: 山崎渉 [(^^)sage] 03/04/20 05:57 ID:??? ∧_∧ ( ^^ )< ぬるぽ(^^) http://medaka.5ch.net/test/read.cgi/php/1036141603/140
141: nobodyさん [] 03/05/09 00:09 ID:seZLVSXV ∩(゚∀゚∩)age http://medaka.5ch.net/test/read.cgi/php/1036141603/141
142: nobodyさん [sage] 03/05/09 21:42 ID:??? えぇと、みんななんか面白そうなコトやってるね。 俺も参加しよう思ったけど…読めない所が多いや。 http://medaka.5ch.net/test/read.cgi/php/1036141603/142
143: nobodyさん [sage] 03/05/10 00:35 ID:??? >>142 過疎スレだから、分からんトコは*自分で調べた上で* 適宜質問してくれれば良いかと。 http://medaka.5ch.net/test/read.cgi/php/1036141603/143
メモ帳
(0/65535文字)
上
下
前
次
1-
新
書
関
写
板
覧
索
設
栞
歴
あと 309 レスあります
スレ情報
赤レス抽出
画像レス抽出
歴の未読スレ
Google検索
Wikipedia
ぬこの手
ぬこTOP
0.009s