viernes, 28 de enero de 2011

PASAR HOJAS DE CALCULO DE OPEN OFFICE CALC A LATEX.


Descargar: calc2latex
http://calc2latex.sourceforge.net/

Instalarlo en openoffice calc:
Abrir el OpenOffice Calc - Ir al Menú Archivo - Abrir.
Pondremos el nombre: calc2latex.
Nos indicara que queremos importarlo.




sábado, 8 de enero de 2011

ROTAR FONDOS CON GNOME Y BASH

# fondorotar.sh
# Por Paco Aldarias
# 8.1.11
# Esta función rota los fondos del escritorio gnome

usuario="/home/paco"
dirfondos="/media/sda5/fotos"

lanzador="$usuario/Escritorio/Fondo.desktop"
icono="pitivi"

fimagenes="/tmp/fimagenes.txt"
ftot="/tmp/ftot.txt"

#***********************
function lanzador
{
echo "#!/usr/bin/env xdg-open" > $lanzador
echo "[Desktop Entry]">> $lanzador
echo "Version=1.0">> $lanzador
echo "Type=Application">> $lanzador
echo "Terminal=false">> $lanzador
echo "Icon[es_ES]=pitivi">> $lanzador
echo "Exec=bash /home/paco/fondorotar.sh">> $lanzador
echo "Name[es_ES]=Fondo $1">> $lanzador
echo "Icon=gparted">> $lanzador
echo "Name=Fondo $1">> $lanzador
}

#***********************
function cambia
{
gconftool-2 -t str -s /desktop/gnome/background/picture_filename $1
#Possible values are "none", "wallpaper" (eg tiled), "centered", "scaled", "stretched"
gconftool-2 -t string -s /desktop/gnome/background/picture_options "stretched"
}

#***********************
function numero
{
num=$1
tema=$(cat $fimagenes | sed -n ${num}L)
cambia "$tema"
lanzador "$tema"
}

#***************** MAIN

# Si no existe lo crea
if [ ! -f $fimagenes ]; then
find $dirfondos -iname '*.jpg' -o -iname '*.png' -o -iname '*.svg' > $fimagenes
cat $fimagenes | wc -l > $ftot
fi

# Total de fondos.
tot=$(cat $ftot)

# Numero aleatorio
num=$(($RANDOM%$tot))
numero $num

miércoles, 5 de enero de 2011

ROTAR TEMAS CON UBUNTU GNOME

INTRODUCCIÖN

Si queremos rotar los temas de forma rápida podemos
crear un icono que permita hacer esto rápido.

Si el script se pone en el arranque permitirá
tener un tema diferente cada vez que se arranque.

Una vez crear el archivo debemos ejetutarlo con:
bash rotartema.sh

EL SCRIPT

cat temarotar.sh
ultimo=ultimo.txt
icono="$HOME/Escritorio/Tema.desktop"

function icono
{
echo "#!/usr/bin/env xdg-open" > $icono
echo "[Desktop Entry]">> $icono
echo "Version=1.0">> $icono
echo "Type=Application">> $icono
echo "Terminal=false">> $icono
echo "Icon[es_ES]=gparted">> $icono
echo "Exec=bash /home/paco/temarotar.sh">> $icono
echo "Name[es_ES]=Tema $1">> $icono
echo "Icon=gparted">> $icono
echo "Name=Tema $1">> $icono

}

function cambia
{

gconftool-2 --type string --set /apps/metacity/general/theme $1
gconftool-2 --type string --set /desktop/gnome/interface/gtk_theme $1
if [ -f /usr/share/backgrounds/$1.jpg ];then
gconftool-2 --type string --set /desktop/gnome/background/picture_filename /usr/share/backgrounds/$1.jpg
fi
gconftool-2 --type string --set /desktop/gnome/interface/icon_theme $1
}

function numero
{
num=$1
c=1
for i in $(ls /usr/share/themes/);do
if [ $c -eq $num ];then
tema=$i
valido=$(echo $tema | grep -v "Contrast")
if [ $valido ];then
break
fi
fi


let c=c+1
done

echo "Tema $num $tema"
cambia $tema
icono $tema
}


