ATI Radeon 4330 Configuration Ubuntu 12.10

Latest proprietary AMD Catalyst driver version 12.9 cannot be used with Ubuntu 12.10 If you have a AMD Radeon HD 2xxx-4xxx series card.

Drivers for these cards are now available in a separate branch called legacy series. Unfortunately these legacy drivers (version 12.6) have not been updated to work with Ubuntu 12.10. Ubuntu 12.10 comes with xorg 1.13 while these drivers have support for older xorg 1.12.

So if you want to install these drivers in Ubuntu 12.10, you have to downgrade to xorg 1.12. A PPA has been provided by Tomasz Makarewicz that includes all the required packages you need to downgrade plus a fglrx-legacy package.

To install these packages, run the following commands:

1
2
3
4
sudo add-apt-repository ppa:makson96/fglrx
sudo apt-get update
sudo apt-get upgrade
sudo apt-get install fglrx-legacy

Do note that these packages are not officially supported by Ubuntu, so use them at your own risk. If something goes wrong, you can purge the packages by running following commands:

1
2
sudo apt-get install ppa-purge
sudo ppa-purge ppa:makson96/fglrx

Configuring Java Jre Plugin for Firefox in Redhat/Centos 6

Download the latest Linux RPM (self-extracting file), currently jre-7u15-linux-i586.rpm, from java.com then as root install and configure the alternatives system and plugins:

1
2
rpm -Uvh jre-7u15-linux-i586.rpm
alternatives --config java

There are 2 programs which provide ‘java’.

“alternatives –config java” output
1
2
3
4
  Selection    Command

*+ 1           /usr/lib/jvm/jre-1.6.0-openjdk/bin/java
   2           /usr/lib/jvm/jre-1.5.0-gcj/bin/java


Enter to keep the current selection[+], or type selection number:

Note use number of versions, N, For example, if 2 versions were installed then:

1
2
alternatives --install /usr/bin/java java /usr/java/latest/bin/java 3
alternatives --config java

There are 3 programs which provide ‘java’.

“alternatives –config java” output
1
2
3
4
5
  Selection    Command

*+ 1           /usr/lib/jvm/jre-1.6.0-openjdk/bin/java
   2           /usr/lib/jvm/jre-1.5.0-gcj/bin/java
   3           /usr/java/latest/bin/java

Enter to keep the current selection[+], or type selection number: 3

1
java -version

java version “1.7.0_15” Java(TM) SE Runtime Environment (build 1.7.0_15-b03) Java HotSpot(TM) Server VM (build 23.7-b01, mixed mode)

Create links in the Mozilla Plugins directory so Java jre will show in firefox plugin option.

1
2
cd /usr/lib/mozilla/plugins/
ln -fs /usr/java/latest/lib/i386/libnpjp2.so

Now Restart your browser and then click on Enable button to enable this plugin.Thats it you are all set.

Installing Qemu and Running Xv6 on Centos/Redhat 6

QEMU Emulator

QEMU is a generic and open source machine emulator and virtualizer.

When used as a machine emulator, QEMU can run OSes and programs made for one machine (e.g. an ARM board) on a different machine (e.g. your own PC). By using dynamic translation, it achieves very good performance.

When used as a virtualizer, QEMU achieves near native performances by executing the guest code directly on the host CPU. QEMU supports virtualization when executing under the Xen hypervisor or using the KVM kernel module in Linux. When using KVM, QEMU can virtualize x86, server and embedded PowerPC, and S390 guests.

xv6

xv6 is a re-implementation of Dennis Ritchie’s and Ken Thompson’s Unix Version 6 (v6). xv6 loosely follows the structure and style of v6, but is implemented for a modern x86-based multiprocessor using ANSI C.

Installing QEMU

get the current version of QEMU at http://wiki.qemu.org/Download or clone the git repository git clone git://git.qemu-project.org/qemu.git.if downloaded the tarball archieve then untar it.either way you have qemu on your system.Now before further proceeding we should check the requirements for installing QEMU.make sure these packages are installed if not you can’t proceed for the installation.

  • SDL (This comes with installation DVD if not u may google it)
  • SDL-devel (This too comes with installation DVD)
  • glib
  • pkg-config
