Quick and dirty bash script to apt-get update all OpenVZ containers

By , 2011-11-30 22:29

It’s a bit of a pain having to run upgrades on all servers. I could of course, set up unattended upgrades, but I always liked initiating the upgrade process myself. So I wrote a little bash script that will initiate apt-get update and apt-get upgrade on all running OpenVZ containers.

Note that this only works for Debian-based distros. So Debian, *buntu, Linux Mint and the like.

It’s very rough, no error-handling or safeguards, so use at your own risk. Works for me, but YMMV.

#!/bin/bash
#Delete temp file
rm /tmp/tmp-script.sh
#Get running VZ
CTIDS=$(vzlist | awk '{print $1}' | sed -e '/CTID/d' -e ':a;N;$!ba;s/\n/ /g' )
# Echo list of running IDs
echo "$CTIDS"
CTIDarray=($CTIDS)
for x in ${CTIDarray[@]}
do
    echo "#/bin/bash" > /tmp/tmp-script.sh
    chmod +x /tmp/tmp-script.sh
    echo vzctl exec $x "apt-get update &&;  apt-get -y upgrade" >> /tmp/tmp-script.sh
    screen -d -m /tmp/tmp-script.sh
done
#Delete temp file
rm /tmp/tmp-script.sh
#Show running screens
screen -x

First, we rm the /tmp/tmp-script.sh. Starting off with very bad form, I know, feeling lazy right now. Then I use awk and sed to get the IDs of running containers from the output of the vzlist command, and place them on a single line, separated by spaces. Those IDs are than put in an array, so that the update command can be called using a for loop.

For some reason, I couldn’t get screen to launch the

vzctl exec $x "apt-get update &&  apt-get -y upgrade"

command directly, hence the hideous use of a temp file. If anyone can fix/improve this, I would be glad to hear from you!

Screengrab for Firefox

By , 2011-11-23 23:04

Update: Here are a few alternatives that use Webkit:
http://derailer.org/paparazzi/
http://cutycapt.sourceforge.net/

Just discovered an old but good add-on for Firefox: Screengrab.

Unfortunately the author has discontinued development, citing that he was unable to keep up with the increased pace of Firefox development.

Fortunately, the extension still works great on Firefox 9.0 beta with the good ol’ install.rdf edit. I’ve attached it below, along with an example screenshot produced by Screengrab.

screengrab-0.96.3-maxVersionmod.xpi

(Right click and download or open image in new window/tab for full view)

Fix scrolling in GTK apps (Pidgin) on Windows

By , 2011-11-15 18:45

Synaptics makes great touch technology. Their performance and drivers have always been, in my experience, much better than their Alps counterparts.

Except in one specific situation: using the trackpad’s edge scrolling feature in Pidgin.

Turns out the problem is because the Synaptics touchpad enhancer app displays a custom cursor while scrolling in such a way that prevents GTK apps from reading the scrolling action. Not sure on what end the bug is, but the good news is there’s a simple registry fix:

Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SOFTWARE\Synaptics\SynTPEnh]
"UseScrollCursor"=dword:00000000

Either copy-paste the above into Notepad and save as “DisableSynTPCursor-FixScrollPidgin.reg” or something less complex, and import it into the registry. Or make the change manually.

Fix thanks to mindelirium88. http://developer.pidgin.im/ticket/10768

Checking Gmail on a monochrome terminal

By , 2011-11-11 19:44

image

is deliciously retro-nostalgic.

Also, e-mail is in a really sad state following the advent of Facebook. Does anyone want to send me a real e-mail? Please?

Custom theme by me. Based on Panorama by Themocracy