How to remove Wolfram Language and Mathematica from Raspberry Pi: Raspbian Jessie and Wheezy distro

Raspbian Jessie and Wheezy distribution includes Wolfram Language and Mathematica. While this can be helpful for students, it doesn’t have much use for others. The following instructions will remove both Wolfram and Mathematica from your Raspberry Pi (Raspbian distribution). It saves 658MB in Jessie.

sudo apt-get remove wolfram-engine
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages will be REMOVED:
0 upgraded, 0 newly installed, 1 to remove and 59 not upgraded.
After this operation, 658 MB disk space will be freed.
Do you want to continue? [Y/n] y
(Reading database ... 150191 files and directories currently installed.)
Removing wolfram-engine (10.3.1+2016012407) ...
Processing triggers for man-db ( ...
Processing triggers for gnome-menus (3.13.3-6) ...
Processing triggers for desktop-file-utils (0.22-1) ...
Processing triggers for mime-support (3.58) ...
Processing triggers for shared-mime-info (1.3-1) ...
Processing triggers for hicolor-icon-theme (0.13-1) ...

Then there is one final step:

sudo rm /usr/share/raspi-ui-overrides/applications/wolfram-language.desktop /usr/share/raspi-ui-overrides/applications/wolfram-mathematica.desktop

And you are done!
PS. You can read more about these free (not for commercial use) packages here.

Code: How to reboot TP-Link Router

TP-Link router may need to be occasionally rebooted as it sometimes hangs in my experience. Here is a script I developed long back to boot such errant server from command line:

wget -qO- --user=admin --password=admin-password


  • You will need wget installed on your system.
  • You may need to change the IP Address and Password.

If you want (let me know) I can give the script to check periodically and reboot TP-Link Router as needed.

BitBucket vs. GitHub vs. ProjectLocker: Where would you setup your closed source project for free and why

Each of the Source Code repositories come with a free tier but each has their own restrictions
BitBucket from Atlassian is free for small team up to 5 users or you can self-host for up to 10 members for one time fee of 10$. With the free plan in cloud, you can have unlimited public and private repositories.
GitHub doesn’t allow private repositories at this time. While you may host closed source project there, I wouldn’t recommend it.
ProjectLocker provider a free tier: 1 user, 1 project and up to 50 MB of storage.
All three supports Git which is probably the most widely used Source Control system these days.
Of the three BitBucket stands out in hosting closed source private repositories for free. Overall their pricing is most lucrative in the long run.
GitHub, while not free, has the most traction.

Mini-Story: Deathly Silence of Linux (after rm -rf /*)

Silence of Linux (after rm -rf /* )
To be fair, rm -rf /* was taking way too long with several millions of files in deep hierarchy. So I ran Delete (Java based recursive File & Directory Delete Tool).
Finally all data that could be deleted was deleted. I could’ve run shred, I could’ve run dd on the drive itself ( dd if=/dev/urandom of=/dev/sda ), I chose the simpler path.
-bash-3.2# clear
-bash: /usr/bin/clear: No such file or directory
-bash-3.2# ls
-bash: /bin/ls: No such file or directory
-bash-3.2# echo *
boot dev media misc net proc sys var
-bash-3.2# echo boot/*
-bash-3.2# echo dev/*
dev/initctl dev/pts dev/shm
-bash-3.2# echo misc/*
-bash-3.2# echo net/*
-bash-3.2# echo net/*

Only one thing left to do:

-bash-3.2# reboot
-bash: reboot: command not found

I still have the final weapon:

-bash-3.2# echo 1 > /proc/sys/kernel/sysrq
-bash-3.2# echo b > /proc/sysrq-trigger

This is pretty much the same as pressing the reset button on the server (if equipped). No daemons will be shut down gracefully, no filesystem sync will occur, and you may get the wrath of a fsck (or worse, a non-booting server) upon reboot. But what do I care?

What I learned and how I recovered from Partition Table corruption due to Power failure and fsck

Had an interesting experience. Our power blinked (rapid off and on) few times. Not only did SuKam UPS pass that through the power fluctuations but continued after power has stabilized. By the time I switched off the computer, the damage was done. It would only boot to Grub prompt.
Used a SSD drive from another computer to boot the computer and ran fsck. Instead of fixing the situation, it f*ck’ed up the three partitions of /dev/sda (/boot, swap and /) and created a single partition!
I hadn’t saved the partition information and didn’t remember how much I allocated to swap so I couldn’t safely guess their size and re-partition the disk myself.
I tried rescue option of parted and part, none of them helped.
Then I used testdisk from CGSecurity. It accurately detected the partitions and saved it. Then I fired up gparted. It couldn’t read /dev/sda3 but suggested I should reboot first, which I did.
Funnily the system was rebooting with /boot -> /dev/sda1 instead of /dev/sdb1 (SSD added for recovery) but then mounting /dev/sdb3 as / instead of /dev/sda3. This happened because the menu.lst specified the volume by label and both sda3 and sdb3 had identical label:

kernel /vmlinuz-2.6.18-408.el5 ro root=LABEL=/ rhgb quiet

During booting I changed it to use ID: root=ID=yuwew…
The ID used was of /dev/sda3
It came up but gave an error in nvidia.
I decided to try again on the actual system. I removed the extra SSD to allow the actual SSD to boot properly.
It came up fine but nvidia driver was not loading. After working for so loong with multi-monitors, it was strangely restrictive trying to get work done with a single monitor, duplicated. After some frantic search I found that the best option was to download it from nvidia and run it using init 3.

chmod 755

Then switched back to init 5, rebooted and it multi-monitor started working again.
Take away from this experience:

  1. Always backup partition table.
  2. Do not run fsck without backing up partition table.
  3. Don’t expect fsck to always do the right thing. After all the name is intentional and the tool is to be used only as a last ditch effort to save your disk and data.
  4. UPS should not be your only protection. I am thinking of adding a spike buster in between.
  5. Regular backups are a must. I had some backups but when it happened I realized they were much too old to be of much use. Cloud backup services like Dropbox are your friend.
  6. Backup is of no value unless you remember how to restore them in an emergency.
  7. Backup disk on the same machine was unharmed. So backup even on the same machine is of some value.
  8. Next time around I will choose Graphics Card with seamless Linux support
  9. Always have a second computer around in running condition, even a Raspberry Pi is good. You may need lots of help from the Internet.
  10. Do not setup your Internet connection, router, firewall, DNS, DHCP etc. on your machine. Use your router and share with all your machines from there. Your router is less likely to fail than your machine. You may keep the settings on an unused NIC on a computer to use if your router fails.

PS. The SuKam Tubular battery has failed which SuKam support insists as the cause of this catastrophe. It was aged over 5 years.

How to install WordPress Network for Hosting Multiple Blogs Easily

WordPress Network was previously installed using WordPress Mu, which has since been discontinued. However since WordPress version 3, you can have more-or-less the same functionality using WordPress.
A multisite network is your own version of where your users can create their own blog / sites on demand. You can restrict it so only you, the administrator, can create new sites.
A multisite network is a collection of sites that all share the same WordPress installation. They can also share plugins and themes. The individual sites in the network are virtual sites in the sense that they do not have their own directories on your server, although they do have separate directories for media uploads within the shared installation, and they do have separate tables in the database.
The detailed instructions can be found in WordPress Multi User.

How to auto-update CNote, Simple CLI Note Taking Application, to Google Drive Cloud

Super simple command line note taking tool for tracking breadcrumb trail during application development…
CNote is a super-simple command line based Note taking application which we use to track changes, take notes before signing-off etc. during development. It can be used on all variants of Unix, Linux and Mac OS. It’s power lies in quickly taking notes as you are working, without interrupting your flow. The notes are searchable and stored in a viewable text file. You can download it from CNote – CLI Note Taking Application site or directly install it from command line with the following:

wget --no-check-certificate -q -O-|bash -

CNotes is super-fast because it stores the notes locally, specifically in ~/.notes.
As we started piling up valuable notes you may start thinking what-if you machine crashes?
One simple solution is to create a symbolic link to it from DropBox managed folder. This ensures DropBox updates it in their cloud whenever new notes are added.
DropBox Nazi says: No DropBox for you!
Incidentally I use CentOS 5.1.x (latest update) on Desktop, which is not supported by DropBox. I also use Raspberry Pi, which also is not supported by DropBox.
Enter Google Drive to the rescue
I tried to make DropBox command line tool work but I found out that DropBox command line client will not work without full installation. This is not possible as CentOS 5.1.x and RaspBerry Pi are unsupported platforms.
Google Drive has a nice third-party command line tool called gdrive (download link) which is just right for my purpose. So instead of wasting more time trying to make DropBox work on RaspberryPi etc., I decided to use Google Drive cloud for backup. I used an unused Google Account for this purpose.
Get access to Google Drive

    • Open a browser and login to Google with the account you want to use.
      • Note: This may be done later too.
    • Upload ~/.notes to Google Drive for the first time:
      gdrive upload ~/.notes
      • This will provide an url which you have to open in your browser to allow gdrive to access files and directories in your Google Drive. After allowing you will be given a code which you will have to copy-paste in command line for the first upload to complete
      • After upload it prints a string (something like: 0B8qjyN8TMP9zSmRYQzhNTaBcdEFg) which is the ID of the file. Copy it. This magic key is the identity of your file on Google Drive.

Backup CNote in Google Drive

    • Now create a file named (for example) updateNoteonGDrive and open it in a text editor and paste the saved file ID.
      nohup ~/bin/gdrive update 0B8qjySampleIDQzhNTaBcdEFg ~/.notes >/dev/null 2>&1 &
  • Make this file executable with chmod:
    chmod 700 ~/bin/updateNoteonGDrive
  • Run it by hand to ensure that it properly updates your notes file in Google Drive.
  • Now open ~/.bashrc with a text editor and invoke this after saving your note like:
    n() {
            echo `date "+%Y-%m-%d %H:%M:%S"`'> '"$*" >> ~/.notes
            tail -1 ~/.notes
  • This ensures every note is backed up in Google Drive. The backup process runs in the background so press Enter and continue with your work. Even if it fails because Internet is down, it will update when you write the next note.


Barracuda's Copy and CudaDrive online storage services will be discontinued on 1 May 2016

Last August, LaCie announced its Wuala service was to close in November 2015, and now Barracuda has announced its Copy and CudaDrive services will close on 1 May 2016.
Paying customers are no longer being charged, and all users have until that date to ensure they have copies of all their files in another location.
DropBox, Google Drive and Microsoft’s OneDrive have the lion’s share of the cloud storage mind-share and they are going strong.

DropBox client on Raspberry Pi

DropBox installer client can be installed from source on Raspberry Pi.
The client expects GUI with nautilus installed which is not available by default on Pi. The installation however succeeds.
You will need to install libnautilus-extension-dev and python-docutils:

apt-get install libnautilus-extension-dev and python-docutils

Then install using:

./configure;make;sudo make install

However the whole process is in vain as it cannot install the daemon (server) dropbox with:

dropbox start -i

In the end you get the dreaded:

Error: Platform not supported

Would you like a solution – would you like to use Dropbox on Raspberry Pi?
Drop me a comment below and I may be able to help.