Archive

Posts Tagged ‘linux’

Install Maemo4 (diablo) and Maemo5 (freemantle) SDK

February 5th, 2010
#!/bin/sh

sh /scratchbox/users/rlinfati/home/rlinfati/maemo-sdk-nokia-binaries_4.1.2.sh

newgrp sbox < /bin/cat <<'END'

sb-conf st maemo5 -c cs2007q3-glibc2.5-i486 -d debian-etch:doctools:git:perl:svn -t none -f
sb-conf re maemo5 -f
sb-conf rs maemo5 /scratchbox/users/rlinfati/home/rlinfati/maemo-sdk-rootstrap_5.0_i386.tgz
sb-conf install maemo5 -L --etc --devkits --fakeroot
echo "# maemo5
deb http://repository.maemo.org/ fremantle/sdk free non-free
deb-src http://repository.maemo.org/ fremantle/sdk free non-free
deb http://repository.maemo.org/ fremantle/tools free non-free
deb-src http://repository.maemo.org/ fremantle/tools free non-free
deb http://repository.maemo.org/ fremantle/12345678901234567890 nokia-binaries
# deb http://repository.maemo.org/extras fremantle free non-free
# deb-src http://repository.maemo.org/extras fremantle free non-free
# deb http://repository.maemo.org/extras-testing fremantle free non-free
# deb-src http://repository.maemo.org/extras-testing fremantle free non-free
# deb http://repository.maemo.org/extras-devel fremantle free non-free
# deb-src http://repository.maemo.org/extras-devel fremantle free non-free" > /scratchbox/users/rlinfati/targets/maemo5/etc/apt/sources.list
rm /scratchbox/users/rlinfati/targets/maemo5/opt
mkdir /scratchbox/users/rlinfati/targets/maemo5/opt

sb-conf st n900 -c cs2007q3-glibc2.5-arm7 -d debian-etch:doctools:git:perl:svn:qemu -t qemu-arm-sb -f
sb-conf re n900 -f
sb-conf rs n900 /scratchbox/users/rlinfati/home/rlinfati/maemo-sdk-rootstrap_5.0_armel.tgz
sb-conf install n900 -L --etc --devkits --fakeroot
echo "export DEB_BUILD_OPTIONS=maemo-launcher,thumb,vfp" > /scratchbox/users/rlinfati/targets/n900.environment
echo "# maemo5
deb http://repository.maemo.org/ fremantle/sdk free non-free
deb-src http://repository.maemo.org/ fremantle/sdk free non-free
deb http://repository.maemo.org/ fremantle/tools free non-free
deb-src http://repository.maemo.org/ fremantle/tools free non-free
deb http://repository.maemo.org/ fremantle/4bc37c7c77ebe90177c050b805a8dc79 nokia-binaries
# deb http://repository.maemo.org/extras fremantle free non-free
# deb-src http://repository.maemo.org/extras fremantle free non-free
# deb http://repository.maemo.org/extras-testing fremantle free non-free
# deb-src http://repository.maemo.org/extras-testing fremantle free non-free
# deb http://repository.maemo.org/extras-devel fremantle free non-free
# deb-src http://repository.maemo.org/extras-devel fremantle free non-free" > /scratchbox/users/rlinfati/targets/n900/etc/apt/sources.list
rm /scratchbox/users/rlinfati/targets/n900/opt
mkdir /scratchbox/users/rlinfati/targets/n900/opt

sb-conf st maemo4 -c cs2007q3-glibc2.5-i486 -d debian-etch:doctools:git:perl:svn -t none -f
sb-conf re maemo4 -f
sb-conf rs maemo4 /scratchbox/users/rlinfati/home/rlinfati/maemo-sdk-rootstrap_4.1.2_i386.tgz
sb-conf install maemo4 -L --etc --devkits --fakeroot
echo "# maemo4
deb http://repository.maemo.org/ diablo/sdk free non-free
deb-src http://repository.maemo.org/ diablo/sdk free
deb http://repository.maemo.org/ diablo/tools free non-free
deb-src http://repository.maemo.org/ diablo/tools free
deb file:/home/rlinfati/maemo-sdk-nokia-binaries_4.1.2 diablo explicit
# deb http://repository.maemo.org/extras diablo free non-free
# deb-src http://repository.maemo.org/extras diablo free non-free
# deb http://repository.maemo.org/extras-devel diablo free non-free
# deb-src http://repository.maemo.org/extras-devel diablo free non-free" > /scratchbox/users/rlinfati/targets/maemo4/etc/apt/sources.list

