Wednesday, February 10, 2010

List installed packages sorted by date/size in FreeBSD

For tcsh:

alias pkg.size 'pkg_info | awk '\''{print $1}'\'' | xargs pkg_info -sQ | sort -n -t: -k2 -r | awk -F: '\''{printf("%12s\t%s\n", $2, $1)}'\'' '
alias pkg.date 'ls -ltT /var/db/pkg/*/+CONTENTS | sed -E "s/.*(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)(.+)\/var\/db\/pkg\/(.+)\/\+CONTENTS/\1\2\3/"'

Resize your browser window if you can't see the end of the lines. Pay attention to all quotes in 2 lines above, otherwise aliases may not work.

Then, for example, you can print package list sorted by size:

% pkg.size
   277980976    jdk-doc-1.6.0.10
   158015255    diablo-jdk-1.6.0.07.02
         ...
        2226    bigreqsproto-1.0.2
        1815    font-micro-misc-1.0.0

Or print package list sorted by installed date:

% pkg.date
Feb  9 10:46:06 2010 firefox-3.6,1
Feb  9 08:35:54 2010 inn-2.4.6_1
...
Jan  8 04:48:58 2009 pkg-config-0.23_1
Jan  8 04:48:57 2009 kbproto-1.0.3

Not a big deal but still useful.

Friday, February 5, 2010

The answer to The Quiz from PragPub #8

Зашифрованный код на ст. 37 журнала--кусок программы ELIZA переписанной на Lua.

Расшифровщик на Ruby 1.9 можно взять отсюда.

Картинка процесса:

687 KB