Latest entries

I own a MacBook Pro and lately I wanted to upgrade my MacOS Leopard to Snow Leopard. My MacBook Pro had three partition:

  1. Leopard
  2. Linux
  3. Linux Swap

Unfortunately Snow Leopard complained during installation that it couldn't find a partition to install the OS. Therefore I thought this might be connected with my partitions of the hard disk. After a complete backup of all my files on the Linux partition I deleted both Linux partitions and resized the hard disk with GParted so that there was only a single partition. Then I restored my data by using Time Machine. First Time Machine couldn't find the partition because I had chosen another name than the one used during backup with Time Machine. I changed the name back to the previous one and Time Machine restored my data without any problems.

Now Snow Leopard could be installed but after rebooting I ran into a new problem. I pressed Apple-V during boot up and my computer got frozen after this line:

AppleIntelCPUPowermanagement: Initialization complete Screenshot

I couldn't find a solution in the web so I just tried to reinstall Snow Leopard. After the second installation the problem was gone and since then I haven't had troubles anymore.

Maybe I had a pending update in the installation queue and therefore my system was messed up? We will never know ... ;-)

Last Updated (Friday, 23 October 2009 16:21)

 

Today I had to copy several PDFs from various subdirectories to another folder. To find all occurrences of a certain type of file I used find and piped the result to cp.

cd /home/andreas/papers
find . -name *.pdf -exec cp {} /destination/path \;

All arguments to find are taken to be arguments to the command until an argument consisting of ';' is encountered[1]. The '\' escapes that character to protect it expansion by the shell. '{}' represents the list of files retrieved by find. So we can use find for a lot of different tasks which actually makes life quite easy ;)

 

[1] man page of find

Last Updated (Wednesday, 11 November 2009 20:11)

 

Some people, including myself, have old cameras or cell phones that can take pictures. Unfortunately those older models do not save the orientation (landscape or portrait) and therefore time consuming postprocessing is needed to rotate all images. I'm currently developing a prototype that analyzes images and rotates them without user interaction. I'll keep you updated and I'll prepare a beta version that will be available here.

Last Updated (Friday, 09 October 2009 18:25)

 

I had a bunch of files containing a certain string "foo" that I'd like to substitute with "bar". That can be done in Linux within seconds. I don't know anything shipped with Windows that is capable of recursively renaming files like rename does.

e.g.  You want to substitute every string "foo" of  your set of PNG images with "bar".

foo001.png
foo002.png
foo003.png
rename 's/foo/bar/'g *.png
bar001.png
bar002.png
bar003.png

If you don't trust your regular-expression skills just add -n after rename to get a list showing old and new filenames.

 

 

Last Updated (Thursday, 08 October 2009 15:34)

 

Sometimes single color-channels are needed for further processing and therefore we have to grab a graphic tool of our choice to accomplish that task. If you have a stack of images it can get very tedious. So why not use a handy script? I've written a short bash script that extracts red, green and blue channel from all images in the current directory storing each channel with postfixes _red|_green|_blue. Again you can change the output format at line 16, 18 and 20 to your desired format. If your input images are not PNG files then you have to change the input format at line 7 (e.g. .png -> .jpg).

#/bin/bash
# RGB splitter
#

#set debug

find . -type f | /bin/grep .png$ |while read file
do
 filenoext=${file%%.png}
 filenameout=$filenoext.png #change filetype here
 echo "Processing $file"
 echo "Output R=$filenoext""_red.png"
 echo "Output G=$filenoext""_green.png"
 echo "Output B=$filenoext""_blue.png"
 echo "Processing R"
convert "$file" -channel R -separate "$filenoext"_red.png
 echo "Processing G"
convert "$file" -channel G -separate "$filenoext"_green.png
 echo "Processing B"
convert "$file" -channel B -separate "$filenoext"_blue.png
done

Last Updated (Wednesday, 07 October 2009 22:20)

 
Polls
What OS are you using?
 
Sponsored links: