Skip to main content

Posts

Showing posts from November, 2011

Resizing images and generating animated gifs

After writing my last posts (P lotting 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 pan 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 .

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}=="u