http://goo.gl/OEqP4 - bancomicsans.com
http://goo.gl/7ODpL - bbc article

http://goo.gl/OEqP4 - bancomicsans.com

http://goo.gl/7ODpL - bbc article

(local and remote) port forward with iptables

packets sent to 5680 will be forwarded to 80

enable port FW for external communication

iptables -A PREROUTING -t nat -p tcp —dport 5680 -j REDIRECT —to-port 80

enable port FW for internal communication

iptables -t nat -A OUTPUT -p tcp  —src 0/0 —dst 127.0.0.1 —dport 5680 -j REDIRECT —to-ports 80


suspend your ubuntu linux if it’s inactive and nobody’s listening music on it

First you need a script which can suspend your machine from the command line:

me@kv-laptop:~$ cat /usr/bin/power-cmd
#!/bin/bash
#    gnome-power-cmd replacement
#    Copyright (C) 2009 A. Bram Neijt <bram @neijt.nl>
#    This program is free software: you can redistribute it and/or modify
#    it under the terms of the GNU General Public License as published by
#    the Free Software Foundation, either version 3 of the License, or
#    (at your option) any later version.
#
#    This program is distributed in the hope that it will be useful,
#    but WITHOUT ANY WARRANTY; without even the implied warranty of
#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#    GNU General Public License for more details.
#
#    You should have received a copy of the GNU General Public License
#    along with this program.  If not, see http ://www.gnu.org/licenses.

case $1 in
suspend)
echo Suspending
    dbus-send —print-reply \
        —system \
        —dest=org.freedesktop.UPower \
        /org/freedesktop/UPower \
        org.freedesktop.UPower.Suspend
;;
hibernate)
echo Hibernating
    dbus-send —print-reply \
        —system \
        —dest=org.freedesktop.UPower \
        /org/freedesktop/UPower \
        org.freedesktop.UPower.Hibernate
;;
*)
echo Not supported command: ‘”’$1’”’
echo Usage: $0 ‘<suspend |hibernate>’
exit 1
;;
esac

Then you need a script which records music player status (I use Audacious and Radiotray):

me@kv-laptop:~$ cat .bin/paactivity
#!/bin/bash

export DISPLAY=:0

pacmd list-clients | egrep -i “radiot” > /dev/null
RADIO=$?
audtool2 playback-playing
AUDA=$?

echo “radio: $RADIO auda: $AUDA” > /tmp/lastrun


if [ $AUDA -eq 1 ] && [ $RADIO -eq 1 ];
then
    rm /tmp/.active-audio
else
        touch /tmp/.active-audio
fi

You have to put this sctipt into your crontab. (crontab -e -> */2 * * * *  /path_to/paactivity)

Then you need to start xautolock at login (apt-get install xautolock):

me@kv-laptop:~$ cat .bin/inactivity
#!/bin/bash

exec xautolock -time 8 -locker “if [ ! -e /tmp/.active-audio ] ; then /usr/bin/power-cmd suspend; fi”

And finally you need to configure Gnome to start this at login, (Settings/Preferences/Startup Applications/New -> /path_to/inactivity).

PostgreSQL vs. Windows 2003 Server

Working with Postgres is always fun — it has soul.

I had to fix recently a broken PostgreSQL install on a Windows 2003 Server. I don’t really know how it was installed, but I was told that according the Postges forums, it has know issues:

The install fails with ‘error reading file %path%\postgresql.conf’. It doesn’t write to anything in the postgresql data directory or create the postgresql service. We have made postgres user Administrator, explicitly given it full control permissions to temp directories, ownership to the install directory, installed when logging on as the postgres user. We last tried to create the service manually, and even that fails: service is created but will not run.

When I logged in to the system the first suspicious things was that we had two data directories [Drive:]\PostgreSQL\8.4\data and [Drive:]\PostgreSQL\data — of course one of them wasn’t necessary.

The solution was:

  1. update D:\PostgreSQL\8.4\pg_env.bat with the right data directory (I coosed [Drive:]\PostgreSQL\data, didn’t know what was the default)
  2. update D:\PostgreSQL\8.4\scripts\serverctl.vbs with the right data directory
  3. register the Windows service: [Drive:]\PostgreSQL\8.4\bin>pg_ctl.exe register -N postgresql-8.4 -D [Drive:]\PostgreSQL\data
  4. finally I had to re-init the DB as well: [Drive:]\PostgreSQL\8.4\bin>initdb.exe -D d:\PostgreSQL\data

That’s all folks!

Image credits

not bad &#8212; via konzanarch

not bad — via konzanarch

stuff for lucid (reblogs)

elementary nautilus (via lifehacker): this makes it a bit easier to use

sudo add-apt-repository ppa:am-monkeyd/nautilus-elementary-ppa
sudo apt-get update && sudo apt-get upgrade

ubuntu tweaks:  this is almost windoz

sudo add-apt-repository ppa:tulatrix/ppa
sudo apt-get update && sudo apt-get install ubuntu-tweak

shotwell (via fedora 13): this one looks promising

sudo apt-get install shotwell