16 October, 2014

How to share internet connection in Ubuntu to a Raspberry Pi over LAN cable


Before we dig deep on this subject, I assume we got a Laptop connected to the internet over wifi and we are running Ubuntu on it. Now connect the Raspberry Pi (running raspbian os) to the laptop using a LAN cable. 




To share the internet connection open the Network Manager application and edit the Wired Connection.






 
 
Click on the IPv4 Settings tab and select the Method -  Shared to Other computers.

Once the above steps are complete reconnect the network to get the connectivity over the raspberry pi. 












Read rest of entry

27 September, 2014

How to remove existing OS installation and reset the size of Raspberry Pi's SD Card

To remove existing OS installation and reset the size of Raspberry Pi's SD Card we are going to use one of the simple partition editor - gparted in Ubuntu/Debian.

Insert the SD Micro SD card that may or may not contains the Raspberry Pi's operating system into your laptops card reader slot. I am assuming that you got a Raspbian OS installed on the SD card during the life of this post :).

On the top right corner of the gparted, choose your SD card properly. You can identify your card using the size in Gigs(14.84GB) or the by checking for a disk name that starts with pattern - mmcblk*. If you choose wrong disk here in this menu, I will not be responsible for anything that sounds like "I lost my personal files" or "I lost my movies" or "my OS is crashed" and so on. See the below image that have the right selection.


Now unmount earch partition by right clikcing on them, if it is already mounted. Ideally the new versions of Ubuntu will mount the partitions automatically unless otherwise you tweak it to not do so.


Once the partition is unmounted, you are ready to delete it.
 
All the changes made so far will be, written to the memory device when the apply button is clicked as in below image.







Read rest of entry

How to install gparted (partition editor) on Ubuntu 14.04 LTS / Debian wheezy / Raspbian

Here is how to install one of the coolest partition editor for  Ubuntu 14.04 / Debian wheezy / Raspbian

Gparted a GUI based application that helps to work with partitions on your memory devices. It is packed with many features like
  •     Create partition tables, (e.g., msdos or gpt)
  •     Create, move, copy, resize, check, label, set new UUID, and delete partitions
  •     Enable and disable partition flags, (e.g., boot or hidden)
  •     Attempt
  •     Create space for new operating systems

GParted works with the following storage devices:
  •     Hard disk drives (e.g., SATA, IDE, and SCSI)
  •     Flash memory devices, such as USB memory sticks and Solid State Drives (SSD’s)
  •     RAID Devices (hardware RAID, motherboard BIOS RAID, and Linux software RAID)
  •     All sector sizes (e.g., devices with 512, 1024, 2048, 4096 byte sectors and more)


Update your software repository listing using the apt commands from the terminal:

sudo apt-get update


 
Now install gparted using the below given command

sudo apt-get install gparted

 
 


Once the installation is complete, launch gparted using the following command and provide the root credentials


sudo gparted



Read rest of entry

07 July, 2011

Change the DocumentRoot of Apache webserver (/var/www) in Debian / Ubuntu

The document root (also called as the web root) of the Apache web server is located at the /var/www directory by default. Document root is the place where we find all the web pages and server scripts. These files are loaded on the browsers when we type in a particular url to point to that server. 

The /var/www directory doesn't allow access for a user who doesn't have the root permission. It's a headache task to switch to the root mode by typing in the root password everytime even though you know the password, since you may have to change your webpages or scripts during its development stage  very frequently. So a better idea to avoid this problem is to change the default Document root directory to some other location which doesn't require root permission for access.


Change it dude !!!
- - - - - - - - - - - - - - - - - -#

Inorder to change the document root,

#1. Make a directory somewhere inside your home directory to use as the Document root. (not necessarily be home... you can make it anywhere). I named it 'www'

$ mkdir /home/jo/www

#2. Now we have to edit the one of the configuration file of the Apache webserver. The file is located @  /etc/apache2/sites-available/default (requires root permission to edit it).

$ sudo gedit /etc/apache2/sites-available/default

