<?xml version="1.0"?>
<?xml-stylesheet type="text/css" href="http://bugs.maemo.com/skins/common/feed.css?207"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/">
	<channel>
		<title>maemo.org wiki - User contributions [en]</title>
		<link>http://bugs.maemo.com/Special:Contributions/80.195.81.165</link>
		<description>From maemo.org wiki</description>
		<language>en</language>
		<generator>MediaWiki 1.15.5-7</generator>
		<lastBuildDate>Sun, 05 Apr 2026 02:47:41 GMT</lastBuildDate>
		<item>
			<title>Desktop Command Execution Widget scripts</title>
			<link>http://bugs.maemo.com/Desktop_Command_Execution_Widget_scripts</link>
			<guid>http://bugs.maemo.com/Desktop_Command_Execution_Widget_scripts</guid>
			<description>&lt;p&gt;80.195.81.165:&amp;#32;/* Transport for London - Live Bus Departures */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Desktop Command Execution widget is one of the most useful widgets on your Maemo desktop. It can be used to show certain information (for example battery level in percentage) or as a button which can be used for example to disconnect active internet connection (you need to tap 3 times and also wait for menus to appear without this widget). Therefore it can replace many other applications/widgets/applets and you can also make something new. Here you'll find a collection of scripts that can be added to the widget. The discussion about the widget is [http://talk.maemo.org/showthread.php?t=39177 on the forum].&lt;br /&gt;
&lt;br /&gt;
Scripts are also compatible with [[Queen BeeCon Widget]] which has extended graphic and cosmetic functionality, but is far more complicated.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Making your own scripts==&lt;br /&gt;
&lt;br /&gt;
===Scripts without output===&lt;br /&gt;
&lt;br /&gt;
When there's no output (for example if you're using widget as a button and you use D-Bus call) the widget displays &amp;quot;Invalid Command&amp;quot;. This can be most easily avoided if you pipe echo &amp;quot;&amp;quot; at the end of the command. This is also usable if your script produces unwanted output (D-Bus reply for example).&lt;br /&gt;
&lt;br /&gt;
 dbus-send -options -moreoptions | echo &amp;quot;&amp;quot;&lt;br /&gt;
&lt;br /&gt;
Collection of D-Bus calls can be found on [[Phone control]] wiki page. The basic principle for making a script for DCEW is the same as above (D-Bus command and piping an echo).&lt;br /&gt;
&lt;br /&gt;
===Scripts with long output===&lt;br /&gt;
&lt;br /&gt;
Some scripts may create multiple lines which are too long to be displayed on a single line. The widget will not wrap these. In order to wrap them you can use the fold command:&lt;br /&gt;
 &lt;br /&gt;
 command-that-produces-long-lines | fold -s -w 80&lt;br /&gt;
