miércoles, 22 de abril de 2009

Videos recomendados por la gerencia artística II

Este video clip de la banda Weezer tiene casi un año pero recién ahora lo descubro. El tema se llama "Pork and beans". Imitan escenas de muchos videos que hicieron furor en internet, algunos por ser muy buenos, otros por ser muy malos. Abajo, una lista con los videos originales. La mayoría los saqué de acá, y el resto del artículo de la Wikipedia.


Videos:
00:00 - La habitación es de Canon en D con guitarra eléctrica de Lim Jeong-hyun. La forma de mostrar las diferentes grabaciones probablemente de One man band
00:16 - Gary Brolsma (Numa numa)
00:19 - Dramatic gopher
00:23 - El Afro Ninja
00:31 - Eepybird (Experimentos mezclando Coca Cola y Mentos)
00:38 - Guy catches glasses with face (Atrapa los lentes con la cara)
00:38 - GI Joe, al servicio público (versión gay de GI Joe)
00:48 - El récord de las 155 camisetas
00:58 - Star wars kid
00:59 - Chris Crocker (Leave Britney alone)
01:04 - All your base are belong to us
01:11 - Miss Teen South Carolina (A la mina le preguntan por qué 1/5 de los norteamericanos no saben marcar su país en el mapa)
01:24 - Psychotic Kids (En Argentina está bloqueado, pero acá lo pude ver)
01:26 - Judson Laipply (Evolution of dance)
01:30 - Tay Zonday (Chocolate rain)
01:39 - Kevin Federline
01:48 - Daft Hands (Unas manos con palabras y letras escritas que se van moviendo para formar la letra de la canción "Harder, better, faster, stronger" de Daft Punk)
01:54 - Daft Bodies (Lo mismo pero lo hacen unas minas con el cuerpo)
02:06 - kicesie
02:08 - ???
02:29 - Liam Kyle Sullivan - Shoes
02:37 - Sneezing Panda (Estornudo de un panda)
02:37 - UFO Haiti (hoax)
02:43 - Dancing Banana
02:46 - Ryan Wieber y Michael “Dorkman” Scott
02:53 - Will It Blend?
02:57 - Charlie the unicorn (buenísimo. ver más abajo)
03:00 - It’s Peanut Butter Jelly Time! (Dancing Banana con música)




Algunos de los videos originales no los conocía. El mejor de los que descubrí fue Charlie the Unicorn. Es genial, jaja, re limado. Acá dejo 4 videos subtitulados en español.
Las versiones subtituladas tienen menos calidad de video así que abajo dejo las originales sin subtítulos.
















Originales, sin subtítulos:

Charlie The Unicorn
Charlie The Unicorn 2
Charlie The Unicorn 3
Charlie The Unicorn - Youtube Live


Para terminar, la sección tierna del post. Entre los videos relacionados estaba este, Charlie bit me - again. Un pendejito que el hermano lo muerde. Muy gracioso. El acento inglés que tiene es genial "Chorley bit mey. It really hoerts. It's still hoerteing!" Jajaja.




Este tambíen, como pronuncia boold-a! jajaja, el mejor.
No lo deja incrustar(?) acá el link


Por último, el falopero este:



Hasta la próxima.

sábado, 4 de abril de 2009

CuñáaaAaAaaaAAaAaa!!!

Les dejo una selección de los mejores videos de dos personajes bizarrísimos de Sevilla. Costó armarla porque en general los chistes que cuentan son malísimos pero la gracia está en cómo lo cuentan, cómo se ríen entre ellos, y hay que reconocer que si tuvieran todos los dientes sería menos gracioso.

Se trata de "El Risitas" y "El Cuñao" (Peíto). Aparecían en los programas El Vagamundo y Ratones Coloraos de Jesús Quintero donde contaban chistes y anécdotas que no le causaban mucha gracia al conductor. Risitas era el que contaba los chistes generalmente y cuando el conductor no se reía, le decía cosas como "Esúuu, ¿que no te gustan los chistes?", "¿Tu no te ries?", "Tu no eres de aquí." Y el cuñao se reía de lo que sea mostrando su único diente.

Este es uno de los mejores (acá hay una especie de transcripción):






Este también está bueno (de paso aprendí los términos cateto=(aprox)boludo, jiñar=cagar)





El video de la anécdota de las paelleras es buenísimo por la manera en se tientan al final Risitas y el conductor. La risa es demasiado contagiosa. Creo que, salvando las astronómicas distancias, lo recomendaría junto con Always look on the bright side of life de Monty Python para pasar cualquier momento bajón. Pero es un poco largo para el internauta moderno, así que esta es la parte del final cuando se empiezan a reir. Lo que contaba antes era que estaba trabajando en un restaurant y lo mandaron a limpiar 20 paelleras, entonces las ató en la playa para que se limpien con la sal del agua. Pero a la mañana había subido la marea y encontró solo una paellera, y por ahí sigue:




Otros videos:

Anécdota de los sacos de cemento
Gafas antisolares
Cámara que no se quiere ir

miércoles, 1 de abril de 2009

Perro, el perro.

Perro en el Patio Olmos
Parece salido de un capítulo de Alejo y Valentina, jaja. Estaba afuera del Patio Olmos cuando esperábamos con mi hermano a otro amigo para ir al Cosquín Rock.
La otra noche lo encontré por Nueva Córdoba y me pareció que el collar decía 123456789 así que parece que los pibes lo tienen de juguete al pobre animal, jaja.

domingo, 29 de marzo de 2009

Python is my religion

