[HOWTO] Uninstall docker from Mac OS X

So, you have installed docker using the official installer in your OS X and don’t want to use it anymore for some reason. Here is how you can get rid of it completely. Open a terminal and run the following commands:

cd /tmp
wget https://raw.githubusercontent.com/docker/toolbox/master/osx/uninstall.sh
chmod +x uninstall.sh
sudo ./uninstall.sh
rm ./uninstall.sh

[HOWTO] Show space, tabs and newlines (invisibles) in Atom 1.x

The default setting in Atom 1.x seems to be to not show the invisible characters. I tried to search how to enable this but I only found answers for old version . I had to go to the documentation page which was not easy to find so I am posting the solution here.

To enable showing invisible characters, all you have to do is open config.cson file (Atom->Open Your Config on Mac OS X) and add showInvisibles: true under editor so that the config file looks like the following:

  editor:
    invisibles: {}
    showInvisibles: true

Hope this helps!

[SOLVED] How to fix the error “locale: Cannot set LC_CTYPE to default locale: No such file or directory” when “ssh”ing from Mac OS X

This happens because ssh sends a LANG environment variable. If we configure ssh to stop sending the variable, the error should be fixed.

sudo nano /etc/ssh/ssh_config

Look for line:

   SendEnv LANG LC_*

And uncomment it so that it looks like:

#   SendEnv LANG LC_*

If you still see the error, generate the locales on the machine you are connecting to, which looks like the following:

sudo locale-gen en_US en_US.UTF-8
sudo dpkg-reconfigure locales

[HOWTO] Install sbagen in Ubuntu 14.04 Trusty Tahr

SBaGen is a Binaural beat generator. For more info, visit the official SBaGen Website.

It is available for Linux, Windows and Mac. For Ubuntu, it is not available in any official repos or ppas so we need to compile it from source. Here is how you can do that.

Make sure you have multiverse repository enabled. You may have it already enabled. Open Software & Sources to check if “Software restricted by copyright or legal issues (multiverse)” is checked.

Then, install the required packages before compiling:

sudo apt-get update
sudo apt-get install libvorbisidec-dev libmad0-dev mlocate -y
sudo updatedb

Download sbagen source code and extract it:

mkdir ~/sbagen
cd ~/sbagen
wget http://uazu.net/sbagen/sbagen-1.4.5.tgz
tar xzvf sbagen-1.4.5.tgz

Compile:

cd ~/sbagen/sbagen-1.4.5
LIBS=$(locate libmad.a | grep /libmad.a)
LIBS="$LIBS $(locate libvorbisidec.a | grep /libvorbisidec.a)"
cc -DMP3_DECODE -DT_LINUX -Wall -O3 -s sbagen.c $LIBS -o sbagen.bin -lm -lpthread

If you see no errors, the code must be compiled. You should be able to run it by typing the following:

./sbagen.bin

If you see an output like the following, then it is installed successfully:

SBaGen - Sequenced Binaural Beat Generator, version 1.4.5
Copyright (c) 1999-2011 Jim Peters, http://uazu.net/, all rights 
  reserved, released under the GNU GPL v2.  See file COPYING.

Usage: sbagen [options] seq-file ...
       sbagen [options] -i tone-specs ...
       sbagen [options] -p pre-programmed-sequence-specs ...

For full usage help, type 'sbagen -h'.  For latest version see
http://uazu.net/sbagen/ or http://sbagen.sf.net/

If you try to run an sbg file however:

./sbagen.bin examples/basics/prog-chakras-1.sbg

you will most probably receive an error:

Can't open /dev/dsp, errno 2

To fix this, we will run it with OSS emulation using padsp:

padsp ./sbagen.bin examples/basics/prog-chakras-1.sbg

So, we will create a simple wrapper so that it is always run with padsp and install it such that it is available in path:

echo padsp sbagen.bin \"\$@\" > sbagen
chmod +x sbagen
sudo cp sbagen.bin /usr/local/bin/
sudo cp sbagen /usr/local/bin/

Now, you can simply run:

sbagen examples/basics/prog-chakras-1.sbg

Hope it works. Post a comment if you encounter any issues.

How to compile mt7801u for OSMC

Note: This may already be fixed with latest version of OSMC.
Note: My device was not detected in Raspberry Pi Model B (older model) because apparently, it can’t provide enough power to it. It does work with powered USB hub though.

I have a USB Network Hub (WiFi 360) from a Chinese manufacturer. It is detected as “Bus 001 Device 005: ID 148f:760b Ralink Technology, Corp.”. To get it working, I had to go through the following:

First, I sshed into the machine (you can do it with ssh command from *nix machines or Putty tool from Windows machine). The default credentials are osmc/osmc.

Then I installed usbutils to use lsusb.

sudo apt-get update
sudo apt-get upgrade
sudo apt-get -y install usbutils

