WordPress redirect loop

Had the problem after upgrade recently. Turned out it was because Cloudfront SSL termination causes wordpress to keep redirecting https.

Solution here.

Deepin Wine WeChat Notes

Archlinux with en locale

Package: deepin.com.wechat2

/usr/lib/gsd-xsettings &

Chinese font settings:

1. Create a reg file chn.reg


[HKEY_LOCAL_MACHINE\Software\Microsoft\Windows NT\CurrentVersion\FontLink\SystemLink]
"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"
"Microsoft YaHei"="notosans.ttc"
"MS Sans Serif"="notosans.ttc"
"MS Shell Dlg"="notosans.ttc"
"MS Shell Dlg 2"="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"

2. Import

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

3. Adjust DPI

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

Restore Tag When Plug/Unplug Screen in Awesome WM

tag.connect_signal("request::screen", function(t)
    clients = t:clients()
    for s in screen do
        if s ~= t.screen and clients and next(clients) then
            t.screen = s
            t.original_tag_name = t.original_tag_name or t.name
            t.name = t.name .. "'"
            t.volatile = true

screen.connect_signal("added", function(s)
    for k,t in pairs(root.tags()) do
        if t.original_tag_name then
          -- find the new tag on the new screen
            new_tag = awful.tag.find_by_name(s, t.original_tag_name)
            if new_tag then
                t.name = t.original_tag_name
                t.original_tag_name = nil
                new_tag:delete(t, true)

Reference: reddit


家里有一台台式机,用着很爽。最近有需要到处使用电脑的需求,手头有一台老旧的macbook air,想来可以试试远程桌面。

NoMachine 的设置很简单,并支持Win/MacOS/Linux和各类手机(未尝试),开箱almost可用,有一些小问题,特此记录一下:

  1. 我的PC是 linux,又是使用的大屏幕,自动转换分辨率并不支持。
  2. 我用colemak,PC上的键盘是在固件level改的,而mac的nomachine client无法forward这个设定。

好在 NoMachine 支持 callback custom script,在 session start /disconnect / close 等可以唤醒。设置在 /usr/NX/etc/node.cfg,用 xrandr 来改分辨率,setxkbmap 设置 keyboard layout。


export XAUTHORITY=/home//.Xauthority
export DISPLAY=":0"

xrandr -d :0 --output HDMI-0 --dpi 144 --set audio off --mode 1920x1080 &> /tmp/f.log

setxkbmap us &>> /tmp/f.log

Traffic Throttling on Linux

I guess I should document this since I spent some time to get this to work.

In short, to rate limit a box to 30MB/s
tc qdisc add dev eth1 root tbf rate 30mbps burst 10kb latency 70ms mtu 100000

The reason why we set mtu to 10000 is because of this.

To delete this rule:
tc qdisc del dev eth1 root

And to view current setting:
tc -s qdisc ls dev eth1