In macOS Sierra, Karabiner-Elements finally support complex modifications

In favor of this commit, Karabiner-Elements now supports the much welcomed yet long-lost feature, namely complex modifications that enable users to trigger complex keypress. Now I can achieve this: If I press <Enter>, then: 1. If <Enter> is pressed alone, then send <Enter>. 2. If <Enter> is pressed along with other keys, then send <Control> + Other. By adding this code to ~/.config/karabiner/karabiner.json : "complex_modifications": { "rules": [ { "manipulators": [ { "description": "Change return_or_enter to left_control.

Read More

等时圆

最近学校老师讲了一下等时圆。先从这个题讲起: 在同一个地方向不同倾角光滑斜面用不同的初速度上滑,到达最高点所用时间相等,求最高点的轨迹是什么? A. 直线 B. 椭圆 C. 抛物线 D. 圆 当时做这个题目的第一想法是把x和y座标表示出来: $$ \frac{1}{2}gsin\theta{}t^2=l, y=lsin\theta, x=ycot\theta $$ 然后就傻眼了,并得不到x与y的关系式。当然了可以求出几个点,强行带入二次曲线通式求解。不过想了想还是用解析几何的方法去做吧: $$ \frac{1}{2}gsin\theta{}t^2=\sqrt{x^2+y^2}, sin\theta=\frac{y}{\sqrt{x^2+y^2}} $$ 这么一代入,显然是圆。但既然这是物理题,可不可以用物理方法做呢? 可以,这就是等时圆。 啥叫等时圆? 等时圆就是,在一个光滑圆环上选择任意一点,让一个小球从这个点沿着光滑直杆到圆的最低点,无论这个点在哪里(最低点不算哈),时间都是一样的。怎么证明? 很简单:设小球与最低点连线与数值方向上夹角为$$\theta$$,那么 $$ s=2Rcos\theta, \frac{1}{2}gcos\theta{}t^2=s $$ 你会发现t与$$\theta$$无关。证明完毕。 其实也可以倒过来:从圆的最高点往各个方向下滑,到达圆周时间相等。 好了,到此为止内容都没什么,但你会想问这和前面那道题目有什么关系呢?这怎么等时圆?重力往下诶。运动可是往右上方。 Here comes the black magic :) 我们考虑向下滑到最低点的那个等时圆,在这个圆周上滑倒最低点的时间都相等。好,我们把这个图沿着竖直方向旋转180度形成一个球,想想这个球上每一个点到最低点时间是不是也一样?那么考虑逆过程,让小球从斜面上滑下来,我对刚才的球体再竖着切一刀,得到的平面不就是题目中那个吗?得证。 当然了最好能有动画说明,限于本人时间问题暂时不提供 ^_^

Read More

I have found a good way to track changes in .gz files: Add these to ~/.gitconfig: [core] attributesFile = ~/.gitattributes [diff "zip"] textconv = unzip -p binary = true [diff "gz"] textconv = gzcat binary = true [diff "bz2"] textconv = bzcat binary = true [diff "xz"] textconv = xzcat binary = true [diff "tar"] textconv = tar -O -xf binary = true [diff "tar-bz2"] textconv = tar -O -xjf binary = true [diff "tar-gz"] textconv = tar -O -xzf binary = true [diff "tar-xz"] textconv = tar -O -xJf binary = true [diff "odf"] textconv = odt2txt [diff "pdf"] textconv = pdfinfo [diff "bin"] textconv = hexdump -v -C And these to ~/.

Read More

Finally the end of Senior 2 arrives. I'm on the way to Senior 3. The summer vacation is rather short which is really common in China. These days I have been diving into Emacs by subscribing both emacs and emacs-devel mailing list. It contributes to my English as well. I can learn a lot of new words and expression thanks to the nice and convenient feature of looking up a word in iOS.

Read More

Just got a piece of great news: GHC 8.0.1 is out! See the announcement [here][http://article.gmane.org/gmane.comp.lang.haskell.ghc.devel/11928]. So excited! And Emacs 25 release will be out soon. Using Emacs 25.0.94 now. Many new features available. See [this][http://puntoblogspot.blogspot.com/2016/05/emacs-251-news.html] for more information. Recently I have finally started to use mu4e and gnus. What makes it truly great is that they integrate org, bbdb and so on.

Read More

Having a bad cold. Really annoying. Okay, here comes the interesting links: https://glyph.twistedmatrix.com/2015/11/editor-malware.html http://kitchingroup.cheme.cmu.edu/blog/2016/04/07/Writing-hy-code-from-hy-code/ https://github.com/holomorph/transmission https://github.com/bergey/org-babel-diagrams http://ess.r-project.org/ http://projects.haskell.org/diagrams/

Read More

Just learned a new tip on git shallow clone. As you know, some repository are really really large, such as emacs and linux. Cloning is slow and unstable. And there is no way to pause and resume a git clone. So I use shallow clone to clone them. But what if I want to clone other branches? From here: http://stackoverflow.com/a/27393574/2148614 git remote set-branches origin '*'

Read More

Here is the subtitle: We meet in a week that could change the United Kingdom for ever. Indeed, it could end the United Kingdom as we know it. On Thursday, Scotland votes, of the future of our country is at stake. On Friday, people could be living in a different country with a different place in the world and the different future ahead of it. This is the decision that could break up our family of nations and rips Scotland from rest of the United Kingdom.

Read More

Most of us have learnt how to use PCLogo to draw some graphics. Logo is a dialect of Lisp in fact, so most of us used a Lisp dialect at a early time! For some people, it is earlier than C++. Cool.

Read More