Airgap file-system

So I needed to create a file-system to house a handful of archive/backup tarballs (around 40 of them). I created an ext4 file-system with 100 inodes, like this:

# mkfs.ext4 -b 4096 -L airgap -m 0 -N 100 -v /dev/sdc1

Note: 100 inodes isn’t very many! Only supports up to 100 files/folders. Also note that 0% space is reserved for root. If you’re copying the above command make sure you replace /dev/sdc1 with an appropriate partition device.

Disable middle mouse button (paste) on Debian KDE

Every now and again I will accidentally click the middle mouse button when I go to grab my mouse, and KDE will dump my clipboard buffer into a BASH shell. Not good. Could run something damaging if I’m unlucky. So see here for the solution. Basically run this to get the mouse device ID:

xinput list | grep 'id='

Then to edit e.g. device 10 to disable middle mouse button:

xinput set-button-map 10 1 0 3

To persist the changes add the set-button-map command to e.g. ~/.xstartup.

Or you can add a pointer configuration to ~/.Xmodmap like this:

pointer = 1 0 3 4 5 6 7 8 9 10

And make sure xmodmap is applied at start-up with an autostart file like e.g. ~/.config/autostart/mouse-config.desktop:

[Desktop Entry]
Type=Application
Name=mouse-config
Comment=Disables middle mouse button.
Exec=xmodmap /home/jj5/.Xmodmap

Disabling F6 ‘Run Main Project’ hot key in NetBeans because of G15 keyboard

I have a G15 keyboard, and I love it (but not as much as the old model!), but it occasionally causes a problem for me when I’m programming in NetBeans on Debian GNU/Linux.

The issue is that on a newer G15 the G6 key is right near the Ctrl key, and from time to time my pinky hits the G6 key which seems to be by default programmed to be the F6 key.

By default in NetBeans the F6 key is the ‘Run Main Project’ hot key, so when I accidentally press it, it fires up a Firefox window and tries to run my web app! I never configure my web apps in NetBeans, but even if I did, I don’t want to accidentally run anything due to an accidental key press.

So my solution was to disable F6 in NetBeans, and for that:

Tools -> Options -> Keymap -> Click ‘Search in Shortcuts’ -> Press F6 -> Click on the ‘…’ in the Shortcut cell for ‘Run Main Project’ (should be F6) -> Clear -> Apply -> And you’re done!

Everything is easy when you know how!

Adding ‘Attach to Icedove’ desktop/dolphin menu item on Debian Jessie

On Debian Jessie (testing) the default ‘Send as Email Attachment’ context menu item uses KMail, and only KMail, even if you’ve configured your desktop to use Icedove (Thunderbird) as your default mail client.

So you can remove the broken ‘Send as Email Attachment’ from Dolphin by opening Dolphin then:

Settings -> Configure Dolphin… -> Services -> uncheck ‘Send as Email Attachment’

Then to create a replacement feature that uses Icedove edit:

~/.kde/share/kd4/share/icedove_attachment.desktop

And enter:

[Desktop Entry]
Type=Service
Actions=attachToEmail
Encoding=UTF-8
ServiceTypes=KonqPopupMenu/Plugin,all/allfiles
ExcludeServiceTypes=application/x-iso,kdedevice/*,inode/directory

[Desktop Action attachToEmail]
Exec=icedove -compose "attachment='$(echo %F | sed 's/\\ \\//,\\/\\//g')'"

Name=Attach to Icedove
Name[it]=Invia E-mail con Icedove
Name[es]=Enviar adjunto con Icedove
Name[de]=Als Anhang mit Icedove verschicken
Name[pt]=Anexar ao Icedove E-mail
Name[pt_BR]=Enviar arquivo(s) como anexo(s)
Name[fr]=Envoyer avec Icedove
Name[nl]=Voeg toe als bijlage aan Icedove
Name[pl]=Wyślij jako załącznik Icedove
Name[ru]=Отправить с помощью Icedove
Name[cz]=Odeslat jako přílohu Icedove

Icon=/usr/lib/icedove/chrome/icons/default/default16.png

And make sure your .desktop file is executable:

 $ chmod +x ~/.kde/share/kd4/share/icedove_attachment.desktop

Mounting Windows SMB share from Debian Wheezy

Configuring an SMB mount from my Linux box to my Windows box. This was helpful.

Basically:

# apt-get install cifs-utils

Then create your credentials file:

# cat > /root/amanda.smbpass  <<EOF
username=jj5
password=SECRET
EOF

Then edit /etc/fstab and add:

//amanda.jj5.net/Users  /media/amanda cifs defaults,noauto,credentials=/root/amanda.smbpass 0 2

Then create /etc/network/if-up.d/mount-amanda like this:

#!/bin/bash
mount /media/amanda

And make sure it’s executable:

# chmod +x /etc/network/if-up.d/mount-amanda

Mounting can also be done from the command-line:

# mount -t cifs -o username=jj5,password=SECRET //amanda.jj5.net/Users /media/amanda