<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>ProjeKt D.K &#187; Linux</title>
	<atom:link href="http://blog.punkid.org/tag/linux/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.punkid.org</link>
	<description>Where We ROT!</description>
	<lastBuildDate>Sun, 04 Jul 2010 07:51:43 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
	<atom:link rel='hub' href='http://blog.punkid.org/?pushpress=hub'/>
		<item>
		<title>用Remuco实现手机遥控MPD播放</title>
		<link>http://blog.punkid.org/2010/07/04/remote-control-mpd-via-remuco-with-your-smartphone/</link>
		<comments>http://blog.punkid.org/2010/07/04/remote-control-mpd-via-remuco-with-your-smartphone/#comments</comments>
		<pubDate>Sun, 04 Jul 2010 07:51:43 +0000</pubDate>
		<dc:creator>punkid</dc:creator>
				<category><![CDATA[Gadget]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[E71]]></category>
		<category><![CDATA[mobile]]></category>
		<category><![CDATA[mpd]]></category>
		<category><![CDATA[remuco]]></category>

		<guid isPermaLink="false">http://blog.punkid.org/?p=364</guid>
		<description><![CDATA[自从Amarok和Gwenview这两款qt3.5时代的经典K软跨入了qt4的2.0时代，我就彻底放弃了qt4下的所有软件，连KDE4都给mask了，为了能够继续用上Amarok 1.4，死守着kde-sunset overlay，无奈愈发觉得Amarok 1.4的内存占用率还是太高了，于是全面转向了MPD (Music Player Daemon) + ncmpcpp，还是字符界面加上强大的键盘快捷键操作最顺服，最省心。 既然MPD是纯粹的C/S理念，为MPD找个手机client端也应该不难。于是找到了Remuco这款软件，它能够通过蓝牙或者Wifi的方式遥控Linux下的大部分媒体播放器，包括Amarok, Audacious, Banshee, Exaile, MPD, MPlayer, Rhythmbox, Songbird, Totem, TVtime, VLC和XMMS2。而且由于本身基于java，理论上支持java且有蓝牙或者Wifi设备的手机都能安装并使用它，从它的List of client devices successfully used with Remuco上看，实验成功的手机还是蛮多的。我在我的诺记非阉割版的E71上也成功实现了，下面是我在Gentoo Linux和E71上的实现过程： （P.S: 这绝对是我最后一台诺记，别在BS我们这种没文化的弱鸡鸭用户了。我们都知道，有钱有文化的才用iPhone，Android手机。） 首先是保证你装了MPD，并且能够顺利运行，MPD默认使用的端口是6600，没有特殊需求的话，最好还是不要改。 然后是去Remuco的Googlecode上下载源码包。源码包包含两个部分，一个是主机上的server实现，另一个是手机用的客户端。一般来说我们都可以找到已经编译好的Remuco二进制包，在Gentoo下Sunrise overlay里也有ebuild，或者直接下载ebuild文件放到自己的本地overlay里吧，最近的版本是remuco-0.9.3-r2.ebuild。 因为我只需要开启remuco对MPD的支持，所以我只启用了mpd一个USE: # echo &#34;net-wireless/remuco mpd&#34; &#62;&#62; /etc/portage/package.use # emerge remuco 然后运行remuco-mpd, 如果你发现运行失败的话（请查看~/.cache/remuco/mpd.log），很有可能是和我一样，主机没有蓝牙设备，我们要做的是关闭remuco-mpd的蓝牙支持。找到~/.config/remuco/remuco.cfg文件，将如下一句键值替换: &#91;DEFAULT&#93; bluetooth-enabled = 0 #把1改为0 ... 重新运行remuco-mpd，如果~/.cache/remuco/mpd.log里有提示: [ manager.py ... [...]]]></description>
			<content:encoded><![CDATA[<p>自从Amarok和Gwenview这两款qt3.5时代的经典K软跨入了qt4的2.0时代，我就彻底放弃了qt4下的所有软件，连KDE4都给mask了，为了能够继续用上Amarok 1.4，死守着kde-sunset overlay，无奈愈发觉得Amarok 1.4的内存占用率还是太高了，于是全面转向了<a href="http://www.musicpd.org" title="Music Player Daemon">MPD</a> (Music Player Daemon) + <a href="http://unkart.ovh.org/ncmpcpp/" title="Ncmpcpp - ncmpc++ mpd client">ncmpcpp</a>，还是字符界面加上强大的键盘快捷键操作最顺服，最省心。</p>
<p>既然MPD是纯粹的C/S理念，为MPD找个手机client端也应该不难。于是找到了<a href="http://code.google.com/p/remuco/" title="Wireless remote control for Linux media players">Remuco</a>这款软件，它能够通过蓝牙或者Wifi的方式遥控Linux下的大部分媒体播放器，包括Amarok, Audacious, Banshee, Exaile, MPD, MPlayer, Rhythmbox, Songbird, Totem, TVtime, VLC和XMMS2。而且由于本身基于java，理论上支持java且有蓝牙或者Wifi设备的手机都能安装并使用它，从它的<a href="http://code.google.com/p/remuco/wiki/ClientDevices" title="List of client devices successfully used with Remuco">List of client devices successfully used with Remuco</a>上看，实验成功的手机还是蛮多的。我在我的诺记非阉割版的E71上也成功实现了，下面是我在Gentoo Linux和E71上的实现过程：</p>
<p>（P.S: 这绝对是我最后一台诺记，别在BS我们这种没文化的弱鸡鸭用户了。我们都知道，有钱有文化的才用iPhone，Android手机。）<br />
<span id="more-364"></span><br />
首先是保证你装了MPD，并且能够顺利运行，MPD默认使用的端口是6600，没有特殊需求的话，最好还是不要改。</p>
<p>然后是去Remuco的<a href="http://code.google.com/p/remuco/downloads/list" title="Downloads - remuco">Googlecode</a>上下载源码包。源码包包含两个部分，一个是主机上的server实现，另一个是手机用的客户端。一般来说我们都可以找到已经编译好的Remuco二进制包，在Gentoo下Sunrise overlay里也有ebuild，或者直接下载ebuild文件放到自己的本地overlay里吧，最近的版本是<a href="http://gentoo-overlays.zugaina.org/sunrise/portage/net-wireless/remuco/remuco-0.9.3-r2.ebuild" title="remuco-0.9.3-r2.ebuild for gentoo">remuco-0.9.3-r2.ebuild</a>。</p>
<p>因为我只需要开启remuco对MPD的支持，所以我只启用了<code>mpd</code>一个USE:</p>
<pre class="bash"><span style="color: #666666; font-style: italic;"># echo &quot;net-wireless/remuco mpd&quot; &gt;&gt; /etc/portage/package.use</span>
<span style="color: #666666; font-style: italic;"># emerge remuco</span></pre>
<p>然后运行<code>remuco-mpd</code>, 如果你发现运行失败的话（请查看<code>~/.cache/remuco/mpd.log</code>），很有可能是和我一样，主机没有蓝牙设备，我们要做的是关闭remuco-mpd的蓝牙支持。找到<code>~/.config/remuco/remuco.cfg</code>文件，将如下一句键值替换:</p>
<pre class="bash"><span style="color: #7a0874; font-weight: bold;">&#91;</span>DEFAULT<span style="color: #7a0874; font-weight: bold;">&#93;</span>
bluetooth-enabled = <span style="color: #000000;">0</span> <span style="color: #666666; font-style: italic;">#把1改为0</span>
...</pre>
<p>重新运行<code>remuco-mpd</code>，如果<code>~/.cache/remuco/mpd.log</code>里有提示: <code>[ manager.py ... ] player adapter started</code>则表示成功运行。</p>
<p>接下来是手机客户端，解压缩的源码包有个<code>client/midp/app</code>目录下有个<code>remuco.jad</code>和<code>remuco.jar</code>安装文件，不需要BT的话就安装<code>no-bluetooth</code>子目录下的安装包吧。</p>
<p>运行手机上的Remuco客户端，一般来说设置<code>Host or IP</code>项就行了，我通过路由器已经绑定了主机的固定IP为192.168.1.100，默认wifi的连接端口是34271，启用了iptables的话还得对端口放行，因为我同样固定了手机的IP为192.168.1.101，所以之前就通过iptables对来自手机的全部访问都放行了。</p>
<pre class="bash"><span style="color: #666666; font-style: italic;"># iptables -A INPUT -s 192.168.1.101 -j ACCEPT</span></pre>
<p>没什么问题的话，手机就能顺利控制MPD啦，这是主机上运行的ncmpcpp，显示正在播放Mono的<em>Follow the Map</em>。</p>
<p><img src="http://blog.punkid.org/wp-content/uploads/2010/07/ncmpcpp.png" alt="ncmpcpp" width="677" height="433" class="no-margin" /></p>
<p>来看下手机端的显示，同样是Mono的<em>Follow the Map</em>。</p>
<p><img src="http://blog.punkid.org/wp-content/uploads/2010/07/Screenshot0004.png" alt="Remuco on E71" width="320" height="240" /></p>
<p>还可以用手机查看播放列表及MPD上的音乐库，并通过手机进行遥控操作。</p>
<p><img src="http://blog.punkid.org/wp-content/uploads/2010/07/Screenshot0005.png" alt="Remuco on E71" width="320" height="240" /></p>
<p><img src="http://blog.punkid.org/wp-content/uploads/2010/07/Screenshot0006.png" alt="Remuco on E71" width="320" height="240" /></p>
<p>另外，录制了一小段演示视频，视频内演示了通过手机快捷键n/p实现歌曲的切换，以及添加歌曲到播放列表，整个操作都是手机端和主机同步的。拍的有点抖，实在不是当AV男的料啊 -_-|||（注：此视频基于HTML5的video技术，采用开源的ogv格式，只支持h.264的Safari&#8230;忽略你！）</p>
<p class="center">
<video class="html5-video" width="500" height="375" preload="none" controls><br />
<source src="http://punkid.org/glade/video/remuco-demo.ogv" type='video/ogg; codecs="theora, vorbis"' /><br />
</video></p>

	<h4>Related posts</h4>
	<ul class="st-related-posts">
	<li><a href="http://blog.punkid.org/2009/11/11/access-local-network-share-via-nokia-symsmb/" title="利用symSMB手机访问局域网共享 (November 11, 2009)">利用symSMB手机访问局域网共享</a> (6)</li>
	<li><a href="http://blog.punkid.org/2009/09/05/a-snapshot-of-my-nomadic-life-in-one-day/" title="A Snapshot of My Nomadic Life in One Day (September 5, 2009)">A Snapshot of My Nomadic Life in One Day</a> (6)</li>
	<li><a href="http://blog.punkid.org/2009/03/23/free-sms-notification-on-amule-completed-download/" title="给aMule增加下载完成短信通知功能 (March 23, 2009)">给aMule增加下载完成短信通知功能</a> (9)</li>
	<li><a href="http://blog.punkid.org/2008/03/28/howto-setup-git-repo-on-dreamhost/" title="在Dreamhost主机上搭建Git (March 28, 2008)">在Dreamhost主机上搭建Git</a> (9)</li>
	<li><a href="http://blog.punkid.org/2008/08/14/compile-tuxonice-kernel-in-archlinux/" title="在Archlinux下编译TuxOnIce内核 (August 14, 2008)">在Archlinux下编译TuxOnIce内核</a> (2)</li>
</ul>

]]></content:encoded>
			<wfw:commentRss>http://blog.punkid.org/2010/07/04/remote-control-mpd-via-remuco-with-your-smartphone/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
<enclosure url="http://punkid.org/glade/video/remuco-demo.ogv" length="31702290" type="video/ogg" />
		</item>
		<item>
		<title>aMule下载短信通知的飞信实现</title>
		<link>http://blog.punkid.org/2009/03/27/free-sms-notification-via-fetion-on-amule-completed-download/</link>
		<comments>http://blog.punkid.org/2009/03/27/free-sms-notification-via-fetion-on-amule-completed-download/#comments</comments>
		<pubDate>Fri, 27 Mar 2009 13:37:34 +0000</pubDate>
		<dc:creator>punkid</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[aMule]]></category>
		<category><![CDATA[gentoo]]></category>
		<category><![CDATA[飞信]]></category>

		<guid isPermaLink="false">http://blog.punkid.org/?p=303</guid>
		<description><![CDATA[上回用GCalcli实现了给aMule增加下载完成短信通知功能，不过由于GCal的短信格式问题并不完美，在Druggo的提示下转而使用飞信来实现这个吧。 飞信虽然在linux下已经有libfetion和linux-fetion for purple了，不过都没有直观的纯CLI操作方式。找来找去只找到个闭源的飞信机器人，这软件优点是:纯命令操作，简单快捷。 不爽的地方是: 闭源，依赖的库文件有版本要求。而且从主页来看，商业味比较浓，怕有猫腻 初次运行后会生成数个当前用户无访问权限的文件夹，强行删除再运行又会重新生成 唉，我又开始二了，用人家的东西还这么多牢骚。下面是实现方法： 在此处下载飞信机器人的linux版，运行程序依赖的库文件有4个:libcrypto.so.0.9.8, libssl.so.0.9.8, libACE.so.5.6.8, libACE_SSL.so.5.6.8。前两个属于openssh，后两个可以# emerge dev-libs/ace得到，鉴于版本问题和libACE 8MB的体积问题，还是直接下载它提供的库文件包吧。 建议解压后放到自己的$HOME目录下，例如我把它解压到$HOME/fetion-cli下，把解压的4个库文件也放到此目录下。 飞信机器人支持config文件读取帐户信息，创建一个$HOME/.fetion-cli.conf，按以下格式输入你的帐户信息: # ID Mobile Password 1 你的手机号码 你的飞信密码 然后是建立一个bash脚本fetion-sms.sh #!/bin/bash #usage: fetion-sms.sh MobileNum. ENTRY &#160; cd /home/punkid/fetion-cli LD_LIBRARY_PATH=. ./fetion --config=$HOME/.fetion-cli.conf --index=1 --to=$1 --msg-utf8=&#34;$2&#34; 这个脚本用法很简单，输入$ sh fetion-sms.sh 接收方的手机好码 飞信消息内容就完成了。 所以在aMule的Download completed event里配置如下就行了: sh /home/punkid/scripts/fetion-sms.sh 你的手机号码 &#34;%NAME 下载完成&#34; 这回算是比较满意了，飞信接收速度快而且不像GCal那样分两条不完整短信发过来。 Related posts [...]]]></description>
			<content:encoded><![CDATA[<p>上回用GCalcli实现了<a href="http://blog.punkid.org/2009/03/23/free-sms-notification-on-amule-completed-download" title="给aMule增加下载完成短信通知功能">给aMule增加下载完成短信通知功能</a>，不过由于GCal的短信格式问题并不完美，在<a href="http://blog.punkid.org/2009/03/23/free-sms-notification-on-amule-completed-download/comment-page-1/#comment-1470" title="Comment by Druggo">Druggo的提示</a>下转而使用飞信来实现这个吧。</p>
<p>飞信虽然在linux下已经有libfetion和linux-fetion for purple了，不过都没有直观的纯CLI操作方式。找来找去只找到个闭源的<a href="http://www.it-adv.net/" title="飞信机器人">飞信机器人</a>，这软件优点是:纯命令操作，简单快捷。</p>
<p>不爽的地方是:</p>
<ol>
<li>闭源，依赖的库文件有版本要求。而且从主页来看，商业味比较浓，怕有猫腻</li>
<li>初次运行后会生成数个当前用户无访问权限的文件夹，强行删除再运行又会重新生成</li>
</ol>
<p>唉，我又开始二了，用人家的东西还这么多牢骚。下面是实现方法：<br />
<span id="more-303"></span><br />
在<a href="http://bbs.it-adv.net/viewthread.php?tid=155" title="下载飞信机器人">此处下载飞信机器人的linux版</a>，运行程序依赖的库文件有4个:<code>libcrypto.so.0.9.8</code>, <code>libssl.so.0.9.8</code>, <code>libACE.so.5.6.8</code>, <code>libACE_SSL.so.5.6.8</code>。前两个属于openssh，后两个可以<code># emerge dev-libs/ace</code>得到，鉴于版本问题和libACE 8MB的体积问题，还是直接下载它提供的<a href="http://www.it-adv.net/fetion/downng/library_linux.tar.gz" title="飞信机器人 Linux库文件包">库文件包</a>吧。</p>
<p>建议解压后放到自己的<code>$HOME</code>目录下，例如我把它解压到<code>$HOME/fetion-cli</code>下，把解压的4个库文件也放到此目录下。</p>
<p>飞信机器人支持config文件读取帐户信息，创建一个<code>$HOME/.fetion-cli.conf</code>，按以下格式输入你的帐户信息:</p>
<pre>
# ID    Mobile          Password
1        你的手机号码   你的飞信密码
</pre>
<p>然后是建立一个bash脚本<code>fetion-sms.sh</code></p>
<pre class="bash"><span style="color: #666666; font-style: italic;">#!/bin/bash</span>
<span style="color: #666666; font-style: italic;">#usage: fetion-sms.sh MobileNum. ENTRY</span>
&nbsp;
<span style="color: #7a0874; font-weight: bold;">cd</span> <span style="color: #000000; font-weight: bold;">/</span>home<span style="color: #000000; font-weight: bold;">/</span>punkid<span style="color: #000000; font-weight: bold;">/</span>fetion-cli
<span style="color: #007800;">LD_LIBRARY_PATH</span>=. .<span style="color: #000000; font-weight: bold;">/</span>fetion <span style="color: #660033;">--config</span>=<span style="color: #007800;">$HOME</span><span style="color: #000000; font-weight: bold;">/</span>.fetion-cli.conf <span style="color: #660033;">--index</span>=<span style="color: #000000;">1</span> <span style="color: #660033;">--to</span>=$<span style="color: #000000;">1</span> <span style="color: #660033;">--msg-utf8</span>=<span style="color: #ff0000;">&quot;$2&quot;</span></pre>
<p>这个脚本用法很简单，输入<code>$ sh fetion-sms.sh 接收方的手机好码 飞信消息内容</code>就完成了。</p>
<p>所以在aMule的Download completed event里配置如下就行了:</p>
<pre class="bash"><span style="color: #c20cb9; font-weight: bold;">sh</span> <span style="color: #000000; font-weight: bold;">/</span>home<span style="color: #000000; font-weight: bold;">/</span>punkid<span style="color: #000000; font-weight: bold;">/</span>scripts<span style="color: #000000; font-weight: bold;">/</span>fetion-sms.sh 你的手机号码 <span style="color: #ff0000;">&quot;%NAME 下载完成&quot;</span></pre>
<p>这回算是比较满意了，飞信接收速度快而且不像GCal那样分两条不完整短信发过来。</p>

	<h4>Related posts</h4>
	<ul class="st-related-posts">
	<li><a href="http://blog.punkid.org/2009/03/23/free-sms-notification-on-amule-completed-download/" title="给aMule增加下载完成短信通知功能 (March 23, 2009)">给aMule增加下载完成短信通知功能</a> (9)</li>
	<li><a href="http://blog.punkid.org/2008/11/09/why-to-upgrade-to-libgpod-svn-build/" title="Why to Upgrade to Libgpod SVN Build (November 9, 2008)">Why to Upgrade to Libgpod SVN Build</a> (3)</li>
	<li><a href="http://blog.punkid.org/2007/11/10/why-i-love-gentoo-and-its-community-so-much/" title="Why I &lt;3 Gentoo and Its Community So Much (November 10, 2007)">Why I &lt;3 Gentoo and Its Community So Much</a> (6)</li>
	<li><a href="http://blog.punkid.org/2008/08/23/use-gentoo-bashrc-under-archlinux/" title="Use gentoo-bashrc under Archlinux (August 23, 2008)">Use gentoo-bashrc under Archlinux</a> (7)</li>
	<li><a href="http://blog.punkid.org/2008/01/06/ultimate-guide-to-manage-your-ipod-under-linux/" title="Ultimate Guide to Manage Your iPod under Linux : Revised (January 6, 2008)">Ultimate Guide to Manage Your iPod under Linux : Revised</a> (53)</li>
</ul>

]]></content:encoded>
			<wfw:commentRss>http://blog.punkid.org/2009/03/27/free-sms-notification-via-fetion-on-amule-completed-download/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>给aMule增加下载完成短信通知功能</title>
		<link>http://blog.punkid.org/2009/03/23/free-sms-notification-on-amule-completed-download/</link>
		<comments>http://blog.punkid.org/2009/03/23/free-sms-notification-on-amule-completed-download/#comments</comments>
		<pubDate>Mon, 23 Mar 2009 13:40:16 +0000</pubDate>
		<dc:creator>punkid</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[aMule]]></category>
		<category><![CDATA[gcalcli]]></category>
		<category><![CDATA[gentoo]]></category>
		<category><![CDATA[Google App]]></category>

		<guid isPermaLink="false">http://blog.punkid.org/?p=301</guid>
		<description><![CDATA[自从入手了E71，装上PuTTY for Symbian OS后就能通过wifi+ssh远程遥控我的电脑了。一个常遇到的问题，人得跑出去，而电脑上的aMule正在挂高清，我想知道我正等着看的东西什么时候下载完成了，然后我好执行远程关机或者选择继续让aMule下载其他的东西。 思索了下，最好的通知方式莫过于短信，而真正可用的免费短信功能莫过于Google Calendar的短信通知了。由于aMule本身就有Events功能，剩下的唯一问题就是能在linux下执行的Gcal CLI了。好在为Google做的third party的大有人在，很快就找到了Gcalcli这个python客户端，连ebuild在Gentoo Bugzilla上都有了。 gcalcli的用法很简单，先在$HOME目录下创建一个.gcalclirc文件，里面写入以下几行: &#91;gcalcli&#93; user:yourname@gmail.com pw:yourpassword cals:all 写法无须解释，最好至少给chmod 600 .gcalclirc下，毕竟密码是明文的，给别人看到就糟了。 然后新建一个download-notify.sh的文件，写入如下几行: #!/bin/bash #usage: download-notify.sh FILENAME &#160; NOTIFY_TIME=`date --date='+5 min' +%R` FILENAME=$1 ENTRY=&#34;$NOTIFY_TIME $FILENAME download finished&#34; &#160; gcalcli quick &#34;$ENTRY&#34; 这是用来快速添加Google Calendar事件的脚本，设定时间是当前时间的5分钟后(给予一定时间差的容错值免得短信还没来得及通知就已经成历史事件了)，文件名将由aMule的Events传递。 接下来要做的是进入Google Calendar设置默认的通知方式，先确保你开通了短信通知功能，然后进入Settings -&#62; Calendars标签页 -&#62; Notifications，将默认通知方式设置为1分钟前短信通知。 剩下的就是aMule设置的问题了。进入Preferences -&#62; Events，在Event types里选择Download completed，有两个可供执行脚本的input框，第一个是当aMule Core发现下载完成时执行指定命令，第二个是仅当aMule GUI发现下载完成时执行指定命令。不管你使用aMule daemon还是aMule GUI，第一个是绝对可行的。所以开启第一个并输入类似命令sh ~/scripts/download-notify.sh "%NAME"。 [...]]]></description>
			<content:encoded><![CDATA[<p>自从入手了E71，装上<a href="http://s2putty.sourceforge.net/" title="PuTTY for Symbian OS">PuTTY for Symbian OS</a>后就能通过wifi+ssh远程遥控我的电脑了。一个常遇到的问题，人得跑出去，而电脑上的aMule正在挂高清，我想知道我正等着看的东西什么时候下载完成了，然后我好执行远程关机或者选择继续让aMule下载其他的东西。</p>
<p>思索了下，最好的通知方式莫过于短信，而真正可用的免费短信功能莫过于<a href="http://calendar.google.com/" title="Google Calendar">Google Calendar</a>的短信通知了。由于aMule本身就有Events功能，剩下的唯一问题就是能在linux下执行的Gcal CLI了。好在为Google做的third party的大有人在，很快就找到了<a href="http://code.google.com/p/gcalcli/" title="Google Calendar Command Line Interface">Gcalcli</a>这个python客户端，连<a href="http://bugs.gentoo.org/195592" title="Bugzilla Bug 195592 - app-misc/gcalcli-1.4 (New Package)">ebuild</a>在Gentoo Bugzilla上都有了。</p>
<p>gcalcli的用法很简单，先在<code>$HOME</code>目录下创建一个<code>.gcalclirc</code>文件，里面写入以下几行:<br />
<span id="more-301"></span></p>
<pre class="bash"><span style="color: #7a0874; font-weight: bold;">&#91;</span>gcalcli<span style="color: #7a0874; font-weight: bold;">&#93;</span>
user:yourname<span style="color: #000000; font-weight: bold;">@</span>gmail.com
pw:yourpassword
cals:all</pre>
<p>写法无须解释，最好至少给<code>chmod 600 .gcalclirc</code>下，毕竟密码是明文的，给别人看到就糟了。</p>
<p>然后新建一个<code>download-notify.sh</code>的文件，写入如下几行:</p>
<pre class="bash"><span style="color: #666666; font-style: italic;">#!/bin/bash</span>
<span style="color: #666666; font-style: italic;">#usage: download-notify.sh FILENAME</span>
&nbsp;
<span style="color: #007800;">NOTIFY_TIME</span>=<span style="color: #000000; font-weight: bold;">`</span><span style="color: #c20cb9; font-weight: bold;">date</span> <span style="color: #660033;">--date</span>=<span style="color: #ff0000;">'+5 min'</span> +<span style="color: #000000; font-weight: bold;">%</span>R<span style="color: #000000; font-weight: bold;">`</span>
<span style="color: #007800;">FILENAME</span>=$<span style="color: #000000;">1</span>
<span style="color: #007800;">ENTRY</span>=<span style="color: #ff0000;">&quot;<span style="color: #007800;">$NOTIFY_TIME</span> <span style="color: #007800;">$FILENAME</span> download finished&quot;</span>
&nbsp;
gcalcli quick <span style="color: #ff0000;">&quot;<span style="color: #007800;">$ENTRY</span>&quot;</span></pre>
<p>这是用来快速添加Google Calendar事件的脚本，设定时间是当前时间的5分钟后(给予一定时间差的容错值免得短信还没来得及通知就已经成历史事件了)，文件名将由aMule的Events传递。</p>
<p>接下来要做的是进入Google Calendar设置默认的通知方式，<strong>先确保你开通了短信通知功能</strong>，然后进入Settings -&gt; Calendars标签页 -&gt; Notifications，将默认通知方式设置为1分钟前短信通知。</p>
<p><img src="http://pic.yupoo.com/punkid/0365272b01a6/qj3g0x7f.jpg" alt="gcal-setting" width="500" height="80" border="0" /></p>
<p>剩下的就是aMule设置的问题了。进入Preferences -&gt; Events，在Event types里选择Download completed，有两个可供执行脚本的input框，第一个是当aMule Core发现下载完成时执行指定命令，第二个是仅当aMule GUI发现下载完成时执行指定命令。不管你使用aMule daemon还是aMule GUI，第一个是绝对可行的。所以开启第一个并输入类似命令<code>sh ~/scripts/download-notify.sh "%NAME"</code>。</p>
<p><img src="http://pic.yupoo.com/punkid/5345072b00c2/jc2eie4m.jpg" alt="amule-setting" width="500" height="281" border="0" /></p>
<p>OK，可用了。短信通知还是蛮及时的，唯一不爽的就是Google非得分两条未满短信通知我。</p>
<p><img src="http://pic.yupoo.com/punkid/9235772b0703/b5x926x5.jpg" alt="reminder" width="500" height="281" border="0" /></p>
<p>有了gcalcli能做的事就多了，例如电脑一旦发现sshd遭受brute force attacks时立刻短信通知，对网管应该比较有用吧 :)</p>

	<h4>Related posts</h4>
	<ul class="st-related-posts">
	<li><a href="http://blog.punkid.org/2008/01/06/ultimate-guide-to-manage-your-ipod-under-linux/" title="Ultimate Guide to Manage Your iPod under Linux : Revised (January 6, 2008)">Ultimate Guide to Manage Your iPod under Linux : Revised</a> (53)</li>
	<li><a href="http://blog.punkid.org/2009/03/27/free-sms-notification-via-fetion-on-amule-completed-download/" title="aMule下载短信通知的飞信实现 (March 27, 2009)">aMule下载短信通知的飞信实现</a> (1)</li>
	<li><a href="http://blog.punkid.org/2008/11/09/why-to-upgrade-to-libgpod-svn-build/" title="Why to Upgrade to Libgpod SVN Build (November 9, 2008)">Why to Upgrade to Libgpod SVN Build</a> (3)</li>
	<li><a href="http://blog.punkid.org/2007/11/10/why-i-love-gentoo-and-its-community-so-much/" title="Why I &lt;3 Gentoo and Its Community So Much (November 10, 2007)">Why I &lt;3 Gentoo and Its Community So Much</a> (6)</li>
	<li><a href="http://blog.punkid.org/2008/08/23/use-gentoo-bashrc-under-archlinux/" title="Use gentoo-bashrc under Archlinux (August 23, 2008)">Use gentoo-bashrc under Archlinux</a> (7)</li>
</ul>

]]></content:encoded>
			<wfw:commentRss>http://blog.punkid.org/2009/03/23/free-sms-notification-on-amule-completed-download/feed/</wfw:commentRss>
		<slash:comments>9</slash:comments>
		</item>
		<item>
		<title>Conky Script: China Stock Market Chart</title>
		<link>http://blog.punkid.org/2008/12/05/conky-script-china-stock-market-chart/</link>
		<comments>http://blog.punkid.org/2008/12/05/conky-script-china-stock-market-chart/#comments</comments>
		<pubDate>Fri, 05 Dec 2008 06:02:30 +0000</pubDate>
		<dc:creator>punkid</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[conky]]></category>
		<category><![CDATA[Stock]]></category>

		<guid isPermaLink="false">http://blog.punkid.org/?p=281</guid>
		<description><![CDATA[本来是想写个能创建并显示portfolio信息的脚本，只奈平日闲暇不多，先凑合用上这个吧。长话短说，把股票代码写入script里，然后用conky显示即时数据，省的天天跑Google Finance了。 这是脚本程序，保存为stockwidget.sh #!/bin/bash &#160; URL=&#34;http://hq.sinajs.cn/list=s_sh000001,s_sh600036,s_sh600000,s_sh600030,hk03968&#34; &#160; curl -s --connect-timeout 30 $URL &#124; iconv \ -f gb2312 -t utf-8 &#124; awk \ -F\&#34; '{ print $2 }' &#124; awk \ ' BEGIN { FS=&#34;,&#34; printf(&#34;%s %16s %14s %14s\n&#34;, &#34;Name&#34;, &#34;Price&#34;, &#34;Change&#34;, &#34;Percentage&#34;) } { if (NF==6) { printf(&#34;%s %12.2f %14.2f %14.2f\n&#34;, $1, $2, $3, $4) [...]]]></description>
			<content:encoded><![CDATA[<p>本来是想写个能创建并显示portfolio信息的脚本，只奈平日闲暇不多，先凑合用上这个吧。长话短说，把股票代码写入script里，然后用conky显示即时数据，省的天天跑<a href="http://finance.google.cn/" title="Google 财经">Google Finance</a>了。</p>
<p><img src="http://pic.yupoo.com/punkid/3234369ae799/ryndyxi1.jpg" alt="stock-conky" width="327" height="104" border="0" /></p>
<p>这是脚本程序，保存为<code>stockwidget.sh</code><br />
<span id="more-281"></span></p>
<pre class="bash"><span style="color: #666666; font-style: italic;">#!/bin/bash</span>
&nbsp;
<span style="color: #007800;">URL</span>=<span style="color: #ff0000;">&quot;http://hq.sinajs.cn/list=s_sh000001,s_sh600036,s_sh600000,s_sh600030,hk03968&quot;</span>
&nbsp;
curl <span style="color: #660033;">-s</span> <span style="color: #660033;">--connect-timeout</span> <span style="color: #000000;">30</span> <span style="color: #007800;">$URL</span> <span style="color: #000000; font-weight: bold;">|</span> iconv \
	<span style="color: #660033;">-f</span> gb2312 <span style="color: #660033;">-t</span> utf-<span style="color: #000000;">8</span> <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">awk</span> \
	<span style="color: #660033;">-F</span><span style="color: #000000; font-weight: bold;">\&quot;</span> <span style="color: #ff0000;">'{ print $2 }'</span> <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">awk</span> \
		<span style="color: #ff0000;">'
		BEGIN {
			FS=&quot;,&quot;
			printf(&quot;%s %16s %14s %14s\n&quot;, &quot;Name&quot;, &quot;Price&quot;, &quot;Change&quot;, &quot;Percentage&quot;)
		}
		{
			if (NF==6) { 
				printf(&quot;%s %12.2f %14.2f %14.2f\n&quot;, $1, $2, $3, $4)
			}
			else {
				printf(&quot;%s(H) %9.2f %14.2f %14.2f\n&quot;, $2, $7, $8, $9)
			}
		}'</span></pre>
<p>其中的<code>sh600001</code>, <code>sh600036</code>, <code>sh600000</code>, <code>hk03968</code>是啥就不用说了吧，反正上证股票在股票代码前加<code>sh</code>，深股加<code>sz</code>，港股加<code>hk</code>，其他的&#8230;暂时不关注，也不知道能不能从sina抓到数据。</p>
<p>然后在<code>.conkyrc</code>里加入这段:</p>
<pre class="bash"><span style="color: #800000;">${color #ffffff}</span>Stock:
<span style="color: #800000;">${color #ffffff}</span><span style="color: #800000;">${font WenQuanYi Bitmap Song:pixelsize=9}</span><span style="color: #800000;">${execi 30 /home/punkid/scripts/stockwidget.sh}</span></pre>
<p>不敢抓太频繁，每30秒更新一次数据吧。</p>

	<h4>Related posts</h4>
	<ul class="st-related-posts">
	<li><a href="http://blog.punkid.org/2007/05/30/the-china-stockmarket-should-get-a-little-bit-of-cool-down/" title="股市该降降温了 (May 30, 2007)">股市该降降温了</a> (2)</li>
	<li><a href="http://blog.punkid.org/2009/03/23/free-sms-notification-on-amule-completed-download/" title="给aMule增加下载完成短信通知功能 (March 23, 2009)">给aMule增加下载完成短信通知功能</a> (9)</li>
	<li><a href="http://blog.punkid.org/2010/07/04/remote-control-mpd-via-remuco-with-your-smartphone/" title="用Remuco实现手机遥控MPD播放 (July 4, 2010)">用Remuco实现手机遥控MPD播放</a> (0)</li>
	<li><a href="http://blog.punkid.org/2008/03/28/howto-setup-git-repo-on-dreamhost/" title="在Dreamhost主机上搭建Git (March 28, 2008)">在Dreamhost主机上搭建Git</a> (9)</li>
	<li><a href="http://blog.punkid.org/2008/08/14/compile-tuxonice-kernel-in-archlinux/" title="在Archlinux下编译TuxOnIce内核 (August 14, 2008)">在Archlinux下编译TuxOnIce内核</a> (2)</li>
</ul>

]]></content:encoded>
			<wfw:commentRss>http://blog.punkid.org/2008/12/05/conky-script-china-stock-market-chart/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>Why to Upgrade to Libgpod SVN Build</title>
		<link>http://blog.punkid.org/2008/11/09/why-to-upgrade-to-libgpod-svn-build/</link>
		<comments>http://blog.punkid.org/2008/11/09/why-to-upgrade-to-libgpod-svn-build/#comments</comments>
		<pubDate>Sat, 08 Nov 2008 16:24:56 +0000</pubDate>
		<dc:creator>punkid</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[gentoo]]></category>
		<category><![CDATA[iPod]]></category>
		<category><![CDATA[libgpod]]></category>

		<guid isPermaLink="false">http://blog.punkid.org/?p=266</guid>
		<description><![CDATA[I didnt pay much attention to the iPod artwork issue until I found the coverflow became extremely slow and out of response occasionally. I&#8217;m using Amarok via libgpod-0.6.0 to manage my iPod library, there&#8217;re approximately 1,000 songs of 68 albums in my iPod. As I checked the iPod_Control/Artwork directory of my iPod, it took up [...]]]></description>
			<content:encoded><![CDATA[<p>I didnt pay much attention to the <a href="http://amarok.kde.org/forum/index.php?action=printpage;topic=15032.0" title="Topic : Artwork on ipod classic on Amarok forums">iPod artwork issue</a> until I found the coverflow became extremely slow and out of response occasionally. </p>
<p>I&#8217;m using <a href="http://blog.punkid.org/2008/01/06/ultimate-guide-to-manage-your-ipod-under-linux/" title="Ultimate Guide to Manage Your iPod under Linux : Revised">Amarok via libgpod-0.6.0</a> to manage my iPod library, there&#8217;re approximately 1,000 songs of 68 albums in my iPod. As I checked the <code>iPod_Control/Artwork</code> directory of my iPod, it took up unexpectedly +300mb for the cover images.</p>
<pre class="bash">punkid<span style="color: #000000; font-weight: bold;">@</span>Genbox <span style="color: #000000; font-weight: bold;">/</span>media<span style="color: #000000; font-weight: bold;">/</span>MUGELLO<span style="color: #000000; font-weight: bold;">/</span>iPod_Control $ <span style="color: #c20cb9; font-weight: bold;">du</span> <span style="color: #660033;">-h</span> Artwork<span style="color: #000000; font-weight: bold;">/</span>
314M    Artwork<span style="color: #000000; font-weight: bold;">/</span></pre>
<p><span id="more-266"></span><br />
Then I tried iTunes to rebuild my music library, the artwork database shrinks to 53mb.</p>
<pre class="bash">punkid<span style="color: #000000; font-weight: bold;">@</span>Genbox <span style="color: #000000; font-weight: bold;">/</span>media<span style="color: #000000; font-weight: bold;">/</span>MUGELLO<span style="color: #000000; font-weight: bold;">/</span>iPod_Control $ <span style="color: #c20cb9; font-weight: bold;">du</span> <span style="color: #660033;">-h</span> Artwork<span style="color: #000000; font-weight: bold;">/</span>
53M     Artwork<span style="color: #000000; font-weight: bold;">/</span></pre>
<p>As someone in that post pointed out:</p>
<blockquote><p>
it turns out that iTunes isn&#8217;t actually storing one piece of artwork per track or even one per album &#8211; in my case at least, it stored one cover for only 2 of the tracks on the 12-track album &#8230;
</p></blockquote>
<p>Fortunately this issue has been fixed in the libgpod svn version, and the new artwork database size looks quite impressive. It&#8217;s even smaller than the iTunes&#8217; one.</p>
<pre class="bash">punkid<span style="color: #000000; font-weight: bold;">@</span>Genbox <span style="color: #000000; font-weight: bold;">/</span>media<span style="color: #000000; font-weight: bold;">/</span>MUGELLO<span style="color: #000000; font-weight: bold;">/</span>iPod_Control $ <span style="color: #c20cb9; font-weight: bold;">du</span> <span style="color: #660033;">-h</span> Artwork<span style="color: #000000; font-weight: bold;">/</span>
18M     Artwork<span style="color: #000000; font-weight: bold;">/</span></pre>
<p>The latest libgpod svn build has already supported the new iPod Nano 4G, and the <a title="Go to comment 1356" href="http://blog.punkid.org/2008/01/06/ultimate-guide-to-manage-your-ipod-under-linux/#comment-1356">photo issue</a> also seems to be fixed. If you dont have the patience for a &#8220;never-landed&#8221; new stable release, grab the latest <a href="http://sourceforge.net/svn/?group_id=67873" title="SourceForge.net: Subversion">libgpod svn snapshot</a>.</p>
<p>For Gentoo users, you may put the <a href="http://punkid.org/genbox/home/ebuild/media-libs/libgpod/libgpod-9999.ebuild" title="media-libs/libgpod-9999.ebuild">media-libs/libgpod-9999.ebuild</a> into your personal ebuild repo.</p>
<p><strong>Note :</strong> I removed the <code>doc</code> USE flag from the ebuild due to the latest libgpod somehow needs gtk-doc to <a href="http://gtkpod.svn.sourceforge.net/viewvc/gtkpod?view=rev&#038;revision=1727" title="SourceForge.net Repository - [gtkpod] Revision 1727">make distcheck to work correctly</a>. Bad news, KDE fan boys :(</p>

	<h4>Related posts</h4>
	<ul class="st-related-posts">
	<li><a href="http://blog.punkid.org/2008/01/06/ultimate-guide-to-manage-your-ipod-under-linux/" title="Ultimate Guide to Manage Your iPod under Linux : Revised (January 6, 2008)">Ultimate Guide to Manage Your iPod under Linux : Revised</a> (53)</li>
	<li><a href="http://blog.punkid.org/2009/03/23/free-sms-notification-on-amule-completed-download/" title="给aMule增加下载完成短信通知功能 (March 23, 2009)">给aMule增加下载完成短信通知功能</a> (9)</li>
	<li><a href="http://blog.punkid.org/2007/11/10/why-i-love-gentoo-and-its-community-so-much/" title="Why I &lt;3 Gentoo and Its Community So Much (November 10, 2007)">Why I &lt;3 Gentoo and Its Community So Much</a> (6)</li>
	<li><a href="http://blog.punkid.org/2008/08/23/use-gentoo-bashrc-under-archlinux/" title="Use gentoo-bashrc under Archlinux (August 23, 2008)">Use gentoo-bashrc under Archlinux</a> (7)</li>
	<li><a href="http://blog.punkid.org/2008/05/26/tips-in-aggregate/" title="Tips in Aggregate (May 26, 2008)">Tips in Aggregate</a> (1)</li>
</ul>

]]></content:encoded>
			<wfw:commentRss>http://blog.punkid.org/2008/11/09/why-to-upgrade-to-libgpod-svn-build/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Backup Your Files Hierarchically to Dreamhost via Rsync</title>
		<link>http://blog.punkid.org/2008/10/29/backup-your-files-hierarchically-to-dreamhost-via-rsync/</link>
		<comments>http://blog.punkid.org/2008/10/29/backup-your-files-hierarchically-to-dreamhost-via-rsync/#comments</comments>
		<pubDate>Wed, 29 Oct 2008 06:18:10 +0000</pubDate>
		<dc:creator>punkid</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[dreamhost]]></category>
		<category><![CDATA[gentoo]]></category>
		<category><![CDATA[rsync]]></category>

		<guid isPermaLink="false">http://blog.punkid.org/?p=263</guid>
		<description><![CDATA[There&#8217;re some easy file backup n&#8217; sync online services such as Amazon S3 and Dropbox, however I find it not so handy when I want to sync my linux files hierarchially. I initially used git to sync my .vimrc file and my own ebuild repo, but it is not cost-efficient as I actually pay little [...]]]></description>
			<content:encoded><![CDATA[<p>There&#8217;re some easy file backup n&#8217; sync online services such as <a href="http://aws.amazon.com/s3/" title="Amazon S3">Amazon S3</a> and <a href="https://www.getdropbox.com/" title="Dropbox">Dropbox</a>, however I find it not so handy when I want to sync my linux files hierarchially.</p>
<p>I initially used git to sync my <code>.vimrc</code> file and my own ebuild repo, but it is not cost-efficient as I actually pay little attention to the tracking commit things. So I ended up using rsync to synchronize my linux files to my dreamhost account.</p>
<h3>Preparation</h3>
<p>Assuming you&#8217;ve already had a dreamhost account with shell access priviledge (any other hosts with shell access will be fine as well). And you&#8217;re going to backup the following files on your system to the dreamhost server:<br />
<span id="more-263"></span></p>
<pre>
/home/yourname/.aliasrc
/home/yourname/.bashrc
/home/yourname/.config/openbox/
/home/yourname/files/
/home/yourname/.vimrc
/home/yourname/.vim/
/home/yourname/.xinitrc
/home/yourname/.Xdefaults
/etc/fstab
/etc/fonts/local.conf
/etc/make.conf
/etc/portage/package.*
/etc/X11/xorg.conf
</pre>
<p>Ofc you dont want others to see your <code>loveletter.txt</code> and <code>bankaccount.txt</code> under <code>files</code> directory, so the two files should be excluded from synchronization.</p>
<p>Put the following two lines into a textfile (such as <code>~/.rsync/excludes</code>) which we&#8217;ll use it later:</p>
<pre>
/home/yourname/files/loveletter.txt
/home/yourname/files/bankaccount.txt
</pre>
<h3>Howto</h3>
<p>I wrote this script for sync:</p>
<pre>
#!/bin/bash

includes="
/home/yourname/.aliasrc
/home/yourname/.bashrc
/home/yourname/.config/openbox/
/home/yourname/files/
/home/yourname/.vimrc
/home/yourname/.vim/
/home/yourname/.xinitrc
/home/yourname/.Xdefaults
/etc/fstab
/etc/fonts/local.conf
/etc/make.conf
/etc/portage/package.*
/etc/X11/xorg.conf
"

rsync -avzuCRpP --delete --delete-excluded $includes --exclude-from "/home/yourname/.rsync/excludes" -e ssh USERNAME@HOSTNAME:linux/
</pre>
<p>The <code>$includes</code> contains the files you want to sync, * wildcard supported, and to exclude the private files you&#8217;ll need the <code>--exclude-from</code> paramater.</p>
<p><code>USERNAME@HOSTNAME</code> is your dreamhost account and hostname, <code>:linux/</code> means sync the files to the linux directory under your dreamhost home directory.</p>
<p><code>-a</code> parameter makes sure your files will be synchronized recursively.</p>
<p><code>-C</code> is used for ignoring files like <code>.git</code>, <code>.svn</code>, <code>*.bak</code> and so on, ofc we dont want to waste time on transfering these useless things.</p>
<p><code>-R</code> is needed for transfering hierarchically, this means I can sync my <code>/etc/make.conf </code>file right under <code>linux/etc/</code> directory on my dreamhost.</p>
<p><code>-P</code> parameter is quite useful when the transaction is interrupted, you can continue the process somewhen later.</p>
<p>Now you can <code>chmod +x scriptname</code> before you run it first time.</p>
<p>Fetch the backup files from your dreamhost is easy, just to run:</p>
<pre>
rsync -e ssh -av USERNAME@HOSTNAME:linux/ backup/
</pre>
<p>The files will be transfered to the <code>backup</code> directory on the local computer.</p>
<p>You may need the <a href="http://www.debian-administration.org/articles/152" title="Password-less logins with OpenSSH">Password-less SSH Login</a> if you want to add this script to the cron job.</p>
<p>I use this cron job to make sure the script run automatically at 23:30 p.m. on every Monday and Thursday.</p>
<pre>
30 23 * * 1,4   punkid   sh /home/punkid/scripts/autobackup.sh
</pre>

	<h4>Related posts</h4>
	<ul class="st-related-posts">
	<li><a href="http://blog.punkid.org/2009/03/23/free-sms-notification-on-amule-completed-download/" title="给aMule增加下载完成短信通知功能 (March 23, 2009)">给aMule增加下载完成短信通知功能</a> (9)</li>
	<li><a href="http://blog.punkid.org/2008/03/28/howto-setup-git-repo-on-dreamhost/" title="在Dreamhost主机上搭建Git (March 28, 2008)">在Dreamhost主机上搭建Git</a> (9)</li>
	<li><a href="http://blog.punkid.org/2008/11/09/why-to-upgrade-to-libgpod-svn-build/" title="Why to Upgrade to Libgpod SVN Build (November 9, 2008)">Why to Upgrade to Libgpod SVN Build</a> (3)</li>
	<li><a href="http://blog.punkid.org/2007/11/10/why-i-love-gentoo-and-its-community-so-much/" title="Why I &lt;3 Gentoo and Its Community So Much (November 10, 2007)">Why I &lt;3 Gentoo and Its Community So Much</a> (6)</li>
	<li><a href="http://blog.punkid.org/2008/08/23/use-gentoo-bashrc-under-archlinux/" title="Use gentoo-bashrc under Archlinux (August 23, 2008)">Use gentoo-bashrc under Archlinux</a> (7)</li>
</ul>

]]></content:encoded>
			<wfw:commentRss>http://blog.punkid.org/2008/10/29/backup-your-files-hierarchically-to-dreamhost-via-rsync/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>华文黑体无法在KDE4下正常渲染</title>
		<link>http://blog.punkid.org/2008/10/20/stheiti-isnt-properly-rendered-on-kde4/</link>
		<comments>http://blog.punkid.org/2008/10/20/stheiti-isnt-properly-rendered-on-kde4/#comments</comments>
		<pubDate>Sun, 19 Oct 2008 16:23:37 +0000</pubDate>
		<dc:creator>punkid</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[kde4]]></category>
		<category><![CDATA[华文黑体]]></category>

		<guid isPermaLink="false">http://blog.punkid.org/?p=257</guid>
		<description><![CDATA[雅黑渲染没问题，华文黑体在普通字号下惨不忍睹 &#8230; AA开关，hintnone/slight/medium/full都试，无改善。 KDE4.12已经蛮稳定的了，UI很漂亮 Dolphin取代Konqueror是明智的选择，加上tab后的dolphin用起来很舒服 Amarok 2 beta2 &#8230; 绝对是个倒退! UI难看不说，细节打磨也是一塌糊涂，iPod删歌居然要一首首的删除，新的树形菜单也很不friendly Win键没法映射 Related posts 给aMule增加下载完成短信通知功能 (9) 用Remuco实现手机遥控MPD播放 (0) 在Dreamhost主机上搭建Git (9) 在Archlinux下编译TuxOnIce内核 (2) Why to Upgrade to Libgpod SVN Build (3)]]></description>
			<content:encoded><![CDATA[<p>雅黑渲染没问题，华文黑体在普通字号下惨不忍睹 &#8230; AA开关，hintnone/slight/medium/full都试，无改善。</p>
<p><img src="http://pic.yupoo.com/punkid/8811565ed0ca/h6ympn2c.jpg" alt="kde4-stheiti" width="431" height="348" border="0" /></p>
<ol>
<li>KDE4.12已经蛮稳定的了，UI很漂亮</li>
<li>Dolphin取代Konqueror是明智的选择，加上tab后的dolphin用起来很舒服</li>
<li>Amarok 2 beta2 &#8230; 绝对是个倒退! UI难看不说，细节打磨也是一塌糊涂，iPod删歌居然要一首首的删除，新的树形菜单也很不friendly</li>
<li>Win键没法映射</li>
</ol>

	<h4>Related posts</h4>
	<ul class="st-related-posts">
	<li><a href="http://blog.punkid.org/2009/03/23/free-sms-notification-on-amule-completed-download/" title="给aMule增加下载完成短信通知功能 (March 23, 2009)">给aMule增加下载完成短信通知功能</a> (9)</li>
	<li><a href="http://blog.punkid.org/2010/07/04/remote-control-mpd-via-remuco-with-your-smartphone/" title="用Remuco实现手机遥控MPD播放 (July 4, 2010)">用Remuco实现手机遥控MPD播放</a> (0)</li>
	<li><a href="http://blog.punkid.org/2008/03/28/howto-setup-git-repo-on-dreamhost/" title="在Dreamhost主机上搭建Git (March 28, 2008)">在Dreamhost主机上搭建Git</a> (9)</li>
	<li><a href="http://blog.punkid.org/2008/08/14/compile-tuxonice-kernel-in-archlinux/" title="在Archlinux下编译TuxOnIce内核 (August 14, 2008)">在Archlinux下编译TuxOnIce内核</a> (2)</li>
	<li><a href="http://blog.punkid.org/2008/11/09/why-to-upgrade-to-libgpod-svn-build/" title="Why to Upgrade to Libgpod SVN Build (November 9, 2008)">Why to Upgrade to Libgpod SVN Build</a> (3)</li>
</ul>

]]></content:encoded>
			<wfw:commentRss>http://blog.punkid.org/2008/10/20/stheiti-isnt-properly-rendered-on-kde4/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Use gentoo-bashrc under Archlinux</title>
		<link>http://blog.punkid.org/2008/08/23/use-gentoo-bashrc-under-archlinux/</link>
		<comments>http://blog.punkid.org/2008/08/23/use-gentoo-bashrc-under-archlinux/#comments</comments>
		<pubDate>Sat, 23 Aug 2008 14:18:03 +0000</pubDate>
		<dc:creator>punkid</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Archlinux]]></category>
		<category><![CDATA[bashrc]]></category>
		<category><![CDATA[gentoo]]></category>

		<guid isPermaLink="false">http://blog.punkid.org/?p=235</guid>
		<description><![CDATA[为什么说Gentoo是最好用的linux distro了呢? 一个小小的.bashrc就包含了许多很人性化的设置，省去了很多自己手动配置的烦恼。 Archlinux用户们$ yaourt gentoo-bashrc吧，然后把/usr/share/gentoo-bashrc/bashrc复制到$HOME下。 Related posts 给aMule增加下载完成短信通知功能 (9) 在Archlinux下编译TuxOnIce内核 (2) Why to Upgrade to Libgpod SVN Build (3) Why I &#60;3 Gentoo and Its Community So Much (6) Ultimate Guide to Manage Your iPod under Linux : Revised (53)]]></description>
			<content:encoded><![CDATA[<p>为什么说Gentoo是最好用的linux distro了呢? 一个小小的<code>.bashrc</code>就包含了许多很人性化的设置，省去了很多自己手动配置的烦恼。</p>
<p>Archlinux用户们<code>$ yaourt gentoo-bashrc</code>吧，然后把<code>/usr/share/gentoo-bashrc/bashrc</code>复制到<code>$HOME</code>下。</p>

	<h4>Related posts</h4>
	<ul class="st-related-posts">
	<li><a href="http://blog.punkid.org/2009/03/23/free-sms-notification-on-amule-completed-download/" title="给aMule增加下载完成短信通知功能 (March 23, 2009)">给aMule增加下载完成短信通知功能</a> (9)</li>
	<li><a href="http://blog.punkid.org/2008/08/14/compile-tuxonice-kernel-in-archlinux/" title="在Archlinux下编译TuxOnIce内核 (August 14, 2008)">在Archlinux下编译TuxOnIce内核</a> (2)</li>
	<li><a href="http://blog.punkid.org/2008/11/09/why-to-upgrade-to-libgpod-svn-build/" title="Why to Upgrade to Libgpod SVN Build (November 9, 2008)">Why to Upgrade to Libgpod SVN Build</a> (3)</li>
	<li><a href="http://blog.punkid.org/2007/11/10/why-i-love-gentoo-and-its-community-so-much/" title="Why I &lt;3 Gentoo and Its Community So Much (November 10, 2007)">Why I &lt;3 Gentoo and Its Community So Much</a> (6)</li>
	<li><a href="http://blog.punkid.org/2008/01/06/ultimate-guide-to-manage-your-ipod-under-linux/" title="Ultimate Guide to Manage Your iPod under Linux : Revised (January 6, 2008)">Ultimate Guide to Manage Your iPod under Linux : Revised</a> (53)</li>
</ul>

]]></content:encoded>
			<wfw:commentRss>http://blog.punkid.org/2008/08/23/use-gentoo-bashrc-under-archlinux/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>在Archlinux下编译TuxOnIce内核</title>
		<link>http://blog.punkid.org/2008/08/14/compile-tuxonice-kernel-in-archlinux/</link>
		<comments>http://blog.punkid.org/2008/08/14/compile-tuxonice-kernel-in-archlinux/#comments</comments>
		<pubDate>Thu, 14 Aug 2008 13:01:53 +0000</pubDate>
		<dc:creator>punkid</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Archlinux]]></category>
		<category><![CDATA[kernel]]></category>
		<category><![CDATA[TuxOnIce]]></category>

		<guid isPermaLink="false">http://blog.punkid.org/?p=225</guid>
		<description><![CDATA[经Druggo的介绍，一直在我的Genbox (我的Gentoo机器名)下使用TuxOnIce内核。现在在家里的Montty (我的Archlinux机器名)下实在觉得Archlinux的预编译内核太大了，而且全部以模块方式加载启动系统时的Loading Udev Events要花去尽20秒，难以忍受。很有必要自己编译一个精简的内核，而Archlinux的AUR里正好有TuxOnIce的PKGBUILD。 先说下为什么在Archlinux下自己编译一个TuxOnIce内核: 精简内核，去掉不需要的模块，减少启动时间 AUR里的TuxOnIce打了Gentoo的内核补丁集 TuxOnIce支持休眠到swap，充分利用绰绰有余的swap空间 支持断电休眠，重新唤醒系统速度快，免去重启烦恼 步骤 先用$ yaourt kernel26-ice获取TuxOnIce的PKGBUILD，它会提示是否修改PKGBUILD文件。我打算自己配置内核选项，所以去掉PKGBUILD里那句make menuconfig的注释。 # use menuconfig, if you want to change the configuration make menuconfig yes &#34;&#34; &#124; make config 然后Y下去，直到出现内核配置界面。我偏向于把东西编译内核，而不是编译为模块，这样做的好处是根本不用去管该手动加载哪些模块，哪些是需要的。为了让Suspend功能运转，需要把勾选以下设置。 Power management options &#40;ACPI, APM&#41; ---&#62; &#91;*&#93; Hibernation &#40;aka 'suspend to disk'&#41; &#40;/dev/&#60;swap-partition&#62;&#41; Default resume partition &#60;*&#62; Enhanced Hibernation &#40;TuxOnIce&#41; ---&#62; --- [...]]]></description>
			<content:encoded><![CDATA[<p>经<a href="http://blog.druggo.net/index.php?post/2008/05/01/TuxOnIce" title="TuxOnIce! 休眠到硬盘!">Druggo</a>的介绍，一直在我的Genbox (我的Gentoo机器名)下使用<a href="http://www.tuxonice.net/" title="TuxOnIce">TuxOnIce</a>内核。现在在家里的Montty (我的Archlinux机器名)下实在觉得Archlinux的预编译内核太大了，而且全部以模块方式加载启动系统时的Loading Udev Events要花去尽20秒，难以忍受。很有必要自己编译一个精简的内核，而Archlinux的AUR里正好有<a href="http://aur.archlinux.org/packages.php?ID=15224" title="kernel26-ice in AUR">TuxOnIce</a>的PKGBUILD。</p>
<p>先说下为什么在Archlinux下自己编译一个TuxOnIce内核:</p>
<ol>
<li>精简内核，去掉不需要的模块，减少启动时间</li>
<li>AUR里的TuxOnIce打了Gentoo的内核补丁集</li>
<li>TuxOnIce支持休眠到swap，充分利用绰绰有余的swap空间</li>
<li>支持断电休眠，重新唤醒系统速度快，免去重启烦恼</li>
</ol>
<p><span id="more-225"></span></p>
<h3>步骤</h3>
<p>先用<code>$ yaourt kernel26-ice</code>获取TuxOnIce的PKGBUILD，它会提示是否修改PKGBUILD文件。我打算自己配置内核选项，所以去掉PKGBUILD里那句<code>make menuconfig</code>的注释。</p>
<pre class="bash"><span style="color: #666666; font-style: italic;"># use menuconfig, if you want to change the configuration</span>
<span style="color: #c20cb9; font-weight: bold;">make</span> menuconfig
<span style="color: #c20cb9; font-weight: bold;">yes</span> <span style="color: #ff0000;">&quot;&quot;</span> <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">make</span> config</pre>
<p>然后Y下去，直到出现内核配置界面。我偏向于把东西编译内核，而不是编译为模块，这样做的好处是根本不用去管该手动加载哪些模块，哪些是需要的。为了让Suspend功能运转，需要把勾选以下设置。</p>
<pre class="bash"> Power management options <span style="color: #7a0874; font-weight: bold;">&#40;</span>ACPI, APM<span style="color: #7a0874; font-weight: bold;">&#41;</span>  ---<span style="color: #000000; font-weight: bold;">&gt;</span>
   <span style="color: #7a0874; font-weight: bold;">&#91;</span><span style="color: #000000; font-weight: bold;">*</span><span style="color: #7a0874; font-weight: bold;">&#93;</span> Hibernation <span style="color: #7a0874; font-weight: bold;">&#40;</span>aka <span style="color: #ff0000;">'suspend to disk'</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>
   <span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #000000; font-weight: bold;">/</span>dev<span style="color: #000000; font-weight: bold;">/&lt;</span>swap-partition<span style="color: #000000; font-weight: bold;">&gt;</span><span style="color: #7a0874; font-weight: bold;">&#41;</span> Default resume partition
   <span style="color: #000000; font-weight: bold;">&lt;*&gt;</span>   Enhanced Hibernation <span style="color: #7a0874; font-weight: bold;">&#40;</span>TuxOnIce<span style="color: #7a0874; font-weight: bold;">&#41;</span>  ---<span style="color: #000000; font-weight: bold;">&gt;</span>
     <span style="color: #660033;">---</span>   Image Storage <span style="color: #7a0874; font-weight: bold;">&#40;</span>you need at least one allocator<span style="color: #7a0874; font-weight: bold;">&#41;</span>
     <span style="color: #000000; font-weight: bold;">&lt;*&gt;</span>   File Allocator
     <span style="color: #000000; font-weight: bold;">&lt;*&gt;</span>   Swap Allocator
     <span style="color: #660033;">---</span>   General Options
     <span style="color: #000000; font-weight: bold;">&lt;*&gt;</span>   Compression support
     <span style="color: #000000; font-weight: bold;">&lt;*&gt;</span>   Userspace User Interface support
     <span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #000000; font-weight: bold;">/</span>sbin<span style="color: #000000; font-weight: bold;">/</span>tuxoniceui_text<span style="color: #7a0874; font-weight: bold;">&#41;</span> Default userui program location 
     <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span>   Allow Keep Image Mode
     <span style="color: #7a0874; font-weight: bold;">&#91;</span><span style="color: #000000; font-weight: bold;">*</span><span style="color: #7a0874; font-weight: bold;">&#93;</span>   Replace swsusp by default
     <span style="color: #000000; font-weight: bold;">&lt;</span> <span style="color: #000000; font-weight: bold;">&gt;</span>   Cluster support  ---<span style="color: #000000; font-weight: bold;">&gt;</span>
     <span style="color: #7a0874; font-weight: bold;">&#91;</span><span style="color: #000000; font-weight: bold;">*</span><span style="color: #7a0874; font-weight: bold;">&#93;</span>   Checksum pageset2
     <span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #000000;">25</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>  Default waiting <span style="color: #000000; font-weight: bold;">time</span> <span style="color: #000000; font-weight: bold;">for</span> emergency boot messages
     <span style="color: #000000; font-weight: bold;">&lt;</span> <span style="color: #000000; font-weight: bold;">&gt;</span>   Test pageflags
 Cryptographic options  ---<span style="color: #000000; font-weight: bold;">&gt;</span>
   <span style="color: #000000; font-weight: bold;">&lt;*&gt;</span>   LZF compression algorithm</pre>
<p>其中<code>/dev/&lt;swap-partition&gt;</code>为swap分区位置，开启LZF压缩可以加快休眠/唤醒速度，不过需要耗费点CPU资源。怕啥，我PIII 667Mhz的老爷机都用上它了。</p>
<p>用多核CPU的还需要勾选这些 (与我无关)</p>
<pre class="bash">Kernels before 2.6.22
&nbsp;
Processor <span style="color: #7a0874; font-weight: bold;">type</span> and features  ---<span style="color: #000000; font-weight: bold;">&gt;</span>
 <span style="color: #7a0874; font-weight: bold;">&#91;</span><span style="color: #000000; font-weight: bold;">*</span><span style="color: #7a0874; font-weight: bold;">&#93;</span> Support <span style="color: #000000; font-weight: bold;">for</span> hot-pluggable CPUs <span style="color: #7a0874; font-weight: bold;">&#40;</span>EXPERIMENTAL<span style="color: #7a0874; font-weight: bold;">&#41;</span>
&nbsp;
Kernel 2.6.22 and after:
&nbsp;
Processor <span style="color: #7a0874; font-weight: bold;">type</span> and features  ---<span style="color: #000000; font-weight: bold;">&gt;</span>
 <span style="color: #7a0874; font-weight: bold;">&#91;</span><span style="color: #000000; font-weight: bold;">*</span><span style="color: #7a0874; font-weight: bold;">&#93;</span> Support <span style="color: #000000; font-weight: bold;">for</span> <span style="color: #7a0874; font-weight: bold;">suspend</span> on SMP and hot-pluggable CPUs <span style="color: #7a0874; font-weight: bold;">&#40;</span>EXPERIMENTAL<span style="color: #7a0874; font-weight: bold;">&#41;</span></pre>
<p>修改好config后等它自动编译吧，然后运行<code>$ sudo pacman -U kernel26-ice-2.6.26-3-i686.pkg.tar.gz</code>安装内核，其间会运行<code>mkinitcpio</code>生成initramfs，无所谓。反正都编译进kernel了，而且又是自己手动编译的，根本不需要initramfs。</p>
<p>完成后添加类似几行到<code>/boot/grub/menu.1st</code>:</p>
<pre class="bash">title  Arch Linux TuxOnIce
root   <span style="color: #7a0874; font-weight: bold;">&#40;</span>hd1,<span style="color: #000000;">0</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>
kernel <span style="color: #000000; font-weight: bold;">/</span>vmlinuz26-ice <span style="color: #007800;">root</span>=<span style="color: #000000; font-weight: bold;">/</span>dev<span style="color: #000000; font-weight: bold;">/</span>sdb3 ro</pre>
<p>其中<code>(hd1,0)</code>指的是<code>/boot</code>分区，<code>/dev/sdb3</code>是<code>/</code> 分区。</p>
<p>我用的是N卡，还需要去AUR下个<code>nvidia-96xx-ice</code>的显卡驱动 (我的还是GeForce 2系列的卡)。<code>$ yaourt nvidia-96xx-ice</code>或者<code>$ yaourt nvidia-ice</code>就是了。</p>
<p>要用Suspend功能，还需要<code>$ yaourt hibernate-script</code>。然后修改<code>/etc/hibernate/blacklisted-modules</code>，把<code>nvidia</code>这行注释了，不然hibernate会报错。</p>
<p>在<code>/etc/hibernate/common.conf</code>里找到这几行，去掉注释，以便在休眠时断开网络，唤醒时重新连接。</p>
<pre class="bash"><span style="color: #666666; font-style: italic;">### network</span>
DownInterfaces eth0
UpInterfaces auto</pre>
<p>我用的是Nvidia的GeForce 2的卡，还需要在<code>/etc/X11/xorg.conf</code>里的Device Section里添加一句<code>Option "NvAGP" "1"</code>，如下:</p>
<pre class="bash">Section <span style="color: #ff0000;">&quot;Device&quot;</span>
        Identifier  <span style="color: #ff0000;">&quot;Card0&quot;</span>
        Driver      <span style="color: #ff0000;">&quot;nvidia&quot;</span>
        VendorName  <span style="color: #ff0000;">&quot;nVidia Corporation&quot;</span>
        BoardName   <span style="color: #ff0000;">&quot;NV11 [GeForce2 MX/MX 400]&quot;</span>
        BusID       <span style="color: #ff0000;">&quot;PCI:1:0:0&quot;</span>
        Option      <span style="color: #ff0000;">&quot;NvAGP&quot;</span> <span style="color: #ff0000;">&quot;1&quot;</span>
        ...
EndSection</pre>
<p>最后在<code>/etc/rc.conf</code>里检查下<code>MODULES</code>这行，把不需要的模块都清除掉，因为我是全部编进了kernel，直接将此行留空。</p>
<p>全部搞定后重启进入新的TuxOnIce内核吧，<del datetime="2008-08-15T15:23:54+00:00">我的Loading Udev Events时间由20秒缩短为7秒了(还是很不爽啊! Gentoo多快啊!)</del>再次重编，Udev Events Loading缩短为4秒了，总算比较可以忍受了，运行<code>$ sudo hibernate -n</code>进行休眠测试，没问题的话以后就<code>$ sudo hibernate</code>进行休眠吧。唤醒的话正常开机由grub引导进入就行了。</p>
<h3>参考</h3>
<ul>
<li><a href="http://gentoo-wiki.com/TuxOnIce" title="TuxOnIce -  Gentoo Linux Wiki">TuxOnIce &#8211;  Gentoo Linux Wiki</a></li>
<li><a href="http://wiki.archlinux.org/index.php/Suspend_to_Disk#Tuxonice_method" title="Suspend to Disk">Suspend to Disk : Tuxonice method &#8211; Arch Wiki</a></li>
</ul>
<p>最后抱怨几句:</p>
<p>为什么Archlinux要把kde3赶出repo，kde4还不足够稳定到给广大用户使用吧。像Gentoo那样用不同的slot机制来并存kde3和kde4多好。</p>
<p>Archlinux的源很痛苦，ABS的rsync服务器更是痛苦&#8230;</p>
<p>尽管有官方预编译包，我还是需要自己去手动编译那些软件，scim就是其一。</p>

	<h4>Related posts</h4>
	<ul class="st-related-posts">
	<li><a href="http://blog.punkid.org/2007/11/10/why-i-love-gentoo-and-its-community-so-much/" title="Why I &lt;3 Gentoo and Its Community So Much (November 10, 2007)">Why I &lt;3 Gentoo and Its Community So Much</a> (6)</li>
	<li><a href="http://blog.punkid.org/2008/08/23/use-gentoo-bashrc-under-archlinux/" title="Use gentoo-bashrc under Archlinux (August 23, 2008)">Use gentoo-bashrc under Archlinux</a> (7)</li>
	<li><a href="http://blog.punkid.org/2009/03/23/free-sms-notification-on-amule-completed-download/" title="给aMule增加下载完成短信通知功能 (March 23, 2009)">给aMule增加下载完成短信通知功能</a> (9)</li>
	<li><a href="http://blog.punkid.org/2010/07/04/remote-control-mpd-via-remuco-with-your-smartphone/" title="用Remuco实现手机遥控MPD播放 (July 4, 2010)">用Remuco实现手机遥控MPD播放</a> (0)</li>
	<li><a href="http://blog.punkid.org/2008/03/28/howto-setup-git-repo-on-dreamhost/" title="在Dreamhost主机上搭建Git (March 28, 2008)">在Dreamhost主机上搭建Git</a> (9)</li>
</ul>

]]></content:encoded>
			<wfw:commentRss>http://blog.punkid.org/2008/08/14/compile-tuxonice-kernel-in-archlinux/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Linux下LaTeX中文处理</title>
		<link>http://blog.punkid.org/2008/05/31/latex-cjk-support-on-linux/</link>
		<comments>http://blog.punkid.org/2008/05/31/latex-cjk-support-on-linux/#comments</comments>
		<pubDate>Sat, 31 May 2008 14:41:03 +0000</pubDate>
		<dc:creator>punkid</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Movie]]></category>
		<category><![CDATA[latex]]></category>
		<category><![CDATA[texlive-xetex]]></category>
		<category><![CDATA[中文]]></category>

		<guid isPermaLink="false">http://blog.punkid.org/?p=217</guid>
		<description><![CDATA[最近要交的论文越来越多了，Google Docs虽然能应付我平时的绝大部分文字工作，但是遇到数学公式就没辙了，Word那个公式编辑器实在是点鼠标点的很累，而且输出的效果不尽理想。不得不认真学习下LaTeX了，什么是LaTeX? 如果你只是拿来写写办公文案，活动策划之类的，显然Word就够了，甚至Google Docs都够了，但是如果你想完成一份漂亮的论文，那就得好好学习下LaTeX了。看过Alice(应该称黄博士了)写的论文后，发现LaTeX做出来的论文实在是太漂亮，太professional了，这才像是个论文样，比起Word的那种花花绿绿，没事来几个艺术字是专业多了。 前面废话太多了，LaTeX对俺们来说最大的问题倒不是那一大堆的Markup Language，而是中文问题。Google了半天，发现之前流行的CJK模块方式过于麻烦，还是用Xetex好，但是在Gentoo下Xetex和默认安装的texlive-core是互相block的，最终方式是选择安装texlive-xetex模块。 Frontend我选择kile，毕竟手生，纯命令我一次性记不过来。emerge吧! # emerge kile texlive-xetex 记住不需要装那个dev-tex/cjk-latex包了。用Xetex可以自由调用系统字体，下面是个简要的tex示例: \documentclass[a4paper,10pt]{article} \usepackage{fontspec} %这两个包是必须加进来的 \usepackage{xunicode} \setromanfont{STHeiti} %设置字体 &#160; %opening \title{示例} \author{punkid} &#160; \begin{document} &#160; \maketitle &#160; \begin{abstract} 摘要文字 \end{abstract} &#160; \section{标题} \paragraph{可以使用系统自带的字体，而不需要再另外生成。} &#160; \end{document} 最后xelatex filename.tex进行编译生成PDF文档吧。 电影话题 凭万达的学生优惠券一下午看了两场电影: 《葫芦兄弟剧场版》和 Iron Man 葫芦兄弟剧场版 &#8230; 额 &#8230; 和当年看的其实一模一样，只不过是二十周年数码修复导演剪辑纪念版。重温后有两点不得不说: 一) 要是老七最先蹦出来，妖怪不就直接给收了; 二) 老七再厉害不如他手中的葫芦厉害，可见还是要打装备啊! Iron Man，莫名其妙挺进IMDB Top 250的最新科幻大片，好看&#8230;但也就看看而已，最终下场估计和之前的Transformer一样跌出250。我只想说，对付钢铁侠的杀手锏&#8211;巨型磁铁! [...]]]></description>
			<content:encoded><![CDATA[<p>最近要交的论文越来越多了，Google Docs虽然能应付我平时的绝大部分文字工作，但是遇到数学公式就没辙了，Word那个公式编辑器实在是点鼠标点的很累，而且输出的效果不尽理想。不得不认真学习下LaTeX了，什么是LaTeX? 如果你只是拿来写写办公文案，活动策划之类的，显然Word就够了，甚至Google Docs都够了，但是如果你想完成一份漂亮的论文，那就得好好学习下LaTeX了。看过Alice(应该称黄博士了)写的论文后，发现LaTeX做出来的论文实在是太漂亮，太professional了，这才像是个论文样，比起Word的那种花花绿绿，没事来几个艺术字是专业多了。</p>
<p>前面废话太多了，LaTeX对俺们来说最大的问题倒不是那一大堆的Markup Language，而是中文问题。Google了半天，发现之前流行的CJK模块方式过于麻烦，还是用Xetex好，但是在Gentoo下Xetex和默认安装的texlive-core是互相block的，最终方式是选择安装texlive-xetex模块。</p>
<p>Frontend我选择kile，毕竟手生，纯命令我一次性记不过来。emerge吧!<br />
<span id="more-217"></span></p>
<pre class="bash"><span style="color: #666666; font-style: italic;"># emerge kile texlive-xetex</span></pre>
<p>记住不需要装那个<code>dev-tex/cjk-latex</code>包了。用Xetex可以自由调用系统字体，下面是个简要的tex示例:</p>
<pre class="latex"><span style="color: #800000; font-weight: normal;">\<span style="color: #800000; font-weight: bold;">documentclass</span></span><span style="color: #E02020; ">[</span><span style="color: #C08020; font-weight: normal;">a4paper,10pt</span><span style="color: #E02020; ">]{</span><span style="color: #2020C0; font-weight: normal;">article</span><span style="color: #E02020; ">}</span>
<span style="color: #800000; font-weight: normal;">\usepackage</span><span style="color: #E02020; ">{</span><span style="color: #2020C0; font-weight: normal;">fontspec</span><span style="color: #E02020; ">}</span> <span style="color: #2C922C; font-style: italic;">%这两个包是必须加进来的</span>
<span style="color: #800000; font-weight: normal;">\usepackage</span><span style="color: #E02020; ">{</span><span style="color: #2020C0; font-weight: normal;">xunicode</span><span style="color: #E02020; ">}</span>
<span style="color: #800000; font-weight: normal;">\setromanfont</span><span style="color: #E02020; ">{</span><span style="color: #2020C0; font-weight: normal;">STHeiti</span><span style="color: #E02020; ">}</span> <span style="color: #2C922C; font-style: italic;">%设置字体</span>
&nbsp;
<span style="color: #2C922C; font-style: italic;">%opening</span>
<span style="color: #800000; font-weight: normal;">\title</span><span style="color: #E02020; ">{</span><span style="color: #2020C0; font-weight: normal;">示例</span><span style="color: #E02020; ">}</span>
<span style="color: #800000; font-weight: normal;">\author</span><span style="color: #E02020; ">{</span><span style="color: #2020C0; font-weight: normal;">punkid</span><span style="color: #E02020; ">}</span>
&nbsp;
<span style="color: #C00000; font-weight: normal;">\begin</span><span style="color: #E02020; ">{</span><span style="color: #2020C0; font-weight: normal;"><span style="color: #0000D0; font-weight: normal;">document</span></span><span style="color: #E02020; ">}</span>
&nbsp;
<span style="color: #800000; font-weight: normal;">\maketitle</span>
&nbsp;
<span style="color: #C00000; font-weight: normal;">\begin</span><span style="color: #E02020; ">{</span><span style="color: #2020C0; font-weight: normal;"><span style="color: #0000D0; font-weight: normal;">abstract</span></span><span style="color: #E02020; ">}</span>
摘要文字
<span style="color: #C00000; font-weight: normal;">\end</span><span style="color: #E02020; ">{</span><span style="color: #2020C0; font-weight: normal;"><span style="color: #0000D0; font-weight: normal;">abstract</span></span><span style="color: #E02020; ">}</span>
&nbsp;
<span style="color: #800000; font-weight: normal;">\section</span><span style="color: #E02020; ">{</span><span style="color: #00008B; font-weight: bold;">标题</span><span style="color: #E02020; ">}</span>
<span style="color: #800000; font-weight: normal;">\paragraph</span><span style="color: #E02020; ">{</span><span style="color: #00008B; font-weight: bold;">可以使用系统自带的字体，而不需要再另外生成。</span><span style="color: #E02020; ">}</span>
&nbsp;
<span style="color: #C00000; font-weight: normal;">\end</span><span style="color: #E02020; ">{</span><span style="color: #2020C0; font-weight: normal;"><span style="color: #0000D0; font-weight: normal;">document</span></span><span style="color: #E02020; ">}</span></pre>
<p>最后<code>xelatex filename.tex</code>进行编译生成PDF文档吧。</p>
<p><strong>电影话题</strong></p>
<p>凭万达的学生优惠券一下午看了两场电影: 《葫芦兄弟剧场版》和 <em>Iron Man</em></p>
<ul>
<li><a href="http://www.douban.com/subject/3062897/" title="葫芦兄弟 on Douban">葫芦兄弟剧场版</a> &#8230; 额 &#8230; 和当年看的其实一模一样，只不过是二十周年数码修复导演剪辑纪念版。重温后有两点不得不说: 一) 要是老七最先蹦出来，妖怪不就直接给收了; 二) 老七再厉害不如他手中的葫芦厉害，可见还是要打装备啊!</li>
<li><a href="http://www.douban.com/subject/1432146/" title="Iron Man on Douban">Iron Man</a>，莫名其妙挺进IMDB Top 250的最新科幻大片，好看&#8230;但也就看看而已，最终下场估计和之前的<em>Transformer</em>一样跌出250。我只想说，对付钢铁侠的杀手锏&#8211;巨型磁铁! 另外，女主角Gwyneth Paltrow真的是非常有气质啊，Chris Martin这山羊头叔叔真是找了个羡煞旁人的好老婆。</li>
<li>昨天稍微瞟了几眼刚下完CD1的<a href="http://www.douban.com/subject/1295629/" title="杀手阿一 on Douban">杀手阿一</a>，看到把人当猪样的用铁钩吊起来往背上泼开水&#8230;害的我做一晚上的噩梦&#8230;回想起那个梦，比三池崇史有过之而无不及啊，原来我更变态更暴力 _-||| 貌似我以前说过不再看三池崇史的片子了&#8230;破戒冲主角浅野忠信看的</li>
</ul>

	<h4>Related posts</h4>
	<ul class="st-related-posts">
	<li><a href="http://blog.punkid.org/2007/07/23/what-im-currently-listenin-to-and-watching/" title="自娱自乐 (July 23, 2007)">自娱自乐</a> (6)</li>
	<li><a href="http://blog.punkid.org/2009/03/23/free-sms-notification-on-amule-completed-download/" title="给aMule增加下载完成短信通知功能 (March 23, 2009)">给aMule增加下载完成短信通知功能</a> (9)</li>
	<li><a href="http://blog.punkid.org/2007/06/14/some-movie-english-you-should-know/" title="电影常用英语 (June 14, 2007)">电影常用英语</a> (4)</li>
	<li><a href="http://blog.punkid.org/2007/09/22/movie-reivew-watch-out-the-undercurrent/" title="电影专题 : 不可不信鬼 (September 22, 2007)">电影专题 : 不可不信鬼</a> (5)</li>
	<li><a href="http://blog.punkid.org/2007/08/23/movie-reivew-its-not-just-about-sex-but-also-morality/" title="电影专题 : 不Lの戀 (August 23, 2007)">电影专题 : 不Lの戀</a> (1)</li>
</ul>

]]></content:encoded>
			<wfw:commentRss>http://blog.punkid.org/2008/05/31/latex-cjk-support-on-linux/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
	</channel>
</rss>