Then I used lsusb to confirm that the USB WiFi Dongle is connected properly. I also ran ifconfig to check if it is already detected.

Then I installed git, gcc, make and build-essential:

sudo apt-get install git gcc make build-essential -y

Then I installed kernel headers:

set -- $(cat /proc/cmdline) && for x in "$@"; do case "$x" in osmcdev=*) sudo apt-get update && sudo apt-get install -y "${x#osmcdev=}-headers-$(uname -r)"; ;; esac; done

And then kernel source (which is ~100M so might take some time depending on your internet connection):

set -- $(cat /proc/cmdline) && for x in "$@"; do case "$x" in osmcdev=*) sudo apt-get update && sudo apt-get install -y "${x#osmcdev=}-source-$(uname -r)"; ;; esac; done

Then I fetched the source for driver:

cd
git clone https://github.com/porjo/mt7601.git

Then I prepared kernel source for compilation:

cd /usr/src
set -- $(cat /proc/cmdline) && for x in "$@"; do case "$x" in osmcdev=*) sudo tar xjvf /usr/src/"${x#osmcdev=}-source-$(uname -r).tar.bz2"; ;; esac; done
set -- $(cat /proc/cmdline) && for x in "$@"; do case "$x" in osmcdev=*) cd /usr/src/"${x#osmcdev=}-source-$(uname -r)"; ;; esac; done
sudo make mrproper
set -- $(cat /proc/cmdline) && for x in "$@"; do case "$x" in osmcdev=*) sudo cp /boot/config-"$(uname -r)" .config; ;; esac; done
sudo cp .config .config.org
sudo make modules_prepare
set -- $(cat /proc/cmdline) && for x in "$@"; do case "$x" in osmcdev=*) sudo cp /usr/src/"${x#osmcdev=}-headers-$(uname -r)"/Module.symvers ./; ;; esac; done
set -- $(cat /proc/cmdline) && for x in "$@"; do case "$x" in osmcdev=*) sudo ln -s /usr/src/"${x#osmcdev=}-source-$(uname -r)"/ /lib/modules/"$(uname -r)"/build; ;; esac; done

Then I built the driver:

cd
cd mt7601/src
make

It took some time (around 20 minutes on a Raspberry Pi 1 B+) and a lot of warnings were shown but apparently they were safe to ignore.

Finally, I installed it:

sudo mkdir -p /etc/Wireless/RT2870STA
sudo cp RT2870STA.dat /etc/Wireless/RT2870STA
sudo cp os/linux/mt7601Usta.ko /lib/modules/"$(uname -r)"/kernel/drivers/net/wireless/

Then I rebooted:

sudo reboot; exit

After reboot, I reconnected ssh and I could see the new interface ra1 when running ifconfig:

ifconfig

If you update your system and if it again stops detecting the device, you should follow the same instructions again.

Sources:
https://github.com/Shareed2k/osmc_mt7601_driver
https://osmc.tv/help/wiki/kernel-sources

[SOLVED] Frequent corrupt HTTP downloads on Windows

Note: If you are just looking for the final solution, skip to the last paragraph.

On my new Windows 7 64-bit installation, I started getting frequent corrupt downloads when files were downloaded via HTTP. First, I thought my download manager (Free Download Manager) was buggy. However, I got corrupt downloads when downloading via Firefox too. I noticed it happening even with third party web installers and even Windows update (with error “WindowsUpdate_80246002” “WindowsUpdate_dt000”). However, downloads via torrent client were fine. So were downloads over SSH Proxy Forwarded tunnel and downloads over HTTPS.

These symptoms could be caused by various reasons. I suspected malware infection but latest updated version of Bitdefender Free did not detect any. Neither did Malwarebytes. Also, the bug was reproduced inside an isolated Virtual Machine with a different OS too using NAT. So, malware infection was ruled out.

Another reason this could happen is because of faulty networking hardware or buggy driver. Bittorrent has integrity checks on application layer so it automatically repairs corruption due to faulty hardware and drivers. However, it was strange that downloads over HTTPS and SSH VPN connections were not buggy.

The network adapter I was having this problem with is Intel® Centrino® Wireless-N 1030 and driver version is 14.3.0.6. So, I decided to try to update the driver. I ran the Intel® Driver Update Utility and found that a newer version of the driver (application version 16.7.0, driver version 15.9.2.1) is available for download. So, I downloaded it using the SSH Proxy Forwarded tunnel (you could download it in a different computer or setup a tunnel and download using it) and installed it. However, updating drivers didn’t help either.

So I suspected that since connections over secure connections were fine, something intercepting non-secure connections could be a problem. The first suspect was Bitdefender Antivirus. I removed it and rebooted. The problem no longer existed. All the downloads following Bitdefender uninstall were fine. I searched for this and found that other users were having the same problem too and it was not a Bitdefender bug but a Windows bug which also affects other security suites that monitor HTTP traffic.

