Thursday, June 12, 2014

Xubuntu: Take screenshot of current window only

Pressing Prt Sc button on the keyboard takes screenshot of the entire desktop. To take the screenshot of the selected/current window only, we can use Alt + Prt Sc

Tuesday, June 10, 2014

ImageMagick: get size and resolution (DPI) of images

To get size and resolution in DPI of many images at once using ImageMagick, we can use this command:identify -format "%w x %h %x x %y\n" *.tiff This result for example in:576 x 432 72 PixelsPerInch x 72 PixelsPerInch 576 x 432 72 PixelsPerInch x 72 PixelsPerInch 576 x 432 72 PixelsPerInch x 72 PixelsPerInch 576 x 432 72 PixelsPerInch x 72 PixelsPerInch 576 x 432 72 PixelsPerInch x 72 PixelsPerInch 576 x 432 72 PixelsPerInch x 72 PixelsPerInch

Friday, June 06, 2014

Python 3.4: Check if module installed

To check whether a given module is install in Python 3.4, we can use PathFinder.find_spec class method. For example, to check if pyperclip moduel is installed / available we can use the following code:

Wednesday, May 28, 2014

Google: search for websites containing exactly the given word or pharase

To search for websites containing exactly the given word or phrase, one can use allintext: operator. For example:
allintext:"some phrase"

Friday, May 23, 2014

Python 3 and tkinter: scroll canvas with mouse wheel and drag it around with middle mouse button

This is an example in Python 3.4 running in 64-bit Ubuntu 14.04 of a canvas that can be scrolled with mouse wheel and dragged around with middle mouse button. Hope this example will be useful to you.

Wednesday, August 28, 2013

ImageMagick: batch resize and DPI change

mogrify -resize 59.06% -density 150x150 *.tif
mogrify -resize 1024x1234 -density 150x150 *.tif
If the images are in grayscale than the above will convert them to RGB. Thus one can use the following: mogrify -resize 59.06% -density 150x150 -colorspace gray -layers flatten *.tif
mogrify -resize 1024x1234 -density 150x150 -colorspace gray -layers flatten *.tif

Wednesday, August 14, 2013

Matlab: split vector into number of parts of roughly the same size

%split into 3 parts
chunckCell=splitvect(1:10, 3);
chunckCell{:}
ans = 1 2 3 ans = 4 5 6 7 ans = 8 9 10

Wednesday, July 24, 2013

Ubuntu: Install java 7 source (openjdk-7-source)

sudo apt-get install openjdk-7-source

The src.zip that is going to be installed by this command can be found: /usr/lib/jvm/java-7-openjdk-i386 or
/usr/lib/jvm/java-7-openjdk-common

Saturday, July 20, 2013

Arch Linux: xfce 4.10 panel freezes

From time to time the xfce 4.10 panel freezes. Instead of restarting or logging out, one can just kill it and it should restartkillall -9 xfce4-panel