Showing posts with label Python. Show all posts
Showing posts with label Python. Show all posts

Change between workspaces using HP 2140 accelerometer

HP mini 2140 netbook comes with an ST Microeletronics accelerometer and under linux kernel 2.6.27 we found a driver that supports it (LIS3LV02Dx).
With wmctrl and some scripting we can toggle between workspaces when we tilt the machine left or right. This is a useless script but it has some fun :)

First you need to install wmctrl
sudo apt-get install wmctrlbash shell script - Download#!/bin/bash

COUNTER=0

while [ $COUNTER -le 100 ]; do
    sleep 0.5
    POS=`cat /sys/devices/platform/lis3lv02d/position | awk -F "(" '{print$2}' | awk -F , '{print$1}'`
    echo $POS
        if [ $POS -ge 12 ]; then
            wmctrl -o 1024,0
        elif [ $POS -le -12 ]; then
            wmctrl -o 0,0
        fi
    COUNTER=$(( $COUNTER + 1 ))
done
UPDATE Sep 8, 2009: an approach in python - Download#!/usr/bin/python
import time
import os
cnt=0
while cnt <= 100:
    time.sleep(0.5)
    f = open ('/sys/devices/platform/lis3lv02d/position','r')
    data = f.read()
    ar = data.split(',')
    results = ar[0].replace('(',''), ar[1], ar[2].replace(')','')
    print results
    if (ar[0].replace('(','') >= '12'):
        os.system('wmctrl -o 1024,0')
    elif (ar[1] <= '-12'):
        os.system('wmctrl -o 0,0')
    f.close()
    cnt += 1
Note: Scripts will work when System/Preferences/Appearance/Visual Effects is set to Normal or Extra.

Quick and simple step by step ensymble guide for Windows

This tutorial is intended for a group of people that they're not programmers or they're new to PyS60 and like to experiment making .sis applications for mobile phones. There's a lot of documentation on the internet about ensymble but not a single simple step by step guide.

So the steps we have to follow to built a .sis file are:

1) Download and install OpenSSL for Windows.

2) Download ensymble python script unzip it and copy it to OpenSSL folder (something like: C:\Program Files\GnuWin32\bin\ensymble_python2.5-0.26.py).

3) Also copy your python script to OpenSSL folder and run ensymble command on the command prompt:
python ensymble_python2.5-0.26.py py2sis --uid=0xE0000000 --appname=your_app_name --version=1.0.0 your_app_name.py your_app_name.sisnow you have probably successfully build your .sis file. Also, be sure that you have path your python directory.

4) Go to Open Signed Online and fill the required fields.

5) You'll get an email with a signed sis file.

6) Install it on your phone and enjoy it!

Good luck!

Resources:
Ensymble: http://ensymble.googlecode.com
Ensymble readme: http://code.google.com/p/ensymble/wiki/Welcome?tm=6
OpenSSL: http://gnuwin32.sourceforge.net/packages/openssl.htm
Open signed online: https://www.symbiansigned.com/app/page/public/openSignedOnline.do

Spy phone python script for S60


The other day I was surfing some surveillance websites and I found some patented mobile phones called spy phones and also some spy software. All of course, at high prices for my standards! The concept is, you call the target phone which will result in the answering of it and let you listen into the surroundings. They also have some extra features like stealth/ghost mode, no lights or zero ringings etc etc.

However the price as I mention isn't reasonable and it's possible for someone with basic programming skills and some research on the internet to do that kind of work with no money at all! How?

Well, I wrote a simple python script for S60 compatible devices that allows you to call the target cellphone, which will acknowledge a number of your choice and afterwards when you hung up it automatically start recording any ambient sound or conversation surrounding the phone.
It has no ghost or no ringing capability but if you are using a Nokia phone you can achieve this by assigning a blank sound to that entry.

I have tested it successfully on my Nokia N95 8GB with Python for S60 1.4.2 final.
You can download the script here (Last update: Sun 23 2010).

Have fun :)