Pages

Sunday, September 30, 2012

Scaling a pdf file from A3 to A4

This is just a quick tip for converting a pdf file from one pagesize to another.
By using the command convert this is easily achieved.

This is the quickest way I've found to do this:


convert -page a3 infile.pdf -page a4 outfile.pdf

The outfile.pdf should now be sized as an A4 page.
The command is as follows: convert [input file options] infile.pdf [output file options] outfile.pdf

Of course it is possible to convert to and from other sizes as well.

Sunday, September 23, 2012

SSH without password prompting

Usually while working on different computers I am using SSH. Being prompted for a password is not a favourite of mine, so I set up my computers to connect without needing a password. It's easier than you think.

Tuesday, September 11, 2012

Free E-books

Just a quick tip for everyone who likes to learn more.
At BookBoon.com you'll find a few good pdf-books free to download.


As always there is a small cath; there are a few adverts in these books.

Thursday, August 16, 2012

Password prompt via ssh

Sometimes when working with ssh you want to run a command that require root privileges on the remote host.
For instance when running apt-get install.

The trick is then to add the -t option to ssh so you get to write the remote host password.
Like this:
ssh -t example.com "sudo apt-get install nmap"


Without the -t option you would get the following error:
sudo: no tty present and no askpass program specified



Saturday, August 11, 2012

Making an A5 book from a pdf-file

Here's how to create an A5 book from a pdf file. This procedure can be done by creating a script that runs through the needed steps automatically. I'll see if I will do that later. But here is the necessary steps to do this manually.

The mission is to print a folder on A4 paper, and fold it into a book.

  1. Calculate:  (number of pages \ 4) + 1 = Sheets  (This is needed as the -s parameter in the psbook-command. If the original document has 9 pages then we need to use the following calculation: (9 \ 4)+1 = 2 + 1 = 3)  2 sheets will hold 8 pages which is one page less than the document. 3 sheets will hold 12 pages and is more than the document.
  2. Convert the original file to a .ps-file:  pdftops original.pdf new_original.ps
  3. Create the pages in the book: psbook -s3 new_original.ps new_original_book.ps   (Refer to step 1 for info about -s3 parameter)
  4. Reorder the pages using psnup: psnup -l -n2 new_original_book.ps new_original_folder.ps  (Parameter -l is to print in landscape, and -n2 is to place 2 pages on each page.)
  5. Convert back to pdf-format: ps2pdf new_original_folder.ps folder.pdf
  6. Remove temporary files: rm new_original_*

After we have printed the book; the pages should come sequentially as in all books. Fold, staple and deliever you brochure/folder. If the original document is more than 4-5 pages we might want to cut a little in front of the book after we have folded it.

Thursday, August 9, 2012

Encrypted storage


In case you have documents and files you don't want anyone to be able to see there is always the possibility to use truecrypt. Truecrypt will let you use a file or partition as an encrypted storage. It is easy to use and not at all hard to understand. It also supports Linux, Windows and Mac so you can use it on whatever platform you wish.

Truecrypt is no longer safe.
Check their website before using it.

You can even encrypt part of an USB-pendrive and include the files for running the truecrypt program on the USB-drive. This way you will be able to use you USB-device on other computers without needing to install the package on the computer you are working on. (But you will need admin privileges.)

To download TrueCrypt head over to their web-site. Go to the download page and download the package for your platform. After downloading the Linux gzipped tarball you simply extract it and run the truecrypt installation-file.

Step 1:
Run truecrypt to open the GUI for the program and create a new encrypted volume. Using a file is as it can be. Click on Create Volume, select the folder to put the file in, and give it a filename. Follow the instructions to set the encryption, password and any other option.

Step 2:
In the TrueCrypt main window select the slot you want to put your encrypted volume in, click on Select File and navigate to the file you created in the previous step. Click on Mount and type your password for the encrypted filesystem when prompted.

Step 3:
Add files or folders to your encrypted filesystem as you do to any filesystem.

That's all there is to it.
Easy and well functioning way of keeping some documents private.
To use a portable USB-drive check the documentation on TrueCrypt web-site.