Using s3cmd to recursively update the meta data on a bucket

In our case, we needed to set the Expires and Cache-Control headers on all the files in one of our buckets for optimization purposes. Here’s what we did. Only the newest version of s3cmd supports the modify command, so if you have an old version installed, run apt-get remove s3cmd to remove the old version. Read more about Using s3cmd to recursively update the meta data on a bucket[…]

Clearing out spam comments in Drupal 7

Very often for a Drupal installation, we come across hundreds of spam comments, in spite of installing spam blockers such as Mollum. If you do need to remove comments manually, the best method is by connecting directly to your MySQL instance and executing the following set of SQL queries. DELETE FROM comments WHERE status = Read more about Clearing out spam comments in Drupal 7[…]

nginx: Prevent search engines from indexing your development server

If you nginx powered development instances are showing up in Google search results, there is a quick and easy way to prevent search engines from crawling your site. Add the following line to the location block of your virtualhost configuration file for the block that you want to prevent crawling. add_header  X-Robots-Tag “noindex, nofollow, nosnippet, Read more about nginx: Prevent search engines from indexing your development server[…]

AngularJS: Show elements based on filtered results

If you ever need to show a container only if the filters of the repeated elements have one or more results, then you can do it using this code. <input ng-model=’searchText’/> <span ng-show=’filtered.length > 0′> <ul> <li ng-repeat=’el in filtered = (model | filter:searchText)’> <div>{{el.label}}</div> </li> </ul> </span> Source: StackOverflow

Creating an SSL certificate for Postfix/Courier IMAP on Ubuntu

If your SSL certificate has expired and you have chosen to go with PositiveSSL(Comodo), this post may help you out. 1. Generate your Certificate Signing Request (CSR) openssl req -new -nodes -newkey rsa:2048 -keyout servername.com.key -out servername.com.csr 2. Get your Certificate by signing the CSR file to Comodo and you will receive the Certificate by Read more about Creating an SSL certificate for Postfix/Courier IMAP on Ubuntu[…]

Adding a single post template based on parent category

We often have requirements where posts under a single category must be shown using a different template file in WordPress. THe code below allows you to search for a post’s parent or grandparent category and show the template based on the parent or grandparent category. Add the following code to your functions.php to find the Read more about Adding a single post template based on parent category[…]

Adding Swap Space to Amazon EC2 Micro Instances

Most of us use EC2 micro instances for prototyping and running small servers. If you use MySQL on an EC2 machine, you may experience the MySQL server automatically shut down with the /var/log/mysql/error.log file reading as below: 140516 10:54:24 InnoDB: Initializing buffer pool, size = 128.0M InnoDB: mmap(137363456 bytes) failed; errno 12 140516 10:54:24 InnoDB: Read more about Adding Swap Space to Amazon EC2 Micro Instances[…]