Saturday, December 26, 2015

Hotspot script for ubuntu

This script was tested on both Ubuntu 12.04


#!/bin/sh
# 20141208
# hotspot access point creation for android mobiles in ubuntu 12.04.4; works for laptop to laptop connection as well

zenity --warning --text "Run this script from terminal. \n ./hotspot_install. \n Close dialog box/ESC if you are running via terminal. Else click ok/ENTER."
if [ $? -eq 0 ]
then
    exit
fi

echo "Is ap-hotspot already installed (y/n) ? "
read ch
if [ "$ch" = "n" ]
then
    sudo add-apt-repository ppa:nilarimogard/webupd8
    sudo apt-get update
    sudo apt-get install ap-hotspot
fi


echo "Is ap-hotspot already configured (y/n) ? "
read ch
if [ "$ch" = "n" ]
then
    echo "configure your hotspot. give an access point name and good password"
    sudo ap-hotspot configure
    echo "delete all hotspot connection. Disconnect connected hotspots. Then Network -> Wireless -> Forget/Remove all hotspot. Then press any key to continue..."
    read key
fi

sudo ap-hotspot start

echo "Are you able to obtain ip address in your android mobile (y/n) ? "
read ch
if [ "$ch" = "n" ]
then
    echo "configuring network manager"
    sudo sed -i 's:^dns=dnsmasq:#dns=dnsmasq:gi' /etc/NetworkManager/NetworkManager.conf
    echo "restarting network manager"
    sudo service network-manager restart
    echo "check if following command does not say nameserver 127.0.0.1"
    cat /etc/resolv.conf
    echo "restarting ap-hotspot"
    sudo ap-hotspot stop
    sudo ap-hotspot start
fi

Friday, December 25, 2015

Ethernet wired connection not detected in Ubuntu 14.04

I have been using only wireless connection for a long time now. Finally a day has come for me to use wired ethernet connection.

Unfortunately, it was not getting detected at all.
The first command that comes to mind for checking connection....

ifconfig
The command didn't show "eth0".

ifconfig - a
This time it showed "eth0", but HWaddr  is all 0's. No valid physical address.


Well, this was the reason the wired connection was not getting detected.

Solution is to edit the rc.local file (/etc/rc.local)

Add these two lines before the "exit 0" line.

ifconfig eth0 hw ether 00:22:68:8f:09:e0
service network-manager restart


Restart and wired connection back.

Weirdly, the connection that got connected is "ifupdown (eth0)" instead of "Wired connection 1". Anyway, I just wanted it to work and that's done.

Wednesday, December 16, 2015

Getting started with Swift on Ubuntu 14.04

Download the swift 2.2 or later from Swift.org offical site.
Extract and set path to the binaries.

export PATH=${PATH}:~/swift-2.2-ubuntu14.04/usr/bin

assuming extracted folder is in home directory (indicated by ~/ ).
Try executing

$ swift --version

If you get error like
libstdc++.so.6: version `GLIBCXX_3.4.18' not found
execute the following commands.
 $ sudo add-apt-repository ppa:ubuntu-toolchain-r/test
$ sudo apt-get update
$ sudo apt-get install libstdc++6-4.7-dev



Finally, verify if the swift is working.

$ swift --version
Swift version 2.2-dev (LLVM 46be9ff861, Clang 4deb154edc, Swift 778f82939c)
Target: x86_64-unknown-linux-gnu



That's all. Enjoy programming in Swift.