forked from waynezhang/blog
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
816 changed files
with
18,570 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
markdown: rdiscount | ||
pygments: true | ||
permalink: /:year/:month/:day/:title.html |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
<!DOCTYPE html> | ||
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en-us"> | ||
<head> | ||
<meta http-equiv="content-type" content="text/html; charset=utf-8" /> | ||
<meta name="author" content="Linghua Zhang" /> | ||
<title>{{ page.title }}</title> | ||
<link rel="shortcut icon" href="/favicon.ico"> | ||
<link href="/atom.xml" rel="alternate" title="setImpl" type="application/atom+xml" /> | ||
<link rel="stylesheet" href="/media/css/style.css"> | ||
<link rel="stylesheet" href="/media/css/github.css"> | ||
<script type="text/javascript" src="/media/js/highlight.pack.js"></script> | ||
<script type="text/javascript"> | ||
hljs.initHighlightingOnLoad(); | ||
</script> | ||
</head> | ||
<body> | ||
<div id="container"> | ||
<div id="main" role="main"> | ||
<header> | ||
<h1>{{ page.title }}</h1> | ||
</header> | ||
<nav> | ||
<span><a title="home page" class="" href="/">home</a></span> | ||
<span><a title="tags" class="" href="/tags.html">tags</a></span> | ||
<span><a title="about" class="" href="/about.html">about me</a></span> | ||
<span><a title="my photos" class="" href="http://www.flickr.com/photos/lhzhang">gallery</a></span> | ||
<span><a title="blogroll" class="" href="/links.html">links</a></span> | ||
<span><a title="subscribe me" class="" href="/atom.xml">feed</a></span> | ||
</nav> | ||
<article class="content"> | ||
{{ content }} | ||
</article> | ||
</div> | ||
</div> <!--! end of #container --> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
--- | ||
layout: default | ||
--- | ||
|
||
<section class="post"> | ||
{{ content }} | ||
</section> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
--- | ||
layout: default | ||
--- | ||
|
||
<section class="post"> | ||
{{ content }} | ||
</section> | ||
<section class="meta"> | ||
{% if page.tags %} | ||
<span class="tags"> | ||
tagged by | ||
{% for tag in page.tags %} | ||
<a href="/tags.html#{{ tag }}" title="{{ tag }}">{{ tag }}</a> | ||
{% endfor %} | ||
</span> | ||
{% endif %} | ||
<span class="time"> | ||
<time datetime="{{ page.date | date:"%Y-%m-%d" }}">{{ page.date | date:"%Y-%m-%d" }}</time> | ||
</span> | ||
</section> | ||
{% if page.guid %} | ||
<section class="comment"> | ||
<div id="disqus_thread"></div> | ||
<script type="text/javascript"> | ||
/* * * CONFIGURATION VARIABLES: EDIT BEFORE PASTING INTO YOUR WEBPAGE * * */ | ||
var disqus_shortname = 'gopherwood'; // required: replace example with your forum shortname | ||
var disqus_identifier = '{{ page.guid }}'; | ||
|
||
/* * * DON'T EDIT BELOW THIS LINE * * */ | ||
(function() { | ||
var dsq = document.createElement('script'); dsq.type = 'text/javascript'; dsq.async = true; | ||
dsq.src = 'http://' + disqus_shortname + '.disqus.com/embed.js'; | ||
(document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq); | ||
})(); | ||
</script> | ||
<noscript>Please enable JavaScript to view the <a href="http://disqus.com/?ref_noscript">comments powered by Disqus.</a></noscript> | ||
</section> | ||
{% endif %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,107 @@ | ||
# tag_cloud.rb | ||
# | ||
# Copyright (C) 2011 Anurag Priyam - MIT License | ||
|
||
module Jekyll | ||
|
||
# Jekyll plugin to generate tag clouds. | ||
# | ||
# The plugin defines a `tag_cloud` tag that is rendered by Liquid into a tag | ||
# cloud: | ||
# | ||
# <div class='cloud'> | ||
# {% tag_cloud %} | ||
# </div> | ||
# | ||
# The tag cloud itself is a collection of anchor tags, styled dynamically | ||
# with the `font-size` CSS property. The range of values, and unit to use for | ||
# `font-size` can be specified with a very simple syntax: | ||
# | ||
# {% tag_cloud font-size: 16 - 28px %} | ||
# | ||
# The output is automatically formatted to use the same number of decimal | ||
# places as used in the argument: | ||
# | ||
# {% tag_cloud font-size: 0.8 - 1.8em %} # => 1 | ||
# {% tag_cloud font-size: 0.80 - 1.80em %} # => 2 | ||
# | ||
# Tags that have been used less than a certain number of times can be | ||
# filtered out from the tag cloud with the optional `threshold` parameter: | ||
# | ||
# {% tag_cloud threshold: 2%} | ||
# | ||
# Both the parameters can be easily clubbed together: | ||
# | ||
# {% tag_cloud font-size: 50 - 150%, threshold: 2%} | ||
# | ||
# The plugin randomizes the order of tags every time the cloud is generated. | ||
class TagCloud < Liquid::Tag | ||
safe = true | ||
|
||
# tag cloud variables - these are setup in `initialize` | ||
attr_reader :size_min, :size_max, :precision, :unit, :threshold | ||
|
||
def initialize(name, params, tokens) | ||
# initialize default values | ||
@size_min, @size_max, @precision, @unit = 70, 170, 0, '%' | ||
@threshold = 1 | ||
|
||
# process parameters | ||
@params = Hash[*params.split(/(?:: *)|(?:, *)/)] | ||
process_font_size(@params['font-size']) | ||
process_threshold(@params['threshold']) | ||
|
||
super | ||
end | ||
|
||
def render(context) | ||
# get an Array of [tag name, tag count] pairs | ||
count = context.registers[:site].tags.map do |name, posts| | ||
[name, posts.count] if posts.count >= threshold | ||
end | ||
|
||
# clear nils if any | ||
count.compact! | ||
|
||
# get the minimum, and maximum tag count | ||
min, max = count.map(&:last).minmax | ||
|
||
# map: [[tag name, tag count]] -> [[tag name, tag weight]] | ||
weight = count.map do |name, count| | ||
# logarithmic distribution | ||
weight = (Math.log(count) - Math.log(min))/(Math.log(max) - Math.log(min)) | ||
[name, weight] | ||
end | ||
|
||
# shuffle the [tag name, tag weight] pairs | ||
weight.sort_by! { rand } | ||
|
||
# reduce the Array of [tag name, tag weight] pairs to HTML | ||
weight.reduce("") do |html, tag| | ||
name, weight = tag | ||
size = size_min + ((size_max - size_min) * weight).to_f | ||
size = sprintf("%.#{@precision}f", size) | ||
html << "<a style='font-size: #{size}#{unit}' href='/tags.html##{name}'>#{name}</a>\n" | ||
end | ||
end | ||
|
||
private | ||
|
||
def process_font_size(param) | ||
/(\d*\.{0,1}(\d*)) *- *(\d*\.{0,1}(\d*)) *(%|em|px)/.match(param) do |m| | ||
@size_min = m[1].to_f | ||
@size_max = m[3].to_f | ||
@precision = [m[2].size, m[4].size].max | ||
@unit = m[5] | ||
end | ||
end | ||
|
||
def process_threshold(param) | ||
/\d*/.match(param) do |m| | ||
@threshold = m[0].to_i | ||
end | ||
end | ||
end | ||
end | ||
|
||
Liquid::Template.register_tag('tag_cloud', Jekyll::TagCloud) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
{} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
--- | ||
title: '在 linux 下驱动 Compaq 万通宝' | ||
layout: post | ||
guid: urn:uuid:b87da13a-a4dd-402f-b06a-cef7eeee2d80 | ||
tags: | ||
- linux | ||
- wifi | ||
- compaq | ||
--- | ||
|
||
近日完全转到 linux 了,不过 PocketPC 和万通宝的驱动是个大问题,Google 了好久,终于解决了万通宝的驱动,如下: | ||
|
||
万通宝的驱动要自己编译安装,所以我们必须先要安装一些必要的软件包,以ubuntu为例,debian及其它发行版会略有不同: | ||
|
||
我们需要的是 gcc,curl,cvs,以及与当前相对应的内核头文件 | ||
|
||
sudo apt-get install build-essential | ||
|
||
以上命令可安装编译所需要的软件包如 gcc,cpp等,然后是安装 cvs | ||
|
||
sudo apt-get install cvs | ||
|
||
以及当前版本的内核头文件 | ||
|
||
sudo apt-get install linux-headers-`uname -r` | ||
|
||
注意:` 符号是 tab 键上面数字 1 键左边那个,不是单引号 | ||
|
||
然后是 curl | ||
|
||
sudo apt-get install curl | ||
|
||
以上是为了说明清楚一些,当然也可以一次性安装: | ||
|
||
sudo apt-get install build-essential cvs linux-headers-`uname -r` curl | ||
|
||
安装好必要的软件包后,我们需要从 cvs 上去 checkout 最新的驱动源码 | ||
|
||
cvs -z3 -d:pserver:[email protected]:/cvsroot/orinoco co orinoco | ||
|
||
然后编译驱动 | ||
|
||
cd orinoco | ||
|
||
make | ||
|
||
编译正确完成后需要安装 | ||
|
||
sudo make install | ||
|
||
之后我们需要去下载 windows 的 firmware,当然这个不用我们动手,已经有写好的脚本来完成了 | ||
|
||
cd firmware | ||
|
||
./get_ezusb_fw | ||
|
||
将得到的 firmware 拷贝到 linux 内核的 firmware 目录中,在 dapper (ubuntu 6.06)中为 /lib/firmware/linux-kernel-xxx (xxx为内核版本)目录中,其它发行版视实际情况而定 | ||
|
||
sudo cp ./orinoco_ezusb_fw /lib/firmware/`uname -r` | ||
|
||
现在我们可以尝试激活万通宝了 | ||
|
||
sudo modprobe -v orinoco_usb | ||
|
||
看看万通宝的绿灯有没有亮,不亮的话则需要重启一下 | ||
|
||
最后,保证系统在启动的时候自动加载万通宝模块,需要修改一下 /etc/modules 文件,在文件的末尾加一行 | ||
|
||
orinoco_usb | ||
|
||
重启,进入桌面后看看,绿灯还不亮的话试下 Fn + F2,这样子应该差不多正常工作了,enjoy~ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
--- | ||
title: '完全Linux ---- 让kaffeine显示中文字幕' | ||
layout: post | ||
guid: urn:uuid:c6675166-6afd-4741-8ccd-d40517ff5231 | ||
tags: | ||
- linux | ||
- kaffeine | ||
- subtitle | ||
--- | ||
|
||
Ubuntu 6.06已经的Kaffeine已经支持字幕的显示了,但是其默认安装还不能显示中文字幕。 | ||
|
||
Kaffeine作为Xine的前端,采用Xine引擎,当然字幕的显示也是以来Xine库了。Xine的字幕显示需要自己定义的一些特殊格式的字体,而其默认安装只带了几种英文字体,这就是Kaffine之所以无法显示中文字幕的原因,知道了原因,解决起来就很容易了。 | ||
|
||
首先我们需要准备的是制作字体的工具,叫做xine-fontconv。源里的xine是没有这个工具的,有兴趣的话大家可以去SourceForge上下xine的源码,自己编译一下就可以了,比较懒的话......这里有一个编译好的版本,下来放到/usr/bin下面,其实放哪里无所谓,执行的时候找的到就行然后要找一个中文字体,不用多说了吧,/usr/share/fonts/truetype下找一个顺眼的中文自己就行了,注意一下编码是gbk & gb2312的还是big5的,这里以文鼎PL细上海宋Uni(AR PL ShanHeiSun Uni)为例,字体文件为/usr/share/fonts/truetype/arphic/uming.ttf | ||
|
||
<del>下载: xine-fontconv.bin</del> | ||
|
||
进入xine的字体目录: | ||
|
||
cd /usr/share/xine/libxine1/fonts | ||
|
||
制作字体,ming是最终生成的字体名,自选,gbk是编码,以实际情况为准: | ||
|
||
xine-fontconv /usr/share/fonts/truetype/arphic/uming.ttf ming gbk | ||
|
||
等吧,很久的,去喝杯咖菲(晕,新换的雅黑字体居然没有咖fei的fei字,只好拿这个代替了%^#$*&$^&@$%#$@^#@)好了,呵呵 | ||
|
||
之后我们会看到生成了ming-16-xinefont.gz这样的文件,就是新的字体了,16代表大小,一共会有16,20,24,32,48,64这几个,然后打开Kaffeine配置一下Xine: | ||
|
||
设置->Xine引擎参数->Subtitles,在右边的新手选项中把最后一项(encoding of the subtitles)替换为我们的编码,这里是gbk,专家选项中的第一项(font for subtitles)替换为我们的字体名,这里为ming,确定。 | ||
|
||
现在可以找个电影试一下啦,把字幕文件名的.idx,.sub,.srt等等之前的部分改成和电影文件名一样就行了,在载入的时候会提示你选字幕的 | ||
|
||
enjoy :) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
--- | ||
title: 'Linux 下 aMule 设置' | ||
layout: post | ||
guid: urn:uuid:0c997fad-353d-48a6-946f-d683d41f56f6 | ||
tags: | ||
- linux | ||
- amule | ||
- edonkey | ||
--- | ||
|
||
DonkeyServer No1 (62.241.53.2:4242)已经存在,要添加的只有: | ||
|
||
华语P2P源动力 61.152.93.254:4661 | ||
Razorback 2 195.245.244.243:4661 | ||
|
||
firefox设置:地址栏输入 about:config | ||
|
||
新建一个布尔值 network.protocol-handler.external.ed2k,设为true | ||
|
||
新建字符串值 network.protocol-handler.app.ed2k,设为/usr/bin/ed2k.amule(aMule安装时的prefix/ed2k.amule) | ||
|
||
OK,记录于此,备忘 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
--- | ||
title: 'Linux下Firefox浏览Flash无声的解决办法' | ||
layout: post | ||
guid: urn:uuid:ffcaf39b-877f-4980-ba2b-0966ca5c4999 | ||
tags: | ||
- linux | ||
- firefox | ||
- flash | ||
--- | ||
|
||
1. 检查flash插件的安装是否正确,根据我的经验flashplugin-nonfree这个比较稳定,尽管是nonfree的......GNU的那个经常崩溃 | ||
|
||
2. 如果Flash可以正常浏览但是没有声音,则是Firefox的声音输出设置有问题,编辑/etc/firefox/firefoxrc文件,如果没有就创建一个好了 | ||
|
||
sudo vi /etc/firefox/firefoxrc | ||
|
||
加入(或修改) | ||
|
||
FIREFOX_DSP="aoss" | ||
|
||
aoss要视你的dsp而定,如esddsp,artsdsp,aoss(aoss要求已经安装了alsa-oss),也可以试一下auto,反正不能是none,呵呵 | ||
|
||
3. 关闭firefox的所有进程,重启firefox,ok?enjoy~ | ||
|
||
PS:适用于dapper ,其他版本或发行版firefoxrc文件可能不同,如/etc/mozilla-firefox/mozilla-firefoxrc等等 | ||
|
Oops, something went wrong.