再见,2014。你好,2015。

“很多事来不及思考,就这样自然发生了。当往事悄然而走远,只留下清澈的心。” ---许巍《漫步》

本已写了一篇2014年的总结,但今天看起来已经是那么不合时宜了,心境的变化也是快得让我惊讶了,但这也并非空穴来风。

在自己的总结里,洋洋洒洒几千字,倒回来却和刘震云说的一样,“百分之九十的人会把一件事情讲成另一件事情,进而讲成第三件事”。我有时尚且遇到镜中的自己都心生不满,更何况是面对自己的灵魂呢?那是需要极大勇气的。

13年跨年的时候,和大兴,肉饼,宝宝一行人在红茶馆楼顶等倒数,我手举相机,试图抓取大楼LED彩灯的图案,可是夜景快门慢,一个不留神就手抖了,于是在别人对着2014的第一秒默默告白的时候,我只是对着片子说了声“艹”。从那一刻开始的365天即将走完,又是一个辞旧迎新的日子,我想对着我的2014年说一声,“艹,谢谢。”

这一年我获得了不少,学历和工作是两个里程碑,我要感谢父母的一贯支持,还有西安遇到的好干妈,这些好人,我爱你们,我愿你们长命百岁。一路上的朋友,数目没有过去那么快速的增长了,但是理解我的,支持我的,可以和我交流的朋友多了,对于这些人,我爱你们,愿你们开心,永远有颗清澈的心。还有一个特殊的人,我姑且封你为我真正的初恋,你是一朵理性的高贵的花,你让我伤心,你也让我清醒,对于你,我依然爱你,在深深的心底。

要坚持自己的道路不是一件容易的事情,首先便是自信,自信来源于自制,我自我控制能力极差,要从小事做起改变,从规律的作息,合理的饮食和锻炼开始,我想要从自制的自己中获得自信。保持自己的趣味也是一件难事,如果发现并不合群,是我错了,还是群体错了,我愿意相信世界上存在一个更加适合我的群体,我会找到他的。但是讨喜也是一个重要的事情,和气生一切,我也是可爱的,只是偶尔背负人类的伤感,显得严肃。我要我自己是一个踏实工作的人,好好工作,有所担当,保持求知。

今晚也是和大兴去跨年。我想对2015满怀期待的说一声,“你好,2015。” (P.S 大兴和肉饼晚上被老板叫去开组会了,我打算去太平山顶跨年。加油!)

Cheers,
@stevenyfy

Creative Commons License
This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.

在DigitalOcean上搭建自己的邮件系统

在国内Gmail被封的情况下,通过此教程依旧可以使用Gmail的邮件管理服务。(因为邮件其实是从自己服务器发出的嘛)

一封从自己的域名发出的邮件,对于开发者来说,是一份最好的自我介绍。在两位博主的文章以及维基的帮助下,上周在DigitalOcean搭建了自己的邮件系统,中间学到不少东西,特此记录下来。

这篇文章中将会包含以下内容:

  • 发向me@yourdomain.com邮件将会转发到配置的Gmail邮箱
  • 使用Gmail作为邮件的图形化管理界面,Google Inbox也适用
  • 发出的邮件将会来自于me@yourdomain.com
  • (Optional)避免自己被识别为Spammer

那就开始吧。

♠  发送和接收邮件时都发生了什么?

邮件是我自己最喜欢使用的通讯方式,它给我了足够的时间去组织一个良好的回复,并且具有更好的检索功能,可以在需要的时候找到历史的备份,简直就是一个冥想盆。在正式搭建自己的邮件服务之前,对邮件的传输有一个大致的认识会帮助理解后面的许多配置环境。 

上面的图片来自Wikipedia,描述了一封邮件传输过程中要经历的重要节点。MUA (Mail User Agent) 或许是到目前为止最为熟悉的部分。他可以是web-based的,像网页版的Gmail, 也可以是功能完整的桌面客户端,例如Outlook。当一封邮件编辑完成后,它会经由TCP587端口(大多数公司)被发往一个叫做MSA (Mail Submission Agent)的服务器, 由此邮件会被提交到下一站:MTA (Mail Transfer Agent)。 MSA和MTA通常是运行在不同参数配置下的相同的程序,例如我们下面即将配置的Postfix,他们可以是运行在同一台机器上,也可以时运行在不同的机器上。前者主要使用共享文件,后者则需要网络传输。好了,现在你的邮件应该已经到了MTA这一站,接下来即将由此进入I(i)nternet。MTA需要确定收件人的具体位置,这一过程通过DNS (Domain Name System)服务来完成,具体来说是一个叫做MX的DNS记录。

如下就是一条MX记录

# example from DNS and BIND edition 4
peets.mpk.ca.us. IN MX 10 realy.hp.com

该条记录有两个功能,它指明了peets.mpk.ca.us.将使用realy.hp.com作为邮件交换器Mail Exchanger(MX) server,同时还为这个邮件交换器指明了优先级,即10。这个优先级的绝对大小并不重要,重要的是它与其他邮件交换器优先级的相对大小,这个关系将作为邮件路由算法的依据。

