Deploy Jupyter behind Apache reverse proxy

Standard

Jupyter was deployed on one LXD container and Apache was deployed on another. At first Jupyter kept complaining “Connecting to kernel… Failed.”

Ubuntu: 16.04LTS

Apache: Server version: Apache/2.4.18 (Ubuntu)

Solution:

Add those two lines BEFORE “/” one:

ProxyPass /api/kernels/ ws://xxx.lxd:8888/api/kernels/
ProxyPassReverse /api/kernels/ http://xxx.lxd:8888/api/kernels/

AND: make sure proxy_wstunnel is enabled for Apache:

a2enmod proxy proxy_wstunnel

Convertion of grey code and binary

Standard

Source: http://www.cnblogs.com/grandyang/p/4315607.html

以下转换代码摘自维基百科 Wikipedia:

/*
The purpose of this function is to convert an unsigned
binary number to reflected binary Gray code.

The operator >> is shift right. The operator ^ is exclusive or.
*/
unsigned int binaryToGray(unsigned int num)
{
return (num >> 1) ^ num;
}

/*
The purpose of this function is to convert a reflected binary
Gray code number to a binary number.
*/
unsigned int grayToBinary(unsigned int num)
{
unsigned int mask;
for (mask = num >> 1; mask != 0; mask = mask >> 1)
{
num = num ^ mask;
}
return num;
}

Left handed cursor for Mac

Standard

Thank bondingfortoday for this amazing method. It saves me, and it works on OS El Capitan:

Source: https://discussions.apple.com/thread/3046732

bondingfortodayApr 12, 2015 7:55 PM
Re: Left handed mouse pointerin response to sipilevi
You can use the following app called Mousecape:

https://github.com/alexzielenski/Mousecape/releases/tag/0.0.5

After downloading, installing both the app and the helper app, do the following:

  1. Go to the Mousecape preferences and choose “I am left handed”.
  2. Dump the system cursors into a cape from the menu: “Capes” → “Dump Cursors”
  3. Apply the Cursor Dump cape (right click → apply)
  4. Done!