My Favourite Utilities
Spinrite is a disk maintenance and repair utility. Originally created to deal with spinning disks in mind, it has also been discovered to work on SSDs.
Remote Utilities is a remote access/maintenance utility.
A Bit of Plumbing
So the bathroom tap was dripping. In fact it was more like a little stream.
I am not a plumber.
I checked online for some help changing a washer, but couldn’t find my tap. This what it looks like.
The main problem was getting the top off. With most taps, there is a little plastic cap or lid that should be prised off, revealing a screw which holds the top on. Not in this case.
The top part lifts off. This sounds easy, but I had to use a plumbing tool that apply some leverage. Let me just repeat that: The top lifts off and there is no screw to undo.
Here is a picture of the tool I used.
The rest is easier. Undo the base to reveal the washer. I needed a 3/8 inch washer. There is general information about changing a dripping tap. See, for example, this video http://www.youtube.com/watch?v=SR6vnfNLr-8.
Google Drive serves up Web Pages
I was listening to the This Week in Google podcast the other day. They talked about the possibility of serving up a static website from a Google Drive folder.
So I looked up the LifeHacker article but I needed a look at the Google Apps Developer Blog for the details. I got confused and started thinking I would need to use an API to set up the website from a folder.
But looking at the URLs, I guessed that when you share the folder with the web pages and make it public, the hash value taken from the shared url for the folder can be used to create a web url.
More Details
So some detail. First create a folder in your Google Drive that will hold your html files, images javascript etc. Make sure you create an index.html which is the entry point.
Share the folder, using the “Public on the web” option. The link share looks something like this:
https://drive.google.com/folderview?id=0B0dQc5h3FWiTcVo3bjlqSGdEeVk&usp=sharing
Looking back the Google Developer Blog, when I changed the URL to the format
https://googledrive.com/host/0B0dQc5h3FWiTcVo3bjlqSGdEeVk
I got a website :).
Backing up those gmail messages in All Mail
I recently read an article on wired.com that mentions in passing backing up all of that information you have lurking in the cloud, like emails.
It got me thinking about a perl script I had for grabbing IMAP data. The basic idea is that the module allows for fetch, delete, copy on IMAP-based email. This allows you, for instance, to grab all of the emails lurking in Gmail’s “All Mail” folder. You know – the place where emails go when you say “archive this one, I don’t want to see it no more.” With the advent of the “Priority Inbox”, using the archive feature, especially with keyboard shortcuts, makes reducing the size of your inbox a much more realizable task.
Anyway, perl has this module, Net::IMAP::Simple::SSL that lets you access IMAP from perl. Here is a simple script to show how it can do it’s thing. Script comes with no warranty, etc.
Don’t forget to put your username and password into the script at the top. See $username and $password.
#!/usr/bin/perl
#
# example-imap-ssl.pl
#
# Get mail from google via imap, and dump it to console.
#
use strict;
use Net::IMAP::Simple::SSL;
use Getopt::Long;
my $host = "imap.googlemail.com";
my $username = '<insert your google username>';
my $password = '<insert your google password>';
my $boxes = 0;
my $brief = 0;
my $dump = 0;
my $help = 0;
my $verbose = 0;
my $mailbox = "%";
my $remove = 0;
my $regexp = "";
#----------------------------------------
# process any command line arguments
my $result = GetOptions('help|?+' => $help,
'brief|b+' => $brief,
"dump+" => $dump,
'dump-folders+' => $boxes,
"host|h=s" => $host,
'mailbox|m=s' => $mailbox,
"password|p=s" => $password,
"regexp=s" => $regexp,
"user|u=s" => $username,
"verbose|v+" => $verbose
);
print "IMAPS client: $username@$hostn" if ($verbose || !$dump);
if ($help) {
print "
--brief, -b synopsis of every message (to,from,subject)
--dump dump the mailbox selected
--dump-folders dump all folders contained in selected mailbox
--host, -h set the imap server contacted to be
--mailbox, -m set the set of folder(s) to consider
--password, -p the password to use
--regexp display messages matching regex
--user, -u the username to use
";
exit 0;
}
my $imap;
if ($verbose > 1) {
print "Connect to $hostn";
$imap = Net::IMAP::Simple::SSL->new($host, Debug=>1, use_ssl=>1);
}
else {
$imap = Net::IMAP::Simple::SSL->new($host, use_ssl=>1);
}
$imap->login($username, $password);
if ($boxes) {
print "Enumerating folders for '$mailbox':n";
my @folders = $imap->mailboxes($mailbox);
for my $f (@folders) {
print " '$f'";
}
print "ne='", $imap->errstr(), "'n";
$imap->quit();
exit(0);
}
if ($dump) {
my @folders = $imap->mailboxes($mailbox);
for my $f (@folders) {
my $msg_count = $imap->select($f);
for (my $i=0; $i < $msg_count; $i++) {
my $msg = $imap->get($i);
if (!defined($msg)) {
print " undefn";
}
else {
for my $m (@{$msg}) {
print "$m";
}
}
} #for (my $i...
} #for @folders
}
else {
my @folders = $imap->mailboxes($mailbox);
for my $f (@folders) {
my $spam = 0;
my $type = " ";
my $msg_count = $imap->select($f);
if ($f =~ /.*spam.*/i) {
$type = "S";
$spam = 1;
}
printf "%4i messages in $f ($type)n", $msg_count;
for (my $i=0; $i < $msg_count; $i++) {
my $matched = 0;
if ($verbose > 1 || $brief || length($regexp)) {
#print "$i $type" if ($verbose > 1);
my $msg = $imap->get($i);
if (!defined($msg)) {
print " undefn";
}
else {
if ($brief) {
my ($sub, $from, $to, $date) = "";
for my $m (@{$msg}) {
$sub = $m if ($m =~ /^Subject/);
$from = $m if ($m =~ /^From/);
$to = $m if ($m =~ /^To/);
$date = $m if ($m =~ /^Date/);
}
print "$from $to $date [$sub] n";
}
elsif (length($regexp)) {
#print "regexp: searchn" if ($verbose);
for my $m (@{$msg}) {
if ($m =~ /$regexp/) {
$matched = 1;
if ($verbose > 0) {
for my $n (@{$msg}) {
print $n;
}
}
else {
print $m;
}
}
}
}
elsif ($verbose > 1) {
for my $m (@{$msg}) {
print "$m";
}
}
}
}
}
}
}
$imap->quit();
The new thing I struggled with was the name of the folder where archived emails live. It is
[Google Mail]/All Mail
But spaces are bad in all kinds of place names, and here is another. There is a wildcard character available ‘%’ and replacing spaces with ‘%’ works fine. So with the name
[Google%Mail]/All%Mail
all of your mail can be downloaded in one go. When researching this, I also found references to [Gmail] as a the IMAP folder name. YMMV. List the IMAP folders if you get stuck.
In the same way, sent emails can be downloaded from “[Google Mail]/Sent Items”.
Note that the format of the downloaded emails isn’t pretty. There is just one great file with all of them concatenated together. But this is a quick and simple backup. And grep is your friend, too.
I use the perl above like this:
./example-imap-ssl.pl --user me --password my_passwd -m '[Google%Mail]/All%Mail' --dump > 2011-01-31.all-mail.backup
bzip2 2011-01-31.all-mail.backup
Further information
Turning on imap in gmail.
Turning on ssl in gmail (if you haven’t done this, you really should).
Linux bluetooth audio: using alsa and a2dp
I got a pair of bluetooth headphones for Christmas, and they have made listening to music so much easier. The model is Zoom 4380. I used them with my phone, and the absence of wires from the phone (and the little drop-down speaker stalk) makes calling cool too.
The only problem I have atm is resuming music from the headphones, once it has stopped.
Anyway, the purpose of this thing here is using these headphones with Gentoo. In the end, the setup seemed easy. The journey wasn’t…
Read more Linux bluetooth audio: using alsa and a2dp
c902 and linux
A little while ago, I received a shiny new c902, and looked forward to loading it with mp3s…
I plugged it in, selected anything, but no joy. Hunting for a while led me to libmtp. I tried ubuntu Intrepid Ibex, and managed to download photos, but still no music.
Let me cut to the chase – I found that libmtp 0.3.5 and gphotofs do the business. I can see the phone storage, and the memory card. Normal operations work fine; I have filed up my memory card now.
Find gphotofs here: http://sourceforge.net/projects/gphoto/files/.
Mackeral sky
Unusual for me, but I quite liked this cloud effect.
Recent Comments