Deepin Wine WeChat Notes

Archlinux with en locale

Package: deepin.com.wechat2

#!/bin/bash
/usr/lib/gsd-xsettings &
/opt/deepinwine/apps/Deepin-WeChat/run.sh

Chinese font settings:

1. Create a reg file chn.reg

REGEDIT4

[HKEY_LOCAL_MACHINE\Software\Microsoft\Windows NT\CurrentVersion\FontLink\SystemLink]
"Arial"="notosans.ttc"
"Arial CE,238"="notosans.ttc"
"Arial CYR,204"="notosans.ttc"
"Arial Greek,161"="notosans.ttc"
"Arial TUR,162"="notosans.ttc"
"Courier New"="notosans.ttc"
"Courier New CE,238"="notosans.ttc"
"Courier New CYR,204"="notosans.ttc"
"Courier New Greek,161"="notosans.ttc"
"Courier New TUR,162"="notosans.ttc"
"FixedSys"="notosans.ttc"
"Helv"="notosans.ttc"
"Helvetica"="notosans.ttc"
"Microsoft YaHei"="notosans.ttc"
"MS Sans Serif"="notosans.ttc"
"MS Shell Dlg"="notosans.ttc"
"MS Shell Dlg 2"="notosans.ttc"
"System"="notosans.ttc"
"Tahoma"="notosans.ttc"
"Times"="notosans.ttc"
"Times New Roman CE,238"="notosans.ttc"
"Times New Roman CYR,204"="notosans.ttc"
"Times New Roman Greek,161"="notosans.ttc"
"Times New Roman TUR,162"="notosans.ttc"
"Tms Rmn"="notosans.ttc"
"notosans"="notosans.ttc"

2. Import

WINEPREFIX=~/.deepinwine/Deepin-WeChat deepin-wine regedit 

3. Adjust DPI

WINEPREFIX=~/.deepinwine/Deepin-WeChat deepin-wine winecfg

4. Setup Locale

LC_ALL=zh_CN.UTF-8

穷人真的比富人更慷慨吗?

今天听了最新一期的 Freakomics: Are the Rich Really Less Generous than the Poor? 里面讲了一个很有趣的经济实验(注1,经济学的实验都是很难的)。

往常大家的共识是认为有钱人往往更加自私,穷苦的人家的孩子相比会慷慨一些。比如在这个实验里,穷人家的孩子会比富人家的孩子捐助得多。这点在穷人和富人在慈善的投入中也有所体现

但和以往更多的实验室里的实验不同的是,这次的经济学家把实验放到了更加真实环境里:他们在荷兰的一个城市中找了160家有钱人的住宅和160家贫穷人的家,分别投递了一封收件人并不是他们的信,信里面有5欧或20欧的现金或者支票。当那320户人家收到信的时候,他们会知道这个信并不是给他们的,但又能看到信里的钱。这个实验就想看看是有钱人家还是穷人家更会把这个钱还给真正的收件人呢?

实验的结果却大跌眼镜,不管是5块还是20块,不管是现金还是支票,富人里有~80%的人会退还信封,是穷人相应比例的两倍。穷人只有不到 40% 的人会还回那封信。他们还发现,往往在发工资之前的几天,穷人是越不会送还这封信的,等到发完工资之后,这个比例才会最高。实验结果有很多种解释,比如20欧的钱对穷人的吸引力远比对富人的多,又比如,穷人的执行力比起富人往往更差,或者他们一般会更忙,他们很有可能本来想要归还的却一直没有做。

所以作者最后的结论是,穷人不比富人更加慷慨,但反之也不一定成立。

13 Reasons Why 观后

花了大半天的时间看完了Netflix的新剧 <13 Reasons Why>,很推荐。

这是一个很沉重的片子,是一个校园欺凌和青少年抑郁的故事:一个高中女孩自杀之后留下了十三章卡带,讲述了她如何一步一步走向死亡的过程,很灰暗,却很真实。

