Restarting Apache web server by normal user (non root)

As a web developer I often have to restart apache, memcached and other services on my local or remote machines to do that usually I have to be root or use sudo and type my password to achieve that. lately I found a way to bypass typing the password for specific commands by adding the following lines into /etc/sudoers

{username} ALL = NOPASSWD: /etc/init.d/apache2
{username} ALL = NOPASSWD: /etc/init.d/memcached

by doing this I was able to run /etc/init.d/apache2 restart or /etc/init.d/memcached restart without typing the password.

Mysqldump over SSH

I often transfer production MySql databases to my local machine for development and testing purposes, usually I do this over SSH for security reasons.
to automate the process I combined all the commands in one line.

ssh -C {ssh.user}@{remote_host} mysqldump -u {remote_dbuser} --password={remote_dbpassword} {remote_dbname} | mysql -u {local_dbuser} --password={local_dbpassword} -D {local_dbname}

How does it work ?
I run mysqldump command remotely using ssh than I pass the output to a local mysql command using the pipe, to speed up the transfer I passed -C to ssh to compress the data.

please note this method works good on fast connections and small databases , I didn’t test it with big database, as you need to have your in a remote machine’s authorized_keys.