Terraform – infrastructure automation and management tool.  It complements configuration management tools like Puppet and Chef, as well as infrastructure building tools like CloudFormation.  The beauty of it is that it is tool and cloud agnostic.  You can use it to build and maintain infrastructure across multiple clouds.

The goal() challenge

I came across the goal() challenge this morning.

g()(‘al’) is a challenge whereby you need to write in as many languages as possible code which enables the code g()(‘al’) to return the string “goal”, the code g()()(‘al’) to return the string “gooal”, the code g()()()(‘al’) return the string “goooal”, etc.

Interestingly enough, the table of solutions for different languages lists my three least liked languages – Java, Ruby, and PHP – as the ones to be improbably used. These languages don’t support the necessary syntax to make it work.

Given that I spend most of my days around PHP developers, I decided to play around and see if I can figure out a way to do it in PHP.  After all, the challenge allows breaking rules in a smart way.  What exactly is smart – that’s not up to me.

My initial approach was to apply the technique I learned in my Perl days – using __DATA__ or __END__ special literals – to stop the processing of the script and adding more data to it.  I’ve never tried that in PHP, but that turned out to be quite possible with the use of __halt_compiler() function.  I’ve submitted the Pull Request, but it still felt like cheating.

So my second approach was completely different.  If PHP doesn’t support the necessary syntax, why not just add it such support?  A quick search for how write a lexer in PHP turned up with this handy article.  I pretty much did a copy-paste of it and find-and-replace for the needs of the challenge.  Hence the second Pull Request.

While both of the solutions aren’t exactly what the challenge was about, I think this was still useful as I’ve learned a thing or two.

Upgrading Fedora 14 to Fedora 20 is always fun!

I’m upgrading my wife’s laptop from Fedora 14 to Fedora 20.  That’s plenty of fun!  I’ve done this before with other machines, but memory isn’t my strongest suit.  First, preupgrade fails complaining that there are no repositories anymore.  That’s to be expected, with even Fedora 18 being passed end of life.  The replacement for preupgradefedup – isn’t yet available for the releases that old.  Digging around I found a DVD with Fedora 19, which would work just fine, if only upgrade option hasn’t been removed from the recent Fedora releases.

So the only option that I see, except for a complete fresh install, is to follow the yum upgrade path.  Which is a bumpy ride, but it did get me to the destination before.  So here we go …

$ yum clean all
$ rpm -Uvh http://.../releases/16/.../fedora-release*rpm
$ yum upgrade
$ yum update
$ reboot

That’ll get me to Fedora 16. Try the preupgrade/fedup option to go to Fedora 18. If not there, repeat the above. Then go to Fedora 20. Jumping more than 2 releases at a time is not recommended.

Good luck!

Happy Sysadmin’s Day!

It is the last Friday of July once again, which means it is Sysadmin’s Day. Congratulations to all system, network, and database administrators.  Have a short day and a long pint!

beers

 

Everyone else should take this opportunity to appreciate the work done by system administrators.  The nature of this profession is such that most people only notice the existence of system administrators when something is broken and doesn’t work.  If you network is running smoothly, if can’t remember the last time your computer gave you trouble, if your inbox is clear of spam and viruses – there’s a sysadmin somewhere making sure of that.  Things don’t just happen by themselves.