Wednesday, March 15, 2017

Load a vimrc from the web

You spend a lot of time configuring your vimrc, and now that you are sitting working in other computer and you can stand working without your predetermined vim configuration!.

But you can start vim with a specific configuration file. In this example,
we consider a vimrc file hosted on the web (github).

The command is:
$ vim -Nu <(curl url -k)

For example:
$ vim -Nu <(curl -k)


Wednesday, July 13, 2016

Installing Google Test

Google test is a framework for unit testing in c++.
For more information watch this video

$ git clone
$ cd googletest
$ make
$ sudo cp -a include/gtest /usr/include
$ sudo cp -a /usr/lib/
$ sudo ldconfig -v

And now compile any program that uses Google test with '-lgtest' flag.


Friday, June 24, 2016

Create a file with random numbers

Sometimes we need to create a file that contains several random numbers. Using bash programming we can do that very quickly. Example,

mycomputer ~% for i in {1..1000}; do echo $RANDOM; done >> nums.txt

This command executes a for loop 1000 times, prints the random variable $RANDOM and redirect the output to the file nums.txt

Print a random integer in the bash console

If you need a random positive integer, you can print the variable $RANDOM. For example:

mycomputer ~% echo $RANDOM

Saturday, April 25, 2015

Replace a string in several files

You need to replace a string in several files

There several options to do this, 
  • sed:         Syntax:    $ sed -i "s/old_string/new_string/g" files
                    Example  $ sed -i "s/foo/bar/g" *.txt 
  • perl:       Syntax:    $ perl -i -p -e "s/old_string/new_string/g;" files  

sed man page 

Monday, August 25, 2014

Managing your latex bib files in linux II

You want a program to manage your Latex bibliography file.
Jabref  is a really good program to organize and modify your bib files in Latex using a very friendly GUI. Also this program can generate  automatically the key for the bib entries and you can include the link to your pdf files.

To install it, we can use the package in Debian's repository
# aptitude install jabref


Synchronize a folder outside the default Dropbox's directory

You want to synchronize a folder with Dropbox, without move that folder to
the default  Dropbox's directory
Create a symbolic link from the folder that you want to synchronize to the Dropbox directory, for example

$ ln -s /path/to/folder/to/sync ~/Dropbox

The permissions of the files or folders should be (at least) owner:r/w, group r/w, and others: r