an idea for Pak'n Save users to save fuel cost

PknSave fuel voucher is often wasted by their members because their tank is full before it expires automatically. So the idea is, we can share the fuel vouchers through a mobile app.

  1. If it is big enough, you print a voucher whatever you need or not.
  2. If you don't need to fuel your car, post this voucher on our app and set the amount with expire time.
  3. If you need fuel for your car but have not a voucher, open the app and try to find an unused one. When you decide to use it, you booked it so other people cannot use it anymore. If you eventually didn't use it, put it back into the voucher pool.

Sounds great? Let's do it. If you want to contribute to this side project, contact me with [email protected]

Seafile server configuration on CentOS 8

I am using the docker-compose version. The first problem I met was none of Seafile's concerns, it is actually a bug of docker. All of the containers cannot reach the internet (cannot resolve any DNS). The solution is at here.

After fixed the issue above, the Seafile server runs well on centos. However, there are still two issues that need to be addressed.

The first one is about the head icon of a user. It simply cannot display. You can easily found that the host part of the head icon is wrong. You need to edit "shared/seafile/conf/ccnet.conf" and change the SERVICE_URL to your real hostname in the [General] section.

The second one is similar, if you don't fix it, you cannot download any of the file you uploaded. This time, you need to edit "shared/seafile/conf/" and change the last line to "".

tmux super simple guide

echo 'set -g mouse on' >> ~/.tmux.conf
tmux new -s tmux3
^b %
^b "
^b d
tmux attach -t tmux3

Superpay 小程序支付后端接口对接记


  1. 小程序 wx.login 拿到 code
  2. 小程序 wx.getUserInfo 拿到加密的 userData和iv
  3. 小程序登录请求公司后端服务器 /wechatMiniProgram/login 接口三方登录,登录成功拿到可访问公司其他接口的 accessToken
  4. 小程序拿着accessToken下订单
  5. 小程序拿着订单id请求公司后端服务器 /supay/wechatMiniProgramPay/{orderId}
  6. 公司服务器请求 supay 小程序下单接口,获取pay_info 给小程序。故事主要发生在这里。


  1. 小程序向公司后台服务器发起下单支付请求
  2. 公司后台服务器请求 superpay 服务器获取 openid
  3. superpay 服务器返回 openid 给公司后台服务器
  4. 公司后台服务器拿着openid 请求superpay服务器(小程序下单接口)拿 pay_info
  5. 公司服务器把 pay_info 返回给小程序
  6. 小程序拿 pay_info 发起支付



inner_trade_no是 supay 的单号,mch_order_no和outer_trade_no 是你们的单号
签名的时候字典序是重要的,文档里虽然没有提到,但在签名串字典序末尾追加一个 &key=商户appsecret 再md5是至关重要的。

因为签名需要拼一个query string格式的串,我就想当然的认为是post这个串到supay服务器。这是我的错,这里要以例子为准。例子里写的就是post一个json格式的数据过去。

10.07.2020 补充一个吐槽,小程序返回的 trade_amount 单位并不是人民币,是纽币。而且小程序各接口没有一个能返回人民币实际支付额。我的解决办法是拿自己的订单号调用 superpay 给非小程序支付的查询交易详情接口,这样就能拿到人民币交易金额数据。

How to setup pm2 to automatically start after reboot?

$ pm2 start
$ pm2 save
$ pm2 startup

You will see something like the following after you run the last command:

[PM2] Init System found: systemd
[PM2] To setup the Startup Script, copy/paste the following command:
sudo env PATH=$PATH:/usr/local/lib/nodejs/node-v12.18.0-linux-x64/bin /usr/local/lib/nodejs/node-v12.18.0-linux-x64/lib/node_modules/pm2/bin/pm2 startup systemd -u shukebeta --hp /home/shukebeta

copy the sudo line & paste it on your command line then press Enter! You have done.