电子邮件签名格式
标准的电子邮件签名格式是:两个连字符,一个空格,然后断行,跟上你的签名信息,纯文本。
The formatting of the sig block is prescribed somewhat more firmly: it should be displayed as plain text in a fixed-width font (no HTML, images, or other rich text), and must be delimited from the body of the message by a single line consisting of exactly two hyphens, followed by a space, followed by the end of line.
你是这样的吗?
中国开发者的一个大的特点:
对技术痴迷的同时不食人间烟火
- 整天津津乐道的就是那些算法、数据结构、设计模式、语言技巧、技术规范
- 对于普通老百姓关心的东西一概没有兴趣。
- 大部分人对于时尚、化妆品、小资情调嗤之以鼻
- 对于电影、音乐、艺术、美食一知半解,对于地产、金融、法律知识一窍不通
- 对于一个普通老百姓市场生活中所能遇到的困难和问题,所追求的那一点享受和乐趣不闻不问
- 既不愿意亲身实践,更在主观心态上予以拒斥。
根本上缺少对于生活和需求的深刻体察,对于人的关怀!
策划产品的时候全凭感觉:
- 做出来的东西千篇一律
- 看上去什么都有,一用起来处处不贴心。
- 我们把太多的时间用来围着电脑转,根本上缺少对于生活和需求的深刻体察,对于人的关怀。
- 在企业软件领域,我们把这种情况称之为“不了解业务”,现在整个企业软件领域都在寻找“懂技术,通业务”的复合型人才
- 在大众软件和公众互联网领域,这种情况同样严重。我就经常感觉,就算是 MP3 播放器、电子书、网络论坛这样最最平常的应用,一旦加上具体应用背景, 放在具体场合下,就有很多地方显得不方便,不贴心。
Python Dictionary tips
- Constructing Dictionaries with Keyword Arguments,the simplest way to create a Dict.
dict(a=1, b=2, c=3) # returns {'a': 1, 'b': 2, 'c': 3}
- Dicts to Lists.
dict = {'a': 1, 'b': 2, 'c': 3}
keys_list = dict.keys() #return ['a', 'c', 'b']
values_list = dict.values() #return [1,2,3]
dict_as_list = dict.items() #return [('a', 1), ('b', 2), ('c', 3)]
Python zip function
The built-in zip function can be used, well, to zip lists together. It returns a list of tuples, where the nth tuple contains the nth item from each of the passed in lists.
letters = ['a', 'b', 'c']
numbers = [1, 2, 3]
squares = [1, 4, 9]
zipped_list = zip(letters, numbers, squares)
# zipped_list contains [('a', 1, 1), ('b', 2, 4), ('c', 3, 9)]
Python 多线程爬虫
备忘。
队列模块使用步骤(via):
- 创建一个 Queue.Queue() 的实例,然后使用数据对它进行填充。
- 将经过填充数据的实例传递给线程类,后者是通过继承 threading.Thread 的方式创建的。
- 生成守护线程池。
- 每次从队列中取出一个项目,并使用该线程中的数据和 run 方法以执行相应的工作。
- 在完成这项工作之后,使用
queue.task_done()
函数向任务已经完成的队列发送一个信号。 - 对队列执行 join 操作,实际上意味着等到队列为空,再退出主程序。
其中 join() 方法说明:
保持阻塞状态,直到处理了队列中的所有项目为止。在将一个项目添加到该队列时,未完成的任务的总数就会增加。当使用者线程调用
task_done()
以表示检索了该项目、并完成了所有的工作时,那么未完成的任务的总数就会减少。当未完成的任务的总数减少到零时,join() 就会结束阻塞状态。
Simple SCP notes
SCP: Copies files over the network securely; uses ssh for data transfer, using the same authentication and providing the same security as ssh.
Using:
scp [-p] [-v] [-r] [[username@]host:] file_or_dir [[username@]host:]file_or_dir
- Putting:
scp mydata.dat [email protected]:Newname.dat
scp -r FileFolder [email protected]:/home/
- Gettiing:
scp [email protected]:remote.data /home/local.dat
scp -r [email protected]:FileFolder /home/
Weighted random choice
Python 带权重的随机选择。via
import random
def windex(lst):
'''an attempt to make a random.choose() function that makes weighted choices
accepts a list of tuples with the item and probability as a pair
like: >>> x = [('one', 0.25), ('two', 0.25), ('three', 0.5)]
>>> y=windex(x)'''
n = random.uniform(0, 1)
for item, weight in lst:
if n < weight:
break
n = n - weight
return item
Quickly and powerful
新系统的开发环境在 Mac 本地部署会很麻烦,所以就直接 ssh 到远程服务器就行修改操作;而 ssh 到服务器实施环境进行 coding 响应速度又跟不上,看着终端上字符一顿一顿的就焦急,配合 svn 快速而又安全的搞定。
本地 svn ci 代码到 svn 代码库,远程服务器 svn co 到实施环境,而后,就可以在本地进行 coding,完后 svn ci 提交代码,之后 ssh 到服务器实施环境 svn up 一下即可在实施环境部署最新代码。
通过 svn 代码库进行中间代码中转,这样 coding 的时候不受网络速度影响;通过 svn 又可以进行代码托管,保证代码安全,而且可以很方便的在实施环境切换、回滚代码版本。
唯一的一个小不足就是因为无法在本地进行 debug,有时候可能为了一个小问题 svn ci 好多次,代码库里会多好多个版本。
ImageMagick Notes
- 尺寸缩放
convert -resize 640x960 input.jpg output.jpg
convert -resize 75% input.jpg output.jpg
- 去除多余 Exif 等信息
convert -strip input.jpg output.jpg
- 调节压缩比例
convert -quality 75% input.jpg output.jpg
Happy in life
及时行善,能帮别人的时候就伸手帮一把,对你来说是举手之劳,对别人就是暖心之举。
及时行乐,善待自己,不必要那么累。