Monday, 17 October 2016

Plotting eight years of book buying habits

Since late-2008, I've been adding my book purchases to my online catalog at LibraryThing. I thought 8 years worth of (a relatively small set of) data would be worthwhile to play with.
They had an export option that gave me a tab-separated dump of all these books. One column in this file is the 'Entry Date' that shows when I added it to the website (usually within a day or two of buying it). This is what I was interested in.

My first exploration involved matplotlib. It did its job well but I got sidetracked into 'prettier' packages like and bokeh. The latter is what I ended up using.

The data processing was trivial. I only needed to calculate how many books I added in a given month and plot a bar chart from the resulting counts. The result looks like this:

And it confirms what I suspected!

  • I got married in 2011. The density drops off drastically then, but is still reasonable.
  • Kid #1 popped out in April 2014, and the second little fellow in March 2016. The counts are a lot more sparse there onwards :(
I'm trying to get them interested in books so they'll leave me in peace as well. Let's see how that goes.

...and here is the code to make it happen. It's just a simple script so I didn't make the extra effort in packaging it and so on. I used anaconda/Spyder to develop the script, and it was pretty easy, despite my complete lack of knowledge in this area.

Monday, 3 October 2016

Some new ebooks

For reasons that I can't fully explain, I bought some ebooks over the weekend, in spite of not having a good ereader. I have an ancient Sony Reader that hasn't been touched in years, so that doesn't count. I have two tablets in the same situation. My current phone has a small screen, so it's not very comfortable for reading either.

I suppose the deals were good, although I would've liked to own proper books for some of them.

  • Peter Watts - Echopraxia and Firefall - I'm a huge fan of Starfish and the other books he's written, so these were no-brainers.
  • Alex Bellos - Alex through the Looking Glass - A sequel to his excellent Alex's adventures in Numberland.
  • David Wong - This book is full of spiders - Again, a sequel to a book I've already read and liked: the excellently titled John dies at the end.
Going by the other ebooks I've purchased in the past, these seem destined to languish in a virtual shelf for quite some time :( Given the high quality of the authors, I'd prefer not to though. And if I settle into a better rhythm with these than dead-tree books, who knows.. these might become my preferred medium for new purchases.

Wednesday, 24 August 2016

Spring cleaning: cancelling my online subscriptions

Having two kids can be hard on the wallet sometimes. And I'm never happy unless I'm switching browsers, servers, services or distros every few months. So my current effort has been to track all my online expenses and terminate them with extreme prejudice.

Here is a list of all the things I've been using, and what I decided to do with them. First, the ones I didn't cancel:

  • The Browser - Still my favourite source for curated long reads.
  • LWN - And my favourite source of linux news.
  • Saavn - This is only Rs. 100 a month so I'm not saving much cancelling it. My favourite source for music streaming/download.
  • Google Drive - I pay $2 a month for 100GB, and this is too important to cancel. All my kids' pics are here.
  • Gandi - They're my registrar for this website. The site is hosted in blogger so that part is already free.
  • Lastpass - The next service I cancel will probably be this. But its not too expensive, and integrates pretty well with my lifestyle (multiple machines and phone), so I've become rather tied to it.

And here are the ones I have sadly had to cancel:

  • Fastmail - I moved back to gandi's email service. The webmail is not that great but I can always use a dedicated client. I've also moved several newsletter subscriptions to my gmail account to reduce the traffic here.
  • ACM - I initially got this only for the safari account that came with it. But my best study time is during my commute, when I never have any connectivity. Cancelled.
  • Linux Journal - A decent magazine that I've been a member of for the past couple years.
  • Marvel Unlimited - A great service. But apart from the initial couple months, I've started using the service less and less.
  • rsync - I didn't know I was still paying for this until I came across the recurring payment page in PayPal. Cancelled. Good service, but it didn't fit in my workflow.
  • Newsblur - Another good service. I switched to a free alternative (Digg)
  • Magzter - Got a year's worth cheap, but never really used to it. Magazines don't look good on the phone screen. So many things to read, so little time!
  • HotStar - I got this only for Game of Thrones. They do have the Wire and a few other good HBO shows.
  • Netflix - No time.
  • FSF - This one felt bad, because this is the only non-profit I donate to. But the $10 a month did add up to a lot more than many of the smaller ones in this list.
  • Digital Ocean - I had a VPS here for playing around with new tools. My web-to-email tools were also hosted here. A toy VPS is the hardest to part with :(
  • AWS - My free tier expired so I got rid of this asap.

Not bad for a few days' worth of digging around and moving stuff, I guess. I think I've saved around Rs 15000 30000 annually with this. But knowing my nature, it won't be long before I slowly start resubscribing to some of these. A low end VPS is going to be high in that list.

Update: added netflix and the fsf.

Monday, 1 August 2016

Publishing my (Emacs/org-powered) notes online

In the past decade, I've amassed a single, long file called notes.txt file that has a large amount of information I've gathered in my day-to-day activities at work. I use GNU Emacs exclusively to edit and search it. It is now more than 21000 lines long, and when I need to find the workaround for some obscure bug I hit several months back (if not years), the answer is always a C-s away.

Still, in an attempt to reorganize my notes, I spent my free time in the past few weeks in slicing up the file into smaller categories. I decided to properly use org-mode to format them this time. As a bonus, org-publish is a lovely way to render html pages out of them.

My workflow has also improved: I use a bookmark to open the file and just dump the content there. Later I re-file them to the appropriate section. I use deft (bound to F8) to quickly search through them.

Since they needed a permanent home, I've uploaded the notes to GitHub. I was happy to see that github was able to render the .org files natively. The notes are infinitely more malleable within emacs itself of course :)

Here are the main sections:
And here is the project in GitHub:

Update: GitLab looks really nice so I created an account and migrated my repositories there, so here's the link for my notes repo in GitLab: 

Monday, 6 June 2016

RAGE gallery

I thoroughly enjoyed this game. It's not often I start taking side quests near the end of a game just to prolong the experience. The scenery is lovely to look at. As you'd expect from an id game, the game flows well, the weapons are fun to use, and the plot is nothing to write home about.

Thursday, 5 May 2016 - Convert RSS feeds to a digest email

I finally scratched a long-pending itch and wrote a python application that:
  • Reads a list of feeds (that update more frequently than I prefer) once a day,
  • Extracts the last day's posts,
  • and mails it to me.
I used mailgun's neat APIs to send out the mails, and feedparser to do the rss/atom parsing.
The application hinges on twisted to asynchronously parse multiple feeds at a time.
Here's the package in PyPi:
And here's the product page:
The mail below is what a sample mail looks like when I get it for one of the sites.
----- Original message -----
From: RSS Digest Mailer <snipped>
To: <snipped>
Subject: Digest mail for 3quarksdaily
Date: Thu, 05 May 2016 13:02:46 +0000

Dangerous Fictions: A Pakistani Novelist Tests the Limits

Dexter Filkins in The New Yorker: Hanif got the idea of writing about a nurse in a decrepit hospital. Alice Bhatti (named for his old editor) is a ferociously strong young woman: smart, independent, and rebellious to the point of...

Our brain uses statistics to calculate confidence, make decisions

From PhysOrg: The directions, which came via cell phone, were a little garbled, but as you understood them: "Turn left at the 3rd light and go straight; the restaurant will be on your right side." Ten minutes ago you made...

Trump-Sanders Phenomenon Signals an Oligarchy on the Brink of a Civilization-Threatening Collapse

Sally Goerner in Evonomics: The media has made a cottage industry out of analyzing the relationship between America's crumbling infrastructure, outsourced jobs, stagnant wages, and evaporating middle class and the rise of anti-establishment presidential candidates Donald Trump and Bernie Sanders....

Stop telling kids you're bad at math

Petra Bonfert-Taylor in the Washington Post: Why do smart people enjoy saying that they are bad at math? Few people would consider proudly announcing that they are bad at writing or reading. Our country's communal math hatred may seem rather...

Blockchain technology will revolutionise far more than money: it will change your life

Dominic Frisby in Aeon: The impact of record-keeping on the course of history cannot be overstated. For example, the act of preserving Judaism and Christianity in written form enabled both to outlive the plethora of other contemporary religions, which were...

Warsan Shire: the Somali-British poet quoted by Beyoncé in Lemonade

Rafia Zakaria in The Guardian: She writes of places where many Beyoncé fans rarely go, the portions of London where the faces are black and brown, where men huddle outside shop-front mosques and veiled women are trailed by long chains...

The Essence of Mathematics, in One Beatles Song

Ben Orlin in Math With Bad Drawings: Okay, here's a life regret: No one has ever stopped me on the street, grabbed me by the collar, and demanded that I explain to them the essence of mathematics. Me: So, you...

How should we live in a diverse society?

Kenan Malik in Pandaemonium: 'Can Europe be the same with different people in it?' So asked the American writer Christopher Caldwell in his book, Reflections on the Revolution in Europe, published a few years ago. It is a question that...

Sarah Palin, Jimmy Kimmel and Scientists on Climate Change

Why did the death of a single lion cause a sustained uproar?

Jason Goldman for Conservation Magazine: When the story of Cecil the lion's death at the hands of an American hunter hit the media, the global response was "the largest reaction in the history of wildlife conservation," according to a new...

Tuesday, 19 April 2016

On meat and ethics

As a vegetarian, I am often interested in arguments both for and against eating meat. A recent link I read started a chain of fascinating resources arguing in either direction. Spoiler: my opinion hasn't changed, yay.

It started with this post in 3quarksdaily in defense of eating meat that got me annoyed. It is fairly obvious that animals feel pain, and are intelligent to varying degrees. Saying that the pain of an animal is of a different degree that we cannot fully comprehend is a pretty weak argument. Another gaping hole is in arguing that the non-existence of a cow is somehow worse than the horror it goes through in a farm or slaughterhouse.

I also ended up reading the utilitarian Peter Singer's 'All Animals Are Equal' paper, and loved it for its clarity. The entire piece is well worth a read for the problems it anticipates, and the thought experiments it proposes.
The truth is that the appeal to the intrinsic dignity of human beings appears to solve the egalitarian's problems only as long as it goes unchallenged. Once we ask why it should be that all humans—including infants, mental defectives, psychopaths, Hitler, Stalin, and the rest—have some kind of dignity or worth that no elephant, pig, or chimpanzee can ever achieve, we see that this question is as difficult to answer as our original request for some relevant fact that justifies the inequality of humans and other animals.
In another few decades, I won't be surprised if animal rights acquire the same level of seriousness in public discourse as race, caste and gender equality have in the past few generations.

P.S. This also lead me on an unrelated but interesting overview of Singer's utilitarian ideas.