### MAIN

tot=$(ls /usr/share/themes/ | wc -w)
if [ ! -f $ultimo ];then
echo 1 > $ultimo
fi

num=$(cat $ultimo)

if [ $num -gt $tot ];then
num=1
fi

let num=num+1
echo $num > $ultimo
numero $num

lunes, 3 de enero de 2011

CONTROL ANCHO BANDA CBQ CON UBUNTU Y COLAS

INTRODUCCION

El contexto es una conexión de Ono, conectado a un
router inhalambrico y una red local 192.168.2.0/24

El objetivo es que el servidor Web no se coma
todo el ancho de banda de salida. Y la conexión
remota ssh vaya rápida.


EJECUTARLO:

sudo bash cbq.sh start
[sudo] password for paco:
=================================================
|| CQB. Por Paco Aldarias. 12.1.09.
=================================================
|| CONTROL ANCHO BANDA SALIDA.
=================================================
|| INTERFACES Y REDES
=================================================
|| Interface unico ..............: eth0
|| IP eth0 ......................: 192.168.2.2
|| LAN ..........................: 192.168.2.0/24
|| Velocidad subida inet ........:300kbit
|| Velocidad subida lan .........: 100000kbit
=================================================
|| CONFIGURACION VEL.GARANTIZADA/MAX(CEIL):
=================================================
|| COLA 10 INET : 270kbit/300kbit 33kbytes/37kbytes
|| COLA 20 LAN : 90000kbit/100000kbit 11250kbytes/12500kbytes
|| COLA 30 ICMP : 216kbit/300kbit 27kbytes/37kbytes
|| COLA 40 SSH,ET : 189kbit/270kbit 23kbytes/33kbytes
|| COLA 50 DEFAULT : 162kbit/240kbit 20kbytes/30kbytes
|| COLA 60 SERV.WEB: 54kbit/60kbit 6kbytes/7kbytes
=================================================
|| OTROS r2q/quamtum

=================================================
|| R2QL : 1000
|| R2QLR(Entre 1500-60.000) : 102400
|| QUANTUML : 12800
|| R2QI : 200
|| R2QIR(Entre 1500-60.000) : 1536
|| QUANTUMI : 192
=================================================

EL SCRIPT
cat cbq.sh

#http://www.esdebian.org/foro/9949/mldonkey-paraliza-navegacion

#!/bin/bash

# Aclaracion:
# quantum=rate*1024/8/r2q
# rate/r2q >= quantum
# QUANTUM debe estar entre 1500 (valor del MTU) y 60000 (valor maximo del leaf QUANTUM)
# 100mbit = 12.5 mbyte / r2q = 1.2 Mbyte > 60.000
# Por Paco Aldarias


echo "================================================="
echo "|| CBQ. Por Paco Aldarias. 12.1.09."


########################################
# VARIABLES
########################################

# EN kbits
UPINET=300
UPLAN=100000
DEV=eth0
LAN="192.168.2.0/24"
IP="192.168.2.2"
ALL="0.0.0.0/0"

echo "================================================="
echo "|| CONTROL ANCHO BANDA SALIDA. "
echo "================================================="
echo "|| INTERFACES Y REDES "
echo "================================================="
echo "|| Interface unico ..............: $DEV"
echo "|| IP $DEV ......................: $IP"
echo "|| LAN ..........................: $LAN"
echo "|| Velocidad subida inet ........:${UPINET}kbit"
echo "|| Velocidad subida lan .........: ${UPLAN}kbit"


#Calculamos un 90 % de nuestra tasa de subida
RATEUPINET=$[9*$UPINET/10]
RATEUPLAN=$[9*$UPLAN/10]

RATE10=${RATEUPINET}
RATE20=${RATEUPLAN}
RATE30=$[8*$RATEUPINET/10]
RATE40=$[7*$RATEUPINET/10]
RATE50=$[6*$RATEUPINET/10]
RATE60=$[2*$RATEUPINET/10]

