Category Archives: Productivity

Merging in mercurial with vimdiff

Put the lines below in .hg/hgrc file of a repository: [ui] merge = vimdiff [merge-tools] vimdiff.executable = vim vimdiff.args = -d $base $local $output $other +close +close Now whenever you do: hg pull hg update and if there are conflicting … Continue reading

Posted in Mercurial, Productivity, Programming, UNIX/Linux, Vim | Leave a comment

Running script in background on linux

If we want to run a script from terminal and be able to close the terminal without killing a script (because terminal would be a parent process, so if it dies, its children die automatically), here is the command: nohup … Continue reading

Posted in Bash, Productivity, Programming, Python, UNIX/Linux, Vim | Tagged , , | Leave a comment

Installing extensions for Mercurial

Detailed instructions are here. Create forlder ~/.hgextensions Copy extesion files to this folder. Open ~/.hgrc Mercurial’s config file and add [extensions] section. It might look something like: At the moment of this post Kiln did not support SSH connection. Kilnauth … Continue reading

Posted in Mercurial, Productivity, Programming | Leave a comment

Running unit tests in Python

Install nose: sudo easy_install nose or: sudo pip install nose By default nose finds all directories and files that match the following regular expression: (?:^|[b_./-])[Tt]est [NOSE_TESTMATCH] I usually create a file test_something.py and place my unit tests there as regular … Continue reading

Posted in Productivity, Programming, Python, UNIX/Linux | Leave a comment

Great unix one liner to join two tables keys in the first columns

Suppose file column_ids.csv contains the first column with some IDs. You have a table big_table.csv with the first column also containing IDs. We can join the two files in unix shell: -t option specifies a delimiter. Both files must be … Continue reading

Posted in Bash, Productivity, Programming, UNIX/Linux | Leave a comment

Useful idioms for C/C++ programming

To double integer n: To divide by 2 as integer: To check if n is even integer: Idioms below are due to Adam Peterson. Instead of better: sizeof *telegram is computed at compile time! Size of array by division: NUM_OF_HANDLES … Continue reading

Posted in C++, Productivity, Programming | Tagged , , , , | Leave a comment

How to add a scheduled job on Linux(Ubuntu)

There is a special program called ‘crontab’. Type This will open vim to edit the file with a list of commands that crontab will be executing.

Posted in Productivity, Programming, UNIX/Linux | Tagged , , | Leave a comment