Perforce backup with rsync

First thing to know, I don’t really want to backup the entire perforce database since it’s huge and requires a lot of extra steps. I’m only backing up the latest version in case a doom fire happens to my apartment.
The scheduled backup is run on my p4 server A, in order to run a scheduled backup plan to push my newest project version to server B.

Create client(aka workspace) for the server A itself.

p4 -d `pwd` client -t Vuth_Auri -o Auri_Backup | p4 client -i
p4 client Auri_Backup

Then run a script in crontab.

51 * * * * bash /home/vuth/__backup/


p4 sync
rsync -rtz -e "ssh -p 1111 -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -i /home/vuth/.ssh/id_rsa_somekey" /home/vuth/__backup/p4 vuth@

First line get the latest version of your project to the workspace.
Second line runs rsync over a ssh connection to your remote server B.

And that’s it. Notice that this is incremental. You can add –delete to the rsync command to remove garbage from remote server B. I left it for extra safety.

“Wait for your 30s. You’re fucked.”

一包辣条 怎么办
Continue reading

Bukkit定时重启bash脚本,GNU Screen走着

Bukkit服务器我一直用GNU Screen跑,隔两天有时候会不稳定要重启。好麻烦根本就不关心为什么,搞定就行。有bukkit插件可以实现但是咱多没自尊用那个。虽然感觉bash操作Screen也挺邋遢的.. 但是好用!其实不然的话怎么操作后台,nohup倒腾输入流什么的太麻烦了,这种用途还是terminal模拟器好看。


while (( $i < 5 ))
    if [ "`ps aux|grep -e '^bukkit'|grep SCREEN`" != "" ]; then
        su bukkit -c 'screen -S bukkit -X stuff 'stop`echo -ne '\015'`'' #`echo -ne '\015'` 等于敲下回车
        echo "`date`" 'Stoping bukkit...'
        sleep 5


if (( $i == 100 )); then
    echo "`date`" 'Bukkit was not running. Starting...'

if (( $i == 5 )); then
    kill `ps aux|grep bukkit|awk '{print $2}'`
    echo "`date`" 'Forcibly killing bukkit...'
    sleep 1

if [ "`ps aux|grep -e '^bukkit'|grep SCREEN`" != "" ]; then
    echo "`date`" "ERROR: Couldn't stop bukkit. Exiting."
    exit 1

bash /home/bukkit/

exit 0

Continue reading

暴力调整Oculus Rift的瞳距设置

A ruthless way to modify your Oculus Rift’s IPD (Interpupillary Distance)

TL;DR: Pictures say it all.

IPD (interpupillary distance) is basically the distance between the center of your two eyeballs. The average value is 63mm~65mm, which Oculus Rift DK is designed for(64mm). If yours is too wide or narrow beyond that you’ll notice how the image in Rift doesn’t focus too well horizontally, which is uncomfortable and may lead to sickness.

My IPD is extremely wide, 72mm (please, I’m still handsome). After a while’s use I knew this is not something I can just ignore so I did some research. The problem turned out to be pretty common, this post shows plastic adapters user bwhill designed to adjust the IPD to specified value. But he’s only selling 3D-printed products not sharing or selling the blueprint and it’s too much of a wait to ship to china. So I penned a few lines and plugged in my heat knife, it’s not pretty but it had the job done.

Continue reading

Time offset for particle instance animation in Maya

因为instancer只是把你加入列表里的虫子模型调整位置显示,无法直接偏移时间,所以思路是copy多个虫子,逐个调整时间后把它们随机附着在粒子上。 Continue reading

把Kinect扫描的点云数据导入Maya | Import Kinect point cloud to Maya

I used Skanect to scan my room down. The .ply file generated is like this:

0.614557 -0.0194625 -0.305274 -0.127814 -0.551592 0.824263 100 113 96
0.614418 -0.019946 -0.305417 -0.127814 -0.551592 0.824263 98 111 96
0.61429 0.00103368 -0.303381 0.0386538 -0.603242 0.796621 104 107 95

Continue reading

Use Kinect LiDAR for camera matchmoving in PFTrack | 用Kinect的激光测距来帮助PFTrack的摄影机反求

So yea I got the idea becaues I wanted to deploy some close-up shots in my small project, but close-ups are always a pain to matchmove according to my experience. We know that this device’s resolution is quite limited, so does it work?

Couldn’t find anybody done the same thing using this low cost toy on Internet, or at least they didn’t post it. So here you go, the result turns out neat and I’m really happy with it. Notice at the end of the clip, the shot is pretty close and it worked fine. Video:

Continue reading


Finally have a multi-language plugin installed, which Can’t be run without a fancy switching button. I photoshopped an old school pink neon sign, with color picked from Drive =D 多语言达成!所以没有一个漂亮的切换图标怎么行?做了一个old school的粉色霓虹灯, 色彩取的 Drive 上的=D Continue reading