:) bikulov.ORG Static notes about information technologies

Create video illustrations from numerical experiments data with Paraview and Python 2

See updated note.

Tips for LXC: creation, autostart, OpenVPN and port forwarding to containers

I’ve completed setting up my comfort set of LXC containers and want to save some points I spent a lot of time for or things for copy-paste.

I used the official Ubuntu Server Guide but note at Digital Ocean knowledge base also helped me a lot. I created 3 containers: one for vpn, one for site on Drupal and last one as www proxy for second one with nginx only.

Setup Drupal 7 with nginx and PostgreSQL on Ubuntu 14.04

This note is similar to previous drupal and joomla installations. Install requirements (webserver, php5, DB server, DB adapter for php) as root:

apt-get install -y nginx php5-fpm nginx postgresql php5-pgsql php5-gd

Install up-to-date scientific environment in Ubuntu 14.04 with Python 3.4

Note: I’ve created an updated page with most recent instructions for Jupyter Notebook.

Research Papers Management With Zotero and Yandex.Disk

Zotero is an open source plugin for Firefox for managing research papers collections. You can use online zotero storage (pretty small) or use third-party sync application. I use Yandex Disk for this purpose: 10 Gb it quite enough for a moderate research library. zotero can automatically fetch article metadata (author, year, etc) from the web (like Mendeley and similar software do).

SSH config for multiple hops in Linux

Often some hosts in corporate network are available only from several gateway machines. The scheme looks like that: you connect to gateway ssh -A gateway.public.net and then to desired host from gateway machines ssh -A host.private.net. But the problem arises when you want to copy or download something from host.private.net. You have to do it in two hops, because host.private.net is not available from your machine directly. The solution is ssh forwarding.

Example of CMake file for CUDA+CPP code

Makefiles are quite straightforward and easy to write (in reasonable situations). But GNU Make is not crossplafrom. CMake is cross-platform, cross-application (it can generate projects for different IDEs and Makefile itself).

throw() in function signature in C++

There is base class exception in standard library (header <exception>). It has default constructor, copy constructor, copy operator and destructor and virtual what() function. Latter returns string with additional information about exception.

Sort strings from file in C++

The very simple and common test program is to read bunch of strings from input file (let it be input.txt), sort them and write down to another file (output.txt). There is an implementation with small bug: it adds extra empty line. I’ve modified original code a bit, so now it works correctly (note: if have last empty line in the input, you will have an empty line in the output). Fixed code is provided below.

Randomized quicksort implementation in C++

Quicksort has $O(N\log(N))$ computational complexity in best and average cases, $O(N^{2})$ for bad case. Extremely bad cases may be avoided by using randomized Quicksort.