sb-conf st n8x0 -c cs2007q3-glibc2.5-arm6 -d debian-etch:doctools:git:perl:svn:qemu -t qemu-arm-sb -f
sb-conf re n8x0 -f
sb-conf rs n8x0 /scratchbox/users/rlinfati/home/rlinfati/maemo-sdk-rootstrap_4.1.2_armel.tgz
sb-conf install n8x0 -L --etc --devkits --fakeroot
echo "export DEB_BUILD_OPTIONS=maemo-launcher,thumb,vfp" > /scratchbox/users/rlinfati/targets/n8x0.environment
echo "# maemo4
deb http://repository.maemo.org/ diablo/sdk free non-free
deb-src http://repository.maemo.org/ diablo/sdk free
deb http://repository.maemo.org/ diablo/tools free non-free
deb-src http://repository.maemo.org/ diablo/tools free
deb file:/home/rlinfati/maemo-sdk-nokia-binaries_4.1.2 diablo explicit
# deb http://repository.maemo.org/extras diablo free non-free
# deb-src http://repository.maemo.org/extras diablo free non-free
# deb http://repository.maemo.org/extras-devel diablo free non-free
# deb-src http://repository.maemo.org/extras-devel diablo free non-free" > /scratchbox/users/rlinfati/targets/n8x0/etc/apt/sources.list

echo export DISPLAY=:2 > /scratchbox/users/rlinfati/home/rlinfati/.bashrc

END
Tags: , ,

Boot a floppy image from grub2

February 5th, 2010

Create a directory for the boot image and copy memdisk to /boot

mkdir /boot/images/
aptitude install syslinux
cp /usr/lib/syslinux/memdisk /boot

Create a script /etc/grub.d/40_custom to auto-detect the floppy image at the directory

#!/bin/sh

set -e

IMAGES=/boot/images
. /usr/lib/grub/grub-mkconfig_lib
if test -e /boot/memdisk ; then
  MEMDISKPATH=$( make_system_path_relative_to_its_root "/boot/memdisk" )
  echo "Found memdisk: $MEMDISKPATH" >&2
  find $IMAGES -name "*.img" | sort |
  while read image ; do
      IMAGEPATH=$( make_system_path_relative_to_its_root "$image" )
      echo "Found floppy image: $IMAGEPATH" >&2
      cat << EOF
menuentry "Bootable floppy: $(basename $IMAGEPATH | sed s/.img//)" {
EOF
      prepare_grub_to_access_device ${GRUB_DEVICE_BOOT} | sed -e "s/^/\t/"
      cat << EOF
        linux16 $MEMDISKPATH bigraw
        initrd16 $IMAGEPATH
}
EOF
  done
fi

# exec tail -n +3 $0
# This file provides an easy way to add custom menu entries.  Simply type the
# menu entries you want to add after this comment.  Be careful not to change
# the 'exec tail' line above.

and call update-grub2

pbuilder and chroot

February 5th, 2010

Build a Chroot with debootstrap, example a Ubuntu lucid

sudo debootstrap lucid /opt/chroots/lucid.linfati.cl/

now, create a /usr/local/bin/go-chroot file with

#/bin/sh

case "$1" in
  sethost)
	echo virtu-$2 | sudo tee /opt/chroots/$2.linfati.cl/etc/debian_chroot
	;;
  run)
	sudo pbuilder --execute \
	--aptcache "" \
	--no-targz \
	--buildplace /opt/chroots/$2.linfati.cl \
	-- /bin/su -
	;;
  *)
	$0 sethost $1
	$0 run $1
	;;
esac

exit 0

and run

go-chroot lucid

Nokia actualiza el firmware de N900 a PR 1.1 !

January 14th, 2010

Por fin salio el BIG update… la lista de nuevas caracteristicas esta en el wiki y la discucion en tmo