installation steps for QEMU
1
2
3
4
cd qemu
./configure
make
make install

Running xv6

Fetch xv6 source.The latest xv6 source is available via git clone git://pdos.csail.mit.edu/xv6/xv6.git.

check the path for qemu executables
1
which qemu-system-i386

Change the line containing #QEMU in xv6/Makefile to: QEMU=/usr/local/bin/qemu-system-i386 (or ensure that qemu is in your path). Go to the xv6 directory. Run following command to run xv6 inside Qemu.

Running xv6
1
2
cd xv6
make qemu

That’s it now enjoy xv6 inside QEMU emulator and learn the core of unix operating system.

A Demo Facebook App for Extracting User Details

I have been thinking of extracting user details of a facebook profile(if we have user’s permission) and found this php script.you can create a facebook demo app to see the result.you ‘ll need to dump this script as index.php along with facebook.php and base_facebook.php to your hosting server.these files are available at github.com/facebook/php-sdk.

currently i am hosting my app at heroku.com you can also consider this for your need.heroku’s service is cool and most of them are free.

Now you will need to register a facebook app at developers.facebook.com.you will get a unique ‘appId’ and ‘Secret’. put the exact values in the index.php and now your heroku app address(something like myapp.herokuapp.com once you have created it) while registering for the app at developers.facebook.com.

My Demo App is available at Demo App below is the code for index.php. have Fun while creating your first Facebook App :)

(user-details.php) download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
<?php

require './facebook.php';

$facebook = new Facebook(array(
'appId' => '',
'secret' => '',
'cookie' => true,
));

$user_profile = null;

$user = $facebook->getUser();
$loginUrl = $facebook->getLoginUrl(
array(
    'req_perms' => 'email,publish_stream,user_birthday,read_stream'
    ));

if($user)
{
    $user_profile=$facebook->api('/me');
    echo "Welcome ".$user_profile['name'] .":";
          
  echo "Your Profile Summary.<br />" ;


  echo "<pre>"; print_r($user_profile); echo "</pre>";

  
}
if (!$user)
{
   echo "<script type=\"text/javascript\">\ntop.location.href = \"$loginUrl\";\n</script>";
}

?>

<html>
<title>FACEBOOK USER DETAILS</title>
</html>

CS 1.6 Memory Refresh

A nice bunny hop performed by russian jumper.refreshes my old memory of CS 1.6. link is tagged below enjoy :)

Wireshark Sniffing

Password sniffing in unsecured networks. 5 min video worth checking it out.

Changing Theme for Octopress

oo..yeah! it’s an octopress theme.

I did a lot of customization for octopress default theme any way i wasn’t satisfied with the look.so thought of changing the default theme and i came to know about this one.it’s a cool theme designed for octopress/jekyll blogging.

installation steps:

1
2
3
4
5
cd octopress
git clone https://github.com/wallace/justin-kelly-theme.git .themes/jk
rake install['jk']
rake generate
rake deploy

That’s it your New Theme is installed.But your existing customization will be deleted.if you want to add something in navigation menu try editing the file _include/custom/navigation.html.

Packing an Rpm Without Source Code

Here we are creating an demo rpm for heroku-client. To build an RPM, you must:

  • Set up a directory hierarchy per the rpmbuild specifications.
  • Place your source code and or supplemental files in the proper locations in the hierarchy.
  • Create your spec file.
  • Build the RPM.

You can optionally build a source RPM to share your source code with others. To begin, build the hierarchy. In a directory in your home directory—say, $HOME/rpmbuild.now create six subdirectories:

1
$mkdir -p /home/amit/rpmbuild/BUILD BUILDROOT RPMS SOURCES SPECS SRPMS

