#!/bin/bash # # this acts as a remote diff program, accepting two files and displaying # a diff for them. Zero, one, or both files can be remote. File paths # must be in a format `scp` understands: [[user@]host:]file [ -n "$1" ] || [ -n "$2" ] || [ -n "$3" ] || \ { echo "Usage: `basename $0` file1 server1 server2" && exit 1;} if test -e $4 then opt="-b" else opt=$4 fi scp "$2:$1" rdiff.1 >& /dev/null scp "$3:$1" rdiff.2 >& /dev/null diff $opt rdiff.1 rdiff.2 rm -f rdiff.1 rdiff.2
Kind of my extended memory with thoughts mostly on Linux and related technologies. You might also find some other stuff, a bit of SF, astronomy as well as old (quantum) chemistry posts.
Search This Blog
Wednesday, January 28, 2009
Remote diff
Monday, December 29, 2008
How to create pictures thums in the one line
for i in `find /path/to/directory/with/pictures -iname "*.JPG"`;\ do\ convert $i -resize 800x600 `dirname $i`/thumb-`basename $i`;\ doneThe
find
command return a whole path to a file. But we want to add thumb- before the actual name of a file. Therefore `dirname $i`
ensure that convert
get the proper path and `basename $i`
the actual file name (preceded by thumb-).
It is also worth to note the iname option of find command. It is case insensitive version of the name
.
Monday, December 22, 2008
Another Awk one-liner
awk 'BEGIN {a=1} \ {if ( $1 == "Mem:" ) \ {printf "%4d %s\n", a, $3; a++}}' \ free-prefork.log >mem-prefork.logBTW. This script is to help me to plot a gnuplot graph based on "used memory" number from free command.
plot "mem-prefork.log"
will do the rest of job.
UPDATE
Mike Hommey post force me to rethink my scripts and I found easy way to eliminate if clause:
awk 'BEGIN {a=1} \ /^Mem:/ {printf "%4d %s\n", a, $3; a++}' \ free-prefork.log >mem-prefork.log
Monday, December 08, 2008
Gnuplot with readline on MacOSX
find . -name Makefile \ -exec sed -i.old "s/TERMLIBS\ =/TERMLIBS = -L\/usr\/local\/lib/" {} \;Two more things about gnuplot and MacOSX.
- I started to think to make a gnuplot.app for MacOSX, but sure how it should work.
- I found that X11 term is much better then Aqua, in particular, it's allow to rotate 3D (s)plots.
Tuesday, December 02, 2008
Header for bonnie++ csv file
,,Sequential,Output,,,,,Sequential,Input,,,Random,,Sequential,Create,,,,,Random,Create, ,,Per Chr, ,Block, ,Rewrite, ,Per Chr, ,Block, ,Seeks, ,Create, ,Read, ,Delete, ,Create, ,Read, ,Delete Machine,Size,K/sec,%CP,K/sec,%CP,K/sec,%CP,K/sec,%CP,K/sec,%CP,/sec,%CP,files,/sec,%CP,/sec,%CP,/sec,%CP,/sec,%CP,/sec,%CP,/sec,%CPYou can save above lines in the file called i.e. bonnie-header.csv and then cat it before csv part of bonnie.out file (of course it can have different name), by:
cat bonnie-header.csv `tail -1 bonnie.out` >bonnie.csvAfter that the output should looks similar to this one:

