Playing with Node.js modules: node-pate

Pâté is a simple XPath-oriented, express-compatible template engine for Node.js

Usage


Output:


Bretzel price: $42.56 (CUARENTA Y DOS PESOS CON 56/100)

Source code:


https://github.com/benoror/node-pate

NPM:


https://https://www.npmjs.com/package/node-pate

Retro Gaming Collection Project - Pt. 1

I recently came across this blog post on Google+. It's about a guy called Pete (also known as 16bitgohst on Youtube) who has an impressive retro gaming collection and an incredible setup, just take a look:


I've been a noob collector for some time, mostly gaming consoles, and Pete's work inspired me to take out all my humble collection:



I even draw a concept using Google Sketchup:



I hope to start working on the project soon.

P.S. I'm still looking for an appropiate Video/Cable setup.

Jelly Bean Installation and Review on my Rooted ASUS TF300T Tablet

I just got Jelly Bean OTA update from ASUS for my ASUS TF300T. I had trouble getting the update, since I rooted and messed up with the system, deleted some system apps, so ASUS denied pushing the update again.

Installation


So far I fixed it thanks to xda-developers community in this post. Unafortunetly my device was wiped out after that so I lost root priviledges.


Getting Root again



coming soon...

Review


coming soon...

Capistrano: Managing an uploads folder

I just found a useful Capistrano recipe for keeping user generated content (a.k.a. uploads) persistent between deployments:

http://www.simonecarletti.com/blog/2009/02/capistrano-uploads-folder/

EDIT: I would like to extend the script to many folders. Any idea?

Capistrano as my default deployment tool

In the last post (a whiiile ago) I described my Git workflow to deploy my production server. One of the drawbacks was that everytime I pushed changes to the main repo I had to manually log in my Dreamhost shared host via SSH and then: 1) pull changes, 2) migrate database schema, 3) rebuild sphinx index, 4) restart passenger server. I wrote a bash script to get the job done, but it was prone to errors and not elegant, so I decided to give Capistrano a try.

After reading the Getting Started and From the Beginning guides I got a good idea of what to do next. Basically my setup is as follows:

File: benoror@macmini:~/simpleapp/Capfile


File: benoror@macmini:~/simpleapp/config/deploy.rb


So now when I make changes to the code I simply follow this workflow in my local machine:


  1. git add . && git commit -a -m "Commit Msg" && git push
  2. cap deploy
  3. cap deploy:migrate


That's it!


The next step is to setup a staging server, until then see you soon ...

Using Git in Rails production server workflow

In my projects I use Git as part of the deployment process. When I'm developing a new app and it's ready for production first I setup a non-bare repo in the Rails project itself:
benoror@macmini:~/simpleapp $ git init
benoror@macmini:~/simpleapp $ git add .
benoror@macmini:~/simpleapp $ git commit -a -m "First commit"
Then I just zip and copy the project to the production server. After extract it I clone it as a bare repo:
benoror@dreamhost:~ $ git clone --bare simpleapp simpleapp.git
This bare repo will act as the main repo (who said central?). Then I just add a remote origin in my computer:
benoror@macmini:~/simpleapp $ git remote add origin ssh://benoror@production.com/~/simpleapp.git
I assume you already copied your SSH keys and credentials. The workflow is as follows:

1. When I make changes in my computer just commit and push:
benoror@macmini:~/simpleapp $ git push origin master
2. Then I log into my production server and pull changes in the non-bare repo:
benoror@macmini:~/simpleapp $ ssh production.com
benoror@dreamhost:~ $ cd simpleapp

benoror@dreamhost:~/simpleapp $ git
pull
3. I have automatized the deployment process with a script that pull changes, restart Passenger, migrate db in case of schema has changed and finally re-index Sphinx.

:wq



Elementary-Mod AUR Package


I just uploaded a PKGBUILD for this great GTK theme to AUR.

*It only works with patched package nautilus-elementary.


Github vs Gitorious

Github is a service I've been using for a while to host my projects/configurations/*. It's truly excellent, and I could write a whole post about it. However, it has one flaw: its free plan doesn't allow for private repos.

I completely understand why they do this since they promote OSS, and in fact, I applaud them for it, as they currently have thousands of open-source projects that have gotten me out of a tight spot on more than one occasion.

However, there are times when it's necessary to maintain some privacy. Since the project I'm working on is at an advanced stage, I decided I couldn't risk it, so I decided to try Gitorious.

At first glance, it has a very similar interface and handling to Github, even with a more detailed design. I'll let you know in the coming weeks how it worked out for me...

