Monthly Archives: November 2012

The probability of SHA-1 collisions

Git uses SHA-1 hashes to identify its objects (commits, refs, blobs, etc). It assumes that if the SHA-1 hashes of two objects are equal, then the two objects themselves are equal, hence there’s no need to store both in the repo. In other words, if the hashes of two different objects turned out to be equal at some point, Git wouldn’t be able to handle that!

But what are the chance of such a SHA-1 collision? This was discussed in the Git mailing list today and a recent analysis on this problem was shed into light. This analysis has used the famous Birthday Paradox and come up with a formula to determine the probability. It quotes,

“Applying the formula for 160bit SHA-1 you need 1.7e23 objects to get a 1% chance of collision. The current Linus kernel repository has 2.7 million objects. So to get a collision you’d need a repository that’s 6e16 times larger. That should be plenty.

For some wacky perspective that’s 10 million kernel sized contributions for every man woman and child on earth together in a single repository. It would seem git will reach plenty of other bottlenecks before SHA-1 becomes a problem…”

The probability is, of course, still non-zero. But don’t ever expect to witness such a collision before you die.

Most popular twitter clients

I was playing with Twitter’s streaming API and thought of finding out what the most popular twitter clients are. So I listened to Twitter’s stream of public tweets for half an hour and sorted the list of tweet sources. The sample contained 100,000 random public tweets. The top ten clients were:

  1. web – 24697
  2. Twitter for iPhone – 17564
  3. Twitter for Android – 13007
  4. Twitter for BlackBerry® – 10592
  5. Mobile Web – 3521
  6. UberSocial for BlackBerry – 1849
  7. TweetDeck – 1776
  8. Twitter for iPad – 1411
  9. Facebook – 1322
  10. Echofon – 1320

As expected, the Twitter web is the source of almost a quarter of the tweets, while the official clients for iPhone, Android and Blackberry take the next slots. And then comes the Mobile Web. Twitter for iPad sits in the 8th place. In other words, more than 70% of the world’s tweets are posted from official clients.

The complete list of results is here.

Activating IRC on Empathy

As it turns out, Empathy doesn’t come with an IRC account support in Ubuntu 12.10. In other words, the new Online Accounts section in Quental lets you connect to Google, Twitter, Jabber and a few other accounts but not IRC. I have no clue what made the packagers take this decision, but it’s a poor move, considering that the plugin only weighs 11.6 kB. Anyway, you can simply install the IRC plugin with the command,

sudo apt-get install account-plugin-irc

There are a few other plugins that do not come pre-installed. You can view them using,

apt-cache search account-plugin

New levels to githug

Githug is an interactive text-based game (or a series of challenges, if ‘game’ isn’t the word), that helps you learn git. It has a series of levels, each of which requires the knowledge of some git commands to solve. Two more levels were added today on checking out tags and solving merge conflicts. You can install the latest version with,

gem install githug

It’ll work on any operating system, given ruby gems is installed. Currently githug consists of 41 levels of increasing difficulty, and more will be added soon.

githug

Some of the first levels in githug (click on the pic to zoom)

Babel by Mumford & Sons

Mumford & Sons became famous with their widely acclaimed debut album ‘Sigh No More’ in 2009. I was a huge fan and was stunned to find out that they had released their second album almost two months back. We really need some RSS feed thingy to get selective notifications of new albums.

Babel, the new album, is pretty good, much like the previous one. I listened twice and it didn’t hit me like Sigh No More did, but still, Babel’s got that unique Mumford & Sons style and lyrics. According to Wikipedia,

… Babel debuted at number one on the UK Album Chart and the US Billboard 200. It became the fastest selling album of 2012 in the UK, selling over 158,000 copies in its first week, and was the biggest selling debut of any album in 2012 in the US, selling 600,000 in its first week.

That’s big. I’m having mixed feelings, but if you liked Sigh No More’s folk-rock, you won’t find Babel disappointing.

Creating booklets out of PDFs

This friend of mine wanted to print a PDF as a booklet, i.e. with two pages printed in each A4 page so that it can be folded to make an A5 sized booklet. It works as shown in this pic. This requires a software that can rearrange the pages accordingly. I had heard of this tool called Booklet Creator but, even though it’s advertised as free, the free version lets you convert only up to 6 pages. And the license is $20. Ridiculous.

What do you do when you need to find an alternative to a software? Check out AlternativeTo.net of course. It led me to this free and open-source tool called pdfbook that lets you do exactly the same. It works in Linux only though (it may work on Windows but will need some work). Also, the tool has some dependencies which need to be installed. In Linux this is usually not much of a problem thanks to package managers. If you’re on Ubuntu/Debian, the steps to install pdfbook is as follows:

  1. sudo apt-get install texlive-latex-base texlive-latex-recommended
  2. Download the pdfbook tarball from here and extract
  3. Go to the extracted directory and install using make install

Now pdfbook is ready to use. The following command will create a booklet:

./pdfbook -2 original.pdf destination.pdf

CrossOver for Linux is free for today only

CrossOver is a a wine-based platform that lets you install Windows software in Linux and OS X machines. According to OMG!Ubuntu, they are giving away the software for free for today only. Just go to this page, enter your name and email and grab the deb (or the relevant package for your distro). Only a few more hours left (coz today means October 31st in Central Daylight Time).

The Ubuntu Geek article on this reports,

Few days back, CodeWeavers started a campaign ‘Flock the Vote’ announcing that they will release CrossOver for free if 100,000 Americans pledge to vote in the 2012 Presidential elections.
CodeWeavers failed to reach stated goal of 100,000 pledges. However, CEO Jeremy White has now decided to give away CrossOver for free anyway.

This CrossOver package usually costs $59.95.