The file will be opened up in the gedit text editor. Now you have to edit the DocumentRoot directive in this file. Replace the /var/www with the /path/to/your/new/document/root in the lines 4 and 9 as shown in the figure below.


#3. Restart the apache webserver.

$ sudo /etc/init.d/apache2  restart



Now test it !!!
- - - - - - - - - - - - - - - - - -#

#1. Create a html/php file inside the Document Root directory (mine is @ /home/jo/www).

#2. Take the terminal and navigate to the Document Root directory (using cd command). Use chmod command given below to allow read+write+execute permission to all.

$ chmod 777 *

#3. Take your web browser and type in http://localhost and hit the enter key! The apache server will load the contents of your Document Root directory as in the figure.


Hope you have done it right!!!


Read rest of entry

Use the Debian Squeeze DVD/pendrive as a package repository

The Debian Squeeze DVD contains many application level packages which are not installed during the base operating system installation. Only core packages are installed during the basic Debian Operating system installation. For example the DVD is loaded with the graphical display managers such as Gnome, KDE and XFCE, but during the installation you can select only one among them.  There are a lot more stuff in the dvd, such as vlc media player, phpmyadmin, mysql etc. Here I am sharing how i used these Debian squeeze DVD as a repository to install those packages.

Adding the dvd to the repository
                 --------------------------------------------------

Take the terminal and type the following

$ sudo apt-cdrom add



This will add your DVD to the repositories list. 


For those who are using the pendrive as the installation media, pendrive should be mounted on the /media/cdrom directory. This can be done in two steps.


#1. Plug in the USB pendrive, then the new block device will be added under the /dev directory. We have to find this block device location for mounting and using the device. Use the following command to detect the block device's filename (selected in the image).
$ sudo fdisk -l


#2. Mount the block device into /media/cdrom.  

$ sudo mount  /dev/sdb1  /media/cdrom/


#3. Add the cdrom to the software repository list, as described earlier in the  case of the DVD.

$ sudo apt-cdrom add


Installing Packages
-------------------------------------
Now install the packages using the apt package manager. Check the sample below :- 
$ sudo apt-get install vlc

Thatz up...This trick will work for Ubuntu also...
Read rest of entry

31 May, 2011

Downloading online flash games and playing it offline in ubuntu 11.04

Flash games are always the right option whenever you feel bored and frustrated sitting infront of pc. Here is a cool trick for downloading all your favorite flash games from any websites that we play usually online. Along with this i am just including the installation of a flash player for playing the .swf files we are going to download ( a browser installed with flash plugin is always enough, though just use it... ).

Usually all the flash games are embedded in the html page so that the browser first caches and loads the application. So the trick to find out the correct url of the .swf file (of the game) varies from website to website.. Dont worry we will go through some eye popping tricks :P

Installing swf player in ubuntu
- - - - - - - - - - - - - - - - - - - - - - - - - - - -
Install swfdec-gnome package with your terminal as follows. U can use synaptic or Ubuntu software centre to install it.  


$ sudo apt-get install swfdec-gnome
 

#   Catching the fish           <------ geeky way
-----------------------------------


Now it is the time to find a cool flash game that you call 'addiction'. For the timesake i am taking the famous game called 'appleshooter'. You can find it on the officegamespot website. Wait till the browser loads the game. Now just take the source code of the page using View => Page Source from the browser (or hit Ctrl + U). In the source page find the pattern ".swf" (Hit Ctrl + F and type .swf).


If you find this pattern as a part of a url then that is the original location of the swf file which we see embedded in the html page. Then copy paste the url ending with .swf on a new tab on the browser to load that game alone. If you dont get a url, we need to use some kind of guess work to find it out.
 

Here i am pinning the screenshot of page source of the appleshooter game on officegamespot website. They dont uses direct url to the .swf file in the page source.



I guessed the url to the .swf file from the above picture from this field <a href="arrow_shooter_03.swf" .....> and tried replacing the tail part of the url,  


