Monday, March 26, 2012

Memoization

Memoization is a way to make code run faster by saving
previously computed results. Instead of needing to recompute the value of an
expression, a memoized computation first looks for the value in a cache of pre-
computed values. (caching)

Friday, March 2, 2012

restart Drush cron

DELETE FROM variable WHERE name="cron_semaphore";
DELETE FROM variable WHERE name = "cron_last"
drush cc all

Wednesday, February 1, 2012

Friday, January 27, 2012

pushd and popd

pushd saves the current working directory in memory.
popd returns to the path at the top of the directory stack.

Example
[sputnik@localhost html]$ pushd . # push current directory to memory
/var/www/html /var/www/html

[sputnik@localhost etc]$ cd /var/games/ # change directory

[mshnaydman@localhost games]$ popd # returns from directory
/var/www/html
[sputnik@imagick-test html]$

For more information, read the Wiki Page

Resize & write data into image

I had task to resize image and add unique identifier. See below handful utilities.

- Exiv2 (manage image metadata. Supports IPTC, Efix, XMP and others formats)
Example: Add the field to IPTC
[sputnik@test_hires] iptc -M"add Iptc.Application2.SpecialInstructions blah blah" myfile.jpg

- Imagemagick (resize, edit, view images or more)
Example: Resize image to 200x200 pixels
[sputnik@test_hires] convert -resize 200x200 myfile_input.jpg myfile_output.jpg

- Identify (image characteristics. is a member of the ImageMagick suite of tools)
Example: Get image size
[sputnik@test_hires] identify -format '%w:%h' $source

- File (determine file type)
Example: Get Filename information. For more 'man file'
file -i $filename | cut -d':' -f 2

Sunday, January 8, 2012

Astronomy Lectures

I start getting into Astronomy for last few weeks and find the subject very interested.
Here are 3 lectures by professor David Helfand that I find interesting:

Astronomy Lecture 1: What Is a Star?
Astronomy Lecture 2: Lives of the Stars
Astronomy Lecture 3: Planets Everywhere


There lectures still available in Google Videos.

Thursday, December 15, 2011

cd command

Few most useful b commands
cd - # move back to the previous directory
cd ~ # move into your home directory
cd .. # move up one directory