Node.js and Express with HTTPS

Quoting from the doco + some missing stuff: var express = require('express'); var https = require('https'); var http = require('http'); var app = express(); var fs = require('fs'); var options = { key: fs.readFileSync('test/fixtures/keys/agent2-key.pem'), cert: fs.readFileSync('test/fixtures/keys/agent2-cert.pem') }; http.createServer(app).listen(80); https.createServer(options, app).listen(443); nJoy 😉

Replacing a piece of XML with awk

This script searches for an initial tag and and closing one and replaces the content. # !/bin/bash awk ‘ BEGIN {pr = 1;one = 0} /<Name>OPENING<\/Name>/ {pr = 0;} { if (pr) print } { if (!pr && !one) {print (“\t\t <Name>OPENING</Name> \n \t\t\t <Value>false</Value> \n \t\t<Type>STOPHERE</Type> \n ” ); one =1 ;}} /<Type>STOPHERE<\/Type>/ {pr…

Track ftp password from tcpdump Linux

Very nice and simple: tcpdump port ftp -l -A | egrep -i ‘pass=|pwd=|log=|login=|user=|username=|pw=|passw=|passwd=|password=|pass:|user:|username:|password:|login:|pass |user ‘ –color=auto –line-buffered -B20 nJoy  😉

Adding all new files and subdirs to svn

Sometimes you find yourself catching up with some devs who did not care to add all the stuff they should to SVN or you want to make sure all files are in SVN. Well here’s a hand script : svn status | awk ‘{if ($1 == “?”) print $2 }’ | xargs svn add nJoy…