now create a directory heroku-client-1.0-el6.i386 inside BUILDROOT. This directroy name should follow this format %{name}-%{version}-%{release}.{archiecture} Now copy your scripts or files what ever your want to put inside the rpm like this: /home/amit/rpmbuild/BUILDROOT/heroku-client-1.6-el6.i386/usr/local/heroku-client/ it means all the files and directory in side heroku directory will be added to the rpm.when you will install this rpm your installing location will be /usr/local/heroku-client/. if you want the installed location inside /bin then directory structure will be look like this: /home/amit/rpmbuild/BUILDROOT/heroku-client-1.6-el6.i386/bin/heroku-client/

Next, create the spec file. A spec file is nothing more than a text file with a special syntax.below is a sample spec file.

(heroku-client.spec) download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
# This is a sample spec file for dict-wn
%define _topdir  /home/amit/rpmbuild/
%define name         heroku-client
%define release  el6
%define version      1.0
%define buildroot %{_topdir}/%{name}-%{version}-root

BuildRoot: %{buildroot}
Summary:  heroku-client a command line interface for accessing heroku services
License:  GPL
Name:     %{name}
Version:  %{version}
Release:  %{release}
#Source:     %{name}-%{version}.tar.gz
Prefix:       /usr
Group:        Development/Tools
%description
heroku-client is a command line interface for accessing heroku services.

#%prep
#%setup -q

#%build
#./configure
#make

#%install
#make install prefix=$RPM_BUILD_ROOT/usr

%files
%defattr(-,root,root)
/usr/local/heroku-client


#%doc %attr(0444,root,root) /usr/local/share/man/man1/rvm.1

%post
echo "export PATH 
PATH="/usr/local/heroku/bin:$PATH"">>/home/amit/.bash_profile

source /home/amit/.bash_profile

Now let’s walk through spec file. The %prep, %build, and %install sections are next, consecutively. Each section generates a shell script that is embedded into the RPM and run subsequently as part of the installation. %prep readies the source code, such as unpacking the tarball. Here, %setup -q is a %prep macro to automatically unpack the tarball named in Source. The instructions in the %build section should look familiar. They are identical to the steps you used to configure and launch the build manually. The %install section is identical, too. However, while the target of the manual build was the actual /usr/local directory of your system, the target of the %install instruction is ~/rpmbuild/BUILDROOT. %files lists the files that should be bundled into the RPM and optionally sets permissions and other information. Within %files, you can use the %defattr macro to define the default permissions, owner, and group of files in the RPM; in this example, %defattr(-,root,root) installs all the files owned by root, using whatever permissions found when RPM bundled them up from the build system. You can include multiple files per line in %files. %post is a hook which will executes the codes after the installation of rpm.

We are not including few section of spec file because we are not building an rpm from source tar ball file.see the spec file.

now run below command as a non root user(avoid root preferably)

1
$rpmbuild -v -ba SPECS/heroku-client.spec

-ba is for build all.Now your binary as well as source rpms are created inside RPMS and SOURCES directory.if only want to build binary then use -bb instead.

source: http://www.ibm.com/developerworks/library/l-rpm1/

Resuming Scp File Transfer With Rsync

I always loved using scp tool for file transfer over internet.but faced some draw back of using it while internet connection get disconnected and file download terminated.now problem is unable to resume from current position.so googled it and found a way out.

1
rsync -e ssh --partial user@remote-ip:/file-directory /home/myself/Downloads

Download will be resumed from that point where it was terminated by any reason.-e ssh indicates rsync to use ssh and --partial indicates for partial downloaded files.one more cool feature is that you can see the progress while file is being downloaded.it will show current download rate as well as progress of the file downloaded.For that use prefix --progress.

1
rsync -e ssh --partial --progress user@remote-ip:/filedirectory /home/myself/download

if working with a directory use “-r”. example:

dealing with file
1
rsync -e ssh --partial --progress emacs@63.90.228.44:/home/emacs/goole_appengine.zip /home/redhat/Downloads
dealing with directory
1
rsync -e ssh --partial --progress -r emacs@63.90.228.44:/home/emacs/goole_appengine /home/redhat/Downloads