Skip to main content

Posts

Showing posts from January 12, 2020

追剧买VIP会员去广告,值不值?李永乐老师讲时间成本

【读书半杯茶】之二十 《西进路上人吃人》:唐纳大队的故事

《The Best Land Under Heaven》:the Donner Party in the Age of Manifest Destiny By Michael Wallis 美国西部开发的历史,是一部惊天动地的史诗。一个新兴的国家,怀着自信与使命感,向西进军,毅然决然开拓出一个新世界。这本书里写的,却是西部开发早期移民中一个悲惨的故事。 美国向西部移民,起于19世纪初叶,但一直到四十年代中期也没成气候。1845年,2760人移民西部,只有260人去了现在的加州(当时是墨西哥领土),其他人都去了俄勒冈。唐纳大队的故事就发生在第二年1846年87位向加州移民的美国人身上。 1846年的加州,地广人稀,墨西哥的统治也受到美国的挑战。美国人苏里文(John L O'Sullivan)在1845年提出"大使命"(Manifest Destiny),强调美国价值观的优越性,美国人有责任以当时美国的农业社会为样板,向西发展。苏里文的这个理念为广大美国人接受。一些早先移民加州的美国人开始大力宣传加州是人间天堂并印发书籍,给出种种移民西部的方法、途径,在美国中西部(如伊州,俄亥俄州,印第安纳州,密苏里州)引起不小反响。那些认为当时自己周围人口太多,想为后代再找一个大发展机会的人,蠢蠢欲动 。 这个故事里的唐纳(George Donner)当时是伊利诺州的一个富裕的农场主,在当地是个旺族。另一位主要人物瑞德(James Reed)则是一个不断尝试各种创新,活跃于伊州上层社会的能人。他们正是这一个"大使命"积极响应者。1846年4月中,他们从伊州春田市向西进发。 一开始,虽然慢点儿但还顺利。他们走上已知的路径,参加到向西进发的大军中。他们用了一个月时间,走到密苏里州的独立市(Independence), 又用了两个多月的时间于七月底走到了现在犹他州境内的Fort Bridger。以前移民去加州都是从这里沿着已有的俄勒冈小道(Oregon Trail), 先向西北走大约两百英里,然后再掉头转向西南,翻过内华达山脉,最后进入到达现在加州首府萨克拉门托市所在的一个叫Sutter Fort的地方。按这个走法,唐纳他们9月初可以到。 但以瑞德为首的几个人却认为这样太绕。他们相信一个叫Hastings的人当时印发的一个小册子说的一条近路,从Fort Bridges 不向西

Using an ssh-agent, or how to type your ssh password once, safely.

If you work a lot on linux and use   ssh   often, you quickly realize that typing your password every time you connect to a remote host gets annoying. Not only that, it is not the best solution in terms of security either: Every time you type a password, a snooper has an extra chance to see it. Every host you ssh to with which you use your password, well, has to know your password. Or a hash of your password. In any case, you probably have typed your password on that host once or twice in your life (even if just for passwd, for example). If you are victim of a Man In The Middle attack, your password may get stolen. Sure, you can verify the fingerprint of every host you connect to, and disable authentication without challenge and response in your ssh config. But what if there was a way you didn't have to do that? This is where key authentication comes into play: instead of using a password to log in a remote host, you can use a pair of keys, and well,   ssh-agent . Usi

Print b'hi\n' instead of 'hi'?

The   b   indicates that what you have is   bytes , which is a binary sequence of bytes rather than a string of Unicode characters. Subprocesses output bytes, not characters, so that's what   communicate()   is returning. The   bytes   type is not directly   print() able, so you're being shown the   repr   of the   bytes   you have. If you know the encoding of the bytes you received from the subprocess, you can use   decode()   to convert them into a printable   str : >>> print ( b 'hi\n' . decode ( 'ascii' )) hi Of course, this specific example only works if you actually are receiving ASCII from the subprocess. If it's not ASCII, you'll get an exception: >>> print ( b '\xff' . decode ( 'ascii' )) Traceback ( most recent call last ): File " " , line 1 , in < module > UnicodeDecodeError : 'ascii' codec can 't decode byte 0xff in position 0… The newline is part of what  

理发还能被剪到耳朵?飞机注定发生空难吗?李永乐老师讲墨菲定律