Harsh J

Memoirs of a QWERTY Keyboard

Archive for the ‘Script’ tag

Clearing all log files in /var/log

leave a comment

Stupid things you end up writing when you worry about filling disk spaces at 3 AM in the morning of the day right before your exams begin. The following will delete all your log files in a safe manner, by simply rewriting them to null.

cd /var/log
for file in `find .`
do
	if [ -f $file ];
	then
		cat /dev/null > $file
	fi
done

Suggest better methods if known, and thank you!

Optionally, get in there and delete those now-stagnant .gz files with the following:

find /var/log -name "*.gz" | xargs rm

P.s. So much for BS code highlight plugins printing angled brackets in HTML notations when asked to do bash.

Written by Harsh

May 19th, 2009 at 3:31 am

Posted in Blog,Linux,Personal

Tagged with , ,

Convert CHM files to PDF in Linux

31 comments

I’ve tried a lot of ways to do this thing in Linux (Ubuntu) and finally I found the easiest one to use.

Called simply as ‘chm2pdf‘, this is a small script written in Python and it uses a few dependencies you might have to install first.

Now to install it, simply follow this guide:

1. Install dependencies by running in the Terminal:

sudo apt-get install htmldoc libchm-bin python-chm

2. Download chm2pdf by clicking this.

3. Now extract the downloaded file.

4. Open your Terminal and browse to the folder you extracted and run:

sudo python setup.py install

5. You’re done!

Now to use it is very simple:

In Terminal, type:

chm2pdf --book filename.chm
# (Where filename is obviously your required file to be converted.)

And surprise surprise, a PDF copy will be waiting for you just next to your CHM file!

Written by Harsh

December 6th, 2007 at 12:08 pm

Posted in Linux,Software

Tagged with , , , , ,