Default changes to Vim

Quick post for future reference.

Just installed Debian or Ubuntu, need Vim back to what you’re used to?

edit /etc/vim/vimrc

uncomment
set background=dark
add
set autoindent
set expandtab
set softtabstop=2
set shiftwidth=2

Tabs are now always (2) spaces and you can actually see the text.

Don’t forget to add export EDITOR=vim to .bashrc either.

MySQL one-liner to obfuscate live user details

Problem: you need to get someone else to set up your web application on another server. Even with a signed NDA it’s not really a good idea to be sending over MySQL dumps containing real people’s details and it is almost certainly against data protection rules.

If so, and you need to do it right now, then this’ll do you nicely as a quick & dirty hack. Clearly, if you had some more time then you could come up with something a bit more elegant.
UPDATE some_table 
/** in this case it's an email address */
SET username = CONCAT(SUBSTRING(MD5(RAND()), -10), "@", SUBSTRING(MD5(RAND()), -10), ".com"), 
PASSWORD = SUBSTRING(MD5(RAND()), -10)
/** this might be some IDs that you want to remain unchanged, say a test login */
WHERE (id != 1);

Scarlett’s Energy Saving Mission

My youngest (5) came home from school this week with some homework relating to her school’s theme of educating the kids on ways to save energy.

The premise was to involve the entire family in looking at devices that are left switched on in the home that might be power hungry.

I jumped on this and may have got ever-so-slightly carried away.

My Scarlett’s homework follows:

—–

We have a device fitted to the house electricity meter it sends a signal to a display unit in the kitchen.

Image

Continue reading

Unable to programmatically download a Onenote file from Skydrive

ImageThis is not a how-to it is more of a how-do-i? The thinking is that if I distill the problem into words I may figure out where I’m going wrong.

Also, there’s always the outside chance that someone else might have the answer and put me out of my misery.

I’ll map out the problem in detail below with some background for context. If you want to cut to the chase then the summary of the problem is here.

Continue reading

Woodland for sale

P1010154Ever since I visited Ben Law and spent a week learning in some detail how he built his amazing house from trees in his woodland I have dreamt of doing something similar.

So much so that when it became available we scraped up the money and bought a 4 acre plantation of slow-grown, straight and tall Japanese Larch that was perfect as a building material.

A year later we found a suitable building plot and sank all of our savings into purchasing it with a view of building our house.

Continue reading

Building a PHP development server from scratch

php-logoThe other day my dev server completely died, this was rather inconvenient to say the least. 24 hrs later and my new (excellent, very quiet, powerful but only consuming 150w) HP 54L Proliant Microserver was sitting on my desk ready for building.

I’ve done a server build so often that I can do it with my eyes closed , but usually miss something, so as I was in a hurry I referred to my previous post of the same name. As I did so the fact that it’s 7 years out of date became apparent. Compiling from source? Nah. Where’s Git? Not using sudo?

So, here I am re-writing from scratch for 2013…

Following these instructions will get you a Debian based PHP/MySQL development server set-up with the ability to have multiple developer sandboxes that are accessible from a remote machine on the local network, using Samba.

Time needed < 1hr

Continue reading