La actualizacion se transmite via OTA (via aire) o pueden usar el NokiaSoftwareUpdater o las imagenes FIASCO

Nokia actualiza el firmware de N900 a PR 1.0.1 !

January 11th, 2010

La version PR 1.0.1 es la 2009.44-1, la cual es solo un minor bugfix para poder actualizar a la version PR 1.1 ( aka 2009.51-1 ) que saldra a fin de mes.

Los cambios segun comento konttori_nokia en #maemo son:

  1. Nuevo kernel que aumenta el nivel de compresion para hacer espacio para el siguiente version
  2. Eliminado el soporte para icon cache que nos comia espacio en cada nuevo programa que se instalaba
  3. Muchos fix (37) en el Administrador de Aplicaciones (h-a-m), nueva interface, soporte para la ovi store

Lo mas importante de esta actualizacion es la posibilidad de actualizar ( en un futuro muy cercano ) a la version PR1.1 ( aka 2009.51-1 ) que traera muchas novedades.

Onformacion original :

konttori_nokia: kernel contains one fix, which is allowing HAM to trigger ubifs to higher compression level for the SSU update.
konttori_nokia: browser contains one fix, which is browser UA string to say that it’s pr1.0.1 device.
konttori_nokia: GTK contains one fix, which is dropping the icon cache support.
konttori_nokia: application manager contains 37 fixes, mostly related to SSU stability
konttori_nokia: And a bit related to the new look of the app grid.

auto-connect to ssh vpn using upstart

December 19th, 2009

if you have a ssh keys configured to root user in a ssh-server, you can do a vpn over ssh using a tun interface

copy the text to /etc/init/vpn2ssh.conf, change 1.2.3.4 for the ip of the vpn server and do “start vpn2ssh”

# vpn2ssh - vpn over ssh to ssh server manager
#
# vpn over ssh to ssh server manager

description "vpn over ssh to va.linfati.cl manager"
author "Rodrigo Linfati <rodrigo@linfati.cl>"
version "0.1"

start on started gdm
stop on stopping gdm

respawn
expect fork

env vpnserver=1.2.3.4
env idtun=309
env iplocal=172.30.9.2
env ipremote=172.30.9.1

pre-start exec sleep 60
exec ssh -C -f -w $idtun:$idtun $vpnserver ifconfig tun$idtun $ipremote pointopoint $iplocal  up
post-start exec                            ifconfig tun$idtun $iplocal  pointopoint $ipremote up

Note: on ssh server need “PermitTunnel=yes” on sshd_config

Tags: , ,

Nokia N900

December 13th, 2009

Me compre mi nokia N900 en un tiempo record… ordenado un dia 20 de Noviembre, despachado el lunes 23 y recibido el dia 24 en la mañana! Genial! ( en el primer lote de entrega ) con un descuento de un 25%… lo cual lo hizo mas genial aun ( precio de mercado 600€ )

Solo dos cosas hecho de menos de mi BlackBerry 8100
1.- Poder usarla con una sola mana para chat, sms, navegar, al ser horizontal para esas tareas, llamar se puede verticalmente
2.- La tecnologia Push, que los mensajes los envia el servidor a mi celular a penas estan disponibles ( sms, email, chat ) y no debe estar cada x minutos revisando si existe algo nuevo… lo que se refleja en la duracion de la bateria.

DSCN7875 (by Rodrigo Linfati)

DSCN7876 (by Rodrigo Linfati)

DSCN7879 (by Rodrigo Linfati)

DSCN7880 (by Rodrigo Linfati)

DSCN7882 (by Rodrigo Linfati)

Bonus: bicicleta dali….
20091202_002.jpg (by Rodrigo Linfati)

UserScripts.org para Greasemonkey

July 23rd, 2009

Que es Greasemonkey?
Greasemonkey es una extensión para el navegador Mozilla Firefox que permite, por medio de pequeñas porciones de código creadas por usuarios, modificar el comportamiento de páginas web específicas. Con esta extensión es posible mejorar la experiencia de lectura de un sitio, hacerlo más usable, añadir nuevas funciones a páginas web, corregir errores, mejorar servicios de búsquedas y muchas otras cosas más.

