Wednesday, February 3, 2010

How are you contributing to the community?

Me? Producing the next geek programmers of tomorrow (lol)...

 
(that's my kid, 1 y.o.)

Handy actions on your right click menu: RAR extract

I already wrote about the nautilus-actions embedding application into the nautilus at Customizing the Right Click Menu, with the features of providing right click actions to whatever you want to do (in my example, how to convert multiverse files).

I've come across situations where I see myself doing the same actions over and over again, repetitively. If you are working on the terminal, it is fine just to type manually everything (it keeps you sharp, ya know!), but if you are on the desktop, trying to relax and watch a movie or listen to music, it is unlikely that you will open the terminal to execute certain commands...

One good example is the "extract" from archive feature. The truth is that the visual box (as below) is not accurate on the progress indicator, neither you have any other details of what's going on (is it stuck or what?).


So, I usually prefer the command-line because it simply gives me a better visual of what is going on:


Since I kind of do that all the time (yeah, I am a TV-Movie freak), I wrote a simple script to save my day. You can find the source code here.

Basically, I added the script call to nautilus-action-configuration window, and the output is something like:




The script is currently handling only RAR (maybe I will add more in future), but it process a single RAR, or a compressed content in volumes, or an entire directory in batch... later, deleting everything (send to trash only, just in case something goes weird).

Feedback and comments on it are very welcome: linscripts > nautilus-actions > ext-rar-clean.sh.

Tuesday, January 12, 2010

Disabling lock on Suspend

(for laptop users)

Just read about it at: Disabling Password When Waking a Laptop

For many it may be considered a security risk, blah, blah, but I still vote for commodity.

This one goes to my linscripts:

# execute these commands from terminal
gconftool -s -t bool /apps/gnome-power-manager/lock/hibernate false
gconftool -s -t bool /apps/gnome-power-manager/lock/suspend false
# Done! :-)

Sunday, January 10, 2010

StdError Description in scripts

I never actually went that deep into the C code to understand the stderror codes that are returned in common bash scripts.

Recently, on a discussion thread from CoreUtils group, a simple implementation of error code translation caught my attention. Instead of relying on the errno.h file (which contains the list of errors with their respective brief description), you can incorporate secondary scripts (Perl, or Python) to do this job for you.

Thanks to Pádraig Brady for this:

$ test || python -c "import os; print $?, os.strerror($?);"
(you could just wrap this in a function).

Monday, December 14, 2009

Mount the iPhone on Ubuntu

I had some experience with the iPhone jailbreaking, and liked it very much. To be able to detain complete control of your mobile is very nice (from SSH mostly, you can just do anything you want). The latest 3.1.2 firmware did not come out right just yet, and I am having problems (already spent long nights trying to solve it) with my SSH connection.

Meanwhile, I really needed an alternative to access my phone the way I want. Then I got to know the libiphone, a package prepared to mount your iPhone on linux (it should be possible, since you connect the device through USB and such). Actually, the iFuse is a ready-to-go package that you just install and start using.

I went through the compiling it from the source, but it is too much trouble. Just follow the DEB packages example (to add their address to the repository list), and use simple apt-get, that will give same result.

I will leave here a beginner version of the installation procedure (as explained in the main page of iFuse):

# to get your ubuntu release codename
codename=`cat /etc/lsb-release | grep CODENAME | awk ' BEGIN { FS="=" }; { print $2 }'`

# place the iFuse repository urls
echo -e "
# For iFuse (manually added at `date +'%Y/%m/%d %H:%M:%S'` by $USER)
deb http://ppa.launchpad.net/jonabeck/ppa/ubuntu $codename main
deb-src http://ppa.launchpad.net/jonabeck/ppa/ubuntu $codename main" >> \
/etc/apt/sources.list

# register iFuse key
sudo apt-key adv --recv-keys --keyserver keyserver.ubuntu.com F0876AC9

# install the application
sudo apt-get install ifuse 

Once the application is installed (this took me a while to figure out, since most help available, here, talk about a mount.fuse.ifuse that does not come with the ifuse packages by default).

# to mount the iPhone (does not require jailbreak)
ifuse /path/to/mount/point/

# to unmount the iPhone
fusermount -u /path/to/mount/point/

# where the /path/to/mount/point/ is anything you want.
# Following a standard in Ubuntu, I suggest creating a directory at:
# /media/iPhone/ (also advised by the iFuse help page).

The only problem is that this action only mounts the current logged in user on the iPhone, the [mobile] user, which means that you will have access to everything it has, but nothing else beyond that.

To mount the root path (and have total control of the phone), you need to:

# to mount the iPhone (requires jailbreak)
ifuse /path/to/mount/point/ --root

Note: This did not work for me on 3.1.2 version... :(
The screenshot of what the attempt does with my iPhone directory... (weird)