Category Archives: UNIX/Linux

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

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

Add a new host to known_hosts

This is from serverfault: ssh-keygen -R [hostname] ssh-keygen -R [ip_address] ssh-keygen -R [hostname],[ip_address] ssh-keyscan -H [hostname],[ip_address] >> ~/.ssh/known_hosts ssh-keyscan -H [ip_address] >> ~/.ssh/known_hosts ssh-keyscan -H [hostname] >> ~/.ssh/known_hosts

Posted in EC2, Programming, Uncategorized, UNIX/Linux | Leave a comment

Python things

How to remove a package using easy_install? sudo easy_install -m [package_name] How to start ipython notebook with interactive pylab capabilities? ipython notebook –pylab inline

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

Mounting memory card on Ubuntu

sudo fdisk -l sudo mount -t vfat /dev/mmcblk1p1 /media/external

Posted in Bash, UNIX/Linux | Leave a comment