十三个人物里,真正意义上的坏人只有一个,他是个体育好的富二代,学校里的明星学生,一次次的把魔爪伸向无辜的女孩们。这样的人,每个校园都会出现。其他的十二个角色,则更是我们身边的人,或者我们自己。有时候开着一些无谓的玩笑,搞一些很无聊的恶作剧,出了事情以后若无其事的再把脏水泼给别人,自己都没有意识到在无意之中对别人的伤害。

雪崩的时候,没有一片雪花是无辜的。

同时,青少年的心理问题也值得关注,片子里的父母似乎也都没有一个够好的亲子关系,正如后面的花絮里说的,那个年龄的孩子们,肚子有一大堆的问题,却无从表达。要培养一个坚强勇敢的孩子,似乎也不是那么容易的事情,更何况,抑郁的时候,一根稻草就足以压倒那头骆驼。

找老师的那段无比可惜,她可是寻求帮助了啊,就差了那么一点点。

最后的最后,看了这么多集,在为一个生命惋惜的时候,谁曾想到,还有一个生命,也走上了自杀的道路?!

真是难过。

How to Access Host machine via SSH in Virtualbox

There are sufficient articles teaching ppl how to access guest machine via ssh in virtualbox, while it takes me time to figure out the reverse way. It is very important since i dont that trust virtual machine and i hope to do the one-way backup of my work in the host.

Well, here is the answer. If using NAT, the ip address 10.0.2.2 is the host machine.

Note: remember to add “sshd: 127.0.0.1” in /etc/hosts.allow otherwise the sshd gives u “ssh_exchange_identification: connection closed by remote host” error.

Google GO (5) – "Effective Go" Notes

Effective GO link

“gofmt” could do the code formatting for you.

Underscore (_), is the blank identifier, provides a way to ignore values returned by a multi-valued expression.

x, _ = f() // ignore second value returned by f()

use range to help for loop

for _, value := range m { // key is unused
sum += value
}

In switch, cases can be presented in comma-seperated lists

switch c {
case ‘ ‘, ‘?’, ‘&’, ‘=’, ‘#’, ‘+’, ‘%’:
return true
}

Switch can be used to discover the dynamic type of an interface variable.

switch t := interfaceValue.(type) {
default:
fmt.Printf(“unexpected type %T”, type); // %T prints type
case bool:
fmt.Printf(“boolean %t\n”, t);
case int:
fmt.Printf(“integer %d\n”, t);
case *bool:
fmt.Printf(“pointer to boolean %t\n”, *t);
case *int:
fmt.Printf(“pointer to integer %d\n”, *t);
}

Functions support multiple returns, such as

func nextInt(b []byte, i int) (int, int)

Named return parameter is initialized by zero, and return by current value if return with no arguments.

Composite literal, could use

return &File{fd, name, nil, 0};

or labels inside

return &File{fd: fd, name: name}

new() returns the pointer with all zeroed memory.

make(T, args) creates slices, maps and channels.

Arrays, when it is passed to a function, it is a copy of the array, not just the pointer.

The size of an array is part of its type, which means [10]int and [20]int are distinct.

len(slice) -> length, cap(slice) -> capacity

In if statement, the expression may be preceded by a simple statement, which executes before the expression is evaluated.

if x := f(); x < y {

Go’s memory sharing design:

Do not communicate by sharing memory; instead, share memory by communicating.

Buffered channel & Unbuffered channel

ci := make(chan int); // unbuffered channel of integers
cj := make(chan int, 0); // unbuffered channel of integers
cs := make(chan *os.File, 100); // buffered channel of pointers to Files

Channels could be used as semaphore

var sem = make(chan int, MaxOutstanding)

func handle(r *Request) {
sem <- 1; // Wait for active queue to drain.
process(r); // May take a long time.
<-sem; // Done; enable next request to run.
}