Sunday, 4 October 2015

How i changed my keyboard's Space key to Space and Ctrl in Ubuntu 14.04

The thing i wanted was to change my keyboard's behavior like this. When i press Space alone it is Space key. If i pressed with some other key, it is Ctrl.
That is Space+X gives Ctrl+X.

Install needed libs

sudo apt-get install libx11-dev libxtst-dev
Get the source
git clone https://github.com/r0adrunner/Space2Ctrl
Install
cd Space2Ctrl
make
sudo make install

How to use?

Start by typing this in a terminal

s2cctl start

And now Stop by

s2cctl stop

How do i use it?

I added it to ~/.bash_login. So when i login to computer it works.

Reference
https://github.com/r0adrunner/Space2Ctrl

Tuesday, 7 April 2015

How to run android apk in your Google Chrome browser with Google's ARC

Google's plan on merging android with ChromeOS is on the way.



What you need is

1. Google Chrome 41+. It works on PC,Linux,Mac.
Or Chromebook on Chrome Version 41+.
2. You apk files to run
3. The ARC Welder app

1. To get chrome
https://www.google.com/intl/en/chrome/browser/desktop/index.html

In ubuntu/debian you can install *.deb file by


sudo dpkg -i google*.deb 

In fedora/ RedHat Linux 


rpm -ivh google*.rpm

2. To get your apk files
Either use
https://play.google.com/store/apps/details?id=mobi.infolife.appbackup
Or some sites like
http://apps.evozi.com/apk-downloader/

3. Go to The ARC Welder app.And install it from Google Chrome browser.

I used this game (2048) for testing.

http://apps.evozi.com/apk-downloader/?id=com.digiplex.game

This is the result i got.






NB:- There is a limitation. It's is only possible to do one app at time


I tested on Ubuntu 14.04 and Fedora 21.

Reference:-
https://developer.chrome.com/apps/getstarted_arc

Sunday, 22 March 2015

Brython: Python in Browser

Brython is python in browser.

Yes, You can just run it in the browser.

What you need is to get brython.js from their github.

https://raw.githubusercontent.com/brython-dev/brython/master/www/src/brython.js

And put it into some folder of your choice.

Now create a html file and call that js.


<html>
<head>
<script src="brython.js"></script>
</head>
<body onload="brython()">
<script type="text/python">
from browser import document, alert, console

def echo(ev):
    alert(document["zone"].value)

console.log('Hi, this is from python')
document['mybutton'].bind('click',echo)
</script>
<input id="zone"><button id="mybutton">click !</button>
</body>
</html>

Here is piece of code i copied from their website (Infact, modified a little bit).

What is important?
1. including

 <script src="brython.js"></script>

Yes this line, calling/including browser.js file.

3.Body onload function 

<html>

<head>
<script src="brython.js"></script>
</head>

<body onload="brython()">
<script type="text/python" src="test.py"></script>
<input id="zone"><button id="mybutton">click!</button>
</body>

</html>

And here is python code (test.py) i used


from browser import document, alert, console

def echo(ev):
    alert(document["zone"].value)

console.log('Hi, this is from python')
document['mybutton'].bind('click',echo)


Here you can try it online

http://brython.info/tests/console.html

OR Here

http://brython.info/tests/editor.html