Setup postgreSQL RDS using Ansible

Setting up PostgreSQL on RDS using ansible is a bit tricky because the main user on RDS is not a SUPERUSER and roles membership is not automatically granted for ex: “ERROR: must be member of role ..” is quite common. Here is a working solution:

Custom validation messages for sails js

//in api/models/User.js
function validationError(invalidAttributes, status, message) {
  var WLValidationError = require('../../node_modules/sails/node_modules/waterline/lib/waterline/error/WLValidationError.js');
  return new WLValidationError({
      invalidAttributes: invalidAttributes,
      status: status,
      message: message
var User = {
  attributes: {
  ownValidate:: function (values, update, cb) {
    //example of not allowed param on update
    //if it is an update then do not allow email param
    if (update && {
      return cb(validationError({
        email: [
            message: 'Email is not allowed for updates.'
      }, 400 /*status*/));
    sails.models['user'].findOne( (err, user) {
      if (err) return cb(err);
      if (user) {
        return cb(validationError({
          email: [
              rule: 'E_UNIQUE'
              /* unique validation message is left for the default one here */
        }, 409));
  beforeCreate: function (values, cb) {
    return sails.models['user'].ownValidate(values, false, cb);
  beforeUpdate: function (values, cb) {
    return sails.models['user'].ownValidate(values, true, cb);

For blueprint custom messages validation

Add full previews to your twitter feed on WordPress using Ozh’ Tweet Archiver

Ozh’ Tweet Archiver is a WordPress plugin that can archive your tweets on your own blog; it simply creates a new post for each tweet. Additionally, it offers converting hashtags to WordPress tags, and several other features. Nevertheless, one feature, I thought might be interesting, is to process the links on tweets and show them as a Facebook feed. Recently, I modified the code and it worked very well on my blog: Gadelkareem Tweets.

– All we need is to modify the “wp-content/plugins/ozh-tweet-archiver/inc/import.php” file as following:

install memcached 1.4.13 on CentOS 6.2

– Make sure to check PHP-FPM and MYSQL posts.

– One of the dependencies of memcache is libevent, get latest version from

mkdir libevent
cd libevent
tar xfz libevent-2.0.17-stable.tar.gz
cd libevent-2.0.17-stable

– get latest version from