&lt;br /&gt;
The 80 in that instance is the maximum length of the line, which you can change. The -s option makes fold word wrap with spaces. More information is available from the [http://unixhelp.ed.ac.uk/CGI/man-cgi?fold fold man page].&lt;br /&gt;
&lt;br /&gt;
==Scripts to display information==&lt;br /&gt;
&lt;br /&gt;
===Battery (via Nokia's BME) ===&lt;br /&gt;
&lt;br /&gt;
All battery scripts are collected here. Pick the one which suits your needs. Examples of the output values are under each one.&lt;br /&gt;
&lt;br /&gt;
There are 2 values for full battery capacity available. First one is design charge in mAh, which is always the same (1273 mAh). The second one is the one used in these scripts and it is the full charge from last charging. With displaying this one you can also monitor battery wear level.&lt;br /&gt;
&lt;br /&gt;
Battery percentage level is calculated using first value and is therefore less accurate, that's why you cannot achieve 100% full battery, but only about 95%. After some time the full percentage will be even lower.&lt;br /&gt;
&lt;br /&gt;
But last full charge value has one disadvantage. This is that after a reboot the phone forgets this value and the value returned is 0. It shows the proper value after next charging.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
====Percentage, current and last full charge====&lt;br /&gt;
&lt;br /&gt;
 hal-device bme | awk '/l.p/ {perc = $3}; /g.c/ {curr = $3}; /g.la/ {last = $3}; /s_c/ {isch = $3} END if (isch == &amp;quot;false&amp;quot;) {print perc&amp;quot; % (&amp;quot;curr&amp;quot;/&amp;quot;last&amp;quot; mAh)&amp;quot;} else {print &amp;quot;Charging&amp;quot;}'&lt;br /&gt;
&lt;br /&gt;
Output example: '''83 % (1000/1200 mAh)''', when charging '''Charging'''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
====Percentage and current charge====&lt;br /&gt;
&lt;br /&gt;
 hal-device bme | awk '/l.p/ {perc = $3}; /g.c/ {curr = $3}; /s_c/ {isch = $3} END if (isch == &amp;quot;false&amp;quot;) {print perc&amp;quot; % (&amp;quot;curr&amp;quot; mAh)&amp;quot;} else {print &amp;quot;Charging&amp;quot;}'&lt;br /&gt;
&lt;br /&gt;
Output example: '''83 % (1000 mAh)''', when charging '''Charging'''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
====Percentage====&lt;br /&gt;
&lt;br /&gt;
 hal-device bme | awk '/l.p/ {perc = $3}; /s_c/ {isch = $3} END if (isch == &amp;quot;false&amp;quot;) {print perc&amp;quot; %&amp;quot;} else {print &amp;quot;Chrg&amp;quot;}'&lt;br /&gt;
&lt;br /&gt;
Output example: '''83 %''', when charging '''Chrg'''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
====Current and last full charge====&lt;br /&gt;
&lt;br /&gt;
 hal-device bme | awk '/g.c/ {curr = $3}; /g.la/ {last = $3} END {print curr&amp;quot;/&amp;quot;last&amp;quot; mAh&amp;quot;}'&lt;br /&gt;
&lt;br /&gt;
Output example: '''1000/1200 mAh'''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
====Current charge====&lt;br /&gt;
&lt;br /&gt;
 hal-device bme | awk '/g.c/ {print $3&amp;quot; mAh&amp;quot;}'&lt;br /&gt;
&lt;br /&gt;
Output example: '''1000 mAh'''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
====Last full charge====&lt;br /&gt;
&lt;br /&gt;
 hal-device bme | awk '/g.la/ {print $3&amp;quot; mAh&amp;quot;}'&lt;br /&gt;
&lt;br /&gt;
Output example: '''1200 mAh'''&lt;br /&gt;
&lt;br /&gt;
===Battery (via bq27200 chip) ===&lt;br /&gt;
&lt;br /&gt;
==== Percentage, current and last full charge, with TTE or TTF as appropriate ====&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Install this as e.g. /usr/local/bin/bqbattery, make it executable and point DCEW to it. This is designed to work whether or not you have the bq27x00_battery module loaded, but if you don't, then you'll need to install the i2c-tools package, and then chmod 4755 /usr/sbin/i2cget (meaning i2cget runs as root even when we invoke it as user from DCEW).&lt;br /&gt;
&lt;br /&gt;
 #!/bin/sh&lt;br /&gt;
 &lt;br /&gt;
 if [ -r &amp;quot;/sys/class/power_supply/bq27200-0/capacity&amp;quot; ]; then&lt;br /&gt;
 # We have bq27x00_battery loaded - get the values from /sys/class/power_supply/bq27200-0/&lt;br /&gt;
 CSOC=`cat /sys/class/power_supply/bq27200-0/capacity`;&lt;br /&gt;
 NAC=$((`cat /sys/class/power_supply/bq27200-0/charge_now` / 1000));&lt;br /&gt;
 LMD=$((`cat /sys/class/power_supply/bq27200-0/charge_full` / 1000));&lt;br /&gt;
 STATUS=`cat /sys/class/power_supply/bq27200-0/status`;&lt;br /&gt;
 if [ &amp;quot;$STATUS&amp;quot; == &amp;quot;Discharging&amp;quot; ]; then&lt;br /&gt;
        TTF=65535&lt;br /&gt;
        TTE=$((`cat /sys/class/power_supply/bq27200-0/time_to_empty_avg` / 60));&lt;br /&gt;
 else&lt;br /&gt;
        TTF=$((`cat /sys/class/power_supply/bq27200-0/time_to_full_now` / 60));&lt;br /&gt;
        TTE=65535&lt;br /&gt;
 fi&lt;br /&gt;
 else&lt;br /&gt;
 # We don't have bq27x00_battery - get the values using i2cget&lt;br /&gt;
 NAC=$(($(/usr/sbin/i2cget -y 2 0x55 0x0c w) * 3570 / 20 / 1000));&lt;br /&gt;
 LMD=$(($(/usr/sbin/i2cget -y 2 0x55 0x12 w) * 3570 / 20 / 1000));&lt;br /&gt;
 CSOC=$(($(/usr/sbin/i2cget -y 2 0x55 0x2c)));&lt;br /&gt;
 TTF=$(($(/usr/sbin/i2cget -y 2 0x55 0x18 w)));&lt;br /&gt;
 TTE=$(($(/usr/sbin/i2cget -y 2 0x55 0x16 w)));&lt;br /&gt;
 fi&lt;br /&gt;
 echo &amp;quot;$CSOC% ($NAC/$LMD mAh)&amp;quot;&lt;br /&gt;
 if [ &amp;quot;$TTF&amp;quot; -eq 65535 ]; then&lt;br /&gt;
         echo &amp;quot;$TTE minutes to empty&amp;quot;&lt;br /&gt;
 else&lt;br /&gt;
         echo &amp;quot;$TTF min to full battery&amp;quot;&lt;br /&gt;
 fi&lt;br /&gt;
&lt;br /&gt;
Output example:&lt;br /&gt;
&lt;br /&gt;
'''88% (1269/1439 mAh)'''&lt;br /&gt;
&lt;br /&gt;
'''37 min to full battery'''&lt;br /&gt;
&lt;br /&gt;
===IP===&lt;br /&gt;
&lt;br /&gt;
Internal IPs are obtained from the ifconfig and external IPs are obtained from the internet, because gprs0 IP which you can get with ifconfig is often from private address range, because mobile operators like to use NAT.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
====External (WAN) and internal (LAN)====&lt;br /&gt;
&lt;br /&gt;
 echo WAN IP: `wget -t 2 -T 3 -q -O - api.myiptest.com | awk -F &amp;quot;\&amp;quot;&amp;quot; '{print $4}'`; echo LAN IP: `/sbin/ifconfig wlan0 | awk -F &amp;quot;[: ]&amp;quot; '/Bc/ {print $13}'`&lt;br /&gt;
&lt;br /&gt;
Output example:&lt;br /&gt;
&lt;br /&gt;
'''WAN IP: 1.2.3.4'''&lt;br /&gt;
&lt;br /&gt;
'''LAN IP: 192.168.1.2'''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 echo WAN IP: `wget -t 2 -T 3 -q -O - api.myiptest.com | awk -F &amp;quot;\&amp;quot;&amp;quot; '{print $4 &amp;quot; (&amp;quot;$12&amp;quot; &amp;quot;toupper($28)&amp;quot;)&amp;quot;}'`; echo LAN IP: `/sbin/ifconfig wlan0 | awk -F &amp;quot;[: ]&amp;quot; '/Bc/ {print $13}'`&lt;br /&gt;
&lt;br /&gt;
Output example:&lt;br /&gt;
&lt;br /&gt;
'''WAN IP: 1.2.3.4 (ISP CountryCode)'''&lt;br /&gt;
&lt;br /&gt;
'''LAN IP: 192.168.1.2'''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 echo WAN IP: `wget -t 2 -T 3 -q -O - api.myiptest.com | awk -F &amp;quot;\&amp;quot;&amp;quot; '{print $4&amp;quot; (&amp;quot;$12&amp;quot; @ &amp;quot;$20&amp;quot;, &amp;quot;toupper($28)&amp;quot;)&amp;quot;}'`; echo LAN IP: `/sbin/ifconfig wlan0 | awk -F &amp;quot;[: ]&amp;quot; '/Bc/ {print $13}'`&lt;br /&gt;
&lt;br /&gt;
Output example:&lt;br /&gt;
&lt;br /&gt;
'''WAN IP: 1.2.3.4 (ISP @ City, CountryCode)'''&lt;br /&gt;
&lt;br /&gt;
'''LAN IP: 192.168.1.2'''&lt;br /&gt;
&lt;br /&gt;
====External (WAN)====&lt;br /&gt;
&lt;br /&gt;
 wget -t 2 -T 3 -q -O - api.myiptest.com | awk -F &amp;quot;\&amp;quot;&amp;quot; '{print $4}'&lt;br /&gt;
&lt;br /&gt;
Output example: '''1.2.3.4'''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 wget -t 2 -T 3 -q -O - api.myiptest.com | awk -F &amp;quot;\&amp;quot;&amp;quot; '{print $4 &amp;quot; (&amp;quot;$12&amp;quot; &amp;quot;toupper($28)&amp;quot;)&amp;quot;}'&lt;br /&gt;
&lt;br /&gt;
Output example: '''1.2.3.4 (ISP CountryCode)'''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 wget -t 2 -T 3 -q -O - api.myiptest.com | awk -F &amp;quot;\&amp;quot;&amp;quot; '{print $4&amp;quot; (&amp;quot;$12&amp;quot; @ &amp;quot;$20&amp;quot;, &amp;quot;toupper($28)&amp;quot;)&amp;quot;}'&lt;br /&gt;
&lt;br /&gt;
Output example: '''1.2.3.4 (ISP @ City, CountryCode)'''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
====Internal (LAN)====&lt;br /&gt;
&lt;br /&gt;
 /sbin/ifconfig wlan0 | awk -F &amp;quot;[: ]&amp;quot; '/Bc/ {print $13}'&lt;br /&gt;
&lt;br /&gt;
This one displays only wlan0 IP (used for SSH, WinSCP, VNC... in LAN).&lt;br /&gt;
&lt;br /&gt;
===Disk usage===&lt;br /&gt;
&lt;br /&gt;
====rootfs (256MB /) percentage used====&lt;br /&gt;
&lt;br /&gt;
 df | awk '$1 == &amp;quot;rootfs&amp;quot; {print $5}'&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
====rootfs (256MB /) free space====&lt;br /&gt;
&lt;br /&gt;
 df -h | awk '$1 == &amp;quot;rootfs&amp;quot; {print $4}'&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
====Internal memory for user data (27GB /home/user/MyDocs) percentage used====&lt;br /&gt;
&lt;br /&gt;
 df /home/user/MyDocs | awk '/My/ {print $5}'&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
====Internal memory for user data (27GB /home/user/MyDocs) free space====&lt;br /&gt;
&lt;br /&gt;
 df -h /home/user/MyDocs | awk '/My/ {print $4}'&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
====Internal memory for application data (2GB /home) percentage used====&lt;br /&gt;
&lt;br /&gt;
 df /home | awk '/ho/ {print $5}'&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
====Internal memory for application data (2GB /home) free space====&lt;br /&gt;
&lt;br /&gt;
 df -h /home | awk '/ho/ {print $4}'&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
====Memory card (/media/mmc1) percentage used====&lt;br /&gt;
&lt;br /&gt;
 df /media/mmc1 | awk '/mm/ {print $5}'&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
====Memory card (/media/mmc1) free space====&lt;br /&gt;
&lt;br /&gt;
 df -h /media/mmc1 | awk '/mm/ {print $4}'&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Cellular signal===&lt;br /&gt;
&lt;br /&gt;
====Quality====&lt;br /&gt;
&lt;br /&gt;
 dbus-send --system --print-reply --dest=com.nokia.phone.net /com/nokia/phone/net Phone.Net.get_signal_strength | awk 'NR==2 {print $2&amp;quot; %&amp;quot;}'&lt;br /&gt;
&lt;br /&gt;
====Strength====&lt;br /&gt;
&lt;br /&gt;
 dbus-send --system --print-reply --dest=com.nokia.phone.net /com/nokia/phone/net Phone.Net.get_signal_strength | awk 'NR==3 {print &amp;quot;-&amp;quot;$2&amp;quot; dBm&amp;quot;}'&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Wi-Fi signal===&lt;br /&gt;
&lt;br /&gt;
====Quality====&lt;br /&gt;
&lt;br /&gt;
 awk -F &amp;quot;[. ]&amp;quot; '/0/ {print $6&amp;quot; %&amp;quot;}' /proc/net/wireless&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
====RSSI====&lt;br /&gt;
&lt;br /&gt;
 awk '/0/ {print $4&amp;quot; dBm&amp;quot;}' /proc/net/wireless&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
====Noise====&lt;br /&gt;
&lt;br /&gt;
 awk -F &amp;quot;[. ]&amp;quot; '/0/ {print $12&amp;quot; dBm&amp;quot;}' /proc/net/wireless&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===CPU frequency===&lt;br /&gt;
&lt;br /&gt;
 awk '{print $1/1000&amp;quot; MHz&amp;quot;}' /sys/devices/system/cpu/cpu0/cpufreq/scaling_cur_freq&lt;br /&gt;
&lt;br /&gt;
====Usage of each frequency====&lt;br /&gt;
&lt;br /&gt;
 awk -v var=$(awk '{sum+=$2}; END {print sum};' /sys/devices/system/cpu/cpu0/cpufreq/stats/time_in_state) '{arr[$3]=$2}{for (i in arr) {print $1/1000 &amp;quot; mhz &amp;quot; int(arr[i]*100/var)&amp;quot;%&amp;quot;}}' /sys/devices/system/cpu/cpu0/cpufreq/stats/time_in_state&lt;br /&gt;
&lt;br /&gt;
===Memory usage===&lt;br /&gt;
&lt;br /&gt;
====RAM used====&lt;br /&gt;
&lt;br /&gt;
 awk '/mT/ {memttl = $2}; /mF/ {memfre = $2}; /Bu/ {membff = $2}; $1 == &amp;quot;Cached:&amp;quot; {memcch = $2} END {printf (&amp;quot;%.1f MB\n&amp;quot;,(memttl-memfre-membff-memcch)/1024)}' /proc/meminfo&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
====RAM free====&lt;br /&gt;
&lt;br /&gt;
 awk '/mF/ {memfre = $2}; /Bu/ {membff = $2}; $1 == &amp;quot;Cached:&amp;quot; {memcch = $2} END {printf (&amp;quot;%.1f MB\n&amp;quot;,(memfre+membff+memcch)/1024)}' /proc/meminfo&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
====Swap used====&lt;br /&gt;
&lt;br /&gt;
 awk '/pT/ {swpttl = $2}; /pF/ {swpfre = $2} END {printf (&amp;quot;%.1f MB\n&amp;quot;,(swpttl-swpfre)/1024)}' /proc/meminfo&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
====Swap free====&lt;br /&gt;
&lt;br /&gt;
 awk '/pF/ {printf (&amp;quot;%.1f MB\n&amp;quot;,$2/1024)}' /proc/meminfo&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
====Total memory used====&lt;br /&gt;
&lt;br /&gt;
 awk '/mT/ {memttl = $2}; /mF/ {memfre = $2}; /Bu/ {membff = $2}; $1 == &amp;quot;Cached:&amp;quot; {memcch = $2}; /pT/ {swpttl = $2}; /pF/ {swpfre = $2} END {printf (&amp;quot;%.1f MB\n&amp;quot;,(memttl+swpttl-memfre-membff-memcch-swpfre)/1024)}' /proc/meminfo&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
====Total memory free====&lt;br /&gt;
&lt;br /&gt;
 awk '/mF/ {memfre = $2}; /Bu/ {membff = $2}; $1 == &amp;quot;Cached:&amp;quot; {memcch = $2}; /pF/ {swpfre = $2} END {printf (&amp;quot;%.1f MB\n&amp;quot;,(memfre+membff+memcch+swpfre)/1024)}' /proc/meminfo&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===GPRS data usage===&lt;br /&gt;
&lt;br /&gt;
You can use this with scheduled reset of the GPRS data counter to display data usage for current month. Additional info can be found on [[fcron]] wiki page.&lt;br /&gt;
&lt;br /&gt;
These scripts are now compatibile with PR1.2 (separate home and roaming counter), which means they won't work on previous versions.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
====Home counter (combined)====&lt;br /&gt;
&lt;br /&gt;
 echo `gconftool-2 -g /system/osso/connectivity/network_type/GPRS/gprs_home_rx_bytes` `gconftool-2 -g /system/osso/connectivity/network_type/GPRS/gprs_home_tx_bytes` | awk '{printf (&amp;quot;%.1f MB\n&amp;quot;,($1+$2)/1048576)}'&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
====Home counter (separated)====&lt;br /&gt;
&lt;br /&gt;
 echo `gconftool-2 -g /system/osso/connectivity/network_type/GPRS/gprs_home_rx_bytes | awk '{printf (&amp;quot;Download: %.1f MB\n&amp;quot;,$1/1048576)}'`; echo `gconftool-2 -g /system/osso/connectivity/network_type/GPRS/gprs_home_tx_bytes | awk '{printf (&amp;quot;Upload: %.1f MB\n&amp;quot;,$1/1048576)}'`&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
====Roaming counter (combined)====&lt;br /&gt;
&lt;br /&gt;
 echo `gconftool-2 -g /system/osso/connectivity/network_type/GPRS/gprs_roaming_rx_bytes` `gconftool-2 -g /system/osso/connectivity/network_type/GPRS/gprs_roaming_tx_bytes` | awk '{printf (&amp;quot;%.1f MB\n&amp;quot;,($1+$2)/1048576)}'&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
====Roaming counter (separated)====&lt;br /&gt;
&lt;br /&gt;
 echo `gconftool-2 -g /system/osso/connectivity/network_type/GPRS/gprs_roaming_rx_bytes | awk '{printf (&amp;quot;Download: %.1f MB\n&amp;quot;,$1/1048576)}'`; echo `gconftool-2 -g /system/osso/connectivity/network_type/GPRS/gprs_roaming_tx_bytes | awk '{printf (&amp;quot;Upload: %.1f MB\n&amp;quot;,$1/1048576)}'`&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Time and date===&lt;br /&gt;
&lt;br /&gt;
====Date====&lt;br /&gt;
&lt;br /&gt;
 date +&amp;quot;%a, %-d.%-m.%Y&amp;quot;&lt;br /&gt;
&lt;br /&gt;
This command will show the date in format (for example) '''Tue, 4.5.2010'''. You can define your own format (between the quotation marks). Possible options are described on [http://unixhelp.ed.ac.uk/CGI/man-cgi?date manpage].&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
====Time in different timezones====&lt;br /&gt;
 &lt;br /&gt;
 export TZ=&amp;quot;Europe/London&amp;quot;; date +%R&lt;br /&gt;
&lt;br /&gt;
This one shows two timezones in format ''London: 13:04 | Denver: 06:04''&lt;br /&gt;
&lt;br /&gt;
 echo &amp;quot;London:&amp;quot; `export TZ=&amp;quot;Europe/London&amp;quot;; date +%R` &amp;quot;| Denver:&amp;quot; `export TZ=&amp;quot;America/Denver&amp;quot;; date +%R`&lt;br /&gt;
&lt;br /&gt;
London and Denver are taken as an example. TZ values can be found on [[:wikipedia:List_of_tz_database_time_zones|Wikipedia]].&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Uptime and load===&lt;br /&gt;
&lt;br /&gt;
These scripts are formatproof meaning that they display what they're supposed to no matter what format is command &amp;quot;uptime&amp;quot; outputting. Not all scripts found are like that, because &amp;quot;uptime&amp;quot; command is a little bit complicated for scripted text processing. For example when the system is running under one hour only &amp;quot;x min&amp;quot; is shown, when it is running under one day &amp;quot;hour:min:sec&amp;quot; is shown and after that it is shown in format &amp;quot;x days, hour:min:sec&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
====Both====&lt;br /&gt;
&lt;br /&gt;
 uptime | sed -e 's/.*up */uptime: /' -e 's/ average//' -e 's/  / /'&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
====Uptime====&lt;br /&gt;
&lt;br /&gt;
 uptime | sed -e 's/.*p *//' -e 's/, l.*//' -e 's/  / /'&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
====Load====&lt;br /&gt;
&lt;br /&gt;
 uptime | sed 's/.*e: //'&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Boot reason===&lt;br /&gt;
&lt;br /&gt;
 cat /proc/bootreason&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Boot count===&lt;br /&gt;
&lt;br /&gt;
 cat /var/lib/dsme/boot_count&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Temperature===&lt;br /&gt;
&lt;br /&gt;
CPU's thermal sensors are not accessible, but there is one near the battery. This commands displays output of its readings, but IT IS NOT RELIABLE, because it doesn't always work. Sometimes the value returned is wrong or constant. It needs to be tested further.&lt;br /&gt;
&lt;br /&gt;
 cat /sys/devices/platform/omap34xx_temp/temp1_input | awk '{ sub(/-/,&amp;quot;&amp;quot;); print $1&amp;quot; °C&amp;quot;}'&lt;br /&gt;
&lt;br /&gt;
There is a working way now to read the correct temperature, but it is working only on a newer titan's kernels (normal, overclock, undervoltage). The bq27x00_battery module has to be loaded first.&lt;br /&gt;
&lt;br /&gt;
 echo `cat /sys/class/power_supply/bq27200-0/temp` °C&lt;br /&gt;
&lt;br /&gt;
with a comma : &lt;br /&gt;
&lt;br /&gt;
 echo `cat /sys/class/power_supply/bq27200-0/temp` °C | sed 's/\B[0-9]\{1\}/&amp;amp;,/'&lt;br /&gt;
&lt;br /&gt;
===Top processes===&lt;br /&gt;
&lt;br /&gt;
This script displays top ''N'' CPU consuming processes. It excludes top itself, which is quite processor intensive so you probably don't want this updating too often. Modify ''N=3'' at the start to display different number of processes.&lt;br /&gt;
&lt;br /&gt;
 N=3; top -bn 1 | grep -v top | head -n $(($N+4)) | tail -n $(($N+1)) | awk '{OFS = &amp;quot;\t&amp;quot;} {print $7,$8}'&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Random Number Generator===&lt;br /&gt;
&lt;br /&gt;
This script displays a random number between 0 and ''M'' (''M'' included)&lt;br /&gt;
&lt;br /&gt;
 M=6; dd if=/dev/urandom bs=1 count=4 2&amp;gt;/dev/null | od -l | awk -v M=$M '{M++;print $2&amp;lt;0?-$2%M:$2%M;exit}'&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Ping a Host===&lt;br /&gt;
Preferred method. Install netcat from [http://wiki.maemo.org/Documentation/devtools/maemo5#Installation]&lt;br /&gt;
&lt;br /&gt;
 if (nc -zw1 192.168.2.1 80);then echo up;else echo down;fi&lt;br /&gt;
&lt;br /&gt;
Alternate method. Ping has a long timeout when down. Warning: it will block the desktop while running.&lt;br /&gt;
&lt;br /&gt;
 if (echo 'ping -c1 192.168.2.1' | rootsh /bin/sh  2&amp;gt;&amp;amp;1 &amp;gt;/dev/null);then echo up;else echo down;fi&lt;br /&gt;
&lt;br /&gt;
==Scripts for buttons==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Make sure that update policy for button widgets is set only to &amp;quot;update when clicked&amp;quot;. &amp;quot;Update when switched to desktop&amp;quot;, &amp;quot;update interval&amp;quot; and &amp;quot;network presence&amp;quot; should be disabled to avoid automatic actions. Also keep in mind that widgets are executed at every boot so they can for example automatically disable Wi-Fi when phone boots.&lt;br /&gt;
&lt;br /&gt;
There is a bug in version 0.9 or lower which prevents you from using DCEW widgets as buttons, because they get activated (pressed) automatically all the time. You have to make sure DCEW is at least version 1.0, to check which version you have installed do this: dpkg -l desktop-cmd-exec.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Networking===&lt;br /&gt;
&lt;br /&gt;
====Connect/disconnect====&lt;br /&gt;
&lt;br /&gt;
 sh /path/conn-disconn.sh | echo &amp;quot;&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''conn-disconn.sh'''&lt;br /&gt;
&lt;br /&gt;
 #!/bin/sh&lt;br /&gt;
 if [ `/sbin/route | awk '/au/ {print $1}'` = default ]; then&lt;br /&gt;
 dbus-send --system --dest=com.nokia.icd /com/nokia/icd_ui com.nokia.icd_ui.disconnect boolean:true&lt;br /&gt;
 else&lt;br /&gt;
 dbus-send --system --type=method_call --dest=com.nokia.icd /com/nokia/icd com.nokia.icd.connect string:&amp;quot;[ANY]&amp;quot; uint32:0&lt;br /&gt;
 fi&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
====Connect internet (show connections)====&lt;br /&gt;
&lt;br /&gt;
 dbus-send --system --type=method_call --dest=com.nokia.icd_ui /com/nokia/icd_ui com.nokia.icd_ui.show_conn_dlg boolean:false | echo &amp;quot;&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
====Connect to any saved connection====&lt;br /&gt;
&lt;br /&gt;
 dbus-send --system --type=method_call --dest=com.nokia.icd /com/nokia/icd com.nokia.icd.connect string:&amp;quot;[ANY]&amp;quot; uint32:0 | echo &amp;quot;&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
====Disconnect internet====&lt;br /&gt;
&lt;br /&gt;
 dbus-send --system --dest=com.nokia.icd /com/nokia/icd_ui com.nokia.icd_ui.disconnect boolean:true | echo &amp;quot;&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
====Enable/disable Wi-Fi====&lt;br /&gt;
&lt;br /&gt;
 echo &amp;quot;/path/to/script/wifi.sh&amp;quot; | sudo gainroot | echo &amp;quot;&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''wifi.sh script:'''&lt;br /&gt;
&lt;br /&gt;
 #!/bin/sh&lt;br /&gt;
 out=`ifconfig wlan0`&lt;br /&gt;
 if [ $? -eq &amp;quot;0&amp;quot; ] ; then&lt;br /&gt;
 if [ `echo &amp;quot;$out&amp;quot; | grep -c RUNNING` -gt &amp;quot;0&amp;quot; ] ; then&lt;br /&gt;
 run-standalone.sh dbus-send --system --dest=com.nokia.icd /com/nokia/icd_ui com.nokia.icd_ui.disconnect boolean:true&lt;br /&gt;
 fi&lt;br /&gt;
 ifconfig wlan0 down&lt;br /&gt;
 rmmod wl12xx&lt;br /&gt;
 run-standalone.sh dbus-send --type=method_call --dest=org.freedesktop.Notifications /org/freedesktop/Notifications org.freedesktop.Notifications.SystemNoteInfoprint string:'Wi-Fi disabled'&lt;br /&gt;
 exit 2&lt;br /&gt;
 else&lt;br /&gt;
 modprobe wl12xx&lt;br /&gt;
 wl1251-cal&lt;br /&gt;
 stop wlancond&lt;br /&gt;
 start wlancond&lt;br /&gt;
 ifconfig wlan0 up&lt;br /&gt;
 run-standalone.sh dbus-send --system --type=method_call --dest=com.nokia.icd_ui /com/nokia/icd_ui com.nokia.icd_ui.show_conn_dlg boolean:false&lt;br /&gt;
 exit 0&lt;br /&gt;
 fi&lt;br /&gt;
&lt;br /&gt;
Don't forget to make it executable.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
====Wake On Lan====&lt;br /&gt;
 &lt;br /&gt;
 /path/to/script/wol.py | echo &amp;quot;&amp;quot;&lt;br /&gt;
wol.py script;&lt;br /&gt;
&lt;br /&gt;
 #! /usr/bin/python&lt;br /&gt;
 # Wake-On-LAN&lt;br /&gt;
 # Change ip range in the &amp;quot;s.sendto(msg&amp;quot; line &lt;br /&gt;
 # and the MAC of the pc to wakeup in the bottom line&lt;br /&gt;
 import struct, socket&lt;br /&gt;
 def WakeOnLan(ethernet_address):&lt;br /&gt;
  # Construct a six-byte hardware address&lt;br /&gt;
  addr_byte = ethernet_address.split(':')&lt;br /&gt;
  hw_addr = struct.pack('BBBBBB', int(addr_byte[0], 16),&lt;br /&gt;
    int(addr_byte[1], 16),&lt;br /&gt;
    int(addr_byte[2], 16),&lt;br /&gt;
    int(addr_byte[3], 16),&lt;br /&gt;
    int(addr_byte[4], 16),&lt;br /&gt;
    int(addr_byte[5], 16))&lt;br /&gt;
  # Build the Wake-On-LAN &amp;quot;Magic Packet&amp;quot;...&lt;br /&gt;
  msg = '\xff' * 6 + hw_addr * 16&lt;br /&gt;
  # ...and send it to the broadcast address using UDP&lt;br /&gt;
  s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)&lt;br /&gt;
  s.setsockopt(socket.SOL_SOCKET, socket.SO_BROADCAST, 1)&lt;br /&gt;
  s.sendto(msg, ('192.168.1.255', 9))&lt;br /&gt;
  s.close()&lt;br /&gt;
 # Example use&lt;br /&gt;
 WakeOnLan('00:13:21:00:62:AE')&lt;br /&gt;
Don't forget to Chmod 755 wol.py&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
====Disconnect mobile network====&lt;br /&gt;
&lt;br /&gt;
 dbus-send --system --type=method_call --dest=com.nokia.phone.SSC /com/nokia/phone/SSC com.nokia.phone.SSC.set_radio boolean:false | echo &amp;quot;&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
====Connect mobile network====&lt;br /&gt;
&lt;br /&gt;
 dbus-send --system --type=method_call --dest=com.nokia.phone.SSC /com/nokia/phone/SSC com.nokia.phone.SSC.set_radio boolean:true | echo &amp;quot;&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Lock screen and keys===&lt;br /&gt;
&lt;br /&gt;
 dbus-send --system --type=method_call --dest=com.nokia.mce /com/nokia/mce/request com.nokia.mce.request.req_tklock_mode_change string:&amp;quot;locked&amp;quot; | echo &amp;quot;&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Radio mode===&lt;br /&gt;
&lt;br /&gt;
====2G/3G====&lt;br /&gt;
&lt;br /&gt;
 sh /path/to/script/2g3g.sh | echo &amp;quot;&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''2g3g.sh script:'''&lt;br /&gt;
&lt;br /&gt;
 #!/bin/sh&lt;br /&gt;
 if [ `dbus-send --system --type=method_call --print-reply --dest=com.nokia.phone.net /com/nokia/phone/net Phone.Net.get_selected_radio_access_technology | awk '/b/ {print $2}'` -eq 1 ]; then&lt;br /&gt;
 dbus-send --system --type=method_call --dest=com.nokia.phone.net /com/nokia/phone/net Phone.Net.set_selected_radio_access_technology byte:2&lt;br /&gt;
 else&lt;br /&gt;
 dbus-send --system --type=method_call --dest=com.nokia.phone.net /com/nokia/phone/net Phone.Net.set_selected_radio_access_technology byte:1&lt;br /&gt;
 fi&lt;br /&gt;
&lt;br /&gt;
When 3G or Dual mode is active, the script will switch to 2G. And when 2G is active, it will switch to 3G.&lt;br /&gt;
&lt;br /&gt;
Don't forget to make the script executable.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
====2G====&lt;br /&gt;
&lt;br /&gt;
 dbus-send --system --type=method_call --dest=com.nokia.phone.net /com/nokia/phone/net Phone.Net.set_selected_radio_access_technology byte:1 | echo &amp;quot;&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
====3G====&lt;br /&gt;
&lt;br /&gt;
 dbus-send --system --type=method_call --dest=com.nokia.phone.net /com/nokia/phone/net Phone.Net.set_selected_radio_access_technology byte:2 | echo &amp;quot;&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
====Dual====&lt;br /&gt;
&lt;br /&gt;
 dbus-send --system --type=method_call --dest=com.nokia.phone.net /com/nokia/phone/net Phone.Net.set_selected_radio_access_technology byte:0 | echo &amp;quot;&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Bluetooth===&lt;br /&gt;
&lt;br /&gt;
====Enable====&lt;br /&gt;
&lt;br /&gt;
 dbus-send --system --type=method_call --dest=org.bluez $(dbus-send --system --print-reply --dest=org.bluez / org.bluez.Manager.ListAdapters | awk -F &amp;quot;\&amp;quot;&amp;quot; '/at/ {print $2}') org.bluez.Adapter.SetProperty string:Powered variant:boolean:true | echo &amp;quot;&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
====Disable====&lt;br /&gt;
&lt;br /&gt;
 dbus-send --system --type=method_call --dest=org.bluez $(dbus-send --system --print-reply --dest=org.bluez / org.bluez.Manager.ListAdapters | awk -F &amp;quot;\&amp;quot;&amp;quot; '/at/ {print $2}') org.bluez.Adapter.SetProperty string:Powered variant:boolean:false | echo &amp;quot;&amp;quot;&lt;br /&gt;
&lt;br /&gt;
===Profiles===&lt;br /&gt;
&lt;br /&gt;
====General====&lt;br /&gt;
&lt;br /&gt;
 dbus-send --type=method_call --dest=com.nokia.profiled /com/nokia/profiled com.nokia.profiled.set_profile string:&amp;quot;general&amp;quot; | echo &amp;quot;&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
====Silent====&lt;br /&gt;
&lt;br /&gt;
 dbus-send --type=method_call --dest=com.nokia.profiled /com/nokia/profiled com.nokia.profiled.set_profile string:&amp;quot;silent&amp;quot; | echo&amp;quot;&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
====Toggle vibrating alert====&lt;br /&gt;
&lt;br /&gt;
There are far more things you can do with your profile. Please have a look at the [[Phone_control#Get_all_profile_Values|profile values at the phone control page]]. This example disables vibrating alert for the active profile.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 # Which profile is active?&lt;br /&gt;
 if \&lt;br /&gt;
 dbus-send --print-reply --type=method_call \&lt;br /&gt;
 --dest=com.nokia.profiled /com/nokia/profiled \&lt;br /&gt;
 com.nokia.profiled.get_profile | grep -q general&lt;br /&gt;
 then&lt;br /&gt;
 	# general profile is active&lt;br /&gt;
 	dbus-send --type=method_call \&lt;br /&gt;
 	--dest=com.nokia.profiled /com/nokia/profiled \&lt;br /&gt;
 	com.nokia.profiled.set_value string:&amp;quot;general&amp;quot; \&lt;br /&gt;
 	string:&amp;quot;vibrating.alert.enabled&amp;quot; string:&amp;quot;Off&amp;quot;&lt;br /&gt;
 else&lt;br /&gt;
 	# silent profile is active&lt;br /&gt;
 	dbus-send --type=method_call \&lt;br /&gt;
 	--dest=com.nokia.profiled /com/nokia/profiled \&lt;br /&gt;
 	com.nokia.profiled.set_value string:&amp;quot;silent&amp;quot; \&lt;br /&gt;
 	string:&amp;quot;vibrating.alert.enabled&amp;quot; string:&amp;quot;Off&amp;quot;&lt;br /&gt;
 fi&lt;br /&gt;
&lt;br /&gt;
You get the opposite behaviour (enable vibrating alert) simply by replacing &amp;quot;Off&amp;quot; two times by &amp;quot;On&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
===Lock (secure) the device===&lt;br /&gt;
&lt;br /&gt;
 dbus-send --system --type=method_call --dest=com.nokia.system_ui /com/nokia/system_ui/request com.nokia.system_ui.request.devlock_open string:&amp;quot;com.nokia.mce&amp;quot; string:&amp;quot;/com/nokia/mce/request&amp;quot; string:&amp;quot;com.nokia.mce.request&amp;quot; string:&amp;quot;devlock_callback&amp;quot; uint32:'3' | echo &amp;quot;&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Update e-mail===&lt;br /&gt;
&lt;br /&gt;
 sh /path/to/script/email.sh | echo &amp;quot;&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''email.sh script:'''&lt;br /&gt;
&lt;br /&gt;
The script connects to the internet and refreshes e-mail. Keep in mind that Modest e-mail client which N900 uses is very slow in this aspect and send and recive can take up to minute and a half. Make it executable.&lt;br /&gt;
&lt;br /&gt;
 #!/bin/sh&lt;br /&gt;
 run-standalone.sh dbus-send --type=method_call --dest=org.freedesktop.Notifications /org/freedesktop/Notifications org.freedesktop.Notifications.SystemNoteInfoprint string:&amp;quot;Updating e-mail...&amp;quot;&lt;br /&gt;
 run-standalone.sh dbus-send --system --type=method_call --dest=com.nokia.icd /com/nokia/icd com.nokia.icd.connect string:&amp;quot;[ANY]&amp;quot; uint32:0&lt;br /&gt;
 sleep 10&lt;br /&gt;
 run-standalone.sh dbus-send --type=method_call --dest=com.nokia.modest /com/nokia/modest com.nokia.modest.SendReceive&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Set maximum CPU frequency===&lt;br /&gt;
&lt;br /&gt;
 echo &amp;quot;echo 600000 &amp;gt; /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq&amp;quot; | sudo gainroot | echo &amp;quot;&amp;quot;&lt;br /&gt;
&lt;br /&gt;
Replace 600000 with desired maximum frequency. This is usable with the new overclocking kernels if you wish to manually change the maximum frequency to which processor can scale. Pay attention to the two exceptions in titan's kernels (124999 and 599000). The list of available frequencies on your device/kernel can be obtained with command:&lt;br /&gt;
&lt;br /&gt;
 awk '{print $1/1000&amp;quot; MHz&amp;quot;}' /sys/devices/system/cpu/cpu0/cpufreq/stats/time_in_state&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Reboot===&lt;br /&gt;
&lt;br /&gt;
 echo &amp;quot;reboot&amp;quot; | sudo gainroot | echo &amp;quot;&amp;quot;&lt;br /&gt;
&lt;br /&gt;
Warning: Consult forums before you try this, because currently DCEW executes some (all?) commands at startup. This will be optional in next version. Making a reboot button on current DCEW version could result in endless reboot loop.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===FM transmitter===&lt;br /&gt;
&lt;br /&gt;
====Enable/disable====&lt;br /&gt;
&lt;br /&gt;
 /usr/bin/fmtx_client -p$(if [ $(cut -d. -f1 /proc/uptime ) -lt 100 ]; then echo 0; else /usr/bin/fmtx_client | /bin/grep -q '^state=enabled' ; echo $? ; fi) | /usr/bin/awk -F &amp;quot;=&amp;quot; '($1==&amp;quot;state&amp;quot;) {print $2}'&lt;br /&gt;
&lt;br /&gt;
Note: when you reboot the device, this script waits 100 seconds before you can turn the transmitter on/off again.&lt;br /&gt;
&lt;br /&gt;
====Increase power====&lt;br /&gt;
&lt;br /&gt;
 echo &amp;quot;echo 118 &amp;gt; /sys/class/i2c-adapter/i2c-2/2-0063/power_level&amp;quot; | sudo gainroot | echo &amp;quot;&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===DBUS call to start browser===&lt;br /&gt;
&lt;br /&gt;
 /usr/bin/browser_dbuscmd.sh load_url http://www.bbc.co.uk/iplayer/console/bbc_radio_fourfm&lt;br /&gt;
[[Category:Software]]&lt;br /&gt;
[[Category:Power users]]&lt;br /&gt;
&lt;br /&gt;
===Display a Conboy Note===&lt;br /&gt;
 python /home/user/conboy_note_to_text.py print noteid&lt;br /&gt;
&lt;br /&gt;
'''conboy_note_to_text.py'''&lt;br /&gt;
Make sure to make this python script executable (chmod 755 /path/to/conboy_note_to_text.py). To list all notes with their title and id in xterm, just use the following commands: python /home/user/conboy_note_to_text.py list&lt;br /&gt;
&lt;br /&gt;
Source : http://khertan.net/articles/maemo/conboy_note_to_text&lt;br /&gt;
&lt;br /&gt;
Direct Script Link : http://khertan.net/_export/code/articles/maemo/conboy_note_to_text?codeblock=0&lt;br /&gt;
&lt;br /&gt;
 #!/usr/lib/python2.5&lt;br /&gt;
 &lt;br /&gt;
 from xml.dom import minidom&lt;br /&gt;
 import os.path&lt;br /&gt;
 import glob&lt;br /&gt;
 import sys&lt;br /&gt;
 import re&lt;br /&gt;
 from xml.sax.handler import ContentHandler&lt;br /&gt;
 import xml.sax&lt;br /&gt;
 &lt;br /&gt;
 class NoteList:&lt;br /&gt;
    def __init__(self,path):&lt;br /&gt;
        self.path = path&lt;br /&gt;
        self.noteList = {}&lt;br /&gt;
        for infile in glob.glob( os.path.join(self.path, '*.note') ):&lt;br /&gt;
          note = Reader(os.path.basename(infile)[:-5])&lt;br /&gt;
          if note.title != None:&lt;br /&gt;
              self.noteList[note.title]=note.note_id&lt;br /&gt;
 &lt;br /&gt;
    def get_note_id_by_title(self,title):&lt;br /&gt;
        try:&lt;br /&gt;
            return self.noteList[title]&lt;br /&gt;
        except:&lt;br /&gt;
            return None&lt;br /&gt;
 &lt;br /&gt;
 class textHandler(ContentHandler):&lt;br /&gt;
    def __init__(self):&lt;br /&gt;
      ContentHandler.__init__(self)&lt;br /&gt;
      self.content = &amp;quot;&amp;quot;&lt;br /&gt;
      self.title = &amp;quot;&amp;quot;&lt;br /&gt;
      self.selector = None&lt;br /&gt;
 &lt;br /&gt;
    def startElement(self, element,attributes):&lt;br /&gt;
        if (element == 'note-content') and (self.selector == None):&lt;br /&gt;
            self.selector = element&lt;br /&gt;
        elif (element == 'title') and (self.selector == None):&lt;br /&gt;
            self.selector = element&lt;br /&gt;
 &lt;br /&gt;
 &lt;br /&gt;
    def endElement(self, element):&lt;br /&gt;
        if (element == self.selector):&lt;br /&gt;
            self.selector = None&lt;br /&gt;
 &lt;br /&gt;
    def characters(self, ch):&lt;br /&gt;
        if self.selector == 'note-content':&lt;br /&gt;
            self.content = self.content + unicode(ch)&lt;br /&gt;
        elif self.selector == 'title':&lt;br /&gt;
            self.title = self.title + unicode(ch)&lt;br /&gt;
 &lt;br /&gt;
 class Reader:&lt;br /&gt;
    def __init__(self,note_id):&lt;br /&gt;
        self.note_id = note_id&lt;br /&gt;
        self.content = None&lt;br /&gt;
        self.title = None&lt;br /&gt;
 &lt;br /&gt;
        try:&lt;br /&gt;
            parser = xml.sax.make_parser()&lt;br /&gt;
            handler = textHandler()&lt;br /&gt;
            parser.setContentHandler(handler)&lt;br /&gt;
              parser.parse(os.path.join(os.path.expanduser(&amp;quot;~&amp;quot;),'.conboy',self.note_id+'.note'))&lt;br /&gt;
            self.content = handler.content&lt;br /&gt;
            self.title = handler.title &lt;br /&gt;
        except StandardError,e:&lt;br /&gt;
            print e&lt;br /&gt;
 &lt;br /&gt;
 &lt;br /&gt;
 &lt;br /&gt;
 if __name__ == &amp;quot;__main__&amp;quot;:&lt;br /&gt;
    try:&lt;br /&gt;
        if (sys.argv[1]=='print'):&lt;br /&gt;
            print Reader(unicode(sys.argv[2])).content&lt;br /&gt;
        elif (sys.argv[1]=='list'):&lt;br /&gt;
            nlist = NoteList('/home/user/.conboy/').noteList&lt;br /&gt;
            for key in nlist.keys():&lt;br /&gt;
                print key, ' : ', nlist[key]&lt;br /&gt;
        elif (sys.argv[1]=='search'):&lt;br /&gt;
            nlist = NoteList('/home/user/.conboy/')&lt;br /&gt;
            print nlist.get_note_id_by_title(sys.argv[2])&lt;br /&gt;
        else:&lt;br /&gt;
            raise&lt;br /&gt;
    except StandardError,e:&lt;br /&gt;
            print &amp;quot;&amp;quot;&amp;quot;Usage : python conboy_note_reader.py option [note_id or note title]&lt;br /&gt;
            Option : &lt;br /&gt;
                - list : list all note by title with id&lt;br /&gt;
                - print : print content of note with the given id&lt;br /&gt;
                - search : print id of the given title&amp;quot;&amp;quot;&amp;quot;&lt;br /&gt;
            print e&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Scripts to pull data from remote web sites ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Transport for London - Live Bus Departures ===&lt;br /&gt;
&lt;br /&gt;
Transport for London recently launched a mobile Web interface to their live bus departures information, and it's pretty good, but it can be a pain navigating to the bus stop that you want. This script uses DCEW to display data from multiple local bus stops, and to switch between them (by iterating over a list of them) on touching the widget.&lt;br /&gt;
 #!/bin/sh&lt;br /&gt;
 &lt;br /&gt;
 BUS_STOPS=&amp;quot;50713 48598 53221 74407&amp;quot;&lt;br /&gt;
 &lt;br /&gt;
 if [ -r &amp;quot;/tmp/.bus_stops&amp;quot; ]; then&lt;br /&gt;
 	BUS_STOPS=`cat /tmp/.bus_stops`;&lt;br /&gt;
 else&lt;br /&gt;
 	echo $BUS_STOPS &amp;gt; /tmp/.bus_stops;&lt;br /&gt;
 	chmod 777 /tmp/.bus_stops&lt;br /&gt;
 fi&lt;br /&gt;
 &lt;br /&gt;
 LOOP=0&lt;br /&gt;
 if [ -r &amp;quot;/tmp/.countdown&amp;quot; ]; then&lt;br /&gt;
 LOOP=`cat /tmp/.countdown`;&lt;br /&gt;
 fi&lt;br /&gt;
 let LOOP=$LOOP+1;&lt;br /&gt;
 STOPCOUNT=`echo $BUS_STOPS | wc -w`;&lt;br /&gt;
 if [ &amp;quot;$LOOP&amp;quot; -gt &amp;quot;$STOPCOUNT&amp;quot; ]; then&lt;br /&gt;
   LOOP=1;&lt;br /&gt;
 fi;&lt;br /&gt;
 echo $LOOP &amp;gt;/tmp/.countdown&lt;br /&gt;
 chmod 777 /tmp/.countdown&lt;br /&gt;
 &lt;br /&gt;
 THISTIME=`echo $BUS_STOPS | cut -d&amp;quot; &amp;quot; -f $LOOP`;&lt;br /&gt;
 &lt;br /&gt;
 lynx -dump -nolist http://m.countdown.tfl.gov.uk/arrivals/$THISTIME | grep -A10 &amp;quot;Buses dep&amp;quot; | sed -e &amp;quot;s/^   //g&amp;quot; | grep [a-z] | egrep -v &amp;quot;(Refresh|See\ map|Buses\ departing)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
This second script, designed to be used with an additional DCEW on the same screen as the first, changes the list of bus stops associated with the script above and displays the place name with which they are associated. So, using this second widget, I can switch the first widget between the list of bus stops that I require in one place, and the list that I require in another. This limits the length of any individual list and will eventually let me access four or five lists of stops according to where I happen to be.&lt;br /&gt;
&lt;br /&gt;
 #!/bin/sh&lt;br /&gt;
 &lt;br /&gt;
 Kingston_Vale=&amp;quot;50713 48598 53221 74407&amp;quot;&lt;br /&gt;
 Roehampton=&amp;quot;75656 74598 71874&amp;quot;&lt;br /&gt;
 &lt;br /&gt;
 BUS_STOPS=&amp;quot;Kingston_Vale Roehampton&amp;quot;;&lt;br /&gt;
 &lt;br /&gt;
 LOOP=0&lt;br /&gt;
 if [ -r &amp;quot;/tmp/.countdown2&amp;quot; ]; then&lt;br /&gt;
 LOOP=`cat /tmp/.countdown2`;&lt;br /&gt;
 fi&lt;br /&gt;
 let LOOP=$LOOP+1;&lt;br /&gt;
 STOPCOUNT=`echo $BUS_STOPS | wc -w`;&lt;br /&gt;
 if [ &amp;quot;$LOOP&amp;quot; -gt &amp;quot;$STOPCOUNT&amp;quot; ]; then&lt;br /&gt;
   LOOP=1;&lt;br /&gt;
 fi;&lt;br /&gt;
 echo $LOOP &amp;gt;/tmp/.countdown2&lt;br /&gt;
 chmod 777 /tmp/.countdown2&lt;br /&gt;
 &lt;br /&gt;
 THISTIME=`echo $BUS_STOPS | cut -d&amp;quot; &amp;quot; -f $LOOP`;&lt;br /&gt;
 &lt;br /&gt;
 eval STOPLIST=\$$THISTIME&lt;br /&gt;
 echo $STOPLIST &amp;gt;/tmp/.bus_stops&lt;br /&gt;
 chmod 777 /tmp/.bus_stops&lt;br /&gt;
 echo $THISTIME | sed -e s/_/\ /g&lt;br /&gt;
&lt;br /&gt;
This third script combines the functionality for both of the above widgets from a single script, to be installed as e.g. /usr/local/bin/countdown, and moves the bus stop configuration from variables to flat files, arranged by placename. It also adds some command-line functionality (not yet widgetised), which enables you to configure a given placename from the 5-digit code of a single bus stop.&lt;br /&gt;
&lt;br /&gt;
 #!/bin/sh&lt;br /&gt;
 &lt;br /&gt;
 case $1 in&lt;br /&gt;
 &lt;br /&gt;
 	&amp;quot;--display&amp;quot;)&lt;br /&gt;
 	BUS_STOPS=&amp;quot;50713 48598 53221 74407&amp;quot;&lt;br /&gt;
 &lt;br /&gt;
 	if [ -r &amp;quot;/tmp/.bus_stops&amp;quot; ]; then&lt;br /&gt;
 		BUS_STOPS=`cat /tmp/.bus_stops`;&lt;br /&gt;
 	else&lt;br /&gt;
 		echo $BUS_STOPS &amp;gt; /tmp/.bus_stops;&lt;br /&gt;
 		chmod 777 /tmp/.bus_stops&lt;br /&gt;
 	fi&lt;br /&gt;
 	LOOP=0&lt;br /&gt;
 	if [ -r &amp;quot;/tmp/.countdown&amp;quot; ]; then&lt;br /&gt;
 		LOOP=`cat /tmp/.countdown`;&lt;br /&gt;
 	fi&lt;br /&gt;
 	let LOOP=$LOOP+1;&lt;br /&gt;
 	STOPCOUNT=`echo $BUS_STOPS | wc -w`;&lt;br /&gt;
 	if [ &amp;quot;$LOOP&amp;quot; -gt &amp;quot;$STOPCOUNT&amp;quot; ]; then&lt;br /&gt;
   		LOOP=1;&lt;br /&gt;
 	fi;&lt;br /&gt;
 	echo $LOOP &amp;gt;/tmp/.countdown&lt;br /&gt;
 	chmod 777 /tmp/.countdown&lt;br /&gt;
 	THISTIME=`echo $BUS_STOPS | cut -d&amp;quot; &amp;quot; -f $LOOP`;&lt;br /&gt;
 	lynx -dump -nolist http://m.countdown.tfl.gov.uk/arrivals/$THISTIME | grep -A10 &amp;quot;Buses dep&amp;quot; | sed -e &amp;quot;s/^   //g&amp;quot; | grep [a-z] | egrep -v &amp;quot;(Refresh|See\ map|Buses\ departing)&amp;quot; | sed -e &amp;quot;s/Bus stop code //g&amp;quot; | fold&lt;br /&gt;
 	;;&lt;br /&gt;
 &lt;br /&gt;
 	&amp;quot;--switch&amp;quot;)&lt;br /&gt;
 	BUS_STOPS=`ls /home/user/countdown/places`;&lt;br /&gt;
 	LOOP=0&lt;br /&gt;
 	if [ -r &amp;quot;/tmp/.countdown2&amp;quot; ]; then&lt;br /&gt;
 	LOOP=`cat /tmp/.countdown2`;&lt;br /&gt;
 	fi&lt;br /&gt;
 	let LOOP=$LOOP+1;&lt;br /&gt;
 	STOPCOUNT=`echo $BUS_STOPS | wc -w`;&lt;br /&gt;
 	if [ &amp;quot;$LOOP&amp;quot; -gt &amp;quot;$STOPCOUNT&amp;quot; ]; then&lt;br /&gt;
   	LOOP=1;&lt;br /&gt;
 	fi;&lt;br /&gt;
 	echo $LOOP &amp;gt;/tmp/.countdown2&lt;br /&gt;
 	chmod 777 /tmp/.countdown2&lt;br /&gt;
 	THISTIME=`echo $BUS_STOPS | cut -d&amp;quot; &amp;quot; -f $LOOP`;&lt;br /&gt;
 	STOPLIST=`cat /home/user/countdown/places/$THISTIME`;&lt;br /&gt;
 	echo $STOPLIST &amp;gt;/tmp/.bus_stops&lt;br /&gt;
 	chmod 777 /tmp/.bus_stops&lt;br /&gt;
 	echo 0 &amp;gt; /tmp/.countdown&lt;br /&gt;
 	chmod 777 /tmp/.countdown&lt;br /&gt;
 	echo $THISTIME | sed -e s/_/\ /g&lt;br /&gt;
 	;;&lt;br /&gt;
 &lt;br /&gt;
 	&amp;quot;--save&amp;quot;)&lt;br /&gt;
 	mkdir -p /home/user/countdown/places/&lt;br /&gt;
 	FILE=`echo &amp;quot;$2&amp;quot; | sed -e &amp;quot;s/ /_/g&amp;quot;`;&lt;br /&gt;
 	cat /tmp/.bus_stops &amp;gt; /home/user/countdown/places/$FILE&lt;br /&gt;
 	chown user /home/user/countdown/places/$FILE&lt;br /&gt;
 	;;&lt;br /&gt;
 &lt;br /&gt;
 	&amp;quot;--near&amp;quot;)&lt;br /&gt;
 	lynx -dump http://m.countdown.tfl.gov.uk/stopsNearStop/$2 | grep /arrivals/ | cut -d / -f 5 | while read stop; do out=&amp;quot;$out $stop&amp;quot;; echo $out &amp;gt; /tmp/.out; done; &lt;br /&gt;
 	cat /tmp/.out &amp;gt; /tmp/.bus_stops&lt;br /&gt;
 	cat /tmp/.bus_stops&lt;br /&gt;
 &lt;br /&gt;
 	if [ ! -z &amp;quot;$3&amp;quot; ]; then&lt;br /&gt;
 		$0 --save &amp;quot;$3&amp;quot;&lt;br /&gt;
 	fi &lt;br /&gt;
 &lt;br /&gt;
 	;;&lt;br /&gt;
 &lt;br /&gt;
 esac&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The idea here is that I go to a new place, let's say Putney, and I get off at The Embankment, which turns out to be stop 75040. I can now run:&lt;br /&gt;
