Publishing this site on IPFS

Sun 08 October 2017

There has been a lot of buzz online recently about IPFS. In particular, I read this fascinating piece on Hacker News about how cyber-activists had leveraged IPFS to get around Spain's federal legal block on all Independence referendum activities.

I've always been interested by p2p networks so this immediately grabbed me. I downloaded and started playing around with it. I am very impressed. This technology could radically change the web as we know it, making it much more decentralised, resilient and fault tolerant.

I decided to go ahead and publish my site on IPFS and it has been a relatively painless process. Most of the changes I had to make to the site were down to how I had handled relative links previously. The docs on the official website are excellent and there are plenty of other resources and tutorials on the net for anybody interested in getting started.

The only caution I would issue is that this technology is still in its infancy so I wouldn't rely on it for anything critical yet. There are definitely some rough edges that need to be resolved. For example. I've discovered that DNS resolution can often be painfully slow and this is something the developers are aware of. Go-ipfs, the main implementation of IPFS (written in Go) also has high memory requirements and appears to suffer from memory leaks. I've had to write a script to restart the daemon regularly on a server with 2GB RAM because of this. This is something which will have to be addressed if IPFS is to have any success on embedded or IOT devices.

My site can be found on IPFS at /ipns/nakhan.net.

Book review - Accelerando by Charles Stross

Wed 29 March 2017

I have decided to try writing short reviews here for books I am currently reading. I'll do my best to not include any spoilers.

So, the book I have just finished is Accelerando by Charles Stross. This is another of those titles that has long remained untouched on my reading list and I am glad to have finally scratched it off.

It is initially set in the first years of the 21st century in the immediate run-up to the technological singularity and proceeds to follow over time the mavericks of the uber intelligent, technologically adept and influential Macx family as they steer humanity's trajectory through this tumultouos and disruptive period.

Themes and topics explored in the book include "mind uploading", sentient animal/human AIs and their rights, distributed intelligences, the industrialisation of the solar system and beyond, viable centrally AI-planned economies, increasing cybernetic convergence, alien signals and ultra-intelligences and our attempts at contact, the psychological/social/economic/religious costs of exponential technological progress and much more.

Stross' prose is sometimes dense but always fashionable, full of information-packed metaphors of science/tech jargon. This from what I gather is one of Stross' signature strengths as a writer. Character development was well done given in my opinion given the surrounding chaos. Stross expertly conveyed the sense of being there on the cusp of the singularity and his exploration of the post-singularity world was well handled and enjoyable.

This is one of the best fictional explorations of the concept of the singularity and, while it can feel like a bit of a slog in certain parts, overall it is an intellectually rewarding, thought provoking and enjoyable read.

Learning Javascript in 2016

Tue 18 October 2016

I just came across this hilarious/outrageous piece on modern front end development! Dear Lord, what have these guys done!?!

Upgrading to Raspbian Jessie

Thu 01 September 2016

I got a nasty surprise a few days ago when I found out that Raspbian Wheezy (the OS running on my Raspberry Pi) was effectively EOLed when Jessie came out in September 2015. I had assumed that, being based on Debian, it would receive security updates until 2018. But due to shortage of resources and manpower the raspbian team have decided to move straight over to Jessie, which makes sense.

Unfortunately that means I have been running my Pi without any security updates for almost a year. Since I now use the Pi (hooked up to a large USB hard drive) as my primary home server and also have SSH access to it from the outside world this made me break out in a cold sweat. I only allow public key authentication for SSH but a year is a long time to go without security updates in the internet age for any type of server accessible over the internet. I had to get over to Jessie ASAP.

I knew that a clean installation was the recommended way to upgrade to Jessie but I did not have physical access to the Pi to do this. I also really didn't want to start from scratch and re-configure everything to the way I wanted. So the only other option was to do the upgrade remotely over SSH, something I haven't done before. After doing some googling, the process appeared to be fairly straightforward so I decided to go ahead with it. In a tmux session I effectively did the following:

# Make sure system is already updated
sudo aptitude update
sudo aptitude safe-upgrade

# Modify sources
sudo sed -i /deb/s/wheezy/jessie/g /etc/apt/sources.list
sudo sed -i /deb/s/wheezy/jessie/g /etc/apt/sources.list.d/raspi.list

# Do the upgrade
sudo aptitude update
sudo aptitude full-upgrade


It it important to run the above in a screen or tmux session in case your internet connection breaks during the upgrade process. The upgrade process took a few hours during which time I was asked to upgrade or keep certain configuration files. The process was faily straightforward and I didn't encounter any issues which is a testament to the Debian team since they have made some major changes under the hood (most importanly being the shift to systemd). After doing a reboot following the upgrade everything appeared to be running as normal.

Removing GUI

I also wanted to remove the GUI on the Pi as I always access it via the command line over SSH. Doing the following got rid of all GUI and Xorg packages:

sudo aptitude purge ~ilibx11


Booting appears to be much quicker now thanks to systemd:

pi@raspberrypi:~$ systemd-analyze time
Startup finished in 11.819s (kernel) + 36.814s (userspace) = 48.634s

Migrating to Pelican

Sat 23 July 2016

I've been considering for a while to port this site to a static site generator like Jekyll from the bottle based mini blogging/CMS engine I created a few years back to learn web development. I finally decided to make the plunge this weekend, although I decided to go with Pelican instead of Jekyll. The migration process has been much quicker and easier than expected. Half of my blog posts have been shifted over and I've re-created most of the other site content and design too. So all the major hurdles are out of the way.

Static site generators

So why move from a working solution to something new? The main reason was poor python support from my web hosting provider. I had no choice but to use CGI to get things to work (yay 1999)! This always irked me and made me feel dirty. I definitely should have done better research into the "python support" they claimed to provide.

Static site generators provide an elegant solution to this kind of problem (and have whole host of other benefits too). They effectively allow you to generate HTML pages via templates. No need to worry about databases, security holes or language support. It's just HTML/CSS/Javascript being served up by your web server (many have been using Github pages)! Further, the workflow is completely command line driven and you can write your blog posts in markdown in vim too! Understandably because of this, all the cool geek kids (and even some big companies) are doing it!

Pelican

Initially, I was considering Jekyll as that appears to be the most popular static site generator. But being a python guy I thought that there must be a decent python equivelant (Jekyll is ruby based). I set off Googling and discovered that Pelican was the most actively developed and used in the python world. It uses the jinja2 templating engine which I have experience with and generally looked sensible and simple to use. So I opted for that.

Migration

It took me a few hours of reading to understand the basics of Pelican and I was able to start moving things over. Most of the hard work was actually adapting one of the pelican themes (notmyidea-cms) to resemble my old site design and making it mobile friendly. Bit of a hacky process but it's mostly done.

Since I wasn't a very prolific blogger I'm just copy pasting my blog posts over.

Conclusion

So far I'm quite happy about making the move and I would definitely recommend bloggers who're technically inclined to explore static site generators and Pelican in particular. If you're using something like wordpress I believe there are scripts to make the migration process simpler. The documentation is good and there are plenty of tutorials on the web to help you out too.