Happy Leap Second!

By Tuesday, June 30, 2015 0 Permalink 0

Are you ready for tonight’s leap second?

No idea what I’m talking about? tl;dr – once in a while, an extra second is added to synchronize coordinated universal time (UTC) with mean solar time. This is needed because, generally, the Earth’s rotation slows down over time. Leap seconds, unlike leap years, do not occur in regular intervals, because the variation in the Earth’s rotation speed varies irregularly. An example of such irregularities is the 2011 Japan earthquake, that increased the Earth’s rotation speed a bit.

If you’re thinking “what’s an extra second once in a while?”, and “why should anyone care about it?” – feel free to spend that extra second in a productive way 😉

A little extra thought can uncover the potential complexities entailed in such time manipulations.

How do banks and stock markets agree on exchange rates? If you make a deposit and a withdrawal, does the order matter? In a distributed compute cluster, how do compute nodes elect a leader? In cryptographic protocols, how do Alice and Bob verify that Eve isn’t tampering with their connection? How does a control tower in a busy airport is able to coordinate hundreds of incoming landings?

These examples, and many others, all rely on the ability to know the time, have a good estimate about the time on “other sides”, and being able to order events sequentially. Manipulating with time itself, in an irregular way, can cause a lot of chaos… It actually did cause chaos the previous time we experienced a leap second, back in 2012!

This is quite an interesting subject, and I encourage you to go deeper :-) .

If you decide to read just one more thing, let it be Google’s post on the subject, mentioning their elegant “smear window” solution. It’s pretty cool.

Got My Sensibo Kit!

If you follow my blog for a while, you know I’m a big fan of home automation. Especially controlling the A/C from anywhere.

I was excited to learn about the Sensibo Indiegogo campaign last year, and thrilled to receive my Sensibo Kit last week!

The Sensibo kit let’s you control your A/C from anywhere. This is similar the my A/C control project, only done professionally :-) .

The kit includes a small hub that connects to the home router, a tiny pod, and free Android & iOS apps. After setting it up, I can easily control my A/C from the phone app from anywhere, which is so great! Nothing like coming back to a pre-cooled house from the blazing Israeli summer :-) . There’s even IFTTT support, enabling automatic house-pre-cooling whenever I approach home!

How To Use SSH With Multiple GitHub Accounts

All I wanted is to have two GitHub accounts, and use them both from the same computer, using SSH. Is this too much to ask?

I’ve been using my personal GitHub account for some time, and associated my default SSH keys with that account. When I created a work account on GitHub, I expected I’d be able to associate the same SSH keys with the work account, so I can git pull/push as easily.

This proved to be a problem. GitHub does not allow reusing SSH keys across accounts. Here is the message I got when trying to do that:

I managed to overcome this problem by creating new SSH keys for the work account. Read on for the details.

Weekly Review, March 14

By Saturday, March 14, 2015 0 Permalink 0

Today was Pi day, and this year was “super Pi day”. I already mentioned it this morning. I also mentioned Pi day is celebrated as “Aba day” in my family, thanks to my perfect wife. She’s not into the geekiness, but she’s into making it an awesome day! Today included lemon meringue pie for breakfast, Pi-decor and balloons with a bunch of Pi digits floating around the house, pizza-pie for lunch, and some Pi-centric fashion statements :-)

The Weekly Review is a recurring (sort-of-)weekly summary, reviewing highlights from the last week.

Happy Best Pi Day of Our Lifetime!

By Saturday, March 14, 2015 0 Permalink 0

This “Happy Pi Day” post was published on 3.14.15@9:26:53.589 (at my local time, UTC+0200)!

Pi day is also known as “Aba Day” (or Daddy Day) in my family. You’ll see why in a later post… 😉

If I lived in the 16th century, I might have witnessed an ever cooler Pi day, on 3.14.1592@6:53:58.979. But back then I guess it was harder to geek out about it…

An even cooler Pi day will take place on 3.14.15926@5:35:8.979 (yes, I’m loose with the zeros). Only 13,910 years, 364 days, 20 hours, 8 minutes, 15 seconds, and 390 milliseconds to go!

Happy Pi Day!

Using Python’s print With No Newline

Maybe I’m the only one who didn’t know that, but yesterday I learned how to make Python’s print function not write \n.

