Archive

Archive for February, 2009

How To Get Yesterday’s Date using BASH Shell Scripting

February 17th, 2009 Masao 2 comments

The new short way:
$ date -d '1 day ago' +'%Y/%m/%d'
2009/07/21

Or the longer way:
Yesterday in epoch seconds
$ yesterday=$((`date +'%s'` - 86400))

Get default formatted yesterday's date
$ date -d "1970-01-01 $yesterday sec"
Tue Feb 17 01:27:32 PST 2009

Same thing in YY-MM-DD
$ date -d "1970-01-01 $yesterday sec" +"%Y-%m-%d"
2009-02-17

Categories: Bash, Linux Tags:

How To Centralize Bookmarks using Firefox and Google Bookmarks

February 12th, 2009 Masao No comments
  1. Create a label in Google Bookmarks with all the bookmarks you want to centralize.
  2. Then, create a live bookmark in Firefox with the following URL, replacing the label name with the one you created:

http://www.google.com/bookmarks/lookup?hl=en&sort=title&output=rss&q=label:live

Categories: Firefox Tags:

How to Quickly Add Multiple Indexes to a MySQL Table

February 10th, 2009 Masao No comments

Instead of:


ALTER TABLE my_table ADD KEY `key1` (`apple`);
ALTER TABLE my_table ADD KEY `key2` (`banana`);

do this:


ALTER TABLE my_table
ADD KEY `key1` (`apple`),
ADD KEY `key2` (`banana`);

Categories: MySQL Tags:

ssh_exchange_identification: Connection closed by remote host

February 5th, 2009 Masao No comments

On the destination server, remove the known_hosts file:

rm ~/.ssh/known_hosts

Also, try this in your /etc/hosts.allow file

/etc/hosts.allow:
SSHD: ALL

Categories: Linux, SSH, Troubleshooting Tags: