Monday, 15 June 2009

Searching for tabs with grep

I was trying to search for an integer number, which had tabs after is
i.e grep 300 and it would come up with something like
300 -0.0137598 -0.00228325 0.930859 0.932037 -1.04561e+27 -1.73505e+26 7.07363e+28 7.08259e+28 -0.0129162 -0.00224769 0.874459 0.875568 0.00575037 0.00194563 -0.395375 0.396846 1.46282e+24
450 -0.00449249 -0.00663059 0.858427 0.869783 -3.41386e+26 -5.03861e+26 6.52322e+28 6.60951e+28 -0.00415084 -0.00613002 0.795084 0.805603 0.00124869 0.00187794 -0.257016 0.262097 1.46282e+24
etc....


i.e. where there is 300 within any number. To search for 300 i used
grep 300[[:space:]]

Friday, 22 May 2009

Wireless with Linux

This link shows how it is set up using the gnome GUI network manager

http://www.york.ac.uk/services/cserv/net/wireless/help/naslinuxnew.html

Thursday, 2 April 2009

Getting xorg to recognise two GPU's

In Ubuntu 8.10, after installation of the nvidia driver, xorg is unable to decide which card to use. To fix this, login in to a terminal, and then type

sudo lspci grep VGA

On my machine this gave the following output:
02:00.0 VGA compatible controller: nVidia Corporation Device 05e2 (rev a1)
04:00.0 VGA compatible controller: nVidia Corporation Device 05e2 (rev a1)

So to get the xserver working, you need to add the following line oin the device section of /etc/X11/xorg.conf:

Section "Device"
Identifier "Configured Video Device"
Busid "PCI:2:0:0"
Driver "nvidia"
EndSection

Then run:

sudo service gdm restart

to get the xserver working as normal.

Tuesday, 31 March 2009

Bash extract function

Extract function for bash. Put in .bashrc


function extract() # Handy Extract Program.
{
if [ -f $1 ] ; then
case $1 in
*.tar.bz2) tar xvjf $1 ;;
*.tar.gz) tar xvzf $1 ;;
*.bz2) bunzip2 $1 ;;
*.rar) unrar x $1 ;;
*.gz) gunzip $1 ;;
*.tar) tar xvf $1 ;;
*.tbz2) tar xvjf $1 ;;
*.tgz) tar xvzf $1 ;;
*.zip) unzip $1 ;;
*.Z) uncompress $1 ;;
*.7z) 7z x $1 ;;
*) echo "'$1' cannot be extracted via >extract<" ;;
esac
else
echo "'$1' is not a valid file"
fi
}

Friday, 27 March 2009

epstopdf

It's epstopdf joe not eps2pdf

Fixing backspace on edred vim

To fix the backspace key on the vim on edred add this to .vimrc

set backspace=indent,eol,start

Thursday, 26 March 2009

latex figures

To get rid of strange behaviour in latex where it does weird things with figure numbers its has to be done in a strict order.

\begin{figure}
\begin{center}
\includegraphics{...}
\end{center}
\caption{...}
\label{...}
\end{figure}

I think caption can go above \begin{center} but it must be outside of the centre section