Tue, 24 Aug 2010

Pretty list of database and table sizes with PostgreSQL

A very handy way to estimate the on-disk size of your databases in PostgreSQL:

> SELECT datname,pg_size_pretty(pg_database_size(datname)) FROM pg_database;
    datname    | pg_size_pretty
---------------+----------------
 template1     | 4144 kB
 template0     | 4144 kB

And the same for individual tables:

> SELECT tablename,pg_size_pretty(pg_total_relation_size(tablename))
    FROM pg_tables WHERE schemaname NOT IN ('information_schema','pg_catalog');

         tablename          | pg_size_pretty
----------------------------+----------------
 django_content_type        | 40 kB
 django_session             | 152 kB
 django_site                | 24 kB

Now go and bug your application developers to save your resources.

posted at: 10:18 | path: /unix | permanent link to this entry

Thu, 25 Feb 2010

Pyblosxom plugin to render Bibtex files as entries

Here is a small module to render the contents of Bibtex (.bib) files as Pyblosxom entries. The plugin is called bib.py and has no configuration. Just put it in your plugins folder, activate it in the config.py file and drop a bibtex file in your entries folder. It will create an unordered list, sorted by last name of the first author and year by default, which can be customized either directly in the source or via a CSS file. The plugin requires the Python bibtex module, available either from your nearest Debian mirror or the Pybliographer distribution.

The title of the entry will either be derived from the filename or from a special Bibtex @title entry:

@TITLE{KeyDoesNotMatter,
        title={Blog entry title}
}

See the result of my RF MEMS specific bibliography and my personal bibliography.

posted at: 11:53 | path: /unix | permanent link to this entry

Tue, 02 Feb 2010

Debian: List installed packages by size with dpkg

$ dpkg-query -W --showformat='${Installed-Size;10}\t${Package}\n' \
   | sort -k1,1n | tail -n 20 

posted at: 11:26 | path: /unix | permanent link to this entry