<?xml version="1.0" encoding="utf-8" ?>
<rss version="2.0"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xml:lang="ja">
	<channel>
		<title>otsune&#39;s SnakeOil </title>
		<link>http://subtech.g.hatena.ne.jp/otsune/</link>
		<description>otsune&#39;s SnakeOil </description>
		<dc:creator>otsune</dc:creator>


		<item>
			<title>[greasemonkey]PDF/PPT Viewer with Google Docsをqueryselector版に修正した</title>
			<link>http://subtech.g.hatena.ne.jp/otsune/20100124/pdfpptviewerwithgoogle</link>

			<description><![CDATA[
		<div class="section">
			<p>元ネタは<a href="http://d.hatena.ne.jp/blooo/20100118/1263818555" target="_blank">no title</a>で。</p>
			<ul>
				<li><a href="http://gist.github.com/285202" target="_blank">http://gist.github.com/285202</a></li>
				<li><a href="http://coderepos.org/share/browser/lang/javascript/userscripts/pdfppt_viewer_with_google.user.js?" target="_blank">http://coderepos.org/share/browser/lang/javascript/userscripts/pdfppt_viewer_with_google.user.js?</a></li>
			</ul>
<pre class="syntax-highlight">
<span class="synComment">// ==UserScript==</span>
<span class="synComment">// @name           PDF/PPT viewer with Google docs</span>
<span class="synComment">// @namespace      http://www.otsune.com/</span>
<span class="synComment">// @include        http://*</span>
<span class="synComment">// @include        https://*</span>
<span class="synComment">// @exclude        http://docs.google.com/*</span>
<span class="synComment">// @version        0.2</span>
<span class="synComment">// ==/UserScript==</span>
<span class="synComment">// Based on http://d.hatena.ne.jp/blooo/20100118/1263818555</span>

(<span class="synIdentifier">function</span>() <span class="synIdentifier">{</span>
    <span class="synStatement">if</span> (<span class="synStatement">location</span>.hostname == <span class="synConstant">&quot;docs.google.com&quot;</span>) <span class="synStatement">return</span>;
    <span class="synIdentifier">function</span> handle(node)<span class="synIdentifier">{</span>
        <span class="synIdentifier">var</span> items = node.querySelectorAll(<span class="synConstant">'a[href$=&quot;.pdf&quot;], a[href$=&quot;.ppt&quot;]'</span>);
        <span class="synStatement">for</span> (<span class="synIdentifier">var</span> i = 0; i &lt; items.length; i++) <span class="synIdentifier">{</span>
            <span class="synIdentifier">var</span> item = items<span class="synIdentifier">[</span>i<span class="synIdentifier">]</span>;
            <span class="synStatement">if</span> (item.hostname != <span class="synConstant">&quot;docs.google.com&quot;</span>) <span class="synIdentifier">{</span>
                <span class="synIdentifier">var</span> ico = <span class="synStatement">document</span>.createElement(<span class="synConstant">&quot;img&quot;</span>);
                ico.src = <span class="synConstant">&quot;http://docs.google.com/favicon.ico&quot;</span>;
                item.parentNode.insertBefore(ico, item);
                item.href = <span class="synConstant">'http://docs.google.com/viewer?url='</span> + item.href;
            <span class="synIdentifier">}</span>
        <span class="synIdentifier">}</span>
    <span class="synIdentifier">}</span>
    <span class="synStatement">document</span>.body.addEventListener(<span class="synConstant">'AutoPagerize_DOMNodeInserted'</span>,<span class="synIdentifier">function</span>(evt)<span class="synIdentifier">{</span>
        <span class="synIdentifier">var</span> node = evt.target;
        handle(node);
    <span class="synIdentifier">}</span>, <span class="synConstant">false</span>);
    handle(<span class="synStatement">document</span>);
<span class="synIdentifier">}</span>)();
</pre>

			<p>また特定の拡張子のリンクを書き換えてアイコン入れるって処理ならユーザースタイルでもいける。</p>
			<p><a href="http://www.unkar.org/read/pc12.2ch.net/software/1253771697" target="_blank">http://www.unkar.org/read/pc12.2ch.net/software/1253771697</a></p>
<pre>
userContent.cssに、
a&#91;href$=&#34;.pdf&#34;]{
-moz-binding: url(&#34;pdf.xml#google&#34;);
}

それと同じ階層にpdf.xmlという名前で、
&#60;?xml version=&#34;1.0&#34;?&#62;
&#60;bindings xmlns=&#34;http://www.mozilla.org/xbl&#34;&#62;
&#60;binding id=&#34;google&#34;&#62;
&#60;implementation&#62;&#60;constructor&#62;&#60;!&#91;CDATA&#91;
this.href = &#39;http://docs.google.com/viewer?url=&#39; + this.href;
]]&#62;&#60;/constructor&#62;&#60;/implementation&#62;
&#60;/binding&#62;
&#60;/bindings&#62;
</pre>

		</div>
]]></description>

			<dc:creator>otsune</dc:creator>

			<pubDate>Sat, 23 Jan 2010 15:00:00 GMT</pubDate>


			<category>greasemonkey</category>


		</item>

		<item>
			<title>[FreeBSD]shells/scponlycが7.xR以降でjailのdevfsをマウントしないのでpatch</title>
			<link>http://subtech.g.hatena.ne.jp/otsune/20091229/scponlyc</link>

			<description><![CDATA[
		<div class="section">
			<p>FreeBSD 7.0R以降から/sbin/mount_devfsは無くなったのでエラーが出る。</p>
			<p>jailの/devにdevfsをマウントするためのコマンドが</p>
			<blockquote>
			<p>mount -t devfs devfs "/path/to/jail/dev"</p>
			</blockquote>
			<p>に成ってるので、kern.osreldateを見て分岐することに。</p>
<pre class="syntax-highlight">
<span class="synType">--- /usr/ports/shells/scponly/files/scponlyc.in	2008-04-03 23:14:28.000000000 +0900</span>
<span class="synType">+++ /usr/ports/shells/scponly/files/scponlyc.in	2009-12-29 18:59:14.000000000 +0900</span>
<span class="synStatement">@@ -28,6 +28,8 @@</span>
 
 scponlyc=%%PREFIX%%/sbin/scponlyc
 
<span class="synIdentifier">+OSVERSION=`sysctl -n kern.osreldate`</span>
<span class="synIdentifier">+</span>
 make_devfs() {
 	# $1 is the user name whose home directory needs a minimal
 	# devfs created. If ~/dev exists, it will be deleted.
<span class="synStatement">@@ -36,10 +38,14 @@</span>
 	while /sbin/umount &quot;${DEV}&quot; 2&gt;/dev/null; do :; done
 	/bin/rm -rf &quot;${DEV}&quot;
 	/bin/mkdir -p &quot;${DEV}&quot;
<span class="synSpecial">-	if /sbin/mount -t devfs dev &quot;${DEV}&quot;; then</span>
<span class="synSpecial">-		/sbin/devfs -m &quot;${DEV}&quot; rule -s 1 applyset &amp;&amp; \</span>
<span class="synSpecial">-		/sbin/devfs -m &quot;${DEV}&quot; rule -s 2 applyset || \</span>
<span class="synSpecial">-		/sbin/umount &quot;${DEV}&quot; 2&gt;/dev/null</span>
<span class="synIdentifier">+        if [ ${OSVERSION} -gt 699999 ] then</span>
<span class="synIdentifier">+                /sbin/mount -t defvs defvs &quot;${DEV}&quot;</span>
<span class="synIdentifier">+        else</span>
<span class="synIdentifier">+		if /sbin/mount -t devfs dev &quot;${DEV}&quot;; then</span>
<span class="synIdentifier">+			/sbin/devfs -m &quot;${DEV}&quot; rule -s 1 applyset &amp;&amp; \</span>
<span class="synIdentifier">+			/sbin/devfs -m &quot;${DEV}&quot; rule -s 2 applyset || \</span>
<span class="synIdentifier">+			/sbin/umount &quot;${DEV}&quot; 2&gt;/dev/null</span>
<span class="synIdentifier">+		fi</span>
 	fi
 }
 
</pre>

		</div>
]]></description>

			<dc:creator>otsune</dc:creator>

			<pubDate>Mon, 28 Dec 2009 15:00:00 GMT</pubDate>


			<category>FreeBSD</category>


		</item>

		<item>
			<title>[javascript]アニメ！アニメ！のエントリータイトルをtitleタグに追加するグリモン書いた</title>
			<link>http://subtech.g.hatena.ne.jp/otsune/20091228/animeanime</link>

			<description><![CDATA[
		<div class="section">
			<p>発端は<a href="http://d.hatena.ne.jp/mame-tanuki/20091227/animeanime" target="_blank">「アニメ！アニメ！がブクマされにくいのは何でかね」問題 - そっと××</a>から。</p>
			<p>（そもそもmovabletypeつかってるんなら&lt;mt:EntryTitle /&gt;をtitleタグのところに入れりゃ済む話なんで、そういう啓蒙をするのが先だったりする）</p>
			<p>普段ならcho45の$X関数をコピペする事例だけど、はしょってstringValueで。</p>
<pre class="syntax-highlight">
<span class="synComment">// ==UserScript==</span>
<span class="synComment">// @name           animeanime.jp: replace title with entrytitle</span>
<span class="synComment">// @namespace      http://www.otsune.com/</span>
<span class="synComment">// @description    replace title with entrytitle</span>
<span class="synComment">// @include        http://animeanime.jp/*</span>
<span class="synComment">// ==/UserScript==</span>

(<span class="synIdentifier">function</span>() <span class="synIdentifier">{</span>
    <span class="synComment">//var xpath = 'id(&quot;blog&quot;)/div[@class=&quot;blog_box&quot;]/div[@class=&quot;b_tit&quot;]/a';</span>
    <span class="synIdentifier">var</span> xpath = <span class="synConstant">'//div[@class=&quot;b_tit&quot;]/a'</span>;
    <span class="synIdentifier">var</span> entryname = <span class="synStatement">document</span>.evaluate(xpath, <span class="synStatement">document</span>, <span class="synStatement">null</span>, XPathResult.STRING_TYPE, <span class="synStatement">null</span>).stringValue;
    <span class="synStatement">if</span>(entryname.length) <span class="synIdentifier">{</span>
        <span class="synStatement">document</span>.title = entryname + <span class="synConstant">' - '</span> + <span class="synStatement">document</span>.title;
    <span class="synIdentifier">}</span>
<span class="synIdentifier">}</span>)();
</pre>

			<p><a href="http://svn.coderepos.org/share/lang/javascript/userscripts/animeanime_replace_title.user.js" target="_blank">http://svn.coderepos.org/share/lang/javascript/userscripts/animeanime_replace_title.user.js</a></p>
			<p>ついでにuse.<a class="keyword" href="http://subtech.g.hatena.ne.jp/keyword/Perl">Perl</a>のjournalもtitle追加するグリモン書いた。</p>
			<p>こういうのはWedataでXPathを共有してgistとかでも使えるようにするってのがいいかも<a class="keyword" href="http://subtech.g.hatena.ne.jp/keyword/%e3%81%aa%e3%81%81%e3%80%82">なぁ。</a></p>
<pre class="syntax-highlight">
<span class="synComment">// ==UserScript==</span>
<span class="synComment">// @name           use Perl Journal: Add title with journal title</span>
<span class="synComment">// @namespace      http://www.otsune.com/</span>
<span class="synComment">// @include        http://use.perl.org/~*/journal/*</span>
<span class="synComment">// ==/UserScript==</span>

(<span class="synIdentifier">function</span>() <span class="synIdentifier">{</span>
    <span class="synIdentifier">var</span> xpath = <span class="synConstant">'id(&quot;journalslashdot&quot;)/div[@class=&quot;title&quot;]/h3'</span>;
    <span class="synIdentifier">var</span> journaltitle = <span class="synStatement">document</span>.evaluate(xpath, <span class="synStatement">document</span>, <span class="synStatement">null</span>, XPathResult.STRING_TYPE, <span class="synStatement">null</span>).stringValue;
    <span class="synStatement">if</span>(journaltitle.length) <span class="synIdentifier">{</span>
        <span class="synStatement">document</span>.title = journaltitle + <span class="synConstant">' - '</span> + <span class="synStatement">document</span>.title;
    <span class="synIdentifier">}</span>
<span class="synIdentifier">}</span>)();
</pre>

			<p><a href="http://svn.coderepos.org/share/lang/javascript/userscripts/use_perl_journal_add_tit.user.js" target="_blank">http://svn.coderepos.org/share/lang/javascript/userscripts/use_perl_journal_add_tit.user.js</a></p>
		</div>
]]></description>

			<dc:creator>otsune</dc:creator>

			<pubDate>Sun, 27 Dec 2009 15:00:00 GMT</pubDate>


			<category>javascript</category>


		</item>

		<item>
			<title>Chromium for MacにAutoPatchWorkとChrome Keyconfigとtableauを入れた</title>
			<link>http://subtech.g.hatena.ne.jp/otsune/20091120/chromiumformac</link>

			<description><![CDATA[
		<div class="section">
			<p>Chromium for Macは<a href="http://build.chromium.org/buildbot/snapshots/chromium-rel-mac/" target="_blank">Index of /buildbot/snapshots/chromium-rel-mac</a>から。</p>
			<p>拡張機能は<a href="http://ss-o.net/chrome_extension/" target="_blank">no title</a>と<a href="http://ido.nu/kuma/2009/11/20/chromium-for-tableau-2-0/" target="_blank">chromium for tableauでタグをつけたりできるようになりました &laquo; ku</a>から。</p>
			<p>Chrome KeyConfigのキーバインドはvimperator風にした。あんまり詰め切れていないけど。</p>
<pre class="syntax-highlight">
{
  &quot;name&quot;: &quot;Chrome Keyconfig&quot;, 
  &quot;version&quot;: &quot;1.5.3&quot;, 
  &quot;normal_actions&quot;: {
    &quot;j&quot;: {
      &quot;name&quot;: &quot;scroll down&quot;, 
      &quot;args&quot;: []
    }, 
    &quot;k&quot;: {
      &quot;name&quot;: &quot;scroll up&quot;, 
      &quot;args&quot;: []
    }, 
    &quot;h&quot;: {
      &quot;name&quot;: &quot;scroll left&quot;, 
      &quot;args&quot;: []
    }, 
    &quot;l&quot;: {
      &quot;name&quot;: &quot;scroll right&quot;, 
      &quot;args&quot;: []
    }, 
    &quot;M-j&quot;: {
      &quot;name&quot;: &quot;scroll down half page&quot;, 
      &quot;args&quot;: []
    }, 
    &quot;M-k&quot;: {
      &quot;name&quot;: &quot;scroll up half page&quot;, 
      &quot;args&quot;: []
    }, 
    &quot;M-J&quot;: {
      &quot;name&quot;: &quot;scroll to bottom&quot;, 
      &quot;args&quot;: []
    }, 
    &quot;M-K&quot;: {
      &quot;name&quot;: &quot;scroll to top&quot;, 
      &quot;args&quot;: []
    }, 
    &quot;C-d&quot;: {
      &quot;name&quot;: &quot;navigate form elements forward&quot;, 
      &quot;args&quot;: []
    }, 
    &quot;C-u&quot;: {
      &quot;name&quot;: &quot;navigate form elements backward&quot;, 
      &quot;args&quot;: []
    }, 
    &quot;Esc&quot;: {
      &quot;name&quot;: &quot;limited mode&quot;, 
      &quot;args&quot;: []
    }, 
    &quot;k e y c o n f i g&quot;: {
      &quot;name&quot;: &quot;Keyconfig&quot;, 
      &quot;args&quot;: []
    }, 
    &quot;u&quot;: {
      &quot;name&quot;: &quot;re-open closed tab&quot;, 
      &quot;args&quot;: []
    }, 
    &quot;d&quot;: {
      &quot;name&quot;: &quot;close this tab&quot;, 
      &quot;args&quot;: []
    }, 
    &quot;C-i&quot;: {
      &quot;name&quot;: &quot;focus first text input&quot;, 
      &quot;args&quot;: []
    }, 
    &quot;f&quot;: {
      &quot;name&quot;: &quot;hit a hint&quot;, 
      &quot;args&quot;: [
        &quot;;&quot;
      ]
    }, 
    &quot;g t&quot;: {
      &quot;name&quot;: &quot;select right tab&quot;, 
      &quot;args&quot;: []
    }, 
    &quot;g T&quot;: {
      &quot;name&quot;: &quot;select left tab&quot;, 
      &quot;args&quot;: []
    }, 
    &quot;g g&quot;: {
      &quot;name&quot;: &quot;scroll to top&quot;, 
      &quot;args&quot;: []
    }, 
    &quot;G&quot;: {
      &quot;name&quot;: &quot;scroll to bottom&quot;, 
      &quot;args&quot;: []
    }, 
    &quot;H&quot;: {
      &quot;name&quot;: &quot;back&quot;, 
      &quot;args&quot;: []
    }, 
    &quot;L&quot;: {
      &quot;name&quot;: &quot;forward&quot;, 
      &quot;args&quot;: []
    }, 
    &quot;g u&quot;: {
      &quot;name&quot;: &quot;go to parent dir&quot;, 
      &quot;args&quot;: []
    }, 
    &quot;: t&quot;: {
      &quot;name&quot;: &quot;open new tab&quot;, 
      &quot;args&quot;: []
    }, 
    &quot;r&quot;: {
      &quot;name&quot;: &quot;reload&quot;, 
      &quot;args&quot;: []
    }, 
    &quot;R&quot;: {
      &quot;name&quot;: &quot;cacheless reload&quot;, 
      &quot;args&quot;: []
    }, 
    &quot;g 0&quot;: {
      &quot;name&quot;: &quot;select first tab&quot;, 
      &quot;args&quot;: []
    }, 
    &quot;g $&quot;: {
      &quot;name&quot;: &quot;select last tab&quot;, 
      &quot;args&quot;: []
    }, 
    &quot;J&quot;: {
      &quot;name&quot;: &quot;scroll down half page&quot;, 
      &quot;args&quot;: []
    }, 
    &quot;K&quot;: {
      &quot;name&quot;: &quot;scroll up half page&quot;, 
      &quot;args&quot;: []
    }
  }, 
  &quot;limited_actions&quot;: {
    &quot;Esc&quot;: {
      &quot;name&quot;: &quot;normal mode&quot;, 
      &quot;args&quot;: []
    }
  }, 
  &quot;useTabTitle&quot;: false, 
  &quot;smooth_scroll&quot;: false, 
  &quot;ldrize&quot;: true, 
  &quot;chrome_vim&quot;: true, 
  &quot;vim_normal_actions&quot;: {
    &quot;j&quot;: {
      &quot;name&quot;: &quot;Down&quot;, 
      &quot;args&quot;: []
    }, 
    &quot;k&quot;: {
      &quot;name&quot;: &quot;Up&quot;, 
      &quot;args&quot;: []
    }, 
    &quot;h&quot;: {
      &quot;name&quot;: &quot;Left&quot;, 
      &quot;args&quot;: []
    }, 
    &quot;l&quot;: {
      &quot;name&quot;: &quot;Right&quot;, 
      &quot;args&quot;: []
    }, 
    &quot;^&quot;: {
      &quot;name&quot;: &quot;Line head&quot;, 
      &quot;args&quot;: []
    }, 
    &quot;$&quot;: {
      &quot;name&quot;: &quot;Line foot&quot;, 
      &quot;args&quot;: []
    }, 
    &quot;Esc&quot;: {
      &quot;name&quot;: &quot;normal mode&quot;, 
      &quot;args&quot;: []
    }, 
    &quot;i&quot;: {
      &quot;name&quot;: &quot;insert mode&quot;, 
      &quot;args&quot;: []
    }
  }, 
  &quot;vim_insert_actions&quot;: {
    &quot;Esc&quot;: {
      &quot;name&quot;: &quot;normal mode&quot;, 
      &quot;args&quot;: []
    }
  }, 
  &quot;vim_default_mode&quot;: &quot;insert&quot;, 
  &quot;vim_color_config&quot;: {
    &quot;normal&quot;: {
      &quot;background&quot;: &quot;gray&quot;, 
      &quot;text&quot;: &quot;black&quot;
    }, 
    &quot;insert&quot;: {
      &quot;background&quot;: &quot;white&quot;, 
      &quot;text&quot;: &quot;black&quot;
    }
  }
}
</pre>

			<p><a href="http://gist.github.com/239017" target="_blank">http://gist.github.com/239017</a></p>
		</div>
]]></description>

			<dc:creator>otsune</dc:creator>

			<pubDate>Thu, 19 Nov 2009 15:00:00 GMT</pubDate>



		</item>

	</channel>
</rss>
