Docker commands to clean unused images

If you use docker for some time, there will be a lot of trash images, volumes that is not used by any containers. Here’s how to remove them. (warning: not reversible)

Remove dangling images

Remove dangling volumes

As seen from above commands, you may guess the nested command within the $(…) is used to list dangling images/volumes

List dangling images

List dangling volumes

Using Dotenv config in Makefile (or anything)

Ever want to use .env file config directly in Makefile? I found it not as easy as it sounds. I found this shell command on the web Continue reading “Using Dotenv config in Makefile (or anything)”

Make Docker work with iptables

Docker containers are just like a computer, the networking between host and containers is affected by the firewall. My iptables has a default DROP all policy, but it will make the Containers cannot communicate with the host. Here is the fix you’ll need. Continue reading “Make Docker work with iptables”

Docker named volume explained

Named volume is a new feature since Docker 1.9, it allows you to manage persistent data more easily, and also the volume can be provided by other storage drivers such as Glusterfs instead of “just a directory on the host”. This new feature is particularly useful in production environment. (On the Dev side, I think we still need mounted volume) Continue reading “Docker named volume explained”

PHP Traits – why is it useful

I know I’m late into the game but I recently found that Traits in PHP is really useful. PHP Traits come in handy if you have some part of a class you wish to re-use in the future in another class, but you don’t want strict inheritance relationship.

What is Traits

PHP Trait defines a code segment that is simply copy-n-pasted into a class at compile time. It can contains variables, constants, methods, Continue reading “PHP Traits – why is it useful”

Delete Chrome Autocomplete URL

This is something bugs me for a long time. When you typed a wrong URL in Google Chrome for a few times, it will be there like forever. Continue reading “Delete Chrome Autocomplete URL”

Nexus 6 on sale!

Although the next Gen. Nexus 5 is right around the corner, the Nexus 6 is now a good deal on the Amazon for just $349.99 USD.

With a 2K resolution 5.96 inch display, Qualcomm Snapdragon 805 CPU, 3GB of memory, 3220 mAh battery and 13Mega-pixels f2.0 camera, Nexus 6 is still one of the high-end phones on the market Continue reading “Nexus 6 on sale!”

Vibrator examples – Android Programming

This article will cover how to use the Vibrator in Android.

Firstly, in your AndroidManifest.xml, you must have this line under the root element, otherwise you will get a Runtime Exception

Quick start

if you just want to vibrate it once, this is the simplest example Continue reading “Vibrator examples – Android Programming”

Install Jetty as a service on CentOS

It seems hard to find a complete step-by-step tutorial to install Jetty as a service (especially on CentOS), some of the tutorial online is somewhat outdated or does not work, so I will share what I’ve learnt. (painfully) Perhaps this tutorial will also be outdated at some point in the future, so I will state the current version of the software I use clearly. Continue reading “Install Jetty as a service on CentOS”

Changing the author info of previous commits in Git

The problem is that you forgot to change the email to your work email before you commit your code, so you’re exposing your personal email. How to change it? Continue reading “Changing the author info of previous commits in Git”