Thursday, November 22, 2012

Converting jpeg to pdf with lower quality

Convert jpeg into PDF with 50% quality:

$ convert -quality 50 file1.jpg file.pdf


Combine multiple file into PDf

$ pdftk *.pdf cat output merged.pdf
or
$ pdftk file1.pdf file2.pdf cat output merged.pdf

You need to have imagemagick and pdftk installed on your system.

If you have multiple files to convert, use the following command on bash:


$ for i in *.jpg; do convert -quality 50 -resize 60% "$i" "${i%.jpg}.eps"; done


Changing resolutions in DPI

$ convert -units PixelsPerInch pic1.png -density 300 pic1.jpg
$ identify -verbose pic1.jpg | grep Resolution
Resolution: 300x300


Converting from PDF to eps 

$ pdftops -eps input.pdf output.eps

Wednesday, November 21, 2012

File Synchronization over Network using Unison

Unison is great tool for synchronizing files over network. Earlier I used rsync for file-synchronization. Unison at least provides one level of comfort over rsync which requires quite a bit of customization. If you want to use Unison to synchronize files between two systems over a network, then please refer to the following links:

http://www.howtoforge.com/setting-up-unison-file-synchronization-between-two-servers-on-ubuntu-11.10

This worked for me on Ubuntu 12.04 LTS 64-bit version and I managed to do everything mentioned on this page. One more thing, you don't need to use the root login for executing the steps.

If you need to delete the several profiles already created on Unison, you should go to ~/.unison folder and delete the corresponding .prf files. It is not possible to delete profiles using GUI.

Sunday, October 14, 2012

GNUPlots Loops


It is possible now to use 'loop's within the GNUPlot Command. See this link for more details.

The following commands plots 10 blocks with different colours. Remember each block is separated from the other block by a pair of double lines.

gnuplot> plot for [i=0:9] './clusterpos.txt' index i u 1:2 w p



Thursday, October 4, 2012

APT Behind Proxy Server Ubuntu 12.04


This worked for me on Ubuntu 12.04


Create a new file as shown below:

$ sudo gvim  /etc/apt/apt.conf.d/02http-proxy

and enter the following line:

Acquire::http::Proxy "http://username:password@proxy.tcs.com:8080";



Save the file and run

$ sudo apt-get update 

It should work for you.

One more thing, if your password contains '@' character, then you need to replace it with '%40' in your password.