A chronological documentation test project, nothing serious, really!

23 Jun 2008 Oneliner to determine directory size

This is a simple oneliner to determine which user has used most diskspace in their /home directory

du -sm $(find /home -type d -maxdepth 1 -xdev) | sort -g

The result could look something like this

215     /home/userT
1367    /home/userB
10865   /home/userL
25326   /home/userY
116328  /home/userH
154426  /home/

The numbers to the left is size i MB.


Posted by

09 Jun 2008 Color channel swapping in Photoshop

This is a little HOWTO (or tutorial) about swapping/inverting two color channels. I will swap the red and the blue color channel using Adobe Photoshop CS 3 to create a more “normal” looking picture with a blue sky on my infrared photo taken with my Nikon D80 and a Hoya R72 67mm IR-filter. I will not describe how to take a IR photo and I will assume you have access to such a filter and know how to use it properly.

The result after this HOWTO should look something like this spring image taken some days ago. Not one of my best photos but it will do the job in this post.

  1. Open the IR photo file in Photoshop, presumeably a RAW file. In my case a Nikon NEF-file.
  2. Open the file whith the White Balance set “As shot”.
  3. The photo might look something like this

  4. Go to the menu and choose Image –> Adjustments –> Channel Mixer… Now you can change the Red Output Channel and set the value for Red to 0% and change the Blue value to 100%. On the Blue Output Channel you set the blue Source Channel to 0% and Red to 100%.
  5. Now we will let Photoshop adjust the levels and colors using the menu Image –> Adjustments –> Auto Levels followed by Image –> Adjustments –> Auto Color.
  6. The result image should look something like this

Thats all that is needed to swap or invert two color channels in Photoshop CS3.

This HOWTO has not been tested on on earlier versions of Photoshop but I guess the features I’ve used aren’t new.

Tags: , , , , ,

Posted by

03 Jun 2008 Generate a /etc/hosts file from the command line

This is a simple example of how you can populate a /etc/hosts file with 100 IPs and hosts from the command line

# N=1; for i in $(seq -w 100); do echo "192.168.99.$N host$i"; P=$(expr $P + 1); done >> /etc/hosts

The result file /etc/hosts host001 host002 host003 host004 host005 host006 host007 host008 host009 host010 host011 host012 host013 host014 host015 host016 host017 host018 host019 host020


Posted by