Search This Blog

Monday, November 20, 2006

Energy converter v0.1

I've just created small Python/Tkinter program to convert values of energies. At the moment you can convert from (to) au, eV, nm and cm-1. Not much, but it is beginning :). Program can be download from mml website.

How to list files in subdirectories

I wrote a shell script which allow to list files and only files in all of subdirectiories of current directory. I don't know if it useful but it nice piece of shell code:
#!/bin/sh
for i in `find $PWD -maxdepth 1 -type d`
do
    (cd $i; echo $i; find -maxdepth 1 -type f| wc -l)
done

Saturday, November 18, 2006

The Python Challenge

I nearly become addicted. To what? To Python Challenge. It is a set of puzzle which can be resolved with Python (you can use other language, but it is design for Python). I don't remember when I have so much fun. It is great think if you what to learn Python or just test your skills. It is my 50th note and I started write this blog 1 year and 3 days ago!

Molekel 5.0 alpha

I wrote that Molekel was rebirth and version 4.6 was release. Recently, I found that the project has been moved and alpha version of Molekel 5.0 can be found hear. So, right now we have:
  1. 4.3. It is very old version and the sources are close. [website]
  2. 4.6. The whole project has been rewritten and it is alpha version, not all functions from 4.3 version are working [website]
  3. 5.0 New, not ready yet version with open source (GPL). [website].

Tuesday, November 14, 2006

Physics for 'normal'

I found another interesting blog related to science. This time some physics. You can find there a lot of interesting news: i.e. the info about physics of new NBA ball or fastest waves ever photographed.

Saturday, November 04, 2006

Loooong bash command

I like bash command. This one is quite long:
for ((i=1;i<36;i++)); do if [ $i -lt 10 ]; then j=0"$i" ; else j="$i" ; fi ; wget --no-check-certificate https://www.linux-magazine.pl/issue/$j/; done
It could be interesting for someone, because in one line there are loop (C-style) and if command. This command download the contents of all Polish LinuxMagazine issues. I have got most of LM issues, but searching some information thru them are quite boring. So I thinking about making some kind of 'searching machine' because one from LM website is weak. My command once more, but this in more readable form:
for ((i=1;i<36;i++)); \
do \
 if [ $i -lt 10 ]; \
    then j=0"$i"; \
    else j="$i" ; \
 fi; \ 
 wget --no-check-certificate https://www.linux-magazine.pl/issue/$j/; \
done

Wednesday, November 01, 2006

Mencoder (part II)

My second example of using mencoder: I had the problem with large avi file which didn't fit CD (it had 1.4 gb). I used mencoder to split this file(console rulez ;). Creating of the first part was quite easy (I found the advices here and here).
mencoder -ovc copy -oac copy -ss 0 -endpos 700mb -o movie_part1.avi movie.avi
But there were no info where I should start the second part. I watched the end of the part 1 and manually (eyelly ;) chose the best point to split the movie (for example 1:05:25). This time I could creat two parts.
mencoder -ovc copy -oac copy -endpos 01:05:25 -o movie_part1.avi movie.avi
mencoder -ovc copy -oac copy -ss 01:05:25 -o movie_part2.avi movie.avi

Mencoder (part I)

I like console. So I'm using it even to manipulate video files ;). My first example of using mencoder: I'm recoding files from my camera (Fuji FinePix 5600/5200). It use two passes technique (it should give smaller out file). I don't know if my options are optimal, I found it somewhere (I don't remember where). The input file is the first argument and output file is second argument of my script.
#!/bin/sh
mencoder $1 -ovc lavc -lavcopts \
vcodec=mpeg4:vpass=1:vbitrate=1000:vlelim=-4:vcelim=9:lumi_mask=0.05:dark_mask=0.01 \
-oac copy -o /dev/null
mencoder $1 -ovc lavc -lavcopts \
vcodec=mpeg4:mbd=2:trell:vpass=2:vbitrate=2000:vlelim=-4:vcelim=9:lumi_mask=0.05:dark_mask=0.01 \
-oac copy -o $2
Sailing through the net (I tried to find the place with mencoder option) I reached Mario Valle website. It seems very interesting. I have to read it careful and write more about it. Right now, I'm adding his blog to my list.

Thursday, October 19, 2006

SwapFile

