Wireless mouse battery status
calendar June 9, 2016   category  scripting , gnome-shell   comments 

I have a trackball by Logitech and it's super awesome. Well, almost. The previous incarnation was a Logitech Trackman Wheel which used a cord and was my preferred pointing device. It never suffered from the "oops my battery is dead and now I have to replace it" problem, it felt great and Just Works.

Until, one day, it didn't anymore :(

I tried everything, even opened up the device and tried to find the issue. Couldn't find it so I set to find a replacement. I quickly discovered that my beloved trackball was no longer sold and was ...

Continue reading ..

Quickly analyze (apache) access logfiles
calendar Dec. 27, 2015   category  scripting , python   comments 

There are many great tools to analyze your webserver's access logfiles. AWstats is one I am very fond of as it creates all kinds of nice graphs and shows a lot of information about the visitors of your website(s). Google analytics is a very popular tool as well.

But sometimes you just want to know what URI is requested a lot, and which IP has accessed your site the most. Perhaps because you suddenly experienced a burst in traffic and want to find out the cause. For this, I've created a simple python script, which can be ...

Continue reading ..

Stop touching my laptop!
calendar Dec. 24, 2015   category  bash , scripting , gnome-shell   comments 

Co-workers who think they're funny/smart, because you've accidently left your screen unlocked, and altering your background, sending out mails and generally being an ass. We all know them. In the GNOME2 days there was the 'free the fish' joke, which was quite harmless. Nowadays GNOME3 doesn't have that anymore and people start causing havoc to 'teach' you to lock your screen.

Don't get me wrong, not locking your screen is a no-go and marks you as an incompetent noob who shouldn't be allowed to handle sensitive information, but that's not my point. My ...

Continue reading ..

bashrc coolness
calendar Dec. 23, 2015   category  bash   comments 

Here's a few things I have in my ~/.bashrc that make my life easier:

Bash completion for screen sessions, so you can do 'screen -r <tab>'

complete -C "perl -e '@w=split(/ /,\$ENV{COMP_LINE},-1);\$w=pop(@w);for(qx(screen -ls)){print qq/\$1\n/ if (/^\s*\$w/&&/(\d+\.\w+)/||/\d+\.(\$w\w*)/)}'" screen

Google from the commandline:

google() {
    echo "Googling: $@"
    for term in $@; do
    xdg-open "http://www.google.com/search?q=$search"

Use ^F to search forward in your history (opposite of ^R)

bind '"\C-f": forward-search-history'

Show git status in ...

Continue reading ..

Forget SSH passphrase upon laptop suspend
calendar Dec. 21, 2015   category  bash   comments 

When you are already using a passphrase on your private SSH key (you should!), once you've entered the passphrase it will be remembered until you either logout or reboot. But most people who're using laptops only reboot when they've just updated major system components and rarely (if ever) log out.

So to secure your SSH sessions even more, add the contents of this little script to /usr/lib/systemd/system-sleep/forget-ssh.sh and make it executable:


SSH_AUTH_SOCK=/run/user/1000/keyring/ssh /usr/bin/ssh-add -D


Replace the value of SSH_AUTH_SOCK with whatever suits your ...

Continue reading ..