Adding code highlighting to VIM in Snow Leopard

Open a Terminal and and enter these commands to open vim’s configuration file:


cd /usr/share/vim
sudo vim vimrc

Press the ‘i‘ key to switch vim to Insertion Mode, then enter these lines below the ‘set backspace=2‘ line:


set ai " auto indenting
set history=100 " keep 100 lines of history
set ruler " show the cursor position
syntax on " syntax highlighting
set hlsearch " highlight the last searched term
filetype plugin on " use the file type plugins
" When editing a file, always jump to the last cursor position autocmd BufReadPost *
\ if ! exists("g:leave_my_cursor_position_alone") |
\ if line("'\"") > 0 && line ("'\"") <= line("$") |
\ exe "normal g'\"" |
\ endif |
\ endif

Press the Escape key to take vim out of Insertion Mode, then press ‘:‘ (colon) followed by ‘x‘ to save the file and exit. Enter this command again:


sudo vim vimrc

… and you’ll see that vim now automatically indents code, displays the cursor position, has syntax highlighting, etc.

Information taken from here.

Recover Previously Deleted File on an NTFS partition (even from Trash) on UBUNTU

Use “ntfsundelete”. A usefull way is to copy the output of its search in a file, like this


~/temp$ sudo ntfsundelete /dev/sda6 -S 10k-1m -p 100 --> list.txt

where sda6 is the drive of interest previously unmounted. Here we searched for files between 10kb and 1mb big, that are 100% recoverable. Then in the list we look for the inode number we are interested in (relative to the filename, size, etc), and to recover it we do


~/temp$ sudo ntfsundelete /dev/sda6 -u -i 1039 -o 33.txt -d ~/temp

1039 is the inode number, 33.txt is the output number and ~/temp is the output folder.

Running Mathematica scripts directly from the Unix shell

1) Select cells with pretty expressions within the Mathematica Notebook and click Cell > Convert to > InputForm

2) Cut and paste the resulting inputform code into a textfile, e.g. script.m.

3) Repeat 1)-2) as needed.

4) Terminate textfile with:  Exit[]

5) Execute script from the command line prompt with:
~$ MathKernel -noprompt -run “<<script.m”

Ubuntu DSL

At the command prompt in the terminal enter the following command:

sudo pppoeconf


Once configured, the DSL connection is established using the pon utility. To establish the connection, execute the following command from a terminal window:

sudo pon dsl-provider

The poff utility is used to close the connection to a DSL provide. To break the connection run the following command:

sudo poff