Wednesday, 11 June 2014

Print four beamer slides per sheet

Of course, on Linux CLI:
pdfnup --landscape --nup 2x2 --frame true --no-tidy --delta '5mm 5mm' --scale 0.95 input.pdf

Saturday, 22 February 2014

Clean up filled up partitions in Linux: mount subdirectories elsewhere

I have two major partitions in my Linux box: / and /home. My root partition was getting dangerously crowded and I got a "disk full" error a number of times.

I had the following idea: mount some large subdirectory from / in /home. In particular, I decided to move there my /usr/local/lib/R/site-library directory (R packages, in the order of 1GB).

Here is how I did it. First, I moved move the required directories:
su -
cd /usr/local/lib/R/
mv site-library /home

Then, I edited the /etc/fstab file adding the line

tmpfs /tmp tmpfs defaults,noatime,mode=1777 0 0

to it in order to persist the changes. (Mind that the spaces are actually tabs).

Finally, I ran

mount -a

Friday, 15 November 2013

Get better performance and life from your SSD in Linux-based systems

I recently purchased a new laptop which came with a 24GB SSD disk. In order to get the most of this technology and prevent unnnecessary writes (which affects the longevity of these systems) I kind of followed the superb advice given at Get better performance and life from your SSD in Linux-based systems.

In particular, I mounted the /home directory in the tradicional HD and moved temporary directories (e.g., /tmp) to RAM.

Works as a charm!

Friday, 9 November 2012

Google link converter

Links provided in the search results of Google look something like
http://www.google.co.uk/url?sa=t&source=web&cd=1&ved=0A&url=http%3A%2F%2Fabc.go.com%2F&rct=j&q=abc&ei=kuw&cad=rja
when the URL it links to is simply
http://abc.go.com/
This tool allows users to transform the former into the later for easier copying and pasting.

Monday, 30 July 2012

Apache ignoring mod_rewrite rules?

Then it is very likely in the site configuration file, usually at
/etc/apache/sites-available 
you have directives such as
AllowOverride None 
Change them to
AllowOverride All 
and try again.

Tuesday, 6 March 2012

Unique rows in vim

Simple! Just

:sort u

Tuesday, 30 August 2011

Sending UTF-8 mail with PHP

I was facing issues sending mail encoded as UTF-8 via PHP. In order to do it properly, you need to set UTF-8 as the encoding for the mail function (first line of code below). Then, mail can be sent (second line).

mb_internal_encoding("UTF-8");
mb_send_mail( 'myrecipient@wherever.com', 'Polite subject', $message, $headers );