&lt;br /&gt;
 # countdown --near 75040&lt;br /&gt;
&lt;br /&gt;
and override the current list of bus stops with the nine stops nearest to stop 75040, or, to store the configuration, I can run&lt;br /&gt;
&lt;br /&gt;
 # countdown --near 75040 &amp;quot;Putney&amp;quot;&lt;br /&gt;
&lt;br /&gt;
and the script will save a new location called Putney which I can then switch using the previously described switching functionality via DCEW. All that needs to be done to configure the script for the places you visit is to pick a bus stop that is fairly central to that location and run with --near to store the configuration.&lt;/div&gt;</description>
			<pubDate>Sun, 19 Feb 2012 11:27:15 GMT</pubDate>			<dc:creator>80.195.81.165</dc:creator>			<comments>http://bugs.maemo.com/Talk:Desktop_Command_Execution_Widget_scripts</comments>		</item>
		<item>
			<title>Desktop Command Execution Widget scripts</title>
			<link>http://bugs.maemo.com/Desktop_Command_Execution_Widget_scripts</link>
			<guid>http://bugs.maemo.com/Desktop_Command_Execution_Widget_scripts</guid>
			<description>&lt;p&gt;80.195.81.165:&amp;#32;/* Transport for London - Live Bus Departures */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Desktop Command Execution widget is one of the most useful widgets on your Maemo desktop. It can be used to show certain information (for example battery level in percentage) or as a button which can be used for example to disconnect active internet connection (you need to tap 3 times and also wait for menus to appear without this widget). Therefore it can replace many other applications/widgets/applets and you can also make something new. Here you'll find a collection of scripts that can be added to the widget. The discussion about the widget is [http://talk.maemo.org/showthread.php?t=39177 on the forum].&lt;br /&gt;
&lt;br /&gt;
Scripts are also compatible with [[Queen BeeCon Widget]] which has extended graphic and cosmetic functionality, but is far more complicated.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Making your own scripts==&lt;br /&gt;
&lt;br /&gt;
===Scripts without output===&lt;br /&gt;
&lt;br /&gt;
When there's no output (for example if you're using widget as a button and you use D-Bus call) the widget displays &amp;quot;Invalid Command&amp;quot;. This can be most easily avoided if you pipe echo &amp;quot;&amp;quot; at the end of the command. This is also usable if your script produces unwanted output (D-Bus reply for example).&lt;br /&gt;
&lt;br /&gt;
 dbus-send -options -moreoptions | echo &amp;quot;&amp;quot;&lt;br /&gt;
&lt;br /&gt;
Collection of D-Bus calls can be found on [[Phone control]] wiki page. The basic principle for making a script for DCEW is the same as above (D-Bus command and piping an echo).&lt;br /&gt;
&lt;br /&gt;
===Scripts with long output===&lt;br /&gt;
&lt;br /&gt;
Some scripts may create multiple lines which are too long to be displayed on a single line. The widget will not wrap these. In order to wrap them you can use the fold command:&lt;br /&gt;
 &lt;br /&gt;
 command-that-produces-long-lines | fold -s -w 80&lt;br /&gt;