Sync your dotfiles with GitHub

I'm tired of trying to keep my config files homogeneous between my linux-notebook and my mac mini, so I decided to store them in 'the cloud'. I chose GitHub because I'm learning Git and it has a neat web interface.

Step 1
Create dotfiles dir in my linux notebook, as the most recent configs reside there

benoror@gateway:~$ mkdir ~/dotfiles
benoror@gateway:~$ mkdir ~/dotfiles
benoror@gateway:~$ mv .bashrc ~/dotfiles/
benoror@gateway:~$ mv .vimrc ~/dotfiles/
benoror@gateway:~$ mv .vim ~/dotfiles/
(... ... ...)
benoror@gateway:~$ mv .ssh ~/dotfiles/

Step 2
Link those files back to my home dir

benoror@gateway:~$ ls -Ad /dotfiles/ | xargs -I _ ln -s _

Step 3
Create a neat readme file and make git ignore those sensitive files!

benoror@gateway:~/dotfiles/$ echo "Welcome to my public dotfiles" > README
benoror@gateway:~/dotfiles/$ echo ".secret" >> .gitignore
(...)
benoror@gateway:~/dotfiles/$ echo ".ssh/*" >> .gitignore

Step 4
Download Git and confiigure it

benoror@gateway:~/dotfiles/$ git config --global user.name "Benji Orozco" benoror@gateway:~/dotfiles/$ git config --global user.email benoror@gmail.com

Step 5
Sign-up at GitHub, and create a repo called 'dotfiles'. Follow the instructions to include your dsa-key, it's straight forward. Then create the repo locally and push it to your github:

benoror@gateway:~/dotfiles/$ git init benoror@gateway:~/dotfiles/$ git add .
benoror@gateway:~/dotfiles/$ git status
benoror@gateway:~/dotfiles/$ git commit -a -m 'first commit'
benoror@gateway:~/dotfiles/$ git remote add origin git@github.com:benoror/dotfiles.git benoror@gateway:~/dotfiles/$ git push origin master

That's It

Next article: Cloning Git Repos and mixing them with Dropbox

Segunda Entrega Robot en OpenGL


Para la segunda entrega del robot en OpenGL tuvimos que agregar muchas mas features:

  • Iluminación ambiente
  • Iluminación con color en movimiento
  • Materiales (Usamos Oro, Bronce y Plata)
  • Reflexiones
  • Primitiva creada desde cero
Para verlo en `wire mode` se usa la tecla 'W'. Para aumentar o disminuir la cantidad de triangulos de la primitiva se usa la tecla 'A' y 'a'.

* Como el servicio pastebin caduca a los pocos días en esta ocasion no publicaré el codigo hasta encontrar otro servicio similar con mejores prestaciones. Si saben de alguno no duden en comentarme. Si quieres el código con gusto se los proporcionare personalmente.

Mejora el arranque de GNOME Terminal

En sistemas basados en Debian (Ubuntu, Mint, etc.) y tal vez en otras distribuciones sucede que la terminal de GNOME (y algunas otras aplicaciones) puede tardar en arrancar porque decide buscar el hostname de la maquina local en 127.0.0.1, cuando en estos sistemas esta fijado en 127.0.1.1. Nuestro archivo /etc/hosts luce asi:
127.0.0.1 localhost
127.0.1.1 inspiron
Para solucionarlo tenemos que agregar nuestro hostname a la primera linea asi:
127.0.0.1 localhost inspiron
127.0.1.1 inspiron
Visto en: LinuxMint Wiki | Gentoo Forums

Robot en OpenGL

Desarrollé un robot humanoide en OpenGL y GLUT para una clase y se los comparto aquí. Mueve los miembros en todos los ejes y tiene limites "naturales". Código. Compilenlo asi:
cc robot.c -lglut -lGL -lGLU -pthread -lm -Wall -o robot

Benchmarking de TraceMonkey en Firefox 3.1b1

Tras habilitar TraceMonkey en Firefox 3.1b1 (vease punto 7 de este link) decidi hacer unas pruebas de este que se dice ser el motor javascript mas rapido del mundo, las cuales arrojaron los siguientes resultados:

Suponiendo el mejor de los casos SIN el motor en 3,021.56 ms, y el peor de los casos CON el motor en 1,830.3 ms , podemos decir que con TraceMonkey tabajando ocupamos solo el 60% del tiempo de procesamiento cuando no esta habilitado. Una mejora del 40% ! Les invito a nuestros amigos de Google Chrome a igualarlo.

Saludos!


