Friday, December 28, 2012

Pretty priting json from command line

alias pp='python -mjson.tool'

Simple json parser for bash using python

echo $YOUR_JSON_DATA | python -c "import json; import sys; data=json.load(sys.stdin); print data['results']"

Tuesday, July 03, 2012


Friday, June 01, 2012


Nuevo disco

Sunday, March 25, 2012


Una cita

Friday, December 30, 2011


Saturday, November 12, 2011


"Vendrá el futuro a verte cualquiera de estos días..."

Saturday, October 29, 2011


Podría ser

Friday, October 21, 2011

Notes - Giving more stability to the mood lamp

I had some troubles setting up supervised process for the python binary running the mood lamp, I guess it might be related with the fact that python is also calling gnuplot subprocess via os.system call, and daemontools might be a bit lost with that (not sure).

So in order to have the binary running more stable and making it strong against spurious crashes I did a little script that is running under a screen session:

while : ; do
python ./
echo $CRASH_COUNTER > /tmp/animo_crash_counter.txt
sleep 10

Saturday, October 01, 2011

Notes - Have seti@home graphics working with ubuntu

sudo xhost +si:localuser:boinc

this command in your System-Preferences-Sessions-Startup Programs:
/usr/bin/xhost +local:
If you want to run it at start up

sudo xhost +si:localuser:boinc

Friday, September 30, 2011


Monday, September 19, 2011

Notes - Adding stability improvements to the mood lamp

If yo want to store chart data for public serving, It's necessary to have dropbox running, due to encryption issues maybe if you reboot your computer it will not run until you log in and mount your home so first thing run dropbox

service dropbox start

bash -c '/usr/bin/screen -dmS minic minicom -o'

#this is if you put some services with symlink under /service

#svscanboot will run them, but Im not using them form now
csh -cf '/command/svscanboot &'

#main soft running supervised and under a screen terminal
bash -c '/usr/bin/screen -dmS lamp supervise /home/me/scripts/animo'

Friday, September 16, 2011

Notes - Web scrapping ajax obfuscated websites

Im using a perl script that calls selenium server, then I use Beautiful soup to nicely parse the rendered output coming from selenium. Probably using webkit could be done more nicely but this way is easy and quick to setup.
Just wanted to write this note so I don't forget the pipes that I'm doing. :)

Really it is not needed to get data first with perl, rc selenium export to python (Remote Control) it is enough later to get the source and parse it.

To get the source code in python use:
data = sel.get_html_source()

if you're using perl:
my $data=$sel->get_html_source();

Sunday, September 11, 2011

Notes - Monitor an event and send email when it occours

tail -f /var/log/messages | awk '/now/ {system("mail -s 'hi' < /dev/null")}'

interesting for /var/log/auth for example...

Notes - Record shell session for later replay (educational use)

script -t 2> tutorial.timing -a tutorial.session
type ‘exit’ to end the recording.

Replay goes like this
scriptreplay tutorial.timing tutorial.session


Creative Commons License
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.