Getting <ctrl>-<tab> to work in gnome-terminal

If you are used to using <ctrl>-<tab> and <ctrl>-<shift>-<tab> in firefox, chrome, etc, and want to have the same in gnome terminal, its a little tricky, but these commands should get things setup so that it works for you.

 

gsettings set org.gnome.Terminal.Legacy.Keybindings:/org/gnome/terminal/legacy/keybindings/ prev-tab '<Primary><Shift>Tab'

gsettings set org.gnome.Terminal.Legacy.Keybindings:/org/gnome/terminal/legacy/keybindings/ next-tab '<Primary>Tab'

 

 

Enabling <alt>-<space> in Ubuntu for Ulauncher

If you are wanting to use <alt>-<space> as the key for the excellent Ulauncher with Ubuntu, there are a couple of tweaks that you need to do:

1. Ensure that CompizConfig Settings Manager is installed:

apt-get install compizconfig-settings-manager

2. Start the CompizConfig Settings Manager

Go to General, General options, Key bindings and disable Window Menu which is assigned <alt>-<space> by default.

Ubuntu - Large external USB drive slow to unmount, eject or sync

When using a USB HDD (probably a stick as well), there can be large delays when using a Ubuntu machine while waiting for data to be synced to the disk. After much googling, trying different filesystems and tweaking mount options, the solution that worked was:

echo $((16*1024*1024)) > /proc/sys/vm/dirty_background_bytes
echo $((48*1024*1024)) > /proc/sys/vm/dirty_bytes

Which i found here: http://unix.stackexchange.com/questions/107703/why-is-my-pc-freezing-while-im-copying-a-file-to-a-pendrive/107722#107722 http://lwn.net/Articles/572911/

 

Find all email that a user sent via postfix mail.log

I needed to find all the email that a user sent with only the postfix mail.log. This simple script does that. There is probably an easier way :-)

#!/bin/bash USERNAME=$1 for i in `grep -A2 $USERNAME mail.log | \
grep message-id | cut -d'<' -f2 | cut -d'>' -f1`; \
do grep "$i" /var/log/mail.log | grep "to=" | awk '{ print $7 }' | \
cut -d'<' -f2 | cut -d'>' -f1; done | sort | uniq -c

 

A low resource usage Pandora player - Pianobar
Pandora has become my go to choice of music player some time ago, but having a browser window open just to play music strikes me as we little crazy. Pithos is one alternative and does a reasonable job, but I was looking for something lighter and I found it with Pianobar. Theres a bunch of features, it works a treat, and is very lightweight compared to Pithos. Give it a try, maybe you'll prefer a non-gui too.
Simon Lindsay

DOMDocument, DOMXPath and invalid html

I've been doing some work with DOMDocument and DOMXPath to parse webpages recently, and even though I could get the XPath directly from Firefox or Chrome, it would not match in the $xpath->query(); What I found is that the $dom->LoadHTML($page); will handle invalid HTML, but mostly just by stripping it out. This is fine, unless you depend on the structure for the XPath query. The problem was the the page contained tables (we've all built them, missing the TBODY tags).

Ubuntu winbind not working?

Have you been trying to get winbind working on Ubuntu, and not having any luck? After the usual:

 

sudo apt-get install winbind

 

You also need to install libnss-winbind as well:

 

sudo apt-get install libnss-winbind

 

That should get it working, when combined with the change of the hosts: line in /etc/nsswitch.conf from:

 

hosts: files dns

 

to

 

hosts: files dns wins

 

And presto, it should start working.

Fathers day

My two fantastic daughters Jess and Cass bought me this awesome Star Wars onesie for Fathers day. Unfortunately my lightsabre did not come when I used The Force to call it, so is not in the picture.

Simon Lindsay