Up and running with Express (Express series 1)

For those who don’t know, Express is a web server framework that runs on Node.js. Basically, if you want to write a web application in node.js, express is one of your options. I prefer it because of its simplicity.

The quickest way to write an express application is to use the express npm module. If you haven’t got it, install it by executing:
Continue reading

Managing your executable Java project with Gradle

I’ve been using Gradle for a while now and have quite used to it. Most of my Java projects are web applications so all Gradle has to do is to build them. Once built, I can just plop the war file onto tomcat and it just works. However, when I’m trying something out, I just need a simple .java file which I manually compile with javac and then run it with java command. This works most of the time, except when I wanted to try out something complex, something that uses loads of external libaries. Something like this normally needs a dependency management system like Gradle. Using my normal Gradle configuration, I got it to build the project really easily, however running it was quite difficult. Continue reading

Streaming an archive from a server over SSH and extracting it on the fly

I’d found this command a while ago now but had completely forgotten about it until I stumbled upon it yesterday. So, if you had one or more tar files on a server and wanted to get them all down and then extract them somewhere to do your work, the normal way to achieve that would be:

scp awesomeuser@awesomeserver:/tmp/mytarfile.tar /storage/

The problem with this is that its a two step action. 1) You download the tar file(s). 2) You extract the downloaded tar file(s). While this is “functional”, here’s an awesome way to do it: Continue reading

Finding text in text files within multiple tar archives without extracting any file onto the file system

So I was working the other day and then suddenly I had a need to find a piece of text within loads of text files contained across multitude of tar files. In a normal case, you’d extract them all somewhere in temp directory and then use grep to find the text you want. However, this doesn’t work very well when the tar files you have are in thousands. Also, there is something uncool about doing stuff manually when you’re in a world where there’s always a better way.

After an hour of experimentation, I found the following magic command: Continue reading