Tuesday, November 25, 2008
BigPicture
Friday, October 24, 2008
Polish UK X11 keybord layout
partial default alphanumeric_keys xkb_symbols "basic" { include "latin" name[Group1]="Poland based on GB"; key{ [ q, Q ] }; key { [ w, W ] }; key { [ e, E, eogonek, Eogonek ] }; key { [ o, O, oacute, Oacute ] }; key { [ a, A, aogonek, Aogonek ] }; key { [ s, S, sacute, Sacute ] }; key { [ f, F ] }; key { [ z, Z, zabovedot, Zabovedot ] }; key { [ x, X, zacute, Zacute ] }; key { [ c, C, cacute, Cacute ] }; key { [ n, N, nacute, Nacute ] }; key { [ 2, quotedbl, twosuperior, oneeighth ] }; key { [ 3, sterling, threesuperior, sterling ] }; key { [ 4, dollar, EuroSign, onequarter ] }; key { [apostrophe, at, dead_circumflex, dead_caron] }; key { [ grave, notsign, bar, bar ] }; key { [numbersign, asciitilde, dead_grave, dead_breve ] }; key { [ backslash, bar, bar, brokenbar ] }; include "kpdl(comma)" include "level3(ralt_switch)" };
Thursday, September 11, 2008
Trash in Ubuntu
~/.local/share/Trash/files/
Monday, September 08, 2008
Cordless USB phone - not working with Ubuntu
dmesg |grep hid
[ 33.859714] usbcore: registered new interface driver hiddev
[ 33.866820] hiddev96hidraw0: USB HID v1.00 Device [HID 06e6:c31c] on usb-0000:00:1f.4-2.2
I tried to make yealink module controlling phone.
rmmod ubhid
modprobe yealink
But, how I expected, it didn't help. Finally, the phone USB info was/is
06e6:c31c Tiger Jet Network, Inc.
PS. The seller was OK and gave me my money back.
Wednesday, August 13, 2008
Swap - VMware effects and parallelization
To present our software marketing and scientific represents use Windows laptopts with Linux in VMWare. They need Linux because our web based product (Relibase+, IsoStar and incoming WebCSD) working only on it. Using virtualization shouldn't be a problem as a machine has 2GB of memory and we can assign 1GB to guest OS. However, recently we couldn't start WebCSD, not only guest was affected but also host froze. VMWare has problem with I/O operation so we were suspicious about disk usage, but the server didn't need to much of it. Anyway I went I/O trace and decided to turn off the swap. After that server started to work as a rocket!
Parallelization of a swap partitionsI was browins through IBM developersWorks and found info that you can parallelize a swap partition.
Amazingly, all modern Linux kernels, by default (with no special kernel options or patches) allow you to parallelize swap, just like a RAID 0 stripe. By using the pri option in /etc/fstab to set multiple swap partitions to the same priority, we tell Linux to use them in parallel:
/dev/sda2 none swap sw,pri=3 0 0 /dev/sdb2 none swap sw,pri=3 0 0 /dev/sdc2 none swap sw,pri=3 0 0 /dev/sdd2 none swap sw,pri=1 0 0
Monday, August 11, 2008
Creating service starting script
- Copy the script from link [3] to your HDD and call it isostar_server
- Change line:
/path/to/command/to/start/new-service
to:/opt/csd/isostar/APACHE/bin/ccdc_apache start
and line:/path/to/command/to/stop/new-service
to:/opt/csd/isostar/APACHE/bin/ccdc_apache stop
- Remove following lines (from both start and stop subsection):
#Or to run it as some other user: /bin/su - username -c /path/to/command/to/start/new-service echo "."
- Change 'new-service' in 'echo -n' lines to 'isostar_server'.
- Now as a root copy isostar_server file into /etc/init.d/
- Again as a root invoke chkconfig and add isostar_server: /sbin/chkconfig --add isostar_server
[2] http://spiralbound.net/2006/11/15/controlling-services-with-chkconfig
[3] http://spiralbound.net/2007/07/23/example-linux-init-script
[4] http://wiki.linuxquestions.org/wiki/Update-rc.d
[5] http://www.annodex.net/cgi-bin/man/man2html?update-rc.d+8
Tuesday, July 29, 2008
Count a sum of sizes of selected files in a directory
du -m * | sort -nr | grep Qt | awk '{sum+=$1} END {print sum}'
- du -m - print used size in megabytes (for directory do not forgot about -s option);
- sort -nr - sort in reverse, numerical order;
- grep Qt - left only lines with Qt (you can also first grep and next sort lines);
- {sum+=$1} - adding a value from first column of each line to variable sum;
- END {print sum} - printing variable sum on after going through all of lines.
Monday, July 14, 2008
The electronic structure of selected betaine dyes. A quantum chemical study
This thesis presents electronic absorption spectra, non linear optical properties and geometrical parameters of betaine dyes obtained by quantum chemical calculations.
Four betaines [4-(1-piridinium-phenolan), 3-(1-piridinium-phenolan), 2-(1-piridinium-phenolan) and 4-(1-piridinium-thiophenolan)] were selected for the study.
During the research various ab initio methods were applied. The Hartee-Fock method (HF) and the second order Møller-Plesset perturbation theory (MP2) were used to determine a geometrical and NLO properties. Moreover, the NLO were obtained using chosen variants of the coupled cluster metod (CC2, CCSD) and the geometry optimizations were perform using the Density Functional Theory (DFT/B3LYP) as well as complete active space methods (CASSCF and CASPT2). In the case of spectroscopic properties the CC and CASSCF/CASPT2 methods along with Time-Dependant DFT (with B3LYP, PBE0 and CAM-B3LYP functionals) and the Configuration Interaction with Singles (CIS and CIS(D)) were used.
Results obtained during the study indicate that the correct description of betaine dyes' electronic structure is an unusually demanding test for present quantum chemical methods. It is safe to say, that, for all of the investigated parameters, the electron correlation has to be take into account. It is also worth to notify that basis set selection is less important. However, diffuse and polarisation functions should be included in the case of spectroscopic and optical properties.
The presented computational result confirmed the very strong interaction between a betaine molecule and its environment. One of the outcome of this phenomena is a large difference between experimental results (usually obtained in condense phases) and theoretical data (calculated in vacuum). Another observation verified during project is the significant increase of the betaines' NLO by the conformational shifting. Finally, it is worth notify that the largest NLO response was obtained for 4-(1-piridinium-thiophenolan).
How you can quest I'm a doctor now! I defended my thesis (abstract above) 19th of June 2008 and my degree was confirmed by faculty of Chemistry board 26th of June. Thesis was written in Polish, so it isn't very useful for most of the world. However, there is the appendix with all available theoretical data of geometrical and spectroscopic parameters of betaine dyes. Additionally, some of results was published in following articles: JMM-11, JMM-13 and LETT-411 (I hope to write one, maybe more). PDF with thesis can be download here.
If I find some time I will might prepare English version of mentioned appendix, and of course, I will share my LaTeX, gnuplot, computational experience.
Tuesday, June 24, 2008
GRUB and why root!=root
title Fedora 9 root (hd1,2) kernel /boot/vmlinuz-2.6.25-14.fc9.i686 root=/dev/sdb3 ro initrd /boot/initrd-2.6.25-14.fc9.i686.imgBut it wanted to work. All the time, I got Error 2 : Bad file or directory type. After trying many things I figured out that problem is lack of the GRUB files at the Fedora partition, so I updated grub config file.
title Fedora 9 root (hd0,0) kernel (hd1,2)/boot/vmlinuz-2.6.25-14.fc9.i686 root=/dev/sdb3 ro initrd (hd1,2)/boot/initrd-2.6.25-14.fc9.i686.imgFinally, the Fedora started to boot.
Wednesday, June 04, 2008
Yet Another Gnuplot Script

set term postscript eps enhanced color set output "nlo-rhb-cc.eps" set ylabel '{/Symbol b} [10^{-30} esu]' set style data histogram set style histogram cluster gap 1 set style fill solid border -1 set boxwidth unset xtics plot [-0.5:.7][-15000:0] "cc.csv" using 1 ti col, '' using 2 ti col, '' using 3 ti colIf you would like to try use the data below: and data:
HF/FF MP2/FF CCSD -14720.51945800 -6960.7083277 -10843.140BTW. I noted three new interesting website related to the gnuplot:
Thursday, May 15, 2008
Ian Foster blog
Monday, May 05, 2008
Tuesday, April 29, 2008
Sed one liners
echo $myvar | perl -p -e '$_ = ucfirst'However, python looks also nice:
echo $myvar | python -c "print raw_input().capitalize()"Awk one is also nice, but a bit more complicated (one line):
echo $myvar |awk '{(sub("^.",substr(toupper($1),1,1),$1)); print }'
Tuesday, April 15, 2008
Very useful MacOSX key shortcut
Friday, March 14, 2008
Povray export in Mercury CSD
