Wednesday, 26 September 2007

Sending files in Gnome via bluetooth

Gnome's bluetooth support is still a "work in progress"! To send files via bluetooth, you may or may not have a menu option. If not, heres a quick script to drop in your nautilus-scripts folder.
#!/bin/sh

TMPFILE=`/bin/mktemp`

hcitool scan | grep -v Scanning > ${TMPFILE}
if [ $? -eq 1 ]; then
zenity --error --text="Couldn't scan for devices"
rm ${TMPFILE}
exit
fi

zenity --list --text="Choose a recipient" --column Address --column Name `cat ${TMPFILE}` > ${TMPFILE}

DEST=`cat ${TMPFILE}`

if [ -z ${DEST} ]; then
zenity --error --text="No recipient selected"
rm ${TMPFILE}
exit
fi

for i in $NAUTILUS_SCRIPT_SELECTED_FILE_PATHS; do
gnome-obex-send -d `cat ${TMPFILE}` "$i"
done

rm ${TMPFILE}

  • Make this directory, if it doesn't exist:
    mkdir -p ~/.gnome2/nautilus-scripts
  • Save the text above into a file "~/.gnome2/nautilus-scripts/send-via-bluetooth"
  • make it executable:
    chmod u+x ~/.gnome2/nautilus-scripts/send-via-bluetooth
  • Now right-click on any file (or group of files) in nautilus, and you should see a scripts> option. Under scripts, select "send-via-bluetooth"
Notes:
  • You will need hcitool (part of bluez-utils)
  • You need zenity (a gnome package)
  • When sending lots of files, the "Sending" dialog keeps popping up under your mouse. Not ideal!
Feel free to email me if you have any questions or improvements.

Wednesday, 5 September 2007

Nigerian scam - with a difference!

I get the odd hundred or so Nigerian scam emails per second, just like the next guy. Usually I just delete them, but this one warranted further inspection.

Major kudos to the guy/gal who did this - I presume they hacked the scammer's mass email system, and changed the text ever so slightly! Here is the source of the email, with some info replaced with ****'s once it hit our office mail server:

Return-Path:
Received: from murder ([unix socket]) by **** (Cyrus v2.2.12)
with LMTPA; Fri, 31 Aug 2007 09:56:22 +0930
X-Sieve: CMU Sieve 2.2
Received: from localhost (localhost.**** [127.0.0.1]) by
**** (Postfix) with ESMTP id BBE9917DDA; Fri, 31 Aug 2007
09:56:22 +0930 (CST)
X-Virus-Scanned: amavisd-new at ****
Received: from **** ([127.0.0.1]) by localhost ****
[127.0.0.1]) (amavisd-new, port 10024) with ESMTP id ykTz5O+R-RhE; Fri, 31
Aug 2007 09:56:06 +0930 (CST)
Received: from yovole.com (unknown [61.152.239.66]) by ****
(Postfix) with ESMTP id A908817CEB for ; Fri, 31 Aug
2007 09:56:04 +0930 (CST)
Received: from yovole.com (localhost.localdomain [127.0.0.1]) by yovole.com
(8.13.1/8.13.1) with ESMTP id l7UNNbOw012441 for ; Fri,
31 Aug 2007 07:23:37 +0800
Received: (from root@localhost) by yovole.com (8.13.1/8.13.1/Submit) id
l7UNNThk012435; Fri, 31 Aug 2007 07:23:29 +0800
Date: Fri, 31 Aug 2007 07:23:29 +0800
Message-Id: <200708302323.l7unnthk012435@yovole.com>
To: iain@****
Subject: Nigerians are retarded humans
From: Nigerian Scamer
Content-Type: text/html
X-Evolution-Source: imap://iain;auth=CRAM-MD5@mail.****/
Mime-Version: 1.0


Dont trust nigerians - Nigerians are the most idiot pice of shits in the world



I'm quite happy to get this email, if it means that this scammer has sent one less real scam. Hopefully this stopped thousands of scams, who knows? At least it made me laugh :D

Monday, 3 September 2007

emacs 22

I just made the switch from emacs 21 to 22. So far, it seems much the same to the average user (me!)

I decided to write down a few settings for those finding it hard to get used to - you may or may not like them all, so change these settings as you feel like it.