&lt;br /&gt;
The 80 in that instance is the maximum length of the line, which you can change. The -s option makes fold word wrap with spaces. More information is available from the [http://unixhelp.ed.ac.uk/CGI/man-cgi?fold fold man page].&lt;br /&gt;
&lt;br /&gt;
==Scripts to display information==&lt;br /&gt;
&lt;br /&gt;
===Battery (via Nokia's BME) ===&lt;br /&gt;
&lt;br /&gt;
All battery scripts are collected here. Pick the one which suits your needs. Examples of the output values are under each one.&lt;br /&gt;
&lt;br /&gt;
There are 2 values for full battery capacity available. First one is design charge in mAh, which is always the same (1273 mAh). The second one is the one used in these scripts and it is the full charge from last charging. With displaying this one you can also monitor battery wear level.&lt;br /&gt;
&lt;br /&gt;
Battery percentage level is calculated using first value and is therefore less accurate, that's why you cannot achieve 100% full battery, but only about 95%. After some time the full percentage will be even lower.&lt;br /&gt;
&lt;br /&gt;
But last full charge value has one disadvantage. This is that after a reboot the phone forgets this value and the value returned is 0. It shows the proper value after next charging.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
====Percentage, current and last full charge====&lt;br /&gt;
&lt;br /&gt;
 hal-device bme | awk '/l.p/ {perc = $3}; /g.c/ {curr = $3}; /g.la/ {last = $3}; /s_c/ {isch = $3} END if (isch == &amp;quot;false&amp;quot;) {print perc&amp;quot; % (&amp;quot;curr&amp;quot;/&amp;quot;last&amp;quot; mAh)&amp;quot;} else {print &amp;quot;Charging&amp;quot;}'&lt;br /&gt;
&lt;br /&gt;
Output example: '''83 % (1000/1200 mAh)''', when charging '''Charging'''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
====Percentage and current charge====&lt;br /&gt;
&lt;br /&gt;
 hal-device bme | awk '/l.p/ {perc = $3}; /g.c/ {curr = $3}; /s_c/ {isch = $3} END if (isch == &amp;quot;false&amp;quot;) {print perc&amp;quot; % (&amp;quot;curr&amp;quot; mAh)&amp;quot;} else {print &amp;quot;Charging&amp;quot;}'&lt;br /&gt;
&lt;br /&gt;
Output example: '''83 % (1000 mAh)''', when charging '''Charging'''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
====Percentage====&lt;br /&gt;
&lt;br /&gt;
 hal-device bme | awk '/l.p/ {perc = $3}; /s_c/ {isch = $3} END if (isch == &amp;quot;false&amp;quot;) {print perc&amp;quot; %&amp;quot;} else {print &amp;quot;Chrg&amp;quot;}'&lt;br /&gt;
&lt;br /&gt;
Output example: '''83 %''', when charging '''Chrg'''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
====Current and last full charge====&lt;br /&gt;
&lt;br /&gt;
 hal-device bme | awk '/g.c/ {curr = $3}; /g.la/ {last = $3} END {print curr&amp;quot;/&amp;quot;last&amp;quot; mAh&amp;quot;}'&lt;br /&gt;
&lt;br /&gt;
Output example: '''1000/1200 mAh'''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
====Current charge====&lt;br /&gt;
&lt;br /&gt;
 hal-device bme | awk '/g.c/ {print $3&amp;quot; mAh&amp;quot;}'&lt;br /&gt;
&lt;br /&gt;
Output example: '''1000 mAh'''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
====Last full charge====&lt;br /&gt;
&lt;br /&gt;
 hal-device bme | awk '/g.la/ {print $3&amp;quot; mAh&amp;quot;}'&lt;br /&gt;
&lt;br /&gt;
Output example: '''1200 mAh'''&lt;br /&gt;
&lt;br /&gt;
===Battery (via bq27200 chip) ===&lt;br /&gt;
&lt;br /&gt;
==== Percentage, current and last full charge, with TTE or TTF as appropriate ====&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Install this as e.g. /usr/local/bin/bqbattery, make it executable and point DCEW to it. This is designed to work whether or not you have the bq27x00_battery module loaded, but if you don't, then you'll need to install the i2c-tools package, and then chmod 4755 /usr/sbin/i2cget (meaning i2cget runs as root even when we invoke it as user from DCEW).&lt;br /&gt;
&lt;br /&gt;
 #!/bin/sh&lt;br /&gt;
 &lt;br /&gt;
 if [ -r &amp;quot;/sys/class/power_supply/bq27200-0/capacity&amp;quot; ]; then&lt;br /&gt;
 # We have bq27x00_battery loaded - get the values from /sys/class/power_supply/bq27200-0/&lt;br /&gt;
 CSOC=`cat /sys/class/power_supply/bq27200-0/capacity`;&lt;br /&gt;
 NAC=$((`cat /sys/class/power_supply/bq27200-0/charge_now` / 1000));&lt;br /&gt;
 LMD=$((`cat /sys/class/power_supply/bq27200-0/charge_full` / 1000));&lt;br /&gt;
 STATUS=`cat /sys/class/power_supply/bq27200-0/status`;&lt;br /&gt;
 if [ &amp;quot;$STATUS&amp;quot; == &amp;quot;Discharging&amp;quot; ]; then&lt;br /&gt;
        TTF=65535&lt;br /&gt;
        TTE=$((`cat /sys/class/power_supply/bq27200-0/time_to_empty_avg` / 60));&lt;br /&gt;
 else&lt;br /&gt;
        TTF=$((`cat /sys/class/power_supply/bq27200-0/time_to_full_now` / 60));&lt;br /&gt;
        TTE=65535&lt;br /&gt;
 fi&lt;br /&gt;
 else&lt;br /&gt;
 # We don't have bq27x00_battery - get the values using i2cget&lt;br /&gt;
 NAC=$(($(/usr/sbin/i2cget -y 2 0x55 0x0c w) * 3570 / 20 / 1000));&lt;br /&gt;
 LMD=$(($(/usr/sbin/i2cget -y 2 0x55 0x12 w) * 3570 / 20 / 1000));&lt;br /&gt;
 CSOC=$(($(/usr/sbin/i2cget -y 2 0x55 0x2c)));&lt;br /&gt;
 TTF=$(($(/usr/sbin/i2cget -y 2 0x55 0x18 w)));&lt;br /&gt;
 TTE=$(($(/usr/sbin/i2cget -y 2 0x55 0x16 w)));&lt;br /&gt;
 fi&lt;br /&gt;
 echo &amp;quot;$CSOC% ($NAC/$LMD mAh)&amp;quot;&lt;br /&gt;
 if [ &amp;quot;$TTF&amp;quot; -eq 65535 ]; then&lt;br /&gt;
         echo &amp;quot;$TTE minutes to empty&amp;quot;&lt;br /&gt;
 else&lt;br /&gt;
         echo &amp;quot;$TTF min to full battery&amp;quot;&lt;br /&gt;
 fi&lt;br /&gt;
&lt;br /&gt;
Output example:&lt;br /&gt;
&lt;br /&gt;
'''88% (1269/1439 mAh)'''&lt;br /&gt;
&lt;br /&gt;
'''37 min to full battery'''&lt;br /&gt;
&lt;br /&gt;
===IP===&lt;br /&gt;
&lt;br /&gt;
Internal IPs are obtained from the ifconfig and external IPs are obtained from the internet, because gprs0 IP which you can get with ifconfig is often from private address range, because mobile operators like to use NAT.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
====External (WAN) and internal (LAN)====&lt;br /&gt;
&lt;br /&gt;
 echo WAN IP: `wget -t 2 -T 3 -q -O - api.myiptest.com | awk -F &amp;quot;\&amp;quot;&amp;quot; '{print $4}'`; echo LAN IP: `/sbin/ifconfig wlan0 | awk -F &amp;quot;[: ]&amp;quot; '/Bc/ {print $13}'`&lt;br /&gt;
&lt;br /&gt;
Output example:&lt;br /&gt;
&lt;br /&gt;
'''WAN IP: 1.2.3.4'''&lt;br /&gt;
&lt;br /&gt;
'''LAN IP: 192.168.1.2'''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 echo WAN IP: `wget -t 2 -T 3 -q -O - api.myiptest.com | awk -F &amp;quot;\&amp;quot;&amp;quot; '{print $4 &amp;quot; (&amp;quot;$12&amp;quot; &amp;quot;toupper($28)&amp;quot;)&amp;quot;}'`; echo LAN IP: `/sbin/ifconfig wlan0 | awk -F &amp;quot;[: ]&amp;quot; '/Bc/ {print $13}'`&lt;br /&gt;
&lt;br /&gt;
Output example:&lt;br /&gt;
&lt;br /&gt;
'''WAN IP: 1.2.3.4 (ISP CountryCode)'''&lt;br /&gt;
&lt;br /&gt;
'''LAN IP: 192.168.1.2'''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 echo WAN IP: `wget -t 2 -T 3 -q -O - api.myiptest.com | awk -F &amp;quot;\&amp;quot;&amp;quot; '{print $4&amp;quot; (&amp;quot;$12&amp;quot; @ &amp;quot;$20&amp;quot;, &amp;quot;toupper($28)&amp;quot;)&amp;quot;}'`; echo LAN IP: `/sbin/ifconfig wlan0 | awk -F &amp;quot;[: ]&amp;quot; '/Bc/ {print $13}'`&lt;br /&gt;
&lt;br /&gt;
Output example:&lt;br /&gt;
&lt;br /&gt;
'''WAN IP: 1.2.3.4 (ISP @ City, CountryCode)'''&lt;br /&gt;
&lt;br /&gt;
'''LAN IP: 192.168.1.2'''&lt;br /&gt;
&lt;br /&gt;
====External (WAN)====&lt;br /&gt;
&lt;br /&gt;
 wget -t 2 -T 3 -q -O - api.myiptest.com | awk -F &amp;quot;\&amp;quot;&amp;quot; '{print $4}'&lt;br /&gt;
&lt;br /&gt;
Output example: '''1.2.3.4'''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 wget -t 2 -T 3 -q -O - api.myiptest.com | awk -F &amp;quot;\&amp;quot;&amp;quot; '{print $4 &amp;quot; (&amp;quot;$12&amp;quot; &amp;quot;toupper($28)&amp;quot;)&amp;quot;}'&lt;br /&gt;
&lt;br /&gt;
Output example: '''1.2.3.4 (ISP CountryCode)'''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 wget -t 2 -T 3 -q -O - api.myiptest.com | awk -F &amp;quot;\&amp;quot;&amp;quot; '{print $4&amp;quot; (&amp;quot;$12&amp;quot; @ &amp;quot;$20&amp;quot;, &amp;quot;toupper($28)&amp;quot;)&amp;quot;}'&lt;br /&gt;
&lt;br /&gt;
Output example: '''1.2.3.4 (ISP @ City, CountryCode)'''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
====Internal (LAN)====&lt;br /&gt;
&lt;br /&gt;
 /sbin/ifconfig wlan0 | awk -F &amp;quot;[: ]&amp;quot; '/Bc/ {print $13}'&lt;br /&gt;
&lt;br /&gt;
This one displays only wlan0 IP (used for SSH, WinSCP, VNC... in LAN).&lt;br /&gt;
&lt;br /&gt;
===Disk usage===&lt;br /&gt;
&lt;br /&gt;
====rootfs (256MB /) percentage used====&lt;br /&gt;
&lt;br /&gt;
 df | awk '$1 == &amp;quot;rootfs&amp;quot; {print $5}'&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
====rootfs (256MB /) free space====&lt;br /&gt;
&lt;br /&gt;
 df -h | awk '$1 == &amp;quot;rootfs&amp;quot; {print $4}'&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
====Internal memory for user data (27GB /home/user/MyDocs) percentage used====&lt;br /&gt;
&lt;br /&gt;
 df /home/user/MyDocs | awk '/My/ {print $5}'&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
====Internal memory for user data (27GB /home/user/MyDocs) free space====&lt;br /&gt;
&lt;br /&gt;
 df -h /home/user/MyDocs | awk '/My/ {print $4}'&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
====Internal memory for application data (2GB /home) percentage used====&lt;br /&gt;
&lt;br /&gt;
 df /home | awk '/ho/ {print $5}'&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
====Internal memory for application data (2GB /home) free space====&lt;br /&gt;
&lt;br /&gt;
 df -h /home | awk '/ho/ {print $4}'&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
====Memory card (/media/mmc1) percentage used====&lt;br /&gt;
&lt;br /&gt;
 df /media/mmc1 | awk '/mm/ {print $5}'&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
====Memory card (/media/mmc1) free space====&lt;br /&gt;
&lt;br /&gt;
 df -h /media/mmc1 | awk '/mm/ {print $4}'&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Cellular signal===&lt;br /&gt;
&lt;br /&gt;
====Quality====&lt;br /&gt;
&lt;br /&gt;
 dbus-send --system --print-reply --dest=com.nokia.phone.net /com/nokia/phone/net Phone.Net.get_signal_strength | awk 'NR==2 {print $2&amp;quot; %&amp;quot;}'&lt;br /&gt;
&lt;br /&gt;
====Strength====&lt;br /&gt;
&lt;br /&gt;
 dbus-send --system --print-reply --dest=com.nokia.phone.net /com/nokia/phone/net Phone.Net.get_signal_strength | awk 'NR==3 {print &amp;quot;-&amp;quot;$2&amp;quot; dBm&amp;quot;}'&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Wi-Fi signal===&lt;br /&gt;
&lt;br /&gt;
====Quality====&lt;br /&gt;
&lt;br /&gt;
 awk -F &amp;quot;[. ]&amp;quot; '/0/ {print $6&amp;quot; %&amp;quot;}' /proc/net/wireless&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
====RSSI====&lt;br /&gt;
&lt;br /&gt;
 awk '/0/ {print $4&amp;quot; dBm&amp;quot;}' /proc/net/wireless&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
====Noise====&lt;br /&gt;
&lt;br /&gt;
 awk -F &amp;quot;[. ]&amp;quot; '/0/ {print $12&amp;quot; dBm&amp;quot;}' /proc/net/wireless&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===CPU frequency===&lt;br /&gt;
&lt;br /&gt;
 awk '{print $1/1000&amp;quot; MHz&amp;quot;}' /sys/devices/system/cpu/cpu0/cpufreq/scaling_cur_freq&lt;br /&gt;
&lt;br /&gt;
====Usage of each frequency====&lt;br /&gt;
&lt;br /&gt;
 awk -v var=$(awk '{sum+=$2}; END {print sum};' /sys/devices/system/cpu/cpu0/cpufreq/stats/time_in_state) '{arr[$3]=$2}{for (i in arr) {print $1/1000 &amp;quot; mhz &amp;quot; int(arr[i]*100/var)&amp;quot;%&amp;quot;}}' /sys/devices/system/cpu/cpu0/cpufreq/stats/time_in_state&lt;br /&gt;
&lt;br /&gt;
===Memory usage===&lt;br /&gt;
&lt;br /&gt;
====RAM used====&lt;br /&gt;
&lt;br /&gt;
 awk '/mT/ {memttl = $2}; /mF/ {memfre = $2}; /Bu/ {membff = $2}; $1 == &amp;quot;Cached:&amp;quot; {memcch = $2} END {printf (&amp;quot;%.1f MB\n&amp;quot;,(memttl-memfre-membff-memcch)/1024)}' /proc/meminfo&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
====RAM free====&lt;br /&gt;
&lt;br /&gt;
 awk '/mF/ {memfre = $2}; /Bu/ {membff = $2}; $1 == &amp;quot;Cached:&amp;quot; {memcch = $2} END {printf (&amp;quot;%.1f MB\n&amp;quot;,(memfre+membff+memcch)/1024)}' /proc/meminfo&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
====Swap used====&lt;br /&gt;
&lt;br /&gt;
 awk '/pT/ {swpttl = $2}; /pF/ {swpfre = $2} END {printf (&amp;quot;%.1f MB\n&amp;quot;,(swpttl-swpfre)/1024)}' /proc/meminfo&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
====Swap free====&lt;br /&gt;
&lt;br /&gt;
 awk '/pF/ {printf (&amp;quot;%.1f MB\n&amp;quot;,$2/1024)}' /proc/meminfo&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
====Total memory used====&lt;br /&gt;
&lt;br /&gt;
 awk '/mT/ {memttl = $2}; /mF/ {memfre = $2}; /Bu/ {membff = $2}; $1 == &amp;quot;Cached:&amp;quot; {memcch = $2}; /pT/ {swpttl = $2}; /pF/ {swpfre = $2} END {printf (&amp;quot;%.1f MB\n&amp;quot;,(memttl+swpttl-memfre-membff-memcch-swpfre)/1024)}' /proc/meminfo&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
====Total memory free====&lt;br /&gt;
&lt;br /&gt;
 awk '/mF/ {memfre = $2}; /Bu/ {membff = $2}; $1 == &amp;quot;Cached:&amp;quot; {memcch = $2}; /pF/ {swpfre = $2} END {printf (&amp;quot;%.1f MB\n&amp;quot;,(memfre+membff+memcch+swpfre)/1024)}' /proc/meminfo&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===GPRS data usage===&lt;br /&gt;
&lt;br /&gt;
You can use this with scheduled reset of the GPRS data counter to display data usage for current month. Additional info can be found on [[fcron]] wiki page.&lt;br /&gt;
&lt;br /&gt;
These scripts are now compatibile with PR1.2 (separate home and roaming counter), which means they won't work on previous versions.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
====Home counter (combined)====&lt;br /&gt;
&lt;br /&gt;
 echo `gconftool-2 -g /system/osso/connectivity/network_type/GPRS/gprs_home_rx_bytes` `gconftool-2 -g /system/osso/connectivity/network_type/GPRS/gprs_home_tx_bytes` | awk '{printf (&amp;quot;%.1f MB\n&amp;quot;,($1+$2)/1048576)}'&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
====Home counter (separated)====&lt;br /&gt;
&lt;br /&gt;
 echo `gconftool-2 -g /system/osso/connectivity/network_type/GPRS/gprs_home_rx_bytes | awk '{printf (&amp;quot;Download: %.1f MB\n&amp;quot;,$1/1048576)}'`; echo `gconftool-2 -g /system/osso/connectivity/network_type/GPRS/gprs_home_tx_bytes | awk '{printf (&amp;quot;Upload: %.1f MB\n&amp;quot;,$1/1048576)}'`&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
====Roaming counter (combined)====&lt;br /&gt;
&lt;br /&gt;
 echo `gconftool-2 -g /system/osso/connectivity/network_type/GPRS/gprs_roaming_rx_bytes` `gconftool-2 -g /system/osso/connectivity/network_type/GPRS/gprs_roaming_tx_bytes` | awk '{printf (&amp;quot;%.1f MB\n&amp;quot;,($1+$2)/1048576)}'&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
====Roaming counter (separated)====&lt;br /&gt;
&lt;br /&gt;
 echo `gconftool-2 -g /system/osso/connectivity/network_type/GPRS/gprs_roaming_rx_bytes | awk '{printf (&amp;quot;Download: %.1f MB\n&amp;quot;,$1/1048576)}'`; echo `gconftool-2 -g /system/osso/connectivity/network_type/GPRS/gprs_roaming_tx_bytes | awk '{printf (&amp;quot;Upload: %.1f MB\n&amp;quot;,$1/1048576)}'`&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Time and date===&lt;br /&gt;
&lt;br /&gt;
====Date====&lt;br /&gt;
&lt;br /&gt;
 date +&amp;quot;%a, %-d.%-m.%Y&amp;quot;&lt;br /&gt;
&lt;br /&gt;
This command will show the date in format (for example) '''Tue, 4.5.2010'''. You can define your own format (between the quotation marks). Possible options are described on [http://unixhelp.ed.ac.uk/CGI/man-cgi?date manpage].&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
====Time in different timezones====&lt;br /&gt;
 &lt;br /&gt;
 export TZ=&amp;quot;Europe/London&amp;quot;; date +%R&lt;br /&gt;
&lt;br /&gt;
This one shows two timezones in format ''London: 13:04 | Denver: 06:04''&lt;br /&gt;
&lt;br /&gt;
 echo &amp;quot;London:&amp;quot; `export TZ=&amp;quot;Europe/London&amp;quot;; date +%R` &amp;quot;| Denver:&amp;quot; `export TZ=&amp;quot;America/Denver&amp;quot;; date +%R`&lt;br /&gt;
&lt;br /&gt;
London and Denver are taken as an example. TZ values can be found on [[:wikipedia:List_of_tz_database_time_zones|Wikipedia]].&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Uptime and load===&lt;br /&gt;
&lt;br /&gt;
These scripts are formatproof meaning that they display what they're supposed to no matter what format is command &amp;quot;uptime&amp;quot; outputting. Not all scripts found are like that, because &amp;quot;uptime&amp;quot; command is a little bit complicated for scripted text processing. For example when the system is running under one hour only &amp;quot;x min&amp;quot; is shown, when it is running under one day &amp;quot;hour:min:sec&amp;quot; is shown and after that it is shown in format &amp;quot;x days, hour:min:sec&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
====Both====&lt;br /&gt;
&lt;br /&gt;
 uptime | sed -e 's/.*up */uptime: /' -e 's/ average//' -e 's/  / /'&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
====Uptime====&lt;br /&gt;
&lt;br /&gt;
 uptime | sed -e 's/.*p *//' -e 's/, l.*//' -e 's/  / /'&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
====Load====&lt;br /&gt;
&lt;br /&gt;
 uptime | sed 's/.*e: //'&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Boot reason===&lt;br /&gt;
&lt;br /&gt;
 cat /proc/bootreason&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Boot count===&lt;br /&gt;
&lt;br /&gt;
 cat /var/lib/dsme/boot_count&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Temperature===&lt;br /&gt;
&lt;br /&gt;
CPU's thermal sensors are not accessible, but there is one near the battery. This commands displays output of its readings, but IT IS NOT RELIABLE, because it doesn't always work. Sometimes the value returned is wrong or constant. It needs to be tested further.&lt;br /&gt;
&lt;br /&gt;
 cat /sys/devices/platform/omap34xx_temp/temp1_input | awk '{ sub(/-/,&amp;quot;&amp;quot;); print $1&amp;quot; °C&amp;quot;}'&lt;br /&gt;
&lt;br /&gt;
There is a working way now to read the correct temperature, but it is working only on a newer titan's kernels (normal, overclock, undervoltage). The bq27x00_battery module has to be loaded first.&lt;br /&gt;
&lt;br /&gt;
 echo `cat /sys/class/power_supply/bq27200-0/temp` °C&lt;br /&gt;
&lt;br /&gt;
with a comma : &lt;br /&gt;
&lt;br /&gt;
 echo `cat /sys/class/power_supply/bq27200-0/temp` °C | sed 's/\B[0-9]\{1\}/&amp;amp;,/'&lt;br /&gt;
&lt;br /&gt;
===Top processes===&lt;br /&gt;
&lt;br /&gt;
This script displays top ''N'' CPU consuming processes. It excludes top itself, which is quite processor intensive so you probably don't want this updating too often. Modify ''N=3'' at the start to display different number of processes.&lt;br /&gt;
&lt;br /&gt;
 N=3; top -bn 1 | grep -v top | head -n $(($N+4)) | tail -n $(($N+1)) | awk '{OFS = &amp;quot;\t&amp;quot;} {print $7,$8}'&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Random Number Generator===&lt;br /&gt;
&lt;br /&gt;
This script displays a random number between 0 and ''M'' (''M'' included)&lt;br /&gt;
&lt;br /&gt;
 M=6; dd if=/dev/urandom bs=1 count=4 2&amp;gt;/dev/null | od -l | awk -v M=$M '{M++;print $2&amp;lt;0?-$2%M:$2%M;exit}'&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Ping a Host===&lt;br /&gt;
Preferred method. Install netcat from [http://wiki.maemo.org/Documentation/devtools/maemo5#Installation]&lt;br /&gt;
&lt;br /&gt;
 if (nc -zw1 192.168.2.1 80);then echo up;else echo down;fi&lt;br /&gt;
&lt;br /&gt;
Alternate method. Ping has a long timeout when down. Warning: it will block the desktop while running.&lt;br /&gt;
&lt;br /&gt;
 if (echo 'ping -c1 192.168.2.1' | rootsh /bin/sh  2&amp;gt;&amp;amp;1 &amp;gt;/dev/null);then echo up;else echo down;fi&lt;br /&gt;
&lt;br /&gt;
==Scripts for buttons==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Make sure that update policy for button widgets is set only to &amp;quot;update when clicked&amp;quot;. &amp;quot;Update when switched to desktop&amp;quot;, &amp;quot;update interval&amp;quot; and &amp;quot;network presence&amp;quot; should be disabled to avoid automatic actions. Also keep in mind that widgets are executed at every boot so they can for example automatically disable Wi-Fi when phone boots.&lt;br /&gt;
&lt;br /&gt;
There is a bug in version 0.9 or lower which prevents you from using DCEW widgets as buttons, because they get activated (pressed) automatically all the time. You have to make sure DCEW is at least version 1.0, to check which version you have installed do this: dpkg -l desktop-cmd-exec.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Networking===&lt;br /&gt;
&lt;br /&gt;
====Connect/disconnect====&lt;br /&gt;
&lt;br /&gt;
 sh /path/conn-disconn.sh | echo &amp;quot;&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''conn-disconn.sh'''&lt;br /&gt;
&lt;br /&gt;
 #!/bin/sh&lt;br /&gt;
 if [ `/sbin/route | awk '/au/ {print $1}'` = default ]; then&lt;br /&gt;
 dbus-send --system --dest=com.nokia.icd /com/nokia/icd_ui com.nokia.icd_ui.disconnect boolean:true&lt;br /&gt;
 else&lt;br /&gt;
 dbus-send --system --type=method_call --dest=com.nokia.icd /com/nokia/icd com.nokia.icd.connect string:&amp;quot;[ANY]&amp;quot; uint32:0&lt;br /&gt;
 fi&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
====Connect internet (show connections)====&lt;br /&gt;
&lt;br /&gt;
 dbus-send --system --type=method_call --dest=com.nokia.icd_ui /com/nokia/icd_ui com.nokia.icd_ui.show_conn_dlg boolean:false | echo &amp;quot;&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
====Connect to any saved connection====&lt;br /&gt;
&lt;br /&gt;
 dbus-send --system --type=method_call --dest=com.nokia.icd /com/nokia/icd com.nokia.icd.connect string:&amp;quot;[ANY]&amp;quot; uint32:0 | echo &amp;quot;&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
====Disconnect internet====&lt;br /&gt;
&lt;br /&gt;
 dbus-send --system --dest=com.nokia.icd /com/nokia/icd_ui com.nokia.icd_ui.disconnect boolean:true | echo &amp;quot;&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
====Enable/disable Wi-Fi====&lt;br /&gt;
&lt;br /&gt;
 echo &amp;quot;/path/to/script/wifi.sh&amp;quot; | sudo gainroot | echo &amp;quot;&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''wifi.sh script:'''&lt;br /&gt;
&lt;br /&gt;
 #!/bin/sh&lt;br /&gt;
 out=`ifconfig wlan0`&lt;br /&gt;
 if [ $? -eq &amp;quot;0&amp;quot; ] ; then&lt;br /&gt;
 if [ `echo &amp;quot;$out&amp;quot; | grep -c RUNNING` -gt &amp;quot;0&amp;quot; ] ; then&lt;br /&gt;
 run-standalone.sh dbus-send --system --dest=com.nokia.icd /com/nokia/icd_ui com.nokia.icd_ui.disconnect boolean:true&lt;br /&gt;
 fi&lt;br /&gt;
 ifconfig wlan0 down&lt;br /&gt;
 rmmod wl12xx&lt;br /&gt;
 run-standalone.sh dbus-send --type=method_call --dest=org.freedesktop.Notifications /org/freedesktop/Notifications org.freedesktop.Notifications.SystemNoteInfoprint string:'Wi-Fi disabled'&lt;br /&gt;
 exit 2&lt;br /&gt;
 else&lt;br /&gt;
 modprobe wl12xx&lt;br /&gt;
 wl1251-cal&lt;br /&gt;
 stop wlancond&lt;br /&gt;
 start wlancond&lt;br /&gt;
 ifconfig wlan0 up&lt;br /&gt;
 run-standalone.sh dbus-send --system --type=method_call --dest=com.nokia.icd_ui /com/nokia/icd_ui com.nokia.icd_ui.show_conn_dlg boolean:false&lt;br /&gt;
 exit 0&lt;br /&gt;
 fi&lt;br /&gt;
&lt;br /&gt;
Don't forget to make it executable.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
====Wake On Lan====&lt;br /&gt;
 &lt;br /&gt;
 /path/to/script/wol.py | echo &amp;quot;&amp;quot;&lt;br /&gt;
wol.py script;&lt;br /&gt;
&lt;br /&gt;
 #! /usr/bin/python&lt;br /&gt;
 # Wake-On-LAN&lt;br /&gt;
 # Change ip range in the &amp;quot;s.sendto(msg&amp;quot; line &lt;br /&gt;
 # and the MAC of the pc to wakeup in the bottom line&lt;br /&gt;
 import struct, socket&lt;br /&gt;
 def WakeOnLan(ethernet_address):&lt;br /&gt;
  # Construct a six-byte hardware address&lt;br /&gt;
  addr_byte = ethernet_address.split(':')&lt;br /&gt;
  hw_addr = struct.pack('BBBBBB', int(addr_byte[0], 16),&lt;br /&gt;
    int(addr_byte[1], 16),&lt;br /&gt;
    int(addr_byte[2], 16),&lt;br /&gt;
    int(addr_byte[3], 16),&lt;br /&gt;
    int(addr_byte[4], 16),&lt;br /&gt;
    int(addr_byte[5], 16))&lt;br /&gt;
  # Build the Wake-On-LAN &amp;quot;Magic Packet&amp;quot;...&lt;br /&gt;
  msg = '\xff' * 6 + hw_addr * 16&lt;br /&gt;
  # ...and send it to the broadcast address using UDP&lt;br /&gt;
  s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)&lt;br /&gt;
  s.setsockopt(socket.SOL_SOCKET, socket.SO_BROADCAST, 1)&lt;br /&gt;
  s.sendto(msg, ('192.168.1.255', 9))&lt;br /&gt;
  s.close()&lt;br /&gt;
 # Example use&lt;br /&gt;
 WakeOnLan('00:13:21:00:62:AE')&lt;br /&gt;
Don't forget to Chmod 755 wol.py&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
====Disconnect mobile network====&lt;br /&gt;
&lt;br /&gt;
 dbus-send --system --type=method_call --dest=com.nokia.phone.SSC /com/nokia/phone/SSC com.nokia.phone.SSC.set_radio boolean:false | echo &amp;quot;&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
====Connect mobile network====&lt;br /&gt;
&lt;br /&gt;
 dbus-send --system --type=method_call --dest=com.nokia.phone.SSC /com/nokia/phone/SSC com.nokia.phone.SSC.set_radio boolean:true | echo &amp;quot;&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Lock screen and keys===&lt;br /&gt;
&lt;br /&gt;
 dbus-send --system --type=method_call --dest=com.nokia.mce /com/nokia/mce/request com.nokia.mce.request.req_tklock_mode_change string:&amp;quot;locked&amp;quot; | echo &amp;quot;&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Radio mode===&lt;br /&gt;
&lt;br /&gt;
====2G/3G====&lt;br /&gt;
&lt;br /&gt;
 sh /path/to/script/2g3g.sh | echo &amp;quot;&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''2g3g.sh script:'''&lt;br /&gt;
&lt;br /&gt;
 #!/bin/sh&lt;br /&gt;
 if [ `dbus-send --system --type=method_call --print-reply --dest=com.nokia.phone.net /com/nokia/phone/net Phone.Net.get_selected_radio_access_technology | awk '/b/ {print $2}'` -eq 1 ]; then&lt;br /&gt;
 dbus-send --system --type=method_call --dest=com.nokia.phone.net /com/nokia/phone/net Phone.Net.set_selected_radio_access_technology byte:2&lt;br /&gt;
 else&lt;br /&gt;
 dbus-send --system --type=method_call --dest=com.nokia.phone.net /com/nokia/phone/net Phone.Net.set_selected_radio_access_technology byte:1&lt;br /&gt;
 fi&lt;br /&gt;
&lt;br /&gt;
When 3G or Dual mode is active, the script will switch to 2G. And when 2G is active, it will switch to 3G.&lt;br /&gt;
&lt;br /&gt;
Don't forget to make the script executable.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
====2G====&lt;br /&gt;
&lt;br /&gt;
 dbus-send --system --type=method_call --dest=com.nokia.phone.net /com/nokia/phone/net Phone.Net.set_selected_radio_access_technology byte:1 | echo &amp;quot;&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
====3G====&lt;br /&gt;
&lt;br /&gt;
 dbus-send --system --type=method_call --dest=com.nokia.phone.net /com/nokia/phone/net Phone.Net.set_selected_radio_access_technology byte:2 | echo &amp;quot;&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
====Dual====&lt;br /&gt;
&lt;br /&gt;
 dbus-send --system --type=method_call --dest=com.nokia.phone.net /com/nokia/phone/net Phone.Net.set_selected_radio_access_technology byte:0 | echo &amp;quot;&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Bluetooth===&lt;br /&gt;
&lt;br /&gt;
====Enable====&lt;br /&gt;
&lt;br /&gt;
 dbus-send --system --type=method_call --dest=org.bluez $(dbus-send --system --print-reply --dest=org.bluez / org.bluez.Manager.ListAdapters | awk -F &amp;quot;\&amp;quot;&amp;quot; '/at/ {print $2}') org.bluez.Adapter.SetProperty string:Powered variant:boolean:true | echo &amp;quot;&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
====Disable====&lt;br /&gt;
&lt;br /&gt;
 dbus-send --system --type=method_call --dest=org.bluez $(dbus-send --system --print-reply --dest=org.bluez / org.bluez.Manager.ListAdapters | awk -F &amp;quot;\&amp;quot;&amp;quot; '/at/ {print $2}') org.bluez.Adapter.SetProperty string:Powered variant:boolean:false | echo &amp;quot;&amp;quot;&lt;br /&gt;
&lt;br /&gt;
===Profiles===&lt;br /&gt;
&lt;br /&gt;
====General====&lt;br /&gt;
&lt;br /&gt;
 dbus-send --type=method_call --dest=com.nokia.profiled /com/nokia/profiled com.nokia.profiled.set_profile string:&amp;quot;general&amp;quot; | echo &amp;quot;&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
====Silent====&lt;br /&gt;
&lt;br /&gt;
 dbus-send --type=method_call --dest=com.nokia.profiled /com/nokia/profiled com.nokia.profiled.set_profile string:&amp;quot;silent&amp;quot; | echo&amp;quot;&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
====Toggle vibrating alert====&lt;br /&gt;
&lt;br /&gt;
There are far more things you can do with your profile. Please have a look at the [[Phone_control#Get_all_profile_Values|profile values at the phone control page]]. This example disables vibrating alert for the active profile.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 # Which profile is active?&lt;br /&gt;
 if \&lt;br /&gt;
 dbus-send --print-reply --type=method_call \&lt;br /&gt;
 --dest=com.nokia.profiled /com/nokia/profiled \&lt;br /&gt;
 com.nokia.profiled.get_profile | grep -q general&lt;br /&gt;
 then&lt;br /&gt;
 	# general profile is active&lt;br /&gt;
 	dbus-send --type=method_call \&lt;br /&gt;
 	--dest=com.nokia.profiled /com/nokia/profiled \&lt;br /&gt;
 	com.nokia.profiled.set_value string:&amp;quot;general&amp;quot; \&lt;br /&gt;
 	string:&amp;quot;vibrating.alert.enabled&amp;quot; string:&amp;quot;Off&amp;quot;&lt;br /&gt;
 else&lt;br /&gt;
 	# silent profile is active&lt;br /&gt;
 	dbus-send --type=method_call \&lt;br /&gt;
 	--dest=com.nokia.profiled /com/nokia/profiled \&lt;br /&gt;
 	com.nokia.profiled.set_value string:&amp;quot;silent&amp;quot; \&lt;br /&gt;
 	string:&amp;quot;vibrating.alert.enabled&amp;quot; string:&amp;quot;Off&amp;quot;&lt;br /&gt;
 fi&lt;br /&gt;
&lt;br /&gt;
You get the opposite behaviour (enable vibrating alert) simply by replacing &amp;quot;Off&amp;quot; two times by &amp;quot;On&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
===Lock (secure) the device===&lt;br /&gt;
&lt;br /&gt;
 dbus-send --system --type=method_call --dest=com.nokia.system_ui /com/nokia/system_ui/request com.nokia.system_ui.request.devlock_open string:&amp;quot;com.nokia.mce&amp;quot; string:&amp;quot;/com/nokia/mce/request&amp;quot; string:&amp;quot;com.nokia.mce.request&amp;quot; string:&amp;quot;devlock_callback&amp;quot; uint32:'3' | echo &amp;quot;&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Update e-mail===&lt;br /&gt;
&lt;br /&gt;
 sh /path/to/script/email.sh | echo &amp;quot;&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''email.sh script:'''&lt;br /&gt;
&lt;br /&gt;
The script connects to the internet and refreshes e-mail. Keep in mind that Modest e-mail client which N900 uses is very slow in this aspect and send and recive can take up to minute and a half. Make it executable.&lt;br /&gt;
&lt;br /&gt;
 #!/bin/sh&lt;br /&gt;
 run-standalone.sh dbus-send --type=method_call --dest=org.freedesktop.Notifications /org/freedesktop/Notifications org.freedesktop.Notifications.SystemNoteInfoprint string:&amp;quot;Updating e-mail...&amp;quot;&lt;br /&gt;
 run-standalone.sh dbus-send --system --type=method_call --dest=com.nokia.icd /com/nokia/icd com.nokia.icd.connect string:&amp;quot;[ANY]&amp;quot; uint32:0&lt;br /&gt;
 sleep 10&lt;br /&gt;
 run-standalone.sh dbus-send --type=method_call --dest=com.nokia.modest /com/nokia/modest com.nokia.modest.SendReceive&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Set maximum CPU frequency===&lt;br /&gt;
&lt;br /&gt;
 echo &amp;quot;echo 600000 &amp;gt; /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq&amp;quot; | sudo gainroot | echo &amp;quot;&amp;quot;&lt;br /&gt;
&lt;br /&gt;
Replace 600000 with desired maximum frequency. This is usable with the new overclocking kernels if you wish to manually change the maximum frequency to which processor can scale. Pay attention to the two exceptions in titan's kernels (124999 and 599000). The list of available frequencies on your device/kernel can be obtained with command:&lt;br /&gt;
&lt;br /&gt;
 awk '{print $1/1000&amp;quot; MHz&amp;quot;}' /sys/devices/system/cpu/cpu0/cpufreq/stats/time_in_state&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Reboot===&lt;br /&gt;
&lt;br /&gt;
 echo &amp;quot;reboot&amp;quot; | sudo gainroot | echo &amp;quot;&amp;quot;&lt;br /&gt;
&lt;br /&gt;
Warning: Consult forums before you try this, because currently DCEW executes some (all?) commands at startup. This will be optional in next version. Making a reboot button on current DCEW version could result in endless reboot loop.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===FM transmitter===&lt;br /&gt;
&lt;br /&gt;
====Enable/disable====&lt;br /&gt;
&lt;br /&gt;
 /usr/bin/fmtx_client -p$(if [ $(cut -d. -f1 /proc/uptime ) -lt 100 ]; then echo 0; else /usr/bin/fmtx_client | /bin/grep -q '^state=enabled' ; echo $? ; fi) | /usr/bin/awk -F &amp;quot;=&amp;quot; '($1==&amp;quot;state&amp;quot;) {print $2}'&lt;br /&gt;
&lt;br /&gt;
Note: when you reboot the device, this script waits 100 seconds before you can turn the transmitter on/off again.&lt;br /&gt;
&lt;br /&gt;
====Increase power====&lt;br /&gt;
&lt;br /&gt;
 echo &amp;quot;echo 118 &amp;gt; /sys/class/i2c-adapter/i2c-2/2-0063/power_level&amp;quot; | sudo gainroot | echo &amp;quot;&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===DBUS call to start browser===&lt;br /&gt;
&lt;br /&gt;
 /usr/bin/browser_dbuscmd.sh load_url http://www.bbc.co.uk/iplayer/console/bbc_radio_fourfm&lt;br /&gt;
[[Category:Software]]&lt;br /&gt;
[[Category:Power users]]&lt;br /&gt;
&lt;br /&gt;
===Display a Conboy Note===&lt;br /&gt;
 python /home/user/conboy_note_to_text.py print noteid&lt;br /&gt;
&lt;br /&gt;
'''conboy_note_to_text.py'''&lt;br /&gt;
Make sure to make this python script executable (chmod 755 /path/to/conboy_note_to_text.py). To list all notes with their title and id in xterm, just use the following commands: python /home/user/conboy_note_to_text.py list&lt;br /&gt;
&lt;br /&gt;
Source : http://khertan.net/articles/maemo/conboy_note_to_text&lt;br /&gt;
&lt;br /&gt;
Direct Script Link : http://khertan.net/_export/code/articles/maemo/conboy_note_to_text?codeblock=0&lt;br /&gt;
&lt;br /&gt;
 #!/usr/lib/python2.5&lt;br /&gt;
 &lt;br /&gt;
 from xml.dom import minidom&lt;br /&gt;
 import os.path&lt;br /&gt;
 import glob&lt;br /&gt;
 import sys&lt;br /&gt;
 import re&lt;br /&gt;
 from xml.sax.handler import ContentHandler&lt;br /&gt;
 import xml.sax&lt;br /&gt;
 &lt;br /&gt;
 class NoteList:&lt;br /&gt;
    def __init__(self,path):&lt;br /&gt;
        self.path = path&lt;br /&gt;
        self.noteList = {}&lt;br /&gt;
        for infile in glob.glob( os.path.join(self.path, '*.note') ):&lt;br /&gt;
          note = Reader(os.path.basename(infile)[:-5])&lt;br /&gt;
          if note.title != None:&lt;br /&gt;
              self.noteList[note.title]=note.note_id&lt;br /&gt;
 &lt;br /&gt;
    def get_note_id_by_title(self,title):&lt;br /&gt;
        try:&lt;br /&gt;
            return self.noteList[title]&lt;br /&gt;
        except:&lt;br /&gt;
            return None&lt;br /&gt;
 &lt;br /&gt;
 class textHandler(ContentHandler):&lt;br /&gt;
    def __init__(self):&lt;br /&gt;
      ContentHandler.__init__(self)&lt;br /&gt;
      self.content = &amp;quot;&amp;quot;&lt;br /&gt;
      self.title = &amp;quot;&amp;quot;&lt;br /&gt;
      self.selector = None&lt;br /&gt;
 &lt;br /&gt;
    def startElement(self, element,attributes):&lt;br /&gt;
        if (element == 'note-content') and (self.selector == None):&lt;br /&gt;
            self.selector = element&lt;br /&gt;
        elif (element == 'title') and (self.selector == None):&lt;br /&gt;
            self.selector = element&lt;br /&gt;
 &lt;br /&gt;
 &lt;br /&gt;
    def endElement(self, element):&lt;br /&gt;
        if (element == self.selector):&lt;br /&gt;
            self.selector = None&lt;br /&gt;
 &lt;br /&gt;
    def characters(self, ch):&lt;br /&gt;
        if self.selector == 'note-content':&lt;br /&gt;
            self.content = self.content + unicode(ch)&lt;br /&gt;
        elif self.selector == 'title':&lt;br /&gt;
            self.title = self.title + unicode(ch)&lt;br /&gt;
 &lt;br /&gt;
 class Reader:&lt;br /&gt;
    def __init__(self,note_id):&lt;br /&gt;
        self.note_id = note_id&lt;br /&gt;
        self.content = None&lt;br /&gt;
        self.title = None&lt;br /&gt;
 &lt;br /&gt;
        try:&lt;br /&gt;
            parser = xml.sax.make_parser()&lt;br /&gt;
            handler = textHandler()&lt;br /&gt;
            parser.setContentHandler(handler)&lt;br /&gt;
              parser.parse(os.path.join(os.path.expanduser(&amp;quot;~&amp;quot;),'.conboy',self.note_id+'.note'))&lt;br /&gt;
            self.content = handler.content&lt;br /&gt;
            self.title = handler.title &lt;br /&gt;
        except StandardError,e:&lt;br /&gt;
            print e&lt;br /&gt;
 &lt;br /&gt;
 &lt;br /&gt;
 &lt;br /&gt;
 if __name__ == &amp;quot;__main__&amp;quot;:&lt;br /&gt;
    try:&lt;br /&gt;
        if (sys.argv[1]=='print'):&lt;br /&gt;
            print Reader(unicode(sys.argv[2])).content&lt;br /&gt;
        elif (sys.argv[1]=='list'):&lt;br /&gt;
            nlist = NoteList('/home/user/.conboy/').noteList&lt;br /&gt;
            for key in nlist.keys():&lt;br /&gt;
                print key, ' : ', nlist[key]&lt;br /&gt;
        elif (sys.argv[1]=='search'):&lt;br /&gt;
            nlist = NoteList('/home/user/.conboy/')&lt;br /&gt;
            print nlist.get_note_id_by_title(sys.argv[2])&lt;br /&gt;
        else:&lt;br /&gt;
            raise&lt;br /&gt;
    except StandardError,e:&lt;br /&gt;
            print &amp;quot;&amp;quot;&amp;quot;Usage : python conboy_note_reader.py option [note_id or note title]&lt;br /&gt;
            Option : &lt;br /&gt;
                - list : list all note by title with id&lt;br /&gt;
                - print : print content of note with the given id&lt;br /&gt;
                - search : print id of the given title&amp;quot;&amp;quot;&amp;quot;&lt;br /&gt;
            print e&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Scripts to pull data from remote web sites ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Transport for London - Live Bus Departures ===&lt;br /&gt;
&lt;br /&gt;
Transport for London recently launched a mobile Web interface to their live bus departures information, and it's pretty good, but it can be a pain navigating to the bus stop that you want. This script uses DCEW to display data from multiple local bus stops, and to switch between them (by iterating over a list of them) on touching the widget.&lt;br /&gt;
 #!/bin/sh&lt;br /&gt;
 &lt;br /&gt;
 BUS_STOPS=&amp;quot;50713 48598 53221 74407&amp;quot;&lt;br /&gt;
 &lt;br /&gt;
 if [ -r &amp;quot;/tmp/.bus_stops&amp;quot; ]; then&lt;br /&gt;
 	BUS_STOPS=`cat /tmp/.bus_stops`;&lt;br /&gt;
 else&lt;br /&gt;
 	echo $BUS_STOPS &amp;gt; /tmp/.bus_stops;&lt;br /&gt;
 	chmod 777 /tmp/.bus_stops&lt;br /&gt;
 fi&lt;br /&gt;
 &lt;br /&gt;
 LOOP=0&lt;br /&gt;
 if [ -r &amp;quot;/tmp/.countdown&amp;quot; ]; then&lt;br /&gt;
 LOOP=`cat /tmp/.countdown`;&lt;br /&gt;
 fi&lt;br /&gt;
 let LOOP=$LOOP+1;&lt;br /&gt;
 STOPCOUNT=`echo $BUS_STOPS | wc -w`;&lt;br /&gt;
 if [ &amp;quot;$LOOP&amp;quot; -gt &amp;quot;$STOPCOUNT&amp;quot; ]; then&lt;br /&gt;
   LOOP=1;&lt;br /&gt;
 fi;&lt;br /&gt;
 echo $LOOP &amp;gt;/tmp/.countdown&lt;br /&gt;
 chmod 777 /tmp/.countdown&lt;br /&gt;
 &lt;br /&gt;
 THISTIME=`echo $BUS_STOPS | cut -d&amp;quot; &amp;quot; -f $LOOP`;&lt;br /&gt;
 &lt;br /&gt;
 lynx -dump -nolist http://m.countdown.tfl.gov.uk/arrivals/$THISTIME | grep -A10 &amp;quot;Buses dep&amp;quot; | sed -e &amp;quot;s/^   //g&amp;quot; | grep [a-z] | egrep -v &amp;quot;(Refresh|See\ map|Buses\ departing)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
This second script, designed to be used with an additional DCEW on the same screen as the first, changes the list of bus stops associated with the script above and displays the place name with which they are associated. So, using this second widget, I can switch the first widget between the list of bus stops that I require in one place, and the list that I require in another. This limits the length of any individual list and will eventually let me access four or five lists of stops according to where I happen to be.&lt;br /&gt;
&lt;br /&gt;
 #!/bin/sh&lt;br /&gt;
 &lt;br /&gt;
 Kingston_Vale=&amp;quot;50713 48598 53221 74407&amp;quot;&lt;br /&gt;
 Roehampton=&amp;quot;75656 74598 71874&amp;quot;&lt;br /&gt;
 &lt;br /&gt;
 BUS_STOPS=&amp;quot;Kingston_Vale Roehampton&amp;quot;;&lt;br /&gt;
 &lt;br /&gt;
 LOOP=0&lt;br /&gt;
 if [ -r &amp;quot;/tmp/.countdown2&amp;quot; ]; then&lt;br /&gt;
 LOOP=`cat /tmp/.countdown2`;&lt;br /&gt;
 fi&lt;br /&gt;
 let LOOP=$LOOP+1;&lt;br /&gt;
 STOPCOUNT=`echo $BUS_STOPS | wc -w`;&lt;br /&gt;
 if [ &amp;quot;$LOOP&amp;quot; -gt &amp;quot;$STOPCOUNT&amp;quot; ]; then&lt;br /&gt;
   LOOP=1;&lt;br /&gt;
 fi;&lt;br /&gt;
 echo $LOOP &amp;gt;/tmp/.countdown2&lt;br /&gt;
 chmod 777 /tmp/.countdown2&lt;br /&gt;
 &lt;br /&gt;
 THISTIME=`echo $BUS_STOPS | cut -d&amp;quot; &amp;quot; -f $LOOP`;&lt;br /&gt;
 &lt;br /&gt;
 eval STOPLIST=\$$THISTIME&lt;br /&gt;
 echo $STOPLIST &amp;gt;/tmp/.bus_stops&lt;br /&gt;
 chmod 777 /tmp/.bus_stops&lt;br /&gt;
 echo $THISTIME | sed -e s/_/\ /g&lt;br /&gt;
&lt;br /&gt;
This third script provides the functionality for both of the above widgets from a single script, to be installed as e.g. /usr/local/bin/countdown, and moves the bus stop configuration from variables to flat files, arranged by placename. It also adds some command-line functionality (not yet widgetised), which enables you to configure a given placename from the 5-digit code of a single bus stop.&lt;br /&gt;
&lt;br /&gt;
 #!/bin/sh&lt;br /&gt;
 &lt;br /&gt;
 case $1 in&lt;br /&gt;
 &lt;br /&gt;
 	&amp;quot;--display&amp;quot;)&lt;br /&gt;
 	BUS_STOPS=&amp;quot;50713 48598 53221 74407&amp;quot;&lt;br /&gt;
 &lt;br /&gt;
 	if [ -r &amp;quot;/tmp/.bus_stops&amp;quot; ]; then&lt;br /&gt;
 		BUS_STOPS=`cat /tmp/.bus_stops`;&lt;br /&gt;
 	else&lt;br /&gt;
 		echo $BUS_STOPS &amp;gt; /tmp/.bus_stops;&lt;br /&gt;
 		chmod 777 /tmp/.bus_stops&lt;br /&gt;
 	fi&lt;br /&gt;
 	LOOP=0&lt;br /&gt;
 	if [ -r &amp;quot;/tmp/.countdown&amp;quot; ]; then&lt;br /&gt;
 		LOOP=`cat /tmp/.countdown`;&lt;br /&gt;
 	fi&lt;br /&gt;
 	let LOOP=$LOOP+1;&lt;br /&gt;
 	STOPCOUNT=`echo $BUS_STOPS | wc -w`;&lt;br /&gt;
 	if [ &amp;quot;$LOOP&amp;quot; -gt &amp;quot;$STOPCOUNT&amp;quot; ]; then&lt;br /&gt;
   		LOOP=1;&lt;br /&gt;
 	fi;&lt;br /&gt;
 	echo $LOOP &amp;gt;/tmp/.countdown&lt;br /&gt;
 	chmod 777 /tmp/.countdown&lt;br /&gt;
 	THISTIME=`echo $BUS_STOPS | cut -d&amp;quot; &amp;quot; -f $LOOP`;&lt;br /&gt;
 	lynx -dump -nolist http://m.countdown.tfl.gov.uk/arrivals/$THISTIME | grep -A10 &amp;quot;Buses dep&amp;quot; | sed -e &amp;quot;s/^   //g&amp;quot; | grep [a-z] | egrep -v &amp;quot;(Refresh|See\ map|Buses\ departing)&amp;quot; | sed -e &amp;quot;s/Bus stop code //g&amp;quot; | fold&lt;br /&gt;
 	;;&lt;br /&gt;
 &lt;br /&gt;
 	&amp;quot;--switch&amp;quot;)&lt;br /&gt;
 	BUS_STOPS=`ls /home/user/countdown/places`;&lt;br /&gt;
 	LOOP=0&lt;br /&gt;
 	if [ -r &amp;quot;/tmp/.countdown2&amp;quot; ]; then&lt;br /&gt;
 	LOOP=`cat /tmp/.countdown2`;&lt;br /&gt;
 	fi&lt;br /&gt;
 	let LOOP=$LOOP+1;&lt;br /&gt;
 	STOPCOUNT=`echo $BUS_STOPS | wc -w`;&lt;br /&gt;
 	if [ &amp;quot;$LOOP&amp;quot; -gt &amp;quot;$STOPCOUNT&amp;quot; ]; then&lt;br /&gt;
   	LOOP=1;&lt;br /&gt;
 	fi;&lt;br /&gt;
 	echo $LOOP &amp;gt;/tmp/.countdown2&lt;br /&gt;
 	chmod 777 /tmp/.countdown2&lt;br /&gt;
 	THISTIME=`echo $BUS_STOPS | cut -d&amp;quot; &amp;quot; -f $LOOP`;&lt;br /&gt;
 	STOPLIST=`cat /home/user/countdown/places/$THISTIME`;&lt;br /&gt;
 	echo $STOPLIST &amp;gt;/tmp/.bus_stops&lt;br /&gt;
 	chmod 777 /tmp/.bus_stops&lt;br /&gt;
 	echo 0 &amp;gt; /tmp/.countdown&lt;br /&gt;
 	chmod 777 /tmp/.countdown&lt;br /&gt;
 	echo $THISTIME | sed -e s/_/\ /g&lt;br /&gt;
 	;;&lt;br /&gt;
 &lt;br /&gt;
 	&amp;quot;--save&amp;quot;)&lt;br /&gt;
 	mkdir -p /home/user/countdown/places/&lt;br /&gt;
 	FILE=`echo &amp;quot;$2&amp;quot; | sed -e &amp;quot;s/ /_/g&amp;quot;`;&lt;br /&gt;
 	cat /tmp/.bus_stops &amp;gt; /home/user/countdown/places/$FILE&lt;br /&gt;
 	chown user /home/user/countdown/places/$FILE&lt;br /&gt;
 	;;&lt;br /&gt;
 &lt;br /&gt;
 	&amp;quot;--near&amp;quot;)&lt;br /&gt;
 	lynx -dump http://m.countdown.tfl.gov.uk/stopsNearStop/$2 | grep /arrivals/ | cut -d / -f 5 | while read stop; do out=&amp;quot;$out $stop&amp;quot;; echo $out &amp;gt; /tmp/.out; done; &lt;br /&gt;
 	cat /tmp/.out &amp;gt; /tmp/.bus_stops&lt;br /&gt;
 	cat /tmp/.bus_stops&lt;br /&gt;
 &lt;br /&gt;
 	if [ ! -z &amp;quot;$3&amp;quot; ]; then&lt;br /&gt;
 		$0 --save &amp;quot;$3&amp;quot;&lt;br /&gt;
 	fi &lt;br /&gt;
 &lt;br /&gt;
 	;;&lt;br /&gt;
 &lt;br /&gt;
 esac&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The idea here is that I go to a new place, let's say Putney, and I get off at The Embankment, which turns out to be stop 75040. I can now run:&lt;br /&gt;
