Super sexy mysql backups

This will give you backups of all your mysql data, nicely versioned with git, securely stored in S3.

There are plenty of guides out there on how git, and S3 work. There are less on how jgit works, but there are still some around. This is just the bare bones to get you up and running as quickly as possible. If anything is unclear, hit me in the comments.

Download jgit.sh (http://www.eclipse.org/jgit/download/)
enable partner repository
sudo apt-get update
sudo apt-get install sun-java6-jre

edit:: jgit seems to work fine with the openjdk, and AWS has a kernel bug where installing the sun package on a t1.micro instance causes the machine to freak out. Only occurs in some availability zones. Had some fun figuring that out!

sudo apt-get install openjdk-6-jre-headless

vim ~/.jgit
accesskey: ACCESSKEY
secretkey: SECRETKEY

mkdir s3backup
cd s3backup
git init
mysqldump DBNAME -u USERNAME -r dump.sql –skip-comments
git add dump.sql
git commit dump.sql -m “Initial commit”
git remote add s3 amazon-s3://.jgit@BUCKETNAME/SOMEPROJECTNAME.git
~/jgit.sh push s3

Cron script contents:

#!/bin/bash
d=”`date`”
cd /home/ubuntu/s3backup
mysqldump DBNAME -u USERNAME -r dump.sql –skip-comments
git commit cpanel.sql -m “$d”
git gc
~/jgit.sh push s3

To get data back:

~/jgit.sh clone amazon-s3://.jgit@BUCKETNAME/PROJECTNAME.git
git log
git reset –hard THEHASHIDOFYOURDATABASEBEFOREYOUMESSEDITUP

Posted in Uncategorized | 2 Comments

Install NodeJS on a default Amazon EC2 instance

There are a few guides to this floating around, but Amazon must have changed a few things about their default micro instances as all the ones I found are out of date. Even the instructions built into AWS about how to connect to your instance are out of date!

I assume you’ve got your instance set up in AWS, if not, go do that and then come back. There’s plenty of info out there.

Ssh into your instance. AWS tells you to use this command:

ssh -i test.pem root@xxxx.compute-1.amazonaws.com

However, logging in as root won’t work. You need:

ssh -i ./test.pem ec2-user@xxxx.compute-1.amazonaws.com

Now you need to install a few prerequisites.

sudo yum install gcc-c++ openssl-devel make

Now grab Node. This version is current as at 25-May-2011. Check http://nodejs.org/#download for changes

wget http://nodejs.org/dist/node-v0.4.8.tar.gz

Untar it

tar -xvvf node-v0.4.8.tar.gz

Change into the correct directory:

cd node-v0.4.8

Configure it:

./configure

Make it (on a micro instance, this will take exactly forever):

make

Install it

sudo make install

Job done!

Posted in NodeJS | Tagged , , , , | 2 Comments

Tomboy and KDE, making it happen

I run Kubuntu Jaunty with KDE4 on my netbook. BasKet wasn’t doing it for me so I tried to get Tomboy happening. Problem was, it would abort with a SIGSEGV and complain about errors in mono any time I tried to run it. I couldn’t find anything out there that suggested a workaround, so I set about building a newer version than was in the repos from source. Couldn’t get that happening, but in my travels I installed the package gnome-doc-utils and BAM, it worked.

So, if you’re having issues with Tomboy refusing to start under KDE4, have a crack at:

sudo apt-get install gnome-doc-utils

Let me know in comments if it does the trick.

Posted in | Leave a comment

Huawei e169 on linux. It can be done!

::EDIT:: As mentioned in some comments below, these devices are now supported out of the box on newer versions of Ubuntu.

After much buggering about, I finally got this *&#$# Huawei e169 working. This method requires no mucking around in the kernel, just the usb_modeswitch utility and wvdial. For reference, this was a unit supplied from Optus in Australia for their Optus Wireless Broadband service. It’s set up on an old laptop running Ubuntu 8.04, Hardy Heron. There’s no good guide out there for the e169 at the time of writing.First, grab usb_modeswitch from http://www.draisberghof.de/usb_modeswitch/There’s nothing to install, you just need the compiled executable. There’s a config file, but I found it far simpler to just use command line arguments. The commands for the e169 need to be executed in order, and they’re as follows:

./usb_modeswitch -v 0x12d1 -p 0×1001 -d 1./usb_modeswitch -v 0x12d1 -p 0×1001 -H 1

Once that’s done, the device should be recognised and /dev/ttyUSB0 should be created. Yay!Now, you need to spend a second setting up /etc/wvdial.conf The below should be pretty universal:

[Dialer Defaults]Phone = *99#Username = *Password = *New PPPD = yes

wvdial looks for a device at /dev/modem, but ours is at /dev/ttyUSB0. My somewhat hacky solution was

sudo ln /dev/ttyUSB0 /dev/modemJerome in the comments has suggested adding this section to the conf file instead of creating a link as above. It’s untested by me, but looks like it should work fine. It’s a much cleaner solution than the crossed out one above, too. Add it right at the beginning of the file.[Modem0]Modem = /dev/ttyUSB0If you use this solution (which you should) remove the “sudo ln…” lines from connect.sh.

Now, just executing wvdial in a terminal should get you connected. It takes a little while, about 30 seconds I guess, but the important thing is that it works, and it’s pretty simple.Since this connection is on a laptop intended for my grandfather, who is a fairly new computer user, I wanted to make the connection automatic in order to simplify things. I put this script in /etc/init.d/ which worked a treat. http://dbe.cc/pub/connect.shDon’t forget to run sudo update-rc.d connect.sh defaultsThe script will need to be tweaked to include the location of the usb_modeswitch executable on your system. Unless your username happens to be brian and it’s in a directory called .huawei under your home folder. That’d be a pretty crazy coincidence though. If people are actually finding this post and using the script I’ll update it to be more user friendly. Naturally, if you don’t want it executing on boot, you can just save the script as an executable and run it (as root) when you please.Also:Because this connection doesn’t run through network-manager, it confuses firefox a little. All it means is that firefox starts itself in offline mode. You can just untick “Work offline” in the File menu. I solved it more permanently with instructions from here: http://ubuntuforums.org/showthread.php?t=767045It’s late, so if there’s anything I’ve missed or anything that’s unclear, please let me know in the comments. I’ll do my best to help out.

Posted in , , | Leave a comment

Openmoko

It’s really, really paining me to watch the beating that the openmoko project is currently taking. I’ve been majorly into this idea for some time now, about half way through ’07. FOSS is a brilliant thing, and it’s only a matter of time before the telecommunications industry wakes up to that. After all, Linux sprouted from Unix which sprouted from a telco.

Sadly, it looks like the openmoko team has set the effort back a fair ways. It’s been released before it was ready and Dave Fayram has pointed that out. I thought Dave gave a reasonably fair assesment. He doesn’t seem to have spent much time with the manual, but most users don’t. His review has unfortunately been leapt upon by every Apple fanboy out there and it’sgaining a life of it’s own.

I’m a rank outsider, no involvement in the project whatsoever aside from voraciously reading news about it for the past 12 months. Frankly, it seems that it’s been mismanaged by FIC. There has been a fair amount of disgruntlement coming from the developers working for the company. The fact that they switched from the original GTK platoform to the qtopia stack at the eleventh hour smacked of desperation.

This wouldn’t really bother me if it wasn’t for the fact that openmoko had gained so much media attention. So often you hear outlets talking about the triumverate of iPhone, Android and openmoko. Up until this week I’ve been really proud to see such a rabidly open source project be given that much airtime. It’s frustrating to now find out that they weren’t deserving of it.

I think those of us looking for an open source phone now need to turn towards the slightly-open-source-but-not-really Android, and hope like hell that something great comes out of Nokia’s plans for opening up Symbian.

Posted in , , , | Leave a comment

It Hath Begun.

Fucking World Youth Day.

I decided to go for a ride today to check out the local walking/riding trails around Willoughby leisure centre and see if there was any decent mountain biking to be had. There’s a whole bunch of concreted paths down there that are shared between pedestrians and bikes.

I was riding down one path when I saw a police motorcycle coming the other way. I was confused, until I saw a bunch of people walking behind it, many in World Youth Day Staff outfits taking up the entire path.

I considered moving over to the left and trying to ride around them, but then realised I didn’t want to be “annoying”. I pulled off onto a grassy area by the side of the path to wait it out. As I sat on my bike I got a whole bunch of greasy looks from the police, presumably they were sizing me up wondering if I was going to be a nuisance.

All up, there were two police motorcycles, four more police on foot and about 10 WYD staff members. This was all for about 20 – 30 pilgrims, doing nothing more than walking along a fucking path in the suburbs. As I rode home, I saw another police car and two more bikes directing traffic, I presume they were there for the same group.

For starters, what a goddamned waste of police resources. Secondly, why the hell was I made to feel like a criminal in my own suburb for some freaking god-botherers? Why did none of them even make a token effort to move over and let me past? Why was I glared at for sitting on my bike and watching them pass? The whole “Do not look upon them for they are holier than thou” attitude shits me to no end.

It Hath Begun.

Posted in | Leave a comment

Ghosts and the Creative Commons license.

Trent Reznor recently released the latest Nine Inch Nails album in a really, really interesting way. The confluence of marketing-geekery and copyleft-geekery that it represents tickled my fancy.

While his decision to release several SKUs at various price-points is the best new-wave digital distribution technique I’ve seen to date, it’s his choice to license the work under a version of the Creative Commons license that I think is really interesting, and has been overlooked by a lot of the comment I’ve read.

Basically, you can do whatever you please with Ghosts I – IV provided you don’t sell it to anyone, provided you don’t pretend that you or someone other than the original artists created it, and provided that you keep the license intact if you remix it.

So, I could take the FLAC copy I just paid Trent for and stick it on The Pirate Bay perfectly legally.

I see this as a watershed moment for Creative Commons. This is the first mainstream use of the license that I’m aware of. If Trent makes money despite the fact that people can legally give the album to everyone they know, it will say a lot of profound things about the emerging marketplaces for creative works.

First and foremost, it will make the RIAA’s ceaseless lawsuits look a bit silly. They’re telling us that the entire reason the music industry’s profits are declining are because of sharing. And yet here’s an artist that has essentially given his work away for free, and yet by all reports he’s made $750k within a few days. Granted, he had to apply some novel thinking to do it. He had to be a little bit *gasp* creative!

Maybe the mainstream record labels could do the same. I’m not saying they should adopt Trent’s model completely (although they could do worse) but just to inject some bold, fresh, risky thinking into their own models.

Posted in , , , | Leave a comment

Change the default action of the power button in KDE 3/Kubuntu.

When Gutsy came out recently I decided to make the switch from Gnome to KDE. Overall I like it, but there are some things that are driving me nuts. One of them is that there seems to be no way to change the default action of the power button on my laptop. This was easy to change in Gnome, but requires more trickery in KDE.

After a while of searching around in control panels and on Google, it became apparent that the answer I sought did not lay in a GUI. Thankfully, the acpi config files are very easy to edit.

All you need to do is go to /etc/acpi/events and find the file named powerbtn. It’s good practice to make a backup at this point. Copy the file to something like powerbtn.bak. Now click the handy “edit as root” button in Dolphin.

Alternately, if you’re comfortable in a terminal, it’s much simpler to just issue the following command:

sudo cp /etc/acpi/events/powerbtn /etc/acpi/events/powerbtn.bak && sudo kate /etc/acpi/events/powerbtn

Once in there, find the line action=/etc/acpi/powerbtn.sh and change it to the following:

action=/etc/acpi/hibernate.sh

Save it and you’re done. You’ll need to restard acpid (or just reboot the whole os) before the change will take effect.

What this change does is, instead of telling the system to run the “ask the user what they want to do” script when the power button is pressed, it tells the system to run the “hibernate now” script when the button is pressed.

Posted in | Leave a comment

Motorcycle!

I’ve been lax in posting about it, but a few weeks ago I finally bought my first motorbike. I’ve been moving towards this for years, but it hasn’t come together, mainly for reasons of money. I finally pulled the trigger on a Sachs Madass 125. It’s a little bike, but it has a few main attributes.

  • It’s cheap. $3500 on road.
  • It’s light, so it’s dead easy to ride and manouver.
  • The build quality is great. The frame has some really pretty welds.
  • It’s cheap.
  • The engine is a knock off of the Honda CT110 with a bigger head on it, so it’s pretty much bulletproof.
  • It looks awesome.
  • It’s cheap.

I can definitely see myself picking up a bigger bike in the future (the Triumph Scrambler, Husqvarna SM610 and the Honda CB1300 spring to mind. Mmmmmm.) But while I’m at uni this little machine is great for getting me around.

I’m also having a hell of a lot of fun riding it. My skill levels are improving constantly, and I’m pushing myself harder and harder to get better. Also, I dragged off a bloke on a Suzuki Across on Saturday. Sure, he was a learner who seemed to be struggling really badly, but I beat him nonetheless.

Posted in | Leave a comment

I want this phone.

My technolust is raging for the Neo1973 from FIC and OpenMoko. It’s a Linux based smartphone with a retardedly high resolution screen, coming out in October. The developer version is already out (this isn’t vapourware), but it lacks a few features like WiFi.

I’m just really, really excited for a completely open phone. I’m currently using a Sony Ericsson k800i, which is a great phone, but it’s loaded with this goddamned Optus My Zoo Now java app that can’t be removed. The shortcut to it is located on the same softkey as the hang up button, meaning that if someone I’m talking to hangs up a call before I do, it loads. This wouldn’t be too much of a problem, except that it’s really, really poorly written and takes a good few minutes to load, during which time you can’t do anything else on the phone. If you try and kill it early, it usually crashes the phone. This is very frustrating behaviour.

Having a completely open phone will mean that crap like this doesn’t happen. Having a phone that runs on Linux will mean that I can use tools like cron. My dream is to have the phone set to automatically mirror smh.com.au/text every morning while it’s at home on my home WiFi network. That’s the main thing I use my data connection for anyway, and it doesn’t change throughout the day. I could have the entire newspaper sitting locally on my phone, loading lightning fast, and it wouldn’t cost me a cent. If I could get that set up the lack of UMTS wouldn’t even bother me.

Also, it would support SyncML meaning I could sync it up with whatever I please. No vendor lock-in like with ActiveSync, gah.

All in all, October is going to be a great month for geekery. Gutsy Gibbon drops and the consumer version of the Neo1973 is released to market. Glee!

Posted in | Leave a comment