Quickly install a new Drupal site (in a multisite environment) using Drush

Easy as that! Just replace with your own parameters!

drush site-install standard \
--site-name=FoobarSite \
--sites-subdir=foobar \
--db-su=adminuser \
--db-su-pw=adminuserpw \

How to optimize all tables from all databases

The following command will optimize all of your databases’ tables within MySQL.
It is important to optimize tables to reduce data fragmentation.

mysqlcheck -Aop -uroot

If you are not using root replace it with your username.

-A : Check all tables in all databases. This is the same as using the –databases option and naming all the databases on the command line.
-o : optimize the tables.
-p : Prompts for a password to use when connecting to the MySQL server.
-u : The MySQL user name to use when connecting to the server.

Inspired by this article.


Putty and tree – how to avoid weird characters (squares)

Character encoding is always a problem when communicating between Windows and Linux. And using the “tree” command is affected by this problem if you are connected to a Linux box using Putty on a Windows box. You will certainly get weird characters, probably squares.

For those who are not sure about what tree is. It is a command-line tool to list contents of directories in a tree-like format.

A solution to this problem is to force using plain ASCII characters:

tree --charset=ASCII

You can also have an alias for this command, so that every time you type “tree“, it will force tree to use the ASCII charset automatically.

alias tree='tree --charset=ASCII'

And this is an example of what you will get as an output:

|-- claws-mail-1000
|-- keyring-x803mg
|   |-- control
|   |-- pkcs11
|   `-- ssh
|-- orbit-gdm [error opening dir]
`-- virtual-user

Script to capture a screenshot (with Chromium) (Command-line)


I wanted to take screenshots of about 15 Websites, but didn’t want to install any plugins as I wouldn’t use them often. I saw a lot of how-to’s using import from Imagemagick but they capture the whole screen, not clearly what I was looking for.

Using chromium, xwininfo (from X) and import, I made this bash script which captures only the webpage. See below for the Source code.

Read the rest of this entry »