Most of people (even Klauss Knopper [1]) think that swap partition has better performance compare to swapfile (Ok. Most of people don't know what is swap file or swap partition ;). However, it isn't true, at least for 2.6 linux kernel. Check thread at Linux-Kernel Mailing list [ 2]. I think the most important is the 3rd point
Does creating the swapfile on a journaled filesystem (e.g. ext3 or reiser) incur a significant performance hit?
and answer
None at all. The kernel generates a map of swap offset -> disk blocks at swapon time and from then on uses that map to perform swap I/O directly against the underlying disk queue, bypassing all caching, metadata and filesystem code.
[1] Klaus Knopper, "Questions and Answers", Linux Magazine Polish ed., 3(25) March 2006, pp 38-40.
[2] Andre Morton et al., "Swap partition vs swap file" thread Linux-Kernel Mailing List, July 2005.

Saturday, October 07, 2006

Camera.sh v2

I rewrite my script for converting raw format pictures. Now, it is converting files from raw to jpg in loop. Doing first convert of all raw files take a lot of space (ppm files are BIG). Right now I need space for one ppm file. Morover, ppm->jpg converting and resizing are made in one step. I found very nice perl program (ExifTool) to managing exif info.
#!/bin/sh

EXIFPATH=/opt/Image-ExifTool-6.36
for raf in *.raf
do 
        dcraw -w $raf
        name=`basename $raf .raf`
        jpg=`basename $name`.jpg
        ppm=`basename $name`.ppm
        echo $name
        convert -resize 800x600 $ppm $jpg
        $EXIFPATH/exiftool -TagsFromFile $raf $jpg
        rm $ppm $jpg"_original"
done

Tuesday, October 03, 2006

Overwriting a line in Vim

Finally, I've learn how to overwrite the whole line in Vim. First you have to yank the line you would like to copy (yy), next to mark the destination line (V) and paste the first line (P or p on it), what gives VP. I found it here.

Monday, September 18, 2006

Blog with many science video lectures

Sometime ago I found Free Science and Video Lectures Online!. It's the place where Peteris Krumins try to list video courses which are related to physics, mathematics, chemistry etc. from all over the world (MIT, Berkeley).

Wednesday, September 06, 2006

Fonts in Linux

There is great HowTo about fonts in Linux.

Tuesday, September 05, 2006

ls and find

I'm all the time learning new things about unix command. Recently, I found new feature of ls and find command.

ls -Ssh
-S lists files and directories in size order,
-s prints size,
-h does it in human readable way.

find -mtime -1
-mtime looks for files modificated later/earlier/exactly n days from now (in my example today and yesterday).

Saturday, September 02, 2006

Benchmarking Filesystems - part II

There is another article benchmarking Linux's filesystems. And the winner is XFS - again.

Tuesday, August 22, 2006

Mcabber

I've found very nice, small but powerful console jabber client. It's name is Mcabber. I also created its port for Crux.

Friday, August 18, 2006

My dalton's problems

I created a website, where I share some info about my problems with Dalton. At the moment there is only one point (problems with HF direct convergence).

Friday, August 11, 2006

Full info about your jobs in PBS

To get full info about job in PBS you have to use -f option, but it doesn't work with -u $USER option, so you get a list of all jobs, or you have to know yours job id. To get around this problem I created this one line 'script':
qstat -f `qstat -u $USER |grep $USER |awk {'print $1'} |sed 's/[a-z.]//g'`
  • qstat -u $USER - create the list of all user jobs,
  • grep $USER - cut lines with usernames,
  • awk {'print $1'} - prints only column with job id (first one),
  • sed 's/[a-z.]//g' - delete all letters and dots from it.
After that you have only id numbers which can be use with qstat -f. You can extent this command further, i.e. to get info about host where you job is running, by adding grep host (it can be very useful at a cluster).

Thursday, July 20, 2006

CCLib

The new version (0.5) of CCLib has been release. CCLib is an open source library, written in Python, for parsing and interpreting the results of computational chemistry packages. It currently parses output files from ADF, GAMESS (US), Gaussian, and PC GAMESS.

Wednesday, June 28, 2006

gaussfield.sh v0.1

It can be very useful to obtain value of some molecular properties in electric field. I.e. you can get dipole moment of excited states from energies in fields F and -F, hyperpolarizability from analytic polarizability etc. But it's quite annoying to create many very similar Gaussian input files, so I wrote short script to created this files:
#!/usr/bin/env bash
for i in $*
do
        name=`basename $i .com`
        sed -e '/^%/d; /^#/s/$/ Field=X-10/' $i > ${name}-x.com
        sed -e "/^%/d; /^#/s/$/ Field=X+10/" $i > ${name}+x.com
done