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)
 
Copyright 2009 Another Blog. Powered by Blogger Blogger Templates create by Deluxe Templates. WP by Masterplan