&lt;br /&gt;
 # countdown --near 75040&lt;br /&gt;
&lt;br /&gt;
and override the current list of bus stops with the nine stops nearest to stop 75040, or, to store the configuration, I can run&lt;br /&gt;
&lt;br /&gt;
 # countdown --near 75040 &amp;quot;Putney&amp;quot;&lt;br /&gt;
&lt;br /&gt;
and the script will save a new location called Putney which I can then switch using the previously described switching functionality via DCEW. All that needs to be done to configure the script for the places you visit is to pick a bus stop that is fairly central to that location and run with --near to store the configuration.&lt;/div&gt;</description>
			<pubDate>Sun, 19 Feb 2012 01:59:16 GMT</pubDate>			<dc:creator>80.195.81.165</dc:creator>			<comments>http://bugs.maemo.com/Talk:Desktop_Command_Execution_Widget_scripts</comments>		</item>
		<item>
			<title>Desktop Command Execution Widget scripts</title>
			<link>http://bugs.maemo.com/Desktop_Command_Execution_Widget_scripts</link>
			<guid>http://bugs.maemo.com/Desktop_Command_Execution_Widget_scripts</guid>
			<description>&lt;p&gt;80.195.81.165:&amp;#32;/* Battery (via bq27200 chip) */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Desktop Command Execution widget is one of the most useful widgets on your Maemo desktop. It can be used to show certain information (for example battery level in percentage) or as a button which can be used for example to disconnect active internet connection (you need to tap 3 times and also wait for menus to appear without this widget). Therefore it can replace many other applications/widgets/applets and you can also make something new. Here you'll find a collection of scripts that can be added to the widget. The discussion about the widget is [http://talk.maemo.org/showthread.php?t=39177 on the forum].&lt;br /&gt;
