So I Built a PC Again

| Comments

Building a PC is not that big a deal in 2013. And admittedly, it is much easier than any other type of DIY. Assembling LEGO blocks arguably has more fun, too. The reason for building a PC today, ultimately, breaks down to squeezing horse power out of a (usually limited) budget.

Now the WinSAT is not really the most accurate benchmark in the world. But I do not know which one is anyway and this one is right there. So please put up with me.

WinSAT result

Doesn’t look too shabby, does it?

However I am going to show a fuller picture (pun intended) here.

Linode 信用卡信息泄露的幕后故事

| Comments

上个月 Linode 被骇客入侵导致所有信用卡信息泄露,我也未能幸免地中招去换了卡。今天在 HN 看到侵入者所发布的幕后故事,觉得挺有意思,就转过来跟大家分享一下。

我对骇客界的术语完全不懂,以下转译基于 HN 上的一条评论,掺杂一些我自己的理解。

HTP (“Hack The Planet”) 是一个骇客组织,某不知名的团体装成另一个叫 (“ac1db1tch3z”) 的组织对 HTP 进行了一些调查活动,主要是想寻找 HTP 使用的 Botnet (僵尸网络)。而这行为被 HTP 察觉到了,于是打算进行报复。

Why Do I Uninstall Chinese IME on My Mac

| Comments

I uninstalled all Chinese IMEs on my Mac a few days ago for the following reasons:

  1. Having multiple IMEs was annoying - especially when I was coding. Countless times I typed a few commands in the console only to find they were some meaningless Chinese words. Then I had to switch to English IME and type them in again.

  2. Without the ability of typing Chinese I have to use English more. My Chinese is basically flawless and does not require any more practise (if I don’t want to become a writer). On the other hand, my English isn’t. (You can probably tell from this post :p)

  3. This is the most important point: to write in English require much more focus and energy for me. Thus, I tend to write only when absolutely necessary, and write as little as possible. I spent a lot of time on different forums (and on twitter of course) arguing with people who really do not worth my precious seconds. Now I am not able to do it anymore (well… not actually unable but I probably wouldn’t bother) even if I want to. How wonderful is that?

Hope I can keep make wise decisions like this one :D

理解 Ruby 的闭包

| Comments

非直译,原文: Understanding Ruby Blocks, Procs and Lambdas

Ruby 处理 closures (闭包) 的方式很独特。闭包在 Ruby 里面有 4 种不同的方式,每种方式跟其余几种都有那么一点点的区别,下面就来看看……

首先, Blocks

最常见的,最简单的,而且被大多人认为是最具有 Ruby 风格的闭包使用方式是 blocks . 像这样:

这段程序做了什么呢?

  1. 定义了一个数组 array .
  2. collect! 这个方法连同它后面的代码块传入这个数组 .
  3. 这个代码块找到 collect! 这个方法用的变量 (也就是 n ),然后对其进行操作 (在这里是平方)。
  4. 每个 n 都操作一遍,得到最后的结果。

collect! 使用一个 block 看起来很容易,只需想像成 collect! 这个方法把代码块在数组里面每个元素上都过了一遍。但是如果我们要自己写这个方法呢?假设这个方法名字叫 iterate! 的话,写出来是这样的:

关于 iPhone 5 的一些想法

| Comments

感谢科技的进步,让贫富差距变小。近五年来,无论一个英国人是领着政府救济的贫困户,还是普通中产阶级,抑或是腰缠万贯的富豪,他能买到的最好的手机都是 £500 左右一台 iPhone . Apple 自从 2007 年发布第一代 iPhone 以来,一直保持着每年一次,不多也不少的更新频率。 今年九月十二号, Apple 按例在旧金山芳草地艺术中心发布了最新一代 - iPhone 5 .

只是, iPhone 5 现在还能算最好的手机么?

iPhone 5

西方文明之根(10/47) — 古希腊建筑与戏剧

| Comments

