Linux | Fancy little “dialog” utility

Using Linux’s sophisticated “dialog” utility to display CPU core temperature

installation

sudo apt-get install dialog

sudo apt-get install lm-sensors

Here the lm-sensors for detecting temperature (see here for configuration details: http://lm-sensors.org/wiki/iwizard/Detection)

Finally the script goes as

#!/bin/bash

temp1=$(sensors | grep “Core 0:” | cut -c1-24)
temp2=$(sensors | grep “Core 1:” | cut -c1-24)

dialog –title “System temp info” –msgbox “$temp1 $temp2″ 10 22

dialog –clear
exit 0

Using minimal advantage of lm-sensors, it’s just displaying main core temperatures.

Screenshot - 11232013 - 10:52:34 PM

openSUSE 13.1 – almost here [updated]

It’s been a while since the openSUSE 13.1 beta is released. And now it’s just a matter of time until the official release. [RC1 is coming on Thursday]

So as a SUSE user I’m putting my blog’s background picture to a nice art work made by the community. You can see the gecko face in between the posts, well it didn’t work as I expected but still it look pretty sleek.

You can check out other promotion fun sparks from here:-

https://news.opensuse.org/2013/10/07/help-promote-opensuse-13-1/

Check out the suggested goals for openSUSE 13.1

https://en.opensuse.org/openSUSE:Goals_13.1

Have fun..!

Update: It’s out..! But I didn’t have much time on checking it out. Hoping to do a run through, let’s see how it goes this time.

Connecting Dots

While I was fooling around the Play store I found this recently released nice, simple and very addictive game. It’s called the Dots. The funny thing about this game is that once you get started playing it you won’t feel bored even it just has to do the same thing over and over again.

The experience that I felt was somewhat different from other games I have played before (but this could be only me). I think the main psychological factor that keeps me in the game is its simplicity and the options you get to boost your score and the opportunity you get to use those options. So there should be also a bit of a planning involved.

Talking about the game basics there are two game mods “Time mode” and “Moves mode”. In time mode there’s a timer which runs for 60 seconds for a single round, so all your connecting skills should be used in this time frame. And in moves mode you’ll get 30 moves to scream at in a round. I usually go with the Time mode because it is fun and challenging.

Once you filled your bucket with enough earned dots you can go ahead and acquire one or more above mentioned options. They call these options as Power Ups.

Here I will list those Power Ups

  • Time Stops: With this Power Up you can hold off your timer for 5 seconds and it requires 1000 dots for 5 tryouts. It’s a pretty neat Power Up by the way. (In moves mode you’ll get extra five moves)
  • Shrinkers: This Power Up just shrinks any dot from the board. You just have to double tap on a dot. It requires 500 dots for five tryouts and can be used only once in a round.
  • Expanders: This Power Up I haven’t used yet. As described it removes all the same color dots. It requires 5000 dots for five tryouts. This Power Up will definitely come in handy.

That’s pretty much it about this beautiful game. If you are bored or trying to eat up some free time this game will certainly do the job for you.

So here’s the Play store URL give it a try

https://play.google.com/store/apps/details?id=com.nerdyoctopus.gamedots

Some screen shots (from my Nexus 4)

Image

Image

Image
UPDATE
I noticed something new in the game’s About section. Actually it was already there but I wasn’t so curious to check it out.
There are few sections, most of them has quotes of wisdom by an admired person.  But one of them has this funny little dots of all colors and you can tap on them, which will eventually makes a unique sound for each dot.

Here, check out some screen shots:-

Screenshot_2013-09-20-22-44-53 Screenshot_2013-09-20-22-45-50 Screenshot_2013-09-20-22-46-00 Screenshot_2013-09-20-22-46-17 Screenshot_2013-09-20-22-46-26

Amazon WS EC2 – connect via SSH RSA

So you own an up and running Amazon EC2 instance. And you want it to access via hassle free way. This guided post will describe on how you can do it with few steps.

Note: Just for the convenience I’m referring some steps from this blog here – http://thekeesh.com/2011/05/setting-up-user-accounts-password-authentication-and-ssh-keys-on-a-new-ec2-instance/

OK before I start assume you have an up and running EC2 instance. If so grab the public DNS from your AWS management console

EC2 Management Console 2013-09-15 15-54-28
It will be probably something like

ec2-#############.compute-1.amazonaws.com

Once that is acquired I again assume you have already made your Key-pair and saved it while you are in the process of creating a new instance

EC2 Management Console 2013-09-15 16-01-07

Once that is also in place go to your terminal and CD to the location you saved your Key [your-key-pair.pem] and try to do SSH

$ ssh -i your-key-pair.pem ubuntu@ec2-#############.compute-1.amazonaws.com

[the default user will be ubuntu for Amazon Machine Images (AMIs).]

Now you should be inside the AMS terminal

aws-terminal

Ok now you have to do is add your self up as a new user and give the root privileges (sudoers). Simply follow execute the following commands on to the AWS terminal

Adding yourself as a user:

$ adduser yourself

granting privileges

$ sudo visudo

find the line root  ALL=(ALL:ALL) ALL and the line yourself ALL=(ALL) ALL under it.

Then enable password authentication via (I used the nano editor)

$ sudo nano /etc/ssh/sshd_config
PasswordAuthentication no to PasswordAuthentication yes

Afterward reload the ssh configuration

$ sudo /etc/init.d/ssh reload

Ok now logout from the current session and log back as yourself

$ ssh yourself@ec2-#############.compute-1.amazonaws.com

And to make sure everything is working just fine, execute following

$ sudo -v

You will be promted to enter the password you have provided while creating the user(yourself). Enter that and if everything went well you will get no output on terminal.

Now lets remove this troublesome password authentication replacing SSH RSA public key authentication

To do that first you need to create a SSH RSA public key

So logout from the AWS terminal and from your local terminal execute the following command (Just press return for all the steps)

local-host$ ssh-keygen -t rsa

And you will get a similar output as below

Enter file in which to save the key (/home/yourself/.ssh/id_rsa):
Created directory ‘/home/yourself/.ssh’.
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /home/yourself/.ssh/id_rsa.
Your public key has been saved in /home/yourself/.ssh/id_rsa.pub.
The key fingerprint is:
58:3a:80:a5:df:17:b0:af:4f:90:07:c5:3c:01:50:c2 yourself@inux-cc6a

Your public key will be stored in /home/yourself/.ssh/

Now what you have to do is add that key to AWS in order to identify yourself as authorize user.

local-host$ scp ~/.ssh/id_rsa.pub yourself@ec2-#############..compute-1.amazonaws.com:/home/yourself

Then again login to the AWS

local-host$ ssh yourself@ec2-#############..compute-1.amazonaws.com:/home/yourself

And place the key file in right place

$ mkdir .ssh
$ mv id_rsa.pub .ssh/authorized_keys
$ chmod 700 .ssh
$ chmod 600 .ssh/authorized_keys

Now you should be able to login without using a password

local-host$ ssh yourself@ec2-#############.compute-1.amazonaws.com

Finally remove the password authentication and root user access

$ sudo vim /etc/ssh/sshd_config

Find the line PasswordAuthentication yes and change it to PasswordAuthentication no.

Also PermitRootLogin yes to PermitRootLogin no

Finally reload the SSH configurations again

$ sudo /etc/init.d/ssh reload

That’s all you need for crating a new user account and allowing authentication via SSH RSA.

If you are still lazy enough to type that long public DNS you can simply assign it to an alias and place it in the ~/.bash_proflle  or ~/.bashrc to make it permanent.

#amazon cloud ssh
alias connect-amazon=’ssh yourself@ec2-#############..compute-1.amazonaws.com’

$ connect-amazon

 

JAXB + Maven – Xml to Java

Situation:

Assume there’s a situation where you want to generate Java sources from a xml schema definition (xsd).  And generate it constantly whenever you want it if the xsd’s got updated.

Solution:

There are quiet a few out tools/libs out there but I found this particulate set (Maven and JAXB2) works well for me, just because it’s pretty straight forward. But you may prefer a different approach.

In to the action:

Let’s create a very basic maven project (assume you have already set up Maven and Java).

mvn archetype:generate -DgroupId={com.jaxb.hello} -DartifactId={HelloJAXB2} -DarchetypeArtifactId=maven-archetype-quickstart  -DinteractiveMode=false

Once the project is created open the pom.xml file in edit mode and add following two plugins

  1. JAXB-2 Maven Plugin
  2. Maven Source Plugin

[Since this is a sample project you may have to define the maven <plugins /> sections]

plugins-section

Carefully notice the sections

                            <generatePackage>com.jaxb.hello</generatePackage>
<schemaIncludes>
<include>helloschema/*.xsd</include>
</schemaIncludes>

<generatePackage> defines the place where you want to put the generated sources for the xsd’s

<schemaIncludes> defines the place where you place your .xsd files.

Now keep all that in mine lets see the project structure

project-structure

As you can see I just added a single .xsd to the location helloschema/

Once all these are in place you just have run the Maven target.

mvn package

maven-build

[Here I have skipped the tests for the convenience]

If everything goes smoothly you’ll see two .jar files in the target folder

final-build

Sources are bundled in the HelloJAXB2-1.1-SNAPSHOT-sources.jar

and you can find it also in generated-sources folder as well

generated-sources

Google Go on OpenSUSE 12.1

Intro

As you may have already know the latest distribution release of OpenSUSE 12.1 ships with Google Go language. Go language was founded by Google as their very own programming language works like an interpreter language yet it has to be compiled in order to execute. This small introduction will show you how to set up the environment and run your first Go language program.

Installing Go

Actually Go language is a part of the SUSE 12.1 distribution so you will not get it out of the box that is you have to install it first in order to use it. So lets begin installing Go

sudo zypper install go

Here I have issued the zypper command to install the Go (usual SUSE way of installing packages from repos). It will probably install two packages. Ok after the successful installation lets check if it’s available

whereis go

outputs

go: /usr/lib/go /usr/share/go

Voila.! so we got installed Go

Setting up the environment

As in the Go guided tutorial mentioned we need to set up three environment variables in order to successfully compile and execute a Go program. So lets open up the /.bashrc file where you usually place your environment variables (because /.bashrc file executes with every new session)

sudo nano ~/.bashrc

place three environment variables on the bottom of the file:-

export GOROOT=/usr/lib/go
export GOOS=linux
export GOARCH=386

[ctrl + x to save the file]

export GOROOT – location of your Go source installation (/usr/lib/go) use whereis command to see that as used before.

export GOOS – Your OS type which is Linux

export GOARCH – Your OS architecture, in my case x86-32 (32-bit) so it goes as 386 [see here for more details]. Issue lscpu to check your sys-architecture.

Ok now everything is setup up. All you have to do now is open a new session, simply logout and re-login.

First program

As this is an introduction I will grab the same “Hello” program listed on http://golang.org/doc/install.html#writing

nano hello.go

package main

import "fmt"

func main() {
	fmt.Printf("hello, world\n")
}

[ctrl + x to save the file]

compiling

8g hello.go

linking

8l hello.8

executing

./8.out

output

hello, world

Note: here I have used 8g, 8l because my arc-type is 32-bit (386). 
You will notice a different formation on the guide. 

Ok now you have successfully completed your first Google Go language program. Pretty straight forward hah? To me it seems like that it follows a familiar executing process as in assembly language. So this is just a little heads up you can find more tutorials and code sample on http://golang.org/doc/

Regards.

Dealing with DLC’s in Playstation Network

Intro

Are you a casual gamer or a hardcore gamer? Your criteria or purpose doesn’t matter in gaming you do it to entertain yourself. There’s a point that you always want so badly to extend your gaming experience and that’s where you want to deal with DLC’s (downloadable contents).

PS3 DLC’s and region free games

Playstation 3 games are region free in fact there’s no region restrictions like in Xbox 360.  Games made for Europe (EU) playable in both Asia or North America (NTSC) but when it comes to DLC’s there’s a region restriction based game’s region. Lets think if you have a game made for EU and you downloaded some DLC’s from your NTSC account  and there’s a restriction that you cannot use it with your game. So it’s always good to follow a one direction either you buy games matching to your PSN (Playstation Network) accounts region or keep a separate PSN account for buying DLC’s that matches your game’s region.

Non-supported Playstation Network countries

When you are creating a PSN account you have to select a country in order to complete the registrations process, but what if your country not listed as a selection. Some countries  (most of Asian countries) are not supported by PSN it self but do not worry you can still create an account. As mentioned above you have to create an account(s) according to one of the two options. Here’s a step-by-step guide of how you can create a PSN account

http://us.playstation.com/support/answer/index.htm?a_id=934

I recommend creating a PSN account selecting USA as the country if you are country is not listed. Because most DLC’s and game merchandise are releases early in North America also it’s kind of easy to handle payments in US currencies.

Payment options and PSN wallet

Now you know the restrictions and the complications that you may have face when dealing with DLC’s. Lets look in to payment options that PSN provides for adding funds to your wallet in order to purchase DLC’s and game merchandise. PlayStation Network provides two options of payment methods :-

  • Pyastation Network card (PSN card)
  • Credit/Debit (International Visa) card

 

to be contained  …