Showing posts with label ubuntu. Show all posts
Showing posts with label ubuntu. Show all posts

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.

Saturday, August 29, 2015

Installing JSHint on Ubuntu using npm


When I tried to install jshint on Ubuntu 12.04 using npm, I got errors. It simply didn't work.

If you are trying to use SublimeLinter-jshint for Sublime Text 3, it won't work unless you install 2 things:
1. node.js
2. jshint

Default version on repo for Ubuntu 12.04
$ /usr/bin/node --version
v0.6.12
$ npm --version
1.1.4

When you try
$ /usr/bin/npm install -g jshint
npm http GET https://registry.npmjs.org/jshint

npm ERR! Error: failed to fetch from registry: jshint
...
...
npm not ok


The important thing to note is you must have recent version to install it properly.

Solution

$ sudo apt-get install python-software-properties
$ sudo add-apt-repository --yes ppa:chris-lea/node.js
$ sudo apt-get install nodejs
$ sudo apt-get update

Check the version to confirm once.
$ npm --version
1.4.28
$ node --version
v0.10.37

and finally...
$ sudo npm install -g jshint
/usr/bin/jshint -> /usr/lib/node_modules/jshint/bin/jshint

Success. It's now installed.

Now if you restart the Sublime text and start with any js file, you can see the jshint will hint you for warnings and errors.a

Thursday, August 27, 2015

Install pygame for python3 on Ubuntu 12.04



To install pygame for python3, do the following:

 1. Open up the terminal and type the following code:
     $ sudo apt-get install python3-dev libsdl-image1.2-dev libsdl-mixer1.2-dev libsdl-ttf2.0-dev libsdl1.2-dev libsmpeg-dev python-numpy subversion libportmidi-dev

2. Then once all libraries are downloaded and installed:
     $ svn co svn://seul.org/svn/pygame/trunk pygame
     $ cd pygame
     $ python3 setup.py build
     $ sudo python3 setup.py install

Good to go. You can now run pygame with python3.

To test, open the terminal and try for yourself
$ python3
Python 3.2.3 (default, Jun 18 2015, 21:46:58)
[GCC 4.6.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import pygame
>>>