Set the proxy for GNOME

I like surfing with Epiphany over the bloated Firefox but it doesn't provide a setting dialog for the proxy. It is configured system wide with gconf. A nice editor to have a quick look at the settings is gconf-editor and once you know what to set you can use the command line tool gconftool-2.

Here is a script to switch the proxy on/off with an optional host and port.

#! /bin/sh
# Switches the GNOME proxy on/off and
# can take an optional proxy host+port

usage ()
cat << CAT
Usage: `basename $0` on|off [host [port]]
exit 1

[ $# -lt 1 ] && usage

case "$1" in

gconftool-2 -t string -s /system/proxy/mode "$mode"
[ ! -z "$2" ] && \
gconftool-2 -t string -s /system/http_proxy/host "$2"
[ ! -z "$3" ] && \
gconftool-2 -t int -s /system/http_proxy/port "$3"

As usual you can follow the changes at mykey57.free.fr/pub/misc/bin/.


MPD repeat track

I have written a Shell script to repeat the current track of MPD. The daemon doesn't provide this feature because it isn't seen as necessary, however I love (sometimes) to stick with the same song. Most people will suggest you to run mpc crop && mpc repeat on && mpc play ^_^, but that kills you playlist and I really want to avoid it.

There are two scripts, one to repeat the track when it has to be done, and a daemon which restarts the repeat process if the user changes the current track. Note: the daemon doesn't take care if you seek in the track, so... if you had like to repeat the same track and seek into it just hack the script and why not leave a comment with your modifications.

The repeat script

# Repeat the same track

function repeat ()
min=`mpc|head -2|tail -1|awk '{print $3}'|cut -d: -f1`
sec=`mpc|head -2|tail -1|awk '{print $3}'|cut -d: -f2`
tmin=`mpc --format %time%|head -1|cut -d: -f1`
tsec=`mpc --format %time%|head -1|cut -d: -f2`
sleep $(( ($tmin*60+$tsec) - ($min*60+$sec) )) && mpc prev && repeat


The daemon

# Daemon which takes care of restarting the repeat process
# if the user changes the current track

function restart ()
killall mpd-repeat-track.sh


while sleep 2
current=`mpc|head -1`
last=`cat $file`
echo $current > $file
[ x"$current" != x"$last" ] && restart

Now run mpd-repeat-trackd.sh and it will just work<tm>.

You can follow the changes here:

Old links:


Deactivate PHP for a container

Since I have set up a File-center on my web server, I never thought about deactivating PHP for the public folder. Now it is done and it is a one line directive. Run "echo SetHandler send-as-is > /to/your/root/public/folder/.htaccess".