Scripting

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 […]

Read More
Photo etc

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 […]

Read More
Linux

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 192.168.99.201 host001 192.168.99.201 host002 192.168.99.201 host003 192.168.99.201 host004 192.168.99.201 host005 […]

Read More