http://officegamespot.com/officegames/appleshooter.htm 
with  
http://officegamespot.com/officegames/arrow_shooter_03.swf 
Hi hi, that worked !!! the flash game alone loaded in the browser.

Now save the swf file to your machines hard disk for using it offline. For this just go File > Save Page As from the browser itself. So we have done it almost, whenever you want to play the game just go to that folder and open the file with swfdec flash player.




   

#   catching the fish          <-------- firefox guy 1
----------------------------------


Here is another trick to findout the url to the .swf file. After the browser loads the game completely, open a new browser tab and type about:cache?device=disk in the address bar and hit the enter key. Now Find the pattern .swf file in this page. Copy the url of the one that is the flash game among the urls matchin the search for .swf pattern. Open another tab and paste the url (to .swf file) to load the swf application alone in the browser. Use File > Save File As to save it to your hard disk. Later you can play the game by opening the downloaded swf file with swfdec player or with any web browsers...




#   catching the fish        
<------- firefox guy 2
----------------------------------

Another methode to get a copy of the .swf file of the flash game is to search on the browser cache for the file. You shold have to load the game on the browser to make this trick work. After loading the game completely in the firefox browser (no need to play till the last level to get the file completely !!), open a new tab and type about:cache in the address bar and hit the enter key. 




Copy paste the value of Cache Directory under Disk Cache Device to the terminal after typing nautilus.

$ nautilus /home/jo/.mozilla/firefox/tu9q54ls.default/Cache

Then the cache directory will open up. Just sort the items by Modificaton date and you can find the .swf file among the recent files. Copy it from the cache to some other directory, other wise the file will be lost when the browser tab is closed or loaded with some other pages. Now open it with the swfdec flash player to play it anytime like a standalone application..

   
#
  catching the fish   
<------- for the lazy guys
---------------------------------
If you are too lazy to spend time on above tricks, then there is an option... Use the google's search engine to find the swf file for you, so that you can just download and play it. Just type in the search box like this pattern without quotes 'appleshooter filetype:swf'.


Copy the direct url to the swf file from any of the search result. Load it in a new tab. Save it using the browser itself. You can also use a terminal command called wget to download the files.

$ cd your/games/directory
$ wget http://vc02.free.fr/media/kangg/kang.swf


Hope you got the game, now play it ...






and Hope you like the post !  Comment on !! share your ideas ....!!!
Read rest of entry

20 May, 2011

Setting up local dns cache and public dns address for "lightning" speed browsing in Ubuntu


When it comes to internet, reasonable speed is always an uncomprimisable thing. That may be a crucial reason for making you sit infront of your machines for hours and days. So the lightning speed can be achieved with your ubuntu box in two ways. They are 
  • Use faster and free domain name servers like google's pubic dns or OpenDNS (first throw the one provided by your service provider). Hope you will check one of my past article written in Crack Bytez.

  • Maintain a local dns cache in your machine itself.  So that you can do a good amount of address resolution for frequently used websites within your machine itself, and that saves a reasonable amount of time.

Here i am planning to bring both of these techniques together in a simple manner. Though there are many applications for local DNS caching in ubuntu [ such as dnsmasq, pdnsd, bind9 ] are available, bind9 seems to be a good option for me...

Starting with BIND9  DNS server in Ubuntu

Bind9 (Berkly Internet Naming Daemon)  is the most widely deployed DNS server. Bind9 is available in the ubuntu main repository itself. So you don't need to add some additional repository for installing it. Use the following command line or search for 'bind9' in Synaptic package manager to install it. 

$ sudo apt-get install bind9

Bind9 allows different type of configurations, and our point of view is on configuring it as a caching server. In this configuration BIND9 will find the answer to name queries and remember the answer for the next query. This can be useful for a slow internet connections especially based on mobile internet. By caching DNS queries, you will reduce bandwidth and (more importantly) latency. It increase network performance by caching IP addresses of commonly visited websites instead of retrieving them from the public DNS servers maintained by ISPs at each request.

