Skip to main content

Posts

How much space emacs backup files are using...?

Every time I use emacs, it automatically saves a backup file which filename ends with "~". From time to time, I issue a recursive find command to wipe out  (delete) every emacs backup file from my home folder. find . -iname \*~ -exec rm -rfv {} \; And everything is clean. I do it strictly to clean things up... not for any disk space concern...  But I was wondering how much disk space those backup files are consuming... So, instead of an rm command, I had executed a df and piped all to awk to summarize... find . -iname \*~  -exec du -s {} \; | cut -f 1 | awk '{s+=$1} END {print s}' This time all the emacs backup files were consuming only 1.6M, which isn't big deal... but I think it is better to get rid of them.

Extracting embedded images from SVG

With Inkscape, one can open and edit PDF files. But when the PDF comes with embedded images, the resulting SVG keeps the images as an embedded base64 encoded data. I wanted to extract those embedded images from the resulting SVG. But I didn't want to use the "export bitmap" option on Inkscape to extract those images, as within this way I wouldn't really know the original resolution besides the fact that Inkscape would re-encode the image data. So I wrote this one line to extract all images from one SVG. i=1; grep data:image test.svg  | cut -d "," -f 2 | cut -d \" -f 1 |while read line ; do echo $line | base64 --decode >  $i.png ; i=$((i+1)); done 

Now, the kid's time

After my little experiment wit clay stop motion animation (link), I brought the camera home and showed the process to my kids... My older son wanted to give it a try... And here is his first movie.

Clay stop motion

A colleague from just the neighbor lab found an old webcam, which has no support (driver) for his Windows 7... He asked me to try to find a Windows 7 driver or some driver which make the cam work for him... As I use a Linux workstation, I've just plugged the camera into an USB port to see what do I get. The camera worked pretty nicely...So we've launched "Cheese" and grab some pictures of some clay that was laying around... It took less than 5 minutes to make this small animation... https://youtu.be/KD4sKULZF_U After that, he forgot the windows driver and he lent that camera to me to play with the kids.

Emptying an entire CVS directory tree

Another one on CVS. Keeping old projects in which one would spend so much effort to do a full migration to another version control system than just learn to live with the CVS limitations makes you find some weird workarounds... In CVS you can't rename a directory, you can't either remove a directory. Instead, you can remove all files in the directory tree you want to remove, and do a "CVS update -P" pruning empty directories. So, how to easily empty an entire directory tree? The find has a "-not" operator which lets you make an inverse logic. For example, you can find -name CVS to locate the CVS control directories and find -not -name CVS to find files other than the CVS control directories. Finally, to empty an entire directory, but not touching the CVS control files and folders, one could run the following line: find . -not -name CVS -a -not -name Entries -a -not -name Root -a -not -name Repository -not -type d | xargs rm; cvs remove

Arduino without arduino IDE

It has been a long time since my last post about hardware or embedded software... This one is just about a link to: A Brief Tutorial on Programming the ATMega (Arduino) without Arduino Software http://brittonkerin.com/cduino/lessons.html The part which had call my attention most was the lesson 11, on persistent storage using the EEPROM. There are much more, it worth a careful the reading.

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, re...