terminal setup in linux mint

Updated version

sudo apt-get install tmux


Commands:

In tmux, hit the prefix ctrl+b (my modified prefix is ctrl+a) and then:

Sessions

:new<CR>  new session
s  list sessions
$  name session

Windows (tabs)

c  create window
w  list windows
n  next window
p  previous window
f  find window
,  name window
&  kill window
 

Panes (splits)

% vertical split " horizontal split o swap panes q show pane numbers x kill pane + break pane into window (e.g. to select text by mouse to copy) - restore pane from window ⍽ space - toggle between layouts

 
Set up scrolling 
put this command in your ~/.tmux.conf

setw -g mode-mouse on

# Lower escape timing from 500ms to 50ms for quicker response to scroll-buffer access.
set -s escape-time 50
 
 

Fix boot record after moving linux mint partitions to another disk

1. Copying partition is straightforward. Made using gparted.

2. Create bootable USB stick (Startup disk creator in Linux mint), boot from it.
Assume we have following partitions:
  • boot /sdb1 (don't really know how it works)
  • root /sdb2
  • home /sdb3
3. Do
sudo mount /dev/sda2 /mnt
 
## if you have boot partition:
# sudo mount /dev/sda1 /mnt/boot

sudo grub-install --root-directory=/mnt /dev/sda




Source of GRUB instructions

Mount yandex webdav on local dir

apt-get install davfs2 
mkdir /mnt/yandex.disk 
mount -t davfs https://webdav.yandex.ru /mnt/yandex.disk/
 
# check: 
df -h /mnt/yandex.disk/ 

how torch stores images

require('image')
imgPath = "image.jpg"
img = torch.Tensor(1, 3, imgDim, imgDim)
img[1] = image.load(imgPath, 3, byte)

image is stored as float, conversion is (intensity/255.). stored top->bottom, line by line. format RGB.

display

require 'gnuplot'
gnuplot.figure(1)
gnuplot.imagesc(img[1])

Torch<->numpy dictionary
https://github.com/torch/torch7/wiki/Torch-for-Numpy-users

Installing torch for miniconda

I got the error while installing torch for miniconda. Something like
Linking CXX executable mshrable
~/miniconda/envs/py27/lib/libreadline.so.6: undefined reference to `BC'
~/miniconda/envs/py27/lib/libreadline.so.6: undefined reference to `tgetnum'
~/miniconda/envs/py27/lib/libreadline.so.6: undefined reference to `PC'
~/miniconda/envs/py27/lib/libreadline.so.6: undefined reference to `tputs'
~/miniconda/envs/py27/lib/libreadline.so.6: undefined reference to `tgetent'
~/miniconda/envs/py27/lib/libreadline.so.6: undefined reference to `tgetflag'
~/miniconda/envs/py27/lib/libreadline.so.6: undefined reference to `tgoto'
~/miniconda/envs/py27/lib/libreadline.so.6: undefined reference to `UP'
~/miniconda/envs/py27/lib/libreadline.so.6: undefined reference to `tgetstr

The same was for python3 and python2 environments.  The solution (at least for python 2) was to remove miniconda from path and compile torch with the system python.


Solution from https://github.com/ContinuumIO/anaconda-issues/issues/152
same here, temporay fix for me is to remove conda readline from the environment:
conda remove --force readline
and install the python bindings with pip install readline.
That way, I presume it is using the system readline.

compile dlib for miniconda

Activate miniconda environment (my environment is called py3):
source activate py3

Produce initial steps from the readme:
cd examples
mkdir build
cd build
cmake ..
cmake --build . --config Release

inside function  build_dlib() of file setup.py add the highlighted code:
        if platform_arch == '64bit' and sys.platform == "win32":
            # 64bit build on Windows

         .................. bla bla ...................

            for ext in [py_ver.replace(".", "") + '.lib', py_ver + 'mu.lib', py_ver + 'm.lib', py_ver + 'u.lib']:
                py_lib = os.path.abspath(os.path.join(inc_dir, '../libs/', 'python' + ext))
                if os.path.exists(py_lib):
                    cmake_extra_arch += ['-DPYTHON_LIBRARY={lib}'.format(lib=py_lib)]
                    break
        else:
            cmake_extra_arch += ['-DPYTHON_LIBRARY=/home/user/miniconda/envs/py3/lib/libpython3.so']
            cmake_extra_arch += ['-DPYTHON_INCLUDE_DIR=/home/user/miniconda/envs/py3/include/python3.5m']


        build_dir = os.path.join(script_dir, "./tools/python/build")
     ......................bla bla.....................................


Replace /home/user/miniconda by your path to miniconda

Run python setup.py install (as usual)

compile dlib for miniconda

Activate miniconda environment (my environment is called py3):
source activate py3

Produce initial steps from the readme:
cd examples
mkdir build
cd build
cmake ..
cmake --build . --config Release

inside function  build_dlib() of file setup.py add the highlighted code:
        if platform_arch == '64bit' and sys.platform == "win32":
            # 64bit build on Windows

         .................. bla bla ...................

            for ext in [py_ver.replace(".", "") + '.lib', py_ver + 'mu.lib', py_ver + 'm.lib', py_ver + 'u.lib']:
                py_lib = os.path.abspath(os.path.join(inc_dir, '../libs/', 'python' + ext))
                if os.path.exists(py_lib):
                    cmake_extra_arch += ['-DPYTHON_LIBRARY={lib}'.format(lib=py_lib)]
                    break
        else:
            cmake_extra_arch += ['-DPYTHON_LIBRARY=/home/user/miniconda/envs/py3/lib/libpython3.so']
            cmake_extra_arch += ['-DPYTHON_INCLUDE_DIR=/home/user/miniconda/envs/py3/include/python3.5m']


        build_dir = os.path.join(script_dir, "./tools/python/build")
     ......................bla bla.....................................


Replace /home/user/miniconda by your path to miniconda

Run python setup.py install (as usual)