SpiderOak Purge Historical versions

I don’t like the default for SpiderOak’s –purge-historical-versions command, which does this:

This allows you to remove historical versions of files in your backup set according to the following schedule, which is to keep one version per hour for the last 24 hours, then one version per day for 30 days, then one version per week thereafter.

So here’s my own version, which does:

  • One version per hour for the last 24 hours
  • Then one version per day for 14 days
  • Then one version per week for 8 weeks
  • Then one version per month thereafter

On Windows
"C:\Program Files\SpiderOakONE\SpiderOakONE.exe" --purge-historical-versions h24,d30,w8,m --verbose

On Linux
SpiderOakONE --purge-historical-versions h24,d30,w8,m --verbose

Gimp Plugin – fixed crop

This is a simple script to crop a plugin with fixed dimensions – I used it to crop out the window border from a VNC Client connected to an industrial touchscreen.

(script-fu-register
    "script-fu-crop"                    ;func name
    "Screenshot Crop"                   ;menu label
    "Crops an image to a fixed size"    ;description
    "Sandy Scott"                       ;author
    ""                                  ;copyright notice
    "January 11, 2015"                  ;date created
    ""               ;image type that the script works on
    SF-IMAGE    "Image"                 0
    SF-DRAWABLE "Drawable"              0
)
(script-fu-menu-register "script-fu-crop" "/Filters/Custom/")
(define (script-fu-crop image drawable)

    ; Prep
    (gimp-context-push)
    (gimp-image-undo-group-start image)
    
    ; Crop the image
    (gimp-image-crop image 800 480 8 30)
    
    ; Finishing Off
    (gimp-image-undo-group-end image)
    (gimp-context-pop)
    (gimp-displays-flush)
)

Save in the gimp scripts folder, something like C:\Users\JoeBloggs\.gimp-2.8\scripts\ on Windows, or /home/JoeBloggs/.gimp-2.8/scripts/ on Linux.

It will appear under Filters > Custom

Updating WordPress

Updating wordpress:

mkdir ~/temp
cd ~/temp/
wget http://wordpress.org/latest.tar.gz
tar -xzvf latest.tar.gz

cd /var/www/html/

sudo rm -Rf wp-admin/
sudo rm -Rf wp-includes/

sudo cp -R ~/temp/wordpress/wp-admin/ .
sudo cp -R ~/temp/wordpress/wp-includes/ .


rsync -vcrultO ~/temp/wordpress/wp-content/ wp-content/

sudo chgrp -R apache .
sudo chown -R apache .

rsync -nvcrultO --exclude 'wp-content' --exclude 'wp-includes' --exclude 'wp-admin' ~/temp/wordpress/* .

Set-up SpiderOak on CentOS

Download the relevant SpiderOak binary – for the 32-bit Fedora installer it’s:

wget https://spideroak.com/getbuild?platform=fedora&arch=i386

Install

sudo yum install spideroak-download-file.rpm

Set up, using interactive mode

/usr/bin/SpiderOak --setup=-

Enter details and protect your data!

Use cron to run this command as frequently as necessary

/usr/bin/SpiderOak --batchmode

VirtualBox direct access to SD Card in Windows

I’ve trying to get my Raspberry Pi working with a touchscreen (eGalax Touch).

This blog post has been an incredible help, but I stumbled at the very last hurdle – modifying the contents of the SD card.

You see, my compile system (Ubuntu 13.04) was in a virtual machine (VM) – VirtualBox running on Windows 7.

Windows 7 doesn’t know how to read the various linux filesystems, so they’re invisible, which means I needed to access to the whole, raw disk directly from the VM.

Here’s a step-by-step guide to directly mounting raw SD card in your virtual machine, so you can edit it.

    1. Get the DeviceID for you SD Card reader

Open a command window as an administrator. (Press Start, type cmd, right click on cmd.exe in the list, and choose “Run as administrator”)

type

wmic diskdrive list brief

and if your system is anything like mine you’ll get something like this:

C:\Users\Sandy Scott>wmic diskdrive list brief
Caption                      DeviceID            Model                        Partitions  Size
WDC WD7500BPKT-75PK4T0       \\.\PHYSICALDRIVE0  WDC WD7500BPKT-75PK4T0       3           750153761280
O2Micro SD SCSI Disk Device  \\.\PHYSICALDRIVE1  O2Micro SD SCSI Disk Device  1           3964584960

The top item is the main hard drive, the lower one is the SD card.

The bit we’re interested in is the DeviceID, in this case \\.\PHYSICALDRIVE1

    1. Navigate to the VirtualBox directory

Next thing you’ll need to find is the installation directory for VirtualBox. This is usually C:\Program Files\Oracle\VirtualBox\. You’ll know it’s the right one if it has lots of files starting with VBox in it.

Go there by entering this command

cd C:\Program Files\Oracle\VirtualBox
    1. Create the link file to the SD card
VBoxManage internalcommands createrawvmdk -filename "%USERPROFILE%/Desktop/sdcard.vmdk" -rawdisk "\\.\PHYSICALDRIVE1"

The file you’ve just created (sdcard.vmdk, on your Desktop) is a special link that lets a virtual machine access the SD card.

    1. Connect the VM to the SD card using the link

Now, open VirtualBox as Administrator, and open the Settings for your virtual machine. Go to Storage -> Controller: SATA -> (right click) Add Hard Disk -> Choose Existing Disk and open the file you just created.

Fire up the VM and you should be able to access the SD card in all it’s glory!