npm bash-conf, for sharing configs between bash and node

API keys, DB authentication, passwords, system paths and other things of that nature dont belong in a Git repo.

They belong in a lovely config file created by an install script run after cloning a repo. That’s how I try and do things these days anyway.

I use a lot of bash scripting for big queries and file manipulation, often creating strings and files in Coldfusion and saving them to Amazon S3 or the HDD for a bash script to sort out later.

So these install scripts ask for db credentials, API keys etc and you type your responses in to match the environment you’re on (production, staging, dev) and the bash scripts work away after importing the data.

I’ve started using node js for these back end processes more and more frequently now, allowing me to develop more complex scripts that are easier to debug, easier to maintain and most of all means my team mates can work on them as well!

In order to avoid having to have another JS friendly config file for my node scripts to read and also to avoid passing data in when the scripts are called I’ve written an npm module that can read the same config file bash uses.

https://www.npmjs.com/package/bash-conf

To quickly summarise how it works, I’ll just dump the usage snippet from the README. You just have to give it the path to a config file which is just a list of simple FOO=BAR style declarations

var path = process.argv[ 2 ],
BashConf = require('bash-conf'),
bashConf = new BashConf();

bashConf
.read( path )
.then(function( data ) {
console.log( 'what is foo', data.FOO );
console.log( 'this should be empty -> [', data.EMPTY_VAR, ']' );
})
.catch( function( err ) {
console.log( err );
});

If you want more info, get in touch, use Github issues or RTFM!
Also get in touch if the manual needs updating…

Screens on Linux

I’ve recently started using screens when inside command line linux.

I got shown it by some Rackspace tech guys as I wanted to leave a process running after I’d left me shell.

Screens is brilliant, it lets you run multiple shells and allows you to switch between them with keyboard shortcuts, and you can close and reopen your ssh client (like putty) and all your “screens” are still there, so you can reconnect to them… or “attach” as screens calls it.

It’s like having multiple terminal/putty windows open, except when you close the actual GUI window, the shell is still running.

What I’ve found this useful for is being logged into multiple GIT repositories and also having a couple of extra shell “screens” for database and server admin.

Anyway, this post is a little but rushed as I’m on my lunch and I’ve still not finished my super noodles, but use screens if you don’t already and you use a command line linux server.

And I’ve put up a Linux section under my code reference, with a screens page in there…

Or I will do shortly… I’ll link to the page in here once I’ve made it!

Chrome beats Firefox hands down

I’ve been using Chrome as my main browser for a while now, but I’ve always had to nip in and out of Firefox to use Firebug.

I don’t really like Opera’s dragon fly, some say it’s great but it’s too different for me to bother learning. The web tools in Safari and Chrome have some good features, but don’t (well didn’t) beat Firebug. And IE… Well, it’s IE. so it is just worse all round. So much worse.


Chrome has had a
pretty big update now though and they’ve added some cool features to the developer tools that make it more on a par with Firebug.

It’s much easier to edit styles on an element in the page, FB was always good at this and Chrome made it into an awkward and annoying hassle, but that’s been fixed.
They’ve also introduced box model highlighting on the page, that activates when you inspect an element in the DOM browser. It also shows the pixel size whilst highlighting the element. I would say this feature beats FB’s equivalent.


The Chrome toolbar also features tue Javascript debugger, like FB again, and they are almost the same in functionality but Chrome seems to just have a few more features, like “contiune to here” which FB doesn’t seem to have.


I still think the UI in Chrome is better than Firefox, it’s cleaner and easier to customize, and Firefox is slow and clunky, even without plug ins. Firefox needs lots of plugins to make it useful, Chrome has more features built in. These extra plugins in Firefox slow it down far too much, and without them it’s nomise – Firebug is one of these plugins.


Chrome Apps are nice too, although alot of them are pointless, silly and rubbish… You can get Angry Birds as a Chrome App, now that’s awesome.


Finally, to make Chrome completly amazing I did have to add a few of plugins for it. One was awesome screenshot, which is a really easy way to take screen shots of pages you’re on and save them as files or upload them to certain web services. Another one is the evernote app, which lets me “clip” web pages and text to my evernote account, and finally I installed Speed Dial 2 which replaces the Chrome Home screen.

