Create test files of specific size

Sometimes you need file of an exact site for testing purpose like an email attachment.

Here is how you make them in Linux command line:

dd if=/dev/zero of=file_5Mb.txt bs=1k count=5120
dd if=/dev/zero of=file_7Mb.txt bs=1k count=7168
dd if=/dev/zero of=file_8Mb.txt bs=1k count=8192
dd if=/dev/zero of=file_8.8Mb.txt bs=1k count=9011

Create test files of specific size

dd if=/dev/zero of=file_5Mb.txt bs=1k count=5120
dd if=/dev/zero of=file_7Mb.txt bs=1k count=7168
dd if=/dev/zero of=file_8Mb.txt bs=1k count=8192
dd if=/dev/zero of=file_8.8Mb.txt bs=1k count=9011
dd if=/dev/zero of=file_9Mb.txt bs=1k count=9216

ls ./file_* -lah
-rw-r--r-- 1 rob disk 5,0M feb 20 14:30 ./Desktop/file_5Mb.txt

Strange character in linux man pages

If you got strange characters in you man pages here is how to fix this.

Method 1

PuTTY's default translation is ISO-Latin-1. Ubuntu's default console locale is based on UTF-8. You have to change one of them to match the other. In PuTTY, change the translation to UTF-8, or from terminal set the locale with LC_ALL to ISO-Latin-1.

  1. Open PuTTY
  2. Select a session

My personal NFS mounts in /ets/fstab

Here are my personal mount in /etc/fstab for mounting my server to the filesystem on my Desktop and Lapto

First install nsf-common

apt-get install nfs-common

Make the mountpoint on the local filesystem

mkdir /extra
mkdir /home/rob/[HOSTNAME]

Add to /etc/fstab


robox:/extra /extra nfs rw,nfsvers=3,hard,intr 0 0

How To Resize images with command line

Photo-Edit-Logo.png

If you want to resize your photos it's simple to use resize tool in gThumb. Unfortunately gThumb deletes all the EXIF data like date and time the photo was taken.

To keep all EXIF data I use convert (from imagemagic)

find ./ -iname *.JPG" -maxdepth 0 -exec convert {} -resize 50% ./resized/{} \;

How To Adjust Date and/or Time setting in EXIF date from JPG pictures

EXIF-Logo.png

Sometimes it happend: The clock from your digital camera isn't on the right time. So all your pictures have the wrong date or time in EXIF data. This can be a very big problem if you use more than one camera and want to sort the pictures of a event on the date and time that the picture was taken.

How To Kill Pulseaudio when audio stucks

PulseAudio-Logo.png

Steps to kill pulsaudio.
Solution for when there is no sound and the soundservers is blocked by pulseaudio

On my desktop machine I have frequently a problem with Pulseaudio. After playing a flash movie (Youtube) it happens very often that I have no audio anymore on my Moviplayers like Movie Player or VLC.

The solution for this problem is to kill all Pluseaudio processes.

How To Resize multiply images to prefered size

Photo-Edit-Logo.png

If you want to resize multiply images to a other (smaller) size you can use this command.

It's not recommend to enlarge pictures because that will have a negative effect on the quality of the enlarged image.

time find ./ -maxdepth 1 -iname '*.jpg' -exec convert '{}' -resize 500 '../big/{}' \;

* time: gives you the time the command was busy. This is optional.

How To add subtitles to a movie and save is to a new file

VLC-Logo.png

Add subtiltes to a new outputfile.
incl. resizeable subtitles, percentage from picture hight. So it can be shown on the Philips media player

mencoder -fontconfig -subfont-text-scale 3 -ovc lavc INPUT-FILE.avi -sub "SuBFILE.srt" -oac copy -o OUTPUT-FILE.avi

How To Add subtitles in Mplayer

MPlayer-Logo.png

Playing a movie with "hot" added subtitles.

Use this command:

mplayer -fontconfig -subfont-text-scale 3 INPUT-FILE.avi -sub "SuBFILE.srt"