Showing posts with label Linux. Show all posts
Showing posts with label Linux. Show all posts

Weekend Raspberry-Pi experiments!



Raspberry PI is an awesome mini Linux Computer. I was totally amazed with the computing power it bears and the inbuilt GPIO pins make it even more awesome! I am pretty sure this cute lil linux box opens unlimited possibilities for a creative tech person because of this Computing and Electronics prototyping features it bears. So thats it a lil intro about RasPi and here we go, my 1st project using it! xD

I have used Raspbian Wheezy Linux distro installed to my Sandisk SDHC 8GB class 10 microSD card. My monitor has no HDMI port, So I had to use home Sony TV for it. Plugged everything, powered on, And booyah!the PI booted successfully!

Small issue was noticed after few mins, its only about colors! the colors were only black and white. So I googled about it and found that some TVs display like this and i need to edit a conf at PI O/S. If you need more info can be found here: (Simply the fix is change to: "sdtvmode=2" at "/boot/config.txt" file, and do a sudo reboot, Voila! colors will come up!)







Despite blinking LEDs xD I have tried a new tutorial to stream video from a Web Cam attached to PI to Web server, So the video stream can be accessed by the LAN network. I have used my router for this connected to PI.




RaspberryPI is awesome for electronics-computer-mobile combinated projects. And while surfing I found theirs another product called beagle board similar to RaspberyPI. : http://beagleboard.org/
Since the highly marketing strategies of RasPI we dont aware much about this gadget, But I think it can do more stuff than RasPI though the cost it lil bit larger. RaspPi is 35$ and BeagleBrd is 89$ A nice comparison between both those two credit card size Linux Computers can be found here:

And finally i wanna thank my friend "Harsha Kumara" who provided me his awesome gadget to play with it for couple of days! Thanks harsha!

Playing with GPIO!


Let's start with the first method (File System):

*Before starting startx
Use SuperUser (After every reboot) or use sudo before any command
sudo su

Connect an LED using a resistor between GPIO11 and GND.

Creating a File access to GPIO using console commands:

If you write to the ./export file in the /sys/class/gpio/ subdirectory, the system creates a file with a GPIO structure according to the input. In this case we want to create an access to write directly to GPIO11 in order to handle an LED.

Create a GPIO file access:
echo 11 > /sys/class/gpio/export 

Configure the Pin Direction (In/Out):
echo out > /sys/class/gpio/gpio11/direction

Write a value to turn on the LED using the GPIO11:
echo 1 > /sys/class/gpio/gpio11/value

Now your led should be ON!!!

Write a value to clear the LED using the GPIO11
echo 0 > /sys/class/gpio/gpio11/value

Now your led should be OFF!!!

Delete the created GPIO (11)
echo 11 > /sys/class/gpio/unexport
 
Ref: https://sites.google.com/site/semilleroadt/raspberry-pi-tutorials/gpio


lil guide on RasPI




lil guide on Beagle Bone/Board





Links:

Login using Remote Desktop to Raspberry PI: http://forum.xda-developers.com/showthread.php?t=2119786
Raspberry Pi Hardware Overview, Documentation, and Research
http://forum.xda-developers.com/showthread.php?t=1945778

Raspberry Pi Supercomputer





Installing JDK on Amazon EC2, f*ck yea Oracle! xD

Today, I had to install the SunOracle JDK on some servers, so I visited the JDK download page to retrieve the direct download link for wget on each server:
$ wget http://download.oracle.com/otn-pub/java/jdk/7u3-b04/jdk-7u3-linux-x64.rpm
After launching the command, the server redirects me to a 5K HTML file:
Location: http://download.oracle.com/errors/download-fail-1505220.html [following]
WAIT, WHAT? I can’t download the file if I don’t visit their download page to accept the OTN license.
Challenge accepted, I’m going to play with requests… What happens when I click on the archive link?
First request:
Request URL:http://download.oracle.com/otn-pub/java/jdk/7u3-b04/jdk-7u3-linux-x64.rpm
Request Method:GET
Cookie:s_nr=some_integer; s_cc=true; gpw_e24=http%3A%2F%2Fwww.oracle.com%2Ftechnetwork%2Fjava%2Fjavase%2Fdownloads%2Fjdk-7u3-download-1501626.html; s_sq=%5B%5BB%5D%5D
Okay, trying to play with cookie values (I deleted the useless values):
$ wget --no-cookies --header "Cookie: gpw_e24=http%3A%2F%2Fwww.oracle.com%2Ftechnetwork%2Fjava%2Fjavase%2Fdownloads%2Fjdk-7u3-download-1501626.html;" http://download.oracle.com/otn-pub/java/jdk/7u3-b04/jdk-7u3-linux-x64.rpm

