AWS ECS instance has high CPU load from dmeventd

28.09 2016
0

Today we found two of our ECS instances in a cluster had unusually high CPU loads. A quick look revealed dmeventd was responsible for that.

Turns out old containers and images are not getting cleaned up by ECS.

We got back to normal levels by removing old containers and images from the instance:

sudo docker rm $(docker ps -q -f status=exited)

docker images -q | xargs --no-run-if-empty docker r
Read more…

Let Nginx handle browserconfig.xml 404 errors with this inline config

02.02 2016
0

If you find lots of 404 errors for browserconfig.xml files in your log files then this little trick might help. Since Windows 8 Microsofts IE requests this file from the site root to configure the desktop tiles in Windows 8.

If you just want to get rid of those 404s you can serve an empty browserconfig.xml inline from your Nginx config file:

location = /browserconfig.xml {return 200 "<?xml versi
Read more…

Serve robots.txt inline in Nginx

18.06 2015
0

To quickly serve a robots.txt from Nginx without actually having access to the physical file you can define the content of the robots.txt file in the Nginx .conf file.

Allow access to all User-agents:

location /robots.txt {return 200 "User-agent: *\nDisallow:\n";}

Disallow access to every User-agent:

location /robots.txt {return 200 "User-agent: *\nDisallow: /\n";}
Read more…

Create an EC2 instance-store AMI from a running Ubuntu instance

29.04 2014
0

Since Amazon started offering EBS instances the classic instance-store images have gotten little love. But when you want to spawn lots and lots of instances a simple instance-store AMI is more flexible and cheaper.

The following steps let you create an instance-store AMI from a running Ubuntu 14.04 LTS instance.

Setting up your current instance

Start an instance-store Ubuntu image. You can find

Read more…

Creating trees from SQL queries in Javascript

18.10 2013
0

Storing tree structures in a database is simple. Add a column for the parentid and everything makes sense.

Our example data:

[
  {"id": 456, "parentid": 123, "name": "Dogs"}
  {"id": 214, "parentid": 456, "name": "Labradors"}
  {"id": 123, "parentid": 0, "name": "Mammals"}
  {"id": 810, "parentid": 456, "name": "Pugs"}
  {"id": 919, "parentid": 456, "name": "Terriers"}
]

Figure 1

Which should

Read more…

Mac OS X and Google Chrome: Set printer defaults from color to black and white / grayscale

23.09 2013
0

Google Chrome on Mac OS X does not use the printer defaults set in the system.
To set the defaults for the Chrome print interface, for example to set the default color mode to black and white / grayscale, follow these steps:

  1. Enable Web-Access to the Unix Printing System by typing cupsctl WebInterface=yes in a terminal window.

  2. Open http://localhost:631 in a browser.

  3. Cli

Read more…

MS-SQL: List table sizes and row count

05.07 2013
0

Need to list all table sizes and their row count of a single database in MS-SQL Server? This neat script works on MS-SQL 2008 - please comment if it works on other versions.

Just run this in the context of a database.

Credits go to this site for listing the script.

DECLARE @table table(Id int IDENTITY(1,1)
					, Name varchar(256))

INSERT INTO @table
SELECT b.name + '.'+ a.name
FROM sys.tables
Read more…

How to prevent the creation of .DS_Store files on network drives

22.11 2012
0

When working on network drives with Mac OS X every Mac user will by default create .DS_Store files. Those files are used by OS X to store custom attributes like icon positions. For more info on .DS_Store files read this article.

To prevent those files from being created:

  • Open up the Terminal
  • Run the following command
    defaults write com.apple.desktopservices DSDontWriteNetworkStores true
  • R
Read more…