Thursday, 12 January 2012

Quick and dirty recursive FTP

I just brought a new QNAP NAS (TS-459 Pro II) - which is pretty cool, but I needed a way of getting all my files off the old NAS (which only supported FTP). QNAP doesn't come with lftp or any other ftp package that could do recursive gets so I started looking at scripting. I found a couple out there but all written in bash or ksh, both of which are not installed on the QNAP. These didn't work in plain old sh and I didn't fancy debugging them.

In the end, I used wget from a shell on the QNAP to copy the files from my old NAS' ftp server:

wget -r --level=20 -x -nH --cut-dirs=1 -nv 'ftp://user:password@'

Here's a list of the params I used:

-r: recursive download
--level: depth to go down to (wget has a maximum of 5 if this is not given)
-x: create folders
-nv: non-verbose, but not as quiet as '-q'
-nH: Don't prefix the downloaded folder structure with the host name (in my case, '')
--cut-dirs=1: Don't prefix the downloaded folder structure with '/Stuff'

Hope it helps

Thursday, 5 January 2012

Move non-standard subversion repository into github

I had some issues when trying to migrate my svn repo into git. I think the main problem was that the docs assume that you have a standard svn layout (which I didn't).

First, create your github repo, but do not follow any of the commands that it suggests.

Then run these commands instead:

mkdir <name>
cd <name>
git svn clone -T http://<host>/<repo>/<path>/<to>/<name> .
git remote add origin<github_username>/<name>.git
git push -u origin master

Tar-dah, all done!

Some common linux commands that I forget

Check for dodgy logins :
cat /var/log/auth.log | grep 'Accepted password '

Get something off the NAS as nother user :
sudo su tomcat -c 'lftp admin@'

Check ubuntu version
cat /etc/issue

sudo apt-get update
sudo apt-get upgrade
sudo apt-get dist-upgrade
Show packages
dpkg --get-selections

Check tomcat
less /var/lib/tomcat6/logs/catalina.out

Wednesday, 4 January 2012

I Hate Facebook

Why do they insist on changing their API without prior notice? My users had been complaining since mid December that it wasn't working, but I hadn't got around to looking at it...

Their latest change had me foxed for over an hour as it wasn't obvious what was wrong. It just looked as though FB.Auth._loadState was stuck as "loading" and therefore my call-back from FB.getLoginStatus was never getting executed. Turns out that is a problem with running as localhost!

The actual problem was that they had changed the response object that gets handed to the call-back, I was checking for response.session but it is now response.authResponse, to be fair the new way is documented here, but no mention that it had changed recently - thanks.

All working again now though...enjoy:

Friday, 9 December 2011

Chrome Crash

Ack! Chrome crashed and didn't ask me if I wanted to restore when it came back (as it updated itself?)

Maybe not a problem if you have a few tabs open - but I'm a tab-aholic; I have 15 windows open, each with an average of 10 tabs. You try remembering what all those 150 tabs were!

Anyway, after a lot of google searching (who would have thought that "chrome restore session" & "chrome has lost my last session" would not turn up useful tips), I finally stumbled upon - it saved my life (well, session at least)