--2012-04-12 18:47:58--  http://download.oracle.com/otn-pub/java/jdk/7u3-b04/jdk-7u3-linux-x64.rpm
Resolving download.oracle.com (download.oracle.com)... 24.29.138.48, 24.29.138.40
Connecting to download.oracle.com (download.oracle.com)|24.29.138.48|:80... connected.
HTTP request sent, awaiting response... 302 Moved Temporarily
Location: https://edelivery.oracle.com/otn-pub/java/jdk/7u3-b04/jdk-7u3-linux-x64.rpm [following]
--2012-04-12 18:47:59--  https://edelivery.oracle.com/otn-pub/java/jdk/7u3-b04/jdk-7u3-linux-x64.rpm
Resolving edelivery.oracle.com (edelivery.oracle.com)... 2.18.222.174
Connecting to edelivery.oracle.com (edelivery.oracle.com)|2.18.222.174|:443... connected.
HTTP request sent, awaiting response... 302 Moved Temporarily
Location: http://download.oracle.com/otn-pub/java/jdk/7u3-b04/jdk-7u3-linux-x64.rpm?AuthParam=THEIR_AUTHPARAM [following]
--2012-04-12 18:48:00--  http://download.oracle.com/otn-pub/java/jdk/7u3-b04/jdk-7u3-linux-x64.rpm?AuthParam=THEIR_AUTHPARAM
Connecting to download.oracle.com (download.oracle.com)|24.29.138.48|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 67667318 (65M) [application/x-redhat-package-manager]
Saving to: `jdk-7u3-linux-x64.rpm'
Fuck Yea.

More information

You can set what you want in gpw_e24, I think it’s a kind of referer. As for me, I’m using the download page URL.
According to the OTN BCL document for Java SE:
BY SELECTING THE “ACCEPT LICENSE AGREEMENT” (OR THE EQUIVALENT) BUTTON AND/OR BY USING THE SOFTWARE YOU ACKNOWLEDGE THAT YOU HAVE READ THE TERMS AND AGREE TO THEM.
Enjoy it!
Bonus

__________
REF:http://blog.kdecherf.com/2012/04/12/oracle-i-download-your-jdk-by-eating-magic-cookies/

Enable/Disable VGA card of your Linux based Laptop. [Power Saver Mode]




The program is called ironhide, it lets the user to enable and disable the VGA card as needed. In earliar days this has been called as Bumble-bee so its the continuation of the same project.

For more info : https://github.com/MrMEEE/ironhide

How to install?

Open a terminal and enter these step by step:

sudo add-apt-repository ppa:mj-casalogic/ironhide
sudo apt-get update
sudo apt-get install ironhide

Now after couple of configurations you will be able to adjust the settings as needed for your VGA card.

Then you can simply type below commands to enable as well disable VGA card anytime!


1  ironhide-enablecard
2  ironhide-disablecard

Other commands.

ironhide-configuration - Initial configuration
ironhide-settings - Lots of different settings
ironhide-bugreport - Bug Report Utility
ironhide-submitsystem - Utility to submit working system infomation 

K53SV Asus Azus RAM problem? [cz by PAE] [solved]

Have you already tried with the PAE (Physical Address Extension)? Actually 4GB shouldn't be a problem...
Anyway, try this:
sudo apt-get install linux-generic-pae linux-headers-generic-pae
sudo reboot now
I had the same problem, and after installing the linux-generic-pae and linux-headers-generic-pae my Ubuntu shows the whole 8GB I have available.
I hope it helps :-)

REF: http://askubuntu.com/questions/61221/why-is-my-system-showing-less-memory-ram-than-is-actually-installed

How To: ubuntu natty (11.04) on asus a53s (k53sv family)

Few configuration for Linux Use of a Asus K53SV Machine.
 
http://ubuntuforums.org/showthread.php?t=1791081

Linux Directory Structure (File System Structure)

Have you wondered why certain programs are located under /bin, or /sbin, or /usr/bin, or /usr/sbin?
For example, less command is located under /usr/bin directory. Why not /bin, or /sbin, or /usr/sbin? What is the different between all these directories?
In this article, let us review the Linux filesystem structures and understand the meaning of individual high-level directories.


1. / – Root

  • Every single file and directory starts from the root directory.
  • Only root user has write privilege under this directory.
  • Please note that /root is root user’s home directory, which is not same as /.

2. /bin – User Binaries

  • Contains binary executables.
  • Common linux commands you need to use in single-user modes are located under this directory.
  • Commands used by all the users of the system are located here.
  • For example: ps, ls, ping, grep, cp.

3. /sbin – System Binaries

  • Just like /bin, /sbin also contains binary executables.
  • But, the linux commands located under this directory are used typically by system aministrator, for system maintenance purpose.
  • For example: iptables, reboot, fdisk, ifconfig, swapon

4. /etc – Configuration Files

  • Contains configuration files required by all programs.
  • This also contains startup and shutdown shell scripts used to start/stop individual programs.
  • For example: /etc/resolv.conf, /etc/logrotate.conf

5. /dev – Device Files

  • Contains device files.
  • These include terminal devices, usb, or any device attached to the system.
  • For example: /dev/tty1, /dev/usbmon0

6. /proc – Process Information

  • Contains information about system process.
  • This is a pseudo filesystem contains information about running process. For example: /proc/{pid} directory contains information about the process with that particular pid.
  • This is a virtual filesystem with text information about system resources. For example: /proc/uptime

7. /var – Variable Files

  • var stands for variable files.
  • Content of the files that are expected to grow can be found under this directory.
  • This includes — system log files (/var/log); packages and database files (/var/lib); emails (/var/mail); print queues (/var/spool); lock files (/var/lock); temp files needed across reboots (/var/tmp);

8. /tmp – Temporary Files

  • Directory that contains temporary files created by system and users.
  • Files under this directory are deleted when system is rebooted.

9. /usr – User Programs

  • Contains binaries, libraries, documentation, and source-code for second level programs.
  • /usr/bin contains binary files for user programs. If you can’t find a user binary under /bin, look under /usr/bin. For example: at, awk, cc, less, scp
  • /usr/sbin contains binary files for system administrators. If you can’t find a system binary under /sbin, look under /usr/sbin. For example: atd, cron, sshd, useradd, userdel
  • /usr/lib contains libraries for /usr/bin and /usr/sbin
  • /usr/local contains users programs that you install from source. For example, when you install apache from source, it goes under /usr/local/apache2

10. /home – Home Directories

  • Home directories for all users to store their personal files.
  • For example: /home/john, /home/nikita

11. /boot – Boot Loader Files

  • Contains boot loader related files.
  • Kernel initrd, vmlinux, grub files are located under /boot
  • For example: initrd.img-2.6.32-24-generic, vmlinuz-2.6.32-24-generic

12. /lib – System Libraries

  • Contains library files that supports the binaries located under /bin and /sbin
  • Library filenames are either ld* or lib*.so.*
  • For example: ld-2.11.1.so, libncurses.so.5.7

13. /opt – Optional add-on Applications

  • opt stands for optional.
  • Contains add-on applications from individual vendors.
  • add-on applications should be installed under either /opt/ or /opt/ sub-directory.

14. /mnt – Mount Directory

  • Temporary mount directory where sysadmins can mount filesystems.

15. /media – Removable Media Devices

  • Temporary mount directory for removable devices.
  • For examples, /media/cdrom for CD-ROM; /media/floppy for floppy drives; /media/cdrecorder for CD writer

16. /srv – Service Data

  • srv stands for service.
  • Contains server specific services related data.
  • For example, /srv/cvs contains CVS related data.

Ref : http://www.thegeekstuff.com/2010/09/linux-file-system-structure/

How to fix "Read from socket failed: Connection reset by peer" error on Ubuntu 11.04

I'm having a really annoying problem on my Ubuntu laptop.
I noticed it today, after upgrading to Ubuntu 11.04, although I'm not entirely sure this is the cause as I played with my ssh keys a few days ago.
The problem is, whenever I try to ssh to ANY host I get the following error:

Read from socket failed: Connection reset by peer 

it's worked for me :)
Just try this bellow :

sudo vim /etc/ssh/ssh_config


Host *

SendEnv LANG LC_*

HashKnownHosts yes

GSSAPIAuthentication yes

GSSAPIDelegateCredentials no

Ciphers aes128-ctr,aes192-ctr,aes256-ctr,arcfour256,arcfour128,aes128-cbc,3des-cbc 

You are done! Try SSH again!

[Solved] Sinhala Fonts not clearly displaying in Ubuntu 11.04?


Just type in Bash.


sudo apt-get install ttf-sinhala-lklug ibus im-switch ibus-m17n m17n-db m17n-contrib language-pack-si-base

Setting Up ADB/USB Drivers for Android Devices in Linux

If you are like me and like developing in Linux, then you will find this guide useful. When I was setting up everything for my Android development, I ran into the problem that Linux was not recognizing my Android phone, and took me some time figuring out how to make Linux recognize my phone. Finally, after some research I was able to put this little guide together and decided to share it with the rest of the world.
ADB (Android Debug Bridge) is a handy tool that comes with Android SDK that allows you to control and interface with your Android device.

Update: 02/04/11 – HTC changed its Vendor ID, older phones have different ID than newer phones. Refer to USB Vendor IDs table at the bottom of this tutorial to see the change.
Update: 01/02/11 – By mistake I had linked the ADB tool for OSX in step 3.1. Now it should be the correct one for Linux.
IMPORTANT Update 12/11/10 – There has been a change to the new Android SDK. ADB Tool has been moved to /android-sdk-linux_x86/plataform-tools, so if you have the old SDK, please download the new one and update your path (Step 9.2 of this tutorial). If this is your first time doing this, then disregard the update and continue with the tutorial.
Update: 09/21/10 – Working code with Ubuntu Lucid Lynx and added more USB vendor IDs.

  1. Download the latest Android SDK from Google: Android SDK
  2. Extract the TGZ file to your home/YOUR-USERNAME directory
  3. To get ADB, you need to install the SDK: Installing the SDK
    • If you are not a developer and not planning to develop, then just download the following zip file containing only the ADB tool and proceed with the tutorial: ADB
  4. On your phone, click Settings > Applications > Development and make sure USB Debugging is on.
  5. Login as root and create this file: /etc/udev/rules.d/##-android.rules
    NOTE: In the above file replace ## with the number 50 if you are running Gusty/Hardy/Dapper (50-android.rules) or with the number 70 if you are running Karmic Koala/Lucid Lynx/Maverick Meerkat(70-android.rules)
    • Or simply type in terminal sudo gedit /etc/udev/rules.d/##-android.rules then enter your password
  6. The file should read:
    • For Gusty/Hardy: SUBSYSTEM==”usb”, SYSFS{idVendor}==”0bb4″, MODE=”0666″
    • For Dapper: SUBSYSTEM==”usb_device”, SYSFS{idVendor}==”0bb4″, MODE=”0666″
    • For Karmic Koala: SUBSYSTEM==”usb”, SYSFS{idVendor}==”0bb4″, MODE=”0666″
    • For Lucid Lynx: SUBSYSTEM==”usb”, SYSFS{idVendor}==”0bb4″, MODE=”0666″
    • For Maverick Meerkat: SUBSYSTEM==”usb”, ATTR{idVendor}==”0bb4″, MODE=”0666″
    NOTE: In the above lines the code ”0bb4″ refers to a HTC device. If your phone is from a different manufacturer, replace the code with the appropriate from the table below.
    NOTE: If you copy one of the lines mentioned above, make sure you replace the quotation marks with the ones in your keyboard, as these have different display code and it might give you a “no permissions” error.
  7. Execute: sudo chmod a+rx /etc/udev/rules.d/70-android.rules
  8. Reboot
  9. To run ADB you need to add an environment variable to your bashrc file:
    • Open a terminal window and type: sudo gedit .bashrc
    • Add the following line at the end: export PATH=${PATH}:/home/YOUR-USERNAME/android-sdk-linux_x86/platform-tools
    • Save and close
  10. You should be ready to go, type adb devices in a terminal window with your phone plugged in.
    If you see a serial number pop up that means you are done. Should look something like this:
    List of devices attached
    HT99PHF02521 device
  11. If for some reasons when running adb devices gives you a “no permissions” error, try typing the following in terminal
    • adb kill-server
    • adb start-server
USB Vendor IDs
Manufacturer USB Vendor ID
Acer 0502
Dell 413c
Foxconn 0489
Garmin-Asus 091E
HTC (Older Phones) 0bb4
HTC (Newer phones) 18d1
Huawei 12d1
Kyocera 0482
LG 1004
Motorola 22b8
Nexus One/S 18d1
Nvidia 0955
Pantech 10A9
Samsung 04e8
Sharp 04dd
Sony Ericsson 0fce
ZTE 19D2
Common ADB Commands
- Lists which devices are currently attached to your computer
  1. adb devices
- Drops you into a basic linux command shell on your phone with no parameters, or lets you run commands directly
  1. adb shell
- Lets you install an Android application on your phone
  1. adb install
- Remounts your system in write mode – this lets you alter system files on your phone using ADB
  1. adb remount
- Rets you upload files to your phones filesystem
  1. adb push
- Lets you download files off your phones filesystem
  1. adb pull
- Starts dumping debugging information from your handset to the console – useful for debugging your apps
  1. adb logcat
Now, as for the credits, I took TheUnlockrHow To” for Windows as a base for this guide.
If you liked this tutorial, please retweet and/or share
________

REF