Create and mount a VDI image (in Debian 8 Jessie)

This will probably work in most Linux distributions, but this is how I did it in Debian 8 Jessie.

Install qemu-utils:

sudo apt-get install qemu-utils

Load nbd kernel module:

sudo rmmod nbd
(only necessary if nbd is already loaded)
sudo modprobe nbd max_part=16
(/dev/nbd0 to /dev/nbd15  will appear after that command)

Create and mount a new VDI image:

qemu-img create -f vdi test.vdi 120G

Connect to the image:

sudo qemu-nbd -c /dev/nbd0 test.vdi
sudo partprobe /dev/nbd0

Create a primary partition in the image using fdisk:

sudo fdisk /dev/nbd0
(type: n enter p enter enter enter enter w)
(/dev/nbd0p1 will appear after that last command)

Create an ext4 file system on the image’s first partition:

sudo mkfs.ext4 /dev/nbd0p1

Mount the VDI image partition:

sudo mount /dev/nbd0p1 /mnt

Mount an existing VDI image:

Assuming it’s got a formatted partition already.

Connect and mount the image:

sudo qemu-nbd -c /dev/nbd0 test.vdi
(/dev/nbd0p1 will appear after that command if the image contains a partition)
sudo mount /dev/nbd0p1 /mnt

Dismount and disconnect the image:

sudo umount /mnt
sudo qemu-nbd -d /dev/nbd0
(/dev/nbd0p1 will disappear after the last command)

XHTML strict Google reCAPTCHA 2.0

This is all the code you need to make your XHTML pass the W3C Markup Validation:

<div id="recaptcha" class="g-recaptcha"></div>
<script type="text/javascript">
var recaptchaOnLoadCallback = function() {
 grecaptcha.render('recaptcha', {
 'sitekey' : "_your_key_here_"
<script src=";render=explicit&amp;hl=en" type="text/javascript" defer="defer"></script>

Script for creating self-signed SSL certificates for Apache

Instead of remembering the procedure, just run this script with the fully qualified server name as argument.


Modify the constants at the top in the code below to suite your situation:



warn () {
        #echo "$0:" "$@" >&2
        echo "$@" >&2
die () {
        warn "$@"
        exit $rc

if [ $(id -u) -ne 0 ]; then
        die 1 "This script must be executed as root!";
if [ $# -ne 1 ]; then
        die 1 "You must pass the server name as argument!";
if [ $(echo "$1" | grep -Eq '^[a-z0-9]+(\.[a-z0-9]+)+$'; echo $?) -ne 0 ]; then
        die 1 "Bad syntax in server name argument: $1";

#echo $dir;

if [ ! -d $dir ]; then
        mkdir $dir || exit 2;

echo "Generate RSA private key"
openssl genrsa -des3 -passout pass:x -out "$dir/selfsigned.pass.key" 2048 || exit 2;

echo "Remove password from RSA private key"
openssl rsa -passin pass:x -in "$dir/selfsigned.pass.key" -out "$dir/selfsigned.key" || exit 2;

echo "Remove the original private key"
rm "$dir/selfsigned.pass.key" || exit 2;

echo "Generate Certificate Signing Request"
openssl req -subj "/C=$COUNTRY/ST=$STATE/L=$CITY/O=$ORGANISATION/CN=$name" -new -key "$dir/selfsigned.key" -out "$dir/selfsigned.csr" || exit 2;

echo "Generate self-signed certificate from selfsigned.key private key and selfsigned.csr"
openssl x509 -req -days 365 -in "$dir/selfsigned.csr" -signkey "$dir/selfsigned.key" -out "$dir/selfsigned.crt"
echo "Done"

echo "Now add these extra lines to your $name SSL VirtualHost block:"
echo "  ServerName $name"
echo "  SSLEngine on"
echo "  SSLCertificateFile $dir/selfsigned.crt"
echo "  SSLCertificateKeyFile $dir/selfsigned.key"</pre>

FrSky X4R receiver hack for 3 SBUS outputs, and 1 analog RSSI output

For multirotors and autopilots, the standard ports on receivers such as the X4R are of no use. All I need is SBUS and RSSI. So I modified my X4R, replacing the standard ports with those listed in the title.

Disabled the ports for ch 1 to 3 by removing 3 resistors and 3 capacitors (top left area in photo).
Linked the SBUS output to the CH2 and CH3 outputs using silicone covered servo wire in order to have 3 SBUS outputs. That’s more than I’ll ever need, and I’ve only needed 2 once before and this is an easy way to not require a Y-cable.


Then I made an RC-filter  (10KΩ & 10µF) using thin PCB and SMD components and stuck that to the board using transparent rubbery double sided tape. Then I connected the PWM RSSI tab (near the 1 antenna) to the RC filter, which in turn is connected to the CH1 output.


Closed the patient, and added some labels.


I tested it all and it works fine.