Configuring the BIND server 

#  First you have to set your machine's address (127.0.0.1) itself as the primary dns address.  This can be done with the help of Network manager or by editing the /etc/resolv.conf file in your ubuntu box. Check the screenshot below..

  • using Network manager:: select the connection and click on the edit. Then choose the IPv4 settings tab and add 127.0.0.1 to the DNS servers field.

  • editing the resolv.conf file:: If you are using DHCP then you may have to edit the resolv.conf file every time you connect to the internet to make bind work properly.



Now change the bind configuration file to add some external DNS servers for resolving a new address that is not cached on your local cache at that time. If you are not adding an external dns server, then it will not be possible to resolve a new address request comes from the browser.  Here i recommend google's public dns or OpenDNS addresses to add in the BIND configuration file. This servers may be sometimes faster and reliable than your ISP's Domain Name Servers. You can find the best DNS server applicable for you by checking in this post. Here is how i have added it

#  First open the file 'named.conf.options

$ sudo gedit /etc/bind/named.conf.options

#  Now uncommend the section 'forwarders'. Replace the '0.0.0.0' with the dns server address applicable to you (Check the figure).

#  Restart  the BIND server:

$ sudo /etc/init.d/bind9 restart

 

Thatz it. We are almost done. Now use the dig command to see the change in speed. If you "dig" a domain name multiple times you should see a drastic decrease in query time: between the first and second query. This is due to the server caching the query. See what happened when i dig twitter from my terminal three times concecutively. See the change in the Query time.

$ dig twitter.com

                                                        

Time is up. Go Applications > Internet > firefox and experience the lightning speed...

Read rest of entry

16 May, 2011

Download your gmail inbox to harddisk for offline usage in Ubuntu

I don't know when i have started using gmail. But now, i am wondering why it doesn't makes me bored eventhough i am watching the same appearence and 'looks of gmail' for more than five years. Gmail is something more than the 'appearences' since it provides a secure and fully fledged mechanism to communicate your personal and business affairs. That may be the reason why i haven't googled for something like 'best online email service' for those past years where i experienced the power of Gmail. 

Here i am introducing an application named 'Gmail Backup' that helps you to download and back up all your mails from the Gmail inbox to your computer's hard disk. The collection of mails that you backed up can be viewed and read offline with the help of some text editors, browsers or email applications such as thunderbird without going online...

 
Setup and Installation

Since the Gmail Backup is a python based application you may need some additional python libraries for running the gui. So first  install the latest version of wxPython on your ubuntu box with the help of Synaptic package manager or apt. The installation  with apt pacakge manager using terminal is given below.

#  First import the key into your apt's list of trusted keys (we both hate warnings !! and this is how we remove the warnings about the digital signature)  

$ curl http://apt.wxwidgets.org/key.asc | sudo apt-key add - 


# Add the following lines to your /etc/apt/sources.list file. Change 'natty' to the suitable one if you are using an ubuntu distribution other than Natty narwhal. 

  #wxWidgets/wxPython repository at apt.wxwidgets.org
  deb http://apt.wxwidgets.org/ natty-wx main
  deb-src http://apt.wxwidgets.org/ natty-wx main

  
#  Run the this command to update your local copy of the packages meta-data. 

$ sudo apt-get update
 

# Now install the wxPython packages using the following commands.

  $ sudo apt-get install python-wxgtk2.8 python-wxtools wx2.8-i18n libwxgtk2.8-dev libgtk2.0-dev

The packages libwxgtk2.8-dev and libgtk2.0-dev may need to be installed if a 3rd party application requires wxWidgets when building from source.
 
# Inorder to access the gmail with such an application you need to enable the IMAP option on the gmail settings. Go to your gmail inbox with your browser. Navigate to the Forwarding and POP/IMAP section on the gmail settings page to enable the IMAP as shown in the figure.



 
Now download the gmail Backup application from the link here. Extract the zipped file. Using your terminal navigate to the location of the zipped file.
 