Python Argentina pyar ultima cena
Python es una religión: Tremenda reconstrucción de la Última Cena por los chicos de PyAr en el último PyCamp. No los conozco a todos personalmente pero sí a la mayoría. Son co-listeros de Python Argentina. Entre ellos, compañeros de trabajo, de la facu, de fiestas nerd en Córdoba, etc. Muy muy grossa foto.

miércoles, 11 de marzo de 2009

Admin Van Buuren

Admin Van Buuren


Una pelotudez que se me vino a la cabeza una de las tantas veces que tuve que ingresar user: admin password: admin en el trabajo quedó plasmada en esta imagen.

sábado, 7 de marzo de 2009

Limiting memory usage of a python script

I've been running recently some python and java experiments with important memory requirements on a machine shared with other people, some of them with the same needs on that machine.
There were no restrictions on resources usage by a user or a process, so controlled memory usage was the user's responsibility.

Java has a parameter to limit the amount of memory the virtual machine can use. If it exceeds that value, the machine exits and the running program fails. It is specified with java -Xmx value.

I couldn't find something similar for python so I procrastinated a bit writing a bash script to control the processes.
I made a cycle that monitored the values from /proc/meminfo and killed the running process if some limit was reached.
The problem with that solution was that my experiments were not just one program, but many, controlled by a bash script, so this solution would just kill the bash script and not the process doing the important memory usage. So I added some extra code borrowed from the web to kill also the subprocesses. That made the code longer and more complex, leading to this:

control_run.sh:
PROGRAM=$*

#Also kills process children, and their children, and so on
KILL_CHILDREN=1

#Minimum free memory available (in Kb.)
MEM_FREE_LIMIT=300000

#Minimum free swap (in Kb.)
SWAP_FREE_LIMIT=500000

#Run the program in background and get its PID
$PROGRAM &
PID=$!

#While the program is alive
ps $PID > /dev/null
while [ $? -eq "0" ]; do


MEM_FREE=$(grep MemFree: /proc/meminfo | egrep [0-9]+ -o)
#echo "Free Memory: ${MEM_FREE}"

SWAP_FREE=$(grep SwapFree: /proc/meminfo | egrep [0-9]+ -o)
#echo "Free Swap: ${SWAP_FREE}"

if [ "${MEM_FREE}" -le ${MEM_FREE_LIMIT} ] || [ "${SWAP_FREE}" -le ${SWAP_FREE_LIMIT} ]; then

if [ "${MEM_FREE}" -le ${MEM_FREE_LIMIT} ]; then
echo "free memory limit reached, exiting...";
else
echo "free swap limit reached, exiting...";
fi

if [ "${KILL_CHILDREN}" -eq 0 ]; then
echo "killing process with id $PID"
kill $PID
else
#code based on http://www.unix.com/unix-dummies-questions-answers/5245-script-kill-all-child-process-given-pid.html
KILL_PIDS=$PID

CHILDREN=`ps -ef| awk '$3 == '$PID' { print $2 }'`
while [ "$CHILDREN" != "" ]; do
KILL_PIDS="$KILL_PIDS $CHILDREN"
OLD_CHILDREN=$CHILDREN
CHILDREN=''
for i in $OLD_CHILDREN; do
CHILDREN="$CHILDREN `ps -ef| awk '$3 == '$i' { print $2 }'`"
done
done

echo "killing process with id $PID and its children"

for i in $KILL_PIDS
do
echo killing $i
kill $i
done

fi
exit 1;
fi

sleep 1

ps $PID > /dev/null
done

echo "program finished"


I tested it with a small python script that just consumes memory:

memory_consumer.py:
import time
a = range(100000)
while True:
a += range(100000)
print "printing something"
time.sleep(1)


and some bash scripts to execute three instances concurrently:


memory_consumer_main.sh:
#!/bin/sh
./memory_consumer_child.sh


memory_consumer_child.sh:
#!/bin/sh
python memory_consumer.py &
python memory_consumer.py &
python memory_consumer.py



we would run:
$./control_run.sh ./memory_consumer_main.sh
printing something
printing something
printing something
printing something
printing something
printing something
printing something
printing something
printing something
printing something
printing something
printing something
printing something
printing something
printing something
free memory limit reached, exiting...
killing process with id 9348 and its children
killing 9348
killing 9349
killing 9350
killing 9351
killing 9353



Another possibility I found was setting the memory limit with ulimit.
We can set it from the command line and enable it for the bash session, or incluide the statements in the first lines of a bash script.

That will limit the allowed memory for any process

for example:
$ ulimit -v 40000
$ ulimit -H -v 40000


There, we limited the available memory for a process to 40Mb.
Then,
$ python memory_consumer.py
printing something
printing something
printing something
printing something
Traceback (most recent call last):
File "memory_consumer.py", line 4, in
a += range(100000)
MemoryError


While simple, the problem with this approach is that it will only kill the process exceeding the memory usage. If we are running just one isolated process, that's fine. But in my case, the batch would continue in an erroneous state and produce wrong results.
Any comment or suggestion, including "hey stupid, python has the option -blabla to do exactly that" will be appreciated.

miércoles, 26 de noviembre de 2008

Experimentando con Qtdesigner y PyQt

El fin de semana estuve probando hacer algún programita con interfaz gráfica usando python y QT. Para eso usé QTDesigner para editar la UI, y PyQT4 para usar la librería QT desde python.

Seguí este tutorial: http://www.cs.usfca.edu/~afedosov/qttut/ que aunque está viejo (es para PyQT3) la idea es la misma y se lo puede adaptar con algunos ejemplos para PyQT4 que hay dando vueltas.

El resultado fue este programita para setear algunos parámetros de mencoder y utilizarlo para capturar TV.

http://code.google.com/p/mtvcgui/