CEIL10=${UPINET}
CEIL20=${UPLAN}
CEIL30=$[10*$UPINET/10]
CEIL40=$[9*$UPINET/10]
CEIL50=$[8*$UPINET/10]
CEIL60=$[2*$UPINET/10]

# http://www.ecualug.org/?q=2006/12/14/comos/como_segmentar_el_ancho_de_banda_de_una_red_con_htb&page=1

# r2q=10 quantum= rate*1024/8/r2q
R2QL=1000
R2QLR=$[${UPLAN}*1024/${R2QL}] # Entre 1500 y 6000
QUANTUML=$[${UPLAN}*1024/8/${R2QL}]

R2QI=200
R2QIR=$[${UPINET}*1024/${R2QI}] # Entre 1500 y 6000
QUANTUMI=$[${UPINET}*1024/8/${R2QI}]

echo "================================================="
echo "|| CONFIGURACION VEL.GARANTIZADA/MAX(CEIL): "
echo "================================================="
echo "|| COLA 10 INET : ${RATE10}kbit/${CEIL10}kbit $[$RATE10/8]kbytes/$[$CEIL10/8]kbytes "
echo "|| COLA 20 LAN : ${RATE20}kbit/${CEIL20}kbit $[$RATE20/8]kbytes/$[$CEIL20/8]kbytes "
echo "|| COLA 30 ICMP : ${RATE30}kbit/${CEIL30}kbit $[$RATE30/8]kbytes/$[$CEIL30/8]kbytes "
echo "|| COLA 40 SSH,ET : ${RATE40}kbit/${CEIL40}kbit $[$RATE40/8]kbytes/$[$CEIL40/8]kbytes"
echo "|| COLA 50 DEFAULT : ${RATE50}kbit/${CEIL50}kbit $[$RATE50/8]kbytes/$[$CEIL50/8]kbytes"
echo "|| COLA 60 SERV.WEB: ${RATE60}kbit/${CEIL60}kbit $[$RATE60/8]kbytes/$[$CEIL60/8]kbytes"

echo "================================================="
echo "|| OTROS r2q/quamtum
"
echo "================================================="
echo "|| R2QL : ${R2QL}"
echo "|| R2QLR(Entre 1500-60.000) : ${R2QLR}"
echo "|| QUANTUML : ${QUANTUML}"
echo "|| R2QI : ${R2QI}"
echo "|| R2QIR(Entre 1500-60.000) : ${R2QIR}"
echo "|| QUANTUMI : ${QUANTUMI}"
echo "================================================="


########################################
# STATUS
########################################

if [ "$1" = "status" ]
then
exit
fi


########################################
# STATUS1
########################################

if [ "$1" = "status1" ]
then
echo "======================================="
echo "|| qdisc"
echo "======================================="

tc -s qdisc show dev $DEV

echo "======================================="
echo "|| class"
echo "======================================="


tc -s class show dev $DEV

echo "======================================="
echo "|| iptables"
echo "======================================="

iptables -t mangle -L MYSHAPER-OUT -n -v
exit
fi

########################################
# STATUS2
########################################

if [ "$1" = "status2" ]
then
watch tc -s qdisc
exit
fi

########################################
# STOP
########################################


# Reset everything to a known state (cleared)
tc qdisc del dev $DEV root 2> /dev/null > /dev/null

iptables -t mangle -D POSTROUTING -o $DEV -j MYSHAPER-OUT 2> /dev/null > /dev/null
iptables -t mangle -F MYSHAPER-OUT 2> /dev/null > /dev/null
iptables -t mangle -X MYSHAPER-OUT 2> /dev/null > /dev/null


if [ "$1" = "stop" ]
then
echo "Shaping removed on $DEV."
exit
fi




########################################
# CONFIGURANDO COLAS
#######################
#################



# Cola padre htb
tc qdisc add dev $DEV root handle 1: htb default 10 r2q $R2QL


#Limitamos el trafico
tc class add dev $DEV parent 1: classid 1:10 htb rate ${RATEUPINET}Kbit ceil ${CEIL10}Kbit burst 6k prio 1 quantum $QUANTUMI #inet
tc class add dev $DEV parent 1: classid 1:20 htb rate ${RATEUPLAN}Kbit ceil ${CEIL20}Kbit burst 6k prio 2 quantum $QUANTUML #lan