回到邮件的发送,现在通过DNS查询,在MTA邮件查明了将发往何处。然后MTA将会通过SMTP协议将邮件转发到该MX服务器。被MX接受的邮件下一步会被转发到MDA (Mail Delivery Agent),通过它邮件将会被分发存往对应用户的邮箱里面。现在邮件的接收者就可以通过邮件管理工具去提取自己的邮件了,邮件提取使用到的协议主要有IMAP (Internet Message Access Protocol) 和 POP3 (Post Office Protocol)。

更多内容, 参考Wikipedia

下面进入正式的配置。

Read the rest of this article »

Move My Blog to DigitalOcean

Now, this blog is hosting in DigitalOcean.

Cheers,
@stevenyfy

Get More Votes using Tor and CUrl

The method in this article is for helping my friend in an not important contest. Even though, I feel really bad, I highly recommand no body use it in important things to hurt fairness.

Anonymous

Anonymous is mixed blessing for sure. In the world of Internet, people are much more easier to hide their identity. I can list too many reasons why anonymous is important, but at the mean time, I can't deny how many crimes were made under the mask of anonymous. However, this article is not for discussing anonymous. In this small article I will share how I use Tor and Pycurl to vote avoid the IP constraint which applied by most of election organization.

Installation

1. Tor and Privoxy Installation

What is Tor?

Tor is a network of virtual tunnels that allows people and groups to improve their privacy and security on the Internet. Tor has to be make sure running successfully in your machine to gain anonymous. Using the command line below to install Tor and Privoxy.

Read the rest of this article »

Install Yarn on Ubuntu Cluster via Scripts

Few months ago, I took a class about Cloud Computing, which is the very first time I have chance to know Hadoop. Cloud Computing sounds beautiful, but in order to build this magic cloud, hard works have to be done. When I was doing course project for that class, I felt extremely boring and tired to login every node and configure something (I didn't realize I can use some tools to simplify the work). It is this reason that pushes me to find another way to build the cloud.

Fortunately, a very good book: Apache Hadoop Yarn shows me the pain-less way. In Chapter 2, the book offers a script-based method to install Yarn on nodes which is elegant and concise. The code provided by this book is available to download. These code works only on CentOS. However, I am familiar and also a fan of Ubuntu, so, the work I'v done to make it works with Ubuntu forms today's post.

Before the content, I would like to quote from Optimizing LInux Performance by Phillip G. Ezolt:

Avoid repeating the work of others.

Avoid repeating your own work.

♠  Before Run the Scripts

1. Install Java

Jave should be installed in every node in your cluster for Yarn to work. If you are using Ubuntu 14.04 just like me, the code below will install java for you. More about install java

sudo add-apt-repository ppa:webupd8team/java
sudo apt-get update
sudo apt-get install oracle-java7-installer

2. Install XML Parser

Script will automatically generate configuration XMLs for you. In order for this feature to work, LibXml2 library has to be installed.

sudo apt-get install libxml2-utils

3. Create User and Group for Using Yarn

I create a default user for using Yarn across cluster: ynuser who is belong to group yarn.

You can add more users to specify how you use yarn. Like one user for using mapreduce, one user for spark etc. It's all depends on you, but remember to modify corresponding part of script to satisfy your demand.

sudo addgroup yarn
sudo adduser —ingroup yarn ynuser

After this, switch to account ynuser.

4. Install Parallel Distributed Shell: Pdsh

Pdsh is an amazing tool helps you execute command through the nodes connected by pdsh. The script highly depends on this tool and pdcp which included in the tool kit too. Before you run the actual script, please setup pdsh correctly.

sudo apt-get install pdsh

When pdsh is installed, some configurations still need to do. First is to change default Remote Command Service (RCMD) to ssh, since by default pdsh uses linux rcmd to execute command on a remote client but not ssh.

echo 'ssh' > /etc/pdsh/rcmd_default

This will save you for typing -R ssh in pdsh & pdcp every time. After change protocol to ssh, next we set up passwd-less connections between nodes for not only pdsh, but also Yarn.

put IP address:hostname in you hosts file.

sudo vim /etc/hosts
should look like this
127.0.0.1   localhost
IP address  node1
IP address  node2
IP address  node3
....

generate ssh-key and distribute.

#log in as ynuser

ssh-keygen -t rsa
#key will be generated in ~/.ssh/ directory

ssh-copy-id -i ~/.ssh/id_rsa.pub hostnasme
#hostname means the node you want to login
#do ssh-copy-id on every node you want to connect

Do ssh ynuser@hostname to verify your ssh setting is correct.

using the command below to test pdsh

pdsh -w node1,node2,... uptime
#note: no space(s) between hostnames

or, using the node number range, eg. operate on node#1 to node#19:

pdsh -w node[1-19] uptime

the output will look like this:

ynuser@student73:/etc/pdsh$ pdsh -a uptime
student74:  05:37:06 up 1 day,  4:23,  1 user,  load average: 1.10, 1.19, 1.22
student75:  05:37:06 up 1 day,  4:23,  1 user,  load average: 1.34, 1.19, 1.16
student73:  05:37:06 up 1 day,  4:22,  1 user,  load average: 1.11, 1.15, 1.19

since I configured hostname in my gender file[/etc/genders], I can use -a to let pdsh resolve the hosts automatically. Check this for more.

Read the rest of this article »