Archive

Archive for March, 2012

What is my IP address from the command line, revisited.

March 27th, 2012 6 comments

Last year I wrote about a little script I use to query checkip.dyndns.org for my current IP address from the Linux CLI. dyn’s checker has served me well over the years and has been rock solid stable, which is why I chose it.

A problem has come about however whereby it is returning a private IP address (192.168.xxx.xxx) which it is taking from the X-Forwarded-For value, rather than ignoring it purely because of the fact that it is a private (internal) IP.

I was trying to find a way to scrape Google’s what is my ip page because it doesn’t suffer from the same bug, and in the process I came about ifconfig.me

So here is my new script, in its entirety:

echo -e "\n$(curl -s ifconfig.me/ip)\n"

If you visit ifconfig.me, on the bottom half of the page you will find a handful of other information you could extract. Now let’s hope that ifconfig.me sticks around for a while.

Categories: All, Linux

Yermasoyia dam

March 21st, 2012 No comments

This morning, someone asked a radio station talk show about the dead fish in Yermasoyia dam in Limassol. It reminded me that we visited this dam 10 days ago and did indeed see tens of dead fish floating on the surface.

The radio station’s reporters later spoke with somebody who informs us that this is Tilapia which has naturally died from its intolerance to colder waters.

We later drove along the dam’s overflow (a rare sight) to where it reaches the sea. Here are some photos.

However, there were no Kayaks there, like not too far away in 2009:

 

Avocado Salad, No Chiz (Pliz!)

March 21st, 2012 1 comment

Avocado Salad, No Chiz

Automatically update iptables rules for Pingdom monitors.

March 14th, 2012 4 comments

Pingdom is an awesome service that tracks the uptime, downtime, and performance of websites (you can see an example of the public stats of this server here). If you have a firewall running on your system, you need to whitelist Pingdom’s servers or else their monitors will fail. As their servers may change at any given time, it is better to automate this whitelisting by realistically and responsibly polling the RSS feed of their monitoring servers.

It’s been done before, but this is how I have chosen to do it.

First, a little php helper script to extract the Active IP addresses of the monitors. For this example, let’s save it as pingdom.com.php alongside our bash script which will be executed by cron.

preg_match_all(
    '/((\d+\.){3}\d+).*?Active/',
    file_get_contents('https://www.pingdom.com/rss/probe_servers.xml'),
    $ips
);

echo implode("\n", $ips[1]);

Then, our bash script which is called from cron:

for ip in $(/usr/bin/php pingdom.com.php); do
    $IPTABLES -A INPUT -s $ip -p icmp -j ACCEPT
done

Of course, this is just an example and you will need to modify the firewall rule(s) according to your needs.

Happy π (Pi) Day!

March 14th, 2012 No comments

Pi Pie

Pi Day is a holiday commemorating the mathematical constant π (pi). Pi Day is celebrated on March 14 (or 3/14 in month/day date format), since 3, 1 and 4 are the three most significant digits of π in the decimal form.

Pi Approximation Day is held on July 22 (or 22/7 in day/month date format), since the fraction 22⁄7 is a common approximation of π.

Categories: All

Clickatell Outage

March 13th, 2012 1 comment

Clickatell have had an outage and have sent their clients an e-mail about it, the beef of which I paste here:

We regret to inform you that Clickatell’s system experienced a total outage due to complete power failure at the data centre which hosts Clickatell’s services. The outage occurred on Sunday the 11th of March 2012 from 09:50 GMT+2 and was resolved at 15:00 GMT+2. During this time all Clickatell services were unavailable. No messages were accepted for delivery and the system was unreachable.

Root Cause:
Clickatell’s services are hosted at a third party data centre. Electrical contractors caused a power outage throughout the data centre’s building while performing routine investigative maintenance on the UPS systems.

As part of their maintenance they bypassed the entire UPS system in order to safely work on it, and powered all infrastructure through one of their standby generators. During the maintenance this generator failed, and the entire building lost power. This meant both our live and standby systems lost power simultaneously.

Clickatell have never struck me as a small company and I was always under the impression that they are used by the largest corporations of the world, such as Google for example. In light of that, how on earth could they have allowed for such a thing to happen?

Quadrotors go to TED2012, but will they come to Cyprus?

March 12th, 2012 No comments

In the beginning of February, I posted a YouTube clip about a swarm of Nano Quadrotors. Here they are again, presented by Vijay Kumar at the TED2012 conference, this time performing the James Bond theme.

 

Unfortunately, I missed the TEDxNicosia event last year. Many friends, colleagues and acquaintances made it there however and I hopefully look forward to being lucky enough to attend next time round.

Sources:

  1. Vijay’s full presentation: Robots that fly … and cooperate
  2. Pennsylvania School of Engineering and Applied Science
Categories: All, Technology

Stick of butter half cup according to Google

March 12th, 2012 1 comment

stick of butter half cup

There, now you know!

Next time you bake a cake, you’ll need 1.39934984 x 10-8 m6 of butter.

No more. No less.

Categories: All

Stop Motion Fresh Guacamole

March 9th, 2012 1 comment

Stop motion (also known as stop frame) is an animation technique to make a physically manipulated object appear to move on its own. The object is moved in small increments between individually photographed frames, creating the illusion of movement when the series of frames is played as a continuous sequence.

 

 

Categories: All

CNN says Nicosia is in Sicily, not Cyprus. Oops.

March 9th, 2012 4 comments

Nicosia, Sicily