Tuesday, September 17, 2013

Arduino without arduino IDE

It has been a long time since my last post about hardware or embeded software...
This one is just about a link to:

A Brief Tutorial on Programming the ATMega (Arduino) without Arduino Software


The part which had call my attention most was the lesson 11, on persistence storage using the EEPROM.
There are much more, it worst a careful the reading.

Tuesday, June 4, 2013

Adding multiple files to CVS

Since the beginning, this blog was meant more as short mental notes for future retrieval. So, here comes another one:

I am a long term CVS users. I have lots of old projects which still being maintained with CVS for version control, backup and central repository. Most of these projects must be updated and/or must have new features added to them, some times I have to add lots of files to the repository, and doing this from the command line would be very painful if there were not powerful command line tools such as "find", "grep", "cut" and "xargs".

First, I have to add everything which is not a CVS control folder to the repository:

find . -not -name CVS -not -name Root -not -name Entries -not -name Repository -exec cvs add {} \;

Second, the remaning files from the projects root folder must be added to. Issuing a "cvs update", the appear with a question mark (?), but cvs echos a lot more info to the stderr. We can cut that off, rederecting the stderr to NULL, and grepping the question marks, cutting the second field and piping it to xargs to add those files to the cvs repository:
cvs update -R -P -d 2> /dev/null | grep "?" | cut -d " " -f 2 | xargs cvs add

Fine. Everything new is in the cvs repository.

Wednesday, November 23, 2011

Resizing images and generating animated gifs

After writing my last posts (Plotting memory usage on console and More trickery with gnuplot dumb terminal), I had to put here some lines used to make the screenshot I'd put there.
To resize all screen shot frames:

ls -1 *.png | cut -d . -f 1 | while read line ; do convert $line.png -resize 60% $line.mini.png; done

In stead of resizing the image, they can be cropped:
ls -1 *.png | cut -d . -f 1 | while read line ; do convert $line.png -crop 400x270+92+37 $line.mini.png; done

To make the animated gif
convert -delay 100 -loop 0 screenshot0*mini.png screenshot.gif

More trickery with gnuplot dumb terminal

In my post "Plotting memory usage on console" the chart doesn't panned the data.
Now, using a named pipe, the effect got a little bit nicer.
First we have to run the memUsage.sh script to get a file filled with memory usage info:
./memUsage.sh > memUsage.dat &
Then we have to create a named pipe:
mkfifo pipe
Now we have to run another process to tail only the last 64 lines from the memUsage.dat
while [ 1 ]; do tail -64 memUsage.dat> pipe; done &
And now we just have to plot the data from the pipe:
watch -n 1 'gnuplot -e "set terminal dumb;p \"pipe\" with lines"'
And that is it!

Plotting memory usage on console

This is just a simple hack to play around with gnuplot set to dumb terminal (character console), doesn't meant to be serious application.
First I had written a bash scritp to log memory usage a while ago:

So, while running this script in background (./memUsage.sh > memUsage.dat &), logging the data, the memory usage information can be plotted with gnuplot and watched in real time:
watch -n 1 'gnuplot -e "set terminal dumb;p \"memUsage.dat\" with impulses"'

The chart can be plotted with lines, with impulses or any gnuplot style option.

Tuesday, November 22, 2011

ftdi232 permission on Ubuntu

I'am using the ftdi chip with bitbang mode to control some hardware with linux.
Every time I copy my software to a new desktop, it always take me hours to figure out why it has no permission to run the bitbang mode as a regular user.
Every website or forum I look around tells me about the udev, but I check back on the working desktops and there is no udev rule for the ftdi hardware. And after trying to force permissions with chgrp and chmod directly on /dev/bus/usb/* I figured out that I had to master at least a little about udev rules.

Checking with a little more care at a working machine I´ve found a Virtualbox instalation which created a udev rule for the virtualbox usb driver. Changing that rule to be used with the FTI chip I do the following steps, with had worked perfeclty:

Create the file /etc/udev/rules.d/10-ftdi.rules

Write on it:
SUBSYSTEM=="usb_device", GROUP="dialout", MODE="0664"
SUBSYSTEM=="usb", ENV{DEVTYPE}=="usb_device", GROUP="dialout", MODE="0664"

I have to make sure my user belongs to the dialout group, reboot the machine and that´s done.

Thursday, August 25, 2011

powerpoint slides to jpeg

Looking for some way to convert power point slides to JPG, I've found this site:


It has tons of good linux command line tips.

And here is the tip about the pdf to jpg which brought me there:


And to convert the powerpoint to pdf before, one can issue the unoconv command:

unoconv -f pdf slides.ppt

Friday, August 12, 2011


Tonight I was home alone with my kid. Fortunetly for us (the kid and me) our PC is connected to the TV set. So, he watched his favorites DVDs, while I had Google Reader in play mode with slide show enabled and side by side windows.

After playing the DVDs a dozen times, Google Reader showed this e-book post.

PostgreSQL is my database of choice, so this book will be very appreciated.

The PostgreSQL e-book is at:

Mac OS X in Linux via VirtualBox (as guest OS)

That is some thing I want to do for quite some time:

Install Mac OS X Snow Leopard as a guest OS in a VirtualBox Linux host




Tuesday, August 9, 2011

JavaScript Pie charts

Considering the "Warning against using pie charts", I'm needing to produce a couple of jquery/json ajax enabled piecharts within a simple webapp I'm designing.

There are some sort of ready to use examples:

Using various javascript libraries to create pie chart

JavaScript charts | Pie charts