# Repartimos el sobrante de ancho de banda equitativamente
tc qdisc add dev $DEV parent 1:10 handle 10: sfq perturb 10
tc qdisc add dev $DEV parent 1:20 handle 20: sfq perturb 10


#Iniciamos iptables
iptables -t mangle -N MYSHAPER-OUT
iptables -t mangle -I POSTROUTING -o $DEV -j MYSHAPER-OUT

###########################
# Marca de paquetes
##########################

# COLA 10. INET

iptables -t mangle -A MYSHAPER-OUT -s $IP ! -d $LAN --j MARK --set-mark 1 # inet
iptables -t mangle -A MYSHAPER-OUT -m mark --mark 1 -j CLASSIFY --set-class 1:10

# COLA 20. LAN.

iptables -t mangle -A MYSHAPER-OUT -s $LAN -d $LAN -j MARK --set-mark 2 # lan
iptables -t mangle -A MYSHAPER-OUT -o lo -j MARK --set-mark 2
iptables -t mangle -A MYSHAPER-OUT -m mark --mark 2 -j CLASSIFY --set-class 1:20


# Clasificamos el trafico de inet

tc class add dev $DEV parent 1:10 classid 1:30 htb rate ${RATE30}Kbit ceil ${CEIL30}Kbit burst 6k prio 3 quantum $QUANTUMI # dns,icmp,router
tc class add dev $DEV parent 1:10 classid 1:40 htb rate ${RATE40}kbit ceil ${CEIL40}kbit burst 6k prio 4 quantum $QUANTUMI # ssh
tc class add dev $DEV parent 1:10 classid 1:50 htb rate ${RATE50}kbit ceil ${CEIL50}kbit burst 6k prio 5 quantum $QUANTUMI # resto
tc class add dev $DEV parent 1:10 classid 1:60 htb rate ${RATE60}kbit ceil ${CEIL60}kbit burst 6k prio 6 quantum $QUANTUMI # www


# Repartimos el sobrante de ancho de banda equitativamente
tc qdisc add dev $DEV parent 1:30 handle 30: sfq perturb 10
tc qdisc add dev $DEV parent 1:40 handle 40: sfq perturb 10
tc qdisc add dev $DEV parent 1:50 handle 50: sfq perturb 10
tc qdisc add dev $DEV parent 1:60 handle 60: sfq perturb 10

# Mldonkey
tc filter add dev $DEV parent 1:10 protocol ip prio 10 u32 match ip tos 0x08 0xff flowid 1:60



########################################
# MARCANDO DE PAQUETES Y ENCOLANDO
########################################

# COLA 30. MAXIMA PRIORIDAD. MAX VELOCIDAD

iptables -t mangle -A MYSHAPER-OUT -p tcp -m tcp --tcp-flags SYN,RST,ACK ACK -s $LAN ! -d $LAN -j MARK --set-mark 3 # MAX PRIORIDAD
iptables -t mangle -A MYSHAPER-OUT -m tos --tos Minimize-Delay -s $LAN ! -d $LAN -j MARK --set-mark 3 # tos
iptables -t mangle -A MYSHAPER-OUT -p icmp -s $LAN ! -d $LAN -j MARK --set-mark 3 # icmp
iptables -t mangle -A MYSHAPER-OUT -s $IP -p udp --sport 27960 -j MARK --set-mark 3 # enemy
iptables -t mangle -A MYSHAPER-OUT -p udp -s $IP --dport 53 -j MARK --set-mark 3 # dns
iptables -t mangle -A MYSHAPER-OUT -m mark --mark 3 -j CLASSIFY --set-class 1:30


# COLA 40

iptables -t mangle -A MYSHAPER-OUT -p tcp -s $IP ! -d $LAN --sport ssh -j MARK --set-mark 4 # ssh
iptables -t mangle -A MYSHAPER-OUT -p tcp -m length --length :64 -j MARK --set-mark 4 # small packets (probably just ACKs)
iptables -t mangle -A MYSHAPER-OUT -m mark --mark 4 -j CLASSIFY --set-class 1:40

