Author Archives: james

AWS Lambda function to set Route53 DNS entries for Autoscaling lifecycle events

Some of our ECS Cluster machines need to have both public and private DNS entries So rather than update Route53 manually (super annoying), we modified the Lambda function we found here: so that it works for both internal and external hosted zones. All you need to do to get this working is add an […]

AWS Cloudformation ECS Stack json config with Launch Config, Autoscaling Group and Load Balancer

A while back, at my company we switched to using Docker and ECS for our application. I wanted a structured way to generate AWS resources and I found that AWS Cloudformation is a great way to do this. It took a lot of trial and error to figure out everything, so I thought posting a […]

RDS snapshot and restore script

A few months ago we needed to automate manual snapshot creation and restore. This is the script I came up with…

Opcache issues resolved for symlink based atomic deploys and PHP-FPM

I recently ran into problems with php-fpm and opcache using symbolic links for atomic deploys. The solution was so simple, use $realpath_root instead of $document_root in your fastcgi config. Thank you nginx, you make me feel all warm and fuzzy inside. fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name; fastcgi_param DOCUMENT_ROOT $realpath_root;fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name; fastcgi_param DOCUMENT_ROOT $realpath_root; Details below — […]

Finding your iPad’s UDID for Test Flight

I don’t know what possessed the folks at apple to make it so incredibly difficult to find your iPad’s identifier, aka your iPad’s UDID. Not sure why its not just in the iPad’s about section of the settings app, but anyway, here is how you find your iPad’s UDID for your app developer’s test flight […]

twitter bootstrap responsive container with padding and a border

I’m working on a project where I wanted to use the twitter bootstrap responsive css scaffolding, but ran into a bit of a snafu because I needed to add a border and background to the container class.  I decided to extend the @media responsive stylesheet declarations to achieve this.  The padding is not quite as […]

PHP sendmail 90 second delay on Dotcloud [solved]

For months we have been having upstream timeout issues with our Dotcloud PHP service running nginx and php-fpm.  Amongst other causes, we found that after our instances were up for more than a day, php’s mail function using sendmail was consistantly taking exactly 90 seconds to send an email.  Unacceptable. After going back and forth […]

Upstream timeout issues with nginX + php-fpm + CodeIgniter + gzip + xdebug on DotCloud – [resolved]

We have been using DotCloud as our hosting platform for months now, and overall I have been extremely pleased with their service.  There were some bumps in the road early on while they were still in their beta phase, but things have been running very smoothly for a few months now.  Everything except an uncomfortable […]

AddThis Pintrest button hack to look better in 32×32 format

Today I had to add a Pinterest Share button on our website, and run it through our AddThis account so we can track the analytics.  Unfortunately, there are only two options for the Pinterest button via AddThis, neither of which look good along side our 32×32 style share buttons.  So, I decided to hack it […]

mongodb geospatial query example in php with distance radius in miles and km

Recently for a project involving 311 reports in New York city, I had to find a speedy way to query over 3 million records within a certain radius of a latitude longitude point. Mysql is slow for this sort of thing, so I decided to try the data set out with Solr. Solr worked great […]