SIN TraceMonkey Habilitado:
RESULTS (means and 95% confidence intervals)
--------------------------------------------
Total:                 3039.8ms +/- 0.6%
CON TraceMonkey habilitado:
RESULTS (means and 95% confidence intervals)
--------------------------------------------
Total:                 1821.2ms +/- 0.5%

Importar marcadores de Firefox en Nautilus

En mi intento por conseguir que mi browser sea más limpio y funcional he decidido eliminar la barra de menús con éste plugin y también la barra de marcadores. Mediante éste script en PHP que he adaptado he logrado importar los marcadores de Firefox y convertirlos en launchers para Nautilus. Por cierto estoy usando el nuevo Firefox Beta 3, sin embargo debe funcionar con versiones anteriores sin ningun problema, sólo recuerden modificar el script para que apunte correctamente a su archivo bookmarks.html y la carpeta donde se guardarán los favicons. A continuación les muestro un screenshot del resultado:


Ajax con JQuery

JQuery nos da los metodos $.ajax, $.post y $get para manejar peticiones AJAX. Los dos últimos son derivados de $.ajax, con una interfaz mas simple. $.ajax es el más completo y nos permite manipular la petición a nuestro antojo como muestro a continuación:


function openAjax(url, data) {
$.ajax({
type: “POST”,
url: url,
data: data,
beforeSend: function() {
$(’#ajax’).hide();
$(’#ajax’).html(”);
$(’#ajax_loading’).fadeIn(’slow’);
},
success: function(callback) {
$(’#ajax’).html(callback);
},
complete: function() {
$(’#ajax_loading’).hide();
$(’#ajax’).fadeIn(’slow’);
},
error: function() {
$(’#ajax’).html(’Ajax ERROR.’);
}
});
}

¿Sí o no?

Parece ser que a la línea de autobuses Noreste le gusta burlarse y confundir a sus pasajeros bilingües cuando éstos se ven en la necesidad darse una vuelta por los cómodos baños de éstas guaguas:

Rotando Wallpapers en GNOME

He modificado un script en Perl que permite rotar wallpapers en GNOME cada cierto intervalo de tiempo. Lo adapté para que parseara el XML ~/.gnome2/backgrounds.xml el cual contiene los wallpapers favoritos del sistema y los usé en lugar de tener que especificar una carpeta del disco duro. Para instalarlo guarda el codigo en algun lugar de tu disco duro y hazlo ejecutable (chmod +x archivo.pl). Ya solo queda definir que se ejecute automáticamente cada vez que inicies sesión (Sistema->Preferencias->Sesiones). Aqui les dejo el código:

#!/usr/bin/perl -w
#
# Default GNOME backgrounds feature by benji
# Originally Written by Michael Moore, Nov. 2007, placed in the public domain
#
# Requieres libxml-simple-perl
# $ sudo apt-get install libxml-simple-perl
#

use strict;
use warnings;
use XML::Simple;

my $switchTime = 300; # Edit to the number of seconds between photo switches
my $xml = new XML::Simple;
my $data = $xml->XMLin("/home/".getpwuid($<)."/.gnome2/backgrounds.xml");
my @photos;
my $temp;

foreach my $key (keys (%{$data->{wallpaper}})){
$temp = $data->{wallpaper}->{$key}->{filename};
if($temp ne "(none)") {
push(@photos,$temp);
}
}

chomp(@photos);

my $photo;

while(1)
{
$photo = $photos[rand($#photos)];
`gconftool-2 --type string --set /desktop/gnome/background/picture_filename "$photo"`;
sleep($switchTime);
}


Nota: Necesitas la libreria XML-Simple. Si usas ubuntu o derivados instalala ejecutando:
$ sudo apt-get install libxml-simple-perl

Jugando con Inkscape

No soy un dieñador gráfico ni nada por el estilo, pero siempre me he sentido atraído por el dibujo vectorial. Existen varias opciones, entre las más destacadas de Adobe y Corel, sin embargo estoy más familiarizado con Inkscape, que no le pide nada a sus contrincantes antes mencionados y además es open source. A continuación les dejo una muestra de lo que se puede llegar a hacer con esta aplicación sin necesidad de ser un Picasso:



Mi perfil en deviantART
.

Vulnerabilidad en la web del IPN

Navegando me encontré con una vulnerabilidad en el sitio del Instituto Politécnico Nacional que permite obtener casi cualquier archivo del servidor usando la siguiente URL:

http://www.cicimar.ipn.mx/cicimar/publica/verarchivos.php?archivo=../../../../../etc/passwd

Están avisados.