# COLA 50

iptables -t mangle -A MYSHAPER-OUT -p tcp -s $IP ! -d $LAN -j MARK --set-mark 5 # Resto
iptables -t mangle -A MYSHAPER-OUT -m mark --mark 5 -j CLASSIFY --set-class 1:50


# COLA 60. MINIMA PRIORIDAD. MIN. VELOCIDAD

iptables -t mangle -A MYSHAPER-OUT -p tcp -s $IP ! -d $LAN -j MARK --sport http --set-mark 6 # www

#f="mltcpdump.txt"
#f="ml-port.txt"
#for i in $(cat $f);do
#if [ $i -gt 1024 ];then
# echo "Marcando $i"
# iptables -t mangle -A MYSHAPER-OUT -p tcp -j MARK --dport $i --set-mark 6 # p2p
# iptables -t mangle -A MYSHAPER-OUT -p udp -j MARK --dport $i --set-mark 6 # p2p
#fi
#done

EDONKEY_PORT=4662
KAD_PORT=8443
OVERNET_PORT=5865
BITTORRENT_PORT=6882
OPENNAP_PORT=9999


iptables -t mangle -A MYSHAPER-OUT -p tcp -j MARK --dport $EDONKEY_PORT --set-mark 6 # p2p
iptables -t mangle -A MYSHAPER-OUT -p udp -j MARK --dport $(($EDONKEY_PORT + 4)) --set-mark 6 # p2p
iptables -t mangle -A MYSHAPER-OUT -p tcp -j MARK --dport $KAD_PORT --set-mark 6 # p2p
iptables -t mangle -A MYSHAPER-OUT -p udp -j MARK --dport $KAD_PORT --set-mark 6 # p2p
iptables -t mangle -A MYSHAPER-OUT -p tcp -j MARK --dport $OVERNET_PORT --set-mark 6 # p2p
iptables -t mangle -A MYSHAPER-OUT -p udp -j MARK --dport $OVERNET_PORT --set-mark 6 # p2p
iptables -t mangle -A MYSHAPER-OUT -p tcp -j MARK --dport $(($EDONKEY_PORT - 1)) --set-mark 6 # p2p
iptables -t mangle -A MYSHAPER-OUT -p tcp -j MARK --dport $BITTORRENT_PORT --set-mark 6 # p2p
iptables -t mangle -A MYSHAPER-OUT -p tcp -j MARK --dport $OPENNAP_PORT --set-mark 6 # p2p

iptables -t mangle -A MYSHAPER-OUT -m mark --mark 6 -j CLASSIFY --set-class 1:60

MLDONKEY SERVER.MET

CREAR EL ARCHIVO: server.met.txt
cat server.met.txt

http://www.descargasbajar.com/emule/server.met
http://users.servicios.retecal.es/ljpadillam/Baltab/server.met
http://ed2k.2x4u.de/3vtom2vk/micro/server.met
http://ed2k.2x4u.de/3vtom2vk/min/server.met
http://ed2k.2x4u.de/3vtom2vk/max/server.met
http://ocbmaurice.dyndns.org/pl/slist.pl/server.met?download/server-best.met
http://ocbmaurice.dyndns.org/pl/slist.pl/server.met?download/server-good.met
http://ocbmaurice.dyndns.org/pl/slist.pl/server.met?download/server-max.met
http://trinit.es/server.met
http://www.linuxpourtous.com/server.met
http://upd.emule-security.net/server.met
http://peerates.net/servers.php

SCRIPT PARA CARGAR SERVIDORES:
#! /bin/bash
# Por Paco Aldarias. v.1.2 06.09.2007

# Acceso
usu="miusuario"
pass="micontrasenya"

host="127.0.0.1"
puerto=4000

# Velocidad
lentoup=5
lentodown=0
rapidoup=11
rapidodown=0