Que usa Internet Explorer? Que odia Firefox? use ie7pro para cargar los script

Script Recomendados

Youtube Enhancer
Permite bajar videos, seleccionar la calidad, activar/desactivar el autoinicio, etc.

Free Youtube
Permite usar un visor de videos para ver los videos, por ejemplo VLC o Totem

Youtube without flash
Otro script que permite usar un visor de videos para ver los videos, por ejemplo VLC o Totem

Facebook Purify
Oculta los mensajes de la pagina principal de los cuestionarios, aplicaciones, juegos, etc

Facebook Fixer
Ver album facilmente, bajar los videos, ver la edad y el signo zodiacal de cada persona, ver todas las fotos del album en una sola pagina, etc.

TwittSeven
Permite hacer Re-tweet, Ver los link acortados, ver el ultimo tweet leido, automaticamente cargar nuevos mensajes, etc

Nested Twitter Replies
Permite ver los mensajes junto a sus respuestas

twitter (by Rodrigo Linfati)

Y tu, que script usas?

Bug on Gurobi Optimization

July 16th, 2009

Today gurobi give me the confirmation of the bug ( and the fix is on the next release 1.1.2 )

Gurobi is a solver for LP and MIP and can be user from C, C++, Java, Python and they are Premiun Partner of Microsoft Solver Foundation. The Management Team are 3 ex-employees from (Ilog) Cplex. The Price of comercial license is from USD$ 6.500 (single user, single machine, single instance) to USD $36.000 (unlimited user, single machine, multi cpu) + 20% per year for maintenance.

The Problem:
Gurobi give me a incorrect, not optimal, not valid, not feasible solution as optimal

The model in format lp

Minimize
  x
Subject To
 c0: 75000 x - 75001 y - 75002 z = 0
Bounds
 1 &amp;lt;= x
Generals
 x y z
End

Or

 \min \quad x
Subject To
 7500 * x = 75001 * y + 75002 * z
 x \geq 1, y \geq 0, z \geq 0
 x,y,z \in \mathbb{Z}^{+}_{0}

The Output of gurobi is

Python 2.5.2 (r252:60911, Jul 31 2008, 17:28:52)
[GCC 4.2.3 (Ubuntu 4.2.3-2ubuntu7)] on linux2
Type &amp;quot;help&amp;quot;, &amp;quot;copyright&amp;quot;, &amp;quot;credits&amp;quot; or &amp;quot;license&amp;quot; for more information.

Gurobi Interactive Shell, Version 1.1.1
Copyright (c) 2009, Gurobi Optimization, Inc.
Type &amp;quot;help()&amp;quot; for help

gurobi&amp;gt; f1 = read('/datos/Universidad/PhD-Unibo/ilofail/fail1.lp' )
Read LP format model from file /datos/Universidad/PhD-Unibo/ilofail/fail1.lp
(null): 1 Rows, 3 Columns, 3 NonZeroes
gurobi&amp;gt; f1.optimize()
Optimize a model with 1 Rows, 3 Columns and 3 NonZeroes
Presolve time: 0.00s
Presolved: 1 Rows, 3 Columns, 3 Nonzeros
Objective GCD is 1

Root relaxation: objective 1.000000e+00, 0 iterations, 0.00 seconds

    Nodes    |    Current Node    |     Objective Bounds      |     Work
 Expl Unexpl |  Obj  Depth IntInf | Incumbent    BestBd   Gap | It/Node Time

H    0     1                          2.0000     1.0000  50.0%     -    0s
     0     1     1.0000    0    1     2.0000     1.0000  50.0%     -    0s

Explored 1364 nodes (1363 simplex iterations) in 0.28 seconds
Thread count was 2 (of 2 available processors)

Optimal solution found (tolerance 1.00e-04)
Best objective 2.0000000000e+00, best bound 2.0000000000e+00, gap 0.0000%

And… is easy check that for  x=2 \quad \nexists \quad y,z \in \mathbb{Z}^{+}_{0} that satisface  7500 * x = 75001 * y + 75002 * z

The optimal solution is  x =  37501 , y = 0, z = 37500

