Sunday, December 11, 2011

backing up an Android device

My beloved Cheese, a Samsung Galaxy S Android phone, has lots of photos on it.  I want copies on my main Ubuntu computer.  Also Cheese is complaining about running out of room, even though I'm down to 130 apps -- I want to examine the phone and delete hidden files taking up precious space.  To do all this I'm installing a file server on the phone, then editing and copying things at my leisure from the main computer vs using the fiddly little phone screen.

1. Install Software Data Cable on Android.  This is an FTP server for your phone, so you can easily see  files on the phone and copy to/from your computers.
Another choice is the excellent ASTRO File Manager, which has a SMB (Windows network file system) module.

2.Start Software Data Cable.  Press "Start Service"

3. In Ubuntu, open the URL given in step #2, like ftp://192.168.11.148:8888/  If all is well you'll see a listing of Android application folders, like "camera360".

4. To sync files, drag and drop using the above file manager, Nautilus.  Or use "wget" which understands FTP. The following says "make a copy on my PC of all JPG images stored on the SD card on the phone. Keep all directories the same."


wget --mirror -nv --accept jpg ftp://192.168.11.148:8888/ .

If things don't look right try the above command and leave off "-nv" to make things more verbose.

Note that the above only gives you access to the "external SD card" parts of the Android phone.  The other, "internal" flash are generally hidden.  To access this area anyway you can enable it in Data Cable's settings area -- but this is sketchy and not recommended.



Monday, October 24, 2011

Linux is awsome

At work we process many millions of emails a day, so we get a lot of bounces. The following code helps me make the system smarter. It translates to "for the most recent five users who's received a bounce message, find all of their bounces in the last 24 hours and show me the Subject lines, with user and date information."

find `ls -1t | head -5` -type f -mtime -1 -print0 | xargs -0 egrep Subject /dev/null | less

Wednesday, October 19, 2011

Webex with Ubuntu Oneiric Ocelot

Read elsewhere how to install all the needed dependencies. Here's a magic bit:

sudo add-apt-repository "deb http://archive.canonical.com/ natty partner"
sudo apt-get update
sudo apt-get install sun-java6-plugin

A final trick: I use Firefox for work stuff, and Chrome for personal tasks -- thus I don't have to deal with multiple profiles, nor does sketchiness in one browser affect the other.

Friday, September 30, 2011

I love Python (espeak speech synthesizer demo)

#!/usr/bin/env python

'''
espeak.py -- demo each of the English espeak voices
'''

import os, re, time
from itertools import ifilter, imap

# Pty Language Age/Gender VoiceName File Other Langs
# 5 en M default default

pat = re.compile('\s* \d+ \s+ (en\S*) \s+ \S \s+ (\S+)',re.VERBOSE)
for m in ifilter(None, imap(pat.match, os.popen('espeak --voices=en'))):
lang,voice = m.groups()
if '-' in lang:
continue
print voice
os.system('espeak -v {0} "{0}... beer is good food" 2>/dev/null >/dev/null'.format(
voice))
time.sleep(3)




https://github.com/shavenwarthog/setup/blob/master/misc/espeak.py