Profile

Cover photo
wg wang
554 followers|1,361 views
AboutPostsPhotosVideos

Stream

wg wang

Shared publicly  - 
 
不能看游记,一看游记就想着远足!
 ·  Translate
1
tuzi hu's profile photowg wang's profile photo
5 comments
tuzi hu
 
西塘去过了,对江南古镇没啥特别的兴趣,从小就是这么长大的。我想去凤凰,男人说,苗寨啥的太危险,不让我一个人去。主要是以前看过苗蛊啥的,把他吓到了
Add a comment...

wg wang

Shared publicly  - 
 
用g+的人太少了,求关注求好友求各种兴趣小组,求技术群求搜索数据挖掘分布式计算……
 ·  Translate
1
2
Add a comment...

wg wang

Shared publicly  - 
 
pythoner写php代码,好累啊!
 ·  Translate
1
徐从斌's profile photoguobing luo's profile photo
2 comments
 
eclipse不错,
Add a comment...
Have him in circles
554 people
James Powers's profile photo
Alex Lu's profile photo
Dragan Bajcic's profile photo
Andrew Kurinnyi's profile photo

wg wang

Shared publicly  - 
 
一篇不太好玩的小文章《C No Evil》http://blog.regehr.org/archives/574

假想的场景是,你有一个不共戴天的敌人(比如情敌啊,杀父之仇啊,杀师之仇啊),而这个敌人有正好跟你在一个地方(即你有可能改动他的代码)。在某个时候,他要在很短的时间内(比如一两周)要完成一个伟大的项目(比如做成这个项目后,可以打败竞争对手,或者可以让市值上涨200%)。这时,你想通过改动他的代码中的某个头文件(c语言的),来实现最大限度的使项目延期。记住,任何能够很快的就被发现的代码改动都是达不到目标的(比如编译器能够检查到的,以及各种常用的工具如cpplint、valgrind等能够检查到的)。针对这个场景,你会怎么做呢?
下面是该文章提供的一些例子:
#define FALSE 1
#define FALSE exit()
#define while if
#define goto
#define struct union
#define assert(x)
#define volatile
#define continue break
#define double int
#define long short
#define unsigned signed

hacker news中,有几十个针对这篇文章的评论,其中有一些有点意思,总结如下:
#define sin(d) ((double)sinf(d))
#define double float
#define pthread_mutex_lock(x)
#define pthread_mutex_unlock(x)
#define free(x) free(x + 1)
#define malloc(x) malloc(random())
#define if(x) if(rand()<0.0001 && (x))
#define assert(x) ((void)(x))
#define int char
××××××××××这是一个×××××××××××
__attribute__((constructor)) void __maiin(void)
{
if (rand() < 0.05) exit();
//if (rand() < 0.05) close(1);
//if (rand() < 0.05) main(); // and so on ..
}
××××××××××××××××××××××××××××××××



也有从这个讨论中引申出去的,用以改善而非邪恶目的的:
#define free(x) do { free(x); x = NULL; } while (0)

还有一个对关键字:volatile 的讨论,有兴趣的也可以看看。

hacker news对这个的讨论的链接为:http://news.ycombinator.com/item?id=2866217
 ·  Translate
1
Add a comment...

wg wang

Shared publicly  - 
 
主动;以结果为导向;爱拼不会赢,拼到底才会赢!
 ·  Translate
1
1
Add a comment...

wg wang

Shared publicly  - 
 
熟练使用ssh,ssh-copy-id这个命令经常使用ssh的,会有帮助的,用法相当简单:
ssh-copy-id [-i [identity_file]] [user@]machine
更加详细的内容见 ssh-copy-id的manpage

SSH-COPY-ID(1) SSH-COPY-ID(1)

NAME
ssh-copy-id - install your public key in a remote machine's authorized_keys

SYNOPSIS
ssh-copy-id [-i [identity_file]] [user@]machine

DESCRIPTION
ssh-copy-id is a script that uses ssh to log into a remote machine and append the indicated identity file to that machine's
~/.ssh/authorized_keys file.

If the -i option is given then the identity file (defaults to ~/.ssh/id_rsa.pub) is used, regardless of whether there are any keys
in your ssh-agent. Otherwise, if this:

ssh-add -L

provides any output, it uses that in preference to the identity file.

If the -i option is used, or the ssh-add produced no output, then it uses the contents of the identity file. Once it has one or
more fingerprints (by whatever means) it uses ssh to append them to ~/.ssh/authorized_keys on the remote machine (creating the
file, and directory, if necessary.)

NOTES
This program does not modify the permissions of any pre-existing files or directories. Therefore, if the remote sshd has Strict‐
Modes set in its configuration, then the user's home, ~/.ssh folder, and ~/.ssh/authorized_keys file may need to have group
writability disabled manually, e.g. via

chmod go-w ~ ~/.ssh ~/.ssh/authorized_keys

on the remote machine.
1
Add a comment...

wg wang

Shared publicly  - 
1
guobing luo's profile photo
 
amazing,but where the "usleep" function come from?
Add a comment...
People
Have him in circles
554 people
James Powers's profile photo
Alex Lu's profile photo
Dragan Bajcic's profile photo
Andrew Kurinnyi's profile photo
Basic Information
Gender
Male
Story
Tagline
上善若水