#********************
function exportar
# Ejemplo: dllink ed2k://|file|02-Roma_2.avi|474486784|F1DCFAB73A68F1126AFFDC4E1788B295|/
{
>ml.export
#Cogemos los numero de fichero
num=$(echo -e "auth $usu $pass \n vd\nq" | nc 127.0.0.1 4000 | grep "\[D" | awk '{print $2}' | cut -d"]" -f1)
for i in $(echo $num);do
a=$(echo -e "auth $usu $pass \n vd $i \nq" | nc 127.0.0.1 4000 | grep ed2k | cut -c 10-)
# b=$(echo -e "auth $usu $pass \n vd $i \nq" | nc 127.0.0.1 4000 | grep "Probable" | cut -c 16- )
b=$(echo -e "auth $usu $pass \n vd $i \nq" | nc 127.0.0.1 4000 | sed -n 12L | cut -d"]" -f2)
c=$(echo -e "auth $usu $pass \n vd $i \nq" | nc 127.0.0.1 4000 | awk '/Total/ {print $2}')
echo "ed2k://|file|$b|$c|$a|/" >> ml.export
done
echo fichero generado: ml.export
cat ml.export
}

#********************
function importar
{
for i in $(cat ml.export);do
echo -e "auth $usu $pass \n dllink $i \n q" | nc 127.0.0.1 4000
done
}

#*********************
function cancelar
{
echo -e "auth $usu $pass\n cancel $1 \n" | nc 127.0.0.1 4000
}


#*********************
function conectar
{
echo -e "auth $usu $pass\n ? \n" | nc 127.0.0.1 4000
}



#*********************
function help
{
#echo -e "auth $usu $pass\n longhelp \nq" | nc 127.0.0.1 4000

{
sleep 1
echo auth "$usu" "$pass"
sleep 1
echo longhelp
sleep 1
echo q
} | telnet $host $puerto

}

#*********************
function spanish
{
echo -e "auth $usu $pass\n \
s -minsize 524288000 -maxsize 1048576000 -Video -format avi -media Video -not "crack" -not "exe" -not "zip" -not "rar" -not "keygen" -not "crack" "spanish"
\nq" | nc 127.0.0.1 4000
}

#*********************
function comando
{
echo -e "auth $usu $pass \n $1 \n q" | nc 127.0.0.1 4000
}


#*********************
function link
{
echo "telnet 127.0.0.1 4000"
echo "auth $usu $pass"
echo "dllink fichero"
echo -e "auth $usu $pass \n dllink $1 \n q" | nc 127.0.0.1 4000
}

#****************************
function velocidad
{
echo "****************************"
case "$1" in
"rapido")
echo "DOWN: $rapidodown UP: $rapidoup"
echo -e "auth $usu $pass\n \
set max_hard_download_rate $rapidodown \n \
set max_hard_upload_rate $rapidoup \n q" | nc 127.0.0.1 4000
;;
"lento")
echo "DOWN: $lentodown UP: $lentoup"
echo -e "auth $usu $pass\n \
set max_hard_download_rate $lentodown \n \
set max_hard_upload_rate $lentoup \n q" | nc 127.0.0.1 4000
;;
*) echo "Uso: $0 v rapido|lento"
exit 1
;;
esac
}

#********************************
function arranque
{
case "$1" in
"stop")
killall mlnet
;;
"start")
cd /home/paco/.mldonkey/
mlnet &
;;
*) echo "$0 arranque start|stop"
exit 1
;;
esac
}

#***************************
function borrar
{
echo -e "auth $usu $pass \n cancel $1 \n confirm yes \n q" | nc 127.0.0.1 4000
}


#***************************
function descargas
{

{
sleep 1
echo auth "$usu" "$pass"
sleep 1
echo vd
sleep 1
echo q
} | telnet $host $puerto

#echo "auth $usu $pass \n vd \n q" | nc 127.0.0.1 4000
}

#***************************
function propiedades
{
echo -e "auth $usu $pass \n vd $1 \nq" | nc 127.0.0.1 4000
}

#***************************
function puertos
{
echo -e "auth $usu $pass \n portinfo \nq" | nc 127.0.0.1 4000
}


