はてなキーワード: TREEとは
事実と真実ですれ違っているというが、そもそもの命題の設定の仕方が間違っているとしか思えん。
例題の「ワシントンの斧」に関して言うならば、
命題を「ワシントンの斧という寓話は真実であるか否か」とするなら、
アメリカに桜が上陸したのは1909年12月。ただし、この時は害虫被害が懸念されてすべて焼却されており、現在DCとかニューヨークで見られる桜は1912年3月に運ばれたもの。 ワシントン幼少時(1730~40年代)には桜の木は当然無い。 これを根拠に否定する輩もいるのだが、英文では"English cherry tree"となっている物があるのでおそらく、桜桃だと思われ、これなら17世紀にはイギリスからアメリカに持ち込まれている。 ワシントンの家は黒人奴隷プランテーションを経営していたので、桃桜があっても格段不思議ではない。 また、海外の挿絵等では背景が農場に見えるものも多く日本で翻訳した時点で相当意訳されてしまっており日本語訳を元に審議を見定めるのは難しい
となるわけで、これは事実の積み重ねだから、認識の違いは起こらないと思われる。
また、「これが子供の思想形成にどのように影響していくか?」という命題に関しても、
寓話を読み聞かせるのは容易いが、子供は大人の行動から物を学ぶのであり、実際の大人が寓話に反した行為を行っている場合には悪い影響を与えるだろう。 事実、アメリカにおいても、"George Washington's axe"は、先祖代々伝わる由緒ある斧だが、刃は錆びたので交換し、柄は古くなったので交換した。 というジョークとなり、「あれこれ取り替えて元が残ってない様子」を示す慣用句として使われてしまっている。 また、「正直に物事を話した方が良い」という事を説明するための寓話は他にも多くあり、「ワシントンの斧」は内容の短さ、状況の簡潔さから反論性が高いため、他の寓話を選択した方が効果はあるように思える。
と、相手に状況を確認してもらって進めれば、一方的な擦れ違いは起きないだろう。
"The Artist"? "The Descendants"? "Hugo"? There was no critical consensus following a day of intense voting yesterday when a gaggle of critics groups voted their top honors. These included the Los Angeles Film Critics Association (LAFCA), the Boston Society of Film Critics (BSFC), and the New York Film Critics Online (NYFCO), as well as critics in San Francisco, Detroit and Indiana. The American Film Institute also announced its annual top 10, typically taking no risks.
Best Picture: "The Descendants" got a strong push with a win at the LAFCA, but "The Artist" took the top prize at the BSFC and the NYFCO. Both titles will make the final Academy shortlist. Fortified by nominations for their respective directors Martin Scorsese and Terrence Malick, "Hugo" and "The Tree of Life" should get nominations. The critics groups didn't get "The Help," any more than "The Blind Side," but the Civic Rights-era drama did make the American Film Institute top ten this year, so don't discount it yet.
Best Actor: Michael Fassbender is coming up fast with an LAFCA win. Why should we care about that group in particular? They're on a six-year roll predicting the Oscar winner for Best Actor. Brad Pitt's also a contender for "Moneyball," getting an art-house bump from "The Tree of Life," with Gary Oldman coming up on the outside thanks to the critical and box-office success of "Tinker, Tailor, Soldier, Spy" and a nod from the San Francisco Film Critics. How about George Clooney for "The Descendants"? He's still in the race, but not at the forefront. Like going for long shots? Then bet Michael Shannon for "Take Shelter," which won NYFCO. And if there's a sweep for "The Artist," add in Jean Dujardin.
Best Actress: Michelle Williams of "My Week With Marilyn," solidifies her spot with a win at the Boston Film Critics Association. Los Angeles went way out for Yung-Jun Hee in "Poetry" (what?) in their 'we're cool and uncorrupted by the Oscar race' vote. NYFCO went classic with Meryl Streep for "The Iron Lady." She's the Streep, but neither she nor Williams will be helped by an apparent lack of enthusiasm for their moves as a whole. Ditto Viola Davis ("The Help"), who will nonetheless make the top five Oscar nominees. Either SF winner Tilda Swinton ("We Need to Talk About Kevin") or multiple-runner-up Kirsten Dunst ("Melancholia") may slip in or come in sixth or seventh. Keep an eye out for Charlize Theron ("Young Adult"), Elizabeth Olsen ("Martha Marcy May Marlene") and Felicity Jones ("Like Crazy) as wild-card entries.
Best Supporting Actor: This is a two-man race between octogenarian Christopher Plummer and Albert Brooks playing against type as a cold-blooded hands-on killer. On the fringes: Patton Oswalt ("Young Adult"), Kenneth Branagh ("My Week with Marilyn") and Andy Serkis ("Rise of the Planet of the Apes").
Best Supporting Actress: Coming up on the inside is Melissa McCarthy for "Bridesmaids." Hurray for comedy! Bolstered by a best ensemble award from the LAFCA, this may push McCarthy into the five Oscar nominees. The LAFCA got behind Jessica Chastain, the NYFCO Breakthrough Performer, who was in every movie from "The Tree of Life" to "The Help," where she'll be competing against her popular co-star Octavia Spencer. The San Francisco critics supported Vanessa Redgrave for "Coriolanus," and Janet McTeer ("Albert Nobbs") was an LAFCA runner up in the category.
Who's out of the running in these five major categories? The Girl With the Dragon Tattoo, War Horse, J. Edgar and Midnight in Paris all underwhelmed. The X-Factor remains Scott Rudin's buzzy "Extremely Loud and Incredibly Close," which has not been screened widely after the New Yorker's David Denby flagrantly broke embargo on Rudin's other major film, "The Girl with the Dragon Tattoo." Pack the Kleenex box for this one.
http://www.chargerbatteryshop.co.uk/panasonic-cga-s002-digital-camera-battery-cbbs.html
http://www.gobatteryonline.com/canon-powershot-sd500-battery-charger-gose.html
http://www.keyboard-store.com/asus-04gncb1kusa4-laptop-keyboard.html
"The Artist"? "The Descendants"? "Hugo"? There was no critical consensus following a day of intense voting yesterday when a gaggle of critics groups voted their top honors. These included the Los Angeles Film Critics Association (LAFCA), the Boston Society of Film Critics (BSFC), and the New York Film Critics Online (NYFCO), as well as critics in San Francisco, Detroit and Indiana. The American Film Institute also announced its annual top 10, typically taking no risks.
Best Picture: "The Descendants" got a strong push with a win at the LAFCA, but "The Artist" took the top prize at the BSFC and the NYFCO. Both titles will make the final Academy shortlist. Fortified by nominations for their respective directors Martin Scorsese and Terrence Malick, "Hugo" and "The Tree of Life" should get nominations. The critics groups didn't get "The Help," any more than "The Blind Side," but the Civic Rights-era drama did make the American Film Institute top ten this year, so don't discount it yet.
Best Actor: Michael Fassbender is coming up fast with an LAFCA win. Why should we care about that group in particular? They're on a six-year roll predicting the Oscar winner for Best Actor. Brad Pitt's also a contender for "Moneyball," getting an art-house bump from "The Tree of Life," with Gary Oldman coming up on the outside thanks to the critical and box-office success of "Tinker, Tailor, Soldier, Spy" and a nod from the San Francisco Film Critics. How about George Clooney for "The Descendants"? He's still in the race, but not at the forefront. Like going for long shots? Then bet Michael Shannon for "Take Shelter," which won NYFCO. And if there's a sweep for "The Artist," add in Jean Dujardin.
Best Actress: Michelle Williams of "My Week With Marilyn," solidifies her spot with a win at the Boston Film Critics Association. Los Angeles went way out for Yung-Jun Hee in "Poetry" (what?) in their 'we're cool and uncorrupted by the Oscar race' vote. NYFCO went classic with Meryl Streep for "The Iron Lady." She's the Streep, but neither she nor Williams will be helped by an apparent lack of enthusiasm for their moves as a whole. Ditto Viola Davis ("The Help"), who will nonetheless make the top five Oscar nominees. Either SF winner Tilda Swinton ("We Need to Talk About Kevin") or multiple-runner-up Kirsten Dunst ("Melancholia") may slip in or come in sixth or seventh. Keep an eye out for Charlize Theron ("Young Adult"), Elizabeth Olsen ("Martha Marcy May Marlene") and Felicity Jones ("Like Crazy) as wild-card entries.
Best Supporting Actor: This is a two-man race between octogenarian Christopher Plummer and Albert Brooks playing against type as a cold-blooded hands-on killer. On the fringes: Patton Oswalt ("Young Adult"), Kenneth Branagh ("My Week with Marilyn") and Andy Serkis ("Rise of the Planet of the Apes").
Best Supporting Actress: Coming up on the inside is Melissa McCarthy for "Bridesmaids." Hurray for comedy! Bolstered by a best ensemble award from the LAFCA, this may push McCarthy into the five Oscar nominees. The LAFCA got behind Jessica Chastain, the NYFCO Breakthrough Performer, who was in every movie from "The Tree of Life" to "The Help," where she'll be competing against her popular co-star Octavia Spencer. The San Francisco critics supported Vanessa Redgrave for "Coriolanus," and Janet McTeer ("Albert Nobbs") was an LAFCA runner up in the category.
Who's out of the running in these five major categories? The Girl With the Dragon Tattoo, War Horse, J. Edgar and Midnight in Paris all underwhelmed. The X-Factor remains Scott Rudin's buzzy "Extremely Loud and Incredibly Close," which has not been screened widely after the New Yorker's David Denby flagrantly broke embargo on Rudin's other major film, "The Girl with the Dragon Tattoo." Pack the Kleenex box for this one.
http://www.chargerbatteryshop.co.uk/panasonic-cga-s002-digital-camera-battery-cbbs.html
http://www.gobatteryonline.com/canon-powershot-sd500-battery-charger-gose.html
http://www.keyboard-store.com/asus-04gncb1kusa4-laptop-keyboard.html
北海道 → North Sea Road
山形 → Mountain Shape
宮城 → Palace Castle
茨城 → Thorn Castle
埼玉 → Tip Ball
東京 → East Capital
新潟 → New Lagoon
富山 → Rich Mountain
石川 → Stone River
岐阜 → Divergence Hill
三重 → Triple
滋賀 → Overgrown With Celebration
京都 → Capital Capital
兵庫 → Soldier Storehouse
和歌山 → Total Song Mountain
岡山 → Hill Mountain
山口 → Mountain Mouth
香川 → Fragrance River
高知 → High Wisdom
佐賀 → Support Celebration
長崎 → Long Cape
宮崎 → Palace Cape
ポイントは溜まりましたか?溜まりましたよね?
20万円の名詞セットとか70万円の切手シートなんてしたり顔のクソッタレ野郎どものジョークも聞かれたもんだが
あくまでVISAカードだから通常の景品も貰えるわけだ。じゃあ、同じポイントで他に何がもらえるか?ここで一部紹介してみよう。
200ポイントを1000円として好きな団体に寄付できる、ということになってる。
カルマを落としたい時にでもどうぞ。ガルシスに逢えなくて困ってる貴兄に。
http://www.haagen-dazs.co.jp/customer/faq/gift.html#faq01
好きなハーゲンダッツミニカップ2個と交換できるぞ、名刺じゃ腹は膨れねーよ!というアナタにマジオススメ。
http://shop.kodansha.jp/bc/hanshin/
分冊百科の創刊号だけプレゼント。300冊限定とかケチくさいこと書いてあるがなんともないぜ。
おれははらみーと阪神を応援するぞ!という人にもオススメかと。
キャッシュバックすると2100円。
L4Uアイドラオフスケッチの、どんな映画を見せても眠る美希の話を思い出しながら映画館にでも行けばいいって思うな。
http://www.toyo-rice.jp/product/
アイマスVISAで貯めたポイントで米貰っておにぎり作ると言う高度な遊びにどうぞ。期限は大晦日までだけど。
なんか売り上げの一部が寄付されるとかいうが、んなこた気にせず、とりあえず緑茶でも入れて街中とか公園で一人飲んでりゃいいと思うよ。これも年末までだけど。
18歳の時、僕は祭りからの帰り道で、金魚がビニール袋に入れられて木にぶら下げられているのを見つけた。僕も大してそれが欲しいというわけじゃなかったけれども、このままでは早々にその金魚は死んでしまうだろうと思った。それで、それを僕は家に持ち帰った。
母に金魚を持ち帰ったことを言い、母が水槽を用意した。こうしてその金魚は我が家の一員となった。
その金魚の名前を言っておくべきかも知れないが、それは出来ない。なぜなら、僕はその金魚に名前をつけることを忘れていたからだ。それはただ、金魚、と呼ばれた。
数ヵ月後、大学進学のため、僕は故郷を後にした。両親には娘と息子のふたりの子がいて、娘、つまり僕の姉はもう結婚していて、家を出ていた。僕が家を出れば、両親はふたりで家に残ることになる。そうなれば、少なからず寂しいことになるのだろうなと僕は思った。
父が電話をかけてきても、これと言って話題もなかった。それで父は僕が実家に残してきた「金魚」の話をした。僕はそれについては特に興味もなかったけれど、父が僕と話したいと思ってくれているのであればそれは嬉しいことだと思った。両親は僕の代わりにその金魚の世話をしていて、帰省するたびに、その金魚は大きくなっていた。
数年が過ぎて、父が死に、母もまたそれに続いた。
金魚は僕に委ねられた。それはまだ生きている。全長が15センチにもなる。今では、やや愛情らしきもの感じなくもないが、あいかわらず名前はつけていない。
When I was 18 y/o, I went to a festival with my friends. After I enjoyed it very much, I walked back home. I found a kingyo in a plastic bag which was tied to a tree. Though I didn't want it so much either, I thought it would die soon if I didn't help it. So I returned home with it - I didn't know if it's a male or female.
I told my mother that I brought a fish, she prepared a tank for it. The fish became a member of our family.
I should tell you its name. But I can't do so because I forgot to give it a name. It was just called "kingyo".
Some months later, I had to leave my hometown to go to a university. My parents have two children, a daughter and a son. The daughter had already married and moved out. After that, I also left home, and they remained by themselves. I think they felt lonely.
When my father called me, he didn't have many things to speak. So he told me about 'my' kingyo which was left at the home. Though I wasn't interested in it, I was glad that my father wanted to speak with me. I think they took care it instead of me. Every time I returned home, it became bigger.
Later, my father died, and my mother followed.
The fish was left to me. It is still alive. Its length is about 15 cm. Now I feel a little love for it. But it doesn't still have a name.
地味になって残念
結局概要表示機能追加した。unsafeWindow使いまくり。大丈夫かいな。
// ==UserScript== // @name Hatena Bookmark Tree Expander // @namespace http://anond.hatelabo.jp/ // @include http://b.hatena.ne.jp/entry/* // ==/UserScript== // <div class="info"> // <ul id="similar_entries" class="bookmarklist"> // <li></li> // </ul> // </div> // <div class="info"> // <ul id="referred_entries" class="bookmarklist"> // <li id="referred-entry-\d+"></li> // </ul> // </div> // <div class="info"> // <ul id="relation_diary" class="bookmarklist"> // <li id="diary-{id}-\d+"></li> // </ul> // </div> (function() { function main() { loadBookmarkCommentViewer(); similar.prototype.rootAppend(); referred.prototype.rootAppend(); } function HBTM(target) { this.target = target; this.targetXPath = "//ul[@id='"+target+"']/li"; this.targetRegExp = new RegExp('<ul id="'+target+'"(.|\\s)*?</ul>'); } HBTM.prototype = { openIcon: '<img width="15" height="15" class="icon" style="opacity: 0.6" src="http://anond.hatelabo.jp/images/common/open.gif"/>', closeIcon: '<img width="15" height="15" class="icon" style="opacity: 0.6" src="http://anond.hatelabo.jp/images/common/close.gif"/>', loadingIcon: '<img width="13" height="13" class="icon" src="http://anond.hatelabo.jp/images/common/loading.gif"/>', commentIcon: function(url) { return '<img class="hatena-bcomment-view-icon" src="http://r.hatena.ne.jp/images/popup.gif" onclick="iconImageClickHandler(this, \''+url+'\', event);">' }, create: function() { this.comment = document.createElement("span"); this.comment.innerHTML = this.commentIcon($X("string(descendant::a/@href)", this.node).value()); this.open = document.createElement("a"); this.open.href = "javascript:void(0)"; this.open.innerHTML = this.openIcon; this.close = document.createElement("a"); this.close.href = "javascript:void(0)"; this.close.innerHTML = this.closeIcon; this.close.style.display = "none"; this.loading = document.createElement("span"); this.loading.innerHTML = this.loadingIcon; this.loading.style.display = "none"; this.node.appendChild(this.comment); this.node.appendChild(document.createTextNode(" ")); this.node.appendChild(this.open); this.node.appendChild(this.close); this.node.appendChild(this.loading); this.open.addEventListener("click", bind(this.openAct, this), false); this.close.addEventListener("click", bind(this.closeAct, this), false); }, openAct: function() { this.open.style.display = "none"; if (this.tree) { this.tree.style.display = "block"; this.close.style.display = "inline"; } else { this.loading.style.display = "inline"; this.load(); } }, closeAct: function() { if (this.tree) { this.tree.style.display = "none"; this.close.style.display = "none"; this.open.style.display = "inline"; } }, load: function() { var url = $X("string(descendant::a[starts-with(@href, '/entry/')]/@href)", this.node).value(); GM_xmlhttpRequest({ method: "GET", url: "http://b.hatena.ne.jp"+url, onload: bind(this.loadCallback, this) }); }, loadCallback: function(result) { var match = result.responseText.match(this.targetRegExp); if (match) { var sandbox = document.createElement("div"); sandbox.innerHTML = match[0].replace(this.target,""); this.tree = sandbox.firstChild; } else { this.tree = document.createElement("ul"); } this.append(); this.loading.style.display = "none"; this.close.style.display = "inline"; }, append: function() { this.tree.style.backgroundColor = "transparent"; this.tree.style.listStyleType = "circle"; this.node.appendChild(this.tree); $X("li", this.tree).each(function(n) { var a = $X("a",n).node(); var c = $X("count(//li/a[@href='"+a.href+"'])").value(); if (c > 1) n.parentNode.removeChild(n); }); $X("li", this.tree).each(bind(function(node){new this.constructor(node)}, this)); }, rootAppend: function() { $X(this.targetXPath).each(bind(function(node){new this.constructor(node)}, this)); } }; function similar(node) { this.node = node; this.create(); } similar.prototype = new HBTM("similar_entries"); similar.prototype.constructor = similar; function referred(node) { this.node = node; this.create(); } referred.prototype = new HBTM("referred_entries"); referred.prototype.constructor = referred; function loadBookmarkCommentViewer() { var head = document.getElementsByTagName("head")[0]; var script = document.createElement("script"); script.type = "text/javascript"; script.src = "http://b.hatena.ne.jp/js/BookmarkCommentViewerAllInOne.1.2.js"; head.appendChild(script); var css = document.createElement("link"); css.rel="stylesheet"; css.href="http://d.hatena.ne.jp/css/base.css"; css.type="text/css"; css.media="all"; head.insertBefore(css, head.firstChild); window.addEventListener("load",function(){ var BCV = unsafeWindow.BookmarkCommentViewer; BCV.options['screenshot'] = true; var asyncCommnetView = BCV.asyncCommnetView; BCV.asyncCommnetView = function(url, onCompleteCallback) { var div = asyncCommnetView(url, function(){ onCompleteCallback.apply(this, arguments); new unsafeWindow.Ten.XHR("http://b.hatena.ne.jp/entry/rss/"+url, {}, function(result) { if (! result.responseText.match(/<description>(.*?)<\/description>/)) return; if (! RegExp.$1) return; // var desc = document.createTextNode("desc: "+RegExp.$1); var desc = document.createElement("li"); desc.appendChild(document.createTextNode("desc: "+RegExp.$1)); div.lastChild.insertBefore(desc,div.lastChild.getElementsByTagName("li")[0]); }); }); return div; }; BCV.asyncCommnetView.origin = asyncCommnetView; }, false); } function bind(f,o) {return function() {return f.apply(o, arguments)}} function $X(xpath, context) { if (!(this instanceof $X)) return new $X(xpath, context); this.xpath = xpath; this.context = context || document; } $X.prototype = { evaluate: function() { var result = document.evaluate(this.xpath, this.context, null, this.type, null); switch (result.resultType) { case XPathResult.STRING_TYPE : return result.stringValue; case XPathResult.NUMBER_TYPE : return result.numberValue; case XPathResult.BOOLEAN_TYPE: return result.booleanValue; case XPathResult.FIRST_ORDERED_NODE_TYPE: return result.singleNodeValue; } return result; }, node: function() { this.type = XPathResult.FIRST_ORDERED_NODE_TYPE; return this.evaluate(); }, value: function() { this.type = XPathResult.ANY_TYPE; return this.evaluate(); }, each: function(func) { this.type = XPathResult.ORDERED_NODE_SNAPSHOT_TYPE; var result = this.evaluate(); for (var i=0; i<result.snapshotLength; i++) func(result.snapshotItem(i)); } }; main(); })();
答えはいらない。ただ、今は、僕が何かになれればいいのかな。だめだ。
I wish I was a neutron bomb, for once I could go off
I wish I was a sacrifice but somehow still lived on
I wish I was a sentimental ornament you hung onThe christmas tree,
I wish I was the star that went on top
I wish I was the evidence,
I wish I was the grounds For 50 million hands upraised and open toward the sky
I wish I was a sailor with someone who waited for me
I wish I was as fortunate, as fortunate as me
I wish I was a messenger and all the news was good
I wish I was the full moon shining off a camaros hood
I wish I was an alien at home behind the sun
I wish I was the souvenir you kept your house key on
I wish I was the pedal brake that you depended on
I wish I was the verb to trust and never let you down
実行してみたら出力に変化がなかった。アルェー?
# tree -pugs | perl -e '@line=<>; $max=(sort {$b<=>$a} map {/^(.*?)\[/; length($1)} @line)[0]; map {s/^(.*?)\[/$1 . " "x($max-length($1))."\["/e} @line; print @line'
毎回正規表現考えるのも面倒かなーとかとか。
理想を語ると出力形式指定できれば最強だなーとか妄想してた。
この辺は、ファイルにして ~/bin に放りこんで、自分好みに育て上げる、ってのがエロゲ^H^H^Hギークの楽しみ方かと。
雛型的には↓かなぁ。どうだろ。弾・monger・コーガイ氏が登場したら……滅多切りさるかもw
#!/usr/bin/perl use strict; use warnings; use Getopt::Std; use vars qw($opt_t); # オプション処理 getopts('t'); # $opt_tがセットされていたらタブ処理、ということにする。 # コマンド起動 # 引数処理とかシグナルとか面倒なところは…… open TREE, "tree -pugs ".join(" ",@ARGV,"|") or die; my @line = <TREE>; # 富豪的にいく close TREE; # ここで子プロセスの処理だっけ? # それともwaitするんだっけ? # ツリー表示部分の最大長を求める。 my $max=(sort {$b<=>$a} map {/^(.*?)\[/; length($1)} @line)[0]; # 色々やる時はユーザ名とかグループ名とかファイル名とかの最大長がいるかも foreach (@line) { if ($opt_t) { # タブ(\t)で位置をそろえるとか…… } else { s/^(.*?)\[/$1 . " "x($max-length($1))."\["/e; } print; }
treeへのオプションの与え方とか、それによる出力の変化とか考えると、結構面倒だけど、自分用に決め打ちしとけば何とかなるでしょう。
あと、「[%p<>%u<>%g<>%s]」みたいなのはCPANに転がってたりしそうな気もするので、それを使うとか。
そんなところでなかろうか。
[追記]
http://search.cpan.org/~darren/String-Format-1.14/Format.pm というのがあった。
反応してくれた人がイター!
ちょっと嬉しい。
> 別にrubyでもsedでも良いけど、正規表現で問題なくパース出来るんじゃない?
毎回正規表現考えるのも面倒かなーとかとか。
> 位置あわせでよいのかな?ほかにある?
理想を語ると出力形式指定できれば最強だなーとか妄想してた。
--output-style "[%p<>%u<>%g<>%s] %n"
とすると
| |-- [-rw-r--r--<>hoge<>hoge<>9108] HTTP_BAD_GATEWAY.html.var
みたいな。
別にコマンド的である必要はまったくないっす。
> # tree -pugs | perl -e '@line=<>; $max=(sort map {/(.*?)\[/; length($1)} @line)[0]; map {s/(.*?)\[/$1 . " "x($max-length($1))."\["/e} @line; print @line'
実行してみたら出力に変化がなかった。アルェー?
何にせよPerlじゃね?ってのは超同意。
とかく出力形式を指定できたら便利だなーと。
この手のディレクトリ状況調べて提出してちょ、みたいな要求はちらほらあるのですよ。
付け加えると、CSVで出してちょーみたいな要求の場合はfindとかlsとかgrepとかその辺組み合わせてどうにでもなる感じです。
| |-- [-rw-r--r-- hoge hoge 9108] HTTP_BAD_GATEWAY.html.var
を前提に。
別にrubyでもsedでも良いけど、正規表現で問題なくパース出来るんじゃない?
位置あわせでよいのかな?ほかにある?
なんにせよ、基本的にperlじゃね?って感じで。
# tree -pugs | perl -e '@line=<>; $max=(sort map {/(.*?)\[/; length($1)} @line)[0]; map {s/(.*?)\[/$1 . " "x($max-length($1))."\["/e} @line; print @line'
かな?たぶん。
便利すぐる!とか思ったんだけど、オプション次第では出力がちょっと汚い。
これってうまいこと成形できないかな。かな。
これ。
http://arbolbell.jp/tools/2007/11/linux-tree.html
[root@localhost www]# tree . |-- cgi-bin |-- error | |-- HTTP_BAD_GATEWAY.html.var | |-- HTTP_BAD_REQUEST.html.var | |-- HTTP_FORBIDDEN.html.var | |-- HTTP_GONE.html.var | |-- HTTP_INTERNAL_SERVER_ERROR.html.var | |-- HTTP_LENGTH_REQUIRED.html.var | |-- HTTP_METHOD_NOT_ALLOWED.html.var | |-- HTTP_NOT_FOUND.html.var | |-- HTTP_NOT_IMPLEMENTED.html.var | |-- HTTP_PRECONDITION_FAILED.html.var | |-- HTTP_REQUEST_ENTITY_TOO_LARGE.html.var | |-- HTTP_REQUEST_TIME_OUT.html.var | |-- HTTP_REQUEST_URI_TOO_LARGE.html.var | |-- HTTP_SERVICE_UNAVAILABLE.html.var | |-- HTTP_UNAUTHORIZED.html.var | |-- HTTP_UNSUPPORTED_MEDIA_TYPE.html.var | |-- HTTP_VARIANT_ALSO_VARIES.html.var | |-- README | |-- contact.html.var | |-- include | | |-- bottom.html | | |-- spacer.html | | `-- top.html | `-- noindex.html |-- html (以下略)
こんな感じで出してくれる。超便利。
[root@localhost www]# tree -pugs . |-- [drwxr-xr-x hoge hoge 4096] cgi-bin |-- [drwxr-xr-x hoge hoge 4096] error | |-- [-rw-r--r-- hoge hoge 9108] HTTP_BAD_GATEWAY.html.var | |-- [-rw-r--r-- hoge hoge 6633] HTTP_BAD_REQUEST.html.var | |-- [-rw-r--r-- hoge hoge 11193] HTTP_FORBIDDEN.html.var | |-- [-rw-r--r-- hoge hoge 12700] HTTP_GONE.html.var | |-- [-rw-r--r-- hoge hoge 12846] HTTP_INTERNAL_SERVER_ERROR.html.var | |-- [-rw-r--r-- hoge hoge 7539] HTTP_LENGTH_REQUIRED.html.var | |-- [-rw-r--r-- hoge hoge 6773] HTTP_METHOD_NOT_ALLOWED.html.var | |-- [-rw-r--r-- hoge hoge 13255] HTTP_NOT_FOUND.html.var | |-- [-rw-r--r-- hoge hoge 6336] HTTP_NOT_IMPLEMENTED.html.var | |-- [-rw-r--r-- hoge hoge 6565] HTTP_PRECONDITION_FAILED.html.var | |-- [-rw-r--r-- hoge hoge 7802] HTTP_REQUEST_ENTITY_TOO_LARGE.html.var | |-- [-rw-r--r-- hoge hoge 7099] HTTP_REQUEST_TIME_OUT.html.var | |-- [-rw-r--r-- hoge hoge 7103] HTTP_REQUEST_URI_TOO_LARGE.html.var | |-- [-rw-r--r-- hoge hoge 7822] HTTP_SERVICE_UNAVAILABLE.html.var | |-- [-rw-r--r-- hoge hoge 13035] HTTP_UNAUTHORIZED.html.var | |-- [-rw-r--r-- hoge hoge 6353] HTTP_UNSUPPORTED_MEDIA_TYPE.html.var | |-- [-rw-r--r-- hoge hoge 7009] HTTP_VARIANT_ALSO_VARIES.html.var | |-- [-rw-r--r-- hoge hoge 1979] README | |-- [-rw-r--r-- hoge hoge 4256] contact.html.var | |-- [drwxr-xr-x hoge hoge 4096] include | | |-- [-rw-r--r-- hoge hoge 291] bottom.html | | |-- [-rw-r--r-- hoge hoge 9] spacer.html | | `-- [-rw-r--r-- hoge hoge 969] top.html | `-- [-rw-r--r-- hoge hoge 5043] noindex.html |-- [drwxr-xr-x hoge hoge 4096] html (以下略)
いまいちかっちょわるい。
体裁とか好きなようにいじれたらそのまま書類にできるんだけどなーと。
欲しいものをまとめると
http://anond.hatelabo.jp/20080415182703
てな感じです。
http://anond.hatelabo.jp/20080416071526
雛型をtreetest.plとして保存して動かすとこんな感じになりました。
[root@localhost www]# perl ./treetest.pl . |-- [drwxr-xr-x hoge hoge 4096] cgi-bin |-- [drwxr-xr-x hoge hoge 4096] error | |-- [-rw-r--r-- hoge hoge 9108] HTTP_BAD_GATEWAY.html.var | |-- [-rw-r--r-- hoge hoge 6633] HTTP_BAD_REQUEST.html.var | |-- [-rw-r--r-- hoge hoge 11193] HTTP_FORBIDDEN.html.var | |-- [-rw-r--r-- hoge hoge 12700] HTTP_GONE.html.var | |-- [-rw-r--r-- hoge hoge 12846] HTTP_INTERNAL_SERVER_ERROR.html.var | |-- [-rw-r--r-- hoge hoge 7539] HTTP_LENGTH_REQUIRED.html.var | |-- [-rw-r--r-- hoge hoge 6773] HTTP_METHOD_NOT_ALLOWED.html.var | |-- [-rw-r--r-- hoge hoge 13255] HTTP_NOT_FOUND.html.var | |-- [-rw-r--r-- hoge hoge 6336] HTTP_NOT_IMPLEMENTED.html.var | |-- [-rw-r--r-- hoge hoge 6565] HTTP_PRECONDITION_FAILED.html.var | |-- [-rw-r--r-- hoge hoge 7802] HTTP_REQUEST_ENTITY_TOO_LARGE.html.var | |-- [-rw-r--r-- hoge hoge 7099] HTTP_REQUEST_TIME_OUT.html.var | |-- [-rw-r--r-- hoge hoge 7103] HTTP_REQUEST_URI_TOO_LARGE.html.var | |-- [-rw-r--r-- hoge hoge 7822] HTTP_SERVICE_UNAVAILABLE.html.var | |-- [-rw-r--r-- hoge hoge 13035] HTTP_UNAUTHORIZED.html.var | |-- [-rw-r--r-- hoge hoge 6353] HTTP_UNSUPPORTED_MEDIA_TYPE.html.var | |-- [-rw-r--r-- hoge hoge 7009] HTTP_VARIANT_ALSO_VARIES.html.var | |-- [-rw-r--r-- hoge hoge 1979] README | |-- [-rw-r--r-- hoge hoge 4256] contact.html.var | |-- [drwxr-xr-x hoge hoge 4096] include | | |-- [-rw-r--r-- hoge hoge 291] bottom.html | | |-- [-rw-r--r-- hoge hoge 9] spacer.html | | `-- [-rw-r--r-- hoge hoge 969] top.html | `-- [-rw-r--r-- hoge hoge 5043] noindex.html |-- [drwxr-xr-x hoge hoge 4096] html (以下略)
ステキすぐる。
これを元にいろいろいぢくればcodereposでコミっても怒られないものができそう。
Format.pmもかなり使えそうと言うか僕の要求ずばりですよ。
20070629230000改定
20070702125800バグ発見:スクリプト中にある「&&」が、「&&」になっている。増田の仕様らしい。
20070827224900改定
// ==UserScript== // @name anond pickup // @namespace http://anond.hatelabo.jp/20070608230645 // @description pickup trackback tree top section at Hatelabo::AnonymousDiary // @include http://anond.hatelabo.jp/* // ==/UserScript== (function() { var threshold_bm = 1; var threshold_tb = 1; var ignoreList = { "/20070801172335": 33, "/20070806163721": 10, }; var firstPager_l = document.evaluate("//div[@class='pager-l']",document,null,XPathResult.FIRST_ORDERED_NODE_TYPE,null).singleNodeValue; function Hide(){} Hide.prototype.setup = function() { this.style = document.createElement("style"); this.style.id = "hide"; this.style.type = "text/css"; document.getElementsByTagName("head")[0].appendChild(this.style); var self = this; this.a = new Object(); this.a.visible = document.createElement("a"); this.a.visible.id = "visible"; this.a.visible.href = "#"; this.a.visible.innerHTML = "visible hide section"; // this.a.visible.setAttribute("onclick","document.getElementById('hide').innerHTML = 'div.hide {display: block}';document.getElementById('visible').style.display = 'none';document.getElementById('unvisible').style.display = 'inline';"); this.a.visible.addEventListener("click", function(){self.visible()}, false); firstPager_l.parentNode.insertBefore(this.a.visible, firstPager_l); this.a.unvisible = document.createElement("a"); this.a.unvisible.id = "unvisible"; this.a.unvisible.href = "#"; this.a.unvisible.innerHTML = "unvisible hide section"; // this.a.visible.setAttribute("onclick","document.getElementById('hide').innerHTML = 'div.hide {display: none}';document.getElementById('visible').style.display = 'inline';document.getElementById('unvisible').style.display = 'none';"); this.a.unvisible.addEventListener("click", function(){self.unvisible()}, false); firstPager_l.parentNode.insertBefore(this.a.unvisible, firstPager_l); if (GM_getValue("visible", 0)) { this.visible(); } else { this.unvisible(); } } Hide.prototype.visible = function() { this.style.innerHTML = "div.hide {display: block}"; this.a.visible.style.display = "none"; this.a.unvisible.style.display = "inline"; GM_setValue("visible", 1); } Hide.prototype.unvisible = function() { this.style.innerHTML = "div.hide {display: none}"; this.a.visible.style.display = "inline"; this.a.unvisible.style.display = "none"; GM_setValue("visible", 0); } Hide.prototype.append = function(section) { if (section.className.match(/hide/)) { return; } section.className += " hide"; } Hide.prototype.clear = function(section) { section.className = section.className.replace(/ hide/g, ""); } Hide.prototype.is = function(section) { return section.className.match(/hide/); } var hide = new Hide(); hide.setup(); var target = document.evaluate( "//div[@class='section' and child::*[not(@class='sectionfooter') and descendant::a[starts-with(@href,'http://anond.hatelabo.jp/2') or starts-with(@href,'/2') and not(child::span[@class='sanchor'])]]]", document,null,XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE,null); for (var i=0; i<target.snapshotLength; i++) { hide.append(target.snapshotItem(i)); } var tbs = document.evaluate( "//p[@class='sectionfooter']/a[2]", document,null,XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE,null); for (var i=0; i<tbs.snapshotLength; i++) { var tb = tbs.snapshotItem(i); if (tb.innerHTML == "\u30c8\u30e9\u30c3\u30af\u30d0\u30c3\u30af(0)") { // hide.append(tb.parentNode.parentNode); bookmark(tb, 0); } else if (! hide.is(tb.parentNode.parentNode)) { trackback(tb, 1); } else { bookmark(tb, 1); } } function trackback(tb, callback) { GM_xmlhttpRequest({ method: "GET", url: "http://anond.hatelabo.jp/" + tb.pathname.match(/\d{14}/), onload: function(result) { var link = result.responseText.match(/<a name="tb">(.|\s)*/)[0].match(/<li>\s*<a href="http:\/\/anond.hatelabo.jp\/\d{14}"/g); var n = link.length; for (var l in link) { var m = "/" + link[l].match(/\d{14}/); if (m in ignoreList) { n -= ignoreList[m]; } } if (n < threshold_tb) { tb.innerHTML = tb.innerHTML.replace(/\)$/, "/"+n+")"); if (callback) { bookmark(tb); } } else { tb.innerHTML = tb.innerHTML.replace(/\)$/, '/<span style="color: red;">'+n+"</span>)"); } } }); } function bookmark(tb, callback){ GM_xmlhttpRequest({ method: "GET", url: "http://b.hatena.ne.jp/entry/rss/http://anond.hatelabo.jp/" + tb.pathname.match(/\d{14}/), onload: function(result) { var r = result.responseText.match(/<rdf:li rdf:resource=/g); if (r && r.length >= threshold_bm){ hide.clear(tb.parentNode.parentNode); if (callback) { trackback(tb); } } else { hide.append(tb.parentNode.parentNode); } } }); } })();
今はスッキリしているのは古いやつ
/// ==UserScript== // @name anond pickup // @namespace http://anond.hatelabo.jp/20070608230645 // @description pickup trackback tree top section at Hatelabo::AnonymousDiary // @include http://anond.hatelabo.jp/*?page=* // ==/UserScript== (function() { var target = document.evaluate( "//div[@class='section' and child::*[not(@class='sectionfooter') and descendant::a[starts-with(@href,'http://anond.hatelabo.jp/2') or starts-with(@href,'/2') and not(child::span[@class='sanchor'])]]]", document, null, XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE, null); for(var i=0; i<target.snapshotLength; i++) { target.snapshotItem(i).style.display = "none"; } var trackback = document.evaluate( "//p[@class='sectionfooter']/a[2]", document, null, XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE, null); for(var i=0; i<trackback.snapshotLength; i++) { if (trackback.snapshotItem(i).innerHTML == "\u30c8\u30e9\u30c3\u30af\u30d0\u30c3\u30af(0)") { trackback.snapshotItem(i).parentNode.parentNode.style.display = "none"; } else if (trackback.snapshotItem(i).parentNode.parentNode.style.display != "none") { count(trackback.snapshotItem(i)); } } function count(tb) { GM_xmlhttpRequest({ method: "GET", url: "http://anond.hatelabo.jp/" + tb.getAttribute("href").match(/[0-9]{14}/), onload: function(result) { var n = result.responseText.replace(/\n/g,"").match(/<a name="tb">.*/)[0].match(/<li>/g).length; if (n < 10) { tb.innerHTML = tb.innerHTML.replace(/\)$/,"/"+n+")"); } else { tb.innerHTML = tb.innerHTML.replace(/\)$/,'/<span style="color: red;">'+n+"</span>)"); } } }); } })();