#  Use the ls command to list all the files 

$ ls -l *.sh 

Run the file named gmail-backup-gui.sh to start the gui interface of the Gmail Backup application shown below.

$ ./gmail-backup-gui.sh

 

# Enter the required information and press the backup button to start downloading the mails. You can view the mails with the help of a browser/text editor/email application[kmail,mozilla thunderbird]. All the mails are stored in the specified folder seperately as eml files.
Read rest of entry

10 May, 2011

Installing Ubuntu 11.04 in pendrive persistently : time for pendrive OS

What about the idea of carrying your operating system whereever you go? I am not talking about bringing your laptop everywhere you go, instead use your pendrive to carry your linux distro. Not simply the live distro, you can carry your operating system with all your configurations, favorite desktop background and personal files. We can call it as a persistent installation since the pendrive linux can not only used as a means for installing linux but also it can retain the changes you made (similar to a linux installation on a hard disk). In simple terms if you store a file on the desktop or installed any new application on the pendrive ubuntu it will be there next time you boot from that pendrive.

While carrying your operating system on a USB pendrive there are many advantages. I think the most appealing one is that you will get your favourite environment wherever you go. If you are a hardcore linux user then no doubt you will find it hard to work with a 'windows only' machine, then you can use your favorite ubuntu that boots from pendrive. Another aspect is related to the security. You can use your ubuntu on the pendrive inside an internet cafe where you can expect keyloggers or other applications that can cause security breaches. Simply your online money transactions can be made secure without the help of softwares or operating system available on a cafe.

Third advantage is somewhat geeky. You can use this pendrive to remain anonymous on the internet and hack safely. Move over many machines and many networks with your handy pendrive and diminish the possibility of tracing you with the help of MAC address and IP address.

And the practical way...

I am very much font of Ubuntu as it provides a powerful environment for application development and entertainment. So i am using the latest distribution of Ubuntu, Natty narwhal (11.04) as my pendrive operating sytem. I have tested it on a Kingston DataTraveler G3 8GB pendrive. Download the iso image of the Ubuntu 11.04 from the link here. Though there are a number of ways to make persistent installation we just use the most simplest one here. For this you need a Windows (vista/7) and application called Universal USB installer (click here to download). 


Select the Ubuntu 11.04 iso image and the pendrive from the Universal USB installer to start installing Ubuntu on to pendrive. The installer will take a few mnutes for finishing the task... Done!!! your pendrive Ubuntu is ready, restart the system and boot from the pendrive to use it...
Read rest of entry

09 May, 2011

Install tweetdeck in Ubuntu 11.04

TweetDeck is an adobe air application that helps us to perform all the online social networking activities using a single platform. It comes as a personal real time browser for connecting you with your contacts across Twitter, Facebook, MySpace, LinkedIn, Foursquare, Google Buzz and more... 


Installation

We need to install Adobe air installer prior to the installation of the tweetdeck. This is because the tweetdeck is built on adobe air framework. You can download the latest version of the adobe air installer linked here. Select .deb from the dropdown list asking for the version to download. 




Double click on the downloaded file (.deb) to install it using the Ubuntu Software center. 

Ignore the bad quality package error if it is shown by the package manager and continue installation...

You can access the Adobe air  installer later from Applications >> accessories for installing other applications based on air framework. 


Now download the tweetdeck.air file from this link. To install it first take the adobe air installer and browse for the tweetdeck.air file.



Then the tweetdeck installer will pop up and begin as shown in the following figures..



Thats all the information needed for installing tweetdeck in ubuntu 11.04. Tweetdeck will ask for authorizing your facebook, twitter etc... accounts in the first login itself... From my point of view tweetdeck is powerful and eyecandy since it provides better interface than any other desktop social networking applications does and it also integrates many social networking communities within a single interface. Lot of customizations are also possible...





Read rest of entry
 

Terminal Diary | techblog Copyright © 2009 Gadget Blog is Designed by jintu jacob Powered by Blogger