Category Archives: Uncategorized

Switching back and forth between tabs and spaces for Python indentation

It seems that majority of python developers prefer using 4 spaces for indentation. However, some people still like using tabs. I am using python.vim script written by Eric Mc Sween. The file stays in .vim/indent directory. There is a line … Continue reading

Posted in Uncategorized | 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

Interview questions on Perl

What is the difference between my and local? my creates a new variable; local temporarily amends the value of a variable. Example: “local temporarily changes the value of the variable, but only within the scope it exists in.” Use my … Continue reading

Posted in Interview, Perl, Programming, Uncategorized | Leave a comment

Get a notebook! :)

Just want to summarize good tips for using a notebook found here: Use one book for all your notes Take your notebook everywhere  Avoid using white out or ripping out pages! Hand-write notes Re-read your notes

Posted in Uncategorized | Tagged , , | Leave a comment

Using Selenium with Python for Web Crawling

This is work in progress. Selenium can be used as emulated web browser. PyVirtualDisplay emulates display. This 2 together can be used to get information from web sites. Installation on Ubuntu: sudo easy_install Selenium Install dependencies for PyVirtualDisplay on Ubuntu: … Continue reading

Posted in Uncategorized | Leave a comment

Sorting Algorithms

Work in progress. Almost all are from Wikipidia: Quicksort is often faster in practice than other algorithms. The steps are: Pick an element, called a pivot, from the list. Reorder the list so that all elements with values less than … Continue reading

Posted in Uncategorized | Leave a comment