写在最前面:刺总写的,然后我从玄魂大大那里转的@玄魂521。偶尔在安全圈里水水,认识了一些业界大牛,他们的传奇也许就是激励我们前行的动力,to be story。
声明:本文内容禁止讲给16岁以下的小朋友听,以免吓坏小朋友。出于保护当事人的原因,禁止任何人在任何时候以任何理由向我打听其人其事,我不会做出任何回复。我不对本文的真实性负责。本文禁止任何媒体转载,但允许个人转载至微博或个人博客!
本文中所有的人物都将匿名,请不要去猜测他是谁,也请不要试图寻找他,这只会给你我都带来不必要的麻烦。如果你竟然强大到能够以势压人,那么我的回答只会有一个:“我在微信里胡乱吹牛B的,这你也信?”,所以请不要浪费你我的时间。

Continue reading
Category Archives: Aha moments
Shell:查找与替换
大学到底要不要去上课呢?
这几天BAT都开始发功了,一时间大家似乎都对去实习有了无比高涨的热情。
没拿到offer的问怎么才能拿到offer,拿到offer的问和上课冲突了怎么办。作为一枚Disruptive Student,我觉得要是你能保证上课你去了不玩手机,你就去上课。
如果你只是想起个大早再换个地方玩手机,那么还是别去上课了,换个让自己舒服的生活方式吧。作为一只逃课率高于50%的坏孩子,我可以很负责任的告诉你,大学的考试只要一个星期把书过一遍,保证你不会挂科。
当然,如果你想问上课点名怎么办这个世界性难题怎么办?这个真的随缘,看你摊上的老师怎么样了。
虽然我浪的飞起,但我真的认为大学时光是非常宝贵的,我们很有必要好好把握着这段时间。所以说,请注意我没有叫所有人都翘完所有的课,毕竟有些同学真的天生就适合天朝的教育体制…
对于那帮熊孩子,我虽然基本不上课,但我好歹也有个80的平均成绩啊。咱们要培养因地制宜的科学主义发展观好么?啥都不会你还不赶紧回教室听课去?
当然,这是我选择的路,路上的艰辛我想只有走过的人才会知道。突然想到了刘同的一段quote,一起分享一下吧:
你的脸上云淡风轻,谁也不知道你的牙咬得有多紧。 你走路带着风,谁也不知道你膝盖上仍有曾摔伤的淤青。 你笑得没心没肺,没人知道你哭起来只能无声落泪。 要让人觉得毫不费力,只能背后极其努力。 我们没有改变不了的未来,只有不想改变的过去。
恩,就说这些。年少轻狂,幸福时光。无论选择什么,千万不要蹉跎岁月。
苦修
求两个日期间相隔的天数
这两天在网上看到了一道求两个日期间相隔天数的题目,想到了一个实现的方法:
import time
time1 = raw_input("Please input time1:")
time2 = raw_input("Please input time2:")
timeStamp1 = int(time.mktime(time.strptime(time1,"%Y-%m-%d")))
timeStamp2 = int(time.mktime(time.strptime(time2,"%Y-%m-%d")))
diff = abs(timeStamp1 - timeStamp2)
print diff/24/60/60
Compare Version Numbers
Compare two version numbers version1 and version2.
If version1 > version2 return 1, if version1 < version2 return -1, otherwise return 0.
You may assume that the version strings are non-empty and contain only digits and the . character.
The . character does not represent a decimal point and is used to separate number sequences. Continue reading
Reverse Linked List
Reverse a singly linked list.
Hint:
A linked list can be reversed either iteratively or recursively. Could you implement both?
Subscribe to see which companies asked this question. Continue reading
Climbing Stairs
You are climbing a stair case. It takes n steps to reach to the top.
Each time you can either climb 1 or 2 steps. In how many distinct ways can you climb to the top?
Subscribe to see which companies asked this question Continue reading
Word Frequency
Write a bash script to calculate the frequency of each word in a text file words.txt.
For simplicity sake, you may assume:
-
words.txtcontains only lowercase characters and space' 'characters. -
Each word must consist of lowercase characters only.
-
Words are separated by one or more whitespace characters.
Continue reading
Excel Sheet Column Title
Given a positive integer, return its corresponding column title as appear in an Excel sheet.
For example:
1 -> A
2 -> B
3 -> C
...
26 -> Z
27 -> AA
28 -> AB
这题看起来不难,但居然做了我两个小时。其中还是有很多值得注意一下的地方的。
def convertToTitle2(n): ret = "" while(n): ret = chr( (n-1)%26 + 65 ) + ret n = (n-1)/26 #核心 return ret
先贴一下最后AC的代码。我之前用了很长的代码去判断字符进位的情况,但效果都不理想。