#***************************
function server
{

# Activar update
{
sleep 1
echo "auth $usu $pass"
sleep 1
set update_server_list_server_met true
sleep 1
set update_server_list_server true
sleep 1
set ED2K-update_server_list_server_met true
sleep 1
echo q
} | telnet $host $puerto




d=".mldonkey/server.met"
for i in $(cat server.met.txt);do
rm -f $d
echo "SERVER: ${i}"
wget -O ${d} ${i}
if [ -f ${d} ];then
{
sleep 1
echo "auth $usu $pass"
sleep 1
echo "servers server.met"
sleep 1
echo q
} | telnet $host $puerto

else
echo "No hay descargar"
fi

done
}

#***************************
function server1
{

url="http://ed2k.2x4u.de/mwoaihpx/min/server.met"
wget -O .mldonkey/server.met "$url"
echo -e "auth $usu $pass \n servers server.met \nq" | nc 127.0.0.1 4000

}

#***************************
function guardian
{
rm guarding.p2p.zip
wget \
http://www.openmedia.info/downloads/guarding.p2p.zip
-O guarding.p2p.zip
unzip guarding.p2p.zip
echo -e "auth $usu $pass \n set ip_blocking "guarding.p2p" \nq" | nc 127.0.0.1 4000
}

#***************************
function remb
{
echo -e "auth $usu $pass \n rem blocked \nq" | nc 127.0.0.1 4000
}


#*********************
function opciones
{
echo "Valores:"
echo "RAPIDO. DOWN: $rapidodown UP: $rapidoup"
echo "LENTO. DOWN: $lentodown UP: $lentoup"

echo "opciones:"
echo "0. Salir"
echo "h. Ayuda de comandos"
echo "a. Arranque start/stop"
echo "v. rapido/lento."
echo "d. Descargas"
echo "l. Link ed2k://"
echo "c comando. Comando directo"
echo "p num. Ver propiedades fichero"
echo "b num. Borra fichero"
echo "t. Conectar"
echo "e. Exportar"
echo "i. Importar"
echo "pu. Ver puertos usados"
echo "se. Cargar todos los server.met"
echo "se1. Cargar un server.met"
echo "sp. Buscar spanish"
echo "gu. Guardian p2p"
echo "seb. Borrar servidore bloqued"
}


#**************** MAIN


case "$1" in
0)
exit
;;
b)
borrar $2
;;
p)
propiedades $2
;;
t)
conectar
;;
a)
arranque $2
;;
v)
velocidad $2
;;
d)
descargas
;;
h)
help
;;
c)
comando $2
;;
l)
link "$2"
;;

e)
exportar
;;

i) importar
;;

pu) puertos
;;

se) server
;;

se1) server1
;;

sp) spanish
;;

gu) guardian
;;

seb) remb
;;

*)
echo "SINTASIS: $0 opcion valor"
opciones
exit 1
;;
esac

EJECUTARLO:
bash ml.sh se

P2P EN LINUX UBUNTU: MLDONKEY

TENEMOS QUE INSTALAR
sudo aptitude install kmldonkey mldonkey-gui mldonkey-server


DANDO PRIORIDAD BAJA AL MLDONKEY

Crear la carpeta .mldonkey
Crear el script: mldonkey.sh

cat mldonkey.sh

#Por Paco Aldarias
p="kmldonkey"
#p="/usr/bin/mlgui"
w="http://127.0.0.1:4080/"

case "$1" in
start)
echo "Arrancando mldonkey"
rm -f /home/paco/.mldonkey/shared_files.ini.tmp
cd /home/paco/.mldonkey
nohup nice -n 19 mlnet &
sleep 10
$p &
$w &
;;
stop)
killall mlnet &
killall "$p" &
;;
other)
echo "$0 start|stop"
;;
esac

kMLDONEY
Gestiona las descargas. La primera vez que entremos poner usuario: admin, contraseña
la del usuario de linux.

sábado, 1 de enero de 2011

RHYTHMBOX CARATULAS

COPIA DE SEGURIDAD:
Podemos hacer una copia de seguridad de las caratulas de los cds de música
que se encuentra en la carpeta:
~/.cache/rythmbox/covers

ASOCIAR CARATULAS
Poner el nombre cover.jpg para asociar las caratulas.