&lt;br /&gt;
Scripts are also compatible with [[Queen BeeCon Widget]] which has extended graphic and cosmetic functionality, but is far more complicated.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Making your own scripts==&lt;br /&gt;
&lt;br /&gt;
===Scripts without output===&lt;br /&gt;
&lt;br /&gt;
When there's no output (for example if you're using widget as a button and you use D-Bus call) the widget displays &amp;quot;Invalid Command&amp;quot;. This can be most easily avoided if you pipe echo &amp;quot;&amp;quot; at the end of the command. This is also usable if your script produces unwanted output (D-Bus reply for example).&lt;br /&gt;
&lt;br /&gt;
 dbus-send -options -moreoptions | echo &amp;quot;&amp;quot;&lt;br /&gt;
&lt;br /&gt;
Collection of D-Bus calls can be found on [[Phone control]] wiki page. The basic principle for making a script for DCEW is the same as above (D-Bus command and piping an echo).&lt;br /&gt;
&lt;br /&gt;
===Scripts with long output===&lt;br /&gt;
&lt;br /&gt;
Some scripts may create multiple lines which are too long to be displayed on a single line. The widget will not wrap these. In order to wrap them you can use the fold command:&lt;br /&gt;
 &lt;br /&gt;
 command-that-produces-long-lines | fold -s -w 80&lt;br /&gt;
