-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
454 lines (236 loc) · 13.2 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
<!DOCTYPE html>
<!--[if IEMobile 7 ]><html class="no-js iem7"><![endif]-->
<!--[if lt IE 9]><html class="no-js lte-ie8"><![endif]-->
<!--[if (gt IE 8)|(gt IEMobile 7)|!(IEMobile)|!(IE)]><!--><html class="no-js" lang="en"><!--<![endif]-->
<head>
<meta charset="utf-8">
<title>庸人</title>
<meta name="author" content="Wang Chen">
<meta name="description" content="QuickLook 是一个快速预览文件内容的功能,相当易用。在 Finder 中,选中文件,按空格键,即可启动。 QuickLook 支持 Plugin,这还有一个专门的插件站点 http://www.qlplugins.com/。 Plugin 一般安装在 /Library/QuickLook …">
<!-- http://t.co/dKP3o1e -->
<meta name="HandheldFriendly" content="True">
<meta name="MobileOptimized" content="320">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="canonical" href="http://wangchen.org">
<link href="/favicon.png" rel="icon">
<link href="/stylesheets/screen.css" media="screen, projection" rel="stylesheet" type="text/css">
<link href="/atom.xml" rel="alternate" title="庸人" type="application/atom+xml">
<script src="/javascripts/modernizr-2.0.js"></script>
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
<script>!window.jQuery && document.write(unescape('%3Cscript src="./javascripts/lib/jquery.min.js"%3E%3C/script%3E'))</script>
<script src="/javascripts/octopress.js" type="text/javascript"></script>
<!--Fonts from Google"s Web font directory at http://google.com/webfonts -->
<link href="http://fonts.googleapis.com/css?family=PT+Serif:regular,italic,bold,bolditalic" rel="stylesheet" type="text/css">
<link href='http://fonts.googleapis.com/css?family=Open+Sans' rel='stylesheet' type='text/css'>
<link href='http://fonts.googleapis.com/css?family=Fjalla+One' rel='stylesheet' type='text/css'>
</head>
<body class="collapse-sidebar sidebar-footer" >
<header role="banner"><hgroup>
<h1><a href="/">庸人</a></h1>
<h2>WANGCHEN's HomePage</h2>
</hgroup>
</header>
<nav role="navigation"><ul class="subscription" data-subscription="rss">
<li><a href="/atom.xml" rel="subscribe-rss" title="subscribe via RSS">RSS</a></li>
</ul>
<form action="http://google.com/search" method="get">
<fieldset role="search">
<input type="hidden" name="q" value="site:wangchen.org" />
<input class="search" type="text" name="q" results="0" placeholder="Search"/>
</fieldset>
</form>
<ul class="main-navigation">
<li><a href="/">Blog</a></li>
<li><a href="/blog/archives">Archives</a></li>
</ul>
</nav>
<div id="main">
<div id="content">
<div class="blog-index">
<article>
<header>
<h1 class="entry-title"><a href="/blog/2014/01/21/hacking-the-quicklook-of-os-x/">Hacking the QuickLook of OS X</a></h1>
<p class="meta">
<time datetime="2014-01-21T13:44:00+08:00" pubdate data-updated="true">Jan 21<span>st</span>, 2014</time>
</p>
</header>
<div class="entry-content"><p>QuickLook 是一个快速预览文件内容的功能,相当易用。在 Finder 中,选中文件,按空格键,即可启动。</p>
<p>QuickLook 支持 Plugin,这还有一个专门的插件站点 <a href="http://www.qlplugins.com/">http://www.qlplugins.com/</a>。</p>
<p>Plugin 一般安装在 <code>/Library/QuickLook</code> 或者 <code>~/Library/QuickLook</code> 下,扩展名为 <code>.qlgenerator</code>。</p>
<p>OS X 还提供了一个命令行工具,用于 管理 QuickLook 插件,<code>/usr/bin/qlmanage</code>。</p>
<p>安装过程也很简单,以 Markdown 的插件为例:</p>
<figure class='code'><div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
<span class='line-number'>2</span>
<span class='line-number'>3</span>
<span class='line-number'>4</span>
</pre></td><td class='code'><pre><code class='sh'><span class='line'><span class="nv">$ </span>wget <span class="s1">'https://github.com/downloads/toland/qlmarkdown/QLMarkdown-1.3.zip'</span>
</span><span class='line'><span class="nv">$ </span>tar xvfz QLMarkdown-1.3.zip
</span><span class='line'><span class="nv">$ </span>cp QLMarkdown/QLMarkdown.qlgenerator ~/Library/QuickLook/
</span><span class='line'><span class="nv">$ </span>qlmanage -r
</span></code></pre></td></tr></table></div></figure>
</div>
</article>
<article>
<header>
<h1 class="entry-title"><a href="/blog/2013/11/11/tab-completion-in-python-shell/">Tab Completion in Python Shell</a></h1>
<p class="meta">
<time datetime="2013-11-11T19:32:00+08:00" pubdate data-updated="true">Nov 11<span>th</span>, 2013</time>
</p>
</header>
<div class="entry-content"><p>为 <strong>Python Shell</strong> 加入自动补全功能。</p>
<p>在你的 home 目录中创建一个 <code>.pythonrc</code> 文件,内容如下:</p>
<figure class='code'><figcaption><span>.pythonrc </span></figcaption>
<div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
<span class='line-number'>2</span>
</pre></td><td class='code'><pre><code class='python'><span class='line'><span class="kn">import</span> <span class="nn">rlcompleter</span><span class="o">,</span> <span class="nn">readline</span>
</span><span class='line'><span class="n">readline</span><span class="o">.</span><span class="n">parse_and_bind</span><span class="p">(</span><span class="s">'tab:complete'</span><span class="p">)</span>
</span></code></pre></td></tr></table></div></figure>
<p>设置 <code>PYTHONSTARTUP</code></p>
<figure class='code'><figcaption><span>.pythonrc </span></figcaption>
<div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
</pre></td><td class='code'><pre><code class='sh'><span class='line'><span class="nv">$ </span><span class="nb">echo</span> <span class="s2">"export PYTHONSTARTUP=~/.pythonrc"</span> >> ~/.bash_profile
</span></code></pre></td></tr></table></div></figure>
<p>现在你可以试试了:</p>
<figure class='code'><figcaption><span>.pythonrc </span></figcaption>
<div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
<span class='line-number'>2</span>
<span class='line-number'>3</span>
</pre></td><td class='code'><pre><code class='sh'><span class='line'><span class="nv">$ </span>python
</span><span class='line'>>>> import sys
</span><span class='line'>>>> sys.<TAB><TAB>
</span></code></pre></td></tr></table></div></figure>
<blockquote><p>实际上,<code>PYTHONSTARTUP</code> 可以做更多事情,欲求更多者,可参考:
<a href="https://github.com/sontek/dotfiles/blob/master/_pythonrc.py">https://github.com/sontek/dotfiles/blob/master/_pythonrc.py</a></p></blockquote>
<h2>关于OS X 上的问题 Update 2013/11/13</h2>
<p>由于 OS X 中不包括 GNU readline,而是有兼容接口的 BSD libedit。
OS X 系统自带 Python 以及 Python.org 提供的 32-bit/64-bit installer 包,都是基于 libedit 构建的。
更详细的解释请参考,StackOverflow 上的一个问题:
<a href="http://stackoverflow.com/questions/7116038/python-tab-completion-mac-osx-10-7-lion">python tab completion Mac OSX 10.7 (Lion)</a></p>
<p>简单的解决方案就是自己编译一个 Python,推荐 <a href="https://github.com/mxcl/homebrew/wiki/Homebrew-and-Python">HomeBrew</a>。</p>
</div>
</article>
<article>
<header>
<h1 class="entry-title"><a href="/blog/2013/10/09/realpath-in-os-x-implemented-by-python/">Realpath in OS X Implemented by Python</a></h1>
<p class="meta">
<time datetime="2013-10-09T19:54:00+08:00" pubdate data-updated="true">Oct 9<span>th</span>, 2013</time>
</p>
</header>
<div class="entry-content"><p>一个Alias,返回指定文件的绝对路径,适用于Bash、ZSH。</p>
<figure class='code'><figcaption><span>realpath.sh </span></figcaption>
<div class="highlight"><table><tr><td class="gutter"><pre class="line-numbers"><span class='line-number'>1</span>
</pre></td><td class='code'><pre><code class='sh'><span class='line'><span class="nb">alias </span><span class="nv">realpath</span><span class="o">=</span><span class="s2">"python -c 'import os,sys; print (os.path.abspath(sys.argv[1]) if len(sys.argv)>1 and os.path.exists(sys.argv[1]) else \"Invalid path\nUsage: realpath <path>\")'"</span>
</span></code></pre></td></tr></table></div></figure>
</div>
</article>
<article>
<header>
<h1 class="entry-title"><a href="/blog/2013/09/30/grunt-get-start/">Grunt Get Start</a></h1>
<p class="meta">
<time datetime="2013-09-30T06:59:00+08:00" pubdate data-updated="true">Sep 30<span>th</span>, 2013</time>
</p>
</header>
<div class="entry-content"><p>Grunt 是一个 JavaScript 的自动化构建工具,它提供的一种方式降低例如编译、压缩、发布等重复性劳动。</p>
<p>Grunt 的体系已非常强大,且仍在日益壮大。</p>
<p>我必须得说,jQuery 正在使用它。</p>
</div>
<footer>
<a rel="full-article" href="/blog/2013/09/30/grunt-get-start/">Read on →</a>
</footer>
</article>
<article>
<header>
<h1 class="entry-title"><a href="/blog/2013/09/30/hello-octopress-and-github-pages/">Hello Octopress & GitHub Pages</a></h1>
<p class="meta">
<time datetime="2013-09-30T06:16:00+08:00" pubdate data-updated="true">Sep 30<span>th</span>, 2013</time>
</p>
</header>
<div class="entry-content"><p>昨天尝试了一下 <a href="http://heroku.com">Heroku</a> , 墙内访问还是很成问题,所以还是回来用 GitHub Pages 吧!</p>
<p>刚刚过完生日,不像前两年那么多唏嘘、感概,反而多了些坚定,但还是免不了叹一声:</p>
<blockquote><p>无论如何,我还是成功的蹉跎了一年的时光。</p></blockquote>
</div>
</article>
<div class="pagination">
<a href="/blog/archives">Blog Archives</a>
</div>
</div>
<aside class="sidebar">
<section>
<h1>Recent Posts</h1>
<ul id="recent_posts">
<li class="post">
<a href="/blog/2014/01/21/hacking-the-quicklook-of-os-x/">Hacking the QuickLook of OS X</a>
</li>
<li class="post">
<a href="/blog/2013/11/11/tab-completion-in-python-shell/">Tab completion in Python Shell</a>
</li>
<li class="post">
<a href="/blog/2013/10/09/realpath-in-os-x-implemented-by-python/">Realpath in OS X implemented by Python</a>
</li>
<li class="post">
<a href="/blog/2013/09/30/grunt-get-start/">Grunt Get Start</a>
</li>
<li class="post">
<a href="/blog/2013/09/30/hello-octopress-and-github-pages/">Hello Octopress & GitHub Pages</a>
</li>
</ul>
</section>
<section>
<h1>GitHub Repos</h1>
<ul id="gh_repos">
<li class="loading">Status updating…</li>
</ul>
<a href="https://github.com/kitta4587@gmail.com">@kitta4587@gmail.com</a> on GitHub
<script type="text/javascript">
$(document).ready(function(){
if (!window.jXHR){
var jxhr = document.createElement('script');
jxhr.type = 'text/javascript';
jxhr.src = '/javascripts/libs/jXHR.js';
var s = document.getElementsByTagName('script')[0];
s.parentNode.insertBefore(jxhr, s);
}
github.showRepos({
user: 'kitta4587@gmail.com',
count: 0,
skip_forks: true,
target: '#gh_repos'
});
});
</script>
<script src="/javascripts/github.js" type="text/javascript"> </script>
</section>
<section class="googleplus googleplus-hidden">
<h1>
<a href="https://plus.google.com/kitta4587@gmail.com?rel=author">
<img src="http://www.google.com/images/icons/ui/gprofile_button-32.png" width="32" height="32">
Google+
</a>
</h1>
</section>
</aside>
</div>
</div>
<footer role="contentinfo"><p>
Copyright © 2014 - Wang Chen -
<span class="credit">Powered by <a href="http://octopress.org">Octopress</a></span>
</p>
</footer>
<script type="text/javascript">
var disqus_shortname = 'wangchen-blog';
var disqus_script = 'count.js';
(function () {
var dsq = document.createElement('script'); dsq.type = 'text/javascript'; dsq.async = true;
dsq.src = 'http://' + disqus_shortname + '.disqus.com/' + disqus_script;
(document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq);
}());
</script>
<script type="text/javascript">
(function() {
var script = document.createElement('script'); script.type = 'text/javascript'; script.async = true;
script.src = 'https://apis.google.com/js/plusone.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(script, s);
})();
</script>
</body>
</html>