pdfnup --landscape --nup 2x2 --frame true --no-tidy --delta '5mm 5mm' --scale 0.95 input.pdf
Wednesday, 11 June 2014
Print four beamer slides per sheet
Saturday, 22 February 2014
Clean up filled up partitions in Linux: mount subdirectories elsewhere
/ 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 linetmpfs /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
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?
/etc/apache/sites-available
you have directives such as
AllowOverride None
Change them to
AllowOverride All
and try again.
Tuesday, 6 March 2012
Tuesday, 30 August 2011
Sending UTF-8 mail with PHP
mb_internal_encoding("UTF-8");
mb_send_mail( 'myrecipient@wherever.com', 'Polite subject', $message, $headers );
Sunday, 26 June 2011
Apache module modwsgi 3.3 on Ubuntu Lucid
root@virt251:/tmp# dpkg -i libapache2-mod-wsgi_3.3-2+b2_i386.deb
...
dpkg: dependency problems prevent configuration of libapache2-mod-wsgi:
libapache2-mod-wsgi depends on libpython2.7 (>= 2.7); however:
Package libpython2.7 is not installed.
dpkg: error processing libapache2-mod-wsgi (--install):
dependency problems - leaving unconfigured
Errors were encountered while processing:
libapache2-mod-wsgi
You cannot install Python 2.7 (easily, at least) on Lucid, but you can install Python 3.1. Use
apt-get and that will do the trick.
Friday, 3 June 2011
Automatic creation of regular expressions in different computing languages
Wednesday, 4 May 2011
Modifying Xubuntu application menu
settings submenu with duplicated entries: many already appeared in the system submenu.So I edited the file
/etc/xdg/menus/xfce-applications.menu and changed the section
<Menu>
<Name>Settings</Name>
<Directory>xfce-settings.directory</Directory>
<Include>
<Category>Settings</Category>
</Include>
<Layout>
<Filename>xfce-settings-manager.desktop</Filename>
<Separator/>
<Merge type="all"/>
</Layout>
<Menu>
<Name>Screensavers</Name>
<Directory>xfce-screensavers.directory</Directory>
<Include>
<Category>Screensaver</Category>
</Include>
</Menu>
</Menu>
into
<Menu>
<Name>Settings</Name>
<Directory>xfce-settings.directory</Directory>
<Include>
<Category>Settings</Category>
</Include>
<Exclude>
<Or>
<Category>System</Category>
</Or>
</Exclude>
<Layout>
<Filename>xfce-settings-manager.desktop</Filename>
<Separator/>
<Merge type="all"/>
</Layout>
<Menu>
<Name>Screensavers</Name>
<Directory>xfce-screensavers.directory</Directory>
<Include>
<Category>Screensaver</Category>
</Include>
</Menu>
</Menu>
This is a simple example of what can be achieved if you (very carefully) edit the file.
Tweaking Xubuntu application menu
/etc/xdg/menus/xfce-applications.menuand changed the section
into
Settings
xfce-settings.directory
Settings
System
xfce-settings-manager.desktop
Screensavers
xfce-screensavers.directory
Screensaver
Sunday, 10 April 2011
Too many files in a directory hurting performance in Linux?
Apparently,
ls and related utils show a dismaying performance there. So I wanted to check that for myself on my own Linux backup directory on my ext3 external disk, where I store 100.000 files approx. (Note: I keep time stamped copies of my directory structure with hard links to a single directory where I store the actual files so as to avoid data multiplication).True,
ls and ls -lrt are slow, very slow there. However, ls -lrt > /tmp/ls.txt is as fast as you could expect for a 7.5MB file. Also, touch kk and rm kk are as fast as in an empty directory.In summary, standard tools such as
ls and find may not be ready to deal with huge directories. The sorting abilities of ls may scale as bad as O(n^2) in some circumstances. Also, shell expansion (for *, say) may not be very efficient. However, accessing files for creation, editing or deletion may be blazingly fast even in relatively oldish file systems such as ext3 on the cheapest hardware.
Thursday, 10 February 2011
Inserting Google visualizations in Wordpress blogs
I tried to insert a Google visualization into my (other) blog. I run into problems that Google itself solved.
The solution? Use the Custom fields shortcode plugin for Wordpress: first, install and activate it. Then, wherever your visualization goes, insert
[cf]this_is_my_tag_name[/cf]
If your plugin is properly inserted, at the bottom of the page you will see a form with title "Custom fields". Add a new custom field with name this_is_my_tag_name and paste the code for your visualization into the adjacent field.
The plugin will replace your tag with the code you inserted and your visualization will be properly shown in your entry.
Padding text with leading zeros in Teradata
create set table my_table ,no fallback ,
no before journal,
no after journal,
checksum = default
( a integer )
primary index ( a );
insert into my_table select 25;
insert into my_table select 12345;
insert into my_table select 0;
select substr(
'00000' || cast( a as varchar(5) ),
characters( cast( a as varchar(5) ) ),
5 )
from my_table;
The relevant part lies in the use of the functions substr and characters.
Friday, 21 January 2011
A open(er) web 2.0 chaintool
- Less Twitter and more identi.ca
- Less Google and more blekko
- Less Google Maps and more OpenStreetMap
- Less FB and more beer!
Wednesday, 12 January 2011
Table sizes and disk utilization in Teradata
Two typical queries are:
select
vproc,
databasename,
sum(currentperm) / 2**30 as cp,
sum( peakperm ) / 2**30 pp
from dbc.tablesize
group by 1,2;
to find space utilization by AMP and
select
tablename,
databasename,
sum(currentperm) / 2**30 as cp,
sum( peakperm ) / 2**30 pp
from dbc.tablesize
group by 1,2;
to find out the sizes of tables.
Sunday, 9 January 2011
More of git for remote server deployment of webpages
My (minimalistic) vi cheatsheet
set softtabstop=2
set shiftwidth=2
set tabstop=4
set expandtab
Saturday, 8 January 2011
Nice feature of OpenOffice's brush
Thursday, 30 September 2010
Query to select last observation by date for each customer
It would work as follows (in Teradata's SQL dialect):
select
cust_id,
status,
status_date,
row_number() over (partition by cust_id order by status_date desc ) as ranking
from customer_status
qualify ranking = 1;
About Me
- cjgb
- Madrid, Spain
- Powered by datanalytics