Sunday, August 12, 2012

Reconnect an ejected USB HDD in a Mac

Sometimes you realize that a file that you need is in an external USB HDD that you just ejected. Of course the external USB is still connected to your USB port. So what would you do to make the USB HDD reappear in your connected drives? Of course, you can physically disconnect the external USB HDD and re-plugin it. But that sounds stupid because the device is already connected to your machine. Just open a terminal and first find out what is the number of your disk by,

$ diskutil list

This will list up all your disk. Let us assume the external USB HDD that you want to reconnect is disk1 (by the way your inbuilt HDD will be disk0), do the following,

$ diskutil mountDisk disk1
Thats it! No more physical unplugging and replugging... 

Sunday, August 5, 2012

Checking the site-packages

If you want to know where the python site-packages directory is located in your machine do the following.


from distutils.sysconfig import get_python_lib
print(get_python_lib())


Saturday, July 28, 2012

Adding and a flag when process has completed

Here are the details

with bash shell do
ping -c 5 www.google.com && tput bel
with fish shell do
ping -c 5 www.google.com ; tput bel 

Saturday, June 2, 2012

Ordering among citations in a multiple citation in Bibtex

It is possible to arrange multiple references within the same brackets by doing \cite{paper1,paper2} instead of \cite{paper1}\cite{paper2}. The former will produce for example [1,2] and the latter will produce [1][2]. The former approach is considered better.

However, sometimes the ordering among the citations within a multiple citation might not come right. For example, \cite{paper1,paper2} might produce [2,1] instead of [1,2]. Here again, it is considered better to order citations in a multiple citation according to the order they appear in the references list. To make sure they are ordered as such add \usepackage{cite} in the preamble of your latex source file.

Saturday, May 26, 2012

Mounting and Unmounting ISO files in Ubuntu

Create a directory first.

$mkdir /home/myusr/example

Mount the iso by,

$sudo mount -o loop filename.iso /home/myusr/example
This will mount the ISO file to the created directory.
To unmount do,
$sudo umount /home/myusr/example 


Monday, September 19, 2011

TexShop coloring

From version 3.06 (Lion) it is possible to have different background and foreground colors in TexShop.

You can select the background colors from Preference dialog box. However, other colors must be
specified at command line.

defaults write foreground_R 1
default write foreground_B 1
default write foreground_G 1
will make the font color to white.

The background color can be changed from TexShop Preferences window.

defaults write TexShop commandblue 1
defaults write TexShop commandred 0
defaults write TexShop commandgreen 1
will make the command color to cyan.

To change the cursor color to white do
defaults write TexShop insertionpoint_R 1
defaults write TexShop insertionpoint_G 1
defaults write TexShop insertionpoint_B 1

defaults write TexShop commentred 0
defaults write TexShop commentblue 0
defaults write TexShop commentgreen 1
will make the comment color to lime green.

These are RGB decimal color codes. To obtain those values divide RGB colors from 255.
Here is a list of RGB colors.

TexShop documentation where these color preferences are mentioned can be seen here.

Continuously monitor GPU usage

 For nvidia GPUs do the follwing: nvidia-smi -l 1