by Huseyin M Ozyilmaz

  • Using CloudFlare as a DDNS Service Provider in Synology

    Synology supports a number of Dynamic DNS providers. Unfortunately, CloudFlare is still not supported in DSM 6.0. However, you can still use CloudFlare as a DDNS provider in Synology using curl command to call CloudFlare API in the Task Scheduler.

    You need:

    1. Your email address registered in CloudFlare
    2. Global API Key from CloudFlare settings
    3. Your domain name (ex:
    4. DNS record name (ex:

    CloudFlare upgraded their API to v4 in 2015 and they are removing support for old API on November 9th, 2016. The following instructions are compatible with the new API.

    Using the API and curl, you need to find out both Zone Id and Record Id before you can update any DNS record. To get the Zone Id run the following command using your own domain name, email address and API key:

    curl -s -X GET "{DOMAIN_NAME}" -H "X-Auth-Email: {EMAIL}" -H "X-Auth-Key: {API_KEY}" -H "Content-Type: application/json"

    JSON response includes Zone Id if your call is successful. To get the record id run the following command using your own Zone Id, email and API key. This call should return the Record Id that you can use to update with a new IP address.

    curl -s -X GET "{ZONE_ID}/dns_records?name={RECORD_NAME}" -H "X-Auth-Email: {EMAIL}" -H "X-Auth-Key: {API_KEY}" -H "Content-Type: application/json"

    Finally, run the following command to update the DNS record with your current IP address:

    curl -s -X PUT "{ZONE_ID}/dns_records/{RECORD_ID}" -H "X-Auth-Email: {EMAIL}" -H "X-Auth-Key: {API_KEY}" -H "Content-Type: application/json" --data "{\"id\":\"{ZONE_ID}\",\"type\":\"A\",\"name\":\"{RECORD_NAME}\",\"content\":\"`curl`\"}"

    You can create a scheduled task and add this command into the User-defined script area in the Task Scheduler. Set it to run every 5 minutes and you are done.

  • How to Upgrade MongoDB on Mac OS X

    If you are using MongoDB version 3.0.x and you would like to upgrate it to version 3.2 then:

    brew update
    brew upgrade mongodb

    Check the version

    mongod --version
  • How to install MongoDB on Mac OS X

    Steps to show how to install MongoDB on Mac OS X.

    1. MongoDB 3.0.7
    2. Mac OS X 10.11.1

    The most straight forword way to install MongoDB is to use HomeBrew

    1. Install MongoDB with Homebrew

    First update Homebrew’s packages

    brew update

    Install the MongoDB Binaries

    brew install mongodb

    2. Create the data directory

    By default, the mongod process uses the /data/db directory. Let’s create it:

    sudo mkdir -p /data/db

    3. Set permissions for the data directory for your current user

    sudo chown `id -un` /data/db

    4. Start MongoDB


    5. Stop MongoDB

    press Control+C in the terminal where the mongod instance is running.

  • How to minimise JavaScript and CSS files in Mac OS X

    JavaScript task runners like Grunt or Gulp is a common tools to take care of tasks like minifiying CSS and JavaScript files using various plugins. However, if you do not want to set up any task runner, then you can use YUI Compressor.

    The YUI Compressor is a JavaScript and CSS minifier that removes comments, white-spaces and obfuscates local variables using the smallest possible variable names.

    You can install it using Homebrew in mac:

    brew install yuicompressor

    Once it is installed, you should be able to just run yuicompressor from the terminal:

    yuicompressor main.css > main.min.css
    yuicompressor main.js > main.min.js
  • Thoughts on software complexity

    One of the most challenging areas in software development is about managing complexity. Every new piece of code that we write contributes to the overall complexity of the system. This is the same complexity that urges every one of us to re-design and re-code the whole system from scratch when it reaches to a certain threshold.

    Virtual nature of software development combined with ever-changing user requirements urge applications to expand beyond the borders that were initially anticipated and designed for. As applications evolve, their complexity increases unless you actively manage it. Furthermore, the nature of programming languages plays a major role in contributing to this complexity.

    Every developer knows that writing a new piece of code is always easier and more fun than reading, understanding and modifying any existing code written by someone else. Most of the time, this difficulty convinces us to re-write. But even if we re-write, it doesn’t take long to realise we eventually end up with “brand new complexity”. Every new line of code we added to the system needs to be debugged, has to be read and understood, has to be tested, supported and maintained. Therefore, some times I think, our best code is the one that we managed to avoid writing.

    In order to effectively work with this complexity, we need to renovate, clean, simplify and improve our code continuously. This is not an easy task neither it is that much of fun. But our ability to refactor effectively determines the health of the applications. After all, everyone can write code, but actively tackling complexity requires not only skills but also plan and discipline.