If you’re using Python’s print function to write stuff to standard output, you’re probably used to its default behavior of ending lines with \n:

> for i in xrange(5): print i
0
1
2
3
4

Sometimes you don’t want it to add the trailing newline. I used to think that in such cases, I need to switch to sys.stdout:

> import sys
> %paste
for i in xrange(5):
    sys.stdout.write('%d ' % (i))
else:
    sys.stdout.write('\n')  # for the trailing newline after the last iteration

## -- End pasted text --
0 1 2 3 4

Turns out that the print function supports the same behavior with a trailing comma!

> for i in xrange(5): print i,

0 1 2 3 4

Of course, this is covered in the documentation.

Every day I learn something new…

Weekly Review, March 7

By Sunday, March 8, 2015 0 Permalink 0

Earlier this week, I finished listening to the audio book version of “A More Beautiful Question: The Power of Inquiry to Spark Breakthrough Ideas”, by Warren Berger.

In this book, Warren Berger explores the power of questions and the questioning mindset, and how it is used to ignite change in business and in our daily lives. Warren finds that although children start out asking hundreds of questions a day, questioning decreases dramatically as children enter school. He discusses the effect of the education and business culture that rewards answers, and barely tolerates questions. Warren analyzes numerous examples of successful startups (e.g. Google, Airbnb, Netflix, and more), and reveals how questioning is key in their culture, and the driver for innovation. Throughout the book, the author outlines a practical Why-What If-How framework of inquiry to facilitate the process of innovation.

I enjoyed the book very much, and recommend it whole heartedly! It resonated with my own lingering thoughts and concerns about the western education system, that keep growing as my own kids approach entering this broken and outdated system. When the day arrives, I hope I will be able to enroll my kids to a school that embraces and encourages the questioning mindset, instead of demanding canned answers and emphasizing compliance – a culture that served the industrial age, but is harmful at the information age. Are you familiar with such school? In Israel? Around the world? Please let me know!

I also completed today the Cloud Compute Concepts (1) Coursera course. This course was a 5-week MOOC from University of Illinois at Urbana-Champaign, covering some basic technical concepts in cloud computing. The syllabus includes MapReduce, grids, peer-to-peer systems, failure detection and membership protocols, key/value stores (e.g. Cassandra), multicast, time ordering in distributed systems, snapshots, the consensus problem and the Paxos protocol.

I’m not seeking any “formal” qualifications on this subject. When I started my current job at Yowza](http://www.yowza3d.com/), it was the first time I worked with cloud technology at depth. I picked up lots and lots of practical stuff, but I felt I’m missing the background and underlying theory. To compensate for this, I decided to take a series of Coursera courses, whose syllabi looked comprehensive enough. This course was the first in the series, and I think I already produced value from it. For instance, we’re considering using Cassandra, and thanks to the course, I now know more about Cassandra then I knew before.

The Weekly Review is a recurring (sort-of-)weekly summary, reviewing highlights from the last week.

Shell Foo: Simple Distributed grep on a GCE Cluster

You just finished running a distributed multi-phase pipeline on a cluster of 200 GCE VM’s. Good for you! But something doesn’t look right, and you’d like to investigate by grepping the local log files across all nodes and do something with the results. How would you do that?

Let’s say that if you had 1-2 machines, you would ssh into each, and run this command:

$ grep ERROR /tmp/*.log.* >errors

This post describes a simple one-liner that scales the local grep to cluster-scale.

Shell-Foo credit for this one: Eyal Fink.

Shell-Foo is a series of fun ways to take advantage of the powers of the shell. In the series, I highlight shell one-liners that I found useful or interesting. Most of the entries should work on bash on Linux, OS X and other UNIX-variants. Some probably work with other shells as well. Your mileage may vary.

Feel free to suggest your own Shell-Foo one-liners!

App Highlights: Twilight

According to research, exposure to blue light near bedtime is bad.

Twilight is a simple app that makes your device screen adapt to the time of the day. Using the app is like applying a red filter to the screen, filtering emitted blue light from reaching your eyes. The app uses your location, to adjust the filter intensity to the sun cycle, based on local sunset and sunrise times.

App Highlights is a recurring series. From time to time, I highlight one Android app that I found useful. Feel free to suggest apps for me to highlight, but be advised that I focus on apps that I actually use.