Category Archives: Programming

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 Scipy on Linux Red Hat

Tried to install scipy using easy_install (also pip). Installation failed with error: Atlas ( libraries not found. Instead: sudo yum install scipy works seamlessly

Posted in EC2, Machine Learning, Programming, Python | Leave a comment

Problems with character encoding when piping output from a python script to a file

Suppose my_unicode_string is a Python unicode string. If you get an error when you do the following: and the error is: UnicodeEncodeError: ‘ascii’ codec can’t encode character u’\xf1′ in position 9: ordinal not in range(128) To get rid of the … Continue reading

Posted in Programming, Python | 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 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