Posts Tagged ‘Tools’

Changing the timezone on a Ubuntu server

Wednesday, March 10th, 2010
bash# sudo dpkg-reconfigure tzdata

Then just follow the instructions on the screen to select your time zone.

While we’re at it, let’s sync the time with the atomic clock:

bash# sudo ntpdate
10 Mar 09:55:19 ntpdate[23121]: adjust time server offset -0.009830 sec

Recursive diff: which files were changed?

Tuesday, July 15th, 2008

Here’s how to tell which files were changed between two directories, if you don’t need to know the details of the differences:

diff -Bbrq folder1 folder2

-B = Ignore changes that just insert or delete blank lines.
-b = Ignore changes in amount of white space.
-r = When comparing directories, recursively compare any subdirectories found.
-q = Report only whether the files differ, not the details of the differences.

It comes out handy to compare two directories checked out of SVN (for instance the prod folder and the staging folder).

Opaque to transparent gradient on layers in GIMP

Thursday, June 19th, 2008

1. Turn on Alpha channels (Layers/Transparency/Add alpha channels) if not already done
2. Click on the Gradient tool (L shortcut)
3. In the toolbox window under the tools appears the properties for the Gradient tool.
4. Click on the big rectangular icon and you see the setting by default is usually FG to BG (meaning the gradient will appear between the foreground color and the background color, with no transparency)
5. In the drop-down list that appeared select “FG to transparent
6. Choose you foreground color
7. On the layer, use the gradient tool by clicking and maintaining the left mouse button, moving the mouse in the direction of the gradient, and releasing the button where you want the gradient to stop (the layer will be totally transparent starting from where the mouse was pointing when you released the button)

Loops in Bash scripting

Wednesday, June 18th, 2008

Here is a quick snippet of bash scripting to build a loop:

for fruit in "apple red" "banana yellow" "pear green"
   set -- $fruit           #parses the variable $fruit and sets the positional vars ($1, $2, $3,...)
   echo "The fruit named $1 is of color $2";

Undo committed changes in SVN

Tuesday, June 17th, 2008

Your last revision 505 of a file should have never happened? You want to revert to 497? Here’s how:

svn merge -r 505:497 bank.php
svn commit

It will bring back locally bank.php to revision 497.
And if you commit right away, it will commit 497, like if commit 505 never happened

Detailed explanation from the SVN manual

vi handy settings in .vimrc

Sunday, May 11th, 2008

set showmatch
set incsearch
set background=dark
syntax on
set ignorecase
set smartcase
set ruler
set hlsearch
colors darkblue