CloudFlare Dynamic DNS using OpenWRT

I use dynamic DNS for my home internet connection so that I can access the machines from anywhere on the internet. And I use OpenWRT on my router. Earlier I was using Namecheap for managing DNS but I switched to CloudFlare for performance and security reasons of the website.

Unfortunately CloudFlare doesn’t support updating IP via shell script — well, it sort of does but the JSON stuff gets very messy with quoting in shell scripts, so I wrote a Lua script to update my IP whenever my PPPoE connection starts up; I have dropped the script in /etc/ppp/ip-up.d  so it gets executed by pppd whenever my connection comes up. You can run this script via cron or put it /etc/hotplug  if you wish to. This script uses LuaSocket, LuaSec, JSON4Lua and libubus-lua libraries that are easily installable on an OpenWRT router with 4 MB flash memory.

Now I can have the benefits of CloudFlare without losing out on DDNS :D. Here’s the code:

Suggestions? Post in comments or fork on GitHub.

Advertisements

A Benchmark About Speed of Programming Languages

Yeah, yet another pointless benchmark about speed of programming languages.
Why I call benchmarks pointless is- The speed of a programming language varies widely with use cases.
Language X might be good at executing loops, while language Y might not be.

Additionally, you have to take into account the time spent in developing the programs.
Interpreted languages like PHP, Python, Ruby make a developer’s life very productive and easy, while it may not be for a C or C++ developer.

I am not a fanboy of any language, I just use the language which suits the requirements perfectly.

The languages I’m comparing in this benchmark are C, PHP, Python, Ruby.

Continue reading “A Benchmark About Speed of Programming Languages”

Trac and Git: The Right Way

This post is about configuring Trac and Git to work together properly. As you might be knowing, Git is a DVCS – Distributed Version Control System and Trac is a project management system. By default, Trac supports SVN, but there are plugins for Git and Mercurial. I don’t know if there are plugins for other repositories like Bazaar, etc.

In the default configuration in Trac’s Git plugin, the repository is not cached and setting repository_sync_per_request to blank doesn’t stop Trac from syncing repostiories on each request. This is a big performance disadvantage and can big a real big trouble if you have lots of repositories with quite a lot of commits.

Continue reading “Trac and Git: The Right Way”