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 extension stores cookies and keeps you authenticated so that you don’t have to to type username and password again and again when connecting via https.
sudo easy_install nose
sudo pip install nose
By default nose finds all directories and files that match the following regular expression:
I usually create a file test_something.py and place my unit tests there as regular functions, e.g.:
To run tests in specific file do:
To run all tests in files satisfying regex above:
By default, nose will capture all output sent to stdout. To be able to see print statements inside test functions use –nocapture option.
I usually run all tests by:
nosetests --nocapture -v
nosetests --nocapture -v -w path_to_folder
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:
join -t "," <(sort file_1.csv) <(sort file_2.csv) > result.csv
-t option specifies a delimiter.
Both files must be sorted in the same order on the key value.
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
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
You are in the room with n computers. Some of them are good, and some of them are bad. You can query any computer about the status of any computer in the room. Good computers will always tell you the truth. Bad computers can answer anything. You also know that there are more good computers in the room than bad ones. How will you find a good computer in the room, and how many queries will you need?
The idea is to construct a sequence of queries that produce the sequence of answers of the form “good -> good -> good … -> good”. We should be able to do so because we know that there are more good computers in the room than bad ones. After we queried all computers in the room and are left with this chain, we know that there is some good computer in the chain. Therefore, the last computer will be good. To be concrete, we can go as follows:
Pick any computer and query it about the status of some other computer. If it answers “good” – add it to the back of the chain; if it answers “bad” – discard both and don’t query them any more. Pick another computer and query it about the status of the last computer in the chain (if the chain is empty pick any computer that has not been discarded before). If it answers “good” – add it to the back of the chain; if it answers “bad” – discard it along with the last computer in the chain (so that chain shrinks by one in this case). Keep doing it. Your chain is guaranteed to be non-empty after all computers are queried because you always discard as many bad computers as good ones.
The number of queries required is n – 1.