The solution is to install Windows hotfix KB2735855. Download it here for 32-bit Windows 7 and here for 64-bit Windows 7. According to Microsoft’s article regarding this bug, this bug only applies to Windows 7, Windows Server 2008 R2 and Windows Web Server 2008 R2.

Booting Ubuntu 12.04 from external disk connected to USB 3.0

I have a Ubuntu 12.04 install on an external HDD. On my Dell Laptop, I tried to boot into 12.04 by connecting the USB 3.0 compatible external HDD to USB 3.0 port but it wouldn’t show the grub (v2.00-7ubuntu11) boot screen. A rather silly workaround helped, however. I connected it first to a USB 2.0 port so that the grub screen loaded. Then, I disconnected the HDD and reconnected it to USB 3.0 port and voila. I don’t know if it’s the BIOS or grub (or both?) but this is what I’m going to do from now on. 🙂

[SOLVED] Failed installing Samsung Mobile MTP Device Error code 10: This device cannot start

While trying to connect Samsung Galaxy S3 i9300 with Android 4.0 Ice Cream Sandwich on Windows 7 64bit PC with Kies installed, the device driver installation failed and it showed “The device cannot start” in Device Manager. While searching for a fix, I found a XDA developer forum post offering a solution for this issue however, the fix didn’t work but thanks to the thread, I finally managed to get it working. I’m sorry but I don’t know how it works and why it works and the procedure involves editing registry so proceed with caution. Having said that, here is what you can do to get it to work.

Prerequisite:
Before continuing with the procedure, make sure you have the latest drivers for Samsung device. To do that, connect your device, wait for it to fail and then open Windows Update and click Check for Updates. If you find any Samsung driver update, install it and restart if you have to.

Here is the process:
1. Open Registry editor (regedit.exe)
2. Navigate to the following key and perform a backup by right clicking on it and selecting Export and save anywhere:
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Class


This step is a safety measure. You can restore the settings by double clicking the reg file if something goes wrong.
3. Now, under Class, find the following keys and look for UpperFilters on the right pane:
{36FC9E60-C465-11CF-8056-444553540000}
{EEC5AD98-8080-425f-922A-DABF3DE3F69A}


If you find UpperFilters, just right click on it and select Delete to delete it.


Remember to do it for both keys i.e. {36FC9E60-C465-11CF-8056-444553540000} and {EEC5AD98-8080-425f-922A-DABF3DE3F69A}.
4. Now, disconnect your phone if you have it connected and try reconnecting.

Hope it works for you too. If it doesn’t or if you mess something up, you may want to restore your registry by double clicking the reg file backed up in step 2 and look for some other solution.

Best of luck.

[HOWTO] Get the Fedora 16 wallpaper for Fedora 15

Fedora 16 Alpha is coming out soon and they have selected Fedora 16 wallpaper. Here is how I installed it in Fedora 15:

cd /tmp
wget http://kojipkgs.fedoraproject.org/packages/verne-backgrounds/15.91.0/1.fc16/noarch/verne-backgrounds-single-15.91.0-1.fc16.noarch.rpm
wget http://kojipkgs.fedoraproject.org/packages/verne-backgrounds/15.91.0/1.fc16/noarch/verne-backgrounds-15.91.0-1.fc16.noarch.rpm
rpm -i verne-backgrounds-single-15.91.0-1.fc16.noarch.rpm
rpm -i verne-backgrounds-15.91.0-1.fc16.noarch.rpm

Then, select the new wallpaper in background settings.

[HOWTO] Install GPaste clipboard manager in Ubuntu 11.10 Oneiric Ocelot (Gnome-Shell)

I am a programmer and I can’t do without a clipboard manager. If you have never used a clipboard manager before, you don’t know what a great tool you are missing. GPaste is an excellent clipboard tool for Gnome-Shell, however it is neither available in Ubuntu repository, nor in any PPA (as of now). Here is how you can compile it. Open up the terminal and get going.

Install Dependencies

sudo apt-get install libgtk-3-dev libglib2.0-dev intltool automake autoconf valac git libdee-dev gnome-tweak-tool

Download Source

cd; git clone https://github.com/Keruspe/GPaste.git

Compile and Install

cd;cd GPaste
./autogen.sh
./configure --prefix=/usr
make
sudo make install

Restart Gnome-Shell
To restart, press Alt+F2, enter ‘r’ (without quotes) and press enter.

Enable GPaste Extension
To enable extension, open up Alt+F2>gnome-tweak-tool (or Activities>Applications>Other>Advanced Settings) and enable GPaste under Shell Extensions.

You should now see GPaste icon in the top panel. However, it may give the following error message:

(Couldn’t connect to GPaste daemon)

For this, add the GPaste daemon in startup as “gpaste –daemon” in StartUP applications and reboot.