Site moved to https://serge-m.github.io/

New address: https://serge-m.github.io/

Archives for 2017

2017-01-09T07:10:00, Mon
Set up HP 1020 printer in Linux Mint 18
2017-01-08T14:10:00, Sun
Pelican Hints
2017-01-08T11:10:00, Sun
Shell commands
2017-01-08T07:10:00, Sun
Add service in ubuntu
2017-01-07T07:10:00, Sat
OpenVPN server in cloud using docker
2017-01-05T07:10:00, Thu
Docker in Scaleway's vc1s Ubuntu Xenial
2017-01-04T07:10:00, Wed
Check server fingerprint for scaleway
2017-01-04T07:10:00, Wed
Operations on images in python


Archives for 2016

2016-12-31T21:30:00, Sat
Raspberry Pi Links
2016-12-19T21:30:00, Mon
Run docker as pytest fixture
2016-12-07T00:30:00, Wed
Installing java 8 on linux mint 17.3
2016-11-27T22:47:00, Sun
Testing json responses in Flask REST apps with pytest
2016-11-27T20:47:00, Sun
Set up Travis CI for building personal page on Github Pages with Pelican
2016-10-08T01:10:00, Sat
Refactoring python code. Extracting variables and other.
2016-10-08T01:10:00, Sat
Useful python links
2016-09-29T14:10:00, Thu
How to fix google search suggestions in Firefox in Linux Mint
2016-08-14T14:16:00, Sun
podcasts
2016-08-14T14:10:00, Sun
git apply patch from another repository
2016-08-07T11:20:00, Sun
terminal setup in linux mint
2016-07-16T20:07:00, Sat
Fix boot record after moving linux mint partitions to another disk
2016-07-16T13:45:00, Sat
Mount yandex webdav on local dir
2016-06-26T23:01:00, Sun
how torch stores images
2016-06-26T22:11:00, Sun
Installing torch for miniconda
2016-06-25T22:43:00, Sat
compile dlib for miniconda
2016-06-19T12:37:00, Sun
Mount windows shares in linux
2016-06-03T23:08:00, Fri
deep learning
2016-06-02T23:24:00, Thu
autocomplete from history in terminal (in linux mint)
2016-06-01T20:47:00, Wed
Working with date and time in Java (russian)
2016-05-16T00:11:00, Mon
pypy with numpy
2016-05-01T12:33:00, Sun
About python
2016-04-10T20:50:00, Sun
Dropbox in linux mint
2016-04-05T00:45:00, Tue
C++ IDE for linux
2016-04-04T00:01:00, Mon
Debugging numpy (any C code of Python) using gdb
2016-03-22T22:12:00, Tue
Scipy in pypy
2016-03-22T21:51:00, Tue
Building Pypy
2016-01-08T08:30:00, Fri
TIL about PyPy









podcasts

http://dontspeak.podster.fm/
http://www.spotlightradio.net/

git apply patch from another repository

$ git --git-dir=../<some_other_repo>/.git format-patch -k -1 --stdout <commit SHA> | git am -3 -k
 
Source 
http://stackoverflow.com/questions/6658313/generate-a-git-patch-for-a-specific-commit 

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