The Chrome homescreen is pretty bad, and Google keep updating it and changing the way I’ve got ot set up. Speed Dial 2 lets you add links to your favourite web pages and apps, add a link while you’re browsing the site, rearrange the links on your home screen, change the picture for the link or let you use the view from the web page, as well as many many other things. It really is very useful.

Anyway, I’ve always loved Chrome and now I love it even more.

Those wonderful apps/plugins I was talking about are

Why you should get Dropbox

I didn’t discover Dropbox myself, it was Tom Riley who showed it to me, so I should first off say thanks to Tom.

Thanks Tom.

Ever since I’ve become aware of it however, I’ve been a huge fan, and have recommended it at every occasion. I’ve got 6 other people using it so far, that’s worth 1.5 GB (I’ll explain why later)!

You install Dropbox on your PC/Mac and/or iOS/Android device, and start saving files (photos, videos, documents etc) into it, and each devic that you’ve connected up has access to that file, instantly!

This is assuming you’ve got Internet access of course. I think Dropbox still caches local copies on your device/computer and then syncs them up when it gets access back.

Anyway, just using it like that is brilliant, being able to use, create and view files across all my devices is very useful. I don’t have to copy and paste between emails or use USB sticks or attach things to email. I just save a file, then read it later in in bed away from my PC!

But you can go so much further with it, you can share folders with people, I use it a lot to work on collaborative documents, or share photos with Holly. I sorted out my brother with an account and backed up his important docs before reinstalling windows on his PC, then we just put Dropbox back on and BOOM! all his files were just there.

And another good thing, is you can use it through a web browser, to upload and download, or just view files. You can even make files public to anyway if you want to.

Oh and there is built in version control, so if you change or delete a file by mistake, you can always go back to the previous version and restore that one, or the one before, or the one before…

There are a couple of snags though. Saving a big file or a complex folder structure can take a while to sync, as when it ‘saves’ it’s uploading to the Dropbox servers, and as all upload speeds are stupidly slow, this can take a while sometimes.

The other issue is it’s only free for 2GB. You can 250MB extra everytime ou refer someone, but that’s capped at about 8GB – this is where those referrals I mentioned really pay off, I’ve gone up to 3.5GB. You can pay for more space, but it’s a bit pricey and doesn’t get you that much, I think 50GB or 100GB are the 2 options at the moment, or very expensive enterprise accounts for hundreds of pounds.

You can work around it, multiple accounts help and it integrates well with the OS (at least it does with Windows 7) to tell you when it’s run if low on space so you can free some, so it’s not terrible.

But these two flaws in it are not that bad at all, and they are both easy to overlook or get around.

I couldn’t live without Dropbox now though. Well I could, but I’d just be spending all my time releasing my own version.

You could steal my hard disk now, I wouldn’t care (well i would, I be pissed right off, but that’s not the point). I’d just put a new one in, put my Windows install back on, download all my free software and Dropbox would have all my docs!

I love Dropbox, I love it so much I barely even think about the fact that someone else somewhere in the world has access to all my work and personal documents.

Fingers crossed they don’t go bust/get hacked/explode. If they haven’t, then get it here: http://dropbox.com

Getting things done

I’m really not that great at finishing things off. If I’ve been paid to do something, then sure I’ll plough on with it and be dedicated and focused on finishing it.

But like most others, I suck at getting my own projects done. I’ve got 25k words written of my novel, about 5 empty websites floating around the internet, a pencil outline on a canvas of an oil painting and a cardboard mess that should be a paper mâché table.

However I am starting to get things done, by making use of very spare minute of time and making simple tasks take seconds instead of minutes. This is all thanks to a variety of services available on my PC, phone and browser. They only really help me with the website and writing though… The craft stuf will still take a while.

The following amazing products make my life so much easier and help me get the right info in the right place at the right time.

To add to those are some brilliant programs for my PC (and sort of sometimes the Mac too) that make the actual work I do, when I get round to it, much easier and quicker to finish.

They’re all so good though, I’m going to review them all individually.

Also I haven’t put Eclipse in that list, and I feel I should do, but what makes Eclipse so good is all the plug-ins I use with it, like MyLyn, CFEclipse, Coldfusion Builder, Aptana etc. So that’s going to have to be a whole separate entry as well.

Anyway, coming up first is drop box…