&lt;br /&gt;
The 80 in that instance is the maximum length of the line, which you can change. The -s option makes fold word wrap with spaces. More information is available from the [http://unixhelp.ed.ac.uk/CGI/man-cgi?fold fold man page].&lt;br /&gt;
&lt;br /&gt;
==Scripts to display information==&lt;br /&gt;
&lt;br /&gt;
===Battery (via Nokia's BME) ===&lt;br /&gt;
&lt;br /&gt;
All battery scripts are collected here. Pick the one which suits your needs. Examples of the output values are under each one.&lt;br /&gt;
&lt;br /&gt;
There are 2 values for full battery capacity available. First one is design charge in mAh, which is always the same (1273 mAh). The second one is the one used in these scripts and it is the full charge from last charging. With displaying this one you can also monitor battery wear level.&lt;br /&gt;
&lt;br /&gt;
Battery percentage level is calculated using first value and is therefore less accurate, that's why you cannot achieve 100% full battery, but only about 95%. After some time the full percentage will be even lower.&lt;br /&gt;
&lt;br /&gt;
But last full charge value has one disadvantage. This is that after a reboot the phone forgets this value and the value returned is 0. It shows the proper value after next charging.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
====Percentage, current and last full charge====&lt;br /&gt;
&lt;br /&gt;
 hal-device bme | awk '/l.p/ {perc = $3}; /g.c/ {curr = $3}; /g.la/ {last = $3}; /s_c/ {isch = $3} END if (isch == &amp;quot;false&amp;quot;) {print perc&amp;quot; % (&amp;quot;curr&amp;quot;/&amp;quot;last&amp;quot; mAh)&amp;quot;} else {print &amp;quot;Charging&amp;quot;}'&lt;br /&gt;
&lt;br /&gt;
Output example: '''83 % (1000/1200 mAh)''', when charging '''Charging'''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
====Percentage and current charge====&lt;br /&gt;
&lt;br /&gt;
 hal-device bme | awk '/l.p/ {perc = $3}; /g.c/ {curr = $3}; /s_c/ {isch = $3} END if (isch == &amp;quot;false&amp;quot;) {print perc&amp;quot; % (&amp;quot;curr&amp;quot; mAh)&amp;quot;} else {print &amp;quot;Charging&amp;quot;}'&lt;br /&gt;
&lt;br /&gt;
Output example: '''83 % (1000 mAh)''', when charging '''Charging'''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
====Percentage====&lt;br /&gt;
&lt;br /&gt;
 hal-device bme | awk '/l.p/ {perc = $3}; /s_c/ {isch = $3} END if (isch == &amp;quot;false&amp;quot;) {print perc&amp;quot; %&amp;quot;} else {print &amp;quot;Chrg&amp;quot;}'&lt;br /&gt;
&lt;br /&gt;
Output example: '''83 %''', when charging '''Chrg'''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
====Current and last full charge====&lt;br /&gt;
&lt;br /&gt;
 hal-device bme | awk '/g.c/ {curr = $3}; /g.la/ {last = $3} END {print curr&amp;quot;/&amp;quot;last&amp;quot; mAh&amp;quot;}'&lt;br /&gt;
&lt;br /&gt;
Output example: '''1000/1200 mAh'''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
====Current charge====&lt;br /&gt;
&lt;br /&gt;
 hal-device bme | awk '/g.c/ {print $3&amp;quot; mAh&amp;quot;}'&lt;br /&gt;
&lt;br /&gt;
Output example: '''1000 mAh'''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
====Last full charge====&lt;br /&gt;
&lt;br /&gt;
 hal-device bme | awk '/g.la/ {print $3&amp;quot; mAh&amp;quot;}'&lt;br /&gt;
&lt;br /&gt;
Output example: '''1200 mAh'''&lt;br /&gt;
&lt;br /&gt;
===Battery (via bq27200 chip) ===&lt;br /&gt;
&lt;br /&gt;
==== Percentage, current and last full charge, with TTE or TTF as appropriate ====&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Install this as e.g. /usr/local/bin/bqbattery, make it executable and point DCEW to it. This is designed to work whether or not you have the bq27x00_battery module loaded, but if you don't, then you'll need to install the i2c-tools package, and then chmod 4755 /usr/sbin/i2cget (meaning i2cget runs as root even when we invoke it as user from DCEW).&lt;br /&gt;
&lt;br /&gt;
 #!/bin/sh&lt;br /&gt;
 &lt;br /&gt;
 if [ -r &amp;quot;/sys/class/power_supply/bq27200-0/capacity&amp;quot; ]; then&lt;br /&gt;
 # We have bq27x00_battery loaded - get the values from /sys/class/power_supply/bq27200-0/&lt;br /&gt;
 CSOC=`cat /sys/class/power_supply/bq27200-0/capacity`;&lt;br /&gt;
 NAC=$((`cat /sys/class/power_supply/bq27200-0/charge_now` / 1000));&lt;br /&gt;
 LMD=$((`cat /sys/class/power_supply/bq27200-0/charge_full` / 1000));&lt;br /&gt;
 STATUS=`cat /sys/class/power_supply/bq27200-0/status`;&lt;br /&gt;
 if [ &amp;quot;$STATUS&amp;quot; == &amp;quot;Discharging&amp;quot; ]; then&lt;br /&gt;
        TTF=65535&lt;br /&gt;
        TTE=$((`cat /sys/class/power_supply/bq27200-0/time_to_empty_avg` / 60));&lt;br /&gt;
 else&lt;br /&gt;
        TTF=$((`cat /sys/class/power_supply/bq27200-0/time_to_full_now` / 60));&lt;br /&gt;
        TTE=65535&lt;br /&gt;
 fi&lt;br /&gt;
 else&lt;br /&gt;
 # We don't have bq27x00_battery - get the values using i2cget&lt;br /&gt;
 NAC=$(($(/usr/sbin/i2cget -y 2 0x55 0x0c w) * 3570 / 20 / 1000));&lt;br /&gt;
 LMD=$(($(/usr/sbin/i2cget -y 2 0x55 0x12 w) * 3570 / 20 / 1000));&lt;br /&gt;
 CSOC=$(($(/usr/sbin/i2cget -y 2 0x55 0x2c)));&lt;br /&gt;
 TTF=$(($(/usr/sbin/i2cget -y 2 0x55 0x18 w)));&lt;br /&gt;
 TTE=$(($(/usr/sbin/i2cget -y 2 0x55 0x16 w)));&lt;br /&gt;
 fi&lt;br /&gt;
 echo &amp;quot;$CSOC% ($NAC/$LMD mAh)&amp;quot;&lt;br /&gt;
 if [ &amp;quot;$TTF&amp;quot; -eq 65535 ]; then&lt;br /&gt;
         echo &amp;quot;$TTE minutes to empty&amp;quot;&lt;br /&gt;
 else&lt;br /&gt;
         echo &amp;quot;$TTF min to full battery&amp;quot;&lt;br /&gt;
 fi&lt;br /&gt;
&lt;br /&gt;
Output example:&lt;br /&gt;
&lt;br /&gt;
'''88% (1269/1439 mAh)'''&lt;br /&gt;
&lt;br /&gt;
'''37 min to full battery'''&lt;br /&gt;
&lt;br /&gt;
===IP===&lt;br /&gt;
&lt;br /&gt;
Internal IPs are obtained from the ifconfig and external IPs are obtained from the internet, because gprs0 IP which you can get with ifconfig is often from private address range, because mobile operators like to use NAT.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
====External (WAN) and internal (LAN)====&lt;br /&gt;
&lt;br /&gt;
 echo WAN IP: `wget -t 2 -T 3 -q -O - api.myiptest.com | awk -F &amp;quot;\&amp;quot;&amp;quot; '{print $4}'`; echo LAN IP: `/sbin/ifconfig wlan0 | awk -F &amp;quot;[: ]&amp;quot; '/Bc/ {print $13}'`&lt;br /&gt;
&lt;br /&gt;
Output example:&lt;br /&gt;
&lt;br /&gt;
'''WAN IP: 1.2.3.4'''&lt;br /&gt;
&lt;br /&gt;
'''LAN IP: 192.168.1.2'''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 echo WAN IP: `wget -t 2 -T 3 -q -O - api.myiptest.com | awk -F &amp;quot;\&amp;quot;&amp;quot; '{print $4 &amp;quot; (&amp;quot;$12&amp;quot; &amp;quot;toupper($28)&amp;quot;)&amp;quot;}'`; echo LAN IP: `/sbin/ifconfig wlan0 | awk -F &amp;quot;[: ]&amp;quot; '/Bc/ {print $13}'`&lt;br /&gt;
&lt;br /&gt;
Output example:&lt;br /&gt;
&lt;br /&gt;
'''WAN IP: 1.2.3.4 (ISP CountryCode)'''&lt;br /&gt;
&lt;br /&gt;
'''LAN IP: 192.168.1.2'''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 echo WAN IP: `wget -t 2 -T 3 -q -O - api.myiptest.com | awk -F &amp;quot;\&amp;quot;&amp;quot; '{print $4&amp;quot; (&amp;quot;$12&amp;quot; @ &amp;quot;$20&amp;quot;, &amp;quot;toupper($28)&amp;quot;)&amp;quot;}'`; echo LAN IP: `/sbin/ifconfig wlan0 | awk -F &amp;quot;[: ]&amp;quot; '/Bc/ {print $13}'`&lt;br /&gt;
&lt;br /&gt;
Output example:&lt;br /&gt;
&lt;br /&gt;
'''WAN IP: 1.2.3.4 (ISP @ City, CountryCode)'''&lt;br /&gt;
&lt;br /&gt;
'''LAN IP: 192.168.1.2'''&lt;br /&gt;
&lt;br /&gt;
====External (WAN)====&lt;br /&gt;
&lt;br /&gt;
 wget -t 2 -T 3 -q -O - api.myiptest.com | awk -F &amp;quot;\&amp;quot;&amp;quot; '{print $4}'&lt;br /&gt;
&lt;br /&gt;
Output example: '''1.2.3.4'''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 wget -t 2 -T 3 -q -O - api.myiptest.com | awk -F &amp;quot;\&amp;quot;&amp;quot; '{print $4 &amp;quot; (&amp;quot;$12&amp;quot; &amp;quot;toupper($28)&amp;quot;)&amp;quot;}'&lt;br /&gt;
&lt;br /&gt;
Output example: '''1.2.3.4 (ISP CountryCode)'''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 wget -t 2 -T 3 -q -O - api.myiptest.com | awk -F &amp;quot;\&amp;quot;&amp;quot; '{print $4&amp;quot; (&amp;quot;$12&amp;quot; @ &amp;quot;$20&amp;quot;, &amp;quot;toupper($28)&amp;quot;)&amp;quot;}'&lt;br /&gt;
&lt;br /&gt;
Output example: '''1.2.3.4 (ISP @ City, CountryCode)'''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
====Internal (LAN)====&lt;br /&gt;
&lt;br /&gt;
 /sbin/ifconfig wlan0 | awk -F &amp;quot;[: ]&amp;quot; '/Bc/ {print $13}'&lt;br /&gt;
&lt;br /&gt;
This one displays only wlan0 IP (used for SSH, WinSCP, VNC... in LAN).&lt;br /&gt;
&lt;br /&gt;
===Disk usage===&lt;br /&gt;
&lt;br /&gt;
====rootfs (256MB /) percentage used====&lt;br /&gt;
&lt;br /&gt;
 df | awk '$1 == &amp;quot;rootfs&amp;quot; {print $5}'&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
====rootfs (256MB /) free space====&lt;br /&gt;
&lt;br /&gt;
 df -h | awk '$1 == &amp;quot;rootfs&amp;quot; {print $4}'&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
====Internal memory for user data (27GB /home/user/MyDocs) percentage used====&lt;br /&gt;
&lt;br /&gt;
 df /home/user/MyDocs | awk '/My/ {print $5}'&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
====Internal memory for user data (27GB /home/user/MyDocs) free space====&lt;br /&gt;
&lt;br /&gt;
 df -h /home/user/MyDocs | awk '/My/ {print $4}'&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
====Internal memory for application data (2GB /home) percentage used====&lt;br /&gt;
&lt;br /&gt;
 df /home | awk '/ho/ {print $5}'&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
====Internal memory for application data (2GB /home) free space====&lt;br /&gt;
&lt;br /&gt;
 df -h /home | awk '/ho/ {print $4}'&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
====Memory card (/media/mmc1) percentage used====&lt;br /&gt;
&lt;br /&gt;
 df /media/mmc1 | awk '/mm/ {print $5}'&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
====Memory card (/media/mmc1) free space====&lt;br /&gt;
&lt;br /&gt;
 df -h /media/mmc1 | awk '/mm/ {print $4}'&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Cellular signal===&lt;br /&gt;
&lt;br /&gt;
====Quality====&lt;br /&gt;
&lt;br /&gt;
 dbus-send --system --print-reply --dest=com.nokia.phone.net /com/nokia/phone/net Phone.Net.get_signal_strength | awk 'NR==2 {print $2&amp;quot; %&amp;quot;}'&lt;br /&gt;
&lt;br /&gt;
====Strength====&lt;br /&gt;
&lt;br /&gt;
 dbus-send --system --print-reply --dest=com.nokia.phone.net /com/nokia/phone/net Phone.Net.get_signal_strength | awk 'NR==3 {print &amp;quot;-&amp;quot;$2&amp;quot; dBm&amp;quot;}'&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Wi-Fi signal===&lt;br /&gt;
&lt;br /&gt;
====Quality====&lt;br /&gt;
&lt;br /&gt;
 awk -F &amp;quot;[. ]&amp;quot; '/0/ {print $6&amp;quot; %&amp;quot;}' /proc/net/wireless&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
====RSSI====&lt;br /&gt;
&lt;br /&gt;
 awk '/0/ {print $4&amp;quot; dBm&amp;quot;}' /proc/net/wireless&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
====Noise====&lt;br /&gt;
&lt;br /&gt;
 awk -F &amp;quot;[. ]&amp;quot; '/0/ {print $12&amp;quot; dBm&amp;quot;}' /proc/net/wireless&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===CPU frequency===&lt;br /&gt;
&lt;br /&gt;
 awk '{print $1/1000&amp;quot; MHz&amp;quot;}' /sys/devices/system/cpu/cpu0/cpufreq/scaling_cur_freq&lt;br /&gt;
&lt;br /&gt;
====Usage of each frequency====&lt;br /&gt;
&lt;br /&gt;
 awk -v var=$(awk '{sum+=$2}; END {print sum};' /sys/devices/system/cpu/cpu0/cpufreq/stats/time_in_state) '{arr[$3]=$2}{for (i in arr) {print $1/1000 &amp;quot; mhz &amp;quot; int(arr[i]*100/var)&amp;quot;%&amp;quot;}}' /sys/devices/system/cpu/cpu0/cpufreq/stats/time_in_state&lt;br /&gt;
&lt;br /&gt;
===Memory usage===&lt;br /&gt;
&lt;br /&gt;
====RAM used====&lt;br /&gt;
&lt;br /&gt;
 awk '/mT/ {memttl = $2}; /mF/ {memfre = $2}; /Bu/ {membff = $2}; $1 == &amp;quot;Cached:&amp;quot; {memcch = $2} END {printf (&amp;quot;%.1f MB\n&amp;quot;,(memttl-memfre-membff-memcch)/1024)}' /proc/meminfo&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
====RAM free====&lt;br /&gt;
&lt;br /&gt;
 awk '/mF/ {memfre = $2}; /Bu/ {membff = $2}; $1 == &amp;quot;Cached:&amp;quot; {memcch = $2} END {printf (&amp;quot;%.1f MB\n&amp;quot;,(memfre+membff+memcch)/1024)}' /proc/meminfo&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
====Swap used====&lt;br /&gt;
&lt;br /&gt;
 awk '/pT/ {swpttl = $2}; /pF/ {swpfre = $2} END {printf (&amp;quot;%.1f MB\n&amp;quot;,(swpttl-swpfre)/1024)}' /proc/meminfo&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
====Swap free====&lt;br /&gt;
&lt;br /&gt;
 awk '/pF/ {printf (&amp;quot;%.1f MB\n&amp;quot;,$2/1024)}' /proc/meminfo&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
====Total memory used====&lt;br /&gt;
&lt;br /&gt;
 awk '/mT/ {memttl = $2}; /mF/ {memfre = $2}; /Bu/ {membff = $2}; $1 == &amp;quot;Cached:&amp;quot; {memcch = $2}; /pT/ {swpttl = $2}; /pF/ {swpfre = $2} END {printf (&amp;quot;%.1f MB\n&amp;quot;,(memttl+swpttl-memfre-membff-memcch-swpfre)/1024)}' /proc/meminfo&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
====Total memory free====&lt;br /&gt;
&lt;br /&gt;
 awk '/mF/ {memfre = $2}; /Bu/ {membff = $2}; $1 == &amp;quot;Cached:&amp;quot; {memcch = $2}; /pF/ {swpfre = $2} END {printf (&amp;quot;%.1f MB\n&amp;quot;,(memfre+membff+memcch+swpfre)/1024)}' /proc/meminfo&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===GPRS data usage===&lt;br /&gt;
&lt;br /&gt;
You can use this with scheduled reset of the GPRS data counter to display data usage for current month. Additional info can be found on [[fcron]] wiki page.&lt;br /&gt;
&lt;br /&gt;
These scripts are now compatibile with PR1.2 (separate home and roaming counter), which means they won't work on previous versions.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
====Home counter (combined)====&lt;br /&gt;
&lt;br /&gt;
 echo `gconftool-2 -g /system/osso/connectivity/network_type/GPRS/gprs_home_rx_bytes` `gconftool-2 -g /system/osso/connectivity/network_type/GPRS/gprs_home_tx_bytes` | awk '{printf (&amp;quot;%.1f MB\n&amp;quot;,($1+$2)/1048576)}'&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
====Home counter (separated)====&lt;br /&gt;
&lt;br /&gt;
 echo `gconftool-2 -g /system/osso/connectivity/network_type/GPRS/gprs_home_rx_bytes | awk '{printf (&amp;quot;Download: %.1f MB\n&amp;quot;,$1/1048576)}'`; echo `gconftool-2 -g /system/osso/connectivity/network_type/GPRS/gprs_home_tx_bytes | awk '{printf (&amp;quot;Upload: %.1f MB\n&amp;quot;,$1/1048576)}'`&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
====Roaming counter (combined)====&lt;br /&gt;
&lt;br /&gt;
 echo `gconftool-2 -g /system/osso/connectivity/network_type/GPRS/gprs_roaming_rx_bytes` `gconftool-2 -g /system/osso/connectivity/network_type/GPRS/gprs_roaming_tx_bytes` | awk '{printf (&amp;quot;%.1f MB\n&amp;quot;,($1+$2)/1048576)}'&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
====Roaming counter (separated)====&lt;br /&gt;
&lt;br /&gt;
 echo `gconftool-2 -g /system/osso/connectivity/network_type/GPRS/gprs_roaming_rx_bytes | awk '{printf (&amp;quot;Download: %.1f MB\n&amp;quot;,$1/1048576)}'`; echo `gconftool-2 -g /system/osso/connectivity/network_type/GPRS/gprs_roaming_tx_bytes | awk '{printf (&amp;quot;Upload: %.1f MB\n&amp;quot;,$1/1048576)}'`&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Time and date===&lt;br /&gt;
&lt;br /&gt;
====Date====&lt;br /&gt;
&lt;br /&gt;
 date +&amp;quot;%a, %-d.%-m.%Y&amp;quot;&lt;br /&gt;
&lt;br /&gt;
This command will show the date in format (for example) '''Tue, 4.5.2010'''. You can define your own format (between the quotation marks). Possible options are described on [http://unixhelp.ed.ac.uk/CGI/man-cgi?date manpage].&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
====Time in different timezones====&lt;br /&gt;
 &lt;br /&gt;
 export TZ=&amp;quot;Europe/London&amp;quot;; date +%R&lt;br /&gt;
&lt;br /&gt;
This one shows two timezones in format ''London: 13:04 | Denver: 06:04''&lt;br /&gt;
&lt;br /&gt;
 echo &amp;quot;London:&amp;quot; `export TZ=&amp;quot;Europe/London&amp;quot;; date +%R` &amp;quot;| Denver:&amp;quot; `export TZ=&amp;quot;America/Denver&amp;quot;; date +%R`&lt;br /&gt;
&lt;br /&gt;
London and Denver are taken as an example. TZ values can be found on [[:wikipedia:List_of_tz_database_time_zones|Wikipedia]].&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Uptime and load===&lt;br /&gt;
&lt;br /&gt;
These scripts are formatproof meaning that they display what they're supposed to no matter what format is command &amp;quot;uptime&amp;quot; outputting. Not all scripts found are like that, because &amp;quot;uptime&amp;quot; command is a little bit complicated for scripted text processing. For example when the system is running under one hour only &amp;quot;x min&amp;quot; is shown, when it is running under one day &amp;quot;hour:min:sec&amp;quot; is shown and after that it is shown in format &amp;quot;x days, hour:min:sec&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
====Both====&lt;br /&gt;
&lt;br /&gt;
 uptime | sed -e 's/.*up */uptime: /' -e 's/ average//' -e 's/  / /'&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
====Uptime====&lt;br /&gt;
&lt;br /&gt;
 uptime | sed -e 's/.*p *//' -e 's/, l.*//' -e 's/  / /'&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
====Load====&lt;br /&gt;
&lt;br /&gt;
 uptime | sed 's/.*e: //'&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Boot reason===&lt;br /&gt;
&lt;br /&gt;
 cat /proc/bootreason&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Boot count===&lt;br /&gt;
&lt;br /&gt;
 cat /var/lib/dsme/boot_count&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Temperature===&lt;br /&gt;
&lt;br /&gt;
CPU's thermal sensors are not accessible, but there is one near the battery. This commands displays output of its readings, but IT IS NOT RELIABLE, because it doesn't always work. Sometimes the value returned is wrong or constant. It needs to be tested further.&lt;br /&gt;
&lt;br /&gt;
 cat /sys/devices/platform/omap34xx_temp/temp1_input | awk '{ sub(/-/,&amp;quot;&amp;quot;); print $1&amp;quot; °C&amp;quot;}'&lt;br /&gt;
&lt;br /&gt;
There is a working way now to read the correct temperature, but it is working only on a newer titan's kernels (normal, overclock, undervoltage). The bq27x00_battery module has to be loaded first.&lt;br /&gt;
&lt;br /&gt;
 echo `cat /sys/class/power_supply/bq27200-0/temp` °C&lt;br /&gt;
&lt;br /&gt;
with a comma : &lt;br /&gt;
&lt;br /&gt;
 echo `cat /sys/class/power_supply/bq27200-0/temp` °C | sed 's/\B[0-9]\{1\}/&amp;amp;,/'&lt;br /&gt;
&lt;br /&gt;
===Top processes===&lt;br /&gt;
&lt;br /&gt;
This script displays top ''N'' CPU consuming processes. It excludes top itself, which is quite processor intensive so you probably don't want this updating too often. Modify ''N=3'' at the start to display different number of processes.&lt;br /&gt;
&lt;br /&gt;
 N=3; top -bn 1 | grep -v top | head -n $(($N+4)) | tail -n $(($N+1)) | awk '{OFS = &amp;quot;\t&amp;quot;} {print $7,$8}'&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Random Number Generator===&lt;br /&gt;
&lt;br /&gt;
This script displays a random number between 0 and ''M'' (''M'' included)&lt;br /&gt;
&lt;br /&gt;
 M=6; dd if=/dev/urandom bs=1 count=4 2&amp;gt;/dev/null | od -l | awk -v M=$M '{M++;print $2&amp;lt;0?-$2%M:$2%M;exit}'&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Ping a Host===&lt;br /&gt;
Preferred method. Install netcat from [http://wiki.maemo.org/Documentation/devtools/maemo5#Installation]&lt;br /&gt;
&lt;br /&gt;
 if (nc -zw1 192.168.2.1 80);then echo up;else echo down;fi&lt;br /&gt;
&lt;br /&gt;
Alternate method. Ping has a long timeout when down. Warning: it will block the desktop while running.&lt;br /&gt;
&lt;br /&gt;
 if (echo 'ping -c1 192.168.2.1' | rootsh /bin/sh  2&amp;gt;&amp;amp;1 &amp;gt;/dev/null);then echo up;else echo down;fi&lt;br /&gt;
&lt;br /&gt;
==Scripts for buttons==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Make sure that update policy for button widgets is set only to &amp;quot;update when clicked&amp;quot;. &amp;quot;Update when switched to desktop&amp;quot;, &amp;quot;update interval&amp;quot; and &amp;quot;network presence&amp;quot; should be disabled to avoid automatic actions. Also keep in mind that widgets are executed at every boot so they can for example automatically disable Wi-Fi when phone boots.&lt;br /&gt;
&lt;br /&gt;
There is a bug in version 0.9 or lower which prevents you from using DCEW widgets as buttons, because they get activated (pressed) automatically all the time. You have to make sure DCEW is at least version 1.0, to check which version you have installed do this: dpkg -l desktop-cmd-exec.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Networking===&lt;br /&gt;
&lt;br /&gt;
====Connect/disconnect====&lt;br /&gt;
&lt;br /&gt;
 sh /path/conn-disconn.sh | echo &amp;quot;&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''conn-disconn.sh'''&lt;br /&gt;
&lt;br /&gt;
 #!/bin/sh&lt;br /&gt;
 if [ `/sbin/route | awk '/au/ {print $1}'` = default ]; then&lt;br /&gt;
 dbus-send --system --dest=com.nokia.icd /com/nokia/icd_ui com.nokia.icd_ui.disconnect boolean:true&lt;br /&gt;
 else&lt;br /&gt;
 dbus-send --system --type=method_call --dest=com.nokia.icd /com/nokia/icd com.nokia.icd.connect string:&amp;quot;[ANY]&amp;quot; uint32:0&lt;br /&gt;
 fi&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
====Connect internet (show connections)====&lt;br /&gt;
&lt;br /&gt;
 dbus-send --system --type=method_call --dest=com.nokia.icd_ui /com/nokia/icd_ui com.nokia.icd_ui.show_conn_dlg boolean:false | echo &amp;quot;&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
====Connect to any saved connection====&lt;br /&gt;
&lt;br /&gt;
 dbus-send --system --type=method_call --dest=com.nokia.icd /com/nokia/icd com.nokia.icd.connect string:&amp;quot;[ANY]&amp;quot; uint32:0 | echo &amp;quot;&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
====Disconnect internet====&lt;br /&gt;
&lt;br /&gt;
 dbus-send --system --dest=com.nokia.icd /com/nokia/icd_ui com.nokia.icd_ui.disconnect boolean:true | echo &amp;quot;&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
====Enable/disable Wi-Fi====&lt;br /&gt;
&lt;br /&gt;
 echo &amp;quot;/path/to/script/wifi.sh&amp;quot; | sudo gainroot | echo &amp;quot;&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''wifi.sh script:'''&lt;br /&gt;
&lt;br /&gt;
 #!/bin/sh&lt;br /&gt;
 out=`ifconfig wlan0`&lt;br /&gt;
 if [ $? -eq &amp;quot;0&amp;quot; ] ; then&lt;br /&gt;
 if [ `echo &amp;quot;$out&amp;quot; | grep -c RUNNING` -gt &amp;quot;0&amp;quot; ] ; then&lt;br /&gt;
 run-standalone.sh dbus-send --system --dest=com.nokia.icd /com/nokia/icd_ui com.nokia.icd_ui.disconnect boolean:true&lt;br /&gt;
 fi&lt;br /&gt;
 ifconfig wlan0 down&lt;br /&gt;
 rmmod wl12xx&lt;br /&gt;
 run-standalone.sh dbus-send --type=method_call --dest=org.freedesktop.Notifications /org/freedesktop/Notifications org.freedesktop.Notifications.SystemNoteInfoprint string:'Wi-Fi disabled'&lt;br /&gt;
 exit 2&lt;br /&gt;
 else&lt;br /&gt;
 modprobe wl12xx&lt;br /&gt;
 wl1251-cal&lt;br /&gt;
 stop wlancond&lt;br /&gt;
 start wlancond&lt;br /&gt;
 ifconfig wlan0 up&lt;br /&gt;
 run-standalone.sh dbus-send --system --type=method_call --dest=com.nokia.icd_ui /com/nokia/icd_ui com.nokia.icd_ui.show_conn_dlg boolean:false&lt;br /&gt;
 exit 0&lt;br /&gt;
 fi&lt;br /&gt;
&lt;br /&gt;
Don't forget to make it executable.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
====Wake On Lan====&lt;br /&gt;
 &lt;br /&gt;
 /path/to/script/wol.py | echo &amp;quot;&amp;quot;&lt;br /&gt;
wol.py script;&lt;br /&gt;
&lt;br /&gt;
 #! /usr/bin/python&lt;br /&gt;
 # Wake-On-LAN&lt;br /&gt;
 # Change ip range in the &amp;quot;s.sendto(msg&amp;quot; line &lt;br /&gt;
 # and the MAC of the pc to wakeup in the bottom line&lt;br /&gt;
 import struct, socket&lt;br /&gt;
 def WakeOnLan(ethernet_address):&lt;br /&gt;
  # Construct a six-byte hardware address&lt;br /&gt;
  addr_byte = ethernet_address.split(':')&lt;br /&gt;
  hw_addr = struct.pack('BBBBBB', int(addr_byte[0], 16),&lt;br /&gt;
    int(addr_byte[1], 16),&lt;br /&gt;
    int(addr_byte[2], 16),&lt;br /&gt;
    int(addr_byte[3], 16),&lt;br /&gt;
    int(addr_byte[4], 16),&lt;br /&gt;
    int(addr_byte[5], 16))&lt;br /&gt;
  # Build the Wake-On-LAN &amp;quot;Magic Packet&amp;quot;...&lt;br /&gt;
  msg = '\xff' * 6 + hw_addr * 16&lt;br /&gt;
  # ...and send it to the broadcast address using UDP&lt;br /&gt;
  s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)&lt;br /&gt;
  s.setsockopt(socket.SOL_SOCKET, socket.SO_BROADCAST, 1)&lt;br /&gt;
  s.sendto(msg, ('192.168.1.255', 9))&lt;br /&gt;
  s.close()&lt;br /&gt;
 # Example use&lt;br /&gt;
 WakeOnLan('00:13:21:00:62:AE')&lt;br /&gt;
Don't forget to Chmod 755 wol.py&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
====Disconnect mobile network====&lt;br /&gt;
&lt;br /&gt;
 dbus-send --system --type=method_call --dest=com.nokia.phone.SSC /com/nokia/phone/SSC com.nokia.phone.SSC.set_radio boolean:false | echo &amp;quot;&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
====Connect mobile network====&lt;br /&gt;
&lt;br /&gt;
 dbus-send --system --type=method_call --dest=com.nokia.phone.SSC /com/nokia/phone/SSC com.nokia.phone.SSC.set_radio boolean:true | echo &amp;quot;&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Lock screen and keys===&lt;br /&gt;
&lt;br /&gt;
 dbus-send --system --type=method_call --dest=com.nokia.mce /com/nokia/mce/request com.nokia.mce.request.req_tklock_mode_change string:&amp;quot;locked&amp;quot; | echo &amp;quot;&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Radio mode===&lt;br /&gt;
&lt;br /&gt;
====2G/3G====&lt;br /&gt;
&lt;br /&gt;
 sh /path/to/script/2g3g.sh | echo &amp;quot;&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''2g3g.sh script:'''&lt;br /&gt;
&lt;br /&gt;
 #!/bin/sh&lt;br /&gt;
 if [ `dbus-send --system --type=method_call --print-reply --dest=com.nokia.phone.net /com/nokia/phone/net Phone.Net.get_selected_radio_access_technology | awk '/b/ {print $2}'` -eq 1 ]; then&lt;br /&gt;
 dbus-send --system --type=method_call --dest=com.nokia.phone.net /com/nokia/phone/net Phone.Net.set_selected_radio_access_technology byte:2&lt;br /&gt;
 else&lt;br /&gt;
 dbus-send --system --type=method_call --dest=com.nokia.phone.net /com/nokia/phone/net Phone.Net.set_selected_radio_access_technology byte:1&lt;br /&gt;
 fi&lt;br /&gt;
&lt;br /&gt;
When 3G or Dual mode is active, the script will switch to 2G. And when 2G is active, it will switch to 3G.&lt;br /&gt;
&lt;br /&gt;
Don't forget to make the script executable.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
====2G====&lt;br /&gt;
&lt;br /&gt;
 dbus-send --system --type=method_call --dest=com.nokia.phone.net /com/nokia/phone/net Phone.Net.set_selected_radio_access_technology byte:1 | echo &amp;quot;&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
====3G====&lt;br /&gt;
&lt;br /&gt;
 dbus-send --system --type=method_call --dest=com.nokia.phone.net /com/nokia/phone/net Phone.Net.set_selected_radio_access_technology byte:2 | echo &amp;quot;&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
====Dual====&lt;br /&gt;
&lt;br /&gt;
 dbus-send --system --type=method_call --dest=com.nokia.phone.net /com/nokia/phone/net Phone.Net.set_selected_radio_access_technology byte:0 | echo &amp;quot;&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Bluetooth===&lt;br /&gt;
&lt;br /&gt;
====Enable====&lt;br /&gt;
&lt;br /&gt;
 dbus-send --system --type=method_call --dest=org.bluez $(dbus-send --system --print-reply --dest=org.bluez / org.bluez.Manager.ListAdapters | awk -F &amp;quot;\&amp;quot;&amp;quot; '/at/ {print $2}') org.bluez.Adapter.SetProperty string:Powered variant:boolean:true | echo &amp;quot;&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
====Disable====&lt;br /&gt;
&lt;br /&gt;
 dbus-send --system --type=method_call --dest=org.bluez $(dbus-send --system --print-reply --dest=org.bluez / org.bluez.Manager.ListAdapters | awk -F &amp;quot;\&amp;quot;&amp;quot; '/at/ {print $2}') org.bluez.Adapter.SetProperty string:Powered variant:boolean:false | echo &amp;quot;&amp;quot;&lt;br /&gt;
&lt;br /&gt;
===Profiles===&lt;br /&gt;
&lt;br /&gt;
====General====&lt;br /&gt;
&lt;br /&gt;
 dbus-send --type=method_call --dest=com.nokia.profiled /com/nokia/profiled com.nokia.profiled.set_profile string:&amp;quot;general&amp;quot; | echo &amp;quot;&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
====Silent====&lt;br /&gt;
&lt;br /&gt;
 dbus-send --type=method_call --dest=com.nokia.profiled /com/nokia/profiled com.nokia.profiled.set_profile string:&amp;quot;silent&amp;quot; | echo&amp;quot;&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
====Toggle vibrating alert====&lt;br /&gt;
&lt;br /&gt;
There are far more things you can do with your profile. Please have a look at the [[Phone_control#Get_all_profile_Values|profile values at the phone control page]]. This example disables vibrating alert for the active profile.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 # Which profile is active?&lt;br /&gt;
 if \&lt;br /&gt;
 dbus-send --print-reply --type=method_call \&lt;br /&gt;
 --dest=com.nokia.profiled /com/nokia/profiled \&lt;br /&gt;
 com.nokia.profiled.get_profile | grep -q general&lt;br /&gt;
 then&lt;br /&gt;
 	# general profile is active&lt;br /&gt;
 	dbus-send --type=method_call \&lt;br /&gt;
 	--dest=com.nokia.profiled /com/nokia/profiled \&lt;br /&gt;
 	com.nokia.profiled.set_value string:&amp;quot;general&amp;quot; \&lt;br /&gt;
 	string:&amp;quot;vibrating.alert.enabled&amp;quot; string:&amp;quot;Off&amp;quot;&lt;br /&gt;
 else&lt;br /&gt;
 	# silent profile is active&lt;br /&gt;
 	dbus-send --type=method_call \&lt;br /&gt;
 	--dest=com.nokia.profiled /com/nokia/profiled \&lt;br /&gt;
 	com.nokia.profiled.set_value string:&amp;quot;silent&amp;quot; \&lt;br /&gt;
 	string:&amp;quot;vibrating.alert.enabled&amp;quot; string:&amp;quot;Off&amp;quot;&lt;br /&gt;
 fi&lt;br /&gt;
&lt;br /&gt;
You get the opposite behaviour (enable vibrating alert) simply by replacing &amp;quot;Off&amp;quot; two times by &amp;quot;On&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
===Lock (secure) the device===&lt;br /&gt;
&lt;br /&gt;
 dbus-send --system --type=method_call --dest=com.nokia.system_ui /com/nokia/system_ui/request com.nokia.system_ui.request.devlock_open string:&amp;quot;com.nokia.mce&amp;quot; string:&amp;quot;/com/nokia/mce/request&amp;quot; string:&amp;quot;com.nokia.mce.request&amp;quot; string:&amp;quot;devlock_callback&amp;quot; uint32:'3' | echo &amp;quot;&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Update e-mail===&lt;br /&gt;
&lt;br /&gt;
 sh /path/to/script/email.sh | echo &amp;quot;&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''email.sh script:'''&lt;br /&gt;
&lt;br /&gt;
The script connects to the internet and refreshes e-mail. Keep in mind that Modest e-mail client which N900 uses is very slow in this aspect and send and recive can take up to minute and a half. Make it executable.&lt;br /&gt;
&lt;br /&gt;
 #!/bin/sh&lt;br /&gt;
 run-standalone.sh dbus-send --type=method_call --dest=org.freedesktop.Notifications /org/freedesktop/Notifications org.freedesktop.Notifications.SystemNoteInfoprint string:&amp;quot;Updating e-mail...&amp;quot;&lt;br /&gt;
 run-standalone.sh dbus-send --system --type=method_call --dest=com.nokia.icd /com/nokia/icd com.nokia.icd.connect string:&amp;quot;[ANY]&amp;quot; uint32:0&lt;br /&gt;
 sleep 10&lt;br /&gt;
 run-standalone.sh dbus-send --type=method_call --dest=com.nokia.modest /com/nokia/modest com.nokia.modest.SendReceive&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Set maximum CPU frequency===&lt;br /&gt;
&lt;br /&gt;
 echo &amp;quot;echo 600000 &amp;gt; /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq&amp;quot; | sudo gainroot | echo &amp;quot;&amp;quot;&lt;br /&gt;
&lt;br /&gt;
Replace 600000 with desired maximum frequency. This is usable with the new overclocking kernels if you wish to manually change the maximum frequency to which processor can scale. Pay attention to the two exceptions in titan's kernels (124999 and 599000). The list of available frequencies on your device/kernel can be obtained with command:&lt;br /&gt;
&lt;br /&gt;
 awk '{print $1/1000&amp;quot; MHz&amp;quot;}' /sys/devices/system/cpu/cpu0/cpufreq/stats/time_in_state&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Reboot===&lt;br /&gt;
&lt;br /&gt;
 echo &amp;quot;reboot&amp;quot; | sudo gainroot | echo &amp;quot;&amp;quot;&lt;br /&gt;
&lt;br /&gt;
Warning: Consult forums before you try this, because currently DCEW executes some (all?) commands at startup. This will be optional in next version. Making a reboot button on current DCEW version could result in endless reboot loop.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===FM transmitter===&lt;br /&gt;
&lt;br /&gt;
====Enable/disable====&lt;br /&gt;
&lt;br /&gt;
 /usr/bin/fmtx_client -p$(if [ $(cut -d. -f1 /proc/uptime ) -lt 100 ]; then echo 0; else /usr/bin/fmtx_client | /bin/grep -q '^state=enabled' ; echo $? ; fi) | /usr/bin/awk -F &amp;quot;=&amp;quot; '($1==&amp;quot;state&amp;quot;) {print $2}'&lt;br /&gt;
&lt;br /&gt;
Note: when you reboot the device, this script waits 100 seconds before you can turn the transmitter on/off again.&lt;br /&gt;
&lt;br /&gt;
====Increase power====&lt;br /&gt;
&lt;br /&gt;
 echo &amp;quot;echo 118 &amp;gt; /sys/class/i2c-adapter/i2c-2/2-0063/power_level&amp;quot; | sudo gainroot | echo &amp;quot;&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===DBUS call to start browser===&lt;br /&gt;
&lt;br /&gt;
 /usr/bin/browser_dbuscmd.sh load_url http://www.bbc.co.uk/iplayer/console/bbc_radio_fourfm&lt;br /&gt;
[[Category:Software]]&lt;br /&gt;
[[Category:Power users]]&lt;br /&gt;
&lt;br /&gt;
===Display a Conboy Note===&lt;br /&gt;
 python /home/user/conboy_note_to_text.py print noteid&lt;br /&gt;
&lt;br /&gt;
'''conboy_note_to_text.py'''&lt;br /&gt;
Make sure to make this python script executable (chmod 755 /path/to/conboy_note_to_text.py). To list all notes with their title and id in xterm, just use the following commands: python /home/user/conboy_note_to_text.py list&lt;br /&gt;
&lt;br /&gt;
Source : http://khertan.net/articles/maemo/conboy_note_to_text&lt;br /&gt;
&lt;br /&gt;
Direct Script Link : http://khertan.net/_export/code/articles/maemo/conboy_note_to_text?codeblock=0&lt;br /&gt;
&lt;br /&gt;
 #!/usr/lib/python2.5&lt;br /&gt;
 &lt;br /&gt;
 from xml.dom import minidom&lt;br /&gt;
 import os.path&lt;br /&gt;
 import glob&lt;br /&gt;
 import sys&lt;br /&gt;
 import re&lt;br /&gt;
 from xml.sax.handler import ContentHandler&lt;br /&gt;
 import xml.sax&lt;br /&gt;
 &lt;br /&gt;
 class NoteList:&lt;br /&gt;
    def __init__(self,path):&lt;br /&gt;
        self.path = path&lt;br /&gt;
        self.noteList = {}&lt;br /&gt;
        for infile in glob.glob( os.path.join(self.path, '*.note') ):&lt;br /&gt;
          note = Reader(os.path.basename(infile)[:-5])&lt;br /&gt;
          if note.title != None:&lt;br /&gt;
              self.noteList[note.title]=note.note_id&lt;br /&gt;
 &lt;br /&gt;
    def get_note_id_by_title(self,title):&lt;br /&gt;
        try:&lt;br /&gt;
            return self.noteList[title]&lt;br /&gt;
        except:&lt;br /&gt;
            return None&lt;br /&gt;
 &lt;br /&gt;
 class textHandler(ContentHandler):&lt;br /&gt;
    def __init__(self):&lt;br /&gt;
      ContentHandler.__init__(self)&lt;br /&gt;
      self.content = &amp;quot;&amp;quot;&lt;br /&gt;
      self.title = &amp;quot;&amp;quot;&lt;br /&gt;
      self.selector = None&lt;br /&gt;
 &lt;br /&gt;
    def startElement(self, element,attributes):&lt;br /&gt;
        if (element == 'note-content') and (self.selector == None):&lt;br /&gt;
            self.selector = element&lt;br /&gt;
        elif (element == 'title') and (self.selector == None):&lt;br /&gt;
            self.selector = element&lt;br /&gt;
 &lt;br /&gt;
 &lt;br /&gt;
    def endElement(self, element):&lt;br /&gt;
        if (element == self.selector):&lt;br /&gt;
            self.selector = None&lt;br /&gt;
 &lt;br /&gt;
    def characters(self, ch):&lt;br /&gt;
        if self.selector == 'note-content':&lt;br /&gt;
            self.content = self.content + unicode(ch)&lt;br /&gt;
        elif self.selector == 'title':&lt;br /&gt;
            self.title = self.title + unicode(ch)&lt;br /&gt;
 &lt;br /&gt;
 class Reader:&lt;br /&gt;
    def __init__(self,note_id):&lt;br /&gt;
        self.note_id = note_id&lt;br /&gt;
        self.content = None&lt;br /&gt;
        self.title = None&lt;br /&gt;
 &lt;br /&gt;
        try:&lt;br /&gt;
            parser = xml.sax.make_parser()&lt;br /&gt;
            handler = textHandler()&lt;br /&gt;
            parser.setContentHandler(handler)&lt;br /&gt;
              parser.parse(os.path.join(os.path.expanduser(&amp;quot;~&amp;quot;),'.conboy',self.note_id+'.note'))&lt;br /&gt;
            self.content = handler.content&lt;br /&gt;
            self.title = handler.title &lt;br /&gt;
        except StandardError,e:&lt;br /&gt;
            print e&lt;br /&gt;
 &lt;br /&gt;
 &lt;br /&gt;
 &lt;br /&gt;
 if __name__ == &amp;quot;__main__&amp;quot;:&lt;br /&gt;
    try:&lt;br /&gt;
        if (sys.argv[1]=='print'):&lt;br /&gt;
            print Reader(unicode(sys.argv[2])).content&lt;br /&gt;
        elif (sys.argv[1]=='list'):&lt;br /&gt;
            nlist = NoteList('/home/user/.conboy/').noteList&lt;br /&gt;
            for key in nlist.keys():&lt;br /&gt;
                print key, ' : ', nlist[key]&lt;br /&gt;
        elif (sys.argv[1]=='search'):&lt;br /&gt;
            nlist = NoteList('/home/user/.conboy/')&lt;br /&gt;
            print nlist.get_note_id_by_title(sys.argv[2])&lt;br /&gt;
        else:&lt;br /&gt;
            raise&lt;br /&gt;
    except StandardError,e:&lt;br /&gt;
            print &amp;quot;&amp;quot;&amp;quot;Usage : python conboy_note_reader.py option [note_id or note title]&lt;br /&gt;
            Option : &lt;br /&gt;
                - list : list all note by title with id&lt;br /&gt;
                - print : print content of note with the given id&lt;br /&gt;
                - search : print id of the given title&amp;quot;&amp;quot;&amp;quot;&lt;br /&gt;
            print e&lt;/div&gt;</description>
			<pubDate>Sat, 18 Feb 2012 19:01:42 GMT</pubDate>			<dc:creator>80.195.81.165</dc:creator>			<comments>http://bugs.maemo.com/Talk:Desktop_Command_Execution_Widget_scripts</comments>		</item>
	</channel>
</rss>