上两期(aka 一年多以前,sorry ;-( )我们访问了 斯巴达雅典 这两座最负盛名的伟大希腊城邦,从社会和政治两方面进行了一些分析。接下来不妨看看在这些古希腊城邦里面产生了什么样的文化。概括而言,所有城邦的文化都有一些共同点,但每个城邦也都具备自己的特色。

鉴于如今对古希腊城邦的了解大部分都建立在雅典城邦上,这次还是以她为例。来到公元前五世纪,雅典城邦正值她在古典时代的黄金时期。让我们从最为公开的艺术形式 建筑 和 戏剧 开始。

建筑是文化标志中最公开,最公共的一种。巨大的建筑物矗立在城邦中,城邦居民每天都要看到它们。无论他们对这些建筑是喜是恶,是赞美还是批判,也动摇不了这些建筑分毫。这些建筑可以告诉我们很多信息,关于它们的城市,关于它们的建筑者。

Rails on Ubuntu VPS

| Comments

So now I have a KVM VPS running Ubuntu. How do I setup a rails development environment? The Linux/OSX users are no as lucky as the Windows users at this – There is no simple stupid all-in-one script/binary for us. Most of us need to go through a try-and-error process to accomplish the task. In this post I am going to do it again and try to record it so that other people (or the future me) can playback.

Prepare

That’s the routine commands:

update system
1
2
3
sudo apt-get update
sudo apt-get upgrade
sudo apt-get install git curl build-essential vim libcurl4-openssl-dev bison openssl libreadline6 libreadline6-dev zlib1g zlib1g-dev libssl-dev libyaml-dev libsqlite3-0 libsqlite3-dev sqlite3 libxml2-dev libxslt-dev autoconf

ZSH

This step is optional. Bash is good enough. However I like the fancy zsh for its flexible custom prompt.

install oh-my-zsh
1
2
3
4
sudo apt-get install zsh
git clone git://github.com/robbyrussell/oh-my-zsh.git ~/.oh-my-zsh
cp ~/.oh-my-zsh/templates/zshrc.zsh-template ~/.zshrc
chsh -s /bin/zsh

Personally, I will change the zsh theme to “gnzh”. You can leave it as is or use any theme you prefer. To do this, open ~/.zshrc and alter “ZSH_THEME”.

所有的一切都是阴谋(微小说)

| Comments

注:本故事纯属虚构。如有雷同,乃是巧合;本文纯属原创。如有雷同,实属抄我。

2011 年圣诞节前夕,美国纽约市第五大道 645 号 Olympic Tower 的某办公室内,两人隔桌相对而坐。

大班椅中的老者显得有些心不在焉。即使坐着的时候,也能看出他身材不高,约莫六十来岁的样子,虽然未见谢顶,但头发已经根根银白。此刻他一只手无意识地拨弄着桌上的钢笔,眼神似乎看着办公桌对面的人,又似乎透过了那人而望向远方不知何处。他脸上表情严肃,嘴角略微下垂,两条还没有完全变成银色的眉毛锁向中间。

老者对面的中年男子是一名黑人,虽然身着西服,也能从外形上看出他身材十分粗壮,他的嘴唇很厚,双目坚定有神,而头上则是光溜溜的,此刻他身体略微前倾,一双大手按在桌面上,目光直视着老者,似乎正在等待对方发话。

短暂的沉默后,黑人男子开口说道:

「我说大卫,我们不是早就谈完了么?事情都已经解决了,名字全都签下了,咱俩还有啥可谈的啊?」

黑人男子那洪亮的声音似乎让老者一下子回过神来,他的脸上瞬间幻化出一个和蔼而略带职业性的微笑,眉头也舒展开来,答道:

Octopress for Absolute Beginners

| Comments

What is Octopress

Octopress is a “blogging framework” according to its author. I’d rather call it a webpage publishing system. For its main function is to publish webpages.

Why use Octopress

For blogging, most people use blogger, wordpress.com, livejournal, etc. Some build independent blogs with their own domain, own hosting and WordPress source code. Those are all very good solutions and one doesn’t need to switch unless has really good reasons.

However if you, like myself, are already bored with all those popular platforms; or, again like myself, are planning to learn Ruby, Git and are trying to work your way out of GitHub. Then Octopress may be for you.

By using Octopress you will get:

  • to learn how to build a Ruby programming environment.
  • some basic command of Git.
  • to write blog posts and pages completely with CLI. That’s right. You can write articles with VIM.
  • to use markdown syntax in blog posts. Or to learn it if you don’t already know.
  • to host your blog on GitHub. Free.
  • very nice code highlighting.

…and, on top of all, it is fun.

DIY 家用 NAS

| Comments

1. 为什么需要 NAS

随着科技进步,普通家庭中的智能设备越来越多,包括传统的台式机,笔记本电脑以及新潮的平板电脑,智能手机甚至媒体播放器(把 iPod touch 归为媒体播放器有点怪异,但人家确实是 iPod 家族成员…)。而便捷地在这些设备之间共享文件的需求也日益增加,于是原本属于专业设备的 NAS (Network-Attached Storage) 逐渐进入普通家庭中。

NAS 相当于大大扩充了家庭中每一台智能设备的存储容量,同时也让它们都能随时独立访问任何文件。简而言之,就是“扩容”和“共享”两大功能。如何利用这功能,则看用户需求了。有些人把 NAS 当作多媒体库使用,存放大量的影视音乐文件;有些人则将其作为备份仓库,存放数码照片原片以及视频原始脚本等。总而言之,可以将其看做一块无线连接在所有智能设备上的大硬盘,随便如何使用。