You can add all of these to your .emacs file to have them automatically used.
  1. highlight or fontify according to the syntax of the text you are editing
    (global-font-lock-mode t)
  2. get rid of the toolbar
    (setq tool-bar-mode)
  3. Show the column number
    (setq column-number-mode t)
  4. highlight matching parenthesis when the cursor is placed on one
    (require 'paren)
    (show-paren-mode 1)
  5. when you paste / insert text over a selection, delete the selection first (otherwise you end up with the selection _and_ the pasted text)
    (delete-selection-mode t)
  6. auto-wrapping options. This binds the key sequenct C-x w to turn on "auto wrapping". It nicely understands comments, and automatically keeps them intact.
    (setq fill-column 80)
    (setq default-fill-column 80)
    (global-set-key "\C-xw" 'auto-fill-mode)
  7. main window geometry
    (setq default-frame-alist
    '((height . 74)
    (width . 120)
    ))
  8. Bind goto-line to 'C-x g' (I use this key sequence a lot!)
    (global-set-key "\C-xg" 'goto-line)
  9. this sets the amount of time to wait between each automatic scroll, when you select something and move the mouse out of the window. Unfortunately, it is ignored if you "shake" the mouse...
    (setq mouse-scroll-delay 0.25)
  10. this is too agressive, so turn it off. It's a nice idea, but it manages to scroll through a 4000 line file in just a few scrolls, and I have to move the mouse very slowly to get normal behaviour.
    (setq mouse-wheel-progressive-speed nil)
  11. Some general editing settings - set default indent level to 3, and no tabs! Useful if you like to stick to a particular style. Tabs are evil, because everybody uses a different tab width, making a nicely formatted text file on your system look unaligned on another system.
    (setq standard-indent 3)
    (setq c-indent-level 3)
    (setq c-basic-offset 3)
    (setq perl-indent-level 3)
    (setq tcl-indent-level 3)
    (setq pascal-case-indent 3)
    (setq comment-column 40)
    (setq sh-indentation 3)
    (setq tcl-indent-level 3)
    (setq c-indent-comments-syntactically-p t)
    (setq c-default-style "ellemtel")
    (setq-default indent-tabs-mode nil)
    (setq-default tab-width 3)
  12. show column numbers
    '(column-number-mode t)
  13. Use the control-c style cut, copy and paste commands (cua mode)
    '(cua-mode t nil (cua-base))

    Note that the superior rectangle support of cua mode has changed from shift-enter to control-enter (ie. C-enter)

Wednesday, 18 July 2007

Wild life!

I just watched the coolest amateur wildlife video I've ever seen. A pride of lionesses attack a buffalo baby, only to have a crocodile attempt to steal it from them. Then along comes the rest of the buffalo herd and starts attacking the lionesses! You have to see it to believe it. Even the guide can be heard saying "I've never seen anything like this" over and over.

Watch it here

Also, here's another version with a voice-over from the lions point of view. Funny!

Wednesday, 11 July 2007

Flexible working hours

I just received an email from "management" (to all staff), the first paragraph reads:

All leave is to be approved by your department manager and/or myself. This includes taking the morning off, ducking out for the afternoon, taking and extended lunch break or adjusting your working hours.


This is a divergence from our previous "agreement" where we could be flexible, within reason, so long as we completed our 40 hour week. (Which is quite easy, given everyone generally works - and is even expected to work - a few hours more per week).

Of course, I don't agree, and in my usual fashion, I am composing a reply stating as much. However, I'm giving this one a "count to 10" before I reply.

The point of this post is to see if our "flexible agreement" is one of the last, or if there are still many workplaces operating successfully this way. I understand this gets harder to manage as a company grows, but we have an efficient time sheet system, so I don't see the reason (nor was one given) for this email.

I personally think it's an affront to the effort we've shown in the last few months - given lay-offs and cutbacks, everyone has been working hard to try and keep the company profitable, and yet random emails like this come through from time to time.

I leave you with an excerpt from "The Tao of Programming":

A manager went to his programmers and told them: "As regards to your work hours: you are going to have to come in at nine in the morning and leave at five in the afternoon." At this, all of them became angry and several resigned on the spot.

So the manager said: "All right, in that case you may set your own working hours, as long as you finish your projects on schedule." The programmers, now satisfied, began to come in at noon and work to the wee hours of the morning.

-- Geoffrey James, "The Tao of Programming"
 
Copyright 2009 Another Blog. Powered by Blogger Blogger Templates create by Deluxe Templates. WP by Masterplan