Snapshot backup using cp -al and rsync

This script requires genuine cp -al capable gnu and rsync commands together with a hardlink capable FS + OS.     #!/bin/bash [ $# -ne 2 ] && echo “Incorrect usage : $0 <source path> <target path>” && exit 128 ; SOURCEFOLDER=$1 TARGETFOLDER=$2 SF_LEN=${#SOURCEFOLDER}-1 TF_LEN=${#TARGETFOLDER}-1 #echo “Last character in source folder is ${SOURCEFOLDER:SF_LEN}” if [ […]

Simple page to redirect to https from index.html

<html> <head> <title> Redirecting…</title></head> <script language=”JavaScript”> function redirectHttpToHttps() { var httpURL= window.location.hostname + window.location.pathname +; var httpsURL= “https://” + httpURL; window.location = httpsURL; } redirectHttpToHttps(); </script> <body> </body> </html>   nJoy πŸ˜‰

Installing node on old version of Ubuntu 10.04

curl -o- | bash logoff and log on nvm ls-remote nvm install v7.9.0 npm -v node -v Caveat : Β  Lots of node stuff fails to compile and run on such an oldΒ version of linux be warned… Thats it you now have node and npm installed. nJoy πŸ˜‰

Saving a million documents in Mongo using Nodejs and mongodb module

/** * Created by davidsaliba on 13/03/2017. */ var MongoClient = require('mongodb').MongoClient , format = require('util').format; var url = 'mongodb://localhost:27017/test'; var async = require ('async'); var entry = { data : "skdlfjsdf", array : [ {id:"arr_obj1"} , {id:"arr_obj2"} ] }; var entries = []; var total_entries = 1000000 for (var j = 0 ; j […]

Installing git on Debian 8.x

You should edit your sources.list , by adding the following line: deb jessie main contrib Then upgrade your package and install git: apt-get update &amp;&amp; apt-get upgrade &amp;&amp; apt-get dist-upgrade apt-get -f install apt-get install git nJoy πŸ˜‰