Thanks to
Edward Rothberg – Gurobi
For confirm the bug (and fix it in the next release)
Juan José Salazar – Universidad of La Laguna, Tenerife, Spain
For show an example of very very small mathematical model, but very hard to solve in cplex or another solver. See the slide

Que hace un conejo conectado a la wifi?

July 5th, 2009

Pues, en mi viaje a españa me compre un nabaztag/tag que es un conejo… pero hace ciertas gracias

  • Mueve las orejas…
  • Habla! y en varios idiomas
  • se conecta a internet via wifi
  • Conectado a internet a el gran hermano conejo, pueden enviarse mensajes y tu conejo los lee
  • Hace coreografia con las orejas y las luces de la boca, nariz, inferior
  • Te da la hora… de forma seria, de forma divertida o de forma ridicula
  • Te da el tiempo/clima de tu ciudad, se lo puedes preguntar por que reconoce tu voz
  • Te lee tu twiter y los feed rss
  • Te despierta en las mañana y pone la radio ( y sin prender el pc! )
  • te avisa cuando tienes una cita/reunion en tu calendario
  • y muchas cosas mas…

El unico problema que me dio, fue que no se quiso unir a mi red wifi wpa, pero como mi router corre linux con una wifi atheros, cree otro AP sin encriptar, oculto y con filtro mac y funciono ( algun dia le agregare wep ), los comandos usados en el router son similares a estos

wlanconfig ath6 create wlandev wifi0 wlanmode ap
iwpriv ath6 hide_ssid 1
iwconfig ath6 essid SSIDPARAMICONEJO
ifconfig ath6 up
brctl addif br1 ath6

Y para usarlo desde mi pc, sin ir a la web…. use la api de nabaztag… pude haber usado php, pero me gusta mas la shell de linux ( o la de mac osx )

#! /bin/sh

if [ -f ~/.nabaztag ] ; then
    . ~/.nabaztag
fi

if [ "x$NT" != "xOK" ] ; then
    echo "edit your ~/.nabaztag with SN, TN and NT=OK"
    exit 0
fi

case "$1" in
  on)
	curl -s "http://api.nabaztag.com/vl/FR/api.jsp?sn=$SN&token=$TN&action=14"
	;;
  off)
	curl -s "http://api.nabaztag.com/vl/FR/api.jsp?sn=$SN&token=$TN&action=13"
	;;
  status)
	curl -s "http://api.nabaztag.com/vl/FR/api.jsp?sn=$SN&token=$TN&action=7"
	;;
  play)
	curl -s "http://api.nabaztag.com/vl/FR/api_stream.jsp?sn=$SN&token=$TN&urlList=$2"
	;;
  bbconce)
	$0 play http://online.laradio.cl:8000/32K
	;;
  bbstgo)
	$0 play http://online.laradio.cl:8002/32K
	;;
  msg)
	[ "$2" ] || read -p Msg?\  t
	[ "$2" ] && t=$2
	[ $3 ] || v=ES-Alfonsina
	[ $3 ] && v=$3
	m=$(echo $t | sed s/\ /+/g)
	curl -s "http://api.nabaztag.com/vl/FR/api.jsp?sn=$SN&token=$TN&voice=$v&tts=$m&ttlive=1"
	;;
  voice)
	[ $2 ] || i='-'
	[ $2 ] && i=$2
	curl -s "http://api.nabaztag.com/vl/FR/api.jsp?sn=$SN&token=$TN&action=9" |
	sed s/\<//g |
	sed s/\"\\/\>/\\n/g |
	sed s/voice.lang....-....command..//g |
	sed s/.xml.version..1.0..encoding..UTF-8...rsp.voiceListTTS.nb..82//g |
	sed s/.rsp.//g |
	sed s/voice.lang..zh-cnm-CN..command..//g |
	sed s/voice.lang..zh-YUE..command..//g |
	sort -u | egrep $i
	;;
  *)
	echo "Usage: $0 {on|off|status|play|msg|voice}" >&2
	exit 1
	;;
esac

exit 0

y el archivo ~/.nabaztag contiene 3 lineas

SN=MAC_DEL_CONEJO_SOLO_NUMEROS
TN=TAG_ID_QUE_SALE_EN_LA_WEB
NT=OK