Gatttool is a tool distributed along with Bluez, the default linux bluetooth stack, to interact with Bluetooth Low Energy (BLE) devices. Currently I have a TI SensorTag with me for a project I’m working on and I’m playing around with it. Most of the examples on the internet which show how to use gatttool to read the TI Tag have shown how to use gatttool in its interactive mode (-I). For eg, to read the temperature sensor, you’d do the following using gatttool’s interactive mode

@~ $ sudo gatttool -b BC:6A:29:AE:CC:23 -I
[   ][BC:6A:29:AE:CC:23][LE]> connect
[CON][BC:6A:29:AE:CC:23][LE]> char-read-hnd 0x25
Characteristic value/descriptor: 00 00 00 00 
[CON][BC:6A:29:AE:CC:23][LE]> char-write-cmd 0x29 01
[CON][BC:6A:29:AE:CC:23][LE]> char-read-hnd 0x25
Characteristic value/descriptor: f0 fe 88 0e 
[CON][BC:6A:29:AE:CC:23][LE]> exit

However gatttool also offers a non-interactive mode which hasn’t been documented. To achieve the above result in manual, non-interactive mode, you would do the following;

@$ sudo hciconfig hci0 down; sudo hciconfig hci0 up
@$ sudo gatttool -b BC:6A:29:AE:CC:23 --char-read -a 0x25; sleep 1; sudo gatttool -b BC:6A:29:AE:CC:23 --char-write -a 0x29 -n 01; sleep 1; sudo gatttool -b BC:6A:29:AE:CC:23 --char-read -a 0x25; 
Characteristic value/descriptor: 00 00 00 00 
Characteristic value/descriptor: 36 ff 68 0e

During the course of development, sometimes one needs to load a specific library from a specific path instead of the stock library that comes installed with the linux operating system. In such cases, LD_PRELOAD is a useful tool.

For example, my Ubuntu 14.04 laptop has the Bluez (linux bluetooth stack) version 4.101-0ubuntu13 installed by default. Thats a pretty old one. Since I wanted to use a newer version of the library for a project of mine and I didn’t want to overwrite my stock library, I installed the newer version (5.19) in a dedicated directory i.e. /home/pratik/Developer/CL/bluez-5.19-install. As a result, the newer version of the library resided at /home/pratik/Developer/CL/bluez-5.19-install/lib/ So now how do I explicity make a binary which is dependent on the bluetooth library use the one installed at the above mentioned location?

Trick is to use LD_PRELOAD. For eg. If I’m running a program called ‘a-bluetooth-program’ and I want to run it against the new library, this is what I do.

LD_PRELOAD=/home/pratik/Developer/CL/bluez-5.19-install/lib/ a-bluetooth-program

How do I know the trick is working? Of course by using ldd.

@$ LD_PRELOAD=/home/pratik/Developer/CloudLeaf/bluez-5.19-install/lib/ ldd st =>  (0x00007fffe1ee9000)
	/home/pratik/Developer/CloudLeaf/bluez-5.19-install/lib/ (0x00007f1b5286f000) => /lib/x86_64-linux-gnu/ (0x00007f1b52628000) => /lib/x86_64-linux-gnu/ (0x00007f1b523fe000) => /lib/x86_64-linux-gnu/ (0x00007f1b52038000) => /lib/x86_64-linux-gnu/ (0x00007f1b51e34000)
	/lib64/ (0x00007f1b52a90000)

If you look at the output of ldd command which is used to print the shared libraries required by a command, you will see that st is now linking to the newer version of the library.

Every since Microsoft bought off Skype, they have decided that they are NOT going to let you go offline. Thats how much they love you being online. So well, you have to knock off Microsoft from your Skype account to be able to go offline.

  • Log on to your Skype online account settings =>
  • Unlink the Microsoft Account. Once unlinked, your Account settings page will look like the screenshot below.
  • In a few seconds, knocking Microsoft out of your Skype account should bear results.
  • Follow suit for other (IT) problems in your life. Say no to Microsoft.

Usually wireshark is used to sniff packets traversing a network. But how does one sniff a unix domain socket? Using socat as a proxy is a neat trick to capture packets traversing a unix socket.

In the below command, /tmp/originalsocket is the socket the Unix Socket Server is listening on, while /tmp/duplicatesocket is the socket that the unix client should connect to. socat will dump all the transactions that go on in a hexadecimal format

sudo socat -t100 -x -v UNIX-LISTEN:/tmp/duplicatesocket,mode=777,reuseaddr,fork UNIX-CONNECT:/tmp/originalsocket

Besides my regular Github freethinker account, I had to create a new github account for my new job. Problem was how to manage different ssh keys for different github accounts as Github doesn’t allow the same key for more than one account. The Solution is:

1) Create a new alias for in the ~/.ssh/config file.

Host GitHub-readme

This alias still points to but when you ssh into github using the new alias, it will use the alternative SSH key. It should be noted that Github recognizes you not by your username but by your ssh key.

Before you go on, do remember to ssh-add the key.

ssh-add ~/.ssh/id_rsa_alt

To verify whether the ssh key has been added or not

ssh-add -l 

2) Next, lets verify if our new configuration works with github. To do so, execute ssh -T git@GitHub-readme, where GitHub-readme is the new alias we created in step one with an alternative ssh key.

@~ $ ssh -T git@GitHub-readme
Hi pratikreadmesys! You've successfully authenticated, but GitHub does not provide shell access.

3) Finally either clone a new repository or edit the .git/config of your present repository. Use the new alias that we created in step 1 instead of ‘’ in the command line.

git clone git@GitHub-readme:ReadmeSystemsInc/testrepository.git

Alternatively if you have already checked out the repository, update the remote URL.

[remote "origin"]
  url = git@GitHub-readme:ReadmeSystemsInc/testrepository.git
  fetch = +refs/heads/*:refs/remotes/origin/*

I was surprised that iptables modules are not loaded automatically on ArchLinux. Here’s how you load them. Dump the following lines in any file (for eg. netfilter.conf) under modules-load.d and restart your machine. Alternatively load the modules manually if you want to avoid restarting.

@~ 1028$ cat /etc/modules-load.d/netfilter.conf 

The WordPress SEO Plugin by Yoast is a wonderful plugin for all practical purposes. However its got a minor glitch (or feature – depends on how you perceive it) that it adds extra columns to all post listings. Removing them is easy, but not many people venture into that part of WordPress – The Screen Options. Unselect the columns corresponding to WordPress SEO in screen options so that you don’t have to see them